39 public $hList = array();
40 public $noRows = FALSE;
41 public $emptyTable = FALSE;
45 function __construct($page,$tblId,$title=1)
47 if (empty ($page)) {
return; }
49 if (strlen($tblId) == 0) {
return; }
50 $this->tableId = $tblId;
51 $this->title = $title;
75 $dom =
new domDocument;
76 @$dom->loadHTML($this->page);
78 $dom->preserveWhiteSpace =
false;
79 $table = $dom->getElementById($this->tableId);
81 $this->emptyTable = TRUE;
83 return($this->hList=array());
86 foreach ($table->childNodes as $tblChildNode)
89 foreach($tblChildNode->childNodes as $childNode){
90 if($childNode->nodeName ==
'td'){
91 if(is_numeric($childNode->nodeValue)) {
92 $histogram[
'count'] =
trim($childNode->nodeValue);
94 if ($childNode->nodeValue ==
'Show') {
95 $anchorList = $childNode->getElementsByTagName(
'a');
96 foreach($anchorList as $anchorEle) {
97 $histogram[
'showLink'] = $anchorEle->getAttribute(
'href');
100 if(is_string($childNode->nodeValue)) {
101 $histogram[
'textOrLink'] =
trim($childNode->nodeValue);
105 $this->hList[] = $histogram;
106 $histogram = array();
113 unset($this->hList[0]);
115 if(empty($this->hList)) {
116 $this->noRows = TRUE;
parseLicenseTbl()
given a fossology license histogram, parse it into license names and Show links.
char * trim(char *ptext)
Trimming whitespace.