本文整理汇总了PHP中Chat::gravatarFromHash方法的典型用法代码示例。如果您正苦于以下问题:PHP Chat::gravatarFromHash方法的具体用法?PHP Chat::gravatarFromHash怎么用?PHP Chat::gravatarFromHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chat
的用法示例。
在下文中一共展示了Chat::gravatarFromHash方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getChats
public static function getChats($lastID)
{
$lastID = (int) $lastID;
$result = DB::query('SELECT * FROM webchat_lines WHERE id > ' . $lastID . ' ORDER BY id ASC');
$chats = array();
while ($chat = $result->fetch_object()) {
$chat->time = array('hours' => gmdate('H', strtotime($chat->ts)), 'minutes' => gmdate('i', strtotime($chat->ts)));
$chat->gravatar = Chat::gravatarFromHash($chat->gravatar);
$chats[] = $chat;
}
return array('chats' => $chats);
}
示例2: actionChat
public function actionChat()
{
$dbOptions = array('db_host' => 'localhost', 'db_user' => 'root', 'db_pass' => '', 'db_name' => 'ot');
session_name('webchat');
session_id(rand(1, 5));
if (get_magic_quotes_gpc()) {
// If magic quotes is enabled, strip the extra slashes
array_walk_recursive($_GET, create_function('&$v,$k', '$v = stripslashes($v);'));
array_walk_recursive($_POST, create_function('&$v,$k', '$v = stripslashes($v);'));
}
try {
// Connecting to the database
//$db = new DB;
$chat = new Chat();
//DB::init($dbOptions);
$response = array();
// Handling the supported actions:
switch ($_GET['action']) {
case 'login':
$response = array('status' => 1, 'name' => Yii::app()->user->name, 'gravatar' => Chat::gravatarFromHash('123'));
break;
case 'checkLogged':
$response = $chat::checkLogged();
break;
case 'logout':
$response = $chat::logout();
break;
case 'submitChat':
$response = $chat::submitChat($_POST['chatText']);
break;
case 'getUsers':
$response = $chat::getUsers();
break;
case 'getChats':
$response = $chat::getChats($_GET['lastID']);
break;
default:
throw new Exception('Wrong action');
}
echo json_encode($response);
} catch (Exception $e) {
die(json_encode(array('error' => $e->getMessage())));
}
}