'com',
"kw" => get_the_title(),
"type" => 'popular',
"tag" => 'susantaslab-20',
"length" => '20',
"details" => true,
"target" => '_blank'
), $atts));
require_once(ABSPATH.WPINC.'/rss.php');
switch ($domain) {
case 'com': //Amazon.com
$dom = "com";
break;
case 'au': //Amazon Australia
$dom = "com.au";
break;
case 'br': //Amazon Brazil
$dom = "com.br";
break;
case 'ca': //Amazon Canada
$dom = "ca";
break;
case 'cn': //Amazon China
$dom = "cn";
break;
case 'fr': //Amazon France
$dom = "fr";
break;
case 'de': //Amazon Germany
$dom = "de";
break;
case 'in': //Amazon India
$dom = "in";
break;
case 'it': //Amazon Italy
$dom = "it";
break;
case 'jp': //Amazon Japan
$dom = "co.jp";
break;
case 'mx': //Amazon Mexico
$dom = "com.mx";
break;
case 'es': //Amazon Spain
$dom = "es";
break;
case 'uk': //Amazon United Kingdom
$dom = "co.uk";
break;
default: //Amazon USA
$dom = "com";
break;
}
$rss = "http://www.amazon.$dom/rss/tag/$kw/$type/ref=tag_rsh_hl_ersn?tag=$tag&length=$length";
if ( $rss != "" && $rssFeed = fetch_feed( $rss ) ) {
$rssFeed->enable_order_by_date(false);
$maxitems = $rssFeed->get_item_quantity( $length );
if ($maxitems == 0)
return '
- Content not available at'.$rss .'.
';
$rss_items = $rssFeed->get_items( 0, $maxitems );
$content = '';
$itmNum = 1;
foreach ( $rss_items as $item ) {
$tagPos = stripos($item->get_title(), 'tagged');
$titlen = strlen($item->get_title());
$title = '# '. $itmNum++ . ' ' . substr($item->get_title(), 0, $tagPos );
$content .= '- ';
if ($target != '_self'){
$content .= '';
}
else {
$content .= '';
}
if ( $details != false && $details != "false") {
$itmDesc = $item->get_description();
$itmDesc = str_replace('class="photo"','class="photo" itemprop="image"',str_replace('
';
}
$content .= '
';
}
return $content;
}
add_shortcode( 'apf', 'SLB_Amazon_Product_Feeder' );
function Custom_APF_Plugin_Links( $links, $file ) {
if ( strpos( $file, 'amazon-product-feeder.php' ) !== false ) {
$new_links = array(
'' . __( 'Rate us' ) . '',
'' . __( 'Contact support' ) . '',
''.__('Demo: 20 Popular Laptops & Accessories at Amazon').'',
''.__('Demo: 20 Popular WiFi Routers at Amazon').' ',
''.__('Demo: 20 All Time Most Popular ChromeBooks').''
);
$links = array_merge( $links, $new_links );
}
return $links;
}
add_filter( 'plugin_row_meta', 'Custom_APF_Plugin_Links', 10, 2 );
?>