Skip to content
This repository
  • 3 commits
  • 72 files changed
  • 0 comments
  • 1 contributor

Showing 72 changed files with 2,436 additions and 1,015 deletions. Show diff stats Hide diff stats

  1. +146 28 assets/plugins/advanced-custom-fields/acf.php
  2. +7 8 assets/plugins/advanced-custom-fields/core/actions/export.php
  3. +12 8 assets/plugins/advanced-custom-fields/core/api.php
  4. +9 6 assets/plugins/advanced-custom-fields/core/controllers/everything_fields.php
  5. +19 16 assets/plugins/advanced-custom-fields/core/controllers/field_group.php
  6. +16 2 assets/plugins/advanced-custom-fields/core/controllers/input.php
  7. +14 3 assets/plugins/advanced-custom-fields/core/controllers/options_page.php
  8. +195 0 assets/plugins/advanced-custom-fields/core/controllers/third_party.php
  9. +5 0 assets/plugins/advanced-custom-fields/core/fields/acf_field.php
  10. +2 2 assets/plugins/advanced-custom-fields/core/fields/checkbox.php
  11. +1 1  assets/plugins/advanced-custom-fields/core/fields/color_picker.php
  12. +8 0 assets/plugins/advanced-custom-fields/core/fields/file.php
  13. +45 53 assets/plugins/advanced-custom-fields/core/fields/flexible_content.php
  14. +4 4 assets/plugins/advanced-custom-fields/core/fields/gallery.php
  15. +8 0 assets/plugins/advanced-custom-fields/core/fields/image.php
  16. +1 1  assets/plugins/advanced-custom-fields/core/fields/number.php
  17. +2 2 assets/plugins/advanced-custom-fields/core/fields/radio.php
  18. +1 1  assets/plugins/advanced-custom-fields/core/fields/relationship.php
  19. +25 34 assets/plugins/advanced-custom-fields/core/fields/repeater.php
  20. +24 20 assets/plugins/advanced-custom-fields/core/fields/select.php
  21. +4 2 assets/plugins/advanced-custom-fields/core/fields/text.php
  22. +6 3 assets/plugins/advanced-custom-fields/core/fields/textarea.php
  23. +1 1  assets/plugins/advanced-custom-fields/core/fields/true_false.php
  24. +111 21 assets/plugins/advanced-custom-fields/core/views/meta_box_fields.php
  25. +2 2 assets/plugins/advanced-custom-fields/core/views/meta_box_location.php
  26. +4 1 assets/plugins/advanced-custom-fields/core/views/meta_box_options.php
  27. +53 15 assets/plugins/advanced-custom-fields/css/fields.css
  28. +30 12 assets/plugins/advanced-custom-fields/css/global.css
  29. +21 9 assets/plugins/advanced-custom-fields/css/input.css
  30. +726 285 assets/plugins/advanced-custom-fields/js/fields.js
  31. +76 5 assets/plugins/advanced-custom-fields/js/input-actions.js
  32. +5 3 assets/plugins/advanced-custom-fields/js/input-ajax.js
  33. +180 147 assets/plugins/advanced-custom-fields/lang/acf.pot
  34. +18 0 assets/plugins/advanced-custom-fields/readme.txt
  35. +22 11 assets/plugins/contact-form-7/includes/classes.php
  36. +3 3 assets/plugins/contact-form-7/includes/controller.php
  37. +5 0 assets/plugins/contact-form-7/includes/functions.php
  38. +27 13 assets/plugins/contact-form-7/includes/js/jquery.form.js
  39. +3 3 assets/plugins/contact-form-7/includes/js/jquery.form.min.js
  40. BIN  assets/plugins/contact-form-7/languages/wpcf7-da_DK.mo
  41. BIN  assets/plugins/contact-form-7/languages/wpcf7-fi.mo
  42. BIN  assets/plugins/contact-form-7/languages/wpcf7-ja.mo
  43. +86 86 assets/plugins/contact-form-7/languages/wpcf7.pot
  44. +7 22 assets/plugins/contact-form-7/modules/akismet.php
  45. +1 2  assets/plugins/contact-form-7/modules/flamingo.php
  46. +7 0 assets/plugins/contact-form-7/modules/jetpack.php
  47. +7 3 assets/plugins/contact-form-7/modules/special-mail-tags.php
  48. +12 2 assets/plugins/contact-form-7/readme.txt
  49. +2 1  assets/plugins/contact-form-7/settings.php
  50. +2 2 assets/plugins/contact-form-7/wp-contact-form-7.php
  51. +17 8 assets/plugins/monster-widget/monster-widget.php
  52. +8 2 assets/plugins/monster-widget/readme.txt
  53. BIN  assets/plugins/query-multiple-taxonomies/lang/query-multiple-taxonomies-de_DE.mo
  54. +100 24 assets/plugins/query-multiple-taxonomies/lang/query-multiple-taxonomies-de_DE.po
  55. +49 33 assets/plugins/query-multiple-taxonomies/lang/query-multiple-taxonomies.pot
  56. +62 14 assets/plugins/query-multiple-taxonomies/mustache/Mustache.php
  57. +85 0 assets/plugins/query-multiple-taxonomies/mustache/MustacheLoader.php
  58. +48 42 assets/plugins/query-multiple-taxonomies/mustache/README.markdown
  59. +1 1  assets/plugins/query-multiple-taxonomies/query-multiple-taxonomies.php
  60. +10 4 assets/plugins/query-multiple-taxonomies/readme.txt
  61. +12 0 assets/plugins/query-multiple-taxonomies/scb/Util.php
  62. +1 1  assets/plugins/query-multiple-taxonomies/scb/load.php
  63. BIN  assets/plugins/query-multiple-taxonomies/screenshot-1.png
  64. BIN  assets/plugins/query-multiple-taxonomies/screenshot-2.png
  65. BIN  assets/plugins/query-multiple-taxonomies/screenshot-3.png
  66. BIN  assets/plugins/query-multiple-taxonomies/screenshot-4.png
  67. +39 16 assets/plugins/query-multiple-taxonomies/walkers.php
  68. +2 1  assets/plugins/query-multiple-taxonomies/widget.php
  69. +11 14 assets/plugins/user-switching/readme.txt
  70. +24 10 assets/plugins/user-switching/user-switching.php
  71. +1 1  assets/themes/international/library/intl-handle-styles.php
  72. +1 1  assets/themes/international/style.css
174 assets/plugins/advanced-custom-fields/acf.php
@@ -3,7 +3,7 @@
3 3 Plugin Name: Advanced Custom Fields
4 4 Plugin URI: http://www.advancedcustomfields.com/
5 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: 3.5.0
  6 +Version: 3.5.1
7 7 Author: Elliot Condon
8 8 Author URI: http://www.elliotcondon.com/
9 9 License: GPL
@@ -30,7 +30,8 @@ class Acf
30 30 $field_group,
31 31 $input,
32 32 $options_page,
33   - $everything_fields;
  33 + $everything_fields,
  34 + $third_party;
