Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
PHPdocs
Consistent line breaks, tidier output in default debug output
  • Loading branch information
Synchro committed Aug 11, 2014
1 parent d6a63fc commit 54c0357
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
38 changes: 24 additions & 14 deletions class.phpmailer.php
Expand Up @@ -216,6 +216,8 @@ class PHPMailer
* You can also specify a different port
* for each host by using this format: [hostname:port]
* (e.g. "smtp1.example.com:25;smtp2.example.com").
* You can also specify encryption type, for example:
* (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465").
* Hosts will be tried in order.
* @type string
*/
Expand Down Expand Up @@ -293,12 +295,13 @@ class PHPMailer

/**
* SMTP class debug output mode.
* Debug output level.
* Options:
* 0: no output
* 1: commands
* 2: data and commands
* 3: as 2 plus connection status
* 4: low level data output
* * `0` No output
* * `1` Commands
* * `2` Data and commands
* * `3` As 2 plus connection status
* * `4` Low-level data output
* @type integer
* @see SMTP::$do_debug
*/
Expand All @@ -307,9 +310,10 @@ class PHPMailer
/**
* How to handle debug output.
* Options:
* 'echo': Output plain-text as-is, appropriate for CLI
* 'html': Output escaped, line breaks converted to <br>, appropriate for browser output
* 'error_log': Output to error log as configured in php.ini
* * `echo` Output plain-text as-is, appropriate for CLI
* * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
* * `error_log` Output to error log as configured in php.ini
*
* Alternatively, you can provide a callable expecting two params: a message string and the debug level:
* <code>
* $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
Expand Down Expand Up @@ -546,27 +550,27 @@ class PHPMailer
protected $exceptions = false;

/**
* Error severity: message only, continue processing
* Error severity: message only, continue processing.
*/
const STOP_MESSAGE = 0;

/**
* Error severity: message, likely ok to continue processing
* Error severity: message, likely ok to continue processing.
*/
const STOP_CONTINUE = 1;

/**
* Error severity: message, plus full stop, critical error reached
* Error severity: message, plus full stop, critical error reached.
*/
const STOP_CRITICAL = 2;

/**
* SMTP RFC standard line ending
* SMTP RFC standard line ending.
*/
const CRLF = "\r\n";

/**
* Constructor
* Constructor.
* @param boolean $exceptions Should we throw external exceptions?
*/
public function __construct($exceptions = false)
Expand Down Expand Up @@ -652,7 +656,13 @@ protected function edebug($str)
break;
case 'echo':
default:
echo gmdate('Y-m-d H:i:s') . "\t" . trim($str) . "\n";
//Normalize line breaks
$str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
"\n",
"\n \t ",
trim($str)
) . "\n";
}
}

Expand Down
15 changes: 10 additions & 5 deletions class.smtp.php
Expand Up @@ -53,23 +53,23 @@ class SMTP
/**
* The PHPMailer SMTP Version number.
* @type string
* @deprecated Use the constant instead
* @deprecated Use the `VERSION` constant instead
* @see SMTP::VERSION
*/
public $Version = '5.2.8';

/**
* SMTP server port number.
* @type integer
* @deprecated This is only ever used as a default value, so use the constant instead
* @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead
* @see SMTP::DEFAULT_SMTP_PORT
*/
public $SMTP_PORT = 25;

/**
* SMTP reply line ending.
* @type string
* @deprecated Use the constant instead
* @deprecated Use the `CRLF` constant instead
* @see SMTP::CRLF
*/
public $CRLF = "\r\n";
Expand All @@ -90,8 +90,9 @@ class SMTP
* How to handle debug output.
* Options:
* * `echo` Output plain-text as-is, appropriate for CLI
* * `html` Output escaped, line breaks converted to <br>, appropriate for browser output
* * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
* * `error_log` Output to error log as configured in php.ini
*
* Alternatively, you can provide a callable expecting two params: a message string and the debug level:
* <code>
* $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
Expand Down Expand Up @@ -177,8 +178,12 @@ protected function edebug($str)
break;
case 'echo':
default:
//Normalize line breaks
$str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
"\r\n", "\r\n \t ", trim($str)
"\n",
"\n \t ",
trim($str)
)."\n";
}
}
Expand Down

0 comments on commit 54c0357

Please sign in to comment.