<!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>[114] sites/trunk/wordcamp.org/public_html/wp-content/plugins: WordCamp Organizer Reminders: Initial commit.</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">
<dt>Revision</dt> <dd><a href="http://meta.trac.wordpress.org/changeset/114">114</a></dd>
<dt>Author</dt> <dd>iandunn</dd>
<dt>Date</dt> <dd>2013-11-05 00:52:03 +0000 (Tue, 05 Nov 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>WordCamp Organizer Reminders: Initial commit. Fixes <a href="http://meta.trac.wordpress.org/ticket/212">#212</a>.</pre>
<h3>Added Paths</h3>
<ul>
<li>sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/</li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamporganizerremindersbootstrapphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/bootstrap.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamporganizerreminderswcormailerphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamporganizerreminderswcorreminderphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-reminder.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamporganizerremindersbootstrapphp"></a>
<div class="addfile"><h4>Added: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/bootstrap.php (0 => 114)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/bootstrap.php (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/bootstrap.php 2013-11-05 00:52:03 UTC (rev 114)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+<?php
+
+/*
+ * Plugin Name: WordCamp Organizer Reminders
+ * Description: Automatically e-mail WordCamp organizers with various reminders at specified intervals.
+ * Version: 0.1
+ * Author: Ian Dunn
+ */
+
+require_once( __DIR__ . '/wcor-mailer.php' );
+$GLOBALS['WCOR_Mailer'] = new WCOR_Mailer();
+register_activation_hook( __FILE__, array( $GLOBALS['WCOR_Mailer'], 'activate' ) );
+register_deactivation_hook( __FILE__, array( $GLOBALS['WCOR_Mailer'], 'deactivate' ) );
+
+require_once( __DIR__ . '/wcor-reminder.php' );
+$GLOBALS['WCOR_Reminder'] = new WCOR_Reminder();
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamporganizerreminderswcormailerphp"></a>
<div class="addfile"><h4>Added: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php (0 => 114)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php 2013-11-05 00:52:03 UTC (rev 114)
</span><span class="lines">@@ -0,0 +1,240 @@
</span><ins>+<?php
+
+/**
+ * Sends e-mails at time-based intervals and triggers
+ * @package WordCampOrganizerReminders
+ */
+class WCOR_Mailer {
+ public $triggers;
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+ $this->triggers = array(
+ 'wcor_added_to_schedule' => array(
+ 'name' => 'Added to schedule',
+ 'actions' => array(
+ array(
+ 'name' => 'post_updated',
+ 'callback' => 'send_trigger_added_to_schedule',
+ 'priority' => 10,
+ 'parameters' => 2,
+ ),
+ ),
+ ),
+ );
+
+ add_action( 'wcor_send_timed_emails', array( $this, 'send_timed_emails' ) );
+
+ foreach ( $this->triggers as $trigger_id => $trigger ) {
+ foreach( $trigger['actions'] as $action ) {
+ add_action( $action['name'], array( $this, $action['callback'] ), $action['priority'], $action['parameters'] );
+ }
+ }
+ }
+
+ /**
+ * Schedule cron job when plugin is activated
+ */
+ public function activate() {
+ if ( wp_next_scheduled( 'wcor_send_timed_emails' ) === false ) {
+ wp_schedule_event(
+ current_time( 'timestamp' ),
+ 'daily',
+ 'wcor_send_timed_emails'
+ );
+ }
+ }
+
+ /**
+ * Clear cron job when plugin is deactivated
+ */
+ public function deactivate() {
+ wp_clear_scheduled_hook( 'wcor_send_timed_emails' );
+ }
+
+ /**
+ * Wrapper for wp_mail() that customizes the subject, body and headers
+ *
+ * We want to make sure that replies go to support@wordcamp.org, rather than the fake address that WordPress sends from, but
+ * we don't want to be flagged as spam for forging the From header, so we set the Sender header.
+ * @see http://stackoverflow.com/q/4728393/450127
+ *
+ * @todo Add the ability to use tags like %organizer_name% and %wordcamp_name% in the e-mail body. Maybe use shortcodes, or just do str_replace.
+ * Problem is sometimes need info from other sites, so hard to get inside this function, but still want it centralized here to keep it DRY.
+ * @todo Prefix subject with WordCamp name instead of Central. Same problem as above.
+ *
+ * @param string $to
+ * @param string $subject
+ * @param string $body
+ * @return bool
+ */
+ protected function mail( $to, $subject, $body ) {
+ $headers = array(
+ 'From: WordCamp Central <support@wordcamp.org>',
+ 'Sender: wordpress@' . strtolower( $_SERVER['SERVER_NAME'] )
+ );
+
+ return wp_mail( $to, 'WordCamp Central Reminder: ' . $subject, strip_tags( $body ), $headers );
+ }
+
+ /**
+ * Send e-mails that are scheduled to go out at a specific time (e.g., 3 days before the camp)
+ */
+ public function send_timed_emails() {
+ $recent_or_upcoming_wordcamps = get_posts( array(
+ 'posts_per_page' => -1,
+ 'post_type' => 'wordcamp',
+ 'meta_query' => array(
+ array(
+ 'key' => 'Start Date (YYYY-mm-dd)',
+ 'value' => strtotime( 'now - 3 months' ),
+ 'compare' => '>=',
+ ),
+ ),
+ ) );
+
+ $reminder_emails = get_posts( array(
+ 'posts_per_page' => -1,
+ 'post_type' => WCOR_Reminder::POST_TYPE_SLUG,
+ 'meta_query' => array(
+ array(
+ 'key' => 'wcor_send_when',
+ 'value' => array( 'wcor_send_before', 'wcor_send_after' ),
+ 'compare' => 'IN'
+ ),
+ ),
+ ) );
+
+ foreach ( $recent_or_upcoming_wordcamps as $wordcamp ) {
+ $organizers_email = get_post_meta( $wordcamp->ID, 'E-mail Address', true );
+ $sent_email_ids = (array) get_post_meta( $wordcamp->ID, 'wcor_sent_email_ids', true );
+
+ if ( ! is_email( $organizers_email ) ) {
+ continue;
+ }
+
+ foreach ( $reminder_emails as $email ) {
+ if ( $this->timed_email_is_ready_to_send( $wordcamp, $email, $sent_email_ids ) ) {
+ if ( $this->mail( $organizers_email, $email->post_title, $email->post_content ) ) {
+ $sent_email_ids[] = $email->ID;
+ update_post_meta( $wordcamp->ID, 'wcor_sent_email_ids', $sent_email_ids );
+ }
+
+ sleep( 1 ); // don't send e-mails too fast, or it might increase the risk of being flagged as spam
+ }
+ }
+ }
+ }
+
+ /**
+ * Determines if a time-based e-mail is ready to be sent to a WordCamp
+ *
+ * E-mails should be sent if the current date matches the date that the e-mail is scheduled to be sent (e.g., 3 days before the camp starts).
+ *
+ * One exception to that is if a camp is added later than expected (e.g., we start sending e-mails 4 months before the start date, but a camp
+ * isn't scheduled until 2 months before the start). When that happens, we want to send all the e-mails that they've missed.
+ *
+ * An exception to that exception is that we don't want to send e-mails to camps that have already been sent those e-mails manually, before we
+ * started sending them automatically.
+ * @todo This exception will no longer be relevant 3 months after the date hardcoded below, because we only query for camps that started 3 months
+ * before the current date, so it can be removed at that time.
+ *
+ * @todo It'd be nice to have some unit tests for this function, since there are a lot of different cases, but it seems like that might be
+ * hard to do because of having to mock get_post_meta(), current_time(), etc. We could pass that info in, but that doesn't seem very elegant.
+ *
+ * @param WP_Post $wordcamp
+ * @param WP_Post $email
+ * @param array $sent_email_ids The IDs of emails that have already been sent to the $wordcamp post
+ * @return bool
+ */
+ protected function timed_email_is_ready_to_send( $wordcamp, $email, $sent_email_ids ) {
+ $ready = false;
+ $send_when = get_post_meta( $email->ID, 'wcor_send_when', true );
+ $start_date = get_post_meta( $wordcamp->ID, 'Start Date (YYYY-mm-dd)', true );
+ $end_date = get_post_meta( $wordcamp->ID, 'End Date (YYYY-mm-dd)', true );
+
+ if ( ! $end_date ) {
+ $end_date = $start_date;
+ }
+
+ if ( ! in_array( $email->ID, $sent_email_ids ) ) {
+ if ( 'wcor_send_before' == $send_when ) {
+ $days_before = absint( get_post_meta( $email->ID, 'wcor_send_days_before', true ) );
+
+ if ( $days_before ) {
+ $send_date = $start_date - ( $days_before * DAY_IN_SECONDS );
+
+ if ( $send_date <= current_time( 'timestamp' ) ) {
+ $ready = true;
+ }
+ }
+ } elseif ( 'wcor_send_after' == $send_when ) {
+ $days_after = absint( get_post_meta( $email->ID, 'wcor_send_days_after', true ) );
+
+ if ( $days_after ) {
+ $send_date = $end_date + ( $days_after * DAY_IN_SECONDS );
+
+ if ( $send_date <= current_time( 'timestamp' ) ) {
+ $ready = true;
+ }
+ }
+ }
+
+ if ( $send_date <= strtotime( 'November 3rd, 2013' ) ) {
+ // Assume it was already sent manually before this plugin was activated
+ $ready = false;
+ }
+ }
+
+ return $ready;
+ }
+
+ /**
+ * Sends e-mails hooked to the wcor_added_to_schedule trigger.
+ *
+ * This fires when a WordCamp is added to the schedule (i.e., when they set the start date in their `wordcamp` post).
+ *
+ * Since Core doesn't support revisions on post meta, we're not actually checking to see if the start date was added during
+ * the current post update, but just that it has a start data. By itself, that would lead to the e-mail being sent every time
+ * the post is updated, but to avoid that we're checking the `wcor_sent_email_id` post meta for the `wordcamp` post to see if
+ * we've already sent this particular e-mail to this WordCamp in the past.
+ *
+ * @param int $post_id
+ * @param WP_Post $post
+ */
+ public function send_trigger_added_to_schedule( $post_id, $post ) {
+ if ( 'wordcamp' == $post->post_type && 'publish' == $post->post_status ) {
+ $start_date = get_post_meta( $post_id, 'Start Date (YYYY-mm-dd)', true );
+ $organizers_email = get_post_meta( $post_id, 'E-mail Address', true );
+ $sent_email_ids = (array) get_post_meta( $post_id, 'wcor_sent_email_ids', true );
+
+ if ( $start_date && is_email( $organizers_email ) ) {
+ $emails = get_posts( array(
+ 'posts_per_page' => -1,
+ 'post_type' => WCOR_Reminder::POST_TYPE_SLUG,
+ 'meta_query' => array(
+ array(
+ 'key' => 'wcor_send_when',
+ 'value' => 'wcor_send_trigger',
+ ),
+ array(
+ 'key' => 'wcor_which_trigger',
+ 'value' => 'wcor_added_to_schedule',
+ ),
+ ),
+ ) );
+
+ foreach( $emails as $email ) {
+ if ( ! in_array( $email->ID, $sent_email_ids ) ) {
+ if ( $this->mail( $organizers_email, $email->post_title, $email->post_content ) ) {
+ $sent_email_ids[] = $email->ID;
+ update_post_meta( $post_id, 'wcor_sent_email_ids', $sent_email_ids );
+ }
+ }
+ }
+ }
+ }
+ }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamporganizerreminderswcorreminderphp"></a>
<div class="addfile"><h4>Added: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-reminder.php (0 => 114)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-reminder.php (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-reminder.php 2013-11-05 00:52:03 UTC (rev 114)
</span><span class="lines">@@ -0,0 +1,178 @@
</span><ins>+<?php
+
+/**
+ * A Custom post type to store the body of the reminder e-mails
+ * @package WordCampOrganizerReminders
+ */
+
+class WCOR_Reminder {
+ const POST_TYPE_SLUG = 'organizer-reminder';
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+ add_action( 'init', array( $this, 'register_post_type' ) );
+ add_action( 'admin_init', array( $this, 'add_meta_boxes' ) );
+ add_action( 'save_post_' . self::POST_TYPE_SLUG, array( $this, 'save_post' ), 10, 2 );
+ }
+
+ /**
+ * Registers the Reminder post type
+ */
+ public function register_post_type() {
+ $labels = array(
+ 'name' => 'Organizer Reminders',
+ 'singular_name' => 'Organizer Reminder',
+ 'add_new' => 'Add New',
+ 'add_new_item' => 'Add New Reminder',
+ 'edit' => 'Edit',
+ 'edit_item' => 'Edit Reminder',
+ 'new_item' => 'New Reminder',
+ 'view' => 'View Reminders',
+ 'view_item' => 'View Reminder',
+ 'search_items' => 'Search Reminders',
+ 'not_found' => 'No reminders',
+ 'not_found_in_trash' => 'No reminders',
+ 'parent' => 'Parent Reminder',
+ );
+
+ $params = array(
+ 'labels' => $labels,
+ 'singular_label' => 'Reminder',
+ 'public' => true,
+ 'exclude_from_search' => true,
+ 'publicly_queryable' => false,
+ 'show_ui' => true,
+ 'show_in_nav_menus' => false,
+ 'hierarchical' => false,
+ 'capability_type' => 'post',
+ 'has_archive' => false,
+ 'rewrite' => false,
+ 'query_var' => false,
+ 'supports' => array( 'title', 'editor', 'author', 'revisions' ),
+ );
+
+ register_post_type( self::POST_TYPE_SLUG, $params );
+ }
+
+ /**
+ * Adds meta boxes for the custom post type
+ */
+ public function add_meta_boxes() {
+ add_meta_box(
+ 'wcor_reminder_details',
+ 'Reminder Details',
+ array( $this, 'markup_reminder_details' ),
+ self::POST_TYPE_SLUG,
+ 'side',
+ 'default'
+ );
+ }
+
+ /**
+ * Builds the markup for the Reminder Details metabox
+ *
+ * @param object $post
+ */
+ public static function markup_reminder_details( $post ) {
+ $send_when = get_post_meta( $post->ID, 'wcor_send_when', true );
+ $send_days_before = get_post_meta( $post->ID, 'wcor_send_days_before', true );
+ $send_days_after = get_post_meta( $post->ID, 'wcor_send_days_after', true );
+ $which_trigger = get_post_meta( $post->ID, 'wcor_which_trigger', true );
+
+ ?>
+
+ <p>When should this e-mail be sent?</p>
+
+ <table>
+ <tbody>
+ <tr>
+ <th><input id="wcor_send_before" name="wcor_send_when" type="radio" value="wcor_send_before" <?php checked( $send_when, 'wcor_send_before' ); ?>></th>
+ <td><label for="wcor_send_before">before the camp starts: </label></td>
+ <td>
+ <input id="wcor_send_days_before" name="wcor_send_days_before" type="text" class="small-text" value="<?php echo esc_attr( $send_days_before ); ?>" />
+ <label for="wcor_send_days_before">days</label>
+ </td>
+ </tr>
+
+ <tr>
+ <th><input id="wcor_send_after" name="wcor_send_when" type="radio" value="wcor_send_after" <?php checked( $send_when, 'wcor_send_after' ); ?>></th>
+ <td><label for="wcor_send_after">after the camp ends: </label></td>
+ <td>
+ <input id="wcor_send_days_after" name="wcor_send_days_after" type="text" class="small-text" value="<?php echo esc_attr( $send_days_after ); ?>" />
+ <label for="wcor_send_days_after">days</label>
+ </td>
+ </tr>
+
+ <tr>
+ <th><input id="wcor_send_trigger" name="wcor_send_when" type="radio" value="wcor_send_trigger" <?php checked( $send_when, 'wcor_send_trigger' ); ?>></th>
+ <td><label for="wcor_send_trigger">on trigger: </label></td>
+ <td>
+ <select name="wcor_which_trigger">
+ <option value="null" <?php selected( $which_trigger, false ); ?>></option>
+
+ <?php foreach ( $GLOBALS['WCOR_Mailer']->triggers as $trigger_id => $trigger ) : ?>
+ <option value="<?php echo esc_attr( $trigger_id ); ?>" <?php selected( $which_trigger, $trigger_id ); ?>><?php echo esc_html( $trigger['name'] ); ?></option>
+ <?php endforeach; ?>
+ </select>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <?php
+ }
+
+ /**
+ * Checks to make sure the conditions for saving post meta are met
+ *
+ * @param int $post_id
+ * @param object $post
+ */
+ public function save_post( $post_id, $post ) {
+ $ignored_actions = array( 'trash', 'untrash', 'restore' );
+
+ if ( isset( $_GET['action'] ) && in_array( $_GET['action'], $ignored_actions ) ) {
+ return;
+ }
+
+ if ( ! current_user_can( 'edit_posts', $post_id ) ) {
+ return;
+ }
+
+ if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! isset( $post->ID ) || $post->post_status == 'auto-draft' ) {
+ return;
+ }
+
+ $this->save_post_meta( $post, $_POST );
+ }
+
+ /**
+ * Saves the meta data for the reminder post
+ *
+ * @param WP_Post $post
+ * @param array $new_meta
+ */
+ protected function save_post_meta( $post, $new_meta ) {
+ if ( isset( $new_meta['wcor_send_when'] ) ) {
+ if ( in_array( $new_meta['wcor_send_when'], array( 'wcor_send_before', 'wcor_send_after', 'wcor_send_trigger' ) ) ) {
+ update_post_meta( $post->ID, 'wcor_send_when', $new_meta['wcor_send_when'] );
+ }
+ }
+
+ if ( isset( $new_meta['wcor_send_days_before'] ) ) {
+ update_post_meta( $post->ID, 'wcor_send_days_before', absint( $new_meta['wcor_send_days_before'] ) );
+ }
+
+ if ( isset( $new_meta['wcor_send_days_after'] ) ) {
+ update_post_meta( $post->ID, 'wcor_send_days_after', absint( $new_meta['wcor_send_days_after'] ) );
+ }
+
+ if ( isset( $new_meta['wcor_which_trigger'] ) ) {
+ if ( in_array( $new_meta['wcor_which_trigger'], array_merge( array( 'null' ), array_keys( $GLOBALS['WCOR_Mailer']->triggers ) ) ) ) {
+ update_post_meta( $post->ID, 'wcor_which_trigger', $new_meta['wcor_which_trigger'] );
+ }
+ }
+ }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>