mb_internal_encoding("EUC-JP");
require_once "include.php";
if (!check()) {
exit;
}
$tokens = explode("/", $_SERVER["REQUEST_URI"]);
$token_count = count($tokens);
$suffix = get_suffix($tokens[$token_count - 1]);
$q = urldecode(remove_suffix($tokens[$token_count - 1]));
if ($tokens[$token_count - 2] == "list") {
$category = "";
$asp = $tokens[$token_count - 3];
} else {
$category = $tokens[$token_count - 2];
$asp = $tokens[$token_count - 4];
}
if ($asp != "rakuten" && $asp != "rakuten_travel" && $asp != "amazon" && $asp != "denno") {
print_error("ERROR");
exit;
}
$tokens = explode("_", $q);
if (count($tokens) > 1) {
$q = $tokens[0];
$page = intval($tokens[1]);
} else {
$page = 1;
}
$q = str_replace(mb_convert_encoding(" ", "UTF-8", "EUC-JP"), " ", $q);
$q = trim($q);
while (!(strpos($q, " ") === FALSE)) {
$q = str_replace(" ", " ", $q);
}
$sq = mb_convert_encoding($q, "SJIS", "UTF-8");
$ng_keyword = get_setting("NG_KEYWORD");
if (strlen($ng_keyword) > 0) {
$ng_keywords = explode(",", $ng_keyword);
$ng_keywords_count = count($ng_keywords);
for ($i = 0; $i < $ng_keywords_count; $i++) {
if (!(strpos($sq, $ng_keywords[$i]) === FALSE)) {
$ng_url = get_setting("NG_URL");
if (strlen($ng_url) > 0) {
header("Location: $ng_url");
} else {
print '
';
}
exit;
}
}
}
$item_text_len = intval(get_setting2("LIST_ITEM_TEXT_LEN", "300"));
$item_title_len = intval(get_setting2("ITEM_TITLE_LEN", "0"));
$cols = intval(get_setting2("LIST_COLS", "1"));
$rows = intval(get_setting2("LIST_ROWS", "10"));
$page_item_count = $cols * $rows;
if ($asp == "rakuten" || $asp == "rakuten_travel") {
$wsvc_page_item_count = 30;
} elseif ($asp == "amazon") {
$wsvc_page_item_count = 10;
} elseif ($asp == "denno") {
$wsvc_page_item_count = 10;
}
$wsvc_page = intval(1 + (($page - 1) * $page_item_count) / $wsvc_page_item_count);
$wsvc_page_index = intval($wsvc_page_item_count - ($wsvc_page * $wsvc_page_item_count - ($page - 1) * $page_item_count));
$wsvc_page_to = ceil(($page * $page_item_count) / $wsvc_page_item_count);
$eq = urlencode($q);
$uq = $q;
$q = mb_convert_encoding($q, "EUC-JP", "UTF-8");
$first_time = TRUE;
for ($x = $wsvc_page; $x <= $wsvc_page_to; $x++) {
if ($asp == "rakuten") {
$host_name = "app.rakuten.co.jp";
$developer_id = "{ASP_ACCESS_ID}";
$affiliate_id = get_setting("RAKUTEN_AFFILIATE_ID");
$affiliate_id = (strlen($affiliate_id) != 0) ? "&affiliateId=" . $affiliate_id : "";
rakuten_genre_tag($category, $genre_id, $tag_id);
$sort = get_setting("RAKUTEN_SORT");
if (strlen($sort) != 0) {
if (!in_array($sort, $rakuten_sorts)) {
$sort = "standard";
}
$sort = "&sort=" . urlencode($sort);
} else {
$sort = "";
}
$request = "/services/api/IchibaItem/Search/20140222?format=xml&applicationId=${developer_id}&hits=${wsvc_page_item_count}&page=${wsvc_page}&keyword=${eq}${genre_id}${tag_id}${affiliate_id}${sort}";
} elseif ($asp == "rakuten_travel") {
$host_name = "app.rakuten.co.jp";
$developer_id = "{ASP_ACCESS_ID}";
$affiliate_id = get_setting("RAKUTEN_AFFILIATE_ID");
$affiliate_id = (strlen($affiliate_id) != 0) ? "&affiliateId=" . $affiliate_id : "";
$middleClassCode = (strlen($category) != 0) ? "&middleClassCode=" . $category : "";
$sort = get_setting("RAKUTEN_TRAVEL_SORT");
if (strlen($sort) != 0) {
if (!in_array($sort, $rakuten_travel_sorts)) {
$sort = "standard";
}
$sort = "&sort=" . urlencode($sort);
} else {
$sort = "";
}
$request = "/services/api/Travel/KeywordHotelSearch/20131024?format=xml&applicationId=${developer_id}&hits=${wsvc_page_item_count}&page=${wsvc_page}&hotelThumbnailSize=2&responseType=large&keyword=${eq}${affiliate_id}${middleClassCode}${sort}";
} elseif ($asp == "amazon") {
if ($wsvc_page > 400) {
break;
}
$host_name = "ecs.amazonaws.jp";
$search_index = $category;
if (strlen($search_index) == 0) {
$search_index = "Blended";
}
$sort = get_setting("AMAZON_SORT_" . $search_index);
$secret_access_key = get_setting("AMAZON_SECRET_ACCESS_KEY");
$p = array();
$p['AssociateTag'] = get_setting("AMAZON_ASSOCIATE_ID");
$p['AWSAccessKeyId'] = get_setting("AMAZON_ACCESS_KEY_ID");
$p['ItemPage'] = $wsvc_page;
$p['Keywords'] = $uq;
$p['Operation'] = "ItemSearch";
$p['ResponseGroup'] = "Medium,Reviews,Offers";
$p['SearchIndex'] = $search_index;
$p['Service'] = "AWSECommerceService";
if (strlen($sort) != 0) {
$p['Sort'] = $sort;
}
$p['Timestamp'] = gmdate('Y-m-d\TH:i:s\Z');
$p['Version'] = "2009-03-31";
ksort($p);
$cstr = '';
foreach ($p as $k => $v) {
$cstr .= '&' . $k . '=' . urlencode_rfc3986($v);
}
$cstr = substr($cstr, 1);
$sstr = "GET\n${host_name}\n/onca/xml\n${cstr}";
$signature = urlencode_rfc3986(base64_encode(hash_hmac('sha256', $sstr, $secret_access_key, true)));
$request = "GET /onca/xml?${cstr}&Signature=${signature} HTTP/1.0\r\nHost: ${host_name}\r\n\r\n";
} elseif ($asp == "denno") {
$host_name = "webservice.d-064.com";
$hid = get_setting("DENNO_HID");
$email = get_setting("DENNO_EMAIL");
if (strlen($category) != 0) {
$category_id = "&category_id=${category}";
}
$sort = get_setting("DENNO_SORT");
if (strlen($sort) != 0) {
$sort = "&sort=" . $sort;
}
$request = "GET /get_tag.php?hid=${hid}&email=${email}&sword=${eq}&type=heavy&page=${wsvc_page}${category_id}${sort} HTTP/1.0\r\nHost: ${host_name}\r\n\r\n";
}
$result = http_get($host_name, $request, $response, $asp);
if ($result) {
$doc = substr($response, strpos($response, "\r\n\r\n") + 4);
} else {
$url = get_setting("ERROR_URL");
if (strlen($url) != 0) {
header("Location: $url");
} else {
print_error("ERROR");
}
exit;
}
$doc = mb_convert_encoding($doc, "EUC-JP", "UTF-8");
if ($asp == "rakuten") {
$total_pages = intval(get_node($doc, "pageCount"));
$total_results = intval(get_node($doc, "count"));
$Items_ = get_nodes($doc, "Item");
} elseif ($asp == "rakuten_travel") {
$total_results = intval(get_node($doc, "recordCount"));
$total_pages = ceil($total_results / $wsvc_page_item_count);
$Items_ = get_nodes($doc, "hotel");
} elseif ($asp == "amazon") {
$total_pages = intval(get_node($doc, "TotalPages"));
$total_pages = min($total_pages, 3200);
$total_results = intval(get_node($doc, "TotalResults"));
$Items_ = get_nodes($doc, "Item");
$errors = get_nodes($doc, "Error");
if (count($errors) != 0) {
foreach ($errors as $error) {
$code = get_node($error, "Code");
if (strcasecmp($code, "AWS.ECommerceService.NoExactMatches") != 0) {
print "ERROR:" . $code . "
";
}
}
}
} elseif ($asp == "denno") {
$total_pages = intval(get_node($doc, "TotalPages"));
$total_results = intval(get_node($doc, "TotalResults"));
$Items_ = get_nodes($doc, "Details");
}
if ($total_results == 0) {
$url = get_setting("NO_RESULT_URL");
if (strlen($url) != 0) {
header("Location: $url");
exit;
}
}
if ($first_time == TRUE) {
for ($i = $wsvc_page_index; $i < count($Items_); $i++) {
$Items[] = $Items_[$i];
$page_index_ = 0;
$pages[] = $wsvc_page;
$page_indexes[] = $i;
}
$first_time = FALSE;
} else {
for ($item_index = 0; $item_index < count($Items_); $item_index++) {
$Items[] = $Items_[$item_index];
$pages[] = $wsvc_page;
$page_indexes[] = $item_index;
}
}
if (count($Items) > $page_item_count) {
$array_count = count($Items);
for ($i = $page_item_count; $i < $array_count; $i++) {
unset($Items[$i]);
}
break;
}
if ($total_pages <= $wsvc_page) {
break;
}
unset($Items_);
$wsvc_page++;
sleep(1);
}
if (get_setting("LIST_ITEM_SHUFFLE") == "1") {
$item_count = count($Items);
for ($i = 0; $i < $item_count; $i++) {
$r = rand(0, $item_count - 1);
if ($i != $r) {
$val = $Items[$i];
$Items[$i] = $Items[$r];
$Items[$r] = $val;
$val = $pages[$i];
$pages[$i] = $pages[$r];
$pages[$r] = $val;
$val = $page_indexes[$i];
$page_indexes[$i] = $page_indexes[$r];
$page_indexes[$r] = $val;
}
}
}
if ($asp == "rakuten" || $asp == "rakuten_travel") {
$can_get_count = min($total_results, $wsvc_page_item_count * $total_pages);
$total_pages = ceil($can_get_count / $page_item_count);
} elseif ($asp == "amazon") {
$can_get_count = min($total_results, $wsvc_page_item_count * 400);
$total_pages = ceil($can_get_count / $page_item_count);
} else {
$total_pages = ceil($total_results / $page_item_count);
}
if ($suffix == "xml") {
$htm = file_get_contents("rss.xml");
$htm = mb_convert_encoding($htm, "EUC-JP", "UTF-8");
$htm = str_replace("", "", $htm);
$htm = str_replace("", "", $htm);
$cols = 1;
$out_encoding = "UTF-8";
} else {
if ($asp == "rakuten_travel") {
$htm = file_get_contents("list_rakuten_travel.html");
} else {
$htm = file_get_contents("list.html");
}
$htm = mb_convert_encoding($htm, "EUC-JP", "SJIS");
$out_encoding = "SJIS";
}
$jis8utf = $eq;
$jis8utf = mb_convert_encoding($jis8utf, "UTF-8", "sjis-win");
$jisw8utf = $jis8utf;
$jisw8utf = urlencode($jis8utf);
$jisww8utf = urlencode($jisw8utf);
$jiswx8utf = urlencode($jisww8utf);
$jiseuc = $sq;
$jiseuc = mb_convert_encoding($jiseuc, "EUC-JP", "sjis-win");
$jisweuc = $jiseuc;
$jisweuc = urlencode($jiseuc);
$jiswweuc = urlencode($jisweuc);
$jiswxeuc = urlencode($jiswweuc);
$jisxxeuc = urlencode($jiswxeuc);
$jisSjis = $sq;
$jisSjis = mb_convert_encoding($jisSjis, "SJIS", "sjis-win");
$jiswSjis = $jisSjis;
$jiswwSjis = urlencode($jiswSjis);
$jiswxSjis = urlencode($jiswwSjis);
$jisxxSjis = urlencode($jiswxSjis);
$jiswjis = $sq;
$jiswjis = urlencode($sq);
$jiswwjis = urlencode($jiswjis);
$jiswxjis = urlencode($jiswwjis);
$htm = get_str_span("LIST_ROW", $htm, $htm_list_row);
$htm_list_row = get_str_span("LIST_COL", $htm_list_row, $htm_item_details);
$htm = get_str_span("PREV_PAGE_LINK", $htm, $htm_prev_page_link);
$htm = get_str_span("NEXT_PAGE_LINK", $htm, $htm_next_page_link);
$htm = get_str_span("PREV_PAGE_LINK2", $htm, $htm_prev_page_link2);
$htm = get_str_span("NEXT_PAGE_LINK2", $htm, $htm_next_page_link2);
$htm = str_replace("{page_title}", $q, $htm);
$htm = str_replace("{page_title_UTF8}", $jis8utf, $htm);
$htm = str_replace("{page_title_UTF8w}", $jisw8utf, $htm);
$htm = str_replace("{page_title_UTF8ww}", $jisww8utf, $htm);
$htm = str_replace("{page_title_UTF8xw}", $jiswx8utf, $htm);
$htm = str_replace("{page_title_EUC}", $jiseuc, $htm);
$htm = str_replace("{page_title_EUCw}", $jisweuc, $htm);
$htm = str_replace("{page_title_EUCww}", $jiswweuc, $htm);
$htm = str_replace("{page_title_EUCxw}", $jiswxeuc, $htm);
$htm = str_replace("{page_title_EUCxx}", $jisxxeuc, $htm);
$htm = str_replace("{page_title_SJIS}", $jisSjis, $htm);
$htm = str_replace("{page_title_SJISw}", $jiswSjis, $htm);
$htm = str_replace("{page_title_SJISww}", $jiswwSjis, $htm);
$htm = str_replace("{page_title_SJISxw}", $jiswxSjis, $htm);
$htm = str_replace("{page_title_SJISxx}", $jisxxSjis, $htm);
$htm = str_replace("{page_title_JIS}", $sq, $htm);
$htm = str_replace("{page_title_JISw}", $jiswjis, $htm);
$htm = str_replace("{page_title_JISww}", $jiswwjis, $htm);
$htm = str_replace("{page_title_JISxw}", $jiswxjis, $htm);
$htm = str_replace("{current_page}", $page, $htm);
$htm = str_replace("{current_page_f}", number_format($page), $htm);
$htm = str_replace("{total_pages}", $total_pages, $htm);
$htm = str_replace("{total_pages_f}", number_format($total_pages), $htm);
$htm = str_replace("{total_results}", $total_results, $htm);
$htm = str_replace("{total_results_f}", number_format($total_results), $htm);
$htm = str_replace("{pub_date}", get_date_string(), $htm);
$htm = replace_link($htm);
if ($page > 1) {
if ($page == 2) {
$htm_prev_page_link = str_replace("{prev_page}", $eq . ".html", $htm_prev_page_link);
$htm_prev_page_link2 = str_replace("{prev_page}", $eq . ".html", $htm_prev_page_link2);
} else {
$htm_prev_page_link = str_replace("{prev_page}", $eq . "_" . strval($page - 1) . ".html", $htm_prev_page_link);
$htm_prev_page_link2 = str_replace("{prev_page}", $eq . "_" . strval($page - 1) . ".html", $htm_prev_page_link2);
}
$htm = str_replace("{PREV_PAGE_LINK}", $htm_prev_page_link, $htm);
$htm = str_replace("{PREV_PAGE_LINK2}", $htm_prev_page_link2, $htm);
} else {
$htm = str_replace("{PREV_PAGE_LINK}", "", $htm);
$htm = str_replace("{PREV_PAGE_LINK2}", "", $htm);
}
if (intval($page) < $total_pages) {
$htm_next_page_link = str_replace("{next_page}", $eq . "_" . strval($page + 1) . ".html", $htm_next_page_link);
$htm_next_page_link2 = str_replace("{next_page}", $eq . "_" . strval($page + 1) . ".html", $htm_next_page_link2);
$htm = str_replace("{NEXT_PAGE_LINK}", $htm_next_page_link, $htm);
$htm = str_replace("{NEXT_PAGE_LINK2}", $htm_next_page_link2, $htm);
} else {
$htm = str_replace("{NEXT_PAGE_LINK}", "", $htm);
$htm = str_replace("{NEXT_PAGE_LINK2}", "", $htm);
}
$names = array(
"title",
"detail_page_url",
"affiliate_url",
"img_url",
"img_s_url",
"img_m_url",
"img_l_url",
"price",
"details",
"hanbaimoto",
"shop_url",
"rating",
"pub_date",
"review_count",
"hotelNo",
"hotelName",
"postalCode",
"address1",
"address2",
"telephoneNo",
"faxNo",
"checkinTime",
"lastCheckinTime",
"checkoutTime",
"latitude",
"longitude",
"access",
"parkingInformation",
"hotelSpecial",
"roomFacilities",
"hotelFacilities",
"privilege",
"aboutPointAdd",
"aboutMileageAdd",
"breakfastPlace",
"dinnerPlace",
"bathType",
"bathQuality",
"bathBenefits",
"availableCreditCard",
"aboutCreditCardNote",
"aboutLeisure",
"note",
"cancelPolicy",
"linguisticLevel",
"handicappedFacilities",
"otherInformation",
"hotelImageUrl",
"roomImageUrl",
"hotelMapImageUrl",
"hotelInformationUrl",
"reserveTelephoneNo",
"planListUrl",
"dpPlanListUrl",
"reviewUrl",
"hotelKanaName",
"nearestStation",
"hotelMinCharge",
"hotelThumbnailUrl",
"roomThumbnailUrl",
"reviewCount",
"reviewAverage",
"userReview",
"serviceAverage",
"locationAverage",
"roomAverage",
"equipmentAverage",
"bathAverage",
"mealAverage",
"areaName",
"hotelRoomNum",
"areaSum",
"hotelSpecialSum",
"roomFixture",
"hotelFixture",
"aboutMealPlace",
"aboutBath",
"handicappedFixture",
"hotelAffiliateUrl",
"hotelImageTag",
"roomImageTag",
"hotelMapImageTag",
"hotelThumbnailTag",
"roomThumbnailTag",
"hotelMinChargeF",
"reviewAverageImg",
"serviceAverageImg",
"locationAverageImg",
"roomAverageImg",
"equipmentAverageImg",
"bathAverageImg",
"mealAverageImg"
);
$htm_items = "";
if (count($Items) != 0) {
for ($i = 0; $i < count($Items); $i+=$cols) {
$htm_item_details_all = "";
for ($j = 0; $j < $cols; $j++) {
if (count($Items) > $i + $j) {
$item = $Items[$i + $j];
if ($asp == "rakuten") {
$title = get_node($item, "itemName");
$itemCode = get_node($item, "itemCode");
$detail_page_url = "../details/" . $itemCode . ".html";
if (strlen($category) != 0) {
$detail_page_url = "../" . $detail_page_url;
}
$detail_page_url = get_full_url($detail_page_url);
$img_url = get_node(get_node($item, "mediumImageUrls"), "imageUrl");
$img_s_url = get_node(get_node($item, "smallImageUrls"), "imageUrl");
$img_m_url = $img_url;
$img_l_url = $img_url;
$details = get_node($item, "itemCaption");
$details = html_to_text($details);
if (mb_strlen($details) > $item_text_len) {
$details = mb_substr($details, 0, $item_text_len) . "...";
}
$price = number_format(get_node($item, "itemPrice")) . "円";
$hanbaimoto = get_node($item, "shopName");
$shop_url = get_node($item, "shopUrl");
$rating = get_node($item, "reviewAverage");
$affiliate_url = get_node($item, "affiliateUrl");
} elseif ($asp == "rakuten_travel") {
$tags = array(
"hotelNo",
"hotelName",
"postalCode",
"address1",
"address2",
"telephoneNo",
"faxNo",
"checkinTime",
"lastCheckinTime",
"checkoutTime",
"latitude",
"longitude",
"access",
"parkingInformation",
"hotelSpecial",
"roomFacilities",
"hotelFacilities",
"privilege",
"aboutPointAdd",
"aboutMileageAdd",
"breakfastPlace",
"dinnerPlace",
"bathType",
"bathQuality",
"bathBenefits",
"availableCreditCard",
"aboutCreditCardNote",
"aboutLeisure",
"note",
"cancelPolicy",
"linguisticLevel",
"handicappedFacilities",
"otherInformation",
"hotelImageUrl",
"roomImageUrl",
"hotelMapImageUrl",
"hotelInformationUrl",
"reserveTelephoneNo",
"planListUrl",
"dpPlanListUrl",
"reviewUrl",
"hotelKanaName",
"nearestStation",
"hotelMinCharge",
"hotelThumbnailUrl",
"roomThumbnailUrl",
"reviewCount",
"reviewAverage",
"userReview",
"serviceAverage",
"locationAverage",
"roomAverage",
"equipmentAverage",
"bathAverage",
"mealAverage",
"areaName",
"hotelRoomNum"
);
foreach ($tags as $tag) {
eval("\$${tag} = get_node(\$item, '${tag}');");
eval("\$${tag} = htmlunescape(\$${tag});");
}
$roomFacilities = implode("・", get_nodes($roomFacilities, "item"));
$roomFixture = $roomFacilities;
$hotelFacilities = implode("・", get_nodes($hotelFacilities, "item"));
$hotelFixture = $hotelFacilities;
$aboutMealPlace = "朝食:" . $breakfastPlace . " 夕食:" . $dinnerPlace;
$aboutBath = "種類:" . $bathType . " 泉質:" . $bathQuality . " 効能:" . $bathBenefits;
$availableCreditCard = implode("・", get_nodes($availableCreditCard, "card"));
$handicappedFacilities = implode("・", get_nodes($handicappedFacilities, "item"));
$handicappedFixture = $handicappedFacilities;
$userReview = htmldecode($userReview);
$hotelMinChargeF = number_format($hotelMinCharge);
$hotelAffiliateUrl = $hotelInformationUrl;
$img_url = $hotelImageUrl;
$img_s_url = $img_url;
$img_m_url = $img_url;
$img_l_url = $img_url;
$title = $hotelName;
$details = html_to_text($hotelSpecial);
$price = number_format($hotelMinCharge) . "円〜";
$hanbaimoto = $hotelName;
$shop_url = "";
$rating = $reviewAverage;
$review_count = $reviewCount;
$hotelImageTag = img_tag($hotelImageUrl);
$roomImageTag = img_tag($roomImageUrl);
$hotelMapImageTag = img_tag($hotelMapImageUrl);
$hotelThumbnailTag = img_tag($hotelThumbnailUrl);
$roomThumbnailTag = img_tag($roomThumbnailUrl);
$areaSum = $areaName;
$hotelSpecialSum = $hotelSpecial;
$reviewAverageImg = get_rating_img($reviewAverage, $category);
$serviceAverageImg = get_rating_img($serviceAverage, $category);
$locationAverageImg = get_rating_img($locationAverage, $category);
$roomAverageImg = get_rating_img($roomAverage, $category);
$equipmentAverageImg = get_rating_img($equipmentAverage, $category);
$bathAverageImg = get_rating_img($bathAverage, $category);
$mealAverageImg = get_rating_img($mealAverage, $category);
$detail_page_url = "../details/" . $hotelNo . ".html";
if (strlen($category) != 0) {
$detail_page_url = "../" . $detail_page_url;
}
$detail_page_url = get_full_url($detail_page_url);
if ($item_text_len != 0 && mb_strlen($details) > $item_text_len) {
$details = mb_substr($details, 0, $item_text_len) . "...";
}
$affiliate_url = $hotelInformationUrl;
} elseif ($asp == "amazon") {
$title = get_node($item, "Title");
$ASIN = get_node($item, "ASIN");
$detail_page_url = "../details/" . $ASIN . ".html";
if (strlen($category) != 0) {
$detail_page_url = "../" . $detail_page_url;
}
$detail_page_url = get_full_url($detail_page_url);
$img_url = get_node(get_node($item, "MediumImage"), "URL");
if (strlen($img_url) == 0) {
$img_url = "../../img/noimage_m.jpg";
if (strlen($category) != 0) {
$img_url = "../" . $img_url;
}
}
$img_s_url = get_node(get_node($item, "SmallImage"), "URL");
if (strlen($img_s_url) == 0) {
$img_s_url = "../../img/noimage_s.jpg";
if (strlen($category) != 0) {
$img_s_url = "../" . $img_s_url;
}
}
$img_m_url = $img_url;
$img_l_url = get_node(get_node($item, "LargeImage"), "URL");
if (strlen($img_l_url) == 0) {
$img_l_url = "../../img/noimage_l.jpg";
if (strlen($category) != 0) {
$img_l_url = "../" . $img_l_url;
}
}
$details = get_node(get_node($item, "EditorialReview"), "Content");
if (strlen($details) == 0) {
$features = get_nodes($item, "Feature");
for ($z = 0; $z < count($features); $z++) {
$details .= $features[$i] . "\n";
}
}
$details = html_to_text($details);
if (mb_strlen($details) > $item_text_len) {
$details = mb_substr($details, 0, $item_text_len) . "...";
}
$details = str_replace("\n", "
", $details);
$price = get_node(get_node($item, "ListPrice"), "Amount");
if (strlen($price) == 0) {
$price = "オープンプライス";
} else {
$price = number_format($price) . "円";
}
$hanbaimoto = get_node($item, "Publisher");
$shop_url = "";
$rating = get_node(get_node($item, "CustomerReviews"), "AverageRating");
$affiliate_url = get_node($item, "DetailPageURL");
} elseif ($asp == "denno") {
$title = get_node($item, "ProductName");
$product_php = get_node($doc, "ProductPHP");
$item_id = get_node($item, "ItemID");
$orid = get_node($item, "ORID");
$detail_page_url = "../details/" . $category . "_" . $eq . "_" . strval($pages[$i + $j]) . "_" . strval($page_indexes[$i + $j]) . ".html";
if (strlen($category) != 0) {
$detail_page_url = "../" . $detail_page_url;
}
$detail_page_url = get_full_url($detail_page_url);
$affiliate_url = $product_php . "?pid=" . $item_id . "&oid=" . $orid;
if (strlen($hid) != 0) {
$affiliate_url .= "&hid=" . $hid;
}
$img_url = get_node($item, "ImageUrlMedium");
$img_s_url = get_node($item, "ImageUrlSmall");
$img_m_url = $img_ur;
$img_l_url = get_node($item, "ImageUrlLarge");
$details = get_node($item, "ItemDetail");
$details = html_to_text($details);
if (mb_strlen($details) > $item_text_len) {
$details = mb_substr($details, 0, $item_text_len) . "...";
}
$price = number_format(get_node($item, "Price")) . "円";
$hanbaimoto = get_node($item, "Manufacturer");
$shop_url = "";
$rating = "";
}
$title = htmlunescape($title);
} else {
$title = "";
$detail_page_url = "";
$img_url = "../../img/noimage_m.jpg";
if (strlen($category) != 0) {
$img_url = "../" . $img_url;
}
$img_s_url = "../../img/noimage_s.jpg";
if (strlen($category) != 0) {
$img_s_url = "../" . $img_s_url;
}
$img_m_url = $img_url;
$img_l_url = "../../img/noimage_l.jpg";
if (strlen($category) != 0) {
$img_l_url = "../" . $img_l_url;
}
$price = "";
$details = "";
$hanbaimoto = "";
$shop_url = "";
$rating = "";
$hotelNo = "";
$hotelName = "";
$areaSum = "";
$hotelSpecialSum = "";
$affiliate_url = "";
}
if ($item_title_len != 0 && mb_strlen($title) > $item_title_len) {
$title = mb_substr($title, 0, $item_title_len) . "...";
}
$out = $htm_item_details;
foreach ($names as $name) {
eval("\$value = \$${name};");
if ($name == "details" && $suffix == "xml") {
$value = get_cdata($value);
}
$out = str_replace("{" . $name . "}", $value, $out);
}
$htm_item_details_all .= $out;
}
$out = $htm_list_row;
$out = str_replace("{LIST_COL}", $htm_item_details_all, $out);
$htm_items .= $out;
}
}
$htm = str_replace("{LIST_ROW}", $htm_items, $htm);
if ($asp != "rakuten") {
$htm = remove_str_span($htm, "RAKUTEN");
}
if ($asp != "rakuten_travel") {
$htm = remove_str_span($htm, "RAKUTEN_TRAVEL");
}
if ($asp != "amazon") {
$htm = remove_str_span($htm, "AMAZON");
}
if ($asp != "denno") {
$htm = remove_str_span($htm, "DENNO");
}
if ($suffix == "xml") {
header("Content-Type: text/xml; charset=UTF-8");
}
print mb_convert_encoding($htm, $out_encoding);
?>