X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Ffilter-functions.php;h=066ca223657ee8ccb5c9d0571ccdbb49e5c8fe6a;hb=b6c301dece2d7a3375321d4f3c0498ceaeb5a2a6;hp=1dd99c42d4d13487217e3ce149cec349fc152627;hpb=c3b4eaf29946349ff058691db2dcb615a5379bb2;p=mailer.git diff --git a/inc/filter-functions.php b/inc/filter-functions.php index 1dd99c42d4..066ca22365 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -105,6 +105,7 @@ ORDER BY registerFilter('init', 'SET_CURRENT_DATE'); registerFilter('init', 'INIT_RANDOM_NUMBER'); registerFilter('init', 'CHECK_REPOSITORY_REVISION'); + registerFilter('init', 'RUN_HOURLY_RESET'); registerFilter('init', 'RUN_DAILY_RESET'); registerFilter('init', 'TRIGGER_SENDING_POOL'); registerFilter('init', 'DETERMINE_USERNAME'); @@ -158,6 +159,9 @@ ORDER BY // Generic extension update filters registerFilter('extension_update', 'UPDATE_EXTENSION_DATA'); + // Do hourly reset stuff, keep this entry first in this chain: + registerFilter('hourly', 'RUN_HOURLY_INCLUDES'); + // Do reset stuff, keep this entry first in this chain: registerFilter('reset', 'RUN_RESET_INCLUDES'); @@ -254,7 +258,7 @@ function runFilterChain ($filterName, $data = null) { // Log not found filters in debug-mode if (isDebugModeEnabled()) { // Log it away... - logDebugMessage(__FUNCTION__, __LINE__, 'Filter chain ' . $filterName . ' not found!'); + logDebugMessage(__FUNCTION__, __LINE__, 'Filter chain ' . $filterName . ' not found.'); } // END - if // Abort here and return content @@ -339,5 +343,30 @@ function prepareFilterArray () { $GLOBALS['cache_array']['filter'] = $filterArray; } +// Loads filter for given extension if present. This function will silently +// ignore absent filter files. +function loadExtensionFilters ($ext_name) { + // Do we have cache entry? + if (!isset($GLOBALS[__FUNCTION__][$ext_name])) { + // Default is not found + $GLOBALS[__FUNCTION__][$ext_name] = false; + + // Construct include file name + $incFileName = sprintf("inc/filter/%s_filter.php", $ext_name); + + // Is the include file readable? + if (isIncludeReadable($incFileName)) { + // Load the include file + loadIncludeOnce($incFileName); + + // Mark the file as loaded + $GLOBALS[__FUNCTION__][$ext_name] = true; + } elseif (isDebugModeEnabled()) { + // Log missing file + logDebugMessage(__FUNCTION__, __LINE__, 'Include file ' . $incFileName . ' for extension ' . $ext_name . ' is missing.'); + } + } // END - if +} + // [EOF] ?>