Completed
Push — add/admin-page-package ( 7976aa...cbfc2c )
by
unknown
136:41 queued 124:01
created

Jetpack_Admin_Page::add_actions()   B

Complexity

Conditions 10
Paths 11

Size

Total Lines 43

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 10
nc 11
nop 0
dl 0
loc 43
rs 7.6666
c 0
b 0
f 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
use Automattic\Jetpack\AdminPage\Page as AdminPage;
4
use Automattic\Jetpack\Identity_Crisis;
5
use Automattic\Jetpack\Redirect;
6
use Automattic\Jetpack\Status;
7
8
// Shared logic between Jetpack admin pages
9
abstract class Jetpack_Admin_Page {
10
11
    protected $admin_page;
12
	// Add page specific actions given the page hook
13
	abstract function add_page_actions( $hook );
14
15
	// Create a menu item for the page and returns the hook
16
	abstract function get_page_hook();
17
18
	// Enqueue and localize page specific scripts
19
	abstract function page_admin_scripts();
20
21
	// Render page specific HTML
22
	abstract function page_render();
23
24
	/**
25
	 * Should we block the page rendering because the site is in IDC?
26
	 *
27
	 * @var bool
28
	 */
29
	static $block_page_rendering_for_idc;
30
31
	/**
32
	 * Function called after admin_styles to load any additional needed styles.
33
	 *
34
	 * @since 4.3.0
35
	 */
36
	function additional_styles() {}
37
38
	/**
39
	 * The constructor.
40
	 */
41
	public function __construct() {
42
		add_action( 'jetpack_loaded', array( $this, 'on_jetpack_loaded' ) );
43
	}
44
45
	/**
46
	 * Runs on Jetpack being ready to load its packages.
47
	 *
48
	 * @param Jetpack $jetpack object.
49
	 */
50
	public function on_jetpack_loaded( $jetpack ) {
51
		$this->jetpack = $jetpack;
0 ignored issues
show
Bug introduced by
The property jetpack does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
52
53
		self::$block_page_rendering_for_idc = (
54
			Identity_Crisis::validate_sync_error_idc_option() && ! Jetpack_Options::get_option( 'safe_mode_confirmed' )
55
		);
56
	}
57
58
	function add_actions() {
59
		$is_offline_mode = ( new Status() )->is_offline_mode();
60
61
		// If user is not an admin and site is in Offline Mode or not connected yet then don't do anything.
62
		if ( ! current_user_can( 'manage_options' ) && ( $is_offline_mode || ! Jetpack::is_connection_ready() ) ) {
63
			return;
64
		}
65
66
		// Is Jetpack not connected and not offline?
67
		// True means that Jetpack is NOT connected and NOT in offline mode.
68
		// If Jetpack is connected OR in offline mode, this will be false.
69
		$connectable = ! Jetpack::is_connection_ready() && ! $is_offline_mode;
70
71
		// Don't add in the modules page unless modules are available!
72
		if ( $this->dont_show_if_not_active && $connectable ) {
0 ignored issues
show
Bug introduced by
The property dont_show_if_not_active does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
73
			return;
74
		}
75
76
		// Initialize menu item for the page in the admin
77
		$hook = $this->get_page_hook();
78
		$this->admin_page = new AdminPage( $hook );
79
80
		// Attach hooks common to all Jetpack admin pages based on the created hook.
81
		add_action( "load-$hook", array( $this, 'admin_help' ) );
82
		add_action( "load-$hook", array( $this, 'admin_page_load' ) );
83
		add_action( "admin_print_styles-$hook", array( $this, 'admin_styles' ) );
84
		add_action( "admin_print_scripts-$hook", array( $this, 'admin_scripts' ) );
85
86
		if ( ! self::$block_page_rendering_for_idc ) {
87
			add_action( "admin_print_styles-$hook", array( $this, 'additional_styles' ) );
88
		}
89
90
		// Check if the site plan changed and deactivate modules accordingly.
91
		add_action( 'current_screen', array( $this, 'check_plan_deactivate_modules' ) );
92
93
		// Attach page specific actions in addition to the above.
94
		$this->add_page_actions( $hook );
95
96
		// If the current user can connect Jetpack, Jetpack isn't connected, and is not in offline mode, let's prompt!
97
		if ( current_user_can( 'jetpack_connect' ) && $connectable ) {
98
			$this->add_connection_banner_actions();
99
		}
100
	}
101
102
	/**
103
	 * Hooks to add when Jetpack is not active or in offline mode for an user capable of connecting.
104
	 */
105
	private function add_connection_banner_actions() {
106
		global $pagenow;
107
		// If someone just activated Jetpack, let's show them a fullscreen connection banner.
108
		if ( ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'jetpack' === $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
109
			add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_banner_scripts' ) );
110
			add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_connect_button_scripts' ) );
111
			add_action( 'admin_print_styles', array( Jetpack::init(), 'admin_banner_styles' ) );
112
			add_action( 'admin_notices', array( 'Jetpack_Connection_Banner', 'render_connect_prompt_full_screen' ) );
113
			delete_transient( 'activated_jetpack' );
114
		}
115
116
		// If Jetpack not yet connected, but user is viewing one of the pages with a Jetpack connection banner.
117
		if ( ( 'index.php' === $pagenow || 'plugins.php' === $pagenow ) ) {
118
			add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_connect_button_scripts' ) );
119
		}
120
121
	}
122
123
	// Render the page with a common top and bottom part, and page specific content
124
	function render() {
125
		// We're in an IDC: we need a decision made before we show the UI again.
126
		if ( self::$block_page_rendering_for_idc ) {
127
			return;
128
		}
129
130
		// Check if we are looking at the main dashboard
131
		if ( isset( $_GET['page'] ) && 'jetpack' === $_GET['page'] ) {
132
			$this->page_render();
133
			return;
134
		}
135
		echo $this->admin_page->render( array( $this, 'page_render' ) );
136
	}
137
138
	function admin_help() {
139
		$this->jetpack->admin_help();
140
	}
141
142
	function admin_page_load() {
143
		// This is big.  For the moment, just call the existing one.
144
		$this->jetpack->admin_page_load();
145
	}
146
147
	// Add page specific scripts and jetpack stats for all menu pages
148
	function admin_scripts() {
149
		$this->page_admin_scripts(); // Delegate to inheriting class
150
		add_action( 'admin_footer', array( $this->jetpack, 'do_stats' ) );
151
	}
152
153
	// Enqueue the Jetpack admin stylesheet
154
	function admin_styles() {
155
		$min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
156
157
		wp_enqueue_style( 'jetpack-admin', plugins_url( "css/jetpack-admin{$min}.css", JETPACK__PLUGIN_FILE ), array( 'genericons' ), JETPACK__VERSION . '-20121016' );
158
		wp_style_add_data( 'jetpack-admin', 'rtl', 'replace' );
159
		wp_style_add_data( 'jetpack-admin', 'suffix', $min );
160
	}
161
162
	/**
163
	 * Checks if REST API is enabled.
164
	 *
165
	 * @since 4.4.2
166
	 *
167
	 * @return bool
168
	 */
169
	function is_rest_api_enabled() {
170
		return /** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
171
			apply_filters( 'rest_enabled', true ) &&
172
			/** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
173
			apply_filters( 'rest_authentication_errors', true );
174
	}
175
176
	/**
177
	 * Checks the site plan and deactivates modules that were active but are no longer included in the plan.
178
	 *
179
	 * @since 4.4.0
180
	 *
181
	 * @param $page
182
	 *
183
	 * @return array
184
	 */
185
	function check_plan_deactivate_modules( $page ) {
186
		if (
187
			( new Status() )->is_offline_mode()
188
			|| ! in_array(
189
				$page->base,
190
				array(
191
					'toplevel_page_jetpack',
192
					'admin_page_jetpack_modules',
193
					'jetpack_page_vaultpress',
194
					'jetpack_page_stats',
195
					'jetpack_page_akismet-key-config',
196
				)
197
			)
198
		) {
199
			return false;
200
		}
201
202
		$current = Jetpack_Plan::get();
203
204
		$to_deactivate = array();
205
		if ( isset( $current['product_slug'] ) ) {
206
			$active = Jetpack::get_active_modules();
207
			switch ( $current['product_slug'] ) {
208
				case 'jetpack_free':
209
				case 'jetpack_personal':
210
				case 'jetpack_personal_monthly':
211
					$to_deactivate = array( 'videopress', 'google-analytics', 'wordads', 'search' );
212
					break;
213
				case 'jetpack_premium':
214
				case 'jetpack_premium_monthly':
215
					$to_deactivate = array( 'google-analytics', 'search' );
216
					break;
217
			}
218
			$to_deactivate = array_intersect( $active, $to_deactivate );
219
220
			$to_leave_enabled = array();
221
			foreach ( $to_deactivate as $feature ) {
222
				if ( Jetpack_Plan::supports( $feature ) ) {
223
					$to_leave_enabled [] = $feature;
224
				}
225
			}
226
			$to_deactivate = array_diff( $to_deactivate, $to_leave_enabled );
227
228
			if ( ! empty( $to_deactivate ) ) {
229
				Jetpack::update_active_modules( array_filter( array_diff( $active, $to_deactivate ) ) );
230
			}
231
		}
232
		return array(
233
			'current'    => $current,
234
			'deactivate' => $to_deactivate,
235
		);
236
	}
237
238
	static function load_wrapper_styles() {
239
		$rtl = is_rtl() ? '.rtl' : '';
240
		wp_enqueue_style( 'dops-css', plugins_url( "_inc/build/admin{$rtl}.css", JETPACK__PLUGIN_FILE ), array(), JETPACK__VERSION );
241
		wp_enqueue_style( 'components-css', plugins_url( "_inc/build/style.min{$rtl}.css", JETPACK__PLUGIN_FILE ), array( 'wp-components' ), JETPACK__VERSION );
242
		$custom_css = '
243
			#wpcontent {
244
				padding-left: 0 !important;
245
			}
246
			#wpbody-content {
247
				background-color: #f6f6f6;
248
			}
249
250
			#jp-plugin-container .wrap {
251
				margin: 0 auto;
252
				max-width:45rem;
253
				padding: 0 1.5rem;
254
			}
