throw new MWException( __METHOD__ . " must be passed a string, $type given$addmsg" );
}
- return (bool)preg_match( '/^[a-z0-9-]{2,}$/i', $code );
+ return (bool)preg_match( '/^[a-z0-9-]{2,}$/', $code );
}
/**
function initContLang() {
}
- /**
- * Same as getFallbacksFor for current language.
- * @return array|bool
- * @deprecated since 1.19
- */
- function getFallbackLanguageCode() {
- wfDeprecated( __METHOD__, '1.19' );
-
- return self::getFallbackFor( $this->mCode );
- }
-
/**
* @return array
* @since 1.19
include "$IP/languages/Names.php";
}
+ // If passed an invalid language code to use, fallback to en
+ if ( $inLanguage !== null && !Language::isValidCode( $inLanguage ) ) {
+ $inLanguage = 'en';
+ }
+
$names = array();
if ( $inLanguage ) {
// Timestamps are in different years: use full timestamp
// Also do full timestamp for future dates
/**
- * @FIXME Add better handling of future timestamps.
+ * @todo FIXME: Add better handling of future timestamps.
*/
$format = $this->getDateFormatString( 'both', $user->getDatePreference() ?: 'default' );
$ts = $this->sprintfDate( $format, $ts->getTimestamp( TS_MW ) );
*/
function getMagic( $mw ) {
// Saves a function call
- if ( ! $this->mMagicHookDone ) {
+ if ( !$this->mMagicHookDone ) {
$this->doMagicHook();
}
foreach ( $forms as $index => $form ) {
if ( preg_match( '/\d+=/i', $form ) ) {
$pos = strpos( $form, '=' );
- if ( substr( $form, 0, $pos ) === (string) $count ) {
+ if ( substr( $form, 0, $pos ) === (string)$count ) {
return substr( $form, $pos + 1 );
}
unset( $forms[$index] );
if ( !isset( $format['avoid'] ) ) {
$format['avoid'] = false;
}
- if ( !isset( $format['noabbrevs' ] ) ) {
+ if ( !isset( $format['noabbrevs'] ) ) {
$format['noabbrevs'] = false;
}
$secondsMsg = wfMessage(