| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | require_once( dirname( __FILE__ ) . '/sync/class.jetpack-sync-dashboard.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | require_once( dirname( __FILE__ ) . '/sync/class.jetpack-sync-reindex.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | class Jetpack_Debugger { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | 	private static function is_jetpack_support_open() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | 		try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | 			$response = wp_remote_request( "http://jetpack.com/is-support-open" ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | 			if ( is_wp_error( $response ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | 				return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | 			$body = wp_remote_retrieve_body( $response ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | 			$json = json_decode( $body ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 			return ( ( bool ) $json->is_support_open ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | 		catch ( Exception $e ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 			return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 	public static function jetpack_increase_timeout() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 		return 30; // seconds | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 	public static function jetpack_debug_display_handler() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 		if ( ! current_user_can( 'manage_options' ) ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 			wp_die( esc_html__('You do not have sufficient permissions to access this page.', 'jetpack' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 		$current_user = wp_get_current_user(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 		$user_id = get_current_user_id(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 		$user_tokens = Jetpack_Options::get_option( 'user_tokens' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 		if ( is_array( $user_tokens ) && array_key_exists( $user_id, $user_tokens ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 			$user_token = $user_tokens[$user_id]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 			$user_token = '[this user has no token]'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 		unset( $user_tokens ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 		$debug_info = "\r\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 		foreach ( array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 			'CLIENT_ID'   => 'id', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 			'BLOG_TOKEN'  => 'blog_token', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 			'MASTER_USER' => 'master_user', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 			'CERT'        => 'fallback_no_verify_ssl_certs', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 			'TIME_DIFF'   => 'time_diff', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 			'VERSION'     => 'version', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 			'OLD_VERSION' => 'old_version', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 			'PUBLIC'      => 'public', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 		) as $label => $option_name ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 			$debug_info .= "\r\n" . esc_html( $label . ": " . Jetpack_Options::get_option( $option_name ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 		$debug_info .= "\r\n" . esc_html( "USER_ID: " . $user_id ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 		$debug_info .= "\r\n" . esc_html( "USER_TOKEN: " . $user_token ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 		$debug_info .= "\r\n" . esc_html( "PHP_VERSION: " . PHP_VERSION ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 		$debug_info .= "\r\n" . esc_html( "WORDPRESS_VERSION: " . $GLOBALS['wp_version'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 		$debug_info .= "\r\n" . esc_html( "JETPACK__VERSION: " . JETPACK__VERSION ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 		$debug_info .= "\r\n" . esc_html( "JETPACK__PLUGIN_DIR: " . JETPACK__PLUGIN_DIR ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 		$debug_info .= "\r\n" . esc_html( "SITE_URL: " . site_url() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 		$debug_info .= "\r\n" . esc_html( "HOME_URL: " . home_url() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 		foreach ( array ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 					  'HTTP_HOST', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 					  'SERVER_PORT', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 					  'HTTPS', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 					  'GD_PHP_HANDLER', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 					  'HTTP_AKAMAI_ORIGIN_HOP', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 					  'HTTP_CF_CONNECTING_IP', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 					  'HTTP_CLIENT_IP', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 					  'HTTP_FASTLY_CLIENT_IP', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 					  'HTTP_FORWARDED', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 					  'HTTP_FORWARDED_FOR', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 					  'HTTP_INCAP_CLIENT_IP', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 					  'HTTP_TRUE_CLIENT_IP', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 					  'HTTP_X_CLIENTIP', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 					  'HTTP_X_CLUSTER_CLIENT_IP', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 					  'HTTP_X_FORWARDED', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 					  'HTTP_X_FORWARDED_FOR', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 					  'HTTP_X_IP_TRAIL', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 					  'HTTP_X_REAL_IP', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 					  'HTTP_X_VARNISH', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 					  'REMOTE_ADDR' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 				  ) as $header ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 			if ( isset( $_SERVER[ $header ] ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 				$debug_info .= "\r\n" . esc_html( $header . ": " . $_SERVER[ $header ] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 		$debug_info .= "\r\n" . esc_html( "PROTECT_TRUSTED_HEADER: " . json_encode( get_site_option( 'trusted_ip_header' ) ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  | 		$debug_info .= "\r\n\r\nTEST RESULTS:\r\n\r\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 		$debug_raw_info = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 		$tests = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 		$tests['HTTP']['result'] = wp_remote_get( preg_replace( '/^https:/', 'http:', JETPACK__API_BASE ) . 'test/1/' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 		$tests['HTTP']['fail_message'] = esc_html__( 'Your site isn’t reaching the Jetpack servers.', 'jetpack' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 		$tests['HTTPS']['result'] = wp_remote_get( preg_replace( '/^http:/', 'https:', JETPACK__API_BASE ) . 'test/1/' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 		$tests['HTTPS']['fail_message'] = esc_html__( 'Your site isn’t securely reaching the Jetpack servers.', 'jetpack' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  | 		$identity_crisis_message = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 		if ( $identity_crisis = Jetpack::check_identity_crisis( true ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 			foreach( $identity_crisis as $key => $value ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 				$identity_crisis_message .= sprintf( __( 'Your `%1$s` option is set up as `%2$s`, but your WordPress.com connection lists it as `%3$s`!', 'jetpack' ), $key, (string) get_option( $key ), $value ) . "\r\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 			$identity_crisis = new WP_Error( 'identity-crisis', $identity_crisis_message, $identity_crisis ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 			$identity_crisis = 'PASS'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 		$tests['IDENTITY_CRISIS']['result'] = $identity_crisis; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 		$tests['IDENTITY_CRISIS']['fail_message'] = esc_html__( 'Something has gotten mixed up in your Jetpack Connection!', 'jetpack' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | 		$self_xml_rpc_url = home_url( 'xmlrpc.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 		$testsite_url = Jetpack::fix_url_for_bad_hosts( JETPACK__API_BASE . 'testsite/1/?url=' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 		add_filter( 'http_request_timeout', array( 'Jetpack_Debugger', 'jetpack_increase_timeout' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 		$tests['SELF']['result'] = wp_remote_get( $testsite_url . $self_xml_rpc_url ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 		if ( is_wp_error( $tests['SELF']['result'] ) && 0 == strpos( $tests['SELF']['result']->get_error_message(), 'Operation timed out' ) ){ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 			$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' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 			$tests['SELF']['fail_message'] = esc_html__( 'It looks like your site can not communicate properly with Jetpack.', 'jetpack' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 		remove_filter( 'http_request_timeout', array( 'Jetpack_Debugger', 'jetpack_increase_timeout' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 		?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 		<div class="wrap"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 			<h2><?php esc_html_e( 'Jetpack Debugging Center', 'jetpack' ); ?></h2> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 			<h3><?php _e( "Testing your site's compatibility with Jetpack...", 'jetpack' ); ?></h3> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 			<div class="jetpack-debug-test-container"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 			<?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 			ob_start(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 			foreach ( $tests as $test_name => $test_info ) : | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 				if ( 'PASS' !== $test_info['result'] && ( is_wp_error( $test_info['result'] ) || | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | 					false == ( $response_code = wp_remote_retrieve_response_code( $test_info['result'] ) )  || | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 					'200' != $response_code ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  | 					$debug_info .= $test_name . ": FAIL\r\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 					?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 					<div class="jetpack-test-error"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 						<p> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 							<a class="jetpack-test-heading" href="#"><?php echo $test_info['fail_message']; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | 							<span class="noticon noticon-collapse"></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 							</a> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 						</p> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 						<pre class="jetpack-test-details"><?php echo esc_html( $test_name ); ?>: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | 	<?php echo esc_html( is_wp_error( $test_info['result'] ) ? $test_info['result']->get_error_message() : print_r( $test_info['result'], 1 ) ); ?></pre> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  | 					</div><?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 				} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | 					$debug_info .= $test_name . ": PASS\r\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 				$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 ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 				?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 			<?php endforeach; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 			$html = ob_get_clean(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  | 			if ( '' == trim( $html ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 				echo '<div class="jetpack-tests-succed">' . esc_html__( 'Your Jetpack setup looks a-okay!', 'jetpack' ) . '</div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  | 			else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | 				echo '<h3>' . esc_html__( 'There seems to be a problem with your site’s ability to communicate with Jetpack!', 'jetpack' ) . '</h3>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 				echo $html; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 			$debug_info .= "\r\n\r\nRAW TEST RESULTS:" . $debug_raw_info ."\r\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 			?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 			</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  | 			<div class="entry-content"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 				<h3><?php esc_html_e( 'Trouble with Jetpack?', 'jetpack' ); ?></h3> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 				<h4><?php esc_html_e( 'It may be caused by one of these issues, which you can diagnose yourself:', 'jetpack' ); ?></h4> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 				<ol> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 					<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/', 'http://wordpress.org/support/plugin/jetpack' ); ?></li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 					<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> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 					<li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 						<b><em><?php esc_html_e( 'A theme conflict.', 'jetpack' ); ?></em></b> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 						<?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 							$default_theme = wp_get_theme( WP_DEFAULT_THEME ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 							if ( $default_theme->exists() ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 								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' ) ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 							} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 								esc_html_e( "If your problem isn't known or caused by a plugin, try activating the default WordPress theme.", 'jetpack' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 							} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 						?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 						<?php esc_html_e( "If this solves the problem, something in your theme is probably broken – let the theme's author know.", 'jetpack' ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 					</li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 					<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' ) ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 						<ul> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 							<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> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 							<li>- <?php esc_html_e( "If you get a 404 message, contact your web host. Their security may block XMLRPC.", 'jetpack' ); ?></li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 						</ul> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | 					</li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 				</ol> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 				<?php if ( self::is_jetpack_support_open() ): ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 				<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 ) ) ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 				</p> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 				<?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  | 				<?php if ( Jetpack::is_active() ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 					<hr /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 					<div id="connected-user-details"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 						<p><?php printf( __( 'The primary connection is owned by <strong>%s</strong>\'s WordPress.com account.', 'jetpack' ), esc_html( Jetpack::get_master_user_email() ) ); ?></p> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 					</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 					<hr /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 					<div id="sync-related-posts"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 						<p><?php echo esc_html__( 'Some features of Jetpack use the WordPress.com infrastructure and require that your public content be mirrored there. If you see intermittent issues only affecting certain posts, please try requesting a reindex of your posts.', 'jetpack' ); ?></p> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 						<?php echo Jetpack_Sync_Reindex::reindex_ui(); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | 					</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 				<?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 			</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 			<div id="contact-message" <?php if( ! isset( $_GET['contact'] ) ) {?>  style="display:none" <?php } ?>> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 			<?php if ( self::is_jetpack_support_open() ): ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 				<form id="contactme" method="post" action="https://jetpack.com/contact-support/"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 					<input type="hidden" name="action" value="submit"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 					<input type="hidden" name="jetpack" value="needs-service"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | 					<input type="hidden" name="contact_form" id="contact_form" value="1"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 					<input type="hidden" name="blog_url" id="blog_url" value="<?php echo esc_attr( site_url() ); ?>"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | 					<?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | 						$subject_line = sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  | 							/* translators: %s is the URL of the site */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 							_x( 'from: %s Jetpack contact form', 'Support request email subject line', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 							esc_attr( site_url() ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 						); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | 						if ( Jetpack::is_development_version() ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 							$subject_line = 'BETA ' . $subject_line; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 						} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  | 						$subject_line_input = printf( | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  | 							'<input type="hidden" name="subject" id="subject" value="%s"">', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  | 							$subject_line | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  | 						); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 					?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  | 					<div class="formbox"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  | 						<label for="message" class="h"><?php esc_html_e( 'Please describe the problem you are having.', 'jetpack' ); ?></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | 						<textarea name="message" cols="40" rows="7" id="did"></textarea> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  | 					</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  | 					<div id="name_div" class="formbox"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | 						<label class="h" for="your_name"><?php esc_html_e( 'Name', 'jetpack' ); ?></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  | 			  			<span class="errormsg"><?php esc_html_e( 'Let us know your name.', 'jetpack' ); ?></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  | 						<input name="your_name" type="text" id="your_name" value="<?php esc_html_e( $current_user->display_name, 'jetpack'); ?>" size="40"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  | 					</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  | 					<div id="email_div" class="formbox"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  | 						<label class="h" for="your_email"><?php esc_html_e( 'E-mail', 'jetpack' ); ?></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  | 			  			<span class="errormsg"><?php esc_html_e( 'Use a valid email address.', 'jetpack' ); ?></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  | 						<input name="your_email" type="text" id="your_email" value="<?php esc_html_e( $current_user->user_email, 'jetpack'); ?>" size="40"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  | 					</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  | 					<div id="toggle_debug_form_info" class="formbox"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  | 						<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> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  | 					</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  | 					<div id="debug_info_form_div" class="formbox" style="display:none"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | 						<label class="h" for="debug_info"><?php esc_html_e( 'Debug Info', 'jetpack' ); ?></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  | 			  			<textarea name="debug_info" cols="40" rows="7" id="debug_form_info"><?php echo esc_attr( $debug_info ); ?></textarea> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  | 					</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  | 					<div style="clear: both;"></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  | 					<div id="blog_div" class="formbox"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  | 						<div id="submit_div" class="contact-support"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  | 						<input type="submit" name="submit" value="<?php esc_html_e( 'Submit »', 'jetpack' ); ?>"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  | 						</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  | 					</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  | 					<div style="clear: both;"></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  | 				</form> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  | 			<?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  | 		</div> <!-- contact-message, hidden by default. --> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  | 		<div id="toggle_debug_info"><a href="#"><?php _e( 'View Advanced Debug Results', 'jetpack' ); ?></a></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  | 			<div id="debug_info_div" style="display:none"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  | 			<h4><?php esc_html_e( 'Debug Info', 'jetpack' ); ?></h4> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  | 			<div id="debug_info"><?php echo wpautop( esc_html( $debug_info ) ); ?></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  | 		</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  | 		</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  | 	<?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 283 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 284 |  |  | 	public static function jetpack_debug_admin_head() { | 
            
                                                        
            
                                    
            
            
                | 285 |  |  | 		?> | 
            
                                                        
            
                                    
            
            
                | 286 |  |  | 		<style type="text/css"> | 
            
                                                        
            
                                    
            
            
                | 287 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 288 |  |  | 			.jetpack-debug-test-container { | 
            
                                                        
            
                                    
            
            
                | 289 |  |  | 				margin-top: 20px; | 
            
                                                        
            
                                    
            
            
                | 290 |  |  | 				margin-bottom: 30px; | 
            
                                                        
            
                                    
            
            
                | 291 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 292 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 293 |  |  | 			.jetpack-tests-succed { | 
            
                                                        
            
                                    
            
            
                | 294 |  |  | 				font-size: large; | 
            
                                                        
            
                                    
            
            
                | 295 |  |  | 				color: #8BAB3E; | 
            
                                                        
            
                                    
            
            
                | 296 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 297 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 298 |  |  | 			.jetpack-test-details { | 
            
                                                        
            
                                    
            
            
                | 299 |  |  | 				margin: 4px 6px; | 
            
                                                        
            
                                    
            
            
                | 300 |  |  | 				padding: 10px; | 
            
                                                        
            
                                    
            
            
                | 301 |  |  | 				overflow: auto; | 
            
                                                        
            
                                    
            
            
                | 302 |  |  | 				display: none; | 
            
                                                        
            
                                    
            
            
                | 303 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 304 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 305 |  |  | 			.jetpack-test-error { | 
            
                                                        
            
                                    
            
            
                | 306 |  |  | 				margin-bottom: 10px; | 
            
                                                        
            
                                    
            
            
                | 307 |  |  | 				background: #FFEBE8; | 
            
                                                        
            
                                    
            
            
                | 308 |  |  | 				border: solid 1px #C00; | 
            
                                                        
            
                                    
            
            
                | 309 |  |  | 				border-radius: 3px; | 
            
                                                        
            
                                    
            
            
                | 310 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 311 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 312 |  |  | 			.jetpack-test-error p { | 
            
                                                        
            
                                    
            
            
                | 313 |  |  | 				margin: 0; | 
            
                                                        
            
                                    
            
            
                | 314 |  |  | 				padding: 0; | 
            
                                                        
            
                                    
            
            
                | 315 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 316 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 317 |  |  | 			.jetpack-test-error a.jetpack-test-heading { | 
            
                                                        
            
                                    
            
            
                | 318 |  |  | 				padding: 4px 6px; | 
            
                                                        
            
                                    
            
            
                | 319 |  |  | 				display: block; | 
            
                                                        
            
                                    
            
            
                | 320 |  |  | 				text-decoration: none; | 
            
                                                        
            
                                    
            
            
                | 321 |  |  | 				color: inherit; | 
            
                                                        
            
                                    
            
            
                | 322 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 323 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 324 |  |  | 			.jetpack-test-error .noticon { | 
            
                                                        
            
                                    
            
            
                | 325 |  |  | 				float: right; | 
            
                                                        
            
                                    
            
            
                | 326 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 327 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 328 |  |  | 			form#contactme { | 
            
                                                        
            
                                    
            
            
                | 329 |  |  | 				border: 1px solid #dfdfdf; | 
            
                                                        
            
                                    
            
            
                | 330 |  |  | 				background: #eaf3fa; | 
            
                                                        
            
                                    
            
            
                | 331 |  |  | 				padding: 20px; | 
            
                                                        
            
                                    
            
            
                | 332 |  |  | 				margin: 10px; | 
            
                                                        
            
                                    
            
            
                | 333 |  |  | 				background-color: #eaf3fa; | 
            
                                                        
            
                                    
            
            
                | 334 |  |  | 				border-radius: 5px; | 
            
                                                        
            
                                    
            
            
                | 335 |  |  | 				font-size: 15px; | 
            
                                                        
            
                                    
            
            
                | 336 |  |  | 				font-family: "Open Sans", "Helvetica Neue", sans-serif; | 
            
                                                        
            
                                    
            
            
                | 337 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 338 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 339 |  |  | 			form#contactme label.h { | 
            
                                                        
            
                                    
            
            
                | 340 |  |  | 				color: #444; | 
            
                                                        
            
                                    
            
            
                | 341 |  |  | 				display: block; | 
            
                                                        
            
                                    
            
            
                | 342 |  |  | 				font-weight: bold; | 
            
                                                        
            
                                    
            
            
                | 343 |  |  | 				margin: 0 0 7px 10px; | 
            
                                                        
            
                                    
            
            
                | 344 |  |  | 				text-shadow: 1px 1px 0 #fff; | 
            
                                                        
            
                                    
            
            
                | 345 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 346 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 347 |  |  | 			.formbox { | 
            
                                                        
            
                                    
            
            
                | 348 |  |  | 				margin: 0 0 25px 0; | 
            
                                                        
            
                                    
            
            
                | 349 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 350 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 351 |  |  | 			.formbox input[type="text"], .formbox input[type="email"], .formbox input[type="url"], .formbox textarea, #debug_info_div { | 
            
                                                        
            
                                    
            
            
                | 352 |  |  | 				border: 1px solid #e5e5e5; | 
            
                                                        
            
                                    
            
            
                | 353 |  |  | 				border-radius: 11px; | 
            
                                                        
            
                                    
            
            
                | 354 |  |  | 				box-shadow: inset 0 1px 1px rgba(0,0,0,0.1); | 
            
                                                        
            
                                    
            
            
                | 355 |  |  | 				color: #666; | 
            
                                                        
            
                                    
            
            
                | 356 |  |  | 				font-size: 14px; | 
            
                                                        
            
                                    
            
            
                | 357 |  |  | 				padding: 10px; | 
            
                                                        
            
                                    
            
            
                | 358 |  |  | 				width: 97%; | 
            
                                                        
            
                                    
            
            
                | 359 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 360 |  |  | 			.formbox .contact-support input[type="submit"] { | 
            
                                                        
            
                                    
            
            
                | 361 |  |  | 				float: right; | 
            
                                                        
            
                                    
            
            
                | 362 |  |  | 				margin: 0 !important; | 
            
                                                        
            
                                    
            
            
                | 363 |  |  | 				border-radius: 20px !important; | 
            
                                                        
            
                                    
            
            
                | 364 |  |  | 				cursor: pointer; | 
            
                                                        
            
                                    
            
            
                | 365 |  |  | 				font-size: 13pt !important; | 
            
                                                        
            
                                    
            
            
                | 366 |  |  | 				height: auto !important; | 
            
                                                        
            
                                    
            
            
                | 367 |  |  | 				margin: 0 0 2em 10px !important; | 
            
                                                        
            
                                    
            
            
                | 368 |  |  | 				padding: 8px 16px !important; | 
            
                                                        
            
                                    
            
            
                | 369 |  |  | 				background-color: #ddd; | 
            
                                                        
            
                                    
            
            
                | 370 |  |  | 				border: 1px solid rgba(0,0,0,0.05); | 
            
                                                        
            
                                    
            
            
                | 371 |  |  | 				border-top-color: rgba(255,255,255,0.1); | 
            
                                                        
            
                                    
            
            
                | 372 |  |  | 				border-bottom-color: rgba(0,0,0,0.15); | 
            
                                                        
            
                                    
            
            
                | 373 |  |  | 				color: #333; | 
            
                                                        
            
                                    
            
            
                | 374 |  |  | 				font-weight: 400; | 
            
                                                        
            
                                    
            
            
                | 375 |  |  | 				display: inline-block; | 
            
                                                        
            
                                    
            
            
                | 376 |  |  | 				text-align: center; | 
            
                                                        
            
                                    
            
            
                | 377 |  |  | 				text-decoration: none; | 
            
                                                        
            
                                    
            
            
                | 378 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 379 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 380 |  |  | 			.formbox span.errormsg { | 
            
                                                        
            
                                    
            
            
                | 381 |  |  | 				margin: 0 0 10px 10px; | 
            
                                                        
            
                                    
            
            
                | 382 |  |  | 				color: #d00; | 
            
                                                        
            
                                    
            
            
                | 383 |  |  | 				display: none; | 
            
                                                        
            
                                    
            
            
                | 384 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 385 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 386 |  |  | 			.formbox.error span.errormsg { | 
            
                                                        
            
                                    
            
            
                | 387 |  |  | 				display: block; | 
            
                                                        
            
                                    
            
            
                | 388 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 389 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 390 |  |  | 			#contact-message ul { | 
            
                                                        
            
                                    
            
            
                | 391 |  |  | 				margin: 0 0 20px 10px; | 
            
                                                        
            
                                    
            
            
                | 392 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 393 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 394 |  |  | 			#contact-message li { | 
            
                                                        
            
                                    
            
            
                | 395 |  |  | 				margin: 0 0 10px 10px; | 
            
                                                        
            
                                    
            
            
                | 396 |  |  | 				list-style: disc; | 
            
                                                        
            
                                    
            
            
                | 397 |  |  | 				display: list-item; | 
            
                                                        
            
                                    
            
            
                | 398 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 399 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 400 |  |  | 			#debug_info_div, #toggle_debug_info, #debug_info_div p { | 
            
                                                        
            
                                    
            
            
                | 401 |  |  | 				font-size: smaller; | 
            
                                                        
            
                                    
            
            
                | 402 |  |  | 			} | 
            
                                                        
            
                                    
            
            
                | 403 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 404 |  |  | 		</style> | 
            
                                                        
            
                                    
            
            
                | 405 |  |  | 		<script type="text/javascript"> | 
            
                                                        
            
                                    
            
            
                | 406 |  |  | 		jQuery( document ).ready( function($) { | 
            
                                                        
            
                                    
            
            
                | 407 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 408 |  |  | 			$( '#debug_info' ).prepend( 'jQuery version: ' + jQuery.fn.jquery + "\r\n" ); | 
            
                                                        
            
                                    
            
            
                | 409 |  |  | 			$( '#debug_form_info' ).prepend( 'jQuery version: ' + jQuery.fn.jquery + "\r\n" ); | 
            
                                                        
            
                                    
            
            
                | 410 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 411 |  |  | 			$( '.jetpack-test-error .jetpack-test-heading' ).on( 'click', function() { | 
            
                                                        
            
                                    
            
            
                | 412 |  |  | 				$( this ).parents( '.jetpack-test-error' ).find( '.jetpack-test-details' ).slideToggle(); | 
            
                                                        
            
                                    
            
            
                | 413 |  |  | 				return false; | 
            
                                                        
            
                                    
            
            
                | 414 |  |  | 			} ); | 
            
                                                        
            
                                    
            
            
                | 415 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 416 |  |  | 			$( '.jetpack-show-contact-form a' ).on( 'click', function() { | 
            
                                                        
            
                                    
            
            
                | 417 |  |  | 				$( '#contact-message' ).slideToggle(); | 
            
                                                        
            
                                    
            
            
                | 418 |  |  | 				return false; | 
            
                                                        
            
                                    
            
            
                | 419 |  |  | 			} ); | 
            
                                                        
            
                                    
            
            
                | 420 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 421 |  |  | 			$( '#toggle_debug_info a' ).on( 'click', function() { | 
            
                                                        
            
                                    
            
            
                | 422 |  |  | 				$( '#debug_info_div' ).slideToggle(); | 
            
                                                        
            
                                    
            
            
                | 423 |  |  | 				return false; | 
            
                                                        
            
                                    
            
            
                | 424 |  |  | 			} ); | 
            
                                                        
            
                                    
            
            
                | 425 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 426 |  |  | 			$( '#toggle_debug_form_info a' ).on( 'click', function() { | 
            
                                                        
            
                                    
            
            
                | 427 |  |  | 				$( '#debug_info_form_div' ).slideToggle(); | 
            
                                                        
            
                                    
            
            
                | 428 |  |  | 				return false; | 
            
                                                        
            
                                    
            
            
                | 429 |  |  | 			} ); | 
            
                                                        
            
                                    
            
            
                | 430 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 431 |  |  | 			$( 'form#contactme' ).on( "submit", function(e){ | 
            
                                                        
            
                                    
            
            
                | 432 |  |  | 				var form = $( this ); | 
            
                                                        
            
                                    
            
            
                | 433 |  |  | 				var message = form.find( '#did' ); | 
            
                                                        
            
                                    
            
            
                | 434 |  |  | 				var name = form.find( '#your_name' ); | 
            
                                                        
            
                                    
            
            
                | 435 |  |  | 				var email = form.find( '#your_email' ) | 
            
                                                        
            
                                    
            
            
                | 436 |  |  | 				var validation_error = false; | 
            
                                                        
            
                                    
            
            
                | 437 |  |  | 				if( !name.val() ) { | 
            
                                                        
            
                                    
            
            
                | 438 |  |  | 					name.parents( '.formbox' ).addClass( 'error' ); | 
            
                                                        
            
                                    
            
            
                | 439 |  |  | 					validation_error = true; | 
            
                                                        
            
                                    
            
            
                | 440 |  |  | 				} | 
            
                                                        
            
                                    
            
            
                | 441 |  |  | 				if( !email.val() ) { | 
            
                                                        
            
                                    
            
            
                | 442 |  |  | 					email.parents( '.formbox' ).addClass( 'error' ); | 
            
                                                        
            
                                    
            
            
                | 443 |  |  | 					validation_error = true; | 
            
                                                        
            
                                    
            
            
                | 444 |  |  | 				} | 
            
                                                        
            
                                    
            
            
                | 445 |  |  | 				if ( validation_error ) { | 
            
                                                        
            
                                    
            
            
                | 446 |  |  | 					return false; | 
            
                                                        
            
                                    
            
            
                | 447 |  |  | 				} | 
            
                                                        
            
                                    
            
            
                | 448 |  |  | 				message.val( message.val() + "\r\n\r\n----------------------------------------------\r\n\r\nDEBUG INFO:\r\n" + $('#debug_info').val()  ); | 
            
                                                        
            
                                    
            
            
                | 449 |  |  | 				return true; | 
            
                                                        
            
                                    
            
            
                | 450 |  |  | 	    	}); | 
            
                                                        
            
                                    
            
            
                | 451 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 452 |  |  | 		} ); | 
            
                                                        
            
                                    
            
            
                | 453 |  |  | 		</script> | 
            
                                                        
            
                                    
            
            
                | 454 |  |  | 		<?php | 
            
                                                        
            
                                    
            
            
                | 455 |  |  | 	} | 
            
                                                        
            
                                    
            
            
                | 456 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 457 |  |  |  | 
            
                        
If you define a variable conditionally, it can happen that it is not defined for all execution paths.
Let’s take a look at an example:
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.
Available Fixes
Check for existence of the variable explicitly:
Define a default value for the variable:
Add a value for the missing path: