Plugin Directory

Changeset 1170322


Ignore:
Timestamp:
05/29/2015 05:00:42 PM (11 years ago)
Author:
cottonspace
Message:

Version 1.2 (Support Rakuten API 2014-02-22 version).

Location:
cs-shop/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cs-shop/trunk/cs-shop.php

    r655498 r1170322  
    44Plugin URI: http://www.csync.net/category/blog/wp-plugin/cs-shop/
    55Description: Easy to create a affiliate products page of affiliate services in Japan.
    6 Version: 1.1.1
     6Version: 1.2
    77Author: cottonspace
    88Author URI: http://www.csync.net/
     
    2828 * プラグインのバージョン
    2929 */
    30 define('CS_SHOP_VER', '1.1.1');
     30define('CS_SHOP_VER', '1.2');
    3131
    3232/**
  • cs-shop/trunk/readme.txt

    r655498 r1170322  
    44Requires at least: 3.0
    55Tested up to: 3.0
    6 Stable tag: 1.1.1
     6Stable tag: 1.2
    77
    88Easy to create a affiliate products page of affiliate services in Japan.
     
    2929
    3030== Changelog ==
     31
     32= 1.2 =
     33* Support Rakuten API 2014-02-22 version.
    3134
    3235= 1.1.1 =
  • cs-shop/trunk/service-rakuten.php

    r575123 r1170322  
    33 * アフィリエイトサービス実装クラス(楽天)
    44 * User: cottonspace
    5  * Date: 12/04/11
     5 * Date: 15/05/30
    66 */
    77
     
    5353    /**
    5454     * カテゴリ検索クエリ生成
    55      * @link http://webservice.rakuten.co.jp/api/genresearch/
     55     * @link https://webservice.rakuten.co.jp/api/ichibagenresearch/
    5656     * @param string $category 対象カテゴリ
    5757     * @return string RESTクエリ文字列
     
    6262            $category = 0;
    6363        }
    64         $baseurl = "http://api.rakuten.co.jp/rws/3.0/rest";
     64        $baseurl = "https://app.rakuten.co.jp/services/api/IchibaGenre/Search/20140222";
    6565        $params = array();
    66         $params["developerId"] = $this->account["developerId"];
     66        $params["applicationId"] = $this->account["developerId"];
    6767        $params["affiliateId"] = $this->account["affiliateId"];
    68         $params["operation"] = "GenreSearch";
    69         $params["version"] = "2007-04-11";
     68        $params["format"] = "xml";
    7069        $params["genrePath"] = 0;
    7170        $params["genreId"] = $category;
     
    7675    /**
    7776     * 商品検索クエリ生成
    78      * @link http://webservice.rakuten.co.jp/api/itemsearch/
     77     * @link https://webservice.rakuten.co.jp/api/ichibaitemsearch/
    7978     * @return string RESTクエリ文字列
    8079     */
    8180    private function queryItems()
    8281    {
    83         $baseurl = "http://api.rakuten.co.jp/rws/3.0/rest";
     82        $baseurl = "https://app.rakuten.co.jp/services/api/IchibaItem/Search/20140222";
    8483        $params = array();
    85         $params["developerId"] = $this->account["developerId"];
     84        $params["applicationId"] = $this->account["developerId"];
    8685        $params["affiliateId"] = $this->account["affiliateId"];
    87         $params["operation"] = "ItemSearch";
    88         $params["version"] = "2010-09-15";
     86        $params["format"] = "xml";
    8987        $params["hits"] = $this->requests["pagesize"];
    9088        $params["availability"] = 1;
     
    159157        // RESTクエリ実行
    160158        $strxml = $this->download($query, $query);
    161         $strxml = str_replace("header:Header", "Header", $strxml);
    162         $strxml = str_replace("genreSearch:GenreSearch", "GenreSearch", $strxml);
    163159        $objxml = simplexml_load_string($strxml);
    164160        $hash = array();
    165         if (isset($objxml->Body->GenreSearch)) {
    166             foreach ($objxml->Body->GenreSearch->child as $node) {
     161        if (isset($objxml->children)) {
     162            foreach ($objxml->children->child as $node) {
    167163                $hash[(string)$node->genreId] = (string)$node->genreName;
    168164            }
     
    183179        // RESTクエリ実行
    184180        $strxml = $this->download($query, $query);
    185         $strxml = str_replace("header:Header", "Header", $strxml);
    186         $strxml = str_replace("itemSearch:ItemSearch", "ItemSearch", $strxml);
    187181        $objxml = simplexml_load_string($strxml);
    188182        $hash = array();
    189         if (isset($objxml->Body->ItemSearch)) {
    190             $this->pages = intval($objxml->Body->ItemSearch->pageCount);
    191             foreach ($objxml->Body->ItemSearch->Items->Item as $node) {
     183        if (isset($objxml->Items)) {
     184            $this->pages = intval($objxml->pageCount);
     185            foreach ($objxml->Items->Item as $node) {
    192186                array_push($hash, array(
    193187                        "name" => (string)$node->itemName,
     
    197191                        "score" => floatval((string)$node->reviewAverage),
    198192                        "aurl" => (string)$node->affiliateUrl,
    199                         "iurl" => empty($this->requests["mobile"]) ? (string)$node->mediumImageUrl : (string)$node->smallImageUrl,
     193                        "iurl" => empty($this->requests["mobile"]) ? (string)$node->mediumImageUrls->imageUrl[0] : (string)$node->smallImageUrls->imageUrl[0],
    200194                        "surl" => (string)$node->shopUrl
    201195                    )
Note: See TracChangeset for help on using the changeset viewer.