| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * Admin page slug. |
| 9 | 9 | */ |
| 10 | - const PAGE_SLUG = 'flywp'; | |
| 10 | + public const PAGE_SLUG = 'flywp'; | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * Screen name. |
| 14 | 14 | * |
| @@ -13,11 +13,12 @@ | ||
| 13 | 13 | * Screen name. |
| 14 | 14 | * |
| 15 | 15 | * @var string |
| 16 | 16 | */ |
| 17 | - const SCREEN_NAME = 'dashboard_page_flywp'; | |
| 17 | + public const SCREEN_NAME = 'dashboard_page_flywp'; | |
| 18 | 18 | |
| 19 | - public $fastcgi = null; | |
| 19 | + public $fastcgi = null; | |
| 20 | + public $litespeed = null; | |
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * Admin constructor. |
| 23 | 24 | */ |
| @@ -23,14 +24,16 @@ | ||
| 23 | 24 | */ |
| 24 | 25 | public function __construct() { |
| 25 | 26 | add_action( 'admin_menu', [ $this, 'register_admin_page' ] ); |
| 26 | 27 | |
| 27 | - $this->fastcgi = new Admin\Fastcgi_Cache(); | |
| 28 | + $this->fastcgi = new Admin\Fastcgi_Cache(); | |
| 29 | + $this->litespeed = new Admin\Litespeed(); | |
| 28 | 30 | |
| 29 | 31 | new Admin\Adminbar(); |
| 30 | 32 | new Admin\Opcache(); |
| 31 | 33 | new Admin\Plugins(); |
| 32 | 34 | new Admin\Email(); |
| 35 | + new Admin\Optimizations(); | |
| 33 | 36 | } |
| 34 | 37 | |
| 35 | 38 | /** |
| 36 | 39 | * Register admin page. |
| @@ -40,14 +43,14 @@ | ||
| 40 | 43 | __( 'FlyWP', 'flywp' ), |
| 41 | 44 | __( 'FlyWP', 'flywp' ), |
| 42 | 45 | 'manage_options', |
| 43 | 46 | self::PAGE_SLUG, |
| 44 | - [$this, 'render_admin_page'] | |
| 47 | + [ $this, 'render_admin_page' ] | |
| 45 | 48 | ); |
| 46 | 49 | |
| 47 | - add_action( "admin_print_styles-{$hook}", [$this, 'enqueue_styles'] ); | |
| 48 | - add_action( "admin_print_scripts-{$hook}", [$this, 'enqueue_js'] ); | |
| 49 | - add_filter( 'removable_query_args', [$this, 'removable_query_args'] ); | |
| 50 | + add_action( "admin_print_styles-{$hook}", [ $this, 'enqueue_styles' ] ); | |
| 51 | + add_action( "admin_print_scripts-{$hook}", [ $this, 'enqueue_js' ] ); | |
| 52 | + add_filter( 'removable_query_args', [ $this, 'removable_query_args' ] ); | |
| 50 | 53 | } |
| 51 | 54 | |
| 52 | 55 | /** |
| 53 | 56 | * Get admin page url. |
| @@ -85,9 +88,9 @@ | ||
| 85 | 88 | */ |
| 86 | 89 | public function enqueue_js() { |
| 87 | 90 | $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
| 88 | 91 | |
| 89 | - wp_enqueue_script( 'flywp-admin-js', FLYWP_PLUGIN_URL . '/assets/js/admin' . $min . '.js', ['jquery'], FLYWP_VERSION, true ); | |
| 92 | + wp_enqueue_script( 'flywp-admin-js', FLYWP_PLUGIN_URL . '/assets/js/admin' . $min . '.js', [ 'jquery' ], FLYWP_VERSION, true ); | |
| 90 | 93 | } |
| 91 | 94 | |
| 92 | 95 | /** |
| 93 | 96 | * Render admin page. |
| @@ -93,12 +96,14 @@ | ||
| 93 | 96 | * Render admin page. |
| 94 | 97 | */ |
| 95 | 98 | public function render_admin_page() { |
| 96 | 99 | $tabs = [ |
| 97 | - 'cache' => __( 'Caching', 'flywp' ), | |
| 98 | - 'email' => __( 'Email', 'flywp' ), | |
| 100 | + 'cache' => __( 'Caching', 'flywp' ), | |
| 101 | + 'email' => __( 'Email', 'flywp' ), | |
| 102 | + 'optimizations' => __( 'Optimizations', 'flywp' ), | |
| 99 | 103 | ]; |
| 100 | 104 | |
| 105 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 101 | 106 | $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $tabs ) ? $_GET['tab'] : 'cache'; |
| 102 | 107 | $site_info = $this->fetch_site_info(); |
| 103 | 108 | $app_site_url = $this->get_site_url( $site_info ); |
| 104 | 109 | |