PHP Класс WPDKScripts

Very useful for view controller.
С версии: 1.4.13
Автор: =undo= ([email protected])
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$scripts

Открытые методы

Метод Описание
__construct ( ) : WPDKScripts Create an instance of WPDKScripts class
enqueue_script_page_templates ( array $page_templates, string | array $handle, boolean $src = false, array $deps = [], boolean $ver = false, boolean $in_footer = false ) : boolean Enqueue script for list of page template. Return FALSE if $page_templates is empty
enqueue_script_pages ( array $pages, string | array $handle, boolean $src = false, array $deps = [], boolean $ver = false, boolean $in_footer = false ) : boolean Enqueue script for list of page. Return FALSE if $pages is empty
enqueue_style_page_templates ( array $page_templates, string | array $handle, boolean $src = false, array $deps = [], boolean $ver = false ) : boolean Enqueue script for list of page template. Return FALSE if $page_templates is empty
enqueue_style_pages ( array $pages, string | array $handle, boolean $src = false, array $deps = [], boolean $ver = false ) : boolean Enqueue style for list of page. Return FALSE if $pages is empty
hasScripts ( string | array $handle, string $comp = '&' ) : boolean Return TRUE if a handle is registered
registerScripts ( array $scripts, string $path = '', string | array $deps = [], boolean | string $version = false, boolean $in_footer = true ) : boolean Register one or more script following the view controller standard

Описание методов

__construct() публичный Метод

Create an instance of WPDKScripts class
public __construct ( ) : WPDKScripts
Результат WPDKScripts

enqueue_script_page_templates() публичный статический Метод

Enqueue script for list of page template. Return FALSE if $page_templates is empty
public static enqueue_script_page_templates ( array $page_templates, string | array $handle, boolean $src = false, array $deps = [], boolean $ver = false, boolean $in_footer = false ) : boolean
$page_templates array Array of page slug template
$handle string | array The script handle or an array of handles
$src boolean Optional. Source URI
$deps array Optional. Array of other handle
$ver boolean Optional. Version to avoid cache
$in_footer boolean Optional. Load in footer
Результат boolean

enqueue_script_pages() публичный статический Метод

Enqueue script for list of page. Return FALSE if $pages is empty
public static enqueue_script_pages ( array $pages, string | array $handle, boolean $src = false, array $deps = [], boolean $ver = false, boolean $in_footer = false ) : boolean
$pages array Array of page slug
$handle string | array The script handle or an array of handles
$src boolean Optional. Source URI
$deps array Optional. Array of other handle
$ver boolean Optional. Version to avoid cache
$in_footer boolean Optional. Load in footer
Результат boolean

enqueue_style_page_templates() публичный статический Метод

Enqueue script for list of page template. Return FALSE if $page_templates is empty
public static enqueue_style_page_templates ( array $page_templates, string | array $handle, boolean $src = false, array $deps = [], boolean $ver = false ) : boolean
$page_templates array Array of page slug template
$handle string | array The script handle or andarray of handles
$src boolean Optional. Source URI
$deps array Optional. Array of other handle
$ver boolean Optional. Version to avoid cache
Результат boolean

enqueue_style_pages() публичный статический Метод

Enqueue style for list of page. Return FALSE if $pages is empty
public static enqueue_style_pages ( array $pages, string | array $handle, boolean $src = false, array $deps = [], boolean $ver = false ) : boolean
$pages array Array of page slug
$handle string | array The script handle or an array of handles
$src boolean Optional. Source URI
$deps array Optional. Array of other handle
$ver boolean Optional. Version to avoid cache
Результат boolean

hasScripts() публичный Метод

Return TRUE if a handle is registered
public hasScripts ( string | array $handle, string $comp = '&' ) : boolean
$handle string | array Handle or list of handles.
$comp string If $handle is an array or list of handles, use 'AND' or '&' to return TRUE wheter all handle exists use 'OR' or '|' to return TRUE if almost one handle exists
Результат boolean

registerScripts() публичный Метод

Register one or more script following the view controller standard
public registerScripts ( array $scripts, string $path = '', string | array $deps = [], boolean | string $version = false, boolean $in_footer = true ) : boolean
$scripts array List of scripts $scripts = array( 'wpxbz-preferences.js' => array( 'handle' => 'my-handle', // Optional -sanitize_titile( $key ) + remove '.js' 'path' => WPXBANNERIZE_URL_JAVASCRIPT, // Optional if set $path params 'deps' => array( 'jquery' ), // Optional if set $deps params 'version' => '1.2.3', // Optional if set $version 'footer' => false, // Optional override the $in_footer params, ) ); WPDKScripts::registerScripts( $scripts ); OR $scripts = array( 'wpxbz-preferences.js', 'wpxbz-admin.js', ); WPDKScripts::registerScripts( $scripts, $path, $version ); OR $scripts = array( 'wpxbz-preferences.js' => array( 'handle' => 'my-handle', // Optional -sanitize_titile( $key ) + remove '.js' 'path' => WPXBANNERIZE_URL_JAVASCRIPT, // Optional if set $path params 'version' => '1.2.3', // Optional if set $version 'footer' => false, // Optional override the $in_footer params ), 'wpxbz-admin.js', ); // $path and version will be used for 2th iten WPDKScripts::registerScripts( $scripts, $path, $version );
$path string Optional. If set all scripts will be loaded fron this url
$deps string | array Optional. One or more handle dependiences
$version boolean | string Optional. If set will apply to all script
$in_footer boolean Optional. Default all scripts are loaded in footer
Результат boolean

Описание свойств

$scripts защищенное свойство

protected $scripts