FIX: url not showing in comments template

This commit is contained in:
Will Rossiter 2012-07-22 09:54:24 +12:00
parent 8ab18fe1d0
commit e18cf3e2bb
2 changed files with 19 additions and 35 deletions

View File

@ -137,25 +137,6 @@ class Comment extends DataObject {
return ($parent->Title) ? $parent->Title : $parent->ClassName . " #" . $parent->ID;
}
/**
* This method is called just before this object is
* written to the database.
*
* Specifically, make sure "http://" exists at the start
* of the URL, if it doesn't have https:// or http://
*/
public function onBeforeWrite() {
parent::onBeforeWrite();
$url = $this->CommenterURL;
if($url) {
if(strtolower(substr($url, 0, 8)) != 'https://' && strtolower(substr($url, 0, 7)) != 'http://') {
$this->CommenterURL = 'http://' . $url;
}
}
}
/**
* @todo needs to compare to the new {@link Commenting} configuration API
*

View File

@ -5,25 +5,28 @@
$Comment.XML
<% end_if %>
</p>
<p class="info">
<% if CommenterURL %>
<% _t('PBY','Posted by') %> <a href="$CommenterURL.ATT" rel="nofollow">$Name.XML</a>, $Created.Nice ($Created.Ago)
<% if $URL %>
<% _t('PBY','Posted by') %> <a href="$URL.URL" rel="nofollow">$Name.XML</a>, $Created.Nice ($Created.Ago)
<% else %>
<% _t('PBY','Posted by') %> $Name.XML, $Created.Nice ($Created.Ago)
<% end_if %>
</p>
<ul class="action-links">
<% if ApproveLink %>
<li><a href="$ApproveLink" class="approve"><% _t('APPROVE', 'approve this comment') %></a></li>
<% end_if %>
<% if SpamLink %>
<li><a href="$SpamLink" class="spam"><% _t('ISSPAM','this comment is spam') %></a></li>
<% end_if %>
<% if HamLink %>
<li><a href="$HamLink" class="ham"><% _t('ISNTSPAM','this comment is not spam') %></a></li>
<% end_if %>
<% if DeleteLink %>
<li class="last"><a href="$DeleteLink" class="delete"><% _t('REMCOM','remove this comment') %></a></li>
<% end_if %>
</ul>
<% if ApproveLink || SpamLink || HamLink || DeleteLink %>
<ul class="action-links">
<% if ApproveLink %>
<li><a href="$ApproveLink" class="approve"><% _t('APPROVE', 'approve this comment') %></a></li>
<% end_if %>
<% if SpamLink %>
<li><a href="$SpamLink" class="spam"><% _t('ISSPAM','this comment is spam') %></a></li>
<% end_if %>
<% if HamLink %>
<li><a href="$HamLink" class="ham"><% _t('ISNTSPAM','this comment is not spam') %></a></li>
<% end_if %>
<% if DeleteLink %>
<li class="last"><a href="$DeleteLink" class="delete"><% _t('REMCOM','remove this comment') %></a></li>
<% end_if %>
</ul>
<% end_if %>