JavaScript helper class

access public
package kocuj_internal_lib

 Methods

Action for adding scripts

actionAddScripts() : void
access public

Add "data-helper.js" script

addDataHelperJs() : void
access public

Add "exception.js" and "exception-code.js" scripts

addExceptionJs() : void
access public

Add "helper.js" script

addHelperJs() : void
access public

Add Kocuj Internal Lib script

addLibScript(string $handle, string $urlToDirectory, string $filenameWithoutExt, array $mainLibDeps = array(), array $deps = array(), string $localizeVar = '', array $localizeData = array()) : void
access public

Parameters

$handle

string

Script handle; prefix will be added automatically

$urlToDirectory

string

URL to script directory; main URL to library will be added automatically

$filenameWithoutExt

string

Script filename without extension

$mainLibDeps

array

Script dependencies with main scripts from Kocuj Internal Lib - default: empty

$deps

array

Script dependencies - default: empty

$localizeVar

string

Variable for localization; if empty, there will be no localization - default: empty

$localizeData

array

Localization data; used only if $localizeVar is not empty - default: empty

Add Kocuj Internal Lib script from vendor

addLibVendorScript(string $handle, string $urlToDirectory, string $filenameWithoutExt, array $mainLibDeps = array(), array $deps = array(), string $localizeVar = '', array $localizeData = array()) : void
access public

Parameters

$handle

string

Script handle; prefix will be added automatically

$urlToDirectory

string

URL to script directory; main URL to library will be added automatically

$filenameWithoutExt

string

Script filename without extension

$mainLibDeps

array

Script dependencies with main scripts from Kocuj Internal Lib - default: empty

$deps

array

Script dependencies - default: empty

$localizeVar

string

Variable for localization; if empty, there will be no localization - default: empty

$localizeData

array

Localization data; used only if $localizeVar is not empty - default: empty

Add script

addScript(string $handle, string $urlToDirectory, string $filenameWithoutExt, array $mainLibDeps = array(), array $deps = array(), string $ver = '', boolean $inFooter = false, boolean $useMin = true, string $localizeVar = '', array $localizeData = array(), boolean $addThrowToLocalizeData = false) : void
access public

Parameters

$handle

string

Script handle

$urlToDirectory

string

URL to script directory

$filenameWithoutExt

string

Script filename without extension

$mainLibDeps

array

Script dependencies with main scripts from Kocuj Internal Lib - default: empty

$deps

array

Script dependencies - default: empty

$ver

string

Script version - default: empty

$inFooter

boolean

Show script in footer (true) or in header (false) - default: false

$useMin

boolean

Use minimized script (true) or standard (false) - default: true

$localizeVar

string

Variable for localization; if empty, there will be no localization - default: empty

$localizeData

array

Localization data; used only if $localizeVar is not empty - default: empty

$addThrowToLocalizeData

boolean

Add settings "throwErrors" to localization data with value indicated if script should throw errors (true) or does not add anything (false) - default: false

Check if JavaScript scripts are in debug mode

checkScriptDebug() : boolean
access public

Returns

booleanJavaScript scripts are in debug mode (true) or not (false)

Get singleton instance

getInstance() : object
Static
access public

Returns

objectSingleton instance

Get minified JavaScript script filename if WordPress allows for it

getMinJsFilename(string $filename) : string
access public

Parameters

$filename

string

Filename of script without extension

Returns

stringMinified JavaScript script filename if WordPress allows for it

Disable cloning of object

__clone() : void
access private

Constructor

__construct() : void
access private

Add "data-helper.js" script now

addDataHelperJsNow() : void
access private

Add "exception.js" and "exception-code.js" scripts now

addExceptionJsNow() : void
access private

Add "helper.js" script now

addHelperJsNow() : void
access private

 Properties

 

Action for adding scripts has been already executed (true) or not (false)

$actionExecuted : boolean

Default

false
access private
 

Scripts to add in footer in adding scripts action

$addJs : array

Default

array()
access private
 

Scripts which has been added to queue

$addedJs : array

Default

array()
access private
 

Singleton instance

$instance : object

Default

NULL
Static
access private