ThirstyAffiliates Affiliate Link Manager - Version 3.10.4

Version Description

  • Bug Fix: Inserting links not working for non-admins
  • Bug Fix: Allow uppercase extensions in external image links
  • Bug Fix: Fatal error in the stats trimmer on PHP8
Download this release

Release Info

Developer caseproof
Plugin Icon 128x128 ThirstyAffiliates Affiliate Link Manager
Version 3.10.4
Comparing to
See all releases

Code changes from version 3.10.3 to 3.10.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.10.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.10.4';
31
  const TEXT_DOMAIN = 'thirstyaffiliates';
32
  const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
33
  const META_DATA_PREFIX = '_ta_';
Models/Affiliate_Link_Attachment.php CHANGED
@@ -300,7 +300,7 @@ class Affiliate_Link_Attachment implements Model_Interface , Initiable_Interface
300
  $response = array( 'status' => 'fail' , 'error_msg' => __( 'Invalid AJAX call' , 'thirstyaffiliates' ) );
301
  elseif ( ! isset( $_POST[ 'url' ] ) || ! isset( $_POST[ 'link_id' ] ) )
302
  $response = array( 'status' => 'fail' , 'error_msg' => __( 'Missing required post data' , 'thirstyaffiliates' ) );
303
- elseif ( ! filter_var( $_POST[ 'url' ] , FILTER_VALIDATE_URL ) || ! in_array( pathinfo( $_POST[ 'url' ] , PATHINFO_EXTENSION ) , $allowed_extensions ) )
304
  $response = array( 'status' => 'fail' , 'error_msg' => __( 'The external image source is not a valid url.' , 'thirstyaffiliates' ) );
