aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-05-27 05:27:35 -0700
committerfriendica <info@friendica.com>2013-05-27 05:27:35 -0700
commitdf32c93d562f0dfcc28ebf36723ef07dab630b90 (patch)
tree9ccbff9a691d896409c23024502b3a11e3e1db9c /include/text.php
parent5c1f959c1828066358ec868ffb953e88f16195c6 (diff)
downloadvolse-hubzilla-df32c93d562f0dfcc28ebf36723ef07dab630b90.tar.gz
volse-hubzilla-df32c93d562f0dfcc28ebf36723ef07dab630b90.tar.bz2
volse-hubzilla-df32c93d562f0dfcc28ebf36723ef07dab630b90.zip
zidify img links, delay notifier until actually published for time travelling posts
Diffstat (limited to 'include/text.php')
-rwxr-xr-xinclude/text.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/include/text.php b/include/text.php
index b1cf900b6..c0ab406e5 100755
--- a/include/text.php
+++ b/include/text.php
@@ -1138,11 +1138,29 @@ function zidify_callback($match) {
return $x;
}
+function zidify_img_callback($match) {
+ if (feature_enabled(local_user(),'sendzid')) {
+ $replace = '<img' . $match[1] . ' src="' . zid($match[2]) . '"';
+ }
+ else {
+ $replace = '<img' . $match[1] . ' src="' . zid($match[3]) . '"';
+ }
+
+ $x = str_replace($match[0],$replace,$match[0]);
+ return $x;
+}
+
+
function zidify_links($s) {
- if (feature_enabled(local_user(),'sendzid')) {
- $s = preg_replace_callback('/\<a(.*?)href\=\"(.*?)\"/ism','zidify_callback',$s);}
+ if(feature_enabled(local_user(),'sendzid')) {
+ $s = preg_replace_callback('/\<a(.*?)href\=\"(.*?)\"/ism','zidify_callback',$s);
+ $s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"/ism','zidify_img_callback',$s);
+ }
else {
- $s = preg_replace_callback('/\<a(.*?)class\=\"zrl\"(.*?)href\=\"(.*?)\"/ism','zidify_callback',$s);}
+ $s = preg_replace_callback('/\<a(.*?)class\=\"zrl\"(.*?)href\=\"(.*?)\"/ism','zidify_callback',$s);
+ // FIXME zidify only img links from known Red servers.
+ $s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"/ism','zidify_img_callback',$s);
+ }
return $s;
}