PluginProbe ʕ •ᴥ•ʔ
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.6.7
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.6.7
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 / Services / CLIService.php
reviews-feed / class / Common / Services Last commit date
Upgrade 2 months ago CLIService.php 2 months ago FeedCacheUpdateService.php 2 months ago MigrationReactivationNotice.php 2 months ago SBR_Upgrader.php 2 months ago SettingsManagerService.php 2 months ago ShortcodeService.php 2 months ago SiteUrlWatcher.php 2 months ago UsageTrackingService.php 2 months ago
CLIService.php
50 lines
1 <?php
2
3 namespace SmashBalloon\Reviews\Common\Services;
4
5 use SmashBalloon\Reviews\Common\Exceptions\RelayResponseException;
6 use SmashBalloon\Reviews\Common\Integrations\SBRelay;
7 use Smashballoon\Stubs\Services\ServiceProvider;
8
9 class CLIService extends ServiceProvider
10 {
11 private $relay;
12
13 public function __construct(SBRelay $relay)
14 {
15 $this->relay = $relay;
16 }
17
18 public function register()
19 {
20 if (defined('WP_CLI') && WP_CLI) {
21 \WP_CLI::add_command('sbr_update', [$this, 'update_site_setting']);
22 \WP_CLI::add_command('sbr_get', [$this, 'get_site_setting']);
23 }
24 }
25
26 public function update_site_setting($args, $assoc_args)
27 {
28 try {
29 $response = $this->relay->call('settings', $assoc_args, 'POST', true);
30 if (isset($response['data'])) {
31 \WP_CLI::success(json_encode($response['data']));
32 }
33 } catch (RelayResponseException $exception) {
34 \WP_CLI::error($exception->getMessage());
35 }
36 }
37
38 public function get_site_setting($args, $assoc_args)
39 {
40 try {
41 $response = $this->relay->call('settings', [], 'GET', true);
42 if (isset($response['data'])) {
43 \WP_CLI::success(json_encode($response['data']));
44 }
45 } catch (RelayResponseException $exception) {
46 \WP_CLI::error($exception->getMessage());
47 }
48 }
49 }
50