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


PHP dropbox::getAccountInfo方法代码示例

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


在下文中一共展示了dropbox::getAccountInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * Prepare FTP connection
  * Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn
  *
  * @return bool
  * @author Dmitry (dio) Levashov
  * @author Cem (DiscoFever)
  **/
 protected function init()
 {
     if (!class_exists('PDO', false)) {
         return $this->setError('PHP PDO class is require.');
     }
     if (!$this->options['consumerKey'] || !$this->options['consumerSecret'] || !$this->options['accessToken'] || !$this->options['accessTokenSecret']) {
         return $this->setError('Required options undefined.');
     }
     if (empty($this->options['metaCachePath']) && defined('ELFINDER_DROPBOX_META_CACHE_PATH')) {
         $this->options['metaCachePath'] = ELFINDER_DROPBOX_META_CACHE_PATH;
     }
     // make net mount key
     $this->netMountKey = md5(join('-', array('dropbox', $this->options['path'])));
     if (!$this->oauth) {
         if (defined('ELFINDER_DROPBOX_USE_CURL_PUT')) {
             $this->oauth = new Dropbox_OAuth_Curl($this->options['consumerKey'], $this->options['consumerSecret']);
         } else {
             if (class_exists('OAuth', false)) {
                 $this->oauth = new Dropbox_OAuth_PHP($this->options['consumerKey'], $this->options['consumerSecret']);
             } else {
                 if (!class_exists('HTTP_OAuth_Consumer')) {
                     // We're going to try to load in manually
                     include 'HTTP/OAuth/Consumer.php';
                 }
                 if (class_exists('HTTP_OAuth_Consumer', false)) {
                     $this->oauth = new Dropbox_OAuth_PEAR($this->options['consumerKey'], $this->options['consumerSecret']);
                 }
             }
         }
     }
     if (!$this->oauth) {
         return $this->setError('OAuth extension not loaded.');
     }
     // normalize root path
     $this->root = $this->options['path'] = $this->_normpath($this->options['path']);
     if (empty($this->options['alias'])) {
         $this->options['alias'] = $this->options['path'] === '/' ? 'Dropbox.com' : 'Dropbox' . $this->options['path'];
     }
     $this->rootName = $this->options['alias'];
     try {
         $this->oauth->setToken($this->options['accessToken'], $this->options['accessTokenSecret']);
         $this->dropbox = new Dropbox_API($this->oauth, $this->options['root']);
     } catch (Dropbox_Exception $e) {
         $this->session->remove('DropboxTokens');
         return $this->setError('Dropbox error: ' . $e->getMessage());
     }
     // user
     if (empty($this->options['dropboxUid'])) {
         try {
             $res = $this->dropbox->getAccountInfo();
             $this->options['dropboxUid'] = $res['uid'];
         } catch (Dropbox_Exception $e) {
             $this->session->remove('DropboxTokens');
             return $this->setError('Dropbox error: ' . $e->getMessage());
         }
     }
     $this->dropboxUid = $this->options['dropboxUid'];
     $this->tmbPrefix = 'dropbox' . base_convert($this->dropboxUid, 10, 32);
     if (!empty($this->options['tmpPath'])) {
         if ((is_dir($this->options['tmpPath']) || mkdir($this->options['tmpPath'])) && is_writable($this->options['tmpPath'])) {
             $this->tmp = $this->options['tmpPath'];
         }
     }
     if (!$this->tmp && is_writable($this->options['tmbPath'])) {
         $this->tmp = $this->options['tmbPath'];
     }
     if (!$this->tmp && ($tmp = elFinder::getStaticVar('commonTempPath'))) {
         $this->tmp = $tmp;
     }
     if (!empty($this->options['metaCachePath'])) {
         if ((is_dir($this->options['metaCachePath']) || mkdir($this->options['metaCachePath'])) && is_writable($this->options['metaCachePath'])) {
             $this->metaCache = $this->options['metaCachePath'];
         }
     }
     if (!$this->metaCache && $this->tmp) {
         $this->metaCache = $this->tmp;
     }
     if (!$this->metaCache) {
         return $this->setError('Cache dirctory (metaCachePath or tmp) is require.');
     }
     // setup PDO
     if (!$this->options['PDO_DSN']) {
         $this->options['PDO_DSN'] = 'sqlite:' . $this->metaCache . DIRECTORY_SEPARATOR . '.elFinder_dropbox_db_' . md5($this->dropboxUid . $this->options['consumerSecret']);
     }
     // DataBase table name
     $this->DB_TableName = $this->options['PDO_DBName'];
     // DataBase check or make table
     try {
         $this->DB = new PDO($this->options['PDO_DSN'], $this->options['PDO_User'], $this->options['PDO_Pass'], $this->options['PDO_Options']);
         if (!$this->checkDB()) {
             return $this->setError('Can not make DB table');
         }
//.........这里部分代码省略.........
开发者ID:studio-42,项目名称:elfinder,代码行数:101,代码来源:elFinderVolumeDropbox.class.php

示例2: init

 /**
 * Prepare FTP connection
 * Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn
 *
 * @return bool
 * @author Dmitry (dio) Levashov
 * @author Cem (DiscoFever)
 **/
 protected function init()
 {
     $this->netmountPrepare($this->options);
     if (!$this->options['consumerKey'] || !$this->options['consumerSecret'] || !$this->options['accessToken'] || !$this->options['accessTokenSecret']) {
         return $this->setError('Required options undefined.');
     }
     // make net mount key
     $this->netMountKey = md5(join('-', array('dropbox', $this->options['path'])));
     if (!$this->oauth) {
         if (class_exists('OAuth')) {
             $this->oauth = new Dropbox_OAuth_PHP($this->options['consumerKey'], $this->options['consumerSecret']);
         } else {
             if (!class_exists('HTTP_OAuth_Consumer')) {
                 // We're going to try to load in manually
                 include 'HTTP/OAuth/Consumer.php';
             }
             if (class_exists('HTTP_OAuth_Consumer')) {
                 $this->oauth = new Dropbox_OAuth_PEAR($this->options['consumerKey'], $this->options['consumerSecret']);
             }
         }
     }
     if (!$this->oauth) {
         return $this->setError('OAuth extension not loaded.');
     }
     // normalize root path
     $this->root = $this->options['path'] = $this->_normpath($this->options['path']);
     if (empty($this->options['alias'])) {
         $this->options['alias'] = $this->options['path'] === '/' ? 'Dropbox.com' : 'Dropbox' . $this->options['path'];
     }
     $this->rootName = $this->options['alias'];
     $this->options['separator'] = '/';
     try {
         $this->oauth->setToken($this->options['accessToken'], $this->options['accessTokenSecret']);
         $this->dropbox = new Dropbox_API($this->oauth, $this->options['root']);
     } catch (Dropbox_Exception $e) {
         unset($_SESSION['elFinderDropboxTokens']);
         return $this->setError('Dropbox error: ' . $e->getMessage());
     }
     // user
     if (empty($this->options['dropboxUid'])) {
         try {
             $res = $this->dropbox->getAccountInfo();
             $this->options['dropboxUid'] = $res['uid'];
         } catch (Dropbox_Exception $e) {
             unset($_SESSION['elFinderDropboxTokens']);
             return $this->setError('Dropbox error: ' . $e->getMessage());
         }
     }
     $this->dropboxUid = $this->options['dropboxUid'];
     if (!empty($this->options['tmpPath'])) {
         if ((is_dir($this->options['tmpPath']) || @mkdir($this->options['tmpPath'])) && is_writable($this->options['tmpPath'])) {
             $this->tmp = $this->options['tmpPath'];
         }
     }
     if (!$this->tmp && is_writable($this->options['tmbPath'])) {
         $this->tmp = $this->options['tmbPath'];
     }
     if (!empty($this->options['metaCachePath'])) {
         if ((is_dir($this->options['metaCachePath']) || @mkdir($this->options['metaCachePath'])) && is_writable($this->options['metaCachePath'])) {
             $this->metaCache = $this->options['metaCachePath'];
         }
     }
     if (!$this->metaCache && $this->tmp) {
         $this->metaCache = $this->tmp;
     }
     if (!$this->tmp) {
         $this->disabled[] = 'archive';
         $this->disabled[] = 'extract';
     }
     if (!$this->metaCache) {
         return $this->setError('Cache dirctory (metaCachePath or tmp) is require.');
     }
     $this->metaCacheFile = $this->metaCache . DIRECTORY_SEPARATOR . '.elFinder_dropbox_metaCache_' . md5($this->dropboxUid . $this->options['consumerSecret']);
     $this->metaCacheGet(!empty($_REQUEST['init']));
     return true;
 }
开发者ID:basdog22,项目名称:Qool,代码行数:84,代码来源:elFinderVolumeDropbox.class.php

示例3: init

 /**
  * Prepare FTP connection
  * Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn
  *
  * @return bool
  * @author Dmitry (dio) Levashov
  * @author Cem (DiscoFever)
  **/
 protected function init()
 {
     if (!$this->options['consumerKey'] || !$this->options['consumerSecret'] || !$this->options['accessToken'] || !$this->options['accessTokenSecret']) {
         return $this->setError('Required options undefined.');
     }
     if (empty($this->options['metaCachePath']) && defined('ELFINDER_DROPBOX_META_CACHE_PATH')) {
         $this->options['metaCachePath'] = ELFINDER_DROPBOX_META_CACHE_PATH;
     }
     // make net mount key
     $this->netMountKey = md5(join('-', array('dropbox', $this->options['path'])));
     if (!$this->oauth) {
         if (class_exists('OAuth')) {
             $this->oauth = new Dropbox_OAuth_PHP($this->options['consumerKey'], $this->options['consumerSecret']);
         } else {
             if (!class_exists('HTTP_OAuth_Consumer')) {
                 // We're going to try to load in manually
                 include 'HTTP/OAuth/Consumer.php';
             }
             if (class_exists('HTTP_OAuth_Consumer')) {
                 $this->oauth = new Dropbox_OAuth_PEAR($this->options['consumerKey'], $this->options['consumerSecret']);
             }
         }
     }
     if (!$this->oauth) {
         return $this->setError('OAuth extension not loaded.');
     }
     // normalize root path
     $this->root = $this->options['path'] = $this->_normpath($this->options['path']);
     if (empty($this->options['alias'])) {
         $this->options['alias'] = $this->options['path'] === '/' ? 'Dropbox.com' : 'Dropbox' . $this->options['path'];
     }
     $this->rootName = $this->options['alias'];
     $this->options['separator'] = '/';
     try {
         $this->oauth->setToken($this->options['accessToken'], $this->options['accessTokenSecret']);
         $this->dropbox = new Dropbox_API($this->oauth, $this->options['root']);
     } catch (Dropbox_Exception $e) {
         unset($_SESSION['elFinderDropboxTokens']);
         return $this->setError('Dropbox error: ' . $e->getMessage());
     }
     // user
     if (empty($this->options['dropboxUid'])) {
         try {
             $res = $this->dropbox->getAccountInfo();
             $this->options['dropboxUid'] = $res['uid'];
         } catch (Dropbox_Exception $e) {
             unset($_SESSION['elFinderDropboxTokens']);
             return $this->setError('Dropbox error: ' . $e->getMessage());
         }
     }
     $this->dropboxUid = $this->options['dropboxUid'];
     $this->tmbPrefix = 'dropbox' . base_convert($this->dropboxUid, 10, 32);
     if (!empty($this->options['tmpPath'])) {
         if ((is_dir($this->options['tmpPath']) || @mkdir($this->options['tmpPath'])) && is_writable($this->options['tmpPath'])) {
             $this->tmp = $this->options['tmpPath'];
         }
     }
     if (!$this->tmp && is_writable($this->options['tmbPath'])) {
         $this->tmp = $this->options['tmbPath'];
     }
     if (!empty($this->options['metaCachePath'])) {
         if ((is_dir($this->options['metaCachePath']) || @mkdir($this->options['metaCachePath'])) && is_writable($this->options['metaCachePath'])) {
             $this->metaCache = $this->options['metaCachePath'];
         }
     }
     if (!$this->metaCache && $this->tmp) {
         $this->metaCache = $this->tmp;
     }
     if (!$this->tmp) {
         $this->disabled[] = 'archive';
         $this->disabled[] = 'extract';
     }
     if (!$this->metaCache) {
         return $this->setError('Cache dirctory (metaCachePath or tmp) is require.');
     }
     // setup PDO
     if (!$this->options['PDO_DSN']) {
         $this->options['PDO_DSN'] = 'sqlite:' . $this->metaCache . DIRECTORY_SEPARATOR . '.elFinder_dropbox_db_' . md5($this->dropboxUid . $this->options['consumerSecret']);
     }
     // DataBase table name
     $this->DB_TableName = $this->options['PDO_DBName'];
     // DataBase check or make table
     if ($this->DB = new PDO($this->options['PDO_DSN'], $this->options['PDO_User'], $this->options['PDO_Pass'], $this->options['PDO_Options'])) {
         if (!$this->checkDB()) {
             return $this->setError('Can not make DB table');
         }
     } else {
         return $this->setError('Could not use PDO');
     }
     $res = $this->deltaCheck(!empty($_REQUEST['init']));
     if ($res !== true) {
         if (is_string($res)) {
//.........这里部分代码省略.........
开发者ID:maddoger,项目名称:yii2-elfinder,代码行数:101,代码来源:elFinderVolumeDropbox.class.php


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