PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 2.38
Strong Testimonials v2.38
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 / widget2.php
strong-testimonials / includes Last commit date
integrations 7 years ago class-strong-form.php 7 years ago class-strong-log.php 7 years ago class-strong-mail.php 7 years ago class-strong-templates.php 7 years ago class-strong-testimonials-order.php 7 years ago class-strong-testimonials-privacy.php 7 years ago class-strong-testimonials-render.php 7 years ago class-strong-testimonials-shortcode-average.php 7 years ago class-strong-testimonials-shortcode-count.php 7 years ago class-strong-testimonials-shortcode.php 7 years ago class-strong-view-display.php 7 years ago class-strong-view-form.php 7 years ago class-strong-view-slideshow.php 7 years ago class-strong-view.php 7 years ago class-walker-strong-category-checklist-front.php 7 years ago deprecated.php 7 years ago filters.php 7 years ago functions-activation.php 7 years ago functions-content.php 7 years ago functions-image.php 7 years ago functions-rating.php 7 years ago functions-template-form.php 7 years ago functions-template.php 7 years ago functions-views.php 7 years ago functions.php 7 years ago l10n-polylang.php 7 years ago l10n-wpml.php 7 years ago post-types.php 7 years ago retro.php 7 years ago scripts.php 7 years ago widget2.php 7 years ago
widget2.php
153 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 function __construct() {
11
12 $widget_ops = array(
13 'classname' => 'strong-testimonials-view-widget',
14 'description' => _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 _x( 'Strong Testimonials View', 'widget label', 'strong-testimonials' ),
22 $widget_ops,
23 $control_ops
24 );
25
26 $this->defaults = array(
27 'title' => _x( 'Testimonials', 'widget title', 'strong-testimonials' ),
28 'text' => '',
29 'filter' => 0,
30 'view' => '0',
31 );
32
33 }
34
35 function widget( $args, $instance ) {
36 $data = array_merge( $args, $instance );
37 $title = apply_filters( 'widget_title', empty( $data['title'] ) ? '' : $data['title'], $instance, $this->id_base );
38
39 $widget_text = ! empty( $data['text'] ) ? $data['text'] : '';
40 $text = apply_filters( 'widget_text', $widget_text, $data, $this );
41
42 echo $data['before_widget'];
43
44 if ( ! empty( $title ) )
45 echo $data['before_title'] . $title . $data['after_title'];
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 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 $this->get_field_id( 'title' ); ?>"
81 name="<?php echo $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 $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox"<?php checked( $filter ); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e( 'Automatically add paragraphs to above Content only', 'strong-testimonials' ); ?></label>
89 </p>
90 <p>
91 <label for="<?php echo $this->get_field_id( 'view' ); ?>">
92 <?php _ex( '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>', $view['id'], selected( $view['id'], $instance['view'] ), $view['name'] );
99 }
100 ?>
101 </select>
102 </p>
103 </div>
104 <?php
105 }
106
107 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 }
113 else {
114 $instance['text'] = wp_kses_post( stripslashes( $new_instance['text'] ) );
115 }
116 $instance['filter'] = !empty( $new_instance['filter'] );
117 $instance['view'] = sanitize_text_field( $new_instance['view'] );
118 return array_merge( $this->defaults, $instance );
119 }
120
121 }
122
123
124 /**
125 * Load widget
126 */
127 function wpmtst_load_view_widget() {
128 register_widget( 'Strong_Testimonials_View_Widget' );
129 }
130 add_action( 'widgets_init', 'wpmtst_load_view_widget' );
131
132
133 /**
134 * Compatibility: CM Tooltip Glossary
135 *
136 * Instead of being registered, the [glossary_exclude] is handled in a late content filter
137 * which leaves the shortcode behind since we don't run that filter on widget content.
138 *
139 * @since 2.11.9
140 *
141 * @param $content
142 *
143 * @return mixed
144 */
145 function wpmtst_remove_glossary_exclude( $content ) {
146 if ( class_exists( 'CMTooltipGlossaryFrontend' ) ) {
147 $content = str_replace( array( '[glossary_exclude]', '[/glossary_exclude]' ), array( '', '' ), $content );
148 }
149
150 return $content;
151 }
152 add_filter( 'wpmtst_widget_text', 'wpmtst_remove_glossary_exclude' );
153