Advanced Custom Fields - Version 2.0.1

Version Description

Download this release

Release Info

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

Code changes from version 2.0.0 to 2.0.1

acf.php CHANGED
@@ -3,7 +3,7 @@
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
@@ -36,7 +36,7 @@ class Acf
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
 
@@ -407,7 +407,7 @@ class Acf
407
  // loop through fields
408
  foreach($fields as $field)
409
  {
410
-
411
  // unserialize options
412
  $field->options = @unserialize($field->options);
413
 
@@ -603,7 +603,7 @@ class Acf
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>';
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.1
7
  Author: Elliot Condon
8
  Author URI: http://www.elliotcondon.com/
9
  License: GPL
36
  $this->dir = plugins_url('',__FILE__);
37
  $this->siteurl = get_bloginfo('url');
38
  $this->wpadminurl = admin_url();
39
+ $this->version = '2.0.1';
40
  $this->activated_fields = $this->get_activated_fields();
41
 
42
 
407
  // loop through fields
408
  foreach($fields as $field)
409
  {
410
+
411
  // unserialize options
412
  $field->options = @unserialize($field->options);
413
 
603
  {
604
  global $post;
605
 
606
+ if(isset($_GET['post_type']) && $_GET['post_type'] == '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>';
core/fields/file.php CHANGED
@@ -12,7 +12,27 @@ class acf_File
12
 
13
  add_action("admin_head-media-upload-popup", array($this, 'popup_head'));
14
  add_filter('media_send_to_editor', array($this, 'media_send_to_editor'), 15, 2 );
15
- add_action('admin_init', array($this, 'admin_init'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
 
18
 
@@ -43,10 +63,9 @@ class acf_File
43
  #media-items tr.image_alt p,
44
  #media-items table thead input.button,
45
  #media-items table thead img.imgedit-wait-spin,
46
- #media-items tr.submit a.wp-post-thumbnail,
47
- form#filter {
48
  display: none;
49
- }
50
 
51
  .media-item table thead img {
52
  border: #DFDFDF solid 1px;
@@ -54,38 +73,27 @@ class acf_File
54
  }
55
 
56
  </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  <?php
59
  }
60
  }
61
 
62
 
63
- /*---------------------------------------------------------------------------------------------
64
- * rename_buttons - RENAMES MEDIA THICKBOX BUTTONS
65
- *
66
- * @author Elliot Condon
67
- * @since 1.1.4
68
- *
69
- ---------------------------------------------------------------------------------------------*/
70
- function admin_init()
71
- {
72
- if(isset($_GET["acf_type"]) && $_GET["acf_type"] == "file")
73
- {
74
- add_filter('gettext', array($this, 'rename_buttons'), 1, 3);
75
- }
76
- }
77
-
78
- function rename_buttons($translated_text, $source_text, $domain) {
79
- if(isset($_GET["acf_type"]) && $_GET["acf_type"] == "file")
80
- {
81
- if ($source_text == 'Insert into Post') {
82
- return __('Select File', 'acf' );
83
- }
84
- }
85
- return $translated_text;
86
- }
87
-
88
-
89
  /*---------------------------------------------------------------------------------------------
90
  * media_send_to_editor - SEND IMAGE TO ACF DIV
91
  *
12
 
13
  add_action("admin_head-media-upload-popup", array($this, 'popup_head'));
14
  add_filter('media_send_to_editor', array($this, 'media_send_to_editor'), 15, 2 );
15
+ //add_action('admin_init', array($this, 'admin_init'));
16
+
17
+ add_action('admin_print_scripts', array($this, 'my_admin_scripts'));
18
+ add_action('admin_print_styles', array($this, 'my_admin_styles'));
19
+ }
20
+
21
+
22
+ /*---------------------------------------------------------------------------------------------
23
+ * admin_print_scripts / admin_print_styles
24
+ *
25
+ * @author Elliot Condon
26
+ * @since 2.0.1
27
+ *
28
+ ---------------------------------------------------------------------------------------------*/
29
+ function my_admin_scripts() {
30
+ wp_enqueue_script('media-upload');
31
+ wp_enqueue_script('thickbox');
32
+ }
33
+
34
+ function my_admin_styles() {
35
+ wp_enqueue_style('thickbox');
36
  }
37
 
38
 
63
  #media-items tr.image_alt p,
64
  #media-items table thead input.button,
65
  #media-items table thead img.imgedit-wait-spin,
66
+ #media-items tr.submit a.wp-post-thumbnail {
 
67
  display: none;
68
+ }
69
 
70
  .media-item table thead img {
71
  border: #DFDFDF solid 1px;
73
  }
74
 
75
  </style>
76
+ <script type="text/javascript">
77
+ (function($){
78
+
79
+ $(document).ready(function(){
80
+
81
+ $('#media-items').bind('DOMNodeInserted',function(){
82
+ $('input[value="Insert into Post"]').each(function(){
83
+ $(this).attr('value','<?php _e("Select File",'acf'); ?>');
84
+ });
85
+ }).trigger('DOMNodeInserted');
86
+
87
+ });
88
+
89
+ })(jQuery);
90
+ </script>
91
 
92
  <?php
93
  }
94
  }
