From 6ea87223d3ba5d9ecc1fa57453207e1645819fe5 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 31 Jan 2011 11:00:35 +0100 Subject: [PATCH] Add 'system''no_oembed' config option --- htconfig.php | 5 ++++- include/oembed.php | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htconfig.php b/htconfig.php index 13c065e697..5f5c76cbd7 100644 --- a/htconfig.php +++ b/htconfig.php @@ -72,4 +72,7 @@ $a->config['system']['rino_encrypt'] = true; $a->config['system']['addon'] = 'js_upload'; - \ No newline at end of file +// Disable oembed embedding +// This disable the conversion of [embed]$url[/embed] tag in html +// $a->config['system']['no_oembed'] = true; + diff --git a/include/oembed.php b/include/oembed.php index d9bf9f67cf..cec9cf75af 100644 --- a/include/oembed.php +++ b/include/oembed.php @@ -10,7 +10,7 @@ function oembed_replacecb($matches){ if (isset($j->thumbnail_url)) { $tw = (isset($j->thumbnail_width)) ? $j->thumbnail_width:200; $th = (isset($j->thumbnail_height)) ? $j->thumbnail_height:180; - $ret = ""; + $ret = ""; $ret.= ""; $ret.= ""; } else { @@ -41,8 +41,9 @@ function oembed_replacecb($matches){ function oembed_bbcode($text){ $stopoembed = get_config("system","no_oembed"); - if ($stopoembed == True): - return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", "$1" ,$text); + if ($stopoembed == true){ + return preg_replace("/\[embed\](.+?)\[\/embed\]/is", "". t('Embedding disabled') ." : $1" ,$text); + } return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", oembed_replacecb ,$text); } ?> \ No newline at end of file