Cleanup
[lhc/web/wiklou.git] / includes / Linker.php
index ea74fa5..105e24b 100644 (file)
@@ -344,9 +344,9 @@ class Linker {
                if( $nt->getNamespace() == NS_SPECIAL ) {
                        $q = $query;
                } else if ( '' == $query ) {
-                       $q = 'action=editredlink';
+                       $q = 'action=edit&redlink=1';
                } else {
-                       $q = 'action=editredlink&'.$query;
+                       $q = 'action=edit&redlink=1&'.$query;
                }
                $u = $nt->escapeLocalURL( $q );
 
@@ -496,7 +496,9 @@ class Linker {
        }
 
        /**
-        * Make an image link
+        * Given parameters derived from [[Image:Foo|options...]], generate the
+        * HTML that that syntax inserts in the page.
+        *
         * @param Title $title Title object
         * @param File $file File object, or false if it doesn't exist
         *
@@ -519,8 +521,15 @@ class Linker {
         * @param array $handlerParams Associative array of media handler parameters, to be passed 
         *       to transform(). Typical keys are "width" and "page". 
         * @param string $time, timestamp of the file, set as false for current
+        * @return string HTML for an image, with links, wrappers, etc.
         */
        function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false ) {
+               $res = null;
+               if( !wfRunHooks( 'ImageBeforeProduceHTML', array( &$this, &$title,
+               &$file, &$frameParams, &$handlerParams, &$time, &$res ) ) ) {
+                       return $res;
+               }
+
                global $wgContLang, $wgUser, $wgThumbLimits, $wgThumbUpright;
                if ( $file && !$file->allowInlineDisplay() ) {
                        wfDebug( __METHOD__.': '.$title->getPrefixedDBkey()." does not allow inline display\n" );
@@ -1359,7 +1368,36 @@ class Linker {
                wfProfileOut( __METHOD__  );
                return $outText;
        }
-       
+
+       /**
+        * Returns HTML for the "hidden categories on this page" list.
+        *
+        * @param array $hiddencats Array of hidden categories from Article::getHiddenCategories
+        * or similar
+        * @return string HTML output
+        */
+       public function formatHiddenCategories( $hiddencats) {
+               global $wgUser, $wgLang;
+               wfProfileIn( __METHOD__ );
+
+               $sk = $wgUser->getSkin();
+
+               $outText = '';
+               if ( count( $hiddencats ) > 0 ) {
+                       # Construct the HTML
+                       $outText = '<div class="mw-hiddenCategoriesExplanation">';
+                       $outText .= wfMsgExt( 'hiddencategories', array( 'parse' ), $wgLang->formatnum( count( $hiddencats ) ) );
+                       $outText .= '</div><ul>';
+
+                       foreach ( $hiddencats as $titleObj ) {
+                               $outText .= '<li>' . $sk->makeKnownLinkObj( $titleObj ) . '</li>'; # If it's hidden, it must exist - no need to check with a LinkBatch
+                       }
+                       $outText .= '</ul>';
+               }
+               wfProfileOut( __METHOD__  );
+               return $outText;
+       }
+
        /**
         * Format a size in bytes for output, using an appropriate
         * unit (B, KB, MB or GB) according to the magnitude in question