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


PHP api_Utils::GetLinkType方法代码示例

本文整理汇总了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;
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:15,代码来源:storage.php

示例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;
 }
开发者ID:nsine,项目名称:webmail-lite,代码行数:87,代码来源:Actions.php

示例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;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:24,代码来源:storage.php


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