* API: (bug 17355) Added auwitheditsonly parameter to list=allusers
[lhc/web/wiklou.git] / includes / OutputPage.php
index bdc8a94..b1a0275 100644 (file)
@@ -309,10 +309,7 @@ class OutputPage {
                }
        }
 
-       # "HTML title" means <title>
-       public function setHTMLTitle( $name ) { $this->mHTMLtitle = $name; }
-       
-       # "Page title" means <h1>
+       public function setHTMLTitle( $name ) {$this->mHTMLtitle = $name; }
        public function setPageTitle( $name ) {
                global $action, $wgContLang;
                $name = $wgContLang->convert($name, true);
@@ -323,7 +320,7 @@ class OutputPage {
                                $name .= ' - '.$taction;
                        }
                }
-               
+
                $this->setHTMLTitle( wfMsg( 'pagetitle', $name ) );
        }
        public function getHTMLTitle() { return $this->mHTMLtitle; }
@@ -411,7 +408,12 @@ class OutputPage {
                if ( wfRunHooks( 'OutputPageMakeCategoryLinks', array( &$this, $categories, &$this->mCategoryLinks ) ) ) {
                        $sk = $wgUser->getSkin();
                        foreach ( $categories as $category => $type ) {
+                               $origcategory = $category;
                                $title = Title::makeTitleSafe( NS_CATEGORY, $category );
+                               $wgContLang->findVariantLink( $category, $title, true );
+                               if ( $category != $origcategory )
+                                       if ( array_key_exists( $category, $categories ) )
+                                               continue;
                                $text = $wgContLang->convertHtml( $title->getText() );
                                $this->mCategoryLinks[$type][] = $sk->makeLinkObj( $title, $text );
                        }
@@ -541,11 +543,11 @@ class OutputPage {
                                $this->mTemplateIds[$ns] = $dbks;
                        }
                }
-               // Display title
-               if( ( $displayTitleText = $parserOutput->getDisplayTitle() ) !== false ) {
-                       $this->setPageTitle( $parserOutput->getDisplayTitleH1() );
-                       $this->setHTMLTitle( wfMsg( 'pagetitle', $displayTitleText ) ); #override the HTML that setPageTitle slated for inclusion in the <title>
-               }
+               // Page title
+               if( ( $dt = $parserOutput->getDisplayTitle() ) !== false )
+                       $this->setPageTitle( $dt );
+               else if ( ( $title = $parserOutput->getTitleText() ) != '' )
+                       $this->setPageTitle( $title );
 
                // Hooks registered in the object
                global $wgParserOutputHooks;
@@ -647,6 +649,18 @@ class OutputPage {
                return $parserOutput->getText();
        }
 
+       /** Parse wikitext, strip paragraphs, and return the HTML. */
+       public function parseInline( $text, $linestart = true, $interface = false ) {
+               $parsed = $this->parse( $text, $linestart, $interface );
+
+               $m = array();
+               if ( preg_match( '/^<p>(.*)\n?<\/p>\n?/sU', $parsed, $m ) ) {
+                       $parsed = $m[1];
+               }
+
+               return $parsed;
+       }
+
        /**
         * @param Article $article
         * @param User    $user
@@ -803,13 +817,16 @@ class OutputPage {
         * the object, let's actually output it:
         */
        public function output() {
-               if( $this->mDoNothing ) return;
                global $wgUser, $wgOutputEncoding, $wgRequest;
                global $wgContLanguageCode, $wgDebugRedirects, $wgMimeType;
                global $wgJsMimeType, $wgUseAjax, $wgAjaxWatch;
                global $wgEnableMWSuggest, $wgUniversalEditButton;
                global $wgArticle, $wgTitle;
 
+               if( $this->mDoNothing ){
+                       return;
+               }
+
                wfProfileIn( __METHOD__ );
 
                if ( '' != $this->mRedirect ) {
@@ -1845,7 +1862,7 @@ class OutputPage {
                                $args = array();
                                $name = $spec;
                        }
-                       $s = str_replace( '$' . ($n+1), wfMsgExt( $name, $options, $args ), $s );
+                       $s = str_replace( '$' . ( $n + 1 ), wfMsgExt( $name, $options, $args ), $s );
                }
                $this->addHTML( $this->parse( $s, /*linestart*/true, /*uilang*/true ) );
        }