Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

print_debugger() now accepts three optional parameters to decide what the function returns #1759

Closed
wants to merge 1 commit into from

3 participants

@jleft

The function now accepts three boolean parameters for: header, subject and body (including attachment data). The user can decide what combination of the above the function should return. The parameters all have a default value of TRUE, so it is fully backwards compatible with the previous version of the function. The debug message(s) will be returned regardless of what the parameters are set to.

@jleft jleft print_debugger() now accepts three optional parameters to decide what…
… the function returns (Issue #1742)

The function now accepts three boolean parameters for: header, subject
and body (including attachment data). The user can decide what
combination of the above the function should return. The parameters all
have a default value of TRUE, so it is fully backwards compatible with
the previous version of the function.
2f98139
@ckdarby

I agree with the old way that all debugging information should be sent.

Putting my personal preferences aside I will not back code like this because it allows for future parameter creep.

Please change this to option array to be passed instead of the tri-parameter set up.

@narfbg narfbg referenced this pull request from a commit
@narfbg narfbg CI_Email::print_debugger() option to limit the type of data to be pri…
…nted

(an alternative to PR #1759; partially solves issue #1742)
61797f6
@narfbg
Owner

See the above commit.

@narfbg narfbg closed this
@nonchip nonchip referenced this pull request from a commit in nonchip/CodeIgniter
@narfbg narfbg CI_Email::print_debugger() option to limit the type of data to be pri…
…nted

(an alternative to PR #1759; partially solves issue #1742)
53e84be
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 2, 2012
  1. @jleft

    print_debugger() now accepts three optional parameters to decide what…

    jleft authored
    … the function returns (Issue #1742)
    
    The function now accepts three boolean parameters for: header, subject
    and body (including attachment data). The user can decide what
    combination of the above the function should return. The parameters all
    have a default value of TRUE, so it is fully backwards compatible with
    the previous version of the function.
This page is out of date. Refresh to see the latest.
Showing with 28 additions and 3 deletions.
  1. +28 −3 system/libraries/Email.php
View
31 system/libraries/Email.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -1780,9 +1780,12 @@ protected function _get_ip()
/**
* Get Debug Message
*
+ * @param bool
+ * @param bool
+ * @param bool
* @return string
*/
- public function print_debugger()
+ public function print_debugger($inc_header = TRUE, $inc_subject = TRUE, $inc_body = TRUE)
{
$msg = '';
@@ -1794,7 +1797,29 @@ public function print_debugger()
}
}
- return $msg.'<pre>'.$this->_header_str."\n".htmlspecialchars($this->_subject)."\n".htmlspecialchars($this->_finalbody).'</pre>';
+ $options = array();
+
+ if ($inc_header)
+ {
+ $options[] = $this->_header_str;
+ }
+
+ if ($inc_subject)
+ {
+ $options[] = htmlspecialchars($this->_subject);
+ }
+
+ if ($inc_body)
+ {
+ $options[] = htmlspecialchars($this->_finalbody);
+ }
+
+ if ( ! empty($options))
+ {
+ $msg .= '<pre>'.implode("\n", $options).'</pre>';
+ }
+
+ return $msg;
}
// --------------------------------------------------------------------
Something went wrong with that request. Please try again.