Completed
Push — fix/jetpack-search-sync ( b948ef )
by
unknown
55:29 queued 37:22
created

Jetpack_Debugger::seconds_to_time()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
nc 5
nop 1
dl 0
loc 24
rs 9.2248
c 0
b 0
f 0
1
<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2
/**
3
 * Jetpack Debugger functionality allowing for self-service diagnostic information.
4
 *
5
 * @package jetpack
6
 */
7
8
/**
9
 * Class Jetpack_Debugger
10
 *
11
 * A namespacing class for functionality related to the in-plugin diagnostic tooling.
12
 */
13
class Jetpack_Debugger {
14
15
	/**
16
	 * Determine the active plan and normalize it for the debugger results.
17
	 *
18
	 * @return string The plan slug prepended with "JetpackPlan"
19
	 */
20
	private static function what_jetpack_plan() {
21
		$plan = Jetpack::get_active_plan();
22
		$plan = ! empty( $plan['class'] ) ? $plan['class'] : 'undefined';
23
		return 'JetpackPlan' . $plan;
24
	}
25
26
	/**
27
	 * Convert seconds to human readable time.
28
	 *
29
	 * A dedication function instead of using Core functionality to allow for output in seconds.
30
	 *
31
	 * @param int $seconds Number of seconds to convert to human time.
32
	 *
33
	 * @return string Human readable time.
34
	 */
35
	public static function seconds_to_time( $seconds ) {
36
		$seconds = intval( $seconds );
37
		$units   = array(
38
			'week'   => WEEK_IN_SECONDS,
39
			'day'    => DAY_IN_SECONDS,
40
			'hour'   => HOUR_IN_SECONDS,
41
			'minute' => MINUTE_IN_SECONDS,
42
			'second' => 1,
43
		);
44
		// specifically handle zero.
45
		if ( 0 === $seconds ) {
46
			return '0 seconds';
47
		}
48
		$human_readable = '';
49
		foreach ( $units as $name => $divisor ) {
50
			$quot = intval( $seconds / $divisor );
51
			if ( $quot ) {
52
				$human_readable .= "$quot $name";
53
				$human_readable .= ( abs( $quot ) > 1 ? 's' : '' ) . ', ';
54
				$seconds        -= $quot * $divisor;
55
			}
56
		}
57
		return substr( $human_readable, 0, -2 );
58
	}
59
60
	/**
61
	 * Returns 30 for use with a filter.
62
	 *
63
	 * To allow time for WP.com to run upstream testing, this function exists to increase the http_request_timeout value
64
	 * to 30.
65
	 *
66
	 * @return int 30
67
	 */
68
	public static function jetpack_increase_timeout() {
69
		return 30; // seconds.
70
	}
71
72
	/**
73
	 * Disconnect Jetpack and redirect user to connection flow.
74
	 */
75
	public static function disconnect_and_redirect() {
76
		if ( ! ( isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'], 'jp_disconnect' ) ) ) {
77
			return;
78
		}
79
80
		if ( isset( $_GET['disconnect'] ) && $_GET['disconnect'] ) {
81
			if ( Jetpack::is_active() ) {
82
				Jetpack::disconnect();
83
				wp_safe_redirect( Jetpack::admin_url() );
84
				exit;
85
			}
86
		}
87
	}
88
89
	/**
90
	 * Calls to WP.com to run the connection diagnostic testing suite.
91
	 *
92
	 * @return array|WP_Error Standard WP_HTTP return array: 'headers', 'body', 'response', 'cookies', 'filename' on success.
93
	 */
94
	public static function run_self_test() {
95
		$self_xml_rpc_url = site_url( 'xmlrpc.php' );
96
97
		$testsite_url = Jetpack::fix_url_for_bad_hosts( JETPACK__API_BASE . 'testsite/1/?url=' );
98
99
		add_filter( 'http_request_timeout', array( 'Jetpack_Debugger', 'jetpack_increase_timeout' ) );
100
101
		$response = wp_remote_get( $testsite_url . $self_xml_rpc_url );
102
103
		remove_filter( 'http_request_timeout', array( 'Jetpack_Debugger', 'jetpack_increase_timeout' ) );
104
105
		return $response;
106
107
	}
108
109
	/**
110
	 * Handles output to the browser for the in-plugin debugger.
111
	 */
112
	public static function jetpack_debug_display_handler() {
113
		if ( ! current_user_can( 'manage_options' ) ) {
114
			wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'jetpack' ) );
115
		}
116
117
		$user_id     = get_current_user_id();
118
		$user_tokens = Jetpack_Options::get_option( 'user_tokens' );
119
		if ( is_array( $user_tokens ) && array_key_exists( $user_id, $user_tokens ) ) {
120
			$user_token = $user_tokens[ $user_id ];
121
		} else {
122
			$user_token = '[this user has no token]';
123
		}
124
		unset( $user_tokens );
125
126
		$debug_info = "\r\n";
127
		foreach ( array(
128
			'CLIENT_ID'   => 'id',
129
			'BLOG_TOKEN'  => 'blog_token',
130
			'MASTER_USER' => 'master_user',
131
			'CERT'        => 'fallback_no_verify_ssl_certs',
132
			'TIME_DIFF'   => 'time_diff',
133
			'VERSION'     => 'version',
134
			'OLD_VERSION' => 'old_version',
135
			'PUBLIC'      => 'public',
136
		) as $label => $option_name ) {
137
			$debug_info .= "\r\n" . esc_html( $label . ': ' . Jetpack_Options::get_option( $option_name ) );
138
		}
139
140
		$debug_info .= "\r\n" . esc_html( 'USER_ID: ' . $user_id );
141
		$debug_info .= "\r\n" . esc_html( 'USER_TOKEN: ' . $user_token );
142
		$debug_info .= "\r\n" . esc_html( 'PHP_VERSION: ' . PHP_VERSION );
143
		$debug_info .= "\r\n" . esc_html( 'WORDPRESS_VERSION: ' . $GLOBALS['wp_version'] );
144
		$debug_info .= "\r\n" . esc_html( 'JETPACK__VERSION: ' . JETPACK__VERSION );
145
		$debug_info .= "\r\n" . esc_html( 'JETPACK__PLUGIN_DIR: ' . JETPACK__PLUGIN_DIR );
146
		$debug_info .= "\r\n" . esc_html( 'SITE_URL: ' . site_url() );
147
		$debug_info .= "\r\n" . esc_html( 'HOME_URL: ' . home_url() );
148
		$debug_info .= "\r\n" . esc_html( 'PLAN: ' . self::what_jetpack_plan() );
149
150
		$debug_info .= "\r\n";
151
152
		$debug_info .= "\r\n" . '-- SYNC Status -- ';
153
		require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-modules.php';
154
		$sync_module = Jetpack_Sync_Modules::get_module( 'full-sync' );
155
		if ( $sync_module ) {
156
			$sync_statuses              = $sync_module->get_status();
157
			$human_readable_sync_status = array();
158
			foreach ( $sync_statuses  as $sync_status => $sync_status_value ) {
159
				$human_readable_sync_status[ $sync_status ] =
160
					in_array( $sync_status, array( 'started', 'queue_finished', 'send_started', 'finished' ), true )
161
						? date( 'r', $sync_status_value ) : $sync_status_value;
162
			}
163
			/* translators: A string reporting status. Example: "started" */
164
			$debug_info .= "\r\n" . sprintf( esc_html__( 'Jetpack Sync Full Status: `%1$s`', 'jetpack' ), print_r( $human_readable_sync_status, 1 ) ); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
165
		}
166
167
		require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-sender.php';
168
169
		$queue = Jetpack_Sync_Sender::get_instance()->get_sync_queue();
170
171
		/* translators: The number of items waiting to be synced. */
172
		$debug_info .= "\r\n" . sprintf( esc_html__( 'Sync Queue size: %1$s', 'jetpack' ), $queue->size() );
173
		/* translators: Human-readable time since the oldest item in the sync queue. */
174
		$debug_info .= "\r\n" . sprintf( esc_html__( 'Sync Queue lag: %1$s', 'jetpack' ), self::seconds_to_time( $queue->lag() ) );
175
176
		$full_sync_queue = Jetpack_Sync_Sender::get_instance()->get_full_sync_queue();
177
178
		/* translators: The number of items waiting to be synced. */
179
		$debug_info .= "\r\n" . sprintf( esc_html__( 'Full Sync Queue size: %1$s', 'jetpack' ), $full_sync_queue->size() );
180
		/* translators: Human-readable time since the oldest item in the sync queue. */
181
		$debug_info .= "\r\n" . sprintf( esc_html__( 'Full Sync Queue lag: %1$s', 'jetpack' ), self::seconds_to_time( $full_sync_queue->lag() ) );
182
183
		require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-functions.php';
184
		$idc_urls = array(
185
			'home'       => Jetpack_Sync_Functions::home_url(),
186
			'siteurl'    => Jetpack_Sync_Functions::site_url(),
187
			'WP_HOME'    => Jetpack_Constants::is_defined( 'WP_HOME' ) ? Jetpack_Constants::get_constant( 'WP_HOME' ) : '',
188
			'WP_SITEURL' => Jetpack_Constants::is_defined( 'WP_SITEURL' ) ? Jetpack_Constants::get_constant( 'WP_SITEURL' ) : '',
189
		);
190
		/* translators: List of URLs. */
191
		$debug_info .= "\r\n" . esc_html( sprintf( 'Sync IDC URLs: %s', wp_json_encode( $idc_urls ) ) );
192
		/* translators: String of a current option. */
193
		$debug_info .= "\r\n" . esc_html( sprintf( 'Sync error IDC option: %s', wp_json_encode( Jetpack_Options::get_option( 'sync_error_idc' ) ) ) );
194
		/* translators: String of a current option. */
195
		$debug_info .= "\r\n" . esc_html( sprintf( 'Sync IDC Optin: %s', (string) Jetpack::sync_idc_optin() ) );
196
197
		$debug_info .= "\r\n";
198
199
		foreach ( array(
200
			'HTTP_HOST',
201
			'SERVER_PORT',
202
			'HTTPS',
203
			'GD_PHP_HANDLER',
204
			'HTTP_AKAMAI_ORIGIN_HOP',
205
			'HTTP_CF_CONNECTING_IP',
206
			'HTTP_CLIENT_IP',
207
			'HTTP_FASTLY_CLIENT_IP',
208
			'HTTP_FORWARDED',
209
			'HTTP_FORWARDED_FOR',
210
			'HTTP_INCAP_CLIENT_IP',
211
			'HTTP_TRUE_CLIENT_IP',
212
			'HTTP_X_CLIENTIP',
213
			'HTTP_X_CLUSTER_CLIENT_IP',
214
			'HTTP_X_FORWARDED',
215
			'HTTP_X_FORWARDED_FOR',
216
			'HTTP_X_IP_TRAIL',
217
			'HTTP_X_REAL_IP',
218
			'HTTP_X_VARNISH',
219
			'REMOTE_ADDR',
220
		) as $header ) {
221
			if ( isset( $_SERVER[ $header ] ) ) {
222
				$debug_info .= "\r\n" . esc_html( $header . ': ' . $_SERVER[ $header ] );
223
			}
224
		}
225
226
		$debug_info .= "\r\n" . esc_html( 'PROTECT_TRUSTED_HEADER: ' . wp_json_encode( get_site_option( 'trusted_ip_header' ) ) );
227
228
		$debug_info    .= "\r\n\r\nTEST RESULTS:\r\n\r\n";
229
		$debug_raw_info = '';
230
231
		$tests = array();
232
233
		$tests['HTTP']['result']       = wp_remote_get( preg_replace( '/^https:/', 'http:', JETPACK__API_BASE ) . 'test/1/' );
234
		$tests['HTTP']['fail_message'] = esc_html__( 'Your site isn’t reaching the Jetpack servers.', 'jetpack' );
235
236
		$tests['HTTPS']['result']       = wp_remote_get( preg_replace( '/^http:/', 'https:', JETPACK__API_BASE ) . 'test/1/' );
237
		$tests['HTTPS']['fail_message'] = esc_html__( 'Your site isn’t securely reaching the Jetpack servers.', 'jetpack' );
238
239
		$identity_crisis_message = '';
240
		$identity_crisis         = Jetpack::check_identity_crisis();
241
		if ( $identity_crisis ) {
242
			$identity_crisis_message .= sprintf(
243
				/* translators: Two URLs. The first is the locally-recorded value, the second is the value as recorded on WP.com. */
244
				__( 'Your url is set as `%1$s`, but your WordPress.com connection lists it as `%2$s`!', 'jetpack' ),
245
				$identity_crisis['home'],
246
				$identity_crisis['wpcom_home']
247
			);
248
			$identity_crisis = new WP_Error( 'identity-crisis', $identity_crisis_message, $identity_crisis );
249
		} else {
250
			$identity_crisis = 'PASS';
251
		}
252
		$tests['IDENTITY_CRISIS']['result']       = $identity_crisis;
253
		$tests['IDENTITY_CRISIS']['fail_message'] = esc_html__( 'Something has gotten mixed up in your Jetpack Connection!', 'jetpack' );
254
255
		$tests['SELF']['result'] = self::run_self_test();
256
257
		if ( is_wp_error( $tests['SELF']['result'] ) && 0 == strpos( $tests['SELF']['result']->get_error_message(), 'Operation timed out' ) ) {
258
			$tests['SELF']['fail_message'] = esc_html__( 'Your site did not get a response from our debugging service in the expected timeframe. If you are not experiencing other issues, this could be due to a slow connection between your site and our server.', 'jetpack' );
259
		} else {
260
			$tests['SELF']['fail_message'] = esc_html__( 'It looks like your site can not communicate properly with Jetpack.', 'jetpack' );
261
		}
262
263
		?>
264
		<div class="wrap">
265
			<h2><?php esc_html_e( 'Debugging Center', 'jetpack' ); ?></h2>
266
				<h3><?php esc_html_e( "Testing your site's compatibility with Jetpack...", 'jetpack' ); ?></h3>
267
				<div class="jetpack-debug-test-container">
268
					<?php
269
					ob_start();
270
					foreach ( $tests as $test_name => $test_info ) :
271
						$response_code = wp_remote_retrieve_response_code( $test_info['result'] );
272
						if ( 'PASS' !== $test_info['result'] && ( is_wp_error( $test_info['result'] ) ||
273
								false === ( $response_code ) ||
274
								200 !== intval( $response_code ) ) ) {
275
							$debug_info .= $test_name . ": FAIL\r\n";
276
							?>
277
							<div class="jetpack-test-error">
278
							<p>
279
								<a class="jetpack-test-heading" href="#"><?php echo esc_html( $test_info['fail_message'] ); ?>
280
									<span class="noticon noticon-collapse"></span>
281
								</a>
282
							</p>
283
						<pre class="jetpack-test-details"><?php echo esc_html( $test_name ); ?>:
284
							<?php echo esc_html( is_wp_error( $test_info['result'] ) ? $test_info['result']->get_error_message() : print_r( $test_info['result'], 1 ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r ?></pre>
285
							</div>
286
							<?php
287
						} else {
288
							$debug_info .= $test_name . ": PASS\r\n";
289
						}
290
						$debug_raw_info .= "\r\n\r\n" . $test_name . "\r\n" . esc_html( is_wp_error( $test_info['result'] ) ? $test_info['result']->get_error_message() : print_r( $test_info['result'], 1 ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
291
						?>
292
						<?php
293
					endforeach;
294
					$html = ob_get_clean();
295
296
					if ( '' === trim( $html ) ) {
297
						echo '<div class="jetpack-tests-succed">' . esc_html__( 'Your Jetpack setup looks a-okay!', 'jetpack' ) . '</div>';
298
					} else {
299
						echo '<h3>' . esc_html__( 'There seems to be a problem with your site’s ability to communicate with Jetpack!', 'jetpack' ) . '</h3>';
300
						echo $html;
301
					}
302
					$debug_info .= "\r\n\r\nRAW TEST RESULTS:" . $debug_raw_info . "\r\n";
303
					?>
304
				</div>
305
306
			<div class="entry-content">
307
				<h3><?php esc_html_e( 'Trouble with Jetpack?', 'jetpack' ); ?></h3>
308
				<h4><?php esc_html_e( 'It may be caused by one of these issues, which you can diagnose yourself:', 'jetpack' ); ?></h4>
309
				<ol>
310
					<?php /* translators: URLs to Jetpack support pages. */ ?>
311
					<li><b><em><?php esc_html_e( 'A known issue.', 'jetpack' ); ?></em></b>  <?php echo sprintf( __( 'Some themes and plugins have <a href="%1$s" target="_blank">known conflicts</a> with Jetpack – check the <a href="%2$s" target="_blank">list</a>. (You can also browse the <a href="%3$s" target="_blank">Jetpack support pages</a> or <a href="%4$s" target="_blank">Jetpack support forum</a> to see if others have experienced and solved the problem.)', 'jetpack' ), 'http://jetpack.com/support/getting-started-with-jetpack/known-issues/', 'http://jetpack.com/support/getting-started-with-jetpack/known-issues/', 'http://jetpack.com/support/', 'https://wordpress.org/support/plugin/jetpack' ); ?></li>
312
					<li><b><em><?php esc_html_e( 'An incompatible plugin.', 'jetpack' ); ?></em></b>  <?php esc_html_e( "Find out by disabling all plugins except Jetpack. If the problem persists, it's not a plugin issue. If the problem is solved, turn your plugins on one by one until the problem pops up again – there's the culprit! Let us know, and we'll try to help.", 'jetpack' ); ?></li>
313
					<li>
314
						<b><em><?php esc_html_e( 'A theme conflict.', 'jetpack' ); ?></em></b>
315
						<?php
316
							$default_theme = wp_get_theme( WP_DEFAULT_THEME );
317
318
						if ( $default_theme->exists() ) {
319
							/* translators: %s is the name of a theme */
320
							echo esc_html( sprintf( __( "If your problem isn't known or caused by a plugin, try activating %s (the default WordPress theme).", 'jetpack' ), $default_theme->get( 'Name' ) ) );
321
						} else {
322
							esc_html_e( "If your problem isn't known or caused by a plugin, try activating the default WordPress theme.", 'jetpack' );
323
						}
324
						?>
325
						<?php esc_html_e( "If this solves the problem, something in your theme is probably broken – let the theme's author know.", 'jetpack' ); ?>
326
					</li>
327
					<?php /* translators: The URL to the site's xmlrpc.php file. */ ?>
328
					<li><b><em><?php esc_html_e( 'A problem with your XMLRPC file.', 'jetpack' ); ?></em></b>  <?php echo sprintf( __( 'Load your <a href="%s">XMLRPC file</a>. It should say “XML-RPC server accepts POST requests only.” on a line by itself.', 'jetpack' ), site_url( 'xmlrpc.php' ) ); ?>
329
						<ul>
330
							<li>- <?php esc_html_e( "If it's not by itself, a theme or plugin is displaying extra characters. Try steps 2 and 3.", 'jetpack' ); ?></li>
331
							<li>- <?php esc_html_e( 'If you get a 404 message, contact your web host. Their security may block XMLRPC.', 'jetpack' ); ?></li>
332
						</ul>
333
					</li>
334
					<?php if ( current_user_can( 'jetpack_disconnect' ) && Jetpack::is_active() ) : ?>
335
						<li>
336
							<strong><em><?php esc_html_e( 'A connection problem with WordPress.com.', 'jetpack' ); ?></em></strong>
337
							<?php
338
							echo wp_kses(
339
								sprintf(
340
									/* translators: URL to disconnect and reconnect Jetpack. */
341
									__( 'Jetpack works by connecting to WordPress.com for a lot of features. Sometimes, when the connection gets messed up, you need to disconnect and reconnect to get things working properly. <a href="%s">Disconnect from WordPress.com</a>', 'jetpack' ),
342
									wp_nonce_url(
343
										Jetpack::admin_url(
344
											array(
345
												'page' => 'jetpack-debugger',
346
												'disconnect' => true,
347
											)
348
										),
349
										'jp_disconnect',
350
										'nonce'
351
									)
352
								),
353
								array(
354
									'a' => array(
355
										'href'  => array(),
356
										'class' => array(),
357
									),
358
								)
359
							);
360
							?>
361
						</li>
362
					<?php endif; ?>
363
				</ol>
364
				<h4><?php esc_html_e( 'Still having trouble?', 'jetpack' ); ?></h4>
365
				<?php /* translators: URL for Jetpack support. */ ?>
366
				<p><b><em><?php esc_html_e( 'Ask us for help!', 'jetpack' ); ?></em></b>  <?php echo sprintf( __( '<a href="%s">Contact our Happiness team</a>. When you do, please include the full debug information below.', 'jetpack' ), 'https://jetpack.com/contact-support/' ); ?></p>
367
				<hr />
368
				<?php if ( Jetpack::is_active() ) : ?>
369
					<div id="connected-user-details">
370
						<h3><?php esc_html_e( 'More details about your Jetpack settings', 'jetpack' ); ?></h3>
371
						<p>
372
						<?php
373
						printf(
374
							/* translators: %s is an e-mail address */
375
							__( 'The primary connection is owned by <strong>%s</strong>\'s WordPress.com account.', 'jetpack' ),
376
							esc_html( Jetpack::get_master_user_email() )
377
						);
378
						?>
379
							</p>
380
					</div>
381
				<?php else : ?>
382
					<div id="dev-mode-details">
383
						<p>
384
						<?php
385
						printf(
386
							/* translators: Link to a Jetpack support page. */
387
							__( 'Would you like to use Jetpack on your local development site? You can do so thanks to <a href="%s">Jetpack\'s development mode</a>.', 'jetpack' ),
388
							'https://jetpack.com/support/development-mode/'
389
						);
390
						?>
391
							</p>
392
					</div>
393
				<?php endif; ?>
394
				<?php
395
				if (
396
					current_user_can( 'jetpack_manage_modules' )
397
					&& ( Jetpack::is_development_mode() || Jetpack::is_active() )
398
				) {
399
					printf(
400
						'<p><a href="%1$s">%2$s</a></p>',
401
						Jetpack::admin_url( 'page=jetpack_modules' ),
402
						esc_html__( 'Access the full list of Jetpack modules available on your site.', 'jetpack' )
403
					);
404
				}
405
				?>
406
			</div>
407
		<hr />
408
		<div id="toggle_debug_info"><?php esc_html_e( 'Advanced Debug Results', 'jetpack' ); ?></div>
409
			<div id="debug_info_div">
410
			<h4><?php esc_html_e( 'Debug Info', 'jetpack' ); ?></h4>
411
			<div id="debug_info"><pre><?php echo esc_html( $debug_info ); ?></pre></div>
412
		</div>
413
		</div>
414
		<?php
415
	}
416
417
	/**
418
	 * Outputs html needed within the <head> for the in-plugin debugger page.
419
	 */
420
	public static function jetpack_debug_admin_head() {
421
422
		Jetpack_Admin_Page::load_wrapper_styles();
423
		?>
424
		<style type="text/css">
425
426
			.jetpack-debug-test-container {
427
				margin-top: 20px;
428
				margin-bottom: 30px;
429
			}
430
431
			.jetpack-tests-succed {
432
				font-size: large;
433
				color: #8BAB3E;
434
			}
435
436
			.jetpack-test-details {
437
				margin: 4px 6px;
438
				padding: 10px;
439
				overflow: auto;
440
				display: none;
441
			}
442
443
			.jetpack-test-error {
444
				margin-bottom: 10px;
445
				background: #FFEBE8;
446
				border: solid 1px #C00;
447
				border-radius: 3px;
448
			}
449
450
			.jetpack-test-error p {
451
				margin: 0;
452
				padding: 0;
453
			}
454
455
			.jetpack-test-error a.jetpack-test-heading {
456
				padding: 4px 6px;
457
				display: block;
458
				text-decoration: none;
459
				color: inherit;
460
			}
461
462
			.jetpack-test-error .noticon {
463
				float: right;
464
			}
465
466
			.formbox {
467
				margin: 0 0 25px 0;
468
			}
469
470
			.formbox input[type="text"], .formbox input[type="email"], .formbox input[type="url"], .formbox textarea, #debug_info_div {
471
				border: 1px solid #e5e5e5;
472
				border-radius: 11px;
473
				box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);
474
				color: #666;
475
				font-size: 14px;
476
				padding: 10px;
477
				width: 97%;
478
			}
479
			#debug_info_div {
480
				border-radius: 0;
481
				margin-top: 16px;
482
				background: #FFF;
483
				padding: 16px;
484
			}
485
			.formbox .contact-support input[type="submit"] {
486
				float: right;
487
				margin: 0 !important;
488
				border-radius: 20px !important;
489
				cursor: pointer;
490
				font-size: 13pt !important;
491
				height: auto !important;
492
				margin: 0 0 2em 10px !important;
493
				padding: 8px 16px !important;
494
				background-color: #ddd;
495
				border: 1px solid rgba(0,0,0,0.05);
496
				border-top-color: rgba(255,255,255,0.1);
497
				border-bottom-color: rgba(0,0,0,0.15);
498
				color: #333;
499
				font-weight: 400;
500
				display: inline-block;
501
				text-align: center;
502
				text-decoration: none;
503
			}
504
505
			.formbox span.errormsg {
506
				margin: 0 0 10px 10px;
507
				color: #d00;
508
				display: none;
509
			}
510
511
			.formbox.error span.errormsg {
512
				display: block;
513
			}
514
515
			#debug_info_div, #toggle_debug_info, #debug_info_div p {
516
				font-size: 12px;
517
			}
518
519
			#category_div ul li {
520
				list-style-type: none;
521
			}
522
523
		</style>
524
		<script type="text/javascript">
525
		jQuery( document ).ready( function($) {
526
527
			$( '#debug_info' ).prepend( 'jQuery version: ' + jQuery.fn.jquery + "\r\n" );
528
			$( '#debug_form_info' ).prepend( 'jQuery version: ' + jQuery.fn.jquery + "\r\n" );
529
530
			$( '.jetpack-test-error .jetpack-test-heading' ).on( 'click', function() {
531
				$( this ).parents( '.jetpack-test-error' ).find( '.jetpack-test-details' ).slideToggle();
532
				return false;
533
			} );
534
535
		} );
536
		</script>
537
		<?php
538
	}
539
}
540