PluginProbe ʕ •ᴥ•ʔ
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.10.0
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.10.0
2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.7 2.6.8 2.6.5 2.6.4 2.6.3 2.6.2 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1 1.1.1 1.1.2 1.2.0 2.0 2.1.0 2.1.1 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5.0 2.5.1
reviews-feed / templates / frontend / post-elements / text.php
reviews-feed / templates / frontend / post-elements Last commit date
extras 3 weeks ago rating-extras 3 weeks ago rating.php 3 weeks ago text-aliexpress.php 3 weeks ago text-booking.php 3 weeks ago text.php 3 weeks ago
text.php
77 lines
1 <?php
2
3 /**
4 * Smash Balloon Reviews Feed Text Template
5 * Adds a review paragraph with provider-specific template support
6 *
7 * @version 1.0 Reviews Feed by Smash Balloon
8 *
9 */
10
11 if (!defined('ABSPATH')) {
12 exit; // Exit if accessed directly
13 }
14
15 // Get provider name
16 $provider = !empty($post['provider']['name']) ? $post['provider']['name'] : '';
17
18 // Providers with custom templates:
19 // - booking: pros/cons + photos
20 // - aliexpress: "Translated from original" indicator placed BEFORE the text
21 // (SMASH-782 Phase 2, matches prototype AliExpressCard.jsx)
22 $providers_with_custom_templates = ['booking', 'aliexpress'];
23
24 // Check if provider-specific template exists
25 if (!empty($provider) && in_array($provider, $providers_with_custom_templates)) {
26 $provider_template = __DIR__ . '/text-' . $provider . '.php';
27
28 if (file_exists($provider_template)) {
29 include $provider_template;
30 return;
31 }
32 }
33
34 // Default template for existing sources (Google, Yelp, Facebook, etc.).
35 // SMASH-1553 — review-title block, rendered ONLY when the source provider
36 // is one we know supplies real customer-typed titles. Cannot use a generic
37 // `!empty($post['title'])` guard because `Util::parse_single_review()`
38 // (class/Common/Util.php:1421) synthesizes a substring fallback title from
39 // the review text whenever the upstream provider omits one — so non-EDD
40 // reviews stored via Collection / Import paths carry a fake "first 40 chars
41 // of text" title that would render as a bold heading above the same text.
42 // Provider allowlist scopes the render to providers where the title is
43 // authoritative customer input. Add new entries here as providers gain
44 // genuine review-title support.
45 $providers_with_review_titles = array( 'edd' );
46 $has_post_title = in_array($provider, $providers_with_review_titles, true)
47 && ! empty($post['title'])
48 && is_string($post['title']);
49
50 // Airbnb uses this default text path and joins the new-source section spacing.
51 $sbr_text_section_class = ( $provider === 'airbnb' ) ? ' sbr-review-horizontal-element' : '';
52 ?>
53 <?php if ($has_post_title) : ?>
54 <?php
55 /*
56 * HTML entity decode before esc_html: EDD Reviews' submission handler
57 * runs `esc_html()` on the title BEFORE persisting to comment meta, so
58 * `$post['title']` contains entities like `&amp;` / `&#039;`. A raw
59 * `esc_html( $post['title'] )` here would double-encode (`&amp;amp;`).
60 * Decoding first, then re-encoding once for output, gives single-pass
61 * safe rendering and works equally well for providers that store raw
62 * strings (decode of plain text is a no-op).
63 */
64 $display_title = html_entity_decode($post['title'], ENT_QUOTES, 'UTF-8');
65 ?>
66 <div class="sb-item-title"><?php echo sbr_neutralize_shortcodes(esc_html($display_title)); ?></div>
67 <?php endif; ?>
68 <div class="sb-item-text sb-fs<?php echo esc_attr($sbr_text_section_class); ?>">
69 <?php echo sbr_neutralize_shortcodes(sbr_kses_review_text(nl2br($this->get_review_text($post)))); ?>
70 </div>
71 <div class="sb-expand">
72 <button type="button" data-link="<?php echo esc_url($this->more_link($post)); ?>" aria-label="<?php esc_attr_e('Read the full review', 'reviews-feed'); ?>">
73 <span class="sb-more" aria-hidden="true">...</span>
74 </button>
75 </div>
76
77