зеркало из https://github.com/nextcloud/news.git
require libxml
This commit is contained in:
Родитель
ade0ecb98b
Коммит
d4f19a20c6
|
@ -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
|
||||
* PHP >= 5.4
|
||||
* php-curl
|
||||
* ownCloud >= 7
|
||||
* PHP >= 5.4
|
||||
* libxml >= 2.7.8
|
||||
* php-curl
|
||||
|
||||
## Supported Browsers
|
||||
* Firefox (Desktop, Android, Firefox OS)
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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'),
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1 +1 @@
|
|||
3.105
|
||||
3.201
|
|
@ -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()));
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>"
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче