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 / admin / class-strong-testimonials-helper.php
strong-testimonials / admin Last commit date
challenge 1 year ago css 1 week ago img 1 year ago js 1 month ago menu 1 month ago partials 2 weeks ago rest-api 1 week ago scss 1 year ago settings 1 week ago uninstall 1 year ago wpchill 1 month ago admin-notices.php 6 months ago admin.php 1 month ago class-strong-testimonials-addons.php 1 month ago class-strong-testimonials-admin-category-list.php 1 year ago class-strong-testimonials-admin-list.php 1 year ago class-strong-testimonials-admin-scripts.php 1 month ago class-strong-testimonials-admin.php 1 month ago class-strong-testimonials-debug.php 6 months ago class-strong-testimonials-exporter.php 1 year ago class-strong-testimonials-help.php 1 year ago class-strong-testimonials-helper.php 1 month ago class-strong-testimonials-list-table.php 1 year ago class-strong-testimonials-lite-vs-pro-page.php 1 month ago class-strong-testimonials-post-editor.php 7 months ago class-strong-testimonials-review.php 1 year ago class-strong-testimonials-updater.php 1 month ago class-strong-testimonials-upsell.php 1 week ago class-strong-views-list-table.php 1 month ago class-walker-strong-category-checklist.php 1 year ago class-walker-strong-form-category-checklist.php 1 year ago class-wpmtst-onboarding.php 1 year ago compat.php 1 year ago custom-fields-ajax.php 1 year ago custom-fields.php 1 week ago form-preview.php 1 year ago view-list-order.php 1 year ago views-ajax.php 1 month ago views-validate.php 1 year ago views.php 1 month ago
class-strong-testimonials-helper.php
2708 lines
1 <?php
2
3 /**
4 * Class Strong_Testimonials_Helper
5 *
6 * @since 3.0.3
7 */
8 class Strong_Testimonials_Helper {
9
10 /**
11 * Our Class variables
12 *
13 * @since 2.51.5
14 */
15 public $field;
16 public $action;
17 public $view_id;
18 public $view_options;
19 public $cat_count = false;
20 public $show_section;
21 public $view;
22 public $view_name;
23 public $view_cats_array;
24 public $sections;
25 public $current_mode;
26 public $current_type;
27 public $is_setting;
28
29 /**
30 * Strong_Testimonials_Helper constructor.
31 *
32 * @since 2.51.5
33 */
34 public function __construct() {
35
36 // Compatibility with plugins that edit wp_kses_post allowed html list. eg. "The Post Grid"
37 add_filter( 'wp_kses_allowed_html', array( $this, 'wpmtst_custom_wpkses_post_tags' ), 99, 2 );
38 add_filter( 'wpmtst_view_options', array( $this, 'add_testimonials_view_order' ) );
39 $this->action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : false;
40 $this->view_id = absint( filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ) );
41 $this->view_options = Strong_Testimonials_Defaults::get_view_options();
42 $this->cat_count = wpmtst_get_cat_count();
43 }
44
45 /**
46 * Set Strong Testimonial view
47 *
48 * @since 2.51.5
49 */
50 public function set_view() {
51
52 $this->view = $this->get_view();
53 $this->show_section = apply_filters( 'wpmtst_show_section', $this->view['mode'] );
54 if ( 'edit' === $this->action ) {
55 $view_array = wpmtst_get_view( $this->view_id );
56 $this->view = unserialize( $view_array['value'] );
57 $this->view_name = $view_array['name'];
58 } elseif ( 'duplicate' === $this->action ) {
59 $view_array = wpmtst_get_view( $this->view_id );
60 $this->view = unserialize( $view_array['value'] );
61 $this->view_id = 0;
62 $this->view_name = $view_array['name'] . ' - COPY';
63 } else {
64 $this->view_id = 1;
65 $this->view = wpmtst_get_view_default();
66 $this->view_name = 'new';
67 }
68 $this->view_cats_array = apply_filters( 'wpmtst_l10n_cats', explode( ',', $this->view['category'] ) );
69 $this->sections = $this->get_sections();
70 }
71
72 /**
73 * Get Strong Testimonial view
74 *
75 * @return array|mixed
76 *
77 * @since 2.51.5
78 */
79 public static function get_view() {
80
81 $view = wpmtst_get_view_default();
82 if ( isset( $_REQUEST['action'] ) ) {
83 $action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : false;
84 $id = absint( filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ) );
85 if ( 'edit' === $action || 'duplicate' === $action ) {
86 $view_array = wpmtst_get_view( $id );
87 if ( isset( $view_array['value'] ) ) {
88 $view = unserialize( $view_array['value'] );
89 }
90 }
91 }
92
93 return $view;
94 }
95
96 /**
97 * Get Strong Testimonials sections
98 *
99 * @return mixed|void
100 *
101 * @since 2.51.5
102 */
103 public function get_sections() {
104 return apply_filters(
105 'wpmtst_view_sections',
106 array(
107 'query' => array(
108 'section_action_before' => 'wpmtst_view_editor_before_group_select',
109 'section_action_after' => 'wpmtst_view_editor_after_group_select',
110 'fields_action_before' => '',
111 'fields_action_after' => array(
112 'action' => 'wpmtst_views_group_query',
113 'param' => $this->view,
114 ),
115 'classes' => array(
116 'then',
117 'then_display',
118 'then_not_form',
119 'then_slideshow',
120 'then_not_single_template',
121 ),
122 'title' => esc_html__( 'Query', 'strong-testimonials' ),
123 'table_classes' => 'form-table multiple group-select',
124 'subheading' => array(
125 array(
126 'title' => esc_html__( 'Option', 'strong-testimonials' ),
127 'classes' => '',
128 'colspan' => 1,
129 'after' => '',
130 ),
131 array(
132 'title' => esc_html__( 'Settings', 'strong-testimonials' ),
133 'classes' => '',
134 'colspan' => 1,
135 'after' => '',
136 ),
137 array(
138 'title' => esc_html__( 'or Shortcode Attribute', 'strong-testimonials' ),
139 'classes' => 'divider',
140 'colspan' => 2,
141 'after' => '<span class="help-links"><span class="description"><a href="#tab-panel-wpmtst-help-shortcode" class="open-help-tab">' . __( 'Help', 'strong-testimonials' ) . '</a></span></span>',
142 ),
143 array(
144 'title' => esc_html__( 'Example', 'strong-testimonials' ),
145 'classes' => '',
146 'colspan' => 1,
147 'after' => '',
148 ),
149 ),
150 'fields' => array(
151 'field_select' => array(
152 'label' => esc_html_x( 'Select', 'verb', 'strong-testimonials' ),
153 'type' => 'select',
154 'before' => '',
155 'after' => '',
156 'class' => 'view-single_or_multiple',
157 'container_classes' => 'then then_display then_slideshow then_not_form',
158 'id' => '',
159 'field_action_before' => '',
160 'field_action_after' => '',
161 ),
162 'field_category' => array(
163 'label' => esc_html__( 'Categories', 'strong-testimonials' ),
164 'type' => 'category',
165 'before' => '',
166 'after' => '',
167 'class' => 'view-category-select',
168 'container_classes' => 'then then_display then_slideshow then_not_form',
169 'id' => '',
170 'field_action_before' => '',
171 'field_action_after' => '',
172 ),
173 'field_order' => array(
174 'label' => esc_html_x( 'Order', 'noun', 'strong-testimonials' ),
175 'type' => 'order',
176 'before' => '',
177 'after' => '',
178 'class' => 'view-order',
179 'container_classes' => 'then then_display then_slideshow then_not_form',
180 'id' => '',
181 'field_action_before' => '',
182 'field_action_after' => '',
183 ),
184 'field_limit' => array(
185 'label' => esc_html__( 'Quantity', 'strong-testimonials' ),
186 'type' => 'limit',
187 'before' => '',
188 'after' => '',
189 'class' => 'view-all',
190 'container_classes' => 'then then_display then_slideshow then_not_form',
191 'id' => '',
192 'field_action_before' => '',
193 'field_action_after' => '',
194 ),
195 ),
196 ),
197 'fields' => array(
198 'section_action_before' => 'wpmtst_view_editor_before_group_fields',
199 'section_action_after' => '',
200 'fields_action_before' => '',
201 'fields_action_after' => '',
202 'classes' => array(
203 'then',
204 'then_display',
205 'then_not_form',
206 'then_slideshow',
207 'then_single_template',
208 ),
209 'title' => esc_html__( 'Fields', 'strong-testimonials' ),
210 'table_classes' => 'form-table multiple group-show',
211 'fields' => array(
212 'field_title' => array(
213 'label' => esc_html__( ' Title', 'strong-testimonials' ),
214 'type' => 'title',
215 'before' => '<input type="checkbox" id="view-title" name="view[data][title]" value="1"' . checked( $this->view['title'], true, false ) . ' class="checkbox if toggle">',
216 'after' => '',
217 'class' => 'view-title',
218 'container_classes' => 'then then_display then_not_form then_slideshow then_not_single_template',
219 'id' => '',
220 'field_action_before' => '',
221 'field_action_after' => '',
222 ),
223 'field_thumbnail' => array(
224 'label' => esc_html__( ' Featured Image', 'strong-testimonials' ),
225 'type' => 'thumbnail',
226 'before' => '<input type="checkbox" id="view-images" class="checkbox if toggle" name="view[data][thumbnail]" value="1"' . checked( $this->view['thumbnail'], true, false ) . '>',
227 'after' => '',
228 'class' => 'view-images',
229 'container_classes' => 'then then_display then_not_form then_slideshow then_not_single_template',
230 'id' => '',
231 'field_action_before' => '',
232 'field_action_after' => '',
233 ),
234 'field_content' => array(
235 'label' => esc_html__( ' Content', 'strong-testimonials' ),
236 'type' => 'content',
237 'before' => '',
238 'after' => '',
239 'class' => 'view-content',
240 'container_classes' => 'then then_display then_not_form then_slideshow then_not_single_template',
241 'id' => '',
242 'field_action_before' => '',
243 'field_action_after' => '',
244 ),
245 'field_client_section' => array(
246 'include' => 'option-client-section.php',
247 'label' => esc_html__( ' Custom Fields', 'strong-testimonials' ),
248 'type' => 'client-section',
249 'before' => '',
250 'after' => '',
251 'class' => '',
252 'container_classes' => 'then then_display then_not_form then_slideshow then_single_template',
253 'id' => '',
254 'field_action_before' => '',
255 'field_action_after' => '',
256 ),
257 ),
258 ),
259
260 'extra' => array(
261 'section_action_before' => 'wpmtst_view_editor_before_group_extra',
262 'section_action_after' => '',
263 'fields_action_before' => '',
264 'fields_action_after' => '',
265 'classes' => array(
266 'then',
267 'then_display',
268 'then_not_form',
269 'then_slideshow',
270 'then_not_single_template',
271 ),
272 'title' => esc_html__( 'Extra', 'strong-testimonials' ),
273 'table_classes' => 'form-table multiple group-layout',
274 'fields' => array(
275 'field_pagination' => array(
276 'label' => esc_html__( ' Pagination', 'strong-testimonials' ),
277 'type' => 'pagination',
278 'before' => '<input class="if toggle checkbox" id="view-pagination" name="view[data][pagination]" type="checkbox" value="1"' . checked( $this->view['pagination'], true, false ) . '/>',
279 'after' => '',
280 'class' => 'view-pagination',
281 'container_classes' => 'then then_display then_not_form then_not_slideshow then_not_single then_multiple',
282 'id' => '',
283 'field_action_before' => '',
284 'field_action_after' => '',
285 ),
286 'field_read_more' => array(
287 'include' => 'option-read-more-page.php',
288 'label' => esc_html__( ' "Read more" link to a page or post', 'strong-testimonials' ),
289 'type' => 'read-more-page',
290 'before' => '<div class="checkbox"><input type="checkbox" id="view-more_page" class="if toggle" name="view[data][more_page]" value="1"' . checked( isset( $this->view['more_page'] ) && $this->view['more_page'], true, false ) . ' class="checkbox">',
291 'after' => '</div>',
292 'class' => 'view-more_page',
293 'container_classes' => 'then then_display then_not_form then_slideshow read-more',
294 'id' => '',
295 'field_action_before' => '',
296 'field_action_after' => '',
297 ),
298 ),
299 ),
300 'slideshow' => array(
301 'section_action_before' => 'wpmtst_view_editor_before_group_slideshow',
302 'section_action_after' => '',
303 'fields_action_before' => '',
304 'fields_action_after' => '',
305 'classes' => array(
306 'then',
307 'then_not_display',
308 'then_not_form',
309 'then_slideshow',
310 'then_not_single_template',
311 ),
312 'title' => esc_html__( 'Slideshow', 'strong-testimonials' ),
313 'table_classes' => 'form-table multiple group-select',
314 'fields' => array(
315 'field_slideshow_num' => array(
316 'label' => esc_html__( 'Show', 'strong-testimonials' ),
317 'type' => 'slideshow-num',
318 'before' => '',
319 'after' => '',
320 'class' => '',
321 'container_classes' => 'then then_slideshow',
322 'id' => '',
323 'field_action_before' => '',
324 'field_action_after' => '',
325 ),
326 'field_slideshow_transition' => array(
327 'include' => 'option-slideshow-transition.php',
328 'label' => esc_html__( 'Transition', 'strong-testimonials' ),
329 'type' => 'slideshow-transition',
330 'before' => '',
331 'after' => '',
332 'class' => '',
333 'container_classes' => 'then then_slideshow',
334 'id' => '',
335 'field_action_before' => '',
336 'field_action_after' => '',
337 ),
338 'field_slideshow_behavior' => array(
339 'label' => esc_html__( 'Behavior', 'strong-testimonials' ),
340 'type' => 'slideshow-behavior',
341 'before' => '',
342 'after' => '',
343 'class' => '',
344 'container_classes' => 'then then_slideshow',
345 'id' => '',
346 'field_action_before' => '',
347 'field_action_after' => '',
348 ),
349 'field_slideshow_navigation' => array(
350 'label' => esc_html__( 'Navigation', 'strong-testimonials' ),
351 'type' => 'slideshow-navigation',
352 'before' => '',
353 'after' => '',
354 'class' => 'view-slideshow_nav',
355 'container_classes' => 'then then_slideshow',
356 'id' => '',
357 'field_action_before' => '',
358 'field_action_after' => '',
359 ),
360 ),
361 ),
362
363 'form' => array(
364 'section_action_before' => 'wpmtst_view_editor_before_group_form',
365 'section_action_after' => '',
366 'fields_action_before' => '',
367 'fields_action_after' => '',
368 'classes' => array(
369 'then',
370 'then_not_display',
371 'then_not_slideshow',
372 'then_form',
373 'then_not_single_template',
374 ),
375 'title' => esc_html__( 'Actions', 'strong-testimonials' ),
376 'table_classes' => 'form-table multiple group-select',
377 'fields' => array(
378 'field_form_category' => array(
379 'label' => esc_html__( 'Assign to a category', 'strong-testimonials' ),
380 'type' => 'form-category',
381 'before' => '',
382 'after' => '',
383 'class' => '',
384 'container_classes' => 'then then_form',
385 'id' => '',
386 'field_action_before' => '',
387 'field_action_after' => '',
388 ),
389 'field_form_ajax' => array(
390 'label' => esc_html__( ' Submit form without reloading the page (Ajax)', 'strong-testimonials' ),
391 'type' => 'form-ajax',
392 'before' => '<input type="checkbox" id="view-form_ajax" class="checkbox if toggle" name="view[data][form_ajax]" value="1"' . checked( $this->view['form_ajax'], true, false ) . '>',
393 'after' => '',
394 'class' => 'view-form_ajax',
395 'container_classes' => 'then then_form',
396 'id' => '',
397 'field_action_before' => '',
398 'field_action_after' => '',
399 ),
400 ),
401 ),
402
403 'style' => array(
404 'section_action_before' => 'wpmtst_view_editor_before_group_style',
405 'section_action_after' => 'wpmtst_after_style_view_section',
406 'fields_action_before' => '',
407 'fields_action_after' => array(
408 'action' => 'wpmtst_view_editor_after_style_section',
409 'param' => '',
410 ),
411 'classes' => array(
412 'then',
413 'then_display',
414 'then_form',
415 'then_slideshow',
416 'then_single_template',
417 ),
418 'title' => esc_html__( 'Style', 'strong-testimonials' ),
419 'table_classes' => 'form-table multiple group-style',
420 'fields' => array(
421 'field_template_list_display' => array(
422 'label' => esc_html__( 'Template', 'strong-testimonials' ),
423 'type' => 'template-list-display',
424 'before' => '',
425 'after' => '',
426 'class' => '',
427 'container_classes' => 'then then_display then_not_form then_slideshow then_single_template',
428 'id' => '',
429 'field_action_before' => 'wpmtst_view_editor_before_template_list',
430 'field_action_after' => '',
431 ),
432 'field_template_list_form' => array(
433 'label' => esc_html__( 'Template', 'strong-testimonials' ),
434 'type' => 'template-list-form',
435 'before' => '',
436 'after' => '',
437 'class' => '',
438 'container_classes' => 'then then_not_display then_form then_not_slideshow then_not_single_template',
439 'id' => '',
440 'field_action_before' => '',
441 'field_action_after' => '',
442 ),
443 'field_option_layout' => array(
444 'include' => 'option-layout.php',
445 'label' => esc_html__( 'Layout', 'strong-testimonials' ),
446 'type' => 'layout',
447 'before' => '',
448 'after' => '',
449 'class' => '',
450 'container_classes' => 'then then_display then_not_form then_not_slideshow then_not_single_template',
451 'id' => '',
452 'field_action_before' => 'wpmtst_view_editor_before_layout',
453 'field_action_after' => '',
454 ),
455 'field_background' => array(
456 'label' => esc_html__( 'Background', 'strong-testimonials' ),
457 'type' => 'background',
458 'before' => '',
459 'after' => '',
460 'class' => '',
461 'id' => 'group-style-option-background',
462 'container_classes' => 'then then_display then_form then_slideshow then_not_single_template',
463 'field_action_before' => 'wpmtst_view_editor_before_background',
464 'field_action_after' => '',
465 ),
466 'field_color' => array(
467 'label' => esc_html__( 'Font Color', 'strong-testimonials' ),
468 'type' => 'color',
469 'before' => '',
470 'after' => '',
471 'class' => '',
472 'id' => 'group-style-option-color',
473 'container_classes' => 'then then_display then_form then_slideshow then_not_single_template',
474 'field_action_before' => '',
475 'field_action_after' => '',
476 ),
477 'field_classes' => array(
478 'label' => esc_html__( 'CSS Classes', 'strong-testimonials' ),
479 'type' => 'classes',
480 'before' => '',
481 'after' => '',
482 'class' => 'view-class',
483 'id' => '',
484 'container_classes' => 'then then_display then_form then_slideshow then_not_single_template',
485 'field_action_before' => 'wpmtst_view_editor_before_classes',
486 'field_action_after' => '',
487 ),
488 ),
489 ),
490
491 'compat' => array(
492 'section_action_before' => 'wpmtst_view_editor_before_group_compat',
493 'section_action_after' => '',
494 'fields_action_before' => '',
495 'fields_action_after' => '',
496 'classes' => array( 'then' ),
497 'title' => esc_html__( 'Compatibility', 'strong-testimonials' ),
498 'table_classes' => 'form-table multiple group-general',
499 'fields' => array(
500 'field_divi_builder' => array(
501 'label' => esc_html__( 'Divi Builder', 'strong-testimonials' ),
502 'type' => 'divi',
503 'before' => '',
504 'after' => '',
505 'class' => 'view-divi_builder',
506 'container_classes' => 'then then_display then_form then_slideshow then_not_single_template',
507 'id' => '',
508 'field_action_before' => '',
509 'field_action_after' => '',
510 ),
511 ),
512 ),
513 )
514 );
515 }
516
517 /**
518 * Render Strong Testimonials form
519 *
520 * @since 2.51.5
521 */
522 public function render_form() {
523
524 $actions = array( 'edit', 'duplicate', 'add' );
525
526 if ( ! in_array( $this->action, $actions, true ) ) {
527 wp_die( esc_html__( 'Invalid request. Please try again.', 'strong-testimonials' ) );
528 }
529
530 if ( ( 'edit' === $this->action || 'duplicate' === $this->action ) && ! $this->view_id ) {
531 return;
532 }
533
534 $this->set_view();
535 add_thickbox();
536
537 // @todo: these don't seem to be used anywhere
538 $fields = wpmtst_get_custom_fields();
539 $all_fields = wpmtst_get_all_fields();
540
541 /**
542 * Show category filter if necessary.
543 *
544 * @since 2.2.0
545 */
546 if ( $this->cat_count > 5 ) {
547 wp_enqueue_script( 'wpmtst-view-category-filter-script' );
548 }
549
550 // Select default template if necessary
551 if ( ! $this->view['template'] ) {
552 if ( 'form' === $this->view['mode'] ) {
553 $this->view['template'] = 'default-form';
554 } else {
555 $this->view['template'] = 'default';
556 }
557 }
558
559 // Get urls
560 $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' );
561 $url1 = $url . '&action=add';
562 $url2 = $url . '&action=duplicate&id=' . $this->view_id;
563
564 ?>
565 <h1>
566 <?php 'edit' === $this->action ? esc_html_e( 'Edit View', 'strong-testimonials' ) : esc_html_e( 'Add View', 'strong-testimonials' ); ?>
567 <a href="<?php echo esc_url( $url1 ); ?>"
568 class="add-new-h2"><?php esc_html_e( 'Add New', 'strong-testimonials' ); ?></a>
569 <a href="<?php echo esc_url( $url ); ?>"
570 class="add-new-h2"><?php esc_html_e( 'Return To List', 'strong-testimonials' ); ?></a>
571 <?php if ( 'edit' === $this->action && 'single_template' !== $this->view['mode'] ) : ?>
572 <a href="<?php echo esc_url( $url2 ); ?>"
573 class="add-new-h2"><?php esc_html_e( 'Duplicate This View', 'strong-testimonials' ); ?></a>
574 <?php endif; ?>
575 </h1>
576
577 <form id="wpmtst-views-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>"
578 autocomplete="off" enctype="multipart/form-data">
579 <?php wp_nonce_field( 'view_form_submit', 'view_form_nonce', true, true ); ?>
580
581 <input type="hidden" name="action" value="view_<?php echo esc_attr( $this->action ); ?>_form">
582 <input type="hidden" name="view[id]" value="<?php echo esc_attr( $this->view_id ); ?>">
583 <input type="hidden" name="view_original_mode" value="<?php echo esc_attr( $this->view['mode'] ); ?>">
584 <input type="hidden" name="view[data][_form_id]" value="<?php echo esc_attr( $this->view['form_id'] ); ?>">
585
586 <div class="table view-info">
587 <?php $this->render_info(); ?>
588 </div>
589
590 <?php $this->render_sections(); ?>
591
592 <p class="wpmtst-submit">
593 <?php submit_button( '', 'primary', 'submit-form', false ); ?>
594 <?php submit_button( esc_html__( 'Cancel Changes', 'strong-testimonials' ), 'secondary', 'reset', false ); ?>
595 <?php submit_button( esc_html__( 'Restore Defaults', 'strong-testimonials' ), 'secondary', 'restore-defaults', false ); ?>
596 </p>
597 </form>
598 <?php
599 }
600
601 /**
602 * Render Strong Testimonials view info
603 *
604 * @since 2.51.5
605 */
606 private function render_info() {
607
608 if ( 'edit' === $this->action ) {
609 $shortcode = '<div class="saved">';
610 $shortcode .= '<input id="view-shortcode" type="text" value="[testimonial_view id=&quot;' . esc_attr( $this->view_id ) . '&quot;]" readonly />';
611 $shortcode .= '<input id="copy-shortcode" class="button small" type="button" value="' . esc_attr__( 'copy to clipboard', 'strong-testimonials' ) . '" data-copytarget="#view-shortcode" />';
612 $shortcode .= '<span id="copy-message">' . esc_html__( 'copied', 'strong-testimonials' ) . '</span>';
613 $shortcode .= '</div>';
614 } else {
615 $shortcode = '<div class="unsaved">' . esc_html_x( 'will be available after you save this', 'The shortcode for a new View.', 'strong-testimonials' ) . '</div>';
616 }
617
618 $classes = array(
619 'then',
620 'then_display',
621 'then_form',
622 'then_slideshow',
623 apply_filters( 'wpmtst_view_section', '', 'shortcode' ),
624 );
625 ?>
626
627 <div class="table-row form-view-name">
628 <div class="table-cell">
629 <label for="view-name">
630 <?php esc_html_e( 'Name', 'strong-testimonials' ); ?>
631 </label>
632 </div>
633 <div class="table-cell">
634 <input type="text" id="view-name" class="view-name" name="view[name]"
635 value="<?php echo esc_attr( htmlspecialchars( stripslashes( $this->view_name ) ) ); ?>"
636 tabindex="1">
637 </div>
638 </div>
639
640 <?php if ( 'single_template' === $this->view['mode'] ) : ?>
641 <input type="hidden" name="view[data][mode]" value="single_template">
642 <script>jQuery(function($){ $.fn.updateScreen('single_template'); });</script>
643 <?php else : ?>
644 <div class="table-row form-view-shortcode <?php echo esc_attr( implode( ' ', array_filter( $classes ) ) ); ?>">
645 <div class="table-cell">
646 <label for="view-shortcode"><?php esc_html_e( 'Shortcode', 'strong-testimonials' ); ?></label>
647 </div>
648 <div class="table-cell">
649 <?php
650 if ( 'edit' === $this->action ) {
651 echo '<div class="saved">';
652 echo '<input id="view-shortcode" type="text" value="[testimonial_view id=&quot;' . esc_attr( $this->view_id ) . '&quot;]" readonly />';
653 echo '<input id="copy-shortcode" class="button small" type="button" value="' . esc_attr__( 'copy to clipboard', 'strong-testimonials' ) . '" data-copytarget="#view-shortcode" />';
654 echo '<span id="copy-message">' . esc_html__( 'copied', 'strong-testimonials' ) . '</span>';
655 echo '</div>';
656 } else {
657 echo '<div class="unsaved">' . esc_html_x( 'will be available after you save this', 'The shortcode for a new View.', 'strong-testimonials' ) . '</div>';
658 }
659 ?>
660 </div>
661 </div>
662 <div id="view-mode" class="table-row mode-select">
663 <div class="table-cell">
664 <?php esc_html_e( 'Mode', 'strong-testimonials' ); ?>
665 </div>
666 <div class="table-cell">
667 <div class="mode-list">
668 <?php foreach ( $this->view_options['mode'] as $mode ) : ?>
669 <label>
670 <input id="<?php echo esc_attr( $mode['name'] ); ?>" type="radio" name="view[data][mode]"
671 value="<?php echo esc_attr( $mode['name'] ); ?>" <?php checked( $this->view['mode'], $mode['name'] ); ?>>
672 <?php echo esc_html( $mode['label'] ); ?>
673 <div class="mode-line"></div>
674 </label>
675 <?php endforeach; ?>
676 </div>
677 <div class="mode-description"></div>
678 </div>
679 </div>
680 <?php endif; ?>
681 <?php
682 }
683
684 /**
685 * Render Strong Testimonials view sections
686 *
687 * @since 2.51.5
688 */
689 private function render_sections() {
690
691 // @todo: check what `$show_section = apply_filters('wpmtst_show_section', $this->view['mode']);` does
692 // @todo: seems like the same filter is used above for $this->show_sections
693 $show_section = apply_filters( 'wpmtst_show_section', $this->view['mode'] );
694 foreach ( $this->sections as $name => $section ) {
695 if ( ! empty( $section['section_action_before'] ) ) {
696 do_action( $section['section_action_before'] );
697 }
698
699 $this->render_section( $name, $section );
700
701 if ( ! empty( $section['section_action_after'] ) ) {
702 do_action( $section['section_action_after'] );
703 }
704 }
705
706 do_action( 'wpmtst_view_editor_before_group_general' );
707 do_action( 'wpmtst_view_editor_after_groups' );
708 }
709
710 /**
711 * Render Strong Testimonial section
712 *
713 * @param $name
714 * @param $section
715 *
716 * @since 2.51.5
717 */
718 public function render_section( $name, $section ) {
719
720 $section['classes'][] = apply_filters( 'wpmtst_view_section', '', $name );
721 ?>
722 <div class="<?php echo esc_attr( implode( ' ', array_filter( $section['classes'] ) ) ); ?>"
723 style="display:none">
724 <h3><?php echo esc_html( $section['title'] ); ?></h3>
725 <table class="<?php echo esc_attr( $section['table_classes'] ); ?>">
726
727 <?php if ( ! empty( $section['subheading'] ) ) : ?>
728 <tr class="subheading">
729 <?php foreach ( $section['subheading'] as $subheading ) : ?>
730 <td class="<?php echo esc_attr( $subheading['classes'] ); ?>"
731 colspan="<?php echo esc_attr( $subheading['colspan'] ); ?>">
732 <?php echo esc_html( $subheading['title'] ); ?>
733 <?php echo wp_kses_post( $subheading['after'] ); ?>
734 </td>
735 <?php endforeach; ?>
736 </tr>
737 <?php
738 endif;
739
740 if ( ! empty( $section['fields'] ) ) {
741 if ( ! empty( $section['fields_action_before'] ) ) {
742 do_action( $section['fields_action_before']['action'], $section['fields_action_before']['param'] );
743 }
744 foreach ( $section['fields'] as $key => $field ) {
745 $this->set_field( $field );
746 if ( ! empty( $this->field['field_action_before'] ) ) {
747 do_action( $field['field_action_before'] );
748 }
749 ?>
750 <tr id="<?php echo esc_attr( $this->field['id'] ); ?>"
751 class="<?php echo esc_attr( $this->field['container_classes'] ); ?>" style="display:none">
752 <?php $this->render_field(); ?>
753 </tr>
754 <?php
755 if ( ! empty( $this->field['field_action_after'] ) ) {
756 do_action( $field['field_action_after'] );
757 }
758 }
759 if ( ! empty( $section['fields_action_after'] ) ) {
760 do_action( $section['fields_action_after']['action'], $section['fields_action_after']['param'] );
761 }
762 }
763 ?>
764 </table>
765 </div>
766 <?php
767 }
768
769 /**
770 * Set Strong Testimonial field
771 *
772 * @param $field
773 *
774 * @since 2.51.5
775 */
776 public function set_field( $field ) {
777
778 $this->field = $field;
779 }
780
781 /**
782 * Set Strong Testimonial settings field
783 *
784 * @param $field
785 *
786 * @since 2.51.5
787 */
788 public function set_settings_field( $field ) {
789
790 $this->field = $field;
791 $this->is_setting = true;
792 }
793
794 /**
795 * Render Strong Testimonial field
796 *
797 * @since 2.51.5
798 */
799 public function render_field() {
800 ?>
801
802 <th>
803 <?php echo wp_kses_post( $this->field['before'] ); ?>
804 <label for="<?php echo esc_attr( $this->field['class'] ); ?>"><?php echo wp_kses_post( $this->field['label'] ); ?></label>
805 <?php echo wp_kses_post( $this->field['after'] ); ?>
806 </th>
807 <?php
808 switch ( $this->field['type'] ) {
809 case 'select':
810 $this->render_field_select();
811 break;
812 case 'category':
813 $this->render_field_category();
814 break;
815 case 'order':
816 $this->render_field_order();
817 break;
818 case 'limit':
819 $this->render_field_limit();
820 break;
821 case 'title':
822 $this->render_field_title();
823 break;
824 case 'thumbnail':
825 $this->render_field_thumbnail();
826 break;
827 case 'content':
828 $this->render_field_content();
829 break;
830 case 'client-section':
831 $this->render_field_client_section();
832 break;
833 case 'pagination':
834 $this->render_field_pagination();
835 break;
836 case 'read-more-page':
837 $this->render_field_read_more_page();
838 break;
839 case 'slideshow-num':
840 $this->render_field_slideshow_num();
841 break;
842 case 'slideshow-transition':
843 $this->render_field_slideshow_transition();
844 break;
845 case 'slideshow-behavior':
846 $this->render_field_slideshow_behavior();
847 break;
848 case 'slideshow-navigation':
849 $this->render_field_slideshow_navigation();
850 break;
851 case 'form-category':
852 $this->render_field_form_category();
853 break;
854 case 'form-ajax':
855 $this->render_field_form_ajax();
856 break;
857 case 'template-list-display':
858 $this->current_mode = 'template';
859 $this->current_type = 'display';
860 $this->render_field_template_list();
861 break;
862 case 'template-list-form':
863 $this->current_mode = 'form-template';
864 $this->current_type = 'form';
865 $this->render_field_template_list();
866 break;
867 case 'layout':
868 $this->render_field_layout();
869 break;
870 case 'background':
871 $this->render_field_background();
872 break;
873 case 'color':
874 $this->render_field_color();
875 break;
876 case 'classes':
877 $this->render_field_classes();
878 break;
879 case 'divi':
880 $this->render_field_divi();
881 break;
882 default:
883 do_action( 'wpmtst_render_field', $this->field );
884 }
885 }
886
887 /**
888 * Render ST select
889 *
890 * @param $input_name
891 * @param false $recommended
892 * @param string $title
893 *
894 * @since 2.51.5
895 */
896 public function render_option_select( $input_name, $recommended = false, $title = '' ) {
897
898 $selected = $this->field['selected'];
899
900 if ( $this->is_setting ) {
901 $selected = $this->field['selected_settings'];
902 }
903
904 if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ) :
905 ?>
906 <td>
907
908 <?php if ( ! empty( $title ) ) : ?>
909 <h4 class="title"><?php echo esc_html( $title ); ?>
910 <h4>
911 <?php endif; ?>
912 <select id="<?php echo esc_attr( $this->field['class'] ); ?>"
913 name="<?php echo esc_attr( $input_name ); ?>">
914 <?php foreach ( $this->field['options'] as $option ) : ?>
915 <option value="<?php echo esc_attr( $option ); ?>" <?php selected( $option, $selected ); ?>><?php echo esc_html( $option ); ?></option>
916 <?php endforeach; ?>
917 </select>
918 <?php if ( $recommended ) : ?>
919 <p class="description"><strong
920 style="color: #00805e; font-style: normal;"><?php esc_html_e( 'Recommended.', 'strong-testimonials' ); ?></strong>
921 <?php
922 if ( is_string( $recommended ) ) {
923 echo esc_html( $recommended );
924 }
925 ?>
926 </p>
927 <?php endif; ?>
928
929 </td>
930 <?php
931 endif;
932 }
933
934 /**
935 * Render ST textfield
936 *
937 * @param $input_name
938 * @param false $recommended
939 * @param string $description
940 * @param string $title
941 * @param string $placeholder
942 *
943 * @SINCE 2.51.5
944 */
945 public function render_option_textfield( $input_name, $recommended = false, $description = '', $title = '', $placeholder = '' ) {
946
947 $value = $this->field['value'];
948
949 if ( $this->is_setting ) {
950 $value = $this->field['value_settings'];
951 }
952 ?>
953
954 <td>
955 <?php if ( ! empty( $title ) ) : ?>
956 <h4 class="title"><?php echo esc_html( $title ); ?>
957 <h4>
958 <?php endif; ?>
959
960 <div>
961 <div class="has-input">
962 <input class="regular-text" type="text" id="<?php echo esc_attr( $this->field['class'] ); ?>"
963 name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo esc_attr( $value ); ?>"
964 data-default="<?php echo esc_attr( $this->field['default'] ); ?>"
965 placeholder="<?php echo esc_attr( $placeholder, 'strong-testimonials' ); ?>">
966 </div>
967 <div class="error-message"></div>
968 </div>
969 <p class="description">
970
971 <?php if ( $recommended ) : ?>
972 <strong style="color: #00805e; font-style: normal;"><?php esc_html_e( 'Recommended.', 'strong-testimonials' ); ?></strong>
973 <?php endif; ?>
974
975 <?php if ( ! empty( $description ) ) : ?>
976 <?php echo esc_html( $description ); ?>
977 <?php endif; ?>
978
979 </p>
980 </td>
981 <?php
982 }
983
984 /**
985 * Render ST select
986 *
987 * @since 2.51.5
988 */
989 private function render_field_select() {
990
991 $testimonials_list = get_posts(
992 array(
993 'orderby' => 'post_date',
994 'order' => 'ASC',
995 'post_type' => 'wpm-testimonial',
996 'post_status' => 'publish',
997 'posts_per_page' => - 1,
998 'suppress_filters' => true,
999 )
1000 );
1001 ?>
1002 <td>
1003 <div class="row">
1004 <div class="row-inner">
1005 <select id="view-single_or_multiple" class="if selectper" name="view[data][select]">
1006 <option value="multiple" <?php echo 0 === (int) $this->view['id'] ? 'selected' : ''; ?>><?php esc_html_e( 'one or more testimonials', 'strong-testimonials' ); ?></option>
1007 <option value="single" <?php echo (int) $this->view['id'] >= 1 ? 'selected' : ''; ?>><?php esc_html_e( 'a specific testimonial', 'strong-testimonials' ); ?></option>
1008 </select>
1009 </div>
1010 </div>
1011
1012 <div class="row">
1013 <div class="then then_not_slideshow then_single then_not_multiple" style="display: none;">
1014 <div class="row-inner">
1015 <label>
1016 <select id="view-id" name="view[data][id]">
1017 <option value="0"><?php esc_html_e( '&mdash; select &mdash;', 'strong-testimonials' ); ?></option>
1018 <?php foreach ( $testimonials_list as $post ) : ?>
1019 <option value="<?php echo esc_attr( $post->ID ); ?>" <?php selected( $this->view['id'], $post->ID ); ?>>
1020 <?php echo $post->post_title ? esc_html( $post->post_title ) : esc_html__( '(untitled)', 'strong-testimonials' ); ?>
1021 </option>
1022 <?php endforeach; ?>
1023 </select>
1024 </label>
1025 </div>
1026 <div class="row-inner">
1027 <label for="view-post_id">
1028 <?php echo esc_html( _x( 'or enter its ID or slug', 'to select a testimonial', 'strong-testimonials' ) ); ?>
1029 </label>
1030 <input type="text" id="view-post_id" name="view[data][post_id]" size="30">
1031 </div>
1032 </div>
1033 </div>
1034 </td>
1035
1036 <td class="divider">
1037 <p><?php echo wp_kses_post( '<code>post_ids</code>' ); ?></p>
1038 </td>
1039
1040 <td>
1041 <p><?php esc_html_e( 'a comma-separated list of post ID\'s', 'strong-testimonials' ); ?></p>
1042 </td>
1043
1044 <td>
1045 <p><?php echo wp_kses_post( '<code>post_ids="123,456"</code>' ); ?></p>
1046 </td>
1047 <?php
1048 }
1049
1050 /**
1051 * Render ST category field
1052 *
1053 * @since 2.51.5
1054 */
1055 private function render_field_category() {
1056
1057 if ( $this->cat_count ) :
1058 ?>
1059 <td>
1060 <div id="view-category" class="row">
1061 <div class="table inline">
1062 <div class="table-row">
1063 <div class="table-cell select-cell then_display then_slideshow then_not_form">
1064 <select id="view-category-select" class="if selectper" name="view[data][category_all]">
1065 <option value="allcats" <?php selected( $this->view['category'], 'all' ); ?>><?php esc_html_e( 'all', 'strong-testimonials' ); ?></option>
1066 <option value="somecats" <?php echo( 'all' !== $this->view['category'] ? 'selected' : '' ); ?>><?php echo esc_html( _x( 'select', 'verb', 'strong-testimonials' ) ); ?></option>
1067 </select>
1068 </div>
1069 <div class="table-cell then then_not_allcats then_somecats" style="display: none;">
1070 <div class="table">
1071 <?php if ( $this->cat_count > 5 ) : ?>
1072 <div class="table-row">
1073 <div class="table-cell">
1074 <div class="row" style="text-align: right; padding-bottom: 5px;">
1075 <input type="button" class="expand-cats button"
1076 value="expand list"/>
1077 </div>
1078 </div>
1079 </div>
1080 <?php endif; ?>
1081 <div class="table-row">
1082 <div class="table-cell"><?php wpmtst_category_checklist( $this->view_cats_array ); ?></div>
1083 </div>
1084 </div>
1085 </div>
1086 </div>
1087 </div>
1088 </div>
1089 </td>
1090 <?php else : ?>
1091 <td>
1092 <div id="view-category" class="row">
1093 <input type="hidden" name="view[data][category_all]" value="all">
1094 <p class="description tall"><?php esc_html_e( 'No categories found', 'strong-testimonials' ); ?></p>
1095 </div>
1096 </td>
1097 <?php endif; ?>
1098
1099 <td class="divider">
1100 <p><?php echo wp_kses_post( '<code>category</code>' ); ?></p>
1101 </td>
1102 <td>
1103 <p><?php esc_html_e( 'a comma-separated list of category slugs or ID\'s', 'strong-testimonials' ); ?></p>
1104 </td>
1105 <td>
1106 <p><?php echo wp_kses_post( '<code>category="accounting"</code>' ); ?></p>
1107 </td>
1108 <?php
1109 }
1110
1111 /**
1112 * Render ST order field
1113 *
1114 * @since 2.51.5
1115 */
1116 private function render_field_order() {
1117
1118 ?>
1119 <td>
1120 <div class="row">
1121 <div class="inline">
1122 <select id="view-order" name="view[data][order]">
1123 <?php foreach ( $this->view_options['order'] as $order => $order_label ) : ?>
1124 <option value="<?php echo esc_attr( $order ); ?>" <?php selected( $order, $this->view['order'] ); ?>><?php echo esc_html( $order_label ); ?></option>
1125 <?php endforeach; ?>
1126 </select>
1127 </div>
1128 </div>
1129 </td>
1130 <td class="divider">
1131 <p><?php echo wp_kses_post( '<code>order</code>' ); ?></p>
1132 </td>
1133 <td>
1134 <p><?php echo wp_kses_post( 'oldest | newest | random | menu_order | submit_date' ); ?></p>
1135 </td>
1136 <td>
1137 <p><?php echo wp_kses_post( '<code>order="random"</code>' ); ?></p>
1138 </td>
1139 <?php
1140 }
1141
1142 /**
1143 * Render ST limit fied
1144 *
1145 * @since 2.51.5
1146 */
1147 private function render_field_limit() {
1148
1149 ?>
1150 <td>
1151 <div class="row">
1152 <div class="inline">
1153 <select class="if select" id="view-all" name="view[data][all]">
1154 <option value="1" <?php selected( - 1, $this->view['count'] ); ?>>
1155 <?php esc_html_e( 'all', 'strong-testimonials' ); ?>
1156 </option>
1157 <option class="trip" value="0" <?php selected( $this->view['count'] > 0 ); ?>>
1158 <?php echo esc_html( _x( 'count', 'noun', 'strong-testimonials' ) ); ?>
1159 </option>
1160 </select>
1161 &nbsp;
1162 <label><input class="input-incremental then_all" type="number" id="view-count"
1163 name="view[data][count]"
1164 value="<?php echo ( -1 === (int) $this->view['count'] ) ? 1 : esc_attr( $this->view['count'] ); ?>"
1165 min="1" size="5" style="display: none;"></label>
1166 </div>
1167 </div>
1168 </td>
1169 <td class="divider">
1170 <p><?php echo wp_kses_post( '<code>count</code>' ); ?></p>
1171 </td>
1172 <td></td>
1173 <td>
1174 <p><?php echo wp_kses_post( '<code>count=5</code>' ); ?></p>
1175 </td>
1176 <?php
1177 }
1178
1179 /**
1180 * Render ST title field
1181 *
1182 * @since 2.51.5
1183 */
1184 private function render_field_title() {
1185
1186 $custom_fields = wpmtst_get_custom_fields();
1187 $options = get_option( 'wpmtst_options' );
1188 $url_fields = array();
1189
1190 foreach ( $custom_fields as $field ) {
1191 if ( 'url' === $field['input_type'] ) {
1192 $url_fields[] = $field;
1193 }
1194 }
1195
1196 // For older versions where title_link was checkbox
1197 if ( '1' === $this->view['title_link'] ) {
1198 $this->view['title_link'] = 'wpmtst_testimonial';
1199 }
1200
1201 if ( '0' === $this->view['title_link'] ) {
1202 $this->view['title_link'] = 'none';
1203 }
1204 ?>
1205
1206 <td colspan="2">
1207 <div class="row">
1208 <div class="row-inner">
1209 <div class="then then_title" style="display: none;">
1210 <label for="view-title_link">
1211 <?php
1212 // translators: %s is the name of the post type. "Testimonial" by default.
1213 printf( esc_html_x( 'Link to %s', 'The name of this post type. "Testimonial" by default.', 'strong-testimonials' ), esc_html( strtolower( apply_filters( 'wpmtst_cpt_singular_name', __( 'Testimonial', 'strong-testimonials' ) ) ) ) );
1214 ?>
1215 </label>
1216 <div class="wpmtst-tooltip"><span>[?]</span>
1217 <div class="wpmtst-tooltip-content">
1218 <?php
1219 echo esc_html__( '"Full testimonial" option doesn\'s work if "Disable permalinks for testimonials" from "Settings" page is enabled.', 'strong-testimonials' );
1220 ?>
1221 </div>
1222 </div>
1223
1224 <select name="view[data][title_link]">
1225 <option value="none" <?php selected( 'none', $this->view['title_link'], true ); ?>><?php echo esc_html__( 'None', 'strong-testimonials' ); ?></option>
1226 <?php if ( ! isset( $options['disable_rewrite'] ) || ! $options['disable_rewrite'] ) { ?>
1227 <option value="wpmtst_testimonial" <?php selected( 'wpmtst_testimonial', $this->view['title_link'], true ); ?>><?php echo esc_html__( 'Full testimonial', 'strong-testimonials' ); ?></option>
1228 <?php } ?>
1229
1230 <?php foreach ( $url_fields as $url ) { ?>
1231 <option value="<?php echo esc_attr( $url['name'] ); ?>" <?php selected( $url['name'], $this->view['title_link'] ); ?>><?php echo esc_html( $url['label'] ); ?></option>
1232 <?php } ?>
1233
1234 </select>
1235 <?php do_action( 'wpmtst_view_editor_after_group_fields_title' ); ?>
1236 </div>
1237 </div>
1238 </div>
1239 </td>
1240 <?php
1241 }
1242
1243 /**
1244 * Render ST thumbnail field
1245 *
1246 * @since 2.51.5
1247 */
1248 private function render_field_thumbnail() {
1249
1250 $image_sizes = wpmtst_get_image_sizes();
1251 ?>
1252 <td colspan="2">
1253 <div class="then then_images" style="display: none;">
1254 <div class="row">
1255 <div class="row-inner">
1256 <div class="inline">
1257 <label for="view-thumbnail_size">Size</label>
1258 <select id="view-thumbnail_size" class="if select" name="view[data][thumbnail_size]">
1259 <?php foreach ( $image_sizes as $key => $size ) : ?>
1260 <option class="<?php echo( 'custom' === $key ? 'trip' : '' ); ?>"
1261 value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $this->view['thumbnail_size'] ); ?>><?php echo esc_html( $size['label'] ); ?></option>
1262 <?php endforeach; ?>
1263 </select>
1264 </div>
1265 <div class="inline then then_thumbnail_size" style="margin-left: 1em;">
1266 <label for="thumbnail_width"><?php esc_html_e( 'width', 'strong-testimonials' ); ?></label>
1267 <input id="thumbnail_width" class="input-number-px" type="text"
1268 name="view[data][thumbnail_width]"
1269 value="<?php echo esc_attr( $this->view['thumbnail_width'] ); ?>"> px
1270 <span style="display: inline-block; color: #BBB; margin: 0 1em;">|</span>
1271 <label for="thumbnail_height"><?php esc_html_e( 'height', 'strong-testimonials' ); ?></label>
1272 <input id="thumbnail_height" class="input-number-px" type="text"
1273 name="view[data][thumbnail_height]"
1274 value="<?php echo esc_attr( $this->view['thumbnail_height'] ); ?>"> px
1275 </div>
1276 </div>
1277 </div>
1278 <div class="row">
1279 <div class="row-inner">
1280 <div class="inline">
1281 <input type="checkbox" id="view-lightbox" class="if toggle" name="view[data][lightbox]"
1282 value="1" <?php checked( $this->view['lightbox'] ); ?> class="checkbox">
1283 <label for="view-lightbox"><?php esc_html_e( 'Open full-size image in a lightbox', 'strong-testimonials' ); ?></label>
1284 </div>
1285 <div class="inline then then_lightbox">
1286 <p class="description"><?php esc_html_e( 'Requires a lightbox provided by your theme or another plugin.', 'strong-testimonials' ); ?></p>
1287 </div>
1288 </div>
1289 </div>
1290
1291 <div class="row">
1292 <div class="row-inner">
1293 <div class="inline then then_lightbox input" style="display: none;">
1294 <label for="view-lightbox_class"><?php esc_html_e( 'CSS class', 'strong-testimonials' ); ?></label>
1295 <input type="text" id="view-lightbox_class" class="medium inline"
1296 name="view[data][lightbox_class]"
1297 value="<?php echo esc_attr( $this->view['lightbox_class'] ); ?>">
1298 <p class="inline description tall"><?php esc_html_e( 'To add a class to the image link.', 'strong-testimonials' ); ?></p>
1299 </div>
1300 </div>
1301 </div>
1302 <div class="row">
1303 <div class="row-inner">
1304 <div class="inline">
1305 <label for="view-gravatar"><?php esc_html_e( 'If no Featured Image', 'strong-testimonials' ); ?></label>
1306 <select id="view-gravatar" class="if select selectper" name="view[data][gravatar]">
1307 <option value="no" <?php selected( $this->view['gravatar'], 'no' ); ?>><?php esc_html_e( 'show nothing', 'strong-testimonials' ); ?></option>
1308 <option value="yes" <?php selected( $this->view['gravatar'], 'yes' ); ?>><?php esc_html_e( 'show Gravatar', 'strong-testimonials' ); ?></option>
1309 <option value="if" <?php selected( $this->view['gravatar'], 'if' ); ?>><?php esc_html_e( 'show Gravatar only if found', 'strong-testimonials' ); ?></option>
1310 <?php do_action( 'wpmtst_avatar_options', $this->view ); ?>
1311 </select>
1312 </div>
1313 <div class="inline">
1314 <div class="then fast then_not_no then_not_default then_not_initials then_not_wp_avatars then_yes then_if"
1315 style="display: none;">
1316 <p class="description tall"><a
1317 href="<?php echo esc_url( admin_url( 'options-discussion.php' ) ); ?>"><?php esc_html_e( 'Gravatar settings', 'strong-testimonials' ); ?></a>
1318 </p>
1319 </div>
1320 </div>
1321 <?php do_action( 'after_no_featured_image', $this->view ); ?>
1322 </div>
1323 </div>
1324 </div><!-- .then_images -->
1325 </td>
1326 <?php
1327 }
1328
1329 /**
1330 * Render ST content field
1331 *
1332 * @since 2.51.5
1333 */
1334 private function render_field_content() {
1335
1336 ?>
1337 <td colspan="2">
1338 <!-- Content type -->
1339 <div id="option-content" class="row">
1340 <div class="row-inner">
1341 <!-- select -->
1342 <div class="inline">
1343 <select id="view-content" class="if selectper min-width-1 label-not-adjacent"
1344 name="view[data][content]">
1345 <option value="entire" <?php selected( 'entire', $this->view['content'] ); ?>><?php echo esc_html( _x( 'entire content', 'display setting', 'strong-testimonials' ) ); ?></option>
1346 <option value="truncated" <?php selected( 'truncated', $this->view['content'] ); ?>><?php echo esc_html( _x( 'automatic excerpt', 'display setting', 'strong-testimonials' ) ); ?></option>
1347 <option value="excerpt" <?php selected( 'excerpt', $this->view['content'] ); ?>><?php echo esc_html( _x( 'manual excerpt', 'display setting', 'strong-testimonials' ) ); ?></option>
1348 </select>
1349 </div>
1350 <!-- info & screenshot -->
1351 <div class="inline then fast then_truncated then_not_entire then_not_excerpt"
1352 style="display: none;">
1353 <p class="description"><?php esc_html_e( 'This will strip tags like &lt;em&gt; and &lt;strong&gt;.', 'strong-testimonials' ); ?></p>
1354 </div>
1355 <div class="inline then fast then_not_truncated then_not_entire then_excerpt"
1356 style="display: none;">
1357 <p class="description">
1358 <?php
1359 // translators: %s is the URL for a Thickbox popup showing a screenshot.
1360 printf( wp_kses_post( __( 'To create manual excerpts, you may need to enable them in the post editor like in this <a href="%s" class="thickbox">screenshot</a>.', 'strong-testimonials' ) ), esc_url( '#TB_inline?width=&height=210&inlineId=screenshot-screen-options' ) );
1361 ?>
1362 <span class="screenshot" id="screenshot-screen-options" style="display: none;"><img
1363 src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>img/screen-options.png"
1364 width="600"></span>
1365 </p>
1366 </div>
1367 </div>
1368 </div>
1369 <!-- Excerpt length -->
1370 <div id="option-content-length" class="row then then_not_entire then_excerpt then_truncated"
1371 style="display: none;">
1372 <div class="row-inner">
1373 <!-- info -->
1374 <div class="inline tight then then_excerpt then_not_truncated" style="display: none;">
1375 <span><?php esc_html_e( 'If no manual excerpt, create an excerpt using', 'strong-testimonials' ); ?></span>
1376 </div>
1377 <!-- default or custom? -->
1378 <div class="inline">
1379 <label>
1380 <select id="view-use_default_length" class="if selectgroup min-width-1"
1381 name="view[data][use_default_length]">
1382 <option value="1" <?php selected( $this->view['use_default_length'] ); ?>><?php echo esc_html( _x( 'default length', 'display setting', 'strong-testimonials' ) ); ?></option>
1383 <option value="0" <?php selected( ! $this->view['use_default_length'] ); ?>><?php echo esc_html( _x( 'custom length', 'display setting', 'strong-testimonials' ) ); ?></option>
1384 </select>
1385 </label>
1386 </div>
1387 <!-- 1st option: default -->
1388 <div class="inline then fast then_use_default_length then_1 then_not_0" style="display: none;">
1389 <label for="view-use_default_length" class="inline-middle"><p
1390 class="description tall"><?php esc_html_e( 'The default length is 55 words but your theme may override that.', 'strong-testimonials' ); ?></p>
1391 </label>
1392 </div>
1393 <!-- 2nd option: length -->
1394 <div class="inline then fast then_use_default_length then_0 then_not_1" style="display: none;">
1395 <label class="inline-middle">
1396 <?php
1397 // translators: %s is an input field where the user can specify the number of words for the excerpt length.
1398 printf( esc_html_x( 'the first %s words', 'the excerpt length', 'strong-testimonials' ), '<input id="view-excerpt_length" class="input-incremental" type="number" min="1" max="999" name="view[data][excerpt_length]" value="' . esc_attr( $this->view['excerpt_length'] ) . '">' );
1399 ?>
1400 </label>
1401 </div>
1402 </div>
1403 </div><!-- #option-content-length -->
1404
1405 <!-- Read-more link -->
1406 <div id="option-content-read-more" class="row then then_not_entire then_excerpt then_truncated"
1407 style="display: none;">
1408 <div class="row-inner subgroup">
1409 <!-- action: full post or in place -->
1410 <div class="row-inner">
1411 <div class="inline"><?php echo wp_kses_post( __( 'Add a <strong>Read more</strong> link to', 'strong-testimonials' ) ); ?></div>
1412 <div class="inline tight">
1413 <label>
1414 <select id="view-more_post_in_place" class="if selectgroup"
1415 name="view[data][more_post_in_place]">
1416 <option value="0" <?php selected( ! $this->view['more_post_in_place'] ); ?>><?php esc_html_e( 'the full testimonial', 'strong-testimonials' ); ?></option>
1417 <option value="1" <?php selected( $this->view['more_post_in_place'] ); ?>><?php esc_html_e( 'expand content in place', 'strong-testimonials' ); ?></option>
1418 </select>
1419 </label>
1420 </div>
1421 </div>
1422 <!-- ellipsis -->
1423 <div class="row-inner">
1424 <div class="then then_use_default_more then_0 then_not_1" style="display: none;">
1425 <div class="inline">
1426 <label>
1427 <select id="view-more_post_ellipsis" class="if selectgroup"
1428 name="view[data][more_post_ellipsis]">
1429 <option value="1" <?php selected( $this->view['more_post_ellipsis'] ); ?>><?php esc_html_e( 'with an ellipsis', 'strong-testimonials' ); ?></option>
1430 <option value="0" <?php selected( ! $this->view['more_post_ellipsis'] ); ?>><?php esc_html_e( 'without an ellipsis', 'strong-testimonials' ); ?></option>
1431 </select>
1432 </label>
1433 </div>
1434 <div class="inline then then_excerpt then_not_truncated" style="display: none;">
1435 <p class="description"><?php esc_html_e( 'Automatic excerpt only.', 'strong-testimonials' ); ?></p>
1436 </div>
1437 </div>
1438 </div>
1439 <!-- default or custom -->
1440 <div class="row-inner">
1441 <div class="inline tight then fast then_more_post_in_place then_1 then_not_0"
1442 style="display: none;">
1443 <?php esc_html_e( 'with link text to read more', 'strong-testimonials' ); ?>
1444 </div>
1445 <div class="inline then fast then_more_post_in_place then_0 then_not_1" style="display: none;">
1446 <label>
1447 <select id="view-use_default_more" class="if selectgroup min-width-1"
1448 name="view[data][use_default_more]">
1449 <option value="1" <?php selected( $this->view['use_default_more'] ); ?>><?php echo esc_html( _x( 'with default link text', 'display setting', 'strong-testimonials' ) ); ?></option>
1450 <option value="0" <?php selected( ! $this->view['use_default_more'] ); ?>><?php echo esc_html( _x( 'with custom link text', 'display setting', 'strong-testimonials' ) ); ?></option>
1451 </select>
1452 </label>
1453 </div>
1454 <div class="inline then fast then_use_default_more then_1 then_not_0" style="display: none;">
1455 <p class="description"><?php esc_html_e( 'If you only see [&hellip;] without a link then use the custom link text instead.', 'strong-testimonials' ); ?></p>
1456 </div>
1457 <!-- read more -->
1458 <div class="inline then fast then_use_default_more then_0 then_not_1" style="display: none;">
1459 <span id="option-link-text" class="inline-span">
1460 <label for="view-more_post_text">
1461 <input type="text" id="view-more_post_text" name="view[data][more_post_text]"
1462 value="<?php echo esc_attr( $this->view['more_post_text'] ); ?>" size="22"
1463 placeholder="<?php esc_html_e( 'enter a phrase', 'strong-testimonials' ); ?>">
1464 </label>
1465 </span>
1466 </div>
1467 <div class="inline then fast then_use_default_more then_0 then_not_1" style="display: none;">
1468 <span id="option-inline-link-text" class="inline-span">
1469 <input class="checkbox" id="view-more_post_text_inline" name="view[data][more_post_text_inline]" value="1"
1470 type="checkbox" <?php checked( isset( $this->view['more_post_text_inline'] ) ? $this->view['more_post_text_inline'] : false ); ?>/>
1471 <label for="view-more_post_text_inline"> <?php echo wp_kses_post( __( 'show inline', 'strong-testimonials' ) ); ?></label>
1472 </span>
1473 </div>
1474 </div>
1475 <!-- read less -->
1476 <div class="row-inner then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
1477 <div class="inline tight">
1478 <?php esc_html_e( 'and link text to read less', 'strong-testimonials' ); ?>
1479 </div>
1480 <div class="inline tight">
1481 <span id="option-link-text-less" class="inline-span">
1482 <label for="view-less_post_text">
1483 <input type="text" id="view-less_post_text" name="view[data][less_post_text]"
1484 value="<?php echo esc_attr( $this->view['less_post_text'] ); ?>" size="22"
1485 placeholder="<?php esc_html_e( 'enter a phrase', 'strong-testimonials' ); ?>">
1486 </label>
1487 </span>
1488 <p class="inline description"><?php esc_html_e( 'Leave blank to leave content expanded without a link.', 'strong-testimonials' ); ?></p>
1489 </div>
1490 </div>
1491 <!-- automatic or both -->
1492 <div class="row-inner then then_excerpt then_not_truncated" style="display: none;">
1493 <div class="inline">
1494 <label>
1495 <select id="view-more_full_post" class="if selectgroup"
1496 name="view[data][more_full_post]">
1497 <option value="0" <?php selected( $this->view['more_full_post'], 0 ); ?>><?php echo esc_html( _x( 'for automatic excerpt only', 'display setting', 'strong-testimonials' ) ); ?></option>
1498 <option value="1" <?php selected( $this->view['more_full_post'], 1 ); ?>><?php echo esc_html( _x( 'for both automatic and manual excerpts', 'display setting', 'strong-testimonials' ) ); ?></option>
1499 </select>
1500 </label>
1501 </div>
1502 </div>
1503 <div class="row-inner">
1504 <div class="row-inner then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
1505 <div class="html-content-checkbox">
1506 <input class="checkbox" id="view-html-content" name="view[data][html_content]" value="1"
1507 type="checkbox" <?php checked( isset( $this->view['html_content'] ) ? $this->view['html_content'] : false ); ?>/>
1508 <label for="view-html-content"><?php echo wp_kses_post( __( 'Show <strong>html content</strong>.', 'strong-testimonials' ) ); ?></label>
1509 </div>
1510 </div>
1511 </div>
1512 </div>
1513 </div>
1514 <div class="row links then then_not_entire then_truncated then_excerpt" style="display: none;">
1515 <p class="description tall solo">
1516 <?php
1517 // translators: %s is a link to a page about WordPress excerpts.
1518 printf( esc_html__( '%s about WordPress excerpts', 'strong-testimonials' ), sprintf( '<a href="%s" target="_blank">%s</a>', esc_url( 'http://buildwpyourself.com/wordpress-manual-excerpts-more-tag/' ), esc_html__( 'Learn more', 'strong-testimonials' ) ) );
1519 ?>
1520 </p>
1521 </div>
1522 </td>
1523 <?php
1524 }
1525
1526 /**
1527 * Render ST client field
1528 *
1529 * @since 2.51.5
1530 */
1531 private function render_field_client_section() {
1532
1533 ?>
1534 <td colspan="2">
1535 <div id="client-section-table">
1536 <div id="custom-field-list2" class="fields">
1537 <?php
1538 if ( isset( $this->view['client_section'] ) ) {
1539 foreach ( $this->view['client_section'] as $key => $field ) {
1540 wpmtst_view_field_inputs( $key, $field );
1541 }
1542 }
1543 ?>
1544 </div>
1545 </div>
1546 <div id="add-field-bar" class="is-below">
1547 <input id="add-field" type="button" name="add-field" source="view[data]"
1548 value="<?php esc_html_e( 'Add Field', 'strong-testimonials' ); ?>" class="button-secondary"/>
1549 </div>
1550 </td>
1551 <?php
1552 }
1553
1554 /**
1555 * Render ST pagination
1556 *
1557 * @since 2.51.5
1558 */
1559 private function render_field_pagination() {
1560 /**
1561 * Attempt to repair bug from 2.28.2
1562 */
1563 if ( ! isset( $this->view['pagination_settings']['end_size'] ) || ! $this->view['pagination_settings']['end_size'] ) {
1564 $this->view['pagination_settings']['end_size'] = 1;
1565 }
1566 if ( ! isset( $this->view['pagination_settings']['mid_size'] ) || ! $this->view['pagination_settings']['mid_size'] ) {
1567 $this->view['pagination_settings']['mid_size'] = 2;
1568 }
1569 if ( ! isset( $this->view['pagination_settings']['per_page'] ) || ! $this->view['pagination_settings']['per_page'] ) {
1570 $this->view['pagination_settings']['per_page'] = 5;
1571 }
1572 $links = '<span class="help-links">';
1573 $links .= '<a href="#tab-panel-wpmtst-help-pagination" class="open-help-tab">' . __( 'Help', 'strong-testimonials' ) . '</a>';
1574 $links .= '</span>';
1575 ?>
1576 <td>
1577 <div class="row then then_pagination" style="display: none;">
1578 <div class="row-inner">
1579 <div class="inline">
1580 <label for="view-pagination_type">
1581 <select class="if selectper" id="view-pagination_type"
1582 name="view[data][pagination_settings][type]">
1583 <option value="simple" <?php selected( 'simple', $this->view['pagination_settings']['type'] ); ?>><?php esc_html_e( 'simple', 'strong-testimonials' ); ?></option>
1584 <option value="standard" <?php selected( 'standard', $this->view['pagination_settings']['type'] ); ?>><?php esc_html_e( 'WordPress standard', 'strong-testimonials' ); ?></option>
1585 <?php do_action( 'wpmtst_form_pagination_options_after', $this->view ); ?>
1586 </select>
1587 </label>
1588 </div>
1589 <div class="inline then fast then_simple then_not_standard then_not_infinitescroll then_not_loadmore"
1590 style="display: none;">
1591 <p class="description">
1592 <?php esc_html_e( 'Using JavaScript. Intended for small scale.', 'strong-testimonials' ); ?>
1593 <?php echo wp_kses_post( $links ); ?>
1594 </p>
1595 </div>
1596 <div class="inline then fast then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1597 style="display: none;">
1598 <p class="description">
1599 <?php esc_html_e( 'Using paged URLs: /page/2, /page/3, etc. Best for large scale.', 'strong-testimonials' ); ?>
1600 <?php echo wp_kses_post( $links ); ?>
1601 </p>
1602 </div>
1603 </div>
1604 </div>
1605 <div class="row then then_pagination" style="display: none;">
1606 <div class="row-inner">
1607 <div class="inline">
1608 <label for="view-per_page"><?php echo esc_html( _x( 'Per page', 'quantity', 'strong-testimonials' ) ); ?></label>
1609 <input class="input-incremental" id="view-per_page"
1610 name="view[data][pagination_settings][per_page]" type="number" min="1" step="1"
1611 value="<?php echo esc_attr( $this->view['pagination_settings']['per_page'] ); ?>"/>
1612 </div>
1613 <div class="inline then then_simple then_standard then_not_infinitescroll then_not_loadmore">
1614 <label for="view-nav"><?php esc_html_e( 'Navigation', 'strong-testimonials' ); ?></label>
1615 <select id="view-nav" name="view[data][pagination_settings][nav]">
1616 <option value="before" <?php selected( $this->view['pagination_settings']['nav'], 'before' ); ?>><?php esc_html_e( 'before', 'strong-testimonials' ); ?></option>
1617 <option value="after" <?php selected( $this->view['pagination_settings']['nav'], 'after' ); ?>><?php esc_html_e( 'after', 'strong-testimonials' ); ?></option>
1618 <option value="before,after" <?php selected( $this->view['pagination_settings']['nav'], 'before,after' ); ?>><?php esc_html_e( 'before & after', 'strong-testimonials' ); ?></option>
1619 </select>
1620 </div>
1621 </div>
1622 <div class="row then then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1623 style="display: none;">
1624 <div class="row-inner">
1625 <div class="inline">
1626 <label for="view-pagination-show_all">
1627 <select class="if select" id="view-pagination-show_all"
1628 name="view[data][pagination_settings][show_all]">
1629 <option value="on" <?php selected( $this->view['pagination_settings']['show_all'] ); ?>><?php esc_html_e( 'Show all page numbers', 'strong-testimonials' ); ?></option>
1630 <option value="off"
1631 <?php selected( ! $this->view['pagination_settings']['show_all'] ); ?>class="trip"><?php esc_html_e( 'Show condensed page numbers', 'strong-testimonials' ); ?></option>
1632 </select>
1633 </label>
1634 </div>
1635 <div class="inline then then_show_all" style="display: none;">
1636 <div class="inline">
1637 <label for="view-pagination-end_size"><?php echo esc_html( _x( 'End size', 'quantity', 'strong-testimonials' ) ); ?></label>
1638 <input class="input-incremental" id="view-pagination-end_size"
1639 name="view[data][pagination_settings][end_size]" type="number" min="1" step="1"
1640 value="<?php echo esc_attr( $this->view['pagination_settings']['end_size'] ); ?>"/>
1641 </div>
1642 <div class="inline">
1643 <label for="view-pagination-mid_size"><?php echo esc_html( _x( 'Middle size', 'quantity', 'strong-testimonials' ) ); ?></label>
1644 <input class="input-incremental" id="view-pagination-mid_size"
1645 name="view[data][pagination_settings][mid_size]" type="number" min="1" step="1"
1646 value="<?php echo esc_attr( $this->view['pagination_settings']['mid_size'] ); ?>"/>
1647 </div>
1648 </div>
1649 </div>
1650 </div>
1651 <div class="row then then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1652 style="display: none;">
1653 <div class="row-inner">
1654 <div class="inline inline-middle">
1655 <input class="if toggle checkbox" id="view-pagination-prev_next"
1656 name="view[data][pagination_settings][prev_next]" type="checkbox"
1657 value="1" <?php checked( $this->view['pagination_settings']['prev_next'] ); ?>>
1658 <label for="view-pagination-prev_next"><?php esc_html_e( 'Show previous/next links', 'strong-testimonials' ); ?></label>
1659 </div>
1660 <div class="then then_prev_next inline inline-middle">
1661 <label for="view-pagination-prev_text"><?php esc_html_e( 'Previous text', 'strong-testimonials' ); ?></label>
1662 <input class="code" id="view-pagination-prev_text"
1663 name="view[data][pagination_settings][prev_text]" type="text"
1664 value="<?php echo esc_attr( htmlentities( $this->view['pagination_settings']['prev_text'] ) ); ?>">
1665 </div>
1666 <div class="then then_prev_next inline inline-middle">
1667 <label for="view-pagination-next_text"><?php esc_html_e( 'Next text', 'strong-testimonials' ); ?></label>
1668 <input class="code" id="view-pagination-next_text"
1669 name="view[data][pagination_settings][next_text]" type="text"
1670 value="<?php echo esc_attr( htmlentities( $this->view['pagination_settings']['next_text'] ) ); ?>">
1671 </div>
1672 </div>
1673 </div>
1674 <div class="row then then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1675 style="display: none;">
1676 <div class="row-inner">
1677 <div class="inline">
1678 <label for="view-pagination-before_page_number"><?php esc_html_e( 'Before page number', 'strong-testimonials' ); ?></label>
1679 <input class="small-text" id="view-pagination-before_page_number"
1680 name="view[data][pagination_settings][before_page_number]" type="text"
1681 value="<?php echo esc_attr( $this->view['pagination_settings']['before_page_number'] ); ?>">
1682 </div>
1683 <div class="inline">
1684 <label for="view-pagination-after_page_number"><?php esc_html_e( 'After page number', 'strong-testimonials' ); ?></label>
1685 <input class="small-text" id="view-pagination-after_page_number"
1686 name="view[data][pagination_settings][after_page_number]" type="text"
1687 value="<?php echo esc_attr( $this->view['pagination_settings']['after_page_number'] ); ?>">
1688 </div>
1689 </div>
1690 </div>
1691 </div>
1692 <?php do_action( 'wpmtst_view_editor_pagination_row_end' ); ?>
1693 </td>
1694 <?php
1695 }
1696
1697 /**
1698 * Render ST read more
1699 *
1700 * @since 2.51.5
1701 */
1702 private function render_field_read_more_page() {
1703
1704 $custom_list = apply_filters( 'wpmtst_custom_pages_list', array(), $this->view );
1705 $pages_list = apply_filters( 'wpmtst_pages_list', wpmtst_get_pages() );
1706 $posts_list = apply_filters( 'wpmtst_posts_list', wpmtst_get_posts() );
1707
1708 ?>
1709 <td>
1710 <div class="row then then_more_page" style="display: none;">
1711 <!-- Select page -->
1712 <div class="row then then_more_page" style="display: none;">
1713 <div class="row-inner">
1714 <label>
1715 <select id="view-page" name="view[data][more_page_id]">
1716 <option value=""><?php esc_html_e( '&mdash; select &mdash;', 'strong-testimonials' ); ?></option>
1717 <?php
1718 do_action( 'wpmtst_readmore_page_list', $this->view );
1719
1720 if ( $custom_list ) {
1721 ?>
1722 <optgroup label="<?php esc_html_e( 'Custom', 'strong-testimonials' ); ?>">
1723 <?php
1724 foreach ( $custom_list as $page ) {
1725 echo wp_kses_post( $page );
1726 }
1727 ?>
1728 </optgroup>
1729 <?php } ?>
1730
1731 <optgroup label="<?php esc_attr_e( 'Pages', 'strong-testimonials' ); ?>">
1732
1733 <?php foreach ( $pages_list as $pages ) : ?>
1734 <option value="<?php echo esc_attr( $pages->ID ); ?>" <?php selected( isset( $this->view['more_page_id'] ) ? $this->view['more_page_id'] : 0, $pages->ID ); ?>><?php echo esc_html( $pages->post_title ); ?></option>
1735 <?php endforeach; ?>
1736
1737 </optgroup>
1738
1739 <optgroup label="<?php esc_attr_e( 'Posts', 'strong-testimonials' ); ?>">
1740
1741 <?php foreach ( $posts_list as $posts ) : ?>
1742 <option value="<?php echo esc_attr( $posts->ID ); ?>" <?php selected( isset( $this->view['more_page_id'] ) ? $this->view['more_page_id'] : 0, $posts->ID ); ?>><?php echo esc_html( $posts->post_title ); ?></option>
1743 <?php endforeach; ?>
1744
1745 </optgroup>
1746 </select>
1747 </label>
1748 <label for="view-page_id2"><?php echo esc_html( _x( 'or enter its ID or slug', 'to select a target page', 'strong-testimonials' ) ); ?></label>
1749 <input type="text" id="view-page_id2"
1750 name="view[data][more_page_id2]" <?php echo( isset( $this->view['more_page_id'] ) ? 'value="' . esc_attr( $this->view['more_page_id'] ) . '"' : '' ); ?>
1751 size="30">
1752 </div>
1753 </div>
1754 <!-- Link text -->
1755 <div class="row">
1756 <div class="row-inner">
1757 <div class="inline">
1758 <label for="view-more_page_text"><?php esc_html_e( 'with link text', 'strong-testimonials' ); ?></label>
1759 <input type="text" id="view-more_page_text" name="view[data][more_page_text]"
1760 value="<?php echo esc_attr( $this->view['more_page_text'] ); ?>" size="50">
1761 </div>
1762 </div>
1763 </div>
1764 <!-- location -->
1765 <div class="row">
1766 <div class="row-inner">
1767 <label>
1768 <select id="view-more_page_hook" name="view[data][more_page_hook]">
1769 <option value="wpmtst_view_footer" <?php selected( 'wpmtst_view_footer', $this->view['more_page_hook'] ); ?>><?php echo esc_html( _x( 'after the last testimonial', 'display setting', 'strong-testimonials' ) ); ?></option>
1770 <option value="wpmtst_after_testimonial" <?php selected( 'wpmtst_after_testimonial', $this->view['more_page_hook'] ); ?>><?php echo esc_html( _x( 'in each testimonial', 'display setting', 'strong-testimonials' ) ); ?></option>
1771 </select>
1772 </label>
1773 </div>
1774 </div>
1775 </div>
1776 </td>
1777 <?php
1778 }
1779
1780 /**
1781 * Render ST slideshow number
1782 *
1783 * @since 2.51.5
1784 */
1785 private function render_field_slideshow_num() {
1786
1787 ?>
1788 <td>
1789 <div class="row">
1790 <div class="inline inline-middle">
1791 <label>
1792 <select id="view-slider_type" name="view[data][slideshow_settings][type]"
1793 class="if selectgroup">
1794 <option value="show_single" <?php selected( $this->view['slideshow_settings']['type'], 'show_single' ); ?>><?php esc_html_e( 'single', 'strong-testimonials' ); ?></option>
1795 <option value="show_multiple" <?php selected( $this->view['slideshow_settings']['type'], 'show_multiple' ); ?>><?php esc_html_e( 'multiple', 'strong-testimonials' ); ?></option>
1796 </select>
1797 </label>
1798 <div class="option-desc singular" style="display: none;">
1799 <?php esc_html_e( 'slide at a time', 'strong-testimonials' ); ?>
1800 </div>
1801 <div class="option-desc plural" style="display: none;">
1802 <?php esc_html_e( 'slides at a time with these responsive breakpoints:', 'strong-testimonials' ); ?>
1803 </div>
1804 </div>
1805 </div>
1806 </td>
1807 <td>
1808 <div class="inline then then_slider_type then_not_show_single then_show_multiple" style="display: none;">
1809 <div class="row">
1810 <div class="inner-table is-below">
1811 <div class="inner-table-row bordered header">
1812 <div class="inner-table-cell"><?php esc_html_e( 'minimum screen width', 'strong-testimonials' ); ?></div>
1813 <div class="inner-table-cell"><?php esc_html_e( 'show', 'strong-testimonials' ); ?></div>
1814 <div class="inner-table-cell"><?php esc_html_e( 'margin', 'strong-testimonials' ); ?></div>
1815 <div class="inner-table-cell"><?php esc_html_e( 'move', 'strong-testimonials' ); ?></div>
1816 </div>
1817 <?php foreach ( $this->view['slideshow_settings']['breakpoints'] as $key => $breakpoint ) : ?>
1818 <div class="inner-table-row bordered">
1819 <div class="inner-table-cell">
1820 <label>
1821 <input id="view-breakpoint_<?php echo esc_attr( $key ); ?>"
1822 name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][width]"
1823 value="<?php echo esc_attr( $breakpoint['width'] ); ?>" type="number"
1824 class="input-incremental"> px
1825 </label>
1826 </div>
1827 <div class="inner-table-cell">
1828 <label>
1829 <select id="view-max_slides_<?php echo esc_attr( $key ); ?>"
1830 name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][max_slides]"
1831 class="if selectgroup">
1832 <option value="1" <?php selected( $breakpoint['max_slides'], 1 ); ?>>1
1833 </option>
1834 <option value="2" <?php selected( $breakpoint['max_slides'], 2 ); ?>>2
1835 </option>
1836 <option value="3" <?php selected( $breakpoint['max_slides'], 3 ); ?>>3
1837 </option>
1838 <option value="4" <?php selected( $breakpoint['max_slides'], 4 ); ?>>4
1839 </option>
1840 </select>
1841 </label>
1842 <div class="option-desc singular"
1843 style="display: none;"><?php esc_html_e( 'slide', 'strong-testimonials' ); ?></div>
1844 <div class="option-desc plural"
1845 style="display: none;"><?php esc_html_e( 'slides', 'strong-testimonials' ); ?></div>
1846 </div>
1847 <div class="inner-table-cell">
1848 <input id="view-margin_<?php echo esc_attr( $key ); ?>"
1849 name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][margin]"
1850 value="<?php echo esc_attr( $breakpoint['margin'] ); ?>" type="number"
1851 min="1" step="1" size="3" class="input-incremental"/> px
1852 </div>
1853 <div class="inner-table-cell">
1854 <label>
1855 <select id="view-move_slides_<?php echo esc_attr( $key ); ?>"
1856 name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][move_slides]"
1857 class="if selectgroup">
1858 <option value="1" <?php selected( $breakpoint['move_slides'], 1 ); ?>>1
1859 </option>
1860 <option value="2" <?php selected( $breakpoint['move_slides'], 2 ); ?>>2
1861 </option>
1862 <option value="3" <?php selected( $breakpoint['move_slides'], 3 ); ?>>3
1863 </option>
1864 <option value="4" <?php selected( $breakpoint['move_slides'], 4 ); ?>>4
1865 </option>
1866 </select>
1867 </label>
1868 <div class="option-desc singular"
1869 style="display: none;"><?php esc_html_e( 'slide', 'strong-testimonials' ); ?></div>
1870 <div class="option-desc plural"
1871 style="display: none;"><?php esc_html_e( 'slides', 'strong-testimonials' ); ?></div>
1872 </div>
1873 </div>
1874 <?php endforeach; ?>
1875 </div>
1876 </div>
1877 <div class="is-below">
1878 <input id="restore-default-breakpoints" type="button" name="restore-default-breakpoints"
1879 value="<?php esc_html_e( 'Restore Default Breakpoints', 'strong-testimonials' ); ?>"
1880 class="button-secondary"/>
1881 <span id="restored-message"><?php esc_html_e( 'defaults restored', 'strong-testimonials' ); ?></span>
1882 </div>
1883 </div>
1884 </td>
1885 <?php
1886 }
1887
1888 /**
1889 * Render ST Slideshow transition
1890 *
1891 * @since 2.51.5
1892 */
1893 private function render_field_slideshow_transition() {
1894
1895 ?>
1896 <td>
1897 <div class="row">
1898 <div class="inline inline-middle">
1899 <label for="view-pause"><?php echo esc_html( _x( 'Show slides for', 'slideshow setting', 'strong-testimonials' ) ); ?></label>
1900 <input type="number" id="view-pause" class="input-incremental"
1901 name="view[data][slideshow_settings][pause]" min=".1" step=".1"
1902 value="<?php echo esc_attr( $this->view['slideshow_settings']['pause'] ); ?>" size="3"/>
1903 <?php echo esc_html( _x( 'seconds', 'time setting', 'strong-testimonials' ) ); ?>
1904 </div>
1905 <div class="inline inline-middle then then_slider_type then_show_single then_not_show_multiple fast"
1906 style="display: none;">
1907 <label for="view-effect"><?php esc_html_e( 'then', 'strong-testimonials' ); ?></label>
1908 <select id="view-effect" name="view[data][slideshow_settings][effect]" class="if selectnot">
1909 <?php foreach ( $this->view_options['slideshow_effect'] as $key => $label ) : ?>
1910 <option value="<?php echo esc_attr( $key ); ?>"
1911 <?php selected( $this->view['slideshow_settings']['effect'], $key ); ?>
1912 <?php echo 'none' === $key ? 'class="trip"' : ''; ?>><?php echo esc_html( $label ); ?></option>
1913 <?php endforeach; ?>
1914 </select>
1915 </div>
1916 <div class="inline inline-middle then then_slider_type then_not_show_single then_show_multiple fast"
1917 style="display: none;">
1918 <?php esc_html_e( 'then', 'strong-testimonials' ); ?><?php echo esc_html( _x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ) ); ?>
1919 </div>
1920 <div class="inline inline-middle then then_effect then_none">
1921 <label for="view-speed"><?php esc_html_e( 'for', 'strong-testimonials' ); ?></label>
1922 <input type="number" id="view-speed" class="input-incremental"
1923 name="view[data][slideshow_settings][speed]" min=".1" step=".1"
1924 value="<?php echo esc_attr( $this->view['slideshow_settings']['speed'] ); ?>" size="3"/>
1925 <?php echo esc_html( _x( 'seconds', 'time setting', 'strong-testimonials' ) ); ?>
1926 </div>
1927 </div>
1928 </td>
1929 <?php
1930 }
1931
1932 /**
1933 * Render ST Slideshow behavior
1934 *
1935 * @since 2.51.5
1936 */
1937 private function render_field_slideshow_behavior() {
1938
1939 ?>
1940 <td>
1941 <div class="row">
1942 <div class="inline inline-middle">
1943 <input type="checkbox" id="view-auto_start" name="view[data][slideshow_settings][auto_start]"
1944 value="0" <?php checked( $this->view['slideshow_settings']['auto_start'] ); ?>
1945 class="checkbox">
1946 <label for="view-auto_start"><?php echo esc_html( _x( 'Start automatically', 'slideshow setting', 'strong-testimonials' ) ); ?></label>
1947 </div>
1948 </div>
1949 <div class="row">
1950 <div class="inline inline-middle">
1951 <input type="checkbox" id="view-continuous_sliding"
1952 name="view[data][slideshow_settings][continuous_sliding]"
1953 value="0" <?php checked( $this->view['slideshow_settings']['continuous_sliding'] ); ?>
1954 class="checkbox">
1955 <label for="view-continuous_sliding"><?php echo esc_html( _x( 'Continuous Sliding', 'slideshow setting', 'strong-testimonials' ) ); ?></label>
1956 </div>
1957 </div>
1958 <div class="row">
1959 <div class="inline inline-middle">
1960 <input type="checkbox" id="view-auto_hover" name="view[data][slideshow_settings][auto_hover]"
1961 value="0" <?php checked( $this->view['slideshow_settings']['auto_hover'] ); ?>
1962 class="checkbox">
1963 <label for="view-auto_hover"><?php echo esc_html( _x( 'Pause on hover', 'slideshow setting', 'strong-testimonials' ) ); ?></label>
1964 </div>
1965 </div>
1966 <div class="row">
1967 <div class="inline inline-middle">
1968 <input type="checkbox" id="view-stop_auto_on_click"
1969 name="view[data][slideshow_settings][stop_auto_on_click]"
1970 value="0" <?php checked( $this->view['slideshow_settings']['stop_auto_on_click'] ); ?>
1971 class="checkbox">
1972 <label for="view-stop_auto_on_click"><?php echo esc_html( _x( 'Stop on interaction', 'slideshow setting', 'strong-testimonials' ) ); ?></label>
1973 </div>
1974 <div class="inline inline-middle">
1975 <p class="description"><?php esc_html_e( 'Recommended if using navigation.', 'strong-testimonials' ); ?></p>
1976 </div>
1977 </div>
1978 <?php
1979 if ( $this->view['slideshow_settings']['adapt_height'] ) {
1980 $height = 'dynamic';
1981 } else {
1982 $height = 'static';
1983 }
1984 ?>
1985 <div class="row">
1986 <div class="row-inner">
1987 <div class="inline">
1988 <label for="view-slideshow_height">
1989 <select id="view-slideshow_height" name="view[data][slideshow_settings][height]"
1990 class="if selectgroup">
1991 <?php foreach ( $this->view_options['slideshow_height'] as $key => $type ) : ?>
1992 <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
1993 <?php selected( $height, $key ); ?>>
1994 <?php echo esc_html( $type ); ?>
1995 </option>
1996 <?php endforeach; ?>
1997 </select>
1998 </label>
1999 </div>
2000 <div class="inline then then_slideshow_height then_dynamic then_not_static" style="display: none;">
2001 <label for="view-adapt_height_speed"><?php esc_html_e( 'Duration', 'strong-testimonials' ); ?></label>
2002 <input type="number" id="view-adapt_height_speed" class="input-incremental"
2003 name="view[data][slideshow_settings][adapt_height_speed]" min="0" step="0.1"
2004 value="<?php echo esc_attr( $this->view['slideshow_settings']['adapt_height_speed'] ); ?>"
2005 size="3"/>
2006 <?php echo esc_html( _x( 'seconds', 'time setting', 'strong-testimonials' ) ); ?>
2007 </div>
2008 <div class="inline then then_slideshow_height then_not_dynamic then_static" style="display: none;">
2009 <input type="checkbox" id="view-stretch" name="view[data][slideshow_settings][stretch]"
2010 value="1" <?php checked( $this->view['slideshow_settings']['stretch'] ); ?>
2011 class="checkbox">
2012 <label for="view-stretch"><?php esc_html_e( 'Stretch slides vertically', 'strong-testimonials' ); ?></label>
2013 <div class="inline description">
2014 <a href="#tab-panel-wpmtst-help-stretch"
2015 class="open-help-tab"><?php esc_html_e( 'Help', 'strong-testimonials' ); ?></a>
2016 </div>
2017 </div>
2018 </div>
2019 </div>
2020 <div class="row tall">
2021 <p class="description"><?php esc_html_e( 'The slideshow will pause if the browser window becomes inactive.', 'strong-testimonials' ); ?></p>
2022 </div>
2023 </td>
2024 <?php
2025 }
2026
2027 /**
2028 * Render ST Slideshow navigation
2029 *
2030 * @since 2.51.5
2031 */
2032 private function render_field_slideshow_navigation() {
2033
2034 ?>
2035 <td>
2036 <div class="row">
2037 <div class="row-inner">
2038 <div class="inline">
2039 <label for="view-slideshow_controls_type"><?php esc_html_e( 'Controls', 'strong-testimonials' ); ?></label>
2040 <select id="view-slideshow_controls_type" name="view[data][slideshow_settings][controls_type]"
2041 class="if selectnot">
2042
2043 <?php foreach ( $this->view_options['slideshow_nav_method']['controls'] as $key => $type ) : ?>
2044 <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
2045 <?php selected( $this->view['slideshow_settings']['controls_type'], $key ); ?>
2046 <?php
2047 if ( 'none' === $key ) {
2048 echo ' class="trip"';
2049 }
2050 ?>
2051 >
2052 <?php echo esc_html( $type['label'] ); ?>
2053 </option>
2054 <?php endforeach; ?>
2055
2056 </select>
2057 </div>
2058 <div class="inline then then_slideshow_controls_type" style="display: none;">
2059 <label for="view-slideshow_controls_style"><?php esc_html_e( 'Style', 'strong-testimonials' ); ?></label>
2060 <select id="view-slideshow_controls_style"
2061 name="view[data][slideshow_settings][controls_style]">
2062 <?php foreach ( $this->view_options['slideshow_nav_style']['controls'] as $key => $style ) : ?>
2063 <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $this->view['slideshow_settings']['controls_style'], $key ); ?>><?php echo esc_html( $style['label'] ); ?></option>
2064 <?php endforeach; ?>
2065 </select>
2066 </div>
2067 </div>
2068 </div>
2069 <div class="row">
2070 <div class="row-inner then then_has-pager">
2071 <div class="inline">
2072 <label for="view-slideshow_pager_type"><?php esc_html_e( 'Pagination', 'strong-testimonials' ); ?></label>
2073 <select id="view-slideshow_pager_type" name="view[data][slideshow_settings][pager_type]"
2074 class="if selectnot">
2075
2076 <?php foreach ( $this->view_options['slideshow_nav_method']['pager'] as $key => $type ) : ?>
2077 <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
2078 <?php selected( $this->view['slideshow_settings']['pager_type'], $key ); ?>
2079 <?php
2080 if ( 'none' === $key ) {
2081 echo ' class="trip"';
2082 }
2083 ?>
2084 >
2085 <?php echo esc_html( $type['label'] ); ?>
2086 </option>
2087 <?php endforeach; ?>
2088
2089 </select>
2090 </div>
2091 <div class="inline then then_slideshow_pager_type" style="display: none;">
2092 <label for="view-slideshow_pager_style"><?php esc_html_e( 'Style', 'strong-testimonials' ); ?></label>
2093 <select id="view-slideshow_pager_style" name="view[data][slideshow_settings][pager_style]"
2094 class="if selectnot">
2095 <?php foreach ( $this->view_options['slideshow_nav_style']['pager'] as $key => $style ) : ?>
2096 <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $this->view['slideshow_settings']['pager_style'], $key ); ?>><?php echo esc_html( $style['label'] ); ?></option>
2097 <?php endforeach; ?>
2098 </select>
2099 </div>
2100 </div>
2101 </div>
2102 <div class="row">
2103 <div class="row-inner">
2104 <div class="then then_slider_type then_show_single then_not_show_multiple" style="display: none;">
2105 <div class="inline then then_has-position" style="display: none;">
2106 <label for="view-slideshow_nav_position"><?php esc_html_e( 'Position', 'strong-testimonials' ); ?></label>
2107 <select id="view-slideshow_nav_position"
2108 name="view[data][slideshow_settings][nav_position]">
2109 <?php foreach ( $this->view_options['slideshow_nav_position'] as $key => $label ) : ?>
2110 <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $this->view['slideshow_settings']['nav_position'], $key ); ?>><?php echo esc_html( $label ); ?></option>
2111 <?php endforeach; ?>
2112 </select>
2113 <?php //esc_html_e( 'outside', 'strong-testimonials' ); ?>
2114 <?php esc_html_e( 'the testimonial frame', 'strong-testimonials' ); ?>
2115 </div>
2116 </div>
2117 </div>
2118 </div>
2119 </td>
2120 <?php
2121 }
2122
2123 /**
2124 * Render ST form category field
2125 *
2126 * @since 2.51.5
2127 */
2128 private function render_field_form_category() {
2129
2130 if ( $this->cat_count ) :
2131 ?>
2132 <td>
2133 <div class="table">
2134
2135 <?php if ( $this->cat_count > 5 ) : ?>
2136 <div class="table-row">
2137 <div class="table-cell">
2138 <div class="row" style="text-align: right; padding-bottom: 5px;">
2139 <input type="button" class="expand-cats button" value="expand list"/>
2140 </div>
2141 </div>
2142 </div>
2143 <?php endif; ?>
2144
2145 <div class="table-row">
2146 <div class="table-cell">
2147 <?php wpmtst_form_category_checklist( $this->view_cats_array ); ?>
2148 </div>
2149 </div>
2150 </div>
2151 </td>
2152 <?php else : ?>
2153 <td>
2154 <p class="description tall"><?php esc_html_e( 'No categories found', 'strong-testimonials' ); ?></p>
2155 </td>
2156 <?php
2157 endif;
2158 }
2159
2160 /**
2161 * Render ST form AJAX field
2162 *
2163 * @since 2.51.5
2164 */
2165 private function render_field_form_ajax() {
2166
2167 ?>
2168 <td>
2169 <p class="description tall"><?php echo wp_kses_post( __( 'This will override the <strong>Success Redirect</strong> setting.', 'strong-testimonials' ) ); ?></p>
2170 </td>
2171 <?php
2172 }
2173
2174 /**
2175 * Render ST template list field
2176 *
2177 * @since 2.51.5
2178 */
2179 private function render_field_template_list() {
2180
2181 // Assemble list of templates
2182 $templates = array(
2183 'display' => WPMST()->templates->get_templates( 'display' ),
2184 'form' => WPMST()->templates->get_templates( 'form' ),
2185 );
2186 $template_found = in_array( $this->view['template'], WPMST()->templates->get_template_keys(), true );
2187
2188 ?>
2189 <td colspan="2">
2190 <div id="view-template-list">
2191 <div class="radio-buttons">
2192
2193 <?php if ( ! $template_found ) : ?>
2194 <ul class="radio-list template-list">
2195 <li>
2196 <div>
2197 <input class="error" type="radio"
2198 id="<?php echo esc_attr( $this->view['template'] ); ?>"
2199 name="view[data][<?php echo esc_attr( $this->current_mode ); ?>]"
2200 value="<?php echo esc_attr( $this->view['template'] ); ?>" checked>
2201 <label for="<?php echo esc_attr( $this->view['template'] ); ?>"><?php echo esc_html( $this->view['template'] ); ?></label>
2202 </div>
2203 <div class="template-description">
2204 <p>
2205 <span class="dashicons dashicons-warning error"></span>&nbsp;
2206 <span class="error"><?php esc_html_e( 'not found', 'strong-testimonials' ); ?></span>
2207 </p>
2208 </div>
2209 </li>
2210 </ul>
2211 <?php endif; ?>
2212
2213 <ul class="radio-list template-list">
2214
2215 <?php foreach ( $templates[ $this->current_type ] as $key => $template ) : ?>
2216 <li>
2217 <div>
2218 <input type="radio" id="template-<?php echo esc_attr( $key ); ?>"
2219 name="view[data][<?php echo esc_attr( $this->current_mode ); ?>]"
2220 value="<?php echo esc_attr( $key ); ?>" <?php checked( $key, $this->view['template'] ); ?>>
2221 <label for="template-<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $template['config']['name'] ); ?></label>
2222 </div>
2223 <div class="template-description">
2224 <p><?php echo( isset( $template['config']['description'] ) && $template['config']['description'] ? esc_html( $template['config']['description'] ) : esc_html__( 'no description', 'strong-testimonials' ) ); ?></p>
2225 <div class="options">
2226 <div>
2227 <?php if ( ! isset( $template['config']['options'] ) || ! is_array( $template['config']['options'] ) ) : ?>
2228 <span><?php esc_html_e( 'No options', 'strong-testimonials' ); ?></span>
2229 <?php else : ?>
2230 <?php foreach ( $template['config']['options'] as $option ) : ?>
2231 <div style="margin-bottom: 10px;">
2232 <?php
2233 $name = sprintf( 'view[data][template_settings][%s][%s]', esc_attr( $key ), esc_attr( $option->name ) );
2234 $id = $key . '-' . $option->name;
2235
2236 switch ( $option->type ) {
2237 case 'select':
2238 // Get default if not set
2239 if ( ! isset( $this->view['template_settings'][ $key ][ $option->name ] ) ) {
2240 $this->view['template_settings'][ $key ][ $option->name ] = $option->default;
2241 }
2242
2243 if ( $option->label ) {
2244 printf( '<label for="%s">%s</label>', esc_attr( $id ), wp_kses_post( $option->label ) );
2245 }
2246
2247 printf( '<select id="%s" name="%s">', esc_attr( $id ), esc_attr( $name ) );
2248
2249 foreach ( $option->values as $value ) {
2250 $selected = selected( $value->value, $this->view['template_settings'][ $key ][ $option->name ], false );
2251 printf( '<option value="%s" %s>%s</option>', esc_attr( $value->value ), esc_attr( $selected ), esc_html( $value->description ) );
2252 }
2253
2254 echo '</select>';
2255 break;
2256 case 'radio':
2257 if ( ! isset( $this->view['template_settings'][ $key ][ $option->name ] ) ) {
2258 $this->view['template_settings'][ $key ][ $option->name ] = $option->default;
2259 }
2260
2261 foreach ( $option->values as $value ) {
2262 $checked = checked( $value->value, $this->view['template_settings'][ $key ][ $option->name ], false );
2263 printf( '<input type="radio" id="%s" name="%s" value="%s" %s>', esc_attr( $id ), esc_attr( $name ), esc_attr( $value->value ), esc_attr( $checked ) );
2264 printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $value->description ) );
2265 }
2266
2267 break;
2268 case 'colorpicker':
2269 if ( $option->label ) {
2270 printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $option->label ) );
2271 }
2272
2273 $value = isset( $this->view['template_settings'][ $key ][ $option->name ] ) ? $this->view['template_settings'][ $key ][ $option->name ] : $option->default;
2274 printf( '<input type="text" class="wp-color-picker-field" data-alpha="true" id="%s" name="%s" value="%s">', esc_attr( $id ), esc_attr( $name ), esc_attr( $value ) );
2275 break;
2276 default:
2277 do_action( 'wpmtst_views_render_template_option_' . $option->type, $this->view, $key, $option );
2278 break;
2279 }
2280 ?>
2281 </div>
2282 <?php endforeach; ?>
2283
2284 <?php endif; ?>
2285 </div>
2286 </div>
2287 <?php do_action( 'wpmtst_views_after_template_options', $this->view, $template, $key ); ?>
2288 </div>
2289 </li>
2290 <?php endforeach; ?>
2291
2292 </ul>
2293 </div>
2294 </div>
2295 <?php do_action( 'wpmtst_views_after_template_list' ); ?>
2296 </td>
2297 <?php
2298 }
2299
2300 /**
2301 * Render ST layout field
2302 *
2303 * @since 2.51.5
2304 */
2305 private function render_field_layout() {
2306
2307 ?>
2308 <td colspan="2">
2309 <div class="section-radios layout-section">
2310 <div class="radio-buttons">
2311 <ul class="radio-list layout-list">
2312 <li>
2313 <input type="radio" id="view-layout-normal" name="view[data][layout]"
2314 value="" <?php checked( false, $this->view['layout'] ); ?>>
2315 <label for="view-layout-normal"><?php esc_html_e( 'normal', 'strong-testimonials' ); ?></label>
2316 </li>
2317 <li>
2318 <input type="radio" id="view-layout-masonry" name="view[data][layout]"
2319 value="masonry" <?php checked( 'masonry', $this->view['layout'] ); ?>>
2320 <label for="view-layout-masonry"><?php esc_html_e( 'Masonry', 'strong-testimonials' ); ?> </label>
2321 </li>
2322 <li>
2323 <input type="radio"
2324 id="view-layout-columns"
2325 name="view[data][layout]"
2326 value="columns" <?php checked( 'columns', $this->view['layout'] ); ?>>
2327 <label for="view-layout-columns">
2328 <?php esc_html_e( 'columns', 'strong-testimonials' ); ?>
2329 </label>
2330 </li>
2331 <li>
2332 <input type="radio" id="view-layout-grid" name="view[data][layout]"
2333 value="grid" <?php checked( 'grid', $this->view['layout'] ); ?>>
2334 <label for="view-layout-grid"><?php esc_html_e( 'grid', 'strong-testimonials' ); ?></label>
2335 </li>
2336 </ul>
2337 </div>
2338 <div>
2339 <div class="radio-description" id="view-layout-info">
2340 <div class="layout-description view-layout-normal">
2341 <p><?php esc_html_e( 'A single column.', 'strong-testimonials' ); ?></p>
2342 </div>
2343 <div class="layout-description view-layout-masonry">
2344 <p>
2345 <?php
2346 // translators: %s is a link to the Masonry jQuery plugin.
2347 printf( wp_kses_post( __( 'A cascading, responsive grid using the jQuery plugin <a href="%s" target="_blank">Masonry</a>.', 'strong-testimonials' ) ), esc_url( 'http://masonry.desandro.com/' ) );
2348 ?>
2349 </p>
2350 <p><?php esc_html_e( 'The universal solution that works well regardless of testimonial lengths.', 'strong-testimonials' ); ?></p>
2351 <p><?php esc_html_e( 'Not compatible with pagination.', 'strong-testimonials' ); ?></p>
2352 </div>
2353 <div class="layout-description view-layout-columns">
2354 <p>
2355 <?php
2356 // translators: %s is a link to a guide on CSS multi-column layout.
2357 printf( wp_kses_post( __( 'Using <a href="%s" target="_blank">CSS multi-column</a>. Fill from top to bottom, then over to next column.', 'strong-testimonials' ) ), esc_url( 'https://css-tricks.com/guide-responsive-friendly-css-columns/' ) );
2358 ?>
2359 </p>
2360 <p><?php esc_html_e( 'Works well with both long and short testimonials.', 'strong-testimonials' ); ?></p>
2361 <p><?php esc_html_e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
2362 </div>
2363 <div class="layout-description view-layout-grid">
2364 <p>
2365 <?php
2366 $url = 'https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties';
2367 // translators: %s is a link to a guide on CSS flexbox.
2368 printf( wp_kses_post( __( 'Using <a href="%s" target="_blank">CSS flexbox</a>.', 'strong-testimonials' ) ), esc_url( $url ) );
2369 ?>
2370 </p>
2371 <p><?php esc_html_e( 'Testimonials will be equal height so this works best when they are about the same length either naturally or using excerpts.', 'strong-testimonials' ); ?></p>
2372 <p><?php esc_html_e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
2373 </div>
2374 </div>
2375 <div class="radio-description options" id="column-count-wrapper">
2376 <div>
2377 <label for="view-column-count"><?php esc_html_e( 'Number of columns', 'strong-testimonials' ); ?></label>
2378 <select id="view-column-count" name="view[data][column_count]">
2379 <option value="2" <?php selected( $this->view['column_count'], 2 ); ?>>2</option>
2380 <option value="3" <?php selected( $this->view['column_count'], 3 ); ?>>3</option>
2381 <option value="4" <?php selected( $this->view['column_count'], 4 ); ?>>4</option>
2382 </select>
2383 </div>
2384 </div>
2385 </div>
2386 <div>
2387 <div class="layout-example view-layout-normal">
2388 <div class="example-container">
2389 <div class="box"><span>1</span></div>
2390 <div class="box size2"><span>2</span></div>
2391 <div class="box"><span>3</span></div>
2392 <div class="box size2"><span>4</span></div>
2393 <div class="box"><span>5</span></div>
2394 </div>
2395 </div>
2396 <div class="layout-example view-layout-masonry">
2397 <div class="example-container col-2">
2398 <div class="grid-sizer"></div>
2399 <div class="box"><span>1</span></div>
2400 <div class="box size2"><span>2</span></div>
2401 <div class="box"><span>3</span></div>
2402 <div class="box size3"><span>4</span></div>
2403 <div class="box"><span>5</span></div>
2404 <div class="box size2"><span>6</span></div>
2405 <div class="box"><span>7</span></div>
2406 <div class="box size3"><span>8</span></div>
2407 <div class="box"><span>9</span></div>
2408 </div>
2409 </div>
2410 <div class="layout-example view-layout-columns">
2411 <div class="example-container col-2">
2412 <div class="box"><span>1</span></div>
2413 <div class="box size2"><span>2</span></div>
2414 <div class="box"><span>3</span></div>
2415 <div class="box size3"><span>4</span></div>
2416 <div class="box"><span>5</span></div>
2417 <div class="box size2"><span>6</span></div>
2418 <div class="box"><span>7</span></div>
2419 <div class="box size3"><span>8</span></div>
2420 <div class="box"><span>9</span></div>
2421 </div>
2422 </div>
2423 <div class="layout-example view-layout-grid">
2424 <div class="example-container col-2">
2425 <div class="box"><span>1</span></div>
2426 <div class="box"><span>2</span></div>
2427 <div class="box"><span>3</span></div>
2428 <div class="box"><span>4</span></div>
2429 <div class="box"><span>5</span></div>
2430 <div class="box"><span>6</span></div>
2431 <div class="box"><span>7</span></div>
2432 <div class="box"><span>8</span></div>
2433 <div class="box"><span>9</span></div>
2434 </div>
2435 </div>
2436 </div>
2437 </div>
2438 </td>
2439 <?php
2440 }
2441
2442 /**
2443 * Render ST background field
2444 *
2445 * @since 2.51.5
2446 */
2447 private function render_field_background() {
2448
2449 ?>
2450 <td>
2451 <div class="section-radios background-section">
2452 <div class="radio-buttons">
2453 <ul class="radio-list background-list">
2454 <li>
2455 <input type="radio" id="bg-none" name="view[data][background][type]"
2456 value="" <?php checked( $this->view['background']['type'], '' ); ?>>
2457 <label for="bg-none"><?php esc_html_e( 'inherit from theme', 'strong-testimonials' ); ?></label>
2458 </li>
2459 <li>
2460 <input type="radio" id="bg-single" name="view[data][background][type]"
2461 value="single" <?php checked( $this->view['background']['type'], 'single' ); ?>>
2462 <label for="bg-single"><?php esc_html_e( 'single color', 'strong-testimonials' ); ?></label>
2463 </li>
2464 <li>
2465 <input type="radio" id="bg-gradient" name="view[data][background][type]"
2466 value="gradient" <?php checked( $this->view['background']['type'], 'gradient' ); ?>>
2467 <label for="bg-gradient"><?php esc_html_e( 'gradient', 'strong-testimonials' ); ?></label>
2468 </li>
2469 <li>
2470 <input type="radio" id="bg-preset" name="view[data][background][type]"
2471 value="preset" <?php checked( $this->view['background']['type'], 'preset' ); ?>>
2472 <label for="bg-preset"><?php esc_html_e( 'preset', 'strong-testimonials' ); ?></label>
2473 </li>
2474 </ul>
2475 </div>
2476 <div class="radio-description" id="view-background-info">
2477 <div class="background-description bg-none">
2478 <div class="description-inner options">
2479 <div>
2480 <?php esc_html_e( 'No options', 'strong-testimonials' ); ?>
2481 </div>
2482 </div>
2483 </div>
2484 <div class="background-description bg-single">
2485 <div class="description-inner options">
2486 <div>
2487 <label>
2488 <input type="text" id="bg-color" name="view[data][background][color]"
2489 value="<?php echo esc_attr( $this->view['background']['color'] ); ?>"
2490 class="wp-color-picker-field">
2491 </label>
2492 </div>
2493 </div>
2494 </div>
2495 <div class="background-description bg-gradient">
2496 <div class="description-inner options">
2497 <div>
2498 <div class="color-picker-wrap">
2499 <div>
2500 <label for="bg-gradient1"><?php esc_html_e( 'From top', 'strong-testimonials' ); ?></label>
2501 </div>
2502 <div><input type="text" id="bg-gradient1" name="view[data][background][gradient1]"
2503 value="<?php echo esc_attr( $this->view['background']['gradient1'] ); ?>"
2504 class="wp-color-picker-field gradient"></div>
2505 </div>
2506 </div>
2507 </div>
2508 <div class="description-inner options">
2509 <div>
2510 <div class="color-picker-wrap">
2511 <div>
2512 <label for="bg-gradient2"><?php esc_html_e( 'To bottom', 'strong-testimonials' ); ?></label>
2513 </div>
2514 <div><input type="text" id="bg-gradient2" name="view[data][background][gradient2]"
2515 value="<?php echo esc_attr( $this->view['background']['gradient2'] ); ?>"
2516 class="wp-color-picker-field gradient"></div>
2517 </div>
2518 </div>
2519 </div>
2520 </div>
2521
2522 <div class="background-description bg-preset">
2523 <div class="description-inner options">
2524 <div>
2525 <label for="view-background-preset">
2526 <select id="view-background-preset" name="view[data][background][preset]">
2527 <?php
2528 $presets = wpmtst_get_background_presets();
2529 $current_preset = ( isset( $this->view['background']['preset'] ) && $this->view['background']['preset'] ) ? $this->view['background']['preset'] : '';
2530 echo '<option value="" ' . selected( $current_preset, '', false ) . '>&mdash;</option>';
2531 foreach ( $presets as $key => $preset ) {
2532 echo '<option value="' . esc_attr( $key ) . '" ' . selected( $current_preset, $key, false ) . '>' . esc_html( $preset['label'] ) . '</option>';
2533 }
2534 ?>
2535 </select>
2536 </label>
2537 </div>
2538 </div>
2539 </div>
2540 </div>
2541 </div>
2542 </td>
2543
2544 <td rowspan="2" class="rowspan">
2545 <div id="view-color-preview" class="table-cell">
2546 <div class="background-preview-wrap">
2547 <div id="background-preview">
2548 Lorem ipsum dolor sit amet, accusam complectitur an eos. No vix perpetua adolescens, vix vidisse
2549 maiorum
2550 in. No erat falli scripta qui, vis ubique scripta electram ad. Vix prompta adipisci no, ad
2551 vidisse
2552 expetendis.
2553 </div>
2554 </div>
2555 </div>
2556 </td>
2557 <?php
2558 }
2559
2560 /**
2561 * Render ST color field
2562 *
2563 * @since 2.51.5
2564 */
2565 private function render_field_color() {
2566
2567 ?>
2568 <td>
2569 <div class="section-radios font-color-section">
2570 <div class="radio-buttons">
2571 <ul class="radio-list font-folor-list">
2572 <li>
2573 <input type="radio" id="fc-none" name="view[data][font-color][type]"
2574 value="" <?php checked( $this->view['font-color']['type'], '' ); ?>>
2575 <label for="fc-none"><?php esc_html_e( 'inherit from theme', 'strong-testimonials' ); ?></label>
2576 </li>
2577 <li>
2578 <input type="radio" id="fc-custom" name="view[data][font-color][type]"
2579 value="custom" <?php checked( $this->view['font-color']['type'], 'custom' ); ?>>
2580 <label for="fc-custom"><?php esc_html_e( 'custom', 'strong-testimonials' ); ?></label>
2581 </li>
2582 </ul>
2583 </div>
2584 <div class="radio-description" id="view-font-color-info">
2585 <div class="font-color-description fc-none">
2586 <div class="description-inner options">
2587 <div><?php esc_html_e( 'No options', 'strong-testimonials' ); ?></div>
2588 </div>
2589 </div>
2590 <div class="font-color-description fc-custom">
2591 <div class="description-inner options">
2592 <div>
2593 <label>
2594 <input type="text" id="fc-color" name="view[data][font-color][color]"
2595 value="<?php echo esc_attr( $this->view['font-color']['color'] ); ?>"
2596 class="wp-color-picker-field">
2597 </label>
2598 </div>
2599 </div>
2600 </div>
2601 </div>
2602 </div>
2603 </td>
2604 <?php
2605 }
2606
2607 /**
2608 * Render ST class field
2609 *
2610 * @since 2.51.5
2611 */
2612 private function render_field_classes() {
2613
2614 ?>
2615 <td colspan="2">
2616 <div class="then then_display then_form then_slideshow input" style="display: none;">
2617 <input type="text" id="view-class" class="long inline" name="view[data][class]"
2618 value="<?php echo esc_attr( $this->view['class'] ); ?>">
2619 <p class="inline description tall">
2620 <?php esc_html_e( 'For advanced users.', 'strong-testimonials' ); ?>
2621 <?php esc_html_e( 'Separate class names by spaces.', 'strong-testimonials' ); ?>
2622 </p>
2623 </div>
2624 </td>
2625 <?php
2626 }
2627
2628 /**
2629 * Render divi field
2630 *
2631 * @since 2.51.5
2632 */
2633 private function render_field_divi() {
2634
2635 ?>
2636 <td>
2637 <div class="row">
2638 <div class="row-inner">
2639 <input type="checkbox" id="view-divi_builder" class="if toggle checkbox"
2640 name="view[data][divi_builder]" value="1" <?php checked( $this->view['divi_builder'] ); ?>/>
2641 <label for="view-divi_builder"><?php esc_html_e( 'Check this if adding this view (via shortcode or widget) using the Visual Builder in <b>Divi Builder version 2</b>.', 'strong-testimonials' ); ?></label>
2642 <p class="description short"><?php esc_html_e( 'Not required if simply adding this view in the default editor.', 'strong-testimonials' ); ?></p>
2643 <p class="description short"><?php esc_html_e( 'Not required if simply adding this view in the <b>Divi theme</b> using either the default editor or Divi Builder.', 'strong-testimonials' ); ?></p>
2644 </div>
2645 </div>
2646 </td>
2647 <?php
2648 }
2649
2650 /**
2651 * Callback to sort tabs/fields on priority.
2652 *
2653 * @since 2.0.0
2654 *
2655 * @return bool
2656 */
2657 public static function sort_data_by_priority( $a, $b ) {
2658 if ( ! isset( $a['priority'], $b['priority'] ) ) {
2659 return -1;
2660 }
2661 if ( $a['priority'] === $b['priority'] ) {
2662 return 0;
2663 }
2664 return $a['priority'] < $b['priority'] ? -1 : 1;
2665 }
2666
2667 /**
2668 * @param $tags
2669 * @param $context
2670 *
2671 * @return mixed
2672 */
2673 public static function wpmtst_custom_wpkses_post_tags( $tags, $context ) {
2674 if ( ! function_exists( 'get_current_screen' ) ) {
2675 return $tags;
2676 }
2677
2678 $screen = get_current_screen();
2679
2680 if ( ! isset( $screen->post_type ) || 'post' !== $context || 'wpm-testimonial' !== $screen->post_type ) {
2681 return $tags;
2682 }
2683
2684 if ( 'post' === $context ) {
2685 $tags['input'] = array(
2686 'type' => true,
2687 'class' => true,
2688 'placeholder' => true,
2689 'name' => true,
2690 'id' => true,
2691 'value' => true,
2692 'checked' => true,
2693 'disabled' => true,
2694 'style' => true,
2695 );
2696 }
2697
2698 return $tags;
2699 }
2700
2701 public function add_testimonials_view_order( $options ) {
2702 if ( isset( $options['order'] ) ) {
2703 $options['order']['submit_date'] = esc_html__( 'submit date', 'strong-testimonials' );
2704 }
2705
2706 return $options;
2707 }
2708 }