"wallabag/tcpdf": "^6.2",
"simplepie/simplepie": "~1.3.1",
"willdurand/hateoas-bundle": "~1.0",
- "htmlawed/htmlawed": "~1.1.19",
"liip/theme-bundle": "~1.1",
"lexik/form-filter-bundle": "~5.0",
"j0k3r/graby": "dev-extractor",
{
// ensure content is a bit cleaned up
if (!empty($content['html'])) {
- $extractor = $this->graby->getExtractor();
- $contentExtracted = $extractor->process($content['html'], $url);
-
- if ($contentExtracted) {
- $contentBlock = $extractor->getContent();
- $contentBlock->normalize();
-
- $content['html'] = trim($contentBlock->innerHTML);
- }
-
- $content['html'] = htmLawed($content['html'], [
- 'safe' => 1,
- // which means: do not remove iframe elements
- 'elements' => '*+iframe',
- 'deny_attribute' => 'style',
- 'comment' => 1,
- 'cdata' => 1,
- ]);
+ $content['html'] = $this->graby->cleanupHtml($content['html'], $url);
}
// do we have to fetch the content or the provided one is ok?
$tagger->expects($this->once())
->method('tag');
- $graby = $this->getMockBuilder('Graby\Graby')->getMock();
-
- $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
- $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [
- 'html' => str_repeat('this is my content', 325),
- 'title' => 'this is my title',
- 'url' => 'http://1.1.1.1',
- 'content_type' => 'text/html',
- 'language' => 'fr',
- ]);
+ $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage);
+ $entry = $proxy->updateEntry(
+ new Entry(new User()),
+ 'http://0.0.0.0',
+ [
+ 'html' => str_repeat('this is my content', 325),
+ 'title' => 'this is my title',
+ 'url' => 'http://1.1.1.1',
+ 'content_type' => 'text/html',
+ 'language' => 'fr',
+ ]
+ );
$this->assertEquals('http://1.1.1.1', $entry->getUrl());
$this->assertEquals('this is my title', $entry->getTitle());
$tagger->expects($this->once())
->method('tag');
- $graby = new Graby();
-
- $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage);
+ $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage);
$entry = $proxy->updateEntry(
new Entry(new User()),
'http://1.1.1.1',