Ticket #18785: 18785.4.diff
File 18785.4.diff, 23.3 KB (added by , 12 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' == $screen->base || 'post' == $screen->base ) { 196 if ( 'page' == $screen->post_type ) 197 $icon_id = 'edit-pages'; 302 198 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 ); 199 $class .= ' ' . sanitize_html_class( 'icon32-posts-' . $screen->post_type ); 200 } 310 201 } 311 202 312 return '<div id="icon-' . esc_attr( $ name) . '" class="' . $class . '"><br /></div>';203 return '<div id="icon-' . esc_attr( $icon_id ) . '" class="' . $class . '"><br /></div>'; 313 204 } 314 205 315 206 /** 316 * 207 * Get the current screen object 317 208 * 318 * 209 * @since 3.1.0 319 210 * 320 * @return objectCurrent screen object211 * @return WP_Screen Current screen object 321 212 */ 322 213 function get_current_screen() { 323 214 global $current_screen; 324 215 325 if ( ! isset($current_screen) )216 if ( ! isset( $current_screen ) ) 326 217 return null; 327 218 328 219 return $current_screen; … … 335 226 * 336 227 * @uses $current_screen 337 228 * 338 * @param string $id Screen id, optional. 229 * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen, 230 * or an existing screen object. 339 231 */ 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); 232 function set_current_screen( $hook_name = '' ) { 233 WP_Screen::get( $hook_name )->set_current_screen(); 346 234 } 347 235 348 236 /** 349 * A class representing the currentadmin screen.237 * A class representing the admin screen. 350 238 * 351 239 * @since 3.3.0 352 240 * @access public 353 241 */ 354 242 final class WP_Screen { 355 243 /** 356 * Any action associated with the screen. 244 * Any action associated with the screen. 'add' for *-add.php and *-new.php screens. Empty otherwise. 357 245 * 358 246 * @since 3.3.0 359 247 * @var string … … 445 333 * @var array 446 334 * @access private 447 335 */ 448 private static$_help_tabs = array();449 336 private $_help_tabs = array(); 337 450 338 /** 451 339 * The help sidebar data associated with screens, if any. 452 340 * … … 454 342 * @var string 455 343 * @access private 456 344 */ 457 private static $_help_sidebar = array();345 private $_help_sidebar = ''; 458 346 459 347 /** 460 348 * Stores old string-based help. … … 468 356 * @var array 469 357 * @access private 470 358 */ 471 private static$_options = array();359 private $_options = array(); 472 360 473 361 /** 362 * The screen object registry. 363 * 364 * @since 3.3.0 365 * @var array 366 * @access private 367 */ 368 private static $_registry = array(); 369 370 /** 474 371 * Stores the result of the public show_screen_options function. 475 372 * 476 373 * @since 3.3.0 … … 489 386 private $_screen_settings; 490 387 491 388 /** 492 * Constructor389 * Fetches a screen object. 493 390 * 494 391 * @since 3.3.0 392 * @access public 495 393 * 496 * @param string $id A screen id. If empty, the $hook_suffix global is used to derive the ID. 394 * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen. 395 * Defaults to the current $hook_suffix global. 396 * @return WP_Screen Screen object. 497 397 */ 498 public function __construct( $id = '' ) { 499 global $hook_suffix, $typenow, $taxnow; 398 public function get( $hook_name = '' ) { 500 399 501 $action = ''; 400 if ( is_a( $hook_name, 'WP_Screen' ) ) 401 return $hook_name; 502 402 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 ) ) { 403 $action = $post_type = $taxonomy = ''; 404 405 if ( $hook_name ) { 406 if ( '-network' == substr( $hook_name, -8 ) ) 407 $hook_name = str_replace( '-network', '', $hook_name ); 408 elseif ( '-user' == substr( $hook_name, -5 ) ) 409 $hook_name = str_replace( '-user', '', $hook_name ); 410 $id = sanitize_key( $hook_name ); 411 if ( false !== strpos( $id, '-' ) ) { 412 list( $id, $second ) = explode( '-', $id, 2 ); 413 if ( taxonomy_exists( $second ) ) { 516 414 $id = 'edit-tags'; 517 $taxnow = $typenow; 518 $typenow = ''; 415 $taxonomy = $second; 416 } elseif ( post_type_exists( $second ) ) { 417 $post_type = $second; 418 } else { 419 $id .= '-' . $second; 519 420 } 520 421 } 521 $this->id = $this->base = $id; 422 } else { 423 $id = $GLOBALS['hook_suffix']; 424 $id = str_replace( '.php', '', $id ); 425 if ( in_array( substr( $id, -4 ), array( '-add', '-new' ) ) ) 426 $action = 'add'; 427 $id = str_replace( array( '-new', '-add' ), '', $id ); 522 428 } 523 429 524 $this->action = $action; 430 if ( 'index' == $id ) 431 $id = 'dashboard'; 525 432 526 // Map index to dashboard 527 if ( 'index' == $this->base ) 528 $this->base = 'dashboard'; 529 if ( 'index' == $this->id ) 530 $this->id = 'dashboard'; 433 $base = $id; 531 434 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; 435 // If this is the current screen, see if we can be more accurate for post types and taxonomies. 436 if ( ! $hook_name ) { 437 switch ( $base ) { 438 case 'post' : 439 if ( isset( $_GET['post'] ) ) 440 $post_id = (int) $_GET['post']; 441 elseif ( isset( $_POST['post_ID'] ) ) 442 $post_id = (int) $_POST['post_ID']; 443 else 444 $post_id = 0; 445 446 if ( $post_id ) { 447 $post = get_post( $post_id ); 448 if ( $post ) 449 $post_type = $post->post_type; 450 } elseif ( isset( $_POST['post_type'] ) && post_type_exists( $_POST['post_type'] ) ) { 451 $post_type = $_GET['post_type']; 452 } elseif ( $action == 'add' && isset( $_GET['post_type'] ) && post_type_exists( $_GET['post_type'] ) ) { 453 $post_type = $_GET['post_type']; 454 } 455 break; 456 case 'edit' : 457 if ( isset( $_GET['post_type'] ) && post_type_exists( $_GET['post_type'] ) ) 458 $post_type = $_GET['post_type']; 459 break; 460 case 'edit-tags' : 461 if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) 462 $taxonomy = $_REQUEST['taxonomy']; 463 break; 464 } 547 465 } 548 466 549 $this->is_network = is_network_admin(); 550 $this->is_user = is_user_admin(); 467 switch ( $id ) { 468 case 'post' : 469 if ( ! $post_type ) 470 $post_type = 'post'; 471 $id = $post_type; 472 break; 473 case 'edit' : 474 if ( ! $post_type ) 475 $post_type = 'post'; 476 $id .= '-' . $post_type; 477 break; 478 case 'edit-tags' : 479 if ( ! $taxonomy ) 480 $taxonomy = 'post_tag'; 481 $id = 'edit-' . $taxonomy; 482 break; 483 } 551 484 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';485 if ( is_network_admin() ) { 486 $id .= '-network'; 487 $base .= '-network'; 488 } elseif ( is_user_admin() ) { 489 $id .= '-user'; 490 $base .= '-user'; 558 491 } 559 492 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(); 493 if ( isset( self::$_registry[ $id ] ) ) 494 return self::$_registry[ $id ]; 495 496 $screen = new WP_Screen(); 497 $screen->id = $id; 498 $screen->base = $base; 499 $screen->action = $action; 500 $screen->post_type = $post_type; 501 $screen->taxonomy = $taxonomy; 502 $screen->is_user = is_user_admin(); 503 $screen->is_network = is_network_admin(); 504 505 self::$_registry[ $id ] = $screen; 506 507 return $screen; 566 508 } 567 509 510 /** 511 * Makes the screen object the current screen. 512 * 513 * @see set_current_screen() 514 * @since 3.3.0 515 */ 516 function set_current_screen() { 517 global $current_screen, $taxnow, $typenow; 518 $current_screen = $this; 519 $taxnow = $this->taxonomy; 520 $typenow = $this->post_type; 521 $current_screen = apply_filters( 'current_screen', $current_screen ); 522 } 523 524 /** 525 * Constructor 526 * 527 * @since 3.3.0 528 * @access private 529 */ 530 private function __construct() {} 531 532 /** 533 * Sets the old string-based contextual help for the screen. 534 * 535 * For backwards compatibility. 536 * 537 * @since 3.3.0 538 * 539 * @param WP_Screen $screen A screen object. 540 * @param string $help Help text. 541 */ 568 542 static function add_old_compat_help( $screen, $help ) { 569 self::$_old_compat_help[ $screen ] = $help;543 self::$_old_compat_help[ $screen->id ] = $help; 570 544 } 571 545 572 546 /** … … 593 567 * @param mixed $args Option-dependent arguments. 594 568 */ 595 569 public function add_option( $option, $args = array() ) { 596 self::$_options[ $this->id ][ $option ] = $args;570 $this->_options[ $option ] = $args; 597 571 } 598 572 599 573 /** … … 601 575 * 602 576 * @since 3.3.0 603 577 * 604 * @param string 578 * @param string 605 579 */ 606 580 public function get_option( $option, $key = false ) { 607 if ( ! isset( self::$_options[ $this->id ][ $option ] ) )581 if ( ! isset( $this->_options[ $option ] ) ) 608 582 return null; 609 583 if ( $key ) { 610 if ( isset( self::$_options[ $this->id ][ $option ][ $key ] ) )611 return self::$_options[ $this->id ][ $option ][ $key ];584 if ( isset( $this->_options[ $option ][ $key ] ) ) 585 return $this->_options[ $option ][ $key ]; 612 586 return null; 613 587 } 614 return self::$_options[ $this->id ][ $option ];588 return $this->_options[ $option ]; 615 589 } 616 590 617 591 /** … … 642 616 if ( ! $args['id'] || ! $args['title'] ) 643 617 return; 644 618 645 self::$_help_tabs[ $this->id ][] = $args;619 $this->_help_tabs[] = $args; 646 620 } 647 621 648 622 /** … … 654 628 * @param string $content Sidebar content in plain text or HTML. 655 629 */ 656 630 public function add_help_sidebar( $content ) { 657 self::$_help_sidebar[ $this->id ]= $content;631 $this->_help_sidebar = $content; 658 632 } 659 633 660 634 /** … … 669 643 // Call old contextual_help_list filter. 670 644 self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this ); 671 645 672 if ( isset( self::$_old_compat_help[ $this->id ] ) || empty( self::$_help_tabs[ $this->id ]) ) {646 if ( isset( self::$_old_compat_help[ $this->id ] ) || empty( $this->_help_tabs ) ) { 673 647 // Call old contextual_help filter. 674 648 if ( isset( self::$_old_compat_help[ $this->id ] ) ) 675 649 $contextual_help = apply_filters( 'contextual_help', self::$_old_compat_help[ $this->id ], $this->id, $this ); … … 695 669 'title' => __('Screen Options'), 696 670 'callback' => array( $this, 'render_screen_options' ), 697 671 ) ); 698 $_options_tab = array_pop( self::$_help_tabs[ $this->id ]);699 array_unshift( self::$_help_tabs[ $this->id ], $_options_tab );672 $_options_tab = array_pop( $this->_help_tabs ); 673 array_unshift( $this->_help_tabs, $_options_tab ); 700 674 } 701 675 702 676 // Time to render! … … 706 680 <div id="contextual-help-wrap" class="hidden"> 707 681 <div class="contextual-help-tabs"> 708 682 <ul> 709 <?php foreach ( self::$_help_tabs[ $this->id ]as $i => $tab ):683 <?php foreach ( $this->_help_tabs as $i => $tab ): 710 684 $link_id = "tab-link-{$tab['id']}"; 711 685 $panel_id = "tab-panel-{$tab['id']}"; 712 686 $classes = ( $i == 0 ) ? 'active' : ''; … … 721 695 </ul> 722 696 </div> 723 697 724 <?php if ( ! empty( self::$_help_sidebar[ $this->id ]) ) : ?>698 <?php if ( ! empty( $this->_help_sidebar ) ) : ?> 725 699 <div class="contextual-help-sidebar"> 726 <?php echo self::$_help_sidebar[ $this->id ]; ?>700 <?php echo $this->_help_sidebar; ?> 727 701 </div> 728 702 <?php endif; ?> 729 703 730 704 <div class="contextual-help-tabs-wrap"> 731 <?php foreach ( self::$_help_tabs[ $this->id ]as $i => $tab ):705 <?php foreach ( $this->_help_tabs as $i => $tab ): 732 706 $panel_id = "tab-panel-{$tab['id']}"; 733 707 $classes = ( $i == 0 ) ? 'active' : ''; 734 708 $classes .= ' help-tab-content'; … … 752 726 } 753 727 754 728 public function show_screen_options() { 755 global $wp_meta_boxes , $wp_list_table;729 global $wp_meta_boxes; 756 730 757 731 if ( is_bool( $this->_show_screen_options ) ) 758 732 return $this->_show_screen_options; … … 764 738 $show_screen = true; 765 739 766 740 // Check if there are per-page options. 767 $show_screen = $show_screen || $this->get_option('per_page'); 741 if ( $this->get_option( 'per_page' ) ) 742 $show_screen = true; 768 743 769 744 $this->_screen_settings = apply_filters( 'screen_settings', '', $this ); 770 745 771 746 switch ( $this->id ) { 772 747 case 'widgets': 773 748 $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 749 break; 776 750 } 777 751 778 if ( ! empty( $this->_screen_settings ))752 if ( $this->_screen_settings || $this->_options ) 779 753 $show_screen = true; 780 754 781 if ( ! empty( self::$_options[ $this->id ] ) )782 $show_screen = true;783 784 755 $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); 785 756 return $this->_show_screen_options; 786 757 } … … 791 762 * @since 3.3.0 792 763 */ 793 764 public function render_screen_options() { 794 global $wp_meta_boxes , $wp_list_table;765 global $wp_meta_boxes; 795 766 796 767 $columns = get_column_headers( $this ); 797 768 $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 /**