X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=languages%2FLanguage.php;h=0531c1fc90638963096603ea2a1990ab6f2b8b37;hb=76f55843776b9a9972d5412849e3c3699bc5c2d4;hp=aa287e926ab6ea154682ab5db8f3916331a98858;hpb=d4cc4f2b4f20725725a9345c7a4b7906e5aa66d2;p=lhc%2Fweb%2Fwiklou.git diff --git a/languages/Language.php b/languages/Language.php index aa287e926a..0531c1fc90 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -245,7 +245,7 @@ class Language { // It's not possible to customise this code with class files, so // just return a Language object. This is to support uselang= hacks. $lang = new Language; - $lang->setCode( $code ); + $lang->mCode = $code; return $lang; } @@ -267,7 +267,7 @@ class Language { $class = self::classFromCode( $fallbackCode ); if ( class_exists( $class ) ) { $lang = new $class; - $lang->setCode( $code ); + $lang->mCode = $code; return $lang; } } @@ -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; } @@ -4241,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 ) ); } /** @@ -4453,6 +4449,7 @@ class Language { * @deprecated since 1.32, use Language::factory to create a new object instead. */ public function setCode( $code ) { + wfDeprecated( __METHOD__, '1.32' ); $this->mCode = $code; // Ensure we don't leave incorrect cached data lying around $this->mHtmlCode = null;