Amazon Associates Link Builder - Version 1.2

Version Description

  • December 19, 2016 =
  • If you are using custom templates, be sure to take a backup of your templates before updating the plugin by following these instructions. If you are not using custom templates, you can simply update the plugin using the update now link.
  • Fix: Array dereference issue with PHP version 5.3. You will no longer get PHP syntax issues while activating the plugin.
  • Administration of the plugin over a secured network (HTTPS) is recommended and not required.
  • Updated plugin user guide.
Download this release

Release Info

Developer amazonlinkbuilder
Plugin Icon 128x128 Amazon Associates Link Builder
Version 1.2
Comparing to
See all releases

Code changes from version 1.1 to 1.2

aalb_admin_item_search_items.hbs CHANGED
@@ -2,7 +2,7 @@
2
  {{#each this}}
3
  <div class="aalb-admin-item-search-items-item" data-asin="{{asin}}">
4
  <div class="aalb-admin-item-search-items-item-img">
5
- <img id="aalb-admin-item-search-items-item-img" src="{{image}}">
6
  </div>
7
  <div class="aalb-admin-item-search-items-item-title">
8
  {{title}}
2
  {{#each this}}
3
  <div class="aalb-admin-item-search-items-item" data-asin="{{asin}}">
4
  <div class="aalb-admin-item-search-items-item-img">
5
+ <img id="aalb-admin-item-search-items-item-img" src="{{image}}" />
6
  </div>
7
  <div class="aalb-admin-item-search-items-item-title">
8
  {{title}}
aalb_config.php CHANGED
@@ -13,7 +13,7 @@ and limitations under the License.
13
  */
14
 
15
  //version
16
- define('AALB_PLUGIN_VERSION','1.1.0-beta-1');
17
 
18
  //paths
19
  define('AALB_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
@@ -141,6 +141,7 @@ define('AALB_AWS_ACCESS_KEY', 'aalb_aws_access_key');
141
  define('AALB_AWS_SECRET_KEY', 'aalb_aws_secret_key');
142
  define('AALB_CRED_CONFIG_GROUP', 'aalb_cred_config_group');
143
  define('AALB_STORE_ID_NAMES', 'aalb_store_id_names');
 
144
 
145
  //Masking constant
146
  define('AALB_AWS_SECRET_KEY_MASK', '••••••••••••••••••••••••••••••••••••••••');
13
  */
14
 
15
  //version
16
+ define('AALB_PLUGIN_CURRENT_VERSION','1.2');
17
 
18
  //paths
19
  define('AALB_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
141
  define('AALB_AWS_SECRET_KEY', 'aalb_aws_secret_key');
142
  define('AALB_CRED_CONFIG_GROUP', 'aalb_cred_config_group');
143
  define('AALB_STORE_ID_NAMES', 'aalb_store_id_names');
144
+ define('AALB_SHOW_HTTP_WARNING_ONCE', 'aalb_show_http_warning_once');
145
 
146
  //Masking constant
147
  define('AALB_AWS_SECRET_KEY_MASK', '••••••••••••••••••••••••••••••••••••••••');
admin/sidebar/js/aalb_template.js CHANGED
@@ -45,6 +45,7 @@ function aalb_template_select_template_onchange(element) {
45
  if (element.value == 'new') {
46
  codeMirrorCss.setValue('');
47
  codeMirrorHtml.setValue('');
 
48
  jQuery('#aalb_template_name').removeAttr("readonly");
49
  jQuery('#aalb_template_name').val('');
50
  jQuery('#clone_template').attr('disabled','disabled');
@@ -61,11 +62,9 @@ function aalb_template_select_template_onchange(element) {
61
  });
62
  //Make the Amazon Default templates as Read-Only
63
  if(wp_opt.aalb_default_templates.split(",").indexOf(element.value)>=0) {
64
- codeMirrorHtml.setOption("readOnly", true);
65
- codeMirrorCss.setOption("readOnly", true);
66
  } else {
67
- codeMirrorHtml.setOption("readOnly", false);
68
- codeMirrorCss.setOption("readOnly", false);
69
  }
70
  }
71
  }
@@ -82,8 +81,7 @@ function clone_existing_template() {
82
  jQuery('#clone_template').attr('disabled','disabled');
83
  //Add CSS Prefix for Amazon Default Templates to prevent style overlapping for clones
84
  if(wp_opt.aalb_default_templates.split(",").indexOf(templateNameToClone)>=0) {
85
- codeMirrorHtml.setOption("readOnly", false);
86
- codeMirrorCss.setOption("readOnly", false);
87
  var randomNumForPrefix = Math.floor((Math.random() * 1000) + 1);
88
  var prefixRegExObject = new RegExp('aalb-', "g");
89
  var prefixReplaceValue = 'aalb-' + randomNumForPrefix + '-';
@@ -91,3 +89,12 @@ function clone_existing_template() {
91
  codeMirrorCss.setValue(codeMirrorCss.getValue().replace(prefixRegExObject, prefixReplaceValue));
92
  }
93
  }
 
 
 
 
 
 
 
 
 
45
  if (element.value == 'new') {
46
  codeMirrorCss.setValue('');
47
  codeMirrorHtml.setValue('');
48
+ set_template_read_only(false);
49
  jQuery('#aalb_template_name').removeAttr("readonly");
50
  jQuery('#aalb_template_name').val('');
51
  jQuery('#clone_template').attr('disabled','disabled');
62
  });
63
  //Make the Amazon Default templates as Read-Only
64
  if(wp_opt.aalb_default_templates.split(",").indexOf(element.value)>=0) {
65
+ set_template_read_only(true);
 
66
  } else {
67
+ set_template_read_only(false);
 
68
  }
69
  }
70
  }
81
  jQuery('#clone_template').attr('disabled','disabled');
82
  //Add CSS Prefix for Amazon Default Templates to prevent style overlapping for clones
83
  if(wp_opt.aalb_default_templates.split(",").indexOf(templateNameToClone)>=0) {
84
+ set_template_read_only(false);
 
85
  var randomNumForPrefix = Math.floor((Math.random() * 1000) + 1);
86
  var prefixRegExObject = new RegExp('aalb-', "g");
87
  var prefixReplaceValue = 'aalb-' + randomNumForPrefix + '-';
89
  codeMirrorCss.setValue(codeMirrorCss.getValue().replace(prefixRegExObject, prefixReplaceValue));
90
  }
91
  }
92
+
93
+ /**
94
+ * Sets the HTML and CSS boxes to read only if TRUE is passed.
95
+ *
96
+ */
97
+ function set_template_read_only(isReadOnly) {
98
+ codeMirrorHtml.setOption("readOnly", isReadOnly);
99
+ codeMirrorCss.setOption("readOnly", isReadOnly);
100
+ }
admin/sidebar/partials/aalb_about.php CHANGED
@@ -136,6 +136,6 @@ include 'aalb_admin_ui_common.php'; ?>
136
  Review <a target="_blank" href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-UserGuide.pdf">Link Builder User Guide</a> for more information on getting started and key features of the plugin.
137
  </p>
138
  <h2>Support</h2>
139
- <p>If you get stuck, or have any questions, you can ask for help in the <a href="https://wordpress.org/support/plugin/amazon-associates-link-builder" target="_blank">Amazon Associates Link Builder plugin forum</a></p>
140
  </div>
141
  </div>
136
  Review <a target="_blank" href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-UserGuide.pdf">Link Builder User Guide</a> for more information on getting started and key features of the plugin.
137
  </p>
138
  <h2>Support</h2>
139
+ <p>If you get stuck, or have any questions, you can ask for help in the <a href="https://wordpress.org/support/plugin/amazon-associates-link-builder" target="_blank">Amazon Associates Link Builder plugin forum</a>.</p>
140
  </div>
141
  </div>
admin/sidebar/partials/aalb_admin_ui_common.php CHANGED
@@ -21,7 +21,11 @@ if (!is_admin())
21
 
22
  if (!is_ssl()) {
23
  //action when page is NOT using SSL
24
- aalb_warning_notice('Adminstration of plugin should be done over a secure network. Please switch to HTTPS.');
 
 
 
 
25
  }
26
 
27
  ?>
21
 
22
  if (!is_ssl()) {
23
  //action when page is NOT using SSL
24
+ if(!get_option(AALB_SHOW_HTTP_WARNING_ONCE)) {
25
+ // This info message is showed only once.
26
+ aalb_info_notice('We <b>recommend</b> using HTTPs connection for improved security.');
27
+ update_option(AALB_SHOW_HTTP_WARNING_ONCE, true);
28
+ }
29
  }
30
 
31
  ?>
admin/sidebar/partials/aalb_credentials.php CHANGED
@@ -103,7 +103,7 @@ wp_localize_script('aalb_credentials_js', 'wp_opt', array('plugin_url' => AALB_P
103
  <table>
104
  <tr>
105
  <th scope="row" style="width:1%;">
106
- <input id="aalb-terms-checkbox" type="checkbox" name="demo-checkbox" value="1" <?php checked( '1', get_option(AALB_CHECKBOX_DEFAULT1) ); ?>/>
107
  </th>
108
  <td style="vertical-align:middle;">
109
  Check here to indicate that you have read and agree to the Amazon Associates Link Builder Conditions of Use as applicable for your region - <a target="_blank" href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-US.pdf">US</a>, <a target="_blank" href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-CA.pdf">CA</a>, <a target="_blank" href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-CN.pdf">CN</a>, <a target="_blank" href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-EU.pdf">EU</a>.
103
  <table>
104
  <tr>
105
  <th scope="row" style="width:1%;">
106
+ <input id="aalb-terms-checkbox" type="checkbox" name="demo-checkbox" value="1" />
107
  </th>
108
  <td style="vertical-align:middle;">
109
  Check here to indicate that you have read and agree to the Amazon Associates Link Builder Conditions of Use as applicable for your region - <a target="_blank" href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-US.pdf">US</a>, <a target="_blank" href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-CA.pdf">CA</a>, <a target="_blank" href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-CN.pdf">CN</a>, <a target="_blank" href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-EU.pdf">EU</a>.
amazon-associates-link-builder.php CHANGED
@@ -7,7 +7,7 @@
7
  /*
8
  Plugin Name: Amazon Associates Link Builder
9
  Description: Amazon Associates Link Builder is the official free Amazon Associates Program plugin for WordPress. The plugin enables you to search for products in the Amazon catalog, access real-time price and availability information, and easily create links in your posts to products on Amazon.com. You will be able to generate text links, create custom ad units, or take advantage of out-of-the-box widgets that we’ve designed and included with the plugin.
10
- Version: 1.1
11
  Author: Amazon Associates Program
12
  Author URI: https://affiliate-program.amazon.com/
13
  License: GPLv2
7
  /*
8
  Plugin Name: Amazon Associates Link Builder
9
  Description: Amazon Associates Link Builder is the official free Amazon Associates Program plugin for WordPress. The plugin enables you to search for products in the Amazon catalog, access real-time price and availability information, and easily create links in your posts to products on Amazon.com. You will be able to generate text links, create custom ad units, or take advantage of out-of-the-box widgets that we’ve designed and included with the plugin.
10
+ Version: 1.2
11
  Author: Amazon Associates Program
12
  Author URI: https://affiliate-program.amazon.com/
13
  License: GPLv2
includes/aalb_config_loader.php CHANGED
@@ -60,7 +60,7 @@ class Aalb_Config_Loader {
60
  throw new Exception('Invalid Json returned by server' . json_last_error());
61
  }
62
  $marketplaces_info = $body['Local']['Marketplace'];
63
- $updated_marketplace = [];
64
  foreach ($marketplaces_info as $key => $value) {
65
  $updated_marketplace[substr($value['Endpoint'],0,strpos($value['Endpoint'],'/'))] = $key;
66
  }
60
  throw new Exception('Invalid Json returned by server' . json_last_error());
61
  }
62
  $marketplaces_info = $body['Local']['Marketplace'];
63
+ $updated_marketplace = array();
64
  foreach ($marketplaces_info as $key => $value) {
65
  $updated_marketplace[substr($value['Endpoint'],0,strpos($value['Endpoint'],'/'))] = $key;
66
  }
includes/aalb_helper.php CHANGED
@@ -149,7 +149,7 @@ class Aalb_Helper{
149
  * @return string Version number of the plugin
150
  */
151
  function get_plugin_version() {
152
- return AALB_PLUGIN_VERSION;
153
  }
154
 
155
  /**
149
  * @return string Version number of the plugin
150
  */
151
  function get_plugin_version() {
152
+ return AALB_PLUGIN_CURRENT_VERSION;
153
  }
154
 
155
  /**
lib/php/aalb_tracking_api_helper.php CHANGED
@@ -68,7 +68,8 @@ class Aalb_Tracking_Api_Helper {
68
  $request_body = wp_json_encode($link_info);
69
  $base_url = $this->get_base_url('link-id');
70
  $response = $this->remote_loader->post($base_url, $request_body);
71
- return json_decode($response, true)["link-id"];
 
72
  }
73
 
74
  /**
68
  $request_body = wp_json_encode($link_info);
69
  $base_url = $this->get_base_url('link-id');
70
  $response = $this->remote_loader->post($base_url, $request_body);
71
+ $response_body = json_decode($response, true);
72
+ return $response_body["link-id"];
73
  }
74
 
75
  /**
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: amazonlinkbuilder
3
  Tags: Amazon, Affiliate, Associates, Amazon Associates, Amazon Associate, Product Advertising API, Amazon API, Amazon Link, Amazon Ad, Amazon Affiliate, eCommerce
4
  Requires at least: 3.0.1
5
- Tested up to: 4.4
6
- Stable tag: 1.1
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -88,6 +88,12 @@ You can search products using keywords in any supported country, but you have to
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
 
91
  = 1.1 - December 13, 2016 =
92
  * Fix: Rendering of search results in Apple Safari browser.
93
 
@@ -96,5 +102,5 @@ You can search products using keywords in any supported country, but you have to
96
 
97
  == Upgrade Notice ==
98
 
99
- = 1.1 =
100
- Install the Amazon Associates Link Builder plugin for WordPress!
2
  Contributors: amazonlinkbuilder
3
  Tags: Amazon, Affiliate, Associates, Amazon Associates, Amazon Associate, Product Advertising API, Amazon API, Amazon Link, Amazon Ad, Amazon Affiliate, eCommerce
4
  Requires at least: 3.0.1
5
+ Tested up to: 4.7.0
6
+ Stable tag: 1.2
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
88
 
89
  == Changelog ==
90
 
91
+ = 1.2 - December 19, 2016 =
92
+ * If you are using custom templates, be sure to take a backup of your templates before updating the plugin by following [these instructions](https://s3.amazonaws.com/aalb-public-resources/documents/Guidance-BackupCustomTemplate.pdf). If you are not using custom templates, you can simply update the plugin using the update now link.
93
+ * Fix: Array dereference issue with PHP version 5.3. You will no longer get PHP syntax issues while activating the plugin.
94
+ * Administration of the plugin over a secured network (HTTPS) is recommended and not required.
95
+ * Updated [plugin user guide](https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-UserGuide.pdf).
96
+
97
  = 1.1 - December 13, 2016 =
98
  * Fix: Rendering of search results in Apple Safari browser.
99
 
102
 
103
  == Upgrade Notice ==
104
 
105
+ = 1.2 =
106
+ You will no longer get PHP syntax issues while activating the plugin. Take a backup of your custom templates before updating the plugin.