personal oembed black/white list
This commit is contained in:
parent
5344431fc0
commit
ea63f3312f
@ -12,6 +12,7 @@ require_once('include/hubloc.php');
|
|||||||
function tryoembed($match) {
|
function tryoembed($match) {
|
||||||
$url = ((count($match) == 2) ? $match[1] : $match[2]);
|
$url = ((count($match) == 2) ? $match[1] : $match[2]);
|
||||||
|
|
||||||
|
|
||||||
$o = oembed_fetch_url($url);
|
$o = oembed_fetch_url($url);
|
||||||
|
|
||||||
if ($o->type == 'error')
|
if ($o->type == 'error')
|
||||||
|
@ -2,6 +2,35 @@
|
|||||||
function oembed_replacecb($matches){
|
function oembed_replacecb($matches){
|
||||||
|
|
||||||
$embedurl=$matches[1];
|
$embedurl=$matches[1];
|
||||||
|
|
||||||
|
// implements a personal embed white/black list for logged in members
|
||||||
|
if(local_channel()) {
|
||||||
|
if(($x = get_pconfig(local_channel(),'system','embed_deny'))) {
|
||||||
|
$l = explode("\n",$x);
|
||||||
|
if($l) {
|
||||||
|
foreach($l as $ll) {
|
||||||
|
if(trim($ll) && strpos($embedurl,trim($ll)) !== false)
|
||||||
|
return '<a href="' . $embedurl . '">' . $embedurl . '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(($x = get_pconfig(local_channel(),'system','embed_allow'))) {
|
||||||
|
$found = false;
|
||||||
|
$l = explode("\n",$x);
|
||||||
|
if($l) {
|
||||||
|
foreach($l as $ll) {
|
||||||
|
if(trim($ll) && strpos($embedurl,trim($ll)) !== false) {
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(! $found) {
|
||||||
|
return '<a href="' . $embedurl . '">' . $embedurl . '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$j = oembed_fetch_url($embedurl);
|
$j = oembed_fetch_url($embedurl);
|
||||||
$s = oembed_format_object($j);
|
$s = oembed_format_object($j);
|
||||||
return $s;
|
return $s;
|
||||||
|
Reference in New Issue
Block a user