X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftext.php;h=0b825cc39940c4017a1087162cfa56a91db0347d;hb=aace55df0ad279d74c5e612078c3f29d114389dc;hp=011006b764cfd2058f2e41b2b08f9d9a494fda58;hpb=70709a882594250684c954a21d186877ea6f983c;p=friendica.git diff --git a/include/text.php b/include/text.php index 011006b764..0b825cc399 100644 --- a/include/text.php +++ b/include/text.php @@ -20,7 +20,7 @@ function replace_macros($s,$r) { //$a = get_app(); //$a->page['debug'] .= "$tt
\n"; - return $r; + return template_unescape($r); }} @@ -610,6 +610,8 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { $url = $redirect_url; $sparkle = ' sparkle'; } + else + $url = zrl($url); } $click = ((x($contact,'click')) ? ' onclick="' . $contact['click'] . '" ' : ''); if($click) @@ -638,7 +640,7 @@ if(! function_exists('search')) { function search($s,$id='search-box',$url='/search',$save = false) { $a = get_app(); $o = '
'; - $o .= '
'; + $o .= ''; $o .= ''; $o .= ''; if($save) @@ -694,8 +696,13 @@ function linkify($s) { if(! function_exists('smilies')) { function smilies($s, $sample = false) { + $a = get_app(); + if(intval(get_config('system','no_smilies')) + || (local_user() && intval(get_pconfig(local_user(),'system','no_smilies')))) + return $s; + $s = preg_replace_callback('/
(.*?)<\/pre>/ism','smile_encode',$s);
 	$s = preg_replace_callback('/(.*?)<\/code>/ism','smile_encode',$s);
 
@@ -704,27 +711,21 @@ function smilies($s, $sample = false) {
 		'</3', 
 		'<\\3', 
 		':-)', 
-//		':)', 
 		';-)', 
-//		';)', 
 		':-(', 
-//		':(', 
 		':-P', 
-//		':P', 
+		':-p', 
 		':-"', 
 		':-"', 
 		':-x', 
 		':-X', 
 		':-D', 
-//		':D', 
 		'8-|', 
 		'8-O', 
 		':-O', 
 		'\\o/', 
 		'o.O', 
 		'O.o', 
-		'\\.../', 
-		'\\ooo/', 
 		":'(", 
 		":-!", 
 		":-/", 
@@ -734,12 +735,8 @@ function smilies($s, $sample = false) {
 		':homebrew', 
 		':coffee', 
 		':facepalm',
-		':headdesk',
 		'~friendika', 
-		'~friendica', 
-//		'Diaspora*' 
-		':beard',
-		':whitebeard'
+		'~friendica'
 
 	);
 
@@ -748,27 +745,21 @@ function smilies($s, $sample = false) {
 		'</3',
 		'<\\3',
 		':-)',
-//		':)',
 		';-)',
-//		';)',                
 		':-(',
-//		':(',
 		':-P',
-//		':P',
+		':-p',
 		':-\',
 		':-\',
 		':-x',
 		':-X',
 		':-D',
-//		':D',                
 		'8-|',
 		'8-O',
 		':-O',                
 		'\\o/',
 		'o.O',
 		'O.o',
-		'\\.../',
-		'\\ooo/',
 		':\'(',
 		':-!',
 		':-/',
@@ -778,12 +769,8 @@ function smilies($s, $sample = false) {
 		':homebrew',
 		':coffee',
 		':facepalm',
-		':headdesk',
 		'~friendika ~friendika',
-		'~friendica ~friendica',
-//		'DiasporaDiaspora*',
-		':beard',
-		':whitebeard'
+		'~friendica ~friendica'
 	);
 
 	$params = array('texts' => $texts, 'icons' => $icons, 'string' => $s);
@@ -874,16 +861,30 @@ function link_compare($a,$b) {
 if(! function_exists('prepare_body')) {
 function prepare_body($item,$attach = false) {
 
+	$a = get_app();
 	call_hooks('prepare_body_init', $item); 
 
-	$s = prepare_text($item['body']);
+	$cache = get_config('system','itemcache');
+
+	if (($cache != '')) {
+		$cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".hash("crc32", $item['body']);
+
+		if (file_exists($cachefile))
+			$s = file_get_contents($cachefile);
+		else {
+			$s = prepare_text($item['body']);
+			file_put_contents($cachefile, $s);
+		}
+	} else
+		$s = prepare_text($item['body']);
 
 	$prep_arr = array('item' => $item, 'html' => $s);
 	call_hooks('prepare_body', $prep_arr);
 	$s = $prep_arr['html'];
 
-	if(! $attach)
+	if(! $attach) {
 		return $s;
+	}
 
 	$arr = explode(',',$item['attach']);
 	if(count($arr)) {
@@ -913,10 +914,67 @@ function prepare_body($item,$attach = false) {
 		}
 		$s .= '
'; } + $matches = false; + $cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER); + if($cnt) { +// logger('prepare_text: categories: ' . print_r($matches,true), LOGGER_DEBUG); + foreach($matches as $mtch) { + if(strlen($x)) + $x .= ','; + $x .= file_tag_decode($mtch[1]); + } + if(strlen($x)) + $s .= '
' . t('Categories:') . ' ' . $x . '
'; + + + } + $matches = false; + $x = ''; + $cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER); + if($cnt) { +// logger('prepare_text: filed_under: ' . print_r($matches,true), LOGGER_DEBUG); + foreach($matches as $mtch) { + if(strlen($x)) + $x .= '   '; + $x .= file_tag_decode($mtch[1]). ' ' . t('[remove]') . ''; + } + if(strlen($x) && (local_user() == $item['uid'])) + $s .= '
' . t('Filed under:') . ' ' . $x . '
'; + } + + // Look for spoiler + $spoilersearch = '
'; + + // Remove line breaks before the spoiler + while ((strpos($s, "\n".$spoilersearch) !== false)) + $s = str_replace("\n".$spoilersearch, $spoilersearch, $s); + while ((strpos($s, "
".$spoilersearch) !== false)) + $s = str_replace("
".$spoilersearch, $spoilersearch, $s); + + while ((strpos($s, $spoilersearch) !== false)) { + + $pos = strpos($s, $spoilersearch); + $rnd = random_string(8); + $spoilerreplace = '
'.sprintf(t('Click to open/close')).''. + '