本文整理汇总了PHP中dropbox::generateAuthUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP dropbox::generateAuthUrl方法的具体用法?PHP dropbox::generateAuthUrl怎么用?PHP dropbox::generateAuthUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dropbox
的用法示例。
在下文中一共展示了dropbox::generateAuthUrl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dropboxConnect
public static function dropboxConnect()
{
require_once DRBBACKUP_BASE_DIR . "/modules/dropbox.class.php";
if (isset($_GET['app_key']) && isset($_GET['app_secret'])) {
if (empty($_GET['app_key']) && empty($_GET['app_secret'])) {
$_GET['app_key'] = WPADM_APP_KEY;
$_GET['app_secret'] = WPADM_APP_SECRET;
}
$dropbox = new dropbox($_GET['app_key'], $_GET['app_secret']);
$_SESSION['dropbox_key'] = $_GET['app_key'];
$_SESSION['dropbox_secret'] = $_GET['app_secret'];
$_SESSION['dropbox_request_token'] = $dropbox->getRequestToken();
echo '<script>window.location.href="' . $dropbox->generateAuthUrl(admin_url('admin-post.php?action=dropboxConnect')) . '";</script>';
} elseif (isset($_GET['oauth_token']) && isset($_GET['uid'])) {
$dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
if ($dropbox_options) {
$dropbox_options = unserialize(base64_decode($dropbox_options));
} else {
$dropbox_options = array();
add_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode(serialize($dropbox_options)));
}
$dropbox = new dropbox(@$_SESSION['dropbox_key'], @$_SESSION['dropbox_secret']);
$access_token = $dropbox->getAccessToken($_SESSION['dropbox_request_token']);
$dropbox_options['app_key'] = @$_SESSION['dropbox_key'];
$dropbox_options['app_secret'] = @$_SESSION['dropbox_secret'];
$dropbox_options['auth_token_secret'] = $access_token;
$dropbox_options['oauth_token'] = @$_GET['oauth_token'];
$dropbox_options['uid'] = @$_GET['uid'];
update_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode(serialize($dropbox_options)));
echo '<script>
if(window.opener){
window.opener.connectDropbox(null, null, "' . htmlspecialchars($access_token['oauth_token_secret']) . '", "' . htmlspecialchars($access_token['oauth_token']) . '", "' . htmlspecialchars($access_token['uid']) . '");window.close();
}else{
window.location.href="' . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox") . '";
}
</script>';
echo '<script>window.close();</script>';
exit;
} elseif (isset($_GET['not_approved'])) {
if ($_GET['not_approved'] == 'true') {
echo '<script>window.close();</script>';
exit;
}
} else {
WPAdm_Core::log(langWPADM::get('Website "%d" returned an error during connection to Dropbox: "app key" and "app secret" wasn\'t found. Please, check your Dropbox settings.', true, '%d', SITE_HOME));
}
exit;
}