/** * Handles the request. * Create installation timestamp if empty (at first software launch) * * @return string */ public function handleRequest() { if (empty(\XLite\Core\Config::getInstance()->Version->timestamp)) { \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('category' => 'Version', 'name' => 'timestamp', 'value' => time())); } parent::handleRequest(); }
/** * Return Viewer object * * @return \XLite\View\Controller */ public function getViewer() { $viewer = parent::getViewer(); if ($this->isAJAXViewer() && \XLite\Core\Request::getInstance()->widgetConfId && \XLite\Module\CDev\DrupalConnector\Handler::isCMSStarted()) { $data = \XLite\Module\CDev\DrupalConnector\Drupal\Model::getInstance()->getBlock(\XLite\Core\Request::getInstance()->widgetConfId); if ($data && isset($data['options']) && is_array($data['options'])) { $viewer->setWidgetParams($data['options']); } } return $viewer; }
/** * Get controller * * @return \XLite\Controller\AController */ public static function getController() { if (!isset(static::$controller)) { $class = static::getControllerClass(); if (!\XLite\Core\Operator::isClassExists($class)) { \XLite\Core\Request::getInstance()->target = static::TARGET_DEFAULT; \XLite\Logger::getInstance()->log('Controller class ' . $class . ' not found!', LOG_ERR); \XLite\Core\Request::getInstance()->target = static::TARGET_404; $class = static::getControllerClass(); } static::$controller = new $class(\XLite\Core\Request::getInstance()->getData()); static::$controller->init(); } return static::$controller; }
/** * Handles the request. * Parses the request variables if necessary. Attempts to call the specified action function * * @return void */ public function handleRequest() { if ($this->checkAccess() && \XLite\Core\Request::getInstance()->help) { $this->printContent($this->getHelp()); } else { set_time_limit(0); $this->actionTime = microtime(true); \XLite\Core\Session::getInstance(); parent::handleRequest(); if (!$this->pureOutput) { $duration = microtime(true) - $this->actionTime; $micro = $duration - floor($duration); $this->printContent(PHP_EOL . 'Execution time: ' . gmdate('H:i:s', floor($duration)) . '.' . sprintf('%04d', $micro * 10000) . ' sec.' . PHP_EOL); } } }
/** * Process request * * @return void */ public function processRequest() { parent::processRequest(); if (!$this->suppressOutput && !$this->isAJAX()) { $viewer = $this->getViewer(); /* $treeKey = 'theme_tweaker_tree_' . md5(LC_START_TIME); \XLite\Core\Session::getInstance()->{$treeKey} = $viewer::getJsonTree(); $output = sprintf( '<div id="templates_tree_wrapper" style="display: none;" data-tree-key="%s">' . '<div id="templates_tree"></div>' . '</div>', $treeKey ); echo $output; */ echo $viewer::getHtmlTree(); } }
/** * Get controller * * @return \XLite\Controller\AController */ public static function getController() { if (!isset(static::$controller)) { $class = static::getControllerClass(); if (!$class) { \XLite\Core\Request::getInstance()->target = static::TARGET_DEFAULT; \XLite\Logger::logCustom('access', 'Controller class ' . $class . ' not found!'); \XLite\Core\Request::getInstance()->target = static::TARGET_404; $class = static::getControllerClass(); } static::$controller = new $class(\XLite\Core\Request::getInstance()->getData()); static::$controller->init(); } return static::$controller; }
/** * Preprocessor for no-action run * * @return void */ protected function doNoAction() { parent::doNoAction(); if (LC_USE_CLEAN_URLS && !$this->isAJAX() && !$this->isRedirectNeeded() && $this->isRedirectToCleanURLNeeded()) { $this->performRedirectToCleanURL(); } }
/** * Return Viewer object * * @return \XLite\View\Controller */ public function getViewer($isExported = false) { return parent::getViewer(true); }
/** * Preprocessor for no-action run * * @return void */ protected function doNoAction() { parent::doNoAction(); if (LC_USE_CLEAN_URLS && !$this->isAJAX() && !$this->isRedirectNeeded() && $this->isRedirectToCleanURLNeeded()) { $this->performRedirectToCleanURL(); } if (!$this->isAJAX() && !$this->isRedirectNeeded()) { \XLite\Core\Session::getInstance()->continueShoppingURL = $this->getAllParams(); } }
/** * Get controller * * @return \XLite\Controller\AController */ public static function getController() { if (null === static::$controller) { $class = static::getControllerClass(); if (!$class) { \XLite\Core\Request::getInstance()->target = static::TARGET_DEFAULT; \XLite\Logger::logCustom('access', 'Controller class ' . $class . ' not found!'); \XLite\Core\Request::getInstance()->target = static::TARGET_404; $class = static::getControllerClass(); } if (!\XLite\Core\Request::getInstance()->isCLI() && \XLite::getInstance()->getRequestedScript() !== \XLite::getInstance()->getExpectedScript() && \XLite::getInstance()->getRequestedScript() !== \XLite::getInstance()->getExpectedScript(true)) { \XLite\Core\Request::getInstance()->target = static::TARGET_404; $class = static::getControllerClass(); } static::$controller = new $class(\XLite\Core\Request::getInstance()->getData()); static::$controller->init(); } return static::$controller; }
/** * Check - need use secure protocol or not * * @return boolean */ public function needSecure() { return parent::needSecure() || !$this->isHTTPS() && \XLite\Core\Config::getInstance()->Security->admin_security; }
/** * Handles the request. * Parses the request variables if necessary. Attempts to call the specified action function * * @return void */ public function handleRequest() { RegistrationScheduler::getInstance()->registerIfScheduled(); parent::handleRequest(); }
/** * Check - need use secure protocol or not * * @return boolean */ protected function needSecure() { return parent::needSecure() || !\XLite\Core\Request::getInstance()->isHTTPS() && \XLite\Core\Config::getInstance()->Security->admin_security; }