Advanced Custom Fields - Version 4.4.9

Version Description

  • WYSIWYG field: Fixed JS error preventing tinymce from initializing
  • Image field: Added nicer 'Edit image' view
  • File field: Added nicer 'Edit file' view
Download this release

Release Info

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

Code changes from version 4.4.8 to 4.4.9

acf.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Advanced Custom Fields
4
  Plugin URI: http://www.advancedcustomfields.com/
5
  Description: Customise WordPress with powerful, professional and intuitive fields
6
- Version: 4.4.8
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.4.8',
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: Customise WordPress with powerful, professional and intuitive fields
6
+ Version: 4.4.9
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.4.9',
47
  'upgrade_version' => '3.4.1',
48
  'include_3rd_party' => false
49
  );
core/fields/wysiwyg.php CHANGED
@@ -215,7 +215,7 @@ class acf_field_wysiwyg extends acf_field
215
 
216
 
217
  // vars
218
- $id = 'wysiwyg-' . $field['id'] . '-' . uniqid();
219
  $default_editor = 'tinymce';
220
 
221
 
@@ -245,7 +245,7 @@ class acf_field_wysiwyg extends acf_field
245
  $field['value'] = apply_filters( 'acf_the_editor_content', $field['value'], $default_editor );
246
 
247
  ?>
248
- <div id="wp-<?php echo $id; ?>-wrap" class="acf_wysiwyg wp-core-ui wp-editor-wrap" data-toolbar="<?php echo $field['toolbar']; ?>" data-upload="<?php echo $field['media_upload']; ?>">
249
  <div id="wp-<?php echo $id; ?>-editor-tools" class="wp-editor-tools hide-if-no-js">
250
  <?php if( user_can_richedit() && $field['media_upload'] == 'yes' ): ?>
251
  <div id="wp-<?php echo $id; ?>-media-buttons" class="wp-media-buttons">
215
 
216
 
217
  // vars
218
+ $id = uniqid('acf-editor-');
219
  $default_editor = 'tinymce';
220
 
221
 
245
  $field['value'] = apply_filters( 'acf_the_editor_content', $field['value'], $default_editor );
246
 
247
  ?>
248
+ <div id="wp-<?php echo $id; ?>-wrap" class="acf_wysiwyg wp-core-ui wp-editor-wrap tmce-active" data-toolbar="<?php echo $field['toolbar']; ?>" data-upload="<?php echo $field['media_upload']; ?>">
249
  <div id="wp-<?php echo $id; ?>-editor-tools" class="wp-editor-tools hide-if-no-js">
250
  <?php if( user_can_richedit() && $field['media_upload'] == 'yes' ): ?>
251
  <div id="wp-<?php echo $id; ?>-media-buttons" class="wp-media-buttons">
css/input.css CHANGED
@@ -508,17 +508,21 @@ not needed in WP 3.8
508
 
509
  .media-modal.acf-media-modal .media-frame-router,
510
  .media-modal.acf-media-modal .attachments,
511
- .media-modal.acf-media-modal .media-frame-content .media-toolbar {
 
512
  display: none;
513
  }
514
 
515
  .media-modal.acf-media-modal .media-frame-content {
516
- top: 56px;
 
517
  }
518
 
 
519
  .media-modal.acf-media-modal .media-frame-title {
520
  border-bottom: 1px solid #DFDFDF;
521
  box-shadow: 0 4px 4px -4px rgba(0, 0, 0, 0.1);
 
522
  }
523
 
