PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 2.36
Strong Testimonials v2.36
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
154 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 $this->get_field_id( 'title' ); ?>">
78 <?php _e( 'Title:' ); ?>
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 $this->get_field_id( 'text' ); ?>"><?php _e( 'Content:' ); ?></label>
85 <textarea class="widefat" rows="8" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $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 $this->get_field_id( 'view' ); ?>"
95 name="<?php echo $this->get_field_name( 'view' ); ?>" autocomplete="off">
96 <option value=""><?php _e( '&mdash; Select &mdash;' ); ?></option>
97 <?php
98 foreach ( $views as $view ) {
99 printf( '<option value="%s" %s>%s</option>', $view['id'], selected( $view['id'], $instance['view'] ), $view['name'] );
100 }
101 ?>
102 </select>
103 </p>
104 </div>
105 <?php
106 }
107
108 function update( $new_instance, $old_instance ) {
109 $instance = $old_instance;
110 $instance['title'] = sanitize_text_field( $new_instance['title'] );
111 if ( current_user_can( 'unfiltered_html' ) ) {
112 $instance['text'] = $new_instance['text'];
113 }
114 else {
115 $instance['text'] = wp_kses_post( stripslashes( $new_instance['text'] ) );
116 }
117 $instance['filter'] = !empty( $new_instance['filter'] );
118 $instance['view'] = sanitize_text_field( $new_instance['view'] );
119 return array_merge( $this->defaults, $instance );
120 }
121
122 }
123
124
125 /**
126 * Load widget
127 */
128 function wpmtst_load_view_widget() {
129 register_widget( 'Strong_Testimonials_View_Widget' );
130 }
131 add_action( 'widgets_init', 'wpmtst_load_view_widget' );
132
133
134 /**
135 * Compatibility: CM Tooltip Glossary
136 *
137 * Instead of being registered, the [glossary_exclude] is handled in a late content filter
138 * which leaves the shortcode behind since we don't run that filter on widget content.
139 *
140 * @since 2.11.9
141 *
142 * @param $content
143 *
144 * @return mixed
145 */
146 function wpmtst_remove_glossary_exclude( $content ) {
147 if ( class_exists( 'CMTooltipGlossaryFrontend' ) ) {
148 $content = str_replace( array( '[glossary_exclude]', '[/glossary_exclude]' ), array( '', '' ), $content );
149 }
150
151 return $content;
152 }
153 add_filter( 'wpmtst_widget_text', 'wpmtst_remove_glossary_exclude' );
154