本文整理汇总了PHP中FB::get_loggedin_user方法的典型用法代码示例。如果您正苦于以下问题:PHP FB::get_loggedin_user方法的具体用法?PHP FB::get_loggedin_user怎么用?PHP FB::get_loggedin_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FB
的用法示例。
在下文中一共展示了FB::get_loggedin_user方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logged_in
/**
* Checks if a session is active.
*
* @param string role name
* @param array collection of role names
* @return boolean
*/
public function logged_in($role = NULL)
{
$user = $this->session->get($this->config['session_key']);
if (!(is_object($user) and $user instanceof Model_User and $user->loaded())) {
if ($fb_uid = FB::get_loggedin_user()) {
$user = ORM::factory('user')->where('fb_uid', '=', $fb_uid)->find();
$this->force_login($user);
}
}
return parent::logged_in($role);
}
示例2:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Facebook API Example</title>
<?php
echo FB::feature_loader();
?>
</head>
<body>
<h1> Facebook Connect API Example </h1>
<div id="comments_post">
<h3>Leave a comment:</h3>
<form method="POST">
<div id="user">
<?php
if (FB::get_loggedin_user()) {
?>
<span>
<?php
echo FB::profile_pic();
?>
Welcome, <?php
echo FB::name(array('useyou' => 'false'));
?>
. You are signed in with your Facebook account.
</span>
<?php
} else {
?>
Name: <input name="name" size="27"/><br/>
Or, you can <?php
示例3: get_user
/**
* Gets the currently logged in user from the session.
* Returns FALSE if no user is currently logged in.
*
* @return mixed
*/
public function get_user()
{
$user = parent::get_user();
if ($user !== FALSE) {
return $user;
}
if ($fb_uid = FB::get_loggedin_user()) {
$user = Sprig::factory('User', array('fb_uid' => $fb_uid))->load();
if (is_object($user) and $user->loaded()) {
$this->_user = $user;
return $this->_user;
}
}
return FALSE;
}