'4052', 'slug' => 'httpswordpressorgpluginsadmin-bar-hide', 'type' => 'plugin', 'public_key' => 'pk_d1ca654078be49c80e83951aee3c8', 'is_premium' => false, 'has_addons' => false, 'has_paid_plans' => false, 'menu' => array( 'first-path' => 'plugins.php', 'account' => false, ), ) ); } return $abh; } // Init Freemius. abh(); // Signal that SDK was initiated. do_action( 'abh_loaded' ); } // don't call the file directly if ( !defined( 'ABSPATH' ) ) exit; /** * Admin_Bar_Hide class * * @class Admin_Bar_Hide The class that holds the entire Admin_Bar_Hide plugin */ class Admin_Bar_Hide { /** * Constructor for the Admin_Bar_Hide class * * Sets up all the appropriate hooks and actions * within our plugin. * * @uses register_activation_hook() * @uses register_deactivation_hook() * @uses is_admin() * @uses add_action() */ public function __construct() { register_activation_hook( __FILE__, array( $this, 'activate' ) ); register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); // Localize our plugin add_action( 'init', array( $this, 'localization_setup' ) ); // Loads frontend scripts and styles add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action('after_setup_theme', array( $this, 'remove_admin_bar' ) ); } /** * Initializes the Admin_Bar_Hide() class * * Checks for an existing Admin_Bar_Hide() instance * and if it doesn't find one, creates it. */ public static function init() { static $instance = false; if ( ! $instance ) { $instance = new Admin_Bar_Hide(); } return $instance; } /** * Placeholder for activation function * * Nothing being called here yet. */ public function activate() { } /** * Placeholder for deactivation function * * Nothing being called here yet. */ public function deactivate() { } /** * Initialize plugin for localization * * @uses load_plugin_textdomain() */ public function localization_setup() { load_plugin_textdomain( 'abh', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); } /** * Enqueue admin scripts * * Allows plugin assets to be loaded. * * @uses wp_enqueue_script() * @uses wp_localize_script() * @uses wp_enqueue_style */ public function enqueue_scripts() { /** * All styles goes here */ wp_enqueue_style( 'abh-styles', plugins_url( 'assets/css/style.css', __FILE__ ), false, date( 'Ymd' ) ); /** * All scripts goes here */ wp_enqueue_script( 'abh-scripts', plugins_url( 'assets/js/script.js', __FILE__ ), array( 'jquery' ), false, true ); /** * Example for setting up text strings from Javascript files for localization * * Uncomment line below and replace with proper localization variables. */ // $translation_array = array( 'some_string' => __( 'Some string to translate', 'abh' ), 'a_value' => '10' ); // wp_localize_script( 'abh-scripts', 'abh', $translation_array ) ); } function remove_admin_bar() { if ( !current_user_can( 'administrator' ) && !is_admin() ) { show_admin_bar(false); } } } // Admin_Bar_Hide $admin_bar_hide = Admin_Bar_Hide::init();