defaults = array(
'title' => __('Calendar','dbem'),
'long_events' => 0,
'category' => 0
);
$widget_ops = array('description' => __( "Display your events in a calendar widget.", 'dbem') );
parent::WP_Widget(false, $name = __('Events Calendar','dbem'), $widget_ops);
}
/** @see WP_Widget::widget */
function widget($args, $instance) {
$instance = array_merge($this->defaults, $instance);
echo $args['before_widget'];
echo $args['before_title'];
echo $instance['title'];
echo $args['after_title'];
//Shall we show a specific month?
if ( !empty($_REQUEST['calendar_day']) ) {
$date = explode('-', $_REQUEST['calendar_day']);
$instance['month'] = $date[1];
$instance['year'] = $date[0];
}else{
$instance['month'] = date("m");
}
//Our Widget Content
echo '
';
echo EM_Calendar::output(apply_filters('em_widget_calendar_get_args',$instance));
echo '
';
echo $args['after_widget'];
}
/** @see WP_Widget::update */
function update($new_instance, $old_instance) {
//filter the new instance and replace blanks with defaults
$new_instance['title'] = ($new_instance['title'] == '') ? $this->defaults['title']:$new_instance['title'];
$new_instance['long_events'] = ($new_instance['long_events'] == '') ? $this->defaults['long_events']:$new_instance['long_events'];
$new_instance['category'] = ($new_instance['category'] == '') ? $this->defaults['category']:$new_instance['category'];
return $new_instance;
}
/** @see WP_Widget::form */
function form($instance) {
$instance = array_merge($this->defaults, $instance);
?>
/>