Skip to content

Commit

Permalink
Improvements to microformats parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
mblaney committed Oct 6, 2015
1 parent a6e19f1 commit ea469ed
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions library/SimplePie/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ private function parse_microformats(&$data, $url) {

$mf = Mf2\parse($data, $url);
foreach ($mf['items'] as $microformat) {
if ($microformat['type'][0] == 'h-entry') {
if (in_array('h-entry', $microformat['type'])) {
$entry = array();
if (isset($microformat['properties']['url'][0])) {
$link = $microformat['properties']['url'][0];
Expand All @@ -429,8 +429,12 @@ private function parse_microformats(&$data, $url) {
$entry['title'] = array(array('data' => $title));
}
if (isset($microformat['properties']['author'][0])) {
$author = htmlspecialchars($microformat['properties']['author'][0]);
$entry['author'] = array(array('data' => $author));
$author = $microformat['properties']['author'][0];
// author is a special case, it can be plain text or an h-card array.
if (is_array($author)) {
$author = isset($author['value']) ? $author['value'] : '';
}
$entry['author'] = array(array('data' => htmlspecialchars($author)));
}
if (isset($microformat['properties']['content'][0]['html'])) {
$description = $microformat['properties']['content'][0]['html'];
Expand Down

0 comments on commit ea469ed

Please sign in to comment.