X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=languages%2FLanguage.php;h=ef9137dc3741025945386788f9eecbb8c984b736;hb=d1c808c3615e0be250890359da12aabc14b08733;hp=86f4505cc41c7c2bdd23e37a547aa05523026fa2;hpb=0f81b58eece352aa867c61b0dfd7bd256ab6208b;p=lhc%2Fweb%2Fwiklou.git diff --git a/languages/Language.php b/languages/Language.php index 86f4505cc4..ef9137dc37 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -58,7 +58,7 @@ class Language { public $mConverter; public $mVariants, $mCode, $mLoaded = false; - public $mMagicExtensions = [], $mMagicHookDone = false; + public $mMagicExtensions = []; private $mHtmlCode = null, $mParentLanguage = false; public $dateFormatStrings = []; @@ -1421,7 +1421,7 @@ class Language { case 'g': $usedHour = true; $h = substr( $ts, 8, 2 ); - $num = $h % 12 ? $h % 12 : 12; + $num = $h % 12 ?: 12; break; case 'G': $usedHour = true; @@ -1430,7 +1430,7 @@ class Language { case 'h': $usedHour = true; $h = substr( $ts, 8, 2 ); - $num = sprintf( '%02d', $h % 12 ? $h % 12 : 12 ); + $num = sprintf( '%02d', $h % 12 ?: 12 ); break; case 'H': $usedHour = true; @@ -1833,22 +1833,19 @@ class Language { while ( $hebrewMonth <= 12 ) { # Calculate days in this month if ( $isLeap && $hebrewMonth == 6 ) { - # Adar in a leap year - if ( $isLeap ) { - # Leap year - has Adar I, with 30 days, and Adar II, with 29 days - $days = 30; + # Leap year - has Adar I, with 30 days, and Adar II, with 29 days + $days = 30; + if ( $hebrewDay <= $days ) { + # Day in Adar I + $hebrewMonth = 13; + } else { + # Subtract the days of Adar I + $hebrewDay -= $days; + # Try Adar II + $days = 29; if ( $hebrewDay <= $days ) { - # Day in Adar I - $hebrewMonth = 13; - } else { - # Subtract the days of Adar I - $hebrewDay -= $days; - # Try Adar II - $days = 29; - if ( $hebrewDay <= $days ) { - # Day in Adar II - $hebrewMonth = 14; - } + # Day in Adar II + $hebrewMonth = 14; } } } elseif ( $hebrewMonth == 2 && $yearPattern == 2 ) { @@ -2192,7 +2189,7 @@ class Language { } # No difference ? Return time unchanged - if ( 0 == $minDiff ) { + if ( $minDiff == 0 ) { return $ts; } @@ -3205,28 +3202,12 @@ class Language { return self::$dataCache->getItem( $this->mCode, 'magicWords' ); } - /** - * Run the LanguageGetMagic hook once. - */ - protected function doMagicHook() { - if ( $this->mMagicHookDone ) { - return; - } - $this->mMagicHookDone = true; - Hooks::run( 'LanguageGetMagic', [ &$this->mMagicExtensions, $this->getCode() ], '1.16' ); - } - /** * Fill a MagicWord object with data from here * * @param MagicWord $mw */ function getMagic( $mw ) { - // Saves a function call - if ( !$this->mMagicHookDone ) { - $this->doMagicHook(); - } - $rawEntry = $this->mMagicExtensions[$mw->mId] ?? self::$dataCache->getSubitem( $this->mCode, 'magicWords', $mw->mId ); @@ -3264,8 +3245,6 @@ class Language { // Initialise array $this->mExtendedSpecialPageAliases = self::$dataCache->getItem( $this->mCode, 'specialPageAliases' ); - Hooks::run( 'LanguageGetSpecialPageAliases', - [ &$this->mExtendedSpecialPageAliases, $this->getCode() ], '1.16' ); } return $this->mExtendedSpecialPageAliases; @@ -4259,12 +4238,11 @@ class Language { /** * Perform output conversion on a string, and encode for safe HTML output. * @param string $text Text to be converted - * @param bool $isTitle Whether this conversion is for the article title * @return string * @todo this should get integrated somewhere sane */ - public function convertHtml( $text, $isTitle = false ) { - return htmlspecialchars( $this->convert( $text, $isTitle ) ); + public function convertHtml( $text ) { + return htmlspecialchars( $this->convert( $text ) ); } /**