Column headers revamp:

* undeprecate get_column_headers()
	* undeprecate get_hidden_columns()
	* in WP_List_Table, rename get_column_headers() to get_column_info()
	* remove $taxonomy argument from single_row()
	* merge manage_columns_prefs() into screen_meta()
Fixes #14952. Fixes #14776.


git-svn-id: http://svn.automattic.com/wordpress/trunk@15653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu
2010-09-24 13:35:06 +00:00
parent 6dd01bf248
commit 248b086540
4 changed files with 80 additions and 105 deletions

View File

@@ -69,6 +69,9 @@ class WP_List_Table {
* @access protected
*/
function WP_List_Table( $args ) {
global $_wp_column_headers;
$_wp_column_headers = $this->get_columns();
$args = wp_parse_args( $args, array(
'screen' => '',
@@ -82,6 +85,8 @@ class WP_List_Table {
if ( is_string( $this->_screen ) )
$this->_screen = convert_to_screen( $this->_screen );
add_filter( 'manage_' . $this->_screen->id . '_columns', array( $this, 'get_columns' ) );
if ( !$args['plural'] )
$args['plural'] = $this->_screen->base;
@@ -513,18 +518,6 @@ class WP_List_Table {
return array();
}
/**
* Get a list of hidden columns.
*
* @since 3.1.0
* @access private
*
* @return array
*/
function get_hidden_columns() {
return (array) get_user_option( 'manage' . $this->_screen->id. 'columnshidden' );
}
/**
* Get a list of all, hidden and sortable columns, with filter applied
*
@@ -533,11 +526,11 @@ class WP_List_Table {
*
* @return array
*/
function get_column_headers() {
function get_column_info() {
if ( !isset( $this->_column_headers ) ) {
$columns = apply_filters( 'manage_' . $this->_screen->id . '_columns', $this->get_columns() );
$columns = get_column_headers( $this->_screen );
$hidden = get_hidden_columns( $this->_screen );
$sortable = apply_filters( 'manage_' . $this->_screen->id . '_sortable_columns', $this->get_sortable_columns() );
$hidden = $this->get_hidden_columns();
$this->_column_headers = array( $columns, $hidden, $sortable );
}
@@ -556,7 +549,7 @@ class WP_List_Table {
function print_column_headers( $with_id = true ) {
$screen = $this->_screen;
list( $columns, $hidden, $sortable ) = $this->get_column_headers();
list( $columns, $hidden, $sortable ) = $this->get_column_info();
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
@@ -746,7 +739,7 @@ class WP_List_Table {
* @param $object $item The current item
*/
function single_row_columns( $item ) {
list( $columns, $hidden ) = $this->get_column_headers();
list( $columns, $hidden ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) {
$class = "class=\"$column_name column-$column_name\"";