X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffilters.php;h=1d96aa316c814c10171bb7fa0324e03afe017154;hb=f4d28601c0ea91db9a9ab7365be4faccfd4147f0;hp=424fe9f1048fe3fb6e7ef46971215bb7a7a2799a;hpb=ad30a667fd8abeb576c04026b62c2e8a29d86f52;p=mailer.git
diff --git a/inc/filters.php b/inc/filters.php
index 424fe9f104..1d96aa316c 100644
--- a/inc/filters.php
+++ b/inc/filters.php
@@ -79,15 +79,15 @@ function FILTER_FLUSH_FILTERS () {
// Walk through all filters
foreach ($filterArray as $filterFunction => $active) {
// Is this filter loaded?
- //* DEBUG: */ print 'FOUND:'.$filterName.'/'.$filterFunction.'='.$active.'
';
+ //* DEBUG: */ debugOutput('FOUND:'.$filterName.'/'.$filterFunction.'='.$active);
if (((!isset($GLOBALS['cache_array']['filter']['loaded'][$filterName][$filterFunction])) && ($active != 'R')) || ($active == 'A')) {
// Add this filter (all filters are active by default)
- //* DEBUG: */ print 'ADD:'.$filterName.'/'.$filterFunction.'
';
+ //* DEBUG: */ debugOutput('ADD:'.$filterName.'/'.$filterFunction);
$insertSQL .= sprintf("('%s','%s','Y'),", $filterName, $filterFunction);
$inserted++;
} elseif ($active == 'R') {
// Remove this filter
- //* DEBUG: */ print 'REMOVE:'.$filterName.'/'.$filterFunction.'
';
+ //* DEBUG: */ debugOutput('REMOVE:'.$filterName.'/'.$filterFunction);
$removeSQL .= sprintf(" (`filter_name`='%s' AND `filter_function`='%s') OR", $filterName, $filterFunction);
$removed++;
}
@@ -107,7 +107,7 @@ function FILTER_FLUSH_FILTERS () {
} // END - if
// Shall we update usage counters (ONLY FOR DEBUGGING!)
- if ((isExtensionInstalledAndNewer('sql_patches', '0.6.0')) && (getConfig('update_filter_usage') == 'Y')) {
+ if ((isExtensionInstalledAndNewer('sql_patches', '0.6.0')) && (isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') == 'Y')) {
// Update all counters
foreach ($GLOBALS['cache_array']['filter']['counter'] as $filterName => $filterArray) {
// Walk through all filters
@@ -435,8 +435,8 @@ function FILTER_COMPILE_CONFIG ($code, $compiled = false) {
// Should we compile it?
if ($compiled === true) {
// Run the code
- $eval = "\$GLOBALS['compiled_config'][\$uncompiled] = \"" . $GLOBALS['compiled_config'][$uncompiled] . "\";";
- //* DEBUG: */ print(__FUNCTION__.'['.__LINE__.']:
' . str_replace('$', '$', htmlentities($eval)) . ''); + $eval = "\$GLOBALS['compiled_config'][\$uncompiled] = \"" . $GLOBALS['compiled_config'][$uncompiled] . '";'; + //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:
' . str_replace('$', '$', htmlentities($eval)) . ''); eval($eval); } // END - if @@ -449,7 +449,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { // Compile {%cmd,callback,extraFunction=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(__FUNCTION__.'['.__LINE__.']:
'.print_r($matches, true).''); + //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:
'.print_r($matches, true).''); // Default is from outputHtml() $outputMode = getOutputMode(); @@ -459,15 +459,29 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { // Replace all matches foreach ($matches[2] as $key => $cmd) { // Init replacer/call-back variable - $replacer = ''; - $callback = ''; + $replacer = ''; + $callback = ''; $extraFunction = ''; + $value = ''; // Extract command and call-back $cmdArray = explode(',', $cmd); $cmd = $cmdArray[0]; - if (isset($cmdArray[1])) $callback = $cmdArray[1]; - if (isset($cmdArray[2])) $extraFunction = $cmdArray[2]; + + // Detect call-back function + if (isset($cmdArray[1])) { + // Call-back function detected + $callback = $cmdArray[1]; + } // END - if + + // Detect extra function + if (isset($cmdArray[2])) { + // Also detected + $extraFunction = $cmdArray[2]; + } elseif (isset($matches[4][$key])) { + // Use this as value + $value = $matches[4][$key]; + } // Construct call-back function name for the command $commandFunction = 'doExpression' . ucfirst(strtolower($cmd)); @@ -481,11 +495,12 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { 'mode' => $outputMode, 'code' => $code, 'callback' => $callback, - 'extra_func' => $extraFunction + 'extra_func' => $extraFunction, + 'value' => $value ); // Call it - //* DEBUG: */ print __FUNCTION__ . '[' . __LINE__ . ']: function=' . $commandFunction . "
'.($code).''); + //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:
'.($code).''); return $code; } @@ -637,7 +652,7 @@ function FILTER_DETERMINE_WHAT_ACTION () { } // Set default 'what' value - //* DEBUG: */ outputHtml('-'.getModule().'/'.getWhat()."-