public function test_sync_jetpack_published_post_should_set_dont_send_to_subscribers_flag() { Jetpack_Options::update_option('active_modules', array('subscriptions')); require_once JETPACK__PLUGIN_DIR . '/modules/subscriptions.php'; Jetpack_Subscriptions::init(); wp_update_post(array('ID' => $this->post->ID, 'post_status' => 'draft')); update_post_meta($this->post->ID, '_jetpack_dont_email_post_to_subs', 1); wp_publish_post($this->post->ID); $this->sender->do_sync(); $post_flags = $this->server_event_storage->get_most_recent_event('jetpack_published_post')->args[1]; $this->assertEquals($post_flags['_jetpack_dont_email_post_to_subs'], 1); }
$cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000); $cookie_path = apply_filters('jetpack_comment_cookie_path', COOKIEPATH); $cookie_domain = apply_filters('jetpack_comment_cookie_domain', COOKIE_DOMAIN); if ($comments) { setcookie('jetpack_comments_subscribe_' . self::$hash, $post->ID, time() + $cookie_lifetime, $cookie_path, $cookie_domain); } else { setcookie('jetpack_comments_subscribe_' . self::$hash, '', time() - 3600, $cookie_path, $cookie_domain); } if ($posts) { setcookie('jetpack_blog_subscribe_' . self::$hash, 1, time() + $cookie_lifetime, $cookie_path, $cookie_domain); } else { setcookie('jetpack_blog_subscribe_' . self::$hash, '', time() - 3600, $cookie_path, $cookie_domain); } } } Jetpack_Subscriptions::init(); /*** * Blog Subscription Widget */ class Jetpack_Subscriptions_Widget extends WP_Widget { function Jetpack_Subscriptions_Widget() { $widget_ops = array('classname' => 'jetpack_subscription_widget', 'description' => __('Add an email signup form to allow people to subscribe to your blog.', 'jetpack')); $control_ops = array('width' => 300); $this->WP_Widget('blog_subscription', __('Blog Subscriptions (Jetpack)', 'jetpack'), $widget_ops, $control_ops); } function widget($args, $instance) { global $current_user; $source = 'widget';
static function setupBeforeClass() { Jetpack_Subscriptions::init(); }