| Server IP : 192.241.186.36 / Your IP : 216.73.216.199 Web Server : Apache/2.4.29 (Ubuntu) System : Linux webserver7 4.15.0-194-generic #205-Ubuntu SMP Fri Sep 16 19:49:27 UTC 2022 x86_64 User : root ( 0) PHP Version : 7.4.32 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/adsonicdigital/wp-content/plugins/seo-by-rank-math/includes/module/ |
Upload File : |
<?php
/**
* The Module Base Class
*
* ALl the classes inherit from this class
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Module
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Module;
use RankMath\Traits\Hooker;
defined( 'ABSPATH' ) || exit;
/**
* Base class.
*/
class Base {
use Hooker;
/**
* Module ID.
*
* @var string
*/
public $id = '';
/**
* Module directory.
*
* @var string
*/
public $directory = '';
/**
* Module help.
*
* @var array
*/
public $help = [];
/**
* Page object.
*
* @var object
*/
public $page;
/**
* List table object.
*
* @var object
*/
public $table;
/**
* Screen.
*
* @var string
*/
public static $screen = '';
/**
* Screen options.
*
* @var array
*/
public $screen_options = [];
/**
* Admin object.
*
* @var Admin
*/
public $admin;
/**
* The Constructor.
*/
public function __construct() {
$this->register_admin_page();
if ( ! empty( $this->page ) && $this->page->is_current_page() ) {
// Store the current screen ID.
self::$screen = $this->page->parent . '_page_' . $this->page->id;
// Register screen options.
$this->register_screen_options();
// Register the table if it exists.
if ( isset( $this->table ) ) {
$this->action( 'admin_init', 'admin_init' );
}
}
}
/**
* Get the current screen.
*/
public static function get_screen() {
return self::$screen;
}
/**
* Register admin page.
*/
public function register_admin_page() {}
/**
* Admin initialize.
*/
public function admin_init() {
$this->table = new $this->table();
}
/**
* Register screen options.
*/
private function register_screen_options() {
if ( ! isset( $this->screen_options ) ) {
return;
}
$this->action( 'current_screen', 'add_screen_options' );
$this->filter( 'set-screen-option', 'set_screen_options', 10, 3 );
}
/**
* Add screen options.
*/
public function add_screen_options() {
if ( ! isset( $this->screen_options['id'] ) ) {
return;
}
add_screen_option(
'per_page',
[
'option' => $this->screen_options['id'],
'default' => $this->screen_options['default'],
'label' => esc_html__( 'Items per page', 'rank-math' ),
]
);
}
/**
* Set screen options.
*
* @param bool|int $status Screen option value. Default false to skip.
* @param string $option The option name.
* @param int $value The number of rows to use.
*/
public function set_screen_options( $status, $option, $value ) {
return $this->screen_options['id'] === $option ? min( $value, 999 ) : $status;
}
}