当前位置: 首页>>代码示例>>PHP>>正文


PHP Jetpack_Sync::sync_posts方法代码示例

本文整理汇总了PHP中Jetpack_Sync::sync_posts方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack_Sync::sync_posts方法的具体用法?PHP Jetpack_Sync::sync_posts怎么用?PHP Jetpack_Sync::sync_posts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Jetpack_Sync的用法示例。


在下文中一共展示了Jetpack_Sync::sync_posts方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct()
 {
     global $publicize_ui;
     $this->in_jetpack = class_exists('Jetpack') && method_exists('Jetpack', 'enable_module_configurable') ? true : false;
     if ($this->in_jetpack && method_exists('Jetpack', 'module_configuration_load')) {
         Jetpack::enable_module_configurable(__FILE__);
         Jetpack::module_configuration_load(__FILE__, array($this, 'jetpack_configuration_load'));
         Jetpack_Sync::sync_posts(__FILE__);
     }
     require_once dirname(__FILE__) . '/publicize/publicize.php';
     if ($this->in_jetpack) {
         require_once dirname(__FILE__) . '/publicize/publicize-jetpack.php';
     } else {
         require_once dirname(dirname(__FILE__)) . '/mu-plugins/keyring/keyring.php';
         require_once dirname(__FILE__) . '/publicize/publicize-wpcom.php';
     }
     require_once dirname(__FILE__) . '/publicize/ui.php';
     $publicize_ui = new Publicize_UI();
     $publicize_ui->in_jetpack = $this->in_jetpack;
     // Jetpack specific checks / hooks
     if ($this->in_jetpack) {
         add_action('jetpack_activate_module_publicize', array($this, 'module_state_toggle'));
         add_action('jetpack_deactivate_module_publicize', array($this, 'module_state_toggle'));
         // if sharedaddy isn't active, the sharing menu hasn't been added yet
         $active = Jetpack::get_active_modules();
         if (in_array('publicize', $active) && !in_array('sharedaddy', $active)) {
             add_action('admin_menu', array(&$publicize_ui, 'sharing_menu'));
         }
     }
 }
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:30,代码来源:publicize.php

示例2: stats_load

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);
    add_action('wp_head', 'stats_admin_bar_head', 100);
    add_action('wp_head', 'stats_hide_smile_css');
    add_action('jetpack_admin_menu', 'stats_admin_menu');
    // Map stats caps
    add_filter('map_meta_cap', 'stats_map_meta_caps', 10, 4);
    if (isset($_GET['oldwidget'])) {
        // Old one.
        add_action('wp_dashboard_setup', 'stats_register_dashboard_widget');
    } else {
        add_action('admin_init', 'stats_merged_widget_admin_init');
    }
    add_filter('jetpack_xmlrpc_methods', 'stats_xmlrpc_methods');
    add_filter('pre_option_db_version', 'stats_ignore_db_version');
}
开发者ID:jordankoschei,项目名称:jordankoschei-dot-com,代码行数:29,代码来源:stats.php

示例3: action_init

 function action_init()
 {
     //syncing must wait until after init so
     //post types that support comments
     $filt_post_types = array();
     $all_post_types = get_post_types();
     foreach ($all_post_types as $post_type) {
         if (post_type_supports($post_type, 'comments')) {
             $filt_post_types[] = $post_type;
         }
     }
     Jetpack_Sync::sync_posts(__FILE__, array('post_types' => $filt_post_types, 'post_stati' => array('publish')));
     Jetpack_Sync::sync_comments(__FILE__, array('post_types' => $filt_post_types, 'post_stati' => array('publish'), 'comment_stati' => array('approve', 'approved', '1', 'hold', 'unapproved', 'unapprove', '0', 'spam', 'trash')));
     if (defined('DOING_AJAX') && DOING_AJAX) {
         return;
     }
     if (!has_filter('show_admin_bar', '__return_true') && !is_user_logged_in()) {
         return;
     }
     if (!self::current_browser_is_supported()) {
         return;
     }
     add_action('admin_bar_menu', array(&$this, 'admin_bar_menu'), 120);
     add_action('wp_head', array(&$this, 'styles_and_scripts'), 120);
     add_action('admin_head', array(&$this, 'styles_and_scripts'));
 }
开发者ID:lcw07r,项目名称:productcampamsterdam.org,代码行数:26,代码来源:notes.php

示例4: sync_posts_init

 function sync_posts_init()
 {
     $post_types = array('post', 'page');
     $all_post_types = get_post_types();
     foreach ($all_post_types as $post_type) {
         // sync Custom Post Types that support publicize
         if (post_type_supports($post_type, 'publicize')) {
             $post_types[] = $post_type;
         }
     }
     Jetpack_Sync::sync_posts(__FILE__, array('post_types' => $post_types));
 }
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:12,代码来源:publicize.php

