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:  * RemoveStylesProcessor
16:  */
17: class RemoveStylesProcessor implements ProcessorInterface
18: {
19:     /**
20:      * Execute processor
21:      *
22:      * @param array $items
23:      *
24:      * @return array
25:      */
26:     public function process(array $items)
27:     {
28:         foreach ($items as $key => $item) {
29:             $items[$key] = $this->removeStyle($item);
30:         }
31: 
32:         return $items;
33:     }
34: 
35:     /**
36:      * @param Item $item
37:      *
38:      * @return Item
39:      */
40:     public function removeStyle(Item $item)
41:     {
42:         $item->setIntro(preg_replace('/(<[^>]+) style=".*?"/i', '$1', $item->getIntro()));
43:         $item->setContent(preg_replace('/(<[^>]+) style=".*?"/i', '$1', $item->getContent()));
44: 
45:         return $item;
46:     }
47: }
48: 
API documentation generated by ApiGen 2.8.0