Plugin Directory

Changeset 410533


Ignore:
Timestamp:
07/16/2011 03:28:38 AM (15 years ago)
Author:
mdbitz
Message:

Version 1.7 Checking

Location:
wordpress-amazon-associate/trunk
Files:
3 added
21 edited

Legend:

Unmodified
Added
Removed
  • wordpress-amazon-associate/trunk/AmazonProduct.php

    r386477 r410533  
    22
    33/*
    4  * copyright (c) 2010 MDBitz - Matthew John Denton - mdbitz.com
     4 * copyright (c) 2010,2011 MDBitz - Matthew John Denton - mdbitz.com
    55 *
    66 * This file is part of WordPress Amazon Associate Plugin.
     
    4848     * @param string $target link target
    4949     */
    50     public static function link($content, $id, $locale = null, $type = "ASIN",
    51             $target = "_blank", $rel = "nofollow", $container = null,
    52             $container_class = null, $title = null ) {
     50    public static function link( $options ) {
    5351        global $wpaa;
    54         $output_str = $content;
    55         if (!is_null($id)) {
    56             $result = $wpaa->getCacheHandler()->getProduct( $id, $locale, $type );
     52        // set Default Values
     53        $options = shortcode_atts( array( 'content'=>null, 'id'=>null,
     54            'locale'=> null, 'type' => 'ASIN', 'target' => '_blank',
     55            'rel' => "nofollow", 'container' => null, 'container_class' => null,
     56            'container_style' => null, 'title' => null, 'echo' => true ),
     57            $options );
     58        // Generate Link
     59        $output_str = $options['content'];
     60        if (!is_null($options['id'])) {
     61            $result = $wpaa->getCacheHandler()->getProduct( $options['id'], $options['locale'], $options['type'] );
    5762            if ($result->isSuccess() && isset($result->Items[0])) {
    58                 $output_str = '<a href="' . urldecode($result->Items[0]->DetailPageURL) . '" target="' . $target . '" rel="' . $rel . '" title="' . (is_null($title) ? '' : $title) . '" >' . $content . '</a>';
     63                $output_str = '<a href="' . urldecode($result->Items[0]->DetailPageURL) . '" target="' . $options['target'] . '" rel="' . $options['rel'] . '" title="' . (is_null($options['title']) ? '' : $options['title']) . '" >' . $options['content'] . '</a>';
    5964            }
    6065        }
    61         if( ! empty($container) ) {
    62             if( ! empty($container_class) ) {
    63                 $output_str = '<' . $container . ' class="' . $container_class . '" >' . $output_str . '</' . $container . '>';
    64             } else {
    65                 $output_str = '<' . $container . ' >' . $output_str . '</' . $container . '>';
    66             }
    67         }
    68         return $output_str;
     66        // Generate Response
     67        if( $options['echo'] ) {
     68            echo WPAA_ShortCodeHandler::doStyle($options, $output_str );
     69        } else {
     70            return WPAA_ShortCodeHandler::doStyle( $options, $output_str );
     71        }
    6972    }
    7073
     
    8285     * @param string $target link target
    8386     */
    84     public static function image($content, $id, $size="medium", $link = false,
    85             $locale = null, $type = "ASIN", $target = "_blank",
    86             $rel = "nofollow", $class = null, $container = null,
    87             $container_class = null, $alt = null, $title = null ) {
     87    public static function image($options ) {
    8888        global $wpaa;
    89         $output_str = $content;
    90         if (!is_null($id)) {
     89        // set default values
     90        $options = shortcode_atts( array( 'content' => null, 'id'=>null,
     91            'locale'=>null, 'size'=>'medium', 'type' => 'ASIN', 'link' => false,
     92            'target' => '_blank', 'rel' => "nofollow", 'class'=> null,
     93            'container'=>null, 'container_class' => null,
     94            'container_style' => null, 'alt' => null, 'title' => null,
     95            'echo' => true ), $options );
     96        // Genrate Image
     97        $output_str = $options['content'];
     98        if (!is_null($options['id'])) {
    9199            $response_group = AmazonProduct_ResponseGroup::ITEM_ATTRIBUTES .", " . AmazonProduct_ResponseGroup::IMAGES;
    92             $result = $wpaa->getCacheHandler()->getProduct( $id, $locale, $type, $response_group );
     100            $result = $wpaa->getCacheHandler()->getProduct( $options['id'], $options['locale'], $options['type'], $response_group );
    93101            if ($result->isSuccess() && isset($result->Items[0])) {
    94                 $size = strtolower($size);
     102                $options['size'] = strtolower($options['size']);
    95103                $image = null;
    96                 switch ($size) {
     104                switch ($options['size']) {
    97105                    case "small":
    98106                        $image = $result->Items[0]->SmallImage;
     
    105113                        break;
    106114                }
    107                 if( ! is_null($class) ) {
    108                     $image->set( "class", $class );
    109                 }
    110                 if( ! is_null($rel) ) {
    111                     $image->set( "rel", $rel );
    112                 }
    113                 if( ! is_null($title) ) {
    114                     $image->set("title", $title );
     115                if( ! is_null($options['class']) ) {
     116                    $image->set( "class", $options['class'] );
     117                }
     118                if( ! is_null($options['rel']) ) {
     119                    $image->set( "rel", $options['rel'] );
     120                }
     121                if( ! is_null($options['title']) ) {
     122                    $image->set("title", $options['title'] );
    115123                } else {
    116                     $image->set("title", $content );
    117                 }
    118                 if( ! is_null($alt) ) {
    119                     $image->set("alt", $alt );
     124                    $image->set("title", $options['content'] );
     125                }
     126                if( ! is_null($options['alt']) ) {
     127                    $image->set("alt", $options['alt'] );
    120128                }
    121129                $output_str = '';
    122                 if ($link) {
    123                     $output_str = '<a href="' . urldecode($result->Items[0]->DetailPageURL) . '" target="' . $target . '">';
     130                if ($options['link']) {
     131                    $output_str = '<a href="' . urldecode($result->Items[0]->DetailPageURL) . '" target="' . $options['target'] . '">';
    124132                }
    125133                if (!is_null($image)) {
    126134                    $output_str .= $image->toHTML();
    127135                } else {
    128                     $output_str .= $content;
    129                 }
    130                 if ($link) {
     136                    $output_str .= $options['content'];
     137                }
     138                if ($options['link']) {
    131139                    $output_str .= '</a>';
    132140                }
    133141            }
    134142        }
    135         if( ! empty($container) ) {
    136             if( ! empty($container_class) ) {
    137                 $output_str = '<' . $container . ' class="' . $container_class . '" >' . $output_str . '</' . $container . '>';
    138             } else {
    139                 $output_str = '<' . $container . ' >' . $output_str . '</' . $container . '>';
    140             }
    141         }
    142         return $output_str;
     143        // Generate Response
     144        if( $options['echo'] ) {
     145            echo WPAA_ShortCodeHandler::doStyle($options, $output_str );
     146        } else {
     147            return WPAA_ShortCodeHandler::doStyle( $options, $output_str );
     148        }
    143149    }
    144150   
     
    151157     * @param string $locale Locale
    152158     */
    153     public static function enhanced($asin, $locale = null, $new_window = true,
    154             $show_border = true, $larger_image = true, $price = "All",
    155             $background_color = "FFFFFF", $text_color="000000",
    156             $link_color="0000FF", $container = null, $container_class = null ) {
     159    public static function enhanced($options ) {
    157160        global $wpaa;
     161        // set defaults
     162        $options = shortcode_atts( array( 'content' => null, 'asin' => null,
     163            'locale' => null, 'new_window' => true, 'show_border' => true,
     164            'larger_image' => true, 'price' => "All",
     165            'background_color' => "FFFFFF", 'text_color' => "000000",
     166            'link_color' => "0000FF", 'container' => null,
     167            'container_class' => null, 'container_style' => null,
     168            'echo' => true), $options );
     169
    158170        $outputStr = '<iframe src="';
    159171        // get Locale
    160         $locale = $wpaa->getGeoLocale( $locale );
     172        $locale = $wpaa->getGeoLocale( $options['locale'] );
    161173        // Append service url
    162         $outputStr .= self::getURL( $locale ) . '?';
     174        $outputStr .= WPAA_URIHandler::getRemoteContentURI( $locale ) . '?';
    163175        // Append Link Target
    164         if( $new_window === true ) {
     176        if( $options['new_window'] === true ) {
    165177            $outputStr .= 'lt1=_blank&';
    166178        } else {
     
    168180        }
    169181        // Append Show Border
    170         if( $show_border === true ) {
     182        if( $options['show_border'] === true ) {
    171183            $outputStr .= 'bc1=000000&';
    172184        } else {
     
    174186        }
    175187        // Append Image Size
    176         if( $larger_image === true ) {
     188        if( $options['larger_image'] === true ) {
    177189            $outputStr .= 'IS2=1&';
    178190        } else {
     
    180192        }
    181193        // Append Pricing Options
    182         if( $price == "New" ) {
     194        if( $options['price'] == "New" ) {
    183195            $outputStr .= 'nou=1&';
    184         } else if ( $price == "Hide" ) {
     196        } else if ( $options['price'] == "Hide" ) {
    185197            $outputStr .= 'npa=1&';
    186198        }
    187199        // Append Style Options
    188         $outputStr .= 'bg1=' . $background_color . '&';
    189         $outputStr .= 'fc1=' . $text_color . '&';
    190         $outputStr .= 'lc1=' . $link_color . '&';
     200        $outputStr .= 'bg1=' . $options['background_color'] . '&';
     201        $outputStr .= 'fc1=' . $options['text_color'] . '&';
     202        $outputStr .= 'lc1=' . $options['link_color'] . '&';
    191203        // Append Associate Tag
    192204        global $post;
     
    200212        $outputStr .= 'p=8&l=as1&m=amazon&f=ifr&';
    201213        // Append ASIN ID
    202         $outputStr .= 'asins=' . $asin;
     214        $outputStr .= 'asins=' . $options['asin'];
    203215        // Close IFrame
    204216        $outputStr .= '" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>';
    205         if( ! empty($container) ) {
    206             if( ! empty($container_class) ) {
    207                 $outputStr = '<' . $container . ' class="' . $container_class . '" >' . $outputStr . '</' . $container . '>';
    208             } else {
    209                 $outputStr = '<' . $container . ' >' . $outputStr . '</' . $container . '>';
    210             }
    211         }
    212         return $outputStr;
    213     }
    214 
    215     /**
    216      * get the service URL for desired locale
    217      *
    218      * @param string $locale
    219      * @return string
    220      */
    221     public static function getURL( $locale ) {
    222         switch( $locale ) {
    223             case "UK":
    224                 return "http://rcm-uk.amazon.co.uk/e/cm";
    225                 break;
    226             case "CA":
    227                 return "http://rcm-ca.amazon.ca/e/cm";
    228                 break;
    229             case "CN":
    230                 return "http://rcm-cn.amazon.cn/e/cm";
    231                 break;
    232             case "DE":
    233                 return "http://rcm-de.amazon.de/e/cm";
    234                 break;
    235             case "FR":
    236                 return "http://rcm-fr.amazon.fr/e/cm";
    237                 break;
    238             case "JP":
    239                 return "http://rcm-jp.amazon.co.jp/e/cm";
    240                 break;
    241             case "IT":
    242                 return "http://rcm-it.amazon.it/e/cm";
    243                 break;
    244             default:
    245                 return "http://rcm.amazon.com/e/cm";
    246                 break;
     217
     218        // Generate Response
     219        if( $options['echo'] ) {
     220            echo WPAA_ShortCodeHandler::doStyle($options, $outputStr );
     221        } else {
     222            return WPAA_ShortCodeHandler::doStyle( $options, $outputStr );
    247223        }
    248224    }
  • wordpress-amazon-associate/trunk/AmazonWidget.php

    r353979 r410533  
    22
    33/*
    4  * copyright (c) 2010 MDBitz - Matthew John Denton - mdbitz.com
     4 * copyright (c) 2010,2011 MDBitz - Matthew John Denton - mdbitz.com
    55 *
    66 * This file is part of WordPress Amazon Associate Plugin.
     
    4343    public static function Carousel( $args ) {
    4444        $widget = new AmazonWidget_Carousel( $args );
    45         echo $widget->toHTML();
     45        echo WPAA_ShortCodeHandler::doStyle( $args, $widget->toHTML() );
    4646    }
    4747
     
    5252    public static function MP3Clips( $args ) {
    5353        $widget = new AmazonWidget_MP3Clips( $args );
    54         echo $widget->toHTML();
     54        echo WPAA_ShortCodeHandler::doStyle( $args, $widget->toHTML() );
    5555    }
    5656
     
    6161    public static function MyFavorites( $args ) {
    6262        $widget = new AmazonWidget_MyFavorites( $args );
    63         echo $widget->toHTML();
     63        echo WPAA_ShortCodeHandler::doStyle( $args, $widget->toHTML() );
    6464    }
    6565
     
    7070    public static function Search( $args ) {
    7171        $widget = new AmazonWidget_Search( $args );
    72         echo $widget->toHTML();
     72        echo WPAA_ShortCodeHandler::doStyle( $args, $widget->toHTML() );
    7373    }
    7474
     
    7979    public static function Omakase( $args ) {
    8080        $widget = new AmazonWidget_Omakase( $args );
    81         echo $widget->toHTML();
     81        echo WPAA_ShortCodeHandler::doStyle( $args, $widget->toHTML() );
    8282    }
    8383
     
    8888    public static function ProductCloud( $args ) {
    8989        $widget = new AmazonWidget_ProductCloud( $args );
    90         echo $widget->toHTML();
     90        echo WPAA_ShortCodeHandler::doStyle( $args, $widget->toHTML() );
    9191    }
    9292
  • wordpress-amazon-associate/trunk/AmazonWidget/Omakase.php

    r321609 r410533  
    170170        $output .= '
    171171            //--></script>';
    172         $output .= '<script type="text/javascript" src="http://www.assoc-amazon.' . self::getDomain( $locale ) . $this->_script_url . '"></script>';
     172        $output .= '<script type="text/javascript" src="http://www.assoc-amazon.' . WPAA_URIHandler::getDomain( $locale ) . $this->_script_url . '"></script>';
    173173        return $output;
    174174    }
     
    291291    }
    292292
    293     /**
    294      * return Associative Array of available Markets
    295      *
    296      * @return array
    297      */
    298     public static function getDomain($locale) {
    299         switch( $locale ) {
    300             case "CA":
    301                 return "ca";
    302             break;
    303             case "DE":
    304                 return "de";
    305             break;
    306             case "FR":
    307                 return "fr";
    308             break;
    309             case "JP":
    310                 return "jp";
    311             break;
    312             case "UK":
    313                 return "co.uk";
    314             break;
    315             default:
    316                 return "com";
    317             break;
    318         };
    319     }
    320 
    321293
    322294    /**
  • wordpress-amazon-associate/trunk/MDBitz/Plugin.php

    r313769 r410533  
    3636     */
    3737    abstract class MDBitz_Plugin {
     38
     39        /**
     40         * Plugin Version
     41         * @var String
     42         */
     43        protected $version = '-';
     44
     45        /**
     46         * Plugin Last Updated
     47         * @var String
     48         */
     49        protected $last_updated = '-';
    3850
    3951        /**
     
    119131        }
    120132
     133        /**
     134         * Output Admin SideBar
     135         */
     136        function doAdminSideBar($source) {
     137?>
     138<div class="postbox-container" style="width:300px;"  >
     139    <div class="metabox-holder">
     140        <div class="meta-box-sortables">
     141<?php
     142            $content = '<div class="admin_config_box">';
     143            $content .= '<strong>' . __('Author:','wpaa') . '</strong> <a href="http://mdbitz.com/" target="_blank">MDBitz- Matthew Denton</a><br/><br/>';
     144            $content .= '<strong>' . __('Project Website:','wpaa') . '</strong> <a href="http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/?utm_source=' . $source . '&utm_medium=about-us&utm_campaign=plugin" target="_blank">labs.mdbitz.com</a><br/><br/>';
     145            $content .= '<strong>' . __('Version:','wpaa') . '</strong> ' . $this->version . '<br/><br/>';
     146            $content .= '<strong>' . __('Last Updated:','wpaa') . '</strong> ' . $this->last_updated;
     147            $content .= '</div>';
     148            $this->postbox("about", __("About this Plugin",'wpaa'), $content);
     149
     150            $content = '<div class="admin_config_box">';
     151            $content .= '<a href="http://wordpress.org/extend/plugins/wordpress-amazon-associate/" target="_blank">' . __('Rate this plugin','wpaa') . '</a> ' . __('on WordPress') . '<br/><br/>';
     152            $content .= '<a href="http://wordpress.org/extend/plugins/wordpress-amazon-associate/" target="_blank">' . __('Notify','wpaa') . '</a> ' .  __('WordPress users this plugin works with your WordPress version','wpaa') . '<br/><br/>';
     153            $content .= '<strong>Share this plugin with others</strong><br/><br/>';
     154            //facebook
     155            $content .= '<a href="http://www.facebook.com/sharer.php?u=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/&t=Awesome%20WordPress%20Plugin:%20%20WordPress%20Amazon%20Associate" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/fb.png" alt="Facebook" /></a>';
     156            //digg
     157            $content .= '&nbsp;&nbsp;<a href="http://digg.com/submit?url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/digg.gif" alt="Digg" /></a>';
     158            //stubmleupon
     159            $content .= '&nbsp;&nbsp;<a href="http://www.stumbleupon.com/badge/?url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/stumbleupon.gif" alt="Stumble Upon" /></a>';
     160            //delicious
     161            $content .= '&nbsp;&nbsp;<a href="http://delicious.com/save?v=5&noui&jump=close&url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/deli.gif" alt="Delicous" /></a>';
     162            //twitter
     163            $content .= '&nbsp;&nbsp;<a href="http://twitter.com/home/?status=WordPress+Amazon+Associate+%2C+the+all-in-one+Amazon+Associate+WordPress+Plugin+http://tinyurl.com/wpaaplugin" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/twitter.gif" alt="Twitter" /></a>';
     164            $content .= '</div>';
     165            $this->postbox("feedback", __("User Feedback",'wpaa'), $content);
     166
     167            $content = '<div class="admin_center" >';
     168            $content .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
     169                        <input type="hidden" name="cmd" value="_s-xclick">
     170                        <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHJwYJKoZIhvcNAQcEoIIHGDCCBxQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UE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gK0O62794omrrKG2jlxFjiHTwb0hgFbShBg4AJd2dpjF9AJ5WFa1V5SGYoscmNYrHnRoaYZIc5SPbd7Fto0vuIK1Z1Jq8x3rZ2ex85I3WLLusKg=-----END PKCS7-----
     171                        ">
     172                        <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
     173                        <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
     174                        </form>';
     175            $content .= '</div>';
     176            $this->postbox("donate", __("Show your support!",'wpaa'), $content);
     177?>
     178        </div>
     179    </div>
     180</div>
     181<?php
     182        }
     183
    121184    }
    122185
  • wordpress-amazon-associate/trunk/WPAA.php

    r400955 r410533  
    11<?php
    22/*
    3  * copyright (c) 2010 MDBitz - Matthew John Denton - mdbitz.com
     3 * copyright (c) 2010,2011 MDBitz - Matthew John Denton - mdbitz.com
    44 *
    55 * This file is part of WordPress Amazon Associate Plugin.
     
    7474
    7575    /**
     76     * Amazon Banners
     77     */
     78    const MODULE_AMAZON_BANNER = 'Amazon Banners';
     79
     80    /**
     81     * Amazon Widgets
     82     */
     83    const MODULE_AMAZON_WIDGETS = 'Amazon Widgets';
     84
     85    /**
    7686     * SourceCode Handler
    7787     * @var WPAA_ShortCodeHandler
     
    99109        "JP" => "wp-amazon-associate-22"
    100110    );
    101    
     111
    102112    /**
    103113     * Amazon Associate Ids
     
    116126     * @var Array
    117127     */
    118     protected $enabled_locales = array( 
    119         "US" => true, 
    120         "UK" => true, 
     128    protected $enabled_locales = array(
     129        "US" => true,
     130        "UK" => true,
    121131        "CA" => true,
    122         "CN" => true,
    123132        "DE" => true,
    124         "IT" => true,
    125133        "FR" => true,
    126134        "JP" => true
     
    176184                "SecretKey" => null,
    177185                "AssociateSupport" => "0",
     186                "AdminSupport" => "0",
    178187                "ProductPreview" => false,
    179188                "ProductPreviewNoConflict" => false,
    180                 "AmazonCarouselWidget" => true,
    181                 "AmazonMyFavoritesWidget" => true,
    182                 "AmazonMP3ClipsWidget" => true,
    183                 "AmazonOmakaseWidget" => true,
    184                 "AmazonProductCloudWidget" => true,
    185                 "AmazonSearchWidget" => true,
    186189                "FilterAssociateTag" => false,
    187                 "MultiUser" => false
     190                "MultiUser" => false,
     191                "AWSValid" => null,
     192                "Version" => null,
     193                "CVEnabled" => false,
     194                "CVLocale" => ""
    188195        );
    189196
     
    198205     * @var String
    199206     */
    200     protected $version = '1.6.1';
     207    protected $version = '1.7.0';
    201208
    202209    /**
     
    204211     * @var String
    205212     */
    206     protected $last_updated = '06-24-2011';
     213    protected $last_updated = '07-15-2011';
    207214
    208215    /**
     
    211218    function __construct() {
    212219        parent::__construct();
    213         add_action('admin_head', array(&$this, 'configPageHead'));
    214         add_action('admin_print_scripts', array(&$this, 'configPageScripts'));
    215         add_action('admin_print_styles', array(&$this, 'configPageStyles'));
    216         add_action('admin_notices', array(&$this, 'displayErrorMessage'));
     220        add_action('admin_head', array(&$this, 'doPageHead'));
     221        add_action('admin_print_scripts', array(&$this, 'doPageScripts'));
     222        add_action('admin_print_styles', array(&$this, 'doPageStyles'));
    217223        add_action('admin_init', array(&$this, 'saveSettings'));
    218224        add_action('init', array(&$this, 'init'));
    219         add_action('widgets_init', array(&$this, 'init_widgets'));
    220225        $this->loadOptions();
    221226        $this->loadModules();
     227        $this->upgrade();
    222228        // init I18n
    223229        load_plugin_textdomain('wpaa', false, dirname( plugin_basename(__FILE__) ) . '/languages');
     
    228234     */
    229235    public function loadModules() {
    230         // init compliance module
    231         $this->modules[self::MODULE_COMPLIANCE] = new WPAA_Module_Compliance( $this->config_hook, $this->version, $this->last_updated );
    232         // init ip2nation module
    233         $this->modules[self::MODULE_IP2NATION] = new WPAA_Module_IP2Nation( $this->config_hook, $this->version, $this->last_updated );
    234         // init ip2nation module
    235         $this->modules[self::MODULE_QUICK_LINKS] = new WPAA_Module_QuickLinks( $this->config_hook, $this->version, $this->last_updated );
    236         // init MultiUser
     236        // init Multi User Support
    237237        if( $this->options['MultiUser'] ) {
    238238            // init multi user module
    239239            $this->modules[self::MODULE_MULTI_USER] = new WPAA_Module_MultiUser( $this->config_hook, $this->version, $this->last_updated );
    240240        }
    241         //init cache module
     241        // init Widget module
     242        $this->modules[self::MODULE_AMAZON_WIDGETS] = new WPAA_Module_Widget( $this->config_hook, $this->version, $this->last_updated );
     243        // init Compliance module
     244        $this->modules[self::MODULE_COMPLIANCE] = new WPAA_Module_Compliance( $this->config_hook, $this->version, $this->last_updated );
     245        //init Amazon Banner
     246        //$this->modules[self::MODULE_AMAZON_BANNER] = new WPAA_Module_Banner( $this->config_hook, $this->version, $this->last_updated );
     247        // init ip2nation module
     248        $this->modules[self::MODULE_IP2NATION] = new WPAA_Module_IP2Nation( $this->config_hook, $this->version, $this->last_updated );
     249        //init Cache module
    242250        $this->modules[self::MODULE_CACHE] = new WPAA_Module_Cache( $this->config_hook, $this->version, $this->last_updated );
     251        if( $this->isValidCredentials() ) { // load if Valid Credentials
     252            // init Quick Links module
     253            $this->modules[self::MODULE_QUICK_LINKS] = new WPAA_Module_QuickLinks( $this->config_hook, $this->version, $this->last_updated );
     254        }
    243255        // init ShortCode Handler
    244256        $this->scHandler = new WPAA_ShortCodeHandler($this->modules[self::MODULE_COMPLIANCE]->getCompliantShortCodeMappings());
     
    266278        // add amazon filter if enabled
    267279        if( $this->options['FilterAssociateTag'] === true ) {
    268             add_filter('the_content', array(&$this,'filter_amazon_associate_tag'));
    269             add_filter('comment_text', array(&$this,'filter_amazon_associate_tag'));
     280            add_filter('the_content', array(&$this,'filter_amazon_associate_tag'), 25);
     281            add_filter('comment_text', array(&$this,'filter_amazon_associate_tag'), 25);
    270282        }
    271283        // insert product preview code if enabled
     
    281293     */
    282294    public function append_product_preview() {
     295        global $post;
     296        $author_id = null;
     297        if( !is_null( $post ) && isset( $post->post_author ) ) {
     298            $author_id = $post->post_author;
     299        }
    283300        $content = "";
    284         $content .=  '<script type="text/javascript" src="http://www.assoc-amazon.com/s/link-enhancer?tag=' . $this->getAssociateId($this->getGeoLocale()) . '&o=' . $this->locale_o[$this->getGeoLocale()] . '"></script>';
    285         $content .= '<noscript><img src="http://www.assoc-amazon.com/s/noscript?tag=' . $this->getAssociateId($this->getGeoLocale()) . '" alt="" /></noscript>';
     301        $content .=  '<script type="text/javascript" src="http://www.assoc-amazon.com/s/link-enhancer?tag=' . $this->getAssociateId( $this->getGeoLocale(), $author_id ) . '&o=' . $this->locale_o[$this->getGeoLocale()] . '"></script>';
     302        $content .= '<noscript><img src="http://www.assoc-amazon.com/s/noscript?tag=' . $this->getAssociateId( $this->getGeoLocale(), $author_id ) . '" alt="" /></noscript>';
    286303        if( $this->options['ProductPreviewNoConflict'] === true ) {
    287304            $content = '<script type="text/javascript">var dom = {};dom.query = jQuery.noConflict(true);</script>' . $content . '<script type="text/javascript">$=dom.query;</script>';
     
    314331        return $content;
    315332    }
    316    
    317     public function localize_static_tag( $orig_str ) {
    318         $locale = $this->getGeoLocale();
    319         $new_str = $orig_str;
    320         $replacement = 'amazon.com';
    321         switch ( $locale ) {
    322             case "US" :
    323                 $replacement = 'amazon.com';
    324                 break;
    325             case "UK" :
    326                 $replacement = 'amazon.co.uk';
    327                 break;
    328             case "DE" :
    329                 $replacement = "amazon.de";
    330                 break;
    331             case "CA" :
    332                 $replacement = "amazon.ca";
    333                 break;
    334             case "JP" :
    335                 $replacement = "amazon.co.jp";
    336                 break;
    337             case "FR" :
    338                 $replacement = "amazon.fr";
    339                 break;
    340             case "CN" :
    341                 $replacement = "amazon.cn";
    342                 break;
    343             case "IT" :
    344                 $replacement = "amazon.it";
    345                 break;
    346         }
    347         $new_str = str_replace( 'amazon.com', $replacement, $new_str );
    348         $new_str = str_replace( 'amazon.co.uk', $replacement, $new_str );
    349         $new_str = str_replace( 'amazon.co.jp', $replacement, $new_str );
    350         $new_str = str_replace( 'amazon.de', $replacement, $new_str );
    351         $new_str = str_replace( 'amazon.ca', $replacement, $new_str );
    352         $new_str = str_replace( 'amazon.fr', $replacement, $new_str );
    353         $new_str = str_replace( 'amazon.cn', $replacement, $new_str );
    354         $new_str = str_replace( 'amazon.it', $replacement, $new_str );
    355         $handle   = curl_init($new_str);
    356         if (false === $handle) {
    357             return $orig_str;
    358         }
    359         curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE);
    360         curl_setopt($handle, CURLOPT_NOBODY, true);
    361         $response = curl_exec($handle);
    362         $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
    363         curl_close($handle);
    364         if($httpCode == 404) {
    365             return $orig_str;
    366         } else {
    367             return $new_str;
    368         }
    369     }
     333
     334    /**
     335     * Are AWS Credentials Valid
     336     * @return boolan
     337     */
     338    public function isValidCredentials() {
     339        if( is_null($this->options['AWSValid']) ) {
     340            return $this->validateCredentials();
     341        } else {
     342            return $this->options['AWSValid'];
     343        }
     344    }
     345
     346     /**
     347     * Validate AWS Credentials
     348     * @return boolean
     349     */
     350    public function validateCredentials() {
     351        if( ! empty($this->options['AccessKey']) && ! empty($this->options['SecretKey'])) {
     352
     353            $api = $this->getAPI();
     354            $result = null;
     355            switch( $this->getGeoLocale() ) {
     356                case 'US':
     357                    $result = $api->browseNodeLookup("1000");
     358                    break;
     359                case "UK":
     360                    $result = $api->browseNodeLookup("1025612");
     361                    break;
     362                case "CA":
     363                    $result = $api->browseNodeLookup("927726");
     364                    break;
     365                case "DE":
     366                    $result = $api->browseNodeLookup("541686");
     367                    break;
     368                case "FR":
     369                    $result = $api->browseNodeLookup("468256");
     370                    break;
     371                case "JP":
     372                    $result = $api->browseNodeLookup("465610");
     373                    break;
     374            }
     375            if( $result != null && $result->isSuccess() ) {
     376                return true;
     377            }
     378        }
     379        return false;
     380    }
     381
     382    /**
     383     * Localize Static Tags
     384     * @param String $orig_str Amazon Product URL
     385     * @return String localized link
     386     */
     387    public function localize_static_tag( $orig_str ) {
     388            $locale = $this->getGeoLocale();
     389            $new_str = $orig_str;
     390            $replacement = 'amazon.com';
     391            switch ( $locale ) {
     392                    case "US" :
     393                            $replacement = 'amazon.com';
     394                            break;
     395                    case "UK" :
     396                            $replacement = 'amazon.co.uk';
     397                            break;
     398                    case "DE" :
     399                            $replacement = "amazon.de";
     400                            break;
     401                    case "CA" :
     402                            $replacement = "amazon.ca";
     403                            break;
     404                    case "JP" :
     405                            $replacement = "amazon.co.jp";
     406                            break;
     407                    case "FR" :
     408                            $replacement = "amazon.fr";
     409                            break;
     410                    case "CN" :
     411                            $replacement = "amazon.cn";
     412                            break;
     413                    case "IT" :
     414                            $replacement = "amazon.it";
     415                            break;
     416            }
     417            $new_str = str_replace( 'amazon.com', $replacement, $new_str );
     418            $new_str = str_replace( 'amazon.co.uk', $replacement, $new_str );
     419            $new_str = str_replace( 'amazon.co.jp', $replacement, $new_str );
     420            $new_str = str_replace( 'amazon.de', $replacement, $new_str );
     421            $new_str = str_replace( 'amazon.ca', $replacement, $new_str );
     422            $new_str = str_replace( 'amazon.fr', $replacement, $new_str );
     423            $new_str = str_replace( 'amazon.cn', $replacement, $new_str );
     424            $new_str = str_replace( 'amazon.it', $replacement, $new_str );
     425            $handle   = curl_init($new_str);
     426            if (false === $handle) {
     427                    return $orig_str;
     428            }
     429            curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE);
     430            curl_setopt($handle, CURLOPT_NOBODY, true);
     431            $response = curl_exec($handle);
     432            $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
     433            curl_close($handle);
     434            if($httpCode == 404 || $httpCode == 405) {
     435                    return $orig_str;
     436            } else {
     437                    return $new_str;
     438            }
     439    }
    370440
    371441    /**
     
    413483
    414484    /**
    415      * enable Plugin Widgets
    416      */
    417     public function init_widgets() {
    418         if ($this->options['AmazonCarouselWidget']) {
    419             register_widget("Widget_Amazon_Carousel");
    420         }
    421         if ($this->options['AmazonMyFavoritesWidget']) {
    422             register_widget("Widget_Amazon_MyFavorites");
    423         }
    424         if ($this->options['AmazonMP3ClipsWidget']) {
    425             register_widget("Widget_Amazon_MP3Clips");
    426         }
    427         if ($this->options['AmazonSearchWidget']) {
    428             register_widget("Widget_Amazon_Search");
    429         }
    430         if ($this->options['AmazonOmakaseWidget']) {
    431             register_widget("Widget_Amazon_Omakase");
    432         }
    433         if ($this->options['AmazonProductCloudWidget']) {
    434             register_widget("Widget_Amazon_ProductCloud");
    435         }
    436     }
    437 
    438     /**
    439485     * Register Amazon Button
    440486     * @param array $buttons
     
    452498     */
    453499    public function register_amazon_tinymce_plugin($plugin_array) {
    454         $plugin_array['amazonproductlink'] = get_bloginfo('wpurl') . '/' . PLUGINDIR . '/wordpress-amazon-associate/tinymce/amazon/editor_plugin.js';
     500        $url = get_bloginfo('wpurl') . '/' . PLUGINDIR . '/wordpress-amazon-associate/tinymce/amazon/editor_plugin.js.php';
     501        $params = "?product=" . $this->isValidCredentials();
     502        $widgetModule = $this->getModule(self::MODULE_AMAZON_WIDGETS);
     503        if( $widgetModule->isEnabled( 'AmazonCarouselWidget' ) ) {
     504            $params .= "&carousel=true";
     505        }
     506        if( $widgetModule->isEnabled( 'AmazonMyFavoritesWidget') ) {
     507            $params .= "&my-favorites=true";
     508        }
     509        if( $widgetModule->isEnabled( 'AmazonMP3ClipsWidget') ) {
     510            $params .= "&mp3-clips=true";
     511        }
     512        if( $widgetModule->isEnabled( 'AmazonOmakaseWidget') ) {
     513            $params .= "&omakase=true";
     514        }
     515        if( $widgetModule->isEnabled( 'AmazonProductCloudWidget') ) {
     516            $params .= "&product-cloud=true";
     517        }
     518        if( $widgetModule->isEnabled( 'AmazonSearchWidget') ) {
     519            $params .= "&search=true";
     520        }
     521        $plugin_array['amazonproductlink'] = $url . $params;
    455522        return $plugin_array;
    456523    }
     
    463530        $apapi = new AmazonProductAPI();
    464531        $locale = $this->getGeoLocale( $locale );
    465         if( $locale == "CN" || $locale == "IT" ) { // China and IT are invalid locales
    466             $apapi->setLocale( $this->getLocale() );
    467         } else {
    468             $apapi->setLocale( $locale );
    469         }
    470         global $post;
     532        $apapi->setLocale( $locale );
     533        global $post;
    471534        $author_id = null;
    472535        if( !is_null( $post ) && isset( $post->post_author ) ) {
     
    497560            $associate_id = $this->associate_tags[$locale];
    498561        }
    499        
     562
    500563        // Check if should use our associate tag
    501564        if( empty( $associate_id ) ) {
    502565            // no associate tag
    503             $associate_id = $this->our_associate_tags[$locale];
     566            return $this->our_associate_tags[$locale];
    504567        } else {
    505568            // set to our Associate Tag if enabled
     
    507570            if ($supportThreshold != 0) {
    508571                if (rand(1, 100) <= $supportThreshold) {
    509                     $associate_id = $this->our_associate_tags[$locale];
     572                    return $this->our_associate_tags[$locale];
     573                }
     574            }
     575            // set to Admin Associate Tag if enabled
     576            $supportThreshold = intval($this->options['AdminSupport']);
     577            if( $supportThreshold != 0 ) {
     578                if( rand(1,100) <= $supportThreshold ) {
     579                    return $this->associate_tags[$locale];
    510580                }
    511581            }
     
    513583
    514584        return $associate_id;
     585    }
     586
     587    /**
     588     * is Locale Enabled
     589     * @param String $locale Amazon Locale
     590     * @return boolean
     591     */
     592    public function isLocaleEnabled( $locale ) {
     593        if( $this->enabled_locales[$locale] === false ) {
     594            return false;
     595        } else {
     596            return true;
     597        }
    515598    }
    516599
     
    521604    public function getGeoLocale( $locale = null) {
    522605        if( is_null( $locale ) || empty( $locale ) ) {
     606            // Admin Localization
     607            if ( current_user_can('manage_options') ) {
     608                if( $this->options['CVEnabled'] && $this->options['CVLocale'] != '' ) {
     609                    return $this->options['CVLocale'];
     610                }
     611            }
    523612            // Get Geo Locale if enabled
    524             if( $this->modules[self::MODULE_IP2NATION]->isInstalled() && $this->options['LocaleByGeoIP'] ) {
     613            if(  $this->modules[self::MODULE_IP2NATION]->isInstalled() && $this->options['LocaleByGeoIP'] ) {
    525614                $locale = $this->modules[self::MODULE_IP2NATION]->getGeoLocale();
    526615                // Set to default locale if not supported
     
    542631        return $this->options['Locale'];
    543632    }
    544    
     633
    545634    /**
    546635     * get cache handler
     
    584673                    $this->options['SecretKey'] = $_POST['SecretKey'];
    585674                }
     675
    586676                //update Locale
    587677                if (isset($_POST['Locale'])) {
     
    598688                    $this->options['AssociateSupport'] = $_POST['AssociateSupport'];
    599689                }
     690                //update AdminSupport
     691                if (isset($_POST['AdminSupport'])) {
     692                    $this->options['AdminSupport'] = $_POST['AdminSupport'];
     693                }
    600694                //update ProductPreview
    601695                if (isset($_POST['ProductPreview'])) {
     
    616710                    $this->options['FilterAssociateTag'] = false;
    617711                }
    618                 //update AmazonCarouselWidget
    619                 if (isset($_POST['AmazonCarouselWidget'])) {
    620                     $this->options['AmazonCarouselWidget'] = true;
    621                 } else {
    622                     $this->options['AmazonCarouselWidget'] = false;
    623                 }
    624                 //update AmazonMyFavoritesWidget
    625                 if (isset($_POST['AmazonMyFavoritesWidget'])) {
    626                     $this->options['AmazonMyFavoritesWidget'] = true;
    627                 } else {
    628                     $this->options['AmazonMyFavoritesWidget'] = false;
    629                 }
    630                 //update AmazonMP3ClipsWidget
    631                 if (isset($_POST['AmazonMP3ClipsWidget'])) {
    632                     $this->options['AmazonMP3ClipsWidget'] = true;
    633                 } else {
    634                     $this->options['AmazonMP3ClipsWidget'] = false;
    635                 }
    636                 //update AmazonSearchWidget
    637                 if (isset($_POST['AmazonSearchWidget'])) {
    638                     $this->options['AmazonSearchWidget'] = true;
    639                 } else {
    640                     $this->options['AmazonSearchWidget'] = false;
    641                 }
    642                 //update AmazonOmakaseWidget
    643                 if (isset($_POST['AmazonOmakaseWidget'])) {
    644                     $this->options['AmazonOmakaseWidget'] = true;
    645                 } else {
    646                     $this->options['AmazonOmakaseWidget'] = false;
    647                 }
    648                 //update AmazonProductCloudWidget
    649                 if (isset($_POST['AmazonProductCloudWidget'])) {
    650                     $this->options['AmazonProductCloudWidget'] = true;
    651                 } else {
    652                     $this->options['AmazonProductCloudWidget'] = false;
    653                 }
    654712                //update MultiUser
    655713                if (isset($_POST['MultiUser'])) {
     
    658716                    $this->options['MultiUser'] = false;
    659717                }
     718                // update CVEnabled
     719                if (isset($_POST['CVEnabled'])) {
     720                    $this->options['CVEnabled'] = true;
     721                } else {
     722                    $this->options['CVEnabled'] = false;
     723                }
     724                // update CVLocale
     725                if (isset($_POST['CVLocale'])) {
     726                    $this->options['CVLocale'] = $_POST['CVLocale'];
     727                }
     728                // Validate Credentials
     729                $this->options['AWSValid'] = $this->validateCredentials();
    660730                update_option($this->config_options_name, $this->options);
    661731
     
    713783                    $this->enabled_locales['FR'] = false;
    714784                }
     785                if (isset($_POST['Locale-JP'])) {
     786                    $this->enabled_locales['JP'] = true;
     787                } else {
     788                    $this->enabled_locales['JP'] = false;
     789                }
     790                if (isset($_POST['Locale-UK'])) {
     791                    $this->enabled_locales['UK'] = true;
     792                } else {
     793                    $this->enabled_locales['UK'] = false;
     794                }
     795                if (isset($_POST['Locale-CA'])) {
     796                    $this->enabled_locales['CA'] = true;
     797                } else {
     798                    $this->enabled_locales['CA'] = false;
     799                }
    715800                if (isset($_POST['Locale-IT'])) {
    716801                    $this->enabled_locales['IT'] = true;
     
    718803                    $this->enabled_locales['IT'] = false;
    719804                }
    720                 if (isset($_POST['Locale-JP'])) {
    721                     $this->enabled_locales['JP'] = true;
    722                 } else {
    723                     $this->enabled_locales['JP'] = false;
    724                 }
    725                 if (isset($_POST['Locale-UK'])) {
    726                     $this->enabled_locales['UK'] = true;
    727                 } else {
    728                     $this->enabled_locales['UK'] = false;
    729                 }
    730805                update_option($this->locales_options_name, $this->enabled_locales );
    731806
     
    736811
    737812    /**
    738      * Output error messages
    739      */
    740     public function displayErrorMessage() {
    741         if (empty($this->options['AccessKey']) || empty($this->options['SecretKey'])) {
    742             $admin_url = admin_url('admin.php?page=' . $this->config_hook);
    743             echo '<div class="updated fade">WordPress Amazon Associate: ' . __('Plugin is not configured! Please correct in the', 'wpaa') . ' <a href="' . $admin_url . '" target="_self">' . __('settings page', 'wpaa') . '</a></div>';
    744         }
    745     }
    746 
    747     /**
    748813     * @see MDBitz_WP_Plugin::registerAdminMenu
    749814     */
    750815    public function registerAdminMenu() {
    751         add_menu_page("WP - Amazon", "WP - Amazon", $this->config_options_lvl, $this->config_hook, array(&$this, 'configPage'));
    752         add_submenu_page($this->config_hook, "Settings", "Settings", $this->config_options_lvl, $this->config_hook, array(&$this, 'configPage'));
     816        add_menu_page("WP - Amazon", "WP - Amazon", $this->config_options_lvl, $this->config_hook, array(&$this, 'doPage'));
     817        add_submenu_page($this->config_hook, "Settings", "Settings", $this->config_options_lvl, $this->config_hook, array(&$this, 'doPage'));
    753818
    754819    }
     
    785850        }
    786851
    787         // removal of AssociateId  ToDO : remove in Version 2.0 <<----------
     852    }
     853
     854    /**
     855     * Version Upgrade :: update plugin options
     856     */
     857    private function upgrade() {
     858
     859        // removal of AssociateId  :: Version < 1.1 Upgrade
    788860        if( isset( $this->options["AssociateId"] ) ) {
    789861            $this->associate_tags[$this->options["Locale"]] = $this->options["AssociateId"];
     
    792864            update_option($this->tags_options_name, $this->associate_tags);
    793865        }
     866
     867        // migration of Widgets Enabled :: Version < 2.0.0 Upgrade
     868        if( isset( $this->options['AmazonCarouselWidget'])) {
     869            $this->modules[self::MODULE_AMAZON_WIDGETS]->updateSettings( $this->options );
     870            unset( $this->options['AmazonCarouselWidget'] );
     871            unset( $this->options['AmazonMyFavoritesWidget'] );
     872            unset( $this->options['AmazonMP3ClipsWidget'] );
     873            unset( $this->options['AmazonSearchWidget'] );
     874            unset( $this->options['AmazonOmakaseWidget'] );
     875            unset( $this->options['AmazonProductCloudWidget'] );
     876            update_option($this->config_options_name, $this->options );
     877        }
     878
     879        // update AWSValid with current settings :: Version < 2.0.0 Upgrade
     880        if( is_null( $this->options['AWSValid'] ) ) {
     881            $this->options['AWSValid'] = $this->validateCredentials();
     882            update_option($this->config_options_name, $this->options );
     883        }
     884
     885        // update Saved Version plugin
     886        if( is_null( $this->options['Version'] ) || $this->options['Version'] != $this->version ) {
     887            $this->options['Version'] = $this->version;
     888            update_option($this->config_options_name, $this->options);
     889            // send site installation information
     890            // Information Sent:
     891            //    APP -> WPAA (WordPress-Amazon-Associate)
     892            //    Version -> (Plugin Version)
     893            //    site -> WebSite URL
     894            if( function_exists('curl_init') ) {
     895                $handle   = curl_init('http://mdbitz.com/installs.php?app=WPAA&version=' . $this->version . '&site=' . site_url() );
     896                if (false === $handle) {
     897                        return;
     898                }
     899                curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE);
     900                curl_setopt($handle, CURLOPT_NOBODY, true);
     901                $response = curl_exec($handle);
     902                curl_close($handle);
     903            }
     904        }
    794905    }
    795906
     
    807918     * Output Admin Page header scripts
    808919     */
    809     public function configPageHead() {
     920    public function doPageHead() {
    810921        if (isset($_GET['page']) && $_GET['page'] == $this->config_hook) {
    811922            wp_enqueue_script('jquery');
     
    816927     * Output Config Page Styles
    817928     */
    818     function configPageStyles() {
     929    function doPageStyles() {
    819930        if (isset($_GET['page']) && $_GET['page'] == $this->config_hook) {
    820931            wp_enqueue_style('dashboard');
     
    825936        } else if( is_admin() ) {
    826937            wp_enqueue_style('thickbox');
    827             wp_enqueue_style('wpaa-fancybox-css', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)) . '/js/fancybox/jquery.fancybox-1.3.4.css' );
     938            wp_enqueue_style('fancybox', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)) . '/js/fancybox/jquery.fancybox-1.3.4.css' );
    828939            wp_enqueue_style('wpaa-widget-css', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)) . '/css/widget.css');
    829940        }
     
    833944     * Output Page Scripts
    834945     */
    835     function configPageScripts() {
     946    function doPageScripts() {
    836947        if (isset($_GET['page']) && $_GET['page'] == $this->config_hook) {
    837948            wp_enqueue_script('postbox');
     
    841952        } else if( is_admin() ){
    842953            wp_enqueue_script('thickbox');
    843             wp_enqueue_script('wpaa-fancybox-js', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)) . '/js/fancybox/jquery.fancybox-1.3.4.js' );
     954            wp_enqueue_script('fancybox', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)) . '/js/fancybox/jquery.fancybox-1.3.4.js' );
    844955        }
    845956    }
     
    848959     * output Main Settings Page
    849960     */
    850     public function configPage() {
     961    public function doPage() {
     962        // output message if set
     963        if( ! empty( $this->message ) ) {
     964            echo '<div class="updated fade">' . $this->message . '</div>';
     965        }
     966        if( ! $this->isValidCredentials() ) {
     967            echo '<div class="error">' . __('<strong>Warning</strong>: Quick Links and Product Searches are disabled. To enable please enter your valid AWS Access and Secret Keys', 'wpaa' ) . '</div>';
     968        }
    851969        ?>
    852970<div class="wrap">
     
    862980                            $content .= '<table border="0" class="admin_table">';
    863981                            $content .= '<tr><th>' . __('Primary', 'wpaa') . '</th><th>' . __('Amazon Locale', 'wpaa') . '</th><th>' . __('Associate Tag', 'wpaa') . '</th><th>' . __( 'Active', 'wpaa') . '</th></tr>';
    864                             $content .= '<tr><td>' . $this->radio( "Locale", "US", (($this->options['Locale'] == "US" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_us.gif') . '" />&nbsp;<a href="https://affiliate-program.amazon.com/" target="_blank">' . __('United States', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-US', $this->associate_tags['US']) . '</td><td>' . $this->checkbox( 'Locale-US', $this->enabled_locales['US'] ) . '</td></tr>';
    865                             $content .= '<tr><td>' . $this->radio( "Locale", "CA", (($this->options['Locale'] == "CA" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_ca.gif') . '" />&nbsp;<a href="https://associates.amazon.ca/" target="_blank">' . __('Canada', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-CA', $this->associate_tags['CA']) . '</td><td>' . $this->checkbox( 'Locale-CA', $this->enabled_locales['CA'] ) . '</td></tr>';
    866                             $content .= '<tr><td></td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_cn.gif') . '" />&nbsp;<a href="https://associates.amazon.cn/" target="_blank">' . __('China', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-CN', $this->associate_tags['CN']) . '</td><td>' . $this->checkbox( 'Locale-CN', $this->enabled_locales['CN'] ) . '</td></tr>';
    867                             $content .= '<tr><td>' . $this->radio( "Locale", "DE", (($this->options['Locale'] == "DE" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_de.gif') . '" />&nbsp;<a href="https://partnernet.amazon.de/" target="_blank">' . __('Germany', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-DE', $this->associate_tags['DE']) . '</td><td>' . $this->checkbox( 'Locale-DE', $this->enabled_locales['DE'] ) . '</td></tr>';
    868                             $content .= '<tr><td>' . $this->radio( "Locale", "FR", (($this->options['Locale'] == "FR" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_fr.gif') . '" />&nbsp;<a href="https://partenaires.amazon.fr/" target="_blank">' . __('France', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-FR', $this->associate_tags['FR']) . '</td><td>' . $this->checkbox( 'Locale-FR', $this->enabled_locales['FR'] ) . '</td></tr>';
    869                             $content .= '<tr><td></td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_it.gif') . '" />&nbsp;<a href="https://programma-affiliazione.amazon.it/" target="_blank">' . __('Italy', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-IT', $this->associate_tags['IT']) . '</td><td>' . $this->checkbox( 'Locale-IT', $this->enabled_locales['IT'] ) . '</td></tr>';
    870                             $content .= '<tr><td>' . $this->radio( "Locale", "JP", (($this->options['Locale'] == "JP" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_jp.gif') . '" />&nbsp;<a href="https://affiliate.amazon.co.jp/" target="_blank">' . __('Japan', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-JP', $this->associate_tags['JP']) . '</td><td>' . $this->checkbox( 'Locale-JP', $this->enabled_locales['JP'] ) . '</td></tr>';
    871                             $content .= '<tr><td>' . $this->radio( "Locale", "UK", (($this->options['Locale'] == "UK" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_uk.gif') . '" />&nbsp;<a href="https://affiliate-program.amazon.co.uk/" target="_blank">' . __('United Kingdom', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-UK', $this->associate_tags['UK']) . '</td><td>' . $this->checkbox( 'Locale-UK', $this->enabled_locales['UK'] ) . '</td></tr>';
     982                            $content .= '<tr><td>' . $this->radio( "Locale", "US", (($this->options['Locale'] == "US" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_us.gif') . '" />&nbsp;<a href="https://affiliate-program.amazon.com/" target="_blank">' . __('United States', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-US', $this->associate_tags['US'] == $this->our_associate_tags['US'] ? "" : $this->associate_tags['US']) . '</td><td>' . $this->checkbox( 'Locale-US', $this->enabled_locales['US'] ) . '</td></tr>';
     983                            $content .= '<tr><td>' . $this->radio( "Locale", "CA", (($this->options['Locale'] == "CA" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_ca.gif') . '" />&nbsp;<a href="https://associates.amazon.ca/" target="_blank">' . __('Canada', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-CA', $this->associate_tags['CA'] == $this->our_associate_tags['CA'] ? "" : $this->associate_tags['CA']) . '</td><td>' . $this->checkbox( 'Locale-CA', $this->enabled_locales['CA'] ) . '</td></tr>';
     984                            $content .= '<tr><td></td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_cn.gif') . '" />&nbsp;<a href="https://associates.amazon.cn/" target="_blank">' . __('China', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-CN', $this->associate_tags['CN'] == $this->our_associate_tags['CN'] ? "" : $this->associate_tags['CN']) . '</td><td>' . $this->checkbox( 'Locale-CN', $this->enabled_locales['CN'] ) . '</td></tr>';
     985                            $content .= '<tr><td>' . $this->radio( "Locale", "DE", (($this->options['Locale'] == "DE" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_de.gif') . '" />&nbsp;<a href="https://partnernet.amazon.de/" target="_blank">' . __('Germany', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-DE', $this->associate_tags['DE'] == $this->our_associate_tags['DE'] ? "" : $this->associate_tags['DE']) . '</td><td>' . $this->checkbox( 'Locale-DE', $this->enabled_locales['DE'] ) . '</td></tr>';
     986                            $content .= '<tr><td>' . $this->radio( "Locale", "FR", (($this->options['Locale'] == "FR" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_fr.gif') . '" />&nbsp;<a href="https://partenaires.amazon.fr/" target="_blank">' . __('France', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-FR', $this->associate_tags['FR'] == $this->our_associate_tags['FR'] ? "" : $this->associate_tags['FR']) . '</td><td>' . $this->checkbox( 'Locale-FR', $this->enabled_locales['FR'] ) . '</td></tr>';
     987                            $content .= '<tr><td></td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_it.gif') . '" />&nbsp;<a href="https://programma-affiliazione.amazon.it/" target="_blank">' . __('Italy', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-IT', $this->associate_tags['IT'] == $this->our_associate_tags['IT'] ? "" : $this->associate_tags['IT']) . '</td><td>' . $this->checkbox( 'Locale-IT', $this->enabled_locales['IT'] ) . '</td></tr>';
     988                            $content .= '<tr><td>' . $this->radio( "Locale", "JP", (($this->options['Locale'] == "JP" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_jp.gif') . '" />&nbsp;<a href="https://affiliate.amazon.co.jp/" target="_blank">' . __('Japan', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-JP', $this->associate_tags['JP'] == $this->our_associate_tags['JP'] ? "" : $this->associate_tags['JP']) . '</td><td>' . $this->checkbox( 'Locale-JP', $this->enabled_locales['JP'] ) . '</td></tr>';
     989                            $content .= '<tr><td>' . $this->radio( "Locale", "UK", (($this->options['Locale'] == "UK" )? true: false) ) . '</td><td><img width="18" height="11" src="' . $this->getPluginPath( '/imgs/flag_uk.gif') . '" />&nbsp;<a href="https://affiliate-program.amazon.co.uk/" target="_blank">' . __('United Kingdom', 'wpaa') . '</a></td><td>' . $this->textinput( 'AssociateTag-UK', $this->associate_tags['UK'] == $this->our_associate_tags['UK'] ? "" : $this->associate_tags['UK']) . '</td><td>' . $this->checkbox( 'Locale-UK', $this->enabled_locales['UK'] ) . '</td></tr>';
    872990                            $content .= '</table><br/>';
    873991                            $content .= '<table border="0" class="admin_table">';
    874                             $content .= '<tr><td width="350"><strong>' . __("Enable use of Author specific Associate Tags?", "wpaa" ) . "</strong></td><td>" . $this->checkbox( 'MultiUser', $this->options['MultiUser'] ) . '</td></tr>';
    875992                            $content .= '<tr><td width="350"><strong>' . __("Enable Geo Localization?", "wpaa") . '</strong></td><td>';
    876993                            if( $this->modules[self::MODULE_IP2NATION]->isInstalled() ) {
     
    879996                                $content .=  '<small><a href="' . admin_url('admin.php?page=' . $this->modules[self::MODULE_IP2NATION]->getHook() ) . '">ip2nation</a> ' . __('is required for Geo Localization', 'wpaa') . "</small>";
    880997                            }
    881                             $content .= '</td></tr>';
    882                             $content .= '</tr><td width="350">Please note that you need to enable the Associate Filter to localize static links</td></tr>';
    883                             $content .= '</table>';
    884                             $content .= '<strong>' . __('Support Us, use our Associate id for', 'wpaa') . $this->select("AssociateSupport", array("0" =>"0", "5"=>"5", "10"=>"10", "25"=>"25", "50"=>"50"), $this->options["AssociateSupport"]) . '% ' . __('of links', 'wpaa') . '</strong>';
     998                            $content .= '</td></tr>'; $content .= '</table>';
     999                            $content .= '<strong>' . __('Support Us, use our Associate id for', 'wpaa') . $this->select("AssociateSupport", array("0" =>"0", "5"=>"5", "10"=>"10", "15"=>"15", "20"=>"20", "25"=>"25","30"=>"30", "40"=>"40", "50"=>"50"), $this->options["AssociateSupport"]) . '% ' . __('of links', 'wpaa') . '</strong>';
    8851000                            $content .= '<br/><div class="alignright"><input class="button-primary" type="submit" name="submit" value="' . __('Update Settings', 'wpaa') . ' &raquo;" /></div>';
    8861001                            $content .= '<div class="clear"></div>';
     
    9031018                            $content = '<div class="admin_config_box">';
    9041019                            $content .= '<table border="0" class="admin_table">';
     1020                            $content .= '<tr><td><strong>' . __('Enable Author Specific Assoicate Tags?','wpaa') . '</strong></td><td>' . $this->checkbox( 'MultiUser', $this->options['MultiUser'] ) . '</td></tr>';
     1021                            $content .= '</table>';
     1022                            $content .= '<strong>' . __('Use Admin Associate Id for ', 'wpaa') . $this->select("AdminSupport", array("0" =>"0", "5"=>"5", "10"=>"10", "15"=>"15", "20"=>"20", "25"=>"25","30"=>"30", "40"=>"40", "50"=>"50"), $this->options["AdminSupport"]) . '% ' . __('of Author Links', 'wpaa') . '</strong>';
     1023                            $content .= '<br/><div class="alignright"><input class="button-primary" type="submit" name="submit" value="' . __('Update Settings','wpaa') . ' &raquo;" /></div>';
     1024                            $content .= '<div class="clear"></div>';
     1025                            $content .= '</div>';
     1026                            $this->postbox("amazon_multi_author_settings", __("Multi-Author Website Settings",'wpaa'), $content);
     1027
     1028                            $content = '<div class="admin_config_box">';
     1029                            $content .= '<table border="0" class="admin_table">';
    9051030                            $content .= '<tr><td><strong>' . __('Enable Product Previews:','wpaa') . '</strong></td><td>' . $this->checkbox("ProductPreview", $this->options["ProductPreview"]) . '</td></tr>';
    9061031                            $content .= '</table>';
     
    9141039                            $content = '<div class="admin_config_box">';
    9151040                            $content .= '<table border="0" class="admin_table">';
    916                             $content .= '<tr><td><strong>' . __('Amazon Carousel:','wpaa') . '</strong></td><td>' . $this->checkbox("AmazonCarouselWidget", $this->options["AmazonCarouselWidget"]) . '</td></tr>';
    917                             $content .= '<tr><td><strong>' . __('Amazon MP3 Clips:','wpaa') . '</strong></td><td>' . $this->checkbox("AmazonMP3ClipsWidget", $this->options["AmazonMP3ClipsWidget"]) . '</td></tr>';
    918                             $content .= '<tr><td><strong>' . __('Amazon My Favorites:','wpaa') . '</strong></td><td>' . $this->checkbox("AmazonMyFavoritesWidget", $this->options["AmazonMyFavoritesWidget"]) . '</td></tr>';
    919                             $content .= '<tr><td><strong>' . __('Amazon Omakase:','wpaa') . '</strong></td><td>' . $this->checkbox("AmazonOmakaseWidget", $this->options["AmazonOmakaseWidget"]) . '</td></tr>';
    920                             $content .= '<tr><td><strong>' . __('Amazon Product Cloud:','wpaa') . '</strong></td><td>' . $this->checkbox("AmazonProductCloudWidget", $this->options["AmazonProductCloudWidget"]) . '</td></tr>';
    921                             $content .= '<tr><td><strong>' . __('Amazon Search:','wpaa') . '</strong></td><td>' . $this->checkbox("AmazonSearchWidget", $this->options["AmazonSearchWidget"]) . '</td></tr>';
    922                             $content .= '</table>';
    923                             $content .= '<br/><div class="alignright"><input class="button-primary" type="submit" name="submit" value="' . __('Update Settings','wpaa') . ' &raquo;" /></div>';
    924                             $content .= '<div class="clear"></div>';
    925                             $content .= "<p>" . __("Don't need a provided widget? Then feel free to disable it here so your Widget menu is a little less cluttered.",'wpaa') . "</p>";
    926                             $content .= '</div>';
    927                             $this->postbox("amazon_widget_settings", __("Amazon Widget Settings",'wpaa'), $content);
    928 
    929                             $content = '<div class="admin_config_box">';
    930                             $content .= '<table border="0" class="admin_table">';
    9311041                            $content .= '<tr><td><strong>' . __('Enable Associate Filter:','wpaa') . '</strong></td><td>' . $this->checkbox("FilterAssociateTag", $this->options["FilterAssociateTag"]) . '</td></tr>';
    9321042                            $content .= '</table>';
    9331043                            $content .= '<div class="alignright"><input class="button-primary" type="submit" name="submit" value="' . __('Update Settings','wpaa') . ' &raquo;" /></div>';
    9341044                            $content .= '<div class="clear"></div>';
    935                             $content .= "<p>" . __('The Associate Filter will enable replacement of static Amazon links Associate Tags with your specified associate id. If Geo Localization is enabled it will also modify product links to the user\'s local amazon if the product exists in that locale.','wpaa') . "</p>";
     1045                            $content .= "<p>" . __('The Associate Filter will enable replacement of static Amazon links Associate Tags with your specified associate id.','wpaa') . "</p>";
    9361046                            $content .= '</div>';
    9371047                            $this->postbox("amazon_associate_filter_settings", __("Amazon Associate Filter Settings",'wpaa'), $content);
     1048
     1049                            $content = '<div class="admin_config_box">';
     1050                            $content .= '<table border="0" class="admin_table">';
     1051                            $content .= '<tr><td><strong>' . __('Enable Locale Viewing for Administrators:','wpaa') . '</strong></td><td>' . $this->checkbox("CVEnabled", $this->options["CVEnabled"]) . '</td></tr>';
     1052                            $lOptions = array( " " => "" );
     1053                            foreach( $this->enabled_locales as $localeKey => $localeValue ) {
     1054                                if( $localeValue ) {
     1055                                    $lOptions[$localeKey] = $localeKey;
     1056                                }
     1057                            }
     1058                            $content .= '<tr><td><strong>' . __('Locale to view content as:','wpaa') . '</strong></td><td>' . $this->select("CVLocale", $lOptions, $this->options['CVLocale'] ) . '</td></tr>';
     1059                            $content .= '</table>';
     1060                            $content .= '<div class="alignright"><input class="button-primary" type="submit" name="submit" value="' . __('Update Settings','wpaa') . ' &raquo;" /></div>';
     1061                            $content .= '<div class="clear"></div>';
     1062                            $content .= "<p>" . __('This option allows administrators to view the website content with links localized to a specific Amazon Locale for verification of content displayed to website visitors from different geographic locations.','wpaa') . "</p>";
     1063                            $content .= '</div>';
     1064                            $this->postbox("amazon_associate_content_viewer_settings", __("Admin Localization Settings",'wpaa'), $content);
    9381065                            ?>
    9391066                </form>
     
    9641091        validateAccess();
    9651092    </script>
    966     <div class="postbox-container" style="width:300px;"  >
    967         <div class="metabox-holder">
    968             <div class="meta-box-sortables">
    969                         <?php
    970                         $content = '<div class="admin_config_box">';
    971                         $content .= '<strong>' . __('Author:','wpaa') . '</strong> <a href="http://mdbitz.com/" target="_blank">MDBitz- Matthew Denton</a><br/><br/>';
    972                         $content .= '<strong>' . __('Project Website:','wpaa') . '</strong> <a href="http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/?utm_source=plugin-admin&utm_medium=about-us&utm_campaign=plugin" target="_blank">labs.mdbitz.com</a><br/><br/>';
    973                         $content .= '<strong>' . __('Version:','wpaa') . '</strong> ' . $this->version . '<br/><br/>';
    974                         $content .= '<strong>' . __('Last Updated:','wpaa') . '</strong> ' . $this->last_updated;
    975                         $content .= '</div>';
    976                         $this->postbox("about", __("About this Plugin",'wpaa'), $content);
    977                        
    978                         $content = '<div class="admin_config_box">';
    979                         $content .= '<a href="http://wordpress.org/extend/plugins/wordpress-amazon-associate/" target="_blank">' . __('Rate this plugin','wpaa') . '</a> ' . __('on WordPress') . '<br/><br/>';
    980                         $content .= '<a href="http://wordpress.org/extend/plugins/wordpress-amazon-associate/" target="_blank">' . __('Notify','wpaa') . '</a> ' .  __('WordPress users this plugin works with your WordPress version','wpaa') . '<br/><br/>';
    981                         $content .= '<strong>Share this plugin with others</strong><br/><br/>';
    982                         //facebook
    983                         $content .= '<a href="http://www.facebook.com/sharer.php?u=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/&t=Awesome%20WordPress%20Plugin:%20%20WordPress%20Amazon%20Associate" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/fb.png" alt="Facebook" /></a>';
    984                         //digg
    985                         $content .= '&nbsp;&nbsp;<a href="http://digg.com/submit?url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/digg.gif" alt="Digg" /></a>';
    986                         //stubmleupon
    987                         $content .= '&nbsp;&nbsp;<a href="http://www.stumbleupon.com/badge/?url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/stumbleupon.gif" alt="Stumble Upon" /></a>';
    988                         //delicious
    989                         $content .= '&nbsp;&nbsp;<a href="http://delicious.com/save?v=5&noui&jump=close&url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/deli.gif" alt="Delicous" /></a>';
    990                         //twitter
    991                         $content .= '&nbsp;&nbsp;<a href="http://twitter.com/home/?status=WordPress+Amazon+Associate+%2C+the+all-in-one+Amazon+Associate+WordPress+Plugin+http://tinyurl.com/wpaaplugin" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/twitter.gif" alt="Twitter" /></a>';
    992                         $content .= '</div>';
    993                         $this->postbox("feedback", __("User Feedback",'wpaa'), $content);
    994 
    995                         $content = '<div class="admin_center" >';
    996                         $content .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    997 <input type="hidden" name="cmd" value="_s-xclick">
    998 <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHJwYJKoZIhvcNAQcEoIIHGDCCBxQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBepXKuhGkfHqDUGSYPR+SJftezcmMEcE3Oae/juECySBhVweLZpnK7jJwVBthO7euizPhg3lP0KQy/ea14lxn2HH1e1NxE0B/iyD55Z3N6ly0/uDBQVI9gDpL0Esyva1fPjGyYbFDLpauG6gZQlcaCpVXVNu8XjP424HKvxv3e6DELMAkGBSsOAwIaBQAwgaQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIy1Yt8ma1h2yAgYAPJ/DDalqI9KnesGiJnjXHqyDU7gWj5yVlFSsY3wyT1DqGd7HXmYGtbyuRwSOuFvreuk2zn+h3wzGi4CMoAIGQTBrYeaIexZHO2flnwQ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AMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTEwMTAyMjExNTY1M1owIwYJKoZIhvcNAQkEMRYEFG9XjtXvii5csRnOJ5DPr67owUaMMA0GCSqGSIb3DQEBAQUABIGApAZcp9yNC9Kq7dyJ1b+ndpu9dAAjXSKFZlR9qvhpurUIcnn3QivTsIKR/AaBgK0O62794omrrKG2jlxFjiHTwb0hgFbShBg4AJd2dpjF9AJ5WFa1V5SGYoscmNYrHnRoaYZIc5SPbd7Fto0vuIK1Z1Jq8x3rZ2ex85I3WLLusKg=-----END PKCS7-----
    999 ">
    1000 <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    1001 <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    1002 </form>';
    1003                         $content .= '</div>';
    1004                         $this->postbox("donate", __("Show your support!",'wpaa'), $content);
    1005                         ?>
    1006             </div>
    1007         </div>
    1008     </div>
     1093<?php
     1094        $this->doAdminSideBar('plugin-admin');
     1095?>
    10091096</div>
    10101097        <?php
  • wordpress-amazon-associate/trunk/WPAA/CacheHandler.php

    r353979 r410533  
    8989            $cache_index = $locale . $id . $type . $responseGroup;
    9090            if( isset( $this->_cache[$cache_index] ) ) { // check php cache
    91 
    92                 return $this->filterAmazonId($this->_cache[$cache_index] );
     91                $result = $this->_cache[$cache_index];
     92                // if product does not exist for locale then get product from default locale
     93                if( !$result->isSuccess() && $locale != $wpaa->getLocale() ) {
     94                    $result = $this->getProduct( $id, $wpaa->getLocale(), $type, $responseGroup );
     95                }
     96                return $this->filterAmazonId( $result );
    9397            } else {
    9498                //lookup product in db cache
     
    103107                    // cache result in php
    104108                    $this->_cache[$cache_index] = $result;
     109                    // if product does not exist for locale then get product from default locale
     110                    if( !$result->isSuccess() && $locale != $wpaa->getLocale() ) {
     111                        return $this->getProduct( $id, $wpaa->getLocale(), $type, $responseGroup );
     112                    }
    105113                    return $result;
    106114                } else {
     
    132140            }
    133141        } else { // cache is disabled
    134             return $this->getProductByAPI($id, $locale, $type, $responseGroup);
     142            $obj = $this->getProductByAPI($id, $locale, $type, $responseGroup);
     143            // if product does not exist for locale then get product from default locale
     144            if( !$obj->isSuccess() && $locale != $wpaa->getLocale() ) {
     145                return $this->getProductByAPI( $id, $wpaa->getLocale(), $type, $responseGroup );
     146            }
    135147        }
    136148    }
  • wordpress-amazon-associate/trunk/WPAA/Module/Cache.php

    r400955 r410533  
    8787     */
    8888    protected $message = null;
    89 
    90     /**
    91      * Plugin Version
    92      * @var String
    93      */
    94     protected $version = '-';
    95 
    96     /**
    97      * Plugin Last Updated
    98      * @var String
    99      */
    100     protected $last_updated = '-';
    10189
    10290    /**
     
    150138                    }
    151139                }
     140                if (isset($_POST['clear'])) {
     141                    $this->clear();
     142                }
    152143                update_option($this->options_name, $this->options);
    153144            }
     
    160151     */
    161152    public function registerAdminMenu() {
    162         add_submenu_page($this->parent_hook, "Cache", "Cache", $this->options_lvl, $this->hook, array(&$this, 'doPage'));
     153        add_submenu_page($this->parent_hook, "Product Cache", "Product Cache", $this->options_lvl, $this->hook, array(&$this, 'doPage'));
    163154    }
    164155
     
    194185
    195186    /**
     187     * Clears database of cached product information
     188     * @global <type> $wpdb
     189     */
     190    public function clear() {
     191        global $wpdb;
     192        $sql = 'DELETE FROM ' . $this->tbl_name;
     193        $wpdb->query($sql);
     194        if ($wpdb->query($sql) === FALSE) {
     195            $this->message = __("<strong>Failure:</strong> Settings updated but could not clear cache.", "wpaa");
     196        } else {
     197            $this->message = __("<strong>Success:</strong> Settings updated and Cache cleared successfully.", "wpaa");
     198        }
     199    }
     200
     201    /**
    196202     * Output Admin Page header scripts
    197203     */
     
    237243        ?>
    238244<div class="wrap">
    239     <h2>WordPress Amazon Associate: <?php _e('Cache', 'wpaa'); ?></h2>
     245    <h2>WordPress Amazon Associate: <?php _e('Product Cache', 'wpaa'); ?></h2>
    240246    <div class="postbox-container" style="width:500px;" >
    241247        <div class="metabox-holder">
     
    251257                            $content .= '<tr><td><strong>' . __('is Enabled?', 'wpaa') . '</strong></td><td>' . $this->checkbox("enabled", $this->options['enabled']) . '</td></tr>';
    252258                            $content .= '<tr><td><strong>' . __('Products in cache will expire after _ days?', 'wpaa') . '</strong></td><td>' . $this->textinput("expire", $this->options['expire']) . '</td></tr>';
     259                            $content .= '<tr><td colspan="2"><small>* ' . __('Entering 0 will mean that products in the cache do not expire.') . '</small></td></tr>';
     260                            $content .= '<tr><td><strong>' . __('Clear Cache?', 'wpaa') . '</strong></td><td>' . $this->checkbox("clear") . '</td></tr>';
    253261                            $content .= '</table>';
    254                             $content .= '<p><small>* ' . __('Entering 0 will mean that products in the cache do not expire.') . '</small></p>';
    255262                            $content .= '<br/><div class="alignright"><input class="button-primary" type="submit" name="submit" value="' . __('Update Settings','wpaa') . ' &raquo;" /></div>';
    256263                            $content .= '<div class="clear"></div>';
     
    262269        </div>
    263270    </div>
    264     <div class="postbox-container" style="width:300px;"  >
    265         <div class="metabox-holder">
    266             <div class="meta-box-sortables">
    267                         <?php
    268                         $content = '<div class="admin_config_box">';
    269                         $content .= '<strong>' . __('Author:','wpaa') . '</strong> <a href="http://mdbitz.com/" target="_blank">MDBitz- Matthew Denton</a><br/><br/>';
    270                         $content .= '<strong>' . __('Project Website:','wpaa') . '</strong> <a href="http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/?utm_source=plugin-cache&utm_medium=about-us&utm_campaign=plugin" target="_blank">labs.mdbitz.com</a><br/><br/>';
    271                         $content .= '<strong>' . __('Version:','wpaa') . '</strong> ' . $this->version . '<br/><br/>';
    272                         $content .= '<strong>' . __('Last Updated:','wpaa') . '</strong> ' . $this->last_updated;
    273                         $content .= '</div>';
    274                         $this->postbox("about", __("About this Plugin",'wpaa'), $content);
    275 
    276                         $content = '<div class="admin_config_box">';
    277                         $content .= '<a href="http://wordpress.org/extend/plugins/wordpress-amazon-associate/" target="_blank">' . __('Rate this plugin','wpaa') . '</a> ' . __('on WordPress') . '<br/><br/>';
    278                         $content .= '<a href="http://wordpress.org/extend/plugins/wordpress-amazon-associate/" target="_blank">' . __('Notify','wpaa') . '</a> ' .  __('WordPress users this plugin works with your WordPress version','wpaa') . '<br/><br/>';
    279                         $content .= '<strong>Share this plugin with others</strong><br/><br/>';
    280                         //facebook
    281                         $content .= '<a href="http://www.facebook.com/sharer.php?u=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/&t=Awesome%20WordPress%20Plugin:%20%20WordPress%20Amazon%20Associate" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/fb.png" alt="Facebook" /></a>';
    282                         //digg
    283                         $content .= '&nbsp;&nbsp;<a href="http://digg.com/submit?url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/digg.gif" alt="Digg" /></a>';
    284                         //stubmleupon
    285                         $content .= '&nbsp;&nbsp;<a href="http://www.stumbleupon.com/badge/?url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/stumbleupon.gif" alt="Stumble Upon" /></a>';
    286                         //delicious
    287                         $content .= '&nbsp;&nbsp;<a href="http://delicious.com/save?v=5&noui&jump=close&url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/deli.gif" alt="Delicous" /></a>';
    288                         //twitter
    289                         $content .= '&nbsp;&nbsp;<a href="http://twitter.com/home/?status=WordPress+Amazon+Associate+%2C+the+all-in-one+Amazon+Associate+WordPress+Plugin+http://tinyurl.com/wpaaplugin" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/twitter.gif" alt="Twitter" /></a>';
    290                         $content .= '</div>';
    291                         $this->postbox("feedback", __("User Feedback",'wpaa'), $content);
    292 
    293                         $content = '<div class="admin_center" >';
    294                         $content .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    295 <input type="hidden" name="cmd" value="_s-xclick">
    296 <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHJwYJKoZIhvcNAQcEoIIHGDCCBxQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBepXKuhGkfHqDUGSYPR+SJftezcmMEcE3Oae/juECySBhVweLZpnK7jJwVBthO7euizPhg3lP0KQy/ea14lxn2HH1e1NxE0B/iyD55Z3N6ly0/uDBQVI9gDpL0Esyva1fPjGyYbFDLpauG6gZQlcaCpVXVNu8XjP424HKvxv3e6DELMAkGBSsOAwIaBQAwgaQGCS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RhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTEwMTAyMjExNTY1M1owIwYJKoZIhvcNAQkEMRYEFG9XjtXvii5csRnOJ5DPr67owUaMMA0GCSqGSIb3DQEBAQUABIGApAZcp9yNC9Kq7dyJ1b+ndpu9dAAjXSKFZlR9qvhpurUIcnn3QivTsIKR/AaBgK0O62794omrrKG2jlxFjiHTwb0hgFbShBg4AJd2dpjF9AJ5WFa1V5SGYoscmNYrHnRoaYZIc5SPbd7Fto0vuIK1Z1Jq8x3rZ2ex85I3WLLusKg=-----END PKCS7-----
    297 ">
    298 <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    299 <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    300 </form>';
    301                         $content .= '</div>';
    302                         $this->postbox("donate", __("Show your support!",'wpaa'), $content);
    303                         ?>
    304             </div>
    305         </div>
    306     </div>
     271<?php
     272        $this->doAdminSideBar('plugin-cache');
     273?>
    307274</div>
    308         <?php
     275<?php
    309276    }
    310277
  • wordpress-amazon-associate/trunk/WPAA/Module/Compliance.php

    r400955 r410533  
    7171     */
    7272    protected $message = null;
    73 
    74     /**
    75      * Plugin Version
    76      * @var String
    77      */
    78     protected $version = '-';
    79 
    80     /**
    81      * Plugin Last Updated
    82      * @var String
    83      */
    84     protected $last_updated = '-';
    8573
    8674    /**
     
    351339        </div>
    352340    </div>
    353     <div class="postbox-container" style="width:300px;"  >
    354         <div class="metabox-holder">
    355             <div class="meta-box-sortables">
    356                         <?php
    357                         $content = '<div class="admin_config_box">';
    358                         $content .= '<strong>' . __('Author:','wpaa') . '</strong> <a href="http://mdbitz.com/" target="_blank">MDBitz- Matthew Denton</a><br/><br/>';
    359                         $content .= '<strong>' . __('Project Website:','wpaa') . '</strong> <a href="http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/?utm_source=plugin-compliance&utm_medium=about-us&utm_campaign=plugin" target="_blank">labs.mdbitz.com</a><br/><br/>';
    360                         $content .= '<strong>' . __('Version:','wpaa') . '</strong> ' . $this->version . '<br/><br/>';
    361                         $content .= '<strong>' . __('Last Updated:','wpaa') . '</strong> ' . $this->last_updated;
    362                         $content .= '</div>';
    363                         $this->postbox("about", __("About this Plugin",'wpaa'), $content);
    364 
    365                         $content = '<div class="admin_config_box">';
    366                         $content .= '<a href="http://wordpress.org/extend/plugins/wordpress-amazon-associate/" target="_blank">' . __('Rate this plugin','wpaa') . '</a> ' . __('on WordPress') . '<br/><br/>';
    367                         $content .= '<a href="http://wordpress.org/extend/plugins/wordpress-amazon-associate/" target="_blank">' . __('Notify','wpaa') . '</a> ' .  __('WordPress users this plugin works with your WordPress version','wpaa') . '<br/><br/>';
    368                         $content .= '<strong>Share this plugin with others</strong><br/><br/>';
    369                         //facebook
    370                         $content .= '<a href="http://www.facebook.com/sharer.php?u=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/&t=Awesome%20WordPress%20Plugin:%20%20WordPress%20Amazon%20Associate" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/fb.png" alt="Facebook" /></a>';
    371                         //digg
    372                         $content .= '&nbsp;&nbsp;<a href="http://digg.com/submit?url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/digg.gif" alt="Digg" /></a>';
    373                         //stubmleupon
    374                         $content .= '&nbsp;&nbsp;<a href="http://www.stumbleupon.com/badge/?url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/stumbleupon.gif" alt="Stumble Upon" /></a>';
    375                         //delicious
    376                         $content .= '&nbsp;&nbsp;<a href="http://delicious.com/save?v=5&noui&jump=close&url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/deli.gif" alt="Delicous" /></a>';
    377                         //twitter
    378                         $content .= '&nbsp;&nbsp;<a href="http://twitter.com/home/?status=WordPress+Amazon+Associate+%2C+the+all-in-one+Amazon+Associate+WordPress+Plugin+http://tinyurl.com/wpaaplugin" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/twitter.gif" alt="Twitter" /></a>';
    379                         $content .= '</div>';
    380                         $this->postbox("feedback", __("User Feedback",'wpaa'), $content);
    381 
    382                         $content = '<div class="admin_center" >';
    383                         $content .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    384 <input type="hidden" name="cmd" value="_s-xclick">
    385 <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHJwYJKoZIhvcNAQcEoIIHGDCCBxQ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NAQkFMQ8XDTEwMTAyMjExNTY1M1owIwYJKoZIhvcNAQkEMRYEFG9XjtXvii5csRnOJ5DPr67owUaMMA0GCSqGSIb3DQEBAQUABIGApAZcp9yNC9Kq7dyJ1b+ndpu9dAAjXSKFZlR9qvhpurUIcnn3QivTsIKR/AaBgK0O62794omrrKG2jlxFjiHTwb0hgFbShBg4AJd2dpjF9AJ5WFa1V5SGYoscmNYrHnRoaYZIc5SPbd7Fto0vuIK1Z1Jq8x3rZ2ex85I3WLLusKg=-----END PKCS7-----
    386 ">
    387 <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    388 <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    389 </form>';
    390                         $content .= '</div>';
    391                         $this->postbox("donate", __("Show your support!",'wpaa'), $content);
    392                         ?>
    393             </div>
    394         </div>
    395     </div>
     341<?php
     342        $this->doAdminSideBar('plugin-compliance');
     343?>
    396344</div>
    397345        <?php
  • wordpress-amazon-associate/trunk/WPAA/Module/IP2Nation.php

    r400955 r410533  
    11<?php
    22/*
    3  * copyright (c) 2010 MDBitz - Matthew John Denton - mdbitz.com
     3 * copyright (c) 2010,2011 MDBitz - Matthew John Denton - mdbitz.com
    44 *
    55 * This file is part of WordPress Amazon Associate Plugin.
     
    5757     */
    5858    protected $options_lvl = "manage_options";
    59 
    60     /**
    61      * Plugin Version
    62      * @var String
    63      */
    64     protected $version = '-';
    65 
    66     /**
    67      * Plugin Last Updated
    68      * @var String
    69      */
    70     protected $last_updated = '-';
    7159
    7260    /**
     
    117105        add_action('admin_print_scripts', array(&$this, 'doPageScripts'));
    118106        add_action('admin_print_styles', array(&$this, 'doPageStyles'));
    119         add_action('admin_init', array(&$this, 'install'));
     107        add_action('admin_init', array(&$this, 'doAction'));
    120108        $this->getStatus();
    121109    }
     
    209197                $locale = 'JP'; // Japan
    210198                break;
    211             // CN
    212             case 'cn':  // China
    213                 $locale = 'CN';
    214                 break;
    215             // IT
    216             case 'it':  // Italy
    217                 $locale = 'IT';
     199            // CN
     200            case 'cn':  // China
     201                $locale = 'CN';
     202                break;
     203            // IT
     204            case 'it':  // Italy
     205                $locale = 'IT';
     206                break;
    218207        }
    219208        return $locale;
     
    240229        }
    241230
     231    }
     232
     233    /**
     234     * Init
     235     */
     236    public function doAction() {
     237        $this->uninstall();
     238        $this->install();
    242239    }
    243240
     
    310307                }
    311308
     309            }
     310        }
     311    }
     312
     313    public function uninstall() {
     314        if( isset($_POST['wpaa_ip2nation_uninstall']) && isset($_POST['wpaa-ip2nation-uninstall-meta-nonce']) ) {
     315            $wpaa_edit = $_POST["wpaa_ip2nation_uninstall"];
     316            $nonce = $_POST['wpaa-ip2nation-uninstall-meta-nonce'];
     317            if (isset($wpaa_edit) && !empty($wpaa_edit) && wp_verify_nonce($nonce, 'wpaa-ip2nation-uninstall-meta-nonce')) {
     318                global $wpdb;
     319                $sql = 'DROP TABLE ' . $this->db;
     320                if ($wpdb->query($sql) === FALSE) {
     321                    $this->install_status = __("<strong>Failure:</strong> IP2Nation database table could not be deleted.", "wpaa");
     322                    return;
     323                } else {
     324                    $this->install_status = __("<strong>Success:</strong> IP2Nation database table was deleted successfully.", "wpaa");
     325                }
     326                $this->status['installed'] = false;
    312327            }
    313328        }
     
    431446                            ?>
    432447                </form>
     448                <?php if( $this->status['installed'] ) { ?>
     449                <form action="<?php echo admin_url('admin.php?page=' . $this->hook); ?>" method="post" id="wpaa-conf">
     450                    <input value="wpaa_ip2nation_uninstall" type="hidden" name="wpaa_ip2nation_uninstall" />
     451                    <input type="hidden" name="wpaa-ip2nation-uninstall-meta-nonce" value="<?php echo wp_create_nonce('wpaa-ip2nation-uninstall-meta-nonce') ?>" />
     452                            <?php
     453
     454                            $content = '<div class="admin_config_box">';
     455                            $content .= '<p>' . __("If you no longer want to use ip2nation for Geo-Localization than you can delete the ip2nation database by clicking uninstall.") . '</p>';
     456                            $content .= '<div class="alignright"><input class="button-primary" type="submit" name="submit" value="' . __('Uninstall','wpaa') . ' &raquo;" /></div>';
     457                            $content .= '<div class="clear"></div>';
     458                            $content .= '</div>';
     459                            $this->postbox("ip2nation_uninstall", __("ip2nation uninstall",'wpaa'), $content);
     460                            ?>
     461                </form>
     462                <?php } ?>
    433463            </div>
    434464        </div>
    435465    </div>
    436     <div class="postbox-container" style="width:300px;"  >
    437         <div class="metabox-holder">
    438             <div class="meta-box-sortables">
    439                         <?php
    440                         $content = '<div class="admin_config_box">';
    441                         $content .= '<strong>' . __('Author:','wpaa') . '</strong> <a href="http://mdbitz.com/" target="_blank">MDBitz- Matthew Denton</a><br/><br/>';
    442                         $content .= '<strong>' . __('Project Website:','wpaa') . '</strong> <a href="http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/?utm_source=plugin-ip2nation&utm_medium=ip2nation&utm_campaign=plugin" target="_blank">labs.mdbitz.com</a><br/><br/>';
    443                         $content .= '<strong>' . __('Version:','wpaa') . '</strong> ' . $this->version . '<br/><br/>';
    444                         $content .= '<strong>' . __('Last Updated:','wpaa') . '</strong> ' . $this->last_updated;
    445                         $content .= '</div>';
    446                         $this->postbox("about", __("About this Plugin",'wpaa'), $content);
    447 
    448                         $content = '<div class="admin_config_box">';
    449                         $content .= '<a href="http://wordpress.org/extend/plugins/wordpress-amazon-associate/" target="_blank">' . __('Rate this plugin','wpaa') . '</a> ' . __('on WordPress') . '<br/><br/>';
    450                         $content .= '<a href="http://wordpress.org/extend/plugins/wordpress-amazon-associate/" target="_blank">' . __('Notify','wpaa') . '</a> ' .  __('WordPress users this plugin works with your WordPress version','wpaa') . '<br/><br/>';
    451                         $content .= '<strong>Share this plugin with others</strong><br/><br/>';
    452                         //facebook
    453                         $content .= '<a href="http://www.facebook.com/sharer.php?u=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/&t=Awesome%20WordPress%20Plugin:%20%20WordPress%20Amazon%20Associate" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/fb.png" alt="Facebook" /></a>';
    454                         //digg
    455                         $content .= '&nbsp;&nbsp;<a href="http://digg.com/submit?url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/digg.gif" alt="Digg" /></a>';
    456                         //stubmleupon
    457                         $content .= '&nbsp;&nbsp;<a href="http://www.stumbleupon.com/badge/?url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/stumbleupon.gif" alt="Stumble Upon" /></a>';
    458                         //delicious
    459                         $content .= '&nbsp;&nbsp;<a href="http://delicious.com/save?v=5&noui&jump=close&url=http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/deli.gif" alt="Delicous" /></a>';
    460                         //twitter
    461                         $content .= '&nbsp;&nbsp;<a href="http://twitter.com/home/?status=WordPress+Amazon+Associate+%2C+the+all-in-one+Amazon+Associate+WordPress+Plugin+http://tinyurl.com/wpaaplugin" target="_blank"><img src="' . WP_CONTENT_URL . '/plugins/wordpress-amazon-associate/imgs/twitter.gif" alt="Twitter" /></a>';
    462                         $content .= '</div>';
    463                         $this->postbox("feedback", __("User Feedback",'wpaa'), $content);
    464 
    465                         $content = '<div class="admin_center" >';
    466                         $content .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    467 <input type="hidden" name="cmd" value="_s-xclick">
    468 <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHJwYJKoZIhvcNAQcEoIIHGDCCBxQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2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hpurUIcnn3QivTsIKR/AaBgK0O62794omrrKG2jlxFjiHTwb0hgFbShBg4AJd2dpjF9AJ5WFa1V5SGYoscmNYrHnRoaYZIc5SPbd7Fto0vuIK1Z1Jq8x3rZ2ex85I3WLLusKg=-----END PKCS7-----
    469 ">
    470 <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    471 <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    472 </form>';
    473                         $content .= '</div>';
    474                         $this->postbox("donate", __("Show your support!",'wpaa'), $content);
    475                         ?>
    476             </div>
    477         </div>
    478     </div>
     466<?php
     467        $this->doAdminSideBar('plugin-ip2nation');
     468?>
    479469</div>
    480470        <?php
  • wordpress-amazon-associate/trunk/WPAA/Module/MultiUser.php

    r400955 r410533  
    11<?php
    22/*
    3  * copyright (c) 2010 MDBitz - Matthew John Denton - mdbitz.com
     3 * copyright (c) 2010,2011 MDBitz - Matthew John Denton - mdbitz.com
    44 *
    55 * This file is part of WordPress Amazon Associate Plugin.
     
    6767
    6868    /**
    69      * Plugin Version
    70      * @var String
    71      */
    72     protected $version = '-';
    73 
    74     /**
    75      * Plugin Last Updated
    76      * @var String
    77      */
    78     protected $last_updated = '-';
    79 
    80     /**
    8169     * Constructor
    8270     * @param string $parent_hook
     
    11098    <h3><?php _e("Amazon Assoicate Settings", "wpaa"); ?></h3>
    11199        <table class="form-table">
     100            <?php if ( $wpaa->isLocaleEnabled( "US" ) ) { ?>
    112101            <tr>
    113102                <th><img alt="" width="18" height="11" src="<?php echo $wpaa->getPluginPath( '/imgs/flag_us.gif'); ?>" />&nbsp;<a href="https://affiliate-program.amazon.com/" target="_blank"><?php _e('United States', 'wpaa');?></a></th>
    114103                <td><input type="text" name="AssociateTag-US" id="AssociateTag-US" value="<?php echo esc_attr( get_user_meta( $user->ID, 'AssociateTag-US', true ) ); ?>" class="regular-text" /></td>
    115104            </tr>
     105            <?php } if ( $wpaa->isLocaleEnabled( "CA" ) ) { ?>
    116106            <tr>
    117107                <th><img alt="" width="18" height="11" src="<?php echo $wpaa->getPluginPath( '/imgs/flag_ca.gif'); ?>" />&nbsp;<a href="https://associates.amazon.ca/" target="_blank"><?php _e('Canada', 'wpaa');?></a></th>
    118108                <td><input type="text" name="AssociateTag-CA" id="AssociateTag-CA" value="<?php echo esc_attr( get_user_meta( $user->ID, 'AssociateTag-CA', true ) ); ?>" class="regular-text" /></td>
    119109            </tr>
     110            <?php } if ( $wpaa->isLocaleEnabled( "CN" ) ) { ?>
    120111            <tr>
    121112                <th><img alt="" width="18" height="11" src="<?php echo $wpaa->getPluginPath( '/imgs/flag_cn.gif'); ?>" />&nbsp;<a href="https://associates.amazon.cn/" target="_blank"><?php _e('China', 'wpaa');?></a></th>
    122113                <td><input type="text" name="AssociateTag-CN" id="AssociateTag-CN" value="<?php echo esc_attr( get_user_meta( $user->ID, 'AssociateTag-CN', true ) ); ?>" class="regular-text" /></td>
    123114            </tr>
     115            <?php } if ( $wpaa->isLocaleEnabled( "DE" ) ) { ?>
    124116            <tr>
    125117                <th><img alt="" width="18" height="11" src="<?php echo $wpaa->getPluginPath( '/imgs/flag_de.gif'); ?>" />&nbsp;<a href="https://partnernet.amazon.de/" target="_blank"><?php _e('Gemany', 'wpaa');?></a></th>
    126118                <td><input type="text" name="AssociateTag-DE" id="AssociateTag-DE" value="<?php echo esc_attr( get_user_meta( $user->ID, 'AssociateTag-DE', true ) ); ?>" class="regular-text" /></td>
    127119            </tr>
     120            <?php } if ( $wpaa->isLocaleEnabled( "FR" ) ) { ?>
    128121            <tr>
    129122                <th><img alt="" width="18" height="11" src="<?php echo $wpaa->getPluginPath( '/imgs/flag_fr.gif'); ?>" />&nbsp;<a href="https://partenaires.amazon.fr/" target="_blank"><?php _e('France', 'wpaa');?></a></th>
    130123                <td><input type="text" name="AssociateTag-FR" id="AssociateTag-FR" value="<?php echo esc_attr( get_user_meta( $user->ID, 'AssociateTag-FR', true ) ); ?>" class="regular-text" /></td>
    131124            </tr>
     125            <?php } if ( $wpaa->isLocaleEnabled( "IT" ) ) { ?>
    132126            <tr>
    133127                <th><img alt="" width="18" height="11" src="<?php echo $wpaa->getPluginPath( '/imgs/flag_it.gif'); ?>" />&nbsp;<a href="https://programma-affiliazione.amazon.it/" target="_blank"><?php _e('Italy', 'wpaa');?></a></th>
    134128                <td><input type="text" name="AssociateTag-IT" id="AssociateTag-IT" value="<?php echo esc_attr( get_user_meta( $user->ID, 'AssociateTag-IT', true ) ); ?>" class="regular-text" /></td>
    135129            </tr>
     130            <?php } if ( $wpaa->isLocaleEnabled( "JP" ) ) { ?>
    136131            <tr>
    137132                <th><img alt="" width="18" height="11" src="<?php echo $wpaa->getPluginPath( '/imgs/flag_jp.gif'); ?>" />&nbsp;<a href="https://affiliate.amazon.co.jp/" target="_blank"><?php _e('Japan', 'wpaa');?></a></th>
    138133                <td><input type="text" name="AssociateTag-JP" id="AssociateTag-JP" value="<?php echo esc_attr( get_user_meta( $user->ID, 'AssociateTag-JP', true ) ); ?>" class="regular-text" /></td>
    139134            </tr>
     135            <?php } if ( $wpaa->isLocaleEnabled( "UK" ) ) { ?>
    140136            <tr>
    141137                <th><img alt="" width="18" height="11" src="<?php echo $wpaa->getPluginPath( '/imgs/flag_uk.gif'); ?>" />&nbsp;<a href="https://affiliate-program.amazon.co.uk/" target="_blank"><?php _e('United Kingdom', 'wpaa');?></a></th>
    142138                <td><input type="text" name="AssociateTag-UK" id="AssociateTag-UK" value="<?php echo esc_attr( get_user_meta( $user->ID, 'AssociateTag-UK', true ) ); ?>" class="regular-text" /></td>
    143139            </tr>
     140            <?php } ?>
    144141        </table>
    145142<?php
  • wordpress-amazon-associate/trunk/WPAA/Module/QuickLinks.php

    r400955 r410533  
    11<?php
    22/*
    3  * copyright (c) 2010 MDBitz - Matthew John Denton - mdbitz.com
     3 * copyright (c) 2010,2011 MDBitz - Matthew John Denton - mdbitz.com
    44 *
    55 * This file is part of WordPress Amazon Associate Plugin.
     
    6565     */
    6666    protected $options = array();
    67 
    68     /**
    69      * Plugin Version
    70      * @var String
    71      */
    72     protected $version = '-';
    73 
    74     /**
    75      * Plugin Last Updated
    76      * @var String
    77      */
    78     protected $last_updated = '-';
    7967
    8068    /**
     
    139127            tinyMCE.execInstanceCommand("mce_editor_0", "mceFocus");
    140128        } else {
     129            var selected_txt = (!!document.getSelection) ? document.getSelection() :
     130           (!!window.getSelection)   ? window.getSelection() :
     131           document.selection.createRange().text;
     132            if( selected_txt != "" ) {
     133                content = selected_txt;
     134            }
    141135            send_to_editor( content_prefix + content + content_suffix );
    142136        }
     
    168162            tinyMCE.execInstanceCommand("mce_editor_0", "mceFocus");
    169163        } else {
     164            var selected_txt = (!!document.getSelection) ? document.getSelection() :
     165           (!!window.getSelection)   ? window.getSelection() :
     166           document.selection.createRange().text;
     167            if( selected_txt != "" ) {
     168                content = selected_txt;
     169            }
    170170            send_to_editor( content_prefix + content + content_suffix );
    171171        }
  • wordpress-amazon-associate/trunk/WPAA/ShortCodeHandler.php

    r386477 r410533  
    11<?php
    22/*
    3  * copyright (c) 2010 MDBitz - Matthew John Denton - mdbitz.com
     3 * copyright (c) 2010,2011 MDBitz - Matthew John Denton - mdbitz.com
    44 *
    55 * This file is part of WordPress Amazon Associate Plugin.
     
    4343        add_shortcode('amazon_image', array(&$this,'amazonImageHandler'));
    4444        add_shortcode('amazon_enhanced', array(&$this,'amazonEnhancedHandler'));
     45        add_shortcode('amazon_banner', array(&$this,'amazonBannerHandler'));
    4546        add_shortcode('amazon_carousel', array(&$this,'amazonCarouselHandler'));
    4647        add_shortcode('amazon_mp3_clips', array(&$this,'amazonMP3ClipsHandler'));
     
    6667    public function amazonLinkHandler( $atts, $content=null, $code="" ) {
    6768        global $wpaa;
    68         $atts = shortcode_atts( array( 'id'=>null, 'locale'=> null,
    69             'type' => 'ASIN', 'target' => '_blank', 'rel' => "nofollow",
    70             'container' => null, 'container_class' => null, 'title' => null ), $atts );
    71         return AmazonProduct::link($content, $atts['id'], $atts['locale'],
    72             $atts['type'], $atts['target'], $atts['rel'], $atts['container'],
    73             $atts['container_class'], $atts['title'] );
     69        $atts['content'] = $content;
     70        $atts['echo'] = false;
     71        return AmazonProduct::link( $atts );
    7472    }
    7573
     
    8280    public function amazonImageHandler( $atts, $content=null, $code="" ) {
    8381        global $wpaa;
    84         $atts = shortcode_atts( array( 'id'=>null, 'locale'=>null,
    85             'size'=>'medium', 'type' => 'ASIN', 'link' => false,
    86             'target' => '_blank', 'rel' => "nofollow", 'class'=> null,
    87             'container'=>null, 'container_class' => null, 'alt' => null,
    88             'title' => null ), $atts );
    89         return AmazonProduct::image($content, $atts['id'], $atts['size'],
    90                 $atts['link'], $atts['locale'], $atts['type'], $atts['target'],
    91                 $atts['rel'], $atts['class'], $atts['container'],
    92                 $atts['container_class'], $atts['alt'], $atts['title']);
     82        $atts['content'] = $content;
     83        $atts['echo'] = false;
     84        return AmazonProduct::image($atts);
    9385    }
    9486
     
    10193    public function amazonEnhancedHandler( $atts, $content=null, $code="" ) {
    10294        global $wpaa;
    103         $atts = shortcode_atts( array('asin' => null, 'locale' => null, 'new_window' => true,
    104             'show_border' => true, 'larger_image' => true, 'price' => "All",
    105             'background_color' => "FFFFFF", 'text_color' => "000000",
    106             'link_color' => "0000FF", 'container' => null,
    107             'container_class' => null ), $atts );
    108         return AmazonProduct::enhanced($atts['asin'], $atts['locale'],
    109                $atts['new_window'], $atts['show_border'], $atts['larger_image'],
    110                $atts['price'], $atts['background_color'], $atts['text_color'],
    111                $atts['link_color'], $atts['container'], $atts['container_class'] );
     95        $atts['content'] = $content;
     96        $atts['echo'] = false;
     97        return AmazonProduct::enhanced( $atts );
     98    }
     99
     100    /**
     101     * Amazon Banner Short Code Handler
     102     * @param array $atts
     103     * @param string $content
     104     * @param string $code
     105     */
     106    public function amazonBannerHandler( $atts, $content=null, $code="" ) {
     107        $banner = AmazonBanner::Banner( $atts );
     108        if( empty( $banner ) ) {
     109            return $content;
     110        } else {
     111            return $banner;
     112        }
    112113    }
    113114
     
    120121    public function amazonCarouselHandler( $atts, $content=null, $code="" ) {
    121122        $widget = new AmazonWidget_Carousel( $this->mergeWidgetOptions( AmazonWidget_Carousel::getDefaultShortCodeOptions(), $atts ) );
    122         return $widget->toHTML();
     123        return self::doStyle( $atts, $widget->toHTML() );
    123124    }
    124125
     
    131132    public function amazonMP3ClipsHandler( $atts, $content=null, $code="" ) {
    132133        $widget = new AmazonWidget_MP3Clips( $this->mergeWidgetOptions( AmazonWidget_MP3Clips::getDefaultShortCodeOptions(), $atts ) );
    133         return $widget->toHTML();
     134        return self::doStyle( $atts, $widget->toHTML() );
    134135    }
    135136
     
    142143    public function amazonMyFavoritesHandler( $atts, $content=null, $code="" ) {
    143144        $widget = new AmazonWidget_MyFavorites( $this->mergeWidgetOptions( AmazonWidget_MyFavorites::getDefaultShortCodeOptions(), $atts ) );
    144         return $widget->toHTML();
     145        return self::doStyle( $atts, $widget->toHTML() );
    145146    }
    146147
     
    153154    public function amazonSearchHandler( $atts, $content=null, $code="" ) {
    154155        $widget = new AmazonWidget_Search( $this->mergeWidgetOptions( AmazonWidget_Search::getDefaultShortCodeOptions(), $atts ) );
    155         return $widget->toHTML();
     156        return self::doStyle( $atts, $widget->toHTML() );
    156157    }
    157158
     
    164165    public function amazonOmakaseHandler( $atts, $content=null, $code="" ) {
    165166        $widget = new AmazonWidget_Omakase( $this->mergeWidgetOptions( AmazonWidget_Omakase::getDefaultShortCodeOptions(), $atts ) );
    166         return $widget->toHTML();
     167        return self::doStyle( $atts, $widget->toHTML() );
    167168    }
    168169
     
    175176    public function amazonProductCloudHandler( $atts, $content=null, $code="" ) {
    176177        $widget = new AmazonWidget_ProductCloud( $this->mergeWidgetOptions( AmazonWidget_ProductCloud::getDefaultShortCodeOptions(), $atts ) );
    177         return $widget->toHTML();
     178        return self::doStyle( $atts, $widget->toHTML() );
    178179    }
    179180
     
    191192        return shortcode_atts( $defaultArgs, $atts );
    192193    }
     194   
     195    /**
     196     * Append Container, class and style if enabled
     197     * @param array $options
     198     * @param string $output_str
     199     * @return <type>
     200     */
     201    public static function doStyle( $options, $output_str ) {
     202        $output = "";
     203        if( ! empty($options['container']) ) {
     204            $output = "<" . $options['container'];
     205            if( ! empty($options['container_class']) ) {
     206                $output .= ' class="' . $options['container_class'] . '"';
     207            }
     208            if( ! empty($options['container_style']) ) {
     209                $output .= ' style="' . $options['container_style'] . '"';
     210            }
     211            return $output . ">" . $output_str . "</" . $options['container'] . ">";
     212        } else {
     213            return $output_str;
     214        }
     215    }
    193216
    194217}
  • wordpress-amazon-associate/trunk/Widget/Amazon/Carousel.php

    r383621 r410533  
    5656    function widget($args, $instance) {
    5757        global $wpaa;
    58         extract($args);
     58    extract($args);
    5959        if( isset( $before_widget ) ) {
    6060            echo $before_widget;
  • wordpress-amazon-associate/trunk/Widget/Amazon/MP3Clips.php

    r383621 r410533  
    5656    function widget($args, $instance) {
    5757        global $wpaa;
    58         extract($args);
     58    extract($args);
    5959        if( isset( $before_widget ) ) {
    6060            echo $before_widget;
  • wordpress-amazon-associate/trunk/Widget/Amazon/MyFavorites.php

    r383621 r410533  
    5656    function widget($args, $instance) {
    5757        global $wpaa;
    58         extract($args);
     58    extract($args);
    5959        if( isset( $before_widget ) ) {
    6060            echo $before_widget;
  • wordpress-amazon-associate/trunk/Widget/Amazon/Omakase.php

    r383621 r410533  
    5656    function widget($args, $instance) {
    5757        global $wpaa;
    58         extract($args);
     58    extract($args);
    5959        if( isset( $before_widget ) ) {
    6060            echo $before_widget;
    6161        }
    62         $title = apply_filters('title', $instance['title']);
     62        $title = apply_filters('widget_title', $instance['title']);
    6363        if ( $title ) {
    6464            echo $before_title . $title . $after_title;
  • wordpress-amazon-associate/trunk/Widget/Amazon/ProductCloud.php

    r383621 r410533  
    5656    function widget($args, $instance) {
    5757        global $wpaa;
    58         extract($args);
     58    extract($args);
    5959        if( isset( $before_widget ) ) {
    6060            echo $before_widget;
    6161        }
    62         $title = apply_filters('title', $instance['widgetTitle']);
     62        $title = apply_filters('widget_title', $instance['widgetTitle']);
    6363        if ( $title ) {
    6464            echo $before_title . $title . $after_title;
  • wordpress-amazon-associate/trunk/Widget/Amazon/Search.php

    r383621 r410533  
    5656    function widget($args, $instance) {
    5757        global $wpaa;
    58         extract($args);
     58    extract($args);
    5959        if( isset( $before_widget ) ) {
    6060            echo $before_widget;
  • wordpress-amazon-associate/trunk/readme.txt

    r400973 r410533  
    44Tags: amazon, associate, affiliate, carousel, widget, filter, search, short code, ip2nation, localization, omakase, my favorites, mp3 clips, multi-user, multi-author, product cloud
    55Requires at least: 3.0.0
    6 Tested up to: 3.2.0
     6Tested up to: 3.2.1
    77Stable tag: trunk
    88
    9 Quickly and easily monetize your webiste through the integration of Amazon
    10 products and widgets tagged with your and/or authors' associate ids.
     9Quickly and easily monetize your website with links and widgets from the web's top Affiliate Program,
     10Amazon Associates.
    1111
    1212== Description ==
    1313
    14 Easily and quickly integrate Amazon Products and Widgets into your website.
    15 This plugin enables you to monetize your website through the use of Amazon's
     14The WPAA plugin enables you to monetize your website through the use of Amazon's
    1615Affiliate Program. By entering your amazon associate id for Amazon's supported
    1716locales you will earn referral fees for all products users purchase through
     
    1918inserting of amazon products and images into your content, content replacement
    2019of static links with your associate tag, and support for inserting Amazon
    21 Widgets through WordPress ShortCode, tinyMCE,Widget Admin, or PHP code.
    22 
    23 This plugin fully supports amazon localization to supported markets:
     20Widgets through WordPress ShortCode, tinyMCE editor controls, Widget Admin,
     21or PHP code.
     22
     23This plugin fully supports amazon product localization to supported markets:
    2424Canada (CA), Germany (DE), France (FR), Japan (JP), United Kingdom (GB), and
    2525the Unites States (US).<br>
    26 In addition the plugin contains basic support for link filtering of Amazon's
     26In addition the plugin contains support for link localization of Amazon's
    2727Italy (IT) and China (CN) markets.
    2828
     
    3030plugin is designed to be your all inclusive source for enriching you website
    3131with Amazon Products and Widgets embedded with your unique Amazon Associate Tag.
    32 Below is a brief overview of the supported features:
     32Below is a brief overview of the supported features if you have any questions
     33concerning using or features of the plugin than please visit the [Support Forums](http://forums.mdbitz.com/).
     34
     35**Key Features**
    3336
    34371. **Amazon Widget Support** <br>
    35 To date the plug-in supports all Amazon Widgets that can be created using
    36 Amazon's [Widget Source](https://widgets.amazon.com/Widget-Source/) including
    37 the Carousel Widget, MP3 Clips Widget, My Favorites Widget and Search Widget in
    38 addition to the Omakase and Product Cloud Widgets.
    39 <br>
    40 All widgets can be inserted into your website in any of 4 methods:
    41 <br>
    42 *Short Code* `[amazon_carousel]`<br>
    43 *tinyMCE Editor Button*<br>
    44 *WordPress Widget Admin*<br>
    45 *PHP code* `<?php AmazonWidget::Carousel( $args ); ?>`<br>
    46 Inserting widgets in templates is done through the usage of the AmazonWidget
    47 class that provides static methods for rendering the different widgets.
    48 
    49 1. **Amazon Associate Tag Filtering** <br>
    50 To make management of your site easier we have included an optional filter that
    51 when enabled will modify static amazon product links to include your specified
    52 associate tag. This feature checks the locale of the amazon link and uses the
    53 correct localized associate tag so that you maximize your returns.
    54 
    55 *As of version 1.6.0 static links are localized if Tag Filtering and Geo Localization are enabled.*
    56 
    57 1. **Amazon Product Linking** <br>
    58 When writing content for your website you may find the need to include product
    59 links and images. The WordPress Amazon Associate plugin makes this task easier
    60 by including an amazon associate tinyMCE control that lets you quickly search
    61 for a product and insert either an image or link to the desired product that is
    62 automatically tagged with your associate id. In addition ShortCode and PHP code
    63 handles are provided to provide complete support.
    64 <br> `<?php AmazonProduct::link( '0756406412'); ?>`
    65 <br> `[amazon_link id="0756406412" ]Shadowrise[/amazon_link]`
    66 
    67 1. **Amazon Product Preview** <br>
    68 If your website contains product links Amazon's 'Product Preview' enhances your
    69 links by providing overlay products when a visitor rolls over the links. This
    70 plugin allows you to easily enable/disable this feature through it's admin
    71 panel.
    72 
    73 1. **Link Localization** <br>
    74 For websites that want to provide the most relevant product links to their visitors
    75 they can enable links to be localized to the visitors Amazon. This means that
    76 visitors from France will be directed to amazon.fr and etc. If you have visitors
    77 from multiple countries this feature is for you.
    78 
    79 1. **Multi-Author Support**<br>
    80 If your website has multiple authors contributing content, then you have the option
    81 of having content they write tagged with their associate id.  If enabled users will
    82 have the ability to insert their associate tags on their profile page in the admin
    83 and any pages/posts they write will have the links/widgets in the content area set
    84 to their associate id. And links or widgets in the non-content (header/footer/sidebar/etc)
    85 will still be tagged with the associate ids configured in the settings page.
    86 
    87 1. **Complete Administrative control** <br>
    88 We want this plugin to be as unobtrusive as possible and for that goal we give you
    89 full control over what features you want to use on your website. Including enabling/disabling
    90 of the Amazon Widgets and Associate Tag Filter if they are unused by your website
    91 freeing up valuable screen space and processing time.
     38  *Carousel*<br>
     39  *MP3 Clips*<br>
     40  *My Favorites*<br>
     41  *Omakase*<br>
     42  *Product Cloud*<br>
     43  *Search*<br>
     44
     451. **Amazon Product Linking**
     46
     471. **Amazon Product Link Filtering**
     48
     491. **Amazon Product Preview**
     50
     511. **Amazon Link & Widget Geo-Localization**
     52
     531. **Multi-Author Support**
     54
     551. **Amazon Product Advertising API Caching**
     56
     571. **Complete Administrative control**
     58
     591. **MPMU Compatible**
    9260
    9361== Installation ==
     
    95631. Upload the `wordpress-amazon-associate` folder and all it's contents to the `/wp-content/plugins/` directory
    96641. Activate the plugin through the *Plugins* menu in WordPress
    97 1. Access the Plugin settings by clicking the *WP - Amazon* menu option
    98 1. Enter your Amazon Associate Id(s)
    99 1. Enter your Amazon Web Services Keys
     651. Access the Plugin Settings by clicking the *WP - Amazon* menu option
     661. Enter your Amazon Associate Ids
     671. Enter your Amazon Web Services Access and Secret Keys
     681. Optionally Configure Multi-Author, Link Filtering and Product Preview settings
    100691. Install the ip2nation database if you wish to support Geo Localization, by selecting the *WP - Amazon* > *ip2nation* menu option
    101701. Configure the Plugin Cache by visiting the *WP - Amazon* > *Cache* menu option
     711. Configure available Widgets by accessing the *WP - Amazon* > *Widgets* menu option
    102721. Insert Products and Widgets into your website through your template, page/post content or the *Widget* admin screen in WordPress
    10373
    10474== Frequently Asked Questions ==
    10575
     76= How can I report a bug? request help? request a feature? =
     77
     78If you find a bug in the WordPress Amazon Associate plugin then please let me
     79know by emailing it to [matt@mdbitz.com](mailto:matt@mdbitz.com) or posting the
     80issue in the [Support Forums](http://forums.mdbitz.com/). You can also
     81report it through my [trac project](http://trac.mdbitz.com/WordPressAmazonAssociate/)
     82using the login credential of "user" with password "guest". Another way you can
     83reach me is through my [website](http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/?utm_source=wordpress&utm_medium=plugin-readme&utm_campaign=plugin)
     84
    10685= Do I need to configure the Amazon Web Service Keys =
    10786
    108 No, however by not inputting a valid Amazon Web Service you will not be able to
    109 insert amazon product links and images through ShortCode or the content editor's
    110 tinyMCE control.
     87No, however by not inputing a valid Amazon Web Service credential you will not be able to
     88insert amazon product links and images through ShortCode, the content editor's
     89tinyMCE control or the Quick Links Module.
    11190
    11291= Why can't I set Italy or China as my Primary Locale? =
     
    11897Link Filter functions for these locales.
    11998
    120 It is important to note that if you put static links in your website and have the
    121 associate filter and geo localization enabled that italy and china locales will be
    122 outputted if the link is valid in the localized locale.
    123 
    12499= Does this plugin support Multi-Author websites? =
    125100
     
    129104associate ids, and if not set will default to the ids configured on
    130105the *WP - Amazon * > *Settings* page.
     106
     107Version 2.0 and later of the plugin enable sites administrators to define a percentage
     108of links where the administrator's associate id will be used instead of the author's
     109associate id.
    131110
    132111= What is Link Localization? =
     
    150129
    151130At this time there is a confirmed bug with the Amazon Product Preview code
    152 that in some wordpress themes the previews do not occour. This error is due to
     131that in some wordpress themes the previews do not occur. This error is due to
    153132the Amazon script including it's own version of jQuery into the page causing a
    154133conflict. To resolve the issue an optional jQuery.noConflict call to remap
     
    177156project for other users.
    178157
    179 = How can I report a bug? request help? request a feature? =
    180 
    181 If you find a bug in the WordPress Amazon Associate plugin then please let me
    182 know by emailing it to [matt@mdbitz.com](mailto:matt@mdbitz.com). You can also
    183 report it through my [trac project](http://trac.mdbitz.com/WordPressAmazonAssociate/)
    184 using the login credential of "user" with password "guest". Another way you can
    185 reach me is through my [website](http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/?utm_source=wordpress&utm_medium=plugin-readme&utm_campaign=plugin)
    186 
    187 = I notice that the associate tag for some links do not have my id, is this a bug? =
    188 
    189 No, this is not a bug. We have built into the plugin the ability to support the
    190 developers by having x% of links tagged with our associate id. By default this
    191 is set to 0% but can be turned on if desired by the user by visiting the
    192 *WP - Amazon* menu in your WordPress admin and selecting to use our associate
    193 tag for X% of links.
    194 
    195158== Screenshots ==
    196159
     
    225188The full project changelogs can be found at [http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/changelog](http://labs.mdbitz.com/wordpress/wordpress-amazon-associate-plugin/changelog/?utm_source=wordpress&utm_medium=plugin-readme&utm_campaign=plugin)
    226189
    227 = 1.6.1 - 06/24/2011 =
     190= 1.7.0 - 07/15/2011 =
     191* Multi-Author - Support Admin for x% of Author links
     192* Multi-Author - Product Preview - Support of Author Associate ID
     193* Plugin Compatibility - WordTwit - Fixed naming of fancybox script
     194* Plugin Compatibility - wp_tables_reloaded - Increased Filter priority
     195* Geo-Localization - Updated APaPi to return error when asin not found in locale
     196* Quick Links - HTML Editor text selection support
     197* Admin - Code refactor of messages, code reuse, options, tracking
     198* Admin - Migrated widget management to own sub-page
     199* Admin - Disable plugin features if AWS credentials not configured
     200* ip2nation - uninstall option
     201* Cache Module - clear cache option
     202* Content Viewer Module - Ability for admin to view content as designated locale
     203* Widgets - Support of Widget Styling via container, container_class and container_style
     204
     205= 1.6.1 - 06/25/2011 =
    228206* WordPress MultiSite Fix : Change admin capabilities to manage_options to enable plugin administration to site administrators
    229207
     
    250228= 1.5.1 - 04/28/2011 =
    251229* Author level users now have access to the TinyMCE interface to create widgets/links
    252 * Fixed Associate Filter logic so that multiple links in page to same url would not be double tagged. 
     230* Fixed Associate Filter logic so that multiple links in page to same url would not be double tagged.
    253231
    254232= 1.5.0 - 03/01/2011 =
     
    324302= Carousel =
    325303
    326 * `<?php AmazonWidget::Carousel( ); ?>`
     304* `<?php AmazonWidget::Carousel( $options ); ?>`
    327305* `[amazon_carousel]`
    328306
    329307= MP3 Clips =
    330308
    331 * `<?php AmazonWidget::MP3Clips( ); ?>`
     309* `<?php AmazonWidget::MP3Clips( $options ); ?>`
    332310* `[amazon_mp3_clips]`
    333311
    334312= My Favorites =
    335313
    336 * `<?php AmazonWidget::MyFavorites( ); ?>`
     314* `<?php AmazonWidget::MyFavorites( $options ); ?>`
    337315* `[amazon_my_favorites]`
    338316
    339317= Omakase (Leave it to Us) =
    340318
    341 * `<?php AmazonWidget::Omakase( ); ?>`
     319* `<?php AmazonWidget::Omakase( $options ); ?>`
    342320* `[amazon_omakase]`
    343321
    344322= Product Cloud =
    345323
    346 * `<?php AmazonWidget::ProductCloud( ); ?>`
     324* `<?php AmazonWidget::ProductCloud( $options ); ?>`
    347325* `[amazon_product_cloud]`
    348326
    349327= Search =
    350328
    351 * `<?php AmazonWidget::Search( ); ?>`
     329* `<?php AmazonWidget::Search( $options ); ?>`
    352330* `[amazon_search]`
    353331
    354332= Product Link =
    355333
    356 * `<?php AmazonProduct::link( "link_text", '0345518705' ); ?>`
     334* `<?php AmazonProduct::link( array( "content"=>"link text", "id" => "0345518705" ) ); ?>`
    357335* `[amazon_link id="0345518705"]link text[/amazon_link]`
    358336
    359337= Product Image =
    360338
    361 * `<?php AmazonProduct::image( "link_text", '0345518705', "medium", true ); ?>`
     339* `<?php AmazonProduct::image( array( "content" => "link text", "id" => "0345518705, "size" => "medium", "link" => true ) ); ?>`
    362340* `[amazon_image id="0345518705" link="true"]alt text[/amazon_image]`
    363341
    364 = Enhanced Product Ad =
    365 
    366 * `<?php AmazonProduct::enhanced( "0345518705" ); ?>`
     342= Enhanced Ad =
     343
     344* `<?php AmazonProduct::enhanced( array( "asin" => "0345518705" ) ); ?>`
    367345* `[amazon_enhanced asin="0345518705" ]`
  • wordpress-amazon-associate/trunk/servlet/index.php

    r321609 r410533  
    11<?php
    22/*
    3  * copyright (c) 2010 MDBitz - Matthew John Denton - mdbitz.com
     3 * copyright (c) 2010,2011 MDBitz - Matthew John Denton - mdbitz.com
    44 *
    55 * This file is part of WordPress Amazon Associate Plugin.
     
    2727
    2828$result = null;
    29 
    3029switch( $_REQUEST['Action'] ) {
    3130    case "ValidateAccess":
    32         $api->setAccessKey( $_REQUEST['AccessKey'] );
    33         $api->setSecretKey( $_REQUEST['SecretKey'] );
    34         $api->setLocale( $_REQUEST['Locale'] );
    35         switch( $_REQUEST['Locale'] ) {
    36             case 'US':
    37                 $result = $api->browseNodeLookup("1000");
    38                 break;
    39             case "UK":
    40                 $result = $api->browseNodeLookup("1025612");
    41                 break;
    42             case "CA":
    43                 $result = $api->browseNodeLookup("927726");
    44                 break;
    45             case "DE":
    46                 $result = $api->browseNodeLookup("541686");
    47                 break;
    48             case "FR":
    49                 $result = $api->browseNodeLookup("468256");
    50                 break;
    51             case "JP":
    52                 $result = $api->browseNodeLookup("465610");
    53                 break;
     31        if( ! empty($_REQUEST['AccessKey']) && ! empty($_REQUEST['SecretKey'])) {
     32            $api->setAccessKey( $_REQUEST['AccessKey'] );
     33            $api->setSecretKey( $_REQUEST['SecretKey'] );
     34            $api->setLocale( $_REQUEST['Locale'] );
     35            switch( $_REQUEST['Locale'] ) {
     36                case 'US':
     37                    $result = $api->browseNodeLookup("1000");
     38                    break;
     39                case "UK":
     40                    $result = $api->browseNodeLookup("1025612");
     41                    break;
     42                case "CA":
     43                    $result = $api->browseNodeLookup("927726");
     44                    break;
     45                case "DE":
     46                    $result = $api->browseNodeLookup("541686");
     47                    break;
     48                case "FR":
     49                    $result = $api->browseNodeLookup("468256");
     50                    break;
     51                case "JP":
     52                    $result = $api->browseNodeLookup("465610");
     53                    break;
     54            }
    5455        }
    5556        break;
  • wordpress-amazon-associate/trunk/wordpress_amazon_associate.php

    r400955 r410533  
    55  Description: Quickly and eaily monetize your webiste through the integration of Amazon products and widgets tagged with your associate id.
    66  Author: MDBitz - Matthew John Denton
    7   Version: 1.6.1
     7  Version: 1.7.0
    88  Requires at least: 3.0.0
    99  Author URI: http://labs.mdbitz.com
     
    1212
    1313/*
    14  * copyright (c) 2010 MDBitz - Matthew John Denton - mdbitz.com
     14 * copyright (c) 2010,2011 MDBitz - Matthew John Denton - mdbitz.com
    1515 *
    1616 * This file is part of WordPress Amazon Associate Plugin.
     
    4545spl_autoload_register(array('WPAA', 'autoload'));
    4646$wpaa = new WPAA();
     47
     48// deactivation
     49register_deactivation_hook( __FILE__, 'wpaa_deactivate');
     50
     51/**
     52 * send site uninstall information
     53 */
     54function wpaa_deactivate() {
     55    if( function_exists('curl_init') ) {
     56        $handle   = curl_init('http://mdbitz.com/installs.php?app=WPAA&uninstall=true&site=' . site_url() );
     57        if (false !== $handle) {
     58            curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE);
     59            curl_setopt($handle, CURLOPT_NOBODY, true);
     60            $response = curl_exec($handle);
     61            curl_close($handle);
     62        }
     63    }
     64}
Note: See TracChangeset for help on using the changeset viewer.