示例5: action_on_load

 /**
  * This action triggers if the module is in an active state, load related posts and options.
  *
  * @uses Jetpack_RelatedPosts::init, is_admin, Jetpack::enable_module_configurable, Jetpack::module_configuration_load, Jetpack_Sync::sync_posts
  * @return null
  */
 public function action_on_load()
 {
     require_once 'related-posts/jetpack-related-posts.php';
     Jetpack_RelatedPosts::init();
     if (is_admin()) {
         // Enable "Configure" button on module card
         Jetpack::enable_module_configurable(__FILE__);
         Jetpack::module_configuration_load(__FILE__, array($this, 'module_configuration_load'));
         // Sync new posts
         Jetpack_Sync::sync_posts(__FILE__);
     }
 }
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:18,代码来源:related-posts.php

示例6: Jetpack_Notifications

 function Jetpack_Notifications()
 {
     $this->jetpack = Jetpack::init();
     add_action('init', array(&$this, 'action_init'));
     //post types that support comments
     $filt_post_types = array();
     foreach (get_post_types() as $post_type) {
         if (post_type_supports($post_type, 'comments')) {
             $filt_post_types[] = $post_type;
         }
     }
     Jetpack_Sync::sync_posts(__FILE__, array('post_types' => $filt_post_types, 'post_stati' => array('publish')));
     Jetpack_Sync::sync_comments(__FILE__, array('post_types' => $filt_post_types, 'post_stati' => array('publish'), 'comment_stati' => array('approve', 'approved', '1', 'hold', 'unapproved', 'unapprove', '0', 'spam', 'trash')));
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:14,代码来源:notes.php

示例7: admin_init

 function admin_init()
 {
     add_filter('manage_posts_columns', array($this, 'add_like_count_column'));
     add_filter('manage_pages_columns', array($this, 'add_like_count_column'));
     add_action('manage_posts_custom_column', array($this, 'likes_edit_column'), 10, 2);
     add_action('manage_pages_custom_column', array($this, 'likes_edit_column'), 10, 2);
     add_action('admin_print_styles-edit.php', array($this, 'load_admin_css'));
     add_action("admin_print_scripts-edit.php", array($this, 'enqueue_admin_scripts'));
     if ($this->in_jetpack) {
         $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));
     }
 }
开发者ID:CoderDojoTo,项目名称:CDWP-theme,代码行数:16,代码来源:likes.php

示例8: 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
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:31,代码来源:subscriptions.php

示例9: add_action

 * Requires Connection: Yes
 * Auto Activate: No
 * Module Tags: Centralized Management, Recommended
 * Feature: Recommended, Jumpstart
 */
add_action('jetpack_activate_module_manage', array(Jetpack::init(), 'toggle_module_on_wpcom'));
add_action('jetpack_deactivate_module_manage', array(Jetpack::init(), 'toggle_module_on_wpcom'));
add_action('customize_register', 'add_wpcom_to_allowed_redirect_hosts');
// Add wordpress.com to the safe redirect whitelist if the Manage module is enabled
// so the customizer can `return` to wordpress.com if invoked from there.
function add_wpcom_to_allowed_redirect_hosts($domains)
{
    if (Jetpack::is_module_active('manage')) {
        add_filter('allowed_redirect_hosts', 'allow_wpcom_domain');
    }
}
// Return $domains, with 'wordpress.com' appended.
function allow_wpcom_domain($domains)
{
    if (empty($domains)) {
        $domains = array();
    }
    $domains[] = 'wordpress.com';
    return array_unique($domains);
}
// Re add sync for non public posts when the optin is selected in Calypso.
// This will only work if you have manage enabled as well.
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);
}
开发者ID:annbransom,项目名称:techishowl_prod_backup,代码行数:31,代码来源:manage.php

示例10: admin_init

 function admin_init()
 {
     add_filter('manage_posts_columns', array($this, 'add_like_count_column'));
     add_filter('manage_pages_columns', array($this, 'add_like_count_column'));
     add_action('manage_posts_custom_column', array($this, 'likes_edit_column'), 10, 2);
     add_action('manage_pages_custom_column', array($this, 'likes_edit_column'), 10, 2);
     add_action('admin_print_styles-edit.php', array($this, 'load_admin_css'));
     add_action("admin_print_scripts-edit.php", array($this, 'enqueue_admin_scripts'));
     if ($this->in_jetpack) {
         Jetpack_Sync::sync_posts(__FILE__);
     }
 }
开发者ID:dtekcth,项目名称:datateknologer.se,代码行数:12,代码来源:likes.php


注:本文中的Jetpack_Sync::sync_posts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。