Overview

Namespaces

  • FastFeed
    • Aggregator
    • Cache
    • Exception
    • Logger
    • Parser
    • Processor
  • PHP

Classes

  • ImageProcessor
  • ImagesProcessor
  • LimitProcessor
  • PathProcessor
  • RemoveStylesProcessor
  • SanitizerProcessor
  • SortByDateProcessor
  • StripTagsProcessor

Interfaces

  • ProcessorInterface
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * This file is part of the planetubuntu package.
 4:  *
 5:  * (c) Daniel González <daniel@desarrolla2.com>
 6:  *
 7:  * For the full copyright and license information, please view the LICENSE
 8:  * file that was distributed with this source code.
 9:  */
10: namespace FastFeed\Processor;
11: 
12: use FastFeed\Item;
13: 
14: /**
15:  * StripTagsProcessor
16:  */
17: class StripTagsProcessor implements ProcessorInterface
18: {
19:     /**
20:      * @var
21:      */
22:     protected $allowedTags = array('content', 'intro');
23: 
24:     /**
25:      * @param mixed $allowedTags
26:      */
27:     public function setAllowedTagsForContent($allowedTags)
28:     {
29:         $this->allowedTags['content'] = $allowedTags;
30:     }
31: 
32:     /**
33:      * @param mixed $allowedTags
34:      */
35:     public function setAllowedTagsForIntro($allowedTags)
36:     {
37:         $this->allowedTags['intro'] = $allowedTags;
38:     }
39: 
40:     /**
41:      * Execute processor
42:      *
43:      * @param array $items
44:      *
45:      * @return array $items
46:      */
47:     public function process(array $items)
48:     {
49:         foreach ($items as $key => $item) {
50:             $items[$key] = $this->doClean($item);
51:         }
52: 
53:         return $items;
54:     }
55: 
56:     /**
57:      * @param Item $item
58:      *
59:      * @return Item
60:      */
61:     protected function doClean(Item $item)
62:     {
63:         $item->setIntro(strip_tags($item->getIntro(), $this->allowedTags['intro']));
64:         $item->setContent(strip_tags($item->getContent(), $this->allowedTags['content']));
65: 
66:         return $item;
67:     }
68: }
69: 
API documentation generated by ApiGen 2.8.0