function _parser_common_syndication_link in Feeds 7.2
Same name and namespace in other branches
- 8.2 libraries/common_syndication_parser.inc \_parser_common_syndication_link()
- 6 libraries/common_syndication_parser.inc \_parser_common_syndication_link()
- 7 libraries/common_syndication_parser.inc \_parser_common_syndication_link()
Extract the link that points to the original content (back to site or original article)
Parameters
array $links: Array of SimpleXML objects.
Return value
string An URL if found. An empty string otherwise.
1 call to _parser_common_syndication_link()
- _parser_common_syndication_atom10_parse in libraries/
common_syndication_parser.inc - Parse atom feeds.
File
- libraries/
common_syndication_parser.inc, line 632 - Downloading and parsing functions for Common Syndication Parser. Pillaged from FeedAPI common syndication parser.
Code
function _parser_common_syndication_link($links) {
$to_link = '';
if (count($links) > 0) {
foreach ($links as $link) {
$link = $link
->attributes();
$to_link = isset($link["href"]) ? "{$link["href"]}" : "";
if (isset($link["rel"])) {
if ("{$link["rel"]}" == 'alternate') {
break;
}
}
}
}
return trim($to_link);
}