當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Localize::getMessage方法代碼示例

本文整理匯總了PHP中Localize::getMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Localize::getMessage方法的具體用法?PHP Localize::getMessage怎麽用?PHP Localize::getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Localize的用法示例。


在下文中一共展示了Localize::getMessage方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getMessages

    /**
     * getter for messages
     *
     * @param	int	$room
     * @param	int	$user
     * @param	int	$time
     * @param	int	$game
     * @return array
     */
    public static function getMessages($room, $toUser = 0, $time = 0, $game = 0)
    {
        $colorRepository = new ColorRepository(TRUE);
        $colors = $colorRepository->getAll();
        $colorList = array();
        foreach ($colors as $color) {
            $colorList[$color['id']] = $color;
        }
        $query = 'SELECT user.*, message.*
			FROM ' . DB_PREFIX . self::$table . ' AS message
			LEFT JOIN ' . DB_PREFIX . 'user AS user ON message.user = user.id
			WHERE room=' . intval($room) . ' AND tstamp > ' . intval($time) . '
				AND to_user IN (' . intval($toUser) . ', 0)';
        if ($game) {
            $query .= ' AND game=' . intval($game);
        }
        if ($toUser) {
            $query .= ' AND NOT not_to_user IN (' . $toUser . ')';
        }
        $query .= ' ORDER BY message.id DESC LIMIT 100';
        $messages = DB::fetchAll($query);
        $messages = array_reverse($messages);
        foreach ($messages as &$message) {
            if ($message['localize_key']) {
                $message['text'] = Localize::getMessage($message['localize_key'], unserialize($message['localize_params']));
            }
            $message['color'] = $colorList[$message['color']]['code'];
        }
        return $messages;
    }
開發者ID:Tomeno,項目名稱:lulcobang,代碼行數:39,代碼來源:Chat.php

示例2: smarty_function_localize

/**
 * Smarty {localize} function plugin
 *
 */
function smarty_function_localize($params, &$smarty)
{
    $attrs = array();
    if ($params['attrs']) {
        $attrs = explode('###', $params['attrs']);
    }
    return Localize::getMessage($params['key'], $attrs);
}
開發者ID:Tomeno,項目名稱:lulcobang,代碼行數:12,代碼來源:function.localize.php

示例3: setup

 protected function setup()
 {
     $loggedUser = LoggedUser::whoIsLogged();
     if (Utils::post('create_room') && $loggedUser['admin']) {
         $params = array('title' => Utils::post('title'), 'alias' => Utils::createAlias(Utils::post('title'), 'room'), 'description' => Utils::post('description'));
         $room = new Room($params);
         $room->save();
     }
     $roomRepository = new RoomRepository();
     $rooms = $roomRepository->getAll();
     $gameRepository = new GameRepository();
     $games = $gameRepository->getGamesByRooms(array_keys($rooms));
     foreach ($games as $game) {
         $rooms[$game['room']]['game'] = TRUE;
         $rooms[$game['room']]['status'] = Localize::getMessage('room_status_' . $game['status']);
     }
     MySmarty::assign('loggedUser', $loggedUser);
     MySmarty::assign('rooms', $rooms);
 }
開發者ID:Tomeno,項目名稱:lulcobang,代碼行數:19,代碼來源:RoomListingBox.php

示例4: setup

 protected function setup()
 {
     $loggedUser = LoggedUser::whoIsLogged();
     MySmarty::assign('loggedUser', $loggedUser);
     MySmarty::assign('room', $this->room);
     if ($this->game) {
         MySmarty::assign('game', $this->game);
         MySmarty::assign('gameStartedStatus', Game::GAME_STATUS_STARTED);
         $playerRepository = new PlayerRepository();
         $actualPlayer = $playerRepository->getOneByGameAndUser($this->game['id'], $loggedUser['id']);
         // phases when we want to make autoreload
         $refreshGameBox = FALSE;
         if (in_array($actualPlayer['phase'], array(Player::PHASE_NONE, Player::PHASE_WAITING))) {
             if ($this->game['status'] == Game::GAME_STATUS_INITIALIZED && $actualPlayer['possible_choices'] != '') {
                 $refreshGameBox = FALSE;
             } else {
                 $refreshGameBox = TRUE;
             }
         }
         MySmarty::assign('refreshGameBox', $refreshGameBox);
         // zobrazime len hracovi ktory je na tahu resp. v medzitahu
         $playerOnMove = $this->game->getPlayerOnMove();
         if ($playerOnMove['id'] == $actualPlayer['id'] || $this->game['status'] == Game::GAME_STATUS_INITIALIZED) {
             MySmarty::assign('response', $actualPlayer['command_response']);
         }
         if ($this->game['status'] == Game::GAME_STATUS_CREATED) {
             if (!GameUtils::checkUserInGame($loggedUser, $this->game)) {
                 MySmarty::assign('joinGameAvailable', TRUE);
             } elseif ($loggedUser['id'] == $this->game['creator']) {
                 MySmarty::assign('startGameAvailable', Localize::getMessage('start_game'));
             }
         } elseif ($this->game['status'] == Game::GAME_STATUS_ENDED) {
             MySmarty::assign('createGameAvailable', Localize::getMessage('create_game'));
             MySmarty::assign('refreshGameBox', TRUE);
         }
     } else {
         MySmarty::assign('createGameAvailable', Localize::getMessage('create_game'));
         MySmarty::assign('refreshGameBox', TRUE);
     }
 }
開發者ID:Tomeno,項目名稱:lulcobang,代碼行數:40,代碼來源:GameBox.php

示例5: getLocalizedDescription

 public function getLocalizedDescription()
 {
     return Localize::getMessage($this['localize_description_key']);
 }
開發者ID:Tomeno,項目名稱:lulcobang,代碼行數:4,代碼來源:CardBaseType.php

示例6: main

 public function main()
 {
     $key = addslashes(Utils::post('key'));
     echo Localize::getMessage($key);
 }
開發者ID:Tomeno,項目名稱:lulcobang,代碼行數:5,代碼來源:LocalizeMessage.php

示例7: getLocalizedUsage

 public function getLocalizedUsage()
 {
     return Localize::getMessage($this['localize_key'] . '_usage');
 }
開發者ID:Tomeno,項目名稱:lulcobang,代碼行數:4,代碼來源:Character.php


注:本文中的Localize::getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。