[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> class.wp-scripts.php (summary)

Dependencies API: WP_Scripts class

File Size: 722 lines (19 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Scripts:: (17 methods):
  __construct()
  init()
  print_scripts()
  print_scripts_l10n()
  print_extra_script()
  do_item()
  add_inline_script()
  print_inline_script()
  localize()
  set_group()
  set_translations()
  print_translations()
  all_deps()
  do_head_items()
  do_footer_items()
  in_default_dir()
  reset()


Class: WP_Scripts  - X-Ref

Core class used to register scripts.

__construct()   X-Ref
Constructor.

since: 2.6.0

init()   X-Ref
Initialize the class.

since: 3.4.0

print_scripts( $handles = false, $group = false )   X-Ref
No description

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
since: 2.1.0
since: 2.8.0 Added the `$display` parameter.

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
since: 3.3.0

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).
since: 2.6.0
since: 2.8.0 Added the `$group` parameter.

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
since: 4.5.0

print_inline_script( $handle, $position = 'after', $display = true )   X-Ref
Prints inline scripts registered 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: string $position Optional. Whether to add the inline script
param: bool   $display  Optional. Whether to print the script
since: 4.5.0

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.
since: 2.1.0

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).
since: 2.8.0

set_translations( $handle, $domain = 'default', $path = null )   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.
since: 5.0.0
since: 5.1.0 The `$domain` parameter was made optional.

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
since: 5.0.0

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).
since: 2.1.0

do_head_items()   X-Ref
Processes items and dependencies for the head group.

return: string[] Handles of items that have been processed.
since: 2.8.0

do_footer_items()   X-Ref
Processes items and dependencies for the footer group.

return: string[] Handles of items that have been processed.
since: 2.8.0

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.
since: 2.8.0

reset()   X-Ref
Resets class properties.

since: 2.8.0



Generated: Sat Apr 27 01:00:02 2024 Cross-referenced by PHPXref 0.7.1