You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
1.7 KiB
PHP
80 lines
1.7 KiB
PHP
<?php
|
|
/**
|
|
* The List Table Base CLass.
|
|
*
|
|
* @since 1.0.0
|
|
* @package RankMath
|
|
* @subpackage RankMath\Admin
|
|
* @author RankMath <support@rankmath.com>
|
|
*/
|
|
|
|
namespace RankMath\Admin;
|
|
|
|
use WP_List_Table;
|
|
use RankMath\Helpers\Param;
|
|
|
|
/**
|
|
* List_Table class.
|
|
*/
|
|
class List_Table extends WP_List_Table {
|
|
|
|
/**
|
|
* The Constructor.
|
|
*
|
|
* @param array $args Array of arguments.
|
|
*/
|
|
public function __construct( $args = [] ) {
|
|
parent::__construct( $args );
|
|
}
|
|
|
|
/**
|
|
* Message to be displayed when there are no items.
|
|
*/
|
|
public function no_items() {
|
|
echo isset( $this->_args['no_items'] ) ? $this->_args['no_items'] : esc_html__( 'No items found.', 'rank-math' );
|
|
}
|
|
|
|
/**
|
|
* Get order setting.
|
|
*
|
|
* @return string
|
|
*/
|
|
protected function get_order() {
|
|
$order = Param::request( 'order', 'desc' );
|
|
return in_array( $order, [ 'desc', 'asc' ], true ) ? strtoupper( $order ) : 'DESC';
|
|
}
|
|
|
|
/**
|
|
* Get orderby setting.
|
|
*
|
|
* @param string $default (Optional) Extract order by from request.
|
|
*
|
|
* @return string
|
|
*/
|
|
protected function get_orderby( $default = 'create_date' ) {
|
|
return Param::get( 'orderby', $default, FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_BACKTICK );
|
|
}
|
|
|
|
/**
|
|
* Get search query variable.
|
|
*
|
|
* @return bool|string
|
|
*/
|
|
protected function get_search() {
|
|
return Param::request( 's', false, FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_BACKTICK );
|
|
}
|
|
|
|
/**
|
|
* Set column headers.
|
|
*
|
|
* @codeCoverageIgnore
|
|
*/
|
|
protected function set_column_headers() {
|
|
$this->_column_headers = [
|
|
$this->get_columns(),
|
|
[],
|
|
$this->get_sortable_columns(),
|
|
];
|
|
}
|
|
}
|