__('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; ?>
0%
'', 'percent_type' => 'horizontal', 'width' => '400', 'height' => '40', 'percent' => '75', 'completed_color' => '878787', 'to_do_color' => 'c8c8c8', 'percent_text_color' => '171717', 'time' => '1000' ); $instance = wp_parse_args((array)$instance, $defaults); $title = esc_attr($instance['title']); $percent_type = esc_attr($instance['percent_type']); $width = esc_attr($instance['width']); $height = esc_attr($instance['height']); $percent = esc_attr($instance['percent']); $completed_color = $instance['completed_color']; $to_do_color = $instance['to_do_color']; $percent_text_color = $instance['percent_text_color']; $time = $instance['time']; wp_enqueue_script('wp-color-picker'); wp_enqueue_style('wp-color-picker'); ?>

>     >

px

px

%

msec