public static function testimonials_slider($atts, $widget_number = null)
 {
     if (is_null($atts) || !is_array($atts)) {
         $atts = array();
     }
     if (empty($widget_number)) {
         $widget_number = self::$widget_number++;
         if (!isset($atts['random'])) {
             $atts['random'] = 1;
         }
     }
     $atts = wp_parse_args($atts, self::get_defaults());
     $atts = Testimonials_Widget_Settings::validate_settings($atts);
     $atts['paging'] = false;
     $atts['type'] = 'testimonials_slider';
     self::set_instance($widget_number);
     $atts['widget_number'] = $widget_number;
     $testimonials = array();
     $content = apply_filters('tw_cache_get', false, $atts);
     if (false === $content) {
         $testimonials = self::get_testimonials($atts);
         $content = self::get_testimonials_html($testimonials, $atts, false, $widget_number);
         $content = apply_filters('tw_cache_set', $content, $atts);
     }
     self::call_scripts_styles($testimonials, $atts, $widget_number);
     return $content;
 }
 public function update($new_instance, $old_instance)
 {
     $instance = Testimonials_Widget_Settings::validate_settings($new_instance);
     return $instance;
 }
Beispiel #3
0
 public function testimonialswidget_widget($atts, $widget_number = null)
 {
     self::add_instance();
     self::scripts();
     if (empty($widget_number)) {
         $widget_number = self::$widget_number++;
         if (empty($atts['random'])) {
             $atts['random'] = 1;
         }
     }
     $atts = wp_parse_args($atts, self::get_defaults());
     $atts = Testimonials_Widget_Settings::validate_settings($atts);
     $atts['paging'] = false;
     $atts['type'] = 'testimonialswidget_widget';
     $atts['widget_number'] = $widget_number;
     $testimonials = self::get_testimonials($atts);
     $content = apply_filters('testimonials_widget_cache_get', false, $atts);
     if (false === $content) {
         $content = self::get_testimonials_html($testimonials, $atts, false, $widget_number);
         $content = apply_filters('testimonials_widget_cache_set', $content, $atts);
     }
     // Generate CSS
     $atts['type'] = 'testimonialswidget_widget_css';
     $css = apply_filters('testimonials_widget_cache_get', false, $atts);
     if (false === $css) {
         $css = self::get_testimonials_html_css($atts, $widget_number);
         $css = apply_filters('testimonials_widget_cache_set', $css, $atts);
     }
     if (!empty($css)) {
         self::$css = array_merge($css, self::$css);
         add_action('wp_footer', array(&$this, 'get_testimonials_css'), 20);
     }
     // Generate JS
     $atts['type'] = 'testimonialswidget_widget_js';
     $js = apply_filters('testimonials_widget_cache_get', false, $atts);
     if (false === $js) {
         $js = self::get_testimonials_html_js($testimonials, $atts, $widget_number);
         $js = apply_filters('testimonials_widget_cache_set', $js, $atts);
     }
     if (!empty($js)) {
         self::$scripts = array_merge($js, self::$scripts);
         add_action('wp_footer', array(&$this, 'get_testimonials_scripts'), 20);
     }
     return $content;
 }
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 validate_settings($instance)
 {
     return Testimonials_Widget_Settings::validate_settings($instance);
 }