524
  .media-modal.acf-media-modal .media-frame-content .media-sidebar {
@@ -528,6 +532,7 @@ not needed in WP 3.8
528
 
529
  .media-modal.acf-media-modal .media-toolbar {
530
  right: 0;
 
531
  }
532
 
533
 
508
 
509
  .media-modal.acf-media-modal .media-frame-router,
510
  .media-modal.acf-media-modal .attachments,
511
+ .media-modal.acf-media-modal .media-frame-content .media-toolbar,
512
+ .media-modal.acf-media-modal .media-frame-menu {
513
  display: none;
514
  }
515
 
516
  .media-modal.acf-media-modal .media-frame-content {
517
+ top: 50px;
518
+ left: 0;
519
  }
520
 
521
+
522
  .media-modal.acf-media-modal .media-frame-title {
523
  border-bottom: 1px solid #DFDFDF;
524
  box-shadow: 0 4px 4px -4px rgba(0, 0, 0, 0.1);
525
+ left: 0;
526
  }
527
 
528
  .media-modal.acf-media-modal .media-frame-content .media-sidebar {
532
 
533
  .media-modal.acf-media-modal .media-toolbar {
534
  right: 0;
535
+ left: 0;
536
  }
537
 
538
 
js/input.js CHANGED
@@ -1573,11 +1573,8 @@ var acf = {
1573
  div.closest('.field').removeClass('error');
1574
 
1575
  },
1576
- edit : function(){
1577
-
1578
- // vars
1579
- var id = this.$input.val();
1580
-
1581
 
1582
  // set global var
1583
  _media.div = this.$el;
@@ -1587,24 +1584,78 @@ var acf = {
1587
  _media.clear_frame();
1588
 
1589
 
1590
- // create the media frame
1591
- _media.frame = wp.media({
1592
- title : acf.l10n.file.edit,
1593
- multiple : false,
1594
- button : { text : acf.l10n.file.update }
1595
- });
 
 
 
 
 
 
 
1596
 
1597
 
1598
- // log events
1599
- /*
1600
- acf.media.frame.on('all', function(e){
1601
 
1602
- console.log( e );
1603
 
1604
- });
1605
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1606
 
1607
 
 
 
 
 
 
 
 
 
1608
  // open
1609
  _media.frame.on('open',function() {
1610
 
@@ -1670,25 +1721,11 @@ var acf = {
1670
  var t = this;
1671
 
1672
 
1673
- // set global var
1674
- _media.div = this.$el;
1675
-
1676
-
1677
- // clear the frame
1678
- _media.clear_frame();
1679
-
1680
-
1681
- // Create the media frame
1682
- _media.frame = wp.media({
1683
- states : [
1684
- new wp.media.controller.Library({
1685
- library : wp.media.query( t.o.query ),
1686
- multiple : t.o.multiple,
1687
- title : acf.l10n.file.select,
1688
- priority : 20,
1689
- filterable : 'all'
1690
- })
1691
- ]
1692
  });
1693
 
1694
 
@@ -2513,11 +2550,8 @@ var acf = {
2513
  div.closest('.field').removeClass('error');
2514
 
2515
  },
2516
- edit : function(){
2517
-
2518
- // vars
2519
- var id = this.$input.val();
2520
-
2521
 
2522
  // set global var
2523
  _media.div = this.$el;
@@ -2527,24 +2561,79 @@ var acf = {
2527
  _media.clear_frame();
2528
 
2529
 
2530
- // create the media frame
2531
- _media.frame = wp.media({
2532
- title : acf.l10n.image.edit,
2533
- multiple : false,
2534
- button : { text : acf.l10n.image.update }
2535
- });
2536
 
2537
 
2538
- // log events
2539
- /*
2540
- acf.media.frame.on('all', function(e){
 
 
 
 
 
 
 
 
 
 
 
2541
 
2542
- console.log( e );
2543
 
2544
- });
2545
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2546
 
2547
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2548
  // open
2549
  _media.frame.on('open',function() {
2550
 
@@ -2586,7 +2675,7 @@ var acf = {
2586
 
2587
 
2588
  // Finally, open the modal
2589
- acf.media.frame.open();
2590
 
2591
  },
2592
  remove : function()
@@ -2607,37 +2696,16 @@ var acf = {
2607
  var t = this;
2608
 
2609
 
2610
- // set global var
2611
- _media.div = this.$el;
2612
-
2613
-
2614
- // clear the frame
2615
- _media.clear_frame();
2616
-
2617
-
2618
- // Create the media frame
2619
- _media.frame = wp.media({
2620
- states : [
2621
- new wp.media.controller.Library({
2622
- library : wp.media.query( t.o.query ),
2623
- multiple : t.o.multiple,
2624
- title : acf.l10n.image.select,
2625
- priority : 20,
2626
- filterable : 'all'
2627
- })
2628
- ]
2629
  });
2630
 
2631
 
2632
- /*acf.media.frame.on('all', function(e){
2633
-
2634
- console.log( e );
2635
-
2636
- });*/
2637
-
2638
-
2639
  // customize model / view
2640
- acf.media.frame.on('content:activate', function(){
2641
 
2642
  // vars
2643
  var toolbar = null,
@@ -4005,12 +4073,12 @@ var acf = {
4005
 
4006
  var _wysiwyg = acf.fields.wysiwyg = {
4007
 
4008
- $el : null,
4009
- $textarea : null,
4010
 
4011
- o : {},
4012
 
4013
- set : function( o ){
4014
 
4015
  // merge in new option
4016
  $.extend( this, o );
@@ -4022,9 +4090,6 @@ var acf = {
4022
 
4023
  // get options
4024
  this.o = acf.helpers.get_atts( this.$el );
4025
-
4026
-
4027
- // add ID
4028
  this.o.id = this.$textarea.attr('id');
4029
 
4030
 
@@ -4032,6 +4097,7 @@ var acf = {
4032
  return this;
4033
 
4034
  },
 
4035
  has_tinymce : function(){
4036
 
4037
  var r = false;
@@ -4070,7 +4136,8 @@ var acf = {
4070
 
4071
 
4072
  // vars
4073
- var toolbar = this.get_toolbar(),
 
4074
  command = 'mceAddControl',
4075
  setting = 'theme_advanced_buttons{i}';
4076
 
@@ -4114,15 +4181,19 @@ var acf = {
4114
 
4115
 
4116
  // add editor
4117
- tinyMCE.execCommand( command, false, this.o.id);
4118
 
4119
 
4120
  // events - load
4121
- $(document).trigger('acf/wysiwyg/load', this.o.id);
4122
 
4123
 
4124
  // add events (click, focus, blur) for inserting image into correct editor
4125
- this.add_events();
 
 
 
 
4126
 
4127
 
4128
  // restore tinyMCE.settings
@@ -4133,18 +4204,15 @@ var acf = {
4133
  wpActiveEditor = null;
4134
 
4135
  },
4136
- add_events : function(){
4137
 
 
 
4138
  // vars
4139
- var id = this.o.id,
4140
- editor = tinyMCE.get( id );
4141
 
4142
 
4143
  // validate
4144
- if( !editor )
4145
- {
4146
- return;
4147
- }
4148
 
4149
 
4150
  // vars
@@ -4512,7 +4580,7 @@ var acf = {
4512
  // Add events to content editor
4513
  if( wp_content )
4514
  {
4515
- _wysiwyg.set({ $el : $('#wp-content-wrap') }).add_events();
4516
  }
4517
 
4518
 
1573
  div.closest('.field').removeClass('error');
1574
 
1575
  },
1576
+
1577
+ new_frame: function( attributes ){
 
 
 
1578
 
1579
  // set global var
1580
  _media.div = this.$el;
1584
  _media.clear_frame();
1585
 
1586
 
1587
+ // vars
1588
+ attributes.states = [];
1589
+
1590
+ // append states
1591
+ attributes.states.push(
1592
+ new wp.media.controller.Library({
1593
+ library : wp.media.query( this.o.query ),
1594
+ multiple : attributes.multiple,
1595
+ title : attributes.title,
1596
+ priority : 20,
1597
+ filterable : 'all'
1598
+ })
1599
+ );
1600
 
1601
 
1602
+ // edit image functionality (added in WP 3.9)
1603
+ if( acf.helpers.isset(wp, 'media', 'controller', 'EditImage') ) {
 
1604
 
1605
+ attributes.states.push( new wp.media.controller.EditImage() );
1606
 
1607
+ }
1608
+
1609
+
1610
+ // Create the media frame
1611
+ _media.frame = wp.media( attributes );
1612
+
1613
+
1614
+ // edit image view
1615
+ // source: media-views.js:2410 editImageContent()
1616
+ _media.frame.on('content:render:edit-image', function(){
1617
+
1618
+ var image = this.state().get('image'),
1619
+ view = new wp.media.view.EditImage( { model: image, controller: this } ).render();
1620
+
1621
+ this.content.set( view );
1622
+
1623
+ // after creating the wrapper view, load the actual editor via an ajax call
1624
+ view.loadEditor();
1625
+
1626
+ }, _media.frame);
1627
+
1628
+
1629
+ // update toolbar button
1630
+ _media.frame.on( 'toolbar:create:select', function( toolbar ) {
1631
+
1632
+ toolbar.view = new wp.media.view.Toolbar.Select({
1633
+ text: attributes.button.text,
1634
+ controller: this
1635
+ });
1636
+
1637
+ }, _media.frame );
1638
+
1639
+
1640
+ // return
1641
+ return _media.frame;
1642
+
1643
+ },
1644
+
1645
+ edit : function(){
1646
+
1647
+ // vars
1648
+ var id = this.$input.val();
1649
 
1650
 
1651
+ // create frame
1652
+ this.new_frame({
1653
+ title : acf.l10n.file.edit,
1654
+ multiple : false,
1655
+ button : { text : acf.l10n.file.update }
1656
+ });
1657
+
1658
+
1659
  // open
1660
  _media.frame.on('open',function() {
1661
 
1721
  var t = this;
1722
 
1723
 
1724
+ // create frame
1725
+ this.new_frame({
1726
+ title : acf.l10n.file.select,
1727
+ multiple : t.o.multiple,
1728
+ button : { text : acf.l10n.file.select }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1729
  });
1730
 
1731
 
2550
  div.closest('.field').removeClass('error');
2551
 
2552
  },
2553
+
2554
+ new_frame: function( attributes ){
 
 
 
2555
 
2556
  // set global var
2557
  _media.div = this.$el;
2561
  _media.clear_frame();
2562
 
2563
 
2564
+ // vars
2565
+ attributes.states = [];
 
 
 
 
2566
 
2567
 
2568
+ // append states
2569
+ attributes.states.push(
2570
+ new wp.media.controller.Library({
2571
+ library : wp.media.query( this.o.query ),
2572
+ multiple : attributes.multiple,
2573
+ title : attributes.title,
2574
+ priority : 20,
2575
+ filterable : 'all'
2576
+ })
2577
+ );
2578
+
2579
+
2580
+ // edit image functionality (added in WP 3.9)
2581
+ if( acf.helpers.isset(wp, 'media', 'controller', 'EditImage') ) {
2582
 
2583
+ attributes.states.push( new wp.media.controller.EditImage() );
2584
 
2585
+ }
2586
+
2587
+
2588
+ // Create the media frame
2589
+ _media.frame = wp.media( attributes );
2590
+
2591
+
2592
+ // edit image view
2593
+ // source: media-views.js:2410 editImageContent()
2594
+ _media.frame.on('content:render:edit-image', function(){
2595
+
2596
+ var image = this.state().get('image'),
2597
+ view = new wp.media.view.EditImage( { model: image, controller: this } ).render();
2598
+
2599
+ this.content.set( view );
2600
+
2601
+ // after creating the wrapper view, load the actual editor via an ajax call
2602
+ view.loadEditor();
2603
+
2604
+ }, _media.frame);
2605
 
2606
 
2607
+ // update toolbar button
2608
+ _media.frame.on( 'toolbar:create:select', function( toolbar ) {
2609
+
2610
+ toolbar.view = new wp.media.view.Toolbar.Select({
2611
+ text: attributes.button.text,
2612
+ controller: this
2613
+ });
2614
+
2615
+ }, _media.frame );
2616
+
2617
+
2618
+ // return
2619
+ return _media.frame;
2620
+
2621
+ },
2622
+
2623
+ edit : function(){
2624
+
2625
+ // vars
2626
+ var id = this.$input.val();
2627
+
2628
+
2629
+ // create frame
2630
+ this.new_frame({
2631
+ title : acf.l10n.image.edit,
2632
+ multiple : false,
2633
+ button : { text : acf.l10n.image.update }
2634
+ });
2635
+
2636
+
2637
  // open
2638
  _media.frame.on('open',function() {
2639
 
2675
 
2676
 
2677
  // Finally, open the modal
2678
+ _media.frame.open();
2679
 
2680
  },
2681
  remove : function()
2696
  var t = this;
2697
 
2698
 
2699
+ // create frame
2700
+ this.new_frame({
2701
+ title : acf.l10n.image.select,
2702
+ multiple : t.o.multiple,
2703
+ button : { text : acf.l10n.image.select }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2704
  });
2705
 
2706
 
 
 
 
 
 
 
 
2707
  // customize model / view
2708
+ _media.frame.on('content:activate', function(){
2709
 
2710
  // vars
2711
  var toolbar = null,
4073
 
4074
  var _wysiwyg = acf.fields.wysiwyg = {
4075
 
4076
+ $el: null,
4077
+ $textarea: null,
4078
 
4079
+ o: {},
4080
 
4081
+ set: function( o ){
4082
 
4083
  // merge in new option
4084
  $.extend( this, o );
4090
 
4091
  // get options
4092
  this.o = acf.helpers.get_atts( this.$el );
 
 
 
4093
  this.o.id = this.$textarea.attr('id');
4094
 
4095
 
4097
  return this;
4098
 
4099
  },
4100
+
4101
  has_tinymce : function(){
4102
 
4103
  var r = false;
4136
 
4137
 
4138
  // vars
4139
+ var id = this.o.id,
4140
+ toolbar = this.get_toolbar(),
4141
  command = 'mceAddControl',
4142
  setting = 'theme_advanced_buttons{i}';
4143
 
4181
 
4182
 
4183
  // add editor
4184
+ tinyMCE.execCommand( command, false, id);
4185
 
4186
 
4187
  // events - load
4188
+ $(document).trigger('acf/wysiwyg/load', id);
4189
 
4190
 
4191
  // add events (click, focus, blur) for inserting image into correct editor
4192
+ setTimeout(function(){
4193
+
4194
+ _wysiwyg.add_events( id );
4195
+
4196
+ }, 100);
4197
 
4198
 
4199
  // restore tinyMCE.settings
4204
  wpActiveEditor = null;
4205
 
4206
  },
 
4207
 
4208
+ add_events: function( id ){
4209
+
4210
  // vars
4211
+ var editor = tinyMCE.get( id );
 
4212
 
4213
 
4214
  // validate
4215
+ if( !editor ) return;
 
 
 
4216
 
4217
 
4218
  // vars
4580
  // Add events to content editor
4581
  if( wp_content )
4582
  {
4583
+ _wysiwyg.add_events('content');
4584
  }
4585
 
4586
 
js/input.min.js CHANGED
@@ -1,2 +1,2 @@
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($){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;i<t;i++){if(e[i]===n||a[e[i]]===n)return!1;a=a[e[i]]}return!0},acf.helpers.get_atts=function(e){var t={};return $.each(e[0].attributes,function(e,i){"data-"==i.name.substr(0,5)&&(t[i.name.replace("data-","")]=i.value)}),t},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(e,t){return t.children().each(function(){$(this).width($(this).width())}),t},acf.helpers.is_clone_field=function(e){return!(!e.attr("name")||-1==e.attr("name").indexOf("[acfcloneindex]"))},acf.helpers.add_message=function(e,t){var e=$('<div class="acf-message-wrapper"><div class="message updated"><p>'+e+"</p></div></div>");t.prepend(e),setTimeout(function(){e.animate({opacity:0},250,function(){e.remove()})},1500)},$.fn.exists=function(){return $(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 e=wp.media.view.AttachmentCompat.prototype;e.orig_render=e.render,e.orig_dispose=e.dispose,e.className="compat-item acf_postbox no_box",e.render=function(){var e=this;return e.ignore_render?this:(this.orig_render(),setTimeout(function(){var t=e.$el.closest(".media-modal");if(!t.hasClass("acf-media-modal")&&!t.find(".media-frame-router .acf-expand-details").exists()){var i=$(['<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(""));i.on("click",function(e){e.preventDefault(),t.hasClass("acf-expanded")?t.removeClass("acf-expanded"):t.addClass("acf-expanded")}),t.find(".media-frame-router").append(i)}},0),clearTimeout(acf.media.render_timout),acf.media.render_timout=setTimeout(function(){$(document).trigger("acf/setup_fields",[e.$el])},50),this)},e.dispose=function(){$(document).trigger("acf/remove_fields",[this.$el]),this.orig_dispose()},e.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 e=this;$(document).on("change",".field input, .field textarea, .field select",function(){$("#acf-has-changed").exists()&&$("#acf-has-changed").val(1),e.change($(this))}),$(document).on("acf/setup_fields",function(t,i){e.refresh($(i))}),e.refresh()},change:function(e){var t=this,i=e.closest(".field"),a=i.attr("data-field_key");$.each(this.items,function(e,i){$.each(i.rules,function(e,n){n.field==a&&t.refresh_field(i)})})},refresh_field:function(e){var t=this,i=$(".field_key-"+e.field);i.each(function(){var i=!0;"any"==e.allorany&&(i=!1);var a=$(this),n=!0;$.each(e.rules,function(s,o){var l=$(".field_key-"+o.field);l.hasClass("sub_field")&&(l=a.siblings(".field_key-"+o.field),n=!1,l.exists()||(a.parents("tr").each(function(){return l=$(this).find(".field_key-"+o.field),l.exists()?!1:void 0}),n=!0));var r=a.parent("tr").parent().parent("table").parent(".layout");r.exists()&&(n=!0,a.is("th")&&l.is("th")&&(l=a.closest(".layout").find("td.field_key-"+o.field)));var r=a.parent("tr").parent().parent("table").parent(".repeater");r.exists()&&"1"==r.attr("data-max_rows")&&(n=!0,a.is("th")&&l.is("th")&&(l=a.closest("table").find("td.field_key-"+o.field)));var c=t.calculate(o,l,a);if("all"==e.allorany){if(0==c)return i=!1,!1}else if(1==c)return i=!0,!1}),a.removeClass("acf-conditional_logic-hide acf-conditional_logic-show acf-show-blank"),i?(a.find("input, textarea, select").removeAttr("disabled"),a.addClass("acf-conditional_logic-show"),$(document).trigger("acf/conditional_logic/show",[a,e])):(a.find("input, textarea, select").attr("disabled","disabled"),a.addClass("acf-conditional_logic-hide"),n||a.addClass("acf-show-blank"),$(document).trigger("acf/conditional_logic/hide",[a,e]))})},refresh:function(e){e=e||$("body");var t=this;$.each(this.items,function(i,a){$.each(a.rules,function(i,n){e.find('.field[data-field_key="'+a.field+'"]').exists()&&t.refresh_field(a)})})},calculate:function(e,t,i){var a=!1;if(t.hasClass("field_type-true_false")||t.hasClass("field_type-checkbox")||t.hasClass("field_type-radio")){var n=t.find('input[value="'+e.value+'"]:checked').exists();"=="==e.operator?n&&(a=!0):n||(a=!0)}else{var s=t.find("input, textarea, select").last().val();$.isArray(s)||(s=[s]),"=="==e.operator?$.inArray(e.value,s)>-1&&(a=!0):$.inArray(e.value,s)<0&&(a=!0)}return a}},$(document).ready(function(){acf.conditional_logic.init(),$(".acf_postbox > .inside > .options").each(function(){$(this).closest(".acf_postbox").addClass($(this).attr("data-layout"))}),$('#metakeyselect option[value^="field_"]').remove()}),$(window).on("load",function(){acf.media.init(),setTimeout(function(){try{$.isNumeric(acf.o.post_id)&&(wp.media.view.settings.post.id=acf.o.post_id)}catch(e){}$(document).trigger("acf/setup_fields",[$("#poststuff")])},10)}),acf.fields.gallery={add:function(){},edit:function(){},update_count:function(){},hide_selected_items:function(){},text:{title_add:"Select Images"}}}(jQuery),function($){function e(){var e=[];$(".categorychecklist input:checked, .acf-taxonomy-field input:checked, .acf-taxonomy-field option:selected").each(function(){$(this).is(":hidden")||$(this).is(":disabled")||$(this).closest(".media-frame").exists()||$(this).closest(".acf-taxonomy-field").exists()&&"0"==$(this).closest(".acf-taxonomy-field").attr("data-load_save")||-1===e.indexOf($(this).val())&&e.push($(this).val())}),acf.screen.post_category=e,acf.screen.taxonomy=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},$(document).ready(function(){if(acf.screen.post_id=acf.o.post_id,acf.screen.nonce=acf.o.nonce,$("#icl-als-first").length>0){var e=$("#icl-als-first").children("a").attr("href"),t=new RegExp("lang=([^&#]*)"),i=t.exec(e);acf.screen.lang=i[1]}}),$(document).on("acf/update_field_groups",function(){return acf.screen.post_id&&$.isNumeric(acf.screen.post_id)?void $.ajax({url:ajaxurl,data:acf.screen,type:"post",dataType:"json",success:function(e){return e?($(".acf_postbox").addClass("acf-hidden"),$(".acf_postbox-toggle").addClass("acf-hidden"),0==e.length?!1:($.each(e,function(e,t){var i=$("#acf_"+t),a=$('#adv-settings .acf_postbox-toggle[for="acf_'+t+'-hide"]');i.removeClass("acf-hidden hide-if-js"),a.removeClass("acf-hidden"),a.find('input[type="checkbox"]').attr("checked","checked"),i.find(".acf-replace-with-fields").each(function(){var e=$(this);$.ajax({url:ajaxurl,data:{action:"acf/post/render_fields",acf_id:t,post_id:acf.o.post_id,nonce:acf.o.nonce},type:"post",dataType:"html",success:function(t){e.replaceWith(t),$(document).trigger("acf/setup_fields",i)}})})}),void $.ajax({url:ajaxurl,data:{action:"acf/post/get_style",acf_id:e[0],nonce:acf.o.nonce},type:"post",dataType:"html",success:function(e){$("#acf_style").html(e)}}))):!1}}):!1}),$(document).on("change","#page_template",function(){acf.screen.page_template=$(this).val(),$(document).trigger("acf/update_field_groups")}),$(document).on("change","#parent_id",function(){var e=$(this).val();""!=e?(acf.screen.page_type="child",acf.screen.page_parent=e):(acf.screen.page_type="parent",acf.screen.page_parent=0),$(document).trigger("acf/update_field_groups")}),$(document).on("change",'#post-formats-select input[type="radio"]',function(){var e=$(this).val();"0"==e&&(e="standard"),acf.screen.post_format=e,$(document).trigger("acf/update_field_groups")}),$(document).on("change",".categorychecklist input, .acf-taxonomy-field input, .acf-taxonomy-field select",function(){$(this).closest(".acf-taxonomy-field").exists()&&"0"==$(this).closest(".acf-taxonomy-field").attr("data-save")||$(this).closest(".media-frame").exists()||setTimeout(function(){e()},1)})}(jQuery),function($){var e=acf.fields.color_picker={$el:null,$input:null,set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="text"]'),this},init:function(){var e=this.$input;acf.helpers.is_clone_field(e)||this.$input.wpColorPicker()}};$(document).on("acf/setup_fields",function(t,i){$(i).find(".acf-color_picker").each(function(){e.set({$el:$(this)}).init()})})}(jQuery),function($){acf.fields.date_picker={$el:null,$input:null,$hidden:null,o:{},set:function(e){return $.extend(this,e),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 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(e),this.$input.datepicker("option","dateFormat",this.o.display_format),$("body > #ui-datepicker-div").length>0&&$("#ui-datepicker-div").wrap('<div class="ui-acf" />')}},blur:function(){this.$input.val()||this.$hidden.val("")}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf-date_picker").each(function(){acf.fields.date_picker.set({$el:$(this)}).init()})}),$(document).on("blur",'.acf-date_picker input[type="text"]',function(e){acf.fields.date_picker.set({$el:$(this).parent()}).blur()})}(jQuery),function($){var e=acf.media;acf.fields.file={$el:null,$input:null,o:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this.o.multiple=!!this.$el.closest(".repeater").exists(),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(t){var i=e.div;i.find(".acf-file-icon").attr("src",t.icon),i.find(".acf-file-title").text(t.title),i.find(".acf-file-name").text(t.name).attr("href",t.url),i.find(".acf-file-size").text(t.size),i.find(".acf-file-value").val(t.id).trigger("change"),i.addClass("active"),i.closest(".field").removeClass("error")},edit:function(){var t=this.$input.val();e.div=this.$el,e.clear_frame(),e.frame=wp.media({title:acf.l10n.file.edit,multiple:!1,button:{text:acf.l10n.file.update}}),e.frame.on("open",function(){"browse"!=e.frame.content._mode&&e.frame.content.mode("browse"),e.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var i=e.frame.state().get("selection"),a=wp.media.attachment(t);$.isEmptyObject(a.changed)&&a.fetch(),i.add(a)}),e.frame.on("close",function(){e.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 t=this;return e.div=this.$el,e.clear_frame(),e.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(t.o.query),multiple:t.o.multiple,title:acf.l10n.file.select,priority:20,filterable:"all"})]}),acf.media.frame.on("content:activate",function(){var e=null,i=null;try{e=acf.media.frame.content.get().toolbar,i=e.get("filters")}catch(a){}return i?void("uploadedTo"==t.o.library&&(i.$el.find('option[value="uploaded"]').remove(),i.$el.after("<span>"+acf.l10n.file.uploadedTo+"</span>"),$.each(i.filters,function(e,t){t.props.uploadedTo=acf.o.post_id}))):!1}),acf.media.frame.on("select",function(){if(selection=e.frame.state().get("selection"),selection){var t=0;selection.each(function(i){if(t++,t>1){var a=e.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"),e.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}},$(document).on("click",".acf-file-uploader .acf-button-edit",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).edit()}),$(document).on("click",".acf-file-uploader .acf-button-delete",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).remove()}),$(document).on("click",".acf-file-uploader .add-file",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).popup()})}(jQuery),function($){acf.fields.google_map={$el:null,$input:null,o:{},api:{sensor:!1,libraries:"places"},ready:!1,geocoder:!1,map:!1,maps:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find(".input-address"),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()}},$(document).on("acf/setup_fields",function(e,t){var i=acf.fields.google_map,a=$(t).find(".acf-google-map");return a.exists()?acf.helpers.isset(window,"google","load")?acf.helpers.isset(window,"google","maps","places")?(a.each(function(){acf.fields.google_map.set({$el:$(this)}).init()}),!0):(google.load("maps","3",{other_params:$.param(i.api),callback:function(){a.each(function(){acf.fields.google_map.set({$el:$(this)}).init()})}}),!1):($.getScript("https://www.google.com/jsapi",function(){google.load("maps","3",{other_params:$.param(i.api),callback:function(){a.each(function(){acf.fields.google_map.set({$el:$(this)}).init()})}})}),!1):!1}),$(document).on("click",".acf-google-map .acf-sprite-remove",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).clear(),$(this).blur()}),$(document).on("click",".acf-google-map .acf-sprite-locate",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).locate(),$(this).blur()}),$(document).on("click",".acf-google-map .title h4",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).edit()}),$(document).on("keydown",".acf-google-map .search",function(e){return 13==e.which?!1:void 0}),$(document).on("blur",".acf-google-map .search",function(e){var t=$(this).closest(".acf-google-map");t.find(".input-lat").val()&&t.addClass("active")}),$(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($){var e=acf.media;acf.fields.image={$el:null,$input:null,o:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this.o.multiple=!!this.$el.closest(".repeater").exists(),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(t){var i=e.div;i.find(".acf-image-image").attr("src",t.url),i.find(".acf-image-value").val(t.id).trigger("change"),i.addClass("active"),i.closest(".field").removeClass("error")},edit:function(){var t=this.$input.val();e.div=this.$el,e.clear_frame(),e.frame=wp.media({title:acf.l10n.image.edit,multiple:!1,button:{text:acf.l10n.image.update}}),e.frame.on("open",function(){"browse"!=e.frame.content._mode&&e.frame.content.mode("browse"),e.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var i=e.frame.state().get("selection"),a=wp.media.attachment(t);$.isEmptyObject(a.changed)&&a.fetch(),i.add(a)}),e.frame.on("close",function(){e.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 t=this;return e.div=this.$el,e.clear_frame(),e.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(t.o.query),multiple:t.o.multiple,title:acf.l10n.image.select,priority:20,filterable:"all"})]}),acf.media.frame.on("content:activate",function(){var e=null,i=null;try{e=acf.media.frame.content.get().toolbar,i=e.get("filters")}catch(a){}return i?($.each(i.filters,function(e,t){t.props.type="image"}),"uploadedTo"==t.o.library&&(i.$el.find('option[value="uploaded"]').remove(),i.$el.after("<span>"+acf.l10n.image.uploadedTo+"</span>"),$.each(i.filters,function(e,t){t.props.uploadedTo=acf.o.post_id})),i.$el.find("option").each(function(){var e=$(this).attr("value");"uploaded"==e&&"all"==t.o.library||-1===e.indexOf("image")&&$(this).remove()}),void i.$el.val("image").trigger("change")):!1}),acf.media.frame.on("select",function(){if(selection=e.frame.state().get("selection"),selection){var i=0;selection.each(function(a){if(i++,i>1){var n=e.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"),e.div=s.next(".row").find(r)}var c={id:a.id,url:a.attributes.url};a.attributes.sizes&&a.attributes.sizes[t.o.preview_size]&&(c.url=a.attributes.sizes[t.o.preview_size].url),acf.fields.image.add(c)})}}),acf.media.frame.open(),!1},text:{title_add:"Select Image",title_edit:"Edit Image"}},$(document).on("click",".acf-image-uploader .acf-button-edit",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).edit()}),$(document).on("click",".acf-image-uploader .acf-button-delete",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).remove()}),$(document).on("click",".acf-image-uploader .add-image",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).popup()})}(jQuery),function($){acf.fields.radio={$el:null,$input:null,$other:null,farbtastic:null,set:function(e){return $.extend(this,e),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())}},$(document).on("change",'.acf-radio-list input[type="radio"]',function(e){acf.fields.radio.set({$el:$(this).closest(".acf-radio-list")}).change()})}(jQuery),function($){acf.fields.relationship={$el:null,$input:null,$left:null,$right:null,o:{},timeout:null,set:function(e){return $.extend(this,e),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 e=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(){e.$input.trigger("change")}});var t=this.$el;this.$left.find(".relationship_list").scrollTop(0).on("scroll",function(i){if(!t.hasClass("loading")&&!t.hasClass("no-results")&&$(this).scrollTop()+$(this).innerHeight()>=$(this).get(0).scrollHeight){var a=parseInt(t.attr("data-paged"));t.attr("data-paged",a+1),e.set({$el:t}).fetch()}}),this.fetch()}},fetch:function(){var e=this,t=this.$el;t.addClass("loading"),$.ajax({url:acf.o.ajaxurl,type:"post",dataType:"json",data:$.extend({action:"acf/fields/relationship/query_posts",post_id:acf.o.post_id,nonce:acf.o.nonce},this.o),success:function(i){e.set({$el:t}).render(i)}})},render:function(e){var t=this;return this.$el.removeClass("no-results").removeClass("loading"),1==this.o.paged&&this.$el.find(".relationship_left li:not(.load-more)").remove(),e&&e.html?(this.$el.find(".relationship_left .load-more").before(e.html),e.next_page_exists||this.$el.addClass("no-results"),void this.$left.find("a").each(function(){var e=$(this).attr("data-post_id");t.$right.find('a[data-post_id="'+e+'"]').exists()&&$(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=["<li>",'<a href="#" data-post_id="'+e.attr("data-post_id")+'">',e.html()+'<span class="acf-button-remove"></span>',"</a>",'<input type="hidden" name="'+this.$input.attr("name")+'[]" value="'+e.attr("data-post_id")+'" />',"</li>"].join("");this.$right.find(".relationship_list").append(a),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")}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf_relationship").each(function(){acf.fields.relationship.set({$el:$(this)}).init()})}),$(document).on("change",".acf_relationship .select-post_type",function(e){var t=$(this).val(),i=$(this).closest(".acf_relationship");i.attr("data-post_type",t),i.attr("data-paged",1),acf.fields.relationship.set({$el:i}).fetch()}),$(document).on("click",".acf_relationship .relationship_left .relationship_list a",function(e){e.preventDefault(),acf.fields.relationship.set({$el:$(this).closest(".acf_relationship")}).add($(this)),$(this).blur()}),$(document).on("click",".acf_relationship .relationship_right .relationship_list a",function(e){e.preventDefault(),acf.fields.relationship.set({$el:$(this).closest(".acf_relationship")}).remove($(this)),$(this).blur()}),$(document).on("keyup",".acf_relationship input.relationship_search",function(e){var t=$(this).val(),i=$(this).closest(".acf_relationship");i.attr("data-s",t),i.attr("data-paged",1),clearTimeout(acf.fields.relationship.timeout),acf.fields.relationship.timeout=setTimeout(function(){acf.fields.relationship.set({$el:i}).fetch()},500)}),$(document).on("keypress",".acf_relationship input.relationship_search",function(e){13==e.which&&e.preventDefault()})}(jQuery),function($){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(e){var t=this,i=e.closest(".acf-tab-wrap").parent(),a=e.attr("data-key");e.parent("li").addClass("active").siblings("li").removeClass("active"),i.children(".field_type-tab").each(function(){var e=$(this);e.attr("data-field_key")==a?t.show_tab_fields($(this)):t.hide_tab_fields($(this))})},show_tab_fields:function(e){e.nextUntil(".field_type-tab").each(function(){$(this).removeClass("acf-tab_group-hide").addClass("acf-tab_group-show"),$(document).trigger("acf/fields/tab/show",[$(this)])})},hide_tab_fields:function(e){e.nextUntil(".field_type-tab").each(function(){$(this).removeClass("acf-tab_group-show").addClass("acf-tab_group-hide"),$(document).trigger("acf/fields/tab/hide",[$(this)])})},refresh:function(e){var t=this;e.find(".acf-tab-group").each(function(){$(this).find(".acf-tab-button:first").each(function(){t.toggle($(this))})})}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf-tab").each(function(){acf.fields.tab.add_tab($(this))}),acf.fields.tab.refresh($(t))}),$(document).on("click",".acf-tab-button",function(e){e.preventDefault(),acf.fields.tab.toggle($(this)),$(this).trigger("blur")}),$(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))}}),$(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($){acf.validation={status:!0,disabled:!1,run:function(){var e=this;e.status=!0,$(".field.required, .form-field.required").each(function(){e.validate($(this))})},show_spinner:function(e){if(e.exists()){var t=acf.o.wp_version;parseFloat(t)>=4.2?e.addClass("is-active"):e.css("display","inline-block")}},hide_spinner:function(e){if(e.exists()){var t=acf.o.wp_version;parseFloat(t)>=4.2?e.removeClass("is-active"):e.css("display","none")}},validate:function(e){var t=!1,i=null;if(e.data("validation",!0),e.is(":hidden")&&(t=!0,e.hasClass("acf-tab_group-hide"))){t=!1;var a=e.prevAll(".field_type-tab:first"),n=e.prevAll(".acf-tab-wrap:first");a.hasClass("acf-conditional_logic-hide")?t=!0:i=n.find('.acf-tab-button[data-key="'+a.attr("data-field_key")+'"]')}if(e.hasClass("acf-conditional_logic-hide")&&(t=!0),e.closest(".postbox.acf-hidden").exists()&&(t=!0),!t){if(""==e.find('input[type="text"], input[type="email"], input[type="number"], input[type="hidden"], textarea').val()&&e.data("validation",!1),e.find(".acf_wysiwyg").exists()&&"object"==typeof tinyMCE){e.data("validation",!0);var s=e.find(".wp-editor-area").attr("id"),o=tinyMCE.get(s);o&&!o.getContent()&&e.data("validation",!1)}if(e.find("select").exists()&&(e.data("validation",!0),"null"!=e.find("select").val()&&e.find("select").val()||e.data("validation",!1)),e.find('input[type="radio"]').exists()&&(e.data("validation",!1),e.find('input[type="radio"]:checked').exists()&&e.data("validation",!0)),e.find('input[type="checkbox"]').exists()&&(e.data("validation",!1),e.find('input[type="checkbox"]:checked').exists()&&e.data("validation",!0)),e.find(".acf_relationship").exists()&&(e.data("validation",!1),e.find(".acf_relationship .relationship_right input").exists()&&e.data("validation",!0)),e.find(".repeater").exists()&&(e.data("validation",!1),e.find(".repeater tr.row").exists()&&e.data("validation",!0)),e.find(".acf-gallery").exists()&&(e.data("validation",!1),e.find(".acf-gallery .thumbnail").exists()&&e.data("validation",!0)),$(document).trigger("acf/validate_field",[e]),!e.data("validation")){if(this.status=!1,e.closest(".field").addClass("error"),e.data("validation_message")){var l=e.find("p.label:first"),r=null;l.children(".acf-error-message").remove(),l.append('<span class="acf-error-message"><i class="bit"></i>'+e.data("validation_message")+"</span>")}i&&i.trigger("click")}}}},$(document).on("focus click",".field.required input, .field.required textarea, .field.required select",function(e){
2
- $(this).closest(".field").removeClass("error")}),$(document).on("click","#save-post",function(){acf.validation.disabled=!0}),$(document).on("submit","#post",function(){if(acf.validation.disabled)return!0;if(acf.validation.run(),!acf.validation.status){var e=$(this);return e.siblings("#message").remove(),e.before('<div id="message" class="error"><p>'+acf.l10n.validation.error+"</p></div>"),$("#submitdiv").exists()&&($("#submitdiv").find(".disabled").removeClass("disabled"),$("#submitdiv").find(".button-disabled").removeClass("button-disabled"),$("#submitdiv").find(".button-primary-disabled").removeClass("button-primary-disabled"),acf.validation.hide_spinner($("#submitdiv .spinner"))),!1}return $(".acf_postbox.acf-hidden").remove(),!0})}(jQuery),function($){var e=acf.fields.wysiwyg={$el:null,$textarea:null,o:{},set:function(e){return $.extend(this,e),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 e=this.get_toolbar(),t="mceAddControl",i="theme_advanced_buttons{i}",a=$.extend({},tinyMCE.settings);if(4==tinymce.majorVersion&&(t="mceAddEditor",i="toolbar{i}"),e)for(var n=1;5>n;n++){var s="";acf.helpers.isset(e,"theme_advanced_buttons"+n)&&(s=e["theme_advanced_buttons"+n]),tinyMCE.settings[i.replace("{i}",n)]=s}tinyMCE.execCommand(t,!1,this.o.id),$(document).trigger("acf/wysiwyg/load",this.o.id),this.add_events(),tinyMCE.settings=a,wpActiveEditor=null}},add_events:function(){var e=this.o.id,t=tinyMCE.get(e);if(t){var i=$("#wp-"+e+"-wrap"),a=$(t.getBody());i.on("click",function(){$(document).trigger("acf/wysiwyg/click",e)}),a.on("focus",function(){$(document).trigger("acf/wysiwyg/focus",e)}),a.on("blur",function(){$(document).trigger("acf/wysiwyg/blur",e)})}},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}};$(document).on("acf/setup_fields",function(t,i){e.has_tinymce()&&($(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).destroy()}),setTimeout(function(){$(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).init()})},0))}),$(document).on("acf/remove_fields",function(t,i){e.has_tinymce()&&i.find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).destroy()})}),$(document).on("acf/wysiwyg/click",function(e,t){wpActiveEditor=t,container=$("#wp-"+t+"-wrap").closest(".field").removeClass("error")}),$(document).on("acf/wysiwyg/focus",function(e,t){wpActiveEditor=t,container=$("#wp-"+t+"-wrap").closest(".field").removeClass("error")}),$(document).on("acf/wysiwyg/blur",function(e,t){wpActiveEditor=null;var i=tinyMCE.get(t);if(i){var a=i.getElement();i.save(),$(a).trigger("change")}}),$(document).on("acf/sortable_start",function(t,i){e.has_tinymce()&&$(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).destroy()})}),$(document).on("acf/sortable_stop",function(t,i){e.has_tinymce()&&$(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).init()})}),$(window).on("load",function(){if(e.has_tinymce()){var t=$("#wp-content-wrap").exists(),i=$("#wp-acf_settings-wrap").exists();mode="tmce",i&&$("#wp-acf_settings-wrap").hasClass("html-active")&&(mode="html"),setTimeout(function(){i&&"html"==mode&&$("#acf_settings-tmce").trigger("click")},1),setTimeout(function(){i&&"html"==mode&&$("#acf_settings-html").trigger("click"),t&&e.set({$el:$("#wp-content-wrap")}).add_events()},11)}}),$(document).on("click",".acf_wysiwyg a.mce_fullscreen",function(){var e=$(this).closest(".acf_wysiwyg"),t=e.attr("data-upload");"no"==t&&$("#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($){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;i<t;i++){if(e[i]===n||a[e[i]]===n)return!1;a=a[e[i]]}return!0},acf.helpers.get_atts=function(e){var t={};return $.each(e[0].attributes,function(e,i){"data-"==i.name.substr(0,5)&&(t[i.name.replace("data-","")]=i.value)}),t},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(e,t){return t.children().each(function(){$(this).width($(this).width())}),t},acf.helpers.is_clone_field=function(e){return!(!e.attr("name")||-1==e.attr("name").indexOf("[acfcloneindex]"))},acf.helpers.add_message=function(e,t){var e=$('<div class="acf-message-wrapper"><div class="message updated"><p>'+e+"</p></div></div>");t.prepend(e),setTimeout(function(){e.animate({opacity:0},250,function(){e.remove()})},1500)},$.fn.exists=function(){return $(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 e=wp.media.view.AttachmentCompat.prototype;e.orig_render=e.render,e.orig_dispose=e.dispose,e.className="compat-item acf_postbox no_box",e.render=function(){var e=this;return e.ignore_render?this:(this.orig_render(),setTimeout(function(){var t=e.$el.closest(".media-modal");if(!t.hasClass("acf-media-modal")&&!t.find(".media-frame-router .acf-expand-details").exists()){var i=$(['<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(""));i.on("click",function(e){e.preventDefault(),t.hasClass("acf-expanded")?t.removeClass("acf-expanded"):t.addClass("acf-expanded")}),t.find(".media-frame-router").append(i)}},0),clearTimeout(acf.media.render_timout),acf.media.render_timout=setTimeout(function(){$(document).trigger("acf/setup_fields",[e.$el])},50),this)},e.dispose=function(){$(document).trigger("acf/remove_fields",[this.$el]),this.orig_dispose()},e.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 e=this;$(document).on("change",".field input, .field textarea, .field select",function(){$("#acf-has-changed").exists()&&$("#acf-has-changed").val(1),e.change($(this))}),$(document).on("acf/setup_fields",function(t,i){e.refresh($(i))}),e.refresh()},change:function(e){var t=this,i=e.closest(".field"),a=i.attr("data-field_key");$.each(this.items,function(e,i){$.each(i.rules,function(e,n){n.field==a&&t.refresh_field(i)})})},refresh_field:function(e){var t=this,i=$(".field_key-"+e.field);i.each(function(){var i=!0;"any"==e.allorany&&(i=!1);var a=$(this),n=!0;$.each(e.rules,function(s,o){var l=$(".field_key-"+o.field);l.hasClass("sub_field")&&(l=a.siblings(".field_key-"+o.field),n=!1,l.exists()||(a.parents("tr").each(function(){return l=$(this).find(".field_key-"+o.field),l.exists()?!1:void 0}),n=!0));var r=a.parent("tr").parent().parent("table").parent(".layout");r.exists()&&(n=!0,a.is("th")&&l.is("th")&&(l=a.closest(".layout").find("td.field_key-"+o.field)));var r=a.parent("tr").parent().parent("table").parent(".repeater");r.exists()&&"1"==r.attr("data-max_rows")&&(n=!0,a.is("th")&&l.is("th")&&(l=a.closest("table").find("td.field_key-"+o.field)));var c=t.calculate(o,l,a);if("all"==e.allorany){if(0==c)return i=!1,!1}else if(1==c)return i=!0,!1}),a.removeClass("acf-conditional_logic-hide acf-conditional_logic-show acf-show-blank"),i?(a.find("input, textarea, select").removeAttr("disabled"),a.addClass("acf-conditional_logic-show"),$(document).trigger("acf/conditional_logic/show",[a,e])):(a.find("input, textarea, select").attr("disabled","disabled"),a.addClass("acf-conditional_logic-hide"),n||a.addClass("acf-show-blank"),$(document).trigger("acf/conditional_logic/hide",[a,e]))})},refresh:function(e){e=e||$("body");var t=this;$.each(this.items,function(i,a){$.each(a.rules,function(i,n){e.find('.field[data-field_key="'+a.field+'"]').exists()&&t.refresh_field(a)})})},calculate:function(e,t,i){var a=!1;if(t.hasClass("field_type-true_false")||t.hasClass("field_type-checkbox")||t.hasClass("field_type-radio")){var n=t.find('input[value="'+e.value+'"]:checked').exists();"=="==e.operator?n&&(a=!0):n||(a=!0)}else{var s=t.find("input, textarea, select").last().val();$.isArray(s)||(s=[s]),"=="==e.operator?$.inArray(e.value,s)>-1&&(a=!0):$.inArray(e.value,s)<0&&(a=!0)}return a}},$(document).ready(function(){acf.conditional_logic.init(),$(".acf_postbox > .inside > .options").each(function(){$(this).closest(".acf_postbox").addClass($(this).attr("data-layout"))}),$('#metakeyselect option[value^="field_"]').remove()}),$(window).on("load",function(){acf.media.init(),setTimeout(function(){try{$.isNumeric(acf.o.post_id)&&(wp.media.view.settings.post.id=acf.o.post_id)}catch(e){}$(document).trigger("acf/setup_fields",[$("#poststuff")])},10)}),acf.fields.gallery={add:function(){},edit:function(){},update_count:function(){},hide_selected_items:function(){},text:{title_add:"Select Images"}}}(jQuery),function($){function e(){var e=[];$(".categorychecklist input:checked, .acf-taxonomy-field input:checked, .acf-taxonomy-field option:selected").each(function(){$(this).is(":hidden")||$(this).is(":disabled")||$(this).closest(".media-frame").exists()||$(this).closest(".acf-taxonomy-field").exists()&&"0"==$(this).closest(".acf-taxonomy-field").attr("data-load_save")||-1===e.indexOf($(this).val())&&e.push($(this).val())}),acf.screen.post_category=e,acf.screen.taxonomy=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},$(document).ready(function(){if(acf.screen.post_id=acf.o.post_id,acf.screen.nonce=acf.o.nonce,$("#icl-als-first").length>0){var e=$("#icl-als-first").children("a").attr("href"),t=new RegExp("lang=([^&#]*)"),i=t.exec(e);acf.screen.lang=i[1]}}),$(document).on("acf/update_field_groups",function(){return acf.screen.post_id&&$.isNumeric(acf.screen.post_id)?void $.ajax({url:ajaxurl,data:acf.screen,type:"post",dataType:"json",success:function(e){return e?($(".acf_postbox").addClass("acf-hidden"),$(".acf_postbox-toggle").addClass("acf-hidden"),0==e.length?!1:($.each(e,function(e,t){var i=$("#acf_"+t),a=$('#adv-settings .acf_postbox-toggle[for="acf_'+t+'-hide"]');i.removeClass("acf-hidden hide-if-js"),a.removeClass("acf-hidden"),a.find('input[type="checkbox"]').attr("checked","checked"),i.find(".acf-replace-with-fields").each(function(){var e=$(this);$.ajax({url:ajaxurl,data:{action:"acf/post/render_fields",acf_id:t,post_id:acf.o.post_id,nonce:acf.o.nonce},type:"post",dataType:"html",success:function(t){e.replaceWith(t),$(document).trigger("acf/setup_fields",i)}})})}),void $.ajax({url:ajaxurl,data:{action:"acf/post/get_style",acf_id:e[0],nonce:acf.o.nonce},type:"post",dataType:"html",success:function(e){$("#acf_style").html(e)}}))):!1}}):!1}),$(document).on("change","#page_template",function(){acf.screen.page_template=$(this).val(),$(document).trigger("acf/update_field_groups")}),$(document).on("change","#parent_id",function(){var e=$(this).val();""!=e?(acf.screen.page_type="child",acf.screen.page_parent=e):(acf.screen.page_type="parent",acf.screen.page_parent=0),$(document).trigger("acf/update_field_groups")}),$(document).on("change",'#post-formats-select input[type="radio"]',function(){var e=$(this).val();"0"==e&&(e="standard"),acf.screen.post_format=e,$(document).trigger("acf/update_field_groups")}),$(document).on("change",".categorychecklist input, .acf-taxonomy-field input, .acf-taxonomy-field select",function(){$(this).closest(".acf-taxonomy-field").exists()&&"0"==$(this).closest(".acf-taxonomy-field").attr("data-save")||$(this).closest(".media-frame").exists()||setTimeout(function(){e()},1)})}(jQuery),function($){var e=acf.fields.color_picker={$el:null,$input:null,set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="text"]'),this},init:function(){var e=this.$input;acf.helpers.is_clone_field(e)||this.$input.wpColorPicker()}};$(document).on("acf/setup_fields",function(t,i){$(i).find(".acf-color_picker").each(function(){e.set({$el:$(this)}).init()})})}(jQuery),function($){acf.fields.date_picker={$el:null,$input:null,$hidden:null,o:{},set:function(e){return $.extend(this,e),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 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(e),this.$input.datepicker("option","dateFormat",this.o.display_format),$("body > #ui-datepicker-div").length>0&&$("#ui-datepicker-div").wrap('<div class="ui-acf" />')}},blur:function(){this.$input.val()||this.$hidden.val("")}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf-date_picker").each(function(){acf.fields.date_picker.set({$el:$(this)}).init()})}),$(document).on("blur",'.acf-date_picker input[type="text"]',function(e){acf.fields.date_picker.set({$el:$(this).parent()}).blur()})}(jQuery),function($){var e=acf.media;acf.fields.file={$el:null,$input:null,o:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this.o.multiple=!!this.$el.closest(".repeater").exists(),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(t){var i=e.div;i.find(".acf-file-icon").attr("src",t.icon),i.find(".acf-file-title").text(t.title),i.find(".acf-file-name").text(t.name).attr("href",t.url),i.find(".acf-file-size").text(t.size),i.find(".acf-file-value").val(t.id).trigger("change"),i.addClass("active"),i.closest(".field").removeClass("error")},new_frame:function(t){return e.div=this.$el,e.clear_frame(),t.states=[],t.states.push(new wp.media.controller.Library({library:wp.media.query(this.o.query),multiple:t.multiple,title:t.title,priority:20,filterable:"all"})),acf.helpers.isset(wp,"media","controller","EditImage")&&t.states.push(new wp.media.controller.EditImage),e.frame=wp.media(t),e.frame.on("content:render:edit-image",function(){var e=this.state().get("image"),t=new wp.media.view.EditImage({model:e,controller:this}).render();this.content.set(t),t.loadEditor()},e.frame),e.frame.on("toolbar:create:select",function(e){e.view=new wp.media.view.Toolbar.Select({text:t.button.text,controller:this})},e.frame),e.frame},edit:function(){var t=this.$input.val();this.new_frame({title:acf.l10n.file.edit,multiple:!1,button:{text:acf.l10n.file.update}}),e.frame.on("open",function(){"browse"!=e.frame.content._mode&&e.frame.content.mode("browse"),e.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var i=e.frame.state().get("selection"),a=wp.media.attachment(t);$.isEmptyObject(a.changed)&&a.fetch(),i.add(a)}),e.frame.on("close",function(){e.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 t=this;return this.new_frame({title:acf.l10n.file.select,multiple:t.o.multiple,button:{text:acf.l10n.file.select}}),acf.media.frame.on("content:activate",function(){var e=null,i=null;try{e=acf.media.frame.content.get().toolbar,i=e.get("filters")}catch(a){}return i?void("uploadedTo"==t.o.library&&(i.$el.find('option[value="uploaded"]').remove(),i.$el.after("<span>"+acf.l10n.file.uploadedTo+"</span>"),$.each(i.filters,function(e,t){t.props.uploadedTo=acf.o.post_id}))):!1}),acf.media.frame.on("select",function(){if(selection=e.frame.state().get("selection"),selection){var t=0;selection.each(function(i){if(t++,t>1){var a=e.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"),e.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}},$(document).on("click",".acf-file-uploader .acf-button-edit",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).edit()}),$(document).on("click",".acf-file-uploader .acf-button-delete",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).remove()}),$(document).on("click",".acf-file-uploader .add-file",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).popup()})}(jQuery),function($){acf.fields.google_map={$el:null,$input:null,o:{},api:{sensor:!1,libraries:"places"},ready:!1,geocoder:!1,map:!1,maps:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find(".input-address"),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()}},$(document).on("acf/setup_fields",function(e,t){var i=acf.fields.google_map,a=$(t).find(".acf-google-map");return a.exists()?acf.helpers.isset(window,"google","load")?acf.helpers.isset(window,"google","maps","places")?(a.each(function(){acf.fields.google_map.set({$el:$(this)}).init()}),!0):(google.load("maps","3",{other_params:$.param(i.api),callback:function(){a.each(function(){acf.fields.google_map.set({$el:$(this)}).init()})}}),!1):($.getScript("https://www.google.com/jsapi",function(){google.load("maps","3",{other_params:$.param(i.api),callback:function(){a.each(function(){acf.fields.google_map.set({$el:$(this)}).init()})}})}),!1):!1}),$(document).on("click",".acf-google-map .acf-sprite-remove",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).clear(),$(this).blur()}),$(document).on("click",".acf-google-map .acf-sprite-locate",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).locate(),$(this).blur()}),$(document).on("click",".acf-google-map .title h4",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).edit()}),$(document).on("keydown",".acf-google-map .search",function(e){return 13==e.which?!1:void 0}),$(document).on("blur",".acf-google-map .search",function(e){var t=$(this).closest(".acf-google-map");t.find(".input-lat").val()&&t.addClass("active")}),$(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($){var e=acf.media;acf.fields.image={$el:null,$input:null,o:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this.o.multiple=!!this.$el.closest(".repeater").exists(),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(t){var i=e.div;i.find(".acf-image-image").attr("src",t.url),i.find(".acf-image-value").val(t.id).trigger("change"),i.addClass("active"),i.closest(".field").removeClass("error")},new_frame:function(t){return e.div=this.$el,e.clear_frame(),t.states=[],t.states.push(new wp.media.controller.Library({library:wp.media.query(this.o.query),multiple:t.multiple,title:t.title,priority:20,filterable:"all"})),acf.helpers.isset(wp,"media","controller","EditImage")&&t.states.push(new wp.media.controller.EditImage),e.frame=wp.media(t),e.frame.on("content:render:edit-image",function(){var e=this.state().get("image"),t=new wp.media.view.EditImage({model:e,controller:this}).render();this.content.set(t),t.loadEditor()},e.frame),e.frame.on("toolbar:create:select",function(e){e.view=new wp.media.view.Toolbar.Select({text:t.button.text,controller:this})},e.frame),e.frame},edit:function(){var t=this.$input.val();this.new_frame({title:acf.l10n.image.edit,multiple:!1,button:{text:acf.l10n.image.update}}),e.frame.on("open",function(){"browse"!=e.frame.content._mode&&e.frame.content.mode("browse"),e.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var i=e.frame.state().get("selection"),a=wp.media.attachment(t);$.isEmptyObject(a.changed)&&a.fetch(),i.add(a)}),e.frame.on("close",function(){e.frame.$el.closest(".media-modal").removeClass("acf-media-modal")}),e.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 t=this;return this.new_frame({title:acf.l10n.image.select,multiple:t.o.multiple,button:{text:acf.l10n.image.select}}),e.frame.on("content:activate",function(){var e=null,i=null;try{e=acf.media.frame.content.get().toolbar,i=e.get("filters")}catch(a){}return i?($.each(i.filters,function(e,t){t.props.type="image"}),"uploadedTo"==t.o.library&&(i.$el.find('option[value="uploaded"]').remove(),i.$el.after("<span>"+acf.l10n.image.uploadedTo+"</span>"),$.each(i.filters,function(e,t){t.props.uploadedTo=acf.o.post_id})),i.$el.find("option").each(function(){var e=$(this).attr("value");"uploaded"==e&&"all"==t.o.library||-1===e.indexOf("image")&&$(this).remove()}),void i.$el.val("image").trigger("change")):!1}),acf.media.frame.on("select",function(){if(selection=e.frame.state().get("selection"),selection){var i=0;selection.each(function(a){if(i++,i>1){var n=e.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"),e.div=s.next(".row").find(r)}var c={id:a.id,url:a.attributes.url};a.attributes.sizes&&a.attributes.sizes[t.o.preview_size]&&(c.url=a.attributes.sizes[t.o.preview_size].url),acf.fields.image.add(c)})}}),acf.media.frame.open(),!1},text:{title_add:"Select Image",title_edit:"Edit Image"}},$(document).on("click",".acf-image-uploader .acf-button-edit",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).edit()}),$(document).on("click",".acf-image-uploader .acf-button-delete",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).remove()}),$(document).on("click",".acf-image-uploader .add-image",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).popup()})}(jQuery),function($){acf.fields.radio={$el:null,$input:null,$other:null,farbtastic:null,set:function(e){return $.extend(this,e),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())}},$(document).on("change",'.acf-radio-list input[type="radio"]',function(e){acf.fields.radio.set({$el:$(this).closest(".acf-radio-list")}).change()})}(jQuery),function($){acf.fields.relationship={$el:null,$input:null,$left:null,$right:null,o:{},timeout:null,set:function(e){return $.extend(this,e),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 e=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(){e.$input.trigger("change")}});var t=this.$el;this.$left.find(".relationship_list").scrollTop(0).on("scroll",function(i){if(!t.hasClass("loading")&&!t.hasClass("no-results")&&$(this).scrollTop()+$(this).innerHeight()>=$(this).get(0).scrollHeight){var a=parseInt(t.attr("data-paged"));t.attr("data-paged",a+1),e.set({$el:t}).fetch()}}),this.fetch()}},fetch:function(){var e=this,t=this.$el;t.addClass("loading"),$.ajax({url:acf.o.ajaxurl,type:"post",dataType:"json",data:$.extend({action:"acf/fields/relationship/query_posts",post_id:acf.o.post_id,nonce:acf.o.nonce},this.o),success:function(i){e.set({$el:t}).render(i)}})},render:function(e){var t=this;return this.$el.removeClass("no-results").removeClass("loading"),1==this.o.paged&&this.$el.find(".relationship_left li:not(.load-more)").remove(),e&&e.html?(this.$el.find(".relationship_left .load-more").before(e.html),e.next_page_exists||this.$el.addClass("no-results"),void this.$left.find("a").each(function(){var e=$(this).attr("data-post_id");t.$right.find('a[data-post_id="'+e+'"]').exists()&&$(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=["<li>",'<a href="#" data-post_id="'+e.attr("data-post_id")+'">',e.html()+'<span class="acf-button-remove"></span>',"</a>",'<input type="hidden" name="'+this.$input.attr("name")+'[]" value="'+e.attr("data-post_id")+'" />',"</li>"].join("");this.$right.find(".relationship_list").append(a),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")}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf_relationship").each(function(){acf.fields.relationship.set({$el:$(this)}).init()})}),$(document).on("change",".acf_relationship .select-post_type",function(e){var t=$(this).val(),i=$(this).closest(".acf_relationship");i.attr("data-post_type",t),i.attr("data-paged",1),acf.fields.relationship.set({$el:i}).fetch()}),$(document).on("click",".acf_relationship .relationship_left .relationship_list a",function(e){e.preventDefault(),acf.fields.relationship.set({$el:$(this).closest(".acf_relationship")}).add($(this)),$(this).blur()}),$(document).on("click",".acf_relationship .relationship_right .relationship_list a",function(e){e.preventDefault(),acf.fields.relationship.set({$el:$(this).closest(".acf_relationship")}).remove($(this)),$(this).blur()}),$(document).on("keyup",".acf_relationship input.relationship_search",function(e){var t=$(this).val(),i=$(this).closest(".acf_relationship");i.attr("data-s",t),i.attr("data-paged",1),clearTimeout(acf.fields.relationship.timeout),acf.fields.relationship.timeout=setTimeout(function(){acf.fields.relationship.set({$el:i}).fetch()},500)}),$(document).on("keypress",".acf_relationship input.relationship_search",function(e){13==e.which&&e.preventDefault()})}(jQuery),function($){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(e){var t=this,i=e.closest(".acf-tab-wrap").parent(),a=e.attr("data-key");e.parent("li").addClass("active").siblings("li").removeClass("active"),i.children(".field_type-tab").each(function(){var e=$(this);e.attr("data-field_key")==a?t.show_tab_fields($(this)):t.hide_tab_fields($(this))})},show_tab_fields:function(e){e.nextUntil(".field_type-tab").each(function(){$(this).removeClass("acf-tab_group-hide").addClass("acf-tab_group-show"),$(document).trigger("acf/fields/tab/show",[$(this)])})},hide_tab_fields:function(e){e.nextUntil(".field_type-tab").each(function(){$(this).removeClass("acf-tab_group-show").addClass("acf-tab_group-hide"),$(document).trigger("acf/fields/tab/hide",[$(this)])})},refresh:function(e){var t=this;e.find(".acf-tab-group").each(function(){$(this).find(".acf-tab-button:first").each(function(){t.toggle($(this))})})}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf-tab").each(function(){acf.fields.tab.add_tab($(this))}),acf.fields.tab.refresh($(t))}),$(document).on("click",".acf-tab-button",function(e){e.preventDefault(),acf.fields.tab.toggle($(this)),$(this).trigger("blur")}),$(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))}}),$(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($){acf.validation={status:!0,disabled:!1,run:function(){var e=this;e.status=!0,$(".field.required, .form-field.required").each(function(){e.validate($(this))})},show_spinner:function(e){if(e.exists()){var t=acf.o.wp_version;parseFloat(t)>=4.2?e.addClass("is-active"):e.css("display","inline-block")}},hide_spinner:function(e){if(e.exists()){var t=acf.o.wp_version;parseFloat(t)>=4.2?e.removeClass("is-active"):e.css("display","none")}},validate:function(e){var t=!1,i=null;if(e.data("validation",!0),e.is(":hidden")&&(t=!0,e.hasClass("acf-tab_group-hide"))){t=!1;var a=e.prevAll(".field_type-tab:first"),n=e.prevAll(".acf-tab-wrap:first");a.hasClass("acf-conditional_logic-hide")?t=!0:i=n.find('.acf-tab-button[data-key="'+a.attr("data-field_key")+'"]')}if(e.hasClass("acf-conditional_logic-hide")&&(t=!0),e.closest(".postbox.acf-hidden").exists()&&(t=!0),!t){if(""==e.find('input[type="text"], input[type="email"], input[type="number"], input[type="hidden"], textarea').val()&&e.data("validation",!1),e.find(".acf_wysiwyg").exists()&&"object"==typeof tinyMCE){e.data("validation",!0);var s=e.find(".wp-editor-area").attr("id"),o=tinyMCE.get(s);o&&!o.getContent()&&e.data("validation",!1)}if(e.find("select").exists()&&(e.data("validation",!0),"null"!=e.find("select").val()&&e.find("select").val()||e.data("validation",!1)),e.find('input[type="radio"]').exists()&&(e.data("validation",!1),
2
+ e.find('input[type="radio"]:checked').exists()&&e.data("validation",!0)),e.find('input[type="checkbox"]').exists()&&(e.data("validation",!1),e.find('input[type="checkbox"]:checked').exists()&&e.data("validation",!0)),e.find(".acf_relationship").exists()&&(e.data("validation",!1),e.find(".acf_relationship .relationship_right input").exists()&&e.data("validation",!0)),e.find(".repeater").exists()&&(e.data("validation",!1),e.find(".repeater tr.row").exists()&&e.data("validation",!0)),e.find(".acf-gallery").exists()&&(e.data("validation",!1),e.find(".acf-gallery .thumbnail").exists()&&e.data("validation",!0)),$(document).trigger("acf/validate_field",[e]),!e.data("validation")){if(this.status=!1,e.closest(".field").addClass("error"),e.data("validation_message")){var l=e.find("p.label:first"),r=null;l.children(".acf-error-message").remove(),l.append('<span class="acf-error-message"><i class="bit"></i>'+e.data("validation_message")+"</span>")}i&&i.trigger("click")}}}},$(document).on("focus click",".field.required input, .field.required textarea, .field.required select",function(e){$(this).closest(".field").removeClass("error")}),$(document).on("click","#save-post",function(){acf.validation.disabled=!0}),$(document).on("submit","#post",function(){if(acf.validation.disabled)return!0;if(acf.validation.run(),!acf.validation.status){var e=$(this);return e.siblings("#message").remove(),e.before('<div id="message" class="error"><p>'+acf.l10n.validation.error+"</p></div>"),$("#submitdiv").exists()&&($("#submitdiv").find(".disabled").removeClass("disabled"),$("#submitdiv").find(".button-disabled").removeClass("button-disabled"),$("#submitdiv").find(".button-primary-disabled").removeClass("button-primary-disabled"),acf.validation.hide_spinner($("#submitdiv .spinner"))),!1}return $(".acf_postbox.acf-hidden").remove(),!0})}(jQuery),function($){var e=acf.fields.wysiwyg={$el:null,$textarea:null,o:{},set:function(e){return $.extend(this,e),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.o.id,i=this.get_toolbar(),a="mceAddControl",n="theme_advanced_buttons{i}",s=$.extend({},tinyMCE.settings);if(4==tinymce.majorVersion&&(a="mceAddEditor",n="toolbar{i}"),i)for(var o=1;5>o;o++){var l="";acf.helpers.isset(i,"theme_advanced_buttons"+o)&&(l=i["theme_advanced_buttons"+o]),tinyMCE.settings[n.replace("{i}",o)]=l}tinyMCE.execCommand(a,!1,t),$(document).trigger("acf/wysiwyg/load",t),setTimeout(function(){e.add_events(t)},100),tinyMCE.settings=s,wpActiveEditor=null}},add_events:function(e){var t=tinyMCE.get(e);if(t){var i=$("#wp-"+e+"-wrap"),a=$(t.getBody());i.on("click",function(){$(document).trigger("acf/wysiwyg/click",e)}),a.on("focus",function(){$(document).trigger("acf/wysiwyg/focus",e)}),a.on("blur",function(){$(document).trigger("acf/wysiwyg/blur",e)})}},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}};$(document).on("acf/setup_fields",function(t,i){e.has_tinymce()&&($(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).destroy()}),setTimeout(function(){$(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).init()})},0))}),$(document).on("acf/remove_fields",function(t,i){e.has_tinymce()&&i.find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).destroy()})}),$(document).on("acf/wysiwyg/click",function(e,t){wpActiveEditor=t,container=$("#wp-"+t+"-wrap").closest(".field").removeClass("error")}),$(document).on("acf/wysiwyg/focus",function(e,t){wpActiveEditor=t,container=$("#wp-"+t+"-wrap").closest(".field").removeClass("error")}),$(document).on("acf/wysiwyg/blur",function(e,t){wpActiveEditor=null;var i=tinyMCE.get(t);if(i){var a=i.getElement();i.save(),$(a).trigger("change")}}),$(document).on("acf/sortable_start",function(t,i){e.has_tinymce()&&$(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).destroy()})}),$(document).on("acf/sortable_stop",function(t,i){e.has_tinymce()&&$(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).init()})}),$(window).on("load",function(){if(e.has_tinymce()){var t=$("#wp-content-wrap").exists(),i=$("#wp-acf_settings-wrap").exists();mode="tmce",i&&$("#wp-acf_settings-wrap").hasClass("html-active")&&(mode="html"),setTimeout(function(){i&&"html"==mode&&$("#acf_settings-tmce").trigger("click")},1),setTimeout(function(){i&&"html"==mode&&$("#acf_settings-html").trigger("click"),t&&e.add_events("content")},11)}}),$(document).on("click",".acf_wysiwyg a.mce_fullscreen",function(){var e=$(this).closest(".acf_wysiwyg"),t=e.attr("data-upload");"no"==t&&$("#mce_fullscreen_container td.mceToolbar .mce_add_media").remove()})}(jQuery);
js/input/_listener.js ADDED
File without changes
js/input/_listener.min.js ADDED
File without changes
js/input/acf.js ADDED
@@ -0,0 +1,942 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * input.js
3
+ *
4
+ * All javascript needed for ACF to work
5
+ *
6
+ * @type awesome
7
+ * @date 1/08/13
8
+ *
9
+ * @param N/A
10
+ * @return N/A
11
+ */
12
+
13
+ var acf = {
14
+
15
+ // vars
16
+ ajaxurl : '',
17
+ admin_url : '',
18
+ wp_version : '',
19
+ post_id : 0,
20
+ nonce : '',
21
+ l10n : null,
22
+ o : null,
23
+
24
+ // helper functions
25
+ helpers : {
26
+ get_atts : null,
27
+ version_compare : null,
28
+ uniqid : null,
29
+ sortable : null,
30
+ add_message : null,
31
+ is_clone_field : null,
32
+ url_to_object : null
33
+ },
34
+
35
+
36
+ // modules
37
+ validation : null,
38
+ conditional_logic : null,
39
+ media : null,
40
+
41
+
42
+ // fields
43
+ fields : {
44
+ date_picker : null,
45
+ color_picker : null,
46
+ Image : null,
47
+ file : null,
48
+ wysiwyg : null,
49
+ gallery : null,
50
+ relationship : null
51
+ }
52
+ };
53
+
54
+ (function($){
55
+
56
+
57
+ /*
58
+ * acf.helpers.isset
59
+ *
60
+ * description
61
+ *
62
+ * @type function
63
+ * @date 20/07/13
64
+ *
65
+ * @param {mixed} arguments
66
+ * @return {boolean}
67
+ */
68
+
69
+ acf.helpers.isset = function(){
70
+
71
+ var a = arguments,
72
+ l = a.length,
73
+ c = null,
74
+ undef;
75
+
76
+ if (l === 0) {
77
+ throw new Error('Empty isset');
78
+ }
79
+
80
+ c = a[0];
81
+
82
+ for (i = 1; i < l; i++) {
83
+
84
+ if (a[i] === undef || c[ a[i] ] === undef) {
85
+ return false;
86
+ }
87
+
88
+ c = c[ a[i] ];
89
+
90
+ }
91
+
92
+ return true;
93
+
94
+ };
95
+
96
+
97
+ /*
98
+ * acf.helpers.get_atts
99
+ *
100
+ * description
101
+ *
102
+ * @type function
103
+ * @date 1/06/13
104
+ *
105
+ * @param {el} $el
106
+ * @return {object} atts
107
+ */
108
+
109
+ acf.helpers.get_atts = function( $el ){
110
+
111
+ var atts = {};
112
+
113
+ $.each( $el[0].attributes, function( index, attr ) {
114
+
115
+ if( attr.name.substr(0, 5) == 'data-' )
116
+ {
117
+ atts[ attr.name.replace('data-', '') ] = attr.value;
118
+ }
119
+ });
120
+
121
+ return atts;
122
+
123
+ };
124
+
125
+
126
+ /**
127
+ * Simply compares two string version values.
128
+ *
129
+ * Example:
130
+ * versionCompare('1.1', '1.2') => -1
131
+ * versionCompare('1.1', '1.1') => 0
132
+ * versionCompare('1.2', '1.1') => 1
133
+ * versionCompare('2.23.3', '2.22.3') => 1
134
+ *
135
+ * Returns:
136
+ * -1 = left is LOWER than right
137
+ * 0 = they are equal
138
+ * 1 = left is GREATER = right is LOWER
139
+ * And FALSE if one of input versions are not valid
140
+ *
141
+ * @function
142
+ * @param {String} left Version #1
143
+ * @param {String} right Version #2
144
+ * @return {Integer|Boolean}
145
+ * @author Alexey Bass (albass)
146
+ * @since 2011-07-14
147
+ */
148
+
149
+ acf.helpers.version_compare = function(left, right)
150
+ {
151
+ if (typeof left + typeof right != 'stringstring')
152
+ return false;
153
+
154
+ var a = left.split('.')
155
+ , b = right.split('.')
156
+ , i = 0, len = Math.max(a.length, b.length);
157
+
158
+ for (; i < len; i++) {
159
+ if ((a[i] && !b[i] && parseInt(a[i]) > 0) || (parseInt(a[i]) > parseInt(b[i]))) {
160
+ return 1;
161
+ } else if ((b[i] && !a[i] && parseInt(b[i]) > 0) || (parseInt(a[i]) < parseInt(b[i]))) {
162
+ return -1;
163
+ }
164
+ }
165
+
166
+ return 0;
167
+ };
168
+
169
+
170
+ /*
171
+ * Helper: uniqid
172
+ *
173
+ * @description:
174
+ * @since: 3.5.8
175
+ * @created: 17/01/13
176
+ */
177
+
178
+ acf.helpers.uniqid = function()
179
+ {
180
+ var newDate = new Date;
181
+ return newDate.getTime();
182
+ };
183
+
184
+
185
+ /*
186
+ * Helper: url_to_object
187
+ *
188
+ * @description:
189
+ * @since: 4.0.0
190
+ * @created: 17/01/13
191
+ */
192
+
193
+ acf.helpers.url_to_object = function( url ){
194
+
195
+ // vars
196
+ var obj = {},
197
+ pairs = url.split('&');
198
+
199
+
200
+ for( i in pairs )
201
+ {
202
+ var split = pairs[i].split('=');
203
+ obj[decodeURIComponent(split[0])] = decodeURIComponent(split[1]);
204
+ }
205
+
206
+ return obj;
207
+
208
+ };
209
+
210
+
211
+ /*
212
+ * Sortable Helper
213
+ *
214
+ * @description: keeps widths of td's inside a tr
215
+ * @since 3.5.1
216
+ * @created: 10/11/12
217
+ */
218
+
219
+ acf.helpers.sortable = function(e, ui)
220
+ {
221
+ ui.children().each(function(){
222
+ $(this).width($(this).width());
223
+ });
224
+ return ui;
225
+ };
226
+
227
+
228
+ /*
229
+ * is_clone_field
230
+ *
231
+ * @description:
232
+ * @since: 3.5.8
233
+ * @created: 17/01/13
234
+ */
235
+
236
+ acf.helpers.is_clone_field = function( input )
237
+ {
238
+ if( input.attr('name') && input.attr('name').indexOf('[acfcloneindex]') != -1 )
239
+ {
240
+ return true;
241
+ }
242
+
243
+ return false;
244
+ };
245
+
246
+
247
+ /*
248
+ * acf.helpers.add_message
249
+ *
250
+ * @description:
251
+ * @since: 3.2.7
252
+ * @created: 10/07/2012
253
+ */
254
+
255
+ acf.helpers.add_message = function( message, div ){
256
+
257
+ var message = $('<div class="acf-message-wrapper"><div class="message updated"><p>' + message + '</p></div></div>');
258
+
259
+ div.prepend( message );
260
+
261
+ setTimeout(function(){
262
+
263
+ message.animate({
264
+ opacity : 0
265
+ }, 250, function(){
266
+ message.remove();
267
+ });
268
+
269
+ }, 1500);
270
+
271
+ };
272
+
273
+
274
+ /*
275
+ * Exists
276
+ *
277
+ * @description: returns true / false
278
+ * @created: 1/03/2011
279
+ */
280
+
281
+ $.fn.exists = function()
282
+ {
283
+ return $(this).length>0;
284
+ };
285
+
286
+
287
+ /*
288
+ * 3.5 Media
289
+ *
290
+ * @description:
291
+ * @since: 3.5.7
292
+ * @created: 16/01/13
293
+ */
294
+
295
+ acf.media = {
296
+
297
+ div : null,
298
+ frame : null,
299
+ render_timout : null,
300
+
301
+ clear_frame : function(){
302
+
303
+ // validate
304
+ if( !this.frame )
305
+ {
306
+ return;
307
+ }
308
+
309
+
310
+ // detach
311
+ this.frame.detach();
312
+ this.frame.dispose();
313
+
314
+
315
+ // reset var
316
+ this.frame = null;
317
+
318
+ },
319
+ type : function(){
320
+
321
+ // default
322
+ var type = 'thickbox';
323
+
324
+
325
+ // if wp exists
326
+ if( typeof wp !== 'undefined' )
327
+ {
328
+ type = 'backbone';
329
+ }
330
+
331
+
332
+ // return
333
+ return type;
334
+
335
+ },
336
+ init : function(){
337
+
338
+ // validate
339
+ if( this.type() !== 'backbone' )
340
+ {
341
+ return false;
342
+ }
343
+
344
+
345
+ // validate prototype
346
+ if( ! acf.helpers.isset(wp, 'media', 'view', 'AttachmentCompat', 'prototype') )
347
+ {
348
+ return false;
349
+ }
350
+
351
+
352
+ // vars
353
+ var _prototype = wp.media.view.AttachmentCompat.prototype;
354
+
355
+
356
+ // orig
357
+ _prototype.orig_render = _prototype.render;
358
+ _prototype.orig_dispose = _prototype.dispose;
359
+
360
+
361
+ // update class
362
+ _prototype.className = 'compat-item acf_postbox no_box';
363
+
364
+
365
+ // modify render
366
+ _prototype.render = function() {
367
+
368
+ // reference
369
+ var _this = this;
370
+
371
+
372
+ // validate
373
+ if( _this.ignore_render )
374
+ {
375
+ return this;
376
+ }
377
+
378
+
379
+ // run the old render function
380
+ this.orig_render();
381
+
382
+
383
+ // add button
384
+ setTimeout(function(){
385
+
386
+ // vars
387
+ var $media_model = _this.$el.closest('.media-modal');
388
+
389
+
390
+ // is this an edit only modal?
391
+ if( $media_model.hasClass('acf-media-modal') )
392
+ {
393
+ return;
394
+ }
395
+
396
+
397
+ // does button already exist?
398
+ if( $media_model.find('.media-frame-router .acf-expand-details').exists() )
399
+ {
400
+ return;
401
+ }
402
+
403
+
404
+ // create button
405
+ var button = $([
406
+ '<a href="#" class="acf-expand-details">',
407
+ '<span class="icon"></span>',
408
+ '<span class="is-closed">' + acf.l10n.core.expand_details + '</span>',
409
+ '<span class="is-open">' + acf.l10n.core.collapse_details + '</span>',
410
+ '</a>'
411
+ ].join(''));
412
+
413
+
414
+ // add events
415
+ button.on('click', function( e ){
416
+
417
+ e.preventDefault();
418
+
419
+ if( $media_model.hasClass('acf-expanded') )
420
+ {
421
+ $media_model.removeClass('acf-expanded');
422
+ }
423
+ else
424
+ {
425
+ $media_model.addClass('acf-expanded');
426
+ }
427
+
428
+ });
429
+
430
+
431
+ // append
432
+ $media_model.find('.media-frame-router').append( button );
433
+
434
+
435
+ }, 0);
436
+
437
+
438
+ // setup fields
439
+ // The clearTimout is needed to prevent many setup functions from running at the same time
440
+ clearTimeout( acf.media.render_timout );
441
+ acf.media.render_timout = setTimeout(function(){
442
+
443
+ $(document).trigger( 'acf/setup_fields', [ _this.$el ] );
444
+
445
+ }, 50);
446
+
447
+
448
+ // return based on the origional render function
449
+ return this;
450
+ };
451
+
452
+
453
+ // modify dispose
454
+ _prototype.dispose = function() {
455
+
456
+ // remove
457
+ $(document).trigger('acf/remove_fields', [ this.$el ]);
458
+
459
+
460
+ // run the old render function
461
+ this.orig_dispose();
462
+
463
+ };
464
+
465
+
466
+ // override save
467
+ _prototype.save = function( event ) {
468
+
469
+ var data = {},
470
+ names = {};
471
+
472
+ if ( event )
473
+ event.preventDefault();
474
+
475
+
476
+ _.each( this.$el.serializeArray(), function( pair ) {
477
+
478
+ // initiate name
479
+ if( pair.name.slice(-2) === '[]' )
480
+ {
481
+ // remove []
482
+ pair.name = pair.name.replace('[]', '');
483
+
484
+
485
+ // initiate counter
486
+ if( typeof names[ pair.name ] === 'undefined'){
487
+
488
+ names[ pair.name ] = -1;
489
+ //console.log( names[ pair.name ] );
490
+
491
+ }
492
+
493
+
494
+ names[ pair.name ]++
495
+
496
+ pair.name += '[' + names[ pair.name ] +']';
497
+
498
+
499
+ }
500
+
501
+ data[ pair.name ] = pair.value;
502
+ });
503
+
504
+ this.ignore_render = true;
505
+ this.model.saveCompat( data );
506
+
507
+ };
508
+ }
509
+ };
510
+
511
+
512
+ /*
513
+ * Conditional Logic Calculate
514
+ *
515
+ * @description:
516
+ * @since 3.5.1
517
+ * @created: 15/10/12
518
+ */
519
+
520
+ acf.conditional_logic = {
521
+
522
+ items : [],
523
+
524
+ init : function(){
525
+
526
+ // reference
527
+ var _this = this;
528
+
529
+
530
+ // events
531
+ $(document).on('change', '.field input, .field textarea, .field select', function(){
532
+
533
+ // preview hack
534
+ if( $('#acf-has-changed').exists() )
535
+ {
536
+ $('#acf-has-changed').val(1);
537
+ }
538
+
539
+ _this.change( $(this) );
540
+
541
+ });
542
+
543
+
544
+ $(document).on('acf/setup_fields', function(e, el){
545
+
546
+ //console.log('acf/setup_fields calling acf.conditional_logic.refresh()');
547
+ _this.refresh( $(el) );
548
+
549
+ });
550
+
551
+ //console.log('acf.conditional_logic.init() calling acf.conditional_logic.refresh()');
552
+ _this.refresh();
553
+
554
+ },
555
+ change : function( $el ){
556
+
557
+ //console.log('change %o', $el);
558
+ // reference
559
+ var _this = this;
560
+
561
+
562
+ // vars
563
+ var $field = $el.closest('.field'),
564
+ key = $field.attr('data-field_key');
565
+
566
+
567
+ // loop through items and find rules where this field key is a trigger
568
+ $.each(this.items, function( k, item ){
569
+
570
+ $.each(item.rules, function( k2, rule ){
571
+
572
+ // compare rule against the changed $field
573
+ if( rule.field == key )
574
+ {
575
+ _this.refresh_field( item );
576
+ }
577
+
578
+ });
579
+
580
+ });
581
+
582
+ },
583
+
584
+ refresh_field : function( item ){
585
+
586
+ //console.log( 'refresh_field: %o ', item );
587
+ // reference
588
+ var _this = this;
589
+
590
+
591
+ // vars
592
+ var $targets = $('.field_key-' + item.field);
593
+
594
+
595
+ // may be multiple targets (sub fields)
596
+ $targets.each(function(){
597
+
598
+ //console.log('target %o', $(this));
599
+
600
+ // vars
601
+ var show = true;
602
+
603
+
604
+ // if 'any' was selected, start of as false and any match will result in show = true
605
+ if( item.allorany == 'any' )
606
+ {
607
+ show = false;
608
+ }
609
+
610
+
611
+ // vars
612
+ var $target = $(this),
613
+ hide_all = true;
614
+
615
+
616
+ // loop through rules
617
+ $.each(item.rules, function( k2, rule ){
618
+
619
+ // vars
620
+ var $toggle = $('.field_key-' + rule.field);
621
+
622
+
623
+ // are any of $toggle a sub field?
624
+ if( $toggle.hasClass('sub_field') )
625
+ {
626
+ // toggle may be a sibling sub field.
627
+ // if so ,show an empty td but keep the column
628
+ $toggle = $target.siblings('.field_key-' + rule.field);
629
+ hide_all = false;
630
+
631
+
632
+ // if no toggle was found, we need to look at parent sub fields.
633
+ // if so, hide the entire column
634
+ if( ! $toggle.exists() )
635
+ {
636
+ // loop through all the parents that could contain sub fields
637
+ $target.parents('tr').each(function(){
638
+
639
+ // attempt to update $toggle to this parent sub field
640
+ $toggle = $(this).find('.field_key-' + rule.field)
641
+
642
+ // if the parent sub field actuallly exists, great! Stop the loop
643
+ if( $toggle.exists() )
644
+ {
645
+ return false;
646
+ }
647
+
648
+ });
649
+
650
+ hide_all = true;
651
+ }
652
+
653
+ }
654
+
655
+
656
+ // if this sub field is within a flexible content layout, hide the entire column because
657
+ // there will never be another row added to this table
658
+ var parent = $target.parent('tr').parent().parent('table').parent('.layout');
659
+ if( parent.exists() )
660
+ {
661
+ hide_all = true;
662
+
663
+ if( $target.is('th') && $toggle.is('th') )
664
+ {
665
+ $toggle = $target.closest('.layout').find('td.field_key-' + rule.field);
666
+ }
667
+
668
+ }
669
+
670
+ // if this sub field is within a repeater field which has a max row of 1, hide the entire column because
671
+ // there will never be another row added to this table
672
+ var parent = $target.parent('tr').parent().parent('table').parent('.repeater');
673
+ if( parent.exists() && parent.attr('data-max_rows') == '1' )
674
+ {
675
+ hide_all = true;
676
+
677
+ if( $target.is('th') && $toggle.is('th') )
678
+ {
679
+ $toggle = $target.closest('table').find('td.field_key-' + rule.field);
680
+ }
681
+
682
+ }
683
+
684
+
685
+ var calculate = _this.calculate( rule, $toggle, $target );
686
+
687
+ if( item.allorany == 'all' )
688
+ {
689
+ if( calculate == false )
690
+ {
691
+ show = false;
692
+
693
+ // end loop
694
+ return false;
695
+ }
696
+ }
697
+ else
698
+ {
699
+ if( calculate == true )
700
+ {
701
+ show = true;
702
+
703
+ // end loop
704
+ return false;
705
+ }
706
+ }
707
+
708
+ });
709
+ // $.each(item.rules, function( k2, rule ){
710
+
711
+
712
+ // clear classes
713
+ $target.removeClass('acf-conditional_logic-hide acf-conditional_logic-show acf-show-blank');
714
+
715
+
716
+ // hide / show field
717
+ if( show )
718
+ {
719
+ // remove "disabled"
720
+ $target.find('input, textarea, select').removeAttr('disabled');
721
+
722
+ $target.addClass('acf-conditional_logic-show');
723
+
724
+ // hook
725
+ $(document).trigger('acf/conditional_logic/show', [ $target, item ]);
726
+
727
+ }
728
+ else
729
+ {
730
+ // add "disabled"
731
+ $target.find('input, textarea, select').attr('disabled', 'disabled');
732
+
733
+ $target.addClass('acf-conditional_logic-hide');
734
+
735
+ if( !hide_all )
736
+ {
737
+ $target.addClass('acf-show-blank');
738
+ }
739
+
740
+ // hook
741
+ $(document).trigger('acf/conditional_logic/hide', [ $target, item ]);
742
+ }
743
+
744
+
745
+ });
746
+
747
+ },
748
+
749
+ refresh : function( $el ){
750
+
751
+ // defaults
752
+ $el = $el || $('body');
753
+
754
+
755
+ // reference
756
+ var _this = this;
757
+
758
+
759
+ // loop through items and find rules where this field key is a trigger
760
+ $.each(this.items, function( k, item ){
761
+
762
+ $.each(item.rules, function( k2, rule ){
763
+
764
+ // is this field within the $el
765
+ // this will increase performance by ignoring conditional logic outside of this newly appended element ($el)
766
+ if( ! $el.find('.field[data-field_key="' + item.field + '"]').exists() )
767
+ {
768
+ return;
769
+ }
770
+
771
+ _this.refresh_field( item );
772
+
773
+ });
774
+
775
+ });
776
+
777
+ },
778
+
779
+ calculate : function( rule, $toggle, $target ){
780
+
781
+ // vars
782
+ var r = false;
783
+
784
+
785
+ // compare values
786
+ if( $toggle.hasClass('field_type-true_false') || $toggle.hasClass('field_type-checkbox') || $toggle.hasClass('field_type-radio') )
787
+ {
788
+ var exists = $toggle.find('input[value="' + rule.value + '"]:checked').exists();
789
+
790
+
791
+ if( rule.operator == "==" )
792
+ {
793
+ if( exists )
794
+ {
795
+ r = true;
796
+ }
797
+ }
798
+ else
799
+ {
800
+ if( ! exists )
801
+ {
802
+ r = true;
803
+ }
804
+ }
805
+
806
+ }
807
+ else
808
+ {
809
+ // get val and make sure it is an array
810
+ var val = $toggle.find('input, textarea, select').last().val();
811
+
812
+ if( ! $.isArray(val) )
813
+ {
814
+ val = [ val ];
815
+ }
816
+
817
+
818
+ if( rule.operator == "==" )
819
+ {
820
+ if( $.inArray(rule.value, val) > -1 )
821
+ {
822
+ r = true;
823
+ }
824
+ }
825
+ else
826
+ {
827
+ if( $.inArray(rule.value, val) < 0 )
828
+ {
829
+ r = true;
830
+ }
831
+ }
832
+
833
+ }
834
+
835
+
836
+ // return
837
+ return r;
838
+
839
+ }
840
+
841
+ };
842
+
843
+
844
+
845
+
846
+
847
+ /*
848
+ * Document Ready
849
+ *
850
+ * @description:
851
+ * @since: 3.5.8
852
+ * @created: 17/01/13
853
+ */
854
+
855
+ $(document).ready(function(){
856
+
857
+
858
+ // conditional logic
859
+ acf.conditional_logic.init();
860
+
861
+
862
+ // fix for older options page add-on
863
+ $('.acf_postbox > .inside > .options').each(function(){
864
+
865
+ $(this).closest('.acf_postbox').addClass( $(this).attr('data-layout') );
866
+
867
+ });
868
+
869
+
870
+ // Remove 'field_123' from native custom field metabox
871
+ $('#metakeyselect option[value^="field_"]').remove();
872
+
873
+
874
+ });
875
+
876
+
877
+ /*
878
+ * window load
879
+ *
880
+ * @description:
881
+ * @since: 3.5.5
882
+ * @created: 22/12/12
883
+ */
884
+
885
+ $(window).on('load', function(){
886
+
887
+ // init
888
+ acf.media.init();
889
+
890
+
891
+ setTimeout(function(){
892
+
893
+ // Hack for CPT without a content editor
894
+ try
895
+ {
896
+ // post_id may be string (user_1) and therefore, the uploaded image cannot be attached to the post
897
+ if( $.isNumeric(acf.o.post_id) )
898
+ {
899
+ wp.media.view.settings.post.id = acf.o.post_id;
900
+ }
901
+
902
+ }
903
+ catch(e)
904
+ {
905
+ // one of the objects was 'undefined'...
906
+ }
907
+
908
+
909
+ // setup fields
910
+ $(document).trigger('acf/setup_fields', [ $('#poststuff') ]);
911
+
912
+ }, 10);
913
+
914
+ });
915
+
916
+
917
+ /*
918
+ * Gallery field Add-on Fix
919
+ *
920
+ * Gallery field v1.0.0 required some data in the acf object.
921
+ * Now not required, but older versions of gallery field need this.
922
+ *
923
+ * @type object
924
+ * @date 1/08/13
925
+ *
926
+ * @param N/A
927
+ * @return N/A
928
+ */
929
+
930
+ acf.fields.gallery = {
931
+ add : function(){},
932
+ edit : function(){},
933
+ update_count : function(){},
934
+ hide_selected_items : function(){},
935
+ text : {
936
+ title_add : "Select Images"
937
+ }
938
+ };
939
+
940
+
941
+
942
+ })(jQuery);
js/input/ajax.js ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+
4
+ /*
5
+ * acf.screen
6
+ *
7
+ * Data used by AJAX to hide / show field groups
8
+ *
9
+ * @type object
10
+ * @date 1/03/2011
11
+ *
12
+ * @param N/A
13
+ * @return N/A
14
+ */
15
+
16
+ acf.screen = {
17
+ action : 'acf/location/match_field_groups_ajax',
18
+ post_id : 0,
19
+ page_template : 0,
20
+ page_parent : 0,
21
+ page_type : 0,
22
+ post_category : 0,
23
+ post_format : 0,
24
+ taxonomy : 0,
25
+ lang : 0,
26
+ nonce : 0
27
+ };
28
+
29
+
30
+ /*
31
+ * Document Ready
32
+ *
33
+ * Updates acf.screen with more data
34
+ *
35
+ * @type function
36
+ * @date 1/03/2011
37
+ *
38
+ * @param N/A
39
+ * @return N/A
40
+ */
41
+
42
+ $(document).ready(function(){
43
+
44
+
45
+ // update post_id
46
+ acf.screen.post_id = acf.o.post_id;
47
+ acf.screen.nonce = acf.o.nonce;
48
+
49
+
50
+ // MPML
51
+ if( $('#icl-als-first').length > 0 )
52
+ {
53
+ var href = $('#icl-als-first').children('a').attr('href'),
54
+ regex = new RegExp( "lang=([^&#]*)" ),
55
+ results = regex.exec( href );
56
+
57
+ // lang
58
+ acf.screen.lang = results[1];
59
+
60
+ }
61
+
62
+ });
63
+
64
+
65
+ /*
66
+ * acf/update_field_groups
67
+ *
68
+ * finds the new id's for metaboxes and show's hides metaboxes
69
+ *
70
+ * @type event
71
+ * @date 1/03/2011
72
+ *
73
+ * @param N/A
74
+ * @return N/A
75
+ */
76
+
77
+ $(document).on('acf/update_field_groups', function(){
78
+
79
+ // Only for a post.
80
+ // This is an attempt to stop the action running on the options page add-on.
81
+ if( ! acf.screen.post_id || ! $.isNumeric(acf.screen.post_id) )
82
+ {
83
+ return false;
84
+ }
85
+
86
+
87
+ $.ajax({
88
+ url: ajaxurl,
89
+ data: acf.screen,
90
+ type: 'post',
91
+ dataType: 'json',
92
+ success: function(result){
93
+
94
+ // validate
95
+ if( !result )
96
+ {
97
+ return false;
98
+ }
99
+
100
+
101
+ // hide all metaboxes
102
+ $('.acf_postbox').addClass('acf-hidden');
103
+ $('.acf_postbox-toggle').addClass('acf-hidden');
104
+
105
+
106
+ // dont bother loading style or html for inputs
107
+ if( result.length == 0 )
108
+ {
109
+ return false;
110
+ }
111
+
112
+
113
+ // show the new postboxes
114
+ $.each(result, function(k, v) {
115
+
116
+
117
+ // vars
118
+ var $el = $('#acf_' + v),
119
+ $toggle = $('#adv-settings .acf_postbox-toggle[for="acf_' + v + '-hide"]');
120
+
121
+
122
+ // classes
123
+ $el.removeClass('acf-hidden hide-if-js');
124
+ $toggle.removeClass('acf-hidden');
125
+ $toggle.find('input[type="checkbox"]').attr('checked', 'checked');
126
+
127
+
128
+ // load fields if needed
129
+ $el.find('.acf-replace-with-fields').each(function(){
130
+
131
+ var $replace = $(this);
132
+
133
+ $.ajax({
134
+ url : ajaxurl,
135
+ data : {
136
+ action : 'acf/post/render_fields',
137
+ acf_id : v,
138
+ post_id : acf.o.post_id,
139
+ nonce : acf.o.nonce
140
+ },
141
+ type : 'post',
142
+ dataType : 'html',
143
+ success : function( html ){
144
+
145
+ $replace.replaceWith( html );
146
+
147
+ $(document).trigger('acf/setup_fields', $el);
148
+
149
+ }
150
+ });
151
+
152
+ });
153
+ });
154
+
155
+
156
+ // load style
157
+ $.ajax({
158
+ url : ajaxurl,
159
+ data : {
160
+ action : 'acf/post/get_style',
161
+ acf_id : result[0],
162
+ nonce : acf.o.nonce
163
+ },
164
+ type : 'post',
165
+ dataType : 'html',
166
+ success : function( result ){
167
+
168
+ $('#acf_style').html( result );
169
+
170
+ }
171
+ });
172
+
173
+
174
+
175
+ }
176
+ });
177
+ });
178
+
179
+
180
+ /*
181
+ * Events
182
+ *
183
+ * Updates acf.screen with more data and triggers the update event
184
+ *
185
+ * @type function
186
+ * @date 1/03/2011
187
+ *
188
+ * @param N/A
189
+ * @return N/A
190
+ */
191
+
192
+ $(document).on('change', '#page_template', function(){
193
+
194
+ acf.screen.page_template = $(this).val();
195
+
196
+ $(document).trigger('acf/update_field_groups');
197
+
198
+ });
199
+
200
+
201
+ $(document).on('change', '#parent_id', function(){
202
+
203
+ var val = $(this).val();
204
+
205
+
206
+ // set page_type / page_parent
207
+ if( val != "" )
208
+ {
209
+ acf.screen.page_type = 'child';
210
+ acf.screen.page_parent = val;
211
+ }
212
+ else
213
+ {
214
+ acf.screen.page_type = 'parent';
215
+ acf.screen.page_parent = 0;
216
+ }
217
+
218
+
219
+ $(document).trigger('acf/update_field_groups');
220
+
221
+ });
222
+
223
+
224
+ $(document).on('change', '#post-formats-select input[type="radio"]', function(){
225
+
226
+ var val = $(this).val();
227
+
228
+ if( val == '0' )
229
+ {
230
+ val = 'standard';
231
+ }
232
+
233
+ acf.screen.post_format = val;
234
+
235
+ $(document).trigger('acf/update_field_groups');
236
+
237
+ });
238
+
239
+
240
+ function _sync_taxonomy_terms() {
241
+
242
+ // vars
243
+ var values = [];
244
+
245
+
246
+ $('.categorychecklist input:checked, .acf-taxonomy-field input:checked, .acf-taxonomy-field option:selected').each(function(){
247
+
248
+ // validate
249
+ if( $(this).is(':hidden') || $(this).is(':disabled') )
250
+ {
251
+ return;
252
+ }
253
+
254
+
255
+ // validate media popup
256
+ if( $(this).closest('.media-frame').exists() )
257
+ {
258
+ return;
259
+ }
260
+
261
+
262
+ // validate acf
263
+ if( $(this).closest('.acf-taxonomy-field').exists() )
264
+ {
265
+ if( $(this).closest('.acf-taxonomy-field').attr('data-load_save') == '0' )
266
+ {
267
+ return;
268
+ }
269
+ }
270
+
271
+
272
+ // append
273
+ if( values.indexOf( $(this).val() ) === -1 )
274
+ {
275
+ values.push( $(this).val() );
276
+ }
277
+
278
+ });
279
+
280
+
281
+ // update screen
282
+ acf.screen.post_category = values;
283
+ acf.screen.taxonomy = values;
284
+
285
+
286
+ // trigger change
287
+ $(document).trigger('acf/update_field_groups');
288
+
289
+ }
290
+
291
+
292
+ $(document).on('change', '.categorychecklist input, .acf-taxonomy-field input, .acf-taxonomy-field select', function(){
293
+
294
+ // a taxonomy field may trigger this change event, however, the value selected is not
295
+ // actually a term relatinoship, it is meta data
296
+ if( $(this).closest('.acf-taxonomy-field').exists() )
297
+ {
298
+ if( $(this).closest('.acf-taxonomy-field').attr('data-save') == '0' )
299
+ {
300
+ return;
301
+ }
302
+ }
303
+
304
+
305
+ // this may be triggered from editing an imgae in a popup. Popup does not support correct metaboxes so ignore this
306
+ if( $(this).closest('.media-frame').exists() )
307
+ {
308
+ return;
309
+ }
310
+
311
+
312
+ // set timeout to fix issue with chrome which does not register the change has yet happened
313
+ setTimeout(function(){
314
+
315
+ _sync_taxonomy_terms();
316
+
317
+ }, 1);
318
+
319
+
320
+ });
321
+
322
+
323
+
324
+
325
+ })(jQuery);
js/input/color-picker.js ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ /*
4
+ * Color Picker
5
+ *
6
+ * jQuery functionality for this field type
7
+ *
8
+ * @type object
9
+ * @date 20/07/13
10
+ *
11
+ * @param N/A
12
+ * @return N/A
13
+ */
14
+
15
+ var _cp = acf.fields.color_picker = {
16
+
17
+ $el : null,
18
+ $input : null,
19
+
20
+ set : function( o ){
21
+
22
+ // merge in new option
23
+ $.extend( this, o );
24
+
25
+
26
+ // find input
27
+ this.$input = this.$el.find('input[type="text"]');
28
+
29
+
30
+ // return this for chaining
31
+ return this;
32
+
33
+ },
34
+ init : function(){
35
+
36
+ // vars (reference)
37
+ var $input = this.$input;
38
+
39
+
40
+ // is clone field?
41
+ if( acf.helpers.is_clone_field($input) )
42
+ {
43
+ return;
44
+ }
45
+
46
+
47
+ this.$input.wpColorPicker();
48
+
49
+
50
+
51
+ }
52
+ };
53
+
54
+
55
+ /*
56
+ * acf/setup_fields
57
+ *
58
+ * run init function on all elements for this field
59
+ *
60
+ * @type event
61
+ * @date 20/07/13
62
+ *
63
+ * @param {object} e event object
64
+ * @param {object} el DOM object which may contain new ACF elements
65
+ * @return N/A
66
+ */
67
+
68
+ $(document).on('acf/setup_fields', function(e, el){
69
+
70
+ $(el).find('.acf-color_picker').each(function(){
71
+
72
+ _cp.set({ $el : $(this) }).init();
73
+
74
+ });
75
+
76
+ });
77
+
78
+
79
+ })(jQuery);
js/input/date-picker.js ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ /*
4
+ * Date Picker
5
+ *
6
+ * static model for this field
7
+ *
8
+ * @type event
9
+ * @date 1/06/13
10
+ *
11
+ */
12
+
13
+ acf.fields.date_picker = {
14
+
15
+ $el : null,
16
+ $input : null,
17
+ $hidden : null,
18
+
19
+ o : {},
20
+
21
+ set : function( o ){
22
+
23
+ // merge in new option
24
+ $.extend( this, o );
25
+
26
+
27
+ // find input
28
+ this.$input = this.$el.find('input[type="text"]');
29
+ this.$hidden = this.$el.find('input[type="hidden"]');
30
+
31
+
32
+ // get options
33
+ this.o = acf.helpers.get_atts( this.$el );
34
+
35
+
36
+ // return this for chaining
37
+ return this;
38
+
39
+ },
40
+ init : function(){
41
+
42
+ // is clone field?
43
+ if( acf.helpers.is_clone_field(this.$hidden) )
44
+ {
45
+ return;
46
+ }
47
+
48
+
49
+ // get and set value from alt field
50
+ this.$input.val( this.$hidden.val() );
51
+
52
+
53
+ // create options
54
+ var options = $.extend( {}, acf.l10n.date_picker, {
55
+ dateFormat : this.o.save_format,
56
+ altField : this.$hidden,
57
+ altFormat : this.o.save_format,
58
+ changeYear : true,
59
+ yearRange : "-100:+100",
60
+ changeMonth : true,
61
+ showButtonPanel : true,
62
+ firstDay : this.o.first_day
63
+ });
64
+
65
+
66
+ // add date picker
67
+ this.$input.addClass('active').datepicker( options );
68
+
69
+
70
+ // now change the format back to how it should be.
71
+ this.$input.datepicker( "option", "dateFormat", this.o.display_format );
72
+
73
+
74
+ // wrap the datepicker (only if it hasn't already been wrapped)
75
+ if( $('body > #ui-datepicker-div').length > 0 )
76
+ {
77
+ $('#ui-datepicker-div').wrap('<div class="ui-acf" />');
78
+ }
79
+
80
+ },
81
+ blur : function(){
82
+
83
+ if( !this.$input.val() )
84
+ {
85
+ this.$hidden.val('');
86
+ }
87
+
88
+ }
89
+
90
+ };
91
+
92
+
93
+ /*
94
+ * acf/setup_fields
95
+ *
96
+ * run init function on all elements for this field
97
+ *
98
+ * @type event
99
+ * @date 20/07/13
100
+ *
101
+ * @param {object} e event object
102
+ * @param {object} el DOM object which may contain new ACF elements
103
+ * @return N/A
104
+ */
105
+
106
+ $(document).on('acf/setup_fields', function(e, el){
107
+
108
+ $(el).find('.acf-date_picker').each(function(){
109
+
110
+ acf.fields.date_picker.set({ $el : $(this) }).init();
111
+
112
+ });
113
+
114
+ });
115
+
116
+
117
+ /*
118
+ * Events
119
+ *
120
+ * jQuery events for this field
121
+ *
122
+ * @type event
123
+ * @date 1/06/13
124
+ *
125
+ */
126
+
127
+ $(document).on('blur', '.acf-date_picker input[type="text"]', function( e ){
128
+
129
+ acf.fields.date_picker.set({ $el : $(this).parent() }).blur();
130
+
131
+ });
132
+
133
+
134
+ })(jQuery);
js/input/file.js ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ /*
4
+ * File
5
+ *
6
+ * static model for this field
7
+ *
8
+ * @type event
9
+ * @date 1/06/13
10
+ *
11
+ */
12
+
13
+
14
+ // reference
15
+ var _media = acf.media;
16
+
17
+
18
+ acf.fields.file = {
19
+
20
+ $el : null,
21
+ $input : null,
22
+
23
+ o : {},
24
+
25
+ set : function( o ){
26
+
27
+ // merge in new option
28
+ $.extend( this, o );
29
+
30
+
31
+ // find input
32
+ this.$input = this.$el.find('input[type="hidden"]');
33
+
34
+
35
+ // get options
36
+ this.o = acf.helpers.get_atts( this.$el );
37
+
38
+
39
+ // multiple?
40
+ this.o.multiple = this.$el.closest('.repeater').exists() ? true : false;
41
+
42
+
43
+ // wp library query
44
+ this.o.query = {};
45
+
46
+
47
+ // library
48
+ if( this.o.library == 'uploadedTo' )
49
+ {
50
+ this.o.query.uploadedTo = acf.o.post_id;
51
+ }
52
+
53
+
54
+ // return this for chaining
55
+ return this;
56
+
57
+ },
58
+ init : function(){
59
+
60
+ // is clone field?
61
+ if( acf.helpers.is_clone_field(this.$input) )
62
+ {
63
+ return;
64
+ }
65
+
66
+ },
67
+ add : function( file ){
68
+
69
+ // this function must reference a global div variable due to the pre WP 3.5 uploader
70
+ // vars
71
+ var div = _media.div;
72
+
73
+
74
+ // set atts
75
+ div.find('.acf-file-icon').attr( 'src', file.icon );
76
+ div.find('.acf-file-title').text( file.title );
77
+ div.find('.acf-file-name').text( file.name ).attr( 'href', file.url );
78
+ div.find('.acf-file-size').text( file.size );
79
+ div.find('.acf-file-value').val( file.id ).trigger('change');
80
+
81
+
82
+ // set div class
83
+ div.addClass('active');
84
+
85
+
86
+ // validation
87
+ div.closest('.field').removeClass('error');
88
+
89
+ },
90
+
91
+ new_frame: function( attributes ){
92
+
93
+ // set global var
94
+ _media.div = this.$el;
95
+
96
+
97
+ // clear the frame
98
+ _media.clear_frame();
99
+
100
+
101
+ // vars
102
+ attributes.states = [];
103
+
104
+ // append states
105
+ attributes.states.push(
106
+ new wp.media.controller.Library({
107
+ library : wp.media.query( this.o.query ),
108
+ multiple : attributes.multiple,
109
+ title : attributes.title,
110
+ priority : 20,
111
+ filterable : 'all'
112
+ })
113
+ );
114
+
115
+
116
+ // edit image functionality (added in WP 3.9)
117
+ if( acf.helpers.isset(wp, 'media', 'controller', 'EditImage') ) {
118
+
119
+ attributes.states.push( new wp.media.controller.EditImage() );
120
+
121
+ }
122
+
123
+
124
+ // Create the media frame
125
+ _media.frame = wp.media( attributes );
126
+
127
+
128
+ // edit image view
129
+ // source: media-views.js:2410 editImageContent()
130
+ _media.frame.on('content:render:edit-image', function(){
131
+
132
+ var image = this.state().get('image'),
133
+ view = new wp.media.view.EditImage( { model: image, controller: this } ).render();
134
+
135
+ this.content.set( view );
136
+
137
+ // after creating the wrapper view, load the actual editor via an ajax call
138
+ view.loadEditor();
139
+
140
+ }, _media.frame);
141
+
142
+
143
+ // update toolbar button
144
+ _media.frame.on( 'toolbar:create:select', function( toolbar ) {
145
+
146
+ toolbar.view = new wp.media.view.Toolbar.Select({
147
+ text: attributes.button.text,
148
+ controller: this
149
+ });
150
+
151
+ }, _media.frame );
152
+
153
+
154
+ // return
155
+ return _media.frame;
156
+
157
+ },
158
+
159
+ edit : function(){
160
+
161
+ // vars
162
+ var id = this.$input.val();
163
+
164
+
165
+ // create frame
166
+ this.new_frame({
167
+ title : acf.l10n.file.edit,
168
+ multiple : false,
169
+ button : { text : acf.l10n.file.update }
170
+ });
171
+
172
+
173
+ // open
174
+ _media.frame.on('open',function() {
175
+
176
+ // set to browse
177
+ if( _media.frame.content._mode != 'browse' )
178
+ {
179
+ _media.frame.content.mode('browse');
180
+ }
181
+
182
+
183
+ // add class
184
+ _media.frame.$el.closest('.media-modal').addClass('acf-media-modal acf-expanded');
185
+
186
+
187
+ // set selection
188
+ var selection = _media.frame.state().get('selection'),
189
+ attachment = wp.media.attachment( id );
190
+
191
+
192
+ // to fetch or not to fetch
193
+ if( $.isEmptyObject(attachment.changed) )
194
+ {
195
+ attachment.fetch();
196
+ }
197
+
198
+
199
+ selection.add( attachment );
200
+
201
+ });
202
+
203
+
204
+ // close
205
+ _media.frame.on('close',function(){
206
+
207
+ // remove class
208
+ _media.frame.$el.closest('.media-modal').removeClass('acf-media-modal');
209
+
210
+ });
211
+
212
+
213
+ // Finally, open the modal
214
+ acf.media.frame.open();
215
+
216
+ },
217
+ remove : function()
218
+ {
219
+
220
+ // set atts
221
+ this.$el.find('.acf-file-icon').attr( 'src', '' );
222
+ this.$el.find('.acf-file-title').text( '' );
223
+ this.$el.find('.acf-file-name').text( '' ).attr( 'href', '' );
224
+ this.$el.find('.acf-file-size').text( '' );
225
+ this.$el.find('.acf-file-value').val( '' ).trigger('change');
226
+
227
+
228
+ // remove class
229
+ this.$el.removeClass('active');
230
+
231
+ },
232
+ popup : function()
233
+ {
234
+ // reference
235
+ var t = this;
236
+
237
+
238
+ // create frame
239
+ this.new_frame({
240
+ title : acf.l10n.file.select,
241
+ multiple : t.o.multiple,
242
+ button : { text : acf.l10n.file.select }
243
+ });
244
+
245
+
246
+ // customize model / view
247
+ acf.media.frame.on('content:activate', function(){
248
+
249
+ // vars
250
+ var toolbar = null,
251
+ filters = null;
252
+
253
+
254
+ // populate above vars making sure to allow for failure
255
+ try
256
+ {
257
+ toolbar = acf.media.frame.content.get().toolbar;
258
+ filters = toolbar.get('filters');
259
+ }
260
+ catch(e)
261
+ {
262
+ // one of the objects was 'undefined'... perhaps the frame open is Upload Files
263
+ //console.log( e );
264
+ }
265
+
266
+
267
+ // validate
268
+ if( !filters )
269
+ {
270
+ return false;
271
+ }
272
+
273
+
274
+ // no need for 'uploaded' filter
275
+ if( t.o.library == 'uploadedTo' )
276
+ {
277
+ filters.$el.find('option[value="uploaded"]').remove();
278
+ filters.$el.after('<span>' + acf.l10n.file.uploadedTo + '</span>')
279
+
280
+ $.each( filters.filters, function( k, v ){
281
+
282
+ v.props.uploadedTo = acf.o.post_id;
283
+
284
+ });
285
+ }
286
+
287
+ });
288
+
289
+
290
+ // When an image is selected, run a callback.
291
+ acf.media.frame.on( 'select', function() {
292
+
293
+ // get selected images
294
+ selection = _media.frame.state().get('selection');
295
+
296
+ if( selection )
297
+ {
298
+ var i = 0;
299
+
300
+ selection.each(function(attachment){
301
+
302
+ // counter
303
+ i++;
304
+
305
+
306
+ // select / add another file field?
307
+ if( i > 1 )
308
+ {
309
+ // vars
310
+ var $td = _media.div.closest('td'),
311
+ $tr = $td.closest('.row'),
312
+ $repeater = $tr.closest('.repeater'),
313
+ key = $td.attr('data-field_key'),
314
+ selector = 'td .acf-file-uploader:first';
315
+
316
+
317
+ // key only exists for repeater v1.0.1 +
318
+ if( key )
319
+ {
320
+ selector = 'td[data-field_key="' + key + '"] .acf-file-uploader';
321
+ }
322
+
323
+
324
+ // add row?
325
+ if( ! $tr.next('.row').exists() )
326
+ {
327
+ $repeater.find('.add-row-end').trigger('click');
328
+
329
+ }
330
+
331
+
332
+ // update current div
333
+ _media.div = $tr.next('.row').find( selector );
334
+
335
+ }
336
+
337
+
338
+ // vars
339
+ var file = {
340
+ id : attachment.id,
341
+ title : attachment.attributes.title,
342
+ name : attachment.attributes.filename,
343
+ url : attachment.attributes.url,
344
+ icon : attachment.attributes.icon,
345
+ size : attachment.attributes.filesize
346
+ };
347
+
348
+
349
+ // add file to field
350
+ acf.fields.file.add( file );
351
+
352
+
353
+ });
354
+ // selection.each(function(attachment){
355
+ }
356
+ // if( selection )
357
+
358
+ });
359
+ // acf.media.frame.on( 'select', function() {
360
+
361
+
362
+ // Finally, open the modal
363
+ acf.media.frame.open();
364
+
365
+
366
+ return false;
367
+ }
368
+
369
+ };
370
+
371
+
372
+ /*
373
+ * Events
374
+ *
375
+ * jQuery events for this field
376
+ *
377
+ * @type function
378
+ * @date 1/03/2011
379
+ *
380
+ * @param N/A
381
+ * @return N/A
382
+ */
383
+
384
+ $(document).on('click', '.acf-file-uploader .acf-button-edit', function( e ){
385
+
386
+ e.preventDefault();
387
+
388
+ acf.fields.file.set({ $el : $(this).closest('.acf-file-uploader') }).edit();
389
+
390
+ });
391
+
392
+ $(document).on('click', '.acf-file-uploader .acf-button-delete', function( e ){
393
+
394
+ e.preventDefault();
395
+
396
+ acf.fields.file.set({ $el : $(this).closest('.acf-file-uploader') }).remove();
397
+
398
+ });
399
+
400
+
401
+ $(document).on('click', '.acf-file-uploader .add-file', function( e ){
402
+
403
+ e.preventDefault();
404
+
405
+ acf.fields.file.set({ $el : $(this).closest('.acf-file-uploader') }).popup();
406
+
407
+ });
408
+
409
+
410
+ })(jQuery);
js/input/google-map.js ADDED
@@ -0,0 +1,566 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ /*
4
+ * Location
5
+ *
6
+ * static model for this field
7
+ *
8
+ * @type event
9
+ * @date 1/06/13
10
+ *
11
+ */
12
+
13
+ acf.fields.google_map = {
14
+
15
+ $el : null,
16
+ $input : null,
17
+
18
+ o : {},
19
+ api: {
20
+ sensor: false,
21
+ libraries: 'places'
22
+ },
23
+
24
+ ready : false,
25
+ geocoder : false,
26
+ map : false,
27
+ maps : {},
28
+
29
+ set : function( o ){
30
+
31
+ // merge in new option
32
+ $.extend( this, o );
33
+
34
+
35
+ // find input
36
+ this.$input = this.$el.find('.input-address');
37
+
38
+
39
+ // get options
40
+ this.o = acf.helpers.get_atts( this.$el );
41
+
42
+
43
+ // get map
44
+ if( this.maps[ this.o.id ] )
45
+ {
46
+ this.map = this.maps[ this.o.id ];
47
+ }
48
+
49
+
50
+ // return this for chaining
51
+ return this;
52
+
53
+ },
54
+ init : function(){
55
+
56
+ // geocode
57
+ if( !this.geocoder )
58
+ {
59
+ this.geocoder = new google.maps.Geocoder();
60
+ }
61
+
62
+
63
+ // google maps is loaded and ready
64
+ this.ready = true;
65
+
66
+
67
+ // is clone field?
68
+ if( acf.helpers.is_clone_field(this.$input) )
69
+ {
70
+ return;
71
+ }
72
+
73
+ this.render();
74
+
75
+ },
76
+ render : function(){
77
+
78
+ // reference
79
+ var _this = this,
80
+ _$el = this.$el;
81
+
82
+
83
+ // vars
84
+ var args = {
85
+ zoom : parseInt(this.o.zoom),
86
+ center : new google.maps.LatLng(this.o.lat, this.o.lng),
87
+ mapTypeId : google.maps.MapTypeId.ROADMAP
88
+ };
89
+
90
+ // create map
91
+ this.map = new google.maps.Map( this.$el.find('.canvas')[0], args);
92
+
93
+
94
+ // add search
95
+ var autocomplete = new google.maps.places.Autocomplete( this.$el.find('.search')[0] );
96
+ autocomplete.map = this.map;
97
+ autocomplete.bindTo('bounds', this.map);
98
+
99
+
100
+ // add dummy marker
101
+ this.map.marker = new google.maps.Marker({
102
+ draggable : true,
103
+ raiseOnDrag : true,
104
+ map : this.map,
105
+ });
106
+
107
+
108
+ // add references
109
+ this.map.$el = this.$el;
110
+
111
+
112
+ // value exists?
113
+ var lat = this.$el.find('.input-lat').val(),
114
+ lng = this.$el.find('.input-lng').val();
115
+
116
+ if( lat && lng )
117
+ {
118
+ this.update( lat, lng ).center();
119
+ }
120
+
121
+
122
+ // events
123
+ google.maps.event.addListener(autocomplete, 'place_changed', function( e ) {
124
+
125
+ // reference
126
+ var $el = this.map.$el;
127
+
128
+
129
+ // manually update address
130
+ var address = $el.find('.search').val();
131
+ $el.find('.input-address').val( address );
132
+ $el.find('.title h4').text( address );
133
+
134
+
135
+ // vars
136
+ var place = this.getPlace();
137
+
138
+
139
+ // validate
140
+ if( place.geometry )
141
+ {
142
+ var lat = place.geometry.location.lat(),
143
+ lng = place.geometry.location.lng();
144
+
145
+
146
+ _this.set({ $el : $el }).update( lat, lng ).center();
147
+ }
148
+ else
149
+ {
150
+ // client hit enter, manulaly get the place
151
+ _this.geocoder.geocode({ 'address' : address }, function( results, status ){
152
+
153
+ // validate
154
+ if( status != google.maps.GeocoderStatus.OK )
155
+ {
156
+ console.log('Geocoder failed due to: ' + status);
157
+ return;
158
+ }
159
+
160
+ if( !results[0] )
161
+ {
162
+ console.log('No results found');
163
+ return;
164
+ }
165
+
166
+
167
+ // get place
168
+ place = results[0];
169
+
170
+ var lat = place.geometry.location.lat(),
171
+ lng = place.geometry.location.lng();
172
+
173
+
174
+ _this.set({ $el : $el }).update( lat, lng ).center();
175
+
176
+ });
177
+ }
178
+
179
+ });
180
+
181
+
182
+ google.maps.event.addListener( this.map.marker, 'dragend', function(){
183
+
184
+ // reference
185
+ var $el = this.map.$el;
186
+
187
+
188
+ // vars
189
+ var position = this.map.marker.getPosition(),
190
+ lat = position.lat(),
191
+ lng = position.lng();
192
+
193
+ _this.set({ $el : $el }).update( lat, lng ).sync();
194
+
195
+ });
196
+
197
+
198
+ google.maps.event.addListener( this.map, 'click', function( e ) {
199
+
200
+ // reference
201
+ var $el = this.$el;
202
+
203
+
204
+ // vars
205
+ var lat = e.latLng.lat(),
206
+ lng = e.latLng.lng();
207
+
208
+
209
+ _this.set({ $el : $el }).update( lat, lng ).sync();
210
+
211
+ });
212
+
213
+
214
+
215
+ // add to maps
216
+ this.maps[ this.o.id ] = this.map;
217
+
218
+
219
+ },
220
+
221
+ update : function( lat, lng ){
222
+
223
+ // vars
224
+ var latlng = new google.maps.LatLng( lat, lng );
225
+
226
+
227
+ // update inputs
228
+ this.$el.find('.input-lat').val( lat );
229
+ this.$el.find('.input-lng').val( lng ).trigger('change');
230
+
231
+
232
+ // update marker
233
+ this.map.marker.setPosition( latlng );
234
+
235
+
236
+ // show marker
237
+ this.map.marker.setVisible( true );
238
+
239
+
240
+ // update class
241
+ this.$el.addClass('active');
242
+
243
+
244
+ // validation
245
+ this.$el.closest('.field').removeClass('error');
246
+
247
+
248
+ // return for chaining
249
+ return this;
250
+ },
251
+
252
+ center : function(){
253
+
254
+ // vars
255
+ var position = this.map.marker.getPosition(),
256
+ lat = this.o.lat,
257
+ lng = this.o.lng;
258
+
259
+
260
+ // if marker exists, center on the marker
261
+ if( position )
262
+ {
263
+ lat = position.lat();
264
+ lng = position.lng();
265
+ }
266
+
267
+
268
+ var latlng = new google.maps.LatLng( lat, lng );
269
+
270
+
271
+ // set center of map
272
+ this.map.setCenter( latlng );
273
+ },
274
+
275
+ sync : function(){
276
+
277
+ // reference
278
+ var $el = this.$el;
279
+
280
+
281
+ // vars
282
+ var position = this.map.marker.getPosition(),
283
+ latlng = new google.maps.LatLng( position.lat(), position.lng() );
284
+
285
+
286
+ this.geocoder.geocode({ 'latLng' : latlng }, function( results, status ){
287
+
288
+ // validate
289
+ if( status != google.maps.GeocoderStatus.OK )
290
+ {
291
+ console.log('Geocoder failed due to: ' + status);
292
+ return;
293
+ }
294
+
295
+ if( !results[0] )
296
+ {
297
+ console.log('No results found');
298
+ return;
299
+ }
300
+
301
+
302
+ // get location
303
+ var location = results[0];
304
+
305
+
306
+ // update h4
307
+ $el.find('.title h4').text( location.formatted_address );
308
+
309
+
310
+ // update input
311
+ $el.find('.input-address').val( location.formatted_address ).trigger('change');
312
+
313
+ });
314
+
315
+
316
+ // return for chaining
317
+ return this;
318
+ },
319
+
320
+ locate : function(){
321
+
322
+ // reference
323
+ var _this = this,
324
+ _$el = this.$el;
325
+
326
+
327
+ // Try HTML5 geolocation
328
+ if( ! navigator.geolocation )
329
+ {
330
+ alert( acf.l10n.google_map.browser_support );
331
+ return this;
332
+ }
333
+
334
+
335
+ // show loading text
336
+ _$el.find('.title h4').text(acf.l10n.google_map.locating + '...');
337
+ _$el.addClass('active');
338
+
339
+ navigator.geolocation.getCurrentPosition(function(position){
340
+
341
+ // vars
342
+ var lat = position.coords.latitude,
343
+ lng = position.coords.longitude;
344
+
345
+ _this.set({ $el : _$el }).update( lat, lng ).sync().center();
346
+
347
+ });
348
+
349
+
350
+ },
351
+
352
+ clear : function(){
353
+
354
+ // update class
355
+ this.$el.removeClass('active');
356
+
357
+
358
+ // clear search
359
+ this.$el.find('.search').val('');
360
+
361
+
362
+ // clear inputs
363
+ this.$el.find('.input-address').val('');
364
+ this.$el.find('.input-lat').val('');
365
+ this.$el.find('.input-lng').val('');
366
+
367
+
368
+ // hide marker
369
+ this.map.marker.setVisible( false );
370
+ },
371
+
372
+ edit : function(){
373
+
374
+ // update class
375
+ this.$el.removeClass('active');
376
+
377
+
378
+ // clear search
379
+ var val = this.$el.find('.title h4').text();
380
+
381
+
382
+ this.$el.find('.search').val( val ).focus();
383
+
384
+ },
385
+
386
+ refresh : function(){
387
+
388
+ // trigger resize on div
389
+ google.maps.event.trigger(this.map, 'resize');
390
+
391
+ // center map
392
+ this.center();
393
+
394
+ }
395
+
396
+ };
397
+
398
+
399
+ /*
400
+ * acf/setup_fields
401
+ *
402
+ * run init function on all elements for this field
403
+ *
404
+ * @type event
405
+ * @date 20/07/13
406
+ *
407
+ * @param {object} e event object
408
+ * @param {object} el DOM object which may contain new ACF elements
409
+ * @return N/A
410
+ */
411
+
412
+ $(document).on('acf/setup_fields', function(e, el){
413
+
414
+ // reference
415
+ var self = acf.fields.google_map;
416
+
417
+
418
+ // vars
419
+ var $fields = $(el).find('.acf-google-map');
420
+
421
+
422
+ // validate
423
+ if( ! $fields.exists() ) return false;
424
+
425
+
426
+ // no google
427
+ if( !acf.helpers.isset(window, 'google', 'load') ) {
428
+
429
+ // load API
430
+ $.getScript('https://www.google.com/jsapi', function(){
431
+
432
+ // load maps
433
+ google.load('maps', '3', { other_params: $.param(self.api), callback: function(){
434
+
435
+ $fields.each(function(){
436
+
437
+ acf.fields.google_map.set({ $el : $(this) }).init();
438
+
439
+ });
440
+
441
+ }});
442
+
443
+ });
444
+
445
+ return false;
446
+
447
+ }
448
+
449
+
450
+ // no maps or places
451
+ if( !acf.helpers.isset(window, 'google', 'maps', 'places') ) {
452
+
453
+ google.load('maps', '3', { other_params: $.param(self.api), callback: function(){
454
+
455
+ $fields.each(function(){
456
+
457
+ acf.fields.google_map.set({ $el : $(this) }).init();
458
+
459
+ });
460
+
461
+ }});
462
+
463
+ return false;
464
+
465
+ }
466
+
467
+
468
+ // google exists
469
+ $fields.each(function(){
470
+
471
+ acf.fields.google_map.set({ $el : $(this) }).init();
472
+
473
+ });
474
+
475
+
476
+ // return
477
+ return true;
478
+
479
+ });
480
+
481
+
482
+ /*
483
+ * Events
484
+ *
485
+ * jQuery events for this field
486
+ *
487
+ * @type function
488
+ * @date 1/03/2011
489
+ *
490
+ * @param N/A
491
+ * @return N/A
492
+ */
493
+
494
+ $(document).on('click', '.acf-google-map .acf-sprite-remove', function( e ){
495
+
496
+ e.preventDefault();
497
+
498
+ acf.fields.google_map.set({ $el : $(this).closest('.acf-google-map') }).clear();
499
+
500
+ $(this).blur();
501
+
502
+ });
503
+
504
+
505
+ $(document).on('click', '.acf-google-map .acf-sprite-locate', function( e ){
506
+
507
+ e.preventDefault();
508
+
509
+ acf.fields.google_map.set({ $el : $(this).closest('.acf-google-map') }).locate();
510
+
511
+ $(this).blur();
512
+
513
+ });
514
+
515
+ $(document).on('click', '.acf-google-map .title h4', function( e ){
516
+
517
+ e.preventDefault();
518
+
519
+ acf.fields.google_map.set({ $el : $(this).closest('.acf-google-map') }).edit();
520
+
521
+ });
522
+
523
+ $(document).on('keydown', '.acf-google-map .search', function( e ){
524
+
525
+ // prevent form from submitting
526
+ if( e.which == 13 )
527
+ {
528
+ return false;
529
+ }
530
+
531
+ });
532
+
533
+ $(document).on('blur', '.acf-google-map .search', function( e ){
534
+
535
+ // vars
536
+ var $el = $(this).closest('.acf-google-map');
537
+
538
+
539
+ // has a value?
540
+ if( $el.find('.input-lat').val() )
541
+ {
542
+ $el.addClass('active');
543
+ }
544
+
545
+ });
546
+
547
+ $(document).on('acf/fields/tab/show acf/conditional_logic/show', function( e, $field ){
548
+
549
+ // validate
550
+ if( ! acf.fields.google_map.ready )
551
+ {
552
+ return;
553
+ }
554
+
555
+
556
+ // validate
557
+ if( $field.attr('data-field_type') == 'google_map' )
558
+ {
559
+ acf.fields.google_map.set({ $el : $field.find('.acf-google-map') }).refresh();
560
+ }
561
+
562
+ });
563
+
564
+
565
+
566
+ })(jQuery);
js/input/image.js ADDED
@@ -0,0 +1,447 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ /*
4
+ * Image
5
+ *
6
+ * static model for this field
7
+ *
8
+ * @type event
9
+ * @date 1/06/13
10
+ *
11
+ */
12
+
13
+
14
+ // reference
15
+ var _media = acf.media;
16
+
17
+
18
+ acf.fields.image = {
19
+
20
+ $el : null,
21
+ $input : null,
22
+
23
+ o : {},
24
+
25
+ set : function( o ){
26
+
27
+ // merge in new option
28
+ $.extend( this, o );
29
+
30
+
31
+ // find input
32
+ this.$input = this.$el.find('input[type="hidden"]');
33
+
34
+
35
+ // get options
36
+ this.o = acf.helpers.get_atts( this.$el );
37
+
38
+
39
+ // multiple?
40
+ this.o.multiple = this.$el.closest('.repeater').exists() ? true : false;
41
+
42
+
43
+ // wp library query
44
+ this.o.query = {
45
+ type : 'image'
46
+ };
47
+
48
+
49
+ // library
50
+ if( this.o.library == 'uploadedTo' )
51
+ {
52
+ this.o.query.uploadedTo = acf.o.post_id;
53
+ }
54
+
55
+
56
+ // return this for chaining
57
+ return this;
58
+
59
+ },
60
+ init : function(){
61
+
62
+ // is clone field?
63
+ if( acf.helpers.is_clone_field(this.$input) )
64
+ {
65
+ return;
66
+ }
67
+
68
+ },
69
+ add : function( image ){
70
+
71
+ // this function must reference a global div variable due to the pre WP 3.5 uploader
72
+ // vars
73
+ var div = _media.div;
74
+
75
+
76
+ // set atts
77
+ div.find('.acf-image-image').attr( 'src', image.url );
78
+ div.find('.acf-image-value').val( image.id ).trigger('change');
79
+
80
+
81
+ // set div class
82
+ div.addClass('active');
83
+
84
+
85
+ // validation
86
+ div.closest('.field').removeClass('error');
87
+
88
+ },
89
+
90
+ new_frame: function( attributes ){
91
+
92
+ // set global var
93
+ _media.div = this.$el;
94
+
95
+
96
+ // clear the frame
97
+ _media.clear_frame();
98
+
99
+
100
+ // vars
101
+ attributes.states = [];
102
+
103
+
104
+ // append states
105
+ attributes.states.push(
106
+ new wp.media.controller.Library({
107
+ library : wp.media.query( this.o.query ),
108
+ multiple : attributes.multiple,
109
+ title : attributes.title,
110
+ priority : 20,
111
+ filterable : 'all'
112
+ })
113
+ );
114
+
115
+
116
+ // edit image functionality (added in WP 3.9)
117
+ if( acf.helpers.isset(wp, 'media', 'controller', 'EditImage') ) {
118
+
119
+ attributes.states.push( new wp.media.controller.EditImage() );
120
+
121
+ }
122
+
123
+
124
+ // Create the media frame
125
+ _media.frame = wp.media( attributes );
126
+
127
+
128
+ // edit image view
129
+ // source: media-views.js:2410 editImageContent()
130
+ _media.frame.on('content:render:edit-image', function(){
131
+
132
+ var image = this.state().get('image'),
133
+ view = new wp.media.view.EditImage( { model: image, controller: this } ).render();
134
+
135
+ this.content.set( view );
136
+
137
+ // after creating the wrapper view, load the actual editor via an ajax call
138
+ view.loadEditor();
139
+
140
+ }, _media.frame);
141
+
142
+
143
+ // update toolbar button
144
+ _media.frame.on( 'toolbar:create:select', function( toolbar ) {
145
+
146
+ toolbar.view = new wp.media.view.Toolbar.Select({
147
+ text: attributes.button.text,
148
+ controller: this
149
+ });
150
+
151
+ }, _media.frame );
152
+
153
+
154
+ // return
155
+ return _media.frame;
156
+
157
+ },
158
+
159
+ edit : function(){
160
+
161
+ // vars
162
+ var id = this.$input.val();
163
+
164
+
165
+ // create frame
166
+ this.new_frame({
167
+ title : acf.l10n.image.edit,
168
+ multiple : false,
169
+ button : { text : acf.l10n.image.update }
170
+ });
171
+
172
+
173
+ // open
174
+ _media.frame.on('open',function() {
175
+
176
+ // set to browse
177
+ if( _media.frame.content._mode != 'browse' )
178
+ {
179
+ _media.frame.content.mode('browse');
180
+ }
181
+
182
+
183
+ // add class
184
+ _media.frame.$el.closest('.media-modal').addClass('acf-media-modal acf-expanded');
185
+
186
+
187
+ // set selection
188
+ var selection = _media.frame.state().get('selection'),
189
+ attachment = wp.media.attachment( id );
190
+
191
+
192
+ // to fetch or not to fetch
193
+ if( $.isEmptyObject(attachment.changed) )
194
+ {
195
+ attachment.fetch();
196
+ }
197
+
198
+
199
+ selection.add( attachment );
200
+
201
+ });
202
+
203
+
204
+ // close
205
+ _media.frame.on('close',function(){
206
+
207
+ // remove class
208
+ _media.frame.$el.closest('.media-modal').removeClass('acf-media-modal');
209
+
210
+ });
211
+
212
+
213
+ // Finally, open the modal
214
+ _media.frame.open();
215
+
216
+ },
217
+ remove : function()
218
+ {
219
+
220
+ // set atts
221
+ this.$el.find('.acf-image-image').attr( 'src', '' );
222
+ this.$el.find('.acf-image-value').val( '' ).trigger('change');
223
+
224
+
225
+ // remove class
226
+ this.$el.removeClass('active');
227
+
228
+ },
229
+ popup : function()
230
+ {
231
+ // reference
232
+ var t = this;
233
+
234
+
235
+ // create frame
236
+ this.new_frame({
237
+ title : acf.l10n.image.select,
238
+ multiple : t.o.multiple,
239
+ button : { text : acf.l10n.image.select }
240
+ });
241
+
242
+
243
+ // customize model / view
244
+ _media.frame.on('content:activate', function(){
245
+
246
+ // vars
247
+ var toolbar = null,
248
+ filters = null;
249
+
250
+
251
+ // populate above vars making sure to allow for failure
252
+ try
253
+ {
254
+ toolbar = acf.media.frame.content.get().toolbar;
255
+ filters = toolbar.get('filters');
256
+ }
257
+ catch(e)
258
+ {
259
+ // one of the objects was 'undefined'... perhaps the frame open is Upload Files
260
+ //console.log( e );
261
+ }
262
+
263
+
264
+ // validate
265
+ if( !filters )
266
+ {
267
+ return false;
268
+ }
269
+
270
+
271
+ // filter only images
272
+ $.each( filters.filters, function( k, v ){
273
+
274
+ v.props.type = 'image';
275
+
276
+ });
277
+
278
+
279
+ // no need for 'uploaded' filter
280
+ if( t.o.library == 'uploadedTo' )
281
+ {
282
+ filters.$el.find('option[value="uploaded"]').remove();
283
+ filters.$el.after('<span>' + acf.l10n.image.uploadedTo + '</span>')
284
+
285
+ $.each( filters.filters, function( k, v ){
286
+
287
+ v.props.uploadedTo = acf.o.post_id;
288
+
289
+ });
290
+ }
291
+
292
+
293
+ // remove non image options from filter list
294
+ filters.$el.find('option').each(function(){
295
+
296
+ // vars
297
+ var v = $(this).attr('value');
298
+
299
+
300
+ // don't remove the 'uploadedTo' if the library option is 'all'
301
+ if( v == 'uploaded' && t.o.library == 'all' )
302
+ {
303
+ return;
304
+ }
305
+
306
+ if( v.indexOf('image') === -1 )
307
+ {
308
+ $(this).remove();
309
+ }
310
+
311
+ });
312
+
313
+
314
+ // set default filter
315
+ filters.$el.val('image').trigger('change');
316
+
317
+ });
318
+
319
+
320
+ // When an image is selected, run a callback.
321
+ acf.media.frame.on( 'select', function() {
322
+
323
+ // get selected images
324
+ selection = _media.frame.state().get('selection');
325
+
326
+ if( selection )
327
+ {
328
+ var i = 0;
329
+
330
+ selection.each(function(attachment){
331
+
332
+ // counter
333
+ i++;
334
+
335
+
336
+ // select / add another image field?
337
+ if( i > 1 )
338
+ {
339
+ // vars
340
+ var $td = _media.div.closest('td'),
341
+ $tr = $td.closest('.row'),
342
+ $repeater = $tr.closest('.repeater'),
343
+ key = $td.attr('data-field_key'),
344
+ selector = 'td .acf-image-uploader:first';
345
+
346
+
347
+ // key only exists for repeater v1.0.1 +
348
+ if( key )
349
+ {
350
+ selector = 'td[data-field_key="' + key + '"] .acf-image-uploader';
351
+ }
352
+
353
+
354
+ // add row?
355
+ if( ! $tr.next('.row').exists() )
356
+ {
357
+ $repeater.find('.add-row-end').trigger('click');
358
+
359
+ }
360
+
361
+
362
+ // update current div
363
+ _media.div = $tr.next('.row').find( selector );
364
+
365
+ }
366
+
367
+
368
+ // vars
369
+ var image = {
370
+ id : attachment.id,
371
+ url : attachment.attributes.url
372
+ };
373
+
374
+ // is preview size available?
375
+ if( attachment.attributes.sizes && attachment.attributes.sizes[ t.o.preview_size ] )
376
+ {
377
+ image.url = attachment.attributes.sizes[ t.o.preview_size ].url;
378
+ }
379
+
380
+ // add image to field
381
+ acf.fields.image.add( image );
382
+
383
+
384
+ });
385
+ // selection.each(function(attachment){
386
+ }
387
+ // if( selection )
388
+
389
+ });
390
+ // acf.media.frame.on( 'select', function() {
391
+
392
+
393
+ // Finally, open the modal
394
+ acf.media.frame.open();
395
+
396
+
397
+ return false;
398
+ },
399
+
400
+ // temporary gallery fix
401
+ text : {
402
+ title_add : "Select Image",
403
+ title_edit : "Edit Image"
404
+ }
405
+
406
+ };
407
+
408
+
409
+ /*
410
+ * Events
411
+ *
412
+ * jQuery events for this field
413
+ *
414
+ * @type function
415
+ * @date 1/03/2011
416
+ *
417
+ * @param N/A
418
+ * @return N/A
419
+ */
420
+
421
+ $(document).on('click', '.acf-image-uploader .acf-button-edit', function( e ){
422
+
423
+ e.preventDefault();
424
+
425
+ acf.fields.image.set({ $el : $(this).closest('.acf-image-uploader') }).edit();
426
+
427
+ });
428
+
429
+ $(document).on('click', '.acf-image-uploader .acf-button-delete', function( e ){
430
+
431
+ e.preventDefault();
432
+
433
+ acf.fields.image.set({ $el : $(this).closest('.acf-image-uploader') }).remove();
434
+
435
+ });
436
+
437
+
438
+ $(document).on('click', '.acf-image-uploader .add-image', function( e ){
439
+
440
+ e.preventDefault();
441
+
442
+ acf.fields.image.set({ $el : $(this).closest('.acf-image-uploader') }).popup();
443
+
444
+ });
445
+
446
+
447
+ })(jQuery);
js/input/radio.js ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ /*
4
+ * Radio
5
+ *
6
+ * static model and events for this field
7
+ *
8
+ * @type event
9
+ * @date 1/06/13
10
+ *
11
+ */
12
+
13
+ acf.fields.radio = {
14
+
15
+ $el : null,
16
+ $input : null,
17
+ $other : null,
18
+ farbtastic : null,
19
+
20
+ set : function( o ){
21
+
22
+ // merge in new option
23
+ $.extend( this, o );
24
+
25
+
26
+ // find input
27
+ this.$input = this.$el.find('input[type="radio"]:checked');
28
+ this.$other = this.$el.find('input[type="text"]');
29
+
30
+
31
+ // return this for chaining
32
+ return this;
33
+
34
+ },
35
+ change : function(){
36
+
37
+ if( this.$input.val() == 'other' )
38
+ {
39
+ this.$other.attr('name', this.$input.attr('name'));
40
+ this.$other.show();
41
+ }
42
+ else
43
+ {
44
+ this.$other.attr('name', '');
45
+ this.$other.hide();
46
+ }
47
+ }
48
+ };
49
+
50
+
51
+ /*
52
+ * Events
53
+ *
54
+ * jQuery events for this field
55
+ *
56
+ * @type function
57
+ * @date 1/03/2011
58
+ *
59
+ * @param N/A
60
+ * @return N/A
61
+ */
62
+
63
+ $(document).on('change', '.acf-radio-list input[type="radio"]', function( e ){
64
+
65
+ acf.fields.radio.set({ $el : $(this).closest('.acf-radio-list') }).change();
66
+
67
+ });
68
+
69
+
70
+ })(jQuery);
js/input/relationship.js ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ /*
4
+ * Relationship
5
+ *
6
+ * static model for this field
7
+ *
8
+ * @type event
9
+ * @date 1/06/13
10
+ *
11
+ */
12
+
13
+ acf.fields.relationship = {
14
+
15
+ $el : null,
16
+ $input : null,
17
+ $left : null,
18
+ $right : null,
19
+
20
+ o : {},
21
+
22
+ timeout : null,
23
+
24
+ set : function( o ){
25
+
26
+ // merge in new option
27
+ $.extend( this, o );
28
+
29
+
30
+ // find elements
31
+ this.$input = this.$el.children('input[type="hidden"]');
32
+ this.$left = this.$el.find('.relationship_left'),
33
+ this.$right = this.$el.find('.relationship_right');
34
+
35
+
36
+ // get options
37
+ this.o = acf.helpers.get_atts( this.$el );
38
+
39
+
40
+ // return this for chaining
41
+ return this;
42
+
43
+ },
44
+ init : function(){
45
+
46
+ // reference
47
+ var _this = this;
48
+
49
+
50
+ // is clone field?
51
+ if( acf.helpers.is_clone_field(this.$input) )
52
+ {
53
+ return;
54
+ }
55
+
56
+
57
+ // set height of right column
58
+ this.$right.find('.relationship_list').height( this.$left.height() -2 );
59
+
60
+
61
+ // right sortable
62
+ this.$right.find('.relationship_list').sortable({
63
+ axis : 'y',
64
+ items : '> li',
65
+ forceHelperSize : true,
66
+ forcePlaceholderSize : true,
67
+ scroll : true,
68
+ update : function(){
69
+
70
+ _this.$input.trigger('change');
71
+
72
+ }
73
+ });
74
+
75
+
76
+ // load more
77
+ var $el = this.$el;
78
+
79
+ this.$left.find('.relationship_list').scrollTop( 0 ).on('scroll', function(e){
80
+
81
+ // validate
82
+ if( $el.hasClass('loading') || $el.hasClass('no-results') )
83
+ {
84
+ return;
85
+ }
86
+
87
+
88
+ // Scrolled to bottom
89
+ if( $(this).scrollTop() + $(this).innerHeight() >= $(this).get(0).scrollHeight )
90
+ {
91
+ var paged = parseInt( $el.attr('data-paged') );
92
+
93
+ // update paged
94
+ $el.attr('data-paged', (paged + 1) );
95
+
96
+ // fetch
97
+ _this.set({ $el : $el }).fetch();
98
+ }
99
+
100
+ });
101
+
102
+
103
+ // ajax fetch values for left side
104
+ this.fetch();
105
+
106
+ },
107
+ fetch : function(){
108
+
109
+ // reference
110
+ var _this = this,
111
+ $el = this.$el;
112
+
113
+
114
+ // add loading class, stops scroll loading
115
+ $el.addClass('loading');
116
+
117
+
118
+ // get results
119
+ $.ajax({
120
+ url : acf.o.ajaxurl,
121
+ type : 'post',
122
+ dataType : 'json',
123
+ data : $.extend({
124
+ action : 'acf/fields/relationship/query_posts',
125
+ post_id : acf.o.post_id,
126
+ nonce : acf.o.nonce
127
+ }, this.o ),
128
+ success : function( json ){
129
+
130
+
131
+ // render
132
+ _this.set({ $el : $el }).render( json );
133
+
134
+ }
135
+ });
136
+
137
+ },
138
+ render : function( json ){
139
+
140
+ // reference
141
+ var _this = this;
142
+
143
+
144
+ // update classes
145
+ this.$el.removeClass('no-results').removeClass('loading');
146
+
147
+
148
+ // new search?
149
+ if( this.o.paged == 1 )
150
+ {
151
+ this.$el.find('.relationship_left li:not(.load-more)').remove();
152
+ }
153
+
154
+
155
+ // no results?
156
+ if( ! json || ! json.html )
157
+ {
158
+ this.$el.addClass('no-results');
159
+ return;
160
+ }
161
+
162
+
163
+ // append new results
164
+ this.$el.find('.relationship_left .load-more').before( json.html );
165
+
166
+
167
+ // next page?
168
+ if( ! json.next_page_exists )
169
+ {
170
+ this.$el.addClass('no-results');
171
+ }
172
+
173
+
174
+ // apply .hide to left li's
175
+ this.$left.find('a').each(function(){
176
+
177
+ var id = $(this).attr('data-post_id');
178
+
179
+ if( _this.$right.find('a[data-post_id="' + id + '"]').exists() )
180
+ {
181
+ $(this).parent().addClass('hide');
182
+ }
183
+
184
+ });
185
+
186
+ },
187
+ add : function( $a ){
188
+
189
+ // vars
190
+ var id = $a.attr('data-post_id'),
191
+ title = $a.html();
192
+
193
+
194
+ // max posts
195
+ if( this.$right.find('a').length >= this.o.max )
196
+ {
197
+ alert( acf.l10n.relationship.max.replace('{max}', this.o.max) );
198
+ return false;
199
+ }
200
+
201
+
202
+ // can be added?
203
+ if( $a.parent().hasClass('hide') )
204
+ {
205
+ return false;
206
+ }
207
+
208
+
209
+ // hide
210
+ $a.parent().addClass('hide');
211
+
212
+
213
+ // template
214
+ var html = [
215
+ '<li>',
216
+ '<a href="#" data-post_id="' + $a.attr('data-post_id') + '">',
217
+ $a.html() + '<span class="acf-button-remove"></span>',
218
+ '</a>',
219
+ '<input type="hidden" name="' + this.$input.attr('name') + '[]" value="' + $a.attr('data-post_id') + '" />',
220
+ '</li>'].join('');
221
+
222
+
223
+ // add new li
224
+ this.$right.find('.relationship_list').append( html )
225
+
226
+
227
+ // trigger change on new_li
228
+ this.$input.trigger('change');
229
+
230
+
231
+ // validation
232
+ this.$el.closest('.field').removeClass('error');
233
+
234
+
235
+ },
236
+ remove : function( $a ){
237
+
238
+ // remove
239
+ $a.parent().remove();
240
+
241
+
242
+ // show
243
+ this.$left.find('a[data-post_id="' + $a.attr('data-post_id') + '"]').parent('li').removeClass('hide');
244
+
245
+
246
+ // trigger change on new_li
247
+ this.$input.trigger('change');
248
+
249
+ }
250
+
251
+ };
252
+
253
+
254
+ /*
255
+ * acf/setup_fields
256
+ *
257
+ * run init function on all elements for this field
258
+ *
259
+ * @type event
260
+ * @date 20/07/13
261
+ *
262
+ * @param {object} e event object
263
+ * @param {object} el DOM object which may contain new ACF elements
264
+ * @return N/A
265
+ */
266
+
267
+ $(document).on('acf/setup_fields', function(e, el){
268
+
269
+ $(el).find('.acf_relationship').each(function(){
270
+
271
+ acf.fields.relationship.set({ $el : $(this) }).init();
272
+
273
+ });
274
+
275
+ });
276
+
277
+
278
+ /*
279
+ * Events
280
+ *
281
+ * jQuery events for this field
282
+ *
283
+ * @type function
284
+ * @date 1/03/2011
285
+ *
286
+ * @param N/A
287
+ * @return N/A
288
+ */
289
+
290
+ $(document).on('change', '.acf_relationship .select-post_type', function(e){
291
+
292
+ // vars
293
+ var val = $(this).val(),
294
+ $el = $(this).closest('.acf_relationship');
295
+
296
+
297
+ // update attr
298
+ $el.attr('data-post_type', val);
299
+ $el.attr('data-paged', 1);
300
+
301
+
302
+ // fetch
303
+ acf.fields.relationship.set({ $el : $el }).fetch();
304
+
305
+ });
306
+
307
+
308
+ $(document).on('click', '.acf_relationship .relationship_left .relationship_list a', function( e ){
309
+
310
+ e.preventDefault();
311
+
312
+ acf.fields.relationship.set({ $el : $(this).closest('.acf_relationship') }).add( $(this) );
313
+
314
+ $(this).blur();
315
+
316
+ });
317
+
318
+ $(document).on('click', '.acf_relationship .relationship_right .relationship_list a', function( e ){
319
+
320
+ e.preventDefault();
321
+
322
+ acf.fields.relationship.set({ $el : $(this).closest('.acf_relationship') }).remove( $(this) );
323
+
324
+ $(this).blur();
325
+
326
+ });
327
+
328
+ $(document).on('keyup', '.acf_relationship input.relationship_search', function( e ){
329
+
330
+ // vars
331
+ var val = $(this).val(),
332
+ $el = $(this).closest('.acf_relationship');
333
+
334
+
335
+ // update attr
336
+ $el.attr('data-s', val);
337
+ $el.attr('data-paged', 1);
338
+
339
+
340
+ // fetch
341
+ clearTimeout( acf.fields.relationship.timeout );
342
+ acf.fields.relationship.timeout = setTimeout(function(){
343
+
344
+ acf.fields.relationship.set({ $el : $el }).fetch();
345
+
346
+ }, 500);
347
+
348
+ });
349
+
350
+ $(document).on('keypress', '.acf_relationship input.relationship_search', function( e ){
351
+
352
+ // don't submit form
353
+ if( e.which == 13 )
354
+ {
355
+ e.preventDefault();
356
+ }
357
+
358
+ });
359
+
360
+
361
+ })(jQuery);
js/input/tab.js ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ acf.fields.tab = {
4
+
5
+ add_group : function( $wrap ){
6
+
7
+ // vars
8
+ var html = '';
9
+
10
+
11
+ // generate html
12
+ if( $wrap.is('tbody') )
13
+ {
14
+ html = '<tr class="acf-tab-wrap"><td colspan="2"><ul class="hl clearfix acf-tab-group"></ul></td></tr>';
15
+ }
16
+ else
17
+ {
18
+ html = '<div class="acf-tab-wrap"><ul class="hl clearfix acf-tab-group"></ul></div>';
19
+ }
20
+
21
+
22
+ // append html
23
+ $wrap.children('.field_type-tab:first').before( html );
24
+
25
+ },
26
+
27
+ add_tab : function( $tab ){
28
+
29
+ // vars
30
+ var $field = $tab.closest('.field'),
31
+ $wrap = $field.parent(),
32
+
33
+ key = $field.attr('data-field_key'),
34
+ label = $tab.text();
35
+
36
+
37
+ // create tab group if it doesnt exist
38
+ if( ! $wrap.children('.acf-tab-wrap').exists() )
39
+ {
40
+ this.add_group( $wrap );
41
+ }
42
+
43
+ // add tab
44
+ $wrap.children('.acf-tab-wrap').find('.acf-tab-group').append('<li><a class="acf-tab-button" href="#" data-key="' + key + '">' + label + '</a></li>');
45
+
46
+ },
47
+
48
+ toggle : function( $a ){
49
+
50
+ // reference
51
+ var _this = this;
52
+
53
+
54
+ //console.log( 'toggle %o ', $a);
55
+ // vars
56
+ var $wrap = $a.closest('.acf-tab-wrap').parent(),
57
+ key = $a.attr('data-key');
58
+
59
+
60
+ // classes
61
+ $a.parent('li').addClass('active').siblings('li').removeClass('active');
62
+
63
+
64
+ // hide / show
65
+ $wrap.children('.field_type-tab').each(function(){
66
+
67
+
68
+ // vars
69
+ var $tab = $(this);
70
+
71
+
72
+ if( $tab.attr('data-field_key') == key )
73
+ {
74
+ _this.show_tab_fields( $(this) );
75
+ }
76
+ else
77
+ {
78
+ _this.hide_tab_fields( $(this) );
79
+ }
80
+
81
+
82
+ });
83
+
84
+ },
85
+
86
+ show_tab_fields : function( $field ) {
87
+
88
+ //console.log('show tab fields %o', $field);
89
+ $field.nextUntil('.field_type-tab').each(function(){
90
+
91
+ $(this).removeClass('acf-tab_group-hide').addClass('acf-tab_group-show');
92
+ $(document).trigger('acf/fields/tab/show', [ $(this) ]);
93
+
94
+ });
95
+ },
96
+
97
+ hide_tab_fields : function( $field ) {
98
+
99
+ $field.nextUntil('.field_type-tab').each(function(){
100
+
101
+ $(this).removeClass('acf-tab_group-show').addClass('acf-tab_group-hide');
102
+ $(document).trigger('acf/fields/tab/hide', [ $(this) ]);
103
+
104
+ });
105
+ },
106
+
107
+ refresh : function( $el ){
108
+
109
+ // reference
110
+ var _this = this;
111
+
112
+
113
+ // trigger
114
+ $el.find('.acf-tab-group').each(function(){
115
+
116
+ $(this).find('.acf-tab-button:first').each(function(){
117
+
118
+ _this.toggle( $(this) );
119
+
120
+ });
121
+
122
+ });
123
+
124
+ }
125
+
126
+ };
127
+
128
+
129
+ /*
130
+ * acf/setup_fields
131
+ *
132
+ * run init function on all elements for this field
133
+ *
134
+ * @type event
135
+ * @date 20/07/13
136
+ *
137
+ * @param {object} e event object
138
+ * @param {object} el DOM object which may contain new ACF elements
139
+ * @return N/A
140
+ */
141
+
142
+ $(document).on('acf/setup_fields', function(e, el){
143
+
144
+ // add tabs
145
+ $(el).find('.acf-tab').each(function(){
146
+
147
+ acf.fields.tab.add_tab( $(this) );
148
+
149
+ });
150
+
151
+
152
+ // activate first tab
153
+ acf.fields.tab.refresh( $(el) );
154
+
155
+
156
+ // NOTE: this code is defined BEFORE the acf.conditional_logic action. This is becuase the 'acf/setup_fields' listener is defined INSIDE the conditional_logic.init() function which is run on doc.ready
157
+
158
+ // trigger conditional logic
159
+ // this code ( acf/setup_fields ) is run after the main acf.conditional_logic.init();
160
+ //console.log('acf/setup_fields (after tab refresh) calling acf.conditional_logic.refresh()');
161
+ //acf.conditional_logic.refresh();
162
+
163
+ });
164
+
165
+
166
+
167
+
168
+ /*
169
+ * Events
170
+ *
171
+ * jQuery events for this field
172
+ *
173
+ * @type function
174
+ * @date 1/03/2011
175
+ *
176
+ * @param N/A
177
+ * @return N/A
178
+ */
179
+
180
+ $(document).on('click', '.acf-tab-button', function( e ){
181
+
182
+ e.preventDefault();
183
+
184
+ acf.fields.tab.toggle( $(this) );
185
+
186
+ $(this).trigger('blur');
187
+
188
+ });
189
+
190
+
191
+ $(document).on('acf/conditional_logic/hide', function( e, $target, item ){
192
+
193
+ // validate
194
+ if( $target.attr('data-field_type') != 'tab' )
195
+ {
196
+ return;
197
+ }
198
+
199
+ //console.log('conditional_logic/hide tab %o', $target);
200
+
201
+
202
+ // vars
203
+ var $tab = $target.siblings('.acf-tab-wrap').find('a[data-key="' + $target.attr('data-field_key') + '"]');
204
+
205
+
206
+ // if tab is already hidden, then ignore the following functiolnality
207
+ if( $tab.is(':hidden') )
208
+ {
209
+ return;
210
+ }
211
+
212
+
213
+ // visibility
214
+ $tab.parent().hide();
215
+
216
+
217
+ // if
218
+ if( $tab.parent().siblings(':visible').exists() )
219
+ {
220
+ // if the $target to be hidden is a tab button, lets toggle a sibling tab button
221
+ $tab.parent().siblings(':visible').first().children('a').trigger('click');
222
+ }
223
+ else
224
+ {
225
+ // no onther tabs
226
+ acf.fields.tab.hide_tab_fields( $target );
227
+ }
228
+
229
+ });
230
+
231
+
232
+ $(document).on('acf/conditional_logic/show', function( e, $target, item ){
233
+
234
+ // validate
235
+ if( $target.attr('data-field_type') != 'tab' )
236
+ {
237
+ return;
238
+ }
239
+
240
+
241
+ //console.log('conditional_logic/show tab %o', $target);
242
+
243
+
244
+ // vars
245
+ var $tab = $target.siblings('.acf-tab-wrap').find('a[data-key="' + $target.attr('data-field_key') + '"]');
246
+
247
+
248
+ // if tab is already visible, then ignore the following functiolnality
249
+ if( $tab.is(':visible') )
250
+ {
251
+ return;
252
+ }
253
+
254
+
255
+ // visibility
256
+ $tab.parent().show();
257
+
258
+
259
+ // if this is the active tab
260
+ if( $tab.parent().hasClass('active') )
261
+ {
262
+ $tab.trigger('click');
263
+ return;
264
+ }
265
+
266
+
267
+ // if the sibling active tab is actually hidden by conditional logic, take ownership of tabs
268
+ if( $tab.parent().siblings('.active').is(':hidden') )
269
+ {
270
+ // show this tab group
271
+ $tab.trigger('click');
272
+ return;
273
+ }
274
+
275
+
276
+ });
277
+
278
+
279
+
280
+ })(jQuery);
js/input/validation.js ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+
4
+ /*
5
+ * Validation
6
+ *
7
+ * JS model
8
+ *
9
+ * @type object
10
+ * @date 1/06/13
11
+ *
12
+ */
13
+
14
+ acf.validation = {
15
+
16
+ status : true,
17
+ disabled : false,
18
+
19
+ run : function(){
20
+
21
+ // reference
22
+ var _this = this;
23
+
24
+
25
+ // reset
26
+ _this.status = true;
27
+
28
+
29
+ // loop through all fields
30
+ $('.field.required, .form-field.required').each(function(){
31
+
32
+ // run validation
33
+ _this.validate( $(this) );
34
+
35
+
36
+ });
37
+ // end loop through all fields
38
+ },
39
+
40
+ /*
41
+ * show_spinner
42
+ *
43
+ * This function will show a spinner element. Logic changed in WP 4.2
44
+ *
45
+ * @type function
46
+ * @date 3/05/2015
47
+ * @since 5.2.3
48
+ *
49
+ * @param $spinner (jQuery)
50
+ * @return n/a
51
+ */
52
+
53
+ show_spinner: function( $spinner ){
54
+
55
+ // bail early if no spinner
56
+ if( !$spinner.exists() ) {
57
+
58
+ return;
59
+
60
+ }
61
+
62
+
63
+ // vars
64
+ var wp_version = acf.o.wp_version;
65
+
66
+
67
+ // show
68
+ if( parseFloat(wp_version) >= 4.2 ) {
69
+
70
+ $spinner.addClass('is-active');
71
+
72
+ } else {
73
+
74
+ $spinner.css('display', 'inline-block');
75
+
76
+ }
77
+
78
+ },
79
+
80
+
81
+ /*
82
+ * hide_spinner
83
+ *
84
+ * This function will hide a spinner element. Logic changed in WP 4.2
85
+ *
86
+ * @type function
87
+ * @date 3/05/2015
88
+ * @since 5.2.3
89
+ *
90
+ * @param $spinner (jQuery)
91
+ * @return n/a
92
+ */
93
+
94
+ hide_spinner: function( $spinner ){
95
+
96
+ // bail early if no spinner
97
+ if( !$spinner.exists() ) {
98
+
99
+ return;
100
+
101
+ }
102
+
103
+
104
+ // vars
105
+ var wp_version = acf.o.wp_version;
106
+
107
+
108
+ // hide
109
+ if( parseFloat(wp_version) >= 4.2 ) {
110
+
111
+ $spinner.removeClass('is-active');
112
+
113
+ } else {
114
+
115
+ $spinner.css('display', 'none');
116
+
117
+ }
118
+
119
+ },
120
+
121
+ validate : function( div ){
122
+
123
+ // var
124
+ var ignore = false,
125
+ $tab = null;
126
+
127
+
128
+ // set validation data
129
+ div.data('validation', true);
130
+
131
+
132
+ // not visible
133
+ if( div.is(':hidden') )
134
+ {
135
+ // ignore validation
136
+ ignore = true;
137
+
138
+
139
+ // if this field is hidden by a tab group, allow validation
140
+ if( div.hasClass('acf-tab_group-hide') )
141
+ {
142
+ ignore = false;
143
+
144
+
145
+ // vars
146
+ var $tab_field = div.prevAll('.field_type-tab:first'),
147
+ $tab_group = div.prevAll('.acf-tab-wrap:first');
148
+
149
+
150
+ // if the tab itself is hidden, bypass validation
151
+ if( $tab_field.hasClass('acf-conditional_logic-hide') )
152
+ {
153
+ ignore = true;
154
+ }
155
+ else
156
+ {
157
+ // activate this tab as it holds hidden required field!
158
+ $tab = $tab_group.find('.acf-tab-button[data-key="' + $tab_field.attr('data-field_key') + '"]');
159
+ }
160
+ }
161
+ }
162
+
163
+
164
+ // if is hidden by conditional logic, ignore
165
+ if( div.hasClass('acf-conditional_logic-hide') )
166
+ {
167
+ ignore = true;
168
+ }
169
+
170
+
171
+ // if field group is hidden, igrnoe
172
+ if( div.closest('.postbox.acf-hidden').exists() ) {
173
+
174
+ ignore = true;
175
+
176
+ }
177
+
178
+
179
+ if( ignore )
180
+ {
181
+ return;
182
+ }
183
+
184
+
185
+
186
+ // text / textarea
187
+ if( div.find('input[type="text"], input[type="email"], input[type="number"], input[type="hidden"], textarea').val() == "" )
188
+ {
189
+ div.data('validation', false);
190
+ }
191
+
192
+
193
+ // wysiwyg
194
+ if( div.find('.acf_wysiwyg').exists() && typeof(tinyMCE) == "object")
195
+ {
196
+ div.data('validation', true);
197
+
198
+ var id = div.find('.wp-editor-area').attr('id'),
199
+ editor = tinyMCE.get( id );
200
+
201
+
202
+ if( editor && !editor.getContent() )
203
+ {
204
+ div.data('validation', false);
205
+ }
206
+ }
207
+
208
+
209
+ // select
210
+ if( div.find('select').exists() )
211
+ {
212
+ div.data('validation', true);
213
+
214
+ if( div.find('select').val() == "null" || ! div.find('select').val() )
215
+ {
216
+ div.data('validation', false);
217
+ }
218
+ }
219
+
220
+
221
+ // radio
222
+ if( div.find('input[type="radio"]').exists() )
223
+ {
224
+ div.data('validation', false);
225
+
226
+ if( div.find('input[type="radio"]:checked').exists() )
227
+ {
228
+ div.data('validation', true);
229
+ }
230
+ }
231
+
232
+
233
+ // checkbox
234
+ if( div.find('input[type="checkbox"]').exists() )
235
+ {
236
+ div.data('validation', false);
237
+
238
+ if( div.find('input[type="checkbox"]:checked').exists() )
239
+ {
240
+ div.data('validation', true);
241
+ }
242
+ }
243
+
244
+
245
+ // relationship
246
+ if( div.find('.acf_relationship').exists() )
247
+ {
248
+ div.data('validation', false);
249
+
250
+ if( div.find('.acf_relationship .relationship_right input').exists() )
251
+ {
252
+ div.data('validation', true);
253
+ }
254
+ }
255
+
256
+
257
+ // repeater
258
+ if( div.find('.repeater').exists() )
259
+ {
260
+ div.data('validation', false);
261
+
262
+ if( div.find('.repeater tr.row').exists() )
263
+ {
264
+ div.data('validation', true);
265
+ }
266
+ }
267
+
268
+
269
+ // gallery
270
+ if( div.find('.acf-gallery').exists() )
271
+ {
272
+ div.data('validation', false);
273
+
274
+ if( div.find('.acf-gallery .thumbnail').exists())
275
+ {
276
+ div.data('validation', true);
277
+ }
278
+ }
279
+
280
+
281
+ // hook for custom validation
282
+ $(document).trigger('acf/validate_field', [ div ] );
283
+
284
+
285
+ // set validation
286
+ if( ! div.data('validation') )
287
+ {
288
+ // show error
289
+ this.status = false;
290
+ div.closest('.field').addClass('error');
291
+
292
+
293
+ // custom validation message
294
+ if( div.data('validation_message') )
295
+ {
296
+ var $label = div.find('p.label:first'),
297
+ $message = null;
298
+
299
+
300
+ // remove old message
301
+ $label.children('.acf-error-message').remove();
302
+
303
+
304
+ $label.append( '<span class="acf-error-message"><i class="bit"></i>' + div.data('validation_message') + '</span>' );
305
+ }
306
+
307
+
308
+ // display field (curently hidden due to another tab being active)
309
+ if( $tab )
310
+ {
311
+ $tab.trigger('click');
312
+ }
313
+
314
+ }
315
+ }
316
+
317
+ };
318
+
319
+
320
+ /*
321
+ * Events
322
+ *
323
+ * Remove error class on focus
324
+ *
325
+ * @type function
326
+ * @date 1/03/2011
327
+ *
328
+ * @param N/A
329
+ * @return N/A
330
+ */
331
+
332
+ $(document).on('focus click', '.field.required input, .field.required textarea, .field.required select', function( e ){
333
+
334
+ $(this).closest('.field').removeClass('error');
335
+
336
+ });
337
+
338
+
339
+ /*
340
+ $(document).on('blur change', '.field.required input, .field.required textarea, .field.required select', function( e ){
341
+
342
+ acf.validation.validate( $(this).closest('.field') );
343
+
344
+ });
345
+ */
346
+
347
+
348
+ /*
349
+ * Save Post
350
+ *
351
+ * If user is saving a draft, allow them to bypass the validation
352
+ *
353
+ * @type function
354
+ * @date 1/03/2011
355
+ *
356
+ * @param N/A
357
+ * @return N/A
358
+ */
359
+
360
+ $(document).on('click', '#save-post', function(){
361
+
362
+ acf.validation.disabled = true;
363
+
364
+ });
365
+
366
+
367
+ /*
368
+ * Submit Post
369
+ *
370
+ * Run validation and return true|false accordingly
371
+ *
372
+ * @type function
373
+ * @date 1/03/2011
374
+ *
375
+ * @param N/A
376
+ * @return N/A
377
+ */
378
+
379
+ $(document).on('submit', '#post', function(){
380
+
381
+ // If disabled, bail early on the validation check
382
+ if( acf.validation.disabled )
383
+ {
384
+ return true;
385
+ }
386
+
387
+
388
+ // do validation
389
+ acf.validation.run();
390
+
391
+
392
+ if( ! acf.validation.status ) {
393
+
394
+ // vars
395
+ var $form = $(this);
396
+
397
+
398
+ // show message
399
+ $form.siblings('#message').remove();
400
+ $form.before('<div id="message" class="error"><p>' + acf.l10n.validation.error + '</p></div>');
401
+
402
+
403
+ // hide ajax stuff on submit button
404
+ if( $('#submitdiv').exists() ) {
405
+
406
+ // remove disabled classes
407
+ $('#submitdiv').find('.disabled').removeClass('disabled');
408
+ $('#submitdiv').find('.button-disabled').removeClass('button-disabled');
409
+ $('#submitdiv').find('.button-primary-disabled').removeClass('button-primary-disabled');
410
+
411
+
412
+ // remove spinner
413
+ acf.validation.hide_spinner( $('#submitdiv .spinner') );
414
+
415
+ }
416
+
417
+ return false;
418
+ }
419
+
420
+
421
+ // remove hidden postboxes
422
+ // + this will stop them from being posted to save
423
+ $('.acf_postbox.acf-hidden').remove();
424
+
425
+
426
+ // submit the form
427
+ return true;
428
+
429
+ });
430
+
431
+
432
+ })(jQuery);
js/input/wysiwyg.js ADDED
@@ -0,0 +1,556 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ /*
4
+ * WYSIWYG
5
+ *
6
+ * jQuery functionality for this field type
7
+ *
8
+ * @type object
9
+ * @date 20/07/13
10
+ *
11
+ * @param N/A
12
+ * @return N/A
13
+ */
14
+
15
+ var _wysiwyg = acf.fields.wysiwyg = {
16
+
17
+ $el: null,
18
+ $textarea: null,
19
+
20
+ o: {},
21
+
22
+ set: function( o ){
23
+
24
+ // merge in new option
25
+ $.extend( this, o );
26
+
27
+
28
+ // find textarea
29
+ this.$textarea = this.$el.find('textarea');
30
+
31
+
32
+ // get options
33
+ this.o = acf.helpers.get_atts( this.$el );
34
+ this.o.id = this.$textarea.attr('id');
35
+
36
+
37
+ // return this for chaining
38
+ return this;
39
+
40
+ },
41
+
42
+ has_tinymce : function(){
43
+
44
+ var r = false;
45
+
46
+ if( typeof(tinyMCE) == "object" )
47
+ {
48
+ r = true;
49
+ }
50
+
51
+ return r;
52
+
53
+ },
54
+
55
+ get_toolbar : function(){
56
+
57
+ // safely get toolbar
58
+ if( acf.helpers.isset( this, 'toolbars', this.o.toolbar ) ) {
59
+
60
+ return this.toolbars[ this.o.toolbar ];
61
+
62
+ }
63
+
64
+
65
+ // return
66
+ return false;
67
+
68
+ },
69
+
70
+ init : function(){
71
+
72
+ // is clone field?
73
+ if( acf.helpers.is_clone_field( this.$textarea ) )
74
+ {
75
+ return;
76
+ }
77
+
78
+
79
+ // vars
80
+ var id = this.o.id,
81
+ toolbar = this.get_toolbar(),
82
+ command = 'mceAddControl',
83
+ setting = 'theme_advanced_buttons{i}';
84
+
85
+
86
+ // backup
87
+ var _settings = $.extend( {}, tinyMCE.settings );
88
+
89
+
90
+ // v4 settings
91
+ if( tinymce.majorVersion == 4 ) {
92
+
93
+ command = 'mceAddEditor';
94
+ setting = 'toolbar{i}';
95
+
96
+ }
97
+
98
+
99
+ // add toolbars
100
+ if( toolbar ) {
101
+
102
+ for( var i = 1; i < 5; i++ ) {
103
+
104
+ // vars
105
+ var v = '';
106
+
107
+
108
+ // load toolbar
109
+ if( acf.helpers.isset( toolbar, 'theme_advanced_buttons' + i ) ) {
110
+
111
+ v = toolbar['theme_advanced_buttons' + i];
112
+
113
+ }
114
+
115
+
116
+ // update setting
117
+ tinyMCE.settings[ setting.replace('{i}', i) ] = v;
118
+
119
+ }
120
+
121
+ }
122
+
123
+
124
+ // add editor
125
+ tinyMCE.execCommand( command, false, id);
126
+
127
+
128
+ // events - load
129
+ $(document).trigger('acf/wysiwyg/load', id);
130
+
131
+
132
+ // add events (click, focus, blur) for inserting image into correct editor
133
+ setTimeout(function(){
134
+
135
+ _wysiwyg.add_events( id );
136
+
137
+ }, 100);
138
+
139
+
140
+ // restore tinyMCE.settings
141
+ tinyMCE.settings = _settings;
142
+
143
+
144
+ // set active editor to null
145
+ wpActiveEditor = null;
146
+
147
+ },
148
+
149
+ add_events: function( id ){
150
+
151
+ // vars
152
+ var editor = tinyMCE.get( id );
153
+
154
+
155
+ // validate
156
+ if( !editor ) return;
157
+
158
+
159
+ // vars
160
+ var $container = $('#wp-' + id + '-wrap'),
161
+ $body = $( editor.getBody() );
162
+
163
+
164
+ // events
165
+ $container.on('click', function(){
166
+
167
+ $(document).trigger('acf/wysiwyg/click', id);
168
+
169
+ });
170
+
171
+ $body.on('focus', function(){
172
+
173
+ $(document).trigger('acf/wysiwyg/focus', id);
174
+
175
+ });
176
+
177
+ $body.on('blur', function(){
178
+
179
+ $(document).trigger('acf/wysiwyg/blur', id);
180
+
181
+ });
182
+
183
+
184
+ },
185
+ destroy : function(){
186
+
187
+ // vars
188
+ var id = this.o.id,
189
+ command = 'mceRemoveControl';
190
+
191
+
192
+ // Remove tinymcy functionality.
193
+ // Due to the media popup destroying and creating the field within such a short amount of time,
194
+ // a JS error will be thrown when launching the edit window twice in a row.
195
+ try {
196
+
197
+ // vars
198
+ var editor = tinyMCE.get( id );
199
+
200
+
201
+ // validate
202
+ if( !editor ) {
203
+
204
+ return;
205
+
206
+ }
207
+
208
+
209
+ // v4 settings
210
+ if( tinymce.majorVersion == 4 ) {
211
+
212
+ command = 'mceRemoveEditor';
213
+
214
+ }
215
+
216
+
217
+ // store value
218
+ var val = editor.getContent();
219
+
220
+
221
+ // remove editor
222
+ tinyMCE.execCommand(command, false, id);
223
+
224
+
225
+ // set value
226
+ this.$textarea.val( val );
227
+
228
+
229
+ } catch(e) {
230
+
231
+ //console.log( e );
232
+
233
+ }
234
+
235
+
236
+ // set active editor to null
237
+ wpActiveEditor = null;
238
+
239
+ }
240
+
241
+ };
242
+
243
+
244
+ /*
245
+ * acf/setup_fields
246
+ *
247
+ * run init function on all elements for this field
248
+ *
249
+ * @type event
250
+ * @date 20/07/13
251
+ *
252
+ * @param {object} e event object
253
+ * @param {object} el DOM object which may contain new ACF elements
254
+ * @return N/A
255
+ */
256
+
257
+ $(document).on('acf/setup_fields', function(e, el){
258
+
259
+ // validate
260
+ if( ! _wysiwyg.has_tinymce() )
261
+ {
262
+ return;
263
+ }
264
+
265
+
266
+ // Destory all WYSIWYG fields
267
+ // This hack will fix a problem when the WP popup is created and hidden, then the ACF popup (image/file field) is opened
268
+ $(el).find('.acf_wysiwyg').each(function(){
269
+
270
+ _wysiwyg.set({ $el : $(this) }).destroy();
271
+
272
+ });
273
+
274
+
275
+ // Add WYSIWYG fields
276
+ setTimeout(function(){
277
+
278
+ $(el).find('.acf_wysiwyg').each(function(){
279
+
280
+ _wysiwyg.set({ $el : $(this) }).init();
281
+
282
+ });
283
+
284
+ }, 0);
285
+
286
+ });
287
+
288
+
289
+ /*
290
+ * acf/remove_fields
291
+ *
292
+ * This action is called when the $el is being removed from the DOM
293
+ *
294
+ * @type event
295
+ * @date 20/07/13
296
+ *
297
+ * @param {object} e event object
298
+ * @param {object} $el jQuery element being removed
299
+ * @return N/A
300
+ */
301
+
302
+ $(document).on('acf/remove_fields', function(e, $el){
303
+
304
+ // validate
305
+ if( ! _wysiwyg.has_tinymce() )
306
+ {
307
+ return;
308
+ }
309
+
310
+
311
+ $el.find('.acf_wysiwyg').each(function(){
312
+
313
+ _wysiwyg.set({ $el : $(this) }).destroy();
314
+
315
+ });
316
+
317
+ });
318
+
319
+
320
+ /*
321
+ * acf/wysiwyg/click
322
+ *
323
+ * this event is run when a user clicks on a WYSIWYG field
324
+ *
325
+ * @type event
326
+ * @date 17/01/13
327
+ *
328
+ * @param {object} e event object
329
+ * @param {int} id WYSIWYG ID
330
+ * @return N/A
331
+ */
332
+
333
+ $(document).on('acf/wysiwyg/click', function(e, id){
334
+
335
+ wpActiveEditor = id;
336
+
337
+ container = $('#wp-' + id + '-wrap').closest('.field').removeClass('error');
338
+
339
+ });
340
+
341
+
342
+ /*
343
+ * acf/wysiwyg/focus
344
+ *
345
+ * this event is run when a user focuses on a WYSIWYG field body
346
+ *
347
+ * @type event
348
+ * @date 17/01/13
349
+ *
350
+ * @param {object} e event object
351
+ * @param {int} id WYSIWYG ID
352
+ * @return N/A
353
+ */
354
+
355
+ $(document).on('acf/wysiwyg/focus', function(e, id){
356
+
357
+ wpActiveEditor = id;
358
+
359
+ container = $('#wp-' + id + '-wrap').closest('.field').removeClass('error');
360
+
361
+ });
362
+
363
+
364
+ /*
365
+ * acf/wysiwyg/blur
366
+ *
367
+ * this event is run when a user loses focus on a WYSIWYG field body
368
+ *
369
+ * @type event
370
+ * @date 17/01/13
371
+ *
372
+ * @param {object} e event object
373
+ * @param {int} id WYSIWYG ID
374
+ * @return N/A
375
+ */
376
+
377
+ $(document).on('acf/wysiwyg/blur', function(e, id){
378
+
379
+ wpActiveEditor = null;
380
+
381
+ // update the hidden textarea
382
+ // - This fixes a but when adding a taxonomy term as the form is not posted and the hidden tetarea is never populated!
383
+ var editor = tinyMCE.get( id );
384
+
385
+
386
+ // validate
387
+ if( !editor )
388
+ {
389
+ return;
390
+ }
391
+
392
+
393
+ var el = editor.getElement();
394
+
395
+
396
+ // save to textarea
397
+ editor.save();
398
+
399
+
400
+ // trigger change on textarea
401
+ $( el ).trigger('change');
402
+
403
+ });
404
+
405
+
406
+ /*
407
+ * acf/sortable_start
408
+ *
409
+ * this event is run when a element is being drag / dropped
410
+ *
411
+ * @type event
412
+ * @date 10/11/12
413
+ *
414
+ * @param {object} e event object
415
+ * @param {object} el DOM object which may contain new ACF elements
416
+ * @return N/A
417
+ */
418
+
419
+ $(document).on('acf/sortable_start', function(e, el) {
420
+
421
+ // validate
422
+ if( ! _wysiwyg.has_tinymce() )
423
+ {
424
+ return;
425
+ }
426
+
427
+
428
+ $(el).find('.acf_wysiwyg').each(function(){
429
+
430
+ _wysiwyg.set({ $el : $(this) }).destroy();
431
+
432
+ });
433
+
434
+ });
435
+
436
+
437
+ /*
438
+ * acf/sortable_stop
439
+ *
440
+ * this event is run when a element has finnished being drag / dropped
441
+ *
442
+ * @type event
443
+ * @date 10/11/12
444
+ *
445
+ * @param {object} e event object
446
+ * @param {object} el DOM object which may contain new ACF elements
447
+ * @return N/A
448
+ */
449
+
450
+ $(document).on('acf/sortable_stop', function(e, el) {
451
+
452
+ // validate
453
+ if( ! _wysiwyg.has_tinymce() )
454
+ {
455
+ return;
456
+ }
457
+
458
+
459
+ $(el).find('.acf_wysiwyg').each(function(){
460
+
461
+ _wysiwyg.set({ $el : $(this) }).init();
462
+
463
+ });
464
+
465
+ });
466
+
467
+
468
+ /*
469
+ * window load
470
+ *
471
+ * @description:
472
+ * @since: 3.5.5
473
+ * @created: 22/12/12
474
+ */
475
+
476
+ $(window).on('load', function(){
477
+
478
+ // validate
479
+ if( ! _wysiwyg.has_tinymce() )
480
+ {
481
+ return;
482
+ }
483
+
484
+
485
+ // vars
486
+ var wp_content = $('#wp-content-wrap').exists(),
487
+ wp_acf_settings = $('#wp-acf_settings-wrap').exists()
488
+ mode = 'tmce';
489
+
490
+
491
+ // has_editor
492
+ if( wp_acf_settings )
493
+ {
494
+ // html_mode
495
+ if( $('#wp-acf_settings-wrap').hasClass('html-active') )
496
+ {
497
+ mode = 'html';
498
+ }
499
+ }
500
+
501
+
502
+ setTimeout(function(){
503
+
504
+ // trigger click on hidden wysiwyg (to get in HTML mode)
505
+ if( wp_acf_settings && mode == 'html' )
506
+ {
507
+ $('#acf_settings-tmce').trigger('click');
508
+ }
509
+
510
+ }, 1);
511
+
512
+
513
+ setTimeout(function(){
514
+
515
+ // trigger html mode for people who want to stay in HTML mode
516
+ if( wp_acf_settings && mode == 'html' )
517
+ {
518
+ $('#acf_settings-html').trigger('click');
519
+ }
520
+
521
+ // Add events to content editor
522
+ if( wp_content )
523
+ {
524
+ _wysiwyg.add_events('content');
525
+ }
526
+
527
+
528
+ }, 11);
529
+
530
+
531
+ });
532
+
533
+
534
+ /*
535
+ * Full screen
536
+ *
537
+ * @description: this hack will hide the 'image upload' button in the wysiwyg full screen mode if the field has disabled image uploads!
538
+ * @since: 3.6
539
+ * @created: 26/02/13
540
+ */
541
+
542
+ $(document).on('click', '.acf_wysiwyg a.mce_fullscreen', function(){
543
+
544
+ // vars
545
+ var wysiwyg = $(this).closest('.acf_wysiwyg'),
546
+ upload = wysiwyg.attr('data-upload');
547
+
548
+ if( upload == 'no' )
549
+ {
550
+ $('#mce_fullscreen_container td.mceToolbar .mce_add_media').remove();
551
+ }
552
+
553
+ });
554
+
555
+
556
+ })(jQuery);
lang/acf-pt_PT.mo CHANGED
Binary file
lang/acf-pt_PT.po CHANGED
@@ -4,8 +4,8 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Advanced Custom Fields\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/advanced-custom-fields\n"
7
- "POT-Creation-Date: 2016-04-06 12:26+0100\n"
8
- "PO-Revision-Date: 2016-04-06 16:28+0100\n"
9
  "Last-Translator: Pedro Mendonça <ped.gaspar@gmail.com>\n"
