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


PHP waSystem::getActiveLocaleDomain方法代码示例

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


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

示例1: execute

 /** Execute appropriate controller and return it's result.
  * Throw 404 exception if no controller found. */
 public function execute($plugin = null, $module = null, $action = null, $default = false)
 {
     if (!$this->system->getConfig()->checkRights($module, $action)) {
         throw new waRightsException(_ws("Access denied."));
     }
     // current app prefix
     $prefix = $this->system->getConfig()->getPrefix();
     // Load plugin locale and set plugin as active
     if ($plugin) {
         $plugin_path = $this->system->getAppPath('plugins/' . $plugin, $this->system->getApp());
         if (!file_exists($plugin_path . '/lib/config/plugin.php')) {
             $plugin = null;
         } else {
             $plugin_info = (include $plugin_path . '/lib/config/plugin.php');
             // check rights
             if (isset($plugin_info['rights']) && $plugin_info['rights']) {
                 if (!$this->system->getUser()->getRights($this->system->getConfig()->getApplication(), 'plugin.' . $plugin)) {
                     throw new waRightsException(_ws("Access denied"), 403);
                 }
             }
             waSystem::pushActivePlugin($plugin, $prefix);
             if (is_dir($plugin_path . '/locale')) {
                 waLocale::load($this->system->getLocale(), $plugin_path . '/locale', waSystem::getActiveLocaleDomain(), false);
             }
         }
     }
     // custom login and signup
     if (wa()->getEnv() == 'frontend') {
         if (!$plugin && !$action && $module == 'login') {
             $login_action = $this->system->getConfig()->getFactory('login_action');
             if ($login_action) {
                 $controller = $this->system->getDefaultController();
                 $controller->setAction($login_action);
                 $r = $controller->run();
                 return $r;
             }
         } elseif (!$plugin && !$action && $module == 'signup') {
             $signup_action = $this->system->getConfig()->getFactory('signup_action');
             if ($signup_action) {
                 $controller = $this->system->getDefaultController();
                 $controller->setAction($signup_action);
                 $r = $controller->run();
                 return $r;
             }
         }
     }
     //
     // Check possible ways to handle the request one by one
     //
     // list of failed class names (for debugging)
     $class_names = array();
     // Single Controller (recomended)
     $class_name = $prefix . ($plugin ? ucfirst($plugin) . 'Plugin' : '') . ucfirst($module) . ($action ? ucfirst($action) : '') . 'Controller';
     if (class_exists($class_name, true)) {
         /**
          * @var $controller waController
          */
         $controller = new $class_name();
         $r = $controller->run();
         if ($plugin) {
             waSystem::popActivePlugin();
         }
         return $r;
     }
     $class_names[] = $class_name;
     // Single Action
     $class_name = $prefix . ($plugin ? ucfirst($plugin) . 'Plugin' : '') . ucfirst($module) . ($action ? ucfirst($action) : '') . 'Action';
     if (class_exists($class_name)) {
         // get default view controller
         /**
          * @var $controller waDefaultViewController
          */
         $controller = $this->system->getDefaultController();
         $controller->setAction($class_name);
         $r = $controller->run();
         if ($plugin) {
             waSystem::popActivePlugin();
         }
         return $r;
     }
     $class_names[] = $class_name;
     // Controller Multi Actions, Zend/Symfony style
     $class_name = $prefix . ($plugin ? ucfirst($plugin) . 'Plugin' : '') . ucfirst($module) . 'Actions';
     if (class_exists($class_name, true)) {
         $controller = new $class_name();
         $r = $controller->run($action);
         if ($plugin) {
             waSystem::popActivePlugin();
         }
         return $r;
     }
     $class_names[] = $class_name;
     // Plugin is no longer active
     if ($plugin) {
         waSystem::popActivePlugin();
     }
     // Last chance: default action for this module
     if ($action && $default) {
//.........这里部分代码省略.........
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:101,代码来源:waFrontController.class.php


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