Changeset 60948 for trunk/src/wp-includes/class-wp-styles.php
- Timestamp:
- 10/16/2025 07:59:11 PM (3 months 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
r60920 r60948 155 155 156 156 $obj = $this->registered[ $handle ]; 157 157 if ( $obj->extra['conditional'] ?? false ) { 158 159 return false; 160 } 158 161 if ( null === $obj->ver ) { 159 162 $ver = ''; … … 166 169 } 167 170 168 $src = $obj->src; 169 $ie_conditional_prefix = ''; 170 $ie_conditional_suffix = ''; 171 $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : ''; 172 173 if ( $conditional ) { 174 $ie_conditional_prefix = "<!--[if {$conditional}]>\n"; 175 $ie_conditional_suffix = "<![endif]-->\n"; 176 } 177 171 $src = $obj->src; 178 172 $inline_style = $this->print_inline_style( $handle, false ); 179 173 … … 190 184 191 185 if ( $this->do_concat ) { 192 if ( $this->in_default_dir( $src ) && ! $conditional && !isset( $obj->extra['alt'] ) ) {186 if ( $this->in_default_dir( $src ) && ! isset( $obj->extra['alt'] ) ) { 193 187 $this->concat .= "$handle,"; 194 188 $this->concat_version .= "$handle$ver"; … … 280 274 281 275 if ( $this->do_concat ) { 282 $this->print_html .= $ie_conditional_prefix;283 276 $this->print_html .= $tag; 284 277 if ( $inline_style_tag ) { 285 278 $this->print_html .= $inline_style_tag; 286 279 } 287 $this->print_html .= $ie_conditional_suffix;288 280 } else { 289 echo $ie_conditional_prefix;290 281 echo $tag; 291 282 $this->print_inline_style( $handle ); 292 echo $ie_conditional_suffix;293 283 } 294 284 … … 372 362 373 363 return true; 364 } 365 366 /** 367 * Overrides the add_data method from WP_Dependencies, to allow unsetting dependencies for conditional styles. 368 * 369 * @since 6.9.0 370 * 371 * @param string $handle Name of the item. Should be unique. 372 * @param string $key The data key. 373 * @param mixed $value The data value. 374 * @return bool True on success, false on failure. 375 */ 376 public function add_data( $handle, $key, $value ) { 377 if ( ! isset( $this->registered[ $handle ] ) ) { 378 return false; 379 } 380 381 if ( 'conditional' === $key ) { 382 $this->registered[ $handle ]->deps = array(); 383 } 384 385 return parent::add_data( $handle, $key, $value ); 374 386 } 375 387
Note: See TracChangeset
for help on using the changeset viewer.