<?php
/**
* Website: http://sourceforge.net/projects/simplehtmldom/
* Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
* Contributions by:
* Yousuke Kumakura (Attribute filters)
* Vadim Voituk (Negative indexes supports of "find" method)
* Antcs (Constructor with automatically load contents either text or file/url)
*
* all affected sections have comments starting with "PaperG"
*
* Paperg - Added case insensitive testing of the value of the selector.
* Paperg - Added tag_start for the starting index of tags - NOTE: This works but not accurately.
* This tag_start gets counted AFTER \r\n have been crushed out, and after the remove_noice calls so it will not reflect the REAL position of the tag in the source,
* it will almost always be smaller by some amount.
* We use this to determine how far into the file the tag in question is. This "percentage will never be accurate as the $dom->size is the "real" number of bytes the dom was created from.
* but for most purposes, it's a really good estimation.
* Paperg - Added the forceTagsClosed to the dom constructor. Forcing tags closed is great for malformed html, but it CAN lead to parsing errors.
* Allow the user to tell us how much they trust the html.
* Paperg add the text and plaintext to the selectors for the find syntax. plaintext implies text in the innertext of a node. text implies that the tag is a text node.
* This allows for us to find tags based on the text they contain.
* Create find_ancestor_tag to see if a tag is - at any level - inside of another specific tag.
* Paperg: added parse_charset so that we know about the character set of the source document.
* NOTE: If the user's system has a routine called get_last_retrieve_url_contents_content_type availalbe, we will assume it's returning the content-type header from the
* last transfer or curl_exec, and we will parse that and use it in preference to any other method of charset detection.
*
* Found infinite loop in the case of broken html in restore_noise. Rewrote to protect from that.
* PaperG (John Schlick) Added get_display_size for "IMG" tags.
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @author S.C. Chen <me578022@gmail.com>
* @author John Schlick
* @author Rus Carroll
* @version 1.5 ($Rev: 196 $)
* @package PlaceLocalInclude
* @subpackage simple_html_dom
*/
/**
* All of the Defines for the classes below.
* @author S.C. Chen <me578022@gmail.com>
*/
define('HDOM_TYPE_ELEMENT', 1);
define('HDOM_TYPE_COMMENT', 2);
define('HDOM_TYPE_TEXT', 3);
define('HDOM_TYPE_ENDTAG', 4);
define('HDOM_TYPE_ROOT', 5);
define('HDOM_TYPE_UNKNOWN', 6);
define('HDOM_QUOTE_DOUBLE', 0);
define('HDOM_QUOTE_SINGLE', 1);
define('HDOM_QUOTE_NO', 3);
define('HDOM_INFO_BEGIN', 0);
define('HDOM_INFO_END', 1);
define('HDOM_INFO_QUOTE', 2);
define('HDOM_INFO_SPACE', 3);
define('HDOM_INFO_TEXT', 4);
define('HDOM_INFO_INNER', 5);
define('HDOM_INFO_OUTER', 6);
define('HDOM_INFO_ENDSPACE',7);
define('DEFAULT_TARGET_CHARSET', 'UTF-8');
define('DEFAULT_BR_TEXT', "\r\n");
define('DEFAULT_SPAN_TEXT', " ");
if (!defined('MAX_FILE_SIZE')) {
define('MAX_FILE_SIZE', 600000);
}
// helper functions
// -----------------------------------------------------------------------------
// get html dom from file
// $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1.
function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
{
// We DO force the tags to be terminated.
$dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
do {
$repeat = false;
if ($context!==NULL)
{
// Test if "Accept-Encoding: gzip" has been set in $context
$params = stream_context_get_params($context);
if (isset($params['options']['http']['header']) && preg_match('/gzip/', $params['options']['http']['header']) !== false)
{
$contents = file_get_contents('compress.zlib://'.$url, $use_include_path, $context, $offset);
}
else
{
$contents = file_get_contents($url, $use_include_path, $context, $offset);
}
}
else
{
$contents = file_get_contents($url, $use_include_path, NULL, $offset);
}
// test if the URL doesn't return a 200 status
if (isset($http_response_header) && strpos($http_response_header[0], '200') === false) {
// has a 301 redirect header been sent?
$pattern = "/^Location:\s*(.*)$/i";
$location_headers = preg_grep($pattern, $http_response_header);
if (!empty($location_headers) && preg_match($pattern, array_values($location_headers)[0], $matches)) {
// set the URL to that returned via the redirect header and repeat this loop
$url = $matches[1];
$repeat = true;
}
}
} while ($repeat);
// stop processing if the header isn't a good responce
if (isset($http_response_header) && strpos($http_response_header[0], '200') === false)
{
return false;
}
// stop processing if the contents are too big
if (empty($contents) || strlen($contents) > MAX_FILE_SIZE)
{
return false;
}
// The second parameter can force the selectors to all be lowercase.
$dom->load($contents, $lowercase, $stripRN);
return $dom;
}
// get html dom from string
function str_get_html($str, $lowercase=true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
{
$dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
if (empty($str) || strlen($str) > MAX_FILE_SIZE)
{
$dom->clear();
return false;
}
$dom->load($str, $lowercase, $stripRN);
return $dom;
}
// dump html dom tree
function dump_html_tree($node, $show_attr=true, $deep=0)
{
$node->dump($node);
}
/**
* simple html dom node
* PaperG - added ability for "find" routine to lowercase the value of the selector.
* PaperG - added $tag_start to track the start position of the tag in the total byte index
*
* @package PlaceLocalInclude
*/
class simple_html_dom_node
{
public $nodetype = HDOM_TYPE_TEXT;
public $tag = 'text';
public $attr = array();
public $children = array();
public $nodes = array();
public $parent = null;
// The "info" array - see HDOM_INFO_... for what each element contains.
public $_ = array();
public $tag_start = 0;
private $dom = null;
function __construct($dom)
{
$this->dom = $dom;
$dom->nodes[] = $this;
}
function __destruct()
{
$this->clear();
}
function __toString()
{
return $this->outertext();
}
// clean up memory due to php5 circular references memory leak...
function clear()
{
$this->dom = null;
$this->nodes = null;
$this->parent = null;
$this->children = null;
}
// dump node's tree
function dump($show_attr=true, $deep=0)
{
$lead = str_repeat(' ', $deep);
echo $lead.$this->tag;
if ($show_attr && count($this->attr)>0)
{
echo '(';
foreach ($this->attr as $k=>$v)
echo "[$k]=>\"".$this->$k.'", ';
echo ')';
}
echo "\n";
if ($this->nodes)
{
foreach ($this->nodes as $c)
{
$c->dump($show_attr, $deep+1);
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于PHP+CI框架+AdminLite的博客管理系统.zip
共1862个文件
js:613个
php:267个
html:265个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 65 浏览量
2024-06-15
19:44:21
上传
评论
收藏 15.58MB ZIP 举报
温馨提示
该资源内项目源码是个人的课程设计、毕业设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 该资源内项目源码是个人的课程设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。
资源推荐
资源详情
资源评论
收起资源包目录
基于PHP+CI框架+AdminLite的博客管理系统.zip (1862个子文件)
.buildinfo 230B
ci_session0439ndouonalqii2q5mcrn2so180767n 4KB
ci_session0qb1q45juv698sf5louu9sg40ui0ah4o 4KB
ci_session0u33dutg5otg3ird44ud0v7fb3poor2a 4KB
ci_session10uabjmeg54n96qdj98c28uamfbae2o1 4KB
ci_session11cuk76a628jb3f27vqj5b4ug4v4up0k 4KB
ci_session11dd0c4meoe7en0446ao5p1pt0kdd4ul 4KB
ci_session146bc0e95aa0cgp1p6t40sua0ldjv3jg 4KB
ci_session17lpdmvfv0q2tmp2darcu6pdnrc1mpvi 4KB
ci_session17s8t6n8ftjkbd689de63nd56n3e1dqs 4KB
ci_session1dt0nfnaai9nnkuk3ro5b5usugtb0mde 34B
ci_session1n1asl80ofvob3go8djl9psvhj0rtqjq 4KB
ci_session1q2c994jb5bcda689vic2ta0emtaonpu 4KB
ci_session1qcnsk15i78dgc2o6motogr778t2u2il 4KB
ci_session1qhcrfdaoqe55rdtqstoshi7dln4u69i 4KB
ci_session2295jj594qdnpdhg8a3nb4ati2fv9mur 4KB
ci_session2ofrtm26a35tqr1irpaule0jah1aa39l 3KB
ci_session2v5cvd8r7v1u7egkon0saf46u0vhj1fc 4KB
ci_session2vbjpus9fpo7bost0kjv81m32foq1pp6 4KB
ci_session316sjih9hsbvpnou5larq8gconj7qapm 4KB
ci_session392nf68f0v58tkh6j2cc23h2qmem92eo 4KB
ci_session3ekt6qeojis1orgtd3tme1knne9j3v18 4KB
ci_session3nk10fhisu34dcja0tjcnlnknqi06089 4KB
ci_session3stk7jua39luethmdhgdvecamarpd37p 4KB
ci_session3u50l4af9lodobc5gme818v6e2ljn41a 3KB
ci_session42jssqgi09rpq2vfal9bm5cm0c7uigqs 4KB
ci_session435patgspncfvj6ciqks3njdcl5d1fto 4KB
ci_session4vb60kv8b6d5q45oaeh6pttl0cdbmhs2 4KB
ci_session5fnu1nu2s9dap9uvj0m1uuclqdd6mjee 4KB
ci_session5igv1374k4f79engdflrvi39ebvp9i1o 4KB
ci_session5kjruuau603aiontsfkuketvmoprjtjd 4KB
ci_session5o6ksm8on7oaorr43tj6a1pu9co2guqj 4KB
ci_session60dkmb9347ol12dh2h0chp0q3qjga1jd 4KB
ci_session6cs1r53m1a30gflhc2t0j4iairov95uh 4KB
ci_session6t27iju45m4sng08l6r6759i17ct0qf7 4KB
ci_session78124vf8ghjdfvboofjs8neg8cshrtqo 4KB
ci_session7ch84iv9obmt1n4npta7upka6t48s7of 4KB
ci_session7eih236lidsmckqbils9kgsscqdlhl2b 4KB
ci_session7kpkv4kcvgokh5rnlostgbv0ds604nte 4KB
ci_session7mf5e3u6ck1q72dggek7ea6btv61g515 4KB
ci_session7pb38rfmh12jb9c80jn1tin14hpo0r3r 4KB
ci_session8ecut15vc4pqlsjcl7f0gekm9o8ito3h 4KB
ci_session8j7e2tnjesgvo4ku3qk7u4601go5g185 4KB
ci_session8n3iapikbr314e2nbbarhd4o9t9k0m1k 4KB
ci_session8vlt7eq6ihdvfbgftlh9lqf8lglgn7ep 4KB
ci_session9ae8v2c0daofcmfichs3aobeqvbpeheb 4KB
ci_session9nrlpmjmoesrli0hk14mp0ed87uksl4t 4KB
ci_session9rirr6nah9fhrcucjd7caip68j6hs7do 4KB
ci_sessionbfef4cqs4lj1uvpilra9bcsn8krb5253 4KB
ci_sessionbfm5nn8h6j2di1lbgbumq54qfs4vt0gd 4KB
ci_sessionblnlsnrqfr6hiu4q46mgbs86uh18r3tq 4KB
ci_sessionc53mbtrjmm6d9rqgtq9onbc3vi76d5gi 3KB
ci_sessionc7egko82kn373voa8bdc60092u7au6ou 4KB
ci_sessionce3qvvbg000qkairf5qmkrar50ds2cef 4KB
ci_sessionclrbgsjiji47nk1n1lsurccgfh3vhrvc 4KB
ci_sessioncm0ivspuk1og83d2ull2n0ifgh1mhkks 4KB
ci_sessiond09dj58o2aorf6erlnt7ir247u8n920k 4KB
ci_sessiondvtkpnm8ap7302p4sbgiuph5urvsl4ts 4KB
ci_sessioneebj1msg0k3v7805ev36gbu2drlfo1pa 4KB
ci_sessionepq95mprqhgqa4ncth36bnj8atikegck 4KB
ci_sessionfk5hm53ordanf4a4084r3k6r0sujp7ek 4KB
ci_sessionfr23fftb9mv1g39shimi8l5q7b2dd87q 4KB
ci_sessiong7iuktl78rbd8t4qt3mo0tgg0f6fcohc 4KB
ci_sessionhr0vpgceco2ua462n8oa8l6q5hgtr894 4KB
ci_sessioni1bk4cdlt8l383djo05ts35f13virk4o 34B
ci_sessionia3avad33tsgae0pa9pl9f626lonuicb 4KB
ci_sessionigilnfa73rin5pbhnjei50nn6q1pilgi 4KB
ci_sessionijnkvld3fri8mruobben2m2ft9f2itkc 4KB
ci_sessionjccoccr0pj39iss7c7eopiia88feebv1 4KB
ci_sessionjei9hj04h8en48op79ippce3924l4krt 4KB
ci_sessionjekkvifgm1km6eccgul4h17pjo776a8d 4KB
ci_sessionjeku5ejgjq95h6v7log3pqfjdpggncsk 34B
ci_sessionk1hu0i1q0gsi6qsv2bhmcitiv7jk7g5f 4KB
ci_sessionk43o6juapkr83061k1fjd7ec0ts85e24 4KB
ci_sessionk7da360k0cd36sin4vvvbqt9h3i5dkrd 34B
ci_sessionkj0fnvcsmvun1rl8806r23b3p3sdbhjp 4KB
ci_sessionl0ilfeavn9m6f5l630ennddvuts15uqt 4KB
ci_sessionl1p0pmhq7aii55ef7jbqn07ipi027ur4 4KB
ci_sessionlanb5rrmgs0lbdqpctijb2sls3qve3rd 4KB
ci_sessionlg43qm0hi8eubjvhqp4ag448tn0o0161 4KB
ci_sessionlqgf2dc10tgjjsaf907b865geo9f9gs9 4KB
ci_sessionm67i0re62rb38a8a0tvsu9o2dnopgj36 4KB
ci_sessionm9l5u8fj722n4k5v6efmtqbg0c727i20 4KB
ci_sessionmfmqpg0eka36frftfi92i3pl9k3qt3qj 3KB
ci_sessionmfn4je90suot8472udmp5g3ot0fi8pfl 4KB
ci_sessionmjho3itp4dhpl99v0u9he7lk3df6mcqp 3KB
ci_sessionmm0daf2vu7vk64q11m89v94hc7r4ll2j 3KB
ci_sessionmvm1oc4c8estk8f0o8do0n6blm0g1qg6 4KB
ci_sessionn0tf8jotd6q92sgvtgd17kotvqe7uroh 34B
ci_sessionn7lkajs3lqrrktvgbjsqodu3alku6crc 4KB
ci_sessionn8ctmkai1na1nf3vehdjt3h5ngeq66m2 4KB
ci_sessiono03bad8klm3gfd725hlobtf5vol9gqtv 3KB
ci_sessionoch4evhkj8tnokr2u0mdijfvd3t43661 4KB
ci_sessionocrpmdkciavevp26b8tj8sso0ait01h1 4KB
ci_sessionoe9ma7bg4h2om1cdi3khtcrt8r7cocoq 4KB
ci_sessionofssrsh7bjgii4qnfnja7t7tbqpq6h3l 4KB
ci_sessionofunb75s519cegr0bfvnsiju94l139nt 4KB
ci_sessionogbml5sjg9vfvlfv87827hb6ktdtbvh6 4KB
ci_sessiononentbp94m1a8qhsnoclf0i6jqf9uh2v 4KB
ci_sessionovmf3sv7v8tbt01mfqusgsmcjjn98j8m 4KB
共 1862 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19
资源评论
毕业小助手
- 粉丝: 2761
- 资源: 5583
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 白色大气风格的宠物猫俱乐部模板下载.zip
- 白色大气风格的插画设计网页模板下载.zip
- 白色大气风格的产品创意设计网站模板下载.zip
- 白色大气风格的电子邮件订阅模板下载.zip
- 白色大气风格的电子数码购物商城网站源码下载.zip
- 白色大气风格的春夏时装秀网站模板下载.zip
- 白色大气风格的多用途单页HTML5模板.zip
- 白色大气风格的多用途电子商务模板下载.zip
- 白色大气风格的度假村酒店HTML5模板.zip
- 白色大气风格的翻页效果动画模板下载.zip
- 白色大气风格的多终端版本网站模板下载.zip
- 白色大气风格的多用途企业网站模板.zip
- 白色大气风格的房地产开发公司模板下载.zip
- 白色大气风格的服饰模特网站模板下载.zip
- 白色大气风格的房产建筑公司模板下载.zip
- 白色大气风格的服装设计公司模板下载.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功