95
 
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  /*---------------------------------------------------------------------------------------------
98
  * media_send_to_editor - SEND IMAGE TO ACF DIV
99
  *
core/fields/image.php CHANGED
@@ -12,10 +12,29 @@ class acf_Image
12
 
13
  add_action('admin_head-media-upload-popup', array($this, 'popup_head'));
14
  add_filter('media_send_to_editor', array($this, 'media_send_to_editor'), 15, 2 );
15
- add_action('admin_init', array($this, 'admin_init'));
 
 
 
 
16
  }
17
 
 
 
 
 
 
 
 
 
 
 
 
18
 
 
 
 
 
19
  /*---------------------------------------------------------------------------------------------
20
  * popup_head - STYLES MEDIA THICKBOX
21
  *
@@ -25,7 +44,7 @@ class acf_Image
25
  ---------------------------------------------------------------------------------------------*/
26
  function popup_head()
27
  {
28
- if($_GET['acf_type'] == 'image')
29
  {
30
  ?>
31
  <style type="text/css">
@@ -43,10 +62,9 @@ class acf_Image
43
  #media-items tr.image_alt p,
44
  #media-items table thead input.button,
45
  #media-items table thead img.imgedit-wait-spin,
46
- #media-items tr.submit a.wp-post-thumbnail,
47
- form#filter {
48
  display: none;
49
- }
50
 
51
  .media-item table thead img {
52
  border: #DFDFDF solid 1px;
@@ -54,7 +72,21 @@ class acf_Image
54
  }
55
 
56
  </style>
 
 
57
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  <?php
59
  }
60
  }
@@ -66,24 +98,22 @@ class acf_Image
66
  * @author Elliot Condon
67
  * @since 1.1.4
68
  *
69
- ---------------------------------------------------------------------------------------------*/
70
  function admin_init()
71
  {
72
- if(isset($_GET["acf_type"]) && $_GET["acf_type"] == "image")
73
- {
74
- add_filter('gettext', array($this, 'rename_buttons'), 1, 3);
75
- }
76
  }
77
 
78
  function rename_buttons($translated_text, $source_text, $domain) {
79
- if(isset($_GET["acf_type"]) && $_GET["acf_type"] == "image")
80
- {
81
- if ($source_text == 'Insert into Post') {
82
- return __('Select Image', 'acf' );
83
- }
84
  }
 
85
  return $translated_text;
86
- }
87
 
88
 
89
  /*---------------------------------------------------------------------------------------------
12
 
13
  add_action('admin_head-media-upload-popup', array($this, 'popup_head'));
14
  add_filter('media_send_to_editor', array($this, 'media_send_to_editor'), 15, 2 );
15
+ //add_action('admin_init', array($this, 'admin_init'));
16
+
17
+ add_action('admin_print_scripts', array($this, 'my_admin_scripts'));
18
+ add_action('admin_print_styles', array($this, 'my_admin_styles'));
19
+
20
  }
21
 
22
+ /*---------------------------------------------------------------------------------------------
23
+ * admin_print_scripts / admin_print_styles
24
+ *
25
+ * @author Elliot Condon
26
+ * @since 2.0.1
27
+ *
28
+ ---------------------------------------------------------------------------------------------*/
29
+ function my_admin_scripts() {
30
+ wp_enqueue_script('media-upload');
31
+ wp_enqueue_script('thickbox');
32
+ }
33
 
