FOSSology  4.4.0
Open Source License Compliance by Open Source Software
parseLicenseTbl.php
1 <?php
2 /*
3 SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
4 
5 SPDX-License-Identifier: GPL-2.0-only
6 */
7 
25 {
26  public $page;
27  private $test;
28 
29  function __construct($page)
30  {
31  if (empty ($page)) { return; }
32  $this->page = $page;
33  }
42  function parseLicenseTbl()
43  {
44  /*
45  * old pattern
46  * "|.*?align='right'.*?align='center'><a href='(.*?)'> (. *?)<. *? id='(.*?)'.*?a href=\"(.*?)\">(.*?)<|";
47  */
48  $pat = "|.*?align='right'.*?<a href='(.*?)'>(.*?)<.*?id='(.*?)'>(.*?)<|";
49  $matches = preg_match_all($pat, $this->page, $tableEntries, PREG_PATTERN_ORDER);
50  //print "PLTBL: tableEntries are:\n"; print_r($tableEntries) . "\n";
51  $rtnList = array ();
52  if ($matches > 0)
53  {
54  $numTblEntries = count($tableEntries[1]);
55  for ($i = 0; $i <= $numTblEntries-1; $i++)
56  {
57  $cleanName = trim($tableEntries[4][$i]);
58  $rtnList[$cleanName] = $tableEntries[1][$i];
59  }
60  //print "PLTBL: returning this array:\n"; print_r($rtnList) . "\n";
61  return ($rtnList);
62  }
63  else
64  {
65  return (array ());
66  }
67  }
68 }
char * trim(char *ptext)
Trimming whitespace.
Definition: fossconfig.c:690