Skip to content

Commit

Permalink
version 1.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Mar 2, 2016
1 parent 0750f30 commit 3112353
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
9 changes: 9 additions & 0 deletions changelog.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"version": "1.4.8",
"downloadUrl": "https://github.com/engram-design/FeedMe/archive/1.4.8.zip",
"date": "2016-03-03 10:00:00",
"notes": [
"[Added] Fix for json parsing when special characters in feed content.",
"[Improved] Better logging when a feed cannot be parsed."
]
},
{
"version": "1.4.7",
"downloadUrl": "https://github.com/engram-design/FeedMe/archive/1.4.7.zip",
Expand Down
2 changes: 1 addition & 1 deletion feedme/FeedMePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function getName()

public function getVersion()
{
return '1.4.7';
return '1.4.8';
}

public function getSchemaVersion()
Expand Down
4 changes: 4 additions & 0 deletions feedme/services/FeedMe_FeedJSONService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class FeedMe_FeedJSONService extends BaseApplicationComponent
public function getFeed($url, $primaryElement) {
if (false === ($raw_content = craft()->feedMe_feed->getRawData($url))) {
craft()->userSession->setError(Craft::t('Unable to parse Feed URL.'));
FeedMePlugin::log('Unable to parse Feed URL.', LogLevel::Error, true);

return false;
}

Expand All @@ -24,6 +26,8 @@ public function getFeed($url, $primaryElement) {

if (!is_array($json_array)) {
craft()->userSession->setError(Craft::t('Invalid JSON.'));
FeedMePlugin::log('Invalid JSON.', LogLevel::Error, true);

return false;
}

Expand Down
10 changes: 9 additions & 1 deletion feedme/services/FeedMe_FeedXMLService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ public function getFeed($url, $primaryElement, $returnAttr = false)
{
if (false === ($raw_content = craft()->feedMe_feed->getRawData($url))) {
craft()->userSession->setError(Craft::t('Unable to parse Feed URL.'));
FeedMePlugin::log('Unable to parse Feed URL.', LogLevel::Error, true);

return false;
}

// Perform cleanup on raw data first
$raw_content = preg_replace("/[\r\n]+/", " ", $raw_content);
$xml = utf8_encode($raw_content);

// Parse the XML string
$xml_array = $this->parseXML($raw_content);
$xml_array = $this->parseXML($xml);

// Convert it to an array
$xml_array = $this->elementArray($xml_array, true, $returnAttr);
Expand All @@ -24,6 +30,8 @@ public function getFeed($url, $primaryElement, $returnAttr = false)

if (!is_array($xml_array)) {
craft()->userSession->setError(Craft::t('Invalid XML.'));
FeedMePlugin::log('Invalid XML.', LogLevel::Error, true);

return false;
}

Expand Down

0 comments on commit 3112353

Please sign in to comment.