| File was renamed from inc/integrations/Instagram.php |
| | |
| | | * Instagram Integration |
| | | * File: /inc/integrations/Instagram.php |
| | | */ |
| | | namespace JVBase\integrations; |
| | | |
| | | namespace JVBase\integrations\services; |
| | | use JVBase\integrations\Integrations; |
| | | use JVBase\meta\Meta; |
| | | use WP_Error; |
| | | use WP_REST_Request; |
| | | use WP_REST_Response; |
| | | use Exception; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | | exit; |
| | |
| | | $this->defaults = [ |
| | | |
| | | ]; |
| | | $this->handleWebhooks = true; |
| | | $this->hasWebhooks = true; |
| | | parent::__construct($userID); |
| | | |
| | | $this->actions = array_merge( |
| | |
| | | } |
| | | |
| | | public function getCredentials():array { |
| | | parent::getCredentials(); |
| | | if (empty($this->credentials)) { |
| | | $credentials = parent::getCredentials(); |
| | | if (empty($credentials)) { |
| | | $facebook = JVB()->connect('facebook'); |
| | | |
| | | if (!$facebook || !$facebook->isSetUp()) { |
| | |
| | | |
| | | $fbCredentials = $facebook->getCredentials(); |
| | | |
| | | $this->credentials = [ |
| | | return [ |
| | | 'client_id' => $fbCredentials['client_id'], |
| | | 'client_secret' => $fbCredentials['client_secret'], |
| | | ]; |
| | | } |
| | | return $this->credentials; |
| | | return $credentials; |
| | | } |
| | | |
| | | private function switchInstagramAccount(array $data): WP_Error|array |