]> git.mxchange.org Git - mailer.git/blobdiff - inc/expression-functions.php
Rewrites/fixes for handling config entries in SQLs
[mailer.git] / inc / expression-functions.php
index c3d1f57f8b9d015880d86593df7a0a472b1f01d1..c114e317731b521ac5c6ceb5e6f9294273e775a2 100644 (file)
@@ -115,7 +115,7 @@ function doExpressionUser ($data) {
        } // END - if
 
        // Generate replacer
-       $replacer = '{DQUOTE} . ' . $functionName . ' . "';
+       $replacer = '{DQUOTE} . ' . $functionName . ' . {DQUOTE}';
 
        // Now replace the code
        $code = replaceExpressionCode($data, $replacer);
@@ -151,17 +151,8 @@ function doExpressionExt ($data) {
 // Expression call-back function for getting configuration data
 // @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
 function doExpressionConfig ($data) {
-       // Read configuration
-       $configValue = getConfig($data['matches'][4][$data['key']]);
-
        // Default replacer is the config value itself
-       $replacer = $configValue;
-
-       // Is there a call-back function provided?
-       if (!empty($data['callback'])) {
-               // Construct a new expression
-               $replacer = '{%pipe,' . $data['callback'] . ',' . $configValue . '%}';
-       } // END - if
+       $replacer = '{DQUOTE}  . ' . $data['callback'] . '(getConfig(' . "'" . $data['matches'][4][$data['key']] . "'" . ')) . {DQUOTE}';
 
        // Replace the config entry
        $code = replaceExpressionCode($data, $replacer);
@@ -175,6 +166,12 @@ function doExpressionPipe ($data) {
        // We need callback and extra_func: callback is really the call-back function, extra_func is our value
        $replacer = $data['extra_func'];
 
+       // Is the extra_func empty and value set?
+       if ((empty($replacer)) && (isset($data['value']))) {
+               // Then use this
+               $replacer = $data['value'];
+       } // END - if
+
        // Do we have a call-back? Should always be there!
        if (!empty($data['callback'])) {
                // Parse it through this function