diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index be276ed4e..3de51754b 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -45,7 +45,7 @@ case 'ajax-tag-search' : die('-1'); $s = $_GET['q']; // is this slashed already? - + if ( isset($_GET['tax']) ) $taxonomy = sanitize_title($_GET['tax']); else @@ -67,13 +67,43 @@ case 'ajax-tag-search' : case 'wp-compression-test' : if ( !current_user_can( 'manage_options' ) ) die('-1'); - - if ( isset($_GET['tested']) ) { - if ( 1 == $_GET['tested'] ) - update_option('can_compress_scripts', 1); - elseif ( 0 == $_GET['tested'] ) - update_option('can_compress_scripts', 0); + + if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) { + update_option('can_compress_scripts', 0); + die('0'); } + + if ( isset($_GET['test']) ) { + header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); + header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); + header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); + header( 'Pragma: no-cache' ); + header('Content-Type: application/x-javascript; charset=UTF-8'); + $force_gzip = ( defined('ENFORCE_GZIP') && ENFORCE_GZIP ); + $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."'; + + if ( 1 == $_GET['test'] ) { + echo $test_str; + die; + } elseif ( 2 == $_GET['test'] ) { + if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) { + header('Content-Encoding: deflate'); + $out = gzdeflate( $test_str, 1 ); + } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) { + header('Content-Encoding: gzip'); + $out = gzencode( $test_str, 1 ); + } else { + die('-1'); + } + echo $out; + die; + } elseif ( 'no' == $_GET['test'] ) { + update_option('can_compress_scripts', 0); + } elseif ( 'yes' == $_GET['test'] ) { + update_option('can_compress_scripts', 1); + } + } + die('0'); break; default : @@ -514,7 +544,7 @@ case 'get-tagcloud' : $taxonomy = sanitize_title($_POST['tax']); else die('0'); - + $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) ); if ( empty( $tags ) ) diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index 1f9c5be59..6f300baf5 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -303,7 +303,7 @@ function populate_options() { add_option('dismissed_update_core', array()); // Delete unused options - $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'); + $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'); foreach ($unusedoptions as $option) : delete_option($option); endforeach; diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 6e25cdafd..2869b5ca6 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1816,9 +1816,9 @@ function user_row( $user_object, $style = '', $role = '' ) { $short_url = substr( $short_url, 0, 32 ).'...'; $numposts = get_usernumposts( $user_object->ID ); $checkbox = ''; - // Check if the user for this row is editable + // Check if the user for this row is editable if ( current_user_can( 'edit_user', $user_object->ID ) ) { - // Set up the user editing link + // Set up the user editing link // TODO: make profile/user-edit determination a seperate function if ($current_user->ID == $user_object->ID) { $edit_link = 'profile.php'; @@ -1826,7 +1826,7 @@ function user_row( $user_object, $style = '', $role = '' ) { $edit_link = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) ); } $edit = "$user_object->user_login
"; - + // Set up the hover actions for this user $actions = array(); $actions['edit'] = '' . __('Edit') . ''; @@ -1841,10 +1841,10 @@ function user_row( $user_object, $style = '', $role = '' ) { $edit .= "$link$sep"; } $edit .= ''; - + // Set up the checkbox (because the user is editable, otherwise its empty) $checkbox = ""; - + } else { $edit = '' . $user_object->user_login . ''; } @@ -1922,7 +1922,7 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0 $post = (int) $post; $count = wp_count_comments(); $index = ''; - + if ( 'moderated' == $status ) { $approved = "comment_approved = '0'"; $total = $count->moderated; @@ -2615,7 +2615,7 @@ function the_attachment_links( $id = false ) { html elements for role selectors based on $wp_roles * @@ -2630,9 +2630,9 @@ function wp_dropdown_roles( $selected = false ) { global $wp_roles; $p = ''; $r = ''; - + $editable_roles = get_editable_roles(); - + foreach( $editable_roles as $role => $details ) { $name = translate_with_context($details['name']); if ( $selected == $role ) // Make default first in list @@ -3402,28 +3402,60 @@ function screen_icon($name = '') { * Outputs JavaScript that tests if compression from PHP works as expected * and sets an option with the result. Has no effect when the current user * is not an administrator. To run the test again the option 'can_compress_scripts' - * has to be deleted. + * has to be deleted. * * @since 2.8.0 */ function compression_test() { ?> -