r84549 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84548‎ | r84549 | r84550 >
Date:20:23, 22 March 2011
Author:ashley
Status:ok
Tags:
Comment:
coding style tweaks, doc updates, marked some public functions as such
Modified paths:
  • /trunk/phase3/includes/Cookie.php (modified) (history)
  • /trunk/phase3/includes/Interwiki.php (modified) (history)
  • /trunk/phase3/includes/MWFunction.php (modified) (history)
  • /trunk/phase3/includes/PrefixSearch.php (modified) (history)
  • /trunk/phase3/includes/ZhClient.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialMergeHistory.php (modified) (history)
  • /trunk/phase3/languages/LanguageConverter.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Interwiki.php
@@ -143,7 +143,7 @@
144144 global $wgMemc, $wgInterwikiExpiry;
145145
146146 $iwData = false;
147 - if ( !wfRunHooks('InterwikiLoadPrefix', array( $prefix, &$iwData ) ) ) {
 147+ if ( !wfRunHooks( 'InterwikiLoadPrefix', array( $prefix, &$iwData ) ) ) {
148148 return Interwiki::loadFromArray( $iwData );
149149 }
150150
Index: trunk/phase3/includes/PrefixSearch.php
@@ -15,7 +15,7 @@
1616 * @param $namespaces Array: used if query is not explicitely prefixed
1717 * @return Array of strings
1818 */
19 - public static function titleSearch( $search, $limit, $namespaces=array() ) {
 19+ public static function titleSearch( $search, $limit, $namespaces = array() ) {
2020 $search = trim( $search );
2121 if( $search == '' ) {
2222 return array(); // Return empty result
@@ -26,8 +26,9 @@
2727 $title = Title::newFromText( $search );
2828 if( $title && $title->getInterwiki() == '' ) {
2929 $ns = array($title->getNamespace());
30 - if($ns[0] == NS_MAIN)
 30+ if( $ns[0] == NS_MAIN ) {
3131 $ns = $namespaces; // no explicit prefix, use default namespaces
 32+ }
3233 return self::searchBackend(
3334 $ns, $title->getText(), $limit );
3435 }
@@ -38,13 +39,12 @@
3940 && $title->getNamespace() != NS_MAIN
4041 && $title->getInterwiki() == '' ) {
4142 return self::searchBackend(
42 - array($title->getNamespace()), '', $limit );
 43+ array( $title->getNamespace() ), '', $limit );
4344 }
4445
4546 return self::searchBackend( $namespaces, $search, $limit );
4647 }
4748
48 -
4949 /**
5050 * Do a prefix search of titles and return a list of matching page names.
5151 * @param $namespaces Array
@@ -53,10 +53,10 @@
5454 * @return Array of strings
5555 */
5656 protected static function searchBackend( $namespaces, $search, $limit ) {
57 - if( count($namespaces) == 1 ){
 57+ if( count( $namespaces ) == 1 ) {
5858 $ns = $namespaces[0];
5959 if( $ns == NS_MEDIA ) {
60 - $namespaces = array(NS_FILE);
 60+ $namespaces = array( NS_FILE );
6161 } elseif( $ns == NS_SPECIAL ) {
6262 return self::specialSearch( $search, $limit );
6363 }
@@ -135,12 +135,13 @@
136136 * @return Array of title strings
137137 */
138138 protected static function defaultSearchBackend( $namespaces, $search, $limit ) {
139 - $ns = array_shift($namespaces); // support only one namespace
140 - if( in_array(NS_MAIN,$namespaces))
 139+ $ns = array_shift( $namespaces ); // support only one namespace
 140+ if( in_array( NS_MAIN, $namespaces ) ) {
141141 $ns = NS_MAIN; // if searching on many always default to main
 142+ }
142143
143144 // Prepare nested request
144 - $req = new FauxRequest(array (
 145+ $req = new FauxRequest( array(
145146 'action' => 'query',
146147 'list' => 'allpages',
147148 'apnamespace' => $ns,
@@ -149,7 +150,7 @@
150151 ));
151152
152153 // Execute
153 - $module = new ApiMain($req);
 154+ $module = new ApiMain( $req );
154155 $module->execute();
155156
156157 // Get resulting data
@@ -157,7 +158,7 @@
158159
159160 // Reformat useful data for future printing by JSON engine
160161 $srchres = array ();
161 - foreach ((array)$data['query']['allpages'] as $pageinfo) {
 162+ foreach ( (array)$data['query']['allpages'] as $pageinfo ) {
162163 // Note: this data will no be printable by the xml engine
163164 // because it does not support lists of unnamed items
164165 $srchres[] = $pageinfo['title'];
@@ -172,18 +173,19 @@
173174 * @param $namespaces Array
174175 * @return Array (default: contains only NS_MAIN)
175176 */
176 - protected static function validateNamespaces($namespaces){
 177+ protected static function validateNamespaces( $namespaces ) {
177178 global $wgContLang;
178179
179180 // We will look at each given namespace against wgContLang namespaces
180181 $validNamespaces = $wgContLang->getNamespaces();
181 - if( is_array($namespaces) && count($namespaces)>0 ){
 182+ if( is_array( $namespaces ) && count( $namespaces ) > 0 ) {
182183 $valid = array();
183 - foreach ($namespaces as $ns){
184 - if( is_numeric($ns) && array_key_exists($ns, $validNamespaces) )
 184+ foreach ( $namespaces as $ns ) {
 185+ if( is_numeric( $ns ) && array_key_exists( $ns, $validNamespaces ) ) {
185186 $valid[] = $ns;
 187+ }
186188 }
187 - if( count($valid) > 0 ) {
 189+ if( count( $valid ) > 0 ) {
188190 return $valid;
189191 }
190192 }
Index: trunk/phase3/includes/MWFunction.php
@@ -19,52 +19,46 @@
2020 */
2121
2222 class MWFunction {
23 -
 23+
2424 protected static function cleanCallback( $callback ) {
25 -
2625 if( is_string( $callback ) ) {
2726 if ( strpos( $callback, '::' ) !== false ) {
28 - //PHP 5.1 cannot use call_user_func( 'Class::Method' )
29 - //It can only handle only call_user_func( array( 'Class', 'Method' ) )
 27+ // PHP 5.1 cannot use call_user_func( 'Class::Method' )
 28+ // It can only handle only call_user_func( array( 'Class', 'Method' ) )
3029 $callback = explode( '::', $callback, 2);
3130 }
3231 }
33 -
 32+
3433 if( count( $callback ) == 2 && $callback[0] == 'self' || $callback[0] == 'parent' ) {
35 -
3634 throw new MWException( 'MWFunction cannot call self::method() or parent::method()' );
37 -
3835 }
39 -
 36+
4037 // Run autoloader (workaround for call_user_func_array bug: http://bugs.php.net/bug.php?id=51329)
4138 is_callable( $callback );
42 -
 39+
4340 return $callback;
4441 }
45 -
 42+
4643 public static function call( $callback ) {
4744 $callback = self::cleanCallback( $callback );
48 -
 45+
4946 $args = func_get_args();
50 -
 47+
5148 return call_user_func_array( 'call_user_func', $args );
52 -
5349 }
54 -
 50+
5551 public static function callArray( $callback, $argsarams ) {
56 -
5752 $callback = self::cleanCallback( $callback );
5853 return call_user_func_array( $callback, $argsarams );
59 -
6054 }
61 -
 55+
6256 public static function newObj( $class, $args = array() ) {
6357 if( !count( $args ) ) {
6458 return new $class;
6559 }
6660
67 - $ref = new ReflectionClass($class);
68 - return $ref->newInstanceArgs($args);
 61+ $ref = new ReflectionClass( $class );
 62+ return $ref->newInstanceArgs( $args );
6963 }
7064
7165 }
Index: trunk/phase3/includes/ZhClient.php
@@ -2,7 +2,6 @@
33
44 /**
55 * Client for querying zhdaemon
6 - *
76 */
87 class ZhClient {
98 var $mHost, $mPort, $mFP, $mConnected;
@@ -12,7 +11,7 @@
1312 *
1413 * @access private
1514 */
16 - function __construct($host, $port) {
 15+ function __construct( $host, $port ) {
1716 $this->mHost = $host;
1817 $this->mPort = $port;
1918 $this->mConnected = $this->connect();
@@ -33,7 +32,7 @@
3433 function connect() {
3534 wfSuppressWarnings();
3635 $errno = $errstr = '';
37 - $this->mFP = fsockopen($this->mHost, $this->mPort, $errno, $errstr, 30);
 36+ $this->mFP = fsockopen( $this->mHost, $this->mPort, $errno, $errstr, 30 );
3837 wfRestoreWarnings();
3938 if ( !$this->mFP ) {
4039 return false;
@@ -46,30 +45,30 @@
4746 *
4847 * @access private
4948 */
50 - function query($request) {
 49+ function query( $request ) {
5150 if ( !$this->mConnected ) {
5251 return false;
5352 }
5453
55 - fwrite($this->mFP, $request);
 54+ fwrite( $this->mFP, $request );
5655
57 - $result=fgets($this->mFP, 1024);
 56+ $result = fgets( $this->mFP, 1024 );
5857
59 - list($status, $len) = explode(" ", $result);
60 - if($status == 'ERROR') {
61 - //$len is actually the error code...
 58+ list( $status, $len ) = explode( ' ', $result );
 59+ if( $status == 'ERROR' ) {
 60+ // $len is actually the error code...
6261 print "zhdaemon error $len<br />\n";
6362 return false;
6463 }
65 - $bytesread=0;
66 - $data='';
67 - while(!feof($this->mFP) && $bytesread<$len) {
68 - $str= fread($this->mFP, $len-$bytesread);
69 - $bytesread += strlen($str);
 64+ $bytesread = 0;
 65+ $data = '';
 66+ while( !feof( $this->mFP ) && $bytesread < $len ) {
 67+ $str = fread( $this->mFP, $len - $bytesread );
 68+ $bytesread += strlen( $str );
7069 $data .= $str;
7170 }
72 - //data should be of length $len. otherwise something is wrong
73 - if ( strlen($data) != $len ) {
 71+ // data should be of length $len. otherwise something is wrong
 72+ if ( strlen( $data ) != $len ) {
7473 return false;
7574 }
7675 return $data;
@@ -78,14 +77,14 @@
7978 /**
8079 * Convert the input to a different language variant
8180 *
82 - * @param $text string: input text
83 - * @param $tolang string: language variant
 81+ * @param $text String: input text
 82+ * @param $tolang String: language variant
8483 * @return string the converted text
8584 */
86 - function convert($text, $tolang) {
87 - $len = strlen($text);
 85+ function convert( $text, $tolang ) {
 86+ $len = strlen( $text );
8887 $q = "CONV $tolang $len\n$text";
89 - $result = $this->query($q);
 88+ $result = $this->query( $q );
9089 if ( !$result ) {
9190 $result = $text;
9291 }
@@ -95,39 +94,39 @@
9695 /**
9796 * Convert the input to all possible variants
9897 *
99 - * @param $text string: input text
 98+ * @param $text String: input text
10099 * @return array langcode => converted_string
101100 */
102 - function convertToAllVariants($text) {
103 - $len = strlen($text);
 101+ function convertToAllVariants( $text ) {
 102+ $len = strlen( $text );
104103 $q = "CONV ALL $len\n$text";
105 - $result = $this->query($q);
 104+ $result = $this->query( $q );
106105 if ( !$result ) {
107106 return false;
108107 }
109 - list($infoline, $data) = explode('|', $result, 2);
110 - $info = explode(";", $infoline);
 108+ list( $infoline, $data ) = explode( '|', $result, 2 );
 109+ $info = explode( ';', $infoline );
111110 $ret = array();
112 - $i=0;
113 - foreach($info as $variant) {
114 - list($code, $len) = explode(' ', $variant);
115 - $ret[strtolower($code)] = substr($data, $i, $len);
116 - $i+=$len;
 111+ $i = 0;
 112+ foreach( $info as $variant ) {
 113+ list( $code, $len ) = explode( ' ', $variant );
 114+ $ret[strtolower( $code )] = substr( $data, $i, $len );
 115+ $i += $len;
117116 }
118117 return $ret;
119118 }
120119 /**
121120 * Perform word segmentation
122121 *
123 - * @param $text string: input text
 122+ * @param $text String: input text
124123 * @return string segmented text
125124 */
126 - function segment($text) {
127 - $len = strlen($text);
 125+ function segment( $text ) {
 126+ $len = strlen( $text );
128127 $q = "SEG $len\n$text";
129 - $result = $this->query($q);
130 - if ( !$result ) {// fallback to character based segmentation
131 - $result = $this->segment($text);
 128+ $result = $this->query( $q );
 129+ if ( !$result ) { // fallback to character based segmentation
 130+ $result = $this->segment( $text );
132131 }
133132 return $result;
134133 }
@@ -136,6 +135,6 @@
137136 * Close the connection
138137 */
139138 function close() {
140 - fclose($this->mFP);
 139+ fclose( $this->mFP );
141140 }
142141 }
Index: trunk/phase3/includes/specials/SpecialMergeHistory.php
@@ -37,6 +37,7 @@
3838
3939 private function loadRequestParams( $request ) {
4040 global $wgUser;
 41+
4142 $this->mAction = $request->getVal( 'action' );
4243 $this->mTarget = $request->getVal( 'target' );
4344 $this->mDest = $request->getVal( 'dest' );
@@ -45,7 +46,7 @@
4647 $this->mTargetID = intval( $request->getVal( 'targetID' ) );
4748 $this->mDestID = intval( $request->getVal( 'destID' ) );
4849 $this->mTimestamp = $request->getVal( 'mergepoint' );
49 - if( !preg_match("/[0-9]{14}/",$this->mTimestamp) ) {
 50+ if( !preg_match( '/[0-9]{14}/', $this->mTimestamp ) ) {
5051 $this->mTimestamp = '';
5152 }
5253 $this->mComment = $request->getText( 'wpComment' );
@@ -73,7 +74,7 @@
7475 }
7576 }
7677
77 - function execute( $par ) {
 78+ public function execute( $par ) {
7879 global $wgOut, $wgRequest, $wgUser;
7980
8081 if ( wfReadOnly() ) {
@@ -91,7 +92,7 @@
9293 $this->setHeaders();
9394 $this->outputHeader();
9495
95 - if( $this->mTargetID && $this->mDestID && $this->mAction=="submit" && $this->mMerge ) {
 96+ if( $this->mTargetID && $this->mDestID && $this->mAction == 'submit' && $this->mMerge ) {
9697 return $this->merge();
9798 }
9899
@@ -109,7 +110,7 @@
110111 );
111112 }
112113
113 - if ( !$this->mDestObj instanceof Title) {
 114+ if ( !$this->mDestObj instanceof Title ) {
114115 $errors[] = wfMsgExt( 'mergehistory-invalid-destination', array( 'parse' ) );
115116 } elseif( !$this->mDestObj->exists() ) {
116117 $errors[] = wfMsgExt( 'mergehistory-no-destination', array( 'parse' ),
@@ -146,18 +147,19 @@
147148 Html::hidden( 'submitted', '1' ) .
148149 Html::hidden( 'mergepoint', $this->mTimestamp ) .
149150 Xml::openElement( 'table' ) .
150 - "<tr>
151 - <td>".Xml::label( wfMsg( 'mergehistory-from' ), 'target' )."</td>
152 - <td>".Xml::input( 'target', 30, $this->mTarget, array('id'=>'target') )."</td>
 151+ '<tr>
 152+ <td>' . Xml::label( wfMsg( 'mergehistory-from' ), 'target' ) . '</td>
 153+ <td>' . Xml::input( 'target', 30, $this->mTarget, array( 'id' => 'target' ) ) . '</td>
153154 </tr><tr>
154 - <td>".Xml::label( wfMsg( 'mergehistory-into' ), 'dest' )."</td>
155 - <td>".Xml::input( 'dest', 30, $this->mDest, array('id'=>'dest') )."</td>
156 - </tr><tr><td>" .
 155+ <td>' . Xml::label( wfMsg( 'mergehistory-into' ), 'dest' ) . '</td>
 156+ <td>' . Xml::input( 'dest', 30, $this->mDest, array( 'id' => 'dest' ) ) . '</td>
 157+ </tr><tr><td>' .
157158 Xml::submitButton( wfMsg( 'mergehistory-go' ) ) .
158 - "</td></tr>" .
 159+ '</td></tr>' .
159160 Xml::closeElement( 'table' ) .
160161 '</fieldset>' .
161 - '</form>' );
 162+ '</form>'
 163+ );
162164 }
163165
164166 private function showHistory() {
@@ -165,18 +167,27 @@
166168
167169 $this->sk = $wgUser->getSkin();
168170
169 - $wgOut->setPagetitle( wfMsg( "mergehistory" ) );
 171+ $wgOut->setPageTitle( wfMsg( 'mergehistory' ) );
170172
171173 $this->showMergeForm();
172174
173175 # List all stored revisions
174 - $revisions = new MergeHistoryPager( $this, array(), $this->mTargetObj, $this->mDestObj );
 176+ $revisions = new MergeHistoryPager(
 177+ $this, array(), $this->mTargetObj, $this->mDestObj
 178+ );
175179 $haveRevisions = $revisions && $revisions->getNumRows() > 0;
176180
177181 $titleObj = $this->getTitle();
178182 $action = $titleObj->getLocalURL( array( 'action' => 'submit' ) );
179183 # Start the form here
180 - $top = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'merge' ) );
 184+ $top = Xml::openElement(
 185+ 'form',
 186+ array(
 187+ 'method' => 'post',
 188+ 'action' => $action,
 189+ 'id' => 'merge'
 190+ )
 191+ );
181192 $wgOut->addHTML( $top );
182193
183194 if( $haveRevisions ) {
@@ -184,43 +195,46 @@
185196 # in a nice little table
186197 $table =
187198 Xml::openElement( 'fieldset' ) .
188 - wfMsgExt( 'mergehistory-merge', array('parseinline'),
 199+ wfMsgExt( 'mergehistory-merge', array( 'parseinline' ),
189200 $this->mTargetObj->getPrefixedText(), $this->mDestObj->getPrefixedText() ) .
190201 Xml::openElement( 'table', array( 'id' => 'mw-mergehistory-table' ) ) .
191 - "<tr>
192 - <td class='mw-label'>" .
 202+ '<tr>
 203+ <td class="mw-label">' .
193204 Xml::label( wfMsg( 'mergehistory-reason' ), 'wpComment' ) .
194 - "</td>
195 - <td class='mw-input'>" .
196 - Xml::input( 'wpComment', 50, $this->mComment, array('id' => 'wpComment') ) .
197 - "</td>
 205+ '</td>
 206+ <td class="mw-input">' .
 207+ Xml::input( 'wpComment', 50, $this->mComment, array( 'id' => 'wpComment' ) ) .
 208+ '</td>
198209 </tr>
199210 <tr>
200211 <td>&#160;</td>
201 - <td class='mw-submit'>" .
 212+ <td class="mw-submit">' .
202213 Xml::submitButton( wfMsg( 'mergehistory-submit' ), array( 'name' => 'merge', 'id' => 'mw-merge-submit' ) ) .
203 - "</td>
204 - </tr>" .
 214+ '</td>
 215+ </tr>' .
205216 Xml::closeElement( 'table' ) .
206217 Xml::closeElement( 'fieldset' );
207218
208219 $wgOut->addHTML( $table );
209220 }
210221
211 - $wgOut->addHTML( "<h2 id=\"mw-mergehistory\">" . wfMsgHtml( "mergehistory-list" ) . "</h2>\n" );
 222+ $wgOut->addHTML(
 223+ '<h2 id="mw-mergehistory">' .
 224+ wfMsgHtml( 'mergehistory-list' ) . "</h2>\n"
 225+ );
212226
213227 if( $haveRevisions ) {
214228 $wgOut->addHTML( $revisions->getNavigationBar() );
215 - $wgOut->addHTML( "<ul>" );
 229+ $wgOut->addHTML( '<ul>' );
216230 $wgOut->addHTML( $revisions->getBody() );
217 - $wgOut->addHTML( "</ul>" );
 231+ $wgOut->addHTML( '</ul>' );
218232 $wgOut->addHTML( $revisions->getNavigationBar() );
219233 } else {
220 - $wgOut->addWikiMsg( "mergehistory-empty" );
 234+ $wgOut->addWikiMsg( 'mergehistory-empty' );
221235 }
222236
223237 # Show relevant lines from the deletion log:
224 - $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'merge' ) ) . "</h2>\n" );
 238+ $wgOut->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'merge' ) ) . "</h2>\n" );
225239 LogEventsList::showLogExtract( $wgOut, 'merge', $this->mTargetObj->getPrefixedText() );
226240
227241 # When we submit, go by page ID to avoid some nasty but unlikely collisions.
@@ -245,7 +259,7 @@
246260 $last = $this->message['last'];
247261
248262 $ts = wfTimestamp( TS_MW, $row->rev_timestamp );
249 - $checkBox = Xml::radio( "mergepoint", $ts, false );
 263+ $checkBox = Xml::radio( 'mergepoint', $ts, false );
250264
251265 $pageLink = $this->sk->linkKnown(
252266 $rev->getTitle(),
@@ -258,9 +272,9 @@
259273 }
260274
261275 # Last link
262 - if( !$rev->userCan( Revision::DELETED_TEXT ) )
 276+ if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
263277 $last = $this->message['last'];
264 - else if( isset($this->prevId[$row->rev_id]) )
 278+ } elseif( isset( $this->prevId[$row->rev_id] ) ) {
265279 $last = $this->sk->linkKnown(
266280 $rev->getTitle(),
267281 $this->message['last'],
@@ -270,10 +284,12 @@
271285 'oldid' => $this->prevId[$row->rev_id]
272286 )
273287 );
 288+ }
274289
275290 $userLink = $this->sk->revUserTools( $rev );
276291
277 - if(!is_null($size = $row->rev_len)) {
 292+ $size = $row->rev_len;
 293+ if( !is_null( $size ) ) {
278294 $stxt = $this->sk->formatRevisionSize( $size );
279295 }
280296 $comment = $this->sk->revComment( $rev );
@@ -288,8 +304,9 @@
289305 function getPageLink( $row, $titleObj, $ts, $target ) {
290306 global $wgLang;
291307
292 - if( !$this->userCan($row, Revision::DELETED_TEXT) ) {
293 - return '<span class="history-deleted">' . $wgLang->timeanddate( $ts, true ) . '</span>';
 308+ if( !$this->userCan( $row, Revision::DELETED_TEXT ) ) {
 309+ return '<span class="history-deleted">' .
 310+ $wgLang->timeanddate( $ts, true ) . '</span>';
294311 } else {
295312 $link = $this->sk->linkKnown(
296313 $titleObj,
@@ -300,8 +317,9 @@
301318 'timestamp' => $ts
302319 )
303320 );
304 - if( $this->isDeleted($row, Revision::DELETED_TEXT) )
 321+ if( $this->isDeleted( $row, Revision::DELETED_TEXT ) ) {
305322 $link = '<span class="history-deleted">' . $link . '</span>';
 323+ }
306324 return $link;
307325 }
308326 }
@@ -313,63 +331,80 @@
314332 # keep it consistent...
315333 $targetTitle = Title::newFromID( $this->mTargetID );
316334 $destTitle = Title::newFromID( $this->mDestID );
317 - if( is_null($targetTitle) || is_null($destTitle) )
 335+ if( is_null( $targetTitle ) || is_null( $destTitle ) ) {
318336 return false; // validate these
319 - if( $targetTitle->getArticleId() == $destTitle->getArticleId() )
 337+ }
 338+ if( $targetTitle->getArticleId() == $destTitle->getArticleId() ) {
320339 return false;
 340+ }
321341 # Verify that this timestamp is valid
322342 # Must be older than the destination page
323343 $dbw = wfGetDB( DB_MASTER );
324344 # Get timestamp into DB format
325 - $this->mTimestamp = $this->mTimestamp ? $dbw->timestamp($this->mTimestamp) : '';
 345+ $this->mTimestamp = $this->mTimestamp ? $dbw->timestamp( $this->mTimestamp ) : '';
326346 # Max timestamp should be min of destination page
327 - $maxtimestamp = $dbw->selectField( 'revision', 'MIN(rev_timestamp)',
328 - array('rev_page' => $this->mDestID ),
329 - __METHOD__ );
 347+ $maxtimestamp = $dbw->selectField(
 348+ 'revision',
 349+ 'MIN(rev_timestamp)',
 350+ array( 'rev_page' => $this->mDestID ),
 351+ __METHOD__
 352+ );
330353 # Destination page must exist with revisions
331354 if( !$maxtimestamp ) {
332 - $wgOut->addWikiMsg('mergehistory-fail');
 355+ $wgOut->addWikiMsg( 'mergehistory-fail' );
333356 return false;
334357 }
335358 # Get the latest timestamp of the source
336 - $lasttimestamp = $dbw->selectField( array('page','revision'),
 359+ $lasttimestamp = $dbw->selectField(
 360+ array( 'page', 'revision' ),
337361 'rev_timestamp',
338 - array('page_id' => $this->mTargetID, 'page_latest = rev_id' ),
339 - __METHOD__ );
 362+ array( 'page_id' => $this->mTargetID, 'page_latest = rev_id' ),
 363+ __METHOD__
 364+ );
340365 # $this->mTimestamp must be older than $maxtimestamp
341366 if( $this->mTimestamp >= $maxtimestamp ) {
342 - $wgOut->addWikiMsg('mergehistory-fail');
 367+ $wgOut->addWikiMsg( 'mergehistory-fail' );
343368 return false;
344369 }
345370 # Update the revisions
346371 if( $this->mTimestamp ) {
347372 $timewhere = "rev_timestamp <= {$this->mTimestamp}";
348 - $TimestampLimit = wfTimestamp(TS_MW,$this->mTimestamp);
 373+ $timestampLimit = wfTimestamp( TS_MW, $this->mTimestamp );
349374 } else {
350375 $timewhere = "rev_timestamp <= {$maxtimestamp}";
351 - $TimestampLimit = wfTimestamp(TS_MW,$lasttimestamp);
 376+ $timestampLimit = wfTimestamp( TS_MW, $lasttimestamp );
352377 }
353378 # Do the moving...
354 - $dbw->update( 'revision',
 379+ $dbw->update(
 380+ 'revision',
355381 array( 'rev_page' => $this->mDestID ),
356 - array( 'rev_page' => $this->mTargetID,
357 - $timewhere ),
358 - __METHOD__ );
 382+ array( 'rev_page' => $this->mTargetID, $timewhere ),
 383+ __METHOD__
 384+ );
359385
360386 $count = $dbw->affectedRows();
361387 # Make the source page a redirect if no revisions are left
362 - $haveRevisions = $dbw->selectField( 'revision',
 388+ $haveRevisions = $dbw->selectField(
 389+ 'revision',
363390 'rev_timestamp',
364391 array( 'rev_page' => $this->mTargetID ),
365392 __METHOD__,
366 - array( 'FOR UPDATE' ) );
 393+ array( 'FOR UPDATE' )
 394+ );
367395 if( !$haveRevisions ) {
368396 if( $this->mComment ) {
369 - $comment = wfMsgForContent( 'mergehistory-comment', $targetTitle->getPrefixedText(),
370 - $destTitle->getPrefixedText(), $this->mComment );
 397+ $comment = wfMsgForContent(
 398+ 'mergehistory-comment',
 399+ $targetTitle->getPrefixedText(),
 400+ $destTitle->getPrefixedText(),
 401+ $this->mComment
 402+ );
371403 } else {
372 - $comment = wfMsgForContent( 'mergehistory-autocomment', $targetTitle->getPrefixedText(),
373 - $destTitle->getPrefixedText() );
 404+ $comment = wfMsgForContent(
 405+ 'mergehistory-autocomment',
 406+ $targetTitle->getPrefixedText(),
 407+ $destTitle->getPrefixedText()
 408+ );
374409 }
375410 $mwRedir = MagicWord::get( 'redirect' );
376411 $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $destTitle->getPrefixedText() . "]]\n";
@@ -389,22 +424,26 @@
390425 'pl_from' => $this->mDestID,
391426 'pl_namespace' => $destTitle->getNamespace(),
392427 'pl_title' => $destTitle->getDBkey() ),
393 - __METHOD__ );
 428+ __METHOD__
 429+ );
394430 } else {
395431 $targetTitle->invalidateCache(); // update histories
396432 }
397433 $destTitle->invalidateCache(); // update histories
398434 # Check if this did anything
399435 if( !$count ) {
400 - $wgOut->addWikiMsg('mergehistory-fail');
 436+ $wgOut->addWikiMsg( 'mergehistory-fail' );
401437 return false;
402438 }
403439 # Update our logs
404440 $log = new LogPage( 'merge' );
405 - $log->addEntry( 'merge', $targetTitle, $this->mComment,
406 - array($destTitle->getPrefixedText(),$TimestampLimit) );
 441+ $log->addEntry(
 442+ 'merge', $targetTitle, $this->mComment,
 443+ array( $destTitle->getPrefixedText(), $timestampLimit )
 444+ );
407445
408 - $wgOut->addHTML( wfMsgExt( 'mergehistory-success', array('parseinline'),
 446+ $wgOut->addHTML(
 447+ wfMsgExt( 'mergehistory-success', array('parseinline'),
409448 $targetTitle->getPrefixedText(), $destTitle->getPrefixedText(), $count ) );
410449
411450 wfRunHooks( 'ArticleMergeComplete', array( $targetTitle, $destTitle ) );
@@ -423,9 +462,12 @@
424463 $this->articleID = $source->getArticleID();
425464
426465 $dbr = wfGetDB( DB_SLAVE );
427 - $maxtimestamp = $dbr->selectField( 'revision', 'MIN(rev_timestamp)',
428 - array('rev_page' => $dest->getArticleID() ),
429 - __METHOD__ );
 466+ $maxtimestamp = $dbr->selectField(
 467+ 'revision',
 468+ 'MIN(rev_timestamp)',
 469+ array( 'rev_page' => $dest->getArticleID() ),
 470+ __METHOD__
 471+ );
430472 $this->maxTimestamp = $maxtimestamp;
431473
432474 parent::__construct();
@@ -442,11 +484,12 @@
443485 $batch->addObj( Title::makeTitleSafe( NS_USER, $row->rev_user_text ) );
444486 $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->rev_user_text ) );
445487
446 - $rev_id = isset($rev_id) ? $rev_id : $row->rev_id;
447 - if( $rev_id > $row->rev_id )
 488+ $rev_id = isset( $rev_id ) ? $rev_id : $row->rev_id;
 489+ if( $rev_id > $row->rev_id ) {
448490 $this->mForm->prevId[$rev_id] = $row->rev_id;
449 - else if( $rev_id < $row->rev_id )
 491+ } elseif( $rev_id < $row->rev_id ) {
450492 $this->mForm->prevId[$row->rev_id] = $rev_id;
 493+ }
451494
452495 $rev_id = $row->rev_id;
453496 }
@@ -468,9 +511,12 @@
469512 $conds[] = 'page_id = rev_page';
470513 $conds[] = "rev_timestamp < {$this->maxTimestamp}";
471514 return array(
472 - 'tables' => array('revision','page'),
473 - 'fields' => array( 'rev_minor_edit', 'rev_timestamp', 'rev_user', 'rev_user_text', 'rev_comment',
474 - 'rev_id', 'rev_page', 'rev_parent_id', 'rev_text_id', 'rev_len', 'rev_deleted' ),
 515+ 'tables' => array( 'revision', 'page' ),
 516+ 'fields' => array(
 517+ 'rev_minor_edit', 'rev_timestamp', 'rev_user', 'rev_user_text',
 518+ 'rev_comment', 'rev_id', 'rev_page', 'rev_parent_id',
 519+ 'rev_text_id', 'rev_len', 'rev_deleted'
 520+ ),
475521 'conds' => $conds
476522 );
477523 }
Index: trunk/phase3/includes/Cookie.php
@@ -42,7 +42,7 @@
4343 if ( isset( $attr['path'] ) ) {
4444 $this->path = $attr['path'];
4545 } else {
46 - $this->path = "/";
 46+ $this->path = '/';
4747 }
4848
4949 if ( isset( $attr['domain'] ) ) {
@@ -50,7 +50,7 @@
5151 $this->domain = $attr['domain'];
5252 }
5353 } else {
54 - throw new MWException( "You must specify a domain." );
 54+ throw new MWException( 'You must specify a domain.' );
5555 }
5656 }
5757
@@ -68,7 +68,7 @@
6969 */
7070 public static function validateCookieDomain( $domain, $originDomain = null ) {
7171 // Don't allow a trailing dot
72 - if ( substr( $domain, -1 ) == "." ) {
 72+ if ( substr( $domain, -1 ) == '.' ) {
7373 return false;
7474 }
7575
@@ -96,20 +96,20 @@
9797 || ( count( $dc ) == 3 && strlen( $dc[0] ) == "" && strlen( $dc[1] ) <= 2 ) ) {
9898 return false;
9999 }
100 - if ( ( count( $dc ) == 2 || ( count( $dc ) == 3 && $dc[0] == "" ) )
 100+ if ( ( count( $dc ) == 2 || ( count( $dc ) == 3 && $dc[0] == '' ) )
101101 && preg_match( '/(com|net|org|gov|edu)\...$/', $domain ) ) {
102102 return false;
103103 }
104104 }
105105
106106 if ( $originDomain != null ) {
107 - if ( substr( $domain, 0, 1 ) != "." && $domain != $originDomain ) {
 107+ if ( substr( $domain, 0, 1 ) != '.' && $domain != $originDomain ) {
108108 return false;
109109 }
110110
111 - if ( substr( $domain, 0, 1 ) == "."
 111+ if ( substr( $domain, 0, 1 ) == '.'
112112 && substr_compare( $originDomain, $domain, -strlen( $domain ),
113 - strlen( $domain ), TRUE ) != 0 ) {
 113+ strlen( $domain ), true ) != 0 ) {
114114 return false;
115115 }
116116 }
@@ -125,12 +125,12 @@
126126 * @return String
127127 */
128128 public function serializeToHttpRequest( $path, $domain ) {
129 - $ret = "";
 129+ $ret = '';
130130
131131 if ( $this->canServeDomain( $domain )
132132 && $this->canServePath( $path )
133133 && $this->isUnExpired() ) {
134 - $ret = $this->name . "=" . $this->value;
 134+ $ret = $this->name . '=' . $this->value;
135135 }
136136
137137 return $ret;
@@ -139,9 +139,9 @@
140140 protected function canServeDomain( $domain ) {
141141 if ( $domain == $this->domain
142142 || ( strlen( $domain ) > strlen( $this->domain )
143 - && substr( $this->domain, 0, 1 ) == "."
 143+ && substr( $this->domain, 0, 1 ) == '.'
144144 && substr_compare( $domain, $this->domain, -strlen( $this->domain ),
145 - strlen( $this->domain ), TRUE ) == 0 ) ) {
 145+ strlen( $this->domain ), true ) == 0 ) ) {
146146 return true;
147147 }
148148
@@ -199,7 +199,7 @@
200200 }
201201 }
202202
203 - return implode( "; ", $cookies );
 203+ return implode( '; ', $cookies );
204204 }
205205
206206 /**
@@ -209,20 +209,20 @@
210210 * @param $domain String: cookie's domain
211211 */
212212 public function parseCookieResponseHeader ( $cookie, $domain ) {
213 - $len = strlen( "Set-Cookie:" );
 213+ $len = strlen( 'Set-Cookie:' );
214214
215 - if ( substr_compare( "Set-Cookie:", $cookie, 0, $len, TRUE ) === 0 ) {
 215+ if ( substr_compare( 'Set-Cookie:', $cookie, 0, $len, true ) === 0 ) {
216216 $cookie = substr( $cookie, $len );
217217 }
218218
219 - $bit = array_map( 'trim', explode( ";", $cookie ) );
 219+ $bit = array_map( 'trim', explode( ';', $cookie ) );
220220
221221 if ( count( $bit ) >= 1 ) {
222 - list( $name, $value ) = explode( "=", array_shift( $bit ), 2 );
 222+ list( $name, $value ) = explode( '=', array_shift( $bit ), 2 );
223223 $attr = array();
224224
225225 foreach ( $bit as $piece ) {
226 - $parts = explode( "=", $piece );
 226+ $parts = explode( '=', $piece );
227227 if ( count( $parts ) > 1 ) {
228228 $attr[strtolower( $parts[0] )] = $parts[1];
229229 } else {
Index: trunk/phase3/languages/LanguageConverter.php
@@ -35,7 +35,12 @@
3636 var $mTables;
3737 // 'bidirectional' 'unidirectional' 'disable' for each variant
3838 var $mManualLevel;
 39+
 40+ /**
 41+ * @var String: memcached key name
 42+ */
3943 var $mCacheKey;
 44+
4045 var $mLangObj;
4146 var $mFlags;
4247 var $mDescCodeSep = ':', $mDescVarSep = ';';
@@ -52,17 +57,15 @@
5358 /**
5459 * Constructor
5560 *
56 - * @param $langobj Language The Language Object
 61+ * @param $langobj Language: the Language Object
5762 * @param $maincode String: the main language code of this language
5863 * @param $variants Array: the supported variants of this language
5964 * @param $variantfallbacks Array: the fallback language of each variant
6065 * @param $flags Array: defining the custom strings that maps to the flags
6166 * @param $manualLevel Array: limit for supported variants
6267 */
63 - public function __construct( $langobj, $maincode,
64 - $variants = array(),
65 - $variantfallbacks = array(),
66 - $flags = array(),
 68+ public function __construct( $langobj, $maincode, $variants = array(),
 69+ $variantfallbacks = array(), $flags = array(),
6770 $manualLevel = array() ) {
6871 global $wgDisabledVariants, $wgLanguageNames;
6972 $this->mLangObj = $langobj;
@@ -82,7 +85,7 @@
8386 'D' => 'D', // convert description (subclass implement)
8487 '-' => '-', // remove convert (not implement)
8588 'H' => 'H', // add rule for convert code
86 - // (but no display in placed code )
 89+ // (but no display in placed code)
8790 'N' => 'N' // current variant name
8891 );
8992 $this->mFlags = array_merge( $defaultflags, $flags );
@@ -143,9 +146,7 @@
144147
145148 if ( $wgUser->isLoggedIn() && !$req ) {
146149 $req = $this->getUserVariant();
147 - }
148 -
149 - elseif ( !$req ) {
 150+ } elseif ( !$req ) {
150151 $req = $this->getHeaderVariant();
151152 }
152153
@@ -189,8 +190,7 @@
190191 * @return Mixed: returns the variant if it is valid, null otherwise
191192 */
192193 protected function validateVariant( $variant = null ) {
193 - if ( $variant !== null &&
194 - in_array( $variant, $this->mVariants ) ) {
 194+ if ( $variant !== null && in_array( $variant, $this->mVariants ) ) {
195195 return $variant;
196196 }
197197 return null;
@@ -227,17 +227,18 @@
228228 global $wgUser;
229229
230230 // memoizing this function wreaks havoc on parserTest.php
231 - /* if ( $this->mUserVariant ) { */
232 - /* return $this->mUserVariant; */
233 - /* } */
 231+ /*
 232+ if ( $this->mUserVariant ) {
 233+ return $this->mUserVariant;
 234+ }
 235+ */
234236
235 - // get language variant preference from logged in users
 237+ // Get language variant preference from logged in users
236238 // Don't call this on stub objects because that causes infinite
237239 // recursion during initialisation
238240 if ( $wgUser->isLoggedIn() ) {
239241 $ret = $wgUser->getOption( 'variant' );
240 - }
241 - else {
 242+ } else {
242243 // figure out user lang without constructing wgLang to avoid
243244 // infinite recursion
244245 $ret = $wgUser->getOption( 'language' );
@@ -259,13 +260,13 @@
260261 }
261262
262263 // see if some supported language variant is set in the
263 - // http header.
 264+ // HTTP header.
264265 $languages = array_keys( $wgRequest->getAcceptLang() );
265266 if ( empty( $languages ) ) {
266267 return null;
267268 }
268269
269 - $fallback_languages = array();
 270+ $fallbackLanguages = array();
270271 foreach ( $languages as $language ) {
271272 $this->mHeaderVariant = $this->validateVariant( $language );
272273 if ( $this->mHeaderVariant ) {
@@ -277,18 +278,17 @@
278279 // them later.
279280 $fallbacks = $this->getVariantFallbacks( $language );
280281 if ( is_string( $fallbacks ) ) {
281 - $fallback_languages[] = $fallbacks;
 282+ $fallbackLanguages[] = $fallbacks;
282283 } elseif ( is_array( $fallbacks ) ) {
283 - $fallback_languages =
284 - array_merge( $fallback_languages,
285 - $fallbacks );
 284+ $fallbackLanguages =
 285+ array_merge( $fallbackLanguages, $fallbacks );
286286 }
287287 }
288288
289289 if ( !$this->mHeaderVariant ) {
290290 // process fallback languages now
291 - $fallback_languages = array_unique( $fallback_languages );
292 - foreach ( $fallback_languages as $language ) {
 291+ $fallback_languages = array_unique( $fallbackLanguages );
 292+ foreach ( $fallbackLanguages as $language ) {
293293 $this->mHeaderVariant = $this->validateVariant( $language );
294294 if ( $this->mHeaderVariant ) {
295295 break;
@@ -323,9 +323,9 @@
324324 }
325325
326326 /* we convert everything except:
327 - 1. html markups (anything between < and >)
328 - 2. html entities
329 - 3. place holders created by the parser
 327+ 1. HTML markups (anything between < and >)
 328+ 2. HTML entities
 329+ 3. placeholders created by the parser
330330 */
331331 global $wgParser;
332332 if ( isset( $wgParser ) && $wgParser->UniqPrefix() != '' ) {
@@ -334,7 +334,7 @@
335335 $marker = '';
336336 }
337337
338 - // this one is needed when the text is inside an html markup
 338+ // this one is needed when the text is inside an HTML markup
339339 $htmlfix = '|<[^>]+$|^[^<>]*>';
340340
341341 // disable convert to variants between <code></code> tags
@@ -372,7 +372,7 @@
373373
374374 // Translate any alt or title attributes inside the matched element
375375 if ( $element !== '' && preg_match( '/^(<[^>\s]*)\s([^>]*)(.*)$/', $element,
376 - $elementMatches ) )
 376+ $elementMatches ) )
377377 {
378378 $attrs = Sanitizer::decodeTagAttributes( $elementMatches[2] );
379379 $changed = false;
@@ -517,8 +517,8 @@
518518 * Auto convert a Title object to a readable string in the
519519 * preferred variant.
520520 *
521 - *@param $title Object: a object of Title
522 - *@return String: converted title text
 521+ * @param $title Object: a object of Title
 522+ * @return String: converted title text
523523 */
524524 public function convertTitle( $title ) {
525525 $variant = $this->getPreferredVariant();
@@ -571,7 +571,9 @@
572572 */
573573 public function convertTo( $text, $variant ) {
574574 global $wgDisableLangConversion;
575 - if ( $wgDisableLangConversion ) return $text;
 575+ if ( $wgDisableLangConversion ) {
 576+ return $text;
 577+ }
576578 return $this->recursiveConvertTopLevel( $text, $variant );
577579 }
578580
@@ -687,10 +689,9 @@
688690 }
689691
690692 /**
691 - * If a language supports multiple variants, it is
692 - * possible that non-existing link in one variant
693 - * actually exists in another variant. This function
694 - * tries to find it. See e.g. LanguageZh.php
 693+ * If a language supports multiple variants, it is possible that
 694+ * non-existing link in one variant actually exists in another variant.
 695+ * This function tries to find it. See e.g. LanguageZh.php
695696 *
696697 * @param $link String: the name of the link
697698 * @param $nt Mixed: the title object of the link
@@ -764,7 +765,7 @@
765766 */
766767 public function getExtraHashOptions() {
767768 $variant = $this->getPreferredVariant();
768 - return '!' . $variant ;
 769+ return '!' . $variant;
769770 }
770771
771772 /**
@@ -781,8 +782,9 @@
782783 /**
783784 * Load conversion tables either from the cache or the disk.
784785 * @private
 786+ * @param $fromCache Boolean: load from memcached? Defaults to true.
785787 */
786 - function loadTables( $fromcache = true ) {
 788+ function loadTables( $fromCache = true ) {
787789 if ( $this->mTablesLoaded ) {
788790 return;
789791 }
@@ -790,7 +792,7 @@
791793 wfProfileIn( __METHOD__ );
792794 $this->mTablesLoaded = true;
793795 $this->mTables = false;
794 - if ( $fromcache ) {
 796+ if ( $fromCache ) {
795797 wfProfileIn( __METHOD__ . '-cache' );
796798 $this->mTables = $wgMemc->get( $this->mCacheKey );
797799 wfProfileOut( __METHOD__ . '-cache' );
@@ -799,8 +801,8 @@
800802 || !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) {
801803 wfProfileIn( __METHOD__ . '-recache' );
802804 // not in cache, or we need a fresh reload.
803 - // we will first load the default tables
804 - // then update them using things in MediaWiki:Zhconversiontable/*
 805+ // We will first load the default tables
 806+ // then update them using things in MediaWiki:Conversiontable/*
805807 $this->loadDefaultTables();
806808 foreach ( $this->mVariants as $var ) {
807809 $cached = $this->parseCachedTable( $var );
@@ -817,8 +819,7 @@
818820 }
819821
820822 /**
821 - * Hook for post processig after conversion tables are loaded.
822 - *
 823+ * Hook for post processing after conversion tables are loaded.
823824 */
824825 function postLoadTables() { }
825826
@@ -835,7 +836,6 @@
836837 $this->loadTables( false );
837838 }
838839
839 -
840840 /**
841841 * Parse the conversion table stored in the cache.
842842 *
@@ -846,9 +846,12 @@
847847 * ...
848848 * }-
849849 *
850 - * To make the tables more manageable, subpages are allowed
851 - * and will be parsed recursively if $recursive == true.
 850+ * To make the tables more manageable, subpages are allowed
 851+ * and will be parsed recursively if $recursive == true.
852852 *
 853+ * @param $code String: language code
 854+ * @param $subpage String: subpage name
 855+ * @param $recursive Boolean: parse subpages recursively? Defaults to true.
853856 */
854857 function parseCachedTable( $code, $subpage = '', $recursive = true ) {
855858 static $parsed = array();
@@ -869,8 +872,10 @@
870873 $txt = '&lt;Conversiontable&gt;';
871874 }
872875 } else {
873 - $title = Title::makeTitleSafe( NS_MEDIAWIKI,
874 - "Conversiontable/$code" );
 876+ $title = Title::makeTitleSafe(
 877+ NS_MEDIAWIKI,
 878+ "Conversiontable/$code"
 879+ );
875880 if ( $title && $title->exists() ) {
876881 $article = new Article( $title );
877882 $txt = $article->getContents();
@@ -880,7 +885,7 @@
881886 }
882887
883888 // get all subpage links of the form
884 - // [[MediaWiki:conversiontable/zh-xx/...|...]]
 889+ // [[MediaWiki:Conversiontable/zh-xx/...|...]]
885890 $linkhead = $this->mLangObj->getNsText( NS_MEDIAWIKI ) .
886891 ':Conversiontable';
887892 $subs = StringUtils::explode( '[[', $txt );
@@ -919,8 +924,9 @@
920925 $table = StringUtils::explode( ';', $stripped );
921926 foreach ( $table as $t ) {
922927 $m = explode( '=>', $t, 3 );
923 - if ( count( $m ) != 2 )
 928+ if ( count( $m ) != 2 ) {
924929 continue;
 930+ }
925931 // trim any trailling comments starting with '//'
926932 $tt = explode( '//', $m[1], 2 );
927933 $ret[trim( $m[0] )] = trim( $tt[0] );
@@ -949,7 +955,7 @@
950956 * various functions in the Parser.
951957 *
952958 * @param $text String: text to be tagged for no conversion
953 - * @param $noParse Unused (?)
 959+ * @param $noParse Boolean: unused
954960 * @return String: the tagged text
955961 */
956962 public function markNoConversion( $text, $noParse = false ) {
@@ -972,11 +978,22 @@
973979
974980 /**
975981 * Hook to refresh the cache of conversion tables when
976 - * MediaWiki:conversiontable* is updated.
 982+ * MediaWiki:Conversiontable* is updated.
977983 * @private
 984+ *
 985+ * @param $article Object: Article object
 986+ * @param $user Object: User object for the current user
 987+ * @param $text String: article text (?)
 988+ * @param $summary String: edit summary of the edit
 989+ * @param $isMinor Boolean: was the edit marked as minor?
 990+ * @param $isWatch Boolean: did the user watch this page or not?
 991+ * @param $section Unused
 992+ * @param $flags Bitfield
 993+ * @param $revision Object: new Revision object or null
 994+ * @return Boolean: true
978995 */
979 - function OnArticleSaveComplete( $article, $user, $text, $summary, $isminor,
980 - $iswatch, $section, $flags, $revision ) {
 996+ function OnArticleSaveComplete( $article, $user, $text, $summary, $isMinor,
 997+ $isWatch, $section, $flags, $revision ) {
981998 $titleobj = $article->getTitle();
982999 if ( $titleobj->getNamespace() == NS_MEDIAWIKI ) {
9831000 $title = $titleobj->getDBkey();
@@ -993,7 +1010,11 @@
9941011
9951012 /**
9961013 * Armour rendered math against conversion.
997 - * Escape special chars in parsed math text.(in most cases are img elements)
 1014+ * Escape special chars in parsed math text. (in most cases are img elements)
 1015+ *
 1016+ * @param $text String: text to armour against conversion
 1017+ * @return String: armoured text where { and } have been converted to
 1018+ * &#123; and &#125;
9981019 */
9991020 public function armourMath( $text ) {
10001021 // convert '-{' and '}-' to '-&#123;' and '&#125;-' to prevent
@@ -1295,7 +1316,7 @@
12961317 }
12971318 $vmarked[] = $v;
12981319 }
1299 - /*for unidirectional array fill to convert tables */
 1320+ /* for unidirectional array fill to convert tables */
13001321 if ( ( $manLevel[$v] == 'bidirectional' || $manLevel[$v] == 'unidirectional' )
13011322 && isset( $unidtable[$v] ) )
13021323 {
@@ -1310,9 +1331,9 @@
13111332
13121333 /**
13131334 * Parse rules and flags.
1314 - * @public
 1335+ * @param $variant String: variant language code
13151336 */
1316 - function parse( $variant = NULL ) {
 1337+ public function parse( $variant = null ) {
13171338 if ( !$variant ) {
13181339 $variant = $this->mConverter->getPreferredVariant();
13191340 }
@@ -1415,58 +1436,52 @@
14161437 }
14171438
14181439 /**
1419 - * @public
 1440+ * @todo FIXME: code this function :)
14201441 */
1421 - function hasRules() {
 1442+ public function hasRules() {
14221443 // TODO:
14231444 }
14241445
14251446 /**
14261447 * Get display text on markup -{...}-
1427 - * @public
14281448 */
1429 - function getDisplay() {
 1449+ public function getDisplay() {
14301450 return $this->mRuleDisplay;
14311451 }
14321452
14331453 /**
14341454 * Get converted title.
1435 - * @public
14361455 */
1437 - function getTitle() {
 1456+ public function getTitle() {
14381457 return $this->mRuleTitle;
14391458 }
14401459
14411460 /**
14421461 * Return how deal with conversion rules.
1443 - * @public
14441462 */
1445 - function getRulesAction() {
 1463+ public function getRulesAction() {
14461464 return $this->mRulesAction;
14471465 }
14481466
14491467 /**
1450 - * Get conversion table. ( bidirectional and unidirectional
1451 - * conversion table )
1452 - * @public
 1468+ * Get conversion table. (bidirectional and unidirectional
 1469+ * conversion table)
14531470 */
1454 - function getConvTable() {
 1471+ public function getConvTable() {
14551472 return $this->mConvTable;
14561473 }
14571474
14581475 /**
14591476 * Get conversion rules string.
1460 - * @public
14611477 */
1462 - function getRules() {
 1478+ public function getRules() {
14631479 return $this->mRules;
14641480 }
14651481
14661482 /**
14671483 * Get conversion flags.
1468 - * @public
14691484 */
1470 - function getFlags() {
 1485+ public function getFlags() {
14711486 return $this->mFlags;
14721487 }
14731488 }

Status & tagging log