]> git.mxchange.org Git - friendica.git/commitdiff
Add 'system''no_oembed' config option
authorFabio Comuni <fabrix.xm@gmail.com>
Mon, 31 Jan 2011 10:00:35 +0000 (11:00 +0100)
committerFabio Comuni <fabrix.xm@gmail.com>
Mon, 31 Jan 2011 10:00:35 +0000 (11:00 +0100)
htconfig.php
include/oembed.php

index 13c065e69796d5050528bc1d0070ac96bce7ed16..5f5c76cbd7863788de6a990d7c06f6630060ff29 100644 (file)
@@ -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;
+
index d9bf9f67cf9fef8107f10cf138eb36e08e9422e1..cec9cf75af4a4516188a1755020394f61d9b608f 100644 (file)
@@ -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 = "<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.= "</a>";
        } 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", "<!-- oembed $1 --><i>". t('Embedding disabled') ." : $1</i><!-- /oembed $1 -->" ,$text);
+       }
        return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", oembed_replacecb ,$text);
 }
 ?>
\ No newline at end of file