]> git.mxchange.org Git - friendica.git/blobdiff - include/oembed.php
make 'PHP "register_argc_argv"' easier to translate, may require fix for po2php
[friendica.git] / include / oembed.php
old mode 100644 (file)
new mode 100755 (executable)
index 118f7fa..1f45d28
@@ -1,6 +1,6 @@
 <?php
 function oembed_replacecb($matches){
-       logger('oembedcb');
+//     logger('oembedcb');
        $embedurl=$matches[1];
        $j = oembed_fetch_url($embedurl);
        $s =  oembed_format_object($j);
@@ -11,9 +11,12 @@ function oembed_replacecb($matches){
 
 
 function oembed_fetch_url($embedurl){
-       
+
        $txt = Cache::get($embedurl);
 
+       // These media files should now be caught in bbcode.php
+       // left here as a fallback in case this is called from another source
+
        $noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm");
        $ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION);
        
@@ -35,7 +38,8 @@ function oembed_fetch_url($embedurl){
                                        $entries = $xpath->query("//link[@type='application/json+oembed']");
                                        foreach($entries as $e){
                                                $href = $e->getAttributeNode("href")->nodeValue;
-                                               $txt = fetch_url($href);
+                                               $txt = fetch_url($href . '&maxwidth=425');
+                                               break;
                                        }
                                }
                        }
@@ -43,7 +47,7 @@ function oembed_fetch_url($embedurl){
                
                if ($txt==false || $txt==""){
                        // try oohembed service
-                       $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl);  
+                       $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=425';  
                        $txt = fetch_url($ourl);
                }
                
@@ -62,7 +66,7 @@ function oembed_fetch_url($embedurl){
        
 function oembed_format_object($j){
        $embedurl = $j->embedurl;
-       $jhtml = oembed_iframe($j->embedurl,$j->width,$j->height );
+       $jhtml = oembed_iframe($j->embedurl,(isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null) );
        $ret="<span class='oembed ".$j->type."'>";
        switch ($j->type) {
                case "video": {