Version Description
- March 14, 2018 =
- Added Impressions data in reports shown on respective associates website. This will work only for ads rendered after upgrade to this release.
Download this release
Release Info
Developer | amazonlinkbuilder |
Plugin | Amazon Associates Link Builder |
Version | 1.6.0 |
Comparing to | |
See all releases |
Code changes from version 1.5.4 to 1.6.0
- NOTICE.txt +1 -1
- aalb_admin_item_search_items.php +1 -1
- aalb_config.php +2 -2
- admin/aalb_admin.php +1 -1
- admin/css/aalb_admin.css +1 -1
- admin/css/aalb_credentials.css +1 -1
- admin/js/aalb_admin.js +1 -1
- admin/partials/aalb_admin_pop_up_content_hbs.php +1 -1
- admin/partials/aalb_editor_search_box.php +1 -1
- admin/partials/aalb_meta_box.php +1 -1
- admin/partials/aalb_meta_box_tab_content.php +1 -1
- admin/sidebar/aalb_sidebar.php +1 -1
- admin/sidebar/js/aalb_credentials.js +1 -1
- admin/sidebar/js/aalb_template.js +1 -1
- admin/sidebar/partials/aalb_about.php +1 -1
- admin/sidebar/partials/aalb_admin_ui_common.php +1 -1
- admin/sidebar/partials/aalb_credentials.php +1 -1
- admin/sidebar/partials/aalb_credentials_locale_row.php +1 -1
- admin/sidebar/partials/aalb_templates.php +1 -1
- admin/sidebar/partials/aalb_ui_common.php +1 -1
- admin/sidebar/partials/helper/aalb_credentials_helper.php +1 -1
- amazon-associates-link-builder.php +2 -2
- css/aalb_basics.css +1 -1
- exceptions/network_call_failure_exception.php +1 -1
- exceptions/unexpected_network_response_exception.php +1 -1
- includes/aalb_activator.php +1 -1
- includes/aalb_admin_notice_manager.php +1 -1
- includes/aalb_autoloader.php +1 -1
- includes/aalb_cache_loader.php +1 -1
- includes/aalb_cache_template_loader.php +1 -1
- includes/aalb_compatibility_helper.php +1 -1
- includes/aalb_config_loader.php +1 -1
- includes/aalb_content_filter.php +1 -1
- includes/aalb_deactivator.php +1 -1
- includes/aalb_helper.php +1 -1
- includes/aalb_hook_loader.php +1 -1
- includes/aalb_manager.php +1 -1
- includes/aalb_remote_loader.php +1 -1
- includes/aalb_settings_page_migration_helper.php +1 -1
- includes/aalb_template_engine.php +45 -11
- io/aalb_curl_request.php +1 -1
- io/aalb_file_system_helper.php +1 -1
- ip2country/aalb_customer_country.php +1 -1
- ip2country/aalb_customer_ip_address.php +1 -1
- ip2country/aalb_maxmind_db_manager.php +1 -1
- lib/php/Paapi/aalb_paapi_helper.php +1 -1
- lib/php/aalb_impression_generator.php +152 -0
- lib/php/aalb_impression_recorder_service_config.php +76 -0
- lib/php/aalb_internationalization_helper.php +1 -1
- lib/php/aalb_tracking_api_helper.php +1 -1
- lib/php/aalb_validation_helper.php +1 -1
- lib/php/aalb_xml_helper.php +1 -1
- readme.txt +8 -2
- shortcode/aalb_shortcode.php +0 -104
- shortcode/aalb_shortcode_helper.php +1 -1
- shortcode/aalb_shortcode_loader.php +1 -1
- shortcode/aalb_shortcode_manager.php +2 -2
- shortcode/aalb_shortcode_text.php +0 -103
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +3 -3
NOTICE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
AmazonAssociatesLinkBuilder
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
The Amazon Associates Link Builder plugin includes the following third-party software/licensing:
|
5 |
|
1 |
AmazonAssociatesLinkBuilder
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
The Amazon Associates Link Builder plugin includes the following third-party software/licensing:
|
5 |
|
aalb_admin_item_search_items.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<!--
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<!--
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
aalb_config.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
@@ -13,7 +13,7 @@ and limitations under the License.
|
|
13 |
*/
|
14 |
|
15 |
//version
|
16 |
-
define( 'AALB_PLUGIN_CURRENT_VERSION', '1.
|
17 |
|
18 |
//Version no. with multi locale settings page
|
19 |
define( 'AALB_MULTI_LOCALE_SETTINGS_PLUGIN_VERSION', '1.4.12' );
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
13 |
*/
|
14 |
|
15 |
//version
|
16 |
+
define( 'AALB_PLUGIN_CURRENT_VERSION', '1.6.0' );
|
17 |
|
18 |
//Version no. with multi locale settings page
|
19 |
define( 'AALB_MULTI_LOCALE_SETTINGS_PLUGIN_VERSION', '1.4.12' );
|
admin/aalb_admin.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/css/aalb_admin.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
/*
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/css/aalb_credentials.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
/*
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/js/aalb_admin.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
/*
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/partials/aalb_admin_pop_up_content_hbs.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<!--
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<!--
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/partials/aalb_editor_search_box.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<!--
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<!--
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/partials/aalb_meta_box.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/partials/aalb_meta_box_tab_content.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<!--
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<!--
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/sidebar/aalb_sidebar.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/sidebar/js/aalb_credentials.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
/*
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/sidebar/js/aalb_template.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
/*
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/sidebar/partials/aalb_about.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/sidebar/partials/aalb_admin_ui_common.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/sidebar/partials/aalb_credentials.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/sidebar/partials/aalb_credentials_locale_row.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<!--
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<!--
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/sidebar/partials/aalb_templates.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/sidebar/partials/aalb_ui_common.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
admin/sidebar/partials/helper/aalb_credentials_helper.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
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.
|
11 |
Author: Amazon Associates Program
|
12 |
Author URI: https://affiliate-program.amazon.com/
|
13 |
License: GPLv2
|
@@ -16,7 +16,7 @@ Domain Path: /languages/
|
|
16 |
*/
|
17 |
|
18 |
/*
|
19 |
-
Copyright 2016-
|
20 |
|
21 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
22 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
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.6.0
|
11 |
Author: Amazon Associates Program
|
12 |
Author URI: https://affiliate-program.amazon.com/
|
13 |
License: GPLv2
|
16 |
*/
|
17 |
|
18 |
/*
|
19 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
20 |
|
21 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
22 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
css/aalb_basics.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*
|
2 |
-
Copyright 2016-
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
/*
|
2 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
5 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
exceptions/network_call_failure_exception.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
exceptions/unexpected_network_response_exception.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_activator.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_admin_notice_manager.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_autoloader.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_cache_loader.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_cache_template_loader.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_compatibility_helper.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_config_loader.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_content_filter.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2016-
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_deactivator.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_helper.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_hook_loader.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_manager.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_remote_loader.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_settings_page_migration_helper.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2016-
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
includes/aalb_template_engine.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
@@ -26,6 +26,7 @@ class Aalb_Template_Engine {
|
|
26 |
protected $mustache;
|
27 |
protected $xml_helper;
|
28 |
protected $helper;
|
|
|
29 |
|
30 |
public function __construct() {
|
31 |
$this->xml_loader = new Aalb_Cache_Loader( new Aalb_Remote_Loader() );
|
@@ -34,6 +35,8 @@ class Aalb_Template_Engine {
|
|
34 |
$this->mustache = new Mustache_Engine( array( 'loader' => new Mustache_Loader_FilesystemLoader( AALB_TEMPLATE_DIR ) ) );
|
35 |
$this->mustache_custom = new Mustache_Engine( array( 'loader' => new Mustache_Loader_FilesystemLoader( $this->helper->get_template_upload_directory() ) ) );
|
36 |
$this->xml_helper = new Aalb_Xml_Helper();
|
|
|
|
|
37 |
}
|
38 |
|
39 |
/**
|
@@ -43,16 +46,18 @@ class Aalb_Template_Engine {
|
|
43 |
*
|
44 |
* @since 1.0.0
|
45 |
*
|
46 |
-
* @param string $display_key
|
47 |
* @param string $products_key Key of the combined products.
|
48 |
-
* @param string $template
|
49 |
-
* @param string $url
|
50 |
-
* @param string $marketplace
|
51 |
-
* @param string $link_code
|
|
|
|
|
52 |
*
|
53 |
* @return string HTML of the disply unit.
|
54 |
*/
|
55 |
-
public function render( $display_key, $products_key, $template, $url, $marketplace, $link_code ) {
|
56 |
if ( false === ( $display_unit = $this->cache_template_loader->get_display_unit( $display_key ) ) ) {
|
57 |
$products = $this->get_products( $products_key, $url, $link_code );
|
58 |
$xml = $this->parse( $products );
|
@@ -62,19 +67,48 @@ class Aalb_Template_Engine {
|
|
62 |
$custom_items = $this->xml_helper->add_custom_nodes( $items, $marketplace );
|
63 |
|
64 |
$display_unit = $this->render_xml( $custom_items, $template );
|
|
|
|
|
65 |
$this->cache_template_loader->save_display_unit( $display_key, $display_unit );
|
66 |
}
|
67 |
|
68 |
return $display_unit;
|
69 |
}
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
/**
|
72 |
* Get the products information.
|
73 |
*
|
74 |
* @since 1.0.0
|
75 |
*
|
76 |
-
* @param string $key
|
77 |
-
* @param string $url
|
78 |
* @param string $link_code Link Code to be entered in URLS for attribution purposes.
|
79 |
*
|
80 |
* @return string Xml response from PAAPI.
|
@@ -118,7 +152,7 @@ class Aalb_Template_Engine {
|
|
118 |
* @return boolean
|
119 |
*/
|
120 |
private function should_not_render_xml( $xml ) {
|
121 |
-
return isset( $xml->Items->Request->Errors->Error )
|
122 |
}
|
123 |
|
124 |
/**
|
@@ -139,7 +173,7 @@ class Aalb_Template_Engine {
|
|
139 |
*
|
140 |
* @since 1.0.0
|
141 |
*
|
142 |
-
* @param array $items
|
143 |
* @param string $template Template in which the content has to be rendered.
|
144 |
*
|
145 |
* @return string HTML of the display unit.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
26 |
protected $mustache;
|
27 |
protected $xml_helper;
|
28 |
protected $helper;
|
29 |
+
protected $impression_generator;
|
30 |
|
31 |
public function __construct() {
|
32 |
$this->xml_loader = new Aalb_Cache_Loader( new Aalb_Remote_Loader() );
|
35 |
$this->mustache = new Mustache_Engine( array( 'loader' => new Mustache_Loader_FilesystemLoader( AALB_TEMPLATE_DIR ) ) );
|
36 |
$this->mustache_custom = new Mustache_Engine( array( 'loader' => new Mustache_Loader_FilesystemLoader( $this->helper->get_template_upload_directory() ) ) );
|
37 |
$this->xml_helper = new Aalb_Xml_Helper();
|
38 |
+
$this->impression_generator = new Aalb_Impression_Generator();
|
39 |
+
|
40 |
}
|
41 |
|
42 |
/**
|
46 |
*
|
47 |
* @since 1.0.0
|
48 |
*
|
49 |
+
* @param string $display_key Key of the display unit.
|
50 |
* @param string $products_key Key of the combined products.
|
51 |
+
* @param string $template Template to render the display unit.
|
52 |
+
* @param string $url Url to get the product from if not present in cache.
|
53 |
+
* @param string $marketplace Marketplace to which the product belongs.
|
54 |
+
* @param string $link_code Link Code to be entered in URLS for attribution purposes.
|
55 |
+
* @param string $store_id Store id of associate
|
56 |
+
* @param string $asin_group Group of different asins speated by ","
|
57 |
*
|
58 |
* @return string HTML of the disply unit.
|
59 |
*/
|
60 |
+
public function render( $display_key, $products_key, $template, $url, $marketplace, $link_code, $store_id, $asin_group ) {
|
61 |
if ( false === ( $display_unit = $this->cache_template_loader->get_display_unit( $display_key ) ) ) {
|
62 |
$products = $this->get_products( $products_key, $url, $link_code );
|
63 |
$xml = $this->parse( $products );
|
67 |
$custom_items = $this->xml_helper->add_custom_nodes( $items, $marketplace );
|
68 |
|
69 |
$display_unit = $this->render_xml( $custom_items, $template );
|
70 |
+
$display_unit = $this->add_html_for_impression_tracking( $display_unit, $marketplace, $link_code, $store_id, $asin_group );
|
71 |
+
|
72 |
$this->cache_template_loader->save_display_unit( $display_key, $display_unit );
|
73 |
}
|
74 |
|
75 |
return $display_unit;
|
76 |
}
|
77 |
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Adds pixel image HTML element to the display unit
|
81 |
+
*
|
82 |
+
* @since 1.6.0
|
83 |
+
*
|
84 |
+
* @param string $display_unit HTML of the display unit.
|
85 |
+
* @param String $marketplace marketplace
|
86 |
+
* @param String $store_id Store id of associate
|
87 |
+
* @param String $link_code Link code used for tracking
|
88 |
+
* @param String $asin_group Group of different asins speated by ","
|
89 |
+
*
|
90 |
+
* @return string $display_unit HTML of the display unit along with pixel image
|
91 |
+
*/
|
92 |
+
private function add_html_for_impression_tracking( $display_unit, $marketplace, $link_code, $store_id, $asin_group ) {
|
93 |
+
try {
|
94 |
+
$impression = $this->impression_generator->get_impression( $marketplace, $link_code, $store_id, $asin_group );
|
95 |
+
$display_unit = $impression . $display_unit;
|
96 |
+
} catch ( InvalidArgumentException $e ) {
|
97 |
+
error_log( "Aalb_Template_Engine::add_html_for_impression_tracking " . $e->getMessage() );
|
98 |
+
} catch ( Exception $e ) {
|
99 |
+
error_log( "Aalb_Template_Engine::add_html_for_impression_tracking " . $e->getMessage() );
|
100 |
+
}
|
101 |
+
|
102 |
+
return $display_unit;
|
103 |
+
}
|
104 |
+
|
105 |
/**
|
106 |
* Get the products information.
|
107 |
*
|
108 |
* @since 1.0.0
|
109 |
*
|
110 |
+
* @param string $key Unique identification of the product.
|
111 |
+
* @param string $url Signed URL for the PAAPI request.
|
112 |
* @param string $link_code Link Code to be entered in URLS for attribution purposes.
|
113 |
*
|
114 |
* @return string Xml response from PAAPI.
|
152 |
* @return boolean
|
153 |
*/
|
154 |
private function should_not_render_xml( $xml ) {
|
155 |
+
return isset( $xml->Items->Request->Errors->Error ) && ! ( $xml->Items->Request->Errors->Error->Code == PAAPI_INVALID_PARAMETER_VALUE_ERROR && isset( $xml->Items->Item ) );
|
156 |
}
|
157 |
|
158 |
/**
|
173 |
*
|
174 |
* @since 1.0.0
|
175 |
*
|
176 |
+
* @param array $items Each key consists of an item information object.
|
177 |
* @param string $template Template in which the content has to be rendered.
|
178 |
*
|
179 |
* @return string HTML of the display unit.
|
io/aalb_curl_request.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2016-
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
io/aalb_file_system_helper.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2016-
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
ip2country/aalb_customer_country.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2016-
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
ip2country/aalb_customer_ip_address.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2016-
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
ip2country/aalb_maxmind_db_manager.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
lib/php/Paapi/aalb_paapi_helper.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
lib/php/aalb_impression_generator.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
|
5 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
7 |
+
A copy of the License is located in the "license" file accompanying this file.
|
8 |
+
|
9 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
+
either express or implied. See the License for the specific language governing permissions
|
11 |
+
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Class to generate HTML element for impressions for impression tracking
|
16 |
+
*
|
17 |
+
* @since 1.6.0
|
18 |
+
* @package AmazonAssociatesLinkBuilder
|
19 |
+
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
20 |
+
*/
|
21 |
+
class Aalb_Impression_Generator {
|
22 |
+
/*
|
23 |
+
* @since 1.6.0
|
24 |
+
*
|
25 |
+
* @param String $marketplace_abbreviation Abbreviation of marketplace
|
26 |
+
* @param String $store_id Store id of associate
|
27 |
+
* @param String $link_code Link code used for tracking
|
28 |
+
* @param String $asin ASIN of the Product
|
29 |
+
*
|
30 |
+
* @return String pixel_image
|
31 |
+
*
|
32 |
+
* @throws InvalidArgumentException
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
public function get_impression( $marketplace_abbreviation, $link_code = AALB_DEFAULT_LINK_CODE, $store_id, $asins ) {
|
36 |
+
if ( empty( $store_id ) ) {
|
37 |
+
throw new InvalidArgumentException( "Empty Store Id passed" );
|
38 |
+
}
|
39 |
+
$impression_recorder_service_endpoint = $this->get_service_endpoint( $marketplace_abbreviation );
|
40 |
+
$org_unit_id = $this->get_org_unit_id( $marketplace_abbreviation );
|
41 |
+
|
42 |
+
return $this->get_html_for_pixel_image_of_all_asins( $impression_recorder_service_endpoint, $store_id, $link_code, $org_unit_id, $asins );
|
43 |
+
}
|
44 |
+
|
45 |
+
/*
|
46 |
+
* @since 1.6.0
|
47 |
+
*
|
48 |
+
* @param String $impression_recorder_service_endpoint
|
49 |
+
* @param String $store_id
|
50 |
+
* @param String $link_code
|
51 |
+
* @param Integer $org_unit_id
|
52 |
+
* @param String $asin_group Group of different asins speated by ","
|
53 |
+
*
|
54 |
+
* @return String HTML for the pixel image of all asins in $asin_group
|
55 |
+
*
|
56 |
+
* @throws InvalidArgumentException
|
57 |
+
*
|
58 |
+
*/
|
59 |
+
private function get_html_for_pixel_image_of_all_asins( $impression_recorder_service_endpoint, $store_id, $link_code, $org_unit_id, $asin_group ) {
|
60 |
+
$pixel_image_for_all_asins = "";
|
61 |
+
$asins_array = explode( ',', $asin_group );
|
62 |
+
foreach ( $asins_array as $asin ) {
|
63 |
+
$pixel_image_url = $this->get_url_with_query_params( $impression_recorder_service_endpoint, $store_id, $link_code, $org_unit_id, $asin );
|
64 |
+
$pixel_image_for_all_asins .= $this->get_html_element_for_pixel_image( $pixel_image_url );
|
65 |
+
}
|
66 |
+
|
67 |
+
return $pixel_image_for_all_asins;
|
68 |
+
}
|
69 |
+
|
70 |
+
/*
|
71 |
+
* Returns service endpoint for a marketplace
|
72 |
+
*
|
73 |
+
* @since 1.6.0
|
74 |
+
*
|
75 |
+
* @param String $marketplace_abbreviation Abbreviation of marketplace
|
76 |
+
*
|
77 |
+
* @return String $impression_recorder_service_endpoint
|
78 |
+
*
|
79 |
+
* @throws InvalidArgumentException
|
80 |
+
*
|
81 |
+
*/
|
82 |
+
private function get_service_endpoint( $marketplace_abbreviation ) {
|
83 |
+
if ( array_key_exists( $marketplace_abbreviation, Aalb_Impression_Recorder_Service_Config::$configuration ) ) {
|
84 |
+
$service_endpoint = Aalb_Impression_Recorder_Service_Config::$configuration[$marketplace_abbreviation]['service_endpoint'];
|
85 |
+
} else {
|
86 |
+
throw new InvalidArgumentException( "Invalid Marketplace value:" . $marketplace_abbreviation . " passed" );
|
87 |
+
}
|
88 |
+
|
89 |
+
return $service_endpoint;
|
90 |
+
}
|
91 |
+
|
92 |
+
/*
|
93 |
+
* Returns Org Unit Id for a marketplace
|
94 |
+
*
|
95 |
+
* @since 1.6.0
|
96 |
+
*
|
97 |
+
* @param String $marketplace_abbreviation Abbreviation of marketplace
|
98 |
+
*
|
99 |
+
* @return Integer $org_unit_id
|
100 |
+
*
|
101 |
+
* @throws InvalidArgumentException
|
102 |
+
*
|
103 |
+
*/
|
104 |
+
private function get_org_unit_id( $marketplace_abbreviation ) {
|
105 |
+
if ( array_key_exists( $marketplace_abbreviation, Aalb_Impression_Recorder_Service_Config::$configuration ) ) {
|
106 |
+
$org_unit_id = Aalb_Impression_Recorder_Service_Config::$configuration[$marketplace_abbreviation]['org_unit_id'];
|
107 |
+
} else {
|
108 |
+
throw new InvalidArgumentException( "Invalid Marketplace value:" . $marketplace_abbreviation . " passed" );
|
109 |
+
}
|
110 |
+
|
111 |
+
return $org_unit_id;
|
112 |
+
}
|
113 |
+
|
114 |
+
/*
|
115 |
+
* @since 1.6.0
|
116 |
+
*
|
117 |
+
* @param String $impression_recorder_service_endpoint
|
118 |
+
* @param String $store_id
|
119 |
+
* @param String $link_code
|
120 |
+
* @param Integer $org_unit_id
|
121 |
+
* @param String $asin ASIN of the Product
|
122 |
+
*
|
123 |
+
* @return String URL with query params set for impression recording
|
124 |
+
*
|
125 |
+
*/
|
126 |
+
private function get_url_with_query_params( $impression_recorder_service_endpoint, $store_id, $link_code, $org_unit_id, $asin ) {
|
127 |
+
return "https://" . $impression_recorder_service_endpoint . '/e/ir?' . 't=' . $store_id . '&l=' . $link_code . '&o=' . $org_unit_id . '&a=' . $asin;
|
128 |
+
}
|
129 |
+
|
130 |
+
/*
|
131 |
+
* Get HTML element for pixel image. The wifth and height ares et to 1px each so that image is not visible
|
132 |
+
*
|
133 |
+
* @since 1.6.0
|
134 |
+
*
|
135 |
+
* @param String $image_url URL of the image
|
136 |
+
*
|
137 |
+
* @return String HTML for the pixel image
|
138 |
+
*
|
139 |
+
*/
|
140 |
+
private function get_html_element_for_pixel_image( $image_url ) {
|
141 |
+
/*
|
142 |
+
*
|
143 |
+
* Below are inline and marked as important to avoid any chance of stylesheet not loading or
|
144 |
+
* property override on client side.The reason being if some other plugin overrides the
|
145 |
+
* property, this pixel will disrupt page spacing a little bit.
|
146 |
+
*
|
147 |
+
*/
|
148 |
+
return '<img src="' . $image_url . '" width="1px" height="1px" alt="" style="position: fixed !important; bottom: -1px !important; right: -1px !important; border:none !important; margin:0px !important;" />';
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
?>
|
lib/php/aalb_impression_recorder_service_config.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
|
5 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
7 |
+
A copy of the License is located in the "license" file accompanying this file.
|
8 |
+
|
9 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
+
either express or implied. See the License for the specific language governing permissions
|
11 |
+
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Class for storing impression recorder Service configuration
|
16 |
+
* Configration been been stored as static to have single config array. Although PHP is single threaded but in one request
|
17 |
+
* there can be multiple shortcodes and so multiple calls to get impression config for every shortcode.
|
18 |
+
*
|
19 |
+
* @since 1.6.0
|
20 |
+
* @package AmazonAssociatesLinkBuilder
|
21 |
+
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
22 |
+
*/
|
23 |
+
class Aalb_Impression_Recorder_Service_Config {
|
24 |
+
public static $configuration = array(
|
25 |
+
US => array(
|
26 |
+
"service_endpoint" => "ir-na.amazon-adsystem.com",
|
27 |
+
"org_unit_id" => 1,
|
28 |
+
),
|
29 |
+
UK => array(
|
30 |
+
"service_endpoint" => "ir-uk.amazon-adsystem.com",
|
31 |
+
"org_unit_id" => 2,
|
32 |
+
),
|
33 |
+
DE => array(
|
34 |
+
"service_endpoint" => "ir-de.amazon-adsystem.com",
|
35 |
+
"org_unit_id" => 3,
|
36 |
+
),
|
37 |
+
"FR" => array(
|
38 |
+
"service_endpoint" => "ir-fr.amazon-adsystem.com",
|
39 |
+
"org_unit_id" => 8,
|
40 |
+
),
|
41 |
+
"JP" => array(
|
42 |
+
"service_endpoint" => "ir-jp.amazon-adsystem.com",
|
43 |
+
"org_unit_id" => 9,
|
44 |
+
),
|
45 |
+
"CA" => array(
|
46 |
+
"service_endpoint" => "ir-ca.amazon-adsystem.com",
|
47 |
+
"org_unit_id" => 15,
|
48 |
+
),
|
49 |
+
"CN" => array(
|
50 |
+
"service_endpoint" => "ir-cn.amazon-adsystem.com",
|
51 |
+
"org_unit_id" => 28,
|
52 |
+
),
|
53 |
+
"IT" => array(
|
54 |
+
"service_endpoint" => "ir-it.amazon-adsystem.com",
|
55 |
+
"org_unit_id" => 29,
|
56 |
+
),
|
57 |
+
"ES" => array(
|
58 |
+
"service_endpoint" => "ir-es.amazon-adsystem.com",
|
59 |
+
"org_unit_id" => 30,
|
60 |
+
),
|
61 |
+
"IN" => array(
|
62 |
+
"service_endpoint" => "ir-in.amazon-adsystem.com",
|
63 |
+
"org_unit_id" => 31,
|
64 |
+
),
|
65 |
+
"BR" => array(
|
66 |
+
"service_endpoint" => "ir-br.amazon-adsystem.com",
|
67 |
+
"org_unit_id" => 32,
|
68 |
+
),
|
69 |
+
"MX" => array(
|
70 |
+
"service_endpoint" => "ir-mx.amazon-adsystem.com",
|
71 |
+
"org_unit_id" => 33,
|
72 |
+
)
|
73 |
+
);
|
74 |
+
}
|
75 |
+
|
76 |
+
?>
|
lib/php/aalb_internationalization_helper.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
lib/php/aalb_tracking_api_helper.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
lib/php/aalb_validation_helper.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
lib/php/aalb_xml_helper.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: amazonlinkbuilder
|
3 |
Tags: Amazon, Affiliate, Associates, Amazon Associates, Amazon Associate, Product Advertising API, Amazon API, Amazon Link, Amazon Ad, Amazon Affiliate, eCommerce
|
4 |
Requires at least: 3.0.1
|
5 |
-
Tested up to: 4.9.
|
6 |
-
Stable tag: 1.
|
7 |
Requires PHP: 5.4.0
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -116,6 +116,9 @@ You can see your earnings and other reports from the respective country Associat
|
|
116 |
|
117 |
== Changelog ==
|
118 |
|
|
|
|
|
|
|
119 |
= 1.5.4 - January 26, 2018 =
|
120 |
* Fix: In case of failed call to Product-Advertising API, Fatal error thrown.
|
121 |
|
@@ -233,6 +236,9 @@ You can see your earnings and other reports from the respective country Associat
|
|
233 |
|
234 |
== Upgrade Notice ==
|
235 |
|
|
|
|
|
|
|
236 |
= 1.5.4 - January 26, 2018 =
|
237 |
* Fix: In case of failed call to Product-Advertising API, Fatal error thrown.
|
238 |
|
2 |
Contributors: amazonlinkbuilder
|
3 |
Tags: Amazon, Affiliate, Associates, Amazon Associates, Amazon Associate, Product Advertising API, Amazon API, Amazon Link, Amazon Ad, Amazon Affiliate, eCommerce
|
4 |
Requires at least: 3.0.1
|
5 |
+
Tested up to: 4.9.4
|
6 |
+
Stable tag: 1.6.0
|
7 |
Requires PHP: 5.4.0
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
116 |
|
117 |
== Changelog ==
|
118 |
|
119 |
+
= 1.6.0 - March 14, 2018 =
|
120 |
+
* Added Impressions data in reports shown on respective associates website. This will work only for ads rendered after upgrade to this release.
|
121 |
+
|
122 |
= 1.5.4 - January 26, 2018 =
|
123 |
* Fix: In case of failed call to Product-Advertising API, Fatal error thrown.
|
124 |
|
236 |
|
237 |
== Upgrade Notice ==
|
238 |
|
239 |
+
= 1.6.0 - March 14, 2018 =
|
240 |
+
* Added Impressions data in reports shown on respective associates website for ads rendered after upgrade to this release.
|
241 |
+
|
242 |
= 1.5.4 - January 26, 2018 =
|
243 |
* Fix: In case of failed call to Product-Advertising API, Fatal error thrown.
|
244 |
|
shortcode/aalb_shortcode.php
DELETED
@@ -1,104 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
-
|
6 |
-
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
-
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
-
A copy of the License is located in the "license" file accompanying this file.
|
9 |
-
|
10 |
-
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
-
either express or implied. See the License for the specific language governing permissions
|
12 |
-
and limitations under the License.
|
13 |
-
*/
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Fired when a amazon_link shortcode is there in the post page.
|
17 |
-
*
|
18 |
-
* Gets the product information by making a Paapi request and renders the HTML
|
19 |
-
*
|
20 |
-
* @since 1.0.0
|
21 |
-
* @package AmazonAssociatesLinkBuilder
|
22 |
-
* @subpackage AmazonAssociatesLinkBuilder/shortcode
|
23 |
-
*/
|
24 |
-
class Aalb_Shortcode {
|
25 |
-
protected $paapi_helper;
|
26 |
-
protected $template_engine;
|
27 |
-
protected $helper;
|
28 |
-
protected $tracking_api_helper;
|
29 |
-
protected $shortcode_helper;
|
30 |
-
|
31 |
-
public function __construct() {
|
32 |
-
$this->template_engine = new Aalb_Template_Engine();
|
33 |
-
$this->paapi_helper = new Aalb_Paapi_Helper();
|
34 |
-
$this->helper = new Aalb_Helper();
|
35 |
-
$this->tracking_api_helper = new Aalb_Tracking_Api_Helper();
|
36 |
-
$this->shortcode_helper = new Aalb_Shortcode_Helper();
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Add basic styles
|
41 |
-
*
|
42 |
-
* @since 1.0.0
|
43 |
-
*/
|
44 |
-
public function enqueue_styles() {
|
45 |
-
wp_enqueue_style( 'aalb_basics_css', AALB_BASICS_CSS, array(), AALB_PLUGIN_CURRENT_VERSION );
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* The function responsible for rendering the shortcode.
|
50 |
-
* Makes a GET request and calls the render_xml to render the response.
|
51 |
-
*
|
52 |
-
* @since 1.0.0
|
53 |
-
*
|
54 |
-
* @param array $atts Shortcode attribute and values.
|
55 |
-
*
|
56 |
-
* @return HTML Rendered html to display.
|
57 |
-
*/
|
58 |
-
public function render( $atts ) {
|
59 |
-
try {
|
60 |
-
$shortcode_attributes = $this->get_shortcode_attributes( $atts );
|
61 |
-
|
62 |
-
$validated_link_id = $this->shortcode_helper->get_validated_link_id( $shortcode_attributes['link_id'] );
|
63 |
-
$validated_marketplace = $this->shortcode_helper->get_validated_marketplace( $shortcode_attributes['marketplace'] );
|
64 |
-
$validated_asins = $this->shortcode_helper->get_validated_asins( $shortcode_attributes['asins'] );
|
65 |
-
$validated_template = $this->shortcode_helper->get_validated_template( $shortcode_attributes['template'] );
|
66 |
-
$validated_store_id = $this->shortcode_helper->get_validated_store_id( $shortcode_attributes['store'] );
|
67 |
-
|
68 |
-
$marketplace = $this->shortcode_helper->get_marketplace_endpoint( $validated_marketplace );
|
69 |
-
$url = $this->paapi_helper->get_item_lookup_url( $validated_asins, $marketplace, $validated_store_id );
|
70 |
-
$asins = $this->shortcode_helper->format_asins( $validated_asins );
|
71 |
-
$products_key = $this->helper->build_products_cache_key( $asins, $marketplace, $validated_store_id );
|
72 |
-
$products_template_key = $this->helper->build_template_cache_key( $asins, $marketplace, $validated_store_id, $validated_template );
|
73 |
-
|
74 |
-
$this->shortcode_helper->enqueue_template_styles( $validated_template );
|
75 |
-
|
76 |
-
return str_replace( array( '[[UNIQUE_ID]]' ), array( str_replace( '.', '-', $products_template_key ) ), $this->template_engine->render( $products_template_key, $products_key, $validated_template, $url, $validated_marketplace ) );
|
77 |
-
} catch ( Exception $e ) {
|
78 |
-
error_log( $this->paapi_helper->get_error_message( $e->getMessage() ) );
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Returns default shortcode attributes if not mentioned
|
84 |
-
*
|
85 |
-
* @since 1.0.0
|
86 |
-
*
|
87 |
-
* @param array $atts Shortcode attributes.
|
88 |
-
*
|
89 |
-
* @return array Default shortcode attributes if not mentioned.
|
90 |
-
*/
|
91 |
-
private function get_shortcode_attributes( $atts ) {
|
92 |
-
$shortcode_attributes = shortcode_atts( array(
|
93 |
-
'asins' => null,
|
94 |
-
'marketplace' => get_option( AALB_DEFAULT_MARKETPLACE ),
|
95 |
-
'store' => get_option( AALB_DEFAULT_STORE_ID ),
|
96 |
-
'template' => get_option( AALB_DEFAULT_TEMPLATE ),
|
97 |
-
'link_id' => null
|
98 |
-
), $atts );
|
99 |
-
|
100 |
-
return $shortcode_attributes;
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shortcode/aalb_shortcode_helper.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
shortcode/aalb_shortcode_loader.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2016-
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
6 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
shortcode/aalb_shortcode_manager.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2016-
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
@@ -136,7 +136,7 @@ class Aalb_Shortcode_Manager {
|
|
136 |
$products_key = $this->helper->build_products_cache_key( $formatted_asins, $validated_marketplace, $validated_store_id );
|
137 |
$products_template_key = $this->helper->build_template_cache_key( $formatted_asins, $validated_marketplace, $validated_store_id, $validated_template );
|
138 |
try {
|
139 |
-
return str_replace( array( '[[UNIQUE_ID]]', '[[Amazon_Link_Text]]' ), array( str_replace( '.', '-', $products_template_key ), $link_text ), $this->template_engine->render( $products_template_key, $products_key, $validated_template, $url, $validated_marketplace, $link_code ) );
|
140 |
} catch ( Exception $e ) {
|
141 |
error_log( $this->paapi_helper->get_error_message( $e->getMessage() ) );
|
142 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
136 |
$products_key = $this->helper->build_products_cache_key( $formatted_asins, $validated_marketplace, $validated_store_id );
|
137 |
$products_template_key = $this->helper->build_template_cache_key( $formatted_asins, $validated_marketplace, $validated_store_id, $validated_template );
|
138 |
try {
|
139 |
+
return str_replace( array( '[[UNIQUE_ID]]', '[[Amazon_Link_Text]]' ), array( str_replace( '.', '-', $products_template_key ), $link_text ), $this->template_engine->render( $products_template_key, $products_key, $validated_template, $url, $validated_marketplace, $link_code, $validated_store_id, $validated_asins ) );
|
140 |
} catch ( Exception $e ) {
|
141 |
error_log( $this->paapi_helper->get_error_message( $e->getMessage() ) );
|
142 |
}
|
shortcode/aalb_shortcode_text.php
DELETED
@@ -1,103 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
-
|
6 |
-
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
-
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
-
A copy of the License is located in the "license" file accompanying this file.
|
9 |
-
|
10 |
-
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
-
either express or implied. See the License for the specific language governing permissions
|
12 |
-
and limitations under the License.
|
13 |
-
*/
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Fired when a amazon_textlink is there in the post page.
|
17 |
-
*
|
18 |
-
* Gets the product information by making a Paapi request and renders the HTML
|
19 |
-
*
|
20 |
-
* @since 1.4
|
21 |
-
* @package AmazonAssociatesLinkBuilder
|
22 |
-
* @subpackage AmazonAssociatesLinkBuilder/shortcode
|
23 |
-
*/
|
24 |
-
class Aalb_Shortcode_Text {
|
25 |
-
|
26 |
-
protected $paapi_helper;
|
27 |
-
protected $template_engine;
|
28 |
-
protected $helper;
|
29 |
-
protected $tracking_api_helper;
|
30 |
-
protected $shortcode_helper;
|
31 |
-
|
32 |
-
public function __construct() {
|
33 |
-
$this->template_engine = new Aalb_Template_Engine();
|
34 |
-
$this->paapi_helper = new Aalb_Paapi_Helper();
|
35 |
-
$this->helper = new Aalb_Helper();
|
36 |
-
$this->tracking_api_helper = new Aalb_Tracking_Api_Helper();
|
37 |
-
$this->shortcode_helper = new Aalb_Shortcode_Helper();
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Add basic styles
|
42 |
-
*
|
43 |
-
* @since 1.4
|
44 |
-
*/
|
45 |
-
public function enqueue_styles() {
|
46 |
-
wp_enqueue_style( 'aalb_basics_css', AALB_BASICS_CSS, array(), AALB_PLUGIN_CURRENT_VERSION );
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* The function responsible for rendering the shortcode.
|
51 |
-
* Makes a GET request and calls the render_xml to render the response.
|
52 |
-
*
|
53 |
-
* @since 1.4
|
54 |
-
*
|
55 |
-
* @param array $atts Shortcode attribute and values.
|
56 |
-
*
|
57 |
-
* @return HTML Rendered html to display.
|
58 |
-
*/
|
59 |
-
|
60 |
-
public function render( $atts ) {
|
61 |
-
try {
|
62 |
-
$shortcode_attributes = $this->get_shortcode_attributes( $atts );
|
63 |
-
|
64 |
-
$validated_link_id = $this->shortcode_helper->get_validated_link_id( $shortcode_attributes['link_id'] );
|
65 |
-
$validated_marketplace = $this->shortcode_helper->get_validated_marketplace( $shortcode_attributes['marketplace'] );
|
66 |
-
$validated_asins = $this->shortcode_helper->get_validated_asins( $shortcode_attributes['asin'] );
|
67 |
-
$validated_template = $this->shortcode_helper->get_validated_template( $shortcode_attributes['template'] );
|
68 |
-
$validated_store_id = $this->shortcode_helper->get_validated_store_id( $shortcode_attributes['store'] );
|
69 |
-
$link_text = $shortcode_attributes['text'];
|
70 |
-
|
71 |
-
$marketplace = $this->shortcode_helper->get_marketplace_endpoint( $validated_marketplace );
|
72 |
-
$url = $this->paapi_helper->get_item_lookup_url( $validated_asins, $marketplace, $validated_store_id );
|
73 |
-
$asins = $this->shortcode_helper->format_asins( $validated_asins );
|
74 |
-
$products_key = $this->helper->build_products_cache_key( $asins, $marketplace, $validated_store_id );
|
75 |
-
$products_template_key = $this->helper->build_template_cache_key( $asins, $marketplace, $validated_store_id, $validated_template );
|
76 |
-
|
77 |
-
$this->shortcode_helper->enqueue_template_styles( $validated_template );
|
78 |
-
|
79 |
-
return str_replace( array( '[[UNIQUE_ID]]', '[[Amazon_Link_Text]]' ), array( str_replace( '.', '-', $products_template_key ), $link_text ), $this->template_engine->render( $products_template_key, $products_key, $validated_template, $url, $validated_marketplace ) );
|
80 |
-
} catch ( Exception $e ) {
|
81 |
-
error_log( $this->paapi_helper->get_error_message( $e->getMessage() ) );
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Returns default shortcode attributes if not mentioned
|
87 |
-
*w
|
88 |
-
* @since 1.4
|
89 |
-
*
|
90 |
-
* @param array $atts Shortcode attributes.
|
91 |
-
*
|
92 |
-
* @return array Default shortcode attributes if not mentioned.
|
93 |
-
*/
|
94 |
-
private function get_shortcode_attributes( $atts ) {
|
95 |
-
$shortcode_attributes = shortcode_atts( array(
|
96 |
-
'asin' => null, 'marketplace' => get_option( AALB_DEFAULT_MARKETPLACE ), 'store' => get_option( AALB_DEFAULT_STORE_ID ), 'template' => get_option( AALB_DEFAULT_TEMPLATE ), 'link_id' => null, 'text' => null
|
97 |
-
), $atts );
|
98 |
-
|
99 |
-
return $shortcode_attributes;
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit622247985f56ba38f11a91b245c8de8e::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitb96cf242fb66f1aa2b76f8a10591983e
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit622247985f56ba38f11a91b245c8de8e
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit622247985f56ba38f11a91b245c8de8e', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit622247985f56ba38f11a91b245c8de8e', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit622247985f56ba38f11a91b245c8de8e::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'M' =>
|
@@ -49,8 +49,8 @@ class ComposerStaticInitb96cf242fb66f1aa2b76f8a10591983e
|
|
49 |
public static function getInitializer(ClassLoader $loader)
|
50 |
{
|
51 |
return \Closure::bind(function () use ($loader) {
|
52 |
-
$loader->prefixLengthsPsr4 =
|
53 |
-
$loader->prefixDirsPsr4 =
|
54 |
|
55 |
}, null, ClassLoader::class);
|
56 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit622247985f56ba38f11a91b245c8de8e
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'M' =>
|
49 |
public static function getInitializer(ClassLoader $loader)
|
50 |
{
|
51 |
return \Closure::bind(function () use ($loader) {
|
52 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit622247985f56ba38f11a91b245c8de8e::$prefixLengthsPsr4;
|
53 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit622247985f56ba38f11a91b245c8de8e::$prefixDirsPsr4;
|
54 |
|
55 |
}, null, ClassLoader::class);
|
56 |
}
|