]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-screen.php
WordPress 4.7.1
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-screen.php
index 398bb07386c56f6b46ee028c3c58259394b59ebb..967875917c688dad2abb8a915d37cb7cbadf554a 100644 (file)
@@ -304,6 +304,7 @@ final class WP_Screen {
                                        }
                                        break;
                                case 'edit-tags' :
+                               case 'term' :
                                        if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) )
                                                $post_type = 'post';
                                        break;
@@ -322,6 +323,7 @@ final class WP_Screen {
                                $id .= '-' . $post_type;
                                break;
                        case 'edit-tags' :
+                       case 'term' :
                                if ( null === $taxonomy )
                                        $taxonomy = 'post_tag';
                                // The edit-tags ID does not contain the post type. Look for it in the request.
@@ -416,9 +418,7 @@ final class WP_Screen {
        }
 
        /**
-        * Sets the old string-based contextual help for the screen.
-        *
-        * For backwards compatibility.
+        * Sets the old string-based contextual help for the screen for backward compatibility.
         *
         * @since 3.3.0
         *
@@ -530,7 +530,7 @@ final class WP_Screen {
                        }
                }
 
-               sort( $priorities );
+               ksort( $priorities );
 
                $sorted = array();
                foreach ( $priorities as $list ) {
@@ -693,7 +693,7 @@ final class WP_Screen {
         *                                      Default 'Filter items list'.
         *     @type string $heading_pagination Screen reader text for the pagination heading.
         *                                      Default 'Items list navigation'.
-        *     @type string heading_list        Screen reader text for the items list heading.
+        *     @type string $heading_list       Screen reader text for the items list heading.
         *                                      Default 'Items list'.
         * }
         */
@@ -720,7 +720,7 @@ final class WP_Screen {
        /**
         * Render the screen's help section.
         *
-        * This will trigger the deprecated filters for backwards compatibility.
+        * This will trigger the deprecated filters for backward compatibility.
         *
         * @since 3.3.0
         *
@@ -729,7 +729,7 @@ final class WP_Screen {
        public function render_screen_meta() {
 
                /**
-                * Filter the legacy contextual help list.
+                * Filters the legacy contextual help list.
                 *
                 * @since 2.7.0
                 * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or
@@ -743,7 +743,7 @@ final class WP_Screen {
                $old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : '';
 
                /**
-                * Filter the legacy contextual help text.
+                * Filters the legacy contextual help text.
                 *
                 * @since 2.7.0
                 * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or
@@ -760,7 +760,7 @@ final class WP_Screen {
                if ( empty( $old_help ) && ! $this->get_help_tabs() ) {
 
                        /**
-                        * Filter the default legacy contextual help text.
+                        * Filters the default legacy contextual help text.
                         *
                         * @since 2.8.0
                         * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or
@@ -849,10 +849,10 @@ final class WP_Screen {
                // Setup layout columns
 
                /**
-                * Filter the array of screen layout columns.
+                * Filters the array of screen layout columns.
                 *
                 * This hook provides back-compat for plugins using the back-compat
-                * filter instead of add_screen_option().
+                * Filters instead of add_screen_option().
                 *
                 * @since 2.8.0
                 *
@@ -915,7 +915,8 @@ final class WP_Screen {
 
                switch ( $this->base ) {
                        case 'widgets':
-                               $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
+                               $nonce = wp_create_nonce( 'widgets-access' );
+                               $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on&_wpnonce=' . urlencode( $nonce ) . '">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off&_wpnonce=' . urlencode( $nonce ) . '">' . __('Disable accessibility mode') . "</a></p>\n";
                                break;
                        case 'post' :
                                $expand = '<fieldset class="editor-expand hidden"><legend>' . __( 'Additional settings' ) . '</legend><label for="editor-expand-toggle">';
@@ -929,7 +930,7 @@ final class WP_Screen {
                }
 
                /**
-                * Filter the screen settings text displayed in the Screen Options tab.
+                * Filters the screen settings text displayed in the Screen Options tab.
                 *
                 * This filter is currently only used on the Widgets screen to enable
                 * accessibility mode.
@@ -945,7 +946,7 @@ final class WP_Screen {
                        $show_screen = true;
 
                /**
-                * Filter whether to show the Screen Options tab.
+                * Filters whether to show the Screen Options tab.
                 *
                 * @since 3.2.0
                 *
@@ -995,10 +996,10 @@ final class WP_Screen {
                echo $this->_screen_settings;
 
                /**
-                * Filter whether to show the Screen Options submit button.
+                * Filters whether to show the Screen Options submit button.
                 *
                 * @since 4.4.0
-                * 
+                *
                 * @param bool      $show_button Whether to show Screen Options submit button.
                 *                               Default false.
                 * @param WP_Screen $this        Current WP_Screen instance.
@@ -1087,7 +1088,7 @@ final class WP_Screen {
 
                        $id = "$column-hide";
                        echo '<label>';
-                       echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" value="' . $column . '"' . checked( ! in_array( $column, $hidden ), true, false ) . ' />';
+                       echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( ! in_array( $column, $hidden ), true, false ) . ' />';
                        echo "$title</label>\n";
                }
                ?>
@@ -1201,15 +1202,16 @@ final class WP_Screen {
                        return;
                }
 
+               $view_mode_post_types = get_post_types( array( 'hierarchical' => false, 'show_ui' => true ) );
+
                /**
-                * Filter the post types that have different view mode options.
+                * Filters the post types that have different view mode options.
                 *
                 * @since 4.4.0
                 *
                 * @param array $view_mode_post_types Array of post types that can change view modes.
                 *                                    Default hierarchical post types with show_ui on.
                 */
-               $view_mode_post_types = get_post_types( array( 'hierarchical' => false, 'show_ui' => true ) );
                $view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types );
 
                if ( ! in_array( $this->post_type, $view_mode_post_types ) ) {