src/Service/Emailer.php
protected function printDebugger($input, $body, $plaintext, $recent_errors)
    {
        /**
         * Debug mode, output data and don't actually send
         * Remove the reference to CI; takes up a ton'na space
         */

        if (isset($input->data['ci'])) {
            $input->data['ci'] = '**REFERENCE TO CODEIGNITER INSTANCE**';
        }

        // --------------------------------------------------------------------------

        //  Input variables
        echo '<pre>';

        //  Who's the email going to?
        echo '<strong>Sending to:</strong>' . "\n";
        echo '-----------------------------------------------------------------' . "\n";
        echo 'email: ' . $input->to->email . "\n";
        echo 'first: ' . $input->to->first . "\n";
        echo 'last:  ' . $input->to->last . "\n";

        //  Who's the email being sent from?
        echo "\n\n" . '<strong>Sending from:</strong>' . "\n";
        echo '-----------------------------------------------------------------' . "\n";
        echo 'name: ' . $input->from->name . "\n";
        echo 'email:    ' . $input->from->email . "\n";

        //  Input data (system & supplied)
        echo "\n\n" . '<strong>Input variables (supplied + system):</strong>' . "\n";
        echo '-----------------------------------------------------------------' . "\n";
        print_r($input->data);

        //  Template
        echo "\n\n" . '<strong>Email body:</strong>' . "\n";
        echo '-----------------------------------------------------------------' . "\n";
        echo 'Subject:         ' . $input->subject . "\n";
        echo 'Template Header: ' . $input->template_header . "\n";
        echo 'Template Body:   ' . $input->template_body . "\n";
        echo 'Template Footer: ' . $input->template_footer . "\n";

        if ($recent_errors) {

            echo "\n\n" . '<strong>Template Errors (' . count($recent_errors) . '):</strong>' . "\n";
            echo '-----------------------------------------------------------------' . "\n";

            foreach ($recent_errors as $error) {

                echo 'Severity: ' . $error->severity . "\n";
                echo 'Mesage: ' . $error->message . "\n";
                echo 'Filepath: ' . $error->filepath . "\n";
                echo 'Line: ' . $error->line . "\n\n";
            }
        }

        echo "\n\n" . '<strong>Rendered HTML:</strong>' . "\n";
        echo '-----------------------------------------------------------------' . "\n";

        $_rendered_body = str_replace('"', '\\"', $body);
        $_rendered_body = str_replace(["\r\n", "\r"], "\n", $_rendered_body);
        $_lines         = explode("\n", $_rendered_body);
        $_new_lines     = [];

        foreach ($_lines as $line) {

            if (!empty($line)) {

                $_new_lines[] = $line;
            }
        }

        $renderedBody  = implode($_new_lines);
        $entityBody    = htmlentities($body);
        $plaintextBody = nl2br($plaintext);

        $str = <<<EOT
<iframe width="100%" height="900" src="" id="renderframe"></iframe>
<script type="text/javascript">
var emailBody = "$renderedBody";
document.getElementById('renderframe').src = "data:text/html;charset=utf-8," + escape(emailBody);
</script>

<strong>HTML:</strong>
-----------------------------------------------------------------
$entityBody

<strong>Plain Text:</strong>
-----------------------------------------------------------------
</pre>$plaintextBody</pre>
EOT;
    }
protected function printDebugger($input, $body, $plaintext, $recent_errors)
    {
        /**
         * Debug mode, output data and don't actually send
         * Remove the reference to CI; takes up a ton'na space
         */

        if (isset($input->data['ci'])) {
            $input->data['ci'] = '**REFERENCE TO CODEIGNITER INSTANCE**';
        }

        // --------------------------------------------------------------------------

        //  Input variables
        echo '<pre>';

        //  Who's the email going to?
        echo '<strong>Sending to:</strong>' . "\n";
        echo '-----------------------------------------------------------------' . "\n";
        echo 'email: ' . $input->to->email . "\n";
        echo 'first: ' . $input->to->first . "\n";
        echo 'last:  ' . $input->to->last . "\n";

        //  Who's the email being sent from?
        echo "\n\n" . '<strong>Sending from:</strong>' . "\n";
        echo '-----------------------------------------------------------------' . "\n";
        echo 'name: ' . $input->from->name . "\n";
        echo 'email:    ' . $input->from->email . "\n";

        //  Input data (system & supplied)
        echo "\n\n" . '<strong>Input variables (supplied + system):</strong>' . "\n";
        echo '-----------------------------------------------------------------' . "\n";
        print_r($input->data);

        //  Template
        echo "\n\n" . '<strong>Email body:</strong>' . "\n";
        echo '-----------------------------------------------------------------' . "\n";
        echo 'Subject:         ' . $input->subject . "\n";
        echo 'Template Header: ' . $input->template_header . "\n";
        echo 'Template Body:   ' . $input->template_body . "\n";
        echo 'Template Footer: ' . $input->template_footer . "\n";

        if ($recent_errors) {

            echo "\n\n" . '<strong>Template Errors (' . count($recent_errors) . '):</strong>' . "\n";
            echo '-----------------------------------------------------------------' . "\n";

            foreach ($recent_errors as $error) {

                echo 'Severity: ' . $error->severity . "\n";
                echo 'Mesage: ' . $error->message . "\n";
                echo 'Filepath: ' . $error->filepath . "\n";
                echo 'Line: ' . $error->line . "\n\n";
            }
        }

        echo "\n\n" . '<strong>Rendered HTML:</strong>' . "\n";
        echo '-----------------------------------------------------------------' . "\n";

        $_rendered_body = str_replace('"', '\\"', $body);
        $_rendered_body = str_replace(["\r\n", "\r"], "\n", $_rendered_body);
        $_lines         = explode("\n", $_rendered_body);
        $_new_lines     = [];

        foreach ($_lines as $line) {

            if (!empty($line)) {

                $_new_lines[] = $line;
            }
        }

        $renderedBody  = implode($_new_lines);
        $entityBody    = htmlentities($body);
        $plaintextBody = nl2br($plaintext);

        $str = <<<EOT
<iframe width="100%" height="900" src="" id="renderframe"></iframe>
<script type="text/javascript">
var emailBody = "$renderedBody";
document.getElementById('renderframe').src = "data:text/html;charset=utf-8," + escape(emailBody);
</script>

<strong>HTML:</strong>
-----------------------------------------------------------------
$entityBody

<strong>Plain Text:</strong>
-----------------------------------------------------------------
</pre>$plaintextBody</pre>
EOT;
    }
