diff -r c7c34916027a -r 177826044cd9 wp/wp-admin/includes/class-wp-list-table.php
--- a/wp/wp-admin/includes/class-wp-list-table.php Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-admin/includes/class-wp-list-table.php Mon Oct 14 18:28:13 2019 +0200
@@ -91,10 +91,24 @@
*
* @var array
*/
- protected $compat_methods = array( 'set_pagination_args', 'get_views', 'get_bulk_actions', 'bulk_actions',
- 'row_actions', 'months_dropdown', 'view_switcher', 'comments_bubble', 'get_items_per_page', 'pagination',
- 'get_sortable_columns', 'get_column_info', 'get_table_classes', 'display_tablenav', 'extra_tablenav',
- 'single_row_columns' );
+ protected $compat_methods = array(
+ 'set_pagination_args',
+ 'get_views',
+ 'get_bulk_actions',
+ 'bulk_actions',
+ 'row_actions',
+ 'months_dropdown',
+ 'view_switcher',
+ 'comments_bubble',
+ 'get_items_per_page',
+ 'pagination',
+ 'get_sortable_columns',
+ 'get_column_info',
+ 'get_table_classes',
+ 'display_tablenav',
+ 'extra_tablenav',
+ 'single_row_columns',
+ );
/**
* Constructor.
@@ -122,21 +136,25 @@
* }
*/
public function __construct( $args = array() ) {
- $args = wp_parse_args( $args, array(
- 'plural' => '',
- 'singular' => '',
- 'ajax' => false,
- 'screen' => null,
- ) );
+ $args = wp_parse_args(
+ $args,
+ array(
+ 'plural' => '',
+ 'singular' => '',
+ 'ajax' => false,
+ 'screen' => null,
+ )
+ );
$this->screen = convert_to_screen( $args['screen'] );
add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
- if ( !$args['plural'] )
+ if ( ! $args['plural'] ) {
$args['plural'] = $this->screen->base;
+ }
- $args['plural'] = sanitize_key( $args['plural'] );
+ $args['plural'] = sanitize_key( $args['plural'] );
$args['singular'] = sanitize_key( $args['singular'] );
$this->_args = $args;
@@ -149,7 +167,7 @@
if ( empty( $this->modes ) ) {
$this->modes = array(
'list' => __( 'List View' ),
- 'excerpt' => __( 'Excerpt View' )
+ 'excerpt' => __( 'Excerpt View' ),
);
}
}
@@ -215,7 +233,7 @@
*
* @since 4.0.0
*
- * @param callable $name Method to call.
+ * @param string $name Method to call.
* @param array $arguments Arguments to pass when calling.
* @return mixed|bool Return value of the callback, false otherwise.
*/
@@ -238,6 +256,7 @@
/**
* Prepares the list of items for displaying.
+ *
* @uses WP_List_Table::set_pagination_args()
*
* @since 3.1.0
@@ -255,14 +274,18 @@
* @param array|string $args Array or string of arguments with information about the pagination.
*/
protected function set_pagination_args( $args ) {
- $args = wp_parse_args( $args, array(
- 'total_items' => 0,
- 'total_pages' => 0,
- 'per_page' => 0,
- ) );
+ $args = wp_parse_args(
+ $args,
+ array(
+ 'total_items' => 0,
+ 'total_pages' => 0,
+ 'per_page' => 0,
+ )
+ );
- if ( !$args['total_pages'] && $args['per_page'] > 0 )
+ if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
$args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
+ }
// Redirect if page number is invalid and headers are not already sent.
if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
@@ -287,8 +310,8 @@
return $this->get_pagenum();
}
- if ( isset( $this->_pagination_args[$key] ) ) {
- return $this->_pagination_args[$key];
+ if ( isset( $this->_pagination_args[ $key ] ) ) {
+ return $this->_pagination_args[ $key ];
}
}
@@ -300,7 +323,7 @@
* @return bool
*/
public function has_items() {
- return !empty( $this->items );
+ return ! empty( $this->items );
}
/**
@@ -321,26 +344,31 @@
* @param string $input_id ID attribute value for the search input field.
*/
public function search_box( $text, $input_id ) {
- if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
+ if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
return;
+ }
$input_id = $input_id . '-search-input';
- if ( ! empty( $_REQUEST['orderby'] ) )
+ if ( ! empty( $_REQUEST['orderby'] ) ) {
echo '';
- if ( ! empty( $_REQUEST['order'] ) )
+ }
+ if ( ! empty( $_REQUEST['order'] ) ) {
echo '';
- if ( ! empty( $_REQUEST['post_mime_type'] ) )
+ }
+ if ( ! empty( $_REQUEST['post_mime_type'] ) ) {
echo '';
- if ( ! empty( $_REQUEST['detached'] ) )
+ }
+ if ( ! empty( $_REQUEST['detached'] ) ) {
echo '';
-?>
+ }
+ ?>
- 'search-submit' ) ); ?>
+ 'search-submit' ) ); ?>
-screen->id}", $views );
- if ( empty( $views ) )
+ if ( empty( $views ) ) {
return;
+ }
$this->screen->render_screen_reader_content( 'heading_views' );
@@ -384,7 +413,7 @@
$views[ $class ] = "\t$view";
}
echo implode( " |\n", $views ) . "\n";
- echo "";
+ echo '';
}
/**
@@ -420,16 +449,17 @@
*
* @since 3.5.0
*
- * @param array $actions An array of the available bulk actions.
+ * @param string[] $actions An array of the available bulk actions.
*/
$this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
- $two = '';
+ $two = '';
} else {
$two = '2';
}
- if ( empty( $this->_actions ) )
+ if ( empty( $this->_actions ) ) {
return;
+ }
echo '';
echo '