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


PHP Tool::isFrontend方法代码示例

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


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

示例1: getPath

 /**
  * Returns the document path.
  *
  * @return string
  */
 public function getPath()
 {
     // check for site, if so rewrite the path for output
     try {
         if (\Pimcore\Tool::isFrontend() && Site::isSiteRequest()) {
             $site = Site::getCurrentSite();
             if ($site instanceof Site) {
                 if ($site->getRootDocument() instanceof Document\Page && $site->getRootDocument() !== $this) {
                     $rootPath = $site->getRootPath();
                     $rootPath = preg_quote($rootPath);
                     $link = preg_replace("@^" . $rootPath . "@", "", $this->path);
                     return $link;
                 }
             }
         }
     } catch (\Exception $e) {
         Logger::error($e);
     }
     return $this->path;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:25,代码来源:Document.php

示例2: run

 /**
  * @static
  * @throws Exception|\Zend_Controller_Router_Exception
  */
 public static function run()
 {
     self::setSystemRequirements();
     // detect frontend (website)
     $frontend = Tool::isFrontend();
     // enable the output-buffer, why? see in self::outputBufferStart()
     //if($frontend) {
     self::outputBufferStart();
     //}
     self::initAutoloader();
     self::initConfiguration();
     self::setupFramework();
     // config is loaded now init the real logger
     self::initLogger();
     // initialize cache
     Cache::init();
     // load plugins and modules (=core plugins)
     self::initModules();
     self::initPlugins();
     // init front controller
     $front = \Zend_Controller_Front::getInstance();
     $conf = Config::getSystemConfig();
     if (!$conf) {
         // redirect to installer if configuration isn't present
         if (!preg_match("/^\\/install.*/", $_SERVER["REQUEST_URI"])) {
             header("Location: /install/");
             exit;
         }
     }
     if (self::inDebugMode() && $frontend && !$conf->general->disable_whoops && !defined("HHVM_VERSION")) {
         $whoops = new \Whoops\Run();
         $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
         $jsonErrorHandler = new \Whoops\Handler\JsonResponseHandler();
         $jsonErrorHandler->onlyForAjaxRequests(true);
         $whoops->pushHandler($jsonErrorHandler);
         $whoops->register();
         // add event handler before Pimcore::shutdown() to ensure fatal errors are handled by Whoops
         self::getEventManager()->attach("system.shutdown", array($whoops, "handleShutdown"), 10000);
     }
     $front->registerPlugin(new Controller\Plugin\ErrorHandler(), 1);
     $front->registerPlugin(new Controller\Plugin\Maintenance(), 2);
     // register general pimcore plugins for frontend
     if ($frontend) {
         $front->registerPlugin(new Controller\Plugin\Thumbnail(), 795);
         $front->registerPlugin(new Controller\Plugin\Less(), 799);
         $front->registerPlugin(new Controller\Plugin\AdminButton(), 806);
     }
     if (Tool::useFrontendOutputFilters(new \Zend_Controller_Request_Http())) {
         $front->registerPlugin(new Controller\Plugin\HybridAuth(), 792);
         $front->registerPlugin(new Controller\Plugin\QrCode(), 793);
         $front->registerPlugin(new Controller\Plugin\CommonFilesFilter(), 794);
         $front->registerPlugin(new Controller\Plugin\WysiwygAttributes(), 796);
         $front->registerPlugin(new Controller\Plugin\Webmastertools(), 797);
         $front->registerPlugin(new Controller\Plugin\Analytics(), 798);
         $front->registerPlugin(new Controller\Plugin\TagManagement(), 804);
         $front->registerPlugin(new Controller\Plugin\Targeting(), 805);
         $front->registerPlugin(new Controller\Plugin\EuCookieLawNotice(), 807);
         $front->registerPlugin(new Controller\Plugin\HttpErrorLog(), 850);
         $front->registerPlugin(new Controller\Plugin\Cache(), 901);
         // for caching
     }
     self::initControllerFront($front);
     // set router
     $router = $front->getRouter();
     $routeAdmin = new \Zend_Controller_Router_Route('admin/:controller/:action/*', array('module' => 'admin', "controller" => "index", "action" => "index"));
     $routeInstall = new \Zend_Controller_Router_Route('install/:controller/:action/*', array('module' => 'install', "controller" => "index", "action" => "index"));
     $routeUpdate = new \Zend_Controller_Router_Route('admin/update/:controller/:action/*', array('module' => 'update', "controller" => "index", "action" => "index"));
     $routePlugins = new \Zend_Controller_Router_Route('admin/plugin/:controller/:action/*', array('module' => 'pluginadmin', "controller" => "index", "action" => "index"));
     $routeExtensions = new \Zend_Controller_Router_Route('admin/extensionmanager/:controller/:action/*', array('module' => 'extensionmanager', "controller" => "index", "action" => "index"));
     $routeReports = new \Zend_Controller_Router_Route('admin/reports/:controller/:action/*', array('module' => 'reports', "controller" => "index", "action" => "index"));
     $routePlugin = new \Zend_Controller_Router_Route('plugin/:module/:controller/:action/*', array("controller" => "index", "action" => "index"));
     $routeWebservice = new \Zend_Controller_Router_Route('webservice/:controller/:action/*', array("module" => "webservice", "controller" => "index", "action" => "index"));
     $routeSearchAdmin = new \Zend_Controller_Router_Route('admin/search/:controller/:action/*', array("module" => "searchadmin", "controller" => "index", "action" => "index"));
     // website route => custom router which check for a suitable document
     $routeFrontend = new Controller\Router\Route\Frontend();
     $router->addRoute('default', $routeFrontend);
     // only do this if not frontend => performance issue
     if (!$frontend) {
         $router->addRoute("install", $routeInstall);
         $router->addRoute('plugin', $routePlugin);
         $router->addRoute('admin', $routeAdmin);
         $router->addRoute('update', $routeUpdate);
         $router->addRoute('plugins', $routePlugins);
         $router->addRoute('extensionmanager', $routeExtensions);
         $router->addRoute('reports', $routeReports);
         $router->addRoute('searchadmin', $routeSearchAdmin);
         if ($conf instanceof \Zend_Config and $conf->webservice and $conf->webservice->enabled) {
             $router->addRoute('webservice', $routeWebservice);
         }
         // check if this request routes into a plugin, if so check if the plugin is enabled
         if (preg_match("@^/plugin/([^/]+)/.*@", $_SERVER["REQUEST_URI"], $matches)) {
             $pluginName = $matches[1];
             if (!Pimcore\ExtensionManager::isEnabled("plugin", $pluginName)) {
                 \Pimcore\Tool::exitWithError("Plugin is disabled. To use this plugin please enable it in the extension manager!");
             }
         }
//.........这里部分代码省略.........
开发者ID:pdaniel-frk,项目名称:pimcore,代码行数:101,代码来源:Pimcore.php

示例3: getFullPath

 /**
  * Returns the full path of the document including the filename
  *
  * @return string
  */
 public function getFullPath()
 {
     $path = $this->getPath() . $this->getFilename();
     if (\Pimcore\Tool::isFrontend()) {
         $path = urlencode_ignore_slash($path);
         $results = \Pimcore::getEventManager()->trigger("frontend.path.asset", $this);
         if ($results->count()) {
             $path = $results->last();
         }
     }
     return $path;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:17,代码来源:Asset.php


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