34 35
35 36
36 37 /*
@@ -47,7 +48,7 @@ function Acf()
47 48 // vars
48 49 $this->path = plugin_dir_path(__FILE__);
49 50 $this->dir = plugins_url('',__FILE__);
50   - $this->version = '3.5.0';
  51 + $this->version = '3.5.1';
51 52 $this->upgrade_version = '3.4.1'; // this is the latest version which requires an upgrade
52 53 $this->cache = array(); // basic array cache to hold data throughout the page load
53 54
@@ -69,6 +70,7 @@ function Acf()
69 70 add_action('admin_head', array($this,'admin_head'));
70 71 add_action('acf_save_post', array($this, 'acf_save_post'), 10); // save post, called from many places (api, input, everything, options)
71 72
  73 + add_filter('acf_load_field', array($this, 'acf_load_field_defaults'), 5);
72 74
73 75 // ajax
74 76 add_action('wp_ajax_get_input_metabox_ids', array($this, 'get_input_metabox_ids'));
@@ -269,6 +271,11 @@ function setup_controllers()
269 271 // everthing fields
270 272 include_once('core/controllers/everything_fields.php');
271 273 $this->everything_fields = new acf_everything_fields($this);
  274 +
  275 +
  276 + // Third Party Compatibility
  277 + include_once('core/controllers/third_party.php');
  278 + $this->third_party = new acf_third_party($this);
272 279 }
273 280
274 281
@@ -531,6 +538,8 @@ function get_acf_fields($post_id)
531 538
532 539 function get_acf_field( $field_key, $post_id = false )
533 540 {
  541 +
  542 +
534 543 // return cache
535 544 $cache = $this->get_cache('acf_field_' . $field_key);
536 545 if($cache != false)
@@ -554,6 +563,7 @@ function get_acf_field( $field_key, $post_id = false )
554 563 $row = $wpdb->get_results( $sql, ARRAY_A );
555 564
556 565
  566 +
557 567 if( $row )
558 568 {
559 569 $row = $row[0];
@@ -565,11 +575,18 @@ function get_acf_field( $field_key, $post_id = false )
565 575 $row['meta_value'] = maybe_unserialize( $row['meta_value'] );
566 576 $row['meta_value'] = maybe_unserialize( $row['meta_value'] ); // run again for WPML
567 577
  578 +
  579 + // run filters
  580 + $field = $row['meta_value'];
  581 + $field = apply_filters('acf_load_field', $field);
  582 + $field = apply_filters('acf_load_field-' . $field['name'], $field);
  583 + $field = apply_filters('acf_load_field-' . $field['key'], $field);
  584 +
568 585
569 586 // set cache
570   - $this->set_cache('acf_field_' . $field_key, $row['meta_value']);
  587 + $this->set_cache('acf_field_' . $field_key, $field);
571 588
572   - return $row['meta_value'];
  589 + return $field;
573 590 }
574 591 }
575 592
@@ -577,6 +594,7 @@ function get_acf_field( $field_key, $post_id = false )
577 594
578 595 // hook to load in registered field groups
579 596 $acfs = apply_filters('acf_register_field_group', array());
  597 +
580 598 if($acfs)
581 599 {
582 600 // loop through acfs
@@ -589,9 +607,14 @@ function get_acf_field( $field_key, $post_id = false )
589 607 {
590 608 if($field['key'] == $field_key)
591 609 {
  610 + // run filters
  611 + $field = apply_filters('acf_load_field', $field);
  612 + $field = apply_filters('acf_load_field-' . $field['name'], $field);
  613 + $field = apply_filters('acf_load_field-' . $field['key'], $field);
  614 +
592 615 // set cache
593 616 $this->set_cache('acf_field_' . $field_key, $field);
594   -
  617 +
595 618 return $field;
596 619 }
597 620 }
@@ -607,6 +630,36 @@ function get_acf_field( $field_key, $post_id = false )
607 630 }
608 631
609 632
  633 + /*
  634 + * acf_load_field_defaults
  635 + *
  636 + * @description:
  637 + * @since 3.5.1
  638 + * @created: 14/10/12
  639 + */
  640 +
  641 + function acf_load_field_defaults( $field )
  642 + {
  643 + $defaults = array(
  644 + 'key' => '',
  645 + 'label' => '',
  646 + 'name' => '',
  647 + 'type' => 'text',
  648 + 'order_no' => '1',
  649 + 'instructions' => '',
  650 + 'required' => '0',
  651 + 'conditional_logic' => array(
  652 + 'status' => '0',
  653 + 'allorany' => 'all',
  654 + 'rules' => false
  655 + ),
  656 + );
  657 +
  658 + $field = array_merge($defaults, $field);
  659 +
  660 + return $field;
  661 + }
  662 +
