[ 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. param: string|string[]|false $handles Optional. Scripts to be printed: queue (false), param: int|false $group Optional. Group level: level (int), no groups (false). return: string[] Handles of scripts that have been printed. |
print_scripts_l10n( $handle, $display = true ) X-Ref |
Prints extra scripts of a registered script. param: string $handle The script's registered handle. param: bool $display Optional. Whether to print the extra script return: bool|string|void Void if no data exists, extra scripts if `$display` is true, |
print_extra_script( $handle, $display = true ) X-Ref |
Prints extra scripts of a registered script. param: string $handle The script's registered handle. param: bool $display Optional. Whether to print the extra script return: bool|string|void Void if no data exists, extra scripts if `$display` is true, |
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. param: string $handle Script handle. return: bool Whether all dependents are in the footer. |
do_item( $handle, $group = false ) X-Ref |
Processes a script dependency. param: string $handle The script's registered handle. param: int|false $group Optional. Group level: level (int), no groups (false). return: bool True on success, false on failure. |
add_inline_script( $handle, $data, $position = 'after' ) X-Ref |
Adds extra code to a registered script. 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 return: bool True on success, false on failure. |
print_inline_script( $handle, $position = 'after', $display = true ) X-Ref |
Prints inline scripts registered for a specific handle. 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 return: string|false Script data on success, false otherwise. |
get_inline_script_data( $handle, $position = 'after' ) X-Ref |
Gets data for inline scripts registered for a specific handle. param: string $handle Name of the script to get data for. param: string $position Optional. Whether to add the inline script return: string Inline script, which may be empty string. |
get_inline_script_tag( $handle, $position = 'after' ) X-Ref |
Gets tags for inline scripts registered for a specific handle. param: string $handle Name of the script to get associated inline script tag for. param: string $position Optional. Whether to get tag for inline return: string Inline script, which may be empty string. |
localize( $handle, $object_name, $l10n ) X-Ref |
Localizes a script, only if the script has already been added. 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. return: bool True on success, false on failure. |
set_group( $handle, $recursion, $group = false ) X-Ref |
Sets handle 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). return: bool Not already in the group or a lower group. |
set_translations( $handle, $domain = 'default', $path = '' ) X-Ref |
Sets a translation textdomain. 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. return: bool True if the text domain was registered, false if not. |
print_translations( $handle, $display = true ) X-Ref |
Prints translations set for a specific handle. param: string $handle Name of the script to add the inline script to. param: bool $display Optional. Whether to print the script return: string|false Script on success, false otherwise. |
all_deps( $handles, $recursion = false, $group = false ) X-Ref |
Determines script dependencies. 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). return: bool True on success, false on failure. |
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. param: string $src The source of the enqueued script. return: bool True if found, false if not. |
add_data( $handle, $key, $value ) X-Ref |
This overrides the add_data method from WP_Dependencies, to support normalizing of $args. param: string $handle Name of the item. Should be unique. param: string $key The data key. param: mixed $value The data value. return: bool True on success, false on failure. |
get_dependents( $handle ) X-Ref |
Gets all dependents of a script. param: string $handle The script handle. return: string[] Script handles. |
is_delayed_strategy( $strategy ) X-Ref |
Checks if the strategy passed is a valid delayed (non-blocking) strategy. param: string $strategy The strategy to check. return: bool True if $strategy is one of the delayed strategies, otherwise false. |
get_eligible_loading_strategy( $handle ) X-Ref |
Gets the best eligible loading strategy for a script. param: string $handle The script handle. return: string The best eligible loading strategy. |
filter_eligible_strategies( $handle, $eligible_strategies = null, $checked = array() X-Ref |
Filter the list of eligible loading strategies for a script. 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. return: string[] A list of eligible loading strategies that could be used. |
has_inline_script( $handle, $position = null ) X-Ref |
Gets data for inline scripts registered for a specific handle. param: string $handle Name of the script to get data for. Must be lowercase. param: string $position The position of the inline script. return: bool Whether the handle has an inline script (either before or after). |
reset() X-Ref |
Resets class properties. |
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |