]> git.mxchange.org Git - mailer.git/blobdiff - inc/filter-functions.php
Updated copyright notice as there are changes in this year
[mailer.git] / inc / filter-functions.php
index c75f48417eda2ff8170a372b6b188a324921d019..a9ea5430ea5b5387b7bdc9a3d9ce8c9fa90077e6 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -113,7 +113,10 @@ ORDER BY
        registerFilter(__FUNCTION__, __LINE__, 'init', 'CHECK_REPOSITORY_REVISION');
        registerFilter(__FUNCTION__, __LINE__, 'init', 'RUN_HOURLY_RESET');
        registerFilter(__FUNCTION__, __LINE__, 'init', 'RUN_DAILY_RESET');
+       registerFilter(__FUNCTION__, __LINE__, 'init', 'RUN_WEEKLY_RESET');
+       registerFilter(__FUNCTION__, __LINE__, 'init', 'RUN_MONTHLY_RESET');
        registerFilter(__FUNCTION__, __LINE__, 'init', 'TRIGGER_SENDING_POOL');
+       // @TODO Remove this forced removal after a year or so
        unregisterFilter(__FUNCTION__, __LINE__, 'init', 'DETERMINE_USERNAME', TRUE);
        registerFilter(__FUNCTION__, __LINE__, 'init', 'DETERMINE_WHAT_ACTION');
        registerFilter(__FUNCTION__, __LINE__, 'init', 'COUNT_MODULE');
@@ -174,8 +177,14 @@ ORDER BY
        // Do hourly reset stuff, keep this entry first in this chain:
        registerFilter(__FUNCTION__, __LINE__, 'hourly', 'RUN_HOURLY_INCLUDES');
 
-       // Do reset stuff, keep this entry first in this chain:
-       registerFilter(__FUNCTION__, __LINE__, 'reset', 'RUN_RESET_INCLUDES');
+       // Do daily stuff, keep this entry first in this chain:
+       registerFilter(__FUNCTION__, __LINE__, 'daily', 'RUN_DAILY_INCLUDES');
+
+       // Do weekly stuff, keep this entry first in this chain:
+       registerFilter(__FUNCTION__, __LINE__, 'weekly', 'RUN_WEEKLY_INCLUDES');
+
+       // Do monthly stuff, keep this entry first in this chain:
+       registerFilter(__FUNCTION__, __LINE__, 'monthly', 'RUN_MONTHLY_INCLUDES');
 
        // Remove extension
        registerFilter(__FUNCTION__, __LINE__, 'extension_remove', 'REMOVE_EXTENSION');
@@ -217,7 +226,7 @@ function registerFilter ($F, $L, $filterName, $filterFunction, $silentAbort = TR
        $filterFunction = 'FILTER_' . strtoupper($filterFunction);
 
        // Debug message with FILTER_ prefix
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',F=' . basename($F) . ',L=' . $L . ' - ENTERED!');
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ',F=' . basename($F) . ',L=' . $L . ' - ENTERED!');
 
        // Is that filter already there?
        if ((isset($GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction])) && ($force === FALSE)) {
@@ -236,7 +245,7 @@ function registerFilter ($F, $L, $filterName, $filterFunction, $silentAbort = TR
                // Is the function there?
                if (!function_exists($filterFunction)) {
                        // Then abort here
-                       addFatalMessage(__FUNCTION__, __LINE__, sprintf("Filter function %s could not be added to filter chain %s. F=%s,L=%s,force=%d", $filterFunction, $filterName, basename($F), $L, intval($force)));
+                       logDebugMessage(__FUNCTION__, __LINE__, sprintf("Filter function %s could not be added to filter chain %s. F=%s,L=%s,force=%d", $filterFunction, $filterName, basename($F), $L, intval($force)));
                        return FALSE;
                } // END - if
 
@@ -246,7 +255,10 @@ function registerFilter ($F, $L, $filterName, $filterFunction, $silentAbort = TR
                $GLOBALS['cache_array']['filter']['counter'][$filterName][$filterFunction] = '0';
        } // END - if
 
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',F=' . basename($F) . ',L=' . $L . ' - EXIT!');
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ',F=' . basename($F) . ',L=' . $L . ' - EXIT!');
+
+       // Worked
+       return TRUE;
 }
 
 // "Unregisters" a filter from the given chain
@@ -261,7 +273,7 @@ function unregisterFilter ($F, $L, $filterName, $filterFunction, $force = FALSE,
        // Is that filter there?
        if ((!isset($GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction])) && ($force === FALSE)) {
                // Not found, so abort here
-               addFatalMessage(__FUNCTION__, __LINE__, sprintf(getMessage('FILTER_FAILED_NOT_REMOVED'), $filterFunction, $filterName));
+               logDebugMessage(__FUNCTION__, __LINE__, sprintf('Filter function %s cannot be unregistered from filter %s.', $filterFunction, $filterName));
                return FALSE;
        } // END - if
 
@@ -273,6 +285,9 @@ function unregisterFilter ($F, $L, $filterName, $filterFunction, $force = FALSE,
        } // END - if
 
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ' - EXIT!');
+
+       // Worked
+       return TRUE;
 }
 
 // "Runs" the given filters, filterData is optional and can be any type of data
@@ -309,7 +324,7 @@ function runFilterChain ($filterName, $filterData = NULL) {
                        } // END - if
 
                        // Call the filter chain
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $filterName . '/' . $filterFunction . ',[]=' . gettype($returnValue));
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $filterName . '/' . $filterFunction . ',[]=' . gettype($returnValue) . ' - CALLING!');
                        $returnValue = call_user_func_array($filterFunction, array($returnValue));
 
                        // Update usage counter