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


PHP Component::children方法代码示例

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


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

示例1: convertVCard30toVCard21

 /**
  * Converts a vcalendar 1.0 component to an icalendar 2.0 component.
  * 
  * @param Sabre_VObject_Component $vobject 
  */
 public static function convertVCard30toVCard21(Sabre\VObject\Component $vobject)
 {
     $qpProperies = array('NOTE', 'FN', 'N');
     if ($vobject->version == '3.0') {
         //vcard 3.0 uses EMAIL;TYPE=INTERNET,HOME:mschering@intermesh.nl
         //We must convert that into EMAIL;INTERNET;HOME:mschering@intermesh.nl for 2.1
         $children = $vobject->children();
         foreach ($children as $property) {
             if (!empty($property['TYPE'])) {
                 $types = explode(',', $property['TYPE']);
                 $property->name .= ';' . implode(';', $types);
                 unset($property['TYPE']);
             }
         }
         $vobject->version = '2.1';
         foreach ($qpProperies as $propName) {
             self::_quotedPrintableEncode($vobject, $propName);
         }
     }
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:25,代码来源:Reader.php

示例2: serializeComponent

 protected function serializeComponent(Component $vObj)
 {
     $this->cWrite('cyan', 'BEGIN');
     $this->cWrite('red', ':');
     $this->cWrite('yellow', $vObj->name . "\n");
     /**
      * Gives a component a 'score' for sorting purposes.
      *
      * This is solely used by the childrenSort method.
      *
      * A higher score means the item will be lower in the list.
      * To avoid score collisions, each "score category" has a reasonable
      * space to accomodate elements. The $key is added to the $score to
      * preserve the original relative order of elements.
      *
      * @param int $key
      * @param array $array
      *
      * @return int
      */
     $sortScore = function ($key, $array) {
         if ($array[$key] instanceof Component) {
             // We want to encode VTIMEZONE first, this is a personal
             // preference.
             if ($array[$key]->name === 'VTIMEZONE') {
                 $score = 300000000;
                 return $score + $key;
             } else {
                 $score = 400000000;
                 return $score + $key;
             }
         } else {
             // Properties get encoded first
             // VCARD version 4.0 wants the VERSION property to appear first
             if ($array[$key] instanceof Property) {
                 if ($array[$key]->name === 'VERSION') {
                     $score = 100000000;
                     return $score + $key;
                 } else {
                     // All other properties
                     $score = 200000000;
                     return $score + $key;
                 }
             }
         }
     };
     $children = $vObj->children();
     $tmp = $children;
     uksort($children, function ($a, $b) use($sortScore, $tmp) {
         $sA = $sortScore($a, $tmp);
         $sB = $sortScore($b, $tmp);
         return $sA - $sB;
     });
     foreach ($children as $child) {
         if ($child instanceof Component) {
             $this->serializeComponent($child);
         } else {
             $this->serializeProperty($child);
         }
     }
     $this->cWrite('cyan', 'END');
     $this->cWrite('red', ':');
     $this->cWrite('yellow', $vObj->name . "\n");
 }
开发者ID:linagora,项目名称:sabre-vobject,代码行数:64,代码来源:Cli.php

示例3: removeXOCAttrFromComponent

 /**
  * remove certain X-OC-* properties from a Sabre Component
  * @param Component &$component
  */
 public static function removeXOCAttrFromComponent(Component &$component)
 {
     foreach ($component->children() as $child) {
         if ($child instanceof Component) {
             self::removeXOCAttrFromComponent($child);
         } elseif (substr($child->name, 0, 5) === 'X-OC-') {
             switch ($child->name) {
                 case 'X-OC-ETAG':
                 case 'X-OC-URI':
                     unset($component->{$child->name});
                     break;
                 default:
                     break;
             }
         }
     }
 }
开发者ID:amin-hedayati,项目名称:calendar-rework,代码行数:21,代码来源:sabreutility.php


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