r97060 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97059‎ | r97060 | r97061 >
Date:15:07, 14 September 2011
Author:reedy
Status:ok
Tags:
Comment:
Whitespace/documentation
Modified paths:
  • /trunk/extensions/Cite/Cite_body.php (modified) (history)
  • /trunk/phase3/includes/Message.php (modified) (history)
  • /trunk/phase3/includes/cache/MessageCache.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/MessageTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/MessageTest.php
@@ -47,7 +47,7 @@
4848 $this->assertEquals( 'Main Page', wfMessage( 'mainpage' )->inContentLanguage()->plain(), 'ForceUIMsg disabled' );
4949 $wgForceUIMsgAsContentMsg['testInContentLanguage'] = 'mainpage';
5050 $this->assertEquals( 'Accueil', wfMessage( 'mainpage' )->inContentLanguage()->plain(), 'ForceUIMsg enabled' );
51 -
 51+
5252 /* Restore globals */
5353 $wgLang = $oldLang;
5454 unset( $wgForceUIMsgAsContentMsg['testInContentLanguage'] );
Index: trunk/phase3/includes/parser/Parser.php
@@ -5292,7 +5292,7 @@
52935293 * not found, $mode=get will return $newtext, and $mode=replace will return $text.
52945294 *
52955295 * Section 0 is always considered to exist, even if it only contains the empty
5296 - * string. If $text is the empty string and section 0 is replaced, $newText is
 5296+ * string. If $text is the empty string and section 0 is replaced, $newText is
52975297 * returned.
52985298 *
52995299 * @param $mode String: one of "get" or "replace"
@@ -5427,7 +5427,7 @@
54285428
54295429 /**
54305430 * This function returns $oldtext after the content of the section
5431 - * specified by $section has been replaced with $text. If the target
 5431+ * specified by $section has been replaced with $text. If the target
54325432 * section does not exist, $oldtext is returned unchanged.
54335433 *
54345434 * @param $oldtext String: former text of the article
Index: trunk/phase3/includes/cache/MessageCache.php
@@ -544,6 +544,8 @@
545545 /**
546546 * Represents a write lock on the messages key
547547 *
 548+ * @param $key string
 549+ *
548550 * @return Boolean: success
549551 */
550552 function lock( $key ) {
@@ -576,6 +578,8 @@
577579 * fallback).
578580 * @param $isFullKey Boolean: specifies whether $key is a two part key
579581 * "msg/lang".
 582+ *
 583+ * @return string|false
580584 */
581585 function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
582586 global $wgLanguageCode, $wgContLang;
@@ -677,6 +681,8 @@
678682 *
679683 * @param $title String: Message cache key with initial uppercase letter.
680684 * @param $code String: code denoting the language to try.
 685+ *
 686+ * @return string|false
681687 */
682688 function getMsgFromNamespace( $title, $code ) {
683689 global $wgAdaptiveMessageCache;
@@ -795,10 +801,9 @@
796802
797803 /**
798804 * @param $text string
799 - * @param $string Title|string
800805 * @param $title Title
 806+ * @param $linestart bool
801807 * @param $interface bool
802 - * @param $linestart bool
803808 * @param $language
804809 * @return ParserOutput
805810 */
@@ -859,6 +864,10 @@
860865 $this->mLoadedLanguages = array();
861866 }
862867
 868+ /**
 869+ * @param $key
 870+ * @return array
 871+ */
863872 public function figureMessage( $key ) {
864873 global $wgLanguageCode;
865874 $pieces = explode( '/', $key );
@@ -916,6 +925,9 @@
917926 wfProfileOut( __METHOD__ );
918927 }
919928
 929+ /**
 930+ * @return array
 931+ */
