]> git.mxchange.org Git - mailer.git/blobdiff - inc/expression-functions.php
New template helper function doTemplateExtensionRegistrationLink() introduced
[mailer.git] / inc / expression-functions.php
index 29d412872442de503769cb4e0bdc05c5a0856290..9f309b9d86ab1308b8d190cb315e1aedf82e828d 100644 (file)
@@ -222,16 +222,17 @@ 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
-               $replacer = '{DQUOTE} . ' . $data['extra_func'] . '(' . $data['callback'] . "('" . $replacer . "')) . {DQUOTE}";
+               //if ($data['callback'] == 'getMemberId') die('<pre>'.encodeEntities(print_r($data, true)).'</pre>');
+               // If the value is empty, we don't add it
+               if (empty($data['value'])) {
+                       // No value is set
+                       $replacer = '{DQUOTE} . ' . $data['extra_func2'] . '(' . $data['extra_func'] . '(' . $data['callback'] . '())) . {DQUOTE}';
+               } else {
+                       // Some value is set
+                       $replacer = '{DQUOTE} . ' . $data['extra_func2'] . '(' . $data['extra_func'] . '(' . $data['callback'] . "('" . $data['value'] . "'))) . {DQUOTE}";
+               }
        } // END - if
 
        // Replace the config entry
@@ -302,7 +303,16 @@ function doExpressionMessage ($data) {
 function doExpressionTemplate ($data) {
        // Do the replacement
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template='.$GLOBALS['current_template']);
-       $replacer = '{DQUOTE} . doTemplate' . $data['callback'] . "('" . $GLOBALS['current_template'] . "', true) . {DQUOTE}";
+       $replacer = '{DQUOTE} . doTemplate' . $data['callback'] . "('" . $GLOBALS['current_template'] . "', true";
+
+       // Is 'value' set?
+       if (!empty($data['value'])) {
+               // Then include it as well
+               $replacer .= ", '" . $data['value'] . "'";
+       } // END - if
+
+       // Replacer is ready
+       $replacer .= ') . {DQUOTE}';
 
        // Replace the code
        $code = replaceExpressionCode($data, $replacer);