version = LINKMORA_VERSION; } else { $this->version = '1.0.0'; } $this->plugin_name = 'linkmora'; $this->load_dependencies(); $this->define_admin_hooks(); $this->define_public_hooks(); } /** * Load the required dependencies for this plugin. * * Include the following files that make up the plugin: * * - Linkmora_Loader. Orchestrates the hooks of the plugin. * - Linkmora_Admin. Defines all hooks for the admin area. * - Linkmora_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() { /** * The class responsible for orchestrating the actions and filters of the * core plugin. */ require_once LINKMORA_PATH . 'includes/class-linkmora-loader.php'; require_once LINKMORA_PATH . 'includes/functions/linkmora-dates.php'; require_once LINKMORA_PATH . 'includes/functions/linkmora-csv.php'; require_once LINKMORA_PATH . 'includes/functions/linkmora-settings.php'; require_once LINKMORA_PATH . 'includes/licensing/interface-linkmora-license-provider.php'; require_once LINKMORA_PATH . 'includes/licensing/class-linkmora-entitlement-manager.php'; require_once LINKMORA_PATH . 'includes/licensing/class-linkmora-freemius-provider.php'; require_once LINKMORA_PATH . 'includes/functions/linkmora-entitlements.php'; if ( function_exists( 'linkmora_register_license_provider' ) ) { linkmora_register_license_provider( new Linkmora_Freemius_Provider() ); } require_once LINKMORA_PATH . 'includes/functions/linkmora-extension-api.php'; require_once LINKMORA_PATH . 'includes/class-linkmora-table.php'; require_once LINKMORA_PATH . 'includes/widgets/class-linkmora-widget.php'; require_once LINKMORA_PATH . 'includes/functions/wprocket-integration.php'; require_once LINKMORA_PATH . 'includes/linkmora-cron.php'; require_once LINKMORA_PATH . 'includes/functions/linkmora-click-tracking.php'; /** * The class responsible for defining all actions that occur in the admin area. */ require_once LINKMORA_PATH . 'admin/class-linkmora-admin.php'; /** * The class responsible for defining all actions that occur in the public-facing * side of the site. */ require_once LINKMORA_PATH . 'public/class-linkmora-public.php'; $this->loader = new Linkmora_Loader(); } /** * 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 Linkmora_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_menu', $plugin_admin, 'add_admin_menu' ); $this->loader->add_action( 'admin_init', $plugin_admin, 'linkmora_save_settings' ); $this->loader->add_action( 'admin_init', $plugin_admin, 'add_backlinks' ); // Runs before any admin HTML is output, so redirects (e.g. Edit) actually work. $this->loader->add_action( 'admin_init', $plugin_admin, 'handle_link_list_actions' ); $this->loader->add_action( 'admin_init', $plugin_admin, 'maybe_run_scheduled_cleanup' ); $this->loader->add_action( 'admin_notices', $plugin_admin, 'show_expiry_admin_notice' ); $this->loader->add_action( 'wp_ajax_linkmora_dismiss_expiry_notice', $plugin_admin, 'ajax_dismiss_expiry_notice' ); $this->loader->add_action( 'wp_ajax_linkmora_save_link_order', $plugin_admin, 'ajax_save_link_order' ); $this->loader->add_action( 'wp_ajax_linkmora_render_links_table', $plugin_admin, 'ajax_render_links_table' ); $this->loader->add_filter( 'set-screen-option', $plugin_admin, 'save_screen_options', 10, 3 ); $this->loader->add_filter( 'linkmora_settings_sections', $plugin_admin, 'register_current_settings_sections', 10, 2 ); $this->loader->add_action( 'linkmora_settings_fields', $plugin_admin, 'render_current_settings_fields', 10, 3 ); add_action( 'font_awesome_preferences', function () { fa()->register( array( 'name' => 'Linkmora', ) ); } ); } /** * 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 Linkmora_Public( $this->get_plugin_name(), $this->get_version() ); $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'register_assets', 5 ); $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'maybe_enqueue_assets', 20 ); } /** * 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 Linkmora_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; } }