/**
* Parse the Accept-Language header sent by the client into an array
- * @return array( languageCode => q-value ) sorted by q-value in descending order
+ * @return array array( languageCode => q-value ) sorted by q-value in descending order
* May contain the "language" '*', which applies to languages other than those explicitly listed.
* This is aligned with rfc2616 section 14.4
*/
/**
* Includes language class files
*
- * @param $class Name of the language class
+ * @param $class string Name of the language class
*/
public static function preloadLanguageClass( $class ) {
global $IP;
}
// Days passed in current month
- $gDayNo += $gd;
+ $gDayNo += (int)$gd;
$jDayNo = $gDayNo - 79;
$s = '';
for ( $pow10 = 1000, $i = 3; $i >= 0; $pow10 /= 10, $i-- ) {
if ( $num >= $pow10 ) {
- $s .= $table[$i][floor( $num / $pow10 )];
+ $s .= $table[$i][(int)floor( $num / $pow10 )];
}
$num = $num % $pow10;
}
* truncateHtml() helper function
* (a) push or pop $tag from $openTags as needed
* (b) clear $tag value
- * @param String &$tag Current HTML tag name we are looking at
- * @param int $tagType (0-open tag, 1-close tag)
- * @param char $lastCh Character before the '>' that ended this tag
- * @param array &$openTags Open tag stack (not accounting for $tag)
+ * @param &$tag string Current HTML tag name we are looking at
+ * @param $tagType int (0-open tag, 1-close tag)
+ * @param $lastCh char|string Character before the '>' that ended this tag
+ * @param &$openTags array Open tag stack (not accounting for $tag)
*/
private function truncate_endBracket( &$tag, $tagType, $lastCh, &$openTags ) {
$tag = ltrim( $tag );
if ( $bps <= 0 ) {
return $this->formatNum( $bps ) . $units[0];
}
- $unitIndex = floor( log10( $bps ) / 3 );
+ $unitIndex = (int)floor( log10( $bps ) / 3 );
$mantissa = $bps / pow( 1000, $unitIndex );
if ( $mantissa < 10 ) {
$mantissa = round( $mantissa, 1 );
* in this case. Right now this is only used by zh.
*
* @param $variant String: the language code of the variant
- * @return String: The code of the fallback language or the
+ * @return String|array: The code of the fallback language or the
* main code if there is no fallback
*/
public function getVariantFallbacks( $variant ) {
$sourceBlob .= substr( $text, $startPos, $elementPos - $startPos ) . "\000";
// Advance to the next position
- $startPos = $elementPos + strlen( $element );
+ $startPos = $elementPos + strlen( $element );
// Translate any alt or title attributes inside the matched element
- if ( $element !== '' && preg_match( '/^(<[^>\s]*)\s([^>]*)(.*)$/', $element,
- $elementMatches ) )
+ if ( $element !== '' && preg_match( '/^(<[^>\s]*)\s([^>]*)(.*)$/', $element,
+ $elementMatches ) )
{
$attrs = Sanitizer::decodeTagAttributes( $elementMatches[2] );
$changed = false;
if ( !strpos( $attr, '://' ) ) {
$attr = $this->translate( $attr, $toVariant );
}
-
+
// Remove HTML tags to avoid disrupting the layout
$attr = preg_replace( '/<[^>]+>/', '', $attr );
if ( $attr !== $attrs[$attrName] ) {
}
}
if ( $changed ) {
- $element = $elementMatches[1] . Html::expandAttributes( $attrs ) .
+ $element = $elementMatches[1] . Html::expandAttributes( $attrs ) .
$elementMatches[3];
}
}
* Conversion script between Latin and Syllabics for Inuktitut.
* - Syllabics -> lowercase Latin
* - lowercase/uppercase Latin -> Syllabics
-*
+*
*
* Based on:
* - http://commons.wikimedia.org/wiki/Image:Inuktitut.png
*
*/
class IuConverter extends LanguageConverter {
+
+ protected $mDoContentConvert;
var $mToLatin = array(
'ᐦ' => 'h', 'ᐃ' => 'i', 'ᐄ' => 'ii', 'ᐅ' => 'u', 'ᐆ' => 'uu', 'ᐊ' => 'a', 'ᐋ' => 'aa',
'ᑉ' => 'p', 'ᐱ' => 'pi', 'ᐲ' => 'pii', 'ᐳ' => 'pu', 'ᐴ' => 'puu', 'ᐸ' => 'pa', 'ᐹ' => 'paa',
* @return string
*/
function parserConvert( $text, &$parser ) {
- if ( is_object( $parser->getTitle() ) && $parser->getTitle()->isTalkPage() )
- $this->mDoContentConvert = false;
- else
- $this->mDoContentConvert = true;
+ $this->mDoContentConvert = !( is_object( $parser->getTitle() ) && $parser->getTitle()->isTalkPage() );
return parent::parserConvert( $text, $parser );
}
* @ingroup Language
*/
class LanguageQqx extends Language {
+ /**
+ * @param $key string
+ * @return string
+ */
function getMessage( $key ) {
return "($key)";
}
* Conversion script between Latin and Tifinagh for Tachelhit.
* - Tifinagh -> lowercase Latin
* - lowercase/uppercase Latin -> Tifinagh
-*
+*
*
* Based on:
* - http://en.wikipedia.org/wiki/Shilha_language
*
*/
class ShiConverter extends LanguageConverter {
+
+ protected $mDoContentConvert;
+
var $mToLatin = array(
'ⴰ' => 'a', 'ⴱ' => 'b', 'ⴳ' => 'g', 'ⴷ' => 'd', 'ⴹ' => 'ḍ', 'ⴻ' => 'e',
'ⴼ' => 'f', 'ⴽ' => 'k', 'ⵀ' => 'h', 'ⵃ' => 'ḥ', 'ⵄ' => 'ε', 'ⵅ' => 'x',
* @return string
*/
function parserConvert( $text, &$parser ) {
- if ( is_object( $parser->getTitle() ) && $parser->getTitle()->isTalkPage() )
- $this->mDoContentConvert = false;
- else
- $this->mDoContentConvert = true;
+ $this->mDoContentConvert = !( is_object( $parser->getTitle() ) && $parser->getTitle()->isTalkPage() );
return parent::parserConvert( $text, $parser );
}