Advanced Custom Fields - Version 4.0.2

Version Description

  • [Added] Add auto video filter to WYSIWYG value - http://support.advancedcustomfields.com/discussion/5378/video-embed-in-wysiwyg-field
  • [Fixed] Fix Repeater + WYSIWYG loosing p tags on drag/drop - http://support.advancedcustomfields.com/discussion/5476/acf-4-0-0-wysiwyg-p-tag-disappearing-after-drag-drop-save
  • [Fixed] Fix upgrade message appearing in iframe
  • [Fixed] Fix value sanitation - http://support.advancedcustomfields.com/discussion/5499/post-relationship-field-value-storage-in-update-to-acf4
  • [Added] Add JS field name validation - http://support.advancedcustomfields.com/discussion/5500/replace-foreign-letters-when-creating-input-name-from-label-in-javascript
  • [Fixed] Fix error when duplicating field group in WPML - http://support.advancedcustomfields.com/discussion/5501/4-0-1-broke-wpml-functionality-
  • [Fixed] Fix pares_type issue. Maybe remove it? - http://support.advancedcustomfields.com/discussion/5502/zeros-get-removed-major-bug
Download this release

Release Info

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

Code changes from version 4.0.1 to 4.0.2

acf.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Advanced Custom Fields
4
  Plugin URI: http://www.advancedcustomfields.com/
5
  Description: Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerfull API, it’s a must have for any web developer working with WordPress. Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker, repeater, flexible content, gallery and more!
6
- Version: 4.0.1
7
  Author: Elliot Condon
8
  Author URI: http://www.elliotcondon.com/
9
  License: GPL
@@ -66,7 +66,7 @@ class Acf
66
  $this->settings = array(
67
  'path' => apply_filters('acf/helpers/get_path', __FILE__),
68
  'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
69
- 'version' => '4.0.1',
70
  'upgrade_version' => '3.4.1',
71
  );
72
 
@@ -209,6 +209,12 @@ class Acf
209
  {
210
  foreach( $value as $k => $v )
211
  {
 
 
 
 
 
 
212
  $value[ $k ] = apply_filters( 'acf/parse_types', $v );
213
  }
214
  }
@@ -639,7 +645,8 @@ class Acf
639
  foreach( $_POST['fields'] as $key => $value )