610 663 /*--------------------------------------------------------------------------------------
611 664 *
612 665 * create_field
@@ -618,6 +671,7 @@ function get_acf_field( $field_key, $post_id = false )
618 671
619 672 function create_field($field)
620 673 {
  674 +
621 675 if(!isset($this->fields[$field['type']]) || !is_object($this->fields[$field['type']]))
622 676 {
623 677 _e('Error: Field Type does not exist!','acf');
@@ -625,14 +679,85 @@ function create_field($field)
625 679 }
626 680
627 681
628   - // defaults
  682 + // defaults - class
629 683 if( !isset($field['class']) )
630 684 {
631 685 $field['class'] = $field['type'];
632 686 }
633 687
634 688
  689 + // defaults - id
  690 + // - isset is needed for the edit field group page where fields are created without many parameters
  691 + if( !isset($field['id']) )
  692 + {
  693 + if( isset($field['key']) )
  694 + {
  695 + $field['id'] = 'acf-' . $field['key'];
  696 + }
  697 + else
  698 + {
  699 + $field['id'] = 'acf-' . $field['name'];
  700 + }
  701 + }
  702 +
  703 +
635 704 $this->fields[ $field['type'] ]->create_field($field);
  705 +
  706 +
  707 + // conditional logic
  708 + // - isset is needed for the edit field group page where fields are created without many parameters
  709 + if( isset($field['conditional_logic']) && $field['conditional_logic']['status'] == '1' ):
  710 +
  711 + $join = ' && ';
  712 + if( $field['conditional_logic']['allorany'] == "any" )
  713 + {
  714 + $join = ' || ';
  715 + }
  716 +
  717 + ?>
  718 +<script type="text/javascript">
  719 +(function($){
  720 +
  721 + // create the conditional function
  722 + $(document).live('acf/conditional_logic/<?php echo $field['key']; ?>', function(){
  723 +
  724 + var field = $('.field-<?php echo $field['key']; ?>');
  725 +<?php
  726 +
  727 + $if = array();
  728 + foreach( $field['conditional_logic']['rules'] as $rule )
  729 + {
  730 + $if[] = 'acf.conditional_logic.calculate({ field : "'. $field['key'] .'", toggle : "' . $rule['field'] . '", operator : "' . $rule['operator'] .'", value : "' . $rule['value'] . '"})' ;
  731 + }
  732 +
  733 +?>
  734 + if(<?php echo implode( $join, $if ); ?>)
  735 + {
  736 + field.show();
  737 + }
  738 + else
  739 + {
  740 + field.hide();
  741 + }
  742 +
  743 + });
  744 +
  745 +
  746 + // add change events to all fields
  747 +<?php foreach( $field['conditional_logic']['rules'] as $rule ): ?>
  748 + $('.field-<?php echo $rule['field']; ?> *[name]').live('change', function(){
  749 + $(document).trigger('acf/conditional_logic/<?php echo $field['key']; ?>');
  750 + });
  751 +<?php endforeach; ?>
  752 +
  753 + $(document).live('acf/setup_fields', function(e, postbox){
  754 + $(document).trigger('acf/conditional_logic/<?php echo $field['key']; ?>');
  755 + });
  756 +
  757 +})(jQuery);
  758 +</script>
  759 + <?php
  760 + endif;
636 761 }
637 762
638 763
@@ -870,29 +995,12 @@ function create_format_data($field)
870 995
871 996 function render_fields_for_input($fields, $post_id)
872 997 {
873   - // vars
874   - $defaults = array(
875   - 'key' => '',
876   - 'label' => '',
877   - 'name' => '',
878   - 'type' => '',
879   - 'instructions' => '',
880   - 'required' => '0',
881   - 'order_no' => '0',
882   - 'value' => '',
883   - );
884   -
885 998
886 999 // create fields
887 1000 if($fields)
888 1001 {
889 1002 foreach($fields as $field)
890 1003 {
891   - // give defaults
892   -
893   - $field = array_merge($defaults, $field);
894   -
895   -
896 1004 // if they didn't select a type, skip this field
897 1005 if(!$field['type'] || $field['type'] == 'null') continue;
898 1006
@@ -909,7 +1017,7 @@ function render_fields_for_input($fields, $post_id)
909 1017 $required_label = ' <span class="required">*</span>';
910 1018 }
911 1019
912   - echo '<div id="acf-' . $field['name'] . '" class="field field-' . $field['type'] . $required_class . '">';
  1020 + echo '<div id="acf-' . $field['name'] . '" class="field field-' . $field['type'] . ' field-'.$field['key'] . $required_class . '">';
913 1021
914 1022 echo '<p class="label">';
915 1023 echo '<label for="fields[' . $field['key'] . ']">' . $field['label'] . $required_label . '</label>';
@@ -1345,14 +1453,24 @@ function match_location_rule($post = null, $rule = array(), $overrides = array()
1345 1453 return false;
1346 1454 }
1347 1455
  1456 +
1348 1457 // value has changed in 3.2.6 to a sanitized string
1349   - if( strpos( $rule['value'] ,'options-') === false )
  1458 + //if( substr($rule['value'], 0, 7) != 'options' )
  1459 + //{
  1460 + // $rule['value'] = 'options-' . sanitize_title( $rule['value'] );
  1461 + //}
  1462 +
  1463 +
  1464 + // value has changed in 3.5.1 to a acf-options-$title
  1465 + if( substr($rule['value'], 0, 12) != 'acf-options-' )
1350 1466 {
1351   - $rule['value'] = 'options-' . sanitize_title( $rule['value'] );
  1467 + $rule['value'] = 'acf-options-' . sanitize_title( $rule['value'] );
1352 1468 }
1353 1469
  1470 +
1354 1471 // generate the page title to match against
1355   - $page_title = 'options-' . sanitize_title( get_admin_page_title() );
  1472 + $page_title = 'acf-options-' . sanitize_title( get_admin_page_title() );
  1473 +
1356 1474
1357 1475 if($rule['operator'] == "==")
1358 1476 {
15 assets/plugins/advanced-custom-fields/core/actions/export.php
@@ -10,18 +10,17 @@
10 10
11 11 // vars
12 12 $defaults = array(
13   - 'acf_abspath' => '../../../../..',
  13 + 'acf_abspath' => '../../../../../',
14 14 'acf_posts' => array()
15 15 );
16   -$options = array_merge( $defaults, $_POST );
  16 +$my_options = array_merge( $defaults, $_POST );
17 17
18   -
19   -require_once( $options['acf_abspath'] . '/wp-load.php');
20   -require_once( $options['acf_abspath'] . '/wp-admin/admin.php');
  18 +require_once( $my_options['acf_abspath'] . 'wp-load.php');
  19 +require_once( $my_options['acf_abspath'] . 'wp-admin/admin.php');
21 20
22 21
23 22 // check for posts
24   -if( !$options['acf_posts'] )
  23 +if( !$my_options['acf_posts'] )
25 24 {
26 25 wp_die(__("No ACF groups selected",'acf'));
27 26 }
@@ -183,12 +182,12 @@ function wxr_authors_list() {
183 182 <wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
184 183 <wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
185 184 <?php wxr_authors_list(); ?>
186   -<?php if ( $_POST['acf_posts'] ) {
  185 +<?php if ( $my_options['acf_posts'] ) {
187 186
188 187 global $wp_query;
189 188 $wp_query->in_the_loop = true; // Fake being in the loop.
190 189
191   - $where = 'WHERE ID IN (' . join( ',', $_POST['acf_posts'] ) . ')';
  190 + $where = 'WHERE ID IN (' . join( ',', $my_options['acf_posts'] ) . ')';
192 191 $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
193 192
194 193 // Begin Loop
20 assets/plugins/advanced-custom-fields/core/api.php
@@ -255,14 +255,18 @@ function has_sub_field($field_name, $post_id = false)
255 255 'post_id' => $post_id,
256 256 );
257 257 }
258   -
259   -
260   - // if someone used break; We should see if the parent value has this field_name as a value.
261   - if( isset($GLOBALS['acf_field'][$depth-1]) && $GLOBALS['acf_field'][$depth-1]['name'] == $field_name )
  258 + elseif( isset($GLOBALS['acf_field'][$depth-1]) && $GLOBALS['acf_field'][$depth-1]['name'] == $field_name )
262 259 {
  260 + // if someone used break; We should see if the parent value has this field_name as a value.
263 261 unset( $GLOBALS['acf_field'][$depth] );
264 262 $GLOBALS['acf_field'] = array_values($GLOBALS['acf_field']);
265 263 }
  264 + else
  265 + {
  266 + // this was a break; (probably to get the first row only). Clear the repeater
  267 + $GLOBALS['acf_field'] = array();
  268 + return has_sub_field($field_name, $post_id);
  269 + }
266 270
267 271 }
268 272
@@ -457,7 +461,7 @@ function register_options_page($title = "")
457 461 {
458 462 $GLOBALS['acf_register_options_page'][] = array(
459 463 'title' => $title,
460   - 'slug' => 'options-' . sanitize_title( $title ),
  464 + 'slug' => 'acf-options-' . sanitize_title( $title ),
461 465 );
462 466 }
463 467
@@ -628,8 +632,6 @@ function acf_form($options = null)
628 632 'class' => ''
629 633 ),
630 634 'return' => add_query_arg( 'updated', 'true', get_permalink() ), // return url
631   - 'html_field_open' => '<div class="field">', // field wrapper open
632   - 'html_field_close' => '</div>', // field wrapper close
633 635 'html_before_fields' => '', // html inside form before fields
634 636 'html_after_fields' => '', // html inside form after fields
635 637 'submit_value' => 'Update', // vale for submit field
@@ -695,7 +697,9 @@ function acf_form($options = null)
695 697
696 698 if($field_group['fields'])
697 699 {
698   - echo '<div id="acf_' . $field_group['id'] . '" class="postbox acf_postbox"><div class="inside">';
  700 + echo '<div id="acf_' . $field_group['id'] . '" class="postbox acf_postbox">';
  701 + echo '<h3 class="hndle"><span>' . $field_group['title'] . '</span></h3>';
  702 + echo '<div class="inside">';
699 703 echo '<div class="options" data-layout="' . $field_group['options']['layout'] . '" data-show="true"></div>';
700 704 $acf->render_fields_for_input($field_group['fields'], $options['post_id']);
701 705 echo '</div></div>';
15 assets/plugins/advanced-custom-fields/core/controllers/everything_fields.php
@@ -221,8 +221,8 @@ function admin_head()
221 221 type: 'post',
222 222 dataType: 'html',
223 223 success: function(html){
224   - <?php
225 224
  225 +<?php
226 226 if($this->data['page_type'] == "user")
227 227 {
228 228 if($this->data['page_action'] == "add")
@@ -256,10 +256,12 @@ function admin_head()
256 256 echo "$('#media-single-form table tbody tr.submit').before( html );";
257 257 }
258 258 }
259   -
260   - echo "setTimeout( function(){ $(document).trigger('acf/setup_fields', $('#wpbody') ); }, 200);";
  259 +?>
  260 +
  261 + setTimeout( function(){
  262 + $(document).trigger('acf/setup_fields', $('#wpbody') );
  263 + }, 200);
261 264
262   - ?>
263 265 }
264 266 });
265 267
@@ -426,7 +428,7 @@ function acf_everything_fields()
426 428
427 429 if( $options['page_type'] == "taxonomy" && $options['page_action'] == "add")
428 430 {
429   - echo '<div id="acf-' . $field['name'] . '" class="form-field' . $required_class . '">';
  431 + echo '<div id="acf-' . $field['name'] . '" class="form-field field field-' . $field['type'] . ' field-'.$field['key'] . $required_class . '">';
430 432 echo '<label for="fields[' . $field['key'] . ']">' . $field['label'] . $required_label . '</label>';
431 433 $field['name'] = 'fields[' . $field['key'] . ']';
432 434 $this->parent->create_field($field);
@@ -435,11 +437,12 @@ function acf_everything_fields()
435 437 }
436 438 else
437 439 {
438   - echo '<tr id="acf-' . $field['name'] . '" class="field form-field' . $required_class . '">';
  440 + echo '<tr id="acf-' . $field['name'] . '" class="form-field field field-' . $field['type'] . ' field-'.$field['key'] . $required_class . '">';
439 441 echo '<th valign="top" scope="row"><label for="fields[' . $field['key'] . ']">' . $field['label'] . $required_label . '</label></th>';
440 442 echo '<td>';
441 443 $field['name'] = 'fields[' . $field['key'] . ']';
442 444 $this->parent->create_field($field);
  445 +
443 446 if($field['instructions']) echo '<span class="description">' . $field['instructions'] . '</span>';
444 447 echo '</td>';
445 448 echo '</tr>';
35 assets/plugins/advanced-custom-fields/core/controllers/field_group.php
@@ -302,10 +302,10 @@ function ajax_acf_location($options = array())
302 302 case "post_type":
303 303
304 304 $choices = get_post_types(array(
305   - 'public' => true
  305 + //'public' => true
306 306 ));
307 307
308   - unset($choices['attachment']);
  308 + unset( $choices['attachment'], $choices['revision'] , $choices['nav_menu_item'] );
309 309
310 310 break;
311 311
@@ -423,8 +423,10 @@ function ajax_acf_location($options = array())
423 423
424 424 case "options_page" :
425 425
  426 + $parent_title = apply_filters('acf_options_page_title', __('Options','acf'));
  427 +
426 428 $choices = array(
427   - __('Options','acf') => __('Options','acf'),
  429 + $parent_title => $parent_title,
428 430 );
429 431
430 432 $custom = apply_filters('acf_register_options_page',array());
@@ -535,7 +537,7 @@ function save_post($post_id)
535 537
536 538
537 539 // only for save acf
538   - if( ! isset($_POST['save_fields']) || $_POST['save_fields'] != 'true')
  540 + if( ! isset($_POST['acf_save_post']) || $_POST['acf_save_post'] != 'field_group')
539 541 {
540 542 return $post_id;
541 543 }
@@ -552,31 +554,29 @@ function save_post($post_id)
552 554 * save fields
553 555 */
554 556
555   - $fields = $_POST['fields'];
556   -
  557 +
