Пример #1
0
 function setUp()
 {
     // create a new instance of String with the
     // string 'abc'
     $this->cacheObj = Erdiko::getCache("default");
     //$this->cacheObj = new Cache();
 }
Пример #2
0
 /** Before */
 public function _before()
 {
     $this->setThemeName('bootstrap');
     $this->prepareTheme();
     $this->cacheObj = \Erdiko::getCache();
     // \Erdiko::log(null, "GET: ".print_r($_GET, true));
     \Erdiko::log(null, "code (0): " . $this->cacheObj->get('shopify_code'));
     \Erdiko::log(null, "shop (0): " . $this->cacheObj->get('shopify_shop'));
     \Erdiko::log(null, "token (0): " . $this->cacheObj->get('shopify_token'));
     if (isset($_GET['code'])) {
         $this->cacheObj->put('shopify_code', $_GET['code']);
         $this->cacheObj->put('shopify_shop', $_GET['shop']);
     }
     if (empty($this->cacheObj->get('shopify_code'))) {
         $shop = $this->returnSite();
         //var_dump($shop);
         $this->cacheObj->put('shopify_shop', $shop);
         $this->shopify = new Shopify($shop, "", $this->returnApiKey(), $this->returnSecret());
         // get the URL to the current page
         $pageURL = 'http';
         // if ($_SERVER["HTTPS"] == "on") { $pageURL .= "s"; }
         $pageURL .= "://";
         if ($_SERVER["SERVER_PORT"] != "80") {
             $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
         } else {
             $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
         }
         // Redirect to Shopfy to get authorization
         header("Location: " . $this->shopify->getAuthorizeUrl($this->returnScope(), $pageURL));
     }
     $this->shopify = new Shopify($this->cacheObj->get('shopify_shop'), "", $this->returnApiKey(), $this->returnSecret());
     // Check for an existing token, if not present request one using the code
     if (empty($this->cacheObj->get('shopify_token'))) {
         $token = $this->shopify->getAccessToken($this->cacheObj->get('shopify_code'));
         $this->cacheObj->put('shopify_token', $token);
     }
     \Erdiko::log(null, "code (1): " . $this->cacheObj->get('shopify_code'));
     \Erdiko::log(null, "shop (1): " . $this->cacheObj->get('shopify_shop'));
     \Erdiko::log(null, "token (1): " . $this->cacheObj->get('shopify_token'));
     // Set the token within shopify so we can use the API
     $this->shopify->setToken($this->cacheObj->get('shopify_token'));
 }
Пример #3
0
 public function getCache()
 {
     //Reture false if config file is not existed
     $this->assertTrue(Erdiko::getCache("default"));
 }