mirror of
https://github.com/silverstripe/silverstripe-versionfeed
synced 2024-06-16 09:41:43 +02:00
Merge ed4fee2478
into 2d6337dad9
This commit is contained in:
commit
7ee2ffc45e
|
@ -6,26 +6,26 @@ class VersionFeed_Controller extends Extension {
|
||||||
'changes',
|
'changes',
|
||||||
'allchanges'
|
'allchanges'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content handler
|
* Content handler
|
||||||
*
|
*
|
||||||
* @var \VersionFeed\Filters\ContentFilter
|
* @var \VersionFeed\Filters\ContentFilter
|
||||||
*/
|
*/
|
||||||
protected $contentFilter;
|
protected $contentFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the content filter
|
* Sets the content filter
|
||||||
*
|
*
|
||||||
* @param \VersionFeed\Filters\ContentFilter $contentFilter
|
* @param \VersionFeed\Filters\ContentFilter $contentFilter
|
||||||
*/
|
*/
|
||||||
public function setContentFilter(\VersionFeed\Filters\ContentFilter $contentFilter) {
|
public function setContentFilter(\VersionFeed\Filters\ContentFilter $contentFilter) {
|
||||||
$this->contentFilter = $contentFilter;
|
$this->contentFilter = $contentFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates the result of the given callback
|
* Evaluates the result of the given callback
|
||||||
*
|
*
|
||||||
* @param string $key Unique key for this
|
* @param string $key Unique key for this
|
||||||
* @param callable $callback Callback for evaluating the content
|
* @param callable $callback Callback for evaluating the content
|
||||||
* @return mixed Result of $callback()
|
* @return mixed Result of $callback()
|
||||||
|
@ -48,7 +48,10 @@ class VersionFeed_Controller extends Extension {
|
||||||
*/
|
*/
|
||||||
public function changes() {
|
public function changes() {
|
||||||
// Check viewability of changes
|
// Check viewability of changes
|
||||||
if(!Config::inst()->get('VersionFeed', 'changes_enabled') || !$this->owner->PublicHistory) {
|
if(!Config::inst()->get('VersionFeed', 'changes_enabled')
|
||||||
|
|| !$this->owner->PublicHistory
|
||||||
|
|| $this->owner->ID == -1
|
||||||
|
) {
|
||||||
return $this->owner->httpError(404, 'Page history not viewable');
|
return $this->owner->httpError(404, 'Page history not viewable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +63,7 @@ class VersionFeed_Controller extends Extension {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Generate the output.
|
// Generate the output.
|
||||||
$title = sprintf(_t('RSSHistory.SINGLEPAGEFEEDTITLE', 'Updates to %s page'), $this->owner->Title);
|
$title = sprintf(_t('RSSHistory.SINGLEPAGEFEEDTITLE', 'Updates to %s page'), $this->owner->Title);
|
||||||
$rss = new RSSFeed($entries, $this->owner->request->getURL(), $title, '', 'Title', '', null);
|
$rss = new RSSFeed($entries, $this->owner->request->getURL(), $title, '', 'Title', '', null);
|
||||||
$rss->setTemplate('Page_changes_rss');
|
$rss->setTemplate('Page_changes_rss');
|
||||||
return $rss->outputToBrowser();
|
return $rss->outputToBrowser();
|
||||||
|
@ -98,7 +101,7 @@ class VersionFeed_Controller extends Extension {
|
||||||
$changeList = new ArrayList();
|
$changeList = new ArrayList();
|
||||||
$canView = array();
|
$canView = array();
|
||||||
foreach ($latestChanges as $record) {
|
foreach ($latestChanges as $record) {
|
||||||
|
|
||||||
// Check if the page should be visible.
|
// Check if the page should be visible.
|
||||||
// WARNING: although we are providing historical details, we check the current configuration.
|
// WARNING: although we are providing historical details, we check the current configuration.
|
||||||
$id = $record['RecordID'];
|
$id = $record['RecordID'];
|
||||||
|
@ -125,7 +128,7 @@ class VersionFeed_Controller extends Extension {
|
||||||
$rss->setTemplate('Page_allchanges_rss');
|
$rss->setTemplate('Page_allchanges_rss');
|
||||||
return $rss->outputToBrowser();
|
return $rss->outputToBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates and embeds the RSS header link for the page-specific version rss feed
|
* Generates and embeds the RSS header link for the page-specific version rss feed
|
||||||
*/
|
*/
|
||||||
|
@ -133,7 +136,7 @@ class VersionFeed_Controller extends Extension {
|
||||||
if (!Config::inst()->get('VersionFeed', 'changes_enabled') || !$this->owner->PublicHistory) {
|
if (!Config::inst()->get('VersionFeed', 'changes_enabled') || !$this->owner->PublicHistory) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RSSFeed::linkToFeed(
|
RSSFeed::linkToFeed(
|
||||||
$this->owner->Link('changes'),
|
$this->owner->Link('changes'),
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -152,7 +155,7 @@ class VersionFeed_Controller extends Extension {
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RSS feed to all-site changes.
|
// RSS feed to all-site changes.
|
||||||
$title = Convert::raw2xml($this->linkToAllSitesRSSFeedTitle());
|
$title = Convert::raw2xml($this->linkToAllSitesRSSFeedTitle());
|
||||||
$url = $this->owner->getSiteRSSLink();
|
$url = $this->owner->getSiteRSSLink();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user