public function form($instance) { $defaults = Testimonials_Widget::get_defaults(); $do_number = true; if (empty($instance)) { $do_number = false; if (empty($defaults['char_limit'])) { $defaults['char_limit'] = 500; } if (empty($defaults['random'])) { $defaults['random'] = 1; } $instance = array(); } $instance = wp_parse_args($instance, $defaults); $form_parts = Testimonials_Widget_Settings::get_settings(); if ($do_number) { $number = $this->number; $std = ' .' . Testimonials_Widget::id . $number; $form_parts['css_class'] = array('section' => 'widget', 'type' => 'readonly', 'title' => __('CSS Class', 'testimonials-widget'), 'desc' => __('This widget\'s unique CSS class for styling', 'testimonials-widget'), 'std' => $std); } // remove non-widget parts unset($form_parts['paging']); unset($form_parts['debug_mode']); // fixme make reset work unset($form_parts['reset_defaults']); foreach ($form_parts as $key => $part) { $part['id'] = $key; $this->display_setting($part, $instance); } }
function tw_init_options() { $options = tw_get_options(); $options = wp_parse_args($options, Testimonials_Widget::get_defaults()); $options = Testimonials_Widget_Settings::validate_settings($options); update_option(Testimonials_Widget_Settings::ID, $options); }
public static function get_defaults() { return Testimonials_Widget::get_defaults(); }