Advanced Custom Fields - Version 4.3.6

Version Description

  • Core: Improved efficiency and speed when saving values by removing ACF meta from the native WP postmeta box
  • Field Group: Fixed cache issue causing field settings to not update
  • WYSIWYG field: Added support for new tinymce 4 in WP 3.9
  • Number field: Fixed bug causing blank values to save as 0
  • Google Maps field: Fixed JS bug causing google maps to not render when Google library is already loaded
  • Validation: Fixed JS bug where hidden field groups's fields were being validated
Download this release

Release Info

Developer elliotcondon
Plugin Icon 128x128 Advanced Custom Fields
Version 4.3.6
Comparing to
See all releases

Code changes from version 4.3.5 to 4.3.6

acf.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Advanced Custom Fields
4
  Plugin URI: http://www.advancedcustomfields.com/
5
  Description: Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerful API, it’s a must have for any web developer working with WordPress. Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker, repeater, flexible content, gallery and more!
6
- Version: 4.3.5
7
  Author: Elliot Condon
8
  Author URI: http://www.elliotcondon.com/
9
  License: GPL
@@ -43,7 +43,7 @@ class acf
43
  'path' => apply_filters('acf/helpers/get_path', __FILE__),
44
  'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
45
  'hook' => basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ),
46
- 'version' => '4.3.5',
47
  'upgrade_version' => '3.4.1',
48
  'include_3rd_party' => false
49
  );
3
  Plugin Name: Advanced Custom Fields
4
  Plugin URI: http://www.advancedcustomfields.com/
5
  Description: Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerful API, it’s a must have for any web developer working with WordPress. Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker, repeater, flexible content, gallery and more!
6
+ Version: 4.3.6
7
  Author: Elliot Condon
8
  Author URI: http://www.elliotcondon.com/
9
  License: GPL
43
  'path' => apply_filters('acf/helpers/get_path', __FILE__),
44
  'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
45
  'hook' => basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ),
46
+ 'version' => '4.3.6',
47
  'upgrade_version' => '3.4.1',
48
  'include_3rd_party' => false
49
  );
core/controllers/post.php CHANGED
@@ -219,6 +219,10 @@ class acf_controller_post
219
 
220
  // Allow 'acf_after_title' metabox position
221
  add_action('edit_form_after_title', array($this, 'edit_form_after_title'));
 
 
 
 
222
  }
223
 
224
 
@@ -520,6 +524,45 @@ class acf_controller_post
520
 
521
  }
522
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
523
 
524
  }
525
 
219
 
220
  // Allow 'acf_after_title' metabox position
221
  add_action('edit_form_after_title', array($this, 'edit_form_after_title'));
222
+
223
+
224
+ // remove ACF from meta postbox
225
+ add_filter( 'is_protected_meta', array($this, 'is_protected_meta'), 10, 3 );
226
  }
227
 
228
 
524
 
525
  }
526
 
527
+
528
+ /*
529
+ * is_protected_meta
530
+ *
531
+ * This function will remove any ACF meta from showing in the meta postbox
532
+ *
533
+ * @type function
534
+ * @date 12/04/2014
535
+ * @since 5.0.0
536
+ *
537
+ * @param $post_id (int)
538
+ * @return $post_id (int)
539
+ */
540
+
541
+ function is_protected_meta( $protected, $meta_key, $meta_type ) {
542
+
543
+ // globals
544
+ global $post;
545
+
546
+
547
+ // if acf_get_field_reference returns a valid key, this is an acf value, so protect it!
548
+ if( !$protected ) {
549
+
550
+ $reference = get_field_reference( $meta_key, $post->ID );
551
+
552
+ if( substr($reference, 0, 6) === 'field_' ) {
553
+
554
+ $protected = true;
555
+
556
+ }
557
+
558
+ }
559
+
560
+
561
+ // return
562
+ return $protected;
563
+
564
+ }
565
+
566
 
567
  }
568
 
core/fields/_functions.php CHANGED
@@ -502,6 +502,10 @@ class acf_field_functions
502
  $field = apply_filters('acf/update_field/type=' . $field['type'], $field, $post_id ); // new filter
503
 
504
 
 
 
 
 
505
  // save
506
  update_post_meta( $post_id, $field['key'], $field );
507
  }
@@ -517,6 +521,10 @@ class acf_field_functions
517
 
518
  function delete_field( $post_id, $field_key )
519
  {
 
 
 
 
520
  // delete
521
  delete_post_meta($post_id, $field_key);
522
  }
502
  $field = apply_filters('acf/update_field/type=' . $field['type'], $field, $post_id ); // new filter
503
 
504
 
505
+ // clear cache
506
+ wp_cache_delete( 'load_field/key=' . $field['key'], 'acf' );
507
+
508
+
509
  // save
510
  update_post_meta( $post_id, $field['key'], $field );
511
  }
521
 
522
  function delete_field( $post_id, $field_key )
523
  {
524
+ // clear cache
525
+ wp_cache_delete( 'load_field/key=' . $field['key'], 'acf' );
526
+
527
+
528
  // delete
529
  delete_post_meta($post_id, $field_key);
530
  }
core/fields/number.php CHANGED
@@ -243,6 +243,14 @@ class acf_field_number extends acf_field
243
 
244
  function update_value( $value, $post_id, $field )
245
  {
 
 
 
 
 
 
 
 
246
  // remove ','
247
  $value = str_replace(',', '', $value);
248
 
243
 
244
  function update_value( $value, $post_id, $field )
245
  {
246
+ // no formatting needed for empty value
247
+ if( empty($value) ) {
248
+
249
+ return $value;
250
+
251
+ }
252
+
253
+
254
  // remove ','
255
  $value = str_replace(',', '', $value);
256
 
js/input.js CHANGED
@@ -2321,12 +2321,16 @@ var acf = {
2321
  }
2322
  else
2323
  {
2324
- $fields.each(function(){
2325
 
2326
- acf.fields.google_map.set({ $el : $(this) }).init();
 
 
 
 
 
 
2327
 
2328
- });
2329
-
2330
  }
2331
 
2332
  });
@@ -3658,6 +3662,14 @@ var acf = {
3658
  }
3659
 
3660
 
 
 
 
 
 
 
 
 
3661
  if( ignore )
3662
  {
3663
  return;
@@ -3963,6 +3975,22 @@ var acf = {
3963
  return r;
3964
 
3965
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3966
  init : function(){
3967
 
3968
  // is clone field?
@@ -3972,38 +4000,64 @@ var acf = {
3972
  }
3973
 
3974
 
3975
- // temp store tinyMCE.settings
3976
- var tinyMCE_settings = $.extend( {}, tinyMCE.settings );
 
 
3977
 
3978
 
3979
- // reset tinyMCE settings
3980
- tinyMCE.settings.theme_advanced_buttons1 = '';
3981
- tinyMCE.settings.theme_advanced_buttons2 = '';
3982
- tinyMCE.settings.theme_advanced_buttons3 = '';
3983
- tinyMCE.settings.theme_advanced_buttons4 = '';
3984
 
3985
- if( acf.helpers.isset( this, 'toolbars', this.o.toolbar ) )
3986
- {
3987
- $.each( this.toolbars[ this.o.toolbar ], function( k, v ){
3988
- tinyMCE.settings[ k ] = v;
3989
- })
3990
- }
3991
 
 
 
3992
 
3993
- // add functionality back in
3994
- tinyMCE.execCommand("mceAddControl", false, this.o.id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3995
 
3996
 
3997
  // events - load
3998
  $(document).trigger('acf/wysiwyg/load', this.o.id);
3999
-
4000
-
4001
  // add events (click, focus, blur) for inserting image into correct editor
4002
  this.add_events();
4003
 
4004
 
4005
  // restore tinyMCE.settings
4006
- tinyMCE.settings = tinyMCE_settings;
4007
 
4008
 
4009
  // set active editor to null
@@ -4052,31 +4106,52 @@ var acf = {
4052
  },
4053
  destroy : function(){
4054
 
 
 
 
 
 
4055
  // Remove tinymcy functionality.
4056
  // Due to the media popup destroying and creating the field within such a short amount of time,
4057
  // a JS error will be thrown when launching the edit window twice in a row.
4058
- try
4059
- {
4060
  // vars
4061
- var id = this.o.id,
4062
- editor = tinyMCE.get( id );
4063
-
 
 
4064
 
4065
- // store the val, and add it back in to keep line breaks / formating
4066
- if( editor )
4067
- {
4068
- var val = editor.getContent();
4069
 
4070
- tinyMCE.execCommand("mceRemoveControl", false, id);
 
4071
 
4072
- this.$textarea.val( val );
 
 
 
 
4073
  }
4074
-
4075
 
4076
- }
4077
- catch(e)
4078
- {
 
 
 
 
 
 
 
 
 
 
 
 
4079
  //console.log( e );
 
4080
  }
4081
 
4082
 
2321
  }
2322
  else
2323
  {
2324
+ google.load('maps', '3', { other_params: 'sensor=false&libraries=places', callback: function(){
2325
 
2326
+ $fields.each(function(){
2327
+
2328
+ acf.fields.google_map.set({ $el : $(this) }).init();
2329
+
2330
+ });
2331
+
2332
+ }});
2333
 
 
 
2334
  }
2335
 
2336
  });
3662
  }
3663
 
3664
 
3665
+ // if field group is hidden, igrnoe
3666
+ if( div.closest('.postbox.acf-hidden').exists() ) {
3667
+
3668
+ ignore = true;
3669
+
3670
+ }
3671
+
3672
+
3673
  if( ignore )
3674
  {
3675
  return;
3975
  return r;
3976
 
3977
  },
3978
+
3979
+ get_toolbar : function(){
3980
+
3981
+ // safely get toolbar
3982
+ if( acf.helpers.isset( this, 'toolbars', this.o.toolbar ) ) {
3983
+
3984
+ return this.toolbars[ this.o.toolbar ];
3985
+
3986
+ }
3987
+
3988
+
3989
+ // return
3990
+ return false;
3991
+
3992
+ },
3993
+
3994
  init : function(){
3995
 
3996
  // is clone field?
4000
  }
4001
 
4002
 
4003
+ // vars
4004
+ var toolbar = this.get_toolbar(),
4005
+ command = 'mceAddControl',
4006
+ setting = 'theme_advanced_buttons{i}';
4007
 
4008
 
4009
+ // backup
4010
+ var _settings = $.extend( {}, tinyMCE.settings );
 
 
 
4011
 
4012
+
4013
+ // v4 settings
4014
+ if( tinymce.majorVersion == 4 ) {
 
 
 
4015
 
4016
+ command = 'mceAddEditor';
4017
+ setting = 'toolbar{i}';
4018
 
4019
+ }
4020
+
4021
+
4022
+ // add toolbars
4023
+ if( toolbar ) {
4024
+
4025
+ for( var i = 1; i < 5; i++ ) {
4026
+
4027
+ // vars
4028
+ var v = '';
4029
+
4030
+
4031
+ // load toolbar
4032
+ if( acf.helpers.isset( toolbar, 'theme_advanced_buttons' + i ) ) {
4033
+
4034
+ v = toolbar['theme_advanced_buttons' + i];
4035
+
4036
+ }
4037
+
4038
+
4039
+ // update setting
4040
+ tinyMCE.settings[ setting.replace('{i}', i) ] = v;
4041
+
4042
+ }
4043
+
4044
+ }
4045
+
4046
+
4047
+ // add editor
4048
+ tinyMCE.execCommand( command, false, this.o.id);
4049
 
4050
 
4051
  // events - load
4052
  $(document).trigger('acf/wysiwyg/load', this.o.id);
4053
+
4054
+
4055
  // add events (click, focus, blur) for inserting image into correct editor
4056
  this.add_events();
4057
 
4058
 
4059
  // restore tinyMCE.settings
4060
+ tinyMCE.settings = _settings;
4061
 
4062
 
4063
  // set active editor to null
4106
  },
