mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-05-02 08:59:22 +03:00
Полнотекстовый RSS
This commit is contained in:
parent
b3fd531abf
commit
976b155eb4
|
@ -51,6 +51,7 @@ class ActionRss extends Action
|
||||||
protected function RegisterEvent()
|
protected function RegisterEvent()
|
||||||
{
|
{
|
||||||
$this->AddEvent('index', 'RssGood');
|
$this->AddEvent('index', 'RssGood');
|
||||||
|
$this->AddEvent('full', 'RssFull');
|
||||||
$this->AddEvent('new', 'RssNew');
|
$this->AddEvent('new', 'RssNew');
|
||||||
$this->AddEvent('allcomments', 'RssComments');
|
$this->AddEvent('allcomments', 'RssComments');
|
||||||
$this->AddEvent('comments', 'RssTopicComments');
|
$this->AddEvent('comments', 'RssTopicComments');
|
||||||
|
@ -142,6 +143,48 @@ class ActionRss extends Action
|
||||||
$this->Viewer_Assign('aItems', $topics);
|
$this->Viewer_Assign('aItems', $topics);
|
||||||
$this->SetTemplateAction('index');
|
$this->SetTemplateAction('index');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Вывод полнотекстового RSS интересных топиков
|
||||||
|
*/
|
||||||
|
protected function RssFull()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Получаем топики
|
||||||
|
*/
|
||||||
|
$aResult = $this->Topic_GetTopicsGood(1, Config::Get('module.topic.max_rss_count'), false);
|
||||||
|
$aTopics = $aResult['collection'];
|
||||||
|
/**
|
||||||
|
* Формируем данные канала RSS
|
||||||
|
*/
|
||||||
|
$aChannel['title'] = Config::Get('view.name');
|
||||||
|
$aChannel['link'] = Router::GetPath('/');
|
||||||
|
$aChannel['description'] = Config::Get('view.name') . ' / RSS channel';
|
||||||
|
$aChannel['language'] = 'ru';
|
||||||
|
$aChannel['managingEditor'] = Config::Get('general.rss_editor_mail');
|
||||||
|
$aChannel['generator'] = Config::Get('view.name');
|
||||||
|
/**
|
||||||
|
* Формируем записи RSS
|
||||||
|
*/
|
||||||
|
$topics = array();
|
||||||
|
foreach ($aTopics as $oTopic) {
|
||||||
|
$item['title'] = $oTopic->getTitle();
|
||||||
|
$item['guid'] = $oTopic->getUrl();
|
||||||
|
$item['link'] = $oTopic->getUrl();
|
||||||
|
$item['description'] = $this->getTopicFullText($oTopic);
|
||||||
|
$item['pubDate'] = $oTopic->getDatePublish();
|
||||||
|
$item['author'] = $oTopic->getUser()->getLogin();
|
||||||
|
$item['category'] = htmlspecialchars($oTopic->getTags());
|
||||||
|
$topics[] = $item;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Формируем ответ
|
||||||
|
*/
|
||||||
|
$this->InitRss();
|
||||||
|
$this->Viewer_Assign('aChannel', $aChannel);
|
||||||
|
$this->Viewer_Assign('aItems', $topics);
|
||||||
|
$this->SetTemplateAction('index');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Вывод RSS последних комментариев
|
* Вывод RSS последних комментариев
|
||||||
|
@ -405,4 +448,13 @@ class ActionRss extends Action
|
||||||
}
|
}
|
||||||
return $sText;
|
return $sText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Формирует полный текст топика (без ката) для RSS
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected function getTopicFullText($oTopic)
|
||||||
|
{
|
||||||
|
return $oTopic->getText();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue