<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[6776] sites/trunk/wordcamp.org/public_html/wp-content/plugins/email-post-changes-specific-post: Email Post Changes Specific Post: Apply coding standards.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/6776">6776</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/6776","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>iandunn</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-02-26 22:41:18 +0000 (Mon, 26 Feb 2018)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Email Post Changes Specific Post: Apply coding standards.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginsemailpostchangesspecificpostemailpostchangesspecificpostphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/email-post-changes-specific-post/email-post-changes-specific-post.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginsemailpostchangesspecificpostwidgetsubscribephp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/email-post-changes-specific-post/widget-subscribe.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginsemailpostchangesspecificpostemailpostchangesspecificpostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/email-post-changes-specific-post/email-post-changes-specific-post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/email-post-changes-specific-post/email-post-changes-specific-post.php 2018-02-26 22:32:30 UTC (rev 6775)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/email-post-changes-specific-post/email-post-changes-specific-post.php 2018-02-26 22:41:18 UTC (rev 6776)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,11 +4,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> Plugin Name: Email Post Changes - Subscribe to Specific Post
</span><span class="cx" style="display: block; padding: 0 10px"> Description: Extends the Email Post Changes plugin to allow visitors to subscribe to a specific post/page
</span><span class="cx" style="display: block; padding: 0 10px"> Version: 0.1
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Author: Ian Dunn
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Author: WordPress Meta Team
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> class EPCSpecificPost {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Constructor
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,7 +27,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Override EPC's default options
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $options
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,33 +35,34 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * EPC assumes you always want to e-mail the admin, and will always include the admin_email in the 'Additional Email Addresses' field,
</span><span class="cx" style="display: block; padding: 0 10px"> * even if you submit an empty value, so emptying the default value works around that.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $options['emails'] = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $options['post_types'] = array( 'page' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $options;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Inserts extra email addresses into the list of recipients
</span><span class="cx" style="display: block; padding: 0 10px"> * When EPC is crafting a new notification, this method adds all of the addresses we've collected to it
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
- * @param array $emails The list of addresses that EPC has collected
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @param array $emails The list of addresses that EPC has collected.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $old_post_id
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $new_post_id
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function insert_subscribed_emails( $emails, $old_post_id, $new_post_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $subscribed_emails = get_option( 'epcsp_subscribed_addresses', array() );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $subscribed_emails[ $old_post_id ] ) && is_array( $subscribed_emails[ $old_post_id ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $emails = array_merge( $emails, $subscribed_emails[ $old_post_id ] );
</span><span class="cx" style="display: block; padding: 0 10px"> $emails = array_unique( $emails );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $emails;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> require_once( __DIR__ . '/widget-subscribe.php' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$GLOBALS['EPCSpecificPost'] = new EPCSpecificPost();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+$GLOBALS['EPCSpecificPost'] = new EPCSpecificPost();
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginsemailpostchangesspecificpostwidgetsubscribephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/email-post-changes-specific-post/widget-subscribe.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/email-post-changes-specific-post/widget-subscribe.php 2018-02-26 22:32:30 UTC (rev 6775)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/email-post-changes-specific-post/widget-subscribe.php 2018-02-26 22:41:18 UTC (rev 6776)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,23 +1,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * A widget that allows visitors to subscribe to the current post/page
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * A widget that allows visitors to subscribe to the current post/page.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * A form is presented to the visitor to enter their email address, and then their address is mapped to the current post ID and saved in the database
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
- * @package EPCSpecificPost
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class EPCSP_SubscribeWidget extends WP_Widget {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Constructor
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function __construct() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function __construct() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $widget_options = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'classname' => 'epcsp_subscribe',
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'Allow visitors to subscribe to email notifications for a specific post or page', 'wordcamporg' ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $control_options = array( 'width' => 300 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::__construct( 'epcsp_subscribe', __( 'Subscribe to Specific Post', 'wordcamporg' ), $widget_options, $control_options );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_head', array( $this, 'output_css' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,15 +23,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Displays and processes the front-end form that visitors will enter their email address into in order to subscribe to the current post
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $args
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $instance
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function widget( $args, $instance ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function widget( $args, $instance ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $errors = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $message = '';
</span><span class="cx" style="display: block; padding: 0 10px"> $title = apply_filters( 'epcsp_subscribe_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_singular() || ! $this->is_supported_epc_post_type( get_post_type() ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,9 +47,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $message = __( 'You have been subscribed to this post.', 'wordcamporg' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> echo $args['before_widget'];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $title ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> echo $args['before_title'] . $title . $args['after_title'];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -60,38 +58,38 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $_POST['epcsp_subscribe_submit'] ) || $errors ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->render_subscription_form();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> echo $args['after_widget'];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Determines if the given post type is enabled in EPC's settings
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $post_type
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function is_supported_epc_post_type( $post_type ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected function is_supported_epc_post_type( $post_type ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $supported = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( class_exists( 'Email_Post_Changes' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $epc_options = Email_Post_Changes::init()->get_options();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $post_type, $epc_options['post_types'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $supported = true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $supported;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Renders the form the visitor inputs their email address into
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function render_subscription_form() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected function render_subscription_form() {
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <form id="epcsp_subscribe" name="epcsp_subscribe" action="" method="POST">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <label for="epcsp_subscribe_address"><?php _e( 'Email Address:', 'wordcamporg' ); ?></label>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <label for="epcsp_subscribe_address"><?php esc_html_e( 'Email Address:', 'wordcamporg' ); ?></label>
</ins><span class="cx" style="display: block; padding: 0 10px"> <input id="epcsp_subscribe_address" name="epcsp_subscribe_address" type="text" />
</span><span class="cx" style="display: block; padding: 0 10px"> <input name="epcsp_subscribe_submit" type="submit" value="Subscribe" />
</span><span class="cx" style="display: block; padding: 0 10px"> </form>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -102,101 +100,112 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Outputs the styles for the widget
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function output_css() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function output_css() {
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> <style type="text/css">
</span><span class="cx" style="display: block; padding: 0 10px"> #epcsp_subscribe label,
</span><span class="cx" style="display: block; padding: 0 10px"> #epcsp_subscribe input {
</span><span class="cx" style="display: block; padding: 0 10px"> display: block;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> #epcsp_subscribe_address {
</span><span class="cx" style="display: block; padding: 0 10px"> width: 100%;
</span><span class="cx" style="display: block; padding: 0 10px"> max-width: 300px;
</span><span class="cx" style="display: block; padding: 0 10px"> margin: 5px 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> </style>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Subscribes the visitor to the post
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $email
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $post_id
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function subscribe_visitor_to_post( $email, $post_id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected function subscribe_visitor_to_post( $email, $post_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $errors = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $post_id = absint( $post_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_email( $email ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $subscribed_addresses = get_option( 'epcsp_subscribed_addresses', array() );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $subscribed_addresses[ $post_id ] ) && in_array( $email, $subscribed_addresses[ $post_id ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $errors[] = __( 'You are already subscribed to this post.', 'wordcamporg' );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $subscribed_addresses[ $post_id ][] = sanitize_email( $email );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $subscribed_addresses[ $post_id ] = array_unique( $subscribed_addresses[ $post_id ] );
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $subscribed_addresses[ $post_id ] = array_unique( $subscribed_addresses[ $post_id ] );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> update_option( 'epcsp_subscribed_addresses', $subscribed_addresses );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $errors[] = __( 'The email address you entered was not valid.', 'wordcamporg' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $errors;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Processes the back-end form on the Widgets page
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $new_instance
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $old_instance
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function update( $new_instance, $old_instance ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function update( $new_instance, $old_instance ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $instance = $old_instance;
</span><span class="cx" style="display: block; padding: 0 10px"> $instance['title'] = strip_tags( $new_instance['title'] );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $instance;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Generates the back-end form for the Widgets page
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $instance
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function form( $instance ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function form( $instance ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $title = strip_tags( $instance['title'] );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php if ( ! $this->is_epc_enabled() ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="error inline">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <strong>Warning:</strong> The 'Enable' setting on <a href="<?php echo admin_url( 'options-general.php?page=email_post_changes' ); ?>">the Email Post Changes settings page</a> is disabled. No emails will be sent until it is enabled.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <strong>Warning:</strong>
+ The 'Enable' setting on <a href="<?php echo esc_url( admin_url( 'options-general.php?page=email_post_changes' ) ); ?>">the Email Post Changes settings page</a> is disabled.
+ No emails will be sent until it is enabled.
</ins><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> <p>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
+ <?php esc_html_e( 'Title:' ); ?>
+ </label>
+
+ <input
+ class="widefat"
+ id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
+ name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
+ type="text"
+ value="<?php echo esc_attr( $title ); ?>"
+ />
</ins><span class="cx" style="display: block; padding: 0 10px"> </p>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Determines if the Email Post Changes plugin has the 'Enabled' setting turned on or not
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function is_epc_enabled() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected function is_epc_enabled() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $enabled = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( class_exists( 'Email_Post_Changes' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $epc_options = Email_Post_Changes::init()->get_options();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -204,7 +213,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $enabled = true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $enabled;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}
</ins></span></pre>
</div>
</div>
</body>
</html>