557 558 // get all keys to find fields
558 559 $dont_delete = array();
559 560
560   - if($fields)
  561 + if( $_POST['fields'] )
561 562 {
562 563 $i = -1;
563 564
564   - // remove dummy field
565   - unset($fields['999']);
  565 + // remove clone field
  566 + unset( $_POST['fields']['field_clone'] );
566 567
567 568 // loop through and save fields
568   - foreach($fields as $field)
  569 + foreach( $_POST['fields'] as $key => $field )
569 570 {
570 571 $i++;
571 572
572   - // each field has a unique id!
573   - if(!isset($field['key'])) $field['key'] = 'field_' . uniqid();
574   -
575 573 // add to dont delete array
576   - $dont_delete[] = $field['key'];
  574 + $dont_delete[] = $key;
577 575
578 576 // order
579 577 $field['order_no'] = $i;
  578 + $field['key'] = $key;
  579 +
580 580
581 581 // update field
582 582 $this->parent->update_field($post_id, $field);
@@ -584,9 +584,10 @@ function save_post($post_id)
584 584 }
585 585
586 586 // delete all other field
587   - foreach(get_post_custom_keys($post_id) as $key)
  587 + $keys = get_post_custom_keys($post_id);
  588 + foreach( $keys as $key )
588 589 {
589   - if(strpos($key, 'field_') !== false && !in_array($key, $dont_delete))
  590 + if( strpos($key, 'field_') !== false && !in_array($key, $dont_delete) )
590 591 {
591 592 // this is a field, and it wasn't found in the dont_delete array
592 593 delete_post_meta($post_id, $key);
@@ -635,6 +636,8 @@ function save_post($post_id)
635 636
636 637 }
637 638
  639 +
  640 +
638 641 }
639 642
640 643 ?>
18 assets/plugins/advanced-custom-fields/core/controllers/input.php
@@ -296,6 +296,18 @@ function get_input_style($acf_id = false)
296 296 {
297 297 $html .= '#revisionsdiv, #screen-meta label[for=revisionsdiv-hide] {display: none;} ';
298 298 }
  299 + if( in_array('categories',$acf['options']['hide_on_screen']) )
  300 + {
  301 + $html .= '#categorydiv, #screen-meta label[for=categorydiv-hide] {display: none;} ';
  302 + }
  303 + if( in_array('tags',$acf['options']['hide_on_screen']) )
  304 + {
  305 + $html .= '#tagsdiv-post_tag, #screen-meta label[for=tagsdiv-post_tag-hide] {display: none;} ';
  306 + }
  307 + if( in_array('send-trackbacks',$acf['options']['hide_on_screen']) )
  308 + {
  309 + $html .= '#trackbacksdiv, #screen-meta label[for=trackbacksdiv-hide] {display: none;} ';
  310 + }
299 311
300 312
301 313 break;
@@ -447,9 +459,11 @@ function save_post($post_id)
447 459 {
448 460 $this->save_post_revision( $parent_id, $post_id );
449 461 }
  462 + else
  463 + {
  464 + do_action('acf_save_post', $post_id);
  465 + }
450 466
451   -
452   - do_action('acf_save_post', $post_id);
453 467 }
454 468
455 469
17 assets/plugins/advanced-custom-fields/core/controllers/options_page.php
@@ -58,29 +58,40 @@ function admin_menu()
58 58 return true;
59 59 }
60 60
  61 +
  62 + // vars
61 63 $parent_slug = 'acf-options';
62 64 $parent_title = __('Options','acf');
  65 + $parent_menu = __('Options','acf');
  66 +
