getSettings(); // If using local tags then just process the ones on this page otherwise search categories. if (strcasecmp($categories, "local") != 0) { // First process all post content for the selected categories $content = ''; $lastposts = get_posts("numberposts=$last&cat=$categories"); foreach ($lastposts as $id => $post) { $content .= $post->post_content; } $saved_tags = array_unique($this->tags); unset($this->tags); $this->tags = array(); $this->contentFilter($content, FALSE, FALSE); $this->Settings = $Settings; // Reset settings as contentFilter will overwrite them } if ((count($this->tags) != 0) && is_array($this->tags)) { $this->tags = array_unique($this->tags); $output = '
'; if (strcasecmp($Settings['wishlist_type'],'similar') == 0) { $request = array("Operation" => "CartCreate", "MergeCart" => "True", "ResponseGroup" => "CartSimilarities", "IdType"=>"ASIN", "MerchantId"=>"Amazon", "AssociateTag"=>$Settings['tag']); // Get the Cart Similarities for the items found $counter=1; foreach ($this->tags as $asin) { if (strlen($asin) > 8) { $request["Item." . $counter . ".ASIN"] = $asin; $request["Item." . $counter . ".Quantity"] = 1; $counter++; } } //echo "
"; print_r($request); echo "
"; $pxml = $this->doQuery($request); if ($pxml === False) { $output .= __('Amazon query failed to return any results - Have you configured the AWS settings?', 'amazon-link'); $output .= print_r($request, true); $Items=array(); } else { $Items=$pxml['Cart']['SimilarProducts']['SimilarProduct']; } foreach ($Items as $Item => $Details) $ASINs[] = $Details['ASIN']; } else if (strcasecmp($Settings['wishlist_type'],'random') == 0) { shuffle($this->tags); $ASINs = $this->tags; } else if (strcasecmp($Settings['wishlist_type'],'multi') == 0) { $ASINs = $this->tags; } $ASINs = array_slice($ASINs,0,$Settings['wishlist_items']); if (!isset($Settings['template'])) $this->Settings['template'] = $Settings['wishlist_template']; $output .= $this->make_links($ASINs, $Settings['text']); $output .= "
"; } else { $output .= ""; } if (isset($saved_tags)) { $this->tags = array_unique($saved_tags); unset($saved_tags); } return $output; ?>