* $button = Xml::button( wfMessage( 'submit' )->text() );
* </pre>
* Messages can have parameters:
- * wfMessage( 'welcome-to' )->params( $wgSitename )->text();
+ * wfMessage( 'welcome-to' )->params( $wgSitename )->text();
* {{GRAMMAR}} and friends work correctly
* wfMessage( 'are-friends', $user, $friend );
* wfMessage( 'bad-message' )->rawParams( '<script>...</script>' )->escaped();
* means the current interface language, false content language.
*/
protected $interface = true;
-
+
/**
* In which language to get this message. Overrides the $interface
* variable.
* @var Language
*/
protected $language = null;
-
+
/**
* The message key.
*/
*/
protected $title = null;
+ /**
+ * @var string
+ */
+ protected $message;
+
/**
* Constructor.
* @param $key: message key, or array of message keys to try and use the first non-empty message for
}
return $this;
}
-
+
/**
* Add parameters that are numeric and will be passed through
* Language::formatNum before substitution
}
return $this;
}
-
+
/**
* Request the message in any language that is supported.
* As a side effect interface message status is unconditionally
} else {
$type = gettype( $lang );
throw new MWException( __METHOD__ . " must be "
- . "passed a String or Language object; $type given"
+ . "passed a String or Language object; $type given"
);
}
$this->interface = false;
*/
public function toString() {
$string = $this->getMessageText();
-
+
# Replace parameters before text parsing
$string = $this->replaceParameters( $string, 'before' );
-
+
# Maybe transform using the full parser
if( $this->format === 'parse' ) {
$string = $this->parseText( $string );
$string = $this->transformText( $string );
$string = htmlspecialchars( $string, ENT_QUOTES, 'UTF-8', false );
}
-
+
# Raw parameter replacement
$string = $this->replaceParameters( $string, 'after' );
-
+
return $string;
}
public function __toString() {
return $this->toString();
}
-
+
/**
* Fully parse the text from wikitext to HTML
* @return String parsed HTML
/**
* Represents a write lock on the messages key
*
+ * @param $key string
+ *
* @return Boolean: success
*/
function lock( $key ) {
* fallback).
* @param $isFullKey Boolean: specifies whether $key is a two part key
* "msg/lang".
+ *
+ * @return string|false
*/
function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
global $wgLanguageCode, $wgContLang;
*
* @param $title String: Message cache key with initial uppercase letter.
* @param $code String: code denoting the language to try.
+ *
+ * @return string|false
*/
function getMsgFromNamespace( $title, $code ) {
global $wgAdaptiveMessageCache;
/**
* @param $text string
- * @param $string Title|string
* @param $title Title
- * @param $interface bool
* @param $linestart bool
+ * @param $interface bool
* @param $language
* @return ParserOutput
*/
$this->mLoadedLanguages = array();
}
+ /**
+ * @param $key
+ * @return array
+ */
public function figureMessage( $key ) {
global $wgLanguageCode;
$pieces = explode( '/', $key );
wfProfileOut( __METHOD__ );
}
+ /**
+ * @return array
+ */
public function getMostUsedMessages() {
wfProfileIn( __METHOD__ );
$cachekey = wfMemcKey( 'message-profiling' );
* not found, $mode=get will return $newtext, and $mode=replace will return $text.
*
* Section 0 is always considered to exist, even if it only contains the empty
- * string. If $text is the empty string and section 0 is replaced, $newText is
+ * string. If $text is the empty string and section 0 is replaced, $newText is
* returned.
*
* @param $mode String: one of "get" or "replace"
/**
* This function returns $oldtext after the content of the section
- * specified by $section has been replaced with $text. If the target
+ * specified by $section has been replaced with $text. If the target
* section does not exist, $oldtext is returned unchanged.
*
* @param $oldtext String: former text of the article