本文整理汇总了PHP中Jetpack_Sync::sync_options方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack_Sync::sync_options方法的具体用法?PHP Jetpack_Sync::sync_options怎么用?PHP Jetpack_Sync::sync_options使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jetpack_Sync
的用法示例。
在下文中一共展示了Jetpack_Sync::sync_options方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jetpack_vaultpress_sync_options
function jetpack_vaultpress_sync_options()
{
if (!class_exists('VaultPress')) {
return;
}
$vaultpress = VaultPress::init();
Jetpack_Sync::sync_options(__FILE__, $vaultpress->auto_register_option, $vaultpress->option_name);
}
示例2: __construct
function __construct() {
$this->in_jetpack = ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ? false : true;
add_action( 'init', array( &$this, 'action_init' ) );
add_action( 'admin_init', array( $this, 'admin_init' ) );
if ( $this->in_jetpack ) {
add_action( 'jetpack_activate_module_likes', array( $this, 'module_toggle' ) );
add_action( 'jetpack_deactivate_module_likes', array( $this, 'module_toggle' ) );
Jetpack::enable_module_configurable( __FILE__ );
Jetpack::module_configuration_load( __FILE__, array( $this, 'configuration_redirect' ) );
add_action('admin_print_scripts-settings_page_sharing', array( &$this, 'load_jp_css' ) );
add_filter( 'sharing_show_buttons_on_row_start', array( $this, 'configuration_target_area' ) );
$active = Jetpack::get_active_modules();
if ( ! in_array( 'sharedaddy', $active ) && ! in_array( 'publicize', $active ) ) {
add_action( 'admin_menu', array( $this, 'sharing_menu' ) ); // we don't have a sharing page yet
}
if ( in_array( 'publicize', $active ) && ! in_array( 'sharedaddy', $active ) ) {
add_action( 'pre_admin_screen_sharing', array( $this, 'sharing_block' ), 20 ); // we have a sharing page but not the global options area
add_action( 'pre_admin_screen_sharing', array( $this, 'updated_message' ), -10 );
}
if( ! in_array( 'sharedaddy', $active ) ) {
add_action( 'admin_init', array( $this, 'process_update_requests_if_sharedaddy_not_loaded' ) );
add_action( 'sharing_global_options', array( $this, 'admin_settings_showbuttonon_init' ), 19 );
add_action( 'sharing_admin_update', array( $this, 'admin_settings_showbuttonon_callback' ), 19 );
add_action( 'admin_init', array( $this, 'add_meta_box' ) );
} else {
add_filter( 'sharing_meta_box_title', array( $this, 'add_likes_to_sharing_meta_box_title' ) );
add_action( 'start_sharing_meta_box_content', array( $this, 'meta_box_content' ) );
}
Jetpack_Sync::sync_options( __FILE__, 'social_notifications_like' );
} else { // wpcom
add_action( 'admin_init', array( $this, 'add_meta_box' ) );
add_action( 'end_likes_meta_box_content', array( $this, 'sharing_meta_box_content' ) );
add_filter( 'likes_meta_box_title', array( $this, 'add_likes_to_sharing_meta_box_title' ) );
}
add_action( 'admin_init', array( $this, 'admin_discussion_likes_settings_init' ) ); // Likes notifications
add_action( 'admin_bar_menu', array( $this, 'admin_bar_likes' ), 60 );
add_action( 'save_post', array( $this, 'meta_box_save' ) );
add_action( 'sharing_global_options', array( $this, 'admin_settings_init' ), 20 );
add_action( 'sharing_admin_update', array( $this, 'admin_settings_callback' ), 20 );
}
示例3: define
<?php
/**
* Module Name: Notifications
* Module Description: Monitor and manage your site's activity with Notifications in your Toolbar and on WordPress.com.
* Sort Order: 1
* First Introduced: 1.9
*/
if (!defined('JETPACK_NOTES__CACHE_BUSTER')) {
define('JETPACK_NOTES__CACHE_BUSTER', JETPACK__VERSION . '-' . gmdate('oW'));
}
Jetpack_Sync::sync_options(__FILE__, 'home', 'blogname', 'siteurl', 'permalink_structure', 'category_base', 'tag_base', 'comment_moderation', 'default_comment_status', 'thread_comments', 'thread_comments_depth');
class Jetpack_Notifications
{
var $jetpack = false;
/**
* Singleton
* @static
*/
function &init()
{
static $instance = array();
if (!$instance) {
$instance[0] = new Jetpack_Notifications();
}
return $instance[0];
}
function Jetpack_Notifications()
{
$this->jetpack = Jetpack::init();
add_action('init', array(&$this, 'action_init'));
示例4: test_backwards_compatibility_sync_options
public function test_backwards_compatibility_sync_options()
{
require_once JETPACK__PLUGIN_DIR . '3rd-party/polldaddy.php';
$this->setExpectedDeprecated('Jetpack_Sync::sync_options');
Jetpack_Sync::sync_options(__FILE__, 'foo_option', 'bar_option');
}
示例5: resolve_identity_crisis
public static function resolve_identity_crisis($key = null)
{
if ($key) {
$identity_options = array($key);
} else {
$identity_options = self::identity_crisis_options_to_check();
}
if (is_array($identity_options)) {
foreach ($identity_options as $identity_option) {
Jetpack_Sync::sync_options(__FILE__, $identity_option);
/**
* Fires when a shadow site option is updated.
* These options are updated via the Identity Crisis UI.
* $identity_option is the option that gets updated.
*
* @since 3.7.0
*/
do_action("update_option_{$identity_option}");
}
}
}
示例6: add_action
<?php
/**
* Module Name: Post by Email
* Module Description: Publish posts to your blog directly from your personal email account.
* First Introduced: 2.0
* Sort Order: 4
* Requires Connection: Yes
* Auto Activate: Yes
* Module Tags: Writing
*/
add_action('jetpack_modules_loaded', array('Jetpack_Post_By_Email', 'init'));
Jetpack_Sync::sync_options(__FILE__, 'large_size_w', 'large_size_h', 'thumbnail_size_w', 'thumbnail_size_h', 'medium_size_w', 'medium_size_h');
add_action('jetpack_activate_module_post-by-email', array('Jetpack_Post_By_Email', 'module_toggle'));
add_action('jetpack_deactivate_module_post-by-email', array('Jetpack_Post_By_Email', 'module_toggle'));
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, array('Jetpack_Post_By_Email', 'configuration_redirect'));
class Jetpack_Post_By_Email
{
public static function init()
{
static $instance = NULL;
if (!$instance) {
$instance = new Jetpack_Post_By_Email();
}
return $instance;
}
function __construct()
{
add_action('init', array(&$this, 'action_init'));
}
示例7: add_action
<?php
/**
* Module Name: Subscriptions
* Module Description: Allow users to subscribe to your posts and comments and receive notifications via email.
* Sort Order: 9
* First Introduced: 1.2
* Requires Connection: Yes
* Auto Activate: Yes
* Module Tags: Social
*/
add_action('jetpack_modules_loaded', 'jetpack_subscriptions_load');
Jetpack_Sync::sync_options(__FILE__, 'home', 'blogname', 'siteurl', 'page_on_front', 'permalink_structure', 'category_base', 'rss_use_excerpt', 'subscription_options', 'stb_enabled', 'stc_enabled', 'tag_base');
Jetpack_Sync::sync_posts(__FILE__);
Jetpack_Sync::sync_comments(__FILE__);
function jetpack_subscriptions_load()
{
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'jetpack_subscriptions_configuration_load');
}
function jetpack_subscriptions_configuration_load()
{
wp_safe_redirect(admin_url('options-discussion.php#jetpack-subscriptions-settings'));
exit;
}
class Jetpack_Subscriptions
{
var $jetpack = false;
public static $hash;
/**
* Singleton
示例8: dirname
* First Introduced: 1.4
* Sort Order: 2
* Requires Connection: Yes
* Auto Activate: No
*/
require dirname( __FILE__ ) . '/comments/comments.php';
if ( is_admin() ) {
require dirname( __FILE__ ) . '/comments/admin.php';
}
Jetpack_Sync::sync_options( __FILE__,
'comment_registration',
'require_name_email',
'show_avatars',
'avatar_default',
'highlander_comment_form_prompt',
'jetpack_comment_form_color_scheme'
);
function jetpack_comments_load() {
Jetpack::enable_module_configurable( __FILE__ );
Jetpack::module_configuration_load( __FILE__, 'jetpack_comments_configuration_load' );
}
function jetpack_comments_configuration_load() {
wp_safe_redirect( admin_url( 'options-discussion.php#jetpack-comments-settings' ) );
exit;
}
add_action( 'jetpack_modules_loaded', 'jetpack_comments_load' );
示例9: resolve_identity_crisis
public static function resolve_identity_crisis($key = null)
{
if ($key) {
$identity_options = array($key);
} else {
$identity_options = self::identity_crisis_options_to_check();
}
if (is_array($identity_options)) {
foreach ($identity_options as $identity_option) {
Jetpack_Sync::sync_options(__FILE__, $identity_option);
// Fire off the sync manually
do_action("update_option_{$identity_option}");
}
}
}
示例10: define
* Module Name: WordPress.com Stats
* Module Description: Simple, concise site stats with no additional load on your server.
* Sort Order: 1
* First Introduced: 1.1
* Requires Connection: Yes
* Auto Activate: Yes
* Module Tags: WordPress.com Stats
*/
if (defined('STATS_VERSION')) {
return;
}
define('STATS_VERSION', '9');
defined('STATS_DASHBOARD_SERVER') or define('STATS_DASHBOARD_SERVER', 'dashboard.wordpress.com');
add_action('jetpack_modules_loaded', 'stats_load');
// Tell HQ about changed settings
Jetpack_Sync::sync_options(__FILE__, 'stats_options', 'home', 'siteurl', 'blogname', 'blogdescription', 'gmt_offset', 'timezone_string', 'page_on_front', 'permalink_structure', 'category_base', 'tag_base');
function stats_load()
{
global $wp_roles;
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'stats_configuration_load');
Jetpack::module_configuration_head(__FILE__, 'stats_configuration_head');
Jetpack::module_configuration_screen(__FILE__, 'stats_configuration_screen');
// Tell HQ about changed posts
$post_stati = get_post_stati(array('public' => true));
// All public post stati
$post_stati[] = 'private';
// Content from private stati will be redacted
Jetpack_Sync::sync_posts(__FILE__, array('post_types' => get_post_types(array('public' => true)), 'post_stati' => $post_stati));
// Generate the tracking code after wp() has queried for posts.
add_action('template_redirect', 'stats_template_redirect', 1);
示例11: sync_all_registered_options
}
}
function sync_all_registered_options($options = array())
{
if ('jetpack_sync_all_registered_options' == current_filter()) {
$all_registered_options = array_unique(call_user_func_array('array_merge', $this->sync_options));
foreach ($all_registered_options as $option) {
$this->added_option_action($option);
}
} else {
wp_schedule_single_event(time(), 'jetpack_sync_all_registered_options', array($this->sync_options));
}
}
}
require_once dirname(__FILE__) . '/class.jetpack-options.php';
require_once dirname(__FILE__) . '/class.jetpack-user-agent.php';
require_once dirname(__FILE__) . '/class.jetpack-post-images.php';
require_once dirname(__FILE__) . '/class.photon.php';
require dirname(__FILE__) . '/functions.photon.php';
require dirname(__FILE__) . '/functions.compat.php';
require dirname(__FILE__) . '/functions.gallery.php';
class Jetpack_Error extends WP_Error
{
}
register_activation_hook(__FILE__, array('Jetpack', 'plugin_activation'));
register_deactivation_hook(__FILE__, array('Jetpack', 'plugin_deactivation'));
add_action('init', array('Jetpack', 'init'));
add_action('plugins_loaded', array('Jetpack', 'load_modules'), 100);
add_filter('jetpack_static_url', array('Jetpack', 'staticize_subdomain'));
Jetpack_Sync::sync_options(__FILE__, 'widget_twitter');
示例12: add_action
<?php
/**
* Module Name: JSON API
* Module Description: Allow applications to securely access your content through the cloud.
* Sort Order: 19
* First Introduced: 1.9
* Requires Connection: Yes
* Auto Activate: Public
* Module Tags: Writing, Developers
*/
add_action('jetpack_activate_module_json-api', array(Jetpack::init(), 'toggle_module_on_wpcom'));
add_action('jetpack_deactivate_module_json-api', array(Jetpack::init(), 'toggle_module_on_wpcom'));
add_action('jetpack_modules_loaded', 'jetpack_json_api_load_module');
$theme_slug = get_option('stylesheet');
Jetpack_Sync::sync_options(__FILE__, 'stylesheet', "theme_mods_{$theme_slug}");
function jetpack_json_api_load_module()
{
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'jetpack_json_api_configuration_load');
Jetpack::module_configuration_screen(__FILE__, 'jetpack_json_api_configuration_screen');
}
function jetpack_json_api_configuration_load()
{
if (isset($_POST['action']) && $_POST['action'] == 'save_options' && wp_verify_nonce($_POST['_wpnonce'], 'json-api')) {
Jetpack_Options::update_option('json_api_full_management', isset($_POST['json_api_full_management']));
Jetpack::state('message', 'module_configured');
wp_safe_redirect(Jetpack::module_configuration_url('json-api'));
exit;
}
}
示例13: add_action
<?php
/**
* Module Name: JSON API
* Module Description: Allow applications to securely access your content through the cloud.
* Sort Order: 19
* First Introduced: 1.9
* Requires Connection: Yes
* Auto Activate: Public
* Module Tags: Writing, Developers
*/
add_action('jetpack_activate_module_json-api', array(Jetpack::init(), 'toggle_module_on_wpcom'));
add_action('jetpack_deactivate_module_json-api', array(Jetpack::init(), 'toggle_module_on_wpcom'));
add_action('jetpack_modules_loaded', 'jetpack_json_api_load_module');
$theme_slug = get_option('stylesheet');
Jetpack_Sync::sync_options(__FILE__, 'stylesheet', "theme_mods_{$theme_slug}", 'jetpack_json_api_full_management', 'jetpack_sync_non_public_post_stati');
if (Jetpack_Options::get_option('sync_non_public_post_stati')) {
$sync_options = array('post_types' => get_post_types(array('public' => true)), 'post_stati' => get_post_stati());
Jetpack_Sync::sync_posts(__FILE__, $sync_options);
}
function jetpack_json_api_load_module()
{
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'jetpack_json_api_configuration_load');
Jetpack::module_configuration_screen(__FILE__, 'jetpack_json_api_configuration_screen');
}
function jetpack_json_api_configuration_load()
{
if (isset($_POST['action']) && $_POST['action'] == 'save_options' && wp_verify_nonce($_POST['_wpnonce'], 'json-api')) {
Jetpack_Options::update_option('json_api_full_management', isset($_POST['json_api_full_management']));
Jetpack::state('message', 'module_configured');
示例14: dirname
<?php
/**
* Module Name: Site Icon
* Module Description: Add a site icon to your site.
* Sort Order: 22
* First Introduced: 3.2
* Requires Connection: No
* Auto Activate: No
* Module Tags: Other
* Additional Search Queries: favicon, icon, site icon
*/
include dirname(__FILE__) . '/site-icon/jetpack-site-icon.php';
include dirname(__FILE__) . '/site-icon/site-icon-functions.php';
Jetpack_Sync::sync_options(__FILE__, 'jetpack_site_icon_url');
示例15: sync_jetpack_options
/**
* Sync the VaultPress options to WordPress.com if the Jetpack plugin is active.
*/
function sync_jetpack_options()
{
if (class_exists('Jetpack_Sync') && method_exists('Jetpack_Sync', 'sync_options') && defined('JETPACK__VERSION') && version_compare(JETPACK__VERSION, '4.1', '<')) {
Jetpack_Sync::sync_options(__FILE__, $this->auto_register_option, $this->option_name);
}
}