Reverted of changes in 1704, see ticket #160
[mailer.git] / inc / expression-functions.php
index 485e6195857e3e9d51e9fcf0ecb6161a2f03f051..b1e95c2ef6932df503a5dc581664dd78c02e3fa6 100644 (file)
@@ -18,6 +18,7 @@
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -98,9 +99,9 @@ function doExpressionUser ($data) {
        }
 
        // Do we have another function to run (e.g. translations)
-       if (!empty($extraFunction)) {
+       if (!empty($data['extra_func'])) {
                // Surround the original function call with it
-               $functionName = $extraFunction . '(' . $functionName . ')';
+               $functionName = $data['extra_func'] . '(' . $functionName . ')';
        } // END - if
 
        // Now replace the code
@@ -132,6 +133,7 @@ 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']]);
@@ -161,5 +163,26 @@ function doExpressionFilter ($data) {
        return $code;
 }
 
+// Expression call-back function for validator links
+function doExpressionValidatorLinks ($data) {
+       // Default is nothing
+       $replacer = '';
+
+       // Get the code from data array for replacement/pipe-through
+       $code = $data['code'];
+
+       // Should we generally include validator links?
+       if ((isExtensionInstalled('validator')) && (getConfig('enable_validator') == 'Y') && (!in_array(getModule(), array('admin', 'login')))) {
+               // Load the validator template
+               $replacer = escapeQuotes(loadTemplate('validator_links', true));
+       } // END - if
+
+       // Replace the code
+       $code = str_replace($data['matches'][0][$data['key']], $replacer, $code);
+
+       // Return the (maybe) replaced code
+       return $code;
+}
+
 // [EOF]
 ?>