27 public $hList = array();
28 public $noRows = FALSE;
29 public $emptyTable = FALSE;
33 function __construct($page,$tblId,$title=1)
35 if (empty ($page)) {
return; }
37 if (strlen($tblId) == 0) {
return; }
38 $this->tableId = $tblId;
39 $this->title = $title;
63 $dom =
new domDocument;
64 @$dom->loadHTML($this->page);
66 $dom->preserveWhiteSpace =
false;
67 $table = $dom->getElementById($this->tableId);
69 $this->emptyTable = TRUE;
71 return($this->hList=array());
74 foreach ($table->childNodes as $tblChildNode)
77 foreach($tblChildNode->childNodes as $childNode){
78 if($childNode->nodeName ==
'td'){
79 if(is_numeric($childNode->nodeValue)) {
80 $histogram[
'count'] =
trim($childNode->nodeValue);
82 if ($childNode->nodeValue ==
'Show') {
83 $anchorList = $childNode->getElementsByTagName(
'a');
84 foreach($anchorList as $anchorEle) {
85 $histogram[
'showLink'] = $anchorEle->getAttribute(
'href');
88 if(is_string($childNode->nodeValue)) {
89 $histogram[
'textOrLink'] =
trim($childNode->nodeValue);
93 $this->hList[] = $histogram;
101 unset($this->hList[0]);
103 if(empty($this->hList)) {
104 $this->noRows = TRUE;
parseLicenseTbl()
given a fossology license histogram, parse it into license names and Show links.
char * trim(char *ptext)
Trimming whitespace.