|
1
|
|
|
<?php |
|
2
|
|
|
include_once( 'class.jetpack-admin-page.php' ); |
|
3
|
|
|
include_once( JETPACK__PLUGIN_DIR . 'class.jetpack-modules-list-table.php' ); |
|
4
|
|
|
|
|
5
|
|
|
// Builds the settings page and its menu |
|
6
|
|
|
class Jetpack_Settings_Page extends Jetpack_Admin_Page { |
|
7
|
|
|
|
|
8
|
|
|
// Show the settings page only when Jetpack is connected or in dev mode |
|
9
|
|
|
protected $dont_show_if_not_active = true; |
|
10
|
|
|
|
|
11
|
|
|
function add_page_actions( $hook ) {} |
|
12
|
|
|
|
|
13
|
|
|
// Adds the Settings sub menu |
|
14
|
|
|
function get_page_hook() { |
|
15
|
|
|
return add_submenu_page( null, __( 'Jetpack Settings', 'jetpack' ), __( 'Settings', 'jetpack' ), 'jetpack_manage_modules', 'jetpack_modules', array( $this, 'render' ) ); |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
// Renders the module list table where you can use bulk action or row |
|
19
|
|
|
// actions to activate/deactivate and configure modules |
|
20
|
|
|
function page_render() { |
|
21
|
|
|
$list_table = new Jetpack_Modules_List_Table; |
|
22
|
|
|
|
|
23
|
|
|
$static_html = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static.html' ); |
|
24
|
|
|
|
|
25
|
|
|
// If static.html isn't there, there's nothing else we can do. |
|
26
|
|
|
if ( false === $static_html ) { |
|
27
|
|
|
esc_html_e( 'Error fetching static.html.', 'jetpack' ); |
|
28
|
|
|
return; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
// We have static.html so let's continue trying to fetch the others |
|
32
|
|
|
$noscript_notice = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static-noscript-notice.html' ); |
|
33
|
|
|
$version_notice = $rest_api_notice = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static-version-notice.html' ); |
|
34
|
|
|
$ie_notice = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static-ie-notice.html' ); |
|
35
|
|
|
|
|
36
|
|
|
$noscript_notice = str_replace( |
|
37
|
|
|
'#HEADER_TEXT#', |
|
38
|
|
|
esc_html__( 'You have JavaScript disabled', 'jetpack' ), |
|
39
|
|
|
$noscript_notice |
|
40
|
|
|
); |
|
41
|
|
|
$noscript_notice = str_replace( |
|
42
|
|
|
'#TEXT#', |
|
43
|
|
|
esc_html__( "Turn on JavaScript to unlock Jetpack's full potential!", 'jetpack' ), |
|
44
|
|
|
$noscript_notice |
|
45
|
|
|
); |
|
46
|
|
|
|
|
47
|
|
|
$version_notice = str_replace( |
|
48
|
|
|
'#HEADER_TEXT#', |
|
49
|
|
|
esc_html__( 'You are using an outdated version of WordPress', 'jetpack' ), |
|
50
|
|
|
$version_notice |
|
51
|
|
|
); |
|
52
|
|
|
$version_notice = str_replace( |
|
53
|
|
|
'#TEXT#', |
|
54
|
|
|
esc_html__( "Update WordPress to unlock Jetpack's full potential!", 'jetpack' ), |
|
55
|
|
|
$version_notice |
|
56
|
|
|
); |
|
57
|
|
|
|
|
58
|
|
|
$rest_api_notice = str_replace( |
|
59
|
|
|
'#HEADER_TEXT#', |
|
60
|
|
|
esc_html( __( 'WordPress REST API is disabled', 'jetpack' ) ), |
|
61
|
|
|
$rest_api_notice |
|
62
|
|
|
); |
|
63
|
|
|
$rest_api_notice = str_replace( |
|
64
|
|
|
'#TEXT#', |
|
65
|
|
|
esc_html( __( "Enable WordPress REST API to unlock Jetpack's full potential!", 'jetpack' ) ), |
|
66
|
|
|
$rest_api_notice |
|
67
|
|
|
); |
|
68
|
|
|
|
|
69
|
|
|
$ie_notice = str_replace( |
|
70
|
|
|
'#HEADER_TEXT#', |
|
71
|
|
|
esc_html__( 'You are using an unsupported browser version.', 'jetpack' ), |
|
72
|
|
|
$ie_notice |
|
73
|
|
|
); |
|
74
|
|
|
$ie_notice = str_replace( |
|
75
|
|
|
'#TEXT#', |
|
76
|
|
|
esc_html__( "Update your browser to unlock Jetpack's full potential!", 'jetpack' ), |
|
77
|
|
|
$ie_notice |
|
78
|
|
|
); |
|
79
|
|
|
|
|
80
|
|
|
ob_start(); |
|
81
|
|
|
|
|
82
|
|
|
$this->admin_page_top(); |
|
83
|
|
|
|
|
84
|
|
|
if ( $this->is_wp_version_too_old() ) { |
|
85
|
|
|
echo $version_notice; |
|
86
|
|
|
} |
|
87
|
|
|
if ( ! $this->is_rest_api_enabled() ) { |
|
88
|
|
|
echo $rest_api_notice; |
|
89
|
|
|
} |
|
90
|
|
|
echo $noscript_notice; |
|
91
|
|
|
echo $ie_notice; |
|
92
|
|
|
?> |
|
93
|
|
|
|
|
94
|
|
|
<div class="page-content configure"> |
|
95
|
|
|
<div class="frame top hide-if-no-js"> |
|
96
|
|
|
<div class="wrap"> |
|
97
|
|
|
<div class="manage-left"> |
|
98
|
|
|
<table class="table table-bordered fixed-top"> |
|
99
|
|
|
<thead> |
|
100
|
|
|
<tr> |
|
101
|
|
|
<th class="check-column"><input type="checkbox" class="checkall"></th> |
|
102
|
|
|
<th colspan="2"> |
|
103
|
|
|
<?php $list_table->unprotected_display_tablenav( 'top' ); ?> |
|
104
|
|
|
<span class="filter-search"> |
|
105
|
|
|
<button type="button" class="button">Filter</button> |
|
106
|
|
|
</span> |
|
107
|
|
|
</th> |
|
108
|
|
|
</tr> |
|
109
|
|
|
</thead> |
|
110
|
|
|
</table> |
|
111
|
|
|
</div> |
|
112
|
|
|
</div><!-- /.wrap --> |
|
113
|
|
|
</div><!-- /.frame --> |
|
114
|
|
|
<div class="frame bottom"> |
|
115
|
|
|
<div class="wrap"> |
|
116
|
|
|
<div class="manage-right" style="display: none;"> |
|
117
|
|
|
<div class="bumper"> |
|
118
|
|
|
<form class="navbar-form" role="search"> |
|
119
|
|
|
<input type="hidden" name="page" value="jetpack_modules" /> |
|
120
|
|
|
<?php $list_table->search_box( __( 'Search', 'jetpack' ), 'srch-term' ); ?> |
|
121
|
|
|
<p><?php esc_html_e( 'View:', 'jetpack' ); ?></p> |
|
122
|
|
|
<div class="button-group filter-active"> |
|
123
|
|
|
<button type="button" class="button <?php if ( empty( $_GET['activated'] ) ) echo 'active'; ?>"><?php esc_html_e( 'All', 'jetpack' ); ?></button> |
|
124
|
|
|
<button type="button" class="button <?php if ( ! empty( $_GET['activated'] ) && 'true' == $_GET['activated'] ) echo 'active'; ?>" data-filter-by="activated" data-filter-value="true"><?php esc_html_e( 'Active', 'jetpack' ); ?></button> |
|
125
|
|
|
<button type="button" class="button <?php if ( ! empty( $_GET['activated'] ) && 'false' == $_GET['activated'] ) echo 'active'; ?>" data-filter-by="activated" data-filter-value="false"><?php esc_html_e( 'Inactive', 'jetpack' ); ?></button> |
|
126
|
|
|
</div> |
|
127
|
|
|
<p><?php esc_html_e( 'Sort by:', 'jetpack' ); ?></p> |
|
128
|
|
|
<div class="button-group sort"> |
|
129
|
|
|
<button type="button" class="button <?php if ( empty( $_GET['sort_by'] ) ) echo 'active'; ?>" data-sort-by="name"><?php esc_html_e( 'Alphabetical', 'jetpack' ); ?></button> |
|
130
|
|
|
<button type="button" class="button <?php if ( ! empty( $_GET['sort_by'] ) && 'introduced' == $_GET['sort_by'] ) echo 'active'; ?>" data-sort-by="introduced" data-sort-order="reverse"><?php esc_html_e( 'Newest', 'jetpack' ); ?></button> |
|
131
|
|
|
<button type="button" class="button <?php if ( ! empty( $_GET['sort_by'] ) && 'sort' == $_GET['sort_by'] ) echo 'active'; ?>" data-sort-by="sort"><?php esc_html_e( 'Popular', 'jetpack' ); ?></button> |
|
132
|
|
|
</div> |
|
133
|
|
|
<p><?php esc_html_e( 'Show:', 'jetpack' ); ?></p> |
|
134
|
|
|
<?php $list_table->views(); ?> |
|
135
|
|
|
</form> |
|
136
|
|
|
</div> |
|
137
|
|
|
</div> |
|
138
|
|
|
<div class="manage-left" style="width: 100%;"> |
|
139
|
|
|
<form class="jetpack-modules-list-table-form" onsubmit="return false;"> |
|
140
|
|
|
<table class="<?php echo implode( ' ', $list_table->get_table_classes() ); ?>"> |
|
141
|
|
|
<tbody id="the-list"> |
|
142
|
|
|
<?php $list_table->display_rows_or_placeholder(); ?> |
|
143
|
|
|
</tbody> |
|
144
|
|
|
</table> |
|
145
|
|
|
</form> |
|
146
|
|
|
</div> |
|
147
|
|
|
</div><!-- /.wrap --> |
|
148
|
|
|
</div><!-- /.frame --> |
|
149
|
|
|
</div><!-- /.content --> |
|
150
|
|
|
<?php |
|
151
|
|
|
|
|
152
|
|
|
$this->admin_page_bottom(); |
|
153
|
|
|
|
|
154
|
|
|
$page_content = ob_get_contents(); |
|
155
|
|
|
ob_end_clean(); |
|
156
|
|
|
|
|
157
|
|
|
echo str_replace( |
|
158
|
|
|
'<div class="jp-loading-placeholder"><span class="dashicons dashicons-wordpress-alt"></span></div>', |
|
159
|
|
|
$page_content, |
|
160
|
|
|
$static_html |
|
161
|
|
|
); |
|
162
|
|
|
|
|
163
|
|
|
JetpackTracking::record_user_event( 'wpa_page_view', array( 'path' => 'old_settings' ) ); |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* Load styles for static page. |
|
168
|
|
|
* |
|
169
|
|
|
* @since 4.3.0 |
|
170
|
|
|
*/ |
|
171
|
|
|
function additional_styles() { |
|
172
|
|
|
$rtl = is_rtl() ? '.rtl' : ''; |
|
173
|
|
|
wp_enqueue_style( 'dops-css', plugins_url( "_inc/build/admin.dops-style$rtl.css", JETPACK__PLUGIN_FILE ), array(), JETPACK__VERSION ); |
|
174
|
|
|
wp_enqueue_style( 'components-css', plugins_url( "_inc/build/style.min$rtl.css", JETPACK__PLUGIN_FILE ), array(), JETPACK__VERSION ); |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
// Javascript logic specific to the list table |
|
178
|
|
|
function page_admin_scripts() { |
|
179
|
|
|
wp_enqueue_script( 'jetpack-admin-js', plugins_url( '_inc/jetpack-admin.js', JETPACK__PLUGIN_FILE ), array( 'jquery' ), JETPACK__VERSION ); |
|
180
|
|
|
} |
|
181
|
|
|
} |
|
182
|
|
|
|