PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 3.3.2
Strong Testimonials v3.3.2
3.3.2 3.3.1 trunk 1.0.1 2.30.9 2.31.10 2.32 2.32.1 2.32.2 2.32.3 2.32.4 2.33 2.34 2.35 2.36 2.37 2.38 2.38.1 2.39 2.39.1 2.39.2 2.39.3 2.40.0 2.40.1 2.40.2 2.40.3 2.40.4 2.40.5 2.40.6 2.40.7 2.41.0 2.41.1 2.50.0 2.50.1 2.50.2 2.50.3 2.50.4 2.51.0 2.51.1 2.51.2 2.51.3 2.51.4 2.51.5 2.51.6 2.51.7 2.51.8 2.51.9 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0
strong-testimonials / includes / class-strong-testimonials-view-widget.php
strong-testimonials / includes Last commit date
elementor 1 year ago logs 1 month ago strong-testimonials-beaver-block 1 year ago submodules 8 months ago class-strong-gutemberg.php 1 year ago class-strong-log.php 1 year ago class-strong-mail.php 1 year ago class-strong-testimonials-average-shortcode.php 1 year ago class-strong-testimonials-count-shortcode.php 1 year ago class-strong-testimonials-defaults.php 1 month ago class-strong-testimonials-form.php 1 month ago class-strong-testimonials-order.php 1 year ago class-strong-testimonials-privacy.php 1 year ago class-strong-testimonials-render.php 1 month ago class-strong-testimonials-templates.php 1 year ago class-strong-testimonials-view-shortcode.php 1 week ago class-strong-testimonials-view-widget.php 1 year ago class-strong-view-display.php 6 days ago class-strong-view-form.php 6 days ago class-strong-view-slideshow.php 6 days ago class-strong-view.php 6 days ago class-walker-strong-category-checklist-front.php 1 year ago deprecated.php 1 year ago filters.php 1 month ago functions-activation.php 1 month ago functions-content.php 11 months ago functions-image.php 5 months ago functions-rating.php 1 year ago functions-template-form.php 1 week ago functions-template.php 4 months ago functions-views.php 1 year ago functions.php 1 month ago l10n-polylang.php 1 year ago l10n-wpml.php 1 year ago post-types.php 1 week ago retro.php 1 year ago scripts.php 1 month ago
class-strong-testimonials-view-widget.php
151 lines
1 <?php
2 /**
3 * Strong Testimonials - View widget
4 *
5 * @since 1.21.0
6 */
7
8 class Strong_Testimonials_View_Widget extends WP_Widget {
9
10 public function __construct() {
11
12 $widget_ops = array(
13 'classname' => 'strong-testimonials-view-widget',
14 'description' => esc_html_x( 'Add one of your testimonial views.', 'widget description', 'strong-testimonials' ),
15 );
16 $control_ops = array(
17 'id_base' => 'strong-testimonials-view-widget',
18 );
19 parent::__construct(
20 'strong-testimonials-view-widget',
21 esc_html_x( 'Strong Testimonials View', 'widget label', 'strong-testimonials' ),
22 $widget_ops,
23 $control_ops
24 );
25
26 $this->defaults = array(
27 'title' => esc_html_x( 'Testimonials', 'widget title', 'strong-testimonials' ),
28 'text' => '',
29 'filter' => 0,
30 'view' => '0',
31 );
32 }
33
34 public function widget( $args, $instance ) {
35 $data = array_merge( $args, $instance );
36 $title = apply_filters( 'widget_title', empty( $data['title'] ) ? '' : $data['title'], $instance, $this->id_base );
37
38 $widget_text = ! empty( $data['text'] ) ? $data['text'] : '';
39 $text = apply_filters( 'widget_text', $widget_text, $data, $this );
40
41 echo $data['before_widget'];
42
43 if ( ! empty( $title ) ) {
44 echo $data['before_title'] . esc_html( $title ) . $data['after_title'];
45 }
46
47 if ( ! empty( $text ) ) {
48 ?>
49 <div class="textwidget"><?php echo ! empty( $data['filter'] ) ? wpautop( $text ) : $text; ?></div>
50 <?php
51 }
52
53 /**
54 * Catch undefined view to avoid error in the Customizer.
55 */
56 if ( isset( $data['view'] ) && $data['view'] ) {
57 /**
58 * Intermediate filter because `the_content` filters are not run on widget text.
59 * @since 2.11.9
60 */
61 ob_start();
62 strong_testimonials_view( $instance['view'] );
63 echo apply_filters( 'wpmtst_widget_text', ob_get_clean() );
64 }
65
66 echo $data['after_widget'];
67 }
68
69 public function form( $instance ) {
70 $instance = wp_parse_args( (array) $instance, $this->defaults );
71 $filter = isset( $instance['filter'] ) ? $instance['filter'] : 0;
72 $title = sanitize_text_field( $instance['title'] );
73 $views = wpmtst_get_views();
74 ?>
75 <div class="wpmtst-widget-form">
76 <p>
77 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
78 <?php esc_html_e( 'Title:', 'strong-testimonials' ); ?>
79 </label>
80 <input class="widefat" type="text" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
81 name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $title ); ?>">
82 </p>
83 <p>
84 <label for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php esc_html_e( 'Content:', 'strong-testimonials' ); ?></label>
85 <textarea class="widefat" rows="8" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>"><?php echo esc_textarea( $instance['text'] ); ?></textarea>
86 </p>
87 <p>
88 <input id="<?php echo esc_attr( $this->get_field_id( 'filter' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'filter' ) ); ?>" type="checkbox"<?php checked( $filter ); ?> />&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'filter' ) ); ?>"><?php esc_html_e( 'Automatically add paragraphs to above Content only', 'strong-testimonials' ); ?></label>
89 </p>
90 <p>
91 <label for="<?php echo esc_attr( $this->get_field_id( 'view' ) ); ?>">
92 <?php echo esc_html_x( 'View:', 'widget setting', 'strong-testimonials' ); ?>
93 </label>
94 <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'view' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'view' ) ); ?>" autocomplete="off">
95 <option value=""><?php esc_html_e( '&mdash; Select &mdash;', 'strong-testimonials' ); ?></option>
96 <?php
97 foreach ( $views as $view ) {
98 printf( '<option value="%s" %s>%s</option>', esc_attr( $view['id'] ), selected( absint( $view['id'] ), $instance['view'] ), esc_html( $view['name'] ) );
99 }
100 ?>
101 </select>
102 </p>
103 </div>
104 <?php
105 }
106
107 public function update( $new_instance, $old_instance ) {
108 $instance = $old_instance;
109 $instance['title'] = sanitize_text_field( $new_instance['title'] );
110 if ( current_user_can( 'unfiltered_html' ) ) {
111 $instance['text'] = $new_instance['text'];
112 } else {
113 $instance['text'] = wp_kses_post( stripslashes( $new_instance['text'] ) );
114 }
115 $instance['filter'] = ! empty( $new_instance['filter'] );
116 $instance['view'] = sanitize_text_field( $new_instance['view'] );
117 return array_merge( $this->defaults, $instance );
118 }
119 }
120
121
122 /**
123 * Load widget
124 */
125 function wpmtst_load_view_widget() {
126 register_widget( 'Strong_Testimonials_View_Widget' );
127 }
128 add_action( 'widgets_init', 'wpmtst_load_view_widget' );
129
130
131 /**
132 * Compatibility: CM Tooltip Glossary
133 *
134 * Instead of being registered, the [glossary_exclude] is handled in a late content filter
135 * which leaves the shortcode behind since we don't run that filter on widget content.
136 *
137 * @since 2.11.9
138 *
139 * @param $content
140 *
141 * @return mixed
142 */
143 function wpmtst_remove_glossary_exclude( $content ) {
144 if ( class_exists( 'CMTooltipGlossaryFrontend' ) ) {
145 $content = str_replace( array( '[glossary_exclude]', '[/glossary_exclude]' ), array( '', '' ), $content );
146 }
147
148 return $content;
149 }
150 add_filter( 'wpmtst_widget_text', 'wpmtst_remove_glossary_exclude' );
151