http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99101
Revision: 99101 Author: reedy Date: 2011-10-06 13:30:06 +0000 (Thu, 06 Oct 2011) Log Message: ----------- More documentation Added 1 TODO Modified Paths: -------------- trunk/extensions/Translate/FFS.php trunk/extensions/Translate/MessageCollection.php trunk/extensions/Translate/MessageGroups.php trunk/extensions/Translate/RcFilter.php trunk/extensions/Translate/TranslateEditAddons.php trunk/extensions/Translate/TranslateHooks.php trunk/extensions/Translate/TranslateTasks.php trunk/extensions/Translate/utils/Font.php trunk/extensions/Translate/utils/HTMLJsSelectToInputField.php trunk/extensions/Translate/utils/MessageGroupCache.php trunk/extensions/Translate/utils/MessageGroupStats.php trunk/extensions/Translate/utils/MessageWebImporter.php trunk/extensions/Translate/utils/StringMatcher.php trunk/extensions/Translate/utils/TranslateYaml.php trunk/extensions/Translate/utils/TranslationEditPage.php trunk/extensions/Translate/utils/TranslationHelpers.php trunk/extensions/Translate/utils/UserToggles.php Modified: trunk/extensions/Translate/FFS.php =================================================================== --- trunk/extensions/Translate/FFS.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/FFS.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -224,7 +224,7 @@ /** * @param $collection MessageCollection - * @return + * @return string */ public function writeIntoVariable( MessageCollection $collection ) { $sourceFile = $this->group->getSourceFilePath( $collection->code ); Modified: trunk/extensions/Translate/MessageCollection.php =================================================================== --- trunk/extensions/Translate/MessageCollection.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/MessageCollection.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -251,6 +251,9 @@ } } + /** + * @return array + */ public static function getAvailableFilters() { return array( 'fuzzy', Modified: trunk/extensions/Translate/MessageGroups.php =================================================================== --- trunk/extensions/Translate/MessageGroups.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/MessageGroups.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -79,10 +79,15 @@ * branches one can set a message key mangler. */ protected $mangler = null; + + /** + * @return StringMatcher + */ public function getMangler() { $mangler = $this->mangler; if ( !$mangler ) { + // TODO: Shouldn't this set $this->mangler $mangler = StringMatcher::emptyMatcher(); } @@ -97,6 +102,9 @@ return null; } + /** + * @return SimpleFormatWriter + */ public function getWriter() { return new SimpleFormatWriter( $this ); } @@ -459,6 +467,11 @@ } } + /** + * @param $label + * @param $id + * @return ExtensionMessageGroup + */ public static function factory( $label, $id ) { $group = new ExtensionMessageGroup; $group->setLabel( $label ); @@ -519,6 +532,9 @@ return is_readable( $this->getMessageFileWithPath( $this->getSourceLanguage() ) ); } + /** + * @return MediaWikiMessageChecker + */ public function getChecker() { $checker = new MediaWikiMessageChecker( $this ); $checker->setChecks( array( @@ -757,6 +773,9 @@ return $this->title; } + /** + * @return array + */ public function getDefinitions() { $dbr = wfGetDB( DB_SLAVE ); $tables = 'translate_sections'; @@ -817,6 +836,9 @@ return $rev->getText(); } + /** + * @return MediaWikiMessageChecker + */ public function getChecker() { $checker = new MediaWikiMessageChecker( $this ); $checker->setChecks( array( @@ -916,9 +938,9 @@ $deps[] = new GlobalDependency( 'wgTranslateEC' ); $deps[] = new GlobalDependency( 'wgTranslateCC' ); $deps[] = new GlobalDependency( 'wgTranslateExtensionDirectory' ); - $deps[] = New FileDependency( dirname( __FILE__ ) . '/groups/mediawiki-defines.txt' ); - $deps[] = New FileDependency( dirname( __FILE__ ) . '/groups/Wikia/extensions.txt' ); - $deps[] = New FileDependency( dirname( __FILE__ ) . '/groups/Toolserver/toolserver-textdomains.txt' ); + $deps[] = new FileDependency( dirname( __FILE__ ) . '/groups/mediawiki-defines.txt' ); + $deps[] = new FileDependency( dirname( __FILE__ ) . '/groups/Wikia/extensions.txt' ); + $deps[] = new FileDependency( dirname( __FILE__ ) . '/groups/Toolserver/toolserver-textdomains.txt' ); if ( $wgTranslateAddMWExtensionGroups ) { $a = new PremadeMediawikiExtensionGroups; Modified: trunk/extensions/Translate/RcFilter.php =================================================================== --- trunk/extensions/Translate/RcFilter.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/RcFilter.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -24,6 +24,10 @@ * documentation of the function parameters. * * Appends SQL filter conditions into $conds. + * @param $conds array + * @param $tables array|stromg + * @param $join_conds array + * @param $opts * @return \bool true */ public static function translationFilter( &$conds, &$tables, &$join_conds, $opts ) { Modified: trunk/extensions/Translate/TranslateEditAddons.php =================================================================== --- trunk/extensions/Translate/TranslateEditAddons.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/TranslateEditAddons.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -212,6 +212,7 @@ } /** + * @param $title Title * @return Array of the message and the language */ public static function figureMessage( Title $title ) { @@ -229,6 +230,10 @@ return array( $key, $code ); } + /** + * @param $title Title + * @return array + */ public static function getKeyCodeGroup( Title $title ) { list( $key, $code ) = self::figureMessage( $title ); $group = self::getMessageGroup( $title->getNamespace(), $key ); @@ -261,6 +266,10 @@ return $mg; } + /** + * @param $object + * @return String + */ private static function editBoxes( $object ) { global $wgOut, $wgRequest; @@ -316,7 +325,12 @@ return true; } - /// Hook: EditPage::showEditForm:fields + /** + * Hook: EditPage::showEditForm:fields + * @param $edit + * @param $out OutputPage + * @return bool + */ public static function keepFields( $edit, $out ) { global $wgRequest; @@ -329,7 +343,19 @@ return true; } - /// Hook: ArticleSaveComplete + /** + * @Hook: ArticleSaveComplete + * @param $article Article + * @param $user User + * @param $text string + * @param $summary string + * @param $minor bool + * @param $_ + * @param $_ + * @param $flags + * @param $revision Revision + * @return bool + */ public static function onSave( $article, $user, $text, $summary, $minor, $_, $_, $flags, $revision ) { @@ -358,6 +384,11 @@ return true; } + /** + * @param $handle MessageHandle + * @param $text + * @return bool + */ protected static function checkNeedsFuzzy( MessageHandle $handle, $text ) { // Check for explicit tag. $fuzzy = self::hasFuzzyString( $text ); @@ -389,6 +420,11 @@ return $fuzzy; } + /** + * @param $title Title + * @param $revision + * @param $fuzzy + */ protected static function updateFuzzyTag( Title $title, $revision, $fuzzy ) { $dbw = wfGetDB( DB_MASTER ); @@ -448,6 +484,10 @@ return true; } + /** + * @param $text string + * @return string + */ public static function preserveWhitespaces( $text ) { $text = wfEscapeWikiText( $text ); $text = preg_replace( '/^ /m', ' ', $text ); @@ -457,7 +497,12 @@ return $text; } - /// Hook: LanguageGetTranslatedLanguageNames + /** + * Hook: LanguageGetTranslatedLanguageNames + * @param $names + * @param $code + * @return bool + */ public static function translateMessageDocumentationLanguage( &$names, $code ) { global $wgTranslateDocumentationLanguageCode; if ( $wgTranslateDocumentationLanguageCode ) { @@ -467,7 +512,12 @@ return true; } - /// Hook: ArticlePrepareTextForEdit + /** + * Hook: ArticlePrepareTextForEdit + * @param $article Article + * @param $popts ParserOptions + * @return bool + */ public static function disablePreSaveTransform( $article, $popts ) { global $wgTranslateDocumentationLanguageCode; @@ -481,7 +531,12 @@ return true; } - /// Hook: ArticleContentOnDiff + /** + * Hook: ArticleContentOnDiff + * @param $de DifferenceEngine + * @param $out OutputPage + * @return bool + */ public static function displayOnDiff( $de, $out ) { $title = $de->getTitle(); $handle = new MessageHandle( $title ); @@ -507,7 +562,11 @@ return false; } - /// Hook: SpecialSearchProfiles + /** + * Hook: SpecialSearchProfiles + * @param $profiles array + * @return bool + */ public static function searchProfile( &$profiles ) { global $wgTranslateMessageNamespaces; $insert = array(); @@ -521,7 +580,15 @@ return true; } - /// Hook: SpecialSearchProfileForm + /** + * Hook: SpecialSearchProfileForm + * @param $search + * @param $form + * @param $profile + * @param $term + * @param $opts + * @return bool + */ public static function searchProfileForm( $search, &$form, $profile, $term, $opts ) { if ( $profile !== 'translation' ) { return true; @@ -568,7 +635,13 @@ return false; } - /// Hook: SpecialSearchSetupEngine + /** + * Hook: SpecialSearchSetupEngine + * @param $search + * @param $profile + * @param $engine + * @return bool + */ public static function searchProfileSetupEngine( $search, $profile, $engine ) { if ( $profile !== 'translation' ) { return true; Modified: trunk/extensions/Translate/TranslateHooks.php =================================================================== --- trunk/extensions/Translate/TranslateHooks.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/TranslateHooks.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -63,7 +63,6 @@ $wgLogActionsHandlers['pagetranslation/deletelnok'] = 'PageTranslationHooks::formatLogEntry'; $wgLogActionsHandlers['pagetranslation/deletefnok'] = 'PageTranslationHooks::formatLogEntry'; - global $wgJobClasses; $wgJobClasses['RenderJob'] = 'RenderJob'; $wgJobClasses['MoveJob'] = 'MoveJob'; @@ -154,7 +153,11 @@ return true; } - /// Hook: UnitTestsList + /** + * Hook: UnitTestsList + * @param $files array + * @return bool + */ public static function setupUnitTests( &$files ) { $testDir = dirname( __FILE__ ) . '/tests/'; $files[] = $testDir . 'MessageGroupBaseTest.php'; @@ -179,14 +182,17 @@ return true; } - /// Hook: ParserTestTables + /** + * Hook: ParserTestTables + * @param $tables array + * @return bool + */ public static function parserTestTables( &$tables ) { $tables[] = 'revtag'; $tables[] = 'translate_groupstats'; return true; } - /** * Set the right page content language for message group translations ("Page/xx"). * Hook: PageContentLanguage Modified: trunk/extensions/Translate/TranslateTasks.php =================================================================== --- trunk/extensions/Translate/TranslateTasks.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/TranslateTasks.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -102,11 +102,22 @@ return false; } - protected $group; ///< \type{MessageGroup} Message group. - protected $collection; ///< \type{MessageCollection} Messages. - protected $options; ///< \type{TaskOptions} Options. + /** + * @var MessageGroup + */ + protected $group; /** + * @var MessageCollection Options + */ + protected $collection; + + /** + * @var TaskOptions Options + */ + protected $options; + + /** * Constructor. * @param $group \type{MessageGroup} Message group. * @param $options \type{TaskOptions} Options. Modified: trunk/extensions/Translate/utils/Font.php =================================================================== --- trunk/extensions/Translate/utils/Font.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/utils/Font.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -93,6 +93,9 @@ return $chosen; } + /** + * @return BagOStuff + */ protected static function getCache() { return wfGetCache( CACHE_ANYTHING ); } Modified: trunk/extensions/Translate/utils/HTMLJsSelectToInputField.php =================================================================== --- trunk/extensions/Translate/utils/HTMLJsSelectToInputField.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/utils/HTMLJsSelectToInputField.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -11,6 +11,11 @@ * Implementation of JsSelectToInput class which is extends HTMLTextField. */ class HTMLJsSelectToInputField extends HTMLTextField { + + /** + * @param $value + * @return string + */ function getInputHTML( $value ) { $input = parent::getInputHTML( $value ); @@ -21,6 +26,10 @@ return $input; } + /** + * @param $value + * @return array + */ function tidy( $value ) { $value = array_map( 'trim', explode( ',', $value ) ); $value = array_unique( array_filter( $value ) ); @@ -28,6 +37,11 @@ return $value; } + /** + * @param $value + * @param $alldata + * @return bool|String + */ function validate( $value, $alldata ) { $p = parent::validate( $value, $alldata ); @@ -55,6 +69,11 @@ return true; } + /** + * @param $value + * @param $alldata + * @return string + */ function filter( $value, $alldata ) { $value = parent::filter( $value, $alldata ); return implode( ', ', $this->tidy( $value ) ); Modified: trunk/extensions/Translate/utils/MessageGroupCache.php =================================================================== --- trunk/extensions/Translate/utils/MessageGroupCache.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/utils/MessageGroupCache.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -14,10 +14,17 @@ * of the actual format. */ class MessageGroupCache { - /// \string + + /** + * @var MessageGroup + */ protected $group; - /// CdbReader + + /** + * @var CdbReader + */ protected $cache; + /// \string protected $code; Modified: trunk/extensions/Translate/utils/MessageGroupStats.php =================================================================== --- trunk/extensions/Translate/utils/MessageGroupStats.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/utils/MessageGroupStats.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -186,8 +186,6 @@ return $flattened; } - - protected static function forGroupInternal( $group, $stats = array() ) { $id = $group->getId(); $res = self::selectRowsIdLang( $id, null ); Modified: trunk/extensions/Translate/utils/MessageWebImporter.php =================================================================== --- trunk/extensions/Translate/utils/MessageWebImporter.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/utils/MessageWebImporter.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -439,6 +439,9 @@ return array( 'translate-manage-import-fuzzy', "\n" . $text ); } + /** + * @return User + */ public static function getFuzzyBot() { global $wgTranslateFuzzyBotName; Modified: trunk/extensions/Translate/utils/StringMatcher.php =================================================================== --- trunk/extensions/Translate/utils/StringMatcher.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/utils/StringMatcher.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -101,6 +101,10 @@ } } + /** + * @param $string string + * @return bool + */ public function match( $string ) { if ( in_array( $string, $this->aExact ) ) { return true; Modified: trunk/extensions/Translate/utils/TranslateYaml.php =================================================================== --- trunk/extensions/Translate/utils/TranslateYaml.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/utils/TranslateYaml.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -56,7 +56,11 @@ return $base; } - + /** + * @param $text string + * @return array + * @throws MWException + */ public static function loadString( $text ) { global $wgTranslateYamlLibrary; @@ -76,6 +80,10 @@ } } + /** + * @param $yaml array + * @return array + */ public static function fixSyckBooleans( &$yaml ) { foreach ( $yaml as &$value ) { if ( is_array( $value ) ) { @@ -87,6 +95,10 @@ return $yaml; } + /** + * @param $yaml array + * @return array + */ public static function fixSpycSpaces( &$yaml ) { foreach ( $yaml as $key => &$value ) { if ( is_array( $value ) ) { @@ -172,8 +184,8 @@ 'sub deutf8 {' . 'if(ref($_[0]) eq "HASH") {' . 'return { map { deutf8($_) } %{$_[0]} };' . - '} elsif(ref($_[0]) eq "ARRAY") {' . - 'return [ map { deutf8($_) } @{$_[0]} ];' . + '} elsif(ref($_[0]) eq "ARRAY") {' . + 'return [ map { deutf8($_) } @{$_[0]} ];' . '} else {' . 'my $s = $_[0];' . 'utf8::decode($s);' . Modified: trunk/extensions/Translate/utils/TranslationEditPage.php =================================================================== --- trunk/extensions/Translate/utils/TranslationEditPage.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/utils/TranslationEditPage.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -46,6 +46,7 @@ /** * Change the title of the page we are working on. + * @param $title Title */ public function setTitle( Title $title ) { $this->title = $title; } /** Modified: trunk/extensions/Translate/utils/TranslationHelpers.php =================================================================== --- trunk/extensions/Translate/utils/TranslationHelpers.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/utils/TranslationHelpers.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -226,6 +226,9 @@ } } + /** + * @return array + */ public function getBoxNames() { return array( 'other-languages' => array( $this, 'getOtherLanguagesBox' ), @@ -323,6 +326,11 @@ return $result; } + /** + * @param $async bool + * @return null|string + * @throws MWException + */ public function getSuggestionBox( $async = false ) { global $wgTranslateTranslationServices; Modified: trunk/extensions/Translate/utils/UserToggles.php =================================================================== --- trunk/extensions/Translate/utils/UserToggles.php 2011-10-06 13:25:56 UTC (rev 99100) +++ trunk/extensions/Translate/utils/UserToggles.php 2011-10-06 13:30:06 UTC (rev 99101) @@ -46,6 +46,8 @@ * Add 'translate-editlangs' preference. * These are the languages also shown when translating. * + * @param $user User + * @param $preferences array * @return \bool true */ public static function translationAssistLanguages( $user, &$preferences ) { @@ -73,6 +75,8 @@ * Add 'translate-jsedit' preference. * An option to disable the javascript edit interface. * + * @param $user User + * @param $preferences array * @return \bool true */ public static function translationJsedit( $user, &$preferences ) { _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs