ThirstyAffiliates Affiliate Link Manager - Version 3.2.4

Version Description

  • Bug Fix: Issues with link fixer for sub-directory installs and with WPML translation
Download this release

Release Info

Developer jkohlbach
Plugin Icon 128x128 ThirstyAffiliates Affiliate Link Manager
Version 3.2.4
Comparing to
See all releases

Code changes from version 3.2.3 to 3.2.4

Helpers/Plugin_Constants.php CHANGED
@@ -27,7 +27,7 @@ class Plugin_Constants {
27
// Plugin configuration constants
28
const TOKEN = 'ta';
29
const INSTALLED_VERSION = 'ta_installed_version';
30
- const VERSION = '3.2.3';
31
const TEXT_DOMAIN = 'thirstyaffiliates';
32
const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
33
const META_DATA_PREFIX = '_ta_';
27
// Plugin configuration constants
28
const TOKEN = 'ta';
29
const INSTALLED_VERSION = 'ta_installed_version';
30
+ const VERSION = '3.2.4';
31
const TEXT_DOMAIN = 'thirstyaffiliates';
32
const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
33
const META_DATA_PREFIX = '_ta_';
Models/Link_Fixer.php CHANGED
@@ -114,8 +114,11 @@ class Link_Fixer implements Model_Interface , Initiable_Interface {
114
* Get data of links to be fixed.
115
*
116
* @since 3.0.0
117
* @access public
118
*
119
* @param array $links List of affiliate links to fix.
120
* @param int $post_id ID of the post currently being viewed.
121
* @param array $data Affiliate Links data.
@@ -123,9 +126,14 @@ class Link_Fixer implements Model_Interface , Initiable_Interface {
123
*/
124
public function get_link_fixer_data( $links , $post_id = 0 , $data = array() ) {
125
126
if ( empty( $links ) )
127
return $data;
128
129
foreach( $links as $link ) {
130
131
$href = esc_url_raw( $link[ 'href' ] );
114
* Get data of links to be fixed.
115
*
116
* @since 3.0.0
117
+ * @since 3.2.4 Make sure that link fixer runs using the default language set on WPML when it is active.
118
* @access public
119
*
120
+ * @global SitePress $sitepress WPML main plugin object.
121
+ *
122
* @param array $links List of affiliate links to fix.
123
* @param int $post_id ID of the post currently being viewed.
124
* @param array $data Affiliate Links data.
126
*/
127
public function get_link_fixer_data( $links , $post_id = 0 , $data = array() ) {
128
129
+ global $sitepress;
130
+
131
if ( empty( $links ) )
132
return $data;
133
134
+ if ( is_object( $sitepress ) )
135
+ $sitepress->switch_lang( $sitepress->get_default_language() );
136
+
137
foreach( $links as $link ) {
138
139
$href = esc_url_raw( $link[ 'href' ] );
Models/Script_Loader.php CHANGED
@@ -271,12 +271,10 @@ class Script_Loader implements Model_Interface {
271
272
if ( apply_filters( 'ta_enqueue_tajs_script' , ( get_option( 'ta_enable_link_fixer' , 'yes' ) === 'yes' || get_option( 'ta_enable_stats_reporting_module' , 'yes' ) === 'yes' ) ) ) {
273
274
- $home_url = parse_url( home_url() );
275
-
276
// load main frontend script that holds the link fixer and stat record JS code
277
wp_enqueue_script( 'ta_main_js' , $this->_constants->JS_ROOT_URL() . 'app/ta.js' , array() , Plugin_Constants::VERSION , true );
278
wp_localize_script( 'ta_main_js' , 'thirsty_global_vars' , array(
279
- 'home_url' => '//' . $home_url[ 'host' ] . '/', // str_replace( array( 'http:' , 'https:' ) , '' , home_url('/') ),
280
'ajax_url' => admin_url( 'admin-ajax.php' ),
281
'link_fixer_enabled' => get_option( 'ta_enable_link_fixer' , 'yes' ),
282
'link_prefix' => $this->_helper_functions->get_thirstylink_link_prefix(),
@@ -287,6 +285,25 @@ class Script_Loader implements Model_Interface {
287
}
288
}
289
290
/**
291
* Execute plugin script loader.
292
*
271
272
if ( apply_filters( 'ta_enqueue_tajs_script' , ( get_option( 'ta_enable_link_fixer' , 'yes' ) === 'yes' || get_option( 'ta_enable_stats_reporting_module' , 'yes' ) === 'yes' ) ) ) {
273
274
// load main frontend script that holds the link fixer and stat record JS code
275
wp_enqueue_script( 'ta_main_js' , $this->_constants->JS_ROOT_URL() . 'app/ta.js' , array() , Plugin_Constants::VERSION , true );
276
wp_localize_script( 'ta_main_js' , 'thirsty_global_vars' , array(
277
+ 'home_url' => $this->_get_absolute_home_url( true ),
278
'ajax_url' => admin_url( 'admin-ajax.php' ),
279
'link_fixer_enabled' => get_option( 'ta_enable_link_fixer' , 'yes' ),
280
'link_prefix' => $this->_helper_functions->get_thirstylink_link_prefix(),
285
}
286
}
287
288
+ /**
289
+ * Get absolute home_url by recreating it and removing unneeded information.
290
+ *
291
+ * @since 3.2.4
292
+ * @access public
293
+ *
294
+ * @param bool $no_scheme Toggle to check if need to include scheme or not.
295
+ * @return string Recreated home_url.
296
+ */
297
+ private function _get_absolute_home_url( $no_scheme = false ) {
298
+
299
+ $home_url = parse_url( home_url() );
300
+ $scheme = $no_scheme ? '//' : $home_url[ 'scheme' ] . '://';
301
+ $path = isset( $home_url[ 'path' ] ) ? $home_url[ 'path' ] : '';
302
+ $port = isset( $home_url[ 'port' ] ) ? ':' . $home_url[ 'port' ] : '';
303
+
304
+ return $scheme . $home_url[ 'host' ] . $port . $path;
305
+ }
306
+
307
/**
308
* Execute plugin script loader.
309
*
languages/thirstyaffiliates.pot CHANGED
@@ -2,7 +2,7 @@
2
msgid ""
3
msgstr ""
4
"Project-Id-Version: ThirstyAffiliates\n"
5
- "POT-Creation-Date: 2018-02-07 10:48+0800\n"
6
"PO-Revision-Date: 2016-04-29 07:38+0800\n"
7
"Last-Translator: \n"
8
"Language-Team: Rymera Web Co <support@thirstyaffiliates.com>\n"
@@ -40,7 +40,7 @@ msgstr ""
40
#: Models/Affiliate_Link_Attachment.php:130
41
#: Models/Affiliate_Link_Attachment.php:200 Models/Affiliate_Links_CPT.php:857
42
#: Models/Affiliate_Links_CPT.php:882 Models/Guided_Tour.php:313
43
- #: Models/Link_Fixer.php:176 Models/Link_Fixer.php:178
44
#: Models/Link_Picker.php:279 Models/Link_Picker.php:337
45
#: Models/Link_Picker.php:457 Models/Marketing.php:175 Models/Marketing.php:300
46
#: Models/Settings.php:1736 Models/Settings.php:1784
2
msgid ""
3
msgstr ""
4
"Project-Id-Version: ThirstyAffiliates\n"
5
+ "POT-Creation-Date: 2018-02-26 10:54+0800\n"
6
"PO-Revision-Date: 2016-04-29 07:38+0800\n"
7
"Last-Translator: \n"
8
"Language-Team: Rymera Web Co <support@thirstyaffiliates.com>\n"
40
#: Models/Affiliate_Link_Attachment.php:130
41
#: Models/Affiliate_Link_Attachment.php:200 Models/Affiliate_Links_CPT.php:857
42
#: Models/Affiliate_Links_CPT.php:882 Models/Guided_Tour.php:313
43
+ #: Models/Link_Fixer.php:184 Models/Link_Fixer.php:186
44
#: Models/Link_Picker.php:279 Models/Link_Picker.php:337
45
#: Models/Link_Picker.php:457 Models/Marketing.php:175 Models/Marketing.php:300
46
#: Models/Settings.php:1736 Models/Settings.php:1784
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: affiliate, link, affiliate link management, link cloaker, link redirect, s
5
Requires at least: 3.4
6
Requires PHP: 5.6
7
Tested up to: 4.9.4
8
- Stable tag: 3.2.3
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
@@ -159,6 +159,9 @@ See our [Knowledge Base](https://thirstyaffiliates.com/knowledge-base/?utm_sourc
159
160
== Changelog ==
161
162
= 3.2.3 =
163
* Bug Fix: Uncloaker module sometimes stripping away query strings
164
* Bug Fix: Notice: Undefined variable error
5
Requires at least: 3.4
6
Requires PHP: 5.6
7
Tested up to: 4.9.4
8
+ Stable tag: 3.2.4
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
159
160
== Changelog ==
161
162
+ = 3.2.4 =
163
+ * Bug Fix: Issues with link fixer for sub-directory installs and with WPML translation
164
+
165
= 3.2.3 =
166
* Bug Fix: Uncloaker module sometimes stripping away query strings
167
* Bug Fix: Notice: Undefined variable error
thirstyaffiliates.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: ThirstyAffiliates
4
* Plugin URI: http://thirstyaffiliates.com/
5
* Description: ThirstyAffiliates is a revolution in affiliate link management. Collect, collate and store your affiliate links for use in your posts and pages.
6
- * Version: 3.2.3
7
* Author: Rymera Web Co
8
* Author URI: https://rymera.com.au/
9
* Requires at least: 4.4.2
3
* Plugin Name: ThirstyAffiliates
4
* Plugin URI: http://thirstyaffiliates.com/
5
* Description: ThirstyAffiliates is a revolution in affiliate link management. Collect, collate and store your affiliate links for use in your posts and pages.
6
+ * Version: 3.2.4
7
* Author: Rymera Web Co
8
* Author URI: https://rymera.com.au/
9
* Requires at least: 4.4.2