本文整理汇总了PHP中l_t函数的典型用法代码示例。如果您正苦于以下问题:PHP l_t函数的具体用法?PHP l_t怎么用?PHP l_t使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了l_t函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Send a message to the public forum. The variables passed are assumed to be already sanitized
*
* @param int $toID User/Thread ID to send to
* @param int $fromUserID UserID sent from
* @param string $message The message to be sent
* @param string[optional] $subject The subject
* @param string[optional] $type 'Bulletin'(GameMaster->Player) 'ThreadStart'(User->All) 'ThreadReply'(User->Thread)
*
* @return int The message ID
*/
public static function send($toID, $fromUserID, $message, $subject = "", $type = 'Bulletin')
{
global $DB;
if (defined('AdminUserSwitch')) {
$fromUserID = AdminUserSwitch;
}
$message = self::linkify($message);
$sentTime = time();
if (65000 < strlen($message)) {
throw new Exception(l_t("Message too long"));
}
libCache::wipeDir(libCache::dirName('forum'));
$DB->sql_put("INSERT INTO wD_ForumMessages\r\n\t\t\t\t\t\tSET toID = " . $toID . ", fromUserID = " . $fromUserID . ", timeSent = " . $sentTime . ",\r\n\t\t\t\t\t\tmessage = '" . $message . "', subject = '" . $subject . "', replies = 0,\r\n\t\t\t\t\t\ttype = '" . $type . "', latestReplySent = 0");
$id = $DB->last_inserted();
if ($type == 'ThreadReply') {
$DB->sql_put("UPDATE wD_ForumMessages " . "SET latestReplySent = " . $id . ", replies = replies + 1 WHERE ( id=" . $id . " OR id=" . $toID . " )");
} else {
$DB->sql_put("UPDATE wD_ForumMessages SET latestReplySent = id WHERE id = " . $id);
}
$tabl = $DB->sql_tabl("SELECT t.id FROM wD_ForumMessages t LEFT JOIN wD_ForumMessages r ON ( r.toID=t.id AND r.fromUserID=" . $fromUserID . " AND r.type='ThreadReply' ) WHERE t.type='ThreadStart' AND ( t.fromUserID=" . $fromUserID . " OR r.id IS NOT NULL ) GROUP BY t.id");
$participatedThreadIDs = array();
while (list($participatedThreadID) = $DB->tabl_row($tabl)) {
$participatedThreadIDs[$participatedThreadID] = $participatedThreadID;
}
$cacheUserParticipatedThreadIDsFilename = libCache::dirID('users', $fromUserID) . '/readThreads.js';
file_put_contents($cacheUserParticipatedThreadIDsFilename, 'participatedThreadIDs = $A([' . implode(',', $participatedThreadIDs) . ']);');
return $id;
}
示例2: turnAsDate
public function turnAsDate($turn)
{
if ($turn == -1) {
return l_t("Pre-game");
} else {
return ($turn % 2 ? l_t("Autumn") . ", " : l_t("Spring") . ", ") . (floor($turn / 2) + 1);
}
}
示例3: formHTML
public function formHTML()
{
print '<form method="post" name="search">';
foreach ($this->searchItems as $item) {
print $item->formHTML();
}
print '<br /><input type="submit" class="form-submit" value="' . l_t('Search') . '" />';
print '</form>';
}
示例4: membersList
/**
* Display a table with the vital members info; who is finalized, who has sent messages etc, each member
* takes up a short, thin column.
* @return string
*/
function membersList()
{
global $User;
// $membersList[$i]=array($nameOrCountryID,$iconOne,$iconTwo,...);
$membersList = array();
if ($this->Game->phase == 'Pre-game') {
$count = count($this->ByID);
for ($i = 0; $i < $count; $i++) {
$membersList[] = array($i + 1, '<img src="' . l_s('images/icons/tick.png') . '" alt=" " title="' . l_t('Player joined, spot filled') . '" />');
}
for ($i = $count; $i <= count($this->Game->Variant->countries); $i++) {
$membersList[] = array($i + 1, '');
}
} else {
for ($countryID = 1; $countryID <= count($this->Game->Variant->countries); $countryID++) {
$Member = $this->ByCountryID[$countryID];
//if ( $User->id == $this->ByCountryID[$countryID]->userID )
// continue;
//elseif( $Member->status != 'Playing' && $Member->status != 'Left' )
// continue;
$membersList[] = $Member->memberColumn();
}
}
$buf = '<table class="homeMembersTable">';
$rowsCount = count($membersList[0]);
$alternate = libHTML::$alternate;
for ($i = 0; $i < $rowsCount; $i++) {
$rowBuf = '';
$dataPresent = false;
$remainingPlayers = count($this->ByID);
$remainingWidth = 100;
foreach ($membersList as $data) {
if ($data[$i]) {
$dataPresent = true;
}
if ($remainingPlayers > 1) {
$width = floor($remainingWidth / $remainingPlayers);
} else {
$width = $remainingWidth;
}
$remainingPlayers--;
$remainingWidth -= $width;
$rowBuf .= '<td style="width:' . $width . '%" class="barAlt' . libHTML::alternate() . '">' . $data[$i] . '</td>';
}
libHTML::alternate();
if ($dataPresent) {
$buf .= '<tr>' . $rowBuf . '</tr>';
}
libHTML::$alternate = $alternate;
}
libHTML::alternate();
$buf .= '</table>';
return $buf;
}
示例5: dir
public static function dir($dir, array $dirParts)
{
$name = array_pop($dirParts);
if (is_null($name)) {
return $dir;
}
if (!is_dir($dir . '/' . $name) && !mkdir($dir . '/' . $name, 0775, true)) {
throw new Exception(l_t("Couldn't make cache directory '%s'.", $dir . '/' . $name));
}
return self::dir($dir . '/' . $name, $dirParts);
}
示例6: iconText
function iconText()
{
if ($this->None) {
return l_t('No orders to submit');
} elseif ($this->Ready) {
return l_t('Ready to move to the next turn');
} elseif ($this->Completed) {
return l_t('Orders completed, but not ready for next turn');
} elseif ($this->Saved) {
return l_t('Orders saved, but not completed!');
} else {
return l_t('No orders submitted!');
}
}
示例7: formHTML
function formHTML()
{
$output = "";
$output .= '<input type="radio"
value="' . $this->value . '"
' . ($this->locked ? '' : 'name="' . $this->htmlName . '"') . '
' . ($this->checked ? 'checked ' : '') . '
' . ($this->locked ? 'disabled ' : '') . '/>
' . l_t($this->label);
if ($this->locked) {
$output .= ' <input type="hidden" name="' . $this->htmlName . '" value="' . $this->value . '" />';
}
return $output;
}
示例8: toTerrIDCheck
protected function toTerrIDCheck()
{
$this->toTerrID = (int) $this->toTerrID;
if ($this->type == 'Build Army') {
/*
* Creating an army at which territory
*
* Unoccupied supply centers owned by our country, which the specified unit type
* can be built in. If a parent coast is found return Child entries.
*/
return $this->sqlCheck("SELECT t.id\r\n\t\t\t\tFROM wD_TerrStatus ts\r\n\t\t\t\tINNER JOIN wD_Territories t\r\n\t\t\t\t\tON ( t.id = ts.terrID )\r\n\t\t\t\tWHERE ts.gameID = " . $this->gameID . "\r\n\t\t\t\t\tAND ts.countryID = " . $this->countryID . "\r\n\t\t\t\t\tAND t.countryID = " . $this->countryID . "\r\n\t\t\t\t\tAND ts.occupyingUnitID IS NULL\r\n\t\t\t\t\tAND t.supply = 'Yes' AND NOT t.type='Sea'\r\n\t\t\t\t\tAND NOT t.coast = 'Child'\r\n\t\t\t\t\tAND t.id=" . $this->toTerrID . "\r\n\t\t\t\t\tAND t.mapID=" . MAPID . "\r\n\t\t\t\tLIMIT 1");
} elseif ($this->type == 'Build Fleet') {
return $this->sqlCheck("SELECT IF(t.coast='Parent', coast.id, t.id) as terrID\r\n\t\t\t\tFROM wD_TerrStatus ts\r\n\t\t\t\tINNER JOIN wD_Territories t ON ( t.id = ts.terrID )\r\n\t\t\t\tLEFT JOIN wD_Territories coast ON ( coast.mapID=t.mapID AND coast.coastParentID = t.id AND NOT t.id = coast.id )\r\n\t\t\t\tWHERE ts.gameID = " . $this->gameID . "\r\n\t\t\t\t\tAND ts.countryID = " . $this->countryID . "\r\n\t\t\t\t\tAND t.countryID = " . $this->countryID . "\r\n\t\t\t\t\tAND ts.occupyingUnitID IS NULL\r\n\t\t\t\t\tAND t.supply = 'Yes'\r\n\t\t\t\t\tAND t.type = 'Coast'\r\n\t\t\t\t\tAND ( t.coast='No' OR ( t.coast='Parent' AND NOT coast.id IS NULL ) )\r\n\t\t\t\t\tAND (\r\n\t\t\t\t\t\t(t.coast='Parent' AND coast.id=" . $this->toTerrID . ")\r\n\t\t\t\t\t\tOR t.id=" . $this->toTerrID . "\r\n\t\t\t\t\t)\r\n\t\t\t\t\tAND t.mapID=" . MAPID . "\r\n\t\t\t\tLIMIT 1");
} elseif ($this->type == 'Destroy') {
/*
* Destroying a unit at which territory
*/
return $this->sqlCheck("SELECT terrID\n\t\t\t\tFROM wD_TerrStatus\r\n\t\t\t\tWHERE gameID = " . $this->gameID . "\r\n\t\t\t\t\tAND occupyingUnitID IS NOT NULL\r\n\t\t\t\t\tAND countryID = " . $this->countryID . "\r\n\t\t\t\t\tAND terrID = " . $this->toTerrID . "\r\n\t\t\t\tLIMIT 1");
} else {
throw new Exception(l_t("Checking the territory when not required."));
}
}
示例9: send
/**
* Send a game message. Messages are sanitized
*
* @param string $toCountryID The countryID being sent to. 'Global' sends to all.
* @param string $fromCountryID The county being sent from. 'GameMaster' can also be used.
* @param string|array $message The message(s) to be sent (Can be an array of messages for)
* @param int[optional] $gameID The game ID to use. If not given the current global Game is sent to.
*/
public static function send($toCountryID, $fromCountryID, $message, $gameID = -1)
{
global $DB, $Game;
if (!is_object($Game)) {
$Variant = libVariant::loadFromGameID($gameID);
$Game = $Variant->Game($gameID);
}
$message = $DB->msg_escape($message);
if (!is_numeric($toCountryID)) {
$toCountryID = 0;
}
if (!is_numeric($fromCountryID)) {
$message = '<strong>' . $fromCountryID . ':</strong> ' . $message;
$fromCountryID = 0;
}
if (65000 < strlen($message)) {
throw new Exception(l_t("Message too long"));
}
$DB->sql_put("INSERT INTO wD_GameMessages\r\n\t\t\t\t\t(gameID, toCountryID, fromCountryID, turn, message, timeSent)\r\n\t\t\t\t\tVALUES(" . $Game->id . ",\r\n\t\t\t\t\t\t" . $toCountryID . ",\r\n\t\t\t\t\t\t" . $fromCountryID . ",\r\n\t\t\t\t\t\t" . $Game->turn . ",\r\n\t\t\t\t\t\t'" . $message . "',\r\n\t\t\t\t\t\t" . time() . ")");
if ($toCountryID != $fromCountryID || $fromCountryID == 0) {
libGameMessage::notify($toCountryID, $fromCountryID);
}
}
示例10: terrJSON
/**
* Saves the territories.js JSON file which the order-generation code need to know the board layout.
*
* @param string $jsonFileLocation Where the file will be saved to
* @param int $mapID
*/
public static function terrJSON($jsonFileLocation, $mapID)
{
global $DB;
$territories = array();
$tabl = $DB->sql_tabl("SELECT id, name, type, supply, countryID, coast, coastParentID, smallMapX, smallMapY\r\n\t\t\tFROM wD_Territories\r\n\t\t\tWHERE mapID=" . $mapID . "\r\n\t\t\tORDER BY id ASC");
$selectVars = '';
while ($row = $DB->tabl_hash($tabl)) {
$row['Borders'] = array();
$row['CoastalBorders'] = array();
$row['name'] = l_t($row['name']);
$territories[$row['id']] = $row;
}
$tabl = $DB->sql_tabl("SELECT * FROM wD_Borders WHERE mapID=" . $mapID);
while ($row = $DB->tabl_hash($tabl)) {
// id, a, f saves space
$territories[$row['fromTerrID']]['Borders'][] = array('id' => $row['toTerrID'], 'a' => $row['armysPass'] == 'Yes', 'f' => $row['fleetsPass'] == 'Yes');
}
$tabl = $DB->sql_tabl("SELECT * FROM wD_CoastalBorders WHERE mapID=" . $mapID);
while ($row = $DB->tabl_hash($tabl)) {
$territories[$row['fromTerrID']]['CoastalBorders'][] = array('id' => $row['toTerrID'], 'a' => $row['armysPass'] == 'Yes', 'f' => $row['fleetsPass'] == 'Yes');
}
$javascript = "function loadTerritories() {\n" . 'Territories = $H(' . json_encode($territories) . ');' . "\n}\n";
file_put_contents($jsonFileLocation, $javascript);
}
示例11: processTimetxt
/**
* Return the next process time in textual format, in terms of time remaining
*
* @return string
*/
function processTimetxt()
{
if ($this->processTime < time()) {
return l_t("Now");
} else {
return libTime::remainingText($this->processTime);
}
}
示例12: l_t
<input type="hidden" name="viewthread" value="0" />
<input type="submit" class="form-submit" value="' . l_t('Close') . '" />
</form>';
} else {
print '<a href="forum.php?viewthread=' . $message['id'] . '#' . $message['id'] . '" ' . 'title="' . l_t('Open this thread to view the replies, or post your own reply') . '">' . l_t('Open') . '</a>';
/*
print '<form action="forum.php#'.$message['id'].'" method="get">
<input type="hidden" name="viewthread" value="'.$message['id'].'" />
<input type="submit" class="form-submit" value="Open"
title="Open this thread to view the replies, or post your own reply" />
</form>';
*/
}
print "</div>\r\n\t\t</div>";
}
print '<div class="hr"></div>';
print '<div>';
print $forumPager->html('bottom');
print '<div><a href="#forum">' . l_t('Back to top') . '</a><a name="bottom"></a></div>';
print '<div style="clear:both;"> </div>
</div>';
print '</div>';
print '</div>';
if ($User->type['User']) {
if (isset($replyToID)) {
libHTML::$footerScript[] = 'readThread(' . $replyToID . ', ' . $replyID . ');';
}
}
libHTML::$footerScript[] = 'makeFormsSafe();';
$_SESSION['lastSeenForum'] = time();
libHTML::footer();
示例13: footerCopyright
private static function footerCopyright()
{
// Version, sourceforge and HTML compliance logos
return l_t('webDiplomacy version <strong>%s</strong>', number_format(VERSION / 100, 2)) . '<br />
<a href="http://github.com/kestasjk/webDiplomacy" class="light">GitHub Project</a> |
<a href="http://github.com/kestasjk/webDiplomacy/issues" class="light">Bug Reports</a> | <a href="mailto:' . Config::$modEMail . '" class="light">Contact Moderator</a>';
}
示例14: unset
if ($percentLeft > 0) {
$percentLeft--;
$percent = 1;
continue;
} else {
break;
}
}
$percentLeft -= $percent;
$scCountsByTurn[$turn][$countryID] = $percent;
}
}
$scRatiosByTurn = $scCountsByTurn;
unset($scCountsByTurn);
if (count($scRatiosByTurn) < 3) {
print l_t('Game too new to graph.');
return;
}
print '<div class="variant' . $Variant->name . ' boardGraph" style="width:auto">';
foreach ($scRatiosByTurn as $turn => $scRatiosByCountryID) {
print '<div class="boardGraphTurn" style="width:auto">';
//500px">';
foreach ($scRatiosByCountryID as $countryID => $scRatio) {
if ($scRatio < 1) {
continue;
}
print '<div class="boardGraphTurnCountry occupationBar' . $countryID . '" ' . 'style="text-align:center; font-size:10pt; font-weight:bold; overflow:hidden;' . 'float:left;width:' . $scRatio . '%">' . $scRatio . '%</div>';
}
print '<div style="clear:both"></div>';
print '</div>';
}
示例15: number_format
$sql[] = number_format(round($chance, 3), 3);
}
$lastLine = "(" . implode(",", $sql) . ")";
unset($userID);
}
}
print "<br />";
flush();
print l_t("Indexing") . "<br />";
flush();
$DB->sql_put("ALTER TABLE `Chances` ADD INDEX ( `id` )");
print l_t("Putting chances table data into users table") . "<br />";
flush();
$sqlBuf = "UPDATE wD_Users u INNER JOIN Chances c SET ";
$first = true;
foreach ($Game->Variant->countries as $c) {
if ($first) {
$first = false;
} else {
$sqlBuf .= ", ";
}
$sqlBuf .= "u.Chance" . $c . " = c.Chance" . $c;
}
$sqlBuf .= " WHERE u.id = c.id";
$DB->sql_put($sqlBuf);
print l_t("Deleting chances table");
flush();
$DB->sql_put("DROP TABLE Chances");
$DB->sql_put("COMMIT");
print l_t("Done");
flush();