OptionTree - Version 2.2.3

Version Description

  • Hotfix - Allow empty condition values. For example, field_id:is() or field_id:not() would now be valid syntax.
  • Hotfix - Fixed a bug in the init_upload_fix JavaScript method.
  • Hotfix - Fixed a bug in the url_exists javaScript method. The code will no longer will check if a URL exists on another domain.
Download this release

Release Info

Developer valendesigns
Plugin Icon wp plugin OptionTree
Version 2.2.3
Comparing to
See all releases

Code changes from version 2.2.2 to 2.2.3

Files changed (3) hide show
  1. assets/js/ot-admin.js +18 -10
  2. ot-loader.php +2 -2
  3. readme.txt +6 -1
assets/js/ot-admin.js CHANGED
@@ -290,14 +290,14 @@
290
  },
291
  match_conditions: function(condition) {
292
  var match;
293
- var regex = /(.+?):(is|not|contains|less_than|less_than_or_equal_to|greater_than|greater_than_or_equal_to)\((.+?)\),?/g;
294
  var conditions = [];
295
 
296
  while( match = regex.exec( condition ) ) {
297
  conditions.push({
298
  'check': match[1],
299
  'rule': match[2],
300
- 'value': match[3]
301
  });
302
  }
303
 
@@ -308,22 +308,22 @@
308
 
309
  var passed;
310
  var conditions = OT_UI.match_conditions( $( this ).data( 'condition' ) );
311
- var operator = ( $( this ).data( 'operator' ) || 'and' ).toLowerCase();
312
 
313
  $.each( conditions, function( index, condition ) {
314
 
315
  var target = $( '#setting_' + condition.check );
316
  var targetEl = !! target.length && target.find( 'select, input[type="radio"]:checked, input.ot-numeric-slider-hidden-input' ).first();
317
 
318
- if( ! target.length || ! targetEl.length ) {
319
  return;
320
  }
321
 
322
- var v1 = targetEl.val().toString();
323
  var v2 = condition.value.toString();
324
  var result;
325
 
326
- switch( condition.rule ) {
327
  case 'less_than':
328
  result = ( v1 < v2 );
329
  break;
@@ -347,11 +347,11 @@
347
  break;
348
  }
349
 
350
- if( 'undefined' == typeof passed ) {
351
  passed = result;
352
  }
353
 
354
- switch( operator ) {
355
  case 'or':
356
  passed = ( passed || result );
357
  break;
@@ -457,9 +457,12 @@
457
  init_upload_fix: function(elm) {
458
  var id = $(elm).attr('id'),
459
  val = $(elm).val(),
460
- img = $(elm).parent().next('option-tree-ui-media-wrap').find('img'),
461
  src = img.attr('src'),
462
  btnContent = '';
 
 
 
463
  if ( val != src ) {
464
  img.attr('src', val);
465
  }
@@ -548,7 +551,7 @@
548
  $('#'+field_id).wpColorPicker();
549
  },
550
  fix_upload_parent: function() {
551
- $(document).on('focus blur', '.option-tree-ui-upload-input', function(){
552
  $(this).parent('.option-tree-ui-upload-parent').toggleClass('focus');
553
  OT_UI.init_upload_fix(this);
554
  });
@@ -587,6 +590,11 @@
587
  });
588
  },
589
  url_exists: function(url) {
 
 
 
 
 
590
  var http = new XMLHttpRequest();
591
  http.open('HEAD', url, false);
592
  http.send();
290
  },
291
  match_conditions: function(condition) {
292
  var match;
293
+ var regex = /(.+?):(is|not|contains|less_than|less_than_or_equal_to|greater_than|greater_than_or_equal_to)\((.*?)\),?/g;
294
  var conditions = [];
295
 
296
  while( match = regex.exec( condition ) ) {
297
  conditions.push({
298
  'check': match[1],
299
  'rule': match[2],
300
+ 'value': match[3] || ''
301
  });
302
  }
303
 
308
 
309
  var passed;
310
  var conditions = OT_UI.match_conditions( $( this ).data( 'condition' ) );
311
+ var operator = ( $( this ).data( 'operator' ) || 'and' ).toLowerCase();
312
 
313
  $.each( conditions, function( index, condition ) {
314
 
315
  var target = $( '#setting_' + condition.check );
316
  var targetEl = !! target.length && target.find( 'select, input[type="radio"]:checked, input.ot-numeric-slider-hidden-input' ).first();
317
 
318
+ if ( ! target.length || ( ! targetEl.length && condition.value.toString() != '' ) ) {
319
  return;
320
  }
321
 
322
+ var v1 = targetEl.length ? targetEl.val().toString() : '';
323
  var v2 = condition.value.toString();
324
  var result;
325
 
326
+ switch ( condition.rule ) {
327
  case 'less_than':
328
  result = ( v1 < v2 );
329
  break;
347
  break;
348
  }
349
 
350
+ if ( 'undefined' == typeof passed ) {
351
  passed = result;
352
  }
353
 
354
+ switch ( operator ) {
355
  case 'or':
356
  passed = ( passed || result );
357
  break;
457
  init_upload_fix: function(elm) {
458
  var id = $(elm).attr('id'),
459
  val = $(elm).val(),
460
+ img = $(elm).parent().next('.option-tree-ui-media-wrap').find('img'),
461
  src = img.attr('src'),
462
  btnContent = '';
463
+ if ( val == src ) {
464
+ return;
465
+ }
466
  if ( val != src ) {
467
  img.attr('src', val);
468
  }
551
  $('#'+field_id).wpColorPicker();
552
  },
553
  fix_upload_parent: function() {
554
+ $('.option-tree-ui-upload-input').on('focus blur', function(){
555
  $(this).parent('.option-tree-ui-upload-parent').toggleClass('focus');
556
  OT_UI.init_upload_fix(this);
557
  });
590
  });
591
  },
592
  url_exists: function(url) {
593
+ var link = document.createElement('a')
594
+ link.href = url
595
+ if ( link.hostname != window.location.hostname ) {
596
+ return true; // Stop the code from checking across domains.
597
+ }
598
  var http = new XMLHttpRequest();
599
  http.open('HEAD', url, false);
600
  http.send();
ot-loader.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: OptionTree
4
  * Plugin URI: http://wp.envato.com
5
  * Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
6
- * Version: 2.2.2
7
  * Author: Derek Herman
8
  * Author URI: http://valendesigns.com
9
  * License: GPLv3
@@ -142,7 +142,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
142
  /**
143
  * Current Version number.
144
  */
145
- define( 'OT_VERSION', '2.2.2' );
146
 
147
  /**
148
  * For developers: Allow Unfiltered HTML in all the textareas.
3
  * Plugin Name: OptionTree
4
  * Plugin URI: http://wp.envato.com
5
  * Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
6
+ * Version: 2.2.3
7
  * Author: Derek Herman
8
  * Author URI: http://valendesigns.com
9
  * License: GPLv3
142
  /**
143
  * Current Version number.
144
  */
145
+ define( 'OT_VERSION', '2.2.3' );
146
 
147
  /**
148
  * For developers: Allow Unfiltered HTML in all the textareas.
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://bit.ly/NuXI3T
4
  Tags: admin, theme options, meta boxes, options, admin interface, ajax
5
  Requires at least: 3.5
6
  Tested up to: 3.8.1
7
- Stable tag: 2.2.2
8
  License: GPLv3
9
 
10
  Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
@@ -41,6 +41,11 @@ Yes. OptionTree & WordPress both require PHP5.
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
44
  = 2.2.2 =
45
  * Hotfix - Added support for both upper and lower case conditions operator.
46
  * Hotfix - Updated the color and font size of inline code.
4
  Tags: admin, theme options, meta boxes, options, admin interface, ajax
5
  Requires at least: 3.5
6
  Tested up to: 3.8.1
7
+ Stable tag: 2.2.3
8
  License: GPLv3
9
 
10
  Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
41
 
42
  == Changelog ==
43
 
44
+ = 2.2.3 =
45
+ * Hotfix - Allow empty condition values. For example, `field_id:is()` or `field_id:not()` would now be valid syntax.
46
+ * Hotfix - Fixed a bug in the `init_upload_fix` JavaScript method.
47
+ * Hotfix - Fixed a bug in the `url_exists` javaScript method. The code will no longer will check if a URL exists on another domain.
48
+
49
  = 2.2.2 =
50
  * Hotfix - Added support for both upper and lower case conditions operator.
51
  * Hotfix - Updated the color and font size of inline code.