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


PHP dropbox::share方法代码示例

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


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

示例1: getContentUrl

 /**
  * Return content URL
  *
  * @param string $hash file hash
  * @param array $options options
  * @return array
  * @author Naoki Sawada
  **/
 public function getContentUrl($hash, $options = array())
 {
     if (($file = $this->file($hash)) == false || !$file['url'] || $file['url'] == 1) {
         $path = $this->decode($hash);
         $cache = $this->getDBdat($path);
         $url = '';
         if (isset($cache['share'])) {
             $res = $this->getHttpResponseHeader($cache['share']);
             if (preg_match("/^HTTP\\/[01\\.]+ ([0-9]{3})/", $res, $match)) {
                 if (preg_match('/^location:\\s*(http[^\\s]+)/im', $res, $match)) {
                     $url = $match[1];
                 } else {
                     if ($match[1] >= 400) {
                         $url = '';
                     }
                 }
             } else {
                 $url = '';
             }
         }
         if (!$url) {
             try {
                 $res = $this->dropbox->share($path);
                 $res = $this->getHttpResponseHeader($res['url']);
                 if (preg_match('/^location:\\s*(http[^\\s]+)/im', $res, $match)) {
                     $url = $match[1] . '?dl=1';
                 }
                 if ($url) {
                     if (!isset($cache['share']) || $cache['share'] !== $url) {
                         $cache['share'] = $url;
                         $this->updateDBdat($path, $cache);
                     }
                     $res = $this->getHttpResponseHeader($url);
                     if (preg_match('/^location:\\s*(http[^\\s?]+)/im', $res, $match)) {
                         $url = $match[1];
                     }
                 }
             } catch (Dropbox_Exception $e) {
                 return false;
             }
         }
         if ($url) {
             list($url) = explode('?', $url);
         }
         return $url;
     }
     return $file['url'];
 }
开发者ID:hen-sen,项目名称:ElFinderPHP,代码行数:56,代码来源:ElFinderVolumeDropbox.php

示例2: getContentUrl

 /**
 * Return content URL
 *
 * @param string $hash file hash
 * @param array $options options
 * @return array
 * @author Naoki Sawada
 **/
 public function getContentUrl($hash, $options = array())
 {
     if (($file = $this->file($hash)) == false || !$file['url'] || $file['url'] == 1) {
         $path = $this->decode($hash);
         $cache =& $this->metaCacheArr['data'][strtolower($path)];
         $url = '';
         if (isset($cache['share'])) {
             $res = $this->getHttpResponseHeader($cache['share']);
             if (preg_match("/^HTTP\\/[01\\.]+ ([0-9]{3})/", $res, $match)) {
                 if (preg_match('/^location:\\s*(http[^\\s]+)/im', $res, $match)) {
                     $url = $match[1];
                 } else {
                     if ($match[1] >= 400) {
                         $url = '';
                     }
                 }
             } else {
                 $url = '';
             }
         }
         if (!$url) {
             try {
                 $res = $this->dropbox->share($path);
                 $res = $this->getHttpResponseHeader($res['url']);
                 if (preg_match('/^location:\\s*(http[^\\s]+)/im', $res, $match)) {
                     $url = $match[1] . '?dl=1';
                 }
                 if ($url) {
                     $cache['share'] = $url;
                     $this->mataCacheSave();
                     $res = $this->getHttpResponseHeader($url);
                     if (preg_match('/^location:\\s*(http[^\\s]+)/im', $res, $match)) {
                         $url = $match[1];
                     }
                 }
             } catch (Dropbox_Exception $e) {
                 return false;
             }
         }
         return $url;
     }
     return $file['url'];
 }
开发者ID:basdog22,项目名称:Qool,代码行数:51,代码来源:elFinderVolumeDropbox.class.php

示例3: getContentUrl

 /**
  * Return content URL
  *
  * @param string  $hash  file hash
  * @param array $options options
  * @return array
  * @author Naoki Sawada
  **/
 public function getContentUrl($hash, $options = array())
 {
     if (($file = $this->file($hash)) == false || !$file['url'] || $file['url'] == 1) {
         $path = $this->decode($hash);
         $cache = $this->getDBdat($path);
         $url = '';
         if (isset($cache['share']) && strpos($cache['share'], $this->dropbox_dlhost) !== false) {
             $res = $this->getHttpResponseHeader($cache['share']);
             if (preg_match("/^HTTP\\/[01\\.]+ ([0-9]{3})/", $res, $match)) {
                 if ($match[1] < 400) {
                     $url = $cache['share'];
                 }
             }
         }
         if (!$url) {
             try {
                 $res = $this->dropbox->share($path, null, false);
                 $url = $res['url'];
                 if (strpos($url, 'www.dropbox.com') === false) {
                     $res = $this->getHttpResponseHeader($url);
                     if (preg_match('/^location:\\s*(http[^\\s]+)/im', $res, $match)) {
                         $url = $match[1];
                     }
                 }
                 list($url) = explode('?', $url);
                 $url = str_replace('www.dropbox.com', $this->dropbox_dlhost, $url);
                 if (!isset($cache['share']) || $cache['share'] !== $url) {
                     $cache['share'] = $url;
                     $this->updateDBdat($path, $cache);
                 }
             } catch (Dropbox_Exception $e) {
                 return false;
             }
         }
         return $url;
     }
     return $file['url'];
 }
开发者ID:studio-42,项目名称:elfinder,代码行数:46,代码来源:elFinderVolumeDropbox.class.php

示例4: share

 public function share($path)
 {
     return $this->dropbox->share($path);
 }
开发者ID:mmayorivera,项目名称:elfinder-l4,代码行数:4,代码来源:elFinderVolumeDropbox.class.php


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