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


PHP Environment::getService方法代码示例

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


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

示例1: ln

 /**
  * Sets the current sheet. Default is 'main'.
  * @param string $sheet
  * @return
  */
 public static function ln($sheet)
 {
     if (self::$translator === NULL) {
         self::$translator = Environment::getService('ITranslator');
     }
     return self::$translator->setCurrentSheet($sheet);
 }
开发者ID:jsmitka,项目名称:Nette-JsonTranslator,代码行数:12,代码来源:JsonTranslator.php

示例2: authenticate

 public function authenticate(array $credentials)
 {
     $login = $credentials['username'];
     $password = $this->phash($credentials['password']);
     $super_admin = Environment::getVariable('admin');
     if ($login == $super_admin['login']) {
         if ($password == $super_admin['password']) {
             $super_admin['roles'] = array('super admin');
             $super_admin['id'] = 0;
             $row = new DibiRow($super_admin);
             MokujiServiceLocator::addService('UserAuthorizator', new Admin_UserModel());
         } else {
             throw new AuthenticationException("Invalid password.", self::INVALID_CREDENTIAL);
         }
     } else {
         try {
             $login_manager = Environment::getService('UserAuthenticator');
             $row = $login_manager->authenticate($credentials);
         } catch (InvalidStateException $e) {
             throw new AuthenticationException("Login and password combination failed.", self::INVALID_CREDENTIAL);
         }
     }
     $identity = new Identity($row->id, $row->roles, $row);
     $identity->id = $row->id;
     return $identity;
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:26,代码来源:AdminUserModel.php

示例3: gatherActions

 private function gatherActions()
 {
     $service = Environment::getService('Nette\\Loaders\\RobotLoader');
     $class_list = $service->list;
     $actions = array();
     foreach ($class_list as $class => $file) {
         //zachtime annotation exception lebo nette si generuje nejake annotation claasy do robotloodera
         try {
             $r = new ReflectionClass($class);
             if ($r->isSubclassOf('Admin_SecurePresenter') && $r->getName() != 'BaseModulePresenter') {
                 $methods = $r->getMethods(ReflectionMethod::IS_PUBLIC);
                 foreach ($methods as $method) {
                     if (String::lower($method->class) == $class) {
                         if (strpos($method->getName(), 'action') !== false || strpos($method->getName(), 'handle') !== false) {
                             $actions[$class][] = $method->getName();
                         }
                     }
                 }
             }
         } catch (ReflectionException $e) {
         }
     }
     $actions = array_merge($actions, Environment::getApplication()->getModulesPermissions());
     $model = new UsersModuleModel();
     $model->saveActions($actions);
     return $actions;
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:27,代码来源:UsersUsersPresenter.php

示例4: startup

 public function startup()
 {
     parent::startup();
     if (!isset($this->lang)) {
         $this->lang = $this->getHttpRequest()->detectLanguage($this->langs);
         if ($this->lang == null) {
             $this->lang = 'en';
         }
         $this->canonicalize();
     }
     $this->translator = Environment::getService('Mokuji\\Translator\\Admin');
     $this->translator->lang = $this->lang;
     //$this->translator = new Admin_Translator($this->lang);
     $cache = Environment::getCache('langs');
     $langs = $cache->offsetGet('langs');
     if ($langs == NULL) {
         $this->langs = $this->translator->getSupportedLangs();
         //$this->model('lang')->getAll();
         $cache->save('langs', $this->langs);
     } else {
         $this->langs = $langs;
     }
     $this->refreshConfig();
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:24,代码来源:AdminBasePresenter.php

示例5: getAuthorizationHandler

 /**
  * Returns current authorization handler.
  * @return IAuthorizator
  */
 public final function getAuthorizationHandler()
 {
     if ($this->authorizationHandler === NULL) {
         $this->authorizationHandler = Environment::getService('Nette\\Security\\IAuthorizator');
     }
     return $this->authorizationHandler;
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:11,代码来源:User.php

示例6: actionPreview

 /**
  * Texyla preview
  */
 public function actionPreview()
 {
     $texy = Environment::getService("Texy");
     $html = $texy->process(Environment::getHttpRequest()->getPost("texy"));
     $this->terminate(new RenderResponse($html));
 }
开发者ID:regiss,项目名称:texyla-s-Nete1-PhP-5.2,代码行数:9,代码来源:TexylaPresenter.php

示例7: getTranslator

 public function getTranslator()
 {
     if (is_null($this->translator)) {
         $this->translator = Environment::getService('Nette\\ITranslator');
     }
     return $this->translator;
 }
开发者ID:radypala,项目名称:maga-website,代码行数:7,代码来源:BasePresenter.php

示例8: getJournal

 /**
  * Returns the ICacheJournal
  * @return ICacheJournal
  */
 protected function getJournal()
 {
     if ($this->journal === NULL) {
         $this->journal = Environment::getService('Nette\\Caching\\ICacheJournal');
     }
     return $this->journal;
 }
开发者ID:radypala,项目名称:maga-website,代码行数:11,代码来源:FileStorage.php


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