r65643 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65642‎ | r65643 | r65644 >
Date:22:50, 28 April 2010
Author:siebrand
Status:deferred
Tags:
Comment:
* stylize.php, trailing whitespace removed
* add support to Translate for Checkpoint
Modified paths:
  • /trunk/extensions/Checkpoint/Checkpoint.i18n.php (modified) (history)
  • /trunk/extensions/Checkpoint/Checkpoint.php (modified) (history)
  • /trunk/extensions/Translate/groups/mediawiki-defines.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/Checkpoint/Checkpoint.i18n.php
@@ -1,4 +1,9 @@
22 <?php
 3+/**
 4+ * Internationalisation file for Checkpoint extension.
 5+ *
 6+ * @addtogroup Extensions
 7+ */
38
49 $messages = array();
510
@@ -7,4 +12,4 @@
813 'checkpoint-desc' => 'Allows one to save an edit and continue editing',
914 'checkpoint-tooltip' => 'Save your progress and continue editing the page',
1015 'checkpoint-notice' => '([[{{ns:project}}:Checkpoint|checkpoint save]])',
11 -);
\ No newline at end of file
 16+);
Index: trunk/extensions/Checkpoint/Checkpoint.php
@@ -1,14 +1,13 @@
22 <?php
3 -
43 /**
54 * Checkpoint extension by Skizzerz, from a request on IRC
6 - * It would be nice if this was in core and not an extension,
7 - * but having an extension is good for testing purposes, etc. before implementation
8 -*/
 5+ * It would be nice if this was in core and not an extension, but having an
 6+ * extension is good for testing purposes, etc. before implementation
 7+ */
98
10 -if(!defined('MEDIAWIKI')) {
 9+if ( !defined( 'MEDIAWIKI' ) ) {
1110 echo "This is an extension to the MediaWiki software and cannot be used standalone";
12 - die(1);
 11+ die( 1 );
1312 }
1413
1514 $wgExtensionCredits['other'][] = array(
@@ -20,51 +19,54 @@
2120 'version' => '0.1',
2221 );
2322
24 -$wgExtensionMessagesFiles['Checkpoint'] = dirname(__FILE__) . '/Checkpoint.i18n.php';
 23+$wgExtensionMessagesFiles['Checkpoint'] = dirname( __FILE__ ) . '/Checkpoint.i18n.php';
2524
2625 $wgHooks['EditPageBeforeEditButtons'][] = 'efCheckpointButton';
2726 $wgHooks['ArticleSave'][] = 'efCheckpointSave';
2827 $wgHooks['GetFullURL'][] = 'efCheckpointReturn';
2928
30 -function efCheckpointButton(&$editpage, &$buttons) {
31 - wfLoadExtensionMessages('Checkpoint');
 29+function efCheckpointButton( &$editpage, &$buttons ) {
 30+ wfLoadExtensionMessages( 'Checkpoint' );
3231 $attr = array(
3332 'id' => 'wpCheckpoint',
3433 'name' => 'wpCheckpoint',
3534 'type' => 'submit',
36 - 'value' => wfMsg('checkpoint'),
37 - 'title' => wfMsg('checkpoint-tooltip'),
 35+ 'value' => wfMsg( 'checkpoint' ),
 36+ 'title' => wfMsg( 'checkpoint-tooltip' ),
3837 );
39 - $buttons['checkpoint'] = Xml::element('input', $attr, '');
 38+ $buttons['checkpoint'] = Xml::element( 'input', $attr, '' );
4039 return true;
4140 }
4241
43 -function efCheckpointSave($article, $user, $text, &$summary, $minor, $watch, $sectionanchor, $flags) {
 42+function efCheckpointSave( $article, $user, $text, &$summary, $minor, $watch, $sectionanchor, $flags ) {
4443 global $wgRequest;
45 - wfLoadExtensionMessages('Checkpoint');
46 - if( $wgRequest->getCheck('wpCheckpoint') ) {
47 - if($summary == '') {
48 - //blank summary, so let's get an automatic one if applicable (the appending bit prevents autosummaries from appearing otherwise).
 44+
 45+ wfLoadExtensionMessages( 'Checkpoint' );
 46+ if ( $wgRequest->getCheck( 'wpCheckpoint' ) ) {
 47+ if ( $summary == '' ) {
 48+ // blank summary, so let's get an automatic one if
 49+ // applicable (the appending bit prevents autosummaries
 50+ // from appearing otherwise).
4951 $oldtext = $article->fetchContent();
50 - $summary = $article->getAutosummary($oldtext, $text, $flags);
 52+ $summary = $article->getAutosummary( $oldtext, $text, $flags );
5153 }
52 - $summary .= ' ' . wfMsg('checkpoint-notice');
53 -
 54+ $summary .= wfMsg( 'word-separator' ) . wfMsg( 'checkpoint-notice' );
5455 }
5556 return true;
5657 }
5758
58 -function efCheckpointReturn($title, &$url, $query) {
 59+function efCheckpointReturn( $title, &$url, $query ) {
5960 global $wgRequest;
60 - if( $wgRequest->wasPosted() && $wgRequest->getCheck('wpCheckpoint') ) {
 61+
 62+ if ( $wgRequest->wasPosted() && $wgRequest->getCheck( 'wpCheckpoint' ) ) {
6163 $frag = $title->getFragmentForURL();
62 - $querystr = strpos($url, '?') ? '&' : '?'; //see if we need to append a ? or a &
63 - if($frag == '') {
64 - //just append our query to the end
 64+ $querystr = strpos( $url, '?' ) ? '&' : '?'; // see if we need to append a ? or a &
 65+ if ( $frag == '' ) {
 66+ // just append our query to the end
6567 $url .= $querystr . 'action=edit&preview=yes';
6668 } else {
67 - //do a string replace
68 - $url = str_replace($frag, $querystr . 'action=edit&preview=yes' . $frag, $url);
 69+ // do a string replace
 70+ $url = str_replace( $frag, $querystr . 'action=edit&preview=yes' . $frag, $url );
6971 }
7072 }
7173 return true;
Index: trunk/extensions/Translate/groups/mediawiki-defines.txt
@@ -115,7 +115,10 @@
116116 ignored = changeauthor-logpagetext, changeauthor-short
117117
118118 Char Insert
 119+#magicfile = CharInsert/CharInsert.i18n.magic.php
119120
 121+Checkpoint
 122+
120123 Check User
121124 aliasfile = CheckUser/CheckUser.alias.php
122125 ignored = checkuser-toollinks

Status & tagging log