Skip to content
This repository has been archived by the owner on Nov 11, 2017. It is now read-only.

Commit

Permalink
* added MP3 widget
Browse files Browse the repository at this point in the history
 * fixed doc bug
 * fixed widgets titles

git-svn-id: http://plugins.svn.wordpress.org/amazon-widgets-shortcodes/trunk@134347 b8457f37-d9ea-0310-8a92-e5e31aec5664
  • Loading branch information
oncletom committed Jul 12, 2009
1 parent 58bff73 commit 3e3ae3d
Show file tree
Hide file tree
Showing 16 changed files with 247 additions and 7 deletions.
34 changes: 33 additions & 1 deletion admin/view/documentation.php
@@ -1,4 +1,4 @@
<div id="awshortcode-documentation" class="postbox closed">
<div id="awshortcode-documentation" class="awshortcode-documentation postbox closed">
<h3><?php _e('Amazon Widgets Shortcodes documentation', 'awshortcode') ?></h3>

<div class="inside">
Expand Down Expand Up @@ -86,6 +86,38 @@
</li>
</ul>

<h4><?php _e('Amazon MP3', 'awshortcode') ?></h4>
<ul>
<li>
<strong><?php _e('Shortcode:', 'awshortcode') ?></strong>
<code>[amazon-mp3][/amazon-mp3]</code>
</li>
<li>
<strong><?php _e('Example:', 'awshortcode') ?></strong>
<code>[amazon-mp3 align="right"]e048ac07-8b5b-4b38-abd0-49a92574494d[/amazon-mp3]</code>
</li>
<li>
<strong><?php _e('Options:', 'awshortcode') ?></strong>
<ul>
<li>
<code>align</code>:
{left, right, center}
<?php _e('align the widget on the desired way', 'awshortcode') ?>
</li>
<li>
<code>alt</code>:
[<?php _e('string', 'awshortcode') ?>]
<?php _e('alternative text if Flash or JavaScript is not available on visitor\'s browser', 'awshortcode') ?>
</li>
</ul>
</li>
<li>
<strong><?php _e('Content:', 'awshortcode') ?></strong>
<?php _e('Widget ID, contained in HTML parameter value like this:', 'awshortcode') ?>
<code>ID=V20070822/FR/onctom-21/8001/<span style="background: #ffc">e048ac07-8b5b-4b38-abd0-49a92574494d</span></code>.
</li>
</ul>

<h4><?php _e('Amazon My Favorites', 'awshortcode') ?></h4>
<ul>
<li>
Expand Down
2 changes: 1 addition & 1 deletion admin/view/options.php
Expand Up @@ -240,7 +240,7 @@
</div>

<div id="awshortcode-documentation">
<?php include(dirname(__FILE__).'/documentation.php') ?>
<?php AmazonWidgetsShortcodesAdmin::displayDocumentation() ?>
</div>

<p class="submit">
Expand Down
2 changes: 1 addition & 1 deletion amazon-widgets-shortcodes.php
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Amazon Widgets Shortcodes
Description: Easy management of Amazon Links & Widgets on your blog. Preserve your post consistency, use copy/paste Amazon code or build your links with an easy to use interface. <em>µ compatible</em>.
Author: Oncle Tom
Version: 1.4.2-dev
Version: 1.5-dev
Author URI: http://oncle-tom.net/
Plugin URI: http://case.oncle-tom.net/code/wordpress/
Expand Down
5 changes: 5 additions & 0 deletions doc/vendor/amazon-associates/WIDGETS
Expand Up @@ -8,6 +8,11 @@
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" id="Player_67b6cdef-c284-401e-a403-27106a813b9d" WIDTH="468px" HEIGHT="60px"> <PARAM NAME="movie" VALUE="http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&MarketPlace=FR&ID=V20070822%2FFR%2Fonctom-21%2F8009%2F67b6cdef-c284-401e-a403-27106a813b9d&Operation=GetDisplayTemplate"><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#FFFFFF"><PARAM NAME="allowscriptaccess" VALUE="always"><embed src="http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&MarketPlace=FR&ID=V20070822%2FFR%2Fonctom-21%2F8009%2F67b6cdef-c284-401e-a403-27106a813b9d&Operation=GetDisplayTemplate" id="Player_67b6cdef-c284-401e-a403-27106a813b9d" quality="high" bgcolor="#ffffff" name="Player_67b6cdef-c284-401e-a403-27106a813b9d" allowscriptaccess="always" type="application/x-shockwave-flash" align="middle" height="60px" width="468px"></embed></OBJECT> <NOSCRIPT><A HREF="http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&MarketPlace=FR&ID=V20070822%2FFR%2Fonctom-21%2F8009%2F67b6cdef-c284-401e-a403-27106a813b9d&Operation=NoScript">Widgets Amazon.fr</A></NOSCRIPT>
}}}

