summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <Raydiation@users.noreply.github.com>2013-09-14 14:50:29 -0700
committerBernhard Posselt <Raydiation@users.noreply.github.com>2013-09-14 14:50:29 -0700
commitf0b45e5c15415886ba739d27360f93b061366e87 (patch)
treedaf8b8b1febc1f208cc6b832780c2370872f509a
parent96a3156a09195f11e83007077b46f147ceb88fda (diff)
parent16e51f90c60e77cb4696523e6cab132f39b37074 (diff)
Merge pull request #349 from David-Development/master
Add ThemeRepublic Enhancer
-rw-r--r--CHANGELOG1
-rw-r--r--dependencyinjection/dicontainer.php10
-rw-r--r--tests/unit/utility/articleenhancer/ArticleEnhancerTest.php3
-rw-r--r--utility/articleenhancer/themerepublicenhancer.php21
4 files changed, 34 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index e441ea558..bf3cd8a6e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
owncloud-news (1.602)
* Remove removed class from container
* Go back to allow feeds per url from input
+* Added ThemeRepublic.net Enhancer
owncloud-news (1.601)
* Remove Google Reader import
diff --git a/dependencyinjection/dicontainer.php b/dependencyinjection/dicontainer.php
index 71866b502..ecdf0b3df 100644
--- a/dependencyinjection/dicontainer.php
+++ b/dependencyinjection/dicontainer.php
@@ -62,6 +62,7 @@ use \OCA\News\Utility\SimplePieFileFactory;
use \OCA\News\Utility\ArticleEnhancer\Enhancer;
use \OCA\News\Utility\ArticleEnhancer\CyanideAndHappinessEnhancer;
+use \OCA\News\Utility\ArticleEnhancer\ThemeRepublicEnhancer;
use \OCA\News\Middleware\CORSMiddleware;
@@ -259,6 +260,7 @@ class DIContainer extends BaseContainer {
// register fetchers in order
// the most generic enhancer should be the last one
$enhancer->registerEnhancer('explosm.net', $c['CyanideAndHappinessEnhancer']);
+ $enhancer->registerEnhancer('themerepublic.net', $c['ThemeRepublicEnhancer']);
return $enhancer;
});
@@ -275,6 +277,14 @@ class DIContainer extends BaseContainer {
);
});
+ $this['ThemeRepublicEnhancer'] = $this->share(function($c){
+ return new ThemeRepublicEnhancer(
+ $c['SimplePieFileFactory'],
+ $c['HTMLPurifier'],
+ $c['feedFetcherTimeout']
+ );
+ });
+
$this['Fetcher'] = $this->share(function($c){
$fetcher = new Fetcher();
diff --git a/tests/unit/utility/articleenhancer/ArticleEnhancerTest.php b/tests/unit/utility/articleenhancer/ArticleEnhancerTest.php
index bb3c9e53d..a7585d771 100644
--- a/tests/unit/utility/articleenhancer/ArticleEnhancerTest.php
+++ b/tests/unit/utility/articleenhancer/ArticleEnhancerTest.php
@@ -58,7 +58,8 @@ class ArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
$this->fileFactory,
array(
'/explosm.net\/comics/' => '//*[@id=\'maincontent\']/div[2]/div/img',
- '/explosm.net\/shorts/' => '//*[@id=\'maincontent\']/div/div'
+ '/explosm.net\/shorts/' => '//*[@id=\'maincontent\']/div/div',
+ '/themerepublic.net/' => '//*[@class=\'post hentry\']'
),
$this->timeout
);
diff --git a/utility/articleenhancer/themerepublicenhancer.php b/utility/articleenhancer/themerepublicenhancer.php
new file mode 100644
index 000000000..c13ff6027
--- /dev/null
+++ b/utility/articleenhancer/themerepublicenhancer.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace OCA\News\Utility\ArticleEnhancer;
+
+use \OCA\News\Utility\SimplePieFileFactory;
+
+class ThemeRepublicEnhancer extends ArticleEnhancer {
+
+ public function __construct(SimplePieFileFactory $fileFactory, $purifier,
+ $timeout){
+ parent::__construct(
+ $purifier,
+ $fileFactory,
+ array(
+ '/feedproxy.google.com\/~r\/blogspot\/DngUJ/' => "//*[@class='post hentry']"
+ ),
+ $timeout
+ );
+ }
+}
+?> \ No newline at end of file