Changeset 19321
- Timestamp:
- 11/17/2011 06:01:08 PM (13 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit.php
r19272 r19321 10 10 require_once( './admin.php' ); 11 11 12 if ( !isset($_GET['post_type']) ) 13 $post_type = 'post'; 14 elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) ) 15 $post_type = $_GET['post_type']; 16 else 17 wp_die( __('Invalid post type') ); 18 19 $_GET['post_type'] = $post_type; 20 12 if ( ! $typenow ) 13 wp_die( __( 'Invalid post type' ) ); 14 15 $post_type = $typenow; 21 16 $post_type_object = get_post_type_object( $post_type ); 22 17 23 if ( !current_user_can($post_type_object->cap->edit_posts) ) 24 wp_die(__('Cheatin’ uh?')); 18 if ( ! $post_type_object ) 19 wp_die( __( 'Invalid post type' ) ); 20 21 if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) 22 wp_die( __( 'Cheatin’ uh?' ) ); 25 23 26 24 $wp_list_table = _get_list_table('WP_Posts_List_Table'); -
trunk/wp-admin/includes/class-wp-posts-list-table.php
r19213 r19321 49 49 global $post_type_object, $wpdb; 50 50 51 if ( !isset( $_REQUEST['post_type'] ) ) 52 $post_type = 'post'; 53 elseif ( in_array( $_REQUEST['post_type'], get_post_types( array( 'show_ui' => true ) ) ) ) 54 $post_type = $_REQUEST['post_type']; 55 else 56 wp_die( __( 'Invalid post type' ) ); 57 $_REQUEST['post_type'] = $post_type; 58 51 $post_type = get_current_screen()->post_type; 59 52 $post_type_object = get_post_type_object( $post_type ); 60 53 -
trunk/wp-admin/includes/screen.php
r19185 r19321 400 400 return $hook_name; 401 401 402 $action = $post_type = $taxonomy = '';402 $action = $post_type = $taxonomy = null; 403 403 $is_network = $is_user = false; 404 404 … … 448 448 // If this is the current screen, see if we can be more accurate for post types and taxonomies. 449 449 if ( ! $hook_name ) { 450 if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ))451 $post_type = $_REQUEST['post_type'];452 if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ))453 $taxonomy = $_REQUEST['taxonomy'];450 if ( isset( $_REQUEST['post_type'] ) ) 451 $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false; 452 if ( isset( $_REQUEST['taxonomy'] ) ) 453 $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false; 454 454 455 455 switch ( $base ) { … … 469 469 break; 470 470 case 'edit-tags' : 471 if ( !$post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) )471 if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) 472 472 $post_type = 'post'; 473 473 break; … … 477 477 switch ( $base ) { 478 478 case 'post' : 479 if ( !$post_type )479 if ( null === $post_type ) 480 480 $post_type = 'post'; 481 481 $id = $post_type; 482 482 break; 483 483 case 'edit' : 484 if ( !$post_type )484 if ( null === $post_type ) 485 485 $post_type = 'post'; 486 486 $id .= '-' . $post_type; 487 487 break; 488 488 case 'edit-tags' : 489 if ( !$taxonomy )489 if ( null === $taxonomy ) 490 490 $taxonomy = 'post_tag'; 491 491 $id = 'edit-' . $taxonomy; … … 512 512 $screen->base = $base; 513 513 $screen->action = $action; 514 $screen->post_type = $post_type;515 $screen->taxonomy = $taxonomy;514 $screen->post_type = (string) $post_type; 515 $screen->taxonomy = (string) $taxonomy; 516 516 $screen->is_user = $is_user; 517 517 $screen->is_network = $is_network; -
trunk/wp-admin/includes/template.php
r19295 r19321 1393 1393 ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', 1394 1394 pagenow = '<?php echo $current_screen->id; ?>', 1395 typenow = '<?php if ( isset($current_screen->post_type) )echo $current_screen->post_type; ?>',1395 typenow = '<?php echo $current_screen->post_type; ?>', 1396 1396 adminpage = '<?php echo $admin_body_class; ?>', 1397 1397 thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
Note: See TracChangeset
for help on using the changeset viewer.