== MP3 ==
{{{
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" id="Player_ed4a7b23-138a-4f0b-9f5d-348a5fb51633" WIDTH="250px" HEIGHT="250px"> <PARAM NAME="movie" VALUE="http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&MarketPlace=FR&ID=V20070822%2FFR%2Fonctom-21%2F8014%2Fed4a7b23-138a-4f0b-9f5d-348a5fb51633&Operation=GetDisplayTemplate"><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#FFFFFF"><PARAM NAME="allowscriptaccess" VALUE="always"><embed src="http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&MarketPlace=FR&ID=V20070822%2FFR%2Fonctom-21%2F8014%2Fed4a7b23-138a-4f0b-9f5d-348a5fb51633&Operation=GetDisplayTemplate" id="Player_ed4a7b23-138a-4f0b-9f5d-348a5fb51633" quality="high" bgcolor="#ffffff" name="Player_ed4a7b23-138a-4f0b-9f5d-348a5fb51633" allowscriptaccess="always" type="application/x-shockwave-flash" align="middle" height="250px" width="250px"></embed></OBJECT> <NOSCRIPT><A HREF="http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&MarketPlace=FR&ID=V20070822%2FFR%2Fonctom-21%2F8014%2Fed4a7b23-138a-4f0b-9f5d-348a5fb51633&Operation=NoScript">Widgets Amazon.fr</A></NOSCRIPT>
}}}