255
			#jp-plugin-container.is-wide .wrap {
256
				max-width: 1040px;
257
			}
258
			#jp-plugin-container .wrap .jetpack-wrap-container {
259
				margin-top: 1em;
260
			}
261
			.wp-admin #dolly {
262
			    float: none;
263
			    position: relative;
264
			    right: 0;
265
			    left: 0;
266
			    top: 0;
267
			    padding: .625rem;
268
			    text-align: right;
269
			    background: #fff;
270
			    font-size: .75rem;
271
			    font-style: italic;
272
			    color: #87a6bc;
273
			    border-bottom: 1px #e9eff3 solid;
274
			}
275
		';
276
		wp_add_inline_style( 'dops-css', $custom_css );
277
	}
278
279
	public static function wrap_ui( $callback, $args = array() ) {
280
		$defaults          = array(
281
			'is-wide'  => false,
282
			'show-nav' => true,
283
		);
284
		$args              = wp_parse_args( $args, $defaults );
0 ignored issues
show
Documentation introduced by
$defaults is of type array<string,boolean,{"i...,"show-nav":"boolean"}>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
285
		$jetpack_admin_url = admin_url( 'admin.php?page=jetpack' );
286
		$jetpack_offline   = ( new Status() )->is_offline_mode();
287
		$jetpack_about_url = ( Jetpack::is_connection_ready() || $jetpack_offline )
288
			? admin_url( 'admin.php?page=jetpack_about' )
289
			: Redirect::get_url( 'jetpack' );
290
291
		$jetpack_privacy_url = ( Jetpack::is_connection_ready() || $jetpack_offline )
292
			? $jetpack_admin_url . '#/privacy'
293
			: Redirect::get_url( 'a8c-privacy' );
294
295
		?>
296
		<div id="jp-plugin-container" class="
297
		<?php
298
		if ( $args['is-wide'] ) {
299
			echo 'is-wide'; }
300
		?>
301
		">
302
303
			<div class="jp-masthead">
304
				<div class="jp-masthead__inside-container">
305
					<div class="jp-masthead__logo-container">
306
						<a class="jp-masthead__logo-link" href="<?php echo esc_url( $jetpack_admin_url ); ?>">
307
							<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>
308
						</a>
309
					</div>
310
					<?php
311
					if ( $args['show-nav'] ) :
312
						?>
313
						<div class="jp-masthead__nav">
314
							<?php
315
							if ( is_network_admin() ) {
316
								$current_screen = get_current_screen();
317
318
								$highlight_current_sites    = ( 'toplevel_page_jetpack-network' === $current_screen->id ? 'is-primary' : '' );
319
								$highlight_current_settings = ( 'jetpack_page_jetpack-settings-network' === $current_screen->id ? 'is-primary' : '' );
320
								?>
321
								<span class="dops-button-group">
322
									<?php
323 View Code Duplication
									if ( current_user_can( 'jetpack_network_sites_page' ) ) {
324
										?>
325
										<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>
326
										<?php
327
									} if ( current_user_can( 'jetpack_network_settings_page' ) ) {
328
										?>
329
										<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>
330
										<?php
331
									}
332
									?>
333
								</span>
334
							<?php } else { ?>
335
								<span class="dops-button-group">
336
									<a href="<?php echo esc_url( $jetpack_admin_url ); ?>" type="button" class="dops-button is-compact"><?php esc_html_e( 'Dashboard', 'jetpack' ); ?></a>
337
														<?php
338
														if ( current_user_can( 'jetpack_manage_modules' ) ) {
339
															?>
340
										<a href="<?php echo esc_url( $jetpack_admin_url . '#/settings' ); ?>" type="button" class="dops-button is-compact"><?php esc_html_e( 'Settings', 'jetpack' ); ?></a>
341
															<?php
342
														}
343
														?>
344
								</span>
345
							<?php } ?>
346
						</div>
347
					<?php endif; ?>
348
				</div>
349
			</div>
350
			<div class="wrap"><div id="jp-admin-notices" aria-live="polite"></div></div>
351
			<!-- START OF CALLBACK -->
352
			<?php
353
			ob_start();
354
			call_user_func( $callback );
355
			$callback_ui = ob_get_contents();
356
			ob_end_clean();
357
			echo $callback_ui;
358
			?>
359
			<!-- END OF CALLBACK -->
360
361
			<div class="jp-footer">
362
				<div class="jp-footer__a8c-attr-container">
363
					<a href="<?php echo esc_url( $jetpack_about_url ); ?>">
364
						<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>
365
					</a>
366
				</div>
367
				<ul class="jp-footer__links">
368
					<li class="jp-footer__link-item">
369
						<a href="<?php echo esc_url( Redirect::get_url( 'jetpack' ) ); ?>" target="_blank" rel="noopener noreferrer" class="jp-footer__link" title="<?php esc_html_e( 'Jetpack version', 'jetpack' ); ?>">Jetpack <?php echo esc_html( JETPACK__VERSION ); ?></a>
370
					</li>
371
					<li class="jp-footer__link-item">
372
						<a href="<?php echo esc_url( $jetpack_about_url ); ?>" title="<?php esc_attr__( 'About Jetpack', 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html__( 'About', 'jetpack' ); ?></a>
373
					</li>
374
					<li class="jp-footer__link-item">
375
						<a href="<?php echo esc_url( Redirect::get_url( 'wpcom-tos' ) ); ?>" target="_blank" rel="noopener noreferrer" title="<?php esc_html__( 'WordPress.com Terms of Service', 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Terms', 'Navigation item', 'jetpack' ); ?></a>
376
					</li>
377
					<li class="jp-footer__link-item">
378
						<a href="<?php echo esc_url( $jetpack_privacy_url ); ?>" rel="noopener noreferrer" title="<?php esc_html_e( "Automattic's Privacy Policy", 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Privacy', 'Navigation item', 'jetpack' ); ?></a>
379
					</li>
380 View Code Duplication
					<?php if ( is_multisite() && current_user_can( 'jetpack_network_sites_page' ) ) { ?>
381
						<li class="jp-footer__link-item">
382
							<a href="<?php echo esc_url( network_admin_url( 'admin.php?page=jetpack' ) ); ?>" title="<?php esc_html_e( "Manage your network's Jetpack Sites.", 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Network Sites', 'Navigation item', 'jetpack' ); ?></a>
383
						</li>
384
					<?php } ?>