10
  "Language-Team: Pedro Mendonça <ped.gaspar@gmail.com>\n"
11
  "Language: pt_PT\n"
@@ -13,7 +13,7 @@ msgstr ""
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
- "X-Generator: Poedit 1.8.7\n"
17
  "X-Poedit-SourceCharset: UTF-8\n"
18
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
19
  "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
@@ -23,102 +23,102 @@ msgstr ""
23
  "X-Poedit-Basepath: ..\n"
24
  "X-Poedit-SearchPath-0: .\n"
25
 
26
- #: acf.php:490
27
  msgid "Field&nbsp;Groups"
28
  msgstr "Grupos&nbsp;de&nbsp;campos"
29
 
30
  #. Plugin Name of the plugin/theme
31
- #: acf.php:491 core/controllers/field_groups.php:213
32
  msgid "Advanced Custom Fields"
33
  msgstr "Advanced Custom Fields"
34
 
35
- #: acf.php:492
36
  msgid "Add New"
37
  msgstr "Adicionar novo"
38
 
39
- #: acf.php:493
40
  msgid "Add New Field Group"
41
  msgstr "Adicionar novo grupo de campos"
42
 
43
- #: acf.php:494
44
  msgid "Edit Field Group"
45
  msgstr "Editar grupo de campos"
