Plugin Directory

Changeset 537630


Ignore:
Timestamp:
04/28/2012 10:10:18 AM (14 years ago)
Author:
cottonspace
Message:

Version 0.9.7

Location:
cs-shop/trunk
Files:
1 added
6 edited

Legend:

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

    r536232 r537630  
    2222        "アプリケーションID" => "csshop_yahoo_appid",
    2323        "アフィリエイトID" => "csshop_yahoo_affiliate_id"
     24    ),
     25    "LinkShare" => array(
     26        "トークン" => "csshop_linkshare_token",
     27        "マーチャンダイザー FTP サーバ" => "csshop_linkshare_md_host",
     28        "マーチャンダイザー FTP ユーザ" => "csshop_linkshare_md_user",
     29        "マーチャンダイザー FTP パスワード" => "csshop_linkshare_md_pass"
    2430    )
    2531);
  • cs-shop/trunk/cs-shop.php

    r536238 r537630  
    44Plugin URI: http://www.csync.net/category/blog/wp-plugin/cs-shop/
    55Description: You can easily create a product search page from the affiliate services of Japan.
    6 Version: 0.9.6.1
     6Version: 0.9.7
    77Author: cottonspace
    88Author URI: http://www.csync.net/
     
    2929 * プラグインのバージョン
    3030 */
    31 define('CS_SHOP_VER', '0.9.6.1');
     31define('CS_SHOP_VER', '0.9.7');
    3232
    3333/**
     
    3939 * 開発・デバッグ用の設定
    4040 */
    41 // ini_set('display_errors', 1);
    42 // ini_set('error_reporting', E_ALL);
     41//ini_set('display_errors', 1);
     42//ini_set('error_reporting', E_ALL);
    4343
    4444/**
     
    6060    $params = shortcode_atts(array(
    6161            "service" => "",
    62             "action" => "",
    6362            "shop" => "",
    6463            "pagesize" => "",
     
    113112            ));
    114113            break;
     114        case "linkshare":
     115
     116            // LinkShare
     117            require_once 'service-linkshare.php';
     118            $service = new LinkShare(array(
     119                "token"
     120                => get_option("csshop_linkshare_token"),
     121                "md_host"
     122                => get_option("csshop_linkshare_md_host"),
     123                "md_user"
     124                => get_option("csshop_linkshare_md_user"),
     125                "md_pass"
     126                => get_option("csshop_linkshare_md_pass")
     127            ));
     128            break;
    115129        default:
    116130
     
    120134    }
    121135
    122     // アクション別処理
    123     switch ($params["action"]) {
    124         case "search":
    125 
    126             // 現在ページ位置の補正
    127             if (!isset($params["page"]) || empty($params["page"])) {
    128                 $params["page"] = "1";
    129             }
    130 
    131             // ページサイズ値の補正
    132             if (!isset($params["pagesize"]) || empty($params["pagesize"])) {
    133                 $params["pagesize"] = "10";
    134             }
    135 
    136             // 商品検索条件の設定
    137             $service->setRequestParams($params);
    138 
    139             // 商品検索実行
    140             $items = $service->getItems();
    141 
    142             // 検索フォーム表示
    143             $output .= showSearchForm($service, $params);
    144 
    145             // 検索結果の存在確認
    146             if (0 < count($items)) {
    147 
    148                 // ページナビゲータ生成
    149                 $pagelinks = showPageLinks($service, $params);
    150 
    151                 // 上部ページナビゲータ表示
    152                 $output .= $pagelinks;
    153 
    154                 // 商品一覧表示
    155                 $output .= showItems($params, $items);
    156 
    157                 // 下部ページナビゲータ表示
    158                 $output .= $pagelinks;
    159             } else {
    160 
    161                 // 検索結果が 0 件の場合(キーワードが指定されている場合のみ)
    162                 if (!empty($params["keyword"])) {
    163 
    164                     // 検索結果が無いメッセージ
    165                     $output .= "<p>検索条件に該当する商品はありませんでした。</p>";
    166 
    167                     // 最上位カテゴリ一覧を表示
    168                     $output .= showRootCategories($service);
    169                 }
    170             }
    171             break;
    172         default:
    173 
    174             // 指定されていない場合(最上位カテゴリ一覧を表示)
    175             $output .= showRootCategories($service);
    176             break;
     136    // 現在ページ位置の補正
     137    if (!isset($params["page"]) || empty($params["page"])) {
     138        $params["page"] = "1";
     139    }
     140
     141    // ページサイズ値の補正
     142    if (!isset($params["pagesize"]) || empty($params["pagesize"])) {
     143        $params["pagesize"] = "10";
     144    }
     145
     146    // 商品検索条件の設定
     147    $service->setRequestParams($params);
     148
     149    // 検索フォーム表示
     150    $output .= showSearchForm($service, $params);
     151
     152    // 商品検索実行
     153    $items = $service->getItems();
     154
     155    // 検索結果の存在確認
     156    if (0 < count($items)) {
     157
     158        // ページナビゲータ生成
     159        $pagelinks = showPageLinks($service, $params);
     160
     161        // 上部ページナビゲータ表示
     162        $output .= $pagelinks;
     163
     164        // 商品一覧表示
     165        $output .= showItems($params, $items);
     166
     167        // 下部ページナビゲータ表示
     168        $output .= $pagelinks;
     169
     170    } else {
     171
     172        // 検索結果が 0 件の場合(キーワードが指定されている場合のみ)
     173        if (!empty($params["keyword"])) {
     174
     175            // 検索結果が無いメッセージ
     176            $output .= "<p>検索条件に該当する商品はありませんでした。</p>";
     177        }
     178
     179        // 最上位カテゴリ一覧を表示
     180        $output .= showRootCategories($service, $params);
    177181    }
    178182
  • cs-shop/trunk/function-view.php

    r536232 r537630  
    2424function getScoreLevel($score)
    2525{
    26 
    2726    // 出力コンテンツ
    2827    $output = "";
     
    5554 * 最上位カテゴリ一覧
    5655 * @param object $service サービス情報
    57  * @return string 出力コンテンツ
    58  */
    59 function showRootCategories(&$service)
    60 {
    61     // 出力コンテンツ
    62     $output = "";
     56 * @param array $params 要求パラメタ
     57 * @return string 出力コンテンツ
     58 */
     59function showRootCategories(&$service, &$params)
     60{
     61    // 出力コンテンツ
     62    $output = "";
     63
     64    // 要求パラメタの複製を作成(指定キーのみ)
     65    $work = array();
     66    foreach (array("service", "pagesize", "keyword", "shop", "sort") as $k) {
     67        if (array_key_exists($k, $params) && !empty($params[$k])) {
     68            $work[$k] = $params[$k];
     69        }
     70    }
    6371
    6472    // 基準URLの生成
    65     $url = getCurrentUrl() . "service=" . urlencode($service->serviceName()) . "&action=search";
     73    $url = getCurrentUrl() . http_build_query($work);
    6674
    6775    // 第2階層まで表示
     
    183191    // 要求パラメタの出力エスケープ処理(指定キーのみ)
    184192    $work = array();
    185     foreach (array("service", "action", "pagesize", "keyword", "shop", "category", "sort") as $k) {
     193    foreach (array("service", "pagesize", "keyword", "shop", "category", "sort") as $k) {
    186194        if (array_key_exists($k, $params) && !empty($params[$k])) {
    187195            $work[$k] = o_escape($params[$k]);
     
    218226<input type="text" name="keyword" value="{$work["keyword"]}" />
    219227<input type="hidden" name="service" value="{$work["service"]}" />
    220 <input type="hidden" name="action" value="{$work["action"]}" />
    221228<input type="hidden" name="shop" value="{$work["shop"]}" />
    222229<input type="hidden" name="pagesize" value="{$work["pagesize"]}" />\n
     
    320327    // 要求パラメタの複製を作成(指定キーのみ)
    321328    $work = array();
    322     foreach (array("service", "action", "pagesize", "keyword", "shop", "category", "sort") as $k) {
     329    foreach (array("service", "pagesize", "keyword", "shop", "category", "sort") as $k) {
    323330        if (array_key_exists($k, $params) && !empty($params[$k])) {
    324331            $work[$k] = $params[$k];
  • cs-shop/trunk/readme.txt

    r536238 r537630  
    44Requires at least: 3.0
    55Tested up to: 3.0
    6 Stable tag: 0.9.6.1
     6Stable tag: 0.9.7
    77
    88You can easily create a product search page from the affiliate services of Japan.
     
    2929
    3030== Changelog ==
     31
     32= 0.9.7 =
     33* Add support LinkShare.
     34* Remove "action" parameter from shortcode attributes.
    3135
    3236= 0.9.6.1 =
     
    6771== Upgrade Notice ==
    6872
     73= 0.9.7 =
     74Support LinkShare.
     75
    6976= 0.9.6.1 =
    7077Re-release version 0.9.6.
     
    104111To view the results of a search by specifying the keyword 'foo' automatically.
    105112
    106 `[csshop service="rakuten" action="search" keyword="foo"]`
     113`[csshop service="rakuten" keyword="foo"]`
    107114
    108 `[csshop service="amazon" action="search" keyword="foo"]`
     115`[csshop service="amazon" keyword="foo"]`
     116
     117`[csshop service="yahoo" keyword="foo"]`
     118
     119`[csshop service="linkshare" keyword="foo"]`
    109120
    110121To view the results of a search by specifying the specified category automatically.
    111122
    112 `[csshop service="rakuten" action="search" category="100026"]`
     123`[csshop service="rakuten" category="100026"]`
    113124
    114 `[csshop service="amazon" action="search" category="Electronics"]`
     125`[csshop service="amazon" category="Electronics"]`
     126
     127`[csshop service="yahoo" category="Electronics"]`
     128
     129`[csshop service="linkshare" category="Electronics"]`
  • cs-shop/trunk/service-rakuten.php

    r536232 r537630  
    198198                        "aurl" => (string)$node->affiliateUrl,
    199199                        "iurl" => empty($this->requests["mobile"]) ? (string)$node->mediumImageUrl : (string)$node->smallImageUrl,
    200                         "surl" => (string)$node->shopUrl)
     200                        "surl" => (string)$node->shopUrl
     201                    )
    201202                );
    202203            }
  • cs-shop/trunk/service-yahoo.php

    r536232 r537630  
    196196                        "aurl" => (string)$node->Url,
    197197                        "iurl" => empty($this->requests["mobile"]) ? (string)$node->Image->Medium : (string)$node->Image->Small,
    198                         "surl" => (string)$node->Store->Url)
     198                        "surl" => (string)$node->Store->Url
     199                    )
    199200                );
    200201            }
Note: See TracChangeset for help on using the changeset viewer.