Changeset 31106
- Timestamp:
- 01/08/2015 10:51:30 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/admin.php
r31105 r31106 96 96 global $pagenow, $hook_suffix, $plugin_page, $typenow, $taxnow; 97 97 98 $page_hook = ''; 99 $hook_suffix = ''; 100 $plugin_page = ''; 101 $typenow = ''; 102 $taxnow = ''; 98 $page_hook = null; 103 99 104 100 $editing = false; 105 101 106 if ( isset( $_GET['page']) ) {102 if ( isset($_GET['page']) ) { 107 103 $plugin_page = wp_unslash( $_GET['page'] ); 108 $plugin_page = plugin_basename( $plugin_page);109 } 110 111 if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) {104 $plugin_page = plugin_basename($plugin_page); 105 } 106 107 if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) 112 108 $typenow = $_REQUEST['post_type']; 113 } 114 115 if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) { 109 else 110 $typenow = ''; 111 112 if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) 116 113 $taxnow = $_REQUEST['taxonomy']; 117 } 114 else 115 $taxnow = ''; 118 116 119 117 if ( WP_NETWORK_ADMIN ) … … 154 152 do_action( 'admin_init' ); 155 153 156 if ( $plugin_page) {157 if ( $typenow ) {154 if ( isset($plugin_page) ) { 155 if ( !empty($typenow) ) 158 156 $the_parent = $pagenow . '?post_type=' . $typenow; 159 } else {157 else 160 158 $the_parent = $pagenow; 161 }162 159 if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) { 163 160 $page_hook = get_plugin_page_hook($plugin_page, $plugin_page); … … 177 174 } 178 175 179 if ( $page_hook ) { 176 $hook_suffix = ''; 177 if ( isset( $page_hook ) ) { 180 178 $hook_suffix = $page_hook; 181 } elseif ( $plugin_page) {179 } elseif ( isset( $plugin_page ) ) { 182 180 $hook_suffix = $plugin_page; 183 } elseif ( $pagenow) {181 } elseif ( isset( $pagenow ) ) { 184 182 $hook_suffix = $pagenow; 185 183 } … … 188 186 189 187 // Handle plugin admin pages. 190 if ( $plugin_page) {188 if ( isset($plugin_page) ) { 191 189 if ( $page_hook ) { 192 190 /** -
trunk/src/wp-admin/includes/plugin.php
r31105 r31106 1509 1509 } 1510 1510 1511 if ( $pagenow == 'admin.php' && $plugin_page) {1511 if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) { 1512 1512 foreach ( (array)$menu as $parent_menu ) { 1513 1513 if ( $parent_menu[2] == $plugin_page ) { … … 1526 1526 } 1527 1527 1528 if ( $plugin_page&& isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) {1528 if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) { 1529 1529 $parent_file = $pagenow; 1530 1530 if ( isset( $_wp_real_parent_file[$parent_file] ) ) … … 1537 1537 if ( isset( $_wp_real_parent_file[$parent] ) ) 1538 1538 $parent = $_wp_real_parent_file[$parent]; 1539 if ( $typenow&& ($submenu_array[2] == "$pagenow?post_type=$typenow") ) {1539 if ( !empty($typenow) && ($submenu_array[2] == "$pagenow?post_type=$typenow") ) { 1540 1540 $parent_file = $parent; 1541 1541 return $parent; 1542 } elseif ( $submenu_array[2] == $pagenow && ! $typenow&& ( empty($parent_file) || false === strpos($parent_file, '?') ) ) {1542 } elseif ( $submenu_array[2] == $pagenow && empty($typenow) && ( empty($parent_file) || false === strpos($parent_file, '?') ) ) { 1543 1543 $parent_file = $parent; 1544 1544 return $parent; 1545 } elseif ( $plugin_page&& ($plugin_page == $submenu_array[2] ) ) {1545 } elseif ( isset( $plugin_page ) && ($plugin_page == $submenu_array[2] ) ) { 1546 1546 $parent_file = $parent; 1547 1547 return $parent; … … 1576 1576 $title = $menu_array[3]; 1577 1577 return $menu_array[3]; 1578 } elseif ( $plugin_page&& ($plugin_page == $menu_array[2] ) && ($hook == $menu_array[3] ) ) {1578 } elseif ( isset( $plugin_page ) && ($plugin_page == $menu_array[2] ) && ($hook == $menu_array[3] ) ) { 1579 1579 $title = $menu_array[3]; 1580 1580 return $menu_array[3]; … … 1588 1588 foreach ( array_keys( $submenu ) as $parent ) { 1589 1589 foreach ( $submenu[$parent] as $submenu_array ) { 1590 if ( $plugin_page&&1590 if ( isset( $plugin_page ) && 1591 1591 ( $plugin_page == $submenu_array[2] ) && 1592 1592 ( … … 1595 1595 ( $plugin_page == $hook ) || 1596 1596 ( $pagenow == 'admin.php' && $parent1 != $submenu_array[2] ) || 1597 ( $typenow&& $parent == $pagenow . '?post_type=' . $typenow)1597 ( !empty($typenow) && $parent == $pagenow . '?post_type=' . $typenow) 1598 1598 ) 1599 1599 ) { … … 1616 1616 if ( empty ( $title ) ) { 1617 1617 foreach ( $menu as $menu_array ) { 1618 if ( $plugin_page&&1618 if ( isset( $plugin_page ) && 1619 1619 ( $plugin_page == $menu_array[2] ) && 1620 1620 ( $pagenow == 'admin.php' ) && … … 1671 1671 $parent = get_admin_page_parent(); 1672 1672 1673 if ( ! $plugin_page&& isset( $_wp_submenu_nopriv[$parent][$pagenow] ) )1673 if ( !isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$pagenow] ) ) 1674 1674 return false; 1675 1675 1676 if ( $plugin_page) {1676 if ( isset( $plugin_page ) ) { 1677 1677 if ( isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) ) 1678 1678 return false; … … 1689 1689 if ( isset( $_wp_submenu_nopriv[$pagenow][$pagenow] ) ) 1690 1690 return false; 1691 if ( $plugin_page&& isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) )1691 if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) 1692 1692 return false; 1693 if ( $plugin_page&& isset( $_wp_menu_nopriv[$plugin_page] ) )1693 if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[$plugin_page] ) ) 1694 1694 return false; 1695 1695 foreach (array_keys( $_wp_submenu_nopriv ) as $key ) { 1696 1696 if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) ) 1697 1697 return false; 1698 if ( $plugin_page&& isset( $_wp_submenu_nopriv[$key][$plugin_page] ) )1698 if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) ) 1699 1699 return false; 1700 1700 } … … 1702 1702 } 1703 1703 1704 if ( $plugin_page&& ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[$plugin_page] ) )1704 if ( isset( $plugin_page ) && ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[$plugin_page] ) ) 1705 1705 return false; 1706 1706 1707 1707 if ( isset( $submenu[$parent] ) ) { 1708 1708 foreach ( $submenu[$parent] as $submenu_array ) { 1709 if ( $plugin_page&& ( $submenu_array[2] == $plugin_page ) ) {1709 if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) { 1710 1710 if ( current_user_can( $submenu_array[1] )) 1711 1711 return true; -
trunk/src/wp-admin/menu-header.php
r31105 r31106 67 67 } 68 68 69 if ( ( $parent_file && $item[2] == $parent_file ) || ( ! $typenow&& $self == $item[2] ) ) {69 if ( ( $parent_file && $item[2] == $parent_file ) || ( empty($typenow) && $self == $item[2] ) ) { 70 70 $class[] = ! empty( $submenu_items ) ? 'wp-has-current-submenu wp-menu-open' : 'current'; 71 71 } else { … … 168 168 169 169 // Handle current for post_type=post|page|foo pages, which won't match $self. 170 $self_type = $typenow? $self . '?post_type=' . $typenow : 'nothing';170 $self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing'; 171 171 172 172 if ( isset( $submenu_file ) ) { … … 176 176 // This allows plugin pages with the same hook to exist under different parents. 177 177 } elseif ( 178 ( ! $plugin_page&& $self == $sub_item[2] ) ||179 ( $plugin_page&& $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false ) )178 ( ! isset( $plugin_page ) && $self == $sub_item[2] ) || 179 ( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false ) ) 180 180 ) { 181 181 $class[] = 'current'; -
trunk/src/wp-includes/deprecated.php
r31105 r31106 2577 2577 global $plugin_page; 2578 2578 2579 if ( $plugin_page)2579 if ( isset($plugin_page) ) 2580 2580 return true; 2581 2581
Note: See TracChangeset
for help on using the changeset viewer.