46
 
47
- #: acf.php:495
48
  msgid "New Field Group"
49
  msgstr "Novo grupo de campos"
50
 
51
- #: acf.php:496
52
  msgid "View Field Group"
53
  msgstr "Ver grupo de campos"
54
 
55
- #: acf.php:497
56
  msgid "Search Field Groups"
57
  msgstr "Pesquisar grupos de campos"
58
 
59
- #: acf.php:498
60
  msgid "No Field Groups found"
61
  msgstr "Nenhum grupo de campos encontrado"
62
 
63
- #: acf.php:499
64
  msgid "No Field Groups found in Trash"
65
  msgstr "Nenhum grupo de campos encontrado no Lixo"
66
 
67
- #: acf.php:584 core/views/meta_box_options.php:99
68
  msgid "Custom Fields"
69
  msgstr "Campos personalizados"
70
 
71
- #: acf.php:602 acf.php:605
72
  msgid "Field group updated."
73
  msgstr "Grupo de campos actualizado."
74
 
75
- #: acf.php:603
76
  msgid "Custom field updated."
77
  msgstr "Campo personalizado actualizado."
78
 
79
- #: acf.php:604
80
  msgid "Custom field deleted."
81
  msgstr "Campo personalizado eliminado."
82
 
83
  #. translators: %s: date and time of the revision
