public function setUp()
 {
     parent::setUp();
     $this->callable_module = Jetpack_Sync_Modules::get_module("functions");
     set_current_screen('post-user');
     // this only works in is_admin()
 }
 public static function get_modules()
 {
     if (null === self::$initialized_modules) {
         self::$initialized_modules = self::initialize_modules();
     }
     return self::$initialized_modules;
 }
 public function setUp()
 {
     parent::setUp();
     $this->options_module = Jetpack_Sync_Modules::get_module("options");
     $this->options_module->set_options_whitelist(array('test_option'));
     add_option('test_option', 'foo');
     $this->sender->do_sync();
 }
 public function setSyncClientDefaults()
 {
     $this->sender->set_defaults();
     Jetpack_Sync_Modules::set_defaults();
     $this->sender->set_dequeue_max_bytes(5000000);
     // process 5MB of items at a time
     $this->sender->set_sync_wait_time(0);
     // disable rate limiting
 }
 public function setUp()
 {
     parent::setUp();
     // create a post
     $this->meta_module = Jetpack_Sync_Modules::get_module("meta");
     Jetpack_Sync_Settings::update_settings(array('post_meta_whitelist' => array('foobar')));
     $this->post_id = $this->factory->post->create();
     add_post_meta($this->post_id, $this->whitelisted_post_meta, 'foo');
     $this->sender->do_sync();
 }
 public function setSyncClientDefaults()
 {
     $this->sender->set_defaults();
     Jetpack_Sync_Modules::set_defaults();
     $this->sender->set_dequeue_max_bytes(5000000);
     // process 5MB of items at a time
     $this->sender->set_sync_wait_time(0);
     // disable rate limiting
     // don't sync callables or constants every time - slows down tests
     set_transient(Jetpack_Sync_Module_Callables::CALLABLES_AWAIT_TRANSIENT_NAME, 60);
     set_transient(Jetpack_Sync_Module_Constants::CONSTANTS_AWAIT_TRANSIENT_NAME, 60);
 }
 public function setUp()
 {
     parent::setUp();
     $this->sender->reset_data();
     $this->terms_module = Jetpack_Sync_Modules::get_module("terms");
     $this->taxonomy = 'genre';
     register_taxonomy($this->taxonomy, 'post', array('label' => __('Genre'), 'rewrite' => array('slug' => $this->taxonomy), 'hierarchical' => true));
     $this->terms_module->set_taxonomy_whitelist(array($this->taxonomy));
     // create a post
     $this->post_id = $this->factory->post->create();
     $this->term_object = wp_insert_term('dog', $this->taxonomy);
     $this->sender->do_sync();
 }
 private function init()
 {
     $handler = array($this, 'action_handler');
     $full_sync_handler = array($this, 'full_sync_action_handler');
     foreach (Jetpack_Sync_Modules::get_modules() as $module) {
         $module->init_listeners($handler);
         $module->init_full_sync_listeners($full_sync_handler);
     }
     // Module Activation
     add_action('jetpack_activate_module', $handler);
     add_action('jetpack_deactivate_module', $handler);
     // Jetpack Upgrade
     add_action('updating_jetpack_version', $handler, 10, 2);
     // Send periodic checksum
     add_action('jetpack_sync_checksum', $handler);
 }
 protected function get_metadata($ids, $meta_type)
 {
     global $wpdb;
     $table = _get_meta_table($meta_type);
     $id = $meta_type . '_id';
     if (!$table) {
         return array();
     }
     $private_meta_whitelist_sql = '';
     $meta_module = Jetpack_Sync_Modules::get_module("meta");
     switch ($meta_type) {
         case 'post':
             $private_meta_whitelist_sql = "'" . implode("','", array_map('esc_sql', $meta_module->get_post_meta_whitelist())) . "'";
             break;
         case 'comment':
             $private_meta_whitelist_sql = "'" . implode("','", array_map('esc_sql', $meta_module->get_comment_meta_whitelist())) . "'";
             break;
     }
     return array_map(array($this, 'unserialize_meta'), $wpdb->get_results("SELECT {$id}, meta_key, meta_value, meta_id FROM {$table} WHERE {$id} IN ( " . implode(',', wp_parse_id_list($ids)) . ' )' . " AND meta_key IN ( {$private_meta_whitelist_sql} ) ", OBJECT));
 }
 static function do_full_sync($modules = null)
 {
     if (!self::sync_allowed()) {
         return;
     }
     self::initialize_listener();
     Jetpack_Sync_Modules::get_module('full-sync')->start($modules);
     self::do_cron_sync();
     // immediately run a cron sync, which sends pending data
 }
 function reset_data()
 {
     $this->reset_sync_queue();
     $this->reset_full_sync_queue();
     foreach (Jetpack_Sync_Modules::get_modules() as $module) {
         $module->reset_data();
     }
     foreach (array('sync', 'full_sync') as $queue_name) {
         delete_option(self::NEXT_SYNC_TIME_OPTION_NAME . '_' . $queue_name);
     }
     Jetpack_Sync_Settings::reset_data();
 }
 public function clear_status()
 {
     $prefix = self::STATUS_OPTION_PREFIX;
     delete_option("{$prefix}_started");
     delete_option("{$prefix}_queue_finished");
     delete_option("{$prefix}_sent_started");
     delete_option("{$prefix}_finished");
     foreach (Jetpack_Sync_Modules::get_modules() as $module) {
         delete_option("{$prefix}_{$module->name()}_total");
         delete_option("{$prefix}_{$module->name()}_queued");
         delete_option("{$prefix}_{$module->name()}_sent");
         delete_option("{$prefix}_{$module->name()}_config");
     }
 }
 public function test_returns_user_object_by_id()
 {
     $user_sync_module = Jetpack_Sync_Modules::get_module("users");
     // get the synced object
     $event = $this->server_event_storage->get_most_recent_event('jetpack_sync_save_user');
     $synced_user = $event->args[0];
     // grab the codec - we need to simulate the stripping of types that comes with encoding/decoding
     $codec = $this->sender->get_codec();
     $retrieved_user = $codec->decode($codec->encode($user_sync_module->get_object_by_id('user', $this->user_id)));
     // TODO: this is to address a testing bug, alas :/
     unset($retrieved_user->data->allowed_mime_types);
     $this->assertEquals($synced_user, $retrieved_user);
 }
