@@ -346,22 +346,22 @@ discard block |
||
346 | 346 | function prevWeek($format = 'n_in_month') |
347 | 347 | { |
348 | 348 | switch (strtolower($format)) { |
349 | - case 'int': |
|
350 | - case 'n_in_month': |
|
351 | - return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1; |
|
352 | - case 'n_in_year': |
|
353 | - return $this->cE->getWeekNInYear( |
|
354 | - $this->cE->stampToYear($this->prevWeek), |
|
355 | - $this->cE->stampToMonth($this->prevWeek), |
|
356 | - $this->cE->stampToDay($this->prevWeek)); |
|
357 | - case 'array': |
|
358 | - return $this->toArray($this->prevWeek); |
|
359 | - case 'object': |
|
360 | - include_once CALENDAR_ROOT.'Factory.php'; |
|
361 | - return Factory::createByTimestamp('Week', $this->prevWeek); |
|
362 | - case 'timestamp': |
|
363 | - default: |
|
364 | - return $this->prevWeek; |
|
349 | + case 'int': |
|
350 | + case 'n_in_month': |
|
351 | + return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1; |
|
352 | + case 'n_in_year': |
|
353 | + return $this->cE->getWeekNInYear( |
|
354 | + $this->cE->stampToYear($this->prevWeek), |
|
355 | + $this->cE->stampToMonth($this->prevWeek), |
|
356 | + $this->cE->stampToDay($this->prevWeek)); |
|
357 | + case 'array': |
|
358 | + return $this->toArray($this->prevWeek); |
|
359 | + case 'object': |
|
360 | + include_once CALENDAR_ROOT.'Factory.php'; |
|
361 | + return Factory::createByTimestamp('Week', $this->prevWeek); |
|
362 | + case 'timestamp': |
|
363 | + default: |
|
364 | + return $this->prevWeek; |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
@@ -376,35 +376,35 @@ discard block |
||
376 | 376 | function thisWeek($format = 'n_in_month') |
377 | 377 | { |
378 | 378 | switch (strtolower($format)) { |
379 | - case 'int': |
|
380 | - case 'n_in_month': |
|
381 | - if ($this->firstWeek) { |
|
382 | - return 1; |
|
383 | - } |
|
384 | - if ($this->lastWeek) { |
|
385 | - return $this->cE->getWeeksInMonth( |
|
379 | + case 'int': |
|
380 | + case 'n_in_month': |
|
381 | + if ($this->firstWeek) { |
|
382 | + return 1; |
|
383 | + } |
|
384 | + if ($this->lastWeek) { |
|
385 | + return $this->cE->getWeeksInMonth( |
|
386 | + $this->thisYear(), |
|
387 | + $this->thisMonth(), |
|
388 | + $this->firstDay); |
|
389 | + } |
|
390 | + return $this->cE->getWeekNInMonth( |
|
386 | 391 | $this->thisYear(), |
387 | 392 | $this->thisMonth(), |
393 | + $this->thisDay(), |
|
388 | 394 | $this->firstDay); |
389 | - } |
|
390 | - return $this->cE->getWeekNInMonth( |
|
391 | - $this->thisYear(), |
|
392 | - $this->thisMonth(), |
|
393 | - $this->thisDay(), |
|
394 | - $this->firstDay); |
|
395 | - case 'n_in_year': |
|
396 | - return $this->cE->getWeekNInYear( |
|
397 | - $this->cE->stampToYear($this->thisWeek), |
|
398 | - $this->cE->stampToMonth($this->thisWeek), |
|
399 | - $this->cE->stampToDay($this->thisWeek)); |
|
400 | - case 'array': |
|
401 | - return $this->toArray($this->thisWeek); |
|
402 | - case 'object': |
|
403 | - include_once CALENDAR_ROOT.'Factory.php'; |
|
404 | - return Factory::createByTimestamp('Week', $this->thisWeek); |
|
405 | - case 'timestamp': |
|
406 | - default: |
|
407 | - return $this->thisWeek; |
|
395 | + case 'n_in_year': |
|
396 | + return $this->cE->getWeekNInYear( |
|
397 | + $this->cE->stampToYear($this->thisWeek), |
|
398 | + $this->cE->stampToMonth($this->thisWeek), |
|
399 | + $this->cE->stampToDay($this->thisWeek)); |
|
400 | + case 'array': |
|
401 | + return $this->toArray($this->thisWeek); |
|
402 | + case 'object': |
|
403 | + include_once CALENDAR_ROOT.'Factory.php'; |
|
404 | + return Factory::createByTimestamp('Week', $this->thisWeek); |
|
405 | + case 'timestamp': |
|
406 | + default: |
|
407 | + return $this->thisWeek; |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | |
@@ -419,22 +419,22 @@ discard block |
||
419 | 419 | function nextWeek($format = 'n_in_month') |
420 | 420 | { |
421 | 421 | switch (strtolower($format)) { |
422 | - case 'int': |
|
423 | - case 'n_in_month': |
|
424 | - return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1; |
|
425 | - case 'n_in_year': |
|
426 | - return $this->cE->getWeekNInYear( |
|
427 | - $this->cE->stampToYear($this->nextWeek), |
|
428 | - $this->cE->stampToMonth($this->nextWeek), |
|
429 | - $this->cE->stampToDay($this->nextWeek)); |
|
430 | - case 'array': |
|
431 | - return $this->toArray($this->nextWeek); |
|
432 | - case 'object': |
|
433 | - include_once CALENDAR_ROOT.'Factory.php'; |
|
434 | - return Factory::createByTimestamp('Week', $this->nextWeek); |
|
435 | - case 'timestamp': |
|
436 | - default: |
|
437 | - return $this->nextWeek; |
|
422 | + case 'int': |
|
423 | + case 'n_in_month': |
|
424 | + return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1; |
|
425 | + case 'n_in_year': |
|
426 | + return $this->cE->getWeekNInYear( |
|
427 | + $this->cE->stampToYear($this->nextWeek), |
|
428 | + $this->cE->stampToMonth($this->nextWeek), |
|
429 | + $this->cE->stampToDay($this->nextWeek)); |
|
430 | + case 'array': |
|
431 | + return $this->toArray($this->nextWeek); |
|
432 | + case 'object': |
|
433 | + include_once CALENDAR_ROOT.'Factory.php'; |
|
434 | + return Factory::createByTimestamp('Week', $this->nextWeek); |
|
435 | + case 'timestamp': |
|
436 | + default: |
|
437 | + return $this->nextWeek; |
|
438 | 438 | } |
439 | 439 | } |
440 | 440 |
@@ -83,41 +83,41 @@ |
||
83 | 83 | { |
84 | 84 | $firstDay = defined('CALENDAR_FIRST_DAY_OF_WEEK') ? CALENDAR_FIRST_DAY_OF_WEEK : 1; |
85 | 85 | switch ($type) { |
86 | - case 'Day': |
|
87 | - return new Day($y, $m, $d); |
|
88 | - case 'Month': |
|
89 | - // Set default state for which month type to build |
|
90 | - if (!defined('CALENDAR_MONTH_STATE')) { |
|
91 | - define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH); |
|
92 | - } |
|
93 | - switch (CALENDAR_MONTH_STATE) { |
|
94 | - case CALENDAR_USE_MONTH_WEEKDAYS: |
|
95 | - $class = 'PEAR\Calendar\Month\Weekdays'; |
|
96 | - break; |
|
97 | - case CALENDAR_USE_MONTH_WEEKS: |
|
98 | - $class = 'PEAR\Calendar\Month\Weeks'; |
|
99 | - break; |
|
100 | - case CALENDAR_USE_MONTH: |
|
101 | - default: |
|
102 | - $class = 'PEAR\Calendar\Month'; |
|
103 | - break; |
|
104 | - } |
|
86 | + case 'Day': |
|
87 | + return new Day($y, $m, $d); |
|
88 | + case 'Month': |
|
89 | + // Set default state for which month type to build |
|
90 | + if (!defined('CALENDAR_MONTH_STATE')) { |
|
91 | + define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH); |
|
92 | + } |
|
93 | + switch (CALENDAR_MONTH_STATE) { |
|
94 | + case CALENDAR_USE_MONTH_WEEKDAYS: |
|
95 | + $class = 'PEAR\Calendar\Month\Weekdays'; |
|
96 | + break; |
|
97 | + case CALENDAR_USE_MONTH_WEEKS: |
|
98 | + $class = 'PEAR\Calendar\Month\Weeks'; |
|
99 | + break; |
|
100 | + case CALENDAR_USE_MONTH: |
|
101 | + default: |
|
102 | + $class = 'PEAR\Calendar\Month'; |
|
103 | + break; |
|
104 | + } |
|
105 | 105 | return new $class($y, $m, $firstDay); |
106 | - case 'Week': |
|
107 | - return new Week($y, $m, $d, $firstDay); |
|
108 | - case 'Hour': |
|
109 | - return new Hour($y, $m, $d, $h); |
|
110 | - case 'Minute': |
|
111 | - return new Minute($y, $m, $d, $h, $i); |
|
112 | - case 'Second': |
|
113 | - return new Second($y, $m, $d, $h, $i, $s); |
|
114 | - case 'Year': |
|
115 | - return new Year($y); |
|
116 | - default: |
|
117 | - include_once 'PEAR.php'; |
|
118 | - PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type, |
|
119 | - null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()'); |
|
120 | - return false; |
|
106 | + case 'Week': |
|
107 | + return new Week($y, $m, $d, $firstDay); |
|
108 | + case 'Hour': |
|
109 | + return new Hour($y, $m, $d, $h); |
|
110 | + case 'Minute': |
|
111 | + return new Minute($y, $m, $d, $h, $i); |
|
112 | + case 'Second': |
|
113 | + return new Second($y, $m, $d, $h, $i, $s); |
|
114 | + case 'Year': |
|
115 | + return new Year($y); |
|
116 | + default: |
|
117 | + include_once 'PEAR.php'; |
|
118 | + PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type, |
|
119 | + null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()'); |
|
120 | + return false; |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | { |
89 | 89 | static $engine = false; |
90 | 90 | switch (CALENDAR_ENGINE) { |
91 | - case 'PearDate': |
|
92 | - $class = 'Calendar_Engine_PearDate'; |
|
93 | - break; |
|
94 | - case 'UnixTS': |
|
95 | - default: |
|
96 | - $class = 'PEAR\Calendar\Engine\UnixTS'; |
|
97 | - break; |
|
91 | + case 'PearDate': |
|
92 | + $class = 'Calendar_Engine_PearDate'; |
|
93 | + break; |
|
94 | + case 'UnixTS': |
|
95 | + default: |
|
96 | + $class = 'PEAR\Calendar\Engine\UnixTS'; |
|
97 | + break; |
|
98 | 98 | } |
99 | 99 | if (!$engine) { |
100 | 100 | if (!class_exists($class)) { |
@@ -341,18 +341,18 @@ discard block |
||
341 | 341 | function returnValue($returnType, $format, $stamp, $default) |
342 | 342 | { |
343 | 343 | switch (strtolower($format)) { |
344 | - case 'int': |
|
345 | - return $default; |
|
346 | - case 'array': |
|
347 | - return $this->toArray($stamp); |
|
348 | - break; |
|
349 | - case 'object': |
|
350 | - return Factory::createByTimestamp($returnType, $stamp); |
|
351 | - break; |
|
352 | - case 'timestamp': |
|
353 | - default: |
|
354 | - return $stamp; |
|
355 | - break; |
|
344 | + case 'int': |
|
345 | + return $default; |
|
346 | + case 'array': |
|
347 | + return $this->toArray($stamp); |
|
348 | + break; |
|
349 | + case 'object': |
|
350 | + return Factory::createByTimestamp($returnType, $stamp); |
|
351 | + break; |
|
352 | + case 'timestamp': |
|
353 | + default: |
|
354 | + return $stamp; |
|
355 | + break; |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 |