*/ class Launch_Checklist { /** * The loader that's responsible for maintaining and registering all hooks that power * the plugin. * * @var Loader $loader Maintains and registers all hooks for the plugin. * @since 1.0.0 * @access protected */ protected Loader $loader; /** * The unique identifier of this plugin. * * @var string $plugin_name The string used to uniquely identify this plugin. * @since 1.0.0 * @access protected */ protected string $plugin_name; /** * The current version of the plugin. * * @var string $version The current version of the plugin. * @since 1.0.0 * @access protected */ protected string $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->version = WP_LAUNCH_CHECKLIST_VERSION; $this->plugin_name = WP_LAUNCH_CHECKLIST_SLUG; $this->load_dependencies(); $this->set_locale(); $this->define_admin_hooks(); } /** * Load the required dependencies for this plugin. * * Include the following files that make up the plugin: * * - Loader. Orchestrates the hooks of the plugin. * - i18n. Defines internationalization functionality. * - Admin. Defines all hooks for the admin area. * - 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() { $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 set_locale() { $plugin_i18n = new i18n(); $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); } /** * 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() { // Admin scripts and styles. $plugin_admin = new 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' ); // Options/settings page $options_page = new Options_Page(); $this->loader->add_action( 'admin_init', $options_page, 'initialize_options' ); } /** * 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() : string { return $this->plugin_name; } /** * The reference to the class that orchestrates the hooks with the plugin. * * @return Loader Orchestrates the hooks of the plugin. * @since 1.0.0 */ public function get_loader() : 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() : string { return $this->version; } }