[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

Dependencies API: WP_Styles class

File Size: 612 lines (18 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Styles:: (14 methods):
  __construct()
  do_item()
  get_rtl_src()
  add_inline_style()
  print_inline_style()
  add_data()
  all_deps()
  _css_href()
  get_src()
  build_src()
  in_default_dir()
  do_footer_items()
  reset()
  get_dependency_warning_message()


Class: WP_Styles  - X-Ref

Core class used to register styles.

__construct()   X-Ref
Constructor.


do_item( $handle, $group = false )   X-Ref
Processes a style dependency.

param: string    $handle The style's registered handle.
param: int|false $group  Optional. Group level: level (int), no groups (false).
return: bool True on success, false on failure.

get_rtl_src( string $handle )   X-Ref
Gets the URL of the right-to-left stylesheet for a registered style.

On a right-to-left locale, a style registered with `rtl` data is served by a separate
stylesheet, which either replaces its left-to-right one (when the data is `'replace'`)
or loads alongside it.

Like {@see WP_Styles::get_src()}, the URL is neither sanitized nor escaped, so a caller can
pass it through esc_url() to print it, or esc_url_raw() otherwise, once.

param: string $handle The style's registered handle.
return: string|null URL of the right-to-left stylesheet, after the {@see 'style_loader_src'}

add_inline_style( $handle, $code )   X-Ref
Adds extra CSS styles to a registered stylesheet.

param: string $handle The style's registered handle.
param: string $code   String containing the CSS styles to be added.
return: bool True on success, false on failure.

print_inline_style( $handle, $display = true )   X-Ref
Prints extra CSS styles of a registered stylesheet.

param: string $handle  The style's registered handle.
param: bool   $display Optional. Whether to print the inline style
return: string|bool False if no data exists, inline styles if `$display` is false,

add_data( $handle, $key, $value )   X-Ref
Overrides the add_data method from WP_Dependencies, to allow unsetting dependencies for conditional styles.

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.

all_deps( $handles, $recursion = false, $group = false )   X-Ref
Determines style 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.

_css_href( $src, $ver, $handle )   X-Ref
Generates an enqueued style's fully-qualified URL.

param: string            $src    The source of the enqueued style.
param: string|false|null $ver    The version of the enqueued style.
param: string            $handle The style's registered handle.
return: string Style's fully-qualified URL, escaped for use in an HTML attribute.

get_src( string $handle )   X-Ref
Gets the URL a registered style is loaded from.

This is the URL printed in the stylesheet's `href` attribute, including the version query
argument and any arguments added to the handle, after the {@see 'style_loader_src'} filter.
Unlike {@see WP_Styles::_css_href()}, it is neither sanitized nor escaped, so a caller can
pass it through esc_url() to print it, or esc_url_raw() otherwise, once. This is the same as
{@see WP_Script_Modules::get_src()}.

param: string $handle The style's registered handle.
return: string Style URL, or an empty string when the style is not registered, has no

build_src( $src, $ver, string $handle, ?string $filter_handle = null )   X-Ref
Builds a style's fully-qualified URL and passes it through the 'style_loader_src' filter.

The result is not escaped, so callers can escape it for where it is used.

param: string|true       $src    The source of the style, or true for one whose URL comes
param: string|false|null $ver           The version of the style.
param: string            $handle        The style's registered handle, whose added arguments
param: string|null       $filter_handle Optional. The handle passed to the
return: string The filtered URL, or an empty string when the filter returns anything other

in_default_dir( $src )   X-Ref
Whether a handle's source is in a default directory.

param: string $src The source of the enqueued style.
return: bool True if found, false if not.

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

HTML 5 allows styles in the body, grab late enqueued items and output them in the footer.

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

reset()   X-Ref
Resets class properties.


get_dependency_warning_message( $handle, $missing_dependency_handles )   X-Ref
Gets a style-specific dependency warning message.

param: string   $handle                     Style handle with missing dependencies.
param: string[] $missing_dependency_handles Missing dependency handles.
return: string Formatted, localized warning message.



Generated : Tue Oct 13 08:20:33 2026 Cross-referenced by PHPXref