"altos-widgets-regional-charts-widget", "description" => "Altos Regional Charts"); $control_ops = array ("width" => 300, "id_base" => "altos_widgets_regional_charts_widget"); $this->WP_Widget ($control_ops["id_base"], "Altos Regional Charts", $widget_ops, $control_ops); /**/ return; } /* Widget display function. This is where the widget actually does something. */ function widget ($args = FALSE, $instance = FALSE) { extract ($args); /**/ global $Altos_Widgets; /**/ $widget_options = (is_array ($instance) && !empty ($instance)) ? $instance : array(); /**/ if ($Altos_Widgets->is_authenticated () && is_array ($widget_options["charturls"])) { echo $before_widget . $before_title . $widget_options["title"] . $after_title; /**/ echo ($widget_options["url"]) ? '' : ''; /**/ echo ''; /**/ echo ($widget_options["url"]) ? '' : ''; /**/ echo $after_widget; } } /* Widget form control function. This is where options are made configurable. */ function form ($instance = FALSE) { global $Altos_Widgets; /**/ $widget_options = (is_array ($instance) && !empty ($instance)) ? $instance : array(); /**/ if ($Altos_Widgets->is_authenticated ()) { echo '

'; echo ''; echo '

'; /**/ echo '

'; echo ' [?]'; echo '

'; echo '', $Altos_Widgets->print_checkbox_options ($this->get_field_name ("zid"), $Altos_Widgets->get_regions_codes_array (), $widget_options["zid"]); echo '

'; echo '

'; /**/ echo '

'; echo ''; echo '

'; /**/ echo '

'; echo ''; echo '

'; /**/ echo '

'; echo ''; echo '

'; /**/ echo '

'; echo ''; echo '

'; /**/ echo '

'; echo ''; echo '

'; /**/ echo '

'; echo ''; echo '

'; /**/ echo '

'; echo ''; echo '

'; } else { $Altos_Widgets->login_form (); } } /* Widget update function. This is where an updated instance is configured/stored. */ function update ($instance = FALSE, $old = FALSE) { global $Altos_Widgets; /**/ $widget_options = stripslashes_deep ($instance); /**/ $widget_options["charturls"] = array (); /* Reset array. */ /**/ foreach ((array)$widget_options["zid"] as $zid) { $charturl = $Altos_Widgets->get_regional_chart_url ($zid, $widget_options["s"], $widget_options["sz"], $widget_options["rt"], $widget_options["ra"], $widget_options["q"], $widget_options["ts"]); /**/ if ($Altos_Widgets->has_error ($charturl)) { $Altos_Widgets->print_error_message ($charturl); return $old; /* Revert to previous options. */ } /**/ $widget_options["charturls"][] = $charturl->response->url; } /**/ return $widget_options; } } ?>