Make WordPress Core

Ticket #33941: 33941.diff

File 33941.diff, 1.7 KB (added by wonderboymusic, 9 years ago)
  • src/wp-admin/includes/class-wp-screen.php

     
    512512         */
    513513        public function get_help_tabs() {
    514514                $help_tabs = $this->_help_tabs;
    515                 uasort( $help_tabs, array( $this, '_sort_help_tabs' ) );
    516                 return $help_tabs;
    517         }
    518515
    519         /**
    520          * Compares the difference between the help tabs priorities.
    521          *
    522          * Used for help tabs sorting.
    523          *
    524          * @since 4.4.0
    525          *
    526          * @param int $tab_a The priority argument for the first tab.
    527          * @param int $tab_b The priority argument for the second tab.
    528          * @return int The difference between the priority arguments.
    529          */
    530         protected function _sort_help_tabs( $tab_a, $tab_b ) {
    531                 return $tab_a['priority'] - $tab_b['priority'];
     516                $priorities = array();
     517                foreach ( $help_tabs as $help_tab ) {
     518                        if ( isset( $priorities[ $help_tab['priority'] ] ) ) {
     519                                $priorities[ $help_tab['priority'] ][] = $help_tab;
     520                        } else {
     521                                $priorities[ $help_tab['priority'] ] = array( $help_tab );
     522                        }
     523                }
     524
     525                sort( $priorities );
     526
     527                $sorted = array();
     528                foreach ( $priorities as $list ) {
     529                        foreach ( $list as $tab ) {
     530                                $sorted[ $tab['id'] ] = $tab;
     531                        }
     532                }
     533
     534                return $sorted;
    532535        }
    533536
    534537        /**
  • tests/phpunit/tests/admin/includesScreen.php

     
    3838
    3939        function tearDown() {
    4040                unset( $GLOBALS['wp_taxonomies']['old-or-new'] );
    41                 set_current_screen( 'front' );
     41                unset( $GLOBALS['screen'] );
    4242                parent::tearDown();
    4343        }
    4444