本文整理汇总了PHP中strfrom函数的典型用法代码示例。如果您正苦于以下问题:PHP strfrom函数的具体用法?PHP strfrom怎么用?PHP strfrom使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strfrom函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printProperty
function printProperty($class, $type)
{
$r = new ReflectionClass($class);
foreach ($r->getProperties() as $s) {
if ($type === 'action') {
$istr = "__acdesc_";
if (!csb($s->name, "__acdesc_")) {
continue;
}
}
if ($type === 'property') {
$istr = "__desc_";
if (!csb($s->name, "__desc_")) {
continue;
}
}
$descr = get_classvar_description($class, $s->name);
$name = strfrom($s->name, $istr);
if (csa($descr[0], "q")) {
continue;
}
if (cse($name, "_f")) {
continue;
}
if (cse($name, "_l")) {
continue;
}
if (cse($name, "_o")) {
continue;
}
printf("%30s %s\n", $name, $descr['help']);
}
}
示例2: __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;
}
示例3: __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;
}
示例4: mail_parse
static function mail_parse($file)
{
$fp = fopen($file, "r");
$ret['header'] = null;
$name = str_replace(",", "_s_coma_s_", $file);
$name = str_replace(":", "_s_colon_s_", $name);
$ret['nname'] = $name;
while (!feof($fp)) {
$l = fgets($fp);
if ($l === "\n") {
fclose($fp);
break;
}
if (csb($l, "From:")) {
$ret['from'] = strfrom($l, "From:");
}
if (csb($l, "Subject:")) {
$ret['subject'] = strfrom($l, "Subject:");
}
if (csb($l, "Date:")) {
$ret['date'] = strfrom($l, "Date:");
}
$ret['location'] = basename(dirname(dirname($file)));
$ret['header'] .= $l;
}
if (!isset($ret['subject'])) {
$ret['subject'] = '[no subject]';
}
return $ret;
}
示例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: __call
function __call($m, $arg)
{
$strarg = var_export($arg, true);
$strarg = str_replace("\n", " ", $strarg);
$existing = var_export($this->__varlist, true);
$existing = str_replace("\n", " ", $existing);
$call = "{$m} {$strarg} on {$this->__name} (existing {$existing})";
if ($this->__notreal) {
log_log("com_error", "unreal {$call}");
return;
}
$comerr = false;
$retcom = false;
if (csb($m, "com_")) {
$m = strfrom($m, "com_");
$retcom = true;
}
try {
//$ret = call_user_func_array(array($this->__com, $m), $arg);
$string = null;
for ($i = 0; $i < count($arg); $i++) {
$string[] = "\$arg[{$i}]";
}
if ($string) {
$string = implode(", ", $string);
}
$func = "return \$this->__com->{$m}({$string});";
dprint("{$func} \n");
$ret = eval($func);
} catch (exception $e) {
log_log("com_error", "Exception: {$e->getMessage()}: {$call}");
$ret = null;
$call = "Exception: {$call}";
$comerr = true;
}
if (!$comerr) {
$call = "Success..: {$call}";
}
log_log("com_call", $call);
if ($retcom) {
return create_lxcom($ret);
}
return $ret;
}
示例7: __xenimport_parsedisk
function __xenimport_parsedisk(&$ret, $val)
{
preg_match("/\\['phy:([^']*)'.*'phy:([^']*)'\\]/i", $val, $matches);
$ret['type'] = 'lvm';
if (!isset($matches[0])) {
$ret['type'] = 'file';
preg_match("/\\['file:([^']*)'.*'file:([^']*)'\\]/i", $val, $matches);
}
if (!isset($matches[0])) {
throw new lxException("could_not_parse_disk_string");
}
$diskstring = $matches[1];
$disk = explode(",", $matches[1]);
if (csb($disk[0], "/dev/")) {
$disk[0] = strfrom($disk[0], "/dev/");
}
if ($ret['type'] === 'file') {
$location = "/home/xen";
$mdn = explode("/", $disk[0]);
$maindiskname = array_pop($mdn);
} else {
list($location, $maindiskname) = explode("/", $disk[0]);
}
$ret['location'] = $location;
$ret['maindiskname'] = $maindiskname;
$swap = explode(",", $matches[2]);
if (csb($swap[0], "/dev/")) {
$swap[0] = strfrom($swap[0], "/dev/");
}
if ($ret['type'] === 'file') {
$location = "/home/xen";
$swp = explode("/", $swap[0]);
$swapdiskname = array_pop($swp);
} else {
list($location, $swapdiskname) = explode("/", $swap[0]);
}
if ($location !== $ret['location']) {
throw new lxException("swap_disk_location_not_same", 'nname', "{$ret['name']}: {$ret['location']}");
}
$ret['swapdiskname'] = $swapdiskname;
}
示例8: createShowPropertyList
function createShowPropertyList(&$alist)
{
global $gbl, $sgbl, $login, $ghtml;
return null;
if ($this->getTrueParentO()->isClass('mailaccount') && !$this->getTrueParentO()->isLogin()) {
$this->getTrueParentO()->createShowPropertyList($alist);
foreach ($alist['property'] as &$__a) {
if (!$ghtml->is_special_url($__a)) {
$__a = strfrom($__a, "goback=2&");
$__a = "goback=3&{$__a}";
}
}
} else {
if ($this->getTrueParentO()->isClass('mmail')) {
$alist['property'][] = 'goback=2&a=show';
$alist['property'][] = 'goback=1&a=list&c=mailaccount';
$alist['property'][] = 'goback=2&a=show&sa=config';
} else {
$alist['property'][] = 'a=show';
}
}
//$alist['property'][] = 'a=list&c=wlist_a';
//$alist['property'][] = 'a=list&c=blist_a';
}
示例9: middlepart
function middlepart($web_home, $domain, $dirp)
{
global $gbl, $sgbl, $login, $ghtml;
$string = null;
foreach ($this->main->customerror_b as $k => $v) {
if (csb($k, "url_") && $v) {
$num = strfrom($k, "url_");
if (csb($v, "http:/")) {
$nv = $v;
} else {
$nv = remove_extra_slash("/{$v}");
}
$string .= "\tErrorDocument {$num} {$nv}\n";
}
}
$string .= $this->enablePhp();
$string .= $this->getDirprotect('');
return $string;
}
示例10: print_information
function print_information($place, $type, $class, $extr, $vlist = null)
{
global $gbl, $sgbl, $login, $ghtml;
global $g_language_mes;
$pinfo = null;
if ($vlist) {
$info = $vlist;
} else {
$info = implode("_", array($class, $type, $extr, $place));
}
if (isset($g_language_mes->__commonhelp[$info])) {
$info = $g_language_mes->__commonhelp[$info];
}
if ($place !== 'post') {
if (isset($g_language_mes->__information[$info])) {
$pinfo = $g_language_mes->__information[$info];
}
} else {
dprint($info);
print "<table cellpadding=0 cellspacing=0> <tr height=10> <td > </td> </tr> </table> ";
}
if (!$pinfo) {
$info = implode("_", array($type, $extr, $place));
if ($place !== 'post') {
if (isset($g_language_mes->__information[$info])) {
$pinfo = $g_language_mes->__information[$info];
}
} else {
dprint($info);
}
}
if (!$pinfo) {
return;
}
$pinfo = str_replace("<%program%>", $sgbl->__var_program_name, $pinfo);
$pinfo = explode("\n", $pinfo);
$skip = false;
foreach ($pinfo as $p) {
$p = trim($p);
if (csb($p, "<%ifblock:")) {
$name = strfrom($p, "<%ifblock:");
$name = strtil($name, "%>");
$forward = true;
if ($name[0] === '!') {
$forward = false;
$name = strfrom($name, "!");
}
if (method_exists($login, $name)) {
if ($forward) {
if (!$login->{$name}()) {
$skip = true;
}
} else {
if ($login->{$name}()) {
$skip = true;
}
}
} else {
$skip = true;
}
continue;
}
if ($p === "</%ifblock%>") {
$skip = false;
continue;
}
if ($skip) {
continue;
}
$out[] = $p;
}
$pinfo = implode("\n", $out);
$fontcolor = "#000000";
if ($sgbl->isBlackBackground()) {
$fontcolor = "#999999";
}
$this->print_curvy_table_start();
$pinfo = str_replace("\n", "<br>", $pinfo);
$pinfo = str_replace("[b]", "<font style='font-weight: bold'>", $pinfo);
$pinfo = str_replace("[/b]", "</font>", $pinfo);
$ret = preg_match("/<url:([^>]*)>([^<]*)<\\/url>/", $pinfo, $matches);
if ($ret) {
$fullurl = $this->getFullUrl(trim($matches[1]));
$pinfo = preg_replace("/<url:([^>]*)>([^<]*)<\\/url>/", "<a class=insidelist href={$fullurl}> {$matches['2']} </a>", $pinfo);
}
if ($sgbl->isBlackBackground()) {
print "<font color=#999999>";
}
print $pinfo;
if ($sgbl->isBlackBackground()) {
print "</font> ";
}
$this->print_curvy_table_end();
}
示例11: os_get_allips
function os_get_allips()
{
$out = lxshell_output("ifconfig");
$list = explode("\n", $out);
foreach ($list as $l) {
$l = trim($l);
if (!csa($l, "inet addr:")) {
continue;
}
$ip = strfrom($l, "inet addr:");
$ip = strtilfirst($ip, " ");
if (csb($ip, "127.0")) {
continue;
}
$iplist[] = $ip;
}
return $iplist;
}
示例12: getSyncClass
function getSyncClass($master, $syncserver, $class)
{
global $gbl, $sgbl, $login, $ghtml;
if (!$login) {
return;
}
if (isLocalhost($master)) {
$master = 'localhost';
}
if ($login->isSuperadmin() && $master === 'localhost') {
return null;
}
if (isLocalhost($syncserver)) {
$syncserver = 'localhost';
}
//Dynamically load the syncserver info....
if (!isset($this->driver) || !isset($this->driver[$master])) {
$this->loaddriverappInfo($master);
}
if (!isset($this->driver[$master][$syncserver])) {
$this->loaddriverappInfo($master);
}
$class_var = strtolower("pg_" . $class);
//debugBacktrace();
$pgm = $this->driver[$master][$syncserver]->driver_b;
if (isset($pgm->{$class_var})) {
$str = $pgm->{$class_var};
if (csb($str, "__v_")) {
$class_var = "pg_" . strtolower(strfrom($str, "__v_"));
}
return $pgm->{$class_var};
}
return null;
}
示例13: readMaillog
static function readMaillog()
{
$date = time() - 24 * 3600 * 2;
$logfile = "/var/log/kloxo/maillog";
$fp = fopen($logfile, "r");
$fsize = lxfile_size($logfile);
FindRightPosition($fp, $fsize, $date, time(), array("mailtraffic", "getTimeFromOriginalQmailString"));
while (!feof($fp)) {
$s = fgets($fp);
$s = trim($s);
if (!csa($s, "lx-sending")) {
continue;
}
$v = strfrom($s, "mail for");
$id = $v;
if (!isset($total[$id])) {
$total[$id] = 1;
} else {
$total[$id]++;
}
}
return $total;
}
示例14: replace_keywords
function replace_keywords($text, $object)
{
global $gbl, $sgbl, $login, $ghtml;
$text = str_replace("%name%", "{$object->nname}\n", $text);
$text = str_replace("%clientname%", $object->getParentName() . "\n", $text);
$text = str_replace("%password%", $object->realpass, $text);
if ($sgbl->isKloxo()) {
$text = str_replace("%default_domain%", $object->default_domain, $text);
}
if (csa($text, "%ipaddress%")) {
$db = new Sqlite($this->__masterserver, 'ipaddress');
$iplist = $db->getRowsWhere("syncserver = 'localhost'");
$text = str_replace("%ipaddress%", getFQDNforServer('localhost'), $text);
}
if (csa($text, "%masterserver%")) {
$db = new Sqlite($this->__masterserver, 'ipaddress');
$iplist = $db->getRowsWhere("syncserver = 'localhost'");
$text = str_replace("%masterserver%", getFQDNforServer('localhost'), $text);
}
$string = null;
foreach ($this->priv as $k => $v) {
if ($this->isQuotaVariable($k)) {
$var = get_v_descr($this, $k);
$var = get_form_variable_name($var);
$string .= "{$var}: {$v}\n";
}
}
$text = str_replace("%quota%", $string, $text);
$tlist = explode("\n", $text);
$inside = false;
$match = false;
foreach ($tlist as $tl) {
$tl = trim($tl);
if (csb($tl, "<%class:")) {
$inside = true;
$classname = strfrom($tl, "<%class:");
$classname = strtil($classname, "%>");
if ($classname === $this->get__table()) {
$match = true;
}
continue;
}
if ($inside) {
if (csb($tl, "<%/class%>")) {
if ($match) {
$total[] = $object->fillWelcomeMessage(implode("\n", $textinside));
}
$inside = false;
$textinside = null;
} else {
$textinside[] = $tl;
}
continue;
}
$total[] = $tl;
}
return implode("\n", $total);
}
示例15: __ajax_desc_tree
function __ajax_desc_tree()
{
global $gbl, $sgbl, $login, $ghtml;
$object = $gbl->__c_object;
$icondir = get_image_path('/button/');
$rclist = $object->getResourceChildList();
$cid = $ghtml->node;
if ($object->hasFileResource()) {
$u = "a=show&k[class]=ffile&k[nname]=/";
$u = $ghtml->getFullUrl($u);
$v = createClName('ffile', '/');
$ret[] = array('text' => "File", 'icon' => "{$icondir}/ffile_show.gif", 'hrefTarget' => 'mainframe', 'href' => $u, 'id' => "{$cid}&{$v}");
}
if ($ghtml->__resource_class) {
$c = strfrom($ghtml->__resource_class, "__resource_");
if (cse($c, "_l")) {
$clname = $object->getChildNameFromDes($c);
$list = $object->getList($clname, $totalcount);
foreach ($list as $o) {
$u = "a=show&k[class]={$o->getClass()}&k[nname]={$o->nname}";
$u = $ghtml->getFullUrl($u);
$ret[] = array('text' => basename($o->nname), 'icon' => "{$icondir}/{$o->getClass()}_list.gif", 'hrefTarget' => 'mainframe', 'href' => $u, 'id' => "{$cid}&{$o->getClName()}");
}
} else {
if (cse($c, "_o")) {
$clname = $object->getChildNameFromDes($c);
$o = $object->getObject($clname);
$u = "a=show&o={$o->getClass()}";
$u = $ghtml->getFullUrl($u);
$ret[] = array('text' => $o->getClass(), 'icon' => "{$icondir}/{$o->getClass()}_show.gif", 'hrefTarget' => 'mainframe', 'href' => $u, 'id' => "{$cid}&{$o->getClass()}");
}
}
return $ret;
}
if ($ghtml->__title_function) {
$t = $ghtml->__title_function;
$alist = $object->createShowAlist($alist);
foreach ($alist as $k => $v) {
if (csb($k, "__title")) {
if ($k !== $t) {
if ($insidetitle) {
$insidetitle = false;
break;
}
continue;
}
$insidetitle = true;
continue;
}
if ($insidetitle) {
$url = $ghtml->getFullUrl($v);
if ($ghtml->is_special_url($url)) {
continue;
}
$urlinfo = $ghtml->getUrlInfo($url);
$ret[] = array('text' => $urlinfo['description']['desc'], 'icon' => $urlinfo['image'], 'hrefTarget' => 'mainframe', 'leaf' => true, 'href' => $url, 'id' => "&end");
}
}
return $ret;
}
if ($object->hasFunctions()) {
$alist = $object->createShowAlist($alist);
foreach ($alist as $k => $v) {
if (!csb($k, "__title")) {
continue;
}
$title = strfrom($k, "__title_");
if ($title === 'mailaccount') {
continue;
}
if ($title === 'custom') {
continue;
}
$icon = "{$icondir}/__title_{$title}.gif";
if (!lxfile_exists("__path_program_htmlbase/{$icon}")) {
//lfile_put_contents("title.img", "$title.gif\n", FILE_APPEND);
$icon = null;
}
$ret[] = array('text' => $v, 'icon' => $icon, 'hrefTarget' => '', 'href' => null, 'id' => "{$cid}&{$k}");
}
}
foreach ($rclist as $c) {
$clname = $object->getChildNameFromDes($c);
$desc = get_description($clname);
$desc = get_plural($desc);
$url = $ghtml->getFullUrl("a=list&c={$clname}");
$ret[] = array('text' => $desc, 'icon' => "{$icondir}/{$clname}_list.gif", 'hrefTarget' => 'mainframe', 'href' => $url, 'id' => "{$cid}&__resource_{$c}");
}
return $ret;
}