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


PHP Utils::get方法代码示例

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


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

示例1: setup

 protected function setup()
 {
     $roleAlias = Utils::get('identifier');
     $roleRepository = new RoleRepository(TRUE);
     $role = $roleRepository->getOneByAlias($roleAlias);
     MySmarty::assign('role', $role);
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:7,代码来源:RoleDetailBox.php

示例2: run

 public function run($function, array $params = array())
 {
     $hooks = Utils::get('ThinHooks');
     $res = null;
     if (Arrays::exists($function, $hooks)) {
         if (Arrays::exists('before', $hooks[$function])) {
             $action = $hooks[$function]['before'];
             if (is_callable($action, true, $before)) {
                 $res = $before();
             }
         }
         if (null === $res) {
             $res = '';
         }
         $res .= call_user_func_array($function, $params);
         if (Arrays::exists('after', $hooks[$function])) {
             $action = $hooks[$function]['after'];
             if (is_callable($action, true, $after)) {
                 $res .= $after();
             }
         }
         return $res;
     } else {
         return call_user_func_array($function, $params);
     }
 }
开发者ID:noikiy,项目名称:inovi,代码行数:26,代码来源:Hook.php

示例3: getLanguage

 /**
  * getter for actual site language
  *
  * @param	string	$lang	language shortcut
  * @return	Language
  */
 public static function getLanguage($lang = NULL)
 {
     $languageRepository = new LanguageRepository(TRUE);
     $language = NULL;
     // ak nemame zadany lang
     if ($lang === NULL) {
         // zistime ci je prihlaseny user a ci ma nastaveny nejaky jazyk
         $loggedUser = LoggedUser::whoIsLogged();
         if ($loggedUser) {
             $lang = $loggedUser['language'];
             if ($lang) {
                 $language = $languageRepository->getOneById($lang);
             }
         }
         // TODO nejaka lokalizacia podla goeip
         // ak stale nemame jazyk, pozrieme sa do url
         if (!$language) {
             $lang = Utils::get('language');
             if ($lang) {
                 $language = $languageRepository->getOneByShortcut($lang);
             } else {
                 // ak nemame zadane nic, vratime anglictinu
                 $language = $languageRepository->getOneByShortcut('sk');
             }
         }
         if (!$language) {
             throw new Exception('Language "' . $lang . '" doesn\'t exist.');
         }
     } else {
         $language = $languageRepository->getOneByShortcut($lang);
     }
     return $language;
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:39,代码来源:Utils.php

示例4: dispatch

 private static function dispatch()
 {
     $route = Utils::get('appDispatch');
     if (!$route instanceof Container) {
         context()->is404();
         $route = container()->getRoute();
     }
     if (true !== container()->getIsDispatched()) {
         if (true !== $route->getCache()) {
             context()->dispatch($route);
         } else {
             $redis = context()->redis();
             $key = sha1(serialize($route->assoc())) . '::routeCache';
             $cached = $redis->get($key);
             if (!strlen($cached)) {
                 ob_start();
                 context()->dispatch($route);
                 $cached = ob_get_contents();
                 ob_end_clean();
                 $redis->set($key, $cached);
                 $ttl = Config::get('application.route.cache', 7200);
                 $redis->expire($key, $ttl);
             }
             echo $cached;
         }
     }
 }
开发者ID:noikiy,项目名称:inovi,代码行数:27,代码来源:Bootstrap.php

示例5: setup

 protected function setup()
 {
     $pageTypeRepository = new PageTypeRepository(TRUE);
     $pageType = $pageTypeRepository->getOneByAlias(Utils::get('action'));
     $pageRepository = new PageRepository(TRUE);
     $page = $pageRepository->getOneByPageType($pageType['id']);
     MySmarty::assign('page', $page);
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:8,代码来源:StaticPageBox.php

示例6: getContent

 public function getContent()
 {
     if (Utils::get('identifier')) {
         $box = new RoomDetailBox();
     } else {
         $box = new RoomListingBox();
     }
     return $box->render();
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:9,代码来源:RoomsAction.php

示例7: instance

 public static function instance($name, $duration = 3600)
 {
     if (null === Utils::get('__Thin__Sessionbis__' . $name)) {
         $instance = new self($name, $duration);
         Utils::set('__Thin__Sessionbis__' . $name, $instance);
         return $instance;
     }
     return Utils::get('__Thin__Sessionbis__' . $name);
 }
开发者ID:schpill,项目名称:thin,代码行数:9,代码来源:Sessionbis.php

示例8: init

 function init()
 {
     parent::init();
     /* $this->fetchUserInfo(); */
     /* Set the app language if the session's language is supported */
     $language = Utils::get(Yii::app()->session, 'language', Yii::app()->params['language']);
     if (Utils::isLanguageSupported($language)) {
         Yii::app()->language = $language;
     }
 }
开发者ID:jessesiu,项目名称:GigaDBV3,代码行数:10,代码来源:Controller.php

示例9: userLogin

 /**
  * log the user - if not exists register him/her and then log the user
  *
  * @return	void
  */
 public static function userLogin()
 {
     $errors = array();
     $hash = addslashes(Utils::get('hash'));
     if ($hash) {
         $userRepository = new UserRepository();
         $user = $userRepository->getOneByHash($hash);
     } else {
         if (Utils::post('username') != '') {
             $username = addslashes(Utils::post('username'));
             if (!ctype_alnum($username)) {
                 $errors['username'] = 'V používateľskom mene môžeš použiť len alfanumerické znaky';
                 // TODO localize
             }
         } else {
             $errors['username'] = 'Musíš vyplniť používateľské meno';
             // TODO localize
         }
         if (Utils::post('password') != '') {
             $password = md5(addslashes(Utils::post('password')));
         } else {
             $errors['password'] = 'Musíš vyplniť heslo';
             // TODO localize
         }
         if (empty($errors)) {
             $userRepository = new UserRepository();
             $userExist = $userRepository->getOneByUsername($username);
             if ($userExist === NULL) {
                 $colorRepository = new ColorRepository();
                 $count = $colorRepository->getCountAll();
                 $rand = rand(1, $count);
                 $params = array('username' => $username, 'password' => $password, 'color' => $rand);
                 $user = new User($params);
                 $user = $user->save(TRUE);
             } elseif ($userExist['password'] != $password) {
                 $errors['password'] = 'Nesprávne heslo';
             } else {
                 $user = $userExist;
             }
         }
     }
     if ($user && empty($errors)) {
         // TODO po prihlaseni treba nejako zmazat v memcachi query, ktora vybera usera podla cookie_value
         // lebo teraz to stale vracia vysledok z memcache -> ked sa prihlasim v dvoch browsroch, v obidvoch to funguje
         // neodhlasi ma z toho prveho
         $cookieValue = md5(time() . $user['id'] . $user['username']);
         DB::update(DB_PREFIX . 'user', array('cookie_value' => $cookieValue), 'id = ' . $user['id']);
         $expire = Utils::post('remember') == 1 ? strtotime('+1 year') : 0;
         setcookie(self::$cookieName, $cookieValue, $expire, '/');
         return TRUE;
     } else {
         return $errors;
     }
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:59,代码来源:LoggedUser.php

示例10: setup

 protected function setup()
 {
     $characterAlias = Utils::get('identifier');
     $characterRepository = new CharacterRepository(TRUE);
     $character = $characterRepository->getOneByAlias($characterAlias);
     BangSeo::addTitlePart($character['name']);
     if ($character->getLocalizedDescription()) {
         BangSeo::setDescription($character->getLocalizedDescription());
     }
     MySmarty::assign('character', $character);
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:11,代码来源:CharacterDetailBox.php

示例11: addSeo

 protected function addSeo()
 {
     $action = Utils::get('action');
     $pageRepository = new PageRepository(TRUE);
     $page = $pageRepository->getOneByAlias($action);
     if (self::$seoAdded === FALSE) {
         BangSeo::addTitlePart($page['title']);
         BangSeo::setDescription($page['meta_description']);
         BangSeo::addContentForKeywords($page['meta_keywords'], BangSeo::MEDIUM_PRIORITY);
         self::$seoAdded = TRUE;
     }
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:12,代码来源:AbstractBox.php

示例12: setup

 protected function setup()
 {
     $loggedUser = LoggedUser::whoIsLogged();
     if ($loggedUser) {
         MySmarty::assign('loggedUser', $loggedUser);
         $logoutPage = PageActionMap::getPageByTypeAndLanguage('logout');
         MySmarty::assign('logoutPage', $logoutPage);
     } else {
         $loginPage = PageActionMap::getPageByTypeAndLanguage('login');
         MySmarty::assign('loginPage', $loginPage);
     }
     MySmarty::assign('language', Utils::get('language'));
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:13,代码来源:UpperPartBox.php

示例13: setup

 protected function setup()
 {
     $cardAlias = Utils::get('identifier');
     $cardBaseTypeRepository = new CardBaseTypeRepository(TRUE);
     $cardBaseType = $cardBaseTypeRepository->getOneByAlias($cardAlias);
     if ($cardBaseType) {
         $cardRepository = new CardRepository(TRUE);
         $card = $cardRepository->getOneByCardBaseType($cardBaseType['id']);
     }
     BangSeo::addTitlePart($card->getTitle());
     if ($card->getDescription()) {
         BangSeo::setDescription($card->getDescription());
     }
     MySmarty::assign('card', $card);
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:15,代码来源:CardDetailBox.php

示例14: assetBundle

 public static function assetBundle($path = 'css/style.css')
 {
     $route = Utils::get('appDispatch');
     $bundle = $route->getBundle();
     if (!is_null($bundle)) {
         $bpath = realpath(APPLICATION_PATH . '/../');
         $bundle = ucfirst(Inflector::lower($bundle));
         $assetsDir = $bpath . DS . 'bundles' . DS . $bundle . DS . 'public';
         $file = $assetsDir . DS . $path;
         if (File::exists($file)) {
             $url = URLSITE . 'bundles/' . $bundle . '/public/' . $path;
         }
     }
     return URLSITE . '/' . $path;
 }
开发者ID:schpill,项目名称:thin,代码行数:15,代码来源:Route.php

示例15: initGame

 protected function initGame($game)
 {
     $roomAlias = Utils::get('identifier');
     $roomRepository = new RoomRepository();
     $room = $roomRepository->getOneByAlias($roomAlias);
     self::$room = $room['id'];
     self::$loggedUser = LoggedUser::whoIsLogged();
     if ($game && self::$loggedUser) {
         self::$game = $game;
         foreach ($game['players'] as $player) {
             if (self::$loggedUser['id'] == $player['user']['id']) {
                 self::$player = $player;
                 break;
             }
         }
     }
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:17,代码来源:OldCommand.php


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