version = AIO_VERSION; } else { $this->version = '1.0.0'; } $this->plugin_name = 'aio-tools'; $this->load_dependencies(); $this->set_locale(); $this->init_modules(); $this->define_admin_hooks(); $this->define_public_hooks(); $this->includes(); } /** * Load the required dependencies for this plugin. * * Include the following files that make up the plugin: * * - AIO_Tools_Loader. Orchestrates the hooks of the plugin. * - AIO_Tools_i18n. Defines internationalization functionality. * - AIO_Tools_Admin. Defines all hooks for the admin area. * - AIO_Tools_Public. 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 load_dependencies() { /** * Load helper files */ require_once AIO_CORE_PATH . 'aio-helpers.php'; /** * The class responsible for orchestrating the actions and filters of the * core plugin. */ require_once AIO_CORE_PATH . 'class-aio-tools-loader.php'; /** * The class responsible for defining internationalization functionality * of the plugin. */ require_once AIO_CORE_PATH . 'class-aio-tools-i18n.php'; /** * The class responsible for defining all actions that occur in the admin area. */ require_once AIO_PATH . 'admin/class-aio-tools-admin.php'; /** * The class responsible for defining all actions that occur in the public-facing * side of the site. */ require_once AIO_PATH . 'public/class-aio-tools-public.php'; /** * The class responsible for handling encryption. */ require_once AIO_CORE_PATH . 'class-aio-crypto.php'; require_once AIO_CORE_PATH . 'class-aio-totp.php'; $this->loader = new AIO_Tools_Loader(); } /** * Define the locale for this plugin for internationalization. * * Uses the AIO_Tools_i18n class in order to set the domain and to register the hook * with WordPress. * * @since 1.0.0 * @access private */ private function set_locale() { $plugin_i18n = new AIO_Tools_i18n(); $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); } /** * Instantiate all classes. * Every class has inner documentation. */ private function init_modules() { } /** * Register all of the hooks related to the admin area functionality * of the plugin. * * @since 1.0.0 * @access private */ private function define_admin_hooks() { $plugin_admin = new AIO_Tools_Admin( $this->get_plugin_name(), $this->get_version() ); $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); } /** * Register all of the hooks related to the public-facing functionality * of the plugin. * * @since 1.0.0 * @access private */ private function define_public_hooks() { $plugin_public = new AIO_Tools_Public( $this->get_plugin_name(), $this->get_version() ); $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'aio_public_enqueue_styles' ); $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'aio_public_enqueue_scripts' ); } /** * 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. * * @return string The name of the plugin. * @since 1.0.0 */ public function get_plugin_name() { return $this->plugin_name; } /** * The reference to the class that orchestrates the hooks with the plugin. * * @return AIO_Tools_Loader Orchestrates the hooks of the plugin. * @since 1.0.0 */ public function get_loader() { return $this->loader; } /** * Retrieve the version number of the plugin. * * @return string The version number of the plugin. * @since 1.0.0 */ public function get_version() { return $this->version; } public function includes() { $is_active = function($key) { $val = aio_get_option($key); return $val === null || !empty($val); }; if ($is_active('opt-module-contact')) { include_once AIO_MODULES_PATH . 'contact-express/public-contact.php'; } if ($is_active('opt-module-smtp')) { include_once AIO_MODULES_PATH . 'smtp/public-smtp.php'; } if ($is_active('opt-module-woocommerce')) { include_once AIO_MODULES_PATH . 'woocommerce-boost/public-woocommerce.php'; } if ($is_active('opt-module-performance')) { include_once AIO_MODULES_PATH . 'performance/public-performance.php'; } if ($is_active('opt-module-security')) { include_once AIO_MODULES_PATH . 'security/public-security.php'; } if ($is_active('opt-module-optimizer')) { include_once AIO_MODULES_PATH . 'optimizer/public-optimizer.php'; } if ($is_active('opt-module-db-cleaner')) { include_once AIO_MODULES_PATH . 'db-cleaner/public-db-cleaner.php'; } if ($is_active('opt-module-messenger')) { include_once AIO_MODULES_PATH . 'messenger/public-messenger.php'; } // Always load these essential/lightweight modules require_once AIO_MODULES_PATH . 'utility/public-utility.php'; include_once AIO_MODULES_PATH . 'header-footer/public-header-footer.php'; include_once AIO_MODULES_PATH . 'login-customizer/public-login.php'; include_once AIO_MODULES_PATH . 'social-login/class-aio-social-login.php'; new AIO_Social_Login(); } }