예제 #14
0
 function reset_data()
 {
     $this->reset_sync_queue();
     foreach (Jetpack_Sync_Modules::get_modules() as $module) {
         $module->reset_data();
     }
     delete_option(self::SYNC_THROTTLE_OPTION_NAME);
     delete_option(self::NEXT_SYNC_TIME_OPTION_NAME);
     Jetpack_Sync_Settings::reset_data();
 }
 static function do_full_sync($modules = null)
 {
     if (!self::sync_allowed()) {
         return false;
     }
     self::initialize_listener();
     Jetpack_Sync_Modules::get_module('full-sync')->start($modules);
     return true;
 }
 public function test_returns_comment_object_by_id()
 {
     $comment_sync_module = Jetpack_Sync_Modules::get_module("comments");
     $comment_id = $this->comment_ids[0];
     // get the synced object
     $event = $this->server_event_storage->get_most_recent_event('wp_insert_comment');
     $synced_comment = $event->args[1];
     // grab the codec - we need to simulate the stripping of types that comes with encoding/decoding
     $codec = $this->sender->get_codec();
     $retrieved_comment = $codec->decode($codec->encode($comment_sync_module->get_object_by_id('comment', $comment_id)));
     $this->assertEquals($synced_comment, $retrieved_comment);
 }
 protected function result()
 {
     $args = $this->query_args();
     $module_name = $args['module_name'];
     require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-modules.php';
     if (!($sync_module = Jetpack_Sync_Modules::get_module($module_name))) {
         return new WP_Error('invalid_module', 'You specified an invalid sync module');
     }
     $object_type = $args['object_type'];
     $object_ids = $args['object_ids'];
     require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-sender.php';
     $codec = Jetpack_Sync_Sender::get_instance()->get_codec();
     Jetpack_Sync_Settings::set_is_syncing(true);
     $objects = $codec->encode($sync_module->get_objects_by_id($object_type, $object_ids));
     Jetpack_Sync_Settings::set_is_syncing(false);
     return array('objects' => $objects);
 }
 function test_reset_module_also_resets_full_sync_lock()
 {
     $full_sync = Jetpack_Sync_Modules::get_module('full-sync');
     $full_sync->start();
     $status = $full_sync->get_status();
     $this->assertTrue($full_sync->is_started());
     $full_sync->reset_data();
     $this->assertFalse($full_sync->is_started());
 }
 public function setUp()
 {
     parent::setUp();
     $this->resetCallableAndConstantTimeouts();
     $this->constant_module = Jetpack_Sync_Modules::get_module("constants");
 }
 function test_initial_sync_doesnt_sync_subscribers()
 {
     $this->factory->user->create(array('user_login' => 'theauthor', 'role' => 'author'));
     $this->factory->user->create(array('user_login' => 'theadmin', 'role' => 'administrator'));
     foreach (range(1, 10) as $i) {
         $this->factory->user->create(array('role' => 'subscriber'));
     }
     $this->full_sync->start();
     $this->sender->do_full_sync();
     $this->assertEquals(13, $this->server_replica_storage->user_count());
     $this->server_replica_storage->reset();
     $this->assertEquals(0, $this->server_replica_storage->user_count());
     $user_ids = Jetpack_Sync_Modules::get_module('users')->get_initial_sync_user_config();
     $this->assertEquals(3, count($user_ids));
     $this->full_sync->start(array('users' => 'initial'));
     $this->sender->do_full_sync();
     $this->assertEquals(3, $this->server_replica_storage->user_count());
     // finally, let's make sure that the initial sync method actually invokes our initial sync user config
     Jetpack_Sync_Actions::do_initial_sync('4.2', '4.1');
     $expected_sync_config = array('options' => true, 'network_options' => true, 'functions' => true, 'constants' => true, 'users' => 'initial');
     $full_sync_status = $this->full_sync->get_status();
     $this->assertEquals($expected_sync_config, $full_sync_status['config']);
 }
 function test_starts_full_sync_on_client_authorized()
 {
     do_action('jetpack_client_authorized', 'abcd1234');
     $this->assertTrue(Jetpack_Sync_Modules::get_module('full-sync')->is_started());
 }
 public function clear_status()
 {
     $prefix = self::STATUS_OPTION_PREFIX;
     Jetpack_Sync_Options::delete_option("{$prefix}_started");
     Jetpack_Sync_Options::delete_option("{$prefix}_params");
     Jetpack_Sync_Options::delete_option("{$prefix}_queue_finished");
     Jetpack_Sync_Options::delete_option("{$prefix}_send_started");
     Jetpack_Sync_Options::delete_option("{$prefix}_finished");
     foreach (Jetpack_Sync_Modules::get_modules() as $module) {
         Jetpack_Sync_Options::delete_option("{$prefix}_{$module->name()}_sent");
     }
 }
