class rssGenerator_rss
{
var $rss_version = '2.0';
var $encoding = '';
var $stylesheet = '';
function cData($str)
{
return '';
}
function createFeed($channel)
{
$selfUrl = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on' ? 'http://' : 'https教程://');
$selfUrl .= $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$rss = '
if (!empty($this->encoding)) {
$rss .= ' encoding="' . $this->encoding . '"';
}
$rss .= '?>' . " ";
if (!empty($this->stylesheet)) {
$rss .= $this->stylesheet . " ";
}
$rss .= '' . " ";
$rss .= '
$rss .= '
$rss .= '
$rss .= '
$rss .= ' ' . $channel->link . '' . " ";
$rss .= '
if (!empty($channel->language)) {
$rss .= '
}
if (!empty($channel->copyright)) {
$rss .= '
}
if (!empty($channel->managingEditor)) {
$rss .= '
}
if (!empty($channel->webMaster)) {
$rss .= '
}
if (!empty($channel->pubDate)) {
$rss .= '
}
if (!empty($channel->lastBuildDate)) {
$rss .= '
}
foreach ($channel->categories as $category) {
$rss .= '
$rss .= ' domain="' . $category['domain'] . '"';
}
$rss .= '>' . $category['name'] . '' . " ";
}
if (!empty($channel->generator)) {
$rss .= '
}
if (!empty($channel->docs)) {
$rss .= '
}
if (!empty($channel->ttl)) {
$rss .= '
}
if (sizeof($channel->skipHours)) {
$rss .= '
foreach ($channel->skipHours as $hour) {
$rss .= '
}
$rss .= '
}
if (sizeof($channel->skipDays)) {
$rss .= '
foreach ($channel->skipDays as $day) {
$rss .= '
}
$rss .= '
}
if (!empty($channel->image)) {
$image = $channel->image;
$rss .= '
$rss .= '
$rss .= '
$rss .= ' ' . $image->link . '' . " ";
if ($image->width) {
$rss .= '
}
if ($image->height) {
$rss .= '
}
if (!empty($image->description)) {
$rss .= '
}
$rss .= '
}
if (!empty($channel->textInput)) {
$textInput = $channel->textInput;
$rss .= '
$rss .= '
$rss .= '
$rss .= '
$rss .= ' ' . $textInput->link . '' . " ";
$rss .= '
}
if (!empty($channel->cloud_domain) || !empty($channel->cloud_path) || !empty($channel->cloud_registerProcedure) || !empty($channel->cloud_protocol)) {
$rss .= '
$rss .= 'registerProcedure="' . $channel->cloud_registerProcedure . '" ';
$rss .= 'protocol="' . $channel->cloud_protocol . '" />' . " ";
}
if (!empty($channel->extraXML)) {
$rss .= $channel->extraXML . " ";
}
foreach ($channel->items as $item) {
$rss .= '
if (!empty($item->title)) {
$rss .= '
}
if (!empty($item->description)) {
$rss .= '
}
if (!empty($item->link)) {
$rss .= ' ' . $item->link . '' . " ";
}
if (!empty($item->pubDate)) {
$rss .= '
}
if (!empty($item->author)) {
$rss .= '
}
if (!empty($item->comments)) {
$rss .= '
}
if (!empty($item->guid)) {
$rss .= '
$rss .= $item->guid . '
}
if (!empty($item->source)) {
$rss .= ' ' . " ";
}
if (!empty($item->enclosure_url) || !empty($item->enclosure_type)) {
$rss .= '
$rss .= 'type="' . $item->enclosure_type . '" />' . " ";
}
foreach ($item->categories as $category) {
$rss .= '
$rss .= ' domain="' . $category['domain'] . '"';
}
$rss .= '>' . $category['name'] . '' . " ";
}
$rss .= '
}
$rss .= '
return $rss .= '
}
}
class rssGenerator_channel
{
var $atomLinkHref = '';
var $title = '';
var $link = '';
var $description = '';
var $language = '';
var $copyright = '';
var $managingEditor = '';
var $webMaster = '';
var $pubDate = '';
var $lastBuildDate = '';
var $categories = array();
var $generator = '';
var $docs = '';
var $ttl = '';
var $image = '';
var $textInput = '';
var $skipHours = array();
var $skipDays = array();
var $cloud_domain = '';
var $cloud_port = '80';
var $cloud_path = '';
var $cloud_registerProcedure = '';
var $cloud_protocol = '';
var $items = array();
var $extraXML = '';
}
class rssGenerator_image
{
var $url = '';
var $title = '';
var $link = '';
var $;
var $;
var $description = '';
}
class rssGenerator_textInput
{
var $title = '';
var $description = '';
var $name = '';
var $link = '';
}
class rssGenerator_item
{
var $title = '';
var $description = '';
var $link = '';
var $author = '';
var $pubDate = '';
var $comments = '';
var $guid = '';
var $guid_isPermaLink = true;
var $source = '';
var $source_url = '';
var $enclosure_url = '';
var $enclosure_length = '0';
var $enclosure_type = '';
var $categories = array();
}
?>
实例
require_once 'rss_generator.inc.php';
$rss_channel = new rssGenerator_channel();
$rss_channel->atomLinkHref = '';
$rss_channel->title = 'My News';
$rss_channel->link = 'http://111cn.net教程/news.php';
$rss_channel->description = 'The latest news about web-development.';
$rss_channel->language = 'en-us';
$rss_channel->generator = 'PHP RSS Feed Generator';
$rss_channel->managingEditor = '[email protected] (Alex Jefferson)';
$rss_channel->webMaster = '[email protected] (Vagharshak Tozalakyan)';
$item = new rssGenerator_item();
$item->title = 'New website launched';
$item->description = 'Today I finaly launch a new website.';
$item->link = 'http://111com.net';
$item->guid = 'http://111com.net';
$item->pubDate = 'Tue, 07 Mar 2006 00:00:01 GMT';
$rss_channel->items[] = $item;
$item = new rssGenerator_item();
$item->title = 'Another website launched';
$item->description = 'Just another website launched.';
$item->link = 'http://111com.net';
$item->guid = 'http://111com.net';
$item->pubDate = 'Wed, 08 Mar 2006 00:00:01 GMT';
$rss_channel->items[] = $item;
$rss_feed = new rssGenerator_rss();
$rss_feed->encoding = 'UTF-8';
$rss_feed->version = '2.0';
header('Content-Type: text/xml');
echo $rss_feed->createFeed($rss_channel);
?>
我的博物馆故事 官方安卓版v1.61.2
我的博物馆故事是一款以消除为主题的经营养成类手游,在这里玩家
专业模拟飞行10 手机版v12.2.4
专业模拟飞行10安卓版是一款飞行休闲手游,顶尖的物理飞行引擎
动物起义战斗模拟器二琳同款 最新版v4.1.1
动物起义战斗模拟器是一个非常有趣的模拟类游戏,玩家可以召唤各
迷你世界七周年 安卓手机版v1.43.0
迷你世界7周年是一款由《迷你世界》官方推出的庆祝特别版本,在
劫后公司无限资源版 v1.0.5.1
劫后公司内置菜单版是游戏的破解版本,在该版本中为玩家提供了内