`
*
* @since Beta 2
- * @return array|null List of {@see SimplePie_Author} objects
+ * @return SimplePie_Author[]|null List of {@see SimplePie_Author} objects
*/
public function get_authors()
{
@@ -649,7 +633,7 @@ public function get_authors()
$email = null;
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
{
- $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
+ $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
{
@@ -657,7 +641,7 @@ public function get_authors()
}
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
{
- $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
+ $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if ($name !== null || $email !== null || $uri !== null)
{
@@ -671,7 +655,7 @@ public function get_authors()
$email = null;
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
{
- $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
+ $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
{
@@ -679,7 +663,7 @@ public function get_authors()
}
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
{
- $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
+ $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if ($name !== null || $email !== null || $url !== null)
{
@@ -688,19 +672,19 @@ public function get_authors()
}
if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author'))
{
- $authors[] = $this->registry->create('Author', array(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_HTML)));
+ $authors[] = $this->registry->create('Author', array(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)));
}
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
{
- $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null));
+ $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
}
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
{
- $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null));
+ $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
}
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
{
- $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null));
+ $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
}
if (!empty($authors))
@@ -715,10 +699,8 @@ public function get_authors()
{
return $authors;
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -743,10 +725,8 @@ public function get_copyright()
{
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -825,10 +805,8 @@ public function get_date($date_format = 'j F Y, g:i a')
return date($date_format, $this->data['date']['parsed']);
}
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -876,10 +854,8 @@ public function get_updated_date($date_format = 'j F Y, g:i a')
return date($date_format, $this->data['updated']['parsed']);
}
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -905,10 +881,8 @@ public function get_local_date($date_format = '%c')
{
return strftime($date_format, $date);
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -969,10 +943,8 @@ public function get_permalink()
{
return $enclosure->get_link();
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -990,10 +962,8 @@ public function get_link($key = 0, $rel = 'alternate')
{
return $links[$key];
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -1073,10 +1043,8 @@ public function get_links($rel = 'alternate')
{
return $this->data['links'][$rel];
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -1096,10 +1064,8 @@ public function get_enclosure($key = 0, $prefer = null)
{
return $enclosures[$key];
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -2922,10 +2888,8 @@ public function get_enclosures()
{
return $this->data['enclosures'];
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -2950,10 +2914,8 @@ public function get_latitude()
{
return (float) $match[1];
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -2982,10 +2944,8 @@ public function get_longitude()
{
return (float) $match[2];
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -3000,10 +2960,7 @@ public function get_source()
{
return $this->registry->create('Source', array($this, $return[0]));
}
- else
- {
- return null;
- }
+
+ return null;
}
}
-
diff --git a/lib/simplepie/library/SimplePie/Locator.php b/lib/simplepie/library/SimplePie/Locator.php
index bc314c2cdcd..3876a2da6bb 100644
--- a/lib/simplepie/library/SimplePie/Locator.php
+++ b/lib/simplepie/library/SimplePie/Locator.php
@@ -62,14 +62,18 @@ class SimplePie_Locator
var $base_location = 0;
var $checked_feeds = 0;
var $max_checked_feeds = 10;
+ var $force_fsockopen = false;
+ var $curl_options = array();
protected $registry;
- public function __construct(SimplePie_File $file, $timeout = 10, $useragent = null, $max_checked_feeds = 10)
+ public function __construct(SimplePie_File $file, $timeout = 10, $useragent = null, $max_checked_feeds = 10, $force_fsockopen = false, $curl_options = array())
{
$this->file = $file;
$this->useragent = $useragent;
$this->timeout = $timeout;
$this->max_checked_feeds = $max_checked_feeds;
+ $this->force_fsockopen = $force_fsockopen;
+ $this->curl_options = $curl_options;
if (class_exists('DOMDocument'))
{
@@ -154,14 +158,8 @@ public function is_feed($file, $check_html = false)
{
$mime_types[] = 'text/html';
}
- if (in_array($sniffed, $mime_types))
- {
- return true;
- }
- else
- {
- return false;
- }
+
+ return in_array($sniffed, $mime_types);
}
elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL)
{
@@ -210,10 +208,8 @@ public function autodiscovery()
{
return array_values($feeds);
}
- else
- {
- return null;
- }
+
+ return null;
}
protected function search_elements_by_tag($name, &$done, $feeds)
@@ -254,7 +250,7 @@ protected function search_elements_by_tag($name, &$done, $feeds)
$headers = array(
'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
);
- $feed = $this->registry->create('File', array($href, $this->timeout, 5, $headers, $this->useragent));
+ $feed = $this->registry->create('File', array($href, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options));
if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed, true))
{
$feeds[$href] = $feed;
@@ -384,7 +380,7 @@ public function extension(&$array)
$headers = array(
'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
);
- $feed = $this->registry->create('File', array($value, $this->timeout, 5, $headers, $this->useragent));
+ $feed = $this->registry->create('File', array($value, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options));
if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
{
return array($feed);
@@ -412,7 +408,7 @@ public function body(&$array)
$headers = array(
'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
);
- $feed = $this->registry->create('File', array($value, $this->timeout, 5, null, $this->useragent));
+ $feed = $this->registry->create('File', array($value, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen, $this->curl_options));
if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
{
return array($feed);
@@ -426,4 +422,3 @@ public function body(&$array)
return null;
}
}
-
diff --git a/lib/simplepie/library/SimplePie/Misc.php b/lib/simplepie/library/SimplePie/Misc.php
index 2e3107eb404..2a2ecc575bc 100644
--- a/lib/simplepie/library/SimplePie/Misc.php
+++ b/lib/simplepie/library/SimplePie/Misc.php
@@ -217,10 +217,8 @@ public static function fix_protocol($url, $http = 1)
{
return substr_replace($url, 'itpc', 0, 4);
}
- else
- {
- return $url;
- }
+
+ return $url;
}
public static function array_merge_recursive($array1, $array2)
@@ -234,9 +232,9 @@ public static function array_merge_recursive($array1, $array2)
else
{
$array1[$key] = $value;
- }
+ }
}
-
+
return $array1;
}
@@ -276,10 +274,8 @@ public static function percent_encoding_normalization($match)
{
return chr($integer);
}
- else
- {
- return strtoupper($match[0]);
- }
+
+ return strtoupper($match[0]);
}
/**
@@ -343,11 +339,9 @@ public static function change_encoding($data, $input, $output)
{
return $return;
}
+
// If we can't do anything, just fail
- else
- {
- return false;
- }
+ return false;
}
protected static function change_encoding_mbstring($data, $input, $output)
@@ -1858,10 +1852,8 @@ public static function parse_mime($mime)
{
return trim($mime);
}
- else
- {
- return trim(substr($mime, 0, $pos));
- }
+
+ return trim(substr($mime, 0, $pos));
}
public static function atom_03_construct_type($attribs)
@@ -1894,10 +1886,8 @@ public static function atom_03_construct_type($attribs)
return SIMPLEPIE_CONSTRUCT_NONE | $mode;
}
}
- else
- {
- return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
- }
+
+ return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
}
public static function atom_10_construct_type($attribs)
@@ -1947,10 +1937,8 @@ public static function atom_10_content_construct_type($attribs)
return SIMPLEPIE_CONSTRUCT_BASE64;
}
}
- else
- {
- return SIMPLEPIE_CONSTRUCT_TEXT;
- }
+
+ return SIMPLEPIE_CONSTRUCT_TEXT;
}
public static function is_isegment_nz_nc($string)
@@ -2007,11 +1995,9 @@ public static function codepoint_to_utf8($codepoint)
{
return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
}
- else
- {
- // U+FFFD REPLACEMENT CHARACTER
- return "\xEF\xBF\xBD";
- }
+
+ // U+FFFD REPLACEMENT CHARACTER
+ return "\xEF\xBF\xBD";
}
/**
@@ -2215,10 +2201,8 @@ public static function get_build()
{
return filemtime(dirname(__FILE__) . '/Core.php');
}
- else
- {
- return filemtime(__FILE__);
- }
+
+ return filemtime(__FILE__);
}
/**
@@ -2276,4 +2260,3 @@ public static function silence_errors($num, $str)
// No-op
}
}
-
diff --git a/lib/simplepie/library/SimplePie/Net/IPv6.php b/lib/simplepie/library/SimplePie/Net/IPv6.php
index 47658aff2af..a054e8be579 100644
--- a/lib/simplepie/library/SimplePie/Net/IPv6.php
+++ b/lib/simplepie/library/SimplePie/Net/IPv6.php
@@ -173,10 +173,8 @@ public static function compress($ip)
{
return implode(':', $ip_parts);
}
- else
- {
- return $ip_parts[0];
- }
+
+ return $ip_parts[0];
}
/**
@@ -200,10 +198,8 @@ private static function split_v6_v4($ip)
$ipv4_part = substr($ip, $pos + 1);
return array($ipv6_part, $ipv4_part);
}
- else
- {
- return array($ip, '');
- }
+
+ return array($ip, '');
}
/**
@@ -253,10 +249,8 @@ public static function check_ipv6($ip)
}
return true;
}
- else
- {
- return false;
- }
+
+ return false;
}
/**
diff --git a/lib/simplepie/library/SimplePie/Parse/Date.php b/lib/simplepie/library/SimplePie/Parse/Date.php
index 1f21566556e..85c4776bdf9 100644
--- a/lib/simplepie/library/SimplePie/Parse/Date.php
+++ b/lib/simplepie/library/SimplePie/Parse/Date.php
@@ -145,6 +145,14 @@ class SimplePie_Parse_Date
'ΠαÏ' => 5,
'Σαβ' => 6,
'ΚυÏ' => 7,
+ // Russian
+ 'Пн.' => 1,
+ 'Ð’Ñ‚.' => 2,
+ 'Ср.' => 3,
+ 'Чт.' => 4,
+ 'Пт.' => 5,
+ 'Сб.' => 6,
+ 'Ð’Ñ.' => 7,
);
/**
@@ -289,7 +297,33 @@ class SimplePie_Parse_Date
'Σεπ' => 9,
'Οκτ' => 10,
'ÎοÎ' => 11,
- 'Δεκ' => 12,
+ 'Δεκ' => 12,
+ // Russian
+ 'Янв' => 1,
+ 'ÑнварÑ' => 1,
+ 'Фев' => 2,
+ 'февралÑ' => 2,
+ 'Мар' => 3,
+ 'марта' => 3,
+ 'Ðпр' => 4,
+ 'апрелÑ' => 4,
+ 'Май' => 5,
+ 'маÑ' => 5,
+ 'Июн' => 6,
+ 'июнÑ' => 6,
+ 'Июл' => 7,
+ 'июлÑ' => 7,
+ 'Ðвг' => 8,
+ 'авгуÑта' => 8,
+ 'Сен' => 9,
+ 'ÑентÑбрÑ' => 9,
+ 'Окт' => 10,
+ 'октÑбрÑ' => 10,
+ 'ÐоÑ' => 11,
+ 'ноÑбрÑ' => 11,
+ 'Дек' => 12,
+ 'декабрÑ' => 12,
+
);
/**
@@ -694,10 +728,8 @@ public function date_w3cdtf($date)
return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
}
- else
- {
- return false;
- }
+
+ return false;
}
/**
@@ -848,10 +880,8 @@ public function date_rfc2822($date)
return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
}
- else
- {
- return false;
- }
+
+ return false;
}
/**
@@ -913,10 +943,8 @@ public function date_rfc850($date)
return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
}
- else
- {
- return false;
- }
+
+ return false;
}
/**
@@ -955,10 +983,8 @@ public function date_asctime($date)
$month = $this->month[strtolower($match[2])];
return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
}
- else
- {
- return false;
- }
+
+ return false;
}
/**
@@ -974,10 +1000,7 @@ public function date_strtotime($date)
{
return false;
}
- else
- {
- return $strtotime;
- }
+
+ return $strtotime;
}
}
-
diff --git a/lib/simplepie/library/SimplePie/Parser.php b/lib/simplepie/library/SimplePie/Parser.php
index 17139abe95a..3cef2287dba 100644
--- a/lib/simplepie/library/SimplePie/Parser.php
+++ b/lib/simplepie/library/SimplePie/Parser.php
@@ -76,26 +76,17 @@ public function set_registry(SimplePie_Registry $registry)
public function parse(&$data, $encoding, $url = '')
{
- if (function_exists('Mf2\parse')) {
+ if (class_exists('DOMXpath') && function_exists('Mf2\parse')) {
+ $doc = new DOMDocument();
+ @$doc->loadHTML($data);
+ $xpath = new DOMXpath($doc);
// Check for both h-feed and h-entry, as both a feed with no entries
// and a list of entries without an h-feed wrapper are both valid.
- $position = 0;
- while ($position = strpos($data, 'h-feed', $position)) {
- $start = $position < 200 ? 0 : $position - 200;
- $check = substr($data, $start, 400);
- if (preg_match('/class="[^"]*h-feed/', $check)) {
- return $this->parse_microformats($data, $url);
- }
- $position += 7;
- }
- $position = 0;
- while ($position = strpos($data, 'h-entry', $position)) {
- $start = $position < 200 ? 0 : $position - 200;
- $check = substr($data, $start, 400);
- if (preg_match('/class="[^"]*h-entry/', $check)) {
- return $this->parse_microformats($data, $url);
- }
- $position += 7;
+ $query = '//*[contains(concat(" ", @class, " "), " h-feed ") or '.
+ 'contains(concat(" ", @class, " "), " h-entry ")]';
+ $result = $xpath->query($query);
+ if ($result->length !== 0) {
+ return $this->parse_microformats($data, $url);
}
}
@@ -185,76 +176,72 @@ public function parse(&$data, $encoding, $url = '')
xml_parser_free($xml);
return $return;
}
- else
+
+ libxml_clear_errors();
+ $xml = new XMLReader();
+ $xml->xml($data);
+ while (@$xml->read())
{
- libxml_clear_errors();
- $xml = new XMLReader();
- $xml->xml($data);
- while (@$xml->read())
+ switch ($xml->nodeType)
{
- switch ($xml->nodeType)
- {
- case constant('XMLReader::END_ELEMENT'):
+ case constant('XMLReader::END_ELEMENT'):
+ if ($xml->namespaceURI !== '')
+ {
+ $tagName = $xml->namespaceURI . $this->separator . $xml->localName;
+ }
+ else
+ {
+ $tagName = $xml->localName;
+ }
+ $this->tag_close(null, $tagName);
+ break;
+ case constant('XMLReader::ELEMENT'):
+ $empty = $xml->isEmptyElement;
+ if ($xml->namespaceURI !== '')
+ {
+ $tagName = $xml->namespaceURI . $this->separator . $xml->localName;
+ }
+ else
+ {
+ $tagName = $xml->localName;
+ }
+ $attributes = array();
+ while ($xml->moveToNextAttribute())
+ {
if ($xml->namespaceURI !== '')
{
- $tagName = $xml->namespaceURI . $this->separator . $xml->localName;
+ $attrName = $xml->namespaceURI . $this->separator . $xml->localName;
}
else
{
- $tagName = $xml->localName;
+ $attrName = $xml->localName;
}
+ $attributes[$attrName] = $xml->value;
+ }
+ $this->tag_open(null, $tagName, $attributes);
+ if ($empty)
+ {
$this->tag_close(null, $tagName);
- break;
- case constant('XMLReader::ELEMENT'):
- $empty = $xml->isEmptyElement;
- if ($xml->namespaceURI !== '')
- {
- $tagName = $xml->namespaceURI . $this->separator . $xml->localName;
- }
- else
- {
- $tagName = $xml->localName;
- }
- $attributes = array();
- while ($xml->moveToNextAttribute())
- {
- if ($xml->namespaceURI !== '')
- {
- $attrName = $xml->namespaceURI . $this->separator . $xml->localName;
- }
- else
- {
- $attrName = $xml->localName;
- }
- $attributes[$attrName] = $xml->value;
- }
- $this->tag_open(null, $tagName, $attributes);
- if ($empty)
- {
- $this->tag_close(null, $tagName);
- }
- break;
- case constant('XMLReader::TEXT'):
+ }
+ break;
+ case constant('XMLReader::TEXT'):
- case constant('XMLReader::CDATA'):
- $this->cdata(null, $xml->value);
- break;
- }
- }
- if ($error = libxml_get_last_error())
- {
- $this->error_code = $error->code;
- $this->error_string = $error->message;
- $this->current_line = $error->line;
- $this->current_column = $error->column;
- return false;
- }
- else
- {
- return true;
+ case constant('XMLReader::CDATA'):
+ $this->cdata(null, $xml->value);
+ break;
}
}
+ if ($error = libxml_get_last_error())
+ {
+ $this->error_code = $error->code;
+ $this->error_string = $error->message;
+ $this->current_line = $error->line;
+ $this->current_column = $error->column;
+ return false;
+ }
+
+ return true;
}
public function get_error_code()
@@ -465,7 +452,7 @@ private function parse_microformats(&$data, $url) {
$h_feed = $mf_item;
break;
}
- // Also look for an h-feed in the children of each top level item.
+ // Also look for h-feed or h-entry in the children of each top level item.
if (!isset($mf_item['children'][0]['type'])) continue;
if (in_array('h-feed', $mf_item['children'][0]['type'])) {
$h_feed = $mf_item['children'][0];
@@ -474,6 +461,13 @@ private function parse_microformats(&$data, $url) {
if (in_array('h-card', $mf_item['type'])) $feed_author = $mf_item;
break;
}
+ else if (in_array('h-entry', $mf_item['children'][0]['type'])) {
+ $entries = $mf_item['children'];
+ // In this case the parent of the h-entry list may be an h-card, so use
+ // it as the feed_author.
+ if (in_array('h-card', $mf_item['type'])) $feed_author = $mf_item;
+ break;
+ }
}
if (isset($h_feed['children'])) {
$entries = $h_feed['children'];
@@ -485,7 +479,7 @@ private function parse_microformats(&$data, $url) {
$feed_author = $mf['items'][0]['properties']['author'][0];
}
}
- else {
+ else if (count($entries) === 0) {
$entries = $mf['items'];
}
for ($i = 0; $i < count($entries); $i++) {
@@ -554,18 +548,21 @@ private function parse_microformats(&$data, $url) {
$photo_list = array();
for ($j = 0; $j < count($entry['properties']['photo']); $j++) {
$photo = $entry['properties']['photo'][$j];
- if (strpos($content, $photo) === false) {
+ if (!empty($photo) && strpos($content, $photo) === false) {
$photo_list[] = $photo;
}
}
// When there's more than one photo show the first and use a lightbox.
+ // Need a permanent, unique name for the image set, but don't have
+ // anything unique except for the content itself, so use that.
$count = count($photo_list);
if ($count > 1) {
+ $image_set_id = preg_replace('/[[:^alnum:]]/', '', $photo_list[0]);
$description = '';
for ($j = 0; $j < $count; $j++) {
$hidden = $j === 0 ? '' : 'class="hidden" ';
$description .= ''.
+ 'data-lightbox="image-set-'.$image_set_id.'">'.
'';
}
$description .= '
'.$count.' photos
';
@@ -583,10 +580,18 @@ private function parse_microformats(&$data, $url) {
$item['title'] = array(array('data' => $title));
}
$description .= $entry['properties']['content'][0]['html'];
- if (isset($entry['properties']['in-reply-to'][0]['value'])) {
- $in_reply_to = $entry['properties']['in-reply-to'][0]['value'];
- $description .= ' '.
- ''.$in_reply_to.'
';
+ if (isset($entry['properties']['in-reply-to'][0])) {
+ $in_reply_to = '';
+ if (is_string($entry['properties']['in-reply-to'][0])) {
+ $in_reply_to = $entry['properties']['in-reply-to'][0];
+ }
+ else if (isset($entry['properties']['in-reply-to'][0]['value'])) {
+ $in_reply_to = $entry['properties']['in-reply-to'][0]['value'];
+ }
+ if ($in_reply_to !== '') {
+ $description .= '
'.
+ ''.$in_reply_to.'
';
+ }
}
$item['description'] = array(array('data' => $description));
}
@@ -627,7 +632,7 @@ private function parse_microformats(&$data, $url) {
$image = array(array('child' => array('' => array('url' =>
array(array('data' => $feed_author['properties']['photo'][0]))))));
}
- // Use the a name given for the h-feed, or get the title from the html.
+ // Use the name given for the h-feed, or get the title from the html.
if ($feed_title !== '') {
$feed_title = array(array('data' => htmlspecialchars($feed_title)));
}
@@ -653,4 +658,4 @@ private function declare_html_entities() {
// html is allowed, but the xml specification says they must be declared.
return ' ]>';
}
-}
\ No newline at end of file
+}
diff --git a/lib/simplepie/library/SimplePie/Rating.php b/lib/simplepie/library/SimplePie/Rating.php
index eaf57080c0d..108dd22bfa6 100644
--- a/lib/simplepie/library/SimplePie/Rating.php
+++ b/lib/simplepie/library/SimplePie/Rating.php
@@ -103,10 +103,8 @@ public function get_scheme()
{
return $this->scheme;
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -120,9 +118,7 @@ public function get_value()
{
return $this->value;
}
- else
- {
- return null;
- }
+
+ return null;
}
}
diff --git a/lib/simplepie/library/SimplePie/Registry.php b/lib/simplepie/library/SimplePie/Registry.php
old mode 100644
new mode 100755
diff --git a/lib/simplepie/library/SimplePie/Restriction.php b/lib/simplepie/library/SimplePie/Restriction.php
index 001a5cd2821..803d84fde92 100644
--- a/lib/simplepie/library/SimplePie/Restriction.php
+++ b/lib/simplepie/library/SimplePie/Restriction.php
@@ -112,10 +112,8 @@ public function get_relationship()
{
return $this->relationship;
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -129,10 +127,8 @@ public function get_type()
{
return $this->type;
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -146,9 +142,7 @@ public function get_value()
{
return $this->value;
}
- else
- {
- return null;
- }
+
+ return null;
}
}
diff --git a/lib/simplepie/library/SimplePie/Sanitize.php b/lib/simplepie/library/SimplePie/Sanitize.php
index 5a11721df12..40b06626639 100644
--- a/lib/simplepie/library/SimplePie/Sanitize.php
+++ b/lib/simplepie/library/SimplePie/Sanitize.php
@@ -354,7 +354,7 @@ public function sanitize($data, $type, $base = '')
}
else
{
- trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
+ trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
}
}
}
diff --git a/lib/simplepie/library/SimplePie/Source.php b/lib/simplepie/library/SimplePie/Source.php
index 1a66a392db5..8fac13ef7eb 100644
--- a/lib/simplepie/library/SimplePie/Source.php
+++ b/lib/simplepie/library/SimplePie/Source.php
@@ -79,10 +79,8 @@ public function get_source_tags($namespace, $tag)
{
return $this->data['child'][$namespace][$tag];
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_base($element = array())
@@ -130,10 +128,8 @@ public function get_title()
{
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_category($key = 0)
@@ -143,10 +139,8 @@ public function get_category($key = 0)
{
return $categories[$key];
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_categories()
@@ -200,10 +194,8 @@ public function get_categories()
{
return array_unique($categories);
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_author($key = 0)
@@ -213,10 +205,8 @@ public function get_author($key = 0)
{
return $authors[$key];
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_authors()
@@ -283,10 +273,8 @@ public function get_authors()
{
return array_unique($authors);
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_contributor($key = 0)
@@ -296,10 +284,8 @@ public function get_contributor($key = 0)
{
return $contributors[$key];
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_contributors()
@@ -354,10 +340,8 @@ public function get_contributors()
{
return array_unique($contributors);
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_link($key = 0, $rel = 'alternate')
@@ -367,10 +351,8 @@ public function get_link($key = 0, $rel = 'alternate')
{
return $links[$key];
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -449,10 +431,8 @@ public function get_links($rel = 'alternate')
{
return $this->data['links'][$rel];
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_description()
@@ -493,10 +473,8 @@ public function get_description()
{
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_copyright()
@@ -521,10 +499,8 @@ public function get_copyright()
{
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_language()
@@ -545,10 +521,8 @@ public function get_language()
{
return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_latitude()
@@ -561,10 +535,8 @@ public function get_latitude()
{
return (float) $match[1];
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_longitude()
@@ -581,10 +553,8 @@ public function get_longitude()
{
return (float) $match[2];
}
- else
- {
- return null;
- }
+
+ return null;
}
public function get_image_url()
@@ -601,10 +571,7 @@ public function get_image_url()
{
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
}
- else
- {
- return null;
- }
+
+ return null;
}
}
-
diff --git a/lib/simplepie/library/SimplePie/XML/Declaration/Parser.php b/lib/simplepie/library/SimplePie/XML/Declaration/Parser.php
index 99e751672a5..18ca1b79b5e 100644
--- a/lib/simplepie/library/SimplePie/XML/Declaration/Parser.php
+++ b/lib/simplepie/library/SimplePie/XML/Declaration/Parser.php
@@ -136,13 +136,11 @@ public function parse()
{
return true;
}
- else
- {
- $this->version = '';
- $this->encoding = '';
- $this->standalone = '';
- return false;
- }
+
+ $this->version = '';
+ $this->encoding = '';
+ $this->standalone = '';
+ return false;
}
/**
diff --git a/lib/simplepie/library/SimplePie/gzdecode.php b/lib/simplepie/library/SimplePie/gzdecode.php
index 0e8bc8fc695..f4aeafa2885 100644
--- a/lib/simplepie/library/SimplePie/gzdecode.php
+++ b/lib/simplepie/library/SimplePie/gzdecode.php
@@ -338,10 +338,8 @@ public function parse()
{
return false;
}
- else
- {
- $this->position = $this->compressed_size - 8;
- }
+
+ $this->position = $this->compressed_size - 8;
// Check CRC of data
$crc = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
@@ -362,9 +360,7 @@ public function parse()
// Wow, against all odds, we've actually got a valid gzip string
return true;
}
- else
- {
- return false;
- }
+
+ return false;
}
}