]> git.mxchange.org Git - mailer.git/blobdiff - inc/filters.php
Filter support added to template engine, functions renamed
[mailer.git] / inc / filters.php
index 1019759bdee08d74e290dda0760ec7cbc0122c71..2b43a8faa82a11eb79c1653352af98eeafd59b56 100644 (file)
@@ -443,11 +443,10 @@ function FILTER_COMPILE_CONFIG ($code, $compiled = false) {
        return $GLOBALS['compiled_config'][$uncompiled];
 }
 
-// Filter for compiling extension data
-function FILTER_COMPILE_EXTENSION ($code) {
-       // Compile {%cmd=some_value%} to get extension data
-       // Support cmd is:
-       //   - version -> getExtensionVersion() call
+// Filter for compiling expression code
+function FILTER_COMPILE_EXPRESSION_CODE ($code) {
+       // Compile {%cmd=some_value%} to get expression code snippets
+       // See switch() command below for supported commands
        preg_match_all('/\{%(([a-zA-Z0-9-_,]+)(=([^\}]+)){0,1})*%\}/', $code, $matches);
        //* DEBUG: */ print('<pre>'.print_r($matches, true).'</pre>');
 
@@ -555,6 +554,11 @@ function FILTER_COMPILE_EXTENSION ($code) {
                                        $code = str_replace($matches[0][$key], $configValue, $code);
                                        break;
 
+                               case 'filter':
+                                       // Run the filter and insert result
+                                       $code = str_replace($matches[0][$key], runFilterChain($matches[4][$key]), $code);
+                                       break;
+
                                default:
                                        // Unsupported command detected
                                        debug_report_bug('Command=' . $cmd . ', callback=' . $callback . ', extra=' . $extraFunction . ' is unsupported.');