305
  else {
306
 
300
  $response = array( 'status' => 'fail' , 'error_msg' => __( 'Invalid AJAX call' , 'thirstyaffiliates' ) );
301
  elseif ( ! isset( $_POST[ 'url' ] ) || ! isset( $_POST[ 'link_id' ] ) )
302
  $response = array( 'status' => 'fail' , 'error_msg' => __( 'Missing required post data' , 'thirstyaffiliates' ) );
303
+ elseif ( ! filter_var( $_POST[ 'url' ] , FILTER_VALIDATE_URL ) || ! in_array( strtolower( pathinfo( $_POST[ 'url' ] , PATHINFO_EXTENSION ) ) , $allowed_extensions ) )
304
  $response = array( 'status' => 'fail' , 'error_msg' => __( 'The external image source is not a valid url.' , 'thirstyaffiliates' ) );
305
  else {
306
 
Models/Affiliate_Links_CPT.php CHANGED
@@ -336,6 +336,22 @@ class Affiliate_Links_CPT implements Model_Interface , Initiable_Interface {
336
 
337
  return $html;
338
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
 
340
  /**
341
  * Register metaboxes
@@ -1001,6 +1017,7 @@ class Affiliate_Links_CPT implements Model_Interface , Initiable_Interface {
1001
 
1002
  // replace permalink with link ID
1003
  add_filter( 'get_sample_permalink_html', array( $this , 'replace_permalink_with_id' ), 10 , 2 );
 
1004
 
1005
  // metaboxes
1006
  add_action( 'add_meta_boxes' , array( $this , 'register_metaboxes' ) );
336
 
337
  return $html;
338
  }
339
+
340
+ /**
341
+ * Add custom HTML ta tag
342
+ *
343
+ * @since 3.10.4
344
+ * @access public
345
+ *
346
+ * @param array $tags List of allowed HTML tags
347
+ * @param string $context Context name
348
+ * @return array Array of allowed HTML tags
349
+ */
350
+ public function add_affiliate_link_tag( $tags, $context ) {
351
+ $tags['ta'] = $tags['a'];
352
+
353
+ return $tags;
354
+ }
355
 
356
  /**
357
  * Register metaboxes
1017
 
1018
  // replace permalink with link ID
1019
  add_filter( 'get_sample_permalink_html', array( $this , 'replace_permalink_with_id' ), 10 , 2 );
1020
+ add_filter( 'wp_kses_allowed_html', array( $this, 'add_affiliate_link_tag' ), 10, 2 );
1021
 
1022
  // metaboxes
1023
  add_action( 'add_meta_boxes' , array( $this , 'register_metaboxes' ) );
Models/Marketing.php CHANGED
@@ -204,6 +204,32 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
204
  */
205
  public function show_review_request_notice() {
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  $screen = get_current_screen();
208
 
209
  $post_type = get_post_type();
@@ -212,11 +238,7 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
212
 
213
  $review_request_response = get_option( Plugin_Constants::REVIEW_REQUEST_RESPONSE );
214
 
215
- if ( get_option( 'ta_review_prompt_removed' ) ) {
216
- return;
217
- }
218
-
219
- if ( ! is_admin() || ! current_user_can( 'manage_options' ) || $post_type !== Plugin_Constants::AFFILIATE_LINKS_CPT || get_option( Plugin_Constants::SHOW_REQUEST_REVIEW ) !== 'yes' || ( $review_request_response !== 'review-later' && ! empty( $review_request_response ) ) )
220
  return;
221
 
222
  ?>
@@ -229,37 +251,42 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
229
  <p><?php _e( 'That\'s awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?', 'thirstyaffiliates' ); ?></p>
230
  <p style="font-weight: bold;">~ Blair Williams<br>CEO of ThirstyAffiliates</p>
231
  <p>
232
- <a style="display: inline-block; margin-right: 10px;" href="https://wordpress.org/support/plugin/thirstyaffiliates/reviews/?filter=5#new-post" onclick="delayReviewPrompt('remove')" target="_blank"><?php esc_html_e( 'Okay, you deserve it', 'thirstyaffiliates' ); ?></a>
233
- <a style="display: inline-block; margin-right: 10px;" href="#" onclick="delayReviewPrompt('delay')"><?php esc_html_e( 'Nope, maybe later', 'thirstyaffiliates' ); ?></a>
234
- <a href="#" onclick="delayReviewPrompt('remove')"><?php esc_html_e( 'I already did', 'thirstyaffiliates' ); ?></a>
235
  </p>
236
  </div>
237
  <div id="ta_review_no" style="display: none;">
238
  <p><?php _e( 'We\'re sorry to hear you aren\'t enjoying ThirstyAffiliates. We would love a chance to improve. Could you take a minute and let us know what we can do better?', 'thirstyaffiliates' ); ?></p>
239
  <p>
240
- <a style="display: inline-block; margin-right: 10px;" href="https://thirstyaffiliates.com/plugin-feedback/?utm_source=plugin_admin&utm_medium=link&utm_campaign=in_plugin&utm_content=request_review" onclick="delayReviewPrompt('remove')" target="_blank"><?php esc_html_e( 'Give Feedback', 'thirstyaffiliates' ); ?></a>
241
- <a href="#" onclick="delayReviewPrompt('remove')"><?php esc_html_e( 'No thanks', 'thirstyaffiliates' ); ?></a>
242
  </p>
243
  </div>
244
  </div>
245
  <script>
246
 
247
- function delayReviewPrompt(type, triggerClick = true) {
248
- if ( triggerClick ) {
249
- jQuery('#ta_review_notice').fadeOut();
250
- }
251
- jQuery.ajax({
252
- url: ajaxurl,
253
- type: 'POST',
254
- data: {
255
- action: 'ta_dismiss_review_prompt',
256
- nonce: "<?php echo wp_create_nonce( 'ta_dismiss_review_prompt' ) ?>",
257
- type: type
258
- },
259
- })
260
- .done(function(data) {
261
-
262
- });
 
 
 
 
 
263
  }
264
 
265
  jQuery(document).ready(function($) {
@@ -271,7 +298,7 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
271
  $('#ta_review_' + selection).show();
272
  });
273
  $('body').on('click', '#ta_review_notice .notice-dismiss', function(event) {
274
- delayReviewPrompt('delay', false);
275
  });
276
  });
277
  </script>
@@ -544,7 +571,9 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
544
  'status' => 'removed'
545
  ) );
