escape smiley conversion in code and pre blocks
This commit is contained in:
parent
f03aaf554e
commit
91c3349025
1 changed files with 17 additions and 0 deletions
|
@ -681,6 +681,9 @@ if(! function_exists('smilies')) {
|
||||||
function smilies($s, $sample = false) {
|
function smilies($s, $sample = false) {
|
||||||
$a = get_app();
|
$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(
|
$texts = array(
|
||||||
'<3',
|
'<3',
|
||||||
'</3',
|
'</3',
|
||||||
|
@ -777,10 +780,24 @@ function smilies($s, $sample = false) {
|
||||||
$s = str_replace($params['texts'],$params['icons'],$params['string']);
|
$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;
|
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')) {
|
if(! function_exists('day_translate')) {
|
||||||
function day_translate($s) {
|
function day_translate($s) {
|
||||||
$ret = str_replace(array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'),
|
$ret = str_replace(array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'),
|
||||||
|
|
Loading…
Reference in a new issue