'hebcal-shabbat', 'description' => 'displays various zmanim (times) for a USA zip code or world city'); /* Widget control settings. */ $control_ops = array('width' => 200, 'height' => 200, 'id_base' => 'hebcal-shabbat-widget'); /* Create the widget. */ $this->WP_Widget('hebcal-shabbat-widget', 'AdatoSystems Zmanim', $widget_ops, $control_ops); } /** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); $ashkenazis_checked = isset($instance['a']) ? $instance['a'] : false; $ashkenazis = $ashkenazis_checked ? 'on' : 'off'; /* JSON get lat/long from zip*/ /*http://maps.googleapis.com/maps/api/geocode/json?address=44122&sensor=false */ $du = file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?address=44122&sensor=false"); $djd = json_decode(utf8_encode($du),true); $longlat = $djd['results'][0]['geometry']['location']['lat'].",".$djd['results'][0]['geometry']['location']['lng']; /* What day is Friday? $friday = ; /* Then get sunrise/sunset using Lat/Long $sunrise = date_sunrise(time(), SUNFUNCS_RET_DOUBLE, $latitude, $longitude, 96, 0); $sunset = date_sunset(time(), SUNFUNCS_RET_DOUBLE, $latitude, $longitude, 96, 0); /* Or this: $sun_info = date_sun_info(strtotime("2006-12-12"), 31.7667, 35.2333); more info: http://php.net/manual/en/function.date-sun-info.php Now start your calculations Sunset - 18min Then use the HebCal JSON for the hebrew elements (parsha hashavua, etc.) http://www.hebcal.com/hebcal/?v=1&cfg=json&nh=on&nx=on&year=now&month=x&ss=on&mf=on&c=on&zip=90210&m=72&s=on information here: http://www.hebcal.com/home/195/jewish-calendar-rest-api */ echo $before_widget; echo $before_title, $title, $after_title; echo "LongLat is ".$longlat."
"; echo $after_widget; } /** * Update the widget settings. */ function update($new_instance, $old_instance) { $instance = $old_instance; /* Strip tags for title and name to remove HTML (important for text inputs). */ $instance['title'] = strip_tags($new_instance['title']); $instance['zip'] = strip_tags($new_instance['zip']); $instance['a'] = $new_instance['a']; $instance['showparsha'] = $new_instance['showparsha']; $instance['showcandles'] = $new_instance['showcandles']; $instance['showhavdalah'] = $new_instance['showhavdalah']; $instance['m'] = $new_instance['m']; $instance['showplag'] = $new_instance['showplag']; $instance['plagmethod'] = $new_instance['plagmethod']; $instance['showsunrise'] = $new_instance['showsunrise']; $instance['showsunset'] = $new_instance['showsunset']; $instance['cmin'] = $new_instance['cmin']; $instance['ctime'] = $new_instance['ctime']; $instance['cfixed'] = $new_instance['cfixed']; return $instance; } /** * Displays the widget settings controls on the widget panel. * Make use of the get_field_id() and get_field_name() function * when creating your form elements. This handles the confusing stuff. */ function form($instance) { /* Set up some default widget settings. */ $defaults = array('zip' => '90210', 'm' => '72'); $instance = wp_parse_args((array) $instance, $defaults); ?>

id="get_field_id('showparsha'); ?>" name="get_field_name('showparsha'); ?>" />

id="get_field_id('showcandles'); ?>" name="get_field_name('showcandles'); ?>" />

Candle Lighting Time:
name="get_field_name('ctime'); ?>" value="cminutes" />Minutes before Sunset 
name="get_field_name('ctime'); ?>" value="cfixed" />Specific Time 

id="get_field_id('showhavdalah'); ?>" name="get_field_name('showhavdalah'); ?>" />

id="get_field_id('showsunrise'); ?>" name="get_field_name('showsunrise'); ?>" />

id="get_field_id('showsunset'); ?>" name="get_field_name('showsunset'); ?>" />

id="get_field_id('showplag'); ?>" name="get_field_name('showplag'); ?>" />

Calculate Plag using:
name="get_field_name('plagmethod'); ?>" value="gra">GR''A (sunrise to sunset)
name="get_field_name('plagmethod'); ?>" value="avr">Magen Avraham (daybreak to nightfall)

Show sunrise? WITH SECONDS

Show sunset? WITH SECONDS