예제 #23
0
    public static function jetpack_debug_display_handler()
    {
        if (!current_user_can('manage_options')) {
            wp_die(esc_html__('You do not have sufficient permissions to access this page.', 'jetpack'));
        }
        $current_user = wp_get_current_user();
        $user_id = get_current_user_id();
        $user_tokens = Jetpack_Options::get_option('user_tokens');
        if (is_array($user_tokens) && array_key_exists($user_id, $user_tokens)) {
            $user_token = $user_tokens[$user_id];
        } else {
            $user_token = '[this user has no token]';
        }
        unset($user_tokens);
        $debug_info = "\r\n";
        foreach (array('CLIENT_ID' => 'id', 'BLOG_TOKEN' => 'blog_token', 'MASTER_USER' => 'master_user', 'CERT' => 'fallback_no_verify_ssl_certs', 'TIME_DIFF' => 'time_diff', 'VERSION' => 'version', 'OLD_VERSION' => 'old_version', 'PUBLIC' => 'public') as $label => $option_name) {
            $debug_info .= "\r\n" . esc_html($label . ": " . Jetpack_Options::get_option($option_name));
        }
        $debug_info .= "\r\n" . esc_html("USER_ID: " . $user_id);
        $debug_info .= "\r\n" . esc_html("USER_TOKEN: " . $user_token);
        $debug_info .= "\r\n" . esc_html("PHP_VERSION: " . PHP_VERSION);
        $debug_info .= "\r\n" . esc_html("WORDPRESS_VERSION: " . $GLOBALS['wp_version']);
        $debug_info .= "\r\n" . esc_html("JETPACK__VERSION: " . JETPACK__VERSION);
        $debug_info .= "\r\n" . esc_html("JETPACK__PLUGIN_DIR: " . JETPACK__PLUGIN_DIR);
        $debug_info .= "\r\n" . esc_html("SITE_URL: " . site_url());
        $debug_info .= "\r\n" . esc_html("HOME_URL: " . home_url());
        $debug_info .= "\r\n";
        require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-modules.php';
        $sync_module = Jetpack_Sync_Modules::get_module('full-sync');
        $sync_statuses = $sync_module->get_status();
        $human_readable_sync_status = array();
        foreach ($sync_statuses as $sync_status => $sync_status_value) {
            $human_readable_sync_status[$sync_status] = in_array($sync_status, array('started', 'queue_finished', 'send_started', 'finished')) ? date('r', $sync_status_value) : $sync_status_value;
        }
        $debug_info .= "\r\n" . sprintf(esc_html__('Jetpack Sync Full Status: `%1$s`', 'jetpack'), print_r($human_readable_sync_status, 1));
        require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-sender.php';
        $queue = Jetpack_Sync_Sender::get_instance()->get_sync_queue();
        $debug_info .= "\r\n" . sprintf(esc_html__('Sync Queue size: %1$s', 'jetpack'), $queue->size());
        $debug_info .= "\r\n" . sprintf(esc_html__('Sync Queue lag: %1$s', 'jetpack'), self::seconds_to_time($queue->lag()));
        $full_sync_queue = Jetpack_Sync_Sender::get_instance()->get_full_sync_queue();
        $debug_info .= "\r\n" . sprintf(esc_html__('Full Sync Queue size: %1$s', 'jetpack'), $full_sync_queue->size());
        $debug_info .= "\r\n" . sprintf(esc_html__('Full Sync Queue lag: %1$s', 'jetpack'), self::seconds_to_time($full_sync_queue->lag()));
        $debug_info .= "\r\n";
        foreach (array('HTTP_HOST', 'SERVER_PORT', 'HTTPS', 'GD_PHP_HANDLER', 'HTTP_AKAMAI_ORIGIN_HOP', 'HTTP_CF_CONNECTING_IP', 'HTTP_CLIENT_IP', 'HTTP_FASTLY_CLIENT_IP', 'HTTP_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_INCAP_CLIENT_IP', 'HTTP_TRUE_CLIENT_IP', 'HTTP_X_CLIENTIP', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_X_FORWARDED', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_IP_TRAIL', 'HTTP_X_REAL_IP', 'HTTP_X_VARNISH', 'REMOTE_ADDR') as $header) {
            if (isset($_SERVER[$header])) {
                $debug_info .= "\r\n" . esc_html($header . ": " . $_SERVER[$header]);
            }
        }
        $debug_info .= "\r\n" . esc_html("PROTECT_TRUSTED_HEADER: " . json_encode(get_site_option('trusted_ip_header')));
        $debug_info .= "\r\n\r\nTEST RESULTS:\r\n\r\n";
        $debug_raw_info = '';
        $tests = array();
        $tests['HTTP']['result'] = wp_remote_get(preg_replace('/^https:/', 'http:', JETPACK__API_BASE) . 'test/1/');
        $tests['HTTP']['fail_message'] = esc_html__('Your site isn’t reaching the Jetpack servers.', 'jetpack');
        $tests['HTTPS']['result'] = wp_remote_get(preg_replace('/^http:/', 'https:', JETPACK__API_BASE) . 'test/1/');
        $tests['HTTPS']['fail_message'] = esc_html__('Your site isn’t securely reaching the Jetpack servers.', 'jetpack');
        $identity_crisis_message = '';
        if ($identity_crisis = Jetpack::check_identity_crisis(true)) {
            foreach ($identity_crisis as $key => $value) {
                $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";
            }
            $identity_crisis = new WP_Error('identity-crisis', $identity_crisis_message, $identity_crisis);
        } else {
            $identity_crisis = 'PASS';
        }
        $tests['IDENTITY_CRISIS']['result'] = $identity_crisis;
        $tests['IDENTITY_CRISIS']['fail_message'] = esc_html__('Something has gotten mixed up in your Jetpack Connection!', 'jetpack');
        $self_xml_rpc_url = home_url('xmlrpc.php');
        $testsite_url = Jetpack::fix_url_for_bad_hosts(JETPACK__API_BASE . 'testsite/1/?url=');
        add_filter('http_request_timeout', array('Jetpack_Debugger', 'jetpack_increase_timeout'));
        $tests['SELF']['result'] = wp_remote_get($testsite_url . $self_xml_rpc_url);
        if (is_wp_error($tests['SELF']['result']) && 0 == strpos($tests['SELF']['result']->get_error_message(), 'Operation timed out')) {
            $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');
        } else {
            $tests['SELF']['fail_message'] = esc_html__('It looks like your site can not communicate properly with Jetpack.', 'jetpack');
        }
        remove_filter('http_request_timeout', array('Jetpack_Debugger', 'jetpack_increase_timeout'));
        ?>
		<div class="wrap">
			<h2><?php 
        esc_html_e('Jetpack Debugging Center', 'jetpack');
        ?>
</h2>
			<h3><?php 
        _e("Testing your site's compatibility with Jetpack...", 'jetpack');
        ?>
</h3>
			<div class="jetpack-debug-test-container">
			<?php 
        ob_start();
        foreach ($tests as $test_name => $test_info) {
            if ('PASS' !== $test_info['result'] && (is_wp_error($test_info['result']) || false == ($response_code = wp_remote_retrieve_response_code($test_info['result'])) || '200' != $response_code)) {
                $debug_info .= $test_name . ": FAIL\r\n";
                ?>
					<div class="jetpack-test-error">
						<p>
							<a class="jetpack-test-heading" href="#"><?php 
                echo $test_info['fail_message'];
                ?>
							<span class="noticon noticon-collapse"></span>
							</a>
						</p>
						<pre class="jetpack-test-details"><?php 
                echo esc_html($test_name);
                ?>
:
	<?php 
                echo esc_html(is_wp_error($test_info['result']) ? $test_info['result']->get_error_message() : print_r($test_info['result'], 1));
                ?>
</pre>
					</div><?php 
            } else {
                $debug_info .= $test_name . ": PASS\r\n";
            }
            $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));
            ?>
			<?php 
        }
        $html = ob_get_clean();
        if ('' == trim($html)) {
            echo '<div class="jetpack-tests-succed">' . esc_html__('Your Jetpack setup looks a-okay!', 'jetpack') . '</div>';
        } else {
            echo '<h3>' . esc_html__('There seems to be a problem with your site’s ability to communicate with Jetpack!', 'jetpack') . '</h3>';
            echo $html;
        }
        $debug_info .= "\r\n\r\nRAW TEST RESULTS:" . $debug_raw_info . "\r\n";
        ?>
			</div>
			<div class="entry-content">
				<h3><?php 
        esc_html_e('Trouble with Jetpack?', 'jetpack');
        ?>
