当前位置: 首页>>代码示例>>PHP>>正文


PHP dropbox::getAccessToken方法代码示例

本文整理汇总了PHP中dropbox::getAccessToken方法的典型用法代码示例。如果您正苦于以下问题:PHP dropbox::getAccessToken方法的具体用法?PHP dropbox::getAccessToken怎么用?PHP dropbox::getAccessToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dropbox的用法示例。


在下文中一共展示了dropbox::getAccessToken方法的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;
 }
开发者ID:derwegas,项目名称:strubbelkinder,代码行数:48,代码来源:wpadm-class-wp.php


注:本文中的dropbox::getAccessToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。