本文整理汇总了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'];
}
示例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'];
}
示例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'];
}
示例4: share
public function share($path)
{
return $this->dropbox->share($path);
}