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


PHP Component::serialize方法代码示例

本文整理汇总了PHP中Sabre\VObject\Component::serialize方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::serialize方法的具体用法?PHP Component::serialize怎么用?PHP Component::serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sabre\VObject\Component的用法示例。


在下文中一共展示了Component::serialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendMessage

 /**
  * Sends one or more iTip messages through email.
  *
  * @param string $originator Originator Email
  * @param array $recipients Array of email addresses
  * @param VObject\Component $vObject
  * @param string $principal Principal Url of the originator
  * @return void
  */
 public function sendMessage($originator, array $recipients, VObject\Component $vObject, $principal)
 {
     foreach ($recipients as $recipient) {
         $to = $recipient;
         $replyTo = $originator;
         $subject = 'SabreDAV iTIP message';
         switch (strtoupper($vObject->METHOD)) {
             case 'REPLY':
                 $subject = 'Response for: ' . $vObject->VEVENT->SUMMARY;
                 break;
             case 'REQUEST':
                 $subject = 'Invitation for: ' . $vObject->VEVENT->SUMMARY;
                 break;
             case 'CANCEL':
                 $subject = 'Cancelled event: ' . $vObject->VEVENT->SUMMARY;
                 break;
         }
         $headers = array();
         $headers[] = 'Reply-To: ' . $replyTo;
         $headers[] = 'From: ' . $this->senderEmail;
         $headers[] = 'Content-Type: text/calendar; method=' . (string) $vObject->method . '; charset=utf-8';
         if (DAV\Server::$exposeVersion) {
             $headers[] = 'X-Sabre-Version: ' . DAV\Version::VERSION . '-' . DAV\Version::STABILITY;
         }
         $vcalBody = $vObject->serialize();
         $this->mail($to, $subject, $vcalBody, $headers);
     }
 }
开发者ID:GTAWWEKID,项目名称:tsiserver.us,代码行数:37,代码来源:IMip.php

示例2: generateICS

 /**
  * Merges all calendar objects, and builds one big ics export
  *
  * @param array $nodes
  * @return string
  */
 public function generateICS(array $nodes)
 {
     $calendar = new VObject\Component('vcalendar');
     $calendar->version = '2.0';
     if (Sabre_DAV_Server::$exposeVersion) {
         $calendar->prodid = '-//SabreDAV//SabreDAV ' . Sabre_DAV_Version::VERSION . '//EN';
     } else {
         $calendar->prodid = '-//SabreDAV//SabreDAV//EN';
     }
     $calendar->calscale = 'GREGORIAN';
     $collectedTimezones = array();
     $timezones = array();
     $objects = array();
     foreach ($nodes as $node) {
         if (!isset($node[200]['{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}calendar-data'])) {
             continue;
         }
         $nodeData = $node[200]['{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}calendar-data'];
         $nodeComp = VObject\Reader::read($nodeData);
         foreach ($nodeComp->children() as $child) {
             switch ($child->name) {
                 case 'VEVENT':
                 case 'VTODO':
                 case 'VJOURNAL':
                     $objects[] = $child;
                     break;
                     // VTIMEZONE is special, because we need to filter out the duplicates
                 // VTIMEZONE is special, because we need to filter out the duplicates
                 case 'VTIMEZONE':
                     // Naively just checking tzid.
                     if (in_array((string) $child->TZID, $collectedTimezones)) {
                         continue;
                     }
                     $timezones[] = $child;
                     $collectedTimezones[] = $child->TZID;
                     break;
             }
         }
     }
     foreach ($timezones as $tz) {
         $calendar->add($tz);
     }
     foreach ($objects as $obj) {
         $calendar->add($obj);
     }
     return $calendar->serialize();
 }
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:53,代码来源:ICSExportPlugin.php

示例3: repair

 /**
  * Repairs a VObject file
  *
  * @param Component $vObj
  * @return int
  */
 protected function repair($vObj)
 {
     $returnCode = 0;
     switch ($vObj->name) {
         case 'VCALENDAR':
             $this->log("iCalendar: " . (string) $vObj->VERSION);
             break;
         case 'VCARD':
             $this->log("vCard: " . (string) $vObj->VERSION);
             break;
     }
     $warnings = $vObj->validate(Node::REPAIR);
     if (!count($warnings)) {
         $this->log("  No warnings!");
     } else {
         $levels = [1 => 'REPAIRED', 2 => 'WARNING', 3 => 'ERROR'];
         $returnCode = 2;
         foreach ($warnings as $warn) {
             $extra = '';
             if ($warn['node'] instanceof Property) {
                 $extra = ' (property: "' . $warn['node']->name . '")';
             }
             $this->log("  [" . $levels[$warn['level']] . '] ' . $warn['message'] . $extra);
         }
     }
     fwrite($this->stdout, $vObj->serialize());
     return $returnCode;
 }
开发者ID:mirabilos,项目名称:sabre-vobject,代码行数:34,代码来源:Cli.php

示例4: repair

 /**
  * Repairs a VObject file
  *
  * @param Component $vObj
  * @return int
  */
 protected function repair($vObj)
 {
     $returnCode = 0;
     switch ($vObj->name) {
         case 'VCALENDAR':
             $this->log("iCalendar: " . (string) $vObj->VERSION);
             break;
         case 'VCARD':
             $this->log("vCard: " . (string) $vObj->VERSION);
             break;
     }
     $warnings = $vObj->validate(Node::REPAIR);
     if (!count($warnings)) {
         $this->log("  No warnings!");
     } else {
         foreach ($warnings as $warn) {
             $returnCode = 2;
             $this->log("  " . $warn['message']);
         }
     }
     fwrite($this->stdout, $vObj->serialize());
     return $returnCode;
 }
开发者ID:hiaio-platform-medical,项目名称:rainloop-webmail,代码行数:29,代码来源:Cli.php

示例5: write

 /**
  * Serializes a vCard or iCalendar object.
  *
  * @param Component $component
  *
  * @return string
  */
 static function write(Component $component)
 {
     return $component->serialize();
 }
开发者ID:ddolbik,项目名称:sabre-vobject,代码行数:11,代码来源:Writer.php


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