Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules
File: subscriptions.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName)
[0] Fix | Delete
/**
[1] Fix | Delete
* Module Name: Newsletter
[2] Fix | Delete
* Module Description: Grow your subscriber list and deliver your content directly to their email inbox.
[3] Fix | Delete
* Sort Order: 9
[4] Fix | Delete
* Recommendation Order: 8
[5] Fix | Delete
* First Introduced: 1.2
[6] Fix | Delete
* Requires Connection: Yes
[7] Fix | Delete
* Requires User Connection: Yes
[8] Fix | Delete
* Auto Activate: No
[9] Fix | Delete
* Module Tags: Social
[10] Fix | Delete
* Feature: Engagement
[11] Fix | Delete
* Additional Search Queries: subscriptions, subscription, email, follow, followers, subscribers, signup, newsletter, creator
[12] Fix | Delete
*/
[13] Fix | Delete
[14] Fix | Delete
// phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files.
[15] Fix | Delete
[16] Fix | Delete
use Automattic\Jetpack\Admin_UI\Admin_Menu;
[17] Fix | Delete
use Automattic\Jetpack\Connection\Manager as Connection_Manager;
[18] Fix | Delete
use Automattic\Jetpack\Connection\XMLRPC_Async_Call;
[19] Fix | Delete
use Automattic\Jetpack\Newsletter\Settings as Newsletter_Settings;
[20] Fix | Delete
use Automattic\Jetpack\Redirect;
[21] Fix | Delete
use Automattic\Jetpack\Status;
[22] Fix | Delete
use Automattic\Jetpack\Status\Host;
[23] Fix | Delete
use Automattic\Jetpack\Subscribers_Dashboard\Dashboard as Subscribers_Dashboard;
[24] Fix | Delete
[25] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[26] Fix | Delete
exit( 0 );
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
add_action( 'jetpack_modules_loaded', 'jetpack_subscriptions_load' );
[30] Fix | Delete
[31] Fix | Delete
// Loads the User Content Link Redirection feature.
[32] Fix | Delete
require_once __DIR__ . '/subscriptions/jetpack-user-content-link-redirection.php';
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* Loads the Subscriptions module.
[36] Fix | Delete
*/
[37] Fix | Delete
function jetpack_subscriptions_load() {
[38] Fix | Delete
Jetpack::enable_module_configurable( __FILE__ );
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
/**
[42] Fix | Delete
* Cherry picks keys from `$_SERVER` array.
[43] Fix | Delete
*
[44] Fix | Delete
* @since 6.0.0
[45] Fix | Delete
*
[46] Fix | Delete
* @return array An array of server data.
[47] Fix | Delete
*/
[48] Fix | Delete
function jetpack_subscriptions_cherry_pick_server_data() {
[49] Fix | Delete
$data = array();
[50] Fix | Delete
[51] Fix | Delete
foreach ( $_SERVER as $key => $value ) {
[52] Fix | Delete
if ( ! is_string( $value ) || str_starts_with( $key, 'HTTP_COOKIE' ) ) {
[53] Fix | Delete
continue;
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
if ( str_starts_with( $key, 'HTTP_' ) || in_array( $key, array( 'REMOTE_ADDR', 'REQUEST_URI', 'DOCUMENT_URI' ), true ) ) {
[57] Fix | Delete
$data[ $key ] = $value;
[58] Fix | Delete
}
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
return $data;
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
/**
[65] Fix | Delete
* Main class file for the Subscriptions module.
[66] Fix | Delete
*
[67] Fix | Delete
* @phan-constructor-used-for-side-effects
[68] Fix | Delete
*/
[69] Fix | Delete
class Jetpack_Subscriptions {
[70] Fix | Delete
/**
[71] Fix | Delete
* Whether Jetpack has been instantiated or not.
[72] Fix | Delete
*
[73] Fix | Delete
* @var bool
[74] Fix | Delete
*/
[75] Fix | Delete
public $jetpack = false;
[76] Fix | Delete
[77] Fix | Delete
/**
[78] Fix | Delete
* Hash of the siteurl option.
[79] Fix | Delete
*
[80] Fix | Delete
* @var string
[81] Fix | Delete
*/
[82] Fix | Delete
public static $hash;
[83] Fix | Delete
[84] Fix | Delete
/**
[85] Fix | Delete
* Singleton
[86] Fix | Delete
*
[87] Fix | Delete
* @static
[88] Fix | Delete
*/
[89] Fix | Delete
public static function init() {
[90] Fix | Delete
static $instance = false;
[91] Fix | Delete
[92] Fix | Delete
if ( ! $instance ) {
[93] Fix | Delete
$instance = new Jetpack_Subscriptions();
[94] Fix | Delete
}
[95] Fix | Delete
[96] Fix | Delete
return $instance;
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
/**
[100] Fix | Delete
* Jetpack_Subscriptions constructor.
[101] Fix | Delete
*/
[102] Fix | Delete
public function __construct() {
[103] Fix | Delete
$this->jetpack = Jetpack::init();
[104] Fix | Delete
[105] Fix | Delete
// Don't use COOKIEHASH as it could be shared across installs && is non-unique in multisite.
[106] Fix | Delete
// @see: https://twitter.com/nacin/status/378246957451333632 .
[107] Fix | Delete
self::$hash = md5( get_option( 'siteurl' ) );
[108] Fix | Delete
[109] Fix | Delete
add_filter( 'jetpack_xmlrpc_methods', array( $this, 'xmlrpc_methods' ) );
[110] Fix | Delete
[111] Fix | Delete
// @todo remove sync from subscriptions and move elsewhere...
[112] Fix | Delete
[113] Fix | Delete
// Add Configuration Page.
[114] Fix | Delete
add_action( 'admin_init', array( $this, 'configure' ) );
[115] Fix | Delete
[116] Fix | Delete
// Catch subscription widget submits.
[117] Fix | Delete
if ( isset( $_REQUEST['jetpack_subscriptions_widget'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce checked in widget_submit() for logged in users.
[118] Fix | Delete
add_action( 'template_redirect', array( $this, 'widget_submit' ) );
[119] Fix | Delete
}
[120] Fix | Delete
[121] Fix | Delete
// Set up the comment subscription checkboxes.
[122] Fix | Delete
add_filter( 'comment_form_submit_field', array( $this, 'comment_subscribe_init' ), 10, 2 );
[123] Fix | Delete
[124] Fix | Delete
// Catch comment posts and check for subscriptions.
[125] Fix | Delete
add_action( 'comment_post', array( $this, 'comment_subscribe_submit' ), 50, 2 );
[126] Fix | Delete
[127] Fix | Delete
// Adds post meta checkbox in the post submit metabox.
[128] Fix | Delete
add_action( 'post_submitbox_misc_actions', array( $this, 'subscription_post_page_metabox' ) );
[129] Fix | Delete
[130] Fix | Delete
add_action( 'transition_post_status', array( $this, 'maybe_send_subscription_email' ), 10, 3 );
[131] Fix | Delete
[132] Fix | Delete
add_filter( 'jetpack_published_post_flags', array( $this, 'set_post_flags' ), 10, 2 );
[133] Fix | Delete
[134] Fix | Delete
add_filter( 'post_updated_messages', array( $this, 'update_published_message' ), 18, 1 );
[135] Fix | Delete
[136] Fix | Delete
// Set "social_notifications_subscribe" option during the first-time activation.
[137] Fix | Delete
add_action( 'jetpack_activate_module_subscriptions', array( $this, 'set_social_notifications_subscribe' ) );
[138] Fix | Delete
add_action( 'jetpack_activate_module_subscriptions', array( $this, 'set_featured_image_in_email_default' ) );
[139] Fix | Delete
[140] Fix | Delete
// Hide subscription messaging in Publish panel for posts that were published in the past
[141] Fix | Delete
add_action( 'init', array( $this, 'register_post_meta' ), 20 );
[142] Fix | Delete
add_action( 'transition_post_status', array( $this, 'maybe_set_first_published_status' ), 10, 3 );
[143] Fix | Delete
[144] Fix | Delete
// Add Subscribers menu to Jetpack navigation.
[145] Fix | Delete
add_action( 'jetpack_admin_menu', array( $this, 'add_subscribers_menu' ) );
[146] Fix | Delete
[147] Fix | Delete
// Customize the configuration URL to lead to the Subscriptions settings.
[148] Fix | Delete
add_filter(
[149] Fix | Delete
'jetpack_module_configuration_url_subscriptions',
[150] Fix | Delete
function () {
[151] Fix | Delete
return Jetpack::admin_url( array( 'page' => 'jetpack#/newsletter' ) );
[152] Fix | Delete
}
[153] Fix | Delete
);
[154] Fix | Delete
[155] Fix | Delete
// Track categories created through the category editor page
[156] Fix | Delete
add_action( 'wp_ajax_add-tag', array( $this, 'track_newsletter_category_creation' ), 1 );
[157] Fix | Delete
$subscribers_dashboard = new Subscribers_Dashboard();
[158] Fix | Delete
$subscribers_dashboard::init();
[159] Fix | Delete
[160] Fix | Delete
$newsletter_settings = new Newsletter_Settings();
[161] Fix | Delete
$newsletter_settings::init();
[162] Fix | Delete
}
[163] Fix | Delete
[164] Fix | Delete
/**
[165] Fix | Delete
* Jetpack_Subscriptions::xmlrpc_methods()
[166] Fix | Delete
*
[167] Fix | Delete
* Register subscriptions methods with the Jetpack XML-RPC server.
[168] Fix | Delete
*
[169] Fix | Delete
* @param array $methods Methods being registered.
[170] Fix | Delete
*/
[171] Fix | Delete
public function xmlrpc_methods( $methods ) {
[172] Fix | Delete
return array_merge(
[173] Fix | Delete
$methods,
[174] Fix | Delete
array(
[175] Fix | Delete
'jetpack.subscriptions.subscribe' => array( $this, 'subscribe' ),
[176] Fix | Delete
)
[177] Fix | Delete
);
[178] Fix | Delete
}
[179] Fix | Delete
[180] Fix | Delete
/**
[181] Fix | Delete
* Disable Subscribe on Single Post
[182] Fix | Delete
* Register post meta
[183] Fix | Delete
*/
[184] Fix | Delete
public function subscription_post_page_metabox() {
[185] Fix | Delete
if (
[186] Fix | Delete
/**
[187] Fix | Delete
* Filter whether or not to show the per-post subscription option.
[188] Fix | Delete
*
[189] Fix | Delete
* @module subscriptions
[190] Fix | Delete
*
[191] Fix | Delete
* @since 3.7.0
[192] Fix | Delete
*
[193] Fix | Delete
* @param bool true = show checkbox option on all new posts | false = hide the option.
[194] Fix | Delete
*/
[195] Fix | Delete
! apply_filters( 'jetpack_allow_per_post_subscriptions', false ) ) {
[196] Fix | Delete
return;
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
if ( has_filter( 'jetpack_subscriptions_exclude_these_categories' ) || has_filter( 'jetpack_subscriptions_include_only_these_categories' ) ) {
[200] Fix | Delete
return;
[201] Fix | Delete
}
[202] Fix | Delete
[203] Fix | Delete
global $post;
[204] Fix | Delete
$disable_subscribe_value = get_post_meta( $post->ID, '_jetpack_dont_email_post_to_subs', true );
[205] Fix | Delete
// only show checkbox if post hasn't been published and is a 'post' post type.
[206] Fix | Delete
if ( get_post_status( $post->ID ) !== 'publish' && get_post_type( $post->ID ) === 'post' ) :
[207] Fix | Delete
// Nonce it.
[208] Fix | Delete
wp_nonce_field( 'disable_subscribe', 'disable_subscribe_nonce' );
[209] Fix | Delete
?>
[210] Fix | Delete
<div class="misc-pub-section">
[211] Fix | Delete
<label for="_jetpack_dont_email_post_to_subs"><?php esc_html_e( 'Jetpack Subscriptions:', 'jetpack' ); ?></label><br>
[212] Fix | Delete
<input type="checkbox" name="_jetpack_dont_email_post_to_subs" id="jetpack-per-post-subscribe" value="1" <?php checked( $disable_subscribe_value, 1, true ); ?> />
[213] Fix | Delete
<?php esc_html_e( 'Don&#8217;t send this to subscribers', 'jetpack' ); ?>
[214] Fix | Delete
</div>
[215] Fix | Delete
<?php
[216] Fix | Delete
endif;
[217] Fix | Delete
}
[218] Fix | Delete
[219] Fix | Delete
/**
[220] Fix | Delete
* Checks whether or not the post should be emailed to subscribers
[221] Fix | Delete
*
[222] Fix | Delete
* It checks for the following things in order:
[223] Fix | Delete
* - Usage of filter jetpack_subscriptions_exclude_these_categories
[224] Fix | Delete
* - Usage of filter jetpack_subscriptions_include_only_these_categories
[225] Fix | Delete
* - Existence of the per-post checkbox option
[226] Fix | Delete
*
[227] Fix | Delete
* Only one of these can be used at any given time.
[228] Fix | Delete
*
[229] Fix | Delete
* @param string $new_status Tthe "new" post status of the transition when saved.
[230] Fix | Delete
* @param string $old_status The "old" post status of the transition when saved.
[231] Fix | Delete
* @param object $post obj The post object.
[232] Fix | Delete
*/
[233] Fix | Delete
public function maybe_send_subscription_email( $new_status, $old_status, $post ) {
[234] Fix | Delete
[235] Fix | Delete
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
[236] Fix | Delete
return;
[237] Fix | Delete
}
[238] Fix | Delete
[239] Fix | Delete
// Make sure that the checkbox is preseved.
[240] Fix | Delete
if ( ! empty( $_POST['disable_subscribe_nonce'] ) && wp_verify_nonce( $_POST['disable_subscribe_nonce'], 'disable_subscribe' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput -- WP Core doesn't unslash or sanitize nonces either.
[241] Fix | Delete
$set_checkbox = isset( $_POST['_jetpack_dont_email_post_to_subs'] ) ? 1 : 0;
[242] Fix | Delete
update_post_meta( $post->ID, '_jetpack_dont_email_post_to_subs', $set_checkbox );
[243] Fix | Delete
}
[244] Fix | Delete
}
[245] Fix | Delete
[246] Fix | Delete
/**
[247] Fix | Delete
* Message used when publishing a post.
[248] Fix | Delete
*
[249] Fix | Delete
* @param array $messages Message array for a post.
[250] Fix | Delete
*/
[251] Fix | Delete
public function update_published_message( $messages ) {
[252] Fix | Delete
global $post;
[253] Fix | Delete
if ( ! $this->should_email_post_to_subscribers( $post ) ) {
[254] Fix | Delete
return $messages;
[255] Fix | Delete
}
[256] Fix | Delete
[257] Fix | Delete
$view_post_link_html = sprintf(
[258] Fix | Delete
' <a href="%1$s">%2$s</a>',
[259] Fix | Delete
esc_url( get_permalink( $post ) ),
[260] Fix | Delete
__( 'View post', 'jetpack' )
[261] Fix | Delete
);
[262] Fix | Delete
[263] Fix | Delete
$messages['post'][6] = sprintf(
[264] Fix | Delete
/* translators: Message shown after a post is published */
[265] Fix | Delete
esc_html__( 'Post published and sending emails to subscribers.', 'jetpack' )
[266] Fix | Delete
) . $view_post_link_html;
[267] Fix | Delete
return $messages;
[268] Fix | Delete
}
[269] Fix | Delete
[270] Fix | Delete
/**
[271] Fix | Delete
* Determine if a post should notifiy subscribers via email.
[272] Fix | Delete
*
[273] Fix | Delete
* @param object $post The post.
[274] Fix | Delete
*/
[275] Fix | Delete
public function should_email_post_to_subscribers( $post ) {
[276] Fix | Delete
$should_email = true;
[277] Fix | Delete
if ( get_post_meta( $post->ID, '_jetpack_dont_email_post_to_subs', true ) ) {
[278] Fix | Delete
return false;
[279] Fix | Delete
}
[280] Fix | Delete
[281] Fix | Delete
// Only posts are currently supported.
[282] Fix | Delete
if ( 'post' !== $post->post_type ) {
[283] Fix | Delete
return false;
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
// Private posts are not sent to subscribers.
[287] Fix | Delete
if ( 'private' === $post->post_status ) {
[288] Fix | Delete
return false;
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
/**
[292] Fix | Delete
* Array of categories that will never trigger subscription emails.
[293] Fix | Delete
*
[294] Fix | Delete
* Will not send subscription emails from any post from within these categories.
[295] Fix | Delete
*
[296] Fix | Delete
* @module subscriptions
[297] Fix | Delete
*
[298] Fix | Delete
* @since 3.7.0
[299] Fix | Delete
*
[300] Fix | Delete
* @param array $args Array of category slugs or ID's.
[301] Fix | Delete
*/
[302] Fix | Delete
$excluded_categories = apply_filters( 'jetpack_subscriptions_exclude_these_categories', array() );
[303] Fix | Delete
[304] Fix | Delete
// Never email posts from these categories.
[305] Fix | Delete
if ( ! empty( $excluded_categories ) && in_category( $excluded_categories, $post->ID ) ) {
[306] Fix | Delete
$should_email = false;
[307] Fix | Delete
}
[308] Fix | Delete
[309] Fix | Delete
/**
[310] Fix | Delete
* ONLY send subscription emails for these categories
[311] Fix | Delete
*
[312] Fix | Delete
* Will ONLY send subscription emails to these categories.
[313] Fix | Delete
*
[314] Fix | Delete
* @module subscriptions
[315] Fix | Delete
*
[316] Fix | Delete
* @since 3.7.0
[317] Fix | Delete
*
[318] Fix | Delete
* @param array $args Array of category slugs or ID's.
[319] Fix | Delete
*/
[320] Fix | Delete
$only_these_categories = apply_filters( 'jetpack_subscriptions_exclude_all_categories_except', array() );
[321] Fix | Delete
[322] Fix | Delete
// Only emails posts from these categories.
[323] Fix | Delete
if ( ! empty( $only_these_categories ) && ! in_category( $only_these_categories, $post->ID ) ) {
[324] Fix | Delete
$should_email = false;
[325] Fix | Delete
}
[326] Fix | Delete
[327] Fix | Delete
return $should_email;
[328] Fix | Delete
}
[329] Fix | Delete
[330] Fix | Delete
/**
[331] Fix | Delete
* Retrieve which flags should be added to a particular post.
[332] Fix | Delete
*
[333] Fix | Delete
* @param array $flags Flags to be added.
[334] Fix | Delete
* @param object $post A post object.
[335] Fix | Delete
*/
[336] Fix | Delete
public function set_post_flags( $flags, $post ) {
[337] Fix | Delete
$flags['send_subscription'] = $this->should_email_post_to_subscribers( $post );
[338] Fix | Delete
return $flags;
[339] Fix | Delete
}
[340] Fix | Delete
[341] Fix | Delete
/**
[342] Fix | Delete
* Jetpack_Subscriptions::configure()
[343] Fix | Delete
*
[344] Fix | Delete
* Jetpack Subscriptions configuration screen.
[345] Fix | Delete
*/
[346] Fix | Delete
public function configure() {
[347] Fix | Delete
// Create the section.
[348] Fix | Delete
add_settings_section(
[349] Fix | Delete
'jetpack_subscriptions',
[350] Fix | Delete
__( 'Jetpack Subscriptions Settings', 'jetpack' ),
[351] Fix | Delete
array( $this, 'subscriptions_settings_section' ),
[352] Fix | Delete
'discussion'
[353] Fix | Delete
);
[354] Fix | Delete
[355] Fix | Delete
/** Subscribe to Posts */
[356] Fix | Delete
[357] Fix | Delete
add_settings_field(
[358] Fix | Delete
'jetpack_subscriptions_post_subscribe',
[359] Fix | Delete
__( 'Follow Blog', 'jetpack' ),
[360] Fix | Delete
array( $this, 'subscription_post_subscribe_setting' ),
[361] Fix | Delete
'discussion',
[362] Fix | Delete
'jetpack_subscriptions'
[363] Fix | Delete
);
[364] Fix | Delete
[365] Fix | Delete
register_setting(
[366] Fix | Delete
'discussion',
[367] Fix | Delete
'stb_enabled'
[368] Fix | Delete
);
[369] Fix | Delete
[370] Fix | Delete
/** Subscribe to Comments */
[371] Fix | Delete
[372] Fix | Delete
add_settings_field(
[373] Fix | Delete
'jetpack_subscriptions_comment_subscribe',
[374] Fix | Delete
__( 'Follow Comments', 'jetpack' ),
[375] Fix | Delete
array( $this, 'subscription_comment_subscribe_setting' ),
[376] Fix | Delete
'discussion',
[377] Fix | Delete
'jetpack_subscriptions'
[378] Fix | Delete
);
[379] Fix | Delete
[380] Fix | Delete
register_setting(
[381] Fix | Delete
'discussion',
[382] Fix | Delete
'stc_enabled'
[383] Fix | Delete
);
[384] Fix | Delete
[385] Fix | Delete
/** Email me whenever: Someone subscribes to my blog */
[386] Fix | Delete
/* @since 8.1 */
[387] Fix | Delete
[388] Fix | Delete
add_settings_section(
[389] Fix | Delete
'notifications_section',
[390] Fix | Delete
__( 'Someone subscribes to my blog', 'jetpack' ),
[391] Fix | Delete
array( $this, 'social_notifications_subscribe_section' ),
[392] Fix | Delete
'discussion'
[393] Fix | Delete
);
[394] Fix | Delete
[395] Fix | Delete
add_settings_field(
[396] Fix | Delete
'jetpack_subscriptions_social_notifications_subscribe',
[397] Fix | Delete
__( 'Email me whenever', 'jetpack' ),
[398] Fix | Delete
array( $this, 'social_notifications_subscribe_field' ),
[399] Fix | Delete
'discussion',
[400] Fix | Delete
'notifications_section'
[401] Fix | Delete
);
[402] Fix | Delete
[403] Fix | Delete
register_setting(
[404] Fix | Delete
'discussion',
[405] Fix | Delete
'social_notifications_subscribe',
[406] Fix | Delete
array( $this, 'social_notifications_subscribe_validate' )
[407] Fix | Delete
);
[408] Fix | Delete
}
[409] Fix | Delete
[410] Fix | Delete
/**
[411] Fix | Delete
* Discussions setting section blurb.
[412] Fix | Delete
*/
[413] Fix | Delete
public function subscriptions_settings_section() {
[414] Fix | Delete
?>
[415] Fix | Delete
<p id="jetpack-subscriptions-settings"><?php esc_html_e( 'Change whether your visitors can subscribe to your posts or comments or both.', 'jetpack' ); ?></p>
[416] Fix | Delete
[417] Fix | Delete
<?php
[418] Fix | Delete
}
[419] Fix | Delete
[420] Fix | Delete
/**
[421] Fix | Delete
* Post Subscriptions Toggle.
[422] Fix | Delete
*/
[423] Fix | Delete
public function subscription_post_subscribe_setting() {
[424] Fix | Delete
[425] Fix | Delete
$stb_enabled = get_option( 'stb_enabled', 1 );
[426] Fix | Delete
?>
[427] Fix | Delete
[428] Fix | Delete
<p class="description">
[429] Fix | Delete
<input type="checkbox" name="stb_enabled" id="jetpack-post-subscribe" value="1" <?php checked( $stb_enabled, 1 ); ?> />
[430] Fix | Delete
<?php
[431] Fix | Delete
echo wp_kses(
[432] Fix | Delete
__(
[433] Fix | Delete
"Show a <em>'follow blog'</em> option in the comment form",
[434] Fix | Delete
'jetpack'
[435] Fix | Delete
),
[436] Fix | Delete
array( 'em' => array() )
[437] Fix | Delete
);
[438] Fix | Delete
?>
[439] Fix | Delete
</p>
[440] Fix | Delete
<?php
[441] Fix | Delete
}
[442] Fix | Delete
[443] Fix | Delete
/**
[444] Fix | Delete
* Comments Subscriptions Toggle.
[445] Fix | Delete
*/
[446] Fix | Delete
public function subscription_comment_subscribe_setting() {
[447] Fix | Delete
[448] Fix | Delete
$stc_enabled = get_option( 'stc_enabled', 1 );
[449] Fix | Delete
?>
[450] Fix | Delete
[451] Fix | Delete
<p class="description">
[452] Fix | Delete
<input type="checkbox" name="stc_enabled" id="jetpack-comment-subscribe" value="1" <?php checked( $stc_enabled, 1 ); ?> />
[453] Fix | Delete
<?php
[454] Fix | Delete
echo wp_kses(
[455] Fix | Delete
__(
[456] Fix | Delete
"Show a <em>'follow comments'</em> option in the comment form",
[457] Fix | Delete
'jetpack'
[458] Fix | Delete
),
[459] Fix | Delete
array( 'em' => array() )
[460] Fix | Delete
);
[461] Fix | Delete
?>
[462] Fix | Delete
</p>
[463] Fix | Delete
[464] Fix | Delete
<?php
[465] Fix | Delete
}
[466] Fix | Delete
[467] Fix | Delete
/**
[468] Fix | Delete
* Someone subscribes to my blog section
[469] Fix | Delete
*
[470] Fix | Delete
* @since 8.1
[471] Fix | Delete
*/
[472] Fix | Delete
public function social_notifications_subscribe_section() {
[473] Fix | Delete
// Atypical usage here. We emit jquery to move subscribe notification checkbox to be with the rest of the email notification settings.
[474] Fix | Delete
?>
[475] Fix | Delete
<script type="text/javascript">
[476] Fix | Delete
jQuery( function( $ ) {
[477] Fix | Delete
var table = $( '#social_notifications_subscribe' ).parents( 'table:first' ),
[478] Fix | Delete
header = table.prevAll( 'h2:first' ),
[479] Fix | Delete
newParent = $( '#moderation_notify' ).parent( 'label' ).parent();
[480] Fix | Delete
[481] Fix | Delete
if ( ! table.length || ! header.length || ! newParent.length ) {
[482] Fix | Delete
return;
[483] Fix | Delete
}
[484] Fix | Delete
[485] Fix | Delete
newParent.append( '<br/>' ).append( table.end().parent( 'label' ).siblings().andSelf() );
[486] Fix | Delete
header.remove();
[487] Fix | Delete
table.remove();
[488] Fix | Delete
} );
[489] Fix | Delete
</script>
[490] Fix | Delete
<?php
[491] Fix | Delete
}
[492] Fix | Delete
[493] Fix | Delete
/**
[494] Fix | Delete
* Someone subscribes to my blog Toggle
[495] Fix | Delete
*
[496] Fix | Delete
* @since 8.1
[497] Fix | Delete
*/
[498] Fix | Delete
public function social_notifications_subscribe_field() {
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function