-
Notifications
You must be signed in to change notification settings - Fork 0
/
AutoloadExample.php
56 lines (50 loc) · 1.51 KB
/
AutoloadExample.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace phpjim\parsers\ficbook;
/**
* This is just an example.
*/
class AutoloadExample extends \yii\base\Widget
{
public function run()
{
$file = file_get_contents('/var/www/lib.phpjim.ru/vendor/phpjim/parse-ficbook/test.html');
$work = new Work('/var/www/lib.phpjim.ru/vendor/phpjim/parse-ficbook/test.html');
//$work = new Work('http://ficbook.net/readfic/1003915');
$work->getData();
//$dom = new \DOMDocument();
// $dom->loadHTML($file);
//$divs = array();
//foreach($dom->getElementsByTagName('div') as $div){
/**
* @var $div \DOMElement
*/
//$class = explode(" ", $div->getAttribute('class'));
// }
return "Hello!";
}
}
//Loop through each <a> tag in the dom and add it to the link array
//foreach($xml->getElementsByTagName('div') as $link) {
// $class = explode(' ', $link->getAttribute('class'));
// if(!in_array('part_text', $class)){
// continue;
// }
// echo 1;
// var_dump(trim(get_inner_html($link)));
//
////var_dump($link->saveHTML());
// echo 1;
// foreach($link->childNodes as $item){
// //var_dump($item);
// }
// exit();
// $divs[] = array('class' => explode(' ', $link->getAttribute('class')));
//}
function get_inner_html( $node ) {
$innerHTML= '';
$children = $node->childNodes;
foreach ($children as $child) {
$innerHTML .= $child->ownerDocument->saveXML( $child );
}
return $innerHTML;
}