WordPress.org

Make WordPress Core

Changeset 15517


Ignore:
Timestamp:
08/21/2010 06:08:42 PM (11 years ago)
Author:
scribu
Message:

Make deprecated functions work. See #14651

Location:
trunk/wp-admin/includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/admin.php

    r12824 r15517  
    4040require_once(ABSPATH . 'wp-admin/includes/template.php');
    4141
     42/** WordPress List Table Administration API */
     43require_once(ABSPATH . 'wp-admin/includes/list-table.php');
     44
    4245/** WordPress Theme Administration API */
    4346require_once(ABSPATH . 'wp-admin/includes/theme.php');
  • trunk/wp-admin/includes/default-list-tables.php

    r15513 r15517  
    11<?php
    2 
    3 require_once('list-table.php');
    42
    53/**
  • trunk/wp-admin/includes/deprecated.php

    r15515 r15517  
    204204 * @deprecated 3.1.0
    205205 * @deprecated Use WP_List_Table
    206  */
    207 function register_column_headers() {
    208     _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
     206 *
     207 * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
     208 * @param array $columns An array of columns with column IDs as the keys and translated column names as the values
     209 * @see get_column_headers(), print_column_headers(), get_hidden_columns()
     210 */
     211function register_column_headers($screen, $columns) {
     212    _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
     213
     214    global $_wp_column_headers;
     215
     216    if ( is_string($screen) )
     217        $screen = convert_to_screen($screen);
     218
     219    if ( !isset($_wp_column_headers) )
     220        $_wp_column_headers = array();
     221
     222    $_wp_column_headers[$screen->id] = $columns;
     223}
     224
     225/**
     226 * Get the column headers for a screen
     227 *
     228 * @since 2.7.0
     229 * @deprecated 3.1.0
     230 * @deprecated Use WP_List_Table
     231 *
     232 * @param string|object $screen The screen you want the headers for
     233 * @return array Containing the headers in the format id => UI String
     234 */
     235function get_column_headers($screen) {
     236    _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
     237
     238    $table = new _WP_List_Table_Compat($screen);
     239    list( $columns ) = $table->get_column_headers();
     240
     241    return $columns;
    209242}
    210243
     
    216249 * @deprecated Use WP_List_Table
    217250 */
    218 function print_column_headers() {
    219     _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
     251function print_column_headers($screen, $id = true) {
     252    _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
     253
     254    $table = new _WP_List_Table_Compat($screen);
     255
     256    $table->print_column_headers($id);
    220257}
    221258
     
    223260 * Gets hidden column names for a particular screen.
    224261 *
    225  * @since unknown
    226  * @deprecated 3.1.0
    227  * @deprecated Use WP_List_Table
    228  */
    229 function get_hidden_columns() {
    230     _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
    231     return array();
    232 }
    233 
     262 * @since 2.7.0
     263 * @deprecated 3.1.0
     264 * @deprecated Use WP_List_Table
     265 *
     266 * @param string $screen
     267 * @return array
     268 */
     269function get_hidden_columns($screen) {
     270    _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
     271
     272    $table = new _WP_List_Table_Compat($screen);
     273
     274    return $table->get_hidden_columns();
     275}
     276
     277// Helper class to be used only by deprecated functions
     278class _WP_List_Table_Compat extends WP_List_Table {
     279
     280    function _WP_List_Table_Compat( $screen) {
     281        parent::WP_List_Table( array(
     282            'screen' => $screen,
     283            'ajax' => false
     284        ) );
     285    }
     286
     287    function get_columns() {
     288        global $_wp_column_headers;
     289
     290        if ( isset($_wp_column_headers[$this->_screen->id]) )
     291            return $_wp_column_headers[$this->_screen->id];
     292
     293        return array();
     294    }
     295}
     296
  • trunk/wp-admin/includes/list-table.php

    r15516 r15517  
    459459     * @since 3.1.0
    460460     * @access protected
     461     *
     462     * @param bool $with_id Wether to set the id attribute or not
    461463     */
    462464    function print_column_headers( $with_id = true ) {
Note: See TracChangeset for help on using the changeset viewer.