Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
OleVik committed Jan 16, 2019
1 parent a2d5672 commit c1f3d5a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# v3.3.4
## 16-01-2019

1. [](#bugfix)
* Silent fallback from file exists check
* Change filename-hash to use entire source-URL
* Fix config-reference in Parser
2. [](#improved)
* Grav version requirement bump

# v3.3.3
## 08-01-2019

Expand Down
9 changes: 3 additions & 6 deletions Manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public function compare($manifest)
}
$feeds = array();
foreach ($this->twigFeeds as $feed) {
$feeds[$feed['source']]['filename'] = hash('md5', parse_url($feed['source'], PHP_URL_HOST)) . '.json';
$feeds[$feed['source']]['filename'] = hash('md5', $feed['source']) . '.json';
if (isset($feed['name'])) {
$feeds[$feed['source']]['name'] = $feed['name'];
}
Expand All @@ -284,15 +284,12 @@ public function compare($manifest)
$feeds[$feed['source']]['extra_tags'] = $feed['extra_tags'];
}
}
$return = array(
'state' => ''
);
$return = array('state' => '');
if ($manifest['data'] == $feeds) {
$return['state'] = 'unchanged';
return $return;
} else {
$return['state'] = 'changed';
return $return;
}
return $return;
}
}
5 changes: 4 additions & 1 deletion Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public function __construct($config)
*/
public function readFeed($file)
{
if (!file_exists($file)) {
return false;
}
$feed = file_get_contents($file);
$json = json_decode($feed, true);
return $json;
Expand Down Expand Up @@ -85,7 +88,7 @@ public function parseFeed($args, $path = false)
$resource = $reader->download($args['source']);
}
} catch (InvalidCertificateException $e) {
if ($this->config['silence_security'] === false) {
if ($this->config['silence_security'] != 'true') {
throw new \Exception($e);
}
}
Expand Down
4 changes: 2 additions & 2 deletions blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Twig Feeds
version: 3.3.3
version: 3.3.4
description: "Parse RSS and Atom feeds with Twig."
icon: feed
author:
Expand All @@ -11,7 +11,7 @@ keywords: avatar, avatars, identicon, identicons
bugs: https://github.com/olevik/grav-plugin-twigfeeds/issues
license: MIT
dependencies:
- { name: grav, version: '>=1.1.17' }
- { name: grav, version: '>=1.5.6' }

form:
validation: loose
Expand Down
6 changes: 5 additions & 1 deletion twigfeeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@ public function outputFeeds()
foreach ($content['data'] as $source => $data) {
$filename = $config['cache_path'] . $data['filename'];
$content = $parser->readFeed($filename);
$feed_items[$content['name']] = $content;
if ($content) {
$feed_items[$content['name']] = $content;
} else {
$debug ? $this->debug('Could not find ' . $filename . ', continuing') : null;
}
}
} else {
foreach ($config['twig_feeds'] as $feed) {
Expand Down

0 comments on commit c1f3d5a

Please sign in to comment.