@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | } |
45 | 45 | */ |
46 | 46 | /* only for phpversion 5.x, date management, default timezone setting */ |
47 | -if( substr( phpversion(), 0, 1) >= '5' ) // && ( 'UTC' == date_default_timezone_get() )) { |
|
48 | - date_default_timezone_set( 'Europe/Stockholm' ); |
|
47 | +if (substr(phpversion(), 0, 1) >= '5') // && ( 'UTC' == date_default_timezone_get() )) { |
|
48 | + date_default_timezone_set('Europe/Stockholm'); |
|
49 | 49 | /* version string, do NOT remove!! */ |
50 | -define( 'ICALCREATOR_VERSION', 'iCalcreator 2.6' ); |
|
50 | +define('ICALCREATOR_VERSION', 'iCalcreator 2.6'); |
|
51 | 51 | /*********************************************************************************/ |
52 | 52 | /*********************************************************************************/ |
53 | 53 | /** |
@@ -97,15 +97,15 @@ discard block |
||
97 | 97 | /** |
98 | 98 | * language = <Text identifying a language, as defined in [RFC 1766]> |
99 | 99 | */ |
100 | - if( defined( 'ICAL_LANG' )) |
|
101 | - $this->setConfig( 'language', ICAL_LANG ); |
|
102 | - $this->setConfig( 'allowEmpty', TRUE ); |
|
103 | - $this->setConfig( 'nl', "\n" ); |
|
104 | - $this->setConfig( 'format', 'iCal'); |
|
100 | + if (defined('ICAL_LANG')) |
|
101 | + $this->setConfig('language', ICAL_LANG); |
|
102 | + $this->setConfig('allowEmpty', TRUE); |
|
103 | + $this->setConfig('nl', "\n"); |
|
104 | + $this->setConfig('format', 'iCal'); |
|
105 | 105 | $this->directory = null; |
106 | 106 | $this->filename = null; |
107 | 107 | $this->url = null; |
108 | - $this->setConfig( 'delimiter', DIRECTORY_SEPARATOR ); |
|
108 | + $this->setConfig('delimiter', DIRECTORY_SEPARATOR); |
|
109 | 109 | $this->xcaldecl = array(); |
110 | 110 | $this->components = array(); |
111 | 111 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @return string |
122 | 122 | */ |
123 | 123 | function createCalscale() { |
124 | - if( empty( $this->calscale )) return FALSE; |
|
125 | - switch( $this->format ) { |
|
124 | + if (empty($this->calscale)) return FALSE; |
|
125 | + switch ($this->format) { |
|
126 | 126 | case 'xcal': |
127 | 127 | return ' calscale="'.$this->calscale.'"'.$this->nl; |
128 | 128 | break; |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | * @param string $value |
140 | 140 | * @return void |
141 | 141 | */ |
142 | - function setCalscale( $value ) { |
|
143 | - if( empty( $value )) return FALSE; |
|
142 | + function setCalscale($value) { |
|
143 | + if (empty($value)) return FALSE; |
|
144 | 144 | $this->calscale = $value; |
145 | 145 | } |
146 | 146 | /*********************************************************************************/ |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @return string |
156 | 156 | */ |
157 | 157 | function createMethod() { |
158 | - if( empty( $this->method )) return FALSE; |
|
159 | - switch( $this->format ) { |
|
158 | + if (empty($this->method)) return FALSE; |
|
159 | + switch ($this->format) { |
|
160 | 160 | case 'xcal': |
161 | 161 | return ' method="'.$this->method.'"'.$this->nl; |
162 | 162 | break; |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param string $value |
174 | 174 | * @return bool |
175 | 175 | */ |
176 | - function setMethod( $value ) { |
|
177 | - if( empty( $value )) return FALSE; |
|
176 | + function setMethod($value) { |
|
177 | + if (empty($value)) return FALSE; |
|
178 | 178 | $this->method = $value; |
179 | 179 | return TRUE; |
180 | 180 | } |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | * @return string |
195 | 195 | */ |
196 | 196 | function createProdid() { |
197 | - if( !isset( $this->prodid )) |
|
197 | + if (!isset($this->prodid)) |
|
198 | 198 | $this->_makeProdid(); |
199 | - switch( $this->format ) { |
|
199 | + switch ($this->format) { |
|
200 | 200 | case 'xcal': |
201 | 201 | return ' prodid="'.$this->prodid.'"'.$this->nl; |
202 | 202 | break; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @return void |
214 | 214 | */ |
215 | 215 | function _makeProdid() { |
216 | - $this->prodid = '-//'.$this->unique_id.'//NONSGML '.ICALCREATOR_VERSION.'//'.strtoupper( $this->language ); |
|
216 | + $this->prodid = '-//'.$this->unique_id.'//NONSGML '.ICALCREATOR_VERSION.'//'.strtoupper($this->language); |
|
217 | 217 | } |
218 | 218 | /** |
219 | 219 | * Conformance: The property MUST be specified once in an iCalendar object. |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @return void |
230 | 230 | */ |
231 | 231 | function _makeUnique_id() { |
232 | - $this->unique_id = ( isset( $_SERVER['SERVER_NAME'] )) ? gethostbyname( $_SERVER['SERVER_NAME'] ) : 'localhost'; |
|
232 | + $this->unique_id = (isset($_SERVER['SERVER_NAME'])) ? gethostbyname($_SERVER['SERVER_NAME']) : 'localhost'; |
|
233 | 233 | } |
234 | 234 | /*********************************************************************************/ |
235 | 235 | /** |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | * @return string |
247 | 247 | */ |
248 | 248 | function createVersion() { |
249 | - if( empty( $this->version )) |
|
249 | + if (empty($this->version)) |
|
250 | 250 | $this->_makeVersion(); |
251 | - switch( $this->format ) { |
|
251 | + switch ($this->format) { |
|
252 | 252 | case 'xcal': |
253 | 253 | return ' version="'.$this->version.'"'.$this->nl; |
254 | 254 | break; |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | * @param string $value |
276 | 276 | * @return void |
277 | 277 | */ |
278 | - function setVersion( $value ) { |
|
279 | - if( empty( $value )) return FALSE; |
|
278 | + function setVersion($value) { |
|
279 | + if (empty($value)) return FALSE; |
|
280 | 280 | $this->version = $value; |
281 | 281 | return TRUE; |
282 | 282 | } |
@@ -292,29 +292,29 @@ discard block |
||
292 | 292 | * @return string |
293 | 293 | */ |
294 | 294 | function createXprop() { |
295 | - if( 'xcal' == $this->format ) |
|
295 | + if ('xcal' == $this->format) |
|
296 | 296 | return false; |
297 | - if( 0 >= count( $this->xprop )) |
|
297 | + if (0 >= count($this->xprop)) |
|
298 | 298 | return; |
299 | 299 | $output = null; |
300 | 300 | $toolbox = new calendarComponent(); |
301 | - $toolbox->setConfig( 'language', $this->getConfig( 'language' )); |
|
302 | - $toolbox->setConfig( 'nl', $this->getConfig( 'nl' )); |
|
303 | - $toolbox->_createFormat( $this->getConfig( 'format' )); |
|
304 | - foreach( $this->xprop as $label => $xpropPart ) { |
|
305 | - if( empty( $xpropPart['value'] )) { |
|
306 | - $output .= $toolbox->_createElement( $label ); |
|
301 | + $toolbox->setConfig('language', $this->getConfig('language')); |
|
302 | + $toolbox->setConfig('nl', $this->getConfig('nl')); |
|
303 | + $toolbox->_createFormat($this->getConfig('format')); |
|
304 | + foreach ($this->xprop as $label => $xpropPart) { |
|
305 | + if (empty($xpropPart['value'])) { |
|
306 | + $output .= $toolbox->_createElement($label); |
|
307 | 307 | continue; |
308 | 308 | } |
309 | - $attributes = $toolbox->_createParams( $xpropPart['params'], array( 'LANGUAGE' )); |
|
310 | - if( is_array( $xpropPart['value'] )) { |
|
311 | - foreach( $xpropPart['value'] as $pix => $theXpart ) |
|
312 | - $xpropPart['value'][$pix] = $toolbox->_strrep( $theXpart ); |
|
313 | - $xpropPart['value'] = implode( ',', $xpropPart['value'] ); |
|
309 | + $attributes = $toolbox->_createParams($xpropPart['params'], array('LANGUAGE')); |
|
310 | + if (is_array($xpropPart['value'])) { |
|
311 | + foreach ($xpropPart['value'] as $pix => $theXpart) |
|
312 | + $xpropPart['value'][$pix] = $toolbox->_strrep($theXpart); |
|
313 | + $xpropPart['value'] = implode(',', $xpropPart['value']); |
|
314 | 314 | } |
315 | 315 | else |
316 | - $xpropPart['value'] = $toolbox->_strrep( $xpropPart['value'] ); |
|
317 | - $output .= $toolbox->_createElement( $label, $attributes, $xpropPart['value'] ); |
|
316 | + $xpropPart['value'] = $toolbox->_strrep($xpropPart['value']); |
|
317 | + $output .= $toolbox->_createElement($label, $attributes, $xpropPart['value']); |
|
318 | 318 | } |
319 | 319 | return $output; |
320 | 320 | } |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | * @param array $params optional |
329 | 329 | * @return bool |
330 | 330 | */ |
331 | - function setXprop( $label, $value, $params=FALSE ) { |
|
332 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
333 | - if( empty( $label )) return FALSE; |
|
334 | - $xprop = array( 'value' => $value ); |
|
331 | + function setXprop($label, $value, $params = FALSE) { |
|
332 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
333 | + if (empty($label)) return FALSE; |
|
334 | + $xprop = array('value' => $value); |
|
335 | 335 | $toolbox = new calendarComponent(); |
336 | - $xprop['params'] = $toolbox->_setParams( $params ); |
|
337 | - if( !is_array( $this->xprop )) $this->xprop = array(); |
|
338 | - $this->xprop[strtoupper( $label )] = $xprop; |
|
336 | + $xprop['params'] = $toolbox->_setParams($params); |
|
337 | + if (!is_array($this->xprop)) $this->xprop = array(); |
|
338 | + $this->xprop[strtoupper($label)] = $xprop; |
|
339 | 339 | return TRUE; |
340 | 340 | } |
341 | 341 | /*********************************************************************************/ |
@@ -348,39 +348,39 @@ discard block |
||
348 | 348 | * @param int @propix, optional, if specific property is wanted in case of multiply occurences |
349 | 349 | * @return bool, if successfull delete |
350 | 350 | */ |
351 | - function deleteProperty( $propName, $propix=FALSE ) { |
|
352 | - $propName = ( $propName ) ? strtoupper( $propName ) : 'X-PROP'; |
|
353 | - if( !$propix ) |
|
354 | - $propix = ( isset( $this->propdelix[$propName] )) ? $this->propdelix[$propName] + 2 : 1; |
|
351 | + function deleteProperty($propName, $propix = FALSE) { |
|
352 | + $propName = ($propName) ? strtoupper($propName) : 'X-PROP'; |
|
353 | + if (!$propix) |
|
354 | + $propix = (isset($this->propdelix[$propName])) ? $this->propdelix[$propName] + 2 : 1; |
|
355 | 355 | $this->propdelix[$propName] = --$propix; |
356 | 356 | $return = FALSE; |
357 | - switch( $propName ) { |
|
357 | + switch ($propName) { |
|
358 | 358 | case 'CALSCALE': |
359 | - if( isset( $this->calscale )) { |
|
359 | + if (isset($this->calscale)) { |
|
360 | 360 | $this->calscale = null; |
361 | 361 | $return = TRUE; |
362 | 362 | } |
363 | 363 | break; |
364 | 364 | case 'METHOD': |
365 | - if( isset( $this->method )) { |
|
366 | - $this->method = null; |
|
365 | + if (isset($this->method)) { |
|
366 | + $this->method = null; |
|
367 | 367 | $return = TRUE; |
368 | 368 | } |
369 | 369 | break; |
370 | 370 | default: |
371 | 371 | $reduced = array(); |
372 | - if( $propName != 'X-PROP' ) { |
|
373 | - if( !isset( $this->xprop[$propName] )) return FALSE; |
|
374 | - foreach( $this->xprop as $k => $a ) { |
|
375 | - if(( $k != $propName ) && !empty( $a )) |
|
372 | + if ($propName != 'X-PROP') { |
|
373 | + if (!isset($this->xprop[$propName])) return FALSE; |
|
374 | + foreach ($this->xprop as $k => $a) { |
|
375 | + if (($k != $propName) && !empty($a)) |
|
376 | 376 | $reduced[$k] = $a; |
377 | 377 | } |
378 | 378 | } |
379 | 379 | else { |
380 | - if( count( $this->xprop ) <= $propix ) return FALSE; |
|
380 | + if (count($this->xprop) <= $propix) return FALSE; |
|
381 | 381 | $xpropno = 0; |
382 | - foreach( $this->xprop as $xpropkey => $xpropvalue ) { |
|
383 | - if( $propix != $xpropno ) |
|
382 | + foreach ($this->xprop as $xpropkey => $xpropvalue) { |
|
383 | + if ($propix != $xpropno) |
|
384 | 384 | $reduced[$xpropkey] = $xpropvalue; |
385 | 385 | $xpropno++; |
386 | 386 | } |
@@ -400,41 +400,41 @@ discard block |
||
400 | 400 | * @param bool $inclParam=FALSE |
401 | 401 | * @return mixed |
402 | 402 | */ |
403 | - function getProperty( $propName=FALSE, $propix=FALSE, $inclParam=FALSE ) { |
|
404 | - $propName = ( $propName ) ? strtoupper( $propName ) : 'X-PROP'; |
|
405 | - if( 'X-PROP' == $propName ) { |
|
406 | - if( !$propix ) |
|
407 | - $propix = ( isset( $this->propix[$propName] )) ? $this->propix[$propName] + 2 : 1; |
|
403 | + function getProperty($propName = FALSE, $propix = FALSE, $inclParam = FALSE) { |
|
404 | + $propName = ($propName) ? strtoupper($propName) : 'X-PROP'; |
|
405 | + if ('X-PROP' == $propName) { |
|
406 | + if (!$propix) |
|
407 | + $propix = (isset($this->propix[$propName])) ? $this->propix[$propName] + 2 : 1; |
|
408 | 408 | $this->propix[$propName] = --$propix; |
409 | 409 | } |
410 | - switch( $propName ) { |
|
410 | + switch ($propName) { |
|
411 | 411 | case 'CALSCALE': |
412 | - return ( !empty( $this->calscale )) ? $this->calscale : null; |
|
412 | + return (!empty($this->calscale)) ? $this->calscale : null; |
|
413 | 413 | break; |
414 | 414 | case 'METHOD': |
415 | - return ( !empty( $this->method )) ? $this->method : null; |
|
415 | + return (!empty($this->method)) ? $this->method : null; |
|
416 | 416 | break; |
417 | 417 | case 'PRODID': |
418 | - if( empty( $this->prodid )) |
|
418 | + if (empty($this->prodid)) |
|
419 | 419 | $this->_makeProdid(); |
420 | 420 | return $this->prodid; |
421 | 421 | break; |
422 | 422 | case 'VERSION': |
423 | - return ( !empty( $this->version )) ? $this->version : null; |
|
423 | + return (!empty($this->version)) ? $this->version : null; |
|
424 | 424 | break; |
425 | 425 | default: |
426 | - if( $propName != 'X-PROP' ) { |
|
427 | - if( !isset( $this->xprop[$propName] )) return FALSE; |
|
428 | - return ( $inclParam ) ? array( $propName, $this->xprop[$propName] ) |
|
429 | - : array( $propName, $this->xprop[$propName]['value'] ); |
|
426 | + if ($propName != 'X-PROP') { |
|
427 | + if (!isset($this->xprop[$propName])) return FALSE; |
|
428 | + return ($inclParam) ? array($propName, $this->xprop[$propName]) |
|
429 | + : array($propName, $this->xprop[$propName]['value']); |
|
430 | 430 | } |
431 | 431 | else { |
432 | - if( empty( $this->xprop )) return FALSE; |
|
432 | + if (empty($this->xprop)) return FALSE; |
|
433 | 433 | $xpropno = 0; |
434 | - foreach( $this->xprop as $xpropkey => $xpropvalue ) { |
|
435 | - if( $propix == $xpropno ) |
|
436 | - return ( $inclParam ) ? array( $xpropkey, $this->xprop[$xpropkey] ) |
|
437 | - : array( $xpropkey, $this->xprop[$xpropkey]['value'] ); |
|
434 | + foreach ($this->xprop as $xpropkey => $xpropvalue) { |
|
435 | + if ($propix == $xpropno) |
|
436 | + return ($inclParam) ? array($xpropkey, $this->xprop[$xpropkey]) |
|
437 | + : array($xpropkey, $this->xprop[$xpropkey]['value']); |
|
438 | 438 | else |
439 | 439 | $xpropno++; |
440 | 440 | } |
@@ -453,23 +453,23 @@ discard block |
||
453 | 453 | * second ALWAYS component value! |
454 | 454 | * @return bool |
455 | 455 | */ |
456 | - function setProperty () { |
|
456 | + function setProperty() { |
|
457 | 457 | $numargs = func_num_args(); |
458 | - if( 1 > $numargs ) |
|
458 | + if (1 > $numargs) |
|
459 | 459 | return FALSE; |
460 | 460 | $arglist = func_get_args(); |
461 | - $arglist[0] = strtoupper( $arglist[0] ); |
|
462 | - switch( $arglist[0] ) { |
|
461 | + $arglist[0] = strtoupper($arglist[0]); |
|
462 | + switch ($arglist[0]) { |
|
463 | 463 | case 'CALSCALE': |
464 | - return $this->setCalscale( $arglist[1] ); |
|
464 | + return $this->setCalscale($arglist[1]); |
|
465 | 465 | case 'METHOD': |
466 | - return $this->setMethod( $arglist[1] ); |
|
466 | + return $this->setMethod($arglist[1]); |
|
467 | 467 | case 'VERSION': |
468 | - return $this->setVersion( $arglist[1] ); |
|
468 | + return $this->setVersion($arglist[1]); |
|
469 | 469 | default: |
470 | - if( !isset( $arglist[1] )) $arglist[1] = null; |
|
471 | - if( !isset( $arglist[2] )) $arglist[2] = null; |
|
472 | - return $this->setXprop( $arglist[0], $arglist[1], $arglist[2] ); |
|
470 | + if (!isset($arglist[1])) $arglist[1] = null; |
|
471 | + if (!isset($arglist[2])) $arglist[2] = null; |
|
472 | + return $this->setXprop($arglist[0], $arglist[1], $arglist[2]); |
|
473 | 473 | } |
474 | 474 | return FALSE; |
475 | 475 | } |
@@ -482,23 +482,23 @@ discard block |
||
482 | 482 | * @param string $config |
483 | 483 | * @return value |
484 | 484 | */ |
485 | - function getConfig( $config ) { |
|
486 | - switch( strtoupper( $config )) { |
|
485 | + function getConfig($config) { |
|
486 | + switch (strtoupper($config)) { |
|
487 | 487 | case 'ALLOWEMPTY': |
488 | 488 | return $this->allowEmpty; |
489 | 489 | break; |
490 | 490 | case 'COMPSINFO': |
491 | - unset( $this->compix ); |
|
491 | + unset($this->compix); |
|
492 | 492 | $info = array(); |
493 | - foreach( $this->components as $cix => $component ) { |
|
494 | - if( empty( $component )) continue; |
|
495 | - unset( $component->propix ); |
|
493 | + foreach ($this->components as $cix => $component) { |
|
494 | + if (empty($component)) continue; |
|
495 | + unset($component->propix); |
|
496 | 496 | $info[$cix]['ordno'] = $cix + 1; |
497 | 497 | $info[$cix]['type'] = $component->objName; |
498 | - $info[$cix]['uid'] = $component->getProperty( 'uid' ); |
|
499 | - $info[$cix]['props'] = $component->getConfig( 'propinfo' ); |
|
500 | - $info[$cix]['sub'] = $component->getConfig( 'compsinfo' ); |
|
501 | - unset( $component->propix ); |
|
498 | + $info[$cix]['uid'] = $component->getProperty('uid'); |
|
499 | + $info[$cix]['props'] = $component->getConfig('propinfo'); |
|
500 | + $info[$cix]['sub'] = $component->getConfig('compsinfo'); |
|
501 | + unset($component->propix); |
|
502 | 502 | } |
503 | 503 | return $info; |
504 | 504 | break; |
@@ -506,32 +506,32 @@ discard block |
||
506 | 506 | return $this->delimiter; |
507 | 507 | break; |
508 | 508 | case 'DIRECTORY': |
509 | - if( empty( $this->directory )) |
|
509 | + if (empty($this->directory)) |
|
510 | 510 | $this->directory = '.'; |
511 | 511 | return $this->directory; |
512 | 512 | break; |
513 | 513 | case 'DIRFILE': |
514 | - return $this->getConfig( 'directory' ).$this->getConfig( 'delimiter' ).$this->getConfig( 'filename' ); |
|
514 | + return $this->getConfig('directory').$this->getConfig('delimiter').$this->getConfig('filename'); |
|
515 | 515 | break; |
516 | 516 | case 'FILEINFO': |
517 | - return array( $this->getConfig( 'directory' ) |
|
518 | - , $this->getConfig( 'filename' ) |
|
519 | - , $this->getConfig( 'filesize' )); |
|
517 | + return array($this->getConfig('directory') |
|
518 | + , $this->getConfig('filename') |
|
519 | + , $this->getConfig('filesize')); |
|
520 | 520 | break; |
521 | 521 | case 'FILENAME': |
522 | - if( empty( $this->filename )) { |
|
523 | - if( 'xcal' == $this->format ) |
|
524 | - $this->filename = date( 'YmdHis' ).'.xml'; // recommended xcs.. . |
|
522 | + if (empty($this->filename)) { |
|
523 | + if ('xcal' == $this->format) |
|
524 | + $this->filename = date('YmdHis').'.xml'; // recommended xcs.. . |
|
525 | 525 | else |
526 | - $this->filename = date( 'YmdHis' ).'.ics'; |
|
526 | + $this->filename = date('YmdHis').'.ics'; |
|
527 | 527 | } |
528 | 528 | return $this->filename; |
529 | 529 | break; |
530 | 530 | case 'FILESIZE': |
531 | - $size = 0; |
|
532 | - if( empty( $this->url )) { |
|
533 | - $dirfile = $this->getConfig( 'dirfile' ); |
|
534 | - if( FALSE === ( $size = filesize( $dirfile ))) |
|
531 | + $size = 0; |
|
532 | + if (empty($this->url)) { |
|
533 | + $dirfile = $this->getConfig('dirfile'); |
|
534 | + if (FALSE === ($size = filesize($dirfile))) |
|
535 | 535 | $size = 0; |
536 | 536 | clearstatcache(); |
537 | 537 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | return $this->unique_id; |
553 | 553 | break; |
554 | 554 | case 'URL': |
555 | - if( !empty( $this->url )) |
|
555 | + if (!empty($this->url)) |
|
556 | 556 | return $this->url; |
557 | 557 | else |
558 | 558 | return FALSE; |
@@ -568,12 +568,12 @@ discard block |
||
568 | 568 | * @param string $value |
569 | 569 | * @return void |
570 | 570 | */ |
571 | - function setConfig( $config, $value ) { |
|
571 | + function setConfig($config, $value) { |
|
572 | 572 | $res = FALSE; |
573 | - switch( strtoupper( $config )) { |
|
573 | + switch (strtoupper($config)) { |
|
574 | 574 | case 'ALLOWEMPTY': |
575 | 575 | $this->allowEmpty = $value; |
576 | - $subcfg = array( 'ALLOWEMPTY' => $value ); |
|
576 | + $subcfg = array('ALLOWEMPTY' => $value); |
|
577 | 577 | $res = TRUE; |
578 | 578 | break; |
579 | 579 | case 'DELIMITER': |
@@ -581,11 +581,11 @@ discard block |
||
581 | 581 | return TRUE; |
582 | 582 | break; |
583 | 583 | case 'DIRECTORY': |
584 | - $value = trim( $value ); |
|
584 | + $value = trim($value); |
|
585 | 585 | $nl = $this->getConfig('delimiter'); |
586 | - if( $nl == substr( $value, ( 0 - strlen( $nl )))) |
|
587 | - $value = substr( $value, 0, ( strlen( $value ) - strlen( $nl ))); |
|
588 | - if( is_dir( $value )) { |
|
586 | + if ($nl == substr($value, (0 - strlen($nl)))) |
|
587 | + $value = substr($value, 0, (strlen($value) - strlen($nl))); |
|
588 | + if (is_dir($value)) { |
|
589 | 589 | /* local directory */ |
590 | 590 | clearstatcache(); |
591 | 591 | $this->directory = $value; |
@@ -596,16 +596,16 @@ discard block |
||
596 | 596 | return FALSE; |
597 | 597 | break; |
598 | 598 | case 'FILENAME': |
599 | - $value = trim( $value ); |
|
600 | - if( !empty( $this->url )) { |
|
599 | + $value = trim($value); |
|
600 | + if (!empty($this->url)) { |
|
601 | 601 | /* remote directory+file - URL */ |
602 | 602 | $this->filename = $value; |
603 | 603 | return TRUE; |
604 | 604 | } |
605 | - $dirfile = $this->getConfig( 'directory' ).$this->getConfig( 'delimiter' ).$value; |
|
606 | - if( file_exists( $dirfile )) { |
|
605 | + $dirfile = $this->getConfig('directory').$this->getConfig('delimiter').$value; |
|
606 | + if (file_exists($dirfile)) { |
|
607 | 607 | /* local existing file */ |
608 | - if( is_readable( $dirfile ) || is_writable( $dirfile )) { |
|
608 | + if (is_readable($dirfile) || is_writable($dirfile)) { |
|
609 | 609 | clearstatcache(); |
610 | 610 | $this->filename = $value; |
611 | 611 | return TRUE; |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | else |
614 | 614 | return FALSE; |
615 | 615 | } |
616 | - elseif( FALSE !== touch( $dirfile )) { |
|
616 | + elseif (FALSE !== touch($dirfile)) { |
|
617 | 617 | /* new local file created */ |
618 | 618 | $this->filename = $value; |
619 | 619 | return TRUE; |
@@ -622,8 +622,8 @@ discard block |
||
622 | 622 | return FALSE; |
623 | 623 | break; |
624 | 624 | case 'FORMAT': |
625 | - $value = trim( $value ); |
|
626 | - if( 'xcal' == strtolower( $value )) { |
|
625 | + $value = trim($value); |
|
626 | + if ('xcal' == strtolower($value)) { |
|
627 | 627 | $this->format = 'xcal'; |
628 | 628 | $this->attributeDelimiter = $this->nl; |
629 | 629 | $this->valueInit = null; |
@@ -633,46 +633,46 @@ discard block |
||
633 | 633 | $this->attributeDelimiter = ';'; |
634 | 634 | $this->valueInit = ':'; |
635 | 635 | } |
636 | - $subcfg = array( 'FORMAT' => $value ); |
|
636 | + $subcfg = array('FORMAT' => $value); |
|
637 | 637 | $res = TRUE; |
638 | 638 | break; |
639 | 639 | case 'LANGUAGE': |
640 | 640 | // set language for calendar component as defined in [RFC 1766] |
641 | - $value = trim( $value ); |
|
641 | + $value = trim($value); |
|
642 | 642 | $this->language = $value; |
643 | - $subcfg = array( 'LANGUAGE' => $value ); |
|
643 | + $subcfg = array('LANGUAGE' => $value); |
|
644 | 644 | $res = TRUE; |
645 | 645 | break; |
646 | 646 | case 'NL': |
647 | 647 | case 'NEWLINECHAR': |
648 | 648 | $this->nl = $value; |
649 | - $subcfg = array( 'NL' => $value ); |
|
649 | + $subcfg = array('NL' => $value); |
|
650 | 650 | $res = TRUE; |
651 | 651 | break; |
652 | 652 | case 'UNIQUE_ID': |
653 | - $value = trim( $value ); |
|
653 | + $value = trim($value); |
|
654 | 654 | $this->unique_id = $value; |
655 | - $subcfg = array( 'UNIQUE_ID' => $value ); |
|
655 | + $subcfg = array('UNIQUE_ID' => $value); |
|
656 | 656 | $res = TRUE; |
657 | 657 | break; |
658 | 658 | case 'URL': |
659 | 659 | /* remote file - URL */ |
660 | - $value = trim( $value ); |
|
661 | - $value = str_replace( 'HTTP://', 'http://', $value ); |
|
662 | - $value = str_replace( 'WEBCAL://', 'http://', $value ); |
|
663 | - $value = str_replace( 'webcal://', 'http://', $value ); |
|
660 | + $value = trim($value); |
|
661 | + $value = str_replace('HTTP://', 'http://', $value); |
|
662 | + $value = str_replace('WEBCAL://', 'http://', $value); |
|
663 | + $value = str_replace('webcal://', 'http://', $value); |
|
664 | 664 | $this->url = $value; |
665 | 665 | $this->directory = null; |
666 | - $parts = pathinfo( $value ); |
|
667 | - return $this->setConfig( 'filename', $parts['basename'] ); |
|
666 | + $parts = pathinfo($value); |
|
667 | + return $this->setConfig('filename', $parts['basename']); |
|
668 | 668 | break; |
669 | 669 | } |
670 | - if( !$res ) return FALSE; |
|
671 | - if( isset( $subcfg ) && !empty( $this->components )) { |
|
672 | - foreach( $subcfg as $cfgkey => $cfgvalue ) { |
|
673 | - foreach( $this->components as $cix => $component ) { |
|
674 | - $res = $component->setConfig( $cfgkey, $cfgvalue ); |
|
675 | - if( !$res ) |
|
670 | + if (!$res) return FALSE; |
|
671 | + if (isset($subcfg) && !empty($this->components)) { |
|
672 | + foreach ($subcfg as $cfgkey => $cfgvalue) { |
|
673 | + foreach ($this->components as $cix => $component) { |
|
674 | + $res = $component->setConfig($cfgkey, $cfgvalue); |
|
675 | + if (!$res) |
|
676 | 676 | break 2; |
677 | 677 | $this->components[$cix] = $component->copy(); // PHP4 compliant |
678 | 678 | } |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | * @param object $component calendar component |
692 | 692 | * @return void |
693 | 693 | */ |
694 | - function addComponent( $component ) { |
|
695 | - $this->setComponent( $component ); |
|
694 | + function addComponent($component) { |
|
695 | + $this->setComponent($component); |
|
696 | 696 | } |
697 | 697 | /** |
698 | 698 | * delete calendar component from container |
@@ -703,33 +703,33 @@ discard block |
||
703 | 703 | * @param mixed $arg2 optional, ordno if arg1 = component type |
704 | 704 | * @return void |
705 | 705 | */ |
706 | - function deleteComponent( $arg1, $arg2=FALSE ) { |
|
706 | + function deleteComponent($arg1, $arg2 = FALSE) { |
|
707 | 707 | $argType = $index = null; |
708 | - if ( ctype_digit( (string) $arg1 )) { |
|
708 | + if (ctype_digit((string) $arg1)) { |
|
709 | 709 | $argType = 'INDEX'; |
710 | 710 | $index = (int) $arg1 - 1; |
711 | 711 | } |
712 | - elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) { |
|
713 | - $argType = strtolower( $arg1 ); |
|
714 | - $index = ( !empty( $arg2 ) && ctype_digit( (string) $arg2 )) ? (( int ) $arg2 - 1 ) : 0; |
|
712 | + elseif ((strlen($arg1) <= strlen('vfreebusy')) && (FALSE === strpos($arg1, '@'))) { |
|
713 | + $argType = strtolower($arg1); |
|
714 | + $index = (!empty($arg2) && ctype_digit((string) $arg2)) ? ((int) $arg2 - 1) : 0; |
|
715 | 715 | } |
716 | 716 | $cix1dC = 0; |
717 | - foreach ( $this->components as $cix => $component) { |
|
718 | - if( empty( $component )) continue; |
|
719 | - unset( $component->propix ); |
|
720 | - if(( 'INDEX' == $argType ) && ( $index == $cix )) { |
|
721 | - unset( $this->components[$cix] ); |
|
717 | + foreach ($this->components as $cix => $component) { |
|
718 | + if (empty($component)) continue; |
|
719 | + unset($component->propix); |
|
720 | + if (('INDEX' == $argType) && ($index == $cix)) { |
|
721 | + unset($this->components[$cix]); |
|
722 | 722 | return TRUE; |
723 | 723 | } |
724 | - elseif( $argType == $component->objName ) { |
|
725 | - if( $index == $cix1dC ) { |
|
726 | - unset( $this->components[$cix] ); |
|
724 | + elseif ($argType == $component->objName) { |
|
725 | + if ($index == $cix1dC) { |
|
726 | + unset($this->components[$cix]); |
|
727 | 727 | return TRUE; |
728 | 728 | } |
729 | 729 | $cix1dC++; |
730 | 730 | } |
731 | - elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) { |
|
732 | - unset( $this->components[$cix] ); |
|
731 | + elseif (!$argType && ($arg1 == $component->getProperty('uid'))) { |
|
732 | + unset($this->components[$cix]); |
|
733 | 733 | return TRUE; |
734 | 734 | } |
735 | 735 | } |
@@ -744,49 +744,49 @@ discard block |
||
744 | 744 | * @param mixed $arg2 optional, ordno if arg1 = component type |
745 | 745 | * @return object |
746 | 746 | */ |
747 | - function getComponent( $arg1=FALSE, $arg2=FALSE ) { |
|
747 | + function getComponent($arg1 = FALSE, $arg2 = FALSE) { |
|
748 | 748 | $index = $argType = null; |
749 | - if ( !$arg1 ) { |
|
749 | + if (!$arg1) { |
|
750 | 750 | $argType = 'INDEX'; |
751 | 751 | $index = $this->compix['INDEX'] = |
752 | - ( isset( $this->compix['INDEX'] )) ? $this->compix['INDEX'] + 1 : 1; |
|
752 | + (isset($this->compix['INDEX'])) ? $this->compix['INDEX'] + 1 : 1; |
|
753 | 753 | } |
754 | - elseif ( ctype_digit( (string) $arg1 )) { |
|
754 | + elseif (ctype_digit((string) $arg1)) { |
|
755 | 755 | $argType = 'INDEX'; |
756 | 756 | $index = (int) $arg1; |
757 | - unset( $this->compix ); |
|
757 | + unset($this->compix); |
|
758 | 758 | } |
759 | - elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) { |
|
760 | - unset( $this->compix['INDEX'] ); |
|
761 | - $argType = strtolower( $arg1 ); |
|
762 | - if( !$arg2 ) |
|
759 | + elseif ((strlen($arg1) <= strlen('vfreebusy')) && (FALSE === strpos($arg1, '@'))) { |
|
760 | + unset($this->compix['INDEX']); |
|
761 | + $argType = strtolower($arg1); |
|
762 | + if (!$arg2) |
|
763 | 763 | $index = $this->compix[$argType] = |
764 | - ( isset( $this->compix[$argType] )) ? $this->compix[$argType] + 1 : 1; |
|
764 | + (isset($this->compix[$argType])) ? $this->compix[$argType] + 1 : 1; |
|
765 | 765 | else |
766 | 766 | $index = (int) $arg2; |
767 | 767 | } |
768 | - $index -= 1; |
|
769 | - $ckeys = array_keys( $this->components ); |
|
770 | - if( !empty( $index) && ( $index > end( $ckeys ))) |
|
768 | + $index -= 1; |
|
769 | + $ckeys = array_keys($this->components); |
|
770 | + if (!empty($index) && ($index > end($ckeys))) |
|
771 | 771 | return FALSE; |
772 | 772 | $cix1gC = 0; |
773 | - foreach ( $this->components as $cix => $component) { |
|
774 | - if( empty( $component )) continue; |
|
775 | - unset( $component->propix ); |
|
776 | - if(( 'INDEX' == $argType ) && ( $index == $cix )) |
|
773 | + foreach ($this->components as $cix => $component) { |
|
774 | + if (empty($component)) continue; |
|
775 | + unset($component->propix); |
|
776 | + if (('INDEX' == $argType) && ($index == $cix)) |
|
777 | 777 | return $component->copy(); |
778 | - elseif( $argType == $component->objName ) { |
|
779 | - if( $index == $cix1gC ) |
|
778 | + elseif ($argType == $component->objName) { |
|
779 | + if ($index == $cix1gC) |
|
780 | 780 | return $component->copy(); |
781 | 781 | $cix1gC++; |
782 | 782 | } |
783 | - elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) { |
|
784 | - unset( $component->propix ); |
|
783 | + elseif (!$argType && ($arg1 == $component->getProperty('uid'))) { |
|
784 | + unset($component->propix); |
|
785 | 785 | return $component->copy(); |
786 | 786 | } |
787 | 787 | } |
788 | 788 | /* not found.. . */ |
789 | - unset( $this->compix ); |
|
789 | + unset($this->compix); |
|
790 | 790 | return FALSE; |
791 | 791 | } |
792 | 792 | /** |
@@ -813,242 +813,242 @@ discard block |
||
813 | 813 | * FALSE - one occurance of component only in output array</tr> |
814 | 814 | * @return array or FALSE |
815 | 815 | */ |
816 | - function selectComponents( $startY=FALSE, $startM=FALSE, $startD=FALSE, $endY=FALSE, $endM=FALSE, $endD=FALSE, $cType=FALSE, $flat=FALSE, $any=TRUE, $split=TRUE ) { |
|
816 | + function selectComponents($startY = FALSE, $startM = FALSE, $startD = FALSE, $endY = FALSE, $endM = FALSE, $endD = FALSE, $cType = FALSE, $flat = FALSE, $any = TRUE, $split = TRUE) { |
|
817 | 817 | /* check if empty calendar */ |
818 | - if( 0 >= count( $this->components )) return FALSE; |
|
818 | + if (0 >= count($this->components)) return FALSE; |
|
819 | 819 | /* check default dates */ |
820 | - if( !$startY ) $startY = date( 'Y' ); |
|
821 | - if( !$startM ) $startM = date( 'm' ); |
|
822 | - if( !$startD ) $startD = date( 'd' ); |
|
823 | - $startDate = mktime( 0, 0, 0, $startM, $startD, $startY ); |
|
824 | - if( !$endY ) $endY = $startY; |
|
825 | - if( !$endM ) $endM = $startM; |
|
826 | - if( !$endD ) $endD = $startD; |
|
827 | - $endDate = mktime( 23, 59, 59, $endM, $endD, $endY ); |
|
820 | + if (!$startY) $startY = date('Y'); |
|
821 | + if (!$startM) $startM = date('m'); |
|
822 | + if (!$startD) $startD = date('d'); |
|
823 | + $startDate = mktime(0, 0, 0, $startM, $startD, $startY); |
|
824 | + if (!$endY) $endY = $startY; |
|
825 | + if (!$endM) $endM = $startM; |
|
826 | + if (!$endD) $endD = $startD; |
|
827 | + $endDate = mktime(23, 59, 59, $endM, $endD, $endY); |
|
828 | 828 | /* check component types */ |
829 | - $validTypes = array('vevent', 'vtodo', 'vjournal', 'vfreebusy' ); |
|
830 | - if( is_array( $cType )) { |
|
831 | - foreach( $cType as $cix => $theType ) { |
|
832 | - $cType[$cix] = $theType = strtolower( $theType ); |
|
833 | - if( !in_array( $theType, $validTypes )) |
|
829 | + $validTypes = array('vevent', 'vtodo', 'vjournal', 'vfreebusy'); |
|
830 | + if (is_array($cType)) { |
|
831 | + foreach ($cType as $cix => $theType) { |
|
832 | + $cType[$cix] = $theType = strtolower($theType); |
|
833 | + if (!in_array($theType, $validTypes)) |
|
834 | 834 | $cType[$cix] = 'vevent'; |
835 | 835 | } |
836 | - $cType = array_unique( $cType ); |
|
836 | + $cType = array_unique($cType); |
|
837 | 837 | } |
838 | - elseif( !empty( $cType )) { |
|
839 | - $cType = strtolower( $cType ); |
|
840 | - if( !in_array( $cType, $validTypes )) |
|
841 | - $cType = array( 'vevent' ); |
|
838 | + elseif (!empty($cType)) { |
|
839 | + $cType = strtolower($cType); |
|
840 | + if (!in_array($cType, $validTypes)) |
|
841 | + $cType = array('vevent'); |
|
842 | 842 | else |
843 | - $cType = array( $cType ); |
|
843 | + $cType = array($cType); |
|
844 | 844 | } |
845 | 845 | else |
846 | 846 | $cType = $validTypes; |
847 | - if( 0 >= count( $cType )) |
|
847 | + if (0 >= count($cType)) |
|
848 | 848 | $cType = $validTypes; |
849 | 849 | /* iterate components */ |
850 | 850 | $result = array(); |
851 | - foreach ( $this->components as $cix => $component ) { |
|
852 | - if( empty( $component )) continue; |
|
853 | - unset( $component->propix, $start ); |
|
851 | + foreach ($this->components as $cix => $component) { |
|
852 | + if (empty($component)) continue; |
|
853 | + unset($component->propix, $start); |
|
854 | 854 | /* deselect unvalid type components */ |
855 | - if( !in_array( $component->objName, $cType )) continue; |
|
855 | + if (!in_array($component->objName, $cType)) continue; |
|
856 | 856 | /* deselect components without dtstart set */ |
857 | - if( FALSE === ( $start = $component->getProperty( 'dtstart' ))) continue; |
|
857 | + if (FALSE === ($start = $component->getProperty('dtstart'))) continue; |
|
858 | 858 | $dtendExist = $dueExist = $durationExist = $endAllDayEvent = FALSE; |
859 | - unset( $end, $startWdate, $endWdate, $rdurWsecs, $rdur, $exdatelist, $workstart, $workend ); // clean up |
|
860 | - $startWdate = $component->_date2timestamp( $start ); |
|
861 | - $startDateFormat = ( isset( $start['hour'] )) ? 'Y-m-d H:i:s' : 'Y-m-d'; |
|
859 | + unset($end, $startWdate, $endWdate, $rdurWsecs, $rdur, $exdatelist, $workstart, $workend); // clean up |
|
860 | + $startWdate = $component->_date2timestamp($start); |
|
861 | + $startDateFormat = (isset($start['hour'])) ? 'Y-m-d H:i:s' : 'Y-m-d'; |
|
862 | 862 | /* get end date from dtend/due/duration properties */ |
863 | - $end = $component->getProperty( 'dtend' ); |
|
864 | - if( !empty( $end )) { |
|
863 | + $end = $component->getProperty('dtend'); |
|
864 | + if (!empty($end)) { |
|
865 | 865 | $dtendExist = TRUE; |
866 | - $endDateFormat = ( isset( $end['hour'] )) ? 'Y-m-d H:i:s' : 'Y-m-d'; |
|
866 | + $endDateFormat = (isset($end['hour'])) ? 'Y-m-d H:i:s' : 'Y-m-d'; |
|
867 | 867 | } |
868 | 868 | // if( !empty($end)) echo 'selectComp 1 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ### |
869 | - if( empty($end) && ( $component->objName == 'vtodo' )) { |
|
870 | - $end = $component->getProperty( 'due' ); |
|
871 | - if( !empty( $end )) { |
|
869 | + if (empty($end) && ($component->objName == 'vtodo')) { |
|
870 | + $end = $component->getProperty('due'); |
|
871 | + if (!empty($end)) { |
|
872 | 872 | $dueExist = TRUE; |
873 | - $endDateFormat = ( isset( $end['hour'] )) ? 'Y-m-d H:i:s' : 'Y-m-d'; |
|
873 | + $endDateFormat = (isset($end['hour'])) ? 'Y-m-d H:i:s' : 'Y-m-d'; |
|
874 | 874 | } |
875 | 875 | // if( !empty($end)) echo 'selectComp 2 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ### |
876 | 876 | } |
877 | - if( !empty( $end ) && !isset( $end['hour'] )) { |
|
877 | + if (!empty($end) && !isset($end['hour'])) { |
|
878 | 878 | /* a DTEND without time part regards an event that ends the day before, |
879 | 879 | for an all-day event DTSTART=20071201 DTEND=20071202 (taking place 20071201!!! */ |
880 | 880 | $endAllDayEvent = TRUE; |
881 | - $endWdate = mktime( 23, 59, 59, $end['month'], ($end['day'] - 1), $end['year'] ); |
|
882 | - $end['year'] = date( 'Y', $endWdate ); |
|
883 | - $end['month'] = date( 'm', $endWdate ); |
|
884 | - $end['day'] = date( 'd', $endWdate ); |
|
881 | + $endWdate = mktime(23, 59, 59, $end['month'], ($end['day'] - 1), $end['year']); |
|
882 | + $end['year'] = date('Y', $endWdate); |
|
883 | + $end['month'] = date('m', $endWdate); |
|
884 | + $end['day'] = date('d', $endWdate); |
|
885 | 885 | $end['hour'] = 23; |
886 | 886 | $end['min'] = $end['sec'] = 59; |
887 | 887 | // if( !empty($end)) echo 'selectComp 3 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ### |
888 | 888 | } |
889 | - if( empty( $end )) { |
|
890 | - $end = $component->getProperty( 'duration', FALSE, FALSE, TRUE );// in dtend (array) format |
|
891 | - if( !empty( $end )) |
|
889 | + if (empty($end)) { |
|
890 | + $end = $component->getProperty('duration', FALSE, FALSE, TRUE); // in dtend (array) format |
|
891 | + if (!empty($end)) |
|
892 | 892 | $durationExist = TRUE; |
893 | 893 | // if( !empty($end)) echo 'selectComp 4 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ### |
894 | 894 | } |
895 | - if( empty( $end )) { // assume one day duration if missing end date |
|
896 | - $end = array( 'year' => $start['year'], 'month' => $start['month'], 'day' => $start['day'], 'hour' => 23, 'min' => 59, 'sec' => 59 ); |
|
895 | + if (empty($end)) { // assume one day duration if missing end date |
|
896 | + $end = array('year' => $start['year'], 'month' => $start['month'], 'day' => $start['day'], 'hour' => 23, 'min' => 59, 'sec' => 59); |
|
897 | 897 | // if( isset($end)) echo 'selectComp 5 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ### |
898 | 898 | } |
899 | - $endWdate = $component->_date2timestamp( $end ); |
|
900 | - if( $endWdate < $startWdate ) { // MUST be after start date!! |
|
901 | - $end = array( 'year' => $start['year'], 'month' => $start['month'], 'day' => $start['day'], 'hour' => 23, 'min' => 59, 'sec' => 59 ); |
|
902 | - $endWdate = $component->_date2timestamp( $end ); |
|
899 | + $endWdate = $component->_date2timestamp($end); |
|
900 | + if ($endWdate < $startWdate) { // MUST be after start date!! |
|
901 | + $end = array('year' => $start['year'], 'month' => $start['month'], 'day' => $start['day'], 'hour' => 23, 'min' => 59, 'sec' => 59); |
|
902 | + $endWdate = $component->_date2timestamp($end); |
|
903 | 903 | } |
904 | 904 | $rdurWsecs = $endWdate - $startWdate; // compute component duration in seconds |
905 | - $rdur = $component->_date2duration( $start, $end ); // compute component duration, array |
|
905 | + $rdur = $component->_date2duration($start, $end); // compute component duration, array |
|
906 | 906 | /* make a list of optional exclude dates for component occurence from exrule and exdate */ |
907 | 907 | $exdatelist = array(); |
908 | - $workstart = $component->_timestamp2date(( $startDate - $rdurWsecs ), 6); |
|
909 | - $workend = $component->_timestamp2date(( $endDate + $rdurWsecs ), 6); |
|
910 | - while( FALSE !== ( $exrule = $component->getProperty( 'exrule' ))) // check exrule |
|
911 | - $component->_recur2date( $exdatelist, $exrule, $start, $workstart, $workend ); |
|
912 | - while( FALSE !== ( $exdate = $component->getProperty( 'exdate' ))) { // check exdate |
|
913 | - foreach( $exdate as $theExdate ) { |
|
914 | - $exWdate = $component->_date2timestamp( $theExdate ); |
|
915 | - if((( $startDate - $rdurWsecs ) <= $exWdate ) && ( $endDate >= $exWdate )) |
|
908 | + $workstart = $component->_timestamp2date(($startDate - $rdurWsecs), 6); |
|
909 | + $workend = $component->_timestamp2date(($endDate + $rdurWsecs), 6); |
|
910 | + while (FALSE !== ($exrule = $component->getProperty('exrule'))) // check exrule |
|
911 | + $component->_recur2date($exdatelist, $exrule, $start, $workstart, $workend); |
|
912 | + while (FALSE !== ($exdate = $component->getProperty('exdate'))) { // check exdate |
|
913 | + foreach ($exdate as $theExdate) { |
|
914 | + $exWdate = $component->_date2timestamp($theExdate); |
|
915 | + if ((($startDate - $rdurWsecs) <= $exWdate) && ($endDate >= $exWdate)) |
|
916 | 916 | $exdatelist[$exWdate] = TRUE; |
917 | 917 | } |
918 | 918 | } |
919 | 919 | /* if 'any' components, check repeating components, removing all excluding dates */ |
920 | - if( TRUE === $any ) { |
|
920 | + if (TRUE === $any) { |
|
921 | 921 | /* make a list of optional repeating dates for component occurence, rrule, rdate */ |
922 | 922 | $recurlist = array(); |
923 | - while( FALSE !== ( $rrule = $component->getProperty( 'rrule' ))) // check rrule |
|
924 | - $component->_recur2date( $recurlist, $rrule, $start, $workstart, $workend ); |
|
925 | - foreach( $recurlist as $recurkey => $recurvalue ) // key=match date as timestamp |
|
923 | + while (FALSE !== ($rrule = $component->getProperty('rrule'))) // check rrule |
|
924 | + $component->_recur2date($recurlist, $rrule, $start, $workstart, $workend); |
|
925 | + foreach ($recurlist as $recurkey => $recurvalue) // key=match date as timestamp |
|
926 | 926 | $recurlist[$recurkey] = $rdurWsecs; // add duration in seconds |
927 | - while( FALSE !== ( $rdate = $component->getProperty( 'rdate' ))) { // check rdate |
|
928 | - foreach( $rdate as $theRdate ) { |
|
929 | - if( is_array( $theRdate ) && ( 2 == count( $theRdate )) && // all days within PERIOD |
|
930 | - array_key_exists( '0', $theRdate ) && array_key_exists( '1', $theRdate )) { |
|
931 | - $rstart = $component->_date2timestamp( $theRdate[0] ); |
|
932 | - if(( $rstart < ( $startDate - $rdurWsecs )) || ( $rstart > $endDate )) |
|
927 | + while (FALSE !== ($rdate = $component->getProperty('rdate'))) { // check rdate |
|
928 | + foreach ($rdate as $theRdate) { |
|
929 | + if (is_array($theRdate) && (2 == count($theRdate)) && // all days within PERIOD |
|
930 | + array_key_exists('0', $theRdate) && array_key_exists('1', $theRdate)) { |
|
931 | + $rstart = $component->_date2timestamp($theRdate[0]); |
|
932 | + if (($rstart < ($startDate - $rdurWsecs)) || ($rstart > $endDate)) |
|
933 | 933 | continue; |
934 | - if( isset( $theRdate[1]['year'] )) // date-date period |
|
935 | - $rend = $component->_date2timestamp( $theRdate[1] ); |
|
934 | + if (isset($theRdate[1]['year'])) // date-date period |
|
935 | + $rend = $component->_date2timestamp($theRdate[1]); |
|
936 | 936 | else { // date-duration period |
937 | - $rend = $component->duration2date( $theRdate[0], $theRdate[1] ); |
|
938 | - $rend = $component->_date2timestamp( $rend ); |
|
937 | + $rend = $component->duration2date($theRdate[0], $theRdate[1]); |
|
938 | + $rend = $component->_date2timestamp($rend); |
|
939 | 939 | } |
940 | - if((( $startDate - $rdurWsecs ) <= $rstart ) && ( $endDate >= $rstart )) |
|
941 | - $recurlist[$rstart] = ( $rstart - $rend ); // set start date + rdate duration in seconds |
|
940 | + if ((($startDate - $rdurWsecs) <= $rstart) && ($endDate >= $rstart)) |
|
941 | + $recurlist[$rstart] = ($rstart - $rend); // set start date + rdate duration in seconds |
|
942 | 942 | } // PERIOD end |
943 | 943 | else { // single date |
944 | - $theRdate = $component->_date2timestamp( $theRdate ); |
|
945 | - if((( $startDate - $rdurWsecs ) <= $theRdate ) && ( $endDate >= $theRdate )) |
|
944 | + $theRdate = $component->_date2timestamp($theRdate); |
|
945 | + if ((($startDate - $rdurWsecs) <= $theRdate) && ($endDate >= $theRdate)) |
|
946 | 946 | $recurlist[$theRdate] = $rdurWsecs; // set start date + event duration in seconds |
947 | 947 | } |
948 | 948 | } |
949 | 949 | } |
950 | - if( 0 < count( $recurlist )) { |
|
951 | - ksort( $recurlist ); |
|
952 | - foreach( $recurlist as $recurkey => $durvalue ) { |
|
953 | - if((( $startDate - $rdurWsecs ) > $recurkey ) || ( $endDate < $recurkey )) // not within period |
|
950 | + if (0 < count($recurlist)) { |
|
951 | + ksort($recurlist); |
|
952 | + foreach ($recurlist as $recurkey => $durvalue) { |
|
953 | + if ((($startDate - $rdurWsecs) > $recurkey) || ($endDate < $recurkey)) // not within period |
|
954 | 954 | continue; |
955 | - if( isset( $exdatelist[$recurkey] )) // check excluded dates |
|
955 | + if (isset($exdatelist[$recurkey])) // check excluded dates |
|
956 | 956 | continue; |
957 | - if( $startWdate >= $recurkey ) // exclude component start date |
|
957 | + if ($startWdate >= $recurkey) // exclude component start date |
|
958 | 958 | continue; |
959 | 959 | $component2 = $component->copy(); |
960 | - $rstart = $component2->_timestamp2date( $recurkey, 6); |
|
960 | + $rstart = $component2->_timestamp2date($recurkey, 6); |
|
961 | 961 | $datevalue = $rstart['month'].'/'.$rstart['day'].'/'.$rstart['year']; |
962 | - if( isset( $start['hour'] ) || isset( $start['min'] ) || isset( $start['sec'] )) { |
|
963 | - $datevalue .= ( isset( $rstart['hour'] )) ? ' '.$rstart['hour'] : ' 00'; |
|
964 | - $datevalue .= ( isset( $rstart['min'] )) ? ':'.$rstart['min'] : ':00'; |
|
965 | - $datevalue .= ( isset( $rstart['sec'] )) ? ':'.$rstart['sec'] : ':00'; |
|
962 | + if (isset($start['hour']) || isset($start['min']) || isset($start['sec'])) { |
|
963 | + $datevalue .= (isset($rstart['hour'])) ? ' '.$rstart['hour'] : ' 00'; |
|
964 | + $datevalue .= (isset($rstart['min'])) ? ':'.$rstart['min'] : ':00'; |
|
965 | + $datevalue .= (isset($rstart['sec'])) ? ':'.$rstart['sec'] : ':00'; |
|
966 | 966 | } |
967 | - $datestring = date( $startDateFormat, strtotime( $datevalue )); |
|
968 | - if( isset( $start['tz'] )) |
|
967 | + $datestring = date($startDateFormat, strtotime($datevalue)); |
|
968 | + if (isset($start['tz'])) |
|
969 | 969 | $datestring .= ' '.$start['tz']; |
970 | - $component2->setProperty( 'X-CURRENT-DTSTART', $datestring ); |
|
971 | - $rend = $component2->_timestamp2date(( $recurkey + $durvalue ), 6); |
|
972 | - if( $dtendExist || $dueExist ) { |
|
973 | - if( $endAllDayEvent ) { |
|
974 | - $rend2 = mktime( 0, 0, 0, $rend['month'], ($rend['day'] + 1), $rend['year'] ); |
|
975 | - $datevalue = date( 'm', $rend2 ).'/'.date( 'd', $rend2 ).'/'.date( 'Y', $rend2 ); |
|
970 | + $component2->setProperty('X-CURRENT-DTSTART', $datestring); |
|
971 | + $rend = $component2->_timestamp2date(($recurkey + $durvalue), 6); |
|
972 | + if ($dtendExist || $dueExist) { |
|
973 | + if ($endAllDayEvent) { |
|
974 | + $rend2 = mktime(0, 0, 0, $rend['month'], ($rend['day'] + 1), $rend['year']); |
|
975 | + $datevalue = date('m', $rend2).'/'.date('d', $rend2).'/'.date('Y', $rend2); |
|
976 | 976 | } |
977 | 977 | else { |
978 | 978 | $datevalue = $rend['month'].'/'.$rend['day'].'/'.$rend['year']; |
979 | - if( isset( $end['hour'] ) || isset( $end['min'] ) || isset( $end['sec'] )) { |
|
980 | - $datevalue .= ( isset( $rend['hour'] )) ? ' '.$rend['hour'] : ' 00'; |
|
981 | - $datevalue .= ( isset( $rend['min'] )) ? ':'.$rend['min'] : ':00'; |
|
982 | - $datevalue .= ( isset( $rend['sec'] )) ? ':'.$rend['sec'] : ':00'; |
|
979 | + if (isset($end['hour']) || isset($end['min']) || isset($end['sec'])) { |
|
980 | + $datevalue .= (isset($rend['hour'])) ? ' '.$rend['hour'] : ' 00'; |
|
981 | + $datevalue .= (isset($rend['min'])) ? ':'.$rend['min'] : ':00'; |
|
982 | + $datevalue .= (isset($rend['sec'])) ? ':'.$rend['sec'] : ':00'; |
|
983 | 983 | } |
984 | 984 | } |
985 | - $datestring = date( $endDateFormat, strtotime( $datevalue )); |
|
986 | - if( isset( $end['tz'] )) |
|
985 | + $datestring = date($endDateFormat, strtotime($datevalue)); |
|
986 | + if (isset($end['tz'])) |
|
987 | 987 | $datestring .= ' '.$end['tz']; |
988 | - if( $dtendExist ) |
|
989 | - $component2->setProperty( 'X-CURRENT-DTEND', $datestring ); |
|
990 | - elseif( $dueExist ) |
|
991 | - $component2->setProperty( 'X-CURRENT-DUE', $datestring ); |
|
988 | + if ($dtendExist) |
|
989 | + $component2->setProperty('X-CURRENT-DTEND', $datestring); |
|
990 | + elseif ($dueExist) |
|
991 | + $component2->setProperty('X-CURRENT-DUE', $datestring); |
|
992 | 992 | } |
993 | - $rend = $component2->_date2timestamp( $rend ); |
|
993 | + $rend = $component2->_date2timestamp($rend); |
|
994 | 994 | $rstart = $recurkey; |
995 | 995 | /* add repeating components within valid dates to output array, only start date */ |
996 | - if( $flat ) |
|
996 | + if ($flat) |
|
997 | 997 | $result[] = $component2->copy(); // copy to output |
998 | - elseif( $split ) { |
|
999 | - if( $rend > $endDate ) |
|
998 | + elseif ($split) { |
|
999 | + if ($rend > $endDate) |
|
1000 | 1000 | $rend = $endDate; |
1001 | - while( $rstart <= $rend ) { // iterate |
|
1002 | - $wd = getdate( $rstart ); |
|
1003 | - if(( $rstart > $startDate ) && // date after dtstart |
|
1004 | - !isset( $exdatelist[$rstart] )) // check exclude date |
|
1001 | + while ($rstart <= $rend) { // iterate |
|
1002 | + $wd = getdate($rstart); |
|
1003 | + if (($rstart > $startDate) && // date after dtstart |
|
1004 | + !isset($exdatelist[$rstart])) // check exclude date |
|
1005 | 1005 | $result[$wd['year']][$wd['mon']][$wd['mday']][] = $component2->copy(); // copy to output |
1006 | - $rstart += ( 24*60*60 ); // step one day |
|
1006 | + $rstart += (24 * 60 * 60); // step one day |
|
1007 | 1007 | } |
1008 | 1008 | } |
1009 | - elseif(( $rstart >= $startDate ) && // date within period |
|
1010 | - !isset( $exdatelist[$rstart] )) { // check exclude date |
|
1011 | - $wd = getdate( $rstart ); |
|
1009 | + elseif (($rstart >= $startDate) && // date within period |
|
1010 | + !isset($exdatelist[$rstart])) { // check exclude date |
|
1011 | + $wd = getdate($rstart); |
|
1012 | 1012 | $result[$wd['year']][$wd['mon']][$wd['mday']][] = $component2->copy(); // copy to output |
1013 | 1013 | } |
1014 | 1014 | } |
1015 | 1015 | } |
1016 | 1016 | /* deselect components with startdate/enddate not within period */ |
1017 | - if(( $endWdate < $startDate ) || ( $startWdate > $endDate )) continue; |
|
1017 | + if (($endWdate < $startDate) || ($startWdate > $endDate)) continue; |
|
1018 | 1018 | } |
1019 | 1019 | /* deselect components with startdate not within period */ |
1020 | - elseif(( $startWdate < $startDate ) || ( $startWdate > $endDate )) continue; |
|
1020 | + elseif (($startWdate < $startDate) || ($startWdate > $endDate)) continue; |
|
1021 | 1021 | /* add selected components within valid dates to output array */ |
1022 | - if( $flat ) |
|
1022 | + if ($flat) |
|
1023 | 1023 | $result[] = $component->copy(); // copy to output; |
1024 | - elseif( $split ) { |
|
1025 | - if( $endWdate > $endDate ) |
|
1026 | - $endWdate = $endDate; // use period end date |
|
1027 | - if( !isset( $exdatelist[$startWdate] )) { // check excluded dates |
|
1028 | - if( $startWdate < $startDate ) |
|
1024 | + elseif ($split) { |
|
1025 | + if ($endWdate > $endDate) |
|
1026 | + $endWdate = $endDate; // use period end date |
|
1027 | + if (!isset($exdatelist[$startWdate])) { // check excluded dates |
|
1028 | + if ($startWdate < $startDate) |
|
1029 | 1029 | $startWdate = $startDate; // use period start date |
1030 | - while( $startWdate <= $endWdate ) { // iterate |
|
1031 | - $wd = getdate( $startWdate ); |
|
1030 | + while ($startWdate <= $endWdate) { // iterate |
|
1031 | + $wd = getdate($startWdate); |
|
1032 | 1032 | $result[$wd['year']][$wd['mon']][$wd['mday']][] = $component->copy(); // copy to output |
1033 | - $startWdate += ( 24*60*60 ); // step one day |
|
1033 | + $startWdate += (24 * 60 * 60); // step one day |
|
1034 | 1034 | } |
1035 | 1035 | } |
1036 | 1036 | } // use component date |
1037 | - elseif( !isset( $exdatelist[$startWdate] ) && // check excluded dates |
|
1038 | - ( $startWdate >= $startDate )) { // within period |
|
1039 | - $wd = getdate( $startWdate ); |
|
1037 | + elseif (!isset($exdatelist[$startWdate]) && // check excluded dates |
|
1038 | + ($startWdate >= $startDate)) { // within period |
|
1039 | + $wd = getdate($startWdate); |
|
1040 | 1040 | $result[$wd['year']][$wd['mon']][$wd['mday']][] = $component->copy(); // copy to output |
1041 | 1041 | } |
1042 | 1042 | } |
1043 | - if( 0 >= count( $result )) return FALSE; |
|
1044 | - elseif( !$flat ) { |
|
1045 | - foreach( $result as $y => $yeararr ) { |
|
1046 | - foreach( $yeararr as $m => $montharr ) { |
|
1047 | - ksort( $result[$y][$m] ); |
|
1043 | + if (0 >= count($result)) return FALSE; |
|
1044 | + elseif (!$flat) { |
|
1045 | + foreach ($result as $y => $yeararr) { |
|
1046 | + foreach ($yeararr as $m => $montharr) { |
|
1047 | + ksort($result[$y][$m]); |
|
1048 | 1048 | } |
1049 | - ksort( $result[$y] ); |
|
1049 | + ksort($result[$y]); |
|
1050 | 1050 | } |
1051 | - ksort( $result ); |
|
1051 | + ksort($result); |
|
1052 | 1052 | } |
1053 | 1053 | return $result; |
1054 | 1054 | } |
@@ -1062,48 +1062,48 @@ discard block |
||
1062 | 1062 | * @param mixed $arg2 optional, ordno if arg1 = component type |
1063 | 1063 | * @return void |
1064 | 1064 | */ |
1065 | - function setComponent( $component, $arg1=FALSE, $arg2=FALSE ) { |
|
1066 | - if( '' >= $component->getConfig( 'language')) |
|
1067 | - $component->setConfig( 'language', $this->getConfig( 'language' )); |
|
1068 | - $component->setConfig( 'allowEmpty', $this->getConfig( 'allowEmpty' )); |
|
1069 | - $component->setConfig( 'nl', $this->getConfig( 'nl' )); |
|
1070 | - $component->setConfig( 'unique_id', $this->getConfig( 'unique_id' )); |
|
1071 | - $component->setConfig( 'format', $this->getConfig( 'format' )); |
|
1072 | - if( !in_array( $component->objName, array( 'valarm', 'vtimezone' ))) { |
|
1073 | - unset( $component->propix ); |
|
1065 | + function setComponent($component, $arg1 = FALSE, $arg2 = FALSE) { |
|
1066 | + if ('' >= $component->getConfig('language')) |
|
1067 | + $component->setConfig('language', $this->getConfig('language')); |
|
1068 | + $component->setConfig('allowEmpty', $this->getConfig('allowEmpty')); |
|
1069 | + $component->setConfig('nl', $this->getConfig('nl')); |
|
1070 | + $component->setConfig('unique_id', $this->getConfig('unique_id')); |
|
1071 | + $component->setConfig('format', $this->getConfig('format')); |
|
1072 | + if (!in_array($component->objName, array('valarm', 'vtimezone'))) { |
|
1073 | + unset($component->propix); |
|
1074 | 1074 | /* make sure dtstamp and uid is set */ |
1075 | - $dummy1 = $component->getProperty( 'dtstamp' ); |
|
1076 | - $dummy2 = $component->getProperty( 'uid' ); |
|
1075 | + $dummy1 = $component->getProperty('dtstamp'); |
|
1076 | + $dummy2 = $component->getProperty('uid'); |
|
1077 | 1077 | } |
1078 | - if( !$arg1 ) { |
|
1078 | + if (!$arg1) { |
|
1079 | 1079 | $this->components[] = $component->copy(); |
1080 | 1080 | return TRUE; |
1081 | 1081 | } |
1082 | 1082 | $argType = $index = null; |
1083 | - if ( ctype_digit( (string) $arg1 )) { |
|
1083 | + if (ctype_digit((string) $arg1)) { |
|
1084 | 1084 | $argType = 'INDEX'; |
1085 | 1085 | $index = (int) $arg1 - 1; |
1086 | 1086 | } |
1087 | - elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) { |
|
1088 | - $argType = strtolower( $arg1 ); |
|
1089 | - $index = ( ctype_digit( (string) $arg2 )) ? ((int) $arg2) - 1 : 0; |
|
1087 | + elseif ((strlen($arg1) <= strlen('vfreebusy')) && (FALSE === strpos($arg1, '@'))) { |
|
1088 | + $argType = strtolower($arg1); |
|
1089 | + $index = (ctype_digit((string) $arg2)) ? ((int) $arg2) - 1 : 0; |
|
1090 | 1090 | } |
1091 | 1091 | $cix1sC = 0; |
1092 | - foreach ( $this->components as $cix => $component2) { |
|
1093 | - if( empty( $component2 )) continue; |
|
1094 | - unset( $component2->propix ); |
|
1095 | - if(( 'INDEX' == $argType ) && ( $index == $cix )) { |
|
1092 | + foreach ($this->components as $cix => $component2) { |
|
1093 | + if (empty($component2)) continue; |
|
1094 | + unset($component2->propix); |
|
1095 | + if (('INDEX' == $argType) && ($index == $cix)) { |
|
1096 | 1096 | $this->components[$cix] = $component->copy(); |
1097 | 1097 | return TRUE; |
1098 | 1098 | } |
1099 | - elseif( $argType == $component2->objName ) { |
|
1100 | - if( $index == $cix1sC ) { |
|
1099 | + elseif ($argType == $component2->objName) { |
|
1100 | + if ($index == $cix1sC) { |
|
1101 | 1101 | $this->components[$cix] = $component->copy(); |
1102 | 1102 | return TRUE; |
1103 | 1103 | } |
1104 | 1104 | $cix1sC++; |
1105 | 1105 | } |
1106 | - elseif( !$argType && ( $arg1 == $component2->getProperty( 'uid' ))) { |
|
1106 | + elseif (!$argType && ($arg1 == $component2->getProperty('uid'))) { |
|
1107 | 1107 | $this->components[$cix] = $component->copy(); |
1108 | 1108 | return TRUE; |
1109 | 1109 | } |
@@ -1124,79 +1124,79 @@ discard block |
||
1124 | 1124 | * |
1125 | 1125 | */ |
1126 | 1126 | function sort() { |
1127 | - if( is_array( $this->components )) { |
|
1128 | - $this->_sortkeys = array( 'year', 'month', 'day', 'hour', 'min', 'sec' ); |
|
1129 | - usort( $this->components, array( $this, '_cmpfcn' )); |
|
1130 | - } |
|
1131 | - } |
|
1132 | - function _cmpfcn( $a, $b ) { |
|
1133 | - if( empty( $a )) return -1; |
|
1134 | - if( empty( $b )) return 1; |
|
1135 | - if( 'vtimezone' == $a->objName) return -1; |
|
1136 | - if( 'vtimezone' == $b->objName) return 1; |
|
1137 | - $astart = ( isset( $a->xprop['X-CURRENT-DTSTART']['value'] )) ? $a->_date_time_string( $a->xprop['X-CURRENT-DTSTART']['value'] ) : null; |
|
1138 | - if( empty( $astart ) && isset( $a->dtstart['value'] )) |
|
1127 | + if (is_array($this->components)) { |
|
1128 | + $this->_sortkeys = array('year', 'month', 'day', 'hour', 'min', 'sec'); |
|
1129 | + usort($this->components, array($this, '_cmpfcn')); |
|
1130 | + } |
|
1131 | + } |
|
1132 | + function _cmpfcn($a, $b) { |
|
1133 | + if (empty($a)) return -1; |
|
1134 | + if (empty($b)) return 1; |
|
1135 | + if ('vtimezone' == $a->objName) return -1; |
|
1136 | + if ('vtimezone' == $b->objName) return 1; |
|
1137 | + $astart = (isset($a->xprop['X-CURRENT-DTSTART']['value'])) ? $a->_date_time_string($a->xprop['X-CURRENT-DTSTART']['value']) : null; |
|
1138 | + if (empty($astart) && isset($a->dtstart['value'])) |
|
1139 | 1139 | $astart = & $a->dtstart['value']; |
1140 | - $bstart = ( isset( $b->xprop['X-CURRENT-DTSTART']['value'] )) ? $b->_date_time_string( $b->xprop['X-CURRENT-DTSTART']['value'] ) : null; |
|
1141 | - if( empty( $bstart ) && isset( $b->dtstart['value'] )) |
|
1140 | + $bstart = (isset($b->xprop['X-CURRENT-DTSTART']['value'])) ? $b->_date_time_string($b->xprop['X-CURRENT-DTSTART']['value']) : null; |
|
1141 | + if (empty($bstart) && isset($b->dtstart['value'])) |
|
1142 | 1142 | $bstart = & $b->dtstart['value']; |
1143 | - if( empty( $astart )) return -1; |
|
1144 | - elseif( empty( $bstart )) return 1; |
|
1145 | - foreach( $this->_sortkeys as $key ) { |
|
1146 | - if ( empty( $astart[$key] )) return -1; |
|
1147 | - elseif( empty( $bstart[$key] )) return 1; |
|
1148 | - if ( $astart[$key] == $bstart[$key]) continue; |
|
1149 | - if (( (int) $astart[$key] ) < ((int) $bstart[$key] )) |
|
1143 | + if (empty($astart)) return -1; |
|
1144 | + elseif (empty($bstart)) return 1; |
|
1145 | + foreach ($this->_sortkeys as $key) { |
|
1146 | + if (empty($astart[$key])) return -1; |
|
1147 | + elseif (empty($bstart[$key])) return 1; |
|
1148 | + if ($astart[$key] == $bstart[$key]) continue; |
|
1149 | + if (((int) $astart[$key]) < ((int) $bstart[$key])) |
|
1150 | 1150 | return -1; |
1151 | - elseif(( (int) $astart[$key] ) > ((int) $bstart[$key] )) |
|
1151 | + elseif (((int) $astart[$key]) > ((int) $bstart[$key])) |
|
1152 | 1152 | return 1; |
1153 | 1153 | } |
1154 | - $c = ( isset( $a->xprop['X-CURRENT-DTEND']['value'] )) ? $a->_date_time_string( $a->xprop['X-CURRENT-DTEND']['value'] ) : null; |
|
1155 | - if( empty( $c ) && !empty( $a->dtend['value'] )) |
|
1154 | + $c = (isset($a->xprop['X-CURRENT-DTEND']['value'])) ? $a->_date_time_string($a->xprop['X-CURRENT-DTEND']['value']) : null; |
|
1155 | + if (empty($c) && !empty($a->dtend['value'])) |
|
1156 | 1156 | $c = & $a->dtend['value']; |
1157 | - if( empty( $c ) && isset( $a->xprop['X-CURRENT-DUE']['value'] )) |
|
1158 | - $c = $a->_date_time_string( $a->xprop['X-CURRENT-DUE']['value'] ); |
|
1159 | - if( empty( $c ) && !empty( $a->due['value'] )) |
|
1157 | + if (empty($c) && isset($a->xprop['X-CURRENT-DUE']['value'])) |
|
1158 | + $c = $a->_date_time_string($a->xprop['X-CURRENT-DUE']['value']); |
|
1159 | + if (empty($c) && !empty($a->due['value'])) |
|
1160 | 1160 | $c = & $a->due['value']; |
1161 | - if( empty( $c ) && !empty( $a->duration['value'] )) |
|
1161 | + if (empty($c) && !empty($a->duration['value'])) |
|
1162 | 1162 | $c = $a->duration2date(); |
1163 | - $d = ( isset( $b->xprop['X-CURRENT-DTEND']['value'] )) ? $b->_date_time_string( $b->xprop['X-CURRENT-DTEND']['value'] ) : null; |
|
1164 | - if( empty( $d ) && !empty( $b->dtend['value'] )) |
|
1163 | + $d = (isset($b->xprop['X-CURRENT-DTEND']['value'])) ? $b->_date_time_string($b->xprop['X-CURRENT-DTEND']['value']) : null; |
|
1164 | + if (empty($d) && !empty($b->dtend['value'])) |
|
1165 | 1165 | $d = & $b->dtend['value']; |
1166 | - if( empty( $d ) && isset( $b->xprop['X-CURRENT-DUE']['value'] )) |
|
1167 | - $d = $b->_date_time_string( $b->xprop['X-CURRENT-DUE']['value'] ); |
|
1168 | - if( empty( $d ) && !empty( $b->due['value'] )) |
|
1166 | + if (empty($d) && isset($b->xprop['X-CURRENT-DUE']['value'])) |
|
1167 | + $d = $b->_date_time_string($b->xprop['X-CURRENT-DUE']['value']); |
|
1168 | + if (empty($d) && !empty($b->due['value'])) |
|
1169 | 1169 | $d = & $b->due['value']; |
1170 | - if( empty( $d ) && !empty( $b->duration['value'] )) |
|
1170 | + if (empty($d) && !empty($b->duration['value'])) |
|
1171 | 1171 | $d = $b->duration2date(); |
1172 | - if( empty( $c )) return -1; |
|
1173 | - elseif( empty( $d )) return 1; |
|
1174 | - foreach( $this->_sortkeys as $key ) { |
|
1175 | - if ( !isset( $c[$key] )) return -1; |
|
1176 | - elseif( !isset( $d[$key] )) return 1; |
|
1177 | - if ( $c[$key] == $d[$key] ) continue; |
|
1178 | - if (( (int) $c[$key] ) < ((int) $d[$key])) return -1; |
|
1179 | - elseif(( (int) $c[$key] ) > ((int) $d[$key])) return 1; |
|
1180 | - } |
|
1181 | - if( isset( $a->created['value'] )) |
|
1172 | + if (empty($c)) return -1; |
|
1173 | + elseif (empty($d)) return 1; |
|
1174 | + foreach ($this->_sortkeys as $key) { |
|
1175 | + if (!isset($c[$key])) return -1; |
|
1176 | + elseif (!isset($d[$key])) return 1; |
|
1177 | + if ($c[$key] == $d[$key]) continue; |
|
1178 | + if (((int) $c[$key]) < ((int) $d[$key])) return -1; |
|
1179 | + elseif (((int) $c[$key]) > ((int) $d[$key])) return 1; |
|
1180 | + } |
|
1181 | + if (isset($a->created['value'])) |
|
1182 | 1182 | $e = & $a->created['value']; |
1183 | 1183 | else |
1184 | 1184 | $e = & $a->dtstamp['value']; |
1185 | - if( isset( $b->created['value'] )) |
|
1185 | + if (isset($b->created['value'])) |
|
1186 | 1186 | $f = & $b->created['value']; |
1187 | 1187 | else |
1188 | 1188 | $f = & $b->dtstamp['value']; |
1189 | - foreach( $this->_sortkeys as $key ) { |
|
1190 | - if( !isset( $e[$key] )) return -1; |
|
1191 | - elseif( !isset( $f[$key] )) return 1; |
|
1192 | - if ( $e[$key] == $f[$key] ) continue; |
|
1193 | - if (( (int) $e[$key] ) < ((int) $f[$key])) return -1; |
|
1194 | - elseif(( (int) $e[$key] ) > ((int) $f[$key])) return 1; |
|
1195 | - } |
|
1196 | - if (( $a->uid['value'] ) < |
|
1197 | - ( $b->uid['value'] )) return -1; |
|
1198 | - elseif(( $a->uid['value'] ) > |
|
1199 | - ( $b->uid['value'] )) return 1; |
|
1189 | + foreach ($this->_sortkeys as $key) { |
|
1190 | + if (!isset($e[$key])) return -1; |
|
1191 | + elseif (!isset($f[$key])) return 1; |
|
1192 | + if ($e[$key] == $f[$key]) continue; |
|
1193 | + if (((int) $e[$key]) < ((int) $f[$key])) return -1; |
|
1194 | + elseif (((int) $e[$key]) > ((int) $f[$key])) return 1; |
|
1195 | + } |
|
1196 | + if (($a->uid['value']) < |
|
1197 | + ($b->uid['value'])) return -1; |
|
1198 | + elseif (($a->uid['value']) > |
|
1199 | + ($b->uid['value'])) return 1; |
|
1200 | 1200 | return 0; |
1201 | 1201 | } |
1202 | 1202 | /** |
@@ -1208,104 +1208,104 @@ discard block |
||
1208 | 1208 | * @return bool FALSE if error occurs during parsing |
1209 | 1209 | * |
1210 | 1210 | */ |
1211 | - function parse( $filename=FALSE ) { |
|
1212 | - if( !$filename ) { |
|
1211 | + function parse($filename = FALSE) { |
|
1212 | + if (!$filename) { |
|
1213 | 1213 | /* directory/filename previous set via setConfig directory+filename / url */ |
1214 | - if( FALSE === ( $filename = $this->getConfig( 'url' ))) |
|
1215 | - $filename = $this->getConfig( 'dirfile' ); |
|
1214 | + if (FALSE === ($filename = $this->getConfig('url'))) |
|
1215 | + $filename = $this->getConfig('dirfile'); |
|
1216 | 1216 | } |
1217 | - elseif(( 'http://' == strtolower( substr( $filename, 0, 7 ))) || |
|
1218 | - ( 'webcal://' == strtolower( substr( $filename, 0, 9 )))) { |
|
1217 | + elseif (('http://' == strtolower(substr($filename, 0, 7))) || |
|
1218 | + ('webcal://' == strtolower(substr($filename, 0, 9)))) { |
|
1219 | 1219 | /* remote file - URL */ |
1220 | - $this->setConfig( 'URL', $filename ); |
|
1221 | - if( !$filename = $this->getConfig( 'url' )) |
|
1222 | - return FALSE; /* err 2 */ |
|
1220 | + $this->setConfig('URL', $filename); |
|
1221 | + if (!$filename = $this->getConfig('url')) |
|
1222 | + return FALSE; /* err 2 */ |
|
1223 | 1223 | } |
1224 | 1224 | else { |
1225 | 1225 | /* local directory/filename */ |
1226 | - $parts = pathinfo( $filename ); |
|
1227 | - if( !empty( $parts['dirname'] ) && ( '.' != $parts['dirname'] )) { |
|
1228 | - if( !$this->setConfig( 'directory', $parts['dirname'] )) |
|
1229 | - return FALSE; /* err 3 */ |
|
1226 | + $parts = pathinfo($filename); |
|
1227 | + if (!empty($parts['dirname']) && ('.' != $parts['dirname'])) { |
|
1228 | + if (!$this->setConfig('directory', $parts['dirname'])) |
|
1229 | + return FALSE; /* err 3 */ |
|
1230 | 1230 | } |
1231 | - if( !$this->setConfig( 'filename', $parts['basename'] )) |
|
1232 | - return FALSE; /* err 4 */ |
|
1231 | + if (!$this->setConfig('filename', $parts['basename'])) |
|
1232 | + return FALSE; /* err 4 */ |
|
1233 | 1233 | } |
1234 | - if( 'http://' != substr( $filename, 0, 7 )) { |
|
1234 | + if ('http://' != substr($filename, 0, 7)) { |
|
1235 | 1235 | /* local file error tests */ |
1236 | - if( !is_file( $filename )) /* err 5 */ |
|
1236 | + if (!is_file($filename)) /* err 5 */ |
|
1237 | 1237 | return FALSE; |
1238 | - if( !is_readable( $filename )) |
|
1239 | - return FALSE; /* err 6 */ |
|
1240 | - if( !filesize( $filename )) |
|
1241 | - return FALSE; /* err 7 */ |
|
1238 | + if (!is_readable($filename)) |
|
1239 | + return FALSE; /* err 6 */ |
|
1240 | + if (!filesize($filename)) |
|
1241 | + return FALSE; /* err 7 */ |
|
1242 | 1242 | clearstatcache(); |
1243 | 1243 | } |
1244 | 1244 | /* READ FILE */ |
1245 | - if( FALSE === ( $rows = file( $filename ))) |
|
1246 | - return FALSE; /* err 1 */ |
|
1245 | + if (FALSE === ($rows = file($filename))) |
|
1246 | + return FALSE; /* err 1 */ |
|
1247 | 1247 | /* identify BEGIN:VCALENDAR, MUST be first row */ |
1248 | - if( 'BEGIN:VCALENDAR' != strtoupper( trim( $rows[0] ))) |
|
1249 | - return FALSE; /* err 8 */ |
|
1248 | + if ('BEGIN:VCALENDAR' != strtoupper(trim($rows[0]))) |
|
1249 | + return FALSE; /* err 8 */ |
|
1250 | 1250 | /* remove empty trailing lines */ |
1251 | - while( '' == trim( $rows[count( $rows ) - 1] )) { |
|
1252 | - unset( $rows[count( $rows ) - 1] ); |
|
1253 | - $rows = array_values( $rows ); |
|
1251 | + while ('' == trim($rows[count($rows) - 1])) { |
|
1252 | + unset($rows[count($rows) - 1]); |
|
1253 | + $rows = array_values($rows); |
|
1254 | 1254 | } |
1255 | 1255 | /* identify ending END:VCALENDAR row */ |
1256 | - if( 'END:VCALENDAR' != strtoupper( trim( $rows[count( $rows ) - 1] ))) { |
|
1257 | - return FALSE; /* err 9 */ |
|
1256 | + if ('END:VCALENDAR' != strtoupper(trim($rows[count($rows) - 1]))) { |
|
1257 | + return FALSE; /* err 9 */ |
|
1258 | 1258 | } |
1259 | - if( 3 > count( $rows )) |
|
1260 | - return FALSE; /* err 10 */ |
|
1259 | + if (3 > count($rows)) |
|
1260 | + return FALSE; /* err 10 */ |
|
1261 | 1261 | $comp = $subcomp = null; |
1262 | 1262 | $actcomp = & $this; |
1263 | - $nl = $this->getConfig( 'nl' ); |
|
1263 | + $nl = $this->getConfig('nl'); |
|
1264 | 1264 | $calsync = 0; |
1265 | 1265 | /* identify components and update unparsed data within component */ |
1266 | - foreach( $rows as $line ) { |
|
1267 | - if( '' == trim( $line )) |
|
1266 | + foreach ($rows as $line) { |
|
1267 | + if ('' == trim($line)) |
|
1268 | 1268 | continue; |
1269 | - if( $nl == substr( $line, 0 - strlen( $nl ))) |
|
1270 | - $line = substr( $line, 0, ( strlen( $line ) - strlen( $nl ))).'\n'; |
|
1271 | - if( 'BEGIN:VCALENDAR' == strtoupper( substr( $line, 0, 15 ))) { |
|
1269 | + if ($nl == substr($line, 0 - strlen($nl))) |
|
1270 | + $line = substr($line, 0, (strlen($line) - strlen($nl))).'\n'; |
|
1271 | + if ('BEGIN:VCALENDAR' == strtoupper(substr($line, 0, 15))) { |
|
1272 | 1272 | $calsync++; |
1273 | 1273 | continue; |
1274 | 1274 | } |
1275 | - elseif( 'END:VCALENDAR' == strtoupper( substr( $line, 0, 13 ))) { |
|
1275 | + elseif ('END:VCALENDAR' == strtoupper(substr($line, 0, 13))) { |
|
1276 | 1276 | $calsync--; |
1277 | 1277 | continue; |
1278 | 1278 | } |
1279 | - elseif( 1 != $calsync ) |
|
1280 | - return FALSE; /* err 20 */ |
|
1281 | - if( 'END:' == strtoupper( substr( $line, 0, 4 ))) { |
|
1282 | - if( null != $subcomp ) { |
|
1283 | - $comp->setComponent( $subcomp ); |
|
1279 | + elseif (1 != $calsync) |
|
1280 | + return FALSE; /* err 20 */ |
|
1281 | + if ('END:' == strtoupper(substr($line, 0, 4))) { |
|
1282 | + if (null != $subcomp) { |
|
1283 | + $comp->setComponent($subcomp); |
|
1284 | 1284 | $subcomp = null; |
1285 | 1285 | } |
1286 | 1286 | else { |
1287 | - $this->setComponent( $comp ); |
|
1287 | + $this->setComponent($comp); |
|
1288 | 1288 | $comp = null; |
1289 | 1289 | } |
1290 | 1290 | $actcomp = null; |
1291 | 1291 | continue; |
1292 | 1292 | } // end - if ( 'END:' ==.. . |
1293 | - elseif( 'BEGIN:' == strtoupper( substr( $line, 0, 6 ))) { |
|
1294 | - $line = str_replace( '\n', '', $line ); |
|
1295 | - $compname = trim (strtoupper( substr( $line, 6 ))); |
|
1296 | - if( null != $comp ) { |
|
1297 | - if( 'VALARM' == $compname ) |
|
1293 | + elseif ('BEGIN:' == strtoupper(substr($line, 0, 6))) { |
|
1294 | + $line = str_replace('\n', '', $line); |
|
1295 | + $compname = trim(strtoupper(substr($line, 6))); |
|
1296 | + if (null != $comp) { |
|
1297 | + if ('VALARM' == $compname) |
|
1298 | 1298 | $subcomp = new valarm(); |
1299 | - elseif( 'STANDARD' == $compname ) |
|
1300 | - $subcomp = new vtimezone( 'STANDARD' ); |
|
1301 | - elseif( 'DAYLIGHT' == $compname ) |
|
1302 | - $subcomp = new vtimezone( 'DAYLIGHT' ); |
|
1299 | + elseif ('STANDARD' == $compname) |
|
1300 | + $subcomp = new vtimezone('STANDARD'); |
|
1301 | + elseif ('DAYLIGHT' == $compname) |
|
1302 | + $subcomp = new vtimezone('DAYLIGHT'); |
|
1303 | 1303 | else |
1304 | 1304 | return FALSE; /* err 6 */ |
1305 | 1305 | $actcomp = & $subcomp; |
1306 | 1306 | } |
1307 | 1307 | else { |
1308 | - switch( $compname ) { |
|
1308 | + switch ($compname) { |
|
1309 | 1309 | case 'VALARM': |
1310 | 1310 | $comp = new valarm(); |
1311 | 1311 | break; |
@@ -1336,74 +1336,74 @@ discard block |
||
1336 | 1336 | $actcomp->unparsed[] = $line; |
1337 | 1337 | } // end - foreach( rows.. . |
1338 | 1338 | /* parse data for calendar (this) object */ |
1339 | - if( is_array( $this->unparsed ) && ( 0 < count( $this->unparsed ))) { |
|
1339 | + if (is_array($this->unparsed) && (0 < count($this->unparsed))) { |
|
1340 | 1340 | /* concatenate property values spread over several lines */ |
1341 | 1341 | $lastix = -1; |
1342 | - $propnames = array( 'calscale','method','prodid','version','x-' ); |
|
1342 | + $propnames = array('calscale', 'method', 'prodid', 'version', 'x-'); |
|
1343 | 1343 | $proprows = array(); |
1344 | - foreach( $this->unparsed as $line ) { |
|
1344 | + foreach ($this->unparsed as $line) { |
|
1345 | 1345 | $newProp = FALSE; |
1346 | - foreach ( $propnames as $propname ) { |
|
1347 | - if( $propname == strtolower( substr( $line, 0, strlen( $propname )))) { |
|
1346 | + foreach ($propnames as $propname) { |
|
1347 | + if ($propname == strtolower(substr($line, 0, strlen($propname)))) { |
|
1348 | 1348 | $newProp = TRUE; |
1349 | 1349 | break; |
1350 | 1350 | } |
1351 | 1351 | } |
1352 | - if( $newProp ) { |
|
1352 | + if ($newProp) { |
|
1353 | 1353 | $newProp = FALSE; |
1354 | 1354 | $lastix++; |
1355 | - $proprows[$lastix] = $line; |
|
1355 | + $proprows[$lastix] = $line; |
|
1356 | 1356 | } |
1357 | 1357 | else { |
1358 | 1358 | /* remove line breaks */ |
1359 | - if(( '\n' == substr( $proprows[$lastix], -2 )) && |
|
1360 | - ( ' ' == substr( $line, 0, 1 ))) { |
|
1361 | - $proprows[$lastix] = substr( $proprows[$lastix], 0, strlen( $proprows[$lastix] ) - 2 ); |
|
1362 | - $line = substr( $line, 1 ); |
|
1359 | + if (('\n' == substr($proprows[$lastix], -2)) && |
|
1360 | + (' ' == substr($line, 0, 1))) { |
|
1361 | + $proprows[$lastix] = substr($proprows[$lastix], 0, strlen($proprows[$lastix]) - 2); |
|
1362 | + $line = substr($line, 1); |
|
1363 | 1363 | } |
1364 | 1364 | $proprows[$lastix] .= $line; |
1365 | 1365 | } |
1366 | 1366 | } |
1367 | 1367 | $toolbox = new calendarComponent(); |
1368 | - foreach( $proprows as $line ) { |
|
1369 | - if( '\n' == substr( $line, -2 )) |
|
1370 | - $line = substr( $line, 0, strlen( $line ) - 2 ); |
|
1368 | + foreach ($proprows as $line) { |
|
1369 | + if ('\n' == substr($line, -2)) |
|
1370 | + $line = substr($line, 0, strlen($line) - 2); |
|
1371 | 1371 | /* get propname */ |
1372 | 1372 | $cix = $propname = null; |
1373 | - for( $cix=0; $cix < strlen( $line ); $cix++ ) { |
|
1374 | - if( in_array( $line{$cix}, array( ':', ';' ))) |
|
1373 | + for ($cix = 0; $cix < strlen($line); $cix++) { |
|
1374 | + if (in_array($line{$cix}, array(':', ';'))) |
|
1375 | 1375 | break; |
1376 | 1376 | else |
1377 | 1377 | $propname .= $line{$cix}; |
1378 | 1378 | } |
1379 | 1379 | /* ignore version/prodid properties */ |
1380 | - if( in_array( strtoupper( $propname ), array( 'VERSION', 'PRODID' ))) |
|
1380 | + if (in_array(strtoupper($propname), array('VERSION', 'PRODID'))) |
|
1381 | 1381 | continue; |
1382 | - $line = substr( $line, $cix); |
|
1382 | + $line = substr($line, $cix); |
|
1383 | 1383 | /* separate attributes from value */ |
1384 | 1384 | $attr = array(); |
1385 | 1385 | $attrix = -1; |
1386 | - $strlen = strlen( $line ); |
|
1387 | - for( $cix=0; $cix < $strlen; $cix++ ) { |
|
1388 | - if(( ':' == $line{$cix} ) && |
|
1389 | - ( '://' != substr( $line, $cix, 3 )) && |
|
1390 | - ( 'mailto:' != strtolower( substr( $line, $cix - 6, 7 )))) { |
|
1386 | + $strlen = strlen($line); |
|
1387 | + for ($cix = 0; $cix < $strlen; $cix++) { |
|
1388 | + if ((':' == $line{$cix} ) && |
|
1389 | + ('://' != substr($line, $cix, 3)) && |
|
1390 | + ('mailto:' != strtolower(substr($line, $cix - 6, 7)))) { |
|
1391 | 1391 | $attrEnd = TRUE; |
1392 | - if(( $cix < ( $strlen - 4 )) && |
|
1393 | - ctype_digit( substr( $line, $cix+1, 4 ))) { // an URI with a (4pos) portnr?? |
|
1394 | - for( $c2ix = $cix; 3 < $c2ix; $c2ix-- ) { |
|
1395 | - if( '://' == substr( $line, $c2ix - 2, 3 )) { |
|
1392 | + if (($cix < ($strlen - 4)) && |
|
1393 | + ctype_digit(substr($line, $cix + 1, 4))) { // an URI with a (4pos) portnr?? |
|
1394 | + for ($c2ix = $cix; 3 < $c2ix; $c2ix--) { |
|
1395 | + if ('://' == substr($line, $c2ix - 2, 3)) { |
|
1396 | 1396 | $attrEnd = FALSE; |
1397 | 1397 | break; // an URI with a portnr!! |
1398 | 1398 | } |
1399 | 1399 | } |
1400 | 1400 | } |
1401 | - if( $attrEnd) { |
|
1402 | - $line = substr( $line, $cix + 1 ); |
|
1401 | + if ($attrEnd) { |
|
1402 | + $line = substr($line, $cix + 1); |
|
1403 | 1403 | break; |
1404 | 1404 | } |
1405 | 1405 | } |
1406 | - if( ';' == $line{$cix} ) |
|
1406 | + if (';' == $line{$cix} ) |
|
1407 | 1407 | $attr[++$attrix] = null; |
1408 | 1408 | else |
1409 | 1409 | $attr[$attrix] .= $line{$cix}; |
@@ -1411,46 +1411,46 @@ discard block |
||
1411 | 1411 | |
1412 | 1412 | /* make attributes in array format */ |
1413 | 1413 | $propattr = array(); |
1414 | - foreach( $attr as $attribute ) { |
|
1415 | - $attrsplit = explode( '=', $attribute, 2 ); |
|
1416 | - if( 1 < count( $attrsplit )) |
|
1414 | + foreach ($attr as $attribute) { |
|
1415 | + $attrsplit = explode('=', $attribute, 2); |
|
1416 | + if (1 < count($attrsplit)) |
|
1417 | 1417 | $propattr[$attrsplit[0]] = $attrsplit[1]; |
1418 | 1418 | else |
1419 | 1419 | $propattr[] = $attribute; |
1420 | 1420 | } |
1421 | 1421 | /* update Property */ |
1422 | - if( FALSE !== strpos( $line, ',' )) { |
|
1423 | - $content = explode( ',', $line ); |
|
1424 | - $clen = count( $content ); |
|
1425 | - for( $cix = 0; $cix < $clen; $cix++ ) { |
|
1426 | - if( "\\" == substr( $content[$cix], -1 )) { |
|
1422 | + if (FALSE !== strpos($line, ',')) { |
|
1423 | + $content = explode(',', $line); |
|
1424 | + $clen = count($content); |
|
1425 | + for ($cix = 0; $cix < $clen; $cix++) { |
|
1426 | + if ("\\" == substr($content[$cix], -1)) { |
|
1427 | 1427 | $content[$cix] .= ','.$content[$cix + 1]; |
1428 | - unset( $content[$cix + 1] ); |
|
1428 | + unset($content[$cix + 1]); |
|
1429 | 1429 | $cix++; |
1430 | 1430 | } |
1431 | 1431 | } |
1432 | - if( 1 < count( $content )) { |
|
1433 | - foreach( $content as $cix => $contentPart ) |
|
1434 | - $content[$cix] = $toolbox->_strunrep( $contentPart ); |
|
1435 | - $this->setProperty( $propname, $content, $propattr ); |
|
1432 | + if (1 < count($content)) { |
|
1433 | + foreach ($content as $cix => $contentPart) |
|
1434 | + $content[$cix] = $toolbox->_strunrep($contentPart); |
|
1435 | + $this->setProperty($propname, $content, $propattr); |
|
1436 | 1436 | continue; |
1437 | 1437 | } |
1438 | 1438 | else |
1439 | - $line = reset( $content ); |
|
1440 | - $line = $toolbox->_strunrep( $line ); |
|
1439 | + $line = reset($content); |
|
1440 | + $line = $toolbox->_strunrep($line); |
|
1441 | 1441 | } |
1442 | - $this->setProperty( $propname, trim( $line ), $propattr ); |
|
1442 | + $this->setProperty($propname, trim($line), $propattr); |
|
1443 | 1443 | } // end - foreach( $this->unparsed.. . |
1444 | 1444 | } // end - if( is_array( $this->unparsed.. . |
1445 | 1445 | /* parse Components */ |
1446 | - if( is_array( $this->components ) && ( 0 < count( $this->components ))) { |
|
1447 | - for( $six = 0; $six < count( $this->components ); $six++ ) { |
|
1448 | - if( !empty( $this->components[$six] )) |
|
1446 | + if (is_array($this->components) && (0 < count($this->components))) { |
|
1447 | + for ($six = 0; $six < count($this->components); $six++) { |
|
1448 | + if (!empty($this->components[$six])) |
|
1449 | 1449 | $this->components[$six]->parse(); |
1450 | 1450 | } |
1451 | 1451 | } |
1452 | 1452 | else |
1453 | - return FALSE; /* err 91 or something.. . */ |
|
1453 | + return FALSE; /* err 91 or something.. . */ |
|
1454 | 1454 | return TRUE; |
1455 | 1455 | } |
1456 | 1456 | /*********************************************************************************/ |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | */ |
1464 | 1464 | function createCalendar() { |
1465 | 1465 | $calendarInit1 = $calendarInit2 = $calendarxCaldecl = $calendarStart = $calendar = null; |
1466 | - switch( $this->format ) { |
|
1466 | + switch ($this->format) { |
|
1467 | 1467 | case 'xcal': |
1468 | 1468 | $calendarInit1 = '<?xml version="1.0" encoding="UTF-8"?>'.$this->nl. |
1469 | 1469 | '<!DOCTYPE iCalendar PUBLIC "-//IETF//DTD XCAL/iCalendar XML//EN"'.$this->nl. |
@@ -1479,38 +1479,38 @@ discard block |
||
1479 | 1479 | $calendarStart .= $this->createMethod(); |
1480 | 1480 | $calendarStart .= $this->createProdid(); |
1481 | 1481 | $calendarStart .= $this->createVersion(); |
1482 | - switch( $this->format ) { |
|
1482 | + switch ($this->format) { |
|
1483 | 1483 | case 'xcal': |
1484 | - $nlstrlen = strlen( $this->nl ); |
|
1485 | - if( $this->nl == substr( $calendarStart, ( 0 - $nlstrlen ))) |
|
1486 | - $calendarStart = substr( $calendarStart, 0, ( strlen( $calendarStart ) - $nlstrlen )); |
|
1484 | + $nlstrlen = strlen($this->nl); |
|
1485 | + if ($this->nl == substr($calendarStart, (0 - $nlstrlen))) |
|
1486 | + $calendarStart = substr($calendarStart, 0, (strlen($calendarStart) - $nlstrlen)); |
|
1487 | 1487 | $calendarStart .= '>'.$this->nl; |
1488 | 1488 | break; |
1489 | 1489 | default: |
1490 | 1490 | break; |
1491 | 1491 | } |
1492 | 1492 | $calendar .= $this->createXprop(); |
1493 | - foreach( $this->components as $component ) { |
|
1494 | - if( empty( $component )) continue; |
|
1495 | - if( '' >= $component->getConfig( 'language')) |
|
1496 | - $component->setConfig( 'language', $this->getConfig( 'language' )); |
|
1497 | - $component->setConfig( 'allowEmpty', $this->getConfig( 'allowEmpty' )); |
|
1498 | - $component->setConfig( 'nl', $this->getConfig( 'nl' )); |
|
1499 | - $component->setConfig( 'unique_id', $this->getConfig( 'unique_id' )); |
|
1500 | - $component->setConfig( 'format', $this->getConfig( 'format' )); |
|
1501 | - $calendar .= $component->createComponent( $this->xcaldecl ); |
|
1502 | - } |
|
1503 | - if(( 0 < count( $this->xcaldecl )) && ( 'xcal' == $this->format )) { // xCal only |
|
1493 | + foreach ($this->components as $component) { |
|
1494 | + if (empty($component)) continue; |
|
1495 | + if ('' >= $component->getConfig('language')) |
|
1496 | + $component->setConfig('language', $this->getConfig('language')); |
|
1497 | + $component->setConfig('allowEmpty', $this->getConfig('allowEmpty')); |
|
1498 | + $component->setConfig('nl', $this->getConfig('nl')); |
|
1499 | + $component->setConfig('unique_id', $this->getConfig('unique_id')); |
|
1500 | + $component->setConfig('format', $this->getConfig('format')); |
|
1501 | + $calendar .= $component->createComponent($this->xcaldecl); |
|
1502 | + } |
|
1503 | + if ((0 < count($this->xcaldecl)) && ('xcal' == $this->format)) { // xCal only |
|
1504 | 1504 | $calendarInit1 .= $this->nl.'['.$this->nl; |
1505 | 1505 | $old_xcaldecl = array(); |
1506 | - foreach( $this->xcaldecl as $declix => $declPart ) { |
|
1507 | - if(( 0 < count( $old_xcaldecl)) && |
|
1508 | - ( in_array( $declPart['uri'], $old_xcaldecl['uri'] )) && |
|
1509 | - ( in_array( $declPart['external'], $old_xcaldecl['external'] ))) |
|
1506 | + foreach ($this->xcaldecl as $declix => $declPart) { |
|
1507 | + if ((0 < count($old_xcaldecl)) && |
|
1508 | + (in_array($declPart['uri'], $old_xcaldecl['uri'])) && |
|
1509 | + (in_array($declPart['external'], $old_xcaldecl['external']))) |
|
1510 | 1510 | continue; // no duplicate uri and ext. references |
1511 | 1511 | $calendarxCaldecl .= '<!'; |
1512 | - foreach( $declPart as $declKey => $declValue ) { |
|
1513 | - switch( $declKey ) { // index |
|
1512 | + foreach ($declPart as $declKey => $declValue) { |
|
1513 | + switch ($declKey) { // index |
|
1514 | 1514 | case 'xmldecl': // no 1 |
1515 | 1515 | $calendarxCaldecl .= $declValue.' '; |
1516 | 1516 | break; |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | } |
1538 | 1538 | $calendarInit2 = ']'.$calendarInit2; |
1539 | 1539 | } |
1540 | - switch( $this->format ) { |
|
1540 | + switch ($this->format) { |
|
1541 | 1541 | case 'xcal': |
1542 | 1542 | $calendar .= '</vcalendar>'.$this->nl; |
1543 | 1543 | break; |
@@ -1555,18 +1555,18 @@ discard block |
||
1555 | 1555 | * @return redirect |
1556 | 1556 | */ |
1557 | 1557 | function returnCalendar() { |
1558 | - $filename = $this->getConfig( 'filename' ); |
|
1558 | + $filename = $this->getConfig('filename'); |
|
1559 | 1559 | $output = $this->createCalendar(); |
1560 | - $filesize = strlen( $output ); |
|
1560 | + $filesize = strlen($output); |
|
1561 | 1561 | // if( headers_sent( $filename, $linenum )) |
1562 | 1562 | // die( "Headers already sent in $filename on line $linenum\n" ); |
1563 | - if( 'xcal' == $this->format ) |
|
1564 | - header( 'Content-Type: application/calendar+xml; charset=utf-8' ); |
|
1563 | + if ('xcal' == $this->format) |
|
1564 | + header('Content-Type: application/calendar+xml; charset=utf-8'); |
|
1565 | 1565 | else |
1566 | - header( 'Content-Type: text/calendar; charset=utf-8' ); |
|
1567 | - header( 'Content-Length: '.$filesize ); |
|
1568 | - header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |
|
1569 | - header( 'Cache-Control: max-age=10' ); |
|
1566 | + header('Content-Type: text/calendar; charset=utf-8'); |
|
1567 | + header('Content-Length: '.$filesize); |
|
1568 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
1569 | + header('Cache-Control: max-age=10'); |
|
1570 | 1570 | echo $output; |
1571 | 1571 | die(); |
1572 | 1572 | } |
@@ -1580,20 +1580,20 @@ discard block |
||
1580 | 1580 | * @param string $delimiter optional |
1581 | 1581 | * @return bool |
1582 | 1582 | */ |
1583 | - function saveCalendar( $directory=FALSE, $filename=FALSE, $delimiter=FALSE ) { |
|
1584 | - if( $directory ) |
|
1585 | - $this->setConfig( 'directory', $directory ); |
|
1586 | - if( $filename ) |
|
1587 | - $this->setConfig( 'filename', $filename ); |
|
1588 | - if( $delimiter && ($delimiter != DIRECTORY_SEPARATOR )) |
|
1589 | - $this->setConfig( 'delimiter', $delimiter ); |
|
1590 | - if( FALSE === ( $dirfile = $this->getConfig( 'url' ))) |
|
1591 | - $dirfile = $this->getConfig( 'dirfile' ); |
|
1592 | - $iCalFile = @fopen( $dirfile, 'w' ); |
|
1593 | - if( $iCalFile ) { |
|
1594 | - if( FALSE === fwrite( $iCalFile, $this->createCalendar() )) |
|
1583 | + function saveCalendar($directory = FALSE, $filename = FALSE, $delimiter = FALSE) { |
|
1584 | + if ($directory) |
|
1585 | + $this->setConfig('directory', $directory); |
|
1586 | + if ($filename) |
|
1587 | + $this->setConfig('filename', $filename); |
|
1588 | + if ($delimiter && ($delimiter != DIRECTORY_SEPARATOR)) |
|
1589 | + $this->setConfig('delimiter', $delimiter); |
|
1590 | + if (FALSE === ($dirfile = $this->getConfig('url'))) |
|
1591 | + $dirfile = $this->getConfig('dirfile'); |
|
1592 | + $iCalFile = @fopen($dirfile, 'w'); |
|
1593 | + if ($iCalFile) { |
|
1594 | + if (FALSE === fwrite($iCalFile, $this->createCalendar())) |
|
1595 | 1595 | return FALSE; |
1596 | - fclose( $iCalFile ); |
|
1596 | + fclose($iCalFile); |
|
1597 | 1597 | return TRUE; |
1598 | 1598 | } |
1599 | 1599 | else |
@@ -1611,38 +1611,38 @@ discard block |
||
1611 | 1611 | * @param int timeout optional, default 3600 sec |
1612 | 1612 | * @return redirect/FALSE |
1613 | 1613 | */ |
1614 | - function useCachedCalendar( $directory=FALSE, $filename=FALSE, $delimiter=FALSE, $timeout=3600) { |
|
1615 | - if ( $directory && ctype_digit( (string) $directory ) && !$filename ) { |
|
1614 | + function useCachedCalendar($directory = FALSE, $filename = FALSE, $delimiter = FALSE, $timeout = 3600) { |
|
1615 | + if ($directory && ctype_digit((string) $directory) && !$filename) { |
|
1616 | 1616 | $timeout = (int) $directory; |
1617 | 1617 | $directory = FALSE; |
1618 | 1618 | } |
1619 | - if( $directory ) |
|
1620 | - $this->setConfig( 'directory', $directory ); |
|
1621 | - if( $filename ) |
|
1622 | - $this->setConfig( 'filename', $filename ); |
|
1623 | - if( $delimiter && ( $delimiter != DIRECTORY_SEPARATOR )) |
|
1624 | - $this->setConfig( 'delimiter', $delimiter ); |
|
1625 | - $filesize = $this->getConfig( 'filesize' ); |
|
1626 | - if( 0 >= $filesize ) |
|
1619 | + if ($directory) |
|
1620 | + $this->setConfig('directory', $directory); |
|
1621 | + if ($filename) |
|
1622 | + $this->setConfig('filename', $filename); |
|
1623 | + if ($delimiter && ($delimiter != DIRECTORY_SEPARATOR)) |
|
1624 | + $this->setConfig('delimiter', $delimiter); |
|
1625 | + $filesize = $this->getConfig('filesize'); |
|
1626 | + if (0 >= $filesize) |
|
1627 | 1627 | return FALSE; |
1628 | - $dirfile = $this->getConfig( 'dirfile' ); |
|
1629 | - if( time() - filemtime( $dirfile ) < $timeout) { |
|
1628 | + $dirfile = $this->getConfig('dirfile'); |
|
1629 | + if (time() - filemtime($dirfile) < $timeout) { |
|
1630 | 1630 | clearstatcache(); |
1631 | - $dirfile = $this->getConfig( 'dirfile' ); |
|
1632 | - $filename = $this->getConfig( 'filename' ); |
|
1631 | + $dirfile = $this->getConfig('dirfile'); |
|
1632 | + $filename = $this->getConfig('filename'); |
|
1633 | 1633 | // if( headers_sent( $filename, $linenum )) |
1634 | 1634 | // die( "Headers already sent in $filename on line $linenum\n" ); |
1635 | - if( 'xcal' == $this->format ) |
|
1636 | - header( 'Content-Type: application/calendar+xml; charset=utf-8' ); |
|
1635 | + if ('xcal' == $this->format) |
|
1636 | + header('Content-Type: application/calendar+xml; charset=utf-8'); |
|
1637 | 1637 | else |
1638 | - header( 'Content-Type: text/calendar; charset=utf-8' ); |
|
1639 | - header( 'Content-Length: '.$filesize ); |
|
1640 | - header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |
|
1641 | - header( 'Cache-Control: max-age=10' ); |
|
1642 | - $fp = @$fopen( $dirfile, 'r' ); |
|
1643 | - if( $fp ) { |
|
1644 | - fpassthru( $fp ); |
|
1645 | - fclose( $fp ); |
|
1638 | + header('Content-Type: text/calendar; charset=utf-8'); |
|
1639 | + header('Content-Length: '.$filesize); |
|
1640 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
1641 | + header('Cache-Control: max-age=10'); |
|
1642 | + $fp = @$fopen($dirfile, 'r'); |
|
1643 | + if ($fp) { |
|
1644 | + fpassthru($fp); |
|
1645 | + fclose($fp); |
|
1646 | 1646 | } |
1647 | 1647 | die(); |
1648 | 1648 | } |
@@ -1691,8 +1691,8 @@ discard block |
||
1691 | 1691 | * @since 2.4.19 - 2008-10-23 |
1692 | 1692 | */ |
1693 | 1693 | function __construct() { |
1694 | - $this->objName = ( isset( $this->timezonetype )) ? |
|
1695 | - strtolower( $this->timezonetype ) : get_class ( $this ); |
|
1694 | + $this->objName = (isset($this->timezonetype)) ? |
|
1695 | + strtolower($this->timezonetype) : get_class($this); |
|
1696 | 1696 | $this->uid = array(); |
1697 | 1697 | $this->dtstamp = array(); |
1698 | 1698 | |
@@ -1718,11 +1718,11 @@ discard block |
||
1718 | 1718 | * @return string |
1719 | 1719 | */ |
1720 | 1720 | function createAction() { |
1721 | - if( empty( $this->action )) return FALSE; |
|
1722 | - if( empty( $this->action['value'] )) |
|
1723 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'ACTION' ) : FALSE; |
|
1724 | - $attributes = $this->_createParams( $this->action['params'] ); |
|
1725 | - return $this->_createElement( 'ACTION', $attributes, $this->action['value'] ); |
|
1721 | + if (empty($this->action)) return FALSE; |
|
1722 | + if (empty($this->action['value'])) |
|
1723 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('ACTION') : FALSE; |
|
1724 | + $attributes = $this->_createParams($this->action['params']); |
|
1725 | + return $this->_createElement('ACTION', $attributes, $this->action['value']); |
|
1726 | 1726 | } |
1727 | 1727 | /** |
1728 | 1728 | * set calendar component property action |
@@ -1733,9 +1733,9 @@ discard block |
||
1733 | 1733 | * @param mixed $params |
1734 | 1734 | * @return bool |
1735 | 1735 | */ |
1736 | - function setAction( $value, $params=FALSE ) { |
|
1737 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
1738 | - $this->action = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
1736 | + function setAction($value, $params = FALSE) { |
|
1737 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
1738 | + $this->action = array('value' => $value, 'params' => $this->_setParams($params)); |
|
1739 | 1739 | return TRUE; |
1740 | 1740 | } |
1741 | 1741 | /*********************************************************************************/ |
@@ -1750,14 +1750,14 @@ discard block |
||
1750 | 1750 | * @return string |
1751 | 1751 | */ |
1752 | 1752 | function createAttach() { |
1753 | - if( empty( $this->attach )) return FALSE; |
|
1754 | - $output = null; |
|
1755 | - foreach( $this->attach as $attachPart ) { |
|
1756 | - if(! empty( $attachPart['value'] )) { |
|
1757 | - $attributes = $this->_createParams( $attachPart['params'] ); |
|
1758 | - $output .= $this->_createElement( 'ATTACH', $attributes, $attachPart['value'] ); |
|
1753 | + if (empty($this->attach)) return FALSE; |
|
1754 | + $output = null; |
|
1755 | + foreach ($this->attach as $attachPart) { |
|
1756 | + if (!empty($attachPart['value'])) { |
|
1757 | + $attributes = $this->_createParams($attachPart['params']); |
|
1758 | + $output .= $this->_createElement('ATTACH', $attributes, $attachPart['value']); |
|
1759 | 1759 | } |
1760 | - elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'ATTACH' ); |
|
1760 | + elseif ($this->getConfig('allowEmpty')) $output .= $this->_createElement('ATTACH'); |
|
1761 | 1761 | } |
1762 | 1762 | return $output; |
1763 | 1763 | } |
@@ -1771,9 +1771,9 @@ discard block |
||
1771 | 1771 | * @param integer $index, optional |
1772 | 1772 | * @return bool |
1773 | 1773 | */ |
1774 | - function setAttach( $value, $params=FALSE, $index=FALSE ) { |
|
1775 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
1776 | - $this->_setMval( $this->attach, $value, $params, FALSE, $index ); |
|
1774 | + function setAttach($value, $params = FALSE, $index = FALSE) { |
|
1775 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
1776 | + $this->_setMval($this->attach, $value, $params, FALSE, $index); |
|
1777 | 1777 | return TRUE; |
1778 | 1778 | } |
1779 | 1779 | /*********************************************************************************/ |
@@ -1788,26 +1788,26 @@ discard block |
||
1788 | 1788 | * @return string |
1789 | 1789 | */ |
1790 | 1790 | function createAttendee() { |
1791 | - if( empty( $this->attendee )) return FALSE; |
|
1791 | + if (empty($this->attendee)) return FALSE; |
|
1792 | 1792 | $output = null; |
1793 | - foreach( $this->attendee as $attendeePart ) { // start foreach 1 |
|
1794 | - if( empty( $attendeePart['value'] )) { |
|
1795 | - if( $this->getConfig( 'allowEmpty' )) |
|
1796 | - $output .= $this->_createElement( 'ATTENDEE' ); |
|
1793 | + foreach ($this->attendee as $attendeePart) { // start foreach 1 |
|
1794 | + if (empty($attendeePart['value'])) { |
|
1795 | + if ($this->getConfig('allowEmpty')) |
|
1796 | + $output .= $this->_createElement('ATTENDEE'); |
|
1797 | 1797 | continue; |
1798 | 1798 | } |
1799 | 1799 | $attendee1 = $attendee2 = $attendeeLANG = $attendeeCN = null; |
1800 | - foreach( $attendeePart as $paramlabel => $paramvalue ) { // start foreach 2 |
|
1801 | - if( 'value' == $paramlabel ) |
|
1802 | - $attendee2 .= 'MAILTO:'.$paramvalue; |
|
1803 | - elseif(( 'params' == $paramlabel ) && ( is_array( $paramvalue ))) { // start elseif |
|
1804 | - foreach( $paramvalue as $optparamlabel => $optparamvalue ) { // start foreach 3 |
|
1800 | + foreach ($attendeePart as $paramlabel => $paramvalue) { // start foreach 2 |
|
1801 | + if ('value' == $paramlabel) |
|
1802 | + $attendee2 .= 'MAILTO:'.$paramvalue; |
|
1803 | + elseif (('params' == $paramlabel) && (is_array($paramvalue))) { // start elseif |
|
1804 | + foreach ($paramvalue as $optparamlabel => $optparamvalue) { // start foreach 3 |
|
1805 | 1805 | $attendee11 = $attendee12 = null; |
1806 | - if( is_int( $optparamlabel )) { |
|
1806 | + if (is_int($optparamlabel)) { |
|
1807 | 1807 | $attendee1 .= $this->intAttrDelimiter.$optparamvalue; |
1808 | 1808 | continue; |
1809 | 1809 | } |
1810 | - switch( $optparamlabel ) { // start switch |
|
1810 | + switch ($optparamlabel) { // start switch |
|
1811 | 1811 | case 'CUTYPE': |
1812 | 1812 | case 'PARTSTAT': |
1813 | 1813 | case 'ROLE': |
@@ -1821,12 +1821,12 @@ discard block |
||
1821 | 1821 | $attendee11 = $this->intAttrDelimiter.'MEMBER='; |
1822 | 1822 | //no break |
1823 | 1823 | case 'DELEGATED-TO': |
1824 | - $attendee11 = ( !$attendee11 ) ? $this->intAttrDelimiter.'DELEGATED-TO=' : $attendee11; |
|
1824 | + $attendee11 = (!$attendee11) ? $this->intAttrDelimiter.'DELEGATED-TO=' : $attendee11; |
|
1825 | 1825 | //no break |
1826 | 1826 | case 'DELEGATED-FROM': |
1827 | - $attendee11 = ( !$attendee11 ) ? $this->intAttrDelimiter.'DELEGATED-FROM=' : $attendee11; |
|
1828 | - foreach( $optparamvalue as $cix => $calUserAddress ) { |
|
1829 | - $attendee12 .= ( $cix ) ? ',' : null; |
|
1827 | + $attendee11 = (!$attendee11) ? $this->intAttrDelimiter.'DELEGATED-FROM=' : $attendee11; |
|
1828 | + foreach ($optparamvalue as $cix => $calUserAddress) { |
|
1829 | + $attendee12 .= ($cix) ? ',' : null; |
|
1830 | 1830 | $attendee12 .= '"MAILTO:'.$calUserAddress.'"'; |
1831 | 1831 | } |
1832 | 1832 | $attendee1 .= $attendee11.$attendee12; |
@@ -1847,7 +1847,7 @@ discard block |
||
1847 | 1847 | } // end foreach 3 |
1848 | 1848 | } // end elseif |
1849 | 1849 | } // end foreach 2 |
1850 | - $output .= $this->_createElement( 'ATTENDEE', $attendee1.$attendeeLANG.$attendeeCN, $attendee2 ); |
|
1850 | + $output .= $this->_createElement('ATTENDEE', $attendee1.$attendeeLANG.$attendeeCN, $attendee2); |
|
1851 | 1851 | } // end foreach 1 |
1852 | 1852 | return $output; |
1853 | 1853 | } |
@@ -1861,63 +1861,63 @@ discard block |
||
1861 | 1861 | * @param integer $index, optional |
1862 | 1862 | * @return bool |
1863 | 1863 | */ |
1864 | - function setAttendee( $value, $params=FALSE, $index=FALSE ) { |
|
1865 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
1866 | - $value = str_replace ( 'MAILTO:', '', $value ); |
|
1867 | - $value = str_replace ( 'mailto:', '', $value ); |
|
1864 | + function setAttendee($value, $params = FALSE, $index = FALSE) { |
|
1865 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
1866 | + $value = str_replace('MAILTO:', '', $value); |
|
1867 | + $value = str_replace('mailto:', '', $value); |
|
1868 | 1868 | $params2 = array(); |
1869 | - if( is_array($params )) { |
|
1869 | + if (is_array($params)) { |
|
1870 | 1870 | $optarrays = array(); |
1871 | - foreach( $params as $optparamlabel => $optparamvalue ) { |
|
1872 | - $optparamlabel = strtoupper( $optparamlabel ); |
|
1873 | - switch( $optparamlabel ) { |
|
1871 | + foreach ($params as $optparamlabel => $optparamvalue) { |
|
1872 | + $optparamlabel = strtoupper($optparamlabel); |
|
1873 | + switch ($optparamlabel) { |
|
1874 | 1874 | case 'MEMBER': |
1875 | 1875 | case 'DELEGATED-TO': |
1876 | 1876 | case 'DELEGATED-FROM': |
1877 | - if( is_array( $optparamvalue )) { |
|
1878 | - foreach( $optparamvalue as $part ) { |
|
1879 | - $part = str_replace( 'MAILTO:', '', $part ); |
|
1880 | - $part = str_replace( 'mailto:', '', $part ); |
|
1881 | - if(( '"' == $part{0} ) && ( '"' == $part{strlen($part)-1} )) |
|
1882 | - $part = substr( $part, 1, ( strlen($part)-2 )); |
|
1877 | + if (is_array($optparamvalue)) { |
|
1878 | + foreach ($optparamvalue as $part) { |
|
1879 | + $part = str_replace('MAILTO:', '', $part); |
|
1880 | + $part = str_replace('mailto:', '', $part); |
|
1881 | + if (('"' == $part{0} ) && ('"' == $part{strlen($part) - 1} )) |
|
1882 | + $part = substr($part, 1, (strlen($part) - 2)); |
|
1883 | 1883 | $optarrays[$optparamlabel][] = $part; |
1884 | 1884 | } |
1885 | 1885 | } |
1886 | 1886 | else { |
1887 | - $part = str_replace( 'MAILTO:', '', $optparamvalue ); |
|
1888 | - $part = str_replace( 'mailto:', '', $part ); |
|
1889 | - if(( '"' == $part{0} ) && ( '"' == $part{strlen($part)-1} )) |
|
1890 | - $part = substr( $part, 1, ( strlen($part)-2 )); |
|
1887 | + $part = str_replace('MAILTO:', '', $optparamvalue); |
|
1888 | + $part = str_replace('mailto:', '', $part); |
|
1889 | + if (('"' == $part{0} ) && ('"' == $part{strlen($part) - 1} )) |
|
1890 | + $part = substr($part, 1, (strlen($part) - 2)); |
|
1891 | 1891 | $optarrays[$optparamlabel][] = $part; |
1892 | 1892 | } |
1893 | 1893 | break; |
1894 | 1894 | default: |
1895 | - if( 'SENT-BY' == $optparamlabel ) { |
|
1896 | - $optparamvalue = str_replace( 'MAILTO:', '', $optparamvalue ); |
|
1897 | - $optparamvalue = str_replace( 'mailto:', '', $optparamvalue ); |
|
1895 | + if ('SENT-BY' == $optparamlabel) { |
|
1896 | + $optparamvalue = str_replace('MAILTO:', '', $optparamvalue); |
|
1897 | + $optparamvalue = str_replace('mailto:', '', $optparamvalue); |
|
1898 | 1898 | } |
1899 | - if(( '"' == substr( $optparamvalue, 0, 1 )) && |
|
1900 | - ( '"' == substr( $optparamvalue, -1 ))) |
|
1901 | - $optparamvalue = substr( $optparamvalue, 1, ( strlen( $optparamvalue ) - 2 )); |
|
1899 | + if (('"' == substr($optparamvalue, 0, 1)) && |
|
1900 | + ('"' == substr($optparamvalue, -1))) |
|
1901 | + $optparamvalue = substr($optparamvalue, 1, (strlen($optparamvalue) - 2)); |
|
1902 | 1902 | $params2[$optparamlabel] = $optparamvalue; |
1903 | 1903 | break; |
1904 | 1904 | } // end switch( $optparamlabel.. . |
1905 | 1905 | } // end foreach( $optparam.. . |
1906 | - foreach( $optarrays as $optparamlabel => $optparams ) |
|
1906 | + foreach ($optarrays as $optparamlabel => $optparams) |
|
1907 | 1907 | $params2[$optparamlabel] = $optparams; |
1908 | 1908 | } |
1909 | 1909 | // remove defaults |
1910 | - $this->_existRem( $params2, 'CUTYPE', 'INDIVIDUAL' ); |
|
1911 | - $this->_existRem( $params2, 'PARTSTAT', 'NEEDS-ACTION' ); |
|
1912 | - $this->_existRem( $params2, 'ROLE', 'REQ-PARTICIPANT' ); |
|
1913 | - $this->_existRem( $params2, 'RSVP', 'FALSE' ); |
|
1910 | + $this->_existRem($params2, 'CUTYPE', 'INDIVIDUAL'); |
|
1911 | + $this->_existRem($params2, 'PARTSTAT', 'NEEDS-ACTION'); |
|
1912 | + $this->_existRem($params2, 'ROLE', 'REQ-PARTICIPANT'); |
|
1913 | + $this->_existRem($params2, 'RSVP', 'FALSE'); |
|
1914 | 1914 | // check language setting |
1915 | - if( isset( $params2['CN' ] )) { |
|
1916 | - $lang = $this->getConfig( 'language' ); |
|
1917 | - if( !isset( $params2['LANGUAGE' ] ) && !empty( $lang )) |
|
1918 | - $params2['LANGUAGE' ] = $lang; |
|
1915 | + if (isset($params2['CN'])) { |
|
1916 | + $lang = $this->getConfig('language'); |
|
1917 | + if (!isset($params2['LANGUAGE']) && !empty($lang)) |
|
1918 | + $params2['LANGUAGE'] = $lang; |
|
1919 | 1919 | } |
1920 | - $this->_setMval( $this->attendee, $value, $params2, FALSE, $index ); |
|
1920 | + $this->_setMval($this->attendee, $value, $params2, FALSE, $index); |
|
1921 | 1921 | return TRUE; |
1922 | 1922 | } |
1923 | 1923 | /*********************************************************************************/ |
@@ -1932,23 +1932,23 @@ discard block |
||
1932 | 1932 | * @return string |
1933 | 1933 | */ |
1934 | 1934 | function createCategories() { |
1935 | - if( empty( $this->categories )) return FALSE; |
|
1935 | + if (empty($this->categories)) return FALSE; |
|
1936 | 1936 | $output = null; |
1937 | - foreach( $this->categories as $category ) { |
|
1938 | - if( empty( $category['value'] )) { |
|
1939 | - if ( $this->getConfig( 'allowEmpty' )) |
|
1940 | - $output .= $this->_createElement( 'CATEGORIES' ); |
|
1937 | + foreach ($this->categories as $category) { |
|
1938 | + if (empty($category['value'])) { |
|
1939 | + if ($this->getConfig('allowEmpty')) |
|
1940 | + $output .= $this->_createElement('CATEGORIES'); |
|
1941 | 1941 | continue; |
1942 | 1942 | } |
1943 | - $attributes = $this->_createParams( $category['params'], array( 'LANGUAGE' )); |
|
1944 | - if( is_array( $category['value'] )) { |
|
1945 | - foreach( $category['value'] as $cix => $categoryPart ) |
|
1946 | - $category['value'][$cix] = $this->_strrep( $categoryPart ); |
|
1947 | - $content = implode( ',', $category['value'] ); |
|
1943 | + $attributes = $this->_createParams($category['params'], array('LANGUAGE')); |
|
1944 | + if (is_array($category['value'])) { |
|
1945 | + foreach ($category['value'] as $cix => $categoryPart) |
|
1946 | + $category['value'][$cix] = $this->_strrep($categoryPart); |
|
1947 | + $content = implode(',', $category['value']); |
|
1948 | 1948 | } |
1949 | 1949 | else |
1950 | - $content = $this->_strrep( $category['value'] ); |
|
1951 | - $output .= $this->_createElement( 'CATEGORIES', $attributes, $content ); |
|
1950 | + $content = $this->_strrep($category['value']); |
|
1951 | + $output .= $this->_createElement('CATEGORIES', $attributes, $content); |
|
1952 | 1952 | } |
1953 | 1953 | return $output; |
1954 | 1954 | } |
@@ -1962,9 +1962,9 @@ discard block |
||
1962 | 1962 | * @param integer $index, optional |
1963 | 1963 | * @return bool |
1964 | 1964 | */ |
1965 | - function setCategories( $value, $params=FALSE, $index=FALSE ) { |
|
1966 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
1967 | - $this->_setMval( $this->categories, $value, $params, FALSE, $index ); |
|
1965 | + function setCategories($value, $params = FALSE, $index = FALSE) { |
|
1966 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
1967 | + $this->_setMval($this->categories, $value, $params, FALSE, $index); |
|
1968 | 1968 | return TRUE; |
1969 | 1969 | } |
1970 | 1970 | /*********************************************************************************/ |
@@ -1979,11 +1979,11 @@ discard block |
||
1979 | 1979 | * @return string |
1980 | 1980 | */ |
1981 | 1981 | function createClass() { |
1982 | - if( empty( $this->class )) return FALSE; |
|
1983 | - if( empty( $this->class['value'] )) |
|
1984 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'CLASS' ) : FALSE; |
|
1985 | - $attributes = $this->_createParams( $this->class['params'] ); |
|
1986 | - return $this->_createElement( 'CLASS', $attributes, $this->class['value'] ); |
|
1982 | + if (empty($this->class)) return FALSE; |
|
1983 | + if (empty($this->class['value'])) |
|
1984 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('CLASS') : FALSE; |
|
1985 | + $attributes = $this->_createParams($this->class['params']); |
|
1986 | + return $this->_createElement('CLASS', $attributes, $this->class['value']); |
|
1987 | 1987 | } |
1988 | 1988 | /** |
1989 | 1989 | * set calendar component property class |
@@ -1994,9 +1994,9 @@ discard block |
||
1994 | 1994 | * @param array $params optional |
1995 | 1995 | * @return bool |
1996 | 1996 | */ |
1997 | - function setClass( $value, $params=FALSE ) { |
|
1998 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
1999 | - $this->class = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
1997 | + function setClass($value, $params = FALSE) { |
|
1998 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
1999 | + $this->class = array('value' => $value, 'params' => $this->_setParams($params)); |
|
2000 | 2000 | return TRUE; |
2001 | 2001 | } |
2002 | 2002 | /*********************************************************************************/ |
@@ -2011,16 +2011,16 @@ discard block |
||
2011 | 2011 | * @return string |
2012 | 2012 | */ |
2013 | 2013 | function createComment() { |
2014 | - if( empty( $this->comment )) return FALSE; |
|
2014 | + if (empty($this->comment)) return FALSE; |
|
2015 | 2015 | $output = null; |
2016 | - foreach( $this->comment as $commentPart ) { |
|
2017 | - if( empty( $commentPart['value'] )) { |
|
2018 | - if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'COMMENT' ); |
|
2016 | + foreach ($this->comment as $commentPart) { |
|
2017 | + if (empty($commentPart['value'])) { |
|
2018 | + if ($this->getConfig('allowEmpty')) $output .= $this->_createElement('COMMENT'); |
|
2019 | 2019 | continue; |
2020 | 2020 | } |
2021 | - $attributes = $this->_createParams( $commentPart['params'], array( 'ALTREP', 'LANGUAGE' )); |
|
2022 | - $content = $this->_strrep( $commentPart['value'] ); |
|
2023 | - $output .= $this->_createElement( 'COMMENT', $attributes, $content ); |
|
2021 | + $attributes = $this->_createParams($commentPart['params'], array('ALTREP', 'LANGUAGE')); |
|
2022 | + $content = $this->_strrep($commentPart['value']); |
|
2023 | + $output .= $this->_createElement('COMMENT', $attributes, $content); |
|
2024 | 2024 | } |
2025 | 2025 | return $output; |
2026 | 2026 | } |
@@ -2034,9 +2034,9 @@ discard block |
||
2034 | 2034 | * @param integer $index, optional |
2035 | 2035 | * @return bool |
2036 | 2036 | */ |
2037 | - function setComment( $value, $params=FALSE, $index=FALSE ) { |
|
2038 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
2039 | - $this->_setMval( $this->comment, $value, $params, FALSE, $index ); |
|
2037 | + function setComment($value, $params = FALSE, $index = FALSE) { |
|
2038 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
2039 | + $this->_setMval($this->comment, $value, $params, FALSE, $index); |
|
2040 | 2040 | return TRUE; |
2041 | 2041 | } |
2042 | 2042 | /*********************************************************************************/ |
@@ -2051,19 +2051,19 @@ discard block |
||
2051 | 2051 | * @return string |
2052 | 2052 | */ |
2053 | 2053 | function createCompleted( ) { |
2054 | - if( empty( $this->completed )) return FALSE; |
|
2055 | - if( !isset( $this->completed['value']['year'] ) && |
|
2056 | - !isset( $this->completed['value']['month'] ) && |
|
2057 | - !isset( $this->completed['value']['day'] ) && |
|
2058 | - !isset( $this->completed['value']['hour'] ) && |
|
2059 | - !isset( $this->completed['value']['min'] ) && |
|
2060 | - !isset( $this->completed['value']['sec'] )) |
|
2061 | - if( $this->getConfig( 'allowEmpty' )) |
|
2062 | - return $this->_createElement( 'COMPLETED' ); |
|
2054 | + if (empty($this->completed)) return FALSE; |
|
2055 | + if (!isset($this->completed['value']['year']) && |
|
2056 | + !isset($this->completed['value']['month']) && |
|
2057 | + !isset($this->completed['value']['day']) && |
|
2058 | + !isset($this->completed['value']['hour']) && |
|
2059 | + !isset($this->completed['value']['min']) && |
|
2060 | + !isset($this->completed['value']['sec'])) |
|
2061 | + if ($this->getConfig('allowEmpty')) |
|
2062 | + return $this->_createElement('COMPLETED'); |
|
2063 | 2063 | else return FALSE; |
2064 | - $formatted = $this->_format_date_time( $this->completed['value'], 7 ); |
|
2065 | - $attributes = $this->_createParams( $this->completed['params'] ); |
|
2066 | - return $this->_createElement( 'COMPLETED', $attributes, $formatted ); |
|
2064 | + $formatted = $this->_format_date_time($this->completed['value'], 7); |
|
2065 | + $attributes = $this->_createParams($this->completed['params']); |
|
2066 | + return $this->_createElement('COMPLETED', $attributes, $formatted); |
|
2067 | 2067 | } |
2068 | 2068 | /** |
2069 | 2069 | * set calendar component property completed |
@@ -2079,16 +2079,16 @@ discard block |
||
2079 | 2079 | * @param array $params optional |
2080 | 2080 | * @return bool |
2081 | 2081 | */ |
2082 | - function setCompleted( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) { |
|
2083 | - if( empty( $year )) { |
|
2084 | - if( $this->getConfig( 'allowEmpty' )) { |
|
2085 | - $this->completed = array( 'value' => null, 'params' => $this->_setParams( $params )); |
|
2082 | + function setCompleted($year, $month = FALSE, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $params = FALSE) { |
|
2083 | + if (empty($year)) { |
|
2084 | + if ($this->getConfig('allowEmpty')) { |
|
2085 | + $this->completed = array('value' => null, 'params' => $this->_setParams($params)); |
|
2086 | 2086 | return TRUE; |
2087 | 2087 | } |
2088 | 2088 | else |
2089 | 2089 | return FALSE; |
2090 | 2090 | } |
2091 | - $this->completed = $this->_setDate2( $year, $month, $day, $hour, $min, $sec, $params ); |
|
2091 | + $this->completed = $this->_setDate2($year, $month, $day, $hour, $min, $sec, $params); |
|
2092 | 2092 | return TRUE; |
2093 | 2093 | } |
2094 | 2094 | /*********************************************************************************/ |
@@ -2103,15 +2103,15 @@ discard block |
||
2103 | 2103 | * @return string |
2104 | 2104 | */ |
2105 | 2105 | function createContact() { |
2106 | - if( empty( $this->contact )) return FALSE; |
|
2106 | + if (empty($this->contact)) return FALSE; |
|
2107 | 2107 | $output = null; |
2108 | - foreach( $this->contact as $contact ) { |
|
2109 | - if( !empty( $contact['value'] )) { |
|
2110 | - $attributes = $this->_createParams( $contact['params'], array( 'ALTREP', 'LANGUAGE' )); |
|
2111 | - $content = $this->_strrep( $contact['value'] ); |
|
2112 | - $output .= $this->_createElement( 'CONTACT', $attributes, $content ); |
|
2108 | + foreach ($this->contact as $contact) { |
|
2109 | + if (!empty($contact['value'])) { |
|
2110 | + $attributes = $this->_createParams($contact['params'], array('ALTREP', 'LANGUAGE')); |
|
2111 | + $content = $this->_strrep($contact['value']); |
|
2112 | + $output .= $this->_createElement('CONTACT', $attributes, $content); |
|
2113 | 2113 | } |
2114 | - elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'CONTACT' ); |
|
2114 | + elseif ($this->getConfig('allowEmpty')) $output .= $this->_createElement('CONTACT'); |
|
2115 | 2115 | } |
2116 | 2116 | return $output; |
2117 | 2117 | } |
@@ -2125,9 +2125,9 @@ discard block |
||
2125 | 2125 | * @param integer $index, optional |
2126 | 2126 | * @return bool |
2127 | 2127 | */ |
2128 | - function setContact( $value, $params=FALSE, $index=FALSE ) { |
|
2129 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
2130 | - $this->_setMval( $this->contact, $value, $params, FALSE, $index ); |
|
2128 | + function setContact($value, $params = FALSE, $index = FALSE) { |
|
2129 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
2130 | + $this->_setMval($this->contact, $value, $params, FALSE, $index); |
|
2131 | 2131 | return TRUE; |
2132 | 2132 | } |
2133 | 2133 | /*********************************************************************************/ |
@@ -2142,10 +2142,10 @@ discard block |
||
2142 | 2142 | * @return string |
2143 | 2143 | */ |
2144 | 2144 | function createCreated() { |
2145 | - if( empty( $this->created )) return FALSE; |
|
2146 | - $formatted = $this->_format_date_time( $this->created['value'], 7 ); |
|
2147 | - $attributes = $this->_createParams( $this->created['params'] ); |
|
2148 | - return $this->_createElement( 'CREATED', $attributes, $formatted ); |
|
2145 | + if (empty($this->created)) return FALSE; |
|
2146 | + $formatted = $this->_format_date_time($this->created['value'], 7); |
|
2147 | + $attributes = $this->_createParams($this->created['params']); |
|
2148 | + return $this->_createElement('CREATED', $attributes, $formatted); |
|
2149 | 2149 | } |
2150 | 2150 | /** |
2151 | 2151 | * set calendar component property created |
@@ -2161,11 +2161,11 @@ discard block |
||
2161 | 2161 | * @param mixed $params optional |
2162 | 2162 | * @return bool |
2163 | 2163 | */ |
2164 | - function setCreated( $year=FALSE, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) { |
|
2165 | - if( !isset( $year )) { |
|
2166 | - $year = date('Ymd\THis', mktime( date( 'H' ), date( 'i' ), date( 's' ) - date( 'Z'), date( 'm' ), date( 'd' ), date( 'Y' ))); |
|
2164 | + function setCreated($year = FALSE, $month = FALSE, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $params = FALSE) { |
|
2165 | + if (!isset($year)) { |
|
2166 | + $year = date('Ymd\THis', mktime(date('H'), date('i'), date('s') - date('Z'), date('m'), date('d'), date('Y'))); |
|
2167 | 2167 | } |
2168 | - $this->created = $this->_setDate2( $year, $month, $day, $hour, $min, $sec, $params ); |
|
2168 | + $this->created = $this->_setDate2($year, $month, $day, $hour, $min, $sec, $params); |
|
2169 | 2169 | return TRUE; |
2170 | 2170 | } |
2171 | 2171 | /*********************************************************************************/ |
@@ -2180,15 +2180,15 @@ discard block |
||
2180 | 2180 | * @return string |
2181 | 2181 | */ |
2182 | 2182 | function createDescription() { |
2183 | - if( empty( $this->description )) return FALSE; |
|
2184 | - $output = null; |
|
2185 | - foreach( $this->description as $description ) { |
|
2186 | - if( !empty( $description['value'] )) { |
|
2187 | - $attributes = $this->_createParams( $description['params'], array( 'ALTREP', 'LANGUAGE' )); |
|
2188 | - $content = $this->_strrep( $description['value'] ); |
|
2189 | - $output .= $this->_createElement( 'DESCRIPTION', $attributes, $content ); |
|
2183 | + if (empty($this->description)) return FALSE; |
|
2184 | + $output = null; |
|
2185 | + foreach ($this->description as $description) { |
|
2186 | + if (!empty($description['value'])) { |
|
2187 | + $attributes = $this->_createParams($description['params'], array('ALTREP', 'LANGUAGE')); |
|
2188 | + $content = $this->_strrep($description['value']); |
|
2189 | + $output .= $this->_createElement('DESCRIPTION', $attributes, $content); |
|
2190 | 2190 | } |
2191 | - elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'DESCRIPTION' ); |
|
2191 | + elseif ($this->getConfig('allowEmpty')) $output .= $this->_createElement('DESCRIPTION'); |
|
2192 | 2192 | } |
2193 | 2193 | return $output; |
2194 | 2194 | } |
@@ -2202,9 +2202,9 @@ discard block |
||
2202 | 2202 | * @param integer $index, optional |
2203 | 2203 | * @return bool |
2204 | 2204 | */ |
2205 | - function setDescription( $value, $params=FALSE, $index=FALSE ) { |
|
2206 | - if( empty( $value )) { if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; } |
|
2207 | - $this->_setMval( $this->description, $value, $params, FALSE, $index ); |
|
2205 | + function setDescription($value, $params = FALSE, $index = FALSE) { |
|
2206 | + if (empty($value)) { if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; } |
|
2207 | + $this->_setMval($this->description, $value, $params, FALSE, $index); |
|
2208 | 2208 | return TRUE; |
2209 | 2209 | } |
2210 | 2210 | /*********************************************************************************/ |
@@ -2219,19 +2219,19 @@ discard block |
||
2219 | 2219 | * @return string |
2220 | 2220 | */ |
2221 | 2221 | function createDtend() { |
2222 | - if( empty( $this->dtend )) return FALSE; |
|
2223 | - if( !isset( $this->dtend['value']['year'] ) && |
|
2224 | - !isset( $this->dtend['value']['month'] ) && |
|
2225 | - !isset( $this->dtend['value']['day'] ) && |
|
2226 | - !isset( $this->dtend['value']['hour'] ) && |
|
2227 | - !isset( $this->dtend['value']['min'] ) && |
|
2228 | - !isset( $this->dtend['value']['sec'] )) |
|
2229 | - if( $this->getConfig( 'allowEmpty' )) |
|
2230 | - return $this->_createElement( 'DTEND' ); |
|
2222 | + if (empty($this->dtend)) return FALSE; |
|
2223 | + if (!isset($this->dtend['value']['year']) && |
|
2224 | + !isset($this->dtend['value']['month']) && |
|
2225 | + !isset($this->dtend['value']['day']) && |
|
2226 | + !isset($this->dtend['value']['hour']) && |
|
2227 | + !isset($this->dtend['value']['min']) && |
|
2228 | + !isset($this->dtend['value']['sec'])) |
|
2229 | + if ($this->getConfig('allowEmpty')) |
|
2230 | + return $this->_createElement('DTEND'); |
|
2231 | 2231 | else return FALSE; |
2232 | - $formatted = $this->_format_date_time( $this->dtend['value'] ); |
|
2233 | - $attributes = $this->_createParams( $this->dtend['params'] ); |
|
2234 | - return $this->_createElement( 'DTEND', $attributes, $formatted ); |
|
2232 | + $formatted = $this->_format_date_time($this->dtend['value']); |
|
2233 | + $attributes = $this->_createParams($this->dtend['params']); |
|
2234 | + return $this->_createElement('DTEND', $attributes, $formatted); |
|
2235 | 2235 | } |
2236 | 2236 | /** |
2237 | 2237 | * set calendar component property dtend |
@@ -2248,16 +2248,16 @@ discard block |
||
2248 | 2248 | * @param array params optional |
2249 | 2249 | * @return bool |
2250 | 2250 | */ |
2251 | - function setDtend( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) { |
|
2252 | - if( empty( $year )) { |
|
2253 | - if( $this->getConfig( 'allowEmpty' )) { |
|
2254 | - $this->dtend = array( 'value' => null, 'params' => $this->_setParams( $params )); |
|
2251 | + function setDtend($year, $month = FALSE, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $tz = FALSE, $params = FALSE) { |
|
2252 | + if (empty($year)) { |
|
2253 | + if ($this->getConfig('allowEmpty')) { |
|
2254 | + $this->dtend = array('value' => null, 'params' => $this->_setParams($params)); |
|
2255 | 2255 | return TRUE; |
2256 | 2256 | } |
2257 | 2257 | else |
2258 | 2258 | return FALSE; |
2259 | 2259 | } |
2260 | - $this->dtend = $this->_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params ); |
|
2260 | + $this->dtend = $this->_setDate($year, $month, $day, $hour, $min, $sec, $tz, $params); |
|
2261 | 2261 | return TRUE; |
2262 | 2262 | } |
2263 | 2263 | /*********************************************************************************/ |
@@ -2272,16 +2272,16 @@ discard block |
||
2272 | 2272 | * @return string |
2273 | 2273 | */ |
2274 | 2274 | function createDtstamp() { |
2275 | - if( !isset( $this->dtstamp['value']['year'] ) && |
|
2276 | - !isset( $this->dtstamp['value']['month'] ) && |
|
2277 | - !isset( $this->dtstamp['value']['day'] ) && |
|
2278 | - !isset( $this->dtstamp['value']['hour'] ) && |
|
2279 | - !isset( $this->dtstamp['value']['min'] ) && |
|
2280 | - !isset( $this->dtstamp['value']['sec'] )) |
|
2275 | + if (!isset($this->dtstamp['value']['year']) && |
|
2276 | + !isset($this->dtstamp['value']['month']) && |
|
2277 | + !isset($this->dtstamp['value']['day']) && |
|
2278 | + !isset($this->dtstamp['value']['hour']) && |
|
2279 | + !isset($this->dtstamp['value']['min']) && |
|
2280 | + !isset($this->dtstamp['value']['sec'])) |
|
2281 | 2281 | $this->_makeDtstamp(); |
2282 | - $formatted = $this->_format_date_time( $this->dtstamp['value'], 7 ); |
|
2283 | - $attributes = $this->_createParams( $this->dtstamp['params'] ); |
|
2284 | - return $this->_createElement( 'DTSTAMP', $attributes, $formatted ); |
|
2282 | + $formatted = $this->_format_date_time($this->dtstamp['value'], 7); |
|
2283 | + $attributes = $this->_createParams($this->dtstamp['params']); |
|
2284 | + return $this->_createElement('DTSTAMP', $attributes, $formatted); |
|
2285 | 2285 | } |
2286 | 2286 | /** |
2287 | 2287 | * computes datestamp for calendar component object instance dtstamp |
@@ -2291,12 +2291,12 @@ discard block |
||
2291 | 2291 | * @return void |
2292 | 2292 | */ |
2293 | 2293 | function _makeDtstamp() { |
2294 | - $this->dtstamp['value'] = array( 'year' => date( 'Y' ) |
|
2295 | - , 'month' => date( 'm' ) |
|
2296 | - , 'day' => date( 'd' ) |
|
2297 | - , 'hour' => date( 'H' ) |
|
2298 | - , 'min' => date( 'i' ) |
|
2299 | - , 'sec' => date( 's' ) - date( 'Z' )); |
|
2294 | + $this->dtstamp['value'] = array('year' => date('Y') |
|
2295 | + , 'month' => date('m') |
|
2296 | + , 'day' => date('d') |
|
2297 | + , 'hour' => date('H') |
|
2298 | + , 'min' => date('i') |
|
2299 | + , 'sec' => date('s') - date('Z')); |
|
2300 | 2300 | $this->dtstamp['params'] = null; |
2301 | 2301 | } |
2302 | 2302 | /** |
@@ -2313,11 +2313,11 @@ discard block |
||
2313 | 2313 | * @param array $params optional |
2314 | 2314 | * @return TRUE |
2315 | 2315 | */ |
2316 | - function setDtstamp( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) { |
|
2317 | - if( empty( $year )) |
|
2316 | + function setDtstamp($year, $month = FALSE, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $params = FALSE) { |
|
2317 | + if (empty($year)) |
|
2318 | 2318 | $this->_makeDtstamp(); |
2319 | 2319 | else |
2320 | - $this->dtstamp = $this->_setDate2( $year, $month, $day, $hour, $min, $sec, $params ); |
|
2320 | + $this->dtstamp = $this->_setDate2($year, $month, $day, $hour, $min, $sec, $params); |
|
2321 | 2321 | return TRUE; |
2322 | 2322 | } |
2323 | 2323 | /*********************************************************************************/ |
@@ -2332,21 +2332,21 @@ discard block |
||
2332 | 2332 | * @return string |
2333 | 2333 | */ |
2334 | 2334 | function createDtstart() { |
2335 | - if( empty( $this->dtstart )) return FALSE; |
|
2336 | - if( !isset( $this->dtstart['value']['year'] ) && |
|
2337 | - !isset( $this->dtstart['value']['month'] ) && |
|
2338 | - !isset( $this->dtstart['value']['day'] ) && |
|
2339 | - !isset( $this->dtstart['value']['hour'] ) && |
|
2340 | - !isset( $this->dtstart['value']['min'] ) && |
|
2341 | - !isset( $this->dtstart['value']['sec'] )) |
|
2342 | - if( $this->getConfig( 'allowEmpty' )) |
|
2343 | - return $this->_createElement( 'DTSTART' ); |
|
2335 | + if (empty($this->dtstart)) return FALSE; |
|
2336 | + if (!isset($this->dtstart['value']['year']) && |
|
2337 | + !isset($this->dtstart['value']['month']) && |
|
2338 | + !isset($this->dtstart['value']['day']) && |
|
2339 | + !isset($this->dtstart['value']['hour']) && |
|
2340 | + !isset($this->dtstart['value']['min']) && |
|
2341 | + !isset($this->dtstart['value']['sec'])) |
|
2342 | + if ($this->getConfig('allowEmpty')) |
|
2343 | + return $this->_createElement('DTSTART'); |
|
2344 | 2344 | else return FALSE; |
2345 | - if( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' ))) |
|
2346 | - unset( $this->dtstart['value']['tz'], $this->dtstart['params']['TZID'] ); |
|
2347 | - $formatted = $this->_format_date_time( $this->dtstart['value'] ); |
|
2348 | - $attributes = $this->_createParams( $this->dtstart['params'] ); |
|
2349 | - return $this->_createElement( 'DTSTART', $attributes, $formatted ); |
|
2345 | + if (in_array($this->objName, array('vtimezone', 'standard', 'daylight'))) |
|
2346 | + unset($this->dtstart['value']['tz'], $this->dtstart['params']['TZID']); |
|
2347 | + $formatted = $this->_format_date_time($this->dtstart['value']); |
|
2348 | + $attributes = $this->_createParams($this->dtstart['params']); |
|
2349 | + return $this->_createElement('DTSTART', $attributes, $formatted); |
|
2350 | 2350 | } |
2351 | 2351 | /** |
2352 | 2352 | * set calendar component property dtstart |
@@ -2363,16 +2363,16 @@ discard block |
||
2363 | 2363 | * @param array $params optional |
2364 | 2364 | * @return bool |
2365 | 2365 | */ |
2366 | - function setDtstart( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) { |
|
2367 | - if( empty( $year )) { |
|
2368 | - if( $this->getConfig( 'allowEmpty' )) { |
|
2369 | - $this->dtstart = array( 'value' => null, 'params' => $this->_setParams( $params )); |
|
2366 | + function setDtstart($year, $month = FALSE, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $tz = FALSE, $params = FALSE) { |
|
2367 | + if (empty($year)) { |
|
2368 | + if ($this->getConfig('allowEmpty')) { |
|
2369 | + $this->dtstart = array('value' => null, 'params' => $this->_setParams($params)); |
|
2370 | 2370 | return TRUE; |
2371 | 2371 | } |
2372 | 2372 | else |
2373 | 2373 | return FALSE; |
2374 | 2374 | } |
2375 | - $this->dtstart = $this->_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params, 'dtstart' ); |
|
2375 | + $this->dtstart = $this->_setDate($year, $month, $day, $hour, $min, $sec, $tz, $params, 'dtstart'); |
|
2376 | 2376 | return TRUE; |
2377 | 2377 | } |
2378 | 2378 | /*********************************************************************************/ |
@@ -2387,19 +2387,19 @@ discard block |
||
2387 | 2387 | * @return string |
2388 | 2388 | */ |
2389 | 2389 | function createDue() { |
2390 | - if( empty( $this->due )) return FALSE; |
|
2391 | - if( !isset( $this->due['value']['year'] ) && |
|
2392 | - !isset( $this->due['value']['month'] ) && |
|
2393 | - !isset( $this->due['value']['day'] ) && |
|
2394 | - !isset( $this->due['value']['hour'] ) && |
|
2395 | - !isset( $this->due['value']['min'] ) && |
|
2396 | - !isset( $this->due['value']['sec'] )) |
|
2397 | - if( $this->getConfig( 'allowEmpty' )) |
|
2398 | - return $this->_createElement( 'DUE' ); |
|
2390 | + if (empty($this->due)) return FALSE; |
|
2391 | + if (!isset($this->due['value']['year']) && |
|
2392 | + !isset($this->due['value']['month']) && |
|
2393 | + !isset($this->due['value']['day']) && |
|
2394 | + !isset($this->due['value']['hour']) && |
|
2395 | + !isset($this->due['value']['min']) && |
|
2396 | + !isset($this->due['value']['sec'])) |
|
2397 | + if ($this->getConfig('allowEmpty')) |
|
2398 | + return $this->_createElement('DUE'); |
|
2399 | 2399 | else return FALSE; |
2400 | - $formatted = $this->_format_date_time( $this->due['value'] ); |
|
2401 | - $attributes = $this->_createParams( $this->due['params'] ); |
|
2402 | - return $this->_createElement( 'DUE', $attributes, $formatted ); |
|
2400 | + $formatted = $this->_format_date_time($this->due['value']); |
|
2401 | + $attributes = $this->_createParams($this->due['params']); |
|
2402 | + return $this->_createElement('DUE', $attributes, $formatted); |
|
2403 | 2403 | } |
2404 | 2404 | /** |
2405 | 2405 | * set calendar component property due |
@@ -2415,16 +2415,16 @@ discard block |
||
2415 | 2415 | * @param array $params optional |
2416 | 2416 | * @return bool |
2417 | 2417 | */ |
2418 | - function setDue( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) { |
|
2419 | - if( empty( $year )) { |
|
2420 | - if( $this->getConfig( 'allowEmpty' )) { |
|
2421 | - $this->due = array( 'value' => null, 'params' => $this->_setParams( $params )); |
|
2418 | + function setDue($year, $month = FALSE, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $tz = FALSE, $params = FALSE) { |
|
2419 | + if (empty($year)) { |
|
2420 | + if ($this->getConfig('allowEmpty')) { |
|
2421 | + $this->due = array('value' => null, 'params' => $this->_setParams($params)); |
|
2422 | 2422 | return TRUE; |
2423 | 2423 | } |
2424 | 2424 | else |
2425 | 2425 | return FALSE; |
2426 | 2426 | } |
2427 | - $this->due = $this->_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params ); |
|
2427 | + $this->due = $this->_setDate($year, $month, $day, $hour, $min, $sec, $tz, $params); |
|
2428 | 2428 | return TRUE; |
2429 | 2429 | } |
2430 | 2430 | /*********************************************************************************/ |
@@ -2439,17 +2439,17 @@ discard block |
||
2439 | 2439 | * @return string |
2440 | 2440 | */ |
2441 | 2441 | function createDuration() { |
2442 | - if( empty( $this->duration )) return FALSE; |
|
2443 | - if( !isset( $this->duration['value']['week'] ) && |
|
2444 | - !isset( $this->duration['value']['day'] ) && |
|
2445 | - !isset( $this->duration['value']['hour'] ) && |
|
2446 | - !isset( $this->duration['value']['min'] ) && |
|
2447 | - !isset( $this->duration['value']['sec'] )) |
|
2448 | - if( $this->getConfig( 'allowEmpty' )) |
|
2449 | - return $this->_createElement( 'DURATION', array(), null ); |
|
2442 | + if (empty($this->duration)) return FALSE; |
|
2443 | + if (!isset($this->duration['value']['week']) && |
|
2444 | + !isset($this->duration['value']['day']) && |
|
2445 | + !isset($this->duration['value']['hour']) && |
|
2446 | + !isset($this->duration['value']['min']) && |
|
2447 | + !isset($this->duration['value']['sec'])) |
|
2448 | + if ($this->getConfig('allowEmpty')) |
|
2449 | + return $this->_createElement('DURATION', array(), null); |
|
2450 | 2450 | else return FALSE; |
2451 | - $attributes = $this->_createParams( $this->duration['params'] ); |
|
2452 | - return $this->_createElement( 'DURATION', $attributes, $this->_format_duration( $this->duration['value'] )); |
|
2451 | + $attributes = $this->_createParams($this->duration['params']); |
|
2452 | + return $this->_createElement('DURATION', $attributes, $this->_format_duration($this->duration['value'])); |
|
2453 | 2453 | } |
2454 | 2454 | /** |
2455 | 2455 | * set calendar component property duration |
@@ -2464,20 +2464,20 @@ discard block |
||
2464 | 2464 | * @param array $params optional |
2465 | 2465 | * @return bool |
2466 | 2466 | */ |
2467 | - function setDuration( $week, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) { |
|
2468 | - if( empty( $week )) if( $this->getConfig( 'allowEmpty' )) $week = null; else return FALSE; |
|
2469 | - if( is_array( $week ) && ( 1 <= count( $week ))) |
|
2470 | - $this->duration = array( 'value' => $this->_duration_array( $week ), 'params' => $this->_setParams( $day )); |
|
2471 | - elseif( is_string( $week ) && ( 3 <= strlen( trim( $week )))) { |
|
2472 | - $week = trim( $week ); |
|
2473 | - if( in_array( substr( $week, 0, 1 ), array( '+', '-' ))) |
|
2474 | - $week = substr( $week, 1 ); |
|
2475 | - $this->duration = array( 'value' => $this->_duration_string( $week ), 'params' => $this->_setParams( $day )); |
|
2476 | - } |
|
2477 | - elseif( empty( $week ) && empty( $day ) && empty( $hour ) && empty( $min ) && empty( $sec )) |
|
2467 | + function setDuration($week, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $params = FALSE) { |
|
2468 | + if (empty($week)) if ($this->getConfig('allowEmpty')) $week = null; else return FALSE; |
|
2469 | + if (is_array($week) && (1 <= count($week))) |
|
2470 | + $this->duration = array('value' => $this->_duration_array($week), 'params' => $this->_setParams($day)); |
|
2471 | + elseif (is_string($week) && (3 <= strlen(trim($week)))) { |
|
2472 | + $week = trim($week); |
|
2473 | + if (in_array(substr($week, 0, 1), array('+', '-'))) |
|
2474 | + $week = substr($week, 1); |
|
2475 | + $this->duration = array('value' => $this->_duration_string($week), 'params' => $this->_setParams($day)); |
|
2476 | + } |
|
2477 | + elseif (empty($week) && empty($day) && empty($hour) && empty($min) && empty($sec)) |
|
2478 | 2478 | return FALSE; |
2479 | 2479 | else |
2480 | - $this->duration = array( 'value' => $this->_duration_array( array( $week, $day, $hour, $min, $sec )), 'params' => $this->_setParams( $params )); |
|
2480 | + $this->duration = array('value' => $this->_duration_array(array($week, $day, $hour, $min, $sec)), 'params' => $this->_setParams($params)); |
|
2481 | 2481 | return TRUE; |
2482 | 2482 | } |
2483 | 2483 | /*********************************************************************************/ |
@@ -2492,36 +2492,36 @@ discard block |
||
2492 | 2492 | * @return string |
2493 | 2493 | */ |
2494 | 2494 | function createExdate() { |
2495 | - if( empty( $this->exdate )) return FALSE; |
|
2495 | + if (empty($this->exdate)) return FALSE; |
|
2496 | 2496 | $output = null; |
2497 | - foreach( $this->exdate as $ex => $theExdate ) { |
|
2498 | - if( empty( $theExdate['value'] )) { |
|
2499 | - if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'EXDATE' ); |
|
2497 | + foreach ($this->exdate as $ex => $theExdate) { |
|
2498 | + if (empty($theExdate['value'])) { |
|
2499 | + if ($this->getConfig('allowEmpty')) $output .= $this->_createElement('EXDATE'); |
|
2500 | 2500 | continue; |
2501 | 2501 | } |
2502 | 2502 | $content = $attributes = null; |
2503 | - foreach( $theExdate['value'] as $eix => $exdatePart ) { |
|
2504 | - $parno = count( $exdatePart ); |
|
2505 | - $formatted = $this->_format_date_time( $exdatePart, $parno ); |
|
2506 | - if( isset( $theExdate['params']['TZID'] )) |
|
2507 | - $formatted = str_replace( 'Z', '', $formatted); |
|
2508 | - if( 0 < $eix ) { |
|
2509 | - if( isset( $theExdate['value'][0]['tz'] )) { |
|
2510 | - if( ctype_digit( substr( $theExdate['value'][0]['tz'], -4 )) || |
|
2511 | - ( 'Z' == $theExdate['value'][0]['tz'] )) { |
|
2512 | - if( 'Z' != substr( $formatted, -1 )) |
|
2503 | + foreach ($theExdate['value'] as $eix => $exdatePart) { |
|
2504 | + $parno = count($exdatePart); |
|
2505 | + $formatted = $this->_format_date_time($exdatePart, $parno); |
|
2506 | + if (isset($theExdate['params']['TZID'])) |
|
2507 | + $formatted = str_replace('Z', '', $formatted); |
|
2508 | + if (0 < $eix) { |
|
2509 | + if (isset($theExdate['value'][0]['tz'])) { |
|
2510 | + if (ctype_digit(substr($theExdate['value'][0]['tz'], -4)) || |
|
2511 | + ('Z' == $theExdate['value'][0]['tz'])) { |
|
2512 | + if ('Z' != substr($formatted, -1)) |
|
2513 | 2513 | $formatted .= 'Z'; |
2514 | 2514 | } |
2515 | 2515 | else |
2516 | - $formatted = str_replace( 'Z', '', $formatted ); |
|
2516 | + $formatted = str_replace('Z', '', $formatted); |
|
2517 | 2517 | } |
2518 | 2518 | else |
2519 | - $formatted = str_replace( 'Z', '', $formatted ); |
|
2519 | + $formatted = str_replace('Z', '', $formatted); |
|
2520 | 2520 | } |
2521 | - $content .= ( 0 < $eix ) ? ','.$formatted : $formatted; |
|
2521 | + $content .= (0 < $eix) ? ','.$formatted : $formatted; |
|
2522 | 2522 | } |
2523 | - $attributes .= $this->_createParams( $theExdate['params'] ); |
|
2524 | - $output .= $this->_createElement( 'EXDATE', $attributes, $content ); |
|
2523 | + $attributes .= $this->_createParams($theExdate['params']); |
|
2524 | + $output .= $this->_createElement('EXDATE', $attributes, $content); |
|
2525 | 2525 | } |
2526 | 2526 | return $output; |
2527 | 2527 | } |
@@ -2535,44 +2535,44 @@ discard block |
||
2535 | 2535 | * @param integer $index, optional |
2536 | 2536 | * @return bool |
2537 | 2537 | */ |
2538 | - function setExdate( $exdates, $params=FALSE, $index=FALSE ) { |
|
2539 | - if( empty( $exdates )) { |
|
2540 | - if( $this->getConfig( 'allowEmpty' )) { |
|
2541 | - $this->_setMval( $this->exdate, null, $params, FALSE, $index ); |
|
2538 | + function setExdate($exdates, $params = FALSE, $index = FALSE) { |
|
2539 | + if (empty($exdates)) { |
|
2540 | + if ($this->getConfig('allowEmpty')) { |
|
2541 | + $this->_setMval($this->exdate, null, $params, FALSE, $index); |
|
2542 | 2542 | return TRUE; |
2543 | 2543 | } |
2544 | 2544 | else |
2545 | 2545 | return FALSE; |
2546 | 2546 | } |
2547 | - $input = array( 'params' => $this->_setParams( $params, array( 'VALUE' => 'DATE-TIME' ))); |
|
2547 | + $input = array('params' => $this->_setParams($params, array('VALUE' => 'DATE-TIME'))); |
|
2548 | 2548 | /* ev. check 1:st date and save ev. timezone **/ |
2549 | - $this->_chkdatecfg( reset( $exdates ), $parno, $input['params'] ); |
|
2550 | - $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME' ); // remove default parameter |
|
2551 | - foreach( $exdates as $eix => $theExdate ) { |
|
2552 | - if( $this->_isArrayTimestampDate( $theExdate )) |
|
2553 | - $exdatea = $this->_timestamp2date( $theExdate, $parno ); |
|
2554 | - elseif( is_array( $theExdate )) |
|
2555 | - $exdatea = $this->_date_time_array( $theExdate, $parno ); |
|
2556 | - elseif( 8 <= strlen( trim( $theExdate ))) // ex. 2006-08-03 10:12:18 |
|
2557 | - $exdatea = $this->_date_time_string( $theExdate, $parno ); |
|
2558 | - if( 3 == $parno ) |
|
2559 | - unset( $exdatea['hour'], $exdatea['min'], $exdatea['sec'], $exdatea['tz'] ); |
|
2560 | - elseif( isset( $exdatea['tz'] )) |
|
2549 | + $this->_chkdatecfg(reset($exdates), $parno, $input['params']); |
|
2550 | + $this->_existRem($input['params'], 'VALUE', 'DATE-TIME'); // remove default parameter |
|
2551 | + foreach ($exdates as $eix => $theExdate) { |
|
2552 | + if ($this->_isArrayTimestampDate($theExdate)) |
|
2553 | + $exdatea = $this->_timestamp2date($theExdate, $parno); |
|
2554 | + elseif (is_array($theExdate)) |
|
2555 | + $exdatea = $this->_date_time_array($theExdate, $parno); |
|
2556 | + elseif (8 <= strlen(trim($theExdate))) // ex. 2006-08-03 10:12:18 |
|
2557 | + $exdatea = $this->_date_time_string($theExdate, $parno); |
|
2558 | + if (3 == $parno) |
|
2559 | + unset($exdatea['hour'], $exdatea['min'], $exdatea['sec'], $exdatea['tz']); |
|
2560 | + elseif (isset($exdatea['tz'])) |
|
2561 | 2561 | $exdatea['tz'] = (string) $exdatea['tz']; |
2562 | - if( isset( $input['params']['TZID'] ) || |
|
2563 | - ( isset( $exdatea['tz'] ) && !$this->_isOffset( $exdatea['tz'] )) || |
|
2564 | - ( isset( $input['value'][0] ) && ( !isset( $input['value'][0]['tz'] ))) || |
|
2565 | - ( isset( $input['value'][0]['tz'] ) && !$this->_isOffset( $input['value'][0]['tz'] ))) |
|
2566 | - unset( $exdatea['tz'] ); |
|
2562 | + if (isset($input['params']['TZID']) || |
|
2563 | + (isset($exdatea['tz']) && !$this->_isOffset($exdatea['tz'])) || |
|
2564 | + (isset($input['value'][0]) && (!isset($input['value'][0]['tz']))) || |
|
2565 | + (isset($input['value'][0]['tz']) && !$this->_isOffset($input['value'][0]['tz']))) |
|
2566 | + unset($exdatea['tz']); |
|
2567 | 2567 | $input['value'][] = $exdatea; |
2568 | 2568 | } |
2569 | - if( 0 >= count( $input['value'] )) |
|
2569 | + if (0 >= count($input['value'])) |
|
2570 | 2570 | return FALSE; |
2571 | - if( 3 == $parno ) { |
|
2571 | + if (3 == $parno) { |
|
2572 | 2572 | $input['params']['VALUE'] = 'DATE'; |
2573 | - unset( $input['params']['TZID'] ); |
|
2573 | + unset($input['params']['TZID']); |
|
2574 | 2574 | } |
2575 | - $this->_setMval( $this->exdate, $input['value'], $input['params'], FALSE, $index ); |
|
2575 | + $this->_setMval($this->exdate, $input['value'], $input['params'], FALSE, $index); |
|
2576 | 2576 | return TRUE; |
2577 | 2577 | } |
2578 | 2578 | /*********************************************************************************/ |
@@ -2587,8 +2587,8 @@ discard block |
||
2587 | 2587 | * @return string |
2588 | 2588 | */ |
2589 | 2589 | function createExrule() { |
2590 | - if( empty( $this->exrule )) return FALSE; |
|
2591 | - return $this->_format_recur( 'EXRULE', $this->exrule ); |
|
2590 | + if (empty($this->exrule)) return FALSE; |
|
2591 | + return $this->_format_recur('EXRULE', $this->exrule); |
|
2592 | 2592 | } |
2593 | 2593 | /** |
2594 | 2594 | * set calendar component property exdate |
@@ -2600,9 +2600,9 @@ discard block |
||
2600 | 2600 | * @param integer $index, optional |
2601 | 2601 | * @return bool |
2602 | 2602 | */ |
2603 | - function setExrule( $exruleset, $params=FALSE, $index=FALSE ) { |
|
2604 | - if( empty( $exruleset )) if( $this->getConfig( 'allowEmpty' )) $exruleset = null; else return FALSE; |
|
2605 | - $this->_setMval( $this->exrule, $this->_setRexrule( $exruleset ), $params, FALSE, $index ); |
|
2603 | + function setExrule($exruleset, $params = FALSE, $index = FALSE) { |
|
2604 | + if (empty($exruleset)) if ($this->getConfig('allowEmpty')) $exruleset = null; else return FALSE; |
|
2605 | + $this->_setMval($this->exrule, $this->_setRexrule($exruleset), $params, FALSE, $index); |
|
2606 | 2606 | return TRUE; |
2607 | 2607 | } |
2608 | 2608 | /*********************************************************************************/ |
@@ -2617,47 +2617,47 @@ discard block |
||
2617 | 2617 | * @return string |
2618 | 2618 | */ |
2619 | 2619 | function createFreebusy() { |
2620 | - if( empty( $this->freebusy )) return FALSE; |
|
2620 | + if (empty($this->freebusy)) return FALSE; |
|
2621 | 2621 | $output = null; |
2622 | - foreach( $this->freebusy as $freebusyPart ) { |
|
2623 | - if( empty( $freebusyPart['value'] )) { |
|
2624 | - if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'FREEBUSY' ); |
|
2622 | + foreach ($this->freebusy as $freebusyPart) { |
|
2623 | + if (empty($freebusyPart['value'])) { |
|
2624 | + if ($this->getConfig('allowEmpty')) $output .= $this->_createElement('FREEBUSY'); |
|
2625 | 2625 | continue; |
2626 | 2626 | } |
2627 | 2627 | $attributes = $content = null; |
2628 | - if( isset( $freebusyPart['value']['fbtype'] )) { |
|
2628 | + if (isset($freebusyPart['value']['fbtype'])) { |
|
2629 | 2629 | $attributes .= $this->intAttrDelimiter.'FBTYPE='.$freebusyPart['value']['fbtype']; |
2630 | - unset( $freebusyPart['value']['fbtype'] ); |
|
2631 | - $freebusyPart['value'] = array_values( $freebusyPart['value'] ); |
|
2630 | + unset($freebusyPart['value']['fbtype']); |
|
2631 | + $freebusyPart['value'] = array_values($freebusyPart['value']); |
|
2632 | 2632 | } |
2633 | 2633 | else |
2634 | 2634 | $attributes .= $this->intAttrDelimiter.'FBTYPE=BUSY'; |
2635 | - $attributes .= $this->_createParams( $freebusyPart['params'] ); |
|
2635 | + $attributes .= $this->_createParams($freebusyPart['params']); |
|
2636 | 2636 | $fno = 1; |
2637 | - $cnt = count( $freebusyPart['value']); |
|
2638 | - foreach( $freebusyPart['value'] as $periodix => $freebusyPeriod ) { |
|
2639 | - $formatted = $this->_format_date_time( $freebusyPeriod[0] ); |
|
2637 | + $cnt = count($freebusyPart['value']); |
|
2638 | + foreach ($freebusyPart['value'] as $periodix => $freebusyPeriod) { |
|
2639 | + $formatted = $this->_format_date_time($freebusyPeriod[0]); |
|
2640 | 2640 | $content .= $formatted; |
2641 | 2641 | $content .= '/'; |
2642 | - $cnt2 = count( $freebusyPeriod[1]); |
|
2643 | - if( array_key_exists( 'year', $freebusyPeriod[1] )) // date-time |
|
2642 | + $cnt2 = count($freebusyPeriod[1]); |
|
2643 | + if (array_key_exists('year', $freebusyPeriod[1])) // date-time |
|
2644 | 2644 | $cnt2 = 7; |
2645 | - elseif( array_key_exists( 'week', $freebusyPeriod[1] )) // duration |
|
2645 | + elseif (array_key_exists('week', $freebusyPeriod[1])) // duration |
|
2646 | 2646 | $cnt2 = 5; |
2647 | - if(( 7 == $cnt2 ) && // period= -> date-time |
|
2648 | - isset( $freebusyPeriod[1]['year'] ) && |
|
2649 | - isset( $freebusyPeriod[1]['month'] ) && |
|
2650 | - isset( $freebusyPeriod[1]['day'] )) { |
|
2651 | - $content .= $this->_format_date_time( $freebusyPeriod[1] ); |
|
2647 | + if ((7 == $cnt2) && // period= -> date-time |
|
2648 | + isset($freebusyPeriod[1]['year']) && |
|
2649 | + isset($freebusyPeriod[1]['month']) && |
|
2650 | + isset($freebusyPeriod[1]['day'])) { |
|
2651 | + $content .= $this->_format_date_time($freebusyPeriod[1]); |
|
2652 | 2652 | } |
2653 | 2653 | else { // period= -> dur-time |
2654 | - $content .= $this->_format_duration( $freebusyPeriod[1] ); |
|
2654 | + $content .= $this->_format_duration($freebusyPeriod[1]); |
|
2655 | 2655 | } |
2656 | - if( $fno < $cnt ) |
|
2656 | + if ($fno < $cnt) |
|
2657 | 2657 | $content .= ','; |
2658 | 2658 | $fno++; |
2659 | 2659 | } |
2660 | - $output .= $this->_createElement( 'FREEBUSY', $attributes, $content ); |
|
2660 | + $output .= $this->_createElement('FREEBUSY', $attributes, $content); |
|
2661 | 2661 | } |
2662 | 2662 | return $output; |
2663 | 2663 | } |
@@ -2672,52 +2672,52 @@ discard block |
||
2672 | 2672 | * @param integer $index, optional |
2673 | 2673 | * @return bool |
2674 | 2674 | */ |
2675 | - function setFreebusy( $fbType, $fbValues, $params=FALSE, $index=FALSE ) { |
|
2676 | - if( empty( $fbValues )) { |
|
2677 | - if( $this->getConfig( 'allowEmpty' )) { |
|
2678 | - $this->_setMval( $this->freebusy, null, $params, FALSE, $index ); |
|
2675 | + function setFreebusy($fbType, $fbValues, $params = FALSE, $index = FALSE) { |
|
2676 | + if (empty($fbValues)) { |
|
2677 | + if ($this->getConfig('allowEmpty')) { |
|
2678 | + $this->_setMval($this->freebusy, null, $params, FALSE, $index); |
|
2679 | 2679 | return TRUE; |
2680 | 2680 | } |
2681 | 2681 | else |
2682 | 2682 | return FALSE; |
2683 | 2683 | } |
2684 | - $fbType = strtoupper( $fbType ); |
|
2685 | - if(( !in_array( $fbType, array( 'FREE', 'BUSY', 'BUSY-UNAVAILABLE', 'BUSY-TENTATIVE' ))) && |
|
2686 | - ( 'X-' != substr( $fbType, 0, 2 ))) |
|
2684 | + $fbType = strtoupper($fbType); |
|
2685 | + if ((!in_array($fbType, array('FREE', 'BUSY', 'BUSY-UNAVAILABLE', 'BUSY-TENTATIVE'))) && |
|
2686 | + ('X-' != substr($fbType, 0, 2))) |
|
2687 | 2687 | $fbType = 'BUSY'; |
2688 | - $input = array( 'fbtype' => $fbType ); |
|
2689 | - foreach( $fbValues as $fbPeriod ) { // periods => period |
|
2688 | + $input = array('fbtype' => $fbType); |
|
2689 | + foreach ($fbValues as $fbPeriod) { // periods => period |
|
2690 | 2690 | $freebusyPeriod = array(); |
2691 | - foreach( $fbPeriod as $fbMember ) { // pairs => singlepart |
|
2691 | + foreach ($fbPeriod as $fbMember) { // pairs => singlepart |
|
2692 | 2692 | $freebusyPairMember = array(); |
2693 | - if( is_array( $fbMember )) { |
|
2694 | - if( $this->_isArrayDate( $fbMember )) { // date-time value |
|
2695 | - $freebusyPairMember = $this->_date_time_array( $fbMember, 7 ); |
|
2693 | + if (is_array($fbMember)) { |
|
2694 | + if ($this->_isArrayDate($fbMember)) { // date-time value |
|
2695 | + $freebusyPairMember = $this->_date_time_array($fbMember, 7); |
|
2696 | 2696 | $freebusyPairMember['tz'] = 'Z'; |
2697 | 2697 | } |
2698 | - elseif( $this->_isArrayTimestampDate( $fbMember )) { // timestamp value |
|
2699 | - $freebusyPairMember = $this->_timestamp2date( $fbMember['timestamp'], 7 ); |
|
2698 | + elseif ($this->_isArrayTimestampDate($fbMember)) { // timestamp value |
|
2699 | + $freebusyPairMember = $this->_timestamp2date($fbMember['timestamp'], 7); |
|
2700 | 2700 | $freebusyPairMember['tz'] = 'Z'; |
2701 | 2701 | } |
2702 | 2702 | else { // array format duration |
2703 | - $freebusyPairMember = $this->_duration_array( $fbMember ); |
|
2703 | + $freebusyPairMember = $this->_duration_array($fbMember); |
|
2704 | 2704 | } |
2705 | 2705 | } |
2706 | - elseif(( 3 <= strlen( trim( $fbMember ))) && // string format duration |
|
2707 | - ( in_array( $fbMember{0}, array( 'P', '+', '-' )))) { |
|
2708 | - if( 'P' != $fbMember{0} ) |
|
2709 | - $fbmember = substr( $fbMember, 1 ); |
|
2710 | - $freebusyPairMember = $this->_duration_string( $fbMember ); |
|
2706 | + elseif ((3 <= strlen(trim($fbMember))) && // string format duration |
|
2707 | + (in_array($fbMember{0}, array('P', '+', '-')))) { |
|
2708 | + if ('P' != $fbMember{0} ) |
|
2709 | + $fbmember = substr($fbMember, 1); |
|
2710 | + $freebusyPairMember = $this->_duration_string($fbMember); |
|
2711 | 2711 | } |
2712 | - elseif( 8 <= strlen( trim( $fbMember ))) { // text date ex. 2006-08-03 10:12:18 |
|
2713 | - $freebusyPairMember = $this->_date_time_string( $fbMember, 7 ); |
|
2712 | + elseif (8 <= strlen(trim($fbMember))) { // text date ex. 2006-08-03 10:12:18 |
|
2713 | + $freebusyPairMember = $this->_date_time_string($fbMember, 7); |
|
2714 | 2714 | $freebusyPairMember['tz'] = 'Z'; |
2715 | 2715 | } |
2716 | - $freebusyPeriod[] = $freebusyPairMember; |
|
2716 | + $freebusyPeriod[] = $freebusyPairMember; |
|
2717 | 2717 | } |
2718 | - $input[] = $freebusyPeriod; |
|
2718 | + $input[] = $freebusyPeriod; |
|
2719 | 2719 | } |
2720 | - $this->_setMval( $this->freebusy, $input, $params, FALSE, $index ); |
|
2720 | + $this->_setMval($this->freebusy, $input, $params, FALSE, $index); |
|
2721 | 2721 | return TRUE; |
2722 | 2722 | } |
2723 | 2723 | /*********************************************************************************/ |
@@ -2732,15 +2732,15 @@ discard block |
||
2732 | 2732 | * @return string |
2733 | 2733 | */ |
2734 | 2734 | function createGeo() { |
2735 | - if( empty( $this->geo )) return FALSE; |
|
2736 | - if( empty( $this->geo['value'] )) |
|
2737 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'GEO' ) : FALSE; |
|
2738 | - $attributes = $this->_createParams( $this->geo['params'] ); |
|
2735 | + if (empty($this->geo)) return FALSE; |
|
2736 | + if (empty($this->geo['value'])) |
|
2737 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('GEO') : FALSE; |
|
2738 | + $attributes = $this->_createParams($this->geo['params']); |
|
2739 | 2739 | $content = null; |
2740 | - $content .= number_format( (float) $this->geo['value']['latitude'], 6, '.', ''); |
|
2740 | + $content .= number_format((float) $this->geo['value']['latitude'], 6, '.', ''); |
|
2741 | 2741 | $content .= ';'; |
2742 | - $content .= number_format( (float) $this->geo['value']['longitude'], 6, '.', ''); |
|
2743 | - return $this->_createElement( 'GEO', $attributes, $content ); |
|
2742 | + $content .= number_format((float) $this->geo['value']['longitude'], 6, '.', ''); |
|
2743 | + return $this->_createElement('GEO', $attributes, $content); |
|
2744 | 2744 | } |
2745 | 2745 | /** |
2746 | 2746 | * set calendar component property geo |
@@ -2752,15 +2752,15 @@ discard block |
||
2752 | 2752 | * @param array $params optional |
2753 | 2753 | * @return bool |
2754 | 2754 | */ |
2755 | - function setGeo( $latitude, $longitude, $params=FALSE ) { |
|
2756 | - if( !empty( $latitude ) && !empty( $longitude )) { |
|
2757 | - if( !is_array( $this->geo )) $this->geo = array(); |
|
2755 | + function setGeo($latitude, $longitude, $params = FALSE) { |
|
2756 | + if (!empty($latitude) && !empty($longitude)) { |
|
2757 | + if (!is_array($this->geo)) $this->geo = array(); |
|
2758 | 2758 | $this->geo['value']['latitude'] = $latitude; |
2759 | 2759 | $this->geo['value']['longitude'] = $longitude; |
2760 | - $this->geo['params'] = $this->_setParams( $params ); |
|
2760 | + $this->geo['params'] = $this->_setParams($params); |
|
2761 | 2761 | } |
2762 | - elseif( $this->getConfig( 'allowEmpty' )) |
|
2763 | - $this->geo = array( 'value' => null, 'params' => $this->_setParams( $params ) ); |
|
2762 | + elseif ($this->getConfig('allowEmpty')) |
|
2763 | + $this->geo = array('value' => null, 'params' => $this->_setParams($params)); |
|
2764 | 2764 | else |
2765 | 2765 | return FALSE; |
2766 | 2766 | return TRUE; |
@@ -2777,10 +2777,10 @@ discard block |
||
2777 | 2777 | * @return string |
2778 | 2778 | */ |
2779 | 2779 | function createLastModified() { |
2780 | - if( empty( $this->lastmodified )) return FALSE; |
|
2781 | - $attributes = $this->_createParams( $this->lastmodified['params'] ); |
|
2782 | - $formatted = $this->_format_date_time( $this->lastmodified['value'], 7 ); |
|
2783 | - return $this->_createElement( 'LAST-MODIFIED', $attributes, $formatted ); |
|
2780 | + if (empty($this->lastmodified)) return FALSE; |
|
2781 | + $attributes = $this->_createParams($this->lastmodified['params']); |
|
2782 | + $formatted = $this->_format_date_time($this->lastmodified['value'], 7); |
|
2783 | + return $this->_createElement('LAST-MODIFIED', $attributes, $formatted); |
|
2784 | 2784 | } |
2785 | 2785 | /** |
2786 | 2786 | * set calendar component property completed |
@@ -2796,10 +2796,10 @@ discard block |
||
2796 | 2796 | * @param array $params optional |
2797 | 2797 | * @return boll |
2798 | 2798 | */ |
2799 | - function setLastModified( $year=FALSE, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) { |
|
2800 | - if( empty( $year )) |
|
2801 | - $year = date('Ymd\THis', mktime( date( 'H' ), date( 'i' ), date( 's' ) - date( 'Z'), date( 'm' ), date( 'd' ), date( 'Y' ))); |
|
2802 | - $this->lastmodified = $this->_setDate2( $year, $month, $day, $hour, $min, $sec, $params ); |
|
2799 | + function setLastModified($year = FALSE, $month = FALSE, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $params = FALSE) { |
|
2800 | + if (empty($year)) |
|
2801 | + $year = date('Ymd\THis', mktime(date('H'), date('i'), date('s') - date('Z'), date('m'), date('d'), date('Y'))); |
|
2802 | + $this->lastmodified = $this->_setDate2($year, $month, $day, $hour, $min, $sec, $params); |
|
2803 | 2803 | return TRUE; |
2804 | 2804 | } |
2805 | 2805 | /*********************************************************************************/ |
@@ -2814,12 +2814,12 @@ discard block |
||
2814 | 2814 | * @return string |
2815 | 2815 | */ |
2816 | 2816 | function createLocation() { |
2817 | - if( empty( $this->location )) return FALSE; |
|
2818 | - if( empty( $this->location['value'] )) |
|
2819 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'LOCATION' ) : FALSE; |
|
2820 | - $attributes = $this->_createParams( $this->location['params'], array( 'ALTREP', 'LANGUAGE' )); |
|
2821 | - $content = $this->_strrep( $this->location['value'] ); |
|
2822 | - return $this->_createElement( 'LOCATION', $attributes, $content ); |
|
2817 | + if (empty($this->location)) return FALSE; |
|
2818 | + if (empty($this->location['value'])) |
|
2819 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('LOCATION') : FALSE; |
|
2820 | + $attributes = $this->_createParams($this->location['params'], array('ALTREP', 'LANGUAGE')); |
|
2821 | + $content = $this->_strrep($this->location['value']); |
|
2822 | + return $this->_createElement('LOCATION', $attributes, $content); |
|
2823 | 2823 | } |
2824 | 2824 | /** |
2825 | 2825 | * set calendar component property location |
@@ -2830,9 +2830,9 @@ discard block |
||
2830 | 2830 | * @param array params optional |
2831 | 2831 | * @return bool |
2832 | 2832 | */ |
2833 | - function setLocation( $value, $params=FALSE ) { |
|
2834 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
2835 | - $this->location = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
2833 | + function setLocation($value, $params = FALSE) { |
|
2834 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
2835 | + $this->location = array('value' => $value, 'params' => $this->_setParams($params)); |
|
2836 | 2836 | return TRUE; |
2837 | 2837 | } |
2838 | 2838 | /*********************************************************************************/ |
@@ -2847,13 +2847,13 @@ discard block |
||
2847 | 2847 | * @return string |
2848 | 2848 | */ |
2849 | 2849 | function createOrganizer() { |
2850 | - if( empty( $this->organizer )) return FALSE; |
|
2851 | - if( empty( $this->organizer['value'] )) |
|
2852 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'ORGANIZER' ) : FALSE; |
|
2853 | - $attributes = $this->_createParams( $this->organizer['params'] |
|
2854 | - , array( 'CN', 'DIR', 'LANGUAGE', 'SENT-BY' )); |
|
2850 | + if (empty($this->organizer)) return FALSE; |
|
2851 | + if (empty($this->organizer['value'])) |
|
2852 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('ORGANIZER') : FALSE; |
|
2853 | + $attributes = $this->_createParams($this->organizer['params'] |
|
2854 | + , array('CN', 'DIR', 'LANGUAGE', 'SENT-BY')); |
|
2855 | 2855 | $content = 'MAILTO:'.$this->organizer['value']; |
2856 | - return $this->_createElement( 'ORGANIZER', $attributes, $content ); |
|
2856 | + return $this->_createElement('ORGANIZER', $attributes, $content); |
|
2857 | 2857 | } |
2858 | 2858 | /** |
2859 | 2859 | * set calendar component property organizer |
@@ -2864,14 +2864,14 @@ discard block |
||
2864 | 2864 | * @param array params optional |
2865 | 2865 | * @return bool |
2866 | 2866 | */ |
2867 | - function setOrganizer( $value, $params=FALSE ) { |
|
2868 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
2869 | - $value = str_replace ( 'MAILTO:', '', $value ); |
|
2870 | - $value = str_replace ( 'mailto:', '', $value ); |
|
2871 | - $this->organizer = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
2872 | - if( isset( $this->organizer['params']['SENT-BY'] )) { |
|
2873 | - if( 'MAILTO' == strtoupper( substr( $this->organizer['params']['SENT-BY'], 0, 6 ))) |
|
2874 | - $this->organizer['params']['SENT-BY'] = substr( $this->organizer['params']['SENT-BY'], 7 ); |
|
2867 | + function setOrganizer($value, $params = FALSE) { |
|
2868 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
2869 | + $value = str_replace('MAILTO:', '', $value); |
|
2870 | + $value = str_replace('mailto:', '', $value); |
|
2871 | + $this->organizer = array('value' => $value, 'params' => $this->_setParams($params)); |
|
2872 | + if (isset($this->organizer['params']['SENT-BY'])) { |
|
2873 | + if ('MAILTO' == strtoupper(substr($this->organizer['params']['SENT-BY'], 0, 6))) |
|
2874 | + $this->organizer['params']['SENT-BY'] = substr($this->organizer['params']['SENT-BY'], 7); |
|
2875 | 2875 | } |
2876 | 2876 | return TRUE; |
2877 | 2877 | } |
@@ -2887,11 +2887,11 @@ discard block |
||
2887 | 2887 | * @return string |
2888 | 2888 | */ |
2889 | 2889 | function createPercentComplete() { |
2890 | - if( empty( $this->percentcomplete )) return FALSE; |
|
2891 | - if( empty( $this->percentcomplete['value'] )) |
|
2892 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'PERCENT-COMPLETE' ) : FALSE; |
|
2893 | - $attributes = $this->_createParams( $this->percentcomplete['params'] ); |
|
2894 | - return $this->_createElement( 'PERCENT-COMPLETE', $attributes, $this->percentcomplete['value'] ); |
|
2890 | + if (empty($this->percentcomplete)) return FALSE; |
|
2891 | + if (empty($this->percentcomplete['value'])) |
|
2892 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('PERCENT-COMPLETE') : FALSE; |
|
2893 | + $attributes = $this->_createParams($this->percentcomplete['params']); |
|
2894 | + return $this->_createElement('PERCENT-COMPLETE', $attributes, $this->percentcomplete['value']); |
|
2895 | 2895 | } |
2896 | 2896 | /** |
2897 | 2897 | * set calendar component property percent-complete |
@@ -2902,9 +2902,9 @@ discard block |
||
2902 | 2902 | * @param array $params optional |
2903 | 2903 | * @return bool |
2904 | 2904 | */ |
2905 | - function setPercentComplete( $value, $params=FALSE ) { |
|
2906 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
2907 | - $this->percentcomplete = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
2905 | + function setPercentComplete($value, $params = FALSE) { |
|
2906 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
2907 | + $this->percentcomplete = array('value' => $value, 'params' => $this->_setParams($params)); |
|
2908 | 2908 | return TRUE; |
2909 | 2909 | } |
2910 | 2910 | /*********************************************************************************/ |
@@ -2919,11 +2919,11 @@ discard block |
||
2919 | 2919 | * @return string |
2920 | 2920 | */ |
2921 | 2921 | function createPriority() { |
2922 | - if( empty( $this->priority )) return FALSE; |
|
2923 | - if( empty( $this->priority['value'] )) |
|
2924 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'PRIORITY' ) : FALSE; |
|
2925 | - $attributes = $this->_createParams( $this->priority['params'] ); |
|
2926 | - return $this->_createElement( 'PRIORITY', $attributes, $this->priority['value'] ); |
|
2922 | + if (empty($this->priority)) return FALSE; |
|
2923 | + if (empty($this->priority['value'])) |
|
2924 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('PRIORITY') : FALSE; |
|
2925 | + $attributes = $this->_createParams($this->priority['params']); |
|
2926 | + return $this->_createElement('PRIORITY', $attributes, $this->priority['value']); |
|
2927 | 2927 | } |
2928 | 2928 | /** |
2929 | 2929 | * set calendar component property priority |
@@ -2934,9 +2934,9 @@ discard block |
||
2934 | 2934 | * @param array $params optional |
2935 | 2935 | * @return bool |
2936 | 2936 | */ |
2937 | - function setPriority( $value, $params=FALSE ) { |
|
2938 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
2939 | - $this->priority = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
2937 | + function setPriority($value, $params = FALSE) { |
|
2938 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
2939 | + $this->priority = array('value' => $value, 'params' => $this->_setParams($params)); |
|
2940 | 2940 | return TRUE; |
2941 | 2941 | } |
2942 | 2942 | /*********************************************************************************/ |
@@ -2951,91 +2951,91 @@ discard block |
||
2951 | 2951 | * @return string |
2952 | 2952 | */ |
2953 | 2953 | function createRdate() { |
2954 | - if( empty( $this->rdate )) return FALSE; |
|
2955 | - $utctime = ( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' ))) ? TRUE : FALSE; |
|
2954 | + if (empty($this->rdate)) return FALSE; |
|
2955 | + $utctime = (in_array($this->objName, array('vtimezone', 'standard', 'daylight'))) ? TRUE : FALSE; |
|
2956 | 2956 | $output = null; |
2957 | - if( $utctime ) |
|
2958 | - unset( $this->rdate['params']['TZID'] ); |
|
2959 | - foreach( $this->rdate as $theRdate ) { |
|
2960 | - if( empty( $theRdate['value'] )) { |
|
2961 | - if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'RDATE' ); |
|
2957 | + if ($utctime) |
|
2958 | + unset($this->rdate['params']['TZID']); |
|
2959 | + foreach ($this->rdate as $theRdate) { |
|
2960 | + if (empty($theRdate['value'])) { |
|
2961 | + if ($this->getConfig('allowEmpty')) $output .= $this->_createElement('RDATE'); |
|
2962 | 2962 | continue; |
2963 | 2963 | } |
2964 | - if( $utctime ) |
|
2965 | - unset( $theRdate['params']['TZID'] ); |
|
2966 | - $attributes = $this->_createParams( $theRdate['params'] ); |
|
2967 | - $cnt = count( $theRdate['value'] ); |
|
2964 | + if ($utctime) |
|
2965 | + unset($theRdate['params']['TZID']); |
|
2966 | + $attributes = $this->_createParams($theRdate['params']); |
|
2967 | + $cnt = count($theRdate['value']); |
|
2968 | 2968 | $content = null; |
2969 | 2969 | $rno = 1; |
2970 | - foreach( $theRdate['value'] as $rpix => $rdatePart ) { |
|
2970 | + foreach ($theRdate['value'] as $rpix => $rdatePart) { |
|
2971 | 2971 | $contentPart = null; |
2972 | - if( is_array( $rdatePart ) && |
|
2973 | - isset( $theRdate['params']['VALUE'] ) && ( 'PERIOD' == $theRdate['params']['VALUE'] )) { // PERIOD |
|
2974 | - if( $utctime ) |
|
2975 | - unset( $rdatePart[0]['tz'] ); |
|
2976 | - $formatted = $this->_format_date_time( $rdatePart[0]); // PERIOD part 1 |
|
2977 | - if( $utctime || !empty( $theRdate['params']['TZID'] )) |
|
2978 | - $formatted = str_replace( 'Z', '', $formatted); |
|
2979 | - if( 0 < $rpix ) { |
|
2980 | - if( !empty( $rdatePart[0]['tz'] ) && $this->_isOffset( $rdatePart[0]['tz'] )) { |
|
2981 | - if( 'Z' != substr( $formatted, -1 )) $formatted .= 'Z'; |
|
2972 | + if (is_array($rdatePart) && |
|
2973 | + isset($theRdate['params']['VALUE']) && ('PERIOD' == $theRdate['params']['VALUE'])) { // PERIOD |
|
2974 | + if ($utctime) |
|
2975 | + unset($rdatePart[0]['tz']); |
|
2976 | + $formatted = $this->_format_date_time($rdatePart[0]); // PERIOD part 1 |
|
2977 | + if ($utctime || !empty($theRdate['params']['TZID'])) |
|
2978 | + $formatted = str_replace('Z', '', $formatted); |
|
2979 | + if (0 < $rpix) { |
|
2980 | + if (!empty($rdatePart[0]['tz']) && $this->_isOffset($rdatePart[0]['tz'])) { |
|
2981 | + if ('Z' != substr($formatted, -1)) $formatted .= 'Z'; |
|
2982 | 2982 | } |
2983 | 2983 | else |
2984 | - $formatted = str_replace( 'Z', '', $formatted ); |
|
2984 | + $formatted = str_replace('Z', '', $formatted); |
|
2985 | 2985 | } |
2986 | 2986 | $contentPart .= $formatted; |
2987 | 2987 | $contentPart .= '/'; |
2988 | - $cnt2 = count( $rdatePart[1]); |
|
2989 | - if( array_key_exists( 'year', $rdatePart[1] )) { |
|
2990 | - if( array_key_exists( 'hour', $rdatePart[1] )) |
|
2991 | - $cnt2 = 7; // date-time |
|
2988 | + $cnt2 = count($rdatePart[1]); |
|
2989 | + if (array_key_exists('year', $rdatePart[1])) { |
|
2990 | + if (array_key_exists('hour', $rdatePart[1])) |
|
2991 | + $cnt2 = 7; // date-time |
|
2992 | 2992 | else |
2993 | - $cnt2 = 3; // date |
|
2993 | + $cnt2 = 3; // date |
|
2994 | 2994 | } |
2995 | - elseif( array_key_exists( 'week', $rdatePart[1] )) // duration |
|
2995 | + elseif (array_key_exists('week', $rdatePart[1])) // duration |
|
2996 | 2996 | $cnt2 = 5; |
2997 | - if(( 7 == $cnt2 ) && // period= -> date-time |
|
2998 | - isset( $rdatePart[1]['year'] ) && |
|
2999 | - isset( $rdatePart[1]['month'] ) && |
|
3000 | - isset( $rdatePart[1]['day'] )) { |
|
3001 | - if( $utctime ) |
|
3002 | - unset( $rdatePart[1]['tz'] ); |
|
3003 | - $formatted = $this->_format_date_time( $rdatePart[1] ); // PERIOD part 2 |
|
3004 | - if( $utctime || !empty( $theRdate['params']['TZID'] )) |
|
3005 | - $formatted = str_replace( 'Z', '', $formatted); |
|
3006 | - if( !empty( $rdatePart[0]['tz'] ) && $this->_isOffset( $rdatePart[0]['tz'] )) { |
|
3007 | - if( 'Z' != substr( $formatted, -1 )) $formatted .= 'Z'; |
|
2997 | + if ((7 == $cnt2) && // period= -> date-time |
|
2998 | + isset($rdatePart[1]['year']) && |
|
2999 | + isset($rdatePart[1]['month']) && |
|
3000 | + isset($rdatePart[1]['day'])) { |
|
3001 | + if ($utctime) |
|
3002 | + unset($rdatePart[1]['tz']); |
|
3003 | + $formatted = $this->_format_date_time($rdatePart[1]); // PERIOD part 2 |
|
3004 | + if ($utctime || !empty($theRdate['params']['TZID'])) |
|
3005 | + $formatted = str_replace('Z', '', $formatted); |
|
3006 | + if (!empty($rdatePart[0]['tz']) && $this->_isOffset($rdatePart[0]['tz'])) { |
|
3007 | + if ('Z' != substr($formatted, -1)) $formatted .= 'Z'; |
|
3008 | 3008 | } |
3009 | 3009 | else |
3010 | - $formatted = str_replace( 'Z', '', $formatted ); |
|
3010 | + $formatted = str_replace('Z', '', $formatted); |
|
3011 | 3011 | $contentPart .= $formatted; |
3012 | 3012 | } |
3013 | 3013 | else { // period= -> dur-time |
3014 | - $contentPart .= $this->_format_duration( $rdatePart[1] ); |
|
3014 | + $contentPart .= $this->_format_duration($rdatePart[1]); |
|
3015 | 3015 | } |
3016 | 3016 | } // PERIOD end |
3017 | 3017 | else { // SINGLE date start |
3018 | - if( $utctime ) |
|
3019 | - unset( $rdatePart['tz'] ); |
|
3020 | - $formatted = $this->_format_date_time( $rdatePart); |
|
3021 | - if( $utctime || !empty( $theRdate['params']['TZID'] )) |
|
3022 | - $formatted = str_replace( 'Z', '', $formatted); |
|
3023 | - if( !$utctime && ( 0 < $rpix )) { |
|
3024 | - if( !empty( $theRdate['value'][0]['tz'] ) && $this->_isOffset( $theRdate['value'][0]['tz'] )) { |
|
3025 | - if( 'Z' != substr( $formatted, -1 )) |
|
3018 | + if ($utctime) |
|
3019 | + unset($rdatePart['tz']); |
|
3020 | + $formatted = $this->_format_date_time($rdatePart); |
|
3021 | + if ($utctime || !empty($theRdate['params']['TZID'])) |
|
3022 | + $formatted = str_replace('Z', '', $formatted); |
|
3023 | + if (!$utctime && (0 < $rpix)) { |
|
3024 | + if (!empty($theRdate['value'][0]['tz']) && $this->_isOffset($theRdate['value'][0]['tz'])) { |
|
3025 | + if ('Z' != substr($formatted, -1)) |
|
3026 | 3026 | $formatted .= 'Z'; |
3027 | 3027 | } |
3028 | 3028 | else |
3029 | - $formatted = str_replace( 'Z', '', $formatted ); |
|
3029 | + $formatted = str_replace('Z', '', $formatted); |
|
3030 | 3030 | } |
3031 | 3031 | $contentPart .= $formatted; |
3032 | 3032 | } |
3033 | 3033 | $content .= $contentPart; |
3034 | - if( $rno < $cnt ) |
|
3034 | + if ($rno < $cnt) |
|
3035 | 3035 | $content .= ','; |
3036 | 3036 | $rno++; |
3037 | 3037 | } |
3038 | - $output .= $this->_createElement( 'RDATE', $attributes, $content ); |
|
3038 | + $output .= $this->_createElement('RDATE', $attributes, $content); |
|
3039 | 3039 | } |
3040 | 3040 | return $output; |
3041 | 3041 | } |
@@ -3049,93 +3049,93 @@ discard block |
||
3049 | 3049 | * @param integer $index, optional |
3050 | 3050 | * @return bool |
3051 | 3051 | */ |
3052 | - function setRdate( $rdates, $params=FALSE, $index=FALSE ) { |
|
3053 | - if( empty( $rdates )) { |
|
3054 | - if( $this->getConfig( 'allowEmpty' )) { |
|
3055 | - $this->_setMval( $this->rdate, null, $params, FALSE, $index ); |
|
3052 | + function setRdate($rdates, $params = FALSE, $index = FALSE) { |
|
3053 | + if (empty($rdates)) { |
|
3054 | + if ($this->getConfig('allowEmpty')) { |
|
3055 | + $this->_setMval($this->rdate, null, $params, FALSE, $index); |
|
3056 | 3056 | return TRUE; |
3057 | 3057 | } |
3058 | 3058 | else |
3059 | 3059 | return FALSE; |
3060 | 3060 | } |
3061 | - $input = array( 'params' => $this->_setParams( $params, array( 'VALUE' => 'DATE-TIME' ))); |
|
3062 | - if( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' ))) { |
|
3063 | - unset( $input['params']['TZID'] ); |
|
3061 | + $input = array('params' => $this->_setParams($params, array('VALUE' => 'DATE-TIME'))); |
|
3062 | + if (in_array($this->objName, array('vtimezone', 'standard', 'daylight'))) { |
|
3063 | + unset($input['params']['TZID']); |
|
3064 | 3064 | $input['params']['VALUE'] = 'DATE-TIME'; |
3065 | 3065 | } |
3066 | 3066 | /* check if PERIOD, if not set */ |
3067 | - if((!isset( $input['params']['VALUE'] ) || !in_array( $input['params']['VALUE'], array( 'DATE', 'PERIOD' ))) && |
|
3068 | - isset( $rdates[0] ) && is_array( $rdates[0] ) && ( 2 == count( $rdates[0] )) && |
|
3069 | - isset( $rdates[0][0] ) && isset( $rdates[0][1] ) && !isset( $rdates[0]['timestamp'] ) && |
|
3070 | - (( is_array( $rdates[0][0] ) && ( isset( $rdates[0][0]['timestamp'] ) || |
|
3071 | - $this->_isArrayDate( $rdates[0][0] ))) || |
|
3072 | - ( is_string( $rdates[0][0] ) && ( 8 <= strlen( trim( $rdates[0][0] ))))) && |
|
3073 | - ( is_array( $rdates[0][1] ) || ( is_string( $rdates[0][1] ) && ( 3 <= strlen( trim( $rdates[0][1] )))))) |
|
3067 | + if ((!isset($input['params']['VALUE']) || !in_array($input['params']['VALUE'], array('DATE', 'PERIOD'))) && |
|
3068 | + isset($rdates[0]) && is_array($rdates[0]) && (2 == count($rdates[0])) && |
|
3069 | + isset($rdates[0][0]) && isset($rdates[0][1]) && !isset($rdates[0]['timestamp']) && |
|
3070 | + ((is_array($rdates[0][0]) && (isset($rdates[0][0]['timestamp']) || |
|
3071 | + $this->_isArrayDate($rdates[0][0]))) || |
|
3072 | + (is_string($rdates[0][0]) && (8 <= strlen(trim($rdates[0][0]))))) && |
|
3073 | + (is_array($rdates[0][1]) || (is_string($rdates[0][1]) && (3 <= strlen(trim($rdates[0][1])))))) |
|
3074 | 3074 | $input['params']['VALUE'] = 'PERIOD'; |
3075 | 3075 | /* check 1:st date, upd. $parno (opt) and save ev. timezone **/ |
3076 | - $date = reset( $rdates ); |
|
3077 | - if( isset( $input['params']['VALUE'] ) && ( 'PERIOD' == $input['params']['VALUE'] )) // PERIOD |
|
3078 | - $date = reset( $date ); |
|
3079 | - $this->_chkdatecfg( $date, $parno, $input['params'] ); |
|
3080 | - if( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' ))) |
|
3081 | - unset( $input['params']['TZID'] ); |
|
3082 | - $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME' ); // remove default |
|
3083 | - foreach( $rdates as $rpix => $theRdate ) { |
|
3076 | + $date = reset($rdates); |
|
3077 | + if (isset($input['params']['VALUE']) && ('PERIOD' == $input['params']['VALUE'])) // PERIOD |
|
3078 | + $date = reset($date); |
|
3079 | + $this->_chkdatecfg($date, $parno, $input['params']); |
|
3080 | + if (in_array($this->objName, array('vtimezone', 'standard', 'daylight'))) |
|
3081 | + unset($input['params']['TZID']); |
|
3082 | + $this->_existRem($input['params'], 'VALUE', 'DATE-TIME'); // remove default |
|
3083 | + foreach ($rdates as $rpix => $theRdate) { |
|
3084 | 3084 | $inputa = null; |
3085 | - if( is_array( $theRdate )) { |
|
3086 | - if( isset( $input['params']['VALUE'] ) && ( 'PERIOD' == $input['params']['VALUE'] )) { // PERIOD |
|
3087 | - foreach( $theRdate as $rix => $rPeriod ) { |
|
3088 | - if( is_array( $rPeriod )) { |
|
3089 | - if( $this->_isArrayTimestampDate( $rPeriod )) // timestamp |
|
3090 | - $inputab = ( isset( $rPeriod['tz'] )) ? $this->_timestamp2date( $rPeriod, $parno ) : $this->_timestamp2date( $rPeriod, 6 ); |
|
3091 | - elseif( $this->_isArrayDate( $rPeriod )) |
|
3092 | - $inputab = ( 3 < count ( $rPeriod )) ? $this->_date_time_array( $rPeriod, $parno ) : $this->_date_time_array( $rPeriod, 6 ); |
|
3093 | - elseif (( 1 == count( $rPeriod )) && ( 8 <= strlen( reset( $rPeriod )))) // text-date |
|
3094 | - $inputab = $this->_date_time_string( reset( $rPeriod ), $parno ); |
|
3085 | + if (is_array($theRdate)) { |
|
3086 | + if (isset($input['params']['VALUE']) && ('PERIOD' == $input['params']['VALUE'])) { // PERIOD |
|
3087 | + foreach ($theRdate as $rix => $rPeriod) { |
|
3088 | + if (is_array($rPeriod)) { |
|
3089 | + if ($this->_isArrayTimestampDate($rPeriod)) // timestamp |
|
3090 | + $inputab = (isset($rPeriod['tz'])) ? $this->_timestamp2date($rPeriod, $parno) : $this->_timestamp2date($rPeriod, 6); |
|
3091 | + elseif ($this->_isArrayDate($rPeriod)) |
|
3092 | + $inputab = (3 < count($rPeriod)) ? $this->_date_time_array($rPeriod, $parno) : $this->_date_time_array($rPeriod, 6); |
|
3093 | + elseif ((1 == count($rPeriod)) && (8 <= strlen(reset($rPeriod)))) // text-date |
|
3094 | + $inputab = $this->_date_time_string(reset($rPeriod), $parno); |
|
3095 | 3095 | else // array format duration |
3096 | - $inputab = $this->_duration_array( $rPeriod ); |
|
3096 | + $inputab = $this->_duration_array($rPeriod); |
|
3097 | 3097 | } |
3098 | - elseif(( 3 <= strlen( trim( $rPeriod ))) && // string format duration |
|
3099 | - ( in_array( $rPeriod{0}, array( 'P', '+', '-' )))) { |
|
3100 | - if( 'P' != $rPeriod{0} ) |
|
3101 | - $rPeriod = substr( $rPeriod, 1 ); |
|
3102 | - $inputab = $this->_duration_string( $rPeriod ); |
|
3098 | + elseif ((3 <= strlen(trim($rPeriod))) && // string format duration |
|
3099 | + (in_array($rPeriod{0}, array('P', '+', '-')))) { |
|
3100 | + if ('P' != $rPeriod{0} ) |
|
3101 | + $rPeriod = substr($rPeriod, 1); |
|
3102 | + $inputab = $this->_duration_string($rPeriod); |
|
3103 | 3103 | } |
3104 | - elseif( 8 <= strlen( trim( $rPeriod ))) // text date ex. 2006-08-03 10:12:18 |
|
3105 | - $inputab = $this->_date_time_string( $rPeriod, $parno ); |
|
3106 | - if( isset( $input['params']['TZID'] ) || |
|
3107 | - ( isset( $inputab['tz'] ) && !$this->_isOffset( $inputab['tz'] )) || |
|
3108 | - ( isset( $inputa[0] ) && ( !isset( $inputa[0]['tz'] ))) || |
|
3109 | - ( isset( $inputa[0]['tz'] ) && !$this->_isOffset( $inputa[0]['tz'] ))) |
|
3110 | - unset( $inputab['tz'] ); |
|
3111 | - $inputa[] = $inputab; |
|
3104 | + elseif (8 <= strlen(trim($rPeriod))) // text date ex. 2006-08-03 10:12:18 |
|
3105 | + $inputab = $this->_date_time_string($rPeriod, $parno); |
|
3106 | + if (isset($input['params']['TZID']) || |
|
3107 | + (isset($inputab['tz']) && !$this->_isOffset($inputab['tz'])) || |
|
3108 | + (isset($inputa[0]) && (!isset($inputa[0]['tz']))) || |
|
3109 | + (isset($inputa[0]['tz']) && !$this->_isOffset($inputa[0]['tz']))) |
|
3110 | + unset($inputab['tz']); |
|
3111 | + $inputa[] = $inputab; |
|
3112 | 3112 | } |
3113 | 3113 | } // PERIOD end |
3114 | - elseif ( $this->_isArrayTimestampDate( $theRdate )) // timestamp |
|
3115 | - $inputa = $this->_timestamp2date( $theRdate, $parno ); |
|
3114 | + elseif ($this->_isArrayTimestampDate($theRdate)) // timestamp |
|
3115 | + $inputa = $this->_timestamp2date($theRdate, $parno); |
|
3116 | 3116 | else // date[-time] |
3117 | - $inputa = $this->_date_time_array( $theRdate, $parno ); |
|
3117 | + $inputa = $this->_date_time_array($theRdate, $parno); |
|
3118 | 3118 | } |
3119 | - elseif( 8 <= strlen( trim( $theRdate ))) // text date ex. 2006-08-03 10:12:18 |
|
3120 | - $inputa = $this->_date_time_string( $theRdate, $parno ); |
|
3121 | - if( !isset( $input['params']['VALUE'] ) || ( 'PERIOD' != $input['params']['VALUE'] )) { // no PERIOD |
|
3122 | - if( 3 == $parno ) |
|
3123 | - unset( $inputa['hour'], $inputa['min'], $inputa['sec'], $inputa['tz'] ); |
|
3124 | - elseif( isset( $inputa['tz'] )) |
|
3119 | + elseif (8 <= strlen(trim($theRdate))) // text date ex. 2006-08-03 10:12:18 |
|
3120 | + $inputa = $this->_date_time_string($theRdate, $parno); |
|
3121 | + if (!isset($input['params']['VALUE']) || ('PERIOD' != $input['params']['VALUE'])) { // no PERIOD |
|
3122 | + if (3 == $parno) |
|
3123 | + unset($inputa['hour'], $inputa['min'], $inputa['sec'], $inputa['tz']); |
|
3124 | + elseif (isset($inputa['tz'])) |
|
3125 | 3125 | $inputa['tz'] = (string) $inputa['tz']; |
3126 | - if( isset( $input['params']['TZID'] ) || |
|
3127 | - ( isset( $inputa['tz'] ) && !$this->_isOffset( $inputa['tz'] )) || |
|
3128 | - ( isset( $input['value'][0] ) && ( !isset( $input['value'][0]['tz'] ))) || |
|
3129 | - ( isset( $input['value'][0]['tz'] ) && !$this->_isOffset( $input['value'][0]['tz'] ))) |
|
3130 | - unset( $inputa['tz'] ); |
|
3126 | + if (isset($input['params']['TZID']) || |
|
3127 | + (isset($inputa['tz']) && !$this->_isOffset($inputa['tz'])) || |
|
3128 | + (isset($input['value'][0]) && (!isset($input['value'][0]['tz']))) || |
|
3129 | + (isset($input['value'][0]['tz']) && !$this->_isOffset($input['value'][0]['tz']))) |
|
3130 | + unset($inputa['tz']); |
|
3131 | 3131 | } |
3132 | 3132 | $input['value'][] = $inputa; |
3133 | 3133 | } |
3134 | - if( 3 == $parno ) { |
|
3134 | + if (3 == $parno) { |
|
3135 | 3135 | $input['params']['VALUE'] = 'DATE'; |
3136 | - unset( $input['params']['TZID'] ); |
|
3136 | + unset($input['params']['TZID']); |
|
3137 | 3137 | } |
3138 | - $this->_setMval( $this->rdate, $input['value'], $input['params'], FALSE, $index ); |
|
3138 | + $this->_setMval($this->rdate, $input['value'], $input['params'], FALSE, $index); |
|
3139 | 3139 | return TRUE; |
3140 | 3140 | } |
3141 | 3141 | /*********************************************************************************/ |
@@ -3150,12 +3150,12 @@ discard block |
||
3150 | 3150 | * @return string |
3151 | 3151 | */ |
3152 | 3152 | function createRecurrenceid() { |
3153 | - if( empty( $this->recurrenceid )) return FALSE; |
|
3154 | - if( empty( $this->recurrenceid['value'] )) |
|
3155 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'RECURRENCE-ID' ) : FALSE; |
|
3156 | - $formatted = $this->_format_date_time( $this->recurrenceid['value'] ); |
|
3157 | - $attributes = $this->_createParams( $this->recurrenceid['params'] ); |
|
3158 | - return $this->_createElement( 'RECURRENCE-ID', $attributes, $formatted ); |
|
3153 | + if (empty($this->recurrenceid)) return FALSE; |
|
3154 | + if (empty($this->recurrenceid['value'])) |
|
3155 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('RECURRENCE-ID') : FALSE; |
|
3156 | + $formatted = $this->_format_date_time($this->recurrenceid['value']); |
|
3157 | + $attributes = $this->_createParams($this->recurrenceid['params']); |
|
3158 | + return $this->_createElement('RECURRENCE-ID', $attributes, $formatted); |
|
3159 | 3159 | } |
3160 | 3160 | /** |
3161 | 3161 | * set calendar component property recurrence-id |
@@ -3171,16 +3171,16 @@ discard block |
||
3171 | 3171 | * @param array $params optional |
3172 | 3172 | * @return bool |
3173 | 3173 | */ |
3174 | - function setRecurrenceid( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) { |
|
3175 | - if( empty( $year )) { |
|
3176 | - if( $this->getConfig( 'allowEmpty' )) { |
|
3177 | - $this->recurrenceid = array( 'value' => null, 'params' => null ); |
|
3174 | + function setRecurrenceid($year, $month = FALSE, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $tz = FALSE, $params = FALSE) { |
|
3175 | + if (empty($year)) { |
|
3176 | + if ($this->getConfig('allowEmpty')) { |
|
3177 | + $this->recurrenceid = array('value' => null, 'params' => null); |
|
3178 | 3178 | return TRUE; |
3179 | 3179 | } |
3180 | 3180 | else |
3181 | 3181 | return FALSE; |
3182 | 3182 | } |
3183 | - $this->recurrenceid = $this->_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params ); |
|
3183 | + $this->recurrenceid = $this->_setDate($year, $month, $day, $hour, $min, $sec, $tz, $params); |
|
3184 | 3184 | return TRUE; |
3185 | 3185 | } |
3186 | 3186 | /*********************************************************************************/ |
@@ -3195,18 +3195,18 @@ discard block |
||
3195 | 3195 | * @return string |
3196 | 3196 | */ |
3197 | 3197 | function createRelatedTo() { |
3198 | - if( empty( $this->relatedto )) return FALSE; |
|
3198 | + if (empty($this->relatedto)) return FALSE; |
|
3199 | 3199 | $output = null; |
3200 | - foreach( $this->relatedto as $relation ) { |
|
3201 | - if( empty( $relation['value'] )) { |
|
3202 | - if( $this->getConfig( 'allowEmpty' )) $output.= $this->_createElement( 'RELATED-TO', $this->_createParams( $relation['params'] )); |
|
3200 | + foreach ($this->relatedto as $relation) { |
|
3201 | + if (empty($relation['value'])) { |
|
3202 | + if ($this->getConfig('allowEmpty')) $output .= $this->_createElement('RELATED-TO', $this->_createParams($relation['params'])); |
|
3203 | 3203 | continue; |
3204 | 3204 | } |
3205 | - $attributes = $this->_createParams( $relation['params'] ); |
|
3206 | - $content = ( 'xcal' != $this->format ) ? '<' : ''; |
|
3207 | - $content .= $this->_strrep( $relation['value'] ); |
|
3208 | - $content .= ( 'xcal' != $this->format ) ? '>' : ''; |
|
3209 | - $output .= $this->_createElement( 'RELATED-TO', $attributes, $content ); |
|
3205 | + $attributes = $this->_createParams($relation['params']); |
|
3206 | + $content = ('xcal' != $this->format) ? '<' : ''; |
|
3207 | + $content .= $this->_strrep($relation['value']); |
|
3208 | + $content .= ('xcal' != $this->format) ? '>' : ''; |
|
3209 | + $output .= $this->_createElement('RELATED-TO', $attributes, $content); |
|
3210 | 3210 | } |
3211 | 3211 | return $output; |
3212 | 3212 | } |
@@ -3220,12 +3220,12 @@ discard block |
||
3220 | 3220 | * @param index $index, optional |
3221 | 3221 | * @return bool |
3222 | 3222 | */ |
3223 | - function setRelatedTo( $value, $params=FALSE, $index=FALSE ) { |
|
3224 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3225 | - if(( '<' == substr( $value, 0, 1 )) && ( '>' == substr( $value, -1 ))) |
|
3226 | - $value = substr( $value, 1, ( strlen( $value ) - 2 )); |
|
3227 | - $this->_existRem( $params, 'RELTYPE', 'PARENT', TRUE ); // remove default |
|
3228 | - $this->_setMval( $this->relatedto, $value, $params, FALSE, $index ); |
|
3223 | + function setRelatedTo($value, $params = FALSE, $index = FALSE) { |
|
3224 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3225 | + if (('<' == substr($value, 0, 1)) && ('>' == substr($value, -1))) |
|
3226 | + $value = substr($value, 1, (strlen($value) - 2)); |
|
3227 | + $this->_existRem($params, 'RELTYPE', 'PARENT', TRUE); // remove default |
|
3228 | + $this->_setMval($this->relatedto, $value, $params, FALSE, $index); |
|
3229 | 3229 | return TRUE; |
3230 | 3230 | } |
3231 | 3231 | /*********************************************************************************/ |
@@ -3240,11 +3240,11 @@ discard block |
||
3240 | 3240 | * @return string |
3241 | 3241 | */ |
3242 | 3242 | function createRepeat() { |
3243 | - if( empty( $this->repeat )) return FALSE; |
|
3244 | - if( empty( $this->repeat['value'] )) |
|
3245 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'REPEAT' ) : FALSE; |
|
3246 | - $attributes = $this->_createParams( $this->repeat['params'] ); |
|
3247 | - return $this->_createElement( 'REPEAT', $attributes, $this->repeat['value'] ); |
|
3243 | + if (empty($this->repeat)) return FALSE; |
|
3244 | + if (empty($this->repeat['value'])) |
|
3245 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('REPEAT') : FALSE; |
|
3246 | + $attributes = $this->_createParams($this->repeat['params']); |
|
3247 | + return $this->_createElement('REPEAT', $attributes, $this->repeat['value']); |
|
3248 | 3248 | } |
3249 | 3249 | /** |
3250 | 3250 | * set calendar component property transp |
@@ -3255,9 +3255,9 @@ discard block |
||
3255 | 3255 | * @param array $params optional |
3256 | 3256 | * @return void |
3257 | 3257 | */ |
3258 | - function setRepeat( $value, $params=FALSE ) { |
|
3259 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3260 | - $this->repeat = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
3258 | + function setRepeat($value, $params = FALSE) { |
|
3259 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3260 | + $this->repeat = array('value' => $value, 'params' => $this->_setParams($params)); |
|
3261 | 3261 | return TRUE; |
3262 | 3262 | } |
3263 | 3263 | /*********************************************************************************/ |
@@ -3271,19 +3271,19 @@ discard block |
||
3271 | 3271 | * @return string |
3272 | 3272 | */ |
3273 | 3273 | function createRequestStatus() { |
3274 | - if( empty( $this->requeststatus )) return FALSE; |
|
3274 | + if (empty($this->requeststatus)) return FALSE; |
|
3275 | 3275 | $output = null; |
3276 | - foreach( $this->requeststatus as $rstat ) { |
|
3277 | - if( empty( $rstat['value']['statcode'] )) { |
|
3278 | - if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'REQUEST-STATUS' ); |
|
3276 | + foreach ($this->requeststatus as $rstat) { |
|
3277 | + if (empty($rstat['value']['statcode'])) { |
|
3278 | + if ($this->getConfig('allowEmpty')) $output .= $this->_createElement('REQUEST-STATUS'); |
|
3279 | 3279 | continue; |
3280 | 3280 | } |
3281 | - $attributes = $this->_createParams( $rstat['params'], array( 'LANGUAGE' )); |
|
3282 | - $content = number_format( (float) $rstat['value']['statcode'], 2, '.', ''); |
|
3283 | - $content .= ';'.$this->_strrep( $rstat['value']['text'] ); |
|
3284 | - if( isset( $rstat['value']['extdata'] )) |
|
3285 | - $content .= ';'.$this->_strrep( $rstat['value']['extdata'] ); |
|
3286 | - $output .= $this->_createElement( 'REQUEST-STATUS', $attributes, $content ); |
|
3281 | + $attributes = $this->_createParams($rstat['params'], array('LANGUAGE')); |
|
3282 | + $content = number_format((float) $rstat['value']['statcode'], 2, '.', ''); |
|
3283 | + $content .= ';'.$this->_strrep($rstat['value']['text']); |
|
3284 | + if (isset($rstat['value']['extdata'])) |
|
3285 | + $content .= ';'.$this->_strrep($rstat['value']['extdata']); |
|
3286 | + $output .= $this->_createElement('REQUEST-STATUS', $attributes, $content); |
|
3287 | 3287 | } |
3288 | 3288 | return $output; |
3289 | 3289 | } |
@@ -3299,12 +3299,12 @@ discard block |
||
3299 | 3299 | * @param integer $index, optional |
3300 | 3300 | * @return bool |
3301 | 3301 | */ |
3302 | - function setRequestStatus( $statcode, $text, $extdata=FALSE, $params=FALSE, $index=FALSE ) { |
|
3303 | - if( empty( $statcode ) || empty( $text )) if( $this->getConfig( 'allowEmpty' )) $statcode = $text = null; else return FALSE; |
|
3304 | - $input = array( 'statcode' => $statcode, 'text' => $text ); |
|
3305 | - if( $extdata ) |
|
3302 | + function setRequestStatus($statcode, $text, $extdata = FALSE, $params = FALSE, $index = FALSE) { |
|
3303 | + if (empty($statcode) || empty($text)) if ($this->getConfig('allowEmpty')) $statcode = $text = null; else return FALSE; |
|
3304 | + $input = array('statcode' => $statcode, 'text' => $text); |
|
3305 | + if ($extdata) |
|
3306 | 3306 | $input['extdata'] = $extdata; |
3307 | - $this->_setMval( $this->requeststatus, $input, $params, FALSE, $index ); |
|
3307 | + $this->_setMval($this->requeststatus, $input, $params, FALSE, $index); |
|
3308 | 3308 | return TRUE; |
3309 | 3309 | } |
3310 | 3310 | /*********************************************************************************/ |
@@ -3319,22 +3319,22 @@ discard block |
||
3319 | 3319 | * @return string |
3320 | 3320 | */ |
3321 | 3321 | function createResources() { |
3322 | - if( empty( $this->resources )) return FALSE; |
|
3322 | + if (empty($this->resources)) return FALSE; |
|
3323 | 3323 | $output = null; |
3324 | - foreach( $this->resources as $resource ) { |
|
3325 | - if( empty( $resource['value'] )) { |
|
3326 | - if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'RESOURCES' ); |
|
3324 | + foreach ($this->resources as $resource) { |
|
3325 | + if (empty($resource['value'])) { |
|
3326 | + if ($this->getConfig('allowEmpty')) $output .= $this->_createElement('RESOURCES'); |
|
3327 | 3327 | continue; |
3328 | 3328 | } |
3329 | - $attributes = $this->_createParams( $resource['params'], array( 'ALTREP', 'LANGUAGE' )); |
|
3330 | - if( is_array( $resource['value'] )) { |
|
3331 | - foreach( $resource['value'] as $rix => $resourcePart ) |
|
3332 | - $resource['value'][$rix] = $this->_strrep( $resourcePart ); |
|
3333 | - $content = implode( ',', $resource['value'] ); |
|
3329 | + $attributes = $this->_createParams($resource['params'], array('ALTREP', 'LANGUAGE')); |
|
3330 | + if (is_array($resource['value'])) { |
|
3331 | + foreach ($resource['value'] as $rix => $resourcePart) |
|
3332 | + $resource['value'][$rix] = $this->_strrep($resourcePart); |
|
3333 | + $content = implode(',', $resource['value']); |
|
3334 | 3334 | } |
3335 | 3335 | else |
3336 | - $content = $this->_strrep( $resource['value'] ); |
|
3337 | - $output .= $this->_createElement( 'RESOURCES', $attributes, $content ); |
|
3336 | + $content = $this->_strrep($resource['value']); |
|
3337 | + $output .= $this->_createElement('RESOURCES', $attributes, $content); |
|
3338 | 3338 | } |
3339 | 3339 | return $output; |
3340 | 3340 | } |
@@ -3348,9 +3348,9 @@ discard block |
||
3348 | 3348 | * @param integer $index, optional |
3349 | 3349 | * @return bool |
3350 | 3350 | */ |
3351 | - function setResources( $value, $params=FALSE, $index=FALSE ) { |
|
3352 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3353 | - $this->_setMval( $this->resources, $value, $params, FALSE, $index ); |
|
3351 | + function setResources($value, $params = FALSE, $index = FALSE) { |
|
3352 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3353 | + $this->_setMval($this->resources, $value, $params, FALSE, $index); |
|
3354 | 3354 | return TRUE; |
3355 | 3355 | } |
3356 | 3356 | /*********************************************************************************/ |
@@ -3365,8 +3365,8 @@ discard block |
||
3365 | 3365 | * @return string |
3366 | 3366 | */ |
3367 | 3367 | function createRrule() { |
3368 | - if( empty( $this->rrule )) return FALSE; |
|
3369 | - return $this->_format_recur( 'RRULE', $this->rrule ); |
|
3368 | + if (empty($this->rrule)) return FALSE; |
|
3369 | + return $this->_format_recur('RRULE', $this->rrule); |
|
3370 | 3370 | } |
3371 | 3371 | /** |
3372 | 3372 | * set calendar component property rrule |
@@ -3378,9 +3378,9 @@ discard block |
||
3378 | 3378 | * @param integer $index, optional |
3379 | 3379 | * @return void |
3380 | 3380 | */ |
3381 | - function setRrule( $rruleset, $params=FALSE, $index=FALSE ) { |
|
3382 | - if( empty( $rruleset )) if( $this->getConfig( 'allowEmpty' )) $rruleset = null; else return FALSE; |
|
3383 | - $this->_setMval( $this->rrule, $this->_setRexrule( $rruleset ), $params, FALSE, $index ); |
|
3381 | + function setRrule($rruleset, $params = FALSE, $index = FALSE) { |
|
3382 | + if (empty($rruleset)) if ($this->getConfig('allowEmpty')) $rruleset = null; else return FALSE; |
|
3383 | + $this->_setMval($this->rrule, $this->_setRexrule($rruleset), $params, FALSE, $index); |
|
3384 | 3384 | return TRUE; |
3385 | 3385 | } |
3386 | 3386 | /*********************************************************************************/ |
@@ -3394,11 +3394,11 @@ discard block |
||
3394 | 3394 | * @return string |
3395 | 3395 | */ |
3396 | 3396 | function createSequence() { |
3397 | - if( empty( $this->sequence )) return FALSE; |
|
3398 | - if( empty( $this->sequence['value'] )) |
|
3399 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'SEQUENCE' ) : FALSE; |
|
3400 | - $attributes = $this->_createParams( $this->sequence['params'] ); |
|
3401 | - return $this->_createElement( 'SEQUENCE', $attributes, $this->sequence['value'] ); |
|
3397 | + if (empty($this->sequence)) return FALSE; |
|
3398 | + if (empty($this->sequence['value'])) |
|
3399 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('SEQUENCE') : FALSE; |
|
3400 | + $attributes = $this->_createParams($this->sequence['params']); |
|
3401 | + return $this->_createElement('SEQUENCE', $attributes, $this->sequence['value']); |
|
3402 | 3402 | } |
3403 | 3403 | /** |
3404 | 3404 | * set calendar component property sequence |
@@ -3408,10 +3408,10 @@ discard block |
||
3408 | 3408 | * @param array $params optional |
3409 | 3409 | * @return bool |
3410 | 3410 | */ |
3411 | - function setSequence( $value=FALSE, $params=FALSE ) { |
|
3412 | - if( empty( $value )) |
|
3413 | - $value = ( isset( $this->sequence['value'] ) && ( 0 < $this->sequence['value'] )) ? $this->sequence['value'] + 1 : 1; |
|
3414 | - $this->sequence = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
3411 | + function setSequence($value = FALSE, $params = FALSE) { |
|
3412 | + if (empty($value)) |
|
3413 | + $value = (isset($this->sequence['value']) && (0 < $this->sequence['value'])) ? $this->sequence['value'] + 1 : 1; |
|
3414 | + $this->sequence = array('value' => $value, 'params' => $this->_setParams($params)); |
|
3415 | 3415 | return TRUE; |
3416 | 3416 | } |
3417 | 3417 | /*********************************************************************************/ |
@@ -3426,11 +3426,11 @@ discard block |
||
3426 | 3426 | * @return string |
3427 | 3427 | */ |
3428 | 3428 | function createStatus() { |
3429 | - if( empty( $this->status )) return FALSE; |
|
3430 | - if( empty( $this->status['value'] )) |
|
3431 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'STATUS' ) : FALSE; |
|
3432 | - $attributes = $this->_createParams( $this->status['params'] ); |
|
3433 | - return $this->_createElement( 'STATUS', $attributes, $this->status['value'] ); |
|
3429 | + if (empty($this->status)) return FALSE; |
|
3430 | + if (empty($this->status['value'])) |
|
3431 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('STATUS') : FALSE; |
|
3432 | + $attributes = $this->_createParams($this->status['params']); |
|
3433 | + return $this->_createElement('STATUS', $attributes, $this->status['value']); |
|
3434 | 3434 | } |
3435 | 3435 | /** |
3436 | 3436 | * set calendar component property status |
@@ -3441,9 +3441,9 @@ discard block |
||
3441 | 3441 | * @param mixed $params optional (array or false) |
3442 | 3442 | * @return bool |
3443 | 3443 | */ |
3444 | - function setStatus( $value, $params=FALSE ) { |
|
3445 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3446 | - $this->status = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
3444 | + function setStatus($value, $params = FALSE) { |
|
3445 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3446 | + $this->status = array('value' => $value, 'params' => $this->_setParams($params)); |
|
3447 | 3447 | return TRUE; |
3448 | 3448 | } |
3449 | 3449 | /*********************************************************************************/ |
@@ -3458,12 +3458,12 @@ discard block |
||
3458 | 3458 | * @return string |
3459 | 3459 | */ |
3460 | 3460 | function createSummary() { |
3461 | - if( empty( $this->summary )) return FALSE; |
|
3462 | - if( empty( $this->summary['value'] )) |
|
3463 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'SUMMARY' ) : FALSE; |
|
3464 | - $attributes = $this->_createParams( $this->summary['params'], array( 'ALTREP', 'LANGUAGE' )); |
|
3465 | - $content = $this->_strrep( $this->summary['value'] ); |
|
3466 | - return $this->_createElement( 'SUMMARY', $attributes, $content ); |
|
3461 | + if (empty($this->summary)) return FALSE; |
|
3462 | + if (empty($this->summary['value'])) |
|
3463 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('SUMMARY') : FALSE; |
|
3464 | + $attributes = $this->_createParams($this->summary['params'], array('ALTREP', 'LANGUAGE')); |
|
3465 | + $content = $this->_strrep($this->summary['value']); |
|
3466 | + return $this->_createElement('SUMMARY', $attributes, $content); |
|
3467 | 3467 | } |
3468 | 3468 | /** |
3469 | 3469 | * set calendar component property summary |
@@ -3474,9 +3474,9 @@ discard block |
||
3474 | 3474 | * @param string $params optional |
3475 | 3475 | * @return bool |
3476 | 3476 | */ |
3477 | - function setSummary( $value, $params=FALSE ) { |
|
3478 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3479 | - $this->summary = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
3477 | + function setSummary($value, $params = FALSE) { |
|
3478 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3479 | + $this->summary = array('value' => $value, 'params' => $this->_setParams($params)); |
|
3480 | 3480 | return TRUE; |
3481 | 3481 | } |
3482 | 3482 | /*********************************************************************************/ |
@@ -3491,11 +3491,11 @@ discard block |
||
3491 | 3491 | * @return string |
3492 | 3492 | */ |
3493 | 3493 | function createTransp() { |
3494 | - if( empty( $this->transp )) return FALSE; |
|
3495 | - if( empty( $this->transp['value'] )) |
|
3496 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TRANSP' ) : FALSE; |
|
3497 | - $attributes = $this->_createParams( $this->transp['params'] ); |
|
3498 | - return $this->_createElement( 'TRANSP', $attributes, $this->transp['value'] ); |
|
3494 | + if (empty($this->transp)) return FALSE; |
|
3495 | + if (empty($this->transp['value'])) |
|
3496 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('TRANSP') : FALSE; |
|
3497 | + $attributes = $this->_createParams($this->transp['params']); |
|
3498 | + return $this->_createElement('TRANSP', $attributes, $this->transp['value']); |
|
3499 | 3499 | } |
3500 | 3500 | /** |
3501 | 3501 | * set calendar component property transp |
@@ -3506,9 +3506,9 @@ discard block |
||
3506 | 3506 | * @param string $params optional |
3507 | 3507 | * @return bool |
3508 | 3508 | */ |
3509 | - function setTransp( $value, $params=FALSE ) { |
|
3510 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3511 | - $this->transp = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
3509 | + function setTransp($value, $params = FALSE) { |
|
3510 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3511 | + $this->transp = array('value' => $value, 'params' => $this->_setParams($params)); |
|
3512 | 3512 | return TRUE; |
3513 | 3513 | } |
3514 | 3514 | /*********************************************************************************/ |
@@ -3523,23 +3523,23 @@ discard block |
||
3523 | 3523 | * @return string |
3524 | 3524 | */ |
3525 | 3525 | function createTrigger() { |
3526 | - if( empty( $this->trigger )) return FALSE; |
|
3527 | - if( empty( $this->trigger['value'] )) |
|
3528 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TRIGGER' ) : FALSE; |
|
3526 | + if (empty($this->trigger)) return FALSE; |
|
3527 | + if (empty($this->trigger['value'])) |
|
3528 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('TRIGGER') : FALSE; |
|
3529 | 3529 | $content = $attributes = null; |
3530 | - if( isset( $this->trigger['value']['year'] ) && |
|
3531 | - isset( $this->trigger['value']['month'] ) && |
|
3532 | - isset( $this->trigger['value']['day'] )) |
|
3533 | - $content .= $this->_format_date_time( $this->trigger['value'] ); |
|
3530 | + if (isset($this->trigger['value']['year']) && |
|
3531 | + isset($this->trigger['value']['month']) && |
|
3532 | + isset($this->trigger['value']['day'])) |
|
3533 | + $content .= $this->_format_date_time($this->trigger['value']); |
|
3534 | 3534 | else { |
3535 | - if( TRUE !== $this->trigger['value']['relatedStart'] ) |
|
3535 | + if (TRUE !== $this->trigger['value']['relatedStart']) |
|
3536 | 3536 | $attributes .= $this->intAttrDelimiter.'RELATED=END'; |
3537 | - if( $this->trigger['value']['before'] ) |
|
3537 | + if ($this->trigger['value']['before']) |
|
3538 | 3538 | $content .= '-'; |
3539 | - $content .= $this->_format_duration( $this->trigger['value'] ); |
|
3539 | + $content .= $this->_format_duration($this->trigger['value']); |
|
3540 | 3540 | } |
3541 | - $attributes .= $this->_createParams( $this->trigger['params'] ); |
|
3542 | - return $this->_createElement( 'TRIGGER', $attributes, $content ); |
|
3541 | + $attributes .= $this->_createParams($this->trigger['params']); |
|
3542 | + return $this->_createElement('TRIGGER', $attributes, $content); |
|
3543 | 3543 | } |
3544 | 3544 | /** |
3545 | 3545 | * set calendar component property trigger |
@@ -3558,86 +3558,86 @@ discard block |
||
3558 | 3558 | * @param array $params optional |
3559 | 3559 | * @return bool |
3560 | 3560 | */ |
3561 | - function setTrigger( $year, $month=null, $day=null, $week=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $relatedStart=TRUE, $before=TRUE, $params=FALSE ) { |
|
3562 | - if( empty( $year ) && empty( $month ) && empty( $day ) && empty( $week ) && empty( $hour ) && empty( $min ) && empty( $sec )) |
|
3563 | - if( $this->getConfig( 'allowEmpty' )) { |
|
3564 | - $this->trigger = array( 'value' => null, 'params' => $this->_setParams( $params ) ); |
|
3561 | + function setTrigger($year, $month = null, $day = null, $week = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $relatedStart = TRUE, $before = TRUE, $params = FALSE) { |
|
3562 | + if (empty($year) && empty($month) && empty($day) && empty($week) && empty($hour) && empty($min) && empty($sec)) |
|
3563 | + if ($this->getConfig('allowEmpty')) { |
|
3564 | + $this->trigger = array('value' => null, 'params' => $this->_setParams($params)); |
|
3565 | 3565 | return TRUE; |
3566 | 3566 | } |
3567 | 3567 | else |
3568 | 3568 | return FALSE; |
3569 | - if( $this->_isArrayTimestampDate( $year )) { // timestamp |
|
3570 | - $params = $this->_setParams( $month ); |
|
3571 | - $date = $this->_timestamp2date( $year, 7 ); |
|
3572 | - foreach( $date as $k => $v ) |
|
3569 | + if ($this->_isArrayTimestampDate($year)) { // timestamp |
|
3570 | + $params = $this->_setParams($month); |
|
3571 | + $date = $this->_timestamp2date($year, 7); |
|
3572 | + foreach ($date as $k => $v) |
|
3573 | 3573 | $$k = $v; |
3574 | 3574 | } |
3575 | - elseif( is_array( $year ) && ( is_array( $month ) || empty( $month ))) { |
|
3576 | - $params = $this->_setParams( $month ); |
|
3577 | - if(!(array_key_exists( 'year', $year ) && // exclude date-time |
|
3578 | - array_key_exists( 'month', $year ) && |
|
3579 | - array_key_exists( 'day', $year ))) { // so this must be a duration |
|
3580 | - if( isset( $params['RELATED'] ) && ( 'END' == $params['RELATED'] )) |
|
3575 | + elseif (is_array($year) && (is_array($month) || empty($month))) { |
|
3576 | + $params = $this->_setParams($month); |
|
3577 | + if (!(array_key_exists('year', $year) && // exclude date-time |
|
3578 | + array_key_exists('month', $year) && |
|
3579 | + array_key_exists('day', $year))) { // so this must be a duration |
|
3580 | + if (isset($params['RELATED']) && ('END' == $params['RELATED'])) |
|
3581 | 3581 | $relatedStart = FALSE; |
3582 | 3582 | else |
3583 | - $relatedStart = ( array_key_exists( 'relatedStart', $year ) && ( TRUE !== $year['relatedStart'] )) ? FALSE : TRUE; |
|
3584 | - $before = ( array_key_exists( 'before', $year ) && ( TRUE !== $year['before'] )) ? FALSE : TRUE; |
|
3583 | + $relatedStart = (array_key_exists('relatedStart', $year) && (TRUE !== $year['relatedStart'])) ? FALSE : TRUE; |
|
3584 | + $before = (array_key_exists('before', $year) && (TRUE !== $year['before'])) ? FALSE : TRUE; |
|
3585 | 3585 | } |
3586 | - $SSYY = ( array_key_exists( 'year', $year )) ? $year['year'] : null; |
|
3587 | - $month = ( array_key_exists( 'month', $year )) ? $year['month'] : null; |
|
3588 | - $day = ( array_key_exists( 'day', $year )) ? $year['day'] : null; |
|
3589 | - $week = ( array_key_exists( 'week', $year )) ? $year['week'] : null; |
|
3590 | - $hour = ( array_key_exists( 'hour', $year )) ? $year['hour'] : 0; //null; |
|
3591 | - $min = ( array_key_exists( 'min', $year )) ? $year['min'] : 0; //null; |
|
3592 | - $sec = ( array_key_exists( 'sec', $year )) ? $year['sec'] : 0; //null; |
|
3586 | + $SSYY = (array_key_exists('year', $year)) ? $year['year'] : null; |
|
3587 | + $month = (array_key_exists('month', $year)) ? $year['month'] : null; |
|
3588 | + $day = (array_key_exists('day', $year)) ? $year['day'] : null; |
|
3589 | + $week = (array_key_exists('week', $year)) ? $year['week'] : null; |
|
3590 | + $hour = (array_key_exists('hour', $year)) ? $year['hour'] : 0; //null; |
|
3591 | + $min = (array_key_exists('min', $year)) ? $year['min'] : 0; //null; |
|
3592 | + $sec = (array_key_exists('sec', $year)) ? $year['sec'] : 0; //null; |
|
3593 | 3593 | $year = $SSYY; |
3594 | 3594 | } |
3595 | - elseif(is_string( $year ) && ( is_array( $month ) || empty( $month ))) { // duration or date in a string |
|
3596 | - $params = $this->_setParams( $month ); |
|
3597 | - if( in_array( $year{0}, array( 'P', '+', '-' ))) { // duration |
|
3598 | - $relatedStart = ( isset( $params['RELATED'] ) && ( 'END' == $params['RELATED'] )) ? FALSE : TRUE; |
|
3599 | - $before = ( '-' == $year{0} ) ? TRUE : FALSE; |
|
3600 | - if( 'P' != $year{0} ) |
|
3601 | - $year = substr( $year, 1 ); |
|
3602 | - $date = $this->_duration_string( $year); |
|
3595 | + elseif (is_string($year) && (is_array($month) || empty($month))) { // duration or date in a string |
|
3596 | + $params = $this->_setParams($month); |
|
3597 | + if (in_array($year{0}, array('P', '+', '-'))) { // duration |
|
3598 | + $relatedStart = (isset($params['RELATED']) && ('END' == $params['RELATED'])) ? FALSE : TRUE; |
|
3599 | + $before = ('-' == $year{0} ) ? TRUE : FALSE; |
|
3600 | + if ('P' != $year{0} ) |
|
3601 | + $year = substr($year, 1); |
|
3602 | + $date = $this->_duration_string($year); |
|
3603 | 3603 | } |
3604 | 3604 | else // date |
3605 | - $date = $this->_date_time_string( $year, 7 ); |
|
3606 | - unset( $year, $month, $day ); |
|
3607 | - foreach( $date as $k => $v ) |
|
3605 | + $date = $this->_date_time_string($year, 7); |
|
3606 | + unset($year, $month, $day); |
|
3607 | + foreach ($date as $k => $v) |
|
3608 | 3608 | $$k = $v; |
3609 | 3609 | } |
3610 | 3610 | else // single values in function input parameters |
3611 | - $params = $this->_setParams( $params ); |
|
3612 | - if( !empty( $year ) && !empty( $month ) && !empty( $day )) { // date |
|
3611 | + $params = $this->_setParams($params); |
|
3612 | + if (!empty($year) && !empty($month) && !empty($day)) { // date |
|
3613 | 3613 | $params['VALUE'] = 'DATE-TIME'; |
3614 | - $hour = ( $hour ) ? $hour : 0; |
|
3615 | - $min = ( $min ) ? $min : 0; |
|
3616 | - $sec = ( $sec ) ? $sec : 0; |
|
3617 | - $this->trigger = array( 'params' => $params ); |
|
3618 | - $this->trigger['value'] = array( 'year' => $year |
|
3614 | + $hour = ($hour) ? $hour : 0; |
|
3615 | + $min = ($min) ? $min : 0; |
|
3616 | + $sec = ($sec) ? $sec : 0; |
|
3617 | + $this->trigger = array('params' => $params); |
|
3618 | + $this->trigger['value'] = array('year' => $year |
|
3619 | 3619 | , 'month' => $month |
3620 | 3620 | , 'day' => $day |
3621 | 3621 | , 'hour' => $hour |
3622 | 3622 | , 'min' => $min |
3623 | 3623 | , 'sec' => $sec |
3624 | - , 'tz' => 'Z' ); |
|
3624 | + , 'tz' => 'Z'); |
|
3625 | 3625 | return TRUE; |
3626 | 3626 | } |
3627 | - elseif(( empty( $year ) && empty( $month )) && // duration |
|
3628 | - (!empty( $week ) || !empty( $day ) || !empty( $hour ) || !empty( $min ) || !empty( $sec ))) { |
|
3629 | - unset( $params['RELATED'] ); // set at output creation (END only) |
|
3630 | - unset( $params['VALUE'] ); // 'DURATION' default |
|
3631 | - $this->trigger = array( 'params' => $params ); |
|
3632 | - $relatedStart = ( FALSE !== $relatedStart ) ? TRUE : FALSE; |
|
3633 | - $before = ( FALSE !== $before ) ? TRUE : FALSE; |
|
3634 | - $this->trigger['value'] = array( 'relatedStart' => $relatedStart |
|
3635 | - , 'before' => $before ); |
|
3636 | - if( !empty( $week )) $this->trigger['value']['week'] = $week; |
|
3637 | - if( !empty( $day )) $this->trigger['value']['day'] = $day; |
|
3638 | - if( !empty( $hour )) $this->trigger['value']['hour'] = $hour; |
|
3639 | - if( !empty( $min )) $this->trigger['value']['min'] = $min; |
|
3640 | - if( !empty( $sec )) $this->trigger['value']['sec'] = $sec; |
|
3627 | + elseif ((empty($year) && empty($month)) && // duration |
|
3628 | + (!empty($week) || !empty($day) || !empty($hour) || !empty($min) || !empty($sec))) { |
|
3629 | + unset($params['RELATED']); // set at output creation (END only) |
|
3630 | + unset($params['VALUE']); // 'DURATION' default |
|
3631 | + $this->trigger = array('params' => $params); |
|
3632 | + $relatedStart = (FALSE !== $relatedStart) ? TRUE : FALSE; |
|
3633 | + $before = (FALSE !== $before) ? TRUE : FALSE; |
|
3634 | + $this->trigger['value'] = array('relatedStart' => $relatedStart |
|
3635 | + , 'before' => $before); |
|
3636 | + if (!empty($week)) $this->trigger['value']['week'] = $week; |
|
3637 | + if (!empty($day)) $this->trigger['value']['day'] = $day; |
|
3638 | + if (!empty($hour)) $this->trigger['value']['hour'] = $hour; |
|
3639 | + if (!empty($min)) $this->trigger['value']['min'] = $min; |
|
3640 | + if (!empty($sec)) $this->trigger['value']['sec'] = $sec; |
|
3641 | 3641 | return TRUE; |
3642 | 3642 | } |
3643 | 3643 | return FALSE; |
@@ -3654,11 +3654,11 @@ discard block |
||
3654 | 3654 | * @return string |
3655 | 3655 | */ |
3656 | 3656 | function createTzid() { |
3657 | - if( empty( $this->tzid )) return FALSE; |
|
3658 | - if( empty( $this->tzid['value'] )) |
|
3659 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZID' ) : FALSE; |
|
3660 | - $attributes = $this->_createParams( $this->tzid['params'] ); |
|
3661 | - return $this->_createElement( 'TZID', $attributes, $this->_strrep( $this->tzid['value'] )); |
|
3657 | + if (empty($this->tzid)) return FALSE; |
|
3658 | + if (empty($this->tzid['value'])) |
|
3659 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('TZID') : FALSE; |
|
3660 | + $attributes = $this->_createParams($this->tzid['params']); |
|
3661 | + return $this->_createElement('TZID', $attributes, $this->_strrep($this->tzid['value'])); |
|
3662 | 3662 | } |
3663 | 3663 | /** |
3664 | 3664 | * set calendar component property tzid |
@@ -3669,9 +3669,9 @@ discard block |
||
3669 | 3669 | * @param array $params optional |
3670 | 3670 | * @return bool |
3671 | 3671 | */ |
3672 | - function setTzid( $value, $params=FALSE ) { |
|
3673 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3674 | - $this->tzid = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
3672 | + function setTzid($value, $params = FALSE) { |
|
3673 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3674 | + $this->tzid = array('value' => $value, 'params' => $this->_setParams($params)); |
|
3675 | 3675 | return TRUE; |
3676 | 3676 | } |
3677 | 3677 | /*********************************************************************************/ |
@@ -3687,14 +3687,14 @@ discard block |
||
3687 | 3687 | * @return string |
3688 | 3688 | */ |
3689 | 3689 | function createTzname() { |
3690 | - if( empty( $this->tzname )) return FALSE; |
|
3690 | + if (empty($this->tzname)) return FALSE; |
|
3691 | 3691 | $output = null; |
3692 | - foreach( $this->tzname as $theName ) { |
|
3693 | - if( !empty( $theName['value'] )) { |
|
3694 | - $attributes = $this->_createParams( $theName['params'], array( 'LANGUAGE' )); |
|
3695 | - $output .= $this->_createElement( 'TZNAME', $attributes, $this->_strrep( $theName['value'] )); |
|
3692 | + foreach ($this->tzname as $theName) { |
|
3693 | + if (!empty($theName['value'])) { |
|
3694 | + $attributes = $this->_createParams($theName['params'], array('LANGUAGE')); |
|
3695 | + $output .= $this->_createElement('TZNAME', $attributes, $this->_strrep($theName['value'])); |
|
3696 | 3696 | } |
3697 | - elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'TZNAME' ); |
|
3697 | + elseif ($this->getConfig('allowEmpty')) $output .= $this->_createElement('TZNAME'); |
|
3698 | 3698 | } |
3699 | 3699 | return $output; |
3700 | 3700 | } |
@@ -3708,9 +3708,9 @@ discard block |
||
3708 | 3708 | * @param integer $index, optional |
3709 | 3709 | * @return bool |
3710 | 3710 | */ |
3711 | - function setTzname( $value, $params=FALSE, $index=FALSE ) { |
|
3712 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3713 | - $this->_setMval( $this->tzname, $value, $params, FALSE, $index ); |
|
3711 | + function setTzname($value, $params = FALSE, $index = FALSE) { |
|
3712 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3713 | + $this->_setMval($this->tzname, $value, $params, FALSE, $index); |
|
3714 | 3714 | return TRUE; |
3715 | 3715 | } |
3716 | 3716 | /*********************************************************************************/ |
@@ -3725,11 +3725,11 @@ discard block |
||
3725 | 3725 | * @return string |
3726 | 3726 | */ |
3727 | 3727 | function createTzoffsetfrom() { |
3728 | - if( empty( $this->tzoffsetfrom )) return FALSE; |
|
3729 | - if( empty( $this->tzoffsetfrom['value'] )) |
|
3730 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZOFFSETFROM' ) : FALSE; |
|
3731 | - $attributes = $this->_createParams( $this->tzoffsetfrom['params'] ); |
|
3732 | - return $this->_createElement( 'TZOFFSETFROM', $attributes, $this->tzoffsetfrom['value'] ); |
|
3728 | + if (empty($this->tzoffsetfrom)) return FALSE; |
|
3729 | + if (empty($this->tzoffsetfrom['value'])) |
|
3730 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('TZOFFSETFROM') : FALSE; |
|
3731 | + $attributes = $this->_createParams($this->tzoffsetfrom['params']); |
|
3732 | + return $this->_createElement('TZOFFSETFROM', $attributes, $this->tzoffsetfrom['value']); |
|
3733 | 3733 | } |
3734 | 3734 | /** |
3735 | 3735 | * set calendar component property tzoffsetfrom |
@@ -3740,9 +3740,9 @@ discard block |
||
3740 | 3740 | * @param string $params optional |
3741 | 3741 | * @return bool |
3742 | 3742 | */ |
3743 | - function setTzoffsetfrom( $value, $params=FALSE ) { |
|
3744 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3745 | - $this->tzoffsetfrom = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
3743 | + function setTzoffsetfrom($value, $params = FALSE) { |
|
3744 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3745 | + $this->tzoffsetfrom = array('value' => $value, 'params' => $this->_setParams($params)); |
|
3746 | 3746 | return TRUE; |
3747 | 3747 | } |
3748 | 3748 | /*********************************************************************************/ |
@@ -3757,11 +3757,11 @@ discard block |
||
3757 | 3757 | * @return string |
3758 | 3758 | */ |
3759 | 3759 | function createTzoffsetto() { |
3760 | - if( empty( $this->tzoffsetto )) return FALSE; |
|
3761 | - if( empty( $this->tzoffsetto['value'] )) |
|
3762 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZOFFSETTO' ) : FALSE; |
|
3763 | - $attributes = $this->_createParams( $this->tzoffsetto['params'] ); |
|
3764 | - return $this->_createElement( 'TZOFFSETTO', $attributes, $this->tzoffsetto['value'] ); |
|
3760 | + if (empty($this->tzoffsetto)) return FALSE; |
|
3761 | + if (empty($this->tzoffsetto['value'])) |
|
3762 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('TZOFFSETTO') : FALSE; |
|
3763 | + $attributes = $this->_createParams($this->tzoffsetto['params']); |
|
3764 | + return $this->_createElement('TZOFFSETTO', $attributes, $this->tzoffsetto['value']); |
|
3765 | 3765 | } |
3766 | 3766 | /** |
3767 | 3767 | * set calendar component property tzoffsetto |
@@ -3772,9 +3772,9 @@ discard block |
||
3772 | 3772 | * @param string $params optional |
3773 | 3773 | * @return bool |
3774 | 3774 | */ |
3775 | - function setTzoffsetto( $value, $params=FALSE ) { |
|
3776 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3777 | - $this->tzoffsetto = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
3775 | + function setTzoffsetto($value, $params = FALSE) { |
|
3776 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3777 | + $this->tzoffsetto = array('value' => $value, 'params' => $this->_setParams($params)); |
|
3778 | 3778 | return TRUE; |
3779 | 3779 | } |
3780 | 3780 | /*********************************************************************************/ |
@@ -3789,11 +3789,11 @@ discard block |
||
3789 | 3789 | * @return string |
3790 | 3790 | */ |
3791 | 3791 | function createTzurl() { |
3792 | - if( empty( $this->tzurl )) return FALSE; |
|
3793 | - if( empty( $this->tzurl['value'] )) |
|
3794 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZURL' ) : FALSE; |
|
3795 | - $attributes = $this->_createParams( $this->tzurl['params'] ); |
|
3796 | - return $this->_createElement( 'TZURL', $attributes, $this->tzurl['value'] ); |
|
3792 | + if (empty($this->tzurl)) return FALSE; |
|
3793 | + if (empty($this->tzurl['value'])) |
|
3794 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('TZURL') : FALSE; |
|
3795 | + $attributes = $this->_createParams($this->tzurl['params']); |
|
3796 | + return $this->_createElement('TZURL', $attributes, $this->tzurl['value']); |
|
3797 | 3797 | } |
3798 | 3798 | /** |
3799 | 3799 | * set calendar component property tzurl |
@@ -3804,9 +3804,9 @@ discard block |
||
3804 | 3804 | * @param string $params optional |
3805 | 3805 | * @return boll |
3806 | 3806 | */ |
3807 | - function setTzurl( $value, $params=FALSE ) { |
|
3808 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3809 | - $this->tzurl = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
3807 | + function setTzurl($value, $params = FALSE) { |
|
3808 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3809 | + $this->tzurl = array('value' => $value, 'params' => $this->_setParams($params)); |
|
3810 | 3810 | return TRUE; |
3811 | 3811 | } |
3812 | 3812 | /*********************************************************************************/ |
@@ -3821,10 +3821,10 @@ discard block |
||
3821 | 3821 | * @return string |
3822 | 3822 | */ |
3823 | 3823 | function createUid() { |
3824 | - if( 0 >= count( $this->uid )) |
|
3824 | + if (0 >= count($this->uid)) |
|
3825 | 3825 | $this->_makeuid(); |
3826 | - $attributes = $this->_createParams( $this->uid['params'] ); |
|
3827 | - return $this->_createElement( 'UID', $attributes, $this->uid['value'] ); |
|
3826 | + $attributes = $this->_createParams($this->uid['params']); |
|
3827 | + return $this->_createElement('UID', $attributes, $this->uid['value']); |
|
3828 | 3828 | } |
3829 | 3829 | /** |
3830 | 3830 | * create an unique id for this calendar component object instance |
@@ -3838,13 +3838,13 @@ discard block |
||
3838 | 3838 | $unique = substr(microtime(), 2, 4); |
3839 | 3839 | $base = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPrRsStTuUvVxXuUvVwWzZ1234567890'; |
3840 | 3840 | $start = 0; |
3841 | - $end = strlen( $base ) - 1; |
|
3841 | + $end = strlen($base) - 1; |
|
3842 | 3842 | $length = 6; |
3843 | 3843 | $str = null; |
3844 | - for( $p = 0; $p < $length; $p++ ) |
|
3845 | - $unique .= $base{mt_rand( $start, $end )}; |
|
3846 | - $this->uid = array( 'params' => null ); |
|
3847 | - $this->uid['value'] = $date.'-'.$unique.'@'.$this->getConfig( 'unique_id' ); |
|
3844 | + for ($p = 0; $p < $length; $p++) |
|
3845 | + $unique .= $base{mt_rand($start, $end)}; |
|
3846 | + $this->uid = array('params' => null); |
|
3847 | + $this->uid['value'] = $date.'-'.$unique.'@'.$this->getConfig('unique_id'); |
|
3848 | 3848 | } |
3849 | 3849 | /** |
3850 | 3850 | * set calendar component property uid |
@@ -3855,9 +3855,9 @@ discard block |
||
3855 | 3855 | * @param string $params optional |
3856 | 3856 | * @return bool |
3857 | 3857 | */ |
3858 | - function setUid( $value, $params=FALSE ) { |
|
3859 | - if( empty( $value )) return FALSE; // no allowEmpty check here !!!! |
|
3860 | - $this->uid = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
3858 | + function setUid($value, $params = FALSE) { |
|
3859 | + if (empty($value)) return FALSE; // no allowEmpty check here !!!! |
|
3860 | + $this->uid = array('value' => $value, 'params' => $this->_setParams($params)); |
|
3861 | 3861 | return TRUE; |
3862 | 3862 | } |
3863 | 3863 | /*********************************************************************************/ |
@@ -3872,11 +3872,11 @@ discard block |
||
3872 | 3872 | * @return string |
3873 | 3873 | */ |
3874 | 3874 | function createUrl() { |
3875 | - if( empty( $this->url )) return FALSE; |
|
3876 | - if( empty( $this->url['value'] )) |
|
3877 | - return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'URL' ) : FALSE; |
|
3878 | - $attributes = $this->_createParams( $this->url['params'] ); |
|
3879 | - return $this->_createElement( 'URL', $attributes, $this->url['value'] ); |
|
3875 | + if (empty($this->url)) return FALSE; |
|
3876 | + if (empty($this->url['value'])) |
|
3877 | + return ($this->getConfig('allowEmpty')) ? $this->_createElement('URL') : FALSE; |
|
3878 | + $attributes = $this->_createParams($this->url['params']); |
|
3879 | + return $this->_createElement('URL', $attributes, $this->url['value']); |
|
3880 | 3880 | } |
3881 | 3881 | /** |
3882 | 3882 | * set calendar component property url |
@@ -3887,9 +3887,9 @@ discard block |
||
3887 | 3887 | * @param string $params optional |
3888 | 3888 | * @return bool |
3889 | 3889 | */ |
3890 | - function setUrl( $value, $params=FALSE ) { |
|
3891 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3892 | - $this->url = array( 'value' => $value, 'params' => $this->_setParams( $params )); |
|
3890 | + function setUrl($value, $params = FALSE) { |
|
3891 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3892 | + $this->url = array('value' => $value, 'params' => $this->_setParams($params)); |
|
3893 | 3893 | return TRUE; |
3894 | 3894 | } |
3895 | 3895 | /*********************************************************************************/ |
@@ -3904,22 +3904,22 @@ discard block |
||
3904 | 3904 | * @return string |
3905 | 3905 | */ |
3906 | 3906 | function createXprop() { |
3907 | - if( empty( $this->xprop )) return FALSE; |
|
3907 | + if (empty($this->xprop)) return FALSE; |
|
3908 | 3908 | $output = null; |
3909 | - foreach( $this->xprop as $label => $xpropPart ) { |
|
3910 | - if( empty( $xpropPart['value'] )) { |
|
3911 | - if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( $label ); |
|
3909 | + foreach ($this->xprop as $label => $xpropPart) { |
|
3910 | + if (empty($xpropPart['value'])) { |
|
3911 | + if ($this->getConfig('allowEmpty')) $output .= $this->_createElement($label); |
|
3912 | 3912 | continue; |
3913 | 3913 | } |
3914 | - $attributes = $this->_createParams( $xpropPart['params'], array( 'LANGUAGE' )); |
|
3915 | - if( is_array( $xpropPart['value'] )) { |
|
3916 | - foreach( $xpropPart['value'] as $pix => $theXpart ) |
|
3917 | - $xpropPart['value'][$pix] = $this->_strrep( $theXpart ); |
|
3918 | - $xpropPart['value'] = implode( ',', $xpropPart['value'] ); |
|
3914 | + $attributes = $this->_createParams($xpropPart['params'], array('LANGUAGE')); |
|
3915 | + if (is_array($xpropPart['value'])) { |
|
3916 | + foreach ($xpropPart['value'] as $pix => $theXpart) |
|
3917 | + $xpropPart['value'][$pix] = $this->_strrep($theXpart); |
|
3918 | + $xpropPart['value'] = implode(',', $xpropPart['value']); |
|
3919 | 3919 | } |
3920 | 3920 | else |
3921 | - $xpropPart['value'] = $this->_strrep( $xpropPart['value'] ); |
|
3922 | - $output .= $this->_createElement( $label, $attributes, $xpropPart['value'] ); |
|
3921 | + $xpropPart['value'] = $this->_strrep($xpropPart['value']); |
|
3922 | + $output .= $this->_createElement($label, $attributes, $xpropPart['value']); |
|
3923 | 3923 | } |
3924 | 3924 | return $output; |
3925 | 3925 | } |
@@ -3933,14 +3933,14 @@ discard block |
||
3933 | 3933 | * @param array $params optional |
3934 | 3934 | * @return bool |
3935 | 3935 | */ |
3936 | - function setXprop( $label, $value, $params=FALSE ) { |
|
3937 | - if( empty( $label )) return; |
|
3938 | - if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; |
|
3939 | - $xprop = array( 'value' => $value ); |
|
3936 | + function setXprop($label, $value, $params = FALSE) { |
|
3937 | + if (empty($label)) return; |
|
3938 | + if (empty($value)) if ($this->getConfig('allowEmpty')) $value = null; else return FALSE; |
|
3939 | + $xprop = array('value' => $value); |
|
3940 | 3940 | $toolbox = new calendarComponent(); |
3941 | - $xprop['params'] = $toolbox->_setParams( $params ); |
|
3942 | - if( !is_array( $this->xprop )) $this->xprop = array(); |
|
3943 | - $this->xprop[strtoupper( $label )] = $xprop; |
|
3941 | + $xprop['params'] = $toolbox->_setParams($params); |
|
3942 | + if (!is_array($this->xprop)) $this->xprop = array(); |
|
3943 | + $this->xprop[strtoupper($label)] = $xprop; |
|
3944 | 3944 | return TRUE; |
3945 | 3945 | } |
3946 | 3946 | /*********************************************************************************/ |
@@ -3953,11 +3953,11 @@ discard block |
||
3953 | 3953 | * @return string |
3954 | 3954 | */ |
3955 | 3955 | function _createFormat() { |
3956 | - $objectname = null; |
|
3957 | - switch( $this->format ) { |
|
3956 | + $objectname = null; |
|
3957 | + switch ($this->format) { |
|
3958 | 3958 | case 'xcal': |
3959 | - $objectname = ( isset( $this->timezonetype )) ? |
|
3960 | - strtolower( $this->timezonetype ) : strtolower( $this->objName ); |
|
3959 | + $objectname = (isset($this->timezonetype)) ? |
|
3960 | + strtolower($this->timezonetype) : strtolower($this->objName); |
|
3961 | 3961 | $this->componentStart1 = $this->elementStart1 = '<'; |
3962 | 3962 | $this->componentStart2 = $this->elementStart2 = '>'; |
3963 | 3963 | $this->componentEnd1 = $this->elementEnd1 = '</'; |
@@ -3967,8 +3967,8 @@ discard block |
||
3967 | 3967 | $this->valueInit = null; |
3968 | 3968 | break; |
3969 | 3969 | default: |
3970 | - $objectname = ( isset( $this->timezonetype )) ? |
|
3971 | - strtoupper( $this->timezonetype ) : strtoupper( $this->objName ); |
|
3970 | + $objectname = (isset($this->timezonetype)) ? |
|
3971 | + strtoupper($this->timezonetype) : strtoupper($this->objName); |
|
3972 | 3972 | $this->componentStart1 = 'BEGIN:'; |
3973 | 3973 | $this->componentStart2 = null; |
3974 | 3974 | $this->componentEnd1 = 'END:'; |
@@ -3994,82 +3994,82 @@ discard block |
||
3994 | 3994 | * @param string $content property content (optional) |
3995 | 3995 | * @return string |
3996 | 3996 | */ |
3997 | - function _createElement( $label, $attributes=null, $content=FALSE ) { |
|
3998 | - $label = $this->_formatPropertyName( $label ); |
|
3997 | + function _createElement($label, $attributes = null, $content = FALSE) { |
|
3998 | + $label = $this->_formatPropertyName($label); |
|
3999 | 3999 | $output = $this->elementStart1.$label; |
4000 | 4000 | $categoriesAttrLang = null; |
4001 | 4001 | $attachInlineBinary = FALSE; |
4002 | 4002 | $attachfmttype = null; |
4003 | - if( !empty( $attributes )) { |
|
4004 | - $attributes = trim( $attributes ); |
|
4005 | - if ( 'xcal' == $this->format) { |
|
4006 | - $attributes2 = explode( $this->intAttrDelimiter, $attributes ); |
|
4003 | + if (!empty($attributes)) { |
|
4004 | + $attributes = trim($attributes); |
|
4005 | + if ('xcal' == $this->format) { |
|
4006 | + $attributes2 = explode($this->intAttrDelimiter, $attributes); |
|
4007 | 4007 | $attributes = null; |
4008 | - foreach( $attributes2 as $attribute ) { |
|
4009 | - $attrKVarr = explode( '=', $attribute ); |
|
4010 | - if( empty( $attrKVarr[0] )) |
|
4008 | + foreach ($attributes2 as $attribute) { |
|
4009 | + $attrKVarr = explode('=', $attribute); |
|
4010 | + if (empty($attrKVarr[0])) |
|
4011 | 4011 | continue; |
4012 | - if( !isset( $attrKVarr[1] )) { |
|
4012 | + if (!isset($attrKVarr[1])) { |
|
4013 | 4013 | $attrValue = $attrKVarr[0]; |
4014 | 4014 | $attrKey = null; |
4015 | 4015 | } |
4016 | - elseif( 2 == count( $attrKVarr)) { |
|
4017 | - $attrKey = strtolower( $attrKVarr[0] ); |
|
4016 | + elseif (2 == count($attrKVarr)) { |
|
4017 | + $attrKey = strtolower($attrKVarr[0]); |
|
4018 | 4018 | $attrValue = $attrKVarr[1]; |
4019 | 4019 | } |
4020 | 4020 | else { |
4021 | - $attrKey = strtolower( $attrKVarr[0] ); |
|
4022 | - unset( $attrKVarr[0] ); |
|
4023 | - $attrValue = implode( '=', $attrKVarr ); |
|
4021 | + $attrKey = strtolower($attrKVarr[0]); |
|
4022 | + unset($attrKVarr[0]); |
|
4023 | + $attrValue = implode('=', $attrKVarr); |
|
4024 | 4024 | } |
4025 | - if(( 'attach' == $label ) && ( in_array( $attrKey, array( 'fmttype', 'encoding', 'value' )))) { |
|
4025 | + if (('attach' == $label) && (in_array($attrKey, array('fmttype', 'encoding', 'value')))) { |
|
4026 | 4026 | $attachInlineBinary = TRUE; |
4027 | - if( 'fmttype' == $attrKey ) |
|
4027 | + if ('fmttype' == $attrKey) |
|
4028 | 4028 | $attachfmttype = $attrKey.'='.$attrValue; |
4029 | 4029 | continue; |
4030 | 4030 | } |
4031 | - elseif(( 'categories' == $label ) && ( 'language' == $attrKey )) |
|
4031 | + elseif (('categories' == $label) && ('language' == $attrKey)) |
|
4032 | 4032 | $categoriesAttrLang = $attrKey.'='.$attrValue; |
4033 | 4033 | else { |
4034 | - $attributes .= ( empty( $attributes )) ? ' ' : $this->attributeDelimiter.' '; |
|
4035 | - $attributes .= ( !empty( $attrKey )) ? $attrKey.'=' : null; |
|
4036 | - if(( '"' == substr( $attrValue, 0, 1 )) && ( '"' == substr( $attrValue, -1 ))) { |
|
4037 | - $attrValue = substr( $attrValue, 1, ( strlen( $attrValue ) - 2 )); |
|
4038 | - $attrValue = str_replace( '"', '', $attrValue ); |
|
4034 | + $attributes .= (empty($attributes)) ? ' ' : $this->attributeDelimiter.' '; |
|
4035 | + $attributes .= (!empty($attrKey)) ? $attrKey.'=' : null; |
|
4036 | + if (('"' == substr($attrValue, 0, 1)) && ('"' == substr($attrValue, -1))) { |
|
4037 | + $attrValue = substr($attrValue, 1, (strlen($attrValue) - 2)); |
|
4038 | + $attrValue = str_replace('"', '', $attrValue); |
|
4039 | 4039 | } |
4040 | - $attributes .= '"'.htmlspecialchars( $attrValue ).'"'; |
|
4040 | + $attributes .= '"'.htmlspecialchars($attrValue).'"'; |
|
4041 | 4041 | } |
4042 | 4042 | } |
4043 | 4043 | } |
4044 | 4044 | else { |
4045 | - $attributes = str_replace( $this->intAttrDelimiter, $this->attributeDelimiter, $attributes ); |
|
4045 | + $attributes = str_replace($this->intAttrDelimiter, $this->attributeDelimiter, $attributes); |
|
4046 | 4046 | } |
4047 | 4047 | } |
4048 | - if(((( 'attach' == $label ) && !$attachInlineBinary ) || |
|
4049 | - ( in_array( $label, array( 'tzurl', 'url' )))) && ( 'xcal' == $this->format)) { |
|
4048 | + if (((('attach' == $label) && !$attachInlineBinary) || |
|
4049 | + (in_array($label, array('tzurl', 'url')))) && ('xcal' == $this->format)) { |
|
4050 | 4050 | $pos = strrpos($content, "/"); |
4051 | - $docname = ( $pos !== false) ? substr( $content, (1 - strlen( $content ) + $pos )) : $content; |
|
4052 | - $this->xcaldecl[] = array( 'xmldecl' => 'ENTITY' |
|
4051 | + $docname = ($pos !== false) ? substr($content, (1 - strlen($content) + $pos)) : $content; |
|
4052 | + $this->xcaldecl[] = array('xmldecl' => 'ENTITY' |
|
4053 | 4053 | , 'uri' => $docname |
4054 | 4054 | , 'ref' => 'SYSTEM' |
4055 | 4055 | , 'external' => $content |
4056 | 4056 | , 'type' => 'NDATA' |
4057 | - , 'type2' => 'BINERY' ); |
|
4058 | - $attributes .= ( empty( $attributes )) ? ' ' : $this->attributeDelimiter.' '; |
|
4057 | + , 'type2' => 'BINERY'); |
|
4058 | + $attributes .= (empty($attributes)) ? ' ' : $this->attributeDelimiter.' '; |
|
4059 | 4059 | $attributes .= 'uri="'.$docname.'"'; |
4060 | 4060 | $content = null; |
4061 | - if( 'attach' == $label ) { |
|
4062 | - $attributes = str_replace( $this->attributeDelimiter, $this->intAttrDelimiter, $attributes ); |
|
4063 | - $content = $this->_createElement( 'extref', $attributes, null ); |
|
4061 | + if ('attach' == $label) { |
|
4062 | + $attributes = str_replace($this->attributeDelimiter, $this->intAttrDelimiter, $attributes); |
|
4063 | + $content = $this->_createElement('extref', $attributes, null); |
|
4064 | 4064 | $attributes = null; |
4065 | 4065 | } |
4066 | 4066 | } |
4067 | - elseif(( 'attach' == $label ) && $attachInlineBinary && ( 'xcal' == $this->format)) { |
|
4068 | - $content = $this->nl.$this->_createElement( 'b64bin', $attachfmttype, $content ); // max one attribute |
|
4067 | + elseif (('attach' == $label) && $attachInlineBinary && ('xcal' == $this->format)) { |
|
4068 | + $content = $this->nl.$this->_createElement('b64bin', $attachfmttype, $content); // max one attribute |
|
4069 | 4069 | } |
4070 | 4070 | $output .= $attributes; |
4071 | - if( !$content ) { |
|
4072 | - switch( $this->format ) { |
|
4071 | + if (!$content) { |
|
4072 | + switch ($this->format) { |
|
4073 | 4073 | case 'xcal': |
4074 | 4074 | $output .= ' /'; |
4075 | 4075 | $output .= $this->elementStart2; |
@@ -4077,18 +4077,18 @@ discard block |
||
4077 | 4077 | break; |
4078 | 4078 | default: |
4079 | 4079 | $output .= $this->elementStart2.$this->valueInit; |
4080 | - return $this->_size75( $output ); |
|
4080 | + return $this->_size75($output); |
|
4081 | 4081 | break; |
4082 | 4082 | } |
4083 | 4083 | } |
4084 | 4084 | $output .= $this->elementStart2; |
4085 | 4085 | $output .= $this->valueInit.$content; |
4086 | - switch( $this->format ) { |
|
4086 | + switch ($this->format) { |
|
4087 | 4087 | case 'xcal': |
4088 | 4088 | return $output.$this->elementEnd1.$label.$this->elementEnd2; |
4089 | 4089 | break; |
4090 | 4090 | default: |
4091 | - return $this->_size75( $output ); |
|
4091 | + return $this->_size75($output); |
|
4092 | 4092 | break; |
4093 | 4093 | } |
4094 | 4094 | } |
@@ -4101,36 +4101,36 @@ discard block |
||
4101 | 4101 | * @param array $ctrKeys optional |
4102 | 4102 | * @return string |
4103 | 4103 | */ |
4104 | - function _createParams( $params=array(), $ctrKeys=array() ) { |
|
4104 | + function _createParams($params = array(), $ctrKeys = array()) { |
|
4105 | 4105 | $attrLANG = $attr1 = $attr2 = null; |
4106 | - $CNattrKey = ( in_array( 'CN', $ctrKeys )) ? TRUE : FALSE ; |
|
4107 | - $LANGattrKey = ( in_array( 'LANGUAGE', $ctrKeys )) ? TRUE : FALSE ; |
|
4106 | + $CNattrKey = (in_array('CN', $ctrKeys)) ? TRUE : FALSE; |
|
4107 | + $LANGattrKey = (in_array('LANGUAGE', $ctrKeys)) ? TRUE : FALSE; |
|
4108 | 4108 | $CNattrExist = $LANGattrExist = FALSE; |
4109 | - if( is_array( $params )) { |
|
4110 | - foreach( $params as $paramKey => $paramValue ) { |
|
4111 | - if( is_int( $paramKey )) |
|
4109 | + if (is_array($params)) { |
|
4110 | + foreach ($params as $paramKey => $paramValue) { |
|
4111 | + if (is_int($paramKey)) |
|
4112 | 4112 | $attr2 .= $this->intAttrDelimiter.$paramValue; |
4113 | - elseif(( 'LANGUAGE' == $paramKey ) && $LANGattrKey ) { |
|
4113 | + elseif (('LANGUAGE' == $paramKey) && $LANGattrKey) { |
|
4114 | 4114 | $attrLANG .= $this->intAttrDelimiter."LANGUAGE=$paramValue"; |
4115 | 4115 | $LANGattrExist = TRUE; |
4116 | 4116 | } |
4117 | - elseif(( 'CN' == $paramKey ) && $CNattrKey ) { |
|
4117 | + elseif (('CN' == $paramKey) && $CNattrKey) { |
|
4118 | 4118 | $attr1 = $this->intAttrDelimiter.'CN="'.$paramValue.'"'; |
4119 | 4119 | $CNattrExist = TRUE; |
4120 | 4120 | } |
4121 | - elseif(( 'ALTREP' == $paramKey ) && in_array( $paramKey, $ctrKeys )) |
|
4121 | + elseif (('ALTREP' == $paramKey) && in_array($paramKey, $ctrKeys)) |
|
4122 | 4122 | $attr2 .= $this->intAttrDelimiter.'ALTREP="'.$paramValue.'"'; |
4123 | - elseif(( 'DIR' == $paramKey ) && in_array( $paramKey, $ctrKeys )) |
|
4123 | + elseif (('DIR' == $paramKey) && in_array($paramKey, $ctrKeys)) |
|
4124 | 4124 | $attr2 .= $this->intAttrDelimiter.'DIR="'.$paramValue.'"'; |
4125 | - elseif(( 'SENT-BY' == $paramKey ) && in_array( $paramKey, $ctrKeys )) |
|
4125 | + elseif (('SENT-BY' == $paramKey) && in_array($paramKey, $ctrKeys)) |
|
4126 | 4126 | $attr2 .= $this->intAttrDelimiter.'SENT-BY="MAILTO:'.$paramValue.'"'; |
4127 | 4127 | else |
4128 | 4128 | $attr2 .= $this->intAttrDelimiter."$paramKey=$paramValue"; |
4129 | 4129 | } |
4130 | 4130 | } |
4131 | - if( !$LANGattrExist ) { |
|
4132 | - $lang = $this->getConfig( 'language' ); |
|
4133 | - if(( $CNattrExist || $LANGattrKey ) && $lang ) |
|
4131 | + if (!$LANGattrExist) { |
|
4132 | + $lang = $this->getConfig('language'); |
|
4133 | + if (($CNattrExist || $LANGattrKey) && $lang) |
|
4134 | 4134 | $attrLANG .= $this->intAttrDelimiter.'LANGUAGE='.$lang; |
4135 | 4135 | } |
4136 | 4136 | return $attrLANG.$attr1.$attr2; |
@@ -4144,47 +4144,47 @@ discard block |
||
4144 | 4144 | * @param int $parno, no of date parts (i.e. year, month.. .) |
4145 | 4145 | * @return array $params, property parameters |
4146 | 4146 | */ |
4147 | - function _chkdatecfg( $theDate, & $parno, & $params ) { |
|
4148 | - if( isset( $params['TZID'] )) |
|
4147 | + function _chkdatecfg($theDate, & $parno, & $params) { |
|
4148 | + if (isset($params['TZID'])) |
|
4149 | 4149 | $parno = 6; |
4150 | - elseif( isset( $params['VALUE'] ) && ( 'DATE' == $params['VALUE'] )) |
|
4150 | + elseif (isset($params['VALUE']) && ('DATE' == $params['VALUE'])) |
|
4151 | 4151 | $parno = 3; |
4152 | 4152 | else { |
4153 | - if( isset( $params['VALUE'] ) && ( 'PERIOD' == $params['VALUE'] )) |
|
4153 | + if (isset($params['VALUE']) && ('PERIOD' == $params['VALUE'])) |
|
4154 | 4154 | $parno = 7; |
4155 | - if( is_array( $theDate )) { |
|
4156 | - if( isset( $theDate['timestamp'] )) |
|
4157 | - $tzid = ( isset( $theDate['tz'] )) ? $theDate['tz'] : null; |
|
4155 | + if (is_array($theDate)) { |
|
4156 | + if (isset($theDate['timestamp'])) |
|
4157 | + $tzid = (isset($theDate['tz'])) ? $theDate['tz'] : null; |
|
4158 | 4158 | else |
4159 | - $tzid = ( isset( $theDate['tz'] )) ? $theDate['tz'] : ( 7 == count( $theDate )) ? end( $theDate ) : null; |
|
4160 | - if( !empty( $tzid )) { |
|
4159 | + $tzid = (isset($theDate['tz'])) ? $theDate['tz'] : (7 == count($theDate)) ? end($theDate) : null; |
|
4160 | + if (!empty($tzid)) { |
|
4161 | 4161 | $parno = 7; |
4162 | - if( !$this->_isOffset( $tzid )) |
|
4162 | + if (!$this->_isOffset($tzid)) |
|
4163 | 4163 | $params['TZID'] = $tzid; // save only timezone |
4164 | 4164 | } |
4165 | - elseif( !$parno && ( 3 == count( $theDate )) && |
|
4166 | - ( isset( $params['VALUE'] ) && ( 'DATE' == $params['VALUE'] ))) |
|
4165 | + elseif (!$parno && (3 == count($theDate)) && |
|
4166 | + (isset($params['VALUE']) && ('DATE' == $params['VALUE']))) |
|
4167 | 4167 | $parno = 3; |
4168 | 4168 | else |
4169 | 4169 | $parno = 6; |
4170 | 4170 | } |
4171 | 4171 | else { // string |
4172 | - $date = trim( $theDate ); |
|
4173 | - if( 'Z' == substr( $date, -1 )) |
|
4172 | + $date = trim($theDate); |
|
4173 | + if ('Z' == substr($date, -1)) |
|
4174 | 4174 | $parno = 7; // UTC DATE-TIME |
4175 | - elseif((( 8 == strlen( $date ) && ctype_digit( $date )) || ( 11 >= strlen( $date ))) && |
|
4176 | - ( !isset( $params['VALUE'] ) || !in_array( $params['VALUE'], array( 'DATE-TIME', 'PERIOD' )))) |
|
4175 | + elseif (((8 == strlen($date) && ctype_digit($date)) || (11 >= strlen($date))) && |
|
4176 | + (!isset($params['VALUE']) || !in_array($params['VALUE'], array('DATE-TIME', 'PERIOD')))) |
|
4177 | 4177 | $parno = 3; // DATE |
4178 | - $date = $this->_date_time_string( $date, $parno ); |
|
4179 | - if( !empty( $date['tz'] )) { |
|
4178 | + $date = $this->_date_time_string($date, $parno); |
|
4179 | + if (!empty($date['tz'])) { |
|
4180 | 4180 | $parno = 7; |
4181 | - if( !$this->_isOffset( $date['tz'] )) |
|
4181 | + if (!$this->_isOffset($date['tz'])) |
|
4182 | 4182 | $params['TZID'] = $date['tz']; // save only timezone |
4183 | 4183 | } |
4184 | - elseif( empty( $parno )) |
|
4184 | + elseif (empty($parno)) |
|
4185 | 4185 | $parno = 6; |
4186 | 4186 | } |
4187 | - if( isset( $params['TZID'] )) |
|
4187 | + if (isset($params['TZID'])) |
|
4188 | 4188 | $parno = 6; |
4189 | 4189 | } |
4190 | 4190 | } |
@@ -4199,28 +4199,28 @@ discard block |
||
4199 | 4199 | * @param array $duration, optional |
4200 | 4200 | * @return array duration |
4201 | 4201 | */ |
4202 | - function _date2duration( $startdate=FALSE, $enddate=FALSE ) { |
|
4203 | - if( !$startdate || !$enddate ) { |
|
4204 | - if( FALSE === ( $startdate = $this->getProperty( 'dtstart' ))) |
|
4202 | + function _date2duration($startdate = FALSE, $enddate = FALSE) { |
|
4203 | + if (!$startdate || !$enddate) { |
|
4204 | + if (FALSE === ($startdate = $this->getProperty('dtstart'))) |
|
4205 | 4205 | return null; |
4206 | - if( FALSE === ( $enddate = $this->getProperty( 'dtend' ))) // vevent/vfreebusy |
|
4207 | - if( FALSE === ( $enddate = $this->getProperty( 'due' ))) // vtodo |
|
4206 | + if (FALSE === ($enddate = $this->getProperty('dtend'))) // vevent/vfreebusy |
|
4207 | + if (FALSE === ($enddate = $this->getProperty('due'))) // vtodo |
|
4208 | 4208 | return null; |
4209 | 4209 | } |
4210 | - if( !$startdate || !$enddate ) |
|
4210 | + if (!$startdate || !$enddate) |
|
4211 | 4211 | return null; |
4212 | - $startWdate = mktime( 0, 0, 0, $startdate['month'], $startdate['day'], $startdate['year'] ); |
|
4213 | - $endWdate = mktime( 0, 0, 0, $enddate['month'], $enddate['day'], $enddate['year'] ); |
|
4212 | + $startWdate = mktime(0, 0, 0, $startdate['month'], $startdate['day'], $startdate['year']); |
|
4213 | + $endWdate = mktime(0, 0, 0, $enddate['month'], $enddate['day'], $enddate['year']); |
|
4214 | 4214 | $wduration = $endWdate - $startWdate; |
4215 | 4215 | $dur = array(); |
4216 | - $dur['week'] = (int) floor( $wduration / ( 7 * 24 * 60 * 60 )); |
|
4217 | - $wduration = $wduration % ( 7 * 24 * 60 * 60 ); |
|
4218 | - $dur['day'] = (int) floor( $wduration / ( 24 * 60 * 60 )); |
|
4219 | - $wduration = $wduration % ( 24 * 60 * 60 ); |
|
4220 | - $dur['hour'] = (int) floor( $wduration / ( 60 * 60 )); |
|
4221 | - $wduration = $wduration % ( 60 * 60 ); |
|
4222 | - $dur['min'] = (int) floor( $wduration / ( 60 )); |
|
4223 | - $dur['sec'] = (int) $wduration % ( 60 ); |
|
4216 | + $dur['week'] = (int) floor($wduration / (7 * 24 * 60 * 60)); |
|
4217 | + $wduration = $wduration % (7 * 24 * 60 * 60); |
|
4218 | + $dur['day'] = (int) floor($wduration / (24 * 60 * 60)); |
|
4219 | + $wduration = $wduration % (24 * 60 * 60); |
|
4220 | + $dur['hour'] = (int) floor($wduration / (60 * 60)); |
|
4221 | + $wduration = $wduration % (60 * 60); |
|
4222 | + $dur['min'] = (int) floor($wduration / (60)); |
|
4223 | + $dur['sec'] = (int) $wduration % (60); |
|
4224 | 4224 | return $dur; |
4225 | 4225 | } |
4226 | 4226 | /** |
@@ -4232,19 +4232,19 @@ discard block |
||
4232 | 4232 | * @param string $tz timezone |
4233 | 4233 | * @return timestamp |
4234 | 4234 | */ |
4235 | - function _date2timestamp( $datetime, $tz=null ) { |
|
4235 | + function _date2timestamp($datetime, $tz = null) { |
|
4236 | 4236 | $output = null; |
4237 | - if( !isset( $datetime['hour'] )) $datetime['hour'] = '0'; |
|
4238 | - if( !isset( $datetime['min'] )) $datetime['min'] = '0'; |
|
4239 | - if( !isset( $datetime['sec'] )) $datetime['sec'] = '0'; |
|
4240 | - foreach( $datetime as $dkey => $dvalue ) { |
|
4241 | - if( 'tz' != $dkey ) |
|
4237 | + if (!isset($datetime['hour'])) $datetime['hour'] = '0'; |
|
4238 | + if (!isset($datetime['min'])) $datetime['min'] = '0'; |
|
4239 | + if (!isset($datetime['sec'])) $datetime['sec'] = '0'; |
|
4240 | + foreach ($datetime as $dkey => $dvalue) { |
|
4241 | + if ('tz' != $dkey) |
|
4242 | 4242 | $datetime[$dkey] = (integer) $dvalue; |
4243 | 4243 | } |
4244 | - if( $tz ) |
|
4244 | + if ($tz) |
|
4245 | 4245 | $datetime['tz'] = $tz; |
4246 | - $offset = ( isset( $datetime['tz'] ) && ( '' < trim ( $datetime['tz'] ))) ? $this->_tz2offset( $datetime['tz'] ) : 0; |
|
4247 | - $output = mktime( $datetime['hour'], $datetime['min'], ($datetime['sec'] + $offset), $datetime['month'], $datetime['day'], $datetime['year'] ); |
|
4246 | + $offset = (isset($datetime['tz']) && ('' < trim($datetime['tz']))) ? $this->_tz2offset($datetime['tz']) : 0; |
|
4247 | + $output = mktime($datetime['hour'], $datetime['min'], ($datetime['sec'] + $offset), $datetime['month'], $datetime['day'], $datetime['year']); |
|
4248 | 4248 | return $output; |
4249 | 4249 | } |
4250 | 4250 | /** |
@@ -4256,13 +4256,13 @@ discard block |
||
4256 | 4256 | * @param int $parno optional, default FALSE |
4257 | 4257 | * @return array |
4258 | 4258 | */ |
4259 | - function _date_time_array( $datetime, $parno=FALSE ) { |
|
4259 | + function _date_time_array($datetime, $parno = FALSE) { |
|
4260 | 4260 | $output = array(); |
4261 | - foreach( $datetime as $dateKey => $datePart ) { |
|
4262 | - switch ( $dateKey ) { |
|
4261 | + foreach ($datetime as $dateKey => $datePart) { |
|
4262 | + switch ($dateKey) { |
|
4263 | 4263 | case '0': |
4264 | 4264 | case 'year': |
4265 | - $output['year'] = $datePart; |
|
4265 | + $output['year'] = $datePart; |
|
4266 | 4266 | break; |
4267 | 4267 | case '1': |
4268 | 4268 | case 'month': |
@@ -4270,40 +4270,40 @@ discard block |
||
4270 | 4270 | break; |
4271 | 4271 | case '2': |
4272 | 4272 | case 'day': |
4273 | - $output['day'] = $datePart; |
|
4273 | + $output['day'] = $datePart; |
|
4274 | 4274 | break; |
4275 | 4275 | } |
4276 | - if( 3 != $parno ) { |
|
4277 | - switch ( $dateKey ) { |
|
4276 | + if (3 != $parno) { |
|
4277 | + switch ($dateKey) { |
|
4278 | 4278 | case '0': |
4279 | 4279 | case '1': |
4280 | 4280 | case '2': |
4281 | 4281 | break; |
4282 | 4282 | case '3': |
4283 | 4283 | case 'hour': |
4284 | - $output['hour'] = $datePart; |
|
4284 | + $output['hour'] = $datePart; |
|
4285 | 4285 | break; |
4286 | 4286 | case '4': |
4287 | 4287 | case 'min': |
4288 | - $output['min'] = $datePart; |
|
4288 | + $output['min'] = $datePart; |
|
4289 | 4289 | break; |
4290 | 4290 | case '5': |
4291 | 4291 | case 'sec': |
4292 | - $output['sec'] = $datePart; |
|
4292 | + $output['sec'] = $datePart; |
|
4293 | 4293 | break; |
4294 | 4294 | case '6': |
4295 | 4295 | case 'tz': |
4296 | - $output['tz'] = $datePart; |
|
4296 | + $output['tz'] = $datePart; |
|
4297 | 4297 | break; |
4298 | 4298 | } |
4299 | 4299 | } |
4300 | 4300 | } |
4301 | - if( 3 != $parno ) { |
|
4302 | - if( !isset( $output['hour'] )) |
|
4301 | + if (3 != $parno) { |
|
4302 | + if (!isset($output['hour'])) |
|
4303 | 4303 | $output['hour'] = 0; |
4304 | - if( !isset( $output['min'] )) |
|
4304 | + if (!isset($output['min'])) |
|
4305 | 4305 | $output['min'] = 0; |
4306 | - if( !isset( $output['sec'] )) |
|
4306 | + if (!isset($output['sec'])) |
|
4307 | 4307 | $output['sec'] = 0; |
4308 | 4308 | } |
4309 | 4309 | return $output; |
@@ -4317,88 +4317,88 @@ discard block |
||
4317 | 4317 | * @param int $parno optional, default FALSE |
4318 | 4318 | * @return array |
4319 | 4319 | */ |
4320 | - function _date_time_string( $datetime, $parno=FALSE ) { |
|
4321 | - $datetime = (string) trim( $datetime ); |
|
4320 | + function _date_time_string($datetime, $parno = FALSE) { |
|
4321 | + $datetime = (string) trim($datetime); |
|
4322 | 4322 | $tz = null; |
4323 | - $len = strlen( $datetime ) - 1; |
|
4324 | - if( 'Z' == substr( $datetime, -1 )) { |
|
4323 | + $len = strlen($datetime) - 1; |
|
4324 | + if ('Z' == substr($datetime, -1)) { |
|
4325 | 4325 | $tz = 'Z'; |
4326 | - $datetime = trim( substr( $datetime, 0, $len )); |
|
4326 | + $datetime = trim(substr($datetime, 0, $len)); |
|
4327 | 4327 | } |
4328 | - elseif( ( ctype_digit( substr( $datetime, -2, 2 ))) && // time or date |
|
4329 | - ( '-' == substr( $datetime, -3, 1 )) || |
|
4330 | - ( ':' == substr( $datetime, -3, 1 )) || |
|
4331 | - ( '.' == substr( $datetime, -3, 1 ))) { |
|
4328 | + elseif ((ctype_digit(substr($datetime, -2, 2))) && // time or date |
|
4329 | + ('-' == substr($datetime, -3, 1)) || |
|
4330 | + (':' == substr($datetime, -3, 1)) || |
|
4331 | + ('.' == substr($datetime, -3, 1))) { |
|
4332 | 4332 | $continue = TRUE; |
4333 | 4333 | } |
4334 | - elseif( ( ctype_digit( substr( $datetime, -4, 4 ))) && // 4 pos offset |
|
4335 | - ( ' +' == substr( $datetime, -6, 2 )) || |
|
4336 | - ( ' -' == substr( $datetime, -6, 2 ))) { |
|
4337 | - $tz = substr( $datetime, -5, 5 ); |
|
4338 | - $datetime = substr( $datetime, 0, ($len - 5)); |
|
4334 | + elseif ((ctype_digit(substr($datetime, -4, 4))) && // 4 pos offset |
|
4335 | + (' +' == substr($datetime, -6, 2)) || |
|
4336 | + (' -' == substr($datetime, -6, 2))) { |
|
4337 | + $tz = substr($datetime, -5, 5); |
|
4338 | + $datetime = substr($datetime, 0, ($len - 5)); |
|
4339 | 4339 | } |
4340 | - elseif( ( ctype_digit( substr( $datetime, -6, 6 ))) && // 6 pos offset |
|
4341 | - ( ' +' == substr( $datetime, -8, 2 )) || |
|
4342 | - ( ' -' == substr( $datetime, -8, 2 ))) { |
|
4343 | - $tz = substr( $datetime, -7, 7 ); |
|
4344 | - $datetime = substr( $datetime, 0, ($len - 7)); |
|
4340 | + elseif ((ctype_digit(substr($datetime, -6, 6))) && // 6 pos offset |
|
4341 | + (' +' == substr($datetime, -8, 2)) || |
|
4342 | + (' -' == substr($datetime, -8, 2))) { |
|
4343 | + $tz = substr($datetime, -7, 7); |
|
4344 | + $datetime = substr($datetime, 0, ($len - 7)); |
|
4345 | 4345 | } |
4346 | - elseif( ( 6 < $len ) && ( ctype_digit( substr( $datetime, -6, 6 )))) { |
|
4346 | + elseif ((6 < $len) && (ctype_digit(substr($datetime, -6, 6)))) { |
|
4347 | 4347 | $continue = TRUE; |
4348 | 4348 | } |
4349 | - elseif( 'T' == substr( $datetime, -7, 1 )) { |
|
4349 | + elseif ('T' == substr($datetime, -7, 1)) { |
|
4350 | 4350 | $continue = TRUE; |
4351 | 4351 | } |
4352 | 4352 | else { |
4353 | - $cx = $tx = 0; // 19970415T133000 US-Eastern |
|
4354 | - for( $cx = -1; $cx > ( 9 - $len ); $cx-- ) { |
|
4355 | - if(( ' ' == substr( $datetime, $cx, 1 )) || ctype_digit( substr( $datetime, $cx, 1 ))) |
|
4353 | + $cx = $tx = 0; // 19970415T133000 US-Eastern |
|
4354 | + for ($cx = -1; $cx > (9 - $len); $cx--) { |
|
4355 | + if ((' ' == substr($datetime, $cx, 1)) || ctype_digit(substr($datetime, $cx, 1))) |
|
4356 | 4356 | break; // if exists, tz ends here.. . ? |
4357 | - elseif( ctype_alpha( substr( $datetime, $cx, 1 )) || |
|
4358 | - ( in_array( substr( $datetime, $cx, 1 ), array( '-', '/' )))) |
|
4357 | + elseif (ctype_alpha(substr($datetime, $cx, 1)) || |
|
4358 | + (in_array(substr($datetime, $cx, 1), array('-', '/')))) |
|
4359 | 4359 | $tx--; // tz length counter |
4360 | 4360 | } |
4361 | - if( 0 > $tx ) { |
|
4362 | - $tz = substr( $datetime, $tx ); |
|
4363 | - $datetime = trim( substr( $datetime, 0, $len + $tx + 1 )); |
|
4361 | + if (0 > $tx) { |
|
4362 | + $tz = substr($datetime, $tx); |
|
4363 | + $datetime = trim(substr($datetime, 0, $len + $tx + 1)); |
|
4364 | 4364 | } |
4365 | 4365 | } |
4366 | - if( 0 < substr_count( $datetime, '-' )) { |
|
4367 | - $datetime = str_replace( '-', '/', $datetime ); |
|
4368 | - } |
|
4369 | - elseif( ctype_digit( substr( $datetime, 0, 8 )) && |
|
4370 | - ( 'T' == substr( $datetime, 8, 1 )) && |
|
4371 | - ctype_digit( substr( $datetime, 9, 6 ))) { |
|
4372 | - $datetime = substr( $datetime, 4, 2 ) |
|
4373 | - .'/'.substr( $datetime, 6, 2 ) |
|
4374 | - .'/'.substr( $datetime, 0, 4 ) |
|
4375 | - .' '.substr( $datetime, 9, 2 ) |
|
4376 | - .':'.substr( $datetime, 11, 2 ) |
|
4377 | - .':'.substr( $datetime, 13); |
|
4378 | - } |
|
4379 | - $datestring = date( 'Y-m-d H:i:s', strtotime( $datetime )); |
|
4380 | - $tz = trim( $tz ); |
|
4366 | + if (0 < substr_count($datetime, '-')) { |
|
4367 | + $datetime = str_replace('-', '/', $datetime); |
|
4368 | + } |
|
4369 | + elseif (ctype_digit(substr($datetime, 0, 8)) && |
|
4370 | + ('T' == substr($datetime, 8, 1)) && |
|
4371 | + ctype_digit(substr($datetime, 9, 6))) { |
|
4372 | + $datetime = substr($datetime, 4, 2) |
|
4373 | + .'/'.substr($datetime, 6, 2) |
|
4374 | + .'/'.substr($datetime, 0, 4) |
|
4375 | + .' '.substr($datetime, 9, 2) |
|
4376 | + .':'.substr($datetime, 11, 2) |
|
4377 | + .':'.substr($datetime, 13); |
|
4378 | + } |
|
4379 | + $datestring = date('Y-m-d H:i:s', strtotime($datetime)); |
|
4380 | + $tz = trim($tz); |
|
4381 | 4381 | $output = array(); |
4382 | - $output['year'] = substr( $datestring, 0, 4 ); |
|
4383 | - $output['month'] = substr( $datestring, 5, 2 ); |
|
4384 | - $output['day'] = substr( $datestring, 8, 2 ); |
|
4385 | - if(( 6 == $parno ) || ( 7 == $parno )) { |
|
4386 | - $output['hour'] = substr( $datestring, 11, 2 ); |
|
4387 | - $output['min'] = substr( $datestring, 14, 2 ); |
|
4388 | - $output['sec'] = substr( $datestring, 17, 2 ); |
|
4389 | - if( !empty( $tz )) |
|
4390 | - $output['tz'] = $tz; |
|
4391 | - } |
|
4392 | - elseif( 3 != $parno ) { |
|
4393 | - if(( '00' < substr( $datestring, 11, 2 )) || |
|
4394 | - ( '00' < substr( $datestring, 14, 2 )) || |
|
4395 | - ( '00' < substr( $datestring, 17, 2 ))) { |
|
4396 | - $output['hour'] = substr( $datestring, 11, 2 ); |
|
4397 | - $output['min'] = substr( $datestring, 14, 2 ); |
|
4398 | - $output['sec'] = substr( $datestring, 17, 2 ); |
|
4382 | + $output['year'] = substr($datestring, 0, 4); |
|
4383 | + $output['month'] = substr($datestring, 5, 2); |
|
4384 | + $output['day'] = substr($datestring, 8, 2); |
|
4385 | + if ((6 == $parno) || (7 == $parno)) { |
|
4386 | + $output['hour'] = substr($datestring, 11, 2); |
|
4387 | + $output['min'] = substr($datestring, 14, 2); |
|
4388 | + $output['sec'] = substr($datestring, 17, 2); |
|
4389 | + if (!empty($tz)) |
|
4390 | + $output['tz'] = $tz; |
|
4391 | + } |
|
4392 | + elseif (3 != $parno) { |
|
4393 | + if (('00' < substr($datestring, 11, 2)) || |
|
4394 | + ('00' < substr($datestring, 14, 2)) || |
|
4395 | + ('00' < substr($datestring, 17, 2))) { |
|
4396 | + $output['hour'] = substr($datestring, 11, 2); |
|
4397 | + $output['min'] = substr($datestring, 14, 2); |
|
4398 | + $output['sec'] = substr($datestring, 17, 2); |
|
4399 | 4399 | } |
4400 | - if( !empty( $tz )) |
|
4401 | - $output['tz'] = $tz; |
|
4400 | + if (!empty($tz)) |
|
4401 | + $output['tz'] = $tz; |
|
4402 | 4402 | } |
4403 | 4403 | return $output; |
4404 | 4404 | } |
@@ -4410,62 +4410,62 @@ discard block |
||
4410 | 4410 | * @param array $duration |
4411 | 4411 | * @return array |
4412 | 4412 | */ |
4413 | - function _duration_array( $duration ) { |
|
4413 | + function _duration_array($duration) { |
|
4414 | 4414 | $output = array(); |
4415 | - if( is_array( $duration ) && |
|
4416 | - ( 1 == count( $duration )) && |
|
4417 | - isset( $duration['sec'] ) && |
|
4418 | - ( 60 < $duration['sec'] )) { |
|
4415 | + if (is_array($duration) && |
|
4416 | + (1 == count($duration)) && |
|
4417 | + isset($duration['sec']) && |
|
4418 | + (60 < $duration['sec'])) { |
|
4419 | 4419 | $durseconds = $duration['sec']; |
4420 | - $output['week'] = floor( $durseconds / ( 60 * 60 * 24 * 7 )); |
|
4421 | - $durseconds = $durseconds % ( 60 * 60 * 24 * 7 ); |
|
4422 | - $output['day'] = floor( $durseconds / ( 60 * 60 * 24 )); |
|
4423 | - $durseconds = $durseconds % ( 60 * 60 * 24 ); |
|
4424 | - $output['hour'] = floor( $durseconds / ( 60 * 60 )); |
|
4425 | - $durseconds = $durseconds % ( 60 * 60 ); |
|
4426 | - $output['min'] = floor( $durseconds / ( 60 )); |
|
4427 | - $output['sec'] = ( $durseconds % ( 60 )); |
|
4420 | + $output['week'] = floor($durseconds / (60 * 60 * 24 * 7)); |
|
4421 | + $durseconds = $durseconds % (60 * 60 * 24 * 7); |
|
4422 | + $output['day'] = floor($durseconds / (60 * 60 * 24)); |
|
4423 | + $durseconds = $durseconds % (60 * 60 * 24); |
|
4424 | + $output['hour'] = floor($durseconds / (60 * 60)); |
|
4425 | + $durseconds = $durseconds % (60 * 60); |
|
4426 | + $output['min'] = floor($durseconds / (60)); |
|
4427 | + $output['sec'] = ($durseconds % (60)); |
|
4428 | 4428 | } |
4429 | 4429 | else { |
4430 | - foreach( $duration as $durKey => $durValue ) { |
|
4431 | - if( empty( $durValue )) continue; |
|
4432 | - switch ( $durKey ) { |
|
4430 | + foreach ($duration as $durKey => $durValue) { |
|
4431 | + if (empty($durValue)) continue; |
|
4432 | + switch ($durKey) { |
|
4433 | 4433 | case '0': |
4434 | 4434 | case 'week': |
4435 | - $output['week'] = $durValue; |
|
4435 | + $output['week'] = $durValue; |
|
4436 | 4436 | break; |
4437 | 4437 | case '1': |
4438 | 4438 | case 'day': |
4439 | - $output['day'] = $durValue; |
|
4439 | + $output['day'] = $durValue; |
|
4440 | 4440 | break; |
4441 | 4441 | case '2': |
4442 | 4442 | case 'hour': |
4443 | - $output['hour'] = $durValue; |
|
4443 | + $output['hour'] = $durValue; |
|
4444 | 4444 | break; |
4445 | 4445 | case '3': |
4446 | 4446 | case 'min': |
4447 | - $output['min'] = $durValue; |
|
4447 | + $output['min'] = $durValue; |
|
4448 | 4448 | break; |
4449 | 4449 | case '4': |
4450 | 4450 | case 'sec': |
4451 | - $output['sec'] = $durValue; |
|
4451 | + $output['sec'] = $durValue; |
|
4452 | 4452 | break; |
4453 | 4453 | } |
4454 | 4454 | } |
4455 | 4455 | } |
4456 | - if( isset( $output['week'] ) && ( 0 < $output['week'] )) { |
|
4457 | - unset( $output['day'], $output['hour'], $output['min'], $output['sec'] ); |
|
4456 | + if (isset($output['week']) && (0 < $output['week'])) { |
|
4457 | + unset($output['day'], $output['hour'], $output['min'], $output['sec']); |
|
4458 | 4458 | return $output; |
4459 | 4459 | } |
4460 | - unset( $output['week'] ); |
|
4461 | - if( empty( $output['day'] )) |
|
4462 | - unset( $output['day'] ); |
|
4463 | - if ( isset( $output['hour'] ) || isset( $output['min'] ) || isset( $output['sec'] )) { |
|
4464 | - if( !isset( $output['hour'] )) $output['hour'] = 0; |
|
4465 | - if( !isset( $output['min'] )) $output['min'] = 0; |
|
4466 | - if( !isset( $output['sec'] )) $output['sec'] = 0; |
|
4467 | - if(( 0 == $output['hour'] ) && ( 0 == $output['min'] ) && ( 0 == $output['sec'] )) |
|
4468 | - unset( $output['hour'], $output['min'], $output['sec'] ); |
|
4460 | + unset($output['week']); |
|
4461 | + if (empty($output['day'])) |
|
4462 | + unset($output['day']); |
|
4463 | + if (isset($output['hour']) || isset($output['min']) || isset($output['sec'])) { |
|
4464 | + if (!isset($output['hour'])) $output['hour'] = 0; |
|
4465 | + if (!isset($output['min'])) $output['min'] = 0; |
|
4466 | + if (!isset($output['sec'])) $output['sec'] = 0; |
|
4467 | + if ((0 == $output['hour']) && (0 == $output['min']) && (0 == $output['sec'])) |
|
4468 | + unset($output['hour'], $output['min'], $output['sec']); |
|
4469 | 4469 | } |
4470 | 4470 | return $output; |
4471 | 4471 | } |
@@ -4478,43 +4478,43 @@ discard block |
||
4478 | 4478 | * @param array $duration, optional |
4479 | 4479 | * @return array, date format |
4480 | 4480 | */ |
4481 | - function duration2date( $startdate=FALSE, $duration=FALSE ) { |
|
4482 | - if( $startdate && $duration ) { |
|
4481 | + function duration2date($startdate = FALSE, $duration = FALSE) { |
|
4482 | + if ($startdate && $duration) { |
|
4483 | 4483 | $d1 = $startdate; |
4484 | 4484 | $dur = $duration; |
4485 | 4485 | } |
4486 | - elseif( isset( $this->dtstart['value'] ) && isset( $this->duration['value'] )) { |
|
4486 | + elseif (isset($this->dtstart['value']) && isset($this->duration['value'])) { |
|
4487 | 4487 | $d1 = $this->dtstart['value']; |
4488 | 4488 | $dur = $this->duration['value']; |
4489 | 4489 | } |
4490 | 4490 | else |
4491 | 4491 | return null; |
4492 | - $dateOnly = ( isset( $d1['hour'] ) || isset( $d1['min'] ) || isset( $d1['sec'] )) ? FALSE : TRUE; |
|
4493 | - $d1['hour'] = ( isset( $d1['hour'] )) ? $d1['hour'] : 0; |
|
4494 | - $d1['min'] = ( isset( $d1['min'] )) ? $d1['min'] : 0; |
|
4495 | - $d1['sec'] = ( isset( $d1['sec'] )) ? $d1['sec'] : 0; |
|
4496 | - $dtend = mktime( $d1['hour'], $d1['min'], $d1['sec'], $d1['month'], $d1['day'], $d1['year'] ); |
|
4497 | - if( isset( $dur['week'] )) |
|
4498 | - $dtend += ( $dur['week'] * 7 * 24 * 60 * 60 ); |
|
4499 | - if( isset( $dur['day'] )) |
|
4500 | - $dtend += ( $dur['day'] * 24 * 60 * 60 ); |
|
4501 | - if( isset( $dur['hour'] )) |
|
4502 | - $dtend += ( $dur['hour'] * 60 *60 ); |
|
4503 | - if( isset( $dur['min'] )) |
|
4504 | - $dtend += ( $dur['min'] * 60 ); |
|
4505 | - if( isset( $dur['sec'] )) |
|
4506 | - $dtend += $dur['sec']; |
|
4492 | + $dateOnly = (isset($d1['hour']) || isset($d1['min']) || isset($d1['sec'])) ? FALSE : TRUE; |
|
4493 | + $d1['hour'] = (isset($d1['hour'])) ? $d1['hour'] : 0; |
|
4494 | + $d1['min'] = (isset($d1['min'])) ? $d1['min'] : 0; |
|
4495 | + $d1['sec'] = (isset($d1['sec'])) ? $d1['sec'] : 0; |
|
4496 | + $dtend = mktime($d1['hour'], $d1['min'], $d1['sec'], $d1['month'], $d1['day'], $d1['year']); |
|
4497 | + if (isset($dur['week'])) |
|
4498 | + $dtend += ($dur['week'] * 7 * 24 * 60 * 60); |
|
4499 | + if (isset($dur['day'])) |
|
4500 | + $dtend += ($dur['day'] * 24 * 60 * 60); |
|
4501 | + if (isset($dur['hour'])) |
|
4502 | + $dtend += ($dur['hour'] * 60 * 60); |
|
4503 | + if (isset($dur['min'])) |
|
4504 | + $dtend += ($dur['min'] * 60); |
|
4505 | + if (isset($dur['sec'])) |
|
4506 | + $dtend += $dur['sec']; |
|
4507 | 4507 | $dtend2 = array(); |
4508 | - $dtend2['year'] = date('Y', $dtend ); |
|
4509 | - $dtend2['month'] = date('m', $dtend ); |
|
4510 | - $dtend2['day'] = date('d', $dtend ); |
|
4511 | - $dtend2['hour'] = date('H', $dtend ); |
|
4512 | - $dtend2['min'] = date('i', $dtend ); |
|
4513 | - $dtend2['sec'] = date('s', $dtend ); |
|
4514 | - if( isset( $d1['tz'] )) |
|
4515 | - $dtend2['tz'] = $d1['tz']; |
|
4516 | - if( $dateOnly && (( 0 == $dtend2['hour'] ) && ( 0 == $dtend2['min'] ) && ( 0 == $dtend2['sec'] ))) |
|
4517 | - unset( $dtend2['hour'], $dtend2['min'], $dtend2['sec'] ); |
|
4508 | + $dtend2['year'] = date('Y', $dtend); |
|
4509 | + $dtend2['month'] = date('m', $dtend); |
|
4510 | + $dtend2['day'] = date('d', $dtend); |
|
4511 | + $dtend2['hour'] = date('H', $dtend); |
|
4512 | + $dtend2['min'] = date('i', $dtend); |
|
4513 | + $dtend2['sec'] = date('s', $dtend); |
|
4514 | + if (isset($d1['tz'])) |
|
4515 | + $dtend2['tz'] = $d1['tz']; |
|
4516 | + if ($dateOnly && ((0 == $dtend2['hour']) && (0 == $dtend2['min']) && (0 == $dtend2['sec']))) |
|
4517 | + unset($dtend2['hour'], $dtend2['min'], $dtend2['sec']); |
|
4518 | 4518 | return $dtend2; |
4519 | 4519 | } |
4520 | 4520 | /** |
@@ -4525,21 +4525,21 @@ discard block |
||
4525 | 4525 | * @param string $duration |
4526 | 4526 | * @return array |
4527 | 4527 | */ |
4528 | - function _duration_string( $duration ) { |
|
4529 | - $duration = (string) trim( $duration ); |
|
4530 | - while( 'P' != strtoupper( substr( $duration, 0, 1 ))) { |
|
4531 | - if( 0 < strlen( $duration )) |
|
4532 | - $duration = substr( $duration, 1 ); |
|
4528 | + function _duration_string($duration) { |
|
4529 | + $duration = (string) trim($duration); |
|
4530 | + while ('P' != strtoupper(substr($duration, 0, 1))) { |
|
4531 | + if (0 < strlen($duration)) |
|
4532 | + $duration = substr($duration, 1); |
|
4533 | 4533 | else |
4534 | 4534 | return false; // no leading P !?!? |
4535 | 4535 | } |
4536 | - $duration = substr( $duration, 1 ); // skip P |
|
4537 | - $duration = str_replace ( 't', 'T', $duration ); |
|
4538 | - $duration = str_replace ( 'T', '', $duration ); |
|
4536 | + $duration = substr($duration, 1); // skip P |
|
4537 | + $duration = str_replace('t', 'T', $duration); |
|
4538 | + $duration = str_replace('T', '', $duration); |
|
4539 | 4539 | $output = array(); |
4540 | 4540 | $val = null; |
4541 | - for( $ix=0; $ix < strlen( $duration ); $ix++ ) { |
|
4542 | - switch( strtoupper( $duration{$ix} )) { |
|
4541 | + for ($ix = 0; $ix < strlen($duration); $ix++) { |
|
4542 | + switch (strtoupper($duration{$ix} )) { |
|
4543 | 4543 | case 'W': |
4544 | 4544 | $output['week'] = $val; |
4545 | 4545 | $val = null; |
@@ -4561,13 +4561,13 @@ discard block |
||
4561 | 4561 | $val = null; |
4562 | 4562 | break; |
4563 | 4563 | default: |
4564 | - if( !ctype_digit( $duration{$ix} )) |
|
4564 | + if (!ctype_digit($duration{$ix} )) |
|
4565 | 4565 | return false; // unknown duration controll character !?!? |
4566 | 4566 | else |
4567 | 4567 | $val .= $duration{$ix}; |
4568 | 4568 | } |
4569 | 4569 | } |
4570 | - return $this->_duration_array( $output ); |
|
4570 | + return $this->_duration_array($output); |
|
4571 | 4571 | } |
4572 | 4572 | /** |
4573 | 4573 | * if not preSet, if exist, remove key with expected value from array and return hit value else return elseValue |
@@ -4582,15 +4582,15 @@ discard block |
||
4582 | 4582 | * @param int $preSet optional, return value if already preset |
4583 | 4583 | * @return int |
4584 | 4584 | */ |
4585 | - function _existRem( &$array, $expkey, $expval=FALSE, $hitVal=null, $elseVal=null, $preSet=null ) { |
|
4586 | - if( $preSet ) |
|
4585 | + function _existRem(&$array, $expkey, $expval = FALSE, $hitVal = null, $elseVal = null, $preSet = null) { |
|
4586 | + if ($preSet) |
|
4587 | 4587 | return $preSet; |
4588 | - if( !is_array( $array ) || ( 0 == count( $array ))) |
|
4588 | + if (!is_array($array) || (0 == count($array))) |
|
4589 | 4589 | return $elseVal; |
4590 | - foreach( $array as $key => $value ) { |
|
4591 | - if( strtoupper( $expkey ) == strtoupper( $key )) { |
|
4592 | - if( !$expval || ( strtoupper( $expval ) == strtoupper( $array[$key] ))) { |
|
4593 | - unset( $array[$key] ); |
|
4590 | + foreach ($array as $key => $value) { |
|
4591 | + if (strtoupper($expkey) == strtoupper($key)) { |
|
4592 | + if (!$expval || (strtoupper($expval) == strtoupper($array[$key]))) { |
|
4593 | + unset($array[$key]); |
|
4594 | 4594 | return $hitVal; |
4595 | 4595 | } |
4596 | 4596 | } |
@@ -4606,48 +4606,48 @@ discard block |
||
4606 | 4606 | * @param int $parno, optional, default 6 |
4607 | 4607 | * @return string |
4608 | 4608 | */ |
4609 | - function _format_date_time( $datetime, $parno=6 ) { |
|
4610 | - if( !isset( $datetime['year'] ) && |
|
4611 | - !isset( $datetime['month'] ) && |
|
4612 | - !isset( $datetime['day'] ) && |
|
4613 | - !isset( $datetime['hour'] ) && |
|
4614 | - !isset( $datetime['min'] ) && |
|
4615 | - !isset( $datetime['sec'] )) |
|
4616 | - return ; |
|
4609 | + function _format_date_time($datetime, $parno = 6) { |
|
4610 | + if (!isset($datetime['year']) && |
|
4611 | + !isset($datetime['month']) && |
|
4612 | + !isset($datetime['day']) && |
|
4613 | + !isset($datetime['hour']) && |
|
4614 | + !isset($datetime['min']) && |
|
4615 | + !isset($datetime['sec'])) |
|
4616 | + return; |
|
4617 | 4617 | $output = null; |
4618 | 4618 | // if( !isset( $datetime['day'] )) { $o=''; foreach($datetime as $k=>$v) {if(is_array($v)) $v=implode('-',$v);$o.=" $k=>$v";} echo " day SAKNAS : $o <br />\n"; } |
4619 | - foreach( $datetime as $dkey => $dvalue ) { |
|
4620 | - if( 'tz' != $dkey ) |
|
4619 | + foreach ($datetime as $dkey => $dvalue) { |
|
4620 | + if ('tz' != $dkey) |
|
4621 | 4621 | $datetime[$dkey] = (integer) $dvalue; |
4622 | 4622 | } |
4623 | - $output = date('Ymd', mktime( 0, 0, 0, $datetime['month'], $datetime['day'], $datetime['year'])); |
|
4624 | - if( isset( $datetime['hour'] ) || |
|
4625 | - isset( $datetime['min'] ) || |
|
4626 | - isset( $datetime['sec'] ) || |
|
4627 | - isset( $datetime['tz'] )) { |
|
4628 | - if( isset( $datetime['tz'] ) && |
|
4629 | - !isset( $datetime['hour'] )) |
|
4623 | + $output = date('Ymd', mktime(0, 0, 0, $datetime['month'], $datetime['day'], $datetime['year'])); |
|
4624 | + if (isset($datetime['hour']) || |
|
4625 | + isset($datetime['min']) || |
|
4626 | + isset($datetime['sec']) || |
|
4627 | + isset($datetime['tz'])) { |
|
4628 | + if (isset($datetime['tz']) && |
|
4629 | + !isset($datetime['hour'])) |
|
4630 | 4630 | $datetime['hour'] = 0; |
4631 | - if( isset( $datetime['hour'] ) && |
|
4632 | - !isset( $datetime['min'] )) |
|
4631 | + if (isset($datetime['hour']) && |
|
4632 | + !isset($datetime['min'])) |
|
4633 | 4633 | $datetime['min'] = 0; |
4634 | - if( isset( $datetime['hour'] ) && |
|
4635 | - isset( $datetime['min'] ) && |
|
4636 | - !isset( $datetime['sec'] )) |
|
4634 | + if (isset($datetime['hour']) && |
|
4635 | + isset($datetime['min']) && |
|
4636 | + !isset($datetime['sec'])) |
|
4637 | 4637 | $datetime['sec'] = 0; |
4638 | - $date = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year']); |
|
4639 | - $output .= date('\THis', $date ); |
|
4640 | - if( isset( $datetime['tz'] ) && ( '' < trim ( $datetime['tz'] ))) { |
|
4641 | - $datetime['tz'] = trim( $datetime['tz'] ); |
|
4642 | - if( 'Z' == $datetime['tz'] ) |
|
4638 | + $date = mktime($datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year']); |
|
4639 | + $output .= date('\THis', $date); |
|
4640 | + if (isset($datetime['tz']) && ('' < trim($datetime['tz']))) { |
|
4641 | + $datetime['tz'] = trim($datetime['tz']); |
|
4642 | + if ('Z' == $datetime['tz']) |
|
4643 | 4643 | $output .= 'Z'; |
4644 | - $offset = $this->_tz2offset( $datetime['tz'] ); |
|
4645 | - if( 0 != $offset ) { |
|
4646 | - $date = mktime( $datetime['hour'], $datetime['min'], ($datetime['sec'] + $offset), $datetime['month'], $datetime['day'], $datetime['year']); |
|
4647 | - $output = date( 'Ymd\THis\Z', $date ); |
|
4644 | + $offset = $this->_tz2offset($datetime['tz']); |
|
4645 | + if (0 != $offset) { |
|
4646 | + $date = mktime($datetime['hour'], $datetime['min'], ($datetime['sec'] + $offset), $datetime['month'], $datetime['day'], $datetime['year']); |
|
4647 | + $output = date('Ymd\THis\Z', $date); |
|
4648 | 4648 | } |
4649 | 4649 | } |
4650 | - elseif( 7 == $parno ) |
|
4650 | + elseif (7 == $parno) |
|
4651 | 4651 | $output .= 'Z'; |
4652 | 4652 | } |
4653 | 4653 | return $output; |
@@ -4660,26 +4660,26 @@ discard block |
||
4660 | 4660 | * @param array $duration ( week, day, hour, min, sec ) |
4661 | 4661 | * @return string |
4662 | 4662 | */ |
4663 | - function _format_duration( $duration ) { |
|
4664 | - if( !isset( $duration['week'] ) && |
|
4665 | - !isset( $duration['day'] ) && |
|
4666 | - !isset( $duration['hour'] ) && |
|
4667 | - !isset( $duration['min'] ) && |
|
4668 | - !isset( $duration['sec'] )) |
|
4663 | + function _format_duration($duration) { |
|
4664 | + if (!isset($duration['week']) && |
|
4665 | + !isset($duration['day']) && |
|
4666 | + !isset($duration['hour']) && |
|
4667 | + !isset($duration['min']) && |
|
4668 | + !isset($duration['sec'])) |
|
4669 | 4669 | return; |
4670 | 4670 | $output = 'P'; |
4671 | - if( isset( $duration['week'] ) && ( 0 < $duration['week'] )) |
|
4672 | - $output .= $duration['week'].'W'; |
|
4671 | + if (isset($duration['week']) && (0 < $duration['week'])) |
|
4672 | + $output .= $duration['week'].'W'; |
|
4673 | 4673 | else { |
4674 | - if( isset($duration['day'] ) && ( 0 < $duration['day'] )) |
|
4674 | + if (isset($duration['day']) && (0 < $duration['day'])) |
|
4675 | 4675 | $output .= $duration['day'].'D'; |
4676 | - if(( isset( $duration['hour']) && ( 0 < $duration['hour'] )) || |
|
4677 | - ( isset( $duration['min']) && ( 0 < $duration['min'] )) || |
|
4678 | - ( isset( $duration['sec']) && ( 0 < $duration['sec'] ))) { |
|
4676 | + if ((isset($duration['hour']) && (0 < $duration['hour'])) || |
|
4677 | + (isset($duration['min']) && (0 < $duration['min'])) || |
|
4678 | + (isset($duration['sec']) && (0 < $duration['sec']))) { |
|
4679 | 4679 | $output .= 'T'; |
4680 | - $output .= ( isset( $duration['hour']) && ( 0 < $duration['hour'] )) ? $duration['hour'].'H' : '0H'; |
|
4681 | - $output .= ( isset( $duration['min']) && ( 0 < $duration['min'] )) ? $duration['min']. 'M' : '0M'; |
|
4682 | - $output .= ( isset( $duration['sec']) && ( 0 < $duration['sec'] )) ? $duration['sec']. 'S' : '0S'; |
|
4680 | + $output .= (isset($duration['hour']) && (0 < $duration['hour'])) ? $duration['hour'].'H' : '0H'; |
|
4681 | + $output .= (isset($duration['min']) && (0 < $duration['min'])) ? $duration['min'].'M' : '0M'; |
|
4682 | + $output .= (isset($duration['sec']) && (0 < $duration['sec'])) ? $duration['sec'].'S' : '0S'; |
|
4683 | 4683 | } |
4684 | 4684 | } |
4685 | 4685 | return $output; |
@@ -4693,23 +4693,23 @@ discard block |
||
4693 | 4693 | * @param array $recurdata |
4694 | 4694 | * @return string |
4695 | 4695 | */ |
4696 | - function _format_recur( $recurlabel, $recurdata ) { |
|
4696 | + function _format_recur($recurlabel, $recurdata) { |
|
4697 | 4697 | $output = null; |
4698 | - foreach( $recurdata as $therule ) { |
|
4699 | - if( empty( $therule['value'] )) { |
|
4700 | - if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( $recurlabel ); |
|
4698 | + foreach ($recurdata as $therule) { |
|
4699 | + if (empty($therule['value'])) { |
|
4700 | + if ($this->getConfig('allowEmpty')) $output .= $this->_createElement($recurlabel); |
|
4701 | 4701 | continue; |
4702 | 4702 | } |
4703 | - $attributes = ( isset( $therule['params'] )) ? $this->_createParams( $therule['params'] ) : null; |
|
4704 | - $content1 = $content2 = null; |
|
4705 | - foreach( $therule['value'] as $rulelabel => $rulevalue ) { |
|
4706 | - switch( $rulelabel ) { |
|
4703 | + $attributes = (isset($therule['params'])) ? $this->_createParams($therule['params']) : null; |
|
4704 | + $content1 = $content2 = null; |
|
4705 | + foreach ($therule['value'] as $rulelabel => $rulevalue) { |
|
4706 | + switch ($rulelabel) { |
|
4707 | 4707 | case 'FREQ': |
4708 | 4708 | $content1 .= "FREQ=$rulevalue"; |
4709 | 4709 | break; |
4710 | 4710 | case 'UNTIL': |
4711 | 4711 | $content2 .= ";UNTIL="; |
4712 | - $content2 .= $this->_format_date_time( $rulevalue ); |
|
4712 | + $content2 .= $this->_format_date_time($rulevalue); |
|
4713 | 4713 | break; |
4714 | 4714 | case 'COUNT': |
4715 | 4715 | case 'INTERVAL': |
@@ -4725,9 +4725,9 @@ discard block |
||
4725 | 4725 | case 'BYMONTH': |
4726 | 4726 | case 'BYSETPOS': |
4727 | 4727 | $content2 .= ";$rulelabel="; |
4728 | - if (is_array( $rulevalue )) { |
|
4729 | - foreach( $rulevalue as $vix => $valuePart ) { |
|
4730 | - $content2 .= ( $vix ) ? ',' : null; |
|
4728 | + if (is_array($rulevalue)) { |
|
4729 | + foreach ($rulevalue as $vix => $valuePart) { |
|
4730 | + $content2 .= ($vix) ? ',' : null; |
|
4731 | 4731 | $content2 .= $valuePart; |
4732 | 4732 | } |
4733 | 4733 | } else { |
@@ -4737,12 +4737,12 @@ discard block |
||
4737 | 4737 | case 'BYDAY': |
4738 | 4738 | $content2 .= ";$rulelabel="; |
4739 | 4739 | $bydaycnt = 0; |
4740 | - foreach( $rulevalue as $vix => $valuePart ) { |
|
4740 | + foreach ($rulevalue as $vix => $valuePart) { |
|
4741 | 4741 | $content21 = $content22 = null; |
4742 | - if( is_array( $valuePart )) { |
|
4743 | - $content2 .= ( $bydaycnt ) ? ',' : null; |
|
4744 | - foreach( $valuePart as $vix2 => $valuePart2 ) { |
|
4745 | - if( 'DAY' != strtoupper( $vix2 )) |
|
4742 | + if (is_array($valuePart)) { |
|
4743 | + $content2 .= ($bydaycnt) ? ',' : null; |
|
4744 | + foreach ($valuePart as $vix2 => $valuePart2) { |
|
4745 | + if ('DAY' != strtoupper($vix2)) |
|
4746 | 4746 | $content21 .= $valuePart2; |
4747 | 4747 | else |
4748 | 4748 | $content22 .= $valuePart2; |
@@ -4751,8 +4751,8 @@ discard block |
||
4751 | 4751 | $bydaycnt++; |
4752 | 4752 | } |
4753 | 4753 | else { |
4754 | - $content2 .= ( $bydaycnt ) ? ',' : null; |
|
4755 | - if( 'DAY' != strtoupper( $vix )) |
|
4754 | + $content2 .= ($bydaycnt) ? ',' : null; |
|
4755 | + if ('DAY' != strtoupper($vix)) |
|
4756 | 4756 | $content21 .= $valuePart; |
4757 | 4757 | else { |
4758 | 4758 | $content22 .= $valuePart; |
@@ -4767,7 +4767,7 @@ discard block |
||
4767 | 4767 | break; |
4768 | 4768 | } |
4769 | 4769 | } |
4770 | - $output .= $this->_createElement( $recurlabel, $attributes, $content1.$content2 ); |
|
4770 | + $output .= $this->_createElement($recurlabel, $attributes, $content1.$content2); |
|
4771 | 4771 | } |
4772 | 4772 | return $output; |
4773 | 4773 | } |
@@ -4779,13 +4779,13 @@ discard block |
||
4779 | 4779 | * @param string $propertyName |
4780 | 4780 | * @return string |
4781 | 4781 | */ |
4782 | - function _formatPropertyName( $propertyName ) { |
|
4783 | - switch( $this->format ) { |
|
4782 | + function _formatPropertyName($propertyName) { |
|
4783 | + switch ($this->format) { |
|
4784 | 4784 | case 'xcal': |
4785 | - return strtolower( $propertyName ); |
|
4785 | + return strtolower($propertyName); |
|
4786 | 4786 | break; |
4787 | 4787 | default: |
4788 | - return strtoupper( $propertyName ); |
|
4788 | + return strtoupper($propertyName); |
|
4789 | 4789 | break; |
4790 | 4790 | } |
4791 | 4791 | } |
@@ -4797,25 +4797,25 @@ discard block |
||
4797 | 4797 | * @param array $input |
4798 | 4798 | * @return bool |
4799 | 4799 | */ |
4800 | - function _isArrayDate( $input ) { |
|
4801 | - if( isset( $input['week'] ) || ( !in_array( count( $input ), array( 3, 6, 7 )))) |
|
4800 | + function _isArrayDate($input) { |
|
4801 | + if (isset($input['week']) || (!in_array(count($input), array(3, 6, 7)))) |
|
4802 | 4802 | return FALSE; |
4803 | - if( 7 == count( $input )) |
|
4803 | + if (7 == count($input)) |
|
4804 | 4804 | return TRUE; |
4805 | - if( isset( $input['year'] ) && isset( $input['month'] ) && isset( $input['day'] )) |
|
4806 | - return checkdate( (int) $input['month'], (int) $input['day'], (int) $input['year'] ); |
|
4807 | - if( isset( $input['day'] ) || isset( $input['hour'] ) || isset( $input['min'] ) || isset( $input['sec'] )) |
|
4805 | + if (isset($input['year']) && isset($input['month']) && isset($input['day'])) |
|
4806 | + return checkdate((int) $input['month'], (int) $input['day'], (int) $input['year']); |
|
4807 | + if (isset($input['day']) || isset($input['hour']) || isset($input['min']) || isset($input['sec'])) |
|
4808 | 4808 | return FALSE; |
4809 | - if( in_array( 0, $input )) |
|
4809 | + if (in_array(0, $input)) |
|
4810 | 4810 | return FALSE; |
4811 | - if(( 1970 > $input[0] ) || ( 12 < $input[1] ) || ( 31 < $input[2] )) |
|
4811 | + if ((1970 > $input[0]) || (12 < $input[1]) || (31 < $input[2])) |
|
4812 | 4812 | return FALSE; |
4813 | - if(( isset( $input[0] ) && isset( $input[1] ) && isset( $input[2] )) && |
|
4814 | - checkdate( (int) $input[1], (int) $input[2], (int) $input[0] )) |
|
4813 | + if ((isset($input[0]) && isset($input[1]) && isset($input[2])) && |
|
4814 | + checkdate((int) $input[1], (int) $input[2], (int) $input[0])) |
|
4815 | 4815 | return TRUE; |
4816 | - $input = $this->_date_time_string( $input[1].'/'.$input[2].'/'.$input[0], 3 ); // m - d - Y |
|
4817 | - if( isset( $input['year'] ) && isset( $input['month'] ) && isset( $input['day'] )) |
|
4818 | - return checkdate( (int) $input['month'], (int) $input['day'], (int) $input['year'] ); |
|
4816 | + $input = $this->_date_time_string($input[1].'/'.$input[2].'/'.$input[0], 3); // m - d - Y |
|
4817 | + if (isset($input['year']) && isset($input['month']) && isset($input['day'])) |
|
4818 | + return checkdate((int) $input['month'], (int) $input['day'], (int) $input['year']); |
|
4819 | 4819 | return FALSE; |
4820 | 4820 | } |
4821 | 4821 | /** |
@@ -4826,8 +4826,8 @@ discard block |
||
4826 | 4826 | * @param array $input |
4827 | 4827 | * @return bool |
4828 | 4828 | */ |
4829 | - function _isArrayTimestampDate( $input ) { |
|
4830 | - return ( is_array( $input ) && isset( $input['timestamp'] )) ? TRUE : FALSE ; |
|
4829 | + function _isArrayTimestampDate($input) { |
|
4830 | + return (is_array($input) && isset($input['timestamp'])) ? TRUE : FALSE; |
|
4831 | 4831 | } |
4832 | 4832 | /** |
4833 | 4833 | * controll if input string contains traling UTC offset |
@@ -4837,17 +4837,17 @@ discard block |
||
4837 | 4837 | * @param string $input |
4838 | 4838 | * @return bool |
4839 | 4839 | */ |
4840 | - function _isOffset( $input ) { |
|
4841 | - $input = trim( (string) $input ); |
|
4842 | - if( 'Z' == substr( $input, -1 )) |
|
4840 | + function _isOffset($input) { |
|
4841 | + $input = trim((string) $input); |
|
4842 | + if ('Z' == substr($input, -1)) |
|
4843 | 4843 | return TRUE; |
4844 | - elseif(( 5 <= strlen( $input )) && |
|
4845 | - ( in_array( substr( $input, -5, 1 ), array( '+', '-' ))) && |
|
4846 | - ( '0000' < substr( $input, -4 )) && ( '9999' >= substr( $input, -4 ))) |
|
4844 | + elseif ((5 <= strlen($input)) && |
|
4845 | + (in_array(substr($input, -5, 1), array('+', '-'))) && |
|
4846 | + ('0000' < substr($input, -4)) && ('9999' >= substr($input, -4))) |
|
4847 | 4847 | return TRUE; |
4848 | - elseif(( 7 <= strlen( $input )) && |
|
4849 | - ( in_array( substr( $input, -7, 1 ), array( '+', '-' ))) && |
|
4850 | - ( '000000' < substr( $input, -6 )) && ( '999999' >= substr( $input, -6 ))) |
|
4848 | + elseif ((7 <= strlen($input)) && |
|
4849 | + (in_array(substr($input, -7, 1), array('+', '-'))) && |
|
4850 | + ('000000' < substr($input, -6)) && ('999999' >= substr($input, -6))) |
|
4851 | 4851 | return TRUE; |
4852 | 4852 | return FALSE; |
4853 | 4853 | |
@@ -4860,15 +4860,15 @@ discard block |
||
4860 | 4860 | * @param string $propName |
4861 | 4861 | * @return bool |
4862 | 4862 | */ |
4863 | - function _notExistProp( $propName ) { |
|
4864 | - if( empty( $propName )) return FALSE; // when deleting x-prop, an empty propName may be used=allowed |
|
4865 | - $propName = strtolower( $propName ); |
|
4866 | - if( 'last-modified' == $propName ) { if( !isset( $this->lastmodified )) return TRUE; } |
|
4867 | - elseif( 'percent-complete' == $propName ) { if( !isset( $this->percentcomplete )) return TRUE; } |
|
4868 | - elseif( 'recurrence-id' == $propName ) { if( !isset( $this->recurrenceid )) return TRUE; } |
|
4869 | - elseif( 'related-to' == $propName ) { if( !isset( $this->relatedto )) return TRUE; } |
|
4870 | - elseif( 'request-status' == $propName ) { if( !isset( $this->requeststatus )) return TRUE; } |
|
4871 | - elseif(( 'x-' != substr($propName,0,2)) && !isset( $this->$propName )) return TRUE; |
|
4863 | + function _notExistProp($propName) { |
|
4864 | + if (empty($propName)) return FALSE; // when deleting x-prop, an empty propName may be used=allowed |
|
4865 | + $propName = strtolower($propName); |
|
4866 | + if ('last-modified' == $propName) { if (!isset($this->lastmodified)) return TRUE; } |
|
4867 | + elseif ('percent-complete' == $propName) { if (!isset($this->percentcomplete)) return TRUE; } |
|
4868 | + elseif ('recurrence-id' == $propName) { if (!isset($this->recurrenceid)) return TRUE; } |
|
4869 | + elseif ('related-to' == $propName) { if (!isset($this->relatedto)) return TRUE; } |
|
4870 | + elseif ('request-status' == $propName) { if (!isset($this->requeststatus)) return TRUE; } |
|
4871 | + elseif (('x-' != substr($propName, 0, 2)) && !isset($this->$propName)) return TRUE; |
|
4872 | 4872 | return FALSE; |
4873 | 4873 | } |
4874 | 4874 | /** |
@@ -4886,101 +4886,101 @@ discard block |
||
4886 | 4886 | * @return array of recurrence (start-)dates as index |
4887 | 4887 | * @todo BYHOUR, BYMINUTE, BYSECOND, ev. BYSETPOS due to ambiguity, WEEKLY at year end/start |
4888 | 4888 | */ |
4889 | - function _recur2date( & $result, $recur, $wdate, $startdate, $enddate=FALSE ) { |
|
4890 | - foreach( $wdate as $k => $v ) if( ctype_digit( $v )) $wdate[$k] = (int) $v; |
|
4891 | - $wdatets = $this->_date2timestamp( $wdate ); |
|
4892 | - $startdatets = $this->_date2timestamp( $startdate ); |
|
4893 | - if( !$enddate ) { |
|
4889 | + function _recur2date(& $result, $recur, $wdate, $startdate, $enddate = FALSE) { |
|
4890 | + foreach ($wdate as $k => $v) if (ctype_digit($v)) $wdate[$k] = (int) $v; |
|
4891 | + $wdatets = $this->_date2timestamp($wdate); |
|
4892 | + $startdatets = $this->_date2timestamp($startdate); |
|
4893 | + if (!$enddate) { |
|
4894 | 4894 | $enddate = $startdate; |
4895 | 4895 | $enddate['year'] += 1; |
4896 | 4896 | // echo "recur __in_ ".implode('-',$startdate)." period start ".implode('-',$wdate)." period end ".implode('-',$enddate)."<br />\n";print_r($recur);echo "<br />\n";//test### |
4897 | 4897 | } |
4898 | - $endDatets = $this->_date2timestamp( $enddate ); // fix break |
|
4899 | - if( !isset( $recur['COUNT'] ) && !isset( $recur['UNTIL'] )) |
|
4898 | + $endDatets = $this->_date2timestamp($enddate); // fix break |
|
4899 | + if (!isset($recur['COUNT']) && !isset($recur['UNTIL'])) |
|
4900 | 4900 | $recur['UNTIL'] = $enddate; // create break |
4901 | - if( isset( $recur['UNTIL'] )) { |
|
4902 | - $tdatets = $this->_date2timestamp( $recur['UNTIL'] ); |
|
4903 | - if( $endDatets > $tdatets ) { |
|
4901 | + if (isset($recur['UNTIL'])) { |
|
4902 | + $tdatets = $this->_date2timestamp($recur['UNTIL']); |
|
4903 | + if ($endDatets > $tdatets) { |
|
4904 | 4904 | $endDatets = $tdatets; // emergency break |
4905 | - $enddate = $this->_timestamp2date( $endDatets, 6 ); |
|
4905 | + $enddate = $this->_timestamp2date($endDatets, 6); |
|
4906 | 4906 | } |
4907 | 4907 | else |
4908 | - $recur['UNTIL'] = $this->_timestamp2date( $endDatets, 6 ); |
|
4908 | + $recur['UNTIL'] = $this->_timestamp2date($endDatets, 6); |
|
4909 | 4909 | } |
4910 | - if( $wdatets > $endDatets ) { |
|
4910 | + if ($wdatets > $endDatets) { |
|
4911 | 4911 | //echo "recur out of date ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$wdatets),6))."<br />\n";//test |
4912 | 4912 | return array(); // nothing to do.. . |
4913 | 4913 | } |
4914 | - if( !isset( $recur['FREQ'] )) // "MUST be specified.. ." |
|
4914 | + if (!isset($recur['FREQ'])) // "MUST be specified.. ." |
|
4915 | 4915 | $recur['FREQ'] = 'DAILY'; // ?? |
4916 | - $wkst = ( isset( $recur['WKST'] ) && ( 'SU' == $recur['WKST'] )) ? 24*60*60 : 0; // ?? |
|
4917 | - if( !isset( $recur['INTERVAL'] )) |
|
4916 | + $wkst = (isset($recur['WKST']) && ('SU' == $recur['WKST'])) ? 24 * 60 * 60 : 0; // ?? |
|
4917 | + if (!isset($recur['INTERVAL'])) |
|
4918 | 4918 | $recur['INTERVAL'] = 1; |
4919 | - $countcnt = ( !isset( $recur['BYSETPOS'] )) ? 1 : 0; // DTSTART counts as the first occurrence |
|
4919 | + $countcnt = (!isset($recur['BYSETPOS'])) ? 1 : 0; // DTSTART counts as the first occurrence |
|
4920 | 4920 | /* find out how to step up dates and set index for interval count */ |
4921 | 4921 | $step = array(); |
4922 | - if( 'YEARLY' == $recur['FREQ'] ) |
|
4922 | + if ('YEARLY' == $recur['FREQ']) |
|
4923 | 4923 | $step['year'] = 1; |
4924 | - elseif( 'MONTHLY' == $recur['FREQ'] ) |
|
4924 | + elseif ('MONTHLY' == $recur['FREQ']) |
|
4925 | 4925 | $step['month'] = 1; |
4926 | - elseif( 'WEEKLY' == $recur['FREQ'] ) |
|
4926 | + elseif ('WEEKLY' == $recur['FREQ']) |
|
4927 | 4927 | $step['day'] = 7; |
4928 | 4928 | else |
4929 | 4929 | $step['day'] = 1; |
4930 | - if( isset( $step['year'] ) && isset( $recur['BYMONTH'] )) |
|
4931 | - $step = array( 'month' => 1 ); |
|
4932 | - if( empty( $step ) && isset( $recur['BYWEEKNO'] )) // ?? |
|
4933 | - $step = array( 'day' => 7 ); |
|
4934 | - if( isset( $recur['BYYEARDAY'] ) || isset( $recur['BYMONTHDAY'] ) || isset( $recur['BYDAY'] )) |
|
4935 | - $step = array( 'day' => 1 ); |
|
4930 | + if (isset($step['year']) && isset($recur['BYMONTH'])) |
|
4931 | + $step = array('month' => 1); |
|
4932 | + if (empty($step) && isset($recur['BYWEEKNO'])) // ?? |
|
4933 | + $step = array('day' => 7); |
|
4934 | + if (isset($recur['BYYEARDAY']) || isset($recur['BYMONTHDAY']) || isset($recur['BYDAY'])) |
|
4935 | + $step = array('day' => 1); |
|
4936 | 4936 | $intervalarr = array(); |
4937 | - if( 1 < $recur['INTERVAL'] ) { |
|
4938 | - $intervalix = $this->_recurIntervalIx( $recur['FREQ'], $wdate, $wkst ); |
|
4939 | - $intervalarr = array( $intervalix => 0 ); |
|
4937 | + if (1 < $recur['INTERVAL']) { |
|
4938 | + $intervalix = $this->_recurIntervalIx($recur['FREQ'], $wdate, $wkst); |
|
4939 | + $intervalarr = array($intervalix => 0); |
|
4940 | 4940 | } |
4941 | - if( isset( $recur['BYSETPOS'] )) { // save start date + weekno |
|
4941 | + if (isset($recur['BYSETPOS'])) { // save start date + weekno |
|
4942 | 4942 | $bysetposymd1 = $bysetposymd2 = $bysetposw1 = $bysetposw2 = array(); |
4943 | - $bysetposWold = (int) date( 'W', ( $wdatets + $wkst )); |
|
4943 | + $bysetposWold = (int) date('W', ($wdatets + $wkst)); |
|
4944 | 4944 | $bysetposYold = $wdate['year']; |
4945 | 4945 | $bysetposMold = $wdate['month']; |
4946 | 4946 | $bysetposDold = $wdate['day']; |
4947 | - if( is_array( $recur['BYSETPOS'] )) { |
|
4948 | - foreach( $recur['BYSETPOS'] as $bix => $bval ) |
|
4947 | + if (is_array($recur['BYSETPOS'])) { |
|
4948 | + foreach ($recur['BYSETPOS'] as $bix => $bval) |
|
4949 | 4949 | $recur['BYSETPOS'][$bix] = (int) $bval; |
4950 | 4950 | } |
4951 | 4951 | else |
4952 | - $recur['BYSETPOS'] = array( (int) $recur['BYSETPOS'] ); |
|
4953 | - $this->_stepdate( $enddate, $endDatets, $step); // make sure to count whole last period |
|
4952 | + $recur['BYSETPOS'] = array((int) $recur['BYSETPOS']); |
|
4953 | + $this->_stepdate($enddate, $endDatets, $step); // make sure to count whole last period |
|
4954 | 4954 | } |
4955 | - $this->_stepdate( $wdate, $wdatets, $step); |
|
4955 | + $this->_stepdate($wdate, $wdatets, $step); |
|
4956 | 4956 | $year_old = null; |
4957 | - $daynames = array( 'SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA' ); |
|
4957 | + $daynames = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'); |
|
4958 | 4958 | /* MAIN LOOP */ |
4959 | 4959 | // echo "recur start ".implode('-',$wdate)." end ".implode('-',$enddate)."<br />\n";//test |
4960 | - while( TRUE ) { |
|
4961 | - if( isset( $endDatets ) && ( $wdatets > $endDatets )) |
|
4960 | + while (TRUE) { |
|
4961 | + if (isset($endDatets) && ($wdatets > $endDatets)) |
|
4962 | 4962 | break; |
4963 | - if( isset( $recur['COUNT'] ) && ( $countcnt >= $recur['COUNT'] )) |
|
4963 | + if (isset($recur['COUNT']) && ($countcnt >= $recur['COUNT'])) |
|
4964 | 4964 | break; |
4965 | - if( $year_old != $wdate['year'] ) { |
|
4965 | + if ($year_old != $wdate['year']) { |
|
4966 | 4966 | $year_old = $wdate['year']; |
4967 | 4967 | $daycnts = array(); |
4968 | 4968 | $yeardays = $weekno = 0; |
4969 | 4969 | $yeardaycnt = array(); |
4970 | - for( $m = 1; $m <= 12; $m++ ) { // count up and update up-counters |
|
4970 | + for ($m = 1; $m <= 12; $m++) { // count up and update up-counters |
|
4971 | 4971 | $daycnts[$m] = array(); |
4972 | 4972 | $weekdaycnt = array(); |
4973 | - foreach( $daynames as $dn ) |
|
4973 | + foreach ($daynames as $dn) |
|
4974 | 4974 | $yeardaycnt[$dn] = $weekdaycnt[$dn] = 0; |
4975 | - $mcnt = date( 't', mktime( 0, 0, 0, $m, 1, $wdate['year'] )); |
|
4976 | - for( $d = 1; $d <= $mcnt; $d++ ) { |
|
4975 | + $mcnt = date('t', mktime(0, 0, 0, $m, 1, $wdate['year'])); |
|
4976 | + for ($d = 1; $d <= $mcnt; $d++) { |
|
4977 | 4977 | $daycnts[$m][$d] = array(); |
4978 | - if( isset( $recur['BYYEARDAY'] )) { |
|
4978 | + if (isset($recur['BYYEARDAY'])) { |
|
4979 | 4979 | $yeardays++; |
4980 | 4980 | $daycnts[$m][$d]['yearcnt_up'] = $yeardays; |
4981 | 4981 | } |
4982 | - if( isset( $recur['BYDAY'] )) { |
|
4983 | - $day = date( 'w', mktime( 0, 0, 0, $m, $d, $wdate['year'] )); |
|
4982 | + if (isset($recur['BYDAY'])) { |
|
4983 | + $day = date('w', mktime(0, 0, 0, $m, $d, $wdate['year'])); |
|
4984 | 4984 | $day = $daynames[$day]; |
4985 | 4985 | $daycnts[$m][$d]['DAY'] = $day; |
4986 | 4986 | $weekdaycnt[$day]++; |
@@ -4988,64 +4988,64 @@ discard block |
||
4988 | 4988 | $yeardaycnt[$day]++; |
4989 | 4989 | $daycnts[$m][$d]['yeardayno_up'] = $yeardaycnt[$day]; |
4990 | 4990 | } |
4991 | - if( isset( $recur['BYWEEKNO'] ) || ( $recur['FREQ'] == 'WEEKLY' )) |
|
4992 | - $daycnts[$m][$d]['weekno_up'] =(int)date('W',mktime(0,0,$wkst,$m,$d,$wdate['year'])); |
|
4991 | + if (isset($recur['BYWEEKNO']) || ($recur['FREQ'] == 'WEEKLY')) |
|
4992 | + $daycnts[$m][$d]['weekno_up'] = (int) date('W', mktime(0, 0, $wkst, $m, $d, $wdate['year'])); |
|
4993 | 4993 | } |
4994 | 4994 | } |
4995 | 4995 | $daycnt = 0; |
4996 | 4996 | $yeardaycnt = array(); |
4997 | - if( isset( $recur['BYWEEKNO'] ) || ( $recur['FREQ'] == 'WEEKLY' )) { |
|
4997 | + if (isset($recur['BYWEEKNO']) || ($recur['FREQ'] == 'WEEKLY')) { |
|
4998 | 4998 | $weekno = null; |
4999 | - for( $d=31; $d > 25; $d-- ) { // get last weekno for year |
|
5000 | - if( !$weekno ) |
|
4999 | + for ($d = 31; $d > 25; $d--) { // get last weekno for year |
|
5000 | + if (!$weekno) |
|
5001 | 5001 | $weekno = $daycnts[12][$d]['weekno_up']; |
5002 | - elseif( $weekno < $daycnts[12][$d]['weekno_up'] ) { |
|
5002 | + elseif ($weekno < $daycnts[12][$d]['weekno_up']) { |
|
5003 | 5003 | $weekno = $daycnts[12][$d]['weekno_up']; |
5004 | 5004 | break; |
5005 | 5005 | } |
5006 | 5006 | } |
5007 | 5007 | } |
5008 | - for( $m = 12; $m > 0; $m-- ) { // count down and update down-counters |
|
5008 | + for ($m = 12; $m > 0; $m--) { // count down and update down-counters |
|
5009 | 5009 | $weekdaycnt = array(); |
5010 | - foreach( $daynames as $dn ) |
|
5010 | + foreach ($daynames as $dn) |
|
5011 | 5011 | $yeardaycnt[$dn] = $weekdaycnt[$dn] = 0; |
5012 | 5012 | $monthcnt = 0; |
5013 | - $mcnt = date( 't', mktime( 0, 0, 0, $m, 1, $wdate['year'] )); |
|
5014 | - for( $d = $mcnt; $d > 0; $d-- ) { |
|
5015 | - if( isset( $recur['BYYEARDAY'] )) { |
|
5013 | + $mcnt = date('t', mktime(0, 0, 0, $m, 1, $wdate['year'])); |
|
5014 | + for ($d = $mcnt; $d > 0; $d--) { |
|
5015 | + if (isset($recur['BYYEARDAY'])) { |
|
5016 | 5016 | $daycnt -= 1; |
5017 | 5017 | $daycnts[$m][$d]['yearcnt_down'] = $daycnt; |
5018 | 5018 | } |
5019 | - if( isset( $recur['BYMONTHDAY'] )) { |
|
5019 | + if (isset($recur['BYMONTHDAY'])) { |
|
5020 | 5020 | $monthcnt -= 1; |
5021 | 5021 | $daycnts[$m][$d]['monthcnt_down'] = $monthcnt; |
5022 | 5022 | } |
5023 | - if( isset( $recur['BYDAY'] )) { |
|
5024 | - $day = $daycnts[$m][$d]['DAY']; |
|
5023 | + if (isset($recur['BYDAY'])) { |
|
5024 | + $day = $daycnts[$m][$d]['DAY']; |
|
5025 | 5025 | $weekdaycnt[$day] -= 1; |
5026 | 5026 | $daycnts[$m][$d]['monthdayno_down'] = $weekdaycnt[$day]; |
5027 | 5027 | $yeardaycnt[$day] -= 1; |
5028 | 5028 | $daycnts[$m][$d]['yeardayno_down'] = $yeardaycnt[$day]; |
5029 | 5029 | } |
5030 | - if( isset( $recur['BYWEEKNO'] ) || ( $recur['FREQ'] == 'WEEKLY' )) |
|
5030 | + if (isset($recur['BYWEEKNO']) || ($recur['FREQ'] == 'WEEKLY')) |
|
5031 | 5031 | $daycnts[$m][$d]['weekno_down'] = ($daycnts[$m][$d]['weekno_up'] - $weekno - 1); |
5032 | 5032 | } |
5033 | 5033 | } |
5034 | 5034 | } |
5035 | 5035 | /* check interval */ |
5036 | - if( 1 < $recur['INTERVAL'] ) { |
|
5036 | + if (1 < $recur['INTERVAL']) { |
|
5037 | 5037 | /* create interval index */ |
5038 | - $intervalix = $this->_recurIntervalIx( $recur['FREQ'], $wdate, $wkst ); |
|
5038 | + $intervalix = $this->_recurIntervalIx($recur['FREQ'], $wdate, $wkst); |
|
5039 | 5039 | /* check interval */ |
5040 | - $currentKey = array_keys( $intervalarr ); |
|
5041 | - $currentKey = end( $currentKey ); // get last index |
|
5042 | - if( $currentKey != $intervalix ) |
|
5043 | - $intervalarr = array( $intervalix => ( $intervalarr[$currentKey] + 1 )); |
|
5044 | - if(( $recur['INTERVAL'] != $intervalarr[$intervalix] ) && |
|
5045 | - ( 0 != $intervalarr[$intervalix] )) { |
|
5040 | + $currentKey = array_keys($intervalarr); |
|
5041 | + $currentKey = end($currentKey); // get last index |
|
5042 | + if ($currentKey != $intervalix) |
|
5043 | + $intervalarr = array($intervalix => ($intervalarr[$currentKey] + 1)); |
|
5044 | + if (($recur['INTERVAL'] != $intervalarr[$intervalix]) && |
|
5045 | + (0 != $intervalarr[$intervalix])) { |
|
5046 | 5046 | /* step up date */ |
5047 | 5047 | //echo "skip: ".implode('-',$wdate)." ix=$intervalix old=$currentKey interval=".$intervalarr[$intervalix]."<br />\n";//test |
5048 | - $this->_stepdate( $wdate, $wdatets, $step); |
|
5048 | + $this->_stepdate($wdate, $wdatets, $step); |
|
5049 | 5049 | continue; |
5050 | 5050 | } |
5051 | 5051 | else // continue within the selected interval |
@@ -5053,69 +5053,69 @@ discard block |
||
5053 | 5053 | //echo "cont: ".implode('-',$wdate)." ix=$intervalix old=$currentKey interval=".$intervalarr[$intervalix]."<br />\n";//test |
5054 | 5054 | } |
5055 | 5055 | $updateOK = TRUE; |
5056 | - if( $updateOK && isset( $recur['BYMONTH'] )) |
|
5057 | - $updateOK = $this->_recurBYcntcheck( $recur['BYMONTH'] |
|
5056 | + if ($updateOK && isset($recur['BYMONTH'])) |
|
5057 | + $updateOK = $this->_recurBYcntcheck($recur['BYMONTH'] |
|
5058 | 5058 | , $wdate['month'] |
5059 | 5059 | ,($wdate['month'] - 13)); |
5060 | - if( $updateOK && isset( $recur['BYWEEKNO'] )) |
|
5061 | - $updateOK = $this->_recurBYcntcheck( $recur['BYWEEKNO'] |
|
5060 | + if ($updateOK && isset($recur['BYWEEKNO'])) |
|
5061 | + $updateOK = $this->_recurBYcntcheck($recur['BYWEEKNO'] |
|
5062 | 5062 | , $daycnts[$wdate['month']][$wdate['day']]['weekno_up'] |
5063 | - , $daycnts[$wdate['month']][$wdate['day']]['weekno_down'] ); |
|
5064 | - if( $updateOK && isset( $recur['BYYEARDAY'] )) |
|
5065 | - $updateOK = $this->_recurBYcntcheck( $recur['BYYEARDAY'] |
|
5063 | + , $daycnts[$wdate['month']][$wdate['day']]['weekno_down']); |
|
5064 | + if ($updateOK && isset($recur['BYYEARDAY'])) |
|
5065 | + $updateOK = $this->_recurBYcntcheck($recur['BYYEARDAY'] |
|
5066 | 5066 | , $daycnts[$wdate['month']][$wdate['day']]['yearcnt_up'] |
5067 | - , $daycnts[$wdate['month']][$wdate['day']]['yearcnt_down'] ); |
|
5068 | - if( $updateOK && isset( $recur['BYMONTHDAY'] )) |
|
5069 | - $updateOK = $this->_recurBYcntcheck( $recur['BYMONTHDAY'] |
|
5067 | + , $daycnts[$wdate['month']][$wdate['day']]['yearcnt_down']); |
|
5068 | + if ($updateOK && isset($recur['BYMONTHDAY'])) |
|
5069 | + $updateOK = $this->_recurBYcntcheck($recur['BYMONTHDAY'] |
|
5070 | 5070 | , $wdate['day'] |
5071 | - , $daycnts[$wdate['month']][$wdate['day']]['monthcnt_down'] ); |
|
5071 | + , $daycnts[$wdate['month']][$wdate['day']]['monthcnt_down']); |
|
5072 | 5072 | //echo "efter BYMONTHDAY: ".implode('-',$wdate).' status: '; echo ($updateOK) ? 'TRUE' : 'FALSE'; echo "<br />\n";//test### |
5073 | - if( $updateOK && isset( $recur['BYDAY'] )) { |
|
5073 | + if ($updateOK && isset($recur['BYDAY'])) { |
|
5074 | 5074 | $updateOK = FALSE; |
5075 | 5075 | $m = $wdate['month']; |
5076 | 5076 | $d = $wdate['day']; |
5077 | - if( isset( $recur['BYDAY']['DAY'] )) { // single day, opt with year/month day order no |
|
5078 | - $daynoexists = $daynosw = $daynamesw = FALSE; |
|
5079 | - if( $recur['BYDAY']['DAY'] == $daycnts[$m][$d]['DAY'] ) |
|
5077 | + if (isset($recur['BYDAY']['DAY'])) { // single day, opt with year/month day order no |
|
5078 | + $daynoexists = $daynosw = $daynamesw = FALSE; |
|
5079 | + if ($recur['BYDAY']['DAY'] == $daycnts[$m][$d]['DAY']) |
|
5080 | 5080 | $daynamesw = TRUE; |
5081 | - if( isset( $recur['BYDAY'][0] )) { |
|
5081 | + if (isset($recur['BYDAY'][0])) { |
|
5082 | 5082 | $daynoexists = TRUE; |
5083 | - if(( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'MONTHLY' )) || isset( $recur['BYMONTH'] )) |
|
5084 | - $daynosw = $this->_recurBYcntcheck( $recur['BYDAY'][0] |
|
5083 | + if ((isset($recur['FREQ']) && ($recur['FREQ'] == 'MONTHLY')) || isset($recur['BYMONTH'])) |
|
5084 | + $daynosw = $this->_recurBYcntcheck($recur['BYDAY'][0] |
|
5085 | 5085 | , $daycnts[$m][$d]['monthdayno_up'] |
5086 | - , $daycnts[$m][$d]['monthdayno_down'] ); |
|
5087 | - elseif( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'YEARLY' )) |
|
5088 | - $daynosw = $this->_recurBYcntcheck( $recur['BYDAY'][0] |
|
5086 | + , $daycnts[$m][$d]['monthdayno_down']); |
|
5087 | + elseif (isset($recur['FREQ']) && ($recur['FREQ'] == 'YEARLY')) |
|
5088 | + $daynosw = $this->_recurBYcntcheck($recur['BYDAY'][0] |
|
5089 | 5089 | , $daycnts[$m][$d]['yeardayno_up'] |
5090 | - , $daycnts[$m][$d]['yeardayno_down'] ); |
|
5090 | + , $daycnts[$m][$d]['yeardayno_down']); |
|
5091 | 5091 | } |
5092 | - if(( $daynoexists && $daynosw && $daynamesw ) || |
|
5093 | - ( !$daynoexists && !$daynosw && $daynamesw )) { |
|
5092 | + if (($daynoexists && $daynosw && $daynamesw) || |
|
5093 | + (!$daynoexists && !$daynosw && $daynamesw)) { |
|
5094 | 5094 | $updateOK = TRUE; |
5095 | 5095 | } |
5096 | 5096 | //echo "daynoexists:$daynoexists daynosw:$daynosw daynamesw:$daynamesw<br />\n"; // test ### |
5097 | 5097 | } |
5098 | 5098 | else { |
5099 | - foreach( $recur['BYDAY'] as $bydayvalue ) { |
|
5099 | + foreach ($recur['BYDAY'] as $bydayvalue) { |
|
5100 | 5100 | $daynoexists = $daynosw = $daynamesw = FALSE; |
5101 | - if( isset( $bydayvalue['DAY'] ) && |
|
5102 | - ( $bydayvalue['DAY'] == $daycnts[$m][$d]['DAY'] )) |
|
5101 | + if (isset($bydayvalue['DAY']) && |
|
5102 | + ($bydayvalue['DAY'] == $daycnts[$m][$d]['DAY'])) |
|
5103 | 5103 | $daynamesw = TRUE; |
5104 | - if( isset( $bydayvalue[0] )) { |
|
5104 | + if (isset($bydayvalue[0])) { |
|
5105 | 5105 | $daynoexists = TRUE; |
5106 | - if(( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'MONTHLY' )) || |
|
5107 | - isset( $recur['BYMONTH'] )) |
|
5108 | - $daynosw = $this->_recurBYcntcheck( $bydayvalue['0'] |
|
5106 | + if ((isset($recur['FREQ']) && ($recur['FREQ'] == 'MONTHLY')) || |
|
5107 | + isset($recur['BYMONTH'])) |
|
5108 | + $daynosw = $this->_recurBYcntcheck($bydayvalue['0'] |
|
5109 | 5109 | , $daycnts[$m][$d]['monthdayno_up'] |
5110 | - , $daycnts[$m][$d]['monthdayno_down'] ); |
|
5111 | - elseif( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'YEARLY' )) |
|
5112 | - $daynosw = $this->_recurBYcntcheck( $bydayvalue['0'] |
|
5110 | + , $daycnts[$m][$d]['monthdayno_down']); |
|
5111 | + elseif (isset($recur['FREQ']) && ($recur['FREQ'] == 'YEARLY')) |
|
5112 | + $daynosw = $this->_recurBYcntcheck($bydayvalue['0'] |
|
5113 | 5113 | , $daycnts[$m][$d]['yeardayno_up'] |
5114 | - , $daycnts[$m][$d]['yeardayno_down'] ); |
|
5114 | + , $daycnts[$m][$d]['yeardayno_down']); |
|
5115 | 5115 | } |
5116 | 5116 | //echo "daynoexists:$daynoexists daynosw:$daynosw daynamesw:$daynamesw<br />\n"; // test ### |
5117 | - if(( $daynoexists && $daynosw && $daynamesw ) || |
|
5118 | - ( !$daynoexists && !$daynosw && $daynamesw )) { |
|
5117 | + if (($daynoexists && $daynosw && $daynamesw) || |
|
5118 | + (!$daynoexists && !$daynosw && $daynamesw)) { |
|
5119 | 5119 | $updateOK = TRUE; |
5120 | 5120 | break; |
5121 | 5121 | } |
@@ -5124,25 +5124,25 @@ discard block |
||
5124 | 5124 | } |
5125 | 5125 | //echo "efter BYDAY: ".implode('-',$wdate).' status: '; echo ($updateOK) ? 'TRUE' : 'FALSE'; echo "<br />\n"; // test ### |
5126 | 5126 | /* check BYSETPOS */ |
5127 | - if( $updateOK ) { |
|
5128 | - if( isset( $recur['BYSETPOS'] ) && |
|
5129 | - ( in_array( $recur['FREQ'], array( 'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY' )))) { |
|
5130 | - if( isset( $recur['WEEKLY'] )) { |
|
5131 | - if( $bysetposWold == $daycnts[$wdate['month']][$wdate['day']]['weekno_up'] ) |
|
5127 | + if ($updateOK) { |
|
5128 | + if (isset($recur['BYSETPOS']) && |
|
5129 | + (in_array($recur['FREQ'], array('YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY')))) { |
|
5130 | + if (isset($recur['WEEKLY'])) { |
|
5131 | + if ($bysetposWold == $daycnts[$wdate['month']][$wdate['day']]['weekno_up']) |
|
5132 | 5132 | $bysetposw1[] = $wdatets; |
5133 | 5133 | else |
5134 | 5134 | $bysetposw2[] = $wdatets; |
5135 | 5135 | } |
5136 | 5136 | else { |
5137 | - if(( isset( $recur['FREQ'] ) && ( 'YEARLY' == $recur['FREQ'] ) && |
|
5138 | - ( $bysetposYold == $wdate['year'] )) || |
|
5139 | - ( isset( $recur['FREQ'] ) && ( 'MONTHLY' == $recur['FREQ'] ) && |
|
5140 | - (( $bysetposYold == $wdate['year'] ) && |
|
5141 | - ( $bysetposMold == $wdate['month'] ))) || |
|
5142 | - ( isset( $recur['FREQ'] ) && ( 'MONTHLY' == $recur['FREQ'] ) && |
|
5143 | - (( $bysetposYold == $wdate['year'] ) && |
|
5144 | - ( $bysetposMold == $wdate['month']) && |
|
5145 | - ( $bysetposDold == $wdate['sday'] )))) |
|
5137 | + if ((isset($recur['FREQ']) && ('YEARLY' == $recur['FREQ']) && |
|
5138 | + ($bysetposYold == $wdate['year'])) || |
|
5139 | + (isset($recur['FREQ']) && ('MONTHLY' == $recur['FREQ']) && |
|
5140 | + (($bysetposYold == $wdate['year']) && |
|
5141 | + ($bysetposMold == $wdate['month']))) || |
|
5142 | + (isset($recur['FREQ']) && ('MONTHLY' == $recur['FREQ']) && |
|
5143 | + (($bysetposYold == $wdate['year']) && |
|
5144 | + ($bysetposMold == $wdate['month']) && |
|
5145 | + ($bysetposDold == $wdate['sday'])))) |
|
5146 | 5146 | $bysetposymd1[] = $wdatets; |
5147 | 5147 | else |
5148 | 5148 | $bysetposymd2[] = $wdatets; |
@@ -5151,7 +5151,7 @@ discard block |
||
5151 | 5151 | else { |
5152 | 5152 | /* update result array if BYSETPOS is set */ |
5153 | 5153 | $countcnt++; |
5154 | - if( $startdatets <= $wdatets ) { // only output within period |
|
5154 | + if ($startdatets <= $wdatets) { // only output within period |
|
5155 | 5155 | $result[$wdatets] = TRUE; |
5156 | 5156 | //echo "recur ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$wdatets),6))."<br />\n";//test |
5157 | 5157 | } |
@@ -5160,39 +5160,39 @@ discard block |
||
5160 | 5160 | } |
5161 | 5161 | } |
5162 | 5162 | /* step up date */ |
5163 | - $this->_stepdate( $wdate, $wdatets, $step); |
|
5163 | + $this->_stepdate($wdate, $wdatets, $step); |
|
5164 | 5164 | /* check if BYSETPOS is set for updating result array */ |
5165 | - if( $updateOK && isset( $recur['BYSETPOS'] )) { |
|
5166 | - $bysetpos = FALSE; |
|
5167 | - if( isset( $recur['FREQ'] ) && ( 'YEARLY' == $recur['FREQ'] ) && |
|
5168 | - ( $bysetposYold != $wdate['year'] )) { |
|
5165 | + if ($updateOK && isset($recur['BYSETPOS'])) { |
|
5166 | + $bysetpos = FALSE; |
|
5167 | + if (isset($recur['FREQ']) && ('YEARLY' == $recur['FREQ']) && |
|
5168 | + ($bysetposYold != $wdate['year'])) { |
|
5169 | 5169 | $bysetpos = TRUE; |
5170 | 5170 | $bysetposYold = $wdate['year']; |
5171 | 5171 | } |
5172 | - elseif( isset( $recur['FREQ'] ) && ( 'MONTHLY' == $recur['FREQ'] && |
|
5173 | - (( $bysetposYold != $wdate['year'] ) || ( $bysetposMold != $wdate['month'] )))) { |
|
5172 | + elseif (isset($recur['FREQ']) && ('MONTHLY' == $recur['FREQ'] && |
|
5173 | + (($bysetposYold != $wdate['year']) || ($bysetposMold != $wdate['month'])))) { |
|
5174 | 5174 | $bysetpos = TRUE; |
5175 | 5175 | $bysetposYold = $wdate['year']; |
5176 | 5176 | $bysetposMold = $wdate['month']; |
5177 | 5177 | } |
5178 | - elseif( isset( $recur['FREQ'] ) && ( 'WEEKLY' == $recur['FREQ'] )) { |
|
5179 | - $weekno = (int) date( 'W', mktime( 0, 0, $wkst, $wdate['month'], $wdate['day'], $wdate['year'])); |
|
5180 | - if( $bysetposWold != $weekno ) { |
|
5178 | + elseif (isset($recur['FREQ']) && ('WEEKLY' == $recur['FREQ'])) { |
|
5179 | + $weekno = (int) date('W', mktime(0, 0, $wkst, $wdate['month'], $wdate['day'], $wdate['year'])); |
|
5180 | + if ($bysetposWold != $weekno) { |
|
5181 | 5181 | $bysetposWold = $weekno; |
5182 | 5182 | $bysetpos = TRUE; |
5183 | 5183 | } |
5184 | 5184 | } |
5185 | - elseif( isset( $recur['FREQ'] ) && ( 'DAILY' == $recur['FREQ'] ) && |
|
5186 | - (( $bysetposYold != $wdate['year'] ) || |
|
5187 | - ( $bysetposMold != $wdate['month'] ) || |
|
5188 | - ( $bysetposDold != $wdate['sday'] ))) { |
|
5185 | + elseif (isset($recur['FREQ']) && ('DAILY' == $recur['FREQ']) && |
|
5186 | + (($bysetposYold != $wdate['year']) || |
|
5187 | + ($bysetposMold != $wdate['month']) || |
|
5188 | + ($bysetposDold != $wdate['sday']))) { |
|
5189 | 5189 | $bysetpos = TRUE; |
5190 | 5190 | $bysetposYold = $wdate['year']; |
5191 | 5191 | $bysetposMold = $wdate['month']; |
5192 | 5192 | $bysetposDold = $wdate['day']; |
5193 | 5193 | } |
5194 | - if( $bysetpos ) { |
|
5195 | - if( isset( $recur['BYWEEKNO'] )) { |
|
5194 | + if ($bysetpos) { |
|
5195 | + if (isset($recur['BYWEEKNO'])) { |
|
5196 | 5196 | $bysetposarr1 = & $bysetposw1; |
5197 | 5197 | $bysetposarr2 = & $bysetposw2; |
5198 | 5198 | } |
@@ -5200,18 +5200,18 @@ discard block |
||
5200 | 5200 | $bysetposarr1 = & $bysetposymd1; |
5201 | 5201 | $bysetposarr2 = & $bysetposymd2; |
5202 | 5202 | } |
5203 | - foreach( $recur['BYSETPOS'] as $ix ) { |
|
5204 | - if( 0 > $ix ) // both positive and negative BYSETPOS allowed |
|
5205 | - $ix = ( count( $bysetposarr1 ) + $ix + 1); |
|
5203 | + foreach ($recur['BYSETPOS'] as $ix) { |
|
5204 | + if (0 > $ix) // both positive and negative BYSETPOS allowed |
|
5205 | + $ix = (count($bysetposarr1) + $ix + 1); |
|
5206 | 5206 | $ix--; |
5207 | - if( isset( $bysetposarr1[$ix] )) { |
|
5208 | - if( $startdatets <= $bysetposarr1[$ix] ) { // only output within period |
|
5207 | + if (isset($bysetposarr1[$ix])) { |
|
5208 | + if ($startdatets <= $bysetposarr1[$ix]) { // only output within period |
|
5209 | 5209 | $result[$bysetposarr1[$ix]] = TRUE; |
5210 | 5210 | //echo "recur ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$bysetposarr1[$ix]),6))."<br />\n";//test |
5211 | 5211 | } |
5212 | 5212 | $countcnt++; |
5213 | 5213 | } |
5214 | - if( isset( $recur['COUNT'] ) && ( $countcnt >= $recur['COUNT'] )) |
|
5214 | + if (isset($recur['COUNT']) && ($countcnt >= $recur['COUNT'])) |
|
5215 | 5215 | break; |
5216 | 5216 | } |
5217 | 5217 | $bysetposarr1 = $bysetposarr2; |
@@ -5220,18 +5220,18 @@ discard block |
||
5220 | 5220 | } |
5221 | 5221 | } |
5222 | 5222 | } |
5223 | - function _recurBYcntcheck( $BYvalue, $upValue, $downValue ) { |
|
5224 | - if( is_array( $BYvalue ) && |
|
5225 | - ( in_array( $upValue, $BYvalue ) || in_array( $downValue, $BYvalue ))) |
|
5223 | + function _recurBYcntcheck($BYvalue, $upValue, $downValue) { |
|
5224 | + if (is_array($BYvalue) && |
|
5225 | + (in_array($upValue, $BYvalue) || in_array($downValue, $BYvalue))) |
|
5226 | 5226 | return TRUE; |
5227 | - elseif(( $BYvalue == $upValue ) || ( $BYvalue == $downValue )) |
|
5227 | + elseif (($BYvalue == $upValue) || ($BYvalue == $downValue)) |
|
5228 | 5228 | return TRUE; |
5229 | 5229 | else |
5230 | 5230 | return FALSE; |
5231 | 5231 | } |
5232 | - function _recurIntervalIx( $freq, $date, $wkst ) { |
|
5232 | + function _recurIntervalIx($freq, $date, $wkst) { |
|
5233 | 5233 | /* create interval index */ |
5234 | - switch( $freq ) { |
|
5234 | + switch ($freq) { |
|
5235 | 5235 | case 'YEARLY': |
5236 | 5236 | $intervalix = $date['year']; |
5237 | 5237 | break; |
@@ -5239,8 +5239,8 @@ discard block |
||
5239 | 5239 | $intervalix = $date['year'].'-'.$date['month']; |
5240 | 5240 | break; |
5241 | 5241 | case 'WEEKLY': |
5242 | - $wdatets = $this->_date2timestamp( $date ); |
|
5243 | - $intervalix = (int) date( 'W', ( $wdatets + $wkst )); |
|
5242 | + $wdatets = $this->_date2timestamp($date); |
|
5243 | + $intervalix = (int) date('W', ($wdatets + $wkst)); |
|
5244 | 5244 | break; |
5245 | 5245 | case 'DAILY': |
5246 | 5246 | default: |
@@ -5257,22 +5257,22 @@ discard block |
||
5257 | 5257 | * @param array $rexrule |
5258 | 5258 | * @return array |
5259 | 5259 | */ |
5260 | - function _setRexrule( $rexrule ) { |
|
5261 | - $input = array(); |
|
5262 | - if( empty( $rexrule )) |
|
5260 | + function _setRexrule($rexrule) { |
|
5261 | + $input = array(); |
|
5262 | + if (empty($rexrule)) |
|
5263 | 5263 | return $input; |
5264 | - foreach( $rexrule as $rexrulelabel => $rexrulevalue ) { |
|
5265 | - $rexrulelabel = strtoupper( $rexrulelabel ); |
|
5266 | - if( 'UNTIL' != $rexrulelabel ) |
|
5267 | - $input[$rexrulelabel] = $rexrulevalue; |
|
5264 | + foreach ($rexrule as $rexrulelabel => $rexrulevalue) { |
|
5265 | + $rexrulelabel = strtoupper($rexrulelabel); |
|
5266 | + if ('UNTIL' != $rexrulelabel) |
|
5267 | + $input[$rexrulelabel] = $rexrulevalue; |
|
5268 | 5268 | else { |
5269 | - if( $this->_isArrayTimestampDate( $rexrulevalue )) // timestamp date |
|
5270 | - $input[$rexrulelabel] = $this->_timestamp2date( $rexrulevalue, 6 ); |
|
5271 | - elseif( $this->_isArrayDate( $rexrulevalue )) // date-time |
|
5272 | - $input[$rexrulelabel] = $this->_date_time_array( $rexrulevalue, 6 ); |
|
5273 | - elseif( 8 <= strlen( trim( $rexrulevalue ))) // ex. 2006-08-03 10:12:18 |
|
5274 | - $input[$rexrulelabel] = $this->_date_time_string( $rexrulevalue ); |
|
5275 | - if(( 3 < count( $input[$rexrulelabel] )) && !isset( $input[$rexrulelabel]['tz'] )) |
|
5269 | + if ($this->_isArrayTimestampDate($rexrulevalue)) // timestamp date |
|
5270 | + $input[$rexrulelabel] = $this->_timestamp2date($rexrulevalue, 6); |
|
5271 | + elseif ($this->_isArrayDate($rexrulevalue)) // date-time |
|
5272 | + $input[$rexrulelabel] = $this->_date_time_array($rexrulevalue, 6); |
|
5273 | + elseif (8 <= strlen(trim($rexrulevalue))) // ex. 2006-08-03 10:12:18 |
|
5274 | + $input[$rexrulelabel] = $this->_date_time_string($rexrulevalue); |
|
5275 | + if ((3 < count($input[$rexrulelabel])) && !isset($input[$rexrulelabel]['tz'])) |
|
5276 | 5276 | $input[$rexrulelabel]['tz'] = 'Z'; |
5277 | 5277 | } |
5278 | 5278 | } |
@@ -5293,85 +5293,85 @@ discard block |
||
5293 | 5293 | * @param string $caller optional |
5294 | 5294 | * @return array |
5295 | 5295 | */ |
5296 | - function _setDate( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE, $caller=null ) { |
|
5296 | + function _setDate($year, $month = FALSE, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $tz = FALSE, $params = FALSE, $caller = null) { |
|
5297 | 5297 | $input = $parno = null; |
5298 | - $localtime = (( 'dtstart' == $caller ) && in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' ))) ? TRUE : FALSE; |
|
5299 | - if( $this->_isArrayDate( $year )) { |
|
5300 | - if( $localtime ) unset ( $month['VALUE'], $month['TZID'] ); |
|
5301 | - $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' )); |
|
5302 | - if( isset( $input['params']['TZID'] )) { |
|
5298 | + $localtime = (('dtstart' == $caller) && in_array($this->objName, array('vtimezone', 'standard', 'daylight'))) ? TRUE : FALSE; |
|
5299 | + if ($this->_isArrayDate($year)) { |
|
5300 | + if ($localtime) unset ($month['VALUE'], $month['TZID']); |
|
5301 | + $input['params'] = $this->_setParams($month, array('VALUE' => 'DATE-TIME')); |
|
5302 | + if (isset($input['params']['TZID'])) { |
|
5303 | 5303 | $input['params']['VALUE'] = 'DATE-TIME'; |
5304 | - unset( $year['tz'] ); |
|
5304 | + unset($year['tz']); |
|
5305 | 5305 | } |
5306 | - $hitval = (( !empty( $year['tz'] ) || !empty( $year[6] ))) ? 7 : 6; |
|
5307 | - $parno = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval ); |
|
5308 | - $parno = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3, count( $year ), $parno ); |
|
5309 | - $input['value'] = $this->_date_time_array( $year, $parno ); |
|
5310 | - } |
|
5311 | - elseif( $this->_isArrayTimestampDate( $year )) { |
|
5312 | - if( $localtime ) unset ( $month['VALUE'], $month['TZID'] ); |
|
5313 | - $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' )); |
|
5314 | - if( isset( $input['params']['TZID'] )) { |
|
5306 | + $hitval = ((!empty($year['tz']) || !empty($year[6]))) ? 7 : 6; |
|
5307 | + $parno = $this->_existRem($input['params'], 'VALUE', 'DATE-TIME', $hitval); |
|
5308 | + $parno = $this->_existRem($input['params'], 'VALUE', 'DATE', 3, count($year), $parno); |
|
5309 | + $input['value'] = $this->_date_time_array($year, $parno); |
|
5310 | + } |
|
5311 | + elseif ($this->_isArrayTimestampDate($year)) { |
|
5312 | + if ($localtime) unset ($month['VALUE'], $month['TZID']); |
|
5313 | + $input['params'] = $this->_setParams($month, array('VALUE' => 'DATE-TIME')); |
|
5314 | + if (isset($input['params']['TZID'])) { |
|
5315 | 5315 | $input['params']['VALUE'] = 'DATE-TIME'; |
5316 | - unset( $year['tz'] ); |
|
5316 | + unset($year['tz']); |
|
5317 | 5317 | } |
5318 | - $parno = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3 ); |
|
5319 | - $hitval = ( isset( $year['tz'] )) ? 7 : 6; |
|
5320 | - $parno = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval, $parno ); |
|
5321 | - $input['value'] = $this->_timestamp2date( $year, $parno ); |
|
5322 | - } |
|
5323 | - elseif( 8 <= strlen( trim( $year ))) { // ex. 2006-08-03 10:12:18 |
|
5324 | - if( $localtime ) unset ( $month['VALUE'], $month['TZID'] ); |
|
5325 | - $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' )); |
|
5326 | - if( isset( $input['params']['TZID'] )) { |
|
5318 | + $parno = $this->_existRem($input['params'], 'VALUE', 'DATE', 3); |
|
5319 | + $hitval = (isset($year['tz'])) ? 7 : 6; |
|
5320 | + $parno = $this->_existRem($input['params'], 'VALUE', 'DATE-TIME', $hitval, $parno); |
|
5321 | + $input['value'] = $this->_timestamp2date($year, $parno); |
|
5322 | + } |
|
5323 | + elseif (8 <= strlen(trim($year))) { // ex. 2006-08-03 10:12:18 |
|
5324 | + if ($localtime) unset ($month['VALUE'], $month['TZID']); |
|
5325 | + $input['params'] = $this->_setParams($month, array('VALUE' => 'DATE-TIME')); |
|
5326 | + if (isset($input['params']['TZID'])) { |
|
5327 | 5327 | $input['params']['VALUE'] = 'DATE-TIME'; |
5328 | 5328 | $parno = 6; |
5329 | 5329 | } |
5330 | - $parno = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', 7, $parno ); |
|
5331 | - $parno = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3, $parno, $parno ); |
|
5332 | - $input['value'] = $this->_date_time_string( $year, $parno ); |
|
5330 | + $parno = $this->_existRem($input['params'], 'VALUE', 'DATE-TIME', 7, $parno); |
|
5331 | + $parno = $this->_existRem($input['params'], 'VALUE', 'DATE', 3, $parno, $parno); |
|
5332 | + $input['value'] = $this->_date_time_string($year, $parno); |
|
5333 | 5333 | } |
5334 | 5334 | else { |
5335 | - if( is_array( $params )) { |
|
5336 | - if( $localtime ) unset ( $params['VALUE'], $params['TZID'] ); |
|
5337 | - $input['params'] = $this->_setParams( $params, array( 'VALUE' => 'DATE-TIME' )); |
|
5335 | + if (is_array($params)) { |
|
5336 | + if ($localtime) unset ($params['VALUE'], $params['TZID']); |
|
5337 | + $input['params'] = $this->_setParams($params, array('VALUE' => 'DATE-TIME')); |
|
5338 | 5338 | } |
5339 | - elseif( is_array( $tz )) { |
|
5340 | - $input['params'] = $this->_setParams( $tz, array( 'VALUE' => 'DATE-TIME' )); |
|
5339 | + elseif (is_array($tz)) { |
|
5340 | + $input['params'] = $this->_setParams($tz, array('VALUE' => 'DATE-TIME')); |
|
5341 | 5341 | $tz = FALSE; |
5342 | 5342 | } |
5343 | - elseif( is_array( $hour )) { |
|
5344 | - $input['params'] = $this->_setParams( $hour, array( 'VALUE' => 'DATE-TIME' )); |
|
5343 | + elseif (is_array($hour)) { |
|
5344 | + $input['params'] = $this->_setParams($hour, array('VALUE' => 'DATE-TIME')); |
|
5345 | 5345 | $hour = $min = $sec = $tz = FALSE; |
5346 | 5346 | } |
5347 | - if( isset( $input['params']['TZID'] )) { |
|
5348 | - $tz = null; |
|
5347 | + if (isset($input['params']['TZID'])) { |
|
5348 | + $tz = null; |
|
5349 | 5349 | $input['params']['VALUE'] = 'DATE-TIME'; |
5350 | 5350 | } |
5351 | - $parno = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3 ); |
|
5352 | - $hitval = ( !empty( $tz )) ? 7 : 6; |
|
5353 | - $parno = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval, $parno, $parno ); |
|
5354 | - $input['value'] = array( 'year' => $year, 'month' => $month, 'day' => $day ); |
|
5355 | - if( 3 != $parno ) { |
|
5356 | - $input['value']['hour'] = ( $hour ) ? $hour : '0'; |
|
5357 | - $input['value']['min'] = ( $min ) ? $min : '0'; |
|
5358 | - $input['value']['sec'] = ( $sec ) ? $sec : '0'; |
|
5359 | - if( !empty( $tz )) |
|
5351 | + $parno = $this->_existRem($input['params'], 'VALUE', 'DATE', 3); |
|
5352 | + $hitval = (!empty($tz)) ? 7 : 6; |
|
5353 | + $parno = $this->_existRem($input['params'], 'VALUE', 'DATE-TIME', $hitval, $parno, $parno); |
|
5354 | + $input['value'] = array('year' => $year, 'month' => $month, 'day' => $day); |
|
5355 | + if (3 != $parno) { |
|
5356 | + $input['value']['hour'] = ($hour) ? $hour : '0'; |
|
5357 | + $input['value']['min'] = ($min) ? $min : '0'; |
|
5358 | + $input['value']['sec'] = ($sec) ? $sec : '0'; |
|
5359 | + if (!empty($tz)) |
|
5360 | 5360 | $input['value']['tz'] = $tz; |
5361 | 5361 | } |
5362 | 5362 | } |
5363 | - if( 3 == $parno ) { |
|
5363 | + if (3 == $parno) { |
|
5364 | 5364 | $input['params']['VALUE'] = 'DATE'; |
5365 | - unset( $input['value']['tz'] ); |
|
5366 | - unset( $input['params']['TZID'] ); |
|
5365 | + unset($input['value']['tz']); |
|
5366 | + unset($input['params']['TZID']); |
|
5367 | 5367 | } |
5368 | - elseif( isset( $input['params']['TZID'] )) |
|
5369 | - unset( $input['value']['tz'] ); |
|
5370 | - if( $localtime ) unset( $input['value']['tz'], $input['params']['TZID'] ); |
|
5371 | - if( isset( $input['value']['tz'] )) |
|
5368 | + elseif (isset($input['params']['TZID'])) |
|
5369 | + unset($input['value']['tz']); |
|
5370 | + if ($localtime) unset($input['value']['tz'], $input['params']['TZID']); |
|
5371 | + if (isset($input['value']['tz'])) |
|
5372 | 5372 | $input['value']['tz'] = (string) $input['value']['tz']; |
5373 | - if( !empty( $input['value']['tz'] ) && ( 'Z' != $input['value']['tz'] ) && |
|
5374 | - ( !$this->_isOffset( $input['value']['tz'] ))) |
|
5373 | + if (!empty($input['value']['tz']) && ('Z' != $input['value']['tz']) && |
|
5374 | + (!$this->_isOffset($input['value']['tz']))) |
|
5375 | 5375 | $input['params']['TZID'] = $input['value']['tz']; |
5376 | 5376 | return $input; |
5377 | 5377 | } |
@@ -5389,37 +5389,37 @@ discard block |
||
5389 | 5389 | * @param array $params optional |
5390 | 5390 | * @return array |
5391 | 5391 | */ |
5392 | - function _setDate2( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) { |
|
5392 | + function _setDate2($year, $month = FALSE, $day = FALSE, $hour = FALSE, $min = FALSE, $sec = FALSE, $params = FALSE) { |
|
5393 | 5393 | $input = null; |
5394 | - if( $this->_isArrayDate( $year )) { |
|
5395 | - $input['value'] = $this->_date_time_array( $year, 7 ); |
|
5396 | - $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) ); |
|
5394 | + if ($this->_isArrayDate($year)) { |
|
5395 | + $input['value'] = $this->_date_time_array($year, 7); |
|
5396 | + $input['params'] = $this->_setParams($month, array('VALUE' => 'DATE-TIME')); |
|
5397 | 5397 | } |
5398 | - elseif( $this->_isArrayTimestampDate( $year )) { |
|
5399 | - $input['value'] = $this->_timestamp2date( $year, 7 ); |
|
5400 | - $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) ); |
|
5398 | + elseif ($this->_isArrayTimestampDate($year)) { |
|
5399 | + $input['value'] = $this->_timestamp2date($year, 7); |
|
5400 | + $input['params'] = $this->_setParams($month, array('VALUE' => 'DATE-TIME')); |
|
5401 | 5401 | } |
5402 | - elseif( 8 <= strlen( trim( $year ))) { // ex. 2006-08-03 10:12:18 |
|
5403 | - $input['value'] = $this->_date_time_string( $year, 7 ); |
|
5404 | - $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) ); |
|
5402 | + elseif (8 <= strlen(trim($year))) { // ex. 2006-08-03 10:12:18 |
|
5403 | + $input['value'] = $this->_date_time_string($year, 7); |
|
5404 | + $input['params'] = $this->_setParams($month, array('VALUE' => 'DATE-TIME')); |
|
5405 | 5405 | } |
5406 | 5406 | else { |
5407 | - $input['value'] = array( 'year' => $year |
|
5407 | + $input['value'] = array('year' => $year |
|
5408 | 5408 | , 'month' => $month |
5409 | 5409 | , 'day' => $day |
5410 | 5410 | , 'hour' => $hour |
5411 | 5411 | , 'min' => $min |
5412 | - , 'sec' => $sec ); |
|
5413 | - $input['params'] = $this->_setParams( $params, array( 'VALUE' => 'DATE-TIME' )); |
|
5412 | + , 'sec' => $sec); |
|
5413 | + $input['params'] = $this->_setParams($params, array('VALUE' => 'DATE-TIME')); |
|
5414 | 5414 | } |
5415 | - $parno = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', 7 ); // remove default |
|
5416 | - if( !isset( $input['value']['hour'] )) |
|
5415 | + $parno = $this->_existRem($input['params'], 'VALUE', 'DATE-TIME', 7); // remove default |
|
5416 | + if (!isset($input['value']['hour'])) |
|
5417 | 5417 | $input['value']['hour'] = 0; |
5418 | - if( !isset( $input['value']['min'] )) |
|
5418 | + if (!isset($input['value']['min'])) |
|
5419 | 5419 | $input['value']['min'] = 0; |
5420 | - if( !isset( $input['value']['sec'] )) |
|
5420 | + if (!isset($input['value']['sec'])) |
|
5421 | 5421 | $input['value']['sec'] = 0; |
5422 | - if( !isset( $input['value']['tz'] ) || !$this->_isOffset( $input['value']['tz'] )) |
|
5422 | + if (!isset($input['value']['tz']) || !$this->_isOffset($input['value']['tz'])) |
|
5423 | 5423 | $input['value']['tz'] = 'Z'; |
5424 | 5424 | return $input; |
5425 | 5425 | } |
@@ -5435,18 +5435,18 @@ discard block |
||
5435 | 5435 | * @param int $index |
5436 | 5436 | * @return void |
5437 | 5437 | */ |
5438 | - function _setMval( & $valArr, $value, $params=FALSE, $defaults=FALSE, $index=FALSE ) { |
|
5439 | - if( !is_array( $valArr )) $valArr = array(); |
|
5440 | - if( $index ) |
|
5438 | + function _setMval(& $valArr, $value, $params = FALSE, $defaults = FALSE, $index = FALSE) { |
|
5439 | + if (!is_array($valArr)) $valArr = array(); |
|
5440 | + if ($index) |
|
5441 | 5441 | $index = $index - 1; |
5442 | - elseif( 0 < count( $valArr )) { |
|
5443 | - $index = end( array_keys( $valArr )); |
|
5442 | + elseif (0 < count($valArr)) { |
|
5443 | + $index = end(array_keys($valArr)); |
|
5444 | 5444 | $index += 1; |
5445 | 5445 | } |
5446 | 5446 | else |
5447 | 5447 | $index = 0; |
5448 | - $valArr[$index] = array( 'value' => $value, 'params' => $this->_setParams( $params, $defaults )); |
|
5449 | - ksort( $valArr ); |
|
5448 | + $valArr[$index] = array('value' => $value, 'params' => $this->_setParams($params, $defaults)); |
|
5449 | + ksort($valArr); |
|
5450 | 5450 | } |
5451 | 5451 | /** |
5452 | 5452 | * set input (formatted) parameters- component property attributes |
@@ -5459,31 +5459,31 @@ discard block |
||
5459 | 5459 | * @param array $defaults |
5460 | 5460 | * @return array |
5461 | 5461 | */ |
5462 | - function _setParams( $params, $defaults=FALSE ) { |
|
5463 | - if( !is_array( $params)) |
|
5462 | + function _setParams($params, $defaults = FALSE) { |
|
5463 | + if (!is_array($params)) |
|
5464 | 5464 | $params = array(); |
5465 | 5465 | $input = array(); |
5466 | - foreach( $params as $paramKey => $paramValue ) { |
|
5467 | - if( is_array( $paramValue )) { |
|
5468 | - foreach( $paramValue as $pkey => $pValue ) { |
|
5469 | - if(( '"' == substr( $pValue, 0, 1 )) && ( '"' == substr( $pValue, -1 ))) |
|
5470 | - $paramValue[$pkey] = substr( $pValue, 1, ( strlen( $pValue ) - 2 )); |
|
5466 | + foreach ($params as $paramKey => $paramValue) { |
|
5467 | + if (is_array($paramValue)) { |
|
5468 | + foreach ($paramValue as $pkey => $pValue) { |
|
5469 | + if (('"' == substr($pValue, 0, 1)) && ('"' == substr($pValue, -1))) |
|
5470 | + $paramValue[$pkey] = substr($pValue, 1, (strlen($pValue) - 2)); |
|
5471 | 5471 | } |
5472 | 5472 | } |
5473 | - elseif(( '"' == substr( $paramValue, 0, 1 )) && ( '"' == substr( $paramValue, -1 ))) |
|
5474 | - $paramValue = substr( $paramValue, 1, ( strlen( $paramValue ) - 2 )); |
|
5475 | - if( 'VALUE' == strtoupper( $paramKey )) |
|
5476 | - $input['VALUE'] = strtoupper( $paramValue ); |
|
5473 | + elseif (('"' == substr($paramValue, 0, 1)) && ('"' == substr($paramValue, -1))) |
|
5474 | + $paramValue = substr($paramValue, 1, (strlen($paramValue) - 2)); |
|
5475 | + if ('VALUE' == strtoupper($paramKey)) |
|
5476 | + $input['VALUE'] = strtoupper($paramValue); |
|
5477 | 5477 | else |
5478 | - $input[strtoupper( $paramKey )] = $paramValue; |
|
5478 | + $input[strtoupper($paramKey)] = $paramValue; |
|
5479 | 5479 | } |
5480 | - if( is_array( $defaults )) { |
|
5481 | - foreach( $defaults as $paramKey => $paramValue ) { |
|
5482 | - if( !isset( $input[$paramKey] )) |
|
5480 | + if (is_array($defaults)) { |
|
5481 | + foreach ($defaults as $paramKey => $paramValue) { |
|
5482 | + if (!isset($input[$paramKey])) |
|
5483 | 5483 | $input[$paramKey] = $paramValue; |
5484 | 5484 | } |
5485 | 5485 | } |
5486 | - return (0 < count( $input )) ? $input : null; |
|
5486 | + return (0 < count($input)) ? $input : null; |
|
5487 | 5487 | } |
5488 | 5488 | /** |
5489 | 5489 | * step date, return updated date, array and timpstamp |
@@ -5495,13 +5495,13 @@ discard block |
||
5495 | 5495 | * @param array $step, default array( 'day' => 1 ) |
5496 | 5496 | * @return void |
5497 | 5497 | */ |
5498 | - function _stepdate( &$date, &$timestamp, $step=array( 'day' => 1 )) { |
|
5499 | - foreach( $step as $stepix => $stepvalue ) |
|
5498 | + function _stepdate(&$date, &$timestamp, $step = array('day' => 1)) { |
|
5499 | + foreach ($step as $stepix => $stepvalue) |
|
5500 | 5500 | $date[$stepix] += $stepvalue; |
5501 | - $timestamp = $this->_date2timestamp( $date ); |
|
5502 | - $date = $this->_timestamp2date( $timestamp, 6 ); |
|
5503 | - foreach( $date as $k => $v ) { |
|
5504 | - if( ctype_digit( $v )) |
|
5501 | + $timestamp = $this->_date2timestamp($date); |
|
5502 | + $date = $this->_timestamp2date($timestamp, 6); |
|
5503 | + foreach ($date as $k => $v) { |
|
5504 | + if (ctype_digit($v)) |
|
5505 | 5505 | $date[$k] = (int) $v; |
5506 | 5506 | } |
5507 | 5507 | } |
@@ -5514,20 +5514,20 @@ discard block |
||
5514 | 5514 | * @param int $parno |
5515 | 5515 | * @return array |
5516 | 5516 | */ |
5517 | - function _timestamp2date( $timestamp, $parno=6 ) { |
|
5518 | - if( is_array( $timestamp )) { |
|
5519 | - if(( 7 == $parno ) && !empty( $timestamp['tz'] )) |
|
5517 | + function _timestamp2date($timestamp, $parno = 6) { |
|
5518 | + if (is_array($timestamp)) { |
|
5519 | + if ((7 == $parno) && !empty($timestamp['tz'])) |
|
5520 | 5520 | $tz = $timestamp['tz']; |
5521 | 5521 | $timestamp = $timestamp['timestamp']; |
5522 | 5522 | } |
5523 | - $output = array( 'year' => date( 'Y', $timestamp ) |
|
5524 | - , 'month' => date( 'm', $timestamp ) |
|
5525 | - , 'day' => date( 'd', $timestamp )); |
|
5526 | - if( 3 != $parno ) { |
|
5527 | - $output['hour'] = date( 'H', $timestamp ); |
|
5528 | - $output['min'] = date( 'i', $timestamp ); |
|
5529 | - $output['sec'] = date( 's', $timestamp ); |
|
5530 | - if( isset( $tz )) |
|
5523 | + $output = array('year' => date('Y', $timestamp) |
|
5524 | + , 'month' => date('m', $timestamp) |
|
5525 | + , 'day' => date('d', $timestamp)); |
|
5526 | + if (3 != $parno) { |
|
5527 | + $output['hour'] = date('H', $timestamp); |
|
5528 | + $output['min'] = date('i', $timestamp); |
|
5529 | + $output['sec'] = date('s', $timestamp); |
|
5530 | + if (isset($tz)) |
|
5531 | 5531 | $output['tz'] = $tz; |
5532 | 5532 | } |
5533 | 5533 | return $output; |
@@ -5540,19 +5540,19 @@ discard block |
||
5540 | 5540 | * @param string $offset |
5541 | 5541 | * @return integer |
5542 | 5542 | */ |
5543 | - function _tz2offset( $tz ) { |
|
5544 | - $tz = trim( (string) $tz ); |
|
5543 | + function _tz2offset($tz) { |
|
5544 | + $tz = trim((string) $tz); |
|
5545 | 5545 | $offset = 0; |
5546 | - if((( 5 != strlen( $tz )) && ( 7 != strlen( $tz ))) || |
|
5547 | - (( '+' != substr( $tz, 0, 1 )) && ( '-' != substr( $tz, 0, 1 ))) || |
|
5548 | - (( '0000' >= substr( $tz, 1, 4 )) && ( '9999' < substr( $tz, 1, 4 ))) || |
|
5549 | - (( 7 == strlen( $tz )) && ( '00' > substr( $tz, 5, 2 )) && ( '99' < substr( $tz, 5, 2 )))) |
|
5546 | + if (((5 != strlen($tz)) && (7 != strlen($tz))) || |
|
5547 | + (('+' != substr($tz, 0, 1)) && ('-' != substr($tz, 0, 1))) || |
|
5548 | + (('0000' >= substr($tz, 1, 4)) && ('9999' < substr($tz, 1, 4))) || |
|
5549 | + ((7 == strlen($tz)) && ('00' > substr($tz, 5, 2)) && ('99' < substr($tz, 5, 2)))) |
|
5550 | 5550 | return $offset; |
5551 | - $hours2sec = (int) substr( $tz, 1, 2 ) * 3600; |
|
5552 | - $min2sec = (int) substr( $tz, 3, 2 ) * 60; |
|
5553 | - $sec = ( 7 == strlen( $tz )) ? (int) substr( $tz, -2 ) : '00'; |
|
5551 | + $hours2sec = (int) substr($tz, 1, 2) * 3600; |
|
5552 | + $min2sec = (int) substr($tz, 3, 2) * 60; |
|
5553 | + $sec = (7 == strlen($tz)) ? (int) substr($tz, -2) : '00'; |
|
5554 | 5554 | $offset = $hours2sec + $min2sec + $sec; |
5555 | - $offset = ('-' == substr( $tz, 0, 1 )) ? $offset : -1 * $offset; |
|
5555 | + $offset = ('-' == substr($tz, 0, 1)) ? $offset : -1 * $offset; |
|
5556 | 5556 | return $offset; |
5557 | 5557 | } |
5558 | 5558 | /*********************************************************************************/ |
@@ -5565,24 +5565,24 @@ discard block |
||
5565 | 5565 | * @param string $config |
5566 | 5566 | * @return value |
5567 | 5567 | */ |
5568 | - function getConfig( $config ) { |
|
5569 | - switch( strtoupper( $config )) { |
|
5568 | + function getConfig($config) { |
|
5569 | + switch (strtoupper($config)) { |
|
5570 | 5570 | case 'ALLOWEMPTY': |
5571 | 5571 | return $this->allowEmpty; |
5572 | 5572 | break; |
5573 | 5573 | case 'COMPSINFO': |
5574 | - unset( $this->compix ); |
|
5574 | + unset($this->compix); |
|
5575 | 5575 | $info = array(); |
5576 | - if( isset( $this->components )) { |
|
5577 | - foreach( $this->components as $cix => $component ) { |
|
5578 | - if( empty( $component )) continue; |
|
5579 | - unset( $component->propix ); |
|
5576 | + if (isset($this->components)) { |
|
5577 | + foreach ($this->components as $cix => $component) { |
|
5578 | + if (empty($component)) continue; |
|
5579 | + unset($component->propix); |
|
5580 | 5580 | $info[$cix]['ordno'] = $cix + 1; |
5581 | 5581 | $info[$cix]['type'] = $component->objName; |
5582 | - $info[$cix]['uid'] = $component->getProperty( 'uid' ); |
|
5583 | - $info[$cix]['props'] = $component->getConfig( 'propinfo' ); |
|
5584 | - $info[$cix]['sub'] = $component->getConfig( 'compsinfo' ); |
|
5585 | - unset( $component->propix ); |
|
5582 | + $info[$cix]['uid'] = $component->getProperty('uid'); |
|
5583 | + $info[$cix]['props'] = $component->getConfig('propinfo'); |
|
5584 | + $info[$cix]['sub'] = $component->getConfig('compsinfo'); |
|
5585 | + unset($component->propix); |
|
5586 | 5586 | } |
5587 | 5587 | } |
5588 | 5588 | return $info; |
@@ -5600,58 +5600,58 @@ discard block |
||
5600 | 5600 | break; |
5601 | 5601 | case 'PROPINFO': |
5602 | 5602 | $output = array(); |
5603 | - if( !in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' ))) { |
|
5604 | - if( empty( $this->uid['value'] )) $this->_makeuid(); |
|
5605 | - $output['UID'] = 1; |
|
5603 | + if (!in_array($this->objName, array('valarm', 'vtimezone', 'standard', 'daylight'))) { |
|
5604 | + if (empty($this->uid['value'])) $this->_makeuid(); |
|
5605 | + $output['UID'] = 1; |
|
5606 | 5606 | } |
5607 | - if( !empty( $this->dtstamp )) $output['DTSTAMP'] = 1; |
|
5608 | - if( !empty( $this->summary )) $output['SUMMARY'] = 1; |
|
5609 | - if( !empty( $this->description )) $output['DESCRIPTION'] = count( $this->description ); |
|
5610 | - if( !empty( $this->dtstart )) $output['DTSTART'] = 1; |
|
5611 | - if( !empty( $this->dtend )) $output['DTEND'] = 1; |
|
5612 | - if( !empty( $this->due )) $output['DUE'] = 1; |
|
5613 | - if( !empty( $this->duration )) $output['DURATION'] = 1; |
|
5614 | - if( !empty( $this->rrule )) $output['RRULE'] = count( $this->rrule ); |
|
5615 | - if( !empty( $this->rdate )) $output['RDATE'] = count( $this->rdate ); |
|
5616 | - if( !empty( $this->exdate )) $output['EXDATE'] = count( $this->exdate ); |
|
5617 | - if( !empty( $this->exrule )) $output['EXRULE'] = count( $this->exrule ); |
|
5618 | - if( !empty( $this->action )) $output['ACTION'] = 1; |
|
5619 | - if( !empty( $this->attach )) $output['ATTACH'] = count( $this->attach ); |
|
5620 | - if( !empty( $this->attendee )) $output['ATTENDEE'] = count( $this->attendee ); |
|
5621 | - if( !empty( $this->categories )) $output['CATEGORIES'] = count( $this->categories ); |
|
5622 | - if( !empty( $this->class )) $output['CLASS'] = 1; |
|
5623 | - if( !empty( $this->comment )) $output['COMMENT'] = count( $this->comment ); |
|
5624 | - if( !empty( $this->completed )) $output['COMPLETED'] = 1; |
|
5625 | - if( !empty( $this->contact )) $output['CONTACT'] = count( $this->contact ); |
|
5626 | - if( !empty( $this->created )) $output['CREATED'] = 1; |
|
5627 | - if( !empty( $this->freebusy )) $output['FREEBUSY'] = count( $this->freebusy ); |
|
5628 | - if( !empty( $this->geo )) $output['GEO'] = 1; |
|
5629 | - if( !empty( $this->lastmodified )) $output['LAST-MODIFIED'] = 1; |
|
5630 | - if( !empty( $this->location )) $output['LOCATION'] = 1; |
|
5631 | - if( !empty( $this->organizer )) $output['ORGANIZER'] = 1; |
|
5632 | - if( !empty( $this->percentcomplete )) $output['PERCENT-COMPLETE'] = 1; |
|
5633 | - if( !empty( $this->priority )) $output['PRIORITY'] = 1; |
|
5634 | - if( !empty( $this->recurrenceid )) $output['RECURRENCE-ID'] = 1; |
|
5635 | - if( !empty( $this->relatedto )) $output['RELATED-TO'] = count( $this->relatedto ); |
|
5636 | - if( !empty( $this->repeat )) $output['REPEAT'] = 1; |
|
5637 | - if( !empty( $this->requeststatus )) $output['REQUEST-STATUS'] = count( $this->requeststatus ); |
|
5638 | - if( !empty( $this->resources )) $output['RESOURCES'] = count( $this->resources ); |
|
5639 | - if( !empty( $this->sequence )) $output['SEQUENCE'] = 1; |
|
5640 | - if( !empty( $this->status )) $output['STATUS'] = 1; |
|
5641 | - if( !empty( $this->transp )) $output['TRANSP'] = 1; |
|
5642 | - if( !empty( $this->trigger )) $output['TRIGGER'] = 1; |
|
5643 | - if( !empty( $this->tzid )) $output['TZID'] = 1; |
|
5644 | - if( !empty( $this->tzname )) $output['TZNAME'] = count( $this->tzname ); |
|
5645 | - if( !empty( $this->tzoffsetfrom )) $output['TZOFFSETTFROM'] = 1; |
|
5646 | - if( !empty( $this->tzoffsetto )) $output['TZOFFSETTO'] = 1; |
|
5647 | - if( !empty( $this->tzurl )) $output['TZURL'] = 1; |
|
5648 | - if( !empty( $this->url )) $output['URL'] = 1; |
|
5649 | - if( !empty( $this->xprop )) $output['X-PROP'] = count( $this->xprop ); |
|
5607 | + if (!empty($this->dtstamp)) $output['DTSTAMP'] = 1; |
|
5608 | + if (!empty($this->summary)) $output['SUMMARY'] = 1; |
|
5609 | + if (!empty($this->description)) $output['DESCRIPTION'] = count($this->description); |
|
5610 | + if (!empty($this->dtstart)) $output['DTSTART'] = 1; |
|
5611 | + if (!empty($this->dtend)) $output['DTEND'] = 1; |
|
5612 | + if (!empty($this->due)) $output['DUE'] = 1; |
|
5613 | + if (!empty($this->duration)) $output['DURATION'] = 1; |
|
5614 | + if (!empty($this->rrule)) $output['RRULE'] = count($this->rrule); |
|
5615 | + if (!empty($this->rdate)) $output['RDATE'] = count($this->rdate); |
|
5616 | + if (!empty($this->exdate)) $output['EXDATE'] = count($this->exdate); |
|
5617 | + if (!empty($this->exrule)) $output['EXRULE'] = count($this->exrule); |
|
5618 | + if (!empty($this->action)) $output['ACTION'] = 1; |
|
5619 | + if (!empty($this->attach)) $output['ATTACH'] = count($this->attach); |
|
5620 | + if (!empty($this->attendee)) $output['ATTENDEE'] = count($this->attendee); |
|
5621 | + if (!empty($this->categories)) $output['CATEGORIES'] = count($this->categories); |
|
5622 | + if (!empty($this->class)) $output['CLASS'] = 1; |
|
5623 | + if (!empty($this->comment)) $output['COMMENT'] = count($this->comment); |
|
5624 | + if (!empty($this->completed)) $output['COMPLETED'] = 1; |
|
5625 | + if (!empty($this->contact)) $output['CONTACT'] = count($this->contact); |
|
5626 | + if (!empty($this->created)) $output['CREATED'] = 1; |
|
5627 | + if (!empty($this->freebusy)) $output['FREEBUSY'] = count($this->freebusy); |
|
5628 | + if (!empty($this->geo)) $output['GEO'] = 1; |
|
5629 | + if (!empty($this->lastmodified)) $output['LAST-MODIFIED'] = 1; |
|
5630 | + if (!empty($this->location)) $output['LOCATION'] = 1; |
|
5631 | + if (!empty($this->organizer)) $output['ORGANIZER'] = 1; |
|
5632 | + if (!empty($this->percentcomplete)) $output['PERCENT-COMPLETE'] = 1; |
|
5633 | + if (!empty($this->priority)) $output['PRIORITY'] = 1; |
|
5634 | + if (!empty($this->recurrenceid)) $output['RECURRENCE-ID'] = 1; |
|
5635 | + if (!empty($this->relatedto)) $output['RELATED-TO'] = count($this->relatedto); |
|
5636 | + if (!empty($this->repeat)) $output['REPEAT'] = 1; |
|
5637 | + if (!empty($this->requeststatus)) $output['REQUEST-STATUS'] = count($this->requeststatus); |
|
5638 | + if (!empty($this->resources)) $output['RESOURCES'] = count($this->resources); |
|
5639 | + if (!empty($this->sequence)) $output['SEQUENCE'] = 1; |
|
5640 | + if (!empty($this->status)) $output['STATUS'] = 1; |
|
5641 | + if (!empty($this->transp)) $output['TRANSP'] = 1; |
|
5642 | + if (!empty($this->trigger)) $output['TRIGGER'] = 1; |
|
5643 | + if (!empty($this->tzid)) $output['TZID'] = 1; |
|
5644 | + if (!empty($this->tzname)) $output['TZNAME'] = count($this->tzname); |
|
5645 | + if (!empty($this->tzoffsetfrom)) $output['TZOFFSETTFROM'] = 1; |
|
5646 | + if (!empty($this->tzoffsetto)) $output['TZOFFSETTO'] = 1; |
|
5647 | + if (!empty($this->tzurl)) $output['TZURL'] = 1; |
|
5648 | + if (!empty($this->url)) $output['URL'] = 1; |
|
5649 | + if (!empty($this->xprop)) $output['X-PROP'] = count($this->xprop); |
|
5650 | 5650 | return $output; |
5651 | 5651 | break; |
5652 | 5652 | case 'UNIQUE_ID': |
5653 | - if( empty( $this->unique_id )) |
|
5654 | - $this->unique_id = ( isset( $_SERVER['SERVER_NAME'] )) ? gethostbyname( $_SERVER['SERVER_NAME'] ) : 'localhost'; |
|
5653 | + if (empty($this->unique_id)) |
|
5654 | + $this->unique_id = (isset($_SERVER['SERVER_NAME'])) ? gethostbyname($_SERVER['SERVER_NAME']) : 'localhost'; |
|
5655 | 5655 | return $this->unique_id; |
5656 | 5656 | break; |
5657 | 5657 | } |
@@ -5665,47 +5665,47 @@ discard block |
||
5665 | 5665 | * @param string $value |
5666 | 5666 | * @return void |
5667 | 5667 | */ |
5668 | - function setConfig( $config, $value ) { |
|
5668 | + function setConfig($config, $value) { |
|
5669 | 5669 | $res = FALSE; |
5670 | - switch( strtoupper( $config )) { |
|
5670 | + switch (strtoupper($config)) { |
|
5671 | 5671 | case 'ALLOWEMPTY': |
5672 | 5672 | $this->allowEmpty = $value; |
5673 | - $subcfg = array( 'ALLOWEMPTY' => $value ); |
|
5673 | + $subcfg = array('ALLOWEMPTY' => $value); |
|
5674 | 5674 | $res = TRUE; |
5675 | 5675 | break; |
5676 | 5676 | case 'FORMAT': |
5677 | - $value = trim( $value ); |
|
5677 | + $value = trim($value); |
|
5678 | 5678 | $this->format = $value; |
5679 | 5679 | $this->_createFormat(); |
5680 | - $subcfg = array( 'FORMAT' => $value ); |
|
5680 | + $subcfg = array('FORMAT' => $value); |
|
5681 | 5681 | $res = TRUE; |
5682 | 5682 | break; |
5683 | 5683 | case 'LANGUAGE': |
5684 | 5684 | // set language for calendar component as defined in [RFC 1766] |
5685 | - $value = trim( $value ); |
|
5685 | + $value = trim($value); |
|
5686 | 5686 | $this->language = $value; |
5687 | - $subcfg = array( 'LANGUAGE' => $value ); |
|
5687 | + $subcfg = array('LANGUAGE' => $value); |
|
5688 | 5688 | $res = TRUE; |
5689 | 5689 | break; |
5690 | 5690 | case 'NL': |
5691 | 5691 | case 'NEWLINECHAR': |
5692 | 5692 | $this->nl = $value; |
5693 | - $subcfg = array( 'NL' => $value ); |
|
5693 | + $subcfg = array('NL' => $value); |
|
5694 | 5694 | $res = TRUE; |
5695 | 5695 | break; |
5696 | 5696 | case 'UNIQUE_ID': |
5697 | - $value = trim( $value ); |
|
5697 | + $value = trim($value); |
|
5698 | 5698 | $this->unique_id = $value; |
5699 | - $subcfg = array( 'UNIQUE_ID' => $value ); |
|
5699 | + $subcfg = array('UNIQUE_ID' => $value); |
|
5700 | 5700 | $res = TRUE; |
5701 | 5701 | break; |
5702 | 5702 | } |
5703 | - if( !$res ) return FALSE; |
|
5704 | - if( isset( $subcfg ) && !empty( $this->components )) { |
|
5705 | - foreach( $subcfg as $cfgkey => $cfgvalue ) { |
|
5706 | - foreach( $this->components as $cix => $component ) { |
|
5707 | - $res = $component->setConfig( $cfgkey, $cfgvalue ); |
|
5708 | - if( !$res ) |
|
5703 | + if (!$res) return FALSE; |
|
5704 | + if (isset($subcfg) && !empty($this->components)) { |
|
5705 | + foreach ($subcfg as $cfgkey => $cfgvalue) { |
|
5706 | + foreach ($this->components as $cix => $component) { |
|
5707 | + $res = $component->setConfig($cfgkey, $cfgvalue); |
|
5708 | + if (!$res) |
|
5709 | 5709 | break 2; |
5710 | 5710 | $this->components[$cix] = $component; // PHP4 compliant |
5711 | 5711 | } |
@@ -5723,248 +5723,248 @@ discard block |
||
5723 | 5723 | * @param int @propix, optional, if specific property is wanted in case of multiply occurences |
5724 | 5724 | * @return bool, if successfull delete TRUE |
5725 | 5725 | */ |
5726 | - function deleteProperty( $propName, $propix=FALSE ) { |
|
5727 | - if( $this->_notExistProp( $propName )) return FALSE; |
|
5728 | - $propName = strtoupper( $propName ); |
|
5729 | - if( in_array( $propName, array( 'ATTACH', 'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'DESCRIPTION', 'EXDATE', 'EXRULE', |
|
5730 | - 'FREEBUSY', 'RDATE', 'RELATED-TO', 'RESOURCES', 'RRULE', 'REQUEST-STATUS', 'TZNAME', 'X-PROP' ))) { |
|
5731 | - if( !$propix ) |
|
5732 | - $propix = ( isset( $this->propdelix[$propName] )) ? $this->propdelix[$propName] + 2 : 1; |
|
5726 | + function deleteProperty($propName, $propix = FALSE) { |
|
5727 | + if ($this->_notExistProp($propName)) return FALSE; |
|
5728 | + $propName = strtoupper($propName); |
|
5729 | + if (in_array($propName, array('ATTACH', 'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'DESCRIPTION', 'EXDATE', 'EXRULE', |
|
5730 | + 'FREEBUSY', 'RDATE', 'RELATED-TO', 'RESOURCES', 'RRULE', 'REQUEST-STATUS', 'TZNAME', 'X-PROP'))) { |
|
5731 | + if (!$propix) |
|
5732 | + $propix = (isset($this->propdelix[$propName])) ? $this->propdelix[$propName] + 2 : 1; |
|
5733 | 5733 | $this->propdelix[$propName] = --$propix; |
5734 | 5734 | } |
5735 | 5735 | $return = FALSE; |
5736 | - switch( $propName ) { |
|
5736 | + switch ($propName) { |
|
5737 | 5737 | case 'ACTION': |
5738 | - if( !empty( $this->action )) { |
|
5738 | + if (!empty($this->action)) { |
|
5739 | 5739 | $this->action = ''; |
5740 | 5740 | $return = TRUE; |
5741 | 5741 | } |
5742 | 5742 | break; |
5743 | 5743 | case 'ATTACH': |
5744 | - return $this->deletePropertyM( $this->attach, $propix ); |
|
5744 | + return $this->deletePropertyM($this->attach, $propix); |
|
5745 | 5745 | break; |
5746 | 5746 | case 'ATTENDEE': |
5747 | - return $this->deletePropertyM( $this->attendee, $propix ); |
|
5747 | + return $this->deletePropertyM($this->attendee, $propix); |
|
5748 | 5748 | break; |
5749 | 5749 | case 'CATEGORIES': |
5750 | - return $this->deletePropertyM( $this->categories, $propix ); |
|
5750 | + return $this->deletePropertyM($this->categories, $propix); |
|
5751 | 5751 | break; |
5752 | 5752 | case 'CLASS': |
5753 | - if( !empty( $this->class )) { |
|
5753 | + if (!empty($this->class)) { |
|
5754 | 5754 | $this->class = ''; |
5755 | 5755 | $return = TRUE; |
5756 | 5756 | } |
5757 | 5757 | break; |
5758 | 5758 | case 'COMMENT': |
5759 | - return $this->deletePropertyM( $this->comment, $propix ); |
|
5759 | + return $this->deletePropertyM($this->comment, $propix); |
|
5760 | 5760 | break; |
5761 | 5761 | case 'COMPLETED': |
5762 | - if( !empty( $this->completed )) { |
|
5762 | + if (!empty($this->completed)) { |
|
5763 | 5763 | $this->completed = ''; |
5764 | 5764 | $return = TRUE; |
5765 | 5765 | } |
5766 | 5766 | break; |
5767 | 5767 | case 'CONTACT': |
5768 | - return $this->deletePropertyM( $this->contact, $propix ); |
|
5768 | + return $this->deletePropertyM($this->contact, $propix); |
|
5769 | 5769 | break; |
5770 | 5770 | case 'CREATED': |
5771 | - if( !empty( $this->created )) { |
|
5771 | + if (!empty($this->created)) { |
|
5772 | 5772 | $this->created = ''; |
5773 | 5773 | $return = TRUE; |
5774 | 5774 | } |
5775 | 5775 | break; |
5776 | 5776 | case 'DESCRIPTION': |
5777 | - return $this->deletePropertyM( $this->description, $propix ); |
|
5777 | + return $this->deletePropertyM($this->description, $propix); |
|
5778 | 5778 | break; |
5779 | 5779 | case 'DTEND': |
5780 | - if( !empty( $this->dtend )) { |
|
5780 | + if (!empty($this->dtend)) { |
|
5781 | 5781 | $this->dtend = ''; |
5782 | 5782 | $return = TRUE; |
5783 | 5783 | } |
5784 | 5784 | break; |
5785 | 5785 | case 'DTSTAMP': |
5786 | - if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' ))) |
|
5786 | + if (in_array($this->objName, array('valarm', 'vtimezone', 'standard', 'daylight'))) |
|
5787 | 5787 | return FALSE; |
5788 | - if( !empty( $this->dtstamp )) { |
|
5788 | + if (!empty($this->dtstamp)) { |
|
5789 | 5789 | $this->dtstamp = ''; |
5790 | 5790 | $return = TRUE; |
5791 | 5791 | } |
5792 | 5792 | break; |
5793 | 5793 | case 'DTSTART': |
5794 | - if( !empty( $this->dtstart )) { |
|
5794 | + if (!empty($this->dtstart)) { |
|
5795 | 5795 | $this->dtstart = ''; |
5796 | 5796 | $return = TRUE; |
5797 | 5797 | } |
5798 | 5798 | break; |
5799 | 5799 | case 'DUE': |
5800 | - if( !empty( $this->due )) { |
|
5800 | + if (!empty($this->due)) { |
|
5801 | 5801 | $this->due = ''; |
5802 | 5802 | $return = TRUE; |
5803 | 5803 | } |
5804 | 5804 | break; |
5805 | 5805 | case 'DURATION': |
5806 | - if( !empty( $this->duration )) { |
|
5806 | + if (!empty($this->duration)) { |
|
5807 | 5807 | $this->duration = ''; |
5808 | 5808 | $return = TRUE; |
5809 | 5809 | } |
5810 | 5810 | break; |
5811 | 5811 | case 'EXDATE': |
5812 | - return $this->deletePropertyM( $this->exdate, $propix ); |
|
5812 | + return $this->deletePropertyM($this->exdate, $propix); |
|
5813 | 5813 | break; |
5814 | 5814 | case 'EXRULE': |
5815 | - return $this->deletePropertyM( $this->exrule, $propix ); |
|
5815 | + return $this->deletePropertyM($this->exrule, $propix); |
|
5816 | 5816 | break; |
5817 | 5817 | case 'FREEBUSY': |
5818 | - return $this->deletePropertyM( $this->freebusy, $propix ); |
|
5818 | + return $this->deletePropertyM($this->freebusy, $propix); |
|
5819 | 5819 | break; |
5820 | 5820 | case 'GEO': |
5821 | - if( !empty( $this->geo )) { |
|
5821 | + if (!empty($this->geo)) { |
|
5822 | 5822 | $this->geo = ''; |
5823 | 5823 | $return = TRUE; |
5824 | 5824 | } |
5825 | 5825 | break; |
5826 | 5826 | case 'LAST-MODIFIED': |
5827 | - if( !empty( $this->lastmodified )) { |
|
5827 | + if (!empty($this->lastmodified)) { |
|
5828 | 5828 | $this->lastmodified = ''; |
5829 | 5829 | $return = TRUE; |
5830 | 5830 | } |
5831 | 5831 | break; |
5832 | 5832 | case 'LOCATION': |
5833 | - if( !empty( $this->location )) { |
|
5833 | + if (!empty($this->location)) { |
|
5834 | 5834 | $this->location = ''; |
5835 | 5835 | $return = TRUE; |
5836 | 5836 | } |
5837 | 5837 | break; |
5838 | 5838 | case 'ORGANIZER': |
5839 | - if( !empty( $this->organizer )) { |
|
5839 | + if (!empty($this->organizer)) { |
|
5840 | 5840 | $this->organizer = ''; |
5841 | 5841 | $return = TRUE; |
5842 | 5842 | } |
5843 | 5843 | break; |
5844 | 5844 | case 'PERCENT-COMPLETE': |
5845 | - if( !empty( $this->percentcomplete )) { |
|
5845 | + if (!empty($this->percentcomplete)) { |
|
5846 | 5846 | $this->percentcomplete = ''; |
5847 | 5847 | $return = TRUE; |
5848 | 5848 | } |
5849 | 5849 | break; |
5850 | 5850 | case 'PRIORITY': |
5851 | - if( !empty( $this->priority )) { |
|
5851 | + if (!empty($this->priority)) { |
|
5852 | 5852 | $this->priority = ''; |
5853 | 5853 | $return = TRUE; |
5854 | 5854 | } |
5855 | 5855 | break; |
5856 | 5856 | case 'RDATE': |
5857 | - return $this->deletePropertyM( $this->rdate, $propix ); |
|
5857 | + return $this->deletePropertyM($this->rdate, $propix); |
|
5858 | 5858 | break; |
5859 | 5859 | case 'RECURRENCE-ID': |
5860 | - if( !empty( $this->recurrenceid )) { |
|
5860 | + if (!empty($this->recurrenceid)) { |
|
5861 | 5861 | $this->recurrenceid = ''; |
5862 | 5862 | $return = TRUE; |
5863 | 5863 | } |
5864 | 5864 | break; |
5865 | 5865 | case 'RELATED-TO': |
5866 | - return $this->deletePropertyM( $this->relatedto, $propix ); |
|
5866 | + return $this->deletePropertyM($this->relatedto, $propix); |
|
5867 | 5867 | break; |
5868 | 5868 | case 'REPEAT': |
5869 | - if( !empty( $this->repeat )) { |
|
5869 | + if (!empty($this->repeat)) { |
|
5870 | 5870 | $this->repeat = ''; |
5871 | 5871 | $return = TRUE; |
5872 | 5872 | } |
5873 | 5873 | break; |
5874 | 5874 | case 'REQUEST-STATUS': |
5875 | - return $this->deletePropertyM( $this->requeststatus, $propix ); |
|
5875 | + return $this->deletePropertyM($this->requeststatus, $propix); |
|
5876 | 5876 | break; |
5877 | 5877 | case 'RESOURCES': |
5878 | - return $this->deletePropertyM( $this->resources, $propix ); |
|
5878 | + return $this->deletePropertyM($this->resources, $propix); |
|
5879 | 5879 | break; |
5880 | 5880 | case 'RRULE': |
5881 | - return $this->deletePropertyM( $this->rrule, $propix ); |
|
5881 | + return $this->deletePropertyM($this->rrule, $propix); |
|
5882 | 5882 | break; |
5883 | 5883 | case 'SEQUENCE': |
5884 | - if( !empty( $this->sequence )) { |
|
5884 | + if (!empty($this->sequence)) { |
|
5885 | 5885 | $this->sequence = ''; |
5886 | 5886 | $return = TRUE; |
5887 | 5887 | } |
5888 | 5888 | break; |
5889 | 5889 | case 'STATUS': |
5890 | - if( !empty( $this->status )) { |
|
5890 | + if (!empty($this->status)) { |
|
5891 | 5891 | $this->status = ''; |
5892 | 5892 | $return = TRUE; |
5893 | 5893 | } |
5894 | 5894 | break; |
5895 | 5895 | case 'SUMMARY': |
5896 | - if( !empty( $this->summary )) { |
|
5896 | + if (!empty($this->summary)) { |
|
5897 | 5897 | $this->summary = ''; |
5898 | 5898 | $return = TRUE; |
5899 | 5899 | } |
5900 | 5900 | break; |
5901 | 5901 | case 'TRANSP': |
5902 | - if( !empty( $this->transp )) { |
|
5902 | + if (!empty($this->transp)) { |
|
5903 | 5903 | $this->transp = ''; |
5904 | 5904 | $return = TRUE; |
5905 | 5905 | } |
5906 | 5906 | break; |
5907 | 5907 | case 'TRIGGER': |
5908 | - if( !empty( $this->trigger )) { |
|
5908 | + if (!empty($this->trigger)) { |
|
5909 | 5909 | $this->trigger = ''; |
5910 | 5910 | $return = TRUE; |
5911 | 5911 | } |
5912 | 5912 | break; |
5913 | 5913 | case 'TZID': |
5914 | - if( !empty( $this->tzid )) { |
|
5914 | + if (!empty($this->tzid)) { |
|
5915 | 5915 | $this->tzid = ''; |
5916 | 5916 | $return = TRUE; |
5917 | 5917 | } |
5918 | 5918 | break; |
5919 | 5919 | case 'TZNAME': |
5920 | - return $this->deletePropertyM( $this->tzname, $propix ); |
|
5920 | + return $this->deletePropertyM($this->tzname, $propix); |
|
5921 | 5921 | break; |
5922 | 5922 | case 'TZOFFSETFROM': |
5923 | - if( !empty( $this->tzoffsetfrom )) { |
|
5923 | + if (!empty($this->tzoffsetfrom)) { |
|
5924 | 5924 | $this->tzoffsetfrom = ''; |
5925 | 5925 | $return = TRUE; |
5926 | 5926 | } |
5927 | 5927 | break; |
5928 | 5928 | case 'TZOFFSETTO': |
5929 | - if( !empty( $this->tzoffsetto )) { |
|
5929 | + if (!empty($this->tzoffsetto)) { |
|
5930 | 5930 | $this->tzoffsetto = ''; |
5931 | 5931 | $return = TRUE; |
5932 | 5932 | } |
5933 | 5933 | break; |
5934 | 5934 | case 'TZURL': |
5935 | - if( !empty( $this->tzurl )) { |
|
5935 | + if (!empty($this->tzurl)) { |
|
5936 | 5936 | $this->tzurl = ''; |
5937 | 5937 | $return = TRUE; |
5938 | 5938 | } |
5939 | 5939 | break; |
5940 | 5940 | case 'UID': |
5941 | - if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' ))) |
|
5941 | + if (in_array($this->objName, array('valarm', 'vtimezone', 'standard', 'daylight'))) |
|
5942 | 5942 | return FALSE; |
5943 | - if( !empty( $this->uid )) { |
|
5943 | + if (!empty($this->uid)) { |
|
5944 | 5944 | $this->uid = ''; |
5945 | 5945 | $return = TRUE; |
5946 | 5946 | } |
5947 | 5947 | break; |
5948 | 5948 | case 'URL': |
5949 | - if( !empty( $this->url )) { |
|
5949 | + if (!empty($this->url)) { |
|
5950 | 5950 | $this->url = ''; |
5951 | 5951 | $return = TRUE; |
5952 | 5952 | } |
5953 | 5953 | break; |
5954 | 5954 | default: |
5955 | 5955 | $reduced = ''; |
5956 | - if( $propName != 'X-PROP' ) { |
|
5957 | - if( !isset( $this->xprop[$propName] )) return FALSE; |
|
5958 | - foreach( $this->xprop as $k => $a ) { |
|
5959 | - if(( $k != $propName ) && !empty( $a )) |
|
5956 | + if ($propName != 'X-PROP') { |
|
5957 | + if (!isset($this->xprop[$propName])) return FALSE; |
|
5958 | + foreach ($this->xprop as $k => $a) { |
|
5959 | + if (($k != $propName) && !empty($a)) |
|
5960 | 5960 | $reduced[$k] = $a; |
5961 | 5961 | } |
5962 | 5962 | } |
5963 | 5963 | else { |
5964 | - if( count( $this->xprop ) <= $propix ) return FALSE; |
|
5964 | + if (count($this->xprop) <= $propix) return FALSE; |
|
5965 | 5965 | $xpropno = 0; |
5966 | - foreach( $this->xprop as $xpropkey => $xpropvalue ) { |
|
5967 | - if( $propix != $xpropno ) |
|
5966 | + foreach ($this->xprop as $xpropkey => $xpropvalue) { |
|
5967 | + if ($propix != $xpropno) |
|
5968 | 5968 | $reduced[$xpropkey] = $xpropvalue; |
5969 | 5969 | $xpropno++; |
5970 | 5970 | } |
@@ -5984,11 +5984,11 @@ discard block |
||
5984 | 5984 | * @param int @propix, default 0 |
5985 | 5985 | * @return bool TRUE |
5986 | 5986 | */ |
5987 | - function deletePropertyM( & $multiprop, $propix=0 ) { |
|
5988 | - if( !isset( $multiprop[$propix])) return FALSE; |
|
5989 | - unset( $multiprop[$propix] ); |
|
5990 | - if( empty( $multiprop )) $multiprop = ''; |
|
5991 | - return ( isset( $this->multiprop[$propix] )) ? FALSE : TRUE; |
|
5987 | + function deletePropertyM(& $multiprop, $propix = 0) { |
|
5988 | + if (!isset($multiprop[$propix])) return FALSE; |
|
5989 | + unset($multiprop[$propix]); |
|
5990 | + if (empty($multiprop)) $multiprop = ''; |
|
5991 | + return (isset($this->multiprop[$propix])) ? FALSE : TRUE; |
|
5992 | 5992 | } |
5993 | 5993 | /** |
5994 | 5994 | * get component property value/params |
@@ -6003,183 +6003,183 @@ discard block |
||
6003 | 6003 | * @param bool $specform=FALSE |
6004 | 6004 | * @return mixed |
6005 | 6005 | */ |
6006 | - function getProperty( $propName=FALSE, $propix=FALSE, $inclParam=FALSE, $specform=FALSE ) { |
|
6007 | - if( $this->_notExistProp( $propName )) return FALSE; |
|
6008 | - $propName = ( $propName ) ? strtoupper( $propName ) : 'X-PROP'; |
|
6009 | - if( in_array( $propName, array( 'ATTACH', 'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'DESCRIPTION', 'EXDATE', 'EXRULE', |
|
6010 | - 'FREEBUSY', 'RDATE', 'RELATED-TO', 'RESOURCES', 'RRULE', 'REQUEST-STATUS', 'TZNAME', 'X-PROP' ))) { |
|
6011 | - if( !$propix ) |
|
6012 | - $propix = ( isset( $this->propix[$propName] )) ? $this->propix[$propName] + 2 : 1; |
|
6006 | + function getProperty($propName = FALSE, $propix = FALSE, $inclParam = FALSE, $specform = FALSE) { |
|
6007 | + if ($this->_notExistProp($propName)) return FALSE; |
|
6008 | + $propName = ($propName) ? strtoupper($propName) : 'X-PROP'; |
|
6009 | + if (in_array($propName, array('ATTACH', 'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'DESCRIPTION', 'EXDATE', 'EXRULE', |
|
6010 | + 'FREEBUSY', 'RDATE', 'RELATED-TO', 'RESOURCES', 'RRULE', 'REQUEST-STATUS', 'TZNAME', 'X-PROP'))) { |
|
6011 | + if (!$propix) |
|
6012 | + $propix = (isset($this->propix[$propName])) ? $this->propix[$propName] + 2 : 1; |
|
6013 | 6013 | $this->propix[$propName] = --$propix; |
6014 | 6014 | } |
6015 | - switch( $propName ) { |
|
6015 | + switch ($propName) { |
|
6016 | 6016 | case 'ACTION': |
6017 | - if( !empty( $this->action['value'] )) return ( $inclParam ) ? $this->action : $this->action['value']; |
|
6017 | + if (!empty($this->action['value'])) return ($inclParam) ? $this->action : $this->action['value']; |
|
6018 | 6018 | break; |
6019 | 6019 | case 'ATTACH': |
6020 | - if( !isset( $this->attach[$propix] )) return FALSE; |
|
6021 | - return ( $inclParam ) ? $this->attach[$propix] : $this->attach[$propix]['value']; |
|
6020 | + if (!isset($this->attach[$propix])) return FALSE; |
|
6021 | + return ($inclParam) ? $this->attach[$propix] : $this->attach[$propix]['value']; |
|
6022 | 6022 | break; |
6023 | 6023 | case 'ATTENDEE': |
6024 | - if( !isset( $this->attendee[$propix] )) return FALSE; |
|
6025 | - return ( $inclParam ) ? $this->attendee[$propix] : $this->attendee[$propix]['value']; |
|
6024 | + if (!isset($this->attendee[$propix])) return FALSE; |
|
6025 | + return ($inclParam) ? $this->attendee[$propix] : $this->attendee[$propix]['value']; |
|
6026 | 6026 | break; |
6027 | 6027 | case 'CATEGORIES': |
6028 | - if( !isset( $this->categories[$propix] )) return FALSE; |
|
6029 | - return ( $inclParam ) ? $this->categories[$propix] : $this->categories[$propix]['value']; |
|
6028 | + if (!isset($this->categories[$propix])) return FALSE; |
|
6029 | + return ($inclParam) ? $this->categories[$propix] : $this->categories[$propix]['value']; |
|
6030 | 6030 | break; |
6031 | 6031 | case 'CLASS': |
6032 | - if( !empty( $this->class['value'] )) return ( $inclParam ) ? $this->class : $this->class['value']; |
|
6032 | + if (!empty($this->class['value'])) return ($inclParam) ? $this->class : $this->class['value']; |
|
6033 | 6033 | break; |
6034 | 6034 | case 'COMMENT': |
6035 | - if( !isset( $this->comment[$propix] )) return FALSE; |
|
6036 | - return ( $inclParam ) ? $this->comment[$propix] : $this->comment[$propix]['value']; |
|
6035 | + if (!isset($this->comment[$propix])) return FALSE; |
|
6036 | + return ($inclParam) ? $this->comment[$propix] : $this->comment[$propix]['value']; |
|
6037 | 6037 | break; |
6038 | 6038 | case 'COMPLETED': |
6039 | - if( !empty( $this->completed['value'] )) return ( $inclParam ) ? $this->completed : $this->completed['value']; |
|
6039 | + if (!empty($this->completed['value'])) return ($inclParam) ? $this->completed : $this->completed['value']; |
|
6040 | 6040 | break; |
6041 | 6041 | case 'CONTACT': |
6042 | - if( !isset( $this->contact[$propix] )) return FALSE; |
|
6043 | - return ( $inclParam ) ? $this->contact[$propix] : $this->contact[$propix]['value']; |
|
6042 | + if (!isset($this->contact[$propix])) return FALSE; |
|
6043 | + return ($inclParam) ? $this->contact[$propix] : $this->contact[$propix]['value']; |
|
6044 | 6044 | break; |
6045 | 6045 | case 'CREATED': |
6046 | - if( !empty( $this->created['value'] )) return ( $inclParam ) ? $this->created : $this->created['value']; |
|
6046 | + if (!empty($this->created['value'])) return ($inclParam) ? $this->created : $this->created['value']; |
|
6047 | 6047 | break; |
6048 | 6048 | case 'DESCRIPTION': |
6049 | - if( !isset( $this->description[$propix] )) return FALSE; |
|
6050 | - return ( $inclParam ) ? $this->description[$propix] : $this->description[$propix]['value']; |
|
6049 | + if (!isset($this->description[$propix])) return FALSE; |
|
6050 | + return ($inclParam) ? $this->description[$propix] : $this->description[$propix]['value']; |
|
6051 | 6051 | break; |
6052 | 6052 | case 'DTEND': |
6053 | - if( !empty( $this->dtend['value'] )) return ( $inclParam ) ? $this->dtend : $this->dtend['value']; |
|
6053 | + if (!empty($this->dtend['value'])) return ($inclParam) ? $this->dtend : $this->dtend['value']; |
|
6054 | 6054 | break; |
6055 | 6055 | case 'DTSTAMP': |
6056 | - if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' ))) |
|
6056 | + if (in_array($this->objName, array('valarm', 'vtimezone', 'standard', 'daylight'))) |
|
6057 | 6057 | return; |
6058 | - if( !isset( $this->dtstamp['value'] )) |
|
6058 | + if (!isset($this->dtstamp['value'])) |
|
6059 | 6059 | $this->_makeDtstamp(); |
6060 | - return ( $inclParam ) ? $this->dtstamp : $this->dtstamp['value']; |
|
6060 | + return ($inclParam) ? $this->dtstamp : $this->dtstamp['value']; |
|
6061 | 6061 | break; |
6062 | 6062 | case 'DTSTART': |
6063 | - if( !empty( $this->dtstart['value'] )) return ( $inclParam ) ? $this->dtstart : $this->dtstart['value']; |
|
6063 | + if (!empty($this->dtstart['value'])) return ($inclParam) ? $this->dtstart : $this->dtstart['value']; |
|
6064 | 6064 | break; |
6065 | 6065 | case 'DUE': |
6066 | - if( !empty( $this->due['value'] )) return ( $inclParam ) ? $this->due : $this->due['value']; |
|
6066 | + if (!empty($this->due['value'])) return ($inclParam) ? $this->due : $this->due['value']; |
|
6067 | 6067 | break; |
6068 | 6068 | case 'DURATION': |
6069 | - if( !isset( $this->duration['value'] )) return FALSE; |
|
6070 | - $value = ( $specform ) ? $this->duration2date() : $this->duration['value']; |
|
6071 | - return ( $inclParam ) ? array( 'value' => $value, 'params' => $this->duration['params'] ) : $value; |
|
6069 | + if (!isset($this->duration['value'])) return FALSE; |
|
6070 | + $value = ($specform) ? $this->duration2date() : $this->duration['value']; |
|
6071 | + return ($inclParam) ? array('value' => $value, 'params' => $this->duration['params']) : $value; |
|
6072 | 6072 | break; |
6073 | 6073 | case 'EXDATE': |
6074 | - if( !isset( $this->exdate[$propix] )) return FALSE; |
|
6075 | - return ( $inclParam ) ? $this->exdate[$propix] : $this->exdate[$propix]['value']; |
|
6074 | + if (!isset($this->exdate[$propix])) return FALSE; |
|
6075 | + return ($inclParam) ? $this->exdate[$propix] : $this->exdate[$propix]['value']; |
|
6076 | 6076 | break; |
6077 | 6077 | case 'EXRULE': |
6078 | - if( !isset( $this->exrule[$propix] )) return FALSE; |
|
6079 | - return ( $inclParam ) ? $this->exrule[$propix] : $this->exrule[$propix]['value']; |
|
6078 | + if (!isset($this->exrule[$propix])) return FALSE; |
|
6079 | + return ($inclParam) ? $this->exrule[$propix] : $this->exrule[$propix]['value']; |
|
6080 | 6080 | break; |
6081 | 6081 | case 'FREEBUSY': |
6082 | - if( !isset( $this->freebusy[$propix] )) return FALSE; |
|
6083 | - return ( $inclParam ) ? $this->freebusy[$propix] : $this->freebusy[$propix]['value']; |
|
6082 | + if (!isset($this->freebusy[$propix])) return FALSE; |
|
6083 | + return ($inclParam) ? $this->freebusy[$propix] : $this->freebusy[$propix]['value']; |
|
6084 | 6084 | break; |
6085 | 6085 | case 'GEO': |
6086 | - if( !empty( $this->geo['value'] )) return ( $inclParam ) ? $this->geo : $this->geo['value']; |
|
6086 | + if (!empty($this->geo['value'])) return ($inclParam) ? $this->geo : $this->geo['value']; |
|
6087 | 6087 | break; |
6088 | 6088 | case 'LAST-MODIFIED': |
6089 | - if( !empty( $this->lastmodified['value'] )) return ( $inclParam ) ? $this->lastmodified : $this->lastmodified['value']; |
|
6089 | + if (!empty($this->lastmodified['value'])) return ($inclParam) ? $this->lastmodified : $this->lastmodified['value']; |
|
6090 | 6090 | break; |
6091 | 6091 | case 'LOCATION': |
6092 | - if( !empty( $this->location['value'] )) return ( $inclParam ) ? $this->location : $this->location['value']; |
|
6092 | + if (!empty($this->location['value'])) return ($inclParam) ? $this->location : $this->location['value']; |
|
6093 | 6093 | break; |
6094 | 6094 | case 'ORGANIZER': |
6095 | - if( !empty( $this->organizer['value'] )) return ( $inclParam ) ? $this->organizer : $this->organizer['value']; |
|
6095 | + if (!empty($this->organizer['value'])) return ($inclParam) ? $this->organizer : $this->organizer['value']; |
|
6096 | 6096 | break; |
6097 | 6097 | case 'PERCENT-COMPLETE': |
6098 | - if( !empty( $this->percentcomplete['value'] )) return ( $inclParam ) ? $this->percentcomplete : $this->percentcomplete['value']; |
|
6098 | + if (!empty($this->percentcomplete['value'])) return ($inclParam) ? $this->percentcomplete : $this->percentcomplete['value']; |
|
6099 | 6099 | break; |
6100 | 6100 | case 'PRIORITY': |
6101 | - if( !empty( $this->priority['value'] )) return ( $inclParam ) ? $this->priority : $this->priority['value']; |
|
6101 | + if (!empty($this->priority['value'])) return ($inclParam) ? $this->priority : $this->priority['value']; |
|
6102 | 6102 | break; |
6103 | 6103 | case 'RDATE': |
6104 | - if( !isset( $this->rdate[$propix] )) return FALSE; |
|
6105 | - return ( $inclParam ) ? $this->rdate[$propix] : $this->rdate[$propix]['value']; |
|
6104 | + if (!isset($this->rdate[$propix])) return FALSE; |
|
6105 | + return ($inclParam) ? $this->rdate[$propix] : $this->rdate[$propix]['value']; |
|
6106 | 6106 | break; |
6107 | 6107 | case 'RECURRENCE-ID': |
6108 | - if( !empty( $this->recurrenceid['value'] )) return ( $inclParam ) ? $this->recurrenceid : $this->recurrenceid['value']; |
|
6108 | + if (!empty($this->recurrenceid['value'])) return ($inclParam) ? $this->recurrenceid : $this->recurrenceid['value']; |
|
6109 | 6109 | break; |
6110 | 6110 | case 'RELATED-TO': |
6111 | - if( !isset( $this->relatedto[$propix] )) return FALSE; |
|
6112 | - return ( $inclParam ) ? $this->relatedto[$propix] : $this->relatedto[$propix]['value']; |
|
6111 | + if (!isset($this->relatedto[$propix])) return FALSE; |
|
6112 | + return ($inclParam) ? $this->relatedto[$propix] : $this->relatedto[$propix]['value']; |
|
6113 | 6113 | break; |
6114 | 6114 | case 'REPEAT': |
6115 | - if( !empty( $this->repeat['value'] )) return ( $inclParam ) ? $this->repeat : $this->repeat['value']; |
|
6115 | + if (!empty($this->repeat['value'])) return ($inclParam) ? $this->repeat : $this->repeat['value']; |
|
6116 | 6116 | break; |
6117 | 6117 | case 'REQUEST-STATUS': |
6118 | - if( !isset( $this->requeststatus[$propix] )) return FALSE; |
|
6119 | - return ( $inclParam ) ? $this->requeststatus[$propix] : $this->requeststatus[$propix]['value']; |
|
6118 | + if (!isset($this->requeststatus[$propix])) return FALSE; |
|
6119 | + return ($inclParam) ? $this->requeststatus[$propix] : $this->requeststatus[$propix]['value']; |
|
6120 | 6120 | break; |
6121 | 6121 | case 'RESOURCES': |
6122 | - if( !isset( $this->resources[$propix] )) return FALSE; |
|
6123 | - return ( $inclParam ) ? $this->resources[$propix] : $this->resources[$propix]['value']; |
|
6122 | + if (!isset($this->resources[$propix])) return FALSE; |
|
6123 | + return ($inclParam) ? $this->resources[$propix] : $this->resources[$propix]['value']; |
|
6124 | 6124 | break; |
6125 | 6125 | case 'RRULE': |
6126 | - if( !isset( $this->rrule[$propix] )) return FALSE; |
|
6127 | - return ( $inclParam ) ? $this->rrule[$propix] : $this->rrule[$propix]['value']; |
|
6126 | + if (!isset($this->rrule[$propix])) return FALSE; |
|
6127 | + return ($inclParam) ? $this->rrule[$propix] : $this->rrule[$propix]['value']; |
|
6128 | 6128 | break; |
6129 | 6129 | case 'SEQUENCE': |
6130 | - if( !empty( $this->sequence['value'] )) return ( $inclParam ) ? $this->sequence : $this->sequence['value']; |
|
6130 | + if (!empty($this->sequence['value'])) return ($inclParam) ? $this->sequence : $this->sequence['value']; |
|
6131 | 6131 | break; |
6132 | 6132 | case 'STATUS': |
6133 | - if( !empty( $this->status['value'] )) return ( $inclParam ) ? $this->status : $this->status['value']; |
|
6133 | + if (!empty($this->status['value'])) return ($inclParam) ? $this->status : $this->status['value']; |
|
6134 | 6134 | break; |
6135 | 6135 | case 'SUMMARY': |
6136 | - if( !empty( $this->summary['value'] )) return ( $inclParam ) ? $this->summary : $this->summary['value']; |
|
6136 | + if (!empty($this->summary['value'])) return ($inclParam) ? $this->summary : $this->summary['value']; |
|
6137 | 6137 | break; |
6138 | 6138 | case 'TRANSP': |
6139 | - if( !empty( $this->transp['value'] )) return ( $inclParam ) ? $this->transp : $this->transp['value']; |
|
6139 | + if (!empty($this->transp['value'])) return ($inclParam) ? $this->transp : $this->transp['value']; |
|
6140 | 6140 | break; |
6141 | 6141 | case 'TRIGGER': |
6142 | - if( !empty( $this->trigger['value'] )) return ( $inclParam ) ? $this->trigger : $this->trigger['value']; |
|
6142 | + if (!empty($this->trigger['value'])) return ($inclParam) ? $this->trigger : $this->trigger['value']; |
|
6143 | 6143 | break; |
6144 | 6144 | case 'TZID': |
6145 | - if( !empty( $this->tzid['value'] )) return ( $inclParam ) ? $this->tzid : $this->tzid['value']; |
|
6145 | + if (!empty($this->tzid['value'])) return ($inclParam) ? $this->tzid : $this->tzid['value']; |
|
6146 | 6146 | break; |
6147 | 6147 | case 'TZNAME': |
6148 | - if( !isset( $this->tzname[$propix] )) return FALSE; |
|
6149 | - return ( $inclParam ) ? $this->tzname[$propix] : $this->tzname[$propix]['value']; |
|
6148 | + if (!isset($this->tzname[$propix])) return FALSE; |
|
6149 | + return ($inclParam) ? $this->tzname[$propix] : $this->tzname[$propix]['value']; |
|
6150 | 6150 | break; |
6151 | 6151 | case 'TZOFFSETFROM': |
6152 | - if( !empty( $this->tzoffsetfrom['value'] )) return ( $inclParam ) ? $this->tzoffsetfrom : $this->tzoffsetfrom['value']; |
|
6152 | + if (!empty($this->tzoffsetfrom['value'])) return ($inclParam) ? $this->tzoffsetfrom : $this->tzoffsetfrom['value']; |
|
6153 | 6153 | break; |
6154 | 6154 | case 'TZOFFSETTO': |
6155 | - if( !empty( $this->tzoffsetto['value'] )) return ( $inclParam ) ? $this->tzoffsetto : $this->tzoffsetto['value']; |
|
6155 | + if (!empty($this->tzoffsetto['value'])) return ($inclParam) ? $this->tzoffsetto : $this->tzoffsetto['value']; |
|
6156 | 6156 | break; |
6157 | 6157 | case 'TZURL': |
6158 | - if( !empty( $this->tzurl['value'] )) return ( $inclParam ) ? $this->tzurl : $this->tzurl['value']; |
|
6158 | + if (!empty($this->tzurl['value'])) return ($inclParam) ? $this->tzurl : $this->tzurl['value']; |
|
6159 | 6159 | break; |
6160 | 6160 | case 'UID': |
6161 | - if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' ))) |
|
6161 | + if (in_array($this->objName, array('valarm', 'vtimezone', 'standard', 'daylight'))) |
|
6162 | 6162 | return FALSE; |
6163 | - if( empty( $this->uid['value'] )) |
|
6163 | + if (empty($this->uid['value'])) |
|
6164 | 6164 | $this->_makeuid(); |
6165 | - return ( $inclParam ) ? $this->uid : $this->uid['value']; |
|
6165 | + return ($inclParam) ? $this->uid : $this->uid['value']; |
|
6166 | 6166 | break; |
6167 | 6167 | case 'URL': |
6168 | - if( !empty( $this->url['value'] )) return ( $inclParam ) ? $this->url : $this->url['value']; |
|
6168 | + if (!empty($this->url['value'])) return ($inclParam) ? $this->url : $this->url['value']; |
|
6169 | 6169 | break; |
6170 | 6170 | default: |
6171 | - if( $propName != 'X-PROP' ) { |
|
6172 | - if( !isset( $this->xprop[$propName] )) return FALSE; |
|
6173 | - return ( $inclParam ) ? array( $propName, $this->xprop[$propName] ) |
|
6174 | - : array( $propName, $this->xprop[$propName]['value'] ); |
|
6171 | + if ($propName != 'X-PROP') { |
|
6172 | + if (!isset($this->xprop[$propName])) return FALSE; |
|
6173 | + return ($inclParam) ? array($propName, $this->xprop[$propName]) |
|
6174 | + : array($propName, $this->xprop[$propName]['value']); |
|
6175 | 6175 | } |
6176 | 6176 | else { |
6177 | - if( empty( $this->xprop )) return FALSE; |
|
6177 | + if (empty($this->xprop)) return FALSE; |
|
6178 | 6178 | $xpropno = 0; |
6179 | - foreach( $this->xprop as $xpropkey => $xpropvalue ) { |
|
6180 | - if( $propix == $xpropno ) |
|
6181 | - return ( $inclParam ) ? array( $xpropkey, $this->xprop[$xpropkey] ) |
|
6182 | - : array( $xpropkey, $this->xprop[$xpropkey]['value'] ); |
|
6179 | + foreach ($this->xprop as $xpropkey => $xpropvalue) { |
|
6180 | + if ($propix == $xpropno) |
|
6181 | + return ($inclParam) ? array($xpropkey, $this->xprop[$xpropkey]) |
|
6182 | + : array($xpropkey, $this->xprop[$xpropkey]['value']); |
|
6183 | 6183 | else |
6184 | 6184 | $xpropno++; |
6185 | 6185 | } |
@@ -6200,105 +6200,105 @@ discard block |
||
6200 | 6200 | */ |
6201 | 6201 | function setProperty() { |
6202 | 6202 | $numargs = func_num_args(); |
6203 | - if( 1 > $numargs ) return FALSE; |
|
6203 | + if (1 > $numargs) return FALSE; |
|
6204 | 6204 | $arglist = func_get_args(); |
6205 | - if( $this->_notExistProp( $arglist[0] )) return FALSE; |
|
6206 | - if( !$this->getConfig( 'allowEmpty' ) && ( !isset( $arglist[1] ) || empty( $arglist[1] ))) |
|
6205 | + if ($this->_notExistProp($arglist[0])) return FALSE; |
|
6206 | + if (!$this->getConfig('allowEmpty') && (!isset($arglist[1]) || empty($arglist[1]))) |
|
6207 | 6207 | return FALSE; |
6208 | - $arglist[0] = strtoupper( $arglist[0] ); |
|
6209 | - for( $argix=$numargs; $argix < 12; $argix++ ) { |
|
6210 | - if( !isset( $arglist[$argix] )) |
|
6208 | + $arglist[0] = strtoupper($arglist[0]); |
|
6209 | + for ($argix = $numargs; $argix < 12; $argix++) { |
|
6210 | + if (!isset($arglist[$argix])) |
|
6211 | 6211 | $arglist[$argix] = null; |
6212 | 6212 | } |
6213 | - switch( $arglist[0] ) { |
|
6213 | + switch ($arglist[0]) { |
|
6214 | 6214 | case 'ACTION': |
6215 | - return $this->setAction( $arglist[1], $arglist[2] ); |
|
6215 | + return $this->setAction($arglist[1], $arglist[2]); |
|
6216 | 6216 | case 'ATTACH': |
6217 | - return $this->setAttach( $arglist[1], $arglist[2], $arglist[3] ); |
|
6217 | + return $this->setAttach($arglist[1], $arglist[2], $arglist[3]); |
|
6218 | 6218 | case 'ATTENDEE': |
6219 | - return $this->setAttendee( $arglist[1], $arglist[2], $arglist[3] ); |
|
6219 | + return $this->setAttendee($arglist[1], $arglist[2], $arglist[3]); |
|
6220 | 6220 | case 'CATEGORIES': |
6221 | - return $this->setCategories( $arglist[1], $arglist[2], $arglist[3] ); |
|
6221 | + return $this->setCategories($arglist[1], $arglist[2], $arglist[3]); |
|
6222 | 6222 | case 'CLASS': |
6223 | - return $this->setClass( $arglist[1], $arglist[2] ); |
|
6223 | + return $this->setClass($arglist[1], $arglist[2]); |
|
6224 | 6224 | case 'COMMENT': |
6225 | - return $this->setComment( $arglist[1], $arglist[2], $arglist[3] ); |
|
6225 | + return $this->setComment($arglist[1], $arglist[2], $arglist[3]); |
|
6226 | 6226 | case 'COMPLETED': |
6227 | - return $this->setCompleted( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] ); |
|
6227 | + return $this->setCompleted($arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7]); |
|
6228 | 6228 | case 'CONTACT': |
6229 | - return $this->setContact( $arglist[1], $arglist[2], $arglist[3] ); |
|
6229 | + return $this->setContact($arglist[1], $arglist[2], $arglist[3]); |
|
6230 | 6230 | case 'CREATED': |
6231 | - return $this->setCreated( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] ); |
|
6231 | + return $this->setCreated($arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7]); |
|
6232 | 6232 | case 'DESCRIPTION': |
6233 | - return $this->setDescription( $arglist[1], $arglist[2], $arglist[3] ); |
|
6233 | + return $this->setDescription($arglist[1], $arglist[2], $arglist[3]); |
|
6234 | 6234 | case 'DTEND': |
6235 | - return $this->setDtend( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] ); |
|
6235 | + return $this->setDtend($arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8]); |
|
6236 | 6236 | case 'DTSTAMP': |
6237 | - return $this->setDtstamp( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] ); |
|
6237 | + return $this->setDtstamp($arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7]); |
|
6238 | 6238 | case 'DTSTART': |
6239 | - return $this->setDtstart( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] ); |
|
6239 | + return $this->setDtstart($arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8]); |
|
6240 | 6240 | case 'DUE': |
6241 | - return $this->setDue( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] ); |
|
6241 | + return $this->setDue($arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8]); |
|
6242 | 6242 | case 'DURATION': |
6243 | - return $this->setDuration( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6] ); |
|
6243 | + return $this->setDuration($arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6]); |
|
6244 | 6244 | case 'EXDATE': |
6245 | - return $this->setExdate( $arglist[1], $arglist[2], $arglist[3] ); |
|
6245 | + return $this->setExdate($arglist[1], $arglist[2], $arglist[3]); |
|
6246 | 6246 | case 'EXRULE': |
6247 | - return $this->setExrule( $arglist[1], $arglist[2], $arglist[3] ); |
|
6247 | + return $this->setExrule($arglist[1], $arglist[2], $arglist[3]); |
|
6248 | 6248 | case 'FREEBUSY': |
6249 | - return $this->setFreebusy( $arglist[1], $arglist[2], $arglist[3], $arglist[4] ); |
|
6249 | + return $this->setFreebusy($arglist[1], $arglist[2], $arglist[3], $arglist[4]); |
|
6250 | 6250 | case 'GEO': |
6251 | - return $this->setGeo( $arglist[1], $arglist[2], $arglist[3] ); |
|
6251 | + return $this->setGeo($arglist[1], $arglist[2], $arglist[3]); |
|
6252 | 6252 | case 'LAST-MODIFIED': |
6253 | - return $this->setLastModified( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] ); |
|
6253 | + return $this->setLastModified($arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7]); |
|
6254 | 6254 | case 'LOCATION': |
6255 | - return $this->setLocation( $arglist[1], $arglist[2] ); |
|
6255 | + return $this->setLocation($arglist[1], $arglist[2]); |
|
6256 | 6256 | case 'ORGANIZER': |
6257 | - return $this->setOrganizer( $arglist[1], $arglist[2] ); |
|
6257 | + return $this->setOrganizer($arglist[1], $arglist[2]); |
|
6258 | 6258 | case 'PERCENT-COMPLETE': |
6259 | - return $this->setPercentComplete( $arglist[1], $arglist[2] ); |
|
6259 | + return $this->setPercentComplete($arglist[1], $arglist[2]); |
|
6260 | 6260 | case 'PRIORITY': |
6261 | - return $this->setPriority( $arglist[1], $arglist[2] ); |
|
6261 | + return $this->setPriority($arglist[1], $arglist[2]); |
|
6262 | 6262 | case 'RDATE': |
6263 | - return $this->setRdate( $arglist[1], $arglist[2], $arglist[3] ); |
|
6263 | + return $this->setRdate($arglist[1], $arglist[2], $arglist[3]); |
|
6264 | 6264 | case 'RECURRENCE-ID': |
6265 | - return $this->setRecurrenceid( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] ); |
|
6265 | + return $this->setRecurrenceid($arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8]); |
|
6266 | 6266 | case 'RELATED-TO': |
6267 | - return $this->setRelatedTo( $arglist[1], $arglist[2], $arglist[3] ); |
|
6267 | + return $this->setRelatedTo($arglist[1], $arglist[2], $arglist[3]); |
|
6268 | 6268 | case 'REPEAT': |
6269 | - return $this->setRepeat( $arglist[1], $arglist[2] ); |
|
6269 | + return $this->setRepeat($arglist[1], $arglist[2]); |
|
6270 | 6270 | case 'REQUEST-STATUS': |
6271 | - return $this->setRequestStatus( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5] ); |
|
6271 | + return $this->setRequestStatus($arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5]); |
|
6272 | 6272 | case 'RESOURCES': |
6273 | - return $this->setResources( $arglist[1], $arglist[2], $arglist[3] ); |
|
6273 | + return $this->setResources($arglist[1], $arglist[2], $arglist[3]); |
|
6274 | 6274 | case 'RRULE': |
6275 | - return $this->setRrule( $arglist[1], $arglist[2], $arglist[3] ); |
|
6275 | + return $this->setRrule($arglist[1], $arglist[2], $arglist[3]); |
|
6276 | 6276 | case 'SEQUENCE': |
6277 | - return $this->setSequence( $arglist[1], $arglist[2] ); |
|
6277 | + return $this->setSequence($arglist[1], $arglist[2]); |
|
6278 | 6278 | case 'STATUS': |
6279 | - return $this->setStatus( $arglist[1], $arglist[2] ); |
|
6279 | + return $this->setStatus($arglist[1], $arglist[2]); |
|
6280 | 6280 | case 'SUMMARY': |
6281 | - return $this->setSummary( $arglist[1], $arglist[2] ); |
|
6281 | + return $this->setSummary($arglist[1], $arglist[2]); |
|
6282 | 6282 | case 'TRANSP': |
6283 | - return $this->setTransp( $arglist[1], $arglist[2] ); |
|
6283 | + return $this->setTransp($arglist[1], $arglist[2]); |
|
6284 | 6284 | case 'TRIGGER': |
6285 | - return $this->setTrigger( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8], $arglist[9], $arglist[10], $arglist[11] ); |
|
6285 | + return $this->setTrigger($arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8], $arglist[9], $arglist[10], $arglist[11]); |
|
6286 | 6286 | case 'TZID': |
6287 | - return $this->setTzid( $arglist[1], $arglist[2] ); |
|
6287 | + return $this->setTzid($arglist[1], $arglist[2]); |
|
6288 | 6288 | case 'TZNAME': |
6289 | - return $this->setTzname( $arglist[1], $arglist[2], $arglist[3] ); |
|
6289 | + return $this->setTzname($arglist[1], $arglist[2], $arglist[3]); |
|
6290 | 6290 | case 'TZOFFSETFROM': |
6291 | - return $this->setTzoffsetfrom( $arglist[1], $arglist[2] ); |
|
6291 | + return $this->setTzoffsetfrom($arglist[1], $arglist[2]); |
|
6292 | 6292 | case 'TZOFFSETTO': |
6293 | - return $this->setTzoffsetto( $arglist[1], $arglist[2] ); |
|
6293 | + return $this->setTzoffsetto($arglist[1], $arglist[2]); |
|
6294 | 6294 | case 'TZURL': |
6295 | - return $this->setTzurl( $arglist[1], $arglist[2] ); |
|
6295 | + return $this->setTzurl($arglist[1], $arglist[2]); |
|
6296 | 6296 | case 'UID': |
6297 | - return $this->setUid( $arglist[1], $arglist[2] ); |
|
6297 | + return $this->setUid($arglist[1], $arglist[2]); |
|
6298 | 6298 | case 'URL': |
6299 | - return $this->setUrl( $arglist[1], $arglist[2] ); |
|
6299 | + return $this->setUrl($arglist[1], $arglist[2]); |
|
6300 | 6300 | default: |
6301 | - return $this->setXprop( $arglist[0], $arglist[1], $arglist[2] ); |
|
6301 | + return $this->setXprop($arglist[0], $arglist[1], $arglist[2]); |
|
6302 | 6302 | } |
6303 | 6303 | return FALSE; |
6304 | 6304 | } |
@@ -6312,18 +6312,18 @@ discard block |
||
6312 | 6312 | * @return bool FALSE if error occurs during parsing |
6313 | 6313 | * |
6314 | 6314 | */ |
6315 | - function parse( $unparsedtext=null ) { |
|
6316 | - if( $unparsedtext ) { |
|
6315 | + function parse($unparsedtext = null) { |
|
6316 | + if ($unparsedtext) { |
|
6317 | 6317 | $this->unparsed = array(); |
6318 | - if( is_array( $unparsedtext )) { |
|
6318 | + if (is_array($unparsedtext)) { |
|
6319 | 6319 | $comp = & $this; |
6320 | - foreach ( $unparsedtext as $line ) { |
|
6321 | - if( 'END:VALARM' == strtoupper( substr( $line, 0, 10 ))) { |
|
6322 | - $this->setComponent( $comp ); |
|
6323 | - $comp = & $this; |
|
6320 | + foreach ($unparsedtext as $line) { |
|
6321 | + if ('END:VALARM' == strtoupper(substr($line, 0, 10))) { |
|
6322 | + $this->setComponent($comp); |
|
6323 | + $comp = & $this; |
|
6324 | 6324 | continue; |
6325 | 6325 | } |
6326 | - elseif( 'BEGIN:VALARM' == strtoupper( substr( $line, 0, 12 ))) { |
|
6326 | + elseif ('BEGIN:VALARM' == strtoupper(substr($line, 0, 12))) { |
|
6327 | 6327 | $comp = new valarm(); |
6328 | 6328 | continue; |
6329 | 6329 | } |
@@ -6332,217 +6332,217 @@ discard block |
||
6332 | 6332 | } |
6333 | 6333 | } |
6334 | 6334 | else |
6335 | - $this->unparsed = array( trim( $unparsedtext )); |
|
6335 | + $this->unparsed = array(trim($unparsedtext)); |
|
6336 | 6336 | } |
6337 | - elseif( !isset( $this->unparsed )) |
|
6337 | + elseif (!isset($this->unparsed)) |
|
6338 | 6338 | $this->unparsed = array(); |
6339 | 6339 | /* concatenate property values spread over several lines */ |
6340 | 6340 | $lastix = -1; |
6341 | - $propnames = array( 'action', 'attach', 'attendee', 'categories', 'comment', 'completed' |
|
6341 | + $propnames = array('action', 'attach', 'attendee', 'categories', 'comment', 'completed' |
|
6342 | 6342 | , 'contact', 'class', 'created', 'description', 'dtend', 'dtstart' |
6343 | 6343 | , 'dtstamp', 'due', 'duration', 'exdate', 'exrule', 'freebusy', 'geo' |
6344 | 6344 | , 'last-modified', 'location', 'organizer', 'percent-complete' |
6345 | 6345 | , 'priority', 'rdate', 'recurrence-id', 'related-to', 'repeat' |
6346 | 6346 | , 'request-status', 'resources', 'rrule', 'sequence', 'status' |
6347 | 6347 | , 'summary', 'transp', 'trigger', 'tzid', 'tzname', 'tzoffsetfrom' |
6348 | - , 'tzoffsetto', 'tzurl', 'uid', 'url', 'x-' ); |
|
6349 | - $proprows = array(); |
|
6350 | - foreach( $this->unparsed as $line ) { |
|
6348 | + , 'tzoffsetto', 'tzurl', 'uid', 'url', 'x-'); |
|
6349 | + $proprows = array(); |
|
6350 | + foreach ($this->unparsed as $line) { |
|
6351 | 6351 | $newProp = FALSE; |
6352 | - foreach ( $propnames as $propname ) { |
|
6353 | - if( $propname == strtolower( substr( $line, 0, strlen( $propname )))) { |
|
6352 | + foreach ($propnames as $propname) { |
|
6353 | + if ($propname == strtolower(substr($line, 0, strlen($propname)))) { |
|
6354 | 6354 | $newProp = TRUE; |
6355 | 6355 | break; |
6356 | 6356 | } |
6357 | 6357 | } |
6358 | - if( $newProp ) { |
|
6358 | + if ($newProp) { |
|
6359 | 6359 | $newProp = FALSE; |
6360 | 6360 | $lastix++; |
6361 | - $proprows[$lastix] = $line; |
|
6361 | + $proprows[$lastix] = $line; |
|
6362 | 6362 | } |
6363 | 6363 | else { |
6364 | 6364 | /* remove line breaks */ |
6365 | - if(( '\n' == substr( $proprows[$lastix], -2 )) && |
|
6366 | - ( ' ' == substr( $line, 0, 1 ))) { |
|
6367 | - $proprows[$lastix] = substr( $proprows[$lastix], 0, strlen( $proprows[$lastix] ) - 2 ); |
|
6368 | - $line = substr( $line, 1 ); |
|
6365 | + if (('\n' == substr($proprows[$lastix], -2)) && |
|
6366 | + (' ' == substr($line, 0, 1))) { |
|
6367 | + $proprows[$lastix] = substr($proprows[$lastix], 0, strlen($proprows[$lastix]) - 2); |
|
6368 | + $line = substr($line, 1); |
|
6369 | 6369 | } |
6370 | 6370 | $proprows[$lastix] .= $line; |
6371 | 6371 | } |
6372 | 6372 | } |
6373 | 6373 | /* parse each property 'line' */ |
6374 | - foreach( $proprows as $line ) { |
|
6375 | - $line = str_replace( "\n ", '', $line ); |
|
6376 | - if( '\n' == substr( $line, -2 )) |
|
6377 | - $line = substr( $line, 0, strlen( $line ) - 2 ); |
|
6374 | + foreach ($proprows as $line) { |
|
6375 | + $line = str_replace("\n ", '', $line); |
|
6376 | + if ('\n' == substr($line, -2)) |
|
6377 | + $line = substr($line, 0, strlen($line) - 2); |
|
6378 | 6378 | /* get propname, (problem with x-properties, otherwise in previous loop) */ |
6379 | 6379 | $cix = $propname = null; |
6380 | - for( $cix=0; $cix < strlen( $line ); $cix++ ) { |
|
6381 | - if( in_array( $line{$cix}, array( ':', ';' ))) |
|
6380 | + for ($cix = 0; $cix < strlen($line); $cix++) { |
|
6381 | + if (in_array($line{$cix}, array(':', ';'))) |
|
6382 | 6382 | break; |
6383 | 6383 | else { |
6384 | 6384 | $propname .= $line{$cix}; |
6385 | 6385 | } |
6386 | 6386 | } |
6387 | - if(( 'x-' == substr( $propname, 0, 2 )) || ( 'X-' == substr( $propname, 0, 2 ))) { |
|
6387 | + if (('x-' == substr($propname, 0, 2)) || ('X-' == substr($propname, 0, 2))) { |
|
6388 | 6388 | $propname2 = $propname; |
6389 | 6389 | $propname = 'X-'; |
6390 | 6390 | } |
6391 | 6391 | /* rest of the line is opt.params and value */ |
6392 | - $line = substr( $line, $cix ); |
|
6392 | + $line = substr($line, $cix); |
|
6393 | 6393 | /* separate attributes from value */ |
6394 | 6394 | $attr = array(); |
6395 | 6395 | $attrix = -1; |
6396 | - $strlen = strlen( $line ); |
|
6397 | - for( $cix=0; $cix < $strlen; $cix++ ) { |
|
6398 | - if(( ':' == $line{$cix} ) && |
|
6399 | - ( '://' != substr( $line, $cix, 3 )) && |
|
6400 | - ( 'mailto:' != strtolower( substr( $line, $cix - 6, 7 )))) { |
|
6396 | + $strlen = strlen($line); |
|
6397 | + for ($cix = 0; $cix < $strlen; $cix++) { |
|
6398 | + if ((':' == $line{$cix} ) && |
|
6399 | + ('://' != substr($line, $cix, 3)) && |
|
6400 | + ('mailto:' != strtolower(substr($line, $cix - 6, 7)))) { |
|
6401 | 6401 | $attrEnd = TRUE; |
6402 | - if(( $cix < ( $strlen - 4 )) && |
|
6403 | - ctype_digit( substr( $line, $cix+1, 4 ))) { // an URI with a (4pos) portnr?? |
|
6404 | - for( $c2ix = $cix; 3 < $c2ix; $c2ix-- ) { |
|
6405 | - if( '://' == substr( $line, $c2ix - 2, 3 )) { |
|
6402 | + if (($cix < ($strlen - 4)) && |
|
6403 | + ctype_digit(substr($line, $cix + 1, 4))) { // an URI with a (4pos) portnr?? |
|
6404 | + for ($c2ix = $cix; 3 < $c2ix; $c2ix--) { |
|
6405 | + if ('://' == substr($line, $c2ix - 2, 3)) { |
|
6406 | 6406 | $attrEnd = FALSE; |
6407 | 6407 | break; // an URI with a portnr!! |
6408 | 6408 | } |
6409 | 6409 | } |
6410 | 6410 | } |
6411 | - if( $attrEnd) { |
|
6412 | - $line = substr( $line, $cix + 1 ); |
|
6411 | + if ($attrEnd) { |
|
6412 | + $line = substr($line, $cix + 1); |
|
6413 | 6413 | break; |
6414 | 6414 | } |
6415 | 6415 | } |
6416 | - if( ';' == $line{$cix} ) |
|
6416 | + if (';' == $line{$cix} ) |
|
6417 | 6417 | $attr[++$attrix] = null; |
6418 | 6418 | else |
6419 | 6419 | $attr[$attrix] .= $line{$cix}; |
6420 | 6420 | } |
6421 | 6421 | /* make attributes in array format */ |
6422 | 6422 | $propattr = array(); |
6423 | - foreach( $attr as $attribute ) { |
|
6424 | - $attrsplit = explode( '=', $attribute, 2 ); |
|
6425 | - if( 1 < count( $attrsplit )) |
|
6423 | + foreach ($attr as $attribute) { |
|
6424 | + $attrsplit = explode('=', $attribute, 2); |
|
6425 | + if (1 < count($attrsplit)) |
|
6426 | 6426 | $propattr[$attrsplit[0]] = $attrsplit[1]; |
6427 | 6427 | else |
6428 | 6428 | $propattr[] = $attribute; |
6429 | 6429 | } |
6430 | 6430 | /* call setProperty( $propname.. . */ |
6431 | - switch( $propname ) { |
|
6431 | + switch ($propname) { |
|
6432 | 6432 | case 'ATTENDEE': |
6433 | - foreach( $propattr as $pix => $attr ) { |
|
6434 | - $attr2 = explode( ',', $attr ); |
|
6435 | - if( 1 < count( $attr2 )) |
|
6433 | + foreach ($propattr as $pix => $attr) { |
|
6434 | + $attr2 = explode(',', $attr); |
|
6435 | + if (1 < count($attr2)) |
|
6436 | 6436 | $propattr[$pix] = $attr2; |
6437 | 6437 | } |
6438 | - $this->setProperty( $propname, $line, $propattr ); |
|
6438 | + $this->setProperty($propname, $line, $propattr); |
|
6439 | 6439 | break; |
6440 | 6440 | case 'CATEGORIES': |
6441 | 6441 | case 'RESOURCES': |
6442 | - if( FALSE !== strpos( $line, ',' )) { |
|
6443 | - $content = explode( ',', $line ); |
|
6444 | - $clen = count( $content ); |
|
6445 | - for( $cix = 0; $cix < $clen; $cix++ ) { |
|
6446 | - if( "\\" == substr($content[$cix], -1)) { |
|
6442 | + if (FALSE !== strpos($line, ',')) { |
|
6443 | + $content = explode(',', $line); |
|
6444 | + $clen = count($content); |
|
6445 | + for ($cix = 0; $cix < $clen; $cix++) { |
|
6446 | + if ("\\" == substr($content[$cix], -1)) { |
|
6447 | 6447 | $content[$cix] .= ','.$content[$cix + 1]; |
6448 | 6448 | unset($content[$cix + 1]); |
6449 | 6449 | $cix++; |
6450 | 6450 | } |
6451 | 6451 | } |
6452 | - if( 1 < count( $content )) { |
|
6453 | - $content = array_values( $content ); |
|
6454 | - foreach( $content as $cix => $contentPart ) |
|
6455 | - $content[$cix] = $this->_strunrep( $contentPart ); |
|
6456 | - $this->setProperty( $propname, $content, $propattr ); |
|
6452 | + if (1 < count($content)) { |
|
6453 | + $content = array_values($content); |
|
6454 | + foreach ($content as $cix => $contentPart) |
|
6455 | + $content[$cix] = $this->_strunrep($contentPart); |
|
6456 | + $this->setProperty($propname, $content, $propattr); |
|
6457 | 6457 | break; |
6458 | 6458 | } |
6459 | 6459 | else |
6460 | - $line = reset( $content ); |
|
6460 | + $line = reset($content); |
|
6461 | 6461 | } |
6462 | 6462 | //no break |
6463 | 6463 | case 'X-': |
6464 | - $propname = ( isset( $propname2 )) ? $propname2 : $propname; |
|
6464 | + $propname = (isset($propname2)) ? $propname2 : $propname; |
|
6465 | 6465 | //no break |
6466 | 6466 | case 'COMMENT': |
6467 | 6467 | case 'CONTACT': |
6468 | 6468 | case 'DESCRIPTION': |
6469 | 6469 | case 'LOCATION': |
6470 | 6470 | case 'SUMMARY': |
6471 | - if( empty( $line )) |
|
6471 | + if (empty($line)) |
|
6472 | 6472 | $propattr = null; |
6473 | - $this->setProperty( $propname, $this->_strunrep( $line ), $propattr ); |
|
6474 | - unset( $propname2 ); |
|
6473 | + $this->setProperty($propname, $this->_strunrep($line), $propattr); |
|
6474 | + unset($propname2); |
|
6475 | 6475 | break; |
6476 | 6476 | case 'REQUEST-STATUS': |
6477 | - $values = explode( ';', $line, 3 ); |
|
6478 | - $values[1] = ( !isset( $values[1] )) ? null : $this->_strunrep( $values[1] ); |
|
6479 | - $values[2] = ( !isset( $values[2] )) ? null : $this->_strunrep( $values[2] ); |
|
6480 | - $this->setProperty( $propname |
|
6477 | + $values = explode(';', $line, 3); |
|
6478 | + $values[1] = (!isset($values[1])) ? null : $this->_strunrep($values[1]); |
|
6479 | + $values[2] = (!isset($values[2])) ? null : $this->_strunrep($values[2]); |
|
6480 | + $this->setProperty($propname |
|
6481 | 6481 | , $values[0] // statcode |
6482 | 6482 | , $values[1] // statdesc |
6483 | 6483 | , $values[2] // extdata |
6484 | - , $propattr ); |
|
6484 | + , $propattr); |
|
6485 | 6485 | break; |
6486 | 6486 | case 'FREEBUSY': |
6487 | - $fbtype = ( isset( $propattr['FBTYPE'] )) ? $propattr['FBTYPE'] : ''; // force setting default, if missing |
|
6488 | - unset( $propattr['FBTYPE'] ); |
|
6489 | - $values = explode( ',', $line ); |
|
6490 | - foreach( $values as $vix => $value ) { |
|
6491 | - $value2 = explode( '/', $value ); |
|
6492 | - if( 1 < count( $value2 )) |
|
6487 | + $fbtype = (isset($propattr['FBTYPE'])) ? $propattr['FBTYPE'] : ''; // force setting default, if missing |
|
6488 | + unset($propattr['FBTYPE']); |
|
6489 | + $values = explode(',', $line); |
|
6490 | + foreach ($values as $vix => $value) { |
|
6491 | + $value2 = explode('/', $value); |
|
6492 | + if (1 < count($value2)) |
|
6493 | 6493 | $values[$vix] = $value2; |
6494 | 6494 | } |
6495 | - $this->setProperty( $propname, $fbtype, $values, $propattr ); |
|
6495 | + $this->setProperty($propname, $fbtype, $values, $propattr); |
|
6496 | 6496 | break; |
6497 | 6497 | case 'GEO': |
6498 | - $value = explode( ';', $line, 2 ); |
|
6499 | - if( 2 > count( $value )) |
|
6498 | + $value = explode(';', $line, 2); |
|
6499 | + if (2 > count($value)) |
|
6500 | 6500 | $value[1] = null; |
6501 | - $this->setProperty( $propname, $value[0], $value[1], $propattr ); |
|
6501 | + $this->setProperty($propname, $value[0], $value[1], $propattr); |
|
6502 | 6502 | break; |
6503 | 6503 | case 'EXDATE': |
6504 | - $values = ( !empty( $line )) ? explode( ',', $line ) : null; |
|
6505 | - $this->setProperty( $propname, $values, $propattr ); |
|
6504 | + $values = (!empty($line)) ? explode(',', $line) : null; |
|
6505 | + $this->setProperty($propname, $values, $propattr); |
|
6506 | 6506 | break; |
6507 | 6507 | case 'RDATE': |
6508 | - if( empty( $line )) { |
|
6509 | - $this->setProperty( $propname, $line, $propattr ); |
|
6508 | + if (empty($line)) { |
|
6509 | + $this->setProperty($propname, $line, $propattr); |
|
6510 | 6510 | break; |
6511 | 6511 | } |
6512 | - $values = explode( ',', $line ); |
|
6513 | - foreach( $values as $vix => $value ) { |
|
6514 | - $value2 = explode( '/', $value ); |
|
6515 | - if( 1 < count( $value2 )) |
|
6512 | + $values = explode(',', $line); |
|
6513 | + foreach ($values as $vix => $value) { |
|
6514 | + $value2 = explode('/', $value); |
|
6515 | + if (1 < count($value2)) |
|
6516 | 6516 | $values[$vix] = $value2; |
6517 | 6517 | } |
6518 | - $this->setProperty( $propname, $values, $propattr ); |
|
6518 | + $this->setProperty($propname, $values, $propattr); |
|
6519 | 6519 | break; |
6520 | 6520 | case 'EXRULE': |
6521 | 6521 | case 'RRULE': |
6522 | - $values = explode( ';', $line ); |
|
6522 | + $values = explode(';', $line); |
|
6523 | 6523 | $recur = array(); |
6524 | - foreach( $values as $value2 ) { |
|
6525 | - if( empty( $value2 )) |
|
6524 | + foreach ($values as $value2) { |
|
6525 | + if (empty($value2)) |
|
6526 | 6526 | continue; // ;-char in ending position ??? |
6527 | - $value3 = explode( '=', $value2, 2 ); |
|
6528 | - $rulelabel = strtoupper( $value3[0] ); |
|
6529 | - switch( $rulelabel ) { |
|
6527 | + $value3 = explode('=', $value2, 2); |
|
6528 | + $rulelabel = strtoupper($value3[0]); |
|
6529 | + switch ($rulelabel) { |
|
6530 | 6530 | case 'BYDAY': |
6531 | - $value4 = explode( ',', $value3[1] ); |
|
6532 | - if( 1 < count( $value4 )) { |
|
6533 | - foreach( $value4 as $v5ix => $value5 ) { |
|
6531 | + $value4 = explode(',', $value3[1]); |
|
6532 | + if (1 < count($value4)) { |
|
6533 | + foreach ($value4 as $v5ix => $value5) { |
|
6534 | 6534 | $value6 = array(); |
6535 | 6535 | $dayno = $dayname = null; |
6536 | - $value5 = trim( (string) $value5 ); |
|
6537 | - if(( ctype_alpha( substr( $value5, -1 ))) && |
|
6538 | - ( ctype_alpha( substr( $value5, -2, 1 )))) { |
|
6539 | - $dayname = substr( $value5, -2, 2 ); |
|
6540 | - if( 2 < strlen( $value5 )) |
|
6541 | - $dayno = substr( $value5, 0, ( strlen( $value5 ) - 2 )); |
|
6536 | + $value5 = trim((string) $value5); |
|
6537 | + if ((ctype_alpha(substr($value5, -1))) && |
|
6538 | + (ctype_alpha(substr($value5, -2, 1)))) { |
|
6539 | + $dayname = substr($value5, -2, 2); |
|
6540 | + if (2 < strlen($value5)) |
|
6541 | + $dayno = substr($value5, 0, (strlen($value5) - 2)); |
|
6542 | 6542 | } |
6543 | - if( $dayno ) |
|
6543 | + if ($dayno) |
|
6544 | 6544 | $value6[] = $dayno; |
6545 | - if( $dayname ) |
|
6545 | + if ($dayname) |
|
6546 | 6546 | $value6['DAY'] = $dayname; |
6547 | 6547 | $value4[$v5ix] = $value6; |
6548 | 6548 | } |
@@ -6550,39 +6550,39 @@ discard block |
||
6550 | 6550 | else { |
6551 | 6551 | $value4 = array(); |
6552 | 6552 | $dayno = $dayname = null; |
6553 | - $value5 = trim( (string) $value3[1] ); |
|
6554 | - if(( ctype_alpha( substr( $value5, -1 ))) && |
|
6555 | - ( ctype_alpha( substr( $value5, -2, 1 )))) { |
|
6556 | - $dayname = substr( $value5, -2, 2 ); |
|
6557 | - if( 2 < strlen( $value5 )) |
|
6558 | - $dayno = substr( $value5, 0, ( strlen( $value5 ) - 2 )); |
|
6553 | + $value5 = trim((string) $value3[1]); |
|
6554 | + if ((ctype_alpha(substr($value5, -1))) && |
|
6555 | + (ctype_alpha(substr($value5, -2, 1)))) { |
|
6556 | + $dayname = substr($value5, -2, 2); |
|
6557 | + if (2 < strlen($value5)) |
|
6558 | + $dayno = substr($value5, 0, (strlen($value5) - 2)); |
|
6559 | 6559 | } |
6560 | - if( $dayno ) |
|
6560 | + if ($dayno) |
|
6561 | 6561 | $value4[] = $dayno; |
6562 | - if( $dayname ) |
|
6562 | + if ($dayname) |
|
6563 | 6563 | $value4['DAY'] = $dayname; |
6564 | 6564 | } |
6565 | 6565 | $recur[$rulelabel] = $value4; |
6566 | 6566 | break; |
6567 | 6567 | default: |
6568 | - $value4 = explode( ',', $value3[1] ); |
|
6569 | - if( 1 < count( $value4 )) |
|
6568 | + $value4 = explode(',', $value3[1]); |
|
6569 | + if (1 < count($value4)) |
|
6570 | 6570 | $value3[1] = $value4; |
6571 | 6571 | $recur[$rulelabel] = $value3[1]; |
6572 | 6572 | break; |
6573 | 6573 | } // end - switch $rulelabel |
6574 | 6574 | } // end - foreach( $values.. . |
6575 | - $this->setProperty( $propname, $recur, $propattr ); |
|
6575 | + $this->setProperty($propname, $recur, $propattr); |
|
6576 | 6576 | break; |
6577 | 6577 | default: |
6578 | - $this->setProperty( $propname, $line, $propattr ); |
|
6578 | + $this->setProperty($propname, $line, $propattr); |
|
6579 | 6579 | break; |
6580 | 6580 | } // end switch( $propname.. . |
6581 | 6581 | } // end - foreach( $proprows.. . |
6582 | - unset( $this->unparsed, $proprows ); |
|
6583 | - if( isset( $this->components ) && is_array( $this->components ) && ( 0 < count( $this->components ))) { |
|
6584 | - for( $six = 0; $six < count( $this->components ); $six++ ) { |
|
6585 | - if( !empty( $this->components[$six]->unparsed )) |
|
6582 | + unset($this->unparsed, $proprows); |
|
6583 | + if (isset($this->components) && is_array($this->components) && (0 < count($this->components))) { |
|
6584 | + for ($six = 0; $six < count($this->components); $six++) { |
|
6585 | + if (!empty($this->components[$six]->unparsed)) |
|
6586 | 6586 | $this->components[$six]->parse(); |
6587 | 6587 | } |
6588 | 6588 | } |
@@ -6599,7 +6599,7 @@ discard block |
||
6599 | 6599 | function copy() { |
6600 | 6600 | $serialized_contents = serialize($this); |
6601 | 6601 | $copy = unserialize($serialized_contents); |
6602 | - unset( $copy->propix ); |
|
6602 | + unset($copy->propix); |
|
6603 | 6603 | return $copy; |
6604 | 6604 | } |
6605 | 6605 | /*********************************************************************************/ |
@@ -6613,34 +6613,34 @@ discard block |
||
6613 | 6613 | * @param mixed $arg2 optional, ordno if arg1 = component type |
6614 | 6614 | * @return void |
6615 | 6615 | */ |
6616 | - function deleteComponent( $arg1, $arg2=FALSE ) { |
|
6617 | - if( !isset( $this->components )) return FALSE; |
|
6616 | + function deleteComponent($arg1, $arg2 = FALSE) { |
|
6617 | + if (!isset($this->components)) return FALSE; |
|
6618 | 6618 | $argType = $index = null; |
6619 | - if ( ctype_digit( (string) $arg1 )) { |
|
6619 | + if (ctype_digit((string) $arg1)) { |
|
6620 | 6620 | $argType = 'INDEX'; |
6621 | 6621 | $index = (int) $arg1 - 1; |
6622 | 6622 | } |
6623 | - elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) { |
|
6624 | - $argType = strtolower( $arg1 ); |
|
6625 | - $index = ( !empty( $arg2 ) && ctype_digit( (string) $arg2 )) ? (( int ) $arg2 - 1 ) : 0; |
|
6623 | + elseif ((strlen($arg1) <= strlen('vfreebusy')) && (FALSE === strpos($arg1, '@'))) { |
|
6624 | + $argType = strtolower($arg1); |
|
6625 | + $index = (!empty($arg2) && ctype_digit((string) $arg2)) ? ((int) $arg2 - 1) : 0; |
|
6626 | 6626 | } |
6627 | 6627 | $cix2dC = 0; |
6628 | - foreach ( $this->components as $cix => $component) { |
|
6629 | - if( empty( $component )) continue; |
|
6630 | - unset( $component->propix ); |
|
6631 | - if(( 'INDEX' == $argType ) && ( $index == $cix )) { |
|
6632 | - unset( $this->components[$cix] ); |
|
6628 | + foreach ($this->components as $cix => $component) { |
|
6629 | + if (empty($component)) continue; |
|
6630 | + unset($component->propix); |
|
6631 | + if (('INDEX' == $argType) && ($index == $cix)) { |
|
6632 | + unset($this->components[$cix]); |
|
6633 | 6633 | return TRUE; |
6634 | 6634 | } |
6635 | - elseif( $argType == $component->objName ) { |
|
6636 | - if( $index == $cix2dC ) { |
|
6637 | - unset( $this->components[$cix] ); |
|
6635 | + elseif ($argType == $component->objName) { |
|
6636 | + if ($index == $cix2dC) { |
|
6637 | + unset($this->components[$cix]); |
|
6638 | 6638 | return TRUE; |
6639 | 6639 | } |
6640 | 6640 | $cix2dC++; |
6641 | 6641 | } |
6642 | - elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) { |
|
6643 | - unset( $this->components[$cix] ); |
|
6642 | + elseif (!$argType && ($arg1 == $component->getProperty('uid'))) { |
|
6643 | + unset($this->components[$cix]); |
|
6644 | 6644 | return TRUE; |
6645 | 6645 | } |
6646 | 6646 | } |
@@ -6655,50 +6655,50 @@ discard block |
||
6655 | 6655 | * @param mixed $arg2 optional, ordno if arg1 = component type |
6656 | 6656 | * @return object |
6657 | 6657 | */ |
6658 | - function getComponent ( $arg1=FALSE, $arg2=FALSE ) { |
|
6659 | - if( !isset( $this->components )) return FALSE; |
|
6658 | + function getComponent($arg1 = FALSE, $arg2 = FALSE) { |
|
6659 | + if (!isset($this->components)) return FALSE; |
|
6660 | 6660 | $index = $argType = null; |
6661 | - if ( !$arg1 ) { |
|
6661 | + if (!$arg1) { |
|
6662 | 6662 | $argType = 'INDEX'; |
6663 | 6663 | $index = $this->compix['INDEX'] = |
6664 | - ( isset( $this->compix['INDEX'] )) ? $this->compix['INDEX'] + 1 : 1; |
|
6664 | + (isset($this->compix['INDEX'])) ? $this->compix['INDEX'] + 1 : 1; |
|
6665 | 6665 | } |
6666 | - elseif ( ctype_digit( (string) $arg1 )) { |
|
6666 | + elseif (ctype_digit((string) $arg1)) { |
|
6667 | 6667 | $argType = 'INDEX'; |
6668 | 6668 | $index = (int) $arg1; |
6669 | - unset( $this->compix ); |
|
6669 | + unset($this->compix); |
|
6670 | 6670 | } |
6671 | - elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) { |
|
6672 | - unset( $this->compix['INDEX'] ); |
|
6673 | - $argType = strtolower( $arg1 ); |
|
6674 | - if( !$arg2 ) |
|
6671 | + elseif ((strlen($arg1) <= strlen('vfreebusy')) && (FALSE === strpos($arg1, '@'))) { |
|
6672 | + unset($this->compix['INDEX']); |
|
6673 | + $argType = strtolower($arg1); |
|
6674 | + if (!$arg2) |
|
6675 | 6675 | $index = $this->compix[$argType] = |
6676 | - ( isset( $this->compix[$argType] )) ? $this->compix[$argType] + 1 : 1; |
|
6676 | + (isset($this->compix[$argType])) ? $this->compix[$argType] + 1 : 1; |
|
6677 | 6677 | else |
6678 | 6678 | $index = (int) $arg2; |
6679 | 6679 | } |
6680 | - $index -= 1; |
|
6681 | - $ckeys = array_keys( $this->components ); |
|
6682 | - if( !empty( $index) && ( $index > end( $ckeys ))) |
|
6680 | + $index -= 1; |
|
6681 | + $ckeys = array_keys($this->components); |
|
6682 | + if (!empty($index) && ($index > end($ckeys))) |
|
6683 | 6683 | return FALSE; |
6684 | 6684 | $cix2gC = 0; |
6685 | - foreach( $this->components as $cix => $component ) { |
|
6686 | - if( empty( $component )) continue; |
|
6687 | - unset( $component->propix ); |
|
6688 | - if(( 'INDEX' == $argType ) && ( $index == $cix )) |
|
6685 | + foreach ($this->components as $cix => $component) { |
|
6686 | + if (empty($component)) continue; |
|
6687 | + unset($component->propix); |
|
6688 | + if (('INDEX' == $argType) && ($index == $cix)) |
|
6689 | 6689 | return $component->copy(); |
6690 | - elseif( $argType == $component->objName ) { |
|
6691 | - if( $index == $cix2gC ) |
|
6690 | + elseif ($argType == $component->objName) { |
|
6691 | + if ($index == $cix2gC) |
|
6692 | 6692 | return $component->copy(); |
6693 | 6693 | $cix2gC++; |
6694 | 6694 | } |
6695 | - elseif( !$argType && ( $arg1 == $component->getProperty( 'uid' ))) { |
|
6696 | - unset( $component->propix ); |
|
6695 | + elseif (!$argType && ($arg1 == $component->getProperty('uid'))) { |
|
6696 | + unset($component->propix); |
|
6697 | 6697 | return $component->copy(); |
6698 | 6698 | } |
6699 | 6699 | } |
6700 | 6700 | /* not found.. . */ |
6701 | - unset( $this->compix ); |
|
6701 | + unset($this->compix); |
|
6702 | 6702 | return false; |
6703 | 6703 | } |
6704 | 6704 | /** |
@@ -6709,8 +6709,8 @@ discard block |
||
6709 | 6709 | * @param object $component calendar component |
6710 | 6710 | * @return void |
6711 | 6711 | */ |
6712 | - function addSubComponent ( $component ) { |
|
6713 | - $this->setComponent( $component ); |
|
6712 | + function addSubComponent($component) { |
|
6713 | + $this->setComponent($component); |
|
6714 | 6714 | } |
6715 | 6715 | /** |
6716 | 6716 | * add calendar component as subcomponent to container for subcomponents |
@@ -6722,49 +6722,49 @@ discard block |
||
6722 | 6722 | * @param mixed $arg2 optional, ordno if arg1 = component type |
6723 | 6723 | * @return bool |
6724 | 6724 | */ |
6725 | - function setComponent( $component, $arg1=FALSE, $arg2=FALSE ) { |
|
6726 | - if( !isset( $this->components )) return FALSE; |
|
6727 | - if( '' >= $component->getConfig( 'language')) |
|
6728 | - $component->setConfig( 'language', $this->getConfig( 'language' )); |
|
6729 | - $component->setConfig( 'allowEmpty', $this->getConfig( 'allowEmpty' )); |
|
6730 | - $component->setConfig( 'nl', $this->getConfig( 'nl' )); |
|
6731 | - $component->setConfig( 'unique_id', $this->getConfig( 'unique_id' )); |
|
6732 | - $component->setConfig( 'format', $this->getConfig( 'format' )); |
|
6733 | - if( !in_array( $component->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' ))) { |
|
6734 | - unset( $component->propix ); |
|
6725 | + function setComponent($component, $arg1 = FALSE, $arg2 = FALSE) { |
|
6726 | + if (!isset($this->components)) return FALSE; |
|
6727 | + if ('' >= $component->getConfig('language')) |
|
6728 | + $component->setConfig('language', $this->getConfig('language')); |
|
6729 | + $component->setConfig('allowEmpty', $this->getConfig('allowEmpty')); |
|
6730 | + $component->setConfig('nl', $this->getConfig('nl')); |
|
6731 | + $component->setConfig('unique_id', $this->getConfig('unique_id')); |
|
6732 | + $component->setConfig('format', $this->getConfig('format')); |
|
6733 | + if (!in_array($component->objName, array('valarm', 'vtimezone', 'standard', 'daylight'))) { |
|
6734 | + unset($component->propix); |
|
6735 | 6735 | /* make sure dtstamp and uid is set */ |
6736 | - $dummy = $component->getProperty( 'dtstamp' ); |
|
6737 | - $dummy = $component->getProperty( 'uid' ); |
|
6736 | + $dummy = $component->getProperty('dtstamp'); |
|
6737 | + $dummy = $component->getProperty('uid'); |
|
6738 | 6738 | } |
6739 | - if( !$arg1 ) { |
|
6739 | + if (!$arg1) { |
|
6740 | 6740 | $this->components[] = $component->copy(); |
6741 | 6741 | return TRUE; |
6742 | 6742 | } |
6743 | 6743 | $argType = $index = null; |
6744 | - if ( ctype_digit( (string) $arg1 )) { |
|
6744 | + if (ctype_digit((string) $arg1)) { |
|
6745 | 6745 | $argType = 'INDEX'; |
6746 | 6746 | $index = (int) $arg1 - 1; |
6747 | 6747 | } |
6748 | - elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) { |
|
6749 | - $argType = strtolower( $arg1 ); |
|
6750 | - $index = ( ctype_digit( (string) $arg2 )) ? ((int) $arg2) - 1 : 0; |
|
6748 | + elseif ((strlen($arg1) <= strlen('vfreebusy')) && (FALSE === strpos($arg1, '@'))) { |
|
6749 | + $argType = strtolower($arg1); |
|
6750 | + $index = (ctype_digit((string) $arg2)) ? ((int) $arg2) - 1 : 0; |
|
6751 | 6751 | } |
6752 | 6752 | $cix2sC = 0; |
6753 | - foreach ( $this->components as $cix => $component2 ) { |
|
6754 | - if( empty( $component2 )) continue; |
|
6755 | - unset( $component2->propix ); |
|
6756 | - if(( 'INDEX' == $argType ) && ( $index == $cix )) { |
|
6753 | + foreach ($this->components as $cix => $component2) { |
|
6754 | + if (empty($component2)) continue; |
|
6755 | + unset($component2->propix); |
|
6756 | + if (('INDEX' == $argType) && ($index == $cix)) { |
|
6757 | 6757 | $this->components[$cix] = $component->copy(); |
6758 | 6758 | return TRUE; |
6759 | 6759 | } |
6760 | - elseif( $argType == $component2->objName ) { |
|
6761 | - if( $index == $cix2sC ) { |
|
6760 | + elseif ($argType == $component2->objName) { |
|
6761 | + if ($index == $cix2sC) { |
|
6762 | 6762 | $this->components[$cix] = $component->copy(); |
6763 | 6763 | return TRUE; |
6764 | 6764 | } |
6765 | 6765 | $cix2sC++; |
6766 | 6766 | } |
6767 | - elseif( !$argType && ($arg1 == $component2->getProperty( 'uid' ))) { |
|
6767 | + elseif (!$argType && ($arg1 == $component2->getProperty('uid'))) { |
|
6768 | 6768 | $this->components[$cix] = $component->copy(); |
6769 | 6769 | return TRUE; |
6770 | 6770 | } |
@@ -6782,15 +6782,15 @@ discard block |
||
6782 | 6782 | */ |
6783 | 6783 | function createSubComponent() { |
6784 | 6784 | $output = null; |
6785 | - foreach( $this->components as $component ) { |
|
6786 | - if( empty( $component )) continue; |
|
6787 | - if( '' >= $component->getConfig( 'language')) |
|
6788 | - $component->setConfig( 'language', $this->getConfig( 'language' )); |
|
6789 | - $component->setConfig( 'allowEmpty', $this->getConfig( 'allowEmpty' )); |
|
6790 | - $component->setConfig( 'nl', $this->getConfig( 'nl' )); |
|
6791 | - $component->setConfig( 'unique_id', $this->getConfig( 'unique_id' )); |
|
6792 | - $component->setConfig( 'format', $this->getConfig( 'format' )); |
|
6793 | - $output .= $component->createComponent( $this->xcaldecl ); |
|
6785 | + foreach ($this->components as $component) { |
|
6786 | + if (empty($component)) continue; |
|
6787 | + if ('' >= $component->getConfig('language')) |
|
6788 | + $component->setConfig('language', $this->getConfig('language')); |
|
6789 | + $component->setConfig('allowEmpty', $this->getConfig('allowEmpty')); |
|
6790 | + $component->setConfig('nl', $this->getConfig('nl')); |
|
6791 | + $component->setConfig('unique_id', $this->getConfig('unique_id')); |
|
6792 | + $component->setConfig('format', $this->getConfig('format')); |
|
6793 | + $output .= $component->createComponent($this->xcaldecl); |
|
6794 | 6794 | } |
6795 | 6795 | return $output; |
6796 | 6796 | } |
@@ -6817,21 +6817,21 @@ discard block |
||
6817 | 6817 | * @param string $value |
6818 | 6818 | * @return string |
6819 | 6819 | */ |
6820 | - function _size75( $string ) { |
|
6821 | - $strlen = strlen( $string ); |
|
6820 | + function _size75($string) { |
|
6821 | + $strlen = strlen($string); |
|
6822 | 6822 | $tmp = $string; |
6823 | 6823 | $string = null; |
6824 | - while( $strlen > 75 ) { |
|
6824 | + while ($strlen > 75) { |
|
6825 | 6825 | $breakAtChar = 75; |
6826 | - if( substr( $tmp, ( $breakAtChar - 1 ), strlen( '\n' )) == '\n' ) |
|
6826 | + if (substr($tmp, ($breakAtChar - 1), strlen('\n')) == '\n') |
|
6827 | 6827 | $breakAtChar = $breakAtChar - 1; |
6828 | - $string .= substr( $tmp, 0, $breakAtChar ); |
|
6828 | + $string .= substr($tmp, 0, $breakAtChar); |
|
6829 | 6829 | $string .= $this->nl; |
6830 | - $tmp = ' '.substr( $tmp, $breakAtChar ); |
|
6831 | - $strlen = strlen( $tmp ); |
|
6830 | + $tmp = ' '.substr($tmp, $breakAtChar); |
|
6831 | + $strlen = strlen($tmp); |
|
6832 | 6832 | } // while |
6833 | - $string .= rtrim( $tmp ); // the rest |
|
6834 | - if( $this->nl != substr( $string, ( 0 - strlen( $this->nl )))) |
|
6833 | + $string .= rtrim($tmp); // the rest |
|
6834 | + if ($this->nl != substr($string, (0 - strlen($this->nl)))) |
|
6835 | 6835 | $string .= $this->nl; |
6836 | 6836 | return $string; |
6837 | 6837 | } |
@@ -6843,38 +6843,38 @@ discard block |
||
6843 | 6843 | * @param string $string |
6844 | 6844 | * @return string |
6845 | 6845 | */ |
6846 | - function _strrep( $string ) { |
|
6847 | - switch( $this->format ) { |
|
6846 | + function _strrep($string) { |
|
6847 | + switch ($this->format) { |
|
6848 | 6848 | case 'xcal': |
6849 | - $string = str_replace( '\n', $this->nl, $string); |
|
6850 | - $string = htmlspecialchars( strip_tags( stripslashes( urldecode ( $string )))); |
|
6849 | + $string = str_replace('\n', $this->nl, $string); |
|
6850 | + $string = htmlspecialchars(strip_tags(stripslashes(urldecode($string)))); |
|
6851 | 6851 | break; |
6852 | 6852 | default: |
6853 | 6853 | $pos = 0; |
6854 | - while( $pos <= strlen( $string )) { |
|
6855 | - $pos = strpos( $string, "\\", $pos ); |
|
6856 | - if( FALSE === $pos ) |
|
6854 | + while ($pos <= strlen($string)) { |
|
6855 | + $pos = strpos($string, "\\", $pos); |
|
6856 | + if (FALSE === $pos) |
|
6857 | 6857 | break; |
6858 | - if( !in_array( $string{($pos + 1)}, array( 'n', 'N', 'r', ',', ';' ))) { |
|
6859 | - $string = substr( $string, 0, $pos )."\\".substr( $string, ( $pos + 1 )); |
|
6858 | + if (!in_array($string{($pos + 1)}, array('n', 'N', 'r', ',', ';'))) { |
|
6859 | + $string = substr($string, 0, $pos)."\\".substr($string, ($pos + 1)); |
|
6860 | 6860 | $pos += 1; |
6861 | 6861 | } |
6862 | 6862 | $pos += 1; |
6863 | 6863 | } |
6864 | - if( FALSE !== strpos( $string, '"' )) |
|
6865 | - $string = str_replace('"', "'", $string); |
|
6866 | - if( FALSE !== strpos( $string, ',' )) |
|
6867 | - $string = str_replace(',', '\,', $string); |
|
6868 | - if( FALSE !== strpos( $string, ';' )) |
|
6869 | - $string = str_replace(';', '\;', $string); |
|
6870 | - if( FALSE !== strpos( $string, "\r\n" )) |
|
6871 | - $string = str_replace( "\r\n", '\n', $string); |
|
6872 | - elseif( FALSE !== strpos( $string, "\r" )) |
|
6873 | - $string = str_replace( "\r", '\n', $string); |
|
6874 | - if( FALSE !== strpos( $string, '\N' )) |
|
6875 | - $string = str_replace( '\N', '\n', $string); |
|
6864 | + if (FALSE !== strpos($string, '"')) |
|
6865 | + $string = str_replace('"', "'", $string); |
|
6866 | + if (FALSE !== strpos($string, ',')) |
|
6867 | + $string = str_replace(',', '\,', $string); |
|
6868 | + if (FALSE !== strpos($string, ';')) |
|
6869 | + $string = str_replace(';', '\;', $string); |
|
6870 | + if (FALSE !== strpos($string, "\r\n")) |
|
6871 | + $string = str_replace("\r\n", '\n', $string); |
|
6872 | + elseif (FALSE !== strpos($string, "\r")) |
|
6873 | + $string = str_replace("\r", '\n', $string); |
|
6874 | + if (FALSE !== strpos($string, '\N')) |
|
6875 | + $string = str_replace('\N', '\n', $string); |
|
6876 | 6876 | // if( FALSE !== strpos( $string, $this->nl )) |
6877 | - $string = str_replace( $this->nl, '\n', $string); |
|
6877 | + $string = str_replace($this->nl, '\n', $string); |
|
6878 | 6878 | break; |
6879 | 6879 | } |
6880 | 6880 | return $string; |
@@ -6887,10 +6887,10 @@ discard block |
||
6887 | 6887 | * @param string $string |
6888 | 6888 | * @return string |
6889 | 6889 | */ |
6890 | - function _strunrep( $string ) { |
|
6891 | - $string = str_replace( '\\\\', '\\', $string); |
|
6892 | - $string = str_replace( '\,', ',', $string); |
|
6893 | - $string = str_replace( '\;', ';', $string); |
|
6890 | + function _strunrep($string) { |
|
6891 | + $string = str_replace('\\\\', '\\', $string); |
|
6892 | + $string = str_replace('\,', ',', $string); |
|
6893 | + $string = str_replace('\;', ';', $string); |
|
6894 | 6894 | // $string = str_replace( '\n', $this->nl, $string); // ?? |
6895 | 6895 | return $string; |
6896 | 6896 | } |
@@ -6988,7 +6988,7 @@ discard block |
||
6988 | 6988 | * @param array $xcaldecl |
6989 | 6989 | * @return string |
6990 | 6990 | */ |
6991 | - function createComponent( &$xcaldecl ) { |
|
6991 | + function createComponent(&$xcaldecl) { |
|
6992 | 6992 | $objectname = $this->_createFormat(); |
6993 | 6993 | $component = $this->componentStart1.$objectname.$this->componentStart2.$this->nl; |
6994 | 6994 | $component .= $this->createUid(); |
@@ -7025,8 +7025,8 @@ discard block |
||
7025 | 7025 | $component .= $this->createXprop(); |
7026 | 7026 | $component .= $this->createSubComponent(); |
7027 | 7027 | $component .= $this->componentEnd1.$objectname.$this->componentEnd2; |
7028 | - if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) { |
|
7029 | - foreach( $this->xcaldecl as $localxcaldecl ) |
|
7028 | + if (is_array($this->xcaldecl) && (0 < count($this->xcaldecl))) { |
|
7029 | + foreach ($this->xcaldecl as $localxcaldecl) |
|
7030 | 7030 | $xcaldecl[] = $localxcaldecl; |
7031 | 7031 | } |
7032 | 7032 | return $component; |
@@ -7126,7 +7126,7 @@ discard block |
||
7126 | 7126 | * @param array $xcaldecl |
7127 | 7127 | * @return string |
7128 | 7128 | */ |
7129 | - function createComponent( &$xcaldecl ) { |
|
7129 | + function createComponent(&$xcaldecl) { |
|
7130 | 7130 | $objectname = $this->_createFormat(); |
7131 | 7131 | $component = $this->componentStart1.$objectname.$this->componentStart2.$this->nl; |
7132 | 7132 | $component .= $this->createUid(); |
@@ -7164,8 +7164,8 @@ discard block |
||
7164 | 7164 | $component .= $this->createXprop(); |
7165 | 7165 | $component .= $this->createSubComponent(); |
7166 | 7166 | $component .= $this->componentEnd1.$objectname.$this->componentEnd2; |
7167 | - if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) { |
|
7168 | - foreach( $this->xcaldecl as $localxcaldecl ) |
|
7167 | + if (is_array($this->xcaldecl) && (0 < count($this->xcaldecl))) { |
|
7168 | + foreach ($this->xcaldecl as $localxcaldecl) |
|
7169 | 7169 | $xcaldecl[] = $localxcaldecl; |
7170 | 7170 | } |
7171 | 7171 | return $component; |
@@ -7245,7 +7245,7 @@ discard block |
||
7245 | 7245 | * @param array $xcaldecl |
7246 | 7246 | * @return string |
7247 | 7247 | */ |
7248 | - function createComponent( &$xcaldecl ) { |
|
7248 | + function createComponent(&$xcaldecl) { |
|
7249 | 7249 | $objectname = $this->_createFormat(); |
7250 | 7250 | $component = $this->componentStart1.$objectname.$this->componentStart2.$this->nl; |
7251 | 7251 | $component .= $this->createUid(); |
@@ -7274,8 +7274,8 @@ discard block |
||
7274 | 7274 | $component .= $this->createUrl(); |
7275 | 7275 | $component .= $this->createXprop(); |
7276 | 7276 | $component .= $this->componentEnd1.$objectname.$this->componentEnd2; |
7277 | - if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) { |
|
7278 | - foreach( $this->xcaldecl as $localxcaldecl ) |
|
7277 | + if (is_array($this->xcaldecl) && (0 < count($this->xcaldecl))) { |
|
7278 | + foreach ($this->xcaldecl as $localxcaldecl) |
|
7279 | 7279 | $xcaldecl[] = $localxcaldecl; |
7280 | 7280 | } |
7281 | 7281 | return $component; |
@@ -7333,7 +7333,7 @@ discard block |
||
7333 | 7333 | * @param array $xcaldecl |
7334 | 7334 | * @return string |
7335 | 7335 | */ |
7336 | - function createComponent( &$xcaldecl ) { |
|
7336 | + function createComponent(&$xcaldecl) { |
|
7337 | 7337 | $objectname = $this->_createFormat(); |
7338 | 7338 | $component = $this->componentStart1.$objectname.$this->componentStart2.$this->nl; |
7339 | 7339 | $component .= $this->createUid(); |
@@ -7350,8 +7350,8 @@ discard block |
||
7350 | 7350 | $component .= $this->createUrl(); |
7351 | 7351 | $component .= $this->createXprop(); |
7352 | 7352 | $component .= $this->componentEnd1.$objectname.$this->componentEnd2; |
7353 | - if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) { |
|
7354 | - foreach( $this->xcaldecl as $localxcaldecl ) |
|
7353 | + if (is_array($this->xcaldecl) && (0 < count($this->xcaldecl))) { |
|
7354 | + foreach ($this->xcaldecl as $localxcaldecl) |
|
7355 | 7355 | $xcaldecl[] = $localxcaldecl; |
7356 | 7356 | } |
7357 | 7357 | return $component; |
@@ -7403,7 +7403,7 @@ discard block |
||
7403 | 7403 | * @param array $xcaldecl |
7404 | 7404 | * @return string |
7405 | 7405 | */ |
7406 | - function createComponent( &$xcaldecl ) { |
|
7406 | + function createComponent(&$xcaldecl) { |
|
7407 | 7407 | $objectname = $this->_createFormat(); |
7408 | 7408 | $component = $this->componentStart1.$objectname.$this->componentStart2.$this->nl; |
7409 | 7409 | $component .= $this->createAction(); |
@@ -7451,11 +7451,11 @@ discard block |
||
7451 | 7451 | * @param string $timezonetype optional, default FALSE ( STANDARD / DAYLIGHT ) |
7452 | 7452 | * @return void |
7453 | 7453 | */ |
7454 | - function __construct( $timezonetype=FALSE ) { |
|
7455 | - if( !$timezonetype ) |
|
7454 | + function __construct($timezonetype = FALSE) { |
|
7455 | + if (!$timezonetype) |
|
7456 | 7456 | $this->timezonetype = 'VTIMEZONE'; |
7457 | 7457 | else |
7458 | - $this->timezonetype = strtoupper( $timezonetype ); |
|
7458 | + $this->timezonetype = strtoupper($timezonetype); |
|
7459 | 7459 | $this->calendarComponent(); |
7460 | 7460 | |
7461 | 7461 | $this->comment = ''; |
@@ -7480,7 +7480,7 @@ discard block |
||
7480 | 7480 | * @param array $xcaldecl |
7481 | 7481 | * @return string |
7482 | 7482 | */ |
7483 | - function createComponent( &$xcaldecl ) { |
|
7483 | + function createComponent(&$xcaldecl) { |
|
7484 | 7484 | $objectname = $this->_createFormat(); |
7485 | 7485 | $component = $this->componentStart1.$objectname.$this->componentStart2.$this->nl; |
7486 | 7486 | $component .= $this->createTzid(); |
@@ -7496,8 +7496,8 @@ discard block |
||
7496 | 7496 | $component .= $this->createXprop(); |
7497 | 7497 | $component .= $this->createSubComponent(); |
7498 | 7498 | $component .= $this->componentEnd1.$objectname.$this->componentEnd2; |
7499 | - if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) { |
|
7500 | - foreach( $this->xcaldecl as $localxcaldecl ) |
|
7499 | + if (is_array($this->xcaldecl) && (0 < count($this->xcaldecl))) { |
|
7500 | + foreach ($this->xcaldecl as $localxcaldecl) |
|
7501 | 7501 | $xcaldecl[] = $localxcaldecl; |
7502 | 7502 | } |
7503 | 7503 | return $component; |