Make deprecated functions work. See #14651

git-svn-id: http://svn.automattic.com/wordpress/trunk@15517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-08-21 18:08:42 +00:00
parent 1ea0bc3486
commit 65206ec0d7
4 changed files with 73 additions and 7 deletions

View File

@ -39,6 +39,9 @@ require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
/** WordPress Template Administration API */
require_once(ABSPATH . 'wp-admin/includes/template.php');
/** WordPress List Table Administration API */
require_once(ABSPATH . 'wp-admin/includes/list-table.php');
/** WordPress Theme Administration API */
require_once(ABSPATH . 'wp-admin/includes/theme.php');

View File

@ -1,7 +1,5 @@
<?php
require_once('list-table.php');
/**
* List table classes
*

View File

@ -203,9 +203,42 @@ function use_codepress() {
* @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() {
function register_column_headers($screen, $columns) {
_deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
global $_wp_column_headers;
if ( is_string($screen) )
$screen = convert_to_screen($screen);
if ( !isset($_wp_column_headers) )
$_wp_column_headers = array();
$_wp_column_headers[$screen->id] = $columns;
}
/**
* Get the column headers for a screen
*
* @since 2.7.0
* @deprecated 3.1.0
* @deprecated Use WP_List_Table
*
* @param string|object $screen The screen you want the headers for
* @return array Containing the headers in the format id => UI String
*/
function get_column_headers($screen) {
_deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
$table = new _WP_List_Table_Compat($screen);
list( $columns ) = $table->get_column_headers();
return $columns;
}
/**
@ -215,19 +248,49 @@ function register_column_headers() {
* @deprecated 3.1.0
* @deprecated Use WP_List_Table
*/
function print_column_headers() {
function print_column_headers($screen, $id = true) {
_deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
$table = new _WP_List_Table_Compat($screen);
$table->print_column_headers($id);
}
/**
* Gets hidden column names for a particular screen.
*
* @since unknown
* @since 2.7.0
* @deprecated 3.1.0
* @deprecated Use WP_List_Table
*
* @param string $screen
* @return array
*/
function get_hidden_columns() {
function get_hidden_columns($screen) {
_deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
return array();
$table = new _WP_List_Table_Compat($screen);
return $table->get_hidden_columns();
}
// Helper class to be used only by deprecated functions
class _WP_List_Table_Compat extends WP_List_Table {
function _WP_List_Table_Compat( $screen) {
parent::WP_List_Table( array(
'screen' => $screen,
'ajax' => false
) );
}
function get_columns() {
global $_wp_column_headers;
if ( isset($_wp_column_headers[$this->_screen->id]) )
return $_wp_column_headers[$this->_screen->id];
return array();
}
}

View File

@ -458,6 +458,8 @@ class WP_List_Table {
*
* @since 3.1.0
* @access protected
*
* @param bool $with_id Wether to set the id attribute or not
*/
function print_column_headers( $with_id = true ) {
$screen = $this->_screen;