546
  } else if ( 'delay' === $_POST['type'] ) {
547
- set_transient( 'ta_review_prompt_delay', true, WEEK_IN_SECONDS );
 
 
548
  wp_send_json_success( array(
549
  'status' => 'delayed'
550
  ) );
204
  */
205
  public function show_review_request_notice() {
206
 
207
+ // Only show to admins
208
+ if ( ! current_user_can( 'manage_options' ) ) {
209
+ return;
210
+ }
211
+
212
+ // Check for the constant to disable the prompt
213
+ if ( defined( 'TA_DISABLE_REVIEW_PROMPT' ) && true == TA_DISABLE_REVIEW_PROMPT ) {
214
+ return;
215
+ }
216
+
217
+ // Notice has been delayed
218
+ $delayed_option = get_option( 'ta_review_prompt_delay' );
219
+ if ( ! empty( $delayed_option['delayed_until'] ) && time() < $delayed_option['delayed_until'] ) {
220
+ return;
221
+ }
222
+
223
+ // Notice has been removed
224
+ if ( get_option( 'ta_review_prompt_removed' ) ) {
225
+ return;
226
+ }
227
+
228
+ // Backwards compat
229
+ if ( get_transient( 'ta_review_prompt_delay' ) ) {
230
+ return;
231
+ }
232
+
233
  $screen = get_current_screen();
234
 
235
  $post_type = get_post_type();
238
 
239
  $review_request_response = get_option( Plugin_Constants::REVIEW_REQUEST_RESPONSE );
240
 
241
+ if ( ! is_admin() || get_option( Plugin_Constants::SHOW_REQUEST_REVIEW ) !== 'yes' || ( $review_request_response !== 'review-later' && ! empty( $review_request_response ) ) )
 
 
 
 
242
  return;
243
 
244
  ?>
251
  <p><?php _e( 'That\'s awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?', 'thirstyaffiliates' ); ?></p>
252
  <p style="font-weight: bold;">~ Blair Williams<br>CEO of ThirstyAffiliates</p>
253
  <p>
254
+ <a style="display: inline-block; margin-right: 10px;" href="https://wordpress.org/support/plugin/thirstyaffiliates/reviews/?filter=5#new-post" onclick="delayReviewPrompt(event, 'remove', true, true)" target="_blank"><?php esc_html_e( 'Okay, you deserve it', 'thirstyaffiliates' ); ?></a>
255
+ <a style="display: inline-block; margin-right: 10px;" href="#" onclick="delayReviewPrompt(event, 'delay', true, false)"><?php esc_html_e( 'Nope, maybe later', 'thirstyaffiliates' ); ?></a>
256
+ <a href="#" onclick="delayReviewPrompt(event, 'remove', true, false)"><?php esc_html_e( 'I already did', 'thirstyaffiliates' ); ?></a>
257
  </p>
258
  </div>
259
  <div id="ta_review_no" style="display: none;">
260
  <p><?php _e( 'We\'re sorry to hear you aren\'t enjoying ThirstyAffiliates. We would love a chance to improve. Could you take a minute and let us know what we can do better?', 'thirstyaffiliates' ); ?></p>
261
  <p>
262
+ <a style="display: inline-block; margin-right: 10px;" href="https://thirstyaffiliates.com/plugin-feedback/?utm_source=plugin_admin&utm_medium=link&utm_campaign=in_plugin&utm_content=request_review" onclick="delayReviewPrompt(event, 'remove', true, true)" target="_blank"><?php esc_html_e( 'Give Feedback', 'thirstyaffiliates' ); ?></a>
263
+ <a href="#" onclick="delayReviewPrompt(event, 'remove', true, false)"><?php esc_html_e( 'No thanks', 'thirstyaffiliates' ); ?></a>
264
  </p>
265
  </div>
266
  </div>
267
  <script>
268
 
269
+ function delayReviewPrompt(event, type, triggerClick = true, openLink = false) {
270
+ event.preventDefault();
271
+ if ( triggerClick ) {
272
+ jQuery('#ta_review_notice').fadeOut();
273
+ }
274
+ if ( openLink ) {
275
+ var href = event.target.href;
276
+ window.open(href, '_blank');
277
+ }
278
+ jQuery.ajax({
279
+ url: ajaxurl,
280
+ type: 'POST',
281
+ data: {
282
+ action: 'ta_dismiss_review_prompt',
283
+ nonce: "<?php echo wp_create_nonce( 'ta_dismiss_review_prompt' ) ?>",
284
+ type: type
285
+ },
286
+ })
287
+ .done(function(data) {
288
+
289
+ });
290
  }
291
 
292
  jQuery(document).ready(function($) {
298
  $('#ta_review_' + selection).show();
299
  });
300
  $('body').on('click', '#ta_review_notice .notice-dismiss', function(event) {
301
+ delayReviewPrompt(event, 'delay', false);
302
  });
303
  });
