FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
parseLicenseTbl.php
1 <?php
2 /***********************************************************
3  Copyright (C) 2008 Hewlett-Packard Development Company, L.P.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ***********************************************************/
18 
36 {
37  public $page;
38  private $test;
39 
40  function __construct($page)
41  {
42  if (empty ($page)) { return; }
43  $this->page = $page;
44  }
53  function parseLicenseTbl()
54  {
55  /*
56  * old pattern
57  * "|.*?align='right'.*?align='center'><a href='(.*?)'> (. *?)<. *? id='(.*?)'.*?a href=\"(.*?)\">(.*?)<|";
58  */
59  $pat = "|.*?align='right'.*?<a href='(.*?)'>(.*?)<.*?id='(.*?)'>(.*?)<|";
60  $matches = preg_match_all($pat, $this->page, $tableEntries, PREG_PATTERN_ORDER);
61  //print "PLTBL: tableEntries are:\n"; print_r($tableEntries) . "\n";
62  $rtnList = array ();
63  if ($matches > 0)
64  {
65  $numTblEntries = count($tableEntries[1]);
66  for ($i = 0; $i <= $numTblEntries-1; $i++)
67  {
68  $cleanName = trim($tableEntries[4][$i]);
69  $rtnList[$cleanName] = $tableEntries[1][$i];
70  }
71  //print "PLTBL: returning this array:\n"; print_r($rtnList) . "\n";
72  return ($rtnList);
73  }
74  else
75  {
76  return (array ());
77  }
78  }
79 }
80 ?>
char * trim(char *ptext)
Trimming whitespace.
Definition: fossconfig.c:695