From 9b234ca7f12cd538bdb9314139928b0209de07e1 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 21 Oct 2009 04:37:59 +0000 Subject: [PATCH] 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 --- code/sitefeatures/PageComment.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/sitefeatures/PageComment.php b/code/sitefeatures/PageComment.php index 408cc118..fb478e7d 100755 --- a/code/sitefeatures/PageComment.php +++ b/code/sitefeatures/PageComment.php @@ -56,6 +56,10 @@ class PageComment extends DataObject { } } + function CommentTextWithLinks() { + return preg_replace("#\[(([a-zA-Z]+://)([a-zA-Z0-9?&%.;:/=+_-]*))\]#", "'$1'", $this->Comment); + } + function SpamLink() { $member = Member::currentUser(); if(Permission::check('CMS_ACCESS_CMSMain') && !$this->getField('IsSpam')) {