Ignore:
Timestamp:
Dec 30, 2014 10:24:51 PM (9 years ago)
Author:
anonymous
Message:

Many minor fixes during pulso development

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Email.inc.php

    r500 r502  
    5353*/
    5454
    55 class Email {
     55class Email
     56{
    5657
    5758    // Default parameters, to be overwritten by setParam() and read with getParam()
     
    244245    }
    245246
     247    /*
     248    * Returns the body of the current email. This can be used to store the message that is being sent.
     249    * It will use the original template, or the replaced template if it has been processed.
     250    *
     251    * @access   public
     252    * @return   string  Message body.
     253    * @author   Quinn Comendant <quinn@strangecode.com>
     254    * @version  1.0
     255    * @since    18 Nov 2014 21:15:19
     256    */
     257    public function getBody()
     258    {
     259        $final_body = isset($this->_template_replaced) ? $this->_template_replaced : $this->_template;
     260        // Ensure all placeholders have been replaced. Find anything with {...} characters.
     261        if (preg_match('/({[^}]+})/', $final_body, $unreplaced_match)) {
     262            unset($unreplaced_match[0]);
     263            $app->logMsg(sprintf('Cannot get email body. Unreplaced variables in template: %s', getDump($unreplaced_match)), LOG_ERR, __FILE__, __LINE__);
     264            return false;
     265        }
     266        return $final_body;
     267    }
     268
    246269    /**
    247270     * Send email using PHP's mail() function.
     
    295318        // Ensure all placeholders have been replaced. Find anything with {...} characters.
    296319        if (preg_match('/({[^}]+})/', $final_body, $unreplaced_match)) {
    297             $app->logMsg(sprintf('Cannot send email. At least one variable left unreplaced in template: %s', (isset($unreplaced_match[1]) ? $unreplaced_match[1] : '')), LOG_ERR, __FILE__, __LINE__);
     320            unset($unreplaced_match[0]);
     321            $app->logMsg(sprintf('Cannot send email. Unreplaced variables in template: %s', getDump($unreplaced_match)), LOG_ERR, __FILE__, __LINE__);
    298322            return false;
    299323        }
Note: See TracChangeset for help on using the changeset viewer.