Add 'system''no_oembed' config option
This commit is contained in:
parent
23d1b994cc
commit
6ea87223d3
2 changed files with 8 additions and 4 deletions
|
@ -72,4 +72,7 @@ $a->config['system']['rino_encrypt'] = true;
|
||||||
$a->config['system']['addon'] = 'js_upload';
|
$a->config['system']['addon'] = 'js_upload';
|
||||||
|
|
||||||
|
|
||||||
|
// Disable oembed embedding
|
||||||
|
// This disable the conversion of [embed]$url[/embed] tag in html
|
||||||
|
// $a->config['system']['no_oembed'] = true;
|
||||||
|
|
|
@ -10,7 +10,7 @@ function oembed_replacecb($matches){
|
||||||
if (isset($j->thumbnail_url)) {
|
if (isset($j->thumbnail_url)) {
|
||||||
$tw = (isset($j->thumbnail_width)) ? $j->thumbnail_width:200;
|
$tw = (isset($j->thumbnail_width)) ? $j->thumbnail_width:200;
|
||||||
$th = (isset($j->thumbnail_height)) ? $j->thumbnail_height:180;
|
$th = (isset($j->thumbnail_height)) ? $j->thumbnail_height:180;
|
||||||
$ret = "<a href='#' onclick='this.innerHTML=unescape(\"".urlencode($j->html)."\").replace(/\+/g,\" \"); return false;' >";
|
$ret = "<a href='".$embedurl."' onclick='this.innerHTML=unescape(\"".urlencode($j->html)."\").replace(/\+/g,\" \"); return false;' >";
|
||||||
$ret.= "<img width='$tw' height='$th' src='".$j->thumbnail_url."'>";
|
$ret.= "<img width='$tw' height='$th' src='".$j->thumbnail_url."'>";
|
||||||
$ret.= "</a>";
|
$ret.= "</a>";
|
||||||
} else {
|
} else {
|
||||||
|
@ -41,8 +41,9 @@ function oembed_replacecb($matches){
|
||||||
|
|
||||||
function oembed_bbcode($text){
|
function oembed_bbcode($text){
|
||||||
$stopoembed = get_config("system","no_oembed");
|
$stopoembed = get_config("system","no_oembed");
|
||||||
if ($stopoembed == True):
|
if ($stopoembed == true){
|
||||||
return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", "$1" ,$text);
|
return preg_replace("/\[embed\](.+?)\[\/embed\]/is", "<!-- oembed $1 --><i>". t('Embedding disabled') ." : $1</i><!-- /oembed $1 -->" ,$text);
|
||||||
|
}
|
||||||
return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", oembed_replacecb ,$text);
|
return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", oembed_replacecb ,$text);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Reference in a new issue