Changeset 43564
- Timestamp:
- 08/11/2018 05:41:02 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class.wp-styles.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class.wp-styles.php
r42876 r43564 133 133 134 134 $obj = $this->registered[ $handle ]; 135 135 136 if ( null === $obj->ver ) { 136 137 $ver = ''; … … 143 144 } 144 145 146 $src = $obj->src; 147 $cond_before = $cond_after = ''; 148 $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : ''; 149 150 if ( $conditional ) { 151 $cond_before = "<!--[if {$conditional}]>\n"; 152 $cond_after = "<![endif]-->\n"; 153 } 154 155 $inline_style = $this->print_inline_style( $handle, false ); 156 157 if ( $inline_style ) { 158 $inline_style_tag = sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style ); 159 } else { 160 $inline_style_tag = ''; 161 } 162 145 163 if ( $this->do_concat ) { 146 if ( $this->in_default_dir( $ obj->src ) && ! isset( $obj->extra['conditional'] )&& ! isset( $obj->extra['alt'] ) ) {164 if ( $this->in_default_dir( $src ) && ! $conditional && ! isset( $obj->extra['alt'] ) ) { 147 165 $this->concat .= "$handle,"; 148 166 $this->concat_version .= "$handle$ver"; 149 167 150 $this->print_code .= $ this->print_inline_style( $handle, false );168 $this->print_code .= $inline_style; 151 169 152 170 return true; … … 161 179 162 180 // A single item may alias a set of items, by having dependencies, but no source. 163 if ( ! $obj->src ) { 164 if ( $inline_style = $this->print_inline_style( $handle, false ) ) { 165 $inline_style = sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style ); 181 if ( ! $src ) { 182 if ( $inline_style_tag ) { 166 183 if ( $this->do_concat ) { 167 $this->print_html .= $inline_style ;184 $this->print_html .= $inline_style_tag; 168 185 } else { 169 echo $inline_style ;186 echo $inline_style_tag; 170 187 } 171 188 } 189 172 190 return true; 173 191 } 174 192 175 $href = $this->_css_href( $ obj->src, $ver, $handle );193 $href = $this->_css_href( $src, $ver, $handle ); 176 194 if ( ! $href ) { 177 195 return true; … … 194 212 */ 195 213 $tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle, $href, $media ); 214 196 215 if ( 'rtl' === $this->text_direction && isset( $obj->extra['rtl'] ) && $obj->extra['rtl'] ) { 197 216 if ( is_bool( $obj->extra['rtl'] ) || 'replace' === $obj->extra['rtl'] ) { 198 217 $suffix = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : ''; 199 $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $ obj->src, $ver, "$handle-rtl" ) );218 $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $src, $ver, "$handle-rtl" ) ); 200 219 } else { 201 220 $rtl_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" ); … … 212 231 } 213 232 214 $conditional_pre = $conditional_post = '';215 if ( isset( $obj->extra['conditional'] ) && $obj->extra['conditional'] ) {216 $conditional_pre = "<!--[if {$obj->extra['conditional']}]>\n";217 $conditional_post = "<![endif]-->\n";218 }219 220 233 if ( $this->do_concat ) { 221 $this->print_html .= $cond itional_pre;234 $this->print_html .= $cond_before; 222 235 $this->print_html .= $tag; 223 if ( $inline_style = $this->print_inline_style( $handle, false )) {224 $this->print_html .= sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style );225 } 226 $this->print_html .= $cond itional_post;236 if ( $inline_style_tag ) { 237 $this->print_html .= $inline_style_tag; 238 } 239 $this->print_html .= $cond_after; 227 240 } else { 228 echo $cond itional_pre;241 echo $cond_before; 229 242 echo $tag; 230 243 $this->print_inline_style( $handle ); 231 echo $cond itional_post;244 echo $cond_after; 232 245 } 233 246
Note: See TracChangeset
for help on using the changeset viewer.