Making WordPress.org


Ignore:
Timestamp:
04/05/2016 04:05:02 PM (8 years ago)
Author:
kovshenin
Message:

WordCamp.org: Reintegrate application-tracking branch into trunk.

Location:
sites/trunk/wordcamp.org
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org

  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php

    r2156 r2898  
    77class WCOR_Mailer {
    88    public $triggers;
    9    
     9
    1010    /**
    1111     * Constructor
     
    6161            ),
    6262        );
    63        
     63
    6464        add_action( 'wcor_send_timed_emails', array( $this, 'send_timed_emails' ) );
    65        
     65
    6666        foreach ( $this->triggers as $trigger_id => $trigger ) {
    6767            foreach( $trigger['actions'] as $action ) {
     
    7272
    7373    /**
    74      * Schedule cron job when plugin is activated 
     74     * Schedule cron job when plugin is activated
    7575     */
    7676    public function activate() {
     
    8383        }
    8484    }
    85    
     85
    8686    /**
    8787     * Clear cron job when plugin is deactivated
     
    9494     * Wrapper for wp_mail() that customizes the subject, body and headers
    9595     *
    96      * We want to make sure that replies go to support@wordcamp.org, rather than the fake address that WordPress sends from, but 
     96     * We want to make sure that replies go to support@wordcamp.org, rather than the fake address that WordPress sends from, but
    9797     * we don't want to be flagged as spam for forging the From header, so we set the Sender header.
    9898     * @see http://stackoverflow.com/q/4728393/450127
     
    213213            '[safety_wrangler_name]',
    214214            '[safety_wrangler_email]',
    215            
     215
    216216            // Venue
    217217            '[venue_name]',
     
    287287            $this->get_mes_info( $wordcamp->ID ),
    288288        );
    289        
     289
    290290        return str_replace( $search, $replace, $content );
    291291    }
     
    454454        return $this->mail( $recipient, $email->post_title, $email->post_content, array(), $email, $wordcamp );
    455455    }
    456    
     456
    457457    /**
    458458     * Send e-mails that are scheduled to go out at a specific time (e.g., 3 days before the camp)
     
    462462            'posts_per_page'  => -1,
    463463            'post_type'       => 'wordcamp',
     464            'post_status'     => WordCamp_Loader::get_public_post_statuses(),
    464465            'meta_query'      => array(
    465466                array(
     
    474475            'posts_per_page'  => -1,
    475476            'post_type'       => WCPT_POST_TYPE_ID,
    476             'post_status'     => 'pending',
     477            'post_status'     => WordCamp_Loader::get_pre_planning_post_statuses(),
    477478        ) );
    478479
     
    490491            ),
    491492        ) );
    492        
     493
    493494        foreach ( $wordcamps as $wordcamp ) {
    494495            $sent_email_ids = (array) get_post_meta( $wordcamp->ID, 'wcor_sent_email_ids', true );
     
    496497            foreach ( $reminder_emails as $email ) {
    497498                $recipient = $this->get_recipients( $wordcamp->ID, $email->ID );
    498                
     499
    499500                if ( $this->timed_email_is_ready_to_send( $wordcamp, $email, $sent_email_ids ) ) {
    500501                    if ( $this->mail( $recipient, $email->post_title, $email->post_content, array(), $email, $wordcamp ) ) {
     
    520521     * @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
    521522     * 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.
    522      *       
     523     *
    523524     * @param WP_Post $wordcamp
    524525     * @param WP_Post $email
     
    544545            if ( 'wcor_send_before' == $send_when ) {
    545546                $days_before = absint( get_post_meta( $email->ID, 'wcor_send_days_before', true ) );
    546                
     547
    547548                if ( $start_date && $days_before ) {
    548549                    $send_date = $start_date - ( $days_before * DAY_IN_SECONDS );
    549                    
     550
    550551                    if ( $send_date <= current_time( 'timestamp' ) ) {
    551552                        $ready = true;
     
    557558                if ( $end_date && $days_after ) {
    558559                    $send_date = $end_date + ( $days_after * DAY_IN_SECONDS );
    559                    
     560
    560561                    if ( $send_date <= current_time( 'timestamp' ) ) {
    561562                        $ready = true;
     
    575576            }
    576577        }
    577        
     578
    578579        return $ready;
    579580    }
Note: See TracChangeset for help on using the changeset viewer.