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