public static sync_idc_optin ( ) : boolean | ||
return | boolean |
public static function sync_idc_optin()
{
if (Jetpack_Constants::is_defined('JETPACK_SYNC_IDC_OPTIN')) {
$default = Jetpack_Constants::get_constant('JETPACK_SYNC_IDC_OPTIN');
} else {
$default = !Jetpack_Constants::is_defined('SUNRISE') && !is_multisite();
}
/**
* Allows sites to optin to IDC mitigation which blocks the site from syncing to WordPress.com when the home
* URL or site URL do not match what WordPress.com expects. The default value is either false, or the value of
* JETPACK_SYNC_IDC_OPTIN constant if set.
*
* @since 4.3.2
*
* @param bool $default Whether the site is opted in to IDC mitigation.
*/
return (bool) apply_filters('jetpack_sync_idc_optin', $default);
}
static function send_data($data, $codec_name, $sent_timestamp, $queue_id) { Jetpack::load_xml_rpc_client(); $query_args = array('sync' => '1', 'codec' => $codec_name, 'timestamp' => $sent_timestamp, 'queue' => $queue_id); if (Jetpack::sync_idc_optin()) { $query_args['home'] = get_home_url(); // Send home url option to check for Identity Crisis server-side $query_args['siteurl'] = get_site_url(); // Send home url option to check for Identity Crisis server-side } $url = add_query_arg($query_args, Jetpack::xmlrpc_api_url()); $rpc = new Jetpack_IXR_Client(array('url' => $url, 'user_id' => JETPACK_MASTER_USER, 'timeout' => 30)); $result = $rpc->query('jetpack.syncActions', $data); if (!$result) { return $rpc->get_jetpack_error(); } return $rpc->getResponse(); }