X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FHelper%2FContentProxy.php;h=dc6e1184cd34e08fc10797f20668879ed94e63f8;hb=1dc4e5da2e281ee8acc69ff025c42369cf778387;hp=3de8828f98e1e5740a155d60532d45c875010836;hpb=57162494557c5eac938a7d6800ac1b112f73efc9;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 3de8828f..dc6e1184 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Helper; use Graby\Graby; use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\CoreBundle\Tools\Utils; /** * This kind of proxy class take care of getting the content from an url @@ -12,10 +13,12 @@ use Wallabag\CoreBundle\Entity\Entry; class ContentProxy { protected $graby; + protected $tagger; - public function __construct(Graby $graby) + public function __construct(Graby $graby, RuleBasedTagger $tagger) { - $this->graby = $graby; + $this->graby = $graby; + $this->tagger = $tagger; } /** @@ -51,11 +54,15 @@ class ContentProxy $entry->setContent($html); $entry->setLanguage($content['language']); $entry->setMimetype($content['content_type']); + $entry->setReadingTime(Utils::getReadingTime($html)); + $entry->setDomainName(parse_url($entry->getUrl(), PHP_URL_HOST)); if (isset($content['open_graph']['og_image'])) { $entry->setPreviewPicture($content['open_graph']['og_image']); } + $this->tagger->tag($entry); + return $entry; } }