diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-11-26 15:15:12 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-11-26 15:15:12 +0100 |
commit | 61797f67a9bcb357ae7e1be9dadffd58eaa3e540 (patch) | |
tree | 540d1e0bed4a9b26dc10d3b314a549d589ca7e2e /system | |
parent | cff35804fa53661df357699260a04aa50fc05b21 (diff) |
CI_Email::print_debugger() option to limit the type of data to be printed
(an alternative to PR #1759; partially solves issue #1742)
Diffstat (limited to 'system')
-rw-r--r-- | system/libraries/Email.php | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 92ccde60c..5d8fc8aea 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -2062,9 +2062,11 @@ class CI_Email { /** * Get Debug Message * + * @param array $include List of raw data chunks to include in the output + * Valid options are: 'headers', 'subject', 'body' * @return string */ - public function print_debugger() + public function print_debugger($include = array('headers', 'subject', 'body')) { $msg = ''; @@ -2076,7 +2078,26 @@ class CI_Email { } } - return $msg.'<pre>'.$this->_header_str."\n".htmlspecialchars($this->_subject)."\n".htmlspecialchars($this->_finalbody).'</pre>'; + // Determine which parts of our raw data needs to be printed + $raw_data = ''; + is_array($include) OR $include = array($include); + + if (in_array('headers', $include, TRUE)) + { + $raw_data = $this->_header_str."\n"; + } + + if (in_array('subject', $include, TRUE)) + { + $raw_data .= htmlspecialchars($this->_subject)."\n"; + } + + if (in_array('body', $include, TRUE)) + { + $raw_data .= htmlspecialchars($this->_finalbody); + } + + return $msg.($raw_data === '' ? '' : '<pre>'.$raw_data.'</pre>'); } // -------------------------------------------------------------------- |