function dump_nodes($file, $node) { global $files; global $base; global $subdir; global $get; global $dest_dir; if (!$node->hasChildren()) { return; } foreach ($node->child as $child) { if (isset($child->id) && $child->id == TIDY_TAG_A) { $url = @$child->attribute['href']; if (!$url) { continue; } if (strstr($url, ':') === false) { if (substr($url, 0, 1) != '/') { $url = $base . '/' . $url; } else { $url = $base . $url; } } $a = parse_url($url); if (!$a) { continue; } if (@$a['scheme'] != 'http') { continue; } if (@$a['query']) { continue; } if (@$a['fragment']) { continue; } $b = pathinfo(@$a['path']); if (!$b) { continue; } $e = strtolower(@$b['extension']); if (!$e) { continue; } if (!isset($get[$e])) { continue; } $key = strtolower(basename($url)); $files[$key] = array('url' => $url, 'referer' => $file); } dump_nodes($file, $child); } }
function dump_nodes(tidyNode $node) { var_dump($node->hasChildren()); if ($node->hasChildren()) { foreach ($node->child as $c) { var_dump($c); if ($c->hasChildren()) { dump_nodes($c); } } } }
function dump_nodes(tidyNode $node, &$urls = NULL) { $urls = is_array($urls) ? $urls : array(); if (isset($node->id)) { if ($node->id == TIDY_TAG_A) { $urls[] = $node->attribute['href']; } } if ($node->hasChildren()) { foreach ($node->child as $c) { dump_nodes($c, $urls); } } return $urls; }
/** * A Helper function used for debugging to dump all the contents * of a Tidy Node. This function was for my own personal help when developing. */ function dump_nodes($node, $indent) { if ($node->hasChildren()) { foreach ($node->child as $child) { if ($child->attribute['class'] == 'test') { $node_value = new Node_Value(); echo "!!!!-" . $node_value->get_value($child) . "-!!!<br/>"; unset($node_value); } dump_nodes($child, $indent + 1); } } }