%PDF- %PDF-
| Direktori : /dom405686/wp-content/plugins/pws-core/public/ |
| Current File : //dom405686/wp-content/plugins/pws-core/public/class-GD-cORe-public.php |
<?php
/**
* The public-facing functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the public-facing stylesheet and JavaScript.
*
* @package GD_cORe
* @subpackage GD_cORe/public
*/
class GD_cORe_Public {
/**
* 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 the 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 public-facing side of the site.
*
* @since 3.0.0
*/
public function enqueue_styles() {
/**
* 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_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/GD-cORe-public.css', array(), $this->version, 'all' );
}
/**
* Register the JavaScript for the public-facing side of the site.
*
* @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-public.js', array( 'jquery' ), $this->version, false );
}
/**
* Add an admin menu item to top bar
*
* @since 1.0.0
*/
public function gd_core_Dropdown() {
global $wp_admin_bar, $wpdb;
if ( !is_super_admin() || !is_admin_bar_showing() )
return;
/* Add the main siteadmin menu item */
$wp_admin_bar->add_menu( array( 'id' => 'core_settings', 'title' => __( 'GD cORe', 'textdomain' ), 'href' => '/wp-admin/admin.php?page=gd-core' ) );
$wp_admin_bar->add_menu( array( 'id' => 'core_settings_1', 'parent' => 'core_settings', 'title' => 'Clear Site Cache', 'href' => '#' ) );
$wp_admin_bar->add_menu( array( 'id' => 'core_settings_3', 'parent' => 'core_settings', 'title' => 'Plugins', 'href' => '/wp-admin/admin.php?page=gd-core-plugins' ) );
$wp_admin_bar->add_menu( array( 'id' => 'core_settings_2', 'parent' => 'core_settings', 'title' => 'Themes', 'href' => '/wp-admin/admin.php?page=gd-core-themes' ) );
$wp_admin_bar->add_menu( array( 'id' => 'core_settings_5', 'parent' => 'core_settings', 'title' => 'Site Audit', 'href' => '/wp-admin/admin.php?page=gd-core-audits' ) );
if(class_exists( 'WPaaS\\Cache' )){
$cdn_title_text = "CDN: ";
$cdn_title_text .= \WPaaS\CDN::is_enabled(true) ? 'Enabled' : 'Disabled';
$wp_admin_bar->add_menu( array( 'id' => 'core_settings_6', 'parent' => 'core_settings', 'title' => $cdn_title_text, 'href' => false ) );
}
}
//inits cache clearing scripts for front 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__ ) . '../admin/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' )
));
}
}