63 67
64   - // set parent slug
  68 + // redirect to first child
65 69 $custom = apply_filters('acf_register_options_page',array());
66   - if(!empty($custom))
  70 + if( !empty($custom) )
67 71 {
68 72 $parent_slug = $custom[0]['slug'];
69 73 $parent_title = $custom[0]['title'];
70 74 }
71 75
72 76
  77 + // allow override of title
  78 + $parent_menu = apply_filters('acf_options_page_title', $parent_menu);
  79 +
  80 +
73 81 // Parent
74   - $parent_page = add_menu_page($parent_title, __('Options','acf'), 'edit_posts', $parent_slug, array($this, 'html'));
  82 + $parent_page = add_menu_page($parent_title, $parent_menu, 'edit_posts', $parent_slug, array($this, 'html'));
  83 +
75 84
76 85 // some fields require js + css
77 86 add_action('admin_print_scripts-'.$parent_page, array($this, 'admin_print_scripts'));
78 87 add_action('admin_print_styles-'.$parent_page, array($this, 'admin_print_styles'));
79 88
  89 +
80 90 // Add admin head
81 91 add_action('admin_head-'.$parent_page, array($this,'admin_head'));
82 92 add_action('admin_footer-'.$parent_page, array($this,'admin_footer'));
83 93
  94 +
84 95 if(!empty($custom))
85 96 {
86 97 foreach($custom as $c)
195 assets/plugins/advanced-custom-fields/core/controllers/third_party.php
... ... @@ -0,0 +1,195 @@
  1 +<?php
  2 +
  3 +/*
  4 +* third_party
  5 +*
  6 +* @description:
  7 +* @since 3.5.1
  8 +* @created: 23/06/12
  9 +*/
  10 +
  11 +class acf_third_party
  12 +{
  13 +
  14 + var $parent,
  15 + $data;
  16 +
  17 +
  18 + /*
  19 + * __construct
  20 + *
  21 + * @description:
  22 + * @since 3.1.8
  23 + * @created: 23/06/12
  24 + */
  25 +
  26 + function __construct($parent)
  27 + {
  28 + // vars
  29 + $this->parent = $parent;
  30 + $this->data['metaboxes'] = array();
  31 +
  32 +
  33 + // Tabify Edit Screen - http://wordpress.org/extend/plugins/tabify-edit-screen/
  34 + add_action('admin_head-settings_page_tabify-edit-screen', array($this,'admin_head_tabify'));
  35 +
  36 +
  37 + // Duplicate Post - http://wordpress.org/extend/plugins/duplicate-post/
  38 + add_action( 'dp_duplicate_page', array($this, 'dp_duplicate_page'), 11, 2);
  39 + }
  40 +
  41 +
  42 + /*
  43 + * admin_head_tabify
  44 + *
  45 + * @description:
  46 + * @since 3.5.1
  47 + * @created: 9/10/12
  48 + */
  49 +
  50 + function admin_head_tabify()
  51 + {
  52 + // remove ACF from the tabs
  53 + add_filter('tabify_posttypes', array($this, 'tabify_posttypes'));
  54 +
  55 +
  56 + // add acf metaboxes to list
  57 + add_action('tabify_add_meta_boxes' , array($this,'tabify_add_meta_boxes'));
  58 +
  59 + }
  60 +
  61 +
  62 + /*
  63 + * tabify_posttypes
  64 + *
  65 + * @description:
  66 + * @since 3.5.1
  67 + * @created: 9/10/12
  68 + */
  69 +
  70 + function tabify_posttypes( $posttypes )
  71 + {
  72 + if( isset($posttypes['acf']) )
  73 + {
  74 + unset( $posttypes['acf'] );
  75 + }
  76 +
  77 + return $posttypes;
  78 + }
  79 +
  80 +
  81 + /*
  82 + * tabify_add_meta_boxes
  83 + *
  84 + * @description:
  85 + * @since 3.5.1
  86 + * @created: 9/10/12
  87 + */
  88 +
  89 + function tabify_add_meta_boxes( $post_type )
  90 + {
  91 + // get acf's
  92 + $acfs = $this->parent->get_field_groups();
  93 +
  94 + if($acfs)
  95 + {
  96 + foreach($acfs as $acf)
  97 + {
  98 + // add meta box
  99 + add_meta_box(
  100 + 'acf_' . $acf['id'],
  101 + $acf['title'],
  102 + array($this, 'dummy'),
  103 + $post_type
  104 + );
  105 +
  106 + }
  107 + // foreach($acfs as $acf)
  108 + }
  109 + // if($acfs)
  110 + }
  111 +
  112 + function dummy(){ /* Do Nothing */ }
  113 +
  114 +
  115 +
  116 + /*
  117 + * dp_duplicate_page
  118 + *
  119 + * @description:
  120 + * @since 3.5.1
  121 + * @created: 9/10/12
  122 + */
  123 +
  124 + function dp_duplicate_page( $new_post_id, $old_post_object )
  125 + {
  126 + // only for acf
  127 + if( $old_post_object->post_type != "acf" )
  128 + {
  129 + return;
  130 + }
  131 +
  132 +
  133 + // update keys
  134 + $metas = get_post_custom( $new_post_id );
  135 +
  136 + if( $metas )
  137 + {
  138 + foreach( $metas as $field_key => $field )
  139 + {
  140 + if( strpos($field_key, 'field_') !== false )
  141 + {
  142 + $field = maybe_unserialize($field[0]);
  143 +
  144 + // delete old field
  145 + delete_post_meta($new_post_id, $field_key);
  146 +
  147 +
  148 + // set new keys (recursive for sub fields)
  149 + $field = $this->create_new_field_keys( $field );
  150 +
  151 +
  152 + // save it!
  153 + update_post_meta($new_post_id, $field['key'], $field);
  154 +
  155 + }
  156 + // if( strpos($field_key, 'field_') !== false )
  157 + }
  158 + // foreach( $metas as $field_key => $field )
  159 + }
  160 + // if( $metas )
  161 +
  162 + }
  163 +
  164 +
  165 + /*
  166 + * create_new_field_keys
  167 + *
  168 + * @description:
  169 + * @since 3.5.1
  170 + * @created: 9/10/12
  171 + */
  172 +
  173 + function create_new_field_keys( $field )
  174 + {
  175 + if( isset( $field['key']) )
  176 + {
  177 + $field['key'] = 'field_' . uniqid();
  178 + }
  179 +
  180 +
  181 + if( isset( $field['sub_fields'] ) )
  182 + {
  183 + foreach( $field['sub_fields'] as &$sub_field )
  184 + {
  185 + $sub_field = $this->create_new_field_keys( $sub_field );
  186 + }
  187 + }
  188 +
  189 +
  190 + return $field;
  191 + }
  192 +
  193 +}
  194 +
  195 +?>
5 assets/plugins/advanced-custom-fields/core/fields/acf_field.php
@@ -114,6 +114,11 @@ function update_value($post_id, $field, $value)
114 114 // strip slashes
115 115 $value = stripslashes_deep($value);
116 116
  117 + // apply filters
  118 + $value = apply_filters('acf_update_value', $value, $field, $post_id );
  119 + $value = apply_filters('acf_update_value-' . $field['name'], $value, $field, $post_id);
  120 + $value = apply_filters('acf_update_value-' . $field['key'], $value, $field, $post_id);
  121 +
117 122
118 123 // if $post_id is a string, then it is used in the everything fields and can be found in the options table
119 124 if( is_numeric($post_id) )
4 assets/plugins/advanced-custom-fields/core/fields/checkbox.php
@@ -71,7 +71,7 @@ function create_field($field)
71 71 {
72 72 $selected = 'checked="yes"';
73 73 }
74   - echo '<li><label><input type="checkbox" class="' . $field['class'] . '" name="' . $field['name'] . '" value="' . $key . '" ' . $selected . ' />' . $value . '</label></li>';
  74 + echo '<li><label><input id="' . $field['id'] . '-' . $key . '" type="checkbox" class="' . $field['class'] . '" name="' . $field['name'] . '" value="' . $key . '" ' . $selected . ' />' . $value . '</label></li>';
75 75 }
76 76
77 77 echo '</ul>';
@@ -121,7 +121,7 @@ function create_options($key, $field)
121 121 </p>
122 122 </td>
123 123 <td>
124   - <textarea rows="5" name="fields[<?php echo $key; ?>][choices]" id=""><?php echo $field['choices']; ?></textarea>
  124 + <textarea class="texarea field_option-choices" rows="5" name="fields[<?php echo $key; ?>][choices]" id=""><?php echo $field['choices']; ?></textarea>
