diff options
author | friendica <info@friendica.com> | 2012-03-15 15:30:52 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-03-15 15:30:52 -0700 |
commit | 5d2c590fa93764c19043981e8398d97c6bae902b (patch) | |
tree | 5f8ac29b83606f9405430a7605dd42b8d66bef43 /include/text.php | |
parent | 5c75d40c0b6bee04d8c58a6f88ecbbe34684874a (diff) | |
parent | b5120888cf6e3aac29aa2a8d80bddcab73822e1e (diff) | |
download | volse-hubzilla-5d2c590fa93764c19043981e8398d97c6bae902b.tar.gz volse-hubzilla-5d2c590fa93764c19043981e8398d97c6bae902b.tar.bz2 volse-hubzilla-5d2c590fa93764c19043981e8398d97c6bae902b.zip |
Merge pull request #136 from annando/master
Mail improvements, item caching and so on
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 19 |
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']; }} |