Changeset 10476
- Timestamp:
- 02/01/2009 09:45:24 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r10475 r10476 46 46 47 47 $s = $_GET['q']; // is this slashed already? 48 48 49 49 if ( isset($_GET['tax']) ) 50 50 $taxonomy = sanitize_title($_GET['tax']); … … 68 68 if ( !current_user_can( 'manage_options' ) ) 69 69 die('-1'); 70 71 if ( isset($_GET['tested']) ) { 72 if ( 1 == $_GET['tested'] ) 70 71 if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) { 72 update_option('can_compress_scripts', 0); 73 die('0'); 74 } 75 76 if ( isset($_GET['test']) ) { 77 header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); 78 header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); 79 header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); 80 header( 'Pragma: no-cache' ); 81 header('Content-Type: application/x-javascript; charset=UTF-8'); 82 $force_gzip = ( defined('ENFORCE_GZIP') && ENFORCE_GZIP ); 83 $test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."'; 84 85 if ( 1 == $_GET['test'] ) { 86 echo $test_str; 87 die; 88 } elseif ( 2 == $_GET['test'] ) { 89 if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) { 90 header('Content-Encoding: deflate'); 91 $out = gzdeflate( $test_str, 1 ); 92 } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) { 93 header('Content-Encoding: gzip'); 94 $out = gzencode( $test_str, 1 ); 95 } else { 96 die('-1'); 97 } 98 echo $out; 99 die; 100 } elseif ( 'no' == $_GET['test'] ) { 101 update_option('can_compress_scripts', 0); 102 } elseif ( 'yes' == $_GET['test'] ) { 73 103 update_option('can_compress_scripts', 1); 74 elseif ( 0 == $_GET['tested'] )75 update_option('can_compress_scripts', 0);76 } 104 } 105 } 106 77 107 die('0'); 78 108 break; … … 515 545 else 516 546 die('0'); 517 547 518 548 $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) ); 519 549 -
trunk/wp-admin/includes/schema.php
r10200 r10476 304 304 305 305 // Delete unused options 306 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins' );306 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts'); 307 307 foreach ($unusedoptions as $option) : 308 308 delete_option($option); -
trunk/wp-admin/includes/template.php
r10451 r10476 1817 1817 $numposts = get_usernumposts( $user_object->ID ); 1818 1818 $checkbox = ''; 1819 // Check if the user for this row is editable 1819 // Check if the user for this row is editable 1820 1820 if ( current_user_can( 'edit_user', $user_object->ID ) ) { 1821 // Set up the user editing link 1821 // Set up the user editing link 1822 1822 // TODO: make profile/user-edit determination a seperate function 1823 1823 if ($current_user->ID == $user_object->ID) { … … 1827 1827 } 1828 1828 $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />"; 1829 1829 1830 1830 // Set up the hover actions for this user 1831 1831 $actions = array(); … … 1842 1842 } 1843 1843 $edit .= '</div>'; 1844 1844 1845 1845 // Set up the checkbox (because the user is editable, otherwise its empty) 1846 1846 $checkbox = "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' />"; 1847 1847 1848 1848 } else { 1849 1849 $edit = '<strong>' . $user_object->user_login . '</strong>'; … … 1923 1923 $count = wp_count_comments(); 1924 1924 $index = ''; 1925 1925 1926 1926 if ( 'moderated' == $status ) { 1927 1927 $approved = "comment_approved = '0'"; … … 2616 2616 } 2617 2617 2618 2618 2619 2619 /** 2620 2620 * Print out <option> html elements for role selectors based on $wp_roles … … 2631 2631 $p = ''; 2632 2632 $r = ''; 2633 2633 2634 2634 $editable_roles = get_editable_roles(); 2635 2635 2636 2636 foreach( $editable_roles as $role => $details ) { 2637 2637 $name = translate_with_context($details['name']); … … 3403 3403 * and sets an option with the result. Has no effect when the current user 3404 3404 * is not an administrator. To run the test again the option 'can_compress_scripts' 3405 * has to be deleted. 3405 * has to be deleted. 3406 3406 * 3407 3407 * @since 2.8.0 … … 3409 3409 function compression_test() { 3410 3410 ?> 3411 <script type="text/javascript" src="load-scripts.php?test=1<?php echo ( defined('ENFORCE_GZIP') && ENFORCE_GZIP ) ? '&c=gzip' : ''; ?>"></script>3412 3411 <script type="text/javascript"> 3413 3412 /* <![CDATA[ */ 3414 (function() { 3415 var x, test = typeof wpCompressionTest == 'undefined' ? 0 : 1; 3416 if ( window.XMLHttpRequest ) { 3417 x = new XMLHttpRequest(); 3418 } else { 3419 try{x=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{x=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){};} 3413 var testCompression = { 3414 get : function(test) { 3415 var x; 3416 if ( window.XMLHttpRequest ) { 3417 x = new XMLHttpRequest(); 3418 } else { 3419 try{x=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{x=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){};} 3420 } 3421 3422 if (x) { 3423 x.onreadystatechange = function() { 3424 var r, h; 3425 if ( x.readyState == 4 ) { 3426 r = x.responseText.substr(0, 18); 3427 h = x.getResponseHeader('Content-Encoding'); 3428 testCompression.check(r, h, test); 3429 } 3430 } 3431 3432 x.open('GET', 'admin-ajax.php?action=wp-compression-test&test='+test+'&'+(new Date()).getTime(), true); 3433 x.send(''); 3434 } 3435 }, 3436 3437 check : function(r, h, test) { 3438 if ( ! r && ! test ) 3439 this.get(1); 3440 3441 if ( 1 == test ) { 3442 if ( h && ( h.match(/deflate/i) || h.match(/gzip/i) ) ) 3443 this.get('no'); 3444 else 3445 this.get(2); 3446 3447 return; 3448 } 3449 3450 if ( 2 == test ) { 3451 if ( '"wpCompressionTest' == r ) 3452 this.get('yes'); 3453 else 3454 this.get('no'); 3455 } 3420 3456 } 3421 3422 if (x) { 3423 x.open('GET', 'admin-ajax.php?action=wp-compression-test&tested='+test+'&'+(new Date()).getTime(), true); 3424 x.send(''); 3425 } 3426 })(); 3457 }; 3458 testCompression.check(); 3427 3459 /* ]]> */ 3428 3460 </script> -
trunk/wp-admin/load-scripts.php
r10466 r10476 86 86 } 87 87 88 // Discard any buffers 89 while ( @ob_end_clean() ); 90 91 if ( isset($_GET['test']) && 1 == $_GET['test'] ) { 92 if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) 93 exit(''); 94 95 $out = 'var wpCompressionTest = 1;'; 96 $force_gzip = ( isset($_GET['c']) && 'gzip' == $_GET['c'] ); 97 98 if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) { 99 header('Content-Encoding: deflate'); 100 $out = gzdeflate( $out, 3 ); 101 } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) { 102 header('Content-Encoding: gzip'); 103 $out = gzencode( $out, 3 ); 104 } else { 105 exit(''); 106 } 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 echo $out; 114 exit; 115 } 116 117 $load = preg_replace( '/[^a-z0-9,_-]*/i', '', $_GET['load'] ); 88 $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] ); 118 89 $load = explode(',', $load); 119 90 … … 143 114 header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT'); 144 115 header("Cache-Control: public, max-age=$expires_offset"); 145 116 146 117 if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') ) { 147 118 header('Vary: Accept-Encoding'); // Handle proxies -
trunk/wp-admin/load-styles.php
r10466 r10476 89 89 require(ABSPATH . '/wp-includes/version.php'); 90 90 91 // Discard any buffers 92 while ( @ob_end_clean() ); 93 94 $load = preg_replace( '/[^a-z0-9,_-]*/i', '', $_GET['load'] ); 91 $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] ); 95 92 $load = explode(',', $load); 96 93 … … 127 124 header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT'); 128 125 header("Cache-Control: public, max-age=$expires_offset"); 129 126 130 127 if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') ) { 131 128 header('Vary: Accept-Encoding'); // Handle proxies -
trunk/wp-includes/js/tinymce/wp-tinymce.php
r10372 r10476 2 2 3 3 $basepath = dirname(__FILE__); 4 5 while ( @ob_end_clean() );6 4 7 5 function get_file($path) { … … 23 21 header("Cache-Control: public, max-age=$expires_offset"); 24 22 25 if ( isset($_GET['c']) && 1 == $_GET['c'] && ! ini_get('zlib.output_compression') &&false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') ) {23 if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') ) { 26 24 header('Content-Encoding: gzip'); 27 25 echo get_file($basepath . '/wp-tinymce.js.gz'); -
trunk/wp-includes/script-loader.php
r10457 r10476 617 617 618 618 global $wp_scripts; 619 619 620 620 if ( !is_a($wp_scripts, 'WP_Scripts') ) 621 621 return array(); // no need to run if nothing is queued 622 622 623 623 return print_head_scripts(); 624 624 } … … 635 635 /** 636 636 * Wrapper for do_action('wp_enqueue_scripts') 637 * 637 * 638 638 * Allows plugins to queue scripts for the front end using wp_enqueue_script(). 639 639 * Runs first in wp_head() where all is_home(), is_page(), etc. functions are available. … … 679 679 global $concatenate_scripts, $compress_scripts, $compress_css; 680 680 681 $compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ); 682 681 683 if ( ! isset($concatenate_scripts) ) { 682 684 $concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true; … … 687 689 if ( ! isset($compress_scripts) ) { 688 690 $compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true; 689 if ( $compress_scripts && ! get_option('can_compress_scripts') )691 if ( $compress_scripts && ( ! get_option('can_compress_scripts') || $compressed_output ) ) 690 692 $compress_scripts = false; 691 693 } … … 693 695 if ( ! isset($compress_css) ) { 694 696 $compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true; 695 if ( $compress_css && ! get_option('can_compress_scripts') )697 if ( $compress_css && ( ! get_option('can_compress_scripts') || $compressed_output ) ) 696 698 $compress_css = false; 697 699 } -
trunk/wp-includes/version.php
r10219 r10476 16 16 * @global int $wp_db_version 17 17 */ 18 $wp_db_version = 987 2;18 $wp_db_version = 9873; 19 19 20 20 ?>
Note: See TracChangeset
for help on using the changeset viewer.