MINOR added the ability to link URLs in comments (with rel=nofollow) (from r83182)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@89816 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-10-21 04:37:59 +00:00
parent 399f9d4e31
commit 9b234ca7f1

View File

@ -56,6 +56,10 @@ class PageComment extends DataObject {
} }
} }
function CommentTextWithLinks() {
return preg_replace("#\[(([a-zA-Z]+://)([a-zA-Z0-9?&%.;:/=+_-]*))\]#", "'<a rel=\"nofollow\" href=\"$1\" target=\"_blank\">$1</a>'", $this->Comment);
}
function SpamLink() { function SpamLink() {
$member = Member::currentUser(); $member = Member::currentUser();
if(Permission::check('CMS_ACCESS_CMSMain') && !$this->getField('IsSpam')) { if(Permission::check('CMS_ACCESS_CMSMain') && !$this->getField('IsSpam')) {