@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | //if you use ISO-8601 dates, switch to PearDate engine |
8 | 8 | define('CALENDAR_ENGINE', 'PearDate'); |
9 | 9 | |
10 | -if ( !@include 'Calendar/Calendar.php' ) { |
|
11 | - define('CALENDAR_ROOT','../../'); |
|
10 | +if (!@include 'Calendar/Calendar.php') { |
|
11 | + define('CALENDAR_ROOT', '../../'); |
|
12 | 12 | } |
13 | 13 | |
14 | -require_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
|
15 | -require_once CALENDAR_ROOT . 'Day.php'; |
|
16 | -require_once CALENDAR_ROOT . 'Decorator.php'; |
|
14 | +require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
|
15 | +require_once CALENDAR_ROOT.'Day.php'; |
|
16 | +require_once CALENDAR_ROOT.'Decorator.php'; |
|
17 | 17 | |
18 | 18 | // accepts multiple entries |
19 | 19 | class DiaryEvent extends Calendar_Decorator |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | var $month; |
50 | 50 | var $firstDay = false; |
51 | 51 | |
52 | - function build($events=array()) |
|
52 | + function build($events = array()) |
|
53 | 53 | { |
54 | - require_once CALENDAR_ROOT . 'Day.php'; |
|
55 | - require_once CALENDAR_ROOT . 'Table/Helper.php'; |
|
54 | + require_once CALENDAR_ROOT.'Day.php'; |
|
55 | + require_once CALENDAR_ROOT.'Table/Helper.php'; |
|
56 | 56 | |
57 | 57 | $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay); |
58 | 58 | $this->cE = & $this->getEngine(); |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | $this->month = $this->thisMonth(); |
61 | 61 | |
62 | 62 | $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); |
63 | - for ($i=1; $i<=$daysInMonth; $i++) { |
|
64 | - $Day = new Calendar_Day(2000,1,1); // Create Day with dummy values |
|
63 | + for ($i = 1; $i <= $daysInMonth; $i++) { |
|
64 | + $Day = new Calendar_Day(2000, 1, 1); // Create Day with dummy values |
|
65 | 65 | $Day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $i)); |
66 | 66 | $this->children[$i] = new DiaryEvent($Day); |
67 | 67 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | function setSelection($events) |
79 | 79 | { |
80 | 80 | $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); |
81 | - for ($i=1; $i<=$daysInMonth; $i++) { |
|
81 | + for ($i = 1; $i <= $daysInMonth; $i++) { |
|
82 | 82 | $stamp1 = $this->cE->dateToStamp($this->year, $this->month, $i); |
83 | - $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i+1); |
|
83 | + $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i + 1); |
|
84 | 84 | foreach ($events as $event) { |
85 | 85 | if (($stamp1 >= $event['start'] && $stamp1 < $event['end']) || |
86 | 86 | ($stamp2 >= $event['start'] && $stamp2 < $event['end']) || |
@@ -7,7 +7,7 @@ |
||
7 | 7 | } |
8 | 8 | $ext = explode('.', $entry); |
9 | 9 | if (isset($ext[1]) && $ext[1] == 'php') { |
10 | - copy($location.$entry,$location.$entry.'s'); |
|
10 | + copy($location.$entry, $location.$entry.'s'); |
|
11 | 11 | echo 'Copying '.$entry.' to '.$entry."s\n"; |
12 | 12 | } |
13 | 13 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Description: client for the SOAP Calendar Server |
4 | 4 | */ |
5 | -if ( version_compare(phpversion(), "5.0.0", ">") ) { |
|
5 | +if (version_compare(phpversion(), "5.0.0", ">")) { |
|
6 | 6 | die('PHP 5 has problems with PEAR::SOAP Client (8.0RC3) |
7 | 7 | - remove @ before include below to see why'); |
8 | 8 | } |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
21 | 21 | if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
22 | 22 | |
23 | -$wsdl = new SOAP_WSDL ($url); |
|
23 | +$wsdl = new SOAP_WSDL($url); |
|
24 | 24 | |
25 | -echo ( '<pre>'.$wsdl->generateProxyCode().'</pre>' ); |
|
25 | +echo ('<pre>'.$wsdl->generateProxyCode().'</pre>'); |
|
26 | 26 | |
27 | 27 | $calendarClient = $wsdl->getProxy(); |
28 | 28 | |
29 | -$month = $calendarClient->getMonth((int)$_GET['y'],(int)$_GET['m']); |
|
29 | +$month = $calendarClient->getMonth((int)$_GET['y'], (int)$_GET['m']); |
|
30 | 30 | |
31 | -if ( PEAR::isError($month) ) { |
|
32 | - die ( $month->toString() ); |
|
31 | +if (PEAR::isError($month)) { |
|
32 | + die ($month->toString()); |
|
33 | 33 | } |
34 | 34 | ?> |
35 | 35 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
@@ -40,30 +40,30 @@ discard block |
||
40 | 40 | <body> |
41 | 41 | <h1>Calendar Over the Wire (featuring PEAR::SOAP)</h1> |
42 | 42 | <table> |
43 | -<caption><b><?php echo ( $month->monthname );?></b></caption> |
|
43 | +<caption><b><?php echo ($month->monthname); ?></b></caption> |
|
44 | 44 | <tr> |
45 | 45 | <th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th> |
46 | 46 | </tr> |
47 | 47 | <?php |
48 | -foreach ( $month->days as $day ) { |
|
48 | +foreach ($month->days as $day) { |
|
49 | 49 | |
50 | - if ( $day->isFirst === 1 ) |
|
51 | - echo ( "<tr>\n" ); |
|
52 | - if ( $day->isEmpty === 1 ) { |
|
53 | - echo ( "<td></td>" ); |
|
50 | + if ($day->isFirst === 1) |
|
51 | + echo ("<tr>\n"); |
|
52 | + if ($day->isEmpty === 1) { |
|
53 | + echo ("<td></td>"); |
|
54 | 54 | } else { |
55 | - echo ( "<td>".$day->day."</td>" ); |
|
55 | + echo ("<td>".$day->day."</td>"); |
|
56 | 56 | } |
57 | - if ( $day->isLast === 1 ) |
|
58 | - echo ( "</tr>\n" ); |
|
57 | + if ($day->isLast === 1) |
|
58 | + echo ("</tr>\n"); |
|
59 | 59 | } |
60 | 60 | ?> |
61 | 61 | <tr> |
62 | 62 | </table> |
63 | 63 | <p>Enter Year and Month to View:</p> |
64 | -<form action="<?php echo ( $_SERVER['PHP_SELF'] ); ?>" method="get"> |
|
65 | -Year: <input type="text" size="4" name="y" value="<?php echo ( $_GET['y'] ); ?>"> |
|
66 | -Month: <input type="text" size="2" name="m" value="<?php echo ( $_GET['m'] ); ?>"> |
|
64 | +<form action="<?php echo ($_SERVER['PHP_SELF']); ?>" method="get"> |
|
65 | +Year: <input type="text" size="4" name="y" value="<?php echo ($_GET['y']); ?>"> |
|
66 | +Month: <input type="text" size="2" name="m" value="<?php echo ($_GET['m']); ?>"> |
|
67 | 67 | <input type="submit" value="Fetch Calendar"> |
68 | 68 | </form> |
69 | 69 | </body> |
@@ -17,8 +17,12 @@ discard block |
||
17 | 17 | $basePath = implode('/', $basePath); |
18 | 18 | $url = 'http://'.$_SERVER['SERVER_NAME'].$basePath.'/7.php?wsdl'; |
19 | 19 | |
20 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
21 | -if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
|
20 | +if (!isset($_GET['y'])) { |
|
21 | + $_GET['y'] = date('Y'); |
|
22 | +} |
|
23 | +if (!isset($_GET['m'])) { |
|
24 | + $_GET['m'] = date('n'); |
|
25 | +} |
|
22 | 26 | |
23 | 27 | $wsdl = new SOAP_WSDL ($url); |
24 | 28 | |
@@ -47,16 +51,18 @@ discard block |
||
47 | 51 | <?php |
48 | 52 | foreach ( $month->days as $day ) { |
49 | 53 | |
50 | - if ( $day->isFirst === 1 ) |
|
51 | - echo ( "<tr>\n" ); |
|
54 | + if ( $day->isFirst === 1 ) { |
|
55 | + echo ( "<tr>\n" ); |
|
56 | + } |
|
52 | 57 | if ( $day->isEmpty === 1 ) { |
53 | 58 | echo ( "<td></td>" ); |
54 | 59 | } else { |
55 | 60 | echo ( "<td>".$day->day."</td>" ); |
56 | 61 | } |
57 | - if ( $day->isLast === 1 ) |
|
58 | - echo ( "</tr>\n" ); |
|
59 | -} |
|
62 | + if ( $day->isLast === 1 ) { |
|
63 | + echo ( "</tr>\n" ); |
|
64 | + } |
|
65 | + } |
|
60 | 66 | ?> |
61 | 67 | <tr> |
62 | 68 | </table> |
@@ -104,7 +104,7 @@ |
||
104 | 104 | case 6: |
105 | 105 | case 9: |
106 | 106 | echo "</tr>\n<tr>\n"; |
107 | - break; |
|
107 | + break; |
|
108 | 108 | case 12: |
109 | 109 | echo "</tr>\n"; |
110 | 110 | break; |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Description: a complete year with numeric week numbers |
4 | 4 | */ |
5 | -function getmicrotime(){ |
|
6 | - list($usec, $sec) = explode(" ",microtime()); |
|
5 | +function getmicrotime() { |
|
6 | + list($usec, $sec) = explode(" ", microtime()); |
|
7 | 7 | return ((float)$usec + (float)$sec); |
8 | 8 | } |
9 | 9 | $start = getmicrotime(); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | require_once CALENDAR_ROOT.'Year.php'; |
16 | 16 | require_once CALENDAR_ROOT.'Month/Weeks.php'; |
17 | 17 | |
18 | -define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); |
|
18 | +define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH_WEEKS); |
|
19 | 19 | |
20 | 20 | if (!isset($_GET['year'])) $_GET['year'] = date('Y'); |
21 | 21 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | 'n_in_month', |
25 | 25 | ); |
26 | 26 | |
27 | -if (!isset($_GET['week_type']) || !in_array($_GET['week_type'],$week_types) ) { |
|
27 | +if (!isset($_GET['week_type']) || !in_array($_GET['week_type'], $week_types)) { |
|
28 | 28 | $_GET['week_type'] = 'n_in_year'; |
29 | 29 | } |
30 | 30 | |
@@ -134,6 +134,6 @@ discard block |
||
134 | 134 | } |
135 | 135 | ?> |
136 | 136 | </table> |
137 | -<p>Took: <?php echo ((getmicrotime()-$start)); ?></p> |
|
137 | +<p>Took: <?php echo ((getmicrotime() - $start)); ?></p> |
|
138 | 138 | </body> |
139 | 139 | </html> |
140 | 140 | \ No newline at end of file |
@@ -17,7 +17,9 @@ |
||
17 | 17 | |
18 | 18 | define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); |
19 | 19 | |
20 | -if (!isset($_GET['year'])) $_GET['year'] = date('Y'); |
|
20 | +if (!isset($_GET['year'])) { |
|
21 | + $_GET['year'] = date('Y'); |
|
22 | +} |
|
21 | 23 | |
22 | 24 | $week_types = array( |
23 | 25 | 'n_in_year', |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | * plus the Uri and Textual utilities |
5 | 5 | */ |
6 | 6 | |
7 | -if ( !@include 'Calendar/Calendar.php' ) { |
|
8 | - define('CALENDAR_ROOT','../../'); |
|
7 | +if (!@include 'Calendar/Calendar.php') { |
|
8 | + define('CALENDAR_ROOT', '../../'); |
|
9 | 9 | } |
10 | 10 | require_once CALENDAR_ROOT.'Month'.DIRECTORY_SEPARATOR.'Weekdays.php'; |
11 | 11 | require_once CALENDAR_ROOT.'Decorator'.DIRECTORY_SEPARATOR.'Wrapper.php'; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | if (!isset($_GET['m'])) $_GET['m'] = date('m'); |
18 | 18 | |
19 | 19 | // Build a month |
20 | -$Month = & new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
|
20 | +$Month = & new Calendar_Month_Weekdays($_GET['y'], $_GET['m']); |
|
21 | 21 | |
22 | 22 | // Build the days in the month |
23 | 23 | $Month->build(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $WrappedMonth = & new Calendar_Decorator_Wrapper($Month); |
27 | 27 | |
28 | 28 | // Set up the Uri util, specifying required fragments (see $_GET vars above) |
29 | -$Uri = & new Calendar_Util_Uri('y','m'); |
|
29 | +$Uri = & new Calendar_Util_Uri('y', 'm'); |
|
30 | 30 | |
31 | 31 | // Get the names of the days of the week |
32 | 32 | $weekDayNames = Calendar_Util_Textual::weekdayNames('short'); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | // Find out who's on call for this day of the week |
37 | 37 | function whoIsOnCall($dayOfWeek) { |
38 | - switch ( $dayOfWeek ) { |
|
38 | + switch ($dayOfWeek) { |
|
39 | 39 | case 0: |
40 | 40 | case 4: |
41 | 41 | return 'John'; |
@@ -125,21 +125,21 @@ discard block |
||
125 | 125 | <table class="calendar" width="98%" cellspacing="0" cellpadding="0"> |
126 | 126 | <caption> |
127 | 127 | <div id="next"> |
128 | - <a href="?<?php echo $Uri->next($Month,'month'); ?>">>></a> |
|
128 | + <a href="?<?php echo $Uri->next($Month, 'month'); ?>">>></a> |
|
129 | 129 | </div> |
130 | 130 | |
131 | 131 | <div id="prev"> |
132 | - <a href="?<?php echo $Uri->prev($Month,'month'); ?>"><<</a> |
|
132 | + <a href="?<?php echo $Uri->prev($Month, 'month'); ?>"><<</a> |
|
133 | 133 | </div> |
134 | 134 | |
135 | - <?php echo strftime('%B %Y',$Month->getTimestamp()); ?> |
|
135 | + <?php echo strftime('%B %Y', $Month->getTimestamp()); ?> |
|
136 | 136 | </caption> |
137 | 137 | |
138 | 138 | <tr> |
139 | 139 | <th class="calWeekNum">Week #</th> |
140 | 140 | |
141 | 141 | <?php |
142 | -foreach ( $weekDayNames as $weekDayName ) { |
|
142 | +foreach ($weekDayNames as $weekDayName) { |
|
143 | 143 | ?> |
144 | 144 | <th><?php echo $weekDayName; ?></th> |
145 | 145 | <?php |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | $weekNum = 1; |
152 | 152 | |
153 | 153 | // Pull out the days, immediately wrapping them in a Weekday decorator |
154 | -while ( $Weekday = & $WrappedMonth->fetch('Calendar_Decorator_Weekday') ) { |
|
154 | +while ($Weekday = & $WrappedMonth->fetch('Calendar_Decorator_Weekday')) { |
|
155 | 155 | |
156 | 156 | if ($Weekday->isFirst()) { |
157 | 157 | echo "<tr>\n"; |
158 | 158 | echo "<td class='calWeekNum'>$weekNum</td>\n"; |
159 | 159 | } |
160 | 160 | |
161 | - if ( $Weekday->isEmpty() ) { |
|
161 | + if ($Weekday->isEmpty()) { |
|
162 | 162 | |
163 | 163 | echo "<td class='calCellEmpty'> </td>\n"; |
164 | 164 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | echo "<td>"; |
168 | 168 | |
169 | - if ( false !== ( $onCall = whoIsOnCall($Weekday->thisWeekDay()) ) ) { |
|
169 | + if (false !== ($onCall = whoIsOnCall($Weekday->thisWeekDay()))) { |
|
170 | 170 | echo "On Call: $onCall"; |
171 | 171 | } else { |
172 | 172 | echo " "; |
@@ -13,8 +13,12 @@ |
||
13 | 13 | require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Uri.php'; |
14 | 14 | require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Textual.php'; |
15 | 15 | |
16 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
17 | -if (!isset($_GET['m'])) $_GET['m'] = date('m'); |
|
16 | +if (!isset($_GET['y'])) { |
|
17 | + $_GET['y'] = date('Y'); |
|
18 | +} |
|
19 | +if (!isset($_GET['m'])) { |
|
20 | + $_GET['m'] = date('m'); |
|
21 | +} |
|
18 | 22 | |
19 | 23 | // Build a month |
20 | 24 | $Month = & new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
@@ -105,7 +105,7 @@ |
||
105 | 105 | echo ( "<tr>\n" ); |
106 | 106 | |
107 | 107 | if ( $Day->isSelected() ) { |
108 | - echo ( "<td class=\"selected\">".$Day->thisDay()."</td>\n" ); |
|
108 | + echo ( "<td class=\"selected\">".$Day->thisDay()."</td>\n" ); |
|
109 | 109 | } else if ( $Day->isEmpty() ) { |
110 | 110 | echo ( "<td> </td>\n" ); |
111 | 111 | } else { |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | * Description: Performs same behaviour as 2.php but uses Month::buildWeekDays() |
4 | 4 | * and is faster |
5 | 5 | */ |
6 | -function getmicrotime(){ |
|
7 | - list($usec, $sec) = explode(" ",microtime()); |
|
6 | +function getmicrotime() { |
|
7 | + list($usec, $sec) = explode(" ", microtime()); |
|
8 | 8 | return ((float)$usec + (float)$sec); |
9 | 9 | } |
10 | 10 | $start = getmicrotime(); |
11 | 11 | |
12 | -if ( !@include 'Calendar/Calendar.php' ) { |
|
13 | - define('CALENDAR_ROOT','../../'); |
|
12 | +if (!@include 'Calendar/Calendar.php') { |
|
13 | + define('CALENDAR_ROOT', '../../'); |
|
14 | 14 | } |
15 | 15 | require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
16 | 16 | require_once CALENDAR_ROOT.'Day.php'; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | if (!isset($_GET['d'])) $_GET['d'] = date('d'); |
21 | 21 | |
22 | 22 | // Build the month |
23 | -$Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
|
23 | +$Month = new Calendar_Month_Weekdays($_GET['y'], $_GET['m']); |
|
24 | 24 | |
25 | 25 | // Construct strings for next/previous links |
26 | 26 | $PMonth = $Month->prevMonth('object'); // Get previous month as object |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | <body> |
70 | 70 | |
71 | 71 | <?php |
72 | -$selectedDays = array ( |
|
73 | - new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']), |
|
74 | - new Calendar_Day($_GET['y'],12,25), |
|
72 | +$selectedDays = array( |
|
73 | + new Calendar_Day($_GET['y'], $_GET['m'], $_GET['d']), |
|
74 | + new Calendar_Day($_GET['y'], 12, 25), |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | // Build the days in the month |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | <h2>Built with Calendar_Month_Weekday::build()</h2> |
81 | 81 | <table class="calendar"> |
82 | 82 | <caption> |
83 | -<?php echo ( date('F Y',$Month->getTimeStamp())); ?> |
|
83 | +<?php echo (date('F Y', $Month->getTimeStamp())); ?> |
|
84 | 84 | </caption> |
85 | 85 | <tr> |
86 | 86 | <th>M</th> |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | <th>S</th> |
93 | 93 | </tr> |
94 | 94 | <?php |
95 | -while ( $Day = $Month->fetch() ) { |
|
95 | +while ($Day = $Month->fetch()) { |
|
96 | 96 | |
97 | 97 | // Build a link string for each day |
98 | 98 | $link = $_SERVER['PHP_SELF']. |
@@ -101,34 +101,34 @@ discard block |
||
101 | 101 | '&d='.$Day->thisDay(); |
102 | 102 | |
103 | 103 | // isFirst() to find start of week |
104 | - if ( $Day->isFirst() ) |
|
105 | - echo ( "<tr>\n" ); |
|
104 | + if ($Day->isFirst()) |
|
105 | + echo ("<tr>\n"); |
|
106 | 106 | |
107 | - if ( $Day->isSelected() ) { |
|
108 | - echo ( "<td class=\"selected\">".$Day->thisDay()."</td>\n" ); |
|
109 | - } else if ( $Day->isEmpty() ) { |
|
110 | - echo ( "<td> </td>\n" ); |
|
107 | + if ($Day->isSelected()) { |
|
108 | + echo ("<td class=\"selected\">".$Day->thisDay()."</td>\n"); |
|
109 | + } else if ($Day->isEmpty()) { |
|
110 | + echo ("<td> </td>\n"); |
|
111 | 111 | } else { |
112 | - echo ( "<td><a href=\"".$link."\">".$Day->thisDay()."</a></td>\n" ); |
|
112 | + echo ("<td><a href=\"".$link."\">".$Day->thisDay()."</a></td>\n"); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // isLast() to find end of week |
116 | - if ( $Day->isLast() ) |
|
117 | - echo ( "</tr>\n" ); |
|
116 | + if ($Day->isLast()) |
|
117 | + echo ("</tr>\n"); |
|
118 | 118 | } |
119 | 119 | ?> |
120 | 120 | <tr> |
121 | 121 | <td> |
122 | -<a href="<?php echo ($prev);?>" class="prevMonth"><< </a> |
|
122 | +<a href="<?php echo ($prev); ?>" class="prevMonth"><< </a> |
|
123 | 123 | </td> |
124 | 124 | <td colspan="5"> </td> |
125 | 125 | <td> |
126 | -<a href="<?php echo ($next);?>" class="nextMonth"> >></a> |
|
126 | +<a href="<?php echo ($next); ?>" class="nextMonth"> >></a> |
|
127 | 127 | </td> |
128 | 128 | </tr> |
129 | 129 | </table> |
130 | 130 | <?php |
131 | -echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); |
|
131 | +echo ('<p><b>Took: '.(getmicrotime() - $start).' seconds</b></p>'); |
|
132 | 132 | ?> |
133 | 133 | </body> |
134 | 134 | </html> |
135 | 135 | \ No newline at end of file |
@@ -15,9 +15,15 @@ discard block |
||
15 | 15 | require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
16 | 16 | require_once CALENDAR_ROOT.'Day.php'; |
17 | 17 | |
18 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
19 | -if (!isset($_GET['m'])) $_GET['m'] = date('m'); |
|
20 | -if (!isset($_GET['d'])) $_GET['d'] = date('d'); |
|
18 | +if (!isset($_GET['y'])) { |
|
19 | + $_GET['y'] = date('Y'); |
|
20 | +} |
|
21 | +if (!isset($_GET['m'])) { |
|
22 | + $_GET['m'] = date('m'); |
|
23 | +} |
|
24 | +if (!isset($_GET['d'])) { |
|
25 | + $_GET['d'] = date('d'); |
|
26 | +} |
|
21 | 27 | |
22 | 28 | // Build the month |
23 | 29 | $Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
@@ -101,8 +107,9 @@ discard block |
||
101 | 107 | '&d='.$Day->thisDay(); |
102 | 108 | |
103 | 109 | // isFirst() to find start of week |
104 | - if ( $Day->isFirst() ) |
|
105 | - echo ( "<tr>\n" ); |
|
110 | + if ( $Day->isFirst() ) { |
|
111 | + echo ( "<tr>\n" ); |
|
112 | + } |
|
106 | 113 | |
107 | 114 | if ( $Day->isSelected() ) { |
108 | 115 | echo ( "<td class=\"selected\">".$Day->thisDay()."</td>\n" ); |
@@ -113,9 +120,10 @@ discard block |
||
113 | 120 | } |
114 | 121 | |
115 | 122 | // isLast() to find end of week |
116 | - if ( $Day->isLast() ) |
|
117 | - echo ( "</tr>\n" ); |
|
118 | -} |
|
123 | + if ( $Day->isLast() ) { |
|
124 | + echo ( "</tr>\n" ); |
|
125 | + } |
|
126 | + } |
|
119 | 127 | ?> |
120 | 128 | <tr> |
121 | 129 | <td> |
@@ -5,16 +5,16 @@ discard block |
||
5 | 5 | * switches the calculation "engine" |
6 | 6 | * Note: make sure PEAR::Date is a stable release!!! |
7 | 7 | */ |
8 | -function getmicrotime(){ |
|
9 | - list($usec, $sec) = explode(" ",microtime()); |
|
8 | +function getmicrotime() { |
|
9 | + list($usec, $sec) = explode(" ", microtime()); |
|
10 | 10 | return ((float)$usec + (float)$sec); |
11 | 11 | } |
12 | 12 | |
13 | 13 | // Switch to PEAR::Date engine |
14 | -define('CALENDAR_ENGINE','PearDate'); |
|
14 | +define('CALENDAR_ENGINE', 'PearDate'); |
|
15 | 15 | |
16 | -if ( !@include 'Calendar/Calendar.php' ) { |
|
17 | - define('CALENDAR_ROOT','../../'); |
|
16 | +if (!@include 'Calendar/Calendar.php') { |
|
17 | + define('CALENDAR_ROOT', '../../'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | if (!isset($_GET['y'])) $_GET['y'] = 2003; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | if (!isset($_GET['i'])) $_GET['i'] = 34; |
25 | 25 | if (!isset($_GET['s'])) $_GET['s'] = 46; |
26 | 26 | |
27 | -switch ( @$_GET['view'] ) { |
|
27 | +switch (@$_GET['view']) { |
|
28 | 28 | default: |
29 | 29 | $_GET['view'] = 'calendar_year'; |
30 | 30 | case 'calendar_year': |
@@ -33,67 +33,67 @@ discard block |
||
33 | 33 | break; |
34 | 34 | case 'calendar_month': |
35 | 35 | require_once CALENDAR_ROOT.'Month.php'; |
36 | - $c = new Calendar_Month($_GET['y'],$_GET['m']); |
|
36 | + $c = new Calendar_Month($_GET['y'], $_GET['m']); |
|
37 | 37 | break; |
38 | 38 | case 'calendar_day': |
39 | 39 | require_once CALENDAR_ROOT.'Day.php'; |
40 | - $c = new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']); |
|
40 | + $c = new Calendar_Day($_GET['y'], $_GET['m'], $_GET['d']); |
|
41 | 41 | break; |
42 | 42 | case 'calendar_hour': |
43 | 43 | require_once CALENDAR_ROOT.'Hour.php'; |
44 | - $c = new Calendar_Hour($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h']); |
|
44 | + $c = new Calendar_Hour($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h']); |
|
45 | 45 | break; |
46 | 46 | case 'calendar_minute': |
47 | 47 | require_once CALENDAR_ROOT.'Minute.php'; |
48 | - $c = new Calendar_Minute($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i']); |
|
48 | + $c = new Calendar_Minute($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i']); |
|
49 | 49 | break; |
50 | 50 | case 'calendar_second': |
51 | 51 | require_once CALENDAR_ROOT.'Second.php'; |
52 | - $c = new Calendar_Second($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i'],$_GET['s']); |
|
52 | + $c = new Calendar_Second($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i'], $_GET['s']); |
|
53 | 53 | break; |
54 | 54 | } |
55 | 55 | |
56 | 56 | // Convert timestamp to human readable date |
57 | 57 | $date = new Date($c->getTimestamp()); |
58 | 58 | |
59 | -echo ( '<h1>Using PEAR::Date engine</h1>' ); |
|
60 | -echo ( 'Viewing: '.@$_GET['view'].'<br />' ); |
|
61 | -echo ( 'The time is now: '.$date->format('%Y %a %e %T').'<br >' ); |
|
59 | +echo ('<h1>Using PEAR::Date engine</h1>'); |
|
60 | +echo ('Viewing: '.@$_GET['view'].'<br />'); |
|
61 | +echo ('The time is now: '.$date->format('%Y %a %e %T').'<br >'); |
|
62 | 62 | |
63 | 63 | $i = 1; |
64 | -echo ( '<h1>First Iteration</h1>' ); |
|
65 | -echo ( '<p>The first iteration is more "expensive", the calendar data |
|
64 | +echo ('<h1>First Iteration</h1>'); |
|
65 | +echo ('<p>The first iteration is more "expensive", the calendar data |
|
66 | 66 | structures having to be built.</p>' ); |
67 | 67 | $start = getmicrotime(); |
68 | 68 | $c->build(); |
69 | -while ( $e = $c->fetch() ) { |
|
69 | +while ($e = $c->fetch()) { |
|
70 | 70 | $class = strtolower(get_class($e)); |
71 | - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
71 | + $link = "&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
72 | 72 | "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); |
73 | - $method = 'this'.str_replace('calendar_','',$class); |
|
74 | - echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " ); |
|
75 | - if ( ($i % 10) == 0 ) { |
|
76 | - echo ( '<br>' ); |
|
73 | + $method = 'this'.str_replace('calendar_', '', $class); |
|
74 | + echo ("<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : "); |
|
75 | + if (($i % 10) == 0) { |
|
76 | + echo ('<br>'); |
|
77 | 77 | } |
78 | 78 | $i++; |
79 | 79 | } |
80 | -echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); |
|
80 | +echo ('<p><b>Took: '.(getmicrotime() - $start).' seconds</b></p>'); |
|
81 | 81 | |
82 | 82 | $i = 1; |
83 | -echo ( '<h1>Second Iteration</h1>' ); |
|
84 | -echo ( '<p>This second iteration is faster, the data structures |
|
83 | +echo ('<h1>Second Iteration</h1>'); |
|
84 | +echo ('<p>This second iteration is faster, the data structures |
|
85 | 85 | being re-used</p>' ); |
86 | 86 | $start = getmicrotime(); |
87 | -while ( $e = $c->fetch() ) { |
|
87 | +while ($e = $c->fetch()) { |
|
88 | 88 | $class = strtolower(get_class($e)); |
89 | - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
89 | + $link = "&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
90 | 90 | "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); |
91 | - $method = 'this'.str_replace('calendar_','',$class); |
|
92 | - echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " ); |
|
93 | - if ( ($i % 10) == 0 ) { |
|
94 | - echo ( '<br>' ); |
|
91 | + $method = 'this'.str_replace('calendar_', '', $class); |
|
92 | + echo ("<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : "); |
|
93 | + if (($i % 10) == 0) { |
|
94 | + echo ('<br>'); |
|
95 | 95 | } |
96 | 96 | $i++; |
97 | 97 | } |
98 | -echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); |
|
98 | +echo ('<p><b>Took: '.(getmicrotime() - $start).' seconds</b></p>'); |
|
99 | 99 | ?> |
100 | 100 | \ No newline at end of file |
@@ -17,12 +17,24 @@ |
||
17 | 17 | define('CALENDAR_ROOT','../../'); |
18 | 18 | } |
19 | 19 | |
20 | -if (!isset($_GET['y'])) $_GET['y'] = 2003; |
|
21 | -if (!isset($_GET['m'])) $_GET['m'] = 8; |
|
22 | -if (!isset($_GET['d'])) $_GET['d'] = 9; |
|
23 | -if (!isset($_GET['h'])) $_GET['h'] = 12; |
|
24 | -if (!isset($_GET['i'])) $_GET['i'] = 34; |
|
25 | -if (!isset($_GET['s'])) $_GET['s'] = 46; |
|
20 | +if (!isset($_GET['y'])) { |
|
21 | + $_GET['y'] = 2003; |
|
22 | +} |
|
23 | +if (!isset($_GET['m'])) { |
|
24 | + $_GET['m'] = 8; |
|
25 | +} |
|
26 | +if (!isset($_GET['d'])) { |
|
27 | + $_GET['d'] = 9; |
|
28 | +} |
|
29 | +if (!isset($_GET['h'])) { |
|
30 | + $_GET['h'] = 12; |
|
31 | +} |
|
32 | +if (!isset($_GET['i'])) { |
|
33 | + $_GET['i'] = 34; |
|
34 | +} |
|
35 | +if (!isset($_GET['s'])) { |
|
36 | + $_GET['s'] = 46; |
|
37 | +} |
|
26 | 38 | |
27 | 39 | switch ( @$_GET['view'] ) { |
28 | 40 | default: |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | require_once CALENDAR_ROOT.'Day.php'; |
9 | 9 | require_once CALENDAR_ROOT.'Decorator/Weekday.php'; |
10 | 10 | |
11 | -$Day = new Calendar_Day(date('Y'), date('n'),date('d')); |
|
11 | +$Day = new Calendar_Day(date('Y'), date('n'), date('d')); |
|
12 | 12 | $WeekDay = & new Calendar_Decorator_Weekday($Day); |
13 | 13 | // $WeekDay->setFirstDay(0); // Make Sunday first Day |
14 | 14 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | $WeekDay->build(); |
20 | 20 | echo 'Hours today:<br>'; |
21 | -while ( $Hour = $WeekDay->fetch() ) { |
|
21 | +while ($Hour = $WeekDay->fetch()) { |
|
22 | 22 | echo $Hour->thisHour().'<br>'; |
23 | 23 | } |
24 | 24 | ?> |
25 | 25 | \ No newline at end of file |
@@ -33,11 +33,11 @@ |
||
33 | 33 | </head> |
34 | 34 | <body> |
35 | 35 | <h1>Paging Weeks</h1> |
36 | -<h2>Week: <?php echo $Week->thisWeek().' '.date('F Y',$Week->thisMonth(true)); ?></h2> |
|
36 | +<h2>Week: <?php echo $Week->thisWeek().' '.date('F Y', $Week->thisMonth(true)); ?></h2> |
|
37 | 37 | <?php |
38 | 38 | $Week->build(); |
39 | 39 | while ($Day = $Week->fetch()) { |
40 | - echo '<p>'.date('jS F',$Day->thisDay(true))."</p>\n"; |
|
40 | + echo '<p>'.date('jS F', $Day->thisDay(true))."</p>\n"; |
|
41 | 41 | } |
42 | 42 | $days = $Week->fetchAll(); |
43 | 43 |
@@ -13,9 +13,15 @@ |
||
13 | 13 | } |
14 | 14 | require_once CALENDAR_ROOT.'Week.php'; |
15 | 15 | |
16 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
17 | -if (!isset($_GET['m'])) $_GET['m'] = date('m'); |
|
18 | -if (!isset($_GET['d'])) $_GET['d'] = 1; |
|
16 | +if (!isset($_GET['y'])) { |
|
17 | + $_GET['y'] = date('Y'); |
|
18 | +} |
|
19 | +if (!isset($_GET['m'])) { |
|
20 | + $_GET['m'] = date('m'); |
|
21 | +} |
|
22 | +if (!isset($_GET['d'])) { |
|
23 | + $_GET['d'] = 1; |
|
24 | +} |
|
19 | 25 | |
20 | 26 | // Build the month |
21 | 27 | $Week = new Calendar_Week($_GET['y'], $_GET['m'], $_GET['d']); |