$apippnewwindowhtml, 'amazonhiddenmsg' => $amazonhiddenmsg, 'amazonerrormsg' => $amazonerrormsg, 'apippopennewwindow' => $apippopennewwindow, 'appip_text_lgimage' => $appip_text_lgimage, 'appip_text_listprice' => $appip_text_listprice, 'appip_text_newfrom' => $appip_text_newfrom, 'appip_text_usedfrom' => $appip_text_usedfrom, 'appip_text_instock' => $appip_text_instock, 'appip_text_outofstock' => $appip_text_outofstock, 'appip_text_author' => $appip_text_author, 'appip_text_starring' => $appip_text_starring, 'appip_text_director' => $appip_text_director, 'appip_text_reldate' => $appip_text_reldate, 'appip_text_preorder' => $appip_text_preorder, 'appip_text_releasedon' => $appip_text_releasedon, 'appip_text_notavalarea' => $appip_text_notavalarea, 'appip_text_manufacturer' => $appip_text_manufacturer, 'appip_text_ESRBAgeRating' => $appip_text_ESRBAgeRating, 'appip_text_feature' => $appip_text_feature, 'appip_text_platform' => $appip_text_platform, 'appip_text_genre' => $appip_text_genre, 'appip_text_rating' => $appip_text_rating, 'buyamzonbutton' => $buyamzonbutton, 'addestrabuybutton' => $addestrabuybutton, 'description' => $description, 'encodemode' => $encodemode, 'replace_title' => $replace_title, 'show_list' => $show_list, 'show_features' => $show_features, 'show_used_price' => $show_used_price, 'show_saved_amt' => $show_saved_amt, 'show_timestamp' => $show_timestamp, 'show_gallery' => $show_gallery, 'template' => $template, 'title_wrap' => $title_wrap, 'validEncModes' => $validEncModes, 'align' => $manual_align, 'button' => $button, ); $set_array = array("Operation" => $appip_operation,"ItemId" => $ASIN,"ResponseGroup" => $appip_responsegroup,"IdType" => $appip_idtype,"AssociateTag" => $manual_partner_id ); $api_request_array = array("RequestBy" => 'main-call-getSingleAmazonProduct-91','locale'=>$manual_locale,'public_key'=>$manual_public_key,'private_key'=>$manual_private_key, "partner_id" => $manual_partner_id, 'api_request_array'=>$set_array); $request_array = apply_filters('appip_pre_request_array',$api_request_array); $pxmlNew = amazon_plugin_aws_signed_request($api_request_array['locale'],$request_array['api_request_array'],$request_array['public_key'],$request_array['private_key'], false); $returnval = ''; $totalResult1 = array(); $totalResult2 = array(); $asinR = explode(",",$ASIN); if( is_array( $pxmlNew ) && !empty( $pxmlNew ) ){ $pxmle = array(); foreach($pxmlNew as $pxmlkey => $pxml ){ if(!is_array($pxml)){ $pxmle[] = ''; }else{ $r1 = appip_plugin_FormatASINResult( $pxml, 0, $asinR ); if(is_array($r1) && !empty($r1)){ foreach($r1 as $ritem){ $totalResult1[] = $ritem; } } $r2 = appip_plugin_FormatASINResult( $pxml, 1, $asinR ); if(is_array($r2) && !empty($r2)){ foreach($r2 as $ritem2){ $totalResult2[] = $ritem2; } } } } } $resultarr = array(); if(!empty($pxmle)){ $pxml = implode("\n",$pxmle); return $pxml; }else{ $appip_text_lgimage = apply_filters('appip_text_lgimage', __("See larger image",'amazon-product-in-a-post-plugin')); $appip_text_listprice = apply_filters('appip_text_listprice',__("List Price:",'amazon-product-in-a-post-plugin')); $appip_text_newfrom = apply_filters('appip_text_newfrom',__("New From:",'amazon-product-in-a-post-plugin')); $appip_text_usedfrom = apply_filters('appip_text_usedfrom', __("Used from:",'amazon-product-in-a-post-plugin')); $appip_text_instock = apply_filters('appip_text_instock', __("In Stock",'amazon-product-in-a-post-plugin')); $appip_text_outofstock = apply_filters('appip_text_outofstock',__("Out of Stock",'amazon-product-in-a-post-plugin')); $appip_text_author = apply_filters('appip_text_author', __("By (author):",'amazon-product-in-a-post-plugin')); $appip_text_starring = apply_filters('appip_text_starring', __("Starring:",'amazon-product-in-a-post-plugin')); $appip_text_director = apply_filters('appip_text_director', __("Director:",'amazon-product-in-a-post-plugin')); $appip_text_reldate = apply_filters('appip_text_reldate', __("Release date:",'amazon-product-in-a-post-plugin')); $appip_text_preorder = apply_filters('appip_text_preorder', __("Preorder:",'amazon-product-in-a-post-plugin')); $appip_text_notavalarea = apply_filters('appip_text_notavalarea', __("This item is may not be available in your area. Please click the image or title of product to check pricing.",'amazon-product-in-a-post-plugin')); $appip_text_releasedon = apply_filters('appip_text_releasedon', __("This title will be released on",'amazon-product-in-a-post-plugin')); $appip_text_manufacturer= apply_filters('appip_text_manufacturer',__("Manufacturer:",'amazon-product-in-a-post-plugin')); $appip_text_ESRBAgeRating= apply_filters('appip_text_ESRBAgeRating',__("ESRB Rating:",'amazon-product-in-a-post-plugin')); $appip_text_feature = apply_filters('appip_text_feature', __("Features:",'amazon-product-in-a-post-plugin')); $appip_text_platform = apply_filters('appip_text_platform', __("Platform:",'amazon-product-in-a-post-plugin')); $appip_text_genre = apply_filters('appip_text_genre', __("Genre:",'amazon-product-in-a-post-plugin')); $appip_text_rating = apply_filters('appip_text_rating', __("Rating:",'amazon-product-in-a-post-plugin')); $resultarr1 = isset($totalResult1) && !empty($totalResult1) ? $totalResult1 : array(); //appip_plugin_FormatASINResult( $pxml ); $resultarr2 = isset($totalResult2) && !empty($totalResult2) ? $totalResult2 : array(); //appip_plugin_FormatASINResult( $pxml, 1 ); if(is_array($resultarr1) && !empty($resultarr1)){ foreach($resultarr1 as $key1 => $result1): $mainAArr = (array)$result1; $otherArr = (array)$resultarr2[$key1]; $resultarr[$key1] = (array)$mainAArr + $otherArr; endforeach; } $resultarr = has_filter('appip_product_array_processed') ? apply_filters('appip_product_array_processed',$resultarr,$apippnewwindowhtml,$resultarr1,$resultarr2,$template) : $resultarr; if( !is_array( $resultarr ) ) $resultarr = (array) $resultarr; if( !empty( $resultarr ) ): $array_for_templates['timestamp_printed'] = $appipTimestampMsgPrinted; if($show_timestamp!=0 && $appipTimestampMsgPrinted != 1){ $appipTimestampMsgPrinted = 1; $array_for_templates['timestamp_printed'] = $appipTimestampMsgPrinted; } if(count($resultarr) >=1){ $thedivider = '
'; } /* New Button functionality */ if($button != ''){ $buttonstemp = explode(',', $button ); unset($button); if( count($buttonstemp) === 1 && count($resultarr) > 1){ foreach($asinR as $kba => $kbv ){ $button[] = $buttonstemp[0]; } }else{ foreach($buttonstemp as $buttona){ if(!empty($buttona)){ $button[] = $buttona; } } } }else{ $button = array(); } /* END New Button functionality */ $arr_position = 0; foreach($resultarr as $key => $result): if(isset($result['NoData']) && (int) $result['NoData'] == 1): $check = array(); if(is_array($result['Error']) && !empty($result['Error'])){ if(isset($result['Error'][0])){ foreach($result['Error'] as $k => $v ){ if( !in_array(implode(':',$v),$check) ){ $returnval .= ''; $check[] = implode(":",$v); } } }else{ if( !in_array( implode( ':', $v ),$check ) ){ $returnval .= ''; $check[] = $implode(":",$result['Error']); } } }else{ $returnval .= ''; } else: $linkURL = $useCartURL ? str_replace(array('##REGION##','##AFFID##','##SUBSCRIBEID##'),array($manual_locale,$manual_partner_id,$manual_public_key),$result['CartURL'] ) : $result['URL']; unset($temppart); $temppart[] = '
'; $temppart[] = '
[!IMAGE!]
'; $temppart[] = ' [!LARGEIMAGETXT!]'; if($result['AddlImages']!='' && $show_gallery == 1){ $temppart[] = '
[!LBL-ADDL-IMAGES!]:[!ADDL-IMAGES!]
'; } $temppart[] = '

[!TITLE!]

'; $temppart[] = '
[!CONTENT!]
'; if($result["Department"]=='Video Games' || $result["ProductGroup"]=='Video Games'){ $temppart[] = '
'; $temppart[] = ' [!LBL-MANUFACTURER!]: [!MANUFACTURER!]
'; $temppart[] = ' [!LBL-ESRBA!]: [!ESRBA!]
'; $temppart[] = ' [!LBL-PLATFORM!]: [!PLATFORM!]
'; $temppart[] = ' [!LBL-GENRE!]: [!GENRE!]
'; if($show_features != 0){ $temppart[] = ' [!LBL-FEATURE!]: [!FEATURE!]
'; } $temppart[] = '
'; }elseif($show_features != 0 && $result["Feature"] != ''){ $temppart[] = ' [!LBL-FEATURE!]: [!FEATURE!]
'; } if($result["ReleaseDate"] != ''){ $nowdatestt = strtotime(date("Y-m-d",time())); $nowminustt = strtotime("-180 days"); $reldatestt = strtotime($result["ReleaseDate"]); if($reldatestt > $nowdatestt){ $temppart[] = '
[!LBL-RELEASED-ON-DATE!] [!RELEASE-DATE!]
'; }elseif($reldatestt >= $nowminustt){ $temppart[] = '[!LBL-RELEASE-DATE!] [!RELEASE-DATE!]'; } } $temppart[] = '
'; $temppart[] = '
'; $temppart[] = '

'; $appip_templates['fluffy'] = implode("\n",$temppart); $appip_templates = apply_filters('appip-template-filter',$appip_templates, $result); if($template !='default' && isset($appip_templates[$template])){ if($replace_title!=''){$title = $replace_title;}else{$title = maybe_convert_encoding($result["Title"]);} $newdesc = ''; if(is_array($result["ItemDesc"]) && $description == 1){ $desc = preg_replace('/^\s*\/\/\s*\z/','$1', $result["ItemDesc"][0]); $newdesc = maybe_convert_encoding($desc['Content']); } $findarr = array( '[!URL!]', '[!TARGET!]', '[!IMAGE!]', '[!TITLE!]', '[!LARGEIMAGE!]', '[!LARGEIMAGETXT!]', '[!ASIN!]', '[!CONTENT!]', '[!LBL-MANUFACTURER!]', '[!MANUFACTURER!]', '[!LBL-ESRBA!]', '[!ESRBA!]', '[!LBL-PLATFORM!]', '[!PLATFORM!]', '[!LBL-GENRE!]', '[!GENRE!]', '[!LBL-FEATURE!]', '[!FEATURE!]', '[!AMZ-BUTTON!]', '[!LBL-RELEASED-ON-DATE!]', '[!LBL-RELEASE-DATE!]', '[!RELEASE-DATE!]', '[!LBL-ADDL-IMAGES!]', '[!ADDL-IMAGES!]', ); $replacearr = array( $linkURL, $apippnewwindowhtml, checkSSLImages_tag($result['LargeImage'],'amazon-image amazon-image-large',$result['ASIN']), //awsImageGrabber($result['LargeImage'],'amazon-image'), $title, checkSSLImages_url($result['LargeImage']), $appip_text_lgimage, $result['ASIN'], $newdesc, $appip_text_manufacturer, maybe_convert_encoding($result["Manufacturer"]), $appip_text_ESRBAgeRating, maybe_convert_encoding($result["ESRBAgeRating"]), $appip_text_platform, maybe_convert_encoding($result["Platform"]), $appip_text_genre, maybe_convert_encoding($result["Genre"]), $appip_text_feature, maybe_convert_encoding($result["Feature"]), plugins_url('/images/'.$buyamzonbutton,dirname(__FILE__)), $appip_text_releasedon, date("F j, Y", strtotime($result["ReleaseDate"])), $appip_text_reldate, __('Additional Images','amazon-product-in-a-post-plugin'), $result['AddlImages'], ); $findarr = apply_filters('appip_template_find_array',$findarr,$template,$result); $replacearr = apply_filters('appip_template_replace_array',$replacearr,$template,$result,$title,$desc); $returnval .= str_replace($findarr,$replacearr,$appip_templates[$template]); }else{ if( (bool) $apippopennewwindow ) $nofollow = ' rel="nofollow noopener"'; else $nofollow = ' rel="nofollow"'; $nofollow = apply_filters( 'appip_template_add_nofollow', $nofollow,$result ); $addAlign = $manual_align != '' ? ' '.$manual_align : ''; $returnval .= '
'."\n"; $returnval .= ' '."\n"; $returnval .= ' '."\n"; $returnval .= ' '."\n"; $returnval .= '
'."\n"; $returnval .= '
'."\n"; //$returnval .= ' ' . awsImageGrabber($result['MediumImage'],'amazon-image') . '
'."\n"; $img = isset($result['MediumImage']) ? $result['MediumImage'] : ''; $img = $img == '' && isset($result['LargeImage']) ? $result['LargeImage'] : $img; $returnval .= ' ' . checkSSLImages_tag( $img ,'amazon-image amazon-image-medium',$result['ASIN']). '
'."\n"; if($result['LargeImage']!=''){ $returnval .= ' '.$appip_text_lgimage.''."\n"; } if($result['AddlImages']!='' && $show_gallery == 1){ $returnval .= '
'.__( 'Additional Images', 'amazon-product-in-a-post-plugin' ).':'.$result['AddlImages'].'
'; } $returnval .= '
'."\n"; $returnval .= '
'."\n"; if($replace_title!=''){$title = $replace_title;}else{$title = maybe_convert_encoding($result["Title"]);} if(strtolower($title) != 'null'){ $returnval .= '

'.$title.'

'."\n"; } if(!empty($result["ItemDesc"]) && $description == 1){ if(is_array($result["ItemDesc"])){ $desc = str_replace('','', $desc ); $desc = str_replace(']]>','', $desc ); $returnval .= '
'.maybe_convert_encoding($desc).'
'."\n"; }else{ $desc = str_replace('','', $desc ); $desc = str_replace(']]>','', $desc ); $returnval .= '
'.maybe_convert_encoding($desc).'
'."\n"; } } $returnval .= '
'."\n"; if($result["Department"]=='Video Games' || $result["ProductGroup"]=='Video Games'){ $returnval .= ' '.$appip_text_manufacturer .'  '.maybe_convert_encoding($result["Manufacturer"]).'
'."\n"; $returnval .= ' '.$appip_text_ESRBAgeRating .'  '.maybe_convert_encoding($result["ESRBAgeRating"]).'
'."\n"; $returnval .= ' '.$appip_text_platform .'  '.maybe_convert_encoding($result["Platform"]).'
'."\n"; $returnval .= ' '.$appip_text_genre.'  '.maybe_convert_encoding($result["Genre"]).'
'."\n"; if($show_features != 0){ $returnval .= ' '.$appip_text_feature .'  '.maybe_convert_encoding($result["Feature"]).''."\n"; } }elseif($show_features != 0 && $result["Feature"] != ''){ $returnval .= ' '.$appip_text_feature .'  '.maybe_convert_encoding($result["Feature"]).''."\n"; } if($show_features != 0){ if(trim($result["Author"])!=''){ $returnval .= ' '.$appip_text_author .'  '.maybe_convert_encoding($result["Author"]).'
'."\n"; } if(trim($result["Director"])!=''){ $returnval .= ' '.$appip_text_director.' '.maybe_convert_encoding($result["Director"]).'
'."\n"; } if(trim($result["Actor"])!=''){ $returnval .= ' '.$appip_text_starring.' '.maybe_convert_encoding($result["Actor"]).'
'."\n"; } if(trim($result["AudienceRating"])!=''){ $returnval .= ' '.$appip_text_rating.' '.$result["AudienceRating"].'
'."\n"; } } $returnval .= '
'."\n"; if($extratext != ''){ $returnval .= '
'.$extratext.'
'."\n"; } $returnval .= ' '."\n"; if($show_list == 1){ if($result["PriceHidden"]== '1' ){ $returnval .= ' '."\n"; $returnval .= ' '."\n"; $returnval .= ' '."\n"; $returnval .= ' '."\n"; }elseif($result["ListPrice"] != '0' || $result["NewAmazonPricing"]["New"]["List"] != '0'){ $returnval .= ' '."\n"; $returnval .= ' '."\n"; if(isset($result["NewAmazonPricing"]["New"]["List"]) && $result["NewAmazonPricing"]["New"]["List"] != '' ) $returnval .= ' '."\n"; else $returnval .= ' '."\n"; $returnval .= ' '."\n"; } } if(isset($result["LowestNewPrice"])){ if($result["Binding"] == 'Kindle Edition'){ $returnval .= ' '."\n"; $returnval .= ' '."\n"; $returnval .= ' '."\n"; $returnval .= ' '."\n"; }else{ if($result["LowestNewPrice"] == 'Too low to display'){ $newPrice = 'Check Amazon For Pricing'; }else{ if(isset($result["NewAmazonPricing"]["New"]["Price"]) && $result["NewAmazonPricing"]["New"]["Price"] != '' ) $newPrice = $result["NewAmazonPricing"]["New"]["Price"]; else $newPrice = $result["LowestNewPrice"]; } $returnval .= ' '."\n"; $returnval .= ' '."\n"; if(!(isset($result["HideStockMsg"]) && isset($result["HideStockMsg"]) == '1')){ $stockIn = $appip_text_instock; $stockOut = $appip_text_outofstock; }else{ $stockIn = ''; $stockOut = ''; } if($result["TotalNew"]>0){ $returnval .= ' '."\n"; }else{ $returnval .= ' '."\n"; } $returnval .= ' '."\n"; } } if($show_used == 1){ if(isset($result["LowestUsedPrice"]) && $result["Binding"] != 'Kindle Edition'){ if(!(isset($result["HideStockMsgUsed"]) && isset($result["HideStockMsgUsed"]) == '1')){ $stockIn = ' '.$appip_text_instock.''; $stockOut = ' '.$appip_text_outofstock.''; }else{ $stockIn = ''; $stockOut = ''; } $returnval .= ' '."\n"; $returnval .= ' '."\n"; if($result["TotalUsed"] > 0){ if(isset($result["NewAmazonPricing"]["Used"]["Price"]) && $result["NewAmazonPricing"]["Used"]["Price"] != '' && $result["NewAmazonPricing"]["Used"]["Price"] != '0') $usedPrice = $result["NewAmazonPricing"]["Used"]["Price"]; else $usedPrice = $result["LowestNewPrice"]; $returnval .= ' '."\n"; }else{ if(isset($result["NewAmazonPricing"]["Used"]["Price"]) && $result["NewAmazonPricing"]["Used"]["Price"] != '' && $result["NewAmazonPricing"]["Used"]["Price"] != '0') $usedPrice = $result["NewAmazonPricing"]["Used"]["Price"]; else $usedPrice = ''; $returnval .= ' '."\n"; } $returnval .= ' '."\n"; } } if(isset($result["VariantHTML"]) && $result["VariantHTML"] != ''){ $returnval .= ' '."\n"; $returnval .= ' '."\n"; $returnval .= ' '."\n"; } $returnval .= ' '."\n"; $returnval .= ' '."\n"; $returnval .= ' '."\n"; if(!isset($result["LowestUsedPrice"]) && !isset($result["LowestNewPrice"]) && !isset($result["ListPrice"])){ $returnval .= ' '."\n"; $returnval .= ' '."\n"; $returnval .= ' '."\n"; } $returnval .= '
'.$appip_text_listprice.''.$amazonhiddenmsg.'
'.$appip_text_listprice.''. maybe_convert_encoding($result["NewAmazonPricing"]["New"]["List"]) .''. maybe_convert_encoding($result["ListPrice"]) .'
' . __( 'Kindle Edition:', 'amazon-product-in-a-post-plugin' ) . '' . __( 'Check Amazon for Pricing', 'amazon-product-in-a-post-plugin' ) . ' ' . __( 'Digital Only', 'amazon-product-in-a-post-plugin' ) . '
'. $appip_text_newfrom .''. maybe_convert_encoding($newPrice).' '.$stockIn.''. maybe_convert_encoding($newPrice).' '.$stockOut.'
'.$appip_text_usedfrom.''.maybe_convert_encoding($usedPrice) .$stockIn.''. maybe_convert_encoding($usedPrice) . $stockOut.'
'.$result["VariantHTML"].'
'."\n"; $returnval .= '
'."\n"; if($result["ReleaseDate"] != ''){ $nowdatestt = strtotime(date("Y-m-d",time())); $nowminustt = strtotime("-60 days"); $reldatestt = strtotime($result["ReleaseDate"]); if($reldatestt > $nowdatestt){ $returnval .= '
'.$appip_text_releasedon.' '.date("F j, Y", strtotime($result["ReleaseDate"])).'.
'."\n"; }elseif($reldatestt >= $nowminustt){ $returnval .= ' '.$appip_text_reldate.' '.date("F j, Y", strtotime($result["ReleaseDate"])).'.'."\n"; } } $htmlButton = ((bool) apply_filters('appip_amazon_button_html',false) === true ? true : false); if($htmlButton){ $returnval .= ' '."\n"; }else{ if(isset($button[$arr_position])){ $bname = $button[$arr_position]; $brounded = strpos($bname,'rounded') !== false ? true : false; $bclass = isset($new_button_arr[$bname]['color']) ? 'amazon__btn'.$new_button_arr[$bname]['color'].' amazon__price--button--style'.( $brounded ? ' button-rounded' : '') : 'amazon__btn amazon__price--button--style'; $btext = isset($new_button_arr[$bname]['text']) ? esc_attr($new_button_arr[$bname]['text']) : _x('Buy Now', 'button text', 'amazon-product-in-a-post-plugin' ); $returnval .= ''."\n"; }else{ $buttonURL = apply_filters('appip_amazon_button_url',plugins_url('/images/'.$buyamzonbutton,dirname(__FILE__)),$buyamzonbutton,$manual_locale); $returnval .= '
'.apply_filters('appip_amazon_button_alt_text', __('buy now','amazon-product-in-a-post-plugin'),$result['ASIN']).'
'."\n"; } } $returnval .= '
'."\n"; $returnval .= '
'.$appip_text_notavalarea.'
'."\n"; $returnval .= '
'."\n"; $returnval .= '
'."\n"; $returnval .= '
'."\n"; if($result["CachedAPPIP"] !=''){ $returnval .= '<'.'!-- APPIP Item Cached ['.$result["CachedAPPIP"].'] -->'."\n"; } $returnval .= $thedivider; }//template endif; $arr_position++; endforeach; endif; return apply_filters('appip_single_product_filter',$returnval,$resultarr,$manual_array); } } } }