diff --git wp-admin/admin.php wp-admin/admin.php
index bf64a1a..b851b46 100644
|
|
|
if ( isset($_GET['page']) ) { |
| 88 | 88 | $plugin_page = plugin_basename($plugin_page); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | | if ( isset($_GET['post_type']) ) |
| 92 | | $typenow = sanitize_key($_GET['post_type']); |
| 93 | | else |
| 94 | | $typenow = ''; |
| 95 | | |
| 96 | | if ( isset($_GET['taxonomy']) ) |
| 97 | | $taxnow = sanitize_key($_GET['taxonomy']); |
| 98 | | else |
| 99 | | $taxnow = ''; |
| 100 | | |
| 101 | 91 | if ( WP_NETWORK_ADMIN ) |
| 102 | 92 | require(ABSPATH . 'wp-admin/network/menu.php'); |
| 103 | 93 | elseif ( WP_USER_ADMIN ) |
diff --git wp-admin/includes/screen.php wp-admin/includes/screen.php
index e9e3dc4..e2a59b7 100644
|
|
|
function get_current_screen() { |
| 333 | 333 | * @param string $id Screen id, optional. |
| 334 | 334 | */ |
| 335 | 335 | function set_current_screen( $id = '' ) { |
| 336 | | global $current_screen; |
| 337 | | |
| 338 | | $current_screen = new WP_Screen( $id ); |
| 339 | | |
| 340 | | $current_screen = apply_filters('current_screen', $current_screen); |
| | 336 | WP_Screen::set_current_screen($id); |
| 341 | 337 | } |
| 342 | 338 | |
| 343 | 339 | /** |
| … |
… |
final class WP_Screen { |
| 422 | 418 | * @var string |
| 423 | 419 | * @access public |
| 424 | 420 | */ |
| 425 | | public $post_type; |
| | 421 | public $post_type = ''; |
| 426 | 422 | |
| 427 | 423 | /** |
| 428 | 424 | * The taxonomy associated with the screen, if any. |
| … |
… |
final class WP_Screen { |
| 431 | 427 | * @var string |
| 432 | 428 | * @access public |
| 433 | 429 | */ |
| 434 | | public $taxonomy; |
| | 430 | public $taxonomy = ''; |
| 435 | 431 | |
| 436 | 432 | /** |
| 437 | 433 | * The help tab data associated with the screen, if any. |
| … |
… |
final class WP_Screen { |
| 441 | 437 | * @access private |
| 442 | 438 | */ |
| 443 | 439 | private static $_help_tabs = array(); |
| 444 | | |
| | 440 | |
| 445 | 441 | /** |
| 446 | 442 | * The help sidebar data associated with screens, if any. |
| 447 | 443 | * |
| … |
… |
final class WP_Screen { |
| 483 | 479 | */ |
| 484 | 480 | private $_screen_settings; |
| 485 | 481 | |
| | 482 | public static function set_current_screen( $screen = '' ) { |
| | 483 | global $current_screen, $typenow, $taxnow; |
| | 484 | |
| | 485 | if ( is_string( $screen ) ) |
| | 486 | $screen = new WP_Screen( $screen ); |
| | 487 | |
| | 488 | $current_screen = $screen; |
| | 489 | $current_screen = apply_filters('current_screen', $current_screen); |
| | 490 | |
| | 491 | $typenow = $current_screen->post_type; |
| | 492 | $taxnow = $current_screen->taxonomy; |
| | 493 | } |
| | 494 | |
| 486 | 495 | /** |
| 487 | 496 | * Constructor |
| 488 | 497 | * |
| … |
… |
final class WP_Screen { |
| 491 | 500 | * @param string $id A screen id. If empty, the $hook_suffix global is used to derive the ID. |
| 492 | 501 | */ |
| 493 | 502 | public function __construct( $id = '' ) { |
| 494 | | global $hook_suffix, $typenow, $taxnow; |
| 495 | | |
| | 503 | global $hook_suffix; |
| 496 | 504 | $action = ''; |
| 497 | 505 | |
| 498 | 506 | if ( empty( $id ) ) { |
| … |
… |
final class WP_Screen { |
| 503 | 511 | $screen = str_replace('-new', '', $screen); |
| 504 | 512 | $screen = str_replace('-add', '', $screen); |
| 505 | 513 | $this->id = $this->base = $screen; |
| | 514 | |
| | 515 | if ( isset( $_GET['post_type'] ) ) |
| | 516 | $this->post_type = sanitize_key( $_GET['post_type'] ); |
| | 517 | |
| | 518 | if ( isset( $_GET['taxonomy'] ) ) |
| | 519 | $this->taxonomy = sanitize_key( $_GET['taxonomy'] ); |
| 506 | 520 | } else { |
| 507 | | $id = sanitize_key( $id ); |
| 508 | | if ( false !== strpos($id, '-') ) { |
| 509 | | list( $id, $typenow ) = explode('-', $id, 2); |
| 510 | | if ( taxonomy_exists( $typenow ) ) { |
| 511 | | $id = 'edit-tags'; |
| 512 | | $taxnow = $typenow; |
| 513 | | $typenow = ''; |
| 514 | | } |
| 515 | | } |
| 516 | | $this->id = $this->base = $id; |
| | 521 | $this->id = $this->base = sanitize_key( $id ); |
| 517 | 522 | } |
| 518 | 523 | |
| 519 | 524 | $this->action = $action; |
| … |
… |
final class WP_Screen { |
| 524 | 529 | if ( 'index' == $this->id ) |
| 525 | 530 | $this->id = 'dashboard'; |
| 526 | 531 | |
| 527 | | if ( 'edit' == $this->id ) { |
| 528 | | if ( empty($typenow) ) |
| 529 | | $typenow = 'post'; |
| 530 | | $this->id .= '-' . $typenow; |
| 531 | | $this->post_type = $typenow; |
| 532 | | } elseif ( 'post' == $this->id ) { |
| 533 | | if ( empty($typenow) ) |
| 534 | | $typenow = 'post'; |
| 535 | | $this->id = $typenow; |
| 536 | | $this->post_type = $typenow; |
| 537 | | } elseif ( 'edit-tags' == $this->id ) { |
| 538 | | if ( empty($taxnow) ) |
| 539 | | $taxnow = 'post_tag'; |
| 540 | | $this->id = 'edit-' . $taxnow; |
| 541 | | $this->taxonomy = $taxnow; |
| | 532 | // edit-tags.php should map to the correct taxonomy |
| | 533 | if ( 'edit-tags' == $this->id ) { |
| | 534 | if ( empty( $this->taxonomy ) ) |
| | 535 | $this->taxonomy = 'post_tag'; |
| | 536 | $this->id = 'edit-' . $this->taxonomy; |
| | 537 | } else if ( 0 === strpos( 'edit-', $this->id ) && empty( $this->post_type ) ) { |
| | 538 | // infer the $post_type from the ID if necessary |
| | 539 | $this->post_type = substr( $this->id, 5 ); |
| | 540 | } |
| | 541 | |
| | 542 | if ( 'edit' === $this->id ) { |
| | 543 | if ( empty( $this->post_type ) ) |
| | 544 | $this->post_type = 'post'; |
| | 545 | $this->id = 'edit-' . $this->post_type; |
| 542 | 546 | } |
| 543 | 547 | |
| 544 | 548 | $this->is_network = is_network_admin(); |
| … |
… |
final class WP_Screen { |
| 561 | 565 | } |
| 562 | 566 | |
| 563 | 567 | function add_old_compat_help( $help ) { |
| 564 | | self::$_old_compat_help[ $this->id ] = $help; |
| | 568 | self::$_old_compat_help[ $this->id ] = $help; |
| 565 | 569 | } |
| 566 | 570 | |
| 567 | 571 | /** |
| … |
… |
final class WP_Screen { |
| 596 | 600 | * |
| 597 | 601 | * @since 3.3.0 |
| 598 | 602 | * |
| 599 | | * @param string |
| | 603 | * @param string |
| 600 | 604 | */ |
| 601 | 605 | public function get_option( $option, $key = false ) { |
| 602 | 606 | if ( ! isset( self::$_options[ $this->id ][ $option ] ) ) |