Centralise check for debug output

This commit is contained in:
Synchro 2013-07-09 13:46:44 +02:00
parent c5e9f7873f
commit d79afc52c8
1 changed files with 9 additions and 16 deletions

View File

@ -545,10 +545,13 @@ class PHPMailer {
}
/**
* Outputs debugging info via user-defined method
* Outputs debugging info via user-defined method if debug output is enabled
* @param string $str
*/
protected function edebug($str) {
if (!$this->SMTPDebug) {
return;
}
switch ($this->Debugoutput) {
case 'error_log':
error_log($str);
@ -694,9 +697,7 @@ class PHPMailer {
if ($this->exceptions) {
throw new phpmailerException('Invalid recipient array: ' . $kind);
}
if ($this->SMTPDebug) {
$this->edebug($this->Lang('Invalid recipient array').': '.$kind);
}
$this->edebug($this->Lang('Invalid recipient array').': '.$kind);
return false;
}
$address = trim($address);
@ -706,9 +707,7 @@ class PHPMailer {
if ($this->exceptions) {
throw new phpmailerException($this->Lang('invalid_address').': '.$address);
}
if ($this->SMTPDebug) {
$this->edebug($this->Lang('invalid_address').': '.$address);
}
$this->edebug($this->Lang('invalid_address').': '.$address);
return false;
}
if ($kind != 'Reply-To') {
@ -742,9 +741,7 @@ class PHPMailer {
if ($this->exceptions) {
throw new phpmailerException($this->Lang('invalid_address').': '.$address);
}
if ($this->SMTPDebug) {
$this->edebug($this->Lang('invalid_address').': '.$address);
}
$this->edebug($this->Lang('invalid_address').': '.$address);
return false;
}
$this->From = $address;
@ -889,9 +886,7 @@ class PHPMailer {
if ($this->exceptions) {
throw $e;
}
if ($this->SMTPDebug) {
$this->edebug($e->getMessage()."\n");
}
$this->edebug($e->getMessage()."\n");
}
return false;
}
@ -1804,9 +1799,7 @@ class PHPMailer {
if ($this->exceptions) {
throw $e;
}
if ($this->SMTPDebug) {
$this->edebug($e->getMessage()."\n");
}
$this->edebug($e->getMessage()."\n");
return false;
}
return true;