From: Maxious Date: Tue, 20 Nov 2012 02:31:00 +0000 Subject: more ausbudget work X-Git-Url: https://maxious.lambdacomplex.org/git/?p=disclosr.git&a=commitdiff&h=17426c2449b541d0c40ae06d976a3a746385f0c3 --- more ausbudget work Former-commit-id: 1ec1907af829318fa6e8e3ac107f21b4a5c10fad --- --- a/admin/ausbudget/importAusbudget.php +++ /dev/null @@ -1,7 +1,1 @@ -body); - phpQuery::selectDocument($html); - foreach (pq('meta')->elements as $meta) { - - --- /dev/null +++ b/admin/importAusbudget.php @@ -1,1 +1,51 @@ +tagName) || $Node->tagName == null) { + return $Text . $Node->textContent; + } + $Node = $Node->firstChild; + if (isset($Node) && $Node != null) { + $Text = getTextFromNode($Node, $Text); + } + while (isset($Node->nextSibling) && $Node->nextSibling != null) { + $Text = getTextFromNode($Node->nextSibling, $Text); + $Node = $Node->nextSibling; + } + return $Text; +} + +$dir = "./ausbudget/"; +$dhandle = opendir("./ausbudget/"); +// define an array to hold the files +$files = array(); +if ($dhandle) { + // loop through all of the files + while (false !== ($fname = readdir($dhandle))) { + if (($fname != '.') && ($fname != '..')) { + echo "$fname
"; + $html = phpQuery::newDocumentHTML(file_get_contents($dir . $fname)); + phpQuery::selectDocument($html); + foreach (pq('table')->elements as $table) { + echo "loltable"; + //echo $table->ownerDocument->saveXML($table); + foreach (pq('tr')->elements as $row) { + echo "lolrow"; + $rowText = getTextFromNode($row); + if (strpos($rowText,"Twitter") === false) { + echo "".pq("td:first",$row)->text()."
"; + echo pq("td",$row)->text() . "
"; + } + } + } + } + break; + } +} +?> +