125 125 </td>
126 126 </tr>
127 127 <?php
2  assets/plugins/advanced-custom-fields/core/fields/color_picker.php
@@ -61,7 +61,7 @@ function admin_print_styles()
61 61 function create_field($field)
62 62 {
63 63 // html
64   - echo '<input type="text" value="' . $field['value'] . '" class="acf_color_picker" name="' . $field['name'] . '" id="' . $field['name'] . '" />';
  64 + echo '<input type="text" value="' . $field['value'] . '" class="acf_color_picker" name="' . $field['name'] . '" id="' . $field['id'] . '" />';
65 65
66 66 }
67 67
8 assets/plugins/advanced-custom-fields/core/fields/file.php
@@ -613,6 +613,14 @@ function get_value_for_api($post_id, $field)
613 613 {
614 614 $attachment = get_post( $value );
615 615
  616 +
  617 + // validate
  618 + if( !$attachment )
  619 + {
  620 + return false;
  621 + }
  622 +
  623 +
616 624 // create array to hold value data
617 625 $value = array(
618 626 'id' => $attachment->ID,
98 assets/plugins/advanced-custom-fields/core/fields/flexible_content.php
@@ -282,9 +282,14 @@ function create_options($key, $field)
282 282 {
283 283 // vars
284 284 $fields_names = array();
285   - $field['layouts'] = isset($field['layouts']) ? $field['layouts'] : array();
286   - $field['button_label'] = (isset($field['button_label']) && $field['button_label'] != "") ? $field['button_label'] : __("+ Add Row",'acf');
  285 + $defaults = array(
  286 + 'layouts' => array(),
  287 + 'button_label' => __("Add Row",'acf'),
  288 + );
287 289
  290 + $field = array_merge($defaults, $field);
  291 +
  292 +
288 293 // load default layout
289 294 if(empty($field['layouts']))
290 295 {
@@ -296,28 +301,30 @@ function create_options($key, $field)
296 301 );
297 302 }
298 303
  304 +
299 305 // get name of all fields for use in field type
300 306 foreach($this->parent->fields as $f)
301 307 {
302 308 $fields_names[$f->name] = $f->title;
303 309 }
304   - //unset($fields_names['repeater']);
305 310 unset($fields_names['flexible_content']);
306 311
  312 +
307 313 // loop through layouts and create the options for them
308 314 if($field['layouts']):
309 315 foreach($field['layouts'] as $layout_key => $layout):
310 316
311   - // add clone field
312   - $layout['sub_fields'][999] = array(
313   - 'label' => __("New Field",'acf'),
314   - 'name' => 'new_field',
315   - 'type' => 'text',
316   - 'order_no' => '1',
317   - 'instructions' => '',
  317 + $layout['sub_fields'][] = array(
  318 + 'key' => 'field_clone',
  319 + 'label' => __("New Field",'acf'),
  320 + 'name' => __("new_field",'acf'),
  321 + 'type' => 'text',
  322 + 'order_no' => '1',
  323 + 'instructions' => '',
318 324 );
319   - ?>
320   -<tr class="field_option field_option_<?php echo $this->name; ?>">
  325 +
  326 +?>
  327 +<tr class="field_option field_option_<?php echo $this->name; ?>" data-id="<?php echo $layout_key; ?>">
321 328 <td class="label">
322 329 <label><?php _e("Layout",'acf'); ?></label>
323 330 <p class="desription">
@@ -383,22 +390,17 @@ function create_options($key, $field)
383 390 </table>
384 391 </div>
385 392 <div class="fields">
386   -
  393 +
387 394 <div class="no_fields_message" <?php if(count($layout['sub_fields']) > 1){ echo 'style="display:none;"'; } ?>>
388 395 <?php _e("No fields. Click the \"+ Add Sub Field button\" to create your first field.",'acf'); ?>
389 396 </div>
390 397
391   - <?php foreach($layout['sub_fields'] as $key2 => $sub_field): ?>
392   - <div class="<?php if($key2 == 999){echo "field_clone";}else{echo "field";} ?> sub_field" data-id="<?php echo $key2; ?>">
393   -
394   - <?php if(isset($sub_field['key'])): ?>
395   - <input type="hidden" name="fields[<?php echo $key; ?>][sub_fields][<?php echo $key2; ?>][key]" value="<?php echo $sub_field['key']; ?>" />
396   - <?php endif; ?>
397   -
  398 + <?php foreach($layout['sub_fields'] as $sub_field): ?>
  399 + <div class="field field-<?php echo $sub_field['key']; ?> sub_field" data-id="<?php echo $sub_field['key']; ?>">
398 400 <div class="field_meta">
399 401 <table class="acf widefat">
400 402 <tr>
401   - <td class="field_order"><span class="circle"><?php echo ($key2+1); ?></span></td>
  403 + <td class="field_order"><span class="circle"><?php echo (int)$sub_field['order_no'] + 1; ?></span></td>
402 404 <td class="field_label">
403 405 <strong>
404 406 <a class="acf_edit_field" title="<?php _e("Edit this Field",'acf'); ?>" href="javascript:;"><?php echo $sub_field['label']; ?></a>
@@ -429,7 +431,7 @@ function create_options($key, $field)
429 431 <?php
430 432 $this->parent->create_field(array(
431 433 'type' => 'text',
432   - 'name' => 'fields['.$key.'][layouts][' . $layout_key . '][sub_fields]['.$key2.'][label]',
  434 + 'name' => 'fields['.$key.'][layouts][' . $layout_key . '][sub_fields]['.$sub_field['key'].'][label]',
433 435 'value' => $sub_field['label'],
434 436 'class' => 'label',
435 437 ));
@@ -445,7 +447,7 @@ function create_options($key, $field)
445 447 <?php
446 448 $this->parent->create_field(array(
447 449 'type' => 'text',
448   - 'name' => 'fields['.$key.'][layouts][' . $layout_key . '][sub_fields]['.$key2.'][name]',
  450 + 'name' => 'fields['.$key.'][layouts][' . $layout_key . '][sub_fields]['.$sub_field['key'].'][name]',
449 451 'value' => $sub_field['name'],
450 452 'class' => 'name',
451 453 ));
@@ -458,7 +460,7 @@ function create_options($key, $field)
458 460 <?php
459 461 $this->parent->create_field(array(
460 462 'type' => 'select',
461   - 'name' => 'fields['.$key.'][layouts][' . $layout_key . '][sub_fields]['.$key2.'][type]',
  463 + 'name' => 'fields['.$key.'][layouts][' . $layout_key . '][sub_fields]['.$sub_field['key'].'][type]',
462 464 'value' => $sub_field['type'],
463 465 'class' => 'type',
464 466 'choices' => $fields_names
@@ -468,7 +470,7 @@ function create_options($key, $field)
468 470 </tr>
469 471 <?php
470 472
471   - $this->parent->fields[$sub_field['type']]->create_options($key.'][layouts][' . $layout_key . '][sub_fields]['.$key2, $sub_field);
  473 + $this->parent->fields[$sub_field['type']]->create_options($key.'][layouts][' . $layout_key . '][sub_fields]['.$sub_field['key'], $sub_field);
472 474
473 475 ?>
474 476 <tr class="field_save">
@@ -614,46 +616,36 @@ function pre_save_field($field)
614 616 // format sub_fields
615 617 if($field['layouts'])
616 618 {
617   -
618   - $layouts = array();
619   -
620 619 // loop through and save fields
621   - foreach($field['layouts'] as $l)
  620 + foreach($field['layouts'] as $layout_key => $layout)
622 621 {
623 622 // remove dummy field
624   - unset($l['sub_fields'][999]);
  623 + unset( $layout['sub_fields']['field_clone'] );
625 624
626 625 // loop through and save fields
627 626 $i = -1;
628 627
629   - $sub_fields = array();
630   -
631   - if($l['sub_fields'])
  628 + if( $layout['sub_fields'] )
632 629 {
633   - foreach($l['sub_fields'] as $f)
634   - {
635   - $i++;
636   -
637   - // each field has a unique id!
638   - if(!isset($f['key'])) $f['key'] = 'field_' . uniqid();
639   -
640   - // order
641   - $f['order_no'] = $i;
642   -
643   - // format
644   - $f = $this->parent->pre_save_field($f);
645   -
646   - $sub_fields[] = $f;
647   - }
  630 + foreach( $layout['sub_fields'] as $key => $f )
  631 + {
  632 + $i++;
  633 +
  634 + // order
  635 + $f['order_no'] = $i;
  636 + $f['key'] = $key;
  637 +
  638 + // format
  639 + $f = $this->parent->pre_save_field( $f );
  640 +
  641 + $layout['sub_fields'][ $key ] = $f;
  642 + }
648 643 }
649   - $l['sub_fields'] = $sub_fields;
650 644
651   - $layouts[] = $l;
  645 + // update $layout
  646 + $field['layouts'][ $layout_key ] = $layout;
652 647
653 648 }
654   -
655   - $field['layouts'] = $layouts;
656   -
657 649 }
658 650
659 651 // return updated repeater field
8 assets/plugins/advanced-custom-fields/core/fields/gallery.php
@@ -259,10 +259,10 @@ function create_field($field)
8 assets/plugins/advanced-custom-fields/core/fields/image.php
@@ -647,6 +647,14 @@ function get_value_for_api($post_id, $field)
647 647 {
648 648 $attachment = get_post( $value );
649 649
  650 +
  651 + // validate
  652 + if( !$attachment )
  653 + {
  654 + return false;
  655 + }
  656 +
  657 +
650 658 // create array to hold value data
651 659 $value = array(
652 660 'id' => $attachment->ID,
2  assets/plugins/advanced-custom-fields/core/fields/number.php
@@ -35,7 +35,7 @@ function __construct($parent)
35 35
36 36 function create_field($field)
37 37 {
38   - echo '<input type="number" step="any" value="' . $field['value'] . '" id="' . $field['name'] . '" class="' . $field['class'] . '" name="' . $field['name'] . '" />';
  38 + echo '<input type="number" step="any" value="' . $field['value'] . '" id="' . $field['id'] . '" class="' . $field['class'] . '" name="' . $field['name'] . '" />';
39 39 }
40 40
41 41
4 assets/plugins/advanced-custom-fields/core/fields/radio.php
@@ -67,7 +67,7 @@ function create_field($field)
67 67 $selected = 'checked="checked" data-checked="checked"';
68 68 }
69 69
70   - echo '<li><label><input type="radio" name="' . $field['name'] . '" value="' . $key . '" ' . $selected . ' />' . $value . '</label></li>';
  70 + echo '<li><label><input id="' . $field['id'] . '-' . $key . '" type="radio" name="' . $field['name'] . '" value="' . $key . '" ' . $selected . ' />' . $value . '</label></li>';
71 71 }
72 72
73 73 echo '</ul>';
@@ -122,7 +122,7 @@ function create_options($key, $field)
122 122 </p>
123 123 </td>
124 124 <td>
125   - <textarea rows="5" name="fields[<?php echo $key; ?>][choices]" id=""><?php echo $field['choices']; ?></textarea>
  125 + <textarea class="texarea field_option-choices" rows="5" name="fields[<?php echo $key; ?>][choices]" id=""><?php echo $field['choices']; ?></textarea>
126 126 </td>
127 127 </tr>
128 128 <tr class="field_option field_option_<?php echo $this->name; ?>">
2  assets/plugins/advanced-custom-fields/core/fields/relationship.php
@@ -265,7 +265,7 @@ function create_field($field)
265 265
266 266
267 267 ?>
268   -<div class="acf_relationship" data-max="<?php echo $field['max']; ?>" data-s="" data-paged="1" data-post_type="<?php echo implode(',', $field['post_type']); ?>" data-taxonomy="<?php echo implode(',', $field['taxonomy']); ?>" <?php if( defined('ICL_LANGUAGE_CODE') ){ echo 'data-lang="' . ICL_LANGUAGE_CODE . '"';} ?>">
  268 +<div class="acf_relationship" data-max="<?php echo $field['max']; ?>" data-s="" data-paged="1" data-post_type="<?php echo implode(',', $field['post_type']); ?>" data-taxonomy="<?php echo implode(',', $field['taxonomy']); ?>" <?php if( defined('ICL_LANGUAGE_CODE') ){ echo 'data-lang="' . ICL_LANGUAGE_CODE . '"';} ?>>
269 269
270 270 <!-- Hidden Blank default value -->
271 271 <input type="hidden" name="<?php echo $field['name']; ?>" value="" />
59 assets/plugins/advanced-custom-fields/core/fields/repeater.php
@@ -142,7 +142,7 @@ function create_field($field)
142 142 }
143 143
144 144 ?>
145   - <th class="<?php echo $sub_field['name']; ?>" <?php echo $attr; ?>>
  145 + <th class="acf-th-<?php echo $sub_field['name']; ?>" <?php echo $attr; ?>>
146 146 <span><?php echo $sub_field['label']; ?></span>
147 147 <?php if( isset($sub_field['instructions']) ): ?>
148 148 <span class="sub-field-instructions"><?php echo $sub_field['instructions']; ?></span>
@@ -297,15 +297,16 @@ function create_options($key, $field)
297 297 $field['row_min'] = (int) $field['row_min'];
298 298
299 299
300   - // add clone field
301   - $field['sub_fields'][999] = array(
302   - 'label' => __("New Field",'acf'),
303   - 'name' => 'new_field',
304   - 'type' => 'text',
305   - 'order_no' => '1',
306   - 'instructions' => '',
307   - 'column_width' => ''
  300 + // add clone
  301 + $field['sub_fields'][] = array(
  302 + 'key' => 'field_clone',
  303 + 'label' => __("New Field",'acf'),
  304 + 'name' => __("new_field",'acf'),
  305 + 'type' => 'text',
  306 + 'order_no' => '1',
  307 + 'instructions' => '',
308 308 );
  309 +
309 310
310 311 // get name of all fields for use in field type
311 312 foreach($this->parent->fields as $f)
@@ -338,16 +339,12 @@ function create_options($key, $field)
338 339 <?php _e("No fields. Click the \"+ Add Sub Field button\" to create your first field.",'acf'); ?>
339 340 </div>
340 341
341   - <?php foreach($field['sub_fields'] as $key2 => $sub_field): ?>
342   - <div class="<?php if($key2 == 999){echo "field_clone";}else{echo "field";} ?> sub_field" data-id="<?php echo $key2; ?>">
343   -
344   - <?php if(isset($sub_field['key'])): ?>
345   - <input type="hidden" name="fields[<?php echo $key; ?>][sub_fields][<?php echo $key2; ?>][key]" value="<?php echo $sub_field['key']; ?>" />
346   - <?php endif; ?>
  342 + <?php foreach($field['sub_fields'] as $sub_field): ?>
  343 + <div class="field field-<?php echo $sub_field['key']; ?> sub_field" data-id="<?php echo $sub_field['key']; ?>">
347 344 <div class="field_meta">
348 345 <table class="acf widefat">
349 346 <tr>
350   - <td class="field_order"><span class="circle"><?php echo ($key2+1); ?></span></td>
  347 + <td class="field_order"><span class="circle"><?php echo (int)$sub_field['order_no'] + 1; ?></span></td>
351 348 <td class="field_label">
352 349 <strong>
353 350 <a class="acf_edit_field" title="<?php _e("Edit this Field",'acf'); ?>" href="javascript:;"><?php echo $sub_field['label']; ?></a>
@@ -379,7 +376,7 @@ function create_options($key, $field)
379 376 <?php
380 377 $this->parent->create_field(array(
381 378 'type' => 'text',
382   - 'name' => 'fields['.$key.'][sub_fields]['.$key2.'][label]',
  379 + 'name' => 'fields['.$key.'][sub_fields]['.$sub_field['key'].'][label]',
383 380 'value' => $sub_field['label'],
384 381 'class' => 'label',
385 382 ));
@@ -395,7 +392,7 @@ function create_options($key, $field)
395 392 <?php
396 393 $this->parent->create_field(array(
397 394 'type' => 'text',
398   - 'name' => 'fields['.$key.'][sub_fields]['.$key2.'][name]',
  395 + 'name' => 'fields['.$key.'][sub_fields]['.$sub_field['key'].'][name]',
399 396 'value' => $sub_field['name'],
400 397 'class' => 'name',
401 398 ));
@@ -408,7 +405,7 @@ function create_options($key, $field)
408 405 <?php
409 406 $this->parent->create_field(array(
410 407 'type' => 'select',
411   - 'name' => 'fields['.$key.'][sub_fields]['.$key2.'][type]',
  408 + 'name' => 'fields['.$key.'][sub_fields]['.$sub_field['key'].'][type]',
412 409 'value' => $sub_field['type'],
413 410 'class' => 'type',
414 411 'choices' => $fields_names
@@ -428,7 +425,7 @@ function create_options($key, $field)
428 425
429 426 $this->parent->create_field(array(
430 427 'type' => 'text',
431   - 'name' => 'fields['.$key.'][sub_fields]['.$key2.'][instructions]',
  428 + 'name' => 'fields['.$key.'][sub_fields]['.$sub_field['key'].'][instructions]',
432 429 'value' => $sub_field['instructions'],
433 430 'class' => 'instructions',
434 431 ));
@@ -450,7 +447,7 @@ function create_options($key, $field)
450 447
451 448 $this->parent->create_field(array(
452 449 'type' => 'number',
453   - 'name' => 'fields['.$key.'][sub_fields]['.$key2.'][column_width]',
  450 + 'name' => 'fields['.$key.'][sub_fields]['.$sub_field['key'].'][column_width]',
454 451 'value' => $sub_field['column_width'],
455 452 'class' => 'column_width',
456 453 ));
@@ -459,7 +456,7 @@ function create_options($key, $field)
459 456 </tr>
460 457 <?php
461 458
462   - $this->parent->fields[$sub_field['type']]->create_options($key.'][sub_fields]['.$key2, $sub_field);
  459 + $this->parent->fields[$sub_field['type']]->create_options($key.'][sub_fields]['.$sub_field['key'], $sub_field);
463 460
464 461 ?>
465 462 <tr class="field_save">
@@ -568,33 +565,27 @@ function create_options($key, $field)
568 565 function pre_save_field($field)
569 566 {
570 567 // format sub_fields
571   - if($field['sub_fields'])
  568 + if( $field['sub_fields'] )
572 569 {
573 570 // remove dummy field
574   - unset($field['sub_fields'][999]);
  571 + unset( $field['sub_fields']['field_clone'] );
575 572
576 573 // loop through and save fields
577 574 $i = -1;
578   -
579   - $sub_fields = array();
580   -
581   - foreach($field['sub_fields'] as $f)
  575 +
  576 + foreach( $field['sub_fields'] as $key => $f )
582 577 {
583 578 $i++;
584 579
585   - // each field has a unique id!
586   - if(!isset($f['key'])) $f['key'] = 'field_' . uniqid();
587   -
588 580 // order
589 581 $f['order_no'] = $i;
  582 + $f['key'] = $key;
590 583
591 584 // format
592 585 $f = $this->parent->pre_save_field($f);
593 586
594   - $sub_fields[] = $f;
  587 + $field['sub_fields'][ $key ] = $f;
595 588 }
596   -
597   - $field['sub_fields'] = $sub_fields;
598 589 }
599 590
600 591 // return updated repeater field
44 assets/plugins/advanced-custom-fields/core/fields/select.php
@@ -69,7 +69,7 @@ function create_field($field)
69 69
70 70
71 71 // html
72   - echo '<select id="' . $field['name'] . '" class="' . $field['class'] . '" name="' . $field['name'] . '" ' . $multiple . ' >';
  72 + echo '<select id="' . $field['id'] . '" class="' . $field['class'] . '" name="' . $field['name'] . '" ' . $multiple . ' >';
73 73
74 74
75 75 // null
@@ -182,7 +182,7 @@ function create_options($key, $field)
182 182 </p>
183 183 </td>
184 184 <td>
185   - <textarea rows="5" name="fields[<?php echo $key; ?>][choices]" id=""><?php echo $field['choices']; ?></textarea>
  185 + <textarea class="texarea field_option-choices" rows="5" name="fields[<?php echo $key; ?>][choices]" id=""><?php echo $field['choices']; ?></textarea>
186 186 </td>
187 187 </tr>
188 188 <tr class="field_option field_option_<?php echo $this->name; ?>">
@@ -274,33 +274,37 @@ function pre_save_field($field)
274 274
275 275
276 276 // explode choices from each line
277   - if(strpos($field['choices'], "\n") !== false)
  277 + if( $field['choices'] )
278 278 {
279   <