Changeset 15653
- Timestamp:
- 09/24/2010 01:35:06 PM (14 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/default-list-tables.php
r15644 r15653 455 455 <?php 456 456 457 list( $columns, $hidden ) = $this->get_column_ headers();457 list( $columns, $hidden ) = $this->get_column_info(); 458 458 459 459 foreach ( $columns as $column_name => $column_display_name ) { … … 677 677 } 678 678 679 list( $columns, $hidden ) = $this->get_column_ headers();679 list( $columns, $hidden ) = $this->get_column_info(); 680 680 681 681 $col_count = count( $columns ) - count( $hidden ); … … 1163 1163 <?php 1164 1164 1165 list( $columns, $hidden ) = $this->get_column_ headers();1165 list( $columns, $hidden ) = $this->get_column_info(); 1166 1166 foreach ( $columns as $column_name => $column_display_name ) { 1167 1167 $class = "class='$column_name column-$column_name'"; … … 1728 1728 return; 1729 1729 1730 list( $columns, $hidden ) = $this->get_column_ headers();1730 list( $columns, $hidden ) = $this->get_column_info(); 1731 1731 1732 1732 $col_count = count( $columns ) - count( $hidden ); … … 1997 1997 $avatar = get_avatar( $user_object->ID, 32 ); 1998 1998 1999 list( $columns, $hidden ) = $this->get_column_ headers();1999 list( $columns, $hidden ) = $this->get_column_info(); 2000 2000 2001 2001 foreach ( $columns as $column_name => $column_display_name ) { … … 2649 2649 <?php 2650 2650 2651 list( $columns, $hidden ) = $this->get_column_ headers();2651 list( $columns, $hidden ) = $this->get_column_info(); 2652 2652 2653 2653 foreach ( $columns as $column_name => $column_display_name ) { … … 2870 2870 $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path']; 2871 2871 2872 list( $columns, $hidden ) = $this->get_column_ headers();2872 list( $columns, $hidden ) = $this->get_column_info(); 2873 2873 2874 2874 foreach ( $columns as $column_name => $column_display_name ) { … … 3118 3118 <?php 3119 3119 3120 list( $columns, $hidden ) = $this->get_column_ headers();3120 list( $columns, $hidden ) = $this->get_column_info(); 3121 3121 3122 3122 foreach ( $columns as $column_name => $column_display_name ) : -
trunk/wp-admin/includes/deprecated.php
r15542 r15653 371 371 372 372 /** 373 * Get the column headers for a screen373 * Prints column headers for a particular screen. 374 374 * 375 375 * @since 2.7.0 376 376 * @deprecated 3.1.0 377 377 * @deprecated Use WP_List_Table 378 * 379 * @param string|object $screen The screen you want the headers for 380 * @return array Containing the headers in the format id => UI String 381 */ 382 function get_column_headers($screen) { 378 */ 379 function print_column_headers($screen, $id = true) { 383 380 _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' ); 384 381 … … 387 384 $wp_list_table = new _WP_List_Table_Compat($screen); 388 385 389 list( $columns ) = $wp_list_table->get_column_headers();390 391 return $columns;392 }393 394 /**395 * Prints column headers for a particular screen.396 *397 * @since 2.7.0398 * @deprecated 3.1.0399 * @deprecated Use WP_List_Table400 */401 function print_column_headers($screen, $id = true) {402 _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );403 404 global $wp_list_table;405 if ( !is_a($wp_list_table, 'WP_List_Table') )406 $wp_list_table = new _WP_List_Table_Compat($screen);407 408 386 $wp_list_table->print_column_headers($id); 409 }410 411 /**412 * Gets hidden column names for a particular screen.413 *414 * @since 2.7.0415 * @deprecated 3.1.0416 * @deprecated Use WP_List_Table417 *418 * @param string $screen419 * @return array420 */421 function get_hidden_columns($screen) {422 _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );423 424 global $wp_list_table;425 if ( !is_a($wp_list_table, 'WP_List_Table') )426 $wp_list_table = new _WP_List_Table_Compat($screen);427 428 return $wp_list_table->get_hidden_columns();429 387 } 430 388 -
trunk/wp-admin/includes/list-table.php
r15642 r15653 70 70 */ 71 71 function WP_List_Table( $args ) { 72 global $_wp_column_headers; 73 74 $_wp_column_headers = $this->get_columns(); 72 75 73 76 $args = wp_parse_args( $args, array( … … 82 85 if ( is_string( $this->_screen ) ) 83 86 $this->_screen = convert_to_screen( $this->_screen ); 87 88 add_filter( 'manage_' . $this->_screen->id . '_columns', array( $this, 'get_columns' ) ); 84 89 85 90 if ( !$args['plural'] ) … … 515 520 516 521 /** 517 * Get a list of hidden columns.518 * 519 * @since 3.1.0 520 * @access pr ivate522 * Get a list of all, hidden and sortable columns, with filter applied 523 * 524 * @since 3.1.0 525 * @access protected 521 526 * 522 527 * @return array 523 528 */ 524 function get_hidden_columns() { 525 return (array) get_user_option( 'manage' . $this->_screen->id. 'columnshidden' ); 526 } 527 528 /** 529 * Get a list of all, hidden and sortable columns, with filter applied 530 * 531 * @since 3.1.0 532 * @access protected 533 * 534 * @return array 535 */ 536 function get_column_headers() { 529 function get_column_info() { 537 530 if ( !isset( $this->_column_headers ) ) { 538 $columns = apply_filters( 'manage_' . $this->_screen->id . '_columns', $this->get_columns() ); 531 $columns = get_column_headers( $this->_screen ); 532 $hidden = get_hidden_columns( $this->_screen ); 539 533 $sortable = apply_filters( 'manage_' . $this->_screen->id . '_sortable_columns', $this->get_sortable_columns() ); 540 $hidden = $this->get_hidden_columns();541 534 542 535 $this->_column_headers = array( $columns, $hidden, $sortable ); … … 557 550 $screen = $this->_screen; 558 551 559 list( $columns, $hidden, $sortable ) = $this->get_column_ headers();552 list( $columns, $hidden, $sortable ) = $this->get_column_info(); 560 553 561 554 $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; … … 747 740 */ 748 741 function single_row_columns( $item ) { 749 list( $columns, $hidden ) = $this->get_column_ headers();742 list( $columns, $hidden ) = $this->get_column_info(); 750 743 751 744 foreach ( $columns as $column_name => $column_display_name ) { -
trunk/wp-admin/includes/template.php
r15590 r15653 218 218 echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, "</label></li>"; 219 219 } 220 } 221 222 /** 223 * Get the column headers for a screen 224 * 225 * @since 2.7.0 226 * 227 * @param string|object $screen The screen you want the headers for 228 * @return array Containing the headers in the format id => UI String 229 */ 230 function get_column_headers( $screen ) { 231 if ( is_string( $screen ) ) 232 $screen = convert_to_screen( $screen ); 233 234 global $_wp_column_headers; 235 236 if ( !isset( $_wp_column_headers[ $screen->id ] ) ) { 237 $_wp_column_headers[ $screen->id ] = apply_filters( 'manage_' . $screen->id . '_columns', $_wp_column_headers ); 238 } 239 240 return $_wp_column_headers[ $screen->id ]; 241 } 242 243 /** 244 * Get a list of hidden columns. 245 * 246 * @since 2.7.0 247 * 248 * @param string|object $screen The screen you want the hidden columns for 249 * @return array 250 */ 251 function get_hidden_columns( $screen ) { 252 if ( is_string( $screen ) ) 253 $screen = convert_to_screen( $screen ); 254 255 return (array) get_user_option( 'manage' . $screen->id . 'columnshidden' ); 220 256 } 221 257 … … 296 332 $wp_list_table = get_list_table('comments'); 297 333 298 $columns = $wp_list_table->get_column_headers();299 $hidden = array_intersect( array_keys( $columns ), array_filter( $ wp_list_table->get_hidden_columns()) );334 list ( $columns, $hidden ) = $wp_list_table->get_column_info(); 335 $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) ); 300 336 $col_count = count($columns) - count($hidden); 301 337 … … 1284 1320 } 1285 1321 echo $output; 1286 }1287 1288 /**1289 * {@internal Missing Short Description}}1290 *1291 * @since unknown1292 *1293 * @param unknown_type $page1294 */1295 function manage_columns_prefs( $page ) {1296 global $wp_list_table;1297 1298 list( $columns, $hidden ) = $wp_list_table->get_column_headers();1299 1300 $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username');1301 1302 foreach ( $columns as $column => $title ) {1303 // Can't hide these for they are special1304 if ( in_array( $column, $special ) )1305 continue;1306 if ( empty( $title ) )1307 continue;1308 1309 if ( 'comments' == $column )1310 $title = __( 'Comments' );1311 $id = "$column-hide";1312 echo '<label for="' . $id . '">';1313 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . (! in_array($column, $hidden) ? ' checked="checked"' : '') . ' />';1314 echo "$title</label>\n";1315 }1316 1322 } 1317 1323 … … 1635 1641 $screen = convert_to_screen($screen); 1636 1642 1637 if ( is_a($wp_list_table, 'WP_List_Table') ) 1638 list( $screen_columns ) = $wp_list_table->get_column_headers(); 1643 $columns = get_column_headers( $screen ); 1644 $hidden = get_hidden_columns( $screen ); 1645 1639 1646 $meta_screens = array('index' => 'dashboard'); 1640 1647 … … 1645 1652 1646 1653 $show_screen = false; 1647 if ( !empty($wp_meta_boxes[$screen->id]) || !empty($ screen_columns) )1654 if ( !empty($wp_meta_boxes[$screen->id]) || !empty($columns) ) 1648 1655 $show_screen = true; 1649 1656 … … 1678 1685 </div> 1679 1686 <?php endif; 1680 if ( ! empty($ screen_columns) ) : ?>1681 <h5><?php echo ( isset( $ screen_columns['_title'] ) ? $screen_columns['_title'] : _x('Show on screen', 'Columns') ) ?></h5>1687 if ( ! empty($columns) ) : ?> 1688 <h5><?php echo ( isset( $columns['_title'] ) ? $columns['_title'] : _x('Show on screen', 'Columns') ) ?></h5> 1682 1689 <div class="metabox-prefs"> 1683 <?php manage_columns_prefs($screen); ?> 1690 <?php 1691 $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username'); 1692 1693 foreach ( $columns as $column => $title ) { 1694 // Can't hide these for they are special 1695 if ( in_array( $column, $special ) ) 1696 continue; 1697 if ( empty( $title ) ) 1698 continue; 1699 1700 if ( 'comments' == $column ) 1701 $title = __( 'Comments' ); 1702 $id = "$column-hide"; 1703 echo '<label for="' . $id . '">'; 1704 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />'; 1705 echo "$title</label>\n"; 1706 } 1707 ?> 1684 1708 <br class="clear" /> 1685 1709 </div>
Note: See TracChangeset
for help on using the changeset viewer.