3 * This class simply puts HTML code / JavaScript code or CSS code out to the
6 * @author Roland Haeder <webmaster@shipsimu.org>
8 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2013 Core Developer Team
9 * @license GNU GPL 3.0 or any newer version
10 * @link http://www.shipsimu.org
12 * This program is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 class WebOutput extends BaseFrameworkSystem implements OutputStreamer, Registerable {
27 * The instance for the singleton design pattern
29 private static $webInstance = NULL;
32 * Protected constructor
36 protected function __construct () {
37 // Call parent constructor
38 parent::__construct(__CLASS__);
42 * Create a new web output system and set the content type
44 * @param $applicationInstance An instance of a ManageableApplication class
45 * @return $debugInstance An instance of this middleware class
47 public static final function createWebOutput (ManageableApplication $applicationInstance) {
48 // Is the self-instance already set?
49 if (is_null(self::$webInstance)) {
50 // Get a new instance and set it
51 self::$webInstance = new WebOutput();
53 // Get the content type
54 $contentType = self::$webInstance->getConfigInstance()->getConfigEntry('web_content_type');
56 // Set the content type
57 if (!empty($contentType)) {
59 $applicationInstance->getResponseInstance()->addHeader('Content-type', $contentType);
64 return self::$webInstance;
70 * @param $outStream Stream to output
71 * @param $stripTags Whether HTML tags shall be stripped out
74 public final function output ($outStream = FALSE, $stripTags = FALSE) {
75 print(stripslashes($outStream));