X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8f374b7233bc2815ccc387e448d208c5434eb961..42aebe6945a3a60c8f73853bea2c8b202d64a20b:/wp-admin/includes/class-wp-list-table.php
diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php
index 6de7abf5..bab488ec 100644
--- a/wp-admin/includes/class-wp-list-table.php
+++ b/wp-admin/includes/class-wp-list-table.php
@@ -72,7 +72,7 @@ class WP_List_Table {
var $_pagination;
/**
- * Constructor. The child class should call this constructor from it's own constructor
+ * Constructor. The child class should call this constructor from its own constructor
*
* @param array $args An associative array with information about the current table
* @access protected
@@ -81,15 +81,16 @@ class WP_List_Table {
$args = wp_parse_args( $args, array(
'plural' => '',
'singular' => '',
- 'ajax' => false
+ 'ajax' => false,
+ 'screen' => null,
) );
- $screen = get_current_screen();
+ $this->screen = convert_to_screen( $args['screen'] );
- add_filter( "manage_{$screen->id}_columns", array( &$this, 'get_columns' ), 0 );
+ add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
if ( !$args['plural'] )
- $args['plural'] = $screen->base;
+ $args['plural'] = $this->screen->base;
$args['plural'] = sanitize_key( $args['plural'] );
$args['singular'] = sanitize_key( $args['singular'] );
@@ -98,7 +99,7 @@ class WP_List_Table {
if ( $args['ajax'] ) {
// wp_enqueue_script( 'list-table' );
- add_action( 'admin_footer', array( &$this, '_js_vars' ) );
+ add_action( 'admin_footer', array( $this, '_js_vars' ) );
}
}
@@ -209,6 +210,10 @@ class WP_List_Table {
echo '';
if ( ! empty( $_REQUEST['order'] ) )
echo '';
+ if ( ! empty( $_REQUEST['post_mime_type'] ) )
+ echo '';
+ if ( ! empty( $_REQUEST['detached'] ) )
+ echo '';
?>
@@ -238,10 +243,8 @@ class WP_List_Table {
* @access public
*/
function views() {
- $screen = get_current_screen();
-
$views = $this->get_views();
- $views = apply_filters( 'views_' . $screen->id, $views );
+ $views = apply_filters( 'views_' . $this->screen->id, $views );
if ( empty( $views ) )
return;
@@ -274,12 +277,10 @@ class WP_List_Table {
* @access public
*/
function bulk_actions() {
- $screen = get_current_screen();
-
if ( is_null( $this->_actions ) ) {
$no_new_actions = $this->_actions = $this->get_bulk_actions();
// This filter can currently only be used to remove actions.
- $this->_actions = apply_filters( 'bulk_actions-' . $screen->id, $this->_actions );
+ $this->_actions = apply_filters( 'bulk_actions-' . $this->screen->id, $this->_actions );
$this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
$two = '';
} else {
@@ -300,7 +301,7 @@ class WP_List_Table {
echo "\n";
- submit_button( __( 'Apply' ), 'button-secondary action', false, false, array( 'id' => "doaction$two" ) );
+ submit_button( __( 'Apply' ), 'action', false, false, array( 'id' => "doaction$two" ) );
echo "\n";
}
@@ -339,7 +340,7 @@ class WP_List_Table {
if ( !$action_count )
return '';
- $out = '
';
+ $out = '
';
foreach ( $actions as $action => $link ) {
++$i;
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
@@ -366,6 +367,16 @@ class WP_List_Table {
ORDER BY post_date DESC
", $post_type ) );
+ /**
+ * Filter the months dropdown results.
+ *
+ * @since 3.7.0
+ *
+ * @param object $months The months dropdown query results.
+ * @param string $post_type The post type.
+ */
+ $months = apply_filters( 'months_dropdown_results', $months, $post_type );
+
$month_count = count( $months );
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
@@ -490,7 +501,7 @@ class WP_List_Table {
$current = $this->get_pagenum();
- $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
@@ -600,12 +611,10 @@ class WP_List_Table {
if ( isset( $this->_column_headers ) )
return $this->_column_headers;
- $screen = get_current_screen();
-
- $columns = get_column_headers( $screen );
- $hidden = get_hidden_columns( $screen );
+ $columns = get_column_headers( $this->screen );
+ $hidden = get_hidden_columns( $this->screen );
- $_sortable = apply_filters( "manage_{$screen->id}_sortable_columns", $this->get_sortable_columns() );
+ $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $this->get_sortable_columns() );
$sortable = array();
foreach ( $_sortable as $id => $data ) {
@@ -647,11 +656,9 @@ class WP_List_Table {
* @param bool $with_id Whether to set the id attribute or not
*/
function print_column_headers( $with_id = true ) {
- $screen = get_current_screen();
-
list( $columns, $hidden, $sortable ) = $this->get_column_info();
- $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( 'paged', $current_url );
if ( isset( $_GET['orderby'] ) )
@@ -664,6 +671,13 @@ class WP_List_Table {
else
$current_order = 'asc';
+ if ( ! empty( $columns['cb'] ) ) {
+ static $cb_counter = 1;
+ $columns['cb'] = '
'
+ . '
';
+ $cb_counter++;
+ }
+
foreach ( $columns as $column_key => $column_display_name ) {
$class = array( 'manage-column', "column-$column_key" );
@@ -728,7 +742,7 @@ class WP_List_Table {
-
>
+ >
display_rows_or_placeholder(); ?>
@@ -760,8 +774,8 @@ class WP_List_Table {
?>
-
- bulk_actions( $which ); ?>
+
+ bulk_actions(); ?>
extra_tablenav( $which );
@@ -822,7 +836,7 @@ class WP_List_Table {
$row_class = ( $row_class == '' ? ' class="alternate"' : '' );
echo '
';
- echo $this->single_row_columns( $item );
+ $this->single_row_columns( $item );
echo '
';
}
@@ -853,7 +867,7 @@ class WP_List_Table {
}
elseif ( method_exists( $this, 'column_' . $column_name ) ) {
echo "
";
- echo call_user_func( array( &$this, 'column_' . $column_name ), $item );
+ echo call_user_func( array( $this, 'column_' . $column_name ), $item );
echo " | ";
}
else {
@@ -903,13 +917,11 @@ class WP_List_Table {
* @access private
*/
function _js_vars() {
- $current_screen = get_current_screen();
-
$args = array(
'class' => get_class( $this ),
'screen' => array(
- 'id' => $current_screen->id,
- 'base' => $current_screen->base,
+ 'id' => $this->screen->id,
+ 'base' => $this->screen->base,
)
);