]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/OEmbed.php
Add pwdreset_time field to user table
[friendica.git] / src / Content / OEmbed.php
index 58fe32ade1b1d4103e49ba666b79464224876ffb..bcfb2346745ae25f07a4ddcd40b7c1c9b64accf7 100644 (file)
@@ -6,6 +6,7 @@
 
 namespace Friendica\Content;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Cache;
 use Friendica\Core\System;
 use Friendica\Core\Config;
@@ -67,7 +68,7 @@ class OEmbed
                // 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");
+               $noexts = ["mp3", "mp4", "ogg", "ogv", "oga", "ogm", "webm"];
                $ext = pathinfo(strtolower($embedurl), PATHINFO_EXTENSION);
 
 
@@ -125,20 +126,18 @@ class OEmbed
 
                // 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->html = str_replace(["http://www.youtube.com/", "http://player.vimeo.com/"], ["https://www.youtube.com/", "https://player.vimeo.com/"], $j->html);
                }
 
                $j->embedurl = $embedurl;
 
                // If fetching information doesn't work, then improve via internal functions
-               if (($j->type == "error") || ($no_rich_type && ($j->type == "rich"))) {
+               if ($no_rich_type && ($j->type == "rich")) {
                        $data = ParseUrl::getSiteinfoCached($embedurl, true, false);
                        $j->type = $data["type"];
 
                        if ($j->type == "photo") {
                                $j->url = $data["url"];
-                               //$j->width = $data["images"][0]["width"];
-                               //$j->height = $data["images"][0]["height"];
                        }
 
                        if (isset($data["title"])) {
@@ -156,7 +155,7 @@ class OEmbed
                        }
                }
 
-               call_hooks('oembed_fetch_url', $embedurl, $j);
+               Addon::callHooks('oembed_fetch_url', $embedurl, $j);
 
                return $j;
        }
@@ -177,14 +176,14 @@ class OEmbed
                                        $th = 120;
                                        $tw = $th * $tr;
                                        $tpl = get_markup_template('oembed_video.tpl');
-                                       $ret .= replace_macros($tpl, array(
+                                       $ret .= replace_macros($tpl, [
                                                '$baseurl' => System::baseUrl(),
                                                '$embedurl' => $embedurl,
                                                '$escapedhtml' => base64_encode($jhtml),
                                                '$tw' => $tw,
                                                '$th' => $th,
                                                '$turl' => $j->thumbnail_url,
-                                       ));
+                                       ]);
                                } else {
                                        $ret = $jhtml;
                                }
@@ -319,8 +318,8 @@ class OEmbed
        public static function getHTML($url, $title = null)
        {
                // Always embed the SSL version
-               $url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),
-                                       array("https://www.youtube.com/", "https://player.vimeo.com/"), $url);
+               $url = str_replace(["http://www.youtube.com/", "http://player.vimeo.com/"],
+                                       ["https://www.youtube.com/", "https://player.vimeo.com/"], $url);
 
                $o = self::fetchURL($url, !self::isAllowedURL($url));