本文整理汇总了PHP中Idno\Core\Webmention::supportsMentions方法的典型用法代码示例。如果您正苦于以下问题:PHP Webmention::supportsMentions方法的具体用法?PHP Webmention::supportsMentions怎么用?PHP Webmention::supportsMentions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Idno\Core\Webmention
的用法示例。
在下文中一共展示了Webmention::supportsMentions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFeedDetails
/**
* Given the URL of a website, returns a single linked array containing the URL and title of a feed
* (whether Microformats or RSS / Atom). The function will attempt to discover RSS and Atom feeds in
* the page if this is an HTML site. Returns false if there is no feed.
* @param $url
* @return array|false
*/
function getFeedDetails($url)
{
if (!filter_var($url, FILTER_VALIDATE_URL)) {
return false;
}
$client = new Webservice();
if ($result = $client->get($url)) {
$feed = array();
if (!empty($result['content'])) {
$feed['webmention'] = Webmention::supportsMentions($url, $result['content']);
if ($html = @\DOMDocument::loadHTML($result['content'])) {
$xpath = new \DOMXpath($html);
$title = $xpath->query('//title')->item(0)->nodeValue;
if ($xpath->query("//*[contains(concat(' ', @class, ' '), ' h-entry ')]")->length > 0) {
$feed['type'] = 'mf2';
$feed['url'] = $url;
if (!empty($title)) {
$feed['title'] = $title;
}
return $feed;
}
if ($rss_url = $this->findXMLFeedURL($html)) {
$feed['type'] = 'xml';
$feed['url'] = $rss_url;
if (!empty($title)) {
$feed['title'] = $title;
}
return $feed;
}
}
if ($xml = @simplexml_load_string($result['content'])) {
if (!empty($xml->rss->channel->item) || !empty($xml->feed) || !empty($xml->channel->item)) {
$feed['type'] = 'xml';
$feed['url'] = $url;
if (!empty($xml->rss->channel->title)) {
$feed['title'] = $xml->rss->channel->title;
} else {
if (!empty($xml->channel->title)) {
$feed['title'] = $xml->channel->title;
} else {
if (!empty($xml->title)) {
$feed['title'] = $xml->title;
}
}
}
return $feed;
}
}
}
}
return false;
}