Ticket #16024: 16024.5.diff
File 16024.5.diff, 5.3 KB (added by , 11 years ago) |
---|
-
wp-includes/functions.wp-scripts.php
183 183 184 184 return (bool) $wp_scripts->query( $handle, $list ); 185 185 } 186 187 function wp_script_add_data( $handle, $key, $value ){ 188 global $wp_scripts; 189 if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) { 190 if ( ! did_action( 'init' ) ) 191 _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ), 192 '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.5' ); 193 $wp_scripts = new WP_Scripts(); 194 } 195 196 return (bool) $wp_scripts->add_data( $handle, $key, $value ); 197 } -
wp-includes/functions.wp-styles.php
190 190 191 191 return (bool) $wp_styles->query( $handle, $list ); 192 192 } 193 194 function wp_style_add_data( $handle, $key, $value ){ 195 global $wp_styles; 196 if ( ! is_a( $wp_styles, 'WP_Styles' ) ) { 197 if ( ! did_action( 'init' ) ) 198 _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ), 199 '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.5' ); 200 $wp_styles = new WP_Styles(); 201 } 202 203 return (bool) $wp_styles->add_data( $handle, $key, $value ); 204 } -
wp-includes/class.wp-scripts.php
83 83 return false; 84 84 } 85 85 86 $obj = $this->registered[$handle]; 87 86 88 if ( false === $group && in_array($handle, $this->in_footer, true) ) 87 89 $this->in_footer = array_diff( $this->in_footer, (array) $handle ); 88 90 89 if ( null === $ this->registered[$handle]->ver )91 if ( null === $obj->ver ) 90 92 $ver = ''; 91 93 else 92 $ver = $ this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;94 $ver = $obj->ver ? $obj->ver : $this->default_version; 93 95 94 96 if ( isset($this->args[$handle]) ) 95 97 $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle]; 96 98 97 $src = $ this->registered[$handle]->src;99 $src = $obj->src; 98 100 99 101 if ( $this->do_concat ) { 100 102 $srce = apply_filters( 'script_loader_src', $src, $handle ); 101 if ( $this->in_default_dir($srce) ) {103 if ( $this->in_default_dir($srce) && ! isset( $obj->extra['conditional'] ) ) { 102 104 $this->print_code .= $this->print_extra_script( $handle, false ); 103 105 $this->concat .= "$handle,"; 104 106 $this->concat_version .= "$handle$ver"; … … 119 121 120 122 $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) ); 121 123 124 $cond_before = $cond_after = null; 125 if ( isset($obj->extra['conditional']) && $obj->extra['conditional'] ) { 126 $cond_before = "<!--[if {$obj->extra['conditional']}]>\n"; 127 $cond_after = "<![endif]-->\n"; 128 } 129 122 130 if ( $this->do_concat ) 123 $this->print_html .= " <script type='text/javascript' src='$src'></script>\n";131 $this->print_html .= "$cond_before<script type='text/javascript' src='$src'></script>\n$cond_after"; 124 132 else 125 echo " <script type='text/javascript' src='$src'></script>\n";133 echo "$cond_before<script type='text/javascript' src='$src'></script>\n$cond_after"; 126 134 127 135 return true; 128 136 } -
wp-content/themes/twentytwelve/header.php
24 24 <title><?php wp_title( '|', true, 'right' ); ?></title> 25 25 <link rel="profile" href="http://gmpg.org/xfn/11" /> 26 26 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> 27 <?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>28 <!--[if lt IE 9]>29 <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>30 <![endif]-->31 27 <?php wp_head(); ?> 32 28 </head> 33 29 -
wp-content/themes/twentytwelve/functions.php
91 91 global $wp_styles; 92 92 93 93 /* 94 * Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. 95 */ 96 wp_enqueue_script( 'twentytwelve-html5', get_template_directory_uri() . '/js/html5.js', array(), '1.0', true ); 97 wp_script_add_data( 'twentytwelve-html5', 'conditional', 'lt IE 9' ); 98 99 /* 94 100 * Adds JavaScript to pages with the comment form to support 95 101 * sites with threaded comments (when in use). 96 102 */ … … 148 154 * Loads the Internet Explorer specific stylesheet. 149 155 */ 150 156 wp_enqueue_style( 'twentytwelve-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), '20121010' ); 151 $wp_styles->add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' );157 wp_style_add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' ); 152 158 } 153 159 add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' ); 154 160