Documentation

Explicit member variable definitions

Simplify some code
This commit is contained in:
Sam Reed 2011-10-18 17:27:52 +00:00
parent 856faea6d6
commit 1c6f95fec3
6 changed files with 28 additions and 25 deletions

View file

@ -946,7 +946,7 @@ HTML;
/**
* 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
*/

View file

@ -239,7 +239,7 @@ class Language {
/**
* 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;
@ -1212,7 +1212,7 @@ class Language {
}
// Days passed in current month
$gDayNo += $gd;
$gDayNo += (int)$gd;
$jDayNo = $gDayNo - 79;
@ -1573,7 +1573,7 @@ class Language {
$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;
}
@ -3097,10 +3097,10 @@ class Language {
* 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 );
@ -3762,7 +3762,7 @@ class Language {
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 );

View file

@ -117,7 +117,7 @@ class LanguageConverter {
* 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 ) {
@ -368,11 +368,11 @@ class LanguageConverter {
$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;
@ -385,7 +385,7 @@ class LanguageConverter {
if ( !strpos( $attr, '://' ) ) {
$attr = $this->translate( $attr, $toVariant );
}
// Remove HTML tags to avoid disrupting the layout
$attr = preg_replace( '/<[^>]+>/', '', $attr );
if ( $attr !== $attrs[$attrName] ) {
@ -394,7 +394,7 @@ class LanguageConverter {
}
}
if ( $changed ) {
$element = $elementMatches[1] . Html::expandAttributes( $attrs ) .
$element = $elementMatches[1] . Html::expandAttributes( $attrs ) .
$elementMatches[3];
}
}

View file

@ -7,7 +7,7 @@
* 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
@ -21,6 +21,8 @@ require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
*
*/
class IuConverter extends LanguageConverter {
protected $mDoContentConvert;
var $mToLatin = array(
'ᐦ' => 'h', 'ᐃ' => 'i', 'ᐄ' => 'ii', 'ᐅ' => 'u', 'ᐆ' => 'uu', 'ᐊ' => 'a', 'ᐋ' => 'aa',
'ᑉ' => 'p', 'ᐱ' => 'pi', 'ᐲ' => 'pii', '' => 'pu', 'ᐴ' => 'puu', '' => 'pa', 'ᐹ' => 'paa',
@ -111,10 +113,7 @@ class IuConverter extends LanguageConverter {
* @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 );
}

View file

@ -9,6 +9,10 @@
* @ingroup Language
*/
class LanguageQqx extends Language {
/**
* @param $key string
* @return string
*/
function getMessage( $key ) {
return "($key)";
}

View file

@ -7,7 +7,7 @@
* Conversion script between Latin and Tifinagh for Tachelhit.
* - Tifinagh -> lowercase Latin
* - lowercase/uppercase Latin -> Tifinagh
*
*
*
* Based on:
* - http://en.wikipedia.org/wiki/Shilha_language
@ -21,6 +21,9 @@ require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
*
*/
class ShiConverter extends LanguageConverter {
protected $mDoContentConvert;
var $mToLatin = array(
'ⴰ' => 'a', 'ⴱ' => 'b', 'ⴳ' => 'g', 'ⴷ' => 'd', '' => 'ḍ', 'ⴻ' => 'e',
'ⴼ' => 'f', 'ⴽ' => 'k', 'ⵀ' => 'h', 'ⵃ' => 'ḥ', 'ⵄ' => 'ε', 'ⵅ' => 'x',
@ -89,10 +92,7 @@ class ShiConverter extends LanguageConverter {
* @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 );
}