ThirstyAffiliates Affiliate Link Manager - Version 3.0.3

Version Description

  • Bug Fix: Visual editor breaks on text widgets
  • Bug Fix: Conflict with Shortcoder plugin
  • Bug Fix: Tour keeps popping up
Download this release

Release Info

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

Code changes from version 3.0.2 to 3.0.3

Helpers/Helper_Functions.php CHANGED
@@ -225,7 +225,7 @@ class Helper_Functions {
225
  */
226
  public function check_if_valid_save_post_action( $post_id , $post_type ) {
227
 
228
- if ( wp_is_post_autosave( $post_id ) || wp_is_post_revision( $post_id ) || !current_user_can( 'edit_page' , $post_id ) || get_post_type() != $post_type || empty( $_POST ) )
229
  return false;
230
  else
231
  return true;
225
  */
226
  public function check_if_valid_save_post_action( $post_id , $post_type ) {
227
 
228
+ if ( get_post_type() != $post_type || empty( $_POST ) || wp_is_post_autosave( $post_id ) || wp_is_post_revision( $post_id ) || !current_user_can( 'edit_page' , $post_id ) )
229
  return false;
230
  else
231
  return true;
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.0.2';
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.0.3';
31
  const TEXT_DOMAIN = 'thirstyaffiliates';
32
  const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
33
  const META_DATA_PREFIX = '_ta_';
Models/Guided_Tour.php CHANGED
@@ -332,6 +332,9 @@ class Guided_Tour implements Model_Interface , Activatable_Interface , Initiable
332
  */
333
  private function set_guided_tour_status_open() {
334
 
 
 
 
335
  update_option( 'ta_guided_tour_status' , 'open' );
336
  }
337
 
332
  */
333
  private function set_guided_tour_status_open() {
334
 
335
+ if ( get_option( 'ta_guided_tour_status' ) )
336
+ return;
337
+
338
  update_option( 'ta_guided_tour_status' , 'open' );
339
  }
340
 
Models/Link_Picker.php CHANGED
@@ -124,7 +124,7 @@ class Link_Picker implements Model_Interface {
124
  */
125
  public function init_thirsty_editor_buttons() {
126
 
127
- if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( 'edit_pages' ) )
128
  return;
129
 
130
  if ( get_option( 'ta_disable_visual_editor_buttons' ) == 'yes' || get_user_option( 'rich_editing' ) != 'true' )
124
  */
125
  public function init_thirsty_editor_buttons() {
126
 
127
+ if ( ! is_admin() || ! current_user_can( 'edit_posts' ) || ! current_user_can( 'edit_pages' ) )
128
  return;
129
 
130
  if ( get_option( 'ta_disable_visual_editor_buttons' ) == 'yes' || get_user_option( 'rich_editing' ) != 'true' )
Models/Script_Loader.php CHANGED
@@ -131,6 +131,24 @@ class Script_Loader implements Model_Interface {
131
  wp_enqueue_script( 'review-request' , $this->_constants->JS_ROOT_URL() . 'app/ta-review-request.js' , array( 'jquery' ) , Plugin_Constants::VERSION , true );
132
  }
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  if ( $screen->base === 'thirstylink_page_thirsty-settings' ) {
135
 
136
  // Settings
@@ -189,21 +207,6 @@ class Script_Loader implements Model_Interface {
189
  wp_enqueue_script( 'jquery_tiptip' , $this->_constants->JS_ROOT_URL() . 'lib/jquery-tiptip/jquery.tipTip.min.js' , array() , Plugin_Constants::VERSION , true );
190
  wp_enqueue_script( 'ta_affiliate-link-page_js' , $this->_constants->JS_ROOT_URL() . 'app/affiliate_link_page/dist/affiliate-link-page.js' , array() , Plugin_Constants::VERSION , true );
191
 
192
- } elseif ( ( $screen->base == 'post' || $screen->id == 'optimizepress_page_optimizepress-page-builder' ) && $post_type != Plugin_Constants::AFFILIATE_LINKS_CPT ) {
193
-
194
- wp_enqueue_style( 'thickbox' );
195
- wp_enqueue_style( 'thirstyaffiliates-tinymce' , $this->_constants->CSS_ROOT_URL() . 'admin/tinymce/editor.css' , Plugin_Constants::VERSION , 'screen' );
196
-
197
- wp_enqueue_script( 'thickbox' , true );
198
- wp_enqueue_script( 'ta_editor_js', $this->_constants->JS_ROOT_URL() . 'app/ta-editor.js', array( 'jquery' ), Plugin_Constants::VERSION , true );
199
- wp_localize_script( 'ta_editor_js' , 'ta_editor_var' , array(
200
- 'insertion_type' => get_option( 'ta_link_insertion_type' , 'link' ),
201
- 'disable_qtag_buttons' => get_option( 'ta_disable_text_editor_buttons' , 'no' ),
202
- 'html_editor_affiliate_link_title' => __( 'Open the ThirstyAffiliates link picker' , 'thirstyaffiliates' ),
203
- 'html_editor_quick_add_title' => __( 'Open quick add affiliate link dialog' , 'thirstyaffiliates' ),
204
- 'simple_search_placeholder' => __( 'Type to search affiliate link' , 'thirstyaffiliates' )
205
- ) );
206
-
207
  } elseif ( $screen->id == 'thirstylink_page_thirsty-reports' ) {
208
 
209
  wp_enqueue_style( 'jquery-ui-styles' , '//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.min.css' , array() , '1.11.4', 'all' );
131
  wp_enqueue_script( 'review-request' , $this->_constants->JS_ROOT_URL() . 'app/ta-review-request.js' , array( 'jquery' ) , Plugin_Constants::VERSION , true );
132
  }
133
 
134
+ // Link picker styles and scripts.
135
+ if ( is_admin() && current_user_can( 'manage_options' ) && ! in_array( $screen->base , array( 'widgets' , 'customize' ) ) ) {
136
+
137
+ wp_enqueue_style( 'thirstyaffiliates-tinymce' , $this->_constants->CSS_ROOT_URL() . 'admin/tinymce/editor.css' , array( 'thickbox' ) , Plugin_Constants::VERSION , 'screen' );
138
+
139
+ wp_enqueue_script( 'ta_editor_js', $this->_constants->JS_ROOT_URL() . 'app/ta-editor.js', array( 'jquery' , 'thickbox' ), Plugin_Constants::VERSION , true );
140
+ wp_localize_script( 'ta_editor_js' , 'ta_editor_var' , array(
141
+ 'insertion_type' => get_option( 'ta_link_insertion_type' , 'link' ),
142
+ 'disable_qtag_buttons' => get_option( 'ta_disable_text_editor_buttons' , 'no' ),
143
+ 'html_editor_affiliate_link_btn' => __( 'affiliate link' , 'thirstyaffiliates' ),
144
+ 'html_editor_quick_add_btn' => __( 'affiliate link' , 'thirstyaffiliates' ),
145
+ 'html_editor_affiliate_link_title' => __( 'Open the ThirstyAffiliates link picker' , 'thirstyaffiliates' ),
146
+ 'html_editor_quick_add_title' => __( 'Open quick add affiliate link dialog' , 'thirstyaffiliates' ),
147
+ 'simple_search_placeholder' => __( 'Type to search affiliate link' , 'thirstyaffiliates' )
148
+ ) );
149
+ }
150
+
151
+
152
  if ( $screen->base === 'thirstylink_page_thirsty-settings' ) {
153
 
154
  // Settings
207
  wp_enqueue_script( 'jquery_tiptip' , $this->_constants->JS_ROOT_URL() . 'lib/jquery-tiptip/jquery.tipTip.min.js' , array() , Plugin_Constants::VERSION , true );
208
  wp_enqueue_script( 'ta_affiliate-link-page_js' , $this->_constants->JS_ROOT_URL() . 'app/affiliate_link_page/dist/affiliate-link-page.js' , array() , Plugin_Constants::VERSION , true );
209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  } elseif ( $screen->id == 'thirstylink_page_thirsty-reports' ) {
211
 
212
  wp_enqueue_style( 'jquery-ui-styles' , '//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.min.css' , array() , '1.11.4', 'all' );
js/app/ta-editor.js CHANGED
@@ -6,6 +6,7 @@ jQuery( document ).ready( function($) {
6
  editor : null,
7
  editorinit : false,
8
  linkNode : null,
 
9
  inputInstance : null,
10
  close_thickbox : function() {
11
  tb_remove();
@@ -24,7 +25,7 @@ jQuery( document ).ready( function($) {
24
 
25
  text_component = document.getElementById( "replycontent" );
26
  if (typeof text_component == "undefined" || ! jQuery(text_component).is( ":visible" ) ) // is not a comment reply
27
- text_component = document.getElementById( "content" );
28
 
29
  // IE version
30
  if (parent.document.selection != undefined) {
@@ -36,7 +37,7 @@ jQuery( document ).ready( function($) {
36
  }
37
 
38
  // Mozilla version
39
- else if (text_component.selectionStart != undefined) {
40
  startPos = text_component.selectionStart;
41
  endPos = text_component.selectionEnd;
42
  selected_text.text = text_component.value.substring(startPos, endPos)
@@ -59,7 +60,7 @@ jQuery( document ).ready( function($) {
59
  val;
60
 
61
  if ( typeof el == "undefined" || ! $( el ).is( ":visible" ) ) // is not a comment reply
62
- el = parent.document.getElementById( "content" );
63
 
64
  val = el.value;
65
  content = append ? sel.text + text : text;
@@ -101,8 +102,8 @@ jQuery( document ).ready( function($) {
101
  */
102
  if ( typeof QTags != 'undefined' && ta_editor_var.disable_qtag_buttons !== 'yes' ) {
103
 
104
- QTags.addButton( "thirstyaffiliates_aff_link", "affiliate link", ta_display_affiliate_link_thickbox , "" , "" , ta_editor_var.html_editor_affiliate_link_title , 30 );
105
- QTags.addButton( "thirstyaffiliates_quick_add_aff_Link", "quick add affiliate link", ta_display_quick_add_affiliate_thickbox , "" , "" , ta_editor_var.html_editor_quick_add_title , 31 );
106
  }
107
 
108
  /**
@@ -112,12 +113,16 @@ jQuery( document ).ready( function($) {
112
  */
113
  function ta_display_affiliate_link_thickbox() {
114
 
 
 
115
  var post_id = $( '#post_ID' ).val();
116
  tb_show( 'Add Affiliate Link' , window.ajaxurl + '?action=ta_advanced_add_affiliate_link&post_id=' + post_id + '&height=640&width=640&html_editor=true&TB_iframe=false' );
117
  }
118
 
119
  /**
120
  * Function to display the quick add affiliate link thickbox for the HTML editor.
 
 
121
  */
122
  function ta_display_quick_add_affiliate_thickbox() {
123
 
@@ -126,4 +131,13 @@ jQuery( document ).ready( function($) {
126
 
127
  tb_show( 'Quick Add Affiliate Link' , window.ajaxurl + '?action=ta_quick_add_affiliate_link_thickbox&post_id=' + post_id + '&height=500&width=500&selection=' + selection + '&html_editor=true&TB_iframe=false' );
128
  }
 
 
 
 
 
 
 
 
 
129
  });
6
  editor : null,
7
  editorinit : false,
8
  linkNode : null,
9
+ htmlEditor : null,
10
  inputInstance : null,
11
  close_thickbox : function() {
12
  tb_remove();
25
 
26
  text_component = document.getElementById( "replycontent" );
27
  if (typeof text_component == "undefined" || ! jQuery(text_component).is( ":visible" ) ) // is not a comment reply
28
+ text_component = ThirstyLinkPicker.html_editor[0];
29
 
30
  // IE version
31
  if (parent.document.selection != undefined) {
37
  }
38
 
39
  // Mozilla version
40
+ else if ( typeof text_component == 'object' && text_component && text_component.selectionStart != undefined) {
41
  startPos = text_component.selectionStart;
42
  endPos = text_component.selectionEnd;
43
  selected_text.text = text_component.value.substring(startPos, endPos)
60
  val;
61
 
62
  if ( typeof el == "undefined" || ! $( el ).is( ":visible" ) ) // is not a comment reply
63
+ el = ThirstyLinkPicker.html_editor[0];
64
 
65
  val = el.value;
66
  content = append ? sel.text + text : text;
102
  */
103
  if ( typeof QTags != 'undefined' && ta_editor_var.disable_qtag_buttons !== 'yes' ) {
104
 
105
+ QTags.addButton( "thirstyaffiliates_aff_link", ta_editor_var.html_editor_affiliate_link_btn, ta_display_affiliate_link_thickbox , "" , "" , ta_editor_var.html_editor_affiliate_link_title , 30 );
106
+ QTags.addButton( "thirstyaffiliates_quick_add_aff_Link", ta_editor_var.html_editor_quick_add_btn, ta_display_quick_add_affiliate_thickbox , "" , "" , ta_editor_var.html_editor_quick_add_title , 31 );
107
  }
108
 
109
  /**
113
  */
114
  function ta_display_affiliate_link_thickbox() {
115
 
116
+
117
+
118
  var post_id = $( '#post_ID' ).val();
119
  tb_show( 'Add Affiliate Link' , window.ajaxurl + '?action=ta_advanced_add_affiliate_link&post_id=' + post_id + '&height=640&width=640&html_editor=true&TB_iframe=false' );
120
  }
121
 
122
  /**
123
  * Function to display the quick add affiliate link thickbox for the HTML editor.
124
+ *
125
+ * @since 3.0.0
126
  */
127
  function ta_display_quick_add_affiliate_thickbox() {
128
 
131
 
132
  tb_show( 'Quick Add Affiliate Link' , window.ajaxurl + '?action=ta_quick_add_affiliate_link_thickbox&post_id=' + post_id + '&height=500&width=500&selection=' + selection + '&html_editor=true&TB_iframe=false' );
133
  }
134
+
135
+ /**
136
+ * Event: save the jQuery object of the html editor textarea to the ThirstyLinkPicker global variable so we can access it on other functions.
137
+ *
138
+ * @since 3.0.3
139
+ */
140
+ $( 'body' ).on( 'click' , 'input[id*="thirstyaffiliates"]' , function() {
141
+ ThirstyLinkPicker.html_editor = $(this).closest( '.wp-editor-container' ).find( 'textarea.wp-editor-area' );
142
+ } );
143
  });
js/lib/thirstymce/editor-plugin.js CHANGED
@@ -1,5 +1,9 @@
1
  ( function( tinymce ) {
2
 
 
 
 
 
3
  // ThirstyLinkInput input type object.
4
  ThirstyLinkInputObj = {
5
  renderHtml: function() {
1
  ( function( tinymce ) {
2
 
3
+ // don't run the file if global variable is not defined.
4
+ if( typeof parent.ta_editor_var != 'object' )
5
+ return;
6
+
7
  // ThirstyLinkInput input type object.
8
  ThirstyLinkInputObj = {
9
  renderHtml: function() {
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.0.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -159,10 +159,15 @@ See our [Knowledge Base](https://thirstyaffiliates.com/knowledge-base/?utm_sourc
159
 
160
  == Changelog ==
161
 
 
 
 
 
 
162
  = 3.0.2 =
163
  * Bug Fix: Link Fixer overrides existing CSS classes on the link
164
  * Bug Fix: Link Fixer removes any query strings from the cloaked link
165
- * Bug Fix: Properly handle special characters on the text in which the link is attched
166
  * Bug Fix: Disabling link CSS and title globally won't work with Link Fixer
167
  * Bug Fix: Fix typo on search placeholder on editor
168
  * Bug Fix: Conflict with OptimizePress theme
5
  Requires at least: 3.4
6
  Requires PHP: 5.6
7
  Tested up to: 4.8.2
8
+ Stable tag: 3.0.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
159
 
160
  == Changelog ==
161
 
162
+ = 3.0.3 =
163
+ * Bug Fix: Visual editor breaks on text widgets
164
+ * Bug Fix: Conflict with Shortcoder plugin
165
+ * Bug Fix: Tour keeps popping up
166
+
167
  = 3.0.2 =
168
  * Bug Fix: Link Fixer overrides existing CSS classes on the link
169
  * Bug Fix: Link Fixer removes any query strings from the cloaked link
170
+ * Bug Fix: Properly handle special characters on the text in which the link is attached
171
  * Bug Fix: Disabling link CSS and title globally won't work with Link Fixer
172
  * Bug Fix: Fix typo on search placeholder on editor
173
  * Bug Fix: Conflict with OptimizePress theme
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.0.2
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.0.3
7
  * Author: Rymera Web Co
8
  * Author URI: https://rymera.com.au/
9
  * Requires at least: 4.4.2