Edit File by line
/home/barbar84/public_h.../wp-inclu...
File: functions.wp-styles.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Dependencies API: Styles functions
[2] Fix | Delete
*
[3] Fix | Delete
* @since 2.6.0
[4] Fix | Delete
*
[5] Fix | Delete
* @package WordPress
[6] Fix | Delete
* @subpackage Dependencies
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* Initialize $wp_styles if it has not been set.
[11] Fix | Delete
*
[12] Fix | Delete
* @global WP_Styles $wp_styles
[13] Fix | Delete
*
[14] Fix | Delete
* @since 4.2.0
[15] Fix | Delete
*
[16] Fix | Delete
* @return WP_Styles WP_Styles instance.
[17] Fix | Delete
*/
[18] Fix | Delete
function wp_styles() {
[19] Fix | Delete
global $wp_styles;
[20] Fix | Delete
[21] Fix | Delete
if ( ! ( $wp_styles instanceof WP_Styles ) ) {
[22] Fix | Delete
$wp_styles = new WP_Styles();
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
return $wp_styles;
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Display styles that are in the $handles queue.
[30] Fix | Delete
*
[31] Fix | Delete
* Passing an empty array to $handles prints the queue,
[32] Fix | Delete
* passing an array with one string prints that style,
[33] Fix | Delete
* and passing an array of strings prints those styles.
[34] Fix | Delete
*
[35] Fix | Delete
* @global WP_Styles $wp_styles The WP_Styles object for printing styles.
[36] Fix | Delete
*
[37] Fix | Delete
* @since 2.6.0
[38] Fix | Delete
*
[39] Fix | Delete
* @param string|bool|array $handles Styles to be printed. Default 'false'.
[40] Fix | Delete
* @return string[] On success, an array of handles of processed WP_Dependencies items; otherwise, an empty array.
[41] Fix | Delete
*/
[42] Fix | Delete
function wp_print_styles( $handles = false ) {
[43] Fix | Delete
global $wp_styles;
[44] Fix | Delete
[45] Fix | Delete
if ( '' === $handles ) { // For 'wp_head'.
[46] Fix | Delete
$handles = false;
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
if ( ! $handles ) {
[50] Fix | Delete
/**
[51] Fix | Delete
* Fires before styles in the $handles queue are printed.
[52] Fix | Delete
*
[53] Fix | Delete
* @since 2.6.0
[54] Fix | Delete
*/
[55] Fix | Delete
do_action( 'wp_print_styles' );
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
[59] Fix | Delete
[60] Fix | Delete
if ( ! ( $wp_styles instanceof WP_Styles ) ) {
[61] Fix | Delete
if ( ! $handles ) {
[62] Fix | Delete
return array(); // No need to instantiate if nothing is there.
[63] Fix | Delete
}
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
return wp_styles()->do_items( $handles );
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
/**
[70] Fix | Delete
* Add extra CSS styles to a registered stylesheet.
[71] Fix | Delete
*
[72] Fix | Delete
* Styles will only be added if the stylesheet is already in the queue.
[73] Fix | Delete
* Accepts a string $data containing the CSS. If two or more CSS code blocks
[74] Fix | Delete
* are added to the same stylesheet $handle, they will be printed in the order
[75] Fix | Delete
* they were added, i.e. the latter added styles can redeclare the previous.
[76] Fix | Delete
*
[77] Fix | Delete
* @see WP_Styles::add_inline_style()
[78] Fix | Delete
*
[79] Fix | Delete
* @since 3.3.0
[80] Fix | Delete
*
[81] Fix | Delete
* @param string $handle Name of the stylesheet to add the extra styles to.
[82] Fix | Delete
* @param string $data String containing the CSS styles to be added.
[83] Fix | Delete
* @return bool True on success, false on failure.
[84] Fix | Delete
*/
[85] Fix | Delete
function wp_add_inline_style( $handle, $data ) {
[86] Fix | Delete
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
[87] Fix | Delete
[88] Fix | Delete
if ( false !== stripos( $data, '</style>' ) ) {
[89] Fix | Delete
_doing_it_wrong(
[90] Fix | Delete
__FUNCTION__,
[91] Fix | Delete
sprintf(
[92] Fix | Delete
/* translators: 1: <style>, 2: wp_add_inline_style() */
[93] Fix | Delete
__( 'Do not pass %1$s tags to %2$s.' ),
[94] Fix | Delete
'<code>&lt;style&gt;</code>',
[95] Fix | Delete
'<code>wp_add_inline_style()</code>'
[96] Fix | Delete
),
[97] Fix | Delete
'3.7.0'
[98] Fix | Delete
);
[99] Fix | Delete
$data = trim( preg_replace( '#<style[^>]*>(.*)</style>#is', '$1', $data ) );
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
return wp_styles()->add_inline_style( $handle, $data );
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
/**
[106] Fix | Delete
* Register a CSS stylesheet.
[107] Fix | Delete
*
[108] Fix | Delete
* @see WP_Dependencies::add()
[109] Fix | Delete
* @link https://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
[110] Fix | Delete
*
[111] Fix | Delete
* @since 2.6.0
[112] Fix | Delete
* @since 4.3.0 A return value was added.
[113] Fix | Delete
*
[114] Fix | Delete
* @param string $handle Name of the stylesheet. Should be unique.
[115] Fix | Delete
* @param string|bool $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
[116] Fix | Delete
* If source is set to false, stylesheet is an alias of other stylesheets it depends on.
[117] Fix | Delete
* @param string[] $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
[118] Fix | Delete
* @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL
[119] Fix | Delete
* as a query string for cache busting purposes. If version is set to false, a version
[120] Fix | Delete
* number is automatically added equal to current installed WordPress version.
[121] Fix | Delete
* If set to null, no version is added.
[122] Fix | Delete
* @param string $media Optional. The media for which this stylesheet has been defined.
[123] Fix | Delete
* Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like
[124] Fix | Delete
* '(orientation: portrait)' and '(max-width: 640px)'.
[125] Fix | Delete
* @return bool Whether the style has been registered. True on success, false on failure.
[126] Fix | Delete
*/
[127] Fix | Delete
function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
[128] Fix | Delete
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
[129] Fix | Delete
[130] Fix | Delete
return wp_styles()->add( $handle, $src, $deps, $ver, $media );
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
/**
[134] Fix | Delete
* Remove a registered stylesheet.
[135] Fix | Delete
*
[136] Fix | Delete
* @see WP_Dependencies::remove()
[137] Fix | Delete
*
[138] Fix | Delete
* @since 2.1.0
[139] Fix | Delete
*
[140] Fix | Delete
* @param string $handle Name of the stylesheet to be removed.
[141] Fix | Delete
*/
[142] Fix | Delete
function wp_deregister_style( $handle ) {
[143] Fix | Delete
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
[144] Fix | Delete
[145] Fix | Delete
wp_styles()->remove( $handle );
[146] Fix | Delete
}
[147] Fix | Delete
[148] Fix | Delete
/**
[149] Fix | Delete
* Enqueue a CSS stylesheet.
[150] Fix | Delete
*
[151] Fix | Delete
* Registers the style if source provided (does NOT overwrite) and enqueues.
[152] Fix | Delete
*
[153] Fix | Delete
* @see WP_Dependencies::add()
[154] Fix | Delete
* @see WP_Dependencies::enqueue()
[155] Fix | Delete
* @link https://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
[156] Fix | Delete
*
[157] Fix | Delete
* @since 2.6.0
[158] Fix | Delete
*
[159] Fix | Delete
* @param string $handle Name of the stylesheet. Should be unique.
[160] Fix | Delete
* @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
[161] Fix | Delete
* Default empty.
[162] Fix | Delete
* @param string[] $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
[163] Fix | Delete
* @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL
[164] Fix | Delete
* as a query string for cache busting purposes. If version is set to false, a version
[165] Fix | Delete
* number is automatically added equal to current installed WordPress version.
[166] Fix | Delete
* If set to null, no version is added.
[167] Fix | Delete
* @param string $media Optional. The media for which this stylesheet has been defined.
[168] Fix | Delete
* Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like
[169] Fix | Delete
* '(orientation: portrait)' and '(max-width: 640px)'.
[170] Fix | Delete
*/
[171] Fix | Delete
function wp_enqueue_style( $handle, $src = '', $deps = array(), $ver = false, $media = 'all' ) {
[172] Fix | Delete
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
[173] Fix | Delete
[174] Fix | Delete
$wp_styles = wp_styles();
[175] Fix | Delete
[176] Fix | Delete
if ( $src ) {
[177] Fix | Delete
$_handle = explode( '?', $handle );
[178] Fix | Delete
$wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
[179] Fix | Delete
}
[180] Fix | Delete
[181] Fix | Delete
$wp_styles->enqueue( $handle );
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
/**
[185] Fix | Delete
* Remove a previously enqueued CSS stylesheet.
[186] Fix | Delete
*
[187] Fix | Delete
* @see WP_Dependencies::dequeue()
[188] Fix | Delete
*
[189] Fix | Delete
* @since 3.1.0
[190] Fix | Delete
*
[191] Fix | Delete
* @param string $handle Name of the stylesheet to be removed.
[192] Fix | Delete
*/
[193] Fix | Delete
function wp_dequeue_style( $handle ) {
[194] Fix | Delete
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
[195] Fix | Delete
[196] Fix | Delete
wp_styles()->dequeue( $handle );
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
/**
[200] Fix | Delete
* Check whether a CSS stylesheet has been added to the queue.
[201] Fix | Delete
*
[202] Fix | Delete
* @since 2.8.0
[203] Fix | Delete
*
[204] Fix | Delete
* @param string $handle Name of the stylesheet.
[205] Fix | Delete
* @param string $list Optional. Status of the stylesheet to check. Default 'enqueued'.
[206] Fix | Delete
* Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
[207] Fix | Delete
* @return bool Whether style is queued.
[208] Fix | Delete
*/
[209] Fix | Delete
function wp_style_is( $handle, $list = 'enqueued' ) {
[210] Fix | Delete
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
[211] Fix | Delete
[212] Fix | Delete
return (bool) wp_styles()->query( $handle, $list );
[213] Fix | Delete
}
[214] Fix | Delete
[215] Fix | Delete
/**
[216] Fix | Delete
* Add metadata to a CSS stylesheet.
[217] Fix | Delete
*
[218] Fix | Delete
* Works only if the stylesheet has already been added.
[219] Fix | Delete
*
[220] Fix | Delete
* Possible values for $key and $value:
[221] Fix | Delete
* 'conditional' string Comments for IE 6, lte IE 7 etc.
[222] Fix | Delete
* 'rtl' bool|string To declare an RTL stylesheet.
[223] Fix | Delete
* 'suffix' string Optional suffix, used in combination with RTL.
[224] Fix | Delete
* 'alt' bool For rel="alternate stylesheet".
[225] Fix | Delete
* 'title' string For preferred/alternate stylesheets.
[226] Fix | Delete
*
[227] Fix | Delete
* @see WP_Dependencies::add_data()
[228] Fix | Delete
*
[229] Fix | Delete
* @since 3.6.0
[230] Fix | Delete
*
[231] Fix | Delete
* @param string $handle Name of the stylesheet.
[232] Fix | Delete
* @param string $key Name of data point for which we're storing a value.
[233] Fix | Delete
* Accepts 'conditional', 'rtl' and 'suffix', 'alt' and 'title'.
[234] Fix | Delete
* @param mixed $value String containing the CSS data to be added.
[235] Fix | Delete
* @return bool True on success, false on failure.
[236] Fix | Delete
*/
[237] Fix | Delete
function wp_style_add_data( $handle, $key, $value ) {
[238] Fix | Delete
return wp_styles()->add_data( $handle, $key, $value );
[239] Fix | Delete
}
[240] Fix | Delete
[241] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function