]> git.mxchange.org Git - mailer.git/commitdiff
New filters introduced for page header, obsolete template removed:
authorRoland Häder <roland@mxchange.org>
Thu, 14 Jan 2010 20:09:03 +0000 (20:09 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 14 Jan 2010 20:09:03 +0000 (20:09 +0000)
- New filters 'pre_page_header' and 'post_page_header' introduced to let
  extensions add their own JavaScript inclusions.
- The HTML template 'header.tpl' is now no longer needed

.gitattributes
inc/filter-functions.php
inc/filters.php
inc/functions.php
templates/de/html/header.tpl [deleted file]

index 00ddc0e1b9634b01399aefede4c39813cdabe86b..8befaa27d5df4163314008e48e793db2d613a367 100644 (file)
@@ -1421,7 +1421,6 @@ templates/de/html/guest/guest_top10_empty5.tpl -text
 templates/de/html/guest/guest_top10_row_earner.tpl -text
 templates/de/html/guest/guest_top10_row_login.tpl -text
 templates/de/html/guest/guest_top10_row_refs.tpl -text
-templates/de/html/header.tpl -text
 templates/de/html/impressum.tpl -text
 templates/de/html/index.tpl -text
 templates/de/html/index_forward.tpl -text
index 046ea8ad25700e52710bf3ef4e43dbec6688aaf7..82747fef797677782a26230abab3c6528210e5a2 100644 (file)
@@ -114,6 +114,14 @@ ORDER BY
        registerFilter('init', 'UPDATE_LOGIN_DATA');
        registerFilter('init', 'ACTIVATE_EXCHANGE');
 
+       // Page headers - pre-filter (normally, you want to register here)
+       registerFilter('pre_page_header', 'LOAD_PAGE_HEADER');
+
+       // Page headers - post-filter (normally, you don't want to register here)
+       // ------------------- LAST FILTER FOR THIS CHAIN! ------------------------
+       registerFilter('post_page_header', 'FINISH_PAGE_HEADER');
+       // ------------------- LAST FILTER FOR THIS CHAIN! ------------------------
+
        // Login failures handler
        registerFilter('post_youhere_line', 'CALL_HANDLER_LOGIN_FAILTURES');
 
index 5fc55a51361826fab208b52ef6caa7960ebb22b4..8636a3813b31c1e3470c8778971405520de60d5f 100644 (file)
@@ -933,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]
 ?>
+
index da1d2508a2afe7707f4165b829c49018f4159201..c1293681cef302da6f78545014bd5c7152985f6e 100644 (file)
@@ -3792,32 +3792,18 @@ function isSpider () {
 
 // Prepares the header for HTML output
 function loadHtmlHeader () {
-       // Determine the page title
-       $content['header_title'] = determinePageTitle();
+       // Run two filters:
+       // 1.) pre_page_header (mainly loads the page_header template and includes
+       //     meta description)
+       runFilterChain('pre_page_header');
 
-       // 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
+       // Here can be something be added, but normally one of the two filters
+       // around this line should do the job for you.
 
+       // 2.) post_page_header (mainly to load stylesheet, extra JavaScripts and
+       //     to close the head-tag)
        // Include more header data here
-       $GLOBALS['page_header'] .= loadTemplate('header', true);
-
-       // Include stylesheet
-       loadIncludeOnce('inc/stylesheet.php');
-
-       // Closing HEAD tag
-       $GLOBALS['page_header'] .= '</head>';
+       runFilterChain('post_page_header');
 }
 
 // Adds page header and footer to output array element
diff --git a/templates/de/html/header.tpl b/templates/de/html/header.tpl
deleted file mode 100644 (file)
index e69de29..0000000