__('Displays Percent', "sauron")); $control_ops = array('width' => 400, 'height' => 500); parent::__construct(false, $name = __('Sauron Percent', "sauron"), $widget_ops, $control_ops); } /* Displays the Widget in the front-end */ function widget($args, $instance) { extract($args); $title = $instance['title']; $percent_type = (isset($instance['percent_type']) ? $instance['percent_type'] : "horizontal"); $width = $instance['width']; $height = $instance['height']; $percent = $instance['percent']; $completed_color = substr($instance['completed_color'], 0, 1) == "#" ? $instance['completed_color'] : "#" . $instance['completed_color']; $to_do_color = substr($instance['to_do_color'], 0, 1) == "#" ? $instance['to_do_color'] : "#" . $instance['to_do_color']; $percent_text_color = substr($instance['percent_text_color'], 0, 1) == "#" ? $instance['percent_text_color'] : "#" . $instance['percent_text_color']; $time = $instance['time']; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $id = $this->get_field_id('title'); preg_match_all('!\d+!', $id, $matches); $match = $matches[0][0]; $rand = rand(1, 10000); // if two instances of the same widget are on the same page $widget_id = $match . '_' . $rand; ?>
> >
px
px
%
msec