]> git.mxchange.org Git - mailer.git/blobdiff - inc/filter-functions.php
ext-coupon is still unfinished
[mailer.git] / inc / filter-functions.php
index dac79b3107b5ce52f27a08b3de2c510a955667ed..066ca223657ee8ccb5c9d0571ccdbb49e5c8fe6a 100644 (file)
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -104,8 +102,10 @@ ORDER BY
        registerFilter('init', 'INIT_RANDOMIZER');
        registerFilter('init', 'LOAD_RUNTIME_INCLUDES');
        registerFilter('init', 'INIT_EXTENSIONS');
+       registerFilter('init', 'SET_CURRENT_DATE');
        registerFilter('init', 'INIT_RANDOM_NUMBER');
-       registerFilter('init', 'CHECK_SVN_REVISION');
+       registerFilter('init', 'CHECK_REPOSITORY_REVISION');
+       registerFilter('init', 'RUN_HOURLY_RESET');
        registerFilter('init', 'RUN_DAILY_RESET');
        registerFilter('init', 'TRIGGER_SENDING_POOL');
        registerFilter('init', 'DETERMINE_USERNAME');
@@ -159,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');
 
@@ -255,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
@@ -340,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]
 ?>