X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Factions%2FInfoAction.php;h=167b7098bdad225102dadd96ead87e6a8ce3e315;hb=c584722cc2e3d33edae58d46c2149063b3fc6d72;hp=be3be85e43acb920dd543d25fe01a180b480a690;hpb=9964ca1a390c446397dcd466916ffed356cdc3c9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index be3be85e43..167b7098bd 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -230,11 +230,11 @@ class InfoAction extends FormlessAction { if ( $title->isRedirect() ) { $pageInfo['header-basic'][] = [ $this->msg( 'pageinfo-redirectsto' ), - Linker::link( $this->page->getRedirectTarget() ) . + $linkRenderer->makeLink( $this->page->getRedirectTarget() ) . $this->msg( 'word-separator' )->escaped() . - $this->msg( 'parentheses' )->rawParams( Linker::link( + $this->msg( 'parentheses' )->rawParams( $linkRenderer->makeLink( $this->page->getRedirectTarget(), - $this->msg( 'pageinfo-redirectsto-info' )->escaped(), + $this->msg( 'pageinfo-redirectsto-info' )->text(), [], [ 'action' => 'info' ] ) )->escaped() @@ -261,28 +261,29 @@ class InfoAction extends FormlessAction { // Language in which the page content is (supposed to be) written $pageLang = $title->getPageLanguage()->getCode(); + $pageLangHtml = $pageLang . ' - ' . + Language::fetchLanguageName( $pageLang, $lang->getCode() ); + // Link to Special:PageLanguage with pre-filled page title if user has permissions if ( $config->get( 'PageLanguageUseDB' ) - && $this->getTitle()->userCan( 'pagelang', $this->getUser() ) + && $title->userCan( 'pagelang', $user ) ) { - // Link to Special:PageLanguage with pre-filled page title if user has permissions - $titleObj = SpecialPage::getTitleFor( 'PageLanguage', $title->getPrefixedText() ); - $langDisp = Linker::link( - $titleObj, - $this->msg( 'pageinfo-language' )->escaped() - ); - } else { - // Display just the message - $langDisp = $this->msg( 'pageinfo-language' )->escaped(); + $pageLangHtml .= ' ' . $this->msg( 'parentheses' )->rawParams( $linkRenderer->makeLink( + SpecialPage::getTitleValueFor( 'PageLanguage', $title->getPrefixedText() ), + $this->msg( 'pageinfo-language-change' )->text() + ) )->escaped(); } - $pageInfo['header-basic'][] = [ $langDisp, - Language::fetchLanguageName( $pageLang, $lang->getCode() ) - . ' ' . $this->msg( 'parentheses', $pageLang )->escaped() ]; + $pageInfo['header-basic'][] = [ + $this->msg( 'pageinfo-language' )->escaped(), + $pageLangHtml + ]; // Content model of the page $modelHtml = htmlspecialchars( ContentHandler::getLocalizedName( $title->getContentModel() ) ); // If the user can change it, add a link to Special:ChangeContentModel - if ( $title->quickUserCan( 'editcontentmodel' ) ) { + if ( $config->get( 'ContentHandlerUseDB' ) + && $title->userCan( 'editcontentmodel', $user ) + ) { $modelHtml .= ' ' . $this->msg( 'parentheses' )->rawParams( $linkRenderer->makeLink( SpecialPage::getTitleValueFor( 'ChangeContentModel', $title->getPrefixedText() ), $this->msg( 'pageinfo-content-model-change' )->text() @@ -360,9 +361,9 @@ class InfoAction extends FormlessAction { // Redirects to this page $whatLinksHere = SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() ); $pageInfo['header-basic'][] = [ - Linker::link( + $linkRenderer->makeLink( $whatLinksHere, - $this->msg( 'pageinfo-redirects-name' )->escaped(), + $this->msg( 'pageinfo-redirects-name' )->text(), [], [ 'hidelinks' => 1, @@ -436,7 +437,7 @@ class InfoAction extends FormlessAction { foreach ( $sources as $sourceTitle ) { $cascadingFrom .= Html::rawElement( - 'li', [], Linker::linkKnown( $sourceTitle ) ); + 'li', [], $linkRenderer->makeKnownLink( $sourceTitle ) ); } $cascadingFrom = Html::rawElement( 'ul', [], $cascadingFrom ); @@ -474,7 +475,7 @@ class InfoAction extends FormlessAction { } $expiry = $title->getRestrictionExpiry( $restrictionType ); $formattedexpiry = $this->msg( 'parentheses', - $this->getLanguage()->formatExpiry( $expiry ) )->escaped(); + $lang->formatExpiry( $expiry ) )->escaped(); $message .= $this->msg( 'word-separator' )->escaped() . $formattedexpiry; // Messages: restriction-edit, restriction-move, restriction-create, @@ -525,9 +526,9 @@ class InfoAction extends FormlessAction { // Date of page creation $pageInfo['header-edits'][] = [ $this->msg( 'pageinfo-firsttime' ), - Linker::linkKnown( + $linkRenderer->makeKnownLink( $title, - htmlspecialchars( $lang->userTimeAndDate( $firstRev->getTimestamp(), $user ) ), + $lang->userTimeAndDate( $firstRev->getTimestamp(), $user ), [], [ 'oldid' => $firstRev->getId() ] ) @@ -544,11 +545,9 @@ class InfoAction extends FormlessAction { // Date of latest edit $pageInfo['header-edits'][] = [ $this->msg( 'pageinfo-lasttime' ), - Linker::linkKnown( + $linkRenderer->makeKnownLink( $title, - htmlspecialchars( - $lang->userTimeAndDate( $this->page->getTimestamp(), $user ) - ), + $lang->userTimeAndDate( $this->page->getTimestamp(), $user ), [], [ 'oldid' => $this->page->getLatest() ] ) @@ -655,9 +654,9 @@ class InfoAction extends FormlessAction { if ( !$config->get( 'MiserMode' ) && $pageCounts['transclusion']['to'] > 0 ) { if ( $pageCounts['transclusion']['to'] > count( $transcludedTargets ) ) { - $more = Linker::link( + $more = $linkRenderer->makeLink( $whatLinksHere, - $this->msg( 'moredotdotdot' )->escaped(), + $this->msg( 'moredotdotdot' )->text(), [], [ 'hidelinks' => 1, 'hideredirs' => 1 ] ); @@ -836,6 +835,7 @@ class InfoAction extends FormlessAction { $real_names = []; $user_names = []; $anon_ips = []; + $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); # Sift for real versus user names /** @var $user User */ @@ -846,11 +846,11 @@ class InfoAction extends FormlessAction { $hiddenPrefs = $this->context->getConfig()->get( 'HiddenPrefs' ); if ( $user->getId() == 0 ) { - $anon_ips[] = Linker::link( $page, htmlspecialchars( $user->getName() ) ); + $anon_ips[] = $linkRenderer->makeLink( $page, $user->getName() ); } elseif ( !in_array( 'realname', $hiddenPrefs ) && $user->getRealName() ) { - $real_names[] = Linker::link( $page, htmlspecialchars( $user->getRealName() ) ); + $real_names[] = $linkRenderer->makeLink( $page, $user->getRealName() ); } else { - $user_names[] = Linker::link( $page, htmlspecialchars( $user->getName() ) ); + $user_names[] = $linkRenderer->makeLink( $page, $user->getName() ); } }