r55175 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55174‎ | r55175 | r55176 >
Date:12:00, 17 August 2009
Author:nikerabbit
Status:ok
Tags:
Comment:
FC, some documentation
Modified paths:
  • /trunk/extensions/Translate/scripts/sync-group.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslationEditPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/scripts/sync-group.php
@@ -146,7 +146,7 @@
147147
148148
149149
150 - $title = Title::makeTitleSafe( $this->group->namespaces[0], "$key/$code" );
 150+ $title = Title::makeTitleSafe( $this->group->getNamespace(), "$key/$code" );
151151
152152 $page = $title->getPrefixedText();
153153
Index: trunk/extensions/Translate/utils/TranslationEditPage.php
@@ -1,7 +1,12 @@
22 <?php
33
44 /**
 5+ * This class together with some javascript implements the ajax translation
 6+ * page.
57 *
 8+ * @author Niklas Laxström
 9+ * @copyright Copyright © 2009 Niklas Laxström
 10+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
611 */
712 class TranslationEditPage {
813 /// Instance of an Title object
@@ -25,6 +30,10 @@
2631 public function setTitle( Title $title ) { $this->title = $title; }
2732 public function getTitle() { return $this->title; }
2833
 34+ /**
 35+ * Generates the html snippet for ajax edit. Echoes it to the output and
 36+ * disabled all other output.
 37+ */
2938 public function execute() {
3039 $data = $this->getEditInfo();
3140 $helpers = new TranslationHelpers( $this->getTitle() );
@@ -39,7 +48,7 @@
4049 'class' => 'mw-translate-edit-area',
4150 'rows' => $short ? 2: 10,
4251 );
43 - $textarea = Html::element( 'textarea', $textareaParams, $translation );
 52+ $textarea = Html::element( 'textarea', $textareaParams, htmlspecialchars($translation) );
4453
4554 $hidden = array();
4655 $hidden[] = Xml::hidden( 'title', $this->getTitle()->getPrefixedDbKey() );
@@ -53,10 +62,12 @@
5463 $summary = Xml::inputLabel( wfMsg( 'summary' ), 'summary', 'summary', 40 );
5564 $save = Html::input( 'submit', wfMsg( 'savearticle' ), 'submit' );
5665
 66+ // Use the api to submit edits
5767 $formParams = array(
5868 'action' => "{$wgServer}{$wgScriptPath}/api.php",
5969 'method' => 'post',
6070 );
 71+
6172 $form = Html::element( 'form', $formParams,
6273 implode( "\n", $hidden ) . "\n" .
6374 $helpers->getBoxes() . "\n" .
@@ -66,6 +77,11 @@
6778 echo $form;
6879 }
6980
 81+ /**
 82+ * Gets the edit token and timestamps in some ugly array structure. Needs to
 83+ * be cleaned up.
 84+ * @return Array
 85+ */
7086 protected function getEditInfo() {
7187 $params = new FauxRequest( array(
7288 'action' => 'query',

Status & tagging log