本文整理汇总了PHP中Utils::t方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::t方法的具体用法?PHP Utils::t怎么用?PHP Utils::t使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils
的用法示例。
在下文中一共展示了Utils::t方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Ajoute un log au fichier correspondant
*
* @param string $type -> Type de log : access, action, etc
* @param string $str -> Ligne de log à écrire
* @return bool
*/
public static function add($type, $str)
{
$out = false;
$type = strtolower($type);
if (defined('USER_PAGE')) {
$userPage = USER_PAGE;
} else {
$userPage = 'index';
}
if (defined('SERVER_NAME')) {
$serverName = '[' . utf8_decode(SERVER_NAME) . '] ';
} else {
$serverName = null;
}
$str = '[' . date('d/m/Y H:i:s') . '] [' . $_SERVER['REMOTE_ADDR'] . '] : ' . $serverName . '[' . $userPage . '] ' . utf8_decode($str) . "\n";
$path = self::$LOGS_PATH . $type . '.log';
if (file_exists($path)) {
if (File::save($path, utf8_encode($str)) !== true) {
$error = Utils::t('Unable to add log in file:') . ' ' . $type . '.';
if ($_SESSION['error'] != null) {
$_SESSION['error'] .= '<br />' . $error;
} else {
$_SESSION['error'] = $error;
}
} else {
$out = true;
}
}
return $out;
}
示例2: array
}
// INCLUDES
require_once '../class/utils.class.php';
$serverConfig = '../../' . $path_cfg;
if (file_exists($serverConfig)) {
require_once $serverConfig;
}
$langCode = Utils::getLang();
$langFile = '../lang/' . $langCode . '.php';
if (file_exists($langFile)) {
require_once $langFile;
}
// DATA
$out = array();
if (class_exists('ServerConfig')) {
if (isset(ServerConfig::$SERVERS) && count(ServerConfig::$SERVERS) > 0 && !isset(ServerConfig::$SERVERS['new server name']) && !isset(ServerConfig::$SERVERS[''])) {
$out['servers'] = count(ServerConfig::$SERVERS);
$out['label']['server'] = Utils::t('Server');
$out['label']['name'] = Utils::t('Server name');
$out['label']['login'] = Utils::t('Server login');
$out['label']['connect'] = Utils::t('Connected on');
$out['label']['status'] = Utils::t('Status');
$out['label']['gamemode'] = Utils::t('Game mode');
$out['label']['currentmap'] = Utils::t('Current map');
$out['label']['players'] = Utils::t('Players');
$out['label']['accessserverplayer'] = Utils::t('Access as player');
$out['label']['accessserverspectate'] = Utils::t('Access as spectator');
$out['label']['addfavourite'] = Utils::t('Add to favourite');
}
}
echo json_encode($out);
示例3: array
echo Utils::t('Click here');
?>
</a></p>
<p>- <?php
echo Utils::t('Unzip the plugin and place its contents into the « plugins » folder of Adminserv.');
?>
<br />
- <?php
echo Utils::t('In the Configuration Extension, add the name of the plugin folder previously added.');
?>
</p>
<p>
<code>
public static $PLUGINS = array(<br />
'PluginName',<br />
);
</code>
</p>
</div>
<h2><?php
echo Utils::t('Create a new plugin');
?>
</h2>
<div class="content">
<?php
echo Utils::t('<p>To create a plugin, go to the plugins folder and duplicate file _newplugin. Replace the values in the config.ini file and folder name.<br />Then there are two PHP files:</p><ul><li>script.php : this file is executed before the header of the site. This is where all plugin script will be placed.</li><li>view.php : this file is the display of the plugin executed after the header. This is where everything will be placed the html code.</li></ul><p>You need to create resources (classes, js, css) then include these files.</p>');
?>
</div>
</section>
</section>
示例4: intval
$color = 'blue';
} else {
$color = 'red';
}
AdminServLogs::add('action', 'Force player in ' . $color . ' team: ' . $player);
}
}
} else {
if (isset($_POST['ForceScores']) && isset($_POST['ScoreTeamBlue']) && isset($_POST['ScoreTeamRed'])) {
$scoreTeamBlue = intval($_POST['ScoreTeamBlue']);
$scoreTeamRed = intval($_POST['ScoreTeamRed']);
$scores = array(array('PlayerId' => 0, 'Score' => $scoreTeamBlue), array('PlayerId' => 1, 'Score' => $scoreTeamRed));
if (!$client->query('ForceScores', $scores, true)) {
AdminServ::error();
} else {
$action = '[Admin] ' . Utils::t('The scores have been modified : $00fblue team $fffhas !scoreTeamBlue and $f00red team $fffhas !scoreTeamRed', array('!scoreTeamBlue' => $scoreTeamBlue, '!scoreTeamRed' => $scoreTeamRed));
if (!$client->query('ChatSendServerMessage', $action)) {
AdminServ::error();
} else {
AdminServLogs::add('action', $action);
}
}
} else {
if (isset($_POST['CancelVote'])) {
if (!$client->query('CancelVote')) {
AdminServ::error();
} else {
Utils::redirection();
}
}
}
示例5: array
<?php
// LECTURE
$data['serverLines'] = AdminServ::getChatServerLines();
$lastNicknameUsed = Utils::readCookieData('adminserv_user', 2);
$data['nickname'] = $lastNicknameUsed != null ? $lastNicknameUsed : Utils::t('Nickname');
$colorList = array('$ff0' => Utils::t('Color'), '$000' => Utils::t('Black'), '$f00' => Utils::t('Red'), '$0f0' => Utils::t('Green'), '$00f' => Utils::t('Blue'), '$f80' => Utils::t('Orange'), '$f0f' => Utils::t('Pink'), '$888' => Utils::t('Grey'), '$fff' => Utils::t('White'));
$data['colorOptions'] = null;
$lastColorUsed = Utils::readCookieData('adminserv_user', 3);
foreach ($colorList as $colorCode => $colorName) {
$selected = $colorCode == $lastColorUsed ? ' selected="selected"' : null;
$data['colorOptions'] .= '<option value="' . $colorCode . '"' . $selected . '>' . $colorName . '</option>';
}
$lastDestination = null;
$lastDestinationTitle = Utils::t('server');
if (isset($_SESSION['adminserv']['chat_dst'])) {
$lastDestination = $lastDestinationTitle = $_SESSION['adminserv']['chat_dst'];
}
$data['destination']['list'] = AdminServUI::getPlayerList($lastDestination);
$data['destination']['title'] = Utils::t('Message destination') . ' : ' . $lastDestinationTitle;
示例6: array
$NextRoundCustomPointsArray = array();
if (count($NextRoundCustomPoints) > 0) {
foreach ($NextRoundCustomPoints as $point) {
$NextRoundCustomPointsArray[] = intval(trim($point));
}
}
if (!$client->query('SetRoundCustomPoints', $NextRoundCustomPointsArray)) {
AdminServ::error();
}
}
// MatchSettings
if (SERVER_MATCHSET) {
$mapsDirectory = AdminServ::getMapsDirectoryPath();
if (array_key_exists('SaveCurrentMatchSettings', $_POST)) {
if (!$client->query('SaveMatchSettings', $mapsDirectory . SERVER_MATCHSET)) {
AdminServ::error();
}
}
}
AdminServLogs::add('action', 'Save game infos');
Utils::redirection(false, '?p=' . USER_PAGE);
}
}
// LECTURE
$gameInfos = AdminServ::getGameInfos();
$data['gameInfos'] = array('curr' => $gameInfos['curr'], 'next' => $gameInfos['next']);
$data['teamInfo'] = array('team1' => array('name' => Utils::t('Blue'), 'color' => '0.667', 'colorhex' => '#0000ff', 'country' => 'World|France'), 'team2' => array('name' => Utils::t('Red'), 'color' => '0', 'colorhex' => '#ff0000', 'country' => 'World|France'));
if (isset($_SESSION['adminserv']['teaminfo']) && count($_SESSION['adminserv']['teaminfo']) > 0) {
$data['teamInfo'] = array('team1' => $_SESSION['adminserv']['teaminfo']['team1'], 'team2' => $_SESSION['adminserv']['teaminfo']['team2']);
}
unset($gameInfos);
示例7: md5
<?php
// ENREGISTREMENT
if (isset($_POST['savepassword'])) {
$current = md5($_POST['changePasswordCurrent']);
$new = md5($_POST['changePasswordNew']);
if (isset($_SESSION['adminserv']['path'])) {
$adminservPath = $_SESSION['adminserv']['path'];
} else {
$adminservPath = null;
}
$pathConfig = $adminservPath . 'config/';
if (OnlineConfig::PASSWORD !== $current) {
AdminServ::error(Utils::t('The current password doesn\'t match.'));
} else {
if (($result = AdminServServerConfig::savePasswordConfig($pathConfig . 'adminserv.cfg.php', $new)) !== true) {
AdminServ::error(Utils::t('Unable to save password.') . ' (' . $result . ')');
} else {
$info = Utils::t('The password has been changed.');
AdminServ::info($info);
AdminServLogs::add('action', $info);
}
}
Utils::redirection(false, '?p=' . USER_PAGE);
}
示例8: array
$playerStatus = Utils::t('Player');
}
if ($player['TeamId'] == 0) {
$teamName = Utils::t('Blue');
} else {
if ($player['TeamId'] == 1) {
$teamName = Utils::t('Red');
} else {
$teamName = Utils::t('Spectator');
}
}
$out['players'][$serverId]['list'][$playerId] = array('name' => TmNick::toHtml(htmlspecialchars($player['NickName'], ENT_QUOTES, 'UTF-8'), 10, true), 'status' => $playerStatus, 'teamId' => $player['TeamId'], 'teamName' => $teamName);
$playerId++;
}
} else {
$out['players'][$serverId]['list'] = Utils::t('No player');
}
// Tri mode team
if ($gameModeName == 'Team' && $countPlayerList > 0) {
uasort($out['players'][$serverId]['list'], 'sortByTeam');
}
// Count players
$maxPlayers = $queriesData['GetMaxPlayers'];
$out['players'][$serverId]['count']['current'] = $countPlayerList;
$out['players'][$serverId]['count']['max'] = $maxPlayers['NextValue'];
}
}
// Déconnexion
$client->Terminate();
$serverId++;
}
示例9: elseif
<?php
// SESSION
if (!isset($_SESSION['adminserv']['allow_config_servers'])) {
AdminServ::error(Utils::t('You are not allowed to configure the servers'));
Utils::redirection();
}
// VERIFICATION
if (class_exists('ServerConfig')) {
// Si on n'autorise pas la configuration en ligne
if (OnlineConfig::ACTIVATE !== true) {
AdminServ::info(Utils::t('No server available. To add one, configure "config/servers.cfg.php" file.'));
Utils::redirection();
} elseif (USER_PAGE != 'config-addserver') {
if (OnlineConfig::ADD_ONLY === true) {
Utils::redirection(false, './?p=addserver');
}
}
} else {
AdminServ::error(Utils::t('The servers configuration file isn\'t recognized by AdminServ.'));
Utils::redirection();
}
示例10:
?>
</span>
</div>
<div class="fright">
<div class="selected-files-label locked">
<span class="selected-files-title"><?php
echo Utils::t('For the selection');
?>
</span>
<div class="selected-files-option">
<input class="button dark" type="submit" name="deleteserver" id="deleteserver" data-confirm-text="<?php
echo Utils::t('Do you really want to remove this selection?');
?>
" value="<?php
echo Utils::t('Delete');
?>
" />
<input class="button dark" type="submit" name="duplicateserver" id="duplicateserver" value="<?php
echo Utils::t('Duplicate');
?>
" />
<input class="button dark" type="submit" name="editserver" id="editserver" value="<?php
echo Utils::t('Modify');
?>
" />
</div>
</div>
</div>
</div>
</form>
</section>
示例11: foreach
foreach ($_POST['map'] as $map) {
$result = File::rename($data['mapsDirectoryPath'] . $map, $newPath . basename($map));
if ($result !== true) {
AdminServ::error(Utils::t('Unable to move the map') . ' : ' . $map . ' (' . $result . ')');
break;
} else {
AdminServLogs::add('action', 'Move map: ' . $map . ' to ' . $newPath . basename($map));
}
}
Utils::redirection(false, '?p=' . USER_PAGE . $hasDirectory);
} else {
if (isset($_POST['deleteMap']) && isset($_POST['map']) && count($_POST['map']) > 0) {
foreach ($_POST['map'] as $map) {
$result = File::delete($data['mapsDirectoryPath'] . $map);
if ($result !== true) {
AdminServ::error(Utils::t('Unable to delete the map') . ' : ' . $map . ' (' . $result . ')');
break;
} else {
AdminServLogs::add('action', 'Delete map: ' . $map);
}
}
Utils::redirection(false, '?p=' . USER_PAGE . $hasDirectory);
}
}
}
}
}
}
}
// Save MatchSettings
if ((isset($_POST['addMap']) || isset($_POST['insertMap'])) && SERVER_MATCHSET) {
示例12: renderPlugin
/**
* Inclue les fichiers pour le rendu d'un plugin
*
* @param string $pluginName -> Le nom du dossier plugin
* @return html
*/
public static function renderPlugin($pluginName = null)
{
global $client, $translate, $args;
if ($pluginName === null) {
$pluginName = USER_PLUGIN;
}
// Tente de récupérer les plugins d'une autre config
self::setPluginsList();
// Création du rendu du plugin
$pluginPath = AdminServConfig::$PATH_PLUGINS . $pluginName . '/';
$scriptFile = $pluginPath . 'script.php';
$viewFile = $pluginPath . 'view.php';
if (file_exists($scriptFile) && file_exists($viewFile)) {
// Process
require_once $scriptFile;
// Terminate client
if (isset($client) && $client->socket != null) {
$client->Terminate();
}
// Header
AdminServUI::getHeader();
// Content
echo '<section class="plugins hasMenu">' . '<section class="cadre left menu">' . self::getMenuList() . '</section>' . '<section class="cadre right">' . '<h1>' . self::getConfig($pluginName, 'name') . '</h1>';
require_once $viewFile;
echo '</section>' . '</section>';
// Footer
AdminServUI::getFooter();
AdminServLogs::add('access', 'Plugin: ' . $pluginName);
} else {
AdminServ::error(Utils::t('Plugin error: script.php or view.php file is missing.'));
AdminServUI::getHeader();
AdminServUI::getFooter();
}
}
示例13: saveServerConfig
/**
* Sauvegarde le fichier de configuration des serveurs
*
* @param array $serverData -> assoc array(name, address, port, matchsettings, adminlevel => array(SuperAdmin, Admin, User));
* @param int $editServer -> Id du serveur à éditer
* @param array $serverList -> Liste des serveurs de la config
* @return bool or string error
*/
public static function saveServerConfig($serverData = array(), $editServer = -1, $serverList = array())
{
// Liste des serveurs
if (isset($serverList) && count($serverList) > 0) {
$servers = $serverList;
} else {
$servers = ServerConfig::$SERVERS;
}
// Template
$fileTemplate = self::$CONFIG_START_TEMPLATE;
$i = 0;
foreach ($servers as $serverName => $serverValues) {
// Édition
if ($i == $editServer && isset($serverData) && count($serverData) > 0) {
$fileTemplate .= self::getServerTemplate($serverData);
} else {
// Récupération des données des serveurs existant
$getServerValues = array('name' => $serverName, 'address' => $serverValues['address'], 'port' => $serverValues['port'], 'mapsbasepath' => isset($serverValues['mapsbasepath']) ? $serverValues['mapsbasepath'] : '', 'matchsettings' => $serverValues['matchsettings'], 'adminlevel' => array());
foreach ($serverValues['adminlevel'] as $admLvlId => $admLvlValue) {
$getServerValues['adminlevel'][$admLvlId] = $admLvlValue;
}
// Ajout des données au template
$fileTemplate .= self::getServerTemplate($getServerValues);
}
$i++;
}
// Ajout d'un nouveau
if ($editServer === -1 && isset($serverData) && count($serverData) > 0) {
if (self::getServerId($serverData['name']) === -1) {
$fileTemplate .= self::getServerTemplate($serverData);
} else {
return Utils::t('The server already exist! Change the name.');
}
}
$fileTemplate .= self::$CONFIG_END_TEMPLATE;
// Enregistrement
return File::save(self::$CONFIG_PATH . self::$CONFIG_FILENAME, $fileTemplate, false);
}
示例14: array
// SET
$setServerData = array('name' => trim(htmlspecialchars(addslashes($_POST['server'][0] . ' - ' . Utils::t('copy')))), 'address' => trim($getServerData['address']), 'port' => intval($getServerData['port']), 'matchsettings' => trim($getServerData['matchsettings']), 'adminlevel' => array('SuperAdmin' => $getServerData['adminlevel']['SuperAdmin'], 'Admin' => $getServerData['adminlevel']['Admin'], 'User' => $getServerData['adminlevel']['User']));
if (AdminServServerConfig::saveServerConfig($setServerData)) {
$action = Utils::t('This server has been duplicated.');
AdminServ::info($action);
AdminServLogs::add('action', $action);
Utils::redirection(false, '?p=' . USER_PAGE);
} else {
AdminServ::error(Utils::t('Unable to duplicate server.'));
}
}
// SUPPRESSION
if (isset($_POST['deleteserver'])) {
$servers = ServerConfig::$SERVERS;
unset($servers[$_POST['server'][0]]);
if (($result = AdminServServerConfig::saveServerConfig(array(), -1, $servers)) !== true) {
AdminServ::error(Utils::t('Unable to delete server.') . ' (' . $result . ')');
} else {
$action = Utils::t('The "!serverName" server has been deleted.', array('!serverName' => $_POST['server'][0]));
AdminServ::info($action);
AdminServLogs::add('action', $action);
Utils::redirection(false, '?p=' . USER_PAGE);
}
}
// SERVERLIST
$data['servers'] = array();
if (is_array(ServerConfig::$SERVERS) && !empty(ServerConfig::$SERVERS)) {
$data['servers'] = ServerConfig::$SERVERS;
}
$data['count'] = count($data['servers']);
$data['adminLevelsType'] = AdminServAdminLevel::getDefaultType();
示例15: saveConfig
/**
* Sauvegarde le fichier de configuration des niveaux admins
*
* @param array $levelData -> assoc array(adminlevel => array(type), access, permission)
* @param int $editLevel -> Id du niveau à éditer
* @param array $levelList -> Liste des niveaux de la config
* @return bool or string error
*/
public static function saveConfig($levelData = array(), $editLevel = -1, $levelList = array())
{
// Liste des niveaux
$levels = isset($levelList) && !empty($levelList) ? $levelList : AdminLevelConfig::$ADMINLEVELS;
// Template
$fileTemplate = self::$CONFIG_START_TEMPLATE;
$i = 0;
foreach ($levels as $levelName => $levelValues) {
// Édition
if ($i == $editLevel && isset($levelData) && !empty($levelData)) {
$fileTemplate .= self::getTemplate($levelData);
} else {
// Récupération des données des niveaux existant
$getLevelsData = array('name' => $levelName, 'adminlevel' => $levelValues['adminlevel'], 'access' => $levelValues['access'], 'permission' => $levelValues['permission']);
// Ajout des données au template
$fileTemplate .= self::getTemplate($getLevelsData);
}
$i++;
}
// Ajout d'un nouveau
if ($editLevel === -1 && isset($levelData) && !empty($levelData)) {
if (self::getId($levelData['name']) === -1) {
$fileTemplate .= self::getTemplate($levelData);
} else {
return Utils::t('The admin level already exist! Change the name.');
}
}
$fileTemplate .= self::$CONFIG_END_TEMPLATE;
// Enregistrement
return File::save(self::$CONFIG_PATH . self::$CONFIG_FILENAME, $fileTemplate, false);
}