Changeset 54348
- Timestamp:
- 09/28/2022 02:57:55 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-styles.php
r54254 r54348 225 225 226 226 $rel = isset( $obj->extra['alt'] ) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; 227 $title = isset( $obj->extra['title'] ) ? sprintf( " title='%s'", esc_attr( $obj->extra['title'] ) ) : '';227 $title = isset( $obj->extra['title'] ) ? sprintf( " title='%s'", esc_attr( $obj->extra['title'] ) ) : ''; 228 228 229 229 $tag = sprintf( 230 "<link rel='%s' id='%s-css' 230 "<link rel='%s' id='%s-css'%s href='%s'%s media='%s' />\n", 231 231 $rel, 232 232 $handle, … … 260 260 261 261 $rtl_tag = sprintf( 262 "<link rel='%s' id='%s-rtl-css' 262 "<link rel='%s' id='%s-rtl-css'%s href='%s'%s media='%s' />\n", 263 263 $rel, 264 264 $handle, -
trunk/tests/phpunit/tests/dependencies/styles.php
r52754 r54348 64 64 65 65 $ver = get_bloginfo( 'version' ); 66 $expected = "<link rel='stylesheet' id='no-deps-no-version-css' 67 $expected .= "<link rel='stylesheet' id='no-deps-version-css' 68 $expected .= "<link rel='stylesheet' id='no-deps-null-version-css' 69 $expected .= "<link rel='stylesheet' id='no-deps-null-version-print-media-css' 66 $expected = "<link rel='stylesheet' id='no-deps-no-version-css' href='http://example.com?ver=$ver' type='text/css' media='all' />\n"; 67 $expected .= "<link rel='stylesheet' id='no-deps-version-css' href='http://example.com?ver=1.2' type='text/css' media='all' />\n"; 68 $expected .= "<link rel='stylesheet' id='no-deps-null-version-css' href='http://example.com' type='text/css' media='all' />\n"; 69 $expected .= "<link rel='stylesheet' id='no-deps-null-version-print-media-css' href='http://example.com' type='text/css' media='print' />\n"; 70 70 71 71 $this->assertSame( $expected, get_echo( 'wp_print_styles' ) ); … … 87 87 88 88 $ver = get_bloginfo( 'version' ); 89 $expected = "<link rel='stylesheet' id='no-deps-no-version-css' 89 $expected = "<link rel='stylesheet' id='no-deps-no-version-css' href='http://example.com?ver=$ver' media='all' />\n"; 90 90 91 91 $this->assertSame( $expected, get_echo( 'wp_print_styles' ) ); … … 108 108 // Try with an HTTP reference. 109 109 wp_enqueue_style( 'reset-css-http', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 110 $expected .= "<link rel='stylesheet' id='reset-css-http-css' 110 $expected .= "<link rel='stylesheet' id='reset-css-http-css' href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n"; 111 111 112 112 // Try with an HTTPS reference. 113 113 wp_enqueue_style( 'reset-css-https', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 114 $expected .= "<link rel='stylesheet' id='reset-css-https-css' 114 $expected .= "<link rel='stylesheet' id='reset-css-https-css' href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n"; 115 115 116 116 // Try with an automatic protocol reference (//). 117 117 wp_enqueue_style( 'reset-css-doubleslash', '//yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 118 $expected .= "<link rel='stylesheet' id='reset-css-doubleslash-css' 118 $expected .= "<link rel='stylesheet' id='reset-css-doubleslash-css' href='//yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n"; 119 119 120 120 // Try with a local resource and an automatic protocol reference (//). 121 121 $url = '//my_plugin/style.css'; 122 122 wp_enqueue_style( 'plugin-style', $url ); 123 $expected .= "<link rel='stylesheet' id='plugin-style-css' 123 $expected .= "<link rel='stylesheet' id='plugin-style-css' href='$url?ver=$ver' type='text/css' media='all' />\n"; 124 124 125 125 // Try with a bad protocol. 126 126 wp_enqueue_style( 'reset-css-ftp', 'ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 127 $expected .= "<link rel='stylesheet' id='reset-css-ftp-css' 127 $expected .= "<link rel='stylesheet' id='reset-css-ftp-css' href='{$wp_styles->base_url}ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n"; 128 128 129 129 // Go! … … 148 148 $style .= '}'; 149 149 150 $expected = "<link rel='stylesheet' id='handle-css' 150 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css' media='all' />\n"; 151 151 $expected .= "<style id='handle-inline-css' type='text/css'>\n"; 152 152 $expected .= "$style\n"; … … 177 177 $style .= '}'; 178 178 179 $expected = "<link rel='stylesheet' id='handle-css' 179 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css' media='all' />\n"; 180 180 $expected .= "<style id='handle-inline-css' type='text/css'>\n"; 181 181 $expected .= "$style\n"; … … 259 259 $style2 .= '}'; 260 260 261 $expected = "<link rel='stylesheet' id='handle-css' 261 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css' media='all' />\n"; 262 262 $expected .= "<style id='handle-inline-css' type='text/css'>\n"; 263 263 $expected .= "$style1\n"; … … 288 288 $style .= '</style>'; 289 289 290 $expected = "<link rel='stylesheet' id='handle-css' 290 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css' media='all' />\n"; 291 291 $expected .= "$style\n"; 292 292 … … 306 306 public function test_unnecessary_style_tags() { 307 307 308 $expected = "<link rel='stylesheet' id='handle-css' 308 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css' media='all' />\n"; 309 309 310 310 wp_enqueue_style( 'handle', 'http://example.com', array(), 1 ); … … 321 321 $expected = <<<CSS 322 322 <!--[if IE]> 323 <link rel='stylesheet' id='handle-css' 323 <link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css' media='all' /> 324 324 <style id='handle-inline-css' type='text/css'> 325 325 a { color: blue; } … … 351 351 $style = 'a { color: blue; }'; 352 352 353 $expected = "<link rel='stylesheet' id='handle-one-css' 354 $expected .= "<link rel='stylesheet' id='handle-two-css' 353 $expected = "<link rel='stylesheet' id='handle-one-css' href='http://example.com?ver=1' type='text/css' media='all' />\n"; 354 $expected .= "<link rel='stylesheet' id='handle-two-css' href='http://example.com?ver=1' type='text/css' media='all' />\n"; 355 355 $expected .= "<style id='handle-three-inline-css' type='text/css'>\n"; 356 356 $expected .= "$style\n";
Note: See TracChangeset
for help on using the changeset viewer.