class-connect-helper.php
1 year ago
class-core.php
10 months ago
class-database.php
10 months ago
class-google-api-new.php
1 year ago
class-google-api-old.php
11 months ago
class-google-connect.php
11 months ago
class-google-dao.php
10 months ago
class-google-utils.php
1 year ago
class-google-utils.php
32 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WP_Rplg_Google_Reviews\Includes\Core; |
| 4 | |
| 5 | class Google_Utils { |
| 6 | |
| 7 | private $api_old; |
| 8 | private $api_new; |
| 9 | |
| 10 | public function __construct(Google_Api_Old $api_old, Google_Api_New $api_new) { |
| 11 | $this->api_old = $api_old; |
| 12 | $this->api_new = $api_new; |
| 13 | } |
| 14 | |
| 15 | public function refresh($args) { |
| 16 | $pid = $args[0]; |
| 17 | $lang = $args[1]; |
| 18 | $local_img = isset($args[2]) ? $args[2] : 'false'; |
| 19 | |
| 20 | $key = get_option('grw_google_api_key'); |
| 21 | if ($key && strlen($key) > 0) { |
| 22 | |
| 23 | $gpa_old = get_option('grw_gpa_old'); |
| 24 | if ($gpa_old === 'true') { |
| 25 | $response = $this->api_old->refresh($pid, $lang, $key, $local_img); |
| 26 | } else { |
| 27 | $response = $this->api_new->connect($pid, $lang, $key, $local_img); |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | } |