ThirstyAffiliates Affiliate Link Manager - Version 3.1.1

Version Description

  • Bug Fix: Change reports content display method to use callback function instead
  • Bug Fix: Update migration for new tracking script option for GCT module
Download this release

Release Info

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

Code changes from version 3.1.0 to 3.1.1

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.0';
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.1';
31
  const TEXT_DOMAIN = 'thirstyaffiliates';
32
  const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
33
  const META_DATA_PREFIX = '_ta_';
Models/Migration.php CHANGED
@@ -609,6 +609,34 @@ class Migration implements Model_Interface , Activatable_Interface , Initiable_I
609
  return $old_options;
610
  }
611
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
612
 
613
 
614
 
@@ -780,16 +808,16 @@ class Migration implements Model_Interface , Activatable_Interface , Initiable_I
780
  $affiliate_link_ids[] = $affiliate_link->ID;
781
 
782
  if ( !empty( $affiliate_link_ids ) && is_array( $affiliate_link_ids ) ) {
783
-
784
  global $wpdb;
785
 
786
  $affiliate_link_ids_str = implode( "," , array_map( 'intval' , $affiliate_link_ids ) );
787
-
788
  $query = "UPDATE $wpdb->postmeta
789
  SET meta_value = REPLACE( REPLACE( meta_value , '&' , '&' ) , '&' , '&' )
790
  WHERE meta_key = '_ta_destination_url'
791
  AND post_id IN ( $affiliate_link_ids_str )";
792
-
793
  $wpdb->query( $query );
794
 
795
  }
@@ -847,6 +875,7 @@ class Migration implements Model_Interface , Activatable_Interface , Initiable_I
847
 
848
  add_filter( 'ta_migration_process_old_options' , array( $this , 'migrate_autolinker_enabled_post_types_field' ) , 10 , 1 );
849
  add_filter( 'ta_migration_process_old_options' , array( $this , 'migrate_stats_manual_exclusion' ) , 10 , 1 );
 
850
  add_action( 'ta_migrate_complex_options' , array( $this , 'complex_options_migration' ) );
851
  add_filter( 'ta_migration_process_old_link_meta' , array( $this , 'migrate_geolocations_meta_data' ) , 10 , 2 );
852
 
609
  return $old_options;
610
  }
611
 
612
+ /**
613
+ * Migrate new GCT tracking script option. (Added on TAP 1.1.0)
614
+ *
615
+ * @since 3.1.1
616
+ * @access public
617
+ *
618
+ * @param array $old_options List of TA2 old options data.
619
+ * @return array Filtered List of TA2 old options data.
620
+ */
621
+ public function migrate_gct_tracking_script( $old_options ) {
622
+
623
+ if ( ! is_plugin_active( 'thirstyaffiliates-pro/thirstyaffiliates-pro.php' ) )
624
+ return $old_options;
625
+
626
+ $tap_plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/thirstyaffiliates-pro/thirstyaffiliates-pro.php' );
627
+
628
+ if ( version_compare( $tap_plugin_data[ 'Version' ] , '1.1.0' , "<" ) )
629
+ return $old_options;
630
+
631
+ if ( isset( $old_options[ 'gctuselegacyga' ] ) && $old_options[ 'gctuselegacyga' ] == 'on' ) {
632
+
633
+ update_option( 'tap_google_click_tracking_script' , 'legacy_ga' );
634
+ unset( $old_options[ 'gctuselegacyga' ] );
635
+ }
636
+
637
+ return $old_options;
638
+ }
639
+
640
 
641
 
642
 
808
  $affiliate_link_ids[] = $affiliate_link->ID;
809
 
810
  if ( !empty( $affiliate_link_ids ) && is_array( $affiliate_link_ids ) ) {
811
+
812
  global $wpdb;
813
 
814
  $affiliate_link_ids_str = implode( "," , array_map( 'intval' , $affiliate_link_ids ) );
815
+
816
  $query = "UPDATE $wpdb->postmeta
817
  SET meta_value = REPLACE( REPLACE( meta_value , '&amp;amp;' , '&' ) , '&amp;' , '&' )
818
  WHERE meta_key = '_ta_destination_url'
819
  AND post_id IN ( $affiliate_link_ids_str )";
820
+
821
  $wpdb->query( $query );
822
 
823
  }
875
 
876
  add_filter( 'ta_migration_process_old_options' , array( $this , 'migrate_autolinker_enabled_post_types_field' ) , 10 , 1 );
877
  add_filter( 'ta_migration_process_old_options' , array( $this , 'migrate_stats_manual_exclusion' ) , 10 , 1 );
