r71787 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71786‎ | r71787 | r71788 >
Date:09:41, 27 August 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Documentation updates
Modified paths:
  • /trunk/extensions/Translate/utils/ResourceLoader.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslationEditPage.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslationMemoryUpdater.php (modified) (history)
  • /trunk/extensions/Translate/utils/UserToggles.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/utils/TranslationEditPage.php
@@ -1,10 +1,11 @@
22 <?php
33 /**
4 - * Contains classes doe the AJAX translation page.
 4+ * Contains classes that imeplement the server side component of AJAX
 5+ * translation page.
56 *
67 * @file
78 * @author Niklas Laxström
8 - * @copyright Copyright © 2009 Niklas Laxström
 9+ * @copyright Copyright © 2009-2010 Niklas Laxström
910 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1011 */
1112
@@ -25,6 +26,12 @@
2627 $this->setTitle( $title );
2728 }
2829
 30+ /**
 31+ * Constructs a page from WebRequest.
 32+ * This interface is a big klunky.
 33+ * @param $request WebRequest
 34+ * @return TranslationEditPage
 35+ */
2936 public static function newFromRequest( WebRequest $request ) {
3037 $title = Title::newFromText( $request->getText( 'page' ) );
3138
@@ -37,7 +44,14 @@
3845 return $obj;
3946 }
4047
 48+ /**
 49+ * Change the title of the page we are working on.
 50+ */
4151 public function setTitle( Title $title ) { $this->title = $title; }
 52+ /**
 53+ * Get the title of the page we are working on.
 54+ * @return Title
 55+ */
4256 public function getTitle() { return $this->title; }
4357
4458 /**
@@ -138,6 +152,15 @@
139153 return $data;
140154 }
141155
 156+ /**
 157+ * Returns link attributes that enable javascript translation dialog.
 158+ * Will degrade gracefully if user does not have permissions or JavaScript
 159+ * is not enabled.
 160+ * @param $title Title Title object for the translatable message.
 161+ * @param $group \string The group in which this message belongs to.
 162+ * Optional, but avoids a lookup later if provided.
 163+ * @return \array
 164+ */
142165 public static function jsEdit( Title $title, $group = "" ) {
143166 global $wgUser;
144167
Index: trunk/extensions/Translate/utils/UserToggles.php
@@ -15,6 +15,7 @@
1616 class TranslatePreferences {
1717 /**
1818 * Add 'translate-pref-nonewsletter' preference.
 19+ * This is actually specific to translatewiki.net
1920 *
2021 * @return \bool true
2122 */
@@ -43,6 +44,7 @@
4445
4546 /**
4647 * Add 'translate-editlangs' preference.
 48+ * These are the languages also shown when translating.
4749 *
4850 * @return \bool true
4951 */
@@ -68,6 +70,7 @@
6971
7072 /**
7173 * Add 'translate-jsedit' preference.
 74+ * An option to disable the javascript edit interface.
7275 *
7376 * @return \bool true
7477 */
@@ -84,7 +87,7 @@
8588 /**
8689 * JavsScript selector for language codes.
8790 */
88 - protected static function languageSelector() {
 91+ protected static function languageSelector() {
8992 global $wgLang;
9093
9194 if ( is_callable( array( 'LanguageNames', 'getNames' ) ) ) {
Index: trunk/extensions/Translate/utils/TranslationMemoryUpdater.php
@@ -1,6 +1,6 @@
22 <?php
33 /**
4 - * Contains classes for updating the Translation Memory.
 4+ * Contains classes for updating the local translation memory.
55 *
66 * @file
77 * @author Niklas Laxström
@@ -9,7 +9,7 @@
1010 */
1111
1212 /**
13 - * Class for updating the Translation Memory runtime.
 13+ * Class for updating the tmserver from translate toolkit during runtime.
1414 */
1515 class TranslationMemoryUpdater {
1616 public static function update( $article, $user, $text, $summary, $minor, $_, $_, $flags, $revision ) {
@@ -85,6 +85,12 @@
8686 return true;
8787 }
8888
 89+ /**
 90+ * Return a handle to tmserver database.
 91+ * Tmserver uses a sqlite database, which we access trough MediaWiki's
 92+ * SQLite database handler.
 93+ * @return DatabaseSqlite or null
 94+ */
8995 public static function getDatabaseHandle() {
9096 global $wgTranslateTM;
9197
Index: trunk/extensions/Translate/utils/ResourceLoader.php
@@ -1,6 +1,6 @@
22 <?php
33 /**
4 - * @todo Needs documentation.
 4+ * Stuff for handling configuration files in PHP format.
55 * @file
66 * @author Niklas Laxström
77 * @copyright Copyright © 2010 Niklas Laxström
@@ -8,15 +8,20 @@
99 */
1010
1111 /**
12 - * @todo Needs documentation.
 12+ * Stuff for handling configuration files in PHP format.
1313 */
1414 class ResourceLoader {
 15+ /**
 16+ * Returns a global variable from PHP file by executing the file.
 17+ * @param $_filename \string Path to the file.
 18+ * @param $_variable \string Name of the variable.
 19+ * @return \mixed The variable contents or null.
 20+ */
1521 public static function loadVariableFromPHPFile( $_filename, $_variable ) {
1622 if ( !file_exists( $_filename ) ) {
1723 return null;
1824 } else {
1925 require( $_filename );
20 -
2126 return isset( $$_variable ) ? $$_variable : null;
2227 }
2328 }

Status & tagging log