Introduced initWebOutputInstance() which will initialize a web output instance.
authorRoland Haeder <roland@mxchange.org>
Sun, 22 Mar 2015 21:54:18 +0000 (22:54 +0100)
committerRoland Haeder <roland@mxchange.org>
Sun, 22 Mar 2015 21:54:18 +0000 (22:54 +0100)
Signed-off-by: Roland Häder <roland@mxchange.org>
db/.htaccess [new file with mode: 0644]
db/news/.htaccess [new file with mode: 0644]
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/output/class_ConsoleOutput.php
inc/classes/main/output/class_WebOutput.php
inc/classes/main/response/console/class_ConsoleResponse.php
inc/classes/main/response/http/class_HttpResponse.php

diff --git a/db/.htaccess b/db/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/db/news/.htaccess b/db/news/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
index c5226fed87530797370d1acee063116bb7bba829..c3bb447f2bf4f1128259572e845f114645c5a5cf 100644 (file)
@@ -2949,6 +2949,28 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $isValid;
        }
 
+       /**
+        * Initializes the web output instance
+        *
+        * @return      void
+        */
+       protected function initWebOutputInstance () {
+               // Get application instance
+               $applicationInstance = Registry::getRegistry()->getInstance('app');
+
+               // Is this a response instance?
+               if ($this instanceof Responseable) {
+                       // Then set it in application instance
+                       $applicationInstance->setResponseInstance($this);
+               } // END - if
+
+               // Init web output instance
+               $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class', array($applicationInstance));
+
+               // Set it locally
+               $this->setWebOutputInstance($outputInstance);
+       }
+
        /**
         * Translates boolean TRUE to 'Y' and FALSE to 'N'
         *
index 7d70a8c4caa56bd9c9f7d66047890fcaa932677d..c2ff3d4f4c521c3e3c660a488edd83b89aefd425 100644 (file)
@@ -55,7 +55,7 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
                // Set the content type
                // @TODO Need to rewrite this to $requestInstance->addHeader()
                if (!empty($contentType)) {
-                       @header(sprintf("Content-type: %s",
+                       @header(sprintf('Content-type: %s',
                                $contentType
                        ));
                } // END - if
@@ -90,6 +90,39 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
        public final function output ($outStream = FALSE, $stripTags = FALSE) {
                print trim($outStream) . PHP_EOL;
        }
+
+       /**
+        * Determines seek position
+        *
+        * @return      $seekPosition   Current seek position
+        * @throws      UnsupportedOperationException   If this method is called
+        */
+       public function determineSeekPosition () {
+               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
+       }
+
+       /**
+        * Seek to given offset (default) or other possibilities as fseek() gives.
+        *
+        * @param       $offset         Offset to seek to (or used as "base" for other seeks)
+        * @param       $whence         Added to offset (default: only use offset to seek to)
+        * @return      $status         Status of file seek: 0 = success, -1 = failed
+        * @throws      UnsupportedOperationException   If this method is called
+        */
+       public function seek ($offset, $whence = SEEK_SET) {
+               self::createDebugInstance(__CLASS__)->debugOutput('offset=' . $offset . ',whence=' . $whence);
+               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
+       }
+
+       /**
+        * Size of file stack
+        *
+        * @return      $size   Size (in bytes) of file
+        * @throws      UnsupportedOperationException   If this method is called
+        */
+       public function size () {
+               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
+       }
 }
 
 // [EOF]
index e875aa8e223453ad37015131e9f1befddacade2e..c000ebcc4df0789d83b2096084439a5a80509d64 100644 (file)
@@ -74,6 +74,39 @@ class WebOutput extends BaseFrameworkSystem implements OutputStreamer, Registera
        public final function output ($outStream = FALSE, $stripTags = FALSE) {
                print(stripslashes($outStream));
        }
+
+       /**
+        * Determines seek position
+        *
+        * @return      $seekPosition   Current seek position
+        * @throws      UnsupportedOperationException   If this method is called
+        */
+       public function determineSeekPosition () {
+               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
+       }
+
+       /**
+        * Seek to given offset (default) or other possibilities as fseek() gives.
+        *
+        * @param       $offset         Offset to seek to (or used as "base" for other seeks)
+        * @param       $whence         Added to offset (default: only use offset to seek to)
+        * @return      $status         Status of file seek: 0 = success, -1 = failed
+        * @throws      UnsupportedOperationException   If this method is called
+        */
+       public function seek ($offset, $whence = SEEK_SET) {
+               self::createDebugInstance(__CLASS__)->debugOutput('offset=' . $offset . ',whence=' . $whence);
+               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
+       }
+
+       /**
+        * Size of file stack
+        *
+        * @return      $size   Size (in bytes) of file
+        * @throws      UnsupportedOperationException   If this method is called
+        */
+       public function size () {
+               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
+       }
 }
 
 // [EOF]
index 7309a2c873449690414870ed8f0c35bded56b9f7..194c0b32d668ed97adbc84c91ad5fba365f294c3 100644 (file)
@@ -51,6 +51,9 @@ class ConsoleResponse extends BaseResponse implements Responseable {
                // Initialize the template engine here
                $responseInstance->initTemplateEngine($applicationInstance);
 
+               // Init web output instance
+               $responseInstance->initWebOutputInstance();
+
                // Return the prepared instance
                return $responseInstance;
        }
index 7dc2e468bf5f78d62a906ba838aef2d70ecaf0ab..d26b33bc21791af0216c7680db30931c5f2aa0c6 100644 (file)
@@ -51,6 +51,9 @@ class HttpResponse extends BaseResponse implements Responseable {
                // Initialize the template engine here
                $responseInstance->initTemplateEngine($applicationInstance);
 
+               // Init web output instance
+               $responseInstance->initWebOutputInstance();
+
                // Return the prepared instance
                return $responseInstance;
        }