diff options
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | appinfo/app.json | 5 | ||||
-rw-r--r-- | appinfo/application.php | 2 | ||||
-rw-r--r-- | appinfo/info.xml | 2 | ||||
-rw-r--r-- | appinfo/version | 2 | ||||
-rw-r--r-- | articleenhancer/globalarticleenhancer.php | 13 | ||||
-rw-r--r-- | css/content.css | 4 | ||||
-rw-r--r-- | js/bower.json | 2 | ||||
-rw-r--r-- | js/package.json | 2 | ||||
-rw-r--r-- | service/feedservice.php | 8 | ||||
-rw-r--r-- | tests/unit/articleenhancer/GlobalArticleEnhancerTest.php | 26 |
12 files changed, 51 insertions, 23 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0211ce7bc..1f2ae6f1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ -owncloud-news (3.106) +owncloud-news (3.201) +* **New dependency**: Minimum libxml version: 2.7.8 * **Bugfix**: Move open website icon in compact view to the left of the title * **Bugfix**: SimplePie: Do not break if url encoded links contain non ASCII chars +* **Bugfix**: Favicon should stay in place if you expand an article in compact view +* **Bugfix**: Go back to debug level logging for feed updates owncloud-news (3.105) * **Bugfix**: Various wording fixes @@ -18,9 +18,10 @@ For further developer and user documentation please visit [the wiki](https://git * [Desktop](https://github.com/owncloud/news/wiki/desktop-clients) ## Dependencies +* ownCloud >= 7 * PHP >= 5.4 +* libxml >= 2.7.8 * php-curl -* ownCloud >= 7 ## Supported Browsers * Firefox (Desktop, Android, Firefox OS) diff --git a/appinfo/app.json b/appinfo/app.json index 64082176b..d5419b67a 100644 --- a/appinfo/app.json +++ b/appinfo/app.json @@ -3,7 +3,7 @@ "id": "news", "description": "ownCloud News App", "licence": "AGPL", - "version": "3.105", + "version": "3.201", "authors": [ { "name": "Bernhard Posselt", @@ -38,7 +38,8 @@ "php": ">=5.4", "owncloud": ">=7", "libs": { - "curl": "*" + "curl": "*", + "libxml": ">=2.7.8" } } }
\ No newline at end of file diff --git a/appinfo/application.php b/appinfo/application.php index 09583fa1f..eaeafc858 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -257,6 +257,8 @@ class Application extends App { $extensions[$extension] = phpversion($extension); } + $extensions['libxml'] = LIBXML_DOTTED_VERSION; + $config = new AppConfig( $c->query('ServerContainer')->getNavigationManager(), $c->query('L10N'), diff --git a/appinfo/info.xml b/appinfo/info.xml index 127dab4ad..afd3868ea 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,6 +5,6 @@ <description>An RSS/Atom feed reader. Requires ownCloud backgroundjobs or an updater script to be enabled to update your feeds. See the README.rst in the apps top directory</description> <licence>AGPL</licence> <author>Bernhard Posselt, Alessandro Cosentino, Jan-Christoph Borchardt</author> - <version>3.105</version> + <version>3.201</version> <require>7</require> </info> diff --git a/appinfo/version b/appinfo/version index b6aa36c63..c336a92a9 100644 --- a/appinfo/version +++ b/appinfo/version @@ -1 +1 @@ -3.105
\ No newline at end of file +3.201
\ No newline at end of file diff --git a/articleenhancer/globalarticleenhancer.php b/articleenhancer/globalarticleenhancer.php index 1b6713ef7..7411d0adc 100644 --- a/articleenhancer/globalarticleenhancer.php +++ b/articleenhancer/globalarticleenhancer.php @@ -24,7 +24,12 @@ class GlobalArticleEnhancer implements ArticleEnhancer { */ public function enhance(Item $item) { $dom = new \DOMDocument(); - @$dom->loadHTML($item->getBody()); + + // wrap it inside a div if there is none to prevent invalid wrapping + // inside <p> tags + $body = '<div>' . $item->getBody() . '</div>'; + + @$dom->loadHTML($body, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new \DOMXpath($dom); // remove youtube autoplay @@ -45,12 +50,6 @@ class GlobalArticleEnhancer implements ArticleEnhancer { } } - // remove <!DOCTYPE - $dom->removeChild($dom->firstChild); - - // remove <html><body></body></html> - $dom->replaceChild($dom->firstChild->firstChild->firstChild, $dom->firstChild); - // save all changes back to the item $item->setBody(trim($dom->saveHTML())); diff --git a/css/content.css b/css/content.css index 927f9d266..f64f735fd 100644 --- a/css/content.css +++ b/css/content.css @@ -386,8 +386,8 @@ white-space:normal; } - #app-content .body > img:first-child, - #app-content .body > div:first-child > img:first-child { + #app-content .body > div > img:first-child, + #app-content .body > div :first-child > img:first-child { padding: 0 14px 0 0; float: left; } diff --git a/js/bower.json b/js/bower.json index fdc95532e..61ebe42d7 100644 --- a/js/bower.json +++ b/js/bower.json @@ -1,6 +1,6 @@ { "name": "ownCloud-news", - "version": "3.1.5", + "version": "3.2.1", "homepage": "https://github.com/owncloud/news", "authors": [ "Bernhard Posselt <dev@bernhard-posselt.com>" diff --git a/js/package.json b/js/package.json index 50269d4fb..adc9b59e0 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "ownCloud-news", - "version": "3.1.5", + "version": "3.2.1", "description": "An RSS/Atom feed reader", "main": "build/app.js", "scripts": { diff --git a/service/feedservice.php b/service/feedservice.php index becf204f7..cb8d4f7cc 100644 --- a/service/feedservice.php +++ b/service/feedservice.php @@ -143,7 +143,7 @@ class FeedService extends Service { return $feed; } catch(FetcherException $ex){ - $this->logger->error($ex->getMessage(), $this->loggerParams); + $this->logger->debug($ex->getMessage(), $this->loggerParams); throw new ServiceNotFoundException( $this->l10n->t( 'Can not add feed: URL does not exist, SSL Certificate can not be validated ' . @@ -162,7 +162,7 @@ class FeedService extends Service { try { $this->update($feed->getId(), $feed->getUserId()); } catch(\Exception $ex){ - $this->logger->error('Could not update feed ' . $ex->getMessage(), + $this->logger->debug('Could not update feed ' . $ex->getMessage(), $this->loggerParams); } } @@ -213,9 +213,9 @@ class FeedService extends Service { } catch(FetcherException $ex){ // failed updating is not really a problem, so only log it - $this->logger->error('Can not update feed with url ' . $existingFeed->getUrl() . + $this->logger->debug('Can not update feed with url ' . $existingFeed->getUrl() . ': Not found or bad source', $this->loggerParams); - $this->logger->error($ex->getMessage(), $this->loggerParams); + $this->logger->debug($ex->getMessage(), $this->loggerParams); } return $this->feedMapper->find($feedId, $userId); diff --git a/tests/unit/articleenhancer/GlobalArticleEnhancerTest.php b/tests/unit/articleenhancer/GlobalArticleEnhancerTest.php index 93f9273ed..84c55ad9d 100644 --- a/tests/unit/articleenhancer/GlobalArticleEnhancerTest.php +++ b/tests/unit/articleenhancer/GlobalArticleEnhancerTest.php @@ -27,7 +27,7 @@ class GlobalArticleEnhancerTest extends \PHPUnit_Framework_TestCase { public function testNoReplaceYoutubeAutoplay() { $body = '<iframe width="728" height="410" src="//www.youtube.com/embed/autoplay=1/AWE6UpXQoGU" frameborder="0" allowfullscreen=""></iframe>'; - $expected = '<iframe width="728" height="410" src="//www.youtube.com/embed/autoplay=1/AWE6UpXQoGU" frameborder="0" allowfullscreen=""></iframe>'; + $expected = '<div><iframe width="728" height="410" src="//www.youtube.com/embed/autoplay=1/AWE6UpXQoGU" frameborder="0" allowfullscreen=""></iframe></div>'; $item = new Item(); $item->setBody($body); @@ -38,7 +38,29 @@ class GlobalArticleEnhancerTest extends \PHPUnit_Framework_TestCase { public function testReplaceYoutubeAutoplay() { $body = 'test <iframe width="728" height="410" src="//www.youtube.com/embed/AWE6UpXQoGU?tst=1&autoplay=1&abc=1" frameborder="0" allowfullscreen=""></iframe>'; - $expected = '<p>test <iframe width="728" height="410" src="//www.youtube.com/embed/AWE6UpXQoGU?tst=1&autoplay=0&abc=1" frameborder="0" allowfullscreen=""></iframe></p>'; + $expected = '<div>test <iframe width="728" height="410" src="//www.youtube.com/embed/AWE6UpXQoGU?tst=1&autoplay=0&abc=1" frameborder="0" allowfullscreen=""></iframe></div>'; + $item = new Item(); + $item->setBody($body); + + $result = $this->enhancer->enhance($item); + $this->assertEquals($expected, $result->getBody()); + } + + + public function testMultipleParagraphs() { + $body = '<p>paragraph 1</p><p>paragraph 2</p>'; + $expected = '<div>' . $body . '</div>'; + $item = new Item(); + $item->setBody($body); + + $result = $this->enhancer->enhance($item); + $this->assertEquals($expected, $result->getBody()); + } + + + public function testMultipleParagraphsInDiv() { + $body = '<p>paragraph 1</p><p>paragraph 2</p>'; + $expected = '<div>' . $body . '</div>'; $item = new Item(); $item->setBody($body); |