From 74b3e9f273b019729d213f3ccaeba1bb11d61d24 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 10 Mar 2012 15:50:35 +0100 Subject: Enabled Caching for items. Changed color of tags in diabook. --- include/text.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 5ad0154d7..38736d836 100644 --- a/include/text.php +++ b/include/text.php @@ -874,6 +874,14 @@ function link_compare($a,$b) { if(! function_exists('prepare_body')) { function prepare_body($item,$attach = false) { + $cache = get_config('system','itemcache'); + + if (($cache != '')) { + $cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".$attach; + if (file_exists($cachefile)) + return(file_get_contents($cachefile)); + } + call_hooks('prepare_body_init', $item); $s = prepare_text($item['body']); @@ -882,8 +890,11 @@ function prepare_body($item,$attach = false) { call_hooks('prepare_body', $prep_arr); $s = $prep_arr['html']; - if(! $attach) + if(! $attach) { + if ($cache != '') + file_put_contents($cachefile, $s); return $s; + } $arr = explode(',',$item['attach']); if(count($arr)) { @@ -917,6 +928,10 @@ function prepare_body($item,$attach = false) { $prep_arr = array('item' => $item, 'html' => $s); call_hooks('prepare_body_final', $prep_arr); + + if ($cache != '') + file_put_contents($cachefile, $prep_arr['html']); + return $prep_arr['html']; }} -- cgit v1.2.3 From 670b571c8ac0532cc80fff6351f91b1b0fa58e0c Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 10 Mar 2012 18:19:00 +0100 Subject: Caching improved. --- include/text.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 38736d836..5bf815105 100644 --- a/include/text.php +++ b/include/text.php @@ -874,25 +874,27 @@ function link_compare($a,$b) { if(! function_exists('prepare_body')) { function prepare_body($item,$attach = false) { + call_hooks('prepare_body_init', $item); + $cache = get_config('system','itemcache'); if (($cache != '')) { - $cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".$attach; - if (file_exists($cachefile)) - return(file_get_contents($cachefile)); - } - - call_hooks('prepare_body_init', $item); + $cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".$attach."-".hash("crc32", $item['body']); - $s = prepare_text($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 ($cache != '') - file_put_contents($cachefile, $s); return $s; } @@ -925,13 +927,9 @@ function prepare_body($item,$attach = false) { $s .= '
'; } - $prep_arr = array('item' => $item, 'html' => $s); call_hooks('prepare_body_final', $prep_arr); - if ($cache != '') - file_put_contents($cachefile, $prep_arr['html']); - return $prep_arr['html']; }} -- cgit v1.2.3 From 9f76d96d46356b18325ca49c383f94a1958fefd3 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Mar 2012 19:11:25 +0100 Subject: Cache: item cache now has an autodelete of old files. The pages plugin now sets a link via redirection. So posting works. --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 5bf815105..08c5a5424 100644 --- a/include/text.php +++ b/include/text.php @@ -879,7 +879,7 @@ function prepare_body($item,$attach = false) { $cache = get_config('system','itemcache'); if (($cache != '')) { - $cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".$attach."-".hash("crc32", $item['body']); + $cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".hash("crc32", $item['body']); if (file_exists($cachefile)) $s = file_get_contents($cachefile); -- cgit v1.2.3 From 5a4167646553e589cf9647c0e0d0446e3f5fd672 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 13 Mar 2012 04:04:26 -0700 Subject: initial tag display for categories and save-to-file - suitable for testing but needs cleanup, links to delete term, and theming. --- include/text.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 011006b76..2663bdeba 100644 --- a/include/text.php +++ b/include/text.php @@ -913,6 +913,33 @@ 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]); + } + if(strlen($x) && (local_user() == $item['uid'])) + $s .= '
' . t('Filed under:') . ' ' . $x . '
'; + } $prep_arr = array('item' => $item, 'html' => $s); -- cgit v1.2.3 From be48fff1570aa1d04e049a6fd1665f4fc9634a62 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 13 Mar 2012 18:13:03 -0700 Subject: file as widget and basic filing implementation for duepuntozero,slackr much more work needed - this is just for test/evaluation currently --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 2663bdeba..c44b4d178 100644 --- a/include/text.php +++ b/include/text.php @@ -1294,7 +1294,7 @@ function file_tag_save_file($uid,$item,$file) { if(count($r)) { if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']')) q("update item set file = '%s' where id = %d and uid = %d limit 1", - dbesc($r[0]['file'] . '[' . $file_tag_encode($file) . ']'), + dbesc($r[0]['file'] . '[' . file_tag_encode($file) . ']'), intval($item), intval($uid) ); -- cgit v1.2.3 From 4972d7ef6ee740f6eb09d8c7efa9a76ee40973c1 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 13 Mar 2012 20:46:37 -0700 Subject: more work on filer, comment level and file tag removal --- include/text.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index c44b4d178..199460d2c 100644 --- a/include/text.php +++ b/include/text.php @@ -874,6 +874,7 @@ 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']); @@ -916,7 +917,7 @@ function prepare_body($item,$attach = false) { $matches = false; $cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER); if($cnt) { - logger('prepare_text: categories: ' . print_r($matches,true), LOGGER_DEBUG); +// logger('prepare_text: categories: ' . print_r($matches,true), LOGGER_DEBUG); foreach($matches as $mtch) { if(strlen($x)) $x .= ','; @@ -931,11 +932,11 @@ function prepare_body($item,$attach = 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); +// 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]); + $x .= '   '; + $x .= file_tag_decode($mtch[1]). ' ' . t('[remove]') . ''; } if(strlen($x) && (local_user() == $item['uid'])) $s .= '
' . t('Filed under:') . ' ' . $x . '
'; -- cgit v1.2.3 From 224dfa848bf2659ba038b6e519692d3755eb7bed Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 16 Mar 2012 05:51:04 -0700 Subject: bug #335 network search broken after new ssl policy settings --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index d34fd7fbe..cdf82ca87 100644 --- a/include/text.php +++ b/include/text.php @@ -638,7 +638,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) -- cgit v1.2.3 From 67fd539f53756723d844dd204639146587f5bb76 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 17 Mar 2012 18:15:36 -0700 Subject: bug #337, call template_unescape() only at the end of template processing --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index cdf82ca87..89acbf9fa 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); }} -- cgit v1.2.3 From 2349852b4abd1638624b541f173f51d1fb1ea011 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 19 Mar 2012 03:18:39 -0700 Subject: support "no_smilies" --- include/text.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 89acbf9fa..a0ff1600e 100644 --- a/include/text.php +++ b/include/text.php @@ -694,8 +694,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);
 
-- 
cgit v1.2.3