Esempio n. 1
0
 /**
  * Changes every property passed as an associative array (key will be
  * uppercased) on given component. DTSTART, DTEND and
  * DURATION are ignored, use make_start and make_end instead
  *
  * @param iCalComponent $component
  * @param array $properties
  */
 function change_properties($component, $properties)
 {
     $properties = array_change_key_case($properties, CASE_UPPER);
     foreach ($properties as $p => $v) {
         if ($p == 'DTSTART' || $p == 'DTEND' || $p == 'DURATION') {
             continue;
         }
         // TODO: multivalued properties?
         // TRANSP
         if ($p == 'TRANSP') {
             if ($v != 'OPAQUE' && $v != 'TRANSPARENT') {
                 log_message('ERROR', 'Invalid TRANSP value (' . $v . ').  Ignoring.');
                 continue;
             }
         }
         $component->deleteProperty($p);
         if (!empty($v)) {
             $component->setProperty($p, $v);
         }
     }
     return $component;
 }