public function get_testimonials_html($testimonials, $atts, $is_list = true, $widget_number = null) { // display attributes $hide_not_found = $atts['hide_not_found']; $paging = Testimonials_Widget_Settings::is_true($atts['paging']); $paging_before = 'before' == $atts['paging']; $paging_after = 'after' == $atts['paging']; $refresh_interval = $atts['refresh_interval']; $target = $atts['target']; $html = ''; $id = self::id; if (is_null($widget_number)) { $html .= '<div class="' . $id; if ($is_list) { $html .= ' ' . $id . '_list'; } $html .= '">'; } else { $id_base = $id . $widget_number; $html .= '<div class="' . $id . ' ' . $id_base . '">'; } if (empty($testimonials) && !$hide_not_found) { $testimonials = array(array('testimonial_content' => __('No testimonials found', 'testimonials-widget'))); } if ($paging || $paging_before) { $html .= self::get_testimonials_paging($testimonials, $atts); } $is_first = true; foreach ($testimonials as $testimonial) { $content = self::get_testimonial_html($testimonial, $atts, $is_list, $is_first, $widget_number); $content = apply_filters('testimonials_widget_testimonial_html', $content, $testimonial, $atts, $is_list, $is_first, $widget_number); $html .= $content; $is_first = false; } if ($paging || $paging_after) { $html .= self::get_testimonials_paging($testimonials, $atts, false); } $html .= '</div>'; if ($target) { $html = links_add_target($html, $target); } return $html; }
public static function get_testimonials_html($testimonials, $atts, $is_list = true, $widget_number = null) { global $tw_template_args; $tw_template_args = compact('testimonials', 'atts', 'is_list', 'widget_number'); $div_open = self::get_template_part('testimonials', 'open'); $paging = Testimonials_Widget_Settings::is_true($atts['paging']); $pre_paging = ''; if ($paging || 'before' === strtolower($atts['paging'])) { $pre_paging = self::get_testimonials_paging($atts); } if (empty($testimonials) && !$atts['hide_not_found']) { $testimonials = array(array('testimonial_content' => esc_html__('No testimonials found', 'testimonials-widget'))); self::set_not_found(true); } else { self::set_not_found(); } $is_first = true; $testimonial_content = ''; foreach ($testimonials as $testimonial) { $content = self::get_testimonial_html($testimonial, $atts, $is_list, $is_first, $widget_number); $content = apply_filters('tw_testimonial_html', $content, $testimonial, $atts, $is_list, $is_first, $widget_number); $testimonial_content .= $content; $is_first = false; } $post_paging = ''; if ($paging || 'after' === strtolower($atts['paging'])) { $post_paging = self::get_testimonials_paging($atts, false); } $div_close = self::get_template_part('testimonials', 'close'); $html = $div_open . $pre_paging . $testimonial_content . $post_paging . $div_close; $html = apply_filters('tw_get_testimonials_html', $html, $testimonials, $atts, $is_list, $widget_number, $div_open, $pre_paging, $testimonial_content, $post_paging, $div_close); return $html; }
public static function get_testimonials_html($testimonials, $atts, $is_list = true, $widget_number = null) { $hide_not_found = $atts['hide_not_found']; $paging = Testimonials_Widget_Settings::is_true($atts['paging']); $paging_before = 'before' === strtolower($atts['paging']); $paging_after = 'after' === strtolower($atts['paging']); $target = $atts['target']; $id = self::ID; if (is_null($widget_number)) { $div_open = '<div class="' . $id; if ($is_list) { $div_open .= ' listing'; } $div_open .= '">'; } else { $id_base = $id . $widget_number; $div_open = '<div class="' . $id . ' ' . $id_base . '">'; } $div_open .= "\n"; if (empty($testimonials) && !$hide_not_found) { $testimonials = array(array('testimonial_content' => esc_html__('No testimonials found', 'testimonials-widget'))); self::set_not_found(true); } else { self::set_not_found(); } $pre_paging = ''; if ($paging || $paging_before) { $pre_paging = self::get_testimonials_paging($atts); } $is_first = true; $testimonial_content = ''; foreach ($testimonials as $testimonial) { $content = self::get_testimonial_html($testimonial, $atts, $is_list, $is_first, $widget_number); if ($target) { $content = links_add_target($content, $target); } $content = apply_filters('testimonials_widget_testimonial_html', $content, $testimonial, $atts, $is_list, $is_first, $widget_number); $is_first = false; $testimonial_content .= $content; } $post_paging = ''; if ($paging || $paging_after) { $post_paging = self::get_testimonials_paging($atts, false); } $div_close = '</div>'; $div_close .= "\n"; $html = $div_open . $pre_paging . $testimonial_content . $post_paging . $div_close; $html = apply_filters('testimonials_widget_get_testimonials_html', $html, $testimonials, $atts, $is_list, $widget_number, $div_open, $pre_paging, $testimonial_content, $post_paging, $div_close); return $html; }