*/ class AdminQuickbar { /** * The loader that's responsible for maintaining and registering all hooks that power * the plugin. * * @since 1.0.0 * @access protected * @var AdminQuickbarLoader $loader Maintains and registers all hooks for the plugin. */ protected $loader; /** * The unique identifier of this plugin. * * @since 1.0.0 * @access protected * @var string $pluginName The string used to uniquely identify this plugin. */ protected $pluginName; /** * The current version of the plugin. * * @since 1.0.0 * @access protected * @var string $version The current version of the plugin. */ protected $version; /** * Define the core functionality of the plugin. * * Set the plugin name and the plugin version that can be used throughout the plugin. * Load the dependencies, define the locale, and set the hooks for the admin area and * the public-facing side of the site. * * @since 1.0.0 */ public function __construct() { $this->pluginName = 'admin-quickbar'; $this->version = '1.0.0'; $this->loadDependencies(); $this->setLocale(); $this->defineAdminHooks(); $this->definePublicHooks(); } /** * Load the required dependencies for this plugin. * * Include the following files that make up the plugin: * * - AdminQuickbarLoader. Orchestrates the hooks of the plugin. * - AdminQuickbarI18n. Defines internationalization functionality. * - AdminQuickbarAdmin. Defines all hooks for the admin area. * - AdminQuickbarPublic. Defines all hooks for the public side of the site. * * Create an instance of the loader which will be used to register the hooks * with WordPress. * * @since 1.0.0 * @access private */ private function loadDependencies() { $this->loader = new AdminQuickbarLoader(); } /** * Define the locale for this plugin for internationalization. * * Uses the AdminQuickbarI18n class in order to set the domain and to register the hook * with WordPress. * * @since 1.0.0 * @access private */ private function setLocale() { $pluginI18n = new AdminQuickbarI18N(); $pluginI18n->setDomain( $this->getAdminQuickbar() ); $this->loader->addAction( 'plugins_loaded', $pluginI18n, 'loadPluginTextdomain' ); } /** * Register all of the hooks related to the admin area functionality * of the plugin. * * @since 1.0.0 * @access private */ private function defineAdminHooks() { $pluginAdmin = new AdminQuickbarAdmin( $this->getAdminQuickbar(), $this->getVersion() ); $this->loader->addAction( 'admin_enqueue_scripts', $pluginAdmin, 'enqueueStyles' ); $this->loader->addAction( 'admin_enqueue_scripts', $pluginAdmin, 'enqueueScripts' ); } /** * Register all of the hooks related to the public-facing functionality * of the plugin. * * @since 1.0.0 * @access private */ private function definePublicHooks() { $pluginPublic = new AdminQuickbarPublic( $this->getAdminQuickbar(), $this->getVersion() ); $this->loader->addAction( 'wp_enqueue_scripts', $pluginPublic, 'enqueueStyles' ); $this->loader->addAction( 'wp_enqueue_scripts', $pluginPublic, 'enqueueScripts' ); } /** * The name of the plugin used to uniquely identify it within the context of * WordPress and to define internationalization functionality. * * @since 1.0.0 * @return string The name of the plugin. */ public function getAdminQuickbar() { return $this->pluginName; } /** * The reference to the class that orchestrates the hooks with the plugin. * * @since 1.0.0 * @return AdminQuickbarLoader Orchestrates the hooks of the plugin. */ public function getLoader() { return $this->loader; } /** * Retrieve the version number of the plugin. * * @since 1.0.0 * @return string The version number of the plugin. */ public function getVersion() { return $this->version; } /** * Run the loader to execute all of the hooks with WordPress. * * @since 1.0.0 */ public static function run() { $plugin = new self(); $plugin->loader->run(); } }