diff --git a/OpenGraph.php b/OpenGraph.php index af2e7b6..76bb968 100644 --- a/OpenGraph.php +++ b/OpenGraph.php @@ -96,10 +96,18 @@ static private function _parse($HTML) { $nonOgDescription = null; foreach ($tags AS $tag) { - if ($tag->hasAttribute('property') && - strpos($tag->getAttribute('property'), 'og:') === 0) { + if ($tag->hasAttribute('property') && strpos($tag->getAttribute('property'), 'og:') === 0) { $key = strtr(substr($tag->getAttribute('property'), 3), '-', '_'); - $page->_values[$key] = $tag->getAttribute('content'); + + if(isset($key)){ + if(!is_array($page->_values[$key])){ + $temp = $page->_values[$key]; + $page->_values[$key] = array($temp); + } + $page->_values[$key][] = $tag->getAttribute('content'); + }else{ + $page->_values[$key] = $tag->getAttribute('content'); + } } //Added this if loop to retrieve description values from sites like the New York Times who have malformed it.