Changeset 15653 for trunk/wp-admin/includes/template.php
- Timestamp:
- 09/24/2010 01:35:06 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.