本文整理汇总了PHP中api_Utils::IsGDImageMimeTypeSuppoted方法的典型用法代码示例。如果您正苦于以下问题:PHP api_Utils::IsGDImageMimeTypeSuppoted方法的具体用法?PHP api_Utils::IsGDImageMimeTypeSuppoted怎么用?PHP api_Utils::IsGDImageMimeTypeSuppoted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api_Utils
的用法示例。
在下文中一共展示了api_Utils::IsGDImageMimeTypeSuppoted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: responseObject
//.........这里部分代码省略.........
$mResult['Safety'] = $mResponse->getSafety();
$mResult['HasExternals'] = $bHasExternals;
$mResult['FoundedCIDs'] = $aFoundedCIDs;
$mResult['FoundedContentLocationUrls'] = $aFoundedContentLocationUrls;
$mResult['Attachments'] = $this->responseObject($oAccount, $oAttachments, $sParent, array_merge($aParameters, array('FoundedCIDs' => $aFoundedCIDs, 'FoundedContentLocationUrls' => $aFoundedContentLocationUrls)));
// $mResult['Html'] = \MailSo\Base\Utils::Utf8Clear($mResult['Html']);
// $mResult['Plain'] = \MailSo\Base\Utils::Utf8Clear($mResult['Plain']);
} else {
$mResult['@Object'] = 'Object/MessageListItem';
$mResult['Threads'] = $mResponse->getThreads();
}
$mResult['Custom'] = $this->responseObject($oAccount, $mResponse->getCustomList(), $sParent, $aParameters);
$mResult['Subject'] = \MailSo\Base\Utils::Utf8Clear($mResult['Subject']);
} else {
if ('CApiMailIcs' === $sClassName) {
$mResult = array_merge($this->objectWrapper($oAccount, $mResponse, $sParent, $aParameters), array('Uid' => $mResponse->Uid, 'Sequence' => $mResponse->Sequence, 'Attendee' => $mResponse->Attendee, 'File' => $mResponse->File, 'Type' => $mResponse->Type, 'Location' => $mResponse->Location, 'Description' => \MailSo\Base\LinkFinder::NewInstance()->Text($mResponse->Description)->UseDefaultWrappers(true)->CompileText(), 'When' => $mResponse->When, 'CalendarId' => $mResponse->CalendarId));
} else {
if ('CApiMailVcard' === $sClassName) {
$mResult = array_merge($this->objectWrapper($oAccount, $mResponse, $sParent, $aParameters), array('Uid' => $mResponse->Uid, 'File' => $mResponse->File, 'Name' => $mResponse->Name, 'Email' => $mResponse->Email, 'Exists' => $mResponse->Exists));
} else {
if ('CFilter' === $sClassName) {
$mResult = array_merge($this->objectWrapper($oAccount, $mResponse, $sParent, $aParameters), array('Enable' => $mResponse->Enable, 'Field' => $mResponse->Field, 'Filter' => $mResponse->Filter, 'Condition' => $mResponse->Condition, 'Action' => $mResponse->Action, 'FolderFullName' => $mResponse->FolderFullName));
} else {
if ('CHelpdeskThread' === $sClassName) {
$mResult = array_merge($this->objectWrapper($oAccount, $mResponse, $sParent, $aParameters), array('IdHelpdeskThread' => $mResponse->IdHelpdeskThread, 'ThreadHash' => $mResponse->StrHelpdeskThreadHash, 'IdOwner' => $mResponse->IdOwner, 'Owner' => $mResponse->Owner, 'Type' => $mResponse->Type, 'Subject' => $mResponse->Subject, 'IsRead' => $mResponse->IsRead, 'IsArchived' => $mResponse->IsArchived, 'ItsMe' => $mResponse->ItsMe, 'HasAttachments' => $mResponse->HasAttachments, 'PostCount' => $mResponse->PostCount, 'Created' => $mResponse->Created, 'Updated' => $mResponse->Updated));
} else {
if ('CHelpdeskPost' === $sClassName) {
$mResult = array_merge($this->objectWrapper($oAccount, $mResponse, $sParent, $aParameters), array('IdHelpdeskPost' => $mResponse->IdHelpdeskPost, 'IdHelpdeskThread' => $mResponse->IdHelpdeskThread, 'IdOwner' => $mResponse->IdOwner, 'Owner' => $mResponse->Owner, 'Attachments' => $this->responseObject($oAccount, $mResponse->Attachments, $sParent), 'IsThreadOwner' => $mResponse->IsThreadOwner, 'ItsMe' => $mResponse->ItsMe, 'Type' => $mResponse->Type, 'SystemType' => $mResponse->SystemType, 'Text' => \MailSo\Base\HtmlUtils::ConvertPlainToHtml($mResponse->Text), 'Created' => $mResponse->Created));
} else {
if ('CHelpdeskAttachment' === $sClassName) {
$iThumbnailLimit = 1024 * 1024 * 2;
// 2MB
/* @var $mResponse CHelpdeskAttachment */
$mResult = array_merge($this->objectWrapper($oAccount, $mResponse, $sParent, $aParameters), array('IdHelpdeskAttachment' => $mResponse->IdHelpdeskAttachment, 'IdHelpdeskPost' => $mResponse->IdHelpdeskPost, 'IdHelpdeskThread' => $mResponse->IdHelpdeskThread, 'SizeInBytes' => $mResponse->SizeInBytes, 'FileName' => $mResponse->FileName, 'MimeType' => \MailSo\Base\Utils::MimeContentType($mResponse->FileName), 'Thumb' => \CApi::GetConf('labs.allow-thumbnail', true) && $mResponse->SizeInBytes < $iThumbnailLimit && \api_Utils::IsGDImageMimeTypeSuppoted(\MailSo\Base\Utils::MimeContentType($mResponse->FileName), $mResponse->FileName), 'Hash' => $mResponse->Hash, 'Content' => $mResponse->Content, 'Created' => $mResponse->Created));
} else {
if ('CFetcher' === $sClassName) {
/* @var $mResponse \CFetcher */
$mResult = array_merge($this->objectWrapper($oAccount, $mResponse, $sParent, $aParameters), array('IdFetcher' => $mResponse->IdFetcher, 'IdAccount' => $mResponse->IdAccount, 'IsEnabled' => $mResponse->IsEnabled, 'IsLocked' => $mResponse->IsLocked, 'Folder' => $mResponse->Folder, 'Name' => $mResponse->Name, 'Email' => $mResponse->Email, 'Signature' => $mResponse->Signature, 'SignatureOptions' => $mResponse->SignatureOptions, 'LeaveMessagesOnServer' => $mResponse->LeaveMessagesOnServer, 'IncomingMailServer' => $mResponse->IncomingMailServer, 'IncomingMailPort' => $mResponse->IncomingMailPort, 'IncomingMailLogin' => $mResponse->IncomingMailLogin, 'IsOutgoingEnabled' => $mResponse->IsOutgoingEnabled, 'OutgoingMailServer' => $mResponse->OutgoingMailServer, 'OutgoingMailPort' => $mResponse->OutgoingMailPort, 'OutgoingMailAuth' => $mResponse->OutgoingMailAuth, 'IncomingMailSsl' => $mResponse->IncomingMailSecurity === \MailSo\Net\Enumerations\ConnectionSecurityType::SSL, 'OutgoingMailSsl' => $mResponse->OutgoingMailSecurity === \MailSo\Net\Enumerations\ConnectionSecurityType::SSL));
} else {
if ('CApiMailFolder' === $sClassName) {
$aExtended = null;
$mStatus = $mResponse->getStatus();
if (is_array($mStatus) && isset($mStatus['MESSAGES'], $mStatus['UNSEEN'], $mStatus['UIDNEXT'])) {
$aExtended = array('MessageCount' => (int) $mStatus['MESSAGES'], 'MessageUnseenCount' => (int) $mStatus['UNSEEN'], 'UidNext' => (string) $mStatus['UIDNEXT'], 'Hash' => \api_Utils::GenerateFolderHash($mResponse->getRawFullName(), $mStatus['MESSAGES'], $mStatus['UNSEEN'], $mStatus['UIDNEXT']));
}
$mResult = array_merge($this->objectWrapper($oAccount, $mResponse, $sParent, $aParameters), array('Type' => $mResponse->getType(), 'Name' => $mResponse->getName(), 'FullName' => $mResponse->getFullName(), 'FullNameRaw' => $mResponse->getRawFullName(), 'FullNameHash' => md5($mResponse->getRawFullName()), 'Delimiter' => $mResponse->getDelimiter(), 'IsSubscribed' => $oAccount->isExtensionEnabled(\CAccount::IgnoreSubscribeStatus) ? true : $mResponse->isSubscribed(), 'IsSelectable' => $mResponse->isSelectable(), 'Exists' => $mResponse->exists(), 'Extended' => $aExtended, 'SubFolders' => $this->responseObject($oAccount, $mResponse->getSubFolders(), $sParent, $aParameters)));
} else {
if ('CApiMailAttachment' === $sClassName) {
$mFoundedCIDs = isset($aParameters['FoundedCIDs']) && is_array($aParameters['FoundedCIDs']) ? $aParameters['FoundedCIDs'] : null;
$mFoundedContentLocationUrls = isset($aParameters['FoundedContentLocationUrls']) && \is_array($aParameters['FoundedContentLocationUrls']) && 0 < \count($aParameters['FoundedContentLocationUrls']) ? $aParameters['FoundedContentLocationUrls'] : null;
if ($mFoundedCIDs || $mFoundedContentLocationUrls) {
$aFoundedCIDs = \array_merge($mFoundedCIDs ? $mFoundedCIDs : array(), $mFoundedContentLocationUrls ? $mFoundedContentLocationUrls : array());
$aFoundedCIDs = 0 < \count($mFoundedCIDs) ? $mFoundedCIDs : null;
}
$sMimeType = strtolower(trim($mResponse->getMimeType()));
$sMimeIndex = strtolower(trim($mResponse->getMimeIndex()));
$sContentTransferEncoding = strtolower(trim($mResponse->getEncoding()));
$sFileName = $mResponse->getFileName(true);
$iEstimatedSize = $mResponse->getEstimatedSize();
$iThumbnailLimit = 1024 * 1024 * 2;
// 2MB //TODO
if (in_array($sMimeType, array('application/octet-stream'))) {
$sMimeType = \MailSo\Base\Utils::MimeContentType($sFileName);
}
$sCid = \trim(\trim($mResponse->getCid()), '<>');
$mResult = array_merge($this->objectWrapper($oAccount, $mResponse, $sParent, $aParameters), array('FileName' => $sFileName, 'MimeType' => $sMimeType, 'MimePartIndex' => 'message/rfc822' === $sMimeType && ('base64' === $sContentTransferEncoding || 'quoted-printable' === $sContentTransferEncoding) ? '' : $sMimeIndex, 'EstimatedSize' => $iEstimatedSize, 'CID' => $sCid, 'ContentLocation' => $mResponse->getContentLocation(), 'Thumb' => \CApi::GetConf('labs.allow-thumbnail', true) && $iEstimatedSize < $iThumbnailLimit && \api_Utils::IsGDImageMimeTypeSuppoted($sMimeType, $sFileName), 'Expand' => \CApi::isExpandMimeTypeSupported($sMimeType, $sFileName), 'Iframed' => \CApi::isIframedMimeTypeSupported($sMimeType, $sFileName), 'Content' => $mResponse->getContent(), 'IsInline' => $mResponse->isInline(), 'IsLinked' => !empty($sCid) && $mFoundedCIDs && \in_array($sCid, $mFoundedCIDs) || $mFoundedContentLocationUrls && \in_array(\trim($mResponse->getContentLocation()), $mFoundedContentLocationUrls)));
示例2: AjaxFileExpand
/**
* @return array
*/
public function AjaxFileExpand()
{
$self = $this;
$mResult = false;
$oAccount = null;
$sHash = \md5(\microtime(true) . \rand(1000, 9999));
$this->rawCallback((string) $this->getParamValue('RawKey', ''), function ($oAccount, $sContentType, $sFileName, $rResource) use($self, $sHash, &$mResult) {
if ($self->ApiFileCache()->putFile($oAccount, $sHash, $rResource)) {
$sFullFilePath = $self->ApiFileCache()->generateFullFilePath($oAccount, $sHash);
$aExpand = array();
\CApi::Plugin()->RunHook('webmail.expand-attachment', array($oAccount, $sContentType, $sFileName, $sFullFilePath, &$aExpand, $self->ApiFileCache()));
if (is_array($aExpand) && 0 < \count($aExpand)) {
foreach ($aExpand as $aItem) {
if ($aItem && isset($aItem['FileName'], $aItem['MimeType'], $aItem['Size'], $aItem['TempName'])) {
$mResult[] = array('FileName' => $aItem['FileName'], 'MimeType' => $aItem['MimeType'], 'EstimatedSize' => $aItem['Size'], 'CID' => '', 'Thumb' => \CApi::GetConf('labs.allow-thumbnail', true) && \api_Utils::IsGDImageMimeTypeSuppoted($aItem['MimeType'], $aItem['FileName']), 'Expand' => \CApi::isExpandMimeTypeSupported($aItem['MimeType'], $aItem['FileName']), 'Iframed' => \CApi::isIframedMimeTypeSupported($aItem['MimeType'], $aItem['FileName']), 'IsInline' => false, 'IsLinked' => false, 'Hash' => \CApi::EncodeKeyValues(array('TempFile' => true, 'Iframed' => \CApi::isIframedMimeTypeSupported($aItem['MimeType'], $aItem['FileName']), 'AccountID' => $oAccount->IdAccount, 'Name' => $aItem['FileName'], 'TempName' => $aItem['TempName'])));
}
}
}
$self->ApiFileCache()->clear($oAccount, $sHash);
}
}, false, $oAccount);
return $this->DefaultResponse($oAccount, __FUNCTION__, $mResult);
}
示例3: GetFiles
public function GetFiles($oAccount, $sType = \EFileStorageTypeStr::Personal, $sPath = '', $sPattern = '')
{
$oDirectory = null;
$aItems = array();
$aResult = array();
$oMin = $this->GetMinManager();
if ($oAccount && $this->Init($oAccount)) {
$oTenant = null;
$oApiTenants = \CApi::Manager('tenants');
if ($oApiTenants) {
$oTenant = 0 < $oAccount->IdTenant ? $oApiTenants->GetTenantById($oAccount->IdTenant) : $oApiTenants->GetDefaultGlobalTenant();
}
$sRootPath = $this->getRootPath($oAccount, $sType, true);
$oDirectory = $this->getDirectory($oAccount, $sType, $sPath);
if ($oDirectory !== null) {
if (!empty($sPattern) || is_numeric($sPattern)) {
$aItems = $oDirectory->Search($sPattern);
$aDirectoryInfo = $oDirectory->getChildrenProperties();
foreach ($aDirectoryInfo as $oDirectoryInfo) {
if (isset($oDirectoryInfo['Link']) && strpos($oDirectoryInfo['Name'], $sPattern) !== false) {
$aItems[] = new \afterlogic\DAV\FS\File($oDirectory->getPath() . '/' . $oDirectoryInfo['@Name']);
}
}
} else {
$aItems = $oDirectory->getChildren();
}
$iThumbnailLimit = 1024 * 1024 * 2;
// 2MB
foreach ($aItems as $oValue) {
$sFilePath = str_replace($sRootPath, '', dirname($oValue->getPath()));
$aProps = $oValue->getProperties(array('Owner', 'Shared', 'Name', 'Link', 'LinkType'));
$oItem = new \CFileStorageItem();
$oItem->Type = $sType;
$oItem->TypeStr = $sType;
$oItem->Path = $sFilePath;
$oItem->Name = $oValue->getName();
$oItem->Id = $oValue->getName();
$oItem->FullPath = $oItem->Name !== '' ? $oItem->Path . '/' . $oItem->Name : $oItem->Path;
$sID = '';
if ($oValue instanceof \afterlogic\DAV\FS\Directory) {
$sID = $this->GenerateShareHash($oAccount, $sType, $sFilePath, $oValue->getName());
$oItem->IsFolder = true;
}
if ($oValue instanceof \afterlogic\DAV\FS\File) {
$sID = $this->GenerateShareHash($oAccount, $sType, $sFilePath, $oValue->getName());
$oItem->IsFolder = false;
$oItem->Size = $oValue->getSize();
$oFileInfo = null;
if (isset($aProps['Link'])) {
$oItem->IsLink = true;
$iLinkType = api_Utils::GetLinkType($aProps['Link']);
$oItem->LinkType = $iLinkType;
$oItem->LinkUrl = $aProps['Link'];
if (isset($iLinkType) && $oTenant) {
if (\EFileStorageLinkType::GoogleDrive === $iLinkType) {
$oSocial = $oTenant->GetSocialByName('google');
if ($oSocial) {
$oFileInfo = \api_Utils::GetGoogleDriveFileInfo($aProps['Link'], $oSocial->SocialApiKey);
if ($oFileInfo) {
$oItem->Name = isset($oFileInfo->title) ? $oFileInfo->title : $oItem->Name;
$oItem->Size = isset($oFileInfo->fileSize) ? $oFileInfo->fileSize : $oItem->Size;
}
}
} else {
if (\EFileStorageLinkType::DropBox === $iLinkType) {
$aProps['Link'] = str_replace('www.dropbox.com', 'dl.dropboxusercontent.com', $aProps['Link']);
}
$oItem->Name = isset($aProps['Name']) ? $aProps['Name'] : basename($aProps['Link']);
$aRemoteFileInfo = \api_Utils::GetRemoteFileInfo($aProps['Link']);
$oItem->Size = $aRemoteFileInfo['size'];
}
}
} else {
$oItem->IsLink = false;
}
$oItem->LastModified = $oValue->getLastModified();
$oItem->ContentType = $oValue->getContentType();
if (!$oItem->ContentType) {
$oItem->ContentType = \api_Utils::MimeContentType($oItem->Name);
}
if (\CApi::GetConf('labs.allow-thumbnail', true)) {
if ($oItem->IsLink && $oItem->LinkType === \EFileStorageLinkType::GoogleDrive && isset($oFileInfo) && isset($oFileInfo->thumbnailLink)) {
$oItem->Thumb = true;
$oItem->ThumbnailLink = $oFileInfo->thumbnailLink;
} else {
$oItem->Thumb = $oItem->Size < $iThumbnailLimit && \api_Utils::IsGDImageMimeTypeSuppoted($oItem->ContentType, $oItem->Name);
}
}
$oItem->Iframed = !$oItem->IsFolder && !$oItem->IsLink && \CApi::isIframedMimeTypeSupported($oItem->ContentType, $oItem->Name);
$oItem->Hash = \CApi::EncodeKeyValues(array('Type' => $sType, 'Path' => $sFilePath, 'Name' => $oValue->getName(), 'FileName' => $oValue->getName(), 'MimeType' => $oItem->ContentType, 'Size' => $oValue->getSize(), 'Iframed' => $oItem->Iframed));
}
$mMin = $oMin->GetMinByID($sID);
$oItem->Shared = isset($aProps['Shared']) ? $aProps['Shared'] : empty($mMin['__hash__']) ? false : true;
$oItem->Owner = isset($aProps['Owner']) ? $aProps['Owner'] : $oAccount->Email;
if ($oItem && '.asc' === \strtolower(\substr(\trim($oItem->Name), -4))) {
$mResult = $this->GetFile($oAccount, $oItem->Type, $oItem->Path, $oItem->Name);
if (is_resource($mResult)) {
$oItem->Content = stream_get_contents($mResult);
}
}
//.........这里部分代码省略.........