diff options
author | friendica <info@friendica.com> | 2014-05-13 20:17:52 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-05-13 20:17:52 -0700 |
commit | 2c27ba66a5a05a52a6f0144ebd3e65562edba14b (patch) | |
tree | b8a62616a21006999fd212b090206ec5f5264930 /include/items.php | |
parent | a4869394f45886a9a6945c3ec0354dee42c1afda (diff) | |
download | volse-hubzilla-2c27ba66a5a05a52a6f0144ebd3e65562edba14b.tar.gz volse-hubzilla-2c27ba66a5a05a52a6f0144ebd3e65562edba14b.tar.bz2 volse-hubzilla-2c27ba66a5a05a52a6f0144ebd3e65562edba14b.zip |
zrlify (turn into zmg) any relevant img tags in a post.
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php index 7a94336be..5aaeb55c0 100755 --- a/include/items.php +++ b/include/items.php @@ -239,6 +239,31 @@ function red_unescape_codeblock($m) { } +function red_zrlify_img_callback($matches) { + $m = @parse_url($matches[2]); + $zrl = false; + if($m['host']) { + $r = q("select hubloc_url from hubloc where hubloc_host = '%s' limit 1", + dbesc($m['host']) + ); + if($r) + $zrl = true; + } + + $t = strip_zids($matches[2]); + if($t !== $matches[2]) { + $zrl = true; + $matches[2] = $t; + } + + if($zrl) + return '[zmg' . $matches[1] . ']' . $matches[2] . '[/zmg]'; + return $matches[0]; +} + + + + /** * @function post_activity_item($arr) * |