84
- #: acf.php:607
85
  #, php-format
86
  msgid "Field group restored to revision from %s"
87
  msgstr "Grupo de campos restaurado para revisão de %s"
88
 
89
- #: acf.php:608
90
  msgid "Field group published."
91
  msgstr "Grupo de campos publicado."
92
 
93
- #: acf.php:609
94
  msgid "Field group saved."
95
  msgstr "Grupo de campos guardado."
96
 
97
- #: acf.php:610
98
  msgid "Field group submitted."
99
  msgstr "Grupo de campos enviado."
100
 
101
- #: acf.php:611
102
  msgid "Field group scheduled for."
103
  msgstr "Grupo de campos agendado."
104
 
105
- #: acf.php:612
106
  msgid "Field group draft updated."
107
  msgstr "Rascunho de grupo de campos actualizado."
108
 
109
- #: acf.php:747
110
  msgid "Thumbnail"
111
  msgstr "Miniatura"
112
 
113
- #: acf.php:748
114
  msgid "Medium"
115
  msgstr "Média"
116
 
117
- #: acf.php:749
118
  msgid "Large"
119
  msgstr "Grande"
120
 
121
- #: acf.php:750
122
  msgid "Full"
123
  msgstr "Completo"
124
 
@@ -148,7 +148,7 @@ msgstr "Campo repetidor"
148
 
