本文整理匯總了PHP中Facebook::IsATValid方法的典型用法代碼示例。如果您正苦於以下問題:PHP Facebook::IsATValid方法的具體用法?PHP Facebook::IsATValid怎麽用?PHP Facebook::IsATValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Facebook
的用法示例。
在下文中一共展示了Facebook::IsATValid方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: trim
<p class='alerttext'>JavaScript MUST be enabled in order for you to use kingposter. However, it seems JavaScript is either disabled or not supported by your browser. If your browser supports JavaScript, Please enable JavaScript by changing your browser options, then try again.</p></div>
</noscript>
<div class='alerts'></div>
<?php
if (isset($_POST['submit'])) {
$accessToken = trim($_POST['accessToken']);
if (empty($accessToken)) {
echo "<script> alertBox('" . lang('ENTER_ACCESS_TOKEN') . "','danger');</script>";
} else {
$user = new User();
$fb = new Facebook();
$fb_account = new FbAccount();
$app_id = "145634995501895";
try {
if ($fb_account->UserDefaultFbAccount()) {
if ($fb->IsATValid($accessToken)) {
if ($fb->GetAccessToken($app_id)) {
$fb->UpdateAccessToken($user->data()->id, $app_id, $fb_account->UserDefaultFbAccount(), $accessToken);
} else {
$fb->SaveAccessToken($user->data()->id, $app_id, $fb_account->UserDefaultFbAccount(), $accessToken);
}
echo "<script>window.opener.location.href;window.close();</script>";
} else {
throw new Exception(lang('INVALID_ACCESS_TOKEN'));
}
} else {
throw new Exception(lang('NO_FB_ACCOUNT_SELECTED'));
}
} catch (Exception $e) {
echo "<script> alertBox('" . $e->getMessage() . "','danger');</script>";
}
示例2: Facebook
<?php
require "../core/init.php";
// Add new facebook account using access token
if (Input::Get("fb_accesstoken")) {
$fb = new Facebook();
$user = new User();
$fbaccount = new fbaccount();
// Test access token
if (!$fb->IsATValid(Input::Get("fb_accesstoken"))) {
echo lang('INVALID_ACCESS_TOKEN');
exit;
}
// get facebook User info
$userData = $fb->GetUserFromAccessToken(Input::Get("fb_accesstoken"));
if ($userData == null) {
echo lang("UNABLE_TO_GET_FB_ACCOUNT_DETAILS");
exit;
}
// Get user groups
$fbgroups = $fb->LoadFbGroups(Input::Get("fb_accesstoken"));
if (!$fbgroups) {
echo lang("UNABLE_GET_FB_GROUPS");
exit;
}
// Save access token
if ($fbAppDetails = $fb->AppDetailsFromAt(Input::Get("fb_accesstoken"))) {
if ($fb->GetAccessToken($fbAppDetails->id, $userData->id)) {
$fb->UpdateAccessToken($user->data()->id, $fbAppDetails->id, $userData->id, Input::Get("fb_accesstoken"));
} else {
$fb->SaveAccessToken($user->data()->id, $fbAppDetails->id, $userData->id, Input::Get("fb_accesstoken"));