878
+ add_filter( 'ta_migration_process_old_options' , array( $this , 'migrate_gct_tracking_script' ) , 10 , 1 );
879
  add_action( 'ta_migrate_complex_options' , array( $this , 'complex_options_migration' ) );
880
  add_filter( 'ta_migration_process_old_link_meta' , array( $this , 'migrate_geolocations_meta_data' ) , 10 , 2 );
881
 
Models/Stats_Reporting.php CHANGED
@@ -197,7 +197,7 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface , Activat
197
  $http_referer = isset( $_SERVER[ 'HTTP_REFERER' ] ) ? $_SERVER[ 'HTTP_REFERER' ] : '';
198
  $query_string = isset( $_SERVER[ 'QUERY_STRING' ] ) ? $_SERVER[ 'QUERY_STRING' ] : '';
199
  $cloaked_url = $query_string ? $thirstylink->get_prop( 'permalink' ) . '?' . $query_string : $thirstylink->get_prop( 'permalink' );
200
-
201
  // if the refferer is from an external site, then record stat.
202
  if ( ! $http_referer || ! strrpos( 'x' . $http_referer , home_url() ) )
203
  $this->save_click_data( $thirstylink , $http_referer , $cloaked_url , $redirect_url , $redirect_type );
@@ -404,7 +404,7 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface , Activat
404
  'name' => __( 'Link Performance' , 'thirstyaffiliates' ),
405
  'title' => __( 'Link Performance Report' , 'thirstyaffiliates' ),
406
  'desc' => __( 'Total clicks on affiliate links over a given period.' , 'thirstyaffiliates' ),
407
- 'content' => $this->get_link_performance_report_content()
408
  );
409
 
410
  return $reports;
@@ -447,6 +447,7 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface , Activat
447
 
448
  // fetch current section
449
  $current_report = $this->get_current_report();
 
450
 
451
  // skip if section data is empty
452
  if ( empty( $current_report ) ) return; ?>
@@ -458,7 +459,7 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface , Activat
458
  <h1><?php echo $current_report[ 'title' ]; ?></h1>
459
  <p class="desc"><?php echo $current_report[ 'desc' ]; ?></p>
460
 
461
- <?php echo $current_report[ 'content' ]; ?>
462
  </div>
463
  <?php
464
  }
197
  $http_referer = isset( $_SERVER[ 'HTTP_REFERER' ] ) ? $_SERVER[ 'HTTP_REFERER' ] : '';
198
  $query_string = isset( $_SERVER[ 'QUERY_STRING' ] ) ? $_SERVER[ 'QUERY_STRING' ] : '';
199
  $cloaked_url = $query_string ? $thirstylink->get_prop( 'permalink' ) . '?' . $query_string : $thirstylink->get_prop( 'permalink' );
200
+
201
  // if the refferer is from an external site, then record stat.
202
  if ( ! $http_referer || ! strrpos( 'x' . $http_referer , home_url() ) )
203
  $this->save_click_data( $thirstylink , $http_referer , $cloaked_url , $redirect_url , $redirect_type );
404
  'name' => __( 'Link Performance' , 'thirstyaffiliates' ),
405
  'title' => __( 'Link Performance Report' , 'thirstyaffiliates' ),
406
  'desc' => __( 'Total clicks on affiliate links over a given period.' , 'thirstyaffiliates' ),
407
+ 'content' => function() { return $this->get_link_performance_report_content(); }
408
  );
409
 
410
  return $reports;
447
 
448
  // fetch current section
449
  $current_report = $this->get_current_report();
450
+ $report_content = is_callable( $current_report[ 'content' ] ) ? $current_report[ 'content' ]() : $current_report[ 'content' ];
451
 
452
  // skip if section data is empty
453
  if ( empty( $current_report ) ) return; ?>
459
  <h1><?php echo $current_report[ 'title' ]; ?></h1>
460
  <p class="desc"><?php echo $current_report[ 'desc' ]; ?></p>
461
 
462
+ <?php echo $report_content; ?>
463
  </div>
464
  <?php
465
  }
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.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -159,6 +159,10 @@ See our [Knowledge Base](https://thirstyaffiliates.com/knowledge-base/?utm_sourc
159
 
160
  == Changelog ==
161
 
 
 
 
 
162
  = 3.1.0 =
163
  * Feature: Add REST API support
164
  * Feature: Automatically add link prefix in the robots.txt to prevent indexing
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
 
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
165
+
166
  = 3.1.0 =
167
  * Feature: Add REST API support
168
  * Feature: Automatically add link prefix in the robots.txt to prevent indexing
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.0
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.1
7
  * Author: Rymera Web Co
8
  * Author URI: https://rymera.com.au/
9
  * Requires at least: 4.4.2