You are here

private function FeedsCrawler::parseHref in Feeds Crawler 6.2

Same name and namespace in other branches
  1. 7 FeedsCrawler.inc \FeedsCrawler::parseHref()
2 calls to FeedsCrawler::parseHref()
FeedsCrawler::parseAuto in ./FeedsCrawler.inc
FeedsCrawler::parseXPath in ./FeedsCrawler.inc

File

./FeedsCrawler.inc, line 102
Home of the FeedsCrawler.

Class

FeedsCrawler
Fetches data via HTTP.

Code

private function parseHref($href, $source_url) {
  if ($href === FALSE || empty($href)) {
    return FALSE;
  }
  foreach ($href as $h) {
    $h = trim((string) $h);
    if (!empty($h)) {
      $href = $h;
      break;
    }
  }
  if (strpos($href, 'http://') !== 0 && strpos($href, 'https://') !== 0) {
    $href = ltrim($href, '/');
    $href = $this
      ->baseUrl($source_url) . '/' . $href;
  }
  return $href;
}