Make WordPress Core


Ignore:
Timestamp:
10/15/2013 02:34:33 PM (13 years ago)
Author:
nacin
Message:

Revert [25202] and enforce that wp_add_inline_style() does not want <style> tags.

Prior to 3.7, these tags were not printed (and thus needed to be provided), but only in the admin and when concatenation was enabled. They should never be required. Strip them when we find them and issue a notice for incorrect usage.

props atimmer, georgestephanis.
fixes #24813.

File:
1 edited

Legend:

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

    r25594 r25786  
    1515 * passing an array with one string prints that style,
    1616 * and passing an array of strings prints those styles.
    17  * 
     17 *
    1818 * @see do_action() Calls 'wp_print_styles' hook.
    1919 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
     
    7070                '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
    7171        $wp_styles = new WP_Styles();
     72    }
     73
     74    if ( false !== stripos( $data, '</style>' ) ) {
     75        _doing_it_wrong( __FUNCTION__, 'Do not pass <style> tags to wp_add_inline_style()', '3.7' );
     76        $data = trim( preg_replace( '#<style[^>]*>(.*)</style>#is', '$1', $data ) );
    7277    }
    7378
Note: See TracChangeset for help on using the changeset viewer.