/** * {@inheritdoc} * * @param string $index * @param null|array $placeholders */ public function query($index, $placeholders = null) { if (!$this->exists($index)) { return $index; } $formatter = new \MessageFormatter($this->options['locale'], $this->get($index, $this->bundle)); if (null !== $formatter) { return $formatter->format((array) $placeholders); } else { return $index; } }
function __construct($messageKey) { $lang=LPC_Language::getCurrent(); return parent::__construct( $lang->getLocale(), self::getTranslation($messageKey) ); }
/** * Formats the message with the help of php intl extension. * * @param string $locale * @param string $message * @param array(string=>mixed) $parameters * @return string * @throws CannotInstantiateFormatterException If the message pattern cannot be used. * @throws CannotFormatException If an error occurs during formatting. */ public function format($locale, $message, array $parameters) { if (empty($message)) { // Empty strings are not accepted as message pattern by the \MessageFormatter. return $message; } try { $formatter = new \MessageFormatter($locale, $message); } catch (\Exception $e) { throw new CannotInstantiateFormatterException($e->getMessage(), $e->getCode(), $e); } if (!$formatter) { throw new CannotInstantiateFormatterException(intl_get_error_message(), intl_get_error_code()); } $result = $formatter->format($parameters); if ($result === false) { throw new CannotFormatException($formatter->getErrorMessage(), $formatter->getErrorCode()); } return $result; }
public function localize(array $values) { $formatter = \MessageFormatter::create($this->locale, $this->pattern); $result = $formatter->format($values); if ($result === false) { $code = $formatter->getErrorCode(); $message = $formatter->getErrorMessage(); throw new \lean\Exception("Could not format message ({$code}) '{$message}'"); } return $result; }
public function format($message, $params, $language) { $params_new = []; $matches = []; preg_match_all("/\\{[A-z0-9]+\\}/isU", $message, $matches); if (count($matches[0])) { foreach ($matches[0] as $k => $val) { $message = str_replace($val, "{" . $k . "}", $message); $val_search = str_replace("{", "", str_replace("}", "", $val)); $params_new[$k] = $params[$val_search]; } } return MessageFormatter::formatMessage($language, $message, $params_new); }
public function getDetails($isbn = null) { if ($isbn != null && apiUtils::isValidISBN($isbn)) { $url = MessageFormatter::formatMessage("nl_NL", BookloveApi::baseUrl . BookloveApi::editionInfoEndpoint, array($this->apikey, $isbn)); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); if ($response !== false) { return $response; } return null; } }
static function getByISBN($isbn) { $url = MessageFormatter::formatMessage("nl_NL", NurApi::baseURL . NurApi::isbnEndpoint, array($isbn)); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); if ($response !== false) { try { $response = str_replace("xmlns=\"http://www.editeur.org/onix/2.1/reference\"", "", $response); $xml = new SimpleXMLElement($response); $xpathResult = $xml->xpath("/ONIXMessage/Product/Subject/SubjectCode/text()"); return $xpathResult[0]->__toString(); } catch (Exception $e) { // die ( $e ); } } return null; }
function generate_delete_link() { global $CURUSER, $user_lang, $res; stdhead($res['msg_delete_association_title']); ?> <form method="post"> <p><?php echo MessageFormatter::formatMessage($user_lang, $res['msg_delete_association_text'], array(htmlspecialchars($CURUSER['cc98id']))); ?> </p> <input type="hidden" name="action" value="delete" /> <button type="submit"><?php echo $res['msg_delete_association_button_text']; ?> </button> </form> <?php stdfoot(); }
/** * This is the main parsing method. * * \param DOMNode $node * The node being parsed. * * \param array $attributes * Array of styling attributes. * * \param array $vars * Template variables that can be injected in the return. * * \retval string * Parsing result, with styles applied as appropriate. */ protected function parseNode($node, &$attributes, $vars) { $result = ''; $saved = $attributes; if ($node->nodeType == XML_TEXT_NODE) { return $node->nodeValue; } if ($node->nodeType != XML_ELEMENT_NODE) { return ''; } // Pre-handling. switch ($node->tagName) { case 'var': $lexer = new \Erebot\Styling\Lexer($node->getAttribute('name'), $vars); $var = $lexer->getResult(); if (!$var instanceof \Erebot\Styling\VariableInterface) { return (string) $var; } return $var->render($this->translator); case 'u': if (!$attributes['underline']) { $result .= self::CODE_UNDERLINE; } $attributes['underline'] = 1; break; case 'b': if (!$attributes['bold']) { $result .= self::CODE_BOLD; } $attributes['bold'] = 1; break; case 'color': $colors = array('', ''); $mapping = array('fg', 'bg'); foreach ($mapping as $pos => $color) { $value = $node->getAttribute($color); if ($value != '') { $value = str_replace(array(' ', '-'), '_', $value); if (strspn($value, '1234567890') !== strlen($value)) { $reflector = new \ReflectionClass('\\Erebot\\StylingInterface'); if (!$reflector->hasConstant('COLOR_' . strtoupper($value))) { throw new \InvalidArgumentException('Invalid color "' . $value . '"'); } $value = $reflector->getConstant('COLOR_' . strtoupper($value)); } $attributes[$color] = sprintf('%02d', $value); if ($attributes[$color] != $saved[$color]) { $colors[$pos] = $attributes[$color]; } } } $code = implode(',', $colors); if ($colors[0] != '' && $colors[1] != '') { $result .= self::CODE_COLOR . $code; } elseif ($code != ',') { $result .= self::CODE_COLOR . rtrim($code, ',') . self::CODE_BOLD . self::CODE_BOLD; } break; } if ($node->tagName == 'for') { // Handle loops. $savedVariables = $vars; $separator = array(', ', ' & '); foreach (array('separator', 'sep') as $attr) { $attrNode = $node->getAttributeNode($attr); if ($attrNode !== false) { $separator[0] = $separator[1] = $attrNode->nodeValue; break; } } foreach (array('last_separator', 'last') as $attr) { $attrNode = $node->getAttributeNode($attr); if ($attrNode !== false) { $separator[1] = $attrNode->nodeValue; break; } } $loopKey = $node->getAttribute('key'); $loopItem = $node->getAttribute('item'); $loopFrom = $node->getAttribute('from'); $count = count($vars[$loopFrom]); reset($vars[$loopFrom]); for ($i = 1; $i < $count; $i++) { if ($i > 1) { $result .= $separator[0]; } $item = each($vars[$loopFrom]); if ($loopKey !== null) { $cls = $this->cls['string']; $vars[$loopKey] = new $cls($item['key']); } $vars[$loopItem] = $this->wrapScalar($item['value'], $loopItem); $result .= $this->parseChildren($node, $attributes, $vars); } $item = each($vars[$loopFrom]); if ($item === false) { $item = array('key' => '', 'value' => ''); } if ($loopKey !== null) { $cls = $this->cls['string']; $vars[$loopKey] = new $cls($item['key']); } $vars[$loopItem] = $this->wrapScalar($item['value'], $loopItem); if ($count > 1) { $result .= $separator[1]; } $result .= $this->parseChildren($node, $attributes, $vars); $vars = $savedVariables; } elseif ($node->tagName == 'plural') { // Handle plurals. /* We don't need the full set of features/complexity/bugs * ICU contains. Here, we use a simple "plural" formatter * to detect the right plural form to use. The formatting * steps are done without relying on ICU. */ $attrNode = $node->getAttributeNode('var'); if ($attrNode === false) { throw new \InvalidArgumentException('No variable name given'); } $lexer = new \Erebot\Styling\Lexer($attrNode->nodeValue, $vars); $value = $lexer->getResult(); if ($value instanceof \Erebot\Styling\VariableInterface) { $value = $value->getValue(); } $value = (int) $value; $subcontents = array(); $pattern = '{0,plural,'; for ($child = $node->firstChild; $child != null; $child = $child->nextSibling) { if ($child->nodeType != XML_ELEMENT_NODE || $child->tagName != 'case') { continue; } // See this class documentation for a link // which lists available forms for each language. $form = $child->getAttribute('form'); $subcontents[$form] = $this->parseNode($child, $attributes, $vars); $pattern .= $form . '{' . $form . '} '; } $pattern .= '}'; $locale = $this->translator->getLocale(\Erebot\IntlInterface::LC_MESSAGES); $formatter = new \MessageFormatter($locale, $pattern); // HACK: PHP <= 5.3.3 returns null when the pattern in invalid // instead of throwing an exception. // See http://bugs.php.net/bug.php?id=52776 if ($formatter === null) { throw new \InvalidArgumentException('Invalid plural forms'); } $correctForm = $formatter->format(array($value)); $result .= $subcontents[$correctForm]; } else { // Handle children. $result .= $this->parseChildren($node, $attributes, $vars); } // Post-handling : restore old state. switch ($node->tagName) { case 'u': if (!$saved['underline']) { $result .= self::CODE_UNDERLINE; } $attributes['underline'] = 0; break; case 'b': if (!$saved['bold']) { $result .= self::CODE_BOLD; } $attributes['bold'] = 0; break; case 'color': $colors = array('', ''); $mapping = array('fg', 'bg'); foreach ($mapping as $pos => $color) { if ($attributes[$color] != $saved[$color]) { $colors[$pos] = $saved[$color]; } $attributes[$color] = $saved[$color]; } $code = implode(',', $colors); if ($colors[0] != '' && $colors[1] != '') { $result .= self::CODE_COLOR . $code; } elseif ($code != ',') { $result .= self::CODE_COLOR . rtrim($code, ',') . self::CODE_BOLD . self::CODE_BOLD; } break; } return $result; }
/** * {@inheritdoc} * * @param string $translateKey * @param array $placeholders * @return string */ public function query($translateKey, $placeholders = null) { $options = $this->options; $translation = $options['db']->fetchOne($this->stmtSelect, Db::FETCH_ASSOC, ['language' => $options['language'], 'key_name' => $translateKey]); $value = empty($translation['value']) ? $translateKey : $translation['value']; if (is_array($placeholders) && !empty($placeholders)) { if (true === $this->useIcuMessageFormatter) { $value = \MessageFormatter::formatMessage($options['language'], $value, $placeholders); } else { foreach ($placeholders as $placeHolderKey => $placeHolderValue) { $value = str_replace('%' . $placeHolderKey . '%', $placeHolderValue, $value); } } } return $value; }
echo $maxloginattempts; ?> </b>] <?php echo $lang_login['p_fail_ban']; ?> <?php } ?> </p> <?php if (!is_special_ip()) { ?> <p><?php echo MessageFormatter::formatMessage("", $lang_login['p_login_remaing_tries_format'], array(remaining())); ?> <?php } ?> </p> <table border="0" cellpadding="5"> <tr> <td class="rowhead"><?php echo $lang_login['rowhead_username']; ?> </td> <td class="rowfollow" align="left"> <input type="text" name="username" style="width: 180px; border: 1px solid gray" /></td> </tr>
/** * Returns translated string * * @param string $key The key to translate * @param array $params The string values to passe in * @param string $target The target locale string if diferent than current * * @return string The resulting string */ public function translate($key, $params = array(), $target = null) { // Load defauts $current = $this->current; $directory = $this->directory . DIRECTORY_SEPARATOR . $current; $params = (array) $params; // Validate and load different $target if (!empty($target) && $target != $current) { $current = $target; $directory = $this->directory . DIRECTORY_SEPARATOR . $current; // Validate locale and translations directory if (\Locale::canonicalize($current) === null || !is_dir($this->directory . DIRECTORY_SEPARATOR . $current)) { throw new DualityException("Error Locale: target code ", DualityException::E_LOCALE_NOTFOUND); } } // Finally, return result $storage = new Storage(); $storage->importArray(include $directory . DIRECTORY_SEPARATOR . 'messages.php'); return \MessageFormatter::formatMessage($current, $storage->get($key), $params); }
<?php /* This might come from user input or the browser */ define('LOCALE', 'en_US'); /* If you can't trust the locale, add some error checking * in case the file doesn't exist or can't be * unserialized. */ $messages = unserialize(file_get_contents(__DIR__ . '/' . LOCALE . '.ser')); $candy = new MessageFormatter(LOCALE, $messages['CANDY']); $favs = new MessageFormatter(LOCALE, $messages['FAVORITE_FOODS']); print $favs->format(array($candy->format(array()))) . "\n";
/** * 登录相关操作。 */ function dologon($cc98_id) { global $res; $user_lang = get_current_user_lang(); $sql = new_mysqli(); $query = $sql->prepare('SELECT `id`, `passhash`, `username` FROM `users` WHERE `cc98id` = ?'); $query->bind_param('s', $cc98_id); $query->execute(); $query->bind_result($id, $passhash, $username); // 是否匹配到结果。 if ($query->fetch()) { logincookie($id, md5($passhash)); ?> <meta http-equiv="refresh" content="3; url=/" /> <?php $title = $res['msg_logon_success_title']; $msg = MessageFormatter::formatMessage($user_lang, $res['msg_logon_success_text'], array($username)); stdhead($title); stdmsg($title, $msg); stdfoot(); die; break; // 没有关联到账户 } else { stderr($res['msg_no_associated_account_title'], $res['msg_no_associated_account_text']); die; } }
<?php ini_set("intl.error_level", E_WARNING); //ini_set("intl.default_locale", "nl"); $time = 1247013673; ini_set('date.timezone', 'America/New_York'); $msgf = new MessageFormatter('en_US', '{0,date,full} {0,time,h:m:s a V}'); echo "date: " . date('l, F j, Y g:i:s A T', $time) . "\n"; echo "msgf: " . $msgf->format(array($time)) . "\n"; //NOT FIXED: /*$msgf = new MessageFormatter('en_US', '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", $msgf->format(array($time, 'time')), "\n"; */ ?> ==DONE==
?> <h1><?php echo MessageFormatter::formatMessage($user_lang, $lang_bbcode['text_title_format'], $title); ?> </h1> <p><?php echo $lang_bbcode['text_instruction']; ?> </p> <table style="width: 95%; margin: 10px;"> <thead> <tr> <th class="colhead" align="center"><?php echo MessageFormatter::formatMessage($user_lang, $lang_bbcode['text_title_format'], $title); ?> </th> </tr> </thead> <tbody> <tr> <td> <blockquote style="white-space: pre-wrap; overflow:scroll; font-family: 'Segoe UI';"> <?php echo htmlspecialchars($descrption); ?> </blockquote> </td> </tr> </tbody>
<?php $message = '{0, select, f {She} m {He} other {It}} went to the store.'; $fmt = new MessageFormatter('en_US', $message); print $fmt->format(array('f')) . "\n"; print $fmt->format(array('m')) . "\n"; print $fmt->format(array('Unknown')) . "\n";
/** * Translate the $resource * * @param string $locale * @param TranslatableResource $resource * * @throws \IntlException * @return string */ public function translate($locale, TranslatableResource $resource) { $canonicalLocale = \Locale::canonicalize($locale); $messageFormatter = new \MessageFormatter($canonicalLocale, $this->retrievePattern($canonicalLocale, $resource->getKey())); return $messageFormatter->format($resource->getParameters()); }
/** * Get a translated string using its key in the translations array. * @param array|string $key the translation key, if an array all values will be checked until a match is found * @param array $replace any variables to replace with * @param string|null $default optional value to return if key is not found, `null` returns the key * @return string the final translated string */ public function get($key, array $replace = [], string $default = null) : string { if (is_array($key)) { foreach ($key as $k) { $tmp = $this->get($k, $replace, chr(0)); if ($tmp !== chr(0)) { return $tmp; } } return $default; } if ($default === null) { $default = $key; } $tmp = explode('.', strtolower($key)); $val = $this->data; foreach ($tmp as $k) { $ok = false; if (is_array($val)) { foreach ($val as $kk => $vv) { if ($k === strtolower($kk)) { $val = $vv; $ok = true; break; } } } if (!$ok) { return $default; } } $val = MF::formatMessage($this->code, (string) $val, $replace); return $val === false ? $default : $val; }
<?php ini_set("intl.error_level", E_WARNING); $fmt = <<<EOD {foo,number} {foo} EOD; $mf = new MessageFormatter('en_US', $fmt); var_dump($mf->format(array(7)));
$send_email = $email; $email = sqlesc($email); $country = sqlesc($country); $gender = sqlesc($gender); $sitelangid = sqlesc(get_langid_from_langcookie()); $res_check_user = sql_query("SELECT * FROM users WHERE username = "******"INSERT INTO users (username, passhash, secret, editsecret, email, country, gender, status, class, invites, " . ($type == 'invite' ? "invited_by," : "") . " added, last_access, lang, stylesheet" . ($showschool == 'yes' ? ", school" : "") . ", uploaded,ip) VALUES (" . $wantusername . "," . $wantpasshash . "," . $secret . "," . $editsecret . "," . $email . "," . $country . "," . $gender . ", 'pending', " . $defaultclass_class . "," . $invite_count . ", " . ($type == 'invite' ? "'{$inviter}'," : "") . " '" . date("Y-m-d H:i:s") . "' , " . " '" . date("Y-m-d H:i:s") . "' , " . $sitelangid . "," . $defcss . ($showschool == 'yes' ? "," . $school : "") . "," . ($iniupload_main > 0 ? $iniupload_main : 0) . ",'" . getip() . "')") or sqlerr(__FILE__, __LINE__); $id = mysql_insert_id(); // 发送欢迎消息 // 消息可选参数 $messageParams = array($wantusernameraw, $SITENAME); $title = MessageFormatter::formatMessage(get_current_user_lang(), get_current_user_resource()['signup']['welcome_message_title'], $messageParams); $text = MessageFormatter::formatMessage(get_current_user_lang(), get_current_user_resource()['signup']['welcome_message_text'], $messageParams); send_message(0, $id, $title, $text); //write_log("User account $id ($wantusername) was created"); $res = sql_query("SELECT passhash, secret, editsecret, status FROM users WHERE id = " . sqlesc($id)) or sqlerr(__FILE__, __LINE__); $row = mysql_fetch_assoc($res); $psecret = md5($row['secret']); $ip = getip(); $usern = htmlspecialchars($wantusername); $title = $SITENAME . $lang_takesignup['mail_title']; $body = <<<EOD {$lang_takesignup['mail_one']}{$usern}{$lang_takesignup['mail_two']}({$email}){$lang_takesignup['mail_three']}{$ip}{$lang_takesignup['mail_four']} <b><a href="http://{$BASEURL}/confirm.php?id={$id}&secret={$psecret}" target="_blank"> {$lang_takesignup['mail_this_link']} </a></b><br /> http://{$BASEURL}/confirm.php?id={$id}&secret={$psecret} {$lang_takesignup['mail_four_1']} <b><a href="http://{$BASEURL}/confirm_resend.php" target="_blank">{$lang_takesignup['mail_here']}</a></b><br />
<?php $message = '{0,number} / {1,number} = {2,number}'; $args = array(5327, 98, 5327 / 98); $us = new MessageFormatter('en_US', $message); $fr = new MessageFormatter('fr_FR', $message); print $us->format($args) . "\n"; print $fr->format($args) . "\n";
<?php ini_set("intl.error_level", E_WARNING); //ini_set("intl.default_locale", "nl"); $mf = new MessageFormatter('en_US', "\n\tnone\t\t\t{a}\n\tnumber\t\t\t{b,number}\n\tnumber integer\t{c,number,integer}\n\tnumber currency\t{d,number,currency}\n\tnumber percent\t{e,number,percent}\n\tdate\t\t\t{f,date}\n\ttime\t\t\t{g,time}\n\tspellout\t\t{h,spellout}\n\tordinal\t\t\t{i,ordinal}\n\tduration\t\t{j,duration}\n\t"); $ex = "1336317965.5 str"; var_dump($mf->format(array('a' => $ex, 'b' => $ex, 'c' => $ex, 'd' => $ex, 'e' => $ex, 'f' => " 1336317965.5", 'g' => " 1336317965.5", 'h' => $ex, 'i' => $ex, 'j' => $ex))); ?> ==DONE==
<?php ini_set("intl.error_level", E_WARNING); $fmt = <<<EOD {foo,number,percent} EOD; $mf = new MessageFormatter('en_US', $fmt); var_dump($mf->format(array("foo" => 7, -1 => "bar")));
/** * Provided that the HTML tag contains ICU-compatible message format * string, it will be localized then integrated with passed arguments */ function setMessage($tag, $args = array()) { if (!is_array($args)) { $args = array($args); } $fmt = $this->app->_($this->get($tag)); // Try to analyze format and see which formatter to use if (class_exists('MessageFormatter', false) && strpos($fmt, '{') !== null) { $fmt = new MessageFormatter($this->app->locale, $fmt); $str = $fmt->format($args); } elseif (strpos($fmt, '%') !== null) { array_unshift($args, $fmt); $str = call_user_func_array('sprintf', $args); } else { throw $this->exception('Unclear how to format this')->addMoreInfo('fmt', $fmt); } return $this->set($tag, $str); }
<?php ini_set("intl.error_level", E_WARNING); //ini_set("intl.default_locale", "nl"); $mf = new MessageFormatter('en_US', "{0,number} -- {foo,ordinal}"); var_dump($mf->format(array(2.3, "foo" => 1.3))); var_dump($mf->format(array("foo" => 1.3, 0 => 2.3))); ?> ==DONE==
<?php $message = 'I like to eat {food} and {drink}.'; $fmt = new MessageFormatter('en_US', $message); print $fmt->format(array('food' => 'eggs', 'drink' => 'water'));
die; } else { KPS("-", $uploadsubtitle_bonus, $a["uppedby"]); //subtitle uploader loses bonus for deleted subtitle } if ($CURUSER['id'] != $a['uppedby']) { $owner_res = get_user_resource($a['uppedby'])['delete_sub_target']; $owner_lang = get_fix_user_lang($a['uppedby']); // 标题 $subject = $owner_res['msg_deleted_your_sub']; // 带有用户链接的用户信息。 $deleter_info = MessageFormatter::formatMessage("", "[url=userdetails.php?id={0}]{1}[/url]", array($CURUSER['id'], $CURUSER['username'])); // 消息模板,根据是否有注释,使用不同类型。 $msg_format = $reason ? $owner_res['msg_delete_sub_format_reason'] : $owner_res['msg_delete_sub_format']; // 正文。 $msg = MessageFormatter::formatMessage($owner_lang, $msg_format, array($a['id'], $a['title'], $deleter_info, $reason)); $time = (string) date("Y-m-d H:i:s"); $sql = new_mysqli(); $query = $sql->prepare("INSERT INTO `messages` (`sender`, `receiver`, `added`, `msg`, `subject`) VALUES (0, ?, ?, ?, ?)"); $query->bind_param("isss", $a['uppedby'], $time, $msg, $subject); $query->execute() or sqlerr(__FILE__, __LINE__); $sql->close(); } $res = sql_query("SELECT lang_name from language WHERE sub_lang=1 AND id = " . sqlesc($a["lang_id"])) or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_assoc($res); write_log("{$arr['lang_name']} Subtitle {$delete} ({$a['title']}) was deleted by " . ($a["anonymous"] == 'yes' && $a["uppedby"] == $CURUSER["id"] ? "Anonymous" : $CURUSER['username']) . ($a["uppedby"] != $CURUSER["id"] ? ", Mod Delete" : "") . ($reason != "" ? " (" . $reason . ")" : "")); } else { stdmsg($lang_subtitles['std_delete_subtitle'], $lang_subtitles['std_delete_subtitle_note'] . "<br /><form method=post action=subtitles.php?delete={$delete}&sure=1>" . $lang_subtitles['text_reason_is'] . "<input type=text style=\"width: 200px\" name=reason><input type=submit value=\"" . $lang_subtitles['submit_confirm'] . "\"></form>"); stdfoot(); die; }
tr_small($lang_usercp['row_email_address'], $CURUSER['email'], 1); if ($enablelocation_tweak == 'yes') { list($loc_pub, $loc_mod) = get_ip_location($CURUSER["ip"]); tr_small($lang_usercp['row_ip_location'], $CURUSER["ip"] . " <span title='" . $loc_mod . "'>[" . $loc_pub . "]</span>", 1); } else { tr_small($lang_usercp['row_ip_location'], $CURUSER["ip"], 1); } if ($CURUSER["avatar"]) { tr_small($lang_usercp['row_avatar'], "<img src=\"" . $CURUSER["avatar"] . "\" border=0>", 1); } tr_small($lang_usercp['row_passkey'], $CURUSER["passkey"], 1); // CC98 ID if ($CURUSER["cc98id"]) { $cc98id_str = MessageFormatter::formatMessage('', '<a href="http://www.cc98.org/dispuser.asp?name={0}">{0}</a> <a href="/cc98id.php?action=edit">[{1}]</a> <a href="/cc98id.php?action=delete">[{2}]</a>', array($CURUSER["cc98id"], $res['cc98_id_action_edit'], $res['cc98_id_action_delete'])); } else { $cc98id_str = MessageFormatter::formatMessage('', '<span style="color: gray">{0}</span> <a href="/cc98id.php?action=new">[{1}]</a>', array($res['cc98_id_text_none'], $res['cc98_id_action_create'])); } tr_small($res['cc98_id_association_title'], $cc98id_str, 1); if ($prolinkpoint_bonus) { $prolinkclick = get_row_count("prolinkclicks", "WHERE userid=" . $CURUSER['id']); tr_small($lang_usercp['row_promotion_link'], $prolinkclick . " [<a href=\"promotionlink.php\">" . $lang_usercp['text_read_more'] . "</a>]", 1); //tr_small($lang_usercp['row_promotion_link'], $prolinkclick. " [<a href=\"promotionlink.php?updatekey=1\">".$lang_usercp['text_update_promotion_link']."</a>] [<a href=\"promotionlink.php\">".$lang_usercp['text_read_more']."</a>]", 1); } tr_small($lang_usercp['row_invitations'], $CURUSER[invites] . " [<a href=\"invite.php?id=" . $CURUSER[id] . "\" title=\"" . $lang_usercp['link_send_invitation'] . "\">" . $lang_usercp['text_send'] . "</a>]", 1); tr_small($lang_usercp['row_karma_points'], $CURUSER['seedbonus'] . " [<a href=\"mybonus.php\" title=\"" . $lang_usercp['link_use_karma_points'] . "\">" . $lang_usercp['text_use'] . "</a>]", 1); tr_small($lang_usercp['row_written_comments'], $commentcount . " [<a href=\"userhistory.php?action=viewcomments&id=" . $CURUSER[id] . "\" title=\"" . $lang_usercp['link_view_comments'] . "\">" . $lang_usercp['text_view'] . "</a>]", 1); if ($forumposts) { tr($lang_usercp['row_forum_posts'], $forumposts . " [<a href=\"userhistory.php?action=viewposts&id=" . $CURUSER[id] . "\" title=\"" . $lang_usercp['link_view_posts'] . "\">" . $lang_usercp['text_view'] . "</a>] (" . $dayposts . $lang_usercp['text_posts_per_day'] . "; " . $percentages . $lang_usercp['text_of_total_posts'] . ")", 1); } ?> </table>
<?php $args = array(7, 159, -0.3782, 6.815574); $messages = array("0", "00", "1", "11", "222", "#", "##", "@", "@@@", "##%", "¤#", "¤1.11", "¤¤#", "#.##;(#.## !!!)"); foreach ($messages as $message) { $fmt = new MessageFormatter('en_US', "{0,number,{$message}}\t{1,number,{$message}}\t" . "{2,number,{$message}}\t{3,number,{$message}}"); print "{$message}:\t" . $fmt->format($args) . "\n"; }