Ticket #8628: 8628-4.patch
File 8628-4.patch, 40.8 KB (added by , 16 years ago) |
---|
-
wp-admin/admin-ajax.php
63 63 echo join( $results, "\n" ); 64 64 die; 65 65 break; 66 case 'wp-compression-test' : 67 if ( !current_user_can( 'manage_options' ) ) 68 die('-1'); 69 70 if ( isset($_GET['tested']) ) { 71 if ( 1 == $_GET['tested'] ) 72 update_option('can_compress_scripts', 1); 73 elseif ( 0 == $_GET['tested'] ) 74 update_option('can_compress_scripts', 0); 75 } 76 die('0'); 77 break; 66 78 default : 67 79 do_action( 'wp_ajax_' . $_GET['action'] ); 68 80 die('0'); -
wp-admin/admin-footer.php
22 22 <p id="footer-upgrade" class="alignright"><?php echo $upgrade; ?></p> 23 23 <div class="clear"></div> 24 24 </div> 25 <?php do_action('admin_footer', ''); ?> 25 <?php 26 do_action('admin_footer', ''); 27 do_action('admin_print_footer_scripts'); 28 29 if ( false === get_option('can_compress_scripts') ) 30 compression_test(); 31 ?> 26 32 <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script> 27 33 </body> 28 </html> 29 No newline at end of file 34 </html> 35 -
wp-admin/includes/template.php
3387 3387 <?php 3388 3388 } 3389 3389 3390 /** 3391 * Test support for compressed JavaScript and CSS 3392 * 3393 * Outputs JavaScript that tests if compression from PHP works properly 3394 * and sets an option with the result. Has no effect when the current user 3395 * is not Administrator. To run the test again the option 'can_compress_scripts' 3396 * has to be deleted. 3397 * 3398 * @since 2.8.0 3399 */ 3400 function compression_test() { 3390 3401 ?> 3402 <script type="text/javascript" src="load-scripts.php?test=1"></script> 3403 <script type="text/javascript"> 3404 /* <![CDATA[ */ 3405 (function() { 3406 var x, test = typeof wpCompressionTest == 'undefined' ? 0 : 1; 3407 if ( window.XMLHttpRequest ) { 3408 x = new XMLHttpRequest(); 3409 } else { 3410 try{x=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{x=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){};} 3411 } 3412 3413 if (x) { 3414 x.open('GET', 'admin-ajax.php?action=wp-compression-test&tested='+test+'&'+(new Date()).getTime(), true); 3415 x.send(''); 3416 } 3417 })(); 3418 /* ]]> */ 3419 </script> 3420 <?php 3421 } 3422 3423 ?> -
wp-admin/load-scripts.php
1 <?php 2 3 /** Set ABSPATH for execution */ 4 define( 'ABSPATH', dirname(dirname(__FILE__)) ); 5 define( 'WPINC', '/wp-includes' ); 6 7 /** 8 * @ignore 9 */ 10 function __() {} 11 12 /** 13 * @ignore 14 */ 15 function _c() {} 16 17 /** 18 * @ignore 19 */ 20 function add_filter() {} 21 22 /** 23 * @ignore 24 */ 25 function attribute_escape() {} 26 27 /** 28 * @ignore 29 */ 30 function apply_filters() {} 31 32 /** 33 * @ignore 34 */ 35 function get_option() {} 36 37 /** 38 * @ignore 39 */ 40 function is_lighttpd_before_150() {} 41 42 /** 43 * @ignore 44 */ 45 function add_action() {} 46 47 /** 48 * @ignore 49 */ 50 function do_action_ref_array() {} 51 52 /** 53 * @ignore 54 */ 55 function get_bloginfo() {} 56 57 /** 58 * @ignore 59 */ 60 function is_admin() {return true;} 61 62 /** 63 * @ignore 64 */ 65 function site_url() {} 66 67 /** 68 * @ignore 69 */ 70 function admin_url() {} 71 72 /** 73 * @ignore 74 */ 75 function wp_guess_url() {} 76 77 function get_file($path) { 78 79 if ( function_exists('realpath') ) 80 $path = realpath($path); 81 82 if ( ! $path || ! @is_file($path) ) 83 return ''; 84 85 return @file_get_contents($path); 86 } 87 88 if ( isset($_GET['test']) && 1 == $_GET['test'] ) { 89 if ( ini_get('zlib.output_compression') ) 90 exit(''); 91 92 $out = 'var wpCompressionTest = 1;'; 93 94 $compressed = false; 95 if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') ) { 96 header('Content-Encoding: deflate'); 97 $out = gzdeflate( $out, 3 ); 98 $compressed = true; 99 } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) { 100 header('Content-Encoding: gzip'); 101 $out = gzencode( $out, 3 ); 102 $compressed = true; 103 } 104 105 if ( ! $compressed ) 106 exit(''); 107 108 header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); 109 header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); 110 header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); 111 header( 'Pragma: no-cache' ); 112 header( 'Content-Type: application/x-javascript; charset=UTF-8' ); 113 exit($out); 114 } 115 116 $load = preg_replace( '/[^a-z0-9,_-]*/i', '', $_GET['load'] ); 117 $load = explode(',', $load); 118 119 if ( empty($load) ) 120 exit; 121 122 require(ABSPATH . '/wp-includes/script-loader.php'); 123 require(ABSPATH . '/wp-includes/version.php'); 124 125 // Discard any buffers 126 while ( @ob_end_clean() ); 127 128 129 $compress = ( isset($_GET['c']) && 1 == $_GET['c'] ); 130 $expires_offset = 31536000; 131 //$last_modified = filemtime(ABSPATH . '/wp-includes/version.php'); 132 133 $wp_scripts = new WP_Scripts(); 134 wp_default_scripts($wp_scripts); 135 136 foreach( $load as $handle ) { 137 if ( !array_key_exists($handle, $wp_scripts->registered) ) 138 continue; 139 140 $path = ABSPATH . $wp_scripts->registered[$handle]->src; 141 $out .= get_file($path) . "\n"; 142 } 143 144 header('Content-Type: application/x-javascript; charset=UTF-8'); 145 header('Vary: Accept-Encoding'); // Handle proxies 146 header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT'); 147 //header('Last-Modified: ' . gmdate( "D, d M Y H:i:s", $last_modified ) . ' GMT'); 148 header("Cache-Control: public, max-age=$expires_offset"); 149 150 if ( $compress && ! ini_get('zlib.output_compression') ) { 151 if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') ) { 152 header('Content-Encoding: deflate'); 153 $out = gzdeflate( $out, 3 ); 154 } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) { 155 header('Content-Encoding: gzip'); 156 $out = gzencode( $out, 3 ); 157 } 158 } 159 160 echo $out; -
wp-admin/load-styles.php
Property changes on: wp-admin\load-scripts.php ___________________________________________________________________ Added: svn:eol-style + native
1 <?php 2 3 /** Set ABSPATH for execution */ 4 define( 'ABSPATH', dirname(dirname(__FILE__)) ); 5 define( 'WPINC', '/wp-includes' ); 6 7 /** 8 * @ignore 9 */ 10 function __() {} 11 12 /** 13 * @ignore 14 */ 15 function _c() {} 16 17 /** 18 * @ignore 19 */ 20 function add_filter() {} 21 22 /** 23 * @ignore 24 */ 25 function attribute_escape() {} 26 27 /** 28 * @ignore 29 */ 30 function apply_filters() {} 31 32 /** 33 * @ignore 34 */ 35 function get_option() {} 36 37 /** 38 * @ignore 39 */ 40 function is_lighttpd_before_150() {} 41 42 /** 43 * @ignore 44 */ 45 function add_action() {} 46 47 /** 48 * @ignore 49 */ 50 function do_action_ref_array() {} 51 52 /** 53 * @ignore 54 */ 55 function get_bloginfo() {} 56 57 /** 58 * @ignore 59 */ 60 function is_admin() {return true;} 61 62 /** 63 * @ignore 64 */ 65 function site_url() {} 66 67 /** 68 * @ignore 69 */ 70 function admin_url() {} 71 72 /** 73 * @ignore 74 */ 75 function wp_guess_url() {} 76 77 function get_file($path) { 78 79 if ( function_exists('realpath') ) 80 $path = realpath($path); 81 82 if ( ! $path || ! @is_file($path) ) 83 return ''; 84 85 return @file_get_contents($path); 86 } 87 88 require(ABSPATH . '/wp-includes/script-loader.php'); 89 require(ABSPATH . '/wp-includes/version.php'); 90 91 // Discard any buffers 92 while ( @ob_end_clean() ); 93 94 $load = preg_replace( '/[^a-z0-9,_-]*/i', '', $_GET['load'] ); 95 $load = explode(',', $load); 96 97 if ( empty($load) ) 98 exit; 99 100 $compress = ( isset($_GET['c']) && 1 == $_GET['c'] ); 101 $rtl = ( isset($_GET['rtl']) && 1 == $_GET['rtl'] ); 102 $expires_offset = 31536000; 103 //$last_modified = filemtime(ABSPATH . '/wp-includes/version.php'); 104 105 $wp_styles = new WP_Styles(); 106 wp_default_styles($wp_styles); 107 108 foreach( $load as $handle ) { 109 if ( !array_key_exists($handle, $wp_styles->registered) ) 110 continue; 111 112 $style = $wp_styles->registered[$handle]; 113 $path = ABSPATH . $style->src; 114 115 $content = get_file($path) . "\n"; 116 117 if ( $rtl && isset($style->extra['rtl']) && $style->extra['rtl'] ) { 118 $rtl_path = is_bool($style->extra['rtl']) ? str_replace( '.css', '-rtl.css', $path ) : ABSPATH . $style->extra['rtl']; 119 $content .= get_file($rtl_path) . "\n"; 120 } 121 122 $out .= str_replace( '../images/', 'images/', $content ); 123 } 124 125 header( 'Content-Type: text/css' ); 126 header('Vary: Accept-Encoding'); // Handle proxies 127 header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT'); 128 //header('Last-Modified: ' . gmdate( "D, d M Y H:i:s", $last_modified ) . ' GMT'); 129 header("Cache-Control: public, max-age=$expires_offset"); 130 131 if ( $compress && ! ini_get('zlib.output_compression') ) { 132 if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') ) { 133 header('Content-Encoding: deflate'); 134 $out = gzdeflate( $out, 3 ); 135 } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) { 136 header('Content-Encoding: gzip'); 137 $out = gzencode( $out, 3 ); 138 } 139 } 140 141 echo $out; -
wp-includes/class.wp-dependencies.php
Property changes on: wp-admin\load-styles.php ___________________________________________________________________ Added: svn:eol-style + native
22 22 var $to_do = array(); 23 23 var $done = array(); 24 24 var $args = array(); 25 var $groups = array(); 26 var $group = 0; 25 27 26 28 function WP_Dependencies() { 27 29 $args = func_get_args(); … … 38 40 * @param mixed handles (optional) items to be processed. (void) processes queue, (string) process that item, (array of strings) process those items 39 41 * @return array Items that have been processed 40 42 */ 41 function do_items( $handles = false ) {43 function do_items( $handles = false, $group = false ) { 42 44 // Print the queue if nothing is passed. If a string is passed, print that script. If an array is passed, print those scripts. 43 45 $handles = false === $handles ? $this->queue : (array) $handles; 44 46 $this->all_deps( $handles ); 45 47 46 foreach( $this->to_do as $ handle ) {48 foreach( $this->to_do as $key => $handle ) { 47 49 if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) { 48 if ( $this->registered[$handle]->src ) { // Else it defines a group. 49 $this->do_item( $handle ); 50 51 if ( ! $this->registered[$handle]->src ) { // Defines a group. 52 $this->done[] = $handle; 53 continue; 50 54 } 51 $this->done[] = $handle; 55 56 if ( $this->do_item( $handle, $group ) ) 57 $this->done[] = $handle; 58 59 unset( $this->to_do[$key] ); 52 60 } 53 61 } 54 62 55 $this->to_do = array();56 63 return $this->done; 57 64 } 58 65 … … 69 76 * @param mixed handles Accepts (string) dep name or (array of strings) dep names 70 77 * @param bool recursion Used internally when function calls itself 71 78 */ 72 function all_deps( $handles, $recursion = false ) {79 function all_deps( $handles, $recursion = false, $group = false ) { 73 80 if ( !$handles = (array) $handles ) 74 81 return false; 75 82 76 83 foreach ( $handles as $handle ) { 77 $handle = explode('?', $handle); 78 if ( isset($handle[1]) ) 79 $this->args[$handle[0]] = $handle[1]; 80 $handle = $handle[0]; 84 $handle_parts = explode('?', $handle); 85 $handle = $handle_parts[0]; 81 86 82 if ( i sset($this->to_do[$handle]) ) // Already grobbed it and its deps87 if ( in_array($handle, $this->done, true) ) // Already done 83 88 continue; 84 89 90 $this->set_group( $handle, $recursion, $group ); 91 92 if ( in_array($handle, $this->to_do, true) ) // Already grobbed it and its deps 93 continue; 94 95 if ( isset($handle_parts[1]) ) 96 $this->args[$handle] = $handle_parts[1]; 97 85 98 $keep_going = true; 86 99 if ( !isset($this->registered[$handle]) ) 87 100 $keep_going = false; // Script doesn't exist 88 101 elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) ) 89 102 $keep_going = false; // Script requires deps which don't exist (not a necessary check. efficiency?) 90 elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true ) )103 elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $group ) ) 91 104 $keep_going = false; // Script requires deps which don't exist 92 105 93 106 if ( !$keep_going ) { // Either script or its deps don't exist. … … 97 110 continue; // We're at the top level. Move on to the next one. 98 111 } 99 112 100 $this->to_do[ $handle] = true;113 $this->to_do[] = $handle; 101 114 } 102 115 103 if ( !$recursion ) // at the end104 $this->to_do = array_keys( $this->to_do );105 116 return true; 106 117 } 107 118 … … 181 192 return false; 182 193 } 183 194 195 function set_group( $handle, $recursion, $group ) { 196 $group = (int) $group; 197 198 if ( $recursion ) 199 $group = min($this->group, $group); 200 else 201 $this->group = $group; 202 203 if ( isset($this->groups[$handle]) && $this->groups[$handle] <= $group ) 204 return false; 205 206 $this->groups[$handle] = $group; 207 return true; 208 } 209 184 210 } 185 211 186 212 class _WP_Dependency { -
wp-includes/class.wp-scripts.php
18 18 */ 19 19 class WP_Scripts extends WP_Dependencies { 20 20 var $base_url; // Full URL with trailing slash 21 var $content_url; 21 22 var $default_version; 23 var $concatenate = false; 24 var $compress = false; 25 var $in_footer = array(); 26 var $concat = ''; 27 var $concat_version = ''; 28 var $do_concat = false; 29 var $printing = ''; 22 30 23 31 function __construct() { 24 32 do_action_ref_array( 'wp_default_scripts', array(&$this) ); … … 30 38 * Prints the scripts passed to it or the print queue. Also prints all necessary dependencies. 31 39 * 32 40 * @param mixed handles (optional) Scripts to be printed. (void) prints queue, (string) prints that script, (array of strings) prints those scripts. 41 * @param int group (optional) If scripts were queued in groups prints this group number. 33 42 * @return array Scripts that have been printed 34 43 */ 35 function print_scripts( $handles = false ) {36 return $this->do_items( $handles );44 function print_scripts( $handles = false, $group = false ) { 45 return $this->do_items( $handles, $group ); 37 46 } 38 47 39 function print_scripts_l10n( $handle ) {48 function print_scripts_l10n( $handle, $echo = true ) { 40 49 if ( empty($this->registered[$handle]->extra['l10n']) || empty($this->registered[$handle]->extra['l10n'][0]) || !is_array($this->registered[$handle]->extra['l10n'][1]) ) 41 50 return false; 42 51 43 52 $object_name = $this->registered[$handle]->extra['l10n'][0]; 44 53 45 echo "<script type='text/javascript'>\n"; 46 echo "/* <![CDATA[ */\n"; 47 echo "\t$object_name = {\n"; 54 $data = "\t$object_name = {\n"; 48 55 $eol = ''; 49 56 foreach ( $this->registered[$handle]->extra['l10n'][1] as $var => $val ) { 50 57 if ( 'l10n_print_after' == $var ) { 51 58 $after = $val; 52 59 continue; 53 60 } 54 echo"$eol\t\t$var: \"" . js_escape( $val ) . '"';61 $data .= "$eol\t\t$var: \"" . js_escape( $val ) . '"'; 55 62 $eol = ",\n"; 56 63 } 57 echo "\n\t}\n"; 58 echo isset($after) ? "\t$after\n" : ''; 59 echo "/* ]]> */\n"; 60 echo "</script>\n"; 64 $data .= "\n\t}\n"; 65 $data .= isset($after) ? "\t$after\n" : ''; 61 66 62 return true; 67 if ( $echo ) { 68 echo "<script type='text/javascript'>\n"; 69 echo "/* <![CDATA[ */\n"; 70 echo $data; 71 echo "/* ]]> */\n"; 72 echo "</script>\n"; 73 return true; 74 } else { 75 return $data; 76 } 63 77 } 64 78 65 function do_item( $handle ) {79 function do_item( $handle, $group = false ) { 66 80 if ( !parent::do_item($handle) ) 67 81 return false; 68 82 83 if ( 0 === $group && $this->groups[$handle] > 0 ) { 84 $this->in_footer[] = $handle; 85 return false; 86 } 87 88 if ( false === $group && in_array($handle, $this->in_footer, true) ) 89 $this->in_footer = array_diff( $this->in_footer, (array) $handle ); 90 69 91 $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version; 70 92 if ( isset($this->args[$handle]) ) 71 93 $ver .= '&' . $this->args[$handle]; 72 94 73 95 $src = $this->registered[$handle]->src; 74 if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) { 96 $this->print_scripts_l10n( $handle ); 97 98 if ( $this->do_concat ) { 99 $srce = apply_filters( 'script_loader_src', $src, $handle, $echo ); 100 if ( 0 === strpos($srce, '/wp-admin/js/') || 0 === strpos($srce, '/wp-includes/js/') ) { 101 $this->concat .= $handle . ','; 102 $this->concat_version .= $ver; 103 return true; 104 } 105 } 106 107 if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) { 75 108 $src = $this->base_url . $src; 76 109 } 77 110 78 111 $src = add_query_arg('ver', $ver, $src); 79 $src = clean_url(apply_filters( 'script_loader_src', $src, $handle ));112 $src = clean_url(apply_filters( 'script_loader_src', $src, $handle, $echo )); 80 113 81 $this->print_scripts_l10n( $handle ); 114 if ( $this->do_concat ) 115 $this->printing .= "<script type='text/javascript' src='$src'></script>\n"; 116 else 117 echo "<script type='text/javascript' src='$src'></script>\n"; 82 118 83 echo "<script type='text/javascript' src='$src'></script>\n";84 85 119 return true; 86 120 } 87 121 … … 101 135 return $this->add_data( $handle, 'l10n', array( $object_name, $l10n ) ); 102 136 } 103 137 138 function set_group( $handle, $recursion, $group = false ) { 139 $grp = isset($this->registered[$handle]->extra['group']) ? (int) $this->registered[$handle]->extra['group'] : 0; 140 if ( false !== $group && $grp > $group ) 141 $grp = $group; 142 143 parent::set_group( $handle, $recursion, $grp ); 144 } 145 104 146 function all_deps( $handles, $recursion = false ) { 105 147 $r = parent::all_deps( $handles, $recursion ); 106 148 if ( !$recursion ) 107 149 $this->to_do = apply_filters( 'print_scripts_array', $this->to_do ); 108 150 return $r; 109 151 } 152 153 function do_head_items() { 154 $this->do_concat = $this->concatenate; 155 $zip = $this->compress ? 1 : 0; 156 157 $this->do_items(false, 0); 158 159 if ( !empty($this->concat) ) { 160 $ver = md5($this->concat_version); 161 $src = $this->base_url . "/wp-admin/load-scripts.php?c={$zip}&load=" . rtrim($this->concat, ',') . "&ver=$ver"; 162 echo "<script type='text/javascript' src='$src'></script>\n"; 163 } 164 165 if ( !empty($this->printing) ) 166 echo $this->printing; 167 168 $this->do_concat = false; 169 return $this->done; 170 } 171 172 function do_footer_items() { 173 $this->concat = $this->concat_version = $this->printing = ''; 174 $this->do_concat = $this->concatenate; 175 $zip = $this->compress ? 1 : 0; 176 177 if ( !empty($this->in_footer) ) { 178 foreach( $this->in_footer as $key => $handle ) { 179 if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) { 180 $this->do_item($handle, false, $this->doecho); 181 $this->done[] = $handle; 182 unset( $this->in_footer[$key] ); 183 } 184 } 185 } 186 187 if ( !empty($this->concat) ) { 188 $ver = md5($this->concat_version); 189 $src = $this->base_url . "/wp-admin/load-scripts.php?c={$zip}&load=" . rtrim($this->concat, ',') . "&ver=$ver"; 190 echo "<script type='text/javascript' src='$src'></script>\n"; 191 } 192 193 if ( !empty($this->printing) ) 194 echo $this->printing; 195 196 return $this->done; 197 } 110 198 } -
wp-includes/class.wp-styles.php
18 18 */ 19 19 class WP_Styles extends WP_Dependencies { 20 20 var $base_url; 21 var $content_url; 21 22 var $default_version; 23 var $concatenate = false; 24 var $compress = false; 22 25 var $text_direction = 'ltr'; 26 var $concat = ''; 27 var $concat_version = ''; 28 var $do_concat = false; 29 var $printing = ''; 23 30 24 31 function __construct() { 25 32 do_action_ref_array( 'wp_default_styles', array(&$this) ); … … 33 40 if ( isset($this->args[$handle]) ) 34 41 $ver .= '&' . $this->args[$handle]; 35 42 43 if ( $this->do_concat ) { 44 if ( 0 === strpos($this->registered[$handle]->src, '/wp-admin/') && !isset($this->registered[$handle]->extra['conditional']) ) { 45 $this->concat .= $handle . ','; 46 $this->concat_version .= $ver; 47 return true; 48 } 49 } 50 36 51 if ( isset($this->registered[$handle]->args) ) 37 52 $media = attribute_escape( $this->registered[$handle]->args ); 38 53 else … … 42 57 $rel = isset($this->registered[$handle]->extra['alt']) && $this->registered[$handle]->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; 43 58 $title = isset($this->registered[$handle]->extra['title']) ? "title='" . attribute_escape( $this->registered[$handle]->extra['title'] ) . "'" : ''; 44 59 45 $end_cond = '';60 $end_cond = $tag = ''; 46 61 if ( isset($this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) { 47 echo"<!--[if {$this->registered[$handle]->extra['conditional']}]>\n";62 $tag .= "<!--[if {$this->registered[$handle]->extra['conditional']}]>\n"; 48 63 $end_cond = "<![endif]-->\n"; 49 64 } 50 65 51 echoapply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle' $title href='$href' type='text/css' media='$media' />\n", $handle );66 $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle' $title href='$href' type='text/css' media='$media' />\n", $handle ); 52 67 if ( 'rtl' === $this->text_direction && isset($this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) { 53 68 if ( is_bool( $this->registered[$handle]->extra['rtl'] ) ) 54 69 $rtl_href = str_replace( '.css', '-rtl.css', $href ); 55 70 else 56 71 $rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" ); 57 72 58 echoapply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle );73 $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle ); 59 74 } 60 75 61 echo $end_cond; 76 $tag .= $end_cond; 77 78 if ( $this->do_concat ) 79 $this->printing .= $tag; 80 else 81 echo $tag; 62 82 63 83 // Could do something with $this->registered[$handle]->extra here to print out extra CSS rules 64 84 // echo "<style type='text/css'>\n"; … … 77 97 } 78 98 79 99 function _css_href( $src, $ver, $handle ) { 80 if ( !preg_match('|^https?://|', $src) && ! preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {100 if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) { 81 101 $src = $this->base_url . $src; 82 102 } 83 103 … … 85 105 $src = apply_filters( 'style_loader_src', $src, $handle ); 86 106 return clean_url( $src ); 87 107 } 108 109 function do_default_items() { 110 $this->do_concat = $this->concatenate; 111 $zip = $this->compress ? 1 : 0; 88 112 113 $this->do_items(false); 114 115 if ( !empty($this->concat) ) { 116 $ver = md5($this->concat_version); 117 $rtl = 'rtl' === $this->text_direction ? 1 : 0; 118 $href = $this->base_url . "/wp-admin/load-styles.php?c={$zip}&rtl={$rtl}&load=" . rtrim($this->concat, ',') . "&ver=$ver"; 119 echo "<link rel='stylesheet' href='$href' type='text/css' media='all' />\n"; 120 } 121 122 if ( !empty($this->printing) ) 123 echo $this->printing; 124 125 $this->do_concat = false; 126 return $this->done; 127 } 128 89 129 } -
wp-includes/default-filters.php
181 181 add_action('do_pings', 'do_all_pings', 10, 1); 182 182 add_action('do_robots', 'do_robots'); 183 183 add_action('sanitize_comment_cookies', 'sanitize_comment_cookies'); 184 add_action('admin_print_scripts', 'wp_print_scripts', 20); 185 add_action('admin_print_styles', 'wp_print_styles', 20); 184 add_action('admin_print_scripts', 'wp_print_head_scripts', 20); 185 add_action('admin_print_footer_scripts', 'wp_print_footer_scripts', 20); 186 add_action('admin_print_styles', 'wp_print_admin_styles', 20); 186 187 add_action('init', 'smilies_init', 5); 187 188 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); 188 189 add_action( 'shutdown', 'wp_ob_end_flush_all', 1); -
wp-includes/functions.wp-scripts.php
9 9 /** 10 10 * Prints script tags in document head. 11 11 * 12 * Called byadmin-header.php and by wp_head hook. Since it is called by wp_head12 * Called in admin-header.php and by wp_head hook. Since it is called by wp_head 13 13 * on every page load, the function does not instantiate the WP_Scripts object 14 14 * unless script names are explicitly passed. Does make use of already 15 15 * instantiated $wp_scripts if present. Use provided wp_print_scripts hook to … … 18 18 * @since r16 19 19 * @see WP_Scripts::print_scripts() 20 20 */ 21 function wp_print_scripts( $handles = false ) {21 function wp_print_scripts( $handles = false, $group = false ) { 22 22 do_action( 'wp_print_scripts' ); 23 23 if ( '' === $handles ) // for wp_head 24 24 $handles = false; … … 31 31 $wp_scripts = new WP_Scripts(); 32 32 } 33 33 34 return $wp_scripts->do_items( $handles );34 return $wp_scripts->do_items( $handles, $group ); 35 35 } 36 36 37 37 /** 38 * Print the script queue in the HTML head. 39 * 40 * Postpones the scripts that were queued for the footer. 41 * wp_print_footer_scripts() has to be called in the footer to print these scripts. 42 * 43 * @since unknown 44 * @see wp_print_scripts() 45 */ 46 function wp_print_head_scripts() { 47 do_action( 'wp_print_scripts' ); 48 49 global $wp_scripts; 50 if ( !is_a($wp_scripts, 'WP_Scripts') ) 51 $wp_scripts = new WP_Scripts(); 52 53 return $wp_scripts->do_head_items(); 54 } 55 56 /** 57 * Print the scripts that were queued for the footer. 58 * 59 * @since unknown 60 * @see WP_Scripts::do_footer_items() 61 */ 62 function wp_print_footer_scripts() { 63 global $wp_scripts; 64 65 if ( !is_a($wp_scripts, 'WP_Scripts') ) 66 return array(); // No need to run if not instantiated. 67 68 return $wp_scripts->do_footer_items(); 69 } 70 71 /** 38 72 * Register new JavaScript file. 39 73 * 40 74 * @since r16 -
wp-includes/functions.wp-styles.php
77 77 } 78 78 $wp_styles->enqueue( $handle ); 79 79 } 80 81 function wp_print_admin_styles() { 82 global $wp_styles; 83 84 if ( !is_a($wp_styles, 'WP_Styles') ) 85 $wp_styles = new WP_Styles(); 86 87 return $wp_styles->do_default_items(); 88 } -
wp-includes/script-loader.php
35 35 * @param object $scripts WP_Scripts object. 36 36 */ 37 37 function wp_default_scripts( &$scripts ) { 38 if (!$guessurl = site_url()) 38 39 if ( !$guessurl = site_url() ) 39 40 $guessurl = wp_guess_url(); 40 41 41 42 $scripts->base_url = $guessurl; 43 $scripts->content_url = WP_CONTENT_URL; 42 44 $scripts->default_version = get_bloginfo( 'version' ); 45 46 $scripts->concatenate = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true; 47 if ( $scripts->concatenate && -1 == get_option('concatenate_scripts') ) 48 $scripts->concatenate = false; 49 50 $scripts->compress = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true; 51 if ( $scripts->compress && ! get_option('can_compress_scripts') ) 52 $scripts->compress = false; 53 43 54 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; 44 55 56 45 57 $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' ); 46 58 47 59 $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090106' ); 60 $scripts->add_data( 'common', 'group', 1 ); 48 61 $scripts->localize( 'common', 'commonL10n', array( 49 62 'warnDelete' => __("You are about to delete the selected items.\n 'Cancel' to stop, 'OK' to delete."), 50 63 'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};' 51 64 ) ); 52 65 53 66 $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1' ); 67 $scripts->add_data( 'sack', 'group', 1 ); 54 68 55 69 $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20090102' ); 56 70 $scripts->localize( 'quicktags', 'quicktagsL10n', array( … … 79 93 $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); 80 94 81 95 $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), '20090102' ); 96 $scripts->add_data( 'wp-ajax-response', 'group', 1 ); 82 97 $scripts->localize( 'wp-ajax-response', 'wpAjax', array( 83 98 'noPerm' => __('You do not have permission to do that.'), 84 99 'broken' => __('An unidentified error has occurred.'), … … 86 101 ) ); 87 102 88 103 $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20090106' ); 104 $scripts->add_data( 'autosave', 'group', 1 ); 89 105 90 106 $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20090102' ); 107 $scripts->add_data( 'wp-lists', 'group', 1 ); 91 108 $scripts->localize( 'wp-lists', 'wpListL10n', array( 92 109 'url' => admin_url('admin-ajax.php') 93 110 ) ); … … 104 121 $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118'); 105 122 106 123 $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.3b2'); 124 125 $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.2' ); 126 $scripts->add_data( 'jquery-ui-core', 'group', 1 ); 127 128 $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.2' ); 129 $scripts->add_data( 'jquery-ui-tabs', 'group', 1 ); 130 131 $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.2c' ); 132 $scripts->add_data( 'jquery-ui-sortable', 'group', 1 ); 133 134 $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.5.2' ); 135 $scripts->add_data( 'jquery-ui-draggable', 'group', 1 ); 136 137 $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' ); 138 $scripts->add_data( 'jquery-ui-resizable', 'group', 1 ); 139 140 $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' ); 141 $scripts->add_data( 'jquery-ui-dialog', 'group', 1 ); 142 107 143 $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '2.02m'); 144 $scripts->add_data( 'jquery-form', 'group', 1 ); 145 108 146 $scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.0-4561m'); 147 $scripts->add_data( 'jquery-color', 'group', 1 ); 148 109 149 $scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' ); 150 110 151 $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1bm'); 152 $scripts->add_data( 'suggest', 'group', 1 ); 153 111 154 $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m'); 155 $scripts->add_data( 'schedule', 'group', 1 ); 156 112 157 $scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m' ); 158 $scripts->add_data( 'jquery-hotkeys', 'group', 1 ); 159 113 160 $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), '20090102' ); 161 $scripts->add_data( 'jquery-table-hotkeys', 'group', 1 ); 162 114 163 $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20080430m'); 164 $scripts->add_data( 'thickbox', 'group', 1 ); 115 165 166 116 167 if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) { 117 168 $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.2.0-20081031'); 118 169 $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload'), '2.2.0-20081031'); … … 150 201 'is_lighttpd_before_150' => is_lighttpd_before_150(), 151 202 ) ); 152 203 153 $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.2' );154 $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.2' );155 $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.2c' );156 $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.5.2' );157 $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' );158 $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' );159 160 204 $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102'); 161 205 162 206 if ( is_admin() ) { 163 207 $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' ); 208 $scripts->add_data( 'ajaxcat', 'group', 1 ); 164 209 $scripts->localize( 'ajaxcat', 'catL10n', array( 165 210 'add' => attribute_escape(__('Add')), 166 211 'how' => __('Separate multiple categories with commas.'), … … 168 213 ) ); 169 214 170 215 $scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20090102' ); 216 $scripts->add_data( 'admin-categories', 'group', 1 ); 171 217 172 218 $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('wp-lists'), '20090102' ); 219 $scripts->add_data( 'admin-tags', 'group', 1 ); 173 220 174 221 $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' ); 222 $scripts->add_data( 'admin-custom-fields', 'group', 1 ); 175 223 176 224 $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20090102' ); 225 $scripts->add_data( 'password-strength-meter', 'group', 1 ); 177 226 $scripts->localize( 'password-strength-meter', 'pwsL10n', array( 178 227 'empty' => __('Strength indicator'), 179 228 'short' => __('Very weak'), … … 184 233 ) ); 185 234 186 235 $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090102' ); 236 $scripts->add_data( 'admin-comments', 'group', 1 ); 187 237 $scripts->localize( 'admin-comments', 'adminCommentsL10n', array( 188 238 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 189 239 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']) … … 192 242 $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' ); 193 243 194 244 $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090102' ); 245 $scripts->add_data( 'postbox', 'group', 1 ); 195 246 $scripts->localize( 'postbox', 'postboxL10n', array( 196 247 'requestFile' => admin_url('admin-ajax.php') 197 248 ) ); 198 249 199 250 $scripts->add( 'slug', "/wp-admin/js/slug$suffix.js", array('jquery'), '20090102' ); 251 $scripts->add_data( 'slug', 'group', 1 ); 200 252 $scripts->localize( 'slug', 'slugL10n', array( 201 253 'requestFile' => admin_url('admin-ajax.php'), 202 254 'save' => __('Save'), … … 205 257 ) ); 206 258 207 259 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20090102' ); 260 $scripts->add_data( 'post', 'group', 1 ); 208 261 $scripts->localize( 'post', 'postL10n', array( 209 262 'tagsUsed' => __('Tags used on this post:'), 210 263 'add' => attribute_escape(__('Add')), … … 232 285 ) ); 233 286 234 287 $scripts->add( 'page', "/wp-admin/js/page$suffix.js", array('jquery', 'slug', 'wp-lists', 'postbox'), '20090102' ); 288 $scripts->add_data( 'page', 'group', 1 ); 235 289 $scripts->localize( 'page', 'postL10n', array( 236 290 'cancel' => __('Cancel'), 237 291 'edit' => __('Edit'), … … 254 308 ) ); 255 309 256 310 $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20090102' ); 311 $scripts->add_data( 'link', 'group', 1 ); 257 312 258 313 $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery'), '20090102' ); 314 $scripts->add_data( 'comment', 'group', 1 ); 259 315 $scripts->localize( 'comment', 'commentL10n', array( 260 316 'cancel' => __('Cancel'), 261 317 'edit' => __('Edit'), … … 265 321 $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ), '20090102' ); 266 322 267 323 $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20090102' ); 324 $scripts->add_data( 'media-upload', 'group', 1 ); 268 325 269 326 $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'interface' ), '20090106' ); 270 327 $scripts->localize( 'admin-widgets', 'widgetsL10n', array( … … 277 334 )); 278 335 279 336 $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20090102' ); 337 $scripts->add_data( 'word-count', 'group', 1 ); 280 338 $scripts->localize( 'word-count', 'wordCountL10n', array( 281 339 'count' => __('Word count: %d'), 282 340 'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};' … … 290 348 )); 291 349 292 350 $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090102' ); 351 $scripts->add_data( 'theme-preview', 'group', 1 ); 293 352 294 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'jquery-form', 'suggest' ), '20090102' ); 353 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery-form', 'suggest' ), '20090102' ); 354 $scripts->add_data( 'inline-edit-post', 'group', 1 ); 295 355 $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 296 356 'error' => __('Error while saving the changes.'), 297 357 'ntdeltitle' => __('Remove From Bulk Edit'), … … 299 359 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' 300 360 ) ); 301 361 302 $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'jquery-form' ), '20090109' ); 362 $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery-form' ), '20090109' ); 363 $scripts->add_data( 'inline-edit-tax', 'group', 1 ); 303 364 $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( 304 365 'error' => __('Error while saving the changes.'), 305 366 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' 306 367 ) ); 307 368 308 369 $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'thickbox', 'jquery' ), '20090102' ); 370 $scripts->add_data( 'plugin-install', 'group', 1 ); 309 371 $scripts->localize( 'plugin-install', 'plugininstallL10n', array( 310 372 'plugin_information' => __('Plugin Information:'), 311 373 'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};' 312 374 ) ); 313 375 314 376 $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' ); 377 $scripts->add_data( 'farbtastic', 'group', 1 ); 315 378 316 379 $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090102' ); 380 $scripts->add_data( 'dashboard', 'group', 1 ); 317 381 318 382 $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '20090102' ); 383 $scripts->add_data( 'hoverIntent', 'group', 1 ); 319 384 385 $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), '20081223' ); 386 $scripts->add_data( 'media', 'group', 1 ); 387 320 388 } 321 389 } 322 390 … … 340 408 // then it assigns $guess_url to wp_guess_url(). Strange format, but it works. 341 409 if ( ! $guessurl = site_url() ) 342 410 $guessurl = wp_guess_url(); 411 343 412 $styles->base_url = $guessurl; 413 $styles->content_url = WP_CONTENT_URL; 344 414 $styles->default_version = get_bloginfo( 'version' ); 345 415 $styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr'; 346 416 417 $styles->concatenate = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true; 418 if ( $styles->concatenate && -1 == get_option('concatenate_scripts') ) 419 $styles->concatenate = false; 420 421 $styles->compress = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true; 422 if ( $styles->compress && ! get_option('can_compress_scripts') ) 423 $styles->compress = false; 424 425 347 426 $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' ); 348 427 349 428 $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081210' ); … … 384 463 * @return array Reordered array, if needed. 385 464 */ 386 465 function wp_prototype_before_jquery( $js_array ) { 387 if ( false === $jquery = array_search( 'jquery', $js_array ) )466 if ( false === $jquery = array_search( 'jquery', $js_array, true ) ) 388 467 return $js_array; 389 468 390 if ( false === $prototype = array_search( 'prototype', $js_array ) )469 if ( false === $prototype = array_search( 'prototype', $js_array, true ) ) 391 470 return $js_array; 392 471 393 472 if ( $prototype < $jquery )