本文整理匯總了PHP中MailSo\Base\Utils::ClearXss方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utils::ClearXss方法的具體用法?PHP Utils::ClearXss怎麽用?PHP Utils::ClearXss使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MailSo\Base\Utils
的用法示例。
在下文中一共展示了Utils::ClearXss方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: responseObject
/**
* @param mixed $mResponse
* @param string $sParent
* @param array $aParameters = array()
*
* @return mixed
*/
protected function responseObject($mResponse, $sParent = '', $aParameters = array())
{
$mResult = $mResponse;
if (\is_object($mResponse)) {
$bHook = true;
$self = $this;
$sClassName = \get_class($mResponse);
$bHasSimpleJsonFunc = \method_exists($mResponse, 'ToSimpleJSON');
$bThumb = $this->GetCapa(false, \RainLoop\Enumerations\Capa::ATTACHMENT_THUMBNAILS);
$oAccountCache = null;
$fGetAccount = function () use($self, &$oAccountCache) {
if (null === $oAccountCache) {
$oAccount = $self->getAccountFromToken(false);
$oAccountCache = $oAccount;
}
return $oAccountCache;
};
$aCheckableFoldersCache = null;
$fGetCheckableFolder = function () use($self, &$aCheckableFoldersCache) {
if (null === $aCheckableFoldersCache) {
$oAccount = $self->getAccountFromToken(false);
$oSettingsLocal = $self->SettingsProvider(true)->Load($oAccount);
$sCheckable = $oSettingsLocal->GetConf('CheckableFolder', '[]');
$aCheckable = @\json_decode($sCheckable);
if (!\is_array($aCheckable)) {
$aCheckable = array();
}
$aCheckableFoldersCache = $aCheckable;
}
return $aCheckableFoldersCache;
};
if ($bHasSimpleJsonFunc) {
$mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), $mResponse->ToSimpleJSON(true));
} else {
if ('MailSo\\Mail\\Message' === $sClassName) {
$oAccount = \call_user_func($fGetAccount);
$iDateTimeStampInUTC = $mResponse->InternalTimeStampInUTC();
if (0 === $iDateTimeStampInUTC || !!$this->Config()->Get('labs', 'date_from_headers', false)) {
$iDateTimeStampInUTC = $mResponse->HeaderTimeStampInUTC();
if (0 === $iDateTimeStampInUTC) {
$iDateTimeStampInUTC = $mResponse->InternalTimeStampInUTC();
}
}
$mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Folder' => $mResponse->Folder(), 'Uid' => (string) $mResponse->Uid(), 'Subject' => \trim(\MailSo\Base\Utils::Utf8Clear($mResponse->Subject())), 'MessageId' => $mResponse->MessageId(), 'Size' => $mResponse->Size(), 'DateTimeStampInUTC' => $iDateTimeStampInUTC, 'ReplyTo' => $this->responseObject($mResponse->ReplyTo(), $sParent, $aParameters), 'From' => $this->responseObject($mResponse->From(), $sParent, $aParameters), 'To' => $this->responseObject($mResponse->To(), $sParent, $aParameters), 'Cc' => $this->responseObject($mResponse->Cc(), $sParent, $aParameters), 'Bcc' => $this->responseObject($mResponse->Bcc(), $sParent, $aParameters), 'Sender' => $this->responseObject($mResponse->Sender(), $sParent, $aParameters), 'DeliveredTo' => $this->responseObject($mResponse->DeliveredTo(), $sParent, $aParameters), 'Priority' => $mResponse->Priority(), 'Threads' => $mResponse->Threads(), 'Sensitivity' => $mResponse->Sensitivity(), 'ExternalProxy' => false, 'ReadReceipt' => ''));
$mResult['SubjectParts'] = $this->explodeSubject($mResult['Subject']);
$oAttachments = $mResponse->Attachments();
$iAttachmentsCount = $oAttachments ? $oAttachments->Count() : 0;
$mResult['HasAttachments'] = 0 < $iAttachmentsCount;
$mResult['AttachmentsSpecData'] = $mResult['HasAttachments'] ? $oAttachments->SpecData() : array();
$sSubject = $mResult['Subject'];
$mResult['Hash'] = \md5($mResult['Folder'] . $mResult['Uid']);
$mResult['RequestHash'] = \RainLoop\Utils::EncodeKeyValuesQ(array('V' => APP_VERSION, 'Account' => $oAccount ? \md5($oAccount->Hash()) : '', 'Folder' => $mResult['Folder'], 'Uid' => $mResult['Uid'], 'MimeType' => 'message/rfc822', 'FileName' => (0 === \strlen($sSubject) ? 'message-' . $mResult['Uid'] : \MailSo\Base\Utils::ClearXss($sSubject)) . '.eml'));
// Flags
$aFlags = $mResponse->FlagsLowerCase();
$mResult['IsSeen'] = \in_array('\\seen', $aFlags);
$mResult['IsFlagged'] = \in_array('\\flagged', $aFlags);
$mResult['IsAnswered'] = \in_array('\\answered', $aFlags);
$mResult['IsDeleted'] = \in_array('\\deleted', $aFlags);
$sForwardedFlag = $this->Config()->Get('labs', 'imap_forwarded_flag', '');
$sReadReceiptFlag = $this->Config()->Get('labs', 'imap_read_receipt_flag', '');
$mResult['IsForwarded'] = 0 < \strlen($sForwardedFlag) && \in_array(\strtolower($sForwardedFlag), $aFlags);
$mResult['IsReadReceipt'] = 0 < \strlen($sReadReceiptFlag) && \in_array(\strtolower($sReadReceiptFlag), $aFlags);
if (!$this->GetCapa(false, \RainLoop\Enumerations\Capa::COMPOSER, $oAccount)) {
$mResult['IsReadReceipt'] = true;
}
$mResult['TextPartIsTrimmed'] = false;
if ('Message' === $sParent) {
$oAttachments = $mResponse->Attachments();
$bHasExternals = false;
$mFoundedCIDs = array();
$aContentLocationUrls = array();
$mFoundedContentLocationUrls = array();
if ($oAttachments && 0 < $oAttachments->Count()) {
$aList =& $oAttachments->GetAsArray();
foreach ($aList as $oAttachment) {
if ($oAttachment) {
$sContentLocation = $oAttachment->ContentLocation();
if ($sContentLocation && 0 < \strlen($sContentLocation)) {
$aContentLocationUrls[] = $oAttachment->ContentLocation();
}
}
}
}
$sPlain = '';
$sHtml = \trim($mResponse->Html());
if (0 === \strlen($sHtml)) {
$sPlain = \trim($mResponse->Plain());
}
$mResult['DraftInfo'] = $mResponse->DraftInfo();
$mResult['InReplyTo'] = $mResponse->InReplyTo();
$mResult['References'] = $mResponse->References();
$fAdditionalDomReader = null;
if (0 < \strlen($sHtml) && $this->Config()->Get('labs', 'emogrifier', false)) {
//.........這裏部分代碼省略.........
示例2: responseObject
/**
* @param mixed $mResponse
* @param string $sParent
* @param array $aParameters = array()
*
* @return mixed
*/
protected function responseObject($mResponse, $sParent = '', $aParameters = array())
{
$mResult = $mResponse;
if (\is_object($mResponse)) {
$bHook = true;
$sClassName = \get_class($mResponse);
$bHasSimpleJsonFunc = \method_exists($mResponse, 'ToSimpleJSON');
$bThumb = $this->GetCapa(false, \RainLoop\Enumerations\Capa::ATTACHMENT_THUMBNAILS);
if ($bHasSimpleJsonFunc) {
$mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), $mResponse->ToSimpleJSON(true));
} else {
if ('MailSo\\Mail\\Message' === $sClassName) {
$oAccount = $this->getAccountFromToken(false);
$mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Folder' => $mResponse->Folder(), 'Uid' => (string) $mResponse->Uid(), 'Subject' => \trim(\MailSo\Base\Utils::Utf8Clear($mResponse->Subject())), 'MessageId' => $mResponse->MessageId(), 'Size' => $mResponse->Size(), 'DateTimeStampInUTC' => !!$this->Config()->Get('labs', 'date_from_headers', false) ? $mResponse->HeaderTimeStampInUTC() : $mResponse->InternalTimeStampInUTC(), 'ReplyTo' => $this->responseObject($mResponse->ReplyTo(), $sParent, $aParameters), 'From' => $this->responseObject($mResponse->From(), $sParent, $aParameters), 'To' => $this->responseObject($mResponse->To(), $sParent, $aParameters), 'Cc' => $this->responseObject($mResponse->Cc(), $sParent, $aParameters), 'Bcc' => $this->responseObject($mResponse->Bcc(), $sParent, $aParameters), 'Sender' => $this->responseObject($mResponse->Sender(), $sParent, $aParameters), 'DeliveredTo' => $this->responseObject($mResponse->DeliveredTo(), $sParent, $aParameters), 'Priority' => $mResponse->Priority(), 'Threads' => $mResponse->Threads(), 'ThreadsLen' => $mResponse->ThreadsLen(), 'ParentThread' => $mResponse->ParentThread(), 'Sensitivity' => $mResponse->Sensitivity(), 'ExternalProxy' => false, 'ReadReceipt' => ''));
$mResult['SubjectParts'] = $this->explodeSubject($mResult['Subject']);
$oAttachments = $mResponse->Attachments();
$iAttachmentsCount = $oAttachments ? $oAttachments->Count() : 0;
$mResult['HasAttachments'] = 0 < $iAttachmentsCount;
$mResult['AttachmentsMainType'] = '';
if (0 < $iAttachmentsCount) {
switch (true) {
case $iAttachmentsCount === $oAttachments->ImageCount():
$mResult['AttachmentsMainType'] = 'image';
break;
case $iAttachmentsCount === $oAttachments->ArchiveCount():
$mResult['AttachmentsMainType'] = 'archive';
break;
case $iAttachmentsCount === $oAttachments->PdfCount():
$mResult['AttachmentsMainType'] = 'pdf';
break;
case $iAttachmentsCount === $oAttachments->DocCount():
$mResult['AttachmentsMainType'] = 'doc';
break;
case $iAttachmentsCount === $oAttachments->CertificateCount():
$mResult['AttachmentsMainType'] = 'certificate';
break;
}
}
$sSubject = $mResult['Subject'];
$mResult['Hash'] = \md5($mResult['Folder'] . $mResult['Uid']);
$mResult['RequestHash'] = \RainLoop\Utils::EncodeKeyValues(array('V' => APP_VERSION, 'Account' => $oAccount ? \md5($oAccount->Hash()) : '', 'Folder' => $mResult['Folder'], 'Uid' => $mResult['Uid'], 'MimeType' => 'message/rfc822', 'FileName' => (0 === \strlen($sSubject) ? 'message-' . $mResult['Uid'] : \MailSo\Base\Utils::ClearXss($sSubject)) . '.eml'));
// Flags
$aFlags = $mResponse->FlagsLowerCase();
$mResult['IsSeen'] = \in_array('\\seen', $aFlags);
$mResult['IsFlagged'] = \in_array('\\flagged', $aFlags);
$mResult['IsAnswered'] = \in_array('\\answered', $aFlags);
$mResult['IsDeleted'] = \in_array('\\deleted', $aFlags);
$sForwardedFlag = $this->Config()->Get('labs', 'imap_forwarded_flag', '');
$sReadReceiptFlag = $this->Config()->Get('labs', 'imap_read_receipt_flag', '');
$mResult['IsForwarded'] = 0 < \strlen($sForwardedFlag) && \in_array(\strtolower($sForwardedFlag), $aFlags);
$mResult['IsReadReceipt'] = 0 < \strlen($sReadReceiptFlag) && \in_array(\strtolower($sReadReceiptFlag), $aFlags);
$mResult['TextPartIsTrimmed'] = false;
if ('Message' === $sParent) {
$oAttachments = $mResponse->Attachments();
$bHasExternals = false;
$mFoundedCIDs = array();
$aContentLocationUrls = array();
$mFoundedContentLocationUrls = array();
if ($oAttachments && 0 < $oAttachments->Count()) {
$aList =& $oAttachments->GetAsArray();
foreach ($aList as $oAttachment) {
if ($oAttachment) {
$sContentLocation = $oAttachment->ContentLocation();
if ($sContentLocation && 0 < \strlen($sContentLocation)) {
$aContentLocationUrls[] = $oAttachment->ContentLocation();
}
}
}
}
$sPlain = '';
$sHtml = \trim($mResponse->Html());
if (0 === \strlen($sHtml)) {
$sPlain = \trim($mResponse->Plain());
}
$mResult['DraftInfo'] = $mResponse->DraftInfo();
$mResult['InReplyTo'] = $mResponse->InReplyTo();
$mResult['References'] = $mResponse->References();
$fAdditionalExternalFilter = null;
if (!!$this->Config()->Get('labs', 'use_local_proxy_for_external_images', false)) {
$fAdditionalExternalFilter = function ($sUrl) {
return './?/ProxyExternal/' . \RainLoop\Utils::EncodeKeyValues(array('Rnd' => \md5(\microtime(true)), 'Token' => \RainLoop\Utils::GetConnectionToken(), 'Url' => $sUrl)) . '/';
};
}
$mResult['Html'] = 0 === \strlen($sHtml) ? '' : \MailSo\Base\HtmlUtils::ClearHtml($sHtml, $bHasExternals, $mFoundedCIDs, $aContentLocationUrls, $mFoundedContentLocationUrls, false, false, $fAdditionalExternalFilter);
$mResult['ExternalProxy'] = null !== $fAdditionalExternalFilter;
$mResult['Plain'] = $sPlain;
// $mResult['Plain'] = 0 === \strlen($sPlain) ? '' : \MailSo\Base\HtmlUtils::ConvertPlainToHtml($sPlain);
$mResult['TextHash'] = \md5($mResult['Html'] . $mResult['Plain']);
$mResult['TextPartIsTrimmed'] = $mResponse->TextPartIsTrimmed();
$mResult['PgpSigned'] = $mResponse->PgpSigned();
$mResult['PgpEncrypted'] = $mResponse->PgpEncrypted();
$mResult['PgpSignature'] = $mResponse->PgpSignature();
unset($sHtml, $sPlain);
//.........這裏部分代碼省略.........