New filters introduced for page header, obsolete template removed:
[mailer.git] / inc / filters.php
index 9345e507e282ea4e641be0549a26c8a6bee76cad..8636a3813b31c1e3470c8778971405520de60d5f 100644 (file)
@@ -18,6 +18,7 @@
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -450,7 +451,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
        preg_match_all('/\{%(([a-zA-Z0-9-_,]+)(=([^\}]+)){0,1})*%\}/', $code, $matches);
        //* DEBUG: */ print('<pre>'.print_r($matches, true).'</pre>');
 
-       // Default is from OUTPUT_HTML
+       // Default is from outputHtml()
        $outputMode = getOutputMode();
 
        // Some entries found?
@@ -475,11 +476,12 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
                        if (function_exists($commandFunction)) {
                                // Prepare $matches, $key, $outputMode, etc.
                                $data = array(
-                                       'matches'  => $matches,
-                                       'key'      => $key,
-                                       'mode'     => $outputMode,
-                                       'code'     => $code,
-                                       'callback' => $callback
+                                       'matches'    => $matches,
+                                       'key'        => $key,
+                                       'mode'       => $outputMode,
+                                       'code'       => $code,
+                                       'callback'   => $callback,
+                                       'extra_func' => $extraFunction
                                );
 
                                // Call it
@@ -533,24 +535,24 @@ function FILTER_RUN_RESET_INCLUDES () {
                $currWeek = date('W', time());
 
                // Has it changed?
-               if ((getConfig('last_week') != $currWeek) || (getConfig('DEBUG_WEEKLY') == 'Y')) {
+               if ((getConfig('last_week') != $currWeek) || ((isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') == 'Y'))) {
                        // Include weekly reset scripts
                        mergeIncludePool('reset', getArrayFromDirectory('inc/weekly/', 'weekly_'));
 
                        // Update config
-                       if ((isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') != 'Y')) updateConfiguration('last_week', $currWeek);
+                       if ((!isConfigEntrySet('DEBUG_WEEKLY')) || (getConfig('DEBUG_WEEKLY') != 'Y')) updateConfiguration('last_week', $currWeek);
                } // END - if
 
                // Create current month mark
                $currMonth = date('m', time());
 
                // Has it changed?
-               if ((getConfig('last_month') != $currMonth) || (getConfig('DEBUG_MONTHLY') == 'Y')) {
+               if ((getConfig('last_month') != $currMonth) || ((isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') == 'Y'))) {
                        // Include monthly reset scripts
                        mergeIncludePool('reset', getArrayFromDirectory('inc/monthly/', 'monthly_'));
 
                        // Update config
-                       if ((isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') != 'Y')) updateConfiguration('last_month', $currMonth);
+                       if ((!isConfigEntrySet('DEBUG_MONTHLY')) || (getConfig('DEBUG_MONTHLY') != 'Y')) updateConfiguration('last_month', $currMonth);
                } // END - if
        } // END - if
 
@@ -931,5 +933,36 @@ function FILTER_DO_LOGIN_ADMIN ($data) {
        return $data;
 }
 
+// Filter for loading page header, this should be ran first!
+function FILTER_LOAD_PAGE_HEADER () {
+       // Determine the page title
+       $content['header_title'] = determinePageTitle();
+
+       // Output page header code
+       $GLOBALS['page_header'] = loadTemplate('page_header', true, $content);
+
+       // Include meta data in 'guest' module
+       if (getModule() == 'index') {
+               // Load meta data template
+               $GLOBALS['page_header'] .= loadTemplate('metadata', true);
+
+               // Add meta description to header
+               if ((isInstalled()) && (isAdminRegistered()) && (SQL_IS_LINK_UP())) {
+                       // Add meta description not in admin and login module and when the script is installed
+                       generateMetaDescriptionCode();
+               } // END - if
+       } // END - if
+}
+
+// Filter for adding style sheet, closing page header
+function FILTER_FINISH_PAGE_HEADER () {
+       // Include stylesheet
+       loadIncludeOnce('inc/stylesheet.php');
+
+       // Closing HEAD tag
+       $GLOBALS['page_header'] .= '</head>';
+}
+
 // [EOF]
 ?>
+