Amazon Associates Link Builder - Version 1.4.6

Version Description

Fix for the issue of big Amazon logo and plugin unusable in some editors.

Download this release

Release Info

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

Code changes from version 1.4.5 to 1.4.6

aalb_config.php CHANGED
@@ -13,7 +13,7 @@ and limitations under the License.
13
  */
14
 
15
  //version
16
- define( 'AALB_PLUGIN_CURRENT_VERSION', '1.4.5' );
17
 
18
  //PHP version compatible for AALB plugin
19
  define('AALB_PLUGIN_MINIMUM_SUPPORTED_PHP_VERSION','5.3.0');
@@ -127,7 +127,7 @@ define( 'CODEMIRROR_CSS', 'https://d8fd03967nrad.cloudfront.net/libs/codemirror/
127
  define( 'AALB_SECURE_HOSTNAME', 'https://images-na.ssl-images-amazon.com/' );
128
  define( 'AALB_NORMAL_HOSTNAME', 'http://g-ecx.images-amazon.com/' );
129
  define( 'AALB_ICON_LOCATION', 'images/G/01/PAAPI/AmazonAssociatesLinkBuilder/icon-2._V276841048_.png' );
130
- define( 'AALB_ADMIN_ICON_LOCATION', 'images/G/01/PAAPI/AmazonAssociatesLinkBuilder/icon._V278877987_.png' );
131
  //AALB_ICON URL is generated by wordpress at run-time by checking the remotehost's encryption. Image source has different URLs depending upon the encryption used.
132
  if ( is_ssl() ) {
133
  define( 'AALB_ICON', AALB_SECURE_HOSTNAME . AALB_ICON_LOCATION );
13
  */
14
 
15
  //version
16
+ define( 'AALB_PLUGIN_CURRENT_VERSION', '1.4.6' );
17
 
18
  //PHP version compatible for AALB plugin
19
  define('AALB_PLUGIN_MINIMUM_SUPPORTED_PHP_VERSION','5.3.0');
127
  define( 'AALB_SECURE_HOSTNAME', 'https://images-na.ssl-images-amazon.com/' );
128
  define( 'AALB_NORMAL_HOSTNAME', 'http://g-ecx.images-amazon.com/' );
129
  define( 'AALB_ICON_LOCATION', 'images/G/01/PAAPI/AmazonAssociatesLinkBuilder/icon-2._V276841048_.png' );
130
+ define( 'AALB_ADMIN_ICON_LOCATION', 'images/G/01/PAAPI/AmazonAssociatesLinkBuilder/amazon_icon._V506839993_.png' );
131
  //AALB_ICON URL is generated by wordpress at run-time by checking the remotehost's encryption. Image source has different URLs depending upon the encryption used.
132
  if ( is_ssl() ) {
133
  define( 'AALB_ICON', AALB_SECURE_HOSTNAME . AALB_ICON_LOCATION );
admin/aalb_admin.php CHANGED
@@ -49,16 +49,12 @@ class Aalb_Admin {
49
  }
50
 
51
  /**
52
- * Adding CSS for post and post-new pages
53
  *
54
- * @since 1.0.0
55
  *
56
- * @param string $hook The name of the WordPress action that is being registered.
57
  */
58
- public function enqueue_styles( $hook ) {
59
- if ( WP_POST != $hook && WP_POST_NEW != $hook ) {
60
- return;
61
- }
62
  wp_enqueue_style( 'aalb_basics_css', AALB_BASICS_CSS, array(), AALB_PLUGIN_CURRENT_VERSION );
63
  wp_enqueue_style( 'aalb_admin_css', AALB_ADMIN_CSS, array(), AALB_PLUGIN_CURRENT_VERSION );
64
  wp_enqueue_style( 'font_awesome_css', FONT_AWESOME_CSS );
@@ -66,23 +62,16 @@ class Aalb_Admin {
66
  }
67
 
68
  /**
69
- * Adding JS for post and post-new pages
70
  *
71
- * @since 1.0.0
72
  *
73
- * @param string $hook The name of the WordPress action that is being registered.
74
  */
75
- public function enqueue_scripts( $hook ) {
76
- if ( WP_POST != $hook && WP_POST_NEW != $hook ) {
77
- return;
78
- }
79
- wp_enqueue_style( 'thickbox' );
80
  wp_enqueue_script( 'jquery' );
81
  wp_enqueue_script( 'handlebars_js', HANDLEBARS_JS );
82
  wp_enqueue_script( 'aalb_sha2_js', AALB_SHA2_JS, array(), AALB_PLUGIN_CURRENT_VERSION );
83
-
84
  wp_enqueue_script( 'aalb_admin_js', AALB_ADMIN_JS, array( 'handlebars_js', 'jquery', 'aalb_sha2_js' ), AALB_PLUGIN_CURRENT_VERSION );
85
- wp_enqueue_style( 'thickbox' );
86
  wp_localize_script( 'aalb_admin_js', 'api_pref', $this->get_paapi_pref() );
87
  wp_localize_script( 'aalb_admin_js', 'aalb_strings', $this->get_aalb_strings() );
88
  }
49
  }
50
 
51
  /**
52
+ * Enqueue CSS classes
53
  *
54
+ * @since 1.4.6
55
  *
 
56
  */
57
+ public function aalb_enqueue_styles() {
 
 
 
58
  wp_enqueue_style( 'aalb_basics_css', AALB_BASICS_CSS, array(), AALB_PLUGIN_CURRENT_VERSION );
59
  wp_enqueue_style( 'aalb_admin_css', AALB_ADMIN_CSS, array(), AALB_PLUGIN_CURRENT_VERSION );
60
  wp_enqueue_style( 'font_awesome_css', FONT_AWESOME_CSS );
62
  }
63
 
64
  /**
65
+ * Enqueue JS files
66
  *
67
+ * @since 1.4.6
68
  *
 
69
  */
70
+ public function aalb_enqueue_scripts() {
 
 
 
 
71
  wp_enqueue_script( 'jquery' );
72
  wp_enqueue_script( 'handlebars_js', HANDLEBARS_JS );
73
  wp_enqueue_script( 'aalb_sha2_js', AALB_SHA2_JS, array(), AALB_PLUGIN_CURRENT_VERSION );
 
74
  wp_enqueue_script( 'aalb_admin_js', AALB_ADMIN_JS, array( 'handlebars_js', 'jquery', 'aalb_sha2_js' ), AALB_PLUGIN_CURRENT_VERSION );
 
75
  wp_localize_script( 'aalb_admin_js', 'api_pref', $this->get_paapi_pref() );
76
  wp_localize_script( 'aalb_admin_js', 'aalb_strings', $this->get_aalb_strings() );
77
  }
admin/css/aalb_admin.css CHANGED
@@ -14,12 +14,6 @@ and limitations under the License.
14
  display: inline;
15
  }
16
 
17
- .aalb-admin-searchbox-amzlogo {
18
- width: 30px;
19
- height: 30px;
20
- padding: 0px;
21
- }
22
-
23
  input.aalb-admin-input-search {
24
  vertical-align: top;
25
  margin-left: 3px;
@@ -476,4 +470,4 @@ input.aalb-admin-input-search:disabled {
476
  text-decoration: underline !important;
477
  color: #0073aa !important;
478
  font-weight: bold;
479
- }
14
  display: inline;
15
  }
16
 
 
 
 
 
 
 
17
  input.aalb-admin-input-search {
18
  vertical-align: top;
19
  margin-left: 3px;
470
  text-decoration: underline !important;
471
  color: #0073aa !important;
472
  font-weight: bold;
473
+ }
admin/partials/aalb_editor_search_box.php CHANGED
@@ -13,6 +13,9 @@ and limitations under the License.
13
 
14
  <?php
15
  $aalb_settings_page_url = admin_url( 'admin.php?page=associates-link-builder-settings' ) ;
 
 
 
16
  ?>
17
 
18
  <!--
13
 
14
  <?php
15
  $aalb_settings_page_url = admin_url( 'admin.php?page=associates-link-builder-settings' ) ;
16
+ $aalb_admin = new Aalb_Admin();
17
+ $aalb_admin->aalb_enqueue_styles();
18
+ $aalb_admin->aalb_enqueue_scripts();
19
  ?>
20
 
21
  <!--
admin/partials/aalb_meta_box.php CHANGED
@@ -23,6 +23,9 @@ $config_loader = new Aalb_Config_Loader();
23
  $aalb_marketplace_names = $config_loader->fetch_marketplaces();
24
  $helper = new Aalb_Helper();
25
  $aalb_store_id_names = $helper->get_store_ids_array();
 
 
 
26
  ?>
27
  <!-- keeping css inline as css file does not load at plugin initialization -->
28
  <div id="aalb-admin-popup-container" style="display:none;">
23
  $aalb_marketplace_names = $config_loader->fetch_marketplaces();
24
  $helper = new Aalb_Helper();
25
  $aalb_store_id_names = $helper->get_store_ids_array();
26
+ $aalb_admin = new Aalb_Admin();
27
+ $aalb_admin->aalb_enqueue_styles();
28
+ $aalb_admin->aalb_enqueue_scripts();
29
  ?>
30
  <!-- keeping css inline as css file does not load at plugin initialization -->
31
  <div id="aalb-admin-popup-container" style="display:none;">
admin/sidebar/partials/aalb_templates.php CHANGED
@@ -127,7 +127,7 @@ if ( ! empty( $_POST["submit"] ) ) {
127
  aalb_error_notice( "Save Failed. Only alphanumeric characters allowed for template name." );
128
  } else {
129
  if ( ! is_dir( $aalb_template_upload_dir ) or ! is_writable( $aalb_template_upload_dir ) ) {
130
- aalb_error_notice( $aalb_template_upload_dir . " doesn't exist or is not writable. Please set up Read-Write permissions for <ApacheHomeFolder>/wordpress/wp-content/uploads/amazon-associates-link-builder/template/" );
131
  } else {
132
  //Check if template of that name already exists
133
  if ( in_array( $aalb_template_name, $aalb_template_names ) ) {
127
  aalb_error_notice( "Save Failed. Only alphanumeric characters allowed for template name." );
128
  } else {
129
  if ( ! is_dir( $aalb_template_upload_dir ) or ! is_writable( $aalb_template_upload_dir ) ) {
130
+ aalb_error_notice( "Failed to create custom template. Please set up recursive Read-Write permissions for " . $helper->aalb_get_uploads_dir_path() );
131
  } else {
132
  //Check if template of that name already exists
133
  if ( in_array( $aalb_template_name, $aalb_template_names ) ) {
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.4.5
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.4.6
11
  Author: Amazon Associates Program
12
  Author URI: https://affiliate-program.amazon.com/
13
  License: GPLv2
includes/aalb_helper.php CHANGED
@@ -222,19 +222,16 @@ class Aalb_Helper {
222
  * If the dir doesn't exists, it is created and returned.
223
  *
224
  * @since 1.3
225
- * @return Full directory path of the template uploads directory
226
  */
227
  public function get_template_upload_directory() {
228
  global $wp_filesystem;
229
  $this->aalb_initialize_wp_filesystem_api();
230
- $aalb_template_upload_dir = $this->get_template_upload_directory_name( $wp_filesystem );
231
- if ( ! $wp_filesystem->is_dir( $aalb_template_upload_dir ) ) {
232
- if ( ! $this->create_template_upload_dir( $aalb_template_upload_dir ) ) {
233
  return false;
234
- }
235
  }
236
-
237
- return $aalb_template_upload_dir;
238
  }
239
 
240
  /**
@@ -243,27 +240,36 @@ class Aalb_Helper {
243
  * @since 1.3
244
  * @return full path of the template uploads directory
245
  */
246
- public function get_template_upload_directory_name() {
247
- global $wp_filesystem;
248
- $upload_dir = wp_upload_dir();
249
-
250
- return $wp_filesystem->find_folder( $upload_dir['basedir'] ) . AALB_TEMPLATE_UPLOADS_FOLDER;
251
  }
252
 
253
  /**
254
- * Creates the Uploads Directory where custom templates are stored
255
  *
256
- * @since 1.3
257
- * @return TRUE on successful creation of the dir; FALSE otherwise
258
  */
259
- public function create_template_upload_dir( $aalb_template_upload_dir ) {
260
  global $wp_filesystem;
261
- if ( ! wp_mkdir_p( $aalb_template_upload_dir ) ) {
262
- error_log( "Error Creating Dir . " . $aalb_template_upload_dir . ". Please set the folder permissions correctly." );
 
 
263
 
 
 
 
 
 
 
 
 
 
 
 
264
  return false;
265
  }
266
-
267
  return true;
268
  }
269
 
222
  * If the dir doesn't exists, it is created and returned.
223
  *
224
  * @since 1.3
225
+ * @return string Full directory path of the template uploads directory
226
  */
227
  public function get_template_upload_directory() {
228
  global $wp_filesystem;
229
  $this->aalb_initialize_wp_filesystem_api();
230
+ $template_upload_path = $this->aalb_get_template_upload_path();
231
+ if ( ! $wp_filesystem->is_dir( $template_upload_path ) && ! $this->aalb_create_dir( $template_upload_path ) ) {
 
232
  return false;
 
233
  }
234
+ return $template_upload_path;
 
235
  }
236
 
237
  /**
240
  * @since 1.3
241
  * @return full path of the template uploads directory
242
  */
243
+ private function aalb_get_template_upload_path() {
244
+ return $this->aalb_get_uploads_dir_path() . AALB_TEMPLATE_UPLOADS_FOLDER;
 
 
 
245
  }
246
 
247
  /**
248
+ * Gets the uploads dir name of AALB plugin.
249
  *
250
+ * @since 1.4.6
251
+ * @return full path of the uploads directory of AALB
252
  */
253
+ public function aalb_get_uploads_dir_path() {
254
  global $wp_filesystem;
255
+ $upload_dir = wp_upload_dir();
256
+ //TODO: Reason for not using directly use $upload_dir['basedir'] instead of calling find_folder
257
+ return $wp_filesystem->find_folder( $upload_dir['basedir'] );
258
+ }
259
 
260
+ /**
261
+ * Creates the Directory
262
+ *
263
+ * @param $dir_path path of directory
264
+ *
265
+ * @since 1.4.6
266
+ * @return boolean true on successful creation of the dir; false otherwise
267
+ */
268
+ public function aalb_create_dir( $dir_path ) {
269
+ if ( ! wp_mkdir_p( $dir_path ) ) {
270
+ error_log( "Error Creating Dir " . $dir_path . ". Please set the folder permissions correctly." );
271
  return false;
272
  }
 
273
  return true;
274
  }
275
 
includes/aalb_manager.php CHANGED
@@ -42,8 +42,6 @@ class Aalb_Manager {
42
  */
43
  private function add_admin_hooks() {
44
  $aalb_admin = new Aalb_Admin();
45
- $this->hook_loader->add_action( 'admin_enqueue_scripts', $aalb_admin, 'enqueue_styles' );
46
- $this->hook_loader->add_action( 'admin_enqueue_scripts', $aalb_admin, 'enqueue_scripts' );
47
  $this->hook_loader->add_action( 'admin_print_footer_scripts', $aalb_admin, 'add_quicktags' );
48
  $this->hook_loader->add_action( 'wp_ajax_get_item_search_result', $aalb_admin, 'get_item_search_result' );
49
  $this->hook_loader->add_action( 'wp_ajax_get_link_code', $aalb_admin, 'get_link_code' );
42
  */
43
  private function add_admin_hooks() {
44
  $aalb_admin = new Aalb_Admin();
 
 
45
  $this->hook_loader->add_action( 'admin_print_footer_scripts', $aalb_admin, 'add_quicktags' );
46
  $this->hook_loader->add_action( 'wp_ajax_get_item_search_result', $aalb_admin, 'get_item_search_result' );
47
  $this->hook_loader->add_action( 'wp_ajax_get_link_code', $aalb_admin, 'get_link_code' );
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.8.0
6
- Stable tag: 1.4.5
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -100,6 +100,11 @@ Amazon Product Advertising API credentials are not required to use the feature t
100
 
101
  == Changelog ==
102
 
 
 
 
 
 
103
  = 1.4.5 - June 13, 2017 =
104
  * Prime branding changes.
105
  * UI Change: Settings page revamped.
@@ -159,6 +164,10 @@ Amazon Product Advertising API credentials are not required to use the feature t
159
  * Plugin released for beta testing
160
 
161
  == Upgrade Notice ==
 
 
 
 
162
  = 1.4.5 =
163
  Prime branding changes, feature to remove rel="noreferrer" from Amazon Affiliate links.
164
 
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.8.0
6
+ Stable tag: 1.4.6
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
100
 
101
  == Changelog ==
102
 
103
+ = 1.4.6 - June 21, 2017 =
104
+ * Fix: Amazon logo appears too big in some editors.
105
+ * Fix: Plugin doesn't work in some editors.
106
+ * Fix: Custom template creation error message not correct.
107
+
108
  = 1.4.5 - June 13, 2017 =
109
  * Prime branding changes.
110
  * UI Change: Settings page revamped.
164
  * Plugin released for beta testing
165
 
166
  == Upgrade Notice ==
167
+
168
+ = 1.4.6 =
169
+ Fix for the issue of big Amazon logo and plugin unusable in some editors.
170
+
171
  = 1.4.5 =
172
  Prime branding changes, feature to remove rel="noreferrer" from Amazon Affiliate links.
173