Make WordPress Core


Ignore:
Timestamp:
11/01/2010 08:56:27 AM (13 years ago)
Author:
westi
Message:

Split out the list table functions into a seperate file from the base class.
See #14579.

File:
1 edited

Legend:

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

    r16125 r16127  
    11<?php
    22/**
    3  * Base class and helper functions for displaying a list of items in an ajaxified HTML table.
     3 * Base class for displaying a list of items in an ajaxified HTML table.
    44 *
    55 * @package WordPress
     
    817817    }
    818818}
    819 
    820 /**
    821  * Fetch an instance of a WP_List_Table class.
    822  *
    823  * @since 3.1.0
    824  *
    825  * @param string $class The type of the list table, which is the class name except for core list tables.
    826  * @return object|bool Object on success, false if the class does not exist.
    827  */
    828 function get_list_table( $class ) {
    829     $class = apply_filters( "get_list_table_$class", $class );
    830 
    831     require_list_table( $class );
    832 
    833     if ( class_exists( $class ) )
    834         return new $class;
    835     return false;
    836 }
    837 
    838 /**
    839  * Include the proper file for a core list table.
    840  *
    841  * Useful for extending a core class that would not otherwise be required.
    842  *
    843  * @since 3.1.0
    844  *
    845  * @param string $table The core table to include.
    846  * @return bool True on success, false on failure.
    847  */
    848 function require_list_table( $class ) {
    849     $core_classes = array(
    850         'WP_Posts_Table' => 'posts',
    851         'WP_Media_Table' => 'media',
    852         'WP_Terms_Table' => 'terms',
    853         'WP_Users_Table' => 'users',
    854         'WP_Comments_Table' => 'comments',
    855         'WP_Post_Comments_Table' => 'comments',
    856         'WP_Links_Table' => 'links',
    857         'WP_Sites_Table' => 'sites',
    858         'WP_MS_Users_Table' => 'ms-users',
    859         'WP_Plugins_Table' => 'plugins',
    860         'WP_Plugin_Install_Table' => 'plugin-install',
    861         'WP_Themes_Table' => 'themes',
    862         'WP_Theme_Install_Table' => 'theme-install',
    863         'WP_MS_Themes_Table' => 'ms-themes',
    864     );
    865 
    866     if ( isset( $core_classes[ $class ] ) ) {
    867         require_once( ABSPATH . '/wp-admin/includes/list-table-' . $core_classes[ $class ] . '.php' );
    868         return true;
    869     }
    870     return false;
    871 }
    872 
    873819?>
Note: See TracChangeset for help on using the changeset viewer.