640
  {
641
  // parse types
642
- $value = apply_filters('acf/parse_types', $value);
 
643
 
644
  // get field
645
  $field = apply_filters('acf/load_field', false, $key );
3
  Plugin Name: Advanced Custom Fields
4
  Plugin URI: http://www.advancedcustomfields.com/
5
  Description: Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerfull API, it’s a must have for any web developer working with WordPress. Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker, repeater, flexible content, gallery and more!
6
+ Version: 4.0.2
7
  Author: Elliot Condon
8
  Author URI: http://www.elliotcondon.com/
9
  License: GPL
66
  $this->settings = array(
67
  'path' => apply_filters('acf/helpers/get_path', __FILE__),
68
  'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
69
+ 'version' => '4.0.2',
70
  'upgrade_version' => '3.4.1',
71
  );
72
 
209
  {
210
  foreach( $value as $k => $v )
211
  {
212
+ // if $field was passed, never modify the value! NEVER!
213
+ if( $k == 'value' )
214
+ {
215
+ continue;
216
+ }
217
+
218
  $value[ $k ] = apply_filters( 'acf/parse_types', $v );
219
  }
220
  }
645
  foreach( $_POST['fields'] as $key => $value )
646
  {
647
  // parse types
648
+ // - caused issues with saving numbers (0 were removed)
649
+ //$value = apply_filters('acf/parse_types', $value);
650
 
651
  // get field
652
  $field = apply_filters('acf/load_field', false, $key );
core/controllers/field_group.php CHANGED
@@ -832,8 +832,7 @@ class acf_field_group
832
  // vars
833
  $dont_delete = array();
834
 
835
-
836
- if( $_POST['fields'] )
837
  {
838
  $i = -1;
839
 
@@ -881,35 +880,37 @@ class acf_field_group
881
  * save location rules
882
  */
883
 
884
- $location = $_POST['location'];
885
- update_post_meta($post_id, 'allorany', $location['allorany']);
886
-
887
- delete_post_meta($post_id, 'rule');
888
- if($location['rules'])
889
  {
890
- foreach($location['rules'] as $k => $rule)
 
 
 
891
  {
892
- $rule['order_no'] = $k;
893
- add_post_meta($post_id, 'rule', $rule);
 
 
 
894
  }
 
895
  }
896
- unset( $_POST['location'] );
 
 
897
 
898
 
899
  /*
900
  * save options
901
  */
902
 
903
- $options = array(
904
- 'position' => 'normal',
905
- 'layout' => 'default',
906
- 'hide_on_screen' => array()
907
- );
908
- $options = array_merge($options, $_POST['options']);
909
-
910
- update_post_meta($post_id, 'position', $options['position']);
911
- update_post_meta($post_id, 'layout', $options['layout']);
912
- update_post_meta($post_id, 'hide_on_screen', $options['hide_on_screen']);
913
 
914
  unset( $_POST['options'] );
915
 
832
  // vars
833
  $dont_delete = array();
834
 
835
+ if( isset($_POST['fields']) && is_array($_POST['fields']) )
 
836
  {
837
  $i = -1;
838
 
880
  * save location rules
881
  */
882
 
883
+ if( isset($_POST['location']) && is_array($_POST['location']) )
 
 
 
 
884
  {
885
+ update_post_meta($post_id, 'allorany', $_POST['location']['allorany']);
886
+
887
+ delete_post_meta($post_id, 'rule');
888
+ if( $_POST['location']['rules'] )
889
  {
890
+ foreach($_POST['location']['rules'] as $k => $rule)
891
+ {
892
+ $rule['order_no'] = $k;
893
+ add_post_meta($post_id, 'rule', $rule);
894
+ }
895
  }
896
+ unset( $_POST['location'] );
897
  }
898
+
899
+
900
+
901
 
902
 
903
  /*
904
  * save options
905
  */
906
 
907
+ if( isset($_POST['options']) && is_array($_POST['options']) )
908
+ {
909
+ update_post_meta($post_id, 'position', $_POST['options']['position']);
910
+ update_post_meta($post_id, 'layout', $_POST['options']['layout']);
911
+ update_post_meta($post_id, 'hide_on_screen', $_POST['options']['hide_on_screen']);
912
+ }
913
+
 
 
 
914
 
915
  unset( $_POST['options'] );
916
 
core/controllers/field_groups.php CHANGED
@@ -214,7 +214,7 @@ class acf_field_groups
214
  <h3 class="h2"><?php _e("Advanced Custom Fields",'acf'); ?> <?php echo $version; ?></h3>
215
 
216
  <h3><?php _e("Changelog",'acf'); ?></h3>
217
- <p><?php _e("See what's new in",'acf'); ?> <a href="<?php echo admin_url('edit.php?post_type=acf&info=changelog'); ?>">version <?php echo $version; ?></a>
218
 
219
  <h3><?php _e("Resources",'acf'); ?></h3>
220
  <ul>
@@ -223,7 +223,7 @@ class acf_field_groups
223
  <li><a href="http://www.advancedcustomfields.com/resources/#functions" target="_blank"><?php _e("Functions",'acf'); ?></a></li>
224
  <li><a href="http://www.advancedcustomfields.com/resources/#actions" target="_blank"><?php _e("Actions",'acf'); ?></a></li>
225
  <li><a href="http://www.advancedcustomfields.com/resources/#filters" target="_blank"><?php _e("Filters",'acf'); ?></a></li>
226
- <li><a href="http://www.advancedcustomfields.com/resources/#how-to" target="_blank"><?php _e("\"How to\" guides",'acf'); ?></a></li>
227
  <li><a href="http://www.advancedcustomfields.com/resources/#tutorials" target="_blank"><?php _e("Tutorials",'acf'); ?></a></li>
228
  </ul>
229
  </div>
@@ -261,11 +261,37 @@ class acf_field_groups
261
  </h2>
262
 
263
  <?php if( $tab == 'whats-new' ):
264
-
265
- $ac_repeater = get_option('acf_repeater_ac', '');
266
- $ac_options_page = get_option('acf_options_page_ac', '');
267
- $ac_flexible_content = get_option('acf_flexible_content_ac', '');
268
- $ac_gallery = get_option('acf_gallery_ac', '');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
 
270
  ?>
271
 
@@ -288,10 +314,16 @@ class acf_field_groups
288
  <p><?php _e("Add-ons are now activated by downloading and installing individual plugins. Although these plugins will not be hosted on the wordpress.org repository, each Add-on will continue to receive updates in the usual way.",'acf'); ?></p>
289
 
290
 
291
- <?php if( $ac_repeater || $ac_options_page || $ac_flexible_content || $ac_gallery ): ?>
292
- <div class="acf-alert acf-alert-success">
293
- <p>This website uses premium Add-ons which need to be downloaded <a href="<?php echo admin_url('edit.php?post_type=acf&info=download-add-ons'); ?>" class="acf-button" style="display: inline-block;">Download your activated Add-ons</a></p>
294
- </div>
 
 
 
 
 
 
295
  <?php else: ?>
296
  <div class="acf-alert acf-alert-success">
297
  <p><?php _e("This website does not use premium Add-ons and will not be affected by this change.",'acf'); ?></p>
@@ -369,13 +401,13 @@ class acf_field_groups
369
 
370
  <h3><?php _e("Overview",'acf'); ?></h3>
371
 
372
- <p>Previously, all Add-ons were unlocked via an activation code (purchased from the ACF Add-ons store). New to v4, all Add-ons act as separate plugins which need to be individually downloaded, installed and updated.</p>
373
 
374
- <p>This page will assist you in downloading and installing each available Add-on.</p>
375
 
376
  <h3><?php _e("Available Add-ons",'acf'); ?></h3>
377
 
378
- <p>The following Add-ons have been detected as activated on this website.</p>
379
 
380
  <?php
381
 
@@ -388,42 +420,42 @@ class acf_field_groups
388
  <table class="widefat" id="acf-download-add-ons-table">
389
  <thead>
390
  <tr>
391
- <th colspan="2">Name</th>
392
- <th>Activation Code</th>
393
- <th>Download</th>
394
  </tr>
395
  </thead>
396
  <tbody>
397
  <?php if( $ac_repeater ): ?>
398
  <tr>
399
  <td class="td-image"><img src="<?php echo $dir; ?>images/add-ons/repeater-field-thumb.jpg" style="width:50px" /></td>
400
- <th class="td-name">Repeater Field</th>
401
  <td class="td-code">XXXX-XXXX-XXXX-<?php echo substr($ac_repeater,-4); ?></td>
402
- <td class="td-download"><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_repeater; ?>/trunk">Download</a></td>
403
  </tr>
404
  <?php endif; ?>
405
  <?php if( $ac_gallery ): ?>
406
  <tr>
407
  <td><img src="<?php echo $dir; ?>images/add-ons/gallery-field-thumb.jpg" /></td>
408
- <th>Gallery Field</th>
409
  <td>XXXX-XXXX-XXXX-<?php echo substr($ac_gallery,-4); ?></td>
410
- <td><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_gallery; ?>/trunk">Download</a></td>
411
  </tr>
412
  <?php endif; ?>
413
  <?php if( $ac_options_page ): ?>
414
  <tr>
415
  <td><img src="<?php echo $dir; ?>images/add-ons/options-page-thumb.jpg" /></td>
416
- <th>Options Page</th>
417
  <td>XXXX-XXXX-XXXX-<?php echo substr($ac_options_page,-4); ?></td>
418
- <td><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_options_page; ?>/trunk">Download</a></td>
419
  </tr>
420
  <?php endif; ?>
421
  <?php if($ac_flexible_content): ?>
422
  <tr>
423
  <td><img src="<?php echo $dir; ?>images/add-ons/flexible-content-field-thumb.jpg" /></td>
424
- <th>Flexible Content</th>
425
  <td>XXXX-XXXX-XXXX-<?php echo substr($ac_flexible_content,-4); ?></td>
426
- <td><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_flexible_content; ?>/trunk">Download</a></td>
427
  </tr>
428
  <?php endif; ?>
429
  </tbody>
@@ -433,13 +465,13 @@ class acf_field_groups
433
 
434
  <h3><?php _e("Installation",'acf'); ?></h3>
435
 
436
- <p>For each Add-on available, please perform the following:</p>
437
  <ol>
438
- <li>Download the Add-on plugin (.zip file) to your desktop</li>
439
- <li>Navigate to <a target="_blank" href="<?php echo admin_url('plugin-install.php?tab=upload'); ?>">Plugins > Add New > Upload</a></li>
440
- <li>Use the uploader to browse, select and install your Add-on (.zip file)</li>
441
- <li>Once the plugin has been uploaded and installed, click the "Activate Plugin" link</li>
442
- <li>The Add-on is now installed and activated!</li>
443
  </ol>
444
 
445
 
214
  <h3 class="h2"><?php _e("Advanced Custom Fields",'acf'); ?> <?php echo $version; ?></h3>
215
 
216
  <h3><?php _e("Changelog",'acf'); ?></h3>
217
+ <p><?php _e("See what's new in",'acf'); ?> <a href="<?php echo admin_url('edit.php?post_type=acf&info=changelog'); ?>"><?php _e("version",'acf'); ?> <?php echo $version; ?></a>
218
 
219
  <h3><?php _e("Resources",'acf'); ?></h3>
220
  <ul>
223
  <li><a href="http://www.advancedcustomfields.com/resources/#functions" target="_blank"><?php _e("Functions",'acf'); ?></a></li>
224
  <li><a href="http://www.advancedcustomfields.com/resources/#actions" target="_blank"><?php _e("Actions",'acf'); ?></a></li>
225
  <li><a href="http://www.advancedcustomfields.com/resources/#filters" target="_blank"><?php _e("Filters",'acf'); ?></a></li>
226
+ <li><a href="http://www.advancedcustomfields.com/resources/#how-to" target="_blank"><?php _e("'How to' guides",'acf'); ?></a></li>
227
  <li><a href="http://www.advancedcustomfields.com/resources/#tutorials" target="_blank"><?php _e("Tutorials",'acf'); ?></a></li>
228
  </ul>
229
  </div>
261
  </h2>
262
 
263
  <?php if( $tab == 'whats-new' ):
264
+
265
+ $activation_codes = array(
266
+ 'repeater' => get_option('acf_repeater_ac', ''),
267
+ 'gallery' => get_option('acf_gallery_ac', ''),
268
+ 'options_page' => get_option('acf_options_page_ac', ''),
269
+ 'flexible_content' => get_option('acf_flexible_content_ac', '')
270
+ );
271
+
272
+ $active = array(
273
+ 'repeater' => class_exists('acf_field_repeater'),
274
+ 'gallery' => class_exists('acf_field_gallery'),
275
+ 'options_page' => class_exists('acf_options_page_plugin'),
276
+ 'flexible_content' => class_exists('acf_field_flexible_content')
277
+ );
278
+
279
+ $update_required = false;
280
+ $update_complete = true;
281
+
282
+ foreach( $activation_codes as $k => $v )
283
+ {
284
+ if( $v )
285
+ {
286
+ $update_required = true;
287
+
288
+ if( !$active[ $k ] )
289
+ {
290
+ $update_complete = false;
291
+ }
292
+ }
293
+ }
294
+
295
 
296
  ?>
297
 
314
  <p><?php _e("Add-ons are now activated by downloading and installing individual plugins. Although these plugins will not be hosted on the wordpress.org repository, each Add-on will continue to receive updates in the usual way.",'acf'); ?></p>
315
 
316
 
317
+ <?php if( $update_required ): ?>
318
+ <?php if( $update_complete ): ?>
319
+ <div class="acf-alert acf-alert-success">
320
+ <p><?php _e("All previous Add-ons have been successfully installed",'acf'); ?></p>
321
+ </div>
322
+ <?php else: ?>
323
+ <div class="acf-alert acf-alert-success">
324
+ <p><?php _e("This website uses premium Add-ons which need to be downloaded",'acf'); ?> <a href="<?php echo admin_url('edit.php?post_type=acf&info=download-add-ons'); ?>" class="acf-button" style="display: inline-block;"><?php _e("Download your activated Add-ons",'acf'); ?></a></p>
325
+ </div>
326
+ <?php endif; ?>
327
  <?php else: ?>
328
  <div class="acf-alert acf-alert-success">
329
  <p><?php _e("This website does not use premium Add-ons and will not be affected by this change.",'acf'); ?></p>
401
 
402
  <h3><?php _e("Overview",'acf'); ?></h3>
403
 
404
+ <p><?php _e("Previously, all Add-ons were unlocked via an activation code (purchased from the ACF Add-ons store). New to v4, all Add-ons act as separate plugins which need to be individually downloaded, installed and updated.",'acf'); ?></p>
405
 
406
+ <p><?php _e("This page will assist you in downloading and installing each available Add-on.",'acf'); ?></p>
407
 
408
  <h3><?php _e("Available Add-ons",'acf'); ?></h3>
409
 
410
+ <p><?php _e("The following Add-ons have been detected as activated on this website.",'acf'); ?></p>
411
 
412
  <?php
413
 
420
  <table class="widefat" id="acf-download-add-ons-table">
421
  <thead>
422
  <tr>
423
+ <th colspan="2"><?php _e("Name",'acf'); ?></th>
424
+ <th><?php _e("Activation Code",'acf'); ?></th>
425
+ <th><?php _e("Download",'acf'); ?></th>
426
  </tr>
427
  </thead>
428
  <tbody>
429
  <?php if( $ac_repeater ): ?>
430
  <tr>
431
  <td class="td-image"><img src="<?php echo $dir; ?>images/add-ons/repeater-field-thumb.jpg" style="width:50px" /></td>
432
+ <th class="td-name"><?php _e("Repeater Field",'acf'); ?></th>
433
  <td class="td-code">XXXX-XXXX-XXXX-<?php echo substr($ac_repeater,-4); ?></td>
434
+ <td class="td-download"><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_repeater; ?>/trunk"><?php _e("Download",'acf'); ?></a></td>
435
  </tr>
436
  <?php endif; ?>
437
  <?php if( $ac_gallery ): ?>
438
  <tr>
439
  <td><img src="<?php echo $dir; ?>images/add-ons/gallery-field-thumb.jpg" /></td>
440
+ <th><?php _e("Gallery Field",'acf'); ?></th>
441
  <td>XXXX-XXXX-XXXX-<?php echo substr($ac_gallery,-4); ?></td>
442
+ <td><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_gallery; ?>/trunk"><?php _e("Download",'acf'); ?></a></td>
443
  </tr>
444
  <?php endif; ?>
445
  <?php if( $ac_options_page ): ?>
446
  <tr>
447
  <td><img src="<?php echo $dir; ?>images/add-ons/options-page-thumb.jpg" /></td>
448
+ <th><?php _e("Options Page",'acf'); ?></th>
449
  <td>XXXX-XXXX-XXXX-<?php echo substr($ac_options_page,-4); ?></td>
450
+ <td><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_options_page; ?>/trunk"><?php _e("Download",'acf'); ?></a></td>
451
  </tr>
452
  <?php endif; ?>
453
  <?php if($ac_flexible_content): ?>
454
  <tr>
455
  <td><img src="<?php echo $dir; ?>images/add-ons/flexible-content-field-thumb.jpg" /></td>
456
+ <th><?php _e("Flexible Content",'acf'); ?></th>
457
  <td>XXXX-XXXX-XXXX-<?php echo substr($ac_flexible_content,-4); ?></td>
458
+ <td><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_flexible_content; ?>/trunk"><?php _e("Download",'acf'); ?></a></td>
459
  </tr>
460
  <?php endif; ?>
461
  </tbody>
465
 
466
  <h3><?php _e("Installation",'acf'); ?></h3>
467
 
468
+ <p><?php _e("For each Add-on available, please perform the following:",'acf'); ?></p>
469
  <ol>
470
+ <li><?php _e("Download the Add-on plugin (.zip file) to your desktop",'acf'); ?></li>
471
+ <li><?php _e("Navigate to",'acf'); ?> <a target="_blank" href="<?php echo admin_url('plugin-install.php?tab=upload'); ?>"><?php _e("Plugins > Add New > Upload",'acf'); ?></a></li>
472
+ <li><?php _e("Use the uploader to browse, select and install your Add-on (.zip file)",'acf'); ?></li>
473
+ <li><?php _e("Once the plugin has been uploaded and installed, click the 'Activate Plugin' link",'acf'); ?></li>
474
+ <li><?php _e("The Add-on is now installed and activated!",'acf'); ?></li>
475
  </ol>
476
 
477
 
core/controllers/upgrade.php CHANGED
@@ -39,10 +39,18 @@ class acf_upgrade
39
 
40
  function admin_menu()
41
  {
 
 
 
 
 
 
 
42
  // vars
43
  $new_version = apply_filters('acf/get_info', 'version');
44
  $old_version = get_option('acf_version', false);
45
 
 
46
  if( $new_version != $old_version )
47
  {
48
  update_option('acf_version', $new_version );
39
 
40
  function admin_menu()
41
  {
42
+ // dont run on plugin activate!
43
+ if( isset($_GET['action']) && $_GET['action'] == 'activate-plugin' )
44
+ {
45
+ return;
46
+ }
47
+
48
+
49
  // vars
50
  $new_version = apply_filters('acf/get_info', 'version');
51
  $old_version = get_option('acf_version', false);
52
 
53
+
54
  if( $new_version != $old_version )
55
  {
56
  update_option('acf_version', $new_version );
core/fields/_functions.php CHANGED
@@ -437,7 +437,8 @@ class acf_field_functions
437
  {
438
  // sanitize field name
439
  // - http://support.advancedcustomfields.com/discussion/5262/sanitize_title-on-field-name
440
- $field['name'] = sanitize_title( $field['name'] );
 
441
 
442
 
443
  // filters
437
  {
438
  // sanitize field name
439
  // - http://support.advancedcustomfields.com/discussion/5262/sanitize_title-on-field-name
440
+ // - issue with camel case! Replaced with JS
441
+ //$field['name'] = sanitize_title( $field['name'] );
442
 
443
 
444
  // filters
core/fields/taxonomy.php CHANGED
@@ -108,6 +108,9 @@ class acf_field_taxonomy extends acf_field
108
 
109
  if( $field['load_save_terms'] )
110
  {
 
 
 
111
  wp_set_object_terms( $post_id, $value, $field['taxonomy'], false );
112
  }
113
 
108
 
109
  if( $field['load_save_terms'] )
110
  {
111
+ // Parse values
112
+ $value = apply_filters( 'acf/parse_types', $value );
113
+
114
  wp_set_object_terms( $post_id, $value, $field['taxonomy'], false );
115
  }
116
 
core/fields/user.php CHANGED
@@ -52,7 +52,7 @@ class acf_field_user extends acf_field
52
  * @return $value - the modified value
53
  */
54
 
55
- function format_value_for_api( $value, $field )
56
  {
57
 
58
  // format value
52
  * @return $value - the modified value
53
  */
54
 
55
+ function format_value_for_api( $value, $post_id, $field )
56
  {
57
 
58
  // format value
core/fields/wysiwyg.php CHANGED
@@ -261,10 +261,23 @@ class acf_field_wysiwyg extends acf_field
261
 
262
  function format_value_for_api( $value, $post_id, $field )
263
  {
264
- // filters
 
 
 
 
 
 
 
 
 
265
  $value = wpautop( $value );
 
 
 
266
  $value = do_shortcode( $value );
267
-
 
268
  return $value;
269
  }
270
 
261
 
262
  function format_value_for_api( $value, $post_id, $field )
263
  {
264
+ // wp_embed convert urls to videos
265
+ if( isset($GLOBALS['wp_embed']) )
266
+ {
267
+ $embed = $GLOBALS['wp_embed'];
268
+ $value = $embed->run_shortcode( $value );
269
+ $value = $embed->autoembed( $value );
270
+ }
271
+
272
+
273
+ // auto p
274
  $value = wpautop( $value );
275
+
276
+
277
+ // run all normal shortcodes
278
  $value = do_shortcode( $value );
279
+
280
+
281
  return $value;
282
  }
283
 
js/field-group.js CHANGED
@@ -518,15 +518,44 @@ var acf = {
518
 
519
  $('#acf_fields tr.field_label input.label').live('blur', function()
520
  {
521
- var label = $(this);
522
- var name = $(this).closest('tr').siblings('tr.field_name').find('input.name');
523
 
524
- if(name.val() == '')
525
  {
526
- var val = label.val().toLowerCase().split(' ').join('_').split('\'').join('');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
  name.val(val);
528
  name.trigger('keyup');
529
  }
 
530
  });
531
 
532
 
518
 
519
  $('#acf_fields tr.field_label input.label').live('blur', function()
520
  {
521
+ var label = $(this),
522
+ name = label.closest('tr').siblings('tr.field_name').find('input.name');
523
 
524
+ if( name.val() == '' )
525
  {
526
+ // thanks to https://gist.github.com/richardsweeney/5317392 for this code!
527
+ var val = label.val(),
528
+ replace = {
529
+ 'ä': 'a',
530
+ 'æ': 'a',
531
+ 'å': 'a',
532
+ 'ö': 'o',
533
+ 'ø': 'o',
534
+ 'é': 'e',
535
+ 'ë': 'e',
536
+ 'ü': 'u',
537
+ 'ó': 'o',
538
+ 'ő': 'o',
539
+ 'ú': 'u',
540
+ 'é': 'e',
541
+ 'á': 'a',
542
+ 'ű': 'u',
543
+ 'í': 'i',
544
+ ' ' : '_',
545
+ '\'' : ''
546
+ };
547
+
548
+ $.each( replace, function(k, v){
549
+ var regex = new RegExp( k, 'g' );
550
+ val = val.replace( regex, v );
551
+ });
552
+
553
+
554
+ val = val.toLowerCase();
555
  name.val(val);
556
  name.trigger('keyup');
557
  }
558
+
559
  });
560
 
561
 
js/input/relationship.js CHANGED
@@ -167,7 +167,16 @@
167
  * @created: 17/01/13
168
  */
169
 
170
- $('.acf_relationship input.relationship_search').live('keyup', function()
 
 
 
 
 
 
 
 
 
171
  {
172
  // vars
173
  var val = $(this).val(),
@@ -202,6 +211,30 @@
202
  });
203
 
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  // hide results
206
  _relationship.hide_results = function( div ){
207
 
167
  * @created: 17/01/13
168
  */
169
 
170
+ $('.acf_relationship input.relationship_search').live('keypress', function( e ){
171
+
172
+ // don't submit form
173
+ if( e.which == 13 )
174
+ {
175
+ return false;
176
+ }
177
+
178
+ })
179
+ .live('keyup', function()
180
  {
181
  // vars
182
  var val = $(this).val(),
211
  });
212
 
213
 
214
+ /*
215
+ * Filter by post_type
216
+ *
217
+ * @description:
218
+ * @since: 3.5.7
219
+ * @created: 9/04/13
220
+ */
221
+
222
+ $('.acf_relationship .select-post_type').live('change', function(){
223
+
224
+ // vars
225
+ var val = $(this).val(),
226
+ div = $(this).closest('.acf_relationship');
227
+
228
+
229
+ // update data-s
230
+ div.attr('data-post_type', val);
231
+
232
+ // ajax
233
+ _relationship.update_results( div );
234
+
235
+ });
236
+
237
+
238
  // hide results
239
  _relationship.hide_results = function( div ){
240
 
js/input/tab.js CHANGED
@@ -46,7 +46,7 @@
46
 
47
 
48
  // add tab
49
- inside.children('.acf-tab-group').append('<li data-field_key="' + id + '"><a class="acf-tab-button" href="#" data-id="' + id + '">' + label + '</a></li>');
50
 
51
 
52
  });
46
 
47
 
48
  // add tab
49
+ inside.children('.acf-tab-group').append('<li class="field_key-' + id + '" data-field_key="' + id + '"><a class="acf-tab-button" href="#" data-id="' + id + '">' + label + '</a></li>');
50
 
51
 
52
  });
js/input/wysiwyg.js CHANGED
@@ -170,8 +170,11 @@
170
  // if wysiwyg was found (should be always...), remove its functionality and set the value (to keep line breaks)
171
  if( editor )
172
  {
173
- editor.save();
 
174
  tinyMCE.execCommand("mceRemoveControl", false, id);
 
 
175
  }
176
 
177
  });
170
  // if wysiwyg was found (should be always...), remove its functionality and set the value (to keep line breaks)
171
  if( editor )
172
  {
173
+ var val = editor.getContent();
174
+
175
  tinyMCE.execCommand("mceRemoveControl", false, id);
176
+
177
+ textarea.val( val );
178
  }
179
 
180
  });
readme.txt CHANGED
@@ -27,25 +27,20 @@ Advanced Custom Fields is the perfect solution for any wordpress website which n
27
  * Number (type number, api returns integer)
28
  * Email (type email, api returns text)
29
  * Password (type password, api returns text)
30
-
31
  * WYSIWYG (a wordpress wysiwyg editor, api returns html)
32
  * Image (upload an image, api returns the url)
33
  * File (upload a file, api returns the url)
34
-
35
  * Select (drop down list of choices, api returns chosen item)
36
  * Checkbox (tickbox list of choices, api returns array of choices)
37
  * Radio Buttons ( radio button list of choices, api returns chosen item)
38
  * True / False (tick box with message, api returns true or false)
39
-
40
  * Page Link (select 1 or more page, post or custom post types, api returns the selected url)
41
  * Post Object (select 1 or more page, post or custom post types, api returns the selected post objects)
42
  * Relationship (search, select and order post objects with a tidy interface, api returns the selected post objects)
43
  * Taxonomy (select taxonomy terms with options to load, display and save, api returns the selected term objects)
44
  * User (select 1 or more WP users, api returns the selected user objects)
45
-
46
  * Date Picker (jquery date picker, options for format, api returns string)
47
  * Color Picker (Farbtastic!)
48
-
49
  * Repeater (ability to create repeatable blocks of fields!)
50
  * Flexible Content (ability to create flexible blocks of fields!)
51
  * Gallery (Add, edit and order multiple images in 1 simple field)
@@ -106,6 +101,15 @@ http://support.advancedcustomfields.com/
106
 
107
  == Changelog ==
108
 
 
 
 
 
 
 
 
 
 
109
  = 4.0.1 =
110
  * [Improved] Improving welcome message with download instructions
111
  * [Fixed] Text / Fix JS issue where metaboxes are not hiding - http://support.advancedcustomfields.com/discussion/5443/bug-content-editor
27
  * Number (type number, api returns integer)
28
  * Email (type email, api returns text)
29
  * Password (type password, api returns text)
 
30
  * WYSIWYG (a wordpress wysiwyg editor, api returns html)
31
  * Image (upload an image, api returns the url)
32
  * File (upload a file, api returns the url)
 
33
  * Select (drop down list of choices, api returns chosen item)
34
  * Checkbox (tickbox list of choices, api returns array of choices)
35
  * Radio Buttons ( radio button list of choices, api returns chosen item)
36
  * True / False (tick box with message, api returns true or false)
 
37
  * Page Link (select 1 or more page, post or custom post types, api returns the selected url)
38
  * Post Object (select 1 or more page, post or custom post types, api returns the selected post objects)
39
  * Relationship (search, select and order post objects with a tidy interface, api returns the selected post objects)
40
  * Taxonomy (select taxonomy terms with options to load, display and save, api returns the selected term objects)
41
  * User (select 1 or more WP users, api returns the selected user objects)
 
42
  * Date Picker (jquery date picker, options for format, api returns string)
43
  * Color Picker (Farbtastic!)
 
44
  * Repeater (ability to create repeatable blocks of fields!)
45
  * Flexible Content (ability to create flexible blocks of fields!)
46
  * Gallery (Add, edit and order multiple images in 1 simple field)
101
 
102
  == Changelog ==
103
 
104
+ = 4.0.2 =
105
+ * [Added] Add auto video filter to WYSIWYG value - http://support.advancedcustomfields.com/discussion/5378/video-embed-in-wysiwyg-field
106
+ * [Fixed] Fix Repeater + WYSIWYG loosing p tags on drag/drop - http://support.advancedcustomfields.com/discussion/5476/acf-4-0-0-wysiwyg-p-tag-disappearing-after-drag-drop-save
107
+ * [Fixed] Fix upgrade message appearing in iframe
108
+ * [Fixed] Fix value sanitation - http://support.advancedcustomfields.com/discussion/5499/post-relationship-field-value-storage-in-update-to-acf4
109
+ * [Added] Add JS field name validation - http://support.advancedcustomfields.com/discussion/5500/replace-foreign-letters-when-creating-input-name-from-label-in-javascript
110
+ * [Fixed] Fix error when duplicating field group in WPML - http://support.advancedcustomfields.com/discussion/5501/4-0-1-broke-wpml-functionality-
111
+ * [Fixed] Fix pares_type issue. Maybe remove it? - http://support.advancedcustomfields.com/discussion/5502/zeros-get-removed-major-bug
112
+
113
  = 4.0.1 =
114
  * [Improved] Improving welcome message with download instructions
115
  * [Fixed] Text / Fix JS issue where metaboxes are not hiding - http://support.advancedcustomfields.com/discussion/5443/bug-content-editor