本文整理汇总了PHP中Feed::extract_tag方法的典型用法代码示例。如果您正苦于以下问题:PHP Feed::extract_tag方法的具体用法?PHP Feed::extract_tag怎么用?PHP Feed::extract_tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feed
的用法示例。
在下文中一共展示了Feed::extract_tag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
<channel>
<title>ホーム - SWI swissinfo.ch</title>
<description><![CDATA[SWI swissinfo.ch]]></description>
<link>http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '</link>
';
$i = 0;
if ($tmp) {
foreach ($tmp as $key => $value) {
$value = str_replace('<item>', '', $value);
$body = strip_tags($usr->get_latter('<content:encoded>', $usr->get_former('</content:encoded>', $value)));
$title = trim($usr->get_latter('<title>', $usr->get_former('</title>', $value)));
if (strlen($body) > 300 && strstr($value, '<content:encoded>') && strlen($title) > 10) {
$body = $fd->make_summary_jp($body);
$value = str_replace('<content:encoded>', '<content:encoded>' . "\n", $value);
$value = str_replace('</content:encoded>', "\n" . '</content:encoded>' . "\n<description><![CDATA[" . $body . "]]></description>\n", $value);
$tmp2 = $fd->extract_tag($value, 'pubDate');
$timestamp = strtotime(strip_tags($tmp2[0]));
$pubdate = date("D, d M Y H:i:s O", $timestamp);
$value = str_replace($tmp2[0], '<pubDate>' . $pubdate . '</pubDate>', $value);
$value = preg_replace('/[\\x{10000}-\\x{10FFFF}]/u', '_', $value);
$tmp3 = $fd->extract_tag($value, 'guid');
$guid = str_replace("&", "&", urldecode(strip_tags($tmp3[0])));
$nid = $usr->get_former('?', $usr->get_latter('/', $guid));
$guid = "http://www.swissinfo.ch/jpn/" . $nid . "/" . $nid . "?ns_mchannel=rss&linkType=guid&link=ibtimes";
$value = str_replace($tmp3[0], '<guid>' . $guid . '</guid>', $value);
$tmp4 = $fd->extract_tag($value, 'link');
$value = str_replace($tmp4[0], '<link>' . $guid . '</link>', $value);
$val .= "\n" . '<item>' . "\n" . $value . "\n" . '</item>' . "\n";
if ($i > 10) {
break;
}
示例2: foreach
<channel>
<title>PR Times</title>
<description><![CDATA[PR Times]]></description>
<link>http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '</link>
';
$i = 0;
if ($tmp) {
foreach ($tmp as $key => $value) {
$value = str_replace('<item>', '', $value);
$body = $usr->get_latter('<content:encoded>', $usr->get_former('</content:encoded>', $value));
if (strlen($body) > 100 && strstr($value, '<content:encoded>')) {
$body = $fd->make_summary_jp($body);
$value = $fd->replace_rdf_item_url($value);
$value = str_replace('<content:encoded>', '<content:encoded>' . "\n" . '<![CDATA[' . "\n", $value);
$value = str_replace('</content:encoded>', "\n" . ']]>' . "\n" . '</content:encoded>' . "\n<description><![CDATA[" . $body . "]]></description>\n", $value);
$tmp2 = $fd->extract_tag($value, 'pubDate');
$timestamp = strtotime(strip_tags($tmp2[0]));
$pubdate = date("D, d M Y H:i:s O", $timestamp);
$value = str_replace($tmp2[0], '<pubDate>' . $pubdate . '</pubDate>', $value);
$value = trim(preg_replace('/[\\x{10000}-\\x{10FFFF}]/u', '_', $value));
if ($value) {
$val .= "\n" . '<item>' . "\n" . $value . "\n" . '</item>' . "\n";
}
if ($i > 7) {
break;
}
$i++;
}
}
}
$val .= "\n" . '</channel>' . "\n" . '</rss>';
示例3: foreach
<link>http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '</link>
';
$i = 0;
if ($tmp) {
foreach ($tmp as $key => $value) {
$value = str_replace('<item>', '', $value);
$value = preg_replace('/[\\x{10000}-\\x{10FFFF}]/u', '_', $value);
$body = $usr->get_latter('<content:encoded>', $usr->get_former('</content:encoded>', $value));
$title = trim($usr->get_latter('<title>', $usr->get_former('</title>', $value)));
if (strlen($body) > 300 && strstr($value, '<content:encoded>') && strlen($title) > 10) {
$body_summary = $fd->make_summary_jp(strip_tags($body));
$body_new = $fd->make_body_text($body);
$value = str_replace($body, $body_new, $value);
$value = str_replace('<content:encoded>', '<content:encoded><![CDATA[' . "\n", $value);
$value = str_replace('</content:encoded>', "\n" . ']]></content:encoded>' . "\n", $value);
//$value = str_replace('<content:encoded>','<description>'.$body_summary.'</description><content:encoded>' , $value);
$tmp2 = $fd->extract_tag($value, 'dc:date');
$timestamp = strtotime(strip_tags($tmp2[0]));
$pubdate = date("D, d M Y H:i:s O", $timestamp);
$value = str_replace($tmp2[0], '<pubDate>' . $pubdate . '</pubDate>', $value);
$val .= "\n" . '<item>' . "\n" . $value . "\n" . '</item>' . "\n";
if ($i > 20) {
break;
}
$i++;
}
}
}
$val .= "\n" . '</channel>' . "\n" . '</rss>';
echo $val;
exit;