X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftext.php;h=4726872ec299f4656770d8be29df5dac883093a2;hb=573670fa0c8a3d8f111430985d263499b79a6ac0;hp=ea64a3d2820992893d3b1261422e8b2bda05f0cf;hpb=939449602a58838f81045c9a0e9a205c8fa9e6bd;p=friendica.git diff --git a/include/text.php b/include/text.php index ea64a3d282..4726872ec2 100644 --- a/include/text.php +++ b/include/text.php @@ -195,6 +195,9 @@ function unxmlify($s) { if(! function_exists('hex2bin')) { function hex2bin($s) { + if(! (is_string($s) && strlen($s))) + return ''; + if(! ctype_xdigit($s)) { logger('hex2bin: illegal input: ' . print_r(debug_backtrace(), true)); return($s); @@ -388,11 +391,13 @@ function get_intltext_template($s) { if(! function_exists('get_markup_template')) { function get_markup_template($s) { - + $a=get_app(); $theme = current_theme(); if(file_exists("view/theme/$theme/$s")) return file_get_contents("view/theme/$theme/$s"); + elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/$s")) + return file_get_contents("view/theme/".$a->theme_info["extends"]."/$s"); else return file_get_contents("view/$s"); @@ -476,7 +481,7 @@ function get_tags($s) { // Otherwise pull out single word tags. These can be @nickname, @first_last // and #hash tags. - if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) { + if(preg_match_all('/([@#][^ \x0D\x0A,;:?]+)([ \x0D\x0A,;:?]|$)/',$s,$match)) { foreach($match[1] as $mtch) { if(strstr($mtch,"]")) { // we might be inside a bbcode color tag - leave it alone @@ -667,7 +672,7 @@ function smilies($s) { $s = str_replace( array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', - '~friendika', 'Diaspora*' ), + '~friendika', '~friendica', 'Diaspora*' ), array( '<3', '</3', @@ -686,7 +691,8 @@ function smilies($s) { '8-|', '8-O', '~friendika ~friendika', - 'DiasporaDiaspora*', + '~friendica ~friendica', + 'DiasporaDiaspora*', ), $s); @@ -742,7 +748,14 @@ function link_compare($a,$b) { if(! function_exists('prepare_body')) { function prepare_body($item,$attach = false) { + call_hooks('prepare_body_init', $item); + $s = prepare_text($item['body']); + + $prep_arr = array('item' => $item, 'html' => $s); + call_hooks('prepare_body', $prep_arr); + $s = $prep_arr['html']; + if(! $attach) return $s; @@ -774,7 +787,19 @@ function prepare_body($item,$attach = false) { } $s .= '
'; } - return $s; + + $arr = explode(',',$item['tag']); + if(count($arr)) { + $s .= '
'; + foreach($arr as $r) { + $s .= bbcode($r) . ' '; + } + $s .= '
'; + } + + $prep_arr = array('item' => $item, 'html' => $s); + call_hooks('prepare_body_final', $prep_arr); + return $prep_arr['html']; }} @@ -857,7 +882,7 @@ function lang_selector() { global $lang; $o = '
'; $o .= '