diff options
author | Bernhard Posselt <Raydiation@users.noreply.github.com> | 2015-08-12 17:06:08 +0200 |
---|---|---|
committer | Bernhard Posselt <Raydiation@users.noreply.github.com> | 2015-08-12 17:06:08 +0200 |
commit | e1af6113c7c916ab776f9b2f6de8dfe8cb6b5469 (patch) | |
tree | fa75e06a965fb5751017288a5c135bc179574210 /articleenhancer/regexarticleenhancer.php | |
parent | c77a6705d34c81cb933f3d4b83eb18e2b586035a (diff) | |
parent | 53679811da855acf9bd944a389a48399ca5d5a15 (diff) |
Merge pull request #835 from owncloud/full-text
Fix #725
Diffstat (limited to 'articleenhancer/regexarticleenhancer.php')
-rw-r--r-- | articleenhancer/regexarticleenhancer.php | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/articleenhancer/regexarticleenhancer.php b/articleenhancer/regexarticleenhancer.php deleted file mode 100644 index 0f600468e..000000000 --- a/articleenhancer/regexarticleenhancer.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * ownCloud - News - * - * This file is licensed under the Affero General Public License version 3 or - * later. See the COPYING file. - * - * @author Alessandro Cosentino <cosenal@gmail.com> - * @author Bernhard Posselt <dev@bernhard-posselt.com> - * @copyright Alessandro Cosentino 2012 - * @copyright Bernhard Posselt 2012, 2014 - */ - -namespace OCA\News\ArticleEnhancer; - -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; - } - - -} |