本文整理汇总了PHP中Jetpack::is_staging_site方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack::is_staging_site方法的具体用法?PHP Jetpack::is_staging_site怎么用?PHP Jetpack::is_staging_site使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jetpack
的用法示例。
在下文中一共展示了Jetpack::is_staging_site方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _e
_e('Disconnect Jetpack', 'jetpack');
?>
</h4>
<a class="button" id="jetpack-disconnect" href="#"><?php
esc_html_e('Disconnect site from WordPress.com', 'jetpack');
?>
</a>
</div>
</div>
<div id="jetpack-disconnect-content">
<div class="j-row">
<div class="j-col j-lrg-12 j-md-12 j-sm-12">
<?php
if (!Jetpack::is_staging_site()) {
?>
<h2><?php
_e('Disconnecting Jetpack', 'jetpack');
?>
</h2>
<p><?php
_e('Before you completely disconnect Jetpack is there anything we can do to help?', 'jetpack');
?>
</p>
<a class="button" id="confirm-disconnect" title="<?php
esc_attr_e('Disconnect Jetpack', 'jetpack');
?>
" href="<?php
echo wp_nonce_url(Jetpack::admin_url('action=disconnect'), 'jetpack-disconnect');
?>
示例2: check_identity_crisis
/**
* Checks to make sure that local options have the same values as remote options. Will cache the results for up to 24 hours.
*
* @param bool $force_recheck Whether to ignore any cached transient and manually re-check.
*
* @return array An array of options that do not match. If everything is good, it will evaluate to false.
*/
public static function check_identity_crisis($force_recheck = false)
{
if (!Jetpack::is_active() || Jetpack::is_development_mode() || Jetpack::is_staging_site()) {
return false;
}
if ($force_recheck || false === ($errors = get_transient('jetpack_has_identity_crisis'))) {
$options_to_check = self::identity_crisis_options_to_check();
$cloud_options = Jetpack::init()->get_cloud_site_options($options_to_check);
$errors = array();
foreach ($cloud_options as $cloud_key => $cloud_value) {
// If it's not the same as the local value...
if ($cloud_value !== get_option($cloud_key)) {
// Break out if we're getting errors. We are going to check the error keys later when we alert.
if ('error_code' == $cloud_key) {
$errors[$cloud_key] = $cloud_value;
break;
}
$parsed_cloud_value = parse_url($cloud_value);
// If the current options is an IP address
if (filter_var($parsed_cloud_value['host'], FILTER_VALIDATE_IP)) {
// Give the new value a Jetpack to fly in to the clouds
Jetpack::resolve_identity_crisis($cloud_key);
continue;
}
// And it's not been added to the whitelist...
if (!self::is_identity_crisis_value_whitelisted($cloud_key, $cloud_value)) {
/*
* This should be a temporary hack until a cleaner solution is found.
*
* The siteurl and home can be set to use http in General > Settings
* however some constants can be defined that can force https in wp-admin
* when this happens wpcom can confuse wporg with a fake identity
* crisis with a mismatch of http vs https when it should be allowed.
* we need to check that here.
*
* @see https://github.com/Automattic/jetpack/issues/1006
*/
if (('home' == $cloud_key || 'siteurl' == $cloud_key) && substr($cloud_value, 0, 8) == "https://" && Jetpack::init()->is_ssl_required_to_visit_site()) {
// Ok, we found a mismatch of http and https because of wp-config, not an invalid url
continue;
}
// Then kick an error!
$errors[$cloud_key] = $cloud_value;
}
}
}
}
/**
* Filters the errors returned when checking for an Identity Crisis.
*
* @since 2.3.2
*
* @param array $errors Array of Identity Crisis errors.
* @param bool $force_recheck Ignore any cached transient and manually re-check. Default to false.
*/
return apply_filters('jetpack_has_identity_crisis', $errors, $force_recheck);
}
示例3: page_admin_scripts
function page_admin_scripts()
{
if ($this->is_redirecting) {
return;
// No need for scripts on a fallback page
}
$is_dev_mode = Jetpack::is_development_mode();
// Enqueue jp.js and localize it
wp_enqueue_script('react-plugin', plugins_url('_inc/build/admin.js', JETPACK__PLUGIN_FILE), array(), JETPACK__VERSION, true);
if (!$is_dev_mode) {
// Required for Analytics
wp_enqueue_script('jp-tracks', '//stats.wp.com/w.js', array(), gmdate('YW'), true);
}
$localeSlug = explode('_', get_locale());
$localeSlug = $localeSlug[0];
// Collecting roles that can view site stats
$stats_roles = array();
$enabled_roles = function_exists('stats_get_option') ? stats_get_option('roles') : array('administrator');
foreach (get_editable_roles() as $slug => $role) {
$stats_roles[$slug] = array('name' => translate_user_role($role['name']), 'canView' => is_array($enabled_roles) ? in_array($slug, $enabled_roles, true) : false);
}
$response = rest_do_request(new WP_REST_Request('GET', '/jetpack/v4/module/all'));
$modules = $response->get_data();
// Preparing translated fields for JSON encoding by transforming all HTML entities to
// respective characters.
foreach ($modules as $slug => $data) {
$modules[$slug]['name'] = html_entity_decode($data['name']);
$modules[$slug]['description'] = html_entity_decode($data['description']);
$modules[$slug]['short_description'] = html_entity_decode($data['short_description']);
$modules[$slug]['long_description'] = html_entity_decode($data['long_description']);
}
// Add objects to be passed to the initial state of the app
wp_localize_script('react-plugin', 'Initial_State', array('WP_API_root' => esc_url_raw(rest_url()), 'WP_API_nonce' => wp_create_nonce('wp_rest'), 'pluginBaseUrl' => plugins_url('', JETPACK__PLUGIN_FILE), 'connectionStatus' => array('isActive' => Jetpack::is_active(), 'isStaging' => Jetpack::is_staging_site(), 'devMode' => array('isActive' => $is_dev_mode, 'constant' => defined('JETPACK_DEV_DEBUG') && JETPACK_DEV_DEBUG, 'url' => site_url() && false === strpos(site_url(), '.'), 'filter' => apply_filters('jetpack_development_mode', false)), 'isPublic' => '1' == get_option('blog_public'), 'isInIdentityCrisis' => Jetpack::validate_sync_error_idc_option()), 'dismissedNotices' => $this->get_dismissed_jetpack_notices(), 'isDevVersion' => Jetpack::is_development_version(), 'currentVersion' => JETPACK__VERSION, 'happinessGravIds' => jetpack_get_happiness_gravatar_ids(), 'getModules' => $modules, 'showJumpstart' => jetpack_show_jumpstart(), 'rawUrl' => Jetpack::build_raw_urls(get_home_url()), 'adminUrl' => esc_url(admin_url()), 'stats' => array('data' => array('general' => false, 'day' => false, 'week' => false, 'month' => false), 'roles' => $stats_roles), 'settingNames' => array('jetpack_holiday_snow_enabled' => function_exists('jetpack_holiday_snow_option_name') ? jetpack_holiday_snow_option_name() : false), 'userData' => array('currentUser' => jetpack_current_user_data()), 'locale' => $this->get_i18n_data(), 'localeSlug' => $localeSlug, 'jetpackStateNotices' => array('messageCode' => Jetpack::state('message'), 'errorCode' => Jetpack::state('error'), 'errorDescription' => Jetpack::state('error_description')), 'tracksUserData' => Jetpack_Tracks_Client::get_connected_user_tracks_identity(), 'currentIp' => function_exists('jetpack_protect_get_ip') ? jetpack_protect_get_ip() : false));
}
示例4: show_development_mode_notice
/**
* Get Jetpack development mode notice text and notice class.
*
* Mirrors the checks made in Jetpack::is_development_mode
*
*/
public static function show_development_mode_notice()
{
if (Jetpack::is_development_mode()) {
if (defined('JETPACK_DEV_DEBUG') && JETPACK_DEV_DEBUG) {
$notice = sprintf(__('In <a href="%s" target="_blank">Development Mode</a>, via the JETPACK_DEV_DEBUG constant being defined in wp-config.php or elsewhere.', 'jetpack'), 'https://jetpack.com/support/development-mode/');
} elseif (site_url() && false === strpos(site_url(), '.')) {
$notice = sprintf(__('In <a href="%s" target="_blank">Development Mode</a>, via site URL lacking a dot (e.g. http://localhost).', 'jetpack'), 'https://jetpack.com/support/development-mode/');
} else {
$notice = sprintf(__('In <a href="%s" target="_blank">Development Mode</a>, via the jetpack_development_mode filter.', 'jetpack'), 'https://jetpack.com/support/development-mode/');
}
echo '<div class="updated" style="border-color: #f0821e;"><p>' . $notice . '</p></div>';
}
// Throw up a notice if using a development version and as for feedback.
if (Jetpack::is_development_version()) {
/* translators: %s is a URL */
$notice = sprintf(__('You are currently running a development version of Jetpack. <a href="%s" target="_blank">Submit your feedback</a>', 'jetpack'), 'https://jetpack.com/contact-support/beta-group/');
echo '<div class="updated" style="border-color: #f0821e;"><p>' . $notice . '</p></div>';
}
// Throw up a notice if using staging mode
if (Jetpack::is_staging_site()) {
/* translators: %s is a URL */
$notice = sprintf(__('You are running Jetpack on a <a href="%s" target="_blank">staging server</a>.', 'jetpack'), 'https://jetpack.com/support/staging-sites/');
echo '<div class="updated" style="border-color: #f0821e;"><p>' . $notice . '</p></div>';
}
}
示例5: sync_allowed
static function sync_allowed()
{
return !Jetpack_Sync_Settings::get_setting('disable') && Jetpack::is_active() && !(Jetpack::is_development_mode() || Jetpack::is_staging_site()) || defined('PHPUNIT_JETPACK_TESTSUITE');
}
示例6: sync
/**
* Set up all the data and queue it for the outgoing XML-RPC request
*/
function sync()
{
if (!$this->sync) {
return false;
}
// Don't sync anything from a staging site.
if (Jetpack::is_development_mode() || Jetpack::is_staging_site()) {
return false;
}
$sync_data = $this->get_common_sync_data();
$wp_importing = defined('WP_IMPORTING') && WP_IMPORTING;
foreach ($this->sync as $sync_operation_type => $sync_operations) {
switch ($sync_operation_type) {
case 'post':
if ($wp_importing) {
break;
}
$global_post = isset($GLOBALS['post']) ? $GLOBALS['post'] : null;
$GLOBALS['post'] = null;
foreach ($sync_operations as $post_id => $settings) {
$sync_data['post'][$post_id] = $this->get_post($post_id);
if (isset($this->post_transitions[$post_id])) {
$sync_data['post'][$post_id]['transitions'] = $this->post_transitions[$post_id];
} else {
$sync_data['post'][$post_id]['transitions'] = array(false, false);
}
$sync_data['post'][$post_id]['on_behalf_of'] = $settings['on_behalf_of'];
}
$GLOBALS['post'] = $global_post;
unset($global_post);
break;
case 'comment':
if ($wp_importing) {
break;
}
$global_comment = isset($GLOBALS['comment']) ? $GLOBALS['comment'] : null;
unset($GLOBALS['comment']);
foreach ($sync_operations as $comment_id => $settings) {
$sync_data['comment'][$comment_id] = $this->get_comment($comment_id);
if (isset($this->comment_transitions[$comment_id])) {
$sync_data['comment'][$comment_id]['transitions'] = $this->comment_transitions[$comment_id];
} else {
$sync_data['comment'][$comment_id]['transitions'] = array(false, false);
}
$sync_data['comment'][$comment_id]['on_behalf_of'] = $settings['on_behalf_of'];
}
$GLOBALS['comment'] = $global_comment;
unset($global_comment);
break;
case 'option':
foreach ($sync_operations as $option => $settings) {
$sync_data['option'][$option] = array('value' => get_option($option));
}
break;
case 'constant':
foreach ($sync_operations as $constant => $settings) {
$sync_data['constant'][$constant] = array('value' => $this->get_constant($constant));
}
break;
case 'delete_post':
case 'delete_comment':
foreach ($sync_operations as $object_id => $settings) {
$sync_data[$sync_operation_type][$object_id] = array('on_behalf_of' => $settings['on_behalf_of']);
}
break;
case 'delete_option':
foreach ($sync_operations as $object_id => $settings) {
$sync_data[$sync_operation_type][$object_id] = true;
}
break;
}
}
Jetpack::xmlrpc_async_call('jetpack.syncContent', $sync_data);
}
示例7: display_sso_login_form
/**
* Ensures that we can get a nonce from WordPress.com via XML-RPC before setting
* up the hooks required to display the SSO form.
*/
public function display_sso_login_form()
{
add_filter('login_body_class', array($this, 'login_body_class'));
add_action('login_head', array($this, 'print_inline_admin_css'));
if (Jetpack::is_staging_site()) {
add_filter('login_message', array('Jetpack_SSO_Notices', 'sso_not_allowed_in_staging'));
return;
}
$sso_nonce = self::request_initial_nonce();
if (is_wp_error($sso_nonce)) {
return;
}
add_action('login_form', array($this, 'login_form'));
add_action('login_enqueue_scripts', array($this, 'login_enqueue_scripts'));
}
示例8: jetpack_connection_status
/**
* Get connection status for this Jetpack site.
*
* @since 4.3.0
*
* @return bool True if site is connected
*/
public static function jetpack_connection_status()
{
return rest_ensure_response(array('isActive' => Jetpack::is_active(), 'isStaging' => Jetpack::is_staging_site(), 'devMode' => array('isActive' => Jetpack::is_development_mode(), 'constant' => defined('JETPACK_DEV_DEBUG') && JETPACK_DEV_DEBUG, 'url' => site_url() && false === strpos(site_url(), '.'), 'filter' => apply_filters('jetpack_development_mode', false))));
}
示例9: get_health_items
protected function get_health_items()
{
$health_items = array();
// WooCommerce
// Only one of the following should present
// Check that WooCommerce is at least 2.6 or higher (feature-plugin only)
// Check that WooCommerce base_country is set
$base_country = WC()->countries->get_base_country();
if (version_compare(WC()->version, WOOCOMMERCE_CONNECT_MINIMUM_WOOCOMMERCE_VERSION, "<")) {
$health_item = $this->build_indicator('woocommerce_indicator', 'notice', 'indicator-error', sprintf(__('WooCommerce %s or higher is required (You are running %s)', 'connectforwoocommerce'), WOOCOMMERCE_CONNECT_MINIMUM_WOOCOMMERCE_VERSION, WC()->version), '');
} else {
if (empty($base_country)) {
$health_item = $this->build_indicator('woocommerce_indicator', 'notice', 'indicator-error', __('Please set Base Location in WooCommerce Settings > General', 'connectforwoocommerce'), '');
} else {
$health_item = $this->build_indicator('woocommerce_indicator', 'checkmark-circle', 'indicator-success', sprintf(__('WooCommerce %s is configured correctly', 'connectforwoocommerce'), WC()->version), '');
}
}
$health_items[] = (object) array('key' => 'woocommerce_health_items', 'title' => __('WooCommerce', 'connectforwoocommerce'), 'type' => 'indicators', 'items' => array('woocommerce_indicator' => $health_item));
// Jetpack
// Only one of the following should present
// Check that Jetpack is active
// Check that Jetpack is connected
include_once ABSPATH . 'wp-admin/includes/plugin.php';
// required for is_plugin_active
if (method_exists('Jetpack', 'is_development_mode') && method_exists('Jetpack', 'is_active')) {
$is_connected = Jetpack::is_development_mode() ? true : Jetpack::is_active();
} else {
$is_connected = false;
}
if (!is_plugin_active('jetpack/jetpack.php')) {
$health_item = $this->build_indicator('jetpack_indicator', 'notice', 'indicator-error', sprintf(__('Please install and activate the Jetpack plugin, version %s or higher', 'connectforwoocommerce'), WOOCOMMERCE_CONNECT_MINIMUM_JETPACK_VERSION), '');
} else {
if (version_compare(JETPACK__VERSION, WOOCOMMERCE_CONNECT_MINIMUM_JETPACK_VERSION, "<")) {
$health_item = $this->build_indicator('jetpack_indicator', 'notice', 'indicator-error', sprintf(__('Jetpack %s or higher is required (You are running %s)', 'connectforwoocommerce'), WOOCOMMERCE_CONNECT_MINIMUM_JETPACK_VERSION, JETPACK__VERSION), '');
} else {
if (!$is_connected) {
$health_item = $this->build_indicator('jetpack_indicator', 'notice', 'indicator-error', __('Jetpack is not connected to WordPress.com. Make sure the Jetpack plugin is installed, activated, and connected.', 'connectforwoocommerce'), '');
} else {
if (Jetpack::is_staging_site()) {
$health_item = $this->build_indicator('jetpack_indicator', 'notice', 'indicator-warning', __('This is a Jetpack staging site', 'connectforwoocommerce'), '');
} else {
$health_item = $this->build_indicator('jetpack_indicator', 'checkmark-circle', 'indicator-success', sprintf(__('Jetpack %s is connected and working correctly', 'connectforwoocommerce'), JETPACK__VERSION), '');
}
}
}
}
$health_items[] = (object) array('key' => 'jetpack_health_items', 'title' => __('Jetpack', 'connectforwoocommerce'), 'type' => 'indicators', 'items' => array('jetpack_indicator' => $health_item));
// Lastly, do the Connect for WooCommerce health check
// Check that we have schema
// Check that we are able to talk to the Connect for WooCommerce server
$schemas = $this->service_schemas_store->get_service_schemas();
$last_fetch_timestamp = $this->service_schemas_store->get_last_fetch_timestamp();
if (!is_null($last_fetch_timestamp)) {
$last_fetch_timestamp_formatted = sprintf(_x('Last updated %s ago', '%s = human-readable time difference', 'connectforwoocommerce'), human_time_diff($last_fetch_timestamp));
} else {
$last_fetch_timestamp = '';
}
if (is_null($schemas)) {
$health_item = $this->build_indicator('wcc_indicator', 'notice', 'indicator-error', __('No service data available', 'connectforwoocommerce'), '');
} else {
if (is_null($last_fetch_timestamp)) {
$health_item = $this->build_indicator('wcc_indicator', 'notice', 'indicator-warning', __('Service data was found, but may be out of date', 'connectforwoocommerce'), '');
} else {
if ($last_fetch_timestamp < time() - WOOCOMMERCE_CONNECT_SCHEMA_AGE_ERROR_THRESHOLD) {
$health_item = $this->build_indicator('wcc_indicator', 'notice', 'indicator-error', __('Service data was found, but is more than three days old', 'connectforwoocommerce'), $last_fetch_timestamp_formatted);
} else {
if ($last_fetch_timestamp < time() - WOOCOMMERCE_CONNECT_SCHEMA_AGE_WARNING_THRESHOLD) {
$health_item = $this->build_indicator('wcc_indicator', 'notice', 'indicator-warning', __('Service data was found, but is more than one day old', 'connectforwoocommerce'), $last_fetch_timestamp_formatted);
} else {
$health_item = $this->build_indicator('wcc_indicator', 'checkmark-circle', 'indicator-success', __('Service data is up-to-date', 'connectforwoocommerce'), $last_fetch_timestamp_formatted);
}
}
}
}
$health_items[] = (object) array('key' => 'wcc_health_items', 'title' => __('Connect for WooCommerce Service Data', 'connectforwoocommerce'), 'type' => 'indicators', 'items' => array('wcc_indicator' => $health_item));
return $health_items;
}
示例10: request_body
/**
* Adds useful WP/WC/WCC information to request bodies
*
* @param array $initial_body
* @return array
*/
protected function request_body($initial_body = array())
{
$default_body = array('settings' => array());
$body = array_merge($default_body, $initial_body);
// Add interesting fields to the body of each request
$body['settings'] = wp_parse_args($body['settings'], array('store_guid' => $this->get_guid(), 'base_city' => WC()->countries->get_base_city(), 'base_country' => WC()->countries->get_base_country(), 'base_state' => WC()->countries->get_base_state(), 'currency' => get_woocommerce_currency(), 'dimension_unit' => strtolower(get_option('woocommerce_dimension_unit')), 'jetpack_version' => JETPACK__VERSION, 'wc_version' => WC()->version, 'weight_unit' => strtolower(get_option('woocommerce_weight_unit')), 'wp_version' => get_bloginfo('version'), 'last_services_update' => get_option('wc_connect_services_last_update', 0), 'last_heartbeat' => get_option('wc_connect_last_heartbeat', 0), 'last_rate_request' => get_option('wc_connect_last_rate_request', 0), 'active_services' => $this->wc_connect_loader->get_active_services(), 'disable_stats' => Jetpack::is_staging_site()));
return $body;
}
示例11: test_is_staging_site_true_when_sync_error_idc_is_valid
function test_is_staging_site_true_when_sync_error_idc_is_valid()
{
add_filter('jetpack_sync_error_idc_validation', '__return_true');
$this->assertTrue(Jetpack::is_staging_site());
remove_filter('jetpack_sync_error_idc_validation', '__return_false');
}
示例12: sync_allowed
static function sync_allowed()
{
require_once dirname(__FILE__) . '/class.jetpack-sync-settings.php';
return !Jetpack_Sync_Settings::get_setting('disable') && Jetpack::is_active() && !(Jetpack::is_development_mode() || Jetpack::is_staging_site()) || defined('PHPUNIT_JETPACK_TESTSUITE');
}
示例13: get_tracking_data
/**
* Get all the tracking data.
* @return array
*/
private static function get_tracking_data()
{
$data = array();
// General site info
$data['url'] = home_url();
$data['email'] = apply_filters('woocommerce_tracker_admin_email', get_option('admin_email'));
$data['theme'] = self::get_theme_info();
// WordPress Info
$data['wp'] = self::get_wordpress_info();
// Server Info
$data['server'] = self::get_server_info();
// Plugin info
$all_plugins = self::get_all_plugins();
$data['active_plugins'] = $all_plugins['active_plugins'];
$data['inactive_plugins'] = $all_plugins['inactive_plugins'];
// Jetpack & WooCommerce Connect
$data['jetpack_version'] = defined('JETPACK__VERSION') ? JETPACK__VERSION : 'none';
$data['jetpack_connected'] = class_exists('Jetpack') && is_callable('Jetpack::is_active') && Jetpack::is_active() ? 'yes' : 'no';
$data['jetpack_is_staging'] = class_exists('Jetpack') && is_callable('Jetpack::is_staging_site') && Jetpack::is_staging_site() ? 'yes' : 'no';
$data['connect_installed'] = class_exists('WC_Connect_Loader') ? 'yes' : 'no';
$data['connect_active'] = class_exists('WC_Connect_Loader') && wp_next_scheduled('wc_connect_fetch_service_schemas') ? 'yes' : 'no';
// Store count info
$data['users'] = self::get_user_counts();
$data['products'] = self::get_product_counts();
$data['orders'] = self::get_order_counts();
// Payment gateway info
$data['gateways'] = self::get_active_payment_gateways();
// Shipping method info
$data['shipping_methods'] = self::get_active_shipping_methods();
// Get all WooCommerce options info
$data['settings'] = self::get_all_woocommerce_options_values();
// Template overrides
$data['template_overrides'] = self::get_all_template_overrides();
return apply_filters('woocommerce_tracker_data', $data);
}
示例14: page_admin_scripts
function page_admin_scripts()
{
// Enqueue jp.js and localize it
wp_enqueue_script('react-plugin', plugins_url('_inc/build/admin.js', JETPACK__PLUGIN_FILE), array(), time(), true);
wp_enqueue_style('dops-css', plugins_url('_inc/build/dops-style.css', JETPACK__PLUGIN_FILE), array(), time());
wp_enqueue_style('components-css', plugins_url('_inc/build/style.min.css', JETPACK__PLUGIN_FILE), array(), time());
$localeSlug = explode('_', get_locale());
$localeSlug = $localeSlug[0];
// Add objects to be passed to the initial state of the app
wp_localize_script('react-plugin', 'Initial_State', array('WP_API_root' => esc_url_raw(rest_url()), 'WP_API_nonce' => wp_create_nonce('wp_rest'), 'pluginBaseUrl' => plugins_url('', JETPACK__PLUGIN_FILE), 'connectionStatus' => array('isActive' => Jetpack::is_active(), 'isStaging' => Jetpack::is_staging_site(), 'devMode' => array('isActive' => Jetpack::is_development_mode(), 'constant' => defined('JETPACK_DEV_DEBUG') && JETPACK_DEV_DEBUG, 'url' => site_url() && false === strpos(site_url(), '.'), 'filter' => apply_filters('jetpack_development_mode', false))), 'dismissedNotices' => $this->get_dismissed_jetpack_notices(), 'isDevVersion' => Jetpack::is_development_version(), 'currentVersion' => JETPACK__VERSION, 'happinessGravIds' => jetpack_get_happiness_gravatar_ids(), 'getModules' => Jetpack_Core_Json_Api_Endpoints::get_modules(), 'showJumpstart' => jetpack_show_jumpstart(), 'rawUrl' => Jetpack::build_raw_urls(get_home_url()), 'adminUrl' => esc_url(admin_url()), 'statsData' => build_initial_stats_shape(), 'settingNames' => array('jetpack_holiday_snow_enabled' => function_exists('jetpack_holiday_snow_option_name') ? jetpack_holiday_snow_option_name() : false), 'userData' => array('othersLinked' => jetpack_get_other_linked_users(), 'currentUser' => jetpack_current_user_data()), 'locale' => $this->get_i18n_data(), 'localeSlug' => $localeSlug, 'jetpackStateNotices' => array('messageCode' => Jetpack::state('message'), 'errorCode' => Jetpack::state('error'), 'errorDescription' => Jetpack::state('error_description'))));
}
示例15: action_handler
function action_handler()
{
// TODO: it's really silly to have this function here - it should be
// wherever we initialize the action listeners or we're just wasting cycles
if (Jetpack::is_development_mode() || Jetpack::is_staging_site()) {
return false;
}
$current_filter = current_filter();
$args = func_get_args();
if ($current_filter === 'wp_insert_post' && $args[1]->post_type === 'revision') {
return;
}
if (in_array($current_filter, array('deleted_option', 'added_option', 'updated_option')) && !$this->is_whitelisted_option($args[0])) {
return;
}
if (in_array($current_filter, array('delete_site_option', 'add_site_option', 'update_site_option')) && !$this->is_whitelisted_network_option($args[0])) {
return;
}
// don't sync private meta
if (preg_match('/^(added|updated|deleted)_.*_meta$/', $current_filter) && $args[2][0] === '_' && !in_array($args[2], Jetpack_Sync_Defaults::$default_whitelist_meta_keys)) {
return;
}
// if we add any items to the queue, we should
// try to ensure that our script can't be killed before
// they are sent
if (function_exists('ignore_user_abort')) {
ignore_user_abort(true);
}
$this->sync_queue->add(array($current_filter, $args, get_current_user_id(), microtime(true)));
}