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 / Common / BusinessDataCache.php
reviews-feed / class / Common Last commit date
Admin 1 month ago Builder 1 month ago Customizer 1 month ago Exceptions 1 month ago Helpers 1 month ago Integrations 1 month ago Migrations 1 month ago ReviewAlerts 1 month ago Services 1 month ago Settings 1 month ago Support 1 month ago Traits 1 month ago Utils 1 month ago AuthorizationStatusCheck.php 1 month ago BusinessDataCache.php 1 month ago Clear_Cache.php 1 month ago Container.php 1 month ago DisplayElements.php 1 month ago Email_Notification.php 1 month ago Error_Reporter.php 1 month ago Feed.php 1 month ago FeedCache.php 1 month ago FeedCacheUpdater.php 1 month ago FeedDisplay.php 1 month ago Feed_Locator.php 1 month ago Parser.php 1 month ago PostAggregator.php 1 month ago RemoteRequest.php 1 month ago SBR_Education.php 1 month ago SBR_Settings.php 1 month ago ServiceContainer.php 1 month ago SinglePostCache.php 1 month ago TemplateRenderer.php 1 month ago Tooltip_Wizard.php 1 month ago Util.php 1 month ago
BusinessDataCache.php
50 lines
1 <?php
2
3 /**
4 * Class BusinessDataCache
5 *
6 * @since 1.0
7 */
8
9 namespace SmashBalloon\Reviews\Common;
10
11 class BusinessDataCache {
12 public const CACHE_KEY = 'sbr_business_cache';
13
14 private $business_cache;
15
16 public function __construct()
17 {
18 $raw_cache = get_option(self::CACHE_KEY, '{}');
19
20 $this->business_cache = json_decode($raw_cache, true);
21 }
22
23 public function get_data($provider, $business_id)
24 {
25 if (! empty($this->business_cache[ $provider ][ $business_id ])) {
26 return $this->business_cache[ $provider ][ $business_id ];
27 }
28
29 return array();
30 }
31
32 public function update_single_datum($provider, $business_id, $data_key, $data_value)
33 {
34 if (empty($this->business_cache[ $provider ][ $business_id ])) {
35 return false;
36 }
37 $this->business_cache[ $provider ][ $business_id ][ $data_key ] = $data_value;
38
39 return update_option(self::CACHE_KEY, wp_json_encode($this->business_cache), false);
40 }
41
42 public function update_data($provider, $business_id, $data)
43 {
44 $this->business_cache[ $provider ][ $business_id ] = $data;
45
46 return update_option(self::CACHE_KEY, wp_json_encode($this->business_cache), false);
47 }
48
49 }
50