From 9f725297e522f2163821bd936ff2a87717aa83d7 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 4 Aug 2014 16:13:54 +0200 Subject: [PATCH] Add support for twitter cards --- OpenGraph.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenGraph.php b/OpenGraph.php index af2e7b6..8835a8f 100644 --- a/OpenGraph.php +++ b/OpenGraph.php @@ -112,6 +112,12 @@ static private function _parse($HTML) { if ($tag->hasAttribute('name') && $tag->getAttribute('name') === 'description') { $nonOgDescription = $tag->getAttribute('content'); } + + if ($tag->hasAttribute('property') && + strpos($tag->getAttribute('property'), 'twitter:') === 0) { + $key = strtr($tag->getAttribute('property'), '-:', '__'); + $page->_values[$key] = $tag->getAttribute('content'); + } } //Based on modifications at https://github.com/bashofmann/opengraph/blob/master/src/OpenGraph/OpenGraph.php