diff options
author | friendica <info@friendica.com> | 2012-02-22 22:36:07 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-02-22 22:36:07 -0800 |
commit | 808b886a3e18b07c63171c4833334e2cf77ddf71 (patch) | |
tree | ca88e82039b5b5c0ceafec9a6fffc369e3c852eb /include/text.php | |
parent | 9fe12d1724acf819f2cbc88bf6647e0adee0b5ea (diff) | |
parent | 3c6b127d40e2f0ea1c2d8eb7114c3e121b58ba2e (diff) | |
download | volse-hubzilla-808b886a3e18b07c63171c4833334e2cf77ddf71.tar.gz volse-hubzilla-808b886a3e18b07c63171c4833334e2cf77ddf71.tar.bz2 volse-hubzilla-808b886a3e18b07c63171c4833334e2cf77ddf71.zip |
Merge branch 'master' into notify
Diffstat (limited to 'include/text.php')
-rwxr-xr-x | include/text.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php index 5ef870fd7..0f7d2f731 100755 --- a/include/text.php +++ b/include/text.php @@ -675,12 +675,24 @@ function linkify($s) { * @Parameter: string $s * * Returns string + * + * It is expected that this function will be called using HTML text. + * We will escape text between HTML pre and code blocks from being + * processed. + * + * At a higher level, the bbcode [nosmile] tag can be used to prevent this + * function from being executed by the prepare_text() routine when preparing + * bbcode source for HTML display + * */ 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 +789,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'), |