Changeset 19468
- Timestamp:
- 11/28/2011 06:33:40 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/screen.php
r19430 r19468 396 396 $id = $GLOBALS['hook_suffix']; 397 397 398 $id = str_replace( '.php', '', $id ); 399 if ( in_array( substr( $id, -4 ), array( '-add', '-new' ) ) ) 400 $action = 'add'; 401 $id = str_replace( array( '-new', '-add' ), '', $id ); 402 403 if ( $hook_name ) { 398 // For those pesky meta boxes. 399 if ( $hook_name && post_type_exists( $hook_name ) ) { 400 $post_type = $id; 401 $id = 'post'; // changes later. ends up being $base. 402 } else { 403 $last_four = substr( $id, -4 ); 404 if ( '.php' == $last_four ) { 405 $id = substr( $id, 0, -4 ); 406 $last_four = substr( $id, -4 ); 407 } 408 if ( '-add' == $last_four || '-new' == $last_four ) { 409 $id = substr( $id, 0, -4 ); 410 $action = 'add'; 411 } 412 } 413 414 if ( ! $post_type && $hook_name ) { 404 415 if ( '-network' == substr( $id, -8 ) ) { 405 $id = s tr_replace( '-network', '', $id);416 $id = substr( $id, 0, -8 ); 406 417 $is_network = true; 407 418 } elseif ( '-user' == substr( $id, -5 ) ) { 408 $id = s tr_replace( '-user', '', $id);419 $id = substr( $id, 0, -5 ); 409 420 $is_user = true; 410 421 } 411 422 412 423 $id = sanitize_key( $id ); 413 if ( post_type_exists( $id ) ) { 414 $post_type = $id; 415 $id = 'post'; // changes later. ends up being $base. 416 } elseif ( false !== strpos( $id, '-' ) ) { 417 list( $first, $second ) = explode( '-', $id, 2 ); 418 if ( taxonomy_exists( $second ) ) { 424 if ( 'edit-' == substr( $id, 0, 5 ) ) { 425 $maybe = substr( $id, 5 ); 426 if ( taxonomy_exists( $maybe ) ) { 419 427 $id = 'edit-tags'; 420 $taxonomy = $ second;421 } elseif ( post_type_exists( $ second) ) {422 $id = $first;423 $post_type = $ second;428 $taxonomy = $maybe; 429 } elseif ( post_type_exists( $maybe ) ) { 430 $id = 'edit'; 431 $post_type = $maybe; 424 432 } 425 433 }
Note: See TracChangeset
for help on using the changeset viewer.