User:MaxSem/CR/ZeroRated

Reviewed as of

i18n

 * 'zero-rated-mobile-access-desc' => 'Zero Rated Mobile Access', - It's just extension name with spaces added, it doesn't explain what this extension does.
 * 'zero-rated-mobile-access-desc' => ' ', - Should be

ZeroRatedMobileAccessTemplate.php
Class-only files need no inclusion guard, I've fixed that in

ZeroRatedMobileAccess.php

 * DIRECTORY_SEPARATOR isn't needed as PHP automatically converts to proper slash style. The only situation when directory separator matters is when file name gets passed to an external program, which isn't the case.
 * It is advised to separate extension implementation from registration and initialization, suggest moving ExtZeroRatedMobileAccess class to a separate file.
 * This class is mostly static, with the only non-static function, beforePageDisplayHTML, using only static resources. Recommend making it static too and avoid initializing the class on every request at all. This will also help in accomplishing the above point.
 * self::$renderZeroRatedLandingPage = $wgRequest->getInt( 'renderZeroRatedLandingPage' ); Recommend using getFuzzyBool and pass 'true' to it for coolness.
 * self::$renderZeroRatedLandingPage = $wgRequest->getInt( 'renderZeroRatedLandingPage' ); Hope such long parameter name isn't going to stick:P
 * $ip = ( $wgRequest->getVal( 'ip') ) ? $wgRequest->getVal( 'ip' ) : wfGetIP; You can simply do $ip = $wgRequest->getVal( 'ip', wfGetIP );
 * Undefined variable: lines in D:\Projects\MediaWiki\extensions\ZeroRatedMobileAccess\ZeroRatedMobileAccess.php on line 149
 * Undefined index: RUSSIAN FEDERATION in D:\Projects\MediaWiki\extensions\ZeroRatedMobileAccess\ZeroRatedMobileAccess.php on line 84
 * $title = Title::newFromText( "Language_options", NS_MEDIAWIKI ); - this message should be prefixed with extension-specific prefix and be present in message file.
 * There's Extension:CLDR that can provide country names. It's alredy enabled on WMF.
 * Why profile array creation in getFullCountryNameFromCode</tt>? I've just made it static to make sure that multiple calls have a minimum overhead. Also, you need to check if country code is not a multi-megabyte string POSTed just to make strtoupper choke twice on it:)