本文整理汇总了PHP中SimplePie_Misc::space_seperated_tokens方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie_Misc::space_seperated_tokens方法的具体用法?PHP SimplePie_Misc::space_seperated_tokens怎么用?PHP SimplePie_Misc::space_seperated_tokens使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimplePie_Misc
的用法示例。
在下文中一共展示了SimplePie_Misc::space_seperated_tokens方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: result
function result()
{
if ($this->data['file']->url != 'http://diveintomark.org/tests/client/autodiscovery/') {
parent::result();
}
static $done = array();
$links = SimplePie_Misc::get_element('link', $this->data['file']->body);
foreach ($links as $link) {
if (!empty($link['attribs']['href']['data']) && !empty($link['attribs']['rel']['data'])) {
$rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data'])));
$href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->data['file']->url);
if (!in_array($href, $done) && in_array('next', $rel)) {
$done[] = $this->data['url'] = $href;
break;
}
}
}
if ($this->data['url']) {
$this->run();
}
}
示例2: autodiscovery
function autodiscovery()
{
$links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body));
$done = array();
foreach ($links as $link) {
if ($this->checked_feeds == $this->max_checked_feeds) {
break;
}
if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data'])) {
$rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data'])));
if ($this->base_location < $link['offset']) {
$href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base);
} else {
$href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
}
if (!in_array($href, $done) && in_array('feed', $rel) || in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) {
$this->checked_feeds++;
$feed =& new $this->file_class($href, $this->timeout, 5, null, $this->useragent);
if ($this->is_feed($feed)) {
return $feed;
}
}
$done[] = $href;
}
}
return null;
}
示例3: autodiscovery
public function autodiscovery()
{
$links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body));
$done = array();
$feeds = array();
foreach ($links as $link) {
if ($this->checked_feeds === $this->max_checked_feeds) {
break;
}
if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data'])) {
$rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data'])));
if ($this->base_location < $link['offset']) {
$href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base);
} else {
$href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
}
if (!in_array($href, $done) && in_array('feed', $rel) || in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml')) && !isset($feeds[$href])) {
$this->checked_feeds++;
$headers = array('Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1');
$feed = new $this->file_class($href, $this->timeout, 5, $headers, $this->useragent);
if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) {
$feeds[$href] = $feed;
}
}
$done[] = $href;
}
}
if (!empty($feeds)) {
return array_values($feeds);
} else {
return null;
}
}