PluginProbe ʕ •ᴥ•ʔ
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.7.0
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.7.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 / class / sbr-functions.php
reviews-feed / class Last commit date
Common 1 month ago sbr-functions.php 1 month ago
sbr-functions.php
757 lines
1 <?php
2
3 use SmashBalloon\Reviews\Common\Admin\Blocks\SB_Reviews_Blocks;
4 use SmashBalloon\Reviews\Common\Util;
5
6 if (!defined('ABSPATH')) {
7 exit; // Exit if accessed directly
8 }
9
10 function sbr_json_encode($thing)
11 {
12 if (function_exists('wp_json_encode')) {
13 return wp_json_encode($thing);
14 } else {
15 return json_encode($thing);
16 }
17 }
18
19
20 /**
21 * Reviews Currect User Capability Check
22 *
23 * @since 1.0
24 */
25 function sbr_current_user_can($cap)
26 {
27 if ($cap === 'manage_reviews_feed_options') {
28 $cap = current_user_can('manage_reviews_feed_options') ? 'manage_reviews_feed_options' : 'manage_options';
29 }
30 $cap = apply_filters('sbr_settings_pages_capability', $cap);
31
32 return current_user_can($cap);
33 }
34
35
36 /**
37 * Get the settings in the database with defaults
38 *
39 * @return array
40 */
41 function sbr_get_database_settings()
42 {
43 global $sbr_settings;
44
45 $defaults = sbr_settings_defaults();
46
47 if ($sbr_settings === null) {
48 $sbr_settings = get_option('sbr_settings', []);
49 }
50
51 // Defensive: `sbr_settings` can arrive as a non-array (raw SQL edits,
52 // broken backup/restore, migration tooling that mangled serialization).
53 // Without this guard `array_merge()` fatals and takes the whole admin
54 // down. Normalizing to an array lets SMASH-1281's migration-recovery
55 // flow re-register + repopulate on the next page load.
56 if (!is_array($sbr_settings)) {
57 $sbr_settings = [];
58 }
59
60 return array_merge($defaults, $sbr_settings);
61 }
62
63 /**
64 * Get the settings default settins
65 *
66 * @return array
67 */
68 function sbr_settings_defaults()
69 {
70 return [
71 //Template
72 'feedTemplate' => 'default',
73 //Sources
74 'sources' => [],
75 //Layout Settings
76 'layout' => 'list',
77 'verticalSpacing' => 20,
78 'horizontalSpacing' => 10,
79 'contentAlignment' => 'left',
80 'contentLength' => 320,
81 'numPostDesktop' => 10,
82 'numPostTablet' => 8,
83 'numPostMobile' => 6,
84 'gridDesktopColumns' => 3,
85 'gridTabletColumns' => 2,
86 'gridMobileColumns' => 1,
87 'masonryDesktopColumns' => 3,
88 'masonryTabletColumns' => 2,
89 'masonryMobileColumns' => 1,
90 'carouselDesktopColumns' => 3,
91 'carouselTabletColumns' => 2,
92 'carouselMobileColumns' => 1,
93 'carouselDesktopRows' => 1,
94 'carouselTabletRows' => 1,
95 'carouselMobileRows' => 1,
96 'carouselLoopType' => 'infinity',
97 'carouselIntervalTime' => 5000,
98 'carouselShowArrows' => false,
99 'carouselShowPagination' => true,
100 'carouselEnableAutoplay' => true,
101
102 //Header
103 'showHeader' => true,
104 'headerContent' => ['heading', 'button', 'averagereview'],
105 'headerPadding' => [],
106 'headerMargin' => ['bottom' => 20],
107 //Heading
108 'headerHeadingContent' => 'Reviews',
109 'headingFont' => [
110 'weight' => 700,
111 'size' => 36,
112 'height' => '100%'
113 ],
114 'headingColor' => '#141B38',
115 'headerHeadingPadding' => [],
116 'headerHeadingMargin' => ['bottom' => 10],
117 //Button
118 'headerButtonLinkTo' => 'google',
119 'headerButtonIcon' => '',
120 'headerButtonExternalLink' => '',
121 'headerButtonFont' => [
122 'weight' => 600,
123 'size' => 14,
124 'height' => '22px'
125 ],
126 'headerButtonColor' => '#ffffff',
127 'headerButtonBg' => '#ED4944',
128 'headerButtonHoverColor' => '#ffffff',
129 'headerButtonHoverBg' => '#CC3F3A',
130 'headerButtonPadding' => [
131 'top' => 8,
132 'right' => 20,
133 'bottom' => 8,
134 'left' => 12,
135 ],
136 'headerButtonMargin' => [],
137 //AverageReview
138 'headerAvReviewFont' => [
139 'weight' => 600,
140 'size' => 20,
141 'height' => '1.5em'
142 ],
143 'headerAvSubtextReviewFont' => [
144 'weight' => 400,
145 'size' => 12,
146 'height' => '1.5em'
147 ],
148 'headerAvReviewIconColor' => '#ED4944',
149 'headerAvReviewColor' => '#141B38',
150 'headerAvReviewSubtextColor' => '#434960',
151 'headerAvReviewMargin' => '',
152 'headerAvReviewPadding' => '',
153
154 //Post Style
155 'postStyle' => 'regular',
156 'boxedBackgroundColor' => '#ffffff',
157 'boxedBoxShadow' => [],
158 'boxedBorderRadius' => [],
159 'postStroke' => [],
160 'postPadding' => [
161 'bottom' => 20
162 ],
163
164 'postElements' => ['author', 'rating', 'text', 'media'],
165 'ratingIconSize' => 'small',
166 'ratingIconColor' => '#ED4944',
167 'ratingIconPadding' => [],
168 'ratingIconMargin' => [
169 'top' => 15,
170 'bottom' => 15,
171 ],
172 'paragraphFont' => [
173 'weight' => 400,
174 'size' => 16,
175 'height' => '1.5em'
176 ],
177 'paragraphColor' => '#434960',
178 'paragraphPadding' => [],
179 'paragraphMargin' => [],
180
181 'authorContent' => ['name', 'image', 'date'],
182 'authorPadding' => [],
183 'authorMargin' => [],
184
185 'authorNameFont' => [
186 'weight' => 600,
187 'size' => 14,
188 'height' => '1.5em'
189 ],
190 'authorNameColor' => '#141B38',
191 'authorNamePadding' => [],
192 'authorNameMargin' => [],
193
194 'dateFont' => [
195 'weight' => 400,
196 'size' => 13,
197 'height' => '1.5em'
198 ],
199 'dateColor' => '#434960',
200
201 'dateFormat' => '1',
202 'dateCustomFormat' => '',
203 'dateBeforeText' => '',
204 'dateAfterText' => '',
205 'datePadding' => [],
206 'dateMargin' => [],
207 'authorImageBorderRadius' => 50,
208 'authorImageMargin' => [
209 'right' => 10
210 ],
211
212 'showLoadButton' => true,
213 'loadButtonText' => 'Load More',
214 'loadButtonFont' => [
215 'weight' => 600,
216 'size' => 16,
217 'height' => '1em'
218 ],
219 'loadButtonColor' => '#141B38',
220 'loadButtonHoverColor' => '#ffffff',
221 'loadButtonBg' => '#E6E6EB',
222 'loadButtonHoverBg' => '#FE544F',
223
224 'loadButtonPadding' => [
225 'top' => 15,
226 'bottom' => 15
227 ],
228 'loadButtonMargin' => [
229 'top' => 20
230 ],
231
232 //Filters
233 'includedStarFilters' => [],
234 'includeWords' => '',
235 'excludeWords' => '',
236 'filterByImage' => false,
237 'filterByVideos' => true,
238
239 //Sort
240 'sortByDateEnabled' => true,
241 'sortByDate' => 'latest',
242
243 'sortByRatingEnabled' => false,
244 'sortByRating' => '',
245
246 'sortRandomEnabled' => false,
247
248 //ColorScheme
249 'colorScheme' => 'inherit',
250
251
252 //Moderation Mode
253 'moderationEnabled' => false,
254 'moderationType' => 'allow',
255 'moderationAllowList' => [],
256 'moderationBlockList' => [],
257
258 //Translation
259 'localization' => 'default',
260 'trustpilotLanguage' => 'all',
261
262 //Filter By Length
263 'filterCharCountMin' => 0,
264 'filterCharCountMax' => '',
265
266 //Carousel Breakpoints
267 'carouselBreakpointDesktop' => 850,
268 'carouselBreakpointTablet' => 520
269 ];
270 }
271
272
273 function sbr_plugin_settings_defaults()
274 {
275 return [
276 'localization' => '',
277 'optimize_images' => true,
278 'usagetracking' => true,
279 'enqueue_js_in_header' => false,
280 'admin_error_notices' => true,
281 'feed_issue_reports' => true,
282 'translations' => [
283 'second' => __('second', 'reviews-feed'),
284 'seconds' => __('seconds', 'reviews-feed'),
285 'minute' => __('minute', 'reviews-feed'),
286 'minutes' => __('minutes', 'reviews-feed'),
287 'hour' => __('hour', 'reviews-feed'),
288 'hours' => __('hours', 'reviews-feed'),
289 'day' => __('day', 'reviews-feed'),
290 'days' => __('days', 'reviews-feed'),
291 'week' => __('week', 'reviews-feed'),
292 'weeks' => __('weeks', 'reviews-feed'),
293 'month' => __('month', 'reviews-feed'),
294 'months' => __('months', 'reviews-feed'),
295 'year' => __('year', 'reviews-feed'),
296 'years' => __('year', 'reviews-feed'),
297 'ago' => __('ago', 'reviews-feed'),
298 'writeReview' => __('Write a Review', 'reviews-feed'),
299 'reviewsHeader' => __('Over %s Reviews', 'reviews-feed'),
300 ]
301 ];
302 }
303 function sbr_activate($network_wide)
304 {
305 global $wp_roles;
306 $wp_roles->add_cap('administrator', 'manage_reviews_feed_options');
307 }
308
309 register_activation_hook(__FILE__, 'sby_activate');
310
311
312 function sbr_get_feed_template_part($part, $settings = array())
313 {
314 $file = '';
315
316 /**
317 * Whether or not to search for custom templates in theme folder
318 *
319 * @param boolean Setting from DB or shortcode to use custom templates
320 *
321 * @since 1.0
322 */
323 $settings_custom_templates = ! empty($settings['customtemplates']) && $settings['customtemplates'];
324 $using_custom_templates_in_theme = apply_filters('sbr_use_theme_templates', $settings_custom_templates);
325 $generic_path = trailingslashit(SBR_PLUGIN_DIR) . 'templates/frontend/';
326
327 //For Templates that are different Free Or Pro
328 $special_path = $generic_path . ( Util::sbr_is_pro() ? 'pro' : 'lite' ) . '/';
329
330 if ($using_custom_templates_in_theme) {
331 $custom_header_template = locate_template('sbr/header.php', false, false);
332 $custom_item_template = locate_template('sbr/item.php', false, false);
333 $custom_footer_template = locate_template('sbr/footer.php', false, false);
334 $custom_feed_template = locate_template('sbr/feed.php', false, false);
335 } else {
336 $custom_header_template = false;
337 $custom_item_template = false;
338 $custom_footer_template = false;
339 $custom_feed_template = false;
340 }
341
342 if ($part === 'header') {
343 if ($custom_header_template) {
344 $file = $custom_header_template;
345 } else {
346 #$file = $generic_path . 'header.php';
347 $file = $special_path . 'header.php';
348 }
349 } elseif ($part === 'item') {
350 if ($custom_item_template) {
351 $file = $custom_item_template;
352 } else {
353 $file = $generic_path . 'item.php';
354 }
355 } elseif ($part === 'footer') {
356 if ($custom_footer_template) {
357 $file = $custom_footer_template;
358 } else {
359 #$file = $generic_path . 'footer.php';
360 $file = $special_path . 'footer.php';
361 }
362 } elseif ($part === 'feed') {
363 if ($custom_feed_template) {
364 $file = $custom_feed_template;
365 } else {
366 #$file = $generic_path . 'feed.php';
367 $file = $special_path . 'feed.php';
368 }
369 } elseif ($part === 'post-elements/author') {
370 if ($custom_feed_template) {
371 $file = $custom_feed_template;
372 } else {
373 #$file = $generic_path . 'post-elements/author.php';
374 $file = $special_path . 'post-elements/author.php';
375 }
376 } elseif ($part === 'post-elements/media') {
377 if ($custom_feed_template) {
378 $file = $custom_feed_template;
379 } else {
380 #$file = $generic_path . 'post-elements/media.php';
381 $file = $special_path . 'post-elements/media.php';
382 }
383 } elseif ($part === 'post-elements/rating') {
384 if ($custom_feed_template) {
385 $file = $custom_feed_template;
386 } else {
387 $file = $generic_path . 'post-elements/rating.php';
388 }
389 } elseif ($part === 'post-elements/text') {
390 if ($custom_feed_template) {
391 $file = $custom_feed_template;
392 } else {
393 $file = $generic_path . 'post-elements/text.php';
394 }
395 }
396
397 return $file;
398 }
399
400 function sbr_container_id($feed_id)
401 {
402 return 'sb-reviews-container-' . $feed_id;
403 }
404
405 function sbr_scripts_enqueue($enqueue = false)
406 {
407 //Register the script to make it available
408 $assets_url = trailingslashit(SBR_PLUGIN_URL);
409 $settings = get_option('sbr_settings', []);
410 if (!is_array($settings)) {
411 $settings = [];
412 }
413 $min = !empty($_GET['sb_debug']) ? '' : '.min';
414
415 wp_enqueue_style(
416 'sbr_styles',
417 $assets_url . 'assets/css/sbr-styles' . $min . '.css',
418 [],
419 SBRVER
420 );
421
422 if (!empty($settings['enqueue_js_in_header'])) {
423 wp_enqueue_script(
424 'sbr_scripts',
425 $assets_url . 'assets/js/sbr-feed' . $min . '.js',
426 ['jquery'],
427 SBRVER,
428 false
429 );
430 } else {
431 wp_register_script(
432 'sbr_scripts',
433 $assets_url . 'assets/js/sbr-feed' . $min . '.js',
434 ['jquery'],
435 SBRVER,
436 true
437 );
438 }
439
440 $data = array(
441 'adminAjaxUrl' => admin_url('admin-ajax.php'),
442 );
443 //Pass option to JS file
444 wp_localize_script('sbr_scripts', 'sbrOptions', $data);
445
446 if ($enqueue || SB_Reviews_Blocks::is_gb_editor()) {
447 wp_enqueue_style('sbr_styles');
448 wp_enqueue_script('sbr_scripts');
449 }
450 }
451 add_action('wp_enqueue_scripts', 'sbr_scripts_enqueue', 2);
452
453 function sbr_esc_html_with_br($text)
454 {
455 return str_replace(array( '&lt;br /&gt;', '&lt;br&gt;' ), '<br>', esc_html(nl2br($text)));
456 }
457
458 /**
459 * Neutralize WordPress shortcodes in third-party review content before output.
460 *
461 * Review data imported from connected sources (Google, Yelp, Booking.com, EDD,
462 * etc.) is rendered inside the dynamic `sbr/sbr-feed-block`. WordPress runs
463 * `do_blocks()` on `the_content` at priority 9 and `do_shortcode()` at priority
464 * 11, so any shortcode left in the rendered block markup is expanded
465 * server-side — including a shortcode an unauthenticated visitor planted in a
466 * public review (e.g. a reviewer name or review body of `[gallery ids=1]`).
467 * The escaping helpers (`esc_html()`, `wp_kses_post()`) deliberately leave the
468 * `[` and `]` characters untouched, so they do not stop this on their own.
469 *
470 * Encoding the square brackets to HEX HTML entities (`&#x5B;` / `&#x5D;`) keeps
471 * the literal text visible to the visitor (the browser renders them as `[` / `]`)
472 * while ensuring `do_shortcode()` can never match them. Apply this as the
473 * OUTERMOST wrapper around already-escaped output: `esc_html()` / `wp_kses_post()`
474 * run first on the raw text (they leave `[` and `]` alone), then this encodes the
475 * brackets last.
476 *
477 * HEX, not decimal, is mandatory here: WordPress core's `do_shortcode()` ends by
478 * calling `unescape_invalid_shortcodes()`, which runs
479 * `str_replace( array( '&#91;', '&#93;' ), array( '[', ']' ), $content )` over the
480 * processed content. That reverses the DECIMAL entities `&#91;` / `&#93;` straight
481 * back to raw `[` / `]` — re-arming the very shortcode we just neutralized (the
482 * feed renders through `do_shortcode` via the `[reviews-feed]` shortcode and again
483 * through the block + `the_content` chain, so this fires in practice). It does NOT
484 * touch the hex forms `&#x5B;` / `&#x5D;`, so those survive intact. Using decimal
485 * here is self-defeating; see SMASH-1607 follow-up (CVE-2026-10724 regression).
486 *
487 * @since 2.6.5
488 *
489 * @see https://awesomemotive.atlassian.net/browse/SMASH-1607 (CVE-2026-10724)
490 *
491 * Non-string (e.g. null) or empty input is returned unchanged, so the type is
492 * intentionally permissive — callers pass already-escaped output, but the guard
493 * keeps a stray null/empty safe rather than coercing it.
494 *
495 * @param string|null $text Already-escaped output that may contain shortcode brackets.
496 * @return string|null The text with `[` and `]` encoded to hex HTML entities (`&#x5B;` / `&#x5D;`); the input unchanged if it isn't a non-empty string.
497 */
498 function sbr_neutralize_shortcodes($text)
499 {
500 if (! is_string($text) || $text === '') {
501 return $text;
502 }
503
504 // Hex entities (not decimal): WordPress core's unescape_invalid_shortcodes()
505 // str_replaces decimal &#91;/&#93; back to [/] inside do_shortcode(), which would
506 // re-arm the shortcode. Hex forms are not reversed. See docblock + SMASH-1607.
507 return str_replace(array( '[', ']' ), array( '&#x5B;', '&#x5D;' ), $text);
508 }
509
510
511
512
513 function sbr_get_fb_connection_urls($is_settings = false)
514 {
515 $urls = array();
516 $admin_url_state = $is_settings ?
517 admin_url('admin.php?page=sbr-settings') :
518 admin_url('admin.php?page=sbr');
519 $sb_admin_email = get_option('admin_email');
520 $nonce = wp_create_nonce('cff_con');
521 $sw_flag = !empty($_GET['sw-feed']) ? true : false;
522
523 // If the admin_url isn't returned correctly then use a fallback.
524 if (
525 $admin_url_state === '/wp-admin/admin.php?page=sbr'
526 || $admin_url_state === '/wp-admin/admin.php?page=sbr&tab=configuration'
527 ) {
528 $admin_url_state = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
529 }
530
531 $urls['page'] = [
532 'connect' => SBR_FB_CONNECT_URL,
533 'wordpress_user' => $sb_admin_email,
534 'v' => 'pro',
535 'vn' => SBRVER,
536 'cff_con' => $nonce,
537 'sw_feed' => $sw_flag
538 ];
539
540 $urls['stateURL'] = $admin_url_state;
541 return $urls;
542 }
543
544 function check_license_valid()
545 {
546 $sbr_settings = get_option('sbr_settings', []);
547 return isset($sbr_settings['license_key'])
548 && !empty($sbr_settings['license_key'])
549 && isset($sbr_settings['license_status'])
550 && !empty($sbr_settings['license_status'])
551 && $sbr_settings['license_status'] !== 'invalid';
552 }
553
554 function sbr_plugin_action_links($links)
555 {
556 $settings_link = check_license_valid() ? admin_url('admin.php?page=sbr-settings') : admin_url('admin.php?page=sbr');
557 $support_link = check_license_valid() ? admin_url('admin.php?page=sbr-support') : admin_url('admin.php?page=sbr');
558 $links = array_merge(
559 array(
560 '<a href="' . esc_url($settings_link) . '">' . __('Settings', 'reviews-feed') . '</a>'
561 ),
562 $links
563 );
564
565 if (!Util::sbr_is_pro()) {
566 $links = array_merge(
567 array(
568 '<a href="https://smashballoon.com/reviews-feed/reviews-lite-upgrade/?utm_campaign=reviews-free&utm_source=plugins-page&utm_medium=upgrade-link&utm_content=UpgradeToPro" target="_blank" style="font-weight:bold; color: #50a56d;">' . __('Upgrade to Pro', 'reviews-feed') . '</a>'
569 ),
570 $links
571 );
572 } else {
573 $links = array_merge(
574 array(
575 '<a href="' . esc_url($support_link) . '">' . __('Support', 'reviews-feed') . '</a>'
576 ),
577 $links
578 );
579 }
580
581 return $links;
582 }
583 add_action('plugin_action_links_' . SBR_PLUGIN_BASENAME, 'sbr_plugin_action_links');
584
585
586 add_action('current_screen', 'sbr_check_current_screen');
587
588 function sbr_check_current_screen()
589 {
590 if (Util::currentPageIs('sbr')) {
591 add_action('admin_enqueue_scripts', 'dequeue_smash_plugins_style');
592 }
593 }
594
595 function dequeue_smash_plugins_style()
596 {
597 wp_dequeue_style('cff_custom_wp_admin_css');
598 wp_deregister_style('cff_custom_wp_admin_css');
599
600 wp_dequeue_style('feed-global-style');
601 wp_deregister_style('feed-global-style');
602
603 wp_dequeue_style('sb_instagram_admin_css');
604 wp_deregister_style('sb_instagram_admin_css');
605
606 wp_dequeue_style('ctf_admin_styles');
607 wp_deregister_style('ctf_admin_styles');
608 }
609
610 function sbr_custom_menu()
611 {
612 if (Util::sbr_is_pro() === false) {
613 $cap = current_user_can('manage_reviews_feed_options') ? 'manage_reviews_feed_options' : 'manage_options';
614 $cap = apply_filters('sbr_settings_pages_capability', $cap);
615 add_submenu_page(
616 'sbr',
617 __('Upgrade to Pro', 'reviews-feed'),
618 __('<div class="sb-pro-upgradelink-bg"></div><strong class="sb-pro-upgradelink">Upgrade to Pro</strong>', 'reviews-feed'),
619 $cap,
620 'https://smashballoon.com/reviews-feed/reviews-lite-upgrade/?utm_campaign=reviews-free&utm_source=menu-link&utm_medium=upgrade-link&utm_content=UpgradeToPro',
621 ''
622 );
623 }
624 }
625
626 add_action('admin_menu', 'sbr_custom_menu', 40);
627
628
629 function sbr_text_domain()
630 {
631 load_plugin_textdomain('reviews-feed', false, dirname(SBR_PLUGIN_BASENAME) . '/languages');
632 }
633 add_action('init', 'sbr_text_domain');
634
635 function sbr_get_current_time()
636 {
637 $current_time = time();
638
639 // where to do tests
640 //$current_time = strtotime( 'November 25, 2020' );
641
642 return $current_time;
643 }
644
645
646 function sbr_recursive_parse_args($args, $defaults)
647 {
648 $new_args = (array) $defaults;
649
650 foreach ($args as $key => $value) {
651 if (is_array($value) && isset($new_args[ $key ])) {
652 $new_args[ $key ] = sbr_recursive_parse_args($value, $new_args[ $key ]);
653 } else {
654 $new_args[ $key ] = $value;
655 }
656 }
657 return $new_args;
658 }
659
660 function sbr_doing_openssl()
661 {
662 return extension_loaded('openssl');
663 }
664
665 function sbr_encrypt_decrypt($action, $string)
666 {
667 $output = false;
668
669 $encrypt_method = "AES-256-CBC";
670 $secret_key = 'SMA$H.BA[[OON#23121';
671 $secret_iv = '1231394873342102221';
672
673 // hash
674 $key = hash('sha256', $secret_key);
675
676 // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning
677 $iv = substr(hash('sha256', $secret_iv), 0, 16);
678
679 if ($action === 'encrypt') {
680 $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv);
681 $output = base64_encode($output);
682 } elseif ($action === 'decrypt') {
683 $output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv);
684 }
685
686 return $output;
687 }
688
689
690 /**
691 * Returns a list of providers that needs
692 * the bulk history update
693 *
694 * @return array
695 *
696 * @since 1.5
697 */
698 function sbr_get_bulk_providers()
699 {
700 return [
701 'google',
702 'yelp'
703 ];
704 }
705
706 /**
707 * Returns a list of providers that
708 * have media
709 *
710 * @return array
711 *
712 * @since 1.5
713 */
714 function sbr_get_media_providers()
715 {
716 return [
717 'yelp',
718 'tripadvisor',
719 'google'
720 ];
721 }
722
723 /**
724 * Returns a list of providers that doesn't
725 * have media
726 *
727 * @return array
728 *
729 * @since 1.5
730 */
731 function sbr_get_no_media_providers()
732 {
733 return [
734 'facebook',
735 'woocommerce',
736 'edd',
737 'airbnb',
738 'booking',
739 'aliexpress'
740 ];
741 }
742
743 /**
744 * Returns a list of providers that have
745 * translations / languages Possibility
746 *
747 * @return array
748 *
749 * @since 1.5
750 */
751 function sbr_get_lang_providers()
752 {
753 return [
754 'google'
755 ];
756 }
757