From cc13d49e83757cf540082eaddf0483153c027c83 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Tue, 4 Nov 2008 19:20:36 +0000 Subject: added protection against non-breaking spaces within tags --- system/libraries/Typography.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php index 317208f2f..8ae47a1b1 100644 --- a/system/libraries/Typography.php +++ b/system/libraries/Typography.php @@ -85,12 +85,13 @@ class CI_Typography { // Convert quotes within tags to temporary markers. We don't want quotes converted // within tags so we'll temporarily convert them to {@DQ} and {@SQ} // and we don't want double dashes converted to emdash entities, so they are marked with {@DD} + // likewise double spaces are converted to {@NBS} to prevent entity conversion if (preg_match_all("#\<.+?>#si", $str, $matches)) { for ($i = 0, $total = count($matches[0]); $i < $total; $i++) { $str = str_replace($matches[0][$i], - str_replace(array("'",'"','--'), array('{@SQ}', '{@DQ}', '{@DD}'), $matches[0][$i]), + str_replace(array("'",'"','--',' '), array('{@SQ}', '{@DQ}', '{@DD}', '{@NBS}'), $matches[0][$i]), $str); } } @@ -180,7 +181,8 @@ class CI_Typography { '/\{@TAG\}/' => '<', '/\{@DQ\}/' => '"', '/\{@SQ\}/' => "'", - '/\{@DD\}/' => '--' + '/\{@DD\}/' => '--', + '/\{@NBS\}/' => ' ' ); -- cgit v1.2.3-24-g4f1b