aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorM. Dent <dentm42@gmail.com>2018-12-02 19:33:54 +0100
committerM. Dent <dentm42@gmail.com>2018-12-02 19:33:54 +0100
commit0b38ab259c6179fc3465efe2a1ed721a73311ba8 (patch)
treed1cd6fca0a88c11782b4376faec133a1c2812bf2 /include
parent237c6eed5024d2507630f2321218685b3540c957 (diff)
parent2a57e00cb4a7dada0993e91e0e2176ad335cf12f (diff)
downloadvolse-hubzilla-0b38ab259c6179fc3465efe2a1ed721a73311ba8.tar.gz
volse-hubzilla-0b38ab259c6179fc3465efe2a1ed721a73311ba8.tar.bz2
volse-hubzilla-0b38ab259c6179fc3465efe2a1ed721a73311ba8.zip
Merge branch 'photocache' into 'dev'
Add Photo Cache addon support See merge request hubzilla/core!1412
Diffstat (limited to 'include')
-rw-r--r--include/text.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/include/text.php b/include/text.php
index edd0f7a5a..cce8a6ed5 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1105,23 +1105,33 @@ function linkify($s, $me = false) {
* to a local redirector which uses https and which redirects to the selected content
*
* @param string $s
+ * @param int $uid
* @returns string
*/
function sslify($s) {
+
+ // Local photo cache
+ $str = array(
+ 'body' => $s,
+ 'uid' => local_channel()
+ );
+ call_hooks('cache_body_hook', $str);
+
+ $s = $str['body'];
+
if (strpos(z_root(),'https:') === false)
return $s;
-
+
// By default we'll only sslify img tags because media files will probably choke.
// You can set sslify_everything if you want - but it will likely white-screen if it hits your php memory limit.
// The downside is that http: media files will likely be blocked by your browser
// Complain to your browser maker
$allow = get_config('system','sslify_everything');
-
- $pattern = (($allow) ? "/\<(.*?)src=\"(http\:.*?)\"(.*?)\>/" : "/\<img(.*?)src=\"(http\:.*?)\"(.*?)\>/" );
+ $pattern = (($allow) ? "/\<(.*?)src=[\"|'](http\:.*?)[\"|'](.*?)\>/" : "/\<img(.*?)src=[\"|'](http\:.*?)[\"|'](.*?)\>/" );
$matches = null;
- $cnt = preg_match_all($pattern,$s,$matches,PREG_SET_ORDER);
+ $cnt = preg_match_all($pattern, $s, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $match) {
$filename = basename( parse_url($match[2], PHP_URL_PATH) );
@@ -3295,7 +3305,7 @@ function cleanup_bbcode($body) {
$body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body);
- $body = scale_external_images($body,false);
+ $body = scale_external_images($body, false);
return $body;
}