From 473f893d040899d13fc936cd79096ec14fe1261a Mon Sep 17 00:00:00 2001 From: hannes Date: Tue, 26 Jan 2016 01:07:44 +0000 Subject: [PATCH] detab --- plugins/Oembed/OembedPlugin.php | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/plugins/Oembed/OembedPlugin.php b/plugins/Oembed/OembedPlugin.php index db94224d2d..24b9591516 100644 --- a/plugins/Oembed/OembedPlugin.php +++ b/plugins/Oembed/OembedPlugin.php @@ -47,26 +47,26 @@ class OembedPlugin extends Plugin ); $metadata = oEmbedHelper::getOembedFrom($api, $url, $params); - // Facebook just gives us javascript in its oembed html, - // so use the content of the title element instead + // Facebook just gives us javascript in its oembed html, + // so use the content of the title element instead if(strpos($url,'https://www.facebook.com/') === 0) { - $metadata->html = $dom->getElementsByTagName('title')->item(0)->nodeValue; + $metadata->html = $dom->getElementsByTagName('title')->item(0)->nodeValue; } - // Wordpress sometimes also just gives us javascript, use og:description if it is available - $xpath = new DomXpath($dom); - $generatorNode = $xpath->query('//meta[@name="generator"][1]')->item(0); - if ($generatorNode instanceof DomElement) { - // when wordpress only gives us javascript, the html stripped from tags - // is the same as the title, so this helps us to identify this (common) case - if(strpos($generatorNode->getAttribute('content'),'WordPress') === 0 - && trim(strip_tags($metadata->html)) == trim($metadata->title)) { - $propertyNode = $xpath->query('//meta[@property="og:description"][1]')->item(0); - if ($propertyNode instanceof DomElement) { - $metadata->html = $propertyNode->getAttribute('content'); - } - } - } + // Wordpress sometimes also just gives us javascript, use og:description if it is available + $xpath = new DomXpath($dom); + $generatorNode = $xpath->query('//meta[@name="generator"][1]')->item(0); + if ($generatorNode instanceof DomElement) { + // when wordpress only gives us javascript, the html stripped from tags + // is the same as the title, so this helps us to identify this (common) case + if(strpos($generatorNode->getAttribute('content'),'WordPress') === 0 + && trim(strip_tags($metadata->html)) == trim($metadata->title)) { + $propertyNode = $xpath->query('//meta[@property="og:description"][1]')->item(0); + if ($propertyNode instanceof DomElement) { + $metadata->html = $propertyNode->getAttribute('content'); + } + } + } } catch (Exception $e) { common_log(LOG_INFO, 'Could not find an oEmbed endpoint using link headers, trying OpenGraph from HTML.'); // Just ignore it!