Example #1
0
 function plugin_isbn_get_isbn_title(&$isbn, $check = true)
 {
     $asin = '';
     if (strlen($isbn) === 13 && !($asin = $this->func->cache_get_db($isbn, 'isbn'))) {
         include_once XOOPS_TRUST_PATH . '/class/hyp_common/hsamazon/hyp_simple_amazon.php';
         $ama = new HypSimpleAmazon();
         if ($this->root->amazon_AccessKeyId) {
             $ama->AccessKeyId = $this->root->amazon_AccessKeyId;
         }
         if ($this->root->amazon_SecretAccessKey) {
             $ama->SecretAccessKey = $this->root->amazon_SecretAccessKey;
         }
         $asin = $ama->ISBN2ASIN($isbn);
         $ttl = $asin == $isbn ? 86400 : 86400 * 365;
         $this->func->cache_save_db($asin, 'isbn', $ttl, $isbn);
     }
     if ($asin) {
         $isbn = $asin;
     }
     $nocache = $nocachable = 0;
     $title = $category = $price = $author = $artist = $releasedate = $manufacturer = $availability = $listprice = $usedprice = '';
     if ($title = $this->plugin_isbn_cache_fetch($isbn, $this->cont['CACHE_DIR'] . 'plugin/', $check)) {
         list($title, $category, $price, $author, $artist, $releasedate, $manufacturer, $availability, $listprice, $usedprice) = array_pad($title, 10, '');
     } else {
         $title = 'ASIN:' . $isbn;
     }
     $tmpary = array($title, $category, $price, $author, $artist, $releasedate, $manufacturer, $availability, $listprice, $usedprice);
     return $tmpary;
 }
Example #2
0
 function is_asin()
 {
     include_once XOOPS_TRUST_PATH . '/class/hyp_common/hsamazon/hyp_simple_amazon.php';
     $ama = new HypSimpleAmazon();
     $this->asin = $ama->ISBN2ASIN($this->asin_all);
     $ama = NULL;
     if (!preg_match('/[a-z0-9]{10}/i', $this->asin)) {
         $this->asin = '';
         return FALSE;
     }
     return TRUE;
 }