예제 #1
0
 /**
  * check index and set (an indexed) content in multiple value array
  *
  * @author Kjell-Inge Gustafsson, kigkonsult <*****@*****.**>
  * @since 2.6.12 - 2011-01-03
  * @param array $valArr
  * @param mixed $value
  * @param array $params
  * @param array $defaults
  * @param int $index
  * @return void
  */
 public static function _setMval(&$valArr, $value, $params = FALSE, $defaults = FALSE, $index = FALSE)
 {
     if (!is_array($valArr)) {
         $valArr = array();
     }
     if ($index) {
         $index = $index - 1;
     } elseif (0 < count($valArr)) {
         $keys = array_keys($valArr);
         $index = end($keys) + 1;
     } else {
         $index = 0;
     }
     $valArr[$index] = array('value' => $value, 'params' => iCalUtilityFunctions::_setParams($params, $defaults));
     ksort($valArr);
 }
 /**
  * set calendar component property url
  *
  * @author Kjell-Inge Gustafsson, kigkonsult <*****@*****.**>
  * @since 2.16.21 - 2013-06-23
  * @param string  $value
  * @param array   $params
  * @uses calendarComponent::getConfig()
  * @uses calendarComponent::$url
  * @uses calendarComponent::_setParams()
  * @return bool
  */
 function setUrl($value, $params = FALSE)
 {
     if (!empty($value)) {
         if (!filter_var($value, FILTER_VALIDATE_URL) && 'urn' != strtolower(substr($value, 0, 3))) {
             return FALSE;
         }
     } elseif ($this->getConfig('allowEmpty')) {
         $value = '';
     } else {
         return FALSE;
     }
     $this->url = array('value' => $value, 'params' => iCalUtilityFunctions::_setParams($params));
     return TRUE;
 }
예제 #3
0
 /**
  * set calendar component property x-prop
  *
  * @author Kjell-Inge Gustafsson, kigkonsult <*****@*****.**>
  * @since 2.9.3 - 2011-05-14
  * @param string $label
  * @param mixed $value
  * @param array $params optional
  * @return bool
  */
 function setXprop($label, $value, $params = FALSE)
 {
     if (empty($label)) {
         return;
     }
     if (empty($value) && !is_numeric($value)) {
         if ($this->getConfig('allowEmpty')) {
             $value = null;
         } else {
             return FALSE;
         }
     }
     $xprop = array('value' => $value);
     $xprop['params'] = iCalUtilityFunctions::_setParams($params);
     if (!is_array($this->xprop)) {
         $this->xprop = array();
     }
     $this->xprop[strtoupper($label)] = $xprop;
     return TRUE;
 }