From: Roland Häder Date: Fri, 16 Sep 2022 14:04:18 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=019ad2dbd1b89feccec917d588babacf3f206781;p=mailer.git Continued: - "get" is for getters only (e.g. no parameter), so used "render" prefix - changed to mask (sprintf()) --- diff --git a/inc/template-functions.php b/inc/template-functions.php index a59a577af2..88269aafeb 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -78,16 +78,16 @@ function initTemplateColorSwitch ($template) { $GLOBALS['color_switch'][$template] = 2; } -// "Getter" for color switch code -function getColorSwitchCode ($template) { +// "Renders" color switch code +function renderColorSwitchCode ($template) { // Prepare the code - $code = "{DQUOTE} . doTemplateColorSwitch('" . $template . "', FALSE, FALSE) . {DQUOTE}"; + $code = sprintf("{DQUOTE} . doTemplateColorSwitch('%s', FALSE, FALSE) . {DQUOTE}", $template); // And return it return $code; } -// Output HTML code directly or 'render' it. You addionally switch the new-line character off +// Output HTML code directly or 'render' it. You can addionally switch the new-line character off function outputHtml ($htmlCode = NULL, $newLine = TRUE) { // Init output if (!isset($GLOBALS['__output'])) { @@ -351,7 +351,7 @@ function loadTemplate ($template, $return = FALSE, $content = [], $compileCode = // Prepare eval() command //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!'); - $GLOBALS['template_eval']['html'][$template] = '$templateContent = "' . getColorSwitchCode($template) . compileCode(escapeQuotes($code), TRUE, $compileCode) . '";'; + $GLOBALS['template_eval']['html'][$template] = '$templateContent = "' . renderColorSwitchCode($template) . compileCode(escapeQuotes($code), TRUE, $compileCode) . '";'; } elseif (substr($template, 0, 3) == 'js_') { // JavaScripts don't like entities, dollar signs and timings //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!'); @@ -369,7 +369,7 @@ function loadTemplate ($template, $return = FALSE, $content = [], $compileCode = // Add surrounding HTML comments to help finding bugs faster $templateContent = '' . $GLOBALS['template_content']['html'][$template] . ''; //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!'); - $GLOBALS['template_eval']['html'][$template] = '$templateContent = "' . getColorSwitchCode($template) . compileRawCode(escapeQuotes($templateContent), TRUE, $compileCode) . '";'; + $GLOBALS['template_eval']['html'][$template] = '$templateContent = "' . renderColorSwitchCode($template) . compileRawCode(escapeQuotes($templateContent), TRUE, $compileCode) . '";'; } elseif (isAjaxOutputMode()) { // AJAX (JSON content) //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');