} // END - if
// Shall we remove? (default, not while just showing an extension removal)
- if (!$dry_run) {
+ if ($dry_run === false) {
// Mark for filter removal
- $GLOBALS['filters']['chains'][$filterName][$filterFunction] = "R";
- unset($GLOBALS['filters']['counter'][$filterName][$filterFunction]);
+ $GLOBALS['filters']['chains'][$filterName][$filterFunction] = 'R';
} // END - if
}
// Is that filter chain there?
if (!isset($GLOBALS['filters']['chains'][$filterName])) {
// Then abort here (quick'N'dirty hack)
- if ((!$silentAbort) && (defined('FILTER_FAILED_NO_FILTER_FOUND'))) {
+ if (($silentAbort === false) && (defined('FILTER_FAILED_NO_FILTER_FOUND'))) {
// Add fatal message
addFatalMessage(__FUNCTION__, __LINE__, getMessage('FILTER_FAILED_NO_FILTER_FOUND'), $filterName);
} // END - if
// Then run all filters
foreach ($GLOBALS['filters']['chains'][$filterName] as $filterFunction=>$active) {
// Debug message
- //* DEBUG: */ echo __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): name={$filterName},func={$filterFunction},active={$active}<br />\n";
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Running: name={$filterName},func={$filterFunction},active={$active}");
// Is the filter active?
- if ($active == 'Y') {
+ if (($active == 'Y') || ((in_array($filterName, array('extension_remove', 'post_extension_run_sql'))) && ($active == 'R'))) {
// Is this filter there?
if (!function_exists($filterFunction)) {
// Unregister it
$returnValue = call_user_func_array($filterFunction, array($returnValue));
// Update usage counter
- $GLOBALS['filters']['counter'][$filterName][$filterFunction]++;
- } // END - if
+ countFilterUsage($filterName, $filterFunction);
+ } elseif (isDebugModeEnabled()) {
+ // Debug message
+ DEBUG_LOG(__FUNCTION__, __LINE__, "Skipped: name={$filterName},func={$filterFunction},active={$active}");
+ }
} // END - foreach
// Return the filtered content
return $returnValue;
}
+// Count the filter usage
+function countFilterUsage ($filterName, $filterFunction) {
+ // Is it there?
+ if (isset($GLOBALS['filters']['counter'][$filterName][$filterFunction])) {
+ // Yes, then increase
+ $GLOBALS['filters']['counter'][$filterName][$filterFunction]++;
+ } else {
+ // No, then create
+ $GLOBALS['filters']['counter'][$filterName][$filterFunction] = 1;
+ }
+}
+
// -----------------------------------------------------------------------------
// Generic filter functions we always need
// -----------------------------------------------------------------------------