当前位置: 首页>>代码示例>>PHP>>正文


PHP Pimcore_Tool::getRoutingDefaults方法代码示例

本文整理汇总了PHP中Pimcore_Tool::getRoutingDefaults方法的典型用法代码示例。如果您正苦于以下问题:PHP Pimcore_Tool::getRoutingDefaults方法的具体用法?PHP Pimcore_Tool::getRoutingDefaults怎么用?PHP Pimcore_Tool::getRoutingDefaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimcore_Tool的用法示例。


在下文中一共展示了Pimcore_Tool::getRoutingDefaults方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _handleError

 protected function _handleError(Zend_Controller_Request_Abstract $request)
 {
     // remove zend error handler
     $front = Zend_Controller_Front::getInstance();
     $front->unregisterPlugin("Zend_Controller_Plugin_ErrorHandler");
     $response = $this->getResponse();
     if ($response->isException() && !$this->_isInsideErrorHandlerLoop) {
         // get errorpage
         try {
             // enable error handler
             $front->setParam('noErrorHandler', false);
             $siteKey = Pimcore_Tool_Frontend::getSiteKey();
             $errorPath = Pimcore_Config::getSystemConfig()->documents->error_pages->{$siteKey};
             if (empty($errorPath)) {
                 $errorPath = "/";
             }
             $document = Document::getByPath($errorPath);
             if (!$document instanceof Document_Page) {
                 // default is home
                 $document = Document::getById(1);
             }
             if ($document instanceof Document_Page) {
                 $params = Pimcore_Tool::getRoutingDefaults();
                 if ($module = $document->getModule()) {
                     $params["module"] = $module;
                 }
                 if ($controller = $document->getController()) {
                     $params["controller"] = $controller;
                     $params["action"] = "index";
                 }
                 if ($action = $document->getAction()) {
                     $params["action"] = $action;
                 }
                 $this->setErrorHandler($params);
                 $request->setParam("document", $document);
                 Zend_Registry::set("pimcore_error_document", $document);
             }
         } catch (Exception $e) {
             Logger::emergency("error page not found");
         }
     }
     // call default ZF error handler
     parent::_handleError($request);
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:44,代码来源:ErrorHandler.php

示例2: match

 /**
  * @param  $path
  * @param bool $partial
  * @return array|bool
  */
 public function match($path, $partial = false)
 {
     $matchFound = false;
     $config = Pimcore_Config::getSystemConfig();
     $routeingDefaults = Pimcore_Tool::getRoutingDefaults();
     $params = array_merge($_GET, $_POST);
     $params = array_merge($routeingDefaults, $params);
     // set the original path
     $originalPath = $path;
     // check for a registered site
     try {
         if ($config->general->domain != $_SERVER["HTTP_HOST"]) {
             $domain = $_SERVER["HTTP_HOST"];
             $site = Site::getByDomain($domain);
             $site->setRootPath($site->getRootDocument()->getFullPath());
             $path = $site->getRootDocument()->getFullPath() . $path;
             Zend_Registry::set("pimcore_site", $site);
         }
     } catch (Exception $e) {
     }
     // check for direct definition of controller/action
     if (!empty($_REQUEST["controller"]) && !empty($_REQUEST["action"])) {
         $matchFound = true;
         //$params["document"] = $this->getNearestDocumentByPath($path);
     }
     // you can also call a page by it's ID /?pimcore_document=XXXX
     if (!$matchFound) {
         if (!empty($params["pimcore_document"]) || !empty($params["pdid"])) {
             $doc = Document::getById($params["pimcore_document"] ? $params["pimcore_document"] : $params["pdid"]);
             if ($doc instanceof Document) {
                 $path = $doc->getFullPath();
             }
         }
     }
     // test if there is a suitable redirect with override = all (=> priority = 99)
     if (!$matchFound) {
         $this->checkForRedirect(true);
     }
     // test if there is a suitable page
     if (!$matchFound) {
         try {
             $document = Document::getByPath($path);
             // check for a parent hardlink with childs
             if (!$document instanceof Document) {
                 $hardlinkedParentDocument = $this->getNearestDocumentByPath($path, true);
                 if ($hardlinkedParentDocument instanceof Document_Hardlink) {
                     if ($hardLinkedDocument = Document_Hardlink_Service::getChildByPath($hardlinkedParentDocument, $path)) {
                         $document = $hardLinkedDocument;
                     }
                 }
             }
             // check for direct hardlink
             if ($document instanceof Document_Hardlink) {
                 $hardlinkParentDocument = $document;
                 $document = Document_Hardlink_Service::wrap($hardlinkParentDocument);
             }
             if ($document instanceof Document) {
                 if (in_array($document->getType(), array("page", "snippet", "email"))) {
                     if (!empty($params["pimcore_version"]) || !empty($params["pimcore_preview"]) || !empty($params["pimcore_admin"]) || !empty($params["pimcore_editmode"]) || $document->isPublished() || !empty($_COOKIE["pimcore_admin_sid"])) {
                         $params["document"] = $document;
                         if ($controller = $document->getController()) {
                             $params["controller"] = $controller;
                             $params["action"] = "index";
                         }
                         if ($action = $document->getAction()) {
                             $params["action"] = $action;
                         }
                         if ($module = $document->getModule()) {
                             $params["module"] = $module;
                         }
                         // check for a trailing slash in path, if exists, redirect to this page without the slash
                         // the only reason for this is: SEO, Analytics, ... there is no system specific reason, pimcore would work also with a trailing slash without problems
                         // use $originalPath because of the sites
                         if ($config->documents->allowtrailingslash) {
                             if ($config->documents->allowtrailingslash == "no") {
                                 if (substr($originalPath, strlen($originalPath) - 1, 1) == "/" && $originalPath != "/") {
                                     $redirectUrl = rtrim($originalPath, "/");
                                     if ($_SERVER["QUERY_STRING"]) {
                                         $redirectUrl .= "?" . $_SERVER["QUERY_STRING"];
                                     }
                                     header("Location: " . $redirectUrl, true, 301);
                                     exit;
                                 }
                             }
                         }
                         if ($config->documents->allowcapitals) {
                             if ($config->documents->allowcapitals == "no") {
                                 if (strtolower($originalPath) != $originalPath) {
                                     $redirectUrl = strtolower($originalPath);
                                     if ($_SERVER["QUERY_STRING"]) {
                                         $redirectUrl .= "?" . $_SERVER["QUERY_STRING"];
                                     }
                                     header("Location: " . $redirectUrl, true, 301);
                                     exit;
                                 }
//.........这里部分代码省略.........
开发者ID:nblackman,项目名称:pimcore,代码行数:101,代码来源:Frontend.php


注:本文中的Pimcore_Tool::getRoutingDefaults方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。