385 View Code Duplication
					<?php if ( is_multisite() && current_user_can( 'jetpack_network_settings_page' ) ) { ?>
386
						<li class="jp-footer__link-item">
387
							<a href="<?php echo esc_url( network_admin_url( 'admin.php?page=jetpack-settings' ) ); ?>" title="<?php esc_html_e( "Manage your network's Jetpack Sites.", 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Network Settings', 'Navigation item', 'jetpack' ); ?></a>
388
						</li>
389
					<?php } ?>
390
					<?php if ( current_user_can( 'manage_options' ) ) { ?>
391
						<li class="jp-footer__link-item">
392
							<a href="<?php echo esc_url( admin_url( 'admin.php?page=jetpack_modules' ) ); ?>" title="<?php esc_html_e( 'Access the full list of Jetpack modules available on your site.', 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Modules', 'Navigation item', 'jetpack' ); ?></a>
393
						</li>
394
						<li class="jp-footer__link-item">
395
							<a href="<?php echo esc_url( admin_url( 'admin.php?page=jetpack-debugger' ) ); ?>" title="<?php esc_html_e( "Test your site's compatibility with Jetpack.", 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Debug', 'Navigation item', 'jetpack' ); ?></a>
396
						</li>
397
					<?php } ?>
398
				</ul>
399
			</div>
400
		</div>
401
		<?php
402
	}
403
}
404