├── testcase ├── reader │ ├── .svn │ │ ├── dir-prop-base │ │ ├── prop-base │ │ │ ├── all_test.php.svn-base │ │ │ ├── memory_test.php.svn-base │ │ │ ├── element_testcase.php.svn-base │ │ │ ├── performance_test.php.svn-base │ │ │ └── selector_testcase.php.svn-base │ │ ├── text-base │ │ │ ├── all_test.php.svn-base │ │ │ ├── performance_test.php.svn-base │ │ │ └── memory_test.php.svn-base │ │ ├── all-wcprops │ │ └── entries │ ├── all_test.php │ ├── performance_test.php │ └── memory_test.php ├── .svn │ ├── prop-base │ │ ├── all_test.php.svn-base │ │ ├── mass_test.php.svn-base │ │ ├── memory_test.php.svn-base │ │ ├── slick_test.php.svn-base │ │ ├── slickspeed.htm.svn-base │ │ ├── dom_testcase.php.svn-base │ │ ├── element_testcase.php.svn-base │ │ ├── invalid_testcase.php.svn-base │ │ ├── jquery-1.2.3.pack.js.svn-base │ │ ├── misc_testcase.php.svn-base │ │ ├── std_testcase.php.svn-base │ │ ├── strip_testcase.php.svn-base │ │ ├── selector_testcase.php.svn-base │ │ ├── callback_testcase.php.svn-base │ │ └── performance_test.php.svn-base │ ├── text-base │ │ ├── all_test.php.svn-base │ │ ├── performance_test.php.svn-base │ │ ├── slick_test.php.svn-base │ │ ├── callback_testcase.php.svn-base │ │ ├── misc_testcase.php.svn-base │ │ ├── mass_test.php.svn-base │ │ ├── strip_testcase.php.svn-base │ │ ├── memory_test.php.svn-base │ │ ├── std_testcase.php.svn-base │ │ └── element_testcase.php.svn-base │ ├── all-wcprops │ └── entries ├── html │ └── .svn │ │ ├── all-wcprops │ │ └── entries ├── all_test.php ├── performance_test.php ├── slick_test.php ├── misc_testcase.php ├── callback_testcase.php ├── mass_test.php ├── strip_testcase.php ├── memory_test.php ├── std_testcase.php └── element_testcase.php ├── manual ├── .svn │ ├── prop-base │ │ ├── manual.htm.svn-base │ │ ├── manual_api.htm.svn-base │ │ └── manual_faq.htm.svn-base │ ├── all-wcprops │ ├── entries │ └── text-base │ │ └── manual_faq.htm.svn-base ├── img │ ├── tab.png │ └── .svn │ │ ├── prop-base │ │ └── tab.png.svn-base │ │ ├── text-base │ │ └── tab.png.svn-base │ │ ├── all-wcprops │ │ └── entries ├── css │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ └── text-base │ │ │ ├── default.css.svn-base │ │ │ └── ui.tabs.css.svn-base │ ├── default.css │ └── ui.tabs.css ├── js │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ └── text-base │ │ │ └── ui.tabs.pack.js.svn-base │ └── ui.tabs.pack.js └── manual_faq.htm ├── app ├── js │ ├── images │ │ ├── .svn │ │ │ ├── prop-base │ │ │ │ ├── treeview-default.gif.svn-base │ │ │ │ └── treeview-default-line.gif.svn-base │ │ │ ├── text-base │ │ │ │ ├── treeview-default.gif.svn-base │ │ │ │ └── treeview-default-line.gif.svn-base │ │ │ ├── all-wcprops │ │ │ └── entries │ │ ├── treeview-default.gif │ │ └── treeview-default-line.gif │ ├── .svn │ │ ├── all-wcprops │ │ ├── text-base │ │ │ ├── screen.css.svn-base │ │ │ ├── jquery.treeview.css.svn-base │ │ │ └── jquery.treeview.js.svn-base │ │ └── entries │ ├── screen.css │ ├── jquery.treeview.css │ └── jquery.treeview.js ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ └── index.php.svn-base └── index.php ├── example ├── example_extract_html.php ├── .svn │ ├── text-base │ │ ├── example_extract_html.php.svn-base │ │ ├── example_modify_contents.php.svn-base │ │ ├── example_callback.php.svn-base │ │ ├── simple_html_dom_utility.php.svn-base │ │ ├── example_basic_selector.php.svn-base │ │ └── example_advanced_selector.php.svn-base │ ├── prop-base │ │ ├── example_callback.php.svn-base │ │ └── example_extract_html.php.svn-base │ ├── all-wcprops │ └── entries ├── scraping │ ├── .svn │ │ ├── prop-base │ │ │ ├── example_scraping_digg.php.svn-base │ │ │ ├── example_scraping_imdb.php.svn-base │ │ │ └── example_scraping_slashdot.php.svn-base │ │ ├── all-wcprops │ │ ├── text-base │ │ │ ├── example_scraping_slashdot.php.svn-base │ │ │ ├── example_scraping_digg.php.svn-base │ │ │ └── example_scraping_imdb.php.svn-base │ │ └── entries │ ├── example_scraping_slashdot.php │ ├── example_scraping_digg.php │ └── example_scraping_imdb.php ├── example_modify_contents.php ├── example_callback.php ├── simple_html_dom_utility.php ├── example_basic_selector.php └── example_advanced_selector.php ├── composer.json └── change_log.txt /testcase/reader/.svn/dir-prop-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:mergeinfo 3 | V 0 4 | 5 | END 6 | -------------------------------------------------------------------------------- /manual/.svn/prop-base/manual.htm.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /manual/.svn/prop-base/manual_api.htm.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /manual/.svn/prop-base/manual_faq.htm.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /manual/img/tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udoless/simple_html_dom/master/manual/img/tab.png -------------------------------------------------------------------------------- /testcase/.svn/prop-base/all_test.php.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/mass_test.php.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/memory_test.php.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/slick_test.php.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/slickspeed.htm.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/dom_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/element_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/invalid_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/jquery-1.2.3.pack.js.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/misc_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/std_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/strip_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/selector_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | K 12 2 | svn:keywords 3 | V 3 4 | Rev 5 | END 6 | -------------------------------------------------------------------------------- /manual/img/.svn/prop-base/tab.png.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:mime-type 3 | V 24 4 | application/octet-stream 5 | END 6 | -------------------------------------------------------------------------------- /app/js/images/.svn/prop-base/treeview-default.gif.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:mime-type 3 | V 24 4 | application/octet-stream 5 | END 6 | -------------------------------------------------------------------------------- /app/js/images/treeview-default.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udoless/simple_html_dom/master/app/js/images/treeview-default.gif -------------------------------------------------------------------------------- /app/js/images/.svn/prop-base/treeview-default-line.gif.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:mime-type 3 | V 24 4 | application/octet-stream 5 | END 6 | -------------------------------------------------------------------------------- /app/js/images/treeview-default-line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udoless/simple_html_dom/master/app/js/images/treeview-default-line.gif -------------------------------------------------------------------------------- /manual/img/.svn/text-base/tab.png.svn-base: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udoless/simple_html_dom/master/manual/img/.svn/text-base/tab.png.svn-base -------------------------------------------------------------------------------- /testcase/html/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 54 4 | /svnroot/simplehtmldom/!svn/ver/28/trunk/testcase/html 5 | END 6 | -------------------------------------------------------------------------------- /example/example_extract_html.php: -------------------------------------------------------------------------------- 1 | plaintext; 5 | ?> -------------------------------------------------------------------------------- /app/js/images/.svn/text-base/treeview-default.gif.svn-base: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udoless/simple_html_dom/master/app/js/images/.svn/text-base/treeview-default.gif.svn-base -------------------------------------------------------------------------------- /example/.svn/text-base/example_extract_html.php.svn-base: -------------------------------------------------------------------------------- 1 | plaintext; 5 | ?> -------------------------------------------------------------------------------- /app/js/images/.svn/text-base/treeview-default-line.gif.svn-base: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udoless/simple_html_dom/master/app/js/images/.svn/text-base/treeview-default-line.gif.svn-base -------------------------------------------------------------------------------- /testcase/reader/.svn/prop-base/all_test.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 3 8 | Rev 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/callback_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 3 8 | Rev 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /testcase/.svn/prop-base/performance_test.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 3 8 | Rev 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /testcase/reader/.svn/prop-base/memory_test.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 3 8 | Rev 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /example/.svn/prop-base/example_callback.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 11 8 | Id Rev Date 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /testcase/reader/.svn/prop-base/element_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 3 8 | Rev 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /testcase/reader/.svn/prop-base/performance_test.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 3 8 | Rev 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /testcase/reader/.svn/prop-base/selector_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 3 8 | Rev 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /example/.svn/prop-base/example_extract_html.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 11 8 | Id Rev Date 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /example/scraping/.svn/prop-base/example_scraping_digg.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 11 8 | Id Rev Date 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /example/scraping/.svn/prop-base/example_scraping_imdb.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 11 8 | Id Rev Date 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /example/scraping/.svn/prop-base/example_scraping_slashdot.php.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:eol-style 3 | V 6 4 | native 5 | K 12 6 | svn:keywords 7 | V 11 8 | Id Rev Date 9 | K 13 10 | svn:mime-type 11 | V 10 12 | text/x-php 13 | END 14 | -------------------------------------------------------------------------------- /manual/img/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 51 4 | /svnroot/simplehtmldom/!svn/ver/29/trunk/manual/img 5 | END 6 | tab.png 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 59 10 | /svnroot/simplehtmldom/!svn/ver/29/trunk/manual/img/tab.png 11 | END 12 | -------------------------------------------------------------------------------- /testcase/reader/all_test.php: -------------------------------------------------------------------------------- 1 | isFile() && strpos($entry, '_testcase.')>0) { 7 | echo basename($entry); 8 | require_once($entry); 9 | echo '
...pass!

'; 10 | } 11 | } 12 | ?> -------------------------------------------------------------------------------- /testcase/reader/.svn/text-base/all_test.php.svn-base: -------------------------------------------------------------------------------- 1 | isFile() && strpos($entry, '_testcase.')>0) { 7 | echo basename($entry); 8 | require_once($entry); 9 | echo '
...pass!

'; 10 | } 11 | } 12 | ?> -------------------------------------------------------------------------------- /app/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 45 4 | /svnroot/simplehtmldom/!svn/ver/179/trunk/app 5 | END 6 | google.htm 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 56 10 | /svnroot/simplehtmldom/!svn/ver/179/trunk/app/google.htm 11 | END 12 | index.php 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 55 16 | /svnroot/simplehtmldom/!svn/ver/176/trunk/app/index.php 17 | END 18 | -------------------------------------------------------------------------------- /testcase/html/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/testcase/html 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2008-03-14T14:52:38.823464Z 11 | 28 12 | me578022 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | -------------------------------------------------------------------------------- /manual/css/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 52 4 | /svnroot/simplehtmldom/!svn/ver/120/trunk/manual/css 5 | END 6 | default.css 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 64 10 | /svnroot/simplehtmldom/!svn/ver/120/trunk/manual/css/default.css 11 | END 12 | ui.tabs.css 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 63 16 | /svnroot/simplehtmldom/!svn/ver/29/trunk/manual/css/ui.tabs.css 17 | END 18 | -------------------------------------------------------------------------------- /manual/js/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 50 4 | /svnroot/simplehtmldom/!svn/ver/29/trunk/manual/js 5 | END 6 | jquery-1.2.3.pack.js 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 71 10 | /svnroot/simplehtmldom/!svn/ver/29/trunk/manual/js/jquery-1.2.3.pack.js 11 | END 12 | ui.tabs.pack.js 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 66 16 | /svnroot/simplehtmldom/!svn/ver/29/trunk/manual/js/ui.tabs.pack.js 17 | END 18 | -------------------------------------------------------------------------------- /app/js/images/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 55 4 | /svnroot/simplehtmldom/!svn/ver/176/trunk/app/js/images 5 | END 6 | treeview-default.gif 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 76 10 | /svnroot/simplehtmldom/!svn/ver/176/trunk/app/js/images/treeview-default.gif 11 | END 12 | treeview-default-line.gif 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 81 16 | /svnroot/simplehtmldom/!svn/ver/176/trunk/app/js/images/treeview-default-line.gif 17 | END 18 | -------------------------------------------------------------------------------- /example/example_modify_contents.php: -------------------------------------------------------------------------------- 1 | find('img') as $e) 10 | $e->outertext = ''; 11 | 12 | // replace all input 13 | foreach($html->find('input') as $e) 14 | $e->outertext = '[INPUT]'; 15 | 16 | // dump contents 17 | echo $html; 18 | ?> -------------------------------------------------------------------------------- /example/.svn/text-base/example_modify_contents.php.svn-base: -------------------------------------------------------------------------------- 1 | find('img') as $e) 10 | $e->outertext = ''; 11 | 12 | // replace all input 13 | foreach($html->find('input') as $e) 14 | $e->outertext = '[INPUT]'; 15 | 16 | // dump contents 17 | echo $html; 18 | ?> -------------------------------------------------------------------------------- /manual/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 48 4 | /svnroot/simplehtmldom/!svn/ver/165/trunk/manual 5 | END 6 | manual.htm 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 59 10 | /svnroot/simplehtmldom/!svn/ver/165/trunk/manual/manual.htm 11 | END 12 | manual_faq.htm 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 63 16 | /svnroot/simplehtmldom/!svn/ver/165/trunk/manual/manual_faq.htm 17 | END 18 | manual_api.htm 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 63 22 | /svnroot/simplehtmldom/!svn/ver/165/trunk/manual/manual_api.htm 23 | END 24 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shark/simple_html_dom", 3 | "description": "Simple HTML DOM package.", 4 | "keywords": ["dom", "php dom"], 5 | "homepage": "http://simplehtmldom.sourceforge.net/", 6 | "type": "library", 7 | "version": "1.5", 8 | "require":{ 9 | "php":">=5.2.4" 10 | }, 11 | "authors": [ 12 | { 13 | "name": "S.C. Chen", 14 | "email": "me578022@gmail.com", 15 | "homepage": "http://simplehtmldom.sourceforge.net/" 16 | } 17 | ], 18 | "autoload": { 19 | "classmap":["simple_html_dom.php"], 20 | "files": ["simple_html_dom.php"] 21 | } 22 | } -------------------------------------------------------------------------------- /example/scraping/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 58 4 | /svnroot/simplehtmldom/!svn/ver/169/trunk/example/scraping 5 | END 6 | example_scraping_digg.php 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 84 10 | /svnroot/simplehtmldom/!svn/ver/133/trunk/example/scraping/example_scraping_digg.php 11 | END 12 | example_scraping_imdb.php 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 84 16 | /svnroot/simplehtmldom/!svn/ver/133/trunk/example/scraping/example_scraping_imdb.php 17 | END 18 | example_scraping_slashdot.php 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 88 22 | /svnroot/simplehtmldom/!svn/ver/169/trunk/example/scraping/example_scraping_slashdot.php 23 | END 24 | -------------------------------------------------------------------------------- /app/js/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 48 4 | /svnroot/simplehtmldom/!svn/ver/176/trunk/app/js 5 | END 6 | jquery.treeview.css 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 68 10 | /svnroot/simplehtmldom/!svn/ver/176/trunk/app/js/jquery.treeview.css 11 | END 12 | jquery.treeview.js 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 67 16 | /svnroot/simplehtmldom/!svn/ver/176/trunk/app/js/jquery.treeview.js 17 | END 18 | screen.css 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 59 22 | /svnroot/simplehtmldom/!svn/ver/176/trunk/app/js/screen.css 23 | END 24 | jquery.js 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 58 28 | /svnroot/simplehtmldom/!svn/ver/176/trunk/app/js/jquery.js 29 | END 30 | -------------------------------------------------------------------------------- /manual/img/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/manual/img 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2008-03-14T14:58:12.908404Z 11 | 29 12 | me578022 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | tab.png 30 | file 31 | 32 | 33 | 34 | 35 | 2010-08-17T19:13:53.595300Z 36 | 83a79d462146a7d0d1ea4dd969101885 37 | 2008-03-14T14:58:12.908404Z 38 | 29 39 | me578022 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 734 62 | 63 | -------------------------------------------------------------------------------- /app/js/screen.css: -------------------------------------------------------------------------------- 1 | html, body {height:100%; margin: 0; padding: 0; } 2 | 3 | html>body { 4 | font-size: 16px; 5 | font-size: 68.75%; 6 | } /* Reset Base Font Size */ 7 | 8 | body { 9 | font-family: Verdana, helvetica, arial, sans-serif; 10 | font-size: 68.75%; 11 | background: #fff; 12 | color: #333; 13 | } 14 | 15 | h1, h2 { font-family: 'trebuchet ms', verdana, arial; padding: 10px; margin: 0 } 16 | h1 { font-size: large } 17 | 18 | #banner { padding: 15px; background-color: #06b; color: white; font-size: large; border-bottom: 1px solid #ccc; 19 | background: url(bg.gif) repeat-x; text-align: center } 20 | #banner a { color: white; } 21 | 22 | #main { padding: 1em; } 23 | 24 | a img { border: none; } -------------------------------------------------------------------------------- /example/.svn/text-base/example_callback.php.svn-base: -------------------------------------------------------------------------------- 1 | tag=='input') 8 | $element->outertext = 'input'; 9 | 10 | if ($element->tag=='img') 11 | $element->outertext = 'img'; 12 | 13 | if ($element->tag=='a') 14 | $element->outertext = 'a'; 15 | } 16 | 17 | 18 | // 2. create HTML Dom 19 | $html = file_get_html('http://www.google.com/'); 20 | 21 | 22 | // 3. Register the callback function with it's function name 23 | $html->set_callback('my_callback'); 24 | 25 | 26 | // 4. Callback function will be invoked while dumping 27 | echo $html; 28 | ?> -------------------------------------------------------------------------------- /example/example_callback.php: -------------------------------------------------------------------------------- 1 | tag=='input') 8 | $element->outertext = 'input'; 9 | 10 | if ($element->tag=='img') 11 | $element->outertext = 'img'; 12 | 13 | if ($element->tag=='a') 14 | $element->outertext = 'a'; 15 | } 16 | 17 | 18 | // 2. create HTML Dom 19 | $html = file_get_html('http://www.google.com/'); 20 | 21 | 22 | // 3. Register the callback function with it's function name 23 | $html->set_callback('my_callback'); 24 | 25 | 26 | // 4. Callback function will be invoked while dumping 27 | echo $html; 28 | ?> -------------------------------------------------------------------------------- /app/js/.svn/text-base/screen.css.svn-base: -------------------------------------------------------------------------------- 1 | html, body {height:100%; margin: 0; padding: 0; } 2 | 3 | html>body { 4 | font-size: 16px; 5 | font-size: 68.75%; 6 | } /* Reset Base Font Size */ 7 | 8 | body { 9 | font-family: Verdana, helvetica, arial, sans-serif; 10 | font-size: 68.75%; 11 | background: #fff; 12 | color: #333; 13 | } 14 | 15 | h1, h2 { font-family: 'trebuchet ms', verdana, arial; padding: 10px; margin: 0 } 16 | h1 { font-size: large } 17 | 18 | #banner { padding: 15px; background-color: #06b; color: white; font-size: large; border-bottom: 1px solid #ccc; 19 | background: url(bg.gif) repeat-x; text-align: center } 20 | #banner a { color: white; } 21 | 22 | #main { padding: 1em; } 23 | 24 | a img { border: none; } -------------------------------------------------------------------------------- /testcase/all_test.php: -------------------------------------------------------------------------------- 1 | '', 'plain'=>'', 'outer'=>'')) { 6 | $html_dom->load($str); 7 | $e = $html_dom->find($selector, 0); 8 | if (isset($params['inner'])) 9 | assert($e->innertext===$params['inner']); 10 | if (isset($params['plain'])) 11 | assert($e->plaintext===$params['plain']); 12 | if (isset($params['outer'])) 13 | assert($e->outertext===$params['outer']); 14 | assert($html_dom==$str); 15 | } 16 | 17 | foreach (new DirectoryIterator(getcwd()) as $entry) { 18 | if ($entry->isFile() && strpos($entry, '_testcase.')>0) { 19 | echo basename($entry); 20 | require_once($entry); 21 | echo '
...pass!

'; 22 | } 23 | } 24 | ?> -------------------------------------------------------------------------------- /testcase/.svn/text-base/all_test.php.svn-base: -------------------------------------------------------------------------------- 1 | '', 'plain'=>'', 'outer'=>'')) { 6 | $html_dom->load($str); 7 | $e = $html_dom->find($selector, 0); 8 | if (isset($params['inner'])) 9 | assert($e->innertext===$params['inner']); 10 | if (isset($params['plain'])) 11 | assert($e->plaintext===$params['plain']); 12 | if (isset($params['outer'])) 13 | assert($e->outertext===$params['outer']); 14 | assert($html_dom==$str); 15 | } 16 | 17 | foreach (new DirectoryIterator(getcwd()) as $entry) { 18 | if ($entry->isFile() && strpos($entry, '_testcase.')>0) { 19 | echo basename($entry); 20 | require_once($entry); 21 | echo '
...pass!

'; 22 | } 23 | } 24 | ?> -------------------------------------------------------------------------------- /testcase/reader/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 57 4 | /svnroot/simplehtmldom/!svn/ver/130/trunk/testcase/reader 5 | END 6 | selector_testcase.php 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 79 10 | /svnroot/simplehtmldom/!svn/ver/130/trunk/testcase/reader/selector_testcase.php 11 | END 12 | performance_test.php 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 78 16 | /svnroot/simplehtmldom/!svn/ver/130/trunk/testcase/reader/performance_test.php 17 | END 18 | element_testcase.php 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 78 22 | /svnroot/simplehtmldom/!svn/ver/130/trunk/testcase/reader/element_testcase.php 23 | END 24 | all_test.php 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 70 28 | /svnroot/simplehtmldom/!svn/ver/129/trunk/testcase/reader/all_test.php 29 | END 30 | memory_test.php 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 73 34 | /svnroot/simplehtmldom/!svn/ver/130/trunk/testcase/reader/memory_test.php 35 | END 36 | -------------------------------------------------------------------------------- /testcase/.svn/text-base/performance_test.php.svn-base: -------------------------------------------------------------------------------- 1 | load($str, false); 19 | 20 | list($eu, $es) = explode(' ', microtime()); 21 | list($bu, $bs) = explode(' ', $start); 22 | 23 | $diff = ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000; 24 | 25 | if ($diff>$max) 26 | $max = $diff; 27 | 28 | if ($diff<$min) 29 | $min = $diff; 30 | 31 | $all += $diff; 32 | echo sprintf('(%.1f)', $diff).'
'; 33 | } 34 | 35 | echo '
-------------------------
'; 36 | echo 'min: ' . $min . '
'; 37 | echo 'max: ' . $max . '
'; 38 | 39 | echo '
avg: ' . $all/$count . '
'; 40 | ?> -------------------------------------------------------------------------------- /testcase/performance_test.php: -------------------------------------------------------------------------------- 1 | load($str, false); 19 | 20 | list($eu, $es) = explode(' ', microtime()); 21 | list($bu, $bs) = explode(' ', $start); 22 | 23 | $diff = ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000; 24 | 25 | if ($diff>$max) 26 | $max = $diff; 27 | 28 | if ($diff<$min) 29 | $min = $diff; 30 | 31 | $all += $diff; 32 | echo sprintf('(%.1f)', $diff).'
'; 33 | } 34 | 35 | echo '
-------------------------
'; 36 | echo 'min: ' . $min . '
'; 37 | echo 'max: ' . $max . '
'; 38 | 39 | echo '
avg: ' . $all/$count . '
'; 40 | ?> -------------------------------------------------------------------------------- /example/scraping/.svn/text-base/example_scraping_slashdot.php.svn-base: -------------------------------------------------------------------------------- 1 | find('div[id^=firehose-]') as $article) { 10 | // get title 11 | $item['title'] = trim($article->find('a.datitle', 0)->plaintext); 12 | // get body 13 | $item['body'] = trim($article->find('div.body', 0)->plaintext); 14 | 15 | $ret[] = $item; 16 | } 17 | 18 | // clean up memory 19 | $html->clear(); 20 | unset($html); 21 | 22 | return $ret; 23 | } 24 | 25 | // ----------------------------------------------------------------------------- 26 | // test it! 27 | $ret = scraping_slashdot(); 28 | 29 | foreach($ret as $v) { 30 | echo $v['title'].'
'; 31 | echo ''; 34 | } 35 | ?> -------------------------------------------------------------------------------- /example/scraping/example_scraping_slashdot.php: -------------------------------------------------------------------------------- 1 | find('div[id^=firehose-]') as $article) { 10 | // get title 11 | $item['title'] = trim($article->find('a.datitle', 0)->plaintext); 12 | // get body 13 | $item['body'] = trim($article->find('div.body', 0)->plaintext); 14 | 15 | $ret[] = $item; 16 | } 17 | 18 | // clean up memory 19 | $html->clear(); 20 | unset($html); 21 | 22 | return $ret; 23 | } 24 | 25 | // ----------------------------------------------------------------------------- 26 | // test it! 27 | $ret = scraping_slashdot(); 28 | 29 | foreach($ret as $v) { 30 | echo $v['title'].'
'; 31 | echo ''; 34 | } 35 | ?> -------------------------------------------------------------------------------- /testcase/slick_test.php: -------------------------------------------------------------------------------- 1 |
'; 11 | 12 | assert(count($html->find('#title'))==1); 13 | assert(count($html->find('div'))==51); 14 | assert(count($html->find('div[class]'))==51); 15 | assert(count($html->find('div.example'))==43); 16 | assert(count($html->find('div[class=example]'))==43); 17 | assert(count($html->find('.note'))==14); 18 | 19 | assert(count($html->find('div[class^=exa]'))==43); 20 | assert(count($html->find('div[class$=mple]'))==43); 21 | assert(count($html->find('div[class*=e]'))==50); 22 | assert(count($html->find('div[class!=made_up]'))==51); 23 | 24 | assert(count($html->find('p'))==324); 25 | 26 | echo 'All pass!
'; 27 | ?> -------------------------------------------------------------------------------- /manual/css/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/manual/css 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2008-06-24T22:59:40.092528Z 11 | 120 12 | me578022 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | default.css 30 | file 31 | 32 | 33 | 34 | 35 | 2010-08-17T19:13:53.530296Z 36 | 2f01e1ff8a4fa8fe63c8be8e17800ab0 37 | 2008-06-24T22:59:40.092528Z 38 | 120 39 | me578022 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 2069 62 | 63 | ui.tabs.css 64 | file 65 | 66 | 67 | 68 | 69 | 2010-08-17T19:13:53.531296Z 70 | 995c002d1908567d7542ec9c2adfdc65 71 | 2008-03-14T14:58:12.908404Z 72 | 29 73 | me578022 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 3833 96 | 97 | -------------------------------------------------------------------------------- /testcase/.svn/text-base/slick_test.php.svn-base: -------------------------------------------------------------------------------- 1 |
'; 11 | 12 | assert(count($html->find('#title'))==1); 13 | assert(count($html->find('div'))==51); 14 | assert(count($html->find('div[class]'))==51); 15 | assert(count($html->find('div.example'))==43); 16 | assert(count($html->find('div[class=example]'))==43); 17 | assert(count($html->find('.note'))==14); 18 | 19 | assert(count($html->find('div[class^=exa]'))==43); 20 | assert(count($html->find('div[class$=mple]'))==43); 21 | assert(count($html->find('div[class*=e]'))==50); 22 | assert(count($html->find('div[class!=made_up]'))==51); 23 | 24 | assert(count($html->find('p'))==324); 25 | 26 | echo 'All pass!
'; 27 | ?> -------------------------------------------------------------------------------- /manual/js/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/manual/js 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2008-03-14T14:58:12.908404Z 11 | 29 12 | me578022 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | jquery-1.2.3.pack.js 30 | file 31 | 32 | 33 | 34 | 35 | 2010-08-17T19:13:53.654303Z 36 | fb49bb7a70d7be19cc6a145146ca7d44 37 | 2008-03-14T14:58:12.908404Z 38 | 29 39 | me578022 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 29846 62 | 63 | ui.tabs.pack.js 64 | file 65 | 66 | 67 | 68 | 69 | 2010-08-17T19:13:53.655303Z 70 | 14b07b37095bc686e405e7d043fee344 71 | 2008-03-14T14:58:12.908404Z 72 | 29 73 | me578022 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 6417 96 | 97 | -------------------------------------------------------------------------------- /app/js/images/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/app/js/images 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2008-12-14T19:02:48.351607Z 11 | 176 12 | me578022 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | treeview-default.gif 30 | file 31 | 32 | 33 | 34 | 35 | 2010-08-17T19:13:52.297225Z 36 | 46878a9b3ede269c4e234550c9c89cd0 37 | 2008-12-14T19:02:48.351607Z 38 | 176 39 | me578022 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 1222 62 | 63 | treeview-default-line.gif 64 | file 65 | 66 | 67 | 68 | 69 | 2010-08-17T19:13:52.303226Z 70 | 5e3c0e0c48f48c23c45aef7b72c739c0 71 | 2008-12-14T19:02:48.351607Z 72 | 176 73 | me578022 74 | has-props 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 1993 96 | 97 | -------------------------------------------------------------------------------- /example/simple_html_dom_utility.php: -------------------------------------------------------------------------------- 1 | find('comment') as $e) 12 | $e->outertext = ''; 13 | 14 | $ret = $html->save(); 15 | 16 | // clean up memory 17 | $html->clear(); 18 | unset($html); 19 | 20 | return $ret; 21 | } 22 | 23 | // ----------------------------------------------------------------------------- 24 | // search elements that contains an specific text 25 | function find_contains($html, $selector, $keyword, $index=-1) { 26 | $ret = array(); 27 | foreach ($html->find($selector) as $e) { 28 | if (strpos($e->innertext, $keyword)!==false) 29 | $ret[] = $e; 30 | } 31 | 32 | if ($index<0) return $ret; 33 | return (isset($ret[$index])) ? $ret[$index] : null; 34 | } 35 | ?> -------------------------------------------------------------------------------- /example/.svn/text-base/simple_html_dom_utility.php.svn-base: -------------------------------------------------------------------------------- 1 | find('comment') as $e) 12 | $e->outertext = ''; 13 | 14 | $ret = $html->save(); 15 | 16 | // clean up memory 17 | $html->clear(); 18 | unset($html); 19 | 20 | return $ret; 21 | } 22 | 23 | // ----------------------------------------------------------------------------- 24 | // search elements that contains an specific text 25 | function find_contains($html, $selector, $keyword, $index=-1) { 26 | $ret = array(); 27 | foreach ($html->find($selector) as $e) { 28 | if (strpos($e->innertext, $keyword)!==false) 29 | $ret[] = $e; 30 | } 31 | 32 | if ($index<0) return $ret; 33 | return (isset($ret[$index])) ? $ret[$index] : null; 34 | } 35 | ?> -------------------------------------------------------------------------------- /app/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/app 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2009-02-23T09:04:02.699587Z 11 | 179 12 | me578022 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | google.htm 30 | file 31 | 32 | 33 | 34 | 35 | 2010-08-17T19:13:52.500237Z 36 | 72a16a066c5a729cd5ddaf6e39082b05 37 | 2009-02-23T09:04:02.699587Z 38 | 179 39 | me578022 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 60128 62 | 63 | js 64 | dir 65 | 66 | index.php 67 | file 68 | 69 | 70 | 71 | 72 | 2010-08-17T19:13:52.502237Z 73 | 3793524c0c846be09274b428d4972b60 74 | 2008-12-14T19:02:48.351607Z 75 | 176 76 | me578022 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 4496 99 | 100 | -------------------------------------------------------------------------------- /example/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 49 4 | /svnroot/simplehtmldom/!svn/ver/169/trunk/example 5 | END 6 | example_extract_html.php 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 74 10 | /svnroot/simplehtmldom/!svn/ver/133/trunk/example/example_extract_html.php 11 | END 12 | example_basic_selector.php 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 76 16 | /svnroot/simplehtmldom/!svn/ver/133/trunk/example/example_basic_selector.php 17 | END 18 | example_modify_contents.php 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 77 22 | /svnroot/simplehtmldom/!svn/ver/133/trunk/example/example_modify_contents.php 23 | END 24 | simple_html_dom_utility.php 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 77 28 | /svnroot/simplehtmldom/!svn/ver/133/trunk/example/simple_html_dom_utility.php 29 | END 30 | example_advanced_selector.php 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 79 34 | /svnroot/simplehtmldom/!svn/ver/133/trunk/example/example_advanced_selector.php 35 | END 36 | example_callback.php 37 | K 25 38 | svn:wc:ra_dav:version-url 39 | V 70 40 | /svnroot/simplehtmldom/!svn/ver/134/trunk/example/example_callback.php 41 | END 42 | -------------------------------------------------------------------------------- /example/example_basic_selector.php: -------------------------------------------------------------------------------- 1 | find('a') as $e) 10 | echo $e->href . '
'; 11 | 12 | // find all image 13 | foreach($html->find('img') as $e) 14 | echo $e->src . '
'; 15 | 16 | // find all image with full tag 17 | foreach($html->find('img') as $e) 18 | echo $e->outertext . '
'; 19 | 20 | // find all div tags with id=gbar 21 | foreach($html->find('div#gbar') as $e) 22 | echo $e->innertext . '
'; 23 | 24 | // find all span tags with class=gb1 25 | foreach($html->find('span.gb1') as $e) 26 | echo $e->outertext . '
'; 27 | 28 | // find all td tags with attribite align=center 29 | foreach($html->find('td[align=center]') as $e) 30 | echo $e->innertext . '
'; 31 | 32 | // extract text from table 33 | echo $html->find('td[align="center"]', 1)->plaintext.'

'; 34 | 35 | // extract text from HTML 36 | echo $html->plaintext; 37 | ?> -------------------------------------------------------------------------------- /example/.svn/text-base/example_basic_selector.php.svn-base: -------------------------------------------------------------------------------- 1 | find('a') as $e) 10 | echo $e->href . '
'; 11 | 12 | // find all image 13 | foreach($html->find('img') as $e) 14 | echo $e->src . '
'; 15 | 16 | // find all image with full tag 17 | foreach($html->find('img') as $e) 18 | echo $e->outertext . '
'; 19 | 20 | // find all div tags with id=gbar 21 | foreach($html->find('div#gbar') as $e) 22 | echo $e->innertext . '
'; 23 | 24 | // find all span tags with class=gb1 25 | foreach($html->find('span.gb1') as $e) 26 | echo $e->outertext . '
'; 27 | 28 | // find all td tags with attribite align=center 29 | foreach($html->find('td[align=center]') as $e) 30 | echo $e->innertext . '
'; 31 | 32 | // extract text from table 33 | echo $html->find('td[align="center"]', 1)->plaintext.'

'; 34 | 35 | // extract text from HTML 36 | echo $html->plaintext; 37 | ?> -------------------------------------------------------------------------------- /example/scraping/.svn/text-base/example_scraping_digg.php.svn-base: -------------------------------------------------------------------------------- 1 | find('div.news-summary') as $article) { 10 | // get title 11 | $item['title'] = trim($article->find('h3', 0)->plaintext); 12 | // get details 13 | $item['details'] = trim($article->find('p', 0)->plaintext); 14 | // get intro 15 | $item['diggs'] = trim($article->find('li a strong', 0)->plaintext); 16 | 17 | $ret[] = $item; 18 | } 19 | 20 | // clean up memory 21 | $html->clear(); 22 | unset($html); 23 | 24 | return $ret; 25 | } 26 | 27 | 28 | // ----------------------------------------------------------------------------- 29 | // test it! 30 | 31 | // "http://digg.com" will check user_agent header... 32 | ini_set('user_agent', 'My-Application/2.5'); 33 | 34 | $ret = scraping_digg(); 35 | 36 | foreach($ret as $v) { 37 | echo $v['title'].'
'; 38 | echo ''; 42 | } 43 | 44 | ?> -------------------------------------------------------------------------------- /testcase/reader/.svn/text-base/performance_test.php.svn-base: -------------------------------------------------------------------------------- 1 | load($str, false); 19 | list($eu, $es) = explode(' ', microtime()); 20 | list($bu, $bs) = explode(' ', $start); 21 | 22 | if (((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000 > $max) 23 | $max = ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000; 24 | 25 | if (((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000 < $min) 26 | $min = ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000; 27 | 28 | $all += ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000; 29 | echo sprintf('(%.1f)', ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000).'
'; 30 | $dom->clear(); 31 | } 32 | 33 | echo '
-------------------------
'; 34 | echo 'min: ' . $min . '
'; 35 | echo 'max: ' . $max . '
'; 36 | 37 | echo '
avg: ' . $all/$count . '
'; 38 | ?> -------------------------------------------------------------------------------- /example/scraping/example_scraping_digg.php: -------------------------------------------------------------------------------- 1 | find('div.news-summary') as $article) { 10 | // get title 11 | $item['title'] = trim($article->find('h3', 0)->plaintext); 12 | // get details 13 | $item['details'] = trim($article->find('p', 0)->plaintext); 14 | // get intro 15 | $item['diggs'] = trim($article->find('li a strong', 0)->plaintext); 16 | 17 | $ret[] = $item; 18 | } 19 | 20 | // clean up memory 21 | $html->clear(); 22 | unset($html); 23 | 24 | return $ret; 25 | } 26 | 27 | 28 | // ----------------------------------------------------------------------------- 29 | // test it! 30 | 31 | // "http://digg.com" will check user_agent header... 32 | ini_set('user_agent', 'My-Application/2.5'); 33 | 34 | $ret = scraping_digg(); 35 | 36 | foreach($ret as $v) { 37 | echo $v['title'].'
'; 38 | echo ''; 42 | } 43 | 44 | ?> -------------------------------------------------------------------------------- /testcase/reader/performance_test.php: -------------------------------------------------------------------------------- 1 | load($str, false); 19 | list($eu, $es) = explode(' ', microtime()); 20 | list($bu, $bs) = explode(' ', $start); 21 | 22 | if (((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000 > $max) 23 | $max = ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000; 24 | 25 | if (((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000 < $min) 26 | $min = ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000; 27 | 28 | $all += ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000; 29 | echo sprintf('(%.1f)', ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000).'
'; 30 | $dom->clear(); 31 | } 32 | 33 | echo '
-------------------------
'; 34 | echo 'min: ' . $min . '
'; 35 | echo 'max: ' . $max . '
'; 36 | 37 | echo '
avg: ' . $all/$count . '
'; 38 | ?> -------------------------------------------------------------------------------- /example/scraping/.svn/text-base/example_scraping_imdb.php.svn-base: -------------------------------------------------------------------------------- 1 | find('title', 0)->innertext; 10 | 11 | // get rating 12 | $ret['Rating'] = $html->find('div[class="general rating"] b', 0)->innertext; 13 | 14 | // get overview 15 | foreach($html->find('div[class="info"]') as $div) { 16 | // skip user comments 17 | if($div->find('h5', 0)->innertext=='User Comments:') 18 | return $ret; 19 | 20 | $key = ''; 21 | $val = ''; 22 | 23 | foreach($div->find('*') as $node) { 24 | if ($node->tag=='h5') 25 | $key = $node->plaintext; 26 | 27 | if ($node->tag=='a' && $node->plaintext!='more') 28 | $val .= trim(str_replace("\n", '', $node->plaintext)); 29 | 30 | if ($node->tag=='text') 31 | $val .= trim(str_replace("\n", '', $node->plaintext)); 32 | } 33 | 34 | $ret[$key] = $val; 35 | } 36 | 37 | // clean up memory 38 | $html->clear(); 39 | unset($html); 40 | 41 | return $ret; 42 | } 43 | 44 | 45 | // ----------------------------------------------------------------------------- 46 | // test it! 47 | $ret = scraping_IMDB('http://imdb.com/title/tt0335266/'); 48 | 49 | foreach($ret as $k=>$v) 50 | echo ''.$k.' '.$v.'
'; 51 | ?> -------------------------------------------------------------------------------- /example/scraping/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/example/scraping 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2008-10-29T19:08:25.076520Z 11 | 169 12 | me578022 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | example_scraping_digg.php 30 | file 31 | 32 | 33 | 34 | 35 | 2010-08-17T19:13:52.895260Z 36 | bd67cef1e4729067a8fef9aff1a61dc3 37 | 2008-07-25T12:31:14.828880Z 38 | 133 39 | me578022 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 1059 62 | 63 | example_scraping_imdb.php 64 | file 65 | 66 | 67 | 68 | 69 | 2010-08-17T19:13:52.901260Z 70 | 477179278b3752eccc5c286a0754e014 71 | 2008-07-25T12:31:14.828880Z 72 | 133 73 | me578022 74 | has-props 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 1311 96 | 97 | example_scraping_slashdot.php 98 | file 99 | 100 | 101 | 102 | 103 | 2010-08-17T19:13:52.909260Z 104 | f3996448238646b8e76006da56fa42d2 105 | 2008-10-29T19:08:25.076520Z 106 | 169 107 | me578022 108 | has-props 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 829 130 | 131 | -------------------------------------------------------------------------------- /example/scraping/example_scraping_imdb.php: -------------------------------------------------------------------------------- 1 | find('title', 0)->innertext; 10 | 11 | // get rating 12 | $ret['Rating'] = $html->find('div[class="general rating"] b', 0)->innertext; 13 | 14 | // get overview 15 | foreach($html->find('div[class="info"]') as $div) { 16 | // skip user comments 17 | if($div->find('h5', 0)->innertext=='User Comments:') 18 | return $ret; 19 | 20 | $key = ''; 21 | $val = ''; 22 | 23 | foreach($div->find('*') as $node) { 24 | if ($node->tag=='h5') 25 | $key = $node->plaintext; 26 | 27 | if ($node->tag=='a' && $node->plaintext!='more') 28 | $val .= trim(str_replace("\n", '', $node->plaintext)); 29 | 30 | if ($node->tag=='text') 31 | $val .= trim(str_replace("\n", '', $node->plaintext)); 32 | } 33 | 34 | $ret[$key] = $val; 35 | } 36 | 37 | // clean up memory 38 | $html->clear(); 39 | unset($html); 40 | 41 | return $ret; 42 | } 43 | 44 | 45 | // ----------------------------------------------------------------------------- 46 | // test it! 47 | $ret = scraping_IMDB('http://imdb.com/title/tt0335266/'); 48 | 49 | foreach($ret as $k=>$v) 50 | echo ''.$k.' '.$v.'
'; 51 | ?> -------------------------------------------------------------------------------- /manual/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/manual 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2008-10-20T21:14:53.811160Z 11 | 165 12 | me578022 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | manual.htm 30 | file 31 | 32 | 33 | 34 | 35 | 2010-08-17T19:13:53.692305Z 36 | 299f58f40c40054c245399752d7164ec 37 | 2008-10-20T21:14:53.811160Z 38 | 165 39 | me578022 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 24678 62 | 63 | css 64 | dir 65 | 66 | manual_faq.htm 67 | file 68 | 69 | 70 | 71 | 72 | 2010-08-17T19:13:53.698306Z 73 | 2d0d134462e6bf404b93d7f8eefe2767 74 | 2008-10-20T21:14:53.811160Z 75 | 165 76 | me578022 77 | has-props 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 4818 99 | 100 | img 101 | dir 102 | 103 | js 104 | dir 105 | 106 | manual_api.htm 107 | file 108 | 109 | 110 | 111 | 112 | 2010-08-17T19:13:53.705306Z 113 | 3ff73eb882e61bd23b87c6cc0ba743b4 114 | 2008-10-20T21:14:53.811160Z 115 | 165 116 | me578022 117 | has-props 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 11505 139 | 140 | -------------------------------------------------------------------------------- /example/example_advanced_selector.php: -------------------------------------------------------------------------------- 1 | 9 |
10 |
ok
11 |
12 | 13 | HTML; 14 | 15 | $html = str_get_html($str); 16 | echo $html->find('div div div', 0)->innertext . '
'; // result: "ok" 17 | 18 | // ----------------------------------------------------------------------------- 19 | // nested selector 20 | $str = << 22 |
  • item:1
  • 23 |
  • item:2
  • 24 | 25 | 29 | HTML; 30 | 31 | $html = str_get_html($str); 32 | foreach($html->find('ul') as $ul) { 33 | foreach($ul->find('li') as $li) 34 | echo $li->innertext . '
    '; 35 | } 36 | 37 | // ----------------------------------------------------------------------------- 38 | // parsing checkbox 39 | $str = << 41 | item1
    42 | item2
    43 | item3
    44 | 45 | HTML; 46 | 47 | $html = str_get_html($str); 48 | foreach($html->find('input[type=checkbox]') as $checkbox) { 49 | if ($checkbox->checked) 50 | echo $checkbox->name . ' is checked
    '; 51 | else 52 | echo $checkbox->name . ' is not checked
    '; 53 | } 54 | ?> -------------------------------------------------------------------------------- /example/.svn/text-base/example_advanced_selector.php.svn-base: -------------------------------------------------------------------------------- 1 | 9 |
    10 |
    ok
    11 |
    12 | 13 | HTML; 14 | 15 | $html = str_get_html($str); 16 | echo $html->find('div div div', 0)->innertext . '
    '; // result: "ok" 17 | 18 | // ----------------------------------------------------------------------------- 19 | // nested selector 20 | $str = << 22 |
  • item:1
  • 23 |
  • item:2
  • 24 | 25 | 29 | HTML; 30 | 31 | $html = str_get_html($str); 32 | foreach($html->find('ul') as $ul) { 33 | foreach($ul->find('li') as $li) 34 | echo $li->innertext . '
    '; 35 | } 36 | 37 | // ----------------------------------------------------------------------------- 38 | // parsing checkbox 39 | $str = << 41 | item1
    42 | item2
    43 | item3
    44 | 45 | HTML; 46 | 47 | $html = str_get_html($str); 48 | foreach($html->find('input[type=checkbox]') as $checkbox) { 49 | if ($checkbox->checked) 50 | echo $checkbox->name . ' is checked
    '; 51 | else 52 | echo $checkbox->name . ' is not checked
    '; 53 | } 54 | ?> -------------------------------------------------------------------------------- /app/js/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/app/js 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2008-12-14T19:02:48.351607Z 11 | 176 12 | me578022 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | jquery.treeview.css 30 | file 31 | 32 | 33 | 34 | 35 | 2010-08-17T19:13:52.459235Z 36 | 339ab1bbbaefa62f58c1fbf4459a7d0e 37 | 2008-12-14T19:02:48.351607Z 38 | 176 39 | me578022 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 2589 62 | 63 | jquery.treeview.js 64 | file 65 | 66 | 67 | 68 | 69 | 2010-08-17T19:13:52.460235Z 70 | 3f81db67b7a973c8835ef5213e3b93c6 71 | 2008-12-14T19:02:48.351607Z 72 | 176 73 | me578022 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 7839 96 | 97 | images 98 | dir 99 | 100 | screen.css 101 | file 102 | 103 | 104 | 105 | 106 | 2010-08-17T19:13:52.463235Z 107 | b8e74072c3d1b740bce61509ce86fe68 108 | 2008-12-14T19:02:48.351607Z 109 | 176 110 | me578022 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 623 133 | 134 | jquery.js 135 | file 136 | 137 | 138 | 139 | 140 | 2010-08-17T19:13:52.465235Z 141 | 957620aeffb2e5b562591b7a19928ea4 142 | 2008-12-14T19:02:48.351607Z 143 | 176 144 | me578022 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 94443 167 | 168 | -------------------------------------------------------------------------------- /testcase/misc_testcase.php: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | HTML; 17 | 18 | $dom->load($str); 19 | $es = $dom->find('img'); 20 | assert(count($es)==3); 21 | assert($es[0]->src=='src0'); 22 | assert($es[1]->src=='src1'); 23 | assert($es[2]->src=='src2'); 24 | assert($es[0]->innertext==''); 25 | assert($es[1]->innertext==''); 26 | assert($es[2]->innertext==''); 27 | assert($es[0]->outertext==''); 28 | assert($es[1]->outertext==''); 29 | assert($es[2]->outertext==''); 30 | assert($dom->find('img', 0)->src=='src0'); 31 | assert($dom->find('img', 1)->src=='src1'); 32 | assert($dom->find('img', 2)->src=='src2'); 33 | assert($dom->find('img', 3)===null); 34 | assert($dom->find('img', 99)===null); 35 | assert($dom->save()==$str); 36 | 37 | // ----------------------------------------------------------------------------- 38 | // test error tag 39 | $str = <<

    p1

    41 |

    42 | 43 | HTML; 44 | 45 | $dom = str_get_html($str); 46 | $es = $dom->find('img'); 47 | assert(count($es)==3); 48 | assert($es[0]->src=='src0'); 49 | assert($es[1]->src=='src1'); 50 | assert($es[2]->src=='src2'); 51 | 52 | $es = $dom->find('p'); 53 | assert($es[0]->innertext=='p1'); 54 | assert($dom==$str); 55 | 56 | // ----------------------------------------------------------------------------- 57 | // tear down 58 | $dom->clear(); 59 | unset($dom); 60 | ?> -------------------------------------------------------------------------------- /testcase/.svn/text-base/callback_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 |

    foo

    13 | HTML; 14 | 15 | function callback_1($e) { 16 | if ($e->tag==='img') 17 | $e->outertext = ''; 18 | } 19 | 20 | $dom->load($str); 21 | $dom->set_callback('callback_1'); 22 | assert($dom=='

    foo

    '); 23 | 24 | // ----------------------------------------------- 25 | // innertext test 26 | function callback_2($e) { 27 | if ($e->tag==='p') 28 | $e->innertext = 'bar'; 29 | } 30 | 31 | $dom->load($str); 32 | $dom->set_callback('callback_2'); 33 | assert($dom=='

    bar

    '); 34 | 35 | // ----------------------------------------------- 36 | // attributes test 37 | function callback_3($e) { 38 | if ($e->tag==='img') 39 | $e->src = 'foo'; 40 | } 41 | 42 | $dom->load($str); 43 | $dom->set_callback('callback_3'); 44 | assert($dom=='

    foo

    '); 45 | 46 | function callback_4($e) { 47 | if ($e->tag==='img') 48 | $e->id = 'foo'; 49 | } 50 | 51 | $dom->set_callback('callback_4'); 52 | assert($dom=='

    foo

    '); 53 | 54 | // ----------------------------------------------- 55 | // attributes test2 56 | //$dom = str_get_dom($str); 57 | $dom->load($str); 58 | $dom->remove_callback(); 59 | $dom->find('img', 0)->id = "foo"; 60 | assert($dom=='

    foo

    '); 61 | 62 | function callback_5($e) { 63 | if ($e->src==='src0') 64 | unset($e->id); 65 | } 66 | 67 | $dom->set_callback('callback_5'); 68 | assert($dom==$str); 69 | 70 | // ----------------------------------------------------------------------------- 71 | // tear down 72 | $dom->clear(); 73 | unset($dom); 74 | ?> -------------------------------------------------------------------------------- /testcase/.svn/text-base/misc_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | HTML; 17 | 18 | $dom->load($str); 19 | $es = $dom->find('img'); 20 | assert(count($es)==3); 21 | assert($es[0]->src=='src0'); 22 | assert($es[1]->src=='src1'); 23 | assert($es[2]->src=='src2'); 24 | assert($es[0]->innertext==''); 25 | assert($es[1]->innertext==''); 26 | assert($es[2]->innertext==''); 27 | assert($es[0]->outertext==''); 28 | assert($es[1]->outertext==''); 29 | assert($es[2]->outertext==''); 30 | assert($dom->find('img', 0)->src=='src0'); 31 | assert($dom->find('img', 1)->src=='src1'); 32 | assert($dom->find('img', 2)->src=='src2'); 33 | assert($dom->find('img', 3)===null); 34 | assert($dom->find('img', 99)===null); 35 | assert($dom->save()==$str); 36 | 37 | // ----------------------------------------------------------------------------- 38 | // test error tag 39 | $str = <<

    p1

    41 |

    42 | 43 | HTML; 44 | 45 | $dom = str_get_html($str); 46 | $es = $dom->find('img'); 47 | assert(count($es)==3); 48 | assert($es[0]->src=='src0'); 49 | assert($es[1]->src=='src1'); 50 | assert($es[2]->src=='src2'); 51 | 52 | $es = $dom->find('p'); 53 | assert($es[0]->innertext=='p1'); 54 | assert($dom==$str); 55 | 56 | // ----------------------------------------------------------------------------- 57 | // tear down 58 | $dom->clear(); 59 | unset($dom); 60 | ?> -------------------------------------------------------------------------------- /testcase/callback_testcase.php: -------------------------------------------------------------------------------- 1 |

    foo

    13 | HTML; 14 | 15 | function callback_1($e) { 16 | if ($e->tag==='img') 17 | $e->outertext = ''; 18 | } 19 | 20 | $dom->load($str); 21 | $dom->set_callback('callback_1'); 22 | assert($dom=='

    foo

    '); 23 | 24 | // ----------------------------------------------- 25 | // innertext test 26 | function callback_2($e) { 27 | if ($e->tag==='p') 28 | $e->innertext = 'bar'; 29 | } 30 | 31 | $dom->load($str); 32 | $dom->set_callback('callback_2'); 33 | assert($dom=='

    bar

    '); 34 | 35 | // ----------------------------------------------- 36 | // attributes test 37 | function callback_3($e) { 38 | if ($e->tag==='img') 39 | $e->src = 'foo'; 40 | } 41 | 42 | $dom->load($str); 43 | $dom->set_callback('callback_3'); 44 | assert($dom=='

    foo

    '); 45 | 46 | function callback_4($e) { 47 | if ($e->tag==='img') 48 | $e->id = 'foo'; 49 | } 50 | 51 | $dom->set_callback('callback_4'); 52 | assert($dom=='

    foo

    '); 53 | 54 | // ----------------------------------------------- 55 | // attributes test2 56 | //$dom = str_get_dom($str); 57 | $dom->load($str); 58 | $dom->remove_callback(); 59 | $dom->find('img', 0)->id = "foo"; 60 | assert($dom=='

    foo

    '); 61 | 62 | function callback_5($e) { 63 | if ($e->src==='src0') 64 | unset($e->id); 65 | } 66 | 67 | $dom->set_callback('callback_5'); 68 | assert($dom==$str); 69 | 70 | // ----------------------------------------------------------------------------- 71 | // tear down 72 | $dom->clear(); 73 | unset($dom); 74 | ?> -------------------------------------------------------------------------------- /testcase/reader/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/testcase/reader 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2008-07-19T21:40:06.854888Z 11 | 130 12 | me578022 13 | has-props 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | selector_testcase.php 30 | file 31 | 32 | 33 | 34 | 35 | 2010-08-17T19:13:53.174276Z 36 | ed68e3ea92d0c1b58ad31728b0b10023 37 | 2008-07-19T21:40:06.854888Z 38 | 130 39 | me578022 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 16889 62 | 63 | performance_test.php 64 | file 65 | 66 | 67 | 68 | 69 | 2010-08-17T19:13:53.181276Z 70 | 3659fd102d8a60a35a95e735d9762dd6 71 | 2008-07-19T21:40:06.854888Z 72 | 130 73 | me578022 74 | has-props 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 1110 96 | 97 | element_testcase.php 98 | file 99 | 100 | 101 | 102 | 103 | 2010-08-17T19:13:53.188276Z 104 | b346a61a9d66e112e5bb8e7cae72dfcf 105 | 2008-07-19T21:40:06.854888Z 106 | 130 107 | me578022 108 | has-props 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 8889 130 | 131 | all_test.php 132 | file 133 | 134 | 135 | 136 | 137 | 2010-08-17T19:13:53.198277Z 138 | 2217fa92f9dea484afa35bcd9ded0e15 139 | 2008-07-15T20:06:11.267636Z 140 | 129 141 | me578022 142 | has-props 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 281 164 | 165 | memory_test.php 166 | file 167 | 168 | 169 | 170 | 171 | 2010-08-17T19:13:53.204277Z 172 | 2861f8bf56bfdd23a6444c4dddcfb177 173 | 2008-07-19T21:40:06.854888Z 174 | 130 175 | me578022 176 | has-props 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 3134 198 | 199 | -------------------------------------------------------------------------------- /testcase/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 50 4 | /svnroot/simplehtmldom/!svn/ver/180/trunk/testcase 5 | END 6 | strip_testcase.php 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 69 10 | /svnroot/simplehtmldom/!svn/ver/169/trunk/testcase/strip_testcase.php 11 | END 12 | performance_test.php 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 71 16 | /svnroot/simplehtmldom/!svn/ver/133/trunk/testcase/performance_test.php 17 | END 18 | mass_test.php 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 64 22 | /svnroot/simplehtmldom/!svn/ver/174/trunk/testcase/mass_test.php 23 | END 24 | slick_test.php 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 65 28 | /svnroot/simplehtmldom/!svn/ver/133/trunk/testcase/slick_test.php 29 | END 30 | memory_test.php 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 66 34 | /svnroot/simplehtmldom/!svn/ver/179/trunk/testcase/memory_test.php 35 | END 36 | all_test.php 37 | K 25 38 | svn:wc:ra_dav:version-url 39 | V 63 40 | /svnroot/simplehtmldom/!svn/ver/175/trunk/testcase/all_test.php 41 | END 42 | dom_testcase.php 43 | K 25 44 | svn:wc:ra_dav:version-url 45 | V 67 46 | /svnroot/simplehtmldom/!svn/ver/180/trunk/testcase/dom_testcase.php 47 | END 48 | selector_testcase.php 49 | K 25 50 | svn:wc:ra_dav:version-url 51 | V 72 52 | /svnroot/simplehtmldom/!svn/ver/172/trunk/testcase/selector_testcase.php 53 | END 54 | jquery-1.2.3.pack.js 55 | K 25 56 | svn:wc:ra_dav:version-url 57 | V 71 58 | /svnroot/simplehtmldom/!svn/ver/106/trunk/testcase/jquery-1.2.3.pack.js 59 | END 60 | invalid_testcase.php 61 | K 25 62 | svn:wc:ra_dav:version-url 63 | V 71 64 | /svnroot/simplehtmldom/!svn/ver/175/trunk/testcase/invalid_testcase.php 65 | END 66 | element_testcase.php 67 | K 25 68 | svn:wc:ra_dav:version-url 69 | V 71 70 | /svnroot/simplehtmldom/!svn/ver/132/trunk/testcase/element_testcase.php 71 | END 72 | std_testcase.php 73 | K 25 74 | svn:wc:ra_dav:version-url 75 | V 67 76 | /svnroot/simplehtmldom/!svn/ver/115/trunk/testcase/std_testcase.php 77 | END 78 | misc_testcase.php 79 | K 25 80 | svn:wc:ra_dav:version-url 81 | V 68 82 | /svnroot/simplehtmldom/!svn/ver/133/trunk/testcase/misc_testcase.php 83 | END 84 | callback_testcase.php 85 | K 25 86 | svn:wc:ra_dav:version-url 87 | V 72 88 | /svnroot/simplehtmldom/!svn/ver/179/trunk/testcase/callback_testcase.php 89 | END 90 | slickspeed.htm 91 | K 25 92 | svn:wc:ra_dav:version-url 93 | V 65 94 | /svnroot/simplehtmldom/!svn/ver/106/trunk/testcase/slickspeed.htm 95 | END 96 | -------------------------------------------------------------------------------- /example/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/example 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2008-10-29T19:08:25.076520Z 11 | 169 12 | me578022 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | example_extract_html.php 30 | file 31 | 32 | 33 | 34 | 35 | 2010-08-17T19:13:52.948263Z 36 | 5815bb5f7500b9a88ecc70a123893c1b 37 | 2008-07-25T12:31:14.828880Z 38 | 133 39 | me578022 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 110 62 | 63 | example_basic_selector.php 64 | file 65 | 66 | 67 | 68 | 69 | 2010-08-17T19:13:52.951263Z 70 | 217a2d96745c826e96d13c055e31638b 71 | 2008-07-25T12:31:14.828880Z 72 | 133 73 | me578022 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 976 96 | 97 | example_modify_contents.php 98 | file 99 | 100 | 101 | 102 | 103 | 2010-08-17T19:13:52.953263Z 104 | e6fcf41d1b2a1867b0314f80efe7eb9a 105 | 2008-07-25T12:31:14.828880Z 106 | 133 107 | me578022 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 378 130 | 131 | simple_html_dom_utility.php 132 | file 133 | 134 | 135 | 136 | 137 | 2010-08-17T19:13:52.955263Z 138 | 3d75d01886f4fb7bc15a8f9a4b204428 139 | 2008-07-25T12:31:14.828880Z 140 | 133 141 | me578022 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 927 164 | 165 | scraping 166 | dir 167 | 168 | example_advanced_selector.php 169 | file 170 | 171 | 172 | 173 | 174 | 2010-08-17T19:13:52.956263Z 175 | 273077bc1a0c8945acc1f318b60d8476 176 | 2008-07-25T12:31:14.828880Z 177 | 133 178 | me578022 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 1521 201 | 202 | example_callback.php 203 | file 204 | 205 | 206 | 207 | 208 | 2010-08-17T19:13:52.964264Z 209 | 0d52be96ec57b5b40efb8588898159e4 210 | 2008-07-25T12:32:01.594191Z 211 | 134 212 | me578022 213 | has-props 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 604 235 | 236 | -------------------------------------------------------------------------------- /manual/css/default.css: -------------------------------------------------------------------------------- 1 | /*$Rev: 46 $*/ 2 | 3 | body { 4 | margin: 0; 5 | padding: 0; 6 | font-family: verdana,arial,helvetica,sans-serif; 7 | font-size: 11px; 8 | color: #4F5155; 9 | } 10 | 11 | #content { 12 | margin: 0 20px 0 20px; 13 | line-height: 16px; 14 | padding: 0; 15 | } 16 | 17 | h1 { 18 | font-size: 18px; 19 | margin: 0; 20 | padding: 0 0 2px 0; 21 | background-color: #D0D0D0; 22 | text-align: center; 23 | } 24 | 25 | h2 { 26 | background-color: #727EA3; 27 | border-right: 1px solid #D0D0D0; 28 | border-bottom: 1px solid #D0D0D0; 29 | color: #FFFFFF; 30 | font-size: 14px; 31 | font-weight: bold; 32 | margin: 14px 0 4px 0; 33 | padding: 1px 10px 1px 10px; 34 | } 35 | 36 | ul { 37 | margin-top: 0; 38 | margin-bottom: 0; 39 | line-height:1.5em; 40 | list-style-image:url(bullet.gif); 41 | list-style-type:square; 42 | } 43 | 44 | .top { 45 | font-size: 11px; 46 | float: right; 47 | } 48 | 49 | .code { 50 | font-size: 11px; 51 | font-family: Monaco, Verdana, Sans-serif; 52 | line-height: 14px; 53 | background-color: #f6f6f6; 54 | border-bottom: 1px solid #D0D0D0; 55 | border-top: 1px solid #A0A0A0; 56 | border-left: 1px solid #A0A0A0; 57 | border-right: 1px solid #D0D0D0; 58 | color: #002166; 59 | display: block; 60 | margin: 2px 0 2px 0; 61 | padding: 2px 10px 2px 10px; 62 | } 63 | 64 | .code A:link {color: #002166; text-decoration: none; font-weight: bold;} 65 | .code A:visited {color: #002166; text-decoration: none; font-weight: bold;} 66 | .code A:active {color: #002166; text-decoration: none; font-weight: bold;} 67 | .code A:hover {color: #0000ff; text-decoration: underline; font-weight: bold;} 68 | 69 | .code .keyword { 70 | color: #007700; 71 | } 72 | 73 | .code .comment { 74 | font-size: 10px; 75 | color: #888; 76 | } 77 | 78 | .code .var { 79 | color: #770000; 80 | } 81 | 82 | th { 83 | font-family: Lucida Grande, Verdana, Geneva, Sans-serif; 84 | color: #000000; 85 | background-color: #CFD4E6; 86 | margin: 2px 2px 2px 2px; 87 | padding: 2px 2px 2px 2px; 88 | font-size: 13px; 89 | font-weight: normal; 90 | font-style: normal; 91 | } 92 | 93 | td { 94 | background-color: #dddddd; 95 | } 96 | 97 | .description { 98 | font-family: Lucida Grande, Verdana, Geneva, Sans-serif; 99 | font-size: 11px; 100 | color: #333; 101 | text-ident: 30px; 102 | font-style: normal; 103 | } 104 | 105 | .returns { 106 | font-family: Monaco, Verdana, Sans-serif; 107 | font-size: 10px; 108 | color: #888; 109 | float: left; 110 | text-align: right; 111 | margin: 0 4px 0 0; 112 | width: 48px; 113 | } -------------------------------------------------------------------------------- /manual/css/.svn/text-base/default.css.svn-base: -------------------------------------------------------------------------------- 1 | /*$Rev: 46 $*/ 2 | 3 | body { 4 | margin: 0; 5 | padding: 0; 6 | font-family: verdana,arial,helvetica,sans-serif; 7 | font-size: 11px; 8 | color: #4F5155; 9 | } 10 | 11 | #content { 12 | margin: 0 20px 0 20px; 13 | line-height: 16px; 14 | padding: 0; 15 | } 16 | 17 | h1 { 18 | font-size: 18px; 19 | margin: 0; 20 | padding: 0 0 2px 0; 21 | background-color: #D0D0D0; 22 | text-align: center; 23 | } 24 | 25 | h2 { 26 | background-color: #727EA3; 27 | border-right: 1px solid #D0D0D0; 28 | border-bottom: 1px solid #D0D0D0; 29 | color: #FFFFFF; 30 | font-size: 14px; 31 | font-weight: bold; 32 | margin: 14px 0 4px 0; 33 | padding: 1px 10px 1px 10px; 34 | } 35 | 36 | ul { 37 | margin-top: 0; 38 | margin-bottom: 0; 39 | line-height:1.5em; 40 | list-style-image:url(bullet.gif); 41 | list-style-type:square; 42 | } 43 | 44 | .top { 45 | font-size: 11px; 46 | float: right; 47 | } 48 | 49 | .code { 50 | font-size: 11px; 51 | font-family: Monaco, Verdana, Sans-serif; 52 | line-height: 14px; 53 | background-color: #f6f6f6; 54 | border-bottom: 1px solid #D0D0D0; 55 | border-top: 1px solid #A0A0A0; 56 | border-left: 1px solid #A0A0A0; 57 | border-right: 1px solid #D0D0D0; 58 | color: #002166; 59 | display: block; 60 | margin: 2px 0 2px 0; 61 | padding: 2px 10px 2px 10px; 62 | } 63 | 64 | .code A:link {color: #002166; text-decoration: none; font-weight: bold;} 65 | .code A:visited {color: #002166; text-decoration: none; font-weight: bold;} 66 | .code A:active {color: #002166; text-decoration: none; font-weight: bold;} 67 | .code A:hover {color: #0000ff; text-decoration: underline; font-weight: bold;} 68 | 69 | .code .keyword { 70 | color: #007700; 71 | } 72 | 73 | .code .comment { 74 | font-size: 10px; 75 | color: #888; 76 | } 77 | 78 | .code .var { 79 | color: #770000; 80 | } 81 | 82 | th { 83 | font-family: Lucida Grande, Verdana, Geneva, Sans-serif; 84 | color: #000000; 85 | background-color: #CFD4E6; 86 | margin: 2px 2px 2px 2px; 87 | padding: 2px 2px 2px 2px; 88 | font-size: 13px; 89 | font-weight: normal; 90 | font-style: normal; 91 | } 92 | 93 | td { 94 | background-color: #dddddd; 95 | } 96 | 97 | .description { 98 | font-family: Lucida Grande, Verdana, Geneva, Sans-serif; 99 | font-size: 11px; 100 | color: #333; 101 | text-ident: 30px; 102 | font-style: normal; 103 | } 104 | 105 | .returns { 106 | font-family: Monaco, Verdana, Sans-serif; 107 | font-size: 10px; 108 | color: #888; 109 | float: left; 110 | text-align: right; 111 | margin: 0 4px 0 0; 112 | width: 48px; 113 | } -------------------------------------------------------------------------------- /app/js/jquery.treeview.css: -------------------------------------------------------------------------------- 1 | .treeview, .treeview ul { 2 | padding: 0; 3 | margin: 0; 4 | list-style: none; 5 | } 6 | 7 | .treeview ul { 8 | background-color: white; 9 | margin-top: 4px; 10 | } 11 | 12 | .treeview .hitarea { 13 | background: url(images/treeview-default.gif) -64px -25px no-repeat; 14 | height: 16px; 15 | width: 16px; 16 | margin-left: -16px; 17 | float: left; 18 | cursor: pointer; 19 | } 20 | /* fix for IE6 */ 21 | * html .hitarea { 22 | display: inline; 23 | float:none; 24 | } 25 | 26 | .treeview li { 27 | margin: 0; 28 | padding: 3px 0pt 3px 16px; 29 | } 30 | 31 | .treeview a.selected { 32 | background-color: #eee; 33 | } 34 | 35 | #treecontrol { margin: 1em 0; display: none; } 36 | 37 | .treeview .hover { color: red; cursor: pointer; } 38 | 39 | .treeview li { background: url(images/treeview-default-line.gif) 0 0 no-repeat; } 40 | .treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; } 41 | 42 | .treeview .expandable-hitarea { background-position: -80px -3px; } 43 | 44 | .treeview li.last { background-position: 0 -1766px } 45 | .treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(images/treeview-default.gif); } 46 | .treeview li.lastCollapsable { background-position: 0 -111px } 47 | .treeview li.lastExpandable { background-position: -32px -67px } 48 | 49 | .treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; } 50 | 51 | .treeview-red li { background-image: url(images/treeview-red-line.gif); } 52 | .treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(images/treeview-red.gif); } 53 | 54 | .treeview-black li { background-image: url(images/treeview-black-line.gif); } 55 | .treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(images/treeview-black.gif); } 56 | 57 | .treeview-gray li { background-image: url(images/treeview-gray-line.gif); } 58 | .treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(images/treeview-gray.gif); } 59 | 60 | .treeview-famfamfam li { background-image: url(images/treeview-famfamfam-line.gif); } 61 | .treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(images/treeview-famfamfam.gif); } 62 | 63 | 64 | .filetree li { padding: 3px 0 2px 16px; } 65 | .filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; } 66 | .filetree span.folder { background: url(images/folder.gif) 0 0 no-repeat; } 67 | .filetree li.expandable span.folder { background: url(images/folder-closed.gif) 0 0 no-repeat; } 68 | .filetree span.file { background: url(images/file.gif) 0 0 no-repeat; } 69 | -------------------------------------------------------------------------------- /app/js/.svn/text-base/jquery.treeview.css.svn-base: -------------------------------------------------------------------------------- 1 | .treeview, .treeview ul { 2 | padding: 0; 3 | margin: 0; 4 | list-style: none; 5 | } 6 | 7 | .treeview ul { 8 | background-color: white; 9 | margin-top: 4px; 10 | } 11 | 12 | .treeview .hitarea { 13 | background: url(images/treeview-default.gif) -64px -25px no-repeat; 14 | height: 16px; 15 | width: 16px; 16 | margin-left: -16px; 17 | float: left; 18 | cursor: pointer; 19 | } 20 | /* fix for IE6 */ 21 | * html .hitarea { 22 | display: inline; 23 | float:none; 24 | } 25 | 26 | .treeview li { 27 | margin: 0; 28 | padding: 3px 0pt 3px 16px; 29 | } 30 | 31 | .treeview a.selected { 32 | background-color: #eee; 33 | } 34 | 35 | #treecontrol { margin: 1em 0; display: none; } 36 | 37 | .treeview .hover { color: red; cursor: pointer; } 38 | 39 | .treeview li { background: url(images/treeview-default-line.gif) 0 0 no-repeat; } 40 | .treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; } 41 | 42 | .treeview .expandable-hitarea { background-position: -80px -3px; } 43 | 44 | .treeview li.last { background-position: 0 -1766px } 45 | .treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(images/treeview-default.gif); } 46 | .treeview li.lastCollapsable { background-position: 0 -111px } 47 | .treeview li.lastExpandable { background-position: -32px -67px } 48 | 49 | .treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; } 50 | 51 | .treeview-red li { background-image: url(images/treeview-red-line.gif); } 52 | .treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(images/treeview-red.gif); } 53 | 54 | .treeview-black li { background-image: url(images/treeview-black-line.gif); } 55 | .treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(images/treeview-black.gif); } 56 | 57 | .treeview-gray li { background-image: url(images/treeview-gray-line.gif); } 58 | .treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(images/treeview-gray.gif); } 59 | 60 | .treeview-famfamfam li { background-image: url(images/treeview-famfamfam-line.gif); } 61 | .treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(images/treeview-famfamfam.gif); } 62 | 63 | 64 | .filetree li { padding: 3px 0 2px 16px; } 65 | .filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; } 66 | .filetree span.folder { background: url(images/folder.gif) 0 0 no-repeat; } 67 | .filetree li.expandable span.folder { background: url(images/folder-closed.gif) 0 0 no-repeat; } 68 | .filetree span.file { background: url(images/file.gif) 0 0 no-repeat; } 69 | -------------------------------------------------------------------------------- /testcase/mass_test.php: -------------------------------------------------------------------------------- 1 | 'empty.htm', 'url'=>''), 10 | array('name'=>'smarty_1.htm', 'url'=>'guestbook.tpl'), 11 | array('name'=>'smarty_2.htm', 'url'=>'guestbook_form.tpl'), 12 | 13 | array('name'=>'google.htm', 'url'=>'http://www.google.com/'), 14 | array('name'=>'senate.htm', 'url'=>'http://www.senate.gov/legislative/LIS/roll_call_lists/roll_call_vote_cfm.cfm?congress=101&session=2&vote=00317'), 15 | array('name'=>'cyberciti.htm', 'url'=>'http://www.cyberciti.biz/tips/configure-ubuntu-grub-to-load-freebsd.html'), 16 | array('name'=>'myspace.htm', 'url'=>'http://www.myspace.com/'), 17 | array('name'=>'mootools.htm', 'url'=>'http://www.mootools.net/'), 18 | array('name'=>'jquery.htm', 'url'=>'http://jquery.com/'), 19 | array('name'=>'scriptaculo.htm', 'url'=>'http://script.aculo.us/'), 20 | array('name'=>'apache.htm', 'url'=>'http://www.apache.org/'), 21 | array('name'=>'microsoft.htm', 'url'=>'http://www.microsoft.com/'), 22 | array('name'=>'slashdot.htm', 'url'=>'http://www.slashdot.org/'), 23 | array('name'=>'ror.htm', 'url'=>'http://www.rubyonrails.org/'), 24 | array('name'=>'yahoo.htm', 'url'=>'http://www.yahoo.com/'), 25 | array('name'=>'phpbb.htm', 'url'=>'http://www.phpbb.com/'), 26 | array('name'=>'python.htm', 'url'=>'http://www.python.org/'), 27 | array('name'=>'lua.htm', 'url'=>'http://www.lua.org/'), 28 | array('name'=>'php.htm', 'url'=>'http://www.php.net/'), 29 | array('name'=>'ibm.htm', 'url'=>'http://www.ibm.com/'), 30 | array('name'=>'java.htm', 'url'=>'http://java.sun.com/'), 31 | array('name'=>'flickr.htm', 'url'=>'http://www.flickr.com/tour/upload/'), 32 | array('name'=>'amazon.htm', 'url'=>'http://www.amazon.com/'), 33 | array('name'=>'youtube.htm', 'url'=>'http://www.youtube.com/watch?v=kib05Ip6GSo&feature=bz302'), 34 | ); 35 | 36 | 37 | echo 'memory: '.memory_get_usage().'
    '; 38 | $dom = new simple_html_dom; 39 | 40 | foreach($files as $f) { 41 | // get file from url 42 | if($f['url']!='') file_put_contents($dir.$f['name'], file_get_contents($f['url'])); 43 | else file_put_contents($dir.$f['name'], ''); 44 | 45 | $start = microtime(); 46 | $dom->load(file_get_contents($dir.$f['name']), false); 47 | list($eu, $es) = explode(' ', microtime()); 48 | list($bu, $bs) = explode(' ', $start); 49 | echo sprintf('(%.1f)', ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000).'
    '; 50 | 51 | if (file_get_contents($dir.$f['name'])!=$dom->save()) { 52 | echo "[failed] ".$f['name']."
    "; 53 | $dom->save($dir.$f['name'].'.error'); 54 | } 55 | else 56 | echo "[success] ".$f['name']."
    "; 57 | 58 | echo 'memory: '.memory_get_usage().'
    '; 59 | 60 | flush(); 61 | set_time_limit(0); 62 | } 63 | 64 | $dom->clear(); 65 | unset($dom); 66 | echo '
    memory: '.memory_get_usage().'
    '; 67 | 68 | ?> -------------------------------------------------------------------------------- /testcase/.svn/text-base/mass_test.php.svn-base: -------------------------------------------------------------------------------- 1 | 'empty.htm', 'url'=>''), 10 | array('name'=>'smarty_1.htm', 'url'=>'guestbook.tpl'), 11 | array('name'=>'smarty_2.htm', 'url'=>'guestbook_form.tpl'), 12 | 13 | array('name'=>'google.htm', 'url'=>'http://www.google.com/'), 14 | array('name'=>'senate.htm', 'url'=>'http://www.senate.gov/legislative/LIS/roll_call_lists/roll_call_vote_cfm.cfm?congress=101&session=2&vote=00317'), 15 | array('name'=>'cyberciti.htm', 'url'=>'http://www.cyberciti.biz/tips/configure-ubuntu-grub-to-load-freebsd.html'), 16 | array('name'=>'myspace.htm', 'url'=>'http://www.myspace.com/'), 17 | array('name'=>'mootools.htm', 'url'=>'http://www.mootools.net/'), 18 | array('name'=>'jquery.htm', 'url'=>'http://jquery.com/'), 19 | array('name'=>'scriptaculo.htm', 'url'=>'http://script.aculo.us/'), 20 | array('name'=>'apache.htm', 'url'=>'http://www.apache.org/'), 21 | array('name'=>'microsoft.htm', 'url'=>'http://www.microsoft.com/'), 22 | array('name'=>'slashdot.htm', 'url'=>'http://www.slashdot.org/'), 23 | array('name'=>'ror.htm', 'url'=>'http://www.rubyonrails.org/'), 24 | array('name'=>'yahoo.htm', 'url'=>'http://www.yahoo.com/'), 25 | array('name'=>'phpbb.htm', 'url'=>'http://www.phpbb.com/'), 26 | array('name'=>'python.htm', 'url'=>'http://www.python.org/'), 27 | array('name'=>'lua.htm', 'url'=>'http://www.lua.org/'), 28 | array('name'=>'php.htm', 'url'=>'http://www.php.net/'), 29 | array('name'=>'ibm.htm', 'url'=>'http://www.ibm.com/'), 30 | array('name'=>'java.htm', 'url'=>'http://java.sun.com/'), 31 | array('name'=>'flickr.htm', 'url'=>'http://www.flickr.com/tour/upload/'), 32 | array('name'=>'amazon.htm', 'url'=>'http://www.amazon.com/'), 33 | array('name'=>'youtube.htm', 'url'=>'http://www.youtube.com/watch?v=kib05Ip6GSo&feature=bz302'), 34 | ); 35 | 36 | 37 | echo 'memory: '.memory_get_usage().'
    '; 38 | $dom = new simple_html_dom; 39 | 40 | foreach($files as $f) { 41 | // get file from url 42 | if($f['url']!='') file_put_contents($dir.$f['name'], file_get_contents($f['url'])); 43 | else file_put_contents($dir.$f['name'], ''); 44 | 45 | $start = microtime(); 46 | $dom->load(file_get_contents($dir.$f['name']), false); 47 | list($eu, $es) = explode(' ', microtime()); 48 | list($bu, $bs) = explode(' ', $start); 49 | echo sprintf('(%.1f)', ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000).'
    '; 50 | 51 | if (file_get_contents($dir.$f['name'])!=$dom->save()) { 52 | echo "[failed] ".$f['name']."
    "; 53 | $dom->save($dir.$f['name'].'.error'); 54 | } 55 | else 56 | echo "[success] ".$f['name']."
    "; 57 | 58 | echo 'memory: '.memory_get_usage().'
    '; 59 | 60 | flush(); 61 | set_time_limit(0); 62 | } 63 | 64 | $dom->clear(); 65 | unset($dom); 66 | echo '
    memory: '.memory_get_usage().'
    '; 67 | 68 | ?> -------------------------------------------------------------------------------- /testcase/reader/.svn/text-base/memory_test.php.svn-base: -------------------------------------------------------------------------------- 1 | "; 12 | } 13 | 14 | function stat_dom($dom) { 15 | $count_text = 0; 16 | $count_comm = 0; 17 | $count_elem = 0; 18 | $count_tag_end = 0; 19 | 20 | foreach($dom->nodes as $n) { 21 | if ($n->nodetype==HDOM_TYPE_TEXT) 22 | ++$count_text; 23 | if ($n->nodetype==HDOM_TYPE_COMMENT) 24 | ++$count_comm; 25 | if ($n->nodetype==HDOM_TYPE_ELEMENT) 26 | ++$count_elem; 27 | if ($n->nodetype==HDOM_TYPE_ENDTAG) 28 | ++$count_tag_end; 29 | } 30 | 31 | echo 'Total: '. count($dom->nodes).', Text: '.$count_text.', Commnet: '.$count_comm.', Tag: '.$count_elem.', End Tag: '.$count_tag_end.'
    '; 32 | } 33 | 34 | echo 'init ' . number_format(memory_get_usage(), 0, '.', ',') . " bytes"; 35 | 36 | 37 | echo '

    [load file]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 38 | echo '------------------------------------------
    '; 39 | flush(); 40 | for($i=0; $i<3; ++$i) { 41 | $str = file_get_contents($filename); 42 | unset($str); 43 | dump_memory(); 44 | } 45 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 46 | flush(); 47 | 48 | 49 | $str = file_get_contents($filename); 50 | echo '

    [multi objects str_get_dom clear memory]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 51 | echo '------------------------------------------
    '; 52 | flush(); 53 | for($i=0; $i<3; ++$i) { 54 | $dom = str_get_dom($str); 55 | //stat_dom($dom); 56 | $dom->clear(); 57 | unset($dom); 58 | dump_memory(); 59 | flush(); 60 | } 61 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 62 | flush(); 63 | 64 | echo '

    [multi objects file_get_dom clear memory]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 65 | echo '------------------------------------------
    '; 66 | flush(); 67 | for($i=0; $i<3; ++$i) { 68 | $dom = file_get_dom($filename); 69 | //stat_dom($dom); 70 | $dom->clear(); 71 | unset($dom); 72 | dump_memory(); 73 | flush(); 74 | } 75 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 76 | flush(); 77 | 78 | 79 | echo '

    [one object]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 80 | echo '------------------------------------------
    '; 81 | flush(); 82 | $dom = new simple_html_dom; 83 | for($i=0; $i<3; ++$i) { 84 | $dom->load_file($filename); 85 | $dom->clear(); 86 | dump_memory(); 87 | } 88 | unset($dom); 89 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 90 | flush(); 91 | 92 | 93 | 94 | echo '

    [multi objects without clear memory]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 95 | echo '------------------------------------------
    '; 96 | flush(); 97 | for($i=0; $i<3; ++$i) { 98 | $dom = file_get_dom($filename); 99 | dump_memory(); 100 | } 101 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 102 | flush(); 103 | ?> -------------------------------------------------------------------------------- /testcase/reader/memory_test.php: -------------------------------------------------------------------------------- 1 | "; 12 | } 13 | 14 | function stat_dom($dom) { 15 | $count_text = 0; 16 | $count_comm = 0; 17 | $count_elem = 0; 18 | $count_tag_end = 0; 19 | 20 | foreach($dom->nodes as $n) { 21 | if ($n->nodetype==HDOM_TYPE_TEXT) 22 | ++$count_text; 23 | if ($n->nodetype==HDOM_TYPE_COMMENT) 24 | ++$count_comm; 25 | if ($n->nodetype==HDOM_TYPE_ELEMENT) 26 | ++$count_elem; 27 | if ($n->nodetype==HDOM_TYPE_ENDTAG) 28 | ++$count_tag_end; 29 | } 30 | 31 | echo 'Total: '. count($dom->nodes).', Text: '.$count_text.', Commnet: '.$count_comm.', Tag: '.$count_elem.', End Tag: '.$count_tag_end.'
    '; 32 | } 33 | 34 | echo 'init ' . number_format(memory_get_usage(), 0, '.', ',') . " bytes"; 35 | 36 | 37 | echo '

    [load file]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 38 | echo '------------------------------------------
    '; 39 | flush(); 40 | for($i=0; $i<3; ++$i) { 41 | $str = file_get_contents($filename); 42 | unset($str); 43 | dump_memory(); 44 | } 45 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 46 | flush(); 47 | 48 | 49 | $str = file_get_contents($filename); 50 | echo '

    [multi objects str_get_dom clear memory]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 51 | echo '------------------------------------------
    '; 52 | flush(); 53 | for($i=0; $i<3; ++$i) { 54 | $dom = str_get_dom($str); 55 | //stat_dom($dom); 56 | $dom->clear(); 57 | unset($dom); 58 | dump_memory(); 59 | flush(); 60 | } 61 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 62 | flush(); 63 | 64 | echo '

    [multi objects file_get_dom clear memory]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 65 | echo '------------------------------------------
    '; 66 | flush(); 67 | for($i=0; $i<3; ++$i) { 68 | $dom = file_get_dom($filename); 69 | //stat_dom($dom); 70 | $dom->clear(); 71 | unset($dom); 72 | dump_memory(); 73 | flush(); 74 | } 75 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 76 | flush(); 77 | 78 | 79 | echo '

    [one object]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 80 | echo '------------------------------------------
    '; 81 | flush(); 82 | $dom = new simple_html_dom; 83 | for($i=0; $i<3; ++$i) { 84 | $dom->load_file($filename); 85 | $dom->clear(); 86 | dump_memory(); 87 | } 88 | unset($dom); 89 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 90 | flush(); 91 | 92 | 93 | 94 | echo '

    [multi objects without clear memory]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 95 | echo '------------------------------------------
    '; 96 | flush(); 97 | for($i=0; $i<3; ++$i) { 98 | $dom = file_get_dom($filename); 99 | dump_memory(); 100 | } 101 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 102 | flush(); 103 | ?> -------------------------------------------------------------------------------- /manual/css/ui.tabs.css: -------------------------------------------------------------------------------- 1 | /* Caution! Ensure accessibility in print and other media types... */ 2 | @media projection, screen { /* Use class for showing/hiding tab content, so that visibility can be better controlled in different media types... */ 3 | .ui-tabs-hide { 4 | display: none; 5 | } 6 | } 7 | 8 | /* Hide useless elements in print layouts... */ 9 | @media print { 10 | .ui-tabs-nav { 11 | display: none; 12 | } 13 | } 14 | 15 | /* Skin */ 16 | .ui-tabs-nav, .ui-tabs-panel { 17 | font-family: "Trebuchet MS", Trebuchet, Verdana, Helvetica, Arial, sans-serif; 18 | font-size: 12px; 19 | } 20 | .ui-tabs-nav { 21 | list-style: none; 22 | margin: 0; 23 | padding: 0 0 0 4px; 24 | } 25 | .ui-tabs-nav:after { /* clearing without presentational markup, IE gets extra treatment */ 26 | display: block; 27 | clear: both; 28 | content: " "; 29 | } 30 | .ui-tabs-nav li { 31 | float: left; 32 | margin: 0 0 0 1px; 33 | min-width: 84px; /* be nice to Opera */ 34 | } 35 | .ui-tabs-nav a, .ui-tabs-nav a span { 36 | display: block; 37 | padding: 0 10px; 38 | background: url(../img/tab.png) no-repeat; 39 | } 40 | .ui-tabs-nav a { 41 | margin: 1px 0 0; /* position: relative makes opacity fail for disabled tab in IE */ 42 | padding-left: 0; 43 | color: #27537a; 44 | font-weight: bold; 45 | line-height: 1.2; 46 | text-align: center; 47 | text-decoration: none; 48 | white-space: nowrap; /* required in IE 6 */ 49 | outline: 0; /* prevent dotted border in Firefox */ 50 | } 51 | .ui-tabs-nav .ui-tabs-selected a { 52 | position: relative; 53 | top: 1px; 54 | z-index: 2; 55 | margin-top: 0; 56 | color: #000; 57 | } 58 | .ui-tabs-nav a span { 59 | width: 64px; /* IE 6 treats width as min-width */ 60 | min-width: 64px; 61 | height: 18px; /* IE 6 treats height as min-height */ 62 | min-height: 18px; 63 | padding-top: 6px; 64 | padding-right: 0; 65 | } 66 | *>.ui-tabs-nav a span { /* hide from IE 6 */ 67 | width: auto; 68 | height: auto; 69 | } 70 | .ui-tabs-nav .ui-tabs-selected a span { 71 | padding-bottom: 1px; 72 | } 73 | .ui-tabs-nav .ui-tabs-selected a, .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active { 74 | background-position: 100% -150px; 75 | } 76 | .ui-tabs-nav a, .ui-tabs-nav .ui-tabs-disabled a:hover, .ui-tabs-nav .ui-tabs-disabled a:focus, .ui-tabs-nav .ui-tabs-disabled a:active { 77 | background-position: 100% -100px; 78 | } 79 | .ui-tabs-nav .ui-tabs-selected a span, .ui-tabs-nav a:hover span, .ui-tabs-nav a:focus span, .ui-tabs-nav a:active span { 80 | background-position: 0 -50px; 81 | } 82 | .ui-tabs-nav a span, .ui-tabs-nav .ui-tabs-disabled a:hover span, .ui-tabs-nav .ui-tabs-disabled a:focus span, .ui-tabs-nav .ui-tabs-disabled a:active span { 83 | background-position: 0 0; 84 | } 85 | .ui-tabs-nav .ui-tabs-selected a:link, .ui-tabs-nav .ui-tabs-selected a:visited, .ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */ 86 | cursor: text; 87 | } 88 | .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active, 89 | .ui-tabs-nav .ui-tabs-unselect a:hover, .ui-tabs-nav .ui-tabs-unselect a:focus, .ui-tabs-nav .ui-tabs-unselect a:active { /* @ Opera, we need to be explicit again here now... */ 90 | cursor: pointer; 91 | } 92 | .ui-tabs-disabled { 93 | opacity: .4; 94 | filter: alpha(opacity=40); 95 | } 96 | .ui-tabs-panel { 97 | border-top: 1px solid #97a5b0; 98 | padding: 2px 4px 2px 4px; 99 | background: #fff; /* declare background color for container to avoid distorted fonts in IE while fading */ 100 | border: 1px solid #D0D0D0; 101 | border-bottom: 1px solid #A0A0A0; 102 | border-right: 1px solid #A0A0A0; 103 | } 104 | .ui-tabs-loading em { 105 | padding: 0 0 0 20px; 106 | background: url(loading.gif) no-repeat 0 50%; 107 | } 108 | 109 | /* Additional IE specific bug fixes... */ 110 | * html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */ 111 | display: inline-block; 112 | } 113 | *:first-child+html .ui-tabs-nav { /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */ 114 | display: inline-block; 115 | } 116 | 117 | -------------------------------------------------------------------------------- /manual/css/.svn/text-base/ui.tabs.css.svn-base: -------------------------------------------------------------------------------- 1 | /* Caution! Ensure accessibility in print and other media types... */ 2 | @media projection, screen { /* Use class for showing/hiding tab content, so that visibility can be better controlled in different media types... */ 3 | .ui-tabs-hide { 4 | display: none; 5 | } 6 | } 7 | 8 | /* Hide useless elements in print layouts... */ 9 | @media print { 10 | .ui-tabs-nav { 11 | display: none; 12 | } 13 | } 14 | 15 | /* Skin */ 16 | .ui-tabs-nav, .ui-tabs-panel { 17 | font-family: "Trebuchet MS", Trebuchet, Verdana, Helvetica, Arial, sans-serif; 18 | font-size: 12px; 19 | } 20 | .ui-tabs-nav { 21 | list-style: none; 22 | margin: 0; 23 | padding: 0 0 0 4px; 24 | } 25 | .ui-tabs-nav:after { /* clearing without presentational markup, IE gets extra treatment */ 26 | display: block; 27 | clear: both; 28 | content: " "; 29 | } 30 | .ui-tabs-nav li { 31 | float: left; 32 | margin: 0 0 0 1px; 33 | min-width: 84px; /* be nice to Opera */ 34 | } 35 | .ui-tabs-nav a, .ui-tabs-nav a span { 36 | display: block; 37 | padding: 0 10px; 38 | background: url(../img/tab.png) no-repeat; 39 | } 40 | .ui-tabs-nav a { 41 | margin: 1px 0 0; /* position: relative makes opacity fail for disabled tab in IE */ 42 | padding-left: 0; 43 | color: #27537a; 44 | font-weight: bold; 45 | line-height: 1.2; 46 | text-align: center; 47 | text-decoration: none; 48 | white-space: nowrap; /* required in IE 6 */ 49 | outline: 0; /* prevent dotted border in Firefox */ 50 | } 51 | .ui-tabs-nav .ui-tabs-selected a { 52 | position: relative; 53 | top: 1px; 54 | z-index: 2; 55 | margin-top: 0; 56 | color: #000; 57 | } 58 | .ui-tabs-nav a span { 59 | width: 64px; /* IE 6 treats width as min-width */ 60 | min-width: 64px; 61 | height: 18px; /* IE 6 treats height as min-height */ 62 | min-height: 18px; 63 | padding-top: 6px; 64 | padding-right: 0; 65 | } 66 | *>.ui-tabs-nav a span { /* hide from IE 6 */ 67 | width: auto; 68 | height: auto; 69 | } 70 | .ui-tabs-nav .ui-tabs-selected a span { 71 | padding-bottom: 1px; 72 | } 73 | .ui-tabs-nav .ui-tabs-selected a, .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active { 74 | background-position: 100% -150px; 75 | } 76 | .ui-tabs-nav a, .ui-tabs-nav .ui-tabs-disabled a:hover, .ui-tabs-nav .ui-tabs-disabled a:focus, .ui-tabs-nav .ui-tabs-disabled a:active { 77 | background-position: 100% -100px; 78 | } 79 | .ui-tabs-nav .ui-tabs-selected a span, .ui-tabs-nav a:hover span, .ui-tabs-nav a:focus span, .ui-tabs-nav a:active span { 80 | background-position: 0 -50px; 81 | } 82 | .ui-tabs-nav a span, .ui-tabs-nav .ui-tabs-disabled a:hover span, .ui-tabs-nav .ui-tabs-disabled a:focus span, .ui-tabs-nav .ui-tabs-disabled a:active span { 83 | background-position: 0 0; 84 | } 85 | .ui-tabs-nav .ui-tabs-selected a:link, .ui-tabs-nav .ui-tabs-selected a:visited, .ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */ 86 | cursor: text; 87 | } 88 | .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active, 89 | .ui-tabs-nav .ui-tabs-unselect a:hover, .ui-tabs-nav .ui-tabs-unselect a:focus, .ui-tabs-nav .ui-tabs-unselect a:active { /* @ Opera, we need to be explicit again here now... */ 90 | cursor: pointer; 91 | } 92 | .ui-tabs-disabled { 93 | opacity: .4; 94 | filter: alpha(opacity=40); 95 | } 96 | .ui-tabs-panel { 97 | border-top: 1px solid #97a5b0; 98 | padding: 2px 4px 2px 4px; 99 | background: #fff; /* declare background color for container to avoid distorted fonts in IE while fading */ 100 | border: 1px solid #D0D0D0; 101 | border-bottom: 1px solid #A0A0A0; 102 | border-right: 1px solid #A0A0A0; 103 | } 104 | .ui-tabs-loading em { 105 | padding: 0 0 0 20px; 106 | background: url(loading.gif) no-repeat 0 50%; 107 | } 108 | 109 | /* Additional IE specific bug fixes... */ 110 | * html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */ 111 | display: inline-block; 112 | } 113 | *:first-child+html .ui-tabs-nav { /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */ 114 | display: inline-block; 115 | } 116 | 117 | -------------------------------------------------------------------------------- /manual/manual_faq.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PHP Simple HTML DOM Parser: FAQ 6 | 7 | 8 | 9 |

    PHP Simple HTML DOM Parser Manual

    10 |
    11 |

    FAQ

    12 | 19 |
    20 | 21 |

    Problem with finding

    22 | Top 23 |
    Q: Element not found in such case:
    24 | $html->find('div[style=padding: 0px 2px;] span[class=rf]');
    25 |
    26 | A: If there is blank in selectors, quote it!  
    27 | $html->find('div[style="padding: 0px 2px;"] span[class=rf]');
    28 | 29 |

    Problem with hosting

    30 | Top 31 |
    Q: On my local server everything works fine, but when I put it on my esternal server it doesn't work. 
    32 |
    33 | A: The "file_get_dom" function is a wrapper of "file_get_contents" function,  you must set "allow_url_fopen" as TRUE in "php.ini" to allow accessing files via HTTP or FTP. However, some hosting venders disabled PHP's "allow_url_fopen" flag for security issues... PHP provides excellent support for "curl" library to do the same job, Use curl to get the page, then call "str_get_dom" to create DOM object. 
    34 |
    35 | Example: 
    36 |  
    37 | $curl = curl_init(); 
    38 | curl_setopt($curl, CURLOPT_URL, 'http://????????');  
    39 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);  
    40 | curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);  
    41 | $str = curl_exec($curl);  
    42 | curl_close($curl);  
    43 |  
    44 | $html= str_get_html($str); 
    45 | ... 
    46 | 47 |
    48 |

    Behind a proxy

    49 | Top 50 |
    Q: My server is behind a Proxy and i can't use file_get_contents b/c it returns a unauthorized error.
    51 |
    52 | A: Thanks for Shaggy to provide the solution: 
    53 |  
    54 | // Define a context for HTTP. 
    55 | $context = array
    56 | ( 
    57 |        'http' => array
    58 |        ( 
    59 |               'proxy' => 'addresseproxy:portproxy', // This needs to be the server and the port of the NTLM Authentication Proxy Server. 
    60 |               'request_fulluri' => true, 
    61 |        ), 
    62 | ); 
    63 |
    64 | $context = stream_context_create($context); 
    65 |  
    66 | $html= file_get_html('http://www.php.net', false, $context); 
    67 | ...
    68 |
    69 |
    70 | 71 |

    Memory leak!

    72 | Top 73 |
    Q: This script is leaking memory seriously... After it finished running, it's not cleaning up dom object properly from memory.. 
    74 |
    75 | A: Due to php5 circular references memory leak, after creating DOM object, you must call $dom->clear() to free memory if call file_get_dom() more then once. 
    76 |
    77 | Example: 
    78 |
    79 | $html = file_get_html(...); 
    80 | // do something... 
    81 | $html->clear(); 
    82 | unset($html);
    83 |
    84 | Author: S.C. Chen (me578022@gmail.com)
    85 | Original idea is from Jose Solorzano's HTML Parser for PHP 4.
    86 | Contributions by: Yousuke Kumakura, Vadim Voituk, Antcs
    87 |
    88 |
    89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /manual/.svn/text-base/manual_faq.htm.svn-base: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PHP Simple HTML DOM Parser: FAQ 6 | 7 | 8 | 9 |

    PHP Simple HTML DOM Parser Manual

    10 |
    11 |

    FAQ

    12 | 19 |
    20 | 21 |

    Problem with finding

    22 | Top 23 |
    Q: Element not found in such case:
    24 | $html->find('div[style=padding: 0px 2px;] span[class=rf]');
    25 |
    26 | A: If there is blank in selectors, quote it!  
    27 | $html->find('div[style="padding: 0px 2px;"] span[class=rf]');
    28 | 29 |

    Problem with hosting

    30 | Top 31 |
    Q: On my local server everything works fine, but when I put it on my esternal server it doesn't work. 
    32 |
    33 | A: The "file_get_dom" function is a wrapper of "file_get_contents" function,  you must set "allow_url_fopen" as TRUE in "php.ini" to allow accessing files via HTTP or FTP. However, some hosting venders disabled PHP's "allow_url_fopen" flag for security issues... PHP provides excellent support for "curl" library to do the same job, Use curl to get the page, then call "str_get_dom" to create DOM object. 
    34 |
    35 | Example: 
    36 |  
    37 | $curl = curl_init(); 
    38 | curl_setopt($curl, CURLOPT_URL, 'http://????????');  
    39 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);  
    40 | curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);  
    41 | $str = curl_exec($curl);  
    42 | curl_close($curl);  
    43 |  
    44 | $html= str_get_html($str); 
    45 | ... 
    46 | 47 |
    48 |

    Behind a proxy

    49 | Top 50 |
    Q: My server is behind a Proxy and i can't use file_get_contents b/c it returns a unauthorized error.
    51 |
    52 | A: Thanks for Shaggy to provide the solution: 
    53 |  
    54 | // Define a context for HTTP. 
    55 | $context = array
    56 | ( 
    57 |        'http' => array
    58 |        ( 
    59 |               'proxy' => 'addresseproxy:portproxy', // This needs to be the server and the port of the NTLM Authentication Proxy Server. 
    60 |               'request_fulluri' => true, 
    61 |        ), 
    62 | ); 
    63 |
    64 | $context = stream_context_create($context); 
    65 |  
    66 | $html= file_get_html('http://www.php.net', false, $context); 
    67 | ...
    68 |
    69 |
    70 | 71 |

    Memory leak!

    72 | Top 73 |
    Q: This script is leaking memory seriously... After it finished running, it's not cleaning up dom object properly from memory.. 
    74 |
    75 | A: Due to php5 circular references memory leak, after creating DOM object, you must call $dom->clear() to free memory if call file_get_dom() more then once. 
    76 |
    77 | Example: 
    78 |
    79 | $html = file_get_html(...); 
    80 | // do something... 
    81 | $html->clear(); 
    82 | unset($html);
    83 |
    84 | Author: S.C. Chen (me578022@gmail.com)
    85 | Original idea is from Jose Solorzano's HTML Parser for PHP 4.
    86 | Contributions by: Yousuke Kumakura, Vadim Voituk, Antcs
    87 |
    88 |
    89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /testcase/strip_testcase.php: -------------------------------------------------------------------------------- 1 | 13 | 16 | 17 | HTML; 18 | $dom->load($str); 19 | assert(count($dom->find('input'))==0); 20 | 21 | // ----------------------------------------------------------------------------- 22 | // test 23 | $str = << 25 | 26 | 27 | 28 | 29 | HTML; 30 | $dom->load($str); 31 | assert(count($dom->find('code'))==1); 32 | assert(count($dom->find('input'))==0); 33 | 34 | // ----------------------------------------------------------------------------- 35 | //
     &  test
     36 | $str = <<
     38 |     
     39 | 
    40 | HTML; 41 | $dom->load($str); 42 | assert(count($dom->find('pre'))==1); 43 | assert(count($dom->find('input'))==0); 44 | 45 | // ----------------------------------------------------------------------------- 46 | // 49 | 58 | HTML; 59 | $dom->load($str); 60 | assert(count($dom->find('style'))==1); 61 | assert(count($dom->find('script'))==3); 62 | 63 | // ----------------------------------------------------------------------------- 64 | // php short tag test 65 | $str = <<hello 67 | 68 | HTML; 69 | $dom->load($str); 70 | assert($dom->find('a', 0)->href===""); 71 | assert($dom->find('input', 0)->value===""); 72 | 73 | // ----------------------------------------------------------------------------- 74 | // noise stripping test 75 | $str = <<--> 78 | 79 | 81 | HTML; 82 | $dom->load($str); 83 | assert(count($dom->find('img'))==1); 84 | assert($dom==$str); 85 | // ----------------------------------------------- 86 | $str = <<ss 88 | 102 | 103 | 106 | 107 | 112 | 113 | 114 | 115 | 120 | 121 | 122 | 123 | 126 | HTML; 127 | $dom->load($str); 128 | assert(count($dom->find('script'))==8); 129 | assert(count($dom->find('style'))==3); 130 | //echo "\n\n\n\n".$dom->save(); 131 | assert($dom==$str); 132 | 133 | // ----------------------------------------------------------------------------- 134 | // tear down 135 | $dom->clear(); 136 | unset($dom); 137 | ?> -------------------------------------------------------------------------------- /change_log.txt: -------------------------------------------------------------------------------- 1 | #$Rev: 194 $ 2 | [Updates - add some ability to insert and create nodes.] 3 | [1: add ability to search the "noise" array] 4 | 5 | [PHP Simple HTML Dom version 1.5 released.] 6 | 1: Memory leak fixed! 7 | 2: Added support for detecting the source html character set. This is used to convert characters when plaintext is requested. 8 | 3: Other little fixes and features, too numerous to categorize. 9 | 10 | [On going] 11 | 1. Error of "file_get_contents()" will be thrown as an exception. 12 | 2. Add flag: LOCK_EX while calling "file_put_contents()". 13 | 3. Fix the typo of "token_blank_t". 14 | 15 | 16 | [PHP Simple HTML DOM Parser v1.11 is released] 17 | 1. Supports xpath generated from Firebug. 18 | 2. New method "dump" of "simple_html_dom_node". 19 | 3. New attribute "xmltext" of "simple_html_dom_node". 20 | 4. remove preg_quote on selector match function: [attribute*=value]; 21 | 5. Element "Comment" will treat as children. 22 | 6. Fixed the problem with
    .
     23 | 7. Fixed bug #2207477 (does not load some pages properly).
     24 | 8. Fixed bug #2315853 (Error with character after < sign).
     25 | 
     26 | 
     27 | [PHP Simple HTML DOM Parser v1.10 is released]
     28 | 1. Negative indexes supports of "find" method, thanks for Vadim Voituk.
     29 | 2. Constructor with automatically load contents either text or file/url, thanks for Antcs.
     30 | 3. Fully supports wildcard in selectors.
     31 | 4. Fixed bug of confusing by the < symbol inside the text.
     32 | 5. Fixed bug of dash in selectors.
     33 | 6. Fixed bug of .
     34 | 7. Fixed bug #2155883 (Nested List Parses Incorrectly).
     35 | 8. Fixed bug #2155113 (error with unclosed html tags).
     36 | 
     37 | 
     38 | [PHP Simple HTML DOM Parser v1.00 is released]
     39 | 1. New method "getAllAttributes" of "simple_html_dom_node".
     40 | 2. Fix the bug of selector in some critical conditions.
     41 | 3. Fix the bug of striping php tags.
     42 | 4. Fix the bug of remove_noise().
     43 | 5. Fix the bug of noise in attributes.
     44 | 6. Supports full javascript string in selector: $e->find("a[onclick=alert('hello')]").
     45 | 7. Change selector "*=" to case-insentive.
     46 | 
     47 | 
     48 | [PHP Simple HTML DOM Parser v0.99 is released]
     49 | 1. Performance turning (boost 10%).
     50 | 2. Memory requirement reduce 25%.
     51 | 3. Change function name from "file_get_dom()" to "file_get_html()".
     52 | 4. Change function name from "str_get_dom()" to "str_get_html()".
     53 | 5. Fixed bug #2011286 (Error with unclosed html tags).
     54 | 6. Fixed bug #2012551 (Error parsing divs).
     55 | 7. Fixed bug #2020924 (Error for missed tag.).
     56 | 8. Fixed bug (problem with  tag's innertext).
     57 | 
     58 | 
     59 | [PHP Simple HTML DOM Parser v0.98 is released]
     60 | 1. Performance turning (boost 20%).
     61 | 2. Supports "multiple class" selector feature: 
    . 62 | 3. New "callback function" feature. 63 | 4. New "multiple selectors" feature: $dom->find('p,a,b'); 64 | 5. New examples. 65 | 6. Supports extract contents from HTML features: $dom->plaintext; 66 | 7. Fix the bug of $dom->clear(). 67 | 8. Fix the bug of text nodes' innertext. 68 | 9. Fix the bug of comment nodes' innertext. 69 | 10. Fix the bug of decendent selector with optional tags. 70 | 11. Change simple_html_dom_node method name from "text()" to "makeup()". 71 | 72 | 73 | [PHP Simple HTML DOM Parser v0.97 is released] 74 | 1. Important!! file and class name changed (html_dom_parser->simple_html_dom)! 75 | 2. Important!! ($dom->save_file) will not support anymore. 76 | 3. New node type "comment" (eg. $dom->find('comment')). 77 | 4. Add self-closing tags: 'base', 'spacer'. 78 | 5. Fix the bug of outertext (th). 79 | 6. Fix the bug of regular expression escaping chars ($dom->find). 80 | 7. Fix the bug while line-breaker and "\t" in tags. 81 | 8. Remove example "example_customize_parser.php". 82 | 9. New example "simple_html_dom_utility.php". 83 | 84 | 85 | [PHP Simple HTML DOM Parser v0.96 is released] 86 | 1. (Request #1936000) New DOM operations(first_child, last_child, next_sibling, previous_sibling). 87 | 2. New method to remove attribute. 88 | 3. Add the solution while server behind proxy in FAQ (Thanks to Yousuke Shaggy). 89 | 4. Add traverse section in manual. 90 | 5. Now file_get_dom supports full file_get_contents parameters. 91 | 6. Fix the bug of self-closing tags in the end of file. 92 | 7. Fix the bug of blanks in the end of tag. 93 | 8. Add Reference section in manual. 94 | #. Fix some typo of testcase. 95 | 96 | 97 | [PHP Simple HTML DOM Parser v0.95 is released] 98 | 1. New attribute filters (Thanks to Yousuke Kumakura). 99 | 2. Fix the bug of optional-closing tags. 100 | 3. Fix the bug of parsing the line break next to the tag's name. 101 | 4. Supports tag name with namespace. 102 | #. Refine structure of testcase. 103 | 104 | 105 | [PHP Simple HTML DOM Parser v0.94 is released] 106 | 1. Stop infinity loop while tthe source content is BAD HTML. 107 | 2. Fix the bug of adding new attributes to self closing tags. 108 | 3. Fix the bug of customize parser without $dom->remove_noise(); 109 | 4. Add FAQ section in manual. -------------------------------------------------------------------------------- /testcase/.svn/text-base/strip_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | 13 | 16 | 17 | HTML; 18 | $dom->load($str); 19 | assert(count($dom->find('input'))==0); 20 | 21 | // ----------------------------------------------------------------------------- 22 | // test 23 | $str = << 25 | 26 | 27 | 28 | 29 | HTML; 30 | $dom->load($str); 31 | assert(count($dom->find('code'))==1); 32 | assert(count($dom->find('input'))==0); 33 | 34 | // ----------------------------------------------------------------------------- 35 | //
     &  test
     36 | $str = <<
     38 |     
     39 | 
    40 | HTML; 41 | $dom->load($str); 42 | assert(count($dom->find('pre'))==1); 43 | assert(count($dom->find('input'))==0); 44 | 45 | // ----------------------------------------------------------------------------- 46 | // 49 | 58 | HTML; 59 | $dom->load($str); 60 | assert(count($dom->find('style'))==1); 61 | assert(count($dom->find('script'))==3); 62 | 63 | // ----------------------------------------------------------------------------- 64 | // php short tag test 65 | $str = <<hello 67 | 68 | HTML; 69 | $dom->load($str); 70 | assert($dom->find('a', 0)->href===""); 71 | assert($dom->find('input', 0)->value===""); 72 | 73 | // ----------------------------------------------------------------------------- 74 | // noise stripping test 75 | $str = <<--> 78 | 79 | 81 | HTML; 82 | $dom->load($str); 83 | assert(count($dom->find('img'))==1); 84 | assert($dom==$str); 85 | // ----------------------------------------------- 86 | $str = <<ss 88 | 102 | 103 | 106 | 107 | 112 | 113 | 114 | 115 | 120 | 121 | 122 | 123 | 126 | HTML; 127 | $dom->load($str); 128 | assert(count($dom->find('script'))==8); 129 | assert(count($dom->find('style'))==3); 130 | //echo "\n\n\n\n".$dom->save(); 131 | assert($dom==$str); 132 | 133 | // ----------------------------------------------------------------------------- 134 | // tear down 135 | $dom->clear(); 136 | unset($dom); 137 | ?> -------------------------------------------------------------------------------- /app/index.php: -------------------------------------------------------------------------------- 1 | find('html', 0); 12 | if ($l!==null) 13 | $lang = $l->lang; 14 | if ($lang!='') 15 | $lang = 'lang="'.$lang.'"'; 16 | 17 | $charset = $html->find('meta[http-equiv*=content-type]', 0); 18 | $target = array(); 19 | $query = ''; 20 | 21 | if (isset($_REQUEST['query'])) { 22 | $query = $_REQUEST['query']; 23 | $target = $html->find($query); 24 | } 25 | 26 | function stat_dom($dom) { 27 | $count_text = 0; 28 | $count_comm = 0; 29 | $count_elem = 0; 30 | $count_tag_end = 0; 31 | $count_unknown = 0; 32 | 33 | foreach($dom->nodes as $n) { 34 | if ($n->nodetype==HDOM_TYPE_TEXT) 35 | ++$count_text; 36 | if ($n->nodetype==HDOM_TYPE_COMMENT) 37 | ++$count_comm; 38 | if ($n->nodetype==HDOM_TYPE_ELEMENT) 39 | ++$count_elem; 40 | if ($n->nodetype==HDOM_TYPE_ENDTAG) 41 | ++$count_tag_end; 42 | if ($n->nodetype==HDOM_TYPE_UNKNOWN) 43 | ++$count_unknown; 44 | } 45 | 46 | echo 'Total: '. count($dom->nodes). 47 | ', Text: '.$count_text. 48 | ', Commnet: '.$count_comm. 49 | ', Tag: '.$count_elem. 50 | ', End Tag: '.$count_tag_end. 51 | ', Unknown: '.$count_unknown; 52 | } 53 | 54 | function dump_my_html_tree($node, $show_attr=true, $deep=0, $last=true) { 55 | $count = count($node->nodes); 56 | if ($count>0) { 57 | if($last) 58 | echo '\n"; 90 | } 91 | ?> 92 | 93 | 94 | > 95 | 96 | '; 99 | else if ($charset) 100 | echo $charset; 101 | else 102 | echo ''; 103 | ?> 104 | Simple HTML DOM Query Test 105 | 106 | 107 | 111 | 112 | 113 | 122 | 123 | 124 |
    125 |

    Simple HTML DOM Test

    126 |
    127 | find: 128 | 129 |
    130 |
    131 | HTML STAT ()
    132 |
    133 |
    134 |
      135 | 141 |
    142 |
    143 | 144 | -------------------------------------------------------------------------------- /app/.svn/text-base/index.php.svn-base: -------------------------------------------------------------------------------- 1 | find('html', 0); 12 | if ($l!==null) 13 | $lang = $l->lang; 14 | if ($lang!='') 15 | $lang = 'lang="'.$lang.'"'; 16 | 17 | $charset = $html->find('meta[http-equiv*=content-type]', 0); 18 | $target = array(); 19 | $query = ''; 20 | 21 | if (isset($_REQUEST['query'])) { 22 | $query = $_REQUEST['query']; 23 | $target = $html->find($query); 24 | } 25 | 26 | function stat_dom($dom) { 27 | $count_text = 0; 28 | $count_comm = 0; 29 | $count_elem = 0; 30 | $count_tag_end = 0; 31 | $count_unknown = 0; 32 | 33 | foreach($dom->nodes as $n) { 34 | if ($n->nodetype==HDOM_TYPE_TEXT) 35 | ++$count_text; 36 | if ($n->nodetype==HDOM_TYPE_COMMENT) 37 | ++$count_comm; 38 | if ($n->nodetype==HDOM_TYPE_ELEMENT) 39 | ++$count_elem; 40 | if ($n->nodetype==HDOM_TYPE_ENDTAG) 41 | ++$count_tag_end; 42 | if ($n->nodetype==HDOM_TYPE_UNKNOWN) 43 | ++$count_unknown; 44 | } 45 | 46 | echo 'Total: '. count($dom->nodes). 47 | ', Text: '.$count_text. 48 | ', Commnet: '.$count_comm. 49 | ', Tag: '.$count_elem. 50 | ', End Tag: '.$count_tag_end. 51 | ', Unknown: '.$count_unknown; 52 | } 53 | 54 | function dump_my_html_tree($node, $show_attr=true, $deep=0, $last=true) { 55 | $count = count($node->nodes); 56 | if ($count>0) { 57 | if($last) 58 | echo '\n"; 90 | } 91 | ?> 92 | 93 | 94 | > 95 | 96 | '; 99 | else if ($charset) 100 | echo $charset; 101 | else 102 | echo ''; 103 | ?> 104 | Simple HTML DOM Query Test 105 | 106 | 107 | 111 | 112 | 113 | 122 | 123 | 124 |
    125 |

    Simple HTML DOM Test

    126 |
    127 | find: 128 | 129 |
    130 |
    131 | HTML STAT ()
    132 |
    133 |
    134 |
      135 | 141 |
    142 |
    143 | 144 | -------------------------------------------------------------------------------- /testcase/memory_test.php: -------------------------------------------------------------------------------- 1 | "; 12 | } 13 | 14 | // ----------------------------------------------------------------------------- 15 | $filename = './html/google.htm'; 16 | //$filename = 'test.htm'; 17 | 18 | // ----------------------------------------------------------------------------- 19 | // test_load_file_memory 20 | function test_load_file_memory($filename, $init_size) { 21 | echo '[load file] init memory: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 22 | echo '--------------------------------------------------------------------
    '; 23 | flush(); 24 | for($i=0; $i<3; ++$i) { 25 | $str = file_get_contents($filename); 26 | 27 | dump_memory($init_size); 28 | unset($str); 29 | } 30 | echo 'after loop: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 31 | echo '--------------------------------------------------------------------
    '; 32 | flush(); 33 | } 34 | 35 | // ----------------------------------------------------------------------------- 36 | // test_multi_objects_str_get_html 37 | function test_multi_str_get_html($filename, $init_size) { 38 | global $__g_node_mgr; 39 | 40 | $str = file_get_contents($filename); 41 | echo '[str_get_html] init memory: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 42 | echo '--------------------------------------------------------------------
    '; 43 | flush(); 44 | for($i=0; $i<3; ++$i) { 45 | $html = str_get_html($str); 46 | dump_memory($init_size); 47 | flush(); 48 | } 49 | echo 'after loop: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 50 | echo '--------------------------------------------------------------------
    '; 51 | flush(); 52 | unset($str); 53 | } 54 | 55 | // ----------------------------------------------------------------------------- 56 | // test_multi_file_get_html 57 | function test_multi_file_get_html($filename, $init_size) { 58 | echo '[file_get_html] init memory: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 59 | echo '--------------------------------------------------------------------
    '; 60 | flush(); 61 | for($i=0; $i<3; ++$i) { 62 | $html = file_get_html($filename); 63 | //$html->clear(); 64 | unset($html); 65 | dump_memory($init_size); 66 | flush(); 67 | } 68 | echo 'after loop: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 69 | echo '--------------------------------------------------------------------
    '; 70 | flush(); 71 | } 72 | /* 73 | // ----------------------------------------------------------------------------- 74 | // test_multi_objects_clear_memory 75 | function test_multi_objects_file_get_html_clear_memory($filename) { 76 | echo '

    [one object]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 77 | echo '------------------------------------------
    '; 78 | flush(); 79 | $html = new simple_html_dom; 80 | for($i=0; $i<3; ++$i) { 81 | $html->load_file($filename); 82 | $html->clear(); 83 | dump_memory(); 84 | } 85 | unset($dom); 86 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 87 | flush(); 88 | 89 | 90 | echo '

    [multi objects without clear memory]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 91 | echo '------------------------------------------
    '; 92 | flush(); 93 | for($i=0; $i<3; ++$i) { 94 | $html = file_get_html($filename); 95 | dump_memory(); 96 | } 97 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 98 | flush(); 99 | */ 100 | 101 | // ----------------------------------------------------------------------------- 102 | // begin test 103 | $init_size = number_format(memory_get_usage(), 0, '.', ','); 104 | echo 'init ' . $init_size . " bytes
    "; 105 | flush(); 106 | 107 | echo '
    before function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 108 | test_load_file_memory($filename, $init_size); 109 | echo 'after function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'

    '; 110 | flush(); 111 | 112 | echo '
    before function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 113 | test_multi_file_get_html($filename, $init_size); 114 | echo 'after function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'

    '; 115 | flush(); 116 | 117 | echo '
    before function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 118 | test_multi_file_get_html($filename, $init_size); 119 | echo 'after function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'

    '; 120 | flush(); 121 | ?> -------------------------------------------------------------------------------- /testcase/.svn/text-base/memory_test.php.svn-base: -------------------------------------------------------------------------------- 1 | "; 12 | } 13 | 14 | // ----------------------------------------------------------------------------- 15 | $filename = './html/google.htm'; 16 | //$filename = 'test.htm'; 17 | 18 | // ----------------------------------------------------------------------------- 19 | // test_load_file_memory 20 | function test_load_file_memory($filename, $init_size) { 21 | echo '[load file] init memory: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 22 | echo '--------------------------------------------------------------------
    '; 23 | flush(); 24 | for($i=0; $i<3; ++$i) { 25 | $str = file_get_contents($filename); 26 | 27 | dump_memory($init_size); 28 | unset($str); 29 | } 30 | echo 'after loop: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 31 | echo '--------------------------------------------------------------------
    '; 32 | flush(); 33 | } 34 | 35 | // ----------------------------------------------------------------------------- 36 | // test_multi_objects_str_get_html 37 | function test_multi_str_get_html($filename, $init_size) { 38 | global $__g_node_mgr; 39 | 40 | $str = file_get_contents($filename); 41 | echo '[str_get_html] init memory: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 42 | echo '--------------------------------------------------------------------
    '; 43 | flush(); 44 | for($i=0; $i<3; ++$i) { 45 | $html = str_get_html($str); 46 | dump_memory($init_size); 47 | flush(); 48 | } 49 | echo 'after loop: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 50 | echo '--------------------------------------------------------------------
    '; 51 | flush(); 52 | unset($str); 53 | } 54 | 55 | // ----------------------------------------------------------------------------- 56 | // test_multi_file_get_html 57 | function test_multi_file_get_html($filename, $init_size) { 58 | echo '[file_get_html] init memory: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 59 | echo '--------------------------------------------------------------------
    '; 60 | flush(); 61 | for($i=0; $i<3; ++$i) { 62 | $html = file_get_html($filename); 63 | //$html->clear(); 64 | unset($html); 65 | dump_memory($init_size); 66 | flush(); 67 | } 68 | echo 'after loop: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 69 | echo '--------------------------------------------------------------------
    '; 70 | flush(); 71 | } 72 | /* 73 | // ----------------------------------------------------------------------------- 74 | // test_multi_objects_clear_memory 75 | function test_multi_objects_file_get_html_clear_memory($filename) { 76 | echo '

    [one object]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 77 | echo '------------------------------------------
    '; 78 | flush(); 79 | $html = new simple_html_dom; 80 | for($i=0; $i<3; ++$i) { 81 | $html->load_file($filename); 82 | $html->clear(); 83 | dump_memory(); 84 | } 85 | unset($dom); 86 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 87 | flush(); 88 | 89 | 90 | echo '

    [multi objects without clear memory]
    init memory: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 91 | echo '------------------------------------------
    '; 92 | flush(); 93 | for($i=0; $i<3; ++$i) { 94 | $html = file_get_html($filename); 95 | dump_memory(); 96 | } 97 | echo 'final: '.number_format(memory_get_usage(), 0, '.', ',').'
    '; 98 | flush(); 99 | */ 100 | 101 | // ----------------------------------------------------------------------------- 102 | // begin test 103 | $init_size = number_format(memory_get_usage(), 0, '.', ','); 104 | echo 'init ' . $init_size . " bytes
    "; 105 | flush(); 106 | 107 | echo '
    before function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 108 | test_load_file_memory($filename, $init_size); 109 | echo 'after function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'

    '; 110 | flush(); 111 | 112 | echo '
    before function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 113 | test_multi_file_get_html($filename, $init_size); 114 | echo 'after function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'

    '; 115 | flush(); 116 | 117 | echo '
    before function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'
    '; 118 | test_multi_file_get_html($filename, $init_size); 119 | echo 'after function: '.number_format(memory_get_usage()/1024, 0, '.', ',').'

    '; 120 | flush(); 121 | ?> -------------------------------------------------------------------------------- /testcase/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 182 5 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom/trunk/testcase 6 | https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom 7 | 8 | 9 | 10 | 2009-03-22T19:24:59.344030Z 11 | 180 12 | me578022 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | d0e60b4b-9046-0410-940c-b97530268c78 28 | 29 | strip_testcase.php 30 | file 31 | 32 | 33 | 34 | 35 | 2010-08-17T19:13:53.350286Z 36 | 312053ebe417d8bd82901a3788ace7cb 37 | 2008-10-29T19:08:25.076520Z 38 | 169 39 | me578022 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 4448 62 | 63 | performance_test.php 64 | file 65 | 66 | 67 | 68 | 69 | 2010-08-17T19:13:53.357286Z 70 | 178c0c89624f4341b732545414590ff2 71 | 2008-07-25T12:31:14.828880Z 72 | 133 73 | me578022 74 | has-props 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 792 96 | 97 | mass_test.php 98 | file 99 | 100 | 101 | 102 | 103 | 2010-08-17T19:13:53.363286Z 104 | b2a94f2744f4fcb902e2f238456b3872 105 | 2008-12-11T19:19:39.653903Z 106 | 174 107 | me578022 108 | has-props 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 3048 130 | 131 | slick_test.php 132 | file 133 | 134 | 135 | 136 | 137 | 2010-08-17T19:13:53.370287Z 138 | b99dbf87b8b80c80d9f6958772a9bd2a 139 | 2008-07-25T12:31:14.828880Z 140 | 133 141 | me578022 142 | has-props 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 892 164 | 165 | memory_test.php 166 | file 167 | 168 | 169 | 170 | 171 | 2010-08-17T19:13:53.383288Z 172 | 876e9e34007c44ae588488de78fbe695 173 | 2009-02-23T09:04:02.699587Z 174 | 179 175 | me578022 176 | has-props 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 4719 198 | 199 | all_test.php 200 | file 201 | 202 | 203 | 204 | 205 | 2010-08-17T19:13:53.376287Z 206 | eda1dbfb14f36ae447c9e23d41870036 207 | 2008-12-14T18:56:55.570844Z 208 | 175 209 | me578022 210 | has-props 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 745 232 | 233 | dom_testcase.php 234 | file 235 | 236 | 237 | 238 | 239 | 2010-08-17T19:13:53.389288Z 240 | d94c6f883d8f55e3009a3118886ba47c 241 | 2009-03-22T19:24:59.344030Z 242 | 180 243 | me578022 244 | has-props 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 11672 266 | 267 | selector_testcase.php 268 | file 269 | 270 | 271 | 272 | 273 | 2010-08-17T19:13:53.395288Z 274 | 46a462975187f4b8804fb3162486c72d 275 | 2008-11-16T20:10:05.337885Z 276 | 172 277 | me578022 278 | has-props 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 21839 300 | 301 | reader 302 | dir 303 | 304 | html 305 | dir 306 | 307 | jquery-1.2.3.pack.js 308 | file 309 | 310 | 311 | 312 | 313 | 2010-08-17T19:13:53.402289Z 314 | f8d6a95d012b83675abe8cd1877268a0 315 | 2008-06-04T18:34:08.672146Z 316 | 106 317 | me578022 318 | has-props 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 29845 340 | 341 | invalid_testcase.php 342 | file 343 | 344 | 345 | 346 | 347 | 2010-08-17T19:13:53.409289Z 348 | 674d63800eeec61271d1bed2083f9306 349 | 2008-12-14T18:56:55.570844Z 350 | 175 351 | me578022 352 | has-props 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 18691 374 | 375 | element_testcase.php 376 | file 377 | 378 | 379 | 380 | 381 | 2010-08-17T19:13:53.415289Z 382 | 7a1e804c7f08595ad56252a26431e2f8 383 | 2008-07-24T13:55:24.521644Z 384 | 132 385 | me578022 386 | has-props 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 8412 408 | 409 | std_testcase.php 410 | file 411 | 412 | 413 | 414 | 415 | 2010-08-17T19:13:53.421290Z 416 | 7941d3823eb3a787633d672eddfa4c98 417 | 2008-06-24T00:55:28.257869Z 418 | 115 419 | me578022 420 | has-props 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 6829 442 | 443 | misc_testcase.php 444 | file 445 | 446 | 447 | 448 | 449 | 2010-08-17T19:13:53.427290Z 450 | 5072ff70e3cce8771b62b319e1be4df0 451 | 2008-07-25T12:31:14.828880Z 452 | 133 453 | me578022 454 | has-props 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 1854 476 | 477 | slickspeed.htm 478 | file 479 | 480 | 481 | 482 | 483 | 2010-08-17T19:13:53.434290Z 484 | 01b4dd6f53b2b9970492704c42901b32 485 | 2008-06-04T18:34:08.672146Z 486 | 106 487 | me578022 488 | has-props 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 116621 510 | 511 | callback_testcase.php 512 | file 513 | 514 | 515 | 516 | 517 | 2010-08-17T19:13:53.441291Z 518 | c026b8c379d20ec4999bd0dcd6550a6f 519 | 2009-02-23T09:04:02.699587Z 520 | 179 521 | me578022 522 | has-props 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 1845 544 | 545 | -------------------------------------------------------------------------------- /manual/js/ui.tabs.pack.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Tabs 3 - New Wave Tabs 3 | * 4 | * Copyright (c) 2007 Klaus Hartl (stilbuero.de) 5 | * Dual licensed under the MIT (MIT-LICENSE.txt) 6 | * and GPL (GPL-LICENSE.txt) licenses. 7 | * 8 | * http://docs.jquery.com/UI/Tabs 9 | */ 10 | eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.4=$.4||{};$.2o.3=6(){7 b=1K 1q[0]==\'1X\'&&1q[0];7 c=b&&1P.1N.2g.2c(1q,1)||1q;l b==\'C\'?$.m(2[0],\'4-3\').$3.C:2.I(6(){5(b){7 a=$.m(2,\'4-3\');a[b].2n(a,c)}D 2l $.4.3(2,c[0]||{})})};$.4.3=6(e,f){7 d=2;2.q=e;2.8=$.1H({p:0,S:f.p===L,12:\'1A\',t:[],G:L,1l:\'2Bx;\',K:y,1R:\'4-3-\',1j:{},X:L,1Q:\'<1h>#{1g}\',1v:\'<1L>\',1f:\'4-3-2f\',w:\'4-3-p\',1t:\'4-3-S\',Q:\'4-3-t\',U:\'4-3-1e\',M:\'4-3-Y\',1s:\'4-3-2Y\'},f);5(f.p===L)2.8.p=L;2.8.12+=\'.4-3\';2.8.G=$.G&&$.G.28==2V&&2.8.G;$(e).1b(\'2T.4-3\',6(b,c,a){5((/^p/).27(c))d.1o(a);D{d.8[c]=a;d.11()}}).1b(\'2Q.4-3\',6(a,b){l d.8[b]});$.m(e,\'4-3\',2);2.11(1a)};$.1H($.4.3.1N,{1z:6(a){l a.22&&a.22.V(/\\s/g,\'1Z\').V(/[^A-2A-2y-9\\-1Z:\\.]/g,\'\')||2.8.1R+$.m(a)},4:6(a,b){l{2w:2,8:2.8,2v:a,1e:b}},11:6(f){2.$u=$(\'E:2s(a[x])\',2.q);2.$3=2.$u.1i(6(){l $(\'a\',2)[0]});2.$k=$([]);7 e=2,o=2.8;2.$3.I(6(i,a){5(a.H&&a.H.V(\'#\',\'\'))e.$k=e.$k.17(a.H);D 5($(a).W(\'x\')!=\'#\'){$.m(a,\'x.4-3\',a.x);$.m(a,\'z.4-3\',a.x);7 b=e.1z(a);a.x=\'#\'+b;7 c=$(\'#\'+b);5(!c.C){c=$(o.1v).W(\'16\',b).v(o.U).2m(e.$k[i-1]||e.q);c.m(\'15.4-3\',1a)}e.$k=e.$k.17(c)}D o.t.1O(i+1)});5(f){$(2.q).J(o.1f)||$(2.q).v(o.1f);2.$k.I(6(){7 a=$(2);a.J(o.U)||a.v(o.U)});2.$3.I(6(i,a){5(1w.H){5(a.H==1w.H){o.p=i;5($.O.14||$.O.2k){7 b=$(1w.H),1M=b.W(\'16\');b.W(\'16\',\'\');1u(6(){b.W(\'16\',1M)},2j)}2i(0,0);l y}}D 5(o.G){7 c=2h($.G(\'4-3\'+$.m(e.q)),10);5(c&&e.$3[c]){o.p=c;l y}}D 5(e.$u.F(i).J(o.w)){o.p=i;l y}});2.$k.v(o.M);2.$u.B(o.w);5(!o.S){2.$k.F(o.p).N().B(o.M);2.$u.F(o.p).v(o.w)}7 h=!o.S&&$.m(2.$3[o.p],\'z.4-3\');5(h)2.z(o.p);o.t=$.2e(o.t.2d($.1i(2.$u.T(\'.\'+o.Q),6(n,i){l e.$u.Z(n)}))).1J();$(2b).1b(\'2a\',6(){e.$3.1d(\'.4-3\');e.$u=e.$3=e.$k=L})}29(7 i=0,E;E=2.$u[i];i++)$(E)[$.1I(i,o.t)!=-1&&!$(E).J(o.w)?\'v\':\'B\'](o.Q);5(o.K===y)2.$3.1r(\'K.4-3\');7 j,R,1c={\'2X-2W\':0,1G:1},1F=\'2U\';5(o.X&&o.X.28==1P)j=o.X[0]||1c,R=o.X[1]||1c;D j=R=o.X||1c;7 g={1p:\'\',2S:\'\',2R:\'\'};5(!$.O.14)g.1E=\'\';6 1D(b,c,a){c.26(j,j.1G||1F,6(){c.v(o.M).13(g);5($.O.14&&j.1E)c[0].24.T=\'\';5(a)1C(b,a,c)})}6 1C(b,a,c){5(R===1c)a.13(\'1p\',\'1B\');a.26(R,R.1G||1F,6(){a.B(o.M).13(g);5($.O.14&&R.1E)a[0].24.T=\'\';$(e.q).P(\'N.4-3\',[e.4(b,a[0])])})}6 23(c,a,d,b){a.v(o.w).2P().B(o.w);1D(c,d,b)}2.$3.1d(\'.4-3\').1b(o.12,6(){7 b=$(2).2O(\'E:F(0)\'),$Y=e.$k.T(\':2N\'),$N=$(2.H);5((b.J(o.w)&&!o.S)||b.J(o.Q)||$(e.q).P(\'1o.4-3\',[e.4(2,$N[0])])===y){2.1k();l y}e.8.p=e.$3.Z(2);5(o.S){5(b.J(o.w)){e.8.p=L;b.B(o.w);e.$k.1y();1D(2,$Y);2.1k();l y}D 5(!$Y.C){e.$k.1y();7 a=2;e.z(e.$3.Z(2),6(){b.v(o.w).v(o.1t);1C(a,$N)});2.1k();l y}}5(o.G)$.G(\'4-3\'+$.m(e.q),e.8.p,o.G);e.$k.1y();5($N.C){7 a=2;e.z(e.$3.Z(2),6(){23(a,b,$Y,$N)})}D 2M\'21 2K 2J: 2H 2G 2F.\';5($.O.14)2.1k();l y});5(!(/^1A/).27(o.12))2.$3.1b(\'1A.4-3\',6(){l y})},17:6(d,e,f){5(f==1Y)f=2.$3.C;7 o=2.8;7 a=$(o.1Q.V(/#\\{x\\}/,d).V(/#\\{1g\\}/,e));a.m(\'15.4-3\',1a);7 b=d.2D(\'#\')==0?d.V(\'#\',\'\'):2.1z($(\'a:2C-2z\',a)[0]);7 c=$(\'#\'+b);5(!c.C){c=$(o.1v).W(\'16\',b).v(o.U).v(o.M);c.m(\'15.4-3\',1a)}5(f>=2.$u.C){a.1W(2.q);c.1W(2.q.2E)}D{a.1V(2.$u[f]);c.1V(2.$k[f])}o.t=$.1i(o.t,6(n,i){l n>=f?++n:n});2.11();5(2.$3.C==1){a.v(o.w);c.B(o.M);7 g=$.m(2.$3[0],\'z.4-3\');5(g)2.z(f,g)}$(2.q).P(\'17.4-3\',[2.4(2.$3[f],2.$k[f])])},19:6(a){7 o=2.8,$E=2.$u.F(a).19(),$1e=2.$k.F(a).19();5($E.J(o.w)&&2.$3.C>1)2.1o(a+(a+1<2.$3.C?1:-1));o.t=$.1i($.1U(o.t,6(n,i){l n!=a}),6(n,i){l n>=a?--n:n});2.11();$(2.q).P(\'19.4-3\',[2.4($E.2I(\'a\')[0],$1e[0])])},25:6(a){7 o=2.8;5($.1I(a,o.t)==-1)l;7 b=2.$u.F(a).B(o.Q);5($.O.2u){b.13(\'1p\',\'2L-1B\');1u(6(){b.13(\'1p\',\'1B\')},0)}o.t=$.1U(o.t,6(n,i){l n!=a});$(2.q).P(\'25.4-3\',[2.4(2.$3[a],2.$k[a])])},20:6(a){7 b=2,o=2.8;5(a!=o.p){2.$u.F(a).v(o.Q);o.t.1O(a);o.t.1J();$(2.q).P(\'20.4-3\',[2.4(2.$3[a],2.$k[a])])}},1o:6(a){5(1K a==\'1X\')a=2.$3.Z(2.$3.T(\'[x$=\'+a+\']\')[0]);2.$3.F(a).2t(2.8.12)},z:6(d,b){7 e=2,o=2.8,$a=2.$3.F(d),a=$a[0],1T=b==1Y|| b===y,18=$a.m(\'z.4-3\');b=b|| 6(){};5(!18|| ($.m(a,\'K.4-3\')&&!1T)){b();l}5(o.1l){7 g=$(\'1h\',a),1g=g.1n();g.1n(\'<1S>\'+o.1l+\'\')}7 c=6(){e.$3.T(\'.\'+o.1s).I(6(){$(2).B(o.1s);5(o.1l)$(\'1h\',2).1n(1g)});e.1m=L};7 f=$.1H({},o.1j,{18:18,1x:6(r,s){$(a.H).1n(r);c();b();5(o.K)$.m(a,\'K.4-3\',1a);$(e.q).P(\'z.4-3\',[e.4(e.$3[d],e.$k[d])]);o.1j.1x&&o.1j.1x(r,s)}});5(2.1m){2.1m.2r();c()}$a.v(o.1s);1u(6(){e.1m=$.2q(f)},0)},18:6(a,b){2.$3.F(a).1r(\'K.4-3\').m(\'z.4-3\',b)},15:6(){7 o=2.8;$(2.q).1d(\'.4-3\').B(o.1f).1r(\'4-3\');2.$3.I(6(){7 b=$.m(2,\'x.4-3\');5(b)2.x=b;7 c=$(2).1d(\'.4-3\');$.I([\'x\',\'z\',\'K\'],6(i,a){c.1r(a+\'.4-3\')})});2.$u.17(2.$k).I(6(){5($.m(2,\'15.4-3\'))$(2).19();D $(2).B([o.w,o.1t,o.Q,o.U,o.M].2p(\' \'))})}})})(21);',62,185,'||this|tabs|ui|if|function|var|options||||||||||||panels|return|data|||selected|element|||disabled|lis|addClass|selectedClass|href|false|load||removeClass|length|else|li|eq|cookie|hash|each|hasClass|cache|null|hideClass|show|browser|triggerHandler|disabledClass|showFx|unselect|filter|panelClass|replace|attr|fx|hide|index||tabify|event|css|msie|destroy|id|add|url|remove|true|bind|baseFx|unbind|panel|navClass|label|span|map|ajaxOptions|blur|spinner|xhr|html|select|display|arguments|removeData|loadingClass|unselectClass|setTimeout|panelTemplate|location|success|stop|tabId|click|block|showTab|hideTab|opacity|baseDuration|duration|extend|inArray|sort|typeof|div|toShowId|prototype|push|Array|tabTemplate|idPrefix|em|bypassCache|grep|insertBefore|appendTo|string|undefined|_|disable|jQuery|title|switchTab|style|enable|animate|test|constructor|for|unload|window|call|concat|unique|nav|slice|parseInt|scrollTo|500|opera|new|insertAfter|apply|fn|join|ajax|abort|has|trigger|safari|tab|instance|8230|z0|child|Za|Loading|first|indexOf|parentNode|identifier|fragment|Mismatching|find|Tabs|UI|inline|throw|visible|parents|siblings|getData|height|overflow|setData|normal|Function|width|min|loading'.split('|'),0,{})) -------------------------------------------------------------------------------- /manual/js/.svn/text-base/ui.tabs.pack.js.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | * Tabs 3 - New Wave Tabs 3 | * 4 | * Copyright (c) 2007 Klaus Hartl (stilbuero.de) 5 | * Dual licensed under the MIT (MIT-LICENSE.txt) 6 | * and GPL (GPL-LICENSE.txt) licenses. 7 | * 8 | * http://docs.jquery.com/UI/Tabs 9 | */ 10 | eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.4=$.4||{};$.2o.3=6(){7 b=1K 1q[0]==\'1X\'&&1q[0];7 c=b&&1P.1N.2g.2c(1q,1)||1q;l b==\'C\'?$.m(2[0],\'4-3\').$3.C:2.I(6(){5(b){7 a=$.m(2,\'4-3\');a[b].2n(a,c)}D 2l $.4.3(2,c[0]||{})})};$.4.3=6(e,f){7 d=2;2.q=e;2.8=$.1H({p:0,S:f.p===L,12:\'1A\',t:[],G:L,1l:\'2Bx;\',K:y,1R:\'4-3-\',1j:{},X:L,1Q:\'<1h>#{1g}\',1v:\'<1L>\',1f:\'4-3-2f\',w:\'4-3-p\',1t:\'4-3-S\',Q:\'4-3-t\',U:\'4-3-1e\',M:\'4-3-Y\',1s:\'4-3-2Y\'},f);5(f.p===L)2.8.p=L;2.8.12+=\'.4-3\';2.8.G=$.G&&$.G.28==2V&&2.8.G;$(e).1b(\'2T.4-3\',6(b,c,a){5((/^p/).27(c))d.1o(a);D{d.8[c]=a;d.11()}}).1b(\'2Q.4-3\',6(a,b){l d.8[b]});$.m(e,\'4-3\',2);2.11(1a)};$.1H($.4.3.1N,{1z:6(a){l a.22&&a.22.V(/\\s/g,\'1Z\').V(/[^A-2A-2y-9\\-1Z:\\.]/g,\'\')||2.8.1R+$.m(a)},4:6(a,b){l{2w:2,8:2.8,2v:a,1e:b}},11:6(f){2.$u=$(\'E:2s(a[x])\',2.q);2.$3=2.$u.1i(6(){l $(\'a\',2)[0]});2.$k=$([]);7 e=2,o=2.8;2.$3.I(6(i,a){5(a.H&&a.H.V(\'#\',\'\'))e.$k=e.$k.17(a.H);D 5($(a).W(\'x\')!=\'#\'){$.m(a,\'x.4-3\',a.x);$.m(a,\'z.4-3\',a.x);7 b=e.1z(a);a.x=\'#\'+b;7 c=$(\'#\'+b);5(!c.C){c=$(o.1v).W(\'16\',b).v(o.U).2m(e.$k[i-1]||e.q);c.m(\'15.4-3\',1a)}e.$k=e.$k.17(c)}D o.t.1O(i+1)});5(f){$(2.q).J(o.1f)||$(2.q).v(o.1f);2.$k.I(6(){7 a=$(2);a.J(o.U)||a.v(o.U)});2.$3.I(6(i,a){5(1w.H){5(a.H==1w.H){o.p=i;5($.O.14||$.O.2k){7 b=$(1w.H),1M=b.W(\'16\');b.W(\'16\',\'\');1u(6(){b.W(\'16\',1M)},2j)}2i(0,0);l y}}D 5(o.G){7 c=2h($.G(\'4-3\'+$.m(e.q)),10);5(c&&e.$3[c]){o.p=c;l y}}D 5(e.$u.F(i).J(o.w)){o.p=i;l y}});2.$k.v(o.M);2.$u.B(o.w);5(!o.S){2.$k.F(o.p).N().B(o.M);2.$u.F(o.p).v(o.w)}7 h=!o.S&&$.m(2.$3[o.p],\'z.4-3\');5(h)2.z(o.p);o.t=$.2e(o.t.2d($.1i(2.$u.T(\'.\'+o.Q),6(n,i){l e.$u.Z(n)}))).1J();$(2b).1b(\'2a\',6(){e.$3.1d(\'.4-3\');e.$u=e.$3=e.$k=L})}29(7 i=0,E;E=2.$u[i];i++)$(E)[$.1I(i,o.t)!=-1&&!$(E).J(o.w)?\'v\':\'B\'](o.Q);5(o.K===y)2.$3.1r(\'K.4-3\');7 j,R,1c={\'2X-2W\':0,1G:1},1F=\'2U\';5(o.X&&o.X.28==1P)j=o.X[0]||1c,R=o.X[1]||1c;D j=R=o.X||1c;7 g={1p:\'\',2S:\'\',2R:\'\'};5(!$.O.14)g.1E=\'\';6 1D(b,c,a){c.26(j,j.1G||1F,6(){c.v(o.M).13(g);5($.O.14&&j.1E)c[0].24.T=\'\';5(a)1C(b,a,c)})}6 1C(b,a,c){5(R===1c)a.13(\'1p\',\'1B\');a.26(R,R.1G||1F,6(){a.B(o.M).13(g);5($.O.14&&R.1E)a[0].24.T=\'\';$(e.q).P(\'N.4-3\',[e.4(b,a[0])])})}6 23(c,a,d,b){a.v(o.w).2P().B(o.w);1D(c,d,b)}2.$3.1d(\'.4-3\').1b(o.12,6(){7 b=$(2).2O(\'E:F(0)\'),$Y=e.$k.T(\':2N\'),$N=$(2.H);5((b.J(o.w)&&!o.S)||b.J(o.Q)||$(e.q).P(\'1o.4-3\',[e.4(2,$N[0])])===y){2.1k();l y}e.8.p=e.$3.Z(2);5(o.S){5(b.J(o.w)){e.8.p=L;b.B(o.w);e.$k.1y();1D(2,$Y);2.1k();l y}D 5(!$Y.C){e.$k.1y();7 a=2;e.z(e.$3.Z(2),6(){b.v(o.w).v(o.1t);1C(a,$N)});2.1k();l y}}5(o.G)$.G(\'4-3\'+$.m(e.q),e.8.p,o.G);e.$k.1y();5($N.C){7 a=2;e.z(e.$3.Z(2),6(){23(a,b,$Y,$N)})}D 2M\'21 2K 2J: 2H 2G 2F.\';5($.O.14)2.1k();l y});5(!(/^1A/).27(o.12))2.$3.1b(\'1A.4-3\',6(){l y})},17:6(d,e,f){5(f==1Y)f=2.$3.C;7 o=2.8;7 a=$(o.1Q.V(/#\\{x\\}/,d).V(/#\\{1g\\}/,e));a.m(\'15.4-3\',1a);7 b=d.2D(\'#\')==0?d.V(\'#\',\'\'):2.1z($(\'a:2C-2z\',a)[0]);7 c=$(\'#\'+b);5(!c.C){c=$(o.1v).W(\'16\',b).v(o.U).v(o.M);c.m(\'15.4-3\',1a)}5(f>=2.$u.C){a.1W(2.q);c.1W(2.q.2E)}D{a.1V(2.$u[f]);c.1V(2.$k[f])}o.t=$.1i(o.t,6(n,i){l n>=f?++n:n});2.11();5(2.$3.C==1){a.v(o.w);c.B(o.M);7 g=$.m(2.$3[0],\'z.4-3\');5(g)2.z(f,g)}$(2.q).P(\'17.4-3\',[2.4(2.$3[f],2.$k[f])])},19:6(a){7 o=2.8,$E=2.$u.F(a).19(),$1e=2.$k.F(a).19();5($E.J(o.w)&&2.$3.C>1)2.1o(a+(a+1<2.$3.C?1:-1));o.t=$.1i($.1U(o.t,6(n,i){l n!=a}),6(n,i){l n>=a?--n:n});2.11();$(2.q).P(\'19.4-3\',[2.4($E.2I(\'a\')[0],$1e[0])])},25:6(a){7 o=2.8;5($.1I(a,o.t)==-1)l;7 b=2.$u.F(a).B(o.Q);5($.O.2u){b.13(\'1p\',\'2L-1B\');1u(6(){b.13(\'1p\',\'1B\')},0)}o.t=$.1U(o.t,6(n,i){l n!=a});$(2.q).P(\'25.4-3\',[2.4(2.$3[a],2.$k[a])])},20:6(a){7 b=2,o=2.8;5(a!=o.p){2.$u.F(a).v(o.Q);o.t.1O(a);o.t.1J();$(2.q).P(\'20.4-3\',[2.4(2.$3[a],2.$k[a])])}},1o:6(a){5(1K a==\'1X\')a=2.$3.Z(2.$3.T(\'[x$=\'+a+\']\')[0]);2.$3.F(a).2t(2.8.12)},z:6(d,b){7 e=2,o=2.8,$a=2.$3.F(d),a=$a[0],1T=b==1Y|| b===y,18=$a.m(\'z.4-3\');b=b|| 6(){};5(!18|| ($.m(a,\'K.4-3\')&&!1T)){b();l}5(o.1l){7 g=$(\'1h\',a),1g=g.1n();g.1n(\'<1S>\'+o.1l+\'\')}7 c=6(){e.$3.T(\'.\'+o.1s).I(6(){$(2).B(o.1s);5(o.1l)$(\'1h\',2).1n(1g)});e.1m=L};7 f=$.1H({},o.1j,{18:18,1x:6(r,s){$(a.H).1n(r);c();b();5(o.K)$.m(a,\'K.4-3\',1a);$(e.q).P(\'z.4-3\',[e.4(e.$3[d],e.$k[d])]);o.1j.1x&&o.1j.1x(r,s)}});5(2.1m){2.1m.2r();c()}$a.v(o.1s);1u(6(){e.1m=$.2q(f)},0)},18:6(a,b){2.$3.F(a).1r(\'K.4-3\').m(\'z.4-3\',b)},15:6(){7 o=2.8;$(2.q).1d(\'.4-3\').B(o.1f).1r(\'4-3\');2.$3.I(6(){7 b=$.m(2,\'x.4-3\');5(b)2.x=b;7 c=$(2).1d(\'.4-3\');$.I([\'x\',\'z\',\'K\'],6(i,a){c.1r(a+\'.4-3\')})});2.$u.17(2.$k).I(6(){5($.m(2,\'15.4-3\'))$(2).19();D $(2).B([o.w,o.1t,o.Q,o.U,o.M].2p(\' \'))})}})})(21);',62,185,'||this|tabs|ui|if|function|var|options||||||||||||panels|return|data|||selected|element|||disabled|lis|addClass|selectedClass|href|false|load||removeClass|length|else|li|eq|cookie|hash|each|hasClass|cache|null|hideClass|show|browser|triggerHandler|disabledClass|showFx|unselect|filter|panelClass|replace|attr|fx|hide|index||tabify|event|css|msie|destroy|id|add|url|remove|true|bind|baseFx|unbind|panel|navClass|label|span|map|ajaxOptions|blur|spinner|xhr|html|select|display|arguments|removeData|loadingClass|unselectClass|setTimeout|panelTemplate|location|success|stop|tabId|click|block|showTab|hideTab|opacity|baseDuration|duration|extend|inArray|sort|typeof|div|toShowId|prototype|push|Array|tabTemplate|idPrefix|em|bypassCache|grep|insertBefore|appendTo|string|undefined|_|disable|jQuery|title|switchTab|style|enable|animate|test|constructor|for|unload|window|call|concat|unique|nav|slice|parseInt|scrollTo|500|opera|new|insertAfter|apply|fn|join|ajax|abort|has|trigger|safari|tab|instance|8230|z0|child|Za|Loading|first|indexOf|parentNode|identifier|fragment|Mismatching|find|Tabs|UI|inline|throw|visible|parents|siblings|getData|height|overflow|setData|normal|Function|width|min|loading'.split('|'),0,{})) -------------------------------------------------------------------------------- /testcase/std_testcase.php: -------------------------------------------------------------------------------- 1 | load($str); 13 | assert($dom->save()==$str); 14 | // ----------------------------------------------- 15 | $str = null; 16 | $dom->load($str); 17 | assert($dom->save()==$str); 18 | 19 | // ----------------------------------------------------------------------------- 20 | // text test 21 | $str = << 24 | 25 | HTML; 26 | $dom->load($str); 27 | assert(count($dom->find('unknown'))==1); 28 | assert(count($dom->find('text'))==1); 29 | 30 | // ----------------------------------------------------------------------------- 31 | // string quote test 32 | $str = << 34 | okok
    35 | 36 |
    37 |
    38 | 39 |
    40 |
    41 | 42 | HTML; 43 | $dom->load($str); 44 | $es = $dom->find('input'); 45 | assert(count($es)==4); 46 | assert($es[0]->onclick=='goto("url0")'); 47 | assert($es[1]->onclick=="goto('url1'+'\'')"); 48 | assert($es[2]->onclick=="goto('url2')"); 49 | assert($es[3]->onclick=='goto("url4"+"\"")'); 50 | 51 | // ----------------------------------------------------------------------------- 52 | // clone test 53 | $str = << 55 | okok
    56 | 57 |
    58 |
    59 | 60 |
    61 |
    62 | 63 | HTML; 64 | $dom->load($str); 65 | $es = $dom->find('input'); 66 | assert(count($es)==4); 67 | assert($es[0]->onclick=='goto("url0")'); 68 | assert($es[1]->onclick=="goto('url1'+'\'')"); 69 | assert($es[2]->onclick=="goto('url2')"); 70 | assert($es[3]->onclick=='goto("url4"+"\"")'); 71 | 72 | unset($es); 73 | $dom2 = clone($dom); 74 | $es = $dom2->find('input'); 75 | assert(count($es)==4); 76 | assert($es[0]->onclick=='goto("url0")'); 77 | assert($es[1]->onclick=="goto('url1'+'\'')"); 78 | assert($es[2]->onclick=="goto('url2')"); 79 | assert($es[3]->onclick=='goto("url4"+"\"")'); 80 | 81 | // ----------------------------------------------- 82 | $str = << 84 | HTML; 85 | $dom->load($str); 86 | assert($dom==$str); 87 | assert($dom->save()==$str); 88 | 89 | // ----------------------------------------------------------------------------- 90 | // monkey test 91 | $str = <<load($str); 95 | assert($dom==$str); 96 | assert($dom->save()==$str); 97 | // ----------------------------------------------- 98 | $str = <<load($str); 103 | assert($dom==$str); 104 | assert($dom->save()==$str); 105 | // ----------------------------------------------- 106 | $str = <<load($str); 112 | assert($dom==$str); 113 | assert($dom->save()==$str); 114 | // ----------------------------------------------- 115 | $str = <<load($str); 119 | assert($dom==$str); 120 | assert($dom->save()==$str); 121 | // ----------------------------------------------- 122 | $str = <<load($str); 126 | assert($dom==$str); 127 | assert($dom->save()==$str); 128 | // ----------------------------------------------- 129 | $str = <<load($str); 133 | assert($dom==$str); 134 | assert($dom->save()==$str); 135 | // ----------------------------------------------- 136 | $str = <<load($str); 140 | assert($dom==$str); 141 | assert($dom->save()==$str); 142 | // ----------------------------------------------- 143 | $str = <<<<>ab 145 | HTML; 146 | $dom->load($str); 147 | assert($dom==$str); 148 | assert($dom->save()==$str); 149 | // ----------------------------------------------- 150 | $str = <<load($str); 155 | assert($dom==$str); 156 | assert($dom->save()==$str); 157 | // ----------------------------------------------- 158 | $str = << 160 | HTML; 161 | $dom->load($str); 162 | assert($dom==$str); 163 | assert($dom->save()==$str); 164 | // ----------------------------------------------- 165 | // $str = <<load($str); 170 | // echo $dom; 171 | // assert($dom==$str); 172 | // assert($dom->save()==$str); 173 | // ----------------------------------------------- 174 | $str = <<load($str); 178 | assert($dom==$str); 179 | assert($dom->save()==$str); 180 | 181 | // ----------------------------------------------------------------------------- 182 | // rnadom string test 183 | function str_random($length) 184 | { 185 | $str = ""; 186 | srand((double)microtime()*1000000); 187 | $char_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 188 | $char_list .= "abcdefghijklmnopqrstuvwxyz"; 189 | $char_list .= "1234567890"; 190 | $char_list .= "<>!?[]%^&*()"; 191 | for($i=0; $i<$length; ++$i) 192 | $str .= substr($char_list,(rand()%(strlen($char_list))), 1); 193 | return $str; 194 | } 195 | 196 | for($i=0; $i<60; ++$i) { 197 | $str = str_random($i); 198 | //echo $str."\n
    "; 199 | $dom->load($str, false); 200 | //echo $dom->save()."\n
    "; 201 | assert($dom==$str); 202 | } 203 | 204 | // ----------------------------------------------------------------------------- 205 | // lowercase test 206 | $str = << 208 | HTML; 209 | $dom->load($str); 210 | assert(count($dom->find('img'))==1); 211 | assert(count($dom->find('IMG'))==1); 212 | assert(isset($dom->find('img', 0)->class)); 213 | assert(!isset($dom->find('img', 0)->CLASS)); 214 | assert($dom->find('img', 0)->class=='class0'); 215 | assert($dom==$str); 216 | // ----------------------------------------------- 217 | $str = << 219 | HTML; 220 | $dom->load($str); 221 | assert(count($dom->find('img'))==1); 222 | assert(count($dom->find('IMG'))==1); 223 | assert(isset($dom->find('img', 0)->class)); 224 | assert(!isset($dom->find('img', 0)->CLASS)); 225 | assert($dom->find('img', 0)->class=='class0'); 226 | assert($dom==strtolower($str)); 227 | // ----------------------------------------------- 228 | $str = << 230 | HTML; 231 | $dom->load($str, false); 232 | assert(count($dom->find('img'))==0); 233 | assert(count($dom->find('IMG'))==1); 234 | assert(isset($dom->find('IMG', 0)->CLASS)); 235 | assert(!isset($dom->find('IMG', 0)->class)); 236 | assert($dom->find('IMG', 0)->CLASS=='class0'); 237 | assert($dom==$str); 238 | 239 | // ----------------------------------------------------------------------------- 240 | // tear down 241 | $dom->clear(); 242 | unset($dom); 243 | ?> -------------------------------------------------------------------------------- /testcase/.svn/text-base/std_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | load($str); 13 | assert($dom->save()==$str); 14 | // ----------------------------------------------- 15 | $str = null; 16 | $dom->load($str); 17 | assert($dom->save()==$str); 18 | 19 | // ----------------------------------------------------------------------------- 20 | // text test 21 | $str = << 24 | 25 | HTML; 26 | $dom->load($str); 27 | assert(count($dom->find('unknown'))==1); 28 | assert(count($dom->find('text'))==1); 29 | 30 | // ----------------------------------------------------------------------------- 31 | // string quote test 32 | $str = << 34 | okok
    35 | 36 |
    37 |
    38 | 39 |
    40 |
    41 | 42 | HTML; 43 | $dom->load($str); 44 | $es = $dom->find('input'); 45 | assert(count($es)==4); 46 | assert($es[0]->onclick=='goto("url0")'); 47 | assert($es[1]->onclick=="goto('url1'+'\'')"); 48 | assert($es[2]->onclick=="goto('url2')"); 49 | assert($es[3]->onclick=='goto("url4"+"\"")'); 50 | 51 | // ----------------------------------------------------------------------------- 52 | // clone test 53 | $str = << 55 | okok
    56 | 57 |
    58 |
    59 | 60 |
    61 |
    62 | 63 | HTML; 64 | $dom->load($str); 65 | $es = $dom->find('input'); 66 | assert(count($es)==4); 67 | assert($es[0]->onclick=='goto("url0")'); 68 | assert($es[1]->onclick=="goto('url1'+'\'')"); 69 | assert($es[2]->onclick=="goto('url2')"); 70 | assert($es[3]->onclick=='goto("url4"+"\"")'); 71 | 72 | unset($es); 73 | $dom2 = clone($dom); 74 | $es = $dom2->find('input'); 75 | assert(count($es)==4); 76 | assert($es[0]->onclick=='goto("url0")'); 77 | assert($es[1]->onclick=="goto('url1'+'\'')"); 78 | assert($es[2]->onclick=="goto('url2')"); 79 | assert($es[3]->onclick=='goto("url4"+"\"")'); 80 | 81 | // ----------------------------------------------- 82 | $str = << 84 | HTML; 85 | $dom->load($str); 86 | assert($dom==$str); 87 | assert($dom->save()==$str); 88 | 89 | // ----------------------------------------------------------------------------- 90 | // monkey test 91 | $str = <<load($str); 95 | assert($dom==$str); 96 | assert($dom->save()==$str); 97 | // ----------------------------------------------- 98 | $str = <<load($str); 103 | assert($dom==$str); 104 | assert($dom->save()==$str); 105 | // ----------------------------------------------- 106 | $str = <<load($str); 112 | assert($dom==$str); 113 | assert($dom->save()==$str); 114 | // ----------------------------------------------- 115 | $str = <<load($str); 119 | assert($dom==$str); 120 | assert($dom->save()==$str); 121 | // ----------------------------------------------- 122 | $str = <<load($str); 126 | assert($dom==$str); 127 | assert($dom->save()==$str); 128 | // ----------------------------------------------- 129 | $str = <<load($str); 133 | assert($dom==$str); 134 | assert($dom->save()==$str); 135 | // ----------------------------------------------- 136 | $str = <<load($str); 140 | assert($dom==$str); 141 | assert($dom->save()==$str); 142 | // ----------------------------------------------- 143 | $str = <<<<>ab 145 | HTML; 146 | $dom->load($str); 147 | assert($dom==$str); 148 | assert($dom->save()==$str); 149 | // ----------------------------------------------- 150 | $str = <<load($str); 155 | assert($dom==$str); 156 | assert($dom->save()==$str); 157 | // ----------------------------------------------- 158 | $str = << 160 | HTML; 161 | $dom->load($str); 162 | assert($dom==$str); 163 | assert($dom->save()==$str); 164 | // ----------------------------------------------- 165 | // $str = <<load($str); 170 | // echo $dom; 171 | // assert($dom==$str); 172 | // assert($dom->save()==$str); 173 | // ----------------------------------------------- 174 | $str = <<load($str); 178 | assert($dom==$str); 179 | assert($dom->save()==$str); 180 | 181 | // ----------------------------------------------------------------------------- 182 | // rnadom string test 183 | function str_random($length) 184 | { 185 | $str = ""; 186 | srand((double)microtime()*1000000); 187 | $char_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 188 | $char_list .= "abcdefghijklmnopqrstuvwxyz"; 189 | $char_list .= "1234567890"; 190 | $char_list .= "<>!?[]%^&*()"; 191 | for($i=0; $i<$length; ++$i) 192 | $str .= substr($char_list,(rand()%(strlen($char_list))), 1); 193 | return $str; 194 | } 195 | 196 | for($i=0; $i<60; ++$i) { 197 | $str = str_random($i); 198 | //echo $str."\n
    "; 199 | $dom->load($str, false); 200 | //echo $dom->save()."\n
    "; 201 | assert($dom==$str); 202 | } 203 | 204 | // ----------------------------------------------------------------------------- 205 | // lowercase test 206 | $str = << 208 | HTML; 209 | $dom->load($str); 210 | assert(count($dom->find('img'))==1); 211 | assert(count($dom->find('IMG'))==1); 212 | assert(isset($dom->find('img', 0)->class)); 213 | assert(!isset($dom->find('img', 0)->CLASS)); 214 | assert($dom->find('img', 0)->class=='class0'); 215 | assert($dom==$str); 216 | // ----------------------------------------------- 217 | $str = << 219 | HTML; 220 | $dom->load($str); 221 | assert(count($dom->find('img'))==1); 222 | assert(count($dom->find('IMG'))==1); 223 | assert(isset($dom->find('img', 0)->class)); 224 | assert(!isset($dom->find('img', 0)->CLASS)); 225 | assert($dom->find('img', 0)->class=='class0'); 226 | assert($dom==strtolower($str)); 227 | // ----------------------------------------------- 228 | $str = << 230 | HTML; 231 | $dom->load($str, false); 232 | assert(count($dom->find('img'))==0); 233 | assert(count($dom->find('IMG'))==1); 234 | assert(isset($dom->find('IMG', 0)->CLASS)); 235 | assert(!isset($dom->find('IMG', 0)->class)); 236 | assert($dom->find('IMG', 0)->CLASS=='class0'); 237 | assert($dom==$str); 238 | 239 | // ----------------------------------------------------------------------------- 240 | // tear down 241 | $dom->clear(); 242 | unset($dom); 243 | ?> -------------------------------------------------------------------------------- /app/js/jquery.treeview.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Treeview 1.4 - jQuery plugin to hide and show branches of a tree 3 | * 4 | * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ 5 | * http://docs.jquery.com/Plugins/Treeview 6 | * 7 | * Copyright (c) 2007 Jörn Zaefferer 8 | * 9 | * Dual licensed under the MIT and GPL licenses: 10 | * http://www.opensource.org/licenses/mit-license.php 11 | * http://www.gnu.org/licenses/gpl.html 12 | * 13 | * Revision: $Id: jquery.treeview.js 4684 2008-02-07 19:08:06Z joern.zaefferer $ 14 | * 15 | */ 16 | 17 | ;(function($) { 18 | 19 | $.extend($.fn, { 20 | swapClass: function(c1, c2) { 21 | var c1Elements = this.filter('.' + c1); 22 | this.filter('.' + c2).removeClass(c2).addClass(c1); 23 | c1Elements.removeClass(c1).addClass(c2); 24 | return this; 25 | }, 26 | replaceClass: function(c1, c2) { 27 | return this.filter('.' + c1).removeClass(c1).addClass(c2).end(); 28 | }, 29 | hoverClass: function(className) { 30 | className = className || "hover"; 31 | return this.hover(function() { 32 | $(this).addClass(className); 33 | }, function() { 34 | $(this).removeClass(className); 35 | }); 36 | }, 37 | heightToggle: function(animated, callback) { 38 | animated ? 39 | this.animate({ height: "toggle" }, animated, callback) : 40 | this.each(function(){ 41 | jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ](); 42 | if(callback) 43 | callback.apply(this, arguments); 44 | }); 45 | }, 46 | heightHide: function(animated, callback) { 47 | if (animated) { 48 | this.animate({ height: "hide" }, animated, callback); 49 | } else { 50 | this.hide(); 51 | if (callback) 52 | this.each(callback); 53 | } 54 | }, 55 | prepareBranches: function(settings) { 56 | if (!settings.prerendered) { 57 | // mark last tree items 58 | this.filter(":last-child:not(ul)").addClass(CLASSES.last); 59 | // collapse whole tree, or only those marked as closed, anyway except those marked as open 60 | this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide(); 61 | } 62 | // return all items with sublists 63 | return this.filter(":has(>ul)"); 64 | }, 65 | applyClasses: function(settings, toggler) { 66 | this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) { 67 | toggler.apply($(this).next()); 68 | }).add( $("a", this) ).hoverClass(); 69 | 70 | if (!settings.prerendered) { 71 | // handle closed ones first 72 | this.filter(":has(>ul:hidden)") 73 | .addClass(CLASSES.expandable) 74 | .replaceClass(CLASSES.last, CLASSES.lastExpandable); 75 | 76 | // handle open ones 77 | this.not(":has(>ul:hidden)") 78 | .addClass(CLASSES.collapsable) 79 | .replaceClass(CLASSES.last, CLASSES.lastCollapsable); 80 | 81 | // create hitarea 82 | this.prepend("
    ").find("div." + CLASSES.hitarea).each(function() { 83 | var classes = ""; 84 | $.each($(this).parent().attr("class").split(" "), function() { 85 | classes += this + "-hitarea "; 86 | }); 87 | $(this).addClass( classes ); 88 | }); 89 | } 90 | 91 | // apply event to hitarea 92 | this.find("div." + CLASSES.hitarea).click( toggler ); 93 | }, 94 | treeview: function(settings) { 95 | 96 | settings = $.extend({ 97 | cookieId: "treeview" 98 | }, settings); 99 | 100 | if (settings.add) { 101 | return this.trigger("add", [settings.add]); 102 | } 103 | 104 | if ( settings.toggle ) { 105 | var callback = settings.toggle; 106 | settings.toggle = function() { 107 | return callback.apply($(this).parent()[0], arguments); 108 | }; 109 | } 110 | 111 | // factory for treecontroller 112 | function treeController(tree, control) { 113 | // factory for click handlers 114 | function handler(filter) { 115 | return function() { 116 | // reuse toggle event handler, applying the elements to toggle 117 | // start searching for all hitareas 118 | toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() { 119 | // for plain toggle, no filter is provided, otherwise we need to check the parent element 120 | return filter ? $(this).parent("." + filter).length : true; 121 | }) ); 122 | return false; 123 | }; 124 | } 125 | // click on first element to collapse tree 126 | $("a:eq(0)", control).click( handler(CLASSES.collapsable) ); 127 | // click on second to expand tree 128 | $("a:eq(1)", control).click( handler(CLASSES.expandable) ); 129 | // click on third to toggle tree 130 | $("a:eq(2)", control).click( handler() ); 131 | } 132 | 133 | // handle toggle event 134 | function toggler() { 135 | $(this) 136 | .parent() 137 | // swap classes for hitarea 138 | .find(">.hitarea") 139 | .swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) 140 | .swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) 141 | .end() 142 | // swap classes for parent li 143 | .swapClass( CLASSES.collapsable, CLASSES.expandable ) 144 | .swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) 145 | // find child lists 146 | .find( ">ul" ) 147 | // toggle them 148 | .heightToggle( settings.animated, settings.toggle ); 149 | if ( settings.unique ) { 150 | $(this).parent() 151 | .siblings() 152 | // swap classes for hitarea 153 | .find(">.hitarea") 154 | .replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) 155 | .replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) 156 | .end() 157 | .replaceClass( CLASSES.collapsable, CLASSES.expandable ) 158 | .replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) 159 | .find( ">ul" ) 160 | .heightHide( settings.animated, settings.toggle ); 161 | } 162 | } 163 | 164 | function serialize() { 165 | function binary(arg) { 166 | return arg ? 1 : 0; 167 | } 168 | var data = []; 169 | branches.each(function(i, e) { 170 | data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0; 171 | }); 172 | $.cookie(settings.cookieId, data.join("") ); 173 | } 174 | 175 | function deserialize() { 176 | var stored = $.cookie(settings.cookieId); 177 | if ( stored ) { 178 | var data = stored.split(""); 179 | branches.each(function(i, e) { 180 | $(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ](); 181 | }); 182 | } 183 | } 184 | 185 | // add treeview class to activate styles 186 | this.addClass("treeview"); 187 | 188 | // prepare branches and find all tree items with child lists 189 | var branches = this.find("li").prepareBranches(settings); 190 | 191 | switch(settings.persist) { 192 | case "cookie": 193 | var toggleCallback = settings.toggle; 194 | settings.toggle = function() { 195 | serialize(); 196 | if (toggleCallback) { 197 | toggleCallback.apply(this, arguments); 198 | } 199 | }; 200 | deserialize(); 201 | break; 202 | case "location": 203 | var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase(); }); 204 | if ( current.length ) { 205 | current.addClass("selected").parents("ul, li").add( current.next() ).show(); 206 | } 207 | break; 208 | } 209 | 210 | branches.applyClasses(settings, toggler); 211 | 212 | // if control option is set, create the treecontroller and show it 213 | if ( settings.control ) { 214 | treeController(this, settings.control); 215 | $(settings.control).show(); 216 | } 217 | 218 | return this.bind("add", function(event, branches) { 219 | $(branches).prev() 220 | .removeClass(CLASSES.last) 221 | .removeClass(CLASSES.lastCollapsable) 222 | .removeClass(CLASSES.lastExpandable) 223 | .find(">.hitarea") 224 | .removeClass(CLASSES.lastCollapsableHitarea) 225 | .removeClass(CLASSES.lastExpandableHitarea); 226 | $(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler); 227 | }); 228 | } 229 | }); 230 | 231 | // classes used by the plugin 232 | // need to be styled via external stylesheet, see first example 233 | var CLASSES = $.fn.treeview.classes = { 234 | open: "open", 235 | closed: "closed", 236 | expandable: "expandable", 237 | expandableHitarea: "expandable-hitarea", 238 | lastExpandableHitarea: "lastExpandable-hitarea", 239 | collapsable: "collapsable", 240 | collapsableHitarea: "collapsable-hitarea", 241 | lastCollapsableHitarea: "lastCollapsable-hitarea", 242 | lastCollapsable: "lastCollapsable", 243 | lastExpandable: "lastExpandable", 244 | last: "last", 245 | hitarea: "hitarea" 246 | }; 247 | 248 | // provide backwards compability 249 | $.fn.Treeview = $.fn.treeview; 250 | 251 | })(jQuery); -------------------------------------------------------------------------------- /app/js/.svn/text-base/jquery.treeview.js.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | * Treeview 1.4 - jQuery plugin to hide and show branches of a tree 3 | * 4 | * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ 5 | * http://docs.jquery.com/Plugins/Treeview 6 | * 7 | * Copyright (c) 2007 Jörn Zaefferer 8 | * 9 | * Dual licensed under the MIT and GPL licenses: 10 | * http://www.opensource.org/licenses/mit-license.php 11 | * http://www.gnu.org/licenses/gpl.html 12 | * 13 | * Revision: $Id: jquery.treeview.js 4684 2008-02-07 19:08:06Z joern.zaefferer $ 14 | * 15 | */ 16 | 17 | ;(function($) { 18 | 19 | $.extend($.fn, { 20 | swapClass: function(c1, c2) { 21 | var c1Elements = this.filter('.' + c1); 22 | this.filter('.' + c2).removeClass(c2).addClass(c1); 23 | c1Elements.removeClass(c1).addClass(c2); 24 | return this; 25 | }, 26 | replaceClass: function(c1, c2) { 27 | return this.filter('.' + c1).removeClass(c1).addClass(c2).end(); 28 | }, 29 | hoverClass: function(className) { 30 | className = className || "hover"; 31 | return this.hover(function() { 32 | $(this).addClass(className); 33 | }, function() { 34 | $(this).removeClass(className); 35 | }); 36 | }, 37 | heightToggle: function(animated, callback) { 38 | animated ? 39 | this.animate({ height: "toggle" }, animated, callback) : 40 | this.each(function(){ 41 | jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ](); 42 | if(callback) 43 | callback.apply(this, arguments); 44 | }); 45 | }, 46 | heightHide: function(animated, callback) { 47 | if (animated) { 48 | this.animate({ height: "hide" }, animated, callback); 49 | } else { 50 | this.hide(); 51 | if (callback) 52 | this.each(callback); 53 | } 54 | }, 55 | prepareBranches: function(settings) { 56 | if (!settings.prerendered) { 57 | // mark last tree items 58 | this.filter(":last-child:not(ul)").addClass(CLASSES.last); 59 | // collapse whole tree, or only those marked as closed, anyway except those marked as open 60 | this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide(); 61 | } 62 | // return all items with sublists 63 | return this.filter(":has(>ul)"); 64 | }, 65 | applyClasses: function(settings, toggler) { 66 | this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) { 67 | toggler.apply($(this).next()); 68 | }).add( $("a", this) ).hoverClass(); 69 | 70 | if (!settings.prerendered) { 71 | // handle closed ones first 72 | this.filter(":has(>ul:hidden)") 73 | .addClass(CLASSES.expandable) 74 | .replaceClass(CLASSES.last, CLASSES.lastExpandable); 75 | 76 | // handle open ones 77 | this.not(":has(>ul:hidden)") 78 | .addClass(CLASSES.collapsable) 79 | .replaceClass(CLASSES.last, CLASSES.lastCollapsable); 80 | 81 | // create hitarea 82 | this.prepend("
    ").find("div." + CLASSES.hitarea).each(function() { 83 | var classes = ""; 84 | $.each($(this).parent().attr("class").split(" "), function() { 85 | classes += this + "-hitarea "; 86 | }); 87 | $(this).addClass( classes ); 88 | }); 89 | } 90 | 91 | // apply event to hitarea 92 | this.find("div." + CLASSES.hitarea).click( toggler ); 93 | }, 94 | treeview: function(settings) { 95 | 96 | settings = $.extend({ 97 | cookieId: "treeview" 98 | }, settings); 99 | 100 | if (settings.add) { 101 | return this.trigger("add", [settings.add]); 102 | } 103 | 104 | if ( settings.toggle ) { 105 | var callback = settings.toggle; 106 | settings.toggle = function() { 107 | return callback.apply($(this).parent()[0], arguments); 108 | }; 109 | } 110 | 111 | // factory for treecontroller 112 | function treeController(tree, control) { 113 | // factory for click handlers 114 | function handler(filter) { 115 | return function() { 116 | // reuse toggle event handler, applying the elements to toggle 117 | // start searching for all hitareas 118 | toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() { 119 | // for plain toggle, no filter is provided, otherwise we need to check the parent element 120 | return filter ? $(this).parent("." + filter).length : true; 121 | }) ); 122 | return false; 123 | }; 124 | } 125 | // click on first element to collapse tree 126 | $("a:eq(0)", control).click( handler(CLASSES.collapsable) ); 127 | // click on second to expand tree 128 | $("a:eq(1)", control).click( handler(CLASSES.expandable) ); 129 | // click on third to toggle tree 130 | $("a:eq(2)", control).click( handler() ); 131 | } 132 | 133 | // handle toggle event 134 | function toggler() { 135 | $(this) 136 | .parent() 137 | // swap classes for hitarea 138 | .find(">.hitarea") 139 | .swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) 140 | .swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) 141 | .end() 142 | // swap classes for parent li 143 | .swapClass( CLASSES.collapsable, CLASSES.expandable ) 144 | .swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) 145 | // find child lists 146 | .find( ">ul" ) 147 | // toggle them 148 | .heightToggle( settings.animated, settings.toggle ); 149 | if ( settings.unique ) { 150 | $(this).parent() 151 | .siblings() 152 | // swap classes for hitarea 153 | .find(">.hitarea") 154 | .replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) 155 | .replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) 156 | .end() 157 | .replaceClass( CLASSES.collapsable, CLASSES.expandable ) 158 | .replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) 159 | .find( ">ul" ) 160 | .heightHide( settings.animated, settings.toggle ); 161 | } 162 | } 163 | 164 | function serialize() { 165 | function binary(arg) { 166 | return arg ? 1 : 0; 167 | } 168 | var data = []; 169 | branches.each(function(i, e) { 170 | data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0; 171 | }); 172 | $.cookie(settings.cookieId, data.join("") ); 173 | } 174 | 175 | function deserialize() { 176 | var stored = $.cookie(settings.cookieId); 177 | if ( stored ) { 178 | var data = stored.split(""); 179 | branches.each(function(i, e) { 180 | $(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ](); 181 | }); 182 | } 183 | } 184 | 185 | // add treeview class to activate styles 186 | this.addClass("treeview"); 187 | 188 | // prepare branches and find all tree items with child lists 189 | var branches = this.find("li").prepareBranches(settings); 190 | 191 | switch(settings.persist) { 192 | case "cookie": 193 | var toggleCallback = settings.toggle; 194 | settings.toggle = function() { 195 | serialize(); 196 | if (toggleCallback) { 197 | toggleCallback.apply(this, arguments); 198 | } 199 | }; 200 | deserialize(); 201 | break; 202 | case "location": 203 | var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase(); }); 204 | if ( current.length ) { 205 | current.addClass("selected").parents("ul, li").add( current.next() ).show(); 206 | } 207 | break; 208 | } 209 | 210 | branches.applyClasses(settings, toggler); 211 | 212 | // if control option is set, create the treecontroller and show it 213 | if ( settings.control ) { 214 | treeController(this, settings.control); 215 | $(settings.control).show(); 216 | } 217 | 218 | return this.bind("add", function(event, branches) { 219 | $(branches).prev() 220 | .removeClass(CLASSES.last) 221 | .removeClass(CLASSES.lastCollapsable) 222 | .removeClass(CLASSES.lastExpandable) 223 | .find(">.hitarea") 224 | .removeClass(CLASSES.lastCollapsableHitarea) 225 | .removeClass(CLASSES.lastExpandableHitarea); 226 | $(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler); 227 | }); 228 | } 229 | }); 230 | 231 | // classes used by the plugin 232 | // need to be styled via external stylesheet, see first example 233 | var CLASSES = $.fn.treeview.classes = { 234 | open: "open", 235 | closed: "closed", 236 | expandable: "expandable", 237 | expandableHitarea: "expandable-hitarea", 238 | lastExpandableHitarea: "lastExpandable-hitarea", 239 | collapsable: "collapsable", 240 | collapsableHitarea: "collapsable-hitarea", 241 | lastCollapsableHitarea: "lastCollapsable-hitarea", 242 | lastCollapsable: "lastCollapsable", 243 | lastExpandable: "lastExpandable", 244 | last: "last", 245 | hitarea: "hitarea" 246 | }; 247 | 248 | // provide backwards compability 249 | $.fn.Treeview = $.fn.treeview; 250 | 251 | })(jQuery); -------------------------------------------------------------------------------- /testcase/element_testcase.php: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 |
    15 | foo 16 | 17 | 18 | HTML; 19 | $dom->load($str); 20 | assert($dom==$str); 21 | // ----------------------------------------------- 22 | $str = << 24 | 25 | 26 |
    27 | bar 28 | 29 | 30 | HTML; 31 | $dom->load($str); 32 | $dom->find('span', 0)->innertext = 'bar'; 33 | assert($dom==$str); 34 | // ----------------------------------------------- 35 | $str = << 37 | ok 38 | 39 |
    40 | bar 41 | 42 | 43 | HTML; 44 | $dom->load($str); 45 | $dom->find('head', 0)->innertext = 'ok'; 46 | assert($dom==$str); 47 | // ----------------------------------------------- 48 | $str = <<foo 50 | HTML; 51 | $dom->load($str); 52 | 53 | $e = $dom->find('b text', 0); 54 | assert($e->innertext=='foo'); 55 | assert($e->outertext=='foo'); 56 | $e->innertext = 'bar'; 57 | assert($e->innertext=='bar'); 58 | assert($e->outertext=='bar'); 59 | $e = $dom->find('b', 0); 60 | assert($e->innertext=='bar'); 61 | assert($e->outertext=='bar'); 62 | 63 | // ----------------------------------------------------------------------------- 64 | // outertext test 65 | $str = << 67 | Head1Head2Head3 68 | 123 69 | 70 | HTML; 71 | $dom->load($str); 72 | assert($dom->find('tr', 0)->outertext=='Head1Head2Head3'); 73 | assert($dom->find('tr', 1)->outertext=='123'); 74 | // ----------------------------------------------- 75 | $str = <<Head1Head2Head3123 77 | HTML; 78 | $dom->load($str); 79 | assert($dom->find('tr', 0)->outertext=='Head1Head2Head3'); 80 | assert($dom->find('tr', 1)->outertext=='123'); 81 | 82 | // ----------------------------------------------- 83 | $str = <<
  • li11
  • li12
    • li21
    • li22
    85 | HTML; 86 | $dom->load($str); 87 | assert($dom->find('ul', 0)->outertext=='
    • li11
    • li12
    '); 88 | assert($dom->find('ul', 1)->outertext=='
    • li21
    • li22
    '); 89 | 90 | // ----------------------------------------------- 91 | $str = <<
  • li11
  • li12
    • li21
    • li22
    • 93 | HTML; 94 | $dom->load($str); 95 | assert($dom->find('ul', 0)->outertext=='
      • li11
      • li12
        • li21
        • li22
        • '); 96 | assert($dom->find('ul', 1)->outertext=='
          • li21
          • li22
          • '); 97 | 98 | // ----------------------------------------------- 99 | $str = <<
          • li11
          • li12
            • li21
            • li22 101 | HTML; 102 | $dom->load($str); 103 | assert($dom->find('ul', 0)->outertext=='
              • li11
              • li12
                • li21
                • li22'); 104 | assert($dom->find('ul', 1)->outertext=='
                  • li21
                  • li22'); 105 | 106 | // ----------------------------------------------- 107 | $str = << 109 | Head1Head2Head3 110 | 123 111 | 112 | HTML; 113 | $dom->load($str); 114 | assert($dom->find('tr', 0)->outertext=='Head1Head2Head3'); 115 | assert($dom->find('tr', 1)->outertext=='123'); 116 | 117 | // ----------------------------------------------------------------------------- 118 | // replacement test 119 | $str = <<
                    ok
    121 | HTML; 122 | $dom->load($str); 123 | $es = $dom->find('div'); 124 | assert(count($es)==2); 125 | assert($es[0]->innertext=='
    ok
    '); 126 | assert($es[0]->outertext=='
    ok
    '); 127 | 128 | // test isset 129 | $es[0]->class = 'class_test'; 130 | assert(isset($es[0]->class)===true); 131 | assert(isset($es[0]->okok)===false); 132 | 133 | // test replacement 134 | $es[0]->class = 'class_test'; 135 | assert($es[0]->outertext=='
    ok
    '); 136 | 137 | // test replacement 138 | $es[0]->tag = 'span'; 139 | assert($es[0]->outertext=='
    ok
    '); 140 | 141 | // test unset (no more support...) 142 | //$dom = str_get_dom($str); 143 | //$es = $dom->find('div'); 144 | //unset($es[0]->class); 145 | //assert($es[0]->outertext=='
    ok
    '); 146 | 147 | $dom->load($str); 148 | $es = $dom->find('div'); 149 | unset($es[0]->attr['class']); 150 | assert($es[0]->outertext=='
    ok
    '); 151 | 152 | // ----------------------------------------------- 153 | $str = <<blahblah2 155 | HTML; 156 | $dom->load($str); 157 | $e = $dom->find('select[name=something]', 0); 158 | $e->innertext = ''; 159 | assert($e->outertext ==''); 160 | 161 | // ----------------------------------------------------------------------------- 162 | // nested replacement test 163 | $str = <<
    ok
    165 | HTML; 166 | $dom->load($str); 167 | $es = $dom->find('div'); 168 | assert(count($es)==2); 169 | assert($es[0]->innertext=='
    ok
    '); 170 | assert($es[0]->outertext=='
    ok
    '); 171 | assert($es[1]->innertext=='ok'); 172 | assert($es[1]->outertext=='
    ok
    '); 173 | 174 | // test replacement 175 | $es[1]->innertext = 'okok'; 176 | assert($es[1]->outertext=='
    okok
    '); 177 | assert($es[0]->outertext=='
    okok
    '); 178 | assert($dom=='
    okok
    '); 179 | 180 | $es[1]->class = 'class_test'; 181 | assert($es[1]->outertext=='
    okok
    '); 182 | assert($es[0]->outertext=='
    okok
    '); 183 | assert($dom=='
    okok
    '); 184 | 185 | $es[0]->class = 'class_test'; 186 | assert($es[0]->outertext=='
    okok
    '); 187 | assert($dom=='
    okok
    '); 188 | 189 | $es[0]->innertext = 'okokok'; 190 | assert($es[0]->outertext=='
    okokok
    '); 191 | assert($dom=='
    okokok
    '); 192 | 193 | // ----------------------------------------------------------------------------- 194 | //

    test 195 | $str = << 197 |

    ok0link0

    198 | 199 |
    200 |

    ok2link2

    201 | 202 | HTML; 203 | $dom->load($str); 204 | $es = $dom->find('p'); 205 | assert($es[0]->innertext=='ok0link0'); 206 | assert($es[1]->innertext=='ok1link1'); 207 | assert($es[2]->innertext=='ok2link2'); 208 | assert($dom->find('p', 0)->plaintext=='ok0link0'); 209 | assert($dom->find('p', 1)->plaintext=='ok1link1'); 210 | assert($dom->find('p', 2)->plaintext=='ok2link2'); 211 | 212 | $count = 0; 213 | foreach($dom->find('p') as $p) { 214 | $a = $p->find('a'); 215 | assert($a[0]->innertext=='link'.$count); 216 | ++$count; 217 | } 218 | 219 | $es = $dom->find('p a'); 220 | assert($es[0]->innertext=='link0'); 221 | assert($es[1]->innertext=='link1'); 222 | assert($es[2]->innertext=='link2'); 223 | assert($dom->find('p a', 0)->plaintext=='link0'); 224 | assert($dom->find('p a', 1)->plaintext=='link1'); 225 | assert($dom->find('p a', 2)->plaintext=='link2'); 226 | 227 | assert($dom==$str); 228 | 229 | // ----------------------------------------------------------------------------- 230 | // test 231 | $str = << 235 | HTML; 236 | $dom->load($str); 237 | $e = $dom->find('embed', 0); 238 | assert($e->src=='../graphics/sounds/1812over.mid'); 239 | assert($e->height=='60'); 240 | assert($e->width=='144'); 241 | assert($dom==strtolower($str)); 242 | 243 | // ----------------------------------------------------------------------------- 244 | // tear down 245 | $dom->clear(); 246 | unset($dom); 247 | ?> -------------------------------------------------------------------------------- /testcase/.svn/text-base/element_testcase.php.svn-base: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 |
    15 | foo 16 | 17 | 18 | HTML; 19 | $dom->load($str); 20 | assert($dom==$str); 21 | // ----------------------------------------------- 22 | $str = << 24 | 25 | 26 |
    27 | bar 28 | 29 | 30 | HTML; 31 | $dom->load($str); 32 | $dom->find('span', 0)->innertext = 'bar'; 33 | assert($dom==$str); 34 | // ----------------------------------------------- 35 | $str = << 37 | ok 38 | 39 |
    40 | bar 41 | 42 | 43 | HTML; 44 | $dom->load($str); 45 | $dom->find('head', 0)->innertext = 'ok'; 46 | assert($dom==$str); 47 | // ----------------------------------------------- 48 | $str = <<foo 50 | HTML; 51 | $dom->load($str); 52 | 53 | $e = $dom->find('b text', 0); 54 | assert($e->innertext=='foo'); 55 | assert($e->outertext=='foo'); 56 | $e->innertext = 'bar'; 57 | assert($e->innertext=='bar'); 58 | assert($e->outertext=='bar'); 59 | $e = $dom->find('b', 0); 60 | assert($e->innertext=='bar'); 61 | assert($e->outertext=='bar'); 62 | 63 | // ----------------------------------------------------------------------------- 64 | // outertext test 65 | $str = << 67 | Head1Head2Head3 68 | 123 69 | 70 | HTML; 71 | $dom->load($str); 72 | assert($dom->find('tr', 0)->outertext=='Head1Head2Head3'); 73 | assert($dom->find('tr', 1)->outertext=='123'); 74 | // ----------------------------------------------- 75 | $str = <<Head1Head2Head3123 77 | HTML; 78 | $dom->load($str); 79 | assert($dom->find('tr', 0)->outertext=='Head1Head2Head3'); 80 | assert($dom->find('tr', 1)->outertext=='123'); 81 | 82 | // ----------------------------------------------- 83 | $str = <<
  • li11
  • li12
    • li21
    • li22
    85 | HTML; 86 | $dom->load($str); 87 | assert($dom->find('ul', 0)->outertext=='
    • li11
    • li12
    '); 88 | assert($dom->find('ul', 1)->outertext=='
    • li21
    • li22
    '); 89 | 90 | // ----------------------------------------------- 91 | $str = <<
  • li11
  • li12
    • li21
    • li22
    • 93 | HTML; 94 | $dom->load($str); 95 | assert($dom->find('ul', 0)->outertext=='
      • li11
      • li12
        • li21
        • li22
        • '); 96 | assert($dom->find('ul', 1)->outertext=='
          • li21
          • li22
          • '); 97 | 98 | // ----------------------------------------------- 99 | $str = <<
          • li11
          • li12
            • li21
            • li22 101 | HTML; 102 | $dom->load($str); 103 | assert($dom->find('ul', 0)->outertext=='
              • li11
              • li12
                • li21
                • li22'); 104 | assert($dom->find('ul', 1)->outertext=='
                  • li21
                  • li22'); 105 | 106 | // ----------------------------------------------- 107 | $str = << 109 | Head1Head2Head3 110 | 123 111 | 112 | HTML; 113 | $dom->load($str); 114 | assert($dom->find('tr', 0)->outertext=='Head1Head2Head3'); 115 | assert($dom->find('tr', 1)->outertext=='123'); 116 | 117 | // ----------------------------------------------------------------------------- 118 | // replacement test 119 | $str = <<
                    ok
                    121 | HTML; 122 | $dom->load($str); 123 | $es = $dom->find('div'); 124 | assert(count($es)==2); 125 | assert($es[0]->innertext=='
                    ok
                    '); 126 | assert($es[0]->outertext=='
                    ok
                    '); 127 | 128 | // test isset 129 | $es[0]->class = 'class_test'; 130 | assert(isset($es[0]->class)===true); 131 | assert(isset($es[0]->okok)===false); 132 | 133 | // test replacement 134 | $es[0]->class = 'class_test'; 135 | assert($es[0]->outertext=='
                    ok
                    '); 136 | 137 | // test replacement 138 | $es[0]->tag = 'span'; 139 | assert($es[0]->outertext=='
                    ok
                    '); 140 | 141 | // test unset (no more support...) 142 | //$dom = str_get_dom($str); 143 | //$es = $dom->find('div'); 144 | //unset($es[0]->class); 145 | //assert($es[0]->outertext=='
                    ok
                    '); 146 | 147 | $dom->load($str); 148 | $es = $dom->find('div'); 149 | unset($es[0]->attr['class']); 150 | assert($es[0]->outertext=='
                    ok
                    '); 151 | 152 | // ----------------------------------------------- 153 | $str = <<blahblah2 155 | HTML; 156 | $dom->load($str); 157 | $e = $dom->find('select[name=something]', 0); 158 | $e->innertext = ''; 159 | assert($e->outertext ==''); 160 | 161 | // ----------------------------------------------------------------------------- 162 | // nested replacement test 163 | $str = <<
                    ok
                    165 | HTML; 166 | $dom->load($str); 167 | $es = $dom->find('div'); 168 | assert(count($es)==2); 169 | assert($es[0]->innertext=='
                    ok
                    '); 170 | assert($es[0]->outertext=='
                    ok
                    '); 171 | assert($es[1]->innertext=='ok'); 172 | assert($es[1]->outertext=='
                    ok
                    '); 173 | 174 | // test replacement 175 | $es[1]->innertext = 'okok'; 176 | assert($es[1]->outertext=='
                    okok
                    '); 177 | assert($es[0]->outertext=='
                    okok
                    '); 178 | assert($dom=='
                    okok
                    '); 179 | 180 | $es[1]->class = 'class_test'; 181 | assert($es[1]->outertext=='
                    okok
                    '); 182 | assert($es[0]->outertext=='
                    okok
                    '); 183 | assert($dom=='
                    okok
                    '); 184 | 185 | $es[0]->class = 'class_test'; 186 | assert($es[0]->outertext=='
                    okok
                    '); 187 | assert($dom=='
                    okok
                    '); 188 | 189 | $es[0]->innertext = 'okokok'; 190 | assert($es[0]->outertext=='
                    okokok
                    '); 191 | assert($dom=='
                    okokok
                    '); 192 | 193 | // ----------------------------------------------------------------------------- 194 | //

                    test 195 | $str = << 197 |

                    ok0link0

                    198 | 199 |
                    200 |

                    ok2link2

                    201 | 202 | HTML; 203 | $dom->load($str); 204 | $es = $dom->find('p'); 205 | assert($es[0]->innertext=='ok0link0'); 206 | assert($es[1]->innertext=='ok1link1'); 207 | assert($es[2]->innertext=='ok2link2'); 208 | assert($dom->find('p', 0)->plaintext=='ok0link0'); 209 | assert($dom->find('p', 1)->plaintext=='ok1link1'); 210 | assert($dom->find('p', 2)->plaintext=='ok2link2'); 211 | 212 | $count = 0; 213 | foreach($dom->find('p') as $p) { 214 | $a = $p->find('a'); 215 | assert($a[0]->innertext=='link'.$count); 216 | ++$count; 217 | } 218 | 219 | $es = $dom->find('p a'); 220 | assert($es[0]->innertext=='link0'); 221 | assert($es[1]->innertext=='link1'); 222 | assert($es[2]->innertext=='link2'); 223 | assert($dom->find('p a', 0)->plaintext=='link0'); 224 | assert($dom->find('p a', 1)->plaintext=='link1'); 225 | assert($dom->find('p a', 2)->plaintext=='link2'); 226 | 227 | assert($dom==$str); 228 | 229 | // ----------------------------------------------------------------------------- 230 | // test 231 | $str = << 235 | HTML; 236 | $dom->load($str); 237 | $e = $dom->find('embed', 0); 238 | assert($e->src=='../graphics/sounds/1812over.mid'); 239 | assert($e->height=='60'); 240 | assert($e->width=='144'); 241 | assert($dom==strtolower($str)); 242 | 243 | // ----------------------------------------------------------------------------- 244 | // tear down 245 | $dom->clear(); 246 | unset($dom); 247 | ?> --------------------------------------------------------------------------------