</h3>
				<h4><?php 
        esc_html_e('It may be caused by one of these issues, which you can diagnose yourself:', 'jetpack');
        ?>
</h4>
				<ol>
					<li><b><em><?php 
        esc_html_e('A known issue.', 'jetpack');
        ?>
</em></b>  <?php 
        echo sprintf(__('Some themes and plugins have <a href="%1$s" target="_blank">known conflicts</a> with Jetpack – check the <a href="%2$s" target="_blank">list</a>. (You can also browse the <a href="%3$s" target="_blank">Jetpack support pages</a> or <a href="%4$s" target="_blank">Jetpack support forum</a> to see if others have experienced and solved the problem.)', 'jetpack'), 'http://jetpack.com/support/getting-started-with-jetpack/known-issues/', 'http://jetpack.com/support/getting-started-with-jetpack/known-issues/', 'http://jetpack.com/support/', 'https://wordpress.org/support/plugin/jetpack');
        ?>
</li>
					<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>
					<li>
						<b><em><?php 
        esc_html_e('A theme conflict.', 'jetpack');
        ?>
</em></b>
						<?php 
        $default_theme = wp_get_theme(WP_DEFAULT_THEME);
        if ($default_theme->exists()) {
            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')));
        } else {
            esc_html_e("If your problem isn't known or caused by a plugin, try activating the default WordPress theme.", 'jetpack');
        }
        ?>
						<?php 
        esc_html_e("If this solves the problem, something in your theme is probably broken – let the theme's author know.", 'jetpack');
        ?>
					</li>
					<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'));
        ?>
						<ul>
							<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>
							<li>- <?php 
        esc_html_e("If you get a 404 message, contact your web host. Their security may block XMLRPC.", 'jetpack');
        ?>