149
  #: core/controllers/addons.php:131
150
  msgid "Create infinite rows of repeatable data with this versatile interface!"
151
- msgstr "Cria infinitas linhas de dados repetíveis com um interfácil versátil!"
152
 
153
  #: core/controllers/addons.php:137 core/controllers/field_groups.php:436
154
  msgid "Gallery Field"
@@ -156,7 +156,7 @@ msgstr "Campo de galeria"
156
 
157
  #: core/controllers/addons.php:138
158
  msgid "Create image galleries in a simple and intuitive interface!"
159
- msgstr "Cria galerias de imagens num interface simples e intuitivo!"
160
 
161
  #: core/controllers/addons.php:144 core/controllers/field_groups.php:444
162
  msgid "Options Page"
@@ -184,11 +184,11 @@ msgstr "Cria um campo de seleção preenchido com Gravity Forms!"
184
 
185
  #: core/controllers/addons.php:168
186
  msgid "Date & Time Picker"
187
- msgstr "Selector de data e hora"
188
 
189
  #: core/controllers/addons.php:169
190
  msgid "jQuery date & time picker"
191
- msgstr "Selector jQuery de data e hora"
192
 
193
  #: core/controllers/addons.php:175
194
  msgid "Google Map Extended"
@@ -204,7 +204,7 @@ msgstr "Campo de Contact Form 7"
204
 
