本文整理汇总了PHP中Horde_Icalendar::getComponentClasses方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Icalendar::getComponentClasses方法的具体用法?PHP Horde_Icalendar::getComponentClasses怎么用?PHP Horde_Icalendar::getComponentClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Icalendar
的用法示例。
在下文中一共展示了Horde_Icalendar::getComponentClasses方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _renderInline
/**
* Return the rendered inline version of the Horde_Mime_Part object.
*
* @return array See parent::render().
*/
protected function _renderInline()
{
$GLOBALS['page_output']->growler = true;
$data = $this->_mimepart->getContents();
$mime_id = $this->_mimepart->getMimeId();
// Parse the iCal file.
$vCal = new Horde_Icalendar();
if (!$vCal->parsevCalendar($data, 'VCALENDAR', $this->_mimepart->getCharset())) {
$status = new IMP_Mime_Status(_("The calendar data is invalid"));
$status->action(IMP_Mime_Status::ERROR);
return array($mime_id => array('data' => '', 'status' => $status, 'type' => 'text/html; charset=UTF-8'));
}
// Check if we got vcard data with the wrong vcalendar mime type.
$imp_contents = $this->getConfigParam('imp_contents');
$c = $vCal->getComponentClasses();
if (count($c) == 1 && !empty($c['horde_icalendar_vcard'])) {
return $imp_contents->renderMIMEPart($mime_id, IMP_Contents::RENDER_INLINE, array('type' => 'text/x-vcard'));
}
$imple = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_ItipRequest', array('mime_id' => $mime_id, 'muid' => strval($imp_contents->getIndicesOb())));
// Get the method type.
try {
$method = $vCal->getAttribute('METHOD');
} catch (Horde_Icalendar_Exception $e) {
$method = '';
}
$out = array();
$components = $vCal->getComponents();
foreach ($components as $key => $component) {
switch ($component->getType()) {
case 'vEvent':
try {
if ($component->getAttribute('RECURRENCE-ID')) {
break;
}
} catch (Horde_ICalendar_Exception $e) {
}
$out[] = $this->_vEvent($component, $key, $method, $components);
break;
case 'vTodo':
$out[] = $this->_vTodo($component, $key, $method);
break;
case 'vTimeZone':
// Ignore them.
break;
case 'vFreebusy':
$out[] = $this->_vFreebusy($component, $key, $method);
break;
// @todo: handle stray vcards here as well.
// @todo: handle stray vcards here as well.
default:
$out[] = sprintf(_("Unhandled component of type: %s"), $component->getType());
break;
}
}
$view = $this->_getViewOb();
$view->formid = $imple->getDomId();
$view->out = implode('', $out);
return array($mime_id => array('data' => $view->render('base'), 'type' => 'text/html; charset=UTF-8'));
}
示例2: _buildMailMessage
//.........这里部分代码省略.........
$ids = array_keys($imap_message->contentTypeMap());
reset($ids);
$part1_id = next($ids);
$part2_id = Horde_Mime::mimeIdArithmetic($part1_id, 'next');
$lines = explode(chr(13), $imap_message->getBodyPart($part2_id, array('decode' => true)));
switch ($part->getContentTypeParameter('report-type')) {
case 'delivery-status':
foreach ($lines as $line) {
if (strpos(trim($line), 'Action:') === 0) {
switch (trim(substr(trim($line), 7))) {
case 'failed':
$eas_message->messageclass = 'REPORT.IPM.NOTE.NDR';
break 2;
case 'delayed':
$eas_message->messageclass = 'REPORT.IPM.NOTE.DELAYED';
break 2;
case 'delivered':
$eas_message->messageclass = 'REPORT.IPM.NOTE.DR';
break 2;
}
}
}
break;
case 'disposition-notification':
foreach ($lines as $line) {
if (strpos(trim($line), 'Disposition:') === 0) {
if (strpos($line, 'displayed') !== false) {
$eas_message->messageclass = 'REPORT.IPM.NOTE.IPNRN';
} elseif (strpos($line, 'deleted') !== false) {
$eas_message->messageclass = 'REPORT.IPM.NOTE.IPNNRN';
}
break;
}
}
}
}
$part = null;
// Check for meeting requests and POOMMAIL_FLAG data
if ($version >= Horde_ActiveSync::VERSION_TWELVE) {
$eas_message->contentclass = 'urn:content-classes:message';
if ($mime_part = $imap_message->hasiCalendar()) {
$data = Horde_ActiveSync_Utils::ensureUtf8($mime_part->getContents(), $mime_part->getCharset());
$vCal = new Horde_Icalendar();
if ($vCal->parsevCalendar($data, 'VCALENDAR', $mime_part->getCharset())) {
$classes = $vCal->getComponentClasses();
} else {
$classes = array();
}
if (!empty($classes['horde_icalendar_vevent'])) {
try {
$method = $vCal->getAttribute('METHOD');
$eas_message->contentclass = 'urn:content-classes:calendarmessage';
} catch (Horde_Icalendar_Exception $e) {
}
switch ($method) {
case 'REQUEST':
case 'PUBLISH':
$eas_message->messageclass = 'IPM.Schedule.Meeting.Request';
$mtg = Horde_ActiveSync::messageFactory('MeetingRequest');
$mtg->fromvEvent($vCal);
$eas_message->meetingrequest = $mtg;
break;
case 'REPLY':
try {
$reply_status = $this->_getiTipStatus($vCal);
switch ($reply_status) {
case 'ACCEPTED':
$eas_message->messageclass = 'IPM.Schedule.Meeting.Resp.Pos';
break;
case 'DECLINED':
$eas_message->messageclass = 'IPM.Schedule.Meeting.Resp.Neg';
break;
case 'TENTATIVE':
$eas_message->messageclass = 'IPM.Schedule.Meeting.Resp.Tent';
}
$mtg = Horde_ActiveSync::messageFactory('MeetingRequest');
$mtg->fromvEvent($vCal);
$eas_message->meetingrequest = $mtg;
} catch (Horde_ActiveSync_Exception $e) {
$this->_logger->err($e->getMessage());
}
}
}
}
if ($imap_message->getFlag(Horde_Imap_Client::FLAG_FLAGGED)) {
$poommail_flag = Horde_ActiveSync::messageFactory('Flag');
$poommail_flag->subject = $imap_message->getSubject();
$poommail_flag->flagstatus = Horde_ActiveSync_Message_Flag::FLAG_STATUS_ACTIVE;
$poommail_flag->flagtype = Horde_Imap_Client::FLAG_FLAGGED;
$eas_message->flag = $poommail_flag;
}
}
if ($version >= Horde_ActiveSync::VERSION_FOURTEEN) {
$eas_message->messageid = $imap_message->getHeaders()->getValue('Message-ID');
$eas_message->forwarded = $imap_message->getFlag(Horde_Imap_Client::FLAG_FORWARDED);
$eas_message->answered = $imap_message->getFlag(Horde_Imap_Client::FLAG_ANSWERED);
}
$imap_message = null;
return $eas_message;
}