X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fexpression-functions.php;h=7b90cbc03b274ae76a9f43c90e1de714b4a8a13c;hb=refs%2Fheads%2Fserver-0.2.1-FINAL%2Fshipsimu-org;hp=4b64265df5685ef192806c50f6effb95b0d162d0;hpb=4ffb69e5746a3a6ba65260745cbbe478e5462f9e;p=mailer.git diff --git a/inc/expression-functions.php b/inc/expression-functions.php index 4b64265df5..7b90cbc03b 100644 --- a/inc/expression-functions.php +++ b/inc/expression-functions.php @@ -10,13 +10,8 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Expression-Callback-Funktionen * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * Copyright (c) 2009 - 2016 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -43,7 +38,7 @@ if (!defined('__SECURITY')) { // Private function to replace the code function replaceExpressionCode ($data, $replacer) { // Replace the code - // @TODO is escapeQuotes() enougth for strings with single/double quotes? + // @TODO is escapeQuotes() enough for strings with single/double quotes? return str_replace($data['matches'][0][$data['key']], $replacer, escapeQuotes($data['code'])); } @@ -79,8 +74,8 @@ function isExpressionFunctionAvaiable ($data) { // And cache it $GLOBALS['expression_function_available'][$entry] = FALSE; } - } elseif ($GLOBALS['expression_function_available'][$entry] == FALSE) { - // Debug message + } elseif (($GLOBALS['expression_function_available'][$entry] == FALSE) && (isDebugModeEnabled())) { + // Debug message in debug mode logDebugMessage(__FUNCTION__, __LINE__, 'Expression function for entry ' . $entry . ' requested but does not exist.'); } @@ -91,7 +86,7 @@ function isExpressionFunctionAvaiable ($data) { // Getter for above expression function function getExpressionFunction ($data) { // Get the enty we need - $entry = $data['matches'][4][$data['key']]; + $entry = trim($data['matches'][4][$data['key']]); // Return it return $GLOBALS['expression_function_name'][$entry]; @@ -157,7 +152,7 @@ function doExpressionExt ($data) { } // END - if // Generate replacer - $replacer = sprintf("&ext=%s&ver=%s&rev={?CURRENT_REPOSITORY_REVISION?}", $data['matches'][4][$data['key']], $replacer); + $replacer = sprintf('&ext=%s&ver=%s', $data['matches'][4][$data['key']], $replacer); // Replace it and insert parameter for GET request $code = replaceExpressionCode($data, $replacer); @@ -281,7 +276,7 @@ function doExpressionMessage ($data) { // Expression call-back for template functions function doExpressionTemplate ($data) { // Construct call-back function name - $callbackFunction = 'doTemplate' . $data['callback']; + $callbackFunction = 'doTemplate' . ucfirst($data['callback']); // Init replacer $replacer = ''; @@ -327,9 +322,6 @@ function doExpressionMath ($data) { // Replace the code $code = replaceExpressionCode($data, $replacer); - // Load include once - loadIncludeOnce('inc/math-functions.php'); - // Return the (maybe) replaced code return $code; } @@ -444,7 +436,7 @@ function doExpressionForm ($data) { if ($value == 'formmethodpost') { // Use it $data['__form_method'] = 'post'; - } elseif (($value == 'formmethodpost') && (!isSpider()) && (!isSessionValid())) { + } elseif (($value == 'formmethodpost') && (!isSpider()) && (!isValidSession())) { // Then expand 'value' with session id if (strpos($data['value'], '?') !== FALSE) { // '?' is set @@ -467,7 +459,7 @@ function doExpressionForm ($data) { $data['__form_id'] = substr($value, 6); } elseif (substr($value, 0, 6) == 'server') { // {%server,foo%} found - $data['__server'] = '{%server=' . substr($value, 6) . '%}'; + $data['__server'] = '{%server,' . substr($value, 6) . '%}'; } } // END - foreach @@ -524,19 +516,35 @@ function doExpressionFormClose ($data) { // Expression call-back to handle jquery inclusion function doExpressionJquery ($data) { // Default is compressed - $jquery = 'jquery.js'; + $scriptName = 'jquery'; + $data['output_mode'] = ''; - // Is debug mode enabled? - if ((isGetRequestElementSet('jquery')) || (isSessionVariableSet('jquery'))) { - // Then use uncompressed - $jquery = 'jquery-uncompressed.js'; + // Is there JS-mode? + if ($data['callback'] == 'js') { + // Switch to it + $data['output_mode'] = ',js'; + } // END - if - // Remember it in session - setSession('jquery', '1'); + // Is there a value? + if ($data['callback'] == 'js') { + // Then load special library + $scriptName .= '-' . $data['value']; } // END - if + // Is debug mode enabled? + if ((!isGetRequestElementSet('jquery')) && (!isSessionVariableSet('jquery'))) { + // Productive systems want minimized version + $scriptName .= '.min'; + } else { + // Debug version is uncompressed, remember it in session + setSession('jquery', '1'); + } + + // Complete script name + $scriptName = sprintf('js/jquery/%s.js', $scriptName); + // Add {%url%} around it - $replacer = '{%url=js/' . $jquery . '?dummy=1%}'; + $replacer = sprintf('{%%url%s=%s?dummy=1%%}', $data['output_mode'], $scriptName); // Replace the code $code = replaceExpressionCode($data, $replacer); @@ -544,6 +552,3 @@ function doExpressionJquery ($data) { // Return the (maybe) replaced code return $code; } - -// [EOF] -?>