]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/response/html/class_HtmlResponse.php
Continued:
[core.git] / framework / main / classes / response / html / class_HtmlResponse.php
index 05d5e2bee7e763c01dcd790f69ad47f57d0a497a..07036f7104810e766afdf83770d3d044dd59b7af 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 // Own namespace
-namespace CoreFramework\Response;
+namespace Org\Mxchange\CoreFramework\Response;
 
 // Import framework stuff
-use CoreFramework\Manager\ManageableApplication;
-use CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Registry\Registry;
+use Org\Mxchange\CoreFramework\Response\Responseable;
 
 /**
  * A class for an HTML response on an HTML request
@@ -42,28 +42,18 @@ class HtmlResponse extends BaseResponse implements Responseable {
                parent::__construct(__CLASS__);
 
                // Set response type
-               $this->setResponseType('html');
+               $this->setResponseType('http');
        }
 
        /**
         * Creates an object of this class
         *
-        * @param       $applicationInstance    An instance of a manageable application
-        * @return      $responseInstance               A prepared instance of this class
+        * @return      $responseInstance       A prepared instance of this class
         */
-       public static final function createHtmlResponse (ManageableApplication $applicationInstance) {
+       public static final function createHtmlResponse () {
                // Get a new instance
                $responseInstance = new HtmlResponse();
 
-               // Set the application instance
-               $responseInstance->setApplicationInstance($applicationInstance);
-
-               // Initialize the template engine here
-               $responseInstance->initTemplateEngine($applicationInstance);
-
-               // Init web output instance
-               $responseInstance->initWebOutputInstance();
-
                // Return the prepared instance
                return $responseInstance;
        }
@@ -92,7 +82,7 @@ class HtmlResponse extends BaseResponse implements Responseable {
         * @todo        If the return statement is removed and setcookie() commented out,
         * @todo        this will send only one cookie out, the first one.
         */
-       public function addCookie ($cookieName, $cookieValue, $encrypted = FALSE, $expires = NULL) {
+       public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = NULL) {
                //* DEBUG: */ echo $cookieName.'='.$cookieValue."<br />\n";
                // Are headers already sent?
                if (headers_sent()) {
@@ -102,7 +92,7 @@ class HtmlResponse extends BaseResponse implements Responseable {
                } // END - if
 
                // Shall we encrypt the cookie?
-               if ($encrypted === TRUE) {
+               if ($encrypted === true) {
                        // Unsupported at the moment
                        $this->partialStub('Encryption is unsupported at the moment.');
                } // END - if
@@ -140,6 +130,9 @@ class HtmlResponse extends BaseResponse implements Responseable {
         * @throws      ResponseHeadersAlreadySentException             If headers are already sent
         */
        public function redirectToConfiguredUrl ($configEntry) {
+               // Get application instance
+               $applicationInstance = Registry::getRegistry()->getInstance('app');
+
                // Is the header not yet sent?
                if (headers_sent()) {
                        // Throw an exception here
@@ -147,7 +140,7 @@ class HtmlResponse extends BaseResponse implements Responseable {
                } // END - if
 
                // Assign application data
-               $this->getTemplateInstance()->assignApplicationData($this->getApplicationInstance());
+               $this->getTemplateInstance()->assignApplicationData($applicationInstance());
 
                // Get the url from config
                $url = $this->getConfigInstance()->getConfigEntry($configEntry . '_url');
@@ -192,7 +185,7 @@ class HtmlResponse extends BaseResponse implements Responseable {
                // Is the cookie there?
                if (isset($_COOKIE[$cookieName])) {
                        // Then expire it with 20 minutes past
-                       $this->addCookie($cookieName, '', FALSE, (time() - 1200));
+                       $this->addCookie($cookieName, '', false, (time() - 1200));
 
                        // Remove it from array
                        unset($_COOKIE[$cookieName]);
@@ -209,7 +202,7 @@ class HtmlResponse extends BaseResponse implements Responseable {
                // Only update existing cookies
                if (isset($_COOKIE[$cookieName])) {
                        // Update the cookie
-                       $this->addCookie($cookieName, $_COOKIE[$cookieName], FALSE);
+                       $this->addCookie($cookieName, $_COOKIE[$cookieName], false);
                } // END - if
        }