equal
deleted
inserted
replaced
13 * @access private |
13 * @access private |
14 * @since 3.1.0 |
14 * @since 3.1.0 |
15 * |
15 * |
16 * @global string $hook_suffix |
16 * @global string $hook_suffix |
17 * |
17 * |
18 * @param string $class The type of the list table, which is the class name. |
18 * @param string $class_name The type of the list table, which is the class name. |
19 * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'. |
19 * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'. |
20 * @return WP_List_Table|false List table object on success, false if the class does not exist. |
20 * @return WP_List_Table|false List table object on success, false if the class does not exist. |
21 */ |
21 */ |
22 function _get_list_table( $class, $args = array() ) { |
22 function _get_list_table( $class_name, $args = array() ) { |
23 $core_classes = array( |
23 $core_classes = array( |
24 // Site Admin. |
24 // Site Admin. |
25 'WP_Posts_List_Table' => 'posts', |
25 'WP_Posts_List_Table' => 'posts', |
26 'WP_Media_List_Table' => 'media', |
26 'WP_Media_List_Table' => 'media', |
27 'WP_Terms_List_Table' => 'terms', |
27 'WP_Terms_List_Table' => 'terms', |
43 // Privacy requests tables. |
43 // Privacy requests tables. |
44 'WP_Privacy_Data_Export_Requests_List_Table' => 'privacy-data-export-requests', |
44 'WP_Privacy_Data_Export_Requests_List_Table' => 'privacy-data-export-requests', |
45 'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests', |
45 'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests', |
46 ); |
46 ); |
47 |
47 |
48 if ( isset( $core_classes[ $class ] ) ) { |
48 if ( isset( $core_classes[ $class_name ] ) ) { |
49 foreach ( (array) $core_classes[ $class ] as $required ) { |
49 foreach ( (array) $core_classes[ $class_name ] as $required ) { |
50 require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php'; |
50 require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php'; |
51 } |
51 } |
52 |
52 |
53 if ( isset( $args['screen'] ) ) { |
53 if ( isset( $args['screen'] ) ) { |
54 $args['screen'] = convert_to_screen( $args['screen'] ); |
54 $args['screen'] = convert_to_screen( $args['screen'] ); |
56 $args['screen'] = get_current_screen(); |
56 $args['screen'] = get_current_screen(); |
57 } else { |
57 } else { |
58 $args['screen'] = null; |
58 $args['screen'] = null; |
59 } |
59 } |
60 |
60 |
61 return new $class( $args ); |
61 return new $class_name( $args ); |
62 } |
62 } |
63 |
63 |
64 return false; |
64 return false; |
65 } |
65 } |
66 |
66 |