[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Dependencies API: WP_Scripts class
File Size: | 1013 lines (28 kb) |
Included or required: | 2 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WP_Scripts:: (26 methods):
__construct()
init()
print_scripts()
print_scripts_l10n()
print_extra_script()
are_all_dependents_in_footer()
do_item()
add_inline_script()
print_inline_script()
get_inline_script_data()
get_inline_script_tag()
localize()
set_group()
set_translations()
print_translations()
all_deps()
do_head_items()
do_footer_items()
in_default_dir()
add_data()
get_dependents()
is_delayed_strategy()
get_eligible_loading_strategy()
filter_eligible_strategies()
has_inline_script()
reset()
Class: WP_Scripts - X-Ref
Core class used to register scripts.__construct() X-Ref |
Constructor. |
init() X-Ref |
Initialize the class. |
print_scripts( $handles = false, $group = false ) X-Ref |
Prints scripts. Prints the scripts passed to it or the print queue. Also prints all necessary dependencies. return: string[] Handles of scripts that have been printed. param: string|string[]|false $handles Optional. Scripts to be printed: queue (false), param: int|false $group Optional. Group level: level (int), no groups (false). |
print_scripts_l10n( $handle, $display = true ) X-Ref |
Prints extra scripts of a registered script. return: bool|string|void Void if no data exists, extra scripts if `$display` is true, param: string $handle The script's registered handle. param: bool $display Optional. Whether to print the extra script |
print_extra_script( $handle, $display = true ) X-Ref |
Prints extra scripts of a registered script. return: bool|string|void Void if no data exists, extra scripts if `$display` is true, param: string $handle The script's registered handle. param: bool $display Optional. Whether to print the extra script |
are_all_dependents_in_footer( $handle ) X-Ref |
Checks whether all dependents of a given handle are in the footer. If there are no dependents, this is considered the same as if all dependents were in the footer. return: bool Whether all dependents are in the footer. param: string $handle Script handle. |
do_item( $handle, $group = false ) X-Ref |
Processes a script dependency. return: bool True on success, false on failure. param: string $handle The script's registered handle. param: int|false $group Optional. Group level: level (int), no groups (false). |
add_inline_script( $handle, $data, $position = 'after' ) X-Ref |
Adds extra code to a registered script. return: bool True on success, false on failure. param: string $handle Name of the script to add the inline script to. param: string $data String containing the JavaScript to be added. param: string $position Optional. Whether to add the inline script |
print_inline_script( $handle, $position = 'after', $display = true ) X-Ref |
Prints inline scripts registered for a specific handle. return: string|false Script data on success, false otherwise. param: string $handle Name of the script to print inline scripts for. param: string $position Optional. Whether to add the inline script param: bool $display Optional. Whether to print the script tag |
get_inline_script_data( $handle, $position = 'after' ) X-Ref |
Gets data for inline scripts registered for a specific handle. return: string Inline script, which may be empty string. param: string $handle Name of the script to get data for. param: string $position Optional. Whether to add the inline script |
get_inline_script_tag( $handle, $position = 'after' ) X-Ref |
Gets tags for inline scripts registered for a specific handle. return: string Inline script, which may be empty string. param: string $handle Name of the script to get associated inline script tag for. param: string $position Optional. Whether to get tag for inline |
localize( $handle, $object_name, $l10n ) X-Ref |
Localizes a script, only if the script has already been added. return: bool True on success, false on failure. param: string $handle Name of the script to attach data to. param: string $object_name Name of the variable that will contain the data. param: array $l10n Array of data to localize. |
set_group( $handle, $recursion, $group = false ) X-Ref |
Sets handle group. return: bool Not already in the group or a lower group. param: string $handle Name of the item. Should be unique. param: bool $recursion Internal flag that calling function was called recursively. param: int|false $group Optional. Group level: level (int), no groups (false). |
set_translations( $handle, $domain = 'default', $path = '' ) X-Ref |
Sets a translation textdomain. return: bool True if the text domain was registered, false if not. param: string $handle Name of the script to register a translation domain to. param: string $domain Optional. Text domain. Default 'default'. param: string $path Optional. The full file path to the directory containing translation files. |
print_translations( $handle, $display = true ) X-Ref |
Prints translations set for a specific handle. return: string|false Script on success, false otherwise. param: string $handle Name of the script to add the inline script to. param: bool $display Optional. Whether to print the script |
all_deps( $handles, $recursion = false, $group = false ) X-Ref |
Determines script dependencies. return: bool True on success, false on failure. param: string|string[] $handles Item handle (string) or item handles (array of strings). param: bool $recursion Optional. Internal flag that function is calling itself. param: int|false $group Optional. Group level: level (int), no groups (false). |
do_head_items() X-Ref |
Processes items and dependencies for the head group. return: string[] Handles of items that have been processed. |
do_footer_items() X-Ref |
Processes items and dependencies for the footer group. return: string[] Handles of items that have been processed. |
in_default_dir( $src ) X-Ref |
Whether a handle's source is in a default directory. return: bool True if found, false if not. param: string $src The source of the enqueued script. |
add_data( $handle, $key, $value ) X-Ref |
This overrides the add_data method from WP_Dependencies, to support normalizing of $args. return: bool True on success, false on failure. param: string $handle Name of the item. Should be unique. param: string $key The data key. param: mixed $value The data value. |
get_dependents( $handle ) X-Ref |
Gets all dependents of a script. return: string[] Script handles. param: string $handle The script handle. |
is_delayed_strategy( $strategy ) X-Ref |
Checks if the strategy passed is a valid delayed (non-blocking) strategy. return: bool True if $strategy is one of the delayed strategies, otherwise false. param: string $strategy The strategy to check. |
get_eligible_loading_strategy( $handle ) X-Ref |
Gets the best eligible loading strategy for a script. return: string The best eligible loading strategy. param: string $handle The script handle. |
filter_eligible_strategies( $handle, $eligible_strategies = null, $checked = array() X-Ref |
Filter the list of eligible loading strategies for a script. return: string[] A list of eligible loading strategies that could be used. param: string $handle The script handle. param: string[]|null $eligible_strategies Optional. The list of strategies to filter. Default null. param: array<string, true> $checked Optional. An array of already checked script handles, used to avoid recursive loops. |
has_inline_script( $handle, $position = null ) X-Ref |
Gets data for inline scripts registered for a specific handle. return: bool Whether the handle has an inline script (either before or after). param: string $handle Name of the script to get data for. Must be lowercase. param: string $position The position of the inline script. |
reset() X-Ref |
Resets class properties. |
Generated : Sat Dec 21 08:20:01 2024 | Cross-referenced by PHPXref |