Advanced Custom Fields - Version 2.0.0

Version Description

Download this release

Release Info

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

Code changes from version 1.1.4 to 2.0.0

acf.php CHANGED
@@ -2,14 +2,16 @@
2
  /*
3
  Plugin Name: Advanced Custom Fields
4
  Plugin URI: http://plugins.elliotcondon.com/advanced-custom-fields/
5
- Description: Completely Customise your edit pages with an assortment of field types: Wysiwyg, text, image, select, checkbox and more! Hide unwanted metaboxes and assign to any edit page!
6
- Version: 1.1.4
7
  Author: Elliot Condon
8
  Author URI: http://www.elliotcondon.com/
9
  License: GPL
10
  Copyright: Elliot Condon
11
  */
12
 
 
 
13
 
14
  $acf = new Acf();
15
  include('core/api.php');
@@ -23,6 +25,7 @@ class Acf
23
  var $wpadminurl;
24
  var $version;
25
  var $fields;
 
26
 
27
  function Acf()
28
  {
@@ -33,11 +36,14 @@ class Acf
33
  $this->dir = plugins_url('',__FILE__);
34
  $this->siteurl = get_bloginfo('url');
35
  $this->wpadminurl = admin_url();
36
- $this->version = '1.1.4';
 
 
37
 
38
  // set text domain
39
  load_plugin_textdomain('acf', false, $this->path.'/lang' );
40
 
 
41
  // populate post types
42
  $this->fields = $this->_get_field_types();
43
 
@@ -47,13 +53,21 @@ class Acf
47
  add_action('admin_head', array($this,'_admin_head'));
48
  add_action('admin_menu', array($this,'_admin_menu'));
49
  add_action('save_post', array($this, '_save_post'));
50
- add_action('admin_footer-edit.php', array($this, '_admin_footer'));
 
 
51
 
52
  // add thickbox
53
  add_action("admin_print_scripts", array($this, '_admin_print_scripts'));
54
  add_action("admin_print_styles", array($this, '_admin_print_styles'));
55
-
56
- //register_activation_hook(__FILE__, array($this,'activate'));
 
 
 
 
 
 
57
 
58
  return true;
59
  }
@@ -134,7 +148,7 @@ class Acf
134
  }
135
 
136
  // delete _acf custom fields if needed
137
- if($_POST['fields_meta_box'] == 'true' || $_POST['location_meta_box'] == 'true' || $_POST['input_meta_box'] == 'true')
138
  {
139
  $this->delete_acf_custom_fields($post_id);
140
  }
@@ -220,29 +234,35 @@ class Acf
220
  {
221
  $array = array();
222
 
223
- include('core/fields/text.php');
224
- include('core/fields/textarea.php');
225
- include('core/fields/wysiwyg.php');
226
- include('core/fields/image.php');
227
- include('core/fields/file.php');
228
- include('core/fields/select.php');
229
- include('core/fields/checkbox.php');
230
- include('core/fields/true_false.php');
231
- include('core/fields/page_link.php');
232
- include('core/fields/post_object.php');
233
- include('core/fields/date_picker/date_picker.php');
234
-
235
- $array['text'] = new Text();
236
- $array['textarea'] = new Textarea();
237
- $array['wysiwyg'] = new Wysiwyg();
238
- $array['image'] = new Image();
239
- $array['file'] = new File();
240
- $array['select'] = new Select($this);
241
- $array['checkbox'] = new Checkbox();
242
- $array['true_false'] = new True_false();
243
- $array['page_link'] = new Page_link($this);
244
- $array['post_object'] = new Post_object($this);
245
- $array['date_picker'] = new Date_picker($this->dir);
 
 
 
 
 
 
246
 
247
  return $array;
248
  }
@@ -373,30 +393,61 @@ class Acf
373
 
374
 
375
  // get fields
376
- $fields = $wpdb->get_results("SELECT * FROM $table_name WHERE post_id = '$acf_id' ORDER BY order_no,name");
 
377
 
378
 
379
  // if fields are empty, this must be a new or broken acf. add blank field
380
  if(empty($fields))
381
  {
382
- $fields = array();
383
- $field = new stdClass();
384
- $field->label = '';
385
- $field->name = '';
386
- $field->type = '';
387
- $field->options = '';
388
-
389
- $fields[] = $field;
390
  }
391
 
392
 
393
  // loop through fields
394
  foreach($fields as $field)
395
  {
 
396
  // unserialize options
397
- $field->options = unserialize($field->options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  }
399
-
400
 
401
  // return fields
402
  return $fields;
@@ -457,6 +508,17 @@ class Acf
457
  }
458
 
459
 
 
 
 
 
 
 
 
 
 
 
 
460
  // unserialize values
461
  $location->post_types = unserialize($location->post_types);
462
  $location->page_titles = unserialize($location->page_titles);
@@ -467,15 +529,7 @@ class Acf
467
  $location->category_names = unserialize($location->category_names);
468
 
469
 
470
- // if empty
471
- if(empty($location->post_types)){$location->post_types = array();}
472
- if(empty($location->page_titles)){$location->page_titles = array();}
473
- if(empty($location->page_slugs)){$location->page_slugs = array();}
474
- if(empty($location->post_ids)){$location->post_ids = array();}
475
- if(empty($location->page_templates)){$location->page_templates = array();}
476
- if(empty($location->page_parents)){$location->page_parents = array();}
477
- if(empty($location->category_names)){$location->category_names = array();}
478
-
479
 
480
 
481
  // return location
@@ -521,15 +575,15 @@ class Acf
521
  $options->$key = $value;
522
  }
523
 
 
 
 
 
 
524
 
525
  // unserialize options
526
  $options->show_on_page = unserialize($options->show_on_page);
527
  $options->user_roles = unserialize($options->user_roles);
528
-
529
-
530
- // if empty
531
- if(empty($options->show_on_page)){$options->show_on_page = array();}
532
- if(empty($options->user_roles)){$options->user_roles = array();}
533
 
534
 
535
  // return fields
@@ -547,12 +601,15 @@ class Acf
547
  ---------------------------------------------------------------------------------------------*/
548
  function _admin_footer()
549
  {
550
- if($_GET['post_type'] != 'acf'){return false;}
 
 
 
 
 
 
 
551
 
552
- echo "<style type='text/css'>.row-actions span.inline, .row-actions span.view { display: none; }</style>";
553
- echo '<link rel="stylesheet" href="'.$this->dir.'/css/style.info.css" type="text/css" media="all" />';
554
- echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.info.js"></script>';
555
- include('core/info_meta_box.php');
556
  }
557
 
558
  /*---------------------------------------------------------------------------------------------
@@ -575,10 +632,9 @@ class Acf
575
  $table_name = $wpdb->prefix.'acf_values';
576
 
577
 
578
- // get var
579
  $value = $wpdb->get_var("SELECT value FROM $table_name WHERE field_id = '$field->id' AND post_id = '$post_id'");
580
- $value = stripslashes($value);
581
-
582
  }
583
 
584
 
@@ -592,29 +648,7 @@ class Acf
592
  // return value
593
  return $value;
594
  }
595
-
596
-
597
- /*---------------------------------------------------------------------------------------------
598
- * load_row_id_for_input
599
- *
600
- * @author Elliot Condon
601
- * @since 1.1.2
602
- *
603
- ---------------------------------------------------------------------------------------------*/
604
- function load_row_id_for_input($post_id, $field_id)
605
- {
606
- // set table name
607
- global $wpdb;
608
- $table_name = $wpdb->prefix.'acf_values';
609
-
610
-
611
- // get var
612
- $value = $wpdb->get_var("SELECT id FROM $table_name WHERE field_id = '$field_id' AND post_id = '$post_id'");
613
-
614
-
615
- // return id
616
- return $value;
617
- }
618
 
619
 
620
  /*---------------------------------------------------------------------------------------------
@@ -639,15 +673,18 @@ class Acf
639
 
640
  // get var
641
  $value = $wpdb->get_var("SELECT value FROM $table_name WHERE field_id = '$field->id' AND post_id = '$post_id'");
642
- $value = stripslashes($value);
 
 
 
 
 
 
 
643
  }
644
 
645
 
646
- // format if needed
647
- if(method_exists($this->fields[$field->type], 'format_value_for_api'))
648
- {
649
- $value = $this->fields[$field->type]->format_value_for_api($value);
650
- }
651
 
652
 
653
  // return value
@@ -655,7 +692,34 @@ class Acf
655
  }
656
 
657
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
658
  }
659
 
660
- // update on activate
661
- register_activation_hook( __FILE__, array('Acf', 'update') );
2
  /*
3
  Plugin Name: Advanced Custom Fields
4
  Plugin URI: http://plugins.elliotcondon.com/advanced-custom-fields/
5
+ Description: Completely Customise your edit pages with an assortment of field types: Wysiwyg, Repeater, text, textarea, image, file, select, checkbox post type, page link and more! Hide unwanted metaboxes and assign to any edit page!
6
+ Version: 2.0.0
7
  Author: Elliot Condon
8
  Author URI: http://www.elliotcondon.com/
9
  License: GPL
10
  Copyright: Elliot Condon
11
  */
12
 
13
+ //ini_set('display_errors',1);
14
+ //error_reporting(E_ALL|E_STRICT);
15
 
16
  $acf = new Acf();
17
  include('core/api.php');
25
  var $wpadminurl;
26
  var $version;
27
  var $fields;
28
+ var $activated_fields;
29
 
30
  function Acf()
31
  {
36
  $this->dir = plugins_url('',__FILE__);
37
  $this->siteurl = get_bloginfo('url');
38
  $this->wpadminurl = admin_url();
39
+ $this->version = '2.0.0';
40
+ $this->activated_fields = $this->get_activated_fields();
41
+
42
 
43
  // set text domain
44
  load_plugin_textdomain('acf', false, $this->path.'/lang' );
45
 
46
+
47
  // populate post types
48
  $this->fields = $this->_get_field_types();
49
 
53
  add_action('admin_head', array($this,'_admin_head'));
54
  add_action('admin_menu', array($this,'_admin_menu'));
55
  add_action('save_post', array($this, '_save_post'));
56
+ add_action('admin_footer', array($this, '_admin_footer'));
57
+
58
+
59
 
60
  // add thickbox
61
  add_action("admin_print_scripts", array($this, '_admin_print_scripts'));
62
  add_action("admin_print_styles", array($this, '_admin_print_styles'));
63
+
64
+
65
+ // update if versions don't match
66
+ if(get_option('acf_version') != $this->version)
67
+ {
68
+ $this->update();
69
+ }
70
+
71
 
72
  return true;
73
  }
148
  }
149
 
150
  // delete _acf custom fields if needed
151
+ if(isset($_POST['fields_meta_box']) || isset($_POST['location_meta_box']) || isset($_POST['input_meta_box']))
152
  {
153
  $this->delete_acf_custom_fields($post_id);
154
  }
234
  {
235
  $array = array();
236
 
237
+ include_once('core/fields/text.php');
238
+ include_once('core/fields/textarea.php');
239
+ include_once('core/fields/wysiwyg.php');
240
+ include_once('core/fields/image.php');
241
+ include_once('core/fields/file.php');
242
+ include_once('core/fields/select.php');
243
+ include_once('core/fields/checkbox.php');
244
+ include_once('core/fields/true_false.php');
245
+ include_once('core/fields/page_link.php');
246
+ include_once('core/fields/post_object.php');
247
+ include_once('core/fields/date_picker/date_picker.php');
248
+ include_once('core/fields/repeater.php');
249
+
250
+ $array['text'] = new acf_Text();
251
+ $array['textarea'] = new acf_Textarea();
252
+ $array['wysiwyg'] = new acf_Wysiwyg();
253
+ $array['image'] = new acf_Image();
254
+ $array['file'] = new acf_File();
255
+ $array['select'] = new acf_Select($this);
256
+ $array['checkbox'] = new acf_Checkbox();
257
+ $array['true_false'] = new acf_True_false();
258
+ $array['page_link'] = new acf_Page_link($this);
259
+ $array['post_object'] = new acf_Post_object($this);
260
+ $array['date_picker'] = new acf_Date_picker($this->dir);
261
+
262
+ if(array_key_exists('repeater', $this->activated_fields))
263
+ {
264
+ $array['repeater'] = new acf_Repeater($this);
265
+ }
266
 
267
  return $array;
268
  }
393
 
394
 
395
  // get fields
396
+ $parent_id = 0;
397
+ $fields = $wpdb->get_results("SELECT * FROM $table_name WHERE post_id = '$acf_id' AND parent_id = $parent_id ORDER BY order_no,name");
398
 
399
 
400
  // if fields are empty, this must be a new or broken acf. add blank field
401
  if(empty($fields))
402
  {
403
+ return array();
 
 
 
 
 
 
 
404
  }
405
 
406
 
407
  // loop through fields
408
  foreach($fields as $field)
409
  {
410
+
411
  // unserialize options
412
+ $field->options = @unserialize($field->options);
413
+
414
+ if(!is_array($field->options))
415
+ {
416
+ $field->options = array();
417
+ }
418
+
419
+
420
+ // sub fields
421
+ if($field->type == 'repeater')
422
+ {
423
+ $sub_fields = $wpdb->get_results("SELECT * FROM $table_name WHERE parent_id = '$field->id' ORDER BY order_no,name");
424
+
425
+
426
+ // if fields are empty, this must be a new or broken acf.
427
+ if(empty($sub_fields))
428
+ {
429
+ $field->options['sub_fields'] = array();
430
+ }
431
+ else
432
+ {
433
+ // loop through fields
434
+ foreach($sub_fields as $sub_field)
435
+ {
436
+ // unserialize options
437
+ $sub_field->options = unserialize($sub_field->options);
438
+ }
439
+
440
+
441
+ // assign array to the field options array
442
+ $field->options['sub_fields'] = $sub_fields;
443
+ }
444
+
445
+
446
+
447
+ }
448
+ // end if sub field
449
  }
450
+ // end foreach $fields
451
 
452
  // return fields
453
  return $fields;
508
  }
509
 
510
 
511
+ // if empty
512
+ if(empty($location->post_types)){$location->post_types = serialize(array());}
513
+ if(empty($location->page_titles)){$location->page_titles = serialize(array());}
514
+ if(empty($location->page_slugs)){$location->page_slugs = serialize(array());}
515
+ if(empty($location->post_ids)){$location->post_ids = serialize(array());}
516
+ if(empty($location->page_templates)){$location->page_templates = serialize(array());}
517
+ if(empty($location->page_parents)){$location->page_parents = serialize(array());}
518
+ if(empty($location->category_names)){$location->category_names = serialize(array());}
519
+ if(empty($location->ignore_other_acfs)){$location->ignore_other_acfs = '0';}
520
+
521
+
522
  // unserialize values
523
  $location->post_types = unserialize($location->post_types);
524
  $location->page_titles = unserialize($location->page_titles);
529
  $location->category_names = unserialize($location->category_names);
530
 
531
 
532
+
 
 
 
 
 
 
 
 
533
 
534
 
535
  // return location
575
  $options->$key = $value;
576
  }
577
 
578
+
579
+ // if empty
580
+ if(empty($options->show_on_page)){$options->show_on_page = serialize(array());}
581
+ if(empty($options->user_roles)){$options->user_roles = serialize(array());}
582
+
583
 
584
  // unserialize options
585
  $options->show_on_page = unserialize($options->show_on_page);
586
  $options->user_roles = unserialize($options->user_roles);
 
 
 
 
 
587
 
588
 
589
  // return fields
601
  ---------------------------------------------------------------------------------------------*/
602
  function _admin_footer()
603
  {
604
+ global $post;
605
+
606
+ if(get_post_type($post) == 'acf')
607
+ {
608
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.screen_extra.css" />';
609
+ echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.screen_extra.js" ></script>';
610
+ include('core/screen_extra.php');
611
+ }
612
 
 
 
 
 
613
  }
614
 
615
  /*---------------------------------------------------------------------------------------------
632
  $table_name = $wpdb->prefix.'acf_values';
633
 
634
 
635
+ // get row
636
  $value = $wpdb->get_var("SELECT value FROM $table_name WHERE field_id = '$field->id' AND post_id = '$post_id'");
637
+
 
638
  }
639
 
640
 
648
  // return value
649
  return $value;
650
  }
651
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
652
 
653
 
654
  /*---------------------------------------------------------------------------------------------
673
 
674
  // get var
675
  $value = $wpdb->get_var("SELECT value FROM $table_name WHERE field_id = '$field->id' AND post_id = '$post_id'");
676
+ //$value = stripslashes($value);
677
+
678
+
679
+ // format if needed
680
+ if(method_exists($this->fields[$field->type], 'format_value_for_api'))
681
+ {
682
+ $value = $this->fields[$field->type]->format_value_for_api($value);
683
+ }
684
  }
685
 
686
 
687
+
 
 
 
 
688
 
689
 
690
  // return value
692
  }
693
 
694
 
695
+ /*---------------------------------------------------------------------------------------------
696
+ * get_activated_fields
697
+ *
698
+ * @author Elliot Condon
699
+ * @since 2.0.0
700
+ *
701
+ ---------------------------------------------------------------------------------------------*/
702
+ function get_activated_fields()
703
+ {
704
+ $activated = array();
705
+
706
+ // repeater
707
+ if(get_option("acf_repeater_ac"))
708
+ {
709
+ $md5 = md5(get_option("acf_repeater_ac"));
710
+ if($md5 == "bbefed143f1ec106ff3a11437bd73432")
711
+ {
712
+ $activated['repeater'] = get_option("acf_repeater_ac");
713
+ }
714
+ if($md5 == "44146dd6d0f8873f34e4a0b75e5639f7")
715
+ {
716
+ $activated['repeater'] = get_option("acf_repeater_ac")." (Testing License)";
717
+ }
718
+ }
719
+
720
+ return $activated;
721
+ }
722
+
723
+
724
  }
725
 
 
 
core/acf_post_type.php CHANGED
@@ -1,17 +1,18 @@
1
  <?php
2
 
3
  $labels = array(
4
- 'name' => __( 'Advanced&nbsp;Custom&nbsp;Fields', 'acf' ),
5
  'singular_name' => __( 'Advanced Custom Fields', 'acf' ),
6
- 'search_items' => __( 'Search Advanced Custom Fields' , 'acf' ),
7
- 'all_items' => __( 'All Advanced Custom Fields' , 'acf' ),
8
- 'parent_item' => __( 'Parent Advanced Custom Fields' , 'acf' ),
9
- 'parent_item_colon' => __( 'Parent Advanced Custom Fields:' , 'acf' ),
10
- 'edit_item' => __( 'Edit Advanced Custom Fields' , 'acf' ),
11
- 'update_item' => __( 'Update Advanced Custom Fields' , 'acf' ),
12
- 'add_new_item' => __( 'Add New Advanced Custom Fields' , 'acf' ),
13
- 'new_item_name' => __( 'New Advanced Custom Fields Name' , 'acf' ),
14
- );
 
15
 
