2amigos/efeed

此软件包已废弃,不再维护。未建议替代软件包。

Feed Writer Generator 扩展,用于创建您的订阅源。目前支持 RSS 1.0、RSS 2.0 和 ATOM 1.0。

维护者

详细信息

github.com/2amigos/efeed

源代码

问题

安装次数: 43,353

依赖者: 1

建议者: 0

安全: 0

星标: 12

关注者: 6

分支: 8

开放问题: 2

类型:yii-extension

0.1.1 2014-08-25 14:34 UTC

This package is auto-updated.

Last update: 2023-08-16 02:54:50 UTC


README

Feed Writer Generator 扩展,用于创建您的订阅源。目前支持 RSS 1.0、RSS 2.0 和 ATOM 1.0。

##要求

  • 使用 Yii 版本 1.1.5 开发

##使用方法 解压软件包内容,并将其放置在您的 protected/extensions 文件夹中。

使用示例

RSS 1.0


Yii::import('ext.feed.*');

// specify feed type
$feed = new EFeed(EFeed::RSS1);
$feed->title = 'Testing the RSS 1 EFeed class';
$feed->link = 'http://www.ramirezcobos.com';
$feed->description = 'This is test of creating a RSS 1.0 feed by Universal Feed Writer';
$feed->RSS1ChannelAbout = 'http://www.ramirezcobos.com/about';
// create our item	
$item = $feed->createNewItem();
$item->title = 'The first feed';
$item->link = 'https://yiiframework.cn';
$item->date = time();
$item->description = 'Amaz-ii-ng <b>Yii Framework</b>';
$item->addTag('dc:subject', 'Subject Testing');
		
$feed->addItem($item);
		
$feed->generateFeed();

RSS 2.0


Yii::import('ext.feed.*');
// RSS 2.0 is the default type
$feed = new EFeed();

$feed->title= 'Testing RSS 2.0 EFeed class';
$feed->description = 'This is test of creating a RSS 2.0 Feed';

$feed->setImage('Testing RSS 2.0 EFeed class','http://www.ramirezcobos.com/rss',
'https://yiiframework.cn/forum/uploads/profile/photo-7106.jpg');

$feed->addChannelTag('language', 'en-us');
$feed->addChannelTag('pubDate', date(DATE_RSS, time()));
$feed->addChannelTag('link', 'http://www.ramirezcobos.com/rss' );

// * self reference
$feed->addChannelTag('atom:link','http://www.ramirezcobos.com/rss/');

$item = $feed->createNewItem();

$item->title = "first Feed";
$item->link = "http://www.yahoo.com";
$item->date = time();
$item->description = 'This is test of adding CDATA Encoded description <b>EFeed Extension</b>';
// this is just a test!!
$item->setEncloser('http://www.tester.com', '1283629', 'audio/mpeg');

$item->addTag('author', 'thisisnot@myemail.com (Antonio Ramirez)');
$item->addTag('guid', 'http://www.ramirezcobos.com/',array('isPermaLink'=>'true'));

$feed->addItem($item);

$feed->generateFeed();
Yii::app()->end();

ATOM 1.0

Yii::import('ext.feed.*');


$feed = new EFeed(EFeed::ATOM);
		
// IMPORTANT : No need to add id for feed or channel. It will be automatically created from link.
$feed->title = 'Testing the ATOM RSS EFeed class';
$feed->link = 'http://www.ramirezcobos.com';
		
$feed->addChannelTag('updated', date(DATE_ATOM, time()));
$feed->addChannelTag('author', array('name'=>'Antonio Ramirez Cobos'));
		
$item = $feed->createNewItem();

$item->title = 'The first Feed';
$item->link  = 'http://www.ramirezcobos.com';
// we can also insert well formatted date strings
$item->date ='2010/24/12';
$item->description = 'Test of CDATA Encoded description <b>EFeed Extension</b>';
		
$feed->addItem($item);

$feed->generateFeed();

##变更日志

  • v.1.3 添加了对样式的支持
  • v.1.2 添加了对 atom:link 的支持
  • v.1.1 通过 Flokey82 修复了 EFeedItemAtom 中的错误

##资源