ThirstyAffiliates Affiliate Link Manager - Version 3.1.2

Version Description

  • Bug Fix: Fix link fixer script to detect links with either http or https protocol
  • Bug Fix: If all modules requiring ta.js are off dequeue it
  • Bug Fix: isThirstyLink should recognize root relative URLs and others
  • Bug Fix: Thirstylink CPT publish status is translatable
Download this release

Release Info

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

Code changes from version 3.1.1 to 3.1.2

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.1.1';
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.1.2';
31
const TEXT_DOMAIN = 'thirstyaffiliates';
32
const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
33
const META_DATA_PREFIX = '_ta_';
Models/Script_Loader.php CHANGED
@@ -265,17 +265,20 @@ class Script_Loader implements Model_Interface {
265
266
global $post, $wp;
267
268
- // load main frontend script that holds the link fixer and stat record JS code
269
- wp_enqueue_script( 'ta_main_js' , $this->_constants->JS_ROOT_URL() . 'app/ta.js' , array() , Plugin_Constants::VERSION , true );
270
- wp_localize_script( 'ta_main_js' , 'thirsty_global_vars' , array(
271
- 'home_url' => home_url('/'),
272
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
273
- 'link_fixer_enabled' => get_option( 'ta_enable_link_fixer' , 'yes' ),
274
- 'link_prefix' => $this->_helper_functions->get_thirstylink_link_prefix(),
275
- 'link_prefixes' => maybe_unserialize( get_option( 'ta_used_link_prefixes' ) ),
276
- 'post_id' => isset( $post->ID ) ? $post->ID : 0,
277
- 'disable_thirstylink_class' => get_option( 'ta_disable_thirsty_link_class' )
278
- ) );
279
}
280
281
/**
265
266
global $post, $wp;
267
268
+ if ( apply_filters( 'ta_enqueue_tajs_script' , ( get_option( 'ta_enable_link_fixer' , 'yes' ) === 'yes' || get_option( 'ta_enable_stats_reporting_module' , 'yes' ) === 'yes' ) ) ) {
269
+
270
+ // load main frontend script that holds the link fixer and stat record JS code
271
+ wp_enqueue_script( 'ta_main_js' , $this->_constants->JS_ROOT_URL() . 'app/ta.js' , array() , Plugin_Constants::VERSION , true );
272
+ wp_localize_script( 'ta_main_js' , 'thirsty_global_vars' , array(
273
+ 'home_url' => str_replace( array( 'http:' , 'https:' ) , '' , home_url('/') ),
274
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
275
+ 'link_fixer_enabled' => get_option( 'ta_enable_link_fixer' , 'yes' ),
276
+ 'link_prefix' => $this->_helper_functions->get_thirstylink_link_prefix(),
277
+ 'link_prefixes' => maybe_unserialize( get_option( 'ta_used_link_prefixes' ) ),
278
+ 'post_id' => isset( $post->ID ) ? $post->ID : 0,
279
+ 'disable_thirstylink_class' => get_option( 'ta_disable_thirsty_link_class' )
280
+ ) );
281
+ }
282
}
283
284
/**
js/app/ta.js CHANGED
@@ -11,7 +11,7 @@ jQuery( document ).ready( function($) {
11
*/
12
recordLinkStat : function() {
13
14
- $( 'body' ).delegate( 'a' , 'click' , function(e) {
15
16
var $link = $(this),
17
href = $link.attr( 'href' ),
@@ -34,15 +34,21 @@ jQuery( document ).ready( function($) {
34
* Function to check if the loaded link is a ThirstyAffiliates link or not.
35
*
36
* @since 3.0.0
37
*/
38
isThirstyLink : function( href ) {
39
40
if ( ! href )
41
return;
42
43
- var link_uri = href.replace( thirsty_global_vars.home_url , '' ),
44
- link_prefix = link_uri.substr( 0 , link_uri.indexOf( '/' ) ),
45
- new_href = href.replace( '/' + link_prefix + '/' , '/' + thirsty_global_vars.link_prefix + '/' );
46
47
return ( link_prefix && $.inArray( link_prefix , link_prefixes ) > -1 ) ? new_href : false;
48
},
@@ -96,6 +102,9 @@ jQuery( document ).ready( function($) {
96
title = response.data[ x ][ 'title' ],
97
className = response.data[ x ][ 'class' ];
98
99
// add the title if present, if not then remove the attribute entirely.
100
if ( title )
101
$( $allLinks[ key ] ).prop( 'title' , title );
11
*/
12
recordLinkStat : function() {
13
14
+ $( 'body' ).on( 'click' , 'a' , function(e) {
15
16
var $link = $(this),
17
href = $link.attr( 'href' ),
34
* Function to check if the loaded link is a ThirstyAffiliates link or not.
35
*
36
* @since 3.0.0
37
+ * @since 3.1.2 Make function detect root relative URLs.
38
*/
39
isThirstyLink : function( href ) {
40
41
if ( ! href )
42
return;
43
44
+ href = href.replace( 'http:' , '{protocol}' ).replace( 'https:' , '{protocol}' );
45
+
46
+ var link_uri = href.replace( thirsty_global_vars.home_url , '' ).replace( '{protocol}' , '' ),
47
+ link_prefix, new_href;
48
+
49
+ link_uri = link_uri.indexOf( '/' ) == 0 ? link_uri.replace( '/' , '' ) : link_uri;
50
+ link_prefix = link_uri.substr( 0 , link_uri.indexOf( '/' ) ),
51
+ new_href = href.replace( '/' + link_prefix + '/' , '/' + thirsty_global_vars.link_prefix + '/' ).replace( '{protocol}' , window.location.protocol );
52
53
return ( link_prefix && $.inArray( link_prefix , link_prefixes ) > -1 ) ? new_href : false;
54
},
102
title = response.data[ x ][ 'title' ],
103
className = response.data[ x ][ 'class' ];
104
105
+ // update protocol to replace it with the one used on the site.
106
+ href = href.replace( 'http:' , window.location.protocol ).replace( 'https:' , window.location.protocol );
107
+
108
// add the title if present, if not then remove the attribute entirely.
109
if ( title )
110
$( $allLinks[ key ] ).prop( 'title' , title );
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.8.2
8
- Stable tag: 3.1.1
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
@@ -159,6 +159,12 @@ See our [Knowledge Base](https://thirstyaffiliates.com/knowledge-base/?utm_sourc
159
160
== Changelog ==
161
162
= 3.1.1 =
163
* Bug Fix: Change reports content display method to use callback function instead
164
* Bug Fix: Update migration for new tracking script option for GCT module
5
Requires at least: 3.4
6
Requires PHP: 5.6
7
Tested up to: 4.8.2
8
+ Stable tag: 3.1.2
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
159
160
== Changelog ==
161
162
+ = 3.1.2 =
163
+ * Bug Fix: Fix link fixer script to detect links with either http or https protocol
164
+ * Bug Fix: If all modules requiring ta.js are off dequeue it
165
+ * Bug Fix: isThirstyLink should recognize root relative URLs and others
166
+ * Bug Fix: Thirstylink CPT publish status is translatable
167
+
168
= 3.1.1 =
169
* Bug Fix: Change reports content display method to use callback function instead
170
* Bug Fix: Update migration for new tracking script option for GCT module
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.1.1
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.1.2
7
* Author: Rymera Web Co
8
* Author URI: https://rymera.com.au/
9
* Requires at least: 4.4.2
views/cpt/view-save-affiliate-link-metabox.php CHANGED
@@ -1,6 +1,6 @@
1
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
3
- <input name="post_status" type="hidden" id="post_status" value="<?php _e( 'publish' , 'thirstyaffiliates' ); ?>" />
4
<input name="original_publish" type="hidden" id="original_publish" value="<?php _e( 'Save' , 'thirstyaffiliates' ); ?>" />
5
<input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e( 'Save Link' , 'thirstyaffiliates' ); ?>">
6
1
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
3
+ <input name="post_status" type="hidden" id="post_status" value="publish" />
4
<input name="original_publish" type="hidden" id="original_publish" value="<?php _e( 'Save' , 'thirstyaffiliates' ); ?>" />
5
<input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e( 'Save Link' , 'thirstyaffiliates' ); ?>">
6