X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fblock%2FAbstractBlock.php;h=d24a2a5773791b5f1bb0b884fabac304a1a4e8ce;hb=04d1aa3033f40a38d721f7f0e88b5bac440d2869;hp=fb49dfcf7245b76521aae25720f27bf152158ea8;hpb=e15e67f25afd78d586e2a62aa63384c34556f2b9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/block/AbstractBlock.php b/includes/block/AbstractBlock.php index fb49dfcf72..d24a2a5773 100644 --- a/includes/block/AbstractBlock.php +++ b/includes/block/AbstractBlock.php @@ -84,7 +84,7 @@ abstract class AbstractBlock { * timestamp string The time at which the block comes into effect * byText string Username of the blocker (for foreign users) */ - function __construct( $options = [] ) { + public function __construct( array $options = [] ) { $defaults = [ 'address' => '', 'by' => null, @@ -513,10 +513,13 @@ abstract class AbstractBlock { * @return array */ public function getBlockErrorParams( IContextSource $context ) { + $lang = $context->getLanguage(); + $blocker = $this->getBlocker(); if ( $blocker instanceof User ) { // local user $blockerUserpage = $blocker->getUserPage(); - $link = "[[{$blockerUserpage->getPrefixedText()}|{$blockerUserpage->getText()}]]"; + $blockerText = $lang->embedBidi( $blockerUserpage->getText() ); + $link = "[[{$blockerUserpage->getPrefixedText()}|{$blockerText}]]"; } else { // foreign user $link = $blocker; } @@ -528,19 +531,18 @@ abstract class AbstractBlock { /* $ip returns who *is* being blocked, $intended contains who was meant to be blocked. * This could be a username, an IP range, or a single IP. */ - $intended = $this->getTarget(); - $lang = $context->getLanguage(); + $intended = (string)$this->getTarget(); return [ $link, $reason, $context->getRequest()->getIP(), - $this->getByName(), + $lang->embedBidi( $this->getByName() ), // TODO: SystemBlock replaces this with the system block type. Clean up // error params so that this is not necessary. $this->getId(), $lang->formatExpiry( $this->getExpiry() ), - (string)$intended, + $lang->embedBidi( $intended ), $lang->userTimeAndDate( $this->getTimestamp(), $context->getUser() ), ]; } @@ -655,10 +657,13 @@ abstract class AbstractBlock { * Check if the block should be tracked with a cookie. * * @since 1.33 + * @deprecated since 1.34 Use BlockManager::trackBlockWithCookie instead + * of calling this directly. * @param bool $isAnon The user is logged out * @return bool The block should be tracked with a cookie */ public function shouldTrackWithCookie( $isAnon ) { + wfDeprecated( __METHOD__, '1.34' ); return false; }