本文整理汇总了PHP中phpQuery::merge方法的典型用法代码示例。如果您正苦于以下问题:PHP phpQuery::merge方法的具体用法?PHP phpQuery::merge怎么用?PHP phpQuery::merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpQuery
的用法示例。
在下文中一共展示了phpQuery::merge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pseudoClasses
//.........这里部分代码省略.........
if (mb_stripos($node->textContent, $text) === false) {
continue;
}
$stack[] = $node;
}
$this->elements = $stack;
break;
case 'not':
$selector = self::unQuote($args);
$this->elements = $this->not($selector)->stack();
break;
case 'slice':
// TODO jQuery difference ?
$args = explode(',', str_replace(', ', ',', trim($args, "\"'")));
$start = $args[0];
$end = isset($args[1]) ? $args[1] : null;
if ($end > 0) {
$end = $end - $start;
}
$this->elements = array_slice($this->elements, $start, $end);
break;
case 'has':
$selector = trim($args, "\"'");
$stack = array();
foreach ($this->stack(1) as $el) {
if ($this->find($selector, $el, true)->length) {
$stack[] = $el;
}
}
$this->elements = $stack;
break;
case 'submit':
case 'reset':
$this->elements = phpQuery::merge($this->map(array($this, 'is'), "input[type={$class}]", new CallbackParam()), $this->map(array($this, 'is'), "button[type={$class}]", new CallbackParam()));
break;
// $stack = array();
// foreach($this->elements as $node)
// if ($node->is('input[type=submit]') || $node->is('button[type=submit]'))
// $stack[] = $el;
// $this->elements = $stack;
// $stack = array();
// foreach($this->elements as $node)
// if ($node->is('input[type=submit]') || $node->is('button[type=submit]'))
// $stack[] = $el;
// $this->elements = $stack;
case 'input':
$this->elements = $this->map(array($this, 'is'), 'input', new CallbackParam())->elements;
break;
case 'password':
case 'checkbox':
case 'radio':
case 'hidden':
case 'image':
case 'file':
$this->elements = $this->map(array($this, 'is'), "input[type={$class}]", new CallbackParam())->elements;
break;
case 'parent':
$this->elements = $this->map(create_function('$node', '
return $node instanceof DOMELEMENT && $node->childNodes->length
? $node : null;'))->elements;
break;
case 'empty':
$this->elements = $this->map(create_function('$node', '
return $node instanceof DOMELEMENT && $node->childNodes->length
? null : $node;'))->elements;
break;