/** * @return Wax_Response */ public static function getInstance() { if (is_null(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
public function dispatch() { $fileName = Wax_Request::getInstance()->getRequestUri(); $fileName = str_replace('/@@/', '', $fileName); $fileName = str_replace('/', '', $fileName); $filePath = $this->_iconPath . $fileName . '.' . $this->_defaultExt; $readFile = file_get_contents($filePath); Wax_Response::getInstance()->setHeader('Content-Type', 'image/' . $this->_defaultExt)->appendBody($readFile)->sendResponse(); }
public function dispatch() { $fileName = Wax_Request::getInstance()->getRequestUri(); $fileName = str_replace('/@JavaScript/', '', $fileName); $fileName = str_replace('/', '', $fileName); $fileName = str_replace('_', '/', $fileName); $filePathModules = $this->_modulesPath . $fileName . '.' . $this->_defaultExt; $filePathLibrary = $this->_libraryPath . $fileName . '.' . $this->_defaultExt; if (file_exists($filePathModules)) { $readFile = file_get_contents($filePathModules); } elseif (file_exists($filePathLibrary)) { $readFile = file_get_contents($filePathLibrary); } else { $readFile = ''; } Wax_Response::getInstance()->setHeader('Content-Type', 'text/javascript')->appendBody($readFile)->sendResponse(); }
public function dispatch() { if ($this->_dispatched) { return; } $this->_dispatched = true; $requestURI = Wax_Request::getInstance()->getRequestUri(); if (strpos($requestURI, '?') !== false) { $requestURI = substr($requestURI, 0, strpos($requestURI, '?')); } $requestURI = explode('/', $requestURI); $parameters = array(); $title = array(); $classInstance = null; $serverName = Wax_Request::getInstance()->getServer('SERVER_NAME'); $serverName = explode('.', $serverName); if ($serverName[0] != 'standard8') { $currentModule = ucfirst($serverName[0]); } else { $currentModule = $this->_moduleDefault; } if (strlen($this->_moduleBase) > 0 && strlen($this->_classBase) > 0) { $classBase = $this->instanceClass(null, array($this->_moduleBase, $this->_classBase)); } if ((strlen($this->_classForce) == 0 || sizeof($this->_classForce) == 0) && is_array($requestURI) && sizeof($requestURI) > 0) { foreach ($requestURI as $key => $value) { if (strlen($value) == 0) { unset($requestURI[$key]); } } for ($i = sizeof($requestURI); $i > 0; $i--) { $continue = true; $filePath = str_replace(' ', '/', ucwords(implode(' ', $requestURI))); $fileName = $this->_binaryPath . '' . $currentModule . '/' . $filePath . '.php'; if (file_exists($fileName)) { if (include_once $fileName) { $className = implode('_', $requestURI); if (class_exists($className)) { if ($classBase) { $classReflection = new ReflectionClass($className); $classConstructor = $classReflection->getConstructor(); $classConstructorParams = $classConstructor->getParameters(); if (sizeof($classConstructorParams) == 0) { $continue = false; } elseif (isset($classConstructorParams[0])) { if ($classConstructorParams[0]->getClass()->name != $this->_classBase) { $continue = false; } } } if ($continue) { $title[] = implode(' :: ', $requestURI); $classParam = array($currentModule, $className); $classInstance = $this->instanceClass($classBase, $classParam, $parameters); if ($classInstance === true) { return true; } elseif ($classInstance === false) { $classInstance = null; } } } } } array_unshift($parameters, array_pop($requestURI)); } } # Wax_Document::$head->setTitle($title, ' :: '); if (strlen($this->_moduleBase) > 0 && strlen($this->_classBase) > 0) { if ($classBase) { if (strlen($this->_moduleForce) > 0 && strlen($this->_classForce) > 0) { $classForce = $this->instanceClass($classBase, array($this->_moduleForce, $this->_classForce)); if ($classForce) { if (method_exists($classBase, 'appendContent')) { $classBase->appendContent($classForce); } else { $classBase->appendChild($classForce); } } } elseif (isset($classInstance) && !is_null($classInstance)) { if (method_exists($classBase, 'appendContent')) { $classBase->appendContent($classInstance); } else { $classBase->appendChild($classInstance); } } elseif (strlen($this->_moduleDefault) > 0 && strlen($this->_classDefault) > 0) { $classDefault = $this->instanceClass($classBase, array($this->_moduleDefault, $this->_classDefault)); if ($classDefault) { if (method_exists($classBase, 'appendContent')) { $classBase->appendContent($classDefault); } else { $classBase->appendChild($classDefault); } } } Wax_Document::$body->appendChild($classBase); } } elseif (isset($classInstance) && !is_null($classInstance)) { Wax_Document::$body->appendChild($classInstance); } Wax_Response::getInstance()->appendBody(Wax_Document::__toString())->sendResponse(); return true; }
public function __construct(Standard8 $Standard8) { Standard8_Session::destroy(); Wax_Response::getInstance()->setRedirect('/'); }