@@ -14,16 +14,16 @@ 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 ' |
|
| 17 | +echo ('<p>The current month is ' |
|
| 18 | 18 | .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'</p>'); |
| 19 | 19 | |
| 20 | -$Uri = & new Calendar_Util_Uri('jahr','monat'); |
|
| 21 | -$Uri->setFragments('jahr','monat'); |
|
| 20 | +$Uri = & new Calendar_Util_Uri('jahr', 'monat'); |
|
| 21 | +$Uri->setFragments('jahr', 'monat'); |
|
| 22 | 22 | |
| 23 | 23 | echo "\"Vector\" URIs<pre>"; |
| 24 | -echo ( "Previous Uri:\t".htmlentities($Uri->prev($Calendar, 'month'))."\n" ); |
|
| 25 | -echo ( "This Uri:\t".htmlentities($Uri->this($Calendar, 'month'))."\n" ); |
|
| 26 | -echo ( "Next Uri:\t".htmlentities($Uri->next($Calendar, 'month'))."\n" ); |
|
| 24 | +echo ("Previous Uri:\t".htmlentities($Uri->prev($Calendar, 'month'))."\n"); |
|
| 25 | +echo ("This Uri:\t".htmlentities($Uri->this($Calendar, 'month'))."\n"); |
|
| 26 | +echo ("Next Uri:\t".htmlentities($Uri->next($Calendar, 'month'))."\n"); |
|
| 27 | 27 | echo "</pre>"; |
| 28 | 28 | |
| 29 | 29 | // Switch to scalar URIs |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | $Uri->scalar = true; // Omit variable names |
| 32 | 32 | |
| 33 | 33 | echo "\"Scalar\" URIs<pre>"; |
| 34 | -echo ( "Previous Uri:\t".$Uri->prev($Calendar, 'month')."\n" ); |
|
| 35 | -echo ( "This Uri:\t".$Uri->this($Calendar, 'month')."\n" ); |
|
| 36 | -echo ( "Next Uri:\t".$Uri->next($Calendar, 'month')."\n" ); |
|
| 34 | +echo ("Previous Uri:\t".$Uri->prev($Calendar, 'month')."\n"); |
|
| 35 | +echo ("This Uri:\t".$Uri->this($Calendar, 'month')."\n"); |
|
| 36 | +echo ("Next Uri:\t".$Uri->next($Calendar, 'month')."\n"); |
|
| 37 | 37 | echo "</pre>"; |
| 38 | 38 | |
| 39 | 39 | // Restore the vector URIs |
@@ -41,6 +41,6 @@ discard block |
||
| 41 | 41 | $Uri->scalar = false; |
| 42 | 42 | ?> |
| 43 | 43 | <p> |
| 44 | -<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->prev($Calendar, 'month'));?>">Prev</a> : |
|
| 45 | -<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->next($Calendar, 'month'));?>">Next</a> |
|
| 44 | +<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->prev($Calendar, 'month')); ?>">Prev</a> : |
|
| 45 | +<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->next($Calendar, 'month')); ?>">Next</a> |
|
| 46 | 46 | </p> |
| 47 | 47 | \ No newline at end of file |
@@ -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']); |
@@ -2,13 +2,13 @@ discard block |
||
| 2 | 2 | /** |
| 3 | 3 | * Description: shows how to perform validation with PEAR::Calendar |
| 4 | 4 | */ |
| 5 | -function getmicrotime(){ |
|
| 5 | +function getmicrotime() { |
|
| 6 | 6 | list($usec, $sec) = explode(' ', microtime()); |
| 7 | 7 | return ((float)$usec + (float)$sec); |
| 8 | 8 | } |
| 9 | 9 | $start = getmicrotime(); |
| 10 | 10 | |
| 11 | -if ( !@include 'Calendar/Calendar.php' ) { |
|
| 11 | +if (!@include 'Calendar/Calendar.php') { |
|
| 12 | 12 | define('CALENDAR_ROOT', '../../'); |
| 13 | 13 | } |
| 14 | 14 | require_once CALENDAR_ROOT.'Second.php'; |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | if ($Unit->isValid()) { |
| 28 | 28 | echo ' is valid!</p>'; |
| 29 | 29 | } else { |
| 30 | - $V= & $Unit->getValidator(); |
|
| 30 | + $V = & $Unit->getValidator(); |
|
| 31 | 31 | echo ' is invalid:</p>'; |
| 32 | 32 | while ($error = $V->fetch()) { |
| 33 | - echo $error->toString() .'<br />'; |
|
| 33 | + echo $error->toString().'<br />'; |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | ?> |
@@ -46,4 +46,4 @@ discard block |
||
| 46 | 46 | </form> |
| 47 | 47 | <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> |
| 48 | 48 | |
| 49 | -<?php echo '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>'; ?> |
|
| 50 | 49 | \ No newline at end of file |
| 50 | +<?php echo '<p><b>Took: '.(getmicrotime() - $start).' seconds</b></p>'; ?> |
|
| 51 | 51 | \ No newline at end of file |
@@ -13,12 +13,24 @@ |
||
| 13 | 13 | } |
| 14 | 14 | require_once CALENDAR_ROOT.'Second.php'; |
| 15 | 15 | |
| 16 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
| 17 | -if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
|
| 18 | -if (!isset($_GET['d'])) $_GET['d'] = date('j'); |
|
| 19 | -if (!isset($_GET['h'])) $_GET['h'] = date('H'); |
|
| 20 | -if (!isset($_GET['i'])) $_GET['i'] = date('i'); |
|
| 21 | -if (!isset($_GET['s'])) $_GET['s'] = date('s'); |
|
| 16 | +if (!isset($_GET['y'])) { |
|
| 17 | + $_GET['y'] = date('Y'); |
|
| 18 | +} |
|
| 19 | +if (!isset($_GET['m'])) { |
|
| 20 | + $_GET['m'] = date('n'); |
|
| 21 | +} |
|
| 22 | +if (!isset($_GET['d'])) { |
|
| 23 | + $_GET['d'] = date('j'); |
|
| 24 | +} |
|
| 25 | +if (!isset($_GET['h'])) { |
|
| 26 | + $_GET['h'] = date('H'); |
|
| 27 | +} |
|
| 28 | +if (!isset($_GET['i'])) { |
|
| 29 | + $_GET['i'] = date('i'); |
|
| 30 | +} |
|
| 31 | +if (!isset($_GET['s'])) { |
|
| 32 | + $_GET['s'] = date('s'); |
|
| 33 | +} |
|
| 22 | 34 | |
| 23 | 35 | $Unit = & new Calendar_Second($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i'], $_GET['s']); |
| 24 | 36 | |
@@ -3,14 +3,14 @@ discard block |
||
| 3 | 3 | * Description: generating elements of a form with PEAR::Calendar, using |
| 4 | 4 | * selections as well as validating the submission |
| 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.'Year.php'; |
| 16 | 16 | require_once CALENDAR_ROOT.'Month.php'; |
@@ -35,38 +35,38 @@ discard block |
||
| 35 | 35 | <body> |
| 36 | 36 | <h1>Select and Update</h1> |
| 37 | 37 | <?php |
| 38 | -if ( isset($_POST['update']) ) { |
|
| 39 | - $Second = & new Calendar_Second($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i'],$_POST['s']); |
|
| 40 | - if ( !$Second->isValid() ) { |
|
| 41 | - $V= & $Second->getValidator(); |
|
| 42 | - echo ('<p>Validation failed:</p>' ); |
|
| 43 | - while ( $error = $V->fetch() ) { |
|
| 44 | - echo ( $error->toString() .'<br>' ); |
|
| 38 | +if (isset($_POST['update'])) { |
|
| 39 | + $Second = & new Calendar_Second($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i'], $_POST['s']); |
|
| 40 | + if (!$Second->isValid()) { |
|
| 41 | + $V = & $Second->getValidator(); |
|
| 42 | + echo ('<p>Validation failed:</p>'); |
|
| 43 | + while ($error = $V->fetch()) { |
|
| 44 | + echo ($error->toString().'<br>'); |
|
| 45 | 45 | } |
| 46 | 46 | } else { |
| 47 | - echo ('<p>Validation success.</p>' ); |
|
| 48 | - echo ( '<p>New timestamp is: '.$Second->getTimeStamp().' which could be used to update a database, for example'); |
|
| 47 | + echo ('<p>Validation success.</p>'); |
|
| 48 | + echo ('<p>New timestamp is: '.$Second->getTimeStamp().' which could be used to update a database, for example'); |
|
| 49 | 49 | } |
| 50 | 50 | } else { |
| 51 | 51 | $Year = new Calendar_Year($_POST['y']); |
| 52 | -$Month = new Calendar_Month($_POST['y'],$_POST['m']); |
|
| 53 | -$Day = new Calendar_Day($_POST['y'],$_POST['m'],$_POST['d']); |
|
| 54 | -$Hour = new Calendar_Hour($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h']); |
|
| 55 | -$Minute = new Calendar_Minute($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i']); |
|
| 56 | -$Second = new Calendar_Second($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i'],$_POST['s']); |
|
| 52 | +$Month = new Calendar_Month($_POST['y'], $_POST['m']); |
|
| 53 | +$Day = new Calendar_Day($_POST['y'], $_POST['m'], $_POST['d']); |
|
| 54 | +$Hour = new Calendar_Hour($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h']); |
|
| 55 | +$Minute = new Calendar_Minute($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i']); |
|
| 56 | +$Second = new Calendar_Second($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i'], $_POST['s']); |
|
| 57 | 57 | ?> |
| 58 | 58 | <p><b>Set the alarm clock</p></p> |
| 59 | -<form action="<?php echo ( $_SERVER['PHP_SELF'] ); ?>" method="post"> |
|
| 60 | -Year: <input type="text" name="y" value="<?php echo ( $_POST['y'] ); ?>" size="4"> |
|
| 59 | +<form action="<?php echo ($_SERVER['PHP_SELF']); ?>" method="post"> |
|
| 60 | +Year: <input type="text" name="y" value="<?php echo ($_POST['y']); ?>" size="4"> |
|
| 61 | 61 | Month:<select name="m"> |
| 62 | 62 | <?php |
| 63 | 63 | $selection = array($Month); |
| 64 | 64 | $Year->build($selection); |
| 65 | -while ( $Child = & $Year->fetch() ) { |
|
| 66 | - if ( $Child->isSelected() ) { |
|
| 67 | - echo ( "<option value=\"".$Child->thisMonth()."\" selected>".$Child->thisMonth()."\n" ); |
|
| 65 | +while ($Child = & $Year->fetch()) { |
|
| 66 | + if ($Child->isSelected()) { |
|
| 67 | + echo ("<option value=\"".$Child->thisMonth()."\" selected>".$Child->thisMonth()."\n"); |
|
| 68 | 68 | } else { |
| 69 | - echo ( "<option value=\"".$Child->thisMonth()."\">".$Child->thisMonth()."\n" ); |
|
| 69 | + echo ("<option value=\"".$Child->thisMonth()."\">".$Child->thisMonth()."\n"); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | ?> |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | <?php |
| 76 | 76 | $selection = array($Day); |
| 77 | 77 | $Month->build($selection); |
| 78 | -while ( $Child = & $Month->fetch() ) { |
|
| 79 | - if ( $Child->isSelected() ) { |
|
| 80 | - echo ( "<option value=\"".$Child->thisDay()."\" selected>".$Child->thisDay()."\n" ); |
|
| 78 | +while ($Child = & $Month->fetch()) { |
|
| 79 | + if ($Child->isSelected()) { |
|
| 80 | + echo ("<option value=\"".$Child->thisDay()."\" selected>".$Child->thisDay()."\n"); |
|
| 81 | 81 | } else { |
| 82 | - echo ( "<option value=\"".$Child->thisDay()."\">".$Child->thisDay()."\n" ); |
|
| 82 | + echo ("<option value=\"".$Child->thisDay()."\">".$Child->thisDay()."\n"); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | ?> |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | <?php |
| 89 | 89 | $selection = array($Hour); |
| 90 | 90 | $Day->build($selection); |
| 91 | -while ( $Child = & $Day->fetch() ) { |
|
| 92 | - if ( $Child->isSelected() ) { |
|
| 93 | - echo ( "<option value=\"".$Child->thisHour()."\" selected>".$Child->thisHour()."\n" ); |
|
| 91 | +while ($Child = & $Day->fetch()) { |
|
| 92 | + if ($Child->isSelected()) { |
|
| 93 | + echo ("<option value=\"".$Child->thisHour()."\" selected>".$Child->thisHour()."\n"); |
|
| 94 | 94 | } else { |
| 95 | - echo ( "<option value=\"".$Child->thisHour()."\">".$Child->thisHour()."\n" ); |
|
| 95 | + echo ("<option value=\"".$Child->thisHour()."\">".$Child->thisHour()."\n"); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | ?> |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | <?php |
| 102 | 102 | $selection = array($Minute); |
| 103 | 103 | $Hour->build($selection); |
| 104 | -while ( $Child = & $Hour->fetch() ) { |
|
| 105 | - if ( $Child->isSelected() ) { |
|
| 106 | - echo ( "<option value=\"".$Child->thisMinute()."\" selected>".$Child->thisMinute()."\n" ); |
|
| 104 | +while ($Child = & $Hour->fetch()) { |
|
| 105 | + if ($Child->isSelected()) { |
|
| 106 | + echo ("<option value=\"".$Child->thisMinute()."\" selected>".$Child->thisMinute()."\n"); |
|
| 107 | 107 | } else { |
| 108 | - echo ( "<option value=\"".$Child->thisMinute()."\">".$Child->thisMinute()."\n" ); |
|
| 108 | + echo ("<option value=\"".$Child->thisMinute()."\">".$Child->thisMinute()."\n"); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | ?> |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | <?php |
| 115 | 115 | $selection = array($Second); |
| 116 | 116 | $Minute->build($selection); |
| 117 | -while ( $Child = & $Minute->fetch() ) { |
|
| 118 | - if ( $Child->isSelected() ) { |
|
| 119 | - echo ( "<option value=\"".$Child->thisSecond()."\" selected>".$Child->thisSecond()."\n" ); |
|
| 117 | +while ($Child = & $Minute->fetch()) { |
|
| 118 | + if ($Child->isSelected()) { |
|
| 119 | + echo ("<option value=\"".$Child->thisSecond()."\" selected>".$Child->thisSecond()."\n"); |
|
| 120 | 120 | } else { |
| 121 | - echo ( "<option value=\"".$Child->thisSecond()."\">".$Child->thisSecond()."\n" ); |
|
| 121 | + echo ("<option value=\"".$Child->thisSecond()."\">".$Child->thisSecond()."\n"); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | ?> |
@@ -127,6 +127,6 @@ discard block |
||
| 127 | 127 | <?php |
| 128 | 128 | } |
| 129 | 129 | ?> |
| 130 | -<?php echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); ?> |
|
| 130 | +<?php echo ('<p><b>Took: '.(getmicrotime() - $start).' seconds</b></p>'); ?> |
|
| 131 | 131 | </body> |
| 132 | 132 | </html> |
| 133 | 133 | \ No newline at end of file |
@@ -20,12 +20,24 @@ |
||
| 20 | 20 | require_once CALENDAR_ROOT.'Second.php'; |
| 21 | 21 | |
| 22 | 22 | // Initialize if not set |
| 23 | -if (!isset($_POST['y'])) $_POST['y'] = date('Y'); |
|
| 24 | -if (!isset($_POST['m'])) $_POST['m'] = date('n'); |
|
| 25 | -if (!isset($_POST['d'])) $_POST['d'] = date('j'); |
|
| 26 | -if (!isset($_POST['h'])) $_POST['h'] = date('H'); |
|
| 27 | -if (!isset($_POST['i'])) $_POST['i'] = date('i'); |
|
| 28 | -if (!isset($_POST['s'])) $_POST['s'] = date('s'); |
|
| 23 | +if (!isset($_POST['y'])) { |
|
| 24 | + $_POST['y'] = date('Y'); |
|
| 25 | +} |
|
| 26 | +if (!isset($_POST['m'])) { |
|
| 27 | + $_POST['m'] = date('n'); |
|
| 28 | +} |
|
| 29 | +if (!isset($_POST['d'])) { |
|
| 30 | + $_POST['d'] = date('j'); |
|
| 31 | +} |
|
| 32 | +if (!isset($_POST['h'])) { |
|
| 33 | + $_POST['h'] = date('H'); |
|
| 34 | +} |
|
| 35 | +if (!isset($_POST['i'])) { |
|
| 36 | + $_POST['i'] = date('i'); |
|
| 37 | +} |
|
| 38 | +if (!isset($_POST['s'])) { |
|
| 39 | + $_POST['s'] = date('s'); |
|
| 40 | +} |
|
| 29 | 41 | ?> |
| 30 | 42 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 31 | 43 | <html> |
@@ -15,14 +15,14 @@ discard block |
||
| 15 | 15 | // Decorate a Month with methods to improve formatting |
| 16 | 16 | class MonthDecorator extends Calendar_Decorator { |
| 17 | 17 | /** |
| 18 | - * @param Calendar_Month |
|
| 19 | - */ |
|
| 18 | + * @param Calendar_Month |
|
| 19 | + */ |
|
| 20 | 20 | function MonthDecorator(& $Month) { |
| 21 | 21 | parent::Calendar_Decorator($Month); |
| 22 | 22 | } |
| 23 | 23 | /** |
| 24 | - * Override the prevMonth method to format the output |
|
| 25 | - */ |
|
| 24 | + * Override the prevMonth method to format the output |
|
| 25 | + */ |
|
| 26 | 26 | function prevMonth() { |
| 27 | 27 | $prevStamp = parent::prevMonth(TRUE); |
| 28 | 28 | // Build the URL for the previous month |
@@ -30,16 +30,16 @@ discard block |
||
| 30 | 30 | '&m='.date('n',$prevStamp).'&d='.date('j',$prevStamp); |
| 31 | 31 | } |
| 32 | 32 | /** |
| 33 | - * Override the thisMonth method to format the output |
|
| 34 | - */ |
|
| 33 | + * Override the thisMonth method to format the output |
|
| 34 | + */ |
|
| 35 | 35 | function thisMonth() { |
| 36 | 36 | $thisStamp = parent::thisMonth(TRUE); |
| 37 | 37 | // A human readable string from this month |
| 38 | 38 | return date('F Y',$thisStamp); |
| 39 | 39 | } |
| 40 | 40 | /** |
| 41 | - * Override the nextMonth method to format the output |
|
| 42 | - */ |
|
| 41 | + * Override the nextMonth method to format the output |
|
| 42 | + */ |
|
| 43 | 43 | function nextMonth() { |
| 44 | 44 | $nextStamp = parent::nextMonth(TRUE); |
| 45 | 45 | // Build the URL for next month |
@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | * hit for extra method calls. For this example some simple functions could help |
| 7 | 7 | * format the month while the days are accessed via the normal Month object |
| 8 | 8 | */ |
| 9 | -if ( !@include 'Calendar/Calendar.php' ) { |
|
| 10 | - define('CALENDAR_ROOT','../../'); |
|
| 9 | +if (!@include 'Calendar/Calendar.php') { |
|
| 10 | + define('CALENDAR_ROOT', '../../'); |
|
| 11 | 11 | } |
| 12 | 12 | require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
| 13 | 13 | require_once CALENDAR_ROOT.'Decorator.php'; |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | function prevMonth() { |
| 27 | 27 | $prevStamp = parent::prevMonth(TRUE); |
| 28 | 28 | // Build the URL for the previous month |
| 29 | - return $_SERVER['PHP_SELF'].'?y='.date('Y',$prevStamp). |
|
| 30 | - '&m='.date('n',$prevStamp).'&d='.date('j',$prevStamp); |
|
| 29 | + return $_SERVER['PHP_SELF'].'?y='.date('Y', $prevStamp). |
|
| 30 | + '&m='.date('n', $prevStamp).'&d='.date('j', $prevStamp); |
|
| 31 | 31 | } |
| 32 | 32 | /** |
| 33 | 33 | * Override the thisMonth method to format the output |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | function thisMonth() { |
| 36 | 36 | $thisStamp = parent::thisMonth(TRUE); |
| 37 | 37 | // A human readable string from this month |
| 38 | - return date('F Y',$thisStamp); |
|
| 38 | + return date('F Y', $thisStamp); |
|
| 39 | 39 | } |
| 40 | 40 | /** |
| 41 | 41 | * Override the nextMonth method to format the output |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | function nextMonth() { |
| 44 | 44 | $nextStamp = parent::nextMonth(TRUE); |
| 45 | 45 | // Build the URL for next month |
| 46 | - return $_SERVER['PHP_SELF'].'?y='.date('Y',$nextStamp). |
|
| 47 | - '&m='.date('n',$nextStamp).'&d='.date('j',$nextStamp); |
|
| 46 | + return $_SERVER['PHP_SELF'].'?y='.date('Y', $nextStamp). |
|
| 47 | + '&m='.date('n', $nextStamp).'&d='.date('j', $nextStamp); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
| 53 | 53 | |
| 54 | 54 | // Creata a month as usual |
| 55 | -$Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
|
| 55 | +$Month = new Calendar_Month_Weekdays($_GET['y'], $_GET['m']); |
|
| 56 | 56 | |
| 57 | 57 | // Pass it to the decorator and use the decorator from now on... |
| 58 | 58 | $MonthDecorator = new MonthDecorator($Month); |
@@ -67,19 +67,19 @@ discard block |
||
| 67 | 67 | <body> |
| 68 | 68 | <h1>A Simple Decorator</h1> |
| 69 | 69 | <table> |
| 70 | -<caption><?php echo ( $MonthDecorator->thisMonth() ); ?></caption> |
|
| 70 | +<caption><?php echo ($MonthDecorator->thisMonth()); ?></caption> |
|
| 71 | 71 | <?php |
| 72 | -while ( $Day = $MonthDecorator->fetch() ) { |
|
| 73 | - if ( $Day->isFirst() ) { |
|
| 74 | - echo ( "\n<tr>\n" ); |
|
| 72 | +while ($Day = $MonthDecorator->fetch()) { |
|
| 73 | + if ($Day->isFirst()) { |
|
| 74 | + echo ("\n<tr>\n"); |
|
| 75 | 75 | } |
| 76 | - if ( $Day->isEmpty() ) { |
|
| 77 | - echo ( "<td> </td>" ); |
|
| 76 | + if ($Day->isEmpty()) { |
|
| 77 | + echo ("<td> </td>"); |
|
| 78 | 78 | } else { |
| 79 | - echo ( "<td>".$Day->thisDay()."</td>" ); |
|
| 79 | + echo ("<td>".$Day->thisDay()."</td>"); |
|
| 80 | 80 | } |
| 81 | - if ( $Day->isLast() ) { |
|
| 82 | - echo ( "\n</tr>\n" ); |
|
| 81 | + if ($Day->isLast()) { |
|
| 82 | + echo ("\n</tr>\n"); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | ?> |
@@ -48,8 +48,12 @@ |
||
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
| 52 | -if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
|
| 51 | +if (!isset($_GET['y'])) { |
|
| 52 | + $_GET['y'] = date('Y'); |
|
| 53 | +} |
|
| 54 | +if (!isset($_GET['m'])) { |
|
| 55 | + $_GET['m'] = date('n'); |
|
| 56 | +} |
|
| 53 | 57 | |
| 54 | 58 | // Creata a month as usual |
| 55 | 59 | $Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
@@ -2,15 +2,15 @@ |
||
| 2 | 2 | /** |
| 3 | 3 | * Description: simple example on i18N |
| 4 | 4 | */ |
| 5 | -if ( !@include 'Calendar/Calendar.php' ) { |
|
| 6 | - define('CALENDAR_ROOT','../../'); |
|
| 5 | +if (!@include 'Calendar/Calendar.php') { |
|
| 6 | + define('CALENDAR_ROOT', '../../'); |
|
| 7 | 7 | } |
| 8 | 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())); |
|
| 16 | 16 | ?> |
| 17 | 17 | \ No newline at end of file |
@@ -2,21 +2,21 @@ discard block |
||
| 2 | 2 | /** |
| 3 | 3 | * Description: a complete year |
| 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(); |
| 10 | 10 | |
| 11 | -if ( !@include 'Calendar/Calendar.php' ) { |
|
| 12 | - define('CALENDAR_ROOT','../../'); |
|
| 11 | +if (!@include 'Calendar/Calendar.php') { |
|
| 12 | + define('CALENDAR_ROOT', '../../'); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | require_once CALENDAR_ROOT.'Year.php'; |
| 16 | 16 | |
| 17 | -define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS); |
|
| 17 | +define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH_WEEKDAYS); |
|
| 18 | 18 | |
| 19 | -if ( !isset($_GET['year']) ) $_GET['year'] = date('Y'); |
|
| 19 | +if (!isset($_GET['year'])) $_GET['year'] = date('Y'); |
|
| 20 | 20 | |
| 21 | 21 | $Year = new Calendar_Year($_GET['year']); |
| 22 | 22 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 26 | 26 | <html> |
| 27 | 27 | <head> |
| 28 | -<title> <?php echo ( $Year->thisYear() ); ?> </title> |
|
| 28 | +<title> <?php echo ($Year->thisYear()); ?> </title> |
|
| 29 | 29 | <style type="text/css"> |
| 30 | 30 | body { |
| 31 | 31 | font-family: Georgia, serif; |
@@ -62,55 +62,55 @@ discard block |
||
| 62 | 62 | <body> |
| 63 | 63 | <table> |
| 64 | 64 | <caption class="year"> |
| 65 | -<?php echo ( $Year->thisYear() ); ?> |
|
| 65 | +<?php echo ($Year->thisYear()); ?> |
|
| 66 | 66 | <div id="next"> |
| 67 | -<a href="?year=<?php echo ( $Year->nextYear() ); ?>">>></a> |
|
| 67 | +<a href="?year=<?php echo ($Year->nextYear()); ?>">>></a> |
|
| 68 | 68 | </div> |
| 69 | 69 | <div id="prev"> |
| 70 | -<a href="?year=<?php echo ( $Year->prevYear() ); ?>"><<</a> |
|
| 70 | +<a href="?year=<?php echo ($Year->prevYear()); ?>"><<</a> |
|
| 71 | 71 | </div> |
| 72 | 72 | </caption> |
| 73 | 73 | <?php |
| 74 | 74 | $i = 0; |
| 75 | -while ( $Month = $Year->fetch() ) { |
|
| 75 | +while ($Month = $Year->fetch()) { |
|
| 76 | 76 | |
| 77 | - switch ( $i ) { |
|
| 77 | + switch ($i) { |
|
| 78 | 78 | case 0: |
| 79 | - echo ( "<tr>\n" ); |
|
| 79 | + echo ("<tr>\n"); |
|
| 80 | 80 | break; |
| 81 | 81 | case 3: |
| 82 | 82 | case 6: |
| 83 | 83 | case 9: |
| 84 | - echo ( "</tr>\n<tr>\n" ); |
|
| 84 | + echo ("</tr>\n<tr>\n"); |
|
| 85 | 85 | break; |
| 86 | 86 | case 12: |
| 87 | - echo ( "</tr>\n" ); |
|
| 87 | + echo ("</tr>\n"); |
|
| 88 | 88 | break; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - echo ( "<td>\n<table class=\"month\">\n" ); |
|
| 92 | - echo ( "<caption class=\"month\">".date('F',$Month->thisMonth(TRUE))."</caption>" ); |
|
| 93 | - echo ( "<tr>\n<th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th>\n</tr>" ); |
|
| 91 | + echo ("<td>\n<table class=\"month\">\n"); |
|
| 92 | + echo ("<caption class=\"month\">".date('F', $Month->thisMonth(TRUE))."</caption>"); |
|
| 93 | + echo ("<tr>\n<th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th>\n</tr>"); |
|
| 94 | 94 | $Month->build(); |
| 95 | - while ( $Day = $Month->fetch() ) { |
|
| 96 | - if ( $Day->isFirst() ) { |
|
| 97 | - echo ( "<tr>\n" ); |
|
| 95 | + while ($Day = $Month->fetch()) { |
|
| 96 | + if ($Day->isFirst()) { |
|
| 97 | + echo ("<tr>\n"); |
|
| 98 | 98 | } |
| 99 | - if ( $Day->isEmpty() ) { |
|
| 100 | - echo ( "<td> </td>\n" ); |
|
| 99 | + if ($Day->isEmpty()) { |
|
| 100 | + echo ("<td> </td>\n"); |
|
| 101 | 101 | } else { |
| 102 | - echo ( "<td>".$Day->thisDay()."</td>\n" ); |
|
| 102 | + echo ("<td>".$Day->thisDay()."</td>\n"); |
|
| 103 | 103 | } |
| 104 | - if ( $Day->isLast() ) { |
|
| 105 | - echo ( "</tr>\n" ); |
|
| 104 | + if ($Day->isLast()) { |
|
| 105 | + echo ("</tr>\n"); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | - echo ( "</table>\n</td>\n" ); |
|
| 108 | + echo ("</table>\n</td>\n"); |
|
| 109 | 109 | |
| 110 | 110 | $i++; |
| 111 | 111 | } |
| 112 | 112 | ?> |
| 113 | 113 | </table> |
| 114 | -<p>Took: <?php echo ((getmicrotime()-$start)); ?></p> |
|
| 114 | +<p>Took: <?php echo ((getmicrotime() - $start)); ?></p> |
|
| 115 | 115 | </body> |
| 116 | 116 | </html> |
| 117 | 117 | \ No newline at end of file |
@@ -16,7 +16,9 @@ |
||
| 16 | 16 | |
| 17 | 17 | define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS); |
| 18 | 18 | |
| 19 | -if ( !isset($_GET['year']) ) $_GET['year'] = date('Y'); |
|
| 19 | +if ( !isset($_GET['year']) ) { |
|
| 20 | + $_GET['year'] = date('Y'); |
|
| 21 | +} |
|
| 20 | 22 | |
| 21 | 23 | $Year = new Calendar_Year($_GET['year']); |
| 22 | 24 | |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | echo "<tr>\n"; |
| 112 | 112 | |
| 113 | 113 | if ($day->isSelected()) { |
| 114 | - echo '<td class="selected">'.$day->thisDay().'</td>'."\n"; |
|
| 114 | + echo '<td class="selected">'.$day->thisDay().'</td>'."\n"; |
|
| 115 | 115 | } else if ($day->isEmpty()) { |
| 116 | 116 | echo '<td> </td>'."\n"; |
| 117 | 117 | } else { |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | * Description: same as 3.php, but using the PEAR::Date engine |
| 4 | 4 | * Note: make sure PEAR::Date is a stable release!!! |
| 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(); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | define('CALENDAR_ENGINE', 'PearDate'); |
| 14 | 14 | |
| 15 | 15 | if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') { |
| 16 | - define('CALENDAR_ROOT','../../'); |
|
| 16 | + define('CALENDAR_ROOT', '../../'); |
|
| 17 | 17 | } |
| 18 | 18 | require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
| 19 | 19 | require_once CALENDAR_ROOT.'Day.php'; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | // Create an array of days which are "selected" |
| 30 | 30 | // Used for Week::build() below |
| 31 | -$selectedDays = array ( |
|
| 31 | +$selectedDays = array( |
|
| 32 | 32 | new Calendar_Day($_GET['y'], $_GET['m'], $_GET['d']), |
| 33 | 33 | new Calendar_Day($_GET['y'], 12, 25), |
| 34 | 34 | ); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | </tr> |
| 136 | 136 | </table> |
| 137 | 137 | <?php |
| 138 | -echo '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>'; |
|
| 138 | +echo '<p><b>Took: '.(getmicrotime() - $start).' seconds</b></p>'; |
|
| 139 | 139 | ?> |
| 140 | 140 | </body> |
| 141 | 141 | </html> |
| 142 | 142 | \ No newline at end of file |
@@ -19,9 +19,15 @@ discard block |
||
| 19 | 19 | require_once CALENDAR_ROOT.'Day.php'; |
| 20 | 20 | |
| 21 | 21 | // Initialize GET variables if not set |
| 22 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
| 23 | -if (!isset($_GET['m'])) $_GET['m'] = date('m'); |
|
| 24 | -if (!isset($_GET['d'])) $_GET['d'] = date('d'); |
|
| 22 | +if (!isset($_GET['y'])) { |
|
| 23 | + $_GET['y'] = date('Y'); |
|
| 24 | +} |
|
| 25 | +if (!isset($_GET['m'])) { |
|
| 26 | + $_GET['m'] = date('m'); |
|
| 27 | +} |
|
| 28 | +if (!isset($_GET['d'])) { |
|
| 29 | + $_GET['d'] = date('d'); |
|
| 30 | +} |
|
| 25 | 31 | |
| 26 | 32 | // Build the month |
| 27 | 33 | $month = new Calendar_Month_Weekdays($_GET['y'], $_GET['m']); |
@@ -107,8 +113,9 @@ discard block |
||
| 107 | 113 | '&d='.$day->thisDay(); |
| 108 | 114 | |
| 109 | 115 | // isFirst() to find start of week |
| 110 | - if ($day->isFirst()) |
|
| 111 | - echo "<tr>\n"; |
|
| 116 | + if ($day->isFirst()) { |
|
| 117 | + echo "<tr>\n"; |
|
| 118 | + } |
|
| 112 | 119 | |
| 113 | 120 | if ($day->isSelected()) { |
| 114 | 121 | echo '<td class="selected">'.$day->thisDay().'</td>'."\n"; |
@@ -4,14 +4,14 @@ discard block |
||
| 4 | 4 | * Note this is done the stupid way - a giant if/else for WML or HTML |
| 5 | 5 | * could be greatly simplified with some HTML/WML rendering classes... |
| 6 | 6 | */ |
| 7 | -function getmicrotime(){ |
|
| 8 | - list($usec, $sec) = explode(" ",microtime()); |
|
| 7 | +function getmicrotime() { |
|
| 8 | + list($usec, $sec) = explode(" ", microtime()); |
|
| 9 | 9 | return ((float)$usec + (float)$sec); |
| 10 | 10 | } |
| 11 | 11 | $start = getmicrotime(); |
| 12 | 12 | |
| 13 | -if ( !@include 'Calendar/Calendar.php' ) { |
|
| 14 | - define('CALENDAR_ROOT','../../'); |
|
| 13 | +if (!@include 'Calendar/Calendar.php') { |
|
| 14 | + define('CALENDAR_ROOT', '../../'); |
|
| 15 | 15 | } |
| 16 | 16 | require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
| 17 | 17 | require_once CALENDAR_ROOT.'Day.php'; |
@@ -20,68 +20,68 @@ discard block |
||
| 20 | 20 | if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
| 21 | 21 | if (!isset($_GET['d'])) $_GET['d'] = date('j'); |
| 22 | 22 | |
| 23 | -$Month = & new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
|
| 24 | -$Day = & new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']); |
|
| 23 | +$Month = & new Calendar_Month_Weekdays($_GET['y'], $_GET['m']); |
|
| 24 | +$Day = & new Calendar_Day($_GET['y'], $_GET['m'], $_GET['d']); |
|
| 25 | 25 | $selection = array($Day); |
| 26 | 26 | |
| 27 | 27 | #-----------------------------------------------------------------------------# |
| 28 | -if ( isset($_GET['mime']) && $_GET['mime']=='wml' ) { |
|
| 29 | - header ('Content-Type: text/vnd.wap.wml'); |
|
| 30 | - echo ( '<?xml version="1.0"?>' ); |
|
| 28 | +if (isset($_GET['mime']) && $_GET['mime'] == 'wml') { |
|
| 29 | + header('Content-Type: text/vnd.wap.wml'); |
|
| 30 | + echo ('<?xml version="1.0"?>'); |
|
| 31 | 31 | ?> |
| 32 | 32 | <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> |
| 33 | 33 | <wml> |
| 34 | 34 | <big><strong>Personal Planner Rendered with WML</strong></big> |
| 35 | 35 | <?php |
| 36 | -if ( isset($_GET['viewday']) ) { |
|
| 36 | +if (isset($_GET['viewday'])) { |
|
| 37 | 37 | ?> |
| 38 | -<p><strong>Viewing <?php echo ( date('l, jS of F, Y',$Day->getTimeStamp()) ); ?></strong></p> |
|
| 38 | +<p><strong>Viewing <?php echo (date('l, jS of F, Y', $Day->getTimeStamp())); ?></strong></p> |
|
| 39 | 39 | <p> |
| 40 | 40 | <anchor> |
| 41 | 41 | Back to Month View |
| 42 | 42 | <go href="<?php |
| 43 | -echo ( "?y=".$Day->thisYear()."&m=". |
|
| 44 | - $Day->thisMonth()."&d=".$Day->thisDay()."&mime=wml" ); |
|
| 43 | +echo ("?y=".$Day->thisYear()."&m=". |
|
| 44 | + $Day->thisMonth()."&d=".$Day->thisDay()."&mime=wml"); |
|
| 45 | 45 | ?>"/> |
| 46 | 46 | </anchor> |
| 47 | 47 | </p> |
| 48 | 48 | <table> |
| 49 | 49 | <?php |
| 50 | 50 | $Day->build(); |
| 51 | - while ( $Hour = & $Day->fetch() ) { |
|
| 52 | - echo ( "<tr>\n" ); |
|
| 53 | - echo ( "<td>".date('g a',$Hour->getTimeStamp())."</td><td>Free time!</td>\n" ); |
|
| 54 | - echo ( "</tr>\n" ); |
|
| 51 | + while ($Hour = & $Day->fetch()) { |
|
| 52 | + echo ("<tr>\n"); |
|
| 53 | + echo ("<td>".date('g a', $Hour->getTimeStamp())."</td><td>Free time!</td>\n"); |
|
| 54 | + echo ("</tr>\n"); |
|
| 55 | 55 | } |
| 56 | 56 | ?> |
| 57 | 57 | </table> |
| 58 | 58 | <?php |
| 59 | 59 | } else { |
| 60 | 60 | ?> |
| 61 | -<p><strong><?php echo ( date('F Y',$Month->getTimeStamp()) ); ?></strong></p> |
|
| 61 | +<p><strong><?php echo (date('F Y', $Month->getTimeStamp())); ?></strong></p> |
|
| 62 | 62 | <table> |
| 63 | 63 | <tr> |
| 64 | 64 | <td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td><td>S</td> |
| 65 | 65 | </tr> |
| 66 | 66 | <?php |
| 67 | 67 | $Month->build($selection); |
| 68 | -while ( $Day = $Month->fetch() ) { |
|
| 69 | - if ( $Day->isFirst() ) { |
|
| 70 | - echo ( "<tr>\n" ); |
|
| 68 | +while ($Day = $Month->fetch()) { |
|
| 69 | + if ($Day->isFirst()) { |
|
| 70 | + echo ("<tr>\n"); |
|
| 71 | 71 | } |
| 72 | - if ( $Day->isEmpty() ) { |
|
| 73 | - echo ( "<td></td>\n" ); |
|
| 74 | - } else if ( $Day->isSelected() ) { |
|
| 75 | - echo ( "<td><anchor><strong><u>".$Day->thisDay()."</u></strong>\n<go href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=". |
|
| 72 | + if ($Day->isEmpty()) { |
|
| 73 | + echo ("<td></td>\n"); |
|
| 74 | + } else if ($Day->isSelected()) { |
|
| 75 | + echo ("<td><anchor><strong><u>".$Day->thisDay()."</u></strong>\n<go href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=". |
|
| 76 | 76 | $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). |
| 77 | - "&mime=wml\" />\n</anchor></td>\n" ); |
|
| 77 | + "&mime=wml\" />\n</anchor></td>\n"); |
|
| 78 | 78 | } else { |
| 79 | - echo ( "<td><anchor>".$Day->thisDay()."\n<go href=\"?viewday=true&y=". |
|
| 79 | + echo ("<td><anchor>".$Day->thisDay()."\n<go href=\"?viewday=true&y=". |
|
| 80 | 80 | $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). |
| 81 | - "&mime=wml\" /></anchor></td>\n" ); |
|
| 81 | + "&mime=wml\" /></anchor></td>\n"); |
|
| 82 | 82 | } |
| 83 | - if ( $Day->isLast() ) { |
|
| 84 | - echo ( "</tr>\n" ); |
|
| 83 | + if ($Day->isLast()) { |
|
| 84 | + echo ("</tr>\n"); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | ?> |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | <anchor> |
| 91 | 91 | << |
| 92 | 92 | <go href="<?php |
| 93 | -echo ( "?y=".$Month->thisYear()."&m=". |
|
| 94 | - $Month->prevMonth()."&d=".$Month->thisDay()."&mime=wml" ); |
|
| 93 | +echo ("?y=".$Month->thisYear()."&m=". |
|
| 94 | + $Month->prevMonth()."&d=".$Month->thisDay()."&mime=wml"); |
|
| 95 | 95 | ?>"/> |
| 96 | 96 | </anchor> |
| 97 | 97 | </td> |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | <anchor> |
| 101 | 101 | >> |
| 102 | 102 | <go href="<?php |
| 103 | -echo ( "?y=".$Month->thisYear()."&m=". |
|
| 104 | - $Month->nextMonth()."&d=".$Month->thisDay()."&mime=wml" ); |
|
| 103 | +echo ("?y=".$Month->thisYear()."&m=". |
|
| 104 | + $Month->nextMonth()."&d=".$Month->thisDay()."&mime=wml"); |
|
| 105 | 105 | ?>"/> |
| 106 | 106 | </anchor> |
| 107 | 107 | </td> |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | <?php |
| 112 | 112 | } |
| 113 | 113 | ?> |
| 114 | -<p><a href="<?php echo ( $_SERVER['PHP_SELF'] ); ?>">Back to HTML</a></p> |
|
| 115 | -<?php echo ( '<p>Took: '.(getmicrotime()-$start).' seconds</p>' ); ?> |
|
| 114 | +<p><a href="<?php echo ($_SERVER['PHP_SELF']); ?>">Back to HTML</a></p> |
|
| 115 | +<?php echo ('<p>Took: '.(getmicrotime() - $start).' seconds</p>'); ?> |
|
| 116 | 116 | </wml> |
| 117 | 117 | <?php |
| 118 | 118 | #-----------------------------------------------------------------------------# |
@@ -125,73 +125,73 @@ discard block |
||
| 125 | 125 | </head> |
| 126 | 126 | <body> |
| 127 | 127 | <h1>Personal Planner Rendered with HTML</h1> |
| 128 | -<p>To view in WML, click <a href="<?php echo ( $_SERVER['PHP_SELF'] ); ?>?mime=wml">here</a> or place a ?mime=wml at the end of any URL. |
|
| 128 | +<p>To view in WML, click <a href="<?php echo ($_SERVER['PHP_SELF']); ?>?mime=wml">here</a> or place a ?mime=wml at the end of any URL. |
|
| 129 | 129 | Note that <a href="http://www.opera.com/download">Opera</a> supports WML natively and Mozilla / Firefox has the WMLBrowser |
| 130 | 130 | plugin: <a href="http://wmlbrowser.mozdev.org">wmlbrowser.mozdev.org</a></p> |
| 131 | 131 | <?php |
| 132 | -if ( isset($_GET['viewday']) ) { |
|
| 132 | +if (isset($_GET['viewday'])) { |
|
| 133 | 133 | ?> |
| 134 | -<p><strong>Viewing <?php echo ( date('l, jS of F, Y',$Day->getTimeStamp()) ); ?></strong></p> |
|
| 134 | +<p><strong>Viewing <?php echo (date('l, jS of F, Y', $Day->getTimeStamp())); ?></strong></p> |
|
| 135 | 135 | <p> |
| 136 | 136 | <anchor> |
| 137 | 137 | <a href="<?php |
| 138 | -echo ( "?y=".$Day->thisYear()."&m=". |
|
| 138 | +echo ("?y=".$Day->thisYear()."&m=". |
|
| 139 | 139 | $Day->thisMonth()."&d=".$Day->thisDay()); |
| 140 | 140 | ?>">Back to Month View</a> |
| 141 | 141 | </p> |
| 142 | 142 | <table> |
| 143 | 143 | <?php |
| 144 | 144 | $Day->build(); |
| 145 | - while ( $Hour = & $Day->fetch() ) { |
|
| 146 | - echo ( "<tr>\n" ); |
|
| 147 | - echo ( "<td>".date('g a',$Hour->getTimeStamp())."</td><td>Free time!</td>\n" ); |
|
| 148 | - echo ( "</tr>\n" ); |
|
| 145 | + while ($Hour = & $Day->fetch()) { |
|
| 146 | + echo ("<tr>\n"); |
|
| 147 | + echo ("<td>".date('g a', $Hour->getTimeStamp())."</td><td>Free time!</td>\n"); |
|
| 148 | + echo ("</tr>\n"); |
|
| 149 | 149 | } |
| 150 | 150 | ?> |
| 151 | 151 | </table> |
| 152 | 152 | <?php |
| 153 | 153 | } else { |
| 154 | 154 | ?> |
| 155 | -<p><strong><?php echo ( date('F Y',$Month->getTimeStamp()) ); ?></strong></p> |
|
| 155 | +<p><strong><?php echo (date('F Y', $Month->getTimeStamp())); ?></strong></p> |
|
| 156 | 156 | <table> |
| 157 | 157 | <tr> |
| 158 | 158 | <td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td><td>S</td> |
| 159 | 159 | </tr> |
| 160 | 160 | <?php |
| 161 | 161 | $Month->build($selection); |
| 162 | -while ( $Day = $Month->fetch() ) { |
|
| 163 | - if ( $Day->isFirst() ) { |
|
| 164 | - echo ( "<tr>\n" ); |
|
| 162 | +while ($Day = $Month->fetch()) { |
|
| 163 | + if ($Day->isFirst()) { |
|
| 164 | + echo ("<tr>\n"); |
|
| 165 | 165 | } |
| 166 | - if ( $Day->isEmpty() ) { |
|
| 167 | - echo ( "<td></td>\n" ); |
|
| 168 | - } else if ( $Day->isSelected() ) { |
|
| 169 | - echo ( "<td><a href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=". |
|
| 166 | + if ($Day->isEmpty()) { |
|
| 167 | + echo ("<td></td>\n"); |
|
| 168 | + } else if ($Day->isSelected()) { |
|
| 169 | + echo ("<td><a href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=". |
|
| 170 | 170 | $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). |
| 171 | - "&wml\"><strong><u>".$Day->thisDay()."</u></strong></a></td>\n" ); |
|
| 171 | + "&wml\"><strong><u>".$Day->thisDay()."</u></strong></a></td>\n"); |
|
| 172 | 172 | } else { |
| 173 | - echo ( "<td><a href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=". |
|
| 173 | + echo ("<td><a href=\"".$_SERVER['PHP_SELF']."?viewday=true&y=". |
|
| 174 | 174 | $Day->thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). |
| 175 | - "\">".$Day->thisDay()."</a></td>\n" ); |
|
| 175 | + "\">".$Day->thisDay()."</a></td>\n"); |
|
| 176 | 176 | } |
| 177 | - if ( $Day->isLast() ) { |
|
| 178 | - echo ( "</tr>\n" ); |
|
| 177 | + if ($Day->isLast()) { |
|
| 178 | + echo ("</tr>\n"); |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | ?> |
| 182 | 182 | <tr> |
| 183 | 183 | <td> |
| 184 | 184 | <a href="<?php |
| 185 | -echo ( "?y=".$Month->thisYear()."&m=". |
|
| 186 | - $Month->prevMonth()."&d=".$Month->thisDay() ); |
|
| 185 | +echo ("?y=".$Month->thisYear()."&m=". |
|
| 186 | + $Month->prevMonth()."&d=".$Month->thisDay()); |
|
| 187 | 187 | ?>"> |
| 188 | 188 | <<</a> |
| 189 | 189 | </td> |
| 190 | 190 | <td></td><td></td><td></td><td></td><td></td> |
| 191 | 191 | <td> |
| 192 | 192 | <a href="<?php |
| 193 | -echo ( "?y=".$Month->thisYear()."&m=". |
|
| 194 | - $Month->nextMonth()."&d=".$Month->thisDay() ); |
|
| 193 | +echo ("?y=".$Month->thisYear()."&m=". |
|
| 194 | + $Month->nextMonth()."&d=".$Month->thisDay()); |
|
| 195 | 195 | ?>">>></a> |
| 196 | 196 | </td> |
| 197 | 197 | </tr> |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | ?> |
| 203 | 203 | |
| 204 | 204 | |
| 205 | -<?php echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); ?> |
|
| 205 | +<?php echo ('<p><b>Took: '.(getmicrotime() - $start).' seconds</b></p>'); ?> |
|
| 206 | 206 | </body> |
| 207 | 207 | </html> |
| 208 | 208 | <?php |
@@ -16,9 +16,15 @@ |
||
| 16 | 16 | require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
| 17 | 17 | require_once CALENDAR_ROOT.'Day.php'; |
| 18 | 18 | |
| 19 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
| 20 | -if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
|
| 21 | -if (!isset($_GET['d'])) $_GET['d'] = date('j'); |
|
| 19 | +if (!isset($_GET['y'])) { |
|
| 20 | + $_GET['y'] = date('Y'); |
|
| 21 | +} |
|
| 22 | +if (!isset($_GET['m'])) { |
|
| 23 | + $_GET['m'] = date('n'); |
|
| 24 | +} |
|
| 25 | +if (!isset($_GET['d'])) { |
|
| 26 | + $_GET['d'] = date('j'); |
|
| 27 | +} |
|
| 22 | 28 | |
| 23 | 29 | $Month = & new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
| 24 | 30 | $Day = & new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']); |
@@ -5,13 +5,13 @@ discard block |
||
| 5 | 5 | * working correctly |
| 6 | 6 | * |
| 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 | -if ( !@include 'Calendar/Calendar.php' ) { |
|
| 14 | - define('CALENDAR_ROOT','../../'); |
|
| 13 | +if (!@include 'Calendar/Calendar.php') { |
|
| 14 | + define('CALENDAR_ROOT', '../../'); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | if (!isset($_GET['y'])) $_GET['y'] = 2003; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | if (!isset($_GET['i'])) $_GET['i'] = 34; |
| 22 | 22 | if (!isset($_GET['s'])) $_GET['s'] = 46; |
| 23 | 23 | |
| 24 | -switch ( @$_GET['view'] ) { |
|
| 24 | +switch (@$_GET['view']) { |
|
| 25 | 25 | default: |
| 26 | 26 | $_GET['view'] = 'calendar_year'; |
| 27 | 27 | case 'calendar_year': |
@@ -30,63 +30,63 @@ discard block |
||
| 30 | 30 | break; |
| 31 | 31 | case 'calendar_month': |
| 32 | 32 | require_once CALENDAR_ROOT.'Month.php'; |
| 33 | - $c = new Calendar_Month($_GET['y'],$_GET['m']); |
|
| 33 | + $c = new Calendar_Month($_GET['y'], $_GET['m']); |
|
| 34 | 34 | break; |
| 35 | 35 | case 'calendar_day': |
| 36 | 36 | require_once CALENDAR_ROOT.'Day.php'; |
| 37 | - $c = new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']); |
|
| 37 | + $c = new Calendar_Day($_GET['y'], $_GET['m'], $_GET['d']); |
|
| 38 | 38 | break; |
| 39 | 39 | case 'calendar_hour': |
| 40 | 40 | require_once CALENDAR_ROOT.'Hour.php'; |
| 41 | - $c = new Calendar_Hour($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h']); |
|
| 41 | + $c = new Calendar_Hour($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h']); |
|
| 42 | 42 | break; |
| 43 | 43 | case 'calendar_minute': |
| 44 | 44 | require_once CALENDAR_ROOT.'Minute.php'; |
| 45 | - $c = new Calendar_Minute($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i']); |
|
| 45 | + $c = new Calendar_Minute($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i']); |
|
| 46 | 46 | break; |
| 47 | 47 | case 'calendar_second': |
| 48 | 48 | require_once CALENDAR_ROOT.'Second.php'; |
| 49 | - $c = new Calendar_Second($_GET['y'],$_GET['m'],$_GET['d'],$_GET['h'],$_GET['i'],$_GET['s']); |
|
| 49 | + $c = new Calendar_Second($_GET['y'], $_GET['m'], $_GET['d'], $_GET['h'], $_GET['i'], $_GET['s']); |
|
| 50 | 50 | break; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -echo ( 'Viewing: '.@$_GET['view'].'<br />' ); |
|
| 54 | -echo ( 'The time is now: '.date('Y M d H:i:s',$c->getTimestamp()).'<br >' ); |
|
| 53 | +echo ('Viewing: '.@$_GET['view'].'<br />'); |
|
| 54 | +echo ('The time is now: '.date('Y M d H:i:s', $c->getTimestamp()).'<br >'); |
|
| 55 | 55 | |
| 56 | 56 | $i = 1; |
| 57 | -echo ( '<h1>First Iteration</h1>' ); |
|
| 58 | -echo ( '<p>The first iteration is more "expensive", the calendar data |
|
| 57 | +echo ('<h1>First Iteration</h1>'); |
|
| 58 | +echo ('<p>The first iteration is more "expensive", the calendar data |
|
| 59 | 59 | structures having to be built.</p>' ); |
| 60 | 60 | $start = getmicrotime(); |
| 61 | 61 | $c->build(); |
| 62 | -while ( $e = $c->fetch() ) { |
|
| 62 | +while ($e = $c->fetch()) { |
|
| 63 | 63 | $class = strtolower(get_class($e)); |
| 64 | - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
| 64 | + $link = "&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
| 65 | 65 | "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); |
| 66 | - $method = 'this'.str_replace('calendar_','',$class); |
|
| 67 | - echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " ); |
|
| 68 | - if ( ($i % 10) == 0 ) { |
|
| 69 | - echo ( '<br>' ); |
|
| 66 | + $method = 'this'.str_replace('calendar_', '', $class); |
|
| 67 | + echo ("<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : "); |
|
| 68 | + if (($i % 10) == 0) { |
|
| 69 | + echo ('<br>'); |
|
| 70 | 70 | } |
| 71 | 71 | $i++; |
| 72 | 72 | } |
| 73 | -echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); |
|
| 73 | +echo ('<p><b>Took: '.(getmicrotime() - $start).' seconds</b></p>'); |
|
| 74 | 74 | |
| 75 | 75 | $i = 1; |
| 76 | -echo ( '<h1>Second Iteration</h1>' ); |
|
| 77 | -echo ( '<p>This second iteration is faster, the data structures |
|
| 76 | +echo ('<h1>Second Iteration</h1>'); |
|
| 77 | +echo ('<p>This second iteration is faster, the data structures |
|
| 78 | 78 | being re-used</p>' ); |
| 79 | 79 | $start = getmicrotime(); |
| 80 | -while ( $e = $c->fetch() ) { |
|
| 80 | +while ($e = $c->fetch()) { |
|
| 81 | 81 | $class = strtolower(get_class($e)); |
| 82 | - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
| 82 | + $link = "&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). |
|
| 83 | 83 | "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); |
| 84 | - $method = 'this'.str_replace('calendar_','',$class); |
|
| 85 | - echo ( "<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : " ); |
|
| 86 | - if ( ($i % 10) == 0 ) { |
|
| 87 | - echo ( '<br>' ); |
|
| 84 | + $method = 'this'.str_replace('calendar_', '', $class); |
|
| 85 | + echo ("<a href=\"".$_SERVER['PHP_SELF']."?view=".$class.$link."\">".$e->{$method}()."</a> : "); |
|
| 86 | + if (($i % 10) == 0) { |
|
| 87 | + echo ('<br>'); |
|
| 88 | 88 | } |
| 89 | 89 | $i++; |
| 90 | 90 | } |
| 91 | -echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); |
|
| 91 | +echo ('<p><b>Took: '.(getmicrotime() - $start).' seconds</b></p>'); |
|
| 92 | 92 | ?> |
| 93 | 93 | \ 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: |