本文整理汇总了PHP中api_Utils::GetLinkType方法的典型用法代码示例。如果您正苦于以下问题:PHP api_Utils::GetLinkType方法的具体用法?PHP api_Utils::GetLinkType怎么用?PHP api_Utils::GetLinkType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api_Utils
的用法示例。
在下文中一共展示了api_Utils::GetLinkType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateLink
public function CreateLink($oAccount, $sType, $sPath, $sLink, $sName)
{
$iLinkType = \api_Utils::GetLinkType($sLink);
if ($this->Init($oAccount)) {
$oDirectory = $this->getDirectory($oAccount, $sType, $sPath);
if ($oDirectory !== null) {
$sFileName = \Sabre\VObject\UUIDUtil::getUUID();
$oDirectory->createFile($sFileName);
$oItem = $oDirectory->getChild($sFileName);
$oItem->updateProperties(array('Owner' => $oAccount->Email, 'Name' => $sName, 'Link' => $sLink, 'LinkType' => $iLinkType));
return true;
}
}
return false;
}
示例2: rawFiles
/**
* @return bool
*/
private function rawFiles($bDownload = true, $bThumbnail = false)
{
$sRawKey = (string) $this->getParamValue('RawKey', '');
$aValues = \CApi::DecodeKeyValues($sRawKey);
if ($bThumbnail) {
$this->verifyCacheByKey($sRawKey);
}
$sHash = (string) $this->getParamValue('TenantHash', '');
$oMin = \CApi::Manager('min');
$mMin = $oMin->getMinByHash($sHash);
$oAccount = null;
if (!empty($mMin['__hash__'])) {
$oAccount = $this->oApiUsers->getAccountById($mMin['Account']);
} else {
if (isset($aValues['Iframed'], $aValues['Time']) && $aValues['Iframed'] && $aValues['Time']) {
$oAccount = $this->getAccountFromParam(true, !($aValues['Time'] > \ProjectCore\Base\Utils::iframedTimestamp()));
if (!$oAccount->IsDefaultAccount) {
$iAccountId = $this->oApiUsers->getDefaultAccountId($oAccount->IdUser);
if (0 < $iAccountId) {
$oAccount = $this->oApiUsers->getAccountById($iAccountId);
} else {
throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::AuthError);
}
}
} else {
$oAccount = $this->getDefaultAccountFromParam();
}
}
$oTenant = null;
if ($oAccount && $this->oApiTenants) {
$oTenant = 0 < $oAccount->IdTenant ? $this->oApiTenants->getTenantById($oAccount->IdTenant) : $this->oApiTenants->getDefaultGlobalTenant();
}
if ($this->oApiCapability->isFilesSupported($oAccount) && $oTenant && isset($aValues['Type'], $aValues['Path'], $aValues['Name'])) {
$mResult = false;
$sFileName = $aValues['Name'];
$sContentType = empty($sFileName) ? 'text/plain' : \MailSo\Base\Utils::MimeContentType($sFileName);
$oFileInfo = $this->oApiFilestorage->getFileInfo($oAccount, $aValues['Type'], $aValues['Path'], $aValues['Name']);
if ($oFileInfo->IsLink) {
$iLinkType = \api_Utils::GetLinkType($oFileInfo->LinkUrl);
if (isset($iLinkType)) {
if (\EFileStorageLinkType::GoogleDrive === $iLinkType) {
$oSocial = $oTenant->getSocialByName('google');
if ($oSocial) {
$oInfo = \api_Utils::GetGoogleDriveFileInfo($oFileInfo->LinkUrl, $oSocial->SocialApiKey);
$sFileName = isset($oInfo->title) ? $oInfo->title : $sFileName;
$sContentType = \MailSo\Base\Utils::MimeContentType($sFileName);
if (isset($oInfo->downloadUrl)) {
$mResult = \MailSo\Base\ResourceRegistry::CreateMemoryResource();
$this->oHttp->SaveUrlToFile($oInfo->downloadUrl, $mResult);
rewind($mResult);
}
}
} else {
if (\EFileStorageLinkType::DropBox === $iLinkType) {
$oFileInfo->LinkUrl = str_replace('www.dropbox.com', 'dl.dropboxusercontent.com', $oFileInfo->LinkUrl);
}
$mResult = \MailSo\Base\ResourceRegistry::CreateMemoryResource();
$sFileName = basename($oFileInfo->LinkUrl);
$sContentType = \MailSo\Base\Utils::MimeContentType($sFileName);
$this->oHttp->SaveUrlToFile($oFileInfo->LinkUrl, $mResult);
rewind($mResult);
}
}
} else {
$mResult = $this->oApiFilestorage->getFile($oAccount, $aValues['Type'], $aValues['Path'], $aValues['Name']);
}
if (false !== $mResult) {
if (is_resource($mResult)) {
$sFileName = $this->clearFileName($oFileInfo->Name, $sContentType);
$sContentType = \MailSo\Base\Utils::MimeContentType($sFileName);
$this->RawOutputHeaders($bDownload, $sContentType, $sFileName);
if ($bThumbnail) {
$this->cacheByKey($sRawKey);
$this->thumbResource($oAccount, $mResult, $sFileName);
} else {
\MailSo\Base\Utils::FpassthruWithTimeLimitReset($mResult);
}
@fclose($mResult);
}
return true;
}
}
return false;
}
示例3: createLink
/**
* @param CAccount $oAccount
* @param string $sType
* @param string $sPath
* @param string $sLink
* @param string $sName
*
* @return bool
*/
public function createLink($oAccount, $sType, $sPath, $sLink, $sName)
{
$iLinkType = \api_Utils::GetLinkType($sLink);
if ($this->init($oAccount)) {
$oDirectory = $this->getDirectory($oAccount, $sType, $sPath);
if ($oDirectory !== null) {
$sFileName = $sName . '.url';
$oDirectory->createFile($sFileName, "[InternetShortcut]\r\nURL=\"" . $sLink . "\"\r\n");
$oItem = $oDirectory->getChild($sFileName);
$oItem->updateProperties(array('Owner' => $oAccount->Email));
return true;
}
}
return false;
}