/** * Initialize the plugin by loading admin scripts & styles and adding a * settings page and menu. * * @since 1.0.0 */ private function __construct() { /* * @TODO : * * - Uncomment following lines if the admin class should only be available for super admins */ /* if( ! is_super_admin() ) { return; } */ /* * Call $plugin_slug from public plugin class. */ $plugin = WP_Whitelabel::get_instance(); $this->plugin_slug = $plugin->get_plugin_slug(); // Load admin style sheet and JavaScript. add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles')); add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts')); // Add the options page and menu item. add_action('admin_menu', array($this, 'add_plugin_admin_menu')); // Add an action link pointing to the options page. $plugin_basename = plugin_basename(plugin_dir_path(__DIR__) . $this->plugin_slug . '.php'); add_filter('plugin_action_links_' . $plugin_basename, array($this, 'add_action_links')); // Populate options page add_action('admin_init', array($this, 'wp_whitelabel_settings_init')); /* * Define custom functionality. * * Read more about actions and filters: * http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters */ add_action('@TODO', array($this, 'action_method_name')); add_filter('@TODO', array($this, 'filter_method_name')); if (get_option('wp_whitelabel_yoast_ads') && is_plugin_active('wordpress-seo/wp-seo.php')) { function whitelabel_yoast() { echo '<style type="text/css"> body.toplevel_page_wpseo_dashboard #sidebar-container { display: none; } body.seo_page_wpseo_titles #sidebar-container { display: none; } body.seo_page_wpseo_social #sidebar-container { display: none; } body.seo_page_wpseo_xml #sidebar-container { display: none; } body.seo_page_wpseo_permalinks #sidebar-container { display: none; } body.seo_page_wpseo_internal-links #sidebar-container { display: none; } body.seo_page_wpseo_rss #sidebar-container { display: none; } body.seo_page_wpseo_import #sidebar-container { display: none; } body.seo_page_wpseo_files #sidebar-container { display: none; } </style>'; } add_action('admin_head', 'whitelabel_yoast'); } function remove_page_analysis_from_publish_box() { return false; } add_filter('wpseo_use_page_analysis', 'remove_page_analysis_from_publish_box'); }
/** * Return an instance of this class. * * @since 1.0.0 * * @return object A single instance of this class. */ public static function get_instance() { // If the single instance hasn't been set, set it now. if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }