Changeset 537630
- Timestamp:
- 04/28/2012 10:10:18 AM (14 years ago)
- Location:
- cs-shop/trunk
- Files:
-
- 1 added
- 6 edited
-
cs-shop-options.php (modified) (1 diff)
-
cs-shop.php (modified) (6 diffs)
-
function-view.php (modified) (5 diffs)
-
readme.txt (modified) (4 diffs)
-
service-linkshare.php (added)
-
service-rakuten.php (modified) (1 diff)
-
service-yahoo.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cs-shop/trunk/cs-shop-options.php
r536232 r537630 22 22 "アプリケーションID" => "csshop_yahoo_appid", 23 23 "アフィリエイト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" 24 30 ) 25 31 ); -
cs-shop/trunk/cs-shop.php
r536238 r537630 4 4 Plugin URI: http://www.csync.net/category/blog/wp-plugin/cs-shop/ 5 5 Description: You can easily create a product search page from the affiliate services of Japan. 6 Version: 0.9. 6.16 Version: 0.9.7 7 7 Author: cottonspace 8 8 Author URI: http://www.csync.net/ … … 29 29 * プラグインのバージョン 30 30 */ 31 define('CS_SHOP_VER', '0.9. 6.1');31 define('CS_SHOP_VER', '0.9.7'); 32 32 33 33 /** … … 39 39 * 開発・デバッグ用の設定 40 40 */ 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); 43 43 44 44 /** … … 60 60 $params = shortcode_atts(array( 61 61 "service" => "", 62 "action" => "",63 62 "shop" => "", 64 63 "pagesize" => "", … … 113 112 )); 114 113 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; 115 129 default: 116 130 … … 120 134 } 121 135 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); 177 181 } 178 182 -
cs-shop/trunk/function-view.php
r536232 r537630 24 24 function getScoreLevel($score) 25 25 { 26 27 26 // 出力コンテンツ 28 27 $output = ""; … … 55 54 * 最上位カテゴリ一覧 56 55 * @param object $service サービス情報 57 * @return string 出力コンテンツ 58 */ 59 function showRootCategories(&$service) 60 { 61 // 出力コンテンツ 62 $output = ""; 56 * @param array $params 要求パラメタ 57 * @return string 出力コンテンツ 58 */ 59 function 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 } 63 71 64 72 // 基準URLの生成 65 $url = getCurrentUrl() . "service=" . urlencode($service->serviceName()) . "&action=search";73 $url = getCurrentUrl() . http_build_query($work); 66 74 67 75 // 第2階層まで表示 … … 183 191 // 要求パラメタの出力エスケープ処理(指定キーのみ) 184 192 $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) { 186 194 if (array_key_exists($k, $params) && !empty($params[$k])) { 187 195 $work[$k] = o_escape($params[$k]); … … 218 226 <input type="text" name="keyword" value="{$work["keyword"]}" /> 219 227 <input type="hidden" name="service" value="{$work["service"]}" /> 220 <input type="hidden" name="action" value="{$work["action"]}" />221 228 <input type="hidden" name="shop" value="{$work["shop"]}" /> 222 229 <input type="hidden" name="pagesize" value="{$work["pagesize"]}" />\n … … 320 327 // 要求パラメタの複製を作成(指定キーのみ) 321 328 $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) { 323 330 if (array_key_exists($k, $params) && !empty($params[$k])) { 324 331 $work[$k] = $params[$k]; -
cs-shop/trunk/readme.txt
r536238 r537630 4 4 Requires at least: 3.0 5 5 Tested up to: 3.0 6 Stable tag: 0.9. 6.16 Stable tag: 0.9.7 7 7 8 8 You can easily create a product search page from the affiliate services of Japan. … … 29 29 30 30 == Changelog == 31 32 = 0.9.7 = 33 * Add support LinkShare. 34 * Remove "action" parameter from shortcode attributes. 31 35 32 36 = 0.9.6.1 = … … 67 71 == Upgrade Notice == 68 72 73 = 0.9.7 = 74 Support LinkShare. 75 69 76 = 0.9.6.1 = 70 77 Re-release version 0.9.6. … … 104 111 To view the results of a search by specifying the keyword 'foo' automatically. 105 112 106 `[csshop service="rakuten" action="search"keyword="foo"]`113 `[csshop service="rakuten" keyword="foo"]` 107 114 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"]` 109 120 110 121 To view the results of a search by specifying the specified category automatically. 111 122 112 `[csshop service="rakuten" action="search"category="100026"]`123 `[csshop service="rakuten" category="100026"]` 113 124 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 198 198 "aurl" => (string)$node->affiliateUrl, 199 199 "iurl" => empty($this->requests["mobile"]) ? (string)$node->mediumImageUrl : (string)$node->smallImageUrl, 200 "surl" => (string)$node->shopUrl) 200 "surl" => (string)$node->shopUrl 201 ) 201 202 ); 202 203 } -
cs-shop/trunk/service-yahoo.php
r536232 r537630 196 196 "aurl" => (string)$node->Url, 197 197 "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 ) 199 200 ); 200 201 }
Note: See TracChangeset
for help on using the changeset viewer.