205
  #: core/controllers/addons.php:183
206
  msgid "Assign one or more contact form 7 forms to a post"
207
- msgstr "Atribui um ou mais formulários Contact Form 7 a um artigo"
208
 
209
  #: core/controllers/addons.php:193
210
  msgid "Advanced Custom Fields Add-Ons"
@@ -384,7 +384,7 @@ msgid ""
384
  "to enable lite mode. Add the following code to your functions.php file "
385
  "<b>before</b> the include_once code:"
386
  msgstr ""
387
- "Para remover todos os interfaces visuais do plugin ACF, pode utilizar uma "
388
  "constante para activar o <i>modo Lite</i>. Adicione o seguinte código ao seu "
389
  "ficheiro functions.php <b>antes</b> do código include_once:"
390
 
@@ -528,7 +528,7 @@ msgstr "Super Administrador"
528
  #: core/controllers/field_group.php:791 core/fields/file.php:186
529
  #: core/fields/image.php:177 core/fields/page_link.php:109
530
  #: core/fields/post_object.php:286 core/fields/post_object.php:310
531
- #: core/fields/relationship.php:588 core/fields/relationship.php:612
532
  #: core/fields/user.php:276
533
  msgid "All"
534
  msgstr "Todos"
@@ -566,7 +566,7 @@ msgstr "Funções"
566
  msgid "Actions"
