Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack
File: class.jetpack.php
// Upgrade to 8.4.0.
[500] Fix | Delete
if ( Jetpack_Options::get_option( 'ab_connect_banner_green_bar' ) ) {
[501] Fix | Delete
Jetpack_Options::delete_option( 'ab_connect_banner_green_bar' );
[502] Fix | Delete
}
[503] Fix | Delete
[504] Fix | Delete
// Update to 8.8.x (WordPress 5.5 Compatibility).
[505] Fix | Delete
if ( Jetpack_Options::get_option( 'autoupdate_plugins' ) ) {
[506] Fix | Delete
$updated = update_site_option(
[507] Fix | Delete
'auto_update_plugins',
[508] Fix | Delete
array_unique(
[509] Fix | Delete
array_merge(
[510] Fix | Delete
(array) Jetpack_Options::get_option( 'autoupdate_plugins', array() ),
[511] Fix | Delete
(array) get_site_option( 'auto_update_plugins', array() )
[512] Fix | Delete
)
[513] Fix | Delete
)
[514] Fix | Delete
);
[515] Fix | Delete
[516] Fix | Delete
if ( $updated ) {
[517] Fix | Delete
Jetpack_Options::delete_option( 'autoupdate_plugins' );
[518] Fix | Delete
} // Should we have some type of fallback if something fails here?
[519] Fix | Delete
}
[520] Fix | Delete
[521] Fix | Delete
if ( did_action( 'wp_loaded' ) ) {
[522] Fix | Delete
self::upgrade_on_load();
[523] Fix | Delete
} else {
[524] Fix | Delete
add_action(
[525] Fix | Delete
'wp_loaded',
[526] Fix | Delete
array( __CLASS__, 'upgrade_on_load' )
[527] Fix | Delete
);
[528] Fix | Delete
}
[529] Fix | Delete
}
[530] Fix | Delete
}
[531] Fix | Delete
}
[532] Fix | Delete
[533] Fix | Delete
/**
[534] Fix | Delete
* Runs upgrade routines that need to have modules loaded.
[535] Fix | Delete
*/
[536] Fix | Delete
public static function upgrade_on_load() {
[537] Fix | Delete
[538] Fix | Delete
// Not attempting any upgrades if jetpack_modules_loaded did not fire.
[539] Fix | Delete
// This can happen in case Jetpack has been just upgraded and is
[540] Fix | Delete
// being initialized late during the page load. In this case we wait
[541] Fix | Delete
// until the next proper admin page load with Jetpack active.
[542] Fix | Delete
if ( ! did_action( 'jetpack_modules_loaded' ) ) {
[543] Fix | Delete
delete_transient( self::$plugin_upgrade_lock_key );
[544] Fix | Delete
[545] Fix | Delete
return;
[546] Fix | Delete
}
[547] Fix | Delete
[548] Fix | Delete
self::maybe_set_version_option();
[549] Fix | Delete
[550] Fix | Delete
if ( method_exists( 'Jetpack_Widget_Conditions', 'migrate_post_type_rules' ) ) {
[551] Fix | Delete
Jetpack_Widget_Conditions::migrate_post_type_rules();
[552] Fix | Delete
}
[553] Fix | Delete
[554] Fix | Delete
if (
[555] Fix | Delete
class_exists( 'Jetpack_Sitemap_Manager' )
[556] Fix | Delete
) {
[557] Fix | Delete
do_action( 'jetpack_sitemaps_purge_data' );
[558] Fix | Delete
}
[559] Fix | Delete
[560] Fix | Delete
// Delete old stats cache.
[561] Fix | Delete
delete_option( 'jetpack_restapi_stats_cache' );
[562] Fix | Delete
[563] Fix | Delete
delete_transient( self::$plugin_upgrade_lock_key );
[564] Fix | Delete
}
[565] Fix | Delete
[566] Fix | Delete
/**
[567] Fix | Delete
* Saves all the currently active modules to options.
[568] Fix | Delete
* Also fires Action hooks for each newly activated and deactivated module.
[569] Fix | Delete
*
[570] Fix | Delete
* @param array $modules Array of active modules to be saved in options.
[571] Fix | Delete
*
[572] Fix | Delete
* @return bool $success true for success, false for failure.
[573] Fix | Delete
*/
[574] Fix | Delete
public static function update_active_modules( $modules ) {
[575] Fix | Delete
return ( new Modules() )->update_active( $modules );
[576] Fix | Delete
}
[577] Fix | Delete
[578] Fix | Delete
/**
[579] Fix | Delete
* Remove all active modules.
[580] Fix | Delete
*
[581] Fix | Delete
* @return void
[582] Fix | Delete
*/
[583] Fix | Delete
public static function delete_active_modules() {
[584] Fix | Delete
self::update_active_modules( array() );
[585] Fix | Delete
}
[586] Fix | Delete
[587] Fix | Delete
/**
[588] Fix | Delete
* Adds a hook to plugins_loaded at a priority that's currently the earliest
[589] Fix | Delete
* available.
[590] Fix | Delete
*/
[591] Fix | Delete
public function add_configure_hook() {
[592] Fix | Delete
global $wp_filter;
[593] Fix | Delete
[594] Fix | Delete
$current_priority = has_filter( 'plugins_loaded', array( $this, 'configure' ) );
[595] Fix | Delete
if ( false !== $current_priority ) {
[596] Fix | Delete
remove_action( 'plugins_loaded', array( $this, 'configure' ), $current_priority );
[597] Fix | Delete
}
[598] Fix | Delete
[599] Fix | Delete
$taken_priorities = array_map( 'intval', array_keys( $wp_filter['plugins_loaded']->callbacks ) );
[600] Fix | Delete
sort( $taken_priorities );
[601] Fix | Delete
[602] Fix | Delete
$first_priority = array_shift( $taken_priorities );
[603] Fix | Delete
[604] Fix | Delete
if ( $first_priority <= PHP_INT_MIN ) {
[605] Fix | Delete
$new_priority = PHP_INT_MIN;
[606] Fix | Delete
} else {
[607] Fix | Delete
$new_priority = $first_priority - 1;
[608] Fix | Delete
}
[609] Fix | Delete
[610] Fix | Delete
add_action( 'plugins_loaded', array( $this, 'configure' ), $new_priority );
[611] Fix | Delete
}
[612] Fix | Delete
[613] Fix | Delete
/**
[614] Fix | Delete
* Constructor. Initializes WordPress hooks
[615] Fix | Delete
*/
[616] Fix | Delete
private function __construct() {
[617] Fix | Delete
/*
[618] Fix | Delete
* Check for and alert any deprecated hooks
[619] Fix | Delete
*/
[620] Fix | Delete
add_action( 'init', array( $this, 'deprecated_hooks' ) );
[621] Fix | Delete
[622] Fix | Delete
// Note how this runs at an earlier plugin_loaded hook intentionally to accomodate for other plugins.
[623] Fix | Delete
add_action( 'plugin_loaded', array( $this, 'add_configure_hook' ), 90 );
[624] Fix | Delete
add_action( 'network_plugin_loaded', array( $this, 'add_configure_hook' ), 90 );
[625] Fix | Delete
add_action( 'mu_plugin_loaded', array( $this, 'add_configure_hook' ), 90 );
[626] Fix | Delete
add_action( 'plugins_loaded', array( $this, 'late_initialization' ), 90 );
[627] Fix | Delete
[628] Fix | Delete
add_action( 'jetpack_verify_signature_error', array( $this, 'track_xmlrpc_error' ) );
[629] Fix | Delete
[630] Fix | Delete
/**
[631] Fix | Delete
* Prepare Gutenberg Editor functionality
[632] Fix | Delete
*
[633] Fix | Delete
* The hooks previously here have been moved to modules/blocks.php but leaving this here pending
[634] Fix | Delete
* a longer investigation to see if code is expecting the Gutenberg class to always be available.
[635] Fix | Delete
*/
[636] Fix | Delete
require_once JETPACK__PLUGIN_DIR . 'class.jetpack-gutenberg.php';
[637] Fix | Delete
add_action( 'set_user_role', array( $this, 'maybe_clear_other_linked_admins_transient' ), 10, 3 );
[638] Fix | Delete
[639] Fix | Delete
add_action( 'jetpack_event_log', array( 'Jetpack', 'log' ), 10, 2 );
[640] Fix | Delete
[641] Fix | Delete
add_filter( 'login_url', array( $this, 'login_url' ), 10, 2 );
[642] Fix | Delete
add_action( 'login_init', array( $this, 'login_init' ) );
[643] Fix | Delete
[644] Fix | Delete
// Set up the REST authentication hooks.
[645] Fix | Delete
Connection_Rest_Authentication::init();
[646] Fix | Delete
[647] Fix | Delete
add_action( 'admin_init', array( $this, 'admin_init' ) );
[648] Fix | Delete
add_action( 'admin_init', array( $this, 'dismiss_jetpack_notice' ) );
[649] Fix | Delete
[650] Fix | Delete
add_filter( 'admin_body_class', array( $this, 'admin_body_class' ), 20 );
[651] Fix | Delete
[652] Fix | Delete
// Filter the dashboard meta box order to swap the new one in in place of the old one.
[653] Fix | Delete
add_filter( 'get_user_option_meta-box-order_dashboard', array( $this, 'get_user_option_meta_box_order_dashboard' ) );
[654] Fix | Delete
[655] Fix | Delete
// WordPress dashboard widget.
[656] Fix | Delete
require_once JETPACK__PLUGIN_DIR . 'class-jetpack-stats-dashboard-widget.php';
[657] Fix | Delete
add_action( 'wp_dashboard_setup', array( new Jetpack_Stats_Dashboard_Widget(), 'init' ) );
[658] Fix | Delete
[659] Fix | Delete
// Returns HTTPS support status.
[660] Fix | Delete
add_action( 'wp_ajax_jetpack-recheck-ssl', array( $this, 'ajax_recheck_ssl' ) );
[661] Fix | Delete
[662] Fix | Delete
add_action( 'wp_loaded', array( $this, 'register_assets' ) );
[663] Fix | Delete
[664] Fix | Delete
/**
[665] Fix | Delete
* These actions run checks to load additional files.
[666] Fix | Delete
* They check for external files or plugins, so they need to run as late as possible.
[667] Fix | Delete
*/
[668] Fix | Delete
add_action( 'wp_head', array( $this, 'check_open_graph' ), 1 );
[669] Fix | Delete
add_action( 'web_stories_story_head', array( $this, 'check_open_graph' ), 1 );
[670] Fix | Delete
add_action( 'plugins_loaded', array( $this, 'check_twitter_tags' ), 999 );
[671] Fix | Delete
add_action( 'plugins_loaded', array( $this, 'check_rest_api_compat' ), 1000 );
[672] Fix | Delete
[673] Fix | Delete
add_filter( 'plugins_url', array( 'Jetpack', 'maybe_min_asset' ), 1, 3 );
[674] Fix | Delete
add_action( 'style_loader_src', array( 'Jetpack', 'set_suffix_on_min' ), 10, 2 );
[675] Fix | Delete
[676] Fix | Delete
add_filter( 'profile_update', array( 'Jetpack', 'user_meta_cleanup' ) );
[677] Fix | Delete
[678] Fix | Delete
add_filter( 'jetpack_get_default_modules', array( $this, 'filter_default_modules' ) );
[679] Fix | Delete
add_filter( 'jetpack_get_default_modules', array( $this, 'handle_deprecated_modules' ), 99 );
[680] Fix | Delete
[681] Fix | Delete
add_action(
[682] Fix | Delete
'plugins_loaded',
[683] Fix | Delete
function () {
[684] Fix | Delete
if ( User_Agent_Info::is_mobile_app() ) {
[685] Fix | Delete
add_filter( 'get_edit_post_link', '__return_empty_string' );
[686] Fix | Delete
}
[687] Fix | Delete
}
[688] Fix | Delete
);
[689] Fix | Delete
[690] Fix | Delete
// Update the site's Jetpack plan and products from API on heartbeats.
[691] Fix | Delete
add_action( 'jetpack_heartbeat', array( Jetpack_Plan::class, 'refresh_from_wpcom' ) );
[692] Fix | Delete
[693] Fix | Delete
// Actually push the stats on shutdown.
[694] Fix | Delete
if ( ! has_action( 'shutdown', array( $this, 'push_stats' ) ) ) {
[695] Fix | Delete
add_action( 'shutdown', array( $this, 'push_stats' ) );
[696] Fix | Delete
}
[697] Fix | Delete
[698] Fix | Delete
// After a successful connection.
[699] Fix | Delete
add_action( 'jetpack_site_registered', array( $this, 'activate_default_modules_on_site_register' ) );
[700] Fix | Delete
add_action( 'jetpack_site_registered', array( $this, 'handle_unique_registrations_stats' ) );
[701] Fix | Delete
add_action( 'jetpack_site_registered', array( Reader_Link::class, 'activate_on_connection' ), 9 );
[702] Fix | Delete
[703] Fix | Delete
// Actions for Manager::authorize().
[704] Fix | Delete
add_action( 'jetpack_authorize_starting', array( $this, 'authorize_starting' ) );
[705] Fix | Delete
add_action( 'jetpack_authorize_ending_linked', array( $this, 'authorize_ending_linked' ) );
[706] Fix | Delete
add_action( 'jetpack_authorize_ending_authorized', array( $this, 'authorize_ending_authorized' ) );
[707] Fix | Delete
[708] Fix | Delete
Jetpack_Client_Server::init();
[709] Fix | Delete
add_action( 'jetpack_client_authorize_error', array( Jetpack_Client_Server::class, 'client_authorize_error' ) );
[710] Fix | Delete
add_filter( 'jetpack_client_authorize_already_authorized_url', array( Jetpack_Client_Server::class, 'client_authorize_already_authorized_url' ) );
[711] Fix | Delete
add_action( 'jetpack_client_authorize_processing', array( Jetpack_Client_Server::class, 'client_authorize_processing' ) );
[712] Fix | Delete
add_filter( 'jetpack_client_authorize_fallback_url', array( Jetpack_Client_Server::class, 'client_authorize_fallback_url' ) );
[713] Fix | Delete
[714] Fix | Delete
// Filters for the Manager::get_token() urls and request body.
[715] Fix | Delete
add_filter( 'jetpack_token_redirect_url', array( Authorize_Redirect::class, 'filter_connect_redirect_url' ) );
[716] Fix | Delete
add_filter( 'jetpack_token_request_body', array( __CLASS__, 'filter_token_request_body' ) );
[717] Fix | Delete
[718] Fix | Delete
// Filter for the `jetpack/v4/connection/data` API response.
[719] Fix | Delete
add_filter( 'jetpack_current_user_connection_data', array( __CLASS__, 'filter_jetpack_current_user_connection_data' ) );
[720] Fix | Delete
[721] Fix | Delete
// Actions for successful reconnect.
[722] Fix | Delete
add_action( 'jetpack_reconnection_completed', array( $this, 'reconnection_completed' ) );
[723] Fix | Delete
[724] Fix | Delete
// Actions for successful disconnect.
[725] Fix | Delete
add_action( 'jetpack_site_disconnected', array( $this, 'jetpack_site_disconnected' ) );
[726] Fix | Delete
[727] Fix | Delete
// Actions for licensing.
[728] Fix | Delete
Licensing::instance()->initialize();
[729] Fix | Delete
[730] Fix | Delete
// Filters for Sync Callables.
[731] Fix | Delete
add_filter( 'jetpack_sync_callable_whitelist', array( $this, 'filter_sync_callable_whitelist' ), 10, 1 );
[732] Fix | Delete
add_filter( 'jetpack_sync_multisite_callable_whitelist', array( $this, 'filter_sync_multisite_callable_whitelist' ), 10, 1 );
[733] Fix | Delete
[734] Fix | Delete
// Make resources use static domain when possible.
[735] Fix | Delete
add_filter( 'jetpack_static_url', array( 'Automattic\\Jetpack\\Assets', 'staticize_subdomain' ) );
[736] Fix | Delete
[737] Fix | Delete
// Validate the domain names in Jetpack development versions.
[738] Fix | Delete
add_action( 'jetpack_pre_register', array( static::class, 'registration_check_domains' ) );
[739] Fix | Delete
[740] Fix | Delete
// Register product descriptions for partner coupon usage.
[741] Fix | Delete
add_filter( 'jetpack_partner_coupon_products', array( $this, 'get_partner_coupon_product_descriptions' ) );
[742] Fix | Delete
[743] Fix | Delete
// Actions for conditional recommendations.
[744] Fix | Delete
add_action( 'plugins_loaded', array( 'Jetpack_Recommendations', 'init_conditional_recommendation_actions' ) );
[745] Fix | Delete
[746] Fix | Delete
// Add 5-star
[747] Fix | Delete
add_filter( 'plugin_row_meta', array( $this, 'add_5_star_review_link' ), 10, 2 );
[748] Fix | Delete
add_action( 'init', array( Deprecate::class, 'instance' ) );
[749] Fix | Delete
}
[750] Fix | Delete
[751] Fix | Delete
/**
[752] Fix | Delete
* Before everything else starts getting initalized, we need to initialize Jetpack using the
[753] Fix | Delete
* Config object.
[754] Fix | Delete
*/
[755] Fix | Delete
public function configure() {
[756] Fix | Delete
$config = new Config();
[757] Fix | Delete
[758] Fix | Delete
foreach (
[759] Fix | Delete
array(
[760] Fix | Delete
'jitm',
[761] Fix | Delete
'sync',
[762] Fix | Delete
'account_protection',
[763] Fix | Delete
'waf',
[764] Fix | Delete
'videopress',
[765] Fix | Delete
'stats',
[766] Fix | Delete
'stats_admin',
[767] Fix | Delete
'import',
[768] Fix | Delete
)
[769] Fix | Delete
as $feature
[770] Fix | Delete
) {
[771] Fix | Delete
$config->ensure( $feature );
[772] Fix | Delete
}
[773] Fix | Delete
[774] Fix | Delete
$config->ensure(
[775] Fix | Delete
'connection',
[776] Fix | Delete
array(
[777] Fix | Delete
'slug' => 'jetpack',
[778] Fix | Delete
'name' => 'Jetpack',
[779] Fix | Delete
)
[780] Fix | Delete
);
[781] Fix | Delete
[782] Fix | Delete
// Identity crisis package.
[783] Fix | Delete
$config->ensure(
[784] Fix | Delete
'identity_crisis',
[785] Fix | Delete
array(
[786] Fix | Delete
'slug' => 'jetpack',
[787] Fix | Delete
'admin_page' => '/wp-admin/admin.php?page=jetpack',
[788] Fix | Delete
)
[789] Fix | Delete
);
[790] Fix | Delete
[791] Fix | Delete
$config->ensure( 'search' );
[792] Fix | Delete
[793] Fix | Delete
if ( ! $this->connection_manager ) {
[794] Fix | Delete
$this->connection_manager = new Connection_Manager( 'jetpack' );
[795] Fix | Delete
}
[796] Fix | Delete
[797] Fix | Delete
$modules = new Automattic\Jetpack\Modules();
[798] Fix | Delete
if ( $modules->is_active( 'publicize' ) && $this->connection_manager->has_connected_user() ) {
[799] Fix | Delete
$config->ensure( 'publicize' );
[800] Fix | Delete
}
[801] Fix | Delete
[802] Fix | Delete
add_action( 'jetpack_initialize_tracking', array( $this, 'initialize_tracking' ) );
[803] Fix | Delete
[804] Fix | Delete
/*
[805] Fix | Delete
* Load things that should only be in Network Admin.
[806] Fix | Delete
*
[807] Fix | Delete
* For now blow away everything else until a more full
[808] Fix | Delete
* understanding of what is needed at the network level is
[809] Fix | Delete
* available
[810] Fix | Delete
*/
[811] Fix | Delete
if ( is_multisite() ) {
[812] Fix | Delete
$network = Jetpack_Network::init();
[813] Fix | Delete
$network->set_connection( $this->connection_manager );
[814] Fix | Delete
}
[815] Fix | Delete
[816] Fix | Delete
$is_connection_ready = self::is_connection_ready();
[817] Fix | Delete
[818] Fix | Delete
if ( $is_connection_ready ) {
[819] Fix | Delete
add_action( 'login_form_jetpack_json_api_authorization', array( $this, 'login_form_json_api_authorization' ) );
[820] Fix | Delete
$this->run_initialize_tracking_action();
[821] Fix | Delete
[822] Fix | Delete
Jetpack_Heartbeat::init();
[823] Fix | Delete
if ( self::is_module_active( 'stats' ) && self::is_module_active( 'search' ) ) {
[824] Fix | Delete
require_once JETPACK__PLUGIN_DIR . '_inc/lib/class.jetpack-search-performance-logger.php';
[825] Fix | Delete
Jetpack_Search_Performance_Logger::init();
[826] Fix | Delete
}
[827] Fix | Delete
} else {
[828] Fix | Delete
add_action( 'jetpack_agreed_to_terms_of_service', array( $this, 'run_initialize_tracking_action' ) );
[829] Fix | Delete
add_action( 'rest_api_init', array( $this, 'run_initialize_tracking_action' ) );
[830] Fix | Delete
add_filter(
[831] Fix | Delete
'xmlrpc_methods',
[832] Fix | Delete
function ( $methods ) {
[833] Fix | Delete
$this->run_initialize_tracking_action();
[834] Fix | Delete
return $methods;
[835] Fix | Delete
},
[836] Fix | Delete
1
[837] Fix | Delete
);
[838] Fix | Delete
}
[839] Fix | Delete
[840] Fix | Delete
// Initialize remote file upload request handlers.
[841] Fix | Delete
$this->add_remote_request_handlers();
[842] Fix | Delete
[843] Fix | Delete
/*
[844] Fix | Delete
* Enable enhanced handling of previewing sites in Calypso
[845] Fix | Delete
*/
[846] Fix | Delete
if ( $is_connection_ready ) {
[847] Fix | Delete
require_once JETPACK__PLUGIN_DIR . '_inc/lib/class.jetpack-iframe-embed.php';
[848] Fix | Delete
add_action( 'init', array( 'Jetpack_Iframe_Embed', 'init' ), 9, 0 );
[849] Fix | Delete
add_action( 'rest_api_init', array( $this, 'maybe_initialize_rest_jsonapi' ) );
[850] Fix | Delete
}
[851] Fix | Delete
}
[852] Fix | Delete
[853] Fix | Delete
/**
[854] Fix | Delete
* Runs on plugins_loaded. Use this to add code that needs to be executed later than other
[855] Fix | Delete
* initialization code.
[856] Fix | Delete
*
[857] Fix | Delete
* @action plugins_loaded
[858] Fix | Delete
*/
[859] Fix | Delete
public function late_initialization() {
[860] Fix | Delete
add_action( 'after_setup_theme', array( 'Jetpack', 'load_modules' ), -2 );
[861] Fix | Delete
My_Jetpack_Initializer::init();
[862] Fix | Delete
[863] Fix | Delete
// Initialize Boost Speed Score
[864] Fix | Delete
new Speed_Score( array(), 'jetpack-dashboard' );
[865] Fix | Delete
[866] Fix | Delete
/**
[867] Fix | Delete
* Fires when Jetpack is fully loaded and ready. This is the point where it's safe
[868] Fix | Delete
* to instantiate classes from packages and namespaces that are managed by the Jetpack Autoloader.
[869] Fix | Delete
*
[870] Fix | Delete
* @since 8.1.0
[871] Fix | Delete
*
[872] Fix | Delete
* @param Jetpack $jetpack the main plugin class object.
[873] Fix | Delete
*/
[874] Fix | Delete
do_action( 'jetpack_loaded', $this );
[875] Fix | Delete
[876] Fix | Delete
add_filter( 'map_meta_cap', array( $this, 'jetpack_custom_caps' ), 1, 2 );
[877] Fix | Delete
}
[878] Fix | Delete
[879] Fix | Delete
/**
[880] Fix | Delete
* This is ported over from the manage module, which has been deprecated and baked in here.
[881] Fix | Delete
*/
[882] Fix | Delete
public function add_wpcom_to_allowed_redirect_hosts() {
[883] Fix | Delete
add_filter( 'allowed_redirect_hosts', array( $this, 'allow_wpcom_domain' ) );
[884] Fix | Delete
}
[885] Fix | Delete
[886] Fix | Delete
/**
[887] Fix | Delete
* Return $domains, with 'wordpress.com' appended.
[888] Fix | Delete
* This is ported over from the manage module, which has been deprecated and baked in here.
[889] Fix | Delete
*
[890] Fix | Delete
* @param array $domains Array of domains allowed for redirect.
[891] Fix | Delete
*
[892] Fix | Delete
* @return array
[893] Fix | Delete
*/
[894] Fix | Delete
public function allow_wpcom_domain( $domains ) {
[895] Fix | Delete
if ( empty( $domains ) ) {
[896] Fix | Delete
$domains = array();
[897] Fix | Delete
}
[898] Fix | Delete
$domains[] = 'wordpress.com';
[899] Fix | Delete
return array_unique( $domains );
[900] Fix | Delete
}
[901] Fix | Delete
[902] Fix | Delete
/**
[903] Fix | Delete
* Redirect edit post links to Calypso.
[904] Fix | Delete
*
[905] Fix | Delete
* @deprecated since 13.9
[906] Fix | Delete
*
[907] Fix | Delete
* @param string $default_url Post edit URL.
[908] Fix | Delete
* @param int $post_id Post ID.
[909] Fix | Delete
*
[910] Fix | Delete
* @return string
[911] Fix | Delete
*/
[912] Fix | Delete
public function point_edit_post_links_to_calypso( $default_url, $post_id ) {
[913] Fix | Delete
_deprecated_function( __METHOD__, '13.9' );
[914] Fix | Delete
[915] Fix | Delete
$post = get_post( $post_id );
[916] Fix | Delete
[917] Fix | Delete
if ( empty( $post ) ) {
[918] Fix | Delete
return $default_url;
[919] Fix | Delete
}
[920] Fix | Delete
[921] Fix | Delete
$post_type = $post->post_type;
[922] Fix | Delete
[923] Fix | Delete
// Mapping the allowed CPTs on WordPress.com to corresponding paths in Calypso.
[924] Fix | Delete
// https://en.support.wordpress.com/custom-post-types/.
[925] Fix | Delete
$allowed_post_types = array(
[926] Fix | Delete
'post',
[927] Fix | Delete
'page',
[928] Fix | Delete
'jetpack-portfolio',
[929] Fix | Delete
'jetpack-testimonial',
[930] Fix | Delete
);
[931] Fix | Delete
[932] Fix | Delete
if ( ! in_array( $post_type, $allowed_post_types, true ) ) {
[933] Fix | Delete
return $default_url;
[934] Fix | Delete
}
[935] Fix | Delete
[936] Fix | Delete
return Redirect::get_url(
[937] Fix | Delete
'calypso-edit-' . $post_type,
[938] Fix | Delete
array(
[939] Fix | Delete
'path' => $post_id,
[940] Fix | Delete
)
[941] Fix | Delete
);
[942] Fix | Delete
}
[943] Fix | Delete
[944] Fix | Delete
/**
[945] Fix | Delete
* Redirect edit comment links to Calypso.
[946] Fix | Delete
*
[947] Fix | Delete
* @deprecated since 13.9
[948] Fix | Delete
*
[949] Fix | Delete
* @param string $url Comment edit URL.
[950] Fix | Delete
*
[951] Fix | Delete
* @return string
[952] Fix | Delete
*/
[953] Fix | Delete
public function point_edit_comment_links_to_calypso( $url ) {
[954] Fix | Delete
_deprecated_function( __METHOD__, '13.9' );
[955] Fix | Delete
[956] Fix | Delete
// Take the `query` key value from the URL, and parse its parts to the $query_args. `amp;c` matches the comment ID.
[957] Fix | Delete
$query_args = null;
[958] Fix | Delete
wp_parse_str( wp_parse_url( $url, PHP_URL_QUERY ), $query_args );
[959] Fix | Delete
[960] Fix | Delete
return Redirect::get_url(
[961] Fix | Delete
'calypso-edit-comment',
[962] Fix | Delete
array(
[963] Fix | Delete
'path' => $query_args['amp;c'],
[964] Fix | Delete
)
[965] Fix | Delete
);
[966] Fix | Delete
}
[967] Fix | Delete
[968] Fix | Delete
/**
[969] Fix | Delete
* Extend Sync callables with Jetpack Plugin functions.
[970] Fix | Delete
*
[971] Fix | Delete
* @param array $callables list of callables.
[972] Fix | Delete
*
[973] Fix | Delete
* @return array list of callables.
[974] Fix | Delete
*/
[975] Fix | Delete
public function filter_sync_callable_whitelist( $callables ) {
[976] Fix | Delete
// Jetpack Functions.
[977] Fix | Delete
$jetpack_callables = array(
[978] Fix | Delete
'single_user_site' => array( 'Jetpack', 'is_single_user_site' ),
[979] Fix | Delete
'updates' => array( 'Jetpack', 'get_updates' ),
[980] Fix | Delete
'available_jetpack_blocks' => array( 'Jetpack_Gutenberg', 'get_availability' ), // Includes both Gutenberg blocks *and* plugins.
[981] Fix | Delete
);
[982] Fix | Delete
return array_merge( $callables, $jetpack_callables );
[983] Fix | Delete
}
[984] Fix | Delete
[985] Fix | Delete
/**
[986] Fix | Delete
* Extend Sync multisite callables with Jetpack Plugin functions.
[987] Fix | Delete
*
[988] Fix | Delete
* @param array $callables list of callables.
[989] Fix | Delete
*
[990] Fix | Delete
* @return array list of callables.
[991] Fix | Delete
*/
[992] Fix | Delete
public function filter_sync_multisite_callable_whitelist( $callables ) {
[993] Fix | Delete
[994] Fix | Delete
// Jetpack Funtions.
[995] Fix | Delete
$jetpack_multisite_callables = array(
[996] Fix | Delete
'network_name' => array( 'Jetpack', 'network_name' ),
[997] Fix | Delete
'network_allow_new_registrations' => array( 'Jetpack', 'network_allow_new_registrations' ),
[998] Fix | Delete
'network_add_new_users' => array( 'Jetpack', 'network_add_new_users' ),
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function