+ @my wife Roline van der Merwe
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
@@ -19,13 +31,6 @@ defined('_JEXEC') or die('Restricted access');
*/
abstract class ###Component###Email
{
- /**
- * The active recipient
- *
- * @var activeRecipient (array)
- */
- public static $active = array();
-
/**
* Configuraiton object
*
@@ -61,44 +66,6 @@ abstract class ###Component###Email
return self::$config;
}
- /**
- * Returns the global mailer object, only creating it if it doesn't already exist.
- *
- */
- public static function getMailerInstance()
- {
- if (!self::$mailer)
- {
- self::$mailer = self::createMailer();
- }
-
- return self::$mailer;
- }
-
- /**
- * Check that a string looks like an email address.
- * @param string $address The email address to check
- * @param string|callable $patternselect A selector for the validation pattern to use :
- * * `auto` Pick best pattern automatically;
- * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
- * * `pcre` Use old PCRE implementation;
- * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL;
- * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
- * * `noregex` Don't use a regex: super fast, really dumb.
- * Alternatively you may pass in a callable to inject your own validator, for example:
- * PHPMailer::validateAddress('user@example.com', function($address) {
- * return (strpos($address, '@') !== false);
- * });
- * You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator.
- * @return boolean
- * @static
- * @access public
- */
- public static function validateAddress($address, $patternselect = null)
- {
- return self::getMailerInstance()->validateAddress($address, $patternselect);
- }
-
/**
* Get a mailer object.
*
@@ -171,17 +138,17 @@ abstract class ###Component###Email
$replyto = $conf->get('replyto');
$replytoname = $conf->get('replytoname');
}
-
- // Set global sender
- $mail->setSender(array($mailfrom, $fromname));
// set the global reply-to if found
if ($replyto && $replytoname)
{
$mail->ClearReplyTos();
- $mail->addReplyTo($replyto, $replytoname);
+ $mail->addReplyTo( array( $replyto, $replytoname ) );
}
+ // Set global sender
+ $mail->setSender(array($mailfrom, $fromname));
+
// Default mailer is to use PHP's mail function
switch ($mailer)
{
@@ -229,6 +196,9 @@ abstract class ###Component###Email
// set component params
$conf = self::getConfig();
+ // do some house cleaning
+ $mail->ClearReplyTos();
+
// set if we have override
if ($mailfrom && $fromname)
{
@@ -327,70 +297,13 @@ abstract class ###Component###Email
if (method_exists('###Component###Helper','storeMessage'))
{
- // if we have active recipient details
- if (isset(self::$active[$recipient]))
- {
- // store the massage if the method is set
- ###Component###Helper::storeMessage($sendmail, self::$active[$recipient], $subject, $body, $textonly, $mode, 'email');
- // clear memory
- unset(self::$active[$recipient]);
- }
- else
- {
- // store the massage if the method is set
- ###Component###Helper::storeMessage($sendmail, $recipient, $subject, $body, $textonly, $mode, 'email');
- }
+ // store the massage if the method is set
+ ###Component###Helper::storeMessage($sendmail, $recipient, $subject, $body, $textonly, $mode, 'email');
}
return $sendmail;
}
- /**
- * Set html text (in a row) and subject (as title) to a email table.
- * do not use instead use
- * in your html that you pass to this method
- * since it is a table row it does not
- * work well with paragraphs
- *
- * @return string on success
- *
- */
- public static function setBasicBody($html, $subject)
- {
- $body = array();
- $body[] = "";
- $body[] = "";
- $body[] = "
";
- $body[] = "";
- $body[] = "";
- $body[] = "" . $subject . "";
- $body[] = "";
- $body[] = "";
- $body[] = "";
- $body[] = "";
- $body[] = $html;
- $body[] = "";
- $body[] = "";
-
- return implode("\n", $body);
- }
-
/**
* Set html text (in a row) and subject (as title) to a email table.
* do not use instead use
@@ -409,7 +322,7 @@ abstract class ###Component###Email
$body[] = "
";
$body[] = "";
$body[] = "";
- $body[] = "" . $subject . "";
+ $body[] = "".$subject."";
$body[] = "";
- $body[] = "";
- $body[] = "";
- $body[] = "";
- $body[] = $html;
- $body[] = "";
- $body[] = "