Ticket #13078: 13078.1.patch
File 13078.1.patch, 3.4 KB (added by , 15 years ago) |
---|
-
wp-includes/functions.wp-styles.php
37 37 * Register CSS style file. 38 38 * 39 39 * @since r79 40 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types. 40 41 * @see WP_Styles::add() For additional information. 41 * @global object $wp_styles The WP_Styles object for printing styles.42 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.43 42 * 44 43 * @param string $handle Name of the stylesheet. 45 44 * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'. … … 50 49 * @param string $media The media for which this stylesheet has been defined. 51 50 */ 52 51 function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) { 52 _wp_register_style( $handle, $src, $deps, $ver, $media, false); 53 } 54 55 56 /** 57 * Register or enqueue a CSS style file. 58 * This function should not be called directly, use wp_register_style() or wp_enqueue_style() instead. 59 * 60 * @since 3.0 61 * @access private 62 * @global object $wp_styles The WP_Styles object for printing styles. 63 * @see wp_register_style(), wp_enqueue_style(), WP_Styles::add(), WP_Styles::enqueue() 64 * 65 * @param string $handle Name of the stylesheet. 66 * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'. 67 * @param array $deps Array of handles of any stylesheet that this stylesheet depends on. 68 * (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies. 69 * @param string|bool $ver String specifying the stylesheet version number. Set to NULL to disable. 70 * Used to ensure that the correct version is sent to the client regardless of caching. 71 * @param string $media The media for which this stylesheet has been defined. 72 * @param boolean $enqueue If the stylesheet will be enqueued. 73 * 74 **/ 75 function _wp_register_style( $handle, $src, $deps, $ver, $media, $enqueue ) { 53 76 global $wp_styles; 54 77 if ( !is_a($wp_styles, 'WP_Styles') ) 55 78 $wp_styles = new WP_Styles(); 56 79 57 $wp_styles->add( $handle, $src, $deps, $ver, $media ); 80 if ( $src ) { 81 $wp_styles->add( $handle, $src, $deps, $ver, $media ); 82 } 83 if ( $enqueue ) { 84 $wp_styles->enqueue( $handle ); 85 } 58 86 } 59 87 60 88 /** … … 81 109 * 82 110 * @since r79 83 111 * @see WP_Styles::add(), WP_Styles::enqueue() 84 * @global object $wp_styles The WP_Styles object for printing styles.85 112 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types. 86 113 * 87 114 * @param string $handle Name of the stylesheet. … … 93 120 * if a version number is available and makes sense for the stylesheet. 94 121 * @param string $media The media for which this stylesheet has been defined. 95 122 */ 96 function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) { 97 global $wp_styles; 98 if ( !is_a($wp_styles, 'WP_Styles') ) 99 $wp_styles = new WP_Styles(); 100 101 if ( $src ) { 102 $_handle = explode('?', $handle); 103 $wp_styles->add( $_handle[0], $src, $deps, $ver, $media ); 104 } 105 $wp_styles->enqueue( $handle ); 123 function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) { 124 _wp_register_style( $handle, $src, $deps, $ver, $media, true); 106 125 } 107 126 108 127 /**