]> git.mxchange.org Git - mailer.git/blobdiff - inc/template-functions.php
Project continued with rewrites:
[mailer.git] / inc / template-functions.php
index 9f84147c1bbbfbbc0b5dab54e05ba4475bbb1e4f..f296be7355dc7e9918f091c3a15b610d05eb574a 100644 (file)
@@ -184,8 +184,14 @@ function compileFinalOutput () {
        addPageHeaderFooter();
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '__output(length)=' . strlen($GLOBALS['__output']) . ' - After addPageHeaderFooter() call.');
 
-       // Do the final compilation
-       $GLOBALS['__output'] = compileUriCode(doFinalCompilation($GLOBALS['__output']));
+       // Do the final (general) compilation
+       $GLOBALS['__output'] = doFinalCompilation($GLOBALS['__output']);
+
+       // Is the output mode not HTML?
+       if (!isHtmlOutputMode()) {
+               // Then remove entities
+               $GLOBALS['__output'] = compileUriCode($GLOBALS['__output']);
+       } // END - if
 
        // Extension 'rewrite' installed?
        if ((isExtensionActive('rewrite')) && (!isCssOutputMode())) {
@@ -335,20 +341,25 @@ function loadTemplate ($template, $return = FALSE, $content = array(), $compileC
                                        $code = '<!-- Template ' . $template . ' - Start //-->' . $GLOBALS['template_content']['html'][$template] . '<!-- Template ' . $template . ' - End //-->';
 
                                        // Prepare eval() command
+                                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
                                        $GLOBALS['template_eval']['html'][$template] = '$ret = "' . getColorSwitchCode($template) . compileCode(escapeQuotes($code), FALSE, TRUE, TRUE, $compileCode) . '";';
                                } elseif (substr($template, 0, 3) == 'js_') {
                                        // JavaScripts don't like entities, dollar signs and timings
+                                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
                                        $GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['template_content']['html'][$template]), FALSE, TRUE, TRUE, $compileCode) . '");';
                                } else {
                                        // Prepare eval() command, other output doesn't like entities, maybe
+                                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
                                        $GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['template_content']['html'][$template]), FALSE, TRUE, TRUE, $compileCode) . '");';
                                }
                        } elseif (isHtmlOutputMode()) {
                                // Add surrounding HTML comments to help finding bugs faster
                                $ret = '<!-- Template ' . $template . ' - Start //-->' . $GLOBALS['template_content']['html'][$template] . '<!-- Template ' . $template . ' - End //-->';
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
                                $GLOBALS['template_eval']['html'][$template] = '$ret = "' . getColorSwitchCode($template) . compileRawCode(escapeQuotes($ret), FALSE, TRUE, TRUE, $compileCode) . '";';
                        } else {
                                // JavaScript again
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
                                $GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['template_content']['html'][$template]), FALSE, TRUE, TRUE, $compileCode) . '");';
                        } // END - if
                } elseif ((isAdmin()) || ((isInstalling()) && (!isInstalled()))) {
@@ -1651,7 +1662,7 @@ function escapeQuotes ($str, $single = FALSE) {
                $str = str_replace(array("\\'", '"', "\\\\"), array(chr(39), "\\\"", chr(92)), $str);
        }
 
-       // Return the escaped string
+       // Return the escape'd string
        return $str;
 }