Amazon Associates Link Builder - Version 1.4.9

Version Description

Download this release

Release Info

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

Code changes from version 1.4.8 to 1.4.9

aalb_config.php CHANGED
@@ -13,13 +13,13 @@ and limitations under the License.
13
  */
14
 
15
  //version
16
- define( 'AALB_PLUGIN_CURRENT_VERSION', '1.4.8' );
17
 
18
  //PHP version compatible for AALB plugin
19
- define('AALB_PLUGIN_MINIMUM_SUPPORTED_PHP_VERSION','5.3.0');
20
 
21
  //Plugin Name
22
- define('AALB_PLUGIN_NAME','Amazon Associates Link Builder');
23
  //paths
24
  define( 'AALB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
25
  define( 'AALB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
@@ -180,26 +180,19 @@ define( 'PAAPI_SERVICE', 'AWSECommerceService' );
180
  define( 'PAAPI_VERSION', '2013-08-01' );
181
  define( 'PAAPI_URL_REGEX', '^https:\\/\\/(.*)\\/onca\\/xml\\?(.*)$' );
182
 
183
- define('PAAPI_INVALID_PARAMETER_VALUE_ERROR', 'AWS.InvalidParameterValue');
184
 
185
  // PAAPI Request Timeout in seconds
186
- define("PAAPI_REQUEST_TIMEOUT", 35);
187
 
188
  //HTTP Status Codes
189
  define( 'HTTP_SUCCESS', '200' );
190
- define( 'HTTP_SUCCESS_MESSAGE', '<h4>Request Successful</h4>' );
191
  define( 'HTTP_BAD_REQUEST', '400' );
192
- define( 'HTTP_BAD_REQUEST_MESSAGE', '<h4>Your AWS Access Key Id is not registered as an Amazon Associate. Please verify that you are <a href="http://docs.aws.amazon.com/AWSECommerceService/latest/DG/becomingAssociate.html" target="_blank">registered as an Amazon Associate</a> in respective locale and you added the email address registered for the Product Advertising API as a <a href="https://affiliate-program.amazon.com/help/node/topic/202049770" target="_blank">secondary email address in your Amazon Associates account</a>.</h4>' );
193
  define( 'HTTP_REQUEST_URI_TOO_LONG', '414' );
194
- define( 'HTTP_REQUEST_URI_TOO_LONG_MESSAGE', '<h4>Your AccessKey Id is not registered for Product Advertising API. Please sign up for Product Advertising API by <a href="http://docs.aws.amazon.com/AWSECommerceService/latest/DG/becomingDev.html" target="_blank">following these guidelines</a>.</h4>' );
195
  define( 'HTTP_FORBIDDEN', '403' );
196
- define( 'HTTP_FORBIDDEN_MESSAGE', '<h4>Your AccessKey Id is not registered for Product Advertising API. Please sign up for Product Advertising API by <a href="http://docs.aws.amazon.com/AWSECommerceService/latest/DG/becomingDev.html" target="_blank">following these guidelines</a>.</h4>' );
197
  define( 'HTTP_INTERNAL_SERVER_ERROR', '500' );
198
- define( 'HTTP_INTERNAL_SERVER_ERROR_MESSAGE', '<h4>Internal server error</h4>' );
199
  define( 'HTTP_THROTTLE', '503' );
200
- define( 'HTTP_THROTTLE_MESSAGE', '<h4>You are submitting requests too quickly. Please retry your requests at a slower rate. For more information, see <a href="http://docs.aws.amazon.com/AWSECommerceService/latest/DG/TroubleshootingApplications.html#efficiency-guidelines" target="_blank">Efficiency Guidelines</a>.</h4>' );
201
  define( 'HTTP_TIME_OUT', '504' );
202
- define( 'HTTP_TIME_OUT_MESSAGE', '<h4>Request timed out. Try again after some time. Please check you network and firewall settings. If the error still persists, write to us at link-builder@amazon.com.</h4>' );
203
 
204
  /**
205
  * Cipher
@@ -263,8 +256,30 @@ $AALB_AMAZON_DOMAINS = array(
263
  );
264
 
265
  //Wordpress Server Timeout in milliseconds
266
- define("AALB_WORDPRESS_REQUEST_TIMEOUT", 40000);
267
 
268
  //Curl Timeout Error String
269
- define('CURL_ERROR_TIMEOUT_STRING','cURL error 28');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  ?>
13
  */
14
 
15
  //version
16
+ define( 'AALB_PLUGIN_CURRENT_VERSION', '1.4.9' );
17
 
18
  //PHP version compatible for AALB plugin
19
+ define( 'AALB_PLUGIN_MINIMUM_SUPPORTED_PHP_VERSION', '5.3.0' );
20
 
21
  //Plugin Name
22
+ define( 'AALB_PLUGIN_NAME', 'Amazon Associates Link Builder' );
23
  //paths
24
  define( 'AALB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
25
  define( 'AALB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
180
  define( 'PAAPI_VERSION', '2013-08-01' );
181
  define( 'PAAPI_URL_REGEX', '^https:\\/\\/(.*)\\/onca\\/xml\\?(.*)$' );
182
 
183
+ define( 'PAAPI_INVALID_PARAMETER_VALUE_ERROR', 'AWS.InvalidParameterValue' );
184
 
185
  // PAAPI Request Timeout in seconds
186
+ define( "PAAPI_REQUEST_TIMEOUT", 35 );
187
 
188
  //HTTP Status Codes
189
  define( 'HTTP_SUCCESS', '200' );
 
190
  define( 'HTTP_BAD_REQUEST', '400' );
 
191
  define( 'HTTP_REQUEST_URI_TOO_LONG', '414' );
 
192
  define( 'HTTP_FORBIDDEN', '403' );
 
193
  define( 'HTTP_INTERNAL_SERVER_ERROR', '500' );
 
194
  define( 'HTTP_THROTTLE', '503' );
 
195
  define( 'HTTP_TIME_OUT', '504' );
 
196
 
197
  /**
198
  * Cipher
256
  );
257
 
258
  //Wordpress Server Timeout in milliseconds
259
+ define( "AALB_WORDPRESS_REQUEST_TIMEOUT", 40000 );
260
 
261
  //Curl Timeout Error String
262
+ define( 'CURL_ERROR_TIMEOUT_STRING', 'cURL error 28' );
263
+
264
+ //Support Email-Id
265
+ define( 'AALB_SUPPORT_EMAIL_ID', 'link-builder@amazon.com' );
266
+
267
+ //Plugin Specific URLs
268
+ define( 'AALB_CONDITIONS_OF_USE_URL', 'https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-2017-01-17.pdf' );
269
+ define( 'AALB_USER_GUIDE_URL', 'https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-UserGuide.pdf' );
270
+ define( 'AALB_SUPPORT_FORUM_URL', 'https://wordpress.org/support/plugin/amazon-associates-link-builder' );
271
+
272
+ //Associate URLs
273
+ define( 'AALB_GETTING_STARTED_URL', 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/CHAP_GettingStarted.html' );
274
+ define( 'AALB_AFFILIATE_WEBSITE_URL', 'https://affiliate-program.amazon.com' );
275
+ define( 'AALB_ADDING_SECONDARY_USER_AC_URL', 'https://affiliate-program.amazon.com/help/node/topic/202049770' );
276
+ define( 'AALB_ASSOCIATE_SIGN_UP_URL', 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/becomingAssociate.html' );
277
+
278
+ //PAAPI URLs
279
+ define( 'AALB_PAAPI_SIGN_UP_URL', 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/becomingDev.html' );
280
+ define( 'AALB_MANAGE_PAAPI_US_ACCOUNT_URL', 'https://affiliate-program.amazon.com/gp/advertising/api/detail/your-account.html' );
281
+ define( 'AALB_PAAPI_EFFICIENCY_GUIDELINES_URL', 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/TroubleshootingApplications.html#efficiency-guidelines' );
282
+
283
+ define( 'AALB_NEW_PAGE_TARGET', "_blank" );
284
+
285
  ?>
admin/aalb_admin.php CHANGED
@@ -107,11 +107,13 @@ class Aalb_Admin {
107
  */
108
  private function get_aalb_strings() {
109
  return array(
110
- "template_asin_error" => "Only one product can be selected for template",
111
- "no_asin_selected_error" => "Please select at least one product for display",
112
- "empty_product_search_bar" => "Please Enter a Product Name ",
113
- "short_code_create_failure" => "Failed to create Text Link shortcode. Editor has some text selected. Only one item can be selected while adding text links",
114
- "paapi_request_timeout_error" => HTTP_TIME_OUT_MESSAGE
 
 
115
  );
116
  }
117
 
@@ -240,7 +242,7 @@ class Aalb_Admin {
240
  $real_mustache_file = realpath( $mustache_file );
241
  if ( $real_css_file === false || $real_mustache_file === false || strpos( $real_css_file, $base_path ) !== 0 || strpos( $real_mustache_file, $base_path ) !== 0 ) {
242
  //If base path is not a prefix of the realpath, this means that a directry traversal was attempted
243
- die( 'Not authorised to make request template content or Directory Traversal Attempted.' );
244
  } else {
245
  //No vulnerability. Get file contents.
246
  $css_file_content = $wp_filesystem->get_contents( $css_file );
@@ -250,7 +252,7 @@ class Aalb_Admin {
250
  echo json_encode( $response );
251
  }
252
  } else {
253
- die( 'Not authorised to make request' );
254
  }
255
  wp_die();
256
  }
107
  */
108
  private function get_aalb_strings() {
109
  return array(
110
+ "template_asin_error" => esc_html__( "Only one product can be selected for this template", 'amazon-associates-link-builder' ),
111
+ "no_asin_selected_error" => esc_html__( "Please select at least one product for display", 'amazon-associates-link-builder' ),
112
+ "empty_product_search_bar" => esc_html__( "Please Enter a Product Name ", 'amazon-associates-link-builder' ),
113
+ "short_code_create_failure" => esc_html__( "Failed to create Text Link shortcode. Editor has some text selected. Only one item can be selected while adding text links", 'amazon-associates-link-builder' ),
114
+ /* translators: %s: Email-id of the support */
115
+ "paapi_request_timeout_error" => sprintf( esc_html__( "Request timed out. Try again after some time. Please check your network and firewall settings. If the error still persists, write to us at %s.", 'amazon-associates-link-builder' ), AALB_SUPPORT_EMAIL_ID ),
116
+ "add_aalb_shortcode" => esc_html__( "Add Amazon Associates Link Builder Shortcode", 'amazon-associates-link-builder' )
117
  );
118
  }
119
 
242
  $real_mustache_file = realpath( $mustache_file );
243
  if ( $real_css_file === false || $real_mustache_file === false || strpos( $real_css_file, $base_path ) !== 0 || strpos( $real_mustache_file, $base_path ) !== 0 ) {
244
  //If base path is not a prefix of the realpath, this means that a directry traversal was attempted
245
+ die( esc_html__( "Not authorised to make request template content or Directory Traversal Attempted.", 'amazon-associates-link-builder' ) );
246
  } else {
247
  //No vulnerability. Get file contents.
248
  $css_file_content = $wp_filesystem->get_contents( $css_file );
252
  echo json_encode( $response );
253
  }
254
  } else {
255
+ die( esc_html__( 'Not authorised to make request', 'amazon-associates-link-builder' ) );
256
  }
257
  wp_die();
258
  }
admin/js/aalb_admin.js CHANGED
@@ -61,7 +61,7 @@ jQuery( document ).ready( function() {
61
  var aalb_add_short_code_button = jQuery( '#aalb-add-shortcode-button' );
62
  //checking for user selected template and number of products selected by user
63
  if( ( selected_products > 1 ) && SINGLE_ASIN_TEMPLATE[ user_selected_template ] ) {
64
- jQuery( '#aalb-add-template-asin-error' ).text( aalb_strings.template_asin_error + ' ' + user_selected_template );
65
  aalb_add_short_code_button.prop( 'disabled', true );
66
 
67
  } else {
@@ -141,7 +141,7 @@ function aalb_admin_show_create_shortcode_popup( search_button ) {
141
  var search_keywords = editor_selected_text || editor_search_box_input.val();
142
  if ( search_keywords ) {
143
 
144
- tb_show( 'Add Amazon Associates Link Builder Shortcode', '#TB_inline?inlineId=aalb-admin-popup-container', false );
145
  resize_thickbox();
146
 
147
  // Getting the ItemSearch results
@@ -489,7 +489,7 @@ function aalb_validate_asins( asin, action ) {
489
  if( ( !template_asin_error ) ) {
490
  aalb_reset_add_short_button_and_error_warnings();
491
  } else {
492
- jQuery( '#aalb-add-template-asin-error' ).text( aalb_strings.template_asin_error + ' ' + selected_template );
493
  aalb_add_short_code_button.prop( 'disabled', true );
494
  }
495
  return true;
61
  var aalb_add_short_code_button = jQuery( '#aalb-add-shortcode-button' );
62
  //checking for user selected template and number of products selected by user
63
  if( ( selected_products > 1 ) && SINGLE_ASIN_TEMPLATE[ user_selected_template ] ) {
64
+ jQuery( '#aalb-add-template-asin-error' ).text( aalb_strings.template_asin_error );
65
  aalb_add_short_code_button.prop( 'disabled', true );
66
 
67
  } else {
141
  var search_keywords = editor_selected_text || editor_search_box_input.val();
142
  if ( search_keywords ) {
143
 
144
+ tb_show( aalb_strings.add_aalb_shortcode, '#TB_inline?inlineId=aalb-admin-popup-container', false );
145
  resize_thickbox();
146
 
147
  // Getting the ItemSearch results
489
  if( ( !template_asin_error ) ) {
490
  aalb_reset_add_short_button_and_error_warnings();
491
  } else {
492
+ jQuery( '#aalb-add-template-asin-error' ).text( aalb_strings.template_asin_error );
493
  aalb_add_short_code_button.prop( 'disabled', true );
494
  }
495
  return true;
admin/partials/aalb_editor_search_box.php CHANGED
@@ -12,7 +12,7 @@ and limitations under the License.
12
  -->
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();
@@ -25,14 +25,16 @@ $aalb_admin->aalb_enqueue_scripts();
25
  -->
26
 
27
  <div class="aalb-admin-inline aalb-admin-searchbox">
28
- <span class="aalb-admin-searchbox-tooltip-disabled">Please configure your PA-API credentials in the <a href= <?php echo $aalb_settings_page_url ?> >Settings Page</a> to use the Link Builder features.
 
 
29
  </span>
30
  <img src=<?= AALB_ADMIN_ICON ?> class="aalb-admin-searchbox-amzlogo">
31
  <input type="text" class="aalb-admin-input-search"
32
  name="aalb-admin-input-search"
33
- placeholder="Enter keyword(s)"
34
- onkeypress='aalb_submit_event(event,"aalb-admin-button-create-amazon-shortcode",this)'/>
35
- <a class="button aalb-admin-button-create-amazon-shortcode" title="Add Amazon Associates Link Builder Shortcode"
36
- onclick="aalb_admin_show_create_shortcode_popup(this)">Search
37
  </a>
38
  </div>
12
  -->
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();
25
  -->
26
 
27
  <div class="aalb-admin-inline aalb-admin-searchbox">
28
+ <span class="aalb-admin-searchbox-tooltip-disabled"><?php
29
+ /* translators: %s: URL of settings page */
30
+ printf( __( "Please configure your PA-API credentials in the <a href=%s>Settings Page</a> to use the Link Builder features.", 'amazon-associates-link-builder' ), $aalb_settings_page_url ); ?>
31
  </span>
32
  <img src=<?= AALB_ADMIN_ICON ?> class="aalb-admin-searchbox-amzlogo">
33
  <input type="text" class="aalb-admin-input-search"
34
  name="aalb-admin-input-search"
35
+ placeholder="<?php esc_attr_e( "Enter keyword(s)", 'amazon-associates-link-builder' ) ?>"
36
+ onkeypress='aalb_submit_event(event,"aalb-admin-button-create-amazon-shortcode",this)' />
37
+ <a class="button aalb-admin-button-create-amazon-shortcode" title="<?php esc_attr_e( "Add Amazon Associates Link Builder Shortcode", 'amazon-associates-link-builder' ) ?>"
38
+ onclick="aalb_admin_show_create_shortcode_popup(this)"><?php esc_html_e( "Search", 'amazon-associates-link-builder' ) ?>
39
  </a>
40
  </div>
admin/partials/aalb_meta_box.php CHANGED
@@ -34,16 +34,16 @@ $aalb_admin->aalb_enqueue_scripts();
34
  <div id="aalb-admin-popup-container" style="display:none;">
35
  <div class="aalb-admin-searchbox aalb-admin-popup-options">
36
  <input type="text" id="aalb-admin-popup-input-search" name="aalb-admin-popup-input-search"
37
- placeholder="Enter keyword(s)" onkeypress='aalb_submit_event(event,"aalb-btn-primary",this)'/>
38
  <button class="aalb-btn aalb-btn-primary" id="aalb-admin-popup-search-button" type="button"
39
- onclick="aalb_admin_popup_search_items()" style="margin-top:1%">Search
40
  </button>
41
  </div><!--end .aalb-admin-popup-options-->
42
  <!-- start: aalb-admin-popup-shortcode-options-->
43
  <div class="aalb-admin-popup-shortocde-wrapper">
44
  <div class="aalb-admin-popup-shortcode-options">
45
  <div class="aalb-admin-item-search-templates">
46
- <label>Ad Template</label>
47
  <?php $aalb_default_template = get_option( AALB_DEFAULT_TEMPLATE, AALB_DEFAULT_TEMPLATE_NAME ); ?>
48
  <select id="aalb_template_names_list" name="aalb_template_names_list" >
49
  <?php foreach ( $aalb_template_names as $aalb_template_name ) { ?>
@@ -52,7 +52,7 @@ $aalb_admin->aalb_enqueue_scripts();
52
  </select>
53
  </div>
54
  <div class="aalb-admin-popup-store">
55
- <label>Associate ID</label>
56
  <?php $aalb_default_store_id = get_option( AALB_DEFAULT_STORE_ID, AALB_DEFAULT_STORE_ID_NAME ); ?>
57
  <select id="aalb-admin-popup-store-id" name="aalb-admin-popup-store-id" >
58
  <?php foreach ( $aalb_store_id_names as $aalb_store_id ) { ?>
@@ -61,7 +61,7 @@ $aalb_admin->aalb_enqueue_scripts();
61
  </select>
62
  </div>
63
  <div class="aalb-admin-item-search-marketplaces">
64
- <label>Marketplace</label>
65
  <?php $aalb_default_marketplace = get_option( AALB_DEFAULT_MARKETPLACE, AALB_DEFAULT_MARKETPLACE_NAME ); ?>
66
  <select id="aalb_marketplace_names_list" name="aalb_marketplace_names_list" >
67
  <?php foreach ( $aalb_marketplace_names as $aalb_marketplace => $aalb_marketplace_abbr ) { ?>
@@ -74,24 +74,23 @@ $aalb_admin->aalb_enqueue_scripts();
74
  <div id="aalb-admin-popup-content">
75
  <div class="aalb-admin-alert aalb-admin-alert-info aalb-admin-item-search-loading">
76
  <div class="aalb-admin-icon"><i class="fa fa-spinner fa-pulse"></i></div>
77
- Searching relevant products from Amazon
78
  </div><!--end .aalb-admin-item-search-loading-->
79
  <div class="aalb-admin-item-search">
80
- Click to select product(s) to advertise
81
  <div class="aalb-admin-item-search-items"></div>
82
- <a href="#" target="_blank" id="aalb-admin-popup-more-results" class="pull-right">Check more search results
83
- on Amazon</a>
84
  </div><!--end .aalb-admin-item-serch-->
85
  </div><!--end .aalb-admin-popup-content-->
86
  <div class="aalb-selected">
87
- <label>List of Selected Products</label>
88
  </div>
89
 
90
  <div class="aalb-add-shortcode-button">
91
- <button class="aalb-btn aalb-btn-primary" id="aalb-add-shortcode-button" type="button">Add Shortcode</button>
92
  <div id="aalb-add-shortcode-alert">
93
  <div class="aalb-admin-icon"><i class="fa fa-spinner fa-pulse"></i></div>
94
- Creating shortcode. Please wait....
95
  </div>
96
  <div id="aalb-add-asin-error">
97
  <div id="aalb-add-template-asin-error"></div>
34
  <div id="aalb-admin-popup-container" style="display:none;">
35
  <div class="aalb-admin-searchbox aalb-admin-popup-options">
36
  <input type="text" id="aalb-admin-popup-input-search" name="aalb-admin-popup-input-search"
37
+ placeholder="<?php esc_attr_e( "Enter keyword(s)", 'amazon-associates-link-builder' ) ?>" onkeypress='aalb_submit_event(event,"aalb-btn-primary",this)'/>
38
  <button class="aalb-btn aalb-btn-primary" id="aalb-admin-popup-search-button" type="button"
39
+ onclick="aalb_admin_popup_search_items()" style="margin-top:1%"><?php esc_html_e( "Search", 'amazon-associates-link-builder' ) ?>
40
  </button>
41
  </div><!--end .aalb-admin-popup-options-->
42
  <!-- start: aalb-admin-popup-shortcode-options-->
43
  <div class="aalb-admin-popup-shortocde-wrapper">
44
  <div class="aalb-admin-popup-shortcode-options">
45
  <div class="aalb-admin-item-search-templates">
46
+ <label><?php esc_html_e( "Ad Template", 'amazon-associates-link-builder' ) ?></label>
47
  <?php $aalb_default_template = get_option( AALB_DEFAULT_TEMPLATE, AALB_DEFAULT_TEMPLATE_NAME ); ?>
48
  <select id="aalb_template_names_list" name="aalb_template_names_list" >
49
  <?php foreach ( $aalb_template_names as $aalb_template_name ) { ?>
52
  </select>
53
  </div>
54
  <div class="aalb-admin-popup-store">
55
+ <label><?php esc_html_e( "Associate ID", 'amazon-associates-link-builder' ) ?></label>
56
  <?php $aalb_default_store_id = get_option( AALB_DEFAULT_STORE_ID, AALB_DEFAULT_STORE_ID_NAME ); ?>
57
  <select id="aalb-admin-popup-store-id" name="aalb-admin-popup-store-id" >
58
  <?php foreach ( $aalb_store_id_names as $aalb_store_id ) { ?>
61
  </select>
62
  </div>
63
  <div class="aalb-admin-item-search-marketplaces">
64
+ <label><?php esc_html_e( "Marketplace", 'amazon-associates-link-builder' ) ?></label>
65
  <?php $aalb_default_marketplace = get_option( AALB_DEFAULT_MARKETPLACE, AALB_DEFAULT_MARKETPLACE_NAME ); ?>
66
  <select id="aalb_marketplace_names_list" name="aalb_marketplace_names_list" >
67
  <?php foreach ( $aalb_marketplace_names as $aalb_marketplace => $aalb_marketplace_abbr ) { ?>
74
  <div id="aalb-admin-popup-content">
75
  <div class="aalb-admin-alert aalb-admin-alert-info aalb-admin-item-search-loading">
76
  <div class="aalb-admin-icon"><i class="fa fa-spinner fa-pulse"></i></div>
77
+ <?php esc_html_e( "Searching relevant products from Amazon", 'amazon-associates-link-builder' ) ?>
78
  </div><!--end .aalb-admin-item-search-loading-->
79
  <div class="aalb-admin-item-search">
80
+ <?php esc_html_e( "Click to select product(s) to advertise", 'amazon-associates-link-builder' ) ?>
81
  <div class="aalb-admin-item-search-items"></div>
82
+ <a href="#" target="_blank" id="aalb-admin-popup-more-results" class="pull-right"><?php esc_html_e( "Check more search results on Amazon", 'amazon-associates-link-builder' ) ?></a>
 
83
  </div><!--end .aalb-admin-item-serch-->
84
  </div><!--end .aalb-admin-popup-content-->
85
  <div class="aalb-selected">
86
+ <label><?php esc_html_e( "List of Selected Products", 'amazon-associates-link-builder' ) ?></label>
87
  </div>
88
 
89
  <div class="aalb-add-shortcode-button">
90
+ <button class="aalb-btn aalb-btn-primary" id="aalb-add-shortcode-button" type="button"><?php esc_html_e( "Add Shortcode", 'amazon-associates-link-builder' ) ?></button>
91
  <div id="aalb-add-shortcode-alert">
92
  <div class="aalb-admin-icon"><i class="fa fa-spinner fa-pulse"></i></div>
93
+ <?php esc_html_e( "Creating shortcode. Please wait....", 'amazon-associates-link-builder' ) ?>
94
  </div>
95
  <div id="aalb-add-asin-error">
96
  <div id="aalb-add-template-asin-error"></div>
admin/sidebar/aalb_sidebar.php CHANGED
@@ -28,11 +28,15 @@ class Aalb_Sidebar {
28
  * @since 1.0.0
29
  */
30
  public function register_sidebar_config_page() {
 
31
  // Create new top-level menu
32
- add_menu_page( AALB_PROJECT_TITLE, AALB_PROJECT_TITLE, 'manage_options', 'associates-link-builder-about', array( $this, 'about_callback' ), AALB_ICON );
33
- add_submenu_page( 'associates-link-builder-about', 'Configure ' . AALB_PROJECT_TITLE . ' About', 'About', 'manage_options', 'associates-link-builder-about', array( $this, 'about_callback' ) );
34
- add_submenu_page( 'associates-link-builder-about', 'Configure ' . AALB_PROJECT_TITLE . ' Settings', 'Settings', 'manage_options', 'associates-link-builder-settings', array( $this, 'settings_callback' ) );
35
- add_submenu_page( 'associates-link-builder-about', 'Configure ' . AALB_PROJECT_TITLE . ' Templates', 'Templates', 'manage_options', 'associates-link-builder-templates', array( $this, 'templates_callback' ) );
 
 
 
36
  }
37
 
38
  /**
28
  * @since 1.0.0
29
  */
30
  public function register_sidebar_config_page() {
31
+ $plugin_title_string = esc_html__( "Associates Link Builder", 'amazon-associates-link-builder' );
32
  // Create new top-level menu
33
+ add_menu_page( $plugin_title_string, $plugin_title_string, 'manage_options', 'associates-link-builder-about', array( $this, 'about_callback' ), AALB_ICON );
34
+ /* translators: %s: Name of plugin */
35
+ add_submenu_page( 'associates-link-builder-about', sprintf( esc_html__( "Configure %s About", 'amazon-associates-link-builder' ), $plugin_title_string ), esc_html__( "About", 'amazon-associates-link-builder' ), 'manage_options', 'associates-link-builder-about', array( $this, 'about_callback' ) );
36
+ /* translators: %s: Name of plugin */
37
+ add_submenu_page( 'associates-link-builder-about', sprintf( esc_html__( "Configure %s Settings", 'amazon-associates-link-builder' ), $plugin_title_string ), esc_html__( "Settings", 'amazon-associates-link-builder' ), 'manage_options', 'associates-link-builder-settings', array( $this, 'settings_callback' ) );
38
+ /* translators: %s: Name of plugin */
39
+ add_submenu_page( 'associates-link-builder-about', sprintf( esc_html__( "Configure %s Templates", 'amazon-associates-link-builder' ), $plugin_title_string ), esc_html__( "Templates", 'amazon-associates-link-builder' ), 'manage_options', 'associates-link-builder-templates', array( $this, 'templates_callback' ) );
40
  }
41
 
42
  /**
admin/sidebar/partials/aalb_about.php CHANGED
@@ -14,158 +14,138 @@ and limitations under the License.
14
 
15
  include 'aalb_admin_ui_common.php'; ?>
16
  <div class="wrap">
17
- <h2><?= AALB_PROJECT_TITLE ?></h2>
18
  <div class="card" style="max-width:100%;">
19
- <h2>About Amazon Associates Program</h2>
20
  <p>
21
- The Amazon Associates Program is one of the original affiliate marketing programs. Available in geographies
22
- across the globe, the Amazon Associates Program has been partnering with content creators to help them
23
- monetize their passions since 1996. To learn more about the Amazon Associates Program, please click <a
24
- target="_blank" href="https://affiliate-program.amazon.com/">here</a>.
25
  </p>
26
- <h2>About Amazon Associates Link Builder </h2>
27
  <p>
28
- Link Builder is the official free Amazon Associates Program plugin for WordPress. The plugin enables you to
29
- search for products in the Amazon catalog, access real-time price and availability information, and easily
30
- create links in your posts to products on Amazon.com. You will be able to generate text links, create custom
31
- ad units, or take advantage of out-of-the-box widgets that we’ve designed and included with the plugin.
32
  </p>
33
- <b>Note</b>
34
  <ul>
35
  <li>
36
- You must review and accept the Amazon Associates Link Builder <a
37
- href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-2017-01-17.pdf"
38
- target="_blank">Conditions of Use</a>.
39
  </li>
40
  <li>
41
- The plugin is currently in beta form. We intend to regularly add new features and enhancements
42
- throughout the beta period and beyond, and welcome your feedback and input.
43
  </li>
44
  </ul>
45
- <h2>Getting Started</h2>
46
- <h3>Step 1 - Become an Associate</h3>
47
  <p>
48
- To become an Associate, create an Amazon Associates account using URL for your country:
49
  </p>
50
  <table border="0" cellpadding="10">
51
  <tr>
52
- <td><b>Brazil</b></td>
53
  <td>
54
  <a href="https://associados.amazon.com.br/" target="_blank">https://associados.amazon.com.br/</a>
55
  </td>
56
  </tr>
57
  <tr>
58
- <td><b>Canada</b></td>
59
  <td>
60
  <a href="https://associates.amazon.ca/" target="_blank">https://associates.amazon.ca/</a>
61
  </td>
62
  </tr>
63
  <tr>
64
- <td><b>China</b></td>
65
  <td>
66
  <a href="https://associates.amazon.cn/" target="_blank">https://associates.amazon.cn/</a>
67
  </td>
68
  </tr>
69
  <tr>
70
- <td><b>France</b></td>
71
  <td>
72
  <a href="http://partenaires.amazon.fr/" target="_blank">http://partenaires.amazon.fr/</a>
73
  </td>
74
  </tr>
75
  <tr>
76
- <td><b>Germany</b></td>
77
  <td>
78
  <a href="https://partnernet.amazon.de/" target="_blank">https://partnernet.amazon.de/</a>
79
  </td>
80
  </tr>
81
  <tr>
82
- <td><b>India</b></td>
83
  <td>
84
- <a href="http://affiliate-program.amazon.in/"
85
- target="_blank">http://affiliate-program.amazon.in/</a>
86
  </td>
87
  </tr>
88
  <tr>
89
- <td><b>Italy</b></td>
90
  <td>
91
  <a href="https://programma-affiliazione.amazon.it/" target="_blank">https://programma-affiliazione.amazon.it/</a>
92
  </td>
93
  </tr>
94
  <tr>
95
- <td><b>Japan</b></td>
96
  <td>
97
  <a href="https://affiliate.amazon.co.jp/" target="_blank">https://affiliate.amazon.co.jp/</a>
98
  </td>
99
  </tr>
100
  <tr>
101
- <td><b>Mexico</b></td>
102
  <td>
103
  <a href="https://afiliados.amazon.com.mx/" target="_blank">https://afiliados.amazon.com.mx/</a>
104
  </td>
105
  </tr>
106
  <tr>
107
- <td><b>Spain</b></td>
108
  <td>
109
  <a href="https://afiliados.amazon.es/" target="_blank">https://afiliados.amazon.es/</a>
110
  </td>
111
  </tr>
112
  <tr>
113
- <td><b>United Kingdom</b></td>
114
  <td>
115
  <a href="https://affiliate-program.amazon.co.uk/" target="_blank">https://affiliate-program.amazon.co.uk/</a>
116
  </td>
117
  </tr>
118
  <tr>
119
- <td><b>United States</b></td>
120
  <td>
121
  <a href="https://affiliate-program.amazon.com/" target="_blank">https://affiliate-program.amazon.com/</a>
122
  </td>
123
  </tr>
124
  </table>
125
  <p>
126
- Your Associate ID works only in the country in which you register. If you’d like to be an Associate in more
127
- than one country, please register separately for each country.
128
  </p>
129
- <h3>Step 2 - Sign up for the Amazon Product Advertising API</h3>
130
  <p>
131
- Sign up for the Amazon Product Advertising API by following the instructions listed
132
- <a target="_blank" href="http://docs.aws.amazon.com/AWSECommerceService/latest/DG/CHAP_GettingStarted.html">here</a>.
133
- The Amazon Product Advertising API is a popular e-commerce service, powering Amazon-integrated experiences
134
- around the world, serving tens of thousands of applications and more than 1 billion API requests every day.
135
- It exposes a web-service, which allows Associates to programmatically search and look up items in the Amazon
136
- product catalog. The Link Builder plugin integrates the Product Advertising API, allowing you to access
137
- Amazon.com product catalog data without requiring additional software development.
138
  </p>
139
- <h3>Step 3 - Configure plugin for first use </h3>
140
  <p>
141
- Use the Associates Link Builder->Settings screen to configure the plugin.
142
  </p>
143
  <ol>
144
- <li>Set Access Key ID and Secret Access Key in the Settings section. These credentials are used to invoke
145
- requests to the Amazon Product Advertising API for fetching information on an item.
146
  </li>
147
- <li>Set default Associate ID. Associate ID is used to monitor traffic and sales from your links to Amazon.
148
- You can also define a list of valid Associate IDs (store ids or tracking ids). You should create a new
149
- tracking ID in your Amazon Associates account for using it as Associate ID in the plugin.
150
  </li>
151
- <li>Set the default Amazon marketplace based on the Amazon Associates Program for which you are registered
152
- (for example, if you’ve signed up for the Amazon Associates Program in UK, then your default marketplace
153
- selection should be UK) and select an appropriate template for rendering your ads.
154
  </li>
155
  </ol>
156
  <p>
157
- That's it! You’re all set to start adding Amazon affiliate links to your posts using the Amazon Associates
158
- Link Builder plugin!
159
  </p>
160
- <h2>User Guide</h2>
161
  <p>
162
- Review
163
- <a target="_blank" href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-UserGuide.pdf">Link
164
- Builder User Guide</a> for more information on getting started and key features of the plugin.
165
  </p>
166
- <h2>Support</h2>
167
- <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"
168
- target="_blank">Amazon Associates Link Builder plugin forum</a>.
 
169
  </p>
170
  </div>
171
  </div>
14
 
15
  include 'aalb_admin_ui_common.php'; ?>
16
  <div class="wrap">
17
+ <h2><?php esc_html_e("Associates Link Builder",'amazon-associates-link-builder'); ?></h2>
18
  <div class="card" style="max-width:100%;">
19
+ <h2><?php esc_html_e( "About Amazon Associates Program", 'amazon-associates-link-builder' ); ?></h2>
20
  <p>
21
+ <?php /* translators: 1: URL of affiliate website 2: _blank */
22
+ printf( __( "The Amazon Associates Program is one of the original affiliate marketing programs. Available in geographies across the globe, the Amazon Associates Program has been partnering with content creators to help them monetize their passions since 1996. To learn more about the Amazon Associates Program, please click <a href=%1s target=%2s >here</a>.", 'amazon-associates-link-builder' ), AALB_AFFILIATE_WEBSITE_URL, AALB_NEW_PAGE_TARGET ); ?>
 
 
23
  </p>
24
+ <h2><?php esc_html_e( "About Amazon Associates Link Builder", 'amazon-associates-link-builder' ); ?> </h2>
25
  <p>
26
+ <?php esc_html_e( "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.", 'amazon-associates-link-builder' ); ?>
 
 
 
27
  </p>
28
+ <b><?php esc_html_e( "Note", 'amazon-associates-link-builder' ); ?> </b>
29
  <ul>
30
  <li>
31
+ <?php /* translators: 1: URL of Condition of Use page 2: _blank */
32
+ printf( __( "You must review and accept the Amazon Associates Link Builder <a href=%1s target=%2s>Conditions of Use.</a>", 'amazon-associates-link-builder' ), AALB_CONDITIONS_OF_USE_URL, AALB_NEW_PAGE_TARGET ); ?>
 
33
  </li>
34
  <li>
35
+ <?php esc_html_e( "The plugin is currently in beta form. We intend to regularly add new features and enhancements throughout the beta period and beyond, and welcome your feedback and input.", 'amazon-associates-link-builder' ); ?>
 
36
  </li>
37
  </ul>
38
+ <h2><?php esc_html_e( "Getting Started", 'amazon-associates-link-builder' ); ?></h2>
39
+ <h3><?php esc_html_e( "Step 1 - Become an Associate", 'amazon-associates-link-builder' ); ?></h3>
40
  <p>
41
+ <?php esc_html_e( "To become an Associate, create an Amazon Associates account using URL for your country:", 'amazon-associates-link-builder' ); ?>
42
  </p>
43
  <table border="0" cellpadding="10">
44
  <tr>
45
+ <td><b><?php esc_html_e( "Brazil", 'amazon-associates-link-builder' ); ?></b></td>
46
  <td>
47
  <a href="https://associados.amazon.com.br/" target="_blank">https://associados.amazon.com.br/</a>
48
  </td>
49
  </tr>
50
  <tr>
51
+ <td><b><?php esc_html_e( "Canada", 'amazon-associates-link-builder' ); ?></b></td>
52
  <td>
53
  <a href="https://associates.amazon.ca/" target="_blank">https://associates.amazon.ca/</a>
54
  </td>
55
  </tr>
56
  <tr>
57
+ <td><b><?php esc_html_e( "China", 'amazon-associates-link-builder' ); ?></b></td>
58
  <td>
59
  <a href="https://associates.amazon.cn/" target="_blank">https://associates.amazon.cn/</a>
60
  </td>
61
  </tr>
62
  <tr>
63
+ <td><b><?php esc_html_e( "France", 'amazon-associates-link-builder' ); ?></b></td>
64
  <td>
65
  <a href="http://partenaires.amazon.fr/" target="_blank">http://partenaires.amazon.fr/</a>
66
  </td>
67
  </tr>
68
  <tr>
69
+ <td><b><?php esc_html_e( "Germany", 'amazon-associates-link-builder' ); ?></b></td>
70
  <td>
71
  <a href="https://partnernet.amazon.de/" target="_blank">https://partnernet.amazon.de/</a>
72
  </td>
73
  </tr>
74
  <tr>
75
+ <td><b><?php esc_html_e( "India", 'amazon-associates-link-builder' ); ?></b></td>
76
  <td>
77
+ <a href="http://affiliate-program.amazon.in/" target="_blank">http://affiliate-program.amazon.in/</a>
 
78
  </td>
79
  </tr>
80
  <tr>
81
+ <td><b><?php esc_html_e( "Italy", 'amazon-associates-link-builder' ); ?></b></td>
82
  <td>
83
  <a href="https://programma-affiliazione.amazon.it/" target="_blank">https://programma-affiliazione.amazon.it/</a>
84
  </td>
85
  </tr>
86
  <tr>
87
+ <td><b><?php esc_html_e( "Japan", 'amazon-associates-link-builder' ); ?></b></td>
88
  <td>
89
  <a href="https://affiliate.amazon.co.jp/" target="_blank">https://affiliate.amazon.co.jp/</a>
90
  </td>
91
  </tr>
92
  <tr>
93
+ <td><b><?php esc_html_e( "Mexico", 'amazon-associates-link-builder' ); ?></b></td>
94
  <td>
95
  <a href="https://afiliados.amazon.com.mx/" target="_blank">https://afiliados.amazon.com.mx/</a>
96
  </td>
97
  </tr>
98
  <tr>
99
+ <td><b><?php esc_html_e( "Spain", 'amazon-associates-link-builder' ); ?></b></td>
100
  <td>
101
  <a href="https://afiliados.amazon.es/" target="_blank">https://afiliados.amazon.es/</a>
102
  </td>
103
  </tr>
104
  <tr>
105
+ <td><b><?php esc_html_e( "United Kingdom", 'amazon-associates-link-builder' ); ?></b></td>
106
  <td>
107
  <a href="https://affiliate-program.amazon.co.uk/" target="_blank">https://affiliate-program.amazon.co.uk/</a>
108
  </td>
109
  </tr>
110
  <tr>
111
+ <td><b><?php esc_html_e( "United States", 'amazon-associates-link-builder' ); ?></b></td>
112
  <td>
113
  <a href="https://affiliate-program.amazon.com/" target="_blank">https://affiliate-program.amazon.com/</a>
114
  </td>
115
  </tr>
116
  </table>
117
  <p>
118
+ <?php esc_html_e( "Your Associate ID works only in the country in which you register. If you’d like to be an Associate in more than one country, please register separately for each country.", 'amazon-associates-link-builder' ); ?>
 
119
  </p>
120
+ <h3><?php esc_html_e( "Step 2 - Sign up for the Amazon Product Advertising API", 'amazon-associates-link-builder' ); ?></h3>
121
  <p>
122
+ <?php /* translators: 1: URL of Getting Started page 2: _blank */
123
+ printf( __( "Sign up for the Amazon Product Advertising API by following the instructions listed <a href=%1s target=%2s>here</a>. The Amazon Product Advertising API is a popular e-commerce service, powering Amazon-integrated experiences around the world, serving tens of thousands of applications and more than 1 billion API requests every day. It exposes a web-service, which allows Associates to programmatically search and look up items in the Amazon product catalog. The Link Builder plugin integrates the Product Advertising API, allowing you to access Amazon.com product catalog data without requiring additional software development.", 'amazon-associates-link-builder' ), AALB_GETTING_STARTED_URL, AALB_NEW_PAGE_TARGET ); ?>
 
 
 
 
 
124
  </p>
125
+ <h3><?php esc_html_e( "Step 3 - Configure plugin for first use", 'amazon-associates-link-builder' ); ?></h3>
126
  <p>
127
+ <?php esc_html_e( "Use the Associates Link Builder->Settings screen to configure the plugin.", 'amazon-associates-link-builder' ); ?>
128
  </p>
129
  <ol>
130
+ <li><?php esc_html_e( "Set Access Key ID and Secret Access Key in the Settings section. These credentials are used to invoke requests to the Amazon Product Advertising API for fetching information on an item.", 'amazon-associates-link-builder' ); ?>
 
131
  </li>
132
+ <li><?php esc_html_e( "Set default Associate ID. Associate ID is used to monitor traffic and sales from your links to Amazon. You can also define a list of valid Associate IDs (store ids or tracking ids). You should create a new tracking ID in your Amazon Associates account for using it as Associate ID in the plugin.", 'amazon-associates-link-builder' ); ?>
 
 
133
  </li>
134
+ <li><?php esc_html_e( "Set the default Amazon marketplace based on the Amazon Associates Program for which you are registered (for example, if you’ve signed up for the Amazon Associates Program in UK, then your default marketplace selection should be UK) and select an appropriate template for rendering your ads.", 'amazon-associates-link-builder' ); ?>
 
 
135
  </li>
136
  </ol>
137
  <p>
138
+ <?php esc_html_e( "That's it! You’re all set to start adding Amazon affiliate links to your posts using the Amazon Associates Link Builder plugin!", 'amazon-associates-link-builder' ); ?>
 
139
  </p>
140
+ <h2><?php esc_html_e( "User Guide", 'amazon-associates-link-builder' ); ?></h2>
141
  <p>
142
+ <?php /* translators: 1: URL of Link Builder User Guide 2: _blank */
143
+ printf( __( "Review <a href=%1s target=%2s >Link Builder User Guide</a> for more information on getting started and key features of the plugin.", 'amazon-associates-link-builder' ), AALB_USER_GUIDE_URL, AALB_NEW_PAGE_TARGET ); ?>
 
144
  </p>
145
+ <h2><?php esc_html_e( "Support", 'amazon-associates-link-builder' ); ?></h2>
146
+ <p>
147
+ <?php /* translators: 1: URL of Plugin's Support Forum 2: _blank */
148
+ printf( __( "If you get stuck, or have any questions, you can ask for help in the <a href=%1s target=%2s>Amazon Associates Link Builder plugin forum</a>.", 'amazon-associates-link-builder' ), AALB_SUPPORT_FORUM_URL, AALB_NEW_PAGE_TARGET ); ?>
149
  </p>
150
  </div>
151
  </div>
admin/sidebar/partials/aalb_admin_ui_common.php CHANGED
@@ -24,7 +24,7 @@ if ( ! is_ssl() ) {
24
  //action when page is NOT using SSL
25
  if ( ! get_option( AALB_SHOW_HTTP_WARNING_ONCE ) ) {
26
  // This info message is showed only once.
27
- aalb_info_notice( 'We <b>recommend</b> using HTTPs connection for improved security.' );
28
  update_option( AALB_SHOW_HTTP_WARNING_ONCE, true );
29
  }
30
  }
24
  //action when page is NOT using SSL
25
  if ( ! get_option( AALB_SHOW_HTTP_WARNING_ONCE ) ) {
26
  // This info message is showed only once.
27
+ aalb_info_notice( __( "We <b>recommend</b> using HTTPs connection for improved security.", 'amazon-associates-link-builder' ) );
28
  update_option( AALB_SHOW_HTTP_WARNING_ONCE, true );
29
  }
30
  }
admin/sidebar/partials/aalb_credentials.php CHANGED
@@ -22,25 +22,23 @@ wp_enqueue_style( 'aalb_credentials_css', AALB_CREDENTIALS_CSS, array(), AALB_PL
22
  ?>
23
 
24
  <div class="wrap">
25
- <h2>Settings for <?= AALB_PROJECT_TITLE ?></h2>
26
  <br>
27
  <form method="post" action="options.php">
28
  <?php settings_fields( AALB_CRED_CONFIG_GROUP );
29
  do_settings_sections( AALB_CRED_CONFIG_GROUP ); ?>
30
  <fieldset class="aalb-settings-fieldset">
31
- <legend class="aalb-settings-legend"> Tracking Id(s) </legend>
32
  <table class ="widefat fixed aalb-settings-table">
33
  <tr>
34
- <th scope="row" class="aalb-settings-identifier">Associate ID</th>
35
  <td class="aalb-settings-input-column">
36
  <textarea type="text" id=<?php echo AALB_STORE_ID_NAMES ?> name=<?php echo AALB_STORE_ID_NAMES ?> class="aalb-settings-input-field"
37
  value="<?php echo esc_attr( get_option( AALB_STORE_ID_NAMES ) ); ?>"
38
  onchange="aalb_credentials_store_ids_onchange(this)"><?php echo esc_attr( get_option( AALB_STORE_ID_NAMES ) ); ?>
39
  </textarea>
40
  </td>
41
- <td>Associate ID is used to monitor traffic and sales from your links to Amazon. You can add one store
42
- id or tracking id per row. You are recommended to create a new tracking ID in your Amazon Associates
43
- account for using it as Associate ID in the plugin.
44
  </td>
45
  </tr>
46
  </table>
@@ -48,10 +46,10 @@ wp_enqueue_style( 'aalb_credentials_css', AALB_CREDENTIALS_CSS, array(), AALB_PL
48
  <br>
49
 
50
  <fieldset class="aalb-settings-fieldset">
51
- <legend class="aalb-settings-legend">Site Wide Settings</legend>
52
  <table class ="widefat fixed aalb-settings-table">
53
  <tr>
54
- <th scope="row" class="aalb-settings-identifier">Default Associate ID</th>
55
  <td class="aalb-settings-input-column">
56
  <?php $default_store_id = get_option( AALB_DEFAULT_STORE_ID, AALB_DEFAULT_STORE_ID_NAME ); ?>
57
  <select id=<?php echo AALB_DEFAULT_STORE_ID ?> name=<?php echo AALB_DEFAULT_STORE_ID ?> class="aalb-settings-input-field">
@@ -64,12 +62,11 @@ wp_enqueue_style( 'aalb_credentials_css', AALB_CREDENTIALS_CSS, array(), AALB_PL
64
  ?>
65
  </select>
66
  </td>
67
- <td>The Associate ID that will be used for tagging the affiliate links generated by the plugin if no tag
68
- is specified in the short code.
69
  </td>
70
  </tr>
71
  <tr>
72
- <th scope="row" class="aalb-settings-identifier">Default Marketplace</th>
73
  <td class="aalb-settings-input-column">
74
  <?php $default_marketplace = get_option( AALB_DEFAULT_MARKETPLACE, AALB_DEFAULT_MARKETPLACE_NAME ); ?>
75
  <select name=<?php echo AALB_DEFAULT_MARKETPLACE ?> class="aalb-settings-input-field">
@@ -84,13 +81,11 @@ wp_enqueue_style( 'aalb_credentials_css', AALB_CREDENTIALS_CSS, array(), AALB_PL
84
  ?>
85
  </select>
86
  </td>
87
- <td>Set the default Amazon marketplace based on the Amazon website that is identified in your Associates
88
- Account (for instance, if you have signed up for Amazon.co.uk site, then your default marketplace
89
- selection should be UK).
90
  </td>
91
  </tr>
92
  <tr>
93
- <th scope="row" class="aalb-settings-identifier">Default Template</th>
94
  <td class="aalb-settings-input-column">
95
  <?php $default_template = get_option( AALB_DEFAULT_TEMPLATE, AALB_DEFAULT_TEMPLATE_NAME ); ?>
96
  <select name=<?php echo AALB_DEFAULT_TEMPLATE ?> class="aalb-settings-input-field">
@@ -104,16 +99,19 @@ wp_enqueue_style( 'aalb_credentials_css', AALB_CREDENTIALS_CSS, array(), AALB_PL
104
  ?>
105
  </select>
106
  </td>
107
- <td>The ad template that will be used for rendering the ad if no template is specified in the short
108
- code.
109
  </td>
110
  </tr>
111
  <tr>
112
  <td scope="row" colspan="2" class="aalb-settings-no-referrer-column">
113
  <input id=<?php echo AALB_NO_REFERRER_DISABLED ?> type="checkbox" name=<?php echo AALB_NO_REFERRER_DISABLED ?> value="true"<?php if (get_option( AALB_NO_REFERRER_DISABLED )) echo "checked='checked'"; ?> />
114
- <label class="aalb-settings-no-referrer-text" for="aalb_no_referrer_disabled">Remove rel="noreferrer" for Amazon Affiliate Links from all posts</label>
 
 
115
  </td>
116
- <td> Selecting the checkbox will remove rel="noreferrer" from Amazon links on all posts till date. The action is reversible and you can revert by deselecting the checkbox
 
 
117
  </td>
118
  </tr>
119
  </table>
@@ -121,23 +119,21 @@ wp_enqueue_style( 'aalb_credentials_css', AALB_CREDENTIALS_CSS, array(), AALB_PL
121
  <br>
122
 
123
  <fieldset class="aalb-settings-fieldset">
124
- <legend class="aalb-settings-legend">PA-API Credentials</legend>
125
  <table class ="widefat fixed aalb-settings-table">
126
  <tr>
127
- <th scope="row" class="aalb-settings-identifier">Access Key ID</th>
128
  <td class="aalb-settings-input-column">
129
  <input type="text" name=<?php echo AALB_AWS_ACCESS_KEY ?> class="aalb-settings-input-field"
130
  value="<?php echo esc_attr( openssl_decrypt( base64_decode( get_option( AALB_AWS_ACCESS_KEY ) ), AALB_ENCRYPTION_ALGORITHM, AALB_ENCRYPTION_KEY, 0, AALB_ENCRYPTION_IV ) ); ?>"/>
131
  </td>
132
- <td>Your Access Key ID that you generated after signing up for the Amazon Product Advertising API. If
133
- you have not already signed up for the Amazon Product Advertising API, you can do so by following
134
- instructions listed <a
135
- href="http://docs.aws.amazon.com/AWSECommerceService/latest/DG/CHAP_GettingStarted.html"
136
- target="_blank">here</a>.
137
  </td>
138
  </tr>
139
  <tr>
140
- <th scope="row" class="aalb-settings-identifier">Secret Access Key</th>
141
  <?php $secret_key = get_option( AALB_AWS_SECRET_KEY );
142
  if ( $secret_key ) {
143
  $secret_key = AALB_AWS_SECRET_KEY_MASK;
@@ -147,12 +143,9 @@ wp_enqueue_style( 'aalb_credentials_css', AALB_CREDENTIALS_CSS, array(), AALB_PL
147
  class="aalb-settings-input-field" value="<?php echo esc_attr( $secret_key ); ?>"
148
  autocomplete="off"/>
149
  </td>
150
- <td>A key that is used in conjunction with the Access Key ID to cryptographically sign an API request.
151
- To retrieve your Access Key ID or Secret Access Key, go to <a
152
- href="https://affiliate-program.amazon.com/gp/advertising/api/detail/your-account.html"
153
- target="_blank">Manage Your Account</a>. The plugin uses a default encryption key for
154
- encrypting the Secret Key. You can change the key using AALB_ENCRYPTION_KEY parameter defined in
155
- /aalb_config.php.
156
  </td>
157
  </tr>
158
  </table>
@@ -160,11 +153,11 @@ wp_enqueue_style( 'aalb_credentials_css', AALB_CREDENTIALS_CSS, array(), AALB_PL
160
 
161
  <div class="aalb-terms-conditions">
162
  <input id="aalb-terms-checkbox" type="checkbox" name="demo-checkbox" value="1"/>
163
- <label for="aalb-terms-checkbox">Check here to indicate that you have read and agree to the Amazon Associates Link Builder</label>
164
- <a href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-2017-01-17.pdf"
165
- target="_blank">Conditions of Use</a>.
166
  </div>
167
-
168
- <?php submit_button( 'Save Changes', 'primary', 'submit', true, array( 'disabled' => 'disabled' ) ); ?>
169
  </form>
170
  </div>
22
  ?>
23
 
24
  <div class="wrap">
25
+ <h2><?php esc_html_e( "Settings for Associates Link Builder", 'amazon-associates-link-builder' ) ?></h2>
26
  <br>
27
  <form method="post" action="options.php">
28
  <?php settings_fields( AALB_CRED_CONFIG_GROUP );
29
  do_settings_sections( AALB_CRED_CONFIG_GROUP ); ?>
30
  <fieldset class="aalb-settings-fieldset">
31
+ <legend class="aalb-settings-legend"> <?php esc_html_e( "Tracking Id(s)", 'amazon-associates-link-builder' ) ?> </legend>
32
  <table class ="widefat fixed aalb-settings-table">
33
  <tr>
34
+ <th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Associate ID", 'amazon-associates-link-builder' ) ?></th>
35
  <td class="aalb-settings-input-column">
36
  <textarea type="text" id=<?php echo AALB_STORE_ID_NAMES ?> name=<?php echo AALB_STORE_ID_NAMES ?> class="aalb-settings-input-field"
37
  value="<?php echo esc_attr( get_option( AALB_STORE_ID_NAMES ) ); ?>"
38
  onchange="aalb_credentials_store_ids_onchange(this)"><?php echo esc_attr( get_option( AALB_STORE_ID_NAMES ) ); ?>
39
  </textarea>
40
  </td>
41
+ <td><?php esc_html_e( "Associate ID is used to monitor traffic and sales from your links to Amazon. You can add one store id or tracking id per row. You are recommended to create a new tracking ID in your Amazon Associates account for using it as Associate ID in the plugin.", 'amazon-associates-link-builder' ) ?>
 
 
42
  </td>
43
  </tr>
44
  </table>
46
  <br>
47
 
48
  <fieldset class="aalb-settings-fieldset">
49
+ <legend class="aalb-settings-legend"><?php esc_html_e( "Site Wide Settings", 'amazon-associates-link-builder' ) ?></legend>
50
  <table class ="widefat fixed aalb-settings-table">
51
  <tr>
52
+ <th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Default Associate ID", 'amazon-associates-link-builder' ) ?></th>
53
  <td class="aalb-settings-input-column">
54
  <?php $default_store_id = get_option( AALB_DEFAULT_STORE_ID, AALB_DEFAULT_STORE_ID_NAME ); ?>
55
  <select id=<?php echo AALB_DEFAULT_STORE_ID ?> name=<?php echo AALB_DEFAULT_STORE_ID ?> class="aalb-settings-input-field">
62
  ?>
63
  </select>
64
  </td>
65
+ <td><?php esc_html_e( "The Associate ID that will be used for tagging the affiliate links generated by the plugin if no tag is specified in the short code.", 'amazon-associates-link-builder' ) ?>
 
66
  </td>
67
  </tr>
68
  <tr>
69
+ <th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Default Marketplace", 'amazon-associates-link-builder' ) ?></th>
70
  <td class="aalb-settings-input-column">
71
  <?php $default_marketplace = get_option( AALB_DEFAULT_MARKETPLACE, AALB_DEFAULT_MARKETPLACE_NAME ); ?>
72
  <select name=<?php echo AALB_DEFAULT_MARKETPLACE ?> class="aalb-settings-input-field">
81
  ?>
82
  </select>
83
  </td>
84
+ <td><?php esc_html_e( "Set the default Amazon marketplace based on the Amazon website that is identified in your Associates Account (for instance, if you have signed up for Amazon.co.uk site, then your default marketplace selection should be UK).", 'amazon-associates-link-builder' ) ?>
 
 
85
  </td>
86
  </tr>
87
  <tr>
88
+ <th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Default Template", 'amazon-associates-link-builder' ) ?></th>
89
  <td class="aalb-settings-input-column">
90
  <?php $default_template = get_option( AALB_DEFAULT_TEMPLATE, AALB_DEFAULT_TEMPLATE_NAME ); ?>
91
  <select name=<?php echo AALB_DEFAULT_TEMPLATE ?> class="aalb-settings-input-field">
99
  ?>
100
  </select>
101
  </td>
102
+ <td><?php esc_html_e( "The ad template that will be used for rendering the ad if no template is specified in the short code.", 'amazon-associates-link-builder' ) ?>
 
103
  </td>
104
  </tr>
105
  <tr>
106
  <td scope="row" colspan="2" class="aalb-settings-no-referrer-column">
107
  <input id=<?php echo AALB_NO_REFERRER_DISABLED ?> type="checkbox" name=<?php echo AALB_NO_REFERRER_DISABLED ?> value="true"<?php if (get_option( AALB_NO_REFERRER_DISABLED )) echo "checked='checked'"; ?> />
108
+ <label class="aalb-settings-no-referrer-text" for="aalb_no_referrer_disabled">
109
+ <?php /* translators: %s: rel="noreferrer" attribute */
110
+ printf( esc_html__( "Remove %s for Amazon Affiliate Links from all posts", 'amazon-associates-link-builder' ), "rel=\"noreferrer\"" ); ?></label>
111
  </td>
112
+ <td>
113
+ <?php /* translators: %s: rel="noreferrer" attribute */
114
+ printf( esc_html__( "Selecting the checkbox will remove %s from Amazon links on all posts till date. The action is reversible and you can revert by deselecting the checkbox", 'amazon-associates-link-builder' ), "rel=\"noreferrer\"" ); ?>
115
  </td>
116
  </tr>
117
  </table>
119
  <br>
120
 
121
  <fieldset class="aalb-settings-fieldset">
122
+ <legend class="aalb-settings-legend"><?php esc_html_e( "PA-API Credentials", 'amazon-associates-link-builder' ) ?></legend>
123
  <table class ="widefat fixed aalb-settings-table">
124
  <tr>
125
+ <th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Access Key ID", 'amazon-associates-link-builder' ) ?></th>
126
  <td class="aalb-settings-input-column">
127
  <input type="text" name=<?php echo AALB_AWS_ACCESS_KEY ?> class="aalb-settings-input-field"
128
  value="<?php echo esc_attr( openssl_decrypt( base64_decode( get_option( AALB_AWS_ACCESS_KEY ) ), AALB_ENCRYPTION_ALGORITHM, AALB_ENCRYPTION_KEY, 0, AALB_ENCRYPTION_IV ) ); ?>"/>
129
  </td>
130
+ <td>
131
+ <?php /* translators: 1: URL of Getting Started page 2: _blank */
132
+ printf( __( "Your Access Key ID that you generated after signing up for the Amazon Product Advertising API. If you have not already signed up for the Amazon Product Advertising API, you can do so by following instructions listed <a href=%1s target=%2s>here</a>.", 'amazon-associates-link-builder' ), AALB_GETTING_STARTED_URL, AALB_NEW_PAGE_TARGET ) ?>
 
 
133
  </td>
134
  </tr>
135
  <tr>
136
+ <th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Secret Access Key", 'amazon-associates-link-builder' ) ?></th>
137
  <?php $secret_key = get_option( AALB_AWS_SECRET_KEY );
138
  if ( $secret_key ) {
139
  $secret_key = AALB_AWS_SECRET_KEY_MASK;
143
  class="aalb-settings-input-field" value="<?php echo esc_attr( $secret_key ); ?>"
144
  autocomplete="off"/>
145
  </td>
146
+ <td>
147
+ <?php /* translators: 1: URL of managing PA-API acccount page 2: _blank */
148
+ printf( __( "A key that is used in conjunction with the Access Key ID to cryptographically sign an API request. To retrieve your Access Key ID or Secret Access Key, go to <a href=%1s target=%2s>Manage Your Account</a>. The plugin uses a default encryption key for encrypting the Secret Key. You can change the key using AALB_ENCRYPTION_KEY parameter defined in /aalb_config.php.", 'amazon-associates-link-builder' ), AALB_MANAGE_PAAPI_US_ACCOUNT_URL, AALB_NEW_PAGE_TARGET ) ?>
 
 
 
149
  </td>
150
  </tr>
151
  </table>
153
 
154
  <div class="aalb-terms-conditions">
155
  <input id="aalb-terms-checkbox" type="checkbox" name="demo-checkbox" value="1"/>
156
+ <label for="aalb-terms-checkbox">
157
+ <?php /* translators: 1: URL of Condition of Use page 2: _blank */
158
+ printf( __( "Check here to indicate that you have read and agree to the Amazon Associates Link Builder <a href=%1s target=%2s>Conditions of Use</a>.", 'amazon-associates-link-builder' ), AALB_CONDITIONS_OF_USE_URL, AALB_NEW_PAGE_TARGET ) ?></label>
159
  </div>
160
+ <?php $aalb_submit_button_text = esc_html__( "Save Changes", 'amazon-associates-link-builder' );
161
+ submit_button( $aalb_submit_button_text, 'primary', 'submit', true, array( 'disabled' => 'disabled' ) ); ?>
162
  </form>
163
  </div>
admin/sidebar/partials/aalb_templates.php CHANGED
@@ -27,7 +27,8 @@ $helper->aalb_initialize_wp_filesystem_api();
27
  */
28
  function aalb_verify_file_is_writable( $file ) {
29
  if ( is_file( $file ) and ! is_writable( $file ) ) {
30
- throw new Exception( "Save Failed. The existing file " . $file . " is not writable." );
 
31
  }
32
 
33
  return true;
@@ -46,7 +47,8 @@ function aalb_verify_file_is_writable( $file ) {
46
  function aalb_write_to_file( $file, $content ) {
47
  global $wp_filesystem;
48
  if ( $wp_filesystem->put_contents( $file, $content ) === false ) {
49
- throw new Exception( "Save Failed. Error writing contents to file: " . $file );
 
50
  }
51
 
52
  return true;
@@ -72,7 +74,7 @@ function aalb_save_template( $file, $content_html, $content_css ) {
72
  //Both files were saved successfully
73
  //Else case never occurs as an exception is thrown in false case
74
  $saveFailed = false;
75
- aalb_success_notice( "Template Saved Successfully" );
76
  }
77
  }
78
  } catch ( Exception $e ) {
@@ -93,10 +95,12 @@ function aalb_find_template_change( $aalb_current_template_names, $aalb_template
93
  $templates_added = array_diff( $aalb_template_names, $aalb_current_template_names );
94
  $templates_deleted = array_diff( $aalb_current_template_names, $aalb_template_names );
95
  if ( sizeof( $templates_added ) > 0 ) {
96
- aalb_info_notice( sizeof( $templates_added ) . " template(s) added: " . implode( ', ', $templates_added ) );
 
97
  }
98
  if ( sizeof( $templates_deleted ) > 0 ) {
99
- aalb_info_notice( sizeof( $templates_deleted ) . " template(s) deleted: " . implode( ', ', $templates_deleted ) );
 
100
  }
101
  }
102
 
@@ -112,26 +116,29 @@ $helper->refresh_template_list();
112
  $aalb_template_names = get_option( AALB_TEMPLATE_NAMES );
113
  aalb_find_template_change( $aalb_current_template_names, $aalb_template_names );
114
 
115
- if ( ! empty( $_POST["submit"] ) ) {
 
116
  $aalb_template_name = stripslashes( $_POST["aalb_template_name"] );
117
  $aalb_template_template_html_box = stripslashes( $_POST["aalb_template_template_html_box"] );
118
  $aalb_template_template_css_box = stripslashes( $_POST["aalb_template_template_css_box"] );
119
  $dir = AALB_TEMPLATE_DIR;
120
  $aalb_template_upload_dir = $helper->get_template_upload_directory();
121
- if ( $_POST["submit"] == "Save" ) {
122
  if ( $_POST["aalb_template_list"] == "new" ) {
123
  if ( empty( $aalb_template_name ) ) {
124
- aalb_error_notice( "Please define the template name for the new template" );
125
  } elseif ( ! ctype_alnum( str_replace( array( '-', '_' ), '', $aalb_template_name ) ) ) {
126
  //The template name can only be alphanumeric characters plus hyphens (-) and underscores (_)
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 ) ) {
134
- aalb_error_notice( "Save Failed. A template with the name \"" . $aalb_template_name . "\" already exists. Please specify some other name for the template" );
 
135
  //Ensures state is saved even on save failures
136
  $saveFailed = true;
137
  } else {
@@ -159,32 +166,35 @@ if ( ! empty( $_POST["submit"] ) ) {
159
  aalb_error_notice( $e->getMessage() );
160
  }
161
  }
162
- } elseif ( $_POST["submit"] == "Remove" ) {
163
- if ( $_POST["aalb_template_list"] == "new" ) {
164
- aalb_error_notice( "Cannot remove new template. Please select a valid template to remove." );
165
- } else {
166
- $aalb_template_names = array_diff( $aalb_template_names, array( $aalb_template_name ) );
167
- update_option( 'aalb_template_names', $aalb_template_names );
168
- if ( in_array( $aalb_template_name, $aalb_default_templates ) ) {
169
- //If Default Amazon Template is Removed
170
- aalb_error_notice( "Couldn't remove Default Template" );
171
- } else {
172
  if ( unlink( $aalb_template_upload_dir . $aalb_template_name . ".mustache" ) ) {
173
- aalb_success_notice( "Successfully removed Template HTML" );
174
  } else {
175
- aalb_error_notice( "Couldn't remove Template HTML. Please manually remove " . $dir . $aalb_template_name . ".mustache" );
 
176
  }
177
  if ( unlink( $aalb_template_upload_dir . $aalb_template_name . ".css" ) ) {
178
- aalb_success_notice( "Successfully removed Template CSS" );
179
  } else {
180
- aalb_error_notice( "Couldn't remove Template CSS. Please manually remove " . $dir . $aalb_template_name . ".css" );
 
181
  }
 
 
 
 
 
182
  }
183
-
184
- $aalb_template_name = "";
185
- $aalb_template_template_html_box = "";
186
- $aalb_template_template_css_box = "";
187
  }
 
 
188
  }
189
  }
190
 
@@ -199,16 +209,16 @@ wp_localize_script( 'aalb_template_js', 'wp_opt', array( 'ajax_url' => admin_url
199
 
200
  ?>
201
  <div class="wrap">
202
- <h2>Templates for <?= AALB_PROJECT_TITLE ?></h2>
203
  <br>
204
  <form method="post">
205
  <table class="widefat fixed">
206
  <tr>
207
- <th scope="row" style="width:15%;">Select Template</th>
208
  <td>
209
  <select id="aalb_template_list_select" name="aalb_template_list" style="width:50%"
210
  onchange="aalb_template_select_template_onchange(this)">
211
- <option value="new">Create new template</option>
212
  <?php
213
  foreach ( $aalb_template_names as $aalb_template ) {
214
  ?>
@@ -217,36 +227,36 @@ wp_localize_script( 'aalb_template_js', 'wp_opt', array( 'ajax_url' => admin_url
217
  }
218
  ?>
219
  </select>
220
- <input type="button" name="clone" id="clone_template" class="button button-secondary" value="Clone"
221
  onclick="clone_existing_template()" disabled>
222
  </td>
223
  </tr>
224
  <tr>
225
- <th scope="row" style="width:15%;">Set a name for your template</th>
226
  <td>
227
  <input type="text" id="aalb_template_name" name="aalb_template_name" style="width:50%"
228
  value="<?= ( isset( $aalb_template_name ) ) ? $aalb_template_name : '' ?>"/>
229
  <span style="font-size:0.9em;">[<a
230
  href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-Guide-HowToCreateCustomTemplates.pdf"
231
- target="_blank">Guide for creating custom templates</a>]</span>
232
  </td>
233
  </tr>
234
  <tr>
235
- <th scope="row" style="width:15%;">Add HTML for your template</th>
236
  <td><textarea id="aalb_template_template_html_box"
237
  name="aalb_template_template_html_box"><?= ( isset( $aalb_template_template_html_box ) ) ? $aalb_template_template_html_box : '' ?></textarea>
238
  </td>
239
  </tr>
240
  <tr>
241
- <th scope="row" style="width:15%;">Add CSS for your template</th>
242
  <td><textarea id="aalb_template_template_css_box"
243
  name="aalb_template_template_css_box"><?= ( isset( $aalb_template_template_css_box ) ) ? $aalb_template_template_css_box : '' ?></textarea>
244
  </td>
245
  </tr>
246
  </table>
247
  <p class="submit">
248
- <input name="submit" id="submit_save" class="button button-primary" value="Save" type="submit">
249
- <input name="submit" id="submit_remove" class="button button-secondary" value="Remove" type="submit" disabled>
250
  </p>
251
  </form>
252
  </div>
27
  */
28
  function aalb_verify_file_is_writable( $file ) {
29
  if ( is_file( $file ) and ! is_writable( $file ) ) {
30
+ /* translators: %s for fileName */
31
+ throw new Exception( sprintf( esc_html__( "Save Failed. The existing file %s is not writable.", 'amazon-associates-link-builder' ), $file ) );
32
  }
33
 
34
  return true;
47
  function aalb_write_to_file( $file, $content ) {
48
  global $wp_filesystem;
49
  if ( $wp_filesystem->put_contents( $file, $content ) === false ) {
50
+ /* translators: %s for fileName */
51
+ throw new Exception( sprintf( esc_html__( "Save Failed. Error writing contents to file: %s", 'amazon-associates-link-builder' ), $file ) );
52
  }
53
 
54
  return true;
74
  //Both files were saved successfully
75
  //Else case never occurs as an exception is thrown in false case
76
  $saveFailed = false;
77
+ aalb_success_notice( esc_html__( "Template Saved Successfully", 'amazon-associates-link-builder' ) );
78
  }
79
  }
80
  } catch ( Exception $e ) {
95
  $templates_added = array_diff( $aalb_template_names, $aalb_current_template_names );
96
  $templates_deleted = array_diff( $aalb_current_template_names, $aalb_template_names );
97
  if ( sizeof( $templates_added ) > 0 ) {
98
+ /* translators: 1: Number of templates 2: Name of added templates */
99
+ aalb_info_notice( sprintf( esc_html__( "%1s template(s) added: %2s", 'amazon-associates-link-builder' ), sizeof( $templates_added ), implode( ', ', $templates_added ) ) );
100
  }
101
  if ( sizeof( $templates_deleted ) > 0 ) {
102
+ /* translators: 1: Number of templates 2: Name of deleted templates */
103
+ aalb_info_notice( sprintf( esc_html__( "%1s template(s) deleted: %2s", 'amazon-associates-link-builder' ), sizeof( $templates_deleted ), implode( ', ', $templates_deleted ) ) );
104
  }
105
  }
106
 
116
  $aalb_template_names = get_option( AALB_TEMPLATE_NAMES );
117
  aalb_find_template_change( $aalb_current_template_names, $aalb_template_names );
118
 
119
+ //ToDO: Make single submit button & move logic for save & remove to separate controllers for HTTP verbs instead of putting along with view
120
+ if ( isset ( $_POST["save"] ) || isset ( $_POST["remove"] ) ) {
121
  $aalb_template_name = stripslashes( $_POST["aalb_template_name"] );
122
  $aalb_template_template_html_box = stripslashes( $_POST["aalb_template_template_html_box"] );
123
  $aalb_template_template_css_box = stripslashes( $_POST["aalb_template_template_css_box"] );
124
  $dir = AALB_TEMPLATE_DIR;
125
  $aalb_template_upload_dir = $helper->get_template_upload_directory();
126
+ if ( isset ( $_POST["save"] ) ) {
127
  if ( $_POST["aalb_template_list"] == "new" ) {
128
  if ( empty( $aalb_template_name ) ) {
129
+ aalb_error_notice( esc_html__( "Please define the template name for the new template", 'amazon-associates-link-builder' ) );
130
  } elseif ( ! ctype_alnum( str_replace( array( '-', '_' ), '', $aalb_template_name ) ) ) {
131
  //The template name can only be alphanumeric characters plus hyphens (-) and underscores (_)
132
+ aalb_error_notice( esc_html__( "Save Failed. Only alphanumeric characters allowed for template name.", 'amazon-associates-link-builder' ) );
133
  } else {
134
  if ( ! is_dir( $aalb_template_upload_dir ) or ! is_writable( $aalb_template_upload_dir ) ) {
135
+ /* translators: %s: Path of upload directory */
136
+ aalb_error_notice( sprintf( esc_html__( "Failed to create custom template. Please set up recursive Read-Write permissions for %s", 'amazon-associates-link-builder' ), $helper->aalb_get_uploads_dir_path() ) );
137
  } else {
138
  //Check if template of that name already exists
139
  if ( in_array( $aalb_template_name, $aalb_template_names ) ) {
140
+ /* translators: %s: Name of the template */
141
+ aalb_error_notice( sprintf( esc_html__( "Save Failed. A template with the name %s already exists. Please specify some other name for the template", 'amazon-associates-link-builder' ), $aalb_template_name ) );
142
  //Ensures state is saved even on save failures
143
  $saveFailed = true;
144
  } else {
166
  aalb_error_notice( $e->getMessage() );
167
  }
168
  }
169
+ } elseif ( isset( $_POST["remove"] ) ) {
170
+ if ( !($_POST["aalb_template_list"] == "new") ) {
171
+ if ( !in_array( $aalb_template_name, $aalb_default_templates ) ) {
172
+ $aalb_template_names = array_diff( $aalb_template_names, array( $aalb_template_name ) );
173
+ update_option( 'aalb_template_names', $aalb_template_names );
174
+
 
 
 
 
175
  if ( unlink( $aalb_template_upload_dir . $aalb_template_name . ".mustache" ) ) {
176
+ aalb_success_notice( esc_html__( "Successfully removed Template HTML", 'amazon-associates-link-builder' ) );
177
  } else {
178
+ /* translators: %s: Name of the template along with absolute file path */
179
+ aalb_error_notice( sprintf( esc_html__( "Couldn't remove Template HTML. Please manually remove %s", 'amazon-associates-link-builder' ), $dir . $aalb_template_name . '.mustache' ) );
180
  }
181
  if ( unlink( $aalb_template_upload_dir . $aalb_template_name . ".css" ) ) {
182
+ aalb_success_notice( esc_html__( "Successfully removed Template CSS", 'amazon-associates-link-builder' ) );
183
  } else {
184
+ /* translators: %s: Name of the template along with complete path */
185
+ aalb_error_notice( sprintf( esc_html__( "Couldn't remove Template CSS. Please manually remove %s", 'amazon-associates-link-builder' ), $dir . $aalb_template_name . '.css' ) );
186
  }
187
+ $aalb_template_name = "";
188
+ $aalb_template_template_html_box = "";
189
+ $aalb_template_template_css_box = "";
190
+ } else {
191
+ aalb_error_notice( esc_html__( "Couldn't remove Default Template", 'amazon-associates-link-builder' ) );
192
  }
193
+ } else {
194
+ aalb_error_notice( esc_html__( "Cannot remove new template. Please select a valid template to remove.", 'amazon-associates-link-builder' ) );
 
 
195
  }
196
+ } else {
197
+ error_log( "Error! Neither save nor remove is set on form submit" );
198
  }
199
  }
200
 
209
 
210
  ?>
211
  <div class="wrap">
212
+ <h2><?php esc_html_e( "Templates for Associates Link Builder", 'amazon-associates-link-builder' ) ?></h2>
213
  <br>
214
  <form method="post">
215
  <table class="widefat fixed">
216
  <tr>
217
+ <th scope="row" style="width:15%;"><?php esc_html_e( "Select Template", 'amazon-associates-link-builder' ) ?></th>
218
  <td>
219
  <select id="aalb_template_list_select" name="aalb_template_list" style="width:50%"
220
  onchange="aalb_template_select_template_onchange(this)">
221
+ <option value="new"><?php esc_html_e( "Create new template", 'amazon-associates-link-builder' ) ?></option>
222
  <?php
223
  foreach ( $aalb_template_names as $aalb_template ) {
224
  ?>
227
  }
228
  ?>
229
  </select>
230
+ <input type="button" name="clone" id="clone_template" class="button button-secondary" value="<?php esc_attr_e( "Clone", 'amazon-associates-link-builder' ) ?>"
231
  onclick="clone_existing_template()" disabled>
232
  </td>
233
  </tr>
234
  <tr>
235
+ <th scope="row" style="width:15%;"><?php esc_html_e( "Set a name for your template", 'amazon-associates-link-builder' ) ?></th>
236
  <td>
237
  <input type="text" id="aalb_template_name" name="aalb_template_name" style="width:50%"
238
  value="<?= ( isset( $aalb_template_name ) ) ? $aalb_template_name : '' ?>"/>
239
  <span style="font-size:0.9em;">[<a
240
  href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-Guide-HowToCreateCustomTemplates.pdf"
241
+ target="_blank"><?php esc_html_e( "Guide for creating custom templates", 'amazon-associates-link-builder' ) ?></a>]</span>
242
  </td>
243
  </tr>
244
  <tr>
245
+ <th scope="row" style="width:15%;"><?php esc_html_e( "Add HTML for your template", 'amazon-associates-link-builder' ) ?></th>
246
  <td><textarea id="aalb_template_template_html_box"
247
  name="aalb_template_template_html_box"><?= ( isset( $aalb_template_template_html_box ) ) ? $aalb_template_template_html_box : '' ?></textarea>
248
  </td>
249
  </tr>
250
  <tr>
251
+ <th scope="row" style="width:15%;"><?php esc_html_e( "Add CSS for your template", 'amazon-associates-link-builder' ) ?></th>
252
  <td><textarea id="aalb_template_template_css_box"
253
  name="aalb_template_template_css_box"><?= ( isset( $aalb_template_template_css_box ) ) ? $aalb_template_template_css_box : '' ?></textarea>
254
  </td>
255
  </tr>
256
  </table>
257
  <p class="submit">
258
+ <input name="save" id="submit_save" class="button button-primary" value="<?php esc_attr_e( "Save", 'amazon-associates-link-builder' ) ?>" type="submit">
259
+ <input name="remove" id="submit_remove" class="button button-secondary" value="<?php esc_attr_e( "Remove", 'amazon-associates-link-builder' ) ?>" type="submit" disabled>
260
  </p>
261
  </form>
262
  </div>
admin/sidebar/partials/aalb_ui_common.php CHANGED
@@ -15,19 +15,23 @@ and limitations under the License.
15
  //some commonly used UI functionality
16
 
17
  function aalb_info_notice( $message ) {
18
- echo "<div class=\"notice notice-info is-dismissible\"><p>INFO - " . $message . "</p></div>";
 
19
  }
20
 
21
  function aalb_warning_notice( $message ) {
22
- echo "<div class=\"notice notice-warning\"><p>WARNING - " . $message . "</p></div>";
 
23
  }
24
 
25
  function aalb_error_notice( $message ) {
26
- echo "<div class=\"notice notice-error\"><p>ERROR - " . $message . "</p></div>";
 
27
  }
28
 
29
  function aalb_success_notice( $message ) {
30
- echo "<div class=\"notice notice-success is-dismissible\"><p>SUCCESS - " . $message . "</p></div>";
 
31
  }
32
 
33
  ?>
15
  //some commonly used UI functionality
16
 
17
  function aalb_info_notice( $message ) {
18
+ /* translators: %s: Information message */
19
+ echo "<div class=\"notice notice-info is-dismissible\"><p>" . sprintf( esc_html__( "INFO - %s", 'amazon-associates-link-builder' ), $message ) . "</p></div>";
20
  }
21
 
22
  function aalb_warning_notice( $message ) {
23
+ /* translators: %s: Warning message */
24
+ echo "<div class=\"notice notice-warning\"><p>" . sprintf( esc_html__( "WARNING - %s", 'amazon-associates-link-builder' ), $message ) . "</p></div>";
25
  }
26
 
27
  function aalb_error_notice( $message ) {
28
+ /* translators: %s: Error message */
29
+ echo "<div class=\"notice notice-error\"><p>" . sprintf( esc_html__( "ERROR - %s", 'amazon-associates-link-builder' ), $message ) . "</p></div>";
30
  }
31
 
32
  function aalb_success_notice( $message ) {
33
+ /* translators: %s: Success message */
34
+ echo "<div class=\"notice notice-success\"><p>" . sprintf( esc_html__( "SUCCESS - %s", 'amazon-associates-link-builder' ), $message ) . "</p></div>";
35
  }
36
 
37
  ?>
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.8
11
  Author: Amazon Associates Program
12
  Author URI: https://affiliate-program.amazon.com/
13
  License: GPLv2
@@ -36,9 +36,9 @@ require_once( plugin_dir_path( __FILE__ ) . 'aalb_config.php' );
36
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'aalb_add_action_links' );
37
  function aalb_add_action_links( $links ) {
38
  $mylinks = array(
39
- '<a href="' . admin_url( 'admin.php?page=associates-link-builder-about' ) . '">About</a>',
40
- '<a href="' . admin_url( 'admin.php?page=associates-link-builder-settings' ) . '">Settings</a>',
41
- '<a href="' . admin_url( 'admin.php?page=associates-link-builder-templates' ) . '">Templates</a>',
42
  );
43
 
44
  return array_merge( $links, $mylinks );
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.9
11
  Author: Amazon Associates Program
12
  Author URI: https://affiliate-program.amazon.com/
13
  License: GPLv2
36
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'aalb_add_action_links' );
37
  function aalb_add_action_links( $links ) {
38
  $mylinks = array(
39
+ '<a href="' . admin_url( 'admin.php?page=associates-link-builder-about' ) . '">' . esc_html__( "About", 'amazon-associates-link-builder' ) . '</a>',
40
+ '<a href="' . admin_url( 'admin.php?page=associates-link-builder-settings' ) . '">' . esc_html__( "Settings", 'amazon-associates-link-builder' ) . '</a>',
41
+ '<a href="' . admin_url( 'admin.php?page=associates-link-builder-templates' ) . '">' . esc_html__( "Templates", 'amazon-associates-link-builder' ) . '</a>',
42
  );
43
 
44
  return array_merge( $links, $mylinks );
includes/aalb_activator.php CHANGED
@@ -63,6 +63,9 @@ class Aalb_Activator {
63
  * @since 1.4.3
64
  */
65
  private function halt_activation() {
 
 
 
66
  exit(sprintf('<span style="color:red;">%s plugin requires PHP Version %s or higher. You’re still on %s.</span>', AALB_PLUGIN_NAME, AALB_PLUGIN_MINIMUM_SUPPORTED_PHP_VERSION, phpversion()));
67
  }
68
 
63
  * @since 1.4.3
64
  */
65
  private function halt_activation() {
66
+ /* This string runs when plugin is not activated & so translation function will not translate it.
67
+ ** So skipping it to put under translator function.
68
+ */
69
  exit(sprintf('<span style="color:red;">%s plugin requires PHP Version %s or higher. You’re still on %s.</span>', AALB_PLUGIN_NAME, AALB_PLUGIN_MINIMUM_SUPPORTED_PHP_VERSION, phpversion()));
70
  }
71
 
includes/aalb_config_loader.php CHANGED
@@ -61,6 +61,7 @@ class Aalb_Config_Loader {
61
  private function parse_json( $json_body ) {
62
  $body = json_decode( $json_body, true );
63
  if ( json_last_error() !== JSON_ERROR_NONE ) {
 
64
  throw new Exception( 'Invalid Json returned by server' . json_last_error() );
65
  }
66
  $marketplaces_info = $body['Local']['Marketplace'];
61
  private function parse_json( $json_body ) {
62
  $body = json_decode( $json_body, true );
63
  if ( json_last_error() !== JSON_ERROR_NONE ) {
64
+ //Don't translate as this is also dumped in error logs and will facilitate AALB team to debug
65
  throw new Exception( 'Invalid Json returned by server' . json_last_error() );
66
  }
67
  $marketplaces_info = $body['Local']['Marketplace'];
includes/aalb_remote_loader.php CHANGED
@@ -67,7 +67,8 @@ class Aalb_Remote_Loader {
67
  if( strpos ( $error_message, CURL_ERROR_TIMEOUT_STRING ) !== false ) {
68
  throw new Exception( HTTP_TIME_OUT );
69
  }
70
- throw new Exception( 'HTTP Request failed! ' . $error_message );
 
71
  }
72
  $code = $response['response']['code'];
73
  if ( $code != HTTP_SUCCESS ) {
@@ -75,7 +76,7 @@ class Aalb_Remote_Loader {
75
  }
76
  $response_body = wp_remote_retrieve_body( $response );
77
  if ( ! isset( $response_body ) || trim( $response_body ) === '' ) {
78
- throw new Exception( 'Response body is empty' );
79
  }
80
 
81
  return $response_body;
67
  if( strpos ( $error_message, CURL_ERROR_TIMEOUT_STRING ) !== false ) {
68
  throw new Exception( HTTP_TIME_OUT );
69
  }
70
+ /* translators: %s: Error message */
71
+ throw new Exception( sprintf( esc_html__( 'HTTP Request failed! %s', 'amazon-associates-link-builder' ), $error_message ) );
72
  }
73
  $code = $response['response']['code'];
74
  if ( $code != HTTP_SUCCESS ) {
76
  }
77
  $response_body = wp_remote_retrieve_body( $response );
78
  if ( ! isset( $response_body ) || trim( $response_body ) === '' ) {
79
+ throw new Exception( esc_html__( 'Response body is empty', 'amazon-associates-link-builder' ) );
80
  }
81
 
82
  return $response_body;
includes/aalb_template_engine.php CHANGED
@@ -94,6 +94,7 @@ class Aalb_Template_Engine {
94
  $xml = simplexml_load_string( $xml_string );
95
 
96
  if ( $xml === false ) {
 
97
  throw new Exception( 'Failed Loading XML' );
98
  }
99
 
94
  $xml = simplexml_load_string( $xml_string );
95
 
96
  if ( $xml === false ) {
97
+ //Don't translate as this is also dumped in error logs and will facilitate AALB team to debug
98
  throw new Exception( 'Failed Loading XML' );
99
  }
100
 
languages/placeholder.txt ADDED
@@ -0,0 +1,2 @@
 
 
1
+ #Remove this file once translator files are available to upload.
2
+ [PlaceHolder file]This is an empty file created to add directory.
lib/php/Paapi/aalb_paapi_helper.php CHANGED
@@ -110,17 +110,21 @@ class Aalb_Paapi_Helper {
110
  function get_error_message( $error ) {
111
  switch ( $error ) {
112
  case HTTP_BAD_REQUEST:
113
- return HTTP_BAD_REQUEST_MESSAGE;
 
114
  case HTTP_FORBIDDEN:
115
- return HTTP_FORBIDDEN_MESSAGE;
 
116
  case HTTP_REQUEST_URI_TOO_LONG:
117
- return HTTP_REQUEST_URI_TOO_LONG_MESSAGE;
118
  case HTTP_INTERNAL_SERVER_ERROR:
119
- return HTTP_INTERNAL_SERVER_ERROR_MESSAGE;
120
  case HTTP_THROTTLE:
121
- return HTTP_THROTTLE_MESSAGE;
 
122
  case HTTP_TIME_OUT:
123
- return HTTP_TIME_OUT_MESSAGE;
 
124
  default:
125
  /**
126
  * <h4> tag ensures that the message is treated as HTML element in jQuery.find in aalb_admin.js.
110
  function get_error_message( $error ) {
111
  switch ( $error ) {
112
  case HTTP_BAD_REQUEST:
113
+ /* translators: 1: URL of Associate sign-up page 2: _blank 3:URL of adding secondary user page 4: _blank */
114
+ return '<h4>' . sprintf( __( "Your AWS Access Key Id is not registered as an Amazon Associate. Please verify that you are <a href=%1s target=%2s>registered as an Amazon Associate</a> in respective locale and you added the email address registered for the Product Advertising API as a <a href=%3s target=%4s>secondary email address in your Amazon Associates account</a>.", 'amazon-associates-link-builder' ), AALB_ASSOCIATE_SIGN_UP_URL, AALB_NEW_PAGE_TARGET, AALB_ADDING_SECONDARY_USER_AC_URL, AALB_NEW_PAGE_TARGET ) . '</h4>';
115
  case HTTP_FORBIDDEN:
116
+ /* translators: 1: URL of PA-API sign-up page 2: _blank */
117
+ return '<h4>' . sprintf( __( "Your AccessKey Id is not registered for Product Advertising API. Please sign up for Product Advertising API by <a href=%1s target=%2s>following these guidelines</a>.", 'amazon-associates-link-builder' ), AALB_PAAPI_SIGN_UP_URL, AALB_NEW_PAGE_TARGET ) . '</h4>';
118
  case HTTP_REQUEST_URI_TOO_LONG:
119
+ return '<h4>' . sprintf( __( "Your AccessKey Id is not registered for Product Advertising API. Please sign up for Product Advertising API by <a href=%1s target=%2s>following these guidelines</a>.", 'amazon-associates-link-builder' ), AALB_PAAPI_SIGN_UP_URL, AALB_NEW_PAGE_TARGET ) . '</h4>';
120
  case HTTP_INTERNAL_SERVER_ERROR:
121
+ return '<h4>' . esc_html__( "Internal server error", 'amazon-associates-link-builder' ) . '</h4>';
122
  case HTTP_THROTTLE:
123
+ /* translators: 1: URL of PA-API efficiency guidelines page 2: _blank */
124
+ return '<h4>' . sprintf( __( "You are submitting requests too quickly. Please retry your requests at a slower rate. For more information, see <a href=%1s target=%2s>Efficiency Guidelines</a>.", 'amazon-associates-link-builder' ), AALB_PAAPI_EFFICIENCY_GUIDELINES_URL, AALB_NEW_PAGE_TARGET ) . '</h4>';
125
  case HTTP_TIME_OUT:
126
+ /* translators: %s: Email-id of the support */
127
+ return '<h4>' . sprintf( __( "Request timed out. Try again after some time. Please check you network and firewall settings. If the error still persists, write to us at %s.", 'amazon-associates-link-builder' ), AALB_SUPPORT_EMAIL_ID ) . '</h4>';
128
  default:
129
  /**
130
  * <h4> tag ensures that the message is treated as HTML element in jQuery.find in aalb_admin.js.
lib/php/aalb_validation_helper.php CHANGED
@@ -99,8 +99,7 @@ class Aalb_Validation_Helper {
99
  $aalb_store_id_names = explode( "\r\n", get_option( AALB_STORE_ID_NAMES ) );
100
  //If the store id used is "not-specified".
101
  if ( $store_id === AALB_DEFAULT_STORE_ID_NAME ) {
102
- $this->helper->show_error_in_preview( "Associate Tag was not found. The sales will not be attributed to any store and you will not earn the associate fees for it. Please provide a valid Associate Tag if you wish to earn the referral fees. Assocaite Tags can be configured from the 'Settings' tab in the WordPress administration panel" );
103
-
104
  return true;
105
  }
106
 
99
  $aalb_store_id_names = explode( "\r\n", get_option( AALB_STORE_ID_NAMES ) );
100
  //If the store id used is "not-specified".
101
  if ( $store_id === AALB_DEFAULT_STORE_ID_NAME ) {
102
+ $this->helper->show_error_in_preview( esc_html__( "Associate Tag was not found. The sales will not be attributed to any store and you will not earn the associate fees for it. Please provide a valid Associate Tag if you wish to earn the referral fees. Assocaite Tags can be configured from the 'Settings' tab in the WordPress administration panel", 'amazon-associates-link-builder' ) );
 
103
  return true;
104
  }
105
 
shortcode/aalb_shortcode_helper.php CHANGED
@@ -140,7 +140,8 @@ class Aalb_Shortcode_Helper {
140
  //Drop Invalid ASIN out of list of asins
141
  $asins_array = array_diff( $asins_array, array( $asin ) );
142
  //Show error message regarding incorrect asin in preview mode only
143
- $this->helper->show_error_in_preview( "The ASIN: '" . $asin . "' is invalid." );
 
144
  }
145
  }
146
 
@@ -163,7 +164,8 @@ class Aalb_Shortcode_Helper {
163
  //Return Default template in case of invalid template name
164
  $validated_template = get_option( AALB_DEFAULT_TEMPLATE );
165
  //Show error message regarding incorrect asin in preview mode only
166
- $this->helper->show_error_in_preview( "The template: '" . $template . "' is invalid. Using default template '" . $validated_template . "'." );
 
167
  }
168
 
169
  return $validated_template;
@@ -185,7 +187,8 @@ class Aalb_Shortcode_Helper {
185
  //Return Default store id in case of invalid store id
186
  $validated_store_id = get_option( AALB_DEFAULT_STORE_ID, AALB_DEFAULT_STORE_ID_NAME );
187
  //Show error message regarding incorrect asin in preview mode only
188
- $this->helper->show_error_in_preview( "The Associate tag '" . $store_id . "' is not present in the list of valid tags. Associate tag has been updated to '" . $validated_store_id . "'. Please check your Associate tag selection or contact the administrator to add a new tag." );
 
189
  }
190
 
191
  return $validated_store_id;
140
  //Drop Invalid ASIN out of list of asins
141
  $asins_array = array_diff( $asins_array, array( $asin ) );
142
  //Show error message regarding incorrect asin in preview mode only
143
+ /* translators: %s: Invalid ASIN name */
144
+ $this->helper->show_error_in_preview( sprintf( esc_html__( "The ASIN: %s is invalid.", 'amazon-associates-link-builder' ), $asin ) );
145
  }
146
  }
147
 
164
  //Return Default template in case of invalid template name
165
  $validated_template = get_option( AALB_DEFAULT_TEMPLATE );
166
  //Show error message regarding incorrect asin in preview mode only
167
+ /* translators: 1: Invalid template name 2: Valid template name */
168
+ $this->helper->show_error_in_preview( sprintf( esc_html__( "The template: %1s is invalid. Using default template %2s.", 'amazon-associates-link-builder' ), $template, $validated_template ) );
169
  }
170
 
171
  return $validated_template;
187
  //Return Default store id in case of invalid store id
188
  $validated_store_id = get_option( AALB_DEFAULT_STORE_ID, AALB_DEFAULT_STORE_ID_NAME );
189
  //Show error message regarding incorrect asin in preview mode only
190
+ /* translators: 1: Invalid associate id 2: Valid associate id */
191
+ $this->helper->show_error_in_preview( sprintf( esc_html__( "The Associate tag %1s is not present in the list of valid tags. Associate tag has been updated to %2s. Please check your Associate tag selection or contact the administrator to add a new tag.", 'amazon-associates-link-builder' ), $store_id, $validated_store_id ) );
192
  }
193
 
194
  return $validated_store_id;
template/ProductAd.css CHANGED
@@ -1,10 +1,3 @@
1
- .aalb-pa-ad-unit {
2
- /*Enable this border property to have a border around the ad unit*/
3
- /*border: 1px solid #d4d4c4;*/
4
- background: #ffffff;
5
- }
6
-
7
- /* Actual styles start below */
8
  .aalb-pa-ad-unit {
9
  position: relative;
10
  overflow: hidden;
@@ -16,16 +9,8 @@
16
  box-shadow: none;
17
  font-family: Arial, Helvetica, sans-serif;
18
  margin: 0;
19
- margin-bottom: 0;
20
- margin-left: 0;
21
- margin-right: 0;
22
- margin-top: 0;
23
  outline: 0;
24
  padding: 0;
25
- padding-bottom: 0;
26
- padding-left: 0;
27
- padding-right: 0;
28
- padding-top: 0;
29
  }
30
 
31
  .aalb-pa-ad-unit.pull-left {
@@ -36,10 +21,6 @@
36
  float: right;
37
  }
38
 
39
- .aalb-pa-ad-unit.pull-left .aalb-pa-product, .aalb-pa-ad-unit.pull-right .aalb-pa-product {
40
- width: 185px !important;
41
- }
42
-
43
  .aalb-pa-ad-unit a {
44
  box-shadow: none !important;
45
  }
@@ -48,32 +29,11 @@
48
  color: #c45500;
49
  }
50
 
51
- .aalb-pa-ad-unit .aalb-pa-ad-header {
52
- padding-left: 3px;
53
- padding-bottom: 9px;
54
- font-size: 17px;
55
- font-weight: normal;
56
- color: #111111;
57
- }
58
-
59
- .aalb-pa-ad-unit .aalb-pa-product-list {
60
- overflow: hidden;
61
- }
62
-
63
- .aalb-pa-ad-unit .aalb-pa-product {
64
- min-width: 185px;
65
- max-width: 385px;
66
- height: auto !important;
67
- padding-top: 22px;
68
- padding-bottom: 22px;
69
- margin-left: 10px;
70
- margin-right: 10px;
71
- float: left;
72
- list-style: none;
73
- text-align: center;
74
  }
75
-
76
- .aalb-pa-ad-unit .aalb-pa-product-image {
77
  display: table;
78
  width: 150px;
79
  height: 150px;
@@ -81,24 +41,24 @@
81
  text-align: center;
82
  }
83
 
84
- .aalb-pa-ad-unit .aalb-pa-product-image-wrapper {
85
  display: table-cell;
86
  vertical-align: middle;
87
  }
88
 
89
- .aalb-pa-ad-unit .aalb-pa-product-image a {
90
  position: relative;
91
  display: inline-block;
92
  vertical-align: middle;
93
  }
94
 
95
- .aalb-pa-ad-unit .aalb-pa-product-image img {
96
  max-width: 150px;
97
  max-height: 150px;
98
  vertical-align: bottom;
99
  }
100
 
101
- .aalb-pa-ad-unit .aalb-pa-percent-off {
102
  display: block;
103
  width: 32px;
104
  height: 27px;
@@ -122,7 +82,7 @@
122
  display: none;
123
  }
124
 
125
- .aalb-pa-ad-unit .aalb-pa-product-details {
126
  display: inline-block;
127
  max-width: 100%;
128
  margin-top: 11px;
@@ -145,26 +105,26 @@
145
  white-space: initial;
146
  }
147
 
148
- .aalb-pa-ad-unit .aalb-pa-product-offer-price {
149
  font-size: 13px;
150
  color: #111111;
151
  }
152
 
153
- .aalb-pa-ad-unit .aalb-pa-product-offer-price-value {
154
  color: #AB1700;
155
  font-weight: bold;
156
  }
157
 
158
- .aalb-pa-ad-unit .aalb-pa-product-list-price {
159
  font-size: 13px;
160
  color: #565656;
161
  }
162
 
163
- .aalb-pa-ad-unit .aalb-pa-product-list-price-value {
164
  text-decoration: line-through;
165
  }
166
 
167
- .aalb-pa-ad-unit .aalb-pa-product-prime-icon .icon-prime-all {
168
  background: url("https://images-na.ssl-images-amazon.com/images/G/01/AUIClients/AmazonUIBaseCSS-sprite_2x_weblab_AUI_100106_T1-4e9f4ae74b1b576e5f55de370aae7aedaedf390d._V2_.png") no-repeat;
169
  display: inline-block;
170
  margin-top: -1px;
@@ -175,58 +135,13 @@
175
  height: 15px;
176
  }
177
 
178
- .aalb-pa-ad-unit .aalb-pa-product-offer-price,
179
- .aalb-pa-ad-unit .aalb-pa-product-list-price,
180
- .aalb-pa-ad-unit .aalb-pa-product-prime-icon {
181
  display: inline-block;
182
  margin-right: 2px;
183
  }
184
 
185
- .aalb-pa-ad-unit .aalb-pa-btn-prev,
186
- .aalb-pa-ad-unit .aalb-pa-btn-next {
187
- position: absolute;
188
- top: 50%;
189
- margin-top: -52px;
190
- display: block;
191
- visibility: hidden;
192
- width: 43px;
193
- height: 105px;
194
- z-index: 2;
195
- line-height: 105px;
196
- background: #ffffff;
197
- color: #D0D0D0;
198
- font-size: 35px;
199
- text-align: center;
200
- text-decoration: none;
201
- border: 1px solid #e9e9e9;
202
- -webkit-box-shadow: 0 0 4px #e9e9e9;
203
- box-shadow: 0 0 4px #e9e9e9;
204
- }
205
-
206
- .aalb-pa-ad-unit .aalb-pa-btn-prev:hover,
207
- .aalb-pa-ad-unit .aalb-pa-btn-next:hover {
208
- color: #999999;
209
- }
210
-
211
- .aalb-pa-ad-unit .aalb-pa-btn-prev:focus,
212
- .aalb-pa-ad-unit .aalb-pa-btn-next:focus {
213
- outline: none;
214
- }
215
-
216
- .aalb-pa-ad-unit .aalb-pa-btn-prev {
217
- left: 0;
218
- border-left: 0;
219
- border-top-right-radius: 20px;
220
- border-bottom-right-radius: 20px;
221
- }
222
-
223
- .aalb-pa-ad-unit .aalb-pa-btn-next {
224
- right: 0;
225
- border-right: 0;
226
- border-top-left-radius: 20px;
227
- border-bottom-left-radius: 20px;
228
- }
229
-
230
  @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
231
  .aalb-pa-ad-unit .aalb-pa-product-prime-icon .icon-prime-all {
232
  background: url("https://images-na.ssl-images-amazon.com/images/G/01/AUIClients/AmazonUIBaseCSS-sprite_2x_weblab_AUI_100106_T1-4e9f4ae74b1b576e5f55de370aae7aedaedf390d._V2_.png") no-repeat;
@@ -238,4 +153,22 @@
238
  width: 52px;
239
  height: 15px;
240
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  }
 
 
 
 
 
 
 
1
  .aalb-pa-ad-unit {
2
  position: relative;
3
  overflow: hidden;
9
  box-shadow: none;
10
  font-family: Arial, Helvetica, sans-serif;
11
  margin: 0;
 
 
 
 
12
  outline: 0;
13
  padding: 0;
 
 
 
 
14
  }
15
 
16
  .aalb-pa-ad-unit.pull-left {
21
  float: right;
22
  }
23
 
 
 
 
 
24
  .aalb-pa-ad-unit a {
25
  box-shadow: none !important;
26
  }
29
  color: #c45500;
30
  }
31
 
32
+ .aalb-pa-product-container {
33
+ width: 205px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
35
+ /* fixed width and height of product image to 150px */
36
+ .aalb-pa-product-image {
37
  display: table;
38
  width: 150px;
39
  height: 150px;
41
  text-align: center;
42
  }
43
 
44
+ .aalb-pa-product-image-wrapper {
45
  display: table-cell;
46
  vertical-align: middle;
47
  }
48
 
49
+ .aalb-pa-product-image-link {
50
  position: relative;
51
  display: inline-block;
52
  vertical-align: middle;
53
  }
54
 
55
+ .aalb-pa-product-image-source {
56
  max-width: 150px;
57
  max-height: 150px;
58
  vertical-align: bottom;
59
  }
60
 
61
+ .aalb-pa-percent-off {
62
  display: block;
63
  width: 32px;
64
  height: 27px;
82
  display: none;
83
  }
84
 
85
+ .aalb-pa-product-details {
86
  display: inline-block;
87
  max-width: 100%;
88
  margin-top: 11px;
105
  white-space: initial;
106
  }
107
 
108
+ .aalb-pa-product-offer-price {
109
  font-size: 13px;
110
  color: #111111;
111
  }
112
 
113
+ .aalb-pa-product-offer-price-value {
114
  color: #AB1700;
115
  font-weight: bold;
116
  }
117
 
118
+ .aalb-pa-product-list-price {
119
  font-size: 13px;
120
  color: #565656;
121
  }
122
 
123
+ .aalb-pa-product-list-price-value {
124
  text-decoration: line-through;
125
  }
126
 
127
+ .aalb-pa-product-prime-icon .icon-prime-all {
128
  background: url("https://images-na.ssl-images-amazon.com/images/G/01/AUIClients/AmazonUIBaseCSS-sprite_2x_weblab_AUI_100106_T1-4e9f4ae74b1b576e5f55de370aae7aedaedf390d._V2_.png") no-repeat;
129
  display: inline-block;
130
  margin-top: -1px;
135
  height: 15px;
136
  }
137
 
138
+ .aalb-pa-product-offer-price,
139
+ .aalb-pa-product-list-price,
140
+ .aalb-pa-product-prime-icon {
141
  display: inline-block;
142
  margin-right: 2px;
143
  }
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
146
  .aalb-pa-ad-unit .aalb-pa-product-prime-icon .icon-prime-all {
147
  background: url("https://images-na.ssl-images-amazon.com/images/G/01/AUIClients/AmazonUIBaseCSS-sprite_2x_weblab_AUI_100106_T1-4e9f4ae74b1b576e5f55de370aae7aedaedf390d._V2_.png") no-repeat;
153
  width: 52px;
154
  height: 15px;
155
  }
156
+ }
157
+
158
+ /* css for mobile devices when device width is less than 441px*/
159
+ @media screen and (max-width: 440px) {
160
+ .aalb-pa-ad-unit {
161
+ float: none;
162
+ width: 100%;
163
+ }
164
+
165
+ .aalb-pa-product-container {
166
+ margin: 0 auto;
167
+ width: 100%;
168
+ }
169
+
170
+ .aalb-pa-product-details {
171
+ text-align: center;
172
+ margin-top: 11px;
173
+ }
174
  }
template/ProductAd.mustache CHANGED
@@ -1,16 +1,13 @@
1
  {{#Items}} <!--Section tag for iterating through the list of items-->
2
  <!-- Single product Ad Template Layout. Position of the Ad can be configured by specifying pull-left or pull-right class below-->
3
  <div class="aalb-pa-ad-unit pull-left" id="{{ID}}">
4
- <div class="aalb-pa-wrapper">
5
- <div class="aalb-pa-product-container">
6
- <ul class="aalb-pa-product-list">
7
  {{#Item}} <!-- Section tag for beginning of information on one item -->
8
  {{#aalb}} <!-- Section tag for picking up information on attributes for the item -->
9
- <li class="aalb-pa-product">
10
  <div class="aalb-pa-product-image">
11
  <div class="aalb-pa-product-image-wrapper">
12
- <a href="{{DetailPageURL}}" title="{{Title}}" target="_blank" rel="nofollow"> <!--Individual attributes are provided as variable tags as {{[[attribute]]}}. Check documentation for list of supported variable tags.-->
13
- <img src="{{MediumImageURL}}" srcset="{{LargeImageURL}}" alt="{{Title}}" />
14
  {{#SavingPercent}} <!-- The section tag ensures that percentage savings is displayed only if it is available -->
15
  <span class="aalb-pa-percent-off">
16
  -{{SavingPercent}}%
@@ -41,96 +38,11 @@
41
  </div>
42
  {{/Prime}}
43
  </div>
44
- </li>
45
  {{/aalb}}
46
  {{/Item}}
47
- </ul>
48
  </div>
49
- </div>
50
- <a href="javascript:void(0);" class="aalb-pa-btn-prev">‹</a>
51
- <a href="javascript:void(0);" class="aalb-pa-btn-next">›</a>
52
- </div>
53
  {{/Items}}
54
 
55
- <script>
56
- jQuery(document).ready(function() {
57
 
58
- var CONSTANTS = {
59
- productMinWidth : 185,
60
- productMargin : 20
61
- };
62
-
63
- var $adUnits = jQuery('.aalb-pa-ad-unit');
64
- $adUnits.each(function() {
65
- var $adUnit = jQuery(this),
66
- $wrapper = $adUnit.find('.aalb-pa-wrapper'),
67
- $productContainer = $adUnit.find('.aalb-pa-product-container'),
68
- $btnNext = $adUnit.find('.aalb-pa-btn-next'),
69
- $btnPrev = $adUnit.find('.aalb-pa-btn-prev'),
70
- $productList = $productContainer.find('.aalb-pa-product-list'),
71
- $products = $productList.find('.aalb-pa-product'),
72
- productCount = $products.length;
73
-
74
- if (!productCount) {
75
- return true;
76
- }
77
-
78
- var rows = $adUnit.find('input[name=rows]').length && parseInt($adUnit.find('input[name=rows]').val(), 10),
79
- columns = $adUnit.find('input[name=columns]').length && parseInt($adUnit.find('input[name=columns]').val(), 10),
80
- disableCarousel = $adUnit.find('input[name=disable-carousel]').length || rows || columns;
81
-
82
- if (columns) {
83
- var productContainerMinWidth = columns * (CONSTANTS.productMinWidth + CONSTANTS.productMargin) + 'px';
84
- $adUnit.css('min-width', productContainerMinWidth);
85
- $productContainer.css('min-width', productContainerMinWidth);
86
- $products.filter(':nth-child(' + columns + 'n + 1)').css('clear', 'both');
87
- }
88
-
89
- if (rows && columns) {
90
- var cutOffIndex = (rows * columns) - 1;
91
- $products.filter(':gt(' + cutOffIndex + ')').remove();
92
- }
93
-
94
- function updateLayout() {
95
- var wrapperWidth = $wrapper.width(),
96
- possibleColumns = columns || parseInt(wrapperWidth / (CONSTANTS.productMinWidth + CONSTANTS.productMargin), 10),
97
- actualColumns = columns || possibleColumns < productCount ? possibleColumns : productCount,
98
- productWidth = parseInt(wrapperWidth / actualColumns, 10) - CONSTANTS.productMargin;
99
-
100
- $products.css('width', productWidth + 'px');
101
-
102
- if (!disableCarousel) {
103
- if ((productCount * productWidth > wrapperWidth) && actualColumns !== 1) {
104
- $btnNext.css('visibility', 'visible').removeClass('disabled').unbind('click');
105
- $btnPrev.css('visibility', 'visible').removeClass('disabled').unbind('click');
106
- $productContainer.jCarouselLite({
107
- btnNext : '#' + $adUnit.attr('id') + ' .aalb-pa-btn-next',
108
- btnPrev : '#' + $adUnit.attr('id') + ' .aalb-pa-btn-prev',
109
- visible : actualColumns,
110
- circular : false
111
- });
112
- } else {
113
- $productContainer.css('width', 'auto');
114
- $productList.css('width', 'auto');
115
- $btnNext.css('visibility', 'hidden').unbind('click');
116
- $btnPrev.css('visibility', 'hidden').unbind('click');
117
- }
118
- }
119
- }
120
-
121
- updateLayout();
122
- jQuery(window).resize(updateLayout);
123
- });
124
- });
125
-
126
- /*!
127
- * jCarouselLite - v1.1 - 2014-09-28
128
- * http://www.gmarwaha.com/jquery/jcarousellite/
129
- * Copyright (c) 2014 Ganeshji Marwaha
130
- * Licensed MIT (https://github.com/ganeshmax/jcarousellite/blob/master/LICENSE)
131
- */
132
-
133
- !function(a){a.jCarouselLite={version:"1.1"},a.fn.jCarouselLite=function(b){return b=a.extend({},a.fn.jCarouselLite.options,b||{}),this.each(function(){function c(a){return n||(clearTimeout(A),z=a,b.beforeStart&&b.beforeStart.call(this,i()),b.circular?j(a):k(a),m({start:function(){n=!0},done:function(){b.afterEnd&&b.afterEnd.call(this,i()),b.auto&&h(),n=!1}}),b.circular||l()),!1}function d(){if(n=!1,o=b.vertical?"top":"left",p=b.vertical?"height":"width",q=B.find(">ul"),r=q.find(">li"),x=r.size(),w=x<b.visible?x:b.visible,b.circular){var c=r.slice(x-w).clone(),d=r.slice(0,w).clone();q.prepend(c).append(d),b.start+=w}s=a("li",q),y=s.size(),z=b.start}function e(){B.css("visibility","visible"),s.css({overflow:"hidden","float":b.vertical?"none":"left"}),q.css({margin:"0",padding:"0",position:"relative","list-style":"none","z-index":"1"}),B.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"}),!b.circular&&b.btnPrev&&0==b.start&&a(b.btnPrev).addClass("disabled")}function f(){t=b.vertical?s.outerHeight(!0):s.outerWidth(!0),u=t*y,v=t*w,s.css({width:s.width(),height:s.height()}),q.css(p,u+"px").css(o,-(z*t)),B.css(p,v+"px")}function g(){b.btnPrev&&a(b.btnPrev).click(function(){return c(z-b.scroll)}),b.btnNext&&a(b.btnNext).click(function(){return c(z+b.scroll)}),b.btnGo&&a.each(b.btnGo,function(d,e){a(e).click(function(){return c(b.circular?w+d:d)})}),b.mouseWheel&&B.mousewheel&&B.mousewheel(function(a,d){return c(d>0?z-b.scroll:z+b.scroll)}),b.auto&&h()}function h(){A=setTimeout(function(){c(z+b.scroll)},b.auto)}function i(){return s.slice(z).slice(0,w)}function j(a){var c;a<=b.start-w-1?(c=a+x+b.scroll,q.css(o,-(c*t)+"px"),z=c-b.scroll):a>=y-w+1&&(c=a-x-b.scroll,q.css(o,-(c*t)+"px"),z=c+b.scroll)}function k(a){0>a?z=0:a>y-w&&(z=y-w)}function l(){a(b.btnPrev+","+b.btnNext).removeClass("disabled"),a(z-b.scroll<0&&b.btnPrev||z+b.scroll>y-w&&b.btnNext||[]).addClass("disabled")}function m(c){n=!0,q.animate("left"==o?{left:-(z*t)}:{top:-(z*t)},a.extend({duration:b.speed,easing:b.easing},c))}var n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=a(this);d(),e(),f(),g()})},a.fn.jCarouselLite.options={btnPrev:null,btnNext:null,btnGo:null,mouseWheel:!1,auto:null,speed:200,easing:null,vertical:!1,circular:!0,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null}}(jQuery);
134
-
135
-
136
- </script>
1
  {{#Items}} <!--Section tag for iterating through the list of items-->
2
  <!-- Single product Ad Template Layout. Position of the Ad can be configured by specifying pull-left or pull-right class below-->
3
  <div class="aalb-pa-ad-unit pull-left" id="{{ID}}">
4
+ <div class="aalb-pa-product-container">
 
 
5
  {{#Item}} <!-- Section tag for beginning of information on one item -->
6
  {{#aalb}} <!-- Section tag for picking up information on attributes for the item -->
 
7
  <div class="aalb-pa-product-image">
8
  <div class="aalb-pa-product-image-wrapper">
9
+ <a class="aalb-pa-product-image-link" href="{{DetailPageURL}}" title="{{Title}}" target="_blank" rel="nofollow"> <!--Individual attributes are provided as variable tags as {{[[attribute]]}}. Check documentation for list of supported variable tags.-->
10
+ <img class="aalb-pa-product-image-source" src="{{MediumImageURL}}" srcset="{{LargeImageURL}}" alt="{{Title}}" />
11
  {{#SavingPercent}} <!-- The section tag ensures that percentage savings is displayed only if it is available -->
12
  <span class="aalb-pa-percent-off">
13
  -{{SavingPercent}}%
38
  </div>
39
  {{/Prime}}
40
  </div>
 
41
  {{/aalb}}
42
  {{/Item}}
 
43
  </div>
44
+ </div>
45
+ </div>
 
 
46
  {{/Items}}
47
 
 
 
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
template/ProductGrid.css CHANGED
@@ -1,10 +1,3 @@
1
- .aalb-pg-ad-unit {
2
- /*Enable this border property to have a border around the ad unit*/
3
- /*border: 1px solid #d4d4c4;*/
4
- background: #ffffff;
5
- }
6
-
7
- /* Actual styles start below */
8
  .aalb-pg-ad-unit {
9
  position: relative;
10
  overflow: hidden;
@@ -16,16 +9,8 @@
16
  box-shadow: none;
17
  font-family: Arial, Helvetica, sans-serif;
18
  margin: 0;
19
- margin-bottom: 0;
20
- margin-left: 0;
21
- margin-right: 0;
22
- margin-top: 0;
23
  outline: 0;
24
  padding: 0;
25
- padding-bottom: 0;
26
- padding-left: 0;
27
- padding-right: 0;
28
- padding-top: 0;
29
  }
30
 
31
  .aalb-pg-ad-unit.pull-left {
@@ -62,20 +47,18 @@
62
  overflow: hidden;
63
  }
64
 
65
- .aalb-pg-ad-unit .aalb-pg-product {
66
- min-width: 185px;
67
- max-width: 385px;
68
- height: auto !important;
69
  padding-top: 22px;
70
  padding-bottom: 22px;
71
- margin-left: 10px;
72
- margin-right: 10px;
73
  float: left;
74
  list-style: none;
75
  text-align: center;
76
  }
77
 
78
- .aalb-pg-ad-unit .aalb-pg-product-image {
79
  display: table;
80
  width: 150px;
81
  height: 150px;
@@ -124,10 +107,9 @@
124
  display: none;
125
  }
126
 
127
- .aalb-pg-ad-unit .aalb-pg-product-details {
128
- display: inline-block;
129
- max-width: 100%;
130
- margin-top: 11px;
131
  text-align: left;
132
  }
133
 
@@ -184,51 +166,6 @@
184
  margin-right: 2px;
185
  }
186
 
187
- .aalb-pg-ad-unit .aalb-pg-btn-prev,
188
- .aalb-pg-ad-unit .aalb-pg-btn-next {
189
- position: absolute;
190
- top: 50%;
191
- margin-top: -52px;
192
- display: block;
193
- visibility: hidden;
194
- width: 43px;
195
- height: 105px;
196
- z-index: 2;
197
- line-height: 105px;
198
- background: #ffffff;
199
- color: #D0D0D0;
200
- font-size: 35px;
201
- text-align: center;
202
- text-decoration: none;
203
- border: 1px solid #e9e9e9;
204
- -webkit-box-shadow: 0 0 4px #e9e9e9;
205
- box-shadow: 0 0 4px #e9e9e9;
206
- }
207
-
208
- .aalb-pg-ad-unit .aalb-pg-btn-prev:hover,
209
- .aalb-pg-ad-unit .aalb-pg-btn-next:hover {
210
- color: #999999;
211
- }
212
-
213
- .aalb-pg-ad-unit .aalb-pg-btn-prev:focus,
214
- .aalb-pg-ad-unit .aalb-pg-btn-next:focus {
215
- outline: none;
216
- }
217
-
218
- .aalb-pg-ad-unit .aalb-pg-btn-prev {
219
- left: 0;
220
- border-left: 0;
221
- border-top-right-radius: 20px;
222
- border-bottom-right-radius: 20px;
223
- }
224
-
225
- .aalb-pg-ad-unit .aalb-pg-btn-next {
226
- right: 0;
227
- border-right: 0;
228
- border-top-left-radius: 20px;
229
- border-bottom-left-radius: 20px;
230
- }
231
-
232
  @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
233
  .aalb-pg-ad-unit .aalb-pg-product-prime-icon .icon-prime-all {
234
  background: url("https://images-na.ssl-images-amazon.com/images/G/01/AUIClients/AmazonUIBaseCSS-sprite_2x_weblab_AUI_100106_T1-4e9f4ae74b1b576e5f55de370aae7aedaedf390d._V2_.png") no-repeat;
@@ -240,4 +177,25 @@
240
  width: 52px;
241
  height: 15px;
242
  }
243
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  .aalb-pg-ad-unit {
2
  position: relative;
3
  overflow: hidden;
9
  box-shadow: none;
10
  font-family: Arial, Helvetica, sans-serif;
11
  margin: 0;
 
 
 
 
12
  outline: 0;
13
  padding: 0;
 
 
 
 
14
  }
15
 
16
  .aalb-pg-ad-unit.pull-left {
47
  overflow: hidden;
48
  }
49
 
50
+ .aalb-pg-product {
51
+ /* Make width 205px as defined in updateLayout() function in ProductGrid.mustache and height 290px to make li as grid and contain height of stretching cell */
52
+ height: 290px;
53
+ width: 205px;
54
  padding-top: 22px;
55
  padding-bottom: 22px;
 
 
56
  float: left;
57
  list-style: none;
58
  text-align: center;
59
  }
60
 
61
+ .aalb-pg-product-image {
62
  display: table;
63
  width: 150px;
64
  height: 150px;
107
  display: none;
108
  }
109
 
110
+ .aalb-pg-product-details {
111
+ max-width: 205px;
112
+ margin: 11px 10px 0 10px;
 
113
  text-align: left;
114
  }
115
 
166
  margin-right: 2px;
167
  }
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
170
  .aalb-pg-ad-unit .aalb-pg-product-prime-icon .icon-prime-all {
171
  background: url("https://images-na.ssl-images-amazon.com/images/G/01/AUIClients/AmazonUIBaseCSS-sprite_2x_weblab_AUI_100106_T1-4e9f4ae74b1b576e5f55de370aae7aedaedf390d._V2_.png") no-repeat;
177
  width: 52px;
178
  height: 15px;
179
  }
180
+ }
181
+
182
+ /* css for mobile devices when device width is less than 441px*/
183
+ @media screen and (max-width: 440px) {
184
+ .aalb-pg-ad-unit {
185
+ padding: 0;
186
+ max-width: 100%;
187
+ }
188
+
189
+ .aalb-pg-product {
190
+ max-width: 100%;
191
+ padding-top: 22px;
192
+ padding-bottom: 22px;
193
+ margin: 0 auto;
194
+ list-style: none;
195
+ float: none;
196
+ }
197
+
198
+ .aalb-pg-product-image {
199
+ margin: 0 auto;
200
+ }
201
+ }
template/ProductGrid.mustache CHANGED
@@ -1,9 +1,7 @@
1
  <!-- A 2x5 Grid Template Layout. It can be configured by the two input fields below -->
2
  {{#Items}} <!--Section tag for iterating through the list of items-->
3
  <div class="aalb-pg-ad-unit" id="{{ID}}">
4
- <input type="hidden" name="columns" value="2" />
5
- <input type="hidden" name="rows" value="5" />
6
- <h2 class="aalb-pg-ad-header">{{#AalbHeader}}{{#MarketplaceUS}}Products from Amazon.com{{/MarketplaceUS}}{{#MarketplaceFR}}Produits disponibles sur Amazon.fr {{/MarketplaceFR}}{{#MarketplaceIT}}Acquista su Amazon.it{{/MarketplaceIT}}{{#MarketplaceDE}}Produkte von Amazon.de{{/MarketplaceDE}}{{#MarketplaceES}}Producto disponible en Amazon.es{{/MarketplaceES}}{{#MarketplaceBR}}Products from Amazon.com.br{{/MarketplaceBR}}{{#MarketplaceCA}}Products from Amazon.ca{{/MarketplaceCA}}{{#MarketplaceCN}}Products from Amazon.cn{{/MarketplaceCN}}{{#MarketplaceIN}}Products from Amazon.in{{/MarketplaceIN}}{{#MarketplaceJP}}Products from Amazon.co.jp{{/MarketplaceJP}}{{#MarketplaceMX}}Products from Amazon.com.mx{{/MarketplaceMX}}{{#MarketplaceUK}}Products from Amazon.co.uk{{/MarketplaceUK}}{{/AalbHeader}}</h2> <!-- Title of the ad localized according to the marketplace picked from the AalbHeader tag -->
7
  <div class="aalb-pg-wrapper">
8
  <div class="aalb-pg-product-container">
9
  <ul class="aalb-pg-product-list">
@@ -50,114 +48,5 @@
50
  </ul>
51
  </div>
52
  </div>
53
- <a href="javascript:void(0);" class="aalb-pg-btn-prev">‹</a>
54
- <a href="javascript:void(0);" class="aalb-pg-btn-next">›</a>
55
  </div>
56
  {{/Items}}
57
-
58
- <script>
59
- jQuery(document).ready(function() {
60
-
61
- var CONSTANTS = {
62
- productMinWidth : 185,
63
- productMargin : 20
64
- };
65
-
66
- var $adUnits = jQuery('.aalb-pg-ad-unit');
67
- $adUnits.each(function() {
68
- var $adUnit = jQuery(this),
69
- $wrapper = $adUnit.find('.aalb-pg-wrapper'),
70
- $productContainer = $adUnit.find('.aalb-pg-product-container'),
71
- $btnNext = $adUnit.find('.aalb-pg-btn-next'),
72
- $btnPrev = $adUnit.find('.aalb-pg-btn-prev'),
73
- $productList = $productContainer.find('.aalb-pg-product-list'),
74
- $products = $productList.find('.aalb-pg-product'),
75
- productCount = $products.length;
76
-
77
- if (!productCount) {
78
- return true;
79
- }
80
-
81
- var rows = $adUnit.find( 'input[name=rows]' ).length && parseInt( $adUnit.find( 'input[name=rows]' ).val(), 10 );
82
- var columns = $adUnit.find( 'input[name=columns]' ).length && parseInt( $adUnit.find( 'input[name=columns]' ).val(), 10 );
83
- var disableCarousel = $adUnit.find( 'input[name=disable-carousel]' ).length || rows || columns;
84
-
85
- if( columns ) {
86
- var productContainerMinWidth = columns * (CONSTANTS.productMinWidth + CONSTANTS.productMargin) + 'px';
87
- $adUnit.css( 'min-width', productContainerMinWidth );
88
- $productContainer.css( 'min-width', productContainerMinWidth );
89
- $products.filter( ':nth-child(' + columns + 'n + 1)' ).css( 'clear', 'both' );
90
- }
91
-
92
- if( rows && columns ) {
93
- var cutOffIndex = (rows * columns) - 1;
94
- $products.filter( ':gt(' + cutOffIndex + ')' ).remove();
95
- }
96
-
97
- function updateLayout() {
98
- //removing residual styles on screen resize
99
- $products.removeAttr("style");
100
- var wrapperWidth = $wrapper.width();
101
-
102
- var possibleColumns = parseInt( wrapperWidth / (CONSTANTS.productMinWidth + CONSTANTS.productMargin), 10 ) || columns;
103
- var actualColumns = possibleColumns < productCount ? possibleColumns : productCount || columns;
104
- var productWidth = parseInt( wrapperWidth / actualColumns, 10 ) - CONSTANTS.productMargin;
105
-
106
- /**
107
- * calculating productContainerMinWidth and assigning it as min-width to adUnit ,ProductContainer and
108
- * products of ADUnit displayed on updateLayout as to override the values coming from closure.Becuase of
109
- * closure the wrapper width was having values generated when the screen was rendered at first time.
110
- */
111
- var productContainerMinWidth = actualColumns * (CONSTANTS.productMinWidth + CONSTANTS.productMargin) + 'px';
112
- $adUnit.css( 'min-width', productContainerMinWidth );
113
- $productContainer.css( 'min-width', productContainerMinWidth );
114
- $products.filter( ':nth-child(' + actualColumns + 'n + 1)' ).css( 'clear', 'both' );
115
-
116
- /**
117
- * When actualColumns is 1 ,the images tend to move towards right of wrapper area.Therefore assigning the
118
- * productContainerMinWidth to product when actualColumns is 1
119
- **/
120
- if( actualColumns == 1 ) {
121
- $products.css( 'width', productContainerMinWidth + 'px' );
122
- var productImage = jQuery('.aalb-pg-product-image');
123
- productImage.css('margin-left','0px');
124
- }
125
- else {
126
- $products.css( 'width', productWidth + 'px' );
127
- }
128
-
129
- if (!disableCarousel) {
130
- if ((productCount * productWidth > wrapperWidth) && actualColumns !== 1) {
131
- $btnNext.css('visibility', 'visible').removeClass('disabled').unbind('click');
132
- $btnPrev.css('visibility', 'visible').removeClass('disabled').unbind('click');
133
- $productContainer.jCarouselLite({
134
- btnNext : '#' + $adUnit.attr('id') + ' .aalb-pg-btn-next',
135
- btnPrev : '#' + $adUnit.attr('id') + ' .aalb-pg-btn-prev',
136
- visible : actualColumns,
137
- circular : false
138
- });
139
- } else {
140
- $productContainer.css('width', 'auto');
141
- $productList.css('width', 'auto');
142
- $btnNext.css('visibility', 'hidden').unbind('click');
143
- $btnPrev.css('visibility', 'hidden').unbind('click');
144
- }
145
- }
146
- }
147
-
148
- updateLayout();
149
- jQuery(window).resize(updateLayout);
150
- });
151
- });
152
-
153
- /*!
154
- * jCarouselLite - v1.1 - 2014-09-28
155
- * http://www.gmarwaha.com/jquery/jcarousellite/
156
- * Copyright (c) 2014 Ganeshji Marwaha
157
- * Licensed MIT (https://github.com/ganeshmax/jcarousellite/blob/master/LICENSE)
158
- */
159
-
160
- !function(a){a.jCarouselLite={version:"1.1"},a.fn.jCarouselLite=function(b){return b=a.extend({},a.fn.jCarouselLite.options,b||{}),this.each(function(){function c(a){return n||(clearTimeout(A),z=a,b.beforeStart&&b.beforeStart.call(this,i()),b.circular?j(a):k(a),m({start:function(){n=!0},done:function(){b.afterEnd&&b.afterEnd.call(this,i()),b.auto&&h(),n=!1}}),b.circular||l()),!1}function d(){if(n=!1,o=b.vertical?"top":"left",p=b.vertical?"height":"width",q=B.find(">ul"),r=q.find(">li"),x=r.size(),w=x<b.visible?x:b.visible,b.circular){var c=r.slice(x-w).clone(),d=r.slice(0,w).clone();q.prepend(c).append(d),b.start+=w}s=a("li",q),y=s.size(),z=b.start}function e(){B.css("visibility","visible"),s.css({overflow:"hidden","float":b.vertical?"none":"left"}),q.css({margin:"0",padding:"0",position:"relative","list-style":"none","z-index":"1"}),B.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"}),!b.circular&&b.btnPrev&&0==b.start&&a(b.btnPrev).addClass("disabled")}function f(){t=b.vertical?s.outerHeight(!0):s.outerWidth(!0),u=t*y,v=t*w,s.css({width:s.width(),height:s.height()}),q.css(p,u+"px").css(o,-(z*t)),B.css(p,v+"px")}function g(){b.btnPrev&&a(b.btnPrev).click(function(){return c(z-b.scroll)}),b.btnNext&&a(b.btnNext).click(function(){return c(z+b.scroll)}),b.btnGo&&a.each(b.btnGo,function(d,e){a(e).click(function(){return c(b.circular?w+d:d)})}),b.mouseWheel&&B.mousewheel&&B.mousewheel(function(a,d){return c(d>0?z-b.scroll:z+b.scroll)}),b.auto&&h()}function h(){A=setTimeout(function(){c(z+b.scroll)},b.auto)}function i(){return s.slice(z).slice(0,w)}function j(a){var c;a<=b.start-w-1?(c=a+x+b.scroll,q.css(o,-(c*t)+"px"),z=c-b.scroll):a>=y-w+1&&(c=a-x-b.scroll,q.css(o,-(c*t)+"px"),z=c+b.scroll)}function k(a){0>a?z=0:a>y-w&&(z=y-w)}function l(){a(b.btnPrev+","+b.btnNext).removeClass("disabled"),a(z-b.scroll<0&&b.btnPrev||z+b.scroll>y-w&&b.btnNext||[]).addClass("disabled")}function m(c){n=!0,q.animate("left"==o?{left:-(z*t)}:{top:-(z*t)},a.extend({duration:b.speed,easing:b.easing},c))}var n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=a(this);d(),e(),f(),g()})},a.fn.jCarouselLite.options={btnPrev:null,btnNext:null,btnGo:null,mouseWheel:!1,auto:null,speed:200,easing:null,vertical:!1,circular:!0,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null}}(jQuery);
161
-
162
-
163
- </script>
1
  <!-- A 2x5 Grid Template Layout. It can be configured by the two input fields below -->
2
  {{#Items}} <!--Section tag for iterating through the list of items-->
3
  <div class="aalb-pg-ad-unit" id="{{ID}}">
4
+ <h2 class="aalb-pg-ad-header">{{#AalbHeader}}{{#MarketplaceUS}}Products from Amazon.com{{/MarketplaceUS}}{{#MarketplaceFR}}Produits disponibles sur Amazon.fr {{/MarketplaceFR}}{{#MarketplaceIT}}Acquista su Amazon.it{{/MarketplaceIT}}{{#MarketplaceDE}}Produkte von Amazon.de{{/MarketplaceDE}}{{#MarketplaceES}}Producto disponible en Amazon.es{{/MarketplaceES}}{{#MarketplaceBR}}Products from Amazon.com.br{{/MarketplaceBR}}{{#MarketplaceCA}}Products from Amazon.ca{{/MarketplaceCA}}{{#MarketplaceCN}}Products from Amazon.cn{{/MarketplaceCN}}{{#MarketplaceIN}}Products from Amazon.in{{/MarketplaceIN}}{{#MarketplaceJP}}Products from Amazon.co.jp{{/MarketplaceJP}}{{#MarketplaceMX}}Products from Amazon.com.mx{{/MarketplaceMX}}{{#MarketplaceUK}}Products from Amazon.co.uk{{/MarketplaceUK}}{{/AalbHeader}}</h2> <!-- Title of the ad localized according to the marketplace picked from the AalbHeader tag -->
 
 
5
  <div class="aalb-pg-wrapper">
6
  <div class="aalb-pg-product-container">
7
  <ul class="aalb-pg-product-list">
48
  </ul>
49
  </div>
50
  </div>
 
 
51
  </div>
52
  {{/Items}}