1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-10-27 20:34:16 +00:00

Xomw: Add paramVal methods to XomwMessage

This commit is contained in:
gnosygnu 2017-04-05 07:07:27 -04:00
parent 1ba6f094e3
commit 0d1b478aa2
3 changed files with 338 additions and 365 deletions

View File

@ -30,8 +30,8 @@ public class Xoa_app_ {
} }
} }
public static final String Name = "xowa"; public static final String Name = "xowa";
public static final int Version_id = 522; public static final int Version_id = 523;
public static final String Version = "4.5.1.1703"; public static final String Version = "4.5.2.1703";
public static String Build_date = "2012-12-30 00:00:00"; public static String Build_date = "2012-12-30 00:00:00";
public static String Build_date_fmt = "yyyy-MM-dd HH:mm:ss"; public static String Build_date_fmt = "yyyy-MM-dd HH:mm:ss";
public static String Op_sys_str; public static String Op_sys_str;

View File

@ -66,7 +66,7 @@ public class Wdata_prop_val_visitor implements Wbase_claim_visitor { // THREAD.U
// if label is still not found, don't add null reference // if label is still not found, don't add null reference
if (label != null) { if (label != null) {
// if statements, add "[[entity_val]]" // if statements, add "[[entity_val]]"; DATE:2017-04-04
if (mode_is_statements) { if (mode_is_statements) {
bfr.Add(gplx.xowa.parsers.tmpls.Xop_tkn_.Lnki_bgn); bfr.Add(gplx.xowa.parsers.tmpls.Xop_tkn_.Lnki_bgn);
bfr.Add(label); bfr.Add(label);

View File

@ -165,8 +165,8 @@ public class XomwMessage {
private static final int FORMAT_NULL = 5; private static final int FORMAT_NULL = 5;
// private static final int PRM_TID_BEFORE = 1; // "before" private static final int PRM_TID_BEFORE = 1; // "before"
// private static final int PRM_TID_AFTER = 2; // "after" private static final int PRM_TID_AFTER = 2; // "after"
/** /**
* Mapping from Message::listParam() types to Language methods. * Mapping from Message::listParam() types to Language methods.
@ -240,6 +240,7 @@ public class XomwMessage {
this.language = null; this.key = null; this.keysToTry = null; this.message = null; this.language = null; this.key = null; this.keysToTry = null; this.message = null;
Tfds.Write(interfaceIsUserLang, language, key, keysToTry, format, useDatabase, title, message, listTypeMap, parameters); Tfds.Write(interfaceIsUserLang, language, key, keysToTry, format, useDatabase, title, message, listTypeMap, parameters);
Tfds.Write(FORMAT_BLOCK_PARSE, FORMAT_ESCAPED, FORMAT_PARSE, FORMAT_PLAIN, FORMAT_TEXT); Tfds.Write(FORMAT_BLOCK_PARSE, FORMAT_ESCAPED, FORMAT_PARSE, FORMAT_PLAIN, FORMAT_TEXT);
this.extractParam(null, null, 0);
} }
public XomwMessage(byte[] textBry) { public XomwMessage(byte[] textBry) {
this.textBry = textBry; this.textBry = textBry;
@ -339,22 +340,22 @@ public class XomwMessage {
// public function getKeysToTry() { // public function getKeysToTry() {
// return this.keysToTry; // return this.keysToTry;
// } // }
//
// /** /**
// * Returns the message key. * Returns the message key.
// * *
// * If a list of multiple possible keys was supplied to the constructor, this method may * If a list of multiple possible keys was supplied to the constructor, this method may
// * return any of these keys. After the message has been fetched, this method will return * return any of these keys. After the message has been fetched, this method will return
// * the key that was actually used to fetch the message. * the key that was actually used to fetch the message.
// * *
// * @since 1.21 * @since 1.21
// * *
// * @return String * @return String
// */ */
// public function getKey() { public byte[] getKey() {
// return this.key; return this.key;
// } }
//
// /** // /**
// * Returns the message parameters. // * Returns the message parameters.
// * // *
@ -502,7 +503,7 @@ public class XomwMessage {
// * @param mixed ... Parameters as strings or arrays from // * @param mixed ... Parameters as strings or arrays from
// * Message::numParam() and the like, or a single array of parameters. // * Message::numParam() and the like, or a single array of parameters.
// * // *
// * @return Message $this // * @return Message this
// */ // */
// public function prmsVar(/*...*/) { // public function prmsVar(/*...*/) {
// $args = func_get_args(); // $args = func_get_args();
@ -525,189 +526,157 @@ public class XomwMessage {
// } // }
// //
// this.parameters = array_merge(this.parameters, array_values($args)); // this.parameters = array_merge(this.parameters, array_values($args));
// return $this; // return this;
// } // }
//
// /** /**
// * Add parameters that are substituted after parsing or escaping. * Add parameters that are substituted after parsing or escaping.
// * In other words the parsing process cannot access the contents * In other words the parsing process cannot access the contents
// * of this type of parameter, and you need to make sure it is * of this type of parameter, and you need to make sure it is
// * sanitized beforehand. The parser will see "$n", instead. * sanitized beforehand. The parser will see "$n", instead.
// * *
// * @since 1.17 * @since 1.17
// * *
// * @param mixed $prmsVar,... Raw parameters as strings, or a single argument that is * @param mixed $prmsVar,... Raw parameters as strings, or a single argument that is
// * an array of raw parameters. * an array of raw parameters.
// * *
// * @return Message $this * @return Message this
// */ */
// public function rawParams(/*...*/) { public XomwMessage rawParams(byte[]... prmsAry) {
// $prmsVar = func_get_args(); for (byte[] prmsVar : prmsAry) {
// if (isset($prmsVar[0]) && is_array($prmsVar[0])) { this.parameters.Add(XomwMessage.rawParam(prmsVar));
// $prmsVar = $prmsVar[0]; }
// } return this;
// foreach ($prmsVar as $param) { }
// this.parameters[] = self::rawParam($param);
// } /**
// return $this; * Add parameters that are numeric and will be passed through
// } * Language::formatNum before substitution
// *
// /** * @since 1.18
// * Add parameters that are numeric and will be passed through *
// * Language::formatNum before substitution * @param mixed $param,... Numeric parameters, or a single argument that is
// * * an array of numeric parameters.
// * @since 1.18 *
// * * @return Message this
// * @param mixed $param,... Numeric parameters, or a single argument that is */
// * an array of numeric parameters. public XomwMessage numParams(int... prmsAry) {
// * for (int prmsVar : prmsAry) {
// * @return Message $this this.parameters.Add(XomwMessage.numParam(prmsVar));
// */ }
// public function numParams(/*...*/) { return this;
// $prmsVar = func_get_args(); }
// if (isset($prmsVar[0]) && is_array($prmsVar[0])) {
// $prmsVar = $prmsVar[0]; /**
// } * Add parameters that are durations of time and will be passed through
// foreach ($prmsVar as $param) { * Language::formatDuration before substitution
// this.parameters[] = self::numParam($param); *
// } * @since 1.22
// return $this; *
// } * @param int|int[] $param,... Duration parameters, or a single argument that is
// * an array of duration parameters.
// /** *
// * Add parameters that are durations of time and will be passed through * @return Message this
// * Language::formatDuration before substitution */
// * public XomwMessage durationParams(int... prmsAry) {
// * @since 1.22 for (int prmsVar : prmsAry) {
// * this.parameters.Add(XomwMessage.durationParam(prmsVar));
// * @param int|int[] $param,... Duration parameters, or a single argument that is }
// * an array of duration parameters. return this;
// * }
// * @return Message $this
// */ /**
// public function durationParams(/*...*/) { * Add parameters that are expiration times and will be passed through
// $prmsVar = func_get_args(); * Language::formatExpiry before substitution
// if (isset($prmsVar[0]) && is_array($prmsVar[0])) { *
// $prmsVar = $prmsVar[0]; * @since 1.22
// } *
// foreach ($prmsVar as $param) { * @param String|String[] $param,... Expiry parameters, or a single argument that is
// this.parameters[] = self::durationParam($param); * an array of expiry parameters.
// } *
// return $this; * @return Message this
// } */
// public XomwMessage expiryParams(byte[]... prmsAry) {
// /** for (byte[] prmsVar : prmsAry) {
// * Add parameters that are expiration times and will be passed through this.parameters.Add(XomwMessage.expiryParam(prmsVar));
// * Language::formatExpiry before substitution }
// * return this;
// * @since 1.22 }
// *
// * @param String|String[] $param,... Expiry parameters, or a single argument that is /**
// * an array of expiry parameters. * Add parameters that are time periods and will be passed through
// * * Language::formatTimePeriod before substitution
// * @return Message $this *
// */ * @since 1.22
// public function expiryParams(/*...*/) { *
// $prmsVar = func_get_args(); * @param int|int[] $param,... Time period parameters, or a single argument that is
// if (isset($prmsVar[0]) && is_array($prmsVar[0])) { * an array of time period parameters.
// $prmsVar = $prmsVar[0]; *
// } * @return Message this
// foreach ($prmsVar as $param) { */
// this.parameters[] = self::expiryParam($param); public XomwMessage timeperiodParams(int... prmsAry) {
// } for (int prmsVar : prmsAry) {
// return $this; this.parameters.Add(XomwMessage.timeperiodParam(prmsVar));
// } }
// return this;
// /** }
// * Add parameters that are time periods and will be passed through
// * Language::formatTimePeriod before substitution /**
// * * Add parameters that are file sizes and will be passed through
// * @since 1.22 * Language::formatSize before substitution
// * *
// * @param int|int[] $param,... Time period parameters, or a single argument that is * @since 1.22
// * an array of time period parameters. *
// * * @param int|int[] $param,... Size parameters, or a single argument that is
// * @return Message $this * an array of size parameters.
// */ *
// public function timeperiodParams(/*...*/) { * @return Message this
// $prmsVar = func_get_args(); */
// if (isset($prmsVar[0]) && is_array($prmsVar[0])) { public XomwMessage sizeParams(int... prmsAry) {
// $prmsVar = $prmsVar[0]; for (int prmsVar : prmsAry) {
// } this.parameters.Add(XomwMessage.sizeParam(prmsVar));
// foreach ($prmsVar as $param) { }
// this.parameters[] = self::timeperiodParam($param); return this;
// } }
// return $this;
// } /**
// * Add parameters that are bitrates and will be passed through
// /** * Language::formatBitrate before substitution
// * Add parameters that are file sizes and will be passed through *
// * Language::formatSize before substitution * @since 1.22
// * *
// * @since 1.22 * @param int|int[] $param,... Bit rate parameters, or a single argument that is
// * * an array of bit rate parameters.
// * @param int|int[] $param,... Size parameters, or a single argument that is *
// * an array of size parameters. * @return Message this
// * */
// * @return Message $this public XomwMessage bitrateParams(int... prmsAry) {
// */ for (int prmsVar : prmsAry) {
// public function sizeParams(/*...*/) { this.parameters.Add(XomwMessage.bitrateParam(prmsVar));
// $prmsVar = func_get_args(); }
// if (isset($prmsVar[0]) && is_array($prmsVar[0])) { return this;
// $prmsVar = $prmsVar[0]; }
// }
// foreach ($prmsVar as $param) { /**
// this.parameters[] = self::sizeParam($param); * Add parameters that are plaintext and will be passed through without
// } * the content being evaluated. Plaintext parameters are not valid as
// return $this; * arguments to parser functions. This differs from XomwMessage.rawParams in
// } * that the Message cls handles escaping to match the output format.
// *
// /** * @since 1.25
// * Add parameters that are bitrates and will be passed through *
// * Language::formatBitrate before substitution * @param String|String[] $param,... plaintext parameters, or a single argument that is
// * * an array of plaintext parameters.
// * @since 1.22 *
// * * @return Message this
// * @param int|int[] $param,... Bit rate parameters, or a single argument that is */
// * an array of bit rate parameters. public XomwMessage plaintextParams(byte[]... prmsAry) {
// * for (byte[] prmsVar : prmsAry) {
// * @return Message $this this.parameters.Add(XomwMessage.plaintextParam(prmsVar));
// */ }
// public function bitrateParams(/*...*/) { return this;
// $prmsVar = func_get_args(); }
// if (isset($prmsVar[0]) && is_array($prmsVar[0])) {
// $prmsVar = $prmsVar[0];
// }
// foreach ($prmsVar as $param) {
// this.parameters[] = self::bitrateParam($param);
// }
// return $this;
// }
//
// /**
// * Add parameters that are plaintext and will be passed through without
// * the content being evaluated. Plaintext parameters are not valid as
// * arguments to parser functions. This differs from self::rawParams in
// * that the Message cls handles escaping to match the output format.
// *
// * @since 1.25
// *
// * @param String|String[] $param,... plaintext parameters, or a single argument that is
// * an array of plaintext parameters.
// *
// * @return Message $this
// */
// public function plaintextParams(/*...*/) {
// $prmsVar = func_get_args();
// if (isset($prmsVar[0]) && is_array($prmsVar[0])) {
// $prmsVar = $prmsVar[0];
// }
// foreach ($prmsVar as $param) {
// this.parameters[] = self::plaintextParam($param);
// }
// return $this;
// }
//
// /** // /**
// * Set the language and the title from a context Object // * Set the language and the title from a context Object
// * // *
@ -715,14 +684,14 @@ public class XomwMessage {
// * // *
// * @param IContextSource $context // * @param IContextSource $context
// * // *
// * @return Message $this // * @return Message this
// */ // */
// public function setContext(IContextSource $context) { // public function setContext(IContextSource $context) {
// this.inLanguage($context->getLanguage()); // this.inLanguage($context->getLanguage());
// this.title($context->getTitle()); // this.title($context->getTitle());
// this.interfaceIsUserLang = true; // this.interfaceIsUserLang = true;
// //
// return $this; // return this;
// } // }
// //
// /** // /**
@ -733,7 +702,7 @@ public class XomwMessage {
// * // *
// * @since 1.17 // * @since 1.17
// * @param Language|String $lang Language code or Language Object. // * @param Language|String $lang Language code or Language Object.
// * @return Message $this // * @return Message this
// * @throws MWException // * @throws MWException
// */ // */
// public function inLanguage($lang) { // public function inLanguage($lang) {
@ -753,7 +722,7 @@ public class XomwMessage {
// } // }
// this.message = null; // this.message = null;
// this.interfaceIsUserLang = false; // this.interfaceIsUserLang = false;
// return $this; // return this;
// } // }
/** /**
@ -763,17 +732,17 @@ public class XomwMessage {
* @since 1.17 * @since 1.17
* @see $wgForceUIMsgAsContentMsg * @see $wgForceUIMsgAsContentMsg
* *
* @return Message $this * @return Message this
*/ */
public XomwMessage inContentLanguage() { public XomwMessage inContentLanguage() {
// global $wgForceUIMsgAsContentMsg; // global $wgForceUIMsgAsContentMsg;
// if (in_array(this.key, (array)$wgForceUIMsgAsContentMsg)) { // if (in_array(this.key, (array)$wgForceUIMsgAsContentMsg)) {
// return $this; // return this;
// } // }
// //
// global $wgContLang; // global $wgContLang;
// this.inLanguage($wgContLang); // this.inLanguage($wgContLang);
// return $this; // return this;
return this; return this;
} }
@ -785,11 +754,11 @@ public class XomwMessage {
// * // *
// * @param boolean $interfaceIsUserLang // * @param boolean $interfaceIsUserLang
// * // *
// * @return Message $this // * @return Message this
// */ // */
// public function setInterfaceMessageFlag($interfaceIsUserLang) { // public function setInterfaceMessageFlag($interfaceIsUserLang) {
// this.interfaceIsUserLang = (boolean)$interfaceIsUserLang; // this.interfaceIsUserLang = (boolean)$interfaceIsUserLang;
// return $this; // return this;
// } // }
// //
// /** // /**
@ -799,12 +768,12 @@ public class XomwMessage {
// * // *
// * @param boolean $useDatabase // * @param boolean $useDatabase
// * // *
// * @return Message $this // * @return Message this
// */ // */
// public function useDatabase($useDatabase) { // public function useDatabase($useDatabase) {
// this.useDatabase = (boolean)$useDatabase; // this.useDatabase = (boolean)$useDatabase;
// this.message = null; // this.message = null;
// return $this; // return this;
// } // }
// //
// /** // /**
@ -814,11 +783,11 @@ public class XomwMessage {
// * // *
// * @param Title title // * @param Title title
// * // *
// * @return Message $this // * @return Message this
// */ // */
// public function title(title) { // public function title(title) {
// this.title = title; // this.title = title;
// return $this; // return this;
// } // }
/** /**
@ -912,7 +881,7 @@ public class XomwMessage {
// // trigger a fatal error if it does. So, catch any exceptions. // // trigger a fatal error if it does. So, catch any exceptions.
// //
// try { // try {
// return this.toString(self::FORMAT_PARSE); // return this.toString(XomwMessage.FORMAT_PARSE);
// } catch (Exception $ex) { // } catch (Exception $ex) {
// try { // try {
// trigger_error("Exception caught in " . __METHOD__ . " (message " . this.key . "): " // trigger_error("Exception caught in " . __METHOD__ . " (message " . this.key . "): "
@ -933,8 +902,8 @@ public class XomwMessage {
// * @return String Parsed HTML. // * @return String Parsed HTML.
// */ // */
// public function parse() { // public function parse() {
// this.format = self::FORMAT_PARSE; // this.format = XomwMessage.FORMAT_PARSE;
// return this.toString(self::FORMAT_PARSE); // return this.toString(XomwMessage.FORMAT_PARSE);
// } // }
/** /**
@ -957,8 +926,8 @@ public class XomwMessage {
// * @return String Unescaped untransformed message text. // * @return String Unescaped untransformed message text.
// */ // */
// public function plain() { // public function plain() {
// this.format = self::FORMAT_PLAIN; // this.format = XomwMessage.FORMAT_PLAIN;
// return this.toString(self::FORMAT_PLAIN); // return this.toString(XomwMessage.FORMAT_PLAIN);
// } // }
// //
// /** // /**
@ -969,8 +938,8 @@ public class XomwMessage {
// * @return String HTML // * @return String HTML
// */ // */
// public function parseAsBlock() { // public function parseAsBlock() {
// this.format = self::FORMAT_BLOCK_PARSE; // this.format = XomwMessage.FORMAT_BLOCK_PARSE;
// return this.toString(self::FORMAT_BLOCK_PARSE); // return this.toString(XomwMessage.FORMAT_BLOCK_PARSE);
// } // }
// //
// /** // /**
@ -982,8 +951,8 @@ public class XomwMessage {
// * @return String Escaped message text. // * @return String Escaped message text.
// */ // */
// public function escaped() { // public function escaped() {
// this.format = self::FORMAT_ESCAPED; // this.format = XomwMessage.FORMAT_ESCAPED;
// return this.toString(self::FORMAT_ESCAPED); // return this.toString(XomwMessage.FORMAT_ESCAPED);
// } // }
// //
// /** // /**
@ -1021,109 +990,109 @@ public class XomwMessage {
// $message = this.fetchMessage(); // $message = this.fetchMessage();
// return $message === false || $message === '' || $message === '-'; // return $message === false || $message === '' || $message === '-';
// } // }
//
// /** /**
// * @since 1.17 * @since 1.17
// * *
// * @param mixed $raw * @param mixed $raw
// * *
// * @return array Array with a single "raw" key. * @return array Array with a single "raw" key.
// */ */
// public static function rawParam($raw) { private static XomwMessagePrm_raw rawParam(byte[] raw) {
// return [ 'raw' => $raw ]; return new XomwMessagePrm_raw(raw);
// } }
//
// /** /**
// * @since 1.18 * @since 1.18
// * *
// * @param mixed $num * @param mixed $num
// * *
// * @return array Array with a single "num" key. * @return array Array with a single "num" key.
// */ */
// public static function numParam($num) { private static XomwMessagePrm_num numParam(int num) {
// return [ 'num' => $num ]; return new XomwMessagePrm_num(num);
// } }
//
// /** /**
// * @since 1.22 * @since 1.22
// * *
// * @param int $duration * @param int $duration
// * *
// * @return int[] Array with a single "duration" key. * @return int[] Array with a single "duration" key.
// */ */
// public static function durationParam($duration) { private static XomwMessagePrm_duration durationParam(int duration) {
// return [ 'duration' => $duration ]; return new XomwMessagePrm_duration(duration);
// } }
//
// /** /**
// * @since 1.22 * @since 1.22
// * *
// * @param String $expiry * @param String $expiry
// * *
// * @return String[] Array with a single "expiry" key. * @return String[] Array with a single "expiry" key.
// */ */
// public static function expiryParam($expiry) { private static XomwMessagePrm_expiry expiryParam(byte[] expiry) {
// return [ 'expiry' => $expiry ]; return new XomwMessagePrm_expiry(expiry);
// } }
//
// /** /**
// * @since 1.22 * @since 1.22
// * *
// * @param int $period * @param int $period
// * *
// * @return int[] Array with a single "period" key. * @return int[] Array with a single "period" key.
// */ */
// public static function timeperiodParam($period) { private static XomwMessagePrm_period timeperiodParam(int period) {
// return [ 'period' => $period ]; return new XomwMessagePrm_period(period);
// } }
//
// /** /**
// * @since 1.22 * @since 1.22
// * *
// * @param int $size * @param int $size
// * *
// * @return int[] Array with a single "size" key. * @return int[] Array with a single "size" key.
// */ */
// public static function sizeParam($size) { private static XomwMessagePrm_size sizeParam(int size) {
// return [ 'size' => $size ]; return new XomwMessagePrm_size(size);
// } }
//
// /** /**
// * @since 1.22 * @since 1.22
// * *
// * @param int $bitrate * @param int $bitrate
// * *
// * @return int[] Array with a single "bitrate" key. * @return int[] Array with a single "bitrate" key.
// */ */
// public static function bitrateParam($bitrate) { private static XomwMessagePrm_bitrate bitrateParam(int bitrate) {
// return [ 'bitrate' => $bitrate ]; return new XomwMessagePrm_bitrate(bitrate);
// } }
//
// /** /**
// * @since 1.25 * @since 1.25
// * *
// * @param String $plaintext * @param String $plaintext
// * *
// * @return String[] Array with a single "plaintext" key. * @return String[] Array with a single "plaintext" key.
// */ */
// public static function plaintextParam($plaintext) { private static XomwMessagePrm_plaintext plaintextParam(byte[] plaintext) {
// return [ 'plaintext' => $plaintext ]; return new XomwMessagePrm_plaintext(plaintext);
// } }
//
// /** /**
// * @since 1.29 * @since 1.29
// * *
// * @param array $list * @param array $list
// * @param String $type 'comma', 'semicolon', 'pipe', 'text' * @param String $type 'comma', 'semicolon', 'pipe', 'text'
// * @return array Array with "list" and "type" keys. * @return array Array with "list" and "type" keys.
// */ */
// public static function listParam(array $list, $type = 'text') { // private static XomwMessagePrm_list listParam(byte[][] list, String type) { // array $list, $type = 'text'
// if (!isset(self::$listTypeMap[$type])) { // if (!listTypeMap.Has(type)) {
// throw new InvalidArgumentException( // throw new XophpInvalidArgumentException(
// "Invalid type '$type'. Known types are: " . join(', ', array_keys(self::$listTypeMap)) // "Invalid type " + type
// ); // );
// } // }
// return [ 'list' => $list, 'type' => $type ]; // return new XomwMessagePrm_list(list, type);
// } // }
/** /**
@ -1161,37 +1130,39 @@ public class XomwMessage {
* *
* @return array Array with the parameter type (either "before" or "after") and the value. * @return array Array with the parameter type (either "before" or "after") and the value.
*/ */
// private void extractParam(XomwMessageVal rv, Object param, int format) { private void extractParam(XomwMessageVal rv, Object param, int format) {
// if (is_array($param)) { if (Type_adp_.Implements_intf_obj(param, XomwMessagePrm.class)) {
// if (isset($param['raw'])) { XomwMessagePrm prm = (XomwMessagePrm)param;
// return [ 'after', $param['raw'] ]; if (prm.Tid() == XomwMessagePrm.Tid__raw) {
// } elseif (isset($param['num'])) { rv.Set(PRM_TID_AFTER, ((XomwMessagePrm_raw)prm).raw);
// // Replace number prmsVar always in before step for now. }
// // No support for combined raw and num prmsVar else if (prm.Tid() == XomwMessagePrm.Tid__num) {
// return [ 'before', this.getLanguage()->formatNum($param['num']) ]; // Replace number prmsVar always in before step for now.
// } elseif (isset($param['duration'])) { // No support for combined raw and num prmsVar
// return [ 'before', this.getLanguage()->formatDuration($param['duration']) ]; // return [PRM_TID_BEFORE, this.getLanguage()->formatNum($param['num']) ];
}
// elseif (isset($param['duration'])) {
// return [PRM_TID_BEFORE, this.getLanguage()->formatDuration($param['duration']) ];
// } elseif (isset($param['expiry'])) { // } elseif (isset($param['expiry'])) {
// return [ 'before', this.getLanguage()->formatExpiry($param['expiry']) ]; // return [PRM_TID_BEFORE, this.getLanguage()->formatExpiry($param['expiry']) ];
// } elseif (isset($param['period'])) { // } elseif (isset($param['period'])) {
// return [ 'before', this.getLanguage()->formatTimePeriod($param['period']) ]; // return [PRM_TID_BEFORE, this.getLanguage()->formatTimePeriod($param['period']) ];
// } elseif (isset($param['size'])) { // } elseif (isset($param['size'])) {
// return [ 'before', this.getLanguage()->formatSize($param['size']) ]; // return [PRM_TID_BEFORE, this.getLanguage()->formatSize($param['size']) ];
// } elseif (isset($param['bitrate'])) { // } elseif (isset($param['bitrate'])) {
// return [ 'before', this.getLanguage()->formatBitrate($param['bitrate']) ]; // return [PRM_TID_BEFORE, this.getLanguage()->formatBitrate($param['bitrate']) ];
// } elseif (isset($param['plaintext'])) { // } elseif (isset($param['plaintext'])) {
// return [ 'after', this.formatPlaintext($param['plaintext'], $format) ]; // return [PRM_TID_AFTER, this.formatPlaintext($param['plaintext'], $format) ];
// } elseif (isset($param['list'])) { // } elseif (isset($param['list'])) {
// return this.formatListParam($param['list'], $param['type'], $format); // return this.formatListParam($param['list'], $param['type'], $format);
// } else {
// $warning = 'Invalid parameter for message "' . this.getKey() . '": ' .
// htmlspecialchars(serialize($param));
// trigger_error($warning, E_USER_WARNING);
// $e = new Exception;
// wfDebugLog('Bug58676', $warning . "\n" . $e->getTraceAsString());
//
// return [ 'before', '[INVALID]' ];
// } // }
else {
String warning = "Invalid parameter for message '" + this.getKey() + "': " +
prm.toString();
Gfo_usr_dlg_.Instance.Warn_many("", "", warning);
rv.Set(PRM_TID_BEFORE, Bry_.new_a7("[INVALID]"));
}
// } // }
// else if ($param instanceof Message) { // else if ($param instanceof Message) {
// // Match language, flags, etc. to the current message. // // Match language, flags, etc. to the current message.
@ -1214,12 +1185,12 @@ public class XomwMessage {
// // Message objects should not be before parameters because // // Message objects should not be before parameters because
// // then they'll get double escaped. If the message needs to be // // then they'll get double escaped. If the message needs to be
// // escaped, it'll happen right here when we call toString(). // // escaped, it'll happen right here when we call toString().
// return [ 'after', $msg->toString($format) ]; // return [PRM_TID_AFTER, $msg->toString($format) ];
// } // }
// else { // else {
// rv.Set(PRM_TID_BEFORE, param); // rv.Set(PRM_TID_BEFORE, param);
// } }
// } }
// /** // /**
// * Wrapper for what ever method we use to parse wikitext. // * Wrapper for what ever method we use to parse wikitext.
@ -1301,13 +1272,13 @@ public class XomwMessage {
// */ // */
// protected function formatPlaintext($plaintext, $format) { // protected function formatPlaintext($plaintext, $format) {
// switch ($format) { // switch ($format) {
// case self::FORMAT_TEXT: // case XomwMessage.FORMAT_TEXT:
// case self::FORMAT_PLAIN: // case XomwMessage.FORMAT_PLAIN:
// return $plaintext; // return $plaintext;
// //
// case self::FORMAT_PARSE: // case XomwMessage.FORMAT_PARSE:
// case self::FORMAT_BLOCK_PARSE: // case XomwMessage.FORMAT_BLOCK_PARSE:
// case self::FORMAT_ESCAPED: // case XomwMessage.FORMAT_ESCAPED:
// default: // default:
// return htmlspecialchars($plaintext, ENT_QUOTES); // return htmlspecialchars($plaintext, ENT_QUOTES);
// //
@ -1323,20 +1294,20 @@ public class XomwMessage {
// * @return array Array with the parameter type (either "before" or "after") and the value. // * @return array Array with the parameter type (either "before" or "after") and the value.
// */ // */
// protected function formatListParam(array $prmsVar, $listType, $format) { // protected function formatListParam(array $prmsVar, $listType, $format) {
// if (!isset(self::$listTypeMap[$listType])) { // if (!isset(XomwMessage.$listTypeMap[$listType])) {
// $warning = 'Invalid list type for message "' . this.getKey() . '": ' // $warning = 'Invalid list type for message "' . this.getKey() . '": '
// . htmlspecialchars($listType) // . htmlspecialchars($listType)
// . ' (prmsVar are ' . htmlspecialchars(serialize($prmsVar)) . ')'; // . ' (prmsVar are ' . htmlspecialchars(serialize($prmsVar)) . ')';
// trigger_error($warning, E_USER_WARNING); // trigger_error($warning, E_USER_WARNING);
// $e = new Exception; // $e = new Exception;
// wfDebugLog('Bug58676', $warning . "\n" . $e->getTraceAsString()); // wfDebugLog('Bug58676', $warning . "\n" . $e->getTraceAsString());
// return [ 'before', '[INVALID]' ]; // return [PRM_TID_BEFORE, '[INVALID]' ];
// } // }
// $func = self::$listTypeMap[$listType]; // $func = XomwMessage.$listTypeMap[$listType];
// //
// // Handle an empty list sensibly // // Handle an empty list sensibly
// if (!$prmsVar) { // if (!$prmsVar) {
// return [ 'before', this.getLanguage()->$func([]) ]; // return [PRM_TID_BEFORE, this.getLanguage()->$func([]) ];
// } // }
// //
// // First, determine what kinds of list items we have // // First, determine what kinds of list items we have
@ -1365,8 +1336,8 @@ public class XomwMessage {
} }
class XomwMessageVal { class XomwMessageVal {
public int tid; public int tid;
public Object val; public byte[] val;
public void Set(int tid, Object val) { public void Set(int tid, byte[] val) {
this.tid = tid; this.tid = tid;
this.val = val; this.val = val;
} }
@ -1427,7 +1398,9 @@ class XomwMessagePrm_plaintext extends XomwMessagePrm { public byte[] plaintext
} }
} }
class XomwMessagePrm_list extends XomwMessagePrm { public byte[][] list; class XomwMessagePrm_list extends XomwMessagePrm { public byte[][] list;
public XomwMessagePrm_list(byte[][] list) {super(Tid__list); public String type;
public XomwMessagePrm_list(byte[][] list, String type) {super(Tid__list);
this.list = list; this.list = list;
this.type = type;
} }
} }