Changeset 31105
- Timestamp:
- 01/08/2015 10:14:58 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/admin.php
r31090 r31105 91 91 wp_enqueue_script( 'common' ); 92 92 93 // $pagenow is set in vars.php 94 // The remaining variables are imported as globals elsewhere, 95 // declared as globals here 96 global $pagenow, $hook_suffix, $plugin_page, $typenow, $taxnow; 97 98 $page_hook = ''; 99 $hook_suffix = ''; 100 $plugin_page = ''; 101 $typenow = ''; 102 $taxnow = ''; 103 93 104 $editing = false; 94 105 95 if ( isset( $_GET['page']) ) {106 if ( isset( $_GET['page'] ) ) { 96 107 $plugin_page = wp_unslash( $_GET['page'] ); 97 $plugin_page = plugin_basename( $plugin_page);98 } 99 100 if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) 108 $plugin_page = plugin_basename( $plugin_page ); 109 } 110 111 if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) { 101 112 $typenow = $_REQUEST['post_type']; 102 else 103 $typenow = ''; 104 105 if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) 113 } 114 115 if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) { 106 116 $taxnow = $_REQUEST['taxonomy']; 107 else 108 $taxnow = ''; 117 } 109 118 110 119 if ( WP_NETWORK_ADMIN ) … … 145 154 do_action( 'admin_init' ); 146 155 147 if ( isset($plugin_page)) {148 if ( !empty($typenow) )156 if ( $plugin_page ) { 157 if ( $typenow ) { 149 158 $the_parent = $pagenow . '?post_type=' . $typenow; 150 else159 } else { 151 160 $the_parent = $pagenow; 161 } 152 162 if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) { 153 163 $page_hook = get_plugin_page_hook($plugin_page, $plugin_page); … … 167 177 } 168 178 169 $hook_suffix = ''; 170 if ( isset( $page_hook ) ) { 179 if ( $page_hook ) { 171 180 $hook_suffix = $page_hook; 172 } elseif ( isset( $plugin_page )) {181 } elseif ( $plugin_page ) { 173 182 $hook_suffix = $plugin_page; 174 } elseif ( isset( $pagenow )) {183 } elseif ( $pagenow ) { 175 184 $hook_suffix = $pagenow; 176 185 } … … 179 188 180 189 // Handle plugin admin pages. 181 if ( isset($plugin_page)) {190 if ( $plugin_page ) { 182 191 if ( $page_hook ) { 183 192 /** -
trunk/src/wp-admin/includes/plugin.php
r31091 r31105 1509 1509 } 1510 1510 1511 if ( $pagenow == 'admin.php' && isset( $plugin_page )) {1511 if ( $pagenow == 'admin.php' && $plugin_page ) { 1512 1512 foreach ( (array)$menu as $parent_menu ) { 1513 1513 if ( $parent_menu[2] == $plugin_page ) { … … 1526 1526 } 1527 1527 1528 if ( isset( $plugin_page )&& isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) {1528 if ( $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 ( !empty($typenow)&& ($submenu_array[2] == "$pagenow?post_type=$typenow") ) {1539 if ( $typenow && ($submenu_array[2] == "$pagenow?post_type=$typenow") ) { 1540 1540 $parent_file = $parent; 1541 1541 return $parent; 1542 } elseif ( $submenu_array[2] == $pagenow && empty($typenow)&& ( empty($parent_file) || false === strpos($parent_file, '?') ) ) {1542 } elseif ( $submenu_array[2] == $pagenow && ! $typenow && ( empty($parent_file) || false === strpos($parent_file, '?') ) ) { 1543 1543 $parent_file = $parent; 1544 1544 return $parent; 1545 } elseif ( isset( $plugin_page )&& ($plugin_page == $submenu_array[2] ) ) {1545 } elseif ( $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 ( isset( $plugin_page )&& ($plugin_page == $menu_array[2] ) && ($hook == $menu_array[3] ) ) {1578 } elseif ( $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 ( isset( $plugin_page )&&1590 if ( $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 ( !empty($typenow)&& $parent == $pagenow . '?post_type=' . $typenow)1597 ( $typenow && $parent == $pagenow . '?post_type=' . $typenow) 1598 1598 ) 1599 1599 ) { … … 1616 1616 if ( empty ( $title ) ) { 1617 1617 foreach ( $menu as $menu_array ) { 1618 if ( isset( $plugin_page )&&1618 if ( $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 ( ! isset( $plugin_page )&& isset( $_wp_submenu_nopriv[$parent][$pagenow] ) )1673 if ( ! $plugin_page && isset( $_wp_submenu_nopriv[$parent][$pagenow] ) ) 1674 1674 return false; 1675 1675 1676 if ( isset( $plugin_page )) {1676 if ( $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 ( isset( $plugin_page )&& isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) )1691 if ( $plugin_page && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) 1692 1692 return false; 1693 if ( isset( $plugin_page )&& isset( $_wp_menu_nopriv[$plugin_page] ) )1693 if ( $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 ( isset( $plugin_page )&& isset( $_wp_submenu_nopriv[$key][$plugin_page] ) )1698 if ( $plugin_page && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) ) 1699 1699 return false; 1700 1700 } … … 1702 1702 } 1703 1703 1704 if ( isset( $plugin_page )&& ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[$plugin_page] ) )1704 if ( $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 ( isset( $plugin_page )&& ( $submenu_array[2] == $plugin_page ) ) {1709 if ( $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
r31090 r31105 67 67 } 68 68 69 if ( ( $parent_file && $item[2] == $parent_file ) || ( empty($typenow)&& $self == $item[2] ) ) {69 if ( ( $parent_file && $item[2] == $parent_file ) || ( ! $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 = ! empty( $typenow )? $self . '?post_type=' . $typenow : 'nothing';170 $self_type = $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 ( ! 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 ) )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 ) ) 180 180 ) { 181 181 $class[] = 'current'; -
trunk/src/wp-includes/deprecated.php
r31090 r31105 2577 2577 global $plugin_page; 2578 2578 2579 if ( isset($plugin_page))2579 if ( $plugin_page ) 2580 2580 return true; 2581 2581
Note: See TracChangeset
for help on using the changeset viewer.