1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
// Shared logic between Jetpack admin pages |
4
|
|
|
abstract class Jetpack_Admin_Page { |
5
|
|
|
// Add page specific actions given the page hook |
6
|
|
|
abstract function add_page_actions( $hook ); |
7
|
|
|
|
8
|
|
|
// Create a menu item for the page and returns the hook |
9
|
|
|
abstract function get_page_hook(); |
10
|
|
|
|
11
|
|
|
// Enqueue and localize page specific scripts |
12
|
|
|
abstract function page_admin_scripts(); |
13
|
|
|
|
14
|
|
|
// Render page specific HTML |
15
|
|
|
abstract function page_render(); |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Should we block the page rendering because the site is in IDC? |
19
|
|
|
* |
20
|
|
|
* @var bool |
21
|
|
|
*/ |
22
|
|
|
static $block_page_rendering_for_idc; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Function called after admin_styles to load any additional needed styles. |
26
|
|
|
* |
27
|
|
|
* @since 4.3.0 |
28
|
|
|
*/ |
29
|
|
|
function additional_styles() {} |
30
|
|
|
|
31
|
|
|
function __construct() { |
32
|
|
|
$this->jetpack = Jetpack::init(); |
|
|
|
|
33
|
|
|
self::$block_page_rendering_for_idc = ( |
34
|
|
|
Jetpack::validate_sync_error_idc_option() && ! Jetpack_Options::get_option( 'safe_mode_confirmed' ) |
35
|
|
|
); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
function add_actions() { |
39
|
|
|
global $pagenow; |
40
|
|
|
|
41
|
|
|
// If user is not an admin and site is in Dev Mode or not connected yet then don't do anything. |
42
|
|
|
if ( ! current_user_can( 'manage_options' ) && ( Jetpack::is_development_mode() || ! Jetpack::is_active() ) ) { |
43
|
|
|
return; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
// Don't add in the modules page unless modules are available! |
47
|
|
|
if ( $this->dont_show_if_not_active && ! Jetpack::is_active() && ! Jetpack::is_development_mode() ) { |
|
|
|
|
48
|
|
|
return; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
// Initialize menu item for the page in the admin |
52
|
|
|
$hook = $this->get_page_hook(); |
53
|
|
|
|
54
|
|
|
// Attach hooks common to all Jetpack admin pages based on the created |
55
|
|
|
// hook |
56
|
|
|
add_action( "load-$hook", array( $this, 'admin_help' ) ); |
57
|
|
|
add_action( "load-$hook", array( $this, 'admin_page_load' ) ); |
58
|
|
|
add_action( "admin_print_styles-$hook", array( $this, 'admin_styles' ) ); |
59
|
|
|
add_action( "admin_print_scripts-$hook", array( $this, 'admin_scripts' ) ); |
60
|
|
|
|
61
|
|
|
if ( ! self::$block_page_rendering_for_idc ) { |
62
|
|
|
add_action( "admin_print_styles-$hook", array( $this, 'additional_styles' ) ); |
63
|
|
|
} |
64
|
|
|
// If someone just activated Jetpack, let's show them a fullscreen connection banner. |
65
|
|
|
if ( |
66
|
|
|
( 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'jetpack' === $_GET['page'] ) |
67
|
|
|
&& ! Jetpack::is_active() |
68
|
|
|
&& current_user_can( 'jetpack_connect' ) |
69
|
|
|
&& ! Jetpack::is_development_mode() |
70
|
|
|
) { |
71
|
|
|
add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_banner_scripts' ) ); |
72
|
|
|
add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_connect_button_scripts' ) ); |
73
|
|
|
add_action( 'admin_print_styles', array( Jetpack::init(), 'admin_banner_styles' ) ); |
74
|
|
|
add_action( 'admin_notices', array( 'Jetpack_Connection_Banner', 'render_connect_prompt_full_screen' ) ); |
75
|
|
|
delete_transient( 'activated_jetpack' ); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
// If Jetpack not yet connected, but user is viewing one of the pages with a Jetpack connection banner. |
79
|
|
|
if ( |
80
|
|
|
( 'index.php' === $pagenow || 'plugins.php' === $pagenow ) |
81
|
|
|
&& ! Jetpack::is_active() |
82
|
|
|
&& current_user_can( 'jetpack_connect' ) |
83
|
|
|
&& ! Jetpack::is_development_mode() |
84
|
|
|
) { |
85
|
|
|
add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_connect_button_scripts' ) ); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
// Check if the site plan changed and deactivate modules accordingly. |
89
|
|
|
add_action( 'current_screen', array( $this, 'check_plan_deactivate_modules' ) ); |
90
|
|
|
|
91
|
|
|
// Attach page specific actions in addition to the above |
92
|
|
|
$this->add_page_actions( $hook ); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
// Render the page with a common top and bottom part, and page specific content |
96
|
|
|
function render() { |
97
|
|
|
// We're in an IDC: we need a decision made before we show the UI again. |
98
|
|
|
if ( self::$block_page_rendering_for_idc ) { |
99
|
|
|
return; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
// Check if we are looking at the main dashboard |
103
|
|
|
if ( isset( $_GET['page'] ) && 'jetpack' === $_GET['page'] ) { |
104
|
|
|
$this->page_render(); |
105
|
|
|
return; |
106
|
|
|
} |
107
|
|
|
self::wrap_ui( array( $this, 'page_render' ) ); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
function admin_help() { |
111
|
|
|
$this->jetpack->admin_help(); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
function admin_page_load() { |
115
|
|
|
// This is big. For the moment, just call the existing one. |
116
|
|
|
$this->jetpack->admin_page_load(); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
// Add page specific scripts and jetpack stats for all menu pages |
120
|
|
|
function admin_scripts() { |
121
|
|
|
$this->page_admin_scripts(); // Delegate to inheriting class |
122
|
|
|
add_action( 'admin_footer', array( $this->jetpack, 'do_stats' ) ); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
// Enqueue the Jetpack admin stylesheet |
126
|
|
|
function admin_styles() { |
127
|
|
|
$min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
128
|
|
|
|
129
|
|
|
wp_enqueue_style( 'jetpack-admin', plugins_url( "css/jetpack-admin{$min}.css", JETPACK__PLUGIN_FILE ), array( 'genericons' ), JETPACK__VERSION . '-20121016' ); |
130
|
|
|
wp_style_add_data( 'jetpack-admin', 'rtl', 'replace' ); |
131
|
|
|
wp_style_add_data( 'jetpack-admin', 'suffix', $min ); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Checks if REST API is enabled. |
136
|
|
|
* |
137
|
|
|
* @since 4.4.2 |
138
|
|
|
* |
139
|
|
|
* @return bool |
140
|
|
|
*/ |
141
|
|
|
function is_rest_api_enabled() { |
142
|
|
|
return /** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */ |
143
|
|
|
apply_filters( 'rest_enabled', true ) && |
144
|
|
|
/** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */ |
145
|
|
|
apply_filters( 'rest_jsonp_enabled', true ) && |
146
|
|
|
/** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */ |
147
|
|
|
apply_filters( 'rest_authentication_errors', true ); |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* Checks the site plan and deactivates modules that were active but are no longer included in the plan. |
152
|
|
|
* |
153
|
|
|
* @since 4.4.0 |
154
|
|
|
* |
155
|
|
|
* @param $page |
156
|
|
|
* |
157
|
|
|
* @return array |
158
|
|
|
*/ |
159
|
|
|
function check_plan_deactivate_modules( $page ) { |
160
|
|
|
if ( |
161
|
|
|
Jetpack::is_development_mode() |
162
|
|
|
|| ! in_array( |
163
|
|
|
$page->base, |
164
|
|
|
array( |
165
|
|
|
'toplevel_page_jetpack', |
166
|
|
|
'admin_page_jetpack_modules', |
167
|
|
|
'jetpack_page_vaultpress', |
168
|
|
|
'jetpack_page_stats', |
169
|
|
|
'jetpack_page_akismet-key-config', |
170
|
|
|
) |
171
|
|
|
) |
172
|
|
|
) { |
173
|
|
|
return false; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
$current = Jetpack_Plan::get(); |
177
|
|
|
|
178
|
|
|
$to_deactivate = array(); |
179
|
|
|
if ( isset( $current['product_slug'] ) ) { |
180
|
|
|
$active = Jetpack::get_active_modules(); |
181
|
|
|
switch ( $current['product_slug'] ) { |
182
|
|
View Code Duplication |
case 'jetpack_free': |
183
|
|
|
$to_deactivate = array( 'seo-tools', 'videopress', 'google-analytics', 'wordads', 'search' ); |
184
|
|
|
break; |
185
|
|
|
case 'jetpack_personal': |
186
|
|
View Code Duplication |
case 'jetpack_personal_monthly': |
187
|
|
|
$to_deactivate = array( 'seo-tools', 'videopress', 'google-analytics', 'wordads', 'search' ); |
188
|
|
|
break; |
189
|
|
|
case 'jetpack_premium': |
190
|
|
|
case 'jetpack_premium_monthly': |
191
|
|
|
$to_deactivate = array( 'seo-tools', 'google-analytics', 'search' ); |
192
|
|
|
break; |
193
|
|
|
} |
194
|
|
|
$to_deactivate = array_intersect( $active, $to_deactivate ); |
195
|
|
|
|
196
|
|
|
$to_leave_enabled = array(); |
197
|
|
|
foreach ( $to_deactivate as $feature ) { |
198
|
|
|
if ( Jetpack_Plan::supports( $feature ) ) { |
199
|
|
|
$to_leave_enabled [] = $feature; |
200
|
|
|
} |
201
|
|
|
} |
202
|
|
|
$to_deactivate = array_diff( $to_deactivate, $to_leave_enabled ); |
203
|
|
|
|
204
|
|
|
if ( ! empty( $to_deactivate ) ) { |
205
|
|
|
Jetpack::update_active_modules( array_filter( array_diff( $active, $to_deactivate ) ) ); |
206
|
|
|
} |
207
|
|
|
} |
208
|
|
|
return array( |
209
|
|
|
'current' => $current, |
210
|
|
|
'deactivate' => $to_deactivate, |
211
|
|
|
); |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
static function load_wrapper_styles() { |
215
|
|
|
$rtl = is_rtl() ? '.rtl' : ''; |
216
|
|
|
wp_enqueue_style( 'dops-css', plugins_url( "_inc/build/admin{$rtl}.css", JETPACK__PLUGIN_FILE ), array(), JETPACK__VERSION ); |
217
|
|
|
wp_enqueue_style( 'components-css', plugins_url( "_inc/build/style.min{$rtl}.css", JETPACK__PLUGIN_FILE ), array(), JETPACK__VERSION ); |
218
|
|
|
$custom_css = ' |
219
|
|
|
#wpcontent { |
220
|
|
|
padding-left: 0 !important; |
221
|
|
|
} |
222
|
|
|
#wpbody-content { |
223
|
|
|
background-color: #f6f6f6; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
#jp-plugin-container .wrap { |
227
|
|
|
margin: 0 auto; |
228
|
|
|
max-width:45rem; |
229
|
|
|
padding: 0 1.5rem; |
230
|
|
|
} |
231
|
|
|
#jp-plugin-container.is-wide .wrap { |
232
|
|
|
max-width: 1040px; |
233
|
|
|
} |
234
|
|
|
#jp-plugin-container .wrap .jetpack-wrap-container { |
235
|
|
|
margin-top: 1em; |
236
|
|
|
} |
237
|
|
|
.wp-admin #dolly { |
238
|
|
|
float: none; |
239
|
|
|
position: relative; |
240
|
|
|
right: 0; |
241
|
|
|
left: 0; |
242
|
|
|
top: 0; |
243
|
|
|
padding: .625rem; |
244
|
|
|
text-align: right; |
245
|
|
|
background: #fff; |
246
|
|
|
font-size: .75rem; |
247
|
|
|
font-style: italic; |
248
|
|
|
color: #87a6bc; |
249
|
|
|
border-bottom: 1px #e9eff3 solid; |
250
|
|
|
} |
251
|
|
|
'; |
252
|
|
|
wp_add_inline_style( 'dops-css', $custom_css ); |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
public static function wrap_ui( $callback, $args = array() ) { |
256
|
|
|
$defaults = array( |
257
|
|
|
'is-wide' => false, |
258
|
|
|
'show-nav' => true, |
259
|
|
|
); |
260
|
|
|
$args = wp_parse_args( $args, $defaults ); |
261
|
|
|
$jetpack_admin_url = admin_url( 'admin.php?page=jetpack' ); |
262
|
|
|
|
263
|
|
|
?> |
264
|
|
|
<div id="jp-plugin-container" class=" |
265
|
|
|
<?php |
266
|
|
|
if ( $args['is-wide'] ) { |
267
|
|
|
echo 'is-wide'; } |
268
|
|
|
?> |
269
|
|
|
"> |
270
|
|
|
|
271
|
|
|
<div class="jp-masthead"> |
272
|
|
|
<div class="jp-masthead__inside-container"> |
273
|
|
|
<div class="jp-masthead__logo-container"> |
274
|
|
|
<a class="jp-masthead__logo-link" href="<?php echo esc_url( $jetpack_admin_url ); ?>"> |
275
|
|
|
<svg class="jetpack-logo__masthead" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" height="32" viewBox="0 0 118 32"><path fill="#00BE28" d="M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"></path><path d="M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z"></path><path d="M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z"></path><path d="M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z"></path><path d="M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z"></path><path d="M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z"></path><path d="M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z"></path><path d="M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z"></path></svg> |
276
|
|
|
</a> |
277
|
|
|
</div> |
278
|
|
|
<?php |
279
|
|
|
if ( $args['show-nav'] ) : |
280
|
|
|
?> |
281
|
|
|
<div class="jp-masthead__nav"> |
282
|
|
|
<?php |
283
|
|
|
if ( is_network_admin() ) { |
284
|
|
|
$current_screen = get_current_screen(); |
285
|
|
|
$highlight_current_sites = ( 'toplevel_page_jetpack-network' === $current_screen->id ? 'is-primary' : '' ); |
286
|
|
|
$highlight_current_settings = ( 'jetpack_page_jetpack-settings-network' === $current_screen->id ? 'is-primary' : '' ); |
287
|
|
|
?> |
288
|
|
|
<span class="dops-button-group"> |
289
|
|
|
<?php |
290
|
|
|
if ( current_user_can( 'jetpack_network_sites_page' ) ) { |
291
|
|
|
?> |
292
|
|
|
<a href="<?php echo esc_url( network_admin_url( 'admin.php?page=jetpack' ) ); ?>" type="button" class="<?php echo esc_attr( $highlight_current_sites ); ?> dops-button is-compact" title="<?php esc_html_e( "Manage your network's Jetpack Sites.", 'jetpack' ); ?>"><?php echo esc_html_x( 'Sites', 'Navigation item', 'jetpack' ); ?></a> |
293
|
|
|
<?php |
294
|
|
|
} if ( current_user_can( 'jetpack_network_settings_page' ) ) { |
295
|
|
|
?> |
296
|
|
|
<a href="<?php echo esc_url( network_admin_url( 'admin.php?page=jetpack-settings' ) ); ?>" type="button" class="<?php echo esc_attr( $highlight_current_settings ); ?> dops-button is-compact" title="<?php esc_html_e( "Manage your network's Jetpack Sites.", 'jetpack' ); ?>"><?php echo esc_html_x( 'Network Settings', 'Navigation item', 'jetpack' ); ?></a> |
297
|
|
|
<?php |
298
|
|
|
} |
299
|
|
|
?> |
300
|
|
|
</span> |
301
|
|
|
<?php } else { ?> |
302
|
|
|
<span class="dops-button-group"> |
303
|
|
|
<a href="<?php echo esc_url( $jetpack_admin_url ); ?>" type="button" class="dops-button is-compact"><?php esc_html_e( 'Dashboard', 'jetpack' ); ?></a> |
304
|
|
|
<?php |
305
|
|
|
if ( current_user_can( 'jetpack_manage_modules' ) ) { |
306
|
|
|
?> |
307
|
|
|
<a href="<?php echo esc_url( $jetpack_admin_url . '#/settings' ); ?>" type="button" class="dops-button is-compact"><?php esc_html_e( 'Settings', 'jetpack' ); ?></a> |
308
|
|
|
<?php |
309
|
|
|
} |
310
|
|
|
?> |
311
|
|
|
</span> |
312
|
|
|
<?php } ?> |
313
|
|
|
</div> |
314
|
|
|
<?php endif; ?> |
315
|
|
|
</div> |
316
|
|
|
</div> |
317
|
|
|
<div class="wrap"><div id="jp-admin-notices" aria-live="polite"></div></div> |
318
|
|
|
<!-- START OF CALLBACK --> |
319
|
|
|
<?php |
320
|
|
|
ob_start(); |
321
|
|
|
call_user_func( $callback ); |
322
|
|
|
$callback_ui = ob_get_contents(); |
323
|
|
|
ob_end_clean(); |
324
|
|
|
echo $callback_ui; |
325
|
|
|
?> |
326
|
|
|
<!-- END OF CALLBACK --> |
327
|
|
|
<?php self::render_footer(); ?> |
328
|
|
|
</div> |
329
|
|
|
<?php |
330
|
|
|
return; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* Output a list item with a link. |
335
|
|
|
* |
336
|
|
|
* @param string $url URL. |
337
|
|
|
* @param string $title Link title attribute. |
338
|
|
|
* @param string $text Link text. |
339
|
|
|
* @param bool $is_internal Is the link linking to an internal or external domain. |
340
|
|
|
*/ |
341
|
|
|
public static function the_footer_link( $url, $title, $text, $is_internal = true ) { |
342
|
|
|
printf( |
343
|
|
|
'<li class="jp-footer__link-item"><a class="jp-footer__link" href="%1$s" title="%2$s" %4$s>%3$s</a></li>', |
344
|
|
|
esc_url( $url ), |
345
|
|
|
esc_attr( $title ), |
346
|
|
|
esc_html( $text ), |
347
|
|
|
( $is_internal ? '' : 'target="_blank" rel="noopener noreferrer"' ) |
348
|
|
|
); |
349
|
|
|
} |
350
|
|
|
|
351
|
|
|
/** |
352
|
|
|
* Render the footer of the jetpack dashboard. For admin pages. |
353
|
|
|
* |
354
|
|
|
* Note that the Jetpack Dashboard may append additional links to that list. |
355
|
|
|
*/ |
356
|
|
|
public static function render_footer() { |
357
|
|
|
$admin_url = admin_url( 'admin.php?page=jetpack' ); |
358
|
|
|
|
359
|
|
|
$is_dev_mode_or_connected = Jetpack::is_active() || Jetpack::is_development_mode(); |
360
|
|
|
|
361
|
|
|
$privacy_url = ( $is_dev_mode_or_connected ) |
362
|
|
|
? $admin_url . '#/privacy' |
363
|
|
|
: 'https://automattic.com/privacy/'; |
364
|
|
|
|
365
|
|
|
$about_url = ( $is_dev_mode_or_connected ) |
366
|
|
|
? admin_url( 'admin.php?page=jetpack_about' ) |
367
|
|
|
: 'https://jetpack.com'; |
368
|
|
|
|
369
|
|
|
?> |
370
|
|
|
<div class="jp-footer"> |
371
|
|
|
<div class="jp-footer__a8c-attr-container"> |
372
|
|
|
<a href="<?php echo esc_url( $about_url ); ?>"> |
373
|
|
|
<svg role="img" class="jp-footer__a8c-attr" x="0" y="0" viewBox="0 0 935 38.2" enable-background="new 0 0 935 38.2" aria-labelledby="a8c-svg-title"><title id="a8c-svg-title">An Automattic Airline</title><path d="M317.1 38.2c-12.6 0-20.7-9.1-20.7-18.5v-1.2c0-9.6 8.2-18.5 20.7-18.5 12.6 0 20.8 8.9 20.8 18.5v1.2C337.9 29.1 329.7 38.2 317.1 38.2zM331.2 18.6c0-6.9-5-13-14.1-13s-14 6.1-14 13v0.9c0 6.9 5 13.1 14 13.1s14.1-6.2 14.1-13.1V18.6zM175 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7L157 1.3h5.5L182 36.8H175zM159.7 8.2L152 23.1h15.7L159.7 8.2zM212.4 38.2c-12.7 0-18.7-6.9-18.7-16.2V1.3h6.6v20.9c0 6.6 4.3 10.5 12.5 10.5 8.4 0 11.9-3.9 11.9-10.5V1.3h6.7V22C231.4 30.8 225.8 38.2 212.4 38.2zM268.6 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H268.6zM397.3 36.8V8.7l-1.8 3.1 -14.9 25h-3.3l-14.7-25 -1.8-3.1v28.1h-6.5V1.3h9.2l14 24.4 1.7 3 1.7-3 13.9-24.4h9.1v35.5H397.3zM454.4 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7l19.2-35.5h5.5l19.5 35.5H454.4zM439.1 8.2l-7.7 14.9h15.7L439.1 8.2zM488.4 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H488.4zM537.3 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H537.3zM569.3 36.8V4.6c2.7 0 3.7-1.4 3.7-3.4h2.8v35.5L569.3 36.8 569.3 36.8zM628 11.3c-3.2-2.9-7.9-5.7-14.2-5.7 -9.5 0-14.8 6.5-14.8 13.3v0.7c0 6.7 5.4 13 15.3 13 5.9 0 10.8-2.8 13.9-5.7l4 4.2c-3.9 3.8-10.5 7.1-18.3 7.1 -13.4 0-21.6-8.7-21.6-18.3v-1.2c0-9.6 8.9-18.7 21.9-18.7 7.5 0 14.3 3.1 18 7.1L628 11.3zM321.5 12.4c1.2 0.8 1.5 2.4 0.8 3.6l-6.1 9.4c-0.8 1.2-2.4 1.6-3.6 0.8l0 0c-1.2-0.8-1.5-2.4-0.8-3.6l6.1-9.4C318.7 11.9 320.3 11.6 321.5 12.4L321.5 12.4z"></path><path d="M37.5 36.7l-4.7-8.9H11.7l-4.6 8.9H0L19.4 0.8H25l19.7 35.9H37.5zM22 7.8l-7.8 15.1h15.9L22 7.8zM82.8 36.7l-23.3-24 -2.3-2.5v26.6h-6.7v-36H57l22.6 24 2.3 2.6V0.8h6.7v35.9H82.8z"></path><path d="M719.9 37l-4.8-8.9H694l-4.6 8.9h-7.1l19.5-36h5.6l19.8 36H719.9zM704.4 8l-7.8 15.1h15.9L704.4 8zM733 37V1h6.8v36H733zM781 37c-1.8 0-2.6-2.5-2.9-5.8l-0.2-3.7c-0.2-3.6-1.7-5.1-8.4-5.1h-12.8V37H750V1h19.6c10.8 0 15.7 4.3 15.7 9.9 0 3.9-2 7.7-9 9 7 0.5 8.5 3.7 8.6 7.9l0.1 3c0.1 2.5 0.5 4.3 2.2 6.1V37H781zM778.5 11.8c0-2.6-2.1-5.1-7.9-5.1h-13.8v10.8h14.4c5 0 7.3-2.4 7.3-5.2V11.8zM794.8 37V1h6.8v30.4h28.2V37H794.8zM836.7 37V1h6.8v36H836.7zM886.2 37l-23.4-24.1 -2.3-2.5V37h-6.8V1h6.5l22.7 24.1 2.3 2.6V1h6.8v36H886.2zM902.3 37V1H935v5.6h-26v9.2h20v5.5h-20v10.1h26V37H902.3z"></path></svg> |
374
|
|
|
</a> |
375
|
|
|
</div> |
376
|
|
|
<ul class="jp-footer__links" id="jp-footer__links-id"> |
377
|
|
|
<?php |
378
|
|
|
// Version number. |
379
|
|
|
self::the_footer_link( |
380
|
|
|
'https://jetpack.com', |
381
|
|
|
__( 'Jetpack version', 'jetpack' ), |
382
|
|
|
sprintf( |
383
|
|
|
/* Translators: placeholder is a number. */ |
384
|
|
|
__( 'Jetpack version %s', 'jetpack' ), |
385
|
|
|
JETPACK__VERSION |
386
|
|
|
), |
387
|
|
|
false |
388
|
|
|
); |
389
|
|
|
|
390
|
|
|
// About page. |
391
|
|
|
self::the_footer_link( |
392
|
|
|
$about_url, |
393
|
|
|
__( 'About Jetpack', 'jetpack' ), |
394
|
|
|
__( 'About', 'jetpack' ), |
395
|
|
|
$is_dev_mode_or_connected |
396
|
|
|
); |
397
|
|
|
|
398
|
|
|
// TOS. |
399
|
|
|
self::the_footer_link( |
400
|
|
|
'https://wordpress.com/tos/', |
401
|
|
|
__( 'WordPress.com Terms of Service', 'jetpack' ), |
402
|
|
|
_x( 'Terms', 'Navigation item', 'jetpack' ), |
403
|
|
|
false |
404
|
|
|
); |
405
|
|
|
|
406
|
|
|
// Privacy policy. |
407
|
|
|
self::the_footer_link( |
408
|
|
|
$privacy_url, |
409
|
|
|
__( "Automattic's Privacy Policy", 'jetpack' ), |
410
|
|
|
_x( 'Privacy', 'Navigation item', 'jetpack' ), |
411
|
|
|
$is_dev_mode_or_connected |
412
|
|
|
); |
413
|
|
|
|
414
|
|
|
// Network Admin Jetpack dashboard. |
415
|
|
|
if ( is_multisite() && current_user_can( 'jetpack_network_sites_page' ) ) { |
416
|
|
|
self::the_footer_link( |
417
|
|
|
network_admin_url( 'admin.php?page=jetpack' ), |
418
|
|
|
__( "Manage your network's Jetpack Sites", 'jetpack' ), |
419
|
|
|
_x( 'Network Sites', 'Navigation item', 'jetpack' ), |
420
|
|
|
true |
421
|
|
|
); |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
// Network Admin Jetpack settings. |
425
|
|
|
if ( is_multisite() && current_user_can( 'jetpack_network_settings_page' ) ) { |
426
|
|
|
self::the_footer_link( |
427
|
|
|
network_admin_url( 'admin.php?page=jetpack-settings' ), |
428
|
|
|
__( "Manage your network's Jetpack settings", 'jetpack' ), |
429
|
|
|
_x( 'Network Settings', 'Navigation item', 'jetpack' ), |
430
|
|
|
true |
431
|
|
|
); |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
// Legacy Modules page. |
435
|
|
View Code Duplication |
if ( current_user_can( 'manage_options' ) && $is_dev_mode_or_connected ) { |
436
|
|
|
self::the_footer_link( |
437
|
|
|
admin_url( 'admin.php?page=jetpack_modules' ), |
438
|
|
|
__( 'Access the full list of Jetpack modules available on your site', 'jetpack' ), |
439
|
|
|
_x( 'Modules', 'Navigation item', 'jetpack' ), |
440
|
|
|
true |
441
|
|
|
); |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
// Debugger. |
445
|
|
View Code Duplication |
if ( current_user_can( 'manage_options' ) ) { |
446
|
|
|
self::the_footer_link( |
447
|
|
|
admin_url( 'admin.php?page=jetpack-debugger' ), |
448
|
|
|
__( "Test your site's compatibility with Jetpack", 'jetpack' ), |
449
|
|
|
_x( 'Debug', 'Navigation item', 'jetpack' ), |
450
|
|
|
true |
451
|
|
|
); |
452
|
|
|
} |
453
|
|
|
?> |
454
|
|
|
</ul> |
455
|
|
|
</div> |
456
|
|
|
<?php |
457
|
|
|
} |
458
|
|
|
} |
459
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: