FOSSology  4.4.0
Open Source License Compliance by Open Source Software
parsePgLinks.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 
22 {
23  public $page;
24  private $test;
25 
26  function __construct($page)
27  {
28  if (empty ($page))
29  {
30  return;
31  }
32  $this->page = $page;
33  }
44  function parsePgLinks()
45  {
46  // The line below is great for pasring hrefs out of a page, from the net
47  $regExp = "<a\s[^>]*href=(\'??)([^\'>]*?)\\1[^>]*>(.*)<\/a>";
48  $matches = preg_match_all("|$regExp|iU", $this->page, $links, PREG_SET_ORDER);
49  print "links are:\n";
50  print_r($links) . "\n";
51  //$lstFilesLic[] = $this->_createRtnArray($pathList, $matches);
52  //return ($lstFilesLic);
53  }
54  function _createRtnArray($list, $matches)
55  {
56  /*
57  * if we have a match, the create return array, else return empty
58  * array
59  */
60  if ($matches > 0)
61  {
62  $numPaths = count($list[3]);
63  //print "numPaths is:$numPaths\n";
64  //print "list is:\n";
65  //print_r($list) . "\n";
66 
67  $rtnList = array ();
68  for ($i = 0; $i <= $numPaths -1; $i++)
69  {
70  $cleanKey = trim($list[3][$i], "\/<>b");
71  $rtnList[$cleanKey] = $list[2][$i];
72  }
73  return ($rtnList);
74  } else
75  {
76  return (array ());
77  }
78  }
79 }
char * trim(char *ptext)
Trimming whitespace.
Definition: fossconfig.c:690