diff options
Diffstat (limited to 'articleenhancer/regexarticleenhancer.php')
-rw-r--r-- | articleenhancer/regexarticleenhancer.php | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/articleenhancer/regexarticleenhancer.php b/articleenhancer/regexarticleenhancer.php index 543eca09b..0f600468e 100644 --- a/articleenhancer/regexarticleenhancer.php +++ b/articleenhancer/regexarticleenhancer.php @@ -18,29 +18,29 @@ use \OCA\News\Db\Item; class RegexArticleEnhancer implements ArticleEnhancer { - private $matchArticleUrl; - private $regexPair; - - public function __construct($matchArticleUrl, array $regexPair) { - $this->matchArticleUrl = $matchArticleUrl; - $this->regexPair = $regexPair; - } - - - /** - * @param \OCA\News\Db\Item $item - * @return \OCA\News\Db\Item enhanced item - */ - public function enhance(Item $item) { - if (preg_match($this->matchArticleUrl, $item->getUrl())) { - $body = $item->getBody(); - foreach($this->regexPair as $search => $replaceWith) { - $body = preg_replace($search, $replaceWith, $body); - } - $item->setBody($body); - } - return $item; - } + private $matchArticleUrl; + private $regexPair; + + public function __construct($matchArticleUrl, array $regexPair) { + $this->matchArticleUrl = $matchArticleUrl; + $this->regexPair = $regexPair; + } + + + /** + * @param \OCA\News\Db\Item $item + * @return \OCA\News\Db\Item enhanced item + */ + public function enhance(Item $item) { + if (preg_match($this->matchArticleUrl, $item->getUrl())) { + $body = $item->getBody(); + foreach($this->regexPair as $search => $replaceWith) { + $body = preg_replace($search, $replaceWith, $body); + } + $item->setBody($body); + } + return $item; + } } |