(bug5077) added BeforePageDisplay hook
authorJens Frank <jeluf@users.mediawiki.org>
Sat, 27 May 2006 08:23:05 +0000 (08:23 +0000)
committerJens Frank <jeluf@users.mediawiki.org>
Sat, 27 May 2006 08:23:05 +0000 (08:23 +0000)
RELEASE-NOTES
docs/hooks.txt
includes/SkinTemplate.php

index 797439c..3cbb670 100644 (file)
@@ -357,6 +357,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   &#61; when making URLs for template parameters.
 * Markup anality: escape </ as <\/ in toolbar javascript for pure correctness
   under HTML-compatible browsers.
+* (bug 5077) Added hook 'BeforePageDisplay' to SkinTemplate::outputPage
 
 
 == Compatibility ==
index b2ee82a..ec8ce7f 100644 (file)
@@ -462,6 +462,10 @@ $catpage: CategoryPage instance
                              to use this hook.
 $content_actions: The array of content actions
 
+'BeforePageDisplay': Called just before outputting a page (all kinds of,
+                    articles, special, history, preview, diff, edit, ...)
+                    Can be used to set custom CSS/JS
+$out: OutputPage object
 
 More hooks might be available but undocumented, you can execute
 ./maintenance/findhooks.php to find hidden one.
index afed9e7..f054153 100644 (file)
@@ -145,6 +145,10 @@ class SkinTemplate extends Skin {
                $fname = 'SkinTemplate::outputPage';
                wfProfileIn( $fname );
 
+               // Hook that allows last minute changes to the output page, e.g.
+               // adding of CSS or Javascript by extensions.
+               wfRunHooks( 'BeforePageDisplay', array( &$out ) );
+
                extract( $wgRequest->getValues( 'oldid', 'diff' ) );
 
                wfProfileIn( "$fname-init" );