本文整理汇总了PHP中str::isempty方法的典型用法代码示例。如果您正苦于以下问题:PHP str::isempty方法的具体用法?PHP str::isempty怎么用?PHP str::isempty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类str
的用法示例。
在下文中一共展示了str::isempty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: proc
function proc($params)
{
require_once "MailGrabber.php";
print "<pre>";
if (str::isempty($params["id"])) {
die("<b>Ошибка: Фильтр не выбран</b>\n");
}
set_time_limit(0);
$json = new Services_JSON();
$mailgrabber = new MailGrabber();
$mailgrabber->run($json->decode(file::load("data/config.ini")), true, $params["id"]);
}
示例2: parse
function parse($msg, $rule)
{
$items = array();
if (!preg_match("{\\[text(=[^]]+)*\\]\\s*\\[list(=[^]]+)*\\](.+?)\\[list/\\]}si", $rule, $m)) {
print "Shit rule\n";
return $items;
}
$text = isset($m[1]) ? trim(substr($m[1], 1)) : "";
list($min, $max) = isset($m[2]) ? explode("..", trim(substr($m[2], 1))) : array(0, 0);
if (!preg_match_all($f = "{\\[(.+?)(=([^]]+))*\\]}si", $sfields = $m[3], $fields)) {
print "Fields is empty\n";
return $items;
}
//print $sfields . "\n";
//print_r(array($rule, $msg));
//$pattern = preg_replace("{FIELD_TAG}s", "(.+?)",
// "{" . preg_replace("{\s+}si", "\s+", preg_quote(preg_replace($f, "FIELD_TAG", $m[2]))) . "\n}si");
$pattern = preg_replace("{\r\n{1}}", "\n", $pattern);
$pattern = preg_replace("{FIELD_TAG}s", "(.+?)", "{" . preg_quote(preg_replace($f, "FIELD_TAG", $sfields)) . "}si");
//print $pattern . "\n";
$content = $this->cutContent($msg, $text);
$content = preg_replace("{\r\n{1}}", "\n", $content);
$content = preg_replace("{[ ]+}si", " ", $content);
//print $content;
preg_match_all($pattern, $content, $res, PREG_SET_ORDER);
foreach ($res as $r) {
$match = true;
$a = $r;
array_shift($a);
// Check contains values in fields
foreach ($a as $i => $f) {
if (!str::isempty($sf = trim($fields[3][$i])) && strpos(strtolower($f), strtolower($sf)) === false) {
$match = false;
break;
}
}
if (!$match) {
continue;
}
$a = array_combine($fields[1], $a);
// Process items
if (isset($a["thumb"])) {
$a["thumb"] = trim(preg_replace("{\\s+}si", "", $a["thumb"]));
}
if (isset($a["url"])) {
$a["url"] = trim(preg_replace("{\\s+}si", "", $a["url"]));
$p = strpos($a["url"], "http://");
if ($p === false || $p > 0) {
unset($a["url"]);
}
}
if (sizeof($a) > 0) {
$items[] = $a;
}
}
if ($min == "") {
$min = 0;
}
if ($max == 0 || $max == "") {
$max = sizeof($items);
}
return array_slice($items, $min, $max - $min + 1);
}