]> git.mxchange.org Git - mailer.git/blobdiff - inc/expression-functions.php
This is no longer required, see template admin_add_network_api_translation
[mailer.git] / inc / expression-functions.php
index 9f309b9d86ab1308b8d190cb315e1aedf82e828d..3d713acd449b006fc836781d176d82dd5f4e07da 100644 (file)
@@ -65,7 +65,7 @@ function isExpressionFunctionAvaiable ($data) {
                        // Add non-empty parts
                        if (!empty($piece)) {
                                // Add it
-                               $functionName .= ucfirst(strtolower($piece));
+                               $functionName .= capitalizeUnderscoreString($piece);
                        } // END - if
                } // END - foreach
 
@@ -138,42 +138,6 @@ function doExpressionServer ($data) {
        return $code;
 }
 
-// Expression call-back function for fetching user data
-function doExpressionUser ($data) {
-       // Use current userid by default
-       $functionName = 'getMemberId()';
-
-       // User-related data, so is there a userid?
-       if (!empty($data['matches'][4][$data['key']])) {
-               // Do we have a userid or $userid?
-               if ($data['matches'][4][$data['key']] == '$userid') {
-                       // Use dynamic call
-                       $functionName = "getFetchedUserData('userid', \$userid, '" . $data['callback'] . "')";
-               } elseif (!empty($data['matches'][4][$data['key']])) {
-                       // User data found
-                       $functionName = "getFetchedUserData('userid', " . $data['matches'][4][$data['key']] . ", '" . $data['callback'] . "')";
-               }
-       } elseif ((!empty($data['callback'])) && (isUserDataValid())) {
-               // "Call-back" alias column for current logged in user's data
-               $functionName = "getUserData('" . $data['callback'] . "')";
-       }
-
-       // Do we have another function to run (e.g. translations)
-       if (!empty($data['extra_func'])) {
-               // Surround the original function call with it
-               $functionName = $data['extra_func'] . '(' . $functionName . ')';
-       } // END - if
-
-       // Generate replacer
-       $replacer = '{DQUOTE} . ' . $functionName . ' . {DQUOTE}';
-
-       // Now replace the code
-       $code = replaceExpressionCode($data, $replacer);
-
-       // Return replaced code
-       return $code;
-}
-
 // Expression call-back function for getting extension data
 function doExpressionExt ($data) {
        // Not installed is default
@@ -182,7 +146,7 @@ function doExpressionExt ($data) {
        // Is the extension installed?
        if (isExtensionInstalled($data['matches'][4][$data['key']])) {
                // Construct call-back function name
-               $functionName = 'getExtension' . ucfirst(strtolower($data['callback']));
+               $functionName = 'getExtension' . capitalizeUnderscoreString($data['callback']);
 
                // Construct call of the function
                $replacer = "{DQUOTE} . call_user_func_array('" . $functionName . "', array('" . $data['matches'][4][$data['key']] . "', true)) . {DQUOTE}";
@@ -321,5 +285,21 @@ function doExpressionTemplate ($data) {
        return $code;
 }
 
+// Expression call-back for math functions
+function doExpressionMath ($data) {
+       // Do the replacement
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template='.$GLOBALS['current_template']);
+       $replacer = '{DQUOTE} . doCalculate' . $data['callback'] . '(' . $data['value'] . ') . {DQUOTE}';
+
+       // Replace the code
+       $code = replaceExpressionCode($data, $replacer);
+
+       // Load include once
+       loadIncludeOnce('inc/math-functions.php');
+
+       // Return the (maybe) replaced code
+       return $code;
+}
+
 // [EOF]
 ?>