Permalink
Browse files

[xoopsmailer] add class method "getVar($key)"

  • Loading branch information...
nao-pon committed Jul 5, 2014
1 parent b1c211d commit aa33f6ae73eabdc959eb9d07cf53abbc9b95cc7d
Showing with 32 additions and 18 deletions.
  1. +32 −18 html/class/xoopsmailer.php
View
@@ -130,6 +130,27 @@ class XoopsMailer
// protected
var $encoding = '8bit';
+ private $properties = array(
+ 'fromEmail' => "",
+ 'fromName' => "",
+ 'fromUser' => null, // RMV-NOTIFY
+ 'priority' => '',
+ 'toUsers' => array(),
+ 'toEmails' => array(),
+ 'headers' => array(),
+ 'subject' => "",
+ 'body' => "",
+ 'errors' => array(),
+ 'success' => array(),
+ 'isMail' => false,
+ 'isPM' => false,
+ 'assignedTags' => array(),
+ 'template' => "",
+ 'templatedir' => "",
+ // Change below to \r\n if you have problem sending mail
+ 'LE' => "\n"
+ );
+
function XoopsMailer()
{
@@ -141,24 +162,9 @@ function XoopsMailer()
// reset all properties to default
function reset()
{
- $this->fromEmail = "";
- $this->fromName = "";
- $this->fromUser = null; // RMV-NOTIFY
- $this->priority = '';
- $this->toUsers = array();
- $this->toEmails = array();
- $this->headers = array();
- $this->subject = "";
- $this->body = "";
- $this->errors = array();
- $this->success = array();
- $this->isMail = false;
- $this->isPM = false;
- $this->assignedTags = array();
- $this->template = "";
- $this->templatedir = "";
- // Change below to \r\n if you have problem sending mail
- $this->LE ="\n";
+ foreach($this->properties as $key => $val) {
+ $this->$key = $val;
+ }
}
// public
@@ -228,6 +234,14 @@ function usePM()
$this->isPM = true;
}
+ public function getVar($key) {
+ if (isset($this->properties[$key])) {
+ return $this->$key;
+ } else {
+ return null;
+ }
+ }
+
// public
function send($debug = false)
{

0 comments on commit aa33f6a

Please sign in to comment.