Plugin Directory

Changeset 546232


Ignore:
Timestamp:
05/19/2012 04:17:24 PM (14 years ago)
Author:
cottonspace
Message:

Add "embed" mode.

Location:
cs-shop/trunk
Files:
3 edited

Legend:

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

    r538922 r546232  
    109109
    110110div.csshop-service-credits {
     111    clear: both;
    111112    text-align: left;
    112113    vertical-align: middle;
  • cs-shop/trunk/cs-shop.php

    r538922 r546232  
    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.8
     6Version: 0.9.9
    77Author: cottonspace
    88Author URI: http://www.csync.net/
     
    2828 * プラグインのバージョン
    2929 */
    30 define('CS_SHOP_VER', '0.9.8');
     30define('CS_SHOP_VER', '0.9.9');
    3131
    3232/**
     
    6363            "keyword" => "",
    6464            "category" => "",
    65             "sort" => ""),
     65            "sort" => "",
     66            "mode" => ""),
    6667        $atts);
    6768
     
    7677    // アフィリエイトサービス選択(WordPress プラグイン設定を取得してサービス別のインスタンスを生成)
    7778    switch ($params["service"]) {
     79
     80        // 楽天アフィリエイト
    7881        case "rakuten":
    79 
    80             // 楽天アフィリエイト
    8182            require_once 'service-rakuten.php';
    8283            $service = new Rakuten(array(
     
    8788            ));
    8889            break;
     90
     91        // Amazon
    8992        case "amazon":
    90 
    91             // Amazon
    9293            require_once 'service-amazon.php';
    9394            $service = new Amazon(array(
     
    100101            ));
    101102            break;
     103
     104        // Yahoo!ショッピング
    102105        case "yahoo":
    103 
    104             // Yahoo!ショッピング
    105106            require_once 'service-yahoo.php';
    106107            $service = new Yahoo(array(
     
    111112            ));
    112113            break;
     114
     115        // LinkShare
    113116        case "linkshare":
    114 
    115             // LinkShare
    116117            require_once 'service-linkshare.php';
    117118            $service = new LinkShare(array(
     
    120121            ));
    121122            break;
     123
     124        // ValueCommerce
    122125        case "valuecommerce":
    123 
    124             // ValueCommerce
    125126            require_once 'service-valuecommerce.php';
    126127            $service = new ValueCommerce(array(
     
    129130            ));
    130131            break;
     132
     133        // 定義されていないサービスの場合(何も出力しない)
    131134        default:
    132 
    133             // 定義されていないサービスの場合(何も出力しない)
    134135            return $output;
    135136            break;
     
    143144    // ページサイズ値の補正
    144145    if (!isset($params["pagesize"]) || empty($params["pagesize"])) {
    145         $params["pagesize"] = "10";
     146
     147        // 表示モード別デフォルト値
     148        switch ($params["mode"]) {
     149
     150            // 埋め込みモード
     151            case "embed":
     152                $params["pagesize"] = "1";
     153                break;
     154
     155            // 標準モード
     156            default:
     157                $params["pagesize"] = "10";
     158                break;
     159        }
    146160    }
    147161
     
    149163    $service->setRequestParams($params);
    150164
    151     // 検索フォーム表示
    152     $output .= showSearchForm($service, $params);
    153 
    154165    // 商品検索実行
    155166    $items = $service->getItems();
    156167
    157     // 検索結果の存在確認
    158     if (0 < count($items)) {
    159 
    160         // ページナビゲータ生成
    161         $pagelinks = showPageLinks($service, $params);
    162 
    163         // 上部ページナビゲータ表示
    164         $output .= $pagelinks;
    165 
    166         // 商品一覧表示
    167         $output .= showItems($params, $items);
    168 
    169         // 下部ページナビゲータ表示
    170         $output .= $pagelinks;
    171 
    172     } else {
    173 
    174         // 検索結果が 0 件の場合(キーワードが指定されている場合のみ)
    175         if (!empty($params["keyword"])) {
    176 
    177             // 検索結果が無いメッセージ
    178             $output .= "<p>検索条件に該当する商品はありませんでした。</p>";
    179         }
    180 
    181         // 最上位カテゴリ一覧を表示
    182         $output .= showRootCategories($service, $params);
    183     }
    184 
    185     // サービスクレジット表示
    186     $output .= showServiceCredits($service);
     168    // 表示モード別結果表示
     169    switch ($params["mode"]) {
     170
     171        // 埋め込みモード(検索結果のみ表示)
     172        case "embed":
     173
     174            // 検索結果の存在確認
     175            if (0 < count($items)) {
     176
     177                // ページサイズ値の再適用
     178                array_splice($items, $params["pagesize"]);
     179
     180                // 商品一覧表示
     181                $output .= showItems($params, $items);
     182            }
     183            break;
     184
     185        // 標準モード
     186        default:
     187
     188            // 検索フォーム表示
     189            $output .= showSearchForm($service, $params);
     190
     191            // 検索結果の存在確認
     192            if (0 < count($items)) {
     193
     194                // ページナビゲータ生成
     195                $pagelinks = showPageLinks($service, $params);
     196
     197                // 上部ページナビゲータ表示
     198                $output .= $pagelinks;
     199
     200                // 商品一覧表示
     201                $output .= showItems($params, $items);
     202
     203                // 下部ページナビゲータ表示
     204                $output .= $pagelinks;
     205
     206            } else {
     207
     208                // 検索結果が 0 件の場合(キーワードが指定されている場合のみ)
     209                if (!empty($params["keyword"])) {
     210
     211                    // 検索結果が無いメッセージ
     212                    $output .= "<p>検索条件に該当する商品はありませんでした。</p>";
     213                }
     214
     215                // 最上位カテゴリ一覧を表示
     216                $output .= showRootCategories($service, $params);
     217            }
     218            break;
     219    }
     220
     221    // サービスクレジット表示(出力コンテンツが存在する場合)
     222    if (!empty($output)) {
     223        $output .= showServiceCredits($service);
     224    }
    187225
    188226    // コンテンツの返却
  • cs-shop/trunk/readme.txt

    r538922 r546232  
    44Requires at least: 3.0
    55Tested up to: 3.0
    6 Stable tag: 0.9.8
     6Stable tag: 0.9.9
    77
    88You can easily create a product search page from the affiliate services of Japan.
     
    2929
    3030== Changelog ==
     31
     32= 0.9.9 =
     33* Add "embed" mode.
    3134
    3235= 0.9.8 =
     
    7679
    7780== Upgrade Notice ==
     81
     82= 0.9.9 =
     83Add "embed" mode.
    7884
    7985= 0.9.8 =
Note: See TracChangeset for help on using the changeset viewer.