' . htmlentities( $title) . '
'; 58 | 59 | ?> 60 | ``` 61 | 62 | ==== 63 | 64 | Source for test.html: 65 | 66 | ```html 67 | 68 | 69 | 70 | 71 |phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | |
35 |
36 |
|
87 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | |
35 |
36 |
|
85 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | Files: 35 |
36 | Callback.php
37 | 38 | DOMDocumentWrapper.php 39 | 40 | DOMEvent.php 41 | 42 | phpQuery.php 43 | 44 | phpQueryEvents.php 45 | 46 | phpQueryObject.php 47 | 48 | 49 | 50 | 51 | Classes: 52 |
53 | Callback
63 | 54 | CallbackParam 55 | CallbackReference 56 | DOMDocumentWrapper 57 | DOMEvent 58 | phpQuery 59 | phpQueryEvents 60 | phpQueryObject 61 | phpQueryPlugins 62 | |
64 |
65 |
|
77 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | Files: 35 |
36 | Callback.php
37 | 38 | DOMDocumentWrapper.php 39 | 40 | DOMEvent.php 41 | 42 | phpQuery.php 43 | 44 | phpQueryEvents.php 45 | 46 | phpQueryObject.php 47 | 48 | 49 | 50 | 51 | Classes: 52 |
53 | Callback
63 | 54 | CallbackParam 55 | CallbackReference 56 | DOMDocumentWrapper 57 | DOMEvent 58 | phpQuery 59 | phpQueryEvents 60 | phpQueryObject 61 | phpQueryPlugins 62 | |
64 |
65 |
|
77 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | Files: 35 |
36 | Callback.php
37 | 38 | DOMDocumentWrapper.php 39 | 40 | DOMEvent.php 41 | 42 | phpQuery.php 43 | 44 | phpQueryEvents.php 45 | 46 | phpQueryObject.php 47 | 48 | 49 | 50 | 51 | Classes: 52 |
53 | Callback
63 | 54 | CallbackParam 55 | CallbackReference 56 | DOMDocumentWrapper 57 | DOMEvent 58 | phpQuery 59 | phpQueryEvents 60 | phpQueryObject 61 | phpQueryPlugins 62 | |
64 |
65 |
|
118 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | Files: 35 |
36 | Callback.php
37 | 38 | DOMDocumentWrapper.php 39 | 40 | DOMEvent.php 41 | 42 | phpQuery.php 43 | 44 | phpQueryEvents.php 45 | 46 | phpQueryObject.php 47 | 48 | 49 | 50 | 51 | Classes: 52 |
53 | Callback
63 | 54 | CallbackParam 55 | CallbackReference 56 | DOMDocumentWrapper 57 | DOMEvent 58 | phpQuery 59 | phpQueryEvents 60 | phpQueryObject 61 | phpQueryPlugins 62 | |
64 |
65 |
|
230 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | Files: 35 |
36 | Callback.php
37 | 38 | DOMDocumentWrapper.php 39 | 40 | DOMEvent.php 41 | 42 | phpQuery.php 43 | 44 | phpQueryEvents.php 45 | 46 | phpQueryObject.php 47 | 48 | 49 | 50 | 51 | Classes: 52 |
53 | Callback
63 | 54 | CallbackParam 55 | CallbackReference 56 | DOMDocumentWrapper 57 | DOMEvent 58 | phpQuery 59 | phpQueryEvents 60 | phpQueryObject 61 | phpQueryPlugins 62 | |
64 |
65 |
|
95 |
phpQuery | 11 |
![]() |
14 |
17 | 18 | 19 | [ class tree: phpQuery ] 20 | [ index: phpQuery ] 21 | [ all elements ] 22 | | 23 |
![]() |
26 |
32 |
33 |
34 |
35 | Packages:36 | phpQuery 37 | 38 | Files: 39 | 40 |
41 | Callback.php
42 |
54 | 43 | DOMDocumentWrapper.php 44 | 45 | DOMEvent.php 46 | 47 | phpQuery.php 48 | 49 | phpQueryEvents.php 50 | 51 | phpQueryObject.php 52 | 53 | 55 | 56 | 57 | x 58 | 59 | 60 | dasdasdsa 61 | 62 |
64 |
65 | Callback
75 | 66 | CallbackParam 67 | CallbackReference 68 | DOMDocumentWrapper 69 | DOMEvent 70 | phpQuery 71 | phpQueryEvents 72 | phpQueryObject 73 | phpQueryPlugins 74 | |
76 |
77 |
78 |
|
110 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | Files: 35 |
36 | Callback.php
37 | 38 | DOMDocumentWrapper.php 39 | 40 | DOMEvent.php 41 | 42 | phpQuery.php 43 | 44 | phpQueryEvents.php 45 | 46 | phpQueryObject.php 47 | 48 | 49 | 50 | 51 | Classes: 52 |
53 | Callback
63 | 54 | CallbackParam 55 | CallbackReference 56 | DOMDocumentWrapper 57 | DOMEvent 58 | phpQuery 59 | phpQueryEvents 60 | phpQueryObject 61 | phpQueryPlugins 62 | |
64 |
65 |
|
91 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | Files: 35 |
36 | Callback.php
37 | 38 | DOMDocumentWrapper.php 39 | 40 | DOMEvent.php 41 | 42 | phpQuery.php 43 | 44 | phpQueryEvents.php 45 | 46 | phpQueryObject.php 47 | 48 | 49 | 50 | 51 | Classes: 52 |
53 | Callback
63 | 54 | CallbackParam 55 | CallbackReference 56 | DOMDocumentWrapper 57 | DOMEvent 58 | phpQuery 59 | phpQueryEvents 60 | phpQueryObject 61 | phpQueryPlugins 62 | |
64 |
65 |
|
219 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | Files: 35 |
36 | Callback.php
37 | 38 | DOMDocumentWrapper.php 39 | 40 | DOMEvent.php 41 | 42 | phpQuery.php 43 | 44 | phpQueryEvents.php 45 | 46 | phpQueryObject.php 47 | 48 | 49 | 50 | 51 | Classes: 52 |
53 | Callback
63 | 54 | CallbackParam 55 | CallbackReference 56 | DOMDocumentWrapper 57 | DOMEvent 58 | phpQuery 59 | phpQueryEvents 60 | phpQueryObject 61 | phpQueryPlugins 62 | |
64 |
65 |
|
91 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | Files: 35 |
36 | Callback.php
37 | 38 | DOMDocumentWrapper.php 39 | 40 | DOMEvent.php 41 | 42 | phpQuery.php 43 | 44 | phpQueryEvents.php 45 | 46 | phpQueryObject.php 47 | 48 | 49 | 50 | 51 | Classes: 52 |
53 | Callback
63 | 54 | CallbackParam 55 | CallbackReference 56 | DOMDocumentWrapper 57 | DOMEvent 58 | phpQuery 59 | phpQueryEvents 60 | phpQueryObject 61 | phpQueryPlugins 62 | |
64 |
65 |
|
91 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | Files: 35 |
36 | Callback.php
37 | 38 | DOMDocumentWrapper.php 39 | 40 | DOMEvent.php 41 | 42 | phpQuery.php 43 | 44 | phpQueryEvents.php 45 | 46 | phpQueryObject.php 47 | 48 | 49 | 50 | 51 | Classes: 52 |
53 | Callback
63 | 54 | CallbackParam 55 | CallbackReference 56 | DOMDocumentWrapper 57 | DOMEvent 58 | phpQuery 59 | phpQueryEvents 60 | phpQueryObject 61 | phpQueryPlugins 62 | |
64 |
65 |
|
188 |
phpQuery | 11 |
![]() |
15 | 16 | 17 | [ class tree: phpQuery ] 18 | [ index: phpQuery ] 19 | [ all elements ] 20 | | 21 |
![]() |
28 |
29 |
30 |
31 | Packages:32 | phpQuery 33 | 34 | 35 | 36 | |
37 |
38 |
|
157 |
Test: żźć
3 |This is an example of an
4 | XHTML 1.0 Strict document.
5 |
8 |
15 |
Test: żźć
19 |This is an example of an
20 | XHTML 1.0 Strict document.
21 |
24 |
31 |
Test: żźć
24 |This is an example of an
25 | XHTML 1.0 Strict document.
26 |
29 |
36 |
This is paragraph of first LI
18 |19 | this is example title 20 |
21 |22 | this is example body 23 |
24 |This is paragraph of second LI
27 |28 | this is example title 2 29 |
30 |31 | this is example body 2 32 |
33 |This is paragraph of third LI
36 |There isnt any title
37 |38 | this is example body 3 39 |
40 |paragraph after UL
43 |"; 57 | print $result; 58 | print "\n"; 59 | } -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_4.php: -------------------------------------------------------------------------------- 1 | find('li') 11 | ->slice(1, 2); 12 | if ( $result->whois() == $testResult ) 13 | print "Test 'Slice1' PASSED :)"; 14 | else { 15 | print "Test 'Slice1' FAILED !!! "; 16 | print "
"; 17 | print_r($result->whois()); 18 | print "\n"; 19 | } 20 | print "\n"; 21 | 22 | // SLICE2 23 | $testResult = array( 24 | 'li#testID', 25 | 'li', 26 | 'li#i_have_nested_list', 27 | 'li.nested', 28 | ); 29 | $result = phpQuery::newDocumentFile('test.html') 30 | ->find('li') 31 | ->slice(1, -1); 32 | if ( $result->whois() == $testResult ) 33 | print "Test 'Slice2' PASSED :)"; 34 | else { 35 | print "Test 'Slice2' FAILED !!! "; 36 | print "
"; 37 | print_r($result->whois()); 38 | print "\n"; 39 | } 40 | print "\n"; 41 | 42 | // Multi-insert 43 | $result = phpQuery::newDocument('
"; 53 | var_dump($result->htmlOuter()); 54 | print "\n"; 55 | } 56 | print "\n"; 57 | 58 | // INDEX 59 | $testResult = 1; 60 | $result = phpQuery::newDocumentFile('test.html') 61 | ->find('p') 62 | ->index(pq('p.title:first')); 63 | if ( $result == $testResult ) 64 | print "Test 'Index' PASSED :)"; 65 | else { 66 | print "Test 'Index' FAILED !!! "; 67 | } 68 | print "\n"; 69 | 70 | // CLONE 71 | $testName = 'Clone'; 72 | $testResult = 3; 73 | $document; 74 | $p = phpQuery::newDocumentFile('test.html') 75 | ->toReference($document) 76 | ->find('p:first'); 77 | foreach(array(0,1,2) as $i) { 78 | $p->clone() 79 | ->addClass("clone-test") 80 | ->addClass("class-$i") 81 | ->insertBefore($p); 82 | } 83 | if (pq('.clone-test')->size() == $testResult) 84 | print "Test '$testName' PASSED :)"; 85 | else { 86 | print "Test '$testName' FAILED !!! "; 87 | } 88 | print "\n"; 89 | 90 | // SIBLINGS 91 | $testName = 'Next'; 92 | $testResult = 3; 93 | $document; 94 | $result = phpQuery::newDocumentFile('test.html') 95 | ->find('li:first') 96 | ->next() 97 | ->next() 98 | ->prev() 99 | ->is('#testID'); 100 | if ($result) 101 | print "Test '$testName' PASSED :)"; 102 | else { 103 | print "Test '$testName' FAILED !!! "; 104 | } 105 | print "\n"; 106 | ?> 107 | 108 | 109 | addClass('newClass'); 9 | } 10 | function methodCallback($node) { 11 | pq($node)->addClass('newClass'); 12 | } 13 | } 14 | function functionCallback($node) { 15 | pq($node)->addClass('newClass'); 16 | } 17 | $testResult = array( 18 | 'li.newClass', 19 | 'li#testID.newClass', 20 | 'li.newClass', 21 | 'li#i_have_nested_list.newClass', 22 | 'li.nested.newClass', 23 | 'li.second.newClass', 24 | ); 25 | $tests = array( 26 | 'functionCallback', 27 | array('callbackClass', 'staticMethodCallback'), 28 | array(new callbackClass, 'methodCallback') 29 | ); 30 | foreach($tests as $test) { 31 | $result = phpQuery::newDocumentFile('test.html') 32 | ->find('li') 33 | ->each($test); 34 | $testName = is_array($test) 35 | ? $test[1] 36 | : $test; 37 | if ( $result->whois() == $testResult ) 38 | print "Test '$testName' PASSED :)"; 39 | else { 40 | print "Test '$testName' FAILED !!! "; 41 | print "
"; 42 | print_r($result->whois()); 43 | print "\n"; 44 | } 45 | print "\n"; 46 | } 47 | ?> -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_ajax.php: -------------------------------------------------------------------------------- 1 | 'http://wikipedia.org/', 17 | // 'success' => 'v87shs79d8fhs9d' 18 | //)); 19 | //function v87shs79d8fhs9d($html) { 20 | // $title = phpQuery::newDocument($html)->find('title'); 21 | // $testName = 'Simple AJAX'; 22 | // if ( strpos(strtolower($title->html()), 'wikipedia') !== false ) 23 | // print "Test '$testName' PASSED :)"; 24 | // else { 25 | // print "Test '$testName' FAILED !!! "; 26 | // print "
"; 27 | // print_r($title->whois()); 28 | // print "\n"; 29 | // } 30 | // print "\n"; 31 | //} 32 | 33 | 34 | $testName = 'Load'; 35 | $test = phpQuery::newDocumentFile('test.html') 36 | ->find('div:first') 37 | ->load('http://wikipedia.org/ div[lang]'); 38 | if (pq('div[lang]')->size()) 39 | print "Test '$testName' PASSED :)"; 40 | else { 41 | print "Test '$testName' FAILED !!! "; 42 | print "
"; 43 | print "\n"; 44 | } 45 | print "\n"; 46 | 47 | 48 | // http://code.google.com/p/phpquery/issues/detail?id=130 49 | $pq = phpQuery::ajax(array( 50 | 'url' => 'http://'.$_SERVER['SERVER_NAME'].preg_replace('@/[^/]+$@', '/test_ajax_data_1', $_SERVER['REQUEST_URI']), 51 | 'success' => 'a789fhasdui3124', 52 | 'error' => 'jhdbg786213u8dsfg7y' 53 | )); 54 | function a789fhasdui3124($html) { 55 | $testName = 'AJAX request text node'; 56 | if ( $html == 'hello world' ) 57 | print "Test '$testName' PASSED :)"; 58 | else { 59 | print "Test '$testName' FAILED !!! "; 60 | } 61 | print "\n"; 62 | } 63 | 64 | function jhdbg786213u8dsfg7y() { 65 | $testName = 'AJAX request text node'; 66 | print "Test '$testName' FAILED !!! "; 67 | } 68 | 69 | 70 | //$testName = 'gdata plugin'; 71 | //phpQuery::extend('gdata'); 72 | //$xhr = phpQuery::$plugins->gdata('tobiasz.cudnik@gmail.com', 'XXX'); 73 | //$url = 'http://code.google.com/p/phpquery/w/edit/Callbacks'; 74 | //phpQuery::ajax(array('url' => $url, 'success' => 'ksjsdgh892jh23'), $xhr); 75 | //function ksjsdgh892jh23($html) { 76 | // print $html; 77 | // print pq($html)->find('script')->remove()->end(); 78 | // if (pq('div[lang]')->size()) 79 | // print "Test '$testName' PASSED :)"; 80 | // else { 81 | // print "Test '$testName' FAILED !!! "; 82 | // print "
"; 83 | // print "\n"; 84 | // } 85 | // print "\n"; 86 | //} -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_ajax_data_1: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_arrayaccess.php: -------------------------------------------------------------------------------- 1 | append('test'); 12 | $testName = 'Array Access get'; 13 | if (trim($testHtml['.just-added']->html()) == 'test') 14 | print "Test '$testName' PASSED :)"; 15 | else { 16 | print "Test '$testName' FAILED !!! "; 17 | print "
"; 18 | print_r($testHtml['.just-added']->whois()); 19 | print "\n"; 20 | } 21 | print "\n"; 22 | 23 | require_once('../phpQuery/phpQuery.php'); 24 | phpQuery::$debug = true; 25 | $testHtml = phpQuery::newDocumentFile('test.html'); 26 | $testHtml['li:first'] = 'new inner html'; 27 | $testName = 'Array Access set'; 28 | if (trim($testHtml['li:first']->html()) == 'new inner html') 29 | print "Test '$testName' PASSED :)"; 30 | else { 31 | print "Test '$testName' FAILED !!! "; 32 | print "
"; 33 | print_r($testHtml['.just-added']->whois()); 34 | print "\n"; 35 | } 36 | print "\n"; 37 | -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_attr.php: -------------------------------------------------------------------------------- 1 | find('p[rel]:first') 9 | ->attr('rel', $expected); 10 | if ($result->attr('rel') == $expected) 11 | print "Test '{$testName}' passed :)"; 12 | else 13 | print "Test '{$testName}' FAILED !!!"; 14 | print "\n"; 15 | 16 | 17 | $testName = 'Attribute change in iteration'; 18 | $expected = 'new attr value'; 19 | $doc = phpQuery::newDocumentFile('test.html'); 20 | foreach($doc['p[rel]:first'] as $p) 21 | pq($p)->attr('rel', $expected); 22 | if ($doc['p[rel]:first']->attr('rel') == $expected) 23 | print "Test '{$testName}' passed :)"; 24 | else 25 | print "Test '{$testName}' FAILED !!!"; 26 | print "\n"; -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_callback.php: -------------------------------------------------------------------------------- 1 | array($this, 'callback1'), 18 | 'newMethod2' => array($this, 'callback2'), 19 | ); 20 | phpQuery::extend('phpQueryObject', $newMethods); 21 | $doc = phpQuery::newDocumentXML(""); 22 | $this->assertTrue($doc->newMethod1() == $doc, 23 | '$doc->newMethod1 == $doc'); 24 | $this->assertTrue($doc->newMethod2() == "callback2", 25 | '$doc->newMethod1 == "callback2"'); 26 | } 27 | } -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_charset.php: -------------------------------------------------------------------------------- 1 | 2 | find('li:first') 9 | ->find('p:first') 10 | ->html('żźć'); 11 | if (trim($result->html()) == 'żźć') 12 | print "Test '{$testName}' passed :)
"; 93 | //print $result; 94 | //print "\n"; -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_document.php: -------------------------------------------------------------------------------- 1 | find('li:first')->html('foo
bar
foo foo')->html(); 10 | die(); 11 | $testResult = 10; 12 | if ($doc->script('example', 'p')->length == $testResult) 13 | print "Test '$testName' PASSED :)"; 14 | else { 15 | print "Test '$testName' FAILED !!! "; 16 | print ""; 17 | var_dump($doc->whois()); 18 | print "\n"; 19 | } 20 | print "\n"; -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_events.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | EOF; 16 | $doc = phpQuery::newDocumentHTML($form); 17 | $inputs = $doc['form > *']; 18 | // creates array from input names 19 | // $results = $inputs->get(null, 20 | // create_function('$node', 'return $node->getAttribute("name");') 21 | // ); 22 | $results = array(); 23 | foreach($inputs as $node) { 24 | $node = pq($node); 25 | $name = $node->attr('name'); 26 | $results[$name] = false; 27 | $node->change( 28 | new CallbackReference($results[$name]) 29 | ); 30 | } 31 | $inputs 32 | ->not('select,:checkbox,:radio') 33 | ->val('new value') 34 | ->end() 35 | ->filter('select') 36 | ->val('first') 37 | ->end() 38 | ->filter(':checkbox') 39 | ->val(array('foo')) 40 | ->end() 41 | ->filter(':radio') 42 | ->val(array('foo')) 43 | ->end() 44 | ; 45 | foreach($results as $name => $result) { 46 | print $result 47 | ? "Test for '$name' PASSED :)
test p
"; 13 | $doc['body > p:last']->append($markup); 14 | if ($doc['body > p:last p']->length == 1) 15 | print "Test '{$testName}' PASSED :)"; 16 | else { 17 | print "Test '{$testName}' FAILED !!! "; 18 | print $doc->htmlOuter('htmlspecialchars'); 19 | } 20 | print "\n"; -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_manipulation.php: -------------------------------------------------------------------------------- 1 | 9 | div.articles text node 10 |This is paragraph of first LI
14 |News 1 title
15 |News 1 body
16 |This is paragraph of first LI
20 |News 2 title
21 |News 2 body
22 |This is paragraph of first LI
25 |News 3
26 |News 3 body
27 |paragraph after UL
30 | 31 | EOF; 32 | $rows = array( 33 | array( 34 | 'title' => 'News 1 title', 35 | 'body' => 'News 1 body', 36 | ), 37 | array( 38 | 'title' => 'News 2 title', 39 | 'body' => 'News 2 body', 40 | ), 41 | array( 42 | 'title' => 'News 3', 43 | 'body' => 'News 3 body', 44 | ), 45 | ); 46 | phpQuery::newDocumentFile('test.html'); 47 | $articles = pq('.articles ul'); 48 | $rowSrc = $articles->find('li') 49 | ->remove() 50 | ->eq(0); 51 | foreach( $rows as $r ) { 52 | $row = $rowSrc->_clone(); 53 | foreach( $r as $field => $value ) { 54 | $row->find(".{$field}") 55 | ->html($value); 56 | // die($row->htmlOuter()); 57 | } 58 | $row->appendTo($articles); 59 | } 60 | $result = pq('.articles')->htmlOuter(); 61 | //print htmlspecialchars("{$result}").'
Éditorial de l\'institution Saint-Pierre.
118 | Hors paragraphe.'; 119 | $doc->find('p')->html($string); 120 | if (pq('img')->length == 1) { 121 | print "Test '{$testName}' PASSED :)"; 122 | print $doc->htmlOuter(); 123 | } else { 124 | print "Test '{$testName}' FAILED !!! "; 125 | print $doc->htmlOuter('htmlentities'); 126 | } 127 | print "\n"; 128 | 129 | 130 | 131 | 132 | $testName = 'Text insertion'; 133 | $doc = phpQuery::newDocument('9 | this is example title 10 |
"); 11 | $result = pq('p:eq(1)'); 12 | if ( $result->hasClass('newTitle') ) 13 | print "Test '{$testName}' PASSED :)"; 14 | else 15 | print "Test '{$testName}' FAILED !!! "; 16 | $result->dump(); 17 | print "\n"; 18 | 19 | 20 | 21 | $testName = 'ReplaceAll'; 22 | $testResult = 3; 23 | phpQuery::newDocumentFile('test.html'); 24 | pq('"; 16 | var_dump($doc->whois()); 17 | print "\n"; 18 | } 19 | print "\n"; 20 | 21 | 22 | $testName = 'Scripts/gmail_login'; 23 | $testResult = 1; 24 | $url = 'http://code.google.com/p/phpquery/w/edit/MultiDocumentSupport'; 25 | //phpQuery::ajaxAllowURL($url); 26 | $editor = phpQuery::newDocument('') 27 | ->script('google_login') 28 | ->location($url); 29 | if ($editor->find('textarea#content')->length == $testResult) 30 | print "Test '$testName' PASSED :)"; 31 | else { 32 | print "Test '$testName' FAILED !!! "; 33 | print "
"; 34 | var_dump($doc->whois()); 35 | print "\n"; 36 | } 37 | print "\n"; 38 | ?> -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_selectors.php: -------------------------------------------------------------------------------- 1 | li:first ~ *', 105 | array( 106 | 'li#testID', 107 | 'li', 108 | ) 109 | ), 110 | // CSS3 pseudoclasses 111 | array( 112 | 'li:only-child', 113 | array( 114 | 'li.nested', 115 | ) 116 | ), 117 | array( 118 | 'p[rel=test]:parent', 119 | array( 120 | 'p', 121 | 'p', 122 | ) 123 | ), 124 | array( 125 | 'li:first-child', 126 | array( 127 | 'li', 128 | 'li#i_have_nested_list', 129 | 'li.nested', 130 | ) 131 | ), 132 | array( 133 | ':last-child', 134 | array( 135 | 'html', 136 | 'script', 137 | 'body', 138 | 'p.body', 139 | 'p.body', 140 | 'li', 141 | 'p.body', 142 | 'p.after', 143 | 'ul', 144 | 'ul', 145 | 'li.nested', 146 | 'li.second', 147 | ) 148 | ), 149 | array( 150 | ':nth-child(1n+1)', 151 | array( 152 | 'html', 153 | 'head', 154 | 'meta', 155 | 'div.articles', 156 | 'ul', 157 | 'li', 158 | 'p', 159 | 'p', 160 | 'p', 161 | 'li#i_have_nested_list', 162 | 'ul', 163 | 'li.nested', 164 | ) 165 | ), 166 | array( 167 | ':nth-child(3n+6)', 168 | array( 169 | 'script', 170 | 'p.body', 171 | 'p.body', 172 | 'li', 173 | 'p.body', 174 | ) 175 | ), 176 | array( 177 | ':nth-child(2n)', 178 | array( 179 | 'title', 180 | 'script', 181 | 'body', 182 | 'p.title', 183 | 'li#testID', 184 | 'p.title', 185 | 'p.noTitle', 186 | 'p.after', 187 | 'ul', 188 | 'li.second', 189 | ) 190 | ), 191 | array( 192 | ':nth-child(1)', 193 | array( 194 | 'html', 195 | 'head', 196 | 'meta', 197 | 'div.articles', 198 | 'ul', 199 | 'li', 200 | 'p', 201 | 'p', 202 | 'p', 203 | 'li#i_have_nested_list', 204 | 'ul', 205 | 'li.nested', 206 | ) 207 | ), 208 | array( 209 | ':nth-child(odd)', 210 | array( 211 | 'html', 212 | 'head', 213 | 'meta', 214 | 'script', 215 | 'div.articles', 216 | 'ul', 217 | 'li', 218 | 'p', 219 | 'p.body', 220 | 'p', 221 | 'p.body', 222 | 'li', 223 | 'p', 224 | 'p.body', 225 | 'li#i_have_nested_list', 226 | 'ul', 227 | 'li.nested', 228 | ) 229 | ), 230 | array( 231 | ':nth-child(even)', 232 | array( 233 | 'title', 234 | 'script', 235 | 'body', 236 | 'p.title', 237 | 'li#testID', 238 | 'p.title', 239 | 'p.noTitle', 240 | 'p.after', 241 | 'ul', 242 | 'li.second', 243 | ) 244 | ), 245 | array( 246 | ':empty', 247 | array( 248 | 'meta', 249 | 'script', 250 | 'script', 251 | 'li.nested', 252 | ) 253 | ), 254 | 255 | 256 | // array( 257 | // '', 258 | // array( 259 | // '', 260 | // ) 261 | // ), 262 | // array( 263 | // '', 264 | // array( 265 | // '', 266 | // ) 267 | // ), 268 | // array( 269 | // '', 270 | // array( 271 | // '', 272 | // ) 273 | // ), 274 | ); 275 | 276 | phpQuery::newDocumentFile('test.html'); 277 | foreach( $tests as $k => $test ) { 278 | $tests[ $k ][2] = pq( $test[0] )->whois(); 279 | } 280 | foreach( $tests as $test ) { 281 | if ( $test[1] == $test[2] ) 282 | print "Test '{$test[0]}' PASSED :)"; 283 | else { 284 | print "Test '{$test[0]}' FAILED !!!"; 285 | print_r($test[2]); 286 | } 287 | print "
"; 79 | // print_r($result->whois()); 80 | // print "\n"; 81 | // } 82 | // print "\n"; 83 | ?> -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/test-cases/test_wrap.php: -------------------------------------------------------------------------------- 1 | find('p') 8 | ->slice(1, 3); 9 | $p->wrap('
Test
hors paragraphe') 59 | ->contents() 60 | ->not('[nodeType=1]') 61 | ->wrap(''); 62 | var_dump((string)$doc); 63 | */ 64 | //$testResult = 3; 65 | //phpQuery::newDocumentFile('test.html') 66 | // ->find('li:first') 67 | // ->wrapInner('"; 22 | print_r($return); 23 | print ""; 24 | } 25 | ?> -------------------------------------------------------------------------------- /demo/vendor/electrolinux/phpquery/unit-tests/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
This is paragraph of first LI
18 |19 | this is example title 20 |
21 |22 | this is example body 23 |
24 |This is paragraph of second LI
27 |28 | this is example title 2 29 |
30 |31 | this is example body 2 32 |
33 |This is paragraph of third LI
36 |There isnt any title
37 |38 | this is example body 3 39 |
40 |paragraph after UL
43 |This is paragraph of first LI
154 |News 1 title
155 |News 1 body
156 |This is paragraph of first LI
160 |News 2 title
161 |News 2 body
162 |This is paragraph of first LI
165 |News 3
166 |News 3 body
167 |paragraph after UL
170 |{$result}").'