304
  </script>
571
  'status' => 'removed'
572
  ) );
573
  } else if ( 'delay' === $_POST['type'] ) {
574
+ update_option( 'ta_review_prompt_delay', array(
575
+ 'delayed_until' => time() + WEEK_IN_SECONDS
576
+ ) );
577
  wp_send_json_success( array(
578
  'status' => 'delayed'
579
  ) );
Models/Stats_Reporting.php CHANGED
@@ -939,7 +939,7 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface , Activat
939
  // Proceed on deleting data when $click_ids are present
940
  if ( is_array( $click_ids ) && ! empty( $click_ids ) ) {
941
 
942
- $click_ids_string = implode( $click_ids , ',' );
943
 
944
  // delete click data
945
  $wpdb->query( "DELETE FROM $clicks_meta_db WHERE click_id IN ( $click_ids_string )" );
939
  // Proceed on deleting data when $click_ids are present
940
  if ( is_array( $click_ids ) && ! empty( $click_ids ) ) {
941
 
942
+ $click_ids_string = implode( ',', $click_ids );
943
 
944
  // delete click data
945
  $wpdb->query( "DELETE FROM $clicks_meta_db WHERE click_id IN ( $click_ids_string )" );
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link:
4
  Tags: affiliate, link, affiliate link management, link cloaker, link redirect, shortlink, thirstyaffiliates, thirsty affiliates
5
  Requires at least: 5.0
6
  Requires PHP: 5.6
7
- Tested up to: 5.8
8
- Stable tag: 3.10.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -159,6 +159,11 @@ See our [Knowledge Base](https://thirstyaffiliates.com/knowledge-base/?utm_sourc
159
 
160
  == Changelog ==
161
 
 
 
 
 
 
162
  = 3.10.3 =
163
  * Bug Fix: User-specific language setting having no effect on plugin translations
164
 
4
  Tags: affiliate, link, affiliate link management, link cloaker, link redirect, shortlink, thirstyaffiliates, thirsty affiliates
5
  Requires at least: 5.0
6
  Requires PHP: 5.6
7
+ Tested up to: 5.9
8
+ Stable tag: 3.10.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.10.4 =
163
+ * Bug Fix: Inserting links not working for non-admins
164
+ * Bug Fix: Allow uppercase extensions in external image links
165
+ * Bug Fix: Fatal error in the stats trimmer on PHP8
166
+
167
  = 3.10.3 =
168
  * Bug Fix: User-specific language setting having no effect on plugin translations
169
 
thirstyaffiliates.php CHANGED
@@ -3,11 +3,11 @@
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.10.3
7
  * Author: Caseproof
8
  * Author URI: https://caseproof.com/
9
  * Requires at least: 5.0
10
- * Tested up to: 5.8
11
  *
12
  * Text Domain: thirstyaffiliates
13
  * Domain Path: /languages/
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.10.4
7
  * Author: Caseproof
8
  * Author URI: https://caseproof.com/
9
  * Requires at least: 5.0
10
+ * Tested up to: 5.9
11
  *
12
  * Text Domain: thirstyaffiliates
13
  * Domain Path: /languages/