X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ftemplate-functions.php;h=208c2f21267780c53be2bf487f72bd1284fe0847;hb=6bd47661d7ec406cd276f0835364b1e3f933d6c8;hp=9c7192ab1a5d40132d25ab1f45c122e2a11e93cf;hpb=6560179e7c8dc565485503f374d4e31f333ffd0e;p=mailer.git diff --git a/inc/template-functions.php b/inc/template-functions.php index 9c7192ab1a..208c2f2126 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -41,12 +41,12 @@ if (!defined('__SECURITY')) { } // END - if // Wrapper until we merged to the EL branch -function preCompileCode ($code, $template = '', $compiled = false, $full = true, $overwrite = false) { - return compileCode($code, false, true, $full); +function preCompileCode ($code, $template = '', $compiled = FALSE, $full = TRUE, $overwrite = FALSE) { + return compileCode($code, FALSE, TRUE, $full); } // Setter for 'is_template_html' -function enableTemplateHtml ($enable = true) { +function enableTemplateHtml ($enable = TRUE) { $GLOBALS['is_template_html'] = (bool) $enable; } @@ -56,7 +56,7 @@ function isTemplateHtml () { // Is the output_mode other than 0 (HTML), then no comments are enabled if (!isHtmlOutputMode()) { // No HTML - return false; + return FALSE; } else { // Maybe HTML? return $GLOBALS['is_template_html']; @@ -86,14 +86,14 @@ function initTemplateColorSwitch ($template) { // "Getter" for color switch code function getColorSwitchCode ($template) { // Prepare the code - $code = "{DQUOTE} . doTemplateColorSwitch('" . $template . "', false, false) . {DQUOTE}"; + $code = "{DQUOTE} . doTemplateColorSwitch('" . $template . "', FALSE, FALSE) . {DQUOTE}"; // And return it return $code; } // Output HTML code directly or 'render' it. You addionally switch the new-line character off -function outputHtml ($htmlCode, $newLine = true) { +function outputHtml ($htmlCode, $newLine = TRUE) { // Init output if (!isset($GLOBALS['__output'])) { $GLOBALS['__output'] = ''; @@ -111,7 +111,7 @@ function outputHtml ($htmlCode, $newLine = true) { outputRawCode($htmlCode); // That's why you don't need any \n at the end of your HTML code... :-) - if ($newLine === true) { + if ($newLine === TRUE) { outputRawCode(chr(10)); } // END - if } else { @@ -119,7 +119,7 @@ function outputHtml ($htmlCode, $newLine = true) { $GLOBALS['__output'] .= $htmlCode; // That's why you don't need any \n at the end of your HTML code... :-) - if ($newLine === true) { + if ($newLine === TRUE) { $GLOBALS['__output'] .= chr(10); } // END - if } @@ -134,7 +134,7 @@ function outputHtml ($htmlCode, $newLine = true) { // The same as above... ^ outputRawCode($htmlCode); - if ($newLine === true) { + if ($newLine === TRUE) { outputRawCode(chr(10)); } // END - if break; @@ -184,8 +184,11 @@ 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']); + + // Compile any other things out + $GLOBALS['__output'] = compileUriCode($GLOBALS['__output']); // Extension 'rewrite' installed? if ((isExtensionActive('rewrite')) && (!isCssOutputMode())) { @@ -218,7 +221,7 @@ function compileFinalOutput () { } // Main compilation loop -function doFinalCompilation ($code, $insertComments = true, $enableCodes = true) { +function doFinalCompilation ($code, $insertComments = TRUE, $enableCodes = TRUE) { // Insert comments? (Only valid with HTML templates, of course) enableTemplateHtml($insertComments); @@ -226,14 +229,14 @@ function doFinalCompilation ($code, $insertComments = true, $enableCodes = true) $count = 0; // Compile all out - while (((isInString('{--', $code)) || (isInString('{DQUOTE}', $code)) || (isInString('{?', $code)) || (isInString('{%', $code) !== false)) && ($count < 7)) { + while (((isInString('{--', $code)) || (isInString('{DQUOTE}', $code)) || (isInString('{?', $code)) || (isInString('{%', $code) !== FALSE)) && ($count < 7)) { // Init common variables $content = array(); $newContent = ''; // Compile it //* DEBUG: */ debugOutput('
'.linenumberCode($code).'
'); - $eval = '$newContent = "' . str_replace('{DQUOTE}', '"', compileCode(escapeQuotes($code), false, true, $enableCodes)) . '";'; + $eval = '$newContent = "' . str_replace('{DQUOTE}', '"', compileCode(escapeQuotes($code), FALSE, TRUE, $enableCodes)) . '";'; //* DEBUG: */ if (!$insertComments) print('EVAL=
'.linenumberCode($eval).'
'); eval($eval); //* DEBUG: */ if (!$insertComments) print('NEW=
'.linenumberCode($newContent).'
'); @@ -242,14 +245,14 @@ function doFinalCompilation ($code, $insertComments = true, $enableCodes = true) // Was that eval okay? if (empty($newContent)) { // Something went wrong! - reportBug(__FUNCTION__, __LINE__, 'Evaluation error:
' . linenumberCode($eval) . '
', false); + reportBug(__FUNCTION__, __LINE__, 'Evaluation error:
' . linenumberCode($eval) . '
', FALSE); } // END - if // Use it again $code = $newContent; // Compile the final code if insertComments is true - if ($insertComments == true) { + if ($insertComments == TRUE) { // ... because SQL queries shall keep OPEN_CONFIG and such in $code = compileRawCode($code); } // END - if @@ -259,7 +262,7 @@ function doFinalCompilation ($code, $insertComments = true, $enableCodes = true) } // END - while // Add debugging data in HTML code, if mode is enabled - if ((isDebugModeEnabled()) && ($insertComments === true) && ((isHtmlOutputMode()) || (isCssOutputMode()))) { + if ((isDebugModeEnabled()) && ($insertComments === TRUE) && ((isHtmlOutputMode()) || (isCssOutputMode()))) { // Add loop count $code .= ''; } // END - if @@ -281,7 +284,7 @@ function outputRawCode ($htmlCode) { } // Load a template file and return it's content (only it's name; do not use ' or ") -function loadTemplate ($template, $return = false, $content = array(), $compileCode = true) { +function loadTemplate ($template, $return = FALSE, $content = array(), $compileCode = TRUE) { // @TODO Remove these sanity checks if all is fine if (!is_bool($return)) { // $return has to be boolean @@ -335,21 +338,26 @@ function loadTemplate ($template, $return = false, $content = array(), $compileC $code = '' . $GLOBALS['template_content']['html'][$template] . ''; // Prepare eval() command - $GLOBALS['template_eval']['html'][$template] = '$ret = "' . getColorSwitchCode($template) . compileCode(escapeQuotes($code), false, true, true, $compileCode) . '";'; + //* 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 - $GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['template_content']['html'][$template]), false, true, true, $compileCode) . '");'; + //* 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 - $GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['template_content']['html'][$template]), false, true, true, $compileCode) . '");'; + //* 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 = '' . $GLOBALS['template_content']['html'][$template] . ''; - $GLOBALS['template_eval']['html'][$template] = '$ret = "' . getColorSwitchCode($template) . compileRawCode(escapeQuotes($ret), false, true, true, $compileCode) . '";'; + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!'); + $GLOBALS['template_eval']['html'][$template] = '$ret = "' . getColorSwitchCode($template) . compileRawCode(escapeQuotes($ret), FALSE, TRUE, TRUE, $compileCode) . '";'; } else { // JavaScript again - $GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['template_content']['html'][$template]), false, true, true, $compileCode) . '");'; + //* 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()))) { // Only admins shall see this warning or when installation mode is active @@ -361,7 +369,7 @@ function loadTemplate ($template, $return = false, $content = array(), $compileC
{--TEMPLATE_CONTENT--}: -
' . print_r($content, true) . '
+
' . print_r($content, TRUE) . '
'; } else { // No file! @@ -381,7 +389,7 @@ function loadTemplate ($template, $return = false, $content = array(), $compileC // Is there some content to output or return? if (!empty($ret)) { // Not empty so let's put it out! ;) - if ($return === true) { + if ($return === TRUE) { // Return the HTML code return $ret; } else { @@ -390,7 +398,7 @@ function loadTemplate ($template, $return = false, $content = array(), $compileC } } elseif (isDebugModeEnabled()) { // Warning, empty output! - return 'E:' . $template . ',content=
' . print_r($content, true) . '
'; + return 'E:' . $template . ',content=
' . print_r($content, TRUE) . '
'; } } @@ -449,7 +457,7 @@ function detectExtraTemplatePath ($prefix, $template) { } // Loads an email template and compiles it -function loadEmailTemplate ($template, $content = array(), $userid = NULL, $loadUserData = true) { +function loadEmailTemplate ($template, $content = array(), $userid = NULL, $loadUserData = TRUE) { // Make sure all template names are lowercase! $template = strtolower($template); @@ -506,7 +514,7 @@ function loadEmailTemplate ($template, $content = array(), $userid = NULL, $load
{--TEMPLATE_CONTENT--}: -
' . print_r($content, true) . '
+
' . print_r($content, TRUE) . '
'; // Don't cache this, as there is no template to cache @@ -536,12 +544,12 @@ function loadEmailTemplate ($template, $content = array(), $userid = NULL, $load // Are there some content? if (empty($newContent)) { // Compiling failed - $newContent = "Compiler error for template " . $template . " !\nUncompiled content:\n" . $GLOBALS['template_content']['email'][$template]; + $newContent = "Compiler error for template " . $template . " !\nUncompiled content:\n" . $GLOBALS['template_eval']['email'][$template]; // Add last error if the required function exists if (function_exists('error_get_last')) { // Add last error and some lines for better overview - $newContent .= "\n--------------------------------------\nDebug:\n" . print_r(error_get_last(), true) . "--------------------------------------\nPlease don't alter these informations!\nThanx."; + $newContent .= "\n--------------------------------------\nDebug:\n" . print_r(error_get_last(), TRUE) . "--------------------------------------\nPlease don't alter these informations!\nThanx."; } // END - if } // END - if @@ -587,21 +595,21 @@ function generateCaptchaCode ($code, $type, $urlId, $userid) { } // Compiles the given HTML/mail code -function compileCode ($code, $simple = false, $constants = true, $full = true, $compileCode = true) { +function compileCode ($code, $simple = FALSE, $constants = TRUE, $full = TRUE, $compileCode = TRUE) { // Is the code a string or should we not compile? - if ((!is_string($code)) || ($compileCode === false)) { + if ((!is_string($code)) || ($compileCode === FALSE)) { // Silently return it return $code; } // END - if // Start couting - $startCompile = microtime(true); + $startCompile = microtime(TRUE); // Comile the code $code = compileRawCode($code, $simple, $constants, $full); // Get timing - $compilationTime = $startCompile - microtime(true); + $compilationTime = $startCompile - microtime(TRUE); // Add timing if enabled if (isTemplateHtml()) { @@ -615,9 +623,9 @@ function compileCode ($code, $simple = false, $constants = true, $full = true, $ // Compiles the code // @TODO $simple/$constants are deprecated -function compileRawCode ($code, $simple = false, $constants = true, $full = true, $compileCode = true) { +function compileRawCode ($code, $simple = FALSE, $constants = TRUE, $full = TRUE, $compileCode = TRUE) { // Is the code a string or shall we not compile? - if ((!is_string($code)) || ($compileCode === false)) { + if ((!is_string($code)) || ($compileCode === FALSE)) { // Silently return it return $code; } // END - if @@ -626,7 +634,7 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true $secChars = $GLOBALS['url_chars']; // Select full set of chars to replace when we e.g. want to compile URLs - if ($full === true) { + if ($full === TRUE) { $secChars = $GLOBALS['security_chars']; } // END - if @@ -650,7 +658,7 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true $matchesFound = array(); foreach ($matches[0] as $key => $match) { // Fuzzy look has failed by default - $fuzzyFound = false; + $fuzzyFound = FALSE; // Fuzzy look on match if already found foreach ($matchesFound as $found => $set) { @@ -662,13 +670,13 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true if ($test == $match) { // Match found //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'fuzzyFound!'); - $fuzzyFound = true; + $fuzzyFound = TRUE; break; } // END - if } // END - foreach // Skip this entry? - if ($fuzzyFound === true) { + if ($fuzzyFound === TRUE) { continue; } // END - if @@ -679,7 +687,7 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true $newMatch = str_replace(array('[', ']', '$'), array("['", "']", '{COMPILE_DOLLAR}'), $match); $code = str_replace($match, '".' . $newMatch . '."', $code); $matchesFound[$key . '_' . $matches[3][$key]] = 1; - $matchesFound[$match] = true; + $matchesFound[$match] = TRUE; } elseif (!isset($matchesFound[$match])) { // Not yet replaced! //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'match=' . $match); @@ -845,12 +853,12 @@ function addSelectionBox ($type, $default, $prefix = '', $id = '0', $class = 'fo } // Insert the code in $img_code into jpeg or PNG image -function generateImageOrCode ($img_code, $headerSent = true) { +function generateImageOrCode ($img_code, $headerSent = TRUE) { // Is the code size oversized or shouldn't we display it? if ((strlen($img_code) > 6) || (empty($img_code)) || (getCodeLength() == '0')) { // Stop execution of function here because of over-sized code length reportBug(__FUNCTION__, __LINE__, 'img_code ' . $img_code .' has invalid length. img_code(length)=' . strlen($img_code) . ' code_length=' . getCodeLength()); - } elseif ($headerSent === false) { + } elseif ($headerSent === FALSE) { // Return an HTML code here return 'Image'; } @@ -900,7 +908,7 @@ function generateImageOrCode ($img_code, $headerSent = true) { } // Create selection box or array of splitted timestamp -function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = 'center', $asArray = false) { +function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = 'center', $asArray = FALSE) { // Do not continue if ONE_DAY is absend if (!isConfigEntrySet('ONE_DAY')) { // Abort here @@ -953,7 +961,7 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = // // Now we convert them in seconds... // - if ($asArray === true) { + if ($asArray === TRUE) { // Just put all data in an array for later use $OUT = array( 'Y' => $Y, @@ -1198,7 +1206,7 @@ function app_exit ($F, $L, $message) { } // END - if // Make sure, that the script realy realy diese here and now - $GLOBALS['app_died'] = true; + $GLOBALS['app_died'] = TRUE; // Set content type as text/html setContentType('text/html'); @@ -1215,7 +1223,7 @@ function app_exit ($F, $L, $message) { ); // Load the message template - loadTemplate('app_exit_message', false, $message); + loadTemplate('app_exit_message', FALSE, $message); // Load footer loadIncludeOnce('inc/footer.php'); @@ -1226,11 +1234,11 @@ function displayParsingTime () { // Is the timer started? if (!isset($GLOBALS['__start_time'])) { // Abort here - return false; + return FALSE; } // END - if // Get end time - $endTime = microtime(true); + $endTime = microtime(TRUE); // "Explode" both times $start = explode(' ', $GLOBALS['__start_time']); @@ -1248,7 +1256,7 @@ function displayParsingTime () { ); // Load the template - $GLOBALS['__page_footer'] .= loadTemplate('show_timings', true, $content); + $GLOBALS['__page_footer'] .= loadTemplate('show_timings', TRUE, $content); } /** @@ -1265,7 +1273,7 @@ function displayParsingTime () { * @param $sendEmail Wether to send an email to all configured administrators * @return void */ -function reportBug ($F, $L, $message = '', $sendEmail = true) { +function reportBug ($F, $L, $message = '', $sendEmail = TRUE) { // Is this already called? if (isset($GLOBALS[__FUNCTION__])) { // Other backtrace @@ -1278,7 +1286,7 @@ function reportBug ($F, $L, $message = '', $sendEmail = true) { setHttpStatus('500 Internal Server Error'); // Mark this function as called - $GLOBALS[__FUNCTION__] = true; + $GLOBALS[__FUNCTION__] = TRUE; // Init message $debug = ''; @@ -1302,7 +1310,7 @@ function reportBug ($F, $L, $message = '', $sendEmail = true) { $debug .= '
Thank you for finding bugs.
'; // Send an email? (e.g. not wanted for evaluation errors) - if (($sendEmail === true) && (!isInstallationPhase())) { + if (($sendEmail === TRUE) && (!isInstallationPhase())) { // Prepare content $content = array( 'message' => trim($message), @@ -1324,7 +1332,7 @@ function reportBug ($F, $L, $message = '', $sendEmail = true) { } // Compile characters which are allowed in URLs -function compileUriCode ($code, $simple = true) { +function compileUriCode ($code, $simple = TRUE) { // Trim code $test = trim($code); @@ -1361,16 +1369,17 @@ function compileUriCode ($code, $simple = true) { ); // Compile constants - if ($simple === false) { + if ($simple === FALSE) { // Add more 'from' - array_push($charsCompile['from'], '{--', '--}'); + array_unshift($charsCompile['from'], '{--', '--}'); // Add more 'to' - array_push($charsCompile['to'], '".', '."'); + array_unshift($charsCompile['to'], '".', '."'); } // END - if // Compile QUOT and other non-HTML codes $code = str_replace($charsCompile['from'], $charsCompile['to'], $code); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'code=' . $code); // Return compiled code return $code; @@ -1392,7 +1401,7 @@ function handleCodeMessage () { $message = getMessageFromErrorCode(getRequestElement('code')); // Load message template - loadTemplate('message', false, $message); + loadTemplate('message', FALSE, $message); } // END - if } @@ -1603,7 +1612,7 @@ function isTemplateCached ($prefix, $template) { // Flushes non-flushed template cache to disk function flushTemplateCache ($prefix, $template, $eval) { // Is this cache flushed? - if ((isDebuggingTemplateCache() === false) && (isTemplateCached($prefix, $template) === false) && ($eval != '404')) { + if ((isDebuggingTemplateCache() === FALSE) && (isTemplateCached($prefix, $template) === FALSE) && ($eval != '404')) { // Generate FQFN $FQFN = generateCacheFqfn($prefix, $template); @@ -1614,7 +1623,7 @@ function flushTemplateCache ($prefix, $template, $eval) { } // END - if // And flush it - writeToFile($FQFN, $eval, true); + writeToFile($FQFN, $eval, TRUE); } // END - if } @@ -1640,9 +1649,9 @@ function readTemplateCache ($prefix, $template) { } // Escapes quotes (default is only double-quotes) -function escapeQuotes ($str, $single = false) { +function escapeQuotes ($str, $single = FALSE) { // Should we escape all? - if ($single === true) { + if ($single === TRUE) { // Escape all (including null) $str = addslashes($str); } else { @@ -1650,7 +1659,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; } @@ -1772,12 +1781,12 @@ function sendModeMails ($mod, $modes) { } // Generates a 'selection box' from given array -function generateSelectionBoxFromArray ($options, $name, $optionKey, $optionContent = '', $extraName = '', $templateName = '', $default = NULL, $nameElement = '', $allowNone = false, $useDefaultAsArray = false) { +function generateSelectionBoxFromArray ($options, $name, $optionKey, $optionContent = '', $extraName = '', $templateName = '', $default = NULL, $nameElement = '', $allowNone = FALSE, $useDefaultAsArray = FALSE) { // Default is empty $addKey = ''; // Use default value as array key? - if ($useDefaultAsArray === true) { + if ($useDefaultAsArray === TRUE) { // Then set it $addKey = '[' . convertNullToZero($default) . ']'; } // END - if @@ -1787,7 +1796,7 @@ function generateSelectionBoxFromArray ($options, $name, $optionKey, $optionCont '; // Allow none? - if ($allowNone === true) { + if ($allowNone === TRUE) { // Then add it $OUT .= ''; } // END - if @@ -1815,10 +1824,10 @@ function generateSelectionBoxFromArray ($options, $name, $optionKey, $optionCont // Is a template name given? if (empty($templateName)) { // ... $name template - $OUT .= loadTemplate('select_' . $name . $extraName . '_option', true, $option); + $OUT .= loadTemplate('select_' . $name . $extraName . '_option', TRUE, $option); } else { // ... $templateName template - $OUT .= loadTemplate('select_' . $templateName . $extraName . '_option', true, $option); + $OUT .= loadTemplate('select_' . $templateName . $extraName . '_option', TRUE, $option); } } else { // ... direct HTML code @@ -1837,10 +1846,10 @@ function generateSelectionBoxFromArray ($options, $name, $optionKey, $optionCont // Load template and return it if (empty($templateName)) { // Use name from $name + $extraName - return loadTemplate('select_' . $name . $extraName . '_box', true, $content); + return loadTemplate('select_' . $name . $extraName . '_box', TRUE, $content); } else { // Use name from $templateName + $extraName - return loadTemplate('select_' . $templateName . $extraName . '_box', true, $content); + return loadTemplate('select_' . $templateName . $extraName . '_box', TRUE, $content); } } @@ -1885,7 +1894,7 @@ function addPageHeaderFooter () { // Generates meta description for current module and 'what' value function generateMetaDescriptionCode () { - // Only include from guest area and if sql_patches has correct version + // Only include from guest area and if ext-sql_patches has correct version if ((getModule() == 'index') && (isExtensionInstalledAndNewer('sql_patches', '0.1.6'))) { // Output it directly $GLOBALS['__page_header'] .= ''; @@ -1952,7 +1961,7 @@ function translateTimeUnit ($unit) { } // Displays given message in admin_settings_saved template -function displayMessage ($message, $return = false) { +function displayMessage ($message, $return = FALSE) { // Load the template return loadTemplate('admin_settings_saved', $return, $message); } @@ -2045,19 +2054,19 @@ function addJavaScriptMenuContent ($menuMode, $mainAction, $action, $what) { //----------------------------------------------------------------------------- // Color-switch helper function -function doTemplateColorSwitch ($templateName, $clear = false, $return = true) { +function doTemplateColorSwitch ($templateName, $clear = FALSE, $return = TRUE) { // Is it there? if (!isset($GLOBALS['color_switch'][$templateName])) { // Initialize it initTemplateColorSwitch($templateName); - } elseif ($clear === false) { + } elseif ($clear === FALSE) { // Switch color if called from loadTemplate() //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SWITCH:' . $templateName); $GLOBALS['color_switch'][$templateName] = 3 - $GLOBALS['color_switch'][$templateName]; } // Return CSS class name - if ($return === true) { + if ($return === TRUE) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'RETURN:' . $templateName . '=' . $GLOBALS['color_switch'][$templateName]); return 'switch_sw' . $GLOBALS['color_switch'][$templateName]; } // END - if @@ -2074,7 +2083,7 @@ function doTemplateExtensionRegistrationLink ($templateName, $clear, $ext_name) $OUT = '---'; } elseif (isExtensionProductive($ext_name)) { // Productive code - $OUT = '{--ADMIN_REGISTER_EXTENSION--}'; + $OUT = '{--ADMIN_REGISTER_EXTENSION--}'; } // Return code @@ -2201,7 +2210,7 @@ function doTemplateGetTermsConditionsLink ($templateName, $clear) { } // Template helper function to create selection box for "locked points mode" -function doTemplatePointsLockedModeSelectionBox ($templateName, $clear = false, $default = NULL) { +function doTemplatePointsLockedModeSelectionBox ($templateName, $clear = FALSE, $default = NULL) { // Init array $lockedModes = array( 0 => array('mode' => 'LOCKED'), @@ -2216,7 +2225,7 @@ function doTemplatePointsLockedModeSelectionBox ($templateName, $clear = false, } // Template helper function to create selection box for payment method -function doTemplatePointsPaymentMethodSelectionBox ($templateName, $clear = false, $default = NULL) { +function doTemplatePointsPaymentMethodSelectionBox ($templateName, $clear = FALSE, $default = NULL) { // Init array $paymentMethods = array( 0 => array('method' => 'DIRECT'), @@ -2230,6 +2239,18 @@ function doTemplatePointsPaymentMethodSelectionBox ($templateName, $clear = fals return $content; } +// Template helper function to create a deferrer code if URL is not empty +function doTemplateDereferrerUrl ($templateName, $clear = FALSE, $url = NULL) { + // Is the URL not NULL and not empty? + if ((!is_null($url)) && (!empty($url))) { + // Set HTML with EL code + $url = '{--ADMIN_TEST_URL--}'; + } // END - if + + // Return URL (or content) or dashes if empty + return fixEmptyContentToDashes($url); +} + // Tries to anonymize some sensitive data (e.g. IP address, user agent, referrer, etc.) function anonymizeSensitiveData ($data) { // Trim it