Fixes and double->single converted
[core.git] / inc / classes / main / mailer / class_BaseMailer.php
index ffd0bc1..9d9b121 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class BaseMailer extends BaseFrameworkSystem {
-       /**
-        * Iterateable list of recipients
-        */
-       private $recipientList = array();
-
        /**
         * Template name
         */
@@ -73,19 +68,13 @@ class BaseMailer extends BaseFrameworkSystem {
                $templateName = $this->getTemplateName();
 
                // Is the list initialized?
-               if (!isset($this->recipientList[$templateName]['recipients'])) {
-                       // Then initialize it here
-                       $this->recipientList[$templateName]['recipients'] = array();
-               } // END - if
-
-               // Add it as a recipient
-               array_pushh($this->recipientList[$templateName]['recipients'], $userInstance);
+               $this->pushValueToGenericArrayElement('recipients', $templateName, 'recipients', $userInstance);
        }
 
        /**
         * Adds a template variable (just the name) to the recipient list in given section of current template
         *
-        * @param       $section                Section can be "config" or "value" currently
+        * @param       $section                Section can be 'config' or "value" currently
         * @param       $variableName   Template variable name to add
         * @return      void
         */
@@ -97,13 +86,7 @@ class BaseMailer extends BaseFrameworkSystem {
                $sectionName = $section . '_vars';
 
                // Is the list initialized?
-               if (!isset($this->recipientList[$templateName][$sectionName])) {
-                       // Then initialize it here
-                       $this->recipientList[$templateName][$sectionName] = array();
-               } // END - if
-
-               // Add the variable to the list
-               $this->recipientList[$templateName][$sectionName][$variableName] = 'OK';
+               $this->setGenericArrayElement('recipients', $templateName, $sectionName, $variableName, 'OK');
        }
 
        /**
@@ -113,17 +96,17 @@ class BaseMailer extends BaseFrameworkSystem {
         * @return      void
         */
        public final function addConfigTemplateVariable ($variableName) {
-               $this->addTemplateVariable("config", $variableName);
+               $this->addTemplateVariable('config', $variableName);
        }
 
        /**
-        * Adds a "value" template variable to the recipient list of current template
+        * Adds a 'value' template variable to the recipient list of current template
         *
         * @param       $variableName   Template variable name to add
         * @return      void
         */
        public final function addValueTemplateVariable ($variableName) {
-               $this->addTemplateVariable("value", $variableName);
+               $this->addTemplateVariable('value', $variableName);
        }
 
        /**
@@ -134,7 +117,7 @@ class BaseMailer extends BaseFrameworkSystem {
         * @return      void
         */
        public final function addValueInstance ($variableName, FrameworkInterface $valueInstance) {
-               $this->recipientList[$this->getTemplateName()]['values'][$variableName] = $valueInstance;
+               $this->setGenericArrayElement('recipients', $this->getTemplateName(), 'values', $variableName, $valueInstance);
        }
 
        /**
@@ -163,7 +146,7 @@ class BaseMailer extends BaseFrameworkSystem {
         * @return      void
         */
        public final function setSubjectLine ($subjectLine) {
-               $this->recipientList[$this->getTemplateName()]['subject'] = (string) $subjectLine;
+       `       $this->setGenericArrayElement('recipients', $this->getTemplateName(), 'generic', 'subject', $subjectLine);
        }
 
        /**
@@ -179,9 +162,9 @@ class BaseMailer extends BaseFrameworkSystem {
                $templateName = $this->getTemplateName();
 
                // Does the subject line exist?
-               if ((!empty($templateName)) && (isset($this->recipientList[$templateName]['subject']))) {
+               if ((!empty($templateName)) && ($this->isGenericArrayElementSet('recipients', $templateName, 'generic', 'subject']))) {
                        // Then use it
-                       $subjectLine = $this->recipientList[$templateName]['subject'];
+                       $subjectLine = $this->getGenericArrayElement('recipients', $templateName, 'generic', 'subject');
                } // END - if
 
                // Return it
@@ -204,7 +187,7 @@ class BaseMailer extends BaseFrameworkSystem {
         * @return      $recipientList  Array with reciepients
         */
        public final function getRecipientList () {
-               return $this->recipientList;
+               return $this->getGenericArray('recipients');
        }
 }