16
  $supports = array(
17
  'title',
1
  <?php
2
 
3
  $labels = array(
4
+ 'name' => __( 'Advanced&nbsp;Custom&nbsp;Fields', 'acf' ),
5
  'singular_name' => __( 'Advanced Custom Fields', 'acf' ),
6
+ 'add_new' => __( 'Add New' , 'acf' ),
7
+ 'add_new_item' => __( 'Add New Advanced Custom Field Group' , 'acf' ),
8
+ 'edit_item' => __( 'Edit Advanced Custom Field Group' , 'acf' ),
9
+ 'new_item' => __( 'New Advanced Custom Field Group' , 'acf' ),
10
+ 'view_item' => __('View Advanced Custom Field Group'),
11
+ 'search_items' => __('Search Advanced Custom Field Groups'),
12
+ 'not_found' => __('No Advanced Custom Field Groups found'),
13
+ 'not_found_in_trash' => __('No Advanced Custom Field Groups found in Trash'),
14
+ );
15
+
16
 
17
  $supports = array(
18
  'title',
core/admin_head.php CHANGED
@@ -2,132 +2,206 @@
2
 
3
  global $post;
4
 
5
-
6
- // shows hidden custom fields
7
- //echo "<style type='text/css'>#postcustom .hidden { display: table-row; }</style>";
8
-
9
- // get current page
10
- $currentFile = $_SERVER["SCRIPT_NAME"];
11
- $parts = Explode('/', $currentFile);
12
- $currentFile = $parts[count($parts) - 1];
13
 
14
- // do stuff
15
- if($currentFile == 'edit.php')
16
  {
 
 
 
 
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
- elseif(get_post_type($post) == 'acf')
20
- {
21
 
22
- // Custom field page for ACF
23
- echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.fields.js" ></script>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.global.css" />';
26
- echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.fields.css" />';
27
- echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.location.css" />';
28
- echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.options.css" />';
29
 
30
- add_meta_box('acf_fields', 'Fields', array($this, '_fields_meta_box'), 'acf', 'normal', 'high');
31
- add_meta_box('acf_location', 'Assign to edit page</span><span class="description">- Create rules to show your advanced custom fields on edit pages', array($this, '_location_meta_box'), 'acf', 'normal', 'high');
32
- add_meta_box('acf_options', 'Advanced Options</span><span class="description">- Customise the edit page', array($this, '_options_meta_box'), 'acf', 'normal', 'high');
33
  }
34
- else
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  {
36
- // any other edit page
37
- $acfs = get_pages(array(
38
- 'numberposts' => -1,
39
- 'post_type' => 'acf',
40
- 'sort_column' => 'menu_order',
41
- ));
42
 
43
- // blank array to hold acfs
44
- $add_acf = array();
 
 
 
 
 
 
 
 
 
45
 
46
- if($acfs)
 
47
  {
48
- foreach($acfs as $acf)
 
 
 
 
 
 
 
 
 
 
49
  {
50
- $add_box = false;
51
-
52
- // get options of matrix
53
- $location = $this->get_acf_location($acf->ID);
54
- $options = $this->get_acf_options($acf->ID);
55
-
56
-
57
- // post type
58
- if(in_array(get_post_type($post), $location->post_types)) {$add_box = true; }
59
-
60
-
61
- // page title
62
- if(in_array($post->post_title, $location->page_titles)) {$add_box = true; }
63
-
64
-
65
- // page slug
66
- if(in_array($post->post_name, $location->page_slugs)) {$add_box = true; }
67
-
68
-
69
- // post id
70
- if(in_array($post->ID, $location->post_ids)) {$add_box = true; }
71
-
72
-
73
- // page template
74
- if(in_array(get_post_meta($post->ID,'_wp_page_template',true), $location->page_templates)) {$add_box = true; }
75
-
76
-
77
- // page parents
78
- if(in_array($post->post_parent, $location->page_parents)) {$add_box = true; }
79
-
80
- // category names
81
- $cats = get_the_category();
82
- if($cats)
83
  {
84
- foreach($cats as $cat)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  {
86
- if(in_array($cat->name, $location->category_names)) {$add_box = true; }
 
 
 
87
  }
88
- }
89
-
90
-
91
-
92
- // current user role
93
- global $current_user;
94
- get_currentuserinfo();
95
- if(!empty($options->user_roles))
96
- {
97
- if(!in_array($current_user->user_level, $options->user_roles)) {$add_box = false; }
98
- }
99
-
100
-
101
-
102
- if($add_box == true)
103
- {
104
- // Override
105
- if($location->ignore_other_acfs == '1')
106
  {
107
- // if ignore other acf's was ticked, override the $add_acf array and break the loop
108
- $add_acf = array($acf);
109
- break;
110
  }
111
- else
 
 
 
112
  {
113
- // add acf to array
114
- $add_acf[] = $acf;
 
 
 
 
 
 
 
 
 
 
115
  }
116
- }
 
117
 
118
- }// end foreach
119
-
120
- if(!empty($add_acf))
121
- {
122
- // add these acf's to the page
123
- echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.global.css" />';
124
- echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.input.css" />';
125
- echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.input.js" ></script>';
126
 
127
- add_meta_box('acf_input', 'ACF Fields', array($this, '_input_meta_box'), get_post_type($post), 'normal', 'high', array('acfs' => $add_acf));
128
- }
129
-
130
- }// end if
 
 
 
 
 
131
  }
132
 
 
133
  ?>
2
 
3
  global $post;
4
 
 
 
 
 
 
 
 
 
5
 
6
+ // deactivate field
7
+ if(isset($_POST['acf_field_deactivate']))
8
  {
9
+ // a field was deactivated
10
+ $field = $_POST['acf_field_deactivate'];
11
+ $option = 'acf_'.$field.'_ac';
12
+ delete_option($option);
13
 
14
+ // update activated fields
15
+ $this->activated_fields = $this->get_activated_fields();
16
+ $this->fields = $this->_get_field_types();
17
+
18
+ global $acf_message_field;
19
+ $acf_message_field = ucfirst($field);
20
+
21
+ function my_admin_notice(){
22
+ global $acf_message_field;
23
+ echo '<div class="updated below-h2" id="message"><p>'.$acf_message_field.' field deactivated</p></div>';
24
+ }
25
+ add_action('admin_notices', 'my_admin_notice');
26
+
27
  }
 
 
28
 
29
+
30
+ // activate field
31
+ if(isset($_POST['acf_field_activate']))
32
+ {
33
+ // a field was deactivated
34
+ $field = $_POST['acf_field_activate'];
35
+ $ac = $_POST['acf_ac'];
36
+
37
+ $option = 'acf_'.$field.'_ac';
38
+ update_option($option, $ac);
39
+
40
+ // update activated fields
41
+ $old_count = count($this->activated_fields);
42
+ $this->activated_fields = $this->get_activated_fields();
43
+ $this->fields = $this->_get_field_types();
44
+ $new_count = count($this->activated_fields);
45
+
46
+ global $acf_message_field;
47
+ $acf_message_field = ucfirst($field);
48
+
49
+ if($new_count == $old_count)
50
+ {
51
+ function my_admin_notice(){
52
+ echo '<div class="updated below-h2" id="message"><p>Activation code unrecognized</p></div>';
53
+ }
54
+ add_action('admin_notices', 'my_admin_notice');
55
+
56
+ }
57
+ else
58
+ {
59
+ function my_admin_notice(){
60
+ global $acf_message_field;
61
+ echo '<div class="updated below-h2" id="message"><p>'.$acf_message_field.' field activated</p></div>';
62
+ }
63
+ add_action('admin_notices', 'my_admin_notice',$m);
64
+
65
+ }
66
+
67
 
 
 
 
 
68
 
 
 
 
69
  }
70
+
71
+
72
+
73
+
74
+
75
+
76
+ // get current page
77
+ $currentFile = $_SERVER["SCRIPT_NAME"];
78
+ $parts = Explode('/', $currentFile);
79
+ $currentFile = $parts[count($parts) - 1];
80
+
81
+
82
+ // only add html to post.php and post-new.php pages
83
+ if($currentFile == 'post.php' || $currentFile == 'post-new.php')
84
  {
85
+
86
+ if(get_post_type($post) == 'acf')
87
+ {
 
 
 
88
 
89
+ // ACF
90
+ echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.fields.js" ></script>';
91
+
92
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.global.css" />';
93
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.fields.css" />';
94
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.location.css" />';
95
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.options.css" />';
96
+
97
+ add_meta_box('acf_fields', 'Fields', array($this, '_fields_meta_box'), 'acf', 'normal', 'high');
98
+ add_meta_box('acf_location', 'Assign to edit page</span><span class="description">- Create rules to show your advanced custom fields on edit pages', array($this, '_location_meta_box'), 'acf', 'normal', 'high');
99
+ add_meta_box('acf_options', 'Advanced Options</span><span class="description">- Customise the edit page', array($this, '_options_meta_box'), 'acf', 'normal', 'high');
100
 
101
+ }
102
+ else
103
  {
104
+ // any other edit page
105
+ $acfs = get_pages(array(
106
+ 'numberposts' => -1,
107
+ 'post_type' => 'acf',
108
+ 'sort_column' => 'menu_order',
109
+ ));
110
+
111
+ // blank array to hold acfs
112
+ $add_acf = array();
113
+
114
+ if($acfs)
115
  {
116
+ foreach($acfs as $acf)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  {
118
+ $add_box = false;
119
+
120
+ // get options of matrix
121
+ $location = $this->get_acf_location($acf->ID);
122
+ $options = $this->get_acf_options($acf->ID);
123
+
124
+
125
+ // post type
126
+ if(in_array(get_post_type($post), $location->post_types)) {$add_box = true; }
127
+
128
+
129
+ // page title
130
+ if(in_array($post->post_title, $location->page_titles)) {$add_box = true; }
131
+
132
+
133
+ // page slug
134
+ if(in_array($post->post_name, $location->page_slugs)) {$add_box = true; }
135
+
136
+
137
+ // post id
138
+ if(in_array($post->ID, $location->post_ids)) {$add_box = true; }
139
+
140
+
141
+ // page template
142
+ if(in_array(get_post_meta($post->ID,'_wp_page_template',true), $location->page_templates)) {$add_box = true; }
143
+
144
+
145
+ // page parents
146
+ if(in_array($post->post_parent, $location->page_parents)) {$add_box = true; }
147
+
148
+ // category names
149
+ $cats = get_the_category();
150
+ if($cats)
151
  {
152
+ foreach($cats as $cat)
153
+ {
154
+ if(in_array($cat->name, $location->category_names)) {$add_box = true; }
155
+ }
156
  }
157
+
158
+
159
+
160
+ // current user role
161
+ global $current_user;
162
+ get_currentuserinfo();
163
+ if(!empty($options->user_roles))
 
 
 
 
 
 
 
 
 
 
 
164
  {
165
+ if(!in_array($current_user->user_level, $options->user_roles)) {$add_box = false; }
 
 
166
  }
167
+
168
+
169
+
170
+ if($add_box == true)
171
  {
172
+ // Override
173
+ if($location->ignore_other_acfs == '1')
174
+ {
175
+ // if ignore other acf's was ticked, override the $add_acf array and break the loop
176
+ $add_acf = array($acf);
177
+ break;
178
+ }
179
+ else
180
+ {
181
+ // add acf to array
182
+ $add_acf[] = $acf;
183
+ }
184
  }
185
+
186
+ }// end foreach
187
 
188
+ if(!empty($add_acf))
189
+ {
190
+ // add these acf's to the page
191
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.global.css" />';
192
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.input.css" />';
193
+ echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.input.js" ></script>';
 
 
194
 
195
+ // date picker!
196
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/core/fields/date_picker/style.date_picker.css" />';
197
+ echo '<script type="text/javascript" src="'.$this->dir.'/core/fields/date_picker/jquery.ui.datepicker.js" ></script>';
198
+
199
+ add_meta_box('acf_input', 'ACF Fields', array($this, '_input_meta_box'), get_post_type($post), 'normal', 'high', array('acfs' => $add_acf));
200
+ }
201
+
202
+ }// end if
203
+ }
204
  }
205
 
206
+
207
  ?>
core/api.php CHANGED
@@ -54,22 +54,59 @@ function get_acf($post_id = false)
54
 
55
 
56
  // get fields
57
- $fields = $wpdb->get_results("SELECT DISTINCT f.* FROM $acf_fields f
 
58
  LEFT JOIN $acf_values v ON v.field_id=f.id
59
  WHERE v.post_id = '$post_id'");
60
 
61
 
62
- if(empty($fields)){return null;}
63
 
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  foreach($fields as $field)
66
  {
67
- // get value
68
- $field->value = $acf->load_value_for_api($post_id, $field);
69
-
70
-
71
  // add this field: name => value
72
- $variables[$field->name] = $field->value;
73
 
74
  }
75
 
@@ -115,11 +152,11 @@ function get_field($field_name, $post_id = false)
115
 
116
  //echo 'field name: '.$field_name.', post id: '.$post_id;
117
 
118
- if(empty($acf_fields))
119
  {
120
  $acf_fields = array();
121
  }
122
- if(empty($acf_fields[$post_id]))
123
  {
124
  $acf_fields[$post_id] = get_acf($post_id);
125
  }
@@ -127,6 +164,25 @@ function get_field($field_name, $post_id = false)
127
  return $acf_fields[$post_id]->$field_name;
128
  }
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  // the field
132
  function the_field($field_name, $post_id = false)
@@ -188,7 +244,7 @@ class ACF_WP_Query extends WP_Query
188
  $acf_fields = $wpdb->prefix.'acf_fields';
189
  $acf_values = $wpdb->prefix.'acf_values';
190
 
191
- $join .= "LEFT JOIN $acf_values v ON v.post_id=wp_posts.ID
192
  LEFT JOIN $acf_fields f ON f.id=v.field_id";
193
 
194
  return $join;
54
 
55
 
56
  // get fields
57
+ $fields = array();
58
+ $temp_fields = $wpdb->get_results("SELECT DISTINCT f.* FROM $acf_fields f
59
  LEFT JOIN $acf_values v ON v.field_id=f.id
60
  WHERE v.post_id = '$post_id'");
61
 
62
 
63
+ if(empty($temp_fields)){return null;}
64
 
65
 
66
+ // add fields to field array with key = field->id
67
+ foreach($temp_fields as $field)
68
+ {
69
+ $fields[$field->id] = $field;
70
+ }
71
+
72
+
73
+ // now look for child fields
74
+ foreach($fields as $i => $field)
75
+ {
76
+ if($field->parent_id != 0)
77
+ {
78
+ // this is a sub field.
79
+ $parent_field = $wpdb->get_row("SELECT * FROM $acf_fields WHERE id = $field->parent_id");
80
+
81
+ if(isset($fields[$parent_field->id]))
82
+ {
83
+ // parent field has already been created!
84
+ $fields[$parent_field->id]->options['sub_fields'][] = $field;
85
+ }
86
+ else
87
+ {
88
+ // add sub field to parent field
89
+ $parent_field->options = array();
90
+ $parent_field->options['sub_fields'][] = $field;
91
+
92
+
93
+ // add parent field
94
+ $fields[$parent_field->id] = $parent_field;
95
+ }
96
+
97
+
98
+ unset($fields[$i]);
99
+ }
100
+ }
101
+ //echo '<pre>';
102
+ //print_r($fields);
103
+ //echo '</pre>';
104
+ //die;
105
  foreach($fields as $field)
106
  {
107
+
 
 
 
108
  // add this field: name => value
109
+ $variables[$field->name] = $acf->load_value_for_api($post_id, $field);
110
 
111
  }
112
 
152
 
153
  //echo 'field name: '.$field_name.', post id: '.$post_id;
154
 
155
+ if(!isset($acf_fields))
156
  {
157
  $acf_fields = array();
158
  }
159
+ if(!isset($acf_fields[$post_id]))
160
  {
161
  $acf_fields[$post_id] = get_acf($post_id);
162
  }
164
  return $acf_fields[$post_id]->$field_name;
165
  }
166
 
167
+ // get sub field
168
+ function get_sub_field($field_name, $field)
169
+ {
170
+ if(isset($field[$field_name]))
171
+ {
172
+ return $field[$field_name];
173
+ }
174
+ else
175
+ {
176
+ return false;
177
+ }
178
+ }
179
+
180
+ // get sub field
181
+ function the_sub_field($field_name, $field)
182
+ {
183
+ echo get_sub_field($field_name, $field);
184
+ }
185
+
186
 
187
  // the field
188
  function the_field($field_name, $post_id = false)
244
  $acf_fields = $wpdb->prefix.'acf_fields';
245
  $acf_values = $wpdb->prefix.'acf_values';
246
 
247
+ $join .= "LEFT JOIN $acf_values v ON v.post_id=".$wpdb->prefix."posts.ID
248
  LEFT JOIN $acf_fields f ON f.id=v.field_id";
249
 
250
  return $join;
core/fields/checkbox.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
 
3
- class Checkbox
4
  {
5
  var $name;
6
  var $title;
7
 
8
- function Checkbox()
9
  {
10
  $this->name = 'checkbox';
11
  $this->title = __('Checkbox','acf');
@@ -53,7 +53,7 @@ class Checkbox
53
  function options_html($key, $options)
54
  {
55
  // implode checkboxes so they work in a textarea
56
- if(!empty($options['choices']) && is_array($options['choices']))
57
  {
58
  foreach($options['choices'] as $choice_key => $choice_val)
59
  {
@@ -61,58 +61,36 @@ class Checkbox
61
  }
62
  $options['choices'] = implode("\n", $options['choices']);
63
  }
 
 
 
 
64
 
65
  ?>
66
 
67
- <table class="acf_input">
68
- <tr>
69
  <td class="label">
70
- <label for=""><?php _e("Choices",'acf');_e("",'acf') ?></label>
 
 
 
 
 
 
 
 
 
71
  </td>
72
  <td>
73
  <textarea rows="5" name="acf[fields][<?php echo $key; ?>][options][choices]" id=""><?php echo $options['choices']; ?></textarea>
74
- <p class="description"><?php _e("Enter your choices one per line. eg:<br />
75
- option_1 : Option 1<br />
76
- option_3 : Option 2<br />
77
- option_3 : Option 3",'acf'); ?></p>
78
  </td>
79
  </tr>
80
- </table>
81
 
82
  <?php
83
  }
84
 
85
-
86
- /*---------------------------------------------------------------------------------------------
87
- * save input
88
- * - called from fields_save.php
89
- * - saves input data
90
- *
91
- * @author Elliot Condon
92
- * @since 1.1
93
- *
94
- ---------------------------------------------------------------------------------------------*/
95
- function save_input($post_id, $field)
96
- {
97
- // set table name
98
- global $wpdb;
99
- $table_name = $wpdb->prefix.'acf_values';
100
-
101
-
102
- // if select is a multiple, you need to save it as an array!
103
- if(is_array($field['value']))
104
- {
105
- $field['value'] = serialize($field['value']);
106
- }
107
-
108
-
109
- // insert new data
110
- $new_id = $wpdb->insert($table_name, array(
111
- 'post_id' => $post_id,
112
- 'field_id' => $field['field_id'],
113
- 'value' => $field['value']
114
- ));
115
- }
116
 
117
 
118
  /*---------------------------------------------------------------------------------------------
1
  <?php
2
 
3
+ class acf_Checkbox
4
  {
5
  var $name;
6
  var $title;
7
 
8
+ function acf_Checkbox()
9
  {
10
  $this->name = 'checkbox';
11
  $this->title = __('Checkbox','acf');
53
  function options_html($key, $options)
54
  {
55
  // implode checkboxes so they work in a textarea
56
+ if(isset($options['choices']) && is_array($options['choices']))
57
  {
58
  foreach($options['choices'] as $choice_key => $choice_val)
59
  {
61
  }
62
  $options['choices'] = implode("\n", $options['choices']);
63
  }
64
+ else
65
+ {
66
+ $options['choices'] = "";
67
+ }
68
 
69
  ?>
70
 
71
+
72
+ <tr class="field_option field_option_checkbox">
73
  <td class="label">
74
+ <label for=""><?php _e("Choices",'acf'); ?></label>
75
+ <p class="description"><?php _e("Enter your choices one per line<br />
76
+ <br />
77
+ Red<br />
78
+ Blue<br />
79
+ <br />
80
+ or<br />
81
+ <br />
82
+ red : Red<br />
83
+ blue : Blue",'acf'); ?></p>
84
  </td>
85
  <td>
86
  <textarea rows="5" name="acf[fields][<?php echo $key; ?>][options][choices]" id=""><?php echo $options['choices']; ?></textarea>
 
 
 
 
87
  </td>
88
  </tr>
89
+
90
 
91
  <?php
92
  }
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
 
96
  /*---------------------------------------------------------------------------------------------
core/fields/date_picker/date_picker.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php
2
 
3
- class Date_picker
4
  {
5
  var $name;
6
  var $title;
7
  var $plugin_dir;
8
 
9
- function Date_picker($plugin_dir)
10
  {
11
  $this->name = 'date_picker';
12
  $this->title = __('Date Picker','acf');
@@ -15,8 +15,6 @@ class Date_picker
15
 
16
  function html($field)
17
  {
18
- echo '<link rel="stylesheet" type="text/css" href="'.$this->plugin_dir.'/core/fields/date_picker/style.date_picker.css" />';
19
- echo '<script type="text/javascript" src="'.$this->plugin_dir.'/core/fields/date_picker/jquery.ui.datepicker.js" ></script>';
20
  echo '<input type="hidden" value="'.$field->options['date_format'].'" name="date_format" />';
21
  echo '<input type="text" value="'.$field->value.'" id="'.$field->input_id.'" class="acf_datepicker" name="'.$field->input_name.'" />';
22
 
@@ -24,18 +22,21 @@ class Date_picker
24
 
25
  function options_html($key, $options)
26
  {
 
 
 
 
27
  ?>
28
- <table class="acf_input">
29
- <tr>
30
  <td class="label">
31
  <label for=""><?php _e("Date format",'acf'); ?></label>
 
32
  </td>
33
  <td>
34
  <input type="text" name="acf[fields][<?php echo $key; ?>][options][date_format]" id="" value="<?php echo $options['date_format']; ?>" />
35
- <p class="description"><?php _e("eg. dd/mm/yy. read more about",'acf'); ?> <a href="http://docs.jquery.com/UI/Datepicker/formatDate">formatDate</a></p>
36
  </td>
37
  </tr>
38
- </table>
39
  <?php
40
  }
41
 
1
  <?php
2
 
3
+ class acf_Date_picker
4
  {
5
  var $name;
6
  var $title;
7
  var $plugin_dir;
8
 
9
+ function acf_Date_picker($plugin_dir)
10
  {
11
  $this->name = 'date_picker';
12
  $this->title = __('Date Picker','acf');
15
 
16
  function html($field)
17
  {
 
 
18
  echo '<input type="hidden" value="'.$field->options['date_format'].'" name="date_format" />';
19
  echo '<input type="text" value="'.$field->value.'" id="'.$field->input_id.'" class="acf_datepicker" name="'.$field->input_name.'" />';
20
 
22
 
23
  function options_html($key, $options)
24
  {
25
+ if(!isset($options['date_format']))
26
+ {
27
+ $options['date_format'] = "";
28
+ }
29
  ?>
30
+ <tr class="field_option field_option_date_picker">
 
31
  <td class="label">
32
  <label for=""><?php _e("Date format",'acf'); ?></label>
33
+ <p class="description"><?php _e("eg. dd/mm/yy. read more about",'acf'); ?> <a href="http://docs.jquery.com/UI/Datepicker/formatDate">formatDate</a></p>
34
  </td>
35
  <td>
36
  <input type="text" name="acf[fields][<?php echo $key; ?>][options][date_format]" id="" value="<?php echo $options['date_format']; ?>" />
 
37
  </td>
38
  </tr>
39
+
40
  <?php
41
  }
42
 
core/fields/file.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
 
3
- class File
4
  {
5
  var $name;
6
  var $title;
7
 
8
- function File()
9
  {
10
  $this->name = 'file';
11
  $this->title = __('File','acf');
1
  <?php
2
 
3
+ class acf_File
4
  {
5
  var $name;
6
  var $title;
7
 
8
+ function acf_File()
9
  {
10
  $this->name = 'file';
11
  $this->title = __('File','acf');
core/fields/image.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
 
3
- class Image
4
  {
5
  var $name;
6
  var $title;
7
 
8
- function Image()
9
  {
10
  $this->name = 'image';
11
  $this->title = __('Image','acf');
1
  <?php
2
 
3
+ class acf_Image
4
  {
5
  var $name;
6
  var $title;
7
 
8
+ function acf_Image()
9
  {
10
  $this->name = 'image';
11
  $this->title = __('Image','acf');
core/fields/page_link.php CHANGED
@@ -1,13 +1,12 @@
1
  <?php
2
 
3
- class Page_link
4
  {
5
  var $name;
6
  var $title;
7
  var $parent;
8
 
9
-
10
- function Page_link($parent)
11
  {
12
  $this->name = 'page_link';
13
  $this->title = __('Page Link','acf');
@@ -24,9 +23,9 @@ class Page_link
24
  *
25
  ---------------------------------------------------------------------------------------------*/
26
  function html($field)
27
- {
28
  // get post types
29
- if(is_array($field->options['post_type']))
30
  {
31
  // 1. If select has selected post types, just use them
32
  $post_types = $field->options['post_type'];
@@ -46,7 +45,7 @@ class Page_link
46
 
47
 
48
  // start select
49
- if($field->options['multiple'] == '1')
50
  {
51
  $name_extra = '[]';
52
  echo '<select id="'.$field->input_id.'" class="'.$field->input_class.'" name="'.$field->input_name.$name_extra.'" multiple="multiple" size="5" >';
@@ -129,14 +128,27 @@ class Page_link
129
  ---------------------------------------------------------------------------------------------*/
130
  function options_html($key, $options)
131
  {
 
 
 
 
 
 
 
 
 
132
  ?>
133
- <table class="acf_input">
134
- <tr>
135
  <td class="label">
136
  <label for=""><?php _e("Post Type",'acf'); ?></label>
 
 
137
  </td>
138
  <td>
139
  <?php
 
 
140
  foreach (get_post_types() as $post_type ) {
141
  $post_types[$post_type] = $post_type;
142
  }
@@ -158,13 +170,12 @@ class Page_link
158
  $this->parent->create_field($temp_field);
159
 
160
  ?>
161
- <p class="description"><?php _e("Filter posts by selecting a post type<br />
162
- Tip: deselect all post types to show all post type's posts",'acf'); ?></p>
163
  </td>
164
  </tr>
165
- <tr>
166
  <td class="label">
167
- <label><?php _e("Multiple?",'acf'); ?></label>
168
  </td>
169
  <td>
170
  <?php
@@ -174,46 +185,15 @@ class Page_link
174
  $temp_field->input_class = '';
175
  $temp_field->input_id = 'acf[fields]['.$key.'][options][multiple]';
176
  $temp_field->value = $options['multiple'];
177
- $temp_field->options = array('message' => 'Select multiple values');
178
  $this->parent->create_field($temp_field);
179
  ?>
180
  </td>
181
  </tr>
182
- </table>
183
  <?php
184
  }
185
 
186
 
187
- /*---------------------------------------------------------------------------------------------
188
- * Save Input
189
- * - this is called from save_input.php, this function saves the field's value(s)
190
- *
191
- * @author Elliot Condon
192
- * @since 1.1
193
- *
194
- ---------------------------------------------------------------------------------------------*/
195
- function save_input($post_id, $field)
196
- {
197
- // set table name
198
- global $wpdb;
199
- $table_name = $wpdb->prefix.'acf_values';
200
-
201
-
202
- // if select is a multiple, you need to save it as an array!
203
- if(is_array($field['value']))
204
- {
205
- $field['value'] = serialize($field['value']);
206
- }
207
-
208
-
209
- // insert new data
210
- $new_id = $wpdb->insert($table_name, array(
211
- 'post_id' => $post_id,
212
- 'field_id' => $field['field_id'],
213
- 'value' => $field['value']
214
- ));
215
- }
216
-
217
 
218
  /*---------------------------------------------------------------------------------------------
219
  * Format Value
@@ -253,14 +233,18 @@ class Page_link
253
  ---------------------------------------------------------------------------------------------*/
254
  function format_value_for_input($value)
255
  {
256
- if(is_array(unserialize($value)))
 
 
257
  {
258
- return(unserialize($value));
259
  }
260
  else
261
  {
262
  return $value;
263
  }
 
 
264
  }
265
 
266
 
1
  <?php
2
 
3
+ class acf_Page_link
4
  {
5
  var $name;
6
  var $title;
7
  var $parent;
8
 
9
+ function acf_Page_link($parent)
 
10
  {
11
  $this->name = 'page_link';
12
  $this->title = __('Page Link','acf');
23
  *
24
  ---------------------------------------------------------------------------------------------*/
25
  function html($field)
26
+ {
27
  // get post types
28
+ if(isset($field->options['post_type']) && is_array($field->options['post_type']) && $field->options['post_type'][0] != "")
29
  {
30
  // 1. If select has selected post types, just use them
31
  $post_types = $field->options['post_type'];
45
 
46
 
47
  // start select
48
+ if(isset($field->options["multiple"]) && $field->options["multiple"] == '1')
49
  {
50
  $name_extra = '[]';
51
  echo '<select id="'.$field->input_id.'" class="'.$field->input_class.'" name="'.$field->input_name.$name_extra.'" multiple="multiple" size="5" >';
128
  ---------------------------------------------------------------------------------------------*/
129
  function options_html($key, $options)
130
  {
131
+ if(!isset($options['post_type']))
132
+ {
133
+ $options['post_type'] = "";
134
+ }
135
+
136
+ if(!isset($options['multiple']))
137
+ {
138
+ $options['multiple'] = '0';
139
+ }
140
  ?>
141
+
142
+ <tr class="field_option field_option_page_link">
143
  <td class="label">
144
  <label for=""><?php _e("Post Type",'acf'); ?></label>
145
+ <p class="description"><?php _e("Filter posts by selecting a post type<br />
146
+ Tip: deselect all post types to show all post type's posts",'acf'); ?></p>
147
  </td>
148
  <td>
149
  <?php
150
+ $post_types = array('' => '-All-');
151
+
152
  foreach (get_post_types() as $post_type ) {
153
  $post_types[$post_type] = $post_type;
154
  }
170
  $this->parent->create_field($temp_field);
171
 
172
  ?>
173
+
 
174
  </td>
175
  </tr>
176
+ <tr class="field_option field_option_page_link">
177
  <td class="label">
178
+ <label><?php _e("Select multiple values?",'acf'); ?></label>
179
  </td>
180
  <td>
181
  <?php
185
  $temp_field->input_class = '';
186
  $temp_field->input_id = 'acf[fields]['.$key.'][options][multiple]';
187
  $temp_field->value = $options['multiple'];
188
+ $temp_field->options = array('message' => '');
189
  $this->parent->create_field($temp_field);
190
  ?>
191
  </td>
192
  </tr>
 
193
  <?php
194
  }
195
 
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
 
198
  /*---------------------------------------------------------------------------------------------
199
  * Format Value
233
  ---------------------------------------------------------------------------------------------*/
234
  function format_value_for_input($value)
235
  {
236
+ $is_array = @unserialize($value);
237
+
238
+ if($is_array)
239
  {
240
+ return unserialize($value);
241
  }
242
  else
243
  {
244
  return $value;
245
  }
246
+
247
+
248
  }
249
 
250
 
core/fields/post_object.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php
2
 
3
- class Post_object
4
  {
5
  var $name;
6
  var $title;
7
  var $parent;
8
 
9
- function Post_object($parent)
10
  {
11
  $this->name = 'post_object';
12
  $this->title = __("Post Object",'acf');
@@ -16,7 +16,7 @@ class Post_object
16
  function html($field)
17
  {
18
  // get post types
19
- if(is_array($field->options['post_type']))
20
  {
21
  // 1. If select has selected post types, just use them
22
  $post_types = $field->options['post_type'];
@@ -36,7 +36,7 @@ class Post_object
36
 
37
 
38
  // start select
39
- if($field->options['multiple'] == '1')
40
  {
41
  $name_extra = '[]';
42
  echo '<select id="'.$field->input_id.'" class="'.$field->input_class.'" name="'.$field->input_name.$name_extra.'" multiple="multiple" size="5" >';
@@ -116,14 +116,26 @@ class Post_object
116
  ---------------------------------------------------------------------------------------------*/
117
  function options_html($key, $options)
118
  {
 
 
 
 
 
 
 
 
 
119
  ?>
120
- <table class="acf_input">
121
- <tr>
122
  <td class="label">
123
  <label for=""><?php _e("Post Type",'acf'); ?></label>
 
 
124
  </td>
125
  <td>
126
  <?php
 
127
 
128
  foreach (get_post_types() as $post_type ) {
129
  $post_types[$post_type] = $post_type;
@@ -145,13 +157,12 @@ class Post_object
145
  $this->parent->create_field($temp_field);
146
 
147
  ?>
148
- <p class="description"><?php _e("Filter posts by selecting a post type<br />
149
- * unselecting all is the same as selecting all",'acf'); ?></p>
150
  </td>
151
  </tr>
152
- <tr>
153
  <td class="label">
154
- <label><?php _e("Multiple?",'acf'); ?></label>
155
  </td>
156
  <td>
157
  <?php
@@ -161,46 +172,17 @@ class Post_object
161
  $temp_field->input_class = '';
162
  $temp_field->input_id = 'acf[fields]['.$key.'][options][multiple]';
163
  $temp_field->value = $options['multiple'];
164
- $temp_field->options = array('message' => 'Select multiple posts');
165
  $this->parent->create_field($temp_field);
166
  ?>
167
  </td>
168
  </tr>
169
- </table>
170
  <?php
171
  }
172
 
173
 
174
 
175
- /*---------------------------------------------------------------------------------------------
176
- * Save Input
177
- * - this is called from save_input.php, this function saves the field's value(s)
178
- *
179
- * @author Elliot Condon
180
- * @since 1.1
181
- *
182
- ---------------------------------------------------------------------------------------------*/
183
- function save_input($post_id, $field)
184
- {
185
- // set table name
186
- global $wpdb;
187
- $table_name = $wpdb->prefix.'acf_values';
188
-
189
-
190
- // if select is a multiple, you need to save it as an array!
191
- if(is_array($field['value']))
192
- {
193
- $field['value'] = serialize($field['value']);
194
- }
195
-
196
-
197
- // insert new data
198
- $new_id = $wpdb->insert($table_name, array(
199
- 'post_id' => $post_id,
200
- 'field_id' => $field['field_id'],
201
- 'value' => $field['value']
202
- ));
203
- }
204
 
205
  /*---------------------------------------------------------------------------------------------
206
  * Format Value
@@ -240,9 +222,11 @@ class Post_object
240
  ---------------------------------------------------------------------------------------------*/
241
  function format_value_for_input($value)
242
  {
243
- if(is_array(unserialize($value)))
 
 
244
  {
245
- return(unserialize($value));
246
  }
247
  else
248
  {
1
  <?php
2
 
3
+ class acf_Post_object
4
  {
5
  var $name;
6
  var $title;
7
  var $parent;
8
 
9
+ function acf_Post_object($parent)
10
  {
11
  $this->name = 'post_object';
12
  $this->title = __("Post Object",'acf');
16
  function html($field)
17
  {
18
  // get post types
19
+ if(is_array($field->options['post_type']) && $field->options['post_type'][0] != "")
20
  {
21
  // 1. If select has selected post types, just use them
22
  $post_types = $field->options['post_type'];
36
 
37
 
38
  // start select
39
+ if(isset($field->options['multiple']) && $field->options['multiple'] == '1')
40
  {
41
  $name_extra = '[]';
42
  echo '<select id="'.$field->input_id.'" class="'.$field->input_class.'" name="'.$field->input_name.$name_extra.'" multiple="multiple" size="5" >';
116
  ---------------------------------------------------------------------------------------------*/
117
  function options_html($key, $options)
118
  {
119
+ if(!isset($options['post_type']))
120
+ {
121
+ $options['post_type'] = "";
122
+ }
123
+
124
+ if(!isset($options['multiple']))
125
+ {
126
+ $options['multiple'] = '0';
127
+ }
128
  ?>
129
+
130
+ <tr class="field_option field_option_post_object">
131
  <td class="label">
132
  <label for=""><?php _e("Post Type",'acf'); ?></label>
133
+ <p class="description"><?php _e("Filter posts by selecting a post type<br />
134
+ Tip: deselect all post types to show all post type's posts",'acf'); ?></p>
135
  </td>
136
  <td>
137
  <?php
138
+ $post_types = array('' => '-All-');
139
 
140
  foreach (get_post_types() as $post_type ) {
141
  $post_types[$post_type] = $post_type;
157
  $this->parent->create_field($temp_field);
158
 
159
  ?>
160
+
 
161
  </td>
162
  </tr>
163
+ <tr class="field_option field_option_post_object">
164
  <td class="label">
165
+ <label><?php _e("Select multiple posts?",'acf'); ?></label>
166
  </td>
167
  <td>
168
  <?php
172
  $temp_field->input_class = '';
173
  $temp_field->input_id = 'acf[fields]['.$key.'][options][multiple]';
174
  $temp_field->value = $options['multiple'];
175
+ $temp_field->options = array('message' => '');
176
  $this->parent->create_field($temp_field);
177
  ?>
178
  </td>
179
  </tr>
180
+
181
  <?php
182
  }
183
 
184
 
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
 
187
  /*---------------------------------------------------------------------------------------------
188
  * Format Value
222
  ---------------------------------------------------------------------------------------------*/
223
  function format_value_for_input($value)
224
  {
225
+ $is_array = @unserialize($value);
226
+
227
+ if($is_array)
228
  {
229
+ return unserialize($value);
230
  }
231
  else
232
  {
core/fields/repeater.php ADDED
@@ -0,0 +1,541 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class acf_Repeater
4
+ {
5
+ var $name;
6
+ var $title;
7
+ var $parent;
8
+
9
+
10
+ function acf_Repeater($parent)
11
+ {
12
+ $this->name = 'repeater';
13
+ $this->title = __("Repeater",'acf');
14
+ $this->parent = $parent;
15
+ }
16
+
17
+
18
+ function html($field)
19
+ {
20
+ $sub_fields = $field->options['sub_fields'];
21
+
22
+ if(isset($field->options['row_limit']) && $field->options['row_limit'] != "")
23
+ {
24
+ $row_limit = intval($field->options['row_limit']);
25
+ }
26
+ else
27
+ {
28
+ $row_limit = 999;
29
+ }
30
+
31
+
32
+ ?>
33
+ <div class="repeater">
34
+ <input type="hidden" name="row_limit" value="<?php echo $row_limit; ?>" />
35
+ <table class="">
36
+ <thead>
37
+ <tr>
38
+ <th class="order"><!-- order --></th>
39
+ <?php foreach($sub_fields as $sub_field):?>
40
+ <th class="<?php echo $sub_field->name; ?>"><span><?php echo $sub_field->label; ?></span></th>
41
+ <?php endforeach; ?>
42
+ <th class="remove"></th>
43
+ </tr>
44
+ </thead>
45
+ <tbody>
46
+ <?php foreach($field->value as $i => $value):?>
47
+ <?php if(($i+1) > $row_limit){continue;} ?>
48
+ <tr>
49
+ <td class="order">
50
+ <?php echo $i+1; ?>
51
+ </td>
52
+ <?php foreach($sub_fields as $j => $sub_field):?>
53
+
54
+ <td>
55
+
56
+ <input type="hidden" name="<?php echo $field->input_name.'['.$i.']['.$j.'][row_id]'; ?>" value="<?php echo $field->value[$i][$j]->id; ?>" />
57
+ <input type="hidden" name="<?php echo $field->input_name.'['.$i.']['.$j.'][field_id]'; ?>" value="<?php echo $sub_field->id; ?>" />
58
+ <input type="hidden" name="<?php echo $field->input_name.'['.$i.']['.$j.'][field_type]' ?>" value="<?php echo $sub_field->type; ?>" />
59
+
60
+ <?php
61
+ $temp_field = new stdClass();
62
+ $temp_field->type = $sub_field->type;
63
+ $temp_field->input_name = $field->input_name.'['.$i.']['.$j.'][value]';
64
+ $temp_field->input_id = $field->input_name.'['.$i.']['.$j.'][value]';
65
+ $temp_field->input_class = $sub_field->type;
66
+ $temp_field->options = $sub_field->options;
67
+ $temp_field->value = $field->value[$i][$j]->value;
68
+ $this->parent->create_field($temp_field);
69
+
70
+ ?>
71
+ </td>
72
+
73
+ <?php endforeach; ?>
74
+ <td class="remove"><a class="remove_field" href="javascript:;"></a></td>
75
+ </tr>
76
+ <?php endforeach; ?>
77
+ </tbody>
78
+ </table>
79
+ <?php if($row_limit > 1): ?>
80
+ <div class="table_footer">
81
+ <div class="order_message"></div>
82
+ <a href="javascript:;" id="add_field" class="button-primary">+ Add Field</a>
83
+ </div>
84
+ <?php endif; ?>
85
+ </div>
86
+ <?php
87
+ }
88
+
89
+
90
+ /*---------------------------------------------------------------------------------------------
91
+ * Options HTML
92
+ * - called from fields_meta_box.php
93
+ * - displays options in html format
94
+ *
95
+ * @author Elliot Condon
96
+ * @since 1.1
97
+ *
98
+ ---------------------------------------------------------------------------------------------*/
99
+ function options_html($key, $options)
100
+ {
101
+ if(isset($options['sub_fields']))
102
+ {
103
+ $fields = $options['sub_fields'];
104
+ }
105
+ else
106
+ {
107
+ $fields = array();
108
+ }
109
+
110
+
111
+
112
+
113
+ // add clone
114
+ $field = new stdClass();
115
+ $field->label = 'New Field';
116
+ $field->name = 'new_field';
117
+ $field->type = 'text';
118
+ $field->options = array();
119
+ $fields[999] = $field;
120
+
121
+
122
+ // get name of all fields for use in field type
123
+ $fields_names = array();
124
+ foreach($this->parent->fields as $field)
125
+ {
126
+ $fields_names[$field->name] = $field->title;
127
+ }
128
+ unset($fields_names['repeater']);
129
+
130
+ ?>
131
+ <tr class="field_option field_option_repeater">
132
+ <td class="label">
133
+ <label for=""><?php _e("Repeater Fields",'acf'); ?></label>
134
+ </td>
135
+ <td>
136
+ <div class="repeater">
137
+ <table class="acf">
138
+ <thead>
139
+ <tr>
140
+ <th class="field_order"><?php _e('Field Order','acf'); ?></th>
141
+ <th class="field_label"><?php _e('Field Label','acf'); ?></th>
142
+ <th class="field_name"><?php _e('Field Name','acf'); ?></th>
143
+ <th class="field_type"><?php _e('Field Type','acf'); ?></th>
144
+ </tr>
145
+ </thead>
146
+ </table>
147
+ <div class="fields">
148
+
149
+ <div class="no_fields_message" <?php if(sizeof($fields) > 1){ echo 'style="display:none;"'; } ?>>
150
+ No fields. Click the "Add Field" button to create your first field.
151
+ </div>
152
+
153
+
154
+ <?php foreach($fields as $key2 => $field): ?>
155
+ <div class="<?php if($key2 == 999){echo "field_clone";}else{echo "field";} ?> sub_field">
156
+
157
+ <input type="hidden" name="acf[fields][<?php echo $key; ?>][sub_fields][<?php echo $key2; ?>][id]'" value="<?php echo $field->id; ?>" />
158
+ <table class="acf">
159
+ <tr>
160
+ <td class="field_order"><?php echo ($key2+1); ?></td>
161
+ <td class="field_label">
162
+ <strong>
163
+ <a class="acf_edit_field" title="Edit this Field" href="javascript:;"><?php echo $field->label; ?></a>
164
+ </strong>
165
+ <div class="row_options">
166
+ <span><a class="acf_edit_field" title="Edit this Field" href="javascript:;">Edit</a> | </span>
167
+ <span><a class="acf_delete_field" title="Delete this Field" href="javascript:;">Delete</a>
168
+ </div>
169
+ </td>
170
+ <td class="field_name"><?php echo $field->name; ?></td>
171
+ <td class="field_type"><?php echo $field->type; ?></td>
172
+ </tr>
173
+ </table>
174
+
175
+ <div class="field_form_mask">
176
+ <div class="field_form">
177
+
178
+ <table class="acf_input">
179
+ <tbody>
180
+ <tr class="field_label">
181
+ <td class="label">
182
+ <label><span class="required">*</span>Field Label</label>
183
+ <p class="description">This is the name which will appear on the EDIT page</p>
184
+ </td>
185
+ <td>
186
+ <?php
187
+ $temp_field = new stdClass();
188
+
189
+ $temp_field->type = 'text';
190
+ $temp_field->input_name = 'acf[fields]['.$key.'][sub_fields]['.$key2.'][label]';
191
+ $temp_field->input_id = 'acf[fields]['.$key.'][sub_fields]['.$key2.'][label]';
192
+ $temp_field->input_class = 'label';
193
+ $temp_field->value = $field->label;
194
+
195
+ $this->parent->create_field($temp_field);
196
+
197
+ ?>
198
+
199
+ </td>
200
+ </tr>
201
+ <tr class="field_name">
202
+ <td class="label"><label><span class="required">*</span>Field Name</label>
203
+ <p class="description">Single word, no spaces. Underscores and dashes allowed</p>
204
+ </td>
205
+ <td>
206
+ <?php
207
+
208
+ $temp_field->type = 'text';
209
+ $temp_field->input_name = 'acf[fields]['.$key.'][sub_fields]['.$key2.'][name]';
210
+ $temp_field->input_id = 'acf[fields]['.$key.'][sub_fields]['.$key2.'][name]';
211
+ $temp_field->input_class = 'name';
212
+ $temp_field->value = $field->name;
213
+
214
+ $this->parent->create_field($temp_field);
215
+
216
+ ?>
217
+
218
+ </td>
219
+ </tr>
220
+ <tr class="field_type">
221
+ <td class="label"><label><span class="required">*</span>Field Type</label></td>
222
+ <td>
223
+ <?php
224
+
225
+ $temp_field->type = 'select';
226
+ $temp_field->input_name = 'acf[fields]['.$key.'][sub_fields]['.$key2.'][type]';
227
+ $temp_field->input_id = 'acf[fields]['.$key.'][sub_fields]['.$key2.'][type]';
228
+ $temp_field->input_class = 'type';
229
+ $temp_field->value = $field->type;
230
+ $temp_field->options = array('choices' => $fields_names);
231
+
232
+ $this->parent->create_field($temp_field);
233
+
234
+ ?>
235
+
236
+ </td>
237
+ </tr>
238
+ <?php foreach($fields_names as $field_name => $field_title): ?>
239
+ <?php if(method_exists($this->parent->fields[$field_name], 'options_html')): ?>
240
+
241
+ <?php $this->parent->fields[$field_name]->options_html($key.'][sub_fields]['.$key2, $field->options); ?>
242
+
243
+ <?php endif; ?>
244
+ <?php endforeach; ?>
245
+ <tr class="field_save">
246
+ <td class="label"><label>Save Field</label>
247
+ <p class="description">This will save your data and reload the page</p>
248
+ </td>
249
+ <td><input type="submit" value="Save Field" class="button-primary" name="save" />
250
+ or <a class="acf_edit_field" title="Hide this edit screen" href="javascript:;">continue editing ACF</a>
251
+ </td>
252
+
253
+ </tr>
254
+ </tbody>
255
+ </table>
256
+
257
+ </div><!-- End Form -->
258
+ </div><!-- End Form Mask -->
259
+
260
+ </div>
261
+ <?php endforeach; ?>
262
+ </div>
263
+ <div class="table_footer">
264
+ <!-- <div class="order_message"></div> -->
265
+ <a href="javascript:;" id="add_field" class="button-primary">+ Add Field</a>
266
+ </div>
267
+ </div>
268
+ </td>
269
+ </tr>
270
+ <tr class="field_option field_option_repeater">
271
+ <td class="label">
272
+ <label for="acf[fields][<?php echo $key; ?>][options][row_limit]"><?php _e("Row Limit",'acf'); ?></label>
273
+ </td>
274
+ <td>
275
+ <input type="text" name="acf[fields][<?php echo $key; ?>][options][row_limit]" id="acf[fields][<?php echo $key; ?>][options][row_limit]" value="<?php echo $options['row_limit']; ?>" />
276
+
277
+ </td>
278
+ </tr>
279
+ <?php
280
+ }
281
+
282
+
283
+
284
+ /*---------------------------------------------------------------------------------------------
285
+ * Save Field
286
+ * - called from fields_save.php
287
+ *
288
+ * @author Elliot Condon
289
+ * @since 1.1.5
290
+ *
291
+ ---------------------------------------------------------------------------------------------*/
292
+ function save_field($post_id, $parent_id, $field)
293
+ {
294
+ $i = 0;
295
+
296
+ // set table name
297
+ global $wpdb;
298
+ $table_name = $wpdb->prefix.'acf_fields';
299
+
300
+ //echo '<pre>';
301
+ //print_r($field);
302
+ //echo '</pre>';
303
+ //die;
304
+ if($field['sub_fields'])
305
+ {
306
+ foreach($field['sub_fields'] as $key => $field)
307
+ {
308
+ if($key == 999)
309
+ {
310
+ continue;
311
+ }
312
+
313
+ // format options if needed
314
+ if(method_exists($this->parent->fields[$field['type']], 'format_options'))
315
+ {
316
+ $field['options'] = $this->parent->fields[$field['type']]->format_options($field['options']);
317
+ }
318
+
319
+
320
+ // create data
321
+ $data = array(
322
+ 'order_no' => $i,
323
+ 'post_id' => $post_id,
324
+ 'parent_id' => $parent_id,
325
+ 'label' => $field['label'],
326
+ 'name' => $field['name'],
327
+ 'type' => $field['type'],
328
+ 'options' => serialize($field['options']),
329
+
330
+ );
331
+ // options does save. Choices is being overriden by other field options that use the same key name
332
+ // update js to disable all other options
333
+
334
+
335
+ // if there is an id, this field already exists, so save it in the same ID spot
336
+ if($field['id'])
337
+ {
338
+ $data['id'] = $field['id'];
339
+ }
340
+
341
+
342
+ // save field as row in database
343
+ $new_id = $wpdb->insert($table_name, $data);
344
+
345
+
346
+ // increase order_no
347
+ $i++;
348
+ }
349
+ }
350
+
351
+ }
352
+
353
+
354
+ /*---------------------------------------------------------------------------------------------
355
+ * save_input
356
+ * - called from input_save.php
357
+ *
358
+ * @author Elliot Condon
359
+ * @since 1.1.5
360
+ *
361
+ ---------------------------------------------------------------------------------------------*/
362
+ function save_input($post_id, $field)
363
+ {
364
+ //print_r($field);
365
+ //die;
366
+
367
+ // set table name
368
+ global $wpdb;
369
+ $table_name = $wpdb->prefix.'acf_values';
370
+
371
+
372
+ $field = stripslashes_deep( $field );
373
+
374
+
375
+ if($field['value'])
376
+ {
377
+ $i = 0;
378
+ foreach($field['value'] as $row)
379
+ {
380
+ // $i = row number
381
+ foreach($row as $j => $cell)
382
+ {
383
+
384
+ // if select is a multiple (multiple select value), you need to save it as an array!
385
+ if(isset($cell['value']))
386
+ {
387
+ if(is_array($cell['value']))
388
+ {
389
+ $cell['value'] = serialize($cell['value']);
390
+ }
391
+ }
392
+ else
393
+ {
394
+ $cell['value'] = "";
395
+ }
396
+
397
+
398
+ // $j = cell number
399
+ $data = array(
400
+ 'post_id' => $post_id,
401
+ 'field_id' => $cell['field_id'],
402
+ 'value' => $cell['value'],
403
+ 'order_no' => $i
404
+ );
405
+
406
+
407
+ // if there is an id, this value already exists, so save it in the same ID spot
408
+ if($cell['row_id'])
409
+ {
410
+ $data['id'] = $cell['row_id'];
411
+ }
412
+
413
+
414
+ // insert new data
415
+ $new_id = $wpdb->insert($table_name, $data);
416
+
417
+ }
418
+ //foreach($row as $j => $cell)
419
+
420
+ $i++;
421
+ }
422
+ //foreach($field['value'] as $i => $row)
423
+ }
424
+ //if($field['value'])
425
+ }
426
+
427
+ /*---------------------------------------------------------------------------------------------
428
+ * load_value_for_input
429
+ * - called from acf.php - load_value_for_input
430
+ *
431
+ * @author Elliot Condon
432
+ * @since 1.1.5
433
+ *
434
+ ---------------------------------------------------------------------------------------------*/
435
+ function load_value_for_input($post_id, $field)
436
+ {
437
+ $sub_fields = $field->options['sub_fields'];
438
+ $values = array();
439
+
440
+
441
+ // set table name
442
+ global $wpdb;
443
+ $table_name = $wpdb->prefix.'acf_values';
444
+
445
+
446
+ foreach($sub_fields as $sub_field)
447
+ {
448
+ // get var
449
+ $db_values = $wpdb->get_results("SELECT * FROM $table_name WHERE field_id = '$sub_field->id' AND post_id = '$post_id' ORDER BY order_no ASC");
450
+
451
+ if($db_values)
452
+ {
453
+ foreach($db_values as $db_value)
454
+ {
455
+
456
+ // format if needed
457
+ if(method_exists($this->parent->fields[$sub_field->type], 'format_value_for_input'))
458
+ {
459
+ $db_value->value = $this->parent->fields[$sub_field->type]->format_value_for_input($db_value->value);
460
+ }
461
+
462
+ $values[$db_value->order_no][$sub_field->order_no] = $db_value;
463
+ }
464
+
465
+ }
466
+ else
467
+ {
468
+ // $values[0][$sub_field->name] = "";
469
+ $value = new stdClass();
470
+ $value->value = "";
471
+ $values[0][$sub_field->order_no] = $value;
472
+ }
473
+
474
+ }
475
+
476
+ //print_r($values);
477
+ return $values;
478
+
479
+ }
480
+
481
+
482
+ /*---------------------------------------------------------------------------------------------
483
+ * load_value_for_api
484
+ * - called from acf.php - load_value_for_api
485
+ *
486
+ * @author Elliot Condon
487
+ * @since 1.1.5
488
+ *
489
+ ---------------------------------------------------------------------------------------------*/
490
+ function load_value_for_api($post_id, $field)
491
+ {
492
+ //echo '<pre>';
493
+ //print_r($field);
494
+ //echo '</pre>';
495
+ //die;
496
+
497
+
498
+ $sub_fields = $field->options['sub_fields'];
499
+ $values = array();
500
+
501
+
502
+ // set table name
503
+ global $wpdb;
504
+ $table_name = $wpdb->prefix.'acf_values';
505
+
506
+
507
+ foreach($sub_fields as $sub_field)
508
+ {
509
+ // get var
510
+ $db_values = $wpdb->get_results("SELECT value, order_no FROM $table_name WHERE field_id = '$sub_field->id' AND post_id = '$post_id' ORDER BY order_no ASC");
511
+
512
+ if($db_values)
513
+ {
514
+ foreach($db_values as $db_value)
515
+ {
516
+
517
+ $value = $db_value->value;
518
+ // format if needed
519
+ if(method_exists($this->parent->fields[$sub_field->type], 'format_value_for_api'))
520
+ {
521
+ $value = $this->parent->fields[$sub_field->type]->format_value_for_api($value);
522
+ }
523
+
524
+ //echo 'db order no = '.$db_value->order_no;
525
+ $values[$db_value->order_no][$sub_field->name] = $value;
526
+ }
527
+
528
+ }
529
+ else
530
+ {
531
+ $values[0][$sub_field->name] = "";
532
+ }
533
+
534
+ }
535
+
536
+
537
+ return $values;
538
+ }
539
+ }
540
+
541
+ ?>
core/fields/select.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php
2
 
3
- class Select
4
  {
5
  var $name;
6
  var $title;
7
  var $parent;
8
 
9
- function Select($parent)
10
  {
11
  $this->name = 'select';
12
  $this->title = __("Select",'acf');
@@ -15,7 +15,7 @@ class Select
15
 
16
  function html($field)
17
  {
18
- if($field->options['multiple'] == '1')
19
  {
20
  $name_extra = '[]';
21
  if(count($field->options['choices']) <= 1)
@@ -64,7 +64,7 @@ class Select
64
  function options_html($key, $options)
65
  {
66
  // implode selects so they work in a textarea
67
- if(!empty($options['choices']) && is_array($options['choices']))
68
  {
69
  foreach($options['choices'] as $choice_key => $choice_val)
70
  {
@@ -72,24 +72,39 @@ class Select
72
  }
73
  $options['choices'] = implode("\n", $options['choices']);
74
  }
 
 
 
 
 
 
 
 
 
75
 
76
  ?>
77
- <table class="acf_input">
78
- <tr>
79
  <td class="label">
80
  <label for=""><?php _e("Choices",'acf'); ?></label>
 
 
 
 
 
 
 
 
 
81
  </td>
82
  <td>
83
  <textarea rows="5" name="acf[fields][<?php echo $key; ?>][options][choices]" id=""><?php echo $options['choices']; ?></textarea>
84
- <p class="description"><?php _e("Enter your choices one per line. eg:<br />
85
- option_1 : Option 1<br />
86
- option_3 : Option 2<br />
87
- option_3 : Option 3",'acf'); ?></p>
88
  </td>
89
  </tr>
90
- <tr>
91
  <td class="label">
92
- <label><?php _e("Multiple?",'acf'); ?></label>
93
  </td>
94
  <td>
95
  <?php
@@ -99,46 +114,15 @@ class Select
99
  $temp_field->input_class = '';
100
  $temp_field->input_id = 'acf[fields]['.$key.'][options][multiple]';
101
  $temp_field->value = $options['multiple'];
102
- $temp_field->options = array('message' => 'Select multiple values');
103
  $this->parent->create_field($temp_field);
104
  ?>
105
  </td>
106
  </tr>
107
- </table>
108
  <?php
109
  }
110
-
111
-
112
- /*---------------------------------------------------------------------------------------------
113
- * Save Input
114
- * - this is called from save_input.php, this function saves the field's value(s)
115
- *
116
- * @author Elliot Condon
117
- * @since 1.1
118
- *
119
- ---------------------------------------------------------------------------------------------*/
120
- function save_input($post_id, $field)
121
- {
122
- // set table name
123
- global $wpdb;
124
- $table_name = $wpdb->prefix.'acf_values';
125
-
126
-
127
- // if select is a multiple, you need to save it as an array!
128
- if(is_array($field['value']))
129
- {
130
- $field['value'] = serialize($field['value']);
131
- }
132
-
133
 
134
- // insert new data
135
- $new_id = $wpdb->insert($table_name, array(
136
- 'post_id' => $post_id,
137
- 'field_id' => $field['field_id'],
138
- 'value' => $field['value']
139
- ));
140
- }
141
-
142
 
143
  /*---------------------------------------------------------------------------------------------
144
  * Format Options
@@ -218,9 +202,11 @@ class Select
218
  ---------------------------------------------------------------------------------------------*/
219
  function format_value_for_input($value)
220
  {
221
- if(is_array(unserialize($value)))
 
 
222
  {
223
- return(unserialize($value));
224
  }
225
  else
226
  {
1
  <?php
2
 
3
+ class acf_Select
4
  {
5
  var $name;
6
  var $title;
7
  var $parent;
8
 
9
+ function acf_Select($parent)
10
  {
11
  $this->name = 'select';
12
  $this->title = __("Select",'acf');
15
 
16
  function html($field)
17
  {
18
+ if(isset($field->options['multiple']) && $field->options['multiple'] == '1')
19
  {
20
  $name_extra = '[]';
21
  if(count($field->options['choices']) <= 1)
64
  function options_html($key, $options)
65
  {
66
  // implode selects so they work in a textarea
67
+ if(isset($options['choices']) && is_array($options['choices']))
68
  {
69
  foreach($options['choices'] as $choice_key => $choice_val)
70
  {
72
  }
73
  $options['choices'] = implode("\n", $options['choices']);
74
  }
75
+ else
76
+ {
77
+ $options['choices'] = "";
78
+ }
79
+
80
+ if(!isset($options['multiple']))
81
+ {
82
+ $options['multiple'] = '0';
83
+ }
84
 
85
  ?>
86
+
87
+ <tr class="field_option field_option_select">
88
  <td class="label">
89
  <label for=""><?php _e("Choices",'acf'); ?></label>
90
+ <p class="description"><?php _e("Enter your choices one per line<br />
91
+ <br />
92
+ Red<br />
93
+ Blue<br />
94
+ <br />
95
+ or<br />
96
+ <br />
97
+ red : Red<br />
98
+ blue : Blue",'acf'); ?></p>
99
  </td>
100
  <td>
101
  <textarea rows="5" name="acf[fields][<?php echo $key; ?>][options][choices]" id=""><?php echo $options['choices']; ?></textarea>
102
+ <p class="description"></p>
 
 
 
103
  </td>
104
  </tr>
105
+ <tr class="field_option field_option_select">
106
  <td class="label">
107
+ <label><?php _e("Select multiple values?",'acf'); ?></label>
108
  </td>
109
  <td>
110
  <?php
114
  $temp_field->input_class = '';
115
  $temp_field->input_id = 'acf[fields]['.$key.'][options][multiple]';
116
  $temp_field->value = $options['multiple'];
117
+ $temp_field->options = array('message' => '');
118
  $this->parent->create_field($temp_field);
119
  ?>
120
  </td>
121
  </tr>
122
+
123
  <?php
124
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
 
 
 
 
 
 
 
 
126
 
127
  /*---------------------------------------------------------------------------------------------
128
  * Format Options
202
  ---------------------------------------------------------------------------------------------*/
203
  function format_value_for_input($value)
204
  {
205
+ $is_array = @unserialize($value);
206
+
207
+ if($is_array)
208
  {
209
+ return unserialize($value);
210
  }
211
  else
212
  {
core/fields/text.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
 
3
- class Text
4
  {
5
  var $name;
6
  var $title;
7
 
8
- function Text()
9
  {
10
  $this->name = 'text';
11
  $this->title = __("Text",'acf');
@@ -17,9 +17,8 @@ class Text
17
  }
18
 
19
  function format_value_for_input($value)
20
- {
21
- $value = htmlspecialchars($value, ENT_QUOTES);
22
- return $value;
23
  }
24
 
25
  }
1
  <?php
2
 
3
+ class acf_Text
4
  {
5
  var $name;
6
  var $title;
7
 
8
+ function acf_Text()
9
  {
10
  $this->name = 'text';
11
  $this->title = __("Text",'acf');
17
  }
18
 
19
  function format_value_for_input($value)
20
+ {
21
+ return htmlspecialchars($value, ENT_QUOTES);
 
22
  }
23
 
24
  }
core/fields/textarea.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
 
3
- class Textarea
4
  {
5
  var $name;
6
  var $title;
7
 
8
- function Textarea()
9
  {
10
  $this->name = 'textarea';
11
  $this->title = __("Text Area",'acf');
1
  <?php
2
 
3
+ class acf_Textarea
4
  {
5
  var $name;
6
  var $title;
7
 
8
+ function acf_Textarea()
9
  {
10
  $this->name = 'textarea';
11
  $this->title = __("Text Area",'acf');
core/fields/true_false.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
 
3
- class True_false
4
  {
5
  var $name;
6
  var $title;
7
 
8
- function True_false()
9
  {
10
  $this->name = 'true_false';
11
  $this->title = __("True / False",'acf');
@@ -16,7 +16,7 @@ class True_false
16
  // set default message
17
  if(empty($field->options['message']))
18
  {
19
- $field->options['message'] = __("True",'acf');
20
  }
21
 
22
  // set choices
@@ -53,18 +53,23 @@ class True_false
53
  ---------------------------------------------------------------------------------------------*/
54
  function options_html($key, $options)
55
  {
 
 
 
 
56
  ?>
57
- <table class="acf_input">
58
- <tr>
59
  <td class="label">
60
  <label for="acf[fields][<?php echo $key; ?>][options][message]"><?php _e("Message",'acf'); ?></label>
 
61
  </td>
62
  <td>
63
  <input type="text" name="acf[fields][<?php echo $key; ?>][options][message]" id="acf[fields][<?php echo $key; ?>][options][message]" value="<?php echo $options['message']; ?>" />
64
- <p class="description"><?php _e("eg. Show extra content",'acf'); ?></a></p>
65
  </td>
66
  </tr>
67
- </table>
68
  <?php
69
  }
70
 
1
  <?php
2
 
3
+ class acf_True_false
4
  {
5
  var $name;
6
  var $title;
7
 
8
+ function acf_True_false()
9
  {
10
  $this->name = 'true_false';
11
  $this->title = __("True / False",'acf');
16
  // set default message
17
  if(empty($field->options['message']))
18
  {
19
+ $field->options['message'] = "";
20
  }
21
 
22
  // set choices
53
  ---------------------------------------------------------------------------------------------*/
54
  function options_html($key, $options)
55
  {
56
+ if(!isset($options['message']))
57
+ {
58
+ $options['message'] = "";
59
+ }
60
  ?>
61
+
62
+ <tr class="field_option field_option_true_false">
63
  <td class="label">
64
  <label for="acf[fields][<?php echo $key; ?>][options][message]"><?php _e("Message",'acf'); ?></label>
65
+ <p class="description"><?php _e("eg. Show extra content",'acf'); ?></a></p>
66
  </td>
67
  <td>
68
  <input type="text" name="acf[fields][<?php echo $key; ?>][options][message]" id="acf[fields][<?php echo $key; ?>][options][message]" value="<?php echo $options['message']; ?>" />
69
+
70
  </td>
71
  </tr>
72
+
73
  <?php
74
  }
75
 
core/fields/wysiwyg.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
 
3
- class Wysiwyg
4
  {
5
  var $name;
6
  var $title;
7
 
8
- function Wysiwyg()
9
  {
10
  $this->name = 'wysiwyg';
11
  $this->title = __("Wysiwyg Editor",'acf');
1
  <?php
2
 
3
+ class acf_Wysiwyg
4
  {
5
  var $name;
6
  var $title;
7
 
8
+ function acf_Wysiwyg()
9
  {
10
  $this->name = 'wysiwyg';
11
  $this->title = __("Wysiwyg Editor",'acf');
core/fields_meta_box.php CHANGED
@@ -4,97 +4,167 @@
4
  global $post;
5
  $fields = $this->get_fields($post->ID);
6
 
 
 
 
 
 
 
 
 
7
 
 
8
  // get name of all fields for use in field type drop down
9
  $fields_names = array();
10
  foreach($this->fields as $field)
11
  {
12
  $fields_names[$field->name] = $field->title;
13
  }
14
-
15
  ?>
 
16
  <input type="hidden" name="fields_meta_box" value="true" />
17
  <input type="hidden" name="total_fields" value="<?php echo count($fields); ?>" />
18
  <input type="hidden" name="fields_limit" value="99" />
19
 
20
  <input type="hidden" name="ei_noncename" id="ei_noncename" value="<?php echo wp_create_nonce('ei-n'); ?>" />
21
 
22
- <div class="fields_heading">
23
- <table class="acf">
 
24
  <tr>
25
- <th class="order"><!-- Order --></th>
26
- <th class="label"><?php _e('Label','acf'); ?><br /><span><?php _e('Shown on the edit page (eg. Hero Image)','acf'); ?></span></th>
27
- <th class="name"><?php _e('Name','acf'); ?><br /><span><?php _e('Used as variable name (eg. hero_image)','acf'); ?></span></th>
28
- <th class="type"><?php _e('Field Type','acf'); ?><br /><span><?php _e('Type of field','acf'); ?></span></th>
29
- <th class="blank"></th>
30
- <th class="remove"><!-- Remove --></th>
31
  </tr>
32
- </table>
33
- </div>
34
  <div class="fields">
 
 
 
 
 
35
  <?php foreach($fields as $key => $field): ?>
36
- <div class="field">
37
-
38
  <input type="hidden" name="acf[fields][<?php echo $key; ?>][id]'" value="<?php echo $field->id; ?>" />
39
- <?php $temp_field = new stdClass(); ?>
40
 
41
  <table class="acf">
42
  <tr>
43
- <td class="order"><?php echo ($key+1); ?></td>
44
- <td class="label">
45
- <?php
46
-
47
- $temp_field->type = 'text';
48
- $temp_field->input_name = 'acf[fields]['.$key.'][label]';
49
- $temp_field->input_class = 'label';
50
- $temp_field->value = $field->label;
51
-
52
- $this->create_field($temp_field);
53
 
54
- ?>
 
 
 
 
 
 
 
55
  </td>
56
- <td class="name">
57
- <?php
58
-
59
- $temp_field->type = 'text';
60
- $temp_field->input_name = 'acf[fields]['.$key.'][name]';
61
- $temp_field->input_class = 'name';
62
- $temp_field->value = $field->name;
63
-
64
- $this->create_field($temp_field);
65
 
66
- ?>
67
  </td>
68
- <td class="type">
69
- <?php
70
-
71
- $temp_field->type = 'select';
72
- $temp_field->input_name = 'acf[fields]['.$key.'][type]';
73
- $temp_field->input_class = 'type';
74
- $temp_field->value = $field->type;
75
- $temp_field->options = array('choices' => $fields_names);
76
-
77
- $this->create_field($temp_field);
78
 
79
- ?>
80
  </td>
81
- <td class="blank"></td>
82
- <td class="remove"><a href="javascript:;" class="remove_field"></a></td>
83
  </tr>
84
  </table>
85
 
86
- <div class="field_options">
87
- <?php foreach($fields_names as $field_name => $field_title): ?>
88
- <?php if(method_exists($this->fields[$field_name], 'options_html')): ?>
89
- <div class="field_option" id="<?php echo $field_name; ?>">
90
- <?php $this->fields[$field_name]->options_html($key, $field->options); ?>
91
- </div>
92
- <?php endif; ?>
93
- <?php endforeach; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  </div>
95
-
 
96
  </div>
97
  <?php endforeach; ?>
 
 
98
  </div>
99
 
100
  <div class="table_footer">
4
  global $post;
5
  $fields = $this->get_fields($post->ID);
6
 
7
+
8
+ // add clone
9
+ $field = new stdClass();
10
+ $field->label = 'New Field';
11
+ $field->name = 'new_field';
12
+ $field->type = 'text';
13
+ $field->options = array();
14
+ $fields[999] = $field;
15
 
16
+
17
  // get name of all fields for use in field type drop down
18
  $fields_names = array();
19
  foreach($this->fields as $field)
20
  {
21
  $fields_names[$field->name] = $field->title;
22
  }
23
+
24
  ?>
25
+
26
  <input type="hidden" name="fields_meta_box" value="true" />
27
  <input type="hidden" name="total_fields" value="<?php echo count($fields); ?>" />
28
  <input type="hidden" name="fields_limit" value="99" />
29
 
30
  <input type="hidden" name="ei_noncename" id="ei_noncename" value="<?php echo wp_create_nonce('ei-n'); ?>" />
31
 
32
+
33
+ <table class="acf">
34
+ <thead>
35
  <tr>
36
+ <th class="field_order"><?php _e('Field Order','acf'); ?></th>
37
+ <th class="field_label"><?php _e('Field Label','acf'); ?></th>
38
+ <th class="field_name"><?php _e('Field Name','acf'); ?></th>
39
+ <th class="field_type"><?php _e('Field Type','acf'); ?></th>
 
 
40
  </tr>
41
+ </thead>
42
+ </table>
43
  <div class="fields">
44
+
45
+ <div class="no_fields_message" <?php if(sizeof($fields) > 1){ echo 'style="display:none;"'; } ?>>
46
+ No fields. Click the "Add Field" button to create your first field.
47
+ </div>
48
+
49
  <?php foreach($fields as $key => $field): ?>
50
+ <div class="<?php if($key == 999){echo "field_clone";}else{echo "field";} ?>">
 
51
  <input type="hidden" name="acf[fields][<?php echo $key; ?>][id]'" value="<?php echo $field->id; ?>" />
 
52
 
53
  <table class="acf">
54
  <tr>
55
+ <td class="field_order"><?php echo ($key+1); ?></td>
56
+ <td class="field_label">
 
 
 
 
 
 
 
 
57
 
58
+ <strong>
59
+ <a class="acf_edit_field" title="Edit this Field" href="javascript:;"><?php echo $field->label; ?></a>
60
+ </strong>
61
+ <div class="row_options">
62
+ <span><a class="acf_edit_field" title="Edit this Field" href="javascript:;">Edit</a> | </span>
63
+ <span><a class="acf_delete_field" title="Delete this Field" href="javascript:;">Delete</a>
64
+ </div>
65
+
66
  </td>
67
+ <td class="field_name">
68
+
69
+ <?php echo $field->name; ?>
 
 
 
 
 
 
70
 
 
71
  </td>
72
+ <td class="field_type">
73
+
74
+ <?php echo $field->type; ?>
 
 
 
 
 
 
 
75
 
 
76
  </td>
 
 
77
  </tr>
78
  </table>
79
 
80
+ <div class="field_form_mask">
81
+ <div class="field_form">
82
+
83
+ <table class="acf_input">
84
+ <tbody>
85
+ <tr class="field_label">
86
+ <td class="label">
87
+ <label><span class="required">*</span>Field Label</label>
88
+ <p class="description">This is the name which will appear on the EDIT page</p>
89
+ </td>
90
+ <td>
91
+ <?php
92
+ $temp_field = new stdClass();
93
+
94
+ $temp_field->type = 'text';
95
+ $temp_field->input_name = 'acf[fields]['.$key.'][label]';
96
+ $temp_field->input_id = 'acf[fields]['.$key.'][label]';
97
+ $temp_field->input_class = 'label';
98
+ $temp_field->value = $field->label;
99
+
100
+ $this->create_field($temp_field);
101
+
102
+ ?>
103
+
104
+ </td>
105
+ </tr>
106
+ <tr class="field_name">
107
+ <td class="label"><label><span class="required">*</span>Field Name</label>
108
+ <p class="description">Single word, no spaces. Underscores and dashes allowed</p>
109
+ </td>
110
+ <td>
111
+ <?php
112
+
113
+ $temp_field->type = 'text';
114
+ $temp_field->input_name = 'acf[fields]['.$key.'][name]';
115
+ $temp_field->input_id = 'acf[fields]['.$key.'][name]';
116
+ $temp_field->input_class = 'name';
117
+ $temp_field->value = $field->name;
118
+
119
+ $this->create_field($temp_field);
120
+
121
+ ?>
122
+
123
+ </td>
124
+ </tr>
125
+ <tr class="field_type">
126
+ <td class="label"><label><span class="required">*</span>Field Type</label></td>
127
+ <td>
128
+ <?php
129
+
130
+ $temp_field->type = 'select';
131
+ $temp_field->input_name = 'acf[fields]['.$key.'][type]';
132
+ $temp_field->input_id = 'acf[fields]['.$key.'][type]';
133
+ $temp_field->input_class = 'type';
134
+ $temp_field->value = $field->type;
135
+ $temp_field->options = array('choices' => $fields_names);
136
+
137
+ $this->create_field($temp_field);
138
+
139
+ ?>
140
+ </td>
141
+ </tr>
142
+ <?php foreach($fields_names as $field_name => $field_title): ?>
143
+ <?php if(method_exists($this->fields[$field_name], 'options_html')): ?>
144
+
145
+ <?php $this->fields[$field_name]->options_html($key, $field->options); ?>
146
+
147
+ <?php endif; ?>
148
+ <?php endforeach; ?>
149
+ <tr class="field_save">
150
+ <td class="label"><label>Save Field</label>
151
+ <p class="description">This will save your data and reload the page</p>
152
+ </td>
153
+ <td><input type="submit" value="Save Field" class="button-primary" name="save" />
154
+ or <a class="acf_edit_field" title="Hide this edit screen" href="javascript:;">continue editing ACF</a>
155
+ </td>
156
+
157
+ </tr>
158
+ </tbody>
159
+ </table>
160
+
161
  </div>
162
+ </div>
163
+
164
  </div>
165
  <?php endforeach; ?>
166
+
167
+
168
  </div>
169
 
170
  <div class="table_footer">
core/fields_save.php CHANGED
@@ -2,8 +2,15 @@
2
  /*---------------------------------------------------------------------------------------------
3
  Save Fields Meta Box
4
  ---------------------------------------------------------------------------------------------*/
5
- if($_POST['fields_meta_box'] == 'true')
6
  {
 
 
 
 
 
 
 
7
  // set table name
8
  global $wpdb;
9
  $table_name = $wpdb->prefix.'acf_fields';
@@ -15,9 +22,18 @@ if($_POST['fields_meta_box'] == 'true')
15
 
16
  // loop through fields and save them
17
  $i = 0;
18
- foreach($_POST['acf']['fields'] as $field)
19
  {
20
-
 
 
 
 
 
 
 
 
 
21
 
22
  // format options if needed
23
  if(method_exists($this->fields[$field['type']], 'format_options'))
@@ -46,7 +62,24 @@ if($_POST['fields_meta_box'] == 'true')
46
 
47
 
48
  // save field as row in database
49
- $new_id = $wpdb->insert($table_name, $data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
 
52
  // increase order_no
2
  /*---------------------------------------------------------------------------------------------
3
  Save Fields Meta Box
4
  ---------------------------------------------------------------------------------------------*/
5
+ if(isset($_POST['fields_meta_box']) && $_POST['fields_meta_box'] == 'true')
6
  {
7
+
8
+ //echo '<pre>';
9
+ //print_r($_POST['acf']);
10
+ //echo '</pre>';
11
+ //die;
12
+
13
+
14
  // set table name
15
  global $wpdb;
16
  $table_name = $wpdb->prefix.'acf_fields';
22
 
23
  // loop through fields and save them
24
  $i = 0;
25
+ foreach($_POST['acf']['fields'] as $key => $field)
26
  {
27
+
28
+ if($key == 999)
29
+ {
30
+ continue;
31
+ }
32
+
33
+
34
+ // clean field
35
+ $field = stripslashes_deep($field);
36
+
37
 
38
  // format options if needed
39
  if(method_exists($this->fields[$field['type']], 'format_options'))
62
 
63
 
64
  // save field as row in database
65
+ $wpdb->insert($table_name, $data);
66
+
67
+
68
+ // save field if needed (used to save sub fields)
69
+ if(method_exists($this->fields[$field['type']], 'save_field'))
70
+ {
71
+ if($field['id'])
72
+ {
73
+ $parent_id = $field['id'];
74
+ }
75
+ else
76
+ {
77
+ $parent_id = $wpdb->insert_id;
78
+ }
79
+
80
+
81
+ $this->fields[$field['type']]->save_field($post_id, $parent_id, $field);
82
+ }
83
 
84
 
85
  // increase order_no
core/input_meta_box.php CHANGED
@@ -42,7 +42,7 @@ if(!in_array('the_content',$adv_options->show_on_page)): ?>
42
  <input type="hidden" name="show_<?php echo $option; ?>" value="true" />
43
  <?php endforeach; ?>
44
 
45
- <table class="acf_input" id="acf_input">
46
  <?php $i = -1; ?>
47
  <?php foreach($fields as $field): $i++ ?>
48
  <?php
@@ -53,24 +53,23 @@ if(!in_array('the_content',$adv_options->show_on_page)): ?>
53
  continue;
54
  }
55
 
56
-
57
-
58
  // set value, id and name for field
59
- $field->value = $this->load_value_for_input($post->ID, $field);
60
- $field->row_id = $this->load_row_id_for_input($post->ID, $field->id);
 
61
  $field->input_id = 'acf['.$i.'][value]';
62
  $field->input_name = 'acf['.$i.'][value]';
 
63
 
64
  ?>
65
- <tr>
66
- <td>
67
- <input type="hidden" name="acf[<?php echo $i; ?>][row_id]" value="<?php echo $field->row_id; ?>" />
68
- <input type="hidden" name="acf[<?php echo $i; ?>][field_id]" value="<?php echo $field->id; ?>" />
69
- <input type="hidden" name="acf[<?php echo $i; ?>][field_type]" value="<?php echo $field->type; ?>" />
70
-
71
- <label for="<?php echo $field->input_id ?>"><?php echo $field->label ?></label>
72
- <?php $this->create_field($field); ?>
73
- </td>
74
- </tr>
75
  <?php endforeach; ?>
76
- </table>
42
  <input type="hidden" name="show_<?php echo $option; ?>" value="true" />
43
  <?php endforeach; ?>
44
 
45
+ <div class="acf_fields_input">
46
  <?php $i = -1; ?>
47
  <?php foreach($fields as $field): $i++ ?>
48
  <?php
53
  continue;
54
  }
55
 
56
+
 
57
  // set value, id and name for field
58
+ $value = $this->load_value_for_input($post->ID, $field);
59
+
60
+ $field->value = $value;
61
  $field->input_id = 'acf['.$i.'][value]';
62
  $field->input_name = 'acf['.$i.'][value]';
63
+ $field->input_class = '';
64
 
65
  ?>
66
+ <div class="field">
67
+ <?php //print_r($value); ?>
68
+ <input type="hidden" name="acf[<?php echo $i; ?>][field_id]" value="<?php echo $field->id; ?>" />
69
+ <input type="hidden" name="acf[<?php echo $i; ?>][field_type]" value="<?php echo $field->type; ?>" />
70
+
71
+ <label for="<?php echo $field->input_id ?>"><?php echo $field->label ?></label>
72
+ <?php $this->create_field($field); ?>
73
+ </div>
 
 
74
  <?php endforeach; ?>
75
+ </div>
core/input_save.php CHANGED
@@ -30,6 +30,15 @@ if($_POST['input_meta_box'] == 'true')
30
  //$field = apply_filters('wp_insert_post_data', $field);
31
  $field = stripslashes_deep( $field );
32
 
 
 
 
 
 
 
 
 
 
33
  $data = array(
34
  'post_id' => $post_id,
35
  'field_id' => $field['field_id'],
30
  //$field = apply_filters('wp_insert_post_data', $field);
31
  $field = stripslashes_deep( $field );
32
 
33
+
34
+ // if select is a multiple (multiple select value), you need to save it as an array!
35
+ if(is_array($field['value']))
36
+ {
37
+ $field['value'] = serialize($field['value']);
38
+ }
39
+
40
+
41
+ // create data object to save
42
  $data = array(
43
  'post_id' => $post_id,
44
  'field_id' => $field['field_id'],
core/location_meta_box.php CHANGED
@@ -30,6 +30,7 @@
30
  <tr>
31
  <td class="label">
32
  <label for="post_type"><?php _e("Post Type's",'acf'); ?></label>
 
33
  </td>
34
  <td>
35
  <?php
@@ -58,12 +59,13 @@
58
  $this->create_field($temp_field);
59
 
60
  ?>
61
- <p class="description"><?php _e("Selecting a post type here will add this ACF to <strong>all</strong> edit screens of that post type.<br />(if your custom post type does not appear, make sure it is publicly query-able)",'acf'); ?></p>
62
  </td>
63
  </tr>
64
  <tr>
65
  <td class="label">
66
  <label for="page_title"><?php _e("Page Title's",'acf'); ?></label>
 
67
  </td>
68
  <td>
69
  <?php
@@ -78,12 +80,13 @@
78
  $this->create_field($temp_field);
79
 
80
  ?>
81
- <p class="description"><?php _e("eg. Home, About Us",'acf'); ?></p>
82
  </td>
83
  </tr>
84
  <tr>
85
  <td class="label">
86
  <label for="page_slug"><?php _e("Page Slug's",'acf'); ?></label>
 
87
  </td>
88
  <td>
89
  <?php
@@ -98,12 +101,13 @@
98
  $this->create_field($temp_field);
99
 
100
  ?>
101
- <p class="description"><?php _e("eg. home, about-us",'acf'); ?></p>
102
  </td>
103
  </tr>
104
  <tr>
105
  <td class="label">
106
  <label for="post_id"><?php _e("Post ID's",'acf'); ?></label>
 
107
  </td>
108
  <td>
109
  <?php
@@ -118,12 +122,13 @@
118
  $this->create_field($temp_field);
119
 
120
  ?>
121
- <p class="description"><?php _e("eg. 1, 2, 3",'acf'); ?></p>
122
  </td>
123
  </tr>
124
  <tr>
125
  <td class="label">
126
  <label for="template_name"><?php _e("Page Template's",'acf'); ?></label>
 
127
  </td>
128
  <td>
129
  <?php
@@ -138,12 +143,13 @@
138
  $this->create_field($temp_field);
139
 
140
  ?>
141
- <p class="description"><?php _e("eg. home_page.php",'acf'); ?></p>
142
  </td>
143
  </tr>
144
  <tr>
145
  <td class="label">
146
  <label for="page_parent"><?php _e("Page Parent ID's",'acf'); ?></label>
 
147
  </td>
148
  <td>
149
  <?php
@@ -158,12 +164,13 @@
158
  $this->create_field($temp_field);
159
 
160
  ?>
161
- <p class="description"><?php _e("eg. 1, 2, 3",'acf'); ?></p>
162
  </td>
163
  </tr>
164
  <tr>
165
  <td class="label">
166
  <label for="category_names"><?php _e("Category Names's",'acf'); ?></label>
 
167
  </td>
168
  <td>
169
  <?php
@@ -178,12 +185,13 @@
178
  $this->create_field($temp_field);
179
 
180
  ?>
181
- <p class="description"><?php _e("eg. News, Media, Uncategoriazed",'acf'); ?></p>
182
  </td>
183
  </tr>
184
  <tr>
185
  <td class="label">
186
  <label for="page_parent"><?php _e("Overrides",'acf'); ?></label>
 
187
  </td>
188
  <td>
189
  <?php
@@ -200,7 +208,7 @@
200
  $this->create_field($temp_field);
201
 
202
  ?>
203
- <p class="description"><?php _e("Tick this box to remove all other ACF's <br />(from the edit screen where this ACF appears)",'acf'); ?></p>
204
  </td>
205
  </tr>
206
  </table>
30
  <tr>
31
  <td class="label">
32
  <label for="post_type"><?php _e("Post Type's",'acf'); ?></label>
33
+ <p class="description"><?php _e("Selecting a post type here will add this ACF to <strong>all</strong> edit screens of that post type.",'acf'); ?></p>
34
  </td>
35
  <td>
36
  <?php
59
  $this->create_field($temp_field);
60
 
61
  ?>
62
+
63
  </td>
64
  </tr>
65
  <tr>
66
  <td class="label">
67
  <label for="page_title"><?php _e("Page Title's",'acf'); ?></label>
68
+ <p class="description"><?php _e("eg. Home, About Us",'acf'); ?></p>
69
  </td>
70
  <td>
71
  <?php
80
  $this->create_field($temp_field);
81
 
82
  ?>
83
+
84
  </td>
85
  </tr>
86
  <tr>
87
  <td class="label">
88
  <label for="page_slug"><?php _e("Page Slug's",'acf'); ?></label>
89
+ <p class="description"><?php _e("eg. home, about-us",'acf'); ?></p>
90
  </td>
91
  <td>
92
  <?php
101
  $this->create_field($temp_field);
102
 
103
  ?>
104
+
105
  </td>
106
  </tr>
107
  <tr>
108
  <td class="label">
109
  <label for="post_id"><?php _e("Post ID's",'acf'); ?></label>
110
+ <p class="description"><?php _e("eg. 1, 2, 3",'acf'); ?></p>
111
  </td>
112
  <td>
113
  <?php
122
  $this->create_field($temp_field);
123
 
124
  ?>
125
+
126
  </td>
127
  </tr>
128
  <tr>
129
  <td class="label">
130
  <label for="template_name"><?php _e("Page Template's",'acf'); ?></label>
131
+ <p class="description"><?php _e("eg. home_page.php",'acf'); ?></p>
132
  </td>
133
  <td>
134
  <?php
143
  $this->create_field($temp_field);
144
 
145
  ?>
146
+
147
  </td>
148
  </tr>
149
  <tr>
150
  <td class="label">
151
  <label for="page_parent"><?php _e("Page Parent ID's",'acf'); ?></label>
152
+ <p class="description"><?php _e("eg. 1, 2, 3",'acf'); ?></p>
153
  </td>
154
  <td>
155
  <?php
164
  $this->create_field($temp_field);
165
 
166
  ?>
167
+
168
  </td>
169
  </tr>
170
  <tr>
171
  <td class="label">
172
  <label for="category_names"><?php _e("Category Names's",'acf'); ?></label>
173
+ <p class="description"><?php _e("eg. News, Media, Uncategoriazed",'acf'); ?></p>
174
  </td>
175
  <td>
176
  <?php
185
  $this->create_field($temp_field);
186
 
187
  ?>
188
+
189
  </td>
190
  </tr>
191
  <tr>
192
  <td class="label">
193
  <label for="page_parent"><?php _e("Overrides",'acf'); ?></label>
194
+ <p class="description"><?php _e("Tick this box to remove all other ACF's (from the edit screen where this ACF appears)",'acf'); ?></p>
195
  </td>
196
  <td>
197
  <?php
208
  $this->create_field($temp_field);
209
 
210
  ?>
211
+
212
  </td>
213
  </tr>
214
  </table>
core/location_save.php CHANGED
@@ -2,7 +2,7 @@
2
  /*---------------------------------------------------------------------------------------------
3
  Fields Meta Box
4
  ---------------------------------------------------------------------------------------------*/
5
- if($_POST['location_meta_box'] == 'true')
6
  {
7
  // set table name
8
  global $wpdb;
2
  /*---------------------------------------------------------------------------------------------
3
  Fields Meta Box
4
  ---------------------------------------------------------------------------------------------*/
5
+ if(isset($_POST['location_meta_box']) && $_POST['location_meta_box'] == 'true')
6
  {
7
  // set table name
8
  global $wpdb;
core/options_save.php CHANGED
@@ -2,7 +2,7 @@
2
  /*---------------------------------------------------------------------------------------------
3
  Fields Meta Box
4
  ---------------------------------------------------------------------------------------------*/
5
- if($_POST['options_meta_box'] == 'true')
6
  {
7
  // set table name
8
  global $wpdb;
2
  /*---------------------------------------------------------------------------------------------
3
  Fields Meta Box
4
  ---------------------------------------------------------------------------------------------*/
5
+ if(isset($_POST['options_meta_box']) && $_POST['options_meta_box'] == 'true')
6
  {
7
  // set table name
8
  global $wpdb;
core/{info_meta_box.php → screen_extra.php} RENAMED
@@ -1,4 +1,63 @@
1
- <div class="cfm_col_right hidden metabox-holder" id="poststuff" >
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  <div class="postbox">
4
  <div title="Click to toggle" class="handlediv"><br></div>
@@ -6,6 +65,8 @@
6
  <a class="thickbox button" href="http://localhost:8888/acf/wp-admin/plugin-install.php?tab=plugin-information&amp;plugin=advanced-custom-fields&amp;section=changelog&amp;TB_iframe=true&amp;width=640&amp;height=570"><?php _e("see what's new",'acf'); ?></a>
7
  </h3>
8
  <div class="inside">
 
 
9
  <table cellpadding="0" cellspacing="0" class="author">
10
  <tr>
11
  <td style="width:24px;">
@@ -54,6 +115,5 @@
54
  </table>
55
  </div>
56
  </div>
57
-
58
-
59
- </div>
1
+ <div id="screen-meta-activate-acf-wrap" class="screen-meta-wrap hidden acf">
2
+ <div class="screen-meta-content">
3
+
4
+ <h5>Unlock Special Fields.</h5>
5
+ <p>Special Fields can be unlocked by purchasing an activation code. Each activation code can be used on multiple sites. <a href="#">Store under construction</a></p>
6
+ <table class="acf_activate">
7
+ <thead>
8
+ <tr>
9
+ <th>Field Type</th>
10
+ <th>Status</th>
11
+ <th>Activation Code</th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
15
+ <tr>
16
+ <td>Repeater</td>
17
+ <td><?php if(array_key_exists('repeater', $this->activated_fields)){
18
+ echo 'Active';
19
+ }
20
+ else
21
+ {
22
+ echo 'Not Active';
23
+ } ?></td>
24
+ <td>
25
+ <form action="" method="post">
26
+ <?php if(array_key_exists('repeater', $this->activated_fields)){
27
+ echo '<span class="activation_code">'.$this->activated_fields['repeater'].'</span>';
28
+ echo '<input type="hidden" name="acf_field_deactivate" value="repeater" />';
29
+ echo '<input type="submit" class="button" value="Deactivate" />';
30
+ }
31
+ else
32
+ {
33
+ echo '<input type="text" name="acf_ac" value="" />';
34
+ echo '<input type="hidden" name="acf_field_activate" value="repeater" />';
35
+ echo '<input type="submit" class="button" value="Activate" />';
36
+ echo '<a href="#">Available soon</a>';
37
+ } ?>
38
+ </form>
39
+ </td>
40
+ </tr>
41
+ </tbody>
42
+ </table>
43
+ </div>
44
+ </div>
45
+ <div id="screen-meta-activate-acf-link-wrap" class="hide-if-no-js screen-meta-toggle acf">
46
+ <a href="#screen-meta-activate-acf" id="screen-meta-activate-acf-link" class="show-settings">Unlock Fields</a>
47
+ </div>
48
+
49
+
50
+ <?php
51
+ // get current page
52
+ $currentFile = $_SERVER["SCRIPT_NAME"];
53
+ $parts = Explode('/', $currentFile);
54
+ $currentFile = $parts[count($parts) - 1];
55
+
56
+ if($currentFile == 'edit.php'):
57
+ ?>
58
+
59
+
60
+ <div class="acf_col_right hidden metabox-holder" id="poststuff" >
61
 
62
  <div class="postbox">
63
  <div title="Click to toggle" class="handlediv"><br></div>
65
  <a class="thickbox button" href="http://localhost:8888/acf/wp-admin/plugin-install.php?tab=plugin-information&amp;plugin=advanced-custom-fields&amp;section=changelog&amp;TB_iframe=true&amp;width=640&amp;height=570"><?php _e("see what's new",'acf'); ?></a>
66
  </h3>
67
  <div class="inside">
68
+
69
+
70
  <table cellpadding="0" cellspacing="0" class="author">
71
  <tr>
72
  <td style="width:24px;">
115
  </table>
116
  </div>
117
  </div>
118
+ </div>
119
+ <?php endif; ?>
 
core/update.php CHANGED
@@ -359,9 +359,11 @@ if(version_compare($version,'1.1.4') < 0)
359
  $wpdb->query($sql);
360
  }
361
 
362
-
 
363
  }
364
 
 
365
  // update to latest acf version
366
- update_option('acf_version','1.1.4');
367
  ?>
359
  $wpdb->query($sql);
360
  }
361
 
362
+ update_option('acf_version','1.1.4');
363
+ $version = '1.1.4';
364
  }
365
 
366
+
367
  // update to latest acf version
368
+ update_option('acf_version','2.0.0');
369
  ?>
css/style.fields.css CHANGED
@@ -18,33 +18,39 @@
18
  margin: 0;
19
  }
20
 
21
-
22
  /*---------------------------------------------------------------------------------------------
23
- Heading
24
  ---------------------------------------------------------------------------------------------*/
25
  .fields {
26
  position: relative;
27
  overflow: hidden;
28
- background: #eaeaea;
29
  }
30
 
31
  .fields .field {
32
  position: relative;
33
  overflow: hidden;
34
- border-top: #fff solid 1px;
35
- border-bottom: #eaeaea solid 1px;
36
- background: #f6f6f6;
37
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa', endColorstr='#f6f6f6'); /* for IE */
38
- background: -webkit-gradient(linear, left top, left bottom, from(#fafafa), to(#f6f6f6)); /* for webkit browsers */
39
- background: -moz-linear-gradient(top, #fafafa, #f6f6f6); /* for firefox 3.6+ */
 
 
 
40
  }
41
 
42
  .fields .field:hover {
43
- background:#f9f9f9;
44
  }
45
 
46
- .fields .field:hover a.remove_field {
47
- visibility: visible;
 
 
 
 
48
  }
49
 
50
  .fields .field:first-child {
@@ -58,22 +64,25 @@
58
  #acf_fields table{border-collapse:separate; border-spacing:0; vertical-align:top; width: 100%;}
59
 
60
 
61
- .acf table,
62
- .acf table tr,
63
- .acf table tr td {
64
  vertical-align: top;
65
  }
66
 
 
 
 
 
67
  .acf tr th {
68
  background: url("../../../../wp-admin/images/gray-grad.png") repeat-x scroll left top #DFDFDF;
69
  text-shadow: 0 1px 0 #FFFFFF;
 
70
  font-weight: bold;
71
- font-size: 12px;
72
- line-height: 1.2;
73
  padding: 8px;
74
  text-align: left;
75
- border-bottom: 1px solid #d6d6d6;
76
- border-right: 1px solid #d6d6d6;
77
  }
78
 
79
  .acf tr th span {
@@ -81,90 +90,93 @@
81
  font-size: 10px;
82
  line-height: 1.2;
83
  font-weight: normal;
84
-
85
  }
86
 
87
- .acf tr th:last-child{
88
- border-right: 0 none;
 
89
  }
90
 
91
- .acf tr td.order,
92
- .acf tr th.order {
93
- width: 20px;
94
- text-align: center;
95
- vertical-align: middle;
96
- border-right: 0 none;
97
- color: #aaa;
98
- text-shadow: #fff 0 1px 0;
99
- padding: 8px 0 8px 8px;
100
  }
101
 
102
- /*
103
- .acf tr td.order span {
104
- display: block;
105
- border: #ebeaea solid 1px;
106
- border-top: #d7d7d7 solid 1px;
107
- border-bottom: #fff solid 1px;
108
- -moz-border-radius: 4px; -webkit-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px;
109
- text-align: center;
110
- font-size: 12px;
111
- line-height: 15px;
112
- padding: 3px;
113
- background: #efefef;
114
- }*/
115
 
116
- .acf tr td.label,
117
- .acf tr th.label {
118
- width: 250px;
 
 
 
119
  }
120
 
121
- .acf tr td.name,
122
- .acf tr th.name {
123
- width: 250px;
124
  }
125
 
126
- .acf tr td.type,
127
- .acf tr th.type {
128
- width: 150px;
129
  }
130
 
131
- .acf tr td.blank,
132
- .acf tr th.blank {
133
- border-right: 0 none;
134
  }
135
 
136
- .acf tr td.remove,
137
- .acf tr th.remove {
138
- width: 20px;
 
 
 
 
139
  }
140
 
141
  .acf tr td {
142
  background: transparent;
143
- border-right: 1px solid #f1f1f1;
144
  padding: 8px;
145
  position: relative;
 
146
  }
147
 
148
- .acf tr td:last-child{
149
- border-right: 0 none;
150
  }
151
 
152
- .acf tr td input {
153
- width: 99.99%;
154
- margin: 0;
155
  }
156
 
157
- .acf tr td select {
158
- width: 120px;
159
- margin: 0;
 
 
 
 
 
 
 
160
  }
161
 
162
 
 
 
 
 
 
 
 
 
 
163
  #acf_fields .table_footer {
164
  position: relative;
165
  overflow: hidden;
166
  padding: 8px;
167
- border-top: 1px solid #DFDFDF;
168
  background: #EAF2FA;
169
  }
170
 
@@ -184,45 +196,6 @@
184
  width: 70px;
185
  }
186
 
187
- a.remove_field {
188
- display: block;
189
- width: 16px;
190
- height: 16px;
191
- background: url(../images/button_remove.png) 0 0 no-repeat;
192
- visibility: hidden;
193
- }
194
-
195
- a.remove_field:hover {
196
- background-position: 0 100%;
197
- }
198
-
199
- a.field_options_button {
200
- width: 22px;
201
- height: 31px;
202
- background: url(../images/field_options.png) 0% 0%;
203
- display: block;
204
- position: absolute;
205
- margin-left: 123px;
206
- }
207
-
208
- .acf > tbody > tr > td > select {
209
- float: left;
210
- }
211
-
212
- a.field_options_button:hover {
213
- background-position: 0% 50%;
214
- }
215
-
216
-
217
- .field.options_open table.acf
218
- {
219
- border-bottom:#cccccc solid 1px;
220
- }
221
-
222
- .field.options_open a.field_options_button {
223
- background-position: 0% 100%;
224
- }
225
-
226
  .inline_metabox {
227
  border: 0 none;
228
  width: 100%;
@@ -231,6 +204,7 @@ a.field_options_button:hover {
231
  .inline_metabox h3 {
232
  border: 0 none;
233
  }
 
234
  /*---------------------------------------------------------------------------------------------
235
  Field Options
236
  ---------------------------------------------------------------------------------------------*/
@@ -255,40 +229,7 @@ a.field_options_button:hover {
255
  border: #CCCCCC solid 1px;
256
  -moz-border-radius: 5px; -webkit-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px;
257
  }
258
- /*
259
- #poststuff .inside .field_options .field_option p {
260
- font-size: 11px;
261
- color: #666;
262
- margin: 2px 0 0;
263
- }
264
-
265
- .field_options .field_option label{
266
- padding-top: 7px;
267
- display: block;
268
- font-size: 12px;
269
- }
270
-
271
- #acf_fields .field_options .field_option table {
272
- width: auto;
273
- vertical-align: top;
274
- padding: 8px;
275
- }
276
-
277
- .field_options .field_option table td{
278
- padding: 8px;
279
- font-size: 11px;
280
- vertical-align: top;
281
- }
282
-
283
- .field_options .field_option td.label {
284
- width: 244px;
285
- padding-left: 44px;
286
- }
287
- */
288
- .field_options .field_option textarea {
289
- width: 300px;
290
 
291
- }
292
 
293
  /*---------------------------------------------------------------------------------------------
294
  Repeater
@@ -303,4 +244,30 @@ a.field_options_button:hover {
303
  .field_options .field_option .repeater table {
304
  border: 0 none;
305
  -moz-border-radius: 0; -webkit-border-radius: 0; -khtml-border-radius: 0; border-radius: 0;
306
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  margin: 0;
19
  }
20
 
 
21
  /*---------------------------------------------------------------------------------------------
22
+ Fields
23
  ---------------------------------------------------------------------------------------------*/
24
  .fields {
25
  position: relative;
26
  overflow: hidden;
27
+ background: #F4F4F4;
28
  }
29
 
30
  .fields .field {
31
  position: relative;
32
  overflow: hidden;
33
+ border-bottom: #DFDFDF solid 1px;
34
+ }
35
+
36
+ .fields .field:nth-child(even) {
37
+ background: #fefefe;
38
+ }
39
+
40
+ .fields .field:nth-child(odd) {
41
+ background: #F9F9F9;
42
  }
43
 
44
  .fields .field:hover {
45
+ background: #FFFFE0;
46
  }
47
 
48
+ .fields .field.form_open {
49
+ background: #FFFFE0;
50
+ }
51
+
52
+ .fields .field_clone {
53
+ display: none;
54
  }
55
 
56
  .fields .field:first-child {
64
  #acf_fields table{border-collapse:separate; border-spacing:0; vertical-align:top; width: 100%;}
65
 
66
 
67
+ .acf,
68
+ .acf tr,
69
+ .acf tr td {
70
  vertical-align: top;
71
  }
72
 
73
+
74
+ /*---------------------------------------------------------------------------------------------
75
+ Table Heading
76
+ ---------------------------------------------------------------------------------------------*/
77
  .acf tr th {
78
  background: url("../../../../wp-admin/images/gray-grad.png") repeat-x scroll left top #DFDFDF;
79
  text-shadow: 0 1px 0 #FFFFFF;
80
+ color: #333;
81
  font-weight: bold;
82
+ font-size: 11px;
83
+ line-height: 1.3;
84
  padding: 8px;
85
  text-align: left;
 
 
86
  }
87
 
88
  .acf tr th span {
90
  font-size: 10px;
91
  line-height: 1.2;
92
  font-weight: normal;
93
+ text-shadow: 0 1px 0 #FFFFFF;
94
  }
95
 
96
+ .acf tr td.field_order,
97
+ .acf tr th.field_order {
98
+ text-indent: 6px;
99
  }
100
 
101
+ .acf tr td.field_order {
102
+ cursor: move;
 
 
 
 
 
 
 
103
  }
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
+ /*---------------------------------------------------------------------------------------------
107
+ Table Cell Alignment
108
+ ---------------------------------------------------------------------------------------------*/
109
+ .acf tr td.field_order,
110
+ .acf tr th.field_order {
111
+ width: 25%;
112
  }
113
 
114
+ .acf tr td.field_label,
115
+ .acf tr th.field_label {
116
+ width: 25%;
117
  }
118
 
119
+ .acf tr td.field_name,
120
+ .acf tr th.field_name {
121
+ width: 25%;
122
  }
123
 
124
+ .acf tr td.field_type,
125
+ .acf tr th.field_type {
126
+ width: 25%;
127
  }
128
 
129
+ /*---------------------------------------------------------------------------------------------
130
+ Table Body - Fields
131
+ ---------------------------------------------------------------------------------------------*/
132
+ .no_fields_message {
133
+ padding: 15px 10px;
134
+ text-shadow: #fff 0 1px 0;
135
+ border-bottom: #DFDFDF solid 1px;
136
  }
137
 
138
  .acf tr td {
139
  background: transparent;
 
140
  padding: 8px;
141
  position: relative;
142
+ font-size: 12px;
143
  }
144
 
145
+ .acf td.field_label strong a {
146
+ text-decoration: none;
147
  }
148
 
149
+ .acf td.field_label strong {
150
+ display: block;
151
+ padding-bottom: 6px;
152
  }
153
 
154
+ .acf .row_options {
155
+ font-size: 11px;
156
+ visibility: hidden;
157
+ }
158
+ .acf:hover .row_options {
159
+ visibility: visible;
160
+ }
161
+
162
+ .acf:hover .acf .row_options {
163
+ visibility: hidden;
164
  }
165
 
166
 
167
+
168
+ /*---------------------------------------------------------------------------------------------
169
+ Table Body - Field Options
170
+ ---------------------------------------------------------------------------------------------*/
171
+
172
+
173
+ /*---------------------------------------------------------------------------------------------
174
+ Table Footer
175
+ ---------------------------------------------------------------------------------------------*/
176
  #acf_fields .table_footer {
177
  position: relative;
178
  overflow: hidden;
179
  padding: 8px;
 
180
  background: #EAF2FA;
181
  }
182
 
196
  width: 70px;
197
  }
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  .inline_metabox {
200
  border: 0 none;
201
  width: 100%;
204
  .inline_metabox h3 {
205
  border: 0 none;
206
  }
207
+
208
  /*---------------------------------------------------------------------------------------------
209
  Field Options
210
  ---------------------------------------------------------------------------------------------*/
229
  border: #CCCCCC solid 1px;
230
  -moz-border-radius: 5px; -webkit-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px;
231
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
 
 
233
 
234
  /*---------------------------------------------------------------------------------------------
235
  Repeater
244
  .field_options .field_option .repeater table {
245
  border: 0 none;
246
  -moz-border-radius: 0; -webkit-border-radius: 0; -khtml-border-radius: 0; border-radius: 0;
247
+ }
248
+
249
+ table.acf_input tr td .acf tr td {
250
+ background: transparent;
251
+ padding: 8px;
252
+ position: relative;
253
+ font-size: 12px;
254
+ border: 0 none;
255
+ }
256
+
257
+
258
+ /*---------------------------------------------------------------------------------------------
259
+ Field Form
260
+ ---------------------------------------------------------------------------------------------*/
261
+ .field_form_mask {
262
+ display: none;
263
+ }
264
+
265
+ .field_form {
266
+ padding: 0 10px 10px;
267
+ }
268
+
269
+ .field_form .field_option {
270
+ display: none;
271
+ }
272
+
273
+
css/style.global.css CHANGED
@@ -1,49 +1,70 @@
1
  table.acf_input {
2
- border: #e9e9e9 solid 1px;
3
  border-collapse:separate;
4
  border-spacing:0;
5
  vertical-align:top;
6
  width: 100%;
7
- background: #F9F9F9;
8
-
9
  }
10
 
11
- table.acf_input > tbody > tr > td {
12
- border-bottom: #f0f0f0 solid 1px;
13
- border-right: #f0f0f0 solid 1px;
14
- padding: 6px;
15
  }
16
 
17
- table.acf_input > tbody > tr:last-child > td {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  border-bottom: 0 none;
19
  }
20
 
21
- table.acf_input > tbody > tr > td:last-child {
22
  border-right: 0 none;
23
  }
24
 
25
- table.acf_input > tbody > tr > td.label {
26
- width: 70px;
27
  vertical-align: top;
28
  }
29
 
30
- table.acf_input > tbody > tr > td > label{
31
  display: block;
32
- width: 110px;
33
  font-size: 12px;
34
- padding: 8px 4px;
35
-
 
36
  }
37
 
38
- table.acf_input > tbody > tr > td > input[type=text],
39
- table.acf_input > tbody > tr > td > textarea,
40
- table.acf_input > tbody > tr > td > select{
41
- width: 300px;
42
- float: left;
43
  }
44
 
45
- table.acf_input > tbody > tr > td > p {
46
- margin: 4px 6px !important;
47
- color: #BBB;
48
- float: left;
 
 
 
 
 
49
  }
 
 
 
 
 
 
1
  table.acf_input {
2
+ border: #DFDFDF solid 1px;
3
  border-collapse:separate;
4
  border-spacing:0;
5
  vertical-align:top;
6
  width: 100%;
7
+ background: #FEFEFE;
 
8
  }
9
 
10
+ table.acf_input tr:nth-child(even) {
11
+ background: #F9F9F9
 
 
12
  }
13
 
14
+ table.acf_input tr:nth-child(odd) {
15
+ background: transparent;
16
+ }
17
+
18
+ table.acf_input tr.field_save {
19
+ background: #EAF2FA;
20
+ }
21
+
22
+ table.acf_input tr td {
23
+ border-bottom: #DFDFDF solid 1px;
24
+ border-right: #DFDFDF solid 1px;
25
+ padding: 10px 8px;
26
+ }
27
+
28
+ table.acf_input tr:last-child td {
29
  border-bottom: 0 none;
30
  }
31
 
32
+ table.acf_input tr td:last-child {
33
  border-right: 0 none;
34
  }
35
 
36
+ table.acf_input tbody tr td.label {
37
+ width: 24%;
38
  vertical-align: top;
39
  }
40
 
41
+ table.acf_input tbody tr td.label label{
42
  display: block;
 
43
  font-size: 12px;
44
+ font-weight: bold;
45
+ padding: 0;
46
+ margin: 0;
47
  }
48
 
49
+ table.acf_input tbody tr td.label label span.required {
50
+ color: #f00;
51
+ display: inline;
52
+ margin-right: 5px;
 
53
  }
54
 
55
+
56
+ table.acf_input tbody tr td.label p{
57
+ display: block;
58
+ font-size: 10px;
59
+ padding: 6px 0 !important;
60
+ margin: 0 !important;
61
+ font-style: normal;
62
+ line-height: 12px;
63
+ color: #666;
64
  }
65
+
66
+ table.acf_input input[type=text],
67
+ table.acf_input textarea,
68
+ table.acf_input select{
69
+ width: 99.95%;
70
+ }
css/style.info.css DELETED
@@ -1,49 +0,0 @@
1
- /*--------------------------------------------------------------------------------------------
2
- Admin
3
- --------------------------------------------------------------------------------------------*/
4
- .cfm_cols {position: relative; overflow: hidden; clear: both;}
5
- .cfm_col_left {margin-right: 400px;}
6
- .cfm_col_left .tablenav {display: none;}
7
- .cfm_col_left p.search-box {display: none;}
8
- .cfm_col_left form {overflow: hidden; position: relative; clear: left;}
9
-
10
-
11
- .cfm_col_right {float: right; width: 380px; padding-top: 86px !important;}
12
- .cfm_col_right ul li,
13
- .cfm_col_right ol li {font-size: 11px; line-height: 14px;}
14
- .cfm_col_right ul {list-style: square outside; padding-left: 20px;}
15
- .cfm_col_right#poststuff .inside p {margin: 12px 6px 12px;}
16
- .cfm_col_right table.author {
17
- border: #cde1e8 solid 1px;
18
- background: #f0f7f9;
19
- -moz-border-radius: 4px 4px 4px 4px;
20
- border-spacing: 0;
21
- clear: both;
22
- margin: 0;
23
- width: 100%;
24
- margin: 4px 0;}
25
- .cfm_col_right table.author td {padding: 5px; font-size: 12px; line-height: 24px;}
26
-
27
- .cfm_col_right form span {
28
- float: left;
29
- }
30
-
31
- .cfm_col_right form input[type="image"]{
32
- display: block;
33
- float: left;
34
- margin: 0 0 0 8px;
35
- padding: 0;
36
- }
37
-
38
- .postbox h3.hndle {
39
- cursor: default;
40
- position: relative;
41
- }
42
-
43
- .postbox h3.hndle a.button {
44
- height: 13px;
45
- line-height: 12px;
46
- position: absolute;
47
- right: 6px;
48
- top: 2px;
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/style.input.css CHANGED
@@ -2,18 +2,36 @@
2
  border: #EAEAEA solid 0px;
3
  background: transparent;
4
  position: relative;
5
- overflow: visible;
6
  }
7
 
8
- table.acf_input {
9
- border: 0 none !important;
 
 
 
 
 
 
 
 
 
10
  }
11
 
12
- table.acf_input > tbody > tr:first-child > td {
 
 
 
 
 
 
 
 
 
13
  border-top: 0 none;
14
  }
15
 
16
- table.acf_input > tbody > tr:last-child > td {
17
  border-bottom: 0 none;
18
  }
19
 
@@ -25,12 +43,12 @@ table.acf_input > tbody > tr:last-child > td {
25
  margin: 0;
26
  }
27
 
28
-
29
  .postbox#acf_input .handlediv {
30
  display: none;
31
  height: 0;
32
  width: 0;
33
  }
 
34
  .acf_wysiwyg {
35
  border: #DFDFDF solid 1px;
36
  overflow: hidden;
@@ -40,14 +58,13 @@ table.acf_input > tbody > tr:last-child > td {
40
  top: -2px !important;
41
  }
42
 
43
- table.acf_input > tbody > tr > td > input[type="text"],
44
- table.acf_input > tbody > tr > td > textarea {
 
45
  width: 99.8%;
46
  }
47
 
48
- table.acf_input > tbody > tr > td > select {
49
- min-width: 250px;
50
- }
51
 
52
  /*---------------------------------------------------------------------------------------------
53
  Image Upload
@@ -80,10 +97,8 @@ table.acf_input > tbody > tr > td > select {
80
  max-height: 100px;
81
  width: auto;
82
  height: auto;
83
- padding: 3px;
84
- background: #FFF;
85
- border: #d8d8d8 solid 1px;
86
  display: none;
 
87
  }
88
 
89
  .acf_image_uploader.active img {
@@ -122,50 +137,47 @@ table.acf_input > tbody > tr > td > select {
122
  }
123
 
124
 
125
-
126
- table.acf_input {
127
- border: 0 none;
128
- border-top: 1px solid #eaeaea;
129
- border-bottom: 1px solid #FFFFFF;
 
130
  }
131
 
132
- table.acf_input {
133
- background: transparent;
 
 
 
 
 
 
 
134
  }
135
 
136
- table.acf_input > tbody > tr > td {
137
- border-bottom: 1px solid #eaeaea;
138
- border-top: 1px solid #FFFFFF;
139
- padding: 8px 0;
 
 
140
  }
141
 
142
- table.acf_input > tbody > tr > td > label {
143
- color: #21759B;
144
- font-size: 12px;
145
- font-weight: bold;
146
- padding: 0 0 8px;
147
- text-shadow: 0 1px 0 #FFFFFF;
148
  }
149
 
150
-
151
- table.acf_input > tbody > tr > td > label {
152
- width: auto;
153
  }
154
 
155
- /*---------------------------------------------------------------------------------------------
156
- Repeater
157
- ---------------------------------------------------------------------------------------------*/
158
- .repeater {
159
- border: 1px solid #eeeeee;
160
- -moz-border-radius: 5px; -webkit-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px;
161
-
162
  }
163
 
164
- .repeater > table {
165
- width: 100%;
166
- border-top:#fff solid 1px;
167
- border-bottom: 0 none;
168
- -moz-border-radius: 5px; -webkit-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px;
169
  }
170
 
171
  .repeater > table > thead > tr > th {
@@ -175,23 +187,26 @@ table.acf_input > tbody > tr > td > label {
175
  padding: 8px;
176
  text-align: left;
177
  font-size: 12px;
178
- border-bottom: 1px solid #EEEEEE;
179
- border-right: 1px solid #EEEEEE;
180
- border-left: 1px solid #ffffff;
181
  background: #f8f8f8;
182
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f8f8f8'); /* for IE */
183
- background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f8f8f8)); /* for webkit browsers */
184
- background: -moz-linear-gradient(top, #ffffff, #f8f8f8); /* for firefox 3.6+ */
185
  }
186
 
187
  .repeater > table > thead > tr > th:last-child {
188
- border-right: 1px solid #ffffff;
189
  }
190
 
191
  .repeater > table > tbody > tr:hover a.remove_field {
192
  visibility: visible;
193
  }
194
 
 
 
 
 
195
  a.remove_field {
196
  display: block;
197
  width: 16px;
@@ -204,13 +219,22 @@ a.remove_field:hover {
204
  background-position: 0 100%;
205
  }
206
 
207
- .repeater > table td.remove {
208
- padding: 8px 4px;
 
 
 
 
 
209
  }
210
 
211
- .repeater > table td.order {
212
- color: #CCC;
213
- text-shadow: #fff 0 1px 0;
 
 
 
 
214
  }
215
 
216
  .repeater > table td.order a.order_up {
@@ -230,19 +254,15 @@ a.remove_field:hover {
230
  }
231
 
232
 
 
 
 
 
 
233
  .repeater .table_footer {
234
  position: relative;
235
  overflow: hidden;
236
- padding: 8px;
237
- padding-right: 38px;
238
- }
239
-
240
- .repeater .table_footer .order_message {
241
- background: url(../images/drag_and_drop_to_reorder.png);
242
- width: 161px;
243
- height: 23px;
244
- float: left;
245
- margin-left: 5px;
246
  }
247
 
248
  .repeater .table_footer a#add_field{
@@ -253,15 +273,12 @@ a.remove_field:hover {
253
  width: 70px;
254
  }
255
 
256
-
257
  #acf_input .wp_themeSkin tr.mceFirst td.mceToolbar {
258
- background: none repeat scroll 0 0 #E6EBF0;
259
- border-color: #d7dee4;
260
  }
261
 
262
  #poststuff #acf_input .wp_themeSkin .mceStatusbar {
263
- background: #f3f6f9;
264
- border-color: #d7dee4;
265
  }
266
 
267
  #wpcontent select[multiple] {
@@ -274,4 +291,8 @@ a.remove_field:hover {
274
 
275
  #wpcontent select optgroup option {
276
  padding-left: 6px;
 
 
 
 
277
  }
2
  border: #EAEAEA solid 0px;
3
  background: transparent;
4
  position: relative;
5
+ overflow: visible;border: 0 none !important;
6
  }
7
 
8
+ .acf_fields_input {
9
+ position: relative;
10
+ border-top: 1px solid #eaeaea;
11
+ border-bottom: 1px solid #FFFFFF;
12
+ }
13
+
14
+ .acf_fields_input .field {
15
+ position: relative;
16
+ padding: 10px 2px;
17
+ border-bottom: 1px solid #eaeaea;
18
+ border-top: 1px solid #FFFFFF;
19
  }
20
 
21
+ .acf_fields_input .field label {
22
+ display: block;
23
+ color: #21759B;
24
+ font-size: 12px;
25
+ font-weight: bold;
26
+ padding: 0 0 8px;
27
+ text-shadow: 0 1px 0 #FFFFFF;
28
+ }
29
+
30
+ .acf_fields_input .field:first-child {
31
  border-top: 0 none;
32
  }
33
 
34
+ .acf_fields_input .field:last-child {
35
  border-bottom: 0 none;
36
  }
37
 
43
  margin: 0;
44
  }
45
 
 
46
  .postbox#acf_input .handlediv {
47
  display: none;
48
  height: 0;
49
  width: 0;
50
  }
51
+
52
  .acf_wysiwyg {
53
  border: #DFDFDF solid 1px;
54
  overflow: hidden;
58
  top: -2px !important;
59
  }
60
 
61
+ .acf_fields_input .field input[type="text"],
62
+ .acf_fields_input .field textarea,
63
+ .acf_fields_input .field select{
64
  width: 99.8%;
65
  }
66
 
67
+
 
 
68
 
69
  /*---------------------------------------------------------------------------------------------
70
  Image Upload
97
  max-height: 100px;
98
  width: auto;
99
  height: auto;
 
 
 
100
  display: none;
101
+ -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
102
  }
103
 
104
  .acf_image_uploader.active img {
137
  }
138
 
139
 
140
+ /*---------------------------------------------------------------------------------------------
141
+ Repeater
142
+ ---------------------------------------------------------------------------------------------*/
143
+ .repeater {
144
+
145
+
146
  }
147
 
148
+ .repeater > table {
149
+ width: 100%;
150
+ border-bottom: 0 none;
151
+ -moz-border-radius: 5px; -webkit-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px;
152
+ border-collapse:separate; border-spacing:0; vertical-align:top; width: 100%;
153
+ position: relative;
154
+ overflow: hidden;
155
+ border: 1px solid #DFDFDF;
156
+ background: #fefefe;
157
  }
158
 
159
+ .repeater > table > tbody > tr > td {
160
+ background: transparent;
161
+ border-right: 1px solid #ededed;
162
+ border-bottom: 1px solid #ededed;
163
+ padding: 8px;
164
+ position: relative;
165
  }
166
 
167
+ .repeater > table > tbody > tr:last-child td {
168
+ border-bottom: 0 none;
 
 
 
 
169
  }
170
 
171
+ .repeater > table > tbody > tr td:last-child{
172
+ border-right: 0 none;
 
173
  }
174
 
175
+ .repeater > table > tbody > tr:nth-child(even) {
176
+ background: transparent;
 
 
 
 
 
177
  }
178
 
179
+ .repeater > table > tbody > tr:nth-child(odd) {
180
+ background: #F9F9F9;
 
 
 
181
  }
182
 
183
  .repeater > table > thead > tr > th {
187
  padding: 8px;
188
  text-align: left;
189
  font-size: 12px;
190
+ border-bottom: 1px solid #e1e1e1;
191
+ border-right: 1px solid #e1e1e1;
 
192
  background: #f8f8f8;
193
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f0f0f0', endColorstr='#e6e6e6'); /* for IE */
194
+ background: -webkit-gradient(linear, left top, left bottom, from(#f0f0f0), to(#e6e6e6)); /* for webkit browsers */
195
+ background: -moz-linear-gradient(top, #f0f0f0, #e6e6e6); /* for firefox 3.6+ */
196
  }
197
 
198
  .repeater > table > thead > tr > th:last-child {
199
+ border-right: 0 none;
200
  }
201
 
202
  .repeater > table > tbody > tr:hover a.remove_field {
203
  visibility: visible;
204
  }
205
 
206
+ .repeater.hide_remove_buttons > table > tbody > tr:hover a.remove_field {
207
+ visibility: hidden;
208
+ }
209
+
210
  a.remove_field {
211
  display: block;
212
  width: 16px;
219
  background-position: 0 100%;
220
  }
221
 
222
+ .repeater table tr td.order,
223
+ .repeater table tr th.order{
224
+ width: 20px;
225
+ text-align: center;
226
+ vertical-align: middle;
227
+ color: #aaa;
228
+ text-shadow: #fff 0 1px 0;
229
  }
230
 
231
+ .repeater table tr td.order {
232
+ cursor: move;
233
+ }
234
+
235
+ .repeater table tr td.remove,
236
+ .repeater table tr th.remove {
237
+ width: 16px;
238
  }
239
 
240
  .repeater > table td.order a.order_up {
254
  }
255
 
256
 
257
+ .repeater table tr td select {
258
+ width: 120px;
259
+ margin: 0;
260
+ }
261
+
262
  .repeater .table_footer {
263
  position: relative;
264
  overflow: hidden;
265
+ padding: 8px 0;
 
 
 
 
 
 
 
 
 
266
  }
267
 
268
  .repeater .table_footer a#add_field{
273
  width: 70px;
274
  }
275
 
 
276
  #acf_input .wp_themeSkin tr.mceFirst td.mceToolbar {
277
+
 
278
  }
279
 
280
  #poststuff #acf_input .wp_themeSkin .mceStatusbar {
281
+
 
282
  }
283
 
284
  #wpcontent select[multiple] {
291
 
292
  #wpcontent select optgroup option {
293
  padding-left: 6px;
294
+ }
295
+
296
+ ul.checkbox_list {
297
+ background: transparent !important;
298
  }
css/style.location.css CHANGED
@@ -1,19 +1,3 @@
1
- /*.postbox#acf_location {
2
- border: none;
3
- }
4
-
5
- .postbox#acf_location h3 {
6
- background: transparent none;
7
- }
8
-
9
-
10
-
11
-
12
- .postbox#acf_location .inside {
13
- background: transparent;
14
- margin: 0;
15
- }*/
16
-
17
  .postbox#acf_location h3 span.description {
18
  font-size: 11px;
19
  color: #666;
@@ -23,8 +7,6 @@
23
  }
24
 
25
  table.acf_input > tbody > tr > td > select[multiple="multiple"] {
26
- float: left;
27
- width: 300px;
28
  height: auto !important;
29
  }
30
 
@@ -47,8 +29,8 @@ table.acf_input > tbody > tr > td > select[multiple="multiple"] {
47
  }
48
 
49
  .help_box {
50
- background: #EAF2FA;
51
- border: #DFDFDF solid 1px;
52
  padding: 8px 16px;
53
  margin-bottom: 10px;
54
  }
@@ -72,6 +54,5 @@ table.acf_input > tbody > tr > td > select[multiple="multiple"] {
72
  display: list-item;
73
  font-size: 11px;
74
  line-height: 12px;
75
- color: #6b8298;
76
  margin-bottom: 6px;
77
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  .postbox#acf_location h3 span.description {
2
  font-size: 11px;
3
  color: #666;
7
  }
8
 
9
  table.acf_input > tbody > tr > td > select[multiple="multiple"] {
 
 
10
  height: auto !important;
11
  }
12
 
29
  }
30
 
31
  .help_box {
32
+ background: #FFFFE0;
33
+ border: #E6DB55 solid 1px;
34
  padding: 8px 16px;
35
  margin-bottom: 10px;
36
  }
54
  display: list-item;
55
  font-size: 11px;
56
  line-height: 12px;
 
57
  margin-bottom: 6px;
58
  }
css/style.screen_extra.css ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*--------------------------------------------------------------------------------------------
2
+ Admin
3
+ --------------------------------------------------------------------------------------------*/
4
+ .acf_cols {position: relative; overflow: hidden; clear: both;}
5
+ .acf_col_left {margin-right: 400px;}
6
+ .acf_col_left .tablenav {display: none;}
7
+ .acf_col_left p.search-box {display: none;}
8
+ .acf_col_left form {overflow: hidden; position: relative; clear: left;}
9
+
10
+
11
+ .acf_col_right {float: right; width: 380px; padding-top: 86px !important;}
12
+ .acf_col_right ul li,
13
+ .acf_col_right ol li {font-size: 11px; line-height: 14px;}
14
+ .acf_col_right ul {list-style: square outside; padding-left: 20px;}
15
+ .acf_col_right#poststuff .inside p {margin: 12px 6px 12px;}
16
+ .acf_col_right table.author {
17
+ border: #cde1e8 solid 1px;
18
+ background: #f0f7f9;
19
+ border-spacing: 0;
20
+ clear: both;
21
+ margin: 0;
22
+ width: 100%;
23
+ margin: 4px 0;}
24
+ .acf_col_right table.author td {padding: 5px; font-size: 12px; line-height: 24px;}
25
+
26
+ #poststuff.acf_col_right .inside {
27
+ margin: 2px 6px 4px;
28
+ }
29
+
30
+ .acf_col_right form span {
31
+ float: left;
32
+ }
33
+
34
+ .acf_col_right form input[type="image"]{
35
+ display: block;
36
+ float: left;
37
+ margin: 0 0 0 8px;
38
+ padding: 0;
39
+ }
40
+
41
+ .postbox h3.hndle {
42
+ cursor: default;
43
+ position: relative;
44
+ }
45
+
46
+ .postbox h3.hndle a.button {
47
+ height: 13px;
48
+ line-height: 12px;
49
+ position: absolute;
50
+ right: 6px;
51
+ top: 2px;
52
+ }
53
+
54
+ /*--------------------------------------------------------------------------------------------
55
+ Unlock Fields
56
+ --------------------------------------------------------------------------------------------*/
57
+ .screen-meta-toggle.acf {
58
+ float: right;
59
+ background: none repeat scroll 0 0 #33aee6;
60
+ border-radius: 0 0 3px 3px;
61
+ float: right;
62
+ font-family: "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;
63
+ height: 22px;
64
+ margin: 0 6px 0 0;
65
+ padding: 0;
66
+ }
67
+
68
+ #screen-meta-links .acf a.show-settings {
69
+ color: #fff;
70
+ text-shadow: #175d7d 0 1px 0;
71
+ padding: 0 16px;
72
+ background: 0 none;
73
+ }
74
+
75
+ .screen-meta-wrap h5 {
76
+ margin: 8px 0 3px;
77
+ font-size: 13px;
78
+ }
79
+ .screen-meta-wrap {
80
+ background: #EAF2FA;
81
+ border: #ccdbea solid 1px;
82
+ border-top: 0 none;
83
+ margin: 0 15px;
84
+ padding: 8px 12px 12px;
85
+ border-radius: 0 0 4px 4px;
86
+ }
87
+
88
+ .screen-meta-wrap p {
89
+ margin-top: 0px;
90
+ }
91
+
92
+ table.acf_activate {
93
+ border: #DFDFDF solid 1px;
94
+ border-collapse:separate;
95
+ border-spacing:0;
96
+ vertical-align:top;
97
+ width: 100%;
98
+ background: #FEFEFE;
99
+ }
100
+
101
+ table.acf_activate thead tr {
102
+ background: #F9F9F9 !important;
103
+ }
104
+
105
+ table.acf_activate thead tr th {
106
+ text-align: left;
107
+ color: #21759B;
108
+ }
109
+
110
+ table.acf_activate tr:nth-child(even) {
111
+ background: #F9F9F9
112
+ }
113
+
114
+ table.acf_activate tr:nth-child(odd) {
115
+ background: transparent;
116
+ }
117
+
118
+ table.acf_activate tr.field_save {
119
+ background: #EAF2FA;
120
+ }
121
+
122
+ table.acf_activate tr td,
123
+ table.acf_activate tr th {
124
+ border-bottom: #DFDFDF solid 1px;
125
+ border-right: #DFDFDF solid 1px;
126
+ padding: 8px;
127
+ }
128
+
129
+ table.acf_activate tr:last-child td {
130
+ border-bottom: 0 none;
131
+ }
132
+
133
+ table.acf_activate tr td:last-child {
134
+ border-right: 0 none;
135
+ }
136
+
137
+ table.acf_activate input[type="submit"] {
138
+ margin-left: 5px;
139
+ margin-right: 5px;
140
+ }
js/functions.fields.js CHANGED
@@ -1,201 +1,271 @@
1
  (function($){
 
2
  // exists
3
- $.fn.exists = function(){return jQuery(this).length>0;}
 
 
 
4
 
5
-
6
- $.fn.make_acf = function()
 
 
 
7
  {
8
- // vars
9
- var fields = $(this); // .fields
10
- var add_field = fields.siblings('.table_footer').children('a#add_field');
11
- var fields_limit = parseInt(fields.siblings('input[name=fields_limit]').val()) - 1;
12
-
13
- /*-------------------------------------------
14
- Add Field Button
15
- -------------------------------------------*/
16
- add_field.unbind("click").click(function(){
17
-
18
- var total_fields = fields.children('.field').length-1;
19
 
20
- // limit fields
21
- if(total_fields >= fields_limit)
 
 
22
  {
23
- alert('Field limit reached!');
24
- return false;
25
  }
26
 
27
- // clone last tr
28
- var new_field = fields.children('.field').last().clone(true);
29
-
30
- // reset new field
31
- new_field.reset_values();
32
- new_field.update_names(total_fields, (total_fields+1));
33
-
34
- // append to table
35
- fields.append(new_field);
36
-
37
- // close options
38
- new_field.find('select.type').trigger('change');
39
- new_field.find('input.label').focus();
 
 
 
 
 
40
 
41
- // update order numbers
42
- fields.update_order_numbers();
 
 
 
 
 
 
 
 
43
 
44
- return false;
45
-
46
-
 
47
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
 
50
- /*-------------------------------------------
51
- Sortable
52
- -------------------------------------------*/
53
- fields.sortable({
54
- update: function(event, ui){fields.update_order_numbers();},
55
- handle: 'table'
 
 
 
 
 
 
 
 
 
 
56
  });
57
 
58
 
59
- /*-------------------------------------------
60
- Auto Fill Name
61
- -------------------------------------------*/
62
- fields.children('.field').children('table').find('input.label').unbind('blur').blur(function()
63
- {
64
- var label = $(this);
65
- var name = $(this).parent().siblings('td.name').children('input');
66
 
67
- if(name.val() == '')
 
68
  {
69
- var val = label.val().toLowerCase().split(' ').join('_').split('\'').join('');
70
- name.val(val);
71
  }
 
 
 
 
 
72
  });
73
 
74
 
75
- /*-------------------------------------------
76
- Remove Field Button
77
- -------------------------------------------*/
78
- fields.children('.field').children('table').find('a.remove_field').unbind('click').click(function()
79
- {
80
- // needs at least one
81
- if(fields.children('.field').length <= 1)
 
82
  {
83
- return false;
 
 
 
 
84
  }
85
 
86
- var field = $(this).parents('.field').first();
87
- field.fadeTo(300,0,function(){
88
- field.animate({'height':0}, 300, function(){
89
- field.remove();
90
- fields.update_order_numbers();
91
- });
92
- });
93
 
94
- return false;
95
- });
 
 
 
 
 
 
 
 
96
 
97
 
98
- /*-------------------------------------------
99
- Field Options
100
- -------------------------------------------*/
101
- fields.children('.field').children('table').find('select.type').change(function()
102
- {
103
- var selected = $(this).val();
104
- var td = $(this).parent('td');
105
 
106
- var field = $(this).parents('.field').first();
107
- var field_options = field.children('.field_options');
108
- var selected_option = field_options.children('.field_option#'+selected);
109
 
110
- // remove preivous field option button
111
- td.children('a.field_options_button').remove();
112
- field.removeClass('options_open');
113
- field_options.children('.field_option').hide();
114
- field_options.children('.field_option').find('[name]').attr('disabled', 'true');
115
 
116
 
117
- // if options...
118
- if(selected_option.exists())
119
  {
120
- var a = $('<a class="field_options_button" href="javascript:;"></a>');
121
- td.append(a);
122
 
123
- // all options are disabled, make the chosen one abled!
124
- selected_option.find('[name]').removeAttr('disabled');
 
 
 
 
125
 
126
- a.click(function(){
127
- if(!field.is('.options_open'))
128
- {
129
- field.addClass('options_open');
130
- selected_option.animate({'height':'toggle', 'padding-top':'toggle', 'padding-bottom':'toggle'}, 500);
131
- }
132
- else
133
- {
134
- selected_option.animate({'height':'toggle', 'padding-top':'toggle', 'padding-bottom':'toggle'}, 500, function(){
135
- field.removeClass('options_open');
136
- });
137
- }
138
-
139
- selected_option.find('[name]').removeAttr('disabled');
140
- });
141
 
 
142
  }
143
- }).trigger('change');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
 
 
 
 
145
 
146
- }
147
-
148
- /*-------------------------------------------
149
- Reset Values
150
- -------------------------------------------*/
151
- $.fn.reset_values = function(){
152
-
153
- $(this).find('input[type="text"]').val('');
154
- $(this).find('input[type="hidden"]').val('');
155
- $(this).find('textarea').val('');
156
- $(this).find('select option').removeAttr('selected');
157
- $(this).find('select[multiple="multiple"] option').attr('selected','selected');
158
- $(this).find('input[type="checkbox"]').removeAttr('checked');
159
- }
160
-
161
- $.fn.update_names = function(old_no, new_no)
162
- {
163
- //alert('passed through '+total_fields);
164
- $(this).find('[name]').each(function()
165
  {
166
- var name = $(this).attr('name').replace('['+(old_no)+']','['+new_no+']');
167
- $(this).attr('name', name);
 
 
 
 
 
 
 
 
168
  });
169
- }
170
-
171
-
172
- /*-------------------------------------------
173
- Update Orer Numbers
174
- -------------------------------------------*/
175
- $.fn.update_order_numbers = function(){
176
- $(this).children('.field').each(function(i){
177
- $(this).children('table').children('tbody').children('tr').children('td.order').html(i+1);
 
 
 
 
 
 
 
 
178
  });
 
 
 
 
 
 
 
 
179
  }
180
-
181
 
182
- /*-------------------------------------------
183
  Document Ready
184
- -------------------------------------------*/
185
  $(document).ready(function(){
186
- $('div.postbox#acf_fields .fields').each(function(){
187
- $(this).make_acf();
188
- });
 
 
 
189
 
190
- $('input#publish').click(function(){
191
- $('div.postbox#acf_fields select.type').each(function(){
192
- if($(this).val() == 'null')
193
- {
194
- alert('** All fields require a type selected **');
195
- }
196
- });
197
-
198
- });
199
 
200
  $('div.postbox a.help').click(function(){
201
  $('div.postbox .help_box_mask').animate({'height':'toggle'}, 500);
1
  (function($){
2
+
3
  // exists
4
+ $.fn.exists = function()
5
+ {
6
+ return jQuery(this).length>0;
7
+ };
8
 
9
+
10
+ /*--------------------------------------------------------------------------
11
+ Update Names
12
+ --------------------------------------------------------------------------*/
13
+ $.fn.update_names = function(new_no, new_sub_no)
14
  {
15
+ //console.log('update names: new_no = '+new_no+', new_sub_no = '+new_sub_no);
16
+
17
+ //alert('passed through '+total_fields);
18
+ $(this).find('[name]').each(function()
19
+ {
 
 
 
 
 
 
20
 
21
+ var name = $(this).attr('name');
22
+ var id = $(this).attr('id');
23
+
24
+ if(name.indexOf("[fields][999]") != -1)
25
  {
26
+ name = name.replace('[fields][999]','[fields]['+new_no+']');
27
+ id = id.replace('[fields][999]','[fields]['+new_no+']');
28
  }
29
 
30
+ if($(this).closest('.sub_field').hasClass('field_clone'))
31
+ {
32
+ // dont change this input (its the clone sub field!)
33
+ }
34
+ else
35
+ {
36
+
37
+
38
+ if(name.indexOf("[sub_fields][999]") != -1)
39
+ {
40
+ name = name.replace('[sub_fields][999]','[sub_fields]['+new_sub_no+']');
41
+ id = id.replace('[sub_fields][999]','[sub_fields]['+new_sub_no+']');
42
+ }
43
+
44
+
45
+
46
+
47
+ }
48
 
49
+ $(this).attr('name', name);
50
+ $(this).attr('id', id);
51
+ });
52
+ }
53
+
54
+
55
+ /*--------------------------------------------------------------------------
56
+ Update Order Numbers
57
+ --------------------------------------------------------------------------*/
58
+ function update_order_numbers(){
59
 
60
+ $('.fields').each(function(){
61
+ $(this).children('.field').each(function(i){
62
+ $(this).find('td.field_order').first().html(i+1);
63
+ });
64
  });
65
+
66
+
67
+ }
68
+
69
+
70
+ /*--------------------------------------------------------------------------
71
+ setup_fields
72
+ --------------------------------------------------------------------------*/
73
+ function setup_fields()
74
+ {
75
+
76
+ if(!$('.postbox#acf_fields').exists())
77
+ {
78
+ alert('ERROR. Could not find .postbox#acf_fields');
79
+ return false;
80
+ }
81
 
82
 
83
+ // add edit button functionality
84
+ $('a.acf_edit_field').live('click', function(){
85
+ //console.log('me');
86
+ var field = $(this).closest('.field');
87
+
88
+ if(field.is('.form_open'))
89
+ {
90
+ field.removeClass('form_open');
91
+ }
92
+ else
93
+ {
94
+ field.addClass('form_open');
95
+ }
96
+
97
+
98
+ field.children('.field_form_mask').animate({'height':'toggle'}, 500);
99
  });
100
 
101
 
102
+ // add delete button functionality
103
+ $('a.acf_delete_field').live('click', function(){
104
+ //console.log('me');
105
+ var field = $(this).closest('.field');
106
+ var fields = field.closest('.fields');
 
 
107
 
108
+ field.remove();
109
+ if(!fields.children('.field').exists())
110
  {
111
+ // no more fields, show the message
112
+ fields.children('.no_fields_message').show();
113
  }
114
+ //field.animate({'opacity':'0'}, 500, function(){
115
+ // $(this).animate({'height':'0'}, 500, function(){
116
+ //
117
+ // });
118
+ //});
119
  });
120
 
121
 
122
+ // show field type options
123
+ $('.field_form tr.field_type select').live('change', function(){
124
+
125
+ var tbody = $(this).closest('tbody');
126
+ var type = $(this).val();
127
+
128
+ // does it have repeater?
129
+ if(!$(this).find('option[value="repeater"]').exists())
130
  {
131
+ //console.log('select: '+type+'. parent length: '+$(this).closest('.repeater').length);
132
+ if($(this).closest('.repeater').length == 0)
133
+ {
134
+ $(this).append('<option value="null" disabled="true">Repeater (Unlock field with activation code)</option>');
135
+ }
136
  }
137
 
138
+ tbody.children('tr.field_option').hide();
139
+ tbody.children('tr.field_option').find('[name]').attr('disabled', 'true');
 
 
 
 
 
140
 
141
+ var tr = tbody.children('tr.field_option_'+type);
142
+ tr.find('[name]').removeAttr('disabled');
143
+
144
+ var tr_top = tbody.children('tr.field_type');
145
+
146
+ tr.insertAfter(tr_top);
147
+ tr.show();
148
+
149
+
150
+ }).trigger('change');
151
 
152
 
153
+ // Add Field Button
154
+ $('#add_field').live('click',function(){
 
 
 
 
 
155
 
156
+ var table_footer = $(this).closest('.table_footer');
157
+ var fields = table_footer.siblings('.fields');
158
+ //console.log(fields);
159
 
160
+ // clone last tr
161
+ var new_field = fields.children('.field_clone').clone();
162
+ new_field.removeClass('field_clone').addClass('field');
 
 
163
 
164
 
165
+ // update input names
166
+ if(new_field.hasClass('sub_field'))
167
  {
 
 
168
 
169
+ // it is a sub field
170
+ //console.log(fields.parents('.fields').last());
171
+ var field_length = fields.parents('.fields').last().children('.field').length;
172
+ var sub_field_length = fields.children('.field').length;
173
+ //alert(sub_field_length);
174
+ //alert('update numbers for sub field! field:'+field_length+', sub:'+sub_field_length);
175
 
176
+ new_field.update_names(field_length, sub_field_length);
177
+ }
178
+ else
179
+ {
180
+ var field_length = fields.children('.field').length;
181
+ new_field.update_names(field_length, 0);
 
 
 
 
 
 
 
 
 
182
 
183
+ //alert('update numbers for field! field:'+field_length);
184
  }
185
+
186
+
187
+ // append to table
188
+ fields.append(new_field);
189
+
190
+
191
+ // remove no fields message
192
+ if(fields.children('.no_fields_message').exists())
193
+ {
194
+ fields.children('.no_fields_message').hide();
195
+ }
196
+
197
+
198
+ // open up the edit form
199
+ new_field.find('a.acf_edit_field').first().trigger('click');
200
+
201
+
202
+ // clear text inputs
203
+ new_field.find('.field_form input[type="text"]').val('');
204
+ new_field.find('.field_form input[type="text"]').first().focus();
205
+
206
+
207
+ // update order numbers
208
+ update_order_numbers();
209
 
210
+ return false;
211
+
212
+
213
+ });
214
 
215
+
216
+ // Auto complete field name
217
+ $('.field_form tr.field_label input.label').live('blur', function()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  {
219
+ //console.log('blur');
220
+ var label = $(this);
221
+ var name = $(this).closest('tr').siblings('tr.field_name').find('input.name');
222
+
223
+ if(name.val() == '')
224
+ {
225
+ var val = label.val().toLowerCase().split(' ').join('_').split('\'').join('');
226
+ name.val(val);
227
+ name.trigger('keyup');
228
+ }
229
  });
230
+
231
+
232
+ // update field text when typing
233
+ $('.field_form tr.field_label input.label').live('keyup', function()
234
+ {
235
+ var val = $(this).val();
236
+ var name = $(this).closest('.field').find('td.field_label strong a').first().html(val);
237
+ });
238
+ $('.field_form tr.field_name input.name').live('keyup', function()
239
+ {
240
+ var val = $(this).val();
241
+ var name = $(this).closest('.field').find('td.field_name').first().html(val);
242
+ });
243
+ $('.field_form tr.field_type select.type').live('change', function()
244
+ {
245
+ var val = $(this).val();
246
+ var name = $(this).closest('.field').find('td.field_type').first().html(val);
247
  });
248
+
249
+
250
+ // sortable
251
+ $('.fields').sortable({
252
+ update: function(event, ui){update_order_numbers();},
253
+ handle: 'td.field_order'
254
+ });
255
+
256
  }
 
257
 
258
+ /*--------------------------------------------------------------------------
259
  Document Ready
260
+ --------------------------------------------------------------------------*/
261
  $(document).ready(function(){
262
+
263
+ setup_fields();
264
+
265
+ //$('div.postbox#acf_fields .fields').each(function(){
266
+ //$(this).make_acf();
267
+ //});
268
 
 
 
 
 
 
 
 
 
 
269
 
270
  $('div.postbox a.help').click(function(){
271
  $('div.postbox .help_box_mask').animate({'height':'toggle'}, 500);
js/functions.info.js DELETED
@@ -1,9 +0,0 @@
1
- jQuery(document).ready(function($){
2
-
3
- $('.wrap').wrapInner('<div class="cfm_col_left" />');
4
- $('.wrap').wrapInner('<div class="cfm_cols" />');
5
- //$('.cfm_col_left div.clear').remove();
6
- $('.cfm_col_right').removeClass('hidden').prependTo('.cfm_cols');
7
-
8
- });
9
-
 
 
 
 
 
 
 
 
 
js/functions.input.js CHANGED
@@ -1,14 +1,17 @@
1
  (function($){
2
 
3
  // exists
4
- $.fn.exists = function(){return jQuery(this).length>0;}
 
 
 
5
 
6
  // vars
7
- var wysiwyg_count = 0;
8
- var post_id = 0;
9
-
10
- // global vars
11
- window.acf_div = null;
12
 
13
 
14
  /*-------------------------------------------
@@ -21,7 +24,7 @@
21
  //alert(id);
22
  $(this).find('textarea').attr('id',id);
23
  tinyMCE.execCommand('mceAddControl', false, id);
24
- }
25
 
26
  /*-------------------------------------------
27
  Datepicker
@@ -89,7 +92,7 @@
89
  }
90
 
91
  screen_options.find('label[for=acf_input-hide]').hide();
92
- }
93
 
94
  /*-------------------------------------------
95
  Image Upload
@@ -105,10 +108,10 @@
105
 
106
 
107
  // show the thickbox
108
- tb_show('Add Image to field', 'media-upload.php?post_id='+post_id+'&type=image&acf_type=image&TB_iframe=1');
109
-
110
-
111
- return false;
112
  });
113
 
114
 
@@ -119,7 +122,7 @@
119
 
120
  return false;
121
  });
122
- }
123
 
124
 
125
  /*-------------------------------------------
@@ -137,9 +140,9 @@
137
 
138
 
139
  // show the thickbox
140
- tb_show('Add File to field', 'media-upload.php?post_id='+post_id+'&type=file&acf_type=file&TB_iframe=1');
141
-
142
-
143
  return false;
144
  });
145
 
@@ -152,10 +155,222 @@
152
 
153
  return false;
154
  });
155
- }
156
 
157
 
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
 
160
  $.fn.make_all_fields = function()
161
  {
@@ -180,7 +395,45 @@
180
  div.find('.acf_file_uploader').each(function(){
181
  $(this).make_acf_file();
182
  });
183
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
185
 
186
  /*-------------------------------------------
@@ -199,9 +452,17 @@
199
  }
200
 
201
 
 
202
  div.hide_meta_boxes();
 
203
  div.make_all_fields();
204
 
 
 
 
 
 
 
205
  });
206
 
207
  })(jQuery);
1
  (function($){
2
 
3
  // exists
4
+ $.fn.exists = function()
5
+ {
6
+ return $(this).length>0;
7
+ };
8
 
9
  // vars
10
+ var wysiwyg_count = 0;
11
+ var post_id = 0;
12
+
13
+ // global vars
14
+ window.acf_div = null;
15
 
16
 
17
  /*-------------------------------------------
24
  //alert(id);
25
  $(this).find('textarea').attr('id',id);
26
  tinyMCE.execCommand('mceAddControl', false, id);
27
+ };
28
 
29
  /*-------------------------------------------
30
  Datepicker
92
  }
93
 
94
  screen_options.find('label[for=acf_input-hide]').hide();
95
+ };
96
 
97
  /*-------------------------------------------
98
  Image Upload
108
 
109
 
110
  // show the thickbox
111
+ tb_show('Add Image to field', 'media-upload.php?post_id='+post_id+'&type=image&acf_type=image&TB_iframe=1');
112
+
113
+
114
+ return false;
115
  });
116
 
117
 
122
 
123
  return false;
124
  });
125
+ };
126
 
127
 
128
  /*-------------------------------------------
140
 
141
 
142
  // show the thickbox
143
+ tb_show('Add File to field', 'media-upload.php?post_id='+post_id+'&type=file&acf_type=file&TB_iframe=1');
144
+
145
+
146
  return false;
147
  });
148
 
155
 
156
  return false;
157
  });
158
+ };
159
 
160
 
161
 
162
+ /*-------------------------------------------
163
+ Repeaters
164
+ -------------------------------------------*/
165
+ $.fn.make_acf_repeater = function(){
166
+
167
+ // vars
168
+ var div = $(this);
169
+ var add_field = div.find('a#add_field');
170
+ var row_limit = parseInt(div.children('input[name="row_limit"]').val());
171
+
172
+
173
+ /*-------------------------------------------
174
+ Add Field Button
175
+ -------------------------------------------*/
176
+ add_field.unbind("click").click(function(){
177
+
178
+ var field_count = div.children('table').children('tbody').children('tr').length;
179
+ if(field_count >= row_limit)
180
+ {
181
+ // reached row limit!
182
+
183
+ add_field.attr('disabled','true');
184
+ return false;
185
+ }
186
+
187
+ // clone last tr
188
+ var new_field = div.children('table').children('tbody').children('tr').last().clone(false);
189
+
190
+ // append to table
191
+ div.children('table').children('tbody').append(new_field);
192
+
193
+ // set new field
194
+ new_field.reset_values();
195
+
196
+ // re make special fields
197
+ new_field.make_all_fields();
198
+
199
+ // update order numbers
200
+ update_order_numbers();
201
+
202
+ if(div.children('table').children('tbody').children('tr').length > 1)
203
+ {
204
+ div.removeClass('hide_remove_buttons');
205
+ }
206
+
207
+ if((field_count+1) >= row_limit)
208
+ {
209
+ // reached row limit!
210
+ add_field.attr('disabled','true');
211
+ }
212
+
213
+ return false;
214
+
215
+ });
216
+
217
+ div.add_remove_buttons();
218
+ div.make_sortable();
219
+
220
+ if(div.children('table').children('tbody').children('tr').length == 1)
221
+ {
222
+ div.addClass('hide_remove_buttons');
223
+ }
224
+
225
+ var field_count = div.children('table').children('tbody').children('tr').length;
226
+ if(field_count >= row_limit)
227
+ {
228
+ add_field.attr('disabled','true');
229
+ }
230
+
231
+ };
232
+
233
+
234
+ /*-------------------------------------------
235
+ Update Order Numbers
236
+ -------------------------------------------*/
237
+ function update_order_numbers(){
238
+ $('.postbox#acf_input .repeater').each(function(){
239
+ $(this).children('table').children('tbody').children('tr').each(function(i){
240
+ $(this).children('td.order').html(i+1);
241
+ });
242
+
243
+ });
244
+ }
245
+
246
+ /*-------------------------------------------
247
+ Sortable
248
+ -------------------------------------------*/
249
+ $.fn.make_sortable = function(){
250
+
251
+ //alert('make sortable');
252
+ var div = $(this);
253
+
254
+ var fixHelper = function(e, ui) {
255
+ ui.children().each(function() {
256
+ $(this).width($(this).width());
257
+ });
258
+ return ui;
259
+ };
260
+
261
+ div.children('table').children('tbody').unbind('sortable').sortable({
262
+ update: function(event, ui){
263
+ update_order_numbers();
264
+ $(this).make_all_fields();
265
+ //alert('update');
266
+ },
267
+ handle: 'td.order',
268
+ helper: fixHelper,
269
+ //pre process stuff as soon as the element has been lifted
270
+ start: function(event, ui)
271
+ {
272
+ //console.log(ui.item);
273
+ if(ui.item.find('.acf_wysiwyg').exists())
274
+ {
275
+ //console.log('aaaah, i found a wysiwyg')
276
+ var id = ui.item.find('.acf_wysiwyg textarea').attr('id');
277
+ //alert(tinyMCE.get(id).getContent());
278
+ tinyMCE.execCommand("mceRemoveControl", false, id);
279
+ }
280
+ },
281
+
282
+ //post process stuff as soon as the element has been dropped
283
+ stop: function(event, ui)
284
+ {
285
+ if(ui.item.find('.acf_wysiwyg').exists())
286
+ {
287
+ var id = ui.item.find('.acf_wysiwyg textarea').attr('id');
288
+ tinyMCE.execCommand("mceAddControl", false, id);
289
+ //div.make_sortable();
290
+ }
291
+ }
292
+ });
293
+ }
294
+
295
+
296
+
297
+ /*-------------------------------------------
298
+ Reset Values
299
+ -------------------------------------------*/
300
+ $.fn.reset_values = function(){
301
+
302
+ var div = $(this);
303
+
304
+
305
+ if(div.find('.acf_wysiwyg').exists())
306
+ {
307
+ var wysiwyg = $(this).find('.acf_wysiwyg');
308
+
309
+ var name = wysiwyg.find('textarea').first().attr('name');
310
+
311
+ wysiwyg.html('<textarea name="'+name+'"></textarea>');
312
+ }
313
+
314
+
315
+ // image upload
316
+ div.find('.acf_image_uploader').each(function(){
317
+ $(this).removeClass('active');
318
+ });
319
+
320
+
321
+ // file upload
322
+ div.find('.acf_file_uploader').each(function(){
323
+ $(this).removeClass('active');
324
+ });
325
+
326
+
327
+ // date picker
328
+ div.find('.acf_datepicker').each(function(){
329
+ $(this).removeClass('hasDatepicker');
330
+ });
331
+
332
+
333
+
334
+
335
+ // total fields
336
+ var total_fields = $(this).siblings('tr').length;
337
+
338
+
339
+ // reset all values
340
+ $(this).find('[name]').each(function()
341
+ {
342
+ var name = $(this).attr('name').replace('[value]['+(total_fields-1)+']','[value]['+(total_fields)+']');
343
+ $(this).attr('name', name);
344
+ $(this).attr('id', name);
345
+
346
+ if(name.indexOf("[field_id]") != -1)
347
+ {
348
+ // do nothing, we want to keep this hidden field with it's current values
349
+ }
350
+ else if(name.indexOf("[field_type]") != -1)
351
+ {
352
+ // do nothing, we want to keep this hidden field with it's current values
353
+ }
354
+ else
355
+ {
356
+ $(this).val('');
357
+ }
358
+
359
+ // selected / ticked
360
+ if($(this).is(':selected'))
361
+ {
362
+ $(this).removeAttr('selected');
363
+
364
+ }
365
+ else if($(this).is(':checked'))
366
+ {
367
+ $(this).removeAttr('checked');
368
+ }
369
+
370
+ });
371
+
372
+
373
+ };
374
 
375
  $.fn.make_all_fields = function()
376
  {
395
  div.find('.acf_file_uploader').each(function(){
396
  $(this).make_acf_file();
397
  });
398
+ };
399
+
400
+
401
+ /*-------------------------------------------
402
+ Remove Field Button
403
+ -------------------------------------------*/
404
+ $.fn.add_remove_buttons = function(){
405
+ $(this).find('a.remove_field').unbind('click').live('click', function(){
406
+
407
+ var total_fields = $(this).closest('.repeater').children('table').children('tbody').children('tr').length;
408
+
409
+ // needs at least one
410
+ if(total_fields <= 1)
411
+ {
412
+ return false;
413
+ }
414
+ else if(total_fields == 2)
415
+ {
416
+ // total fields will be 1 after the tr is removed
417
+ $(this).parents('.repeater').addClass('hide_remove_buttons');
418
+ }
419
+
420
+ var tr = $(this).closest('tr');
421
+
422
+ tr.animate({'opacity':'0'}, 300,function(){
423
+ tr.remove();
424
+ update_order_numbers();
425
+ });
426
+
427
+
428
+ $(this).closest('.repeater').find('a#add_field').removeAttr('disabled');
429
+
430
+
431
+ return false;
432
+
433
+ });
434
+ };
435
+
436
+
437
 
438
 
439
  /*-------------------------------------------
452
  }
453
 
454
 
455
+ // hide meta boxes
456
  div.hide_meta_boxes();
457
+
458
  div.make_all_fields();
459
 
460
+ // repeater
461
+ div.find('.repeater').each(function(){
462
+ $(this).make_acf_repeater();
463
+ });
464
+
465
+
466
  });
467
 
468
  })(jQuery);
js/functions.screen_extra.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ $.fn.exists = function()
4
+ {
5
+ return jQuery(this).length>0;
6
+ };
7
+
8
+ $(document).ready(function(){
9
+
10
+ // add new buttons to screen meta
11
+ $('#contextual-help-link-wrap').each(function(){
12
+ $(this).hide();
13
+ });
14
+ $('.screen-meta-toggle.acf').each(function(){
15
+ $('#screen-meta-links').append($(this));
16
+ });
17
+
18
+ $('.screen-meta-wrap.acf').each(function() {
19
+ $('#screen-meta-links').before($(this));
20
+ });
21
+
22
+ $('#screen-meta-links a#screen-meta-activate-acf-link').unbind('click').click(function() {
23
+ var a = $(this);
24
+ $(a.attr('href')+'-wrap').slideToggle('fast', function() {
25
+ if (a.hasClass('screen-meta-shown')) {
26
+ a.css({'background-position':'right top'}).removeClass('screen-meta-shown');
27
+ $('.screen-meta-toggle').css('visibility', 'visible');
28
+ }
29
+ else {
30
+ $('.screen-meta-toggle').css('visibility', 'hidden');
31
+ a.css({'background-position':'right bottom'}).addClass('screen-meta-shown').parent().css('visibility', 'visible');
32
+ }
33
+ });
34
+ return false;
35
+ });
36
+
37
+
38
+ $('.acf_col_right').each(function(){
39
+
40
+ $('.wrap').wrapInner('<div class="acf_col_left" />');
41
+ $('.wrap').wrapInner('<div class="acf_cols" />');
42
+ $(this).removeClass('hidden').prependTo('.acf_cols');
43
+
44
+ });
45
+
46
+
47
+ });
48
+
49
+ })(jQuery);
lang/advanced-custom-fields.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/advanced-custom-fields\n"
7
- "POT-Creation-Date: 2011-04-26 07:11:21+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -12,97 +12,89 @@ msgstr ""
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: acf.php:173
16
  msgid "Adv Custom Fields"
17
  msgstr ""
18
 
19
- #: acf.php:177 core/acf_post_type.php:4
20
  msgid "Advanced&nbsp;Custom&nbsp;Fields"
21
  msgstr ""
22
 
23
- #: acf.php:262 acf.php:280
24
  msgid "Error: Field Type does not exist!"
25
  msgstr ""
26
 
27
- #: core/info_meta_box.php:5
28
- msgid "Advanced Custom Fields v"
29
  msgstr ""
30
 
31
- #: core/info_meta_box.php:6
32
- msgid "see what's new"
33
- msgstr ""
34
-
35
- #: core/info_meta_box.php:15
36
- msgid "User Guide + Code Examples"
37
  msgstr ""
38
 
39
- #: core/info_meta_box.php:15
40
- msgid "Visit the Plugin Website"
41
- msgstr ""
42
-
43
- #: core/info_meta_box.php:25
44
- msgid "Need Help?"
45
  msgstr ""
46
 
47
- #: core/info_meta_box.php:25
48
- msgid "Visit the Support Forum"
49
  msgstr ""
50
 
51
- #: core/info_meta_box.php:38
52
- msgid "Help fund future development"
53
  msgstr ""
54
 
55
- #: core/info_meta_box.php:51
56
- msgid "Created by"
57
  msgstr ""
58
 
59
- #: core/fields_meta_box.php:26
60
- msgid "Label"
 
 
61
  msgstr ""
62
 
63
- #: core/fields_meta_box.php:26
64
- msgid "Shown on the edit page (eg. Hero Image)"
65
  msgstr ""
66
 
67
- #: core/fields_meta_box.php:27
68
- msgid "Name"
 
 
 
69
  msgstr ""
70
 
71
- #: core/fields_meta_box.php:27
72
- msgid "Used as variable name (eg. hero_image)"
73
  msgstr ""
74
 
75
- #: core/fields_meta_box.php:28
76
- msgid "Field Type"
77
  msgstr ""
78
 
79
- #: core/fields_meta_box.php:28
80
- msgid "Type of field"
81
  msgstr ""
82
 
83
- #: core/fields_meta_box.php:102
84
- msgid "+ Add Field"
85
  msgstr ""
86
 
87
- #: core/options_meta_box.php:18
88
- msgid "Show on page"
89
  msgstr ""
90
 
91
- #: core/options_meta_box.php:43
92
- msgid ""
93
- "Select the metaboxes you wish to keep on your edit screen.<br />\n"
94
- "\t\t\tTip: This is useful to customise the edit screen"
95
  msgstr ""
96
 
97
- #: core/options_meta_box.php:49
98
- msgid "Filter Users"
99
  msgstr ""
100
 
101
- #: core/options_meta_box.php:72
102
- msgid ""
103
- "Select user types to give them access to this ACF<br />\n"
104
- "\t\t\tTip: If no user types are selected, all user's will have access to "
105
- "this ACF"
106
  msgstr ""
107
 
108
  #: core/acf_post_type.php:5
@@ -110,35 +102,35 @@ msgid "Advanced Custom Fields"
110
  msgstr ""
111
 
112
  #: core/acf_post_type.php:6
113
- msgid "Search Advanced Custom Fields"
114
  msgstr ""
115
 
116
  #: core/acf_post_type.php:7
117
- msgid "All Advanced Custom Fields"
118
  msgstr ""
119
 
120
  #: core/acf_post_type.php:8
121
- msgid "Parent Advanced Custom Fields"
122
  msgstr ""
123
 
124
  #: core/acf_post_type.php:9
125
- msgid "Parent Advanced Custom Fields:"
126
  msgstr ""
127
 
128
  #: core/acf_post_type.php:10
129
- msgid "Edit Advanced Custom Fields"
130
  msgstr ""
131
 
132
  #: core/acf_post_type.php:11
133
- msgid "Update Advanced Custom Fields"
134
  msgstr ""
135
 
136
  #: core/acf_post_type.php:12
137
- msgid "Add New Advanced Custom Fields"
138
  msgstr ""
139
 
140
  #: core/acf_post_type.php:13
141
- msgid "New Advanced Custom Fields Name"
142
  msgstr ""
143
 
144
  #: core/location_meta_box.php:16
@@ -150,7 +142,9 @@ msgid "The values you enter bellow will be used to match against edit screens"
150
  msgstr ""
151
 
152
  #: core/location_meta_box.php:19
153
- msgid "If any of the values match the edit screen, this ACF will be used"
 
 
154
  msgstr ""
155
 
156
  #: core/location_meta_box.php:20
@@ -169,29 +163,25 @@ msgstr ""
169
  msgid "Post Type's"
170
  msgstr ""
171
 
172
- #: core/location_meta_box.php:62
173
  msgid ""
174
- "Selecting a post type here will add this ACF to all edit screens of that "
175
- "post type.<br />(if your custom post type does not appear, make sure it is "
176
- "publicly query-able)<br /><br />\n"
177
- "\t\t\tTip: Unselect post types and use the options below to customise your "
178
- "ACF location!<br />\n"
179
- "\t\t\t(command+click)"
180
  msgstr ""
181
 
182
- #: core/location_meta_box.php:69
183
  msgid "Page Title's"
184
  msgstr ""
185
 
186
- #: core/location_meta_box.php:84
187
  msgid "eg. Home, About Us"
188
  msgstr ""
189
 
190
- #: core/location_meta_box.php:89
191
  msgid "Page Slug's"
192
  msgstr ""
193
 
194
- #: core/location_meta_box.php:104
195
  msgid "eg. home, about-us"
196
  msgstr ""
197
 
@@ -199,64 +189,71 @@ msgstr ""
199
  msgid "Post ID's"
200
  msgstr ""
201
 
202
- #: core/location_meta_box.php:124 core/location_meta_box.php:164
203
  msgid "eg. 1, 2, 3"
204
  msgstr ""
205
 
206
- #: core/location_meta_box.php:129
207
  msgid "Page Template's"
208
  msgstr ""
209
 
210
- #: core/location_meta_box.php:144
211
  msgid "eg. home_page.php"
212
  msgstr ""
213
 
214
- #: core/location_meta_box.php:149
215
  msgid "Page Parent ID's"
216
  msgstr ""
217
 
218
- #: core/location_meta_box.php:169
 
 
 
 
 
 
 
 
219
  msgid "Overrides"
220
  msgstr ""
221
 
222
- #: core/location_meta_box.php:186
223
  msgid ""
224
- "Tick this box to remove all other ACF's <br />(from the edit screen where "
225
- "this ACF appears)"
226
  msgstr ""
227
 
228
  #: core/fields/post_object.php:12
229
  msgid "Post Object"
230
  msgstr ""
231
 
232
- #: core/fields/post_object.php:48 core/fields/page_link.php:58
233
  msgid "Select Option"
234
  msgstr ""
235
 
236
- #: core/fields/post_object.php:123 core/fields/page_link.php:136
237
  msgid "Post Type"
238
  msgstr ""
239
 
240
- #: core/fields/post_object.php:148
241
  msgid ""
242
  "Filter posts by selecting a post type<br />\n"
243
- "\t\t\t\t* unselecting all is the same as selecting all"
244
  msgstr ""
245
 
246
- #: core/fields/post_object.php:154 core/fields/select.php:92
247
- #: core/fields/page_link.php:167
248
- msgid "Multiple?"
249
  msgstr ""
250
 
251
  #: core/fields/date_picker/date_picker.php:12
252
  msgid "Date Picker"
253
  msgstr ""
254
 
255
- #: core/fields/date_picker/date_picker.php:31
256
  msgid "Date format"
257
  msgstr ""
258
 
259
- #: core/fields/date_picker/date_picker.php:35
260
  msgid "eg. dd/mm/yy. read more about"
261
  msgstr ""
262
 
@@ -268,15 +265,15 @@ msgstr ""
268
  msgid "Image"
269
  msgstr ""
270
 
271
- #: core/fields/image.php:51
272
  msgid "Select Image"
273
  msgstr ""
274
 
275
- #: core/fields/image.php:74
276
  msgid "No image selected"
277
  msgstr ""
278
 
279
- #: core/fields/image.php:74
280
  msgid "Add Image"
281
  msgstr ""
282
 
@@ -284,31 +281,36 @@ msgstr ""
284
  msgid "Select"
285
  msgstr ""
286
 
287
- #: core/fields/select.php:80 core/fields/checkbox.php:70
288
  msgid "Choices"
289
  msgstr ""
290
 
291
- #: core/fields/select.php:84 core/fields/checkbox.php:74
292
  msgid ""
293
- "Enter your choices one per line. eg:<br />\n"
294
- "\t\t\t\toption_1 : Option 1<br />\n"
295
- "\t\t\t\toption_3 : Option 2<br />\n"
296
- "\t\t\t\toption_3 : Option 3"
 
 
 
 
 
297
  msgstr ""
298
 
299
- #: core/fields/true_false.php:11
300
- msgid "True / False"
301
  msgstr ""
302
 
303
- #: core/fields/true_false.php:19
304
- msgid "True"
305
  msgstr ""
306
 
307
- #: core/fields/true_false.php:60
308
  msgid "Message"
309
  msgstr ""
310
 
311
- #: core/fields/true_false.php:64
312
  msgid "eg. Show extra content"
313
  msgstr ""
314
 
@@ -316,14 +318,20 @@ msgstr ""
316
  msgid "Wysiwyg Editor"
317
  msgstr ""
318
 
319
- #: core/fields/page_link.php:13
320
  msgid "Page Link"
321
  msgstr ""
322
 
323
- #: core/fields/page_link.php:161
324
- msgid ""
325
- "Filter posts by selecting a post type<br />\n"
326
- "\t\t\t\tTip: deselect all post types to show all post type's posts"
 
 
 
 
 
 
327
  msgstr ""
328
 
329
  #: core/fields/checkbox.php:11
@@ -338,18 +346,18 @@ msgstr ""
338
  msgid "File"
339
  msgstr ""
340
 
341
- #: core/fields/file.php:51
342
  msgid "Select File"
343
  msgstr ""
344
 
345
- #: core/fields/file.php:74
346
  msgid "Remove File"
347
  msgstr ""
348
 
349
- #: core/fields/file.php:76
350
  msgid "No File selected"
351
  msgstr ""
352
 
353
- #: core/fields/file.php:76
354
  msgid "Add File"
355
  msgstr ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/advanced-custom-fields\n"
7
+ "POT-Creation-Date: 2011-05-21 23:59:47+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: acf.php:187
16
  msgid "Adv Custom Fields"
17
  msgstr ""
18
 
19
+ #: acf.php:191 core/acf_post_type.php:4
20
  msgid "Advanced&nbsp;Custom&nbsp;Fields"
21
  msgstr ""
22
 
23
+ #: acf.php:282 acf.php:300
24
  msgid "Error: Field Type does not exist!"
25
  msgstr ""
26
 
27
+ #: core/fields_meta_box.php:36 core/fields/repeater.php:140
28
+ msgid "Field Order"
29
  msgstr ""
30
 
31
+ #: core/fields_meta_box.php:37 core/fields/repeater.php:141
32
+ msgid "Field Label"
 
 
 
 
33
  msgstr ""
34
 
35
+ #: core/fields_meta_box.php:38 core/fields/repeater.php:142
36
+ msgid "Field Name"
 
 
 
 
37
  msgstr ""
38
 
39
+ #: core/fields_meta_box.php:39 core/fields/repeater.php:143
40
+ msgid "Field Type"
41
  msgstr ""
42
 
43
+ #: core/fields_meta_box.php:172
44
+ msgid "+ Add Field"
45
  msgstr ""
46
 
47
+ #: core/options_meta_box.php:18
48
+ msgid "Show on page"
49
  msgstr ""
50
 
51
+ #: core/options_meta_box.php:43
52
+ msgid ""
53
+ "Select the metaboxes you wish to keep on your edit screen.<br />\n"
54
+ "\t\t\tTip: This is useful to customise the edit screen"
55
  msgstr ""
56
 
57
+ #: core/options_meta_box.php:49
58
+ msgid "Show only for specific users"
59
  msgstr ""
60
 
61
+ #: core/options_meta_box.php:71
62
+ msgid ""
63
+ "Select user types to give them access to this ACF<br />\n"
64
+ "\t\t\tTip: If no user types are selected, all user's will have access to "
65
+ "this ACF"
66
  msgstr ""
67
 
68
+ #: core/screen_extra.php:64
69
+ msgid "Advanced Custom Fields v"
70
  msgstr ""
71
 
72
+ #: core/screen_extra.php:65
73
+ msgid "see what's new"
74
  msgstr ""
75
 
76
+ #: core/screen_extra.php:76
77
+ msgid "User Guide + Code Examples"
78
  msgstr ""
79
 
80
+ #: core/screen_extra.php:76
81
+ msgid "Visit the Plugin Website"
82
  msgstr ""
83
 
84
+ #: core/screen_extra.php:86
85
+ msgid "Need Help?"
86
  msgstr ""
87
 
88
+ #: core/screen_extra.php:86
89
+ msgid "Visit the Support Forum"
 
 
90
  msgstr ""
91
 
92
+ #: core/screen_extra.php:99
93
+ msgid "Help fund future development"
94
  msgstr ""
95
 
96
+ #: core/screen_extra.php:112
97
+ msgid "Created by"
 
 
 
98
  msgstr ""
99
 
100
  #: core/acf_post_type.php:5
102
  msgstr ""
103
 
104
  #: core/acf_post_type.php:6
105
+ msgid "Add New"
106
  msgstr ""
107
 
108
  #: core/acf_post_type.php:7
109
+ msgid "Add New Advanced Custom Field Group"
110
  msgstr ""
111
 
112
  #: core/acf_post_type.php:8
113
+ msgid "Edit Advanced Custom Field Group"
114
  msgstr ""
115
 
116
  #: core/acf_post_type.php:9
117
+ msgid "New Advanced Custom Field Group"
118
  msgstr ""
119
 
120
  #: core/acf_post_type.php:10
121
+ msgid "View Advanced Custom Field Group"
122
  msgstr ""
123
 
124
  #: core/acf_post_type.php:11
125
+ msgid "Search Advanced Custom Field Groups"
126
  msgstr ""
127
 
128
  #: core/acf_post_type.php:12
129
+ msgid "No Advanced Custom Field Groups found"
130
  msgstr ""
131
 
132
  #: core/acf_post_type.php:13
133
+ msgid "No Advanced Custom Field Groups found in Trash"
134
  msgstr ""
135
 
136
  #: core/location_meta_box.php:16
142
  msgstr ""
143
 
144
  #: core/location_meta_box.php:19
145
+ msgid ""
146
+ "If <strong>any</strong> of the values match the edit screen, this ACF will "
147
+ "be used"
148
  msgstr ""
149
 
150
  #: core/location_meta_box.php:20
163
  msgid "Post Type's"
164
  msgstr ""
165
 
166
+ #: core/location_meta_box.php:33
167
  msgid ""
168
+ "Selecting a post type here will add this ACF to <strong>all</strong> edit "
169
+ "screens of that post type."
 
 
 
 
170
  msgstr ""
171
 
172
+ #: core/location_meta_box.php:67
173
  msgid "Page Title's"
174
  msgstr ""
175
 
176
+ #: core/location_meta_box.php:68
177
  msgid "eg. Home, About Us"
178
  msgstr ""
179
 
180
+ #: core/location_meta_box.php:88
181
  msgid "Page Slug's"
182
  msgstr ""
183
 
184
+ #: core/location_meta_box.php:89
185
  msgid "eg. home, about-us"
186
  msgstr ""
187
 
189
  msgid "Post ID's"
190
  msgstr ""
191
 
192
+ #: core/location_meta_box.php:110 core/location_meta_box.php:152
193
  msgid "eg. 1, 2, 3"
194
  msgstr ""
195
 
196
+ #: core/location_meta_box.php:130
197
  msgid "Page Template's"
198
  msgstr ""
199
 
200
+ #: core/location_meta_box.php:131
201
  msgid "eg. home_page.php"
202
  msgstr ""
203
 
204
+ #: core/location_meta_box.php:151
205
  msgid "Page Parent ID's"
206
  msgstr ""
207
 
208
+ #: core/location_meta_box.php:172
209
+ msgid "Category Names's"
210
+ msgstr ""
211
+
212
+ #: core/location_meta_box.php:173
213
+ msgid "eg. News, Media, Uncategoriazed"
214
+ msgstr ""
215
+
216
+ #: core/location_meta_box.php:193
217
  msgid "Overrides"
218
  msgstr ""
219
 
220
+ #: core/location_meta_box.php:194
221
  msgid ""
222
+ "Tick this box to remove all other ACF's (from the edit screen where this ACF "
223
+ "appears)"
224
  msgstr ""
225
 
226
  #: core/fields/post_object.php:12
227
  msgid "Post Object"
228
  msgstr ""
229
 
230
+ #: core/fields/post_object.php:48 core/fields/page_link.php:57
231
  msgid "Select Option"
232
  msgstr ""
233
 
234
+ #: core/fields/post_object.php:132 core/fields/page_link.php:144
235
  msgid "Post Type"
236
  msgstr ""
237
 
238
+ #: core/fields/post_object.php:133 core/fields/page_link.php:145
239
  msgid ""
240
  "Filter posts by selecting a post type<br />\n"
241
+ "\t\t\t\tTip: deselect all post types to show all post type's posts"
242
  msgstr ""
243
 
244
+ #: core/fields/post_object.php:165
245
+ msgid "Select multiple posts?"
 
246
  msgstr ""
247
 
248
  #: core/fields/date_picker/date_picker.php:12
249
  msgid "Date Picker"
250
  msgstr ""
251
 
252
+ #: core/fields/date_picker/date_picker.php:32
253
  msgid "Date format"
254
  msgstr ""
255
 
256
+ #: core/fields/date_picker/date_picker.php:33
257
  msgid "eg. dd/mm/yy. read more about"
258
  msgstr ""
259
 
265
  msgid "Image"
266
  msgstr ""
267
 
268
+ #: core/fields/image.php:82
269
  msgid "Select Image"
270
  msgstr ""
271
 
272
+ #: core/fields/image.php:143
273
  msgid "No image selected"
274
  msgstr ""
275
 
276
+ #: core/fields/image.php:143
277
  msgid "Add Image"
278
  msgstr ""
279
 
281
  msgid "Select"
282
  msgstr ""
283
 
284
+ #: core/fields/select.php:89 core/fields/checkbox.php:74
285
  msgid "Choices"
286
  msgstr ""
287
 
288
+ #: core/fields/select.php:90 core/fields/checkbox.php:75
289
  msgid ""
290
+ "Enter your choices one per line<br />\n"
291
+ "\t\t\t\t<br />\n"
292
+ "\t\t\t\tRed<br />\n"
293
+ "\t\t\t\tBlue<br />\n"
294
+ "\t\t\t\t<br />\n"
295
+ "\t\t\t\tor<br />\n"
296
+ "\t\t\t\t<br />\n"
297
+ "\t\t\t\tred : Red<br />\n"
298
+ "\t\t\t\tblue : Blue"
299
  msgstr ""
300
 
301
+ #: core/fields/select.php:107 core/fields/page_link.php:178
302
+ msgid "Select multiple values?"
303
  msgstr ""
304
 
305
+ #: core/fields/true_false.php:11
306
+ msgid "True / False"
307
  msgstr ""
308
 
309
+ #: core/fields/true_false.php:64
310
  msgid "Message"
311
  msgstr ""
312
 
313
+ #: core/fields/true_false.php:65
314
  msgid "eg. Show extra content"
315
  msgstr ""
316
 
318
  msgid "Wysiwyg Editor"
319
  msgstr ""
320
 
321
+ #: core/fields/page_link.php:12
322
  msgid "Page Link"
323
  msgstr ""
324
 
325
+ #: core/fields/repeater.php:13
326
+ msgid "Repeater"
327
+ msgstr ""
328
+
329
+ #: core/fields/repeater.php:133
330
+ msgid "Repeater Fields"
331
+ msgstr ""
332
+
333
+ #: core/fields/repeater.php:272
334
+ msgid "Row Limit"
335
  msgstr ""
336
 
337
  #: core/fields/checkbox.php:11
346
  msgid "File"
347
  msgstr ""
348
 
349
+ #: core/fields/file.php:82
350
  msgid "Select File"
351
  msgstr ""
352
 
353
+ #: core/fields/file.php:143
354
  msgid "Remove File"
355
  msgstr ""
356
 
357
+ #: core/fields/file.php:145
358
  msgid "No File selected"
359
  msgstr ""
360
 
361
+ #: core/fields/file.php:145
362
  msgid "Add File"
363
  msgstr ""
readme.txt CHANGED
@@ -1,12 +1,12 @@
1
  === Advanced Custom Fields ===
2
  Contributors: Elliot Condon
3
  Donate link: https://www.paypal.com/au/cgi-bin/webscr?cmd=_flow&SESSION=-B2MHZ-ioHQb-z1o22AMmhjSI08rxFqQdljyfqVa1R-4QrbQWPNcfL37jYi&dispatch=5885d80a13c0db1f8e263663d3faee8d5fa8ff279e37c3d9d4e38bdbee0ede69
4
- Tags: custom, field, custom field, advanced, simple fields, magic fields, more fields, post, type, text, textarea, file, image, edit, admin
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
  Stable tag: 3.1
8
 
9
- Completely Customise your edit pages with an assortment of field types: Wysiwyg, text, image, select, checkbox, page link, post object and more! Hide unwanted metaboxes and assign to any edit page!
10
 
11
  == Description ==
12
 
@@ -32,6 +32,7 @@ Advanced Custom Fields is the perfect solution for any wordpress website which n
32
  * Post Object (select 1 or more page, post or custom post types, api returns post objects)
33
  * Date Picker (jquery date picker, options for format, api returns string)
34
  * True / False (tick box with message, api returns true or false)
 
35
 
36
  = Tested on =
37
  * Mac Firefox :)
@@ -80,6 +81,14 @@ http://support.plugins.elliotcondon.com/categories/advanced-custom-fields/
80
 
81
  == Changelog ==
82
 
 
 
 
 
 
 
 
 
83
  = 1.1.4 =
84
  * Fixed Image / File upload issues
85
  * Location now supports category names
1
  === Advanced Custom Fields ===
2
  Contributors: Elliot Condon
3
  Donate link: https://www.paypal.com/au/cgi-bin/webscr?cmd=_flow&SESSION=-B2MHZ-ioHQb-z1o22AMmhjSI08rxFqQdljyfqVa1R-4QrbQWPNcfL37jYi&dispatch=5885d80a13c0db1f8e263663d3faee8d5fa8ff279e37c3d9d4e38bdbee0ede69
4
+ Tags: custom, field, custom field, advanced, simple fields, magic fields, more fields, repeater, matrix, post, type, text, textarea, file, image, edit, admin
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
  Stable tag: 3.1
8
 
9
+ Completely Customise your edit pages with an assortment of field types: Wysiwyg, Repeater, text, image, select, checkbox, page link, post object and more! Hide unwanted metaboxes and assign to any edit page!
10
 
11
  == Description ==
12
 
32
  * Post Object (select 1 or more page, post or custom post types, api returns post objects)
33
  * Date Picker (jquery date picker, options for format, api returns string)
34
  * True / False (tick box with message, api returns true or false)
35
+ * Repeater (ability to create repeatable blocks of fields!)
36
 
37
  = Tested on =
38
  * Mac Firefox :)
81
 
82
  == Changelog ==
83
 
84
+ =2.0.0=
85
+ * Completely re-designed the ACF edit page
86
+ * Added repeater field (unlocked through external purchase)
87
+ * Fixed minor js bugs
88
+ * Fixed PHP error handling
89
+ * Fixed problem with update script not running
90
+ * General js + css improvements
91
+
92
  = 1.1.4 =
93
  * Fixed Image / File upload issues
94
  * Location now supports category names
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file