AHSC_Page.php
54 lines
| 1 | <?php |
| 2 | namespace AHSC\Pages; |
| 3 | abstract class AHSC_Page { |
| 4 | abstract protected function draw(); |
| 5 | |
| 6 | private function loadStyles() { |
| 7 | wp_register_style( |
| 8 | 'aruba-hispeed-cache-style', // handle name |
| 9 | plugins_url( 'assets/css/option-page.css', __DIR__ ), |
| 10 | [], |
| 11 | AHSC_get_version() |
| 12 | ); |
| 13 | |
| 14 | wp_enqueue_style( 'aruba-hispeed-cache-style' ); |
| 15 | wp_enqueue_style('latofont','https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap',array(),1); |
| 16 | } |
| 17 | |
| 18 | private function loadJavascript() { |
| 19 | |
| 20 | wp_register_script( |
| 21 | 'aruba-hispeed-cache-script', // handle name |
| 22 | plugins_url( 'assets/js/option-page.js', __DIR__ ), |
| 23 | [], |
| 24 | AHSC_get_version(), |
| 25 | array( |
| 26 | 'strategy' => 'defer', |
| 27 | 'in_footer'=> true |
| 28 | ) |
| 29 | ); |
| 30 | |
| 31 | wp_enqueue_script( 'aruba-hispeed-cache-script' ); |
| 32 | wp_localize_script( 'aruba-hispeed-cache-script', 'AHSC_OPTIONS_CONFIGS', |
| 33 | array( |
| 34 | 'ahsc_ajax_url' => \admin_url( 'admin-ajax.php' ), |
| 35 | 'ahsc_topurge' => 'all', |
| 36 | 'ahsc_nonce' => \wp_create_nonce( 'ahsc-purge-cache' ), |
| 37 | 'ahsc_confirm' => __( 'You are about to purge the entire cache. Do you want to continue?', 'aruba-hispeed-cache' ), |
| 38 | 'ahsc_reset_confirm' => __( 'By confirming this action, all the plugin\'s original settings will be restored. Are you sure you want to proceed?', 'aruba-hispeed-cache' ), |
| 39 | 'ahsc_db_opt_status_active'=>__('Optimized', 'aruba-hispeed-cache' ), |
| 40 | 'ahsc_db_opt_status_disactive'=>__('Not optimized', 'aruba-hispeed-cache' ) |
| 41 | ) |
| 42 | ); |
| 43 | } |
| 44 | |
| 45 | public function buildPage() { |
| 46 | $this->loadJavascript(); |
| 47 | $this->loadStyles(); |
| 48 | |
| 49 | |
| 50 | $this->draw(); |
| 51 | |
| 52 | } |
| 53 | } |
| 54 |