X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Foembed.php;h=80b49fbf046c7095c9724a1e550bc75ed890ab91;hb=d9f8fbeb4f83112ed1c856b694c3bc96a6f782fa;hp=a1945894fcaf3fb877ff36c7e2b5a2ec1e0b7e71;hpb=f852f7aac0b44f243d3cd812aa92122f7b38067b;p=friendica.git diff --git a/include/oembed.php b/include/oembed.php index a1945894fc..80b49fbf04 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -4,8 +4,9 @@ * @file include/oembed.php */ -use \Friendica\ParseUrl; -use \Friendica\Core\Config; +use Friendica\App; +use Friendica\ParseUrl; +use Friendica\Core\Config; function oembed_replacecb($matches){ $embedurl=$matches[1]; @@ -17,10 +18,10 @@ function oembed_replacecb($matches){ /** * @brief Get data from an URL to embed its content. - * + * * @param string $embedurl The URL from which the data should be fetched. * @param bool $no_rich_type If set to true rich type content won't be fetched. - * + * * @return bool|object Returns object with embed content or false if no embedable * content exists */ @@ -41,8 +42,8 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){ // 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); + $noexts = array("mp3", "mp4", "ogg", "ogv", "oga", "ogm", "webm"); + $ext = pathinfo(strtolower($embedurl), PATHINFO_EXTENSION); if (is_null($txt)) { @@ -74,21 +75,10 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){ } } - if ($txt==false || $txt=="") { - $embedly = Config::get("system", "embedly"); - if ($embedly != "") { - // try embedly service - $ourl = "https://api.embed.ly/1/oembed?key=".$embedly."&url=".urlencode($embedurl); - $txt = fetch_url($ourl); - - logger("oembed_fetch_url: ".$txt, LOGGER_DEBUG); - } - } - - $txt=trim($txt); + $txt = trim($txt); - if ($txt[0]!="{") { - $txt='{"type":"error"}'; + if ($txt[0] != "{") { + $txt = '{"type":"error"}'; } else { //save in cache $j = json_decode($txt); if ($j->type != "error") {