protected function printDebugger ( $ input , $ body , $ plaintext , $ recent_errors ) { /**
         * Debug mode, output data and don't actually send
         * Remove the reference to CI; takes up a ton'na space
         */ if ( isset ( $ input -> data [ 'ci' ] ) ) { $ input -> data [ 'ci' ] = '**REFERENCE TO CODEIGNITER INSTANCE**' ; } // -------------------------------------------------------------------------- //  Input variables echo '<pre>' ; //  Who's the email going to? echo '<strong>Sending to:</strong>' . "\n" ; echo '-----------------------------------------------------------------' . "\n" ; echo 'email: ' . $ input -> to -> email . "\n" ; echo 'first: ' . $ input -> to -> first . "\n" ; echo 'last:  ' . $ input -> to -> last . "\n" ; //  Who's the email being sent from? echo "\n\n" . '<strong>Sending from:</strong>' . "\n" ; echo '-----------------------------------------------------------------' . "\n" ; echo 'name: ' . $ input -> from -> name . "\n" ; echo 'email:    ' . $ input -> from -> email . "\n" ; //  Input data (system & supplied) echo "\n\n" . '<strong>Input variables (supplied + system):</strong>' . "\n" ; echo '-----------------------------------------------------------------' . "\n" ; print_r ( $ input -> data ) ; //  Template echo "\n\n" . '<strong>Email body:</strong>' . "\n" ; echo '-----------------------------------------------------------------' . "\n" ; echo 'Subject:         ' . $ input -> subject . "\n" ; echo 'Template Header: ' . $ input -> template_header . "\n" ; echo 'Template Body:   ' . $ input -> template_body . "\n" ; echo 'Template Footer: ' . $ input -> template_footer . "\n" ; if ( $ recent_errors ) { echo "\n\n" . '<strong>Template Errors (' . count ( $ recent_errors ) . '):</strong>' . "\n" ; echo '-----------------------------------------------------------------' . "\n" ; foreach ( $ recent_errors as $ error ) { echo 'Severity: ' . $ error -> severity . "\n" ; echo 'Mesage: ' . $ error -> message . "\n" ; echo 'Filepath: ' . $ error -> filepath . "\n" ; echo 'Line: ' . $ error -> line . "\n\n" ; } } echo "\n\n" . '<strong>Rendered HTML:</strong>' . "\n" ; echo '-----------------------------------------------------------------' . "\n" ; $ _rendered_body = str_replace ( '"' , '\\"' , $ body ) ; $ _rendered_body = str_replace ( [ "\r\n" , "\r" ] , "\n" , $ _rendered_body ) ; $ _lines = explode ( "\n" , $ _rendered_body ) ; $ _new_lines = [ ] ; foreach ( $ _lines as $ line ) { if ( ! empty ( $ line ) ) { $ _new_lines [ ] = $ line ; } } $ renderedBody = implode ( $ _new_lines ) ; $ entityBody = htmlentities ( $ body ) ; $ plaintextBody = nl2br ( $ plaintext ) ; $ str =  <<<EOT
<iframe width="100%" height="900" src="" id="renderframe"></iframe>
<script type="text/javascript">
var emailBody = "$renderedBody";
document.getElementById('renderframe').src = "data:text/html;charset=utf-8," + escape(emailBody);
</script>

<strong>HTML:</strong>
-----------------------------------------------------------------
$entityBody

<strong>Plain Text:</strong>
-----------------------------------------------------------------
</pre>$plaintextBody</pre>
EOT ; }
Renders the debugger

@param  \stdClass $input         The email input object
@param  string    $body          The email's body
@param  string    $plaintext     The email's plaintext body
@param  array     $recent_errors An array of any recent errors

@return void
Renders the debugger