diff options
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Generator/FileContentGenerator.php')
-rw-r--r-- | vendor/fguillot/picofeed/lib/PicoFeed/Generator/FileContentGenerator.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Generator/FileContentGenerator.php b/vendor/fguillot/picofeed/lib/PicoFeed/Generator/FileContentGenerator.php new file mode 100644 index 000000000..03f37e16f --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Generator/FileContentGenerator.php @@ -0,0 +1,36 @@ +<?php + +namespace PicoFeed\Generator; + +use PicoFeed\Base; +use PicoFeed\Parser\Item; + +/** + * File Content Generator + * + * @package PicoFeed\Generator + * @author Frederic Guillot + */ +class FileContentGenerator extends Base implements ContentGeneratorInterface +{ + private $extensions = array('pdf'); + + /** + * Execute Content Generator + * + * @access public + * @param Item $item + * @return boolean + */ + public function execute(Item $item) + { + foreach ($this->extensions as $extension) { + if (substr($item->getUrl(), - strlen($extension)) === $extension) { + $item->setContent('<a href="'.$item->getUrl().'" target="_blank">'.$item->getUrl().'</a>'); + return true; + } + } + + return false; + } +} |