* Add globalusage link to the file toc
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Sun, 8 Nov 2009 11:09:20 +0000 (11:09 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Sun, 8 Nov 2009 11:09:20 +0000 (11:09 +0000)
* Add thumb of the file to Special:GlobalUsage

docs/hooks.txt
includes/ImagePage.php

index a139a8e..f184b47 100644 (file)
@@ -849,6 +849,10 @@ $page: ImagePage object
 &$file: File object
 &$displayFile: displayed File object
 
+'ImagePageShowTOC': called when the file toc on an image page is generated
+$page: ImagePage object
+&$toc: Array of <li> strings
+
 'ImgAuthBeforeStream': executed before file is streamed to user, but only when
        using img_auth.php
 &$title: the Title object of the file as it would appear for the upload page
index c42c736..0401e1d 100644 (file)
@@ -230,14 +230,18 @@ class ImagePage extends Article {
         * @return string
         */
        protected function showTOC( $metadata ) {
-               global $wgLang;
-               $r = '<ul id="filetoc">
-                       <li><a href="#file">' . wfMsgHtml( 'file-anchor-link' ) . '</a></li>
-                       <li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li>
-                       <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . "</a></li>\n" .
-                       ($metadata ? '                  <li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . "
-                       </ul>\n";
-               return $r;
+               $r = array(
+                               '<li><a href="#file">' . wfMsgHtml( 'file-anchor-link' ) . '</a></li>',
+                               '<li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li>',
+                               '<li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>', 
+               );
+               if ( $metadata ) {
+                       $r[] = '<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>';
+               }
+       
+               wfRunHooks( 'ImagePageShowTOC', array( $this, &$r ) );
+               
+               return '<ul id="filetoc">' . implode( "\n", $r ) . '</ul>';
        }
 
        /**