1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
<?php /** * React based Gzip page. * * @since 2.2.0 * @package Hummingbird\Admin\Pages\React */
namespace Hummingbird\Admin\Pages\React;
use Hummingbird\Admin\Page; use Hummingbird\Core\Module_Server; use Hummingbird\Core\Settings; use Hummingbird\Core\Utils;
if ( ! defined( 'ABSPATH' ) ) { exit; }
/** * Class Gzip extends Page. */ class Gzip extends Page {
/** * Render the page. */ public function render() { $settings = Settings::get_settings( 'settings' ); ?> <div class="sui-wrap<?php echo $settings['accessible_colors'] ? ' sui-color-accessible ' : ' '; ?>wrap-wp-hummingbird wrap-wp-hummingbird-page <?php echo 'wrap-' . esc_attr( $this->slug ); ?>"> <?php $this->render_header(); ?> <div class="row" id="<?php echo 'wrap-' . esc_attr( $this->slug ); ?>"></div> <?php $this->render_footer(); ?> </div><!-- end container --> <?php }
/** * Enqueue scripts. * * @param string $hook Hook from where the call is made. */ public function enqueue_scripts( $hook ) { parent::enqueue_scripts( $hook );
// We don't need the scripts/styles from non-React pages. wp_dequeue_script( 'wphb-admin' ); wp_dequeue_style( 'wphb-admin' );
wp_enqueue_style( 'wphb-sui', WPHB_DIR_URL . 'admin/assets/css/wphb-react-gzip.min.css', array(), WPHB_VERSION );
wp_enqueue_script( 'wphb-react-gzip', WPHB_DIR_URL . 'admin/assets/js/wphb-react-gzip.min.js', array( 'wp-i18n' ), WPHB_VERSION, true );
wp_localize_script( 'wphb-react-gzip', 'wphb', array( 'isMember' => Utils::is_member(), 'links' => array( 'modules' => array( 'gzip' => Utils::get_admin_menu_url( 'gzip' ), ), 'support' => array( 'chat' => Utils::get_link( 'chat' ), 'forum' => Utils::get_link( 'support' ), ), ), 'nonces' => array( 'HBFetchNonce' => wp_create_nonce( 'wphb-fetch' ), ), 'module' => array( 'is_wpmu_hosting' => isset( $_SERVER['WPMUDEV_HOSTED'] ), 'is_white_labeled' => apply_filters( 'wpmudev_branding_hide_branding', false ), 'htaccess_error' => isset( $_GET['htaccess-error'] ), // Input data ok. 'htaccess_writable' => Module_Server::is_htaccess_writable(), 'htaccess_written' => Module_Server::is_htaccess_written( 'gzip' ), 'servers_array' => Module_Server::get_servers(), 'server_name' => Module_Server::get_server_type(), 'snippets' => array( 'apache' => Module_Server::get_code_snippet( 'gzip', 'apache' ), 'iis' => Module_Server::get_code_snippet( 'gzip', 'iis' ), 'nginx' => Module_Server::get_code_snippet( 'gzip', 'nginx' ), ), ), ) ); }
}
|