From 61797f67a9bcb357ae7e1be9dadffd58eaa3e540 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Nov 2012 16:15:12 +0200 Subject: CI_Email::print_debugger() option to limit the type of data to be printed (an alternative to PR #1759; partially solves issue #1742) --- system/libraries/Email.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'system') 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.'
'.$this->_header_str."\n".htmlspecialchars($this->_subject)."\n".htmlspecialchars($this->_finalbody).'
'; + // 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 === '' ? '' : '
'.$raw_data.'
'); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b