aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-03-15 16:39:21 -0700
committerfriendica <info@friendica.com>2012-03-15 16:39:21 -0700
commit41d595d5bc74987d95ffc6f81194ccc20050e5a4 (patch)
tree5113a75197923b8b0ff994db0f9feef9ce221aea /include/text.php
parent7684f63ecdfce560f24475630144f6058df15ca9 (diff)
parent5d2c590fa93764c19043981e8398d97c6bae902b (diff)
downloadvolse-hubzilla-41d595d5bc74987d95ffc6f81194ccc20050e5a4.tar.gz
volse-hubzilla-41d595d5bc74987d95ffc6f81194ccc20050e5a4.tar.bz2
volse-hubzilla-41d595d5bc74987d95ffc6f81194ccc20050e5a4.zip
Merge branch 'pull'
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/text.php b/include/text.php
index 199460d2c..d34fd7fbe 100644
--- a/include/text.php
+++ b/include/text.php
@@ -877,14 +877,27 @@ 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)) {
@@ -942,9 +955,9 @@ function prepare_body($item,$attach = false) {
$s .= '<div class="filesavetags"><span>' . t('Filed under:') . ' </span>' . $x . '</div>';
}
-
$prep_arr = array('item' => $item, 'html' => $s);
call_hooks('prepare_body_final', $prep_arr);
+
return $prep_arr['html'];
}}