/** * Request an instance of the OAuthStore */ public static function getInstance($object = null, $options = array()) { if (!AuthStore::$instance) { if (!$object instanceof AuthStoreAbstract) { AuthStore::$instance = new AuthSessionStore(); } else { AuthStore::$instance = $object; } } elseif (!is_null($object)) { AuthStore::$instance = $object; } return AuthStore::$instance; }
public function __construct($config, $authStore = null, $disableSession = false) { if (!$disableSession && !session_id()) { throw new ShoploException('Session not initialized'); } if (!isset($config['api_key']) || empty($config['api_key'])) { throw new ShoploException('Invalid Api Key'); } elseif (!isset($config['secret_key']) || empty($config['secret_key'])) { throw new ShoploException('Invalid Api Key'); } elseif (!isset($config['callback_url']) || empty($config['callback_url'])) { throw new ShoploException('Invalid Callback Url'); } $this->api_key = $config['api_key']; $this->secret_key = $config['secret_key']; $shopDomain = null; if (isset($_GET['shop_domain'])) { $shopDomain = addslashes($_GET['shop_domain']); $_SESSION['shop_domain'] = $shopDomain; } $this->callback_url = false === strpos($config['callback_url'], 'http') ? 'http://' . $config['callback_url'] : $config['callback_url']; $this->auth_store = AuthStore::getInstance($authStore); $this->authorize(); $client = $this->getClient(); $this->assets = new Assets($client); $this->category = new Category($client); $this->cart = new Cart($client); $this->collection = new Collection($client); $this->customer = new Customer($client); $this->order = new Order($client); $this->order_status = new OrderStatus($client); $this->product = new Product($client); $this->product_image = new ProductImage($client); $this->product_variant = new ProductVariant($client); $this->vendor = new Vendor($client); $this->shop = new Shop($client); $this->webhook = new Webhook($client); $this->theme = new Theme($client); $this->page = new Page($client); $this->shipping = new Shipping($client); $this->checkout = new Checkout($client); }