</li>
						</ul>
					</li>
				</ol>
				<?php 
        if (self::is_jetpack_support_open()) {
            ?>
				<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)));
            ?>
				</p>
				<?php 
        }
        ?>
				<?php 
        if (Jetpack::is_active()) {
            ?>
					<hr />
					<div id="connected-user-details">
						<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>
					</div>
				<?php 
        }
        ?>
			</div>
			<div id="contact-message" <?php 
        if (!isset($_GET['contact'])) {
            ?>
  style="display:none" <?php 
        }
        ?>
>
			<?php 
        if (self::is_jetpack_support_open()) {
            ?>
				<form id="contactme" method="post" action="https://jetpack.com/contact-support/">
					<input type="hidden" name="action" value="submit">
					<input type="hidden" name="jetpack" value="needs-service">

					<input type="hidden" name="contact_form" id="contact_form" value="1">
					<input type="hidden" name="blog_url" id="blog_url" value="<?php 
            echo esc_attr(site_url());
            ?>
">
					<?php 
            $subject_line = sprintf(_x('from: %s Jetpack contact form', 'Support request email subject line', 'jetpack'), esc_attr(site_url()));
            if (Jetpack::is_development_version()) {
                $subject_line = 'BETA ' . $subject_line;
            }
            $subject_line_input = printf('<input type="hidden" name="subject" id="subject" value="%s"">', $subject_line);
            ?>
					<div class="formbox">
						<label for="message" class="h"><?php 
            esc_html_e('Please describe the problem you are having.', 'jetpack');
            ?>
</label>
						<textarea name="message" cols="40" rows="7" id="did"></textarea>
					</div>

					<div id="name_div" class="formbox">
						<label class="h" for="your_name"><?php 
            esc_html_e('Name', 'jetpack');
            ?>
</label>
			  			<span class="errormsg"><?php 
            esc_html_e('Let us know your name.', 'jetpack');
            ?>
</span>
						<input name="your_name" type="text" id="your_name" value="<?php 
            esc_html_e($current_user->display_name, 'jetpack');
            ?>
" size="40">
					</div>

					<div id="email_div" class="formbox">
						<label class="h" for="your_email"><?php 
            esc_html_e('E-mail', 'jetpack');
            ?>
</label>
			  			<span class="errormsg"><?php 
            esc_html_e('Use a valid email address.', 'jetpack');
            ?>
</span>
						<input name="your_email" type="text" id="your_email" value="<?php 
            esc_html_e($current_user->user_email, 'jetpack');
            ?>
" size="40">
					</div>

					<div id="toggle_debug_form_info" class="formbox">
						<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>
					</div>

					<div id="debug_info_form_div" class="formbox" style="display:none">
						<label class="h" for="debug_info"><?php 
            esc_html_e('Debug Info', 'jetpack');
            ?>
</label>
			  			<textarea name="debug_info" cols="40" rows="7" id="debug_form_info"><?php 
            echo esc_attr($debug_info);
            ?>
</textarea>
					</div>

					<div style="clear: both;"></div>

					<div id="blog_div" class="formbox">
						<div id="submit_div" class="contact-support">
						<input type="submit" name="submit" value="<?php 
            esc_html_e('Submit &#187;', 'jetpack');
            ?>
">
						</div>
					</div>
					<div style="clear: both;"></div>
				</form>
			<?php 
        }
        ?>
		</div> <!-- contact-message, hidden by default. -->
		<div id="toggle_debug_info"><a href="#"><?php 
        _e('View Advanced Debug Results', 'jetpack');
        ?>
</a></div>
			<div id="debug_info_div" style="display:none">
			<h4><?php 
        esc_html_e('Debug Info', 'jetpack');
        ?>
</h4>
			<div id="debug_info"><pre><?php 
        echo esc_html($debug_info);
        ?>
</pre></div>
		</div>
		</div>
	<?php 
    }
 public function setUp()
 {
     parent::setUp();
     $this->constant_module = Jetpack_Sync_Modules::get_module("constants");
 }
 /**
  * Returns any object that is able to be synced
  */
 function sync_object($args)
 {
     // e.g. posts, post, 5
     list($module_name, $object_type, $id) = $args;
     require_once dirname(__FILE__) . '/sync/class.jetpack-sync-modules.php';
     require_once dirname(__FILE__) . '/sync/class.jetpack-sync-sender.php';
     $sync_module = Jetpack_Sync_Modules::get_module($module_name);
     $codec = Jetpack_Sync_Sender::get_instance()->get_codec();
     return $codec->encode($sync_module->get_object_by_id($object_type, $id));
 }