3 namespace CoreFramework\Filter\News;
6 * A pre-filter for downloading news from a source. This can be a XML feed or
7 * the local database. You *can* register this filter as post filter but for
8 * output on web pages it makes no sense.
10 * @author Roland Haeder <webmaster@shipsimu.org>
12 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
13 * @license GNU GPL 3.0 or any newer version
14 * @link http://www.shipsimu.org
16 * This program is free software: you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation, either version 3 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 class NewsDownloadFilter extends BaseFilter implements Filterable {
31 * Protected constructor
35 protected function __construct () {
36 // Call parent constructor
37 parent::__construct(__CLASS__);
41 * Creates an instance of this filter class
43 * @return $filterInstance An instance of this filter class
45 public static final function createNewsDownloadFilter () {
47 $filterInstance = new NewsDownloadFilter();
49 // Return the instance
50 return $filterInstance;
54 * Executes the filter with given request and response objects
56 * @param $requestInstance An instance of a class with an Requestable interface
57 * @param $responseInstance An instance of a class with an Responseable interface
60 public function execute (Requestable $requestInstance, Responseable $responseInstance) {
61 // Get a news instance
62 $newsInstance = HtmlNewsFactory::createFactoryByRequest($requestInstance);
64 // Store the news instance in registry
65 Registry::getRegistry()->addInstance('news', $newsInstance);