Helper class

access public
package kocuj_internal_lib

 Methods

Calculate the highest priority of WordPress filter or action

calculateMaxPriority(string $name) : integer
todo remove checking if $wp_filter is an array, when this library will have 4.7 as the minimal supported WordPress version
access public

Parameters

$name

string

WordPress filter or action name

Returns

integerCalculated highest priority of WordPress filter or action

Check current permissions

checkCurrentPermissions(array $permissions, integer $logicOperator = \KocujIL\V12a\Enums\LogicOperator::OPERATOR_OR) : boolean
access public

Parameters

$permissions

array

Permissions to check

$logicOperator

integer

Logic operator; must be one of the following constants from \KocujIL\V12a\Enums\LogicOperator: OPERATOR_OR ("OR" operator) or OPERATOR_AND ("AND" operator) - default: \KocujIL\V12a\Enums\LogicOperator::OPERATOR_OR

Returns

booleanPermissions are correct (true) or not (false)

Check if it is debug mode

checkDebug(integer $checkJavascript = \KocujIL\V12a\Enums\CheckJavascript::NO) : boolean
access public

Parameters

$checkJavascript

integer

Check JavaScript; must be one of the following constants from \KocujIL\V12a\Enums\CheckJavascript: NO (when JavaScript should not be checked) or YES (when JavaScript should be checked) - default: \KocujIL\V12a\Enums\CheckJavascript::NO

Returns

booleanIt is debug mode (true) or not (false)

Check if IP address is in local network

checkIPLocal(string $ip) : boolean
access public

Parameters

$ip

string

IP to check

Returns

booleanIP is in local network (true) or not (false)

Check if server IP address is in local network

checkServerIPLocal() : boolean
access public

Returns

booleanServer IP is in local network (true) or not (false)

Check if user IP address is in local network

checkUserIPLocal() : boolean
access public

Returns

booleanUser IP is in local network (true) or not (false)

Get better random value

getBetterRandom(integer $min, integer $max) : integer
access public

Parameters

$min

integer

Minimal value

$max

integer

Maximum value

Returns

integerRandom value

Get current url

getCurrentUrl() : string
access public

Returns

stringCurrent URL

Get singleton instance

getInstance() : object
Static
access public

Returns

objectSingleton instance

Get prefix for some names in library

getPrefix() : string
access public

Returns

stringPrefix

Get real URL; it is similar to "realpath()" but it parse URL-s

getRealUrl(string $url) : string
access public

Parameters

$url

string

URL to parse

Returns

stringParsed URL

Get script URL

getScriptUrl() : string
access public

Returns

stringScript URL

Get protocol for current URL

getUrlProtocol() : string
access public

Returns

stringProtocol for current URL

Disable cloning of object

__clone() : void
access private

Constructor

__construct() : void
access private

 Properties

 

Singleton instance

$instance : object

Default

NULL
Static
access private
 

Remembered script URL

$scriptUrl : string

Default

''
access private
 

Script URL is remembered in $this->scriptUrl property (true) or not and should be updated (false)

$scriptUrlRemember : boolean

Default

false
access private