version = AIPS_LITE_VERSION; } else { $this->version = '1.0.0'; } $this->plugin_name = 'ai-post-summarizer-lite'; $this->load_dependencies(); $this->set_locale(); $this->define_admin_hooks(); $this->define_public_hooks(); } /** * Load the required dependencies for this plugin. * * Include the following files that make up the plugin: * * - AIPS_Lite_Loader. Orchestrates the hooks of the plugin. * - AIPS_Lite_i18n. Defines internationalization functionality. * - AIPS_Lite_Admin. Defines all hooks for the admin area. * - AIPS_Lite_Public. Defines all hooks for the public side of the site. * * @since 1.0.0 * @access private */ private function load_dependencies() { /** * The class responsible for orchestrating the actions and filters of the * core plugin. */ require_once plugin_dir_path( __DIR__ ) . 'includes/class-aips-lite-loader.php'; /** * The class responsible for defining internationalization functionality * of the plugin. */ require_once plugin_dir_path( __DIR__ ) . 'includes/class-aips-lite-i18n.php'; /** * The class responsible for defining all actions that occur in the admin area. */ require_once plugin_dir_path( __DIR__ ) . 'admin/class-aips-lite-admin.php'; /** * The class responsible for defining all actions that occur in the public-facing * side of the site. */ require_once plugin_dir_path( __DIR__ ) . 'includes/class-aips-lite-public.php'; $this->loader = new AIPS_Lite_Loader(); } /** * Define the locale for this plugin for internationalization. * * @since 1.0.0 * @access private */ private function set_locale() { // load_plugin_textdomain is handled automatically by WordPress.org } /** * 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 AIPS_Lite_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' ); $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_notice_scripts' ); $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_admin_menu' ); $this->loader->add_action( 'admin_init', $plugin_admin, 'register_settings' ); $this->loader->add_action( 'admin_post_aips_lite_reset_defaults', $plugin_admin, 'reset_defaults' ); // Add settings link to plugin list $this->loader->add_filter( 'plugin_action_links_' . $this->plugin_name . '/' . $this->plugin_name . '.php', $plugin_admin, 'add_plugin_action_links' ); // Add row meta (View Details, Rate) $this->loader->add_filter( 'plugin_row_meta', $plugin_admin, 'modify_plugin_row_meta', 10, 2 ); // Admin Notices (including toast) $this->loader->add_action( 'admin_notices', $plugin_admin, 'display_admin_notices' ); $this->loader->add_action( 'wp_ajax_aips_lite_dismiss_notice', $plugin_admin, 'dismiss_review_notice' ); $this->loader->add_action( 'wp_ajax_aips_lite_dismiss_pro_notice', $plugin_admin, 'dismiss_pro_notice' ); $this->loader->add_action( 'wp_ajax_aips_lite_activate_plugin', $plugin_admin, 'ajax_activate_plugin' ); } private function define_public_hooks() { $plugin_public = new AIPS_Lite_Public( $this->get_plugin_name(), $this->get_version() ); $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); $this->loader->add_filter( 'the_content', $plugin_public, 'add_ai_buttons_to_content' ); $this->loader->add_action( 'wp_footer', $plugin_public, 'render_floating_widget' ); } /** * 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 get_plugin_name() { return $this->plugin_name; } /** * The reference to the class that orchestrates the hooks with the plugin. * * @since 1.0.0 * @return AIPS_Lite_Loader Orchestrates the hooks of the plugin. */ public function get_loader() { return $this->loader; } /** * Retrieve the version number of the plugin. * * @since 1.0.0 * @return string The version number of the plugin. */ public function get_version() { return $this->version; } }