Make WordPress Core

Ticket #30579: bug-fix-30579.diff

File bug-fix-30579.diff, 1.7 KB (added by kevdotbadger, 10 years ago)

Fixes 30579

  • src/wp-includes/class.wp-styles.php

    diff --git a/src/wp-includes/class.wp-styles.php b/src/wp-includes/class.wp-styles.php
    old mode 100644
    new mode 100755
    index eb16067..1140418
    a b class WP_Styles extends WP_Dependencies { 
    8989                 * @param string $handle The style's registered handle.
    9090                 */
    9191                $tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle );
     92
     93                // Add stylesheet outside the <head>, HTML4 and HTML5 have different specs.
     94                if ( isset($obj->extra['in_footer']) ) {
     95                        if ( current_theme_supports('html5') ) {
     96                                $tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' property='$handle-css-$rel' type='text/css' media='$media' />\n", $handle );
     97                        }else{
     98                                $tag = "<style id='$handle-css' type='text/css' media='$media'>@import url('$href')</style>\n";
     99                        }
     100                }
     101
    92102                if ( 'rtl' === $this->text_direction && isset($obj->extra['rtl']) && $obj->extra['rtl'] ) {
    93103                        if ( is_bool( $obj->extra['rtl'] ) || 'replace' === $obj->extra['rtl'] ) {
    94104                                $suffix = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : '';
    class WP_Styles extends WP_Dependencies { 
    227237                return false;
    228238        }
    229239
    230         public function do_footer_items() { // HTML 5 allows styles in the body, grab late enqueued items and output them in the footer.
     240        public function do_footer_items() {
     241                $footer_items = array_diff($this->queue, $this->done);
     242                if ( ! empty( $footer_items ) ) {
     243                        foreach ( $footer_items as $footer_item ) {
     244                                $this->registered[$footer_item]->extra['in_footer'] = true;
     245                        }
     246                }
     247
    231248                $this->do_items(false, 1);
    232249                return $this->done;
    233250        }