X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftext.php;h=08803cc9b7be5b54bb7f4b9ceb8b6e980e520939;hb=fd4fe24406edb277814c7a45a6094a8eec0850d7;hp=647741f5ce467c259e1ae5aa33879ef4e46396b7;hpb=feaba3d3000a2caf79e4168527190bd0d5ed8410;p=friendica.git diff --git a/include/text.php b/include/text.php index 647741f5ce..08803cc9b7 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); @@ -462,7 +465,7 @@ function get_tags($s) { // Match full names against @tags including the space between first and last // We will look these up afterward to see if they are full names or not recognisable. - if(preg_match_all('/(@[^ \x0D\x0A,:?]+ [^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) { + if(preg_match_all('/(@[^ \x0D\x0A,:?]+ [^ \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 @@ -478,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 @@ -669,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', @@ -688,6 +691,7 @@ function smilies($s) { '8-|', '8-O', '~friendika ~friendika', + '~friendica ~friendica', 'DiasporaDiaspora*', ), $s); @@ -748,7 +752,9 @@ function prepare_body($item,$attach = false) { $s = prepare_text($item['body']); - call_hooks('prepare_body', $s); + $prep_arr = array('item' => $item, 'html' => $s); + call_hooks('prepare_body', $prep_arr); + $s = $prep_arr['html']; if(! $attach) return $s; @@ -781,8 +787,11 @@ function prepare_body($item,$attach = false) { } $s .= '
'; } - call_hooks('prepare_body_final', $s); - return $s; + + + $prep_arr = array('item' => $item, 'html' => $s); + call_hooks('prepare_body_final', $prep_arr); + return $prep_arr['html']; }} @@ -865,7 +874,7 @@ function lang_selector() { global $lang; $o = '
'; $o .= '