@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | if (!@include 'Calendar/Calendar.php') { |
6 | 6 | define('CALENDAR_ROOT', '../../'); |
7 | 7 | } |
8 | -require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
|
9 | -require_once CALENDAR_ROOT.'Decorator/Uri.php'; |
|
8 | +require_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
|
9 | +require_once CALENDAR_ROOT . 'Decorator/Uri.php'; |
|
10 | 10 | |
11 | 11 | if (!isset($_GET['jahr'])) $_GET['jahr'] = date('Y'); |
12 | 12 | if (!isset($_GET['monat'])) $_GET['monat'] = date('m'); |
@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | // Build the month |
15 | 15 | $Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']); |
16 | 16 | |
17 | -echo ( '<p>The current month is ' |
|
18 | - .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'</p>'); |
|
17 | +echo ('<p>The current month is ' |
|
18 | + .$Calendar->thisMonth() . ' of year ' . $Calendar->thisYear() . '</p>'); |
|
19 | 19 | |
20 | 20 | $Uri = new Calendar_Decorator_Uri($Calendar); |
21 | -$Uri->setFragments('jahr','monat'); |
|
21 | +$Uri->setFragments('jahr', 'monat'); |
|
22 | 22 | // $Uri->setSeperator('/'); // Default is & |
23 | 23 | // $Uri->setScalar(); // Omit variable names |
24 | -echo ( "<pre>Previous Uri:\t".$Uri->prev('month')."\n" ); |
|
25 | -echo ( "This Uri:\t".$Uri->this('month')."\n" ); |
|
26 | -echo ( "Next Uri:\t".$Uri->next('month')."\n</pre>" ); |
|
24 | +echo ("<pre>Previous Uri:\t" . $Uri->prev('month') . "\n"); |
|
25 | +echo ("This Uri:\t" . $Uri->this('month') . "\n"); |
|
26 | +echo ("Next Uri:\t" . $Uri->next('month') . "\n</pre>"); |
|
27 | 27 | ?> |
28 | 28 | <p> |
29 | -<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->prev('month'));?>">Prev</a> : |
|
30 | -<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->next('month'));?>">Next</a> |
|
29 | +<a href="<?php echo($_SERVER['PHP_SELF'] . '?' . $Uri->prev('month')); ?>">Prev</a> : |
|
30 | +<a href="<?php echo($_SERVER['PHP_SELF'] . '?' . $Uri->next('month')); ?>">Next</a> |
|
31 | 31 | </p> |
@@ -8,8 +8,12 @@ |
||
8 | 8 | require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
9 | 9 | require_once CALENDAR_ROOT.'Util/Uri.php'; |
10 | 10 | |
11 | -if (!isset($_GET['jahr'])) $_GET['jahr'] = date('Y'); |
|
12 | -if (!isset($_GET['monat'])) $_GET['monat'] = date('m'); |
|
11 | +if (!isset($_GET['jahr'])) { |
|
12 | + $_GET['jahr'] = date('Y'); |
|
13 | +} |
|
14 | +if (!isset($_GET['monat'])) { |
|
15 | + $_GET['monat'] = date('m'); |
|
16 | +} |
|
13 | 17 | |
14 | 18 | // Build the month |
15 | 19 | $Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']); |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | */ |
8 | 8 | function getmicrotime() |
9 | 9 | { |
10 | - list($usec, $sec) = explode(" ",microtime()); |
|
10 | + list($usec, $sec) = explode(" ", microtime()); |
|
11 | 11 | |
12 | 12 | return ((float) $usec + (float) $sec); |
13 | 13 | } |
14 | 14 | |
15 | 15 | if (!@include 'Calendar/Calendar.php') { |
16 | - define('CALENDAR_ROOT','../../'); |
|
16 | + define('CALENDAR_ROOT', '../../'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | if (!isset($_GET['y'])) $_GET['y'] = 2003; |
@@ -27,67 +27,67 @@ discard block |
||
27 | 27 | default: |
28 | 28 | $_GET['view'] = 'calendar_year'; |
29 | 29 | case 'calendar_year': |
30 | - require_once CALENDAR_ROOT.'Year.php'; |
|
30 | + require_once CALENDAR_ROOT . 'Year.php'; |
|
31 | 31 | $c = new Calendar_Year($_GET['y']); |
32 | 32 | break; |
33 | 33 | case 'calendar_month': |
34 | - require_once CALENDAR_ROOT.'Month.php'; |
|
35 | - $c = new Calendar_Month($_GET['y'],$_GET['m']); |
|
34 | + require_once CALENDAR_ROOT . 'Month.php'; |
|
35 | + $c = new Calendar_Month($_GET['y'], $_GET['m']); |
|
36 | 36 | break; |
37 | 37 | case 'calendar_day': |
38 | - require_once CALENDAR_ROOT.'Day.php'; |
|
39 | - $c = new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']); |
|
38 | + require_once CALENDAR_ROOT . 'Day.php'; |
|
39 | + $c = new Calendar_Day($_GET['y'], $_GET['m'], $_GET['d']); |
|
40 | 40 | break; |
41 | 41 | case 'calendar_hour': |
42 | - require_once CALENDAR_ROOT.'Hour.php'; |
|
43 | - $c = new Calendar_Hour($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h']); |
|
42 | + require_once CALENDAR_ROOT . 'Hour.php'; |
|
43 | + $c = new Calendar_Hour($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h']); |
|
44 | 44 | break; |
45 | 45 | case 'calendar_minute': |
46 | - require_once CALENDAR_ROOT.'Minute.php'; |
|
47 | - $c = new Calendar_Minute($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i']); |
|
46 | + require_once CALENDAR_ROOT . 'Minute.php'; |
|
47 | + $c = new Calendar_Minute($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i']); |
|
48 | 48 | break; |
49 | 49 | case 'calendar_second': |
50 | - require_once CALENDAR_ROOT.'Second.php'; |
|
51 | - $c = new Calendar_Second($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i'],$_GET['s']); |
|
50 | + require_once CALENDAR_ROOT . 'Second.php'; |
|
51 | + $c = new Calendar_Second($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i'], $_GET['s']); |
|
52 | 52 | break; |
53 | 53 | } |
54 | 54 | |
55 | -echo ( 'Viewing: '.@$_GET['view'].'<br />' ); |
|
56 | -echo ( 'The time is now: '.date('Y M d H:i:s',$c->getTimestamp()).'<br >' ); |
|
55 | +echo ('Viewing: ' . @$_GET['view'] . '<br />'); |
|
56 | +echo ('The time is now: ' . date('Y M d H:i:s', $c->getTimestamp()) . '<br >'); |
|
57 | 57 | |
58 | 58 | $i = 1; |
59 | -echo ( '<h1>First Iteration</h1>' ); |
|
60 | -echo ( '<p>The first iteration is more "expensive", the calendar data |
|
59 | +echo ('<h1>First Iteration</h1>'); |
|
60 | +echo ('<p>The first iteration is more "expensive", the calendar data |
|
61 | 61 | structures having to be built.</p>' ); |
62 | 62 | $start = getmicrotime(); |
63 | 63 | $c->build(); |
64 | -while ( $e = $c->fetch() ) { |
|
64 | +while ($e = $c->fetch()) { |
|
65 | 65 | $class = strtolower(get_class($e)); |
66 | - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
67 | - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); |
|
68 | - $method = 'this'.str_replace('calendar_','',$class); |
|
69 | - echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " ); |
|
70 | - if ( ($i % 10) == 0 ) { |
|
71 | - echo ( '<br>' ); |
|
66 | + $link = "&y=" . $e->thisYear() . "&m=" . $e->thisMonth() . "&d=" . $e->thisDay() . |
|
67 | + "&h=" . $e->thisHour() . "&i=" . $e->thisMinute() . "&s=" . $e->thisSecond(); |
|
68 | + $method = 'this' . str_replace('calendar_', '', $class); |
|
69 | + echo ("<a href=\"" . $_SERVER['PHP_SELF'] . "?view=" . $class . $link . "\">" . $e->{$method}() . "</a> : "); |
|
70 | + if (($i % 10) == 0) { |
|
71 | + echo ('<br>'); |
|
72 | 72 | } |
73 | 73 | ++$i; |
74 | 74 | } |
75 | -echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); |
|
75 | +echo ('<p><b>Took: ' . (getmicrotime() - $start) . ' seconds</b></p>'); |
|
76 | 76 | |
77 | 77 | $i = 1; |
78 | -echo ( '<h1>Second Iteration</h1>' ); |
|
79 | -echo ( '<p>This second iteration is faster, the data structures |
|
78 | +echo ('<h1>Second Iteration</h1>'); |
|
79 | +echo ('<p>This second iteration is faster, the data structures |
|
80 | 80 | being re-used</p>' ); |
81 | 81 | $start = getmicrotime(); |
82 | -while ( $e = $c->fetch() ) { |
|
82 | +while ($e = $c->fetch()) { |
|
83 | 83 | $class = strtolower(get_class($e)); |
84 | - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
85 | - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); |
|
86 | - $method = 'this'.str_replace('calendar_','',$class); |
|
87 | - echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " ); |
|
88 | - if ( ($i % 10) == 0 ) { |
|
89 | - echo ( '<br>' ); |
|
84 | + $link = "&y=" . $e->thisYear() . "&m=" . $e->thisMonth() . "&d=" . $e->thisDay() . |
|
85 | + "&h=" . $e->thisHour() . "&i=" . $e->thisMinute() . "&s=" . $e->thisSecond(); |
|
86 | + $method = 'this' . str_replace('calendar_', '', $class); |
|
87 | + echo ("<a href=\"" . $_SERVER['PHP_SELF'] . "?view=" . $class . $link . "\">" . $e->{$method}() . "</a> : "); |
|
88 | + if (($i % 10) == 0) { |
|
89 | + echo ('<br>'); |
|
90 | 90 | } |
91 | 91 | ++$i; |
92 | 92 | } |
93 | -echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); |
|
93 | +echo ('<p><b>Took: ' . (getmicrotime() - $start) . ' seconds</b></p>'); |
@@ -19,12 +19,24 @@ |
||
19 | 19 | define('CALENDAR_ROOT','../../'); |
20 | 20 | } |
21 | 21 | |
22 | -if (!isset($_GET['y'])) $_GET['y'] = 2003; |
|
23 | -if (!isset($_GET['m'])) $_GET['m'] = 8; |
|
24 | -if (!isset($_GET['d'])) $_GET['d'] = 9; |
|
25 | -if (!isset($_GET['h'])) $_GET['h'] = 12; |
|
26 | -if (!isset($_GET['i'])) $_GET['i'] = 34; |
|
27 | -if (!isset($_GET['s'])) $_GET['s'] = 46; |
|
22 | +if (!isset($_GET['y'])) { |
|
23 | + $_GET['y'] = 2003; |
|
24 | +} |
|
25 | +if (!isset($_GET['m'])) { |
|
26 | + $_GET['m'] = 8; |
|
27 | +} |
|
28 | +if (!isset($_GET['d'])) { |
|
29 | + $_GET['d'] = 9; |
|
30 | +} |
|
31 | +if (!isset($_GET['h'])) { |
|
32 | + $_GET['h'] = 12; |
|
33 | +} |
|
34 | +if (!isset($_GET['i'])) { |
|
35 | + $_GET['i'] = 34; |
|
36 | +} |
|
37 | +if (!isset($_GET['s'])) { |
|
38 | + $_GET['s'] = 46; |
|
39 | +} |
|
28 | 40 | |
29 | 41 | switch (@$_GET['view']) { |
30 | 42 | default: |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Description: client for the SOAP Calendar Server |
|
4 | - */ |
|
3 | + * Description: client for the SOAP Calendar Server |
|
4 | + */ |
|
5 | 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'); |
@@ -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 | } |
@@ -15,21 +15,21 @@ discard block |
||
15 | 15 | $basePath = explode('/', $_SERVER['SCRIPT_NAME']); |
16 | 16 | array_pop($basePath); |
17 | 17 | $basePath = implode('/', $basePath); |
18 | -$url = 'http://'.$_SERVER['SERVER_NAME'].$basePath.'/7.php?wsdl'; |
|
18 | +$url = 'http://' . $_SERVER['SERVER_NAME'] . $basePath . '/7.php?wsdl'; |
|
19 | 19 | |
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 | 48 | foreach ($month->days as $day) { |
49 | 49 | |
50 | - if ( $day->isFirst === 1 ) |
|
51 | - echo ( "<tr>\n" ); |
|
50 | + if ($day->isFirst === 1) |
|
51 | + echo ("<tr>\n"); |
|
52 | 52 | if ($day->isEmpty === 1) { |
53 | - echo ( "<td></td>" ); |
|
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> |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | */ |
8 | 8 | function getmicrotime() |
9 | 9 | { |
10 | - list($usec, $sec) = explode(" ",microtime()); |
|
10 | + list($usec, $sec) = explode(" ", microtime()); |
|
11 | 11 | |
12 | 12 | return ((float) $usec + (float) $sec); |
13 | 13 | } |
14 | 14 | |
15 | 15 | // Switch to PEAR::Date engine |
16 | -define('CALENDAR_ENGINE','PearDate'); |
|
16 | +define('CALENDAR_ENGINE', 'PearDate'); |
|
17 | 17 | |
18 | 18 | if (!@include 'Calendar/Calendar.php') { |
19 | - define('CALENDAR_ROOT','../../'); |
|
19 | + define('CALENDAR_ROOT', '../../'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | if (!isset($_GET['y'])) $_GET['y'] = 2003; |
@@ -30,71 +30,71 @@ discard block |
||
30 | 30 | default: |
31 | 31 | $_GET['view'] = 'calendar_year'; |
32 | 32 | case 'calendar_year': |
33 | - require_once CALENDAR_ROOT.'Year.php'; |
|
33 | + require_once CALENDAR_ROOT . 'Year.php'; |
|
34 | 34 | $c = new Calendar_Year($_GET['y']); |
35 | 35 | break; |
36 | 36 | case 'calendar_month': |
37 | - require_once CALENDAR_ROOT.'Month.php'; |
|
38 | - $c = new Calendar_Month($_GET['y'],$_GET['m']); |
|
37 | + require_once CALENDAR_ROOT . 'Month.php'; |
|
38 | + $c = new Calendar_Month($_GET['y'], $_GET['m']); |
|
39 | 39 | break; |
40 | 40 | case 'calendar_day': |
41 | - require_once CALENDAR_ROOT.'Day.php'; |
|
42 | - $c = new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']); |
|
41 | + require_once CALENDAR_ROOT . 'Day.php'; |
|
42 | + $c = new Calendar_Day($_GET['y'], $_GET['m'], $_GET['d']); |
|
43 | 43 | break; |
44 | 44 | case 'calendar_hour': |
45 | - require_once CALENDAR_ROOT.'Hour.php'; |
|
46 | - $c = new Calendar_Hour($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h']); |
|
45 | + require_once CALENDAR_ROOT . 'Hour.php'; |
|
46 | + $c = new Calendar_Hour($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h']); |
|
47 | 47 | break; |
48 | 48 | case 'calendar_minute': |
49 | - require_once CALENDAR_ROOT.'Minute.php'; |
|
50 | - $c = new Calendar_Minute($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i']); |
|
49 | + require_once CALENDAR_ROOT . 'Minute.php'; |
|
50 | + $c = new Calendar_Minute($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i']); |
|
51 | 51 | break; |
52 | 52 | case 'calendar_second': |
53 | - require_once CALENDAR_ROOT.'Second.php'; |
|
54 | - $c = new Calendar_Second($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i'],$_GET['s']); |
|
53 | + require_once CALENDAR_ROOT . 'Second.php'; |
|
54 | + $c = new Calendar_Second($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i'], $_GET['s']); |
|
55 | 55 | break; |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Convert timestamp to human readable date |
59 | 59 | $date = new Date($c->getTimestamp()); |
60 | 60 | |
61 | -echo ( '<h1>Using PEAR::Date engine</h1>' ); |
|
62 | -echo ( 'Viewing: '.@$_GET['view'].'<br />' ); |
|
63 | -echo ( 'The time is now: '.$date->format('%Y %a %e %T').'<br >' ); |
|
61 | +echo ('<h1>Using PEAR::Date engine</h1>'); |
|
62 | +echo ('Viewing: ' . @$_GET['view'] . '<br />'); |
|
63 | +echo ('The time is now: ' . $date->format('%Y %a %e %T') . '<br >'); |
|
64 | 64 | |
65 | 65 | $i = 1; |
66 | -echo ( '<h1>First Iteration</h1>' ); |
|
67 | -echo ( '<p>The first iteration is more "expensive", the calendar data |
|
66 | +echo ('<h1>First Iteration</h1>'); |
|
67 | +echo ('<p>The first iteration is more "expensive", the calendar data |
|
68 | 68 | structures having to be built.</p>' ); |
69 | 69 | $start = getmicrotime(); |
70 | 70 | $c->build(); |
71 | -while ( $e = $c->fetch() ) { |
|
71 | +while ($e = $c->fetch()) { |
|
72 | 72 | $class = strtolower(get_class($e)); |
73 | - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
74 | - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); |
|
75 | - $method = 'this'.str_replace('calendar_','',$class); |
|
76 | - echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " ); |
|
77 | - if ( ($i % 10) == 0 ) { |
|
78 | - echo ( '<br>' ); |
|
73 | + $link = "&y=" . $e->thisYear() . "&m=" . $e->thisMonth() . "&d=" . $e->thisDay() . |
|
74 | + "&h=" . $e->thisHour() . "&i=" . $e->thisMinute() . "&s=" . $e->thisSecond(); |
|
75 | + $method = 'this' . str_replace('calendar_', '', $class); |
|
76 | + echo ("<a href=\"" . $_SERVER['PHP_SELF'] . "?view=" . $class . $link . "\">" . $e->{$method}() . "</a> : "); |
|
77 | + if (($i % 10) == 0) { |
|
78 | + echo ('<br>'); |
|
79 | 79 | } |
80 | 80 | ++$i; |
81 | 81 | } |
82 | -echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); |
|
82 | +echo ('<p><b>Took: ' . (getmicrotime() - $start) . ' seconds</b></p>'); |
|
83 | 83 | |
84 | 84 | $i = 1; |
85 | -echo ( '<h1>Second Iteration</h1>' ); |
|
86 | -echo ( '<p>This second iteration is faster, the data structures |
|
85 | +echo ('<h1>Second Iteration</h1>'); |
|
86 | +echo ('<p>This second iteration is faster, the data structures |
|
87 | 87 | being re-used</p>' ); |
88 | 88 | $start = getmicrotime(); |
89 | -while ( $e = $c->fetch() ) { |
|
89 | +while ($e = $c->fetch()) { |
|
90 | 90 | $class = strtolower(get_class($e)); |
91 | - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
92 | - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); |
|
93 | - $method = 'this'.str_replace('calendar_','',$class); |
|
94 | - echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " ); |
|
95 | - if ( ($i % 10) == 0 ) { |
|
96 | - echo ( '<br>' ); |
|
91 | + $link = "&y=" . $e->thisYear() . "&m=" . $e->thisMonth() . "&d=" . $e->thisDay() . |
|
92 | + "&h=" . $e->thisHour() . "&i=" . $e->thisMinute() . "&s=" . $e->thisSecond(); |
|
93 | + $method = 'this' . str_replace('calendar_', '', $class); |
|
94 | + echo ("<a href=\"" . $_SERVER['PHP_SELF'] . "?view=" . $class . $link . "\">" . $e->{$method}() . "</a> : "); |
|
95 | + if (($i % 10) == 0) { |
|
96 | + echo ('<br>'); |
|
97 | 97 | } |
98 | 98 | ++$i; |
99 | 99 | } |
100 | -echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); |
|
100 | +echo ('<p><b>Took: ' . (getmicrotime() - $start) . ' seconds</b></p>'); |
@@ -19,12 +19,24 @@ |
||
19 | 19 | define('CALENDAR_ROOT','../../'); |
20 | 20 | } |
21 | 21 | |
22 | -if (!isset($_GET['y'])) $_GET['y'] = 2003; |
|
23 | -if (!isset($_GET['m'])) $_GET['m'] = 8; |
|
24 | -if (!isset($_GET['d'])) $_GET['d'] = 9; |
|
25 | -if (!isset($_GET['h'])) $_GET['h'] = 12; |
|
26 | -if (!isset($_GET['i'])) $_GET['i'] = 34; |
|
27 | -if (!isset($_GET['s'])) $_GET['s'] = 46; |
|
22 | +if (!isset($_GET['y'])) { |
|
23 | + $_GET['y'] = 2003; |
|
24 | +} |
|
25 | +if (!isset($_GET['m'])) { |
|
26 | + $_GET['m'] = 8; |
|
27 | +} |
|
28 | +if (!isset($_GET['d'])) { |
|
29 | + $_GET['d'] = 9; |
|
30 | +} |
|
31 | +if (!isset($_GET['h'])) { |
|
32 | + $_GET['h'] = 12; |
|
33 | +} |
|
34 | +if (!isset($_GET['i'])) { |
|
35 | + $_GET['i'] = 34; |
|
36 | +} |
|
37 | +if (!isset($_GET['s'])) { |
|
38 | + $_GET['s'] = 46; |
|
39 | +} |
|
28 | 40 | |
29 | 41 | switch (@$_GET['view']) { |
30 | 42 | default: |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | if (!@include 'Calendar/Calendar.php') { |
7 | 7 | define('CALENDAR_ROOT', '../../'); |
8 | 8 | } |
9 | -require_once CALENDAR_ROOT.'Day.php'; |
|
10 | -require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
|
11 | -require_once CALENDAR_ROOT.'Decorator/Textual.php'; |
|
9 | +require_once CALENDAR_ROOT . 'Day.php'; |
|
10 | +require_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
|
11 | +require_once CALENDAR_ROOT . 'Decorator/Textual.php'; |
|
12 | 12 | |
13 | 13 | // Could change language like this |
14 | 14 | // setlocale (LC_TIME, "de_DE"); // Unix based (probably) |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | // Decorate |
29 | 29 | $Textual = new Calendar_Decorator_Textual($Calendar); |
30 | 30 | |
31 | -echo '<hr>Previous month is: '.$Textual->prevMonthName('two').'<br />'; |
|
32 | -echo 'This month is: '.$Textual->thisMonthName('short').'<br />'; |
|
33 | -echo 'Next month is: '.$Textual->nextMonthName().'<br /><hr />'; |
|
34 | -echo 'Previous day is: '.$Textual->prevDayName().'<br />'; |
|
35 | -echo 'This day is: '.$Textual->thisDayName('short').'<br />'; |
|
36 | -echo 'Next day is: '.$Textual->nextDayName('one').'<br /><hr />'; |
|
31 | +echo '<hr>Previous month is: ' . $Textual->prevMonthName('two') . '<br />'; |
|
32 | +echo 'This month is: ' . $Textual->thisMonthName('short') . '<br />'; |
|
33 | +echo 'Next month is: ' . $Textual->nextMonthName() . '<br /><hr />'; |
|
34 | +echo 'Previous day is: ' . $Textual->prevDayName() . '<br />'; |
|
35 | +echo 'This day is: ' . $Textual->thisDayName('short') . '<br />'; |
|
36 | +echo 'Next day is: ' . $Textual->nextDayName('one') . '<br /><hr />'; |
|
37 | 37 | |
38 | 38 | echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week<br />"; |
39 | 39 | $Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6); |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | ?> |
44 | 44 | <p>Rendering calendar....</p> |
45 | 45 | <table> |
46 | -<caption><?php echo $Textual->thisMonthName().' '.$Textual->thisYear(); ?></caption> |
|
46 | +<caption><?php echo $Textual->thisMonthName() . ' ' . $Textual->thisYear(); ?></caption> |
|
47 | 47 | <tr> |
48 | 48 | <?php |
49 | 49 | $dayheaders = $Textual->orderedWeekdays('short'); |
50 | 50 | foreach ($dayheaders as $dayheader) { |
51 | - echo '<th>'.$dayheader.'</th>'; |
|
51 | + echo '<th>' . $dayheader . '</th>'; |
|
52 | 52 | } |
53 | 53 | ?> |
54 | 54 | </tr> |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if ($Day->isEmpty()) { |
62 | 62 | echo '<td> </td>'; |
63 | 63 | } else { |
64 | - echo '<td>'.$Day->thisDay().'</td>'; |
|
64 | + echo '<td>' . $Day->thisDay() . '</td>'; |
|
65 | 65 | } |
66 | 66 | if ($Day->isLast()) { |
67 | 67 | echo "</tr>\n"; |
@@ -3,13 +3,13 @@ |
||
3 | 3 | * Description: simple example on i18N |
4 | 4 | */ |
5 | 5 | if (!@include 'Calendar/Calendar.php') { |
6 | - define('CALENDAR_ROOT','../../'); |
|
6 | + define('CALENDAR_ROOT', '../../'); |
|
7 | 7 | } |
8 | -require_once CALENDAR_ROOT.'Day.php'; |
|
8 | +require_once CALENDAR_ROOT . 'Day.php'; |
|
9 | 9 | |
10 | -$Day = new Calendar_Day(2003,10,23); |
|
10 | +$Day = new Calendar_Day(2003, 10, 23); |
|
11 | 11 | |
12 | -setlocale (LC_TIME, "de_DE"); // Unix based (probably) |
|
12 | +setlocale(LC_TIME, "de_DE"); // Unix based (probably) |
|
13 | 13 | // setlocale (LC_TIME, "ge"); // Windows |
14 | 14 | |
15 | -echo ( strftime('%A %d %B %Y',$Day->getTimeStamp())); |
|
15 | +echo (strftime('%A %d %B %Y', $Day->getTimeStamp())); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | if (!@include 'Calendar/Calendar.php') { |
14 | 14 | define('CALENDAR_ROOT', '../../'); |
15 | 15 | } |
16 | -require_once CALENDAR_ROOT.'Second.php'; |
|
16 | +require_once CALENDAR_ROOT . 'Second.php'; |
|
17 | 17 | |
18 | 18 | if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
19 | 19 | if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | |
25 | 25 | $Unit = new Calendar_Second($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i'], $_GET['s']); |
26 | 26 | |
27 | -echo '<p><b>Result:</b> '.$Unit->thisYear().'-'.$Unit->thisMonth().'-'.$Unit->thisDay(). |
|
28 | - ' '.$Unit->thisHour().':'.$Unit->thisMinute().':'.$Unit->thisSecond(); |
|
27 | +echo '<p><b>Result:</b> ' . $Unit->thisYear() . '-' . $Unit->thisMonth() . '-' . $Unit->thisDay() . |
|
28 | + ' ' . $Unit->thisHour() . ':' . $Unit->thisMinute() . ':' . $Unit->thisSecond(); |
|
29 | 29 | if ($Unit->isValid()) { |
30 | 30 | echo ' is valid!</p>'; |
31 | 31 | } else { |
32 | - $V= & $Unit->getValidator(); |
|
32 | + $V = & $Unit->getValidator(); |
|
33 | 33 | echo ' is invalid:</p>'; |
34 | 34 | while ($error = $V->fetch()) { |
35 | - echo $error->toString() .'<br />'; |
|
35 | + echo $error->toString() . '<br />'; |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | ?> |
@@ -48,4 +48,4 @@ discard block |
||
48 | 48 | </form> |
49 | 49 | <p><b>Note:</b> Error messages can be controlled with the constants <code>CALENDAR_VALUE_TOOSMALL</code> and <code>CALENDAR_VALUE_TOOLARGE</code> - see <code>Calendar_Validator.php</code></p> |
50 | 50 | |
51 | -<?php echo '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>'; |
|
51 | +<?php echo '<p><b>Took: ' . (getmicrotime() - $start) . ' seconds</b></p>'; |
@@ -15,12 +15,24 @@ |
||
15 | 15 | } |
16 | 16 | require_once CALENDAR_ROOT.'Second.php'; |
17 | 17 | |
18 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
19 | -if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
|
20 | -if (!isset($_GET['d'])) $_GET['d'] = date('j'); |
|
21 | -if (!isset($_GET['h'])) $_GET['h'] = date('H'); |
|
22 | -if (!isset($_GET['i'])) $_GET['i'] = date('i'); |
|
23 | -if (!isset($_GET['s'])) $_GET['s'] = date('s'); |
|
18 | +if (!isset($_GET['y'])) { |
|
19 | + $_GET['y'] = date('Y'); |
|
20 | +} |
|
21 | +if (!isset($_GET['m'])) { |
|
22 | + $_GET['m'] = date('n'); |
|
23 | +} |
|
24 | +if (!isset($_GET['d'])) { |
|
25 | + $_GET['d'] = date('j'); |
|
26 | +} |
|
27 | +if (!isset($_GET['h'])) { |
|
28 | + $_GET['h'] = date('H'); |
|
29 | +} |
|
30 | +if (!isset($_GET['i'])) { |
|
31 | + $_GET['i'] = date('i'); |
|
32 | +} |
|
33 | +if (!isset($_GET['s'])) { |
|
34 | + $_GET['s'] = date('s'); |
|
35 | +} |
|
24 | 36 | |
25 | 37 | $Unit = new Calendar_Second($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i'], $_GET['s']); |
26 | 38 |
@@ -4,11 +4,11 @@ discard block |
||
4 | 4 | * to make it available when iterating over calendar children |
5 | 5 | */ |
6 | 6 | if (!@include 'Calendar/Calendar.php') { |
7 | - define('CALENDAR_ROOT','../../'); |
|
7 | + define('CALENDAR_ROOT', '../../'); |
|
8 | 8 | } |
9 | -require_once CALENDAR_ROOT.'Day.php'; |
|
10 | -require_once CALENDAR_ROOT.'Hour.php'; |
|
11 | -require_once CALENDAR_ROOT.'Decorator.php'; |
|
9 | +require_once CALENDAR_ROOT . 'Day.php'; |
|
10 | +require_once CALENDAR_ROOT . 'Hour.php'; |
|
11 | +require_once CALENDAR_ROOT . 'Decorator.php'; |
|
12 | 12 | |
13 | 13 | // Decorator to "attach" functionality to selected hours |
14 | 14 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | // Create a day to view the hours for |
43 | -$Day = new Calendar_Day(2003,10,24); |
|
43 | +$Day = new Calendar_Day(2003, 10, 24); |
|
44 | 44 | |
45 | 45 | // A sample query to get the data for today (NOT ACTUALLY USED HERE) |
46 | 46 | $sql = " |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | FROM |
50 | 50 | diary |
51 | 51 | WHERE |
52 | - eventtime >= '".$Day->thisDay(TRUE)."' |
|
52 | + eventtime >= '".$Day->thisDay(TRUE) . "' |
|
53 | 53 | AND |
54 | - eventtime < '".$Day->nextDay(TRUE)."';"; |
|
54 | + eventtime < '".$Day->nextDay(TRUE) . "';"; |
|
55 | 55 | |
56 | 56 | // An array simulating data from a database |
57 | -$result = array ( |
|
58 | - array('eventtime'=>mktime(9,0,0,10,24,2003),'entry'=>'Meeting with sales team'), |
|
59 | - array('eventtime'=>mktime(11,0,0,10,24,2003),'entry'=>'Conference call with Widget Inc.'), |
|
60 | - array('eventtime'=>mktime(15,0,0,10,24,2003),'entry'=>'Presentation to board of directors') |
|
57 | +$result = array( |
|
58 | + array('eventtime'=>mktime(9, 0, 0, 10, 24, 2003), 'entry'=>'Meeting with sales team'), |
|
59 | + array('eventtime'=>mktime(11, 0, 0, 10, 24, 2003), 'entry'=>'Conference call with Widget Inc.'), |
|
60 | + array('eventtime'=>mktime(15, 0, 0, 10, 24, 2003), 'entry'=>'Presentation to board of directors') |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | // An array to place selected hours in |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | // Loop through the "database result" |
67 | 67 | foreach ($result as $row) { |
68 | - $Hour = new Calendar_Hour(2000,1,1,1); // Create Hour with dummy values |
|
68 | + $Hour = new Calendar_Hour(2000, 1, 1, 1); // Create Hour with dummy values |
|
69 | 69 | $Hour->setTimeStamp($row['eventtime']); // Set the real time with setTimeStamp |
70 | 70 | |
71 | 71 | // Create the decorator, passing it the Hour |
@@ -89,36 +89,36 @@ discard block |
||
89 | 89 | <body> |
90 | 90 | <h1>Passing a Selection "Payload" using a Decorator</h1> |
91 | 91 | <table> |
92 | -<caption><b>Your Schedule for <?php echo ( date('D nS F Y',$Day->thisDay(TRUE)) ); ?></b></caption> |
|
92 | +<caption><b>Your Schedule for <?php echo (date('D nS F Y', $Day->thisDay(TRUE))); ?></b></caption> |
|
93 | 93 | <tr> |
94 | 94 | <th width="5%">Time</th> |
95 | 95 | <th>Entry</th> |
96 | 96 | </tr> |
97 | 97 | <?php |
98 | -while ( $Hour = & $Day->fetch() ) { |
|
98 | +while ($Hour = & $Day->fetch()) { |
|
99 | 99 | |
100 | 100 | $hour = $Hour->thisHour(); |
101 | 101 | $minute = $Hour->thisMinute(); |
102 | 102 | |
103 | 103 | // Office hours only... |
104 | 104 | if ($hour >= 8 && $hour <= 18) { |
105 | - echo ( "<tr>\n" ); |
|
106 | - echo ( "<td>$hour:$minute</td>\n" ); |
|
105 | + echo ("<tr>\n"); |
|
106 | + echo ("<td>$hour:$minute</td>\n"); |
|
107 | 107 | |
108 | 108 | // If the hour is selected, call the decorator method... |
109 | - if ( $Hour->isSelected() ) { |
|
110 | - echo ( "<td bgcolor=\"silver\">".$Hour->getEntry()."</td>\n" ); |
|
109 | + if ($Hour->isSelected()) { |
|
110 | + echo ("<td bgcolor=\"silver\">" . $Hour->getEntry() . "</td>\n"); |
|
111 | 111 | } else { |
112 | - echo ( "<td> </td>\n" ); |
|
112 | + echo ("<td> </td>\n"); |
|
113 | 113 | } |
114 | - echo ( "</tr>\n" ); |
|
114 | + echo ("</tr>\n"); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | ?> |
118 | 118 | </table> |
119 | 119 | <p>The query to fetch this data, with help from PEAR::Calendar, might be;</p> |
120 | 120 | <pre> |
121 | -<?php echo ( $sql ); ?> |
|
121 | +<?php echo ($sql); ?> |
|
122 | 122 | </pre> |
123 | 123 | </body> |
124 | 124 | </html> |
@@ -24,7 +24,7 @@ |
||
24 | 24 | var $entries = array(); |
25 | 25 | |
26 | 26 | /** |
27 | - * @param $calendar |
|
27 | + * @param Calendar_Day $calendar |
|
28 | 28 | */ |
29 | 29 | function DiaryEvent($calendar) |
30 | 30 | { |
@@ -19,15 +19,15 @@ discard block |
||
19 | 19 | class MonthDecorator extends Calendar_Decorator |
20 | 20 | { |
21 | 21 | /** |
22 | - * @param Calendar_Month |
|
23 | - */ |
|
22 | + * @param Calendar_Month |
|
23 | + */ |
|
24 | 24 | function MonthDecorator(& $Month) |
25 | 25 | { |
26 | 26 | parent::Calendar_Decorator($Month); |
27 | 27 | } |
28 | 28 | /** |
29 | - * Override the prevMonth method to format the output |
|
30 | - */ |
|
29 | + * Override the prevMonth method to format the output |
|
30 | + */ |
|
31 | 31 | function prevMonth() |
32 | 32 | { |
33 | 33 | $prevStamp = parent::prevMonth(TRUE); |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | '&m='.date('n',$prevStamp).'&d='.date('j',$prevStamp); |
37 | 37 | } |
38 | 38 | /** |
39 | - * Override the thisMonth method to format the output |
|
40 | - */ |
|
39 | + * Override the thisMonth method to format the output |
|
40 | + */ |
|
41 | 41 | function thisMonth() |
42 | 42 | { |
43 | 43 | $thisStamp = parent::thisMonth(TRUE); |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | return date('F Y',$thisStamp); |
46 | 46 | } |
47 | 47 | /** |
48 | - * Override the nextMonth method to format the output |
|
49 | - */ |
|
48 | + * Override the nextMonth method to format the output |
|
49 | + */ |
|
50 | 50 | function nextMonth() |
51 | 51 | { |
52 | 52 | $nextStamp = parent::nextMonth(TRUE); |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | * format the month while the days are accessed via the normal Month object |
8 | 8 | */ |
9 | 9 | if (!@include 'Calendar/Calendar.php') { |
10 | - define('CALENDAR_ROOT','../../'); |
|
10 | + define('CALENDAR_ROOT', '../../'); |
|
11 | 11 | } |
12 | -require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
|
13 | -require_once CALENDAR_ROOT.'Decorator.php'; |
|
12 | +require_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
|
13 | +require_once CALENDAR_ROOT . 'Decorator.php'; |
|
14 | 14 | |
15 | 15 | // Decorate a Month with methods to improve formatting |
16 | 16 | /** |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | { |
33 | 33 | $prevStamp = parent::prevMonth(TRUE); |
34 | 34 | // Build the URL for the previous month |
35 | - return $_SERVER['PHP_SELF'].'?y='.date('Y',$prevStamp). |
|
36 | - '&m='.date('n',$prevStamp).'&d='.date('j',$prevStamp); |
|
35 | + return $_SERVER['PHP_SELF'] . '?y=' . date('Y', $prevStamp) . |
|
36 | + '&m=' . date('n', $prevStamp) . '&d=' . date('j', $prevStamp); |
|
37 | 37 | } |
38 | 38 | /** |
39 | 39 | * Override the thisMonth method to format the output |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $thisStamp = parent::thisMonth(TRUE); |
44 | 44 | // A human readable string from this month |
45 | - return date('F Y',$thisStamp); |
|
45 | + return date('F Y', $thisStamp); |
|
46 | 46 | } |
47 | 47 | /** |
48 | 48 | * Override the nextMonth method to format the output |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | { |
52 | 52 | $nextStamp = parent::nextMonth(TRUE); |
53 | 53 | // Build the URL for next month |
54 | - return $_SERVER['PHP_SELF'].'?y='.date('Y',$nextStamp). |
|
55 | - '&m='.date('n',$nextStamp).'&d='.date('j',$nextStamp); |
|
54 | + return $_SERVER['PHP_SELF'] . '?y=' . date('Y', $nextStamp) . |
|
55 | + '&m=' . date('n', $nextStamp) . '&d=' . date('j', $nextStamp); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
61 | 61 | |
62 | 62 | // Creata a month as usual |
63 | -$Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
|
63 | +$Month = new Calendar_Month_Weekdays($_GET['y'], $_GET['m']); |
|
64 | 64 | |
65 | 65 | // Pass it to the decorator and use the decorator from now on... |
66 | 66 | $MonthDecorator = new MonthDecorator($Month); |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | <body> |
76 | 76 | <h1>A Simple Decorator</h1> |
77 | 77 | <table> |
78 | -<caption><?php echo ( $MonthDecorator->thisMonth() ); ?></caption> |
|
78 | +<caption><?php echo ($MonthDecorator->thisMonth()); ?></caption> |
|
79 | 79 | <?php |
80 | -while ( $Day = $MonthDecorator->fetch() ) { |
|
81 | - if ( $Day->isFirst() ) { |
|
82 | - echo ( "\n<tr>\n" ); |
|
80 | +while ($Day = $MonthDecorator->fetch()) { |
|
81 | + if ($Day->isFirst()) { |
|
82 | + echo ("\n<tr>\n"); |
|
83 | 83 | } |
84 | - if ( $Day->isEmpty() ) { |
|
85 | - echo ( "<td> </td>" ); |
|
84 | + if ($Day->isEmpty()) { |
|
85 | + echo ("<td> </td>"); |
|
86 | 86 | } else { |
87 | - echo ( "<td>".$Day->thisDay()."</td>" ); |
|
87 | + echo ("<td>" . $Day->thisDay() . "</td>"); |
|
88 | 88 | } |
89 | - if ( $Day->isLast() ) { |
|
90 | - echo ( "\n</tr>\n" ); |
|
89 | + if ($Day->isLast()) { |
|
90 | + echo ("\n</tr>\n"); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | ?> |
@@ -56,8 +56,12 @@ |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
60 | -if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
|
59 | +if (!isset($_GET['y'])) { |
|
60 | + $_GET['y'] = date('Y'); |
|
61 | +} |
|
62 | +if (!isset($_GET['m'])) { |
|
63 | + $_GET['m'] = date('n'); |
|
64 | +} |
|
61 | 65 | |
62 | 66 | // Creata a month as usual |
63 | 67 | $Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |