BUGFIX #4150 banal: Fixed PreserveLinks option in Convert::html2raw

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@78555 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-06-08 00:11:22 +00:00
parent 87478b2c5e
commit 44639ca404

View File

@ -267,7 +267,7 @@ class Convert extends Object {
); );
} }
// Expand hyperlinks // Expand hyperlinks
if( !$preserveLinks && !isset($config['PreserveLink'])) { if(!$preserveLinks && !$config['PreserveLinks']) {
$data = preg_replace('/<a[^>]*href\s*=\s*"([^"]*)">(.*?)<\/a>/ie', "Convert::html2raw('\\2').'[\\1]'", $data); $data = preg_replace('/<a[^>]*href\s*=\s*"([^"]*)">(.*?)<\/a>/ie', "Convert::html2raw('\\2').'[\\1]'", $data);
$data = preg_replace('/<a[^>]*href\s*=\s*([^ ]*)>(.*?)<\/a>/ie', "Convert::html2raw('\\2').'[\\1]'", $data); $data = preg_replace('/<a[^>]*href\s*=\s*([^ ]*)>(.*?)<\/a>/ie', "Convert::html2raw('\\2').'[\\1]'", $data);
@ -306,7 +306,7 @@ class Convert extends Object {
// strip_tags seemed to be restricting the length of the output // strip_tags seemed to be restricting the length of the output
// arbitrarily. This essentially does the same thing. // arbitrarily. This essentially does the same thing.
if( !$preserveLinks ) { if(!$preserveLinks && !$config['PreserveLinks']) {
$data = preg_replace('/<\/?[^>]*>/','', $data); $data = preg_replace('/<\/?[^>]*>/','', $data);
} else { } else {
$data = strip_tags($data, '<a>'); $data = strip_tags($data, '<a>');