open graph support for shaarli (oops)

This commit is contained in:
n 2017-02-11 18:32:39 +01:00
parent 766c0f7ae1
commit 95df8e3c86

View file

@ -1,5 +1,5 @@
--- /root/Shaarli/index.php 2017-01-20 16:47:36.000000000 +0100 --- Shaarli/index.php 2017-01-20 16:47:36.000000000 +0100
+++ index.php 2017-02-11 18:19:24.618226000 +0100 +++ index.php 2017-02-11 18:29:08.779509000 +0100
@@ -1821,11 +1821,16 @@ @@ -1821,11 +1821,16 @@
$path = parse_url($url,PHP_URL_PATH); $path = parse_url($url,PHP_URL_PATH);
if ("/talks/" !== substr($path,0,7)) return array(); // This is not a single video URL. if ("/talks/" !== substr($path,0,7)) return array(); // This is not a single video URL.
@ -43,7 +43,7 @@
+ // Extract the link to the thumbnail + // Extract the link to the thumbnail
+ $doc = new DOMDocument(); + $doc = new DOMDocument();
+ libxml_use_internal_errors(true); + libxml_use_internal_errors(true);
+ $doc->loadHTML($headers); + $doc->loadHTML($content);
+ foreach( $doc->getElementsByTagName('meta') as $meta ) + foreach( $doc->getElementsByTagName('meta') as $meta )
+ if ($meta->getAttribute('property') == 'og:image') + if ($meta->getAttribute('property') == 'og:image')
+ $imageurl=$meta->getAttribute('content'); + $imageurl=$meta->getAttribute('content');