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.9 11.9.1 11.9.2 11.9.3 12.0 12.0.1 12.0.2 12.1 12.1.1 12.1.2 12.2 12.2.1 12.2.2 12.3 12.3.1 12.4 12.4.1 12.5 12.5.1 12.6 12.6.1 12.6.2 12.6.3 12.7 12.7.1 12.7.2 12.8 12.8.1 12.8.2 12.9 12.9.1 12.9.2 12.9.3 12.9.4 13.0 13.0.1 13.1 13.1.1 13.1.2 13.1.3 13.1.4 13.2 13.2.1 13.2.2 13.2.3 13.3 13.3.1 13.3.2 13.4 13.4.1 13.4.2 13.4.3 13.4.4 13.5 13.5.1 13.6 13.6.1 13.7 13.7.1 13.8 13.8.1 13.8.2 13.9 13.9.1 14.0 14.1 14.2 14.2.1 14.3 14.4 14.4.1 14.5 14.6 14.7 14.8 14.9 14.9.1 15.0 15.0.1 15.0.2 15.1 15.1.1 15.2 15.3 15.3.1 15.4 15.5 15.6 15.7 15.7-a.1 15.7-a.3 15.7-a.5 15.7-a.7 15.7-beta
jetpack / class.jetpack-debugger.php
jetpack Last commit date
3rd-party 7 years ago _inc 7 years ago bin 7 years ago css 7 years ago images 7 years ago json-endpoints 7 years ago languages 7 years ago logs 9 years ago modules 7 years ago sal 7 years ago scss 7 years ago sync 7 years ago views 8 years ago wpcom-test-backup 10 years ago .svnignore 12 years ago CODE-OF-CONDUCT.md 9 years ago changelog.txt 7 years ago class.frame-nonce-preview.php 9 years ago class.jetpack-admin.php 8 years ago class.jetpack-autoupdate.php 8 years ago class.jetpack-bbpress-json-api-compat.php 9 years ago class.jetpack-cli.php 7 years ago class.jetpack-client-server.php 8 years ago class.jetpack-client.php 8 years ago class.jetpack-connection-banner.php 7 years ago class.jetpack-constants.php 8 years ago class.jetpack-data.php 7 years ago class.jetpack-debugger.php 8 years ago class.jetpack-error.php 10 years ago class.jetpack-heartbeat.php 9 years ago class.jetpack-idc.php 8 years ago class.jetpack-ixr-client.php 10 years ago class.jetpack-jitm.php 8 years ago class.jetpack-modules-list-table.php 8 years ago class.jetpack-network-sites-list-table.php 9 years ago class.jetpack-network.php 8 years ago class.jetpack-options.php 7 years ago class.jetpack-post-images.php 7 years ago class.jetpack-signature.php 8 years ago class.jetpack-tracks.php 8 years ago class.jetpack-twitter-cards.php 7 years ago class.jetpack-user-agent.php 8 years ago class.jetpack-xmlrpc-server.php 7 years ago class.jetpack.php 7 years ago class.json-api-endpoints.php 7 years ago class.json-api.php 7 years ago class.photon.php 7 years ago composer.json 7 years ago functions.compat.php 7 years ago functions.gallery.php 8 years ago functions.global.php 7 years ago functions.opengraph.php 8 years ago functions.photon.php 8 years ago jetpack.php 7 years ago json-api-config.php 10 years ago json-endpoints.php 8 years ago locales.php 9 years ago phpcs.xml 7 years ago readme.txt 7 years ago require-lib.php 8 years ago uninstall.php 8 years ago wpml-config.xml 10 years ago
class.jetpack-debugger.php
629 lines
1 <?php
2
3 class Jetpack_Debugger {
4
5 private static function is_jetpack_support_open() {
6 try {
7 $url = add_query_arg( 'ver', JETPACK__VERSION, 'https://jetpack.com/is-support-open/' );
8 $response = wp_remote_request( esc_url_raw( $url ) );
9 if ( is_wp_error( $response ) ) {
10 return false;
11 }
12 $body = wp_remote_retrieve_body( $response );
13 $json = json_decode( $body );
14 return ( ( bool ) $json->is_support_open );
15 }
16 catch ( Exception $e ) {
17 return true;
18 }
19 }
20
21 private static function what_jetpack_plan() {
22 $plan = Jetpack::get_active_plan();
23 $plan = ! empty( $plan['class'] ) ? $plan['class'] : 'undefined';
24 return 'JetpackPlan' . $plan;
25 }
26
27 static function seconds_to_time( $seconds ) {
28 $units = array(
29 "week" => 7*24*3600,
30 "day" => 24*3600,
31 "hour" => 3600,
32 "minute" => 60,
33 "second" => 1,
34 );
35 // specifically handle zero
36 if ( $seconds == 0 ) return "0 seconds";
37 $human_readable = "";
38 foreach ( $units as $name => $divisor ) {
39 if ( $quot = intval( $seconds / $divisor) ) {
40 $human_readable .= "$quot $name";
41 $human_readable .= ( abs( $quot ) > 1 ? "s" : "" ) . ", ";
42 $seconds -= $quot * $divisor;
43 }
44 }
45 return substr( $human_readable, 0, -2 );
46 }
47
48 public static function jetpack_increase_timeout() {
49 return 30; // seconds
50 }
51
52 public static function disconnect_and_redirect() {
53 $can_disconnect = isset( $_GET['disconnect'] ) && $_GET['disconnect'] && isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'], 'jp_disconnect' );
54 if ( $can_disconnect ) {
55 if ( Jetpack::is_active() ) {
56 Jetpack::disconnect();
57 wp_safe_redirect( Jetpack::admin_url() );
58 exit;
59 }
60 }
61 }
62
63 public static function run_self_test() {
64 $self_xml_rpc_url = site_url( 'xmlrpc.php' );
65
66 $testsite_url = Jetpack::fix_url_for_bad_hosts( JETPACK__API_BASE . 'testsite/1/?url=' );
67
68 add_filter( 'http_request_timeout', array( 'Jetpack_Debugger', 'jetpack_increase_timeout' ) );
69
70 $response = wp_remote_get( $testsite_url . $self_xml_rpc_url );
71
72 remove_filter( 'http_request_timeout', array( 'Jetpack_Debugger', 'jetpack_increase_timeout' ) );
73
74 return $response;
75
76 }
77
78 public static function jetpack_debug_display_handler() {
79 if ( ! current_user_can( 'manage_options' ) )
80 wp_die( esc_html__('You do not have sufficient permissions to access this page.', 'jetpack' ) );
81
82 $current_user = wp_get_current_user();
83
84 $user_id = get_current_user_id();
85 $user_tokens = Jetpack_Options::get_option( 'user_tokens' );
86 if ( is_array( $user_tokens ) && array_key_exists( $user_id, $user_tokens ) ) {
87 $user_token = $user_tokens[$user_id];
88 } else {
89 $user_token = '[this user has no token]';
90 }
91 unset( $user_tokens );
92
93 $debug_info = "\r\n";
94 foreach ( array(
95 'CLIENT_ID' => 'id',
96 'BLOG_TOKEN' => 'blog_token',
97 'MASTER_USER' => 'master_user',
98 'CERT' => 'fallback_no_verify_ssl_certs',
99 'TIME_DIFF' => 'time_diff',
100 'VERSION' => 'version',
101 'OLD_VERSION' => 'old_version',
102 'PUBLIC' => 'public',
103 ) as $label => $option_name ) {
104 $debug_info .= "\r\n" . esc_html( $label . ": " . Jetpack_Options::get_option( $option_name ) );
105 }
106
107 $debug_info .= "\r\n" . esc_html( "USER_ID: " . $user_id );
108 $debug_info .= "\r\n" . esc_html( "USER_TOKEN: " . $user_token );
109 $debug_info .= "\r\n" . esc_html( "PHP_VERSION: " . PHP_VERSION );
110 $debug_info .= "\r\n" . esc_html( "WORDPRESS_VERSION: " . $GLOBALS['wp_version'] );
111 $debug_info .= "\r\n" . esc_html( "JETPACK__VERSION: " . JETPACK__VERSION );
112 $debug_info .= "\r\n" . esc_html( "JETPACK__PLUGIN_DIR: " . JETPACK__PLUGIN_DIR );
113 $debug_info .= "\r\n" . esc_html( "SITE_URL: " . site_url() );
114 $debug_info .= "\r\n" . esc_html( "HOME_URL: " . home_url() );
115 $debug_info .= "\r\n" . esc_html( "PLAN: " . self::what_jetpack_plan() );
116
117 $debug_info .= "\r\n";
118 require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-modules.php';
119 $sync_module = Jetpack_Sync_Modules::get_module( 'full-sync' );
120 $sync_statuses = $sync_module->get_status();
121 $human_readable_sync_status = array();
122 foreach( $sync_statuses as $sync_status => $sync_status_value ) {
123 $human_readable_sync_status[ $sync_status ] =
124 in_array( $sync_status, array( 'started', 'queue_finished', 'send_started', 'finished' ) )
125 ? date( 'r', $sync_status_value ) : $sync_status_value ;
126 }
127
128 $debug_info .= "\r\n". sprintf( esc_html__( 'Jetpack Sync Full Status: `%1$s`', 'jetpack' ), print_r( $human_readable_sync_status, 1 ) );
129
130 require_once JETPACK__PLUGIN_DIR. 'sync/class.jetpack-sync-sender.php';
131
132 $queue = Jetpack_Sync_Sender::get_instance()->get_sync_queue();
133
134 $debug_info .= "\r\n". sprintf( esc_html__( 'Sync Queue size: %1$s', 'jetpack' ), $queue->size() );
135 $debug_info .= "\r\n". sprintf( esc_html__( 'Sync Queue lag: %1$s', 'jetpack' ), self::seconds_to_time( $queue->lag() ) );
136
137 $full_sync_queue = Jetpack_Sync_Sender::get_instance()->get_full_sync_queue();
138
139 $debug_info .= "\r\n". sprintf( esc_html__( 'Full Sync Queue size: %1$s', 'jetpack' ), $full_sync_queue->size() );
140 $debug_info .= "\r\n". sprintf( esc_html__( 'Full Sync Queue lag: %1$s', 'jetpack' ), self::seconds_to_time( $full_sync_queue->lag() ) );
141
142 require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-functions.php';
143 $idc_urls = array(
144 'home' => Jetpack_Sync_Functions::home_url(),
145 'siteurl' => Jetpack_Sync_Functions::site_url(),
146 'WP_HOME' => Jetpack_Constants::is_defined( 'WP_HOME' ) ? Jetpack_Constants::get_constant( 'WP_HOME' ) : '',
147 'WP_SITEURL' => Jetpack_Constants::is_defined( 'WP_SITEURL' ) ? Jetpack_Constants::get_constant( 'WP_SITEURL' ) : '',
148 );
149 $debug_info .= "\r\n". esc_html( sprintf( 'Sync IDC URLs: %s', json_encode( $idc_urls ) ) );
150 $debug_info .= "\r\n". esc_html( sprintf( 'Sync error IDC option: %s', json_encode( Jetpack_Options::get_option( 'sync_error_idc' ) ) ) );
151 $debug_info .= "\r\n". esc_html( sprintf( 'Sync IDC Optin: %s', (string) Jetpack::sync_idc_optin() ) );
152
153 $debug_info .= "\r\n";
154
155 foreach ( array (
156 'HTTP_HOST',
157 'SERVER_PORT',
158 'HTTPS',
159 'GD_PHP_HANDLER',
160 'HTTP_AKAMAI_ORIGIN_HOP',
161 'HTTP_CF_CONNECTING_IP',
162 'HTTP_CLIENT_IP',
163 'HTTP_FASTLY_CLIENT_IP',
164 'HTTP_FORWARDED',
165 'HTTP_FORWARDED_FOR',
166 'HTTP_INCAP_CLIENT_IP',
167 'HTTP_TRUE_CLIENT_IP',
168 'HTTP_X_CLIENTIP',
169 'HTTP_X_CLUSTER_CLIENT_IP',
170 'HTTP_X_FORWARDED',
171 'HTTP_X_FORWARDED_FOR',
172 'HTTP_X_IP_TRAIL',
173 'HTTP_X_REAL_IP',
174 'HTTP_X_VARNISH',
175 'REMOTE_ADDR'
176 ) as $header ) {
177 if ( isset( $_SERVER[ $header ] ) ) {
178 $debug_info .= "\r\n" . esc_html( $header . ": " . $_SERVER[ $header ] );
179 }
180 }
181
182 $debug_info .= "\r\n" . esc_html( "PROTECT_TRUSTED_HEADER: " . json_encode( get_site_option( 'trusted_ip_header' ) ) );
183
184 $debug_info .= "\r\n\r\nTEST RESULTS:\r\n\r\n";
185 $debug_raw_info = '';
186
187
188 $tests = array();
189
190 $tests['HTTP']['result'] = wp_remote_get( preg_replace( '/^https:/', 'http:', JETPACK__API_BASE ) . 'test/1/' );
191 $tests['HTTP']['fail_message'] = esc_html__( 'Your site isn’t reaching the Jetpack servers.', 'jetpack' );
192
193 $tests['HTTPS']['result'] = wp_remote_get( preg_replace( '/^http:/', 'https:', JETPACK__API_BASE ) . 'test/1/' );
194 $tests['HTTPS']['fail_message'] = esc_html__( 'Your site isn’t securely reaching the Jetpack servers.', 'jetpack' );
195
196 $identity_crisis_message = '';
197 if ( $identity_crisis = Jetpack::check_identity_crisis() ) {
198 $identity_crisis_message .= sprintf(
199 __( 'Your url is set as `%1$s`, but your WordPress.com connection lists it as `%2$s`!', 'jetpack' ),
200 $identity_crisis['home'],
201 $identity_crisis['wpcom_home']
202 );
203 $identity_crisis = new WP_Error( 'identity-crisis', $identity_crisis_message, $identity_crisis );
204 } else {
205 $identity_crisis = 'PASS';
206 }
207 $tests['IDENTITY_CRISIS']['result'] = $identity_crisis;
208 $tests['IDENTITY_CRISIS']['fail_message'] = esc_html__( 'Something has gotten mixed up in your Jetpack Connection!', 'jetpack' );
209
210 $tests['SELF']['result'] = self::run_self_test();
211
212 if ( is_wp_error( $tests['SELF']['result'] ) && 0 == strpos( $tests['SELF']['result']->get_error_message(), 'Operation timed out' ) ){
213 $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' );
214 } else {
215 $tests['SELF']['fail_message'] = esc_html__( 'It looks like your site can not communicate properly with Jetpack.', 'jetpack' );
216 }
217
218 ?>
219 <div class="wrap">
220 <h2><?php esc_html_e( 'Jetpack Debugging Center', 'jetpack' ); ?></h2>
221 <?php if ( isset( $can_disconnect ) && $can_disconnect ) : ?>
222 <div id="message" class="updated notice notice-success is-dismissible"><p><?php esc_html_e( 'This site was successfully disconnected.', 'jetpack' ) ?> <a href="<?php echo esc_url( Jetpack::admin_url() ); ?>"><?php esc_html_e( 'Go to connection screen.', 'jetpack' ); ?></a></p>
223 <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'jetpack' ); ?></span></button></div>
224 <?php else: ?>
225 <h3><?php _e( "Testing your site's compatibility with Jetpack...", 'jetpack' ); ?></h3>
226 <div class="jetpack-debug-test-container">
227 <?php
228 ob_start();
229 foreach ( $tests as $test_name => $test_info ) :
230 if ( 'PASS' !== $test_info['result'] && ( is_wp_error( $test_info['result'] ) ||
231 false == ( $response_code = wp_remote_retrieve_response_code( $test_info['result'] ) ) ||
232 '200' != $response_code ) ) {
233 $debug_info .= $test_name . ": FAIL\r\n";
234 ?>
235 <div class="jetpack-test-error">
236 <p>
237 <a class="jetpack-test-heading" href="#"><?php echo $test_info['fail_message']; ?>
238 <span class="noticon noticon-collapse"></span>
239 </a>
240 </p>
241 <pre class="jetpack-test-details"><?php echo esc_html( $test_name ); ?>:
242 <?php echo esc_html( is_wp_error( $test_info['result'] ) ? $test_info['result']->get_error_message() : print_r( $test_info['result'], 1 ) ); ?></pre>
243 </div><?php
244 } else {
245 $debug_info .= $test_name . ": PASS\r\n";
246 }
247 $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 ) );
248 ?>
249 <?php endforeach;
250 $html = ob_get_clean();
251
252 if ( '' == trim( $html ) ) {
253 echo '<div class="jetpack-tests-succed">' . esc_html__( 'Your Jetpack setup looks a-okay!', 'jetpack' ) . '</div>';
254 } else {
255 echo '<h3>' . esc_html__( 'There seems to be a problem with your site’s ability to communicate with Jetpack!', 'jetpack' ) . '</h3>';
256 echo $html;
257 }
258 $debug_info .= "\r\n\r\nRAW TEST RESULTS:" . $debug_raw_info ."\r\n";
259 ?>
260 </div>
261 <?php endif; ?>
262
263 <div class="entry-content">
264 <h3><?php esc_html_e( 'Trouble with Jetpack?', 'jetpack' ); ?></h3>
265 <h4><?php esc_html_e( 'It may be caused by one of these issues, which you can diagnose yourself:', 'jetpack' ); ?></h4>
266 <ol>
267 <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>
268 <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>
269 <li>
270 <b><em><?php esc_html_e( 'A theme conflict.', 'jetpack' ); ?></em></b>
271 <?php
272 $default_theme = wp_get_theme( WP_DEFAULT_THEME );
273
274 if ( $default_theme->exists() ) {
275 /* translators: %s is the name of a theme */
276 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' ) ) );
277 } else {
278 esc_html_e( "If your problem isn't known or caused by a plugin, try activating the default WordPress theme.", 'jetpack' );
279 }
280 ?>
281 <?php esc_html_e( "If this solves the problem, something in your theme is probably broken – let the theme's author know.", 'jetpack' ); ?>
282 </li>
283 <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' ) ); ?>
284 <ul>
285 <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>
286 <li>- <?php esc_html_e( "If you get a 404 message, contact your web host. Their security may block XMLRPC.", 'jetpack' ); ?></li>
287 </ul>
288 </li>
289 <?php if ( current_user_can( 'jetpack_disconnect' ) && Jetpack::is_active() ) : ?>
290 <li>
291 <strong><em><?php esc_html_e( 'A connection problem with WordPress.com.', 'jetpack' ); ?></em></strong>
292 <?php
293 echo wp_kses(
294 sprintf(
295 __( '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' ),
296 wp_nonce_url(
297 Jetpack::admin_url( array( 'page' => 'jetpack-debugger', 'disconnect' => true ) ),
298 'jp_disconnect',
299 'nonce'
300 )
301 ),
302 array( 'a' => array( 'href' => array(), 'class' => array() ) )
303 );
304 ?>
305 </li>
306 <?php endif; ?>
307 </ol>
308 <?php if ( self::is_jetpack_support_open() ): ?>
309 <p class="jetpack-show-contact-form"><?php echo sprintf( __( 'If none of these help you find a solution, <a href="%s">click here to contact Jetpack support</a>. Tell us as much as you can about the issue and what steps you\'ve tried to resolve it, and one of our Happiness Engineers will be in touch to help.', 'jetpack' ), Jetpack::admin_url( array( 'page' => 'jetpack-debugger', 'contact' => true ) ) ); ?>
310 </p>
311 <?php endif; ?>
312 <hr />
313 <?php if ( Jetpack::is_active() ) : ?>
314 <div id="connected-user-details">
315 <h3><?php esc_html_e( 'More details about your Jetpack settings', 'jetpack' ); ?></h3>
316 <p><?php printf(
317 /* translators: %s is an e-mail address */
318 __( 'The primary connection is owned by <strong>%s</strong>\'s WordPress.com account.', 'jetpack' ),
319 esc_html( Jetpack::get_master_user_email() )
320 ); ?></p>
321 </div>
322 <?php else : ?>
323 <div id="dev-mode-details">
324 <p><?php printf(
325 __( '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' ),
326 'https://jetpack.com/support/development-mode/'
327 ); ?></p>
328 </div>
329 <?php endif; ?>
330 <?php if (
331 current_user_can( 'jetpack_manage_modules' )
332 && ( Jetpack::is_development_mode() || Jetpack::is_active() )
333 ) {
334 printf(
335 '<p><a href="%1$s">%2$s</a></p>',
336 Jetpack::admin_url( 'page=jetpack_modules' ),
337 esc_html__( 'Access the full list of Jetpack modules available on your site.', 'jetpack' )
338 );
339 } ?>
340 </div>
341 <div id="contact-message" <?php if( ! isset( $_GET['contact'] ) ) {?> style="display:none" <?php } ?>>
342 <?php if ( self::is_jetpack_support_open() ): ?>
343 <form id="contactme" method="post" action="https://jetpack.com/contact-support/">
344 <input type="hidden" name="action" value="submit">
345 <input type="hidden" name="jetpack" value="needs-service">
346
347 <input type="hidden" name="contact_form" id="contact_form" value="1">
348 <input type="hidden" name="blog_url" id="blog_url" value="<?php echo esc_attr( site_url() ); ?>">
349 <?php
350 $subject_line = sprintf(
351 /* translators: %s is the URL of the site */
352 _x( 'from: %s Jetpack contact form', 'Support request email subject line', 'jetpack' ),
353 esc_attr( site_url() )
354 );
355
356 if ( Jetpack::is_development_version() ) {
357 $subject_line = 'BETA ' . $subject_line;
358 }
359
360 $subject_line_input = printf(
361 '<input type="hidden" name="subject" id="subject" value="%s"">',
362 $subject_line
363 );
364 ?>
365 <div id="category_div" class="formbox">
366 <label class="h" for="category"><?php esc_html_e( 'What do you need help with?', 'jetpack' ); ?></label>
367 <ul>
368 <?php
369 /**
370 * Set up an array of ticket categories.
371 * (reasons why a user would contact us.)
372 */
373 $categories = array(
374 'Connection' => esc_html__( "I'm having trouble connecting Jetpack to WordPress.com.", 'jetpack' ),
375 'Billing' => esc_html__( 'I have an issue with a current plan.', 'jetpack' ),
376 'Presales' => esc_html__( 'I have questions about buying a plan.', 'jetpack' ),
377 'Backups' => esc_html__( 'I need help with backing up my site.', 'jetpack' ),
378 'Restores' => esc_html__( 'I have a problem restoring my site.', 'jetpack' ),
379 'Security' => esc_html__( 'I have security concerns / my site is hacked.', 'jetpack' ),
380 'Priority' => esc_html__( "My site is down / I can't access my site.", 'jetpack' ),
381 /* translators: Last item in a list of reasons to contact Jetpack support. */
382 'Other' => esc_html__( 'Something Else', 'jetpack' ),
383 );
384
385 foreach ( $categories as $value => $label ) { ?>
386 <li><label for="<?php echo esc_attr( $value ); ?>">
387 <input
388 id="<?php echo esc_attr( $value ); ?>"
389 name="category"
390 type="radio"
391 value="<?php echo esc_attr( $value ); ?>"
392 <?php checked( esc_attr( $value ), 'Other' ); ?>
393 />
394 <?php echo esc_html( $label ); ?>
395 </label></li>
396 <?php } ?>
397 </ul>
398 </div>
399
400 <div class="formbox">
401 <label for="message" class="h"><?php esc_html_e( 'Please describe the problem you are having.', 'jetpack' ); ?></label>
402 <textarea name="message" cols="40" rows="7" id="did"></textarea>
403 </div>
404
405 <div id="name_div" class="formbox">
406 <label class="h" for="your_name"><?php esc_html_e( 'Name', 'jetpack' ); ?></label>
407 <span class="errormsg"><?php esc_html_e( 'Let us know your name.', 'jetpack' ); ?></span>
408 <input name="your_name" type="text" id="your_name" value="<?php esc_html_e( $current_user->display_name, 'jetpack'); ?>" size="40">
409 </div>
410
411 <div id="email_div" class="formbox">
412 <label class="h" for="your_email"><?php esc_html_e( 'Email', 'jetpack' ); ?></label>
413 <span class="errormsg"><?php esc_html_e( 'Use a valid email address.', 'jetpack' ); ?></span>
414 <input name="your_email" type="text" id="your_email" value="<?php esc_html_e( $current_user->user_email, 'jetpack'); ?>" size="40">
415 </div>
416
417 <div id="toggle_debug_form_info" class="formbox">
418 <p><?php _e( 'The test results and some other useful debug information will be sent to the support team. Please feel free to <a href="#">review/modify</a> this information.', 'jetpack' ); ?></p>
419 </div>
420
421 <div id="debug_info_form_div" class="formbox" style="display:none">
422 <label class="h" for="debug_info"><?php esc_html_e( 'Debug Info', 'jetpack' ); ?></label>
423 <textarea name="debug_info" cols="40" rows="7" id="debug_form_info"><?php echo esc_attr( $debug_info ); ?></textarea>
424 </div>
425
426 <div style="clear: both;"></div>
427
428 <div id="blog_div" class="formbox">
429 <div id="submit_div" class="contact-support">
430 <input type="submit" name="submit" value="<?php esc_html_e( 'Submit &#187;', 'jetpack' ); ?>">
431 </div>
432 </div>
433 <div style="clear: both;"></div>
434 </form>
435 <?php endif; ?>
436 </div> <!-- contact-message, hidden by default. -->
437 <hr />
438 <div id="toggle_debug_info"><a href="#"><?php _e( 'View Advanced Debug Results', 'jetpack' ); ?></a></div>
439 <div id="debug_info_div" style="display:none">
440 <h4><?php esc_html_e( 'Debug Info', 'jetpack' ); ?></h4>
441 <div id="debug_info"><pre><?php echo esc_html( $debug_info ) ; ?></pre></div>
442 </div>
443 </div>
444 <?php
445 }
446
447 public static function jetpack_debug_admin_head() {
448 ?>
449 <style type="text/css">
450
451 .jetpack-debug-test-container {
452 margin-top: 20px;
453 margin-bottom: 30px;
454 }
455
456 .jetpack-tests-succed {
457 font-size: large;
458 color: #8BAB3E;
459 }
460
461 .jetpack-test-details {
462 margin: 4px 6px;
463 padding: 10px;
464 overflow: auto;
465 display: none;
466 }
467
468 .jetpack-test-error {
469 margin-bottom: 10px;
470 background: #FFEBE8;
471 border: solid 1px #C00;
472 border-radius: 3px;
473 }
474
475 .jetpack-test-error p {
476 margin: 0;
477 padding: 0;
478 }
479
480 .jetpack-test-error a.jetpack-test-heading {
481 padding: 4px 6px;
482 display: block;
483 text-decoration: none;
484 color: inherit;
485 }
486
487 .jetpack-test-error .noticon {
488 float: right;
489 }
490
491 form#contactme {
492 border: 1px solid #dfdfdf;
493 background: #eaf3fa;
494 padding: 20px;
495 margin: 10px;
496 background-color: #eaf3fa;
497 border-radius: 5px;
498 font-size: 15px;
499 }
500
501 form#contactme label.h {
502 color: #444;
503 display: block;
504 font-weight: bold;
505 margin: 0 0 7px 10px;
506 text-shadow: 1px 1px 0 #fff;
507 }
508
509 .formbox {
510 margin: 0 0 25px 0;
511 }
512
513 .formbox input[type="text"], .formbox input[type="email"], .formbox input[type="url"], .formbox textarea, #debug_info_div {
514 border: 1px solid #e5e5e5;
515 border-radius: 11px;
516 box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);
517 color: #666;
518 font-size: 14px;
519 padding: 10px;
520 width: 97%;
521 }
522 #debug_info_div {
523 border-radius: 0;
524 margin-top: 16px;
525 background: #FFF;
526 padding: 16px;
527 }
528 .formbox .contact-support input[type="submit"] {
529 float: right;
530 margin: 0 !important;
531 border-radius: 20px !important;
532 cursor: pointer;
533 font-size: 13pt !important;
534 height: auto !important;
535 margin: 0 0 2em 10px !important;
536 padding: 8px 16px !important;
537 background-color: #ddd;
538 border: 1px solid rgba(0,0,0,0.05);
539 border-top-color: rgba(255,255,255,0.1);
540 border-bottom-color: rgba(0,0,0,0.15);
541 color: #333;
542 font-weight: 400;
543 display: inline-block;
544 text-align: center;
545 text-decoration: none;
546 }
547
548 .formbox span.errormsg {
549 margin: 0 0 10px 10px;
550 color: #d00;
551 display: none;
552 }
553
554 .formbox.error span.errormsg {
555 display: block;
556 }
557
558 #contact-message ul {
559 margin: 0 0 20px 10px;
560 }
561
562 #contact-message li {
563 margin: 0 0 10px 10px;
564 list-style: disc;
565 display: list-item;
566 }
567
568 #debug_info_div, #toggle_debug_info, #debug_info_div p {
569 font-size: 12px;
570 }
571
572 #category_div ul li {
573 list-style-type: none;
574 }
575
576 </style>
577 <script type="text/javascript">
578 jQuery( document ).ready( function($) {
579
580 $( '#debug_info' ).prepend( 'jQuery version: ' + jQuery.fn.jquery + "\r\n" );
581 $( '#debug_form_info' ).prepend( 'jQuery version: ' + jQuery.fn.jquery + "\r\n" );
582
583 $( '.jetpack-test-error .jetpack-test-heading' ).on( 'click', function() {
584 $( this ).parents( '.jetpack-test-error' ).find( '.jetpack-test-details' ).slideToggle();
585 return false;
586 } );
587
588 $( '.jetpack-show-contact-form a' ).on( 'click', function() {
589 $( '#contact-message' ).slideToggle();
590 return false;
591 } );
592
593 $( '#toggle_debug_info a' ).on( 'click', function() {
594 $( '#debug_info_div' ).slideToggle();
595 return false;
596 } );
597
598 $( '#toggle_debug_form_info a' ).on( 'click', function() {
599 $( '#debug_info_form_div' ).slideToggle();
600 return false;
601 } );
602
603 $( 'form#contactme' ).on( "submit", function(e){
604 var form = $( this );
605 var message = form.find( '#did' );
606 var name = form.find( '#your_name' );
607 var email = form.find( '#your_email' )
608 var validation_error = false;
609 if( !name.val() ) {
610 name.parents( '.formbox' ).addClass( 'error' );
611 validation_error = true;
612 }
613 if( !email.val() ) {
614 email.parents( '.formbox' ).addClass( 'error' );
615 validation_error = true;
616 }
617 if ( validation_error ) {
618 return false;
619 }
620 message.val( message.val() + "\r\n\r\n----------------------------------------------\r\n\r\nDEBUG INFO:\r\n" + $('#debug_form_info').val() );
621 return true;
622 });
623
624 } );
625 </script>
626 <?php
627 }
628 }
629