'hebcal-shabbat', 'description' => 'displays Shabbat candle lighting 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', 'Hebcal Shabbat Times', $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'; $out = ''; include('simple_html_dom.php'); $html = new simple_html_dom(); $html->load_file('http://www.hebcal.com/shabbat/?geo=zip;zip=44122'); foreach( $html->find('.candles') as $candle) { if (preg_match("/(.*)friday(.*)/i",$candle)) { $candlestring = $candle; } } $havdalah = $html->find('.havdalah', 0); echo $before_widget; echo $before_title, $title, $after_title; if ($instance['candles']) {echo $candlestring;} if ($instance['havdalah']) {echo $havdalah;} echo "
id="get_field_id('a'); ?>" name="get_field_name('a'); ?>" />
id="get_field_id('candles'); ?>" name="get_field_name('candles'); ?>" />
id="get_field_id('havdalah'); ?>" name="get_field_name('havdalah'); ?>" />