%PDF- %PDF-
| Direktori : /dom405686/wp-content/plugins/pws-core/admin/ |
| Current File : /dom405686/wp-content/plugins/pws-core/admin/class-GD-cORe-admin.php |
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The admin-specific functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package GD_cORe
* @subpackage GD_cORe/admin
*/
class GD_cORe_Admin {
/**
* The ID of this plugin.
*
* @since 3.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* The version of this plugin.
*
* @since 3.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @since 3.0.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
$this->plugin_name = $plugin_name;
$this->version = $version;
}
/**
* Register the stylesheets for the admin area.
*
* @since 3.0.0
*/
public function enqueue_styles($hook) {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in GD_cORe_Loader as all of the hooks are defined
* in that particular class.
*
* The GD_cORe_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
if (strpos($hook, 'gd-core') !== false) {
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/GD-cORe-admin.css', array(), $this->version, 'all' );
}
}
/**
* Register the JavaScript for the admin area.
*
* @since 3.0.0
*/
public function enqueue_scripts() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in GD_cORe_Loader as all of the hooks are defined
* in that particular class.
*
* The GD_cORe_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/GD-cORe-admin.js', array( 'jquery' ), $this->version, false );
}
/**
* Add an options page under the Settings submenu
*
* @since 1.0.0
*/
public function add_admin_page() {
$this->plugin_screen_hook_suffix = add_menu_page(
__( 'GD cORe', 'gd-core' ),
__( 'GD cORe', 'gd-core' ),
'manage_options',
$this->plugin_name,
array( $this, 'display_admin_page' )
);
$this->plugin_screen_hook_suffix = add_submenu_page(
'gd-core',
'GD cORe Plugins',
'Plugins',
'manage_options',
'gd-core-plugins',
array( $this, 'display_admin_plugins_page' )
);
$this->plugin_screen_hook_suffix = add_submenu_page(
'gd-core',
'GD cORe Themes',
'Themes',
'manage_options',
'gd-core-themes',
array( $this, 'display_admin_themes_page' )
);
$this->plugin_screen_hook_suffix = add_submenu_page(
'gd-core',
'GD cORe Site Audits',
'Site Audits',
'manage_options',
'gd-core-audits',
array( $this, 'display_admin_audits_page' )
);
}
/**
* Render the Main options page for GD cORe
*
* @since 3.0.0
*/
public function display_admin_page() {
include_once 'partials/GD-cORe-admin-home.php';
}
/**
* Render the Main options page for GD cORe
*
* @since 3.0.0
*/
public function display_admin_plugins_page() {
include_once 'partials/GD-cORe-admin-plugins.php';
}
/**
* Render the Main options page for GD cORe
*
* @since 3.0.0
*/
public function display_admin_themes_page() {
include_once 'partials/GD-cORe-admin-themes.php';
}
/**
* Render the Main options page for GD cORe
*
* @since 3.0.0
*/
public function display_admin_audits_page() {
include_once 'partials/GD-cORe-admin-audits.php';
}
//inits cache clearing scripts for back end
public function core_cache_scripts() {
if ( !is_super_admin() || !is_admin_bar_showing() )
return;
wp_enqueue_script( 'core_cache_control_script', plugin_dir_url( __FILE__ ) . 'js/gdcoreAjax.js', array('jquery'), '1.0.0', true );
wp_localize_script( 'core_cache_control_script', 'core_cache_control', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'security' => wp_create_nonce( 'core_cache_string' )
));
}
//flushes cache
public function core_flush() {
$cache_actions = new GD_cORe\handlers\Cache();
$cache_actions->spendCache(true);
}
}