34
+ function my_admin_styles() {
35
+ wp_enqueue_style('thickbox');
36
+ }
37
+
38
  /*---------------------------------------------------------------------------------------------
39
  * popup_head - STYLES MEDIA THICKBOX
40
  *
44
  ---------------------------------------------------------------------------------------------*/
45
  function popup_head()
46
  {
47
+ if(isset($_GET["acf_type"]) && $_GET['acf_type'] == 'image')
48
  {
49
  ?>
50
  <style type="text/css">
62
  #media-items tr.image_alt p,
63
  #media-items table thead input.button,
64
  #media-items table thead img.imgedit-wait-spin,
65
+ #media-items tr.submit a.wp-post-thumbnail {
 
66
  display: none;
67
+ }
68
 
69
  .media-item table thead img {
70
  border: #DFDFDF solid 1px;
72
  }
73
 
74
  </style>
75
+ <script type="text/javascript">
76
+ (function($){
77
 
78
+ $(document).ready(function(){
79
+
80
+ $('#media-items').bind('DOMNodeInserted',function(){
81
+ $('input[value="Insert into Post"]').each(function(){
82
+ $(this).attr('value','<?php _e("Select Image",'acf'); ?>');
83
+ });
84
+ }).trigger('DOMNodeInserted');
85
+
86
+ });
87
+
88
+ })(jQuery);
89
+ </script>
90
  <?php
91
  }
92
  }
98
  * @author Elliot Condon
99
  * @since 1.1.4
100
  *
101
+ ---------------------------------------------------------------------------------------------
102
  function admin_init()
103
  {
104
+ //if(isset($_GET["acf_type"]) && $_GET["acf_type"] == "image")
105
+ //{
106
+ // add_filter('gettext', array($this, 'rename_buttons'), 1, 3);
107
+ //}
108
  }
109
 
110
  function rename_buttons($translated_text, $source_text, $domain) {
111
+ if ($source_text == 'Insert into Post') {
112
+ return __('Select Image', 'acf' );
 
 
 
113
  }
114
+
115
  return $translated_text;
116
+ }*/
117
 
118
 