567
  msgstr "Acções"
568
 
569
- #: core/controllers/field_groups.php:224 core/fields/relationship.php:631
570
  msgid "Filters"
571
  msgstr "Filtros"
572
 
@@ -832,7 +832,7 @@ msgstr "Instalação"
832
 
833
  #: core/controllers/field_groups.php:464
834
  msgid "For each Add-on available, please perform the following:"
835
- msgstr "Para cada add-on disponível, por favor aça o seguinte:"
836
 
837
  #: core/controllers/field_groups.php:466
838
  msgid "Download the Add-on plugin (.zip file) to your desktop"
@@ -863,15 +863,15 @@ msgstr "O add-on está agora instalado e activado!"
863
 
864
  #: core/controllers/field_groups.php:484
865
  msgid "Awesome. Let's get to work"
866
- msgstr "Incrível. Vamos começar a trabalhar"
867
 
868
  #: core/controllers/input.php:63
869
  msgid "Expand Details"
870
- msgstr "Mostrar detalhes"
871
 
872
  #: core/controllers/input.php:64
873
  msgid "Collapse Details"
874
- msgstr "Ocultar detalhes"
875
 
876
  #: core/controllers/input.php:67
877
  msgid "Validation Failed. One or more fields below are required."
@@ -905,12 +905,12 @@ msgstr "Caixa de selecção"
905
  #: core/fields/checkbox.php:20 core/fields/radio.php:19
906
  #: core/fields/select.php:19 core/fields/true_false.php:20
907
  msgid "Choice"
908
- msgstr "Escolha"
909
 
910
  #: core/fields/checkbox.php:146 core/fields/radio.php:147
911
  #: core/fields/select.php:177
912
  msgid "Choices"
913
- msgstr "Escolhas"
914
 
915
  #: core/fields/checkbox.php:147 core/fields/select.php:178
916
  msgid "Enter each choice on a new line."
@@ -958,7 +958,7 @@ msgstr "Horizontal"
958
 
959
  #: core/fields/color_picker.php:19
960
  msgid "Color Picker"
961
- msgstr "Selector de cor"
962
 
963
  #: core/fields/color_picker.php:20 core/fields/date_picker/date_picker.php:20
964
  #: core/fields/google-map.php:19
@@ -967,7 +967,7 @@ msgstr "jQuery"
967
 
968
  #: core/fields/date_picker/date_picker.php:19
969
  msgid "Date Picker"
970
- msgstr "Selector de data"
971
 
972
  #: core/fields/date_picker/date_picker.php:55
973
  msgid "Done"
@@ -1004,7 +1004,7 @@ msgstr "Formatos de data jQuery"
1004
 
1005
  #: core/fields/date_picker/date_picker.php:142
1006
  msgid "Display format"
1007
- msgstr "Formato de apresentação"
1008
 
1009
  #: core/fields/date_picker/date_picker.php:143
1010
  msgid "This format will be seen by the user when entering a value"
@@ -1015,7 +1015,7 @@ msgid ""
1015
  "\"dd/mm/yy\" or \"mm/dd/yy\" are the most used display formats. Read more "
1016
  "about"
1017
  msgstr ""
1018
- "\"dd/mm/yy\" ou \"mm/dd/yy\" são os formatos de apresentação mais "
1019
  "utilizados. Leia mais sobre"
1020
 
1021
  #: core/fields/date_picker/date_picker.php:158
@@ -1034,7 +1034,7 @@ msgstr "Email"
1034
  #: core/fields/text.php:117 core/fields/textarea.php:104
1035
  #: core/fields/wysiwyg.php:287
1036
  msgid "Appears when creating a new post"
1037
- msgstr "Aparece quando é criado um novo artigo"
1038
 
1039
  #: core/fields/email.php:123 core/fields/number.php:133
1040
  #: core/fields/password.php:105 core/fields/text.php:131
@@ -1107,7 +1107,7 @@ msgstr "Adicionar ficheiro"
1107
  #: core/fields/file.php:153 core/fields/image.php:125
1108
  #: core/fields/taxonomy.php:523
1109
  msgid "Return Value"
1110
- msgstr "Valor a mostrar"
1111
 
1112
  #: core/fields/file.php:164
1113
  msgid "File Object"
@@ -1139,7 +1139,7 @@ msgstr "A obter localização"
1139
 
1140
  #: core/fields/google-map.php:34
1141
  msgid "Sorry, this browser does not support geolocation"
1142
- msgstr "Desculpe, este browser não suporta geolocalização"
1143
 
1144
  #: core/fields/google-map.php:120
1145
  msgid "Clear location"
@@ -1209,9 +1209,9 @@ msgstr "Nenhuma imagem seleccionada"
1209
  msgid "Add Image"
1210
  msgstr "Adicionar imagem"
1211
 
1212
- #: core/fields/image.php:126 core/fields/relationship.php:563
1213
  msgid "Specify the returned value on front end"
1214
- msgstr "Especifica o valor a mostrar na frente do site"
1215
 
1216
  #: core/fields/image.php:136
1217
  msgid "Image Object"
@@ -1235,7 +1235,7 @@ msgstr "Mostrado ao introduzir dados"
1235
 
1236
  #: core/fields/image.php:166
1237
  msgid "Limit the media library choice"
1238
- msgstr "Limitar a escolha da biblioteca de media"
1239
 
1240
  #: core/fields/message.php:19 core/fields/message.php:70
1241
  #: core/fields/true_false.php:79
@@ -1244,11 +1244,11 @@ msgstr "Mensagem"
1244
 
1245
  #: core/fields/message.php:71
1246
  msgid "Text &amp; HTML entered here will appear inline with the fields"
1247
- msgstr "O texto e HTML introduzidos aqui irão aparecer na linha dos campos"
1248
 
1249
  #: core/fields/message.php:72
1250
  msgid "Please note that all text will first be passed through the wp function "
1251
- msgstr "Note que todo o texto será previamente analisado pela função wp "
1252
 
1253
  #: core/fields/number.php:19
1254
  msgid "Number"
@@ -1268,7 +1268,7 @@ msgstr "Valor dos passos"
1268
 
1269
  #: core/fields/page_link.php:18
1270
  msgid "Page Link"
1271
- msgstr "Ligação da página"
1272
 
1273
  #: core/fields/page_link.php:19 core/fields/post_object.php:19
1274
  #: core/fields/relationship.php:19 core/fields/taxonomy.php:19
@@ -1277,7 +1277,7 @@ msgid "Relational"
1277
  msgstr "Relacional"
1278
 
1279
  #: core/fields/page_link.php:103 core/fields/post_object.php:280
1280
- #: core/fields/relationship.php:582 core/fields/relationship.php:661
1281
  #: core/views/meta_box_location.php:75
1282
  msgid "Post Type"
1283
  msgstr "Tipo de conteúdo"
@@ -1299,13 +1299,13 @@ msgstr "Senha"
1299
 
1300
  #: core/fields/post_object.php:18
1301
  msgid "Post Object"
1302
- msgstr "Artigo"
1303
 
1304
- #: core/fields/post_object.php:194 core/fields/relationship.php:170
1305
  msgid "(no title)"
1306
  msgstr "(sem título)"
1307
 
1308
- #: core/fields/post_object.php:304 core/fields/relationship.php:606
1309
  msgid "Filter from Taxonomy"
1310
  msgstr "Filtrar por taxonomia"
1311
 
@@ -1336,7 +1336,7 @@ msgstr ""
1336
 
1337
  #: core/fields/radio.php:187
1338
  msgid "Save 'other' values to the field's choices"
1339
- msgstr "Guardar 'outros' valores nas escolhas do campo"
1340
 
1341
  #: core/fields/relationship.php:18
1342
  msgid "Relationship"
@@ -1346,58 +1346,58 @@ msgstr "Relação"
1346
  msgid "Maximum values reached ( {max} values )"
1347
  msgstr "Valor máximo alcançado ( {max} item(s) )"
1348
 
1349
- #: core/fields/relationship.php:457
1350
  msgid "Search..."
1351
  msgstr "Pesquisar..."
1352
 
1353
- #: core/fields/relationship.php:468
1354
  msgid "Filter by post type"
1355
  msgstr "Filtrar por tipo de conteúdo"
1356
 
1357
- #: core/fields/relationship.php:562
1358
  msgid "Return Format"
1359
- msgstr "Formato a mostrar"
1360
 
1361
- #: core/fields/relationship.php:573
1362
  msgid "Post Objects"
1363
- msgstr "Artigos"
1364
 
1365
- #: core/fields/relationship.php:574
1366
  msgid "Post IDs"
1367
- msgstr "IDs dos artigos"
1368
 
1369
- #: core/fields/relationship.php:640
1370
  msgid "Search"
1371
  msgstr "Pesquisar"
1372
 
1373
- #: core/fields/relationship.php:641
1374
  msgid "Post Type Select"
1375
  msgstr "Selecção de tipo de conteúdo"
1376
 
1377
- #: core/fields/relationship.php:649
1378
  msgid "Elements"
1379
  msgstr "Elementos"
1380
 
1381
- #: core/fields/relationship.php:650
1382
  msgid "Selected elements will be displayed in each result"
1383
  msgstr "Os elementos seleccionados serão mostrados em cada resultado"
1384
 
1385
- #: core/fields/relationship.php:659 core/views/meta_box_options.php:106
1386
  msgid "Featured Image"
1387
  msgstr "Imagem de destaque"
1388
 
1389
- #: core/fields/relationship.php:660
1390
  msgid "Post Title"
1391
  msgstr "Título do artigo"
1392
 
1393
- #: core/fields/relationship.php:672
1394
  msgid "Maximum posts"
1395
- msgstr "Máximo de artigos"
1396
 
1397
  #: core/fields/select.php:18 core/fields/select.php:109
1398
  #: core/fields/taxonomy.php:480 core/fields/user.php:313
1399
  msgid "Select"
1400
- msgstr "Selector"
1401
 
1402
  #: core/fields/tab.php:19
1403
  msgid "Tab"
@@ -1461,7 +1461,7 @@ msgid ""
1461
  "Load value based on the post's terms and update the post's terms on save"
1462
  msgstr ""
1463
  "Carrega o valor com base nos termos do artigo e actualiza os termos do "
1464
- "artigo ao guardar"
1465
 
1466
  #: core/fields/taxonomy.php:533
1467
  msgid "Term Object"
@@ -1529,7 +1529,7 @@ msgstr "Utilizador"
1529
 
1530
  #: core/fields/user.php:271
1531
  msgid "Filter by role"
1532
- msgstr "Filtrar por perfil"
1533
 
1534
  #: core/fields/wysiwyg.php:19
1535
  msgid "Wysiwyg Editor"
@@ -1597,12 +1597,12 @@ msgstr "Eliminar"
1597
 
1598
  #: core/views/meta_box_fields.php:127
1599
  msgid "This is the name which will appear on the EDIT page"
1600
- msgstr "Este é o nome que irá aparecer na página de EDITAR"
1601
 
1602
  #: core/views/meta_box_fields.php:143
1603
  msgid "Single word, no spaces. Underscores and dashes allowed"
1604
  msgstr ""
1605
- "Uma única palavra, sem espaços. São permitidos underscores (_) e traços (-)"
1606
 
1607
  #: core/views/meta_box_fields.php:172
1608
  msgid "Field Instructions"
4
  msgstr ""
5
  "Project-Id-Version: Advanced Custom Fields\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/advanced-custom-fields\n"
7
+ "POT-Creation-Date: 2016-04-14 10:07+0100\n"
8
+ "PO-Revision-Date: 2016-08-05 16:16+0100\n"
9
  "Last-Translator: Pedro Mendonça <ped.gaspar@gmail.com>\n"
10
  "Language-Team: Pedro Mendonça <ped.gaspar@gmail.com>\n"
11
  "Language: pt_PT\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+ "X-Generator: Poedit 1.8.8\n"
17
  "X-Poedit-SourceCharset: UTF-8\n"
18
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
19
  "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
23
  "X-Poedit-Basepath: ..\n"
24
  "X-Poedit-SearchPath-0: .\n"
25
 
26
+ #: acf.php:509
27
  msgid "Field&nbsp;Groups"
28
  msgstr "Grupos&nbsp;de&nbsp;campos"
29
 
30
  #. Plugin Name of the plugin/theme
31
+ #: acf.php:510 core/controllers/field_groups.php:213
32
  msgid "Advanced Custom Fields"
33
  msgstr "Advanced Custom Fields"
34
 
35
+ #: acf.php:511
36
  msgid "Add New"
37
  msgstr "Adicionar novo"
38
 
39
+ #: acf.php:512
40
  msgid "Add New Field Group"
41
  msgstr "Adicionar novo grupo de campos"
42
 
43
+ #: acf.php:513
44
  msgid "Edit Field Group"
45
  msgstr "Editar grupo de campos"
46
 
47
+ #: acf.php:514
48
  msgid "New Field Group"
49
  msgstr "Novo grupo de campos"
50
 
51
+ #: acf.php:515
52
  msgid "View Field Group"
53
  msgstr "Ver grupo de campos"
54
 
55
+ #: acf.php:516
56
  msgid "Search Field Groups"
57
  msgstr "Pesquisar grupos de campos"
58
 
59
+ #: acf.php:517
60
  msgid "No Field Groups found"
61
  msgstr "Nenhum grupo de campos encontrado"
62
 
63
+ #: acf.php:518
64
  msgid "No Field Groups found in Trash"
65
  msgstr "Nenhum grupo de campos encontrado no Lixo"
66
 
67
+ #: acf.php:603 core/views/meta_box_options.php:99
68
  msgid "Custom Fields"
69
  msgstr "Campos personalizados"
70
 
71
+ #: acf.php:621 acf.php:624
72
  msgid "Field group updated."
73
  msgstr "Grupo de campos actualizado."
74
 
75
+ #: acf.php:622
76
  msgid "Custom field updated."
77
  msgstr "Campo personalizado actualizado."
78
 
79
+ #: acf.php:623
80
  msgid "Custom field deleted."
81
  msgstr "Campo personalizado eliminado."
82
 
83
  #. translators: %s: date and time of the revision
84
+ #: acf.php:626
85
  #, php-format
86
  msgid "Field group restored to revision from %s"
87
  msgstr "Grupo de campos restaurado para revisão de %s"
88
 
89
+ #: acf.php:627
90
  msgid "Field group published."
91
  msgstr "Grupo de campos publicado."
92
 
93
+ #: acf.php:628
94
  msgid "Field group saved."
95
  msgstr "Grupo de campos guardado."
96
 
97
+ #: acf.php:629
98
  msgid "Field group submitted."
99
  msgstr "Grupo de campos enviado."
100
 
101
+ #: acf.php:630
102
  msgid "Field group scheduled for."
103
  msgstr "Grupo de campos agendado."
104
 
105
+ #: acf.php:631
106
  msgid "Field group draft updated."
107
  msgstr "Rascunho de grupo de campos actualizado."
108
 
109
+ #: acf.php:766
110
  msgid "Thumbnail"
111
  msgstr "Miniatura"
112
 
113
+ #: acf.php:767
114
  msgid "Medium"
115
  msgstr "Média"
116
 
117
+ #: acf.php:768
118
  msgid "Large"
119
  msgstr "Grande"
120
 
121
+ #: acf.php:769
122
  msgid "Full"
123
  msgstr "Completo"
124
 
148
 
149
  #: core/controllers/addons.php:131
150
  msgid "Create infinite rows of repeatable data with this versatile interface!"
151
+ msgstr "Cria infinitas linhas de dados repetíveis com uma interface versátil!"
152
 
153
  #: core/controllers/addons.php:137 core/controllers/field_groups.php:436
154
  msgid "Gallery Field"
156
 
157
  #: core/controllers/addons.php:138
158
  msgid "Create image galleries in a simple and intuitive interface!"
159
+ msgstr "Cria galerias de imagens numa interface simples e intuitiva!"
160
 
161
  #: core/controllers/addons.php:144 core/controllers/field_groups.php:444
162
  msgid "Options Page"
184
 
185
  #: core/controllers/addons.php:168
186
  msgid "Date & Time Picker"
187
+ msgstr "Selecção de data e hora"
188
 
189
  #: core/controllers/addons.php:169
190
  msgid "jQuery date & time picker"
191
+ msgstr "Selecção jQuery de data e hora"
192
 
193
  #: core/controllers/addons.php:175
194
  msgid "Google Map Extended"
204
 
205
  #: core/controllers/addons.php:183
206
  msgid "Assign one or more contact form 7 forms to a post"
207
+ msgstr "Atribui um ou mais formulários Contact Form 7 a um conteúdo"
208
 
209
  #: core/controllers/addons.php:193
210
  msgid "Advanced Custom Fields Add-Ons"
384
  "to enable lite mode. Add the following code to your functions.php file "
385
  "<b>before</b> the include_once code:"
386
  msgstr ""
387
+ "Para remover todas as interfaces visuais do plugin ACF, pode utilizar uma "
388
  "constante para activar o <i>modo Lite</i>. Adicione o seguinte código ao seu "
389
  "ficheiro functions.php <b>antes</b> do código include_once:"
390
 
528
  #: core/controllers/field_group.php:791 core/fields/file.php:186
529
  #: core/fields/image.php:177 core/fields/page_link.php:109
530
  #: core/fields/post_object.php:286 core/fields/post_object.php:310
531
+ #: core/fields/relationship.php:582 core/fields/relationship.php:606
532
  #: core/fields/user.php:276
533
  msgid "All"
534
  msgstr "Todos"
566
  msgid "Actions"
567
  msgstr "Acções"
568
 
569
+ #: core/controllers/field_groups.php:224 core/fields/relationship.php:625
570
  msgid "Filters"
571
  msgstr "Filtros"
572
 
832
 
833
  #: core/controllers/field_groups.php:464
834
  msgid "For each Add-on available, please perform the following:"
835
+ msgstr "Para cada add-on disponível, por favor faça o seguinte:"
836
 
837
  #: core/controllers/field_groups.php:466
838
  msgid "Download the Add-on plugin (.zip file) to your desktop"
863
 
864
  #: core/controllers/field_groups.php:484
865
  msgid "Awesome. Let's get to work"
866
+ msgstr "Impressionante. Vamos começar a trabalhar."
867
 
868
  #: core/controllers/input.php:63
869
  msgid "Expand Details"
870
+ msgstr "Expandir detalhes"
871
 
872
  #: core/controllers/input.php:64
873
  msgid "Collapse Details"
874
+ msgstr "Minimizar detalhes"
875
 
876
  #: core/controllers/input.php:67
877
  msgid "Validation Failed. One or more fields below are required."
905
  #: core/fields/checkbox.php:20 core/fields/radio.php:19
906
  #: core/fields/select.php:19 core/fields/true_false.php:20
907
  msgid "Choice"
908
+ msgstr "Opção"
909
 
910
  #: core/fields/checkbox.php:146 core/fields/radio.php:147
911
  #: core/fields/select.php:177
912
  msgid "Choices"
913
+ msgstr "Opções"
914
 
915
  #: core/fields/checkbox.php:147 core/fields/select.php:178
916
  msgid "Enter each choice on a new line."
958
 
959
  #: core/fields/color_picker.php:19
960
  msgid "Color Picker"
961
+ msgstr "Selecção de cor"
962
 
963
  #: core/fields/color_picker.php:20 core/fields/date_picker/date_picker.php:20
964
  #: core/fields/google-map.php:19
967
 
968
  #: core/fields/date_picker/date_picker.php:19
969
  msgid "Date Picker"
970
+ msgstr "Selecção de data"
971
 
972
  #: core/fields/date_picker/date_picker.php:55
973
  msgid "Done"
1004
 
1005
  #: core/fields/date_picker/date_picker.php:142
1006
  msgid "Display format"
1007
+ msgstr "Formato de visualização"
1008
 
1009
  #: core/fields/date_picker/date_picker.php:143
1010
  msgid "This format will be seen by the user when entering a value"
1015
  "\"dd/mm/yy\" or \"mm/dd/yy\" are the most used display formats. Read more "
1016
  "about"
1017
  msgstr ""
1018
+ "\"dd/mm/yy\" ou \"mm/dd/yy\" são os formatos de visualização mais "
1019
  "utilizados. Leia mais sobre"
1020
 
1021
  #: core/fields/date_picker/date_picker.php:158
1034
  #: core/fields/text.php:117 core/fields/textarea.php:104
1035
  #: core/fields/wysiwyg.php:287
1036
  msgid "Appears when creating a new post"
1037
+ msgstr "Aparece quando é criado um novo conteúdo."
1038
 
1039
  #: core/fields/email.php:123 core/fields/number.php:133
1040
  #: core/fields/password.php:105 core/fields/text.php:131
1107
  #: core/fields/file.php:153 core/fields/image.php:125
1108
  #: core/fields/taxonomy.php:523
1109
  msgid "Return Value"
1110
+ msgstr "Valor devolvido"
1111
 
1112
  #: core/fields/file.php:164
1113
  msgid "File Object"
1139
 
1140
  #: core/fields/google-map.php:34
1141
  msgid "Sorry, this browser does not support geolocation"
1142
+ msgstr "Desculpe, este navegador não suporta geolocalização."
1143
 
1144
  #: core/fields/google-map.php:120
1145
  msgid "Clear location"
1209
  msgid "Add Image"
1210
  msgstr "Adicionar imagem"
1211
 
1212
+ #: core/fields/image.php:126 core/fields/relationship.php:557
1213
  msgid "Specify the returned value on front end"
1214
+ msgstr "Especifica o valor devolvido na frente do site."
1215
 
1216
  #: core/fields/image.php:136
1217
  msgid "Image Object"
1235
 
1236
  #: core/fields/image.php:166
1237
  msgid "Limit the media library choice"
1238
+ msgstr "Limita a escolha da biblioteca de media."
1239
 
1240
  #: core/fields/message.php:19 core/fields/message.php:70
1241
  #: core/fields/true_false.php:79
1244
 
1245
  #: core/fields/message.php:71
1246
  msgid "Text &amp; HTML entered here will appear inline with the fields"
1247
+ msgstr "O texto e HTML introduzidos aqui irão aparecer na linha dos campos."
1248
 
1249
  #: core/fields/message.php:72
1250
  msgid "Please note that all text will first be passed through the wp function "
1251
+ msgstr "Note que todo o texto será previamente analisado pela função do WP "
1252
 
1253
  #: core/fields/number.php:19
1254
  msgid "Number"
1268
 
1269
  #: core/fields/page_link.php:18
1270
  msgid "Page Link"
1271
+ msgstr "Ligação de página"
1272
 
1273
  #: core/fields/page_link.php:19 core/fields/post_object.php:19
1274
  #: core/fields/relationship.php:19 core/fields/taxonomy.php:19
1277
  msgstr "Relacional"
1278
 
1279
  #: core/fields/page_link.php:103 core/fields/post_object.php:280
1280
+ #: core/fields/relationship.php:576 core/fields/relationship.php:655
1281
  #: core/views/meta_box_location.php:75
1282
  msgid "Post Type"
1283
  msgstr "Tipo de conteúdo"
1299
 
1300
  #: core/fields/post_object.php:18
1301
  msgid "Post Object"
1302
+ msgstr "Conteúdo"
1303
 
1304
+ #: core/fields/post_object.php:194 core/fields/relationship.php:164
1305
  msgid "(no title)"
1306
  msgstr "(sem título)"
1307
 
1308
+ #: core/fields/post_object.php:304 core/fields/relationship.php:600
1309
  msgid "Filter from Taxonomy"
1310
  msgstr "Filtrar por taxonomia"
1311
 
1336
 
1337
  #: core/fields/radio.php:187
1338
  msgid "Save 'other' values to the field's choices"
1339
+ msgstr "Guardar 'outros' valores nas opções do campo"
1340
 
1341
  #: core/fields/relationship.php:18
1342
  msgid "Relationship"
1346
  msgid "Maximum values reached ( {max} values )"
1347
  msgstr "Valor máximo alcançado ( {max} item(s) )"
1348
 
1349
+ #: core/fields/relationship.php:451
1350
  msgid "Search..."
1351
  msgstr "Pesquisar..."
1352
 
1353
+ #: core/fields/relationship.php:462
1354
  msgid "Filter by post type"
1355
  msgstr "Filtrar por tipo de conteúdo"
1356
 
1357
+ #: core/fields/relationship.php:556
1358
  msgid "Return Format"
1359
+ msgstr "Formato devolvido"
1360
 
1361
+ #: core/fields/relationship.php:567
1362
  msgid "Post Objects"
1363
+ msgstr "Conteúdos"
1364
 
1365
+ #: core/fields/relationship.php:568
1366
  msgid "Post IDs"
1367
+ msgstr "IDs dos conteúdos"
1368
 
1369
+ #: core/fields/relationship.php:634
1370
  msgid "Search"
1371
  msgstr "Pesquisar"
1372
 
1373
+ #: core/fields/relationship.php:635
1374
  msgid "Post Type Select"
1375
  msgstr "Selecção de tipo de conteúdo"
1376
 
1377
+ #: core/fields/relationship.php:643
1378
  msgid "Elements"
1379
  msgstr "Elementos"
1380
 
1381
+ #: core/fields/relationship.php:644
1382
  msgid "Selected elements will be displayed in each result"
1383
  msgstr "Os elementos seleccionados serão mostrados em cada resultado"
1384
 
1385
+ #: core/fields/relationship.php:653 core/views/meta_box_options.php:106
1386
  msgid "Featured Image"
1387
  msgstr "Imagem de destaque"
1388
 
1389
+ #: core/fields/relationship.php:654
1390
  msgid "Post Title"
1391
  msgstr "Título do artigo"
1392
 
1393
+ #: core/fields/relationship.php:666
1394
  msgid "Maximum posts"
1395
+ msgstr "Máximo de conteúdos"
1396
 
1397
  #: core/fields/select.php:18 core/fields/select.php:109
1398
  #: core/fields/taxonomy.php:480 core/fields/user.php:313
1399
  msgid "Select"
1400
+ msgstr "Selecção"
1401
 
1402
  #: core/fields/tab.php:19
1403
  msgid "Tab"
1461
  "Load value based on the post's terms and update the post's terms on save"
1462
  msgstr ""
1463
  "Carrega o valor com base nos termos do artigo e actualiza os termos do "
1464
+ "artigo ao guardar."
1465
 
1466
  #: core/fields/taxonomy.php:533
1467
  msgid "Term Object"
1529
 
1530
  #: core/fields/user.php:271
1531
  msgid "Filter by role"
1532
+ msgstr "Filtrar por papel"
1533
 
1534
  #: core/fields/wysiwyg.php:19
1535
  msgid "Wysiwyg Editor"
1597
 
1598
  #: core/views/meta_box_fields.php:127
1599
  msgid "This is the name which will appear on the EDIT page"
1600
+ msgstr "Este é o nome que irá aparecer na página EDITAR."
1601
 
1602
  #: core/views/meta_box_fields.php:143
1603
  msgid "Single word, no spaces. Underscores and dashes allowed"
1604
  msgstr ""
1605
+ "Uma única palavra, sem espaços. São permitidos underscores (_) e traços (-)."
1606
 
1607
  #: core/views/meta_box_fields.php:172
1608
  msgid "Field Instructions"
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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: 4.7.0
6
- Stable tag: 4.4.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -116,6 +116,11 @@ http://support.advancedcustomfields.com/
116
 
117
  == Changelog ==
118
 
 
 
 
 
 
119
  = 4.4.8 =
120
  * Google Map: Added new 'acf/fields/google_map/api' filter
121
 
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: 4.7.0
6
+ Stable tag: 4.4.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
116
 
117
  == Changelog ==
118
 
119
+ = 4.4.9 =
120
+ * WYSIWYG field: Fixed JS error preventing tinymce from initializing
121
+ * Image field: Added nicer 'Edit image' view
122
+ * File field: Added nicer 'Edit file' view
123
+
124
  = 4.4.8 =
125
  * Google Map: Added new 'acf/fields/google_map/api' filter
126