Merge "Escape message editsection on action=view"
[lhc/web/wiklou.git] / includes / skins / Skin.php
index 999dda8..530338a 100644 (file)
@@ -646,17 +646,17 @@ abstract class Skin extends ContextSource {
 
                return $this->msg( 'retrievedfrom' )
                        ->rawParams( '<a dir="ltr" href="' . $url. '">' . $url . '</a>' )
-                       ->escaped();
+                       ->parse();
        }
 
        /**
-        * @return string
+        * @return string HTML
         */
        function getUndeleteLink() {
                $action = $this->getRequest()->getVal( 'action', 'view' );
 
                if ( $this->getTitle()->userCan( 'deletedhistory', $this->getUser() ) &&
-                       ( $this->getTitle()->getArticleID() == 0 || $action == 'history' ) ) {
+                       ( !$this->getTitle()->exists() || $action == 'history' ) ) {
                        $n = $this->getTitle()->isDeleted();
 
                        if ( $n ) {
@@ -670,7 +670,7 @@ abstract class Skin extends ContextSource {
                                        Linker::linkKnown(
                                                SpecialPage::getTitleFor( 'Undelete', $this->getTitle()->getPrefixedDBkey() ),
                                                $this->msg( 'restorelink' )->numParams( $n )->escaped() )
-                                       )->text();
+                                       )->escaped();
                        }
                }
 
@@ -837,9 +837,12 @@ abstract class Skin extends ContextSource {
        function getPoweredBy() {
                global $wgResourceBasePath;
 
-               $url = htmlspecialchars( "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png" );
-               $text = '<a href="//www.mediawiki.org/"><img src="' . $url
-                       . '" height="31" width="88" alt="Powered by MediaWiki" /></a>';
+               $url1 = htmlspecialchars( "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png" );
+               $url1_5 = htmlspecialchars( "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png" );
+               $url2 = htmlspecialchars( "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png" );
+               $text = '<a href="//www.mediawiki.org/"><img src="' . $url1
+                       . '" srcset="' . $url1_5 . ' 1.5x, ' . $url2 . ' 2x" '
+                       . 'height="31" width="88" alt="Powered by MediaWiki" /></a>';
                Hooks::run( 'SkinGetPoweredBy', array( &$text, $this ) );
                return $text;
        }
@@ -860,7 +863,7 @@ abstract class Skin extends ContextSource {
                if ( $timestamp ) {
                        $d = $this->getLanguage()->userDate( $timestamp, $this->getUser() );
                        $t = $this->getLanguage()->userTime( $timestamp, $this->getUser() );
-                       $s = ' ' . $this->msg( 'lastmodifiedat', $d, $t )->escaped();
+                       $s = ' ' . $this->msg( 'lastmodifiedat', $d, $t )->parse();
                } else {
                        $s = '';
                }
@@ -1163,7 +1166,7 @@ abstract class Skin extends ContextSource {
 
                return array(
                        'href' => $title->getLocalURL( $urlaction ),
-                       'exists' => $title->getArticleID() != 0,
+                       'exists' => $title->isKnown(),
                );
        }
 
@@ -1581,18 +1584,40 @@ abstract class Skin extends ContextSource {
                        $attribs['title'] = wfMessage( 'editsectionhint' )->rawParams( $tooltip )
                                ->inLanguage( $lang )->text();
                }
-               $link = Linker::link( $nt, wfMessage( 'editsection' )->inLanguage( $lang )->text(),
-                       $attribs,
-                       array( 'action' => 'edit', 'section' => $section ),
-                       array( 'noclasses', 'known' )
+
+               $links = array(
+                       'editsection' => array(
+                               'text' => wfMessage( 'editsection' )->inLanguage( $lang )->escaped(),
+                               'targetTitle' => $nt,
+                               'attribs' => $attribs,
+                               'query' => array( 'action' => 'edit', 'section' => $section ),
+                               'options' => array( 'noclasses', 'known' )
+                       )
+               );
+
+               Hooks::run( 'SkinEditSectionLinks', array( $this, $nt, $section, $tooltip, &$links, $lang ) );
+
+               $result = '<span class="mw-editsection"><span class="mw-editsection-bracket">[</span>';
+
+               $linksHtml = array();
+               foreach ( $links as $k => $linkDetails ) {
+                       $linksHtml[] = Linker::link(
+                               $linkDetails['targetTitle'],
+                               $linkDetails['text'],
+                               $linkDetails['attribs'],
+                               $linkDetails['query'],
+                               $linkDetails['options']
+                       );
+               }
+
+               $result .= implode(
+                       '<span class="mw-editsection-divider">'
+                               . wfMessage( 'pipe-separator' )->inLanguage( $lang )->text()
+                               . '</span>',
+                       $linksHtml
                );
 
-               # Add the brackets and the span and run the hook.
-               $result = '<span class="mw-editsection">'
-                       . '<span class="mw-editsection-bracket">[</span>'
-                       . $link
-                       . '<span class="mw-editsection-bracket">]</span>'
-                       . '</span>';
+               $result .= '<span class="mw-editsection-bracket">]</span></span>';
 
                Hooks::run( 'DoEditSectionLink', array( $this, $nt, $section, $tooltip, &$result, $lang ) );
                return $result;