119
  /*---------------------------------------------------------------------------------------------
core/fields/repeater.php CHANGED
@@ -382,7 +382,7 @@ class acf_Repeater
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
  {
@@ -391,7 +391,8 @@ class acf_Repeater
391
  }
392
  else
393
  {
394
- $cell['value'] = "";
 
395
  }
396
 
397
 
@@ -533,6 +534,10 @@ class acf_Repeater
533
 
534
  }
535
 
 
 
 
 
536
 
537
  return $values;
538
  }
382
  {
383
 
384
  // if select is a multiple (multiple select value), you need to save it as an array!
385
+ if(isset($cell['value']) && $cell['value'] != "")
386
  {
387
  if(is_array($cell['value']))
388
  {
391
  }
392
  else
393
  {
394
+ //$cell['value'] = "";
395
+ continue;
396
  }
397
 
398
 
534
 
535
  }
536
 
537
+ if(empty($values))
538
+ {
539
+ $values = null;
540
+ }
541
 
542
  return $values;
543
  }
core/fields_meta_box copy.php DELETED
@@ -1,98 +0,0 @@
1
- <?php
2
-
3
- // get fields
4
- global $post;
5
- $fields = $this->get_fields($post->ID);
6
-
7
- // if no fields (new acf), add blank field
8
- if(empty($fields))
9
- {
10
- $fields[] = array(
11
- 'title' => '',
12
- 'label' => '',
13
- 'type' => 'text',
14
- 'options' => array()
15
- );
16
- }
17
-
18
- // get name of all fields for use in field type
19
- $fields_names = array();
20
- foreach($this->fields as $field)
21
- {
22
- $fields_names[$field->name] = $field->title;
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
- <table class="acf">
32
- <thead>
33
- <tr>
34
- <th class="order"><!-- Order --></th>
35
- <th class="title">Label<br /><span>Shown on the edit page (eg. Hero Image)</span></th>
36
- <th class="label">Name<br /><span>Used as variable name (eg. hero_image)</span></th>
37
- <th class="field_type">Field Type<br /><span>Type of field</span></th>
38
- <!-- <th class="field_options">Field Options<br /><span>Specific field type options</span></th> -->
39
- <th class="remove"><!-- Remove --></th>
40
- </tr>
41
- </thead>
42
- <tbody>
43
- <?php foreach($fields as $key => $field): ?>
44
-
45
- <tr>
46
- <td class="order"><?php echo ($key+1); ?></td>
47
- <td>
48
- <?php $this->create_field(array(
49
- 'type' => 'text',
50
- 'name' => 'acf[fields]['.$key.'][label]',
51
- 'value' => $field['label'],
52
- 'class' => 'label'
53
- )); ?>
54
- </td>
55
- <td>
56
- <?php $this->create_field(array(
57
- 'type' => 'text',
58
- 'name' => 'acf[fields]['.$key.'][name]',
59
- 'value' => $field['name'],
60
- 'class' => 'name'
61
- )); ?>
62
- </td>
63
- <td>
64
- <?php $this->create_field(array(
65
- 'type' => 'select',
66
- 'name' => 'acf[fields]['.$key.'][type]',
67
- 'value' => $field['type'],
68
- 'class' => 'type',
69
- 'options' => array('choices' => $fields_names)
70
- )); ?>
71
-
72
- <div class="field_options">
73
- <?php foreach($fields_names as $field_name => $field_title): ?>
74
- <?php if($this->fields[$field_name]->has_options()): ?>
75
- <div class="field_option" id="<?php echo $field_name; ?>">
76
- <?php $this->fields[$field_name]->options($key, $field['options']); ?>
77
- </div>
78
- <?php endif; ?>
79
- <?php endforeach; ?>
80
- </div>
81
-
82
- </td>
83
- <!-- <td>
84
- <div class="field_options_trigger">
85
-
86
- </div>
87
- </td> -->
88
- <td><a href="javascript:;" class="remove_field"></a></td>
89
- </tr>
90
-
91
- <?php endforeach; ?>
92
- </tbody>
93
- </table>
94
-
95
- <div class="table_footer">
96
- <div class="order_message"></div>
97
- <a href="javascript:;" id="add_field" class="button-primary">+ Add Field</a>
98
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/fields_meta_box.php CHANGED
@@ -43,7 +43,7 @@
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): ?>
@@ -59,8 +59,8 @@
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>
@@ -84,8 +84,8 @@
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
@@ -104,8 +104,8 @@
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
@@ -123,7 +123,7 @@
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
 
@@ -139,6 +139,39 @@
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
 
43
  <div class="fields">
44
 
45
  <div class="no_fields_message" <?php if(sizeof($fields) > 1){ echo 'style="display:none;"'; } ?>>
46
+ <?php _e("No fields. Click the \"+ Add Field button\" to create your first field.",'acf'); ?>
47
  </div>
48
 
49
  <?php foreach($fields as $key => $field): ?>
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:;"><?php _e("Edit",'acf'); ?></a> | </span>
63
+ <span><a class="acf_delete_field" title="Delete this Field" href="javascript:;"><?php _e("Delete",'acf'); ?></a>
64
  </div>
65
 
66
  </td>
84
  <tbody>
85
  <tr class="field_label">
86
  <td class="label">
87
+ <label><span class="required">*</span><?php _e("Field Label",'acf'); ?></label>
88
+ <p class="description"><?php _e("This is the name which will appear on the EDIT page",'acf'); ?></p>
89
  </td>
90
  <td>
91
  <?php
104
  </td>
105
  </tr>
106
  <tr class="field_name">
107
+ <td class="label"><label><span class="required">*</span><?php _e("Field Name",'acf'); ?></label>
108
+ <p class="description"><?php _e("Single word, no spaces. Underscores and dashes allowed",'acf'); ?></p>
109
  </td>
110
  <td>
111
  <?php
123
  </td>
124
  </tr>
125
  <tr class="field_type">
126
+ <td class="label"><label><span class="required">*</span><?php _e("Field Type",'acf'); ?></label></td>
127
  <td>
128
  <?php
129
 
139
  ?>
140
  </td>
141
  </tr>
142
+ <tr class="field_instructions">
143
+ <td class="label"><label><?php _e("Field Instructions",'acf'); ?></label>
144
+ <p class="description"><?php _e("Instructions for authors. Shown when submitting data",'acf'); ?></p></td>
145
+ <td>
146
+ <?php
147
+
148
+ $temp_field->type = 'textarea';
149
+ $temp_field->input_name = 'acf[fields]['.$key.'][instructions]';
150
+ $temp_field->input_id = 'acf[fields]['.$key.'][instructions]';
151
+ $temp_field->input_class = 'instructions';
152
+ $temp_field->value = $field->instructions;
153
+
154
+ $this->create_field($temp_field);
155
+
156
+ ?>
157
+ </td>
158
+ </tr>
159
+ <tr class="field_save_as_cf">
160
+ <td class="label">
161
+ <label><?php _e("Is field searchable?",'acf'); ?></label>
162
+ </td>
163
+ <td>
164
+ <?php
165
+ $temp_field->type = 'true_false';
166
+ $temp_field->input_name = 'acf[fields]['.$key.'][save_as_cf]';
167
+ $temp_field->input_id = 'acf[fields]['.$key.'][save_as_cf]';
168
+ $temp_field->input_class = 'save_as_cf';
169
+ $temp_field->value = $field->save_as_cf;
170
+ $temp_field->options = array('message' => __("Save this field's value as a standard WordPress Custom Field",'acf'));
171
+ $this->create_field($temp_field);
172
+ ?>
173
+ </td>
174
+ </tr>
175
  <?php foreach($fields_names as $field_name => $field_title): ?>
176
  <?php if(method_exists($this->fields[$field_name], 'options_html')): ?>
177
 
core/fields_save.php CHANGED
@@ -44,13 +44,14 @@ if(isset($_POST['fields_meta_box']) && $_POST['fields_meta_box'] == 'true')
44
 
45
  // create data
46
  $data = array(
47
- 'order_no' => $i,
48
- 'post_id' => $post_id,
49
- 'label' => $field['label'],
50
- 'name' => $field['name'],
51
- 'type' => $field['type'],
52
- 'options' => serialize($field['options']),
53
-
 
54
  );
55
 
56
 
44
 
45
  // create data
46
  $data = array(
47
+ 'order_no' => $i,
48
+ 'post_id' => $post_id,
49
+ 'label' => $field['label'],
50
+ 'name' => $field['name'],
51
+ 'type' => $field['type'],
52
+ 'options' => serialize($field['options']),
53
+ 'instructions' => $field['instructions'],
54
+ 'save_as_cf' => $field['save_as_cf'],
55
  );
56
 
57
 
core/input_meta_box.php CHANGED
@@ -68,8 +68,14 @@ if(!in_array('the_content',$adv_options->show_on_page)): ?>
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>
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
+ <?php if($field->save_as_cf == 1): ?>
72
+ <input type="hidden" name="acf[<?php echo $i; ?>][save_as_cf]" value="<?php echo $field->name; ?>" />
73
+ <?php endif; ?>
74
+
75
  <label for="<?php echo $field->input_id ?>"><?php echo $field->label ?></label>
76
+ <?php if($field->instructions): ?><p class="instructions"><?php echo $field->instructions; ?></p><?php endif; ?>
77
  <?php $this->create_field($field); ?>
78
+
79
  </div>
80
  <?php endforeach; ?>
81
  </div>
core/input_save.php CHANGED
@@ -55,6 +55,19 @@ if($_POST['input_meta_box'] == 'true')
55
  // insert new data
56
  $new_id = $wpdb->insert($table_name, $data);
57
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
 
60
  }
55
  // insert new data
56
  $new_id = $wpdb->insert($table_name, $data);
57
  }
58
+
59
+
60
+
61
+ // save as standard cf
62
+ if(isset($field['save_as_cf']))
63
+ {
64
+ if(is_array($field['value']))
65
+ {
66
+ $field['value'] = serialize($field['value']);
67
+ }
68
+
69
+ update_post_meta($post_id, $field['save_as_cf'], $field['value']);
70
+ }
71
 
72
 
73
  }
core/screen_extra.php CHANGED
@@ -2,7 +2,7 @@
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>
@@ -33,7 +33,6 @@
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>
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="http://plugins.elliotcondon.com/shop/">Visit the Plugin Store</a></p>
6
  <table class="acf_activate">
7
  <thead>
8
  <tr>
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
  } ?>
37
  </form>
38
  </td>
core/update.php CHANGED
@@ -364,6 +364,52 @@ if(version_compare($version,'1.1.4') < 0)
364
  }
365
 
366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
  // update to latest acf version
368
- update_option('acf_version','2.0.0');
369
  ?>
364
  }
365
 
366
 
367
+ /*---------------------------------------------------------------------------------------------
368
+ * Update to 2.0.1 - this version adds field description and save as custom field columns to acf_fields
369
+ *
370
+ * @author Elliot Condon
371
+ * @since 2.0.6
372
+ *
373
+ ---------------------------------------------------------------------------------------------*/
374
+
375
+ if(version_compare($version,'2.0.1') < 0)
376
+ {
377
+
378
+ global $wpdb;
379
+
380
+
381
+ // set charset
382
+ if(!empty($wpdb->charset))
383
+ {
384
+ $char = $wpdb->charset;
385
+ }
386
+ else
387
+ {
388
+ $char = "utf8";
389
+ }
390
+
391
+
392
+ // create acf_fields table
393
+ $table_name = $wpdb->prefix.'acf_fields';
394
+ if($wpdb->get_var("SHOW TABLES LIKE '".$table_name."'"))
395
+ {
396
+ $sql = "CREATE TABLE " . $table_name . " (
397
+ id bigint(20) NOT NULL AUTO_INCREMENT,
398
+ order_no int(9) NOT NULL DEFAULT '0',
399
+ post_id bigint(20) NOT NULL DEFAULT '0',
400
+ parent_id bigint(20) NOT NULL DEFAULT '0',
401
+ label text NOT NULL,
402
+ name text NOT NULL,
403
+ instructions text NOT NULL DEFAULT '',
404
+ save_as_cf int(1) NOT NULL DEFAULT 0,
405
+ type text NOT NULL,
406
+ options text NOT NULL,
407
+ UNIQUE KEY id (id)
408
+ ) ".$char.";";
409
+ dbDelta($sql);
410
+ }
411
+ }
412
+
413
  // update to latest acf version
