Make WordPress Core


Ignore:
Timestamp:
02/17/2016 05:10:53 PM (11 years ago)
Author:
ocean90
Message:

Script/Style Dependencies: Make sure that inline styles for handles without a source are printed.

This prevents breaking plugins which are adding inline styles to the wp-admin handle after [36341].

Props dd32, ocean90.
Fixes #35229.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class.wp-styles.php

    r33222 r36550  
    7373                        $media = 'all';
    7474
     75                // A single item may alias a set of items, by having dependencies, but no source.
     76                if ( ! $obj->src ) {
     77                        if ( $inline_style = $this->print_inline_style( $handle, false ) ) {
     78                                $inline_style = sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style );
     79                                if ( $this->do_concat ) {
     80                                        $this->print_html .= $inline_style;
     81                                } else {
     82                                        echo $inline_style;
     83                                }
     84                        }
     85                        return true;
     86                }
     87
    7588                $href = $this->_css_href( $obj->src, $ver, $handle );
    76                 if ( empty( $href ) ) {
    77                         // Turns out there is nothing to print.
    78                         return true;
    79                 }
    8089                $rel = isset($obj->extra['alt']) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
    8190                $title = isset($obj->extra['title']) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : '';
Note: See TracChangeset for help on using the changeset viewer.