| @@ 711-745 (lines=35) @@ | ||
| 708 | * @see PHPMailer::$SMTPDebug |
|
| 709 | * @param string $str |
|
| 710 | */ |
|
| 711 | protected function edebug($str) |
|
| 712 | { |
|
| 713 | if ($this->SMTPDebug <= 0) { |
|
| 714 | return; |
|
| 715 | } |
|
| 716 | //Avoid clash with built-in function names |
|
| 717 | if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) { |
|
| 718 | call_user_func($this->Debugoutput, $str, $this->SMTPDebug); |
|
| 719 | return; |
|
| 720 | } |
|
| 721 | switch ($this->Debugoutput) { |
|
| 722 | case 'error_log': |
|
| 723 | //Don't output, just log |
|
| 724 | error_log($str); |
|
| 725 | break; |
|
| 726 | case 'html': |
|
| 727 | //Cleans up output a bit for a better looking, HTML-safe output |
|
| 728 | echo htmlentities( |
|
| 729 | preg_replace('/[\r\n]+/', '', $str), |
|
| 730 | ENT_QUOTES, |
|
| 731 | 'UTF-8' |
|
| 732 | ) |
|
| 733 | . "<br>\n"; |
|
| 734 | break; |
|
| 735 | case 'echo': |
|
| 736 | default: |
|
| 737 | //Normalize line breaks |
|
| 738 | $str = preg_replace('/\r\n?/ms', "\n", $str); |
|
| 739 | echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
| 740 | "\n", |
|
| 741 | "\n \t ", |
|
| 742 | trim($str) |
|
| 743 | ) . "\n"; |
|
| 744 | } |
|
| 745 | } |
|
| 746 | ||
| 747 | /** |
|
| 748 | * Sets message type to HTML or plain. |
|
| @@ 213-247 (lines=35) @@ | ||
| 210 | * @param integer $level The debug level of this message; see DEBUG_* constants |
|
| 211 | * @return void |
|
| 212 | */ |
|
| 213 | protected function edebug($str, $level = 0) |
|
| 214 | { |
|
| 215 | if ($level > $this->do_debug) { |
|
| 216 | return; |
|
| 217 | } |
|
| 218 | //Avoid clash with built-in function names |
|
| 219 | if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) { |
|
| 220 | call_user_func($this->Debugoutput, $str, $level); |
|
| 221 | return; |
|
| 222 | } |
|
| 223 | switch ($this->Debugoutput) { |
|
| 224 | case 'error_log': |
|
| 225 | //Don't output, just log |
|
| 226 | error_log($str); |
|
| 227 | break; |
|
| 228 | case 'html': |
|
| 229 | //Cleans up output a bit for a better looking, HTML-safe output |
|
| 230 | echo htmlentities( |
|
| 231 | preg_replace('/[\r\n]+/', '', $str), |
|
| 232 | ENT_QUOTES, |
|
| 233 | 'UTF-8' |
|
| 234 | ) |
|
| 235 | . "<br>\n"; |
|
| 236 | break; |
|
| 237 | case 'echo': |
|
| 238 | default: |
|
| 239 | //Normalize line breaks |
|
| 240 | $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); |
|
| 241 | echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
| 242 | "\n", |
|
| 243 | "\n \t ", |
|
| 244 | trim($str) |
|
| 245 | )."\n"; |
|
| 246 | } |
|
| 247 | } |
|
| 248 | ||
| 249 | /** |
|
| 250 | * Connect to an SMTP server. |
|