aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2018-11-30 10:50:00 +0100
committerMax Kostikov <max@kostikov.co>2018-11-30 10:50:00 +0100
commit0ee403eab3a29a98f85dc9fe304c25c6f037b24a (patch)
tree5950eba40032c383546ca43cb6ad1cfb061dcd56 /include
parent6f2d09eb205f09cdc83225b6fadff316b934e1eb (diff)
downloadvolse-hubzilla-0ee403eab3a29a98f85dc9fe304c25c6f037b24a.tar.gz
volse-hubzilla-0ee403eab3a29a98f85dc9fe304c25c6f037b24a.tar.bz2
volse-hubzilla-0ee403eab3a29a98f85dc9fe304c25c6f037b24a.zip
Move cache code to addon
Diffstat (limited to 'include')
-rw-r--r--include/text.php24
1 files changed, 7 insertions, 17 deletions
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("/\<img(.+?)src=[\"|'](https?\:.*?)[\"|'](.*?)\>/", $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;