PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 3.3.3
Strong Testimonials v3.3.3
3.3.3 3.3.2 3.3.1 trunk 1.0.1 2.30.9 2.31.10 2.32 2.32.1 2.32.2 2.32.3 2.32.4 2.33 2.34 2.35 2.36 2.37 2.38 2.38.1 2.39 2.39.1 2.39.2 2.39.3 2.40.0 2.40.1 2.40.2 2.40.3 2.40.4 2.40.5 2.40.6 2.40.7 2.41.0 2.41.1 2.50.0 2.50.1 2.50.2 2.50.3 2.50.4 2.51.0 2.51.1 2.51.2 2.51.3 2.51.4 2.51.5 2.51.6 2.51.7 2.51.8 2.51.9 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0
strong-testimonials / includes / functions-template.php
strong-testimonials / includes Last commit date
elementor 1 year ago logs 2 months ago strong-testimonials-beaver-block 1 year ago submodules 9 months ago class-strong-gutemberg.php 1 year ago class-strong-log.php 1 year ago class-strong-mail.php 1 year ago class-strong-testimonials-average-shortcode.php 1 year ago class-strong-testimonials-count-shortcode.php 1 year ago class-strong-testimonials-defaults.php 3 days ago class-strong-testimonials-form.php 2 months ago class-strong-testimonials-order.php 1 year ago class-strong-testimonials-privacy.php 1 year ago class-strong-testimonials-render.php 2 months ago class-strong-testimonials-templates.php 3 days ago class-strong-testimonials-view-shortcode.php 3 weeks ago class-strong-testimonials-view-widget.php 1 year ago class-strong-view-display.php 2 weeks ago class-strong-view-form.php 3 days ago class-strong-view-slideshow.php 2 weeks ago class-strong-view.php 2 weeks ago class-walker-strong-category-checklist-front.php 1 year ago deprecated.php 1 year ago filters.php 2 months ago functions-activation.php 3 days ago functions-content.php 1 year ago functions-image.php 6 months ago functions-rating.php 1 year ago functions-template-form.php 3 days ago functions-template.php 3 days ago functions-views.php 1 year ago functions.php 3 days ago l10n-polylang.php 1 year ago l10n-wpml.php 1 year ago post-types.php 3 weeks ago retro.php 1 year ago scripts.php 2 months ago
functions-template.php
744 lines
1 <?php
2 /**
3 * Template Functions
4 */
5
6 /**
7 * Template function for showing a View.
8 *
9 * @since 1.25.0
10 *
11 * @param null $id
12 */
13 function strong_testimonials_view( $id = null ) {
14 if ( ! $id ) {
15 return;
16 }
17
18 $out = array();
19 $pairs = array();
20 $atts = array( 'id' => $id );
21 $out = WPMST()->render->prerender( $atts );
22 $out = WPMST()->render->parse_view( $out, $pairs, $atts );
23
24 echo WPMST()->shortcode->render_view( $out );
25 }
26
27 /**
28 * Print the current post title with optional markup.
29 *
30 * @since 2.26.0 Add optional link to post.
31 *
32 * @param string $before
33 * @param string $after
34 */
35
36 function wpmtst_the_title( $tag = '', $wrapper_class = '' ) {
37 $title = get_the_title();
38 $options = get_option( 'wpmtst_options' );
39
40 $tag = apply_filters( 'wpmtst_the_title_tag', $tag );
41 if ( ! empty( $tag ) ) {
42 $before = '<' . $tag . ' class="' . $wrapper_class . '">';
43 $after = '</' . $tag . '>';
44 }
45 if ( WPMST()->atts( 'title' ) && $title ) {
46 if ( 'none' !== WPMST()->atts( 'title_link' ) && '0' !== WPMST()->atts( 'title_link' ) ) {
47 if ( ( ! isset( $options['disable_rewrite'] ) || false === $options['disable_rewrite'] ) && ( 'wpmtst_testimonial' === WPMST()->atts( 'title_link' ) || '1' === WPMST()->atts( 'title_link' ) ) ) {
48 $before .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
49 $after = '</a>' . $after;
50 } else {
51 $id = get_the_ID();
52 $url_field = WPMST()->atts( 'title_link' );
53 $external_url = get_post_meta( $id, $url_field, true );
54
55 if ( '' !== $external_url && ! is_array( $external_url ) ) {
56 $before .= '<a href="' . esc_url( $external_url ) . '" rel="bookmark" target="_blank">';
57 $after = '</a>' . $after;
58 }
59 }
60 }
61 }
62 $before = apply_filters( 'wpmtst_the_title_before', $before );
63 $after = apply_filters( 'wpmtst_the_title_after', $after );
64
65 if ( WPMST()->atts( 'title' ) !== 'hidden' ) {
66 the_title( $before, $after );
67 }
68 }
69
70 /**
71 * Display the testimonial content.
72 *
73 * @since 1.24.0
74 *
75 * @since 2.4.0 Run content through core WordPress filters only, instead of all filters
76 * added to the_excerpt() or the_content() in order to to be compatible with
77 * NextGEN Gallery and to prevent other plugins from unconditionally adding
78 * content like share buttons, etc.
79 *
80 * @since 2.11.5 Run specific filters on `wpmtst_the_content` hook.
81 *
82 * @since 2.20.0 For automatic excerpts, run `wpautop` after truncating.
83 * Add `wp_make_content_images_responsive`.
84 *
85 * @since 2.26.0 Using content filters instead of direct function calls.
86 * Using custom get_*() functions to allow filter selectivity.
87 */
88 function wpmtst_the_content() {
89 /**
90 * Use this hook to remove specific content filters.
91 *
92 * @since 2.26.0
93 */
94 do_action( 'wpmtst_before_content_filters' );
95
96 echo apply_filters( 'wpmtst_get_the_content', '' );
97
98 /**
99 * Restore content filters that were removed.
100 *
101 * @since 2.26.0
102 */
103 do_action( 'wpmtst_after_content_filters' );
104 }
105
106 /**
107 * Like the_excerpt().
108 *
109 * @since 2.33.0
110 */
111 function wpmtst_the_excerpt() {
112 echo wpmtst_the_excerpt_filtered();
113 }
114
115 /**
116 * The ellipsis on read-more's.
117 *
118 * @since 2.33.0
119 */
120 function wpmtst_ellipsis() {
121 if ( apply_filters( 'wpmtst_use_ellipsis', true ) ) {
122 return apply_filters( 'wpmtst_ellipsis', __( '&hellip;', 'strong-testimonials' ) );
123 }
124
125 return '';
126 }
127
128 function wpmtst_prepend_ellipsis( $more ) {
129 return wpmtst_ellipsis() . ' ' . $more;
130 }
131
132 /**
133 * Assemble link to secondary "Read more" page.
134 *
135 * @since 2.10.0
136 */
137 function wpmtst_read_more_page() {
138 $atts = WPMST()->atts();
139
140 if ( $atts['more_page'] && $atts['more_page_id'] ) {
141 $permalink = '';
142 if ( is_numeric( $atts['more_page_id'] ) ) {
143 $permalink = wpmtst_get_permalink( $atts['more_page_id'] );
144 }
145 $permalink = apply_filters( 'wpmtst_readmore_page_link', $permalink, $atts );
146
147 if ( $permalink ) {
148 $default_view = wpmtst_get_view_default();
149
150 if ( isset( $atts['more_page_text'] ) && $atts['more_page_text'] ) {
151 $link_text = $atts['more_page_text'];
152 } else {
153 $link_text = $default_view['more_page_text'];
154 }
155
156 $link_text = apply_filters( 'wpmtst_read_more_page_link_text', $link_text, $atts );
157
158 if ( 'wpmtst_after_testimonial' === $atts['more_page_hook'] ) {
159 $classname = 'readmore';
160 } else {
161 $classname = 'readmore-page';
162 }
163 $classname = apply_filters( 'wpmtst_read_more_page_class', $classname );
164 echo apply_filters( 'wpmtst_read_more_page_output', sprintf( '<div class="%s"><a href="%s">%s</a></div>', esc_attr( $classname ), esc_url( $permalink ), wp_kses_post( $link_text ) ) );
165 }
166 }
167 }
168
169 /**
170 * L10n filter on read-more-page link.
171 *
172 * @since 2.23.0 As separate function.
173 *
174 * @param $text
175 * @param $atts
176 *
177 * @return string
178 */
179 function wpmtst_read_more_page_link_text_l10n( $text, $atts ) {
180 return apply_filters(
181 'wpmtst_l10n',
182 $text,
183 'strong-testimonials-read-more',
184 sprintf( 'View %s : Read more (page or post)', $atts['view'] )
185 );
186 }
187 add_filter( 'wpmtst_read_more_page_link_text', 'wpmtst_read_more_page_link_text_l10n', 10, 2 );
188
189 /**
190 * L10n filter on read-more-post link.
191 *
192 * @since 2.29.0
193 *
194 * @param $text
195 * @param $atts
196 *
197 * @return string
198 */
199 function wpmtst_read_more_post_link_text_l10n( $text, $atts ) {
200 return apply_filters(
201 'wpmtst_l10n',
202 $text,
203 'strong-testimonials-read-more',
204 sprintf( 'View %s : Read more (testimonial)', $atts['view'] )
205 );
206 }
207 add_filter( 'wpmtst_read_more_post_link_text', 'wpmtst_read_more_post_link_text_l10n', 10, 2 );
208
209 /**
210 * Get permalink by ID or slug.
211 *
212 * @since 1.25.0
213 *
214 * @param $page_id
215 *
216 * @return false|string
217 */
218 function wpmtst_get_permalink( $page_id ) {
219 if ( ! is_numeric( $page_id ) ) {
220 $page = get_page_by_path( $page_id );
221 $page_id = $page->ID;
222 }
223
224 return get_permalink( $page_id );
225 }
226
227 /**
228 * Prevent page scroll when clicking the More link.
229 *
230 * @since 2.10.0
231 *
232 * @param $link
233 *
234 * @return mixed
235 */
236 function wpmtst_remove_more_link_scroll( $link ) {
237 if ( 'wpm-testimonial' === get_post_type() ) {
238 $link = preg_replace( '|#more-[0-9]+|', '', $link );
239 }
240
241 return $link;
242 }
243 add_filter( 'the_content_more_link', 'wpmtst_remove_more_link_scroll' );
244
245 /**
246 * Display the thumbnail.
247 *
248 * TODO WP 4.2+ has better filters.
249 *
250 * @param null $size
251 * @param string $before
252 * @param string $after
253 */
254 function wpmtst_the_thumbnail( $size = null, $before = '<div class="wpmtst-testimonial-image testimonial-image">', $after = '</div>' ) {
255 if ( ! WPMST()->atts( 'thumbnail' ) ) {
256 return;
257 }
258
259 $img = wpmtst_get_thumbnail( $size );
260 if ( $img ) {
261 echo $before . $img . $after;
262 }
263 }
264
265 /**
266 * Print the date.
267 *
268 * @param string $format
269 * @param string $wrapper_class
270 */
271 function wpmtst_the_date( $format = '', $wrapper_class = '' ) {
272 global $post;
273 if ( ! $post ) {
274 return;
275 }
276
277 if ( ! $format ) {
278 $format = get_option( 'date_format' );
279 }
280
281 $the_date = apply_filters( 'wpmtst_the_date', mysql2date( $format, $post->post_date ), $format, $post );
282 echo '<div class="' . esc_attr( $wrapper_class ) . '">' . esc_attr( $the_date ) . '</div>';
283 }
284
285 /**
286 * Display the client section.
287 *
288 * @since 1.21.0
289 */
290 function wpmtst_the_client() {
291 $atts = WPMST()->atts();
292 if ( isset( $atts['client_section'] ) ) {
293 echo wpmtst_client_section( $atts['client_section'] );
294 }
295 }
296
297 /**
298 * Assemble the client section.
299 *
300 * @since 1.21.0
301 *
302 * @param array $client_section An array of client fields.
303 *
304 * @return mixed
305 */
306 function wpmtst_client_section( $client_section ) {
307
308 $html = '';
309
310 foreach ( $client_section as $field ) {
311 $html .= wpmtst_the_custom_field( $field );
312 }
313
314 return $html;
315 }
316
317 function wpmtst_the_custom_field( $field ) {
318 global $post;
319
320 $options = get_option( 'wpmtst_options' );
321 $custom_fields = wpmtst_get_custom_fields();
322
323 $output = '';
324 $field_name = $field['field'];
325
326 if ( isset( $custom_fields[ $field_name ] ) ) {
327 $field['prop'] = $custom_fields[ $field_name ];
328 } else {
329 $field['prop'] = array();
330 }
331
332 // Check for callback first.
333 if ( isset( $field['prop']['action_output'] ) && $field['prop']['action_output'] ) {
334 $value = get_post_meta( $post->ID, $field_name, true );
335 $output = apply_filters( $field['prop']['action_output'], $field, $value );
336 } elseif ( has_filter( 'wpmtst_output_' . $field_name ) ) {
337 $value = get_post_meta( $post->ID, $field_name, true );
338 $output = apply_filters( 'wpmtst_output_' . $field_name, $field, $value );
339 } else {
340 switch ( $field['type'] ) {
341 case 'link':
342 case 'link2':
343 // use default if missing
344 if ( ! isset( $field['link_text'] ) ) {
345 $field['link_text'] = 'value';
346 }
347
348 /**
349 * Get link text and an alternate in case the URL is empty;
350 * e.g. display the domain if no company name given
351 * but don't display 'LinkedIn' if no URL given.
352 */
353 switch ( $field['link_text'] ) {
354 case 'custom':
355 $text = $field['link_text_custom'];
356 $output = '';
357 break;
358 case 'label':
359 $text = $field['prop']['label'];
360 $output = '';
361 break;
362 default: // value
363 $text = get_post_meta( $post->ID, $field_name, true );
364 // if no URL (next condition), show the alternate (the field)
365 $output = $text;
366 }
367
368 if ( $field['url'] ) {
369 $url = get_post_meta( $post->ID, $field['url'], true );
370 if ( $url ) {
371 if ( isset( $field['new_tab'] ) && $field['new_tab'] ) {
372 $newtab = ' target="_blank"';
373 } else {
374 $newtab = '';
375 }
376
377 // TODO Abstract this global fallback technique.
378 $is_nofollow = get_post_meta( $post->ID, 'nofollow', true );
379 if ( 'default' === $is_nofollow || '' === $is_nofollow ) {
380 // convert default to (yes|no)
381 $is_nofollow = $options['nofollow'] ? 'yes' : 'no';
382 }
383 if ( 'yes' === $is_nofollow ) {
384 $nofollow = 'nofollow';
385 } else {
386 $nofollow = '';
387 }
388
389 $is_noopener = get_post_meta( $post->ID, 'noopener', true );
390 if ( 'default' === $is_noopener || '' === $is_noopener ) {
391 // convert default to (yes|no)
392 $is_noopener = $options['noopener'] ? 'yes' : 'no';
393 }
394 if ( 'yes' === $is_noopener ) {
395 $noopener = 'noopener';
396 } else {
397 $noopener = '';
398 }
399
400 $is_noreferrer = get_post_meta( $post->ID, 'noreferrer', true );
401 if ( 'default' === $is_noreferrer || '' === $is_noreferrer ) {
402 // convert default to (yes|no)
403 $is_noreferrer = $options['noreferrer'] ? 'yes' : 'no';
404 }
405 if ( 'yes' === $is_noreferrer ) {
406 $noreferrer = 'noreferrer';
407 } else {
408 $noreferrer = '';
409 }
410
411 if ( ! empty( $noopener ) || ! empty( $nofollow ) || ! empty( $noreferrer ) ) {
412 $rel = sprintf( ' rel="%s %s %s"', esc_attr( $nofollow ), esc_attr( $noopener ), esc_attr( $noreferrer ) );
413 } else {
414 $rel = '';
415 }
416
417 // if field empty, use domain instead
418 if ( ! $text || is_array( $text ) ) {
419 $text = preg_replace( '(^https?://)', '', $url );
420 }
421 $output = sprintf( '<a href="%s"%s%s>%s</a>', esc_url( $url ), $newtab, $rel, wp_kses_post( $text ) );
422 }
423 }
424 break;
425
426 case 'date':
427 $format = isset( $field['format'] ) && $field['format'] ? $field['format'] : get_option( 'date_format' );
428
429 // Fall back to post_date if submit_date missing.
430 $the_date = get_post_meta( $post->ID, $field_name, true );
431 $the_date = $the_date ? $the_date : $post->post_date;
432 $the_date = mysql2date( $format, $the_date );
433
434 if ( get_option( 'date_format' ) !== $format ) {
435 // Requires PHP 5.3+
436 if ( version_compare( PHP_VERSION, '5.3' ) >= 0 ) {
437 $new_date = DateTime::createFromFormat( get_option( 'date_format' ), $the_date );
438 if ( $new_date ) {
439 $the_date = $new_date->format( $format );
440 }
441 }
442 }
443
444 $output = apply_filters( 'wpmtst_the_date', $the_date, $format, $post );
445 break;
446
447 case 'category':
448 // 1. Get all terms for testimonial
449 $categories = get_the_terms( $post->ID, 'wpm-testimonial-category' );
450 // 2, Check for errors
451 if ( $categories && ! is_wp_error( $categories ) ) {
452 $list = array();
453 // 3. Check if should display parent cats, child cats, or both.
454 if ( isset( $field['category_show'] ) && 'both' !== $field['category_show'] ) {
455 if ( 'parent' === $field['category_show'] ) {
456 foreach ( $categories as $cat ) {
457 // 3.1 Include only categories that don't have parents
458 if ( 0 === $cat->parent ) {
459 $list[] = $cat->name;
460 }
461 }
462 $output = implode( ', ', $list );
463 } elseif ( 'child' === $field['category_show'] ) {
464 foreach ( $categories as $cat ) {
465 // 3.2 Include only categories that have parents
466 if ( 0 !== $cat->parent ) {
467 $list[] = $cat->name;
468 }
469 }
470 $output = implode( ', ', $list );
471 }
472 } else {
473 foreach ( $categories as $cat ) {
474 // 3.3 Include all categories
475 $list[] = $cat->name;
476 }
477 $output = implode( ', ', $list );
478 }
479 } else {
480 $output = '';
481 }
482 break;
483
484 case 'shortcode':
485 if ( isset( $field['prop']['shortcode_on_display'] ) && $field['prop']['shortcode_on_display'] ) {
486 $output = do_shortcode( $field['prop']['shortcode_on_display'] );
487 }
488 break;
489
490 case 'rating':
491 $output = get_post_meta( $post->ID, $field_name, true );
492 // Check default value
493 if ( '' === $output && isset( $field['prop']['default_display_value'] ) && $field['prop']['default_display_value'] ) {
494 $output = $field['prop']['default_display_value'];
495 }
496 // Convert number to stars
497 if ( $output ) {
498 $output = wpmtst_star_rating_display( $output, 'in-view', false );
499 }
500 break;
501
502 case 'platform':
503 $platform = get_post_meta( $post->ID, $field_name, true );
504
505 if ( $platform ) {
506 $output = wpmtst_platform_display( $platform );
507 }
508
509 break;
510
511 case 'checkbox':
512 // we output the checkbox value from view
513 $output = '';
514 if ( isset( $field['custom_label'] ) && ! empty( $field['custom_label'] ) ) {
515 $output = sprintf( '%s: ', esc_attr( $field['custom_label'] ) );
516 }
517 if ( get_post_meta( $post->ID, $field_name, true ) ) {
518 $output .= esc_attr( $field['checked_value_custom'] );
519 } else {
520 $output .= esc_attr( $field['unchecked_value'] );
521 }
522 break;
523
524 default:
525 // text field
526 $output = get_post_meta( $post->ID, $field_name, true );
527 $output = wp_kses_post( $output );
528 if ( '' === $output && isset( $field['prop']['default_display_value'] ) && $field['prop']['default_display_value'] ) {
529 $output = $field['prop']['default_display_value'];
530 }
531 }
532 }
533
534 if ( is_array( $output ) ) {
535 return '';
536 }
537
538 if ( $output ) {
539 if ( isset( $field['before'] ) && $field['before'] ) {
540 $output = '<span class="wpmtst-testimonial-field-before testimonial-field-before">' . $field['before'] . '</span>' . $output;
541 }
542 $output = '<div class="wpmtst-testimonial-field testimonial-field ' . esc_attr( $field['class'] ) . '">' . $output . '</div>';
543 }
544
545 return $output;
546 }
547
548 /**
549 * Same as wpmtst_the_custom_field(), but wraps the result in a <p> instead
550 * of a <div> so themes that style paragraph typography (e.g. .wp-block-paragraph)
551 * apply to it.
552 *
553 * @param array $field
554 *
555 * @since 3.4.0
556 * @return string
557 */
558 function wpmtst_the_custom_field_as_paragraph( $field ) {
559 $output = wpmtst_the_custom_field( $field );
560
561 if ( ! $output ) {
562 return '';
563 }
564
565 $output = preg_replace( '/^<div /', '<p ', $output, 1 );
566 $output = preg_replace( '/<\/div>$/', '</p>', $output, 1 );
567
568 return $output;
569 }
570
571 function wpmtst_container_class() {
572 echo esc_attr( apply_filters( 'wpmtst_container_class', WPMST()->atts( 'container_class' ) ) );
573 }
574
575 function wpmtst_container_data() {
576 $data_array = apply_filters( 'wpmtst_container_data', WPMST()->atts( 'container_data' ) );
577 if ( $data_array && is_array( $data_array ) ) {
578 $parts = array();
579 foreach ( $data_array as $attr => $value ) {
580 $attr = sanitize_key( $attr );
581 $value = esc_attr( (string) $value );
582 $parts[] = sprintf( ' data-%s="%s"', $attr, $value );
583 }
584 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Each part built from sanitize_key and esc_attr.
585 echo implode( '', $parts );
586 }
587 }
588
589 function wpmtst_content_class() {
590 echo esc_attr( apply_filters( 'wpmtst_content_class', WPMST()->atts( 'content_class' ) ) );
591 }
592
593 function wpmtst_post_class( $args = null ) {
594 echo esc_attr( apply_filters( 'wpmtst_post_class', WPMST()->atts( 'post_class' ) . ' post-' . get_the_ID(), $args ) );
595 }
596
597 /**
598 * Echo custom field.
599 *
600 * @since 1.11.0
601 *
602 * @param null $field
603 * @param array $args
604 */
605 function wpmtst_field( $field = null, $args = array() ) {
606 echo wpmtst_get_field( $field, $args );
607 }
608
609 /**
610 * Fetch custom field.
611 *
612 * Thanks to Matthew Harris.
613 *
614 * @link https://github.com/cdillon/strong-testimonials/issues/2
615 *
616 * @param $field
617 * @param array $args
618 *
619 * @since 1.15.7
620 *
621 * @return mixed|string
622 */
623 function wpmtst_get_field( $field, $args = array() ) {
624 if ( ! $field ) {
625 return '';
626 }
627
628 global $post;
629
630 switch ( $field ) {
631
632 // Apply a character limit to post content.
633 case 'truncated':
634 $html = wpmtst_truncate( $post->post_content, $args['char_limit'] );
635 break;
636
637 // Get the custom field.
638 default:
639 $html = get_post_meta( $post->ID, $field, true );
640 }
641
642 return $html;
643 }
644
645 if ( ! function_exists( 'wpmtst_standard_pagination' ) ) :
646 /**
647 * Custom pagination. Pluggable.
648 *
649 * Thanks http://callmenick.com/post/custom-wordpress-loop-with-pagination
650 */
651 function wpmtst_standard_pagination() {
652 $query = WPMST()->get_query();
653 $numpages = $query->max_num_pages ? $query->max_num_pages : 1;
654 $paged = wpmtst_get_paged();
655 $options = WPMST()->atts( 'pagination_settings' );
656
657 $pagination_args = array(
658 // Required
659 'total' => $numpages,
660 'current' => $paged,
661 // Options
662 'show_all' => isset( $options['show_all'] ) ? $options['show_all'] : false,
663 'end_size' => isset( $options['end_size'] ) ? $options['end_size'] : 1,
664 'mid_size' => isset( $options['mid_size'] ) ? $options['mid_size'] : 2,
665 'prev_next' => isset( $options['prev_next'] ) ? $options['prev_next'] : true,
666 'prev_text' => isset( $options['prev_text'] ) ? $options['prev_text'] : __( '&laquo; Previous', 'strong-testimonials' ),
667 'next_text' => isset( $options['next_text'] ) ? $options['next_text'] : __( 'Next &raquo;', 'strong-testimonials' ),
668 'before_page_number' => isset( $options['before_page_number'] ) ? $options['before_page_number'] : '',
669 'after_page_number' => isset( $options['after_page_number'] ) ? $options['after_page_number'] : '',
670 );
671
672 $paginate_links = paginate_links( apply_filters( 'wpmtst_pagination_args', $pagination_args ) );
673
674 if ( $paginate_links ) {
675 echo "<nav class='nav-links'>";
676 echo $paginate_links;
677 echo '</nav>';
678 }
679 }
680 endif;
681
682 /**
683 * If paged, return the current page number.
684 *
685 * @return int|mixed
686 */
687 function wpmtst_get_paged() {
688 if ( is_front_page() ) {
689 return get_query_var( 'page' ) ? intval( get_query_var( 'page' ) ) : 1;
690 }
691 return get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
692 }
693
694 /*
695 // alternate pagination style
696 function wpmtst_new_pagination_2() {
697 $query = WPMST()->get_query();
698 if ($query->max_num_pages > 1) { ?>
699 <nav class="prev-next-posts">
700 <div class="prev-posts-link">
701 <?php echo get_next_posts_link( 'Older Entries', $query->max_num_pages ); // display older posts link ?>
702 </div>
703 <div class="next-posts-link">
704 <?php echo get_previous_posts_link( 'Newer Entries' ); // display newer posts link ?>
705 </div>
706 </nav>
707 <?php }
708 }
709 */
710
711 if ( ! function_exists( 'wpmtst_single_template_client' ) ) :
712 /**
713 * Single testimonial custom fields. Pluggable.
714 *
715 * @since 2.22.0
716 */
717 function wpmtst_single_template_client() {
718 $html = '';
719 $view = wpmtst_find_single_template_view();
720 if ( $view && isset( $view['client_section'] ) ) {
721 foreach ( $view['client_section'] as $field ) {
722 if ( 'rating' === $field['type'] ) {
723 wp_enqueue_style( 'wpmtst-rating-display' );
724 break;
725 }
726 }
727
728 $html .= '<div class="testimonial-client normal">';
729 $html .= wpmtst_client_section( $view['client_section'] );
730 $html .= '</div>';
731 }
732
733 return $html;
734 }
735 endif;
736
737 function wpmtst_platform_display( $platform ) {
738 ob_start();
739 ?>
740 <img title="<?php echo esc_attr( __( 'posted on ', 'strong-testimonials' ) . $platform ); ?>" width="20" height="20" src="<?php echo esc_attr( WPMTST_ASSETS_IMG ); ?>/platform_icons/<?php echo esc_attr( $platform ); ?>.svg"/>
741 <?php
742 return ob_get_clean();
743 }
744