== My Favorites ==
{{{
<SCRIPT charset="utf-8" type="text/javascript" src="http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&MarketPlace=FR&ID=V20070822/FR/onctom-21/8006/83fd4e57-4df0-49fe-add1-6ad5933247b0"> </SCRIPT> <NOSCRIPT><A HREF="http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&MarketPlace=FR&ID=V20070822%2FFR%2Fonctom-21%2F8006%2F83fd4e57-4df0-49fe-add1-6ad5933247b0&Operation=NoScript">Widgets Amazon.fr</A></NOSCRIPT>
Expand Down
9 changes: 9 additions & 0 deletions lib/AmazonWidgetsShortcodeConfiguration.class.php
Expand Up @@ -125,6 +125,7 @@ function getRegions()
'tool-productpreview' => 'http://www.assoc-amazon.ca/s/link-enhancer?tag=%s&amp;o=15',
'widget-carrousel' => 'http://ws.amazon.ca/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8010%%2F%s&amp;Operation=%s',
'widget-deals' => 'http://ws.amazon.ca/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8009%%2F%s&amp;Operation=%s',
'widget-mp3' => 'http://ws.amazon.ca/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8009%%2F%s&amp;Operation=%s',
'widget-myfavorites' => 'http://ws.amazon.ca/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8001/%s',
'widget-product' => 'http://rcm-ca.amazon.ca/e/cm?t=%s&amp;o=15&amp;p=8&amp;l=as1&amp;asins=%s&amp;fc1=%s&amp;%s=1&amp;lt1=%s&amp;lc1=%s&amp;bc1=%s&amp;bg1=%s&amp;f=ifr',
'widget-productcloud' => 'http://ws.amazon.ca/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8006/%s',
Expand All @@ -146,6 +147,7 @@ function getRegions()
'tool-productpreview' => 'http://www.assoc-amazon.de/s/link-enhancer?tag=%s&amp;o=15',
'widget-carrousel' => 'http://ws.amazon.de/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8010%%2F%s&amp;Operation=%s',
'widget-deals' => 'http://ws.amazon.de/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8009%%2F%s&amp;Operation=%s',
'widget-mp3' => 'http://ws.amazon.de/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8009%%2F%s&amp;Operation=%s',
'widget-myfavorites' => 'http://ws.amazon.de/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8001/%s',
'widget-product' => 'http://rcm-de.amazon.de/e/cm?t=%s&amp;o=15&amp;p=8&amp;l=as1&amp;asins=%s&amp;fc1=%s&amp;%s=1&amp;lt1=%s&amp;lc1=%s&amp;bc1=%s&amp;bg1=%s&amp;f=ifr',
'widget-productcloud' => 'http://ws.amazon.de/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8006/%s',
Expand All @@ -168,6 +170,7 @@ function getRegions()
'tool-productpreview' => 'http://www.assoc-amazon.fr/s/link-enhancer?tag=%s&o=8',
'widget-carrousel' => 'http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8010%%2F%s&amp;Operation=%s',
'widget-deals' => 'http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8009%%2F%s&amp;Operation=%s',
'widget-mp3' => 'http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8009%%2F%s&amp;Operation=%s',
'widget-myfavorites' => 'http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8001/%s',
'widget-product' => 'http://rcm-fr.amazon.fr/e/cm?t=%s&amp;o=8&amp;p=8&amp;l=as1&amp;asins=%s&amp;fc1=%s&amp;%s=1&amp;lt1=%s&amp;lc1=%s&amp;bc1=%s&amp;bg1=%s&amp;f=ifr',
'widget-productcloud' => 'http://ws.amazon.fr/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8006/%s',
Expand All @@ -189,6 +192,7 @@ function getRegions()
'tool-productpreview' => 'http://www.assoc-amazon.jp/s/link-enhancer?tag=%s&o=8',
'widget-carrousel' => 'http://ws.amazon.co.jp/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8010%%2F%s&amp;Operation=%s',
'widget-deals' => 'http://ws.amazon.co.jp/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8009%%2F%s&amp;Operation=%s',
'widget-mp3' => 'http://ws.amazon.co.jp/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8009%%2F%s&amp;Operation=%s',
'widget-myfavorites' => 'http://ws.amazon.co.jp/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8001/%s',
'widget-product' => 'http://rcm-jp.amazon.co.jp/e/cm?t=%s&amp;o=8&amp;p=8&amp;l=as1&amp;asins=%s&amp;fc1=%s&amp;%s=1&amp;lt1=%s&amp;lc1=%s&amp;bc1=%s&amp;bg1=%s&amp;f=ifr',
'widget-productcloud' => 'http://ws.amazon.co.jp/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8006/%s',
Expand All @@ -211,6 +215,7 @@ function getRegions()
'tool-productpreview' => 'http://www.assoc-amazon.co.uk/s/link-enhancer?tag=%s&amp;o=2',
'widget-carrousel' => 'http://ws.amazon.co.uk/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8010%%2F%s&amp;Operation=%s',
'widget-deals' => 'http://ws.amazon.co.uk/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8009%%2F%s&amp;Operation=%s',
'widget-mp3' => 'http://ws.amazon.co.uk/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8009%%2F%s&amp;Operation=%s',
'widget-myfavorites' => 'http://ws.amazon.co.uk/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8001/%s',
'widget-product' => 'http://rcm-uk.amazon.co.uk/e/cm?t=%s&amp;o=2&amp;p=8&amp;l=as1&amp;asins=%s&amp;fc1=%s&amp;%s=1&amp;lt1=%s&amp;lc1=%s&amp;bc1=%s&amp;bg1=%s&amp;f=ifr',
'widget-productcloud' => 'http://ws.amazon.co.uk/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8006/%s',
Expand All @@ -232,6 +237,7 @@ function getRegions()
'tool-contextlinks' => 'http://cls.assoc-amazon.com/s/cls.js',
'tool-productpreview' => 'http://www.assoc-amazon.com/s/link-enhancer?tag=%s&amp;o=1',
'widget-carrousel' => 'http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8010%%2F%s&amp;Operation=%s',
'widget-mp3' => 'http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822%%2F%1$s%%2F%s%%2F8009%%2F%s&amp;Operation=%s',
'widget-myfavorites' => 'http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8001/%s',
'widget-product' => 'http://rcm.amazon.com/e/cm?t=%s&amp;o=1&amp;p=8&amp;l=as1&amp;asins=%s&amp;fc1=%s&amp;%s=1&amp;lt1=%s&amp;lc1=%s&amp;bc1=%s&amp;bg1=%s&amp;f=ifr',
'widget-productcloud' => 'http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=%s&amp;ID=V20070822/%1$s/%s/8006/%s',
Expand Down Expand Up @@ -276,6 +282,9 @@ function getShortcodes()
'amazon-deals' => array(
'class' => 'AmazonWidgetsShortcodeDeals',
),
'amazon-mp3' => array(
'class' => 'AmazonWidgetsShortcodeMp3',
),
'amazon-myfavorites' => array(
'class' => 'AmazonWidgetsShortcodeMyFavorites',
),
Expand Down
59 changes: 59 additions & 0 deletions lib/widgets/AmazonWidgetsShortcodeMp3.class.php
@@ -0,0 +1,59 @@
<?php
/**
* @author oncletom
*/

class AmazonWidgetsShortcodeMp3 extends AmazonWidgetsShortcodeBase
{
/**
* @see AmazonWidgetsShortcode::displayAsHtml()
* @see AmazonWidgetsShortcodeBase::displayAsHtml()
*/
function displayAsHtml($attributes, $value = null)
{
return parent::displayAsHtml($attributes, $value, __CLASS__);
}

/**
* @see AmazonWidgetsShortcode::shortcodeToHtml()
*/
function shortcodeToHtml($attributes, $value = null)
{
extract(
shortcode_atts(
array(
'align' => get_option('awshortcode_align'),
'alt' => '',
'region' => get_option('awshortcode_region'),
'tracking_id' => get_option('awshortcode_tracking_id'),
),
$attributes
)
);

/*
* Preparing data
*/
$region = AmazonWidgetsShortcodeConfiguration::getRegion($region);
$uri = sprintf(
$region['url']['widget-mp3'],
$region['marketplace'],
$tracking_id,
$value
);
$uri_encoded = call_user_func(array(__CLASS__, 'encodeParameters'), $uri);

/*
* Display
*/
return
'<div class="awshortcode-mp3 align'.$align.'">'.
'<script charset="utf-8" type="text/javascript" src="'.$uri.'"></script>'.
'<noscript>'.
'<a href="'.$uri_encoded.'&amp;Operation=NoScript">'.
($alt ? $alt : __('Consult my shared MP3 on Amazon.', 'awshortcode')).
'</a>'.
'</noscript>'.
'</div>';
}
}
7 changes: 7 additions & 0 deletions readme.txt
Expand Up @@ -34,6 +34,7 @@ Easy management of Amazon Links & Widgets on your blog. Preserve your post consi

* Carrousel Widget
* Deals Widget
* MP3
* My Favorites Widget
* Product Preview
* Product Links
Expand Down Expand Up @@ -74,6 +75,12 @@ Now you plug 'n play 'n earn money ;-)


== Release notes ==
= Version 1.5 =
* ui: documentation tab now displays the ... documentation (it helps a bit ...)
* widget: added MP3 Widget
* widget: fixed 'apply the magic' parser which missed some ASIN codes with alpha chars inside (reported by [DavidBorrink](http://wordpress.org/support/profile/20995))
* widget: fixed Germany widgets (reported by [jetztlernin](http://wordpress.org/support/profile/3392887))

= Version 1.4.1 =
* i18n: new Belorussian translation thanks to [Fat Cow](http://www.fatcow.com/)

Expand Down
2 changes: 2 additions & 0 deletions web/javascript/awshortcode.js
Expand Up @@ -16,6 +16,8 @@
select: 0
});

$('#awshortcode div.awshortcode-documentation').removeClass('closed');

/*
* Open links in a new page
*/
Expand Down

0 comments on commit 3e3ae3d

Please sign in to comment.