414
+ update_option('acf_version','2.0.1');
415
  ?>
css/style.input.css CHANGED
@@ -27,13 +27,13 @@
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
 
38
  .postbox#acf_input h3.hndle{
39
  display: none;
@@ -64,6 +64,12 @@
64
  width: 99.8%;
65
  }
66
 
 
 
 
 
 
 
67
 
68
 
69
  /*---------------------------------------------------------------------------------------------
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
 
38
  .postbox#acf_input h3.hndle{
39
  display: none;
64
  width: 99.8%;
65
  }
66
 
67
+ #poststuff .inside p.instructions {
68
+ font-size: 11px;
69
+ margin: -6px 0 10px;
70
+ padding: 0;
71
+ color: #999;
72
+ }
73
 
74
 
75
  /*---------------------------------------------------------------------------------------------
css/style.options.css CHANGED
@@ -10,13 +10,13 @@
10
  padding-left: 4px;
11
  }
12
 
13
- ul.checkbox_list {
14
  display: block;
15
  float: left;
16
  width: 300px;
17
  }
18
 
19
- ul.checkbox_list li {
20
  display: block;
21
  }
22
 
10
  padding-left: 4px;
11
  }
12
 
13
+ .postbox#acf_options ul.checkbox_list {
14
  display: block;
15
  float: left;
16
  width: 300px;
17
  }
18
 
19
+ .postbox#acf_options ul.checkbox_list li {
20
  display: block;
21
  }
22
 
readme.txt CHANGED
@@ -81,6 +81,14 @@ http://support.plugins.elliotcondon.com/categories/advanced-custom-fields/
81
 
82
  == Changelog ==
83
 
 
 
 
 
 
 
 
 
84
  =2.0.0=
85
  * Completely re-designed the ACF edit page
86
  * Added repeater field (unlocked through external purchase)
81
 
82
  == Changelog ==
83
 
84
+ =2.0.1=
85
+ * Added Field Option: Field Instructions
86
+ * Added Field Option: Is field searchable? (saves field value as a normal custom field so you can use the field against wp queries)
87
+ * Added Media Search / Pagination to Image / File thickbox
88
+ * Added Media Upload support to post types which do not have a Content Editor.
89
+ * Fixed "Select Image" / "Select File" text on thickbox buttons after upload
90
+ * Repeater field now returns null if no data was added.
91
+
92
  =2.0.0=
93
  * Completely re-designed the ACF edit page
94
  * Added repeater field (unlocked through external purchase)