920932 public function getMostUsedMessages() {
921933 wfProfileIn( __METHOD__ );
922934 $cachekey = wfMemcKey( 'message-profiling' );
Index: trunk/phase3/includes/Message.php
@@ -11,7 +11,7 @@
1212 * $button = Xml::button( wfMessage( 'submit' )->text() );
1313 * </pre>
1414 * Messages can have parameters:
15 - * wfMessage( 'welcome-to' )->params( $wgSitename )->text();
 15+ * wfMessage( 'welcome-to' )->params( $wgSitename )->text();
1616 * {{GRAMMAR}} and friends work correctly
1717 * wfMessage( 'are-friends', $user, $friend );
1818 * wfMessage( 'bad-message' )->rawParams( '<script>...</script>' )->escaped();
@@ -60,7 +60,7 @@
6161 * means the current interface language, false content language.
6262 */
6363 protected $interface = true;
64 -
 64+
6565 /**
6666 * In which language to get this message. Overrides the $interface
6767 * variable.
@@ -68,7 +68,7 @@
6969 * @var Language
7070 */
7171 protected $language = null;
72 -
 72+
7373 /**
7474 * The message key.
7575 */
@@ -101,6 +101,11 @@
102102 protected $title = null;
103103
104104 /**
 105+ * @var string
 106+ */
 107+ protected $message;
 108+
 109+ /**
105110 * Constructor.
106111 * @param $key: message key, or array of message keys to try and use the first non-empty message for
107112 * @param $params Array message parameters
@@ -181,7 +186,7 @@
182187 }
183188 return $this;
184189 }
185 -
 190+
186191 /**
187192 * Add parameters that are numeric and will be passed through
188193 * Language::formatNum before substitution
@@ -198,7 +203,7 @@
199204 }
200205 return $this;
201206 }
202 -
 207+
203208 /**
204209 * Request the message in any language that is supported.
205210 * As a side effect interface message status is unconditionally
@@ -216,7 +221,7 @@
217222 } else {
218223 $type = gettype( $lang );
219224 throw new MWException( __METHOD__ . " must be "
220 - . "passed a String or Language object; $type given"
 225+ . "passed a String or Language object; $type given"
221226 );
222227 }
223228 $this->interface = false;
@@ -268,10 +273,10 @@
269274 */
270275 public function toString() {
271276 $string = $this->getMessageText();
272 -
 277+
273278 # Replace parameters before text parsing
274279 $string = $this->replaceParameters( $string, 'before' );
275 -
 280+
276281 # Maybe transform using the full parser
277282 if( $this->format === 'parse' ) {
278283 $string = $this->parseText( $string );
@@ -287,10 +292,10 @@
288293 $string = $this->transformText( $string );
289294 $string = htmlspecialchars( $string, ENT_QUOTES, 'UTF-8', false );
290295 }
291 -
 296+
292297 # Raw parameter replacement
293298 $string = $this->replaceParameters( $string, 'after' );
294 -
 299+
295300 return $string;
296301 }
297302
@@ -303,7 +308,7 @@
304309 public function __toString() {
305310 return $this->toString();
306311 }
307 -
 312+
308313 /**
309314 * Fully parse the text from wikitext to HTML
310315 * @return String parsed HTML
Index: trunk/extensions/Cite/Cite_body.php
@@ -71,7 +71,7 @@
7272 * @var int
7373 */
7474 var $mInCnt = 0;
75 -
 75+
7676 /**
7777 * Counter to track the total number of (useful) calls to either the
7878 * ref or references tag hook
@@ -617,9 +617,9 @@
618618
619619 /**
620620 * Make output to be returned from the references() function
621 - *
 621+ *
622622 * @param $group
623 - *
 623+ *
624624 * @return string XHTML ready for output
625625 */
626626 function referencesFormat( $group ) {
@@ -1020,11 +1020,11 @@
10211021 *
10221022 * @return bool
10231023 */
1024 - function clearState( $parser ) {
 1024+ function clearState( &$parser ) {
10251025 if ( $parser->extCite !== $this ) {
10261026 return $parser->extCite->clearState( $parser );
10271027 }
1028 -
 1028+
10291029 # Don't clear state when we're in the middle of parsing
10301030 # a <ref> tag
10311031 if ( $this->mInCite || $this->mInReferences ) {
@@ -1055,7 +1055,7 @@
10561056 if ( $parser->extCite !== $this ) {
10571057 return $parser->extCite->checkRefsNoReferences( $parser, $text );
10581058 }
1059 -
 1059+
10601060 if ( $parser->getOptions()->getIsSectionPreview() ) {
10611061 return true;
10621062 }
@@ -1073,13 +1073,13 @@
10741074 }
10751075 return true;
10761076 }
1077 -
 1077+
10781078 /**
10791079 * Hook for the InlineEditor extension. If any ref or reference reference tag is in the text, the entire
10801080 * page should be reparsed, so we return false in that case.
10811081 *
10821082 * @param $output
1083 - *
 1083+ *
10841084 * @return bool
10851085 */
10861086 function checkAnyCalls( &$output ) {
@@ -1099,7 +1099,7 @@
11001100 global $wgHooks;
11011101
11021102 $parser->extCite = new self();
1103 -
 1103+
11041104 if ( !Cite::$hooksInstalled ) {
11051105 $wgHooks['ParserClearState'][] = array( $parser->extCite, 'clearState' );
11061106 $wgHooks['ParserBeforeTidy'][] = array( $parser->extCite, 'checkRefsNoReferences' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r97082Merged revisions 97057,97060,97071,97073-97074,97077-97080 via svnmerge from...dantman18:11, 14 September 2011

Status & tagging log