| @@ 202-236 (lines=35) @@ | ||
| 199 | * @param integer $level The debug level of this message; see DEBUG_* constants |
|
| 200 | * @return void |
|
| 201 | */ |
|
| 202 | protected function edebug($str, $level = 0) |
|
| 203 | { |
|
| 204 | if ($level > $this->do_debug) { |
|
| 205 | return; |
|
| 206 | } |
|
| 207 | //Avoid clash with built-in function names |
|
| 208 | if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) { |
|
| 209 | call_user_func($this->Debugoutput, $str, $this->do_debug); |
|
| 210 | return; |
|
| 211 | } |
|
| 212 | switch ($this->Debugoutput) { |
|
| 213 | case 'error_log': |
|
| 214 | //Don't output, just log |
|
| 215 | error_log($str); |
|
| 216 | break; |
|
| 217 | case 'html': |
|
| 218 | //Cleans up output a bit for a better looking, HTML-safe output |
|
| 219 | echo htmlentities( |
|
| 220 | preg_replace('/[\r\n]+/', '', $str), |
|
| 221 | ENT_QUOTES, |
|
| 222 | 'UTF-8' |
|
| 223 | ) |
|
| 224 | . "<br>\n"; |
|
| 225 | break; |
|
| 226 | case 'echo': |
|
| 227 | default: |
|
| 228 | //Normalize line breaks |
|
| 229 | $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); |
|
| 230 | echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
| 231 | "\n", |
|
| 232 | "\n \t ", |
|
| 233 | trim($str) |
|
| 234 | )."\n"; |
|
| 235 | } |
|
| 236 | } |
|
| 237 | ||
| 238 | /** |
|
| 239 | * Connect to an SMTP server. |
|
| @@ 689-723 (lines=35) @@ | ||
| 686 | * @see PHPMailer::$SMTPDebug |
|
| 687 | * @param string $str |
|
| 688 | */ |
|
| 689 | protected function edebug($str) |
|
| 690 | { |
|
| 691 | if ($this->SMTPDebug <= 0) { |
|
| 692 | return; |
|
| 693 | } |
|
| 694 | //Avoid clash with built-in function names |
|
| 695 | if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) { |
|
| 696 | call_user_func($this->Debugoutput, $str, $this->SMTPDebug); |
|
| 697 | return; |
|
| 698 | } |
|
| 699 | switch ($this->Debugoutput) { |
|
| 700 | case 'error_log': |
|
| 701 | //Don't output, just log |
|
| 702 | error_log($str); |
|
| 703 | break; |
|
| 704 | case 'html': |
|
| 705 | //Cleans up output a bit for a better looking, HTML-safe output |
|
| 706 | echo htmlentities( |
|
| 707 | preg_replace('/[\r\n]+/', '', $str), |
|
| 708 | ENT_QUOTES, |
|
| 709 | 'UTF-8' |
|
| 710 | ) |
|
| 711 | . "<br>\n"; |
|
| 712 | break; |
|
| 713 | case 'echo': |
|
| 714 | default: |
|
| 715 | //Normalize line breaks |
|
| 716 | $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); |
|
| 717 | echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
| 718 | "\n", |
|
| 719 | "\n \t ", |
|
| 720 | trim($str) |
|
| 721 | ) . "\n"; |
|
| 722 | } |
|
| 723 | } |
|
| 724 | ||
| 725 | /** |
|
| 726 | * Sets message type to HTML or plain. |
|