本文整理汇总了PHP中Pimcore_Tool::isFrontend方法的典型用法代码示例。如果您正苦于以下问题:PHP Pimcore_Tool::isFrontend方法的具体用法?PHP Pimcore_Tool::isFrontend怎么用?PHP Pimcore_Tool::isFrontend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore_Tool
的用法示例。
在下文中一共展示了Pimcore_Tool::isFrontend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run()
{
self::setSystemRequirements();
// detect frontend (website)
$frontend = Pimcore_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();
self::initModules();
self::initPlugins();
// init front controller
$front = Zend_Controller_Front::getInstance();
$conf = Pimcore_Config::getSystemConfig();
if (!$conf) {
// redirect to installer if configuration isn't present
if (!preg_match("/^\\/install.*/", $_SERVER["REQUEST_URI"])) {
header("Location: /install/");
exit;
}
}
// set timezone
if ($conf instanceof Zend_Config) {
if ($conf->general->timezone) {
date_default_timezone_set($conf->general->timezone);
}
}
$front->registerPlugin(new Pimcore_Controller_Plugin_Maintenance(), 2);
// register general pimcore plugins for frontend
if ($frontend) {
$front->registerPlugin(new Pimcore_Controller_Plugin_ErrorHandler(), 1);
$front->registerPlugin(new Pimcore_Controller_Plugin_Less(), 799);
}
if (Pimcore_Tool::useFrontendOutputFilters(new Zend_Controller_Request_Http())) {
$front->registerPlugin(new Pimcore_Controller_Plugin_WysiwygAttributes(), 796);
$front->registerPlugin(new Pimcore_Controller_Plugin_Webmastertools(), 797);
$front->registerPlugin(new Pimcore_Controller_Plugin_Analytics(), 798);
$front->registerPlugin(new Pimcore_Controller_Plugin_CssMinify(), 800);
$front->registerPlugin(new Pimcore_Controller_Plugin_JavascriptMinify(), 801);
$front->registerPlugin(new Pimcore_Controller_Plugin_HtmlMinify(), 802);
$front->registerPlugin(new Pimcore_Controller_Plugin_ImageDataUri(), 803);
$front->registerPlugin(new Pimcore_Controller_Plugin_CDN(), 804);
$front->registerPlugin(new Pimcore_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 Pimcore_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 webdav is configured and add router
if ($conf instanceof Zend_Config) {
if ($conf->assets->webdav->hostname) {
$routeWebdav = new Zend_Controller_Router_Route_Hostname($conf->assets->webdav->hostname, array("module" => "admin", 'controller' => 'asset', 'action' => 'webdav'));
$router->addRoute('webdav', $routeWebdav);
}
}
$front->setRouter($router);
Pimcore_API_Plugin_Broker::getInstance()->preDispatch();
// run dispatcher
if ($frontend && !PIMCORE_DEBUG) {
@ini_set("display_errors", "Off");
@ini_set("display_startup_errors", "Off");
$front->dispatch();
} else {
@ini_set("display_errors", "On");
@ini_set("display_startup_errors", "On");
$front->throwExceptions(true);
try {
$front->dispatch();
} catch (Zend_Controller_Router_Exception $e) {
//.........这里部分代码省略.........
示例2: run
/**
* @static
* @throws Exception|Zend_Controller_Router_Exception
*/
public static function run()
{
self::setSystemRequirements();
// register shutdown function
Pimcore_Event::register("pimcore.shutdown", array("Pimcore", "shutdown"), array(), 999);
// detect frontend (website)
$frontend = Pimcore_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();
// set locale data cache, this must be after self::initLogger() since Pimcore_Model_Cache requires the logger
// to log if there's something wrong with the cache configuration in cache.xml
Zend_Locale_Data::setCache(Pimcore_Model_Cache::getInstance());
// load plugins and modules (=core plugins)
self::initModules();
self::initPlugins();
// init front controller
$front = Zend_Controller_Front::getInstance();
$conf = Pimcore_Config::getSystemConfig();
if (!$conf) {
// redirect to installer if configuration isn't present
if (!preg_match("/^\\/install.*/", $_SERVER["REQUEST_URI"])) {
header("Location: /install/");
exit;
}
}
$front->registerPlugin(new Pimcore_Controller_Plugin_ErrorHandler(), 1);
$front->registerPlugin(new Pimcore_Controller_Plugin_Maintenance(), 2);
// register general pimcore plugins for frontend
if ($frontend) {
$front->registerPlugin(new Pimcore_Controller_Plugin_Less(), 799);
}
if (Pimcore_Tool::useFrontendOutputFilters(new Zend_Controller_Request_Http())) {
$front->registerPlugin(new Pimcore_Controller_Plugin_Robotstxt(), 795);
$front->registerPlugin(new Pimcore_Controller_Plugin_WysiwygAttributes(), 796);
$front->registerPlugin(new Pimcore_Controller_Plugin_Webmastertools(), 797);
$front->registerPlugin(new Pimcore_Controller_Plugin_Analytics(), 798);
$front->registerPlugin(new Pimcore_Controller_Plugin_CssMinify(), 800);
$front->registerPlugin(new Pimcore_Controller_Plugin_JavascriptMinify(), 801);
$front->registerPlugin(new Pimcore_Controller_Plugin_ImageDataUri(), 803);
$front->registerPlugin(new Pimcore_Controller_Plugin_TagManagement(), 804);
$front->registerPlugin(new Pimcore_Controller_Plugin_HttpErrorLog(), 850);
$front->registerPlugin(new Pimcore_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 Pimcore_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 webdav is configured and add router
if ($conf instanceof Zend_Config) {
if ($conf->assets->webdav->hostname) {
$routeWebdav = new Zend_Controller_Router_Route_Hostname($conf->assets->webdav->hostname, array("module" => "admin", 'controller' => 'asset', 'action' => 'webdav'));
$router->addRoute('webdav', $routeWebdav);
}
}
$front->setRouter($router);
Pimcore_API_Plugin_Broker::getInstance()->preDispatch();
// throw exceptions also when in preview or in editmode (documents) to see it immediately when there's a problem with this page
$throwExceptions = false;
if (array_key_exists("pimcore_editmode", $_REQUEST) || array_key_exists("pimcore_preview", $_REQUEST) || array_key_exists("pimcore_admin", $_REQUEST)) {
$user = Pimcore_Tool_Authentication::authenticateSession();
if ($user instanceof User) {
$throwExceptions = true;
}
//.........这里部分代码省略.........