]> git.mxchange.org Git - mailer.git/blobdiff - inc/expression-functions.php
Admin area 'Referral levels' refactured:
[mailer.git] / inc / expression-functions.php
index 4b64265df5685ef192806c50f6effb95b0d162d0..743e4a450b2096d1a2626491b2f12eb552b62ba9 100644 (file)
@@ -43,7 +43,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 +79,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 +91,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];
@@ -524,19 +524,32 @@ function doExpressionFormClose ($data) {
 // Expression call-back to handle jquery inclusion
 function doExpressionJquery ($data) {
        // Default is compressed
-       $jquery = 'jquery.js';
+       $jquery = 'jquery';
+       $data['output_mode'] = '';
+
+       // Is there JS-mode?
+       if ($data['callback'] == 'js') {
+               // Switch to it
+               $data['output_mode'] = ',js';
+       } // END - if
+
+       // Is there a value?
+       if ($data['callback'] == 'js') {
+               // Then load special library
+               $jquery .= '-' . $data['value'];
+       } // END - if
 
        // Is debug mode enabled?
        if ((isGetRequestElementSet('jquery')) || (isSessionVariableSet('jquery'))) {
                // Then use uncompressed
-               $jquery = 'jquery-uncompressed.js';
+               $jquery .= '.uncompressed';
 
                // Remember it in session
                setSession('jquery', '1');
        } // END - if
 
        // Add {%url%} around it
-       $replacer = '{%url=js/' . $jquery . '?dummy=1%}';
+       $replacer = '{%url' . $data['output_mode'] . '=js/' . $jquery . '.js?dummy=1%}';
 
        // Replace the code
        $code = replaceExpressionCode($data, $replacer);