Changeset 527360
- Timestamp:
- 04/04/2012 03:06:55 PM (14 years ago)
- Location:
- sunrise-sunset/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (4 diffs)
-
sunrisesunset.php (modified) (5 diffs)
-
utils.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sunrise-sunset/trunk/readme.txt
r527331 r527360 4 4 Requires at least: 3.0 5 5 Tested up to: 3.3.1 6 Stable tag: 1.1. 36 Stable tag: 1.1.4 7 7 License: GPLv2 8 8 … … 13 13 Displays sunrise and sunset times for the capital cities of the America (including miscellaneous cities). 14 14 Times displayed are local time. 15 16 You can also set the sunrise/sunset times for only Friday. 15 17 16 18 IF YOU ARE UPGRADING please change the settings of the widget in the dashboard right after upgrading. … … 46 48 I will try to accommodate you ASAP. 47 49 50 = Why is there an options to limit the sunrise/sunset display to only Friday? = 51 These times are important for certain religious denomination. 52 53 48 54 = What updates are planned for this widget? = 49 55 Here are some: … … 65 71 66 72 == Changelog == 67 = 1.1.3 = 68 * Updated README and screenshot. 73 = 1.1.4 = 74 * Added "Friday" feature. 75 * Added Timezone in Display. 69 76 70 77 = 1.1.2 = -
sunrise-sunset/trunk/sunrisesunset.php
r527331 r527360 4 4 Plugin URI: http://wordpress.org/extend/plugins/sunrise-sunset/ 5 5 Description: Displays Sunrise and Sunset Times 6 Version: 1.1. 36 Version: 1.1.4 7 7 Author: Rex Posadas ([email protected]) 8 8 Author URI: http://www.rxnfx.com/ss-plugin … … 59 59 $showsunset = strip_tags($instance['showsunset']); 60 60 $showsunrise = strip_tags($instance['showsunrise']); 61 $friday = strip_tags($instance['showfriday']); 61 62 62 63 ?> … … 85 86 $field_sunset = $this->get_field_name('showsunset'); 86 87 $field_sunrise = $this->get_field_name('showsunrise'); 88 $field_friday = $this->get_field_name('showfriday'); 87 89 88 $showsunset_checkbox; 89 $showsunrise_checkbox; 90 $sunset_checkbox; 91 $sunrise_checkbox; 92 $friday_checkbox; 90 93 91 94 if ($instance['showsunset']) { 92 $s howsunset_checkbox = sprintf('<input type="checkbox" name="%s" value="%s" checked/> Display Sunset Time', $field_sunset, $field_sunset);95 $sunset_checkbox = sprintf('<input type="checkbox" name="%s" value="%s" checked/> Display Sunset Time', $field_sunset, $field_sunset); 93 96 } else { 94 $s howsunset_checkbox = sprintf('<input type="checkbox" name="%s" value="%s"/> Display Sunset Time', $field_sunset, $field_sunset);97 $sunset_checkbox = sprintf('<input type="checkbox" name="%s" value="%s"/> Display Sunset Time', $field_sunset, $field_sunset); 95 98 } 96 99 97 100 if ($instance['showsunrise']) { 98 $s howsunrise_checkbox = sprintf('<input type="checkbox" name="%s" value="%s" checked/> Display Sunrise Time', $field_sunrise, $field_sunrise);101 $sunrise_checkbox = sprintf('<input type="checkbox" name="%s" value="%s" checked/> Display Sunrise Time', $field_sunrise, $field_sunrise); 99 102 } else { 100 $s howsunrise_checkbox = sprintf('<input type="checkbox" name="%s" value="%s"/> Display Sunrise Time', $field_sunrise, $field_sunrise);103 $sunrise_checkbox = sprintf('<input type="checkbox" name="%s" value="%s"/> Display Sunrise Time', $field_sunrise, $field_sunrise); 101 104 } 102 105 103 echo "<br/>" . $showsunset_checkbox; 104 echo "<br/>" . $showsunrise_checkbox; 106 if ($instance['showfriday']) { 107 $friday_checkbox = sprintf('<input type="checkbox" name="%s" value="%s" checked/> Display only Friday', $field_friday, $field_friday); 108 } else { 109 $friday_checkbox = sprintf('<input type="checkbox" name="%s" value="%s"/> Display only Friday', $field_friday, $field_friday); 110 } 111 112 113 echo "<br/>" . $sunrise_checkbox; 114 echo "<br/>" . $sunset_checkbox; 115 echo "<br/>" . $friday_checkbox; 105 116 106 117 ?> … … 120 131 $instance['showsunset'] = strip_tags($new_instance['showsunset']); 121 132 $instance['showsunrise'] = strip_tags($new_instance['showsunrise']); 133 $instance['showfriday'] = strip_tags($new_instance['showfriday']); 122 134 return $instance; 123 135 } 124 136 125 // display our widget 137 /** 138 * The Front end of our widget. 139 * @param $args 140 * @param $instance 141 */ 126 142 function widget($args, $instance) 127 143 { … … 137 153 } 138 154 139 $result = SSUtils::getTimes($instance, $this->_cities); 155 $showOnlyFriday = $instance['showfriday']? true: false; 156 157 158 $result = SSUtils::getTimes($instance, $this->_cities, $showOnlyFriday); 140 159 141 160 echo $today . "<br/>"; -
sunrise-sunset/trunk/utils.php
r527331 r527360 59 59 } 60 60 61 static public function getTimes($instance, $cities) 61 62 static public function getTime($onlyFriday) 63 { 64 65 if (!$onlyFriday) return time(); 66 67 68 $currentDay = date('N', time()); 69 70 //1 (for Monday) through 7 (for Sunday) 71 $aDay = 24 * 60 * 60; 72 73 $newTime = time(); 74 switch (intval($currentDay)) { 75 case 1: // Monday 76 $newTime = time() + (4 * $aDay); 77 break; 78 case 2: // Tuesday 79 $newTime = time() + (3 * $aDay); 80 break; 81 case 3: // Wednesday 82 $newTime = time() + (2 * $aDay); 83 break; 84 case 4: // Thursday 85 $newTime = time() + (1 * $aDay); 86 break; 87 case 6: // Saturday 88 $newTime = time() + (6 * $aDay); 89 break; 90 case 7: // Sunday 91 $newTime = time() + (5 * $aDay); 92 break; 93 } 94 95 96 $newDay = date('N', $newTime); 97 98 return $newTime; 99 } 100 101 static public function getTimes($instance, $cities, $onlyFriday) 62 102 { 63 103 $time_format = 'h:i A'; … … 67 107 $long = $targetCity->getLongitude(); 68 108 69 $suninfo = date_sun_info(time(), $lat, $long); 109 110 $suninfo = date_sun_info(self::getTime($onlyFriday), $lat, $long); 70 111 71 112 $convertedSunriseTime = self::convertTimezone($suninfo['sunrise'], $targetCity);
Note: See TracChangeset
for help on using the changeset viewer.