public static function generate_css($atts, $widget_number = null) { $atts['subtype'] = 'css'; $css = apply_filters('tw_cache_get', false, $atts); if (false === $css) { $css = self::get_testimonials_html_css($atts, $widget_number); $css = apply_filters('tw_cache_set', $css, $atts); } if (!empty($css)) { self::$css = array_merge($css, self::$css); add_action('wp_footer', array(__CLASS__, 'get_testimonials_css'), 20); } }
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; }