Files
wp-multisite-waas/inc/admin-pages/class-rollback-admin-page.php
2024-11-30 18:24:12 -07:00

171 lines
3.4 KiB
PHP

<?php
/**
* WP Ultimo Rollback Admin Page.
*
* @package WP_Ultimo
* @subpackage Admin_Pages
* @since 2.0.0
*/
namespace WP_Ultimo\Admin_Pages;
// Exit if accessed directly
defined('ABSPATH') || exit;
/**
* WP Ultimo Rollback Admin Page.
*/
class Rollback_Admin_Page extends Base_Admin_Page {
/**
* Holds the ID for this page, this is also used as the page slug.
*
* @var string
*/
protected $id = 'wp-ultimo-rollback';
/**
* Is this a top-level menu or a submenu?
*
* @since 1.8.2
* @var string
*/
protected $type = 'submenu';
/**
* Is this a top-level menu or a submenu?
*
* @since 1.8.2
* @var string
*/
protected $parent = 'none';
/**
* This page has no parent, so we need to highlight another sub-menu.
*
* @since 2.0.0
* @var string
*/
protected $highlight_menu_slug = 'wp-ultimo-settings';
/**
* Should we hide admin notices on this page?
*
* @since 2.0.0
* @var boolean
*/
protected $hide_admin_notices = true;
/**
* Should we force the admin menu into a folded state?
*
* @since 2.0.0
* @var boolean
*/
protected $fold_menu = false;
/**
* Holds the admin panels where this page should be displayed, as well as which capability to require.
*
* To add a page to the regular admin (wp-admin/), use: 'admin_menu' => 'capability_here'
* To add a page to the network admin (wp-admin/network), use: 'network_admin_menu' => 'capability_here'
* To add a page to the user (wp-admin/user) admin, use: 'user_admin_menu' => 'capability_here'
*
* @since 2.0.0
* @var array
*/
protected $supported_panels = array(
'network_admin_menu' => 'manage_network',
);
/**
* Creates the page with the necessary hooks.
*
* @since 1.8.2
*/
public function __construct() {
if (WP_Ultimo()->is_loaded() === false) {
$this->highlight_menu_slug = 'wp-ultimo-setup';
} // end if;
parent::__construct();
} // end __construct;
/**
* Returns the title of the page.
*
* @since 2.0.0
* @return string Title of the page.
*/
public function get_title() {
return __('Rollback', 'wp-ultimo');
} // end get_title;
/**
* Returns the title of menu for this page.
*
* @since 2.0.0
* @return string Menu label of the page.
*/
public function get_menu_title() {
return __('Rollback', 'wp-ultimo');
} // end get_menu_title;
/**
* Allows admins to rename the sub-menu (first item) for a top-level page.
*
* @since 2.0.0
* @return string False to use the title menu or string with sub-menu title.
*/
public function get_submenu_title() {
return __('Rollback', 'wp-ultimo');
} // end get_submenu_title;
/**
* Registers the necessary scripts.
*
* @since 2.0.0
* @return void
*/
public function register_scripts() {
/*
* If Ultimo is not yet loaded, we need to register vue.
*/
if (WP_Ultimo()->is_loaded() === false) {
wp_register_script('wu-vue', wu_get_asset('lib/vue.js', 'js'), false, wu_get_version());
} // end if;
wp_enqueue_script('wu-vue');
} // end register_scripts;
/**
* Every child class should implement the output method to display the contents of the page.
*
* @since 1.8.2
* @return void
*/
public function output() {
wu_get_template('rollback/rollback', array(
'n' => \WP_Ultimo\License::get_instance()->get_license_key(),
'versions' => \WP_Ultimo\Rollback\Rollback::get_instance()->get_available_versions(),
'page' => $this,
));
} // end output;
} // end class Rollback_Admin_Page;