Merge "Add a class to interlanguage links"
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index c50ca75..414312a 100644 (file)
@@ -156,10 +156,17 @@ class SkinTemplate extends Skin {
                                        // otherwise we'll end up with the autonym again.
                                        $ilLangLocalName = Language::fetchLanguageName( $ilInterwikiCode, $userLang->getCode() );
 
+                                       if ( $languageLinkTitle->getText() === '' ) {
+                                               $ilTitle = wfMessage( 'interlanguage-link-title-langonly', $ilLangLocalName )->text();
+                                       } else {
+                                               $ilTitle = wfMessage( 'interlanguage-link-title', $languageLinkTitle->getText(),
+                                                       $ilLangLocalName )->text();
+                                       }
+
                                        $language_urls[] = array(
                                                'href' => $languageLinkTitle->getFullURL(),
                                                'text' => $ilLangName,
-                                               'title' => wfMessage( 'interlanguage-link-title', $languageLinkTitle->getText(), $ilLangLocalName )->text(),
+                                               'title' => $ilTitle,
                                                'class' => $class,
                                                'lang' => wfBCP47( $ilInterwikiCode ),
                                                'hreflang' => wfBCP47( $ilInterwikiCode ),
@@ -245,6 +252,8 @@ class SkinTemplate extends Skin {
                if ( $oldContext ) {
                        $this->setContext( $oldContext );
                }
+
+               wfProfileOut( __METHOD__ );
        }
 
        /**
@@ -739,7 +748,7 @@ class SkinTemplate extends Skin {
                        $personal_urls[$login_id] = $login_url;
                }
 
-               wfRunHooks( 'PersonalUrls', array( &$personal_urls, &$title ) );
+               wfRunHooks( 'PersonalUrls', array( &$personal_urls, &$title, $this ) );
                wfProfileOut( __METHOD__ );
                return $personal_urls;
        }
@@ -1448,6 +1457,20 @@ abstract class QuickTemplate {
        public function getSkin() {
                return $this->data['skin'];
        }
+
+       /**
+        * Fetch the output of a QuickTemplate and return it
+        *
+        * @since 1.23
+        * @return String
+        */
+       public function getHTML() {
+               ob_start();
+               $this->execute();
+               $html = ob_get_contents();
+               ob_end_clean();
+               return $html;
+       }
 }
 
 /**