PHP Class Nabble\SemaltBlocker\Blocker

Show file Open project: nabble/semalt-blocker Class Usage Examples

Public Properties

Property Type Description
$explanation

Public Methods

Method Description
blocked ( $verbose = false )
blocked ( boolean $verbose = false ) : boolean | string
explain ( )
explain ( ) : string
forbidden ( ) Send a 403 Forbidden header.
getBlocklist ( )
getBlocklist ( ) : array
getBlocklistFilename ( )
getBlocklistFilename ( ) : string
isRefererOnBlocklist ( )
isRefererOnBlocklist ( ) : boolean The public use of this function is undocumented.
isUrlOnBlocklist ( $url, $entity = 'url' )
isUrlOnBlocklist ( string $url, string $entity = 'url' ) : boolean The public use of this function is undocumented.
protect ( $action = '' )
protect ( string $action = '' ) Block a page if referer is found on list of blocked domains.

Private Methods

Method Description
blockAction ( $action = '' )
blockAction ( string $action = '' ) Execute desired action.
cls ( ) Clear output buffer.
concatenateBlocklist ( $blocklistContent )
concatenateBlocklist ( string $blocklistContent ) : string
doBlock ( $action = '' )
doBlock ( string $action = '' ) Responsible for sending action output.
getBlocklistContents ( )
getBlocklistContents ( ) : string
getConcatenateBlocklist ( )
getConcatenateBlocklist ( ) : string
getHttpReferer ( )
getHttpReferer ( ) : string | null Returns HTTP Referer if it is available and not empty, null otherwise.
parseBlocklist ( $blocklistContent )
parseBlocklist ( string $blocklistContent ) : array
redirect ( $url )
redirect ( string $url ) Redirect to a url by sending the appropriate header.

Method Details

blocked() public static method

public static blocked ( $verbose = false )

blocked() public static method

public static blocked ( boolean $verbose = false ) : boolean | string
$verbose boolean Deprecated. Please use the explain() method instead.
return boolean | string

explain() public static method

public static explain ( )

explain() public static method

public static explain ( ) : string
return string

forbidden() public static method

Send a 403 Forbidden header.
public static forbidden ( )

getBlocklist() public static method

public static getBlocklist ( )

getBlocklist() public static method

public static getBlocklist ( ) : array
return array

getBlocklistFilename() public static method

public static getBlocklistFilename ( )

getBlocklistFilename() public static method

public static getBlocklistFilename ( ) : string
return string

isRefererOnBlocklist() public static method

public static isRefererOnBlocklist ( )

isRefererOnBlocklist() public static method

The public use of this function is undocumented.
public static isRefererOnBlocklist ( ) : boolean
return boolean

isUrlOnBlocklist() public static method

public static isUrlOnBlocklist ( $url, $entity = 'url' )

isUrlOnBlocklist() public static method

The public use of this function is undocumented.
public static isUrlOnBlocklist ( string $url, string $entity = 'url' ) : boolean
$url string
$entity string
return boolean

protect() public static method

public static protect ( $action = '' )

protect() public static method

Block a page if referer is found on list of blocked domains.
public static protect ( string $action = '' )
$action string If empty, send 403 response; if URL, redirect here; if non-empty string, print message

Property Details

$explanation public static property

public static $explanation