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')); }
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'))); }
<?php /** * Module Name: Mobile Push Notifications * Module Description: Receive notifications on your mobile device. * Sort Order: 100 * First Introduced: 1.9 * Requires Connection: Yes */ Jetpack_Sync::sync_comments(__FILE__, array('comment_stati' => array('approved', 'unapproved')));
<?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