@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @return string iso-8601 datetime |
| 172 | 172 | * @access protected |
| 173 | 173 | */ |
| 174 | - function dateToStamp($y, $m, $d, $h=0, $i=0, $s=0) |
|
| 174 | + function dateToStamp($y, $m, $d, $h = 0, $i = 0, $s = 0) |
|
| 175 | 175 | { |
| 176 | 176 | $r = array(); |
| 177 | 177 | Calendar_Engine_PearDate::adjustDate($y, $m, $d, $h, $i, $s); |
@@ -222,8 +222,8 @@ discard block |
||
| 222 | 222 | $d += floor($h / 24); |
| 223 | 223 | $h %= 24; |
| 224 | 224 | } |
| 225 | - for(; $m < 1; $y--, $m+=12); |
|
| 226 | - for(; $m > 12; $y++, $m-=12); |
|
| 225 | + for (; $m < 1; $y--, $m += 12); |
|
| 226 | + for (; $m > 12; $y++, $m -= 12); |
|
| 227 | 227 | |
| 228 | 228 | while ($d < 1) { |
| 229 | 229 | if ($m > 1) { |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | } |
| 235 | 235 | $d += Date_Calc::daysInMonth($m, $y); |
| 236 | 236 | } |
| 237 | - for ($max_days = Date_Calc::daysInMonth($m, $y); $d > $max_days; ) { |
|
| 237 | + for ($max_days = Date_Calc::daysInMonth($m, $y); $d > $max_days;) { |
|
| 238 | 238 | $d -= $max_days; |
| 239 | 239 | if ($m < 12) { |
| 240 | 240 | $m++; |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * @return int (12) |
| 276 | 276 | * @access protected |
| 277 | 277 | */ |
| 278 | - function getMonthsInYear($y=null) |
|
| 278 | + function getMonthsInYear($y = null) |
|
| 279 | 279 | { |
| 280 | 280 | return 12; |
| 281 | 281 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | * @return int (7) |
| 320 | 320 | * @access protected |
| 321 | 321 | */ |
| 322 | - function getDaysInWeek($y=null, $m=null, $d=null) |
|
| 322 | + function getDaysInWeek($y = null, $m = null, $d = null) |
|
| 323 | 323 | { |
| 324 | 324 | return 7; |
| 325 | 325 | } |
@@ -352,9 +352,9 @@ discard block |
||
| 352 | 352 | * @return int week number |
| 353 | 353 | * @access protected |
| 354 | 354 | */ |
| 355 | - function getWeekNInMonth($y, $m, $d, $firstDay=1) |
|
| 355 | + function getWeekNInMonth($y, $m, $d, $firstDay = 1) |
|
| 356 | 356 | { |
| 357 | - $weekEnd = ($firstDay == 0) ? $this->getDaysInWeek()-1 : $firstDay-1; |
|
| 357 | + $weekEnd = ($firstDay == 0) ? $this->getDaysInWeek() - 1 : $firstDay - 1; |
|
| 358 | 358 | $end_of_week = (int)Date_Calc::nextDayOfWeek($weekEnd, 1, $m, $y, '%e', true); |
| 359 | 359 | $w = 1; |
| 360 | 360 | while ($d > $end_of_week) { |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | * @return int weeks number |
| 375 | 375 | * @access protected |
| 376 | 376 | */ |
| 377 | - function getWeeksInMonth($y, $m, $firstDay=1) |
|
| 377 | + function getWeeksInMonth($y, $m, $firstDay = 1) |
|
| 378 | 378 | { |
| 379 | 379 | $FDOM = Date_Calc::firstOfMonthWeekday($m, $y); |
| 380 | 380 | if ($FDOM == 0) { |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | * @return array (0, 1, 2, 3, 4, 5, 6) 1 = Monday |
| 418 | 418 | * @access protected |
| 419 | 419 | */ |
| 420 | - function getWeekDays($y=null, $m=null, $d=null) |
|
| 420 | + function getWeekDays($y = null, $m = null, $d = null) |
|
| 421 | 421 | { |
| 422 | 422 | return array(0, 1, 2, 3, 4, 5, 6); |
| 423 | 423 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | * @return int (default 1 = Monday) |
| 433 | 433 | * @access protected |
| 434 | 434 | */ |
| 435 | - function getFirstDayOfWeek($y=null, $m=null, $d=null) |
|
| 435 | + function getFirstDayOfWeek($y = null, $m = null, $d = null) |
|
| 436 | 436 | { |
| 437 | 437 | return 1; |
| 438 | 438 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | * @return int (24) |
| 448 | 448 | * @access protected |
| 449 | 449 | */ |
| 450 | - function getHoursInDay($y=null,$m=null,$d=null) |
|
| 450 | + function getHoursInDay($y = null, $m = null, $d = null) |
|
| 451 | 451 | { |
| 452 | 452 | return 24; |
| 453 | 453 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | * @return int (60) |
| 464 | 464 | * @access protected |
| 465 | 465 | */ |
| 466 | - function getMinutesInHour($y=null,$m=null,$d=null,$h=null) |
|
| 466 | + function getMinutesInHour($y = null, $m = null, $d = null, $h = null) |
|
| 467 | 467 | { |
| 468 | 468 | return 60; |
| 469 | 469 | } |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | * @return int (60) |
| 481 | 481 | * @access protected |
| 482 | 482 | */ |
| 483 | - function getSecondsInMinute($y=null,$m=null,$d=null,$h=null,$i=null) |
|
| 483 | + function getSecondsInMinute($y = null, $m = null, $d = null, $h = null, $i = null) |
|
| 484 | 484 | { |
| 485 | 485 | return 60; |
| 486 | 486 | } |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | $today = new Date(); |
| 501 | 501 | } |
| 502 | 502 | $date = Calendar_Engine_PearDate::stampCollection($stamp); |
| 503 | - return ( $date->day == $today->getDay() |
|
| 503 | + return ($date->day == $today->getDay() |
|
| 504 | 504 | && $date->month == $today->getMonth() |
| 505 | 505 | && $date->year == $today->getYear() |
| 506 | 506 | ); |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | include_once CALENDAR_ROOT.'Factory.php'; |
| 108 | 108 | $this->firstDay = $this->defineFirstDayOfWeek($firstDay); |
| 109 | 109 | $monthsInYear = $this->cE->getMonthsInYear($this->thisYear()); |
| 110 | - for ($i=1; $i <= $monthsInYear; $i++) { |
|
| 110 | + for ($i = 1; $i <= $monthsInYear; $i++) { |
|
| 111 | 111 | $this->children[$i] = Calendar_Factory::create('Month', $this->year, $i); |
| 112 | 112 | } |
| 113 | 113 | if (count($sDates) > 0) { |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | include_once CALENDAR_ROOT.'Second.php'; |
| 100 | 100 | $sIM = $this->cE->getSecondsInMinute($this->year, $this->month, |
| 101 | 101 | $this->day, $this->hour, $this->minute); |
| 102 | - for ($i=0; $i < $sIM; $i++) { |
|
| 102 | + for ($i = 0; $i < $sIM; $i++) { |
|
| 103 | 103 | $this->children[$i] = new Calendar_Second($this->year, $this->month, |
| 104 | 104 | $this->day, $this->hour, $this->minute, $i); |
| 105 | 105 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @return void |
| 241 | 241 | * @access private |
| 242 | 242 | */ |
| 243 | - function setEmpty ($state = true) |
|
| 243 | + function setEmpty($state = true) |
|
| 244 | 244 | { |
| 245 | 245 | if (method_exists($this->calendar, 'setEmpty')) { |
| 246 | 246 | $this->calendar->setEmpty($state); |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | */ |
| 436 | 436 | function prevWeek($format = 'n_in_month') |
| 437 | 437 | { |
| 438 | - if ( method_exists($this->calendar, 'prevWeek')) { |
|
| 438 | + if (method_exists($this->calendar, 'prevWeek')) { |
|
| 439 | 439 | return $this->calendar->prevWeek($format); |
| 440 | 440 | } else { |
| 441 | 441 | include_once 'PEAR.php'; |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | */ |
| 458 | 458 | function thisWeek($format = 'n_in_month') |
| 459 | 459 | { |
| 460 | - if ( method_exists($this->calendar, 'thisWeek')) { |
|
| 460 | + if (method_exists($this->calendar, 'thisWeek')) { |
|
| 461 | 461 | return $this->calendar->thisWeek($format); |
| 462 | 462 | } else { |
| 463 | 463 | include_once 'PEAR.php'; |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | */ |
| 480 | 480 | function nextWeek($format = 'n_in_month') |
| 481 | 481 | { |
| 482 | - if ( method_exists($this->calendar, 'nextWeek')) { |
|
| 482 | + if (method_exists($this->calendar, 'nextWeek')) { |
|
| 483 | 483 | return $this->calendar->nextWeek($format); |
| 484 | 484 | } else { |
| 485 | 485 | include_once 'PEAR.php'; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | 'Hour', $h, CALENDAR_VALUE_TOOSMALL.$min); |
| 205 | 205 | return false; |
| 206 | 206 | } |
| 207 | - $max = ($this->cE->getHoursInDay($this->calendar->thisDay())-1); |
|
| 207 | + $max = ($this->cE->getHoursInDay($this->calendar->thisDay()) - 1); |
|
| 208 | 208 | if ($h > $max) { |
| 209 | 209 | $this->errors[] = new Calendar_Validation_Error( |
| 210 | 210 | 'Hour', $h, CALENDAR_VALUE_TOOLARGE.$max); |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | 'Minute', $i, CALENDAR_VALUE_TOOSMALL.$min); |
| 229 | 229 | return false; |
| 230 | 230 | } |
| 231 | - $max = ($this->cE->getMinutesInHour($this->calendar->thisHour())-1); |
|
| 231 | + $max = ($this->cE->getMinutesInHour($this->calendar->thisHour()) - 1); |
|
| 232 | 232 | if ($i > $max) { |
| 233 | 233 | $this->errors[] = new Calendar_Validation_Error( |
| 234 | 234 | 'Minute', $i, CALENDAR_VALUE_TOOLARGE.$max); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | 'Second', $s, CALENDAR_VALUE_TOOSMALL.$min); |
| 253 | 253 | return false; |
| 254 | 254 | } |
| 255 | - $max = ($this->cE->getSecondsInMinute($this->calendar->thisMinute())-1); |
|
| 255 | + $max = ($this->cE->getSecondsInMinute($this->calendar->thisMinute()) - 1); |
|
| 256 | 256 | if ($s > $max) { |
| 257 | 257 | $this->errors[] = new Calendar_Validation_Error( |
| 258 | 258 | 'Second', $s, CALENDAR_VALUE_TOOLARGE.$max); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | * @return string |
| 370 | 370 | * @access public |
| 371 | 371 | */ |
| 372 | - function toString () |
|
| 372 | + function toString() |
|
| 373 | 373 | { |
| 374 | 374 | return $this->unit.' = '.$this->value.' ['.$this->message.']'; |
| 375 | 375 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @access protected |
| 116 | 116 | */ |
| 117 | - function __construct(& $calendar, $firstDay=null) |
|
| 117 | + function __construct(& $calendar, $firstDay = null) |
|
| 118 | 118 | { |
| 119 | 119 | $this->calendar = & $calendar; |
| 120 | 120 | $this->cE = & $calendar->getEngine(); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $this->calendar->thisYear(), $this->calendar->thisMonth()); |
| 173 | 173 | $firstDayInMonth = $this->cE->getFirstDayInMonth( |
| 174 | 174 | $this->calendar->thisYear(), $this->calendar->thisMonth()); |
| 175 | - $this->emptyBefore=0; |
|
| 175 | + $this->emptyBefore = 0; |
|
| 176 | 176 | foreach ($this->daysOfMonth as $dayOfWeek) { |
| 177 | 177 | if ($firstDayInMonth == $dayOfWeek) { |
| 178 | 178 | break; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $this->calendar->thisDay() |
| 189 | 189 | ) |
| 190 | 190 | ); |
| 191 | - for ($i=1; $i < $this->numWeeks; $i++) { |
|
| 191 | + for ($i = 1; $i < $this->numWeeks; $i++) { |
|
| 192 | 192 | $this->daysOfMonth = |
| 193 | 193 | array_merge($this->daysOfMonth, $this->daysOfWeek); |
| 194 | 194 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | $this->calendar->thisYear(), |
| 284 | 284 | $this->calendar->thisMonth(), |
| 285 | 285 | $this->calendar->thisDay() |
| 286 | - ) * ($this->numWeeks-1)); |
|
| 286 | + ) * ($this->numWeeks - 1)); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * |
| 297 | 297 | * @return int timestamp |
| 298 | 298 | */ |
| 299 | - function getWeekStart($y, $m, $d, $firstDay=1) |
|
| 299 | + function getWeekStart($y, $m, $d, $firstDay = 1) |
|
| 300 | 300 | { |
| 301 | 301 | $dow = $this->cE->getDayOfWeek($y, $m, $d); |
| 302 | 302 | if ($dow > $firstDay) { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @access public |
| 81 | 81 | */ |
| 82 | - function __construct($y, $m, $firstDay=null) |
|
| 82 | + function __construct($y, $m, $firstDay = null) |
|
| 83 | 83 | { |
| 84 | 84 | parent::__construct($y, $m); |
| 85 | 85 | $this->firstDay = $this->defineFirstDayOfWeek($firstDay); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | include_once CALENDAR_ROOT.'Day.php'; |
| 100 | 100 | $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); |
| 101 | - for ($i=1; $i<=$daysInMonth; $i++) { |
|
| 101 | + for ($i = 1; $i <= $daysInMonth; $i++) { |
|
| 102 | 102 | $this->children[$i] = new Calendar_Day($this->year, $this->month, $i); |
| 103 | 103 | } |
| 104 | 104 | if (count($sDates) > 0) { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @access public |
| 100 | 100 | */ |
| 101 | - function __construct($y, $m=null, $d=null, $h=null, $i=null, $s=null) |
|
| 101 | + function __construct($y, $m = null, $d = null, $h = null, $i = null, $s = null) |
|
| 102 | 102 | { |
| 103 | 103 | $this->setFragments($y, $m, $d, $h, $i, $s); |
| 104 | 104 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @return void |
| 117 | 117 | * @access public |
| 118 | 118 | */ |
| 119 | - function setFragments($y, $m=null, $d=null, $h=null, $i=null, $s=null) |
|
| 119 | + function setFragments($y, $m = null, $d = null, $h = null, $i = null, $s = null) |
|
| 120 | 120 | { |
| 121 | 121 | if (!is_null($y)) $this->uris['Year'] = $y; |
| 122 | 122 | if (!is_null($m)) $this->uris['Month'] = $m; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @access public |
| 110 | 110 | */ |
| 111 | - function __construct($y, $m, $firstDay=null) |
|
| 111 | + function __construct($y, $m, $firstDay = null) |
|
| 112 | 112 | { |
| 113 | 113 | parent::__construct($y, $m, $firstDay); |
| 114 | 114 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | function buildEmptyDaysBefore() |
| 148 | 148 | { |
| 149 | 149 | $eBefore = $this->tableHelper->getEmptyDaysBefore(); |
| 150 | - for ($i=0; $i < $eBefore; $i++) { |
|
| 150 | + for ($i = 0; $i < $eBefore; $i++) { |
|
| 151 | 151 | $stamp = $this->cE->dateToStamp($this->year, $this->month, -$i); |
| 152 | 152 | $Day = new Calendar_Day( |
| 153 | 153 | $this->cE->stampToYear($stamp), |
@@ -183,8 +183,8 @@ discard block |
||
| 183 | 183 | { |
| 184 | 184 | $eAfter = $this->tableHelper->getEmptyDaysAfter(); |
| 185 | 185 | $sDOM = $this->tableHelper->getNumTableDaysInMonth(); |
| 186 | - for ($i=1; $i <= $sDOM-$eAfter; $i++) { |
|
| 187 | - $Day = new Calendar_Day($this->year, $this->month+1, $i); |
|
| 186 | + for ($i = 1; $i <= $sDOM - $eAfter; $i++) { |
|
| 187 | + $Day = new Calendar_Day($this->year, $this->month + 1, $i); |
|
| 188 | 188 | $Day->setEmpty(); |
| 189 | 189 | $Day->adjust(); |
| 190 | 190 | array_push($this->children, $Day); |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | $this->thisDay() |
| 207 | 207 | ); |
| 208 | 208 | $sDOM = $this->tableHelper->getNumTableDaysInMonth(); |
| 209 | - for ($i=1; $i <= $sDOM; $i+= $dIW) { |
|
| 209 | + for ($i = 1; $i <= $sDOM; $i += $dIW) { |
|
| 210 | 210 | $this->children[$i]->setFirst(); |
| 211 | - $this->children[$i+($dIW-1)]->setLast(); |
|
| 211 | + $this->children[$i + ($dIW - 1)]->setLast(); |
|
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | } |