turn naked links in posts into zrl's if we've got a hubloc for the site
This commit is contained in:
parent
ba1cb0bb05
commit
db038c5654
@ -268,7 +268,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
|
|||||||
|
|
||||||
$Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/$urlchars+)/ism", '$1<a href="$2" >$2</a>', $Text);
|
$Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/$urlchars+)/ism", '$1<a href="$2" >$2</a>', $Text);
|
||||||
|
|
||||||
// $Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/$urlchars+)\{zid\}($urlchars*)/ism", '$1<a class="zrl" href="$2$3" >$2$3</a>', $Text);
|
|
||||||
|
|
||||||
$Text = preg_replace_callback("/\[share(.*?)\](.*?)\[\/share\]/ism","bb_ShareAttributes",$Text);
|
$Text = preg_replace_callback("/\[share(.*?)\](.*?)\[\/share\]/ism","bb_ShareAttributes",$Text);
|
||||||
|
|
||||||
|
@ -53,6 +53,31 @@ function collect_recipients($item,&$private) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function red_zrl_callback
|
||||||
|
* preg_match function when fixing 'naked' links in mod item.php
|
||||||
|
* Check if we've got a hubloc for the site and use a zrl if we do, a url if we don't.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function red_zrl_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;
|
||||||
|
}
|
||||||
|
if($zrl)
|
||||||
|
return $matches[1] . '[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]';
|
||||||
|
return $matches[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function post_activity_item($arr)
|
* @function post_activity_item($arr)
|
||||||
*
|
*
|
||||||
|
@ -320,6 +320,13 @@ function item_post(&$a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fix naked links by passing through a callback to see if this is a red site
|
||||||
|
* (already known to us) which will get a zrl, otherwise link with url
|
||||||
|
*/
|
||||||
|
|
||||||
|
$body = preg_replace_callback("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\+\,]+)/ism", 'red_zrl_callback', $body);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* When a photo was uploaded into the message using the (profile wall) ajax
|
* When a photo was uploaded into the message using the (profile wall) ajax
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php /** @file */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zot endpoint
|
* Zot endpoint
|
||||||
|
@ -1 +1 @@
|
|||||||
2013-04-17.286
|
2013-04-18.287
|
||||||
|
Reference in New Issue
Block a user