From 0ee403eab3a29a98f85dc9fe304c25c6f037b24a Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 30 Nov 2018 10:50:00 +0100 Subject: Move cache code to addon --- include/text.php | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 7c0610ed9..866b3fa2c 100644 --- a/include/text.php +++ b/include/text.php @@ -1111,23 +1111,13 @@ function linkify($s, $me = false) { function sslify($s) { // Local photo cache - if(get_config('system','photo_cache_enable', 0) && local_channel()) { - $matches = null; - $cnt = preg_match_all("/\/", $s, $matches, PREG_SET_ORDER); - if ($cnt) { - foreach ($matches as $match) { - logger('uid: ' . $uid . '; url: ' . $match[2], LOGGER_DEBUG); - $cache = array( - 'url' => $match[2], - 'uid' => local_channel() - ); - call_hooks('cache_url_hook', $cache); - logger('cache status: ' . intval($cache['status']) .'; cached as: ' . ($cache['cached'] ? $cache['hash'] : '-'), LOGGER_DEBUG); - if($cache['cached']) - $s = str_replace($match[2], z_root() . '/photo/' . $cache['hash'] . '-' . $cache['res'], $s); - } - } - } + $str = array( + 'body' => $s, + 'uid' => local_channel() + ); + call_hooks('cache_body_hook', $str); + + $s = $str['body']; if (strpos(z_root(),'https:') === false) return $s; -- cgit v1.2.3