public function parse($string) { $parsed = array(); $parsedClean = array(); // first find all <a> tags $parsed = $this->subparser->parse($string); //X_Debug::i("Atoms found: ".count($parsed)); foreach ($parsed as $found) { try { $hoster = $this->helper->findHoster($found['href']); $parsedClean[] = array('hoster' => $hoster, 'url' => $found['href'], 'label' => strip_tags($found['label'])); } catch (Exception $e) { /* invalid href, ignored */ /*X_Debug::i("No hoster for link: {$found['href']}");*/ } } return $parsedClean; }
public function parse($string) { $parsed = array(); $parsedClean = array(); // first find all <a> tags //@file_put_contents(sys_get_temp_dir()."/last-http-request.html", $string); $parsed = $this->subparser->parse($string); //X_Debug::i("Atoms found: ".count($parsed)); foreach ($parsed as $found) { try { $hoster = $this->helper->findHoster($found['href']); $parsedClean[] = array('hoster' => $hoster, 'url' => $found['href'], 'label' => strip_tags($found['label'])); //X_Debug::i("Valid link: {$found['href']}"); } catch (Exception $e) { /* invalid href, ignored */ /* if ( X_Env::startWith($found['href'], 'http://') ) X_Debug::i("No hoster for link: {$found['href']}"); */ } } return $parsedClean; }
public function findHoster($url) { $this->lastPositiveMatch = $this->hoster->findHoster($url); return $this->lastPositiveMatch; }