version = PLUGIN_NAME_VERSION; } else { $this->version = '1.0.0'; } $this->plugin_name = 'admin-panel-colors'; $this->loadDependencies(); $this->setLocale(); // Hooks $this->defineAdminHooks(); $this->definePublicHooks(); } /** * 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 Loader(); } /** * Define the locale for this plugin for internationalization. * * Uses the I18n class in order to set the domain and to register the hook * with WordPress. * * @since 1.0.0 * @access private */ private function setLocale() { $plugin_i18n = new I18n(); $this->loader->addAction('plugins_loaded', $plugin_i18n, 'loadPluginTextdomain'); } /** * Register all of the hooks related to the admin area functionality * of the plugin. * * @since 1.0.0 * @access private */ private function defineAdminHooks() { $plugin_admin = new Admin($this->getPluginName(), $this->getVersion()); $this->loader->addAction('admin_enqueue_scripts', $plugin_admin, 'enqueueScripts'); $this->loader->addAction('admin_color_scheme_picker', $plugin_admin, 'addUserExtraFields'); $this->loader->addAction('personal_options_update', $plugin_admin, 'saveUserExtraFields'); $this->loader->addAction('edit_user_profile_update', $plugin_admin, 'saveUserExtraFields'); $this->loader->addAction('admin_init', $plugin_admin, 'getCurrentUserId'); $this->loader->addAction('admin_init', $plugin_admin, 'getCurrentBackground', 11); } /** * Register all of the hooks related to the public-facing functionality * of the plugin. * * @since 1.0.0 * @access private */ private function definePublicHooks() { $plugin_public = new PublicClass($this->getPluginName(), $this->getVersion()); $this->loader->addAction('wp_enqueue_scripts', $plugin_public, 'enqueueScripts'); } /** * Run the loader to execute all of the hooks with WordPress. * * @since 1.0.0 */ public function run() { $this->loader->run(); } /** * 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 getPluginName() { return $this->plugin_name; } /** * The reference to the class that orchestrates the hooks with the plugin. * * @since 1.0.0 * @return Loader 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; } }