mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
FEATURE: Enable disabling of TrackBacks
This commit is contained in:
parent
3443ff9f60
commit
8e708d98a7
@ -151,6 +151,21 @@ class BlogEntry extends Page {
|
||||
function EditURL() {
|
||||
return $this->getParent()->Link('post') . '/' . $this->ID . '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if trackbacks are enabled.
|
||||
*/
|
||||
function TrackBacksEnabled() {
|
||||
return $this->getParent()->TrackBacksEnabled;
|
||||
}
|
||||
|
||||
function trackbackping() {
|
||||
if($this->TrackBacksEnabled()) {
|
||||
return $this->extInstance('TrackBackDecorator')->trackbackping();
|
||||
} else {
|
||||
Director::redirect($this->Link());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to enable WYSIWYG editing on your blog entries.
|
||||
|
@ -13,8 +13,9 @@ class BlogHolder extends Page {
|
||||
static $icon = "blog/images/blogholder";
|
||||
|
||||
static $db = array(
|
||||
"LandingPageFreshness" => "Varchar",
|
||||
"Name" => "Varchar"
|
||||
'LandingPageFreshness' => 'Varchar',
|
||||
'Name' => 'Varchar',
|
||||
'TrackBacksEnabled' => 'Boolean'
|
||||
);
|
||||
|
||||
static $has_one = array(
|
||||
@ -31,10 +32,6 @@ class BlogHolder extends Page {
|
||||
'BlogEntry'
|
||||
);
|
||||
|
||||
static $defaults = array(
|
||||
"LandingPageFreshness" => "3 MONTH",
|
||||
);
|
||||
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
$fields->removeFieldFromTab("Root.Content.Main","Content");
|
||||
@ -54,8 +51,10 @@ class BlogHolder extends Page {
|
||||
"9 MONTH" => "Last 9 months' entries",
|
||||
"10 MONTH" => "Last 10 months' entries",
|
||||
"11 MONTH" => "Last 11 months' entries",
|
||||
"12 MONTH" => "Last year's entries",
|
||||
"12 MONTH" => "Last year's entries"
|
||||
)));
|
||||
|
||||
$fields->addFieldToTab('Root.Content.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks'));
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
<% if CurrentMember %><p><a href="$EditURL" id="editpost" title="<% _t('EDITTHIS', 'Edit this post') %>"><% _t('EDITTHIS', 'Edit this post') %></a> | <a href="$Link(unpublishPost)" id="unpublishpost"><% _t('UNPUBLISHTHIS', 'Unpublish this post') %></a></p><% end_if %>
|
||||
|
||||
<% include TrackBacks %>
|
||||
<% if TrackBacksEnabled %>
|
||||
<% include TrackBacks %>
|
||||
<% end_if %>
|
||||
$PageComments
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user