@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $this->thisDay() |
| 224 | 224 | ); |
| 225 | 225 | |
| 226 | - for ($i=1; $i <= $end; $i++) { |
|
| 226 | + for ($i = 1; $i <= $end; $i++) { |
|
| 227 | 227 | $stamp = $this->cE->dateToStamp($year, $month, $day++); |
| 228 | 228 | $this->children[$i] = new Day( |
| 229 | 229 | $this->cE->stampToYear($stamp), |
@@ -235,13 +235,13 @@ discard block |
||
| 235 | 235 | //set empty days (@see Calendar_Month_Weeks::build()) |
| 236 | 236 | if ($this->firstWeek) { |
| 237 | 237 | $eBefore = $this->tableHelper->getEmptyDaysBefore(); |
| 238 | - for ($i=1; $i <= $eBefore; $i++) { |
|
| 238 | + for ($i = 1; $i <= $eBefore; $i++) { |
|
| 239 | 239 | $this->children[$i]->setEmpty(); |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | if ($this->lastWeek) { |
| 243 | 243 | $eAfter = $this->tableHelper->getEmptyDaysAfterOffset(); |
| 244 | - for ($i = $eAfter+1; $i <= $end; $i++) { |
|
| 244 | + for ($i = $eAfter + 1; $i <= $end; $i++) { |
|
| 245 | 245 | $this->children[$i]->setEmpty(); |
| 246 | 246 | } |
| 247 | 247 | } |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | switch (strtolower($format)) { |
| 349 | 349 | case 'int': |
| 350 | 350 | case 'n_in_month': |
| 351 | - return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1; |
|
| 351 | + return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') - 1; |
|
| 352 | 352 | case 'n_in_year': |
| 353 | 353 | return $this->cE->getWeekNInYear( |
| 354 | 354 | $this->cE->stampToYear($this->prevWeek), |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | switch (strtolower($format)) { |
| 422 | 422 | case 'int': |
| 423 | 423 | case 'n_in_month': |
| 424 | - return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1; |
|
| 424 | + return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') + 1; |
|
| 425 | 425 | case 'n_in_year': |
| 426 | 426 | return $this->cE->getWeekNInYear( |
| 427 | 427 | $this->cE->stampToYear($this->nextWeek), |
@@ -331,21 +331,21 @@ discard block |
||
| 331 | 331 | function prevWeek($format = 'n_in_month') |
| 332 | 332 | { |
| 333 | 333 | switch (strtolower($format)) { |
| 334 | - case 'int': |
|
| 335 | - case 'n_in_month': |
|
| 336 | - return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1; |
|
| 337 | - case 'n_in_year': |
|
| 338 | - return $this->cE->getWeekNInYear( |
|
| 339 | - $this->cE->stampToYear($this->prevWeek), |
|
| 340 | - $this->cE->stampToMonth($this->prevWeek), |
|
| 341 | - $this->cE->stampToDay($this->prevWeek)); |
|
| 342 | - case 'array': |
|
| 343 | - return $this->toArray($this->prevWeek); |
|
| 344 | - case 'object': |
|
| 345 | - return Factory::createByTimestamp('Week', $this->prevWeek); |
|
| 346 | - case 'timestamp': |
|
| 347 | - default: |
|
| 348 | - return $this->prevWeek; |
|
| 334 | + case 'int': |
|
| 335 | + case 'n_in_month': |
|
| 336 | + return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1; |
|
| 337 | + case 'n_in_year': |
|
| 338 | + return $this->cE->getWeekNInYear( |
|
| 339 | + $this->cE->stampToYear($this->prevWeek), |
|
| 340 | + $this->cE->stampToMonth($this->prevWeek), |
|
| 341 | + $this->cE->stampToDay($this->prevWeek)); |
|
| 342 | + case 'array': |
|
| 343 | + return $this->toArray($this->prevWeek); |
|
| 344 | + case 'object': |
|
| 345 | + return Factory::createByTimestamp('Week', $this->prevWeek); |
|
| 346 | + case 'timestamp': |
|
| 347 | + default: |
|
| 348 | + return $this->prevWeek; |
|
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | |
@@ -360,34 +360,34 @@ discard block |
||
| 360 | 360 | function thisWeek($format = 'n_in_month') |
| 361 | 361 | { |
| 362 | 362 | switch (strtolower($format)) { |
| 363 | - case 'int': |
|
| 364 | - case 'n_in_month': |
|
| 365 | - if ($this->firstWeek) { |
|
| 366 | - return 1; |
|
| 367 | - } |
|
| 368 | - if ($this->lastWeek) { |
|
| 369 | - return $this->cE->getWeeksInMonth( |
|
| 363 | + case 'int': |
|
| 364 | + case 'n_in_month': |
|
| 365 | + if ($this->firstWeek) { |
|
| 366 | + return 1; |
|
| 367 | + } |
|
| 368 | + if ($this->lastWeek) { |
|
| 369 | + return $this->cE->getWeeksInMonth( |
|
| 370 | + $this->thisYear(), |
|
| 371 | + $this->thisMonth(), |
|
| 372 | + $this->firstDay); |
|
| 373 | + } |
|
| 374 | + return $this->cE->getWeekNInMonth( |
|
| 370 | 375 | $this->thisYear(), |
| 371 | 376 | $this->thisMonth(), |
| 377 | + $this->thisDay(), |
|
| 372 | 378 | $this->firstDay); |
| 373 | - } |
|
| 374 | - return $this->cE->getWeekNInMonth( |
|
| 375 | - $this->thisYear(), |
|
| 376 | - $this->thisMonth(), |
|
| 377 | - $this->thisDay(), |
|
| 378 | - $this->firstDay); |
|
| 379 | - case 'n_in_year': |
|
| 380 | - return $this->cE->getWeekNInYear( |
|
| 381 | - $this->cE->stampToYear($this->thisWeek), |
|
| 382 | - $this->cE->stampToMonth($this->thisWeek), |
|
| 383 | - $this->cE->stampToDay($this->thisWeek)); |
|
| 384 | - case 'array': |
|
| 385 | - return $this->toArray($this->thisWeek); |
|
| 386 | - case 'object': |
|
| 387 | - return Factory::createByTimestamp('Week', $this->thisWeek); |
|
| 388 | - case 'timestamp': |
|
| 389 | - default: |
|
| 390 | - return $this->thisWeek; |
|
| 379 | + case 'n_in_year': |
|
| 380 | + return $this->cE->getWeekNInYear( |
|
| 381 | + $this->cE->stampToYear($this->thisWeek), |
|
| 382 | + $this->cE->stampToMonth($this->thisWeek), |
|
| 383 | + $this->cE->stampToDay($this->thisWeek)); |
|
| 384 | + case 'array': |
|
| 385 | + return $this->toArray($this->thisWeek); |
|
| 386 | + case 'object': |
|
| 387 | + return Factory::createByTimestamp('Week', $this->thisWeek); |
|
| 388 | + case 'timestamp': |
|
| 389 | + default: |
|
| 390 | + return $this->thisWeek; |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | |
@@ -402,21 +402,21 @@ discard block |
||
| 402 | 402 | function nextWeek($format = 'n_in_month') |
| 403 | 403 | { |
| 404 | 404 | switch (strtolower($format)) { |
| 405 | - case 'int': |
|
| 406 | - case 'n_in_month': |
|
| 407 | - return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1; |
|
| 408 | - case 'n_in_year': |
|
| 409 | - return $this->cE->getWeekNInYear( |
|
| 410 | - $this->cE->stampToYear($this->nextWeek), |
|
| 411 | - $this->cE->stampToMonth($this->nextWeek), |
|
| 412 | - $this->cE->stampToDay($this->nextWeek)); |
|
| 413 | - case 'array': |
|
| 414 | - return $this->toArray($this->nextWeek); |
|
| 415 | - case 'object': |
|
| 416 | - return Factory::createByTimestamp('Week', $this->nextWeek); |
|
| 417 | - case 'timestamp': |
|
| 418 | - default: |
|
| 419 | - return $this->nextWeek; |
|
| 405 | + case 'int': |
|
| 406 | + case 'n_in_month': |
|
| 407 | + return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1; |
|
| 408 | + case 'n_in_year': |
|
| 409 | + return $this->cE->getWeekNInYear( |
|
| 410 | + $this->cE->stampToYear($this->nextWeek), |
|
| 411 | + $this->cE->stampToMonth($this->nextWeek), |
|
| 412 | + $this->cE->stampToDay($this->nextWeek)); |
|
| 413 | + case 'array': |
|
| 414 | + return $this->toArray($this->nextWeek); |
|
| 415 | + case 'object': |
|
| 416 | + return Factory::createByTimestamp('Week', $this->nextWeek); |
|
| 417 | + case 'timestamp': |
|
| 418 | + default: |
|
| 419 | + return $this->nextWeek; |
|
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | function stampCollection($stamp) |
| 78 | 78 | { |
| 79 | 79 | static $stamps = array(); |
| 80 | - if ( !isset($stamps[$stamp]) ) { |
|
| 80 | + if (!isset($stamps[$stamp])) { |
|
| 81 | 81 | $date = @date('Y n j H i s t W w', $stamp); |
| 82 | 82 | $stamps[$stamp] = sscanf($date, "%d %d %d %d %d %d %d %d %d"); |
| 83 | 83 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @return int Unix timestamp |
| 182 | 182 | * @access protected |
| 183 | 183 | */ |
| 184 | - function dateToStamp($y, $m, $d, $h=0, $i=0, $s=0) |
|
| 184 | + function dateToStamp($y, $m, $d, $h = 0, $i = 0, $s = 0) |
|
| 185 | 185 | { |
| 186 | 186 | static $dates = array(); |
| 187 | 187 | if (!isset($dates[$y][$m][$d][$h][$i][$s])) { |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * @return int (12) |
| 221 | 221 | * @access protected |
| 222 | 222 | */ |
| 223 | - function getMonthsInYear($y=null) |
|
| 223 | + function getMonthsInYear($y = null) |
|
| 224 | 224 | { |
| 225 | 225 | return 12; |
| 226 | 226 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * @return int (7) |
| 269 | 269 | * @access protected |
| 270 | 270 | */ |
| 271 | - function getDaysInWeek($y=null, $m=null, $d=null) |
|
| 271 | + function getDaysInWeek($y = null, $m = null, $d = null) |
|
| 272 | 272 | { |
| 273 | 273 | return 7; |
| 274 | 274 | } |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | * @return int week number |
| 302 | 302 | * @access protected |
| 303 | 303 | */ |
| 304 | - function getWeekNInMonth($y, $m, $d, $firstDay=1) |
|
| 304 | + function getWeekNInMonth($y, $m, $d, $firstDay = 1) |
|
| 305 | 305 | { |
| 306 | - $weekEnd = (0 == $firstDay) ? $this->getDaysInWeek()-1 : $firstDay-1; |
|
| 306 | + $weekEnd = (0 == $firstDay) ? $this->getDaysInWeek() - 1 : $firstDay - 1; |
|
| 307 | 307 | $end_of_week = 1; |
| 308 | 308 | while (@date('w', @mktime(0, 0, 0, $m, $end_of_week, $y)) != $weekEnd) { |
| 309 | 309 | ++$end_of_week; //find first weekend of the month |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | * @return array (0,1,2,3,4,5,6) 1 = Monday |
| 372 | 372 | * @access protected |
| 373 | 373 | */ |
| 374 | - function getWeekDays($y=null, $m=null, $d=null) |
|
| 374 | + function getWeekDays($y = null, $m = null, $d = null) |
|
| 375 | 375 | { |
| 376 | 376 | return array(0, 1, 2, 3, 4, 5, 6); |
| 377 | 377 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | * @return int (default 1 = Monday) |
| 387 | 387 | * @access protected |
| 388 | 388 | */ |
| 389 | - function getFirstDayOfWeek($y=null, $m=null, $d=null) |
|
| 389 | + function getFirstDayOfWeek($y = null, $m = null, $d = null) |
|
| 390 | 390 | { |
| 391 | 391 | return 1; |
| 392 | 392 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | * @return int (24) |
| 402 | 402 | * @access protected |
| 403 | 403 | */ |
| 404 | - function getHoursInDay($y=null, $m=null, $d=null) |
|
| 404 | + function getHoursInDay($y = null, $m = null, $d = null) |
|
| 405 | 405 | { |
| 406 | 406 | return 24; |
| 407 | 407 | } |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | * @return int (60) |
| 418 | 418 | * @access protected |
| 419 | 419 | */ |
| 420 | - function getMinutesInHour($y=null, $m=null, $d=null, $h=null) |
|
| 420 | + function getMinutesInHour($y = null, $m = null, $d = null, $h = null) |
|
| 421 | 421 | { |
| 422 | 422 | return 60; |
| 423 | 423 | } |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | * @return int (60) |
| 435 | 435 | * @access protected |
| 436 | 436 | */ |
| 437 | - function getSecondsInMinute($y=null, $m=null, $d=null, $h=null, $i=null) |
|
| 437 | + function getSecondsInMinute($y = null, $m = null, $d = null, $h = null, $i = null) |
|
| 438 | 438 | { |
| 439 | 439 | return 60; |
| 440 | 440 | } |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | $today = sscanf($today_date, '%d %d %d'); |
| 456 | 456 | } |
| 457 | 457 | $date = UnixTS::stampCollection($stamp); |
| 458 | - return ( $date[2] == $today[2] |
|
| 458 | + return ($date[2] == $today[2] |
|
| 459 | 459 | && $date[1] == $today[1] |
| 460 | 460 | && $date[0] == $today[0] |
| 461 | 461 | ); |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | $format = 'long'; |
| 81 | 81 | } |
| 82 | 82 | $months = array(); |
| 83 | - for ($i=1; $i<=12; $i++) { |
|
| 83 | + for ($i = 1; $i <= 12; $i++) { |
|
| 84 | 84 | $stamp = mktime(0, 0, 0, $i, 1, 2003); |
| 85 | 85 | $month = strftime($formats[$format], $stamp); |
| 86 | - switch($format) { |
|
| 86 | + switch ($format) { |
|
| 87 | 87 | case 'one': |
| 88 | 88 | $month = substr($month, 0, 1); |
| 89 | 89 | break; |
@@ -117,10 +117,10 @@ discard block |
||
| 117 | 117 | $format = 'long'; |
| 118 | 118 | } |
| 119 | 119 | $days = array(); |
| 120 | - for ($i=0; $i<=6; $i++) { |
|
| 121 | - $stamp = mktime(0, 0, 0, 11, $i+2, 2003); |
|
| 120 | + for ($i = 0; $i <= 6; $i++) { |
|
| 121 | + $stamp = mktime(0, 0, 0, 11, $i + 2, 2003); |
|
| 122 | 122 | $day = strftime($formats[$format], $stamp); |
| 123 | - switch($format) { |
|
| 123 | + switch ($format) { |
|
| 124 | 124 | case 'one': |
| 125 | 125 | $day = substr($day, 0, 1); |
| 126 | 126 | break; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @access public |
| 213 | 213 | * @static |
| 214 | 214 | */ |
| 215 | - function thisDayName($Calendar, $format='long') |
|
| 215 | + function thisDayName($Calendar, $format = 'long') |
|
| 216 | 216 | { |
| 217 | 217 | $days = Textual::weekdayNames($format); |
| 218 | 218 | $stamp = $Calendar->thisDay('timestamp'); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * @access public |
| 232 | 232 | * @static |
| 233 | 233 | */ |
| 234 | - function nextDayName($Calendar, $format='long') |
|
| 234 | + function nextDayName($Calendar, $format = 'long') |
|
| 235 | 235 | { |
| 236 | 236 | $days = Textual::weekdayNames($format); |
| 237 | 237 | $stamp = $Calendar->nextDay('timestamp'); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | //check if defined / set |
| 265 | 265 | if (defined('CALENDAR_FIRST_DAY_OF_WEEK')) { |
| 266 | 266 | $firstDay = CALENDAR_FIRST_DAY_OF_WEEK; |
| 267 | - } elseif(isset($Calendar->firstDay)) { |
|
| 267 | + } elseif (isset($Calendar->firstDay)) { |
|
| 268 | 268 | $firstDay = $Calendar->firstDay; |
| 269 | 269 | } |
| 270 | 270 | $ordereddays = array(); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @access public |
| 115 | 115 | */ |
| 116 | - function __construct($y, $m, $firstDay=null) |
|
| 116 | + function __construct($y, $m, $firstDay = null) |
|
| 117 | 117 | { |
| 118 | 118 | parent::__construct($y, $m, $firstDay); |
| 119 | 119 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | function buildEmptyDaysBefore() |
| 152 | 152 | { |
| 153 | 153 | $eBefore = $this->tableHelper->getEmptyDaysBefore(); |
| 154 | - for ($i=0; $i < $eBefore; $i++) { |
|
| 154 | + for ($i = 0; $i < $eBefore; $i++) { |
|
| 155 | 155 | $stamp = $this->cE->dateToStamp($this->year, $this->month, -$i); |
| 156 | 156 | $Day = new Day( |
| 157 | 157 | $this->cE->stampToYear($stamp), |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | { |
| 188 | 188 | $eAfter = $this->tableHelper->getEmptyDaysAfter(); |
| 189 | 189 | $sDOM = $this->tableHelper->getNumTableDaysInMonth(); |
| 190 | - for ($i=1; $i <= $sDOM-$eAfter; $i++) { |
|
| 191 | - $Day = new Day($this->year, $this->month+1, $i); |
|
| 190 | + for ($i = 1; $i <= $sDOM - $eAfter; $i++) { |
|
| 191 | + $Day = new Day($this->year, $this->month + 1, $i); |
|
| 192 | 192 | $Day->setEmpty(); |
| 193 | 193 | $Day->adjust(); |
| 194 | 194 | array_push($this->children, $Day); |
@@ -210,9 +210,9 @@ discard block |
||
| 210 | 210 | $this->thisDay() |
| 211 | 211 | ); |
| 212 | 212 | $sDOM = $this->tableHelper->getNumTableDaysInMonth(); |
| 213 | - for ($i=1; $i <= $sDOM; $i+= $dIW) { |
|
| 213 | + for ($i = 1; $i <= $sDOM; $i += $dIW) { |
|
| 214 | 214 | $this->children[$i]->setFirst(); |
| 215 | - $this->children[$i+($dIW-1)]->setLast(); |
|
| 215 | + $this->children[$i + ($dIW - 1)]->setLast(); |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -137,7 +137,7 @@ |
||
| 137 | 137 | * @return string |
| 138 | 138 | * @access public |
| 139 | 139 | */ |
| 140 | - function toString () |
|
| 140 | + function toString() |
|
| 141 | 141 | { |
| 142 | 142 | return $this->unit.' = '.$this->value.' ['.$this->message.']'; |
| 143 | 143 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | 'Hour', $h, CALENDAR_VALUE_TOOSMALL.$min); |
| 206 | 206 | return false; |
| 207 | 207 | } |
| 208 | - $max = ($this->cE->getHoursInDay($this->calendar->thisDay())-1); |
|
| 208 | + $max = ($this->cE->getHoursInDay($this->calendar->thisDay()) - 1); |
|
| 209 | 209 | if ($h > $max) { |
| 210 | 210 | $this->errors[] = new ValidationError( |
| 211 | 211 | 'Hour', $h, CALENDAR_VALUE_TOOLARGE.$max); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | 'Minute', $i, CALENDAR_VALUE_TOOSMALL.$min); |
| 230 | 230 | return false; |
| 231 | 231 | } |
| 232 | - $max = ($this->cE->getMinutesInHour($this->calendar->thisHour())-1); |
|
| 232 | + $max = ($this->cE->getMinutesInHour($this->calendar->thisHour()) - 1); |
|
| 233 | 233 | if ($i > $max) { |
| 234 | 234 | $this->errors[] = new ValidationError( |
| 235 | 235 | 'Minute', $i, CALENDAR_VALUE_TOOLARGE.$max); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | 'Second', $s, CALENDAR_VALUE_TOOSMALL.$min); |
| 254 | 254 | return false; |
| 255 | 255 | } |
| 256 | - $max = ($this->cE->getSecondsInMinute($this->calendar->thisMinute())-1); |
|
| 256 | + $max = ($this->cE->getSecondsInMinute($this->calendar->thisMinute()) - 1); |
|
| 257 | 257 | if ($s > $max) { |
| 258 | 258 | $this->errors[] = new ValidationError( |
| 259 | 259 | 'Second', $s, CALENDAR_VALUE_TOOLARGE.$max); |
@@ -83,11 +83,11 @@ |
||
| 83 | 83 | function build($sDates = array()) |
| 84 | 84 | { |
| 85 | 85 | $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day, |
| 86 | - $this->hour); |
|
| 86 | + $this->hour); |
|
| 87 | 87 | for ($i=0; $i < $mIH; $i++) { |
| 88 | 88 | $this->children[$i] = |
| 89 | 89 | new Minute($this->year, $this->month, $this->day, |
| 90 | - $this->hour, $i); |
|
| 90 | + $this->hour, $i); |
|
| 91 | 91 | } |
| 92 | 92 | if (count($sDates) > 0) { |
| 93 | 93 | $this->setSelection($sDates); |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | { |
| 85 | 85 | $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day, |
| 86 | 86 | $this->hour); |
| 87 | - for ($i=0; $i < $mIH; $i++) { |
|
| 87 | + for ($i = 0; $i < $mIH; $i++) { |
|
| 88 | 88 | $this->children[$i] = |
| 89 | 89 | new Minute($this->year, $this->month, $this->day, |
| 90 | 90 | $this->hour, $i); |
@@ -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 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @access public |
| 68 | 68 | */ |
| 69 | - function __construct($y, $m, $firstDay=null) |
|
| 69 | + function __construct($y, $m, $firstDay = null) |
|
| 70 | 70 | { |
| 71 | 71 | parent::__construct($y, $m); |
| 72 | 72 | $this->firstDay = $this->defineFirstDayOfWeek($firstDay); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | function build($sDates = array()) |
| 85 | 85 | { |
| 86 | 86 | $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); |
| 87 | - for ($i=1; $i<=$daysInMonth; $i++) { |
|
| 87 | + for ($i = 1; $i <= $daysInMonth; $i++) { |
|
| 88 | 88 | $this->children[$i] = new Day($this->year, $this->month, $i); |
| 89 | 89 | } |
| 90 | 90 | if (count($sDates) > 0) { |