本文整理汇总了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"));