diff options
author | friendica <info@friendica.com> | 2012-02-21 23:13:03 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-02-21 23:13:03 -0800 |
commit | 91c334902565b2ceb7fd26735b4d501973e28557 (patch) | |
tree | 14723d17b6fdaee49fd7351438f26bf3d52c111d | |
parent | f03aaf554e32fa528b0f1b1068db0824efb77e07 (diff) | |
download | volse-hubzilla-91c334902565b2ceb7fd26735b4d501973e28557.tar.gz volse-hubzilla-91c334902565b2ceb7fd26735b4d501973e28557.tar.bz2 volse-hubzilla-91c334902565b2ceb7fd26735b4d501973e28557.zip |
escape smiley conversion in code and pre blocks
-rwxr-xr-x | include/text.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php index 5ef870fd7..38ac58a6c 100755 --- a/include/text.php +++ b/include/text.php @@ -681,6 +681,9 @@ if(! function_exists('smilies')) { function smilies($s, $sample = false) { $a = get_app(); + $s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','smile_encode',$s); + $s = preg_replace_callback('/<code>(.*?)<\/code>/ism','smile_encode',$s); + $texts = array( '<3', '</3', @@ -777,10 +780,24 @@ function smilies($s, $sample = false) { $s = str_replace($params['texts'],$params['icons'],$params['string']); } + $s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','smile_decode',$s); + $s = preg_replace_callback('/<code>(.*?)<\/code>/ism','smile_decode',$s); + return $s; }} +function smile_encode($m) { + return(str_replace($m[1],base64url_encode($m[1]),$m[0])); +} + +function smile_decode($m) { + return(str_replace($m[1],base64url_decode($m[1]),$m[0])); +} + + + + if(! function_exists('day_translate')) { function day_translate($s) { $ret = str_replace(array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'), |