本文整理汇总了PHP中Str::replaceSpecialChars方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::replaceSpecialChars方法的具体用法?PHP Str::replaceSpecialChars怎么用?PHP Str::replaceSpecialChars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Str
的用法示例。
在下文中一共展示了Str::replaceSpecialChars方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
<?php
// ENREGISTREMENT
if (isset($_POST['saveserver'])) {
// Variables
$serverName = Str::replaceSpecialChars(htmlspecialchars(addslashes($_POST['addServerName'])), false);
$serverAddress = trim($_POST['addServerAddress']);
$serverPort = intval($_POST['addServerPort']);
$serverMapsBasePath = trim($_POST['addServerMapsBasePath']);
$serverMatchSet = trim($_POST['addServerMatchSet']);
$serverAdmLvl = array('SuperAdmin' => $_POST['addServerAdmLvlSA'], 'Admin' => $_POST['addServerAdmLvlADM'], 'User' => $_POST['addServerAdmLvlUSR']);
$isNotAnArray = array('all', 'local', 'none');
foreach ($serverAdmLvl as $admLvlId => $admLvlValue) {
if (!in_array($admLvlValue, $isNotAnArray)) {
$serverAdmLvl[$admLvlId] = explode(',', $admLvlValue);
} else {
$serverAdmLvl[$admLvlId] = trim($admLvlValue);
}
}
$serverData = array('name' => $serverName, 'address' => $serverAddress, 'port' => $serverPort, 'mapsbasepath' => $serverMapsBasePath, 'matchsettings' => $serverMatchSet, 'adminlevel' => array());
foreach ($serverAdmLvl as $admLvlId => $admLvlValue) {
$serverData['adminlevel'][$admLvlId] = $admLvlValue;
}
// Édition
if ($args['id'] !== -1) {
if (($result = AdminServServerConfig::saveServerConfig($serverData, $args['id'])) !== true) {
AdminServ::error(Utils::t('Unable to modify the server.') . ' (' . $result . ')');
} else {
$action = Utils::t('This server has been modified.');
AdminServ::info($action);
AdminServLogs::add('action', $action);
示例2: array
<?php
// ENREGISTREMENT
if (isset($_POST['savelevel'])) {
// Variables
$levelName = Str::replaceSpecialChars(htmlspecialchars(addslashes($_POST['addLevelName'])), false);
$levelType = $_POST['addLevelType'];
$levelAccess = array();
if ($_POST['selectedAccessSortList']) {
$levelAccess = explode(',', $_POST['selectedAccessSortList']);
}
$levelPermission = array();
if ($_POST['selectedPermissionSortList']) {
$levelPermission = explode(',', $_POST['selectedPermissionSortList']);
}
$levelData = array('name' => $levelName, 'adminlevel' => array('type' => $levelType), 'access' => $levelAccess, 'permission' => $levelPermission);
// Édition
if ($args['id'] !== -1) {
if (($result = AdminServAdminLevel::saveConfig($levelData, $args['id'])) !== true) {
AdminServ::error(Utils::t('Unable to modify the admin level.') . ' (' . $result . ')');
} else {
$action = Utils::t('This admin level has been modified.');
AdminServ::info($action);
AdminServLogs::add('action', $action);
Utils::redirection(false, '?p=config-adminlevel');
}
} else {
if (($result = AdminServAdminLevel::saveConfig($levelData)) !== true) {
AdminServ::error(Utils::t('Unable to add the admin level.') . ' (' . $result . ')');
} else {
$action = Utils::t('This admin level has been added.');