4107
  destroy : function(){
4108
 
4109
+ // vars
4110
+ var id = this.o.id,
4111
+ command = 'mceRemoveControl';
4112
+
4113
+
4114
  // Remove tinymcy functionality.
4115
  // Due to the media popup destroying and creating the field within such a short amount of time,
4116
  // a JS error will be thrown when launching the edit window twice in a row.
4117
+ try {
4118
+
4119
  // vars
4120
+ var editor = tinyMCE.get( id );
4121
+
4122
+
4123
+ // validate
4124
+ if( !editor ) {
4125
 
4126
+ return;
 
 
 
4127
 
4128
+ }
4129
+
4130
 
4131
+ // v4 settings
4132
+ if( tinymce.majorVersion == 4 ) {
4133
+
4134
+ command = 'mceRemoveEditor';
4135
+
4136
  }
 
4137
 
4138
+
4139
+ // store value
4140
+ var val = editor.getContent();
4141
+
4142
+
4143
+ // remove editor
4144
+ tinyMCE.execCommand(command, false, id);
4145
+
4146
+
4147
+ // set value
4148
+ this.$textarea.val( val );
4149
+
4150
+
4151
+ } catch(e) {
4152
+
4153
  //console.log( e );
4154
+
4155
  }
4156
 
4157
 
js/input.min.js CHANGED
@@ -1,14 +1,2 @@
1
- /* **********************************************
2
- Begin acf.js
3
- ********************************************** *//*
4
- * input.js
5
- *
6
- * All javascript needed for ACF to work
7
- *
8
- * @type awesome
9
- * @date 1/08/13
10
- *
11
- * @param N/A
12
- * @return N/A
13
- */var acf={ajaxurl:"",admin_url:"",wp_version:"",post_id:0,nonce:"",l10n:null,o:null,helpers:{get_atts:null,version_compare:null,uniqid:null,sortable:null,add_message:null,is_clone_field:null,url_to_object:null},validation:null,conditional_logic:null,media:null,fields:{date_picker:null,color_picker:null,Image:null,file:null,wysiwyg:null,gallery:null,relationship:null}};(function(e){acf.helpers.isset=function(){var e=arguments,t=e.length,n=null,r;if(t===0)throw new Error("Empty isset");n=e[0];for(i=1;i<t;i++){if(e[i]===r||n[e[i]]===r)return!1;n=n[e[i]]}return!0};acf.helpers.get_atts=function(t){var n={};e.each(t[0].attributes,function(e,t){t.name.substr(0,5)=="data-"&&(n[t.name.replace("data-","")]=t.value)});return n};acf.helpers.version_compare=function(e,t){if(typeof e+typeof t!="stringstring")return!1;var n=e.split("."),r=t.split("."),i=0,s=Math.max(n.length,r.length);for(;i<s;i++){if(n[i]&&!r[i]&&parseInt(n[i])>0||parseInt(n[i])>parseInt(r[i]))return 1;if(r[i]&&!n[i]&&parseInt(r[i])>0||parseInt(n[i])<parseInt(r[i]))return-1}return 0};acf.helpers.uniqid=function(){var e=new Date;return e.getTime()};acf.helpers.url_to_object=function(e){var t={},n=e.split("&");for(i in n){var r=n[i].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t};acf.helpers.sortable=function(t,n){n.children().each(function(){e(this).width(e(this).width())});return n};acf.helpers.is_clone_field=function(e){return e.attr("name")&&e.attr("name").indexOf("[acfcloneindex]")!=-1?!0:!1};acf.helpers.add_message=function(t,n){var t=e('<div class="acf-message-wrapper"><div class="message updated"><p>'+t+"</p></div></div>");n.prepend(t);setTimeout(function(){t.animate({opacity:0},250,function(){t.remove()})},1500)};e.fn.exists=function(){return e(this).length>0};acf.media={div:null,frame:null,render_timout:null,clear_frame:function(){if(!this.frame)return;this.frame.detach();this.frame.dispose();this.frame=null},type:function(){var e="thickbox";typeof wp!="undefined"&&(e="backbone");return e},init:function(){if(this.type()!=="backbone")return!1;if(!acf.helpers.isset(wp,"media","view","AttachmentCompat","prototype"))return!1;var t=wp.media.view.AttachmentCompat.prototype;t.orig_render=t.render;t.orig_dispose=t.dispose;t.className="compat-item acf_postbox no_box";t.render=function(){var t=this;if(t.ignore_render)return this;this.orig_render();setTimeout(function(){var n=t.$el.closest(".media-modal");if(n.hasClass("acf-media-modal"))return;if(n.find(".media-frame-router .acf-expand-details").exists())return;var r=e(['<a href="#" class="acf-expand-details">','<span class="icon"></span>','<span class="is-closed">'+acf.l10n.core.expand_details+"</span>",'<span class="is-open">'+acf.l10n.core.collapse_details+"</span>","</a>"].join(""));r.on("click",function(e){e.preventDefault();n.hasClass("acf-expanded")?n.removeClass("acf-expanded"):n.addClass("acf-expanded")});n.find(".media-frame-router").append(r)},0);clearTimeout(acf.media.render_timout);acf.media.render_timout=setTimeout(function(){e(document).trigger("acf/setup_fields",[t.$el])},50);return this};t.dispose=function(){e(document).trigger("acf/remove_fields",[this.$el]);this.orig_dispose()};t.save=function(e){var t={},n={};e&&e.preventDefault();_.each(this.$el.serializeArray(),function(e){if(e.name.slice(-2)==="[]"){e.name=e.name.replace("[]","");typeof n[e.name]=="undefined"&&(n[e.name]=-1);n[e.name]++;e.name+="["+n[e.name]+"]"}t[e.name]=e.value});this.ignore_render=!0;this.model.saveCompat(t)}}};acf.conditional_logic={items:[],init:function(){var t=this;e(document).on("change",".field input, .field textarea, .field select",function(){e("#acf-has-changed").exists()&&e("#acf-has-changed").val(1);t.change(e(this))});e(document).on("acf/setup_fields",function(n,r){t.refresh(e(r))});t.refresh()},change:function(t){var n=this,r=t.closest(".field"),i=r.attr("data-field_key");e.each(this.items,function(t,r){e.each(r.rules,function(e,t){t.field==i&&n.refresh_field(r)})})},refresh_field:function(t){var n=this,r=e(".field_key-"+t.field);r.each(function(){var r=!0;t.allorany=="any"&&(r=!1);var i=e(this),s=!0;e.each(t.rules,function(o,u){var a=e(".field_key-"+u.field);if(a.hasClass("sub_field")){a=i.siblings(".field_key-"+u.field);s=!1;if(!a.exists()){i.parents("tr").each(function(){a=e(this).find(".field_key-"+u.field);if(a.exists())return!1});s=!0}}var f=i.parent("tr").parent().parent("table").parent(".layout");if(f.exists()){s=!0;i.is("th")&&a.is("th")&&(a=i.closest(".layout").find("td.field_key-"+u.field))}var f=i.parent("tr").parent().parent("table").parent(".repeater");if(f.exists()&&f.attr("data-max_rows")=="1"){s=!0;i.is("th")&&a.is("th")&&(a=i.closest("table").find("td.field_key-"+u.field))}var l=n.calculate(u,a,i);if(t.allorany=="all"){if(l==0){r=!1;return!1}}else if(l==1){r=!0;return!1}});i.removeClass("acf-conditional_logic-hide acf-conditional_logic-show acf-show-blank");if(r){i.find("input, textarea, select").removeAttr("disabled");i.addClass("acf-conditional_logic-show");e(document).trigger("acf/conditional_logic/show",[i,t])}else{i.find("input, textarea, select").attr("disabled","disabled");i.addClass("acf-conditional_logic-hide");s||i.addClass("acf-show-blank");e(document).trigger("acf/conditional_logic/hide",[i,t])}})},refresh:function(t){t=t||e("body");var n=this;e.each(this.items,function(r,i){e.each(i.rules,function(e,r){if(!t.find('.field[data-field_key="'+i.field+'"]').exists())return;n.refresh_field(i)})})},calculate:function(t,n,r){var i=!1;if(n.hasClass("field_type-true_false")||n.hasClass("field_type-checkbox")||n.hasClass("field_type-radio")){var s=n.find('input[value="'+t.value+'"]:checked').exists();t.operator=="=="?s&&(i=!0):s||(i=!0)}else{var o=n.find("input, textarea, select").last().val();e.isArray(o)||(o=[o]);t.operator=="=="?e.inArray(t.value,o)>-1&&(i=!0):e.inArray(t.value,o)<0&&(i=!0)}return i}};e(document).ready(function(){acf.conditional_logic.init();e(".acf_postbox > .inside > .options").each(function(){e(this).closest(".acf_postbox").addClass(e(this).attr("data-layout"))});e('#metakeyselect option[value^="field_"]').remove()});e(window).load(function(){acf.media.init();setTimeout(function(){try{e.isNumeric(acf.o.post_id)&&(wp.media.view.settings.post.id=acf.o.post_id)}catch(t){}e(document).trigger("acf/setup_fields",[e("#poststuff")])},10)});acf.fields.gallery={add:function(){},edit:function(){},update_count:function(){},hide_selected_items:function(){},text:{title_add:"Select Images"}}})(jQuery);(function(e){function t(){var t=[];e(".categorychecklist input:checked, .acf-taxonomy-field input:checked, .acf-taxonomy-field option:selected").each(function(){if(e(this).is(":hidden")||e(this).is(":disabled"))return;if(e(this).closest(".media-frame").exists())return;if(e(this).closest(".acf-taxonomy-field").exists()&&e(this).closest(".acf-taxonomy-field").attr("data-save")=="0")return;t.indexOf(e(this).val())===-1&&t.push(e(this).val())});acf.screen.post_category=t;acf.screen.taxonomy=t;e(document).trigger("acf/update_field_groups")}acf.screen={action:"acf/location/match_field_groups_ajax",post_id:0,page_template:0,page_parent:0,page_type:0,post_category:0,post_format:0,taxonomy:0,lang:0,nonce:0};e(document).ready(function(){acf.screen.post_id=acf.o.post_id;acf.screen.nonce=acf.o.nonce;if(e("#icl-als-first").length>0){var t=e("#icl-als-first").children("a").attr("href"),n=new RegExp("lang=([^&#]*)"),r=n.exec(t);acf.screen.lang=r[1]}});e(document).on("acf/update_field_groups",function(){if(!acf.screen.post_id||!e.isNumeric(acf.screen.post_id))return!1;e.ajax({url:ajaxurl,data:acf.screen,type:"post",dataType:"json",success:function(t){if(!t)return!1;e(".acf_postbox").addClass("acf-hidden");e(".acf_postbox-toggle").addClass("acf-hidden");if(t.length==0)return!1;e.each(t,function(t,n){var r=e("#acf_"+n),i=e('#adv-settings .acf_postbox-toggle[for="acf_'+n+'-hide"]');r.removeClass("acf-hidden hide-if-js");i.removeClass("acf-hidden");i.find('input[type="checkbox"]').attr("checked","checked");r.find(".acf-replace-with-fields").each(function(){var t=e(this);e.ajax({url:ajaxurl,data:{action:"acf/post/render_fields",acf_id:n,post_id:acf.o.post_id,nonce:acf.o.nonce},type:"post",dataType:"html",success:function(n){t.replaceWith(n);e(document).trigger("acf/setup_fields",r)}})})});e.ajax({url:ajaxurl,data:{action:"acf/post/get_style",acf_id:t[0],nonce:acf.o.nonce},type:"post",dataType:"html",success:function(t){e("#acf_style").html(t)}})}})});e(document).on("change","#page_template",function(){acf.screen.page_template=e(this).val();e(document).trigger("acf/update_field_groups")});e(document).on("change","#parent_id",function(){var t=e(this).val();if(t!=""){acf.screen.page_type="child";acf.screen.page_parent=t}else{acf.screen.page_type="parent";acf.screen.page_parent=0}e(document).trigger("acf/update_field_groups")});e(document).on("change",'#post-formats-select input[type="radio"]',function(){var t=e(this).val();t=="0"&&(t="standard");acf.screen.post_format=t;e(document).trigger("acf/update_field_groups")});e(document).on("change",".categorychecklist input, .acf-taxonomy-field input, .acf-taxonomy-field select",function(){if(e(this).closest(".acf-taxonomy-field").exists()&&e(this).closest(".acf-taxonomy-field").attr("data-save")=="0")return;if(e(this).closest(".media-frame").exists())return;setTimeout(function(){t()},1)})})(jQuery);(function(e){var t=acf.fields.color_picker={$el:null,$input:null,set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="text"]');return this},init:function(){var e=this.$input;if(acf.helpers.is_clone_field(e))return;this.$input.wpColorPicker()}};e(document).on("acf/setup_fields",function(n,r){e(r).find(".acf-color_picker").each(function(){t.set({$el:e(this)}).init()})})})(jQuery);(function(e){acf.fields.date_picker={$el:null,$input:null,$hidden:null,o:{},set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="text"]');this.$hidden=this.$el.find('input[type="hidden"]');this.o=acf.helpers.get_atts(this.$el);return this},init:function(){if(acf.helpers.is_clone_field(this.$hidden))return;this.$input.val(this.$hidden.val());var t=e.extend({},acf.l10n.date_picker,{dateFormat:this.o.save_format,altField:this.$hidden,altFormat:this.o.save_format,changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.o.first_day});this.$input.addClass("active").datepicker(t);this.$input.datepicker("option","dateFormat",this.o.display_format);e("body > #ui-datepicker-div").length>0&&e("#ui-datepicker-div").wrap('<div class="ui-acf" />')},blur:function(){this.$input.val()||this.$hidden.val("")}};e(document).on("acf/setup_fields",function(t,n){e(n).find(".acf-date_picker").each(function(){acf.fields.date_picker.set({$el:e(this)}).init()})});e(document).on("blur",'.acf-date_picker input[type="text"]',function(t){acf.fields.date_picker.set({$el:e(this).parent()}).blur()})})(jQuery);(function(e){var t=acf.media;acf.fields.file={$el:null,$input:null,o:{},set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="hidden"]');this.o=acf.helpers.get_atts(this.$el);this.o.multiple=this.$el.closest(".repeater").exists()?!0:!1;this.o.query={};this.o.library=="uploadedTo"&&(this.o.query.uploadedTo=acf.o.post_id);return this},init:function(){if(acf.helpers.is_clone_field(this.$input))return},add:function(e){var n=t.div;n.find(".acf-file-icon").attr("src",e.icon);n.find(".acf-file-title").text(e.title);n.find(".acf-file-name").text(e.name).attr("href",e.url);n.find(".acf-file-size").text(e.size);n.find(".acf-file-value").val(e.id).trigger("change");n.addClass("active");n.closest(".field").removeClass("error")},edit:function(){var n=this.$input.val();t.div=this.$el;t.clear_frame();t.frame=wp.media({title:acf.l10n.file.edit,multiple:!1,button:{text:acf.l10n.file.update}});t.frame.on("open",function(){t.frame.content._mode!="browse"&&t.frame.content.mode("browse");t.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var r=t.frame.state().get("selection"),i=wp.media.attachment(n);e.isEmptyObject(i.changed)&&i.fetch();r.add(i)});t.frame.on("close",function(){t.frame.$el.closest(".media-modal").removeClass("acf-media-modal")});acf.media.frame.open()},remove:function(){this.$el.find(".acf-file-icon").attr("src","");this.$el.find(".acf-file-title").text("");this.$el.find(".acf-file-name").text("").attr("href","");this.$el.find(".acf-file-size").text("");this.$el.find(".acf-file-value").val("").trigger("change");this.$el.removeClass("active")},popup:function(){var n=this;t.div=this.$el;t.clear_frame();t.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(n.o.query),multiple:n.o.multiple,title:acf.l10n.file.select,priority:20,filterable:"all"})]});acf.media.frame.on("content:activate",function(){var t=null,r=null;try{t=acf.media.frame.content.get().toolbar;r=t.get("filters")}catch(i){}if(!r)return!1;if(n.o.library=="uploadedTo"){r.$el.find('option[value="uploaded"]').remove();r.$el.after("<span>"+acf.l10n.file.uploadedTo+"</span>");e.each(r.filters,function(e,t){t.props.uploadedTo=acf.o.post_id})}});acf.media.frame.on("select",function(){selection=t.frame.state().get("selection");if(selection){var e=0;selection.each(function(n){e++;if(e>1){var r=t.div.closest("td"),s=r.closest(".row"),o=s.closest(".repeater"),u=r.attr("data-field_key"),a="td .acf-file-uploader:first";u&&(a='td[data-field_key="'+u+'"] .acf-file-uploader');s.next(".row").exists()||o.find(".add-row-end").trigger("click");t.div=s.next(".row").find(a)}var f={id:n.id,title:n.attributes.title,name:n.attributes.filename,url:n.attributes.url,icon:n.attributes.icon,size:n.attributes.filesize};acf.fields.file.add(f)})}});acf.media.frame.open();return!1}};e(document).on("click",".acf-file-uploader .acf-button-edit",function(t){t.preventDefault();acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).edit()});e(document).on("click",".acf-file-uploader .acf-button-delete",function(t){t.preventDefault();acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).remove()});e(document).on("click",".acf-file-uploader .add-file",function(t){t.preventDefault();acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).popup()})})(jQuery);(function(e){acf.fields.google_map={$el:null,$input:null,o:{},ready:!1,geocoder:!1,map:!1,maps:{},set:function(t){e.extend(this,t);this.$input=this.$el.find(".value");this.o=acf.helpers.get_atts(this.$el);this.maps[this.o.id]&&(this.map=this.maps[this.o.id]);return this},init:function(){this.geocoder||(this.geocoder=new google.maps.Geocoder);this.ready=!0;if(acf.helpers.is_clone_field(this.$input))return;this.render()},render:function(){var e=this,t=this.$el,n={zoom:parseInt(this.o.zoom),center:new google.maps.LatLng(this.o.lat,this.o.lng),mapTypeId:google.maps.MapTypeId.ROADMAP};this.map=new google.maps.Map(this.$el.find(".canvas")[0],n);var r=new google.maps.places.Autocomplete(this.$el.find(".search")[0]);r.map=this.map;r.bindTo("bounds",this.map);this.map.marker=new google.maps.Marker({draggable:!0,raiseOnDrag:!0,map:this.map});this.map.$el=this.$el;var i=this.$el.find(".input-lat").val(),s=this.$el.find(".input-lng").val();i&&s&&this.update(i,s).center();google.maps.event.addListener(r,"place_changed",function(t){var n=this.map.$el,r=n.find(".search").val();n.find(".input-address").val(r);n.find(".title h4").text(r);var i=this.getPlace();if(i.geometry){var s=i.geometry.location.lat(),o=i.geometry.location.lng();e.set({$el:n}).update(s,o).center()}else e.geocoder.geocode({address:r},function(t,r){if(r!=google.maps.GeocoderStatus.OK){console.log("Geocoder failed due to: "+r);return}if(!t[0]){console.log("No results found");return}i=t[0];var s=i.geometry.location.lat(),o=i.geometry.location.lng();e.set({$el:n}).update(s,o).center()})});google.maps.event.addListener(this.map.marker,"dragend",function(){var t=this.map.$el,n=this.map.marker.getPosition(),r=n.lat(),i=n.lng();e.set({$el:t}).update(r,i).sync()});google.maps.event.addListener(this.map,"click",function(t){var n=this.$el,r=t.latLng.lat(),i=t.latLng.lng();e.set({$el:n}).update(r,i).sync()});this.maps[this.o.id]=this.map},update:function(e,t){var n=new google.maps.LatLng(e,t);this.$el.find(".input-lat").val(e);this.$el.find(".input-lng").val(t).trigger("change");this.map.marker.setPosition(n);this.map.marker.setVisible(!0);this.$el.addClass("active");this.$el.closest(".field").removeClass("error");return this},center:function(){var e=this.map.marker.getPosition(),t=this.o.lat,n=this.o.lng;if(e){t=e.lat();n=e.lng()}var r=new google.maps.LatLng(t,n);this.map.setCenter(r)},sync:function(){var e=this.$el,t=this.map.marker.getPosition(),n=new google.maps.LatLng(t.lat(),t.lng());this.geocoder.geocode({latLng:n},function(t,n){if(n!=google.maps.GeocoderStatus.OK){console.log("Geocoder failed due to: "+n);return}if(!t[0]){console.log("No results found");return}var r=t[0];e.find(".title h4").text(r.formatted_address);e.find(".input-address").val(r.formatted_address).trigger("change")});return this},locate:function(){var e=this,t=this.$el;if(!navigator.geolocation){alert(acf.l10n.google_map.browser_support);return this}t.find(".title h4").text(acf.l10n.google_map.locating+"...");t.addClass("active");navigator.geolocation.getCurrentPosition(function(n){var r=n.coords.latitude,i=n.coords.longitude;e.set({$el:t}).update(r,i).sync().center()})},clear:function(){this.$el.removeClass("active");this.$el.find(".search").val("");this.$el.find(".input-address").val("");this.$el.find(".input-lat").val("");this.$el.find(".input-lng").val("");this.map.marker.setVisible(!1)},edit:function(){this.$el.removeClass("active");var e=this.$el.find(".title h4").text();this.$el.find(".search").val(e).focus()},refresh:function(){google.maps.event.trigger(this.map,"resize");this.center()}};e(document).on("acf/setup_fields",function(t,n){$fields=e(n).find(".acf-google-map");if(!$fields.exists())return;typeof google=="undefined"?e.getScript("https://www.google.com/jsapi",function(){google.load("maps","3",{other_params:"sensor=false&libraries=places",callback:function(){$fields.each(function(){acf.fields.google_map.set({$el:e(this)}).init()})}})}):$fields.each(function(){acf.fields.google_map.set({$el:e(this)}).init()})});e(document).on("click",".acf-google-map .acf-sprite-remove",function(t){t.preventDefault();acf.fields.google_map.set({$el:e(this).closest(".acf-google-map")}).clear();e(this).blur()});e(document).on("click",".acf-google-map .acf-sprite-locate",function(t){t.preventDefault();acf.fields.google_map.set({$el:e(this).closest(".acf-google-map")}).locate();e(this).blur()});e(document).on("click",".acf-google-map .title h4",function(t){t.preventDefault();acf.fields.google_map.set({$el:e(this).closest(".acf-google-map")}).edit()});e(document).on("keydown",".acf-google-map .search",function(e){if(e.which==13)return!1});e(document).on("blur",".acf-google-map .search",function(t){var n=e(this).closest(".acf-google-map");n.find(".input-lat").val()&&n.addClass("active")});e(document).on("acf/fields/tab/show acf/conditional_logic/show",function(e,t){if(!acf.fields.google_map.ready)return;t.attr("data-field_type")=="google_map"&&acf.fields.google_map.set({$el:t.find(".acf-google-map")}).refresh()})})(jQuery);(function(e){var t=acf.media;acf.fields.image={$el:null,$input:null,o:{},set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="hidden"]');this.o=acf.helpers.get_atts(this.$el);this.o.multiple=this.$el.closest(".repeater").exists()?!0:!1;this.o.query={type:"image"};this.o.library=="uploadedTo"&&(this.o.query.uploadedTo=acf.o.post_id);return this},init:function(){if(acf.helpers.is_clone_field(this.$input))return},add:function(e){var n=t.div;n.find(".acf-image-image").attr("src",e.url);n.find(".acf-image-value").val(e.id).trigger("change");n.addClass("active");n.closest(".field").removeClass("error")},edit:function(){var n=this.$input.val();t.div=this.$el;t.clear_frame();t.frame=wp.media({title:acf.l10n.image.edit,multiple:!1,button:{text:acf.l10n.image.update}});t.frame.on("open",function(){t.frame.content._mode!="browse"&&t.frame.content.mode("browse");t.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var r=t.frame.state().get("selection"),i=wp.media.attachment(n);e.isEmptyObject(i.changed)&&i.fetch();r.add(i)});t.frame.on("close",function(){t.frame.$el.closest(".media-modal").removeClass("acf-media-modal")});acf.media.frame.open()},remove:function(){this.$el.find(".acf-image-image").attr("src","");this.$el.find(".acf-image-value").val("").trigger("change");this.$el.removeClass("active")},popup:function(){var n=this;t.div=this.$el;t.clear_frame();t.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(n.o.query),multiple:n.o.multiple,title:acf.l10n.image.select,priority:20,filterable:"all"})]});acf.media.frame.on("content:activate",function(){var t=null,r=null;try{t=acf.media.frame.content.get().toolbar;r=t.get("filters")}catch(i){}if(!r)return!1;e.each(r.filters,function(e,t){t.props.type="image"});if(n.o.library=="uploadedTo"){r.$el.find('option[value="uploaded"]').remove();r.$el.after("<span>"+acf.l10n.image.uploadedTo+"</span>");e.each(r.filters,function(e,t){t.props.uploadedTo=acf.o.post_id})}r.$el.find("option").each(function(){var t=e(this).attr("value");if(t=="uploaded"&&n.o.library=="all")return;t.indexOf("image")===-1&&e(this).remove()});r.$el.val("image").trigger("change")});acf.media.frame.on("select",function(){selection=t.frame.state().get("selection");if(selection){var e=0;selection.each(function(r){e++;if(e>1){var s=t.div.closest("td"),o=s.closest(".row"),u=o.closest(".repeater"),a=s.attr("data-field_key"),f="td .acf-image-uploader:first";a&&(f='td[data-field_key="'+a+'"] .acf-image-uploader');o.next(".row").exists()||u.find(".add-row-end").trigger("click");t.div=o.next(".row").find(f)}var l={id:r.id,url:r.attributes.url};r.attributes.sizes&&r.attributes.sizes[n.o.preview_size]&&(l.url=r.attributes.sizes[n.o.preview_size].url);acf.fields.image.add(l)})}});acf.media.frame.open();return!1},text:{title_add:"Select Image",title_edit:"Edit Image"}};e(document).on("click",".acf-image-uploader .acf-button-edit",function(t){t.preventDefault();acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).edit()});e(document).on("click",".acf-image-uploader .acf-button-delete",function(t){t.preventDefault();acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).remove()});e(document).on("click",".acf-image-uploader .add-image",function(t){t.preventDefault();acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).popup()})})(jQuery);(function(e){acf.fields.radio={$el:null,$input:null,$other:null,farbtastic:null,set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="radio"]:checked');this.$other=this.$el.find('input[type="text"]');return this},change:function(){if(this.$input.val()=="other"){this.$other.attr("name",this.$input.attr("name"));this.$other.show()}else{this.$other.attr("name","");this.$other.hide()}}};e(document).on("change",'.acf-radio-list input[type="radio"]',function(t){acf.fields.radio.set({$el:e(this).closest(".acf-radio-list")}).change()})})(jQuery);(function(e){acf.fields.relationship={$el:null,$input:null,$left:null,$right:null,o:{},timeout:null,set:function(t){e.extend(this,t);this.$input=this.$el.children('input[type="hidden"]');this.$left=this.$el.find(".relationship_left"),this.$right=this.$el.find(".relationship_right");this.o=acf.helpers.get_atts(this.$el);return this},init:function(){var t=this;if(acf.helpers.is_clone_field(this.$input))return;this.$right.find(".relationship_list").height(this.$left.height()-2);this.$right.find(".relationship_list").sortable({axis:"y",items:"> li",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,update:function(){t.$input.trigger("change")}});var n=this.$el;this.$left.find(".relationship_list").scrollTop(0).on("scroll",function(r){if(n.hasClass("loading")||n.hasClass("no-results"))return;if(e(this).scrollTop()+e(this).innerHeight()>=e(this).get(0).scrollHeight){var i=parseInt(n.attr("data-paged"));n.attr("data-paged",i+1);t.set({$el:n}).fetch()}});this.fetch()},fetch:function(){var t=this,n=this.$el;n.addClass("loading");e.ajax({url:acf.o.ajaxurl,type:"post",dataType:"json",data:e.extend({action:"acf/fields/relationship/query_posts",post_id:acf.o.post_id,nonce:acf.o.nonce},this.o),success:function(e){t.set({$el:n}).render(e)}})},render:function(t){var n=this;this.$el.removeClass("no-results").removeClass("loading");this.o.paged==1&&this.$el.find(".relationship_left li:not(.load-more)").remove();if(!t||!t.html){this.$el.addClass("no-results");return}this.$el.find(".relationship_left .load-more").before(t.html);t.next_page_exists||this.$el.addClass("no-results");this.$left.find("a").each(function(){var t=e(this).attr("data-post_id");n.$right.find('a[data-post_id="'+t+'"]').exists()&&e(this).parent().addClass("hide")})},add:function(e){var t=e.attr("data-post_id"),n=e.html();if(this.$right.find("a").length>=this.o.max){alert(acf.l10n.relationship.max.replace("{max}",this.o.max));return!1}if(e.parent().hasClass("hide"))return!1;e.parent().addClass("hide");var r={post_id:e.attr("data-post_id"),title:e.html(),name:this.$input.attr("name")},i=_.template(acf.l10n.relationship.tmpl_li,r);this.$right.find(".relationship_list").append(i);this.$input.trigger("change");this.$el.closest(".field").removeClass("error")},remove:function(e){e.parent().remove();this.$left.find('a[data-post_id="'+e.attr("data-post_id")+'"]').parent("li").removeClass("hide");this.$input.trigger("change")}};e(document).on("acf/setup_fields",function(t,n){e(n).find(".acf_relationship").each(function(){acf.fields.relationship.set({$el:e(this)}).init()})});e(document).on("change",".acf_relationship .select-post_type",function(t){var n=e(this).val(),r=e(this).closest(".acf_relationship");r.attr("data-post_type",n);r.attr("data-paged",1);acf.fields.relationship.set({$el:r}).fetch()});e(document).on("click",".acf_relationship .relationship_left .relationship_list a",function(t){t.preventDefault();acf.fields.relationship.set({$el:e(this).closest(".acf_relationship")}).add(e(this));e(this).blur()});e(document).on("click",".acf_relationship .relationship_right .relationship_list a",function(t){t.preventDefault();acf.fields.relationship.set({$el:e(this).closest(".acf_relationship")}).remove(e(this));e(this).blur()});e(document).on("keyup",".acf_relationship input.relationship_search",function(t){var n=e(this).val(),r=e(this).closest(".acf_relationship");r.attr("data-s",n);r.attr("data-paged",1);clearTimeout(acf.fields.relationship.timeout);acf.fields.relationship.timeout=setTimeout(function(){acf.fields.relationship.set({$el:r}).fetch()},500)});e(document).on("keypress",".acf_relationship input.relationship_search",function(e){e.which==13&&e.preventDefault()})})(jQuery);(function(e){acf.fields.tab={add_group:function(e){var t="";e.is("tbody")?t='<tr class="acf-tab-wrap"><td colspan="2"><ul class="hl clearfix acf-tab-group"></ul></td></tr>':t='<div class="acf-tab-wrap"><ul class="hl clearfix acf-tab-group"></ul></div>';e.children(".field_type-tab:first").before(t)},add_tab:function(e){var t=e.closest(".field"),n=t.parent(),r=t.attr("data-field_key"),i=e.text();n.children(".acf-tab-wrap").exists()||this.add_group(n);n.children(".acf-tab-wrap").find(".acf-tab-group").append('<li><a class="acf-tab-button" href="#" data-key="'+r+'">'+i+"</a></li>")},toggle:function(t){var n=this,r=t.closest(".acf-tab-wrap").parent(),i=t.attr("data-key");t.parent("li").addClass("active").siblings("li").removeClass("active");r.children(".field_type-tab").each(function(){var t=e(this);t.attr("data-field_key")==i?n.show_tab_fields(e(this)):n.hide_tab_fields(e(this))})},show_tab_fields:function(t){t.nextUntil(".field_type-tab").each(function(){e(this).removeClass("acf-tab_group-hide").addClass("acf-tab_group-show");e(document).trigger("acf/fields/tab/show",[e(this)])})},hide_tab_fields:function(t){t.nextUntil(".field_type-tab").each(function(){e(this).removeClass("acf-tab_group-show").addClass("acf-tab_group-hide");e(document).trigger("acf/fields/tab/hide",[e(this)])})},refresh:function(t){var n=this;t.find(".acf-tab-group").each(function(){e(this).find(".acf-tab-button:first").each(function(){n.toggle(e(this))})})}};e(document).on("acf/setup_fields",function(t,n){e(n).find(".acf-tab").each(function(){acf.fields.tab.add_tab(e(this))});acf.fields.tab.refresh(e(n))});e(document).on("click",".acf-tab-button",function(t){t.preventDefault();acf.fields.tab.toggle(e(this));e(this).trigger("blur")});e(document).on("acf/conditional_logic/hide",function(e,t,n){if(t.attr("data-field_type")!="tab")return;var r=t.siblings(".acf-tab-wrap").find('a[data-key="'+t.attr("data-field_key")+'"]');if(r.is(":hidden"))return;r.parent().hide();r.parent().siblings(":visible").exists()?r.parent().siblings(":visible").first().children("a").trigger("click"):acf.fields.tab.hide_tab_fields(t)});e(document).on("acf/conditional_logic/show",function(e,t,n){if(t.attr("data-field_type")!="tab")return;var r=t.siblings(".acf-tab-wrap").find('a[data-key="'+t.attr("data-field_key")+'"]');if(r.is(":visible"))return;r.parent().show();if(r.parent().hasClass("active")){r.trigger("click");return}if(r.parent().siblings(".active").is(":hidden")){r.trigger("click");return}})})(jQuery);(function(e){acf.validation={status:!0,disabled:!1,run:function(){var t=this;t.status=!0;e(".field.required, .form-field.required").each(function(){t.validate(e(this))})},validate:function(t){var n=!1,r=null;t.data("validation",!0);if(t.is(":hidden")){n=!0;if(t.hasClass("acf-tab_group-hide")){n=!1;var i=t.prevAll(".field_type-tab:first"),s=t.prevAll(".acf-tab-wrap:first");i.hasClass("acf-conditional_logic-hide")?n=!0:r=s.find('.acf-tab-button[data-key="'+i.attr("data-field_key")+'"]')}}t.hasClass("acf-conditional_logic-hide")&&(n=!0);if(n)return;t.find('input[type="text"], input[type="email"], input[type="number"], input[type="hidden"], textarea').val()==""&&t.data("validation",!1);if(t.find(".acf_wysiwyg").exists()&&typeof tinyMCE=="object"){t.data("validation",!0);var o=t.find(".wp-editor-area").attr("id"),u=tinyMCE.get(o);u&&!u.getContent()&&t.data("validation",!1)}if(t.find("select").exists()){t.data("validation",!0);(t.find("select").val()=="null"||!t.find("select").val())&&t.data("validation",!1)}if(t.find('input[type="radio"]').exists()){t.data("validation",!1);t.find('input[type="radio"]:checked').exists()&&t.data("validation",!0)}if(t.find('input[type="checkbox"]').exists()){t.data("validation",!1);t.find('input[type="checkbox"]:checked').exists()&&t.data("validation",!0)}if(t.find(".acf_relationship").exists()){t.data("validation",!1);t.find(".acf_relationship .relationship_right input").exists()&&t.data("validation",!0)}if(t.find(".repeater").exists()){t.data("validation",!1);t.find(".repeater tr.row").exists()&&t.data("validation",!0)}if(t.find(".acf-gallery").exists()){t.data("validation",!1);t.find(".acf-gallery .thumbnail").exists()&&t.data("validation",!0)}e(document).trigger("acf/validate_field",[t]);if(!t.data("validation")){this.status=!1;t.closest(".field").addClass("error");if(t.data("validation_message")){var a=t.find("p.label:first"),f=null;a.children(".acf-error-message").remove();a.append('<span class="acf-error-message"><i class="bit"></i>'+t.data("validation_message")+"</span>")}r&&r.trigger("click")}}};e(document).on("focus click",".field.required input, .field.required textarea, .field.required select",function(t){e(this).closest(".field").removeClass("error")});e(document).on("click","#save-post",function(){acf.validation.disabled=!0});e(document).on("submit","#post",function(){if(acf.validation.disabled)return!0;acf.validation.run();if(!acf.validation.status){var t=e(this);t.siblings("#message").remove();t.before('<div id="message" class="error"><p>'+acf.l10n.validation.error+"</p></div>");e("#publish").removeClass("button-primary-disabled");e("#ajax-loading").attr("style","");e("#publishing-action .spinner").hide();return!1}e(".acf_postbox.acf-hidden").remove();return!0})})(jQuery);(function(e){var t=acf.fields.wysiwyg={$el:null,$textarea:null,o:{},set:function(t){e.extend(this,t);this.$textarea=this.$el.find("textarea");this.o=acf.helpers.get_atts(this.$el);this.o.id=this.$textarea.attr("id");return this},has_tinymce:function(){var e=!1;typeof tinyMCE=="object"&&(e=!0);return e},init:function(){if(acf.helpers.is_clone_field(this.$textarea))return;var t=
14
- e.extend({},tinyMCE.settings);tinyMCE.settings.theme_advanced_buttons1="";tinyMCE.settings.theme_advanced_buttons2="";tinyMCE.settings.theme_advanced_buttons3="";tinyMCE.settings.theme_advanced_buttons4="";acf.helpers.isset(this,"toolbars",this.o.toolbar)&&e.each(this.toolbars[this.o.toolbar],function(e,t){tinyMCE.settings[e]=t});tinyMCE.execCommand("mceAddControl",!1,this.o.id);e(document).trigger("acf/wysiwyg/load",this.o.id);this.add_events();tinyMCE.settings=t;wpActiveEditor=null},add_events:function(){var t=this.o.id,n=tinyMCE.get(t);if(!n)return;var r=e("#wp-"+t+"-wrap"),i=e(n.getBody());r.on("click",function(){e(document).trigger("acf/wysiwyg/click",t)});i.on("focus",function(){e(document).trigger("acf/wysiwyg/focus",t)});i.on("blur",function(){e(document).trigger("acf/wysiwyg/blur",t)})},destroy:function(){try{var e=this.o.id,t=tinyMCE.get(e);if(t){var n=t.getContent();tinyMCE.execCommand("mceRemoveControl",!1,e);this.$textarea.val(n)}}catch(r){}wpActiveEditor=null}};e(document).on("acf/setup_fields",function(n,r){if(!t.has_tinymce())return;e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()});setTimeout(function(){e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).init()})},0)});e(document).on("acf/remove_fields",function(n,r){if(!t.has_tinymce())return;r.find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()})});e(document).on("acf/wysiwyg/click",function(t,n){wpActiveEditor=n;container=e("#wp-"+n+"-wrap").closest(".field").removeClass("error")});e(document).on("acf/wysiwyg/focus",function(t,n){wpActiveEditor=n;container=e("#wp-"+n+"-wrap").closest(".field").removeClass("error")});e(document).on("acf/wysiwyg/blur",function(t,n){wpActiveEditor=null;var r=tinyMCE.get(n);if(!r)return;var i=r.getElement();r.save();e(i).trigger("change")});e(document).on("acf/sortable_start",function(n,r){if(!t.has_tinymce())return;e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()})});e(document).on("acf/sortable_stop",function(n,r){if(!t.has_tinymce())return;e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).init()})});e(window).load(function(){if(!t.has_tinymce())return;var n=e("#wp-content-wrap").exists(),r=e("#wp-acf_settings-wrap").exists();mode="tmce";r&&e("#wp-acf_settings-wrap").hasClass("html-active")&&(mode="html");setTimeout(function(){r&&mode=="html"&&e("#acf_settings-tmce").trigger("click")},1);setTimeout(function(){r&&mode=="html"&&e("#acf_settings-html").trigger("click");n&&t.set({$el:e("#wp-content-wrap")}).add_events()},11)});e(document).on("click",".acf_wysiwyg a.mce_fullscreen",function(){var t=e(this).closest(".acf_wysiwyg"),n=t.attr("data-upload");n=="no"&&e("#mce_fullscreen_container td.mceToolbar .mce_add_media").remove()})})(jQuery);
1
+ var acf={ajaxurl:"",admin_url:"",wp_version:"",post_id:0,nonce:"",l10n:null,o:null,helpers:{get_atts:null,version_compare:null,uniqid:null,sortable:null,add_message:null,is_clone_field:null,url_to_object:null},validation:null,conditional_logic:null,media:null,fields:{date_picker:null,color_picker:null,Image:null,file:null,wysiwyg:null,gallery:null,relationship:null}};!function(e){acf.helpers.isset=function(){var e=arguments,t=e.length,a=null,n;if(0===t)throw new Error("Empty isset");for(a=e[0],i=1;t>i;i++){if(e[i]===n||a[e[i]]===n)return!1;a=a[e[i]]}return!0},acf.helpers.get_atts=function(t){var i={};return e.each(t[0].attributes,function(e,t){"data-"==t.name.substr(0,5)&&(i[t.name.replace("data-","")]=t.value)}),i},acf.helpers.version_compare=function(e,t){if(typeof e+typeof t!="stringstring")return!1;for(var i=e.split("."),a=t.split("."),n=0,s=Math.max(i.length,a.length);s>n;n++){if(i[n]&&!a[n]&&parseInt(i[n])>0||parseInt(i[n])>parseInt(a[n]))return 1;if(a[n]&&!i[n]&&parseInt(a[n])>0||parseInt(i[n])<parseInt(a[n]))return-1}return 0},acf.helpers.uniqid=function(){var e=new Date;return e.getTime()},acf.helpers.url_to_object=function(e){var t={},a=e.split("&");for(i in a){var n=a[i].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t},acf.helpers.sortable=function(t,i){return i.children().each(function(){e(this).width(e(this).width())}),i},acf.helpers.is_clone_field=function(e){return e.attr("name")&&-1!=e.attr("name").indexOf("[acfcloneindex]")?!0:!1},acf.helpers.add_message=function(t,i){var t=e('<div class="acf-message-wrapper"><div class="message updated"><p>'+t+"</p></div></div>");i.prepend(t),setTimeout(function(){t.animate({opacity:0},250,function(){t.remove()})},1500)},e.fn.exists=function(){return e(this).length>0},acf.media={div:null,frame:null,render_timout:null,clear_frame:function(){this.frame&&(this.frame.detach(),this.frame.dispose(),this.frame=null)},type:function(){var e="thickbox";return"undefined"!=typeof wp&&(e="backbone"),e},init:function(){if("backbone"!==this.type())return!1;if(!acf.helpers.isset(wp,"media","view","AttachmentCompat","prototype"))return!1;var t=wp.media.view.AttachmentCompat.prototype;t.orig_render=t.render,t.orig_dispose=t.dispose,t.className="compat-item acf_postbox no_box",t.render=function(){var t=this;return t.ignore_render?this:(this.orig_render(),setTimeout(function(){var i=t.$el.closest(".media-modal");if(!i.hasClass("acf-media-modal")&&!i.find(".media-frame-router .acf-expand-details").exists()){var a=e(['<a href="#" class="acf-expand-details">','<span class="icon"></span>','<span class="is-closed">'+acf.l10n.core.expand_details+"</span>",'<span class="is-open">'+acf.l10n.core.collapse_details+"</span>","</a>"].join(""));a.on("click",function(e){e.preventDefault(),i.hasClass("acf-expanded")?i.removeClass("acf-expanded"):i.addClass("acf-expanded")}),i.find(".media-frame-router").append(a)}},0),clearTimeout(acf.media.render_timout),acf.media.render_timout=setTimeout(function(){e(document).trigger("acf/setup_fields",[t.$el])},50),this)},t.dispose=function(){e(document).trigger("acf/remove_fields",[this.$el]),this.orig_dispose()},t.save=function(e){var t={},i={};e&&e.preventDefault(),_.each(this.$el.serializeArray(),function(e){"[]"===e.name.slice(-2)&&(e.name=e.name.replace("[]",""),"undefined"==typeof i[e.name]&&(i[e.name]=-1),i[e.name]++,e.name+="["+i[e.name]+"]"),t[e.name]=e.value}),this.ignore_render=!0,this.model.saveCompat(t)}}},acf.conditional_logic={items:[],init:function(){var t=this;e(document).on("change",".field input, .field textarea, .field select",function(){e("#acf-has-changed").exists()&&e("#acf-has-changed").val(1),t.change(e(this))}),e(document).on("acf/setup_fields",function(i,a){t.refresh(e(a))}),t.refresh()},change:function(t){var i=this,a=t.closest(".field"),n=a.attr("data-field_key");e.each(this.items,function(t,a){e.each(a.rules,function(e,t){t.field==n&&i.refresh_field(a)})})},refresh_field:function(t){var i=this,a=e(".field_key-"+t.field);a.each(function(){var a=!0;"any"==t.allorany&&(a=!1);var n=e(this),s=!0;e.each(t.rules,function(o,l){var r=e(".field_key-"+l.field);r.hasClass("sub_field")&&(r=n.siblings(".field_key-"+l.field),s=!1,r.exists()||(n.parents("tr").each(function(){return r=e(this).find(".field_key-"+l.field),r.exists()?!1:void 0}),s=!0));var c=n.parent("tr").parent().parent("table").parent(".layout");c.exists()&&(s=!0,n.is("th")&&r.is("th")&&(r=n.closest(".layout").find("td.field_key-"+l.field)));var c=n.parent("tr").parent().parent("table").parent(".repeater");c.exists()&&"1"==c.attr("data-max_rows")&&(s=!0,n.is("th")&&r.is("th")&&(r=n.closest("table").find("td.field_key-"+l.field)));var d=i.calculate(l,r,n);if("all"==t.allorany){if(0==d)return a=!1,!1}else if(1==d)return a=!0,!1}),n.removeClass("acf-conditional_logic-hide acf-conditional_logic-show acf-show-blank"),a?(n.find("input, textarea, select").removeAttr("disabled"),n.addClass("acf-conditional_logic-show"),e(document).trigger("acf/conditional_logic/show",[n,t])):(n.find("input, textarea, select").attr("disabled","disabled"),n.addClass("acf-conditional_logic-hide"),s||n.addClass("acf-show-blank"),e(document).trigger("acf/conditional_logic/hide",[n,t]))})},refresh:function(t){t=t||e("body");var i=this;e.each(this.items,function(a,n){e.each(n.rules,function(e,a){t.find('.field[data-field_key="'+n.field+'"]').exists()&&i.refresh_field(n)})})},calculate:function(t,i,a){var n=!1;if(i.hasClass("field_type-true_false")||i.hasClass("field_type-checkbox")||i.hasClass("field_type-radio")){var s=i.find('input[value="'+t.value+'"]:checked').exists();"=="==t.operator?s&&(n=!0):s||(n=!0)}else{var o=i.find("input, textarea, select").last().val();e.isArray(o)||(o=[o]),"=="==t.operator?e.inArray(t.value,o)>-1&&(n=!0):e.inArray(t.value,o)<0&&(n=!0)}return n}},e(document).ready(function(){acf.conditional_logic.init(),e(".acf_postbox > .inside > .options").each(function(){e(this).closest(".acf_postbox").addClass(e(this).attr("data-layout"))}),e('#metakeyselect option[value^="field_"]').remove()}),e(window).load(function(){acf.media.init(),setTimeout(function(){try{e.isNumeric(acf.o.post_id)&&(wp.media.view.settings.post.id=acf.o.post_id)}catch(t){}e(document).trigger("acf/setup_fields",[e("#poststuff")])},10)}),acf.fields.gallery={add:function(){},edit:function(){},update_count:function(){},hide_selected_items:function(){},text:{title_add:"Select Images"}}}(jQuery),function(e){function t(){var t=[];e(".categorychecklist input:checked, .acf-taxonomy-field input:checked, .acf-taxonomy-field option:selected").each(function(){e(this).is(":hidden")||e(this).is(":disabled")||e(this).closest(".media-frame").exists()||e(this).closest(".acf-taxonomy-field").exists()&&"0"==e(this).closest(".acf-taxonomy-field").attr("data-save")||-1===t.indexOf(e(this).val())&&t.push(e(this).val())}),acf.screen.post_category=t,acf.screen.taxonomy=t,e(document).trigger("acf/update_field_groups")}acf.screen={action:"acf/location/match_field_groups_ajax",post_id:0,page_template:0,page_parent:0,page_type:0,post_category:0,post_format:0,taxonomy:0,lang:0,nonce:0},e(document).ready(function(){if(acf.screen.post_id=acf.o.post_id,acf.screen.nonce=acf.o.nonce,e("#icl-als-first").length>0){var t=e("#icl-als-first").children("a").attr("href"),i=new RegExp("lang=([^&#]*)"),a=i.exec(t);acf.screen.lang=a[1]}}),e(document).on("acf/update_field_groups",function(){return acf.screen.post_id&&e.isNumeric(acf.screen.post_id)?void e.ajax({url:ajaxurl,data:acf.screen,type:"post",dataType:"json",success:function(t){return t?(e(".acf_postbox").addClass("acf-hidden"),e(".acf_postbox-toggle").addClass("acf-hidden"),0==t.length?!1:(e.each(t,function(t,i){var a=e("#acf_"+i),n=e('#adv-settings .acf_postbox-toggle[for="acf_'+i+'-hide"]');a.removeClass("acf-hidden hide-if-js"),n.removeClass("acf-hidden"),n.find('input[type="checkbox"]').attr("checked","checked"),a.find(".acf-replace-with-fields").each(function(){var t=e(this);e.ajax({url:ajaxurl,data:{action:"acf/post/render_fields",acf_id:i,post_id:acf.o.post_id,nonce:acf.o.nonce},type:"post",dataType:"html",success:function(i){t.replaceWith(i),e(document).trigger("acf/setup_fields",a)}})})}),void e.ajax({url:ajaxurl,data:{action:"acf/post/get_style",acf_id:t[0],nonce:acf.o.nonce},type:"post",dataType:"html",success:function(t){e("#acf_style").html(t)}}))):!1}}):!1}),e(document).on("change","#page_template",function(){acf.screen.page_template=e(this).val(),e(document).trigger("acf/update_field_groups")}),e(document).on("change","#parent_id",function(){var t=e(this).val();""!=t?(acf.screen.page_type="child",acf.screen.page_parent=t):(acf.screen.page_type="parent",acf.screen.page_parent=0),e(document).trigger("acf/update_field_groups")}),e(document).on("change",'#post-formats-select input[type="radio"]',function(){var t=e(this).val();"0"==t&&(t="standard"),acf.screen.post_format=t,e(document).trigger("acf/update_field_groups")}),e(document).on("change",".categorychecklist input, .acf-taxonomy-field input, .acf-taxonomy-field select",function(){e(this).closest(".acf-taxonomy-field").exists()&&"0"==e(this).closest(".acf-taxonomy-field").attr("data-save")||e(this).closest(".media-frame").exists()||setTimeout(function(){t()},1)})}(jQuery),function(e){var t=acf.fields.color_picker={$el:null,$input:null,set:function(t){return e.extend(this,t),this.$input=this.$el.find('input[type="text"]'),this},init:function(){var e=this.$input;acf.helpers.is_clone_field(e)||this.$input.wpColorPicker()}};e(document).on("acf/setup_fields",function(i,a){e(a).find(".acf-color_picker").each(function(){t.set({$el:e(this)}).init()})})}(jQuery),function(e){acf.fields.date_picker={$el:null,$input:null,$hidden:null,o:{},set:function(t){return e.extend(this,t),this.$input=this.$el.find('input[type="text"]'),this.$hidden=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this},init:function(){if(!acf.helpers.is_clone_field(this.$hidden)){this.$input.val(this.$hidden.val());var t=e.extend({},acf.l10n.date_picker,{dateFormat:this.o.save_format,altField:this.$hidden,altFormat:this.o.save_format,changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.o.first_day});this.$input.addClass("active").datepicker(t),this.$input.datepicker("option","dateFormat",this.o.display_format),e("body > #ui-datepicker-div").length>0&&e("#ui-datepicker-div").wrap('<div class="ui-acf" />')}},blur:function(){this.$input.val()||this.$hidden.val("")}},e(document).on("acf/setup_fields",function(t,i){e(i).find(".acf-date_picker").each(function(){acf.fields.date_picker.set({$el:e(this)}).init()})}),e(document).on("blur",'.acf-date_picker input[type="text"]',function(t){acf.fields.date_picker.set({$el:e(this).parent()}).blur()})}(jQuery),function(e){var t=acf.media;acf.fields.file={$el:null,$input:null,o:{},set:function(t){return e.extend(this,t),this.$input=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this.o.multiple=this.$el.closest(".repeater").exists()?!0:!1,this.o.query={},"uploadedTo"==this.o.library&&(this.o.query.uploadedTo=acf.o.post_id),this},init:function(){acf.helpers.is_clone_field(this.$input)},add:function(e){var i=t.div;i.find(".acf-file-icon").attr("src",e.icon),i.find(".acf-file-title").text(e.title),i.find(".acf-file-name").text(e.name).attr("href",e.url),i.find(".acf-file-size").text(e.size),i.find(".acf-file-value").val(e.id).trigger("change"),i.addClass("active"),i.closest(".field").removeClass("error")},edit:function(){var i=this.$input.val();t.div=this.$el,t.clear_frame(),t.frame=wp.media({title:acf.l10n.file.edit,multiple:!1,button:{text:acf.l10n.file.update}}),t.frame.on("open",function(){"browse"!=t.frame.content._mode&&t.frame.content.mode("browse"),t.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var a=t.frame.state().get("selection"),n=wp.media.attachment(i);e.isEmptyObject(n.changed)&&n.fetch(),a.add(n)}),t.frame.on("close",function(){t.frame.$el.closest(".media-modal").removeClass("acf-media-modal")}),acf.media.frame.open()},remove:function(){this.$el.find(".acf-file-icon").attr("src",""),this.$el.find(".acf-file-title").text(""),this.$el.find(".acf-file-name").text("").attr("href",""),this.$el.find(".acf-file-size").text(""),this.$el.find(".acf-file-value").val("").trigger("change"),this.$el.removeClass("active")},popup:function(){var i=this;return t.div=this.$el,t.clear_frame(),t.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(i.o.query),multiple:i.o.multiple,title:acf.l10n.file.select,priority:20,filterable:"all"})]}),acf.media.frame.on("content:activate",function(){var t=null,a=null;try{t=acf.media.frame.content.get().toolbar,a=t.get("filters")}catch(n){}return a?void("uploadedTo"==i.o.library&&(a.$el.find('option[value="uploaded"]').remove(),a.$el.after("<span>"+acf.l10n.file.uploadedTo+"</span>"),e.each(a.filters,function(e,t){t.props.uploadedTo=acf.o.post_id}))):!1}),acf.media.frame.on("select",function(){if(selection=t.frame.state().get("selection")){var e=0;selection.each(function(i){if(e++,e>1){var a=t.div.closest("td"),n=a.closest(".row"),s=n.closest(".repeater"),o=a.attr("data-field_key"),l="td .acf-file-uploader:first";o&&(l='td[data-field_key="'+o+'"] .acf-file-uploader'),n.next(".row").exists()||s.find(".add-row-end").trigger("click"),t.div=n.next(".row").find(l)}var r={id:i.id,title:i.attributes.title,name:i.attributes.filename,url:i.attributes.url,icon:i.attributes.icon,size:i.attributes.filesize};acf.fields.file.add(r)})}}),acf.media.frame.open(),!1}},e(document).on("click",".acf-file-uploader .acf-button-edit",function(t){t.preventDefault(),acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).edit()}),e(document).on("click",".acf-file-uploader .acf-button-delete",function(t){t.preventDefault(),acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).remove()}),e(document).on("click",".acf-file-uploader .add-file",function(t){t.preventDefault(),acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).popup()})}(jQuery),function(e){acf.fields.google_map={$el:null,$input:null,o:{},ready:!1,geocoder:!1,map:!1,maps:{},set:function(t){return e.extend(this,t),this.$input=this.$el.find(".value"),this.o=acf.helpers.get_atts(this.$el),this.maps[this.o.id]&&(this.map=this.maps[this.o.id]),this},init:function(){this.geocoder||(this.geocoder=new google.maps.Geocoder),this.ready=!0,acf.helpers.is_clone_field(this.$input)||this.render()},render:function(){var e=this,t=this.$el,i={zoom:parseInt(this.o.zoom),center:new google.maps.LatLng(this.o.lat,this.o.lng),mapTypeId:google.maps.MapTypeId.ROADMAP};this.map=new google.maps.Map(this.$el.find(".canvas")[0],i);var a=new google.maps.places.Autocomplete(this.$el.find(".search")[0]);a.map=this.map,a.bindTo("bounds",this.map),this.map.marker=new google.maps.Marker({draggable:!0,raiseOnDrag:!0,map:this.map}),this.map.$el=this.$el;var n=this.$el.find(".input-lat").val(),s=this.$el.find(".input-lng").val();n&&s&&this.update(n,s).center(),google.maps.event.addListener(a,"place_changed",function(t){var i=this.map.$el,a=i.find(".search").val();i.find(".input-address").val(a),i.find(".title h4").text(a);var n=this.getPlace();if(n.geometry){var s=n.geometry.location.lat(),o=n.geometry.location.lng();e.set({$el:i}).update(s,o).center()}else e.geocoder.geocode({address:a},function(t,a){if(a!=google.maps.GeocoderStatus.OK)return void console.log("Geocoder failed due to: "+a);if(!t[0])return void console.log("No results found");n=t[0];var s=n.geometry.location.lat(),o=n.geometry.location.lng();e.set({$el:i}).update(s,o).center()})}),google.maps.event.addListener(this.map.marker,"dragend",function(){var t=this.map.$el,i=this.map.marker.getPosition(),a=i.lat(),n=i.lng();e.set({$el:t}).update(a,n).sync()}),google.maps.event.addListener(this.map,"click",function(t){var i=this.$el,a=t.latLng.lat(),n=t.latLng.lng();e.set({$el:i}).update(a,n).sync()}),this.maps[this.o.id]=this.map},update:function(e,t){var i=new google.maps.LatLng(e,t);return this.$el.find(".input-lat").val(e),this.$el.find(".input-lng").val(t).trigger("change"),this.map.marker.setPosition(i),this.map.marker.setVisible(!0),this.$el.addClass("active"),this.$el.closest(".field").removeClass("error"),this},center:function(){var e=this.map.marker.getPosition(),t=this.o.lat,i=this.o.lng;e&&(t=e.lat(),i=e.lng());var a=new google.maps.LatLng(t,i);this.map.setCenter(a)},sync:function(){var e=this.$el,t=this.map.marker.getPosition(),i=new google.maps.LatLng(t.lat(),t.lng());return this.geocoder.geocode({latLng:i},function(t,i){if(i!=google.maps.GeocoderStatus.OK)return void console.log("Geocoder failed due to: "+i);if(!t[0])return void console.log("No results found");var a=t[0];e.find(".title h4").text(a.formatted_address),e.find(".input-address").val(a.formatted_address).trigger("change")}),this},locate:function(){var e=this,t=this.$el;return navigator.geolocation?(t.find(".title h4").text(acf.l10n.google_map.locating+"..."),t.addClass("active"),void navigator.geolocation.getCurrentPosition(function(i){var a=i.coords.latitude,n=i.coords.longitude;e.set({$el:t}).update(a,n).sync().center()})):(alert(acf.l10n.google_map.browser_support),this)},clear:function(){this.$el.removeClass("active"),this.$el.find(".search").val(""),this.$el.find(".input-address").val(""),this.$el.find(".input-lat").val(""),this.$el.find(".input-lng").val(""),this.map.marker.setVisible(!1)},edit:function(){this.$el.removeClass("active");var e=this.$el.find(".title h4").text();this.$el.find(".search").val(e).focus()},refresh:function(){google.maps.event.trigger(this.map,"resize"),this.center()}},e(document).on("acf/setup_fields",function(t,i){$fields=e(i).find(".acf-google-map"),$fields.exists()&&("undefined"==typeof google?e.getScript("https://www.google.com/jsapi",function(){google.load("maps","3",{other_params:"sensor=false&libraries=places",callback:function(){$fields.each(function(){acf.fields.google_map.set({$el:e(this)}).init()})}})}):google.load("maps","3",{other_params:"sensor=false&libraries=places",callback:function(){$fields.each(function(){acf.fields.google_map.set({$el:e(this)}).init()})}}))}),e(document).on("click",".acf-google-map .acf-sprite-remove",function(t){t.preventDefault(),acf.fields.google_map.set({$el:e(this).closest(".acf-google-map")}).clear(),e(this).blur()}),e(document).on("click",".acf-google-map .acf-sprite-locate",function(t){t.preventDefault(),acf.fields.google_map.set({$el:e(this).closest(".acf-google-map")}).locate(),e(this).blur()}),e(document).on("click",".acf-google-map .title h4",function(t){t.preventDefault(),acf.fields.google_map.set({$el:e(this).closest(".acf-google-map")}).edit()}),e(document).on("keydown",".acf-google-map .search",function(e){return 13==e.which?!1:void 0}),e(document).on("blur",".acf-google-map .search",function(t){var i=e(this).closest(".acf-google-map");i.find(".input-lat").val()&&i.addClass("active")}),e(document).on("acf/fields/tab/show acf/conditional_logic/show",function(e,t){acf.fields.google_map.ready&&"google_map"==t.attr("data-field_type")&&acf.fields.google_map.set({$el:t.find(".acf-google-map")}).refresh()})}(jQuery),function(e){var t=acf.media;acf.fields.image={$el:null,$input:null,o:{},set:function(t){return e.extend(this,t),this.$input=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this.o.multiple=this.$el.closest(".repeater").exists()?!0:!1,this.o.query={type:"image"},"uploadedTo"==this.o.library&&(this.o.query.uploadedTo=acf.o.post_id),this},init:function(){acf.helpers.is_clone_field(this.$input)},add:function(e){var i=t.div;i.find(".acf-image-image").attr("src",e.url),i.find(".acf-image-value").val(e.id).trigger("change"),i.addClass("active"),i.closest(".field").removeClass("error")},edit:function(){var i=this.$input.val();t.div=this.$el,t.clear_frame(),t.frame=wp.media({title:acf.l10n.image.edit,multiple:!1,button:{text:acf.l10n.image.update}}),t.frame.on("open",function(){"browse"!=t.frame.content._mode&&t.frame.content.mode("browse"),t.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var a=t.frame.state().get("selection"),n=wp.media.attachment(i);e.isEmptyObject(n.changed)&&n.fetch(),a.add(n)}),t.frame.on("close",function(){t.frame.$el.closest(".media-modal").removeClass("acf-media-modal")}),acf.media.frame.open()},remove:function(){this.$el.find(".acf-image-image").attr("src",""),this.$el.find(".acf-image-value").val("").trigger("change"),this.$el.removeClass("active")},popup:function(){var i=this;return t.div=this.$el,t.clear_frame(),t.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(i.o.query),multiple:i.o.multiple,title:acf.l10n.image.select,priority:20,filterable:"all"})]}),acf.media.frame.on("content:activate",function(){var t=null,a=null;try{t=acf.media.frame.content.get().toolbar,a=t.get("filters")}catch(n){}return a?(e.each(a.filters,function(e,t){t.props.type="image"}),"uploadedTo"==i.o.library&&(a.$el.find('option[value="uploaded"]').remove(),a.$el.after("<span>"+acf.l10n.image.uploadedTo+"</span>"),e.each(a.filters,function(e,t){t.props.uploadedTo=acf.o.post_id})),a.$el.find("option").each(function(){var t=e(this).attr("value");("uploaded"!=t||"all"!=i.o.library)&&-1===t.indexOf("image")&&e(this).remove()}),void a.$el.val("image").trigger("change")):!1}),acf.media.frame.on("select",function(){if(selection=t.frame.state().get("selection")){var e=0;selection.each(function(a){if(e++,e>1){var n=t.div.closest("td"),s=n.closest(".row"),o=s.closest(".repeater"),l=n.attr("data-field_key"),r="td .acf-image-uploader:first";l&&(r='td[data-field_key="'+l+'"] .acf-image-uploader'),s.next(".row").exists()||o.find(".add-row-end").trigger("click"),t.div=s.next(".row").find(r)}var c={id:a.id,url:a.attributes.url};a.attributes.sizes&&a.attributes.sizes[i.o.preview_size]&&(c.url=a.attributes.sizes[i.o.preview_size].url),acf.fields.image.add(c)})}}),acf.media.frame.open(),!1},text:{title_add:"Select Image",title_edit:"Edit Image"}},e(document).on("click",".acf-image-uploader .acf-button-edit",function(t){t.preventDefault(),acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).edit()}),e(document).on("click",".acf-image-uploader .acf-button-delete",function(t){t.preventDefault(),acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).remove()}),e(document).on("click",".acf-image-uploader .add-image",function(t){t.preventDefault(),acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).popup()})}(jQuery),function(e){acf.fields.radio={$el:null,$input:null,$other:null,farbtastic:null,set:function(t){return e.extend(this,t),this.$input=this.$el.find('input[type="radio"]:checked'),this.$other=this.$el.find('input[type="text"]'),this},change:function(){"other"==this.$input.val()?(this.$other.attr("name",this.$input.attr("name")),this.$other.show()):(this.$other.attr("name",""),this.$other.hide())}},e(document).on("change",'.acf-radio-list input[type="radio"]',function(t){acf.fields.radio.set({$el:e(this).closest(".acf-radio-list")}).change()})}(jQuery),function(e){acf.fields.relationship={$el:null,$input:null,$left:null,$right:null,o:{},timeout:null,set:function(t){return e.extend(this,t),this.$input=this.$el.children('input[type="hidden"]'),this.$left=this.$el.find(".relationship_left"),this.$right=this.$el.find(".relationship_right"),this.o=acf.helpers.get_atts(this.$el),this},init:function(){var t=this;if(!acf.helpers.is_clone_field(this.$input)){this.$right.find(".relationship_list").height(this.$left.height()-2),this.$right.find(".relationship_list").sortable({axis:"y",items:"> li",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,update:function(){t.$input.trigger("change")}});var i=this.$el;this.$left.find(".relationship_list").scrollTop(0).on("scroll",function(a){if(!i.hasClass("loading")&&!i.hasClass("no-results")&&e(this).scrollTop()+e(this).innerHeight()>=e(this).get(0).scrollHeight){var n=parseInt(i.attr("data-paged"));i.attr("data-paged",n+1),t.set({$el:i}).fetch()}}),this.fetch()}},fetch:function(){var t=this,i=this.$el;i.addClass("loading"),e.ajax({url:acf.o.ajaxurl,type:"post",dataType:"json",data:e.extend({action:"acf/fields/relationship/query_posts",post_id:acf.o.post_id,nonce:acf.o.nonce},this.o),success:function(e){t.set({$el:i}).render(e)}})},render:function(t){var i=this;return this.$el.removeClass("no-results").removeClass("loading"),1==this.o.paged&&this.$el.find(".relationship_left li:not(.load-more)").remove(),t&&t.html?(this.$el.find(".relationship_left .load-more").before(t.html),t.next_page_exists||this.$el.addClass("no-results"),void this.$left.find("a").each(function(){var t=e(this).attr("data-post_id");i.$right.find('a[data-post_id="'+t+'"]').exists()&&e(this).parent().addClass("hide")})):void this.$el.addClass("no-results")},add:function(e){var t=e.attr("data-post_id"),i=e.html();if(this.$right.find("a").length>=this.o.max)return alert(acf.l10n.relationship.max.replace("{max}",this.o.max)),!1;if(e.parent().hasClass("hide"))return!1;e.parent().addClass("hide");var a={post_id:e.attr("data-post_id"),title:e.html(),name:this.$input.attr("name")},n=_.template(acf.l10n.relationship.tmpl_li,a);this.$right.find(".relationship_list").append(n),this.$input.trigger("change"),this.$el.closest(".field").removeClass("error")},remove:function(e){e.parent().remove(),this.$left.find('a[data-post_id="'+e.attr("data-post_id")+'"]').parent("li").removeClass("hide"),this.$input.trigger("change")}},e(document).on("acf/setup_fields",function(t,i){e(i).find(".acf_relationship").each(function(){acf.fields.relationship.set({$el:e(this)}).init()})}),e(document).on("change",".acf_relationship .select-post_type",function(t){var i=e(this).val(),a=e(this).closest(".acf_relationship");a.attr("data-post_type",i),a.attr("data-paged",1),acf.fields.relationship.set({$el:a}).fetch()}),e(document).on("click",".acf_relationship .relationship_left .relationship_list a",function(t){t.preventDefault(),acf.fields.relationship.set({$el:e(this).closest(".acf_relationship")}).add(e(this)),e(this).blur()}),e(document).on("click",".acf_relationship .relationship_right .relationship_list a",function(t){t.preventDefault(),acf.fields.relationship.set({$el:e(this).closest(".acf_relationship")}).remove(e(this)),e(this).blur()}),e(document).on("keyup",".acf_relationship input.relationship_search",function(t){var i=e(this).val(),a=e(this).closest(".acf_relationship");a.attr("data-s",i),a.attr("data-paged",1),clearTimeout(acf.fields.relationship.timeout),acf.fields.relationship.timeout=setTimeout(function(){acf.fields.relationship.set({$el:a}).fetch()},500)}),e(document).on("keypress",".acf_relationship input.relationship_search",function(e){13==e.which&&e.preventDefault()})}(jQuery),function(e){acf.fields.tab={add_group:function(e){var t="";t=e.is("tbody")?'<tr class="acf-tab-wrap"><td colspan="2"><ul class="hl clearfix acf-tab-group"></ul></td></tr>':'<div class="acf-tab-wrap"><ul class="hl clearfix acf-tab-group"></ul></div>',e.children(".field_type-tab:first").before(t)},add_tab:function(e){var t=e.closest(".field"),i=t.parent(),a=t.attr("data-field_key"),n=e.text();i.children(".acf-tab-wrap").exists()||this.add_group(i),i.children(".acf-tab-wrap").find(".acf-tab-group").append('<li><a class="acf-tab-button" href="#" data-key="'+a+'">'+n+"</a></li>")},toggle:function(t){var i=this,a=t.closest(".acf-tab-wrap").parent(),n=t.attr("data-key");t.parent("li").addClass("active").siblings("li").removeClass("active"),a.children(".field_type-tab").each(function(){var t=e(this);t.attr("data-field_key")==n?i.show_tab_fields(e(this)):i.hide_tab_fields(e(this))})},show_tab_fields:function(t){t.nextUntil(".field_type-tab").each(function(){e(this).removeClass("acf-tab_group-hide").addClass("acf-tab_group-show"),e(document).trigger("acf/fields/tab/show",[e(this)])})},hide_tab_fields:function(t){t.nextUntil(".field_type-tab").each(function(){e(this).removeClass("acf-tab_group-show").addClass("acf-tab_group-hide"),e(document).trigger("acf/fields/tab/hide",[e(this)])})},refresh:function(t){var i=this;t.find(".acf-tab-group").each(function(){e(this).find(".acf-tab-button:first").each(function(){i.toggle(e(this))})})}},e(document).on("acf/setup_fields",function(t,i){e(i).find(".acf-tab").each(function(){acf.fields.tab.add_tab(e(this))}),acf.fields.tab.refresh(e(i))}),e(document).on("click",".acf-tab-button",function(t){t.preventDefault(),acf.fields.tab.toggle(e(this)),e(this).trigger("blur")}),e(document).on("acf/conditional_logic/hide",function(e,t,i){if("tab"==t.attr("data-field_type")){var a=t.siblings(".acf-tab-wrap").find('a[data-key="'+t.attr("data-field_key")+'"]');a.is(":hidden")||(a.parent().hide(),a.parent().siblings(":visible").exists()?a.parent().siblings(":visible").first().children("a").trigger("click"):acf.fields.tab.hide_tab_fields(t))}}),e(document).on("acf/conditional_logic/show",function(e,t,i){if("tab"==t.attr("data-field_type")){var a=t.siblings(".acf-tab-wrap").find('a[data-key="'+t.attr("data-field_key")+'"]');if(!a.is(":visible"))return a.parent().show(),a.parent().hasClass("active")?void a.trigger("click"):a.parent().siblings(".active").is(":hidden")?void a.trigger("click"):void 0}})}(jQuery),function(e){acf.validation={status:!0,disabled:!1,run:function(){var t=this;t.status=!0,e(".field.required, .form-field.required").each(function(){t.validate(e(this))})},validate:function(t){var i=!1,a=null;if(t.data("validation",!0),t.is(":hidden")&&(i=!0,t.hasClass("acf-tab_group-hide"))){i=!1;var n=t.prevAll(".field_type-tab:first"),s=t.prevAll(".acf-tab-wrap:first");n.hasClass("acf-conditional_logic-hide")?i=!0:a=s.find('.acf-tab-button[data-key="'+n.attr("data-field_key")+'"]')}if(t.hasClass("acf-conditional_logic-hide")&&(i=!0),t.closest(".postbox.acf-hidden").exists()&&(i=!0),!i){if(""==t.find('input[type="text"], input[type="email"], input[type="number"], input[type="hidden"], textarea').val()&&t.data("validation",!1),t.find(".acf_wysiwyg").exists()&&"object"==typeof tinyMCE){t.data("validation",!0);var o=t.find(".wp-editor-area").attr("id"),l=tinyMCE.get(o);l&&!l.getContent()&&t.data("validation",!1)}if(t.find("select").exists()&&(t.data("validation",!0),"null"!=t.find("select").val()&&t.find("select").val()||t.data("validation",!1)),t.find('input[type="radio"]').exists()&&(t.data("validation",!1),t.find('input[type="radio"]:checked').exists()&&t.data("validation",!0)),t.find('input[type="checkbox"]').exists()&&(t.data("validation",!1),t.find('input[type="checkbox"]:checked').exists()&&t.data("validation",!0)),t.find(".acf_relationship").exists()&&(t.data("validation",!1),t.find(".acf_relationship .relationship_right input").exists()&&t.data("validation",!0)),t.find(".repeater").exists()&&(t.data("validation",!1),t.find(".repeater tr.row").exists()&&t.data("validation",!0)),t.find(".acf-gallery").exists()&&(t.data("validation",!1),t.find(".acf-gallery .thumbnail").exists()&&t.data("validation",!0)),e(document).trigger("acf/validate_field",[t]),!t.data("validation")){if(this.status=!1,t.closest(".field").addClass("error"),t.data("validation_message")){var r=t.find("p.label:first"),c=null;r.children(".acf-error-message").remove(),r.append('<span class="acf-error-message"><i class="bit"></i>'+t.data("validation_message")+"</span>")}a&&a.trigger("click")}}}},e(document).on("focus click",".field.required input, .field.required textarea, .field.required select",function(t){e(this).closest(".field").removeClass("error")}),e(document).on("click","#save-post",function(){acf.validation.disabled=!0}),e(document).on("submit","#post",function(){if(acf.validation.disabled)return!0;if(acf.validation.run(),!acf.validation.status){var t=e(this);return t.siblings("#message").remove(),t.before('<div id="message" class="error"><p>'+acf.l10n.validation.error+"</p></div>"),e("#publish").removeClass("button-primary-disabled"),e("#ajax-loading").attr("style",""),e("#publishing-action .spinner").hide(),!1
2
+ }return e(".acf_postbox.acf-hidden").remove(),!0})}(jQuery),function(e){var t=acf.fields.wysiwyg={$el:null,$textarea:null,o:{},set:function(t){return e.extend(this,t),this.$textarea=this.$el.find("textarea"),this.o=acf.helpers.get_atts(this.$el),this.o.id=this.$textarea.attr("id"),this},has_tinymce:function(){var e=!1;return"object"==typeof tinyMCE&&(e=!0),e},get_toolbar:function(){return acf.helpers.isset(this,"toolbars",this.o.toolbar)?this.toolbars[this.o.toolbar]:!1},init:function(){if(!acf.helpers.is_clone_field(this.$textarea)){var t=this.get_toolbar(),i="mceAddControl",a="theme_advanced_buttons{i}",n=e.extend({},tinyMCE.settings);if(4==tinymce.majorVersion&&(i="mceAddEditor",a="toolbar{i}"),t)for(var s=1;5>s;s++){var o="";acf.helpers.isset(t,"theme_advanced_buttons"+s)&&(o=t["theme_advanced_buttons"+s]),tinyMCE.settings[a.replace("{i}",s)]=o}tinyMCE.execCommand(i,!1,this.o.id),e(document).trigger("acf/wysiwyg/load",this.o.id),this.add_events(),tinyMCE.settings=n,wpActiveEditor=null}},add_events:function(){var t=this.o.id,i=tinyMCE.get(t);if(i){var a=e("#wp-"+t+"-wrap"),n=e(i.getBody());a.on("click",function(){e(document).trigger("acf/wysiwyg/click",t)}),n.on("focus",function(){e(document).trigger("acf/wysiwyg/focus",t)}),n.on("blur",function(){e(document).trigger("acf/wysiwyg/blur",t)})}},destroy:function(){var e=this.o.id,t="mceRemoveControl";try{var i=tinyMCE.get(e);if(!i)return;4==tinymce.majorVersion&&(t="mceRemoveEditor");var a=i.getContent();tinyMCE.execCommand(t,!1,e),this.$textarea.val(a)}catch(n){}wpActiveEditor=null}};e(document).on("acf/setup_fields",function(i,a){t.has_tinymce()&&(e(a).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()}),setTimeout(function(){e(a).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).init()})},0))}),e(document).on("acf/remove_fields",function(i,a){t.has_tinymce()&&a.find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()})}),e(document).on("acf/wysiwyg/click",function(t,i){wpActiveEditor=i,container=e("#wp-"+i+"-wrap").closest(".field").removeClass("error")}),e(document).on("acf/wysiwyg/focus",function(t,i){wpActiveEditor=i,container=e("#wp-"+i+"-wrap").closest(".field").removeClass("error")}),e(document).on("acf/wysiwyg/blur",function(t,i){wpActiveEditor=null;var a=tinyMCE.get(i);if(a){var n=a.getElement();a.save(),e(n).trigger("change")}}),e(document).on("acf/sortable_start",function(i,a){t.has_tinymce()&&e(a).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()})}),e(document).on("acf/sortable_stop",function(i,a){t.has_tinymce()&&e(a).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).init()})}),e(window).load(function(){if(t.has_tinymce()){var i=e("#wp-content-wrap").exists(),a=e("#wp-acf_settings-wrap").exists();mode="tmce",a&&e("#wp-acf_settings-wrap").hasClass("html-active")&&(mode="html"),setTimeout(function(){a&&"html"==mode&&e("#acf_settings-tmce").trigger("click")},1),setTimeout(function(){a&&"html"==mode&&e("#acf_settings-html").trigger("click"),i&&t.set({$el:e("#wp-content-wrap")}).add_events()},11)}}),e(document).on("click",".acf_wysiwyg a.mce_fullscreen",function(){var t=e(this).closest(".acf_wysiwyg"),i=t.attr("data-upload");"no"==i&&e("#mce_fullscreen_container td.mceToolbar .mce_add_media").remove()})}(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: elliotcondon
3
  Tags: custom, field, custom field, advanced, simple fields, magic fields, more fields, repeater, matrix, post, type, text, textarea, file, image, edit, admin
4
  Requires at least: 3.5.0
5
- Tested up to: 3.8.0
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
@@ -107,6 +107,14 @@ http://support.advancedcustomfields.com/
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
 
 
110
  = 4.3.5 =
111
  * Textarea field: Added new `rows` setting
112
  * API: Added `$format_value` parameter to the `get_fields` function
2
  Contributors: elliotcondon
3
  Tags: custom, field, custom field, advanced, simple fields, magic fields, more fields, repeater, matrix, post, type, text, textarea, file, image, edit, admin
4
  Requires at least: 3.5.0
5
+ Tested up to: 3.9.0
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
107
 
108
  == Changelog ==
109
 
110
+ = 4.3.6 =
111
+ * Core: Improved efficiency and speed when saving values by removing ACF meta from the native WP postmeta box
112
+ * Field Group: Fixed cache issue causing field settings to not update
113
+ * WYSIWYG field: Added support for new tinymce 4 in WP 3.9
114
+ * Number field: Fixed bug causing blank values to save as 0
115
+ * Google Maps field: Fixed JS bug causing google maps to not render when Google library is already loaded
116
+ * Validation: Fixed JS bug where hidden field groups's fields were being validated
117
+
118
  = 4.3.5 =
119
  * Textarea field: Added new `rows` setting
120
  * API: Added `$format_value` parameter to the `get_fields` function