本文整理汇总了PHP中strtil函数的典型用法代码示例。如果您正苦于以下问题:PHP strtil函数的具体用法?PHP strtil怎么用?PHP strtil使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strtil函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __xenimport_parse_config
function __xenimport_parse_config($file)
{
$list = lfile_trim($file);
foreach ($list as $l) {
if (!csa($l, "=")) {
continue;
}
list($var, $val) = explode("=", $l);
$var = trim($var);
$val = trim($val);
switch ($var) {
case "memory":
$ret['memory'] = $val;
break;
case "name":
$val = strfrom($val, 'vm');
$ret['name'] = strtolower(strtil($val, '"'));
break;
case "#ip":
$val = strfrom($val, '"');
$ret['ipaddress'] = strtil($val, '"');
break;
case "disk":
__xenimport_parsedisk($ret, $val);
break;
}
}
return $ret;
}
示例2: __xenimport_parsedisk
function __xenimport_parsedisk(&$ret, $val)
{
preg_match("/\\['file:([^']*)'.*'file:([^']*)'\\]/i", $val, $matches);
$ret['type'] = 'file';
if (!isset($matches[0])) {
throw new lxException("could_not_parse_disk_string");
}
$diskstring = $matches[1];
$disk = explode(",", $matches[1]);
$disk[0] = trim($disk[0], "/");
$location = strtil($disk[0], "/");
$maindiskname = strfrom($disk[0], $location);
$maindiskname = trim($maindiskname, "/");
$ret['location'] = $location;
$ret['maindiskname'] = $maindiskname;
$swap = explode(",", $matches[2]);
$swap[0] = trim($swap[0], "/");
$location = strtil($swap[0], "/");
$swapdiskname = strfrom($swap[0], $location);
$swapdiskname = trim($swapdiskname, "/");
if ($location !== $ret['location']) {
throw new lxException("swap_disk_location_not_same", 'nname', "{$ret['name']}: {$ret['location']}");
}
$ret['location'] = "/{$ret['location']}";
$ret['swapdiskname'] = $swapdiskname;
}
示例3: check_first_last_ip
static function check_first_last_ip($param)
{
$first = strtil($param['firstip'], ".");
$last = strtil($param['lastip'], ".");
if ($first !== $last) {
throw new lxException("first_and_last_should_be_same_network", 'lastip');
}
}
示例4: display
function display($var)
{
/*
if ($var === 'nname') {
return ucfirst($this->$var);
}
*/
if ($var === 'resourceplan_used_f') {
return strtil($this->resourceplan_used, "___");
}
return parent::display($var);
}
示例5: readProcessList
static function readProcessList()
{
$list = lscandir("/proc");
foreach ($list as $pid) {
if (is_numeric($pid) && $pid[0] != ".") {
$cmdlinearr = lfile("/proc/" . $pid . "/cmdline");
$return[$pid]['nname'] = $pid;
if (!$cmdlinearr) {
unset($return[$pid]);
continue;
}
$cmdline = $cmdlinearr[0];
$cmdline = preg_replace('+\\0+i', " ", $cmdline);
$return[$pid]["command"] = substr($cmdline, 0, 100);
if (csa($cmdline, "display.php") && csa($cmdline, "kloxo")) {
unset($return[$pid]);
continue;
}
$arr = lfile("/proc/" . $return[$pid]["nname"] . "/status");
foreach ($arr as $a) {
if (csb($a, "State:")) {
$a = trim($a);
$a = strtil($a, "(");
$a = strfrom($a, "State:");
$a = trim($a);
$return[$pid]["state"] = $a;
$return[$pid]["state"] = $return[$pid]["state"] === "S" ? "ZZ" : $return[$pid]["state"];
}
if (csa($a, "Uid")) {
$uidarr = explode(":", $a);
$value = trimSpaces($uidarr[1]);
$uidarr2 = explode(" ", $value);
$uid = trim($uidarr2[1]);
$pwd = posix_getpwuid($uid);
$username = $pwd['name'];
$return[$pid]["username"] = $username;
}
if (csa($a, "VmSize")) {
$uidarr = explode(":", $a);
$uidarr = trimSpaces($uidarr[1]);
$uidarr = strtilfirst($uidarr, " ");
$return[$pid]['memory'] = round($uidarr / 1024, 2);
}
}
}
}
return $return;
}
示例6: add
static function add($parent, $class, $param)
{
global $gbl, $sgbl, $login, $ghtml;
if ($login->isAdmin() && isset($param['nomodifyname']) && $param['nomodifyname'] === 'on') {
} else {
if (!$parent->isAdmin()) {
$param['nname'] = self::getDbName($parent->nname, $param['nname']);
} else {
$param['nname'] = substr($param['nname'], 0, 15);
}
}
$param['username'] = $param['nname'];
$param['dbname'] = $param['nname'];
$param['dbtype'] = strtil($class, "db");
/*
if (!check_if_many_server()) {
$param['syncserver'] = 'localhost';
}
*/
return $param;
}
示例7: createDhcpConfFile
static function createDhcpConfFile($slist)
{
$list = os_get_allips();
foreach ($list as $l) {
$base = strtil($l, ".");
$subnet[$base] = null;
}
$string = null;
$string .= "ddns-update-style interim;\n";
$string .= "ignore client-updates;\n\n\n";
$string .= self::getSubnetString($k, $slist);
/*
foreach($subnet as $k => $v) {
$string .= self::getSubnetString($k, $slist);
}
*/
foreach ($slist as $s) {
$string .= self::getHostString($s);
}
lfile_put_contents("/etc/dhcpd.conf", $string);
createRestartFile("dhcpd");
}
示例8: add
static function add($parent, $class, $param)
{
global $gbl, $sgbl, $login, $ghtml;
if ($login->isAdmin() && isset($param['nomodifyname']) && $param['nomodifyname'] === 'on') {
} else {
if (!$parent->isAdmin()) {
$param['nname'] = self::getDbName($parent->nname, $param['nname']);
} else {
$param['nname'] = substr($param['nname'], 0, 15);
}
}
if (csa($param['dbpassword'], "'")) {
throw new lxexception("password_cannot_contain_single_quote", '', "");
}
$param['username'] = $param['nname'];
$param['dbname'] = $param['nname'];
$param['dbtype'] = strtil($class, "db");
/*
if (!check_if_many_server()) {
$param['syncserver'] = 'localhost';
}
*/
return $param;
}
示例9: print_resourcelist
function print_resourcelist($tree, $alist, $base)
{
global $gbl, $sgbl, $login, $ghtml;
$image = null;
$open = 'false';
$help = null;
$alt = null;
/*
print("$treename.add($total, $level, 'Main', '', '', 'mainframe', '$image', '$image', $open, '$help', '$alt');\n");
$level = $total;
*/
foreach ((array) $alist as $k => $a) {
if (is_array($a)) {
if ($k === 'home') {
continue;
}
if (csb($k, "__title")) {
$open = 'false';
$a = strtil($a, "(");
$a = strtil($a, "[");
$ttr = createTreeObject($name, $image, $a, '', $open, $help, $alt);
$tree->addToList($ttr);
//print("$treename.add($total, 1, '$a', '', '', 'mainframe', '', '', $open, '$help', '$alt');\n");
continue;
}
$desc = get_plural($k);
$image = "/img/image/" . $login->getSpecialObject('sp_specialplay')->icon_name . "/button/browse.gif";
$endimg = "/img/right_point.gif";
$desc = "{$desc}";
$open = 'false';
$help = $desc;
$alt = lx_strip_tags($help);
$ttr = createTreeObject('name', $image, $desc, null, $open, $help, $alt);
$tree->addToList('tree', $ttr);
//print("$treename.add($total, $level, '$desc', '', '', 'mainframe', '$image', '$image', $open, '$help', '$alt');\n");
foreach ($a as $nk => $nv) {
$nv = $this->getFullUrl($nv, $base);
$this->print_ressingle($ttr, $nv);
}
}
}
foreach ((array) $alist as $k => $a) {
if ($k === 'home') {
continue;
}
if (csb($k, "__title")) {
$open = 'false';
$a = strtil($a, "(");
$a = strtil($a, "[");
$a = strtil($a, ":");
$a = strtil($a, ":");
$ttr = createTreeObject('name', $image, $a, null, $open, $help, $alt);
$tree->addToList('tree', $ttr);
//print("$treename.add($total, 1, '$a', '', '', 'mainframe', '', '', $open, '$help', '$alt');\n");
continue;
}
if (is_array($a)) {
} else {
// Hack hack... NOt showing addforms in the top Menu... Also not showing in the tree view..
/*
if (csa(strtolower($a), "addform")) {
continue;
}
*/
if (!csb($k, "__v_")) {
$a = $this->getFullUrl($a, $base);
if (isset($ttr)) {
$this->print_ressingle($ttr, $a);
} else {
$this->print_ressingle($tree, $a);
}
}
}
}
}
示例10: getToArray
function getToArray($object)
{
$col = $this->getColumnTypes();
//dprint_r($array);
foreach ($col as $key => $val) {
if (csb($key, "coma_")) {
$cvar = substr($key, 5);
$value = $object->{$cvar};
if (cse($key, "_list")) {
$namelist = $value;
} else {
$namelist = get_namelist_from_objectlist($value);
}
$ret[$key] = implode(",", $namelist);
dprint("in COma {$key} {$ret[$key]}<br> ");
$ret[$key] = ",{$ret[$key]},";
} else {
if (csb($key, "ser_")) {
$cvar = substr($key, 4);
$value = $object->{$cvar};
if ($value && isset($value->driverApp)) {
unset($value->driverApp);
}
if (cse($key, "_a")) {
if ($value) {
foreach ($value as $kk => $vv) {
unset($value[$kk]->__parent_o);
}
}
}
$ret[$key] = base64_encode(serialize($object->{$cvar}));
//$ret[$key] = serialize($object->$cvar);
} else {
if (csb($key, "priv_q_") || csb($key, "used_q_")) {
$qob = strtil($key, "_q_");
$qkey = strfrom($key, "_q_");
if ($object->get__table() === 'uuser') {
}
$ret[$key] = $object->{$qob}->{$qkey};
} else {
if (!isset($object->{$key})) {
$object->{$key} = null;
}
if (csb($key, "text_")) {
$string = str_replace("\\", '\\\\', $object->{$key});
} else {
$string = $object->{$key};
}
$ret[$key] = str_replace("'", "\\'", $string);
//$ret[$key] = $object->$key;
}
}
}
}
return $ret;
}
示例11: createNewcertificate
function createNewcertificate()
{
global $gbl, $sgbl, $login, $ghtml;
foreach ($this->ssl_data_b as $key => $value) {
if (!cse($key, "_r")) {
continue;
}
$nk = strtil($key, "_r");
$temp[$nk] = $value;
}
foreach ($temp as $key => $t) {
if ($key === "countryName") {
$l = explode(":", $t);
$name = $l[0];
} else {
$name = $t;
}
$ltemp[$key] = $name;
}
$config['private_key_bits'] = 1024;
$privkey = openssl_pkey_new($config);
openssl_pkey_export($privkey, $text_key_content);
$csr = openssl_csr_new($ltemp, $privkey);
openssl_csr_export($csr, $text_csr_content);
$sscert = openssl_csr_sign($csr, null, $privkey, 3650);
openssl_x509_export($sscert, $text_crt_content);
$this->text_key_content = $text_key_content;
$this->text_csr_content = $text_csr_content;
$this->text_crt_content = $text_crt_content;
}
示例12: getFullVersionList
function getFullVersionList($till = null)
{
global $gbl, $sgbl, $login, $ghtml;
$progname = $sgbl->__var_program_name;
static $nlist;
if ($nlist) {
return $nlist;
}
$res = curl_get_file("{$progname}/version.txt");
//dprintr($res);
if (!$res) {
throw new lxException('could_not_get_version_list', '');
}
foreach ($res as $k => $l) {
// Skip lines that do not start with progname or one that contains 'current'
if (!csb($l, "{$progname}")) {
continue;
}
if (csa($l, "current")) {
continue;
}
$upversion = strfrom($l, "{$progname}-");
$upversion = strtil($upversion, ".zip");
$list[] = $upversion;
if ($till) {
if ($upversion === $till) {
break;
}
}
}
return $list;
}
示例13: check_file_if_owned_by
function check_file_if_owned_by($file, $user)
{
if (!lxfile_exists($file)) {
return true;
}
if (csa($user, ":")) {
$ruser = strtil($user, ":");
} else {
$ruser = $user;
}
$stat = lxfile_stat($file, false);
$uid = $stat['uid'];
$name = os_get_user_from_uid($uid);
if ($name === $ruser) {
return true;
}
log_log("file_check", "{$file} not owned by {$ruser}");
return false;
}
示例14: readMailqueue
static function readMailqueue()
{
lxfile_unix_chmod("__path_program_root/bin/misc/qmHandle", "0755");
$res = lxshell_output("__path_program_root/bin/misc/qmHandle", "-l");
$list = array('subject', 'to', 'from', 'date', 'size');
//$res = lfile_get_contents("a.txt");
$res = explode("\n", $res);
//dprintr($res);
$i = 0;
foreach ($res as $r) {
$r = trim($r);
if (!$r) {
$i++;
continue;
}
if (is_numeric($r[0])) {
list($nname, $s, $ss) = explode(" ", $r);
$ret[$i]['nname'] = $nname;
if (cse($ss, 'R)')) {
$ret[$i]['type'] = 'remote';
} else {
$ret[$i]['type'] = 'local';
}
continue;
}
foreach ($list as $l) {
$ul = ucfirst($l);
if (csb($r, "{$ul}:")) {
$ret[$i][$l] = strfrom($r, "{$ul}:");
if ($l === 'size') {
$ret[$i][$l] = strtil($ret[$i][$l], " bytes");
$ret[$i][$l] = trim($ret[$i][$l]);
}
}
}
}
return $ret;
}
示例15: updateform
function updateform($subaction, $param)
{
global $gbl, $sgbl, $login, $ghtml;
$gen = $login->getObject('general')->generalmisc_b;
switch ($subaction) {
case "dialogsize":
$vlist['dialogsize'] = null;
return $vlist;
case "boxposopen":
$vlist['title_class'] = null;
$vlist['title_open'] = null;
$vlist['title_name'] = null;
return $vlist;
case "boxpos":
$vlist['title_class'] = null;
$vlist['title_open'] = null;
$vlist['title_name'] = null;
$vlist['page'] = null;
return $vlist;
case "addshortcut":
$vlist['shortcut'] = null;
return $vlist;
case "resendwelcome":
$vlist['extra_email_f'] = null;
$vlist['password'] = null;
$vlist['__v_updateall_button'] = array();
return $vlist;
case "disable_per":
if ($this->islogin()) {
throw new lxException('you_cannot_set_your_own_limit', '');
}
$vlist['disable_per'] = array('s', array('off', '95', '100', '110', '120', '130'));
return $vlist;
case "miscinfo":
$vlist['nname'] = array('M', $this->nname);
$vlist['realname'] = "";
$vlist['add_address'] = "";
$vlist['add_city'] = "";
$vlist['add_country'] = "";
$vlist['add_telephone'] = "";
$vlist['add_fax'] = "";
return $vlist;
case "limit_s":
case "limit":
if ($this->islogin()) {
throw new lxException('you_cannot_set_your_own_limit', '');
}
if (cse($this->get__table(), "template")) {
$class = strtil($this->get__table(), "template");
$vlist = getQuotaListForClass($class);
} else {
$vlist = $this->getQuotaVariableList();
}
// This is patently wrong. In update, the object is inititialized properly and we are suppsed to get the quota for the specific type of object and not for the class.... Changing it to $this.
$sgbl->method = 'post';
//$vlist['__v_updateall_button'] = array();
return $vlist;
case "change_plan":
$parent = $this->getParentO();
$ttlist = $parent->getTemplateList("resourceplan", false);
$this->newresourceplan = $this->resourceplan_used;
if (!$ttlist) {
$vlist['newresourceplan'] = array("M", "No Plan in Parent");
} else {
$vlist['newresourceplan'] = array("A", $ttlist);
}
//$vlist['__v_updateall_button'] = array();
return $vlist;
case "password":
if ($this->isLogin() || $this->is__table('auxiliary') && $this->getParentO()->isAuxiliary()) {
$vlist['old_password_f'] = "";
}
$vlist['password'] = "";
$vlist['__v_updateall_button'] = array();
return $vlist;
}
return parent::updateform($subaction, $param);
}