]> git.mxchange.org Git - friendica.git/blobdiff - include/oembed.php
Improved the margins of the headers
[friendica.git] / include / oembed.php
index 2ecb11e1f5f684d45b8f2f739476ad6c0254af97..19bdc474f545aa4b14e690970e0bf7b7a9042f2a 100755 (executable)
@@ -78,6 +78,11 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){
        if (!is_object($j))
                return false;
 
+       // Always embed the SSL version
+       if (isset($j->html))
+               $j->html = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),
+                       array("https://www.youtube.com/", "https://player.vimeo.com/"), $j->html);
+
        $j->embedurl = $embedurl;
 
        // If fetching information doesn't work, then improve via internal functions
@@ -105,6 +110,8 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){
                }
        }
 
+       call_hooks('oembed_fetch_url', $embedurl, $j);
+
        return $j;
 }
 
@@ -156,6 +163,7 @@ function oembed_format_object($j){
 
        // add link to source if not present in "rich" type
        if ($j->type!='rich' || !strpos($j->html,$embedurl) ){
+               $ret .= "<h4>";
                if (isset($j->title)) {
                        if (isset($j->provider_name))
                                $ret .= $j->provider_name.": ";
@@ -182,11 +190,12 @@ function oembed_format_object($j){
                }
                //if (isset($j->author_name)) $ret.=" by ".$j->author_name;
                //if (isset($j->provider_name)) $ret.=" on ".$j->provider_name;
+               $ret .= "</h4>";
        } else {
                // add <a> for html2bbcode conversion
                $ret .= "<a href='$embedurl' rel='oembed'>$embedurl</a>";
+               $ret.="<br style='clear:left'></span>";
        }
-       $ret.="<br style='clear:left'></span>";
        return  mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret));
 }