/** * Returns the value of the jetpack_sync_idc_optin filter, or constant. * If set to true, the site will be put into staging mode. * * @since 4.3.2 * @return bool */ 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); }
function test_jetpack_constants_is_defined_when_constant_set_to_null() { Jetpack_Constants::set_constant('TEST', null); $this->assertTrue(Jetpack_Constants::is_defined('TEST')); }