[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> script-loader.php (summary)

WordPress scripts and styles default loader. Several constants are used to manage the loading, concatenating and compression of scripts and CSS: define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and CSS, and disables compression and concatenation, define('CONCATENATE_SCRIPTS', false); disables compression and concatenation of scripts and CSS, define('COMPRESS_SCRIPTS', false); disables compression of scripts, define('COMPRESS_CSS', false); disables compression of CSS, define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate).

File Size: 2789 lines (108 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 9 files
 wp-includes/class.wp-dependencies.php
 wp-includes/class-wp-dependency.php
 wp-includes/class.wp-scripts.php
 wp-includes/functions.wp-scripts.php
 wp-includes/version.php
 wp-includes/assets/script-loader-packages.php
 wp-includes/functions.wp-styles.php
 wp-admin/includes/class-wp-community-events.php
 wp-includes/class.wp-styles.php

Defines 42 functions

  wp_register_tinymce_scripts()
  wp_default_packages_vendor()
  wp_get_script_polyfill()
  wp_default_packages_scripts()
  wp_default_packages_inline_scripts()
  wp_tinymce_inline_scripts()
  wp_default_packages()
  wp_scripts_get_suffix()
  wp_default_scripts()
  wp_default_styles()
  wp_prototype_before_jquery()
  wp_just_in_time_script_localization()
  wp_localize_jquery_ui_datepicker()
  wp_localize_community_events()
  wp_style_loader_src()
  print_head_scripts()
  print_footer_scripts()
  _print_scripts()
  wp_print_head_scripts()
  _wp_footer_scripts()
  wp_print_footer_scripts()
  wp_enqueue_scripts()
  print_admin_styles()
  print_late_styles()
  _print_styles()
  script_concat_settings()
  wp_common_block_scripts_and_styles()
  wp_enqueue_global_styles()
  wp_should_load_block_editor_scripts_and_styles()
  wp_should_load_separate_core_block_assets()
  wp_enqueue_registered_block_scripts_and_styles()
  enqueue_block_styles_assets()
  enqueue_editor_block_styles_assets()
  wp_enqueue_editor_block_directory_assets()
  wp_enqueue_editor_format_library_assets()
  wp_sanitize_script_attributes()
  wp_get_script_tag()
  wp_print_script_tag()
  wp_get_inline_script_tag()
  wp_print_inline_script_tag()
  wp_maybe_inline_styles()
  wp_add_iframed_editor_assets_html()

Functions
Functions that are not part of a class:

wp_register_tinymce_scripts( $scripts, $force_uncompressed = false )   X-Ref
Registers TinyMCE scripts.

param: WP_Scripts $scripts            WP_Scripts object.
param: bool       $force_uncompressed Whether to forcibly prevent gzip compression. Default false.

wp_default_packages_vendor( $scripts )   X-Ref
Registers all the WordPress vendor scripts that are in the standardized
`js/dist/vendor/` location.

For the order of `$scripts->add` see `wp_default_scripts`.

param: WP_Scripts $scripts WP_Scripts object.

wp_get_script_polyfill( $scripts, $tests )   X-Ref
Returns contents of an inline script used in appending polyfill scripts for
browsers which fail the provided tests. The provided array is a mapping from
a condition to verify feature support to its polyfill script handle.

return: string Conditional polyfill inline script.
param: WP_Scripts $scripts WP_Scripts object.
param: array      $tests   Features to detect.

wp_default_packages_scripts( $scripts )   X-Ref
Registers all the WordPress packages scripts that are in the standardized
`js/dist/` location.

For the order of `$scripts->add` see `wp_default_scripts`.

param: WP_Scripts $scripts WP_Scripts object.

wp_default_packages_inline_scripts( $scripts )   X-Ref
Adds inline scripts required for the WordPress JavaScript packages.

param: WP_Scripts $scripts WP_Scripts object.

wp_tinymce_inline_scripts()   X-Ref
Adds inline scripts required for the TinyMCE in the block editor.

These TinyMCE init settings are used to extend and override the default settings
from `_WP_Editors::default_settings()` for the Classic block.


wp_default_packages( $scripts )   X-Ref
Registers all the WordPress packages scripts.

param: WP_Scripts $scripts WP_Scripts object.

wp_scripts_get_suffix( $type = '' )   X-Ref
Returns the suffix that can be used for the scripts.

There are two suffix types, the normal one and the dev suffix.

return: string The script suffix.
param: string $type The type of suffix to retrieve.

wp_default_scripts( $scripts )   X-Ref
Register all WordPress scripts.

Localizes some of them.
args order: `$scripts->add( 'handle', 'url', 'dependencies', 'query-string', 1 );`
when last arg === 1 queues the script for the footer

param: WP_Scripts $scripts WP_Scripts object.

wp_default_styles( $styles )   X-Ref
Assign default styles to $styles object.

Nothing is returned, because the $styles parameter is passed by reference.
Meaning that whatever object is passed will be updated without having to
reassign the variable that was passed back to the same value. This saves
memory.

Adding default styles is not the only task, it also assigns the base_url
property, the default version, and text direction for the object.

param: WP_Styles $styles

wp_prototype_before_jquery( $js_array )   X-Ref
Reorder JavaScript scripts array to place prototype before jQuery.

return: array Reordered array, if needed.
param: array $js_array JavaScript scripts array

wp_just_in_time_script_localization()   X-Ref
Load localized data on print rather than initialization.

These localizations require information that may not be loaded even by init.


wp_localize_jquery_ui_datepicker()   X-Ref
Localizes the jQuery UI datepicker.


wp_localize_community_events()   X-Ref
Localizes community events data that needs to be passed to dashboard.js.


wp_style_loader_src( $src, $handle )   X-Ref
Administration Screen CSS for changing the styles.

If installing the 'wp-admin/' directory will be replaced with './'.

The $_wp_admin_css_colors global manages the Administration Screens CSS
stylesheet that is loaded. The option that is set is 'admin_color' and is the
color and key for the array. The value for the color key is an object with
a 'url' parameter that has the URL path to the CSS file.

The query from $src parameter will be appended to the URL that is given from
the $_wp_admin_css_colors array value URL.

return: string|false URL path to CSS stylesheet for Administration Screens.
param: string $src    Source URL.
param: string $handle Either 'colors' or 'colors-rtl'.

print_head_scripts()   X-Ref
Prints the script queue in the HTML head on admin pages.

Postpones the scripts that were queued for the footer.
print_footer_scripts() is called in the footer to print these scripts.

return: array

print_footer_scripts()   X-Ref
Prints the scripts that were queued for the footer or too late for the HTML head.

return: array

_print_scripts()   X-Ref
Print scripts (internal use only)


wp_print_head_scripts()   X-Ref
Prints the script queue in the HTML head on the front end.

Postpones the scripts that were queued for the footer.
wp_print_footer_scripts() is called in the footer to print these scripts.

return: array

_wp_footer_scripts()   X-Ref
Private, for use in *_footer_scripts hooks


wp_print_footer_scripts()   X-Ref
Hooks to print the scripts and styles in the footer.


wp_enqueue_scripts()   X-Ref
Wrapper for do_action( 'wp_enqueue_scripts' ).

Allows plugins to queue scripts for the front end using wp_enqueue_script().
Runs first in wp_head() where all is_home(), is_page(), etc. functions are available.


print_admin_styles()   X-Ref
Prints the styles queue in the HTML head on admin pages.

return: array

print_late_styles()   X-Ref
Prints the styles that were queued too late for the HTML head.

return: array|void

_print_styles()   X-Ref
Print styles (internal use only)


script_concat_settings()   X-Ref
Determine the concatenation and compression settings for scripts and styles.


wp_common_block_scripts_and_styles()   X-Ref
Handles the enqueueing of block scripts and styles that are common to both
the editor and the front-end.


wp_enqueue_global_styles()   X-Ref
Enqueues the global styles defined via theme.json.


wp_should_load_block_editor_scripts_and_styles()   X-Ref
Checks if the editor scripts and styles for all registered block types
should be enqueued on the current screen.

return: bool Whether scripts and styles should be enqueued.

wp_should_load_separate_core_block_assets()   X-Ref
Checks whether separate styles should be loaded for core blocks on-render.

When this function returns true, other functions ensure that core blocks
only load their assets on-render, and each block loads its own, individual
assets. Third-party blocks only load their assets when rendered.

When this function returns false, all core block assets are loaded regardless
of whether they are rendered in a page or not, because they are all part of
the `block-library/style.css` file. Assets for third-party blocks are always
enqueued regardless of whether they are rendered or not.

This only affects front end and not the block editor screens.

return: bool Whether separate assets will be loaded.

wp_enqueue_registered_block_scripts_and_styles()   X-Ref
Enqueues registered block scripts and styles, depending on current rendered
context (only enqueuing editor scripts while in context of the editor).


enqueue_block_styles_assets()   X-Ref
Function responsible for enqueuing the styles required for block styles functionality on the editor and on the frontend.


enqueue_editor_block_styles_assets()   X-Ref
No description

wp_enqueue_editor_block_directory_assets()   X-Ref
Enqueues the assets required for the block directory within the block editor.


wp_enqueue_editor_format_library_assets()   X-Ref
Enqueues the assets required for the format library within the block editor.


wp_sanitize_script_attributes( $attributes )   X-Ref
Sanitizes an attributes array into an attributes string to be placed inside a `<script>` tag.

Automatically injects type attribute if needed.
Used by {@see wp_get_script_tag()} and {@see wp_get_inline_script_tag()}.

return: string String made of sanitized `<script>` tag attributes.
param: array $attributes Key-value pairs representing `<script>` tag attributes.

wp_get_script_tag( $attributes )   X-Ref
Formats `<script>` loader tags.

It is possible to inject attributes in the `<script>` tag via the {@see 'wp_script_attributes'} filter.
Automatically injects type attribute if needed.

return: string String containing `<script>` opening and closing tags.
param: array $attributes Key-value pairs representing `<script>` tag attributes.

wp_print_script_tag( $attributes )   X-Ref
Prints formatted `<script>` loader tag.

It is possible to inject attributes in the `<script>` tag via the  {@see 'wp_script_attributes'}  filter.
Automatically injects type attribute if needed.

param: array $attributes Key-value pairs representing `<script>` tag attributes.

wp_get_inline_script_tag( $javascript, $attributes = array()   X-Ref
Wraps inline JavaScript in `<script>` tag.

It is possible to inject attributes in the `<script>` tag via the  {@see 'wp_script_attributes'}  filter.
Automatically injects type attribute if needed.

return: string String containing inline JavaScript code wrapped around `<script>` tag.
param: string $javascript Inline JavaScript code.
param: array  $attributes  Optional. Key-value pairs representing `<script>` tag attributes.

wp_print_inline_script_tag( $javascript, $attributes = array()   X-Ref
Prints inline JavaScript wrapped in `<script>` tag.

It is possible to inject attributes in the `<script>` tag via the  {@see 'wp_script_attributes'}  filter.
Automatically injects type attribute if needed.

param: string $javascript Inline JavaScript code.
param: array  $attributes Optional. Key-value pairs representing `<script>` tag attributes.

wp_maybe_inline_styles()   X-Ref
Allows small styles to be inlined.

This improves performance and sustainability, and is opt-in. Stylesheets can opt in
by adding `path` data using `wp_style_add_data`, and defining the file's absolute path:

wp_style_add_data( $style_handle, 'path', $file_path );


wp_add_iframed_editor_assets_html()   X-Ref
No description



Generated : Mon Aug 2 08:20:01 2021 Cross-referenced by PHPXref