<?php
/**
* Class representing phpQuery objects.
*
* @author Tobiasz Cudnik <tobiasz.cudnik/gmail.com>
* @package phpQuery
* @method phpQueryObject clone() clone()
* @method phpQueryObject empty() empty()
* @method phpQueryObject next() next($selector = null)
* @method phpQueryObject prev() prev($selector = null)
* @property Int $length
*/
class phpQueryObject
implements Iterator, Countable, ArrayAccess {
public $documentID = null;
/**
* DOMDocument class.
*
* @var DOMDocument
*/
public $document = null;
public $charset = null;
/**
*
* @var DOMDocumentWrapper
*/
public $documentWrapper = null;
/**
* XPath interface.
*
* @var DOMXPath
*/
public $xpath = null;
/**
* Stack of selected elements.
* @TODO refactor to ->nodes
* @var array
*/
public $elements = array();
/**
* @access private
*/
protected $elementsBackup = array();
/**
* @access private
*/
protected $previous = null;
/**
* @access private
* @TODO deprecate
*/
protected $root = array();
/**
* Indicated if doument is just a fragment (no <html> tag).
*
* Every document is realy a full document, so even documentFragments can
* be queried against <html>, but getDocument(id)->htmlOuter() will return
* only contents of <body>.
*
* @var bool
*/
public $documentFragment = true;
/**
* Iterator interface helper
* @access private
*/
protected $elementsInterator = array();
/**
* Iterator interface helper
* @access private
*/
protected $valid = false;
/**
* Iterator interface helper
* @access private
*/
protected $current = null;
/**
* Enter description here...
*
* @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery
*/
public function __construct($documentID) {
// if ($documentID instanceof self)
// var_dump($documentID->getDocumentID());
$id = $documentID instanceof self
? $documentID->getDocumentID()
: $documentID;
// var_dump($id);
if (! isset(phpQuery::$documents[$id] )) {
// var_dump(phpQuery::$documents);
throw new Exception("Document with ID '{$id}' isn't loaded. Use phpQuery::newDocument(\$html) or phpQuery::newDocumentFile(\$file) first.");
}
$this->documentID = $id;
$this->documentWrapper =& phpQuery::$documents[$id];
$this->document =& $this->documentWrapper->document;
$this->xpath =& $this->documentWrapper->xpath;
$this->charset =& $this->documentWrapper->charset;
$this->documentFragment =& $this->documentWrapper->isDocumentFragment;
// TODO check $this->DOM->documentElement;
// $this->root = $this->document->documentElement;
$this->root =& $this->documentWrapper->root;
// $this->toRoot();
$this->elements = array($this->root);
}
/**
*
* @access private
* @param $attr
* @return unknown_type
*/
public function __get($attr) {
switch($attr) {
// FIXME doesnt work at all ?
case 'length':
return $this->size();
break;
default:
return $this->$attr;
}
}
/**
* Saves actual object to $var by reference.
* Useful when need to break chain.
* @param phpQueryObject $var
* @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery
*/
public function toReference(&$var) {
return $var = $this;
}
public function documentFragment($state = null) {
if ($state) {
phpQuery::$documents[$this->getDocumentID()]['documentFragment'] = $state;
return $this;
}
return $this->documentFragment;
}
/**
* @access private
* @TODO documentWrapper
*/
protected function isRoot( $node) {
// return $node instanceof DOMDOCUMENT || $node->tagName == 'html';
return $node instanceof DOMDOCUMENT
|| ($node instanceof DOMELEMENT && $node->tagName == 'html')
|| $this->root->isSameNode($node);
}
/**
* @access private
*/
protected function stackIsRoot() {
return $this->size() == 1 && $this->isRoot($this->elements[0]);
}
/**
* Enter description here...
* NON JQUERY METHOD
*
* Watch out, it doesn't creates new instance, can be reverted with end().
*
* @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery
*/
public function toRoot() {
$this->elements = array($this->root);
return $this;
// return $this->newInstance(array($this->root));
}
/**
* Saves object's DocumentID to $var by reference.
* <code>
* $myDocumentId;
* phpQuery::newDocument('<div/>')
* ->getDocumentIDRef($myDocumentId)
* ->find('div')->...
* </code>
*
* @param unknown_type $domId
* @see phpQuery::newDocument
* @see phpQuery::newDocumentFile
* @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery
*/
public function getDocumentIDRef(&$documentID) {
$documentID = $this->getDocumentID();
return $this;
}
/**
* Returns object with stack set to document root.
*
* @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery
*/
public function getDocument() {
return phpQuery::getDocument($this->getDocumentID());
}
/**
*
* @return DOMDocument
*/
public function getDOMDocument() {
return $this->document;
}
/**
* Get object's Document ID.
*
* @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery
*/
public function getDocumentID() {
return $this->documentID;
}
/**
* Unloads whole document from memory.
* CAUTION! None further operations will be possible on this document.
* All objects refering to it will be useless.
*
* @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery
*/
public function unloadDocument() {
phpQuery::unloadDocuments($this->getDocumentID());
}
public function isHTML() {
return $this->documentWrapper->isHTML;
}
public function isXHTML() {
return $this->documentWrapper->isXHTML;
}
public function isXML() {
return $this->documentWrapper->isXML;
}
/**
* Enter description here...
*
* @link http://docs.jquery.com/Ajax/serialize
* @return string
*/
public function serialize() {
return phpQuery::param($this->serializeArray());
}
/**
* Enter description here...
*
* @link http://docs.jquery.com/Ajax/serializeArray
* @return array
*/
public function serializeArray($submit = null) {
$source = $this->filter('form, input, select, textarea')
->find('input, select, textarea')
->andSelf()
->not('form');
$return = array();
// $source->dumpDie();
foreach($source as $input) {
$input = phpQuery::pq($input);
if ($input->is('[disabled]'))
continue;
if (!$input->is('[name]'))
continue;
if ($input->is('[type=checkbox]') && !$input->is('[checked]'))
continue;
// jquery diff
if ($submit && $input->is('[type=submit]')) {
if ($submit instanceof DOMELEMENT && ! $input->elements[0]->isSameNode($submit))
continue;
else if (is_string($submit) && $input->attr('name') != $submit)
continue;
}
$return[] = array(
'name' => $input->attr('name'),
'value' => $input->val(),
);
}
return $return;
}
/**
* @access private
*/
protected function debug($in) {
if (! phpQuery::$debug )
return;
print('<pre>');
print_r($in);
// file debug
// file_put_contents(dirname(__FILE__).'/phpQuery.log', print_r($in, true)."\n", FILE_APPEND);
// quite handy debug trace
// if ( is_array($in))
// print_r(array_slice(debug_backtrace(), 3));
print("</pre>\n");
}
/**
* @access private
*/
protected function isRegexp($pattern) {
return in_array(
$pattern[ mb_strlen($pattern)-1 ],
array('^','*','$')
);
}
/**
* Determines if $char is really a char.
*
* @param string $char
* @return bool
* @todo rewrite me to charcode range ! ;)
* @access private
*/
protected function isChar($char) {
return extension_loaded('mbstring') && phpQuery::$mbstringSupport
? mb_eregi('\w', $char)
: preg_match('@\w@', $char);
}
/**
* @access private
*/
protected function pars
没有合适的资源?快使用搜索试试~ 我知道了~
thinkphp写的在线聊天源码
共1665个文件
js:396个
png:292个
php:268个
需积分: 0 0 下载量 141 浏览量
2022-11-07
22:06:25
上传
评论
收藏 19.34MB ZIP 举报
温馨提示
thinkphp写的在线聊天源码 基于workman
资源推荐
资源详情
资源评论
收起资源包目录
thinkphp写的在线聊天源码 (1665个子文件)
start_for_win.bat 110B
summernote-bs3.css 143KB
summernote-bs3.css 143KB
bootstrap.min.css 118KB
bootstrap.min.css 118KB
style.min.css 97KB
style.min.css 97KB
animate.min.css 46KB
animate.min.css 46KB
ueditor.css 43KB
ueditor.css 43KB
ueditor.min.css 34KB
ueditor.min.css 34KB
datepicker3.css 33KB
datepicker3.css 33KB
layui.css 32KB
layui.css 32KB
font-awesome.min.css 26KB
font-awesome.min.css 26KB
ambiance.css 25KB
ambiance.css 25KB
style.min.css 25KB
style.min.css 25KB
video-js.css 21KB
video-js.css 21KB
image.css 18KB
image.css 18KB
sweetalert.css 18KB
sweetalert.css 18KB
simditor.css 17KB
simditor.css 17KB
ui.jqgridffe4.css 16KB
ui.jqgridffe4.css 16KB
layer.css 15KB
layer.css 15KB
layim.css 15KB
layim.css 15KB
video.css 15KB
video.css 15KB
attachment.css 14KB
attachment.css 14KB
jasny-bootstrap.min.css 14KB
jasny-bootstrap.min.css 14KB
chosen.css 12KB
chosen.css 12KB
dropzone.css 11KB
dropzone.css 11KB
video-js.min.css 11KB
video-js.min.css 11KB
layer.css 11KB
layer.css 11KB
layim.css 11KB
layim.css 11KB
fullcalendar.css 11KB
fullcalendar.css 11KB
summernote.css 10KB
summernote.css 10KB
plyr.css 10KB
plyr.css 10KB
laydate.css 9KB
laydate.css 9KB
zTreeStyle.css 7KB
zTreeStyle.css 7KB
codemirror.css 7KB
codemirror.css 7KB
shCoreDefault.css 7KB
shCoreDefault.css 7KB
blueimp-gallery.min.css 7KB
blueimp-gallery.min.css 7KB
awesome-bootstrap-checkbox.css 7KB
awesome-bootstrap-checkbox.css 7KB
toastr.min.css 7KB
toastr.min.css 7KB
laydate.css 6KB
laydate.css 6KB
webuploader-demo.min.css 6KB
webuploader-demo.min.css 6KB
laydate.css 6KB
laydate.css 6KB
jquery.steps.css 6KB
jquery.steps.css 6KB
footable.core.css 5KB
footable.core.css 5KB
jquery.fancybox.css 5KB
jquery.fancybox.css 5KB
dataTables.bootstrap.css 5KB
dataTables.bootstrap.css 5KB
bootstrap-table.min.css 4KB
bootstrap-table.min.css 4KB
scrawl.css 4KB
scrawl.css 4KB
clockpicker.css 4KB
clockpicker.css 4KB
basic.css 4KB
basic.css 4KB
style.css 4KB
style.css 4KB
laydate.css 3KB
laydate.css 3KB
bootstrap-colorpicker.min.css 3KB
共 1665 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
资源评论
codeMMBB
- 粉丝: 13
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 部署yolov8的tensorrt模型支持检测分割姿态估计的C++源码+部署步骤.zip
- 以简单、易用、高性能为目标、开源的时序数据库,支持Linux及Windows, Time Series Database.zip
- python-leetcode面试题解之第198题打家劫舍-题解.zip
- python-leetcode面试题解之第191题位1的个数-题解.zip
- python-leetcode面试题解之第186题反转字符串中的单词II-题解.zip
- 一个基于python的web后端高性能开发框架,下载可用
- python-leetcode面试题解之第179题最大数-题解.zip
- python-leetcode面试题解之第170题两数之和III数据结构设计-题解.zip
- python-leetcode面试题解之第168题Excel表列名称-题解.zip
- python-leetcode面试题解之第167题两数之和II输入有序数组-题解.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功