$active) { // Debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Running: name=' . $filterName . ',func=' . $filterFunction . ',active=' . $active); // Is the filter active or newly added?? if (($active == 'Y') || ($active == 'A') || ((in_array($filterName, array('shutdown','extension_remove','post_extension_run_sql'))) && ($active == 'R'))) { // Is this filter there? if (!function_exists($filterFunction)) { // Unregister it unregisterFilter(__FUNCTION__, __LINE__, $filterName, $filterFunction); // Skip this entry continue; } // END - if // Call the filter chain //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $filterName . '/' . $filterFunction . ',[]=' . gettype($returnValue)); $returnValue = call_user_func_array($filterFunction, array($returnValue)); // Update usage counter countFilterUsage($filterName, $filterFunction); } elseif (isDebugModeEnabled()) { // Debug message logDebugMessage(__FUNCTION__, __LINE__, 'Skipped: name=' . $filterName . ',func=' . $filterFunction . ',active=' . $active); } } // END - foreach // Return the filtered content //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'filterName=' . $filterName . ',data[]=' . gettype($data) . ',returnValue[]=' . gettype($returnValue) . ' - EXIT!'); return $returnValue; } // Count the filter usage function countFilterUsage ($filterName, $filterFunction) { // Is it there? if (isset($GLOBALS['cache_array']['filter']['counter'][$filterName][$filterFunction])) { // Yes, then increase $GLOBALS['cache_array']['filter']['counter'][$filterName][$filterFunction]++; } else { // No, then create $GLOBALS['cache_array']['filter']['counter'][$filterName][$filterFunction] = 1; } } // Prepares the filter array for usage function prepareFilterArray () { // Abort here if array is absend (e.g. not cached) if (!isset($GLOBALS['cache_array']['filter']['filter_name'])) { // Abort silently return false; } // END - if // Init dummy array $filterArray = array( 'chains' => array(), 'loaded' => array(), 'counter' => array() ); // Found in cache so rewrite the array foreach ($GLOBALS['cache_array']['filter']['filter_name'] as $idx => $filterName) { // Get filter function $filterFunction = $GLOBALS['cache_array']['filter']['filter_function'][$idx]; // Add the element with mapped index $filterArray['counter'][$filterName][$filterFunction] = $GLOBALS['cache_array']['filter']['filter_counter'][$idx]; $filterArray['loaded'][$filterName][$filterFunction] = true; $filterArray['chains'][$filterName][$filterFunction] = $GLOBALS['cache_array']['filter']['filter_active'][$idx]; } // END - foreach // Remove the cache $GLOBALS['cache_array']['filter'] = $filterArray; } // [EOF] ?>