Completed
Push — 1.10.x ( 67073c...77bf11 )
by Angel Fernando Quiroz
81:48 queued 37:47
created
main/inc/lib/pear/Pager/Common.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
             return array(
627 627
                         max(($this->_perPage * ($pageID - 1)) + 1, 1),
628 628
                         min($this->_totalItems, $this->_perPage * $pageID)
629
-                   );
629
+                    );
630 630
         }
631 631
         return array(0, 0);
632 632
     }
@@ -848,16 +848,16 @@  discard block
 block discarded – undo
848 848
                 $onclick = str_replace('%d', $this->_linkData[$this->_urlVar], $this->_onclick);
849 849
             }
850 850
             return sprintf('<a href="%s"%s%s%s%s title="%s">%s</a>',
851
-                           // Modified by Ivan Tcholakov, 17-OCT-2008.
852
-                           //htmlentities($this->_url . $href, ENT_COMPAT, 'UTF-8'),
853
-                           api_htmlentities($this->_url . $href),
854
-                           //
855
-                           empty($this->_classString) ? '' : ' '.$this->_classString,
856
-                           empty($this->_attributes)  ? '' : ' '.$this->_attributes,
857
-                           empty($this->_accesskey)   ? '' : ' accesskey="'.$this->_linkData[$this->_urlVar].'"',
858
-                           empty($onclick)            ? '' : ' onclick="'.$onclick.'"',
859
-                           $altText,
860
-                           $linkText
851
+                            // Modified by Ivan Tcholakov, 17-OCT-2008.
852
+                            //htmlentities($this->_url . $href, ENT_COMPAT, 'UTF-8'),
853
+                            api_htmlentities($this->_url . $href),
854
+                            //
855
+                            empty($this->_classString) ? '' : ' '.$this->_classString,
856
+                            empty($this->_attributes)  ? '' : ' '.$this->_attributes,
857
+                            empty($this->_accesskey)   ? '' : ' accesskey="'.$this->_linkData[$this->_urlVar].'"',
858
+                            empty($onclick)            ? '' : ' onclick="'.$onclick.'"',
859
+                            $altText,
860
+                            $linkText
861 861
             );
862 862
         } elseif ($this->_httpMethod == 'POST') {
863 863
             $href = $this->_url;
@@ -865,12 +865,12 @@  discard block
 block discarded – undo
865 865
                 $href .= '?' . $this->_http_build_query_wrapper($_GET);
866 866
             }
867 867
             return sprintf("<a href='javascript:void(0)' onclick='%s'%s%s%s title='%s'>%s</a>",
868
-                           $this->_generateFormOnClick($href, $this->_linkData),
869
-                           empty($this->_classString) ? '' : ' '.$this->_classString,
870
-                           empty($this->_attributes)  ? '' : ' '.$this->_attributes,
871
-                           empty($this->_accesskey)   ? '' : ' accesskey=\''.$this->_linkData[$this->_urlVar].'\'',
872
-                           $altText,
873
-                           $linkText
868
+                            $this->_generateFormOnClick($href, $this->_linkData),
869
+                            empty($this->_classString) ? '' : ' '.$this->_classString,
870
+                            empty($this->_attributes)  ? '' : ' '.$this->_attributes,
871
+                            empty($this->_accesskey)   ? '' : ' accesskey=\''.$this->_linkData[$this->_urlVar].'\'',
872
+                            $altText,
873
+                            $linkText
874 874
             );
875 875
         }
876 876
         return '';
@@ -1120,10 +1120,10 @@  discard block
 block discarded – undo
1120 1120
         if ($this->_currentPage > 1) {
1121 1121
             $this->_linkData[$this->_urlVar] = $this->getPreviousPageID();
1122 1122
             $back = $this->_renderLink($this->_altPrev, $this->_prevImg)
1123
-                  . $this->_spacesBefore . $this->_spacesAfter;
1123
+                    . $this->_spacesBefore . $this->_spacesAfter;
1124 1124
         } else if ($this->_prevImgEmpty !== null && $this->_totalPages > 1) {
1125 1125
             $back = $this->_prevImgEmpty
1126
-                  . $this->_spacesBefore . $this->_spacesAfter;
1126
+                    . $this->_spacesBefore . $this->_spacesAfter;
1127 1127
         }
1128 1128
         return $back;
1129 1129
     }
@@ -1171,12 +1171,12 @@  discard block
 block discarded – undo
1171 1171
         if ($this->_currentPage < $this->_totalPages) {
1172 1172
             $this->_linkData[$this->_urlVar] = $this->getNextPageID();
1173 1173
             $next = $this->_spacesAfter
1174
-                  . $this->_renderLink($this->_altNext, $this->_nextImg)
1175
-                  . $this->_spacesBefore . $this->_spacesAfter;
1174
+                    . $this->_renderLink($this->_altNext, $this->_nextImg)
1175
+                    . $this->_spacesBefore . $this->_spacesAfter;
1176 1176
         } else if ($this->_nextImgEmpty !== null && $this->_totalPages > 1) {
1177 1177
             $next = $this->_spacesAfter
1178
-                  . $this->_nextImgEmpty
1179
-                  . $this->_spacesBefore . $this->_spacesAfter;
1178
+                    . $this->_nextImgEmpty
1179
+                    . $this->_spacesBefore . $this->_spacesAfter;
1180 1180
         }
1181 1181
         return $next;
1182 1182
     }
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
         }
1633 1633
 
1634 1634
         if (!empty($_SESSION[$this->_sessionVar]) && $this->_useSessions) {
1635
-             $this->_perPage = $_SESSION[$this->_sessionVar];
1635
+                $this->_perPage = $_SESSION[$this->_sessionVar];
1636 1636
         }
1637 1637
 
1638 1638
         if ($this->_closeSession) {
@@ -1713,7 +1713,7 @@  discard block
 block discarded – undo
1713 1713
                 ERROR_PAGER_INVALID             => 'invalid',
1714 1714
                 ERROR_PAGER_INVALID_PLACEHOLDER => 'invalid format - use "%d" as placeholder.',
1715 1715
                 ERROR_PAGER_INVALID_USAGE       => 'if $options[\'append\'] is set to false, '
1716
-                                                  .' $options[\'fileName\'] MUST contain the "%d" placeholder.',
1716
+                                                    .' $options[\'fileName\'] MUST contain the "%d" placeholder.',
1717 1717
                 ERROR_PAGER_NOT_IMPLEMENTED     => 'not implemented'
1718 1718
             );
1719 1719
         }
Please login to merge, or discard this patch.
main/inc/lib/icalcreator/iCalcreator.class.php 1 patch
Indentation   +3356 added lines, -3357 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 */
46 46
             /* only for phpversion 5.x, date management, default timezone setting */
47 47
 if( substr( phpversion(), 0, 1) >= '5' ) // && ( 'UTC' == date_default_timezone_get() )) {
48
-  date_default_timezone_set( 'Europe/Stockholm' );
48
+    date_default_timezone_set( 'Europe/Stockholm' );
49 49
             /* version string, do NOT remove!! */
50 50
 define( 'ICALCREATOR_VERSION', 'iCalcreator 2.6' );
51 51
 /*********************************************************************************/
@@ -58,28 +58,28 @@  discard block
 block discarded – undo
58 58
  */
59 59
 class vcalendar {
60 60
             //  calendar property variables
61
-  var $calscale;
62
-  var $method;
63
-  var $prodid;
64
-  var $version;
65
-  var $xprop;
61
+    var $calscale;
62
+    var $method;
63
+    var $prodid;
64
+    var $version;
65
+    var $xprop;
66 66
             //  container for calendar components
67
-  var $components;
67
+    var $components;
68 68
             //  component config variables
69
-  var $allowEmpty;
70
-  var $unique_id;
71
-  var $language;
72
-  var $directory;
73
-  var $filename;
74
-  var $url;
75
-  var $delimiter;
76
-  var $nl;
77
-  var $format;
69
+    var $allowEmpty;
70
+    var $unique_id;
71
+    var $language;
72
+    var $directory;
73
+    var $filename;
74
+    var $url;
75
+    var $delimiter;
76
+    var $nl;
77
+    var $format;
78 78
             //  component internal variables
79
-  var $attributeDelimiter;
80
-  var $valueInit;
79
+    var $attributeDelimiter;
80
+    var $valueInit;
81 81
             //  component xCal declaration container
82
-  var $xcaldecl;
82
+    var $xcaldecl;
83 83
 /*
84 84
  * constructor for calendar object
85 85
  *
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
  * @since 2.2.13 - 2007-12-30
88 88
  * @return void
89 89
  */
90
-  function vcalendar () {
90
+    function vcalendar () {
91 91
     $this->_makeVersion();
92 92
     $this->calscale   = null;
93 93
     $this->method     = null;
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
     $this->prodid     = null;
96 96
     $this->xprop      = array();
97 97
 /**
98
- *   language = <Text identifying a language, as defined in [RFC 1766]>
99
- */
98
+     *   language = <Text identifying a language, as defined in [RFC 1766]>
99
+     */
100 100
     if( defined( 'ICAL_LANG' ))
101
-      $this->setConfig( 'language', ICAL_LANG );
101
+        $this->setConfig( 'language', ICAL_LANG );
102 102
     $this->setConfig( 'allowEmpty', TRUE );
103 103
     $this->setConfig( 'nl',         "\n" );
104 104
     $this->setConfig( 'format',     'iCal');
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     $this->setConfig( 'delimiter',  DIRECTORY_SEPARATOR );
109 109
     $this->xcaldecl   = array();
110 110
     $this->components = array();
111
-  }
111
+    }
112 112
 /*********************************************************************************/
113 113
 /**
114 114
  * Property Name: CALSCALE
@@ -120,29 +120,29 @@  discard block
 block discarded – undo
120 120
  * @since 2.4.8 - 2008-10-21
121 121
  * @return string
122 122
  */
123
-  function createCalscale() {
123
+    function createCalscale() {
124 124
     if( empty( $this->calscale )) return FALSE;
125 125
     switch( $this->format ) {
126
-      case 'xcal':
126
+        case 'xcal':
127 127
         return ' calscale="'.$this->calscale.'"'.$this->nl;
128 128
         break;
129
-      default:
129
+        default:
130 130
         return 'CALSCALE:'.$this->calscale.$this->nl;
131 131
         break;
132 132
     }
133
-  }
133
+    }
134 134
 /**
135
- * set calendar property calscale
136
- *
137
- * @author Kjell-Inge Gustafsson <[email protected]>
138
- * @since 2.4.8 - 2008-10-21
139
- * @param string $value
140
- * @return void
141
- */
142
-  function setCalscale( $value ) {
135
+     * set calendar property calscale
136
+     *
137
+     * @author Kjell-Inge Gustafsson <[email protected]>
138
+     * @since 2.4.8 - 2008-10-21
139
+     * @param string $value
140
+     * @return void
141
+     */
142
+    function setCalscale( $value ) {
143 143
     if( empty( $value )) return FALSE;
144 144
     $this->calscale = $value;
145
-  }
145
+    }
146 146
 /*********************************************************************************/
147 147
 /**
148 148
  * Property Name: METHOD
@@ -154,30 +154,30 @@  discard block
 block discarded – undo
154 154
  * @since 0.9.7 - 2006-11-20
155 155
  * @return string
156 156
  */
157
-  function createMethod() {
157
+    function createMethod() {
158 158
     if( empty( $this->method )) return FALSE;
159 159
     switch( $this->format ) {
160
-      case 'xcal':
160
+        case 'xcal':
161 161
         return ' method="'.$this->method.'"'.$this->nl;
162 162
         break;
163
-      default:
163
+        default:
164 164
         return 'METHOD:'.$this->method.$this->nl;
165 165
         break;
166 166
     }
167
-  }
167
+    }
168 168
 /**
169
- * set calendar property method
170
- *
171
- * @author Kjell-Inge Gustafsson <[email protected]>
172
- * @since 2.4.8 - 2008-20-23
173
- * @param string $value
174
- * @return bool
175
- */
176
-  function setMethod( $value ) {
169
+     * set calendar property method
170
+     *
171
+     * @author Kjell-Inge Gustafsson <[email protected]>
172
+     * @since 2.4.8 - 2008-20-23
173
+     * @param string $value
174
+     * @return bool
175
+     */
176
+    function setMethod( $value ) {
177 177
     if( empty( $value )) return FALSE;
178 178
     $this->method = $value;
179 179
     return TRUE;
180
-  }
180
+    }
181 181
 /*********************************************************************************/
182 182
 /**
183 183
  * Property Name: PRODID
@@ -193,44 +193,44 @@  discard block
 block discarded – undo
193 193
  * @since 0.9.7 - 2006-11-20
194 194
  * @return string
195 195
  */
196
-  function createProdid() {
196
+    function createProdid() {
197 197
     if( !isset( $this->prodid ))
198
-      $this->_makeProdid();
198
+        $this->_makeProdid();
199 199
     switch( $this->format ) {
200
-      case 'xcal':
200
+        case 'xcal':
201 201
         return ' prodid="'.$this->prodid.'"'.$this->nl;
202 202
         break;
203
-      default:
203
+        default:
204 204
         return 'PRODID:'.$this->prodid.$this->nl;
205 205
         break;
206 206
     }
207
-  }
207
+    }
208 208
 /**
209
- * make default value for calendar prodid
210
- *
211
- * @author Kjell-Inge Gustafsson <[email protected]>
212
- * @since 0.3.0 - 2006-08-10
213
- * @return void
214
- */
215
-  function _makeProdid() {
209
+     * make default value for calendar prodid
210
+     *
211
+     * @author Kjell-Inge Gustafsson <[email protected]>
212
+     * @since 0.3.0 - 2006-08-10
213
+     * @return void
214
+     */
215
+    function _makeProdid() {
216 216
     $this->prodid  = '-//'.$this->unique_id.'//NONSGML '.ICALCREATOR_VERSION.'//'.strtoupper( $this->language );
217
-  }
217
+    }
218 218
 /**
219
- * Conformance: The property MUST be specified once in an iCalendar object.
220
- * Description: The vendor of the implementation SHOULD assure that this
221
- * is a globally unique identifier; using some technique such as an FPI
222
- * value, as defined in [ISO 9070].
223
- */
219
+     * Conformance: The property MUST be specified once in an iCalendar object.
220
+     * Description: The vendor of the implementation SHOULD assure that this
221
+     * is a globally unique identifier; using some technique such as an FPI
222
+     * value, as defined in [ISO 9070].
223
+     */
224 224
 /**
225
- * make default unique_id for calendar prodid
226
- *
227
- * @author Kjell-Inge Gustafsson <[email protected]>
228
- * @since 0.3.0 - 2006-08-10
229
- * @return void
230
- */
231
-  function _makeUnique_id() {
225
+     * make default unique_id for calendar prodid
226
+     *
227
+     * @author Kjell-Inge Gustafsson <[email protected]>
228
+     * @since 0.3.0 - 2006-08-10
229
+     * @return void
230
+     */
231
+    function _makeUnique_id() {
232 232
     $this->unique_id  = ( isset( $_SERVER['SERVER_NAME'] )) ? gethostbyname( $_SERVER['SERVER_NAME'] ) : 'localhost';
233
-  }
233
+    }
234 234
 /*********************************************************************************/
235 235
 /**
236 236
  * Property Name: VERSION
@@ -239,47 +239,46 @@  discard block
 block discarded – undo
239 239
  */
240 240
 /**
241 241
  * creates formatted output for calendar property version
242
-
243 242
  *
244 243
  * @author Kjell-Inge Gustafsson <[email protected]>
245 244
  * @since 0.9.7 - 2006-11-20
246 245
  * @return string
247 246
  */
248
-  function createVersion() {
247
+    function createVersion() {
249 248
     if( empty( $this->version ))
250
-      $this->_makeVersion();
249
+        $this->_makeVersion();
251 250
     switch( $this->format ) {
252
-      case 'xcal':
251
+        case 'xcal':
253 252
         return ' version="'.$this->version.'"'.$this->nl;
254 253
         break;
255
-      default:
254
+        default:
256 255
         return 'VERSION:'.$this->version.$this->nl;
257 256
         break;
258 257
     }
259
-  }
258
+    }
260 259
 /**
261
- * set default calendar version
262
- *
263
- * @author Kjell-Inge Gustafsson <[email protected]>
264
- * @since 0.3.0 - 2006-08-10
265
- * @return void
266
- */
267
-  function _makeVersion() {
260
+     * set default calendar version
261
+     *
262
+     * @author Kjell-Inge Gustafsson <[email protected]>
263
+     * @since 0.3.0 - 2006-08-10
264
+     * @return void
265
+     */
266
+    function _makeVersion() {
268 267
     $this->version = '2.0';
269
-  }
268
+    }
270 269
 /**
271
- * set calendar version
272
- *
273
- * @author Kjell-Inge Gustafsson <[email protected]>
274
- * @since 2.4.8 - 2008-10-23
275
- * @param string $value
276
- * @return void
277
- */
278
-  function setVersion( $value ) {
270
+     * set calendar version
271
+     *
272
+     * @author Kjell-Inge Gustafsson <[email protected]>
273
+     * @since 2.4.8 - 2008-10-23
274
+     * @param string $value
275
+     * @return void
276
+     */
277
+    function setVersion( $value ) {
279 278
     if( empty( $value )) return FALSE;
280 279
     $this->version = $value;
281 280
     return TRUE;
282
-  }
281
+    }
283 282
 /*********************************************************************************/
284 283
 /**
285 284
  * Property Name: x-prop
@@ -291,44 +290,44 @@  discard block
 block discarded – undo
291 290
  * @since 2.4.11 - 2008-11-03
292 291
  * @return string
293 292
  */
294
-  function createXprop() {
293
+    function createXprop() {
295 294
     if( 'xcal' == $this->format )
296
-      return false;
295
+        return false;
297 296
     if( 0 >= count( $this->xprop ))
298
-      return;
297
+        return;
299 298
     $output = null;
300 299
     $toolbox = new calendarComponent();
301 300
     $toolbox->setConfig( 'language', $this->getConfig( 'language' ));
302 301
     $toolbox->setConfig( 'nl',       $this->getConfig( 'nl' ));
303 302
     $toolbox->_createFormat(         $this->getConfig( 'format' ));
304 303
     foreach( $this->xprop as $label => $xpropPart ) {
305
-      if( empty( $xpropPart['value'] )) {
304
+        if( empty( $xpropPart['value'] )) {
306 305
         $output  .= $toolbox->_createElement( $label );
307 306
         continue;
308
-      }
309
-      $attributes = $toolbox->_createParams( $xpropPart['params'], array( 'LANGUAGE' ));
310
-      if( is_array( $xpropPart['value'] )) {
307
+        }
308
+        $attributes = $toolbox->_createParams( $xpropPart['params'], array( 'LANGUAGE' ));
309
+        if( is_array( $xpropPart['value'] )) {
311 310
         foreach( $xpropPart['value'] as $pix => $theXpart )
312
-          $xpropPart['value'][$pix] = $toolbox->_strrep( $theXpart );
311
+            $xpropPart['value'][$pix] = $toolbox->_strrep( $theXpart );
313 312
         $xpropPart['value']  = implode( ',', $xpropPart['value'] );
314
-      }
315
-      else
313
+        }
314
+        else
316 315
         $xpropPart['value'] = $toolbox->_strrep( $xpropPart['value'] );
317
-      $output    .= $toolbox->_createElement( $label, $attributes, $xpropPart['value'] );
316
+        $output    .= $toolbox->_createElement( $label, $attributes, $xpropPart['value'] );
318 317
     }
319 318
     return $output;
320
-  }
319
+    }
321 320
 /**
322
- * set calendar property x-prop
323
- *
324
- * @author Kjell-Inge Gustafsson <[email protected]>
325
- * @since 2.4.11 - 2008-11-04
326
- * @param string $label
327
- * @param string $value
328
- * @param array $params optional
329
- * @return bool
330
- */
331
-  function setXprop( $label, $value, $params=FALSE ) {
321
+     * set calendar property x-prop
322
+     *
323
+     * @author Kjell-Inge Gustafsson <[email protected]>
324
+     * @since 2.4.11 - 2008-11-04
325
+     * @param string $label
326
+     * @param string $value
327
+     * @param array $params optional
328
+     * @return bool
329
+     */
330
+    function setXprop( $label, $value, $params=FALSE ) {
332 331
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
333 332
     if( empty( $label )) return FALSE;
334 333
     $xprop           = array( 'value' => $value );
@@ -337,7 +336,7 @@  discard block
 block discarded – undo
337 336
     if( !is_array( $this->xprop )) $this->xprop = array();
338 337
     $this->xprop[strtoupper( $label )] = $xprop;
339 338
     return TRUE;
340
-  }
339
+    }
341 340
 /*********************************************************************************/
342 341
 /**
343 342
  * delete calendar property value
@@ -348,131 +347,131 @@  discard block
 block discarded – undo
348 347
  * @param int @propix, optional, if specific property is wanted in case of multiply occurences
349 348
  * @return bool, if successfull delete
350 349
  */
351
-  function deleteProperty( $propName, $propix=FALSE ) {
350
+    function deleteProperty( $propName, $propix=FALSE ) {
352 351
     $propName = ( $propName ) ? strtoupper( $propName ) : 'X-PROP';
353 352
     if( !$propix )
354
-      $propix = ( isset( $this->propdelix[$propName] )) ? $this->propdelix[$propName] + 2 : 1;
353
+        $propix = ( isset( $this->propdelix[$propName] )) ? $this->propdelix[$propName] + 2 : 1;
355 354
     $this->propdelix[$propName] = --$propix;
356 355
     $return = FALSE;
357 356
     switch( $propName ) {
358
-      case 'CALSCALE':
357
+        case 'CALSCALE':
359 358
         if( isset( $this->calscale )) {
360
-          $this->calscale = null;
361
-          $return = TRUE;
359
+            $this->calscale = null;
360
+            $return = TRUE;
362 361
         }
363 362
         break;
364
-      case 'METHOD':
363
+        case 'METHOD':
365 364
         if( isset( $this->method )) {
366
-          $this->method   = null;
367
-          $return = TRUE;
365
+            $this->method   = null;
366
+            $return = TRUE;
368 367
         }
369 368
         break;
370
-      default:
369
+        default:
371 370
         $reduced = array();
372 371
         if( $propName != 'X-PROP' ) {
373
-          if( !isset( $this->xprop[$propName] )) return FALSE;
374
-          foreach( $this->xprop as $k => $a ) {
372
+            if( !isset( $this->xprop[$propName] )) return FALSE;
373
+            foreach( $this->xprop as $k => $a ) {
375 374
             if(( $k != $propName ) && !empty( $a ))
376
-              $reduced[$k] = $a;
377
-          }
375
+                $reduced[$k] = $a;
376
+            }
378 377
         }
379 378
         else {
380
-          if( count( $this->xprop ) <= $propix )  return FALSE;
381
-          $xpropno = 0;
382
-          foreach( $this->xprop as $xpropkey => $xpropvalue ) {
379
+            if( count( $this->xprop ) <= $propix )  return FALSE;
380
+            $xpropno = 0;
381
+            foreach( $this->xprop as $xpropkey => $xpropvalue ) {
383 382
             if( $propix != $xpropno )
384
-              $reduced[$xpropkey] = $xpropvalue;
383
+                $reduced[$xpropkey] = $xpropvalue;
385 384
             $xpropno++;
386
-          }
385
+            }
387 386
         }
388 387
         $this->xprop = $reduced;
389 388
         return TRUE;
390 389
     }
391 390
     return $return;
392
-  }
391
+    }
393 392
 /**
394
- * get calendar property value/params
395
- *
396
- * @author Kjell-Inge Gustafsson <[email protected]>
397
- * @since 2.5.1 - 2008-11-02
398
- * @param string $propName, optional
399
- * @param int @propix, optional, if specific property is wanted in case of multiply occurences
400
- * @param bool $inclParam=FALSE
401
- * @return mixed
402
- */
403
-  function getProperty( $propName=FALSE, $propix=FALSE, $inclParam=FALSE ) {
393
+     * get calendar property value/params
394
+     *
395
+     * @author Kjell-Inge Gustafsson <[email protected]>
396
+     * @since 2.5.1 - 2008-11-02
397
+     * @param string $propName, optional
398
+     * @param int @propix, optional, if specific property is wanted in case of multiply occurences
399
+     * @param bool $inclParam=FALSE
400
+     * @return mixed
401
+     */
402
+    function getProperty( $propName=FALSE, $propix=FALSE, $inclParam=FALSE ) {
404 403
     $propName = ( $propName ) ? strtoupper( $propName ) : 'X-PROP';
405 404
     if( 'X-PROP' == $propName ) {
406
-      if( !$propix )
405
+        if( !$propix )
407 406
         $propix = ( isset( $this->propix[$propName] )) ? $this->propix[$propName] + 2 : 1;
408
-      $this->propix[$propName] = --$propix;
407
+        $this->propix[$propName] = --$propix;
409 408
     }
410 409
     switch( $propName ) {
411
-      case 'CALSCALE':
410
+        case 'CALSCALE':
412 411
         return ( !empty( $this->calscale )) ? $this->calscale : null;
413 412
         break;
414
-      case 'METHOD':
413
+        case 'METHOD':
415 414
         return ( !empty( $this->method )) ? $this->method : null;
416 415
         break;
417
-      case 'PRODID':
416
+        case 'PRODID':
418 417
         if( empty( $this->prodid ))
419
-          $this->_makeProdid();
418
+            $this->_makeProdid();
420 419
         return $this->prodid;
421 420
         break;
422
-      case 'VERSION':
421
+        case 'VERSION':
423 422
         return ( !empty( $this->version )) ? $this->version : null;
424 423
         break;
425
-      default:
424
+        default:
426 425
         if( $propName != 'X-PROP' ) {
427
-          if( !isset( $this->xprop[$propName] )) return FALSE;
428
-          return ( $inclParam ) ? array( $propName, $this->xprop[$propName] )
426
+            if( !isset( $this->xprop[$propName] )) return FALSE;
427
+            return ( $inclParam ) ? array( $propName, $this->xprop[$propName] )
429 428
                                 : array( $propName, $this->xprop[$propName]['value'] );
430 429
         }
431 430
         else {
432
-          if( empty( $this->xprop )) return FALSE;
433
-          $xpropno = 0;
434
-          foreach( $this->xprop as $xpropkey => $xpropvalue ) {
431
+            if( empty( $this->xprop )) return FALSE;
432
+            $xpropno = 0;
433
+            foreach( $this->xprop as $xpropkey => $xpropvalue ) {
435 434
             if( $propix == $xpropno )
436
-              return ( $inclParam ) ? array( $xpropkey, $this->xprop[$xpropkey] )
435
+                return ( $inclParam ) ? array( $xpropkey, $this->xprop[$xpropkey] )
437 436
                                     : array( $xpropkey, $this->xprop[$xpropkey]['value'] );
438 437
             else
439
-              $xpropno++;
440
-          }
441
-          return FALSE; // not found ??
438
+                $xpropno++;
439
+            }
440
+            return FALSE; // not found ??
442 441
         }
443 442
     }
444 443
     return FALSE;
445
-  }
444
+    }
446 445
 /**
447
- * general vcalendar property setting
448
- *
449
- * @author Kjell-Inge Gustafsson <[email protected]>
450
- * @since 2.2.13 - 2007-11-04
451
- * @param mixed $args variable number of function arguments,
452
- *                    first argument is ALWAYS component name,
453
- *                    second ALWAYS component value!
454
- * @return bool
455
- */
456
-  function setProperty () {
446
+     * general vcalendar property setting
447
+     *
448
+     * @author Kjell-Inge Gustafsson <[email protected]>
449
+     * @since 2.2.13 - 2007-11-04
450
+     * @param mixed $args variable number of function arguments,
451
+     *                    first argument is ALWAYS component name,
452
+     *                    second ALWAYS component value!
453
+     * @return bool
454
+     */
455
+    function setProperty () {
457 456
     $numargs    = func_num_args();
458 457
     if( 1 > $numargs )
459
-      return FALSE;
458
+        return FALSE;
460 459
     $arglist    = func_get_args();
461 460
     $arglist[0] = strtoupper( $arglist[0] );
462 461
     switch( $arglist[0] ) {
463
-      case 'CALSCALE':
462
+        case 'CALSCALE':
464 463
         return $this->setCalscale( $arglist[1] );
465
-      case 'METHOD':
464
+        case 'METHOD':
466 465
         return $this->setMethod( $arglist[1] );
467
-      case 'VERSION':
466
+        case 'VERSION':
468 467
         return $this->setVersion( $arglist[1] );
469
-      default:
468
+        default:
470 469
         if( !isset( $arglist[1] )) $arglist[1] = null;
471 470
         if( !isset( $arglist[2] )) $arglist[2] = null;
472 471
         return $this->setXprop( $arglist[0], $arglist[1], $arglist[2] );
473 472
     }
474 473
     return FALSE;
475
-  }
474
+    }
476 475
 /*********************************************************************************/
477 476
 /**
478 477
  * get vcalendar config values or * calendar components
@@ -482,180 +481,180 @@  discard block
 block discarded – undo
482 481
  * @param string $config
483 482
  * @return value
484 483
  */
485
-  function getConfig( $config ) {
484
+    function getConfig( $config ) {
486 485
     switch( strtoupper( $config )) {
487
-      case 'ALLOWEMPTY':
486
+        case 'ALLOWEMPTY':
488 487
         return $this->allowEmpty;
489 488
         break;
490
-      case 'COMPSINFO':
489
+        case 'COMPSINFO':
491 490
         unset( $this->compix );
492 491
         $info = array();
493 492
         foreach( $this->components as $cix => $component ) {
494
-          if( empty( $component )) continue;
495
-          unset( $component->propix );
496
-          $info[$cix]['ordno'] = $cix + 1;
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 );
493
+            if( empty( $component )) continue;
494
+            unset( $component->propix );
495
+            $info[$cix]['ordno'] = $cix + 1;
496
+            $info[$cix]['type']  = $component->objName;
497
+            $info[$cix]['uid']   = $component->getProperty( 'uid' );
498
+            $info[$cix]['props'] = $component->getConfig( 'propinfo' );
499
+            $info[$cix]['sub']   = $component->getConfig( 'compsinfo' );
500
+            unset( $component->propix );
502 501
         }
503 502
         return $info;
504 503
         break;
505
-      case 'DELIMITER':
504
+        case 'DELIMITER':
506 505
         return $this->delimiter;
507 506
         break;
508
-      case 'DIRECTORY':
507
+        case 'DIRECTORY':
509 508
         if( empty( $this->directory ))
510
-          $this->directory = '.';
509
+            $this->directory = '.';
511 510
         return $this->directory;
512 511
         break;
513
-      case 'DIRFILE':
512
+        case 'DIRFILE':
514 513
         return $this->getConfig( 'directory' ).$this->getConfig( 'delimiter' ).$this->getConfig( 'filename' );
515 514
         break;
516
-      case 'FILEINFO':
515
+        case 'FILEINFO':
517 516
         return array( $this->getConfig( 'directory' )
518 517
                     , $this->getConfig( 'filename' )
519 518
                     , $this->getConfig( 'filesize' ));
520 519
         break;
521
-      case 'FILENAME':
520
+        case 'FILENAME':
522 521
         if( empty( $this->filename )) {
523
-          if( 'xcal' == $this->format )
522
+            if( 'xcal' == $this->format )
524 523
             $this->filename = date( 'YmdHis' ).'.xml'; // recommended xcs.. .
525
-          else
524
+            else
526 525
             $this->filename = date( 'YmdHis' ).'.ics';
527 526
         }
528 527
         return $this->filename;
529 528
         break;
530
-      case 'FILESIZE':
529
+        case 'FILESIZE':
531 530
         $size    = 0;
532 531
         if( empty( $this->url )) {
533
-          $dirfile = $this->getConfig( 'dirfile' );
534
-          if( FALSE === ( $size = filesize( $dirfile )))
532
+            $dirfile = $this->getConfig( 'dirfile' );
533
+            if( FALSE === ( $size = filesize( $dirfile )))
535 534
             $size = 0;
536
-          clearstatcache();
535
+            clearstatcache();
537 536
         }
538 537
         return $size;
539 538
         break;
540
-      case 'FORMAT':
539
+        case 'FORMAT':
541 540
         return $this->format;
542 541
         break;
543
-      case 'LANGUAGE':
542
+        case 'LANGUAGE':
544 543
          /* get language for calendar component as defined in [RFC 1766] */
545 544
         return $this->language;
546 545
         break;
547
-      case 'NL':
546
+        case 'NL':
548 547
       case 'NEWLINECHAR':
549 548
         return $this->nl;
550 549
         break;
551
-      case 'UNIQUE_ID':
550
+        case 'UNIQUE_ID':
552 551
         return $this->unique_id;
553 552
         break;
554
-      case 'URL':
553
+        case 'URL':
555 554
         if( !empty( $this->url ))
556
-          return $this->url;
555
+            return $this->url;
557 556
         else
558
-          return FALSE;
557
+            return FALSE;
559 558
         break;
560 559
     }
561
-  }
560
+    }
562 561
 /**
563
- * general vcalendar config setting
564
- *
565
- * @author Kjell-Inge Gustafsson <[email protected]>
566
- * @since 2.4.8 - 2008-10-24
567
- * @param string $config
568
- * @param string $value
569
- * @return void
570
- */
571
-  function setConfig( $config, $value ) {
562
+     * general vcalendar config setting
563
+     *
564
+     * @author Kjell-Inge Gustafsson <[email protected]>
565
+     * @since 2.4.8 - 2008-10-24
566
+     * @param string $config
567
+     * @param string $value
568
+     * @return void
569
+     */
570
+    function setConfig( $config, $value ) {
572 571
     $res = FALSE;
573 572
     switch( strtoupper( $config )) {
574
-      case 'ALLOWEMPTY':
573
+        case 'ALLOWEMPTY':
575 574
         $this->allowEmpty = $value;
576 575
         $subcfg  = array( 'ALLOWEMPTY' => $value );
577 576
         $res = TRUE;
578 577
         break;
579
-      case 'DELIMITER':
578
+        case 'DELIMITER':
580 579
         $this->delimiter = $value;
581 580
         return TRUE;
582 581
         break;
583
-      case 'DIRECTORY':
582
+        case 'DIRECTORY':
584 583
         $value   = trim( $value );
585 584
         $nl      = $this->getConfig('delimiter');
586 585
         if( $nl == substr( $value, ( 0 - strlen( $nl ))))
587
-          $value = substr( $value, 0, ( strlen( $value ) - strlen( $nl )));
586
+            $value = substr( $value, 0, ( strlen( $value ) - strlen( $nl )));
588 587
         if( is_dir( $value )) {
589 588
             /* local directory */
590
-          clearstatcache();
591
-          $this->directory = $value;
592
-          $this->url       = null;
593
-          return TRUE;
589
+            clearstatcache();
590
+            $this->directory = $value;
591
+            $this->url       = null;
592
+            return TRUE;
594 593
         }
595 594
         else
596
-          return FALSE;
595
+            return FALSE;
597 596
         break;
598
-      case 'FILENAME':
597
+        case 'FILENAME':
599 598
         $value   = trim( $value );
600 599
         if( !empty( $this->url )) {
601 600
             /* remote directory+file - URL */
602
-          $this->filename = $value;
603
-          return TRUE;
601
+            $this->filename = $value;
602
+            return TRUE;
604 603
         }
605 604
         $dirfile = $this->getConfig( 'directory' ).$this->getConfig( 'delimiter' ).$value;
606 605
         if( file_exists( $dirfile )) {
607 606
             /* local existing file */
608
-          if( is_readable( $dirfile ) || is_writable( $dirfile )) {
607
+            if( is_readable( $dirfile ) || is_writable( $dirfile )) {
609 608
             clearstatcache();
610 609
             $this->filename = $value;
611 610
             return TRUE;
612
-          }
613
-          else
611
+            }
612
+            else
614 613
             return FALSE;
615 614
         }
616 615
         elseif( FALSE !== touch( $dirfile )) {
617 616
             /* new local file created */
618
-          $this->filename = $value;
619
-          return TRUE;
617
+            $this->filename = $value;
618
+            return TRUE;
620 619
         }
621 620
         else
622
-          return FALSE;
621
+            return FALSE;
623 622
         break;
624
-      case 'FORMAT':
623
+        case 'FORMAT':
625 624
         $value   = trim( $value );
626 625
         if( 'xcal' == strtolower( $value )) {
627
-          $this->format             = 'xcal';
628
-          $this->attributeDelimiter = $this->nl;
629
-          $this->valueInit          = null;
626
+            $this->format             = 'xcal';
627
+            $this->attributeDelimiter = $this->nl;
628
+            $this->valueInit          = null;
630 629
         }
631 630
         else {
632
-          $this->format             = null;
633
-          $this->attributeDelimiter = ';';
634
-          $this->valueInit          = ':';
631
+            $this->format             = null;
632
+            $this->attributeDelimiter = ';';
633
+            $this->valueInit          = ':';
635 634
         }
636 635
         $subcfg  = array( 'FORMAT' => $value );
637 636
         $res = TRUE;
638 637
         break;
639
-      case 'LANGUAGE':
638
+        case 'LANGUAGE':
640 639
          // set language for calendar component as defined in [RFC 1766]
641 640
         $value   = trim( $value );
642 641
         $this->language = $value;
643 642
         $subcfg  = array( 'LANGUAGE' => $value );
644 643
         $res = TRUE;
645 644
         break;
646
-      case 'NL':
645
+        case 'NL':
647 646
       case 'NEWLINECHAR':
648 647
         $this->nl = $value;
649 648
         $subcfg  = array( 'NL' => $value );
650 649
         $res = TRUE;
651 650
         break;
652
-      case 'UNIQUE_ID':
651
+        case 'UNIQUE_ID':
653 652
         $value   = trim( $value );
654 653
         $this->unique_id = $value;
655 654
         $subcfg  = array( 'UNIQUE_ID' => $value );
656 655
         $res = TRUE;
657 656
         break;
658
-      case 'URL':
657
+        case 'URL':
659 658
             /* remote file - URL */
660 659
         $value     = trim( $value );
661 660
         $value     = str_replace( 'HTTP://',   'http://', $value );
@@ -669,17 +668,17 @@  discard block
 block discarded – undo
669 668
     }
670 669
     if( !$res ) return FALSE;
671 670
     if( isset( $subcfg ) && !empty( $this->components )) {
672
-      foreach( $subcfg as $cfgkey => $cfgvalue ) {
671
+        foreach( $subcfg as $cfgkey => $cfgvalue ) {
673 672
         foreach( $this->components as $cix => $component ) {
674
-          $res = $component->setConfig( $cfgkey, $cfgvalue );
675
-          if( !$res )
673
+            $res = $component->setConfig( $cfgkey, $cfgvalue );
674
+            if( !$res )
676 675
             break 2;
677
-          $this->components[$cix] = $component->copy(); // PHP4 compliant
676
+            $this->components[$cix] = $component->copy(); // PHP4 compliant
677
+        }
678 678
         }
679
-      }
680 679
     }
681 680
     return $res;
682
-  }
681
+    }
683 682
 /*********************************************************************************/
684 683
 /**
685 684
  * add calendar component to container
@@ -691,129 +690,129 @@  discard block
 block discarded – undo
691 690
  * @param object $component calendar component
692 691
  * @return void
693 692
  */
694
-  function addComponent( $component ) {
693
+    function addComponent( $component ) {
695 694
     $this->setComponent( $component );
696
-  }
695
+    }
697 696
 /**
698
- * delete calendar component from container
699
- *
700
- * @author Kjell-Inge Gustafsson <[email protected]>
701
- * @since 2.4.10 - 2008-08-05
702
- * @param mixed $arg1 ordno / component type / component uid
703
- * @param mixed $arg2 optional, ordno if arg1 = component type
704
- * @return void
705
- */
706
-  function deleteComponent( $arg1, $arg2=FALSE  ) {
697
+     * delete calendar component from container
698
+     *
699
+     * @author Kjell-Inge Gustafsson <[email protected]>
700
+     * @since 2.4.10 - 2008-08-05
701
+     * @param mixed $arg1 ordno / component type / component uid
702
+     * @param mixed $arg2 optional, ordno if arg1 = component type
703
+     * @return void
704
+     */
705
+    function deleteComponent( $arg1, $arg2=FALSE  ) {
707 706
     $argType = $index = null;
708 707
     if ( ctype_digit( (string) $arg1 )) {
709
-      $argType = 'INDEX';
710
-      $index   = (int) $arg1 - 1;
708
+        $argType = 'INDEX';
709
+        $index   = (int) $arg1 - 1;
711 710
     }
712 711
     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
+        $argType = strtolower( $arg1 );
713
+        $index   = ( !empty( $arg2 ) && ctype_digit( (string) $arg2 )) ? (( int ) $arg2 - 1 ) : 0;
715 714
     }
716 715
     $cix1dC = 0;
717 716
     foreach ( $this->components as $cix => $component) {
718
-      if( empty( $component )) continue;
719
-      unset( $component->propix );
720
-      if(( 'INDEX' == $argType ) && ( $index == $cix )) {
717
+        if( empty( $component )) continue;
718
+        unset( $component->propix );
719
+        if(( 'INDEX' == $argType ) && ( $index == $cix )) {
721 720
         unset( $this->components[$cix] );
722 721
         return TRUE;
723
-      }
724
-      elseif( $argType == $component->objName ) {
722
+        }
723
+        elseif( $argType == $component->objName ) {
725 724
         if( $index == $cix1dC ) {
726
-          unset( $this->components[$cix] );
727
-          return TRUE;
725
+            unset( $this->components[$cix] );
726
+            return TRUE;
728 727
         }
729 728
         $cix1dC++;
730
-      }
731
-      elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) {
729
+        }
730
+        elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) {
732 731
         unset( $this->components[$cix] );
733 732
         return TRUE;
734
-      }
733
+        }
735 734
     }
736 735
     return FALSE;
737
-  }
736
+    }
738 737
 /**
739
- * get calendar component from container
740
- *
741
- * @author Kjell-Inge Gustafsson <[email protected]>
742
- * @since 2.4.10 - 2008-08-06
743
- * @param mixed $arg1 optional, ordno/component type/ component uid
744
- * @param mixed $arg2 optional, ordno if arg1 = component type
745
- * @return object
746
- */
747
-  function getComponent( $arg1=FALSE, $arg2=FALSE ) {
738
+     * get calendar component from container
739
+     *
740
+     * @author Kjell-Inge Gustafsson <[email protected]>
741
+     * @since 2.4.10 - 2008-08-06
742
+     * @param mixed $arg1 optional, ordno/component type/ component uid
743
+     * @param mixed $arg2 optional, ordno if arg1 = component type
744
+     * @return object
745
+     */
746
+    function getComponent( $arg1=FALSE, $arg2=FALSE ) {
748 747
     $index = $argType = null;
749 748
     if ( !$arg1 ) {
750
-      $argType = 'INDEX';
751
-      $index   = $this->compix['INDEX'] =
749
+        $argType = 'INDEX';
750
+        $index   = $this->compix['INDEX'] =
752 751
         ( isset( $this->compix['INDEX'] )) ? $this->compix['INDEX'] + 1 : 1;
753 752
     }
754 753
     elseif ( ctype_digit( (string) $arg1 )) {
755
-      $argType = 'INDEX';
756
-      $index   = (int) $arg1;
757
-      unset( $this->compix );
754
+        $argType = 'INDEX';
755
+        $index   = (int) $arg1;
756
+        unset( $this->compix );
758 757
     }
759 758
     elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) {
760
-      unset( $this->compix['INDEX'] );
761
-      $argType = strtolower( $arg1 );
762
-      if( !$arg2 )
759
+        unset( $this->compix['INDEX'] );
760
+        $argType = strtolower( $arg1 );
761
+        if( !$arg2 )
763 762
         $index = $this->compix[$argType] =
764 763
         ( isset( $this->compix[$argType] )) ? $this->compix[$argType] + 1 : 1;
765
-      else
764
+        else
766 765
         $index = (int) $arg2;
767 766
     }
768 767
     $index  -= 1;
769 768
     $ckeys =  array_keys( $this->components );
770 769
     if( !empty( $index) && ( $index > end(  $ckeys )))
771
-      return FALSE;
770
+        return FALSE;
772 771
     $cix1gC = 0;
773 772
     foreach ( $this->components as $cix => $component) {
774
-      if( empty( $component )) continue;
775
-      unset( $component->propix );
776
-      if(( 'INDEX' == $argType ) && ( $index == $cix ))
773
+        if( empty( $component )) continue;
774
+        unset( $component->propix );
775
+        if(( 'INDEX' == $argType ) && ( $index == $cix ))
777 776
         return $component->copy();
778
-      elseif( $argType == $component->objName ) {
779
-         if( $index == $cix1gC )
780
-           return $component->copy();
781
-         $cix1gC++;
782
-      }
783
-      elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) {
777
+        elseif( $argType == $component->objName ) {
778
+            if( $index == $cix1gC )
779
+            return $component->copy();
780
+            $cix1gC++;
781
+        }
782
+        elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) {
784 783
         unset( $component->propix );
785 784
         return $component->copy();
786
-      }
785
+        }
787 786
     }
788 787
             /* not found.. . */
789 788
     unset( $this->compix );
790 789
     return FALSE;
791
-  }
790
+    }
792 791
 /**
793
- * select components from calendar on date basis
794
- *
795
- * Ensure DTSTART is set for every component.
796
- * No date controls occurs.
797
- *
798
- * @author Kjell-Inge Gustafsson <[email protected]>
799
- * @since 2.4.16 - 2008-10-18
800
- * @param int $startY optional,  start Year, default current Year
801
- * @param int $startM optional,  start Month, default current Month
802
- * @param int $startD optional,  start Day, default current Day
803
- * @param int $endY optional,    end Year, default $startY
804
- * @param int $endY optional,    end Month, default $startM
805
- * @param int $endY optional,    end Day, default $startD
806
- * @param mixed $cType optional, calendar component type(-s), default FALSE=all else string/array type(-s)
807
- * @param bool $flat optional,   FALSE (default) => output : array[Year][Month][Day][]
808
- *                               TRUE => output : array[] (ignores split)
809
- * @param bool $any optional,    TRUE (default) - select component that take place within period
810
- *                               FALSE - only components that starts within period
811
- * @param bool $split optional,  TRUE (default) - one component copy every day it take place during the
812
- *                                       period (implies flat=FALSE)
813
- *                               FALSE - one occurance of component only in output array</tr>
814
- * @return array or FALSE
815
- */
816
-  function selectComponents( $startY=FALSE, $startM=FALSE, $startD=FALSE, $endY=FALSE, $endM=FALSE, $endD=FALSE, $cType=FALSE, $flat=FALSE, $any=TRUE, $split=TRUE ) {
792
+     * select components from calendar on date basis
793
+     *
794
+     * Ensure DTSTART is set for every component.
795
+     * No date controls occurs.
796
+     *
797
+     * @author Kjell-Inge Gustafsson <[email protected]>
798
+     * @since 2.4.16 - 2008-10-18
799
+     * @param int $startY optional,  start Year, default current Year
800
+     * @param int $startM optional,  start Month, default current Month
801
+     * @param int $startD optional,  start Day, default current Day
802
+     * @param int $endY optional,    end Year, default $startY
803
+     * @param int $endY optional,    end Month, default $startM
804
+     * @param int $endY optional,    end Day, default $startD
805
+     * @param mixed $cType optional, calendar component type(-s), default FALSE=all else string/array type(-s)
806
+     * @param bool $flat optional,   FALSE (default) => output : array[Year][Month][Day][]
807
+     *                               TRUE => output : array[] (ignores split)
808
+     * @param bool $any optional,    TRUE (default) - select component that take place within period
809
+     *                               FALSE - only components that starts within period
810
+     * @param bool $split optional,  TRUE (default) - one component copy every day it take place during the
811
+     *                                       period (implies flat=FALSE)
812
+     *                               FALSE - one occurance of component only in output array</tr>
813
+     * @return array or FALSE
814
+     */
815
+    function selectComponents( $startY=FALSE, $startM=FALSE, $startD=FALSE, $endY=FALSE, $endM=FALSE, $endD=FALSE, $cType=FALSE, $flat=FALSE, $any=TRUE, $split=TRUE ) {
817 816
             /* check  if empty calendar */
818 817
     if( 0 >= count( $this->components )) return FALSE;
819 818
             /* check default dates */
@@ -828,54 +827,54 @@  discard block
 block discarded – undo
828 827
             /* check component types */
829 828
     $validTypes = array('vevent', 'vtodo', 'vjournal', 'vfreebusy' );
830 829
     if( is_array( $cType )) {
831
-      foreach( $cType as $cix => $theType ) {
830
+        foreach( $cType as $cix => $theType ) {
832 831
         $cType[$cix] = $theType = strtolower( $theType );
833 832
         if( !in_array( $theType, $validTypes ))
834
-          $cType[$cix] = 'vevent';
835
-      }
836
-      $cType = array_unique( $cType );
833
+            $cType[$cix] = 'vevent';
834
+        }
835
+        $cType = array_unique( $cType );
837 836
     }
838 837
     elseif( !empty( $cType )) {
839
-      $cType = strtolower( $cType );
840
-      if( !in_array( $cType, $validTypes ))
838
+        $cType = strtolower( $cType );
839
+        if( !in_array( $cType, $validTypes ))
841 840
         $cType = array( 'vevent' );
842
-      else
841
+        else
843 842
         $cType = array( $cType );
844 843
     }
845 844
     else
846
-      $cType = $validTypes;
845
+        $cType = $validTypes;
847 846
     if( 0 >= count( $cType ))
848
-      $cType = $validTypes;
847
+        $cType = $validTypes;
849 848
             /* iterate components */
850 849
     $result = array();
851 850
     foreach ( $this->components as $cix => $component ) {
852
-      if( empty( $component )) continue;
853
-      unset( $component->propix, $start );
851
+        if( empty( $component )) continue;
852
+        unset( $component->propix, $start );
854 853
             /* deselect unvalid type components */
855
-      if( !in_array( $component->objName, $cType )) continue;
854
+        if( !in_array( $component->objName, $cType )) continue;
856 855
             /* deselect components without dtstart set */
857
-      if( FALSE === ( $start = $component->getProperty( 'dtstart' ))) continue;
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';
856
+        if( FALSE === ( $start = $component->getProperty( 'dtstart' ))) continue;
857
+        $dtendExist = $dueExist = $durationExist = $endAllDayEvent = FALSE;
858
+        unset( $end, $startWdate, $endWdate, $rdurWsecs, $rdur, $exdatelist, $workstart, $workend ); // clean up
859
+        $startWdate = $component->_date2timestamp( $start );
860
+        $startDateFormat = ( isset( $start['hour'] )) ? 'Y-m-d H:i:s' : 'Y-m-d';
862 861
             /* get end date from dtend/due/duration properties */
863
-      $end = $component->getProperty( 'dtend' );
864
-      if( !empty( $end )) {
862
+        $end = $component->getProperty( 'dtend' );
863
+        if( !empty( $end )) {
865 864
         $dtendExist = TRUE;
866 865
         $endDateFormat = ( isset( $end['hour'] )) ? 'Y-m-d H:i:s' : 'Y-m-d';
867
-      }
868
-   // if( !empty($end))  echo 'selectComp 1 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
869
-      if( empty($end) && ( $component->objName == 'vtodo' )) {
866
+        }
867
+    // if( !empty($end))  echo 'selectComp 1 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
868
+        if( empty($end) && ( $component->objName == 'vtodo' )) {
870 869
         $end = $component->getProperty( 'due' );
871 870
         if( !empty( $end )) {
872
-          $dueExist = TRUE;
873
-          $endDateFormat = ( isset( $end['hour'] )) ? 'Y-m-d H:i:s' : 'Y-m-d';
871
+            $dueExist = TRUE;
872
+            $endDateFormat = ( isset( $end['hour'] )) ? 'Y-m-d H:i:s' : 'Y-m-d';
873
+        }
874
+    // if( !empty($end))  echo 'selectComp 2 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
874 875
         }
875
-   // if( !empty($end))  echo 'selectComp 2 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
876
-      }
877
-      if( !empty( $end ) && !isset( $end['hour'] )) {
878
-          /* a DTEND without time part regards an event that ends the day before,
876
+        if( !empty( $end ) && !isset( $end['hour'] )) {
877
+            /* a DTEND without time part regards an event that ends the day before,
879 878
              for an all-day event DTSTART=20071201 DTEND=20071202 (taking place 20071201!!! */
880 879
         $endAllDayEvent = TRUE;
881 880
         $endWdate = mktime( 23, 59, 59, $end['month'], ($end['day'] - 1), $end['year'] );
@@ -884,575 +883,575 @@  discard block
 block discarded – undo
884 883
         $end['day']   = date( 'd', $endWdate );
885 884
         $end['hour']  = 23;
886 885
         $end['min']   = $end['sec'] = 59;
887
-   // if( !empty($end))  echo 'selectComp 3 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
888
-      }
889
-      if( empty( $end )) {
886
+    // if( !empty($end))  echo 'selectComp 3 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
887
+        }
888
+        if( empty( $end )) {
890 889
         $end = $component->getProperty( 'duration', FALSE, FALSE, TRUE );// in dtend (array) format
891 890
         if( !empty( $end ))
892
-          $durationExist = TRUE;
893
-   // if( !empty($end))  echo 'selectComp 4 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
894
-      }
895
-      if( empty( $end )) { // assume one day duration if missing end date
891
+            $durationExist = TRUE;
892
+    // if( !empty($end))  echo 'selectComp 4 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
893
+        }
894
+        if( empty( $end )) { // assume one day duration if missing end date
896 895
         $end = array( 'year' => $start['year'], 'month' => $start['month'], 'day' => $start['day'], 'hour' => 23, 'min' => 59, 'sec' => 59 );
897
-   // if( isset($end))  echo 'selectComp 5 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
898
-      }
899
-      $endWdate = $component->_date2timestamp( $end );
900
-      if( $endWdate < $startWdate ) { // MUST be after start date!!
896
+    // if( isset($end))  echo 'selectComp 5 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
897
+        }
898
+        $endWdate = $component->_date2timestamp( $end );
899
+        if( $endWdate < $startWdate ) { // MUST be after start date!!
901 900
         $end = array( 'year' => $start['year'], 'month' => $start['month'], 'day' => $start['day'], 'hour' => 23, 'min' => 59, 'sec' => 59 );
902 901
         $endWdate = $component->_date2timestamp( $end );
903
-      }
904
-      $rdurWsecs  = $endWdate - $startWdate; // compute component duration in seconds
905
-      $rdur       = $component->_date2duration( $start, $end ); // compute component duration, array
902
+        }
903
+        $rdurWsecs  = $endWdate - $startWdate; // compute component duration in seconds
904
+        $rdur       = $component->_date2duration( $start, $end ); // compute component duration, array
906 905
             /* make a list of optional exclude dates for component occurence from exrule and exdate */
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
906
+        $exdatelist = array();
907
+        $workstart  = $component->_timestamp2date(( $startDate - $rdurWsecs ), 6);
908
+        $workend    = $component->_timestamp2date(( $endDate + $rdurWsecs ), 6);
909
+        while( FALSE !== ( $exrule = $component->getProperty( 'exrule' )))    // check exrule
911 910
         $component->_recur2date( $exdatelist, $exrule, $start, $workstart, $workend );
912
-      while( FALSE !== ( $exdate = $component->getProperty( 'exdate' ))) {  // check exdate
911
+        while( FALSE !== ( $exdate = $component->getProperty( 'exdate' ))) {  // check exdate
913 912
         foreach( $exdate as $theExdate ) {
914
-          $exWdate = $component->_date2timestamp( $theExdate );
915
-          if((( $startDate - $rdurWsecs ) <= $exWdate ) && ( $endDate >= $exWdate ))
913
+            $exWdate = $component->_date2timestamp( $theExdate );
914
+            if((( $startDate - $rdurWsecs ) <= $exWdate ) && ( $endDate >= $exWdate ))
916 915
             $exdatelist[$exWdate] = TRUE;
917 916
         }
918
-      }
917
+        }
919 918
             /* if 'any' components, check repeating components, removing all excluding dates */
920
-      if( TRUE === $any ) {
919
+        if( TRUE === $any ) {
921 920
             /* make a list of optional repeating dates for component occurence, rrule, rdate */
922 921
         $recurlist = array();
923 922
         while( FALSE !== ( $rrule = $component->getProperty( 'rrule' )))    // check rrule
924
-          $component->_recur2date( $recurlist, $rrule, $start, $workstart, $workend );
923
+            $component->_recur2date( $recurlist, $rrule, $start, $workstart, $workend );
925 924
         foreach( $recurlist as $recurkey => $recurvalue ) // key=match date as timestamp
926
-          $recurlist[$recurkey] = $rdurWsecs; // add duration in seconds
925
+            $recurlist[$recurkey] = $rdurWsecs; // add duration in seconds
927 926
         while( FALSE !== ( $rdate = $component->getProperty( 'rdate' ))) {  // check rdate
928
-          foreach( $rdate as $theRdate ) {
927
+            foreach( $rdate as $theRdate ) {
929 928
             if( is_array( $theRdate ) && ( 2 == count( $theRdate )) &&  // all days within PERIOD
930 929
                    array_key_exists( '0', $theRdate ) &&  array_key_exists( '1', $theRdate )) {
931
-              $rstart = $component->_date2timestamp( $theRdate[0] );
932
-              if(( $rstart < ( $startDate - $rdurWsecs )) || ( $rstart > $endDate ))
930
+                $rstart = $component->_date2timestamp( $theRdate[0] );
931
+                if(( $rstart < ( $startDate - $rdurWsecs )) || ( $rstart > $endDate ))
933 932
                 continue;
934
-              if( isset( $theRdate[1]['year'] )) // date-date period
933
+                if( isset( $theRdate[1]['year'] )) // date-date period
935 934
                 $rend = $component->_date2timestamp( $theRdate[1] );
936
-              else {                             // date-duration period
935
+                else {                             // date-duration period
937 936
                 $rend = $component->duration2date( $theRdate[0], $theRdate[1] );
938 937
                 $rend = $component->_date2timestamp( $rend );
939
-              }
940
-              if((( $startDate - $rdurWsecs ) <= $rstart ) && ( $endDate >= $rstart ))
938
+                }
939
+                if((( $startDate - $rdurWsecs ) <= $rstart ) && ( $endDate >= $rstart ))
941 940
                 $recurlist[$rstart] = ( $rstart - $rend ); // set start date + rdate duration in seconds
942 941
             } // PERIOD end
943 942
             else { // single date
944
-              $theRdate = $component->_date2timestamp( $theRdate );
945
-              if((( $startDate - $rdurWsecs ) <= $theRdate ) && ( $endDate >= $theRdate ))
943
+                $theRdate = $component->_date2timestamp( $theRdate );
944
+                if((( $startDate - $rdurWsecs ) <= $theRdate ) && ( $endDate >= $theRdate ))
946 945
                 $recurlist[$theRdate] = $rdurWsecs; // set start date + event duration in seconds
947 946
             }
948
-          }
947
+            }
949 948
         }
950 949
         if( 0 < count( $recurlist )) {
951
-          ksort( $recurlist );
952
-          foreach( $recurlist as $recurkey => $durvalue ) {
950
+            ksort( $recurlist );
951
+            foreach( $recurlist as $recurkey => $durvalue ) {
953 952
             if((( $startDate - $rdurWsecs ) > $recurkey ) || ( $endDate < $recurkey )) // not within period
954
-              continue;
953
+                continue;
955 954
             if( isset( $exdatelist[$recurkey] )) // check excluded dates
956
-              continue;
955
+                continue;
957 956
             if( $startWdate >= $recurkey ) // exclude component start date
958
-              continue;
957
+                continue;
959 958
             $component2   = $component->copy();
960 959
             $rstart       = $component2->_timestamp2date( $recurkey, 6);
961 960
             $datevalue    = $rstart['month'].'/'.$rstart['day'].'/'.$rstart['year'];
962 961
             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
+                $datevalue .= ( isset( $rstart['hour'] )) ? ' '.$rstart['hour'] : ' 00';
963
+                $datevalue .= ( isset( $rstart['min'] ))  ? ':'.$rstart['min']  : ':00';
964
+                $datevalue .= ( isset( $rstart['sec'] ))  ? ':'.$rstart['sec']  : ':00';
966 965
             }
967 966
             $datestring = date( $startDateFormat, strtotime( $datevalue ));
968 967
             if( isset( $start['tz'] ))
969
-              $datestring .= ' '.$start['tz'];
968
+                $datestring .= ' '.$start['tz'];
970 969
             $component2->setProperty( 'X-CURRENT-DTSTART', $datestring );
971 970
             $rend   = $component2->_timestamp2date(( $recurkey + $durvalue ), 6);
972 971
             if( $dtendExist || $dueExist ) {
973
-              if( $endAllDayEvent ) {
972
+                if( $endAllDayEvent ) {
974 973
                 $rend2 = mktime( 0, 0, 0, $rend['month'], ($rend['day'] + 1), $rend['year'] );
975 974
                 $datevalue  = date( 'm', $rend2 ).'/'.date( 'd', $rend2 ).'/'.date( 'Y', $rend2 );
976
-              }
977
-              else {
975
+                }
976
+                else {
978 977
                 $datevalue  = $rend['month'].'/'.$rend['day'].'/'.$rend['year'];
979 978
                 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
+                    $datevalue .= ( isset( $rend['hour'] )) ? ' '.$rend['hour'] : ' 00';
980
+                    $datevalue .= ( isset( $rend['min'] ))  ? ':'.$rend['min']  : ':00';
981
+                    $datevalue .= ( isset( $rend['sec'] ))  ? ':'.$rend['sec']  : ':00';
982
+                }
983 983
                 }
984
-              }
985
-              $datestring = date( $endDateFormat, strtotime( $datevalue ));
986
-              if( isset( $end['tz'] ))
984
+                $datestring = date( $endDateFormat, strtotime( $datevalue ));
985
+                if( isset( $end['tz'] ))
987 986
                 $datestring .= ' '.$end['tz'];
988
-              if( $dtendExist )
987
+                if( $dtendExist )
989 988
                 $component2->setProperty( 'X-CURRENT-DTEND', $datestring );
990
-              elseif( $dueExist )
989
+                elseif( $dueExist )
991 990
                 $component2->setProperty( 'X-CURRENT-DUE', $datestring );
992 991
             }
993 992
             $rend   = $component2->_date2timestamp( $rend );
994 993
             $rstart = $recurkey;
995 994
             /* add repeating components within valid dates to output array, only start date */
996 995
             if( $flat )
997
-              $result[] = $component2->copy(); // copy to output
996
+                $result[] = $component2->copy(); // copy to output
998 997
             elseif( $split ) {
999
-              if( $rend > $endDate )
998
+                if( $rend > $endDate )
1000 999
                 $rend = $endDate;
1001
-              while( $rstart <= $rend ) { // iterate
1000
+                while( $rstart <= $rend ) { // iterate
1002 1001
                 $wd = getdate( $rstart );
1003 1002
                 if(( $rstart > $startDate ) &&      // date after dtstart
1004 1003
                     !isset( $exdatelist[$rstart] )) // check exclude date
1005
-                  $result[$wd['year']][$wd['mon']][$wd['mday']][] = $component2->copy(); // copy to output
1004
+                    $result[$wd['year']][$wd['mon']][$wd['mday']][] = $component2->copy(); // copy to output
1006 1005
                 $rstart += ( 24*60*60 ); // step one day
1007
-              }
1006
+                }
1008 1007
             }
1009 1008
             elseif(( $rstart >= $startDate ) &&     // date within period
1010 1009
                   !isset( $exdatelist[$rstart] )) { // check exclude date
1011
-              $wd = getdate( $rstart );
1012
-              $result[$wd['year']][$wd['mon']][$wd['mday']][] = $component2->copy(); // copy to output
1010
+                $wd = getdate( $rstart );
1011
+                $result[$wd['year']][$wd['mon']][$wd['mday']][] = $component2->copy(); // copy to output
1012
+            }
1013 1013
             }
1014
-          }
1015 1014
         }
1016 1015
             /* deselect components with startdate/enddate not within period */
1017 1016
         if(( $endWdate < $startDate ) || ( $startWdate > $endDate )) continue;
1018
-      }
1017
+        }
1019 1018
             /* deselect components with startdate not within period */
1020
-      elseif(( $startWdate < $startDate ) || ( $startWdate > $endDate )) continue;
1019
+        elseif(( $startWdate < $startDate ) || ( $startWdate > $endDate )) continue;
1021 1020
             /* add selected components within valid dates to output array */
1022
-      if( $flat )
1021
+        if( $flat )
1023 1022
         $result[] = $component->copy(); // copy to output;
1024
-      elseif( $split ) {
1023
+        elseif( $split ) {
1025 1024
         if( $endWdate > $endDate )
1026
-          $endWdate = $endDate;     // use period end date
1025
+            $endWdate = $endDate;     // use period end date
1027 1026
         if( !isset( $exdatelist[$startWdate] ))  { // check excluded dates
1028
-          if( $startWdate < $startDate )
1027
+            if( $startWdate < $startDate )
1029 1028
             $startWdate = $startDate; // use period start date
1030
-          while( $startWdate <= $endWdate ) { // iterate
1029
+            while( $startWdate <= $endWdate ) { // iterate
1031 1030
             $wd = getdate( $startWdate );
1032 1031
             $result[$wd['year']][$wd['mon']][$wd['mday']][] = $component->copy(); // copy to output
1033 1032
             $startWdate += ( 24*60*60 ); // step one day
1034
-          }
1033
+            }
1035 1034
         }
1036
-      } // use component date
1037
-      elseif( !isset( $exdatelist[$startWdate] ) &&   // check excluded dates
1035
+        } // use component date
1036
+        elseif( !isset( $exdatelist[$startWdate] ) &&   // check excluded dates
1038 1037
             ( $startWdate >= $startDate )) {          // within period
1039 1038
         $wd = getdate( $startWdate );
1040 1039
         $result[$wd['year']][$wd['mon']][$wd['mday']][] = $component->copy(); // copy to output
1041
-      }
1040
+        }
1042 1041
     }
1043 1042
     if( 0 >= count( $result )) return FALSE;
1044 1043
     elseif( !$flat ) {
1045
-      foreach( $result as $y => $yeararr ) {
1044
+        foreach( $result as $y => $yeararr ) {
1046 1045
         foreach( $yeararr as $m => $montharr ) {
1047
-          ksort( $result[$y][$m] );
1046
+            ksort( $result[$y][$m] );
1048 1047
         }
1049 1048
         ksort( $result[$y] );
1050
-      }
1051
-      ksort( $result );
1049
+        }
1050
+        ksort( $result );
1052 1051
     }
1053 1052
     return $result;
1054
-  }
1053
+    }
1055 1054
 /**
1056
- * add calendar component to container
1057
- *
1058
- * @author Kjell-Inge Gustafsson <[email protected]>
1059
- * @since 2.4.10 - 2008-08-06
1060
- * @param object $component calendar component
1061
- * @param mixed $arg1 optional, ordno/component type/ component uid
1062
- * @param mixed $arg2 optional, ordno if arg1 = component type
1063
- * @return void
1064
- */
1065
-  function setComponent( $component, $arg1=FALSE, $arg2=FALSE  ) {
1055
+     * add calendar component to container
1056
+     *
1057
+     * @author Kjell-Inge Gustafsson <[email protected]>
1058
+     * @since 2.4.10 - 2008-08-06
1059
+     * @param object $component calendar component
1060
+     * @param mixed $arg1 optional, ordno/component type/ component uid
1061
+     * @param mixed $arg2 optional, ordno if arg1 = component type
1062
+     * @return void
1063
+     */
1064
+    function setComponent( $component, $arg1=FALSE, $arg2=FALSE  ) {
1066 1065
     if( '' >= $component->getConfig( 'language'))
1067
-      $component->setConfig( 'language',  $this->getConfig( 'language' ));
1066
+        $component->setConfig( 'language',  $this->getConfig( 'language' ));
1068 1067
     $component->setConfig( 'allowEmpty',  $this->getConfig( 'allowEmpty' ));
1069 1068
     $component->setConfig( 'nl',          $this->getConfig( 'nl' ));
1070 1069
     $component->setConfig( 'unique_id',   $this->getConfig( 'unique_id' ));
1071 1070
     $component->setConfig( 'format',      $this->getConfig( 'format' ));
1072 1071
     if( !in_array( $component->objName, array( 'valarm', 'vtimezone' ))) {
1073
-      unset( $component->propix );
1072
+        unset( $component->propix );
1074 1073
             /* make sure dtstamp and uid is set */
1075
-      $dummy1 = $component->getProperty( 'dtstamp' );
1076
-      $dummy2 = $component->getProperty( 'uid' );
1074
+        $dummy1 = $component->getProperty( 'dtstamp' );
1075
+        $dummy2 = $component->getProperty( 'uid' );
1077 1076
     }
1078 1077
     if( !$arg1 ) {
1079
-      $this->components[] = $component->copy();
1080
-      return TRUE;
1078
+        $this->components[] = $component->copy();
1079
+        return TRUE;
1081 1080
     }
1082 1081
     $argType = $index = null;
1083 1082
     if ( ctype_digit( (string) $arg1 )) {
1084
-      $argType = 'INDEX';
1085
-      $index   = (int) $arg1 - 1;
1083
+        $argType = 'INDEX';
1084
+        $index   = (int) $arg1 - 1;
1086 1085
     }
1087 1086
     elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) {
1088
-      $argType = strtolower( $arg1 );
1089
-      $index = ( ctype_digit( (string) $arg2 )) ? ((int) $arg2) - 1 : 0;
1087
+        $argType = strtolower( $arg1 );
1088
+        $index = ( ctype_digit( (string) $arg2 )) ? ((int) $arg2) - 1 : 0;
1090 1089
     }
1091 1090
     $cix1sC = 0;
1092 1091
     foreach ( $this->components as $cix => $component2) {
1093
-      if( empty( $component2 )) continue;
1094
-      unset( $component2->propix );
1095
-      if(( 'INDEX' == $argType ) && ( $index == $cix )) {
1092
+        if( empty( $component2 )) continue;
1093
+        unset( $component2->propix );
1094
+        if(( 'INDEX' == $argType ) && ( $index == $cix )) {
1096 1095
         $this->components[$cix] = $component->copy();
1097 1096
         return TRUE;
1098
-      }
1099
-      elseif( $argType == $component2->objName ) {
1097
+        }
1098
+        elseif( $argType == $component2->objName ) {
1100 1099
         if( $index == $cix1sC ) {
1101
-          $this->components[$cix] = $component->copy();
1102
-          return TRUE;
1100
+            $this->components[$cix] = $component->copy();
1101
+            return TRUE;
1103 1102
         }
1104 1103
         $cix1sC++;
1105
-      }
1106
-      elseif( !$argType && ( $arg1 == $component2->getProperty( 'uid' ))) {
1104
+        }
1105
+        elseif( !$argType && ( $arg1 == $component2->getProperty( 'uid' ))) {
1107 1106
         $this->components[$cix] = $component->copy();
1108 1107
         return TRUE;
1109
-      }
1108
+        }
1110 1109
     }
1111 1110
             /* not found.. . insert last in chain anyway .. .*/
1112 1111
     $this->components[] = $component->copy();
1113 1112
     return TRUE;
1114
-  }
1113
+    }
1115 1114
 /**
1116
- * sort iCal compoments, only local date sort
1117
- *
1118
- * ascending sort on properties (if exist) x-current-dtstart, dtstart,
1119
- * x-current-dtend, dtend, x-current-due, due, duration, created, dtstamp, uid
1120
- *
1121
- * @author Kjell-Inge Gustafsson <[email protected]>
1122
- * @since 2.4.10 - 2008-09-24
1123
- * @return sort param
1124
- *
1125
- */
1126
-  function sort() {
1115
+     * sort iCal compoments, only local date sort
1116
+     *
1117
+     * ascending sort on properties (if exist) x-current-dtstart, dtstart,
1118
+     * x-current-dtend, dtend, x-current-due, due, duration, created, dtstamp, uid
1119
+     *
1120
+     * @author Kjell-Inge Gustafsson <[email protected]>
1121
+     * @since 2.4.10 - 2008-09-24
1122
+     * @return sort param
1123
+     *
1124
+     */
1125
+    function sort() {
1127 1126
     if( is_array( $this->components )) {
1128
-      $this->_sortkeys = array( 'year', 'month', 'day', 'hour', 'min', 'sec' );
1129
-      usort( $this->components, array( $this, '_cmpfcn' ));
1127
+        $this->_sortkeys = array( 'year', 'month', 'day', 'hour', 'min', 'sec' );
1128
+        usort( $this->components, array( $this, '_cmpfcn' ));
1130 1129
     }
1131
-  }
1132
-  function _cmpfcn( $a, $b ) {
1130
+    }
1131
+    function _cmpfcn( $a, $b ) {
1133 1132
     if( empty( $a ))                                   return -1;
1134 1133
     if( empty( $b ))                                   return  1;
1135 1134
     if(  'vtimezone' == $a->objName)                   return -1;
1136 1135
     if(  'vtimezone' == $b->objName)                   return  1;
1137 1136
     $astart = ( isset( $a->xprop['X-CURRENT-DTSTART']['value'] )) ? $a->_date_time_string( $a->xprop['X-CURRENT-DTSTART']['value'] ) : null;
1138 1137
     if( empty( $astart ) && isset( $a->dtstart['value'] ))
1139
-      $astart = & $a->dtstart['value'];
1138
+        $astart = & $a->dtstart['value'];
1140 1139
     $bstart = ( isset( $b->xprop['X-CURRENT-DTSTART']['value'] )) ? $b->_date_time_string( $b->xprop['X-CURRENT-DTSTART']['value'] ) : null;
1141 1140
     if( empty( $bstart ) && isset( $b->dtstart['value'] ))
1142
-      $bstart = & $b->dtstart['value'];
1141
+        $bstart = & $b->dtstart['value'];
1143 1142
     if(     empty( $astart ))                          return -1;
1144 1143
     elseif( empty( $bstart ))                          return  1;
1145 1144
     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
-                                                       return -1;
1151
-      elseif(( (int) $astart[$key] ) > ((int) $bstart[$key] ))
1152
-                                                       return  1;
1145
+        if    ( empty( $astart[$key] ))                  return -1;
1146
+        elseif( empty( $bstart[$key] ))                  return  1;
1147
+        if    (        $astart[$key] == $bstart[$key])   continue;
1148
+        if    (( (int) $astart[$key] ) < ((int) $bstart[$key] ))
1149
+                                                        return -1;
1150
+        elseif(( (int) $astart[$key] ) > ((int) $bstart[$key] ))
1151
+                                                        return  1;
1153 1152
     }
1154 1153
     $c   = ( isset( $a->xprop['X-CURRENT-DTEND']['value'] )) ? $a->_date_time_string( $a->xprop['X-CURRENT-DTEND']['value'] ) : null;
1155 1154
     if(     empty( $c ) && !empty( $a->dtend['value'] ))
1156
-      $c = & $a->dtend['value'];
1155
+        $c = & $a->dtend['value'];
1157 1156
     if(     empty( $c ) && isset( $a->xprop['X-CURRENT-DUE']['value'] ))
1158
-      $c = $a->_date_time_string( $a->xprop['X-CURRENT-DUE']['value'] );
1157
+        $c = $a->_date_time_string( $a->xprop['X-CURRENT-DUE']['value'] );
1159 1158
     if(     empty( $c ) && !empty( $a->due['value'] ))
1160
-      $c = & $a->due['value'];
1159
+        $c = & $a->due['value'];
1161 1160
     if(     empty( $c ) && !empty( $a->duration['value'] ))
1162
-      $c = $a->duration2date();
1161
+        $c = $a->duration2date();
1163 1162
     $d   = ( isset( $b->xprop['X-CURRENT-DTEND']['value'] )) ? $b->_date_time_string( $b->xprop['X-CURRENT-DTEND']['value'] ) : null;
1164 1163
     if(     empty( $d ) && !empty( $b->dtend['value'] ))
1165
-      $d = & $b->dtend['value'];
1164
+        $d = & $b->dtend['value'];
1166 1165
     if(     empty( $d ) && isset( $b->xprop['X-CURRENT-DUE']['value'] ))
1167
-      $d = $b->_date_time_string( $b->xprop['X-CURRENT-DUE']['value'] );
1166
+        $d = $b->_date_time_string( $b->xprop['X-CURRENT-DUE']['value'] );
1168 1167
     if(     empty( $d ) && !empty( $b->due['value'] ))
1169
-      $d = & $b->due['value'];
1168
+        $d = & $b->due['value'];
1170 1169
     if(     empty( $d ) && !empty( $b->duration['value'] ))
1171
-      $d = $b->duration2date();
1170
+        $d = $b->duration2date();
1172 1171
     if(     empty( $c ))                               return -1;
1173 1172
     elseif( empty( $d ))                               return  1;
1174 1173
     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;
1174
+        if    ( !isset( $c[$key] ))                      return -1;
1175
+        elseif( !isset( $d[$key] ))                      return  1;
1176
+        if    (         $c[$key] == $d[$key] )           continue;
1177
+        if    ((  (int) $c[$key] ) < ((int) $d[$key]))   return -1;
1178
+        elseif((  (int) $c[$key] ) > ((int) $d[$key]))   return  1;
1180 1179
     }
1181 1180
     if( isset( $a->created['value'] ))
1182
-     $e = & $a->created['value'];
1181
+        $e = & $a->created['value'];
1183 1182
     else
1184
-     $e = & $a->dtstamp['value'];
1183
+        $e = & $a->dtstamp['value'];
1185 1184
     if( isset( $b->created['value'] ))
1186
-      $f = & $b->created['value'];
1185
+        $f = & $b->created['value'];
1187 1186
     else
1188
-      $f = & $b->dtstamp['value'];
1187
+        $f = & $b->dtstamp['value'];
1189 1188
     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;
1189
+        if(       !isset( $e[$key] ))                    return -1;
1190
+        elseif(   !isset( $f[$key] ))                    return  1;
1191
+        if    (           $e[$key] == $f[$key] )         continue;
1192
+        if    ((    (int) $e[$key] ) < ((int) $f[$key])) return -1;
1193
+        elseif((    (int) $e[$key] ) > ((int) $f[$key])) return  1;
1195 1194
     }
1196 1195
     if    ((            $a->uid['value'] ) <
1197
-           (            $b->uid['value'] ))            return -1;
1196
+            (            $b->uid['value'] ))            return -1;
1198 1197
     elseif((            $a->uid['value'] ) >
1199
-           (            $b->uid['value'] ))            return  1;
1198
+            (            $b->uid['value'] ))            return  1;
1200 1199
     return 0;
1201
-  }
1200
+    }
1202 1201
 /**
1203
- * parse iCal file into vcalendar, components, properties and parameters
1204
- *
1205
- * @author Kjell-Inge Gustafsson <[email protected]>
1206
- * @since 2.4.10 - 2008-08-06
1207
- * @param string $filename optional filname (incl. opt. directory/path) or URL
1208
- * @return bool FALSE if error occurs during parsing
1209
- *
1210
- */
1211
-  function parse( $filename=FALSE ) {
1202
+     * parse iCal file into vcalendar, components, properties and parameters
1203
+     *
1204
+     * @author Kjell-Inge Gustafsson <[email protected]>
1205
+     * @since 2.4.10 - 2008-08-06
1206
+     * @param string $filename optional filname (incl. opt. directory/path) or URL
1207
+     * @return bool FALSE if error occurs during parsing
1208
+     *
1209
+     */
1210
+    function parse( $filename=FALSE ) {
1212 1211
     if( !$filename ) {
1213 1212
             /* directory/filename previous set via setConfig directory+filename / url */
1214
-      if( FALSE === ( $filename = $this->getConfig( 'url' )))
1213
+        if( FALSE === ( $filename = $this->getConfig( 'url' )))
1215 1214
         $filename = $this->getConfig( 'dirfile' );
1216 1215
     }
1217 1216
     elseif(( 'http://'   == strtolower( substr( $filename, 0, 7 ))) ||
1218 1217
            ( 'webcal://' == strtolower( substr( $filename, 0, 9 ))))  {
1219 1218
             /* remote file - URL */
1220
-      $this->setConfig( 'URL', $filename );
1221
-      if( !$filename = $this->getConfig( 'url' ))
1219
+        $this->setConfig( 'URL', $filename );
1220
+        if( !$filename = $this->getConfig( 'url' ))
1222 1221
         return FALSE;                 /* err 2 */
1223 1222
     }
1224 1223
     else {
1225 1224
             /* local directory/filename */
1226
-      $parts = pathinfo( $filename );
1227
-      if( !empty( $parts['dirname'] ) && ( '.' != $parts['dirname'] )) {
1225
+        $parts = pathinfo( $filename );
1226
+        if( !empty( $parts['dirname'] ) && ( '.' != $parts['dirname'] )) {
1228 1227
         if( !$this->setConfig( 'directory', $parts['dirname'] ))
1229
-          return FALSE;               /* err 3 */
1230
-      }
1231
-      if( !$this->setConfig( 'filename', $parts['basename'] ))
1228
+            return FALSE;               /* err 3 */
1229
+        }
1230
+        if( !$this->setConfig( 'filename', $parts['basename'] ))
1232 1231
         return FALSE;                 /* err 4 */
1233 1232
     }
1234 1233
     if( 'http://' != substr( $filename, 0, 7 )) {
1235 1234
             /* local file error tests */
1236
-      if( !is_file( $filename ))      /* err 5 */
1235
+        if( !is_file( $filename ))      /* err 5 */
1237 1236
         return FALSE;
1238
-      if( !is_readable( $filename ))
1237
+        if( !is_readable( $filename ))
1239 1238
         return FALSE;                 /* err 6 */
1240
-      if( !filesize( $filename ))
1239
+        if( !filesize( $filename ))
1241 1240
         return FALSE;                 /* err 7 */
1242
-      clearstatcache();
1241
+        clearstatcache();
1243 1242
     }
1244 1243
             /* READ FILE */
1245 1244
     if( FALSE === ( $rows = file( $filename )))
1246
-      return FALSE;                   /* err 1 */
1245
+        return FALSE;                   /* err 1 */
1247 1246
             /* identify BEGIN:VCALENDAR, MUST be first row */
1248 1247
     if( 'BEGIN:VCALENDAR' != strtoupper( trim( $rows[0] )))
1249
-      return FALSE;                   /* err 8 */
1248
+        return FALSE;                   /* err 8 */
1250 1249
             /* remove empty trailing lines */
1251 1250
     while( '' == trim( $rows[count( $rows ) - 1] )) {
1252
-      unset( $rows[count( $rows ) - 1] );
1253
-      $rows  = array_values( $rows );
1251
+        unset( $rows[count( $rows ) - 1] );
1252
+        $rows  = array_values( $rows );
1254 1253
     }
1255 1254
             /* identify ending END:VCALENDAR row */
1256 1255
     if( 'END:VCALENDAR'   != strtoupper( trim( $rows[count( $rows ) - 1] ))) {
1257
-      return FALSE;                   /* err 9 */
1256
+        return FALSE;                   /* err 9 */
1258 1257
     }
1259 1258
     if( 3 > count( $rows ))
1260
-      return FALSE;                   /* err 10 */
1259
+        return FALSE;                   /* err 10 */
1261 1260
     $comp    = $subcomp = null;
1262 1261
     $actcomp = & $this;
1263 1262
     $nl      = $this->getConfig( 'nl' );
1264 1263
     $calsync = 0;
1265 1264
             /* identify components and update unparsed data within component */
1266 1265
     foreach( $rows as $line ) {
1267
-      if( '' == trim( $line ))
1266
+        if( '' == trim( $line ))
1268 1267
         continue;
1269
-      if( $nl == substr( $line, 0 - strlen( $nl )))
1268
+        if( $nl == substr( $line, 0 - strlen( $nl )))
1270 1269
         $line = substr( $line, 0, ( strlen( $line ) - strlen( $nl ))).'\n';
1271
-      if( 'BEGIN:VCALENDAR' == strtoupper( substr( $line, 0, 15 ))) {
1270
+        if( 'BEGIN:VCALENDAR' == strtoupper( substr( $line, 0, 15 ))) {
1272 1271
         $calsync++;
1273 1272
         continue;
1274
-      }
1275
-      elseif( 'END:VCALENDAR' == strtoupper( substr( $line, 0, 13 ))) {
1273
+        }
1274
+        elseif( 'END:VCALENDAR' == strtoupper( substr( $line, 0, 13 ))) {
1276 1275
         $calsync--;
1277 1276
         continue;
1278
-      }
1279
-      elseif( 1 != $calsync )
1277
+        }
1278
+        elseif( 1 != $calsync )
1280 1279
         return FALSE;                 /* err 20 */
1281
-      if( 'END:' == strtoupper( substr( $line, 0, 4 ))) {
1280
+        if( 'END:' == strtoupper( substr( $line, 0, 4 ))) {
1282 1281
         if( null != $subcomp ) {
1283
-          $comp->setComponent( $subcomp );
1284
-          $subcomp = null;
1282
+            $comp->setComponent( $subcomp );
1283
+            $subcomp = null;
1285 1284
         }
1286 1285
         else {
1287
-          $this->setComponent( $comp );
1288
-          $comp = null;
1286
+            $this->setComponent( $comp );
1287
+            $comp = null;
1289 1288
         }
1290 1289
         $actcomp = null;
1291 1290
         continue;
1292
-      } // end - if ( 'END:' ==.. .
1293
-      elseif( 'BEGIN:' == strtoupper( substr( $line, 0, 6 ))) {
1291
+        } // end - if ( 'END:' ==.. .
1292
+        elseif( 'BEGIN:' == strtoupper( substr( $line, 0, 6 ))) {
1294 1293
         $line = str_replace( '\n', '', $line );
1295 1294
         $compname = trim (strtoupper( substr( $line, 6 )));
1296 1295
         if( null != $comp ) {
1297
-          if( 'VALARM' == $compname )
1296
+            if( 'VALARM' == $compname )
1298 1297
             $subcomp = new valarm();
1299
-          elseif( 'STANDARD' == $compname )
1298
+            elseif( 'STANDARD' == $compname )
1300 1299
             $subcomp = new vtimezone( 'STANDARD' );
1301
-          elseif( 'DAYLIGHT' == $compname )
1300
+            elseif( 'DAYLIGHT' == $compname )
1302 1301
             $subcomp = new vtimezone( 'DAYLIGHT' );
1303
-          else
1302
+            else
1304 1303
             return FALSE; /* err 6 */
1305
-          $actcomp = & $subcomp;
1304
+            $actcomp = & $subcomp;
1306 1305
         }
1307 1306
         else {
1308
-          switch( $compname ) {
1307
+            switch( $compname ) {
1309 1308
             case 'VALARM':
1310 1309
               $comp = new valarm();
1311
-              break;
1310
+                break;
1312 1311
             case 'VEVENT':
1313 1312
               $comp = new vevent();
1314
-              break;
1313
+                break;
1315 1314
             case 'VFREEBUSY';
1316
-              $comp = new vfreebusy();
1317
-              break;
1315
+                $comp = new vfreebusy();
1316
+                break;
1318 1317
             case 'VJOURNAL':
1319 1318
               $comp = new vjournal();
1320
-              break;
1319
+                break;
1321 1320
             case 'VTODO':
1322 1321
               $comp = new vtodo();
1323
-              break;
1322
+                break;
1324 1323
             case 'VTIMEZONE':
1325 1324
               $comp = new vtimezone();
1326
-              break;
1325
+                break;
1327 1326
             default:
1328 1327
               return FALSE; // err 7
1329
-              break;
1330
-          } // end - switch
1331
-          $actcomp = & $comp;
1328
+                break;
1329
+            } // end - switch
1330
+            $actcomp = & $comp;
1332 1331
         }
1333 1332
         continue;
1334
-      } // end - elsif ( 'BEGIN:'.. .
1333
+        } // end - elsif ( 'BEGIN:'.. .
1335 1334
             /* update selected component with unparsed data */
1336
-      $actcomp->unparsed[] = $line;
1335
+        $actcomp->unparsed[] = $line;
1337 1336
     } // end - foreach( rows.. .
1338 1337
             /* parse data for calendar (this) object */
1339 1338
     if( is_array( $this->unparsed ) && ( 0 < count( $this->unparsed ))) {
1340 1339
             /* concatenate property values spread over several lines */
1341
-      $lastix    = -1;
1342
-      $propnames = array( 'calscale','method','prodid','version','x-' );
1343
-      $proprows  = array();
1344
-      foreach( $this->unparsed as $line ) {
1340
+        $lastix    = -1;
1341
+        $propnames = array( 'calscale','method','prodid','version','x-' );
1342
+        $proprows  = array();
1343
+        foreach( $this->unparsed as $line ) {
1345 1344
         $newProp = FALSE;
1346 1345
         foreach ( $propnames as $propname ) {
1347
-          if( $propname == strtolower( substr( $line, 0, strlen( $propname )))) {
1346
+            if( $propname == strtolower( substr( $line, 0, strlen( $propname )))) {
1348 1347
             $newProp = TRUE;
1349 1348
             break;
1350
-          }
1349
+            }
1351 1350
         }
1352 1351
         if( $newProp ) {
1353
-          $newProp = FALSE;
1354
-          $lastix++;
1355
-          $proprows[$lastix]  = $line;
1352
+            $newProp = FALSE;
1353
+            $lastix++;
1354
+            $proprows[$lastix]  = $line;
1356 1355
         }
1357 1356
         else {
1358 1357
             /* remove line breaks */
1359
-          if(( '\n' == substr( $proprows[$lastix], -2 )) &&
1358
+            if(( '\n' == substr( $proprows[$lastix], -2 )) &&
1360 1359
              (  ' ' == substr( $line, 0, 1 ))) {
1361 1360
             $proprows[$lastix] = substr( $proprows[$lastix], 0, strlen( $proprows[$lastix] ) - 2 );
1362 1361
             $line = substr( $line, 1 );
1363
-          }
1364
-          $proprows[$lastix] .= $line;
1362
+            }
1363
+            $proprows[$lastix] .= $line;
1364
+        }
1365 1365
         }
1366
-      }
1367
-      $toolbox = new calendarComponent();
1368
-      foreach( $proprows as $line ) {
1366
+        $toolbox = new calendarComponent();
1367
+        foreach( $proprows as $line ) {
1369 1368
         if( '\n' == substr( $line, -2 ))
1370
-          $line = substr( $line, 0, strlen( $line ) - 2 );
1369
+            $line = substr( $line, 0, strlen( $line ) - 2 );
1371 1370
             /* get propname */
1372 1371
         $cix = $propname = null;
1373 1372
         for( $cix=0; $cix < strlen( $line ); $cix++ ) {
1374
-          if( in_array( $line{$cix}, array( ':', ';' )))
1373
+            if( in_array( $line{$cix}, array( ':', ';' )))
1375 1374
             break;
1376
-          else
1375
+            else
1377 1376
             $propname .= $line{$cix};
1378 1377
         }
1379 1378
             /* ignore version/prodid properties */
1380 1379
         if( in_array( strtoupper( $propname ), array( 'VERSION', 'PRODID' )))
1381
-          continue;
1380
+            continue;
1382 1381
         $line = substr( $line, $cix);
1383 1382
             /* separate attributes from value */
1384 1383
         $attr   = array();
1385 1384
         $attrix = -1;
1386 1385
         $strlen = strlen( $line );
1387 1386
         for( $cix=0; $cix < $strlen; $cix++ ) {
1388
-          if((       ':'   == $line{$cix} )             &&
1387
+            if((       ':'   == $line{$cix} )             &&
1389 1388
                    ( '://' != substr( $line, $cix, 3 )) &&
1390 1389
              ( 'mailto:'   != strtolower( substr( $line, $cix - 6, 7 )))) {
1391 1390
             $attrEnd = TRUE;
1392 1391
             if(( $cix < ( $strlen - 4 )) &&
1393 1392
                  ctype_digit( substr( $line, $cix+1, 4 ))) { // an URI with a (4pos) portnr??
1394
-              for( $c2ix = $cix; 3 < $c2ix; $c2ix-- ) {
1393
+                for( $c2ix = $cix; 3 < $c2ix; $c2ix-- ) {
1395 1394
                 if( '://' == substr( $line, $c2ix - 2, 3 )) {
1396
-                  $attrEnd = FALSE;
1397
-                  break; // an URI with a portnr!!
1395
+                    $attrEnd = FALSE;
1396
+                    break; // an URI with a portnr!!
1397
+                }
1398 1398
                 }
1399
-              }
1400 1399
             }
1401 1400
             if( $attrEnd) {
1402
-              $line = substr( $line, $cix + 1 );
1403
-              break;
1401
+                $line = substr( $line, $cix + 1 );
1402
+                break;
1404 1403
             }
1405
-          }
1406
-          if( ';' == $line{$cix} )
1404
+            }
1405
+            if( ';' == $line{$cix} )
1407 1406
             $attr[++$attrix] = null;
1408
-          else
1407
+            else
1409 1408
             $attr[$attrix] .= $line{$cix};
1410 1409
         }
1411 1410
 
1412 1411
             /* make attributes in array format */
1413 1412
         $propattr = array();
1414 1413
         foreach( $attr as $attribute ) {
1415
-          $attrsplit = explode( '=', $attribute, 2 );
1416
-          if( 1 < count( $attrsplit ))
1414
+            $attrsplit = explode( '=', $attribute, 2 );
1415
+            if( 1 < count( $attrsplit ))
1417 1416
             $propattr[$attrsplit[0]] = $attrsplit[1];
1418
-          else
1417
+            else
1419 1418
             $propattr[] = $attribute;
1420 1419
         }
1421 1420
             /* update Property */
1422 1421
         if( FALSE !== strpos( $line, ',' )) {
1423
-          $content  = explode( ',', $line );
1424
-          $clen     = count( $content );
1425
-          for( $cix = 0; $cix < $clen; $cix++ ) {
1422
+            $content  = explode( ',', $line );
1423
+            $clen     = count( $content );
1424
+            for( $cix = 0; $cix < $clen; $cix++ ) {
1426 1425
             if( "\\" == substr( $content[$cix], -1 )) {
1427
-              $content[$cix] .= ','.$content[$cix + 1];
1428
-              unset( $content[$cix + 1] );
1429
-              $cix++;
1426
+                $content[$cix] .= ','.$content[$cix + 1];
1427
+                unset( $content[$cix + 1] );
1428
+                $cix++;
1430 1429
             }
1431
-          }
1432
-          if( 1 < count( $content )) {
1430
+            }
1431
+            if( 1 < count( $content )) {
1433 1432
             foreach( $content as $cix => $contentPart )
1434
-              $content[$cix] = $toolbox->_strunrep( $contentPart );
1433
+                $content[$cix] = $toolbox->_strunrep( $contentPart );
1435 1434
             $this->setProperty( $propname, $content, $propattr );
1436 1435
             continue;
1437
-          }
1438
-          else
1436
+            }
1437
+            else
1439 1438
             $line = reset( $content );
1440
-          $line = $toolbox->_strunrep( $line );
1439
+            $line = $toolbox->_strunrep( $line );
1441 1440
         }
1442 1441
         $this->setProperty( $propname, trim( $line ), $propattr );
1443
-      } // end - foreach( $this->unparsed.. .
1442
+        } // end - foreach( $this->unparsed.. .
1444 1443
     } // end - if( is_array( $this->unparsed.. .
1445 1444
             /* parse Components */
1446 1445
     if( is_array( $this->components ) && ( 0 < count( $this->components ))) {
1447
-      for( $six = 0; $six < count( $this->components ); $six++ ) {
1446
+        for( $six = 0; $six < count( $this->components ); $six++ ) {
1448 1447
         if( !empty( $this->components[$six] ))
1449
-          $this->components[$six]->parse();
1450
-      }
1448
+            $this->components[$six]->parse();
1449
+        }
1451 1450
     }
1452 1451
     else
1453
-      return FALSE;                   /* err 91 or something.. . */
1452
+        return FALSE;                   /* err 91 or something.. . */
1454 1453
     return TRUE;
1455
-  }
1454
+    }
1456 1455
 /*********************************************************************************/
1457 1456
 /**
1458 1457
  * creates formatted output for calendar object instance
@@ -1461,17 +1460,17 @@  discard block
 block discarded – undo
1461 1460
  * @since 2.4.10 - 2008-08-06
1462 1461
  * @return string
1463 1462
  */
1464
-  function createCalendar() {
1463
+    function createCalendar() {
1465 1464
     $calendarInit1 = $calendarInit2 = $calendarxCaldecl = $calendarStart = $calendar = null;
1466 1465
     switch( $this->format ) {
1467
-      case 'xcal':
1466
+        case 'xcal':
1468 1467
         $calendarInit1 = '<?xml version="1.0" encoding="UTF-8"?>'.$this->nl.
1469
-                         '<!DOCTYPE iCalendar PUBLIC "-//IETF//DTD XCAL/iCalendar XML//EN"'.$this->nl.
1470
-                         '"http://www.ietf.org/internet-drafts/draft-ietf-calsch-many-xcal-01.txt"';
1468
+                            '<!DOCTYPE iCalendar PUBLIC "-//IETF//DTD XCAL/iCalendar XML//EN"'.$this->nl.
1469
+                            '"http://www.ietf.org/internet-drafts/draft-ietf-calsch-many-xcal-01.txt"';
1471 1470
         $calendarInit2 = '>'.$this->nl;
1472 1471
         $calendarStart = '<vcalendar';
1473 1472
         break;
1474
-      default:
1473
+        default:
1475 1474
         $calendarStart = 'BEGIN:VCALENDAR'.$this->nl;
1476 1475
         break;
1477 1476
     }
@@ -1480,175 +1479,175 @@  discard block
 block discarded – undo
1480 1479
     $calendarStart .= $this->createProdid();
1481 1480
     $calendarStart .= $this->createVersion();
1482 1481
     switch( $this->format ) {
1483
-      case 'xcal':
1482
+        case 'xcal':
1484 1483
         $nlstrlen = strlen( $this->nl );
1485 1484
         if( $this->nl == substr( $calendarStart, ( 0 - $nlstrlen )))
1486
-          $calendarStart = substr( $calendarStart, 0, ( strlen( $calendarStart ) - $nlstrlen ));
1485
+            $calendarStart = substr( $calendarStart, 0, ( strlen( $calendarStart ) - $nlstrlen ));
1487 1486
         $calendarStart .= '>'.$this->nl;
1488 1487
         break;
1489
-      default:
1488
+        default:
1490 1489
         break;
1491 1490
     }
1492 1491
     $calendar .= $this->createXprop();
1493 1492
     foreach( $this->components as $component ) {
1494
-      if( empty( $component )) continue;
1495
-      if( '' >= $component->getConfig( 'language'))
1493
+        if( empty( $component )) continue;
1494
+        if( '' >= $component->getConfig( 'language'))
1496 1495
         $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 );
1496
+        $component->setConfig( 'allowEmpty',  $this->getConfig( 'allowEmpty' ));
1497
+        $component->setConfig( 'nl',          $this->getConfig( 'nl' ));
1498
+        $component->setConfig( 'unique_id',   $this->getConfig( 'unique_id' ));
1499
+        $component->setConfig( 'format',      $this->getConfig( 'format' ));
1500
+        $calendar .= $component->createComponent( $this->xcaldecl );
1502 1501
     }
1503 1502
     if(( 0 < count( $this->xcaldecl )) && ( 'xcal' == $this->format )) { // xCal only
1504
-      $calendarInit1 .= $this->nl.'['.$this->nl;
1505
-      $old_xcaldecl = array();
1506
-      foreach( $this->xcaldecl as $declix => $declPart ) {
1503
+        $calendarInit1 .= $this->nl.'['.$this->nl;
1504
+        $old_xcaldecl = array();
1505
+        foreach( $this->xcaldecl as $declix => $declPart ) {
1507 1506
         if(( 0 < count( $old_xcaldecl)) &&
1508 1507
            ( in_array( $declPart['uri'],      $old_xcaldecl['uri'] )) &&
1509 1508
            ( in_array( $declPart['external'], $old_xcaldecl['external'] )))
1510
-          continue; // no duplicate uri and ext. references
1509
+            continue; // no duplicate uri and ext. references
1511 1510
         $calendarxCaldecl .= '<!';
1512 1511
         foreach( $declPart as $declKey => $declValue ) {
1513
-          switch( $declKey ) {                    // index
1512
+            switch( $declKey ) {                    // index
1514 1513
             case 'xmldecl':                       // no 1
1515 1514
               $calendarxCaldecl .= $declValue.' ';
1516
-              break;
1515
+                break;
1517 1516
             case 'uri':                           // no 2
1518 1517
               $calendarxCaldecl .= $declValue.' ';
1519
-              $old_xcaldecl['uri'][] = $declValue;
1520
-              break;
1518
+                $old_xcaldecl['uri'][] = $declValue;
1519
+                break;
1521 1520
             case 'ref':                           // no 3
1522 1521
               $calendarxCaldecl .= $declValue.' ';
1523
-              break;
1522
+                break;
1524 1523
             case 'external':                      // no 4
1525 1524
               $calendarxCaldecl .= '"'.$declValue.'" ';
1526
-              $old_xcaldecl['external'][] = $declValue;
1527
-              break;
1525
+                $old_xcaldecl['external'][] = $declValue;
1526
+                break;
1528 1527
             case 'type':                          // no 5
1529 1528
               $calendarxCaldecl .= $declValue.' ';
1530
-              break;
1529
+                break;
1531 1530
             case 'type2':                         // no 6
1532 1531
               $calendarxCaldecl .= $declValue;
1533
-              break;
1534
-          }
1532
+                break;
1533
+            }
1535 1534
         }
1536 1535
         $calendarxCaldecl .= '>'.$this->nl;
1537
-      }
1538
-      $calendarInit2 = ']'.$calendarInit2;
1536
+        }
1537
+        $calendarInit2 = ']'.$calendarInit2;
1539 1538
     }
1540 1539
     switch( $this->format ) {
1541
-      case 'xcal':
1540
+        case 'xcal':
1542 1541
         $calendar .= '</vcalendar>'.$this->nl;
1543 1542
         break;
1544
-      default:
1543
+        default:
1545 1544
         $calendar .= 'END:VCALENDAR'.$this->nl;
1546 1545
         break;
1547 1546
     }
1548 1547
     return $calendarInit1.$calendarxCaldecl.$calendarInit2.$calendarStart.$calendar;
1549
-  }
1548
+    }
1550 1549
 /**
1551
- * a HTTP redirect header is sent with created, updated and/or parsed calendar
1552
- *
1553
- * @author Kjell-Inge Gustafsson <[email protected]>
1554
- * @since 2.2.12 - 2007-10-23
1555
- * @return redirect
1556
- */
1557
-  function returnCalendar() {
1550
+     * a HTTP redirect header is sent with created, updated and/or parsed calendar
1551
+     *
1552
+     * @author Kjell-Inge Gustafsson <[email protected]>
1553
+     * @since 2.2.12 - 2007-10-23
1554
+     * @return redirect
1555
+     */
1556
+    function returnCalendar() {
1558 1557
     $filename = $this->getConfig( 'filename' );
1559 1558
     $output   = $this->createCalendar();
1560 1559
     $filesize = strlen( $output );
1561 1560
 //    if( headers_sent( $filename, $linenum ))
1562 1561
 //      die( "Headers already sent in $filename on line $linenum\n" );
1563 1562
     if( 'xcal' == $this->format )
1564
-      header( 'Content-Type: application/calendar+xml; charset=utf-8' );
1563
+        header( 'Content-Type: application/calendar+xml; charset=utf-8' );
1565 1564
     else
1566
-      header( 'Content-Type: text/calendar; charset=utf-8' );
1565
+        header( 'Content-Type: text/calendar; charset=utf-8' );
1567 1566
     header( 'Content-Length: '.$filesize );
1568 1567
     header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
1569 1568
     header( 'Cache-Control: max-age=10' );
1570 1569
     echo $output;
1571 1570
     die();
1572
-  }
1571
+    }
1573 1572
 /**
1574
- * save content in a file
1575
- *
1576
- * @author Kjell-Inge Gustafsson <[email protected]>
1577
- * @since 2.2.12 - 2007-12-30
1578
- * @param string $directory optional
1579
- * @param string $filename optional
1580
- * @param string $delimiter optional
1581
- * @return bool
1582
- */
1583
-  function saveCalendar( $directory=FALSE, $filename=FALSE, $delimiter=FALSE ) {
1573
+     * save content in a file
1574
+     *
1575
+     * @author Kjell-Inge Gustafsson <[email protected]>
1576
+     * @since 2.2.12 - 2007-12-30
1577
+     * @param string $directory optional
1578
+     * @param string $filename optional
1579
+     * @param string $delimiter optional
1580
+     * @return bool
1581
+     */
1582
+    function saveCalendar( $directory=FALSE, $filename=FALSE, $delimiter=FALSE ) {
1584 1583
     if( $directory )
1585
-      $this->setConfig( 'directory', $directory );
1584
+        $this->setConfig( 'directory', $directory );
1586 1585
     if( $filename )
1587
-      $this->setConfig( 'filename',  $filename );
1586
+        $this->setConfig( 'filename',  $filename );
1588 1587
     if( $delimiter && ($delimiter != DIRECTORY_SEPARATOR ))
1589
-      $this->setConfig( 'delimiter', $delimiter );
1588
+        $this->setConfig( 'delimiter', $delimiter );
1590 1589
     if( FALSE === ( $dirfile = $this->getConfig( 'url' )))
1591
-      $dirfile = $this->getConfig( 'dirfile' );
1590
+        $dirfile = $this->getConfig( 'dirfile' );
1592 1591
     $iCalFile = @fopen( $dirfile, 'w' );
1593 1592
     if( $iCalFile ) {
1594
-      if( FALSE === fwrite( $iCalFile, $this->createCalendar() ))
1593
+        if( FALSE === fwrite( $iCalFile, $this->createCalendar() ))
1595 1594
         return FALSE;
1596
-      fclose( $iCalFile );
1597
-      return TRUE;
1595
+        fclose( $iCalFile );
1596
+        return TRUE;
1598 1597
     }
1599 1598
     else
1600
-      return FALSE;
1601
-  }
1599
+        return FALSE;
1600
+    }
1602 1601
 /**
1603
- * if recent version of calendar file exists (default one hour), an HTTP redirect header is sent
1604
- * else FALSE is returned
1605
- *
1606
- * @author Kjell-Inge Gustafsson <[email protected]>
1607
- * @since 2.2.12 - 2007-10-28
1608
- * @param string $directory optional alt. int timeout
1609
- * @param string $filename optional
1610
- * @param string $delimiter optional
1611
- * @param int timeout optional, default 3600 sec
1612
- * @return redirect/FALSE
1613
- */
1614
-  function useCachedCalendar( $directory=FALSE, $filename=FALSE, $delimiter=FALSE, $timeout=3600) {
1602
+     * if recent version of calendar file exists (default one hour), an HTTP redirect header is sent
1603
+     * else FALSE is returned
1604
+     *
1605
+     * @author Kjell-Inge Gustafsson <[email protected]>
1606
+     * @since 2.2.12 - 2007-10-28
1607
+     * @param string $directory optional alt. int timeout
1608
+     * @param string $filename optional
1609
+     * @param string $delimiter optional
1610
+     * @param int timeout optional, default 3600 sec
1611
+     * @return redirect/FALSE
1612
+     */
1613
+    function useCachedCalendar( $directory=FALSE, $filename=FALSE, $delimiter=FALSE, $timeout=3600) {
1615 1614
     if ( $directory && ctype_digit( (string) $directory ) && !$filename ) {
1616
-      $timeout   = (int) $directory;
1617
-      $directory = FALSE;
1615
+        $timeout   = (int) $directory;
1616
+        $directory = FALSE;
1618 1617
     }
1619 1618
     if( $directory )
1620
-      $this->setConfig( 'directory', $directory );
1619
+        $this->setConfig( 'directory', $directory );
1621 1620
     if( $filename )
1622
-      $this->setConfig( 'filename',  $filename );
1621
+        $this->setConfig( 'filename',  $filename );
1623 1622
     if( $delimiter && ( $delimiter != DIRECTORY_SEPARATOR ))
1624
-      $this->setConfig( 'delimiter', $delimiter );
1623
+        $this->setConfig( 'delimiter', $delimiter );
1625 1624
     $filesize    = $this->getConfig( 'filesize' );
1626 1625
     if( 0 >= $filesize )
1627
-      return FALSE;
1626
+        return FALSE;
1628 1627
     $dirfile     = $this->getConfig( 'dirfile' );
1629 1628
     if( time() - filemtime( $dirfile ) < $timeout) {
1630
-      clearstatcache();
1631
-      $dirfile   = $this->getConfig( 'dirfile' );
1632
-      $filename  = $this->getConfig( 'filename' );
1629
+        clearstatcache();
1630
+        $dirfile   = $this->getConfig( 'dirfile' );
1631
+        $filename  = $this->getConfig( 'filename' );
1633 1632
 //    if( headers_sent( $filename, $linenum ))
1634 1633
 //      die( "Headers already sent in $filename on line $linenum\n" );
1635
-      if( 'xcal' == $this->format )
1634
+        if( 'xcal' == $this->format )
1636 1635
         header( 'Content-Type: application/calendar+xml; charset=utf-8' );
1637
-      else
1636
+        else
1638 1637
         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 ) {
1638
+        header( 'Content-Length: '.$filesize );
1639
+        header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
1640
+        header( 'Cache-Control: max-age=10' );
1641
+        $fp = @$fopen( $dirfile, 'r' );
1642
+        if( $fp ) {
1644 1643
         fpassthru( $fp );
1645 1644
         fclose( $fp );
1646
-      }
1647
-      die();
1645
+        }
1646
+        die();
1648 1647
     }
1649 1648
     else
1650
-      return FALSE;
1651
-  }
1649
+        return FALSE;
1650
+    }
1652 1651
 }
1653 1652
 /*********************************************************************************/
1654 1653
 /*********************************************************************************/
@@ -1660,37 +1659,37 @@  discard block
 block discarded – undo
1660 1659
  */
1661 1660
 class calendarComponent {
1662 1661
             //  component property variables
1663
-  var $uid;
1664
-  var $dtstamp;
1662
+    var $uid;
1663
+    var $dtstamp;
1665 1664
 
1666 1665
             //  component config variables
1667
-  var $allowEmpty;
1668
-  var $language;
1669
-  var $nl;
1670
-  var $unique_id;
1671
-  var $format;
1672
-  var $objName; // created automatically at instance creation
1666
+    var $allowEmpty;
1667
+    var $language;
1668
+    var $nl;
1669
+    var $unique_id;
1670
+    var $format;
1671
+    var $objName; // created automatically at instance creation
1673 1672
             //  component internal variables
1674
-  var $componentStart1;
1675
-  var $componentStart2;
1676
-  var $componentEnd1;
1677
-  var $componentEnd2;
1678
-  var $elementStart1;
1679
-  var $elementStart2;
1680
-  var $elementEnd1;
1681
-  var $elementEnd2;
1682
-  var $intAttrDelimiter;
1683
-  var $attributeDelimiter;
1684
-  var $valueInit;
1673
+    var $componentStart1;
1674
+    var $componentStart2;
1675
+    var $componentEnd1;
1676
+    var $componentEnd2;
1677
+    var $elementStart1;
1678
+    var $elementStart2;
1679
+    var $elementEnd1;
1680
+    var $elementEnd2;
1681
+    var $intAttrDelimiter;
1682
+    var $attributeDelimiter;
1683
+    var $valueInit;
1685 1684
             //  component xCal declaration container
1686
-  var $xcaldecl;
1687
-/**
1688
- * constructor for calendar component object
1689
- *
1690
- * @author Kjell-Inge Gustafsson <[email protected]>
1691
- * @since 2.4.19 - 2008-10-23
1692
- */
1693
-  function calendarComponent() {
1685
+    var $xcaldecl;
1686
+/**
1687
+     * constructor for calendar component object
1688
+     *
1689
+     * @author Kjell-Inge Gustafsson <[email protected]>
1690
+     * @since 2.4.19 - 2008-10-23
1691
+     */
1692
+    function calendarComponent() {
1694 1693
     $this->objName         = ( isset( $this->timezonetype )) ?
1695 1694
                           strtolower( $this->timezonetype )  :  get_class ( $this );
1696 1695
     $this->uid             = array();
@@ -1705,7 +1704,7 @@  discard block
 block discarded – undo
1705 1704
 
1706 1705
     $this->_createFormat();
1707 1706
     $this->_makeDtstamp();
1708
-  }
1707
+    }
1709 1708
 /*********************************************************************************/
1710 1709
 /**
1711 1710
  * Property Name: ACTION
@@ -1717,27 +1716,27 @@  discard block
 block discarded – undo
1717 1716
  * @since 2.4.8 - 2008-10-22
1718 1717
  * @return string
1719 1718
  */
1720
-  function createAction() {
1719
+    function createAction() {
1721 1720
     if( empty( $this->action )) return FALSE;
1722 1721
     if( empty( $this->action['value'] ))
1723
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'ACTION' ) : FALSE;
1722
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'ACTION' ) : FALSE;
1724 1723
     $attributes = $this->_createParams( $this->action['params'] );
1725 1724
     return $this->_createElement( 'ACTION', $attributes, $this->action['value'] );
1726
-  }
1725
+    }
1727 1726
 /**
1728
- * set calendar component property action
1729
- *
1730
- * @author Kjell-Inge Gustafsson <[email protected]>
1731
- * @since 2.4.8 - 2008-11-04
1732
- * @param string $value  "AUDIO" / "DISPLAY" / "EMAIL" / "PROCEDURE"
1733
- * @param mixed $params
1734
- * @return bool
1735
- */
1736
-  function setAction( $value, $params=FALSE ) {
1727
+     * set calendar component property action
1728
+     *
1729
+     * @author Kjell-Inge Gustafsson <[email protected]>
1730
+     * @since 2.4.8 - 2008-11-04
1731
+     * @param string $value  "AUDIO" / "DISPLAY" / "EMAIL" / "PROCEDURE"
1732
+     * @param mixed $params
1733
+     * @return bool
1734
+     */
1735
+    function setAction( $value, $params=FALSE ) {
1737 1736
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
1738 1737
     $this->action = array( 'value' => $value, 'params' => $this->_setParams( $params ));
1739 1738
     return TRUE;
1740
-  }
1739
+    }
1741 1740
 /*********************************************************************************/
1742 1741
 /**
1743 1742
  * Property Name: ATTACH
@@ -1749,33 +1748,33 @@  discard block
 block discarded – undo
1749 1748
  * @since 0.9.7 - 2006-11-23
1750 1749
  * @return string
1751 1750
  */
1752
-  function createAttach() {
1751
+    function createAttach() {
1753 1752
     if( empty( $this->attach )) return FALSE;
1754 1753
     $output       = null;
1755 1754
     foreach( $this->attach as $attachPart ) {
1756
-      if(! empty( $attachPart['value'] )) {
1755
+        if(! empty( $attachPart['value'] )) {
1757 1756
         $attributes = $this->_createParams( $attachPart['params'] );
1758 1757
         $output    .= $this->_createElement( 'ATTACH', $attributes, $attachPart['value'] );
1759
-      }
1760
-      elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'ATTACH' );
1758
+        }
1759
+        elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'ATTACH' );
1761 1760
     }
1762 1761
     return $output;
1763
-  }
1762
+    }
1764 1763
 /**
1765
- * set calendar component property attach
1766
- *
1767
- * @author Kjell-Inge Gustafsson <[email protected]>
1768
- * @since 2.5.1 - 2008-11-06
1769
- * @param string $value
1770
- * @param array $params, optional
1771
- * @param integer $index, optional
1772
- * @return bool
1773
- */
1774
-  function setAttach( $value, $params=FALSE, $index=FALSE ) {
1764
+     * set calendar component property attach
1765
+     *
1766
+     * @author Kjell-Inge Gustafsson <[email protected]>
1767
+     * @since 2.5.1 - 2008-11-06
1768
+     * @param string $value
1769
+     * @param array $params, optional
1770
+     * @param integer $index, optional
1771
+     * @return bool
1772
+     */
1773
+    function setAttach( $value, $params=FALSE, $index=FALSE ) {
1775 1774
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
1776 1775
     $this->_setMval( $this->attach, $value, $params, FALSE, $index );
1777 1776
     return TRUE;
1778
-  }
1777
+    }
1779 1778
 /*********************************************************************************/
1780 1779
 /**
1781 1780
  * Property Name: ATTENDEE
@@ -1787,121 +1786,121 @@  discard block
 block discarded – undo
1787 1786
  * @since 2.4.8 - 2008-09-23
1788 1787
  * @return string
1789 1788
  */
1790
-  function createAttendee() {
1789
+    function createAttendee() {
1791 1790
     if( empty( $this->attendee )) return FALSE;
1792 1791
     $output = null;
1793 1792
     foreach( $this->attendee as $attendeePart ) {                      // start foreach 1
1794
-      if( empty( $attendeePart['value'] )) {
1793
+        if( empty( $attendeePart['value'] )) {
1795 1794
         if( $this->getConfig( 'allowEmpty' ))
1796
-          $output .= $this->_createElement( 'ATTENDEE' );
1795
+            $output .= $this->_createElement( 'ATTENDEE' );
1797 1796
         continue;
1798
-      }
1799
-      $attendee1 = $attendee2 = $attendeeLANG = $attendeeCN = null;
1800
-      foreach( $attendeePart as $paramlabel => $paramvalue ) {         // start foreach 2
1797
+        }
1798
+        $attendee1 = $attendee2 = $attendeeLANG = $attendeeCN = null;
1799
+        foreach( $attendeePart as $paramlabel => $paramvalue ) {         // start foreach 2
1801 1800
         if( 'value' == $paramlabel )
1802
-          $attendee2  .= 'MAILTO:'.$paramvalue;
1801
+            $attendee2  .= 'MAILTO:'.$paramvalue;
1803 1802
         elseif(( 'params' == $paramlabel ) && ( is_array( $paramvalue ))) { // start elseif
1804
-          foreach( $paramvalue as $optparamlabel => $optparamvalue ) { // start foreach 3
1803
+            foreach( $paramvalue as $optparamlabel => $optparamvalue ) { // start foreach 3
1805 1804
             $attendee11 = $attendee12 = null;
1806 1805
             if( is_int( $optparamlabel )) {
1807
-              $attendee1 .= $this->intAttrDelimiter.$optparamvalue;
1808
-              continue;
1806
+                $attendee1 .= $this->intAttrDelimiter.$optparamvalue;
1807
+                continue;
1809 1808
             }
1810 1809
             switch( $optparamlabel ) {                                 // start switch
1811
-              case 'CUTYPE':
1810
+                case 'CUTYPE':
1812 1811
               case 'PARTSTAT':
1813 1812
               case 'ROLE':
1814 1813
               case 'RSVP':
1815 1814
                 $attendee1 .= $this->intAttrDelimiter.$optparamlabel.'="'.$optparamvalue.'"';
1816 1815
                 break;
1817
-              case 'SENT-BY':
1816
+                case 'SENT-BY':
1818 1817
                 $attendee1 .= $this->intAttrDelimiter.'SENT-BY="MAILTO:'.$optparamvalue.'"';
1819 1818
                 break;
1820
-              case 'MEMBER':
1819
+                case 'MEMBER':
1821 1820
                 $attendee11 = $this->intAttrDelimiter.'MEMBER=';
1822
-              case 'DELEGATED-TO':
1821
+                case 'DELEGATED-TO':
1823 1822
                 $attendee11 = ( !$attendee11 ) ? $this->intAttrDelimiter.'DELEGATED-TO='   : $attendee11;
1824
-              case 'DELEGATED-FROM':
1823
+                case 'DELEGATED-FROM':
1825 1824
                 $attendee11 = ( !$attendee11 ) ? $this->intAttrDelimiter.'DELEGATED-FROM=' : $attendee11;
1826 1825
                 foreach( $optparamvalue  as $cix => $calUserAddress ) {
1827
-                  $attendee12 .= ( $cix ) ? ',' : null;
1828
-                  $attendee12 .= '"MAILTO:'.$calUserAddress.'"';
1826
+                    $attendee12 .= ( $cix ) ? ',' : null;
1827
+                    $attendee12 .= '"MAILTO:'.$calUserAddress.'"';
1829 1828
                 }
1830 1829
                 $attendee1  .= $attendee11.$attendee12;
1831 1830
                 break;
1832
-              case 'CN':
1831
+                case 'CN':
1833 1832
                 $attendeeCN .= $this->intAttrDelimiter.'CN="'.$optparamvalue.'"';
1834 1833
                 break;
1835
-              case 'DIR':
1834
+                case 'DIR':
1836 1835
                 $attendee1 .= $this->intAttrDelimiter.'DIR="'.$optparamvalue.'"';
1837 1836
                 break;
1838
-              case 'LANGUAGE':
1837
+                case 'LANGUAGE':
1839 1838
                 $attendeeLANG .= $this->intAttrDelimiter.'LANGUAGE='.$optparamvalue;
1840 1839
                 break;
1841
-              default:
1840
+                default:
1842 1841
                 $attendee1 .= $this->intAttrDelimiter."$optparamlabel=$optparamvalue";
1843 1842
                 break;
1844 1843
             }    // end switch
1845
-          }      // end foreach 3
1844
+            }      // end foreach 3
1846 1845
         }        // end elseif
1847
-      }          // end foreach 2
1848
-      $output .= $this->_createElement( 'ATTENDEE', $attendee1.$attendeeLANG.$attendeeCN, $attendee2 );
1846
+        }          // end foreach 2
1847
+        $output .= $this->_createElement( 'ATTENDEE', $attendee1.$attendeeLANG.$attendeeCN, $attendee2 );
1849 1848
     }              // end foreach 1
1850 1849
     return $output;
1851
-  }
1850
+    }
1852 1851
 /**
1853
- * set calendar component property attach
1854
- *
1855
- * @author Kjell-Inge Gustafsson <[email protected]>
1856
- * @since 2.5.1 - 2008-11-05
1857
- * @param string $value
1858
- * @param array $params, optional
1859
- * @param integer $index, optional
1860
- * @return bool
1861
- */
1862
-  function setAttendee( $value, $params=FALSE, $index=FALSE ) {
1852
+     * set calendar component property attach
1853
+     *
1854
+     * @author Kjell-Inge Gustafsson <[email protected]>
1855
+     * @since 2.5.1 - 2008-11-05
1856
+     * @param string $value
1857
+     * @param array $params, optional
1858
+     * @param integer $index, optional
1859
+     * @return bool
1860
+     */
1861
+    function setAttendee( $value, $params=FALSE, $index=FALSE ) {
1863 1862
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
1864 1863
     $value = str_replace ( 'MAILTO:', '', $value );
1865 1864
     $value = str_replace ( 'mailto:', '', $value );
1866 1865
     $params2 = array();
1867 1866
     if( is_array($params )) {
1868
-      $optarrays = array();
1869
-      foreach( $params as $optparamlabel => $optparamvalue ) {
1867
+        $optarrays = array();
1868
+        foreach( $params as $optparamlabel => $optparamvalue ) {
1870 1869
         $optparamlabel = strtoupper( $optparamlabel );
1871 1870
         switch( $optparamlabel ) {
1872
-          case 'MEMBER':
1871
+            case 'MEMBER':
1873 1872
           case 'DELEGATED-TO':
1874 1873
           case 'DELEGATED-FROM':
1875 1874
             if( is_array( $optparamvalue )) {
1876
-              foreach( $optparamvalue as $part ) {
1875
+                foreach( $optparamvalue as $part ) {
1877 1876
                 $part = str_replace( 'MAILTO:', '', $part );
1878 1877
                 $part = str_replace( 'mailto:', '', $part );
1879 1878
                 if(( '"' == $part{0} ) && ( '"' == $part{strlen($part)-1} ))
1880
-                  $part = substr( $part, 1, ( strlen($part)-2 ));
1879
+                    $part = substr( $part, 1, ( strlen($part)-2 ));
1881 1880
                 $optarrays[$optparamlabel][] = $part;
1882
-              }
1881
+                }
1883 1882
             }
1884 1883
             else {
1885
-              $part = str_replace( 'MAILTO:', '', $optparamvalue );
1886
-              $part = str_replace( 'mailto:', '', $part );
1887
-              if(( '"' == $part{0} ) && ( '"' == $part{strlen($part)-1} ))
1884
+                $part = str_replace( 'MAILTO:', '', $optparamvalue );
1885
+                $part = str_replace( 'mailto:', '', $part );
1886
+                if(( '"' == $part{0} ) && ( '"' == $part{strlen($part)-1} ))
1888 1887
                 $part = substr( $part, 1, ( strlen($part)-2 ));
1889
-              $optarrays[$optparamlabel][] = $part;
1888
+                $optarrays[$optparamlabel][] = $part;
1890 1889
             }
1891 1890
             break;
1892
-          default:
1891
+            default:
1893 1892
             if( 'SENT-BY' ==  $optparamlabel ) {
1894
-              $optparamvalue = str_replace( 'MAILTO:', '', $optparamvalue );
1895
-              $optparamvalue = str_replace( 'mailto:', '', $optparamvalue );
1893
+                $optparamvalue = str_replace( 'MAILTO:', '', $optparamvalue );
1894
+                $optparamvalue = str_replace( 'mailto:', '', $optparamvalue );
1896 1895
             }
1897 1896
             if(( '"' == substr( $optparamvalue, 0, 1 )) &&
1898 1897
                ( '"' == substr( $optparamvalue, -1 )))
1899
-              $optparamvalue = substr( $optparamvalue, 1, ( strlen( $optparamvalue ) - 2 ));
1898
+                $optparamvalue = substr( $optparamvalue, 1, ( strlen( $optparamvalue ) - 2 ));
1900 1899
             $params2[$optparamlabel] = $optparamvalue;
1901 1900
             break;
1902 1901
         } // end switch( $optparamlabel.. .
1903
-      } // end foreach( $optparam.. .
1904
-      foreach( $optarrays as $optparamlabel => $optparams )
1902
+        } // end foreach( $optparam.. .
1903
+        foreach( $optarrays as $optparamlabel => $optparams )
1905 1904
         $params2[$optparamlabel] = $optparams;
1906 1905
     }
1907 1906
         // remove defaults
@@ -1911,13 +1910,13 @@  discard block
 block discarded – undo
1911 1910
     $this->_existRem( $params2, 'RSVP',     'FALSE' );
1912 1911
         // check language setting
1913 1912
     if( isset( $params2['CN' ] )) {
1914
-      $lang = $this->getConfig( 'language' );
1915
-      if( !isset( $params2['LANGUAGE' ] ) && !empty( $lang ))
1913
+        $lang = $this->getConfig( 'language' );
1914
+        if( !isset( $params2['LANGUAGE' ] ) && !empty( $lang ))
1916 1915
         $params2['LANGUAGE' ] = $lang;
1917 1916
     }
1918 1917
     $this->_setMval( $this->attendee, $value, $params2, FALSE, $index );
1919 1918
     return TRUE;
1920
-  }
1919
+    }
1921 1920
 /*********************************************************************************/
1922 1921
 /**
1923 1922
  * Property Name: CATEGORIES
@@ -1929,42 +1928,42 @@  discard block
 block discarded – undo
1929 1928
  * @since 2.4.8 - 2008-10-22
1930 1929
  * @return string
1931 1930
  */
1932
-  function createCategories() {
1931
+    function createCategories() {
1933 1932
     if( empty( $this->categories )) return FALSE;
1934 1933
     $output = null;
1935 1934
     foreach( $this->categories as $category ) {
1936
-      if( empty( $category['value'] )) {
1935
+        if( empty( $category['value'] )) {
1937 1936
         if ( $this->getConfig( 'allowEmpty' ))
1938
-          $output .= $this->_createElement( 'CATEGORIES' );
1937
+            $output .= $this->_createElement( 'CATEGORIES' );
1939 1938
         continue;
1940
-      }
1941
-      $attributes = $this->_createParams( $category['params'], array( 'LANGUAGE' ));
1942
-      if( is_array( $category['value'] )) {
1939
+        }
1940
+        $attributes = $this->_createParams( $category['params'], array( 'LANGUAGE' ));
1941
+        if( is_array( $category['value'] )) {
1943 1942
         foreach( $category['value'] as $cix => $categoryPart )
1944
-          $category['value'][$cix] = $this->_strrep( $categoryPart );
1943
+            $category['value'][$cix] = $this->_strrep( $categoryPart );
1945 1944
         $content  = implode( ',', $category['value'] );
1946
-      }
1947
-      else
1945
+        }
1946
+        else
1948 1947
         $content  = $this->_strrep( $category['value'] );
1949
-      $output    .= $this->_createElement( 'CATEGORIES', $attributes, $content );
1948
+        $output    .= $this->_createElement( 'CATEGORIES', $attributes, $content );
1950 1949
     }
1951 1950
     return $output;
1952
-  }
1951
+    }
1953 1952
 /**
1954
- * set calendar component property categories
1955
- *
1956
- * @author Kjell-Inge Gustafsson <[email protected]>
1957
- * @since 2.5.1 - 2008-11-06
1958
- * @param mixed $value
1959
- * @param array $params, optional
1960
- * @param integer $index, optional
1961
- * @return bool
1962
- */
1963
-  function setCategories( $value, $params=FALSE, $index=FALSE ) {
1953
+     * set calendar component property categories
1954
+     *
1955
+     * @author Kjell-Inge Gustafsson <[email protected]>
1956
+     * @since 2.5.1 - 2008-11-06
1957
+     * @param mixed $value
1958
+     * @param array $params, optional
1959
+     * @param integer $index, optional
1960
+     * @return bool
1961
+     */
1962
+    function setCategories( $value, $params=FALSE, $index=FALSE ) {
1964 1963
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
1965 1964
     $this->_setMval( $this->categories, $value, $params, FALSE, $index );
1966 1965
     return TRUE;
1967
- }
1966
+    }
1968 1967
 /*********************************************************************************/
1969 1968
 /**
1970 1969
  * Property Name: CLASS
@@ -1976,27 +1975,27 @@  discard block
 block discarded – undo
1976 1975
  * @since 0.9.7 - 2006-11-20
1977 1976
  * @return string
1978 1977
  */
1979
-  function createClass() {
1978
+    function createClass() {
1980 1979
     if( empty( $this->class )) return FALSE;
1981 1980
     if( empty( $this->class['value'] ))
1982
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'CLASS' ) : FALSE;
1981
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'CLASS' ) : FALSE;
1983 1982
     $attributes = $this->_createParams( $this->class['params'] );
1984 1983
     return $this->_createElement( 'CLASS', $attributes, $this->class['value'] );
1985
-  }
1984
+    }
1986 1985
 /**
1987
- * set calendar component property class
1988
- *
1989
- * @author Kjell-Inge Gustafsson <[email protected]>
1990
- * @since 2.4.8 - 2008-11-04
1991
- * @param string $value "PUBLIC" / "PRIVATE" / "CONFIDENTIAL" / iana-token / x-name
1992
- * @param array $params optional
1993
- * @return bool
1994
- */
1995
-  function setClass( $value, $params=FALSE ) {
1986
+     * set calendar component property class
1987
+     *
1988
+     * @author Kjell-Inge Gustafsson <[email protected]>
1989
+     * @since 2.4.8 - 2008-11-04
1990
+     * @param string $value "PUBLIC" / "PRIVATE" / "CONFIDENTIAL" / iana-token / x-name
1991
+     * @param array $params optional
1992
+     * @return bool
1993
+     */
1994
+    function setClass( $value, $params=FALSE ) {
1996 1995
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
1997 1996
     $this->class = array( 'value' => $value, 'params' => $this->_setParams( $params ));
1998 1997
     return TRUE;
1999
-  }
1998
+    }
2000 1999
 /*********************************************************************************/
2001 2000
 /**
2002 2001
  * Property Name: COMMENT
@@ -2008,35 +2007,35 @@  discard block
 block discarded – undo
2008 2007
  * @since 2.4.8 - 2008-10-22
2009 2008
  * @return string
2010 2009
  */
2011
-  function createComment() {
2010
+    function createComment() {
2012 2011
     if( empty( $this->comment )) return FALSE;
2013 2012
     $output = null;
2014 2013
     foreach( $this->comment as $commentPart ) {
2015
-      if( empty( $commentPart['value'] )) {
2014
+        if( empty( $commentPart['value'] )) {
2016 2015
         if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'COMMENT' );
2017 2016
         continue;
2018
-      }
2019
-      $attributes = $this->_createParams( $commentPart['params'], array( 'ALTREP', 'LANGUAGE' ));
2020
-      $content    = $this->_strrep( $commentPart['value'] );
2021
-      $output    .= $this->_createElement( 'COMMENT', $attributes, $content );
2017
+        }
2018
+        $attributes = $this->_createParams( $commentPart['params'], array( 'ALTREP', 'LANGUAGE' ));
2019
+        $content    = $this->_strrep( $commentPart['value'] );
2020
+        $output    .= $this->_createElement( 'COMMENT', $attributes, $content );
2022 2021
     }
2023 2022
     return $output;
2024
-  }
2023
+    }
2025 2024
 /**
2026
- * set calendar component property comment
2027
- *
2028
- * @author Kjell-Inge Gustafsson <[email protected]>
2029
- * @since 2.5.1 - 2008-11-06
2030
- * @param string $value
2031
- * @param array $params, optional
2032
- * @param integer $index, optional
2033
- * @return bool
2034
- */
2035
-  function setComment( $value, $params=FALSE, $index=FALSE ) {
2025
+     * set calendar component property comment
2026
+     *
2027
+     * @author Kjell-Inge Gustafsson <[email protected]>
2028
+     * @since 2.5.1 - 2008-11-06
2029
+     * @param string $value
2030
+     * @param array $params, optional
2031
+     * @param integer $index, optional
2032
+     * @return bool
2033
+     */
2034
+    function setComment( $value, $params=FALSE, $index=FALSE ) {
2036 2035
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
2037 2036
     $this->_setMval( $this->comment, $value, $params, FALSE, $index );
2038 2037
     return TRUE;
2039
-  }
2038
+    }
2040 2039
 /*********************************************************************************/
2041 2040
 /**
2042 2041
  * Property Name: COMPLETED
@@ -2048,7 +2047,7 @@  discard block
 block discarded – undo
2048 2047
  * @since 2.4.8 - 2008-10-22
2049 2048
  * @return string
2050 2049
  */
2051
-  function createCompleted( ) {
2050
+    function createCompleted( ) {
2052 2051
     if( empty( $this->completed )) return FALSE;
2053 2052
     if( !isset( $this->completed['value']['year'] )  &&
2054 2053
         !isset( $this->completed['value']['month'] ) &&
@@ -2056,39 +2055,39 @@  discard block
 block discarded – undo
2056 2055
         !isset( $this->completed['value']['hour'] )  &&
2057 2056
         !isset( $this->completed['value']['min'] )   &&
2058 2057
         !isset( $this->completed['value']['sec'] ))
2059
-      if( $this->getConfig( 'allowEmpty' ))
2058
+        if( $this->getConfig( 'allowEmpty' ))
2060 2059
         return $this->_createElement( 'COMPLETED' );
2061
-      else return FALSE;
2060
+        else return FALSE;
2062 2061
     $formatted  = $this->_format_date_time( $this->completed['value'], 7 );
2063 2062
     $attributes = $this->_createParams( $this->completed['params'] );
2064 2063
     return $this->_createElement( 'COMPLETED', $attributes, $formatted );
2065
-  }
2064
+    }
2066 2065
 /**
2067
- * set calendar component property completed
2068
- *
2069
- * @author Kjell-Inge Gustafsson <[email protected]>
2070
- * @since 2.4.8 - 2008-10-23
2071
- * @param mixed $year
2072
- * @param mixed $month optional
2073
- * @param int $day optional
2074
- * @param int $hour optional
2075
- * @param int $min optional
2076
- * @param int $sec optional
2077
- * @param array $params optional
2078
- * @return bool
2079
- */
2080
-  function setCompleted( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
2066
+     * set calendar component property completed
2067
+     *
2068
+     * @author Kjell-Inge Gustafsson <[email protected]>
2069
+     * @since 2.4.8 - 2008-10-23
2070
+     * @param mixed $year
2071
+     * @param mixed $month optional
2072
+     * @param int $day optional
2073
+     * @param int $hour optional
2074
+     * @param int $min optional
2075
+     * @param int $sec optional
2076
+     * @param array $params optional
2077
+     * @return bool
2078
+     */
2079
+    function setCompleted( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
2081 2080
     if( empty( $year )) {
2082
-      if( $this->getConfig( 'allowEmpty' )) {
2081
+        if( $this->getConfig( 'allowEmpty' )) {
2083 2082
         $this->completed = array( 'value' => null, 'params' => $this->_setParams( $params ));
2084 2083
         return TRUE;
2085
-      }
2086
-      else
2084
+        }
2085
+        else
2087 2086
         return FALSE;
2088 2087
     }
2089 2088
     $this->completed = $this->_setDate2( $year, $month, $day, $hour, $min, $sec, $params );
2090 2089
     return TRUE;
2091
-  }
2090
+    }
2092 2091
 /*********************************************************************************/
2093 2092
 /**
2094 2093
  * Property Name: CONTACT
@@ -2100,34 +2099,34 @@  discard block
 block discarded – undo
2100 2099
  * @since 2.4.8 - 2008-10-23
2101 2100
  * @return string
2102 2101
  */
2103
-  function createContact() {
2102
+    function createContact() {
2104 2103
     if( empty( $this->contact )) return FALSE;
2105 2104
     $output = null;
2106 2105
     foreach( $this->contact as $contact ) {
2107
-      if( !empty( $contact['value'] )) {
2106
+        if( !empty( $contact['value'] )) {
2108 2107
         $attributes = $this->_createParams( $contact['params'], array( 'ALTREP', 'LANGUAGE' ));
2109 2108
         $content    = $this->_strrep( $contact['value'] );
2110 2109
         $output    .= $this->_createElement( 'CONTACT', $attributes, $content );
2111
-      }
2112
-      elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'CONTACT' );
2110
+        }
2111
+        elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'CONTACT' );
2113 2112
     }
2114 2113
     return $output;
2115
-  }
2114
+    }
2116 2115
 /**
2117
- * set calendar component property contact
2118
- *
2119
- * @author Kjell-Inge Gustafsson <[email protected]>
2120
- * @since 2.5.1 - 2008-11-05
2121
- * @param string $value
2122
- * @param array $params, optional
2123
- * @param integer $index, optional
2124
- * @return bool
2125
- */
2126
-  function setContact( $value, $params=FALSE, $index=FALSE ) {
2116
+     * set calendar component property contact
2117
+     *
2118
+     * @author Kjell-Inge Gustafsson <[email protected]>
2119
+     * @since 2.5.1 - 2008-11-05
2120
+     * @param string $value
2121
+     * @param array $params, optional
2122
+     * @param integer $index, optional
2123
+     * @return bool
2124
+     */
2125
+    function setContact( $value, $params=FALSE, $index=FALSE ) {
2127 2126
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
2128 2127
     $this->_setMval( $this->contact, $value, $params, FALSE, $index );
2129 2128
     return TRUE;
2130
-  }
2129
+    }
2131 2130
 /*********************************************************************************/
2132 2131
 /**
2133 2132
  * Property Name: CREATED
@@ -2139,33 +2138,33 @@  discard block
 block discarded – undo
2139 2138
  * @since 2.4.8 - 2008-10-21
2140 2139
  * @return string
2141 2140
  */
2142
-  function createCreated() {
2141
+    function createCreated() {
2143 2142
     if( empty( $this->created )) return FALSE;
2144 2143
     $formatted  = $this->_format_date_time( $this->created['value'], 7 );
2145 2144
     $attributes = $this->_createParams( $this->created['params'] );
2146 2145
     return $this->_createElement( 'CREATED', $attributes, $formatted );
2147
-  }
2146
+    }
2148 2147
 /**
2149
- * set calendar component property created
2150
- *
2151
- * @author Kjell-Inge Gustafsson <[email protected]>
2152
- * @since 2.4.8 - 2008-10-23
2153
- * @param mixed $year optional
2154
- * @param mixed $month optional
2155
- * @param int $day optional
2156
- * @param int $hour optional
2157
- * @param int $min optional
2158
- * @param int $sec optional
2159
- * @param mixed $params optional
2160
- * @return bool
2161
- */
2162
-  function setCreated( $year=FALSE, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
2148
+     * set calendar component property created
2149
+     *
2150
+     * @author Kjell-Inge Gustafsson <[email protected]>
2151
+     * @since 2.4.8 - 2008-10-23
2152
+     * @param mixed $year optional
2153
+     * @param mixed $month optional
2154
+     * @param int $day optional
2155
+     * @param int $hour optional
2156
+     * @param int $min optional
2157
+     * @param int $sec optional
2158
+     * @param mixed $params optional
2159
+     * @return bool
2160
+     */
2161
+    function setCreated( $year=FALSE, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
2163 2162
     if( !isset( $year )) {
2164
-      $year = date('Ymd\THis', mktime( date( 'H' ), date( 'i' ), date( 's' ) - date( 'Z'), date( 'm' ), date( 'd' ), date( 'Y' )));
2163
+        $year = date('Ymd\THis', mktime( date( 'H' ), date( 'i' ), date( 's' ) - date( 'Z'), date( 'm' ), date( 'd' ), date( 'Y' )));
2165 2164
     }
2166 2165
     $this->created = $this->_setDate2( $year, $month, $day, $hour, $min, $sec, $params );
2167 2166
     return TRUE;
2168
-  }
2167
+    }
2169 2168
 /*********************************************************************************/
2170 2169
 /**
2171 2170
  * Property Name: DESCRIPTION
@@ -2177,34 +2176,34 @@  discard block
 block discarded – undo
2177 2176
  * @since 2.4.8 - 2008-10-22
2178 2177
  * @return string
2179 2178
  */
2180
-  function createDescription() {
2179
+    function createDescription() {
2181 2180
     if( empty( $this->description )) return FALSE;
2182 2181
     $output       = null;
2183 2182
     foreach( $this->description as $description ) {
2184
-      if( !empty( $description['value'] )) {
2183
+        if( !empty( $description['value'] )) {
2185 2184
         $attributes = $this->_createParams( $description['params'], array( 'ALTREP', 'LANGUAGE' ));
2186 2185
         $content    = $this->_strrep( $description['value'] );
2187 2186
         $output    .= $this->_createElement( 'DESCRIPTION', $attributes, $content );
2188
-      }
2189
-      elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'DESCRIPTION' );
2187
+        }
2188
+        elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'DESCRIPTION' );
2190 2189
     }
2191 2190
     return $output;
2192
-  }
2191
+    }
2193 2192
 /**
2194
- * set calendar component property description
2195
- *
2196
- * @author Kjell-Inge Gustafsson <[email protected]>
2197
- * @since 2.5.1 - 2008-11-05
2198
- * @param string $value
2199
- * @param array $params, optional
2200
- * @param integer $index, optional
2201
- * @return bool
2202
- */
2203
-  function setDescription( $value, $params=FALSE, $index=FALSE ) {
2193
+     * set calendar component property description
2194
+     *
2195
+     * @author Kjell-Inge Gustafsson <[email protected]>
2196
+     * @since 2.5.1 - 2008-11-05
2197
+     * @param string $value
2198
+     * @param array $params, optional
2199
+     * @param integer $index, optional
2200
+     * @return bool
2201
+     */
2202
+    function setDescription( $value, $params=FALSE, $index=FALSE ) {
2204 2203
     if( empty( $value )) { if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; }
2205 2204
     $this->_setMval( $this->description, $value, $params, FALSE, $index );
2206 2205
     return TRUE;
2207
-  }
2206
+    }
2208 2207
 /*********************************************************************************/
2209 2208
 /**
2210 2209
  * Property Name: DTEND
@@ -2216,7 +2215,7 @@  discard block
 block discarded – undo
2216 2215
  * @since 2.4.8 - 2008-10-21
2217 2216
  * @return string
2218 2217
  */
2219
-  function createDtend() {
2218
+    function createDtend() {
2220 2219
     if( empty( $this->dtend )) return FALSE;
2221 2220
     if( !isset( $this->dtend['value']['year'] )  &&
2222 2221
         !isset( $this->dtend['value']['month'] ) &&
@@ -2224,40 +2223,40 @@  discard block
 block discarded – undo
2224 2223
         !isset( $this->dtend['value']['hour'] )  &&
2225 2224
         !isset( $this->dtend['value']['min'] )   &&
2226 2225
         !isset( $this->dtend['value']['sec'] ))
2227
-      if( $this->getConfig( 'allowEmpty' ))
2226
+        if( $this->getConfig( 'allowEmpty' ))
2228 2227
         return $this->_createElement( 'DTEND' );
2229
-      else return FALSE;
2228
+        else return FALSE;
2230 2229
     $formatted  = $this->_format_date_time( $this->dtend['value'] );
2231 2230
     $attributes = $this->_createParams( $this->dtend['params'] );
2232 2231
     return $this->_createElement( 'DTEND', $attributes, $formatted );
2233
-  }
2232
+    }
2234 2233
 /**
2235
- * set calendar component property dtend
2236
- *
2237
- * @author Kjell-Inge Gustafsson <[email protected]>
2238
- * @since 2.4.8 - 2008-10-23
2239
- * @param mixed $year
2240
- * @param mixed $month optional
2241
- * @param int $day optional
2242
- * @param int $hour optional
2243
- * @param int $min optional
2244
- * @param int $sec optional
2245
- * @param string $tz optional
2246
- * @param array params optional
2247
- * @return bool
2248
- */
2249
-  function setDtend( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
2234
+     * set calendar component property dtend
2235
+     *
2236
+     * @author Kjell-Inge Gustafsson <[email protected]>
2237
+     * @since 2.4.8 - 2008-10-23
2238
+     * @param mixed $year
2239
+     * @param mixed $month optional
2240
+     * @param int $day optional
2241
+     * @param int $hour optional
2242
+     * @param int $min optional
2243
+     * @param int $sec optional
2244
+     * @param string $tz optional
2245
+     * @param array params optional
2246
+     * @return bool
2247
+     */
2248
+    function setDtend( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
2250 2249
     if( empty( $year )) {
2251
-      if( $this->getConfig( 'allowEmpty' )) {
2250
+        if( $this->getConfig( 'allowEmpty' )) {
2252 2251
         $this->dtend = array( 'value' => null, 'params' => $this->_setParams( $params ));
2253 2252
         return TRUE;
2254
-      }
2255
-      else
2253
+        }
2254
+        else
2256 2255
         return FALSE;
2257 2256
     }
2258 2257
     $this->dtend = $this->_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params );
2259 2258
     return TRUE;
2260
-  }
2259
+    }
2261 2260
 /*********************************************************************************/
2262 2261
 /**
2263 2262
  * Property Name: DTSTAMP
@@ -2269,55 +2268,55 @@  discard block
 block discarded – undo
2269 2268
  * @since 2.4.4 - 2008-03-07
2270 2269
  * @return string
2271 2270
  */
2272
-  function createDtstamp() {
2271
+    function createDtstamp() {
2273 2272
     if( !isset( $this->dtstamp['value']['year'] )  &&
2274 2273
         !isset( $this->dtstamp['value']['month'] ) &&
2275 2274
         !isset( $this->dtstamp['value']['day'] )   &&
2276 2275
         !isset( $this->dtstamp['value']['hour'] )  &&
2277 2276
         !isset( $this->dtstamp['value']['min'] )   &&
2278 2277
         !isset( $this->dtstamp['value']['sec'] ))
2279
-      $this->_makeDtstamp();
2278
+        $this->_makeDtstamp();
2280 2279
     $formatted  = $this->_format_date_time( $this->dtstamp['value'], 7 );
2281 2280
     $attributes = $this->_createParams( $this->dtstamp['params'] );
2282 2281
     return $this->_createElement( 'DTSTAMP', $attributes, $formatted );
2283
-  }
2282
+    }
2284 2283
 /**
2285
- * computes datestamp for calendar component object instance dtstamp
2286
- *
2287
- * @author Kjell-Inge Gustafsson <[email protected]>
2288
- * @since 1.x.x - 2007-05-13
2289
- * @return void
2290
- */
2291
-  function _makeDtstamp() {
2284
+     * computes datestamp for calendar component object instance dtstamp
2285
+     *
2286
+     * @author Kjell-Inge Gustafsson <[email protected]>
2287
+     * @since 1.x.x - 2007-05-13
2288
+     * @return void
2289
+     */
2290
+    function _makeDtstamp() {
2292 2291
     $this->dtstamp['value'] = array( 'year'  => date( 'Y' )
2293
-                                   , 'month' => date( 'm' )
2294
-                                   , 'day'   => date( 'd' )
2295
-                                   , 'hour'  => date( 'H' )
2296
-                                   , 'min'   => date( 'i' )
2297
-                                   , 'sec'   => date( 's' ) - date( 'Z' ));
2292
+                                    , 'month' => date( 'm' )
2293
+                                    , 'day'   => date( 'd' )
2294
+                                    , 'hour'  => date( 'H' )
2295
+                                    , 'min'   => date( 'i' )
2296
+                                    , 'sec'   => date( 's' ) - date( 'Z' ));
2298 2297
     $this->dtstamp['params'] = null;
2299
-  }
2298
+    }
2300 2299
 /**
2301
- * set calendar component property dtstamp
2302
- *
2303
- * @author Kjell-Inge Gustafsson <[email protected]>
2304
- * @since 2.4.8 - 2008-10-23
2305
- * @param mixed $year
2306
- * @param mixed $month optional
2307
- * @param int $day optional
2308
- * @param int $hour optional
2309
- * @param int $min optional
2310
- * @param int $sec optional
2311
- * @param array $params optional
2312
- * @return TRUE
2313
- */
2314
-  function setDtstamp( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
2300
+     * set calendar component property dtstamp
2301
+     *
2302
+     * @author Kjell-Inge Gustafsson <[email protected]>
2303
+     * @since 2.4.8 - 2008-10-23
2304
+     * @param mixed $year
2305
+     * @param mixed $month optional
2306
+     * @param int $day optional
2307
+     * @param int $hour optional
2308
+     * @param int $min optional
2309
+     * @param int $sec optional
2310
+     * @param array $params optional
2311
+     * @return TRUE
2312
+     */
2313
+    function setDtstamp( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
2315 2314
     if( empty( $year ))
2316
-      $this->_makeDtstamp();
2315
+        $this->_makeDtstamp();
2317 2316
     else
2318
-      $this->dtstamp = $this->_setDate2( $year, $month, $day, $hour, $min, $sec, $params );
2317
+        $this->dtstamp = $this->_setDate2( $year, $month, $day, $hour, $min, $sec, $params );
2319 2318
     return TRUE;
2320
-  }
2319
+    }
2321 2320
 /*********************************************************************************/
2322 2321
 /**
2323 2322
  * Property Name: DTSTART
@@ -2329,7 +2328,7 @@  discard block
 block discarded – undo
2329 2328
  * @since 2.4.16 - 2008-10-26
2330 2329
  * @return string
2331 2330
  */
2332
-  function createDtstart() {
2331
+    function createDtstart() {
2333 2332
     if( empty( $this->dtstart )) return FALSE;
2334 2333
     if( !isset( $this->dtstart['value']['year'] )  &&
2335 2334
         !isset( $this->dtstart['value']['month'] ) &&
@@ -2338,41 +2337,41 @@  discard block
 block discarded – undo
2338 2337
         !isset( $this->dtstart['value']['min'] )   &&
2339 2338
         !isset( $this->dtstart['value']['sec'] ))
2340 2339
     if( $this->getConfig( 'allowEmpty' ))
2341
-      return $this->_createElement( 'DTSTART' );
2340
+        return $this->_createElement( 'DTSTART' );
2342 2341
     else return FALSE;
2343 2342
     if( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' )))
2344
-      unset( $this->dtstart['value']['tz'], $this->dtstart['params']['TZID'] );
2343
+        unset( $this->dtstart['value']['tz'], $this->dtstart['params']['TZID'] );
2345 2344
     $formatted  = $this->_format_date_time( $this->dtstart['value'] );
2346 2345
     $attributes = $this->_createParams( $this->dtstart['params'] );
2347 2346
     return $this->_createElement( 'DTSTART', $attributes, $formatted );
2348
-  }
2347
+    }
2349 2348
 /**
2350
- * set calendar component property dtstart
2351
- *
2352
- * @author Kjell-Inge Gustafsson <[email protected]>
2353
- * @since 2.4.16 - 2008-11-04
2354
- * @param mixed $year
2355
- * @param mixed $month optional
2356
- * @param int $day optional
2357
- * @param int $hour optional
2358
- * @param int $min optional
2359
- * @param int $sec optional
2360
- * @param string $tz optional
2361
- * @param array $params optional
2362
- * @return bool
2363
- */
2364
-  function setDtstart( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
2349
+     * set calendar component property dtstart
2350
+     *
2351
+     * @author Kjell-Inge Gustafsson <[email protected]>
2352
+     * @since 2.4.16 - 2008-11-04
2353
+     * @param mixed $year
2354
+     * @param mixed $month optional
2355
+     * @param int $day optional
2356
+     * @param int $hour optional
2357
+     * @param int $min optional
2358
+     * @param int $sec optional
2359
+     * @param string $tz optional
2360
+     * @param array $params optional
2361
+     * @return bool
2362
+     */
2363
+    function setDtstart( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
2365 2364
     if( empty( $year )) {
2366
-      if( $this->getConfig( 'allowEmpty' )) {
2365
+        if( $this->getConfig( 'allowEmpty' )) {
2367 2366
         $this->dtstart = array( 'value' => null, 'params' => $this->_setParams( $params ));
2368 2367
         return TRUE;
2369
-      }
2370
-      else
2368
+        }
2369
+        else
2371 2370
         return FALSE;
2372 2371
     }
2373 2372
     $this->dtstart = $this->_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params, 'dtstart' );
2374 2373
     return TRUE;
2375
-  }
2374
+    }
2376 2375
 /*********************************************************************************/
2377 2376
 /**
2378 2377
  * Property Name: DUE
@@ -2384,7 +2383,7 @@  discard block
 block discarded – undo
2384 2383
  * @since 2.4.8 - 2008-10-22
2385 2384
  * @return string
2386 2385
  */
2387
-  function createDue() {
2386
+    function createDue() {
2388 2387
     if( empty( $this->due )) return FALSE;
2389 2388
     if( !isset( $this->due['value']['year'] )  &&
2390 2389
         !isset( $this->due['value']['month'] ) &&
@@ -2392,39 +2391,39 @@  discard block
 block discarded – undo
2392 2391
         !isset( $this->due['value']['hour'] )  &&
2393 2392
         !isset( $this->due['value']['min'] )   &&
2394 2393
         !isset( $this->due['value']['sec'] ))
2395
-      if( $this->getConfig( 'allowEmpty' ))
2394
+        if( $this->getConfig( 'allowEmpty' ))
2396 2395
         return $this->_createElement( 'DUE' );
2397
-      else return FALSE;
2396
+        else return FALSE;
2398 2397
     $formatted  = $this->_format_date_time( $this->due['value'] );
2399 2398
     $attributes = $this->_createParams( $this->due['params'] );
2400 2399
     return $this->_createElement( 'DUE', $attributes, $formatted );
2401
-  }
2400
+    }
2402 2401
 /**
2403
- * set calendar component property due
2404
- *
2405
- * @author Kjell-Inge Gustafsson <[email protected]>
2406
- * @since 2.4.8 - 2008-11-04
2407
- * @param mixed $year
2408
- * @param mixed $month optional
2409
- * @param int $day optional
2410
- * @param int $hour optional
2411
- * @param int $min optional
2412
- * @param int $sec optional
2413
- * @param array $params optional
2414
- * @return bool
2415
- */
2416
-  function setDue( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
2402
+     * set calendar component property due
2403
+     *
2404
+     * @author Kjell-Inge Gustafsson <[email protected]>
2405
+     * @since 2.4.8 - 2008-11-04
2406
+     * @param mixed $year
2407
+     * @param mixed $month optional
2408
+     * @param int $day optional
2409
+     * @param int $hour optional
2410
+     * @param int $min optional
2411
+     * @param int $sec optional
2412
+     * @param array $params optional
2413
+     * @return bool
2414
+     */
2415
+    function setDue( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
2417 2416
     if( empty( $year )) {
2418
-      if( $this->getConfig( 'allowEmpty' )) {
2417
+        if( $this->getConfig( 'allowEmpty' )) {
2419 2418
         $this->due = array( 'value' => null, 'params' => $this->_setParams( $params ));
2420 2419
         return TRUE;
2421
-      }
2422
-      else
2420
+        }
2421
+        else
2423 2422
         return FALSE;
2424 2423
     }
2425 2424
     $this->due = $this->_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params );
2426 2425
     return TRUE;
2427
-  }
2426
+    }
2428 2427
 /*********************************************************************************/
2429 2428
 /**
2430 2429
  * Property Name: DURATION
@@ -2436,48 +2435,48 @@  discard block
 block discarded – undo
2436 2435
  * @since 2.4.8 - 2008-10-21
2437 2436
  * @return string
2438 2437
  */
2439
-  function createDuration() {
2438
+    function createDuration() {
2440 2439
     if( empty( $this->duration )) return FALSE;
2441 2440
     if( !isset( $this->duration['value']['week'] ) &&
2442 2441
         !isset( $this->duration['value']['day'] )  &&
2443 2442
         !isset( $this->duration['value']['hour'] ) &&
2444 2443
         !isset( $this->duration['value']['min'] )  &&
2445 2444
         !isset( $this->duration['value']['sec'] ))
2446
-      if( $this->getConfig( 'allowEmpty' ))
2445
+        if( $this->getConfig( 'allowEmpty' ))
2447 2446
         return $this->_createElement( 'DURATION', array(), null );
2448
-      else return FALSE;
2447
+        else return FALSE;
2449 2448
     $attributes = $this->_createParams( $this->duration['params'] );
2450 2449
     return $this->_createElement( 'DURATION', $attributes, $this->_format_duration( $this->duration['value'] ));
2451
-  }
2450
+    }
2452 2451
 /**
2453
- * set calendar component property duration
2454
- *
2455
- * @author Kjell-Inge Gustafsson <[email protected]>
2456
- * @since 2.4.8 - 2008-11-04
2457
- * @param mixed $week
2458
- * @param mixed $day optional
2459
- * @param int $hour optional
2460
- * @param int $min optional
2461
- * @param int $sec optional
2462
- * @param array $params optional
2463
- * @return bool
2464
- */
2465
-  function setDuration( $week, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
2452
+     * set calendar component property duration
2453
+     *
2454
+     * @author Kjell-Inge Gustafsson <[email protected]>
2455
+     * @since 2.4.8 - 2008-11-04
2456
+     * @param mixed $week
2457
+     * @param mixed $day optional
2458
+     * @param int $hour optional
2459
+     * @param int $min optional
2460
+     * @param int $sec optional
2461
+     * @param array $params optional
2462
+     * @return bool
2463
+     */
2464
+    function setDuration( $week, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
2466 2465
     if( empty( $week )) if( $this->getConfig( 'allowEmpty' )) $week = null; else return FALSE;
2467 2466
     if( is_array( $week ) && ( 1 <= count( $week )))
2468
-      $this->duration = array( 'value' => $this->_duration_array( $week ), 'params' => $this->_setParams( $day ));
2467
+        $this->duration = array( 'value' => $this->_duration_array( $week ), 'params' => $this->_setParams( $day ));
2469 2468
     elseif( is_string( $week ) && ( 3 <= strlen( trim( $week )))) {
2470
-      $week = trim( $week );
2471
-      if( in_array( substr( $week, 0, 1 ), array( '+', '-' )))
2469
+        $week = trim( $week );
2470
+        if( in_array( substr( $week, 0, 1 ), array( '+', '-' )))
2472 2471
         $week = substr( $week, 1 );
2473
-      $this->duration = array( 'value' => $this->_duration_string( $week ), 'params' => $this->_setParams( $day ));
2472
+        $this->duration = array( 'value' => $this->_duration_string( $week ), 'params' => $this->_setParams( $day ));
2474 2473
     }
2475 2474
     elseif( empty( $week ) && empty( $day ) && empty( $hour ) && empty( $min ) && empty( $sec ))
2476
-      return FALSE;
2475
+        return FALSE;
2477 2476
     else
2478
-      $this->duration = array( 'value' => $this->_duration_array( array( $week, $day, $hour, $min, $sec )), 'params' => $this->_setParams( $params ));
2477
+        $this->duration = array( 'value' => $this->_duration_array( array( $week, $day, $hour, $min, $sec )), 'params' => $this->_setParams( $params ));
2479 2478
     return TRUE;
2480
-  }
2479
+    }
2481 2480
 /*********************************************************************************/
2482 2481
 /**
2483 2482
  * Property Name: EXDATE
@@ -2489,57 +2488,57 @@  discard block
 block discarded – undo
2489 2488
  * @since 2.4.8 - 2008-10-22
2490 2489
  * @return string
2491 2490
  */
2492
-  function createExdate() {
2491
+    function createExdate() {
2493 2492
     if( empty( $this->exdate )) return FALSE;
2494 2493
     $output = null;
2495 2494
     foreach( $this->exdate as $ex => $theExdate ) {
2496
-      if( empty( $theExdate['value'] )) {
2495
+        if( empty( $theExdate['value'] )) {
2497 2496
         if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'EXDATE' );
2498 2497
         continue;
2499
-      }
2500
-      $content = $attributes = null;
2501
-      foreach( $theExdate['value'] as $eix => $exdatePart ) {
2498
+        }
2499
+        $content = $attributes = null;
2500
+        foreach( $theExdate['value'] as $eix => $exdatePart ) {
2502 2501
         $parno = count( $exdatePart );
2503 2502
         $formatted = $this->_format_date_time( $exdatePart, $parno );
2504 2503
         if( isset( $theExdate['params']['TZID'] ))
2505
-          $formatted = str_replace( 'Z', '', $formatted);
2504
+            $formatted = str_replace( 'Z', '', $formatted);
2506 2505
         if( 0 < $eix ) {
2507
-          if( isset( $theExdate['value'][0]['tz'] )) {
2506
+            if( isset( $theExdate['value'][0]['tz'] )) {
2508 2507
             if( ctype_digit( substr( $theExdate['value'][0]['tz'], -4 )) ||
2509 2508
                ( 'Z' == $theExdate['value'][0]['tz'] )) {
2510
-              if( 'Z' != substr( $formatted, -1 ))
2509
+                if( 'Z' != substr( $formatted, -1 ))
2511 2510
                 $formatted .= 'Z';
2512 2511
             }
2513 2512
             else
2514
-              $formatted = str_replace( 'Z', '', $formatted );
2515
-          }
2516
-          else
2513
+                $formatted = str_replace( 'Z', '', $formatted );
2514
+            }
2515
+            else
2517 2516
             $formatted = str_replace( 'Z', '', $formatted );
2518 2517
         }
2519 2518
         $content .= ( 0 < $eix ) ? ','.$formatted : $formatted;
2520
-      }
2521
-      $attributes .= $this->_createParams( $theExdate['params'] );
2522
-      $output .= $this->_createElement( 'EXDATE', $attributes, $content );
2519
+        }
2520
+        $attributes .= $this->_createParams( $theExdate['params'] );
2521
+        $output .= $this->_createElement( 'EXDATE', $attributes, $content );
2523 2522
     }
2524 2523
     return $output;
2525
-  }
2524
+    }
2526 2525
 /**
2527
- * set calendar component property exdate
2528
- *
2529
- * @author Kjell-Inge Gustafsson <[email protected]>
2530
- * @since 2.5.1 - 2008-11-05
2531
- * @param array exdates
2532
- * @param array $params, optional
2533
- * @param integer $index, optional
2534
- * @return bool
2535
- */
2536
-  function setExdate( $exdates, $params=FALSE, $index=FALSE ) {
2526
+     * set calendar component property exdate
2527
+     *
2528
+     * @author Kjell-Inge Gustafsson <[email protected]>
2529
+     * @since 2.5.1 - 2008-11-05
2530
+     * @param array exdates
2531
+     * @param array $params, optional
2532
+     * @param integer $index, optional
2533
+     * @return bool
2534
+     */
2535
+    function setExdate( $exdates, $params=FALSE, $index=FALSE ) {
2537 2536
     if( empty( $exdates )) {
2538
-      if( $this->getConfig( 'allowEmpty' )) {
2537
+        if( $this->getConfig( 'allowEmpty' )) {
2539 2538
         $this->_setMval( $this->exdate, null, $params, FALSE, $index );
2540 2539
         return TRUE;
2541
-      }
2542
-      else
2540
+        }
2541
+        else
2543 2542
         return FALSE;
2544 2543
     }
2545 2544
     $input  = array( 'params' => $this->_setParams( $params, array( 'VALUE' => 'DATE-TIME' )));
@@ -2547,32 +2546,32 @@  discard block
 block discarded – undo
2547 2546
     $this->_chkdatecfg( reset( $exdates ), $parno, $input['params'] );
2548 2547
     $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME' ); // remove default parameter
2549 2548
     foreach( $exdates as $eix => $theExdate ) {
2550
-      if( $this->_isArrayTimestampDate( $theExdate ))
2549
+        if( $this->_isArrayTimestampDate( $theExdate ))
2551 2550
         $exdatea = $this->_timestamp2date( $theExdate, $parno );
2552
-      elseif(  is_array( $theExdate ))
2551
+        elseif(  is_array( $theExdate ))
2553 2552
         $exdatea = $this->_date_time_array( $theExdate, $parno );
2554
-      elseif( 8 <= strlen( trim( $theExdate ))) // ex. 2006-08-03 10:12:18
2553
+        elseif( 8 <= strlen( trim( $theExdate ))) // ex. 2006-08-03 10:12:18
2555 2554
         $exdatea = $this->_date_time_string( $theExdate, $parno );
2556
-      if( 3 == $parno )
2555
+        if( 3 == $parno )
2557 2556
         unset( $exdatea['hour'], $exdatea['min'], $exdatea['sec'], $exdatea['tz'] );
2558
-      elseif( isset( $exdatea['tz'] ))
2557
+        elseif( isset( $exdatea['tz'] ))
2559 2558
         $exdatea['tz'] = (string) $exdatea['tz'];
2560
-      if(  isset( $input['params']['TZID'] ) ||
2559
+        if(  isset( $input['params']['TZID'] ) ||
2561 2560
          ( isset( $exdatea['tz'] ) && !$this->_isOffset( $exdatea['tz'] )) ||
2562 2561
          ( isset( $input['value'][0] ) && ( !isset( $input['value'][0]['tz'] ))) ||
2563 2562
          ( isset( $input['value'][0]['tz'] ) && !$this->_isOffset( $input['value'][0]['tz'] )))
2564 2563
         unset( $exdatea['tz'] );
2565
-      $input['value'][] = $exdatea;
2564
+        $input['value'][] = $exdatea;
2566 2565
     }
2567 2566
     if( 0 >= count( $input['value'] ))
2568
-      return FALSE;
2567
+        return FALSE;
2569 2568
     if( 3 == $parno ) {
2570
-      $input['params']['VALUE'] = 'DATE';
2571
-      unset( $input['params']['TZID'] );
2569
+        $input['params']['VALUE'] = 'DATE';
2570
+        unset( $input['params']['TZID'] );
2572 2571
     }
2573 2572
     $this->_setMval( $this->exdate, $input['value'], $input['params'], FALSE, $index );
2574 2573
     return TRUE;
2575
-  }
2574
+    }
2576 2575
 /*********************************************************************************/
2577 2576
 /**
2578 2577
  * Property Name: EXRULE
@@ -2584,25 +2583,25 @@  discard block
 block discarded – undo
2584 2583
  * @since 2.4.8 - 2008-10-22
2585 2584
  * @return string
2586 2585
  */
2587
-  function createExrule() {
2586
+    function createExrule() {
2588 2587
     if( empty( $this->exrule )) return FALSE;
2589 2588
     return $this->_format_recur( 'EXRULE', $this->exrule );
2590
-  }
2589
+    }
2591 2590
 /**
2592
- * set calendar component property exdate
2593
- *
2594
- * @author Kjell-Inge Gustafsson <[email protected]>
2595
- * @since 2.5.1 - 2008-11-05
2596
- * @param array $exruleset
2597
- * @param array $params, optional
2598
- * @param integer $index, optional
2599
- * @return bool
2600
- */
2601
-  function setExrule( $exruleset, $params=FALSE, $index=FALSE ) {
2591
+     * set calendar component property exdate
2592
+     *
2593
+     * @author Kjell-Inge Gustafsson <[email protected]>
2594
+     * @since 2.5.1 - 2008-11-05
2595
+     * @param array $exruleset
2596
+     * @param array $params, optional
2597
+     * @param integer $index, optional
2598
+     * @return bool
2599
+     */
2600
+    function setExrule( $exruleset, $params=FALSE, $index=FALSE ) {
2602 2601
     if( empty( $exruleset )) if( $this->getConfig( 'allowEmpty' )) $exruleset = null; else return FALSE;
2603 2602
     $this->_setMval( $this->exrule, $this->_setRexrule( $exruleset ), $params, FALSE, $index );
2604 2603
     return TRUE;
2605
-  }
2604
+    }
2606 2605
 /*********************************************************************************/
2607 2606
 /**
2608 2607
  * Property Name: FREEBUSY
@@ -2614,110 +2613,110 @@  discard block
 block discarded – undo
2614 2613
  * @since 2.4.8 - 2008-10-22
2615 2614
  * @return string
2616 2615
  */
2617
-  function createFreebusy() {
2616
+    function createFreebusy() {
2618 2617
     if( empty( $this->freebusy )) return FALSE;
2619 2618
     $output = null;
2620 2619
     foreach( $this->freebusy as $freebusyPart ) {
2621
-      if( empty( $freebusyPart['value'] )) {
2620
+        if( empty( $freebusyPart['value'] )) {
2622 2621
         if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'FREEBUSY' );
2623 2622
         continue;
2624
-      }
2625
-      $attributes = $content = null;
2626
-      if( isset( $freebusyPart['value']['fbtype'] )) {
2623
+        }
2624
+        $attributes = $content = null;
2625
+        if( isset( $freebusyPart['value']['fbtype'] )) {
2627 2626
         $attributes .= $this->intAttrDelimiter.'FBTYPE='.$freebusyPart['value']['fbtype'];
2628 2627
         unset( $freebusyPart['value']['fbtype'] );
2629 2628
         $freebusyPart['value'] = array_values( $freebusyPart['value'] );
2630
-      }
2631
-      else
2629
+        }
2630
+        else
2632 2631
         $attributes .= $this->intAttrDelimiter.'FBTYPE=BUSY';
2633
-      $attributes .= $this->_createParams( $freebusyPart['params'] );
2634
-      $fno = 1;
2635
-      $cnt = count( $freebusyPart['value']);
2636
-      foreach( $freebusyPart['value'] as $periodix => $freebusyPeriod ) {
2632
+        $attributes .= $this->_createParams( $freebusyPart['params'] );
2633
+        $fno = 1;
2634
+        $cnt = count( $freebusyPart['value']);
2635
+        foreach( $freebusyPart['value'] as $periodix => $freebusyPeriod ) {
2637 2636
         $formatted   = $this->_format_date_time( $freebusyPeriod[0] );
2638 2637
         $content .= $formatted;
2639 2638
         $content .= '/';
2640 2639
         $cnt2 = count( $freebusyPeriod[1]);
2641 2640
         if( array_key_exists( 'year', $freebusyPeriod[1] ))      // date-time
2642
-          $cnt2 = 7;
2641
+            $cnt2 = 7;
2643 2642
         elseif( array_key_exists( 'week', $freebusyPeriod[1] ))  // duration
2644
-          $cnt2 = 5;
2643
+            $cnt2 = 5;
2645 2644
         if(( 7 == $cnt2 )   &&    // period=  -> date-time
2646 2645
             isset( $freebusyPeriod[1]['year'] )  &&
2647 2646
             isset( $freebusyPeriod[1]['month'] ) &&
2648 2647
             isset( $freebusyPeriod[1]['day'] )) {
2649
-          $content .= $this->_format_date_time( $freebusyPeriod[1] );
2648
+            $content .= $this->_format_date_time( $freebusyPeriod[1] );
2650 2649
         }
2651 2650
         else {                                  // period=  -> dur-time
2652
-          $content .= $this->_format_duration( $freebusyPeriod[1] );
2651
+            $content .= $this->_format_duration( $freebusyPeriod[1] );
2653 2652
         }
2654 2653
         if( $fno < $cnt )
2655
-          $content .= ',';
2654
+            $content .= ',';
2656 2655
         $fno++;
2657
-      }
2658
-      $output .= $this->_createElement( 'FREEBUSY', $attributes, $content );
2656
+        }
2657
+        $output .= $this->_createElement( 'FREEBUSY', $attributes, $content );
2659 2658
     }
2660 2659
     return $output;
2661
-  }
2660
+    }
2662 2661
 /**
2663
- * set calendar component property freebusy
2664
- *
2665
- * @author Kjell-Inge Gustafsson <[email protected]>
2666
- * @since 2.5.1 - 2008-11-05
2667
- * @param string $fbType
2668
- * @param array $fbValues
2669
- * @param array $params, optional
2670
- * @param integer $index, optional
2671
- * @return bool
2672
- */
2673
-  function setFreebusy( $fbType, $fbValues, $params=FALSE, $index=FALSE ) {
2662
+     * set calendar component property freebusy
2663
+     *
2664
+     * @author Kjell-Inge Gustafsson <[email protected]>
2665
+     * @since 2.5.1 - 2008-11-05
2666
+     * @param string $fbType
2667
+     * @param array $fbValues
2668
+     * @param array $params, optional
2669
+     * @param integer $index, optional
2670
+     * @return bool
2671
+     */
2672
+    function setFreebusy( $fbType, $fbValues, $params=FALSE, $index=FALSE ) {
2674 2673
     if( empty( $fbValues )) {
2675
-      if( $this->getConfig( 'allowEmpty' )) {
2674
+        if( $this->getConfig( 'allowEmpty' )) {
2676 2675
         $this->_setMval( $this->freebusy, null, $params, FALSE, $index );
2677 2676
         return TRUE;
2678
-      }
2679
-      else
2677
+        }
2678
+        else
2680 2679
         return FALSE;
2681 2680
     }
2682 2681
     $fbType = strtoupper( $fbType );
2683 2682
     if(( !in_array( $fbType, array( 'FREE', 'BUSY', 'BUSY-UNAVAILABLE', 'BUSY-TENTATIVE' ))) &&
2684 2683
        ( 'X-' != substr( $fbType, 0, 2 )))
2685
-      $fbType = 'BUSY';
2684
+        $fbType = 'BUSY';
2686 2685
     $input = array( 'fbtype' => $fbType );
2687 2686
     foreach( $fbValues as $fbPeriod ) {   // periods => period
2688
-      $freebusyPeriod = array();
2689
-      foreach( $fbPeriod as $fbMember ) { // pairs => singlepart
2687
+        $freebusyPeriod = array();
2688
+        foreach( $fbPeriod as $fbMember ) { // pairs => singlepart
2690 2689
         $freebusyPairMember = array();
2691 2690
         if( is_array( $fbMember )) {
2692
-          if( $this->_isArrayDate( $fbMember )) { // date-time value
2691
+            if( $this->_isArrayDate( $fbMember )) { // date-time value
2693 2692
             $freebusyPairMember       = $this->_date_time_array( $fbMember, 7 );
2694 2693
             $freebusyPairMember['tz'] = 'Z';
2695
-          }
2696
-          elseif( $this->_isArrayTimestampDate( $fbMember )) { // timestamp value
2694
+            }
2695
+            elseif( $this->_isArrayTimestampDate( $fbMember )) { // timestamp value
2697 2696
             $freebusyPairMember       = $this->_timestamp2date( $fbMember['timestamp'], 7 );
2698 2697
             $freebusyPairMember['tz'] = 'Z';
2699
-          }
2700
-          else {                                         // array format duration
2698
+            }
2699
+            else {                                         // array format duration
2701 2700
             $freebusyPairMember = $this->_duration_array( $fbMember );
2702
-          }
2701
+            }
2703 2702
         }
2704 2703
         elseif(( 3 <= strlen( trim( $fbMember ))) &&    // string format duration
2705 2704
                ( in_array( $fbMember{0}, array( 'P', '+', '-' )))) {
2706
-          if( 'P' != $fbMember{0} )
2705
+            if( 'P' != $fbMember{0} )
2707 2706
             $fbmember = substr( $fbMember, 1 );
2708
-          $freebusyPairMember = $this->_duration_string( $fbMember );
2707
+            $freebusyPairMember = $this->_duration_string( $fbMember );
2709 2708
         }
2710 2709
         elseif( 8 <= strlen( trim( $fbMember ))) { // text date ex. 2006-08-03 10:12:18
2711
-          $freebusyPairMember       = $this->_date_time_string( $fbMember, 7 );
2712
-          $freebusyPairMember['tz'] = 'Z';
2710
+            $freebusyPairMember       = $this->_date_time_string( $fbMember, 7 );
2711
+            $freebusyPairMember['tz'] = 'Z';
2713 2712
         }
2714 2713
         $freebusyPeriod[]   = $freebusyPairMember;
2715
-      }
2716
-      $input[]              = $freebusyPeriod;
2714
+        }
2715
+        $input[]              = $freebusyPeriod;
2717 2716
     }
2718 2717
     $this->_setMval( $this->freebusy, $input, $params, FALSE, $index );
2719 2718
     return TRUE;
2720
-  }
2719
+    }
2721 2720
 /*********************************************************************************/
2722 2721
 /**
2723 2722
  * Property Name: GEO
@@ -2729,40 +2728,40 @@  discard block
 block discarded – undo
2729 2728
  * @since 2.4.8 - 2008-10-21
2730 2729
  * @return string
2731 2730
  */
2732
-  function createGeo() {
2731
+    function createGeo() {
2733 2732
     if( empty( $this->geo )) return FALSE;
2734 2733
     if( empty( $this->geo['value'] ))
2735
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'GEO' ) : FALSE;
2734
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'GEO' ) : FALSE;
2736 2735
     $attributes = $this->_createParams( $this->geo['params'] );
2737 2736
     $content    = null;
2738 2737
     $content   .= number_format( (float) $this->geo['value']['latitude'], 6, '.', '');
2739 2738
     $content   .= ';';
2740 2739
     $content   .= number_format( (float) $this->geo['value']['longitude'], 6, '.', '');
2741 2740
     return $this->_createElement( 'GEO', $attributes, $content );
2742
-  }
2741
+    }
2743 2742
 /**
2744
- * set calendar component property geo
2745
- *
2746
- * @author Kjell-Inge Gustafsson <[email protected]>
2747
- * @since 2.4.8 - 2008-11-04
2748
- * @param float $latitude
2749
- * @param float $longitude
2750
- * @param array $params optional
2751
- * @return bool
2752
- */
2753
-  function setGeo( $latitude, $longitude, $params=FALSE ) {
2743
+     * set calendar component property geo
2744
+     *
2745
+     * @author Kjell-Inge Gustafsson <[email protected]>
2746
+     * @since 2.4.8 - 2008-11-04
2747
+     * @param float $latitude
2748
+     * @param float $longitude
2749
+     * @param array $params optional
2750
+     * @return bool
2751
+     */
2752
+    function setGeo( $latitude, $longitude, $params=FALSE ) {
2754 2753
     if( !empty( $latitude ) && !empty( $longitude )) {
2755
-      if( !is_array( $this->geo )) $this->geo = array();
2756
-      $this->geo['value']['latitude']  = $latitude;
2757
-      $this->geo['value']['longitude'] = $longitude;
2758
-      $this->geo['params'] = $this->_setParams( $params );
2754
+        if( !is_array( $this->geo )) $this->geo = array();
2755
+        $this->geo['value']['latitude']  = $latitude;
2756
+        $this->geo['value']['longitude'] = $longitude;
2757
+        $this->geo['params'] = $this->_setParams( $params );
2759 2758
     }
2760 2759
     elseif( $this->getConfig( 'allowEmpty' ))
2761
-      $this->geo = array( 'value' => null, 'params' => $this->_setParams( $params ) );
2760
+        $this->geo = array( 'value' => null, 'params' => $this->_setParams( $params ) );
2762 2761
     else
2763
-      return FALSE;
2762
+        return FALSE;
2764 2763
     return TRUE;
2765
-  }
2764
+    }
2766 2765
 /*********************************************************************************/
2767 2766
 /**
2768 2767
  * Property Name: LAST-MODIFIED
@@ -2774,32 +2773,32 @@  discard block
 block discarded – undo
2774 2773
  * @since 2.4.8 - 2008-10-21
2775 2774
  * @return string
2776 2775
  */
2777
-  function createLastModified() {
2776
+    function createLastModified() {
2778 2777
     if( empty( $this->lastmodified )) return FALSE;
2779 2778
     $attributes = $this->_createParams( $this->lastmodified['params'] );
2780 2779
     $formatted  = $this->_format_date_time( $this->lastmodified['value'], 7 );
2781 2780
     return $this->_createElement( 'LAST-MODIFIED', $attributes, $formatted );
2782
-  }
2781
+    }
2783 2782
 /**
2784
- * set calendar component property completed
2785
- *
2786
- * @author Kjell-Inge Gustafsson <[email protected]>
2787
- * @since 2.4.8 - 2008-10-23
2788
- * @param mixed $year optional
2789
- * @param mixed $month optional
2790
- * @param int $day optional
2791
- * @param int $hour optional
2792
- * @param int $min optional
2793
- * @param int $sec optional
2794
- * @param array $params optional
2795
- * @return boll
2796
- */
2797
-  function setLastModified( $year=FALSE, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
2783
+     * set calendar component property completed
2784
+     *
2785
+     * @author Kjell-Inge Gustafsson <[email protected]>
2786
+     * @since 2.4.8 - 2008-10-23
2787
+     * @param mixed $year optional
2788
+     * @param mixed $month optional
2789
+     * @param int $day optional
2790
+     * @param int $hour optional
2791
+     * @param int $min optional
2792
+     * @param int $sec optional
2793
+     * @param array $params optional
2794
+     * @return boll
2795
+     */
2796
+    function setLastModified( $year=FALSE, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
2798 2797
     if( empty( $year ))
2799
-      $year = date('Ymd\THis', mktime( date( 'H' ), date( 'i' ), date( 's' ) - date( 'Z'), date( 'm' ), date( 'd' ), date( 'Y' )));
2798
+        $year = date('Ymd\THis', mktime( date( 'H' ), date( 'i' ), date( 's' ) - date( 'Z'), date( 'm' ), date( 'd' ), date( 'Y' )));
2800 2799
     $this->lastmodified = $this->_setDate2( $year, $month, $day, $hour, $min, $sec, $params );
2801 2800
     return TRUE;
2802
-  }
2801
+    }
2803 2802
 /*********************************************************************************/
2804 2803
 /**
2805 2804
  * Property Name: LOCATION
@@ -2811,28 +2810,28 @@  discard block
 block discarded – undo
2811 2810
  * @since 2.4.8 - 2008-10-22
2812 2811
  * @return string
2813 2812
  */
2814
-  function createLocation() {
2813
+    function createLocation() {
2815 2814
     if( empty( $this->location )) return FALSE;
2816 2815
     if( empty( $this->location['value'] ))
2817
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'LOCATION' ) : FALSE;
2816
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'LOCATION' ) : FALSE;
2818 2817
     $attributes = $this->_createParams( $this->location['params'], array( 'ALTREP', 'LANGUAGE' ));
2819 2818
     $content    = $this->_strrep( $this->location['value'] );
2820 2819
     return $this->_createElement( 'LOCATION', $attributes, $content );
2821
-  }
2820
+    }
2822 2821
 /**
2823
- * set calendar component property location
2822
+     * set calendar component property location
2824 2823
  '
2825
- * @author Kjell-Inge Gustafsson <[email protected]>
2826
- * @since 2.4.8 - 2008-11-04
2827
- * @param string $value
2828
- * @param array params optional
2829
- * @return bool
2830
- */
2831
-  function setLocation( $value, $params=FALSE ) {
2824
+     * @author Kjell-Inge Gustafsson <[email protected]>
2825
+     * @since 2.4.8 - 2008-11-04
2826
+     * @param string $value
2827
+     * @param array params optional
2828
+     * @return bool
2829
+     */
2830
+    function setLocation( $value, $params=FALSE ) {
2832 2831
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
2833 2832
     $this->location = array( 'value' => $value, 'params' => $this->_setParams( $params ));
2834 2833
     return TRUE;
2835
-  }
2834
+    }
2836 2835
 /*********************************************************************************/
2837 2836
 /**
2838 2837
  * Property Name: ORGANIZER
@@ -2844,35 +2843,35 @@  discard block
 block discarded – undo
2844 2843
  * @since 2.4.8 - 2008-10-21
2845 2844
  * @return string
2846 2845
  */
2847
-  function createOrganizer() {
2846
+    function createOrganizer() {
2848 2847
     if( empty( $this->organizer )) return FALSE;
2849 2848
     if( empty( $this->organizer['value'] ))
2850
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'ORGANIZER' ) : FALSE;
2849
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'ORGANIZER' ) : FALSE;
2851 2850
     $attributes = $this->_createParams( $this->organizer['params']
2852
-                                      , array( 'CN', 'DIR', 'LANGUAGE', 'SENT-BY' ));
2851
+                                        , array( 'CN', 'DIR', 'LANGUAGE', 'SENT-BY' ));
2853 2852
     $content    = 'MAILTO:'.$this->organizer['value'];
2854 2853
     return $this->_createElement( 'ORGANIZER', $attributes, $content );
2855
-  }
2854
+    }
2856 2855
 /**
2857
- * set calendar component property organizer
2858
- *
2859
- * @author Kjell-Inge Gustafsson <[email protected]>
2860
- * @since 2.4.8 - 2008-11-04
2861
- * @param string $value
2862
- * @param array params optional
2863
- * @return bool
2864
- */
2865
-  function setOrganizer( $value, $params=FALSE ) {
2856
+     * set calendar component property organizer
2857
+     *
2858
+     * @author Kjell-Inge Gustafsson <[email protected]>
2859
+     * @since 2.4.8 - 2008-11-04
2860
+     * @param string $value
2861
+     * @param array params optional
2862
+     * @return bool
2863
+     */
2864
+    function setOrganizer( $value, $params=FALSE ) {
2866 2865
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
2867 2866
     $value = str_replace ( 'MAILTO:', '', $value );
2868 2867
     $value = str_replace ( 'mailto:', '', $value );
2869 2868
     $this->organizer = array( 'value' => $value, 'params' => $this->_setParams( $params ));
2870 2869
     if( isset( $this->organizer['params']['SENT-BY'] )) {
2871
-      if( 'MAILTO' == strtoupper( substr( $this->organizer['params']['SENT-BY'], 0, 6 )))
2870
+        if( 'MAILTO' == strtoupper( substr( $this->organizer['params']['SENT-BY'], 0, 6 )))
2872 2871
         $this->organizer['params']['SENT-BY'] = substr( $this->organizer['params']['SENT-BY'], 7 );
2873 2872
     }
2874 2873
     return TRUE;
2875
-  }
2874
+    }
2876 2875
 /*********************************************************************************/
2877 2876
 /**
2878 2877
  * Property Name: PERCENT-COMPLETE
@@ -2884,27 +2883,27 @@  discard block
 block discarded – undo
2884 2883
  * @since 2.4.8 - 2008-10-22
2885 2884
  * @return string
2886 2885
  */
2887
-  function createPercentComplete() {
2886
+    function createPercentComplete() {
2888 2887
     if( empty( $this->percentcomplete )) return FALSE;
2889 2888
     if( empty( $this->percentcomplete['value'] ))
2890
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'PERCENT-COMPLETE' ) : FALSE;
2889
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'PERCENT-COMPLETE' ) : FALSE;
2891 2890
     $attributes = $this->_createParams( $this->percentcomplete['params'] );
2892 2891
     return $this->_createElement( 'PERCENT-COMPLETE', $attributes, $this->percentcomplete['value'] );
2893
-  }
2892
+    }
2894 2893
 /**
2895
- * set calendar component property percent-complete
2896
- *
2897
- * @author Kjell-Inge Gustafsson <[email protected]>
2898
- * @since 2.4.8 - 2008-11-04
2899
- * @param int $value
2900
- * @param array $params optional
2901
- * @return bool
2902
- */
2903
-  function setPercentComplete( $value, $params=FALSE ) {
2894
+     * set calendar component property percent-complete
2895
+     *
2896
+     * @author Kjell-Inge Gustafsson <[email protected]>
2897
+     * @since 2.4.8 - 2008-11-04
2898
+     * @param int $value
2899
+     * @param array $params optional
2900
+     * @return bool
2901
+     */
2902
+    function setPercentComplete( $value, $params=FALSE ) {
2904 2903
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
2905 2904
     $this->percentcomplete = array( 'value' => $value, 'params' => $this->_setParams( $params ));
2906 2905
     return TRUE;
2907
-  }
2906
+    }
2908 2907
 /*********************************************************************************/
2909 2908
 /**
2910 2909
  * Property Name: PRIORITY
@@ -2916,27 +2915,27 @@  discard block
 block discarded – undo
2916 2915
  * @since 2.4.8 - 2008-10-21
2917 2916
  * @return string
2918 2917
  */
2919
-  function createPriority() {
2918
+    function createPriority() {
2920 2919
     if( empty( $this->priority )) return FALSE;
2921 2920
     if( empty( $this->priority['value'] ))
2922
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'PRIORITY' ) : FALSE;
2921
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'PRIORITY' ) : FALSE;
2923 2922
     $attributes = $this->_createParams( $this->priority['params'] );
2924 2923
     return $this->_createElement( 'PRIORITY', $attributes, $this->priority['value'] );
2925
-  }
2924
+    }
2926 2925
 /**
2927
- * set calendar component property priority
2928
- *
2929
- * @author Kjell-Inge Gustafsson <[email protected]>
2930
- * @since 2.4.8 - 2008-11-04
2931
- * @param int $value
2932
- * @param array $params optional
2933
- * @return bool
2934
- */
2935
-  function setPriority( $value, $params=FALSE  ) {
2926
+     * set calendar component property priority
2927
+     *
2928
+     * @author Kjell-Inge Gustafsson <[email protected]>
2929
+     * @since 2.4.8 - 2008-11-04
2930
+     * @param int $value
2931
+     * @param array $params optional
2932
+     * @return bool
2933
+     */
2934
+    function setPriority( $value, $params=FALSE  ) {
2936 2935
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
2937 2936
     $this->priority = array( 'value' => $value, 'params' => $this->_setParams( $params ));
2938 2937
     return TRUE;
2939
-  }
2938
+    }
2940 2939
 /*********************************************************************************/
2941 2940
 /**
2942 2941
  * Property Name: RDATE
@@ -2948,118 +2947,118 @@  discard block
 block discarded – undo
2948 2947
  * @since 2.4.16 - 2008-10-26
2949 2948
  * @return string
2950 2949
  */
2951
-  function createRdate() {
2950
+    function createRdate() {
2952 2951
     if( empty( $this->rdate )) return FALSE;
2953 2952
     $utctime = ( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' ))) ? TRUE : FALSE;
2954 2953
     $output = null;
2955 2954
     if( $utctime  )
2956
-      unset( $this->rdate['params']['TZID'] );
2955
+        unset( $this->rdate['params']['TZID'] );
2957 2956
     foreach( $this->rdate as $theRdate ) {
2958
-      if( empty( $theRdate['value'] )) {
2957
+        if( empty( $theRdate['value'] )) {
2959 2958
         if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'RDATE' );
2960 2959
         continue;
2961
-      }
2962
-      if( $utctime  )
2960
+        }
2961
+        if( $utctime  )
2963 2962
         unset( $theRdate['params']['TZID'] );
2964
-      $attributes = $this->_createParams( $theRdate['params'] );
2965
-      $cnt = count( $theRdate['value'] );
2966
-      $content = null;
2967
-      $rno = 1;
2968
-      foreach( $theRdate['value'] as $rpix => $rdatePart ) {
2963
+        $attributes = $this->_createParams( $theRdate['params'] );
2964
+        $cnt = count( $theRdate['value'] );
2965
+        $content = null;
2966
+        $rno = 1;
2967
+        foreach( $theRdate['value'] as $rpix => $rdatePart ) {
2969 2968
         $contentPart = null;
2970 2969
         if( is_array( $rdatePart ) &&
2971 2970
             isset( $theRdate['params']['VALUE'] ) && ( 'PERIOD' == $theRdate['params']['VALUE'] )) { // PERIOD
2972
-          if( $utctime )
2971
+            if( $utctime )
2973 2972
             unset( $rdatePart[0]['tz'] );
2974
-          $formatted = $this->_format_date_time( $rdatePart[0]); // PERIOD part 1
2975
-          if( $utctime || !empty( $theRdate['params']['TZID'] ))
2973
+            $formatted = $this->_format_date_time( $rdatePart[0]); // PERIOD part 1
2974
+            if( $utctime || !empty( $theRdate['params']['TZID'] ))
2976 2975
             $formatted = str_replace( 'Z', '', $formatted);
2977
-          if( 0 < $rpix ) {
2976
+            if( 0 < $rpix ) {
2978 2977
             if( !empty( $rdatePart[0]['tz'] ) && $this->_isOffset( $rdatePart[0]['tz'] )) {
2979
-              if( 'Z' != substr( $formatted, -1 )) $formatted .= 'Z';
2978
+                if( 'Z' != substr( $formatted, -1 )) $formatted .= 'Z';
2980 2979
             }
2981 2980
             else
2982
-              $formatted = str_replace( 'Z', '', $formatted );
2983
-          }
2984
-          $contentPart .= $formatted;
2985
-          $contentPart .= '/';
2986
-          $cnt2 = count( $rdatePart[1]);
2987
-          if( array_key_exists( 'year', $rdatePart[1] )) {
2981
+                $formatted = str_replace( 'Z', '', $formatted );
2982
+            }
2983
+            $contentPart .= $formatted;
2984
+            $contentPart .= '/';
2985
+            $cnt2 = count( $rdatePart[1]);
2986
+            if( array_key_exists( 'year', $rdatePart[1] )) {
2988 2987
             if( array_key_exists( 'hour', $rdatePart[1] ))
2989
-              $cnt2 = 7;                                      // date-time
2988
+                $cnt2 = 7;                                      // date-time
2990 2989
             else
2991
-              $cnt2 = 3;                                      // date
2992
-          }
2993
-          elseif( array_key_exists( 'week', $rdatePart[1] ))  // duration
2990
+                $cnt2 = 3;                                      // date
2991
+            }
2992
+            elseif( array_key_exists( 'week', $rdatePart[1] ))  // duration
2994 2993
             $cnt2 = 5;
2995
-          if(( 7 == $cnt2 )   &&    // period=  -> date-time
2994
+            if(( 7 == $cnt2 )   &&    // period=  -> date-time
2996 2995
               isset( $rdatePart[1]['year'] )  &&
2997 2996
               isset( $rdatePart[1]['month'] ) &&
2998 2997
               isset( $rdatePart[1]['day'] )) {
2999 2998
             if( $utctime )
3000
-              unset( $rdatePart[1]['tz'] );
2999
+                unset( $rdatePart[1]['tz'] );
3001 3000
             $formatted = $this->_format_date_time( $rdatePart[1] ); // PERIOD part 2
3002 3001
             if( $utctime || !empty( $theRdate['params']['TZID'] ))
3003
-              $formatted = str_replace( 'Z', '', $formatted);
3002
+                $formatted = str_replace( 'Z', '', $formatted);
3004 3003
             if( !empty( $rdatePart[0]['tz'] ) && $this->_isOffset( $rdatePart[0]['tz'] )) {
3005
-              if( 'Z' != substr( $formatted, -1 )) $formatted .= 'Z';
3004
+                if( 'Z' != substr( $formatted, -1 )) $formatted .= 'Z';
3006 3005
             }
3007 3006
             else
3008
-              $formatted = str_replace( 'Z', '', $formatted );
3009
-           $contentPart .= $formatted;
3010
-          }
3011
-          else {                                  // period=  -> dur-time
3007
+                $formatted = str_replace( 'Z', '', $formatted );
3008
+            $contentPart .= $formatted;
3009
+            }
3010
+            else {                                  // period=  -> dur-time
3012 3011
             $contentPart .= $this->_format_duration( $rdatePart[1] );
3013
-          }
3012
+            }
3014 3013
         } // PERIOD end
3015 3014
         else { // SINGLE date start
3016
-          if( $utctime )
3015
+            if( $utctime )
3017 3016
             unset( $rdatePart['tz'] );
3018
-          $formatted = $this->_format_date_time( $rdatePart);
3019
-          if( $utctime || !empty( $theRdate['params']['TZID'] ))
3017
+            $formatted = $this->_format_date_time( $rdatePart);
3018
+            if( $utctime || !empty( $theRdate['params']['TZID'] ))
3020 3019
             $formatted = str_replace( 'Z', '', $formatted);
3021
-          if( !$utctime && ( 0 < $rpix )) {
3020
+            if( !$utctime && ( 0 < $rpix )) {
3022 3021
             if( !empty( $theRdate['value'][0]['tz'] ) && $this->_isOffset( $theRdate['value'][0]['tz'] )) {
3023
-              if( 'Z' != substr( $formatted, -1 ))
3022
+                if( 'Z' != substr( $formatted, -1 ))
3024 3023
                 $formatted .= 'Z';
3025 3024
             }
3026 3025
             else
3027
-              $formatted = str_replace( 'Z', '', $formatted );
3028
-          }
3029
-          $contentPart .= $formatted;
3026
+                $formatted = str_replace( 'Z', '', $formatted );
3027
+            }
3028
+            $contentPart .= $formatted;
3030 3029
         }
3031 3030
         $content .= $contentPart;
3032 3031
         if( $rno < $cnt )
3033
-          $content .= ',';
3032
+            $content .= ',';
3034 3033
         $rno++;
3035
-      }
3036
-      $output    .= $this->_createElement( 'RDATE', $attributes, $content );
3034
+        }
3035
+        $output    .= $this->_createElement( 'RDATE', $attributes, $content );
3037 3036
     }
3038 3037
     return $output;
3039
-  }
3038
+    }
3040 3039
 /**
3041
- * set calendar component property rdate
3042
- *
3043
- * @author Kjell-Inge Gustafsson <[email protected]>
3044
- * @since 2.5.1 - 2008-11-07
3045
- * @param array $rdates
3046
- * @param array $params, optional
3047
- * @param integer $index, optional
3048
- * @return bool
3049
- */
3050
-  function setRdate( $rdates, $params=FALSE, $index=FALSE ) {
3040
+     * set calendar component property rdate
3041
+     *
3042
+     * @author Kjell-Inge Gustafsson <[email protected]>
3043
+     * @since 2.5.1 - 2008-11-07
3044
+     * @param array $rdates
3045
+     * @param array $params, optional
3046
+     * @param integer $index, optional
3047
+     * @return bool
3048
+     */
3049
+    function setRdate( $rdates, $params=FALSE, $index=FALSE ) {
3051 3050
     if( empty( $rdates )) {
3052
-      if( $this->getConfig( 'allowEmpty' )) {
3051
+        if( $this->getConfig( 'allowEmpty' )) {
3053 3052
         $this->_setMval( $this->rdate, null, $params, FALSE, $index );
3054 3053
         return TRUE;
3055
-      }
3056
-      else
3054
+        }
3055
+        else
3057 3056
         return FALSE;
3058 3057
     }
3059 3058
     $input = array( 'params' => $this->_setParams( $params, array( 'VALUE' => 'DATE-TIME' )));
3060 3059
     if( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' ))) {
3061
-      unset( $input['params']['TZID'] );
3062
-      $input['params']['VALUE'] = 'DATE-TIME';
3060
+        unset( $input['params']['TZID'] );
3061
+        $input['params']['VALUE'] = 'DATE-TIME';
3063 3062
     }
3064 3063
             /*  check if PERIOD, if not set */
3065 3064
     if((!isset( $input['params']['VALUE'] ) || !in_array( $input['params']['VALUE'], array( 'DATE', 'PERIOD' ))) &&
@@ -3069,73 +3068,73 @@  discard block
 block discarded – undo
3069 3068
                                       $this->_isArrayDate( $rdates[0][0] ))) ||
3070 3069
                                     ( is_string( $rdates[0][0] ) && ( 8 <= strlen( trim( $rdates[0][0] )))))  &&
3071 3070
      ( is_array( $rdates[0][1] ) || ( is_string( $rdates[0][1] ) && ( 3 <= strlen( trim( $rdates[0][1] ))))))
3072
-      $input['params']['VALUE'] = 'PERIOD';
3071
+        $input['params']['VALUE'] = 'PERIOD';
3073 3072
             /* check 1:st date, upd. $parno (opt) and save ev. timezone **/
3074 3073
     $date  = reset( $rdates );
3075 3074
     if( isset( $input['params']['VALUE'] ) && ( 'PERIOD' == $input['params']['VALUE'] )) // PERIOD
3076
-      $date  = reset( $date );
3075
+        $date  = reset( $date );
3077 3076
     $this->_chkdatecfg( $date, $parno, $input['params'] );
3078 3077
     if( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' )))
3079
-      unset( $input['params']['TZID'] );
3078
+        unset( $input['params']['TZID'] );
3080 3079
     $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME' ); // remove default
3081 3080
     foreach( $rdates as $rpix => $theRdate ) {
3082
-      $inputa = null;
3083
-      if( is_array( $theRdate )) {
3081
+        $inputa = null;
3082
+        if( is_array( $theRdate )) {
3084 3083
         if( isset( $input['params']['VALUE'] ) && ( 'PERIOD' == $input['params']['VALUE'] )) { // PERIOD
3085
-          foreach( $theRdate as $rix => $rPeriod ) {
3084
+            foreach( $theRdate as $rix => $rPeriod ) {
3086 3085
             if( is_array( $rPeriod )) {
3087
-              if( $this->_isArrayTimestampDate( $rPeriod ))      // timestamp
3086
+                if( $this->_isArrayTimestampDate( $rPeriod ))      // timestamp
3088 3087
                 $inputab  = ( isset( $rPeriod['tz'] )) ? $this->_timestamp2date( $rPeriod, $parno ) : $this->_timestamp2date( $rPeriod, 6 );
3089
-              elseif( $this->_isArrayDate( $rPeriod ))
3088
+                elseif( $this->_isArrayDate( $rPeriod ))
3090 3089
                 $inputab  = ( 3 < count ( $rPeriod )) ? $this->_date_time_array( $rPeriod, $parno ) : $this->_date_time_array( $rPeriod, 6 );
3091
-              elseif (( 1 == count( $rPeriod )) && ( 8 <= strlen( reset( $rPeriod ))))  // text-date
3090
+                elseif (( 1 == count( $rPeriod )) && ( 8 <= strlen( reset( $rPeriod ))))  // text-date
3092 3091
                 $inputab  = $this->_date_time_string( reset( $rPeriod ), $parno );
3093
-              else                                               // array format duration
3092
+                else                                               // array format duration
3094 3093
                 $inputab  = $this->_duration_array( $rPeriod );
3095 3094
             }
3096 3095
             elseif(( 3 <= strlen( trim( $rPeriod ))) &&          // string format duration
3097 3096
                    ( in_array( $rPeriod{0}, array( 'P', '+', '-' )))) {
3098
-              if( 'P' != $rPeriod{0} )
3097
+                if( 'P' != $rPeriod{0} )
3099 3098
                 $rPeriod  = substr( $rPeriod, 1 );
3100
-              $inputab    = $this->_duration_string( $rPeriod );
3099
+                $inputab    = $this->_duration_string( $rPeriod );
3101 3100
             }
3102 3101
             elseif( 8 <= strlen( trim( $rPeriod )))              // text date ex. 2006-08-03 10:12:18
3103
-              $inputab    = $this->_date_time_string( $rPeriod, $parno );
3102
+                $inputab    = $this->_date_time_string( $rPeriod, $parno );
3104 3103
             if(  isset( $input['params']['TZID'] ) ||
3105 3104
                ( isset( $inputab['tz'] )   && !$this->_isOffset( $inputab['tz'] )) ||
3106 3105
                ( isset( $inputa[0] )       && ( !isset( $inputa[0]['tz'] )))       ||
3107 3106
                ( isset( $inputa[0]['tz'] ) && !$this->_isOffset( $inputa[0]['tz'] )))
3108
-              unset( $inputab['tz'] );
3107
+                unset( $inputab['tz'] );
3109 3108
             $inputa[]     = $inputab;
3110
-          }
3109
+            }
3111 3110
         } // PERIOD end
3112 3111
         elseif ( $this->_isArrayTimestampDate( $theRdate ))      // timestamp
3113
-          $inputa = $this->_timestamp2date( $theRdate, $parno );
3112
+            $inputa = $this->_timestamp2date( $theRdate, $parno );
3114 3113
         else                                                     // date[-time]
3115
-          $inputa = $this->_date_time_array( $theRdate, $parno );
3116
-      }
3117
-      elseif( 8 <= strlen( trim( $theRdate )))                   // text date ex. 2006-08-03 10:12:18
3114
+            $inputa = $this->_date_time_array( $theRdate, $parno );
3115
+        }
3116
+        elseif( 8 <= strlen( trim( $theRdate )))                   // text date ex. 2006-08-03 10:12:18
3118 3117
         $inputa       = $this->_date_time_string( $theRdate, $parno );
3119
-      if( !isset( $input['params']['VALUE'] ) || ( 'PERIOD' != $input['params']['VALUE'] )) { // no PERIOD
3118
+        if( !isset( $input['params']['VALUE'] ) || ( 'PERIOD' != $input['params']['VALUE'] )) { // no PERIOD
3120 3119
         if( 3 == $parno )
3121
-          unset( $inputa['hour'], $inputa['min'], $inputa['sec'], $inputa['tz'] );
3120
+            unset( $inputa['hour'], $inputa['min'], $inputa['sec'], $inputa['tz'] );
3122 3121
         elseif( isset( $inputa['tz'] ))
3123
-          $inputa['tz'] = (string) $inputa['tz'];
3122
+            $inputa['tz'] = (string) $inputa['tz'];
3124 3123
         if(  isset( $input['params']['TZID'] ) ||
3125 3124
            ( isset( $inputa['tz'] )            && !$this->_isOffset( $inputa['tz'] ))     ||
3126 3125
            ( isset( $input['value'][0] )       && ( !isset( $input['value'][0]['tz'] )))  ||
3127 3126
            ( isset( $input['value'][0]['tz'] ) && !$this->_isOffset( $input['value'][0]['tz'] )))
3128
-          unset( $inputa['tz'] );
3129
-      }
3130
-      $input['value'][] = $inputa;
3127
+            unset( $inputa['tz'] );
3128
+        }
3129
+        $input['value'][] = $inputa;
3131 3130
     }
3132 3131
     if( 3 == $parno ) {
3133
-      $input['params']['VALUE'] = 'DATE';
3134
-      unset( $input['params']['TZID'] );
3132
+        $input['params']['VALUE'] = 'DATE';
3133
+        unset( $input['params']['TZID'] );
3135 3134
     }
3136 3135
     $this->_setMval( $this->rdate, $input['value'], $input['params'], FALSE, $index );
3137 3136
     return TRUE;
3138
-  }
3137
+    }
3139 3138
 /*********************************************************************************/
3140 3139
 /**
3141 3140
  * Property Name: RECURRENCE-ID
@@ -3147,40 +3146,40 @@  discard block
 block discarded – undo
3147 3146
  * @since 2.4.8 - 2008-10-21
3148 3147
  * @return string
3149 3148
  */
3150
-  function createRecurrenceid() {
3149
+    function createRecurrenceid() {
3151 3150
     if( empty( $this->recurrenceid )) return FALSE;
3152 3151
     if( empty( $this->recurrenceid['value'] ))
3153
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'RECURRENCE-ID' ) : FALSE;
3152
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'RECURRENCE-ID' ) : FALSE;
3154 3153
     $formatted  = $this->_format_date_time( $this->recurrenceid['value'] );
3155 3154
     $attributes = $this->_createParams( $this->recurrenceid['params'] );
3156 3155
     return $this->_createElement( 'RECURRENCE-ID', $attributes, $formatted );
3157
-  }
3156
+    }
3158 3157
 /**
3159
- * set calendar component property recurrence-id
3160
- *
3161
- * @author Kjell-Inge Gustafsson <[email protected]>
3162
- * @since 2.4.8 - 2008-10-23
3163
- * @param mixed $year
3164
- * @param mixed $month optional
3165
- * @param int $day optional
3166
- * @param int $hour optional
3167
- * @param int $min optional
3168
- * @param int $sec optional
3169
- * @param array $params optional
3170
- * @return bool
3171
- */
3172
-  function setRecurrenceid( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
3158
+     * set calendar component property recurrence-id
3159
+     *
3160
+     * @author Kjell-Inge Gustafsson <[email protected]>
3161
+     * @since 2.4.8 - 2008-10-23
3162
+     * @param mixed $year
3163
+     * @param mixed $month optional
3164
+     * @param int $day optional
3165
+     * @param int $hour optional
3166
+     * @param int $min optional
3167
+     * @param int $sec optional
3168
+     * @param array $params optional
3169
+     * @return bool
3170
+     */
3171
+    function setRecurrenceid( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
3173 3172
     if( empty( $year )) {
3174
-      if( $this->getConfig( 'allowEmpty' )) {
3173
+        if( $this->getConfig( 'allowEmpty' )) {
3175 3174
         $this->recurrenceid = array( 'value' => null, 'params' => null );
3176 3175
         return TRUE;
3177
-      }
3178
-      else
3176
+        }
3177
+        else
3179 3178
         return FALSE;
3180 3179
     }
3181 3180
     $this->recurrenceid = $this->_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params );
3182 3181
     return TRUE;
3183
-  }
3182
+    }
3184 3183
 /*********************************************************************************/
3185 3184
 /**
3186 3185
  * Property Name: RELATED-TO
@@ -3192,40 +3191,40 @@  discard block
 block discarded – undo
3192 3191
  * @since 2.4.8 - 2008-10-23
3193 3192
  * @return string
3194 3193
  */
3195
-  function createRelatedTo() {
3194
+    function createRelatedTo() {
3196 3195
     if( empty( $this->relatedto )) return FALSE;
3197 3196
     $output = null;
3198 3197
     foreach( $this->relatedto as $relation ) {
3199
-      if( empty( $relation['value'] )) {
3198
+        if( empty( $relation['value'] )) {
3200 3199
         if( $this->getConfig( 'allowEmpty' )) $output.= $this->_createElement( 'RELATED-TO', $this->_createParams( $relation['params'] ));
3201 3200
         continue;
3202
-      }
3203
-      $attributes = $this->_createParams( $relation['params'] );
3204
-      $content    = ( 'xcal' != $this->format ) ? '<' : '';
3205
-      $content   .= $this->_strrep( $relation['value'] );
3206
-      $content   .= ( 'xcal' != $this->format ) ? '>' : '';
3207
-      $output    .= $this->_createElement( 'RELATED-TO', $attributes, $content );
3201
+        }
3202
+        $attributes = $this->_createParams( $relation['params'] );
3203
+        $content    = ( 'xcal' != $this->format ) ? '<' : '';
3204
+        $content   .= $this->_strrep( $relation['value'] );
3205
+        $content   .= ( 'xcal' != $this->format ) ? '>' : '';
3206
+        $output    .= $this->_createElement( 'RELATED-TO', $attributes, $content );
3208 3207
     }
3209 3208
     return $output;
3210
-  }
3209
+    }
3211 3210
 /**
3212
- * set calendar component property related-to
3213
- *
3214
- * @author Kjell-Inge Gustafsson <[email protected]>
3215
- * @since 2.5.1 - 2008-11-07
3216
- * @param float $relid
3217
- * @param array $params, optional
3218
- * @param index $index, optional
3219
- * @return bool
3220
- */
3221
-  function setRelatedTo( $value, $params=FALSE, $index=FALSE ) {
3211
+     * set calendar component property related-to
3212
+     *
3213
+     * @author Kjell-Inge Gustafsson <[email protected]>
3214
+     * @since 2.5.1 - 2008-11-07
3215
+     * @param float $relid
3216
+     * @param array $params, optional
3217
+     * @param index $index, optional
3218
+     * @return bool
3219
+     */
3220
+    function setRelatedTo( $value, $params=FALSE, $index=FALSE ) {
3222 3221
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3223 3222
     if(( '<' == substr( $value, 0, 1 )) && ( '>' == substr( $value, -1 )))
3224
-      $value = substr( $value, 1, ( strlen( $value ) - 2 ));
3223
+        $value = substr( $value, 1, ( strlen( $value ) - 2 ));
3225 3224
     $this->_existRem( $params, 'RELTYPE', 'PARENT', TRUE ); // remove default
3226 3225
     $this->_setMval( $this->relatedto, $value, $params, FALSE, $index );
3227 3226
     return TRUE;
3228
-  }
3227
+    }
3229 3228
 /*********************************************************************************/
3230 3229
 /**
3231 3230
  * Property Name: REPEAT
@@ -3237,27 +3236,27 @@  discard block
 block discarded – undo
3237 3236
  * @since 2.4.8 - 2008-10-21
3238 3237
  * @return string
3239 3238
  */
3240
-  function createRepeat() {
3239
+    function createRepeat() {
3241 3240
     if( empty( $this->repeat )) return FALSE;
3242 3241
     if( empty( $this->repeat['value'] ))
3243
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'REPEAT' ) : FALSE;
3242
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'REPEAT' ) : FALSE;
3244 3243
     $attributes = $this->_createParams( $this->repeat['params'] );
3245 3244
     return $this->_createElement( 'REPEAT', $attributes, $this->repeat['value'] );
3246
-  }
3245
+    }
3247 3246
 /**
3248
- * set calendar component property transp
3249
- *
3250
- * @author Kjell-Inge Gustafsson <[email protected]>
3251
- * @since 2.4.8 - 2008-11-04
3252
- * @param string $value
3253
- * @param array $params optional
3254
- * @return void
3255
- */
3256
-  function setRepeat( $value, $params=FALSE ) {
3247
+     * set calendar component property transp
3248
+     *
3249
+     * @author Kjell-Inge Gustafsson <[email protected]>
3250
+     * @since 2.4.8 - 2008-11-04
3251
+     * @param string $value
3252
+     * @param array $params optional
3253
+     * @return void
3254
+     */
3255
+    function setRepeat( $value, $params=FALSE ) {
3257 3256
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3258 3257
     $this->repeat = array( 'value' => $value, 'params' => $this->_setParams( $params ));
3259 3258
     return TRUE;
3260
-  }
3259
+    }
3261 3260
 /*********************************************************************************/
3262 3261
 /**
3263 3262
  * Property Name: REQUEST-STATUS
@@ -3268,43 +3267,43 @@  discard block
 block discarded – undo
3268 3267
  * @since 2.4.8 - 2008-10-23
3269 3268
  * @return string
3270 3269
  */
3271
-  function createRequestStatus() {
3270
+    function createRequestStatus() {
3272 3271
     if( empty( $this->requeststatus )) return FALSE;
3273 3272
     $output = null;
3274 3273
     foreach( $this->requeststatus as $rstat ) {
3275
-      if( empty( $rstat['value']['statcode'] )) {
3274
+        if( empty( $rstat['value']['statcode'] )) {
3276 3275
         if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'REQUEST-STATUS' );
3277 3276
         continue;
3278
-      }
3279
-      $attributes  = $this->_createParams( $rstat['params'], array( 'LANGUAGE' ));
3280
-      $content     = number_format( (float) $rstat['value']['statcode'], 2, '.', '');
3281
-      $content    .= ';'.$this->_strrep( $rstat['value']['text'] );
3282
-      if( isset( $rstat['value']['extdata'] ))
3277
+        }
3278
+        $attributes  = $this->_createParams( $rstat['params'], array( 'LANGUAGE' ));
3279
+        $content     = number_format( (float) $rstat['value']['statcode'], 2, '.', '');
3280
+        $content    .= ';'.$this->_strrep( $rstat['value']['text'] );
3281
+        if( isset( $rstat['value']['extdata'] ))
3283 3282
         $content  .= ';'.$this->_strrep( $rstat['value']['extdata'] );
3284
-      $output     .= $this->_createElement( 'REQUEST-STATUS', $attributes, $content );
3283
+        $output     .= $this->_createElement( 'REQUEST-STATUS', $attributes, $content );
3285 3284
     }
3286 3285
     return $output;
3287
-  }
3286
+    }
3288 3287
 /**
3289
- * set calendar component property request-status
3290
- *
3291
- * @author Kjell-Inge Gustafsson <[email protected]>
3292
- * @since 2.5.1 - 2008-11-05
3293
- * @param float $statcode
3294
- * @param string $text
3295
- * @param string $extdata, optional
3296
- * @param array $params, optional
3297
- * @param integer $index, optional
3298
- * @return bool
3299
- */
3300
-  function setRequestStatus( $statcode, $text, $extdata=FALSE, $params=FALSE, $index=FALSE ) {
3288
+     * set calendar component property request-status
3289
+     *
3290
+     * @author Kjell-Inge Gustafsson <[email protected]>
3291
+     * @since 2.5.1 - 2008-11-05
3292
+     * @param float $statcode
3293
+     * @param string $text
3294
+     * @param string $extdata, optional
3295
+     * @param array $params, optional
3296
+     * @param integer $index, optional
3297
+     * @return bool
3298
+     */
3299
+    function setRequestStatus( $statcode, $text, $extdata=FALSE, $params=FALSE, $index=FALSE ) {
3301 3300
     if( empty( $statcode ) || empty( $text )) if( $this->getConfig( 'allowEmpty' )) $statcode = $text = null; else return FALSE;
3302 3301
     $input              = array( 'statcode' => $statcode, 'text' => $text );
3303 3302
     if( $extdata )
3304
-      $input['extdata'] = $extdata;
3303
+        $input['extdata'] = $extdata;
3305 3304
     $this->_setMval( $this->requeststatus, $input, $params, FALSE, $index );
3306 3305
     return TRUE;
3307
-  }
3306
+    }
3308 3307
 /*********************************************************************************/
3309 3308
 /**
3310 3309
  * Property Name: RESOURCES
@@ -3316,41 +3315,41 @@  discard block
 block discarded – undo
3316 3315
  * @since 2.4.8 - 2008-10-23
3317 3316
  * @return string
3318 3317
  */
3319
-  function createResources() {
3318
+    function createResources() {
3320 3319
     if( empty( $this->resources )) return FALSE;
3321 3320
     $output = null;
3322 3321
     foreach( $this->resources as $resource ) {
3323
-      if( empty( $resource['value'] )) {
3322
+        if( empty( $resource['value'] )) {
3324 3323
         if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'RESOURCES' );
3325 3324
         continue;
3326
-      }
3327
-      $attributes  = $this->_createParams( $resource['params'], array( 'ALTREP', 'LANGUAGE' ));
3328
-      if( is_array( $resource['value'] )) {
3325
+        }
3326
+        $attributes  = $this->_createParams( $resource['params'], array( 'ALTREP', 'LANGUAGE' ));
3327
+        if( is_array( $resource['value'] )) {
3329 3328
         foreach( $resource['value'] as $rix => $resourcePart )
3330
-          $resource['value'][$rix] = $this->_strrep( $resourcePart );
3329
+            $resource['value'][$rix] = $this->_strrep( $resourcePart );
3331 3330
         $content   = implode( ',', $resource['value'] );
3332
-      }
3333
-      else
3331
+        }
3332
+        else
3334 3333
         $content   = $this->_strrep( $resource['value'] );
3335
-      $output     .= $this->_createElement( 'RESOURCES', $attributes, $content );
3334
+        $output     .= $this->_createElement( 'RESOURCES', $attributes, $content );
3336 3335
     }
3337 3336
     return $output;
3338
-  }
3337
+    }
3339 3338
 /**
3340
- * set calendar component property recources
3341
- *
3342
- * @author Kjell-Inge Gustafsson <[email protected]>
3343
- * @since 2.5.1 - 2008-11-05
3344
- * @param mixed $value
3345
- * @param array $params, optional
3346
- * @param integer $index, optional
3347
- * @return bool
3348
- */
3349
-  function setResources( $value, $params=FALSE, $index=FALSE ) {
3339
+     * set calendar component property recources
3340
+     *
3341
+     * @author Kjell-Inge Gustafsson <[email protected]>
3342
+     * @since 2.5.1 - 2008-11-05
3343
+     * @param mixed $value
3344
+     * @param array $params, optional
3345
+     * @param integer $index, optional
3346
+     * @return bool
3347
+     */
3348
+    function setResources( $value, $params=FALSE, $index=FALSE ) {
3350 3349
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3351 3350
     $this->_setMval( $this->resources, $value, $params, FALSE, $index );
3352 3351
     return TRUE;
3353
-  }
3352
+    }
3354 3353
 /*********************************************************************************/
3355 3354
 /**
3356 3355
  * Property Name: RRULE
@@ -3362,25 +3361,25 @@  discard block
 block discarded – undo
3362 3361
  * @since 2.4.8 - 2008-10-21
3363 3362
  * @return string
3364 3363
  */
3365
-  function createRrule() {
3364
+    function createRrule() {
3366 3365
     if( empty( $this->rrule )) return FALSE;
3367 3366
     return $this->_format_recur( 'RRULE', $this->rrule );
3368
-  }
3367
+    }
3369 3368
 /**
3370
- * set calendar component property rrule
3371
- *
3372
- * @author Kjell-Inge Gustafsson <[email protected]>
3373
- * @since 2.5.1 - 2008-11-05
3374
- * @param array $rruleset
3375
- * @param array $params, optional
3376
- * @param integer $index, optional
3377
- * @return void
3378
- */
3379
-  function setRrule( $rruleset, $params=FALSE, $index=FALSE ) {
3369
+     * set calendar component property rrule
3370
+     *
3371
+     * @author Kjell-Inge Gustafsson <[email protected]>
3372
+     * @since 2.5.1 - 2008-11-05
3373
+     * @param array $rruleset
3374
+     * @param array $params, optional
3375
+     * @param integer $index, optional
3376
+     * @return void
3377
+     */
3378
+    function setRrule( $rruleset, $params=FALSE, $index=FALSE ) {
3380 3379
     if( empty( $rruleset )) if( $this->getConfig( 'allowEmpty' )) $rruleset = null; else return FALSE;
3381 3380
     $this->_setMval( $this->rrule, $this->_setRexrule( $rruleset ), $params, FALSE, $index );
3382 3381
     return TRUE;
3383
-  }
3382
+    }
3384 3383
 /*********************************************************************************/
3385 3384
 /**
3386 3385
  * Property Name: SEQUENCE
@@ -3391,27 +3390,27 @@  discard block
 block discarded – undo
3391 3390
  * @since 0.9.7 - 2006-11-20
3392 3391
  * @return string
3393 3392
  */
3394
-  function createSequence() {
3393
+    function createSequence() {
3395 3394
     if( empty( $this->sequence )) return FALSE;
3396 3395
     if( empty( $this->sequence['value'] ))
3397
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'SEQUENCE' ) : FALSE;
3396
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'SEQUENCE' ) : FALSE;
3398 3397
     $attributes = $this->_createParams( $this->sequence['params'] );
3399 3398
     return $this->_createElement( 'SEQUENCE', $attributes, $this->sequence['value'] );
3400
-  }
3399
+    }
3401 3400
 /**
3402
- * set calendar component property sequence
3403
- * @author Kjell-Inge Gustafsson <[email protected]>
3404
- * @since 2.4.8 - 2008-11-04
3405
- * @param int $value optional
3406
- * @param array $params optional
3407
- * @return bool
3408
- */
3409
-  function setSequence( $value=FALSE, $params=FALSE ) {
3401
+     * set calendar component property sequence
3402
+     * @author Kjell-Inge Gustafsson <[email protected]>
3403
+     * @since 2.4.8 - 2008-11-04
3404
+     * @param int $value optional
3405
+     * @param array $params optional
3406
+     * @return bool
3407
+     */
3408
+    function setSequence( $value=FALSE, $params=FALSE ) {
3410 3409
     if( empty( $value ))
3411
-      $value = ( isset( $this->sequence['value'] ) && ( 0 < $this->sequence['value'] )) ? $this->sequence['value'] + 1 : 1;
3410
+        $value = ( isset( $this->sequence['value'] ) && ( 0 < $this->sequence['value'] )) ? $this->sequence['value'] + 1 : 1;
3412 3411
     $this->sequence = array( 'value' => $value, 'params' => $this->_setParams( $params ));
3413 3412
     return TRUE;
3414
-  }
3413
+    }
3415 3414
 /*********************************************************************************/
3416 3415
 /**
3417 3416
  * Property Name: STATUS
@@ -3423,27 +3422,27 @@  discard block
 block discarded – undo
3423 3422
  * @since 2.4.8 - 2008-10-21
3424 3423
  * @return string
3425 3424
  */
3426
-  function createStatus() {
3425
+    function createStatus() {
3427 3426
     if( empty( $this->status )) return FALSE;
3428 3427
     if( empty( $this->status['value'] ))
3429
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'STATUS' ) : FALSE;
3428
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'STATUS' ) : FALSE;
3430 3429
     $attributes = $this->_createParams( $this->status['params'] );
3431 3430
     return $this->_createElement( 'STATUS', $attributes, $this->status['value'] );
3432
-  }
3431
+    }
3433 3432
 /**
3434
- * set calendar component property status
3435
- *
3436
- * @author Kjell-Inge Gustafsson <[email protected]>
3437
- * @since 2.4.8 - 2008-11-04
3438
- * @param string $value
3439
- * @param array $params optional
3440
- * @return bool
3441
- */
3442
-  function setStatus( $value, $params=FALSE ) {
3433
+     * set calendar component property status
3434
+     *
3435
+     * @author Kjell-Inge Gustafsson <[email protected]>
3436
+     * @since 2.4.8 - 2008-11-04
3437
+     * @param string $value
3438
+     * @param array $params optional
3439
+     * @return bool
3440
+     */
3441
+    function setStatus( $value, $params=FALSE ) {
3443 3442
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3444 3443
     $this->status = array( 'value' => $value, 'params' => $this->_setParams( $params ));
3445 3444
     return TRUE;
3446
-  }
3445
+    }
3447 3446
 /*********************************************************************************/
3448 3447
 /**
3449 3448
  * Property Name: SUMMARY
@@ -3455,28 +3454,28 @@  discard block
 block discarded – undo
3455 3454
  * @since 2.4.8 - 2008-10-21
3456 3455
  * @return string
3457 3456
  */
3458
-  function createSummary() {
3457
+    function createSummary() {
3459 3458
     if( empty( $this->summary )) return FALSE;
3460 3459
     if( empty( $this->summary['value'] ))
3461
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'SUMMARY' ) : FALSE;
3460
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'SUMMARY' ) : FALSE;
3462 3461
     $attributes = $this->_createParams( $this->summary['params'], array( 'ALTREP', 'LANGUAGE' ));
3463 3462
     $content    = $this->_strrep( $this->summary['value'] );
3464 3463
     return $this->_createElement( 'SUMMARY', $attributes, $content );
3465
-  }
3464
+    }
3466 3465
 /**
3467
- * set calendar component property summary
3468
- *
3469
- * @author Kjell-Inge Gustafsson <[email protected]>
3470
- * @since 2.4.8 - 2008-11-04
3471
- * @param string $value
3472
- * @param string $params optional
3473
- * @return bool
3474
- */
3475
-  function setSummary( $value, $params=FALSE ) {
3466
+     * set calendar component property summary
3467
+     *
3468
+     * @author Kjell-Inge Gustafsson <[email protected]>
3469
+     * @since 2.4.8 - 2008-11-04
3470
+     * @param string $value
3471
+     * @param string $params optional
3472
+     * @return bool
3473
+     */
3474
+    function setSummary( $value, $params=FALSE ) {
3476 3475
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3477 3476
     $this->summary = array( 'value' => $value, 'params' => $this->_setParams( $params ));
3478 3477
     return TRUE;
3479
-  }
3478
+    }
3480 3479
 /*********************************************************************************/
3481 3480
 /**
3482 3481
  * Property Name: TRANSP
@@ -3488,27 +3487,27 @@  discard block
 block discarded – undo
3488 3487
  * @since 2.4.8 - 2008-10-21
3489 3488
  * @return string
3490 3489
  */
3491
-  function createTransp() {
3490
+    function createTransp() {
3492 3491
     if( empty( $this->transp )) return FALSE;
3493 3492
     if( empty( $this->transp['value'] ))
3494
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TRANSP' ) : FALSE;
3493
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TRANSP' ) : FALSE;
3495 3494
     $attributes = $this->_createParams( $this->transp['params'] );
3496 3495
     return $this->_createElement( 'TRANSP', $attributes, $this->transp['value'] );
3497
-  }
3496
+    }
3498 3497
 /**
3499
- * set calendar component property transp
3500
- *
3501
- * @author Kjell-Inge Gustafsson <[email protected]>
3502
- * @since 2.4.8 - 2008-11-04
3503
- * @param string $value
3504
- * @param string $params optional
3505
- * @return bool
3506
- */
3507
-  function setTransp( $value, $params=FALSE ) {
3498
+     * set calendar component property transp
3499
+     *
3500
+     * @author Kjell-Inge Gustafsson <[email protected]>
3501
+     * @since 2.4.8 - 2008-11-04
3502
+     * @param string $value
3503
+     * @param string $params optional
3504
+     * @return bool
3505
+     */
3506
+    function setTransp( $value, $params=FALSE ) {
3508 3507
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3509 3508
     $this->transp = array( 'value' => $value, 'params' => $this->_setParams( $params ));
3510 3509
     return TRUE;
3511
-  }
3510
+    }
3512 3511
 /*********************************************************************************/
3513 3512
 /**
3514 3513
  * Property Name: TRIGGER
@@ -3520,126 +3519,126 @@  discard block
 block discarded – undo
3520 3519
  * @since 2.4.16 - 2008-10-21
3521 3520
  * @return string
3522 3521
  */
3523
-  function createTrigger() {
3522
+    function createTrigger() {
3524 3523
     if( empty( $this->trigger )) return FALSE;
3525 3524
     if( empty( $this->trigger['value'] ))
3526
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TRIGGER' ) : FALSE;
3525
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TRIGGER' ) : FALSE;
3527 3526
     $content = $attributes = null;
3528 3527
     if( isset( $this->trigger['value']['year'] )   &&
3529 3528
         isset( $this->trigger['value']['month'] )  &&
3530 3529
         isset( $this->trigger['value']['day'] ))
3531
-      $content      .= $this->_format_date_time( $this->trigger['value'] );
3530
+        $content      .= $this->_format_date_time( $this->trigger['value'] );
3532 3531
     else {
3533
-      if( TRUE !== $this->trigger['value']['relatedStart'] )
3532
+        if( TRUE !== $this->trigger['value']['relatedStart'] )
3534 3533
         $attributes .= $this->intAttrDelimiter.'RELATED=END';
3535
-      if( $this->trigger['value']['before'] )
3534
+        if( $this->trigger['value']['before'] )
3536 3535
         $content    .= '-';
3537
-      $content      .= $this->_format_duration( $this->trigger['value'] );
3536
+        $content      .= $this->_format_duration( $this->trigger['value'] );
3538 3537
     }
3539 3538
     $attributes     .= $this->_createParams( $this->trigger['params'] );
3540 3539
     return $this->_createElement( 'TRIGGER', $attributes, $content );
3541
-  }
3540
+    }
3542 3541
 /**
3543
- * set calendar component property trigger
3544
- *
3545
- * @author Kjell-Inge Gustafsson <[email protected]>
3546
- * @since 2.4.16 - 2008-11-04
3547
- * @param mixed $year
3548
- * @param mixed $month optional
3549
- * @param int $day optional
3550
- * @param int $week optional
3551
- * @param int $hour optional
3552
- * @param int $min optional
3553
- * @param int $sec optional
3554
- * @param bool $relatedStart optional
3555
- * @param bool $before optional
3556
- * @param array $params optional
3557
- * @return bool
3558
- */
3559
-  function setTrigger( $year, $month=null, $day=null, $week=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $relatedStart=TRUE, $before=TRUE, $params=FALSE ) {
3542
+     * set calendar component property trigger
3543
+     *
3544
+     * @author Kjell-Inge Gustafsson <[email protected]>
3545
+     * @since 2.4.16 - 2008-11-04
3546
+     * @param mixed $year
3547
+     * @param mixed $month optional
3548
+     * @param int $day optional
3549
+     * @param int $week optional
3550
+     * @param int $hour optional
3551
+     * @param int $min optional
3552
+     * @param int $sec optional
3553
+     * @param bool $relatedStart optional
3554
+     * @param bool $before optional
3555
+     * @param array $params optional
3556
+     * @return bool
3557
+     */
3558
+    function setTrigger( $year, $month=null, $day=null, $week=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $relatedStart=TRUE, $before=TRUE, $params=FALSE ) {
3560 3559
     if( empty( $year ) && empty( $month ) && empty( $day ) && empty( $week ) && empty( $hour ) && empty( $min ) && empty( $sec ))
3561
-      if( $this->getConfig( 'allowEmpty' )) {
3560
+        if( $this->getConfig( 'allowEmpty' )) {
3562 3561
         $this->trigger = array( 'value' => null, 'params' => $this->_setParams( $params ) );
3563 3562
         return TRUE;
3564
-      }
3565
-      else
3563
+        }
3564
+        else
3566 3565
         return FALSE;
3567 3566
     if( $this->_isArrayTimestampDate( $year )) { // timestamp
3568
-      $params = $this->_setParams( $month );
3569
-      $date   = $this->_timestamp2date( $year, 7 );
3570
-      foreach( $date as $k => $v )
3567
+        $params = $this->_setParams( $month );
3568
+        $date   = $this->_timestamp2date( $year, 7 );
3569
+        foreach( $date as $k => $v )
3571 3570
         $$k = $v;
3572 3571
     }
3573 3572
     elseif( is_array( $year ) && ( is_array( $month ) || empty( $month ))) {
3574
-      $params = $this->_setParams( $month );
3575
-      if(!(array_key_exists( 'year',  $year ) &&   // exclude date-time
3573
+        $params = $this->_setParams( $month );
3574
+        if(!(array_key_exists( 'year',  $year ) &&   // exclude date-time
3576 3575
            array_key_exists( 'month', $year ) &&
3577 3576
            array_key_exists( 'day',   $year ))) {  // so this must be a duration
3578 3577
         if( isset( $params['RELATED'] ) && ( 'END' == $params['RELATED'] ))
3579
-          $relatedStart = FALSE;
3578
+            $relatedStart = FALSE;
3580 3579
         else
3581
-          $relatedStart = ( array_key_exists( 'relatedStart', $year ) && ( TRUE !== $year['relatedStart'] )) ? FALSE : TRUE;
3580
+            $relatedStart = ( array_key_exists( 'relatedStart', $year ) && ( TRUE !== $year['relatedStart'] )) ? FALSE : TRUE;
3582 3581
         $before         = ( array_key_exists( 'before', $year )       && ( TRUE !== $year['before'] ))       ? FALSE : TRUE;
3583
-      }
3584
-      $SSYY  = ( array_key_exists( 'year',  $year )) ? $year['year']  : null;
3585
-      $month = ( array_key_exists( 'month', $year )) ? $year['month'] : null;
3586
-      $day   = ( array_key_exists( 'day',   $year )) ? $year['day']   : null;
3587
-      $week  = ( array_key_exists( 'week',  $year )) ? $year['week']  : null;
3588
-      $hour  = ( array_key_exists( 'hour',  $year )) ? $year['hour']  : 0; //null;
3589
-      $min   = ( array_key_exists( 'min',   $year )) ? $year['min']   : 0; //null;
3590
-      $sec   = ( array_key_exists( 'sec',   $year )) ? $year['sec']   : 0; //null;
3591
-      $year  = $SSYY;
3582
+        }
3583
+        $SSYY  = ( array_key_exists( 'year',  $year )) ? $year['year']  : null;
3584
+        $month = ( array_key_exists( 'month', $year )) ? $year['month'] : null;
3585
+        $day   = ( array_key_exists( 'day',   $year )) ? $year['day']   : null;
3586
+        $week  = ( array_key_exists( 'week',  $year )) ? $year['week']  : null;
3587
+        $hour  = ( array_key_exists( 'hour',  $year )) ? $year['hour']  : 0; //null;
3588
+        $min   = ( array_key_exists( 'min',   $year )) ? $year['min']   : 0; //null;
3589
+        $sec   = ( array_key_exists( 'sec',   $year )) ? $year['sec']   : 0; //null;
3590
+        $year  = $SSYY;
3592 3591
     }
3593 3592
     elseif(is_string( $year ) && ( is_array( $month ) || empty( $month ))) {  // duration or date in a string
3594
-      $params = $this->_setParams( $month );
3595
-      if( in_array( $year{0}, array( 'P', '+', '-' ))) { // duration
3593
+        $params = $this->_setParams( $month );
3594
+        if( in_array( $year{0}, array( 'P', '+', '-' ))) { // duration
3596 3595
         $relatedStart = ( isset( $params['RELATED'] ) && ( 'END' == $params['RELATED'] )) ? FALSE : TRUE;
3597 3596
         $before       = ( '-'  == $year{0} ) ? TRUE : FALSE;
3598 3597
         if(     'P'  != $year{0} )
3599
-          $year       = substr( $year, 1 );
3598
+            $year       = substr( $year, 1 );
3600 3599
         $date         = $this->_duration_string( $year);
3601
-      }
3602
-      else   // date
3600
+        }
3601
+        else   // date
3603 3602
         $date    = $this->_date_time_string( $year, 7 );
3604
-      unset( $year, $month, $day );
3605
-      foreach( $date as $k => $v )
3603
+        unset( $year, $month, $day );
3604
+        foreach( $date as $k => $v )
3606 3605
         $$k = $v;
3607 3606
     }
3608 3607
     else // single values in function input parameters
3609
-      $params = $this->_setParams( $params );
3608
+        $params = $this->_setParams( $params );
3610 3609
     if( !empty( $year ) && !empty( $month ) && !empty( $day )) { // date
3611
-      $params['VALUE'] = 'DATE-TIME';
3612
-      $hour = ( $hour ) ? $hour : 0;
3613
-      $min  = ( $min  ) ? $min  : 0;
3614
-      $sec  = ( $sec  ) ? $sec  : 0;
3615
-      $this->trigger = array( 'params' => $params );
3616
-      $this->trigger['value'] = array( 'year'  => $year
3617
-                                     , 'month' => $month
3618
-                                     , 'day'   => $day
3619
-                                     , 'hour'  => $hour
3620
-                                     , 'min'   => $min
3621
-                                     , 'sec'   => $sec
3622
-                                     , 'tz'    => 'Z' );
3623
-      return TRUE;
3610
+        $params['VALUE'] = 'DATE-TIME';
3611
+        $hour = ( $hour ) ? $hour : 0;
3612
+        $min  = ( $min  ) ? $min  : 0;
3613
+        $sec  = ( $sec  ) ? $sec  : 0;
3614
+        $this->trigger = array( 'params' => $params );
3615
+        $this->trigger['value'] = array( 'year'  => $year
3616
+                                        , 'month' => $month
3617
+                                        , 'day'   => $day
3618
+                                        , 'hour'  => $hour
3619
+                                        , 'min'   => $min
3620
+                                        , 'sec'   => $sec
3621
+                                        , 'tz'    => 'Z' );
3622
+        return TRUE;
3624 3623
     }
3625 3624
     elseif(( empty( $year ) && empty( $month )) &&    // duration
3626 3625
            (!empty( $week ) || !empty( $day ) || !empty( $hour ) || !empty( $min ) || !empty( $sec ))) {
3627
-      unset( $params['RELATED'] ); // set at output creation (END only)
3628
-      unset( $params['VALUE'] );   // 'DURATION' default
3629
-      $this->trigger = array( 'params' => $params );
3630
-      $relatedStart = ( FALSE !== $relatedStart ) ? TRUE : FALSE;
3631
-      $before       = ( FALSE !== $before )       ? TRUE : FALSE;
3632
-      $this->trigger['value']  = array( 'relatedStart' => $relatedStart
3633
-                                      , 'before'       => $before );
3634
-      if( !empty( $week )) $this->trigger['value']['week'] = $week;
3635
-      if( !empty( $day  )) $this->trigger['value']['day']  = $day;
3636
-      if( !empty( $hour )) $this->trigger['value']['hour'] = $hour;
3637
-      if( !empty( $min  )) $this->trigger['value']['min']  = $min;
3638
-      if( !empty( $sec  )) $this->trigger['value']['sec']  = $sec;
3639
-      return TRUE;
3626
+        unset( $params['RELATED'] ); // set at output creation (END only)
3627
+        unset( $params['VALUE'] );   // 'DURATION' default
3628
+        $this->trigger = array( 'params' => $params );
3629
+        $relatedStart = ( FALSE !== $relatedStart ) ? TRUE : FALSE;
3630
+        $before       = ( FALSE !== $before )       ? TRUE : FALSE;
3631
+        $this->trigger['value']  = array( 'relatedStart' => $relatedStart
3632
+                                        , 'before'       => $before );
3633
+        if( !empty( $week )) $this->trigger['value']['week'] = $week;
3634
+        if( !empty( $day  )) $this->trigger['value']['day']  = $day;
3635
+        if( !empty( $hour )) $this->trigger['value']['hour'] = $hour;
3636
+        if( !empty( $min  )) $this->trigger['value']['min']  = $min;
3637
+        if( !empty( $sec  )) $this->trigger['value']['sec']  = $sec;
3638
+        return TRUE;
3640 3639
     }
3641 3640
     return FALSE;
3642
-  }
3641
+    }
3643 3642
 /*********************************************************************************/
3644 3643
 /**
3645 3644
  * Property Name: TZID
@@ -3651,27 +3650,27 @@  discard block
 block discarded – undo
3651 3650
  * @since 2.4.8 - 2008-10-21
3652 3651
  * @return string
3653 3652
  */
3654
-  function createTzid() {
3653
+    function createTzid() {
3655 3654
     if( empty( $this->tzid )) return FALSE;
3656 3655
     if( empty( $this->tzid['value'] ))
3657
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZID' ) : FALSE;
3656
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZID' ) : FALSE;
3658 3657
     $attributes = $this->_createParams( $this->tzid['params'] );
3659 3658
     return $this->_createElement( 'TZID', $attributes, $this->_strrep( $this->tzid['value'] ));
3660
-  }
3659
+    }
3661 3660
 /**
3662
- * set calendar component property tzid
3663
- *
3664
- * @author Kjell-Inge Gustafsson <[email protected]>
3665
- * @since 2.4.8 - 2008-11-04
3666
- * @param string $value
3667
- * @param array $params optional
3668
- * @return bool
3669
- */
3670
-  function setTzid( $value, $params=FALSE ) {
3661
+     * set calendar component property tzid
3662
+     *
3663
+     * @author Kjell-Inge Gustafsson <[email protected]>
3664
+     * @since 2.4.8 - 2008-11-04
3665
+     * @param string $value
3666
+     * @param array $params optional
3667
+     * @return bool
3668
+     */
3669
+    function setTzid( $value, $params=FALSE ) {
3671 3670
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3672 3671
     $this->tzid = array( 'value' => $value, 'params' => $this->_setParams( $params ));
3673 3672
     return TRUE;
3674
-  }
3673
+    }
3675 3674
 /*********************************************************************************/
3676 3675
 /**
3677 3676
  * .. .
@@ -3684,33 +3683,33 @@  discard block
 block discarded – undo
3684 3683
  * @since 2.4.8 - 2008-10-21
3685 3684
  * @return string
3686 3685
  */
3687
-  function createTzname() {
3686
+    function createTzname() {
3688 3687
     if( empty( $this->tzname )) return FALSE;
3689 3688
     $output = null;
3690 3689
     foreach( $this->tzname as $theName ) {
3691
-      if( !empty( $theName['value'] )) {
3690
+        if( !empty( $theName['value'] )) {
3692 3691
         $attributes = $this->_createParams( $theName['params'], array( 'LANGUAGE' ));
3693 3692
         $output    .= $this->_createElement( 'TZNAME', $attributes, $this->_strrep( $theName['value'] ));
3694
-      }
3695
-      elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'TZNAME' );
3693
+        }
3694
+        elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'TZNAME' );
3696 3695
     }
3697 3696
     return $output;
3698
-  }
3697
+    }
3699 3698
 /**
3700
- * set calendar component property tzname
3701
- *
3702
- * @author Kjell-Inge Gustafsson <[email protected]>
3703
- * @since 2.5.1 - 2008-11-05
3704
- * @param string $value
3705
- * @param string $params, optional
3706
- * @param integer $index, optional
3707
- * @return bool
3708
- */
3709
-  function setTzname( $value, $params=FALSE, $index=FALSE ) {
3699
+     * set calendar component property tzname
3700
+     *
3701
+     * @author Kjell-Inge Gustafsson <[email protected]>
3702
+     * @since 2.5.1 - 2008-11-05
3703
+     * @param string $value
3704
+     * @param string $params, optional
3705
+     * @param integer $index, optional
3706
+     * @return bool
3707
+     */
3708
+    function setTzname( $value, $params=FALSE, $index=FALSE ) {
3710 3709
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3711 3710
     $this->_setMval( $this->tzname, $value, $params, FALSE, $index );
3712 3711
     return TRUE;
3713
-  }
3712
+    }
3714 3713
 /*********************************************************************************/
3715 3714
 /**
3716 3715
  * Property Name: TZOFFSETFROM
@@ -3722,27 +3721,27 @@  discard block
 block discarded – undo
3722 3721
  * @since 2.4.8 - 2008-10-21
3723 3722
  * @return string
3724 3723
  */
3725
-  function createTzoffsetfrom() {
3724
+    function createTzoffsetfrom() {
3726 3725
     if( empty( $this->tzoffsetfrom )) return FALSE;
3727 3726
     if( empty( $this->tzoffsetfrom['value'] ))
3728
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZOFFSETFROM' ) : FALSE;
3727
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZOFFSETFROM' ) : FALSE;
3729 3728
     $attributes = $this->_createParams( $this->tzoffsetfrom['params'] );
3730 3729
     return $this->_createElement( 'TZOFFSETFROM', $attributes, $this->tzoffsetfrom['value'] );
3731
-  }
3730
+    }
3732 3731
 /**
3733
- * set calendar component property tzoffsetfrom
3734
- *
3735
- * @author Kjell-Inge Gustafsson <[email protected]>
3736
- * @since 2.4.8 - 2008-11-04
3737
- * @param string $value
3738
- * @param string $params optional
3739
- * @return bool
3740
- */
3741
-  function setTzoffsetfrom( $value, $params=FALSE ) {
3732
+     * set calendar component property tzoffsetfrom
3733
+     *
3734
+     * @author Kjell-Inge Gustafsson <[email protected]>
3735
+     * @since 2.4.8 - 2008-11-04
3736
+     * @param string $value
3737
+     * @param string $params optional
3738
+     * @return bool
3739
+     */
3740
+    function setTzoffsetfrom( $value, $params=FALSE ) {
3742 3741
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3743 3742
     $this->tzoffsetfrom = array( 'value' => $value, 'params' => $this->_setParams( $params ));
3744 3743
     return TRUE;
3745
-  }
3744
+    }
3746 3745
 /*********************************************************************************/
3747 3746
 /**
3748 3747
  * Property Name: TZOFFSETTO
@@ -3754,27 +3753,27 @@  discard block
 block discarded – undo
3754 3753
  * @since 2.4.8 - 2008-10-21
3755 3754
  * @return string
3756 3755
  */
3757
-  function createTzoffsetto() {
3756
+    function createTzoffsetto() {
3758 3757
     if( empty( $this->tzoffsetto )) return FALSE;
3759 3758
     if( empty( $this->tzoffsetto['value'] ))
3760
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZOFFSETTO' ) : FALSE;
3759
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZOFFSETTO' ) : FALSE;
3761 3760
     $attributes = $this->_createParams( $this->tzoffsetto['params'] );
3762 3761
     return $this->_createElement( 'TZOFFSETTO', $attributes, $this->tzoffsetto['value'] );
3763
-  }
3762
+    }
3764 3763
 /**
3765
- * set calendar component property tzoffsetto
3766
- *
3767
- * @author Kjell-Inge Gustafsson <[email protected]>
3768
- * @since 2.4.8 - 2008-11-04
3769
- * @param string $value
3770
- * @param string $params optional
3771
- * @return bool
3772
- */
3773
-  function setTzoffsetto( $value, $params=FALSE ) {
3764
+     * set calendar component property tzoffsetto
3765
+     *
3766
+     * @author Kjell-Inge Gustafsson <[email protected]>
3767
+     * @since 2.4.8 - 2008-11-04
3768
+     * @param string $value
3769
+     * @param string $params optional
3770
+     * @return bool
3771
+     */
3772
+    function setTzoffsetto( $value, $params=FALSE ) {
3774 3773
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3775 3774
     $this->tzoffsetto = array( 'value' => $value, 'params' => $this->_setParams( $params ));
3776 3775
     return TRUE;
3777
-  }
3776
+    }
3778 3777
 /*********************************************************************************/
3779 3778
 /**
3780 3779
  * Property Name: TZURL
@@ -3786,27 +3785,27 @@  discard block
 block discarded – undo
3786 3785
  * @since 2.4.8 - 2008-10-21
3787 3786
  * @return string
3788 3787
  */
3789
-  function createTzurl() {
3788
+    function createTzurl() {
3790 3789
     if( empty( $this->tzurl )) return FALSE;
3791 3790
     if( empty( $this->tzurl['value'] ))
3792
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZURL' ) : FALSE;
3791
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZURL' ) : FALSE;
3793 3792
     $attributes = $this->_createParams( $this->tzurl['params'] );
3794 3793
     return $this->_createElement( 'TZURL', $attributes, $this->tzurl['value'] );
3795
-  }
3794
+    }
3796 3795
 /**
3797
- * set calendar component property tzurl
3798
- *
3799
- * @author Kjell-Inge Gustafsson <[email protected]>
3800
- * @since 2.4.8 - 2008-11-04
3801
- * @param string $value
3802
- * @param string $params optional
3803
- * @return boll
3804
- */
3805
-  function setTzurl( $value, $params=FALSE ) {
3796
+     * set calendar component property tzurl
3797
+     *
3798
+     * @author Kjell-Inge Gustafsson <[email protected]>
3799
+     * @since 2.4.8 - 2008-11-04
3800
+     * @param string $value
3801
+     * @param string $params optional
3802
+     * @return boll
3803
+     */
3804
+    function setTzurl( $value, $params=FALSE ) {
3806 3805
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3807 3806
     $this->tzurl = array( 'value' => $value, 'params' => $this->_setParams( $params ));
3808 3807
     return TRUE;
3809
-  }
3808
+    }
3810 3809
 /*********************************************************************************/
3811 3810
 /**
3812 3811
  * Property Name: UID
@@ -3818,20 +3817,20 @@  discard block
 block discarded – undo
3818 3817
  * @since 0.9.7 - 2006-11-20
3819 3818
  * @return string
3820 3819
  */
3821
-  function createUid() {
3820
+    function createUid() {
3822 3821
     if( 0 >= count( $this->uid ))
3823
-      $this->_makeuid();
3822
+        $this->_makeuid();
3824 3823
     $attributes = $this->_createParams( $this->uid['params'] );
3825 3824
     return $this->_createElement( 'UID', $attributes, $this->uid['value'] );
3826
-  }
3825
+    }
3827 3826
 /**
3828
- * create an unique id for this calendar component object instance
3829
- *
3830
- * @author Kjell-Inge Gustafsson <[email protected]>
3831
- * @since 2.2.7 - 2007-09-04
3832
- * @return void
3833
- */
3834
-  function _makeUid() {
3827
+     * create an unique id for this calendar component object instance
3828
+     *
3829
+     * @author Kjell-Inge Gustafsson <[email protected]>
3830
+     * @since 2.2.7 - 2007-09-04
3831
+     * @return void
3832
+     */
3833
+    function _makeUid() {
3835 3834
     $date   = date('Ymd\THisT');
3836 3835
     $unique = substr(microtime(), 2, 4);
3837 3836
     $base   = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPrRsStTuUvVxXuUvVwWzZ1234567890';
@@ -3840,24 +3839,24 @@  discard block
 block discarded – undo
3840 3839
     $length = 6;
3841 3840
     $str    = null;
3842 3841
     for( $p = 0; $p < $length; $p++ )
3843
-      $unique .= $base{mt_rand( $start, $end )};
3842
+        $unique .= $base{mt_rand( $start, $end )};
3844 3843
     $this->uid = array( 'params' => null );
3845 3844
     $this->uid['value']  = $date.'-'.$unique.'@'.$this->getConfig( 'unique_id' );
3846
-  }
3845
+    }
3847 3846
 /**
3848
- * set calendar component property uid
3849
- *
3850
- * @author Kjell-Inge Gustafsson <[email protected]>
3851
- * @since 2.4.8 - 2008-11-04
3852
- * @param string $value
3853
- * @param string $params optional
3854
- * @return bool
3855
- */
3856
-  function setUid( $value, $params=FALSE ) {
3847
+     * set calendar component property uid
3848
+     *
3849
+     * @author Kjell-Inge Gustafsson <[email protected]>
3850
+     * @since 2.4.8 - 2008-11-04
3851
+     * @param string $value
3852
+     * @param string $params optional
3853
+     * @return bool
3854
+     */
3855
+    function setUid( $value, $params=FALSE ) {
3857 3856
     if( empty( $value )) return FALSE; // no allowEmpty check here !!!!
3858 3857
     $this->uid = array( 'value' => $value, 'params' => $this->_setParams( $params ));
3859 3858
     return TRUE;
3860
-  }
3859
+    }
3861 3860
 /*********************************************************************************/
3862 3861
 /**
3863 3862
  * Property Name: URL
@@ -3869,27 +3868,27 @@  discard block
 block discarded – undo
3869 3868
  * @since 2.4.8 - 2008-10-21
3870 3869
  * @return string
3871 3870
  */
3872
-  function createUrl() {
3871
+    function createUrl() {
3873 3872
     if( empty( $this->url )) return FALSE;
3874 3873
     if( empty( $this->url['value'] ))
3875
-      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'URL' ) : FALSE;
3874
+        return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'URL' ) : FALSE;
3876 3875
     $attributes = $this->_createParams( $this->url['params'] );
3877 3876
     return $this->_createElement( 'URL', $attributes, $this->url['value'] );
3878
-  }
3877
+    }
3879 3878
 /**
3880
- * set calendar component property url
3881
- *
3882
- * @author Kjell-Inge Gustafsson <[email protected]>
3883
- * @since 2.4.8 - 2008-11-04
3884
- * @param string $value
3885
- * @param string $params optional
3886
- * @return bool
3887
- */
3888
-  function setUrl( $value, $params=FALSE ) {
3879
+     * set calendar component property url
3880
+     *
3881
+     * @author Kjell-Inge Gustafsson <[email protected]>
3882
+     * @since 2.4.8 - 2008-11-04
3883
+     * @param string $value
3884
+     * @param string $params optional
3885
+     * @return bool
3886
+     */
3887
+    function setUrl( $value, $params=FALSE ) {
3889 3888
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3890 3889
     $this->url = array( 'value' => $value, 'params' => $this->_setParams( $params ));
3891 3890
     return TRUE;
3892
-  }
3891
+    }
3893 3892
 /*********************************************************************************/
3894 3893
 /**
3895 3894
  * Property Name: x-prop
@@ -3901,37 +3900,37 @@  discard block
 block discarded – undo
3901 3900
  * @since 2.4.11 - 2008-10-22
3902 3901
  * @return string
3903 3902
  */
3904
-  function createXprop() {
3903
+    function createXprop() {
3905 3904
     if( empty( $this->xprop )) return FALSE;
3906 3905
     $output = null;
3907 3906
     foreach( $this->xprop as $label => $xpropPart ) {
3908
-      if( empty( $xpropPart['value'] )) {
3907
+        if( empty( $xpropPart['value'] )) {
3909 3908
         if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( $label );
3910 3909
         continue;
3911
-      }
3912
-      $attributes = $this->_createParams( $xpropPart['params'], array( 'LANGUAGE' ));
3913
-      if( is_array( $xpropPart['value'] )) {
3910
+        }
3911
+        $attributes = $this->_createParams( $xpropPart['params'], array( 'LANGUAGE' ));
3912
+        if( is_array( $xpropPart['value'] )) {
3914 3913
         foreach( $xpropPart['value'] as $pix => $theXpart )
3915
-          $xpropPart['value'][$pix] = $this->_strrep( $theXpart );
3914
+            $xpropPart['value'][$pix] = $this->_strrep( $theXpart );
3916 3915
         $xpropPart['value']  = implode( ',', $xpropPart['value'] );
3917
-      }
3918
-      else
3916
+        }
3917
+        else
3919 3918
         $xpropPart['value'] = $this->_strrep( $xpropPart['value'] );
3920
-      $output    .= $this->_createElement( $label, $attributes, $xpropPart['value'] );
3919
+        $output    .= $this->_createElement( $label, $attributes, $xpropPart['value'] );
3921 3920
     }
3922 3921
     return $output;
3923
-  }
3922
+    }
3924 3923
 /**
3925
- * set calendar component property x-prop
3926
- *
3927
- * @author Kjell-Inge Gustafsson <[email protected]>
3928
-	* @since 2.4.11 - 2008-11-04
3929
- * @param string $label
3930
- * @param mixed $value
3931
- * @param array $params optional
3932
- * @return bool
3933
- */
3934
-  function setXprop( $label, $value, $params=FALSE ) {
3924
+     * set calendar component property x-prop
3925
+     *
3926
+     * @author Kjell-Inge Gustafsson <[email protected]>
3927
+     * @since 2.4.11 - 2008-11-04
3928
+     * @param string $label
3929
+     * @param mixed $value
3930
+     * @param array $params optional
3931
+     * @return bool
3932
+     */
3933
+    function setXprop( $label, $value, $params=FALSE ) {
3935 3934
     if( empty( $label )) return;
3936 3935
     if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
3937 3936
     $xprop           = array( 'value' => $value );
@@ -3940,7 +3939,7 @@  discard block
 block discarded – undo
3940 3939
     if( !is_array( $this->xprop )) $this->xprop = array();
3941 3940
     $this->xprop[strtoupper( $label )] = $xprop;
3942 3941
     return TRUE;
3943
-  }
3942
+    }
3944 3943
 /*********************************************************************************/
3945 3944
 /*********************************************************************************/
3946 3945
 /**
@@ -3950,10 +3949,10 @@  discard block
 block discarded – undo
3950 3949
  * @since 2.0.6 - 2006-06-20
3951 3950
  * @return string
3952 3951
  */
3953
-  function _createFormat() {
3952
+    function _createFormat() {
3954 3953
     $objectname                   = null;
3955 3954
     switch( $this->format ) {
3956
-      case 'xcal':
3955
+        case 'xcal':
3957 3956
         $objectname               = ( isset( $this->timezonetype )) ?
3958 3957
                                  strtolower( $this->timezonetype )  :  strtolower( $this->objName );
3959 3958
         $this->componentStart1    = $this->elementStart1 = '<';
@@ -3964,7 +3963,7 @@  discard block
 block discarded – undo
3964 3963
         $this->attributeDelimiter = $this->nl;
3965 3964
         $this->valueInit          = null;
3966 3965
         break;
3967
-      default:
3966
+        default:
3968 3967
         $objectname               = ( isset( $this->timezonetype )) ?
3969 3968
                                  strtoupper( $this->timezonetype )  :  strtoupper( $this->objName );
3970 3969
         $this->componentStart1    = 'BEGIN:';
@@ -3981,232 +3980,232 @@  discard block
 block discarded – undo
3981 3980
         break;
3982 3981
     }
3983 3982
     return $objectname;
3984
-  }
3983
+    }
3985 3984
 /**
3986
- * creates formatted output for calendar component property
3987
- *
3988
- * @author Kjell-Inge Gustafsson <[email protected]>
3989
- * @since 2.4.8 - 2008-10-23
3990
- * @param string $label property name
3991
- * @param string $attributes property attributes
3992
- * @param string $content property content (optional)
3993
- * @return string
3994
- */
3995
-  function _createElement( $label, $attributes=null, $content=FALSE ) {
3985
+     * creates formatted output for calendar component property
3986
+     *
3987
+     * @author Kjell-Inge Gustafsson <[email protected]>
3988
+     * @since 2.4.8 - 2008-10-23
3989
+     * @param string $label property name
3990
+     * @param string $attributes property attributes
3991
+     * @param string $content property content (optional)
3992
+     * @return string
3993
+     */
3994
+    function _createElement( $label, $attributes=null, $content=FALSE ) {
3996 3995
     $label  = $this->_formatPropertyName( $label );
3997 3996
     $output = $this->elementStart1.$label;
3998 3997
     $categoriesAttrLang = null;
3999 3998
     $attachInlineBinary = FALSE;
4000 3999
     $attachfmttype      = null;
4001 4000
     if( !empty( $attributes ))  {
4002
-      $attributes  = trim( $attributes );
4003
-      if ( 'xcal' == $this->format) {
4001
+        $attributes  = trim( $attributes );
4002
+        if ( 'xcal' == $this->format) {
4004 4003
         $attributes2 = explode( $this->intAttrDelimiter, $attributes );
4005 4004
         $attributes  = null;
4006 4005
         foreach( $attributes2 as $attribute ) {
4007
-          $attrKVarr = explode( '=', $attribute );
4008
-          if( empty( $attrKVarr[0] ))
4006
+            $attrKVarr = explode( '=', $attribute );
4007
+            if( empty( $attrKVarr[0] ))
4009 4008
             continue;
4010
-          if( !isset( $attrKVarr[1] )) {
4009
+            if( !isset( $attrKVarr[1] )) {
4011 4010
             $attrValue = $attrKVarr[0];
4012 4011
             $attrKey   = null;
4013
-          }
4014
-          elseif( 2 == count( $attrKVarr)) {
4012
+            }
4013
+            elseif( 2 == count( $attrKVarr)) {
4015 4014
             $attrKey   = strtolower( $attrKVarr[0] );
4016 4015
             $attrValue = $attrKVarr[1];
4017
-          }
4018
-          else {
4016
+            }
4017
+            else {
4019 4018
             $attrKey   = strtolower( $attrKVarr[0] );
4020 4019
             unset( $attrKVarr[0] );
4021 4020
             $attrValue = implode( '=', $attrKVarr );
4022
-          }
4023
-          if(( 'attach' == $label ) && ( in_array( $attrKey, array( 'fmttype', 'encoding', 'value' )))) {
4021
+            }
4022
+            if(( 'attach' == $label ) && ( in_array( $attrKey, array( 'fmttype', 'encoding', 'value' )))) {
4024 4023
             $attachInlineBinary = TRUE;
4025 4024
             if( 'fmttype' == $attrKey )
4026
-              $attachfmttype = $attrKey.'='.$attrValue;
4025
+                $attachfmttype = $attrKey.'='.$attrValue;
4027 4026
             continue;
4028
-          }
4029
-          elseif(( 'categories' == $label ) && ( 'language' == $attrKey ))
4027
+            }
4028
+            elseif(( 'categories' == $label ) && ( 'language' == $attrKey ))
4030 4029
             $categoriesAttrLang = $attrKey.'='.$attrValue;
4031
-          else {
4030
+            else {
4032 4031
             $attributes .= ( empty( $attributes )) ? ' ' : $this->attributeDelimiter.' ';
4033 4032
             $attributes .= ( !empty( $attrKey )) ? $attrKey.'=' : null;
4034 4033
             if(( '"' == substr( $attrValue, 0, 1 )) && ( '"' == substr( $attrValue, -1 ))) {
4035
-              $attrValue = substr( $attrValue, 1, ( strlen( $attrValue ) - 2 ));
4036
-              $attrValue = str_replace( '"', '', $attrValue );
4034
+                $attrValue = substr( $attrValue, 1, ( strlen( $attrValue ) - 2 ));
4035
+                $attrValue = str_replace( '"', '', $attrValue );
4037 4036
             }
4038 4037
             $attributes .= '"'.htmlspecialchars( $attrValue ).'"';
4039
-          }
4038
+            }
4040 4039
         }
4041
-      }
4042
-      else {
4040
+        }
4041
+        else {
4043 4042
         $attributes = str_replace( $this->intAttrDelimiter, $this->attributeDelimiter, $attributes );
4044
-      }
4043
+        }
4045 4044
     }
4046 4045
     if(((( 'attach' == $label ) && !$attachInlineBinary ) ||
4047 4046
          ( in_array( $label, array( 'tzurl', 'url' ))))      && ( 'xcal' == $this->format)) {
4048
-      $pos = strrpos($content, "/");
4049
-      $docname = ( $pos !== false) ? substr( $content, (1 - strlen( $content ) + $pos )) : $content;
4050
-      $this->xcaldecl[] = array( 'xmldecl'  => 'ENTITY'
4051
-                               , 'uri'      => $docname
4052
-                               , 'ref'      => 'SYSTEM'
4053
-                               , 'external' => $content
4054
-                               , 'type'     => 'NDATA'
4055
-                               , 'type2'    => 'BINERY' );
4056
-      $attributes .= ( empty( $attributes )) ? ' ' : $this->attributeDelimiter.' ';
4057
-      $attributes .= 'uri="'.$docname.'"';
4058
-      $content = null;
4059
-      if( 'attach' == $label ) {
4047
+        $pos = strrpos($content, "/");
4048
+        $docname = ( $pos !== false) ? substr( $content, (1 - strlen( $content ) + $pos )) : $content;
4049
+        $this->xcaldecl[] = array( 'xmldecl'  => 'ENTITY'
4050
+                                , 'uri'      => $docname
4051
+                                , 'ref'      => 'SYSTEM'
4052
+                                , 'external' => $content
4053
+                                , 'type'     => 'NDATA'
4054
+                                , 'type2'    => 'BINERY' );
4055
+        $attributes .= ( empty( $attributes )) ? ' ' : $this->attributeDelimiter.' ';
4056
+        $attributes .= 'uri="'.$docname.'"';
4057
+        $content = null;
4058
+        if( 'attach' == $label ) {
4060 4059
         $attributes = str_replace( $this->attributeDelimiter, $this->intAttrDelimiter, $attributes );
4061 4060
         $content = $this->_createElement( 'extref', $attributes, null );
4062 4061
         $attributes = null;
4063
-      }
4062
+        }
4064 4063
     }
4065 4064
     elseif(( 'attach' == $label ) && $attachInlineBinary && ( 'xcal' == $this->format)) {
4066
-      $content = $this->nl.$this->_createElement( 'b64bin', $attachfmttype, $content ); // max one attribute
4065
+        $content = $this->nl.$this->_createElement( 'b64bin', $attachfmttype, $content ); // max one attribute
4067 4066
     }
4068 4067
     $output .= $attributes;
4069 4068
     if( !$content ) {
4070
-      switch( $this->format ) {
4069
+        switch( $this->format ) {
4071 4070
         case 'xcal':
4072 4071
           $output .= ' /';
4073
-          $output .= $this->elementStart2;
4074
-          return $output;
4075
-          break;
4072
+            $output .= $this->elementStart2;
4073
+            return $output;
4074
+            break;
4076 4075
         default:
4077 4076
           $output .= $this->elementStart2.$this->valueInit;
4078
-          return $this->_size75( $output );
4079
-          break;
4080
-      }
4077
+            return $this->_size75( $output );
4078
+            break;
4079
+        }
4081 4080
     }
4082 4081
     $output .= $this->elementStart2;
4083 4082
     $output .= $this->valueInit.$content;
4084 4083
     switch( $this->format ) {
4085
-      case 'xcal':
4084
+        case 'xcal':
4086 4085
         return $output.$this->elementEnd1.$label.$this->elementEnd2;
4087 4086
         break;
4088
-      default:
4087
+        default:
4089 4088
         return $this->_size75( $output );
4090 4089
         break;
4091 4090
     }
4092
-  }
4091
+    }
4093 4092
 /**
4094
- * creates formatted output for calendar component property parameters
4095
- *
4096
- * @author Kjell-Inge Gustafsson <[email protected]>
4097
- * @since 0.9.22 - 2007-04-10
4098
- * @param array $params  optional
4099
- * @param array $ctrKeys optional
4100
- * @return string
4101
- */
4102
-  function _createParams( $params=array(), $ctrKeys=array() ) {
4093
+     * creates formatted output for calendar component property parameters
4094
+     *
4095
+     * @author Kjell-Inge Gustafsson <[email protected]>
4096
+     * @since 0.9.22 - 2007-04-10
4097
+     * @param array $params  optional
4098
+     * @param array $ctrKeys optional
4099
+     * @return string
4100
+     */
4101
+    function _createParams( $params=array(), $ctrKeys=array() ) {
4103 4102
     $attrLANG = $attr1 = $attr2 = null;
4104 4103
     $CNattrKey   = ( in_array( 'CN',       $ctrKeys )) ? TRUE : FALSE ;
4105 4104
     $LANGattrKey = ( in_array( 'LANGUAGE', $ctrKeys )) ? TRUE : FALSE ;
4106 4105
     $CNattrExist = $LANGattrExist = FALSE;
4107 4106
     if( is_array( $params )) {
4108
-      foreach( $params as $paramKey => $paramValue ) {
4107
+        foreach( $params as $paramKey => $paramValue ) {
4109 4108
         if( is_int( $paramKey ))
4110
-          $attr2            .= $this->intAttrDelimiter.$paramValue;
4109
+            $attr2            .= $this->intAttrDelimiter.$paramValue;
4111 4110
         elseif(( 'LANGUAGE' == $paramKey ) && $LANGattrKey ) {
4112
-          $attrLANG         .= $this->intAttrDelimiter."LANGUAGE=$paramValue";
4113
-          $LANGattrExist     = TRUE;
4111
+            $attrLANG         .= $this->intAttrDelimiter."LANGUAGE=$paramValue";
4112
+            $LANGattrExist     = TRUE;
4114 4113
         }
4115 4114
         elseif(( 'CN'       == $paramKey ) && $CNattrKey ) {
4116
-          $attr1             = $this->intAttrDelimiter.'CN="'.$paramValue.'"';
4117
-          $CNattrExist       = TRUE;
4115
+            $attr1             = $this->intAttrDelimiter.'CN="'.$paramValue.'"';
4116
+            $CNattrExist       = TRUE;
4118 4117
         }
4119 4118
         elseif(( 'ALTREP'   == $paramKey ) && in_array( $paramKey, $ctrKeys ))
4120
-          $attr2            .= $this->intAttrDelimiter.'ALTREP="'.$paramValue.'"';
4119
+            $attr2            .= $this->intAttrDelimiter.'ALTREP="'.$paramValue.'"';
4121 4120
         elseif(( 'DIR'      == $paramKey ) && in_array( $paramKey, $ctrKeys ))
4122
-          $attr2            .= $this->intAttrDelimiter.'DIR="'.$paramValue.'"';
4121
+            $attr2            .= $this->intAttrDelimiter.'DIR="'.$paramValue.'"';
4123 4122
         elseif(( 'SENT-BY'  == $paramKey ) && in_array( $paramKey, $ctrKeys ))
4124
-          $attr2            .= $this->intAttrDelimiter.'SENT-BY="MAILTO:'.$paramValue.'"';
4123
+            $attr2            .= $this->intAttrDelimiter.'SENT-BY="MAILTO:'.$paramValue.'"';
4125 4124
         else
4126
-          $attr2            .= $this->intAttrDelimiter."$paramKey=$paramValue";
4127
-      }
4125
+            $attr2            .= $this->intAttrDelimiter."$paramKey=$paramValue";
4126
+        }
4128 4127
     }
4129 4128
     if( !$LANGattrExist ) {
4130
-      $lang = $this->getConfig( 'language' );
4131
-      if(( $CNattrExist || $LANGattrKey ) && $lang )
4129
+        $lang = $this->getConfig( 'language' );
4130
+        if(( $CNattrExist || $LANGattrKey ) && $lang )
4132 4131
         $attrLANG .= $this->intAttrDelimiter.'LANGUAGE='.$lang;
4133 4132
     }
4134 4133
     return $attrLANG.$attr1.$attr2;
4135
-  }
4134
+    }
4136 4135
 /**
4137
- * check a date(-time) for an opt. timezone and if it is a DATE-TIME or DATE
4138
- *
4139
- * @author Kjell-Inge Gustafsson <[email protected]>
4140
- * @since 2.4.16 - 2008-10-25
4141
- * @param array $date, date to check
4142
- * @param int $parno, no of date parts (i.e. year, month.. .)
4143
- * @return array $params, property parameters
4144
- */
4145
-  function _chkdatecfg( $theDate, & $parno, & $params ) {
4136
+     * check a date(-time) for an opt. timezone and if it is a DATE-TIME or DATE
4137
+     *
4138
+     * @author Kjell-Inge Gustafsson <[email protected]>
4139
+     * @since 2.4.16 - 2008-10-25
4140
+     * @param array $date, date to check
4141
+     * @param int $parno, no of date parts (i.e. year, month.. .)
4142
+     * @return array $params, property parameters
4143
+     */
4144
+    function _chkdatecfg( $theDate, & $parno, & $params ) {
4146 4145
     if( isset( $params['TZID'] ))
4147
-      $parno = 6;
4146
+        $parno = 6;
4148 4147
     elseif( isset( $params['VALUE'] ) && ( 'DATE' == $params['VALUE'] ))
4149
-      $parno = 3;
4148
+        $parno = 3;
4150 4149
     else {
4151
-      if( isset( $params['VALUE'] ) && ( 'PERIOD' == $params['VALUE'] ))
4150
+        if( isset( $params['VALUE'] ) && ( 'PERIOD' == $params['VALUE'] ))
4152 4151
         $parno = 7;
4153
-      if( is_array( $theDate )) {
4152
+        if( is_array( $theDate )) {
4154 4153
         if( isset( $theDate['timestamp'] ))
4155
-          $tzid = ( isset( $theDate['tz'] )) ? $theDate['tz'] : null;
4154
+            $tzid = ( isset( $theDate['tz'] )) ? $theDate['tz'] : null;
4156 4155
         else
4157
-          $tzid = ( isset( $theDate['tz'] )) ? $theDate['tz'] : ( 7 == count( $theDate )) ? end( $theDate ) : null;
4156
+            $tzid = ( isset( $theDate['tz'] )) ? $theDate['tz'] : ( 7 == count( $theDate )) ? end( $theDate ) : null;
4158 4157
         if( !empty( $tzid )) {
4159
-          $parno = 7;
4160
-          if( !$this->_isOffset( $tzid ))
4158
+            $parno = 7;
4159
+            if( !$this->_isOffset( $tzid ))
4161 4160
             $params['TZID'] = $tzid; // save only timezone
4162 4161
         }
4163 4162
         elseif( !$parno && ( 3 == count( $theDate )) && 
4164 4163
           ( isset( $params['VALUE'] ) && ( 'DATE' == $params['VALUE'] )))
4165
-          $parno = 3;
4164
+            $parno = 3;
4166 4165
         else
4167
-          $parno = 6;
4168
-      }
4169
-      else { // string
4166
+            $parno = 6;
4167
+        }
4168
+        else { // string
4170 4169
         $date = trim( $theDate );
4171 4170
         if( 'Z' == substr( $date, -1 ))
4172
-          $parno = 7; // UTC DATE-TIME
4171
+            $parno = 7; // UTC DATE-TIME
4173 4172
         elseif((( 8 == strlen( $date ) && ctype_digit( $date )) || ( 11 >= strlen( $date ))) && 
4174 4173
           ( !isset( $params['VALUE'] ) || !in_array( $params['VALUE'], array( 'DATE-TIME', 'PERIOD' ))))
4175
-          $parno = 3; // DATE
4174
+            $parno = 3; // DATE
4176 4175
         $date = $this->_date_time_string( $date, $parno );
4177 4176
         if( !empty( $date['tz'] )) {
4178
-          $parno = 7;
4179
-          if( !$this->_isOffset( $date['tz'] ))
4177
+            $parno = 7;
4178
+            if( !$this->_isOffset( $date['tz'] ))
4180 4179
             $params['TZID'] = $date['tz']; // save only timezone
4181 4180
         }
4182 4181
         elseif( empty( $parno ))
4183
-          $parno = 6;
4184
-      }
4185
-      if( isset( $params['TZID'] ))
4182
+            $parno = 6;
4183
+        }
4184
+        if( isset( $params['TZID'] ))
4186 4185
         $parno = 6;
4187 4186
     }
4188
-  }
4187
+    }
4189 4188
 /**
4190
- * convert local startdate/enddate (Ymd[His]) to duration
4191
- *
4192
- * uses this component dates if missing input dates
4193
- *
4194
- * @author Kjell-Inge Gustafsson <[email protected]>
4195
- * @since 2.2.11 - 2007-11-03
4196
- * @param array $startdate, optional
4197
- * @param array $duration, optional
4198
- * @return array duration
4199
- */
4200
-  function _date2duration( $startdate=FALSE, $enddate=FALSE ) {
4189
+     * convert local startdate/enddate (Ymd[His]) to duration
4190
+     *
4191
+     * uses this component dates if missing input dates
4192
+     *
4193
+     * @author Kjell-Inge Gustafsson <[email protected]>
4194
+     * @since 2.2.11 - 2007-11-03
4195
+     * @param array $startdate, optional
4196
+     * @param array $duration, optional
4197
+     * @return array duration
4198
+     */
4199
+    function _date2duration( $startdate=FALSE, $enddate=FALSE ) {
4201 4200
     if( !$startdate || !$enddate ) {
4202
-      if(   FALSE === ( $startdate = $this->getProperty( 'dtstart' )))
4201
+        if(   FALSE === ( $startdate = $this->getProperty( 'dtstart' )))
4203 4202
         return null;
4204
-      if(   FALSE === ( $enddate   = $this->getProperty( 'dtend' )))    // vevent/vfreebusy
4203
+        if(   FALSE === ( $enddate   = $this->getProperty( 'dtend' )))    // vevent/vfreebusy
4205 4204
         if( FALSE === ( $enddate   = $this->getProperty( 'due' )))      // vtodo
4206
-          return null;
4205
+            return null;
4207 4206
     }
4208 4207
     if( !$startdate || !$enddate )
4209
-      return null;
4208
+        return null;
4210 4209
     $startWdate  = mktime( 0, 0, 0, $startdate['month'], $startdate['day'], $startdate['year'] );
4211 4210
     $endWdate    = mktime( 0, 0, 0, $enddate['month'],   $enddate['day'],   $enddate['year'] );
4212 4211
     $wduration   = $endWdate - $startWdate;
@@ -4220,137 +4219,137 @@  discard block
 block discarded – undo
4220 4219
     $dur['min']  = (int) floor( $wduration / ( 60 ));
4221 4220
     $dur['sec']  = (int)        $wduration % ( 60 );
4222 4221
     return $dur;
4223
-  }
4222
+    }
4224 4223
 /**
4225
- * convert date/datetime to timestamp
4226
- *
4227
- * @author Kjell-Inge Gustafsson <[email protected]>
4228
- * @since 2.4.8 - 2008-10-30
4229
- * @param array  $datetime  datetime/(date)
4230
- * @param string $tz        timezone
4231
- * @return timestamp
4232
- */
4233
-  function _date2timestamp( $datetime, $tz=null ) {
4224
+     * convert date/datetime to timestamp
4225
+     *
4226
+     * @author Kjell-Inge Gustafsson <[email protected]>
4227
+     * @since 2.4.8 - 2008-10-30
4228
+     * @param array  $datetime  datetime/(date)
4229
+     * @param string $tz        timezone
4230
+     * @return timestamp
4231
+     */
4232
+    function _date2timestamp( $datetime, $tz=null ) {
4234 4233
     $output = null;
4235 4234
     if( !isset( $datetime['hour'] )) $datetime['hour'] = '0';
4236 4235
     if( !isset( $datetime['min'] ))  $datetime['min']  = '0';
4237 4236
     if( !isset( $datetime['sec'] ))  $datetime['sec']  = '0';
4238 4237
     foreach( $datetime as $dkey => $dvalue ) {
4239
-      if( 'tz' != $dkey )
4238
+        if( 'tz' != $dkey )
4240 4239
         $datetime[$dkey] = (integer) $dvalue;
4241 4240
     }
4242 4241
     if( $tz )
4243
-      $datetime['tz'] = $tz;
4242
+        $datetime['tz'] = $tz;
4244 4243
     $offset = ( isset( $datetime['tz'] ) && ( '' < trim ( $datetime['tz'] ))) ? $this->_tz2offset( $datetime['tz'] ) : 0;
4245 4244
     $output = mktime( $datetime['hour'], $datetime['min'], ($datetime['sec'] + $offset), $datetime['month'], $datetime['day'], $datetime['year'] );
4246 4245
     return $output;
4247
-  }
4246
+    }
4248 4247
 /**
4249
- * ensures internal date-time/date format for input date-time/date in array format
4250
- *
4251
- * @author Kjell-Inge Gustafsson <[email protected]>
4252
- * @since 0.3.0 - 2006-08-15
4253
- * @param array $datetime
4254
- * @param int $parno optional, default FALSE
4255
- * @return array
4256
- */
4257
-  function _date_time_array( $datetime, $parno=FALSE ) {
4248
+     * ensures internal date-time/date format for input date-time/date in array format
4249
+     *
4250
+     * @author Kjell-Inge Gustafsson <[email protected]>
4251
+     * @since 0.3.0 - 2006-08-15
4252
+     * @param array $datetime
4253
+     * @param int $parno optional, default FALSE
4254
+     * @return array
4255
+     */
4256
+    function _date_time_array( $datetime, $parno=FALSE ) {
4258 4257
     $output = array();
4259 4258
     foreach( $datetime as $dateKey => $datePart ) {
4260
-      switch ( $dateKey ) {
4259
+        switch ( $dateKey ) {
4261 4260
         case '0': case 'year':   $output['year']  = $datePart; break;
4262 4261
         case '1': case 'month':  $output['month'] = $datePart; break;
4263 4262
         case '2': case 'day':    $output['day']   = $datePart; break;
4264
-      }
4265
-      if( 3 != $parno ) {
4263
+        }
4264
+        if( 3 != $parno ) {
4266 4265
         switch ( $dateKey ) {
4267
-          case '0':
4266
+            case '0':
4268 4267
           case '1':
4269 4268
           case '2': break;
4270
-          case '3': case 'hour': $output['hour']  = $datePart; break;
4271
-          case '4': case 'min' : $output['min']   = $datePart; break;
4272
-          case '5': case 'sec' : $output['sec']   = $datePart; break;
4273
-          case '6': case 'tz'  : $output['tz']    = $datePart; break;
4269
+            case '3': case 'hour': $output['hour']  = $datePart; break;
4270
+            case '4': case 'min' : $output['min']   = $datePart; break;
4271
+            case '5': case 'sec' : $output['sec']   = $datePart; break;
4272
+            case '6': case 'tz'  : $output['tz']    = $datePart; break;
4273
+        }
4274 4274
         }
4275
-      }
4276 4275
     }
4277 4276
     if( 3 != $parno ) {
4278
-      if( !isset( $output['hour'] ))
4277
+        if( !isset( $output['hour'] ))
4279 4278
         $output['hour'] = 0;
4280
-      if( !isset( $output['min']  ))
4279
+        if( !isset( $output['min']  ))
4281 4280
         $output['min'] = 0;
4282
-      if( !isset( $output['sec']  ))
4281
+        if( !isset( $output['sec']  ))
4283 4282
         $output['sec'] = 0;
4284 4283
     }
4285 4284
     return $output;
4286
-  }
4285
+    }
4287 4286
 /**
4288
- * ensures internal date-time/date format for input date-time/date in string fromat
4289
- *
4290
- * @author Kjell-Inge Gustafsson <[email protected]>
4291
- * @since 2.2.10 - 2007-10-19
4292
- * @param array $datetime
4293
- * @param int $parno optional, default FALSE
4294
- * @return array
4295
- */
4296
-  function _date_time_string( $datetime, $parno=FALSE ) {
4287
+     * ensures internal date-time/date format for input date-time/date in string fromat
4288
+     *
4289
+     * @author Kjell-Inge Gustafsson <[email protected]>
4290
+     * @since 2.2.10 - 2007-10-19
4291
+     * @param array $datetime
4292
+     * @param int $parno optional, default FALSE
4293
+     * @return array
4294
+     */
4295
+    function _date_time_string( $datetime, $parno=FALSE ) {
4297 4296
     $datetime = (string) trim( $datetime );
4298 4297
     $tz  = null;
4299 4298
     $len = strlen( $datetime ) - 1;
4300 4299
     if( 'Z' == substr( $datetime, -1 )) {
4301
-      $tz = 'Z';
4302
-      $datetime = trim( substr( $datetime, 0, $len ));
4300
+        $tz = 'Z';
4301
+        $datetime = trim( substr( $datetime, 0, $len ));
4303 4302
     }
4304 4303
     elseif( ( ctype_digit( substr( $datetime, -2, 2 ))) && // time or date
4305 4304
                   ( '-' == substr( $datetime, -3, 1 )) ||
4306 4305
                   ( ':' == substr( $datetime, -3, 1 )) ||
4307 4306
                   ( '.' == substr( $datetime, -3, 1 ))) {
4308
-      $continue = TRUE;
4307
+        $continue = TRUE;
4309 4308
     }
4310 4309
     elseif( ( ctype_digit( substr( $datetime, -4, 4 ))) && // 4 pos offset
4311 4310
             ( ' +' == substr( $datetime, -6, 2 )) ||
4312 4311
             ( ' -' == substr( $datetime, -6, 2 ))) {
4313
-      $tz = substr( $datetime, -5, 5 );
4314
-      $datetime = substr( $datetime, 0, ($len - 5));
4312
+        $tz = substr( $datetime, -5, 5 );
4313
+        $datetime = substr( $datetime, 0, ($len - 5));
4315 4314
     }
4316 4315
     elseif( ( ctype_digit( substr( $datetime, -6, 6 ))) && // 6 pos offset
4317 4316
             ( ' +' == substr( $datetime, -8, 2 )) ||
4318 4317
             ( ' -' == substr( $datetime, -8, 2 ))) {
4319
-      $tz = substr( $datetime, -7, 7 );
4320
-      $datetime = substr( $datetime, 0, ($len - 7));
4318
+        $tz = substr( $datetime, -7, 7 );
4319
+        $datetime = substr( $datetime, 0, ($len - 7));
4321 4320
     }
4322 4321
     elseif( ( 6 < $len ) && ( ctype_digit( substr( $datetime, -6, 6 )))) {
4323
-      $continue = TRUE;
4322
+        $continue = TRUE;
4324 4323
     }
4325 4324
     elseif( 'T' ==  substr( $datetime, -7, 1 )) {
4326
-      $continue = TRUE;
4325
+        $continue = TRUE;
4327 4326
     }
4328 4327
     else {
4329
-      $cx  = $tx = 0;    //  19970415T133000 US-Eastern
4330
-      for( $cx = -1; $cx > ( 9 - $len ); $cx-- ) {
4328
+        $cx  = $tx = 0;    //  19970415T133000 US-Eastern
4329
+        for( $cx = -1; $cx > ( 9 - $len ); $cx-- ) {
4331 4330
         if(( ' ' == substr( $datetime, $cx, 1 )) || ctype_digit( substr( $datetime, $cx, 1 )))
4332
-          break; // if exists, tz ends here.. . ?
4331
+            break; // if exists, tz ends here.. . ?
4333 4332
         elseif( ctype_alpha( substr( $datetime, $cx, 1 )) ||
4334 4333
              ( in_array( substr( $datetime, $cx, 1 ), array( '-', '/' ))))
4335
-          $tx--; // tz length counter
4336
-      }
4337
-      if( 0 > $tx ) {
4334
+            $tx--; // tz length counter
4335
+        }
4336
+        if( 0 > $tx ) {
4338 4337
         $tz = substr( $datetime, $tx );
4339 4338
         $datetime = trim( substr( $datetime, 0, $len + $tx + 1 ));
4340
-      }
4339
+        }
4341 4340
     }
4342 4341
     if( 0 < substr_count( $datetime, '-' )) {
4343
-      $datetime = str_replace( '-', '/', $datetime );
4342
+        $datetime = str_replace( '-', '/', $datetime );
4344 4343
     }
4345 4344
     elseif( ctype_digit( substr( $datetime, 0, 8 )) &&
4346 4345
            ( 'T' ==      substr( $datetime, 8, 1 )) &&
4347 4346
             ctype_digit( substr( $datetime, 9, 6 ))) {
4348
-      $datetime = substr( $datetime,  4, 2 )
4349
-             .'/'.substr( $datetime,  6, 2 )
4350
-             .'/'.substr( $datetime,  0, 4 )
4351
-             .' '.substr( $datetime,  9, 2 )
4352
-             .':'.substr( $datetime, 11, 2 )
4353
-             .':'.substr( $datetime, 13);
4347
+        $datetime = substr( $datetime,  4, 2 )
4348
+                .'/'.substr( $datetime,  6, 2 )
4349
+                .'/'.substr( $datetime,  0, 4 )
4350
+                .' '.substr( $datetime,  9, 2 )
4351
+                .':'.substr( $datetime, 11, 2 )
4352
+                .':'.substr( $datetime, 13);
4354 4353
     }
4355 4354
     $datestring = date( 'Y-m-d H:i:s', strtotime( $datetime ));
4356 4355
     $tz                = trim( $tz );
@@ -4359,112 +4358,112 @@  discard block
 block discarded – undo
4359 4358
     $output['month']   = substr( $datestring, 5, 2 );
4360 4359
     $output['day']     = substr( $datestring, 8, 2 );
4361 4360
     if(( 6 == $parno ) || ( 7 == $parno )) {
4362
-      $output['hour']  = substr( $datestring, 11, 2 );
4363
-      $output['min']   = substr( $datestring, 14, 2 );
4364
-      $output['sec']   = substr( $datestring, 17, 2 );
4365
-      if( !empty( $tz ))
4361
+        $output['hour']  = substr( $datestring, 11, 2 );
4362
+        $output['min']   = substr( $datestring, 14, 2 );
4363
+        $output['sec']   = substr( $datestring, 17, 2 );
4364
+        if( !empty( $tz ))
4366 4365
         $output['tz']  = $tz;
4367 4366
     }
4368 4367
     elseif( 3 != $parno ) {
4369
-      if(( '00' < substr( $datestring, 11, 2 )) ||
4368
+        if(( '00' < substr( $datestring, 11, 2 )) ||
4370 4369
          ( '00' < substr( $datestring, 14, 2 )) ||
4371 4370
          ( '00' < substr( $datestring, 17, 2 ))) {
4372 4371
         $output['hour']  = substr( $datestring, 11, 2 );
4373 4372
         $output['min']   = substr( $datestring, 14, 2 );
4374 4373
         $output['sec']   = substr( $datestring, 17, 2 );
4375
-      }
4376
-      if( !empty( $tz ))
4374
+        }
4375
+        if( !empty( $tz ))
4377 4376
         $output['tz']  = $tz;
4378 4377
     }
4379 4378
     return $output;
4380
-  }
4379
+    }
4381 4380
 /**
4382
- * ensures internal duration format for input in array format
4383
- *
4384
- * @author Kjell-Inge Gustafsson <[email protected]>
4385
- * @since 2.1.1 - 2007-06-24
4386
- * @param array $duration
4387
- * @return array
4388
- */
4389
-  function _duration_array( $duration ) {
4381
+     * ensures internal duration format for input in array format
4382
+     *
4383
+     * @author Kjell-Inge Gustafsson <[email protected]>
4384
+     * @since 2.1.1 - 2007-06-24
4385
+     * @param array $duration
4386
+     * @return array
4387
+     */
4388
+    function _duration_array( $duration ) {
4390 4389
     $output = array();
4391 4390
     if(    is_array( $duration )        &&
4392 4391
        ( 1 == count( $duration ))       &&
4393 4392
               isset( $duration['sec'] ) &&
4394 4393
               ( 60 < $duration['sec'] )) {
4395
-      $durseconds  = $duration['sec'];
4396
-      $output['week'] = floor( $durseconds / ( 60 * 60 * 24 * 7 ));
4397
-      $durseconds  =           $durseconds % ( 60 * 60 * 24 * 7 );
4398
-      $output['day']  = floor( $durseconds / ( 60 * 60 * 24 ));
4399
-      $durseconds  =           $durseconds % ( 60 * 60 * 24 );
4400
-      $output['hour'] = floor( $durseconds / ( 60 * 60 ));
4401
-      $durseconds  =           $durseconds % ( 60 * 60 );
4402
-      $output['min']  = floor( $durseconds / ( 60 ));
4403
-      $output['sec']  =      ( $durseconds % ( 60 ));
4394
+        $durseconds  = $duration['sec'];
4395
+        $output['week'] = floor( $durseconds / ( 60 * 60 * 24 * 7 ));
4396
+        $durseconds  =           $durseconds % ( 60 * 60 * 24 * 7 );
4397
+        $output['day']  = floor( $durseconds / ( 60 * 60 * 24 ));
4398
+        $durseconds  =           $durseconds % ( 60 * 60 * 24 );
4399
+        $output['hour'] = floor( $durseconds / ( 60 * 60 ));
4400
+        $durseconds  =           $durseconds % ( 60 * 60 );
4401
+        $output['min']  = floor( $durseconds / ( 60 ));
4402
+        $output['sec']  =      ( $durseconds % ( 60 ));
4404 4403
     }
4405 4404
     else {
4406
-      foreach( $duration as $durKey => $durValue ) {
4405
+        foreach( $duration as $durKey => $durValue ) {
4407 4406
         if( empty( $durValue )) continue;
4408 4407
         switch ( $durKey ) {
4409
-          case '0': case 'week': $output['week']  = $durValue; break;
4410
-          case '1': case 'day':  $output['day']   = $durValue; break;
4411
-          case '2': case 'hour': $output['hour']  = $durValue; break;
4412
-          case '3': case 'min':  $output['min']   = $durValue; break;
4413
-          case '4': case 'sec':  $output['sec']   = $durValue; break;
4408
+            case '0': case 'week': $output['week']  = $durValue; break;
4409
+            case '1': case 'day':  $output['day']   = $durValue; break;
4410
+            case '2': case 'hour': $output['hour']  = $durValue; break;
4411
+            case '3': case 'min':  $output['min']   = $durValue; break;
4412
+            case '4': case 'sec':  $output['sec']   = $durValue; break;
4413
+        }
4414 4414
         }
4415
-      }
4416 4415
     }
4417 4416
     if( isset( $output['week'] ) && ( 0 < $output['week'] )) {
4418
-      unset( $output['day'], $output['hour'], $output['min'], $output['sec'] );
4419
-      return $output;
4417
+        unset( $output['day'], $output['hour'], $output['min'], $output['sec'] );
4418
+        return $output;
4420 4419
     }
4421 4420
     unset( $output['week'] );
4422 4421
     if( empty( $output['day'] ))
4423
-      unset( $output['day'] );
4422
+        unset( $output['day'] );
4424 4423
     if ( isset( $output['hour'] ) || isset( $output['min'] ) || isset( $output['sec'] )) {
4425
-      if( !isset( $output['hour'] )) $output['hour'] = 0;
4426
-      if( !isset( $output['min']  )) $output['min']  = 0;
4427
-      if( !isset( $output['sec']  )) $output['sec']  = 0;
4428
-      if(( 0 == $output['hour'] ) && ( 0 == $output['min'] ) && ( 0 == $output['sec'] ))
4424
+        if( !isset( $output['hour'] )) $output['hour'] = 0;
4425
+        if( !isset( $output['min']  )) $output['min']  = 0;
4426
+        if( !isset( $output['sec']  )) $output['sec']  = 0;
4427
+        if(( 0 == $output['hour'] ) && ( 0 == $output['min'] ) && ( 0 == $output['sec'] ))
4429 4428
         unset( $output['hour'], $output['min'], $output['sec'] );
4430 4429
     }
4431 4430
     return $output;
4432
-  }
4431
+    }
4433 4432
 /**
4434
- * convert duration to date in array format based on input or dtstart value
4435
- *
4436
- * @author Kjell-Inge Gustafsson <[email protected]>
4437
- * @since 2.4.8 - 2008-10-30
4438
- * @param array $startdate, optional
4439
- * @param array $duration, optional
4440
- * @return array, date format
4441
- */
4442
-  function duration2date( $startdate=FALSE, $duration=FALSE ) {
4433
+     * convert duration to date in array format based on input or dtstart value
4434
+     *
4435
+     * @author Kjell-Inge Gustafsson <[email protected]>
4436
+     * @since 2.4.8 - 2008-10-30
4437
+     * @param array $startdate, optional
4438
+     * @param array $duration, optional
4439
+     * @return array, date format
4440
+     */
4441
+    function duration2date( $startdate=FALSE, $duration=FALSE ) {
4443 4442
     if( $startdate && $duration ) {
4444
-      $d1               = $startdate;
4445
-      $dur              = $duration;
4443
+        $d1               = $startdate;
4444
+        $dur              = $duration;
4446 4445
     }
4447 4446
     elseif( isset( $this->dtstart['value'] ) && isset( $this->duration['value'] )) {
4448
-      $d1               = $this->dtstart['value'];
4449
-      $dur              = $this->duration['value'];
4447
+        $d1               = $this->dtstart['value'];
4448
+        $dur              = $this->duration['value'];
4450 4449
     }
4451 4450
     else
4452
-      return null;
4451
+        return null;
4453 4452
     $dateOnly         = ( isset( $d1['hour'] ) || isset( $d1['min'] ) || isset( $d1['sec'] )) ? FALSE : TRUE;
4454 4453
     $d1['hour']       = ( isset( $d1['hour'] )) ? $d1['hour'] : 0;
4455 4454
     $d1['min']        = ( isset( $d1['min'] ))  ? $d1['min']  : 0;
4456 4455
     $d1['sec']        = ( isset( $d1['sec'] ))  ? $d1['sec']  : 0;
4457 4456
     $dtend = mktime( $d1['hour'], $d1['min'], $d1['sec'], $d1['month'], $d1['day'], $d1['year'] );
4458 4457
     if( isset( $dur['week'] ))
4459
-      $dtend += ( $dur['week'] * 7 * 24 * 60 * 60 );
4458
+        $dtend += ( $dur['week'] * 7 * 24 * 60 * 60 );
4460 4459
     if( isset( $dur['day'] ))
4461
-      $dtend += ( $dur['day'] * 24 * 60 * 60 );
4460
+        $dtend += ( $dur['day'] * 24 * 60 * 60 );
4462 4461
     if( isset( $dur['hour'] ))
4463
-      $dtend += ( $dur['hour'] * 60 *60 );
4462
+        $dtend += ( $dur['hour'] * 60 *60 );
4464 4463
     if( isset( $dur['min'] ))
4465
-      $dtend += ( $dur['min'] * 60 );
4464
+        $dtend += ( $dur['min'] * 60 );
4466 4465
     if( isset( $dur['sec'] ))
4467
-      $dtend +=   $dur['sec'];
4466
+        $dtend +=   $dur['sec'];
4468 4467
     $dtend2 = array();
4469 4468
     $dtend2['year']   = date('Y', $dtend );
4470 4469
     $dtend2['month']  = date('m', $dtend );
@@ -4473,112 +4472,112 @@  discard block
 block discarded – undo
4473 4472
     $dtend2['min']    = date('i', $dtend );
4474 4473
     $dtend2['sec']    = date('s', $dtend );
4475 4474
     if( isset( $d1['tz'] ))
4476
-      $dtend2['tz']   = $d1['tz'];
4475
+        $dtend2['tz']   = $d1['tz'];
4477 4476
     if( $dateOnly && (( 0 == $dtend2['hour'] ) && ( 0 == $dtend2['min'] ) && ( 0 == $dtend2['sec'] )))
4478
-      unset( $dtend2['hour'], $dtend2['min'], $dtend2['sec'] );
4477
+        unset( $dtend2['hour'], $dtend2['min'], $dtend2['sec'] );
4479 4478
     return $dtend2;
4480
-  }
4479
+    }
4481 4480
 /**
4482
- * ensures internal duration format for input in string format
4483
- *
4484
- * @author Kjell-Inge Gustafsson <[email protected]>
4485
- * @since 2.0.5 - 2007-03-14
4486
- * @param string $duration
4487
- * @return array
4488
- */
4489
-  function _duration_string( $duration ) {
4490
-   $duration = (string) trim( $duration );
4491
-   while( 'P' != strtoupper( substr( $duration, 0, 1 ))) {
4492
-     if( 0 < strlen( $duration ))
4493
-       $duration = substr( $duration, 1 );
4494
-     else
4495
-       return false; // no leading P !?!?
4496
-   }
4497
-   $duration = substr( $duration, 1 ); // skip P
4498
-   $duration = str_replace ( 't', 'T', $duration );
4499
-   $duration = str_replace ( 'T', '', $duration );
4500
-   $output = array();
4501
-   $val    = null;
4502
-   for( $ix=0; $ix < strlen( $duration ); $ix++ ) {
4503
-     switch( strtoupper( $duration{$ix} )) {
4504
-      case 'W':
4481
+     * ensures internal duration format for input in string format
4482
+     *
4483
+     * @author Kjell-Inge Gustafsson <[email protected]>
4484
+     * @since 2.0.5 - 2007-03-14
4485
+     * @param string $duration
4486
+     * @return array
4487
+     */
4488
+    function _duration_string( $duration ) {
4489
+    $duration = (string) trim( $duration );
4490
+    while( 'P' != strtoupper( substr( $duration, 0, 1 ))) {
4491
+        if( 0 < strlen( $duration ))
4492
+        $duration = substr( $duration, 1 );
4493
+        else
4494
+        return false; // no leading P !?!?
4495
+    }
4496
+    $duration = substr( $duration, 1 ); // skip P
4497
+    $duration = str_replace ( 't', 'T', $duration );
4498
+    $duration = str_replace ( 'T', '', $duration );
4499
+    $output = array();
4500
+    $val    = null;
4501
+    for( $ix=0; $ix < strlen( $duration ); $ix++ ) {
4502
+        switch( strtoupper( $duration{$ix} )) {
4503
+        case 'W':
4505 4504
         $output['week'] = $val;
4506 4505
         $val            = null;
4507 4506
         break;
4508
-      case 'D':
4507
+        case 'D':
4509 4508
         $output['day']  = $val;
4510 4509
         $val            = null;
4511 4510
         break;
4512
-      case 'H':
4511
+        case 'H':
4513 4512
         $output['hour'] = $val;
4514 4513
         $val            = null;
4515 4514
         break;
4516
-      case 'M':
4515
+        case 'M':
4517 4516
         $output['min']  = $val;
4518 4517
         $val            = null;
4519 4518
         break;
4520
-      case 'S':
4519
+        case 'S':
4521 4520
         $output['sec']  = $val;
4522 4521
         $val            = null;
4523 4522
         break;
4524
-      default:
4523
+        default:
4525 4524
         if( !ctype_digit( $duration{$ix} ))
4526
-          return false; // unknown duration controll character  !?!?
4525
+            return false; // unknown duration controll character  !?!?
4527 4526
         else
4528
-          $val .= $duration{$ix};
4529
-     }
4530
-   }
4531
-   return $this->_duration_array( $output );
4532
-  }
4533
-/**
4534
- * if not preSet, if exist, remove key with expected value from array and return hit value else return elseValue
4535
- *
4536
- * @author Kjell-Inge Gustafsson <[email protected]>
4537
- * @since 2.4.16 - 2008-11-08
4538
- * @param array $array
4539
- * @param string $expkey, expected key
4540
- * @param string $expval, expected value
4541
- * @param int $hitVal optional, return value if found
4542
- * @param int $elseVal optional, return value if not found
4543
- * @param int $preSet optional, return value if already preset
4544
- * @return int
4545
- */
4546
-  function _existRem( &$array, $expkey, $expval=FALSE, $hitVal=null, $elseVal=null, $preSet=null ) {
4527
+            $val .= $duration{$ix};
4528
+        }
4529
+    }
4530
+    return $this->_duration_array( $output );
4531
+    }
4532
+/**
4533
+     * if not preSet, if exist, remove key with expected value from array and return hit value else return elseValue
4534
+     *
4535
+     * @author Kjell-Inge Gustafsson <[email protected]>
4536
+     * @since 2.4.16 - 2008-11-08
4537
+     * @param array $array
4538
+     * @param string $expkey, expected key
4539
+     * @param string $expval, expected value
4540
+     * @param int $hitVal optional, return value if found
4541
+     * @param int $elseVal optional, return value if not found
4542
+     * @param int $preSet optional, return value if already preset
4543
+     * @return int
4544
+     */
4545
+    function _existRem( &$array, $expkey, $expval=FALSE, $hitVal=null, $elseVal=null, $preSet=null ) {
4547 4546
     if( $preSet )
4548
-      return $preSet;
4547
+        return $preSet;
4549 4548
     if( !is_array( $array ) || ( 0 == count( $array )))
4550
-      return $elseVal;
4549
+        return $elseVal;
4551 4550
     foreach( $array as $key => $value ) {
4552
-      if( strtoupper( $expkey ) == strtoupper( $key )) {
4551
+        if( strtoupper( $expkey ) == strtoupper( $key )) {
4553 4552
         if( !$expval || ( strtoupper( $expval ) == strtoupper( $array[$key] ))) {
4554
-          unset( $array[$key] );
4555
-          return $hitVal;
4553
+            unset( $array[$key] );
4554
+            return $hitVal;
4555
+        }
4556 4556
         }
4557
-      }
4558 4557
     }
4559 4558
     return $elseVal;
4560
-  }
4559
+    }
4561 4560
 /**
4562
- * creates formatted output for calendar component property data value type date/date-time
4563
- *
4564
- * @author Kjell-Inge Gustafsson <[email protected]>
4565
- * @since 2.4.8 - 2008-10-30
4566
- * @param array   $datetime
4567
- * @param int     $parno, optional, default 6
4568
- * @return string
4569
- */
4570
-  function _format_date_time( $datetime, $parno=6 ) {
4561
+     * creates formatted output for calendar component property data value type date/date-time
4562
+     *
4563
+     * @author Kjell-Inge Gustafsson <[email protected]>
4564
+     * @since 2.4.8 - 2008-10-30
4565
+     * @param array   $datetime
4566
+     * @param int     $parno, optional, default 6
4567
+     * @return string
4568
+     */
4569
+    function _format_date_time( $datetime, $parno=6 ) {
4571 4570
     if( !isset( $datetime['year'] )  &&
4572 4571
         !isset( $datetime['month'] ) &&
4573 4572
         !isset( $datetime['day'] )   &&
4574 4573
         !isset( $datetime['hour'] )  &&
4575 4574
         !isset( $datetime['min'] )   &&
4576 4575
         !isset( $datetime['sec'] ))
4577
-      return ;
4576
+        return ;
4578 4577
     $output = null;
4579 4578
     // 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"; }
4580 4579
     foreach( $datetime as $dkey => $dvalue ) {
4581
-      if( 'tz' != $dkey )
4580
+        if( 'tz' != $dkey )
4582 4581
         $datetime[$dkey] = (integer) $dvalue;
4583 4582
     }
4584 4583
     $output = date('Ymd', mktime( 0, 0, 0, $datetime['month'], $datetime['day'], $datetime['year']));
@@ -4586,101 +4585,101 @@  discard block
 block discarded – undo
4586 4585
         isset( $datetime['min'] )   ||
4587 4586
         isset( $datetime['sec'] )   ||
4588 4587
         isset( $datetime['tz'] )) {
4589
-      if( isset( $datetime['tz'] )  &&
4588
+        if( isset( $datetime['tz'] )  &&
4590 4589
          !isset( $datetime['hour'] ))
4591 4590
         $datetime['hour'] = 0;
4592
-      if( isset( $datetime['hour'] )  &&
4591
+        if( isset( $datetime['hour'] )  &&
4593 4592
          !isset( $datetime['min'] ))
4594 4593
         $datetime['min'] = 0;
4595
-      if( isset( $datetime['hour'] )  &&
4594
+        if( isset( $datetime['hour'] )  &&
4596 4595
           isset( $datetime['min'] )   &&
4597 4596
          !isset( $datetime['sec'] ))
4598 4597
         $datetime['sec'] = 0;
4599
-      $date = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year']);
4600
-      $output .= date('\THis', $date );
4601
-      if( isset( $datetime['tz'] ) && ( '' < trim ( $datetime['tz'] ))) {
4598
+        $date = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year']);
4599
+        $output .= date('\THis', $date );
4600
+        if( isset( $datetime['tz'] ) && ( '' < trim ( $datetime['tz'] ))) {
4602 4601
         $datetime['tz'] = trim( $datetime['tz'] );
4603 4602
         if( 'Z' == $datetime['tz'] )
4604
-          $output .= 'Z';
4603
+            $output .= 'Z';
4605 4604
         $offset = $this->_tz2offset( $datetime['tz'] );
4606 4605
         if( 0 != $offset ) {
4607
-          $date = mktime( $datetime['hour'], $datetime['min'], ($datetime['sec'] + $offset), $datetime['month'], $datetime['day'], $datetime['year']);
4608
-          $output    = date( 'Ymd\THis\Z', $date );
4606
+            $date = mktime( $datetime['hour'], $datetime['min'], ($datetime['sec'] + $offset), $datetime['month'], $datetime['day'], $datetime['year']);
4607
+            $output    = date( 'Ymd\THis\Z', $date );
4609 4608
         }
4610
-      }
4611
-      elseif( 7 == $parno )
4609
+        }
4610
+        elseif( 7 == $parno )
4612 4611
         $output .= 'Z';
4613 4612
     }
4614 4613
     return $output;
4615
-  }
4614
+    }
4616 4615
 /**
4617
- * creates formatted output for calendar component property data value type duration
4618
- *
4619
- * @author Kjell-Inge Gustafsson <[email protected]>
4620
- * @since 2.4.16 - 2008-10-10
4621
- * @param array $duration ( week, day, hour, min, sec )
4622
- * @return string
4623
- */
4624
-  function _format_duration( $duration ) {
4616
+     * creates formatted output for calendar component property data value type duration
4617
+     *
4618
+     * @author Kjell-Inge Gustafsson <[email protected]>
4619
+     * @since 2.4.16 - 2008-10-10
4620
+     * @param array $duration ( week, day, hour, min, sec )
4621
+     * @return string
4622
+     */
4623
+    function _format_duration( $duration ) {
4625 4624
     if( !isset( $duration['week'] ) &&
4626 4625
         !isset( $duration['day'] )  &&
4627 4626
         !isset( $duration['hour'] ) &&
4628 4627
         !isset( $duration['min'] )  &&
4629 4628
         !isset( $duration['sec'] ))
4630
-      return;
4629
+        return;
4631 4630
     $output = 'P';
4632 4631
     if( isset( $duration['week'] ) && ( 0 < $duration['week'] ))
4633
-      $output   .= $duration['week'].'W';
4632
+        $output   .= $duration['week'].'W';
4634 4633
     else {
4635
-      if( isset($duration['day'] ) && ( 0 < $duration['day'] ))
4634
+        if( isset($duration['day'] ) && ( 0 < $duration['day'] ))
4636 4635
         $output .= $duration['day'].'D';
4637
-      if(( isset( $duration['hour']) && ( 0 < $duration['hour'] )) ||
4636
+        if(( isset( $duration['hour']) && ( 0 < $duration['hour'] )) ||
4638 4637
          ( isset( $duration['min'])  && ( 0 < $duration['min'] ))  ||
4639 4638
          ( isset( $duration['sec'])  && ( 0 < $duration['sec'] ))) {
4640 4639
         $output .= 'T';
4641 4640
         $output .= ( isset( $duration['hour']) && ( 0 < $duration['hour'] )) ? $duration['hour'].'H' : '0H';
4642 4641
         $output .= ( isset( $duration['min'])  && ( 0 < $duration['min'] ))  ? $duration['min']. 'M' : '0M';
4643 4642
         $output .= ( isset( $duration['sec'])  && ( 0 < $duration['sec'] ))  ? $duration['sec']. 'S' : '0S';
4644
-      }
4643
+        }
4645 4644
     }
4646 4645
     return $output;
4647
-  }
4646
+    }
4648 4647
 /**
4649
- * creates formatted output for calendar component property data value type recur
4650
- *
4651
- * @author Kjell-Inge Gustafsson <[email protected]>
4652
- * @since 2.4.8 - 2008-10-22
4653
- * @param array $recurlabel
4654
- * @param array $recurdata
4655
- * @return string
4656
- */
4657
-  function _format_recur( $recurlabel, $recurdata ) {
4648
+     * creates formatted output for calendar component property data value type recur
4649
+     *
4650
+     * @author Kjell-Inge Gustafsson <[email protected]>
4651
+     * @since 2.4.8 - 2008-10-22
4652
+     * @param array $recurlabel
4653
+     * @param array $recurdata
4654
+     * @return string
4655
+     */
4656
+    function _format_recur( $recurlabel, $recurdata ) {
4658 4657
     $output = null;
4659 4658
     foreach( $recurdata as $therule ) {
4660
-      if( empty( $therule['value'] )) {
4659
+        if( empty( $therule['value'] )) {
4661 4660
         if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( $recurlabel );
4662 4661
         continue;
4663
-      }
4664
-      $attributes = ( isset( $therule['params'] )) ? $this->_createParams( $therule['params'] ) : null;
4665
-      $content1  = $content2  = null;
4666
-      foreach( $therule['value'] as $rulelabel => $rulevalue ) {
4662
+        }
4663
+        $attributes = ( isset( $therule['params'] )) ? $this->_createParams( $therule['params'] ) : null;
4664
+        $content1  = $content2  = null;
4665
+        foreach( $therule['value'] as $rulelabel => $rulevalue ) {
4667 4666
         switch( $rulelabel ) {
4668
-          case 'FREQ': {
4667
+            case 'FREQ': {
4669 4668
             $content1 .= "FREQ=$rulevalue";
4670 4669
             break;
4671
-          }
4672
-          case 'UNTIL': {
4670
+            }
4671
+            case 'UNTIL': {
4673 4672
             $content2 .= ";UNTIL=";
4674 4673
             $content2 .= $this->_format_date_time( $rulevalue );
4675 4674
             break;
4676
-          }
4677
-          case 'COUNT':
4675
+            }
4676
+            case 'COUNT':
4678 4677
           case 'INTERVAL':
4679 4678
           case 'WKST': {
4680 4679
             $content2 .= ";$rulelabel=$rulevalue";
4681 4680
             break;
4682
-          }
4683
-          case 'BYSECOND':
4681
+            }
4682
+            case 'BYSECOND':
4684 4683
           case 'BYMINUTE':
4685 4684
           case 'BYHOUR':
4686 4685
           case 'BYMONTHDAY':
@@ -4690,144 +4689,144 @@  discard block
 block discarded – undo
4690 4689
           case 'BYSETPOS': {
4691 4690
             $content2 .= ";$rulelabel=";
4692 4691
             if( is_array( $rulevalue )) {
4693
-              foreach( $rulevalue as $vix => $valuePart ) {
4692
+                foreach( $rulevalue as $vix => $valuePart ) {
4694 4693
                 $content2 .= ( $vix ) ? ',' : null;
4695 4694
                 $content2 .= $valuePart;
4696
-              }
4695
+                }
4697 4696
             }
4698 4697
             else
4699
-             $content2 .= $rulevalue;
4698
+                $content2 .= $rulevalue;
4700 4699
             break;
4701
-          }
4702
-          case 'BYDAY': {
4700
+            }
4701
+            case 'BYDAY': {
4703 4702
             $content2 .= ";$rulelabel=";
4704 4703
             $bydaycnt = 0;
4705 4704
             foreach( $rulevalue as $vix => $valuePart ) {
4706
-              $content21 = $content22 = null;
4707
-              if( is_array( $valuePart )) {
4705
+                $content21 = $content22 = null;
4706
+                if( is_array( $valuePart )) {
4708 4707
                 $content2 .= ( $bydaycnt ) ? ',' : null;
4709 4708
                 foreach( $valuePart as $vix2 => $valuePart2 ) {
4710
-                  if( 'DAY' != strtoupper( $vix2 ))
4711
-                      $content21 .= $valuePart2;
4712
-                  else
4709
+                    if( 'DAY' != strtoupper( $vix2 ))
4710
+                        $content21 .= $valuePart2;
4711
+                    else
4713 4712
                     $content22 .= $valuePart2;
4714 4713
                 }
4715 4714
                 $content2 .= $content21.$content22;
4716 4715
                 $bydaycnt++;
4717
-              }
4718
-              else {
4716
+                }
4717
+                else {
4719 4718
                 $content2 .= ( $bydaycnt ) ? ',' : null;
4720 4719
                 if( 'DAY' != strtoupper( $vix ))
4721 4720
                     $content21 .= $valuePart;
4722 4721
                 else {
4723
-                  $content22 .= $valuePart;
4724
-                  $bydaycnt++;
4722
+                    $content22 .= $valuePart;
4723
+                    $bydaycnt++;
4725 4724
                 }
4726 4725
                 $content2 .= $content21.$content22;
4727
-              }
4726
+                }
4728 4727
             }
4729 4728
             break;
4730
-          }
4731
-          default: {
4729
+            }
4730
+            default: {
4732 4731
             $content2 .= ";$rulelabel=$rulevalue";
4733 4732
             break;
4734
-          }
4733
+            }
4735 4734
         }
4736
-      }
4737
-      $output .= $this->_createElement( $recurlabel, $attributes, $content1.$content2 );
4735
+        }
4736
+        $output .= $this->_createElement( $recurlabel, $attributes, $content1.$content2 );
4738 4737
     }
4739 4738
     return $output;
4740
-  }
4739
+    }
4741 4740
 /**
4742
- * create property name case - lower/upper
4743
- *
4744
- * @author Kjell-Inge Gustafsson <[email protected]>
4745
- * @since 0.9.7 - 2006-11-20
4746
- * @param string $propertyName
4747
- * @return string
4748
- */
4749
-  function _formatPropertyName( $propertyName ) {
4741
+     * create property name case - lower/upper
4742
+     *
4743
+     * @author Kjell-Inge Gustafsson <[email protected]>
4744
+     * @since 0.9.7 - 2006-11-20
4745
+     * @param string $propertyName
4746
+     * @return string
4747
+     */
4748
+    function _formatPropertyName( $propertyName ) {
4750 4749
     switch( $this->format ) {
4751
-      case 'xcal':
4750
+        case 'xcal':
4752 4751
         return strtolower( $propertyName );
4753 4752
         break;
4754
-      default:
4753
+        default:
4755 4754
         return strtoupper( $propertyName );
4756 4755
         break;
4757 4756
     }
4758
-  }
4757
+    }
4759 4758
 /**
4760
- * checks if input array contains a date
4761
- *
4762
- * @author Kjell-Inge Gustafsson <[email protected]>
4763
- * @since 2.4.16 - 2008-10-25
4764
- * @param array $input
4765
- * @return bool
4766
- */
4767
-  function _isArrayDate( $input ) {
4759
+     * checks if input array contains a date
4760
+     *
4761
+     * @author Kjell-Inge Gustafsson <[email protected]>
4762
+     * @since 2.4.16 - 2008-10-25
4763
+     * @param array $input
4764
+     * @return bool
4765
+     */
4766
+    function _isArrayDate( $input ) {
4768 4767
     if( isset( $input['week'] ) || ( !in_array( count( $input ), array( 3, 6, 7 ))))
4769
-      return FALSE;
4768
+        return FALSE;
4770 4769
     if( 7 == count( $input ))
4771
-      return TRUE;
4770
+        return TRUE;
4772 4771
     if( isset( $input['year'] ) && isset( $input['month'] ) && isset( $input['day'] ))
4773
-      return checkdate( (int) $input['month'], (int) $input['day'], (int) $input['year'] );
4772
+        return checkdate( (int) $input['month'], (int) $input['day'], (int) $input['year'] );
4774 4773
     if( isset( $input['day'] ) || isset( $input['hour'] ) || isset( $input['min'] ) || isset( $input['sec'] ))
4775
-      return FALSE;
4774
+        return FALSE;
4776 4775
     if( in_array( 0, $input ))
4777
-      return FALSE;
4776
+        return FALSE;
4778 4777
     if(( 1970 > $input[0] ) || ( 12 < $input[1] ) || ( 31 < $input[2] ))
4779
-      return FALSE;
4778
+        return FALSE;
4780 4779
     if(( isset( $input[0] ) && isset( $input[1] ) && isset( $input[2] )) &&
4781 4780
          checkdate( (int) $input[1], (int) $input[2], (int) $input[0] ))
4782
-      return TRUE;
4781
+        return TRUE;
4783 4782
     $input = $this->_date_time_string( $input[1].'/'.$input[2].'/'.$input[0], 3 ); //  m - d - Y
4784 4783
     if( isset( $input['year'] ) && isset( $input['month'] ) && isset( $input['day'] ))
4785
-      return checkdate( (int) $input['month'], (int) $input['day'], (int) $input['year'] );
4784
+        return checkdate( (int) $input['month'], (int) $input['day'], (int) $input['year'] );
4786 4785
     return FALSE;
4787
-  }
4786
+    }
4788 4787
 /**
4789
- * checks if input array contains a timestamp date
4790
- *
4791
- * @author Kjell-Inge Gustafsson <[email protected]>
4792
- * @since 2.4.16 - 2008-10-18
4793
- * @param array $input
4794
- * @return bool
4795
- */
4796
-  function _isArrayTimestampDate( $input ) {
4788
+     * checks if input array contains a timestamp date
4789
+     *
4790
+     * @author Kjell-Inge Gustafsson <[email protected]>
4791
+     * @since 2.4.16 - 2008-10-18
4792
+     * @param array $input
4793
+     * @return bool
4794
+     */
4795
+    function _isArrayTimestampDate( $input ) {
4797 4796
     return ( is_array( $input ) && isset( $input['timestamp'] )) ? TRUE : FALSE ;
4798
-  }
4797
+    }
4799 4798
 /**
4800
- * controll if input string contains traling UTC offset
4801
- *
4802
- * @author Kjell-Inge Gustafsson <[email protected]>
4803
- * @since 2.4.16 - 2008-10-19
4804
- * @param string $input
4805
- * @return bool
4806
- */
4807
-  function _isOffset( $input ) {
4799
+     * controll if input string contains traling UTC offset
4800
+     *
4801
+     * @author Kjell-Inge Gustafsson <[email protected]>
4802
+     * @since 2.4.16 - 2008-10-19
4803
+     * @param string $input
4804
+     * @return bool
4805
+     */
4806
+    function _isOffset( $input ) {
4808 4807
     $input         = trim( (string) $input );
4809 4808
     if( 'Z' == substr( $input, -1 ))
4810
-      return TRUE;
4809
+        return TRUE;
4811 4810
     elseif((   5 <= strlen( $input )) &&
4812 4811
        ( in_array( substr( $input, -5, 1 ), array( '+', '-' ))) &&
4813 4812
        (   '0000'  < substr( $input, -4 )) && (   '9999' >= substr( $input, -4 )))
4814
-      return TRUE;
4813
+        return TRUE;
4815 4814
     elseif((    7 <= strlen( $input )) &&
4816 4815
        ( in_array( substr( $input, -7, 1 ), array( '+', '-' ))) &&
4817 4816
        ( '000000'  < substr( $input, -6 )) && ( '999999' >= substr( $input, -6 )))
4818
-      return TRUE;
4817
+        return TRUE;
4819 4818
     return FALSE;
4820 4819
 
4821
-  }
4820
+    }
4822 4821
 /**
4823
- * check if property not exists within component
4824
- *
4825
- * @author Kjell-Inge Gustafsson <[email protected]>
4826
- * @since 2.5.1 - 2008-10-15
4827
- * @param string $propName
4828
- * @return bool
4829
- */
4830
-  function _notExistProp( $propName ) {
4822
+     * check if property not exists within component
4823
+     *
4824
+     * @author Kjell-Inge Gustafsson <[email protected]>
4825
+     * @since 2.5.1 - 2008-10-15
4826
+     * @param string $propName
4827
+     * @return bool
4828
+     */
4829
+    function _notExistProp( $propName ) {
4831 4830
     if( empty( $propName )) return FALSE; // when deleting x-prop, an empty propName may be used=allowed
4832 4831
     $propName = strtolower( $propName );
4833 4832
     if(     'last-modified'    == $propName )  { if( !isset( $this->lastmodified ))    return TRUE; }
@@ -4837,270 +4836,270 @@  discard block
 block discarded – undo
4837 4836
     elseif( 'request-status'   == $propName )  { if( !isset( $this->requeststatus ))   return TRUE; }
4838 4837
     elseif((       'x-' != substr($propName,0,2)) && !isset( $this->$propName ))       return TRUE;
4839 4838
     return FALSE;
4840
-  }
4839
+    }
4841 4840
 /**
4842
- * remakes a recur pattern to an array of dates
4843
- *
4844
- * if missing, UNTIL is set 1 year from startdate (emergency break)
4845
- *
4846
- * @author Kjell-Inge Gustafsson <[email protected]>
4847
- * @since 2.4.16 - 2008-10-18
4848
- * @param array $result, array to update, array([timestamp] => timestamp)
4849
- * @param array $recur, pattern for recurrency (only value part, params ignored)
4850
- * @param array $wdate, component start date
4851
- * @param array $startdate, start date
4852
- * @param array $enddate, optional
4853
- * @return array of recurrence (start-)dates as index
4854
- * @todo BYHOUR, BYMINUTE, BYSECOND, ev. BYSETPOS due to ambiguity, WEEKLY at year end/start
4855
- */
4856
-  function _recur2date( & $result, $recur, $wdate, $startdate, $enddate=FALSE ) {
4841
+     * remakes a recur pattern to an array of dates
4842
+     *
4843
+     * if missing, UNTIL is set 1 year from startdate (emergency break)
4844
+     *
4845
+     * @author Kjell-Inge Gustafsson <[email protected]>
4846
+     * @since 2.4.16 - 2008-10-18
4847
+     * @param array $result, array to update, array([timestamp] => timestamp)
4848
+     * @param array $recur, pattern for recurrency (only value part, params ignored)
4849
+     * @param array $wdate, component start date
4850
+     * @param array $startdate, start date
4851
+     * @param array $enddate, optional
4852
+     * @return array of recurrence (start-)dates as index
4853
+     * @todo BYHOUR, BYMINUTE, BYSECOND, ev. BYSETPOS due to ambiguity, WEEKLY at year end/start
4854
+     */
4855
+    function _recur2date( & $result, $recur, $wdate, $startdate, $enddate=FALSE ) {
4857 4856
     foreach( $wdate as $k => $v ) if( ctype_digit( $v )) $wdate[$k] = (int) $v;
4858 4857
     $wdatets     = $this->_date2timestamp( $wdate );
4859 4858
     $startdatets = $this->_date2timestamp( $startdate );
4860 4859
     if( !$enddate ) {
4861
-      $enddate = $startdate;
4862
-      $enddate['year'] += 1;
4860
+        $enddate = $startdate;
4861
+        $enddate['year'] += 1;
4863 4862
 // echo "recur __in_ ".implode('-',$startdate)." period start ".implode('-',$wdate)." period end ".implode('-',$enddate)."<br />\n";print_r($recur);echo "<br />\n";//test###
4864 4863
     }
4865 4864
     $endDatets = $this->_date2timestamp( $enddate ); // fix break
4866 4865
     if( !isset( $recur['COUNT'] ) && !isset( $recur['UNTIL'] ))
4867
-      $recur['UNTIL'] = $enddate; // create break
4866
+        $recur['UNTIL'] = $enddate; // create break
4868 4867
     if( isset( $recur['UNTIL'] )) {
4869
-      $tdatets = $this->_date2timestamp( $recur['UNTIL'] );
4870
-      if( $endDatets > $tdatets ) {
4868
+        $tdatets = $this->_date2timestamp( $recur['UNTIL'] );
4869
+        if( $endDatets > $tdatets ) {
4871 4870
         $endDatets = $tdatets; // emergency break
4872 4871
         $enddate   = $this->_timestamp2date( $endDatets, 6 );
4873
-      }
4874
-      else
4872
+        }
4873
+        else
4875 4874
         $recur['UNTIL'] = $this->_timestamp2date( $endDatets, 6 );
4876 4875
     }
4877 4876
     if( $wdatets > $endDatets ) {
4878
-     //echo "recur out of date ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$wdatets),6))."<br />\n";//test
4879
-      return array(); // nothing to do.. .
4877
+        //echo "recur out of date ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$wdatets),6))."<br />\n";//test
4878
+        return array(); // nothing to do.. .
4880 4879
     }
4881 4880
     if( !isset( $recur['FREQ'] )) // "MUST be specified.. ."
4882
-      $recur['FREQ'] = 'DAILY'; // ??
4881
+        $recur['FREQ'] = 'DAILY'; // ??
4883 4882
     $wkst = ( isset( $recur['WKST'] ) && ( 'SU' == $recur['WKST'] )) ? 24*60*60 : 0; // ??
4884 4883
     if( !isset( $recur['INTERVAL'] ))
4885
-      $recur['INTERVAL'] = 1;
4884
+        $recur['INTERVAL'] = 1;
4886 4885
     $countcnt = ( !isset( $recur['BYSETPOS'] )) ? 1 : 0; // DTSTART counts as the first occurrence
4887 4886
             /* find out how to step up dates and set index for interval count */
4888 4887
     $step = array();
4889 4888
     if( 'YEARLY' == $recur['FREQ'] )
4890
-      $step['year']  = 1;
4889
+        $step['year']  = 1;
4891 4890
     elseif( 'MONTHLY' == $recur['FREQ'] )
4892
-      $step['month'] = 1;
4891
+        $step['month'] = 1;
4893 4892
     elseif( 'WEEKLY' == $recur['FREQ'] )
4894
-      $step['day']   = 7;
4893
+        $step['day']   = 7;
4895 4894
     else
4896
-      $step['day']   = 1;
4895
+        $step['day']   = 1;
4897 4896
     if( isset( $step['year'] ) && isset( $recur['BYMONTH'] ))
4898
-      $step = array( 'month' => 1 );
4897
+        $step = array( 'month' => 1 );
4899 4898
     if( empty( $step ) && isset( $recur['BYWEEKNO'] )) // ??
4900
-      $step = array( 'day' => 7 );
4899
+        $step = array( 'day' => 7 );
4901 4900
     if( isset( $recur['BYYEARDAY'] ) || isset( $recur['BYMONTHDAY'] ) || isset( $recur['BYDAY'] ))
4902
-      $step = array( 'day' => 1 );
4901
+        $step = array( 'day' => 1 );
4903 4902
     $intervalarr = array();
4904 4903
     if( 1 < $recur['INTERVAL'] ) {
4905
-      $intervalix = $this->_recurIntervalIx( $recur['FREQ'], $wdate, $wkst );
4906
-      $intervalarr = array( $intervalix => 0 );
4904
+        $intervalix = $this->_recurIntervalIx( $recur['FREQ'], $wdate, $wkst );
4905
+        $intervalarr = array( $intervalix => 0 );
4907 4906
     }
4908 4907
     if( isset( $recur['BYSETPOS'] )) { // save start date + weekno
4909
-      $bysetposymd1 = $bysetposymd2 = $bysetposw1 = $bysetposw2 = array();
4910
-      $bysetposWold = (int) date( 'W', ( $wdatets + $wkst ));
4911
-      $bysetposYold = $wdate['year'];
4912
-      $bysetposMold = $wdate['month'];
4913
-      $bysetposDold = $wdate['day'];
4914
-      if( is_array( $recur['BYSETPOS'] )) {
4908
+        $bysetposymd1 = $bysetposymd2 = $bysetposw1 = $bysetposw2 = array();
4909
+        $bysetposWold = (int) date( 'W', ( $wdatets + $wkst ));
4910
+        $bysetposYold = $wdate['year'];
4911
+        $bysetposMold = $wdate['month'];
4912
+        $bysetposDold = $wdate['day'];
4913
+        if( is_array( $recur['BYSETPOS'] )) {
4915 4914
         foreach( $recur['BYSETPOS'] as $bix => $bval )
4916
-          $recur['BYSETPOS'][$bix] = (int) $bval;
4917
-      }
4918
-      else
4915
+            $recur['BYSETPOS'][$bix] = (int) $bval;
4916
+        }
4917
+        else
4919 4918
         $recur['BYSETPOS'] = array( (int) $recur['BYSETPOS'] );
4920
-      $this->_stepdate( $enddate, $endDatets, $step); // make sure to count whole last period
4919
+        $this->_stepdate( $enddate, $endDatets, $step); // make sure to count whole last period
4921 4920
     }
4922 4921
     $this->_stepdate( $wdate, $wdatets, $step);
4923 4922
     $year_old     = null;
4924 4923
     $daynames     = array( 'SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA' );
4925
-             /* MAIN LOOP */
4926
-     // echo "recur start ".implode('-',$wdate)." end ".implode('-',$enddate)."<br />\n";//test
4924
+                /* MAIN LOOP */
4925
+        // echo "recur start ".implode('-',$wdate)." end ".implode('-',$enddate)."<br />\n";//test
4927 4926
     while( TRUE ) {
4928
-      if( isset( $endDatets ) && ( $wdatets > $endDatets ))
4927
+        if( isset( $endDatets ) && ( $wdatets > $endDatets ))
4929 4928
         break;
4930
-      if( isset( $recur['COUNT'] ) && ( $countcnt >= $recur['COUNT'] ))
4929
+        if( isset( $recur['COUNT'] ) && ( $countcnt >= $recur['COUNT'] ))
4931 4930
         break;
4932
-      if( $year_old != $wdate['year'] ) {
4931
+        if( $year_old != $wdate['year'] ) {
4933 4932
         $year_old   = $wdate['year'];
4934 4933
         $daycnts    = array();
4935 4934
         $yeardays   = $weekno = 0;
4936 4935
         $yeardaycnt = array();
4937 4936
         for( $m = 1; $m <= 12; $m++ ) { // count up and update up-counters
4938
-          $daycnts[$m] = array();
4939
-          $weekdaycnt = array();
4940
-          foreach( $daynames as $dn )
4937
+            $daycnts[$m] = array();
4938
+            $weekdaycnt = array();
4939
+            foreach( $daynames as $dn )
4941 4940
             $yeardaycnt[$dn] = $weekdaycnt[$dn] = 0;
4942
-          $mcnt     = date( 't', mktime( 0, 0, 0, $m, 1, $wdate['year'] ));
4943
-          for( $d   = 1; $d <= $mcnt; $d++ ) {
4941
+            $mcnt     = date( 't', mktime( 0, 0, 0, $m, 1, $wdate['year'] ));
4942
+            for( $d   = 1; $d <= $mcnt; $d++ ) {
4944 4943
             $daycnts[$m][$d] = array();
4945 4944
             if( isset( $recur['BYYEARDAY'] )) {
4946
-              $yeardays++;
4947
-              $daycnts[$m][$d]['yearcnt_up'] = $yeardays;
4945
+                $yeardays++;
4946
+                $daycnts[$m][$d]['yearcnt_up'] = $yeardays;
4948 4947
             }
4949 4948
             if( isset( $recur['BYDAY'] )) {
4950
-              $day    = date( 'w', mktime( 0, 0, 0, $m, $d, $wdate['year'] ));
4951
-              $day    = $daynames[$day];
4952
-              $daycnts[$m][$d]['DAY'] = $day;
4953
-              $weekdaycnt[$day]++;
4954
-              $daycnts[$m][$d]['monthdayno_up'] = $weekdaycnt[$day];
4955
-              $yeardaycnt[$day]++;
4956
-              $daycnts[$m][$d]['yeardayno_up'] = $yeardaycnt[$day];
4949
+                $day    = date( 'w', mktime( 0, 0, 0, $m, $d, $wdate['year'] ));
4950
+                $day    = $daynames[$day];
4951
+                $daycnts[$m][$d]['DAY'] = $day;
4952
+                $weekdaycnt[$day]++;
4953
+                $daycnts[$m][$d]['monthdayno_up'] = $weekdaycnt[$day];
4954
+                $yeardaycnt[$day]++;
4955
+                $daycnts[$m][$d]['yeardayno_up'] = $yeardaycnt[$day];
4957 4956
             }
4958 4957
             if(  isset( $recur['BYWEEKNO'] ) || ( $recur['FREQ'] == 'WEEKLY' ))
4959
-              $daycnts[$m][$d]['weekno_up'] =(int)date('W',mktime(0,0,$wkst,$m,$d,$wdate['year']));
4960
-          }
4958
+                $daycnts[$m][$d]['weekno_up'] =(int)date('W',mktime(0,0,$wkst,$m,$d,$wdate['year']));
4959
+            }
4961 4960
         }
4962 4961
         $daycnt = 0;
4963 4962
         $yeardaycnt = array();
4964 4963
         if(  isset( $recur['BYWEEKNO'] ) || ( $recur['FREQ'] == 'WEEKLY' )) {
4965
-          $weekno = null;
4966
-          for( $d=31; $d > 25; $d-- ) { // get last weekno for year
4964
+            $weekno = null;
4965
+            for( $d=31; $d > 25; $d-- ) { // get last weekno for year
4967 4966
             if( !$weekno )
4968
-              $weekno = $daycnts[12][$d]['weekno_up'];
4967
+                $weekno = $daycnts[12][$d]['weekno_up'];
4969 4968
             elseif( $weekno < $daycnts[12][$d]['weekno_up'] ) {
4970
-              $weekno = $daycnts[12][$d]['weekno_up'];
4971
-              break;
4969
+                $weekno = $daycnts[12][$d]['weekno_up'];
4970
+                break;
4971
+            }
4972 4972
             }
4973
-          }
4974 4973
         }
4975 4974
         for( $m = 12; $m > 0; $m-- ) { // count down and update down-counters
4976
-          $weekdaycnt = array();
4977
-          foreach( $daynames as $dn )
4975
+            $weekdaycnt = array();
4976
+            foreach( $daynames as $dn )
4978 4977
             $yeardaycnt[$dn] = $weekdaycnt[$dn] = 0;
4979
-          $monthcnt = 0;
4980
-          $mcnt     = date( 't', mktime( 0, 0, 0, $m, 1, $wdate['year'] ));
4981
-          for( $d   = $mcnt; $d > 0; $d-- ) {
4978
+            $monthcnt = 0;
4979
+            $mcnt     = date( 't', mktime( 0, 0, 0, $m, 1, $wdate['year'] ));
4980
+            for( $d   = $mcnt; $d > 0; $d-- ) {
4982 4981
             if( isset( $recur['BYYEARDAY'] )) {
4983
-              $daycnt -= 1;
4984
-              $daycnts[$m][$d]['yearcnt_down'] = $daycnt;
4982
+                $daycnt -= 1;
4983
+                $daycnts[$m][$d]['yearcnt_down'] = $daycnt;
4985 4984
             }
4986 4985
             if( isset( $recur['BYMONTHDAY'] )) {
4987
-              $monthcnt -= 1;
4988
-              $daycnts[$m][$d]['monthcnt_down'] = $monthcnt;
4986
+                $monthcnt -= 1;
4987
+                $daycnts[$m][$d]['monthcnt_down'] = $monthcnt;
4989 4988
             }
4990 4989
             if( isset( $recur['BYDAY'] )) {
4991
-              $day  = $daycnts[$m][$d]['DAY'];
4992
-              $weekdaycnt[$day] -= 1;
4993
-              $daycnts[$m][$d]['monthdayno_down'] = $weekdaycnt[$day];
4994
-              $yeardaycnt[$day] -= 1;
4995
-              $daycnts[$m][$d]['yeardayno_down'] = $yeardaycnt[$day];
4990
+                $day  = $daycnts[$m][$d]['DAY'];
4991
+                $weekdaycnt[$day] -= 1;
4992
+                $daycnts[$m][$d]['monthdayno_down'] = $weekdaycnt[$day];
4993
+                $yeardaycnt[$day] -= 1;
4994
+                $daycnts[$m][$d]['yeardayno_down'] = $yeardaycnt[$day];
4996 4995
             }
4997 4996
             if(  isset( $recur['BYWEEKNO'] ) || ( $recur['FREQ'] == 'WEEKLY' ))
4998
-              $daycnts[$m][$d]['weekno_down'] = ($daycnts[$m][$d]['weekno_up'] - $weekno - 1);
4999
-          }
4997
+                $daycnts[$m][$d]['weekno_down'] = ($daycnts[$m][$d]['weekno_up'] - $weekno - 1);
4998
+            }
4999
+        }
5000 5000
         }
5001
-      }
5002 5001
             /* check interval */
5003
-      if( 1 < $recur['INTERVAL'] ) {
5002
+        if( 1 < $recur['INTERVAL'] ) {
5004 5003
             /* create interval index */
5005 5004
         $intervalix = $this->_recurIntervalIx( $recur['FREQ'], $wdate, $wkst );
5006 5005
             /* check interval */
5007 5006
         $currentKey = array_keys( $intervalarr );
5008 5007
         $currentKey = end( $currentKey ); // get last index
5009 5008
         if( $currentKey != $intervalix )
5010
-          $intervalarr = array( $intervalix => ( $intervalarr[$currentKey] + 1 ));
5009
+            $intervalarr = array( $intervalix => ( $intervalarr[$currentKey] + 1 ));
5011 5010
         if(( $recur['INTERVAL'] != $intervalarr[$intervalix] ) &&
5012 5011
            ( 0 != $intervalarr[$intervalix] )) {
5013 5012
             /* step up date */
5014 5013
     //echo "skip: ".implode('-',$wdate)." ix=$intervalix old=$currentKey interval=".$intervalarr[$intervalix]."<br />\n";//test
5015
-          $this->_stepdate( $wdate, $wdatets, $step);
5016
-          continue;
5014
+            $this->_stepdate( $wdate, $wdatets, $step);
5015
+            continue;
5017 5016
         }
5018 5017
         else // continue within the selected interval
5019
-          $intervalarr[$intervalix] = 0;
5020
-   //echo "cont: ".implode('-',$wdate)." ix=$intervalix old=$currentKey interval=".$intervalarr[$intervalix]."<br />\n";//test
5021
-      }
5022
-      $updateOK = TRUE;
5023
-      if( $updateOK && isset( $recur['BYMONTH'] ))
5018
+            $intervalarr[$intervalix] = 0;
5019
+    //echo "cont: ".implode('-',$wdate)." ix=$intervalix old=$currentKey interval=".$intervalarr[$intervalix]."<br />\n";//test
5020
+        }
5021
+        $updateOK = TRUE;
5022
+        if( $updateOK && isset( $recur['BYMONTH'] ))
5024 5023
         $updateOK = $this->_recurBYcntcheck( $recur['BYMONTH']
5025
-                                           , $wdate['month']
5026
-                                           ,($wdate['month'] - 13));
5027
-      if( $updateOK && isset( $recur['BYWEEKNO'] ))
5024
+                                            , $wdate['month']
5025
+                                            ,($wdate['month'] - 13));
5026
+        if( $updateOK && isset( $recur['BYWEEKNO'] ))
5028 5027
         $updateOK = $this->_recurBYcntcheck( $recur['BYWEEKNO']
5029
-                                           , $daycnts[$wdate['month']][$wdate['day']]['weekno_up']
5030
-                                           , $daycnts[$wdate['month']][$wdate['day']]['weekno_down'] );
5031
-      if( $updateOK && isset( $recur['BYYEARDAY'] ))
5028
+                                            , $daycnts[$wdate['month']][$wdate['day']]['weekno_up']
5029
+                                            , $daycnts[$wdate['month']][$wdate['day']]['weekno_down'] );
5030
+        if( $updateOK && isset( $recur['BYYEARDAY'] ))
5032 5031
         $updateOK = $this->_recurBYcntcheck( $recur['BYYEARDAY']
5033
-                                           , $daycnts[$wdate['month']][$wdate['day']]['yearcnt_up']
5034
-                                           , $daycnts[$wdate['month']][$wdate['day']]['yearcnt_down'] );
5035
-      if( $updateOK && isset( $recur['BYMONTHDAY'] ))
5032
+                                            , $daycnts[$wdate['month']][$wdate['day']]['yearcnt_up']
5033
+                                            , $daycnts[$wdate['month']][$wdate['day']]['yearcnt_down'] );
5034
+        if( $updateOK && isset( $recur['BYMONTHDAY'] ))
5036 5035
         $updateOK = $this->_recurBYcntcheck( $recur['BYMONTHDAY']
5037
-                                           , $wdate['day']
5038
-                                           , $daycnts[$wdate['month']][$wdate['day']]['monthcnt_down'] );
5036
+                                            , $wdate['day']
5037
+                                            , $daycnts[$wdate['month']][$wdate['day']]['monthcnt_down'] );
5039 5038
     //echo "efter BYMONTHDAY: ".implode('-',$wdate).' status: '; echo ($updateOK) ? 'TRUE' : 'FALSE'; echo "<br />\n";//test###
5040
-      if( $updateOK && isset( $recur['BYDAY'] )) {
5039
+        if( $updateOK && isset( $recur['BYDAY'] )) {
5041 5040
         $updateOK = FALSE;
5042 5041
         $m = $wdate['month'];
5043 5042
         $d = $wdate['day'];
5044 5043
         if( isset( $recur['BYDAY']['DAY'] )) { // single day, opt with year/month day order no
5045
-          $daynoexists = $daynosw = $daynamesw =  FALSE;
5046
-          if( $recur['BYDAY']['DAY'] == $daycnts[$m][$d]['DAY'] )
5044
+            $daynoexists = $daynosw = $daynamesw =  FALSE;
5045
+            if( $recur['BYDAY']['DAY'] == $daycnts[$m][$d]['DAY'] )
5047 5046
             $daynamesw = TRUE;
5048
-          if( isset( $recur['BYDAY'][0] )) {
5047
+            if( isset( $recur['BYDAY'][0] )) {
5049 5048
             $daynoexists = TRUE;
5050 5049
             if(( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'MONTHLY' )) || isset( $recur['BYMONTH'] ))
5051
-              $daynosw = $this->_recurBYcntcheck( $recur['BYDAY'][0]
5050
+                $daynosw = $this->_recurBYcntcheck( $recur['BYDAY'][0]
5052 5051
                                                 , $daycnts[$m][$d]['monthdayno_up']
5053 5052
                                                 , $daycnts[$m][$d]['monthdayno_down'] );
5054 5053
             elseif( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'YEARLY' ))
5055
-              $daynosw = $this->_recurBYcntcheck( $recur['BYDAY'][0]
5054
+                $daynosw = $this->_recurBYcntcheck( $recur['BYDAY'][0]
5056 5055
                                                 , $daycnts[$m][$d]['yeardayno_up']
5057 5056
                                                 , $daycnts[$m][$d]['yeardayno_down'] );
5058
-          }
5059
-          if((  $daynoexists &&  $daynosw && $daynamesw ) ||
5057
+            }
5058
+            if((  $daynoexists &&  $daynosw && $daynamesw ) ||
5060 5059
              ( !$daynoexists && !$daynosw && $daynamesw )) {
5061 5060
             $updateOK = TRUE;
5062
-          }
5061
+            }
5063 5062
         //echo "daynoexists:$daynoexists daynosw:$daynosw daynamesw:$daynamesw<br />\n"; // test ###
5064 5063
         }
5065 5064
         else {
5066
-          foreach( $recur['BYDAY'] as $bydayvalue ) {
5065
+            foreach( $recur['BYDAY'] as $bydayvalue ) {
5067 5066
             $daynoexists = $daynosw = $daynamesw = FALSE;
5068 5067
             if( isset( $bydayvalue['DAY'] ) &&
5069 5068
                      ( $bydayvalue['DAY'] == $daycnts[$m][$d]['DAY'] ))
5070
-              $daynamesw = TRUE;
5069
+                $daynamesw = TRUE;
5071 5070
             if( isset( $bydayvalue[0] )) {
5072
-              $daynoexists = TRUE;
5073
-              if(( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'MONTHLY' )) ||
5071
+                $daynoexists = TRUE;
5072
+                if(( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'MONTHLY' )) ||
5074 5073
                    isset( $recur['BYMONTH'] ))
5075 5074
                 $daynosw = $this->_recurBYcntcheck( $bydayvalue['0']
5076
-                                                  , $daycnts[$m][$d]['monthdayno_up']
5077
-                                                  , $daycnts[$m][$d]['monthdayno_down'] );
5078
-              elseif( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'YEARLY' ))
5075
+                                                    , $daycnts[$m][$d]['monthdayno_up']
5076
+                                                    , $daycnts[$m][$d]['monthdayno_down'] );
5077
+                elseif( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'YEARLY' ))
5079 5078
                 $daynosw = $this->_recurBYcntcheck( $bydayvalue['0']
5080
-                                                  , $daycnts[$m][$d]['yeardayno_up']
5081
-                                                  , $daycnts[$m][$d]['yeardayno_down'] );
5079
+                                                    , $daycnts[$m][$d]['yeardayno_up']
5080
+                                                    , $daycnts[$m][$d]['yeardayno_down'] );
5082 5081
             }
5083 5082
         //echo "daynoexists:$daynoexists daynosw:$daynosw daynamesw:$daynamesw<br />\n"; // test ###
5084 5083
             if((  $daynoexists &&  $daynosw && $daynamesw ) ||
5085 5084
                ( !$daynoexists && !$daynosw && $daynamesw )) {
5086
-              $updateOK = TRUE;
5087
-              break;
5085
+                $updateOK = TRUE;
5086
+                break;
5087
+            }
5088 5088
             }
5089
-          }
5090 5089
         }
5091
-      }
5092
-      //echo "efter BYDAY: ".implode('-',$wdate).' status: '; echo ($updateOK) ? 'TRUE' : 'FALSE'; echo "<br />\n"; // test ###
5090
+        }
5091
+        //echo "efter BYDAY: ".implode('-',$wdate).' status: '; echo ($updateOK) ? 'TRUE' : 'FALSE'; echo "<br />\n"; // test ###
5093 5092
             /* check BYSETPOS */
5094
-      if( $updateOK ) {
5093
+        if( $updateOK ) {
5095 5094
         if( isset( $recur['BYSETPOS'] ) &&
5096 5095
           ( in_array( $recur['FREQ'], array( 'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY' )))) {
5097
-          if( isset( $recur['WEEKLY'] )) {
5096
+            if( isset( $recur['WEEKLY'] )) {
5098 5097
             if( $bysetposWold == $daycnts[$wdate['month']][$wdate['day']]['weekno_up'] )
5099
-              $bysetposw1[] = $wdatets;
5098
+                $bysetposw1[] = $wdatets;
5100 5099
             else
5101
-              $bysetposw2[] = $wdatets;
5102
-          }
5103
-          else {
5100
+                $bysetposw2[] = $wdatets;
5101
+            }
5102
+            else {
5104 5103
             if(( isset( $recur['FREQ'] ) && ( 'YEARLY'      == $recur['FREQ'] )  &&
5105 5104
                                             ( $bysetposYold == $wdate['year'] ))   ||
5106 5105
                ( isset( $recur['FREQ'] ) && ( 'MONTHLY'     == $recur['FREQ'] )  &&
@@ -5110,418 +5109,418 @@  discard block
 block discarded – undo
5110 5109
                                            (( $bysetposYold == $wdate['year'] )  &&
5111 5110
                                             ( $bysetposMold == $wdate['month'])  &&
5112 5111
                                             ( $bysetposDold == $wdate['sday'] ))))
5113
-              $bysetposymd1[] = $wdatets;
5112
+                $bysetposymd1[] = $wdatets;
5114 5113
             else
5115
-              $bysetposymd2[] = $wdatets;
5116
-          }
5114
+                $bysetposymd2[] = $wdatets;
5115
+            }
5117 5116
         }
5118 5117
         else {
5119 5118
             /* update result array if BYSETPOS is set */
5120
-          $countcnt++;
5121
-          if( $startdatets <= $wdatets ) { // only output within period
5119
+            $countcnt++;
5120
+            if( $startdatets <= $wdatets ) { // only output within period
5122 5121
             $result[$wdatets] = TRUE;
5123
-          //echo "recur ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$wdatets),6))."<br />\n";//test
5124
-          }
5125
-         //else echo "recur undate ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$wdatets),6))." okdatstart ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$startdatets),6))."<br />\n";//test
5126
-          $updateOK = FALSE;
5122
+            //echo "recur ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$wdatets),6))."<br />\n";//test
5123
+            }
5124
+            //else echo "recur undate ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$wdatets),6))." okdatstart ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$startdatets),6))."<br />\n";//test
5125
+            $updateOK = FALSE;
5126
+        }
5127 5127
         }
5128
-      }
5129 5128
             /* step up date */
5130
-      $this->_stepdate( $wdate, $wdatets, $step);
5129
+        $this->_stepdate( $wdate, $wdatets, $step);
5131 5130
             /* check if BYSETPOS is set for updating result array */
5132
-      if( $updateOK && isset( $recur['BYSETPOS'] )) {
5131
+        if( $updateOK && isset( $recur['BYSETPOS'] )) {
5133 5132
         $bysetpos       = FALSE;
5134 5133
         if( isset( $recur['FREQ'] ) && ( 'YEARLY'  == $recur['FREQ'] ) &&
5135 5134
           ( $bysetposYold != $wdate['year'] )) {
5136
-          $bysetpos     = TRUE;
5137
-          $bysetposYold = $wdate['year'];
5135
+            $bysetpos     = TRUE;
5136
+            $bysetposYold = $wdate['year'];
5138 5137
         }
5139 5138
         elseif( isset( $recur['FREQ'] ) && ( 'MONTHLY' == $recur['FREQ'] &&
5140 5139
          (( $bysetposYold != $wdate['year'] ) || ( $bysetposMold != $wdate['month'] )))) {
5141
-          $bysetpos     = TRUE;
5142
-          $bysetposYold = $wdate['year'];
5143
-          $bysetposMold = $wdate['month'];
5140
+            $bysetpos     = TRUE;
5141
+            $bysetposYold = $wdate['year'];
5142
+            $bysetposMold = $wdate['month'];
5144 5143
         }
5145 5144
         elseif( isset( $recur['FREQ'] ) && ( 'WEEKLY'  == $recur['FREQ'] )) {
5146
-          $weekno = (int) date( 'W', mktime( 0, 0, $wkst, $wdate['month'], $wdate['day'], $wdate['year']));
5147
-          if( $bysetposWold != $weekno ) {
5145
+            $weekno = (int) date( 'W', mktime( 0, 0, $wkst, $wdate['month'], $wdate['day'], $wdate['year']));
5146
+            if( $bysetposWold != $weekno ) {
5148 5147
             $bysetposWold = $weekno;
5149 5148
             $bysetpos     = TRUE;
5150
-          }
5149
+            }
5151 5150
         }
5152 5151
         elseif( isset( $recur['FREQ'] ) && ( 'DAILY'   == $recur['FREQ'] ) &&
5153 5152
          (( $bysetposYold != $wdate['year'] )  ||
5154 5153
           ( $bysetposMold != $wdate['month'] ) ||
5155 5154
           ( $bysetposDold != $wdate['sday'] ))) {
5156
-          $bysetpos     = TRUE;
5157
-          $bysetposYold = $wdate['year'];
5158
-          $bysetposMold = $wdate['month'];
5159
-          $bysetposDold = $wdate['day'];
5155
+            $bysetpos     = TRUE;
5156
+            $bysetposYold = $wdate['year'];
5157
+            $bysetposMold = $wdate['month'];
5158
+            $bysetposDold = $wdate['day'];
5160 5159
         }
5161 5160
         if( $bysetpos ) {
5162
-          if( isset( $recur['BYWEEKNO'] )) {
5161
+            if( isset( $recur['BYWEEKNO'] )) {
5163 5162
             $bysetposarr1 = & $bysetposw1;
5164 5163
             $bysetposarr2 = & $bysetposw2;
5165
-          }
5166
-          else {
5164
+            }
5165
+            else {
5167 5166
             $bysetposarr1 = & $bysetposymd1;
5168 5167
             $bysetposarr2 = & $bysetposymd2;
5169
-          }
5170
-          foreach( $recur['BYSETPOS'] as $ix ) {
5168
+            }
5169
+            foreach( $recur['BYSETPOS'] as $ix ) {
5171 5170
             if( 0 > $ix ) // both positive and negative BYSETPOS allowed
5172
-              $ix = ( count( $bysetposarr1 ) + $ix + 1);
5171
+                $ix = ( count( $bysetposarr1 ) + $ix + 1);
5173 5172
             $ix--;
5174 5173
             if( isset( $bysetposarr1[$ix] )) {
5175
-              if( $startdatets <= $bysetposarr1[$ix] ) { // only output within period
5174
+                if( $startdatets <= $bysetposarr1[$ix] ) { // only output within period
5176 5175
                 $result[$bysetposarr1[$ix]] = TRUE;
5177
-       //echo "recur ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$bysetposarr1[$ix]),6))."<br />\n";//test
5178
-              }
5179
-              $countcnt++;
5176
+        //echo "recur ".implode('-',$this->_date_time_string(date('Y-m-d H:i:s',$bysetposarr1[$ix]),6))."<br />\n";//test
5177
+                }
5178
+                $countcnt++;
5180 5179
             }
5181 5180
             if( isset( $recur['COUNT'] ) && ( $countcnt >= $recur['COUNT'] ))
5182
-              break;
5183
-          }
5184
-          $bysetposarr1 = $bysetposarr2;
5185
-          $bysetposarr2 = array();
5181
+                break;
5182
+            }
5183
+            $bysetposarr1 = $bysetposarr2;
5184
+            $bysetposarr2 = array();
5185
+        }
5186 5186
         }
5187
-      }
5188 5187
     }
5189
-  }
5190
-  function _recurBYcntcheck( $BYvalue, $upValue, $downValue ) {
5188
+    }
5189
+    function _recurBYcntcheck( $BYvalue, $upValue, $downValue ) {
5191 5190
     if( is_array( $BYvalue ) &&
5192 5191
       ( in_array( $upValue, $BYvalue ) || in_array( $downValue, $BYvalue )))
5193
-      return TRUE;
5192
+        return TRUE;
5194 5193
     elseif(( $BYvalue == $upValue ) || ( $BYvalue == $downValue ))
5195
-      return TRUE;
5194
+        return TRUE;
5196 5195
     else
5197
-      return FALSE;
5198
-  }
5199
-  function _recurIntervalIx( $freq, $date, $wkst ) {
5196
+        return FALSE;
5197
+    }
5198
+    function _recurIntervalIx( $freq, $date, $wkst ) {
5200 5199
             /* create interval index */
5201 5200
     switch( $freq ) {
5202
-      case 'YEARLY':
5201
+        case 'YEARLY':
5203 5202
         $intervalix = $date['year'];
5204 5203
         break;
5205
-      case 'MONTHLY':
5204
+        case 'MONTHLY':
5206 5205
         $intervalix = $date['year'].'-'.$date['month'];
5207 5206
         break;
5208
-      case 'WEEKLY':
5207
+        case 'WEEKLY':
5209 5208
         $wdatets    = $this->_date2timestamp( $date );
5210 5209
         $intervalix = (int) date( 'W', ( $wdatets + $wkst ));
5211
-       break;
5212
-      case 'DAILY':
5210
+        break;
5211
+        case 'DAILY':
5213 5212
            default:
5214 5213
         $intervalix = $date['year'].'-'.$date['month'].'-'.$date['day'];
5215 5214
         break;
5216 5215
     }
5217 5216
     return $intervalix;
5218
-  }
5217
+    }
5219 5218
 /**
5220
- * convert input format for exrule and rrule to internal format
5221
- *
5222
- * @author Kjell-Inge Gustafsson <[email protected]>
5223
- * @since 2.4.16 - 2008-10-19
5224
- * @param array $rexrule
5225
- * @return array
5226
- */
5227
-  function _setRexrule( $rexrule ) {
5219
+     * convert input format for exrule and rrule to internal format
5220
+     *
5221
+     * @author Kjell-Inge Gustafsson <[email protected]>
5222
+     * @since 2.4.16 - 2008-10-19
5223
+     * @param array $rexrule
5224
+     * @return array
5225
+     */
5226
+    function _setRexrule( $rexrule ) {
5228 5227
     $input          = array();
5229 5228
     if( empty( $rexrule ))
5230
-      return $input;
5229
+        return $input;
5231 5230
     foreach( $rexrule as $rexrulelabel => $rexrulevalue ) {
5232
-      $rexrulelabel = strtoupper( $rexrulelabel );
5233
-      if( 'UNTIL'  != $rexrulelabel )
5231
+        $rexrulelabel = strtoupper( $rexrulelabel );
5232
+        if( 'UNTIL'  != $rexrulelabel )
5234 5233
         $input[$rexrulelabel]   = $rexrulevalue;
5235
-      else {
5234
+        else {
5236 5235
         if( $this->_isArrayTimestampDate( $rexrulevalue )) // timestamp date
5237
-          $input[$rexrulelabel] = $this->_timestamp2date( $rexrulevalue, 6 );
5236
+            $input[$rexrulelabel] = $this->_timestamp2date( $rexrulevalue, 6 );
5238 5237
         elseif( $this->_isArrayDate( $rexrulevalue )) // date-time
5239
-          $input[$rexrulelabel] = $this->_date_time_array( $rexrulevalue, 6 );
5238
+            $input[$rexrulelabel] = $this->_date_time_array( $rexrulevalue, 6 );
5240 5239
         elseif( 8 <= strlen( trim( $rexrulevalue ))) // ex. 2006-08-03 10:12:18
5241
-          $input[$rexrulelabel] = $this->_date_time_string( $rexrulevalue );
5240
+            $input[$rexrulelabel] = $this->_date_time_string( $rexrulevalue );
5242 5241
         if(( 3 < count( $input[$rexrulelabel] )) && !isset( $input[$rexrulelabel]['tz'] ))
5243
-          $input[$rexrulelabel]['tz'] = 'Z';
5244
-      }
5242
+            $input[$rexrulelabel]['tz'] = 'Z';
5243
+        }
5245 5244
     }
5246 5245
     return $input;
5247
-  }
5246
+    }
5248 5247
 /**
5249
- * convert format for input date to internal date with parameters
5250
- *
5251
- * @author Kjell-Inge Gustafsson <[email protected]>
5252
- * @since 2.4.17 - 2008-10-31
5253
- * @param mixed $year
5254
- * @param mixed $month optional
5255
- * @param int $day optional
5256
- * @param int $hour optional
5257
- * @param int $min optional
5258
- * @param int $sec optional
5259
- * @param array $params optional
5260
- * @param string $caller optional
5261
- * @return array
5262
- */
5263
-  function _setDate( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE, $caller=null ) {
5248
+     * convert format for input date to internal date with parameters
5249
+     *
5250
+     * @author Kjell-Inge Gustafsson <[email protected]>
5251
+     * @since 2.4.17 - 2008-10-31
5252
+     * @param mixed $year
5253
+     * @param mixed $month optional
5254
+     * @param int $day optional
5255
+     * @param int $hour optional
5256
+     * @param int $min optional
5257
+     * @param int $sec optional
5258
+     * @param array $params optional
5259
+     * @param string $caller optional
5260
+     * @return array
5261
+     */
5262
+    function _setDate( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE, $caller=null ) {
5264 5263
     $input = $parno = null;
5265 5264
     $localtime = (( 'dtstart' == $caller ) && in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' ))) ? TRUE : FALSE;
5266 5265
     if( $this->_isArrayDate( $year )) {
5267
-      if( $localtime ) unset ( $month['VALUE'], $month['TZID'] );
5268
-      $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ));
5269
-      if( isset( $input['params']['TZID'] )) {
5266
+        if( $localtime ) unset ( $month['VALUE'], $month['TZID'] );
5267
+        $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ));
5268
+        if( isset( $input['params']['TZID'] )) {
5270 5269
         $input['params']['VALUE'] = 'DATE-TIME';
5271 5270
         unset( $year['tz'] );
5272
-      }
5273
-      $hitval          = (( !empty( $year['tz'] ) || !empty( $year[6] ))) ? 7 : 6;
5274
-      $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval );
5275
-      $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3, count( $year ), $parno );
5276
-      $input['value']  = $this->_date_time_array( $year, $parno );
5271
+        }
5272
+        $hitval          = (( !empty( $year['tz'] ) || !empty( $year[6] ))) ? 7 : 6;
5273
+        $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval );
5274
+        $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3, count( $year ), $parno );
5275
+        $input['value']  = $this->_date_time_array( $year, $parno );
5277 5276
     }
5278 5277
     elseif( $this->_isArrayTimestampDate( $year )) {
5279
-      if( $localtime ) unset ( $month['VALUE'], $month['TZID'] );
5280
-      $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ));
5281
-      if( isset( $input['params']['TZID'] )) {
5278
+        if( $localtime ) unset ( $month['VALUE'], $month['TZID'] );
5279
+        $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ));
5280
+        if( isset( $input['params']['TZID'] )) {
5282 5281
         $input['params']['VALUE'] = 'DATE-TIME';
5283 5282
         unset( $year['tz'] );
5284
-      }
5285
-      $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3 );
5286
-      $hitval          = ( isset( $year['tz'] )) ? 7 : 6;
5287
-      $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval, $parno );
5288
-      $input['value']  = $this->_timestamp2date( $year, $parno );
5283
+        }
5284
+        $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3 );
5285
+        $hitval          = ( isset( $year['tz'] )) ? 7 : 6;
5286
+        $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval, $parno );
5287
+        $input['value']  = $this->_timestamp2date( $year, $parno );
5289 5288
     }
5290 5289
     elseif( 8 <= strlen( trim( $year ))) { // ex. 2006-08-03 10:12:18
5291
-      if( $localtime ) unset ( $month['VALUE'], $month['TZID'] );
5292
-      $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ));
5293
-      if( isset( $input['params']['TZID'] )) {
5290
+        if( $localtime ) unset ( $month['VALUE'], $month['TZID'] );
5291
+        $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ));
5292
+        if( isset( $input['params']['TZID'] )) {
5294 5293
         $input['params']['VALUE'] = 'DATE-TIME';
5295 5294
         $parno = 6;
5296
-      }
5297
-      $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', 7, $parno );
5298
-      $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3, $parno, $parno );
5299
-      $input['value']  = $this->_date_time_string( $year, $parno );
5295
+        }
5296
+        $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', 7, $parno );
5297
+        $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3, $parno, $parno );
5298
+        $input['value']  = $this->_date_time_string( $year, $parno );
5300 5299
     }
5301 5300
     else {
5302
-      if( is_array( $params )) {
5301
+        if( is_array( $params )) {
5303 5302
         if( $localtime ) unset ( $params['VALUE'], $params['TZID'] );
5304 5303
         $input['params'] = $this->_setParams( $params, array( 'VALUE' => 'DATE-TIME' ));
5305
-      }
5306
-      elseif( is_array( $tz )) {
5304
+        }
5305
+        elseif( is_array( $tz )) {
5307 5306
         $input['params'] = $this->_setParams( $tz,     array( 'VALUE' => 'DATE-TIME' ));
5308 5307
         $tz = FALSE;
5309
-      }
5310
-      elseif( is_array( $hour )) {
5308
+        }
5309
+        elseif( is_array( $hour )) {
5311 5310
         $input['params'] = $this->_setParams( $hour,   array( 'VALUE' => 'DATE-TIME' ));
5312 5311
         $hour = $min = $sec = $tz = FALSE;
5313
-      }
5314
-      if( isset( $input['params']['TZID'] )) {
5312
+        }
5313
+        if( isset( $input['params']['TZID'] )) {
5315 5314
         $tz            = null;
5316 5315
         $input['params']['VALUE'] = 'DATE-TIME';
5317
-      }
5318
-      $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3 );
5319
-      $hitval          = ( !empty( $tz )) ? 7 : 6;
5320
-      $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval, $parno, $parno );
5321
-      $input['value']  = array( 'year'  => $year, 'month' => $month, 'day'   => $day );
5322
-      if( 3 != $parno ) {
5316
+        }
5317
+        $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE', 3 );
5318
+        $hitval          = ( !empty( $tz )) ? 7 : 6;
5319
+        $parno           = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval, $parno, $parno );
5320
+        $input['value']  = array( 'year'  => $year, 'month' => $month, 'day'   => $day );
5321
+        if( 3 != $parno ) {
5323 5322
         $input['value']['hour'] = ( $hour ) ? $hour : '0';
5324 5323
         $input['value']['min']  = ( $min )  ? $min  : '0';
5325 5324
         $input['value']['sec']  = ( $sec )  ? $sec  : '0';
5326 5325
         if( !empty( $tz ))
5327
-          $input['value']['tz'] = $tz;
5328
-      }
5326
+            $input['value']['tz'] = $tz;
5327
+        }
5329 5328
     }
5330 5329
     if( 3 == $parno ) {
5331
-      $input['params']['VALUE'] = 'DATE';
5332
-      unset( $input['value']['tz'] );
5333
-      unset( $input['params']['TZID'] );
5330
+        $input['params']['VALUE'] = 'DATE';
5331
+        unset( $input['value']['tz'] );
5332
+        unset( $input['params']['TZID'] );
5334 5333
     }
5335 5334
     elseif( isset( $input['params']['TZID'] ))
5336
-      unset( $input['value']['tz'] );
5335
+        unset( $input['value']['tz'] );
5337 5336
     if( $localtime ) unset( $input['value']['tz'], $input['params']['TZID'] );
5338 5337
     if( isset( $input['value']['tz'] ))
5339
-      $input['value']['tz'] = (string) $input['value']['tz'];
5338
+        $input['value']['tz'] = (string) $input['value']['tz'];
5340 5339
     if( !empty( $input['value']['tz'] ) && ( 'Z' != $input['value']['tz'] ) &&
5341 5340
       ( !$this->_isOffset( $input['value']['tz'] )))
5342
-      $input['params']['TZID'] = $input['value']['tz'];
5341
+        $input['params']['TZID'] = $input['value']['tz'];
5343 5342
     return $input;
5344
-  }
5343
+    }
5345 5344
 /**
5346
- * convert format for input date (UTC) to internal date with parameters
5347
- *
5348
- * @author Kjell-Inge Gustafsson <[email protected]>
5349
- * @since 2.4.17 - 2008-10-31
5350
- * @param mixed $year
5351
- * @param mixed $month optional
5352
- * @param int $day optional
5353
- * @param int $hour optional
5354
- * @param int $min optional
5355
- * @param int $sec optional
5356
- * @param array $params optional
5357
- * @return array
5358
- */
5359
-  function _setDate2( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
5345
+     * convert format for input date (UTC) to internal date with parameters
5346
+     *
5347
+     * @author Kjell-Inge Gustafsson <[email protected]>
5348
+     * @since 2.4.17 - 2008-10-31
5349
+     * @param mixed $year
5350
+     * @param mixed $month optional
5351
+     * @param int $day optional
5352
+     * @param int $hour optional
5353
+     * @param int $min optional
5354
+     * @param int $sec optional
5355
+     * @param array $params optional
5356
+     * @return array
5357
+     */
5358
+    function _setDate2( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
5360 5359
     $input = null;
5361 5360
     if( $this->_isArrayDate( $year )) {
5362
-      $input['value']  = $this->_date_time_array( $year, 7 );
5363
-      $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) );
5361
+        $input['value']  = $this->_date_time_array( $year, 7 );
5362
+        $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) );
5364 5363
     }
5365 5364
     elseif( $this->_isArrayTimestampDate( $year )) {
5366
-      $input['value']  = $this->_timestamp2date( $year, 7 );
5367
-      $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) );
5365
+        $input['value']  = $this->_timestamp2date( $year, 7 );
5366
+        $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) );
5368 5367
     }
5369 5368
     elseif( 8 <= strlen( trim( $year ))) { // ex. 2006-08-03 10:12:18
5370
-      $input['value']  = $this->_date_time_string( $year, 7 );
5371
-      $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) );
5369
+        $input['value']  = $this->_date_time_string( $year, 7 );
5370
+        $input['params'] = $this->_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) );
5372 5371
     }
5373 5372
     else {
5374
-      $input['value']  = array( 'year'  => $year
5375
-                              , 'month' => $month
5376
-                              , 'day'   => $day
5377
-                              , 'hour'  => $hour
5378
-                              , 'min'   => $min
5379
-                              , 'sec'   => $sec );
5380
-      $input['params'] = $this->_setParams( $params, array( 'VALUE' => 'DATE-TIME' ));
5373
+        $input['value']  = array( 'year'  => $year
5374
+                                , 'month' => $month
5375
+                                , 'day'   => $day
5376
+                                , 'hour'  => $hour
5377
+                                , 'min'   => $min
5378
+                                , 'sec'   => $sec );
5379
+        $input['params'] = $this->_setParams( $params, array( 'VALUE' => 'DATE-TIME' ));
5381 5380
     }
5382 5381
     $parno = $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', 7 ); // remove default
5383 5382
     if( !isset( $input['value']['hour'] ))
5384
-      $input['value']['hour'] = 0;
5383
+        $input['value']['hour'] = 0;
5385 5384
     if( !isset( $input['value']['min'] ))
5386
-      $input['value']['min'] = 0;
5385
+        $input['value']['min'] = 0;
5387 5386
     if( !isset( $input['value']['sec'] ))
5388
-      $input['value']['sec'] = 0;
5387
+        $input['value']['sec'] = 0;
5389 5388
     if( !isset( $input['value']['tz'] ) || !$this->_isOffset( $input['value']['tz'] ))
5390
-      $input['value']['tz'] = 'Z';
5389
+        $input['value']['tz'] = 'Z';
5391 5390
     return $input;
5392
-  }
5391
+    }
5393 5392
 /**
5394
- * check index and set (an indexed) content in multiple value array
5395
- *
5396
- * @author Kjell-Inge Gustafsson <[email protected]>
5397
- * @since 2.5.1 - 2008-11-06
5398
- * @param array $valArr
5399
- * @param mixed $value
5400
- * @param array $params
5401
- * @param array $defaults
5402
- * @param int $index
5403
- * @return void
5404
- */
5405
-  function _setMval( & $valArr, $value, $params=FALSE, $defaults=FALSE, $index=FALSE ) {
5393
+     * check index and set (an indexed) content in multiple value array
5394
+     *
5395
+     * @author Kjell-Inge Gustafsson <[email protected]>
5396
+     * @since 2.5.1 - 2008-11-06
5397
+     * @param array $valArr
5398
+     * @param mixed $value
5399
+     * @param array $params
5400
+     * @param array $defaults
5401
+     * @param int $index
5402
+     * @return void
5403
+     */
5404
+    function _setMval( & $valArr, $value, $params=FALSE, $defaults=FALSE, $index=FALSE ) {
5406 5405
     if( !is_array( $valArr )) $valArr = array();
5407 5406
     if( $index )
5408
-      $index = $index - 1;
5407
+        $index = $index - 1;
5409 5408
     elseif( 0 < count( $valArr )) {
5410
-      $index = end( array_keys( $valArr ));
5411
-      $index += 1;
5409
+        $index = end( array_keys( $valArr ));
5410
+        $index += 1;
5412 5411
     }
5413 5412
     else
5414
-      $index = 0;
5413
+        $index = 0;
5415 5414
     $valArr[$index] = array( 'value' => $value, 'params' => $this->_setParams( $params, $defaults ));
5416 5415
     ksort( $valArr );
5417
-  }
5416
+    }
5418 5417
 /**
5419
- * set input (formatted) parameters- component property attributes
5420
- *
5421
- * default parameters can be set, if missing
5422
- *
5423
- * @author Kjell-Inge Gustafsson <[email protected]>
5424
- * @since 1.x.x - 2007-05-01
5425
- * @param array $params
5426
- * @param array $defaults
5427
- * @return array
5428
- */
5429
-  function _setParams( $params, $defaults=FALSE ) {
5418
+     * set input (formatted) parameters- component property attributes
5419
+     *
5420
+     * default parameters can be set, if missing
5421
+     *
5422
+     * @author Kjell-Inge Gustafsson <[email protected]>
5423
+     * @since 1.x.x - 2007-05-01
5424
+     * @param array $params
5425
+     * @param array $defaults
5426
+     * @return array
5427
+     */
5428
+    function _setParams( $params, $defaults=FALSE ) {
5430 5429
     if( !is_array( $params))
5431
-      $params = array();
5430
+        $params = array();
5432 5431
     $input = array();
5433 5432
     foreach( $params as $paramKey => $paramValue ) {
5434
-      if( is_array( $paramValue )) {
5433
+        if( is_array( $paramValue )) {
5435 5434
         foreach( $paramValue as $pkey => $pValue ) {
5436
-          if(( '"' == substr( $pValue, 0, 1 )) && ( '"' == substr( $pValue, -1 )))
5435
+            if(( '"' == substr( $pValue, 0, 1 )) && ( '"' == substr( $pValue, -1 )))
5437 5436
             $paramValue[$pkey] = substr( $pValue, 1, ( strlen( $pValue ) - 2 ));
5438 5437
         }
5439
-      }
5440
-      elseif(( '"' == substr( $paramValue, 0, 1 )) && ( '"' == substr( $paramValue, -1 )))
5438
+        }
5439
+        elseif(( '"' == substr( $paramValue, 0, 1 )) && ( '"' == substr( $paramValue, -1 )))
5441 5440
         $paramValue = substr( $paramValue, 1, ( strlen( $paramValue ) - 2 ));
5442
-      if( 'VALUE' == strtoupper( $paramKey ))
5441
+        if( 'VALUE' == strtoupper( $paramKey ))
5443 5442
         $input['VALUE']                 = strtoupper( $paramValue );
5444
-      else
5443
+        else
5445 5444
         $input[strtoupper( $paramKey )] = $paramValue;
5446 5445
     }
5447 5446
     if( is_array( $defaults )) {
5448
-      foreach( $defaults as $paramKey => $paramValue ) {
5447
+        foreach( $defaults as $paramKey => $paramValue ) {
5449 5448
         if( !isset( $input[$paramKey] ))
5450
-          $input[$paramKey] = $paramValue;
5451
-      }
5449
+            $input[$paramKey] = $paramValue;
5450
+        }
5452 5451
     }
5453 5452
     return (0 < count( $input )) ? $input : null;
5454
-  }
5453
+    }
5455 5454
 /**
5456
- * step date, return updated date, array and timpstamp
5457
- *
5458
- * @author Kjell-Inge Gustafsson <[email protected]>
5459
- * @since 2.4.16 - 2008-10-18
5460
- * @param array $date, date to step
5461
- * @param int $timestamp
5462
- * @param array $step, default array( 'day' => 1 )
5463
- * @return void
5464
- */
5465
-  function _stepdate( &$date, &$timestamp, $step=array( 'day' => 1 )) {
5455
+     * step date, return updated date, array and timpstamp
5456
+     *
5457
+     * @author Kjell-Inge Gustafsson <[email protected]>
5458
+     * @since 2.4.16 - 2008-10-18
5459
+     * @param array $date, date to step
5460
+     * @param int $timestamp
5461
+     * @param array $step, default array( 'day' => 1 )
5462
+     * @return void
5463
+     */
5464
+    function _stepdate( &$date, &$timestamp, $step=array( 'day' => 1 )) {
5466 5465
     foreach( $step as $stepix => $stepvalue )
5467
-      $date[$stepix] += $stepvalue;
5466
+        $date[$stepix] += $stepvalue;
5468 5467
     $timestamp  = $this->_date2timestamp( $date );
5469 5468
     $date       = $this->_timestamp2date( $timestamp, 6 );
5470 5469
     foreach( $date as $k => $v ) {
5471
-      if( ctype_digit( $v ))
5470
+        if( ctype_digit( $v ))
5472 5471
         $date[$k] = (int) $v;
5473 5472
     }
5474
-  }
5473
+    }
5475 5474
 /**
5476
- * convert timestamp to date array
5477
- *
5478
- * @author Kjell-Inge Gustafsson <[email protected]>
5479
- * @since 2.4.16 - 2008-11-01
5480
- * @param mixed $timestamp
5481
- * @param int $parno
5482
- * @return array
5483
- */
5484
-  function _timestamp2date( $timestamp, $parno=6 ) {
5475
+     * convert timestamp to date array
5476
+     *
5477
+     * @author Kjell-Inge Gustafsson <[email protected]>
5478
+     * @since 2.4.16 - 2008-11-01
5479
+     * @param mixed $timestamp
5480
+     * @param int $parno
5481
+     * @return array
5482
+     */
5483
+    function _timestamp2date( $timestamp, $parno=6 ) {
5485 5484
     if( is_array( $timestamp )) {
5486
-      if(( 7 == $parno ) && !empty( $timestamp['tz'] ))
5485
+        if(( 7 == $parno ) && !empty( $timestamp['tz'] ))
5487 5486
         $tz = $timestamp['tz'];
5488
-      $timestamp = $timestamp['timestamp'];
5487
+        $timestamp = $timestamp['timestamp'];
5489 5488
     }
5490 5489
     $output = array( 'year'  => date( 'Y', $timestamp )
5491
-                   , 'month' => date( 'm', $timestamp )
5492
-                   , 'day'   => date( 'd', $timestamp ));
5490
+                    , 'month' => date( 'm', $timestamp )
5491
+                    , 'day'   => date( 'd', $timestamp ));
5493 5492
     if( 3 != $parno ) {
5494
-             $output['hour'] =  date( 'H', $timestamp );
5495
-             $output['min']  =  date( 'i', $timestamp );
5496
-             $output['sec']  =  date( 's', $timestamp );
5497
-      if( isset( $tz ))
5493
+                $output['hour'] =  date( 'H', $timestamp );
5494
+                $output['min']  =  date( 'i', $timestamp );
5495
+                $output['sec']  =  date( 's', $timestamp );
5496
+        if( isset( $tz ))
5498 5497
         $output['tz'] = $tz;
5499 5498
     }
5500 5499
     return $output;
5501
-  }
5500
+    }
5502 5501
 /**
5503
- * convert (numeric) local time offset to seconds correcting localtime to GMT
5504
- *
5505
- * @author Kjell-Inge Gustafsson <[email protected]>
5506
- * @since 2.4.16 - 2008-10-19
5507
- * @param string $offset
5508
- * @return integer
5509
- */
5510
-  function _tz2offset( $tz ) {
5502
+     * convert (numeric) local time offset to seconds correcting localtime to GMT
5503
+     *
5504
+     * @author Kjell-Inge Gustafsson <[email protected]>
5505
+     * @since 2.4.16 - 2008-10-19
5506
+     * @param string $offset
5507
+     * @return integer
5508
+     */
5509
+    function _tz2offset( $tz ) {
5511 5510
     $tz           = trim( (string) $tz );
5512 5511
     $offset       = 0;
5513 5512
     if(((     5  != strlen( $tz )) && ( 7  != strlen( $tz ))) ||
5514 5513
        ((    '+' != substr( $tz, 0, 1 )) && ( '-' != substr( $tz, 0, 1 ))) ||
5515 5514
        (( '0000' >= substr( $tz, 1, 4 )) && ( '9999' < substr( $tz, 1, 4 ))) ||
5516 5515
            (( 7  == strlen( $tz )) && ( '00' > substr( $tz, 5, 2 )) && ( '99' < substr( $tz, 5, 2 ))))
5517
-      return $offset;
5516
+        return $offset;
5518 5517
     $hours2sec    = (int) substr( $tz, 1, 2 ) * 3600;
5519 5518
     $min2sec      = (int) substr( $tz, 3, 2 ) *   60;
5520 5519
     $sec          = ( 7  == strlen( $tz )) ? (int) substr( $tz, -2 ) : '00';
5521 5520
     $offset       = $hours2sec + $min2sec + $sec;
5522 5521
     $offset       = ('-' == substr( $tz, 0, 1 )) ? $offset : -1 * $offset;
5523 5522
     return $offset;
5524
-  }
5523
+    }
5525 5524
 /*********************************************************************************/
5526 5525
 /*********************************************************************************/
5527 5526
 /**
@@ -5532,16 +5531,16 @@  discard block
 block discarded – undo
5532 5531
  * @param string $config
5533 5532
  * @return value
5534 5533
  */
5535
-  function getConfig( $config ) {
5534
+    function getConfig( $config ) {
5536 5535
     switch( strtoupper( $config )) {
5537
-      case 'ALLOWEMPTY':
5536
+        case 'ALLOWEMPTY':
5538 5537
         return $this->allowEmpty;
5539 5538
         break;
5540
-      case 'COMPSINFO':
5539
+        case 'COMPSINFO':
5541 5540
         unset( $this->compix );
5542 5541
         $info = array();
5543 5542
         if( isset( $this->components )) {
5544
-          foreach( $this->components as $cix => $component ) {
5543
+            foreach( $this->components as $cix => $component ) {
5545 5544
             if( empty( $component )) continue;
5546 5545
             unset( $component->propix );
5547 5546
             $info[$cix]['ordno'] = $cix + 1;
@@ -5550,26 +5549,26 @@  discard block
 block discarded – undo
5550 5549
             $info[$cix]['props'] = $component->getConfig( 'propinfo' );
5551 5550
             $info[$cix]['sub']   = $component->getConfig( 'compsinfo' );
5552 5551
             unset( $component->propix );
5553
-          }
5552
+            }
5554 5553
         }
5555 5554
         return $info;
5556 5555
         break;
5557
-      case 'FORMAT':
5556
+        case 'FORMAT':
5558 5557
         return $this->format;
5559 5558
         break;
5560
-      case 'LANGUAGE':
5559
+        case 'LANGUAGE':
5561 5560
          // get language for calendar component as defined in [RFC 1766]
5562 5561
         return $this->language;
5563 5562
         break;
5564
-      case 'NL':
5563
+        case 'NL':
5565 5564
       case 'NEWLINECHAR':
5566 5565
         return $this->nl;
5567 5566
         break;
5568
-      case 'PROPINFO':
5567
+        case 'PROPINFO':
5569 5568
         $output = array();
5570 5569
         if( !in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' ))) {
5571
-          if( empty( $this->uid['value'] )) $this->_makeuid();
5572
-                                              $output['UID']              = 1;
5570
+            if( empty( $this->uid['value'] )) $this->_makeuid();
5571
+                                                $output['UID']              = 1;
5573 5572
         }
5574 5573
         if( !empty( $this->dtstamp ))         $output['DTSTAMP']          = 1;
5575 5574
         if( !empty( $this->summary ))         $output['SUMMARY']          = 1;
@@ -5616,51 +5615,51 @@  discard block
 block discarded – undo
5616 5615
         if( !empty( $this->xprop ))           $output['X-PROP']           = count( $this->xprop );
5617 5616
         return $output;
5618 5617
         break;
5619
-      case 'UNIQUE_ID':
5618
+        case 'UNIQUE_ID':
5620 5619
         if( empty( $this->unique_id ))
5621
-          $this->unique_id  = ( isset( $_SERVER['SERVER_NAME'] )) ? gethostbyname( $_SERVER['SERVER_NAME'] ) : 'localhost';
5620
+            $this->unique_id  = ( isset( $_SERVER['SERVER_NAME'] )) ? gethostbyname( $_SERVER['SERVER_NAME'] ) : 'localhost';
5622 5621
         return $this->unique_id;
5623 5622
         break;
5624 5623
     }
5625
-  }
5624
+    }
5626 5625
 /**
5627
- * general component config setting
5628
- *
5629
- * @author Kjell-Inge Gustafsson <[email protected]>
5630
- * @since 2.4.8 - 2008-10-24
5631
- * @param string $config
5632
- * @param string $value
5633
- * @return void
5634
- */
5635
-  function setConfig( $config, $value ) {
5626
+     * general component config setting
5627
+     *
5628
+     * @author Kjell-Inge Gustafsson <[email protected]>
5629
+     * @since 2.4.8 - 2008-10-24
5630
+     * @param string $config
5631
+     * @param string $value
5632
+     * @return void
5633
+     */
5634
+    function setConfig( $config, $value ) {
5636 5635
     $res = FALSE;
5637 5636
     switch( strtoupper( $config )) {
5638
-      case 'ALLOWEMPTY':
5637
+        case 'ALLOWEMPTY':
5639 5638
         $this->allowEmpty = $value;
5640 5639
         $subcfg = array( 'ALLOWEMPTY' => $value );
5641 5640
         $res    = TRUE;
5642 5641
         break;
5643
-      case 'FORMAT':
5642
+        case 'FORMAT':
5644 5643
         $value  = trim( $value );
5645 5644
         $this->format = $value;
5646 5645
         $this->_createFormat();
5647 5646
         $subcfg = array( 'FORMAT' => $value );
5648 5647
         $res    = TRUE;
5649 5648
         break;
5650
-      case 'LANGUAGE':
5649
+        case 'LANGUAGE':
5651 5650
          // set language for calendar component as defined in [RFC 1766]
5652 5651
         $value  = trim( $value );
5653 5652
         $this->language = $value;
5654 5653
         $subcfg = array( 'LANGUAGE' => $value );
5655 5654
         $res    = TRUE;
5656 5655
         break;
5657
-      case 'NL':
5656
+        case 'NL':
5658 5657
       case 'NEWLINECHAR':
5659 5658
         $this->nl = $value;
5660 5659
         $subcfg = array( 'NL' => $value );
5661 5660
         $res    = TRUE;
5662 5661
         break;
5663
-      case 'UNIQUE_ID':
5662
+        case 'UNIQUE_ID':
5664 5663
         $value  = trim( $value );
5665 5664
         $this->unique_id = $value;
5666 5665
         $subcfg = array( 'UNIQUE_ID' => $value );
@@ -5669,17 +5668,17 @@  discard block
 block discarded – undo
5669 5668
     }
5670 5669
     if( !$res ) return FALSE;
5671 5670
     if( isset( $subcfg ) && !empty( $this->components )) {
5672
-      foreach( $subcfg as $cfgkey => $cfgvalue ) {
5671
+        foreach( $subcfg as $cfgkey => $cfgvalue ) {
5673 5672
         foreach( $this->components as $cix => $component ) {
5674
-          $res = $component->setConfig( $cfgkey, $cfgvalue );
5675
-          if( !$res )
5673
+            $res = $component->setConfig( $cfgkey, $cfgvalue );
5674
+            if( !$res )
5676 5675
             break 2;
5677
-          $this->components[$cix] = $component; // PHP4 compliant
5676
+            $this->components[$cix] = $component; // PHP4 compliant
5677
+        }
5678 5678
         }
5679
-      }
5680 5679
     }
5681 5680
     return $res;
5682
-  }
5681
+    }
5683 5682
 /*********************************************************************************/
5684 5683
 /**
5685 5684
  * delete component property value
@@ -5690,257 +5689,257 @@  discard block
 block discarded – undo
5690 5689
  * @param int @propix, optional, if specific property is wanted in case of multiply occurences
5691 5690
  * @return bool, if successfull delete TRUE
5692 5691
  */
5693
-  function deleteProperty( $propName, $propix=FALSE ) {
5692
+    function deleteProperty( $propName, $propix=FALSE ) {
5694 5693
     if( $this->_notExistProp( $propName )) return FALSE;
5695 5694
     $propName = strtoupper( $propName );
5696 5695
     if( in_array( $propName, array( 'ATTACH',   'ATTENDEE', 'CATEGORIES', 'COMMENT',   'CONTACT', 'DESCRIPTION',    'EXDATE', 'EXRULE',
5697 5696
                                     'FREEBUSY', 'RDATE',    'RELATED-TO', 'RESOURCES', 'RRULE',   'REQUEST-STATUS', 'TZNAME', 'X-PROP'  ))) {
5698
-      if( !$propix )
5697
+        if( !$propix )
5699 5698
         $propix = ( isset( $this->propdelix[$propName] )) ? $this->propdelix[$propName] + 2 : 1;
5700
-      $this->propdelix[$propName] = --$propix;
5699
+        $this->propdelix[$propName] = --$propix;
5701 5700
     }
5702 5701
     $return = FALSE;
5703 5702
     switch( $propName ) {
5704
-      case 'ACTION':
5703
+        case 'ACTION':
5705 5704
         if( !empty( $this->action )) {
5706
-          $this->action = '';
5707
-          $return = TRUE;
5705
+            $this->action = '';
5706
+            $return = TRUE;
5708 5707
         }
5709 5708
         break;
5710
-      case 'ATTACH':
5709
+        case 'ATTACH':
5711 5710
         return $this->deletePropertyM( $this->attach, $propix );
5712 5711
         break;
5713
-      case 'ATTENDEE':
5712
+        case 'ATTENDEE':
5714 5713
         return $this->deletePropertyM( $this->attendee, $propix );
5715 5714
         break;
5716
-      case 'CATEGORIES':
5715
+        case 'CATEGORIES':
5717 5716
         return $this->deletePropertyM( $this->categories, $propix );
5718 5717
         break;
5719
-      case 'CLASS':
5718
+        case 'CLASS':
5720 5719
         if( !empty( $this->class )) {
5721
-          $this->class = '';
5722
-          $return = TRUE;
5720
+            $this->class = '';
5721
+            $return = TRUE;
5723 5722
         }
5724 5723
         break;
5725
-      case 'COMMENT':
5724
+        case 'COMMENT':
5726 5725
         return $this->deletePropertyM( $this->comment, $propix );
5727 5726
         break;
5728
-      case 'COMPLETED':
5727
+        case 'COMPLETED':
5729 5728
         if( !empty( $this->completed )) {
5730
-          $this->completed = '';
5731
-          $return = TRUE;
5729
+            $this->completed = '';
5730
+            $return = TRUE;
5732 5731
         }
5733 5732
         break;
5734
-      case 'CONTACT':
5733
+        case 'CONTACT':
5735 5734
         return $this->deletePropertyM( $this->contact, $propix );
5736 5735
         break;
5737
-      case 'CREATED':
5736
+        case 'CREATED':
5738 5737
         if( !empty( $this->created )) {
5739
-          $this->created = '';
5740
-          $return = TRUE;
5738
+            $this->created = '';
5739
+            $return = TRUE;
5741 5740
         }
5742 5741
         break;
5743
-      case 'DESCRIPTION':
5742
+        case 'DESCRIPTION':
5744 5743
         return $this->deletePropertyM( $this->description, $propix );
5745 5744
         break;
5746
-      case 'DTEND':
5745
+        case 'DTEND':
5747 5746
         if( !empty( $this->dtend )) {
5748
-          $this->dtend = '';
5749
-          $return = TRUE;
5747
+            $this->dtend = '';
5748
+            $return = TRUE;
5750 5749
         }
5751 5750
         break;
5752
-      case 'DTSTAMP':
5751
+        case 'DTSTAMP':
5753 5752
         if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' )))
5754
-          return FALSE;
5753
+            return FALSE;
5755 5754
         if( !empty( $this->dtstamp )) {
5756
-          $this->dtstamp = '';
5757
-          $return = TRUE;
5755
+            $this->dtstamp = '';
5756
+            $return = TRUE;
5758 5757
         }
5759 5758
         break;
5760
-      case 'DTSTART':
5759
+        case 'DTSTART':
5761 5760
         if( !empty( $this->dtstart )) {
5762
-          $this->dtstart = '';
5763
-          $return = TRUE;
5761
+            $this->dtstart = '';
5762
+            $return = TRUE;
5764 5763
         }
5765 5764
         break;
5766
-      case 'DUE':
5765
+        case 'DUE':
5767 5766
         if( !empty( $this->due )) {
5768
-          $this->due = '';
5769
-          $return = TRUE;
5767
+            $this->due = '';
5768
+            $return = TRUE;
5770 5769
         }
5771 5770
         break;
5772
-      case 'DURATION':
5771
+        case 'DURATION':
5773 5772
         if( !empty( $this->duration )) {
5774
-          $this->duration = '';
5775
-          $return = TRUE;
5773
+            $this->duration = '';
5774
+            $return = TRUE;
5776 5775
         }
5777 5776
         break;
5778
-      case 'EXDATE':
5777
+        case 'EXDATE':
5779 5778
         return $this->deletePropertyM( $this->exdate, $propix );
5780 5779
         break;
5781
-      case 'EXRULE':
5780
+        case 'EXRULE':
5782 5781
         return $this->deletePropertyM( $this->exrule, $propix );
5783 5782
         break;
5784
-      case 'FREEBUSY':
5783
+        case 'FREEBUSY':
5785 5784
         return $this->deletePropertyM( $this->freebusy, $propix );
5786 5785
         break;
5787
-      case 'GEO':
5786
+        case 'GEO':
5788 5787
         if( !empty( $this->geo )) {
5789
-          $this->geo = '';
5790
-          $return = TRUE;
5788
+            $this->geo = '';
5789
+            $return = TRUE;
5791 5790
         }
5792 5791
         break;
5793
-      case 'LAST-MODIFIED':
5792
+        case 'LAST-MODIFIED':
5794 5793
         if( !empty( $this->lastmodified )) {
5795
-          $this->lastmodified = '';
5796
-          $return = TRUE;
5794
+            $this->lastmodified = '';
5795
+            $return = TRUE;
5797 5796
         }
5798 5797
         break;
5799
-      case 'LOCATION':
5798
+        case 'LOCATION':
5800 5799
         if( !empty( $this->location )) {
5801
-          $this->location = '';
5802
-          $return = TRUE;
5800
+            $this->location = '';
5801
+            $return = TRUE;
5803 5802
         }
5804 5803
         break;
5805
-      case 'ORGANIZER':
5804
+        case 'ORGANIZER':
5806 5805
         if( !empty( $this->organizer )) {
5807
-          $this->organizer = '';
5808
-          $return = TRUE;
5806
+            $this->organizer = '';
5807
+            $return = TRUE;
5809 5808
         }
5810 5809
         break;
5811
-      case 'PERCENT-COMPLETE':
5810
+        case 'PERCENT-COMPLETE':
5812 5811
         if( !empty( $this->percentcomplete )) {
5813
-          $this->percentcomplete = '';
5814
-          $return = TRUE;
5812
+            $this->percentcomplete = '';
5813
+            $return = TRUE;
5815 5814
         }
5816 5815
         break;
5817
-      case 'PRIORITY':
5816
+        case 'PRIORITY':
5818 5817
         if( !empty( $this->priority )) {
5819
-          $this->priority = '';
5820
-          $return = TRUE;
5818
+            $this->priority = '';
5819
+            $return = TRUE;
5821 5820
         }
5822 5821
         break;
5823
-      case 'RDATE':
5822
+        case 'RDATE':
5824 5823
         return $this->deletePropertyM( $this->rdate, $propix );
5825 5824
         break;
5826
-      case 'RECURRENCE-ID':
5825
+        case 'RECURRENCE-ID':
5827 5826
         if( !empty( $this->recurrenceid )) {
5828
-          $this->recurrenceid = '';
5829
-          $return = TRUE;
5827
+            $this->recurrenceid = '';
5828
+            $return = TRUE;
5830 5829
         }
5831 5830
         break;
5832
-      case 'RELATED-TO':
5831
+        case 'RELATED-TO':
5833 5832
         return $this->deletePropertyM( $this->relatedto, $propix );
5834 5833
         break;
5835
-      case 'REPEAT':
5834
+        case 'REPEAT':
5836 5835
         if( !empty( $this->repeat )) {
5837
-          $this->repeat = '';
5838
-          $return = TRUE;
5836
+            $this->repeat = '';
5837
+            $return = TRUE;
5839 5838
         }
5840 5839
         break;
5841
-      case 'REQUEST-STATUS':
5840
+        case 'REQUEST-STATUS':
5842 5841
         return $this->deletePropertyM( $this->requeststatus, $propix );
5843 5842
         break;
5844
-      case 'RESOURCES':
5843
+        case 'RESOURCES':
5845 5844
         return $this->deletePropertyM( $this->resources, $propix );
5846 5845
         break;
5847
-      case 'RRULE':
5846
+        case 'RRULE':
5848 5847
         return $this->deletePropertyM( $this->rrule, $propix );
5849 5848
         break;
5850
-      case 'SEQUENCE':
5849
+        case 'SEQUENCE':
5851 5850
         if( !empty( $this->sequence )) {
5852
-          $this->sequence = '';
5853
-          $return = TRUE;
5851
+            $this->sequence = '';
5852
+            $return = TRUE;
5854 5853
         }
5855 5854
         break;
5856
-      case 'STATUS':
5855
+        case 'STATUS':
5857 5856
         if( !empty( $this->status )) {
5858
-          $this->status = '';
5859
-          $return = TRUE;
5857
+            $this->status = '';
5858
+            $return = TRUE;
5860 5859
         }
5861 5860
         break;
5862
-      case 'SUMMARY':
5861
+        case 'SUMMARY':
5863 5862
         if( !empty( $this->summary )) {
5864
-          $this->summary = '';
5865
-          $return = TRUE;
5863
+            $this->summary = '';
5864
+            $return = TRUE;
5866 5865
         }
5867 5866
         break;
5868
-      case 'TRANSP':
5867
+        case 'TRANSP':
5869 5868
         if( !empty( $this->transp )) {
5870
-          $this->transp = '';
5871
-          $return = TRUE;
5869
+            $this->transp = '';
5870
+            $return = TRUE;
5872 5871
         }
5873 5872
         break;
5874
-      case 'TRIGGER':
5873
+        case 'TRIGGER':
5875 5874
         if( !empty( $this->trigger )) {
5876
-          $this->trigger = '';
5877
-          $return = TRUE;
5875
+            $this->trigger = '';
5876
+            $return = TRUE;
5878 5877
         }
5879 5878
         break;
5880
-      case 'TZID':
5879
+        case 'TZID':
5881 5880
         if( !empty( $this->tzid )) {
5882
-          $this->tzid = '';
5883
-          $return = TRUE;
5881
+            $this->tzid = '';
5882
+            $return = TRUE;
5884 5883
         }
5885 5884
         break;
5886
-      case 'TZNAME':
5885
+        case 'TZNAME':
5887 5886
         return $this->deletePropertyM( $this->tzname, $propix );
5888 5887
         break;
5889
-      case 'TZOFFSETFROM':
5888
+        case 'TZOFFSETFROM':
5890 5889
         if( !empty( $this->tzoffsetfrom )) {
5891
-          $this->tzoffsetfrom = '';
5892
-          $return = TRUE;
5890
+            $this->tzoffsetfrom = '';
5891
+            $return = TRUE;
5893 5892
         }
5894 5893
         break;
5895
-      case 'TZOFFSETTO':
5894
+        case 'TZOFFSETTO':
5896 5895
         if( !empty( $this->tzoffsetto )) {
5897
-          $this->tzoffsetto = '';
5898
-          $return = TRUE;
5896
+            $this->tzoffsetto = '';
5897
+            $return = TRUE;
5899 5898
         }
5900 5899
         break;
5901
-      case 'TZURL':
5900
+        case 'TZURL':
5902 5901
         if( !empty( $this->tzurl )) {
5903
-          $this->tzurl = '';
5904
-          $return = TRUE;
5902
+            $this->tzurl = '';
5903
+            $return = TRUE;
5905 5904
         }
5906 5905
         break;
5907
-      case 'UID':
5906
+        case 'UID':
5908 5907
         if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' )))
5909
-          return FALSE;
5908
+            return FALSE;
5910 5909
         if( !empty( $this->uid )) {
5911
-          $this->uid = '';
5912
-          $return = TRUE;
5910
+            $this->uid = '';
5911
+            $return = TRUE;
5913 5912
         }
5914 5913
         break;
5915
-      case 'URL':
5914
+        case 'URL':
5916 5915
         if( !empty( $this->url )) {
5917
-          $this->url = '';
5918
-          $return = TRUE;
5916
+            $this->url = '';
5917
+            $return = TRUE;
5919 5918
         }
5920 5919
         break;
5921
-      default:
5920
+        default:
5922 5921
         $reduced = '';
5923 5922
         if( $propName != 'X-PROP' ) {
5924
-          if( !isset( $this->xprop[$propName] )) return FALSE;
5925
-          foreach( $this->xprop as $k => $a ) {
5923
+            if( !isset( $this->xprop[$propName] )) return FALSE;
5924
+            foreach( $this->xprop as $k => $a ) {
5926 5925
             if(( $k != $propName ) && !empty( $a ))
5927
-              $reduced[$k] = $a;
5928
-          }
5926
+                $reduced[$k] = $a;
5927
+            }
5929 5928
         }
5930 5929
         else {
5931
-          if( count( $this->xprop ) <= $propix )  return FALSE;
5932
-          $xpropno = 0;
5933
-          foreach( $this->xprop as $xpropkey => $xpropvalue ) {
5930
+            if( count( $this->xprop ) <= $propix )  return FALSE;
5931
+            $xpropno = 0;
5932
+            foreach( $this->xprop as $xpropkey => $xpropvalue ) {
5934 5933
             if( $propix != $xpropno )
5935
-              $reduced[$xpropkey] = $xpropvalue;
5934
+                $reduced[$xpropkey] = $xpropvalue;
5936 5935
             $xpropno++;
5937
-          }
5936
+            }
5938 5937
         }
5939 5938
         $this->xprop = $reduced;
5940 5939
         return TRUE;
5941 5940
     }
5942 5941
     return $return;
5943
-  }
5942
+    }
5944 5943
 /*********************************************************************************/
5945 5944
 /**
5946 5945
  * delete component property value, fixing components with multiple occurencies
@@ -5951,324 +5950,324 @@  discard block
 block discarded – undo
5951 5950
  * @param int @propix, default 0
5952 5951
  * @return bool TRUE
5953 5952
  */
5954
-  function deletePropertyM( & $multiprop, $propix=0 ) {
5953
+    function deletePropertyM( & $multiprop, $propix=0 ) {
5955 5954
     if( !isset( $multiprop[$propix])) return FALSE;
5956 5955
     unset( $multiprop[$propix] );
5957 5956
     if( empty( $multiprop )) $multiprop = '';
5958 5957
     return ( isset( $this->multiprop[$propix] )) ? FALSE : TRUE;
5959
-  }
5958
+    }
5960 5959
 /**
5961
- * get component property value/params
5962
- *
5963
- * if property has multiply values, consequtive function calls are needed
5964
- *
5965
- * @author Kjell-Inge Gustafsson <[email protected]>
5966
- * @since 2.5.1 - 2008-11-02
5967
- * @param string $propName, optional
5968
- * @param int @propix, optional, if specific property is wanted in case of multiply occurences
5969
- * @param bool $inclParam=FALSE
5970
- * @param bool $specform=FALSE
5971
- * @return mixed
5972
- */
5973
-  function getProperty( $propName=FALSE, $propix=FALSE, $inclParam=FALSE, $specform=FALSE ) {
5960
+     * get component property value/params
5961
+     *
5962
+     * if property has multiply values, consequtive function calls are needed
5963
+     *
5964
+     * @author Kjell-Inge Gustafsson <[email protected]>
5965
+     * @since 2.5.1 - 2008-11-02
5966
+     * @param string $propName, optional
5967
+     * @param int @propix, optional, if specific property is wanted in case of multiply occurences
5968
+     * @param bool $inclParam=FALSE
5969
+     * @param bool $specform=FALSE
5970
+     * @return mixed
5971
+     */
5972
+    function getProperty( $propName=FALSE, $propix=FALSE, $inclParam=FALSE, $specform=FALSE ) {
5974 5973
     if( $this->_notExistProp( $propName )) return FALSE;
5975 5974
     $propName = ( $propName ) ? strtoupper( $propName ) : 'X-PROP';
5976 5975
     if( in_array( $propName, array( 'ATTACH',   'ATTENDEE', 'CATEGORIES', 'COMMENT',   'CONTACT', 'DESCRIPTION',    'EXDATE', 'EXRULE',
5977 5976
                                     'FREEBUSY', 'RDATE',    'RELATED-TO', 'RESOURCES', 'RRULE',   'REQUEST-STATUS', 'TZNAME', 'X-PROP'  ))) {
5978
-      if( !$propix )
5977
+        if( !$propix )
5979 5978
         $propix = ( isset( $this->propix[$propName] )) ? $this->propix[$propName] + 2 : 1;
5980
-      $this->propix[$propName] = --$propix;
5979
+        $this->propix[$propName] = --$propix;
5981 5980
     }
5982 5981
     switch( $propName ) {
5983
-      case 'ACTION':
5982
+        case 'ACTION':
5984 5983
         if( !empty( $this->action['value'] )) return ( $inclParam ) ? $this->action : $this->action['value'];
5985 5984
         break;
5986
-      case 'ATTACH':
5985
+        case 'ATTACH':
5987 5986
         if( !isset( $this->attach[$propix] )) return FALSE;
5988 5987
         return ( $inclParam ) ? $this->attach[$propix] : $this->attach[$propix]['value'];
5989 5988
         break;
5990
-      case 'ATTENDEE':
5989
+        case 'ATTENDEE':
5991 5990
         if( !isset( $this->attendee[$propix] )) return FALSE;
5992 5991
         return ( $inclParam ) ? $this->attendee[$propix] : $this->attendee[$propix]['value'];
5993 5992
         break;
5994
-      case 'CATEGORIES':
5993
+        case 'CATEGORIES':
5995 5994
         if( !isset( $this->categories[$propix] )) return FALSE;
5996 5995
         return ( $inclParam ) ? $this->categories[$propix] : $this->categories[$propix]['value'];
5997 5996
         break;
5998
-      case 'CLASS':
5997
+        case 'CLASS':
5999 5998
         if( !empty( $this->class['value'] )) return ( $inclParam ) ? $this->class : $this->class['value'];
6000 5999
         break;
6001
-      case 'COMMENT':
6000
+        case 'COMMENT':
6002 6001
         if( !isset( $this->comment[$propix] )) return FALSE;
6003 6002
         return ( $inclParam ) ? $this->comment[$propix] : $this->comment[$propix]['value'];
6004 6003
         break;
6005
-      case 'COMPLETED':
6004
+        case 'COMPLETED':
6006 6005
         if( !empty( $this->completed['value'] )) return ( $inclParam ) ? $this->completed : $this->completed['value'];
6007 6006
         break;
6008
-      case 'CONTACT':
6007
+        case 'CONTACT':
6009 6008
         if( !isset( $this->contact[$propix] )) return FALSE;
6010 6009
         return ( $inclParam ) ? $this->contact[$propix] : $this->contact[$propix]['value'];
6011 6010
         break;
6012
-      case 'CREATED':
6011
+        case 'CREATED':
6013 6012
         if( !empty( $this->created['value'] )) return ( $inclParam ) ? $this->created : $this->created['value'];
6014 6013
         break;
6015
-      case 'DESCRIPTION':
6014
+        case 'DESCRIPTION':
6016 6015
         if( !isset( $this->description[$propix] )) return FALSE;
6017 6016
         return ( $inclParam ) ? $this->description[$propix] : $this->description[$propix]['value'];
6018 6017
         break;
6019
-      case 'DTEND':
6018
+        case 'DTEND':
6020 6019
         if( !empty( $this->dtend['value'] )) return ( $inclParam ) ? $this->dtend : $this->dtend['value'];
6021 6020
         break;
6022
-      case 'DTSTAMP':
6021
+        case 'DTSTAMP':
6023 6022
         if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' )))
6024
-          return;
6023
+            return;
6025 6024
         if( !isset( $this->dtstamp['value'] ))
6026
-          $this->_makeDtstamp();
6025
+            $this->_makeDtstamp();
6027 6026
         return ( $inclParam ) ? $this->dtstamp : $this->dtstamp['value'];
6028 6027
         break;
6029
-      case 'DTSTART':
6028
+        case 'DTSTART':
6030 6029
         if( !empty( $this->dtstart['value'] )) return ( $inclParam ) ? $this->dtstart : $this->dtstart['value'];
6031 6030
         break;
6032
-      case 'DUE':
6031
+        case 'DUE':
6033 6032
         if( !empty( $this->due['value'] )) return ( $inclParam ) ? $this->due : $this->due['value'];
6034 6033
         break;
6035
-      case 'DURATION':
6034
+        case 'DURATION':
6036 6035
         if( !isset( $this->duration['value'] )) return FALSE;
6037 6036
         $value = ( $specform ) ? $this->duration2date() : $this->duration['value'];
6038 6037
         return ( $inclParam ) ? array( 'value' => $value, 'params' =>  $this->duration['params'] ) : $value;
6039 6038
         break;
6040
-      case 'EXDATE':
6039
+        case 'EXDATE':
6041 6040
         if( !isset( $this->exdate[$propix] )) return FALSE;
6042 6041
         return ( $inclParam ) ? $this->exdate[$propix] : $this->exdate[$propix]['value'];
6043 6042
         break;
6044
-      case 'EXRULE':
6043
+        case 'EXRULE':
6045 6044
         if( !isset( $this->exrule[$propix] )) return FALSE;
6046 6045
         return ( $inclParam ) ? $this->exrule[$propix] : $this->exrule[$propix]['value'];
6047 6046
         break;
6048
-      case 'FREEBUSY':
6047
+        case 'FREEBUSY':
6049 6048
         if( !isset( $this->freebusy[$propix] )) return FALSE;
6050 6049
         return ( $inclParam ) ? $this->freebusy[$propix] : $this->freebusy[$propix]['value'];
6051 6050
         break;
6052
-      case 'GEO':
6051
+        case 'GEO':
6053 6052
         if( !empty( $this->geo['value'] )) return ( $inclParam ) ? $this->geo : $this->geo['value'];
6054 6053
         break;
6055
-      case 'LAST-MODIFIED':
6054
+        case 'LAST-MODIFIED':
6056 6055
         if( !empty( $this->lastmodified['value'] )) return ( $inclParam ) ? $this->lastmodified : $this->lastmodified['value'];
6057 6056
         break;
6058
-      case 'LOCATION':
6057
+        case 'LOCATION':
6059 6058
         if( !empty( $this->location['value'] )) return ( $inclParam ) ? $this->location : $this->location['value'];
6060 6059
         break;
6061
-      case 'ORGANIZER':
6060
+        case 'ORGANIZER':
6062 6061
         if( !empty( $this->organizer['value'] )) return ( $inclParam ) ? $this->organizer : $this->organizer['value'];
6063 6062
         break;
6064
-      case 'PERCENT-COMPLETE':
6063
+        case 'PERCENT-COMPLETE':
6065 6064
         if( !empty( $this->percentcomplete['value'] )) return ( $inclParam ) ? $this->percentcomplete : $this->percentcomplete['value'];
6066 6065
         break;
6067
-      case 'PRIORITY':
6066
+        case 'PRIORITY':
6068 6067
         if( !empty( $this->priority['value'] )) return ( $inclParam ) ? $this->priority : $this->priority['value'];
6069 6068
         break;
6070
-      case 'RDATE':
6069
+        case 'RDATE':
6071 6070
         if( !isset( $this->rdate[$propix] )) return FALSE;
6072 6071
         return ( $inclParam ) ? $this->rdate[$propix] : $this->rdate[$propix]['value'];
6073 6072
         break;
6074
-      case 'RECURRENCE-ID':
6073
+        case 'RECURRENCE-ID':
6075 6074
         if( !empty( $this->recurrenceid['value'] )) return ( $inclParam ) ? $this->recurrenceid : $this->recurrenceid['value'];
6076 6075
         break;
6077
-      case 'RELATED-TO':
6076
+        case 'RELATED-TO':
6078 6077
         if( !isset( $this->relatedto[$propix] )) return FALSE;
6079 6078
         return ( $inclParam ) ? $this->relatedto[$propix] : $this->relatedto[$propix]['value'];
6080 6079
         break;
6081
-      case 'REPEAT':
6080
+        case 'REPEAT':
6082 6081
         if( !empty( $this->repeat['value'] )) return ( $inclParam ) ? $this->repeat : $this->repeat['value'];
6083 6082
         break;
6084
-      case 'REQUEST-STATUS':
6083
+        case 'REQUEST-STATUS':
6085 6084
         if( !isset( $this->requeststatus[$propix] )) return FALSE;
6086 6085
         return ( $inclParam ) ? $this->requeststatus[$propix] : $this->requeststatus[$propix]['value'];
6087 6086
         break;
6088
-      case 'RESOURCES':
6087
+        case 'RESOURCES':
6089 6088
         if( !isset( $this->resources[$propix] )) return FALSE;
6090 6089
         return ( $inclParam ) ? $this->resources[$propix] : $this->resources[$propix]['value'];
6091 6090
         break;
6092
-      case 'RRULE':
6091
+        case 'RRULE':
6093 6092
         if( !isset( $this->rrule[$propix] )) return FALSE;
6094 6093
         return ( $inclParam ) ? $this->rrule[$propix] : $this->rrule[$propix]['value'];
6095 6094
         break;
6096
-      case 'SEQUENCE':
6095
+        case 'SEQUENCE':
6097 6096
         if( !empty( $this->sequence['value'] )) return ( $inclParam ) ? $this->sequence : $this->sequence['value'];
6098 6097
         break;
6099
-      case 'STATUS':
6098
+        case 'STATUS':
6100 6099
         if( !empty( $this->status['value'] )) return ( $inclParam ) ? $this->status : $this->status['value'];
6101 6100
         break;
6102
-      case 'SUMMARY':
6101
+        case 'SUMMARY':
6103 6102
         if( !empty( $this->summary['value'] )) return ( $inclParam ) ? $this->summary : $this->summary['value'];
6104 6103
         break;
6105
-      case 'TRANSP':
6104
+        case 'TRANSP':
6106 6105
         if( !empty( $this->transp['value'] )) return ( $inclParam ) ? $this->transp : $this->transp['value'];
6107 6106
         break;
6108
-      case 'TRIGGER':
6107
+        case 'TRIGGER':
6109 6108
         if( !empty( $this->trigger['value'] )) return ( $inclParam ) ? $this->trigger : $this->trigger['value'];
6110 6109
         break;
6111
-      case 'TZID':
6110
+        case 'TZID':
6112 6111
         if( !empty( $this->tzid['value'] )) return ( $inclParam ) ? $this->tzid : $this->tzid['value'];
6113 6112
         break;
6114
-      case 'TZNAME':
6113
+        case 'TZNAME':
6115 6114
         if( !isset( $this->tzname[$propix] )) return FALSE;
6116 6115
         return ( $inclParam ) ? $this->tzname[$propix] : $this->tzname[$propix]['value'];
6117 6116
         break;
6118
-      case 'TZOFFSETFROM':
6117
+        case 'TZOFFSETFROM':
6119 6118
         if( !empty( $this->tzoffsetfrom['value'] )) return ( $inclParam ) ? $this->tzoffsetfrom : $this->tzoffsetfrom['value'];
6120 6119
         break;
6121
-      case 'TZOFFSETTO':
6120
+        case 'TZOFFSETTO':
6122 6121
         if( !empty( $this->tzoffsetto['value'] )) return ( $inclParam ) ? $this->tzoffsetto : $this->tzoffsetto['value'];
6123 6122
         break;
6124
-      case 'TZURL':
6123
+        case 'TZURL':
6125 6124
         if( !empty( $this->tzurl['value'] )) return ( $inclParam ) ? $this->tzurl : $this->tzurl['value'];
6126 6125
         break;
6127
-      case 'UID':
6126
+        case 'UID':
6128 6127
         if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' )))
6129
-          return FALSE;
6128
+            return FALSE;
6130 6129
         if( empty( $this->uid['value'] ))
6131
-          $this->_makeuid();
6130
+            $this->_makeuid();
6132 6131
         return ( $inclParam ) ? $this->uid : $this->uid['value'];
6133 6132
         break;
6134
-      case 'URL':
6133
+        case 'URL':
6135 6134
         if( !empty( $this->url['value'] )) return ( $inclParam ) ? $this->url : $this->url['value'];
6136 6135
         break;
6137
-      default:
6136
+        default:
6138 6137
         if( $propName != 'X-PROP' ) {
6139
-          if( !isset( $this->xprop[$propName] )) return FALSE;
6140
-          return ( $inclParam ) ? array( $propName, $this->xprop[$propName] )
6138
+            if( !isset( $this->xprop[$propName] )) return FALSE;
6139
+            return ( $inclParam ) ? array( $propName, $this->xprop[$propName] )
6141 6140
                                 : array( $propName, $this->xprop[$propName]['value'] );
6142 6141
         }
6143 6142
         else {
6144
-          if( empty( $this->xprop )) return FALSE;
6145
-          $xpropno = 0;
6146
-          foreach( $this->xprop as $xpropkey => $xpropvalue ) {
6143
+            if( empty( $this->xprop )) return FALSE;
6144
+            $xpropno = 0;
6145
+            foreach( $this->xprop as $xpropkey => $xpropvalue ) {
6147 6146
             if( $propix == $xpropno )
6148
-              return ( $inclParam ) ? array( $xpropkey, $this->xprop[$xpropkey] )
6147
+                return ( $inclParam ) ? array( $xpropkey, $this->xprop[$xpropkey] )
6149 6148
                                     : array( $xpropkey, $this->xprop[$xpropkey]['value'] );
6150 6149
             else
6151
-              $xpropno++;
6152
-          }
6153
-          return FALSE; // not found ??
6150
+                $xpropno++;
6151
+            }
6152
+            return FALSE; // not found ??
6154 6153
         }
6155 6154
     }
6156 6155
     return FALSE;
6157
-  }
6156
+    }
6158 6157
 /**
6159
- * general component property setting
6160
- *
6161
- * @author Kjell-Inge Gustafsson <[email protected]>
6162
- * @since 2.5.1 - 2008-11-05
6163
- * @param mixed $args variable number of function arguments,
6164
- *                    first argument is ALWAYS component name,
6165
- *                    second ALWAYS component value!
6166
- * @return void
6167
- */
6168
-  function setProperty() {
6158
+     * general component property setting
6159
+     *
6160
+     * @author Kjell-Inge Gustafsson <[email protected]>
6161
+     * @since 2.5.1 - 2008-11-05
6162
+     * @param mixed $args variable number of function arguments,
6163
+     *                    first argument is ALWAYS component name,
6164
+     *                    second ALWAYS component value!
6165
+     * @return void
6166
+     */
6167
+    function setProperty() {
6169 6168
     $numargs    = func_num_args();
6170 6169
     if( 1 > $numargs ) return FALSE;
6171 6170
     $arglist    = func_get_args();
6172 6171
     if( $this->_notExistProp( $arglist[0] )) return FALSE;
6173 6172
     if( !$this->getConfig( 'allowEmpty' ) && ( !isset( $arglist[1] ) || empty( $arglist[1] )))
6174
-      return FALSE;
6173
+        return FALSE;
6175 6174
     $arglist[0] = strtoupper( $arglist[0] );
6176 6175
     for( $argix=$numargs; $argix < 12; $argix++ ) {
6177
-      if( !isset( $arglist[$argix] ))
6176
+        if( !isset( $arglist[$argix] ))
6178 6177
         $arglist[$argix] = null;
6179 6178
     }
6180 6179
     switch( $arglist[0] ) {
6181
-      case 'ACTION':
6180
+        case 'ACTION':
6182 6181
         return $this->setAction( $arglist[1], $arglist[2] );
6183
-      case 'ATTACH':
6182
+        case 'ATTACH':
6184 6183
         return $this->setAttach( $arglist[1], $arglist[2], $arglist[3] );
6185
-      case 'ATTENDEE':
6184
+        case 'ATTENDEE':
6186 6185
         return $this->setAttendee( $arglist[1], $arglist[2], $arglist[3] );
6187
-      case 'CATEGORIES':
6186
+        case 'CATEGORIES':
6188 6187
         return $this->setCategories( $arglist[1], $arglist[2], $arglist[3] );
6189
-      case 'CLASS':
6188
+        case 'CLASS':
6190 6189
         return $this->setClass( $arglist[1], $arglist[2] );
6191
-      case 'COMMENT':
6190
+        case 'COMMENT':
6192 6191
         return $this->setComment( $arglist[1], $arglist[2], $arglist[3] );
6193
-      case 'COMPLETED':
6192
+        case 'COMPLETED':
6194 6193
         return $this->setCompleted( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] );
6195
-      case 'CONTACT':
6194
+        case 'CONTACT':
6196 6195
         return $this->setContact( $arglist[1], $arglist[2], $arglist[3] );
6197
-      case 'CREATED':
6196
+        case 'CREATED':
6198 6197
         return $this->setCreated( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] );
6199
-      case 'DESCRIPTION':
6198
+        case 'DESCRIPTION':
6200 6199
         return $this->setDescription( $arglist[1], $arglist[2], $arglist[3] );
6201
-      case 'DTEND':
6200
+        case 'DTEND':
6202 6201
         return $this->setDtend( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] );
6203
-      case 'DTSTAMP':
6202
+        case 'DTSTAMP':
6204 6203
         return $this->setDtstamp( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] );
6205
-      case 'DTSTART':
6204
+        case 'DTSTART':
6206 6205
         return $this->setDtstart( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] );
6207
-      case 'DUE':
6206
+        case 'DUE':
6208 6207
         return $this->setDue( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] );
6209
-      case 'DURATION':
6208
+        case 'DURATION':
6210 6209
         return $this->setDuration( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6] );
6211
-      case 'EXDATE':
6210
+        case 'EXDATE':
6212 6211
         return $this->setExdate( $arglist[1], $arglist[2], $arglist[3] );
6213
-      case 'EXRULE':
6212
+        case 'EXRULE':
6214 6213
         return $this->setExrule( $arglist[1], $arglist[2], $arglist[3] );
6215
-      case 'FREEBUSY':
6214
+        case 'FREEBUSY':
6216 6215
         return $this->setFreebusy( $arglist[1], $arglist[2], $arglist[3], $arglist[4] );
6217
-      case 'GEO':
6216
+        case 'GEO':
6218 6217
         return $this->setGeo( $arglist[1], $arglist[2], $arglist[3] );
6219
-      case 'LAST-MODIFIED':
6218
+        case 'LAST-MODIFIED':
6220 6219
         return $this->setLastModified( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] );
6221
-      case 'LOCATION':
6220
+        case 'LOCATION':
6222 6221
         return $this->setLocation( $arglist[1], $arglist[2] );
6223
-      case 'ORGANIZER':
6222
+        case 'ORGANIZER':
6224 6223
         return $this->setOrganizer( $arglist[1], $arglist[2] );
6225
-      case 'PERCENT-COMPLETE':
6224
+        case 'PERCENT-COMPLETE':
6226 6225
         return $this->setPercentComplete( $arglist[1], $arglist[2] );
6227
-      case 'PRIORITY':
6226
+        case 'PRIORITY':
6228 6227
         return $this->setPriority( $arglist[1], $arglist[2] );
6229
-      case 'RDATE':
6228
+        case 'RDATE':
6230 6229
         return $this->setRdate( $arglist[1], $arglist[2], $arglist[3] );
6231
-      case 'RECURRENCE-ID':
6230
+        case 'RECURRENCE-ID':
6232 6231
        return $this->setRecurrenceid( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] );
6233
-      case 'RELATED-TO':
6232
+        case 'RELATED-TO':
6234 6233
         return $this->setRelatedTo( $arglist[1], $arglist[2], $arglist[3] );
6235
-      case 'REPEAT':
6234
+        case 'REPEAT':
6236 6235
         return $this->setRepeat( $arglist[1], $arglist[2] );
6237
-      case 'REQUEST-STATUS':
6236
+        case 'REQUEST-STATUS':
6238 6237
         return $this->setRequestStatus( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5] );
6239
-      case 'RESOURCES':
6238
+        case 'RESOURCES':
6240 6239
         return $this->setResources( $arglist[1], $arglist[2], $arglist[3] );
6241
-      case 'RRULE':
6240
+        case 'RRULE':
6242 6241
         return $this->setRrule( $arglist[1], $arglist[2], $arglist[3] );
6243
-      case 'SEQUENCE':
6242
+        case 'SEQUENCE':
6244 6243
         return $this->setSequence( $arglist[1], $arglist[2] );
6245
-      case 'STATUS':
6244
+        case 'STATUS':
6246 6245
         return $this->setStatus( $arglist[1], $arglist[2] );
6247
-      case 'SUMMARY':
6246
+        case 'SUMMARY':
6248 6247
         return $this->setSummary( $arglist[1], $arglist[2] );
6249
-      case 'TRANSP':
6248
+        case 'TRANSP':
6250 6249
         return $this->setTransp( $arglist[1], $arglist[2] );
6251
-      case 'TRIGGER':
6250
+        case 'TRIGGER':
6252 6251
         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] );
6253
-      case 'TZID':
6252
+        case 'TZID':
6254 6253
         return $this->setTzid( $arglist[1], $arglist[2] );
6255
-      case 'TZNAME':
6254
+        case 'TZNAME':
6256 6255
         return $this->setTzname( $arglist[1], $arglist[2], $arglist[3] );
6257
-      case 'TZOFFSETFROM':
6256
+        case 'TZOFFSETFROM':
6258 6257
         return $this->setTzoffsetfrom( $arglist[1], $arglist[2] );
6259
-      case 'TZOFFSETTO':
6258
+        case 'TZOFFSETTO':
6260 6259
         return $this->setTzoffsetto( $arglist[1], $arglist[2] );
6261
-      case 'TZURL':
6260
+        case 'TZURL':
6262 6261
         return $this->setTzurl( $arglist[1], $arglist[2] );
6263
-      case 'UID':
6262
+        case 'UID':
6264 6263
         return $this->setUid( $arglist[1], $arglist[2] );
6265
-      case 'URL':
6264
+        case 'URL':
6266 6265
         return $this->setUrl( $arglist[1], $arglist[2] );
6267
-      default:
6266
+        default:
6268 6267
         return $this->setXprop( $arglist[0], $arglist[1], $arglist[2] );
6269 6268
     }
6270 6269
     return FALSE;
6271
-  }
6270
+    }
6272 6271
 /*********************************************************************************/
6273 6272
 /**
6274 6273
  * parse component unparsed data into properties
@@ -6279,153 +6278,153 @@  discard block
 block discarded – undo
6279 6278
  * @return bool FALSE if error occurs during parsing
6280 6279
  *
6281 6280
  */
6282
-  function parse( $unparsedtext=null ) {
6281
+    function parse( $unparsedtext=null ) {
6283 6282
     if( $unparsedtext ) {
6284
-      $this->unparsed = array();
6285
-      if( is_array( $unparsedtext )) {
6283
+        $this->unparsed = array();
6284
+        if( is_array( $unparsedtext )) {
6286 6285
         $comp = & $this;
6287 6286
         foreach ( $unparsedtext as $line ) {
6288
-          if( 'END:VALARM' == strtoupper( substr( $line, 0, 10 ))) {
6287
+            if( 'END:VALARM' == strtoupper( substr( $line, 0, 10 ))) {
6289 6288
             $this->setComponent( $comp );
6290 6289
             $comp =  & $this;
6291 6290
             continue;
6292
-          }
6293
-          elseif( 'BEGIN:VALARM' == strtoupper( substr( $line, 0, 12 ))) {
6291
+            }
6292
+            elseif( 'BEGIN:VALARM' == strtoupper( substr( $line, 0, 12 ))) {
6294 6293
             $comp = new valarm();
6295 6294
             continue;
6296
-          }
6297
-          else
6295
+            }
6296
+            else
6298 6297
             $comp->unparsed[] = $line;
6299 6298
         }
6300
-      }
6301
-      else
6299
+        }
6300
+        else
6302 6301
         $this->unparsed = array( trim( $unparsedtext ));
6303 6302
     }
6304 6303
     elseif( !isset( $this->unparsed ))
6305
-      $this->unparsed = array();
6304
+        $this->unparsed = array();
6306 6305
             /* concatenate property values spread over several lines */
6307 6306
     $lastix    = -1;
6308 6307
     $propnames = array( 'action', 'attach', 'attendee', 'categories', 'comment', 'completed'
6309
-                      , 'contact', 'class', 'created', 'description', 'dtend', 'dtstart'
6310
-                      , 'dtstamp', 'due', 'duration', 'exdate', 'exrule', 'freebusy', 'geo'
6311
-                      , 'last-modified', 'location', 'organizer', 'percent-complete'
6312
-                      , 'priority', 'rdate', 'recurrence-id', 'related-to', 'repeat'
6313
-                      , 'request-status', 'resources', 'rrule', 'sequence', 'status'
6314
-                      , 'summary', 'transp', 'trigger', 'tzid', 'tzname', 'tzoffsetfrom'
6315
-                      , 'tzoffsetto', 'tzurl', 'uid', 'url', 'x-' );
6308
+                        , 'contact', 'class', 'created', 'description', 'dtend', 'dtstart'
6309
+                        , 'dtstamp', 'due', 'duration', 'exdate', 'exrule', 'freebusy', 'geo'
6310
+                        , 'last-modified', 'location', 'organizer', 'percent-complete'
6311
+                        , 'priority', 'rdate', 'recurrence-id', 'related-to', 'repeat'
6312
+                        , 'request-status', 'resources', 'rrule', 'sequence', 'status'
6313
+                        , 'summary', 'transp', 'trigger', 'tzid', 'tzname', 'tzoffsetfrom'
6314
+                        , 'tzoffsetto', 'tzurl', 'uid', 'url', 'x-' );
6316 6315
     $proprows  = array();
6317 6316
     foreach( $this->unparsed as $line ) {
6318
-      $newProp = FALSE;
6319
-      foreach ( $propnames as $propname ) {
6317
+        $newProp = FALSE;
6318
+        foreach ( $propnames as $propname ) {
6320 6319
         if( $propname == strtolower( substr( $line, 0, strlen( $propname )))) {
6321
-          $newProp = TRUE;
6322
-          break;
6320
+            $newProp = TRUE;
6321
+            break;
6323 6322
         }
6324
-      }
6325
-      if( $newProp ) {
6323
+        }
6324
+        if( $newProp ) {
6326 6325
         $newProp = FALSE;
6327 6326
         $lastix++;
6328 6327
         $proprows[$lastix]  = $line;
6329
-      }
6330
-      else {
6328
+        }
6329
+        else {
6331 6330
             /* remove line breaks */
6332 6331
         if(( '\n' == substr( $proprows[$lastix], -2 )) &&
6333 6332
            (  ' ' == substr( $line, 0, 1 ))) {
6334
-          $proprows[$lastix] = substr( $proprows[$lastix], 0, strlen( $proprows[$lastix] ) - 2 );
6335
-          $line = substr( $line, 1 );
6333
+            $proprows[$lastix] = substr( $proprows[$lastix], 0, strlen( $proprows[$lastix] ) - 2 );
6334
+            $line = substr( $line, 1 );
6336 6335
         }
6337 6336
         $proprows[$lastix] .= $line;
6338
-      }
6337
+        }
6339 6338
     }
6340 6339
             /* parse each property 'line' */
6341 6340
     foreach( $proprows as $line ) {
6342
-      $line = str_replace( "\n ", '', $line );
6343
-      if( '\n' == substr( $line, -2 ))
6341
+        $line = str_replace( "\n ", '', $line );
6342
+        if( '\n' == substr( $line, -2 ))
6344 6343
         $line = substr( $line, 0, strlen( $line ) - 2 );
6345 6344
             /* get propname, (problem with x-properties, otherwise in previous loop) */
6346
-      $cix = $propname = null;
6347
-      for( $cix=0; $cix < strlen( $line ); $cix++ ) {
6345
+        $cix = $propname = null;
6346
+        for( $cix=0; $cix < strlen( $line ); $cix++ ) {
6348 6347
         if( in_array( $line{$cix}, array( ':', ';' )))
6349
-          break;
6348
+            break;
6350 6349
         else {
6351
-          $propname .= $line{$cix};
6350
+            $propname .= $line{$cix};
6352 6351
         }
6353
-      }
6354
-      if(( 'x-' == substr( $propname, 0, 2 )) || ( 'X-' == substr( $propname, 0, 2 ))) {
6352
+        }
6353
+        if(( 'x-' == substr( $propname, 0, 2 )) || ( 'X-' == substr( $propname, 0, 2 ))) {
6355 6354
         $propname2 = $propname;
6356 6355
         $propname  = 'X-';
6357
-      }
6356
+        }
6358 6357
             /* rest of the line is opt.params and value */
6359
-      $line = substr( $line, $cix );
6358
+        $line = substr( $line, $cix );
6360 6359
             /* separate attributes from value */
6361
-      $attr   = array();
6362
-      $attrix = -1;
6363
-      $strlen = strlen( $line );
6364
-      for( $cix=0; $cix < $strlen; $cix++ ) {
6360
+        $attr   = array();
6361
+        $attrix = -1;
6362
+        $strlen = strlen( $line );
6363
+        for( $cix=0; $cix < $strlen; $cix++ ) {
6365 6364
         if((       ':'   == $line{$cix} )             &&
6366 6365
                  ( '://' != substr( $line, $cix, 3 )) &&
6367 6366
            ( 'mailto:'   != strtolower( substr( $line, $cix - 6, 7 )))) {
6368
-          $attrEnd = TRUE;
6369
-          if(( $cix < ( $strlen - 4 )) &&
6367
+            $attrEnd = TRUE;
6368
+            if(( $cix < ( $strlen - 4 )) &&
6370 6369
                ctype_digit( substr( $line, $cix+1, 4 ))) { // an URI with a (4pos) portnr??
6371 6370
             for( $c2ix = $cix; 3 < $c2ix; $c2ix-- ) {
6372
-              if( '://' == substr( $line, $c2ix - 2, 3 )) {
6371
+                if( '://' == substr( $line, $c2ix - 2, 3 )) {
6373 6372
                 $attrEnd = FALSE;
6374 6373
                 break; // an URI with a portnr!!
6375
-              }
6374
+                }
6376 6375
             }
6377
-          }
6378
-          if( $attrEnd) {
6376
+            }
6377
+            if( $attrEnd) {
6379 6378
             $line = substr( $line, $cix + 1 );
6380 6379
             break;
6381
-          }
6380
+            }
6382 6381
         }
6383 6382
         if( ';' == $line{$cix} )
6384
-          $attr[++$attrix] = null;
6383
+            $attr[++$attrix] = null;
6385 6384
         else
6386
-          $attr[$attrix] .= $line{$cix};
6387
-      }
6385
+            $attr[$attrix] .= $line{$cix};
6386
+        }
6388 6387
             /* make attributes in array format */
6389
-      $propattr = array();
6390
-      foreach( $attr as $attribute ) {
6388
+        $propattr = array();
6389
+        foreach( $attr as $attribute ) {
6391 6390
         $attrsplit = explode( '=', $attribute, 2 );
6392 6391
         if( 1 < count( $attrsplit ))
6393
-          $propattr[$attrsplit[0]] = $attrsplit[1];
6392
+            $propattr[$attrsplit[0]] = $attrsplit[1];
6394 6393
         else
6395
-          $propattr[] = $attribute;
6396
-      }
6394
+            $propattr[] = $attribute;
6395
+        }
6397 6396
             /* call setProperty( $propname.. . */
6398
-      switch( $propname ) {
6397
+        switch( $propname ) {
6399 6398
         case 'ATTENDEE':
6400 6399
           foreach( $propattr as $pix => $attr ) {
6401 6400
             $attr2 = explode( ',', $attr );
6402
-              if( 1 < count( $attr2 ))
6401
+                if( 1 < count( $attr2 ))
6403 6402
                 $propattr[$pix] = $attr2;
6404
-          }
6405
-          $this->setProperty( $propname, $line, $propattr );
6406
-          break;
6403
+            }
6404
+            $this->setProperty( $propname, $line, $propattr );
6405
+            break;
6407 6406
         case 'CATEGORIES':
6408 6407
         case 'RESOURCES':
6409 6408
           if( FALSE !== strpos( $line, ',' )) {
6410 6409
             $content  = explode( ',', $line );
6411 6410
             $clen     = count( $content );
6412 6411
             for( $cix = 0; $cix < $clen; $cix++ ) {
6413
-              if( "\\" == substr($content[$cix], -1)) {
6412
+                if( "\\" == substr($content[$cix], -1)) {
6414 6413
                 $content[$cix] .= ','.$content[$cix + 1];
6415 6414
                 unset($content[$cix + 1]);
6416 6415
                 $cix++;
6417
-              }
6416
+                }
6418 6417
             }
6419 6418
             if( 1 < count( $content )) {
6420
-              $content = array_values( $content );
6421
-              foreach( $content as $cix => $contentPart )
6419
+                $content = array_values( $content );
6420
+                foreach( $content as $cix => $contentPart )
6422 6421
                 $content[$cix] = $this->_strunrep( $contentPart );
6423
-              $this->setProperty( $propname, $content, $propattr );
6424
-              break;
6422
+                $this->setProperty( $propname, $content, $propattr );
6423
+                break;
6425 6424
             }
6426 6425
             else
6427
-              $line = reset( $content );
6428
-          }
6426
+                $line = reset( $content );
6427
+            }
6429 6428
         case 'X-':
6430 6429
           $propname = ( isset( $propname2 )) ? $propname2 : $propname;
6431 6430
         case 'COMMENT':
@@ -6435,125 +6434,125 @@  discard block
 block discarded – undo
6435 6434
         case 'SUMMARY':
6436 6435
           if( empty( $line ))
6437 6436
             $propattr = null;
6438
-          $this->setProperty( $propname, $this->_strunrep( $line ), $propattr );
6439
-          unset( $propname2 );
6440
-          break;
6437
+            $this->setProperty( $propname, $this->_strunrep( $line ), $propattr );
6438
+            unset( $propname2 );
6439
+            break;
6441 6440
         case 'REQUEST-STATUS':
6442 6441
           $values    = explode( ';', $line, 3 );
6443
-          $values[1] = ( !isset( $values[1] )) ? null : $this->_strunrep( $values[1] );
6444
-          $values[2] = ( !isset( $values[2] )) ? null : $this->_strunrep( $values[2] );
6445
-          $this->setProperty( $propname
6442
+            $values[1] = ( !isset( $values[1] )) ? null : $this->_strunrep( $values[1] );
6443
+            $values[2] = ( !isset( $values[2] )) ? null : $this->_strunrep( $values[2] );
6444
+            $this->setProperty( $propname
6446 6445
                             , $values[0]  // statcode
6447 6446
                             , $values[1]  // statdesc
6448 6447
                             , $values[2]  // extdata
6449 6448
                             , $propattr );
6450
-          break;
6449
+            break;
6451 6450
         case 'FREEBUSY':
6452 6451
           $fbtype = ( isset( $propattr['FBTYPE'] )) ? $propattr['FBTYPE'] : ''; // force setting default, if missing
6453
-          unset( $propattr['FBTYPE'] );
6454
-          $values = explode( ',', $line );
6455
-          foreach( $values as $vix => $value ) {
6452
+            unset( $propattr['FBTYPE'] );
6453
+            $values = explode( ',', $line );
6454
+            foreach( $values as $vix => $value ) {
6456 6455
             $value2 = explode( '/', $value );
6457 6456
             if( 1 < count( $value2 ))
6458
-              $values[$vix] = $value2;
6459
-          }
6460
-          $this->setProperty( $propname, $fbtype, $values, $propattr );
6461
-          break;
6457
+                $values[$vix] = $value2;
6458
+            }
6459
+            $this->setProperty( $propname, $fbtype, $values, $propattr );
6460
+            break;
6462 6461
         case 'GEO':
6463 6462
           $value = explode( ';', $line, 2 );
6464
-          if( 2 > count( $value ))
6463
+            if( 2 > count( $value ))
6465 6464
             $value[1] = null;
6466
-          $this->setProperty( $propname, $value[0], $value[1], $propattr );
6467
-          break;
6465
+            $this->setProperty( $propname, $value[0], $value[1], $propattr );
6466
+            break;
6468 6467
         case 'EXDATE':
6469 6468
           $values = ( !empty( $line )) ? explode( ',', $line ) : null;
6470
-          $this->setProperty( $propname, $values, $propattr );
6471
-          break;
6469
+            $this->setProperty( $propname, $values, $propattr );
6470
+            break;
6472 6471
         case 'RDATE':
6473 6472
           if( empty( $line )) {
6474 6473
             $this->setProperty( $propname, $line, $propattr );
6475 6474
             break;
6476
-          }
6477
-          $values = explode( ',', $line );
6478
-          foreach( $values as $vix => $value ) {
6475
+            }
6476
+            $values = explode( ',', $line );
6477
+            foreach( $values as $vix => $value ) {
6479 6478
             $value2 = explode( '/', $value );
6480 6479
             if( 1 < count( $value2 ))
6481
-              $values[$vix] = $value2;
6482
-          }
6483
-          $this->setProperty( $propname, $values, $propattr );
6484
-          break;
6480
+                $values[$vix] = $value2;
6481
+            }
6482
+            $this->setProperty( $propname, $values, $propattr );
6483
+            break;
6485 6484
         case 'EXRULE':
6486 6485
         case 'RRULE':
6487 6486
           $values = explode( ';', $line );
6488
-          $recur = array();
6489
-          foreach( $values as $value2 ) {
6487
+            $recur = array();
6488
+            foreach( $values as $value2 ) {
6490 6489
             if( empty( $value2 ))
6491
-              continue; // ;-char in ending position ???
6490
+                continue; // ;-char in ending position ???
6492 6491
             $value3 = explode( '=', $value2, 2 );
6493 6492
             $rulelabel = strtoupper( $value3[0] );
6494 6493
             switch( $rulelabel ) {
6495
-              case 'BYDAY': {
6494
+                case 'BYDAY': {
6496 6495
                 $value4 = explode( ',', $value3[1] );
6497 6496
                 if( 1 < count( $value4 )) {
6498
-                  foreach( $value4 as $v5ix => $value5 ) {
6497
+                    foreach( $value4 as $v5ix => $value5 ) {
6499 6498
                     $value6 = array();
6500 6499
                     $dayno = $dayname = null;
6501 6500
                     $value5 = trim( (string) $value5 );
6502 6501
                     if(( ctype_alpha( substr( $value5, -1 ))) &&
6503 6502
                        ( ctype_alpha( substr( $value5, -2, 1 )))) {
6504
-                      $dayname = substr( $value5, -2, 2 );
6505
-                      if( 2 < strlen( $value5 ))
6503
+                        $dayname = substr( $value5, -2, 2 );
6504
+                        if( 2 < strlen( $value5 ))
6506 6505
                         $dayno = substr( $value5, 0, ( strlen( $value5 ) - 2 ));
6507 6506
                     }
6508 6507
                     if( $dayno )
6509
-                      $value6[] = $dayno;
6508
+                        $value6[] = $dayno;
6510 6509
                     if( $dayname )
6511
-                      $value6['DAY'] = $dayname;
6510
+                        $value6['DAY'] = $dayname;
6512 6511
                     $value4[$v5ix] = $value6;
6513
-                  }
6512
+                    }
6514 6513
                 }
6515 6514
                 else {
6516
-                  $value4 = array();
6517
-                  $dayno  = $dayname = null;
6518
-                  $value5 = trim( (string) $value3[1] );
6519
-                  if(( ctype_alpha( substr( $value5, -1 ))) &&
6515
+                    $value4 = array();
6516
+                    $dayno  = $dayname = null;
6517
+                    $value5 = trim( (string) $value3[1] );
6518
+                    if(( ctype_alpha( substr( $value5, -1 ))) &&
6520 6519
                      ( ctype_alpha( substr( $value5, -2, 1 )))) {
6521
-                      $dayname = substr( $value5, -2, 2 );
6520
+                        $dayname = substr( $value5, -2, 2 );
6522 6521
                     if( 2 < strlen( $value5 ))
6523
-                      $dayno = substr( $value5, 0, ( strlen( $value5 ) - 2 ));
6524
-                  }
6525
-                  if( $dayno )
6522
+                        $dayno = substr( $value5, 0, ( strlen( $value5 ) - 2 ));
6523
+                    }
6524
+                    if( $dayno )
6526 6525
                     $value4[] = $dayno;
6527
-                  if( $dayname )
6526
+                    if( $dayname )
6528 6527
                     $value4['DAY'] = $dayname;
6529 6528
                 }
6530 6529
                 $recur[$rulelabel] = $value4;
6531 6530
                 break;
6532
-              }
6533
-              default: {
6531
+                }
6532
+                default: {
6534 6533
                 $value4 = explode( ',', $value3[1] );
6535 6534
                 if( 1 < count( $value4 ))
6536
-                  $value3[1] = $value4;
6535
+                    $value3[1] = $value4;
6537 6536
                 $recur[$rulelabel] = $value3[1];
6538 6537
                 break;
6539
-              }
6538
+                }
6540 6539
             } // end - switch $rulelabel
6541
-          } // end - foreach( $values.. .
6542
-          $this->setProperty( $propname, $recur, $propattr );
6543
-          break;
6540
+            } // end - foreach( $values.. .
6541
+            $this->setProperty( $propname, $recur, $propattr );
6542
+            break;
6544 6543
         default:
6545 6544
           $this->setProperty( $propname, $line, $propattr );
6546
-          break;
6547
-      } // end  switch( $propname.. .
6545
+            break;
6546
+        } // end  switch( $propname.. .
6548 6547
     } // end - foreach( $proprows.. .
6549 6548
     unset( $this->unparsed, $proprows );
6550 6549
     if( isset( $this->components ) && is_array( $this->components ) && ( 0 < count( $this->components ))) {
6551
-      for( $six = 0; $six < count( $this->components ); $six++ ) {
6550
+        for( $six = 0; $six < count( $this->components ); $six++ ) {
6552 6551
         if( !empty( $this->components[$six]->unparsed ))
6553
-          $this->components[$six]->parse();
6554
-      }
6552
+            $this->components[$six]->parse();
6553
+        }
6554
+    }
6555 6555
     }
6556
-  }
6557 6556
 /*********************************************************************************/
6558 6557
 /*********************************************************************************/
6559 6558
 /**
@@ -6563,12 +6562,12 @@  discard block
 block discarded – undo
6563 6562
  * @since 2.2.16 - 2007-11-07
6564 6563
  * @return object
6565 6564
  */
6566
-  function copy() {
6565
+    function copy() {
6567 6566
     $serialized_contents = serialize($this);
6568 6567
     $copy = unserialize($serialized_contents);
6569 6568
     unset( $copy->propix );
6570 6569
     return $copy;
6571
- }
6570
+    }
6572 6571
 /*********************************************************************************/
6573 6572
 /*********************************************************************************/
6574 6573
 /**
@@ -6580,187 +6579,187 @@  discard block
 block discarded – undo
6580 6579
  * @param mixed $arg2 optional, ordno if arg1 = component type
6581 6580
  * @return void
6582 6581
  */
6583
-  function deleteComponent( $arg1, $arg2=FALSE  ) {
6582
+    function deleteComponent( $arg1, $arg2=FALSE  ) {
6584 6583
     if( !isset( $this->components )) return FALSE;
6585 6584
     $argType = $index = null;
6586 6585
     if ( ctype_digit( (string) $arg1 )) {
6587
-      $argType = 'INDEX';
6588
-      $index   = (int) $arg1 - 1;
6586
+        $argType = 'INDEX';
6587
+        $index   = (int) $arg1 - 1;
6589 6588
     }
6590 6589
     elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) {
6591
-      $argType = strtolower( $arg1 );
6592
-      $index   = ( !empty( $arg2 ) && ctype_digit( (string) $arg2 )) ? (( int ) $arg2 - 1 ) : 0;
6590
+        $argType = strtolower( $arg1 );
6591
+        $index   = ( !empty( $arg2 ) && ctype_digit( (string) $arg2 )) ? (( int ) $arg2 - 1 ) : 0;
6593 6592
     }
6594 6593
     $cix2dC = 0;
6595 6594
     foreach ( $this->components as $cix => $component) {
6596
-      if( empty( $component )) continue;
6597
-      unset( $component->propix );
6598
-      if(( 'INDEX' == $argType ) && ( $index == $cix )) {
6595
+        if( empty( $component )) continue;
6596
+        unset( $component->propix );
6597
+        if(( 'INDEX' == $argType ) && ( $index == $cix )) {
6599 6598
         unset( $this->components[$cix] );
6600 6599
         return TRUE;
6601
-      }
6602
-      elseif( $argType == $component->objName ) {
6600
+        }
6601
+        elseif( $argType == $component->objName ) {
6603 6602
         if( $index == $cix2dC ) {
6604
-          unset( $this->components[$cix] );
6605
-          return TRUE;
6603
+            unset( $this->components[$cix] );
6604
+            return TRUE;
6606 6605
         }
6607 6606
         $cix2dC++;
6608
-      }
6609
-      elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) {
6607
+        }
6608
+        elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) {
6610 6609
         unset( $this->components[$cix] );
6611 6610
         return TRUE;
6612
-      }
6611
+        }
6613 6612
     }
6614 6613
     return FALSE;
6615
-  }
6614
+    }
6616 6615
 /**
6617
- * get calendar component subcomponent from component container
6618
- *
6619
- * @author Kjell-Inge Gustafsson <[email protected]>
6620
- * @since 2.5.1 - 2008-10-15
6621
- * @param mixed $arg1 optional, ordno/component type/ component uid
6622
- * @param mixed $arg2 optional, ordno if arg1 = component type
6623
- * @return object
6624
- */
6625
-  function getComponent ( $arg1=FALSE, $arg2=FALSE ) {
6616
+     * get calendar component subcomponent from component container
6617
+     *
6618
+     * @author Kjell-Inge Gustafsson <[email protected]>
6619
+     * @since 2.5.1 - 2008-10-15
6620
+     * @param mixed $arg1 optional, ordno/component type/ component uid
6621
+     * @param mixed $arg2 optional, ordno if arg1 = component type
6622
+     * @return object
6623
+     */
6624
+    function getComponent ( $arg1=FALSE, $arg2=FALSE ) {
6626 6625
     if( !isset( $this->components )) return FALSE;
6627 6626
     $index = $argType = null;
6628 6627
     if ( !$arg1 ) {
6629
-      $argType = 'INDEX';
6630
-      $index   = $this->compix['INDEX'] =
6628
+        $argType = 'INDEX';
6629
+        $index   = $this->compix['INDEX'] =
6631 6630
         ( isset( $this->compix['INDEX'] )) ? $this->compix['INDEX'] + 1 : 1;
6632 6631
     }
6633 6632
     elseif ( ctype_digit( (string) $arg1 )) {
6634
-      $argType = 'INDEX';
6635
-      $index   = (int) $arg1;
6636
-      unset( $this->compix );
6633
+        $argType = 'INDEX';
6634
+        $index   = (int) $arg1;
6635
+        unset( $this->compix );
6637 6636
     }
6638 6637
     elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) {
6639
-      unset( $this->compix['INDEX'] );
6640
-      $argType = strtolower( $arg1 );
6641
-      if( !$arg2 )
6638
+        unset( $this->compix['INDEX'] );
6639
+        $argType = strtolower( $arg1 );
6640
+        if( !$arg2 )
6642 6641
         $index = $this->compix[$argType] =
6643 6642
         ( isset( $this->compix[$argType] )) ? $this->compix[$argType] + 1 : 1;
6644
-      else
6643
+        else
6645 6644
         $index = (int) $arg2;
6646 6645
     }
6647 6646
     $index  -= 1;
6648 6647
     $ckeys = array_keys( $this->components );
6649 6648
     if( !empty( $index) && ( $index > end( $ckeys )))
6650
-      return FALSE;
6649
+        return FALSE;
6651 6650
     $cix2gC = 0;
6652 6651
     foreach( $this->components as $cix => $component ) {
6653
-      if( empty( $component )) continue;
6654
-      unset( $component->propix );
6655
-      if(( 'INDEX' == $argType ) && ( $index == $cix ))
6652
+        if( empty( $component )) continue;
6653
+        unset( $component->propix );
6654
+        if(( 'INDEX' == $argType ) && ( $index == $cix ))
6656 6655
         return $component->copy();
6657
-      elseif( $argType == $component->objName ) {
6658
-         if( $index == $cix2gC )
6659
-           return $component->copy();
6660
-         $cix2gC++;
6661
-      }
6662
-      elseif( !$argType && ( $arg1 == $component->getProperty( 'uid' ))) {
6656
+        elseif( $argType == $component->objName ) {
6657
+            if( $index == $cix2gC )
6658
+            return $component->copy();
6659
+            $cix2gC++;
6660
+        }
6661
+        elseif( !$argType && ( $arg1 == $component->getProperty( 'uid' ))) {
6663 6662
         unset( $component->propix );
6664 6663
         return $component->copy();
6665
-      }
6664
+        }
6666 6665
     }
6667 6666
             /* not found.. . */
6668 6667
     unset( $this->compix );
6669 6668
     return false;
6670
-  }
6669
+    }
6671 6670
 /**
6672
- * add calendar component as subcomponent to container for subcomponents
6673
- *
6674
- * @author Kjell-Inge Gustafsson <[email protected]>
6675
- * @since 1.x.x - 2007-04-24
6676
- * @param object $component calendar component
6677
- * @return void
6678
- */
6679
-  function addSubComponent ( $component ) {
6671
+     * add calendar component as subcomponent to container for subcomponents
6672
+     *
6673
+     * @author Kjell-Inge Gustafsson <[email protected]>
6674
+     * @since 1.x.x - 2007-04-24
6675
+     * @param object $component calendar component
6676
+     * @return void
6677
+     */
6678
+    function addSubComponent ( $component ) {
6680 6679
     $this->setComponent( $component );
6681
-  }
6680
+    }
6682 6681
 /**
6683
- * add calendar component as subcomponent to container for subcomponents
6684
- *
6685
- * @author Kjell-Inge Gustafsson <[email protected]>
6686
- * @since 2.4.13 - 2008-09-24
6687
- * @param object $component calendar component
6688
- * @param mixed $arg1 optional, ordno/component type/ component uid
6689
- * @param mixed $arg2 optional, ordno if arg1 = component type
6690
- * @return bool
6691
- */
6692
-  function setComponent( $component, $arg1=FALSE, $arg2=FALSE  ) {
6682
+     * add calendar component as subcomponent to container for subcomponents
6683
+     *
6684
+     * @author Kjell-Inge Gustafsson <[email protected]>
6685
+     * @since 2.4.13 - 2008-09-24
6686
+     * @param object $component calendar component
6687
+     * @param mixed $arg1 optional, ordno/component type/ component uid
6688
+     * @param mixed $arg2 optional, ordno if arg1 = component type
6689
+     * @return bool
6690
+     */
6691
+    function setComponent( $component, $arg1=FALSE, $arg2=FALSE  ) {
6693 6692
     if( !isset( $this->components )) return FALSE;
6694 6693
     if( '' >= $component->getConfig( 'language'))
6695
-      $component->setConfig( 'language',  $this->getConfig( 'language' ));
6694
+        $component->setConfig( 'language',  $this->getConfig( 'language' ));
6696 6695
     $component->setConfig( 'allowEmpty',  $this->getConfig( 'allowEmpty' ));
6697 6696
     $component->setConfig( 'nl',          $this->getConfig( 'nl' ));
6698 6697
     $component->setConfig( 'unique_id',   $this->getConfig( 'unique_id' ));
6699 6698
     $component->setConfig( 'format',      $this->getConfig( 'format' ));
6700 6699
     if( !in_array( $component->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' ))) {
6701
-      unset( $component->propix );
6700
+        unset( $component->propix );
6702 6701
             /* make sure dtstamp and uid is set */
6703
-      $dummy = $component->getProperty( 'dtstamp' );
6704
-      $dummy = $component->getProperty( 'uid' );
6702
+        $dummy = $component->getProperty( 'dtstamp' );
6703
+        $dummy = $component->getProperty( 'uid' );
6705 6704
     }
6706 6705
     if( !$arg1 ) {
6707
-      $this->components[] = $component->copy();
6708
-      return TRUE;
6706
+        $this->components[] = $component->copy();
6707
+        return TRUE;
6709 6708
     }
6710 6709
     $argType = $index = null;
6711 6710
     if ( ctype_digit( (string) $arg1 )) {
6712
-      $argType = 'INDEX';
6713
-      $index   = (int) $arg1 - 1;
6711
+        $argType = 'INDEX';
6712
+        $index   = (int) $arg1 - 1;
6714 6713
     }
6715 6714
     elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) {
6716
-      $argType = strtolower( $arg1 );
6717
-      $index = ( ctype_digit( (string) $arg2 )) ? ((int) $arg2) - 1 : 0;
6715
+        $argType = strtolower( $arg1 );
6716
+        $index = ( ctype_digit( (string) $arg2 )) ? ((int) $arg2) - 1 : 0;
6718 6717
     }
6719 6718
     $cix2sC = 0;
6720 6719
     foreach ( $this->components as $cix => $component2 ) {
6721
-      if( empty( $component2 )) continue;
6722
-      unset( $component2->propix );
6723
-      if(( 'INDEX' == $argType ) && ( $index == $cix )) {
6720
+        if( empty( $component2 )) continue;
6721
+        unset( $component2->propix );
6722
+        if(( 'INDEX' == $argType ) && ( $index == $cix )) {
6724 6723
         $this->components[$cix] = $component->copy();
6725 6724
         return TRUE;
6726
-      }
6727
-      elseif( $argType == $component2->objName ) {
6725
+        }
6726
+        elseif( $argType == $component2->objName ) {
6728 6727
         if( $index == $cix2sC ) {
6729
-          $this->components[$cix] = $component->copy();
6730
-          return TRUE;
6728
+            $this->components[$cix] = $component->copy();
6729
+            return TRUE;
6731 6730
         }
6732 6731
         $cix2sC++;
6733
-      }
6734
-      elseif( !$argType && ($arg1 == $component2->getProperty( 'uid' ))) {
6732
+        }
6733
+        elseif( !$argType && ($arg1 == $component2->getProperty( 'uid' ))) {
6735 6734
         $this->components[$cix] = $component->copy();
6736 6735
         return TRUE;
6737
-      }
6736
+        }
6738 6737
     }
6739 6738
             /* not found.. . insert anyway.. .*/
6740 6739
     $this->components[] = $component->copy();
6741 6740
     return TRUE;
6742
-  }
6741
+    }
6743 6742
 /**
6744
- * creates formatted output for subcomponents
6745
- *
6746
- * @author Kjell-Inge Gustafsson <[email protected]>
6747
- * @since 2.4.10 - 2008-08-06
6748
- * @return string
6749
- */
6750
-  function createSubComponent() {
6743
+     * creates formatted output for subcomponents
6744
+     *
6745
+     * @author Kjell-Inge Gustafsson <[email protected]>
6746
+     * @since 2.4.10 - 2008-08-06
6747
+     * @return string
6748
+     */
6749
+    function createSubComponent() {
6751 6750
     $output = null;
6752 6751
     foreach( $this->components as $component ) {
6753
-      if( empty( $component )) continue;
6754
-      if( '' >= $component->getConfig( 'language'))
6752
+        if( empty( $component )) continue;
6753
+        if( '' >= $component->getConfig( 'language'))
6755 6754
         $component->setConfig( 'language',  $this->getConfig( 'language' ));
6756
-      $component->setConfig( 'allowEmpty',  $this->getConfig( 'allowEmpty' ));
6757
-      $component->setConfig( 'nl',          $this->getConfig( 'nl' ));
6758
-      $component->setConfig( 'unique_id',   $this->getConfig( 'unique_id' ));
6759
-      $component->setConfig( 'format',      $this->getConfig( 'format' ));
6760
-      $output .= $component->createComponent( $this->xcaldecl );
6755
+        $component->setConfig( 'allowEmpty',  $this->getConfig( 'allowEmpty' ));
6756
+        $component->setConfig( 'nl',          $this->getConfig( 'nl' ));
6757
+        $component->setConfig( 'unique_id',   $this->getConfig( 'unique_id' ));
6758
+        $component->setConfig( 'format',      $this->getConfig( 'format' ));
6759
+        $output .= $component->createComponent( $this->xcaldecl );
6761 6760
     }
6762 6761
     return $output;
6763
-  }
6762
+    }
6764 6763
 /********************************************************************************/
6765 6764
 /**
6766 6765
  * break lines at pos 75
@@ -6784,83 +6783,83 @@  discard block
 block discarded – undo
6784 6783
  * @param string $value
6785 6784
  * @return string
6786 6785
  */
6787
-  function _size75( $string ) {
6786
+    function _size75( $string ) {
6788 6787
     $strlen = strlen( $string );
6789 6788
     $tmp    = $string;
6790 6789
     $string = null;
6791 6790
     while( $strlen > 75 ) {
6792
-       $breakAtChar = 75;
6793
-       if( substr( $tmp, ( $breakAtChar - 1 ), strlen( '\n' )) == '\n' )
6794
-         $breakAtChar = $breakAtChar - 1;
6795
-       $string .= substr( $tmp, 0, $breakAtChar );
6796
-       $string .= $this->nl;
6797
-       $tmp     = ' '.substr( $tmp, $breakAtChar );
6798
-       $strlen  = strlen( $tmp );
6791
+        $breakAtChar = 75;
6792
+        if( substr( $tmp, ( $breakAtChar - 1 ), strlen( '\n' )) == '\n' )
6793
+            $breakAtChar = $breakAtChar - 1;
6794
+        $string .= substr( $tmp, 0, $breakAtChar );
6795
+        $string .= $this->nl;
6796
+        $tmp     = ' '.substr( $tmp, $breakAtChar );
6797
+        $strlen  = strlen( $tmp );
6799 6798
     } // while
6800 6799
     $string .= rtrim( $tmp ); // the rest
6801 6800
     if( $this->nl != substr( $string, ( 0 - strlen( $this->nl ))))
6802
-      $string .= $this->nl;
6801
+        $string .= $this->nl;
6803 6802
     return $string;
6804
-  }
6803
+    }
6805 6804
 /**
6806
- * special characters management output
6807
- *
6808
- * @author Kjell-Inge Gustafsson <[email protected]>
6809
- * @since 2.3.3 - 2007-12-20
6810
- * @param string $string
6811
- * @return string
6812
- */
6813
-  function _strrep( $string ) {
6805
+     * special characters management output
6806
+     *
6807
+     * @author Kjell-Inge Gustafsson <[email protected]>
6808
+     * @since 2.3.3 - 2007-12-20
6809
+     * @param string $string
6810
+     * @return string
6811
+     */
6812
+    function _strrep( $string ) {
6814 6813
     switch( $this->format ) {
6815
-      case 'xcal':
6814
+        case 'xcal':
6816 6815
         $string = str_replace( '\n',  $this->nl, $string);
6817 6816
         $string = htmlspecialchars( strip_tags( stripslashes( urldecode ( $string ))));
6818 6817
         break;
6819
-      default:
6818
+        default:
6820 6819
         $pos = 0;
6821 6820
         while( $pos <= strlen( $string )) {
6822
-          $pos = strpos( $string, "\\", $pos );
6823
-          if( FALSE === $pos )
6821
+            $pos = strpos( $string, "\\", $pos );
6822
+            if( FALSE === $pos )
6824 6823
             break;
6825
-          if( !in_array( $string{($pos + 1)}, array( 'n', 'N', 'r', ',', ';' ))) {
6824
+            if( !in_array( $string{($pos + 1)}, array( 'n', 'N', 'r', ',', ';' ))) {
6826 6825
             $string = substr( $string, 0, $pos )."\\".substr( $string, ( $pos + 1 ));
6827 6826
             $pos += 1;
6828
-          }
6829
-          $pos += 1;
6827
+            }
6828
+            $pos += 1;
6830 6829
         }
6831 6830
         if( FALSE !== strpos( $string, '"' ))
6832
-          $string = str_replace('"',   "'",       $string);
6831
+            $string = str_replace('"',   "'",       $string);
6833 6832
         if( FALSE !== strpos( $string, ',' ))
6834
-          $string = str_replace(',',   '\,',      $string);
6833
+            $string = str_replace(',',   '\,',      $string);
6835 6834
         if( FALSE !== strpos( $string, ';' ))
6836
-          $string = str_replace(';',   '\;',      $string);
6835
+            $string = str_replace(';',   '\;',      $string);
6837 6836
         if( FALSE !== strpos( $string, "\r\n" ))
6838
-          $string = str_replace( "\r\n", '\n',    $string);
6837
+            $string = str_replace( "\r\n", '\n',    $string);
6839 6838
         elseif( FALSE !== strpos( $string, "\r" ))
6840
-          $string = str_replace( "\r", '\n',      $string);
6839
+            $string = str_replace( "\r", '\n',      $string);
6841 6840
         if( FALSE !== strpos( $string, '\N' ))
6842
-          $string = str_replace( '\N', '\n',      $string);
6841
+            $string = str_replace( '\N', '\n',      $string);
6843 6842
 //        if( FALSE !== strpos( $string, $this->nl ))
6844
-          $string = str_replace( $this->nl, '\n', $string);
6843
+            $string = str_replace( $this->nl, '\n', $string);
6845 6844
         break;
6846 6845
     }
6847 6846
     return $string;
6848
-  }
6847
+    }
6849 6848
 /**
6850
- * special characters management input (from iCal file)
6851
- *
6852
- * @author Kjell-Inge Gustafsson <[email protected]>
6853
- * @since 2.3.3 - 2007-11-23
6854
- * @param string $string
6855
- * @return string
6856
- */
6857
-  function _strunrep( $string ) {
6849
+     * special characters management input (from iCal file)
6850
+     *
6851
+     * @author Kjell-Inge Gustafsson <[email protected]>
6852
+     * @since 2.3.3 - 2007-11-23
6853
+     * @param string $string
6854
+     * @return string
6855
+     */
6856
+    function _strunrep( $string ) {
6858 6857
     $string = str_replace( '\\\\', '\\',     $string);
6859 6858
     $string = str_replace( '\,',   ',',      $string);
6860 6859
     $string = str_replace( '\;',   ';',      $string);
6861 6860
 //    $string = str_replace( '\n',  $this->nl, $string); // ??
6862 6861
     return $string;
6863
-  }
6862
+    }
6864 6863
 }
6865 6864
 /*********************************************************************************/
6866 6865
 /*********************************************************************************/
@@ -6871,46 +6870,46 @@  discard block
 block discarded – undo
6871 6870
  * @since 2.5.1 - 2008-10-12
6872 6871
  */
6873 6872
 class vevent extends calendarComponent {
6874
-  var $attach;
6875
-  var $attendee;
6876
-  var $categories;
6877
-  var $comment;
6878
-  var $contact;
6879
-  var $class;
6880
-  var $created;
6881
-  var $description;
6882
-  var $dtend;
6883
-  var $dtstart;
6884
-  var $duration;
6885
-  var $exdate;
6886
-  var $exrule;
6887
-  var $geo;
6888
-  var $lastmodified;
6889
-  var $location;
6890
-  var $organizer;
6891
-  var $priority;
6892
-  var $rdate;
6893
-  var $recurrenceid;
6894
-  var $relatedto;
6895
-  var $requeststatus;
6896
-  var $resources;
6897
-  var $rrule;
6898
-  var $sequence;
6899
-  var $status;
6900
-  var $summary;
6901
-  var $transp;
6902
-  var $url;
6903
-  var $xprop;
6873
+    var $attach;
6874
+    var $attendee;
6875
+    var $categories;
6876
+    var $comment;
6877
+    var $contact;
6878
+    var $class;
6879
+    var $created;
6880
+    var $description;
6881
+    var $dtend;
6882
+    var $dtstart;
6883
+    var $duration;
6884
+    var $exdate;
6885
+    var $exrule;
6886
+    var $geo;
6887
+    var $lastmodified;
6888
+    var $location;
6889
+    var $organizer;
6890
+    var $priority;
6891
+    var $rdate;
6892
+    var $recurrenceid;
6893
+    var $relatedto;
6894
+    var $requeststatus;
6895
+    var $resources;
6896
+    var $rrule;
6897
+    var $sequence;
6898
+    var $status;
6899
+    var $summary;
6900
+    var $transp;
6901
+    var $url;
6902
+    var $xprop;
6904 6903
             //  component subcomponents container
6905
-  var $components;
6906
-/**
6907
- * constructor for calendar component VEVENT object
6908
- *
6909
- * @author Kjell-Inge Gustafsson <[email protected]>
6910
- * @since 2.5.1 - 2008-10-31
6911
- * @return void
6912
- */
6913
-  function vevent() {
6904
+    var $components;
6905
+/**
6906
+     * constructor for calendar component VEVENT object
6907
+     *
6908
+     * @author Kjell-Inge Gustafsson <[email protected]>
6909
+     * @since 2.5.1 - 2008-10-31
6910
+     * @return void
6911
+     */
6912
+    function vevent() {
6914 6913
     $this->calendarComponent();
6915 6914
 
6916 6915
     $this->attach          = '';
@@ -6946,16 +6945,16 @@  discard block
 block discarded – undo
6946 6945
 
6947 6946
     $this->components      = array();
6948 6947
 
6949
-  }
6948
+    }
6950 6949
 /**
6951
- * create formatted output for calendar component VEVENT object instance
6952
- *
6953
- * @author Kjell-Inge Gustafsson <[email protected]>
6954
- * @since 2.5.1 - 2008-11-07
6955
- * @param array $xcaldecl
6956
- * @return string
6957
- */
6958
-  function createComponent( &$xcaldecl ) {
6950
+     * create formatted output for calendar component VEVENT object instance
6951
+     *
6952
+     * @author Kjell-Inge Gustafsson <[email protected]>
6953
+     * @since 2.5.1 - 2008-11-07
6954
+     * @param array $xcaldecl
6955
+     * @return string
6956
+     */
6957
+    function createComponent( &$xcaldecl ) {
6959 6958
     $objectname    = $this->_createFormat();
6960 6959
     $component     = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
6961 6960
     $component    .= $this->createUid();
@@ -6993,11 +6992,11 @@  discard block
 block discarded – undo
6993 6992
     $component    .= $this->createSubComponent();
6994 6993
     $component    .= $this->componentEnd1.$objectname.$this->componentEnd2;
6995 6994
     if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) {
6996
-      foreach( $this->xcaldecl as $localxcaldecl )
6995
+        foreach( $this->xcaldecl as $localxcaldecl )
6997 6996
         $xcaldecl[] = $localxcaldecl;
6998 6997
     }
6999 6998
     return $component;
7000
-  }
6999
+    }
7001 7000
 }
7002 7001
 /*********************************************************************************/
7003 7002
 /*********************************************************************************/
@@ -7008,47 +7007,47 @@  discard block
 block discarded – undo
7008 7007
  * @since 2.5.1 - 2008-10-12
7009 7008
  */
7010 7009
 class vtodo extends calendarComponent {
7011
-  var $attach;
7012
-  var $attendee;
7013
-  var $categories;
7014
-  var $comment;
7015
-  var $completed;
7016
-  var $contact;
7017
-  var $class;
7018
-  var $created;
7019
-  var $description;
7020
-  var $dtstart;
7021
-  var $due;
7022
-  var $duration;
7023
-  var $exdate;
7024
-  var $exrule;
7025
-  var $geo;
7026
-  var $lastmodified;
7027
-  var $location;
7028
-  var $organizer;
7029
-  var $percentcomplete;
7030
-  var $priority;
7031
-  var $rdate;
7032
-  var $recurrenceid;
7033
-  var $relatedto;
7034
-  var $requeststatus;
7035
-  var $resources;
7036
-  var $rrule;
7037
-  var $sequence;
7038
-  var $status;
7039
-  var $summary;
7040
-  var $url;
7041
-  var $xprop;
7010
+    var $attach;
7011
+    var $attendee;
7012
+    var $categories;
7013
+    var $comment;
7014
+    var $completed;
7015
+    var $contact;
7016
+    var $class;
7017
+    var $created;
7018
+    var $description;
7019
+    var $dtstart;
7020
+    var $due;
7021
+    var $duration;
7022
+    var $exdate;
7023
+    var $exrule;
7024
+    var $geo;
7025
+    var $lastmodified;
7026
+    var $location;
7027
+    var $organizer;
7028
+    var $percentcomplete;
7029
+    var $priority;
7030
+    var $rdate;
7031
+    var $recurrenceid;
7032
+    var $relatedto;
7033
+    var $requeststatus;
7034
+    var $resources;
7035
+    var $rrule;
7036
+    var $sequence;
7037
+    var $status;
7038
+    var $summary;
7039
+    var $url;
7040
+    var $xprop;
7042 7041
             //  component subcomponents container
7043
-  var $components;
7044
-/**
7045
- * constructor for calendar component VTODO object
7046
- *
7047
- * @author Kjell-Inge Gustafsson <[email protected]>
7048
- * @since 2.5.1 - 2008-10-31
7049
- * @return void
7050
- */
7051
-  function vtodo() {
7042
+    var $components;
7043
+/**
7044
+     * constructor for calendar component VTODO object
7045
+     *
7046
+     * @author Kjell-Inge Gustafsson <[email protected]>
7047
+     * @since 2.5.1 - 2008-10-31
7048
+     * @return void
7049
+     */
7050
+    function vtodo() {
7052 7051
     $this->calendarComponent();
7053 7052
 
7054 7053
     $this->attach          = '';
@@ -7084,16 +7083,16 @@  discard block
 block discarded – undo
7084 7083
     $this->xprop           = '';
7085 7084
 
7086 7085
     $this->components      = array();
7087
-  }
7086
+    }
7088 7087
 /**
7089
- * create formatted output for calendar component VTODO object instance
7090
- *
7091
- * @author Kjell-Inge Gustafsson <[email protected]>
7092
- * @since 2.5.1 - 2008-11-07
7093
- * @param array $xcaldecl
7094
- * @return string
7095
- */
7096
-  function createComponent( &$xcaldecl ) {
7088
+     * create formatted output for calendar component VTODO object instance
7089
+     *
7090
+     * @author Kjell-Inge Gustafsson <[email protected]>
7091
+     * @since 2.5.1 - 2008-11-07
7092
+     * @param array $xcaldecl
7093
+     * @return string
7094
+     */
7095
+    function createComponent( &$xcaldecl ) {
7097 7096
     $objectname    = $this->_createFormat();
7098 7097
     $component     = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
7099 7098
     $component    .= $this->createUid();
@@ -7132,11 +7131,11 @@  discard block
 block discarded – undo
7132 7131
     $component    .= $this->createSubComponent();
7133 7132
     $component    .= $this->componentEnd1.$objectname.$this->componentEnd2;
7134 7133
     if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) {
7135
-      foreach( $this->xcaldecl as $localxcaldecl )
7134
+        foreach( $this->xcaldecl as $localxcaldecl )
7136 7135
         $xcaldecl[] = $localxcaldecl;
7137 7136
     }
7138 7137
     return $component;
7139
-  }
7138
+    }
7140 7139
 }
7141 7140
 /*********************************************************************************/
7142 7141
 /*********************************************************************************/
@@ -7147,37 +7146,37 @@  discard block
 block discarded – undo
7147 7146
  * @since 2.5.1 - 2008-10-12
7148 7147
  */
7149 7148
 class vjournal extends calendarComponent {
7150
-  var $attach;
7151
-  var $attendee;
7152
-  var $categories;
7153
-  var $comment;
7154
-  var $contact;
7155
-  var $class;
7156
-  var $created;
7157
-  var $description;
7158
-  var $dtstart;
7159
-  var $exdate;
7160
-  var $exrule;
7161
-  var $lastmodified;
7162
-  var $organizer;
7163
-  var $rdate;
7164
-  var $recurrenceid;
7165
-  var $relatedto;
7166
-  var $requeststatus;
7167
-  var $rrule;
7168
-  var $sequence;
7169
-  var $status;
7170
-  var $summary;
7171
-  var $url;
7172
-  var $xprop;
7173
-/**
7174
- * constructor for calendar component VJOURNAL object
7175
- *
7176
- * @author Kjell-Inge Gustafsson <[email protected]>
7177
- * @since 2.5.1 - 2008-10-31
7178
- * @return void
7179
- */
7180
-  function vjournal() {
7149
+    var $attach;
7150
+    var $attendee;
7151
+    var $categories;
7152
+    var $comment;
7153
+    var $contact;
7154
+    var $class;
7155
+    var $created;
7156
+    var $description;
7157
+    var $dtstart;
7158
+    var $exdate;
7159
+    var $exrule;
7160
+    var $lastmodified;
7161
+    var $organizer;
7162
+    var $rdate;
7163
+    var $recurrenceid;
7164
+    var $relatedto;
7165
+    var $requeststatus;
7166
+    var $rrule;
7167
+    var $sequence;
7168
+    var $status;
7169
+    var $summary;
7170
+    var $url;
7171
+    var $xprop;
7172
+/**
7173
+     * constructor for calendar component VJOURNAL object
7174
+     *
7175
+     * @author Kjell-Inge Gustafsson <[email protected]>
7176
+     * @since 2.5.1 - 2008-10-31
7177
+     * @return void
7178
+     */
7179
+    function vjournal() {
7181 7180
     $this->calendarComponent();
7182 7181
 
7183 7182
     $this->attach          = '';
@@ -7203,16 +7202,16 @@  discard block
 block discarded – undo
7203 7202
     $this->summary         = '';
7204 7203
     $this->url             = '';
7205 7204
     $this->xprop           = '';
7206
-  }
7205
+    }
7207 7206
 /**
7208
- * create formatted output for calendar component VJOURNAL object instance
7209
- *
7210
- * @author Kjell-Inge Gustafsson <[email protected]>
7211
- * @since 2.5.1 - 2008-10-12
7212
- * @param array $xcaldecl
7213
- * @return string
7214
- */
7215
-  function createComponent( &$xcaldecl ) {
7207
+     * create formatted output for calendar component VJOURNAL object instance
7208
+     *
7209
+     * @author Kjell-Inge Gustafsson <[email protected]>
7210
+     * @since 2.5.1 - 2008-10-12
7211
+     * @param array $xcaldecl
7212
+     * @return string
7213
+     */
7214
+    function createComponent( &$xcaldecl ) {
7216 7215
     $objectname = $this->_createFormat();
7217 7216
     $component  = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
7218 7217
     $component .= $this->createUid();
@@ -7242,11 +7241,11 @@  discard block
 block discarded – undo
7242 7241
     $component .= $this->createXprop();
7243 7242
     $component .= $this->componentEnd1.$objectname.$this->componentEnd2;
7244 7243
     if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) {
7245
-      foreach( $this->xcaldecl as $localxcaldecl )
7244
+        foreach( $this->xcaldecl as $localxcaldecl )
7246 7245
         $xcaldecl[] = $localxcaldecl;
7247 7246
     }
7248 7247
     return $component;
7249
-  }
7248
+    }
7250 7249
 }
7251 7250
 /*********************************************************************************/
7252 7251
 /*********************************************************************************/
@@ -7257,27 +7256,27 @@  discard block
 block discarded – undo
7257 7256
  * @since 2.5.1 - 2008-10-12
7258 7257
  */
7259 7258
 class vfreebusy extends calendarComponent {
7260
-  var $attendee;
7261
-  var $comment;
7262
-  var $contact;
7263
-  var $dtend;
7264
-  var $dtstart;
7265
-  var $duration;
7266
-  var $freebusy;
7267
-  var $organizer;
7268
-  var $requeststatus;
7269
-  var $url;
7270
-  var $xprop;
7259
+    var $attendee;
7260
+    var $comment;
7261
+    var $contact;
7262
+    var $dtend;
7263
+    var $dtstart;
7264
+    var $duration;
7265
+    var $freebusy;
7266
+    var $organizer;
7267
+    var $requeststatus;
7268
+    var $url;
7269
+    var $xprop;
7271 7270
             //  component subcomponents container
7272
-  var $components;
7273
-/**
7274
- * constructor for calendar component VFREEBUSY object
7275
- *
7276
- * @author Kjell-Inge Gustafsson <[email protected]>
7277
- * @since 2.5.1 - 2008-10-31
7278
- * @return void
7279
- */
7280
-  function vfreebusy() {
7271
+    var $components;
7272
+/**
7273
+     * constructor for calendar component VFREEBUSY object
7274
+     *
7275
+     * @author Kjell-Inge Gustafsson <[email protected]>
7276
+     * @since 2.5.1 - 2008-10-31
7277
+     * @return void
7278
+     */
7279
+    function vfreebusy() {
7281 7280
     $this->calendarComponent();
7282 7281
 
7283 7282
     $this->attendee        = '';
@@ -7291,16 +7290,16 @@  discard block
 block discarded – undo
7291 7290
     $this->requeststatus   = '';
7292 7291
     $this->url             = '';
7293 7292
     $this->xprop           = '';
7294
-  }
7293
+    }
7295 7294
 /**
7296
- * create formatted output for calendar component VFREEBUSY object instance
7297
- *
7298
- * @author Kjell-Inge Gustafsson <[email protected]>
7299
- * @since 2.3.1 - 2007-11-19
7300
- * @param array $xcaldecl
7301
- * @return string
7302
- */
7303
-  function createComponent( &$xcaldecl ) {
7295
+     * create formatted output for calendar component VFREEBUSY object instance
7296
+     *
7297
+     * @author Kjell-Inge Gustafsson <[email protected]>
7298
+     * @since 2.3.1 - 2007-11-19
7299
+     * @param array $xcaldecl
7300
+     * @return string
7301
+     */
7302
+    function createComponent( &$xcaldecl ) {
7304 7303
     $objectname = $this->_createFormat();
7305 7304
     $component  = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
7306 7305
     $component .= $this->createUid();
@@ -7318,11 +7317,11 @@  discard block
 block discarded – undo
7318 7317
     $component .= $this->createXprop();
7319 7318
     $component .= $this->componentEnd1.$objectname.$this->componentEnd2;
7320 7319
     if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) {
7321
-      foreach( $this->xcaldecl as $localxcaldecl )
7320
+        foreach( $this->xcaldecl as $localxcaldecl )
7322 7321
         $xcaldecl[] = $localxcaldecl;
7323 7322
     }
7324 7323
     return $component;
7325
-  }
7324
+    }
7326 7325
 }
7327 7326
 /*********************************************************************************/
7328 7327
 /*********************************************************************************/
@@ -7333,23 +7332,23 @@  discard block
 block discarded – undo
7333 7332
  * @since 2.5.1 - 2008-10-12
7334 7333
  */
7335 7334
 class valarm extends calendarComponent {
7336
-  var $action;
7337
-  var $attach;
7338
-  var $attendee;
7339
-  var $description;
7340
-  var $duration;
7341
-  var $repeat;
7342
-  var $summary;
7343
-  var $trigger;
7344
-  var $xprop;
7345
-/**
7346
- * constructor for calendar component VALARM object
7347
- *
7348
- * @author Kjell-Inge Gustafsson <[email protected]>
7349
- * @since 2.5.1 - 2008-10-31
7350
- * @return void
7351
- */
7352
-  function valarm() {
7335
+    var $action;
7336
+    var $attach;
7337
+    var $attendee;
7338
+    var $description;
7339
+    var $duration;
7340
+    var $repeat;
7341
+    var $summary;
7342
+    var $trigger;
7343
+    var $xprop;
7344
+/**
7345
+     * constructor for calendar component VALARM object
7346
+     *
7347
+     * @author Kjell-Inge Gustafsson <[email protected]>
7348
+     * @since 2.5.1 - 2008-10-31
7349
+     * @return void
7350
+     */
7351
+    function valarm() {
7353 7352
     $this->calendarComponent();
7354 7353
 
7355 7354
     $this->action          = '';
@@ -7361,16 +7360,16 @@  discard block
 block discarded – undo
7361 7360
     $this->summary         = '';
7362 7361
     $this->trigger         = '';
7363 7362
     $this->xprop           = '';
7364
-  }
7363
+    }
7365 7364
 /**
7366
- * create formatted output for calendar component VALARM object instance
7367
- *
7368
- * @author Kjell-Inge Gustafsson <[email protected]>
7369
- * @since 2.5.1 - 2008-10-22
7370
- * @param array $xcaldecl
7371
- * @return string
7372
- */
7373
-  function createComponent( &$xcaldecl ) {
7365
+     * create formatted output for calendar component VALARM object instance
7366
+     *
7367
+     * @author Kjell-Inge Gustafsson <[email protected]>
7368
+     * @since 2.5.1 - 2008-10-22
7369
+     * @param array $xcaldecl
7370
+     * @return string
7371
+     */
7372
+    function createComponent( &$xcaldecl ) {
7374 7373
     $objectname    = $this->_createFormat();
7375 7374
     $component     = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
7376 7375
     $component    .= $this->createAction();
@@ -7384,7 +7383,7 @@  discard block
 block discarded – undo
7384 7383
     $component    .= $this->createXprop();
7385 7384
     $component    .= $this->componentEnd1.$objectname.$this->componentEnd2;
7386 7385
     return $component;
7387
-  }
7386
+    }
7388 7387
 }
7389 7388
 /**********************************************************************************
7390 7389
 /*********************************************************************************/
@@ -7395,34 +7394,34 @@  discard block
 block discarded – undo
7395 7394
  * @since 2.5.1 - 2008-10-12
7396 7395
  */
7397 7396
 class vtimezone extends calendarComponent {
7398
-  var $timezonetype;
7397
+    var $timezonetype;
7399 7398
 
7400
-  var $comment;
7401
-  var $dtstart;
7402
-  var $lastmodified;
7403
-  var $rdate;
7404
-  var $rrule;
7405
-  var $tzid;
7406
-  var $tzname;
7407
-  var $tzoffsetfrom;
7408
-  var $tzoffsetto;
7409
-  var $tzurl;
7410
-  var $xprop;
7399
+    var $comment;
7400
+    var $dtstart;
7401
+    var $lastmodified;
7402
+    var $rdate;
7403
+    var $rrule;
7404
+    var $tzid;
7405
+    var $tzname;
7406
+    var $tzoffsetfrom;
7407
+    var $tzoffsetto;
7408
+    var $tzurl;
7409
+    var $xprop;
7411 7410
             //  component subcomponents container
7412
-  var $components;
7413
-/**
7414
- * constructor for calendar component VTIMEZONE object
7415
- *
7416
- * @author Kjell-Inge Gustafsson <[email protected]>
7417
- * @since 2.5.1 - 2008-10-31
7418
- * @param string $timezonetype optional, default FALSE ( STANDARD / DAYLIGHT )
7419
- * @return void
7420
- */
7421
-  function vtimezone( $timezonetype=FALSE ) {
7411
+    var $components;
7412
+/**
7413
+     * constructor for calendar component VTIMEZONE object
7414
+     *
7415
+     * @author Kjell-Inge Gustafsson <[email protected]>
7416
+     * @since 2.5.1 - 2008-10-31
7417
+     * @param string $timezonetype optional, default FALSE ( STANDARD / DAYLIGHT )
7418
+     * @return void
7419
+     */
7420
+    function vtimezone( $timezonetype=FALSE ) {
7422 7421
     if( !$timezonetype )
7423
-      $this->timezonetype = 'VTIMEZONE';
7422
+        $this->timezonetype = 'VTIMEZONE';
7424 7423
     else
7425
-      $this->timezonetype = strtoupper( $timezonetype );
7424
+        $this->timezonetype = strtoupper( $timezonetype );
7426 7425
     $this->calendarComponent();
7427 7426
 
7428 7427
     $this->comment         = '';
@@ -7438,16 +7437,16 @@  discard block
 block discarded – undo
7438 7437
     $this->xprop           = '';
7439 7438
 
7440 7439
     $this->components      = array();
7441
-  }
7440
+    }
7442 7441
 /**
7443
- * create formatted output for calendar component VTIMEZONE object instance
7444
- *
7445
- * @author Kjell-Inge Gustafsson <[email protected]>
7446
- * @since 2.5.1 - 2008-10-25
7447
- * @param array $xcaldecl
7448
- * @return string
7449
- */
7450
-  function createComponent( &$xcaldecl ) {
7442
+     * create formatted output for calendar component VTIMEZONE object instance
7443
+     *
7444
+     * @author Kjell-Inge Gustafsson <[email protected]>
7445
+     * @since 2.5.1 - 2008-10-25
7446
+     * @param array $xcaldecl
7447
+     * @return string
7448
+     */
7449
+    function createComponent( &$xcaldecl ) {
7451 7450
     $objectname    = $this->_createFormat();
7452 7451
     $component     = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
7453 7452
     $component    .= $this->createTzid();
@@ -7464,10 +7463,10 @@  discard block
 block discarded – undo
7464 7463
     $component    .= $this->createSubComponent();
7465 7464
     $component    .= $this->componentEnd1.$objectname.$this->componentEnd2;
7466 7465
     if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) {
7467
-      foreach( $this->xcaldecl as $localxcaldecl )
7466
+        foreach( $this->xcaldecl as $localxcaldecl )
7468 7467
         $xcaldecl[] = $localxcaldecl;
7469 7468
     }
7470 7469
     return $component;
7471
-  }
7470
+    }
7472 7471
 }
7473 7472
 ?>
7474 7473
\ No newline at end of file
Please login to merge, or discard this patch.
main/inc/lib/api.lib.php 1 patch
Indentation   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -625,7 +625,6 @@  discard block
 block discarded – undo
625 625
  * The other configuration parameters have not been changed.
626 626
  *
627 627
  * This is how we can get most used paths, for common purpose:
628
-
629 628
  * api_get_path(REL_PATH)                       /chamilo/
630 629
  * api_get_path(REL_COURSE_PATH)                /chamilo/courses/
631 630
  * api_get_path(REL_CODE_PATH)                  /chamilo/main/
@@ -1803,7 +1802,6 @@  discard block
 block discarded – undo
1803 1802
 
1804 1803
 /**
1805 1804
  * Returns the current course info array.
1806
-
1807 1805
  * Now if the course_code is given, the returned array gives info about that
1808 1806
  * particular course, not specially the current one.
1809 1807
  * @param int $id Numeric ID of the course
@@ -2734,7 +2732,7 @@  discard block
 block discarded – undo
2734 2732
         switch ($session_user_status) {
2735 2733
             case 0:
2736 2734
                 $session_status['status'] = 'student';
2737
-               break;
2735
+                break;
2738 2736
             case 2:
2739 2737
                 $session_status['status'] = 'coach';
2740 2738
             break;
@@ -6492,7 +6490,7 @@  discard block
 block discarded – undo
6492 6490
 function api_get_jquery_ui_js($include_jqgrid = false) {
6493 6491
     $libraries = array();
6494 6492
     if ($include_jqgrid) {
6495
-       $libraries[]='jqgrid';
6493
+        $libraries[]='jqgrid';
6496 6494
     }
6497 6495
     return api_get_jquery_libraries_js($libraries);
6498 6496
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/dompdf_config.inc.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
  */
114 114
 
115 115
 if (!defined("DOMPDF_FONT_CACHE")) {
116
-  define("DOMPDF_FONT_CACHE", DOMPDF_FONT_DIR);
116
+    define("DOMPDF_FONT_CACHE", DOMPDF_FONT_DIR);
117 117
 }
118 118
 
119 119
 /**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
  * using the PFDLib back end.
125 125
  */
126 126
 if (!defined('DOMPDF_TEMP_DIR')) {
127
-  define("DOMPDF_TEMP_DIR", sys_get_temp_dir());
127
+    define("DOMPDF_TEMP_DIR", sys_get_temp_dir());
128 128
 }
129 129
 
130 130
 /**
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  * $dompdf = new DOMPDF();	$dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
141 141
  */
142 142
 if (!defined("DOMPDF_CHROOT")) {
143
-  define("DOMPDF_CHROOT", realpath(DOMPDF_DIR));
143
+    define("DOMPDF_CHROOT", realpath(DOMPDF_DIR));
144 144
 }
145 145
 
146 146
 /**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
  *
158 158
  */
159 159
 if (!defined("DOMPDF_UNICODE_ENABLED")) {
160
-  define("DOMPDF_UNICODE_ENABLED", false);
160
+    define("DOMPDF_UNICODE_ENABLED", false);
161 161
 }
162 162
 
163 163
 /**
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
  * @link http://ttf2pt1.sourceforge.net/
173 173
  */
174 174
 if (!defined("TTF2AFM")) {
175
-  define("TTF2AFM", DOMPDF_LIB_DIR ."/ttf2ufm/ttf2ufm-src/ttf2pt1");
176
-  //define("TTF2AFM", "/usr/bin/ttf2pt1");
175
+    define("TTF2AFM", DOMPDF_LIB_DIR ."/ttf2ufm/ttf2ufm-src/ttf2pt1");
176
+    //define("TTF2AFM", "/usr/bin/ttf2pt1");
177 177
 }
178 178
 
179 179
 /**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
  * @link http://www.php.net/image
206 206
  */
207 207
 if (!defined("DOMPDF_PDF_BACKEND")) {
208
-  define("DOMPDF_PDF_BACKEND", "CPDF");
208
+    define("DOMPDF_PDF_BACKEND", "CPDF");
209 209
 }
210 210
 
211 211
 /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  * a real license code must exist!
222 222
  */
223 223
 if (!defined("DOMPDF_PDFLIB_LICENSE")) {
224
-  #define("DOMPDF_PDFLIB_LICENSE", "your license key here");
224
+    #define("DOMPDF_PDFLIB_LICENSE", "your license key here");
225 225
 }
226 226
 
227 227
 /**
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
  * Therefore allow specification of content here.
236 236
  */
237 237
 if (!defined("DOMPDF_DEFAULT_MEDIA_TYPE")) {
238
-  define("DOMPDF_DEFAULT_MEDIA_TYPE", "screen");
238
+    define("DOMPDF_DEFAULT_MEDIA_TYPE", "screen");
239 239
 }
240 240
 
241 241
 /**
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
  * @see CPDF_Adapter::PAPER_SIZES for valid sizes
247 247
  */
248 248
 if (!defined("DOMPDF_DEFAULT_PAPER_SIZE")) {
249
-  define("DOMPDF_DEFAULT_PAPER_SIZE", "letter");
249
+    define("DOMPDF_DEFAULT_PAPER_SIZE", "letter");
250 250
 }
251 251
 
252 252
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
  * @var string
258 258
  */
259 259
 if (!defined("DOMPDF_DEFAULT_FONT")) {
260
-  define("DOMPDF_DEFAULT_FONT", "serif");
260
+    define("DOMPDF_DEFAULT_FONT", "serif");
261 261
 }
262 262
 /**
263 263
  * Image DPI setting
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
  * @var int
294 294
  */
295 295
 if (!defined("DOMPDF_DPI")) {
296
-  define("DOMPDF_DPI", "96");
296
+    define("DOMPDF_DPI", "96");
297 297
 }
298 298
 
299 299
 /**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
  * @var bool
310 310
  */
311 311
 if (!defined("DOMPDF_ENABLE_PHP")) {
312
-  define("DOMPDF_ENABLE_PHP", true);
312
+    define("DOMPDF_ENABLE_PHP", true);
313 313
 }
314 314
 
315 315
 /**
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
  * @var bool
331 331
  */
332 332
 if (!defined("DOMPDF_ENABLE_REMOTE")) {
333
-  define("DOMPDF_ENABLE_REMOTE", false);
333
+    define("DOMPDF_ENABLE_REMOTE", false);
334 334
 }
335 335
  
336 336
 /**
@@ -344,25 +344,25 @@  discard block
 block discarded – undo
344 344
  * @param string $class
345 345
  */
346 346
 function DOMPDF_autoload($class) {
347
-  $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php";
347
+    $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php";
348 348
   
349
-  if ( is_file($filename) )
349
+    if ( is_file($filename) )
350 350
     require_once($filename);
351 351
 }
352 352
 
353 353
 if ( function_exists("spl_autoload_register") ) {
354 354
 
355
-   spl_autoload_register("DOMPDF_autoload");
355
+    spl_autoload_register("DOMPDF_autoload");
356 356
 
357 357
 } else if ( !function_exists("__autoload") ) {
358
-  /**
359
-   * Default __autoload() function
360
-   *
361
-   * @param string $class
362
-   */
363
-  function __autoload($class) {
358
+    /**
359
+     * Default __autoload() function
360
+     *
361
+     * @param string $class
362
+     */
363
+    function __autoload($class) {
364 364
     DOMPDF_autoload($class);
365
-  }
365
+    }
366 366
 }
367 367
 
368 368
 // ### End of user-configurable options ###
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
  * the browser cache and the premature output prevents setting of the mime type.
417 417
  */
418 418
 if (!defined('DEBUGPNG')) {
419
-  define('DEBUGPNG',0);
419
+    define('DEBUGPNG',0);
420 420
 }
421 421
 if (!defined('DEBUGKEEPTEMP')) {
422
-  define('DEBUGKEEPTEMP',0);
422
+    define('DEBUGKEEPTEMP',0);
423 423
 }
424 424
 if (!defined('DEBUGCSS')) {
425
-  define('DEBUGCSS',0);
425
+    define('DEBUGCSS',0);
426 426
 }
Please login to merge, or discard this patch.
main/install/install.lib.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
         $html .= '<label class="checkbox-inline">
1683 1683
                         <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .'
1684 1684
                     </label>';
1685
-         $html .= '<label class="checkbox-inline">
1685
+            $html .= '<label class="checkbox-inline">
1686 1686
                     <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .'
1687 1687
                 </label>';
1688 1688
         $html .= '</div>';
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
     </div>';
1717 1717
 
1718 1718
     echo panel($html, get_lang('Platform'), 'platform');
1719
- ?>
1719
+    ?>
1720 1720
     <div class='form-group'>
1721 1721
         <div class="col-sm-6">
1722 1722
             <button type="submit" class="btn btn-default pull-right" name="step3" value="&lt; <?php echo get_lang('Previous'); ?>" ><em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?></button>
Please login to merge, or discard this patch.
main/newscorm/lp_add_item.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
 
82 82
 // Using the resource linker as a tool for adding resources to the learning path.
83 83
 if ($action == 'add' && $type == 'learnpathitem') {
84
-     $htmlHeadXtra[] = "<script type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
84
+        $htmlHeadXtra[] = "<script type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
85 85
 }
86 86
 if ((!$is_allowed_to_edit)) {
87 87
     error_log('New LP - User not authorized in lp_add_item.php');
Please login to merge, or discard this patch.
main/newscorm/lp_move_item.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@
 block discarded – undo
47 47
 " .
48 48
 "\n" .
49 49
 '$().ready(function() {'."\n" .
50
-  'if ($(\'#previous\')) {'."\n" .
50
+    'if ($(\'#previous\')) {'."\n" .
51 51
     'if(\'parent is\'+$(\'#idParent\').val()) {'.
52
-      'load_cbo($(\'#idParent\').val());'."\n" .
53
-  '}}'."\n" .
52
+        'load_cbo($(\'#idParent\').val());'."\n" .
53
+    '}}'."\n" .
54 54
 '});</script>'."\n" ;
55 55
 
56 56
 /* Constants and variables */
Please login to merge, or discard this patch.
main/inc/ajax/course_home.ajax.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
             echo json_encode($response_data);
64 64
         }
65 65
         break;
66
-	case 'show_course_information' :
67
-		require_once '../global.inc.php';
66
+    case 'show_course_information' :
67
+        require_once '../global.inc.php';
68 68
 
69
-		// Get the name of the database course.
70
-		$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
71
-		$course_info = api_get_course_info($_GET['code']);
69
+        // Get the name of the database course.
70
+        $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
71
+        $course_info = api_get_course_info($_GET['code']);
72 72
 
73 73
         if (
74 74
             api_get_setting('course_catalog_hide_private') === 'true' &&
@@ -77,27 +77,27 @@  discard block
 block discarded – undo
77 77
             echo get_lang('PrivateAccess');
78 78
             break;
79 79
         }
80
-		//echo Display::tag('h2', $course_info['name']);
81
-		//echo '<br />';
80
+        //echo Display::tag('h2', $course_info['name']);
81
+        //echo '<br />';
82 82
 
83
-		$sql = "SELECT * FROM $tbl_course_description
83
+        $sql = "SELECT * FROM $tbl_course_description
84 84
 		        WHERE c_id = ".$course_info['real_id']." AND session_id = 0
85 85
 		        ORDER BY id";
86
-		$result = Database::query($sql);
87
-		if (Database::num_rows($result) > 0 ) {
88
-		    while ($description = Database::fetch_object($result)) {
89
-			    $descriptions[$description->id] = $description;
90
-		    }
86
+        $result = Database::query($sql);
87
+        if (Database::num_rows($result) > 0 ) {
88
+            while ($description = Database::fetch_object($result)) {
89
+                $descriptions[$description->id] = $description;
90
+            }
91 91
             // Function that displays the details of the course description in html.
92
-		    echo CourseManager::get_details_course_description_html(
92
+            echo CourseManager::get_details_course_description_html(
93 93
                 $descriptions,
94 94
                 api_get_system_encoding(),
95 95
                 false
96 96
             );
97
-		} else {
98
-		    echo get_lang('NoDescription');
99
-		}
100
-	    break;
97
+        } else {
98
+            echo get_lang('NoDescription');
99
+        }
100
+        break;
101 101
     case 'session_courses_lp_default':
102 102
         /**
103 103
          * @todo this functions need to belong to a class or a special
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $sidx  = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id';
113 113
         $sord  = $_REQUEST['sord'];    //asc or desc
114 114
         if (!in_array($sord, array('asc','desc'))) {
115
-        	$sord = 'desc';
115
+            $sord = 'desc';
116 116
         }
117 117
         $session_id  = intval($_REQUEST['session_id']);
118 118
         $course_id   = intval($_REQUEST['course_id']);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                     $my_session_list[] = $item['id_session'];
128 128
             }
129 129
             if (!in_array($session_id, $my_session_list)) {
130
-            	break;
130
+                break;
131 131
             }
132 132
         }
133 133
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
                     $date = '-';
313 313
                 }
314 314
 
315
-                 //Checking LP publicated and expired_on dates
315
+                    //Checking LP publicated and expired_on dates
316 316
 
317 317
                 if (!empty($lp_item['publicated_on']) && $lp_item['publicated_on'] != '0000-00-00 00:00:00') {
318 318
                     $week_data = date('Y', api_strtotime($lp_item['publicated_on'], 'UTC')).' - '.get_week_from_day($lp_item['publicated_on']);
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
                     $date = '-';
441 441
                 }
442 442
 
443
-                 //Checking LP publicated and expired_on dates
443
+                    //Checking LP publicated and expired_on dates
444 444
                 if (!empty($lp_item['publicated_on']) && $lp_item['publicated_on'] != '0000-00-00 00:00:00') {
445 445
                     if ($now < api_strtotime($lp_item['publicated_on'], 'UTC')) {
446 446
                         continue;
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 
495 495
         echo json_encode($response);
496 496
         break;
497
-	default:
498
-		echo '';
497
+    default:
498
+        echo '';
499 499
 }
500 500
 exit;
Please login to merge, or discard this patch.
main/gradebook/lib/be/learnpathlink.class.php 1 patch
Indentation   +242 added lines, -242 removed lines patch added patch discarded remove patch
@@ -9,260 +9,260 @@
 block discarded – undo
9 9
  */
10 10
 class LearnpathLink extends AbstractLink
11 11
 {
12
-	private $course_info = null;
13
-	private $learnpath_table = null;
14
-	private $learnpath_data = null;
15
-
16
-	/**
17
-	 * Constructor
18
-	 */
19
-	public function __construct()
20
-	{
21
-		parent::__construct();
22
-		$this->set_type(LINK_LEARNPATH);
23
-	}
24
-
25
-	/**
26
-	 * Generate an array of learnpaths that a teacher hasn't created a link for.
27
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
28
-	 */
29
-	public function get_not_created_links()
30
-	{
31
-		return false;
32
-		if (empty($this->course_code))
33
-			die('Error in get_not_created_links() : course code not set');
34
-
35
-		$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
36
-
37
-		$sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp
12
+    private $course_info = null;
13
+    private $learnpath_table = null;
14
+    private $learnpath_data = null;
15
+
16
+    /**
17
+     * Constructor
18
+     */
19
+    public function __construct()
20
+    {
21
+        parent::__construct();
22
+        $this->set_type(LINK_LEARNPATH);
23
+    }
24
+
25
+    /**
26
+     * Generate an array of learnpaths that a teacher hasn't created a link for.
27
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
28
+     */
29
+    public function get_not_created_links()
30
+    {
31
+        return false;
32
+        if (empty($this->course_code))
33
+            die('Error in get_not_created_links() : course code not set');
34
+
35
+        $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
36
+
37
+        $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp
38 38
 				WHERE c_id = '.$this->course_id.' AND id NOT IN '
39
-			.' (SELECT ref_id FROM '.$tbl_grade_links
40
-			.' WHERE type = '.LINK_LEARNPATH
41
-			." AND course_code = '".$this->get_course_code()."'"
42
-			.') AND lp.session_id='.api_get_session_id().'';
43
-
44
-		$result = Database::query($sql);
45
-
46
-		$cats=array();
47
-		while ($data=Database::fetch_array($result)) {
48
-			$cats[] = array ($data['id'], $data['name']);
49
-		}
50
-
51
-		return $cats;
52
-	}
53
-
54
-	/**
55
-	 * Generate an array of all learnpaths available.
56
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
57
-	 */
58
-	public function get_all_links()
59
-	{
60
-		if (empty($this->course_code))
61
-			die('Error in get_not_created_links() : course code not set');
62
-
63
-		$session_id = api_get_session_id();
64
-		if (empty($session_id)) {
65
-			$session_condition = api_get_session_condition(0, true);
66
-		} else {
67
-			$session_condition = api_get_session_condition($session_id, true, true);
68
-		}
69
-
70
-		$sql = 'SELECT id, name FROM '.$this->get_learnpath_table().'
39
+            .' (SELECT ref_id FROM '.$tbl_grade_links
40
+            .' WHERE type = '.LINK_LEARNPATH
41
+            ." AND course_code = '".$this->get_course_code()."'"
42
+            .') AND lp.session_id='.api_get_session_id().'';
43
+
44
+        $result = Database::query($sql);
45
+
46
+        $cats=array();
47
+        while ($data=Database::fetch_array($result)) {
48
+            $cats[] = array ($data['id'], $data['name']);
49
+        }
50
+
51
+        return $cats;
52
+    }
53
+
54
+    /**
55
+     * Generate an array of all learnpaths available.
56
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
57
+     */
58
+    public function get_all_links()
59
+    {
60
+        if (empty($this->course_code))
61
+            die('Error in get_not_created_links() : course code not set');
62
+
63
+        $session_id = api_get_session_id();
64
+        if (empty($session_id)) {
65
+            $session_condition = api_get_session_condition(0, true);
66
+        } else {
67
+            $session_condition = api_get_session_condition($session_id, true, true);
68
+        }
69
+
70
+        $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().'
71 71
                 WHERE c_id = '.$this->course_id.' '.$session_condition.' ';
72
-		$result = Database::query($sql);
72
+        $result = Database::query($sql);
73 73
 
74
-		$cats = array();
75
-		while ($data=Database::fetch_array($result)) {
76
-			$cats[] = array ($data['id'], $data['name']);
77
-		}
74
+        $cats = array();
75
+        while ($data=Database::fetch_array($result)) {
76
+            $cats[] = array ($data['id'], $data['name']);
77
+        }
78 78
 
79
-		return $cats;
80
-	}
79
+        return $cats;
80
+    }
81 81
 
82 82
 
83
-	/**
84
-	 * Has anyone used this learnpath yet ?
85
-	 */
86
-	public function has_results()
87
-	{
88
-		$tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
89
-		$sql = "SELECT count(id) AS number FROM $tbl_stats
83
+    /**
84
+     * Has anyone used this learnpath yet ?
85
+     */
86
+    public function has_results()
87
+    {
88
+        $tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
89
+        $sql = "SELECT count(id) AS number FROM $tbl_stats
90 90
 				WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id();
91
-		$result = Database::query($sql);
92
-		$number = Database::fetch_array($result,'NUM');
93
-		return ($number[0] != 0);
94
-	}
95
-
96
-	/**
97
-	 * Get the progress of this learnpath. Only the last attempt are taken into account.
98
-	 * @param $stud_id student id (default: all students who have results - then the average is returned)
99
-	 * @return	array (score, max) if student is given
100
-	 * 			array (sum of scores, number of scores) otherwise
101
-	 * 			or null if no scores available
102
-	 */
103
-	public function calc_score($stud_id = null, $type = null)
104
-	{
105
-		$tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
106
-		$session_id = api_get_session_id();
107
-
108
-		$sql = "SELECT * FROM $tbl_stats
91
+        $result = Database::query($sql);
92
+        $number = Database::fetch_array($result,'NUM');
93
+        return ($number[0] != 0);
94
+    }
95
+
96
+    /**
97
+     * Get the progress of this learnpath. Only the last attempt are taken into account.
98
+     * @param $stud_id student id (default: all students who have results - then the average is returned)
99
+     * @return	array (score, max) if student is given
100
+     * 			array (sum of scores, number of scores) otherwise
101
+     * 			or null if no scores available
102
+     */
103
+    public function calc_score($stud_id = null, $type = null)
104
+    {
105
+        $tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
106
+        $session_id = api_get_session_id();
107
+
108
+        $sql = "SELECT * FROM $tbl_stats
109 109
                 WHERE
110 110
                 	c_id = ".$this->course_id." AND
111 111
                     lp_id = ".$this->get_ref_id()." AND
112 112
                     session_id = $session_id ";
113 113
 
114
-		if (isset($stud_id))
115
-			$sql .= ' AND user_id = '.intval($stud_id);
116
-
117
-		// order by id, that way the student's first attempt is accessed first
118
-		$sql .= ' ORDER BY view_count DESC';
119
-
120
-		$scores = Database::query($sql);
121
-		// for 1 student
122
-		if (isset($stud_id)) {
123
-			if ($data = Database::fetch_assoc($scores)) {
124
-				return array ($data['progress'], 100);
125
-			} else
126
-				return null;
127
-		} else {
128
-			// all students -> get average
129
-			$students = array();  // user list, needed to make sure we only
130
-			// take first attempts into account
131
-			$rescount = 0;
132
-			$sum = 0;
133
-			$bestResult = 0;
134
-			$sumResult = 0;
135
-			while ($data = Database::fetch_array($scores)) {
136
-				if (!(array_key_exists($data['user_id'], $students))) {
137
-					$students[$data['user_id']] = $data['progress'];
138
-					$rescount++;
139
-					$sum += $data['progress'] / 100;
140
-					$sumResult += $data['progress'];
141
-
142
-					if ($data['progress'] > $bestResult) {
143
-						$bestResult = $data['progress'];
144
-					}
145
-				}
146
-			}
147
-
148
-			if ($rescount == 0) {
149
-				return null;
150
-			} else {
151
-
152
-				switch ($type) {
153
-					case 'best':
154
-						return array($bestResult, 100);
155
-						break;
156
-					case 'average':
157
-						return array($sumResult/$rescount, 100);
158
-						break;
159
-					case 'ranking':
160
-						return AbstractLink::getCurrentUserRanking($stud_id, $students);
161
-						break;
162
-					default:
163
-						return array($sum, $rescount);
164
-						break;
165
-				}
166
-			}
167
-		}
168
-	}
169
-
170
-	/**
171
-	 * Get URL where to go to if the user clicks on the link.
172
-	 */
173
-	public function get_link()
174
-	{
175
-		$url = api_get_path(WEB_PATH).'main/newscorm/lp_controller.php?cidReq='.$this->get_course_code().'&gradebook=view';
176
-		$session_id = api_get_session_id();
177
-		if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) {
178
-			$url .= '&action=view&session_id='.$session_id.'&lp_id='.$this->get_ref_id();
179
-		} else {
180
-			$url .= '&action=build&session_id='.$session_id.'&lp_id='.$this->get_ref_id();
181
-		}
182
-		return $url;
183
-	}
184
-
185
-	/**
186
-	 * Get name to display: same as learnpath title
187
-	 */
188
-	public function get_name()
189
-	{
190
-		$data = $this->get_learnpath_data();
191
-		return $data['name'];
192
-	}
193
-
194
-	/**
195
-	 * Get description to display: same as learnpath description
196
-	 */
197
-	public function get_description()
198
-	{
199
-		$data = $this->get_learnpath_data();
200
-		return $data['description'];
201
-	}
202
-
203
-	/**
204
-	 * Check if this still links to a learnpath
205
-	 */
206
-	public function is_valid_link() {
207
-		$sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().'
114
+        if (isset($stud_id))
115
+            $sql .= ' AND user_id = '.intval($stud_id);
116
+
117
+        // order by id, that way the student's first attempt is accessed first
118
+        $sql .= ' ORDER BY view_count DESC';
119
+
120
+        $scores = Database::query($sql);
121
+        // for 1 student
122
+        if (isset($stud_id)) {
123
+            if ($data = Database::fetch_assoc($scores)) {
124
+                return array ($data['progress'], 100);
125
+            } else
126
+                return null;
127
+        } else {
128
+            // all students -> get average
129
+            $students = array();  // user list, needed to make sure we only
130
+            // take first attempts into account
131
+            $rescount = 0;
132
+            $sum = 0;
133
+            $bestResult = 0;
134
+            $sumResult = 0;
135
+            while ($data = Database::fetch_array($scores)) {
136
+                if (!(array_key_exists($data['user_id'], $students))) {
137
+                    $students[$data['user_id']] = $data['progress'];
138
+                    $rescount++;
139
+                    $sum += $data['progress'] / 100;
140
+                    $sumResult += $data['progress'];
141
+
142
+                    if ($data['progress'] > $bestResult) {
143
+                        $bestResult = $data['progress'];
144
+                    }
145
+                }
146
+            }
147
+
148
+            if ($rescount == 0) {
149
+                return null;
150
+            } else {
151
+
152
+                switch ($type) {
153
+                    case 'best':
154
+                        return array($bestResult, 100);
155
+                        break;
156
+                    case 'average':
157
+                        return array($sumResult/$rescount, 100);
158
+                        break;
159
+                    case 'ranking':
160
+                        return AbstractLink::getCurrentUserRanking($stud_id, $students);
161
+                        break;
162
+                    default:
163
+                        return array($sum, $rescount);
164
+                        break;
165
+                }
166
+            }
167
+        }
168
+    }
169
+
170
+    /**
171
+     * Get URL where to go to if the user clicks on the link.
172
+     */
173
+    public function get_link()
174
+    {
175
+        $url = api_get_path(WEB_PATH).'main/newscorm/lp_controller.php?cidReq='.$this->get_course_code().'&gradebook=view';
176
+        $session_id = api_get_session_id();
177
+        if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) {
178
+            $url .= '&action=view&session_id='.$session_id.'&lp_id='.$this->get_ref_id();
179
+        } else {
180
+            $url .= '&action=build&session_id='.$session_id.'&lp_id='.$this->get_ref_id();
181
+        }
182
+        return $url;
183
+    }
184
+
185
+    /**
186
+     * Get name to display: same as learnpath title
187
+     */
188
+    public function get_name()
189
+    {
190
+        $data = $this->get_learnpath_data();
191
+        return $data['name'];
192
+    }
193
+
194
+    /**
195
+     * Get description to display: same as learnpath description
196
+     */
197
+    public function get_description()
198
+    {
199
+        $data = $this->get_learnpath_data();
200
+        return $data['description'];
201
+    }
202
+
203
+    /**
204
+     * Check if this still links to a learnpath
205
+     */
206
+    public function is_valid_link() {
207
+        $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().'
208 208
                 WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' ';
209
-		$result = Database::query($sql);
210
-		$number = Database::fetch_row($result,'NUM');
211
-		return ($number[0] != 0);
212
-	}
213
-
214
-	public function get_type_name()
215
-	{
216
-		return get_lang('LearningPaths');
217
-	}
218
-
219
-	public function needs_name_and_description()
220
-	{
221
-		return false;
222
-	}
223
-
224
-	public function needs_max()
225
-	{
226
-		return false;
227
-	}
228
-
229
-	public function needs_results()
230
-	{
231
-		return false;
232
-	}
233
-
234
-	public function is_allowed_to_change_name()
235
-	{
236
-		return false;
237
-	}
238
-
239
-	// INTERNAL FUNCTIONS
240
-
241
-	/**
242
-	 * Lazy load function to get the database table of the learnpath
243
-	 */
244
-	private function get_learnpath_table()
245
-	{
246
-		$this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN);
247
-		return $this->learnpath_table;
248
-	}
249
-
250
-	/**
251
-	 * Lazy load function to get the database contents of this learnpath
252
-	 */
253
-	private function get_learnpath_data()
254
-	{
255
-		if (!isset($this->learnpath_data)) {
256
-			$sql = 'SELECT * FROM '.$this->get_learnpath_table().'
209
+        $result = Database::query($sql);
210
+        $number = Database::fetch_row($result,'NUM');
211
+        return ($number[0] != 0);
212
+    }
213
+
214
+    public function get_type_name()
215
+    {
216
+        return get_lang('LearningPaths');
217
+    }
218
+
219
+    public function needs_name_and_description()
220
+    {
221
+        return false;
222
+    }
223
+
224
+    public function needs_max()
225
+    {
226
+        return false;
227
+    }
228
+
229
+    public function needs_results()
230
+    {
231
+        return false;
232
+    }
233
+
234
+    public function is_allowed_to_change_name()
235
+    {
236
+        return false;
237
+    }
238
+
239
+    // INTERNAL FUNCTIONS
240
+
241
+    /**
242
+     * Lazy load function to get the database table of the learnpath
243
+     */
244
+    private function get_learnpath_table()
245
+    {
246
+        $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN);
247
+        return $this->learnpath_table;
248
+    }
249
+
250
+    /**
251
+     * Lazy load function to get the database contents of this learnpath
252
+     */
253
+    private function get_learnpath_data()
254
+    {
255
+        if (!isset($this->learnpath_data)) {
256
+            $sql = 'SELECT * FROM '.$this->get_learnpath_table().'
257 257
                     WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' ';
258
-			$result = Database::query($sql);
259
-			$this->learnpath_data = Database::fetch_array($result);
260
-		}
261
-		return $this->learnpath_data;
262
-	}
263
-
264
-	public function get_icon_name()
265
-	{
266
-		return 'learnpath';
267
-	}
258
+            $result = Database::query($sql);
259
+            $this->learnpath_data = Database::fetch_array($result);
260
+        }
261
+        return $this->learnpath_data;
262
+    }
263
+
264
+    public function get_icon_name()
265
+    {
266
+        return 'learnpath';
267
+    }
268 268
 }
Please login to merge, or discard this patch.