Ticket #18785: 18785.3.diff
| File 18785.3.diff, 23.2 KB (added by , 14 years ago) |
|---|
-
wp-admin/includes/deprecated.php
805 805 $current_screen->render_screen_meta(); 806 806 } 807 807 808 /** 809 * Favorite actions were deprecated in version 3.2. Use the admin bar instead. 810 * 811 * @since 2.7.0 812 * @deprecated 3.2.0 813 */ 814 function favorite_actions() { 815 _deprecated_function( __FUNCTION__, '3.2', 'WP_Admin_Bar' ); 816 } 817 808 818 function media_upload_image() { 809 819 __deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' ); 810 820 return wp_media_upload_handler(); -
wp-admin/includes/screen.php
11 11 * 12 12 * @since 2.7.0 13 13 * 14 * @param string| object$screen The screen you want the headers for14 * @param string|WP_Screen $screen The screen you want the headers for 15 15 * @return array Containing the headers in the format id => UI String 16 16 */ 17 17 function get_column_headers( $screen ) { … … 31 31 * 32 32 * @since 2.7.0 33 33 * 34 * @param string| object$screen The screen you want the hidden columns for34 * @param string|WP_Screen $screen The screen you want the hidden columns for 35 35 * @return array 36 36 */ 37 37 function get_hidden_columns( $screen ) { … … 42 42 } 43 43 44 44 /** 45 * {@internal Missing Short Description}}45 * Prints the meta box preferences for screen meta. 46 46 * 47 47 * @since 2.7.0 48 48 * 49 * @param unknown_type$screen49 * @param string|WP_Screen $screen 50 50 */ 51 51 function meta_box_prefs( $screen ) { 52 52 global $wp_meta_boxes; 53 53 54 if ( is_string( $screen) )55 $screen = convert_to_screen( $screen);54 if ( is_string( $screen ) ) 55 $screen = convert_to_screen( $screen ); 56 56 57 57 if ( empty($wp_meta_boxes[$screen->id]) ) 58 58 return; … … 108 108 } 109 109 110 110 /** 111 * {@internal Missing Short Description}}112 *113 * @since 2.7.0114 */115 function favorite_actions( $screen = null ) {116 $default_action = false;117 118 if ( is_string($screen) )119 $screen = convert_to_screen($screen);120 121 if ( $screen->is_user )122 return;123 124 if ( isset($screen->post_type) ) {125 $post_type_object = get_post_type_object($screen->post_type);126 if ( 'add' != $screen->action )127 $default_action = array('post-new.php?post_type=' . $post_type_object->name => array($post_type_object->labels->new_item, $post_type_object->cap->edit_posts));128 else129 $default_action = array('edit.php?post_type=' . $post_type_object->name => array($post_type_object->labels->name, $post_type_object->cap->edit_posts));130 }131 132 if ( !$default_action ) {133 if ( $screen->is_network ) {134 $default_action = array('sites.php' => array( __('Sites'), 'manage_sites'));135 } else {136 switch ( $screen->id ) {137 case 'upload':138 $default_action = array('media-new.php' => array(__('New Media'), 'upload_files'));139 break;140 case 'media':141 $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files'));142 break;143 case 'link-manager':144 case 'link':145 if ( 'add' != $screen->action )146 $default_action = array('link-add.php' => array(__('New Link'), 'manage_links'));147 else148 $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links'));149 break;150 case 'users':151 $default_action = array('user-new.php' => array(__('New User'), 'create_users'));152 break;153 case 'user':154 $default_action = array('users.php' => array(__('Edit Users'), 'edit_users'));155 break;156 case 'plugins':157 $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins'));158 break;159 case 'plugin-install':160 $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins'));161 break;162 case 'themes':163 $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes'));164 break;165 case 'theme-install':166 $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes'));167 break;168 default:169 $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts'));170 break;171 }172 }173 }174 175 if ( !$screen->is_network ) {176 $actions = array(177 'post-new.php' => array(__('New Post'), 'edit_posts'),178 'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),179 'post-new.php?post_type=page' => array(__('New Page'), 'edit_pages'),180 'media-new.php' => array(__('Upload'), 'upload_files'),181 'edit-comments.php' => array(__('Comments'), 'moderate_comments')182 );183 } else {184 $actions = array(185 'sites.php' => array( __('Sites'), 'manage_sites'),186 'users.php' => array( __('Users'), 'manage_network_users')187 );188 }189 190 $default_key = array_keys($default_action);191 $default_key = $default_key[0];192 if ( isset($actions[$default_key]) )193 unset($actions[$default_key]);194 $actions = array_merge($default_action, $actions);195 $actions = apply_filters( 'favorite_actions', $actions, $screen );196 197 $allowed_actions = array();198 foreach ( $actions as $action => $data ) {199 if ( current_user_can($data[1]) )200 $allowed_actions[$action] = $data[0];201 }202 203 if ( empty($allowed_actions) )204 return;205 206 $first = array_keys($allowed_actions);207 $first = $first[0];208 echo '<div id="favorite-actions">';209 echo '<div id="favorite-first"><a href="' . $first . '">' . $allowed_actions[$first] . '</a></div><div id="favorite-toggle"><br /></div>';210 echo '<div id="favorite-inside">';211 212 array_shift($allowed_actions);213 214 foreach ( $allowed_actions as $action => $label) {215 echo "<div class='favorite-action'><a href='$action'>";216 echo $label;217 echo "</a></div>\n";218 }219 echo "</div></div>\n";220 }221 222 /**223 111 * Convert a screen string to a screen object 224 112 * 225 113 * @since 3.0.0 226 114 * 227 * @param string $ screen The name of the screen228 * @return object An object containing the safe screen name and id115 * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen. 116 * @return WP_Screen Screen object. 229 117 */ 230 function convert_to_screen( $screen ) { 231 $screen = str_replace( array('.php', '-new', '-add', '-network', '-user' ), '', $screen); 232 233 if ( is_network_admin() ) 234 $screen .= '-network'; 235 elseif ( is_user_admin() ) 236 $screen .= '-user'; 237 238 $screen = (string) apply_filters( 'screen_meta_screen', $screen ); 239 $screen = (object) array( 'id' => $screen, 'base' => $screen ); 240 return $screen; 118 function convert_to_screen( $hook_name ) { 119 return WP_Screen::get( $hook_name ); 241 120 } 242 121 243 122 /** … … 256 135 if ( is_string( $screen ) ) 257 136 $screen = convert_to_screen( $screen ); 258 137 259 WP_Screen::add_old_compat_help( $screen ->id, $help );138 WP_Screen::add_old_compat_help( $screen, $help ); 260 139 } 261 140 262 141 /** … … 277 156 return $current_screen->add_option( $option, $args ); 278 157 } 279 158 159 /** 160 * Displays a screen icon. 161 * 162 * @uses get_screen_icon() 163 * @since 2.7.0 164 * 165 * @param string|WP_Screen $screen Optional. Accepts a screen object (and defaults to the current screen object) 166 * which it uses to determine an icon HTML ID. Or, if a string is provided, it is used to form the icon HTML ID. 167 */ 280 168 function screen_icon( $screen = '' ) { 281 169 echo get_screen_icon( $screen ); 282 170 } 283 171 172 /** 173 * Gets a screen icon. 174 * 175 * @since 3.2.0 176 * 177 * @param string|WP_Screen $screen Optional. Accepts a screen object (and defaults to the current screen object) 178 * which it uses to determine an icon HTML ID. Or, if a string is provided, it is used to form the icon HTML ID. 179 * @return string HTML for the screen icon. 180 */ 284 181 function get_screen_icon( $screen = '' ) { 285 global $current_screen, $typenow; 182 if ( empty( $screen ) ) 183 $screen = get_current_screen(); 184 elseif ( is_string( $screen ) ) 185 $icon_id = $screen; 286 186 287 if ( empty($screen) )288 $screen = $current_screen;289 elseif ( is_string($screen) )290 $name = $screen;291 292 187 $class = 'icon32'; 293 188 294 if ( empty( $name) ) {295 if ( !empty($screen->parent_base))296 $ name= $screen->parent_base;189 if ( empty( $icon_id ) ) { 190 if ( $screen->parent_base ) 191 $icon_id = $screen->parent_base; 297 192 else 298 $ name= $screen->base;193 $icon_id = $screen->base; 299 194 300 if ( 'edit' == $ name && isset($screen->post_type)&& 'page' == $screen->post_type )301 $ name= 'edit-pages';195 if ( 'edit' == $icon_id && $screen->post_type && 'page' == $screen->post_type ) 196 $icon_id = 'edit-pages'; 302 197 303 $post_type = ''; 304 if ( isset( $screen->post_type ) ) 305 $post_type = $screen->post_type; 306 elseif ( $current_screen == $screen ) 307 $post_type = $typenow; 308 if ( $post_type ) 309 $class .= ' ' . sanitize_html_class( 'icon32-posts-' . $post_type ); 198 if ( $screen->post_type ) 199 $class .= ' ' . sanitize_html_class( 'icon32-posts-' . $screen->post_type ); 310 200 } 311 201 312 return '<div id="icon-' . esc_attr( $ name) . '" class="' . $class . '"><br /></div>';202 return '<div id="icon-' . esc_attr( $icon_id ) . '" class="' . $class . '"><br /></div>'; 313 203 } 314 204 315 205 /** 316 * Get the current screen object206 * Get the current screen object 317 207 * 318 * @since 3.1.0208 * @since 3.1.0 319 209 * 320 * @return objectCurrent screen object210 * @return WP_Screen Current screen object 321 211 */ 322 212 function get_current_screen() { 323 213 global $current_screen; 324 214 325 if ( ! isset($current_screen) )215 if ( ! isset( $current_screen ) ) 326 216 return null; 327 217 328 218 return $current_screen; … … 335 225 * 336 226 * @uses $current_screen 337 227 * 338 * @param string $id Screen id, optional. 228 * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen, 229 * or an existing screen object. 339 230 */ 340 function set_current_screen( $id = '' ) { 341 global $current_screen; 342 343 $current_screen = new WP_Screen( $id ); 344 345 $current_screen = apply_filters('current_screen', $current_screen); 231 function set_current_screen( $hook_name = '' ) { 232 WP_Screen::get( $hook_name )->set_current_screen(); 346 233 } 347 234 348 235 /** 349 * A class representing the currentadmin screen.236 * A class representing the admin screen. 350 237 * 351 238 * @since 3.3.0 352 239 * @access public 353 240 */ 354 241 final class WP_Screen { 355 242 /** 356 * Any action associated with the screen. 'add' for *-add.php and *-new.php screens. Empty otherwise.243 * Any action associated with the screen. 'add' for *-add.php and *-new.php screens. Empty otherwise. 357 244 * 358 245 * @since 3.3.0 359 246 * @var string … … 445 332 * @var array 446 333 * @access private 447 334 */ 448 private static$_help_tabs = array();335 private $_help_tabs = array(); 449 336 450 337 /** 451 338 * The help sidebar data associated with screens, if any. … … 454 341 * @var string 455 342 * @access private 456 343 */ 457 private static $_help_sidebar = array();344 private $_help_sidebar = ''; 458 345 459 346 /** 460 347 * Stores old string-based help. … … 468 355 * @var array 469 356 * @access private 470 357 */ 471 private static$_options = array();358 private $_options = array(); 472 359 473 360 /** 361 * The screen object registry. 362 * 363 * @since 3.3.0 364 * @var array 365 * @access private 366 */ 367 private static $_registry = array(); 368 369 /** 474 370 * Stores the result of the public show_screen_options function. 475 371 * 476 372 * @since 3.3.0 … … 489 385 private $_screen_settings; 490 386 491 387 /** 492 * Constructor388 * Fetches a screen object. 493 389 * 494 390 * @since 3.3.0 391 * @access public 495 392 * 496 * @param string $id A screen id. If empty, the $hook_suffix global is used to derive the ID. 393 * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen. 394 * Defaults to the current $hook_suffix global. 395 * @return WP_Screen Screen object. 497 396 */ 498 public function __construct( $id = '' ) { 499 global $hook_suffix, $typenow, $taxnow; 397 public function get( $hook_name = '' ) { 500 398 501 $action = ''; 399 if ( is_a( $hook_name, 'WP_Screen' ) ) 400 return $hook_name; 502 401 503 if ( empty( $id ) ) { 504 $screen = $hook_suffix; 505 $screen = str_replace('.php', '', $screen); 506 if ( preg_match('/-add|-new$/', $screen) ) 507 $action = 'add'; 508 $screen = str_replace('-new', '', $screen); 509 $screen = str_replace('-add', '', $screen); 510 $this->id = $this->base = $screen; 511 } else { 512 $id = sanitize_key( $id ); 513 if ( false !== strpos($id, '-') ) { 514 list( $id, $typenow ) = explode('-', $id, 2); 515 if ( taxonomy_exists( $typenow ) ) { 402 $action = $post_type = $taxonomy = ''; 403 404 if ( $hook_name ) { 405 if ( '-network' == substr( $hook_name, -8 ) ) 406 $hook_name = str_replace( '-network', '', $hook_name ); 407 elseif ( '-user' == substr( $hook_name, -5 ) ) 408 $hook_name = str_replace( '-user', '', $hook_name ); 409 $id = sanitize_key( $hook_name ); 410 if ( false !== strpos( $id, '-' ) ) { 411 list( $id, $second ) = explode( '-', $id, 2 ); 412 if ( taxonomy_exists( $second ) ) { 516 413 $id = 'edit-tags'; 517 $taxnow = $typenow; 518 $typenow = ''; 414 $taxonomy = $second; 415 } elseif ( post_type_exists( $second ) ) { 416 $post_type = $second; 417 } else { 418 $id .= '-' . $second; 519 419 } 520 420 } 521 $this->id = $this->base = $id; 421 } else { 422 $id = $GLOBALS['hook_suffix']; 423 $id = str_replace( '.php', '', $id ); 424 if ( in_array( substr( $id, -4 ), array( '-add', '-new' ) ) ) 425 $action = 'add'; 426 $id = str_replace( array( '-new', '-add' ), '', $id ); 522 427 } 523 428 524 $this->action = $action; 429 if ( 'index' == $id ) 430 $id = 'dashboard'; 525 431 526 // Map index to dashboard 527 if ( 'index' == $this->base ) 528 $this->base = 'dashboard'; 529 if ( 'index' == $this->id ) 530 $this->id = 'dashboard'; 432 $base = $id; 531 433 532 if ( 'edit' == $this->id ) { 533 if ( empty($typenow) ) 534 $typenow = 'post'; 535 $this->id .= '-' . $typenow; 536 $this->post_type = $typenow; 537 } elseif ( 'post' == $this->id ) { 538 if ( empty($typenow) ) 539 $typenow = 'post'; 540 $this->id = $typenow; 541 $this->post_type = $typenow; 542 } elseif ( 'edit-tags' == $this->id ) { 543 if ( empty($taxnow) ) 544 $taxnow = 'post_tag'; 545 $this->id = 'edit-' . $taxnow; 546 $this->taxonomy = $taxnow; 434 // If this is the current screen, see if we can be more accurate for post types and taxonomies. 435 if ( ! $hook_name ) { 436 switch ( $base ) { 437 case 'post' : 438 if ( isset( $_GET['post'] ) ) 439 $post_id = (int) $_GET['post']; 440 elseif ( isset( $_POST['post_ID'] ) ) 441 $post_id = (int) $_POST['post_ID']; 442 else 443 $post_id = 0; 444 445 if ( $post_id ) { 446 $post = get_post( $post_id ); 447 if ( $post ) 448 $post_type = $post->post_type; 449 } elseif ( isset( $_POST['post_type'] ) && post_type_exists( $_POST['post_type'] ) ) { 450 $post_type = $_GET['post_type']; 451 } elseif ( $action == 'add' && isset( $_GET['post_type'] ) && post_type_exists( $_GET['post_type'] ) ) { 452 $post_type = $_GET['post_type']; 453 } 454 break; 455 case 'edit' : 456 if ( isset( $_GET['post_type'] ) && post_type_exists( $_GET['post_type'] ) ) 457 $post_type = $_GET['post_type']; 458 break; 459 case 'edit-tags' : 460 if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) 461 $taxonomy = $_REQUEST['taxonomy']; 462 break; 463 } 547 464 } 548 465 549 $this->is_network = is_network_admin(); 550 $this->is_user = is_user_admin(); 466 switch ( $id ) { 467 case 'post' : 468 if ( ! $post_type ) 469 $post_type = 'post'; 470 $id = $post_type; 471 break; 472 case 'edit' : 473 if ( ! $post_type ) 474 $post_type = 'post'; 475 $id .= '-' . $post_type; 476 break; 477 case 'edit-tags' : 478 if ( ! $taxonomy ) 479 $taxonomy = 'post_tag'; 480 $id = 'edit-' . $taxonomy; 481 break; 482 } 551 483 552 if ( $this->is_network) {553 $ this->base.= '-network';554 $ this->id.= '-network';555 } elseif ( $this->is_user) {556 $ this->base.= '-user';557 $ this->id.= '-user';484 if ( is_network_admin() ) { 485 $id .= '-network'; 486 $base .= '-network'; 487 } elseif ( is_user_admin() ) { 488 $id .= '-user'; 489 $base .= '-user'; 558 490 } 559 491 560 if ( ! isset( self::$_help_tabs[ $this->id ] ) ) 561 self::$_help_tabs[ $this->id ] = array(); 562 if ( ! isset( self::$_help_sidebar[ $this->id ] ) ) 563 self::$_help_sidebar[ $this->id ] = ''; 564 if ( ! isset( self::$_options[ $this->id ] ) ) 565 self::$_options[ $this->id ] = array(); 492 if ( isset( self::$_registry[ $id ] ) ) 493 return self::$_registry[ $id ]; 494 495 $screen = new WP_Screen(); 496 $screen->id = $id; 497 $screen->base = $base; 498 $screen->action = $action; 499 $screen->post_type = $post_type; 500 $screen->taxonomy = $taxonomy; 501 $screen->is_user = is_user_admin(); 502 $screen->is_network = is_network_admin(); 503 504 self::$_registry[ $id ] = $screen; 505 506 return $screen; 566 507 } 567 508 509 /** 510 * Makes the screen object the current screen. 511 * 512 * @see set_current_screen() 513 * @since 3.3.0 514 */ 515 function set_current_screen() { 516 global $current_screen, $taxnow, $typenow; 517 $current_screen = $this; 518 $taxnow = $this->taxonomy; 519 $typenow = $this->post_type; 520 $current_screen = apply_filters( 'current_screen', $current_screen ); 521 } 522 523 /** 524 * Constructor 525 * 526 * @since 3.3.0 527 * @access private 528 */ 529 private function __construct() {} 530 531 /** 532 * Sets the old string-based contextual help for the screen. 533 * 534 * For backwards compatibility. 535 * 536 * @since 3.3.0 537 * 538 * @param WP_Screen $screen A screen object. 539 * @param string $help Help text. 540 */ 568 541 static function add_old_compat_help( $screen, $help ) { 569 self::$_old_compat_help[ $screen ] = $help;542 self::$_old_compat_help[ $screen->id ] = $help; 570 543 } 571 544 572 545 /** … … 593 566 * @param mixed $args Option-dependent arguments. 594 567 */ 595 568 public function add_option( $option, $args = array() ) { 596 self::$_options[ $this->id ][ $option ] = $args;569 $this->_options[ $option ] = $args; 597 570 } 598 571 599 572 /** … … 604 577 * @param string 605 578 */ 606 579 public function get_option( $option, $key = false ) { 607 if ( ! isset( self::$_options[ $this->id ][ $option ] ) )580 if ( ! isset( $this->_options[ $option ] ) ) 608 581 return null; 609 582 if ( $key ) { 610 if ( isset( self::$_options[ $this->id ][ $option ][ $key ] ) )611 return self::$_options[ $this->id ][ $option ][ $key ];583 if ( isset( $this->_options[ $option ][ $key ] ) ) 584 return $this->_options[ $option ][ $key ]; 612 585 return null; 613 586 } 614 return self::$_options[ $this->id ][ $option ];587 return $this->_options[ $option ]; 615 588 } 616 589 617 590 /** … … 642 615 if ( ! $args['id'] || ! $args['title'] ) 643 616 return; 644 617 645 self::$_help_tabs[ $this->id ][] = $args;618 $this->_help_tabs[] = $args; 646 619 } 647 620 648 621 /** … … 654 627 * @param string $content Sidebar content in plain text or HTML. 655 628 */ 656 629 public function add_help_sidebar( $content ) { 657 self::$_help_sidebar[ $this->id ]= $content;630 $this->_help_sidebar = $content; 658 631 } 659 632 660 633 /** … … 669 642 // Call old contextual_help_list filter. 670 643 self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this ); 671 644 672 if ( isset( self::$_old_compat_help[ $this->id ] ) || empty( self::$_help_tabs[ $this->id ]) ) {645 if ( isset( self::$_old_compat_help[ $this->id ] ) || empty( $this->_help_tabs ) ) { 673 646 // Call old contextual_help filter. 674 647 if ( isset( self::$_old_compat_help[ $this->id ] ) ) 675 648 $contextual_help = apply_filters( 'contextual_help', self::$_old_compat_help[ $this->id ], $this->id, $this ); … … 695 668 'title' => __('Screen Options'), 696 669 'callback' => array( $this, 'render_screen_options' ), 697 670 ) ); 698 $_options_tab = array_pop( self::$_help_tabs[ $this->id ]);699 array_unshift( self::$_help_tabs[ $this->id ], $_options_tab );671 $_options_tab = array_pop( $this->_help_tabs ); 672 array_unshift( $this->_help_tabs, $_options_tab ); 700 673 } 701 674 702 675 // Time to render! … … 706 679 <div id="contextual-help-wrap" class="hidden"> 707 680 <div class="contextual-help-tabs"> 708 681 <ul> 709 <?php foreach ( self::$_help_tabs[ $this->id ]as $i => $tab ):682 <?php foreach ( $this->_help_tabs as $i => $tab ): 710 683 $link_id = "tab-link-{$tab['id']}"; 711 684 $panel_id = "tab-panel-{$tab['id']}"; 712 685 $classes = ( $i == 0 ) ? 'active' : ''; … … 721 694 </ul> 722 695 </div> 723 696 724 <?php if ( ! empty( self::$_help_sidebar[ $this->id ]) ) : ?>697 <?php if ( ! empty( $this->_help_sidebar ) ) : ?> 725 698 <div class="contextual-help-sidebar"> 726 <?php echo self::$_help_sidebar[ $this->id ]; ?>699 <?php echo $this->_help_sidebar; ?> 727 700 </div> 728 701 <?php endif; ?> 729 702 730 703 <div class="contextual-help-tabs-wrap"> 731 <?php foreach ( self::$_help_tabs[ $this->id ]as $i => $tab ):704 <?php foreach ( $this->_help_tabs as $i => $tab ): 732 705 $panel_id = "tab-panel-{$tab['id']}"; 733 706 $classes = ( $i == 0 ) ? 'active' : ''; 734 707 $classes .= ' help-tab-content'; … … 752 725 } 753 726 754 727 public function show_screen_options() { 755 global $wp_meta_boxes , $wp_list_table;728 global $wp_meta_boxes; 756 729 757 730 if ( is_bool( $this->_show_screen_options ) ) 758 731 return $this->_show_screen_options; … … 764 737 $show_screen = true; 765 738 766 739 // Check if there are per-page options. 767 $show_screen = $show_screen || $this->get_option('per_page'); 740 if ( $this->get_option( 'per_page' ) ) 741 $show_screen = true; 768 742 769 743 $this->_screen_settings = apply_filters( 'screen_settings', '', $this ); 770 744 771 745 switch ( $this->id ) { 772 746 case 'widgets': 773 747 $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"; 774 $show_screen = true;775 748 break; 776 749 } 777 750 778 if ( ! empty( $this->_screen_settings ))751 if ( $this->_screen_settings || $this->_options ) 779 752 $show_screen = true; 780 753 781 if ( ! empty( self::$_options[ $this->id ] ) )782 $show_screen = true;783 784 754 $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); 785 755 return $this->_show_screen_options; 786 756 } … … 791 761 * @since 3.3.0 792 762 */ 793 763 public function render_screen_options() { 794 global $wp_meta_boxes , $wp_list_table;764 global $wp_meta_boxes; 795 765 796 766 $columns = get_column_headers( $this ); 797 767 $hidden = get_hidden_columns( $this ); -
wp-admin/post.php
16 16 17 17 wp_reset_vars(array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder')); 18 18 19 if ( isset( $_GET['post']) )19 if ( isset( $_GET['post'] ) ) 20 20 $post_id = (int) $_GET['post']; 21 elseif ( isset( $_POST['post_ID']) )21 elseif ( isset( $_POST['post_ID'] ) ) 22 22 $post_id = (int) $_POST['post_ID']; 23 23 else 24 24 $post_id = 0; 25 25 26 $post_ID = $post_id; 26 $post = null; 27 $post_type_object = null; 28 $post_type = null; 29 if ( $post_id ) { 30 $post = get_post($post_id); 31 if ( $post ) { 32 $post_type_object = get_post_type_object($post->post_type); 33 if ( $post_type_object ) { 34 $post_type = $post->post_type; 35 $current_screen->post_type = $post->post_type; 36 $current_screen->id = $current_screen->post_type; 37 } 38 } 39 } elseif ( isset($_POST['post_type']) ) { 40 $post_type_object = get_post_type_object($_POST['post_type']); 41 if ( $post_type_object ) { 42 $post_type = $post_type_object->name; 43 $current_screen->post_type = $post_type; 44 $current_screen->id = $current_screen->post_type; 45 } 27 $post = $post_type = $post_type_object = null; 28 29 if ( $post_id ) 30 $post = get_post( $post_id ); 31 32 if ( $post ) { 33 $post_type = $post->post_type; 34 $post_type_object = get_post_type_object( $post_type ); 46 35 } 47 36 48 37 /**