Skip to content
This repository

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

Closed
wants to merge 1 commit into from

3 participants

Cory Kennedy-Darby Andrey Andreev

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 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
Cory Kennedy-Darby

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.

Andrey Andreev narfbg referenced this pull request from a commit
Andrey Andreev 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
Andrey Andreev
Collaborator

See the above commit.

Kyra Zimmer nonchip referenced this pull request from a commit in nonchip/CodeIgniter
Andrey Andreev 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

Showing 1 unique commit by 1 author.

Sep 02, 2012
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
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 28 additions and 3 deletions. Show diff stats Hide diff stats

  1. +28 3 system/libraries/Email.php
31 system/libraries/Email.php
... ... @@ -1,4 +1,4 @@
1   -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  1 +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2 2 /**
3 3 * CodeIgniter
4 4 *
@@ -1780,9 +1780,12 @@ protected function _get_ip()
1780 1780 /**
1781 1781 * Get Debug Message
1782 1782 *
  1783 + * @param bool
  1784 + * @param bool
  1785 + * @param bool
1783 1786 * @return string
1784 1787 */
1785   - public function print_debugger()
  1788 + public function print_debugger($inc_header = TRUE, $inc_subject = TRUE, $inc_body = TRUE)
1786 1789 {
1787 1790 $msg = '';
1788 1791
@@ -1794,7 +1797,29 @@ public function print_debugger()
1794 1797 }
1795 1798 }
1796 1799
1797   - return $msg.'<pre>'.$this->_header_str."\n".htmlspecialchars($this->_subject)."\n".htmlspecialchars($this->_finalbody).'</pre>';
  1800 + $options = array();
  1801 +
  1802 + if ($inc_header)
  1803 + {
  1804 + $options[] = $this->_header_str;
  1805 + }
  1806 +
  1807 + if ($inc_subject)
  1808 + {
  1809 + $options[] = htmlspecialchars($this->_subject);
  1810 + }
  1811 +
  1812 + if ($inc_body)
  1813 + {
  1814 + $options[] = htmlspecialchars($this->_finalbody);
  1815 + }
  1816 +
  1817 + if ( ! empty($options))
  1818 + {
  1819 + $msg .= '<pre>'.implode("\n", $options).'</pre>';
  1820 + }
  1821 +
  1822 + return $msg;
1798 1823 }
1799 1824
1800 1825 // --------------------------------------------------------------------

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.