From efbc3b3a81877613077219521ab845cbdf987bca Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Tue, 12 Aug 2014 16:46:52 +1200 Subject: [PATCH] Move the link-tracking into the cms to remove the SiteTree dependency. Depends on 8996b67c13a773c3339f45d91bf2378a39e5178a in the cms module. --- forms/HtmlEditorField.php | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index 7d962e105..8fe3d1ffd 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -64,36 +64,6 @@ class HtmlEditorField extends TextareaField { self::include_js(); } - /** - * @return string - */ - public function Field($properties = array()) { - // mark up broken links - $value = Injector::inst()->create('HTMLValue', $this->value); - - if($links = $value->getElementsByTagName('a')) foreach($links as $link) { - $matches = array(); - - if(preg_match('/\[sitetree_link(?:\s*|%20|,)?id=([0-9]+)\]/i', $link->getAttribute('href'), $matches)) { - if(!DataObject::get_by_id('SiteTree', $matches[1])) { - $class = $link->getAttribute('class'); - $link->setAttribute('class', ($class ? "$class ss-broken" : 'ss-broken')); - } - } - - if(preg_match('/\[file_link(?:\s*|%20|,)?id=([0-9]+)\]/i', $link->getAttribute('href'), $matches)) { - if(!DataObject::get_by_id('File', $matches[1])) { - $class = $link->getAttribute('class'); - $link->setAttribute('class', ($class ? "$class ss-broken" : 'ss-broken')); - } - } - } - - $properties['Value'] = htmlentities($value->getContent(), ENT_COMPAT, 'UTF-8'); - - return parent::Field($properties); - } - public function getAttributes() { return array_merge( parent::getAttributes(),