The old methods are good enough in alot of cases where plugins want to extend simply. So un deprecate for now.

git-svn-id: http://svn.automattic.com/wordpress/trunk@17293 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2011-01-13 23:19:51 +00:00
parent ce0ebf0c95
commit 93465db918
3 changed files with 59 additions and 69 deletions

View File

@ -40,8 +40,8 @@ require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
require_once(ABSPATH . 'wp-admin/includes/template.php');
/** WordPress List Table Administration API and base class */
require_once(ABSPATH . 'wp-admin/includes/list-table.php');
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
require_once(ABSPATH . 'wp-admin/includes/list-table.php');
/** WordPress Theme Administration API */
require_once(ABSPATH . 'wp-admin/includes/theme.php');

View File

@ -688,70 +688,3 @@ function get_others_pending($user_id) {
return get_others_unpublished_posts($user_id, 'pending');
}
/**
* Register column headers for a particular screen.
*
* @since 2.7.0
* @deprecated 3.1.0
* @deprecated Use WP_List_Table
*
* @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
* @param array $columns An array of columns with column IDs as the keys and translated column names as the values
* @see get_column_headers(), print_column_headers(), get_hidden_columns()
*/
function register_column_headers($screen, $columns) {
_deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
$wp_list_table = new _WP_List_Table_Compat($screen, $columns);
}
/**
* Prints column headers for a particular screen.
*
* @since 2.7.0
* @deprecated 3.1.0
* @deprecated Use WP_List_Table
*/
function print_column_headers($screen, $id = true) {
_deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
$wp_list_table = new _WP_List_Table_Compat($screen);
$wp_list_table->print_column_headers($id);
}
/**
* Helper class to be used only by deprecated functions
*
* @since 3.1.0
*/
class _WP_List_Table_Compat extends WP_List_Table {
var $_screen;
var $_columns;
function _WP_List_Table_Compat( $screen, $columns = array() ) {
if ( is_string( $screen ) )
$screen = convert_to_screen( $screen );
$this->_screen = $screen;
if ( !empty( $columns ) ) {
$this->_columns = $columns;
add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 );
}
}
function get_column_info() {
$columns = get_column_headers( $this->_screen );
$hidden = get_hidden_columns( $this->_screen );
$sortable = array();
return array( $columns, $hidden, $sortable );
}
function get_columns() {
return $this->_columns;
}
}

View File

@ -63,4 +63,61 @@ function require_list_table( $class ) {
return false;
}
?>
/**
* Register column headers for a particular screen.
*
* @since 2.7.0
*
* @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
* @param array $columns An array of columns with column IDs as the keys and translated column names as the values
* @see get_column_headers(), print_column_headers(), get_hidden_columns()
*/
function register_column_headers($screen, $columns) {
$wp_list_table = new _WP_List_Table_Compat($screen, $columns);
}
/**
* Prints column headers for a particular screen.
*
* @since 2.7.0
*/
function print_column_headers($screen, $id = true) {
$wp_list_table = new _WP_List_Table_Compat($screen);
$wp_list_table->print_column_headers($id);
}
/**
* Helper class to be used only by back compat functions
*
* @since 3.1.0
*/
class _WP_List_Table_Compat extends WP_List_Table {
var $_screen;
var $_columns;
function _WP_List_Table_Compat( $screen, $columns = array() ) {
if ( is_string( $screen ) )
$screen = convert_to_screen( $screen );
$this->_screen = $screen;
if ( !empty( $columns ) ) {
$this->_columns = $columns;
add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 );
}
}
function get_column_info() {
$columns = get_column_headers( $this->_screen );
$hidden = get_hidden_columns( $this->_screen );
$sortable = array();
return array( $columns, $hidden, $sortable );
}
function get_columns() {
return $this->_columns;
}
}
?>