&& ( isset( $_GET[ Brizy_Editor::prefix( '-edit' ) ] ) || isset( $_GET[ Brizy_Editor::prefix( '-edit-iframe' ) ] ) ) ) { return false; } return true; } /** * Instantiate all classes. * Every class has inner documentation. */ private function init_modules() { new SpeedBooster\SBP_WP_Admin(); new SpeedBooster\SBP_Database_Optimizer(); new SpeedBooster\SBP_Newsletter(); new SpeedBooster\SBP_Migrator(); new SpeedBooster\SBP_Compatibility_Checker(); new SpeedBooster\SBP_Cloudflare(); new SpeedBooster\SBP_Sucuri(); new SpeedBooster\SBP_Notice_Manager(); new SpeedBooster\SBP_Cache_Warmup(); new SpeedBooster\SBP_JS_Optimizer(); new SpeedBooster\SBP_Tweaks(); new SpeedBooster\SBP_Font_Optimizer(); new SpeedBooster\SBP_Preboost(); new SpeedBooster\SBP_CDN(); new SpeedBooster\SBP_Lazy_Loader(); new SpeedBooster\SBP_CSS_Minifier(); new SpeedBooster\SBP_Critical_CSS(); new SpeedBooster\SBP_Image_Dimensions(); new SpeedBooster\SBP_HTML_Minifier(); new SpeedBooster\SBP_Localize_Tracker(); new SpeedBooster\SBP_Woocommerce(); new SpeedBooster\SBP_Cache(); new SpeedBooster\SBP_LiteSpeed_Cache(); } /** * Load the required dependencies for this plugin. * * Include the following files that make up the plugin: * * - Speed_Booster_Pack_Loader. Orchestrates the hooks of the plugin. * - Speed_Booster_Pack_i18n. Defines internationalization functionality. * - Speed_Booster_Pack_Admin. Defines all hooks for the admin area. * - Speed_Booster_Pack_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 4.0.0 * @access private */ private function load_dependencies() { /** * Composer autoload file. */ require_once SBP_PATH . 'vendor/autoload.php'; /** * Load helper files */ require_once SBP_INC_PATH . 'sbp-helpers.php'; /** * The class responsible for orchestrating the actions and filters of the * core plugin. */ require_once SBP_INC_PATH . 'class-speed-booster-pack-loader.php'; /** * The class responsible for defining internationalization functionality * of the plugin. */ require_once SBP_INC_PATH . 'class-speed-booster-pack-i18n.php'; /** * The class responsible for defining all actions that occur in the admin area. */ require_once SBP_PATH . 'admin/class-speed-booster-pack-admin.php'; /** * The class responsible for defining all actions that occur in the public-facing * side of the site. */ require_once SBP_PATH . 'public/class-speed-booster-pack-public.php'; $this->loader = new Speed_Booster_Pack_Loader(); } /** * Define the locale for this plugin for internationalization. * * Uses the Speed_Booster_Pack_i18n class in order to set the domain and to register the hook * with WordPress. * * @since 4.0.0 * @access private */ private function set_locale() { $plugin_i18n = new Speed_Booster_Pack_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 4.0.0 * @access private */ private function define_admin_hooks() { if ( ! is_admin() || wp_doing_cron() || wp_doing_ajax() ) { return; } add_filter( 'rocket_plugins_to_deactivate', '__return_empty_array' ); $plugin_admin = new Speed_Booster_Pack_Admin( $this->plugin_name, SBP_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_init', $plugin_admin, 'set_up_defaults' ); $this->loader->add_action( 'admin_init', $plugin_admin, 'redirect' ); } /** * Register all of the hooks related to the public-facing functionality * of the plugin. * * @since 4.0.0 * @access private */ private function define_public_hooks() { if ( is_admin() || wp_doing_cron() || wp_doing_ajax() ) { return; } $plugin_public = new Speed_Booster_Pack_Public( $this->plugin_name, SBP_VERSION ); $this->loader->add_action( 'template_redirect', $plugin_public, 'template_redirect', 2 ); // $this->loader->add_action( 'shutdown', $plugin_public, 'shutdown', PHP_INT_MAX ); // $this->loader->add_filter( 'wp_headers', $plugin_public, 'sbp_headers' ); add_filter( 'aioseo_flush_output_buffer', '__return_false' ); } private function save_post_types() { add_action('admin_init', function() { $post_types = array_keys( get_post_types( [ 'public' => true ] ) ); $saved_post_types = get_option( 'sbp_public_post_types' ); if ( ! $saved_post_types || $saved_post_types != $post_types ) { update_option( 'sbp_public_post_types', $post_types ); } }); } /** * Run the loader to execute all of the hooks with WordPress. * * @since 4.0.0 */ public function run() { $this->loader->run(); } /** * The reference to the class that orchestrates the hooks with the plugin. * * @return Speed_Booster_Pack_Loader Orchestrates the hooks of the plugin. * @since 4.0.0 */ public function get_loader() { return $this->loader; } }