Advanced Custom Fields - Version 1.0.0

Version Description

Download this release

Release Info

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

Version 1.0.0

acf.php ADDED
@@ -0,0 +1,516 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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.0.0
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');
16
+
17
+
18
+
19
+
20
+ class Acf
21
+ {
22
+ var $name;
23
+ var $dir;
24
+ var $path;
25
+ var $siteurl;
26
+ var $wpadminurl;
27
+ var $version;
28
+ var $fields;
29
+
30
+ function Acf()
31
+ {
32
+
33
+ // set class variables
34
+ $this->name = 'Advanced Custom Fields';
35
+ $this->path = dirname(__FILE__).'';
36
+ $this->dir = plugins_url('',__FILE__);
37
+ $this->siteurl = get_bloginfo('url');
38
+ $this->wpadminurl = admin_url();
39
+ $this->version = '1.0.0';
40
+
41
+ // set text domain
42
+ load_plugin_textdomain('acf', false, $this->path.'/lang' );
43
+
44
+ // populate post types
45
+ $this->fields = $this->_get_field_types();
46
+
47
+
48
+ // add actions
49
+ add_action('init', array($this, '_init'));
50
+ add_action('admin_head', array($this,'_admin_head'));
51
+ add_action('admin_menu', array($this,'_admin_menu'));
52
+ add_action('save_post', array($this, '_save_post'));
53
+ add_action('admin_footer-edit.php', array($this, '_admin_footer'));
54
+
55
+ //register_activation_hook(__FILE__, array($this,'activate'));
56
+
57
+ return true;
58
+ }
59
+
60
+
61
+ /*---------------------------------------------------------------------------------------------
62
+ * Init
63
+ *
64
+ * @author Elliot Condon
65
+ * @since 1.0.0
66
+ *
67
+ ---------------------------------------------------------------------------------------------*/
68
+ function _init()
69
+ {
70
+ // create acf post type
71
+ $this->_acf_post_type();
72
+ }
73
+
74
+
75
+ /*---------------------------------------------------------------------------------------------
76
+ * Save Post
77
+ *
78
+ * @author Elliot Condon
79
+ * @since 1.0.0
80
+ *
81
+ ---------------------------------------------------------------------------------------------*/
82
+ function _save_post($post_id)
83
+ {
84
+ // do not save if this is an auto save routine
85
+ if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;
86
+
87
+ // verify this with nonce because save_post can be triggered at other times
88
+ if (!wp_verify_nonce($_POST['ei_noncename'], 'ei-n')) return $post_id;
89
+
90
+ // set post ID if is a revision
91
+ if(wp_is_post_revision($post_id))
92
+ {
93
+ $post_id = wp_is_post_revision($post_id);
94
+ }
95
+
96
+ // delete _acf custom fields if needed
97
+ if($_POST['fields_meta_box'] == 'true' || $_POST['location_meta_box'] == 'true' || $_POST['input_meta_box'] == 'true')
98
+ {
99
+ $this->delete_acf_custom_fields($post_id);
100
+ }
101
+
102
+ // include meta box save files
103
+ include('core/fields_save.php');
104
+ include('core/location_save.php');
105
+ include('core/options_save.php');
106
+ include('core/input_save.php');
107
+ }
108
+
109
+
110
+ /*---------------------------------------------------------------------------------------------
111
+ * Create ACF Post Type
112
+ *
113
+ * @author Elliot Condon
114
+ * @since 1.0.0
115
+ *
116
+ ---------------------------------------------------------------------------------------------*/
117
+ function _acf_post_type()
118
+ {
119
+ include('core/acf_post_type.php');
120
+ }
121
+
122
+
123
+ /*---------------------------------------------------------------------------------------------
124
+ * Admin Menu
125
+ *
126
+ * @author Elliot Condon
127
+ * @since 1.0.0
128
+ *
129
+ ---------------------------------------------------------------------------------------------*/
130
+ function _admin_menu() {
131
+
132
+ // add sub menu
133
+ add_submenu_page('options-general.php', 'CFA', __('Adv Custom Fields','acf'), 'manage_options','edit.php?post_type=acf');
134
+
135
+ // remove acf menu item
136
+ global $menu;
137
+ $restricted = array('Advanced&nbsp;Custom&nbsp;Fields');
138
+ end ($menu);
139
+ while (prev($menu)){
140
+ $value = explode(' ',$menu[key($menu)][0]);
141
+ if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
142
+ }
143
+
144
+ }
145
+
146
+ /*---------------------------------------------------------------------------------------------
147
+ * Admin Head
148
+ *
149
+ * @author Elliot Condon
150
+ * @since 1.0.0
151
+ *
152
+ ---------------------------------------------------------------------------------------------*/
153
+ function _admin_head()
154
+ {
155
+ include('core/admin_head.php');
156
+ }
157
+
158
+
159
+ /*---------------------------------------------------------------------------------------------
160
+ * admin_head
161
+ *
162
+ * @author Elliot Condon
163
+ * @since 1.0.0
164
+ *
165
+ ---------------------------------------------------------------------------------------------*/
166
+ function admin_footer()
167
+ {
168
+ //if($_GET['post_type'] != 'cf_matrix'){return false;}
169
+
170
+ //echo '<link rel="stylesheet" href="'.$this->dir.'/css/cf_matrix_admin.css" type="text/css" media="all" />';
171
+ //echo '<script type="text/javascript" src="'.$this->dir.'/js/admin.js"></script>';
172
+ //include('core/meta_box_4.php');
173
+ }
174
+
175
+
176
+ /*---------------------------------------------------------------------------------------------
177
+ * activate
178
+ *
179
+ * @author Elliot Condon
180
+ * @since 1.0.0
181
+ *
182
+ ---------------------------------------------------------------------------------------------*/
183
+ function activate()
184
+ {
185
+ //include('core/update.php');
186
+ }
187
+
188
+
189
+ /*---------------------------------------------------------------------------------------------
190
+ * _get_field_types
191
+ *
192
+ * @author Elliot Condon
193
+ * @since 1.0.0
194
+ *
195
+ ---------------------------------------------------------------------------------------------*/
196
+ function _get_field_types()
197
+ {
198
+ $array = array();
199
+
200
+ include('core/fields/text.php');
201
+ include('core/fields/textarea.php');
202
+ include('core/fields/wysiwyg.php');
203
+ include('core/fields/image.php');
204
+ include('core/fields/select.php');
205
+ include('core/fields/checkbox.php');
206
+ include('core/fields/page_link.php');
207
+
208
+ $array['text'] = new Text();
209
+ $array['textarea'] = new Textarea();
210
+ $array['wysiwyg'] = new Wysiwyg();
211
+ $array['image'] = new Image($this->dir);
212
+ $array['select'] = new Select();
213
+ $array['checkbox'] = new Checkbox();
214
+ $array['page_link'] = new Page_link();
215
+
216
+ return $array;
217
+ }
218
+
219
+
220
+ /*---------------------------------------------------------------------------------------------
221
+ * create_field
222
+ *
223
+ * @author Elliot Condon
224
+ * @since 1.0.0
225
+ *
226
+ ---------------------------------------------------------------------------------------------*/
227
+ function create_field($options)
228
+ {
229
+ $this->fields[$options['type']]->html($options);
230
+ }
231
+
232
+
233
+ /*---------------------------------------------------------------------------------------------
234
+ * Add Meta Box to the ACF post type edit page
235
+ *
236
+ * @author Elliot Condon
237
+ * @since 1.0.0
238
+ *
239
+ ---------------------------------------------------------------------------------------------*/
240
+ function _fields_meta_box()
241
+ {
242
+ include('core/fields_meta_box.php');
243
+ }
244
+
245
+
246
+ /*---------------------------------------------------------------------------------------------
247
+ * Add Meta Box to the ACF post type edit page
248
+ *
249
+ * @author Elliot Condon
250
+ * @since 1.0.0
251
+ *
252
+ ---------------------------------------------------------------------------------------------*/
253
+ function _location_meta_box()
254
+ {
255
+ include('core/location_meta_box.php');
256
+ }
257
+
258
+
259
+ /*---------------------------------------------------------------------------------------------
260
+ * Add Meta Box to the selected post type edit page
261
+ *
262
+ * @author Elliot Condon
263
+ * @since 1.0.0
264
+ *
265
+ ---------------------------------------------------------------------------------------------*/
266
+ function _input_meta_box($post, $args)
267
+ {
268
+ include('core/input_meta_box.php');
269
+ }
270
+
271
+
272
+ /*---------------------------------------------------------------------------------------------
273
+ * Add Meta Box to the ACF post type edit page
274
+ *
275
+ * @author Elliot Condon
276
+ * @since 1.0.0
277
+ *
278
+ ---------------------------------------------------------------------------------------------*/
279
+ function _options_meta_box()
280
+ {
281
+ include('core/options_meta_box.php');
282
+ }
283
+
284
+
285
+ /*---------------------------------------------------------------------------------------------
286
+ * delete_acf_custom_fields
287
+ *
288
+ * @author Elliot Condon
289
+ * @since 1.0.0
290
+ *
291
+ ---------------------------------------------------------------------------------------------*/
292
+ function delete_acf_custom_fields($post_id)
293
+ {
294
+
295
+ foreach(get_post_custom($post_id) as $key => $values)
296
+ {
297
+ if(strpos($key, '_acf') !== false)
298
+ {
299
+ // this custom field needs to be deleted!
300
+ delete_post_meta($post_id, $key);
301
+ }
302
+ }
303
+ }
304
+
305
+ /*---------------------------------------------------------------------------------------------
306
+ * get_fields
307
+ *
308
+ * @author Elliot Condon
309
+ * @since 1.0.0
310
+ *
311
+ ---------------------------------------------------------------------------------------------*/
312
+ function get_fields($acf_id)
313
+ {
314
+ $keys = get_post_custom_keys($acf_id);
315
+
316
+ if(empty($keys))
317
+ {
318
+ return null;
319
+ }
320
+
321
+ $fields = array();
322
+ for($i = 0; $i < 99; $i++)
323
+ {
324
+ if(in_array('_acf_field_'.$i.'_label',$keys))
325
+ {
326
+ $fields[] = array(
327
+ 'label' => get_post_meta($acf_id, '_acf_field_'.$i.'_label', true),
328
+ 'name' => get_post_meta($acf_id, '_acf_field_'.$i.'_name', true),
329
+ 'type' => get_post_meta($acf_id, '_acf_field_'.$i.'_type', true),
330
+ 'options' => $this->string_to_clean_array(
331
+ get_post_meta($acf_id, '_acf_field_'.$i.'_options', true)
332
+ ),
333
+ );
334
+ }
335
+ else
336
+ {
337
+ // data doesnt exist, break loop
338
+ break;
339
+ }
340
+ }
341
+
342
+ return $fields;
343
+ }
344
+
345
+ /*---------------------------------------------------------------------------------------------
346
+ * get_field_options
347
+ *
348
+ * @author Elliot Condon
349
+ * @since 1.0.0
350
+ *
351
+ ---------------------------------------------------------------------------------------------*/
352
+ function get_field_options($type, $options)
353
+ {
354
+ $field_options = $this->fields[$type]->options();
355
+
356
+ ?>
357
+ <table class="field_options">
358
+ <?php foreach($field_options as $field_option): ?>
359
+ <tr>
360
+ <td class="label">
361
+ <label for="post_type"><?php echo $field_options[0]['label'] ?></label>
362
+ </td>
363
+ <td>
364
+ <?php $acf->create_field('text',$options); ?>
365
+ </td>
366
+ </tr>
367
+ <?php endforeach; ?>
368
+ </table>
369
+ <?php
370
+ }
371
+
372
+ /*---------------------------------------------------------------------------------------------
373
+ * get_acf_location
374
+ *
375
+ * @author Elliot Condon
376
+ * @since 1.0.0
377
+ *
378
+ ---------------------------------------------------------------------------------------------*/
379
+ function get_acf_location($acf_id)
380
+ {
381
+ $location = array(
382
+ 'post_type' => get_post_meta($acf_id, '_acf_location_post_type', true),
383
+ 'page_slug' => get_post_meta($acf_id, '_acf_location_page_slug', true),
384
+ 'post_id' => get_post_meta($acf_id, '_acf_location_post_id', true),
385
+ 'page_template' => get_post_meta($acf_id, '_acf_location_page_template', true),
386
+ 'parent_id' => get_post_meta($acf_id, '_acf_location_parent_id', true),
387
+ );
388
+
389
+ // post type needs to be in array format
390
+ //$location['post_type'] = str_replace(', ',',',$location['post_type']);
391
+ //$location['post_type'] = explode(',',$location['post_type']);
392
+
393
+ return $location;
394
+ }
395
+
396
+
397
+ /*---------------------------------------------------------------------------------------------
398
+ * get_acf_options
399
+ *
400
+ * @author Elliot Condon
401
+ * @since 1.0.0
402
+ *
403
+ ---------------------------------------------------------------------------------------------*/
404
+ function get_acf_options($acf_id)
405
+ {
406
+ $options = array();
407
+
408
+ $keys = get_post_custom_keys($acf_id);
409
+
410
+ if(empty($keys))
411
+ {
412
+ $options['show_on_page'] = 'the_content, discussion, custom_fields, comments, slug, author';
413
+ }
414
+ else
415
+ {
416
+ $options['show_on_page'] = get_post_meta($acf_id, '_acf_option_show_on_page', true);
417
+ }
418
+
419
+ return $options;
420
+ }
421
+
422
+
423
+ /*---------------------------------------------------------------------------------------------
424
+ * add_to_Edit_screen
425
+ *
426
+ * @author Elliot Condon
427
+ * @since 1.0.0
428
+ *
429
+ ---------------------------------------------------------------------------------------------*/
430
+ function add_to_edit_screen()
431
+ {
432
+
433
+ }
434
+
435
+
436
+ /*---------------------------------------------------------------------------------------------
437
+ * string_to_clean_array
438
+ *
439
+ * @author Elliot Condon
440
+ * @since 1.0.0
441
+ *
442
+ ---------------------------------------------------------------------------------------------*/
443
+ function string_to_clean_array($string)
444
+ {
445
+ if(!is_array(unserialize($string)))
446
+ {
447
+ return array();
448
+ }
449
+
450
+ $array = unserialize($string);
451
+
452
+ foreach($array as $key => $value)
453
+ {
454
+ if(is_array($value)) // options is an array, so unserialize it and strip slashes
455
+ {
456
+ $child_array = array();
457
+ foreach($value as $child_key => $child_value)
458
+ {
459
+ $child_array[$child_key] = stripslashes($child_value);
460
+ }
461
+ $value[$key] = $child_array;
462
+ }
463
+ else // everythis else is a simple string.
464
+ {
465
+ $array[$key] = stripslashes($value);
466
+ }
467
+ }
468
+ return $array;
469
+ }
470
+
471
+
472
+ /*---------------------------------------------------------------------------------------------
473
+ * get_adv_options
474
+ *
475
+ * @author Elliot Condon
476
+ * @since 1.0.0
477
+ *
478
+ ---------------------------------------------------------------------------------------------*/
479
+ function get_adv_options($acf_id)
480
+ {
481
+ $adv = array();
482
+
483
+ $adv['show_on_page'] = get_post_meta($acf_id, '_acf_option_show_on_page', true);
484
+
485
+ if(empty($adv['show_on_page']))
486
+ {
487
+ $adv['show_on_page'] = array();
488
+ }
489
+ else
490
+ {
491
+ $adv['show_on_page'] = str_replace(', ',',',$adv['show_on_page']);
492
+ $adv['show_on_page'] = explode(',',$adv['show_on_page']);
493
+ }
494
+
495
+ return $adv;
496
+ }
497
+
498
+ /*---------------------------------------------------------------------------------------------
499
+ * admin_footer
500
+ *
501
+ * @author Elliot Condon
502
+ * @since 1.0.0
503
+ *
504
+ ---------------------------------------------------------------------------------------------*/
505
+ function _admin_footer()
506
+ {
507
+ if($_GET['post_type'] != 'acf'){return false;}
508
+
509
+ echo '<link rel="stylesheet" href="'.$this->dir.'/css/style.info.css" type="text/css" media="all" />';
510
+ echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.info.js"></script>';
511
+ include('core/info_meta_box.php');
512
+ }
513
+
514
+
515
+
516
+ }
core/acf_post_type.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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',
18
+ 'revisions',
19
+ 'custom-fields'
20
+ );
21
+
22
+ register_post_type('acf', array(
23
+ 'labels' => $labels,
24
+ 'public' => false,
25
+ 'show_ui' => true,
26
+ '_builtin' => false,
27
+ 'capability_type' => 'post',
28
+ 'hierarchical' => false,
29
+ 'rewrite' => array("slug" => "acf"),
30
+ 'query_var' => "acf",
31
+ 'supports' => $supports,
32
+ ));
33
+
34
+
35
+ ?>
core/admin_head.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ global $post;
4
+
5
+ // shows hidden custom fields
6
+ echo "<style type='text/css'>#postcustom .hidden { display: table-row; }</style>\n";
7
+
8
+ // add metabox, style and javascript to acf page
9
+ //if($_GET['post_type'] == 'acf')
10
+ //{
11
+ // not edit screen
12
+ //}
13
+
14
+ $currentFile = $_SERVER["SCRIPT_NAME"];
15
+ $parts = Explode('/', $currentFile);
16
+ $currentFile = $parts[count($parts) - 1];
17
+
18
+ if($currentFile == 'edit.php')
19
+ {
20
+
21
+ }
22
+ elseif(get_post_type($post) == 'acf')
23
+ {
24
+
25
+ // Custom field page for ACF
26
+ echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.fields.js" ></script>';
27
+
28
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.global.css" />';
29
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.fields.css" />';
30
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.location.css" />';
31
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.options.css" />';
32
+
33
+ add_meta_box('acf_fields', 'Fields', array($this, '_fields_meta_box'), 'acf', 'normal', 'high');
34
+ add_meta_box('acf_location', 'Assign to edit page</span><span class="description">- Specify exactly where you want your Advanced Custom Fields fields to appear', array($this, '_location_meta_box'), 'acf', 'normal', 'high');
35
+ add_meta_box('acf_options', 'Advanced Options</span><span class="description">- Customise the edit page', array($this, '_options_meta_box'), 'acf', 'normal', 'high');
36
+ }
37
+ else
38
+ {
39
+ // any other edit page
40
+ $acfs = get_posts(array(
41
+ 'numberposts' => -1,
42
+ 'post_type' => 'acf'
43
+ ));
44
+
45
+ if($acfs)
46
+ {
47
+ foreach($acfs as $acf)
48
+ {
49
+ $add_box = false;
50
+
51
+ // get options of matrix
52
+ $location = $this->get_acf_location($acf->ID);
53
+ //print_r($location);
54
+
55
+ // post type
56
+ if($location['post_type'] != '')
57
+ {
58
+ $post_types = explode(',',str_replace(' ','',$location['post_type']));
59
+ if(in_array(get_post_type($post), $post_types)) {$add_box = true; }
60
+ }
61
+
62
+ // page slug
63
+ if($location['page_slug'] != '')
64
+ {
65
+ $page_slugs = explode(',',str_replace(' ','',$location['page_slug']));
66
+ if(in_array($post->post_name, $page_slugs)) {$add_box = true; }
67
+ }
68
+
69
+ // post ID
70
+ if($location['post_id'] != '')
71
+ {
72
+ $post_ids = explode(',',str_replace(' ','',$location['post_id']));
73
+ if(in_array($post->ID, $post_ids)) {$add_box = true; }
74
+ }
75
+
76
+ // page template
77
+ if($location['page_template'] != '')
78
+ {
79
+ $page_template = explode(',',str_replace(' ','',$location['page_template']));
80
+ if(in_array(get_post_meta($post->ID,'_wp_page_template',true), $page_template)) {$add_box = true;}
81
+ }
82
+
83
+ // parent id
84
+ if($location['parent_id'] != '')
85
+ {
86
+ $parent_ids = explode(',',str_replace(' ','',$location['parent_id']));
87
+ if(in_array($post->post_parent, $parent_ids)) {$add_box = true;}
88
+
89
+ }
90
+
91
+ if($add_box == true)
92
+ {
93
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.global.css" />';
94
+ echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.input.css" />';
95
+
96
+ echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.input.js" ></script>';
97
+
98
+ add_meta_box('acf_input', get_the_title($acf->ID), array($this, '_input_meta_box'), get_post_type($post), 'normal', 'high', array('acf' => $acf));
99
+
100
+ // only add 1 metabox
101
+ break;
102
+ }
103
+ }
104
+
105
+ }
106
+ }
107
+
108
+ ?>
core/api.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*---------------------------------------------------------------------------------------------
3
+ * api.php
4
+ *
5
+ * @version 1.0.6
6
+ ---------------------------------------------------------------------------------------------*/
7
+
8
+ /*---------------------------------------------------------------------------------------------
9
+ * acf_object
10
+ *
11
+ * @author Elliot Condon
12
+ * @since 1.0.0
13
+ *
14
+ ---------------------------------------------------------------------------------------------*/
15
+ class acf_object
16
+ {
17
+ function acf_object($variables)
18
+ {
19
+ foreach($variables as $key => $value)
20
+ {
21
+ $this->$key = $value;
22
+ }
23
+ }
24
+
25
+ }
26
+
27
+ /*---------------------------------------------------------------------------------------------
28
+ * get_acf
29
+ *
30
+ * @author Elliot Condon
31
+ * @since 1.0.0
32
+ *
33
+ ---------------------------------------------------------------------------------------------*/
34
+ function get_acf()
35
+ {
36
+ global $acf;
37
+ global $wpdb;
38
+ global $post;
39
+
40
+ if(!$post_id)
41
+ {
42
+ $post_id = $post->ID;
43
+ }
44
+
45
+ $results = array();
46
+ $acf_id = get_post_meta($post_id, '_acf_id', true);
47
+
48
+ $fields = $acf->get_fields($acf_id);
49
+
50
+ if($fields)
51
+ {
52
+ $variables = array();
53
+
54
+ foreach($fields as $field)
55
+ {
56
+ // get value
57
+ $field['value'] = get_post_meta($post_id, '_acf_'.$field['name'], true);
58
+
59
+ // if field has a format function, format the value
60
+ if($acf->fields[$field['type']]->has_format_value())
61
+ {
62
+ $field['value'] = $acf->fields[$field['type']]->format_value($field['value']);
63
+ }
64
+
65
+ // add name + value to variables array
66
+ $variables[$field['name']] = $field['value'];
67
+
68
+ }
69
+
70
+ return new acf_object($variables);
71
+
72
+ }
73
+ else
74
+ {
75
+ return null;
76
+ }
77
+ }
78
+
79
+
80
+ ?>
core/fields/checkbox.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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';
12
+ }
13
+
14
+ function html($options)
15
+ {
16
+ if(empty($options['value']))
17
+ {
18
+ $options['value'] = array();
19
+ }
20
+ else
21
+ {
22
+ $options['value'] = str_replace(', ',',',$options['value']);
23
+ $options['value'] = explode(',',$options['value']);
24
+ }
25
+
26
+ echo '<ul class="checkbox_list '.$options['class'].'">';
27
+ // loop through values and add them as options
28
+ foreach($options['options']['choices'] as $key => $value)
29
+ {
30
+ $selected = '';
31
+ if(in_array($key, $options['value']))
32
+ {
33
+ $selected = 'checked="yes"';
34
+ }
35
+ echo '<li><input type="checkbox" class="'.$options['class'].'" name="'.$options['name'].'[]" value="'.$key.'" '.$selected.' />'.$value.'</li>';
36
+ }
37
+ echo '</ul>';
38
+
39
+ }
40
+
41
+ function has_options()
42
+ {
43
+ return true;
44
+ }
45
+
46
+ function options($key, $options)
47
+ {
48
+ //if($options['choices'] == ''){$options['choices'] = "option 1\noption 2\noption 3";}
49
+ ?>
50
+
51
+ <table>
52
+ <tr>
53
+ <td class="label">
54
+ <label for="">Choices</label>
55
+ <p>Enter your choices one per line. eg:<br />
56
+ Option 1<br />
57
+ Option 2 <br />
58
+ Option 3</p>
59
+ </td>
60
+ <td>
61
+ <textarea rows="5" name="acf[fields][<?php echo $key; ?>][options][choices]" id=""><?php echo $options['choices']; ?></textarea>
62
+ </td>
63
+ </tr>
64
+ </table>
65
+
66
+ <?php
67
+ }
68
+
69
+ function has_format_value()
70
+ {
71
+ return true;
72
+ }
73
+
74
+ function format_value($value)
75
+ {
76
+ $value = str_replace(', ',',',$value);
77
+ $value = explode(',',$value);
78
+
79
+ if(!is_array($value))
80
+ {
81
+ $value = array($value);
82
+ }
83
+
84
+ return $value;
85
+ }
86
+
87
+ }
88
+
89
+ ?>
core/fields/image.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Image
4
+ {
5
+ var $name;
6
+ var $title;
7
+ var $plugin_dir;
8
+
9
+ function Image($plugin_dir)
10
+ {
11
+ $this->name = 'image';
12
+ $this->title = 'Image';
13
+ $this->plugin_dir = $plugin_dir;
14
+ }
15
+
16
+ function html($options)
17
+ {
18
+ echo '<div class="acf_image_uploader">';
19
+
20
+ if($options['value'] != '')
21
+ {
22
+ echo '<a href="#" class="remove_image"></a>';
23
+ echo '<img src="'.$options['value'].'"/>';
24
+ echo '<input type="hidden" name="'.$options['name'].'" value="'.$options['value'].'" />';
25
+ echo '<iframe class="hide" src="'.$this->plugin_dir.'/core/upload.php"></iframe>';
26
+ }
27
+ else
28
+ {
29
+ echo '<a href="#" class="remove_image hide"></a>';
30
+ echo '<input type="hidden" name="'.$options['name'].'" value="'.$options['value'].'" />';
31
+ echo '<iframe src="'.$this->plugin_dir.'/core/upload.php"></iframe>';
32
+ }
33
+
34
+ echo '</div>';
35
+
36
+ }
37
+
38
+ function has_options()
39
+ {
40
+ return false;
41
+ }
42
+
43
+ function has_format_value()
44
+ {
45
+ return false;
46
+ }
47
+
48
+ }
49
+
50
+ ?>
core/fields/page_link.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Page_link
4
+ {
5
+ var $name;
6
+ var $title;
7
+
8
+ function Page_link()
9
+ {
10
+ $this->name = 'page_link';
11
+ $this->title = 'Page Link';
12
+ }
13
+
14
+ function html($options)
15
+ {
16
+
17
+ $post_types = get_post_types(array('public' => true));
18
+ foreach($post_types as $key => $value)
19
+ {
20
+ if($value == 'attachment')
21
+ {
22
+ unset($post_types[$key]);
23
+ }
24
+ }
25
+
26
+ $posts = get_posts(array(
27
+ 'numberposts' => -1,
28
+ 'post_type' => $post_types,
29
+ 'orderby' => 'title',
30
+ 'order' => 'ASC'
31
+ ));
32
+
33
+ $choices = array();
34
+ if($posts)
35
+ {
36
+ foreach($posts as $post)
37
+ {
38
+ $title = get_the_title($post->ID);
39
+
40
+ if(strlen($title) > 33)
41
+ {
42
+ $title = substr($title,0,30).'...';
43
+ }
44
+
45
+ $choices[$post->ID] = $title.' ('.get_post_type($post->ID).')';
46
+ }
47
+ }
48
+ else
49
+ {
50
+ $choices[] = null;
51
+ }
52
+
53
+ $options['options']['choices'] = $choices;
54
+
55
+
56
+
57
+ echo '<select id="'.$options['id'].'" class="'.$options['class'].'" name="'.$options['name'].'" >';
58
+
59
+ // add top option
60
+ echo '<option value="">- Select Option -</option>';
61
+
62
+ // loop through values and add them as options
63
+ foreach($options['options']['choices'] as $key => $value)
64
+ {
65
+ $selected = '';
66
+ if($options['value'] == $key)
67
+ {
68
+ $selected = 'selected="selected"';
69
+ }
70
+ echo '<option value="'.$key.'" '.$selected.'>'.$value.'</option>';
71
+ }
72
+
73
+ echo '</select>';
74
+ }
75
+
76
+ function has_options()
77
+ {
78
+ return false;
79
+ }
80
+
81
+ function has_format_value()
82
+ {
83
+ return true;
84
+ }
85
+
86
+ function format_value($value)
87
+ {
88
+ $value = get_permalink($value);
89
+
90
+ return $value;
91
+ }
92
+
93
+ }
94
+
95
+ ?>
core/fields/select.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Select
4
+ {
5
+ var $name;
6
+ var $title;
7
+
8
+ function Select()
9
+ {
10
+ $this->name = 'select';
11
+ $this->title = 'Select';
12
+ }
13
+
14
+ function html($options)
15
+ {
16
+ //$options['choices'] = explode("\n",$options['choices']);
17
+ if($options['options']['multiple'] == 'true')
18
+ {
19
+ echo '<select id="'.$options['id'].'" class="'.$options['class'].'" name="'.$options['name'].'[]" multiple="multiple" size="5" >';
20
+ }
21
+ else
22
+ {
23
+ echo '<select id="'.$options['id'].'" class="'.$options['class'].'" name="'.$options['name'].'" >';
24
+ // add top option
25
+ echo '<option value="null">- Select Option -</option>';
26
+ }
27
+
28
+
29
+
30
+
31
+
32
+ // loop through values and add them as options
33
+ foreach($options['options']['choices'] as $key => $value)
34
+ {
35
+ $selected = '';
36
+ if(is_array($options['value']))
37
+ {
38
+ if(in_array($key, $options['value']))
39
+ {
40
+ $selected = 'selected="selected"';
41
+ }
42
+ }
43
+ else
44
+ {
45
+ if($key == $options['value'])
46
+ {
47
+ $selected = 'selected="selected"';
48
+ }
49
+ }
50
+
51
+
52
+ echo '<option value="'.$key.'" '.$selected.'>'.$value.'</option>';
53
+ }
54
+
55
+ echo '</select>';
56
+ }
57
+
58
+ function has_options()
59
+ {
60
+ return true;
61
+ }
62
+
63
+ function options($key, $options)
64
+ {
65
+ //if($options['choices'] == ''){$options['choices'] = "option 1\noption 2\noption 3";}
66
+ ?>
67
+ <table class="acf_input">
68
+ <tr>
69
+ <td class="label">
70
+ <label for="">Choices</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">Enter your choices one per line. eg:<br />
75
+ Option 1<br />
76
+ Option 2 <br />
77
+ Option 3</p>
78
+ </td>
79
+ </tr>
80
+ </table>
81
+ <?php
82
+ }
83
+
84
+ function has_format_value()
85
+ {
86
+ return false;
87
+ }
88
+
89
+ }
90
+
91
+ ?>
core/fields/text.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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';
12
+ }
13
+
14
+ function html($options)
15
+ {
16
+ echo '<input type="text" value="'.$options['value'].'" id="'.$options['id'].'" class="'.$options['class'].'" name="'.$options['name'].'" />';
17
+ }
18
+
19
+ function has_options()
20
+ {
21
+ return false;
22
+ }
23
+
24
+ function has_format_value()
25
+ {
26
+ return false;
27
+ }
28
+
29
+ }
30
+
31
+ ?>
core/fields/textarea.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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';
12
+ }
13
+
14
+ function html($options)
15
+ {
16
+ echo '<textarea id="'.$options['id'].'" rows="4" class="'.$options['class'].'" name="'.$options['name'].'" >'.$options['value'].'</textarea>';
17
+ }
18
+
19
+ function has_options()
20
+ {
21
+ return false;
22
+ }
23
+
24
+ function has_format_value()
25
+ {
26
+ return true;
27
+ }
28
+
29
+ function format_value($value)
30
+ {
31
+ $value = nl2br($value);
32
+
33
+ return $value;
34
+ }
35
+ }
36
+
37
+ ?>
core/fields/wysiwyg.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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';
12
+ }
13
+
14
+ function html($options)
15
+ {
16
+ echo '<div class="acf_wysiwyg"><textarea name="'.$options['name'].'" >';
17
+ echo wp_richedit_pre($options['value']);
18
+ echo '</textarea></div>';
19
+ }
20
+
21
+ function has_options()
22
+ {
23
+ return false;
24
+ }
25
+
26
+ function has_format_value()
27
+ {
28
+ return true;
29
+ }
30
+
31
+ function format_value($value)
32
+ {
33
+ $value = apply_filters('the_content',$value);
34
+
35
+ return $value;
36
+ }
37
+ }
38
+
39
+ ?>
core/fields_meta_box copy.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
32
+ <div class="fields_heading">
33
+ <table class="acf">
34
+ <tr>
35
+ <th class="order"><!-- Order --></th>
36
+ <th class="label">Label<br /><span>Shown on the edit page (eg. Hero Image)</span></th>
37
+ <th class="name">Name<br /><span>Used as variable name (eg. hero_image)</span></th>
38
+ <th class="type">Field Type<br /><span>Type of field</span></th>
39
+ <th class="blank"></th>
40
+ <th class="remove"><!-- Remove --></th>
41
+ </tr>
42
+ </table>
43
+ </div>
44
+ <div class="fields">
45
+ <?php foreach($fields as $key => $field): ?>
46
+ <div class="field">
47
+
48
+ <table class="acf">
49
+ <tr>
50
+ <td class="order"><?php echo ($key+1); ?></td>
51
+ <td class="label">
52
+ <?php $this->create_field(array(
53
+ 'type' => 'text',
54
+ 'name' => 'acf[fields]['.$key.'][label]',
55
+ 'value' => $field['label'],
56
+ 'class' => 'label'
57
+ )); ?>
58
+ </td>
59
+ <td class="name">
60
+ <?php $this->create_field(array(
61
+ 'type' => 'text',
62
+ 'name' => 'acf[fields]['.$key.'][name]',
63
+ 'value' => $field['name'],
64
+ 'class' => 'name'
65
+ )); ?>
66
+ </td>
67
+ <td class="type">
68
+ <?php $this->create_field(array(
69
+ 'type' => 'select',
70
+ 'name' => 'acf[fields]['.$key.'][type]',
71
+ 'value' => $field['type'],
72
+ 'class' => 'type',
73
+ 'options' => array('choices' => $fields_names)
74
+ )); ?>
75
+ </td>
76
+ <td class="blank"></td>
77
+ <td class="remove"><a href="javascript:;" class="remove_field"></a></td>
78
+ </tr>
79
+ </table>
80
+
81
+ <div class="field_options">
82
+ <?php foreach($fields_names as $field_name => $field_title): ?>
83
+ <?php if($this->fields[$field_name]->has_options()): ?>
84
+ <div class="field_option" id="<?php echo $field_name; ?>">
85
+ <?php $this->fields[$field_name]->options($key, $field['options']); ?>
86
+ </div>
87
+ <?php endif; ?>
88
+ <?php endforeach; ?>
89
+ </div>
90
+
91
+ </div>
92
+ <?php endforeach; ?>
93
+ </div>
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_save.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*---------------------------------------------------------------------------------------------
3
+ Fields Meta Box
4
+ ---------------------------------------------------------------------------------------------*/
5
+ if($_POST['fields_meta_box'] == 'true')
6
+ {
7
+ $i = 0;
8
+
9
+ foreach($_POST['acf']['fields'] as $field)
10
+ {
11
+ // add post meta
12
+ add_post_meta($post_id, '_acf_field_'.$i.'_label', $field['label']);
13
+ add_post_meta($post_id, '_acf_field_'.$i.'_name', $field['name']);
14
+ add_post_meta($post_id, '_acf_field_'.$i.'_type', $field['type']);
15
+
16
+ //$options = array();
17
+ //foreach($field['options'] as $option)
18
+ //{
19
+ // if(!empty($option))
20
+ // {
21
+ // $options[] = $option;
22
+ // }
23
+ //}
24
+ add_post_meta($post_id, '_acf_field_'.$i.'_options', serialize($field['options']));
25
+
26
+ //print_r(serialize($field['options']));
27
+ //die;
28
+
29
+ // increase counter
30
+ $i++;
31
+ }
32
+ }
33
+
34
+ ?>
core/info_meta_box.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
5
+ <h3 class="hndle"><span>Advanced Custom Fields v<?php echo $this->version; ?></span></h3>
6
+ <div class="inside">
7
+ <table cellpadding="0" cellspacing="0" class="author">
8
+ <tr>
9
+ <td style="width:24px;">
10
+ <img src="<?php echo $this->dir ?>/images/resources.png" />
11
+ </td>
12
+ <td>
13
+ Help / Code. <a href="http://plugins.elliotcondon.com/advanced-custom-fields/">Visit the Plugin Website</a>
14
+ </td>
15
+ </tr>
16
+ </table>
17
+ <table cellpadding="0" cellspacing="0" class="author">
18
+ <tr>
19
+ <td style="width:24px;">
20
+ <img src="<?php echo $this->dir ?>/images/need_help.png" />
21
+ </td>
22
+ <td>
23
+ Need Help? <a href="http://support.plugins.elliotcondon.com/categories/advanced-custom-fields/">Visit the Support Forum</a>
24
+ </td>
25
+ </tr>
26
+ </table>
27
+ <table cellpadding="0" cellspacing="0" class="author">
28
+ <tr>
29
+ <td style="width:24px;">
30
+ <img src="<?php echo $this->dir ?>/images/donate.png" />
31
+ </td>
32
+ <td>
33
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
34
+ <input type="hidden" name="cmd" value="_s-xclick">
35
+ <input type="hidden" name="hosted_button_id" value="4C9N2WFW6B9QL">
36
+ <span>Help fund future development</span><input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_AU/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
37
+ <img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_AU/i/scr/pixel.gif" width="1" height="1">
38
+ </form>
39
+ <!-- Help fund future development <a href="http://www.elliotcondon.com">Donate here</a> -->
40
+ </td>
41
+ </tr>
42
+ </table>
43
+ <table cellpadding="0" cellspacing="0" class="author">
44
+ <tr>
45
+ <td style="width:24px;">
46
+ <img src="<?php echo $this->dir ?>/images/elliot_condon.png" />
47
+ </td>
48
+ <td>
49
+ Created by <a href="http://www.elliotcondon.com">Elliot Condon</a>
50
+ </td>
51
+ </tr>
52
+ </table>
53
+ </div>
54
+ </div>
55
+
56
+
57
+ </div>
core/input_meta_box.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ global $post;
4
+
5
+ $acf = $args['args']['acf'];
6
+
7
+ $fields = $this->get_fields($acf->ID);
8
+ $adv_options = $this->get_adv_options($acf->ID);
9
+ ?>
10
+
11
+ <input type="hidden" name="ei_noncename" id="ei_noncename" value="<?php echo wp_create_nonce('ei-n'); ?>" />
12
+
13
+ <input type="hidden" name="input_meta_box" value="true" />
14
+ <input type="hidden" name="acf[id]" value="<?php echo $acf->ID; ?>" />
15
+
16
+ <?php if(!in_array('the_content',$adv_options['show_on_page'])): // hide the content quicker than jquery ?>
17
+ <style type="text/css">
18
+ #postdivrich {display: none;}
19
+ </style>
20
+ <?php endif; ?>
21
+
22
+ <?php foreach($adv_options['show_on_page'] as $option): ?>
23
+
24
+ <input type="hidden" name="show_<?php echo $option; ?>" value="true" />
25
+ <?php endforeach; ?>
26
+
27
+ <table class="acf_input" id="acf_input">
28
+ <?php foreach($fields as $field): ?>
29
+ <?php
30
+ // if they didn't select a type, skip this field
31
+ if($field['type'] == 'null')
32
+ {
33
+ continue;
34
+ }
35
+
36
+ $field['value'] = get_post_meta($post->ID, '_acf_'.$field['name'], true);
37
+
38
+ $field['id'] = 'acf['.$field['name'].']';
39
+ $field['name'] = 'acf['.$field['name'].']';
40
+
41
+ if($field['type'] == 'select' || $field['type'] == 'checkbox')
42
+ {
43
+ $array = array();
44
+ foreach(explode("\n",$field['options']['choices']) as $choice)
45
+ {
46
+ $array[trim($choice)] = trim($choice);
47
+ }
48
+ $field['options']['choices'] = $array;
49
+ }
50
+
51
+ //print_r($field['options']['choices']);
52
+ ?>
53
+ <tr>
54
+
55
+ <td>
56
+ <label for="<?php echo $field['id']; ?>"><?php echo $field['label']; ?></label>
57
+ <?php $this->create_field($field); ?>
58
+ </td>
59
+ </tr>
60
+ <?php endforeach; ?>
61
+ </table>
core/input_save.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*---------------------------------------------------------------------------------------------
3
+ Fields Meta Box
4
+ ---------------------------------------------------------------------------------------------*/
5
+ if($_POST['input_meta_box'] == 'true')
6
+ {
7
+ foreach($_POST['acf'] as $key => $value)
8
+ {
9
+ if(is_array($value))
10
+ {
11
+ $value = implode(',',$value);
12
+ }
13
+ add_post_meta($post_id, '_acf_'.$key, $value);
14
+ }
15
+ }
16
+
17
+ ?>
core/location_meta_box.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ global $post;
4
+
5
+ // get options
6
+ $location = $this->get_acf_location($post->ID);
7
+ $location['post_type'] = explode(',',str_replace(' ','',$location['post_type']));
8
+
9
+ ?>
10
+
11
+ <input type="hidden" name="location_meta_box" value="true" />
12
+ <input type="hidden" name="ei_noncename" id="ei_noncename" value="<?php echo wp_create_nonce('ei-n'); ?>" />
13
+
14
+ <table class="acf_input" id="acf_location">
15
+ <tr>
16
+ <td class="label">
17
+ <label for="post_type">Post Type's</label>
18
+ </td>
19
+ <td>
20
+ <?php
21
+ $post_types = array();
22
+ foreach (get_post_types() as $post_type ) {
23
+ $post_types[$post_type] = $post_type;
24
+ }
25
+
26
+ unset($post_types['attachment']);
27
+ unset($post_types['nav_menu_item']);
28
+ unset($post_types['revision']);
29
+ unset($post_types['acf']);
30
+
31
+ $this->create_field(array('type'=>'select','name'=>'acf[location][post_type]','value'=>$location['post_type'],'id'=>'post_type', 'options' => array('choices' => $post_types, 'multiple' => 'true')));
32
+ ?>
33
+ <p class="description">Select post types<br />(if your custom post type does not appear, make sure it is publicly queriable)</p>
34
+ </td>
35
+ </tr>
36
+ <tr>
37
+ <td class="label">
38
+ <label for="page_slug">Page Slug's</label>
39
+ </td>
40
+ <td>
41
+ <?php $this->create_field(array('type'=>'text','name'=>'acf[location][page_slug]','value'=>$location['page_slug'],'id'=>'page_slug')); ?>
42
+ <p class="description">eg. home, about-us</p>
43
+ </td>
44
+ </tr>
45
+ <tr>
46
+ <td class="label">
47
+ <label for="post_id">Post ID's</label>
48
+ </td>
49
+ <td>
50
+ <?php $this->create_field(array('type'=>'text','name'=>'acf[location][post_id]','value'=>$location['post_id'],'id'=>'post_id')); ?>
51
+ <p class="description">eg. 1, 2, 3</p>
52
+ </td>
53
+ </tr>
54
+ <tr>
55
+ <td class="label">
56
+ <label for="template_name">Page Template's</label>
57
+ </td>
58
+ <td>
59
+ <?php $this->create_field(array('type'=>'text','name'=>'acf[location][page_template]','value'=>$location['page_template'],'id'=>'page_template')); ?>
60
+ <p class="description">eg. home_page.php</p>
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <td class="label">
65
+ <label for="page_parent">Page Parent ID's</label>
66
+ </td>
67
+ <td>
68
+ <?php $this->create_field(array('type'=>'text','name'=>'acf[location][parent_id]','value'=>$location['parent_id'],'id'=>'parent_id')); ?>
69
+ <p class="description">eg. 1, 2, 3</p>
70
+ </td>
71
+ </tr>
72
+ </table>
core/location_save.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*---------------------------------------------------------------------------------------------
3
+ Fields Meta Box
4
+ ---------------------------------------------------------------------------------------------*/
5
+ if($_POST['location_meta_box'] == 'true')
6
+ {
7
+ $location = $_POST['acf']['location'];
8
+
9
+ // add post meta
10
+ if(is_array($location['post_type']))
11
+ {
12
+ $location['post_type'] = implode(',',$location['post_type']);
13
+ }
14
+
15
+ add_post_meta($post_id, '_acf_location_post_type', $location['post_type']);
16
+ add_post_meta($post_id, '_acf_location_page_slug', $location['page_slug']);
17
+ add_post_meta($post_id, '_acf_location_post_id', $location['post_id']);
18
+ add_post_meta($post_id, '_acf_location_page_template', $location['page_template']);
19
+ add_post_meta($post_id, '_acf_location_parent_id', $location['parent_id']);
20
+
21
+ }
22
+
23
+ ?>
core/options_meta_box.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ global $post;
4
+
5
+ // get options
6
+ $options = $this->get_acf_options($post->ID);
7
+ //print_r($options);
8
+ ?>
9
+
10
+ <input type="hidden" name="options_meta_box" value="true" />
11
+ <input type="hidden" name="ei_noncename" id="ei_noncename" value="<?php echo wp_create_nonce('ei-n'); ?>" />
12
+
13
+ <table class="acf_input" id="acf_options">
14
+ <tr>
15
+ <td class="label">
16
+ <label for="post_type">Show on page</label>
17
+ </td>
18
+ <td>
19
+ <?php
20
+ $show = array(
21
+ 'the_content' => 'Content Editor',
22
+ 'custom_fields' => 'Custom Fields',
23
+ 'discussion' => 'Discussion',
24
+ 'comments' => 'Comments',
25
+ 'slug' => 'Slug',
26
+ 'author' => 'Author'
27
+ );
28
+
29
+ if(empty($options['show_on_page']))
30
+ {
31
+ $options['show_on_page'] = 'bilbo bagains';
32
+ }
33
+ ?>
34
+ <?php $this->create_field(array(
35
+ 'type' => 'checkbox',
36
+ 'name' => 'acf[options][show_on_page]',
37
+ 'value' => $options['show_on_page'],
38
+ 'id' => 'show_on_page',
39
+ 'options' => array('choices' => $show)
40
+ )); ?>
41
+ <p class="description">Unselected items will not be shown on the edit screen.<br>This is useful to clean up the edit page</p>
42
+ </td>
43
+ </tr>
44
+
45
+ </table>
core/options_save.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*---------------------------------------------------------------------------------------------
3
+ Fields Meta Box
4
+ ---------------------------------------------------------------------------------------------*/
5
+ if($_POST['options_meta_box'] == 'true')
6
+ {
7
+ $options = $_POST['acf']['options'];
8
+
9
+ if(is_array($options['show_on_page']))
10
+ {
11
+ $options['show_on_page'] = implode(', ',$options['show_on_page']);
12
+ }
13
+
14
+
15
+ // add post meta
16
+ add_post_meta($post_id, '_acf_option_show_on_page', $options['show_on_page']);
17
+
18
+ }
19
+
20
+ ?>
core/upload.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(isset($_POST['acf_post']))
4
+ {
5
+ if($_FILES['acf_image']['name'] == '')
6
+ {
7
+ //echo '<div class="result">0</div>';
8
+ }
9
+ else
10
+ {
11
+ require_once('../../../../wp-load.php');
12
+ require_once('../../../../wp-admin/admin.php');
13
+
14
+ $override = array('test_form' => false);
15
+ $file = wp_handle_upload( $_FILES['acf_image'], $override );
16
+ //echo '<div class="result">'.$file['url'].'</div>';
17
+ }
18
+ }
19
+
20
+ ?>
21
+ <!DOCTYPE html>
22
+ <html lang="en">
23
+ <head>
24
+
25
+ <meta charset="utf-8" />
26
+ <title>Upload</title>
27
+
28
+ <style type="text/css">
29
+ body {
30
+ padding: 0;
31
+ margin: 0;
32
+ }
33
+
34
+ .result {display: none;}
35
+ </style>
36
+
37
+ </head>
38
+ <body>
39
+
40
+ <?php
41
+ if(isset($_POST['acf_post']) && $_FILES['acf_image']['name'] == '')
42
+ {
43
+ echo '<div class="result">0</div>';
44
+ }
45
+
46
+ if(!empty($file))
47
+ {
48
+ echo '<div class="result">'.$file['url'].'</div>';
49
+ }
50
+ ?>
51
+
52
+ <form id="acf_upload" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" name="acf_upload" enctype="multipart/form-data">
53
+
54
+ <input type="hidden" name="acf_post" value="true" />
55
+ <input type="file" name="acf_image" id="acf_image" />
56
+
57
+ </form>
58
+
59
+ </body>
60
+ </html>
css/style.fields.css ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ Postbox
3
+ ---------------------------------------------------------------------------------------------*/
4
+
5
+ .postbox#acf_fields {
6
+ background: #fff;
7
+ }
8
+
9
+ .postbox#acf_fields .handlediv {
10
+ display: none;
11
+ }
12
+
13
+ .postbox#acf_fields h3.hndle {
14
+ display: none;
15
+ }
16
+
17
+ .postbox#acf_fields .inside {
18
+ margin: 0;
19
+ }
20
+
21
+
22
+ /*---------------------------------------------------------------------------------------------
23
+ Heading
24
+ ---------------------------------------------------------------------------------------------*/
25
+ .fields {
26
+ position: relative;
27
+ overflow: hidden;
28
+ }
29
+
30
+ .fields .field {
31
+ position: relative;
32
+ overflow: hidden;
33
+ border-top: #fff solid 1px;
34
+ border-bottom: #eaeaea solid 1px;
35
+ background: #f6f6f6;
36
+ }
37
+
38
+ .fields .field:hover {
39
+ background:#f9f9f9;
40
+ }
41
+
42
+ .fields .field:hover a.remove_field {
43
+ visibility: visible;
44
+ }
45
+
46
+ .fields .field:first-child {
47
+ border-top: 0 none;
48
+ }
49
+
50
+ .fields .field:last-child {
51
+ border-bottom: 0 none;
52
+ }
53
+
54
+ #acf_fields table{border-collapse:separate; border-spacing:0; vertical-align:top; width: 100%;}
55
+
56
+
57
+ .acf table,
58
+ .acf table tr,
59
+ .acf table tr td {
60
+ vertical-align: top;
61
+ }
62
+
63
+ .acf tr th {
64
+ background: url("../../../../wp-admin/images/gray-grad.png") repeat-x scroll left top #DFDFDF;
65
+ text-shadow: 0 1px 0 #FFFFFF;
66
+ font-weight: bold;
67
+ font-size: 12px;
68
+ line-height: 1.2;
69
+ padding: 8px;
70
+ text-align: left;
71
+ border-bottom: 1px solid #d6d6d6;
72
+ border-right: 1px solid #d6d6d6;
73
+ }
74
+
75
+ .acf tr th span {
76
+ color: #666;
77
+ font-size: 10px;
78
+ line-height: 1.2;
79
+ font-weight: normal;
80
+
81
+ }
82
+
83
+ .acf tr th:last-child{
84
+ border-right: 0 none;
85
+ }
86
+
87
+ .acf tr td.order,
88
+ .acf tr th.order {
89
+ width: 20px;
90
+ text-align: center;
91
+ vertical-align: middle;
92
+ border-right: 0 none;
93
+ color: #CCC;
94
+ text-shadow: #fff 0 1px 0;
95
+ padding: 8px 0 8px 8px;
96
+ }
97
+
98
+ /*
99
+ .acf tr td.order span {
100
+ display: block;
101
+ border: #ebeaea solid 1px;
102
+ border-top: #d7d7d7 solid 1px;
103
+ border-bottom: #fff solid 1px;
104
+ -moz-border-radius: 4px; -webkit-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px;
105
+ text-align: center;
106
+ font-size: 12px;
107
+ line-height: 15px;
108
+ padding: 3px;
109
+ background: #efefef;
110
+ }*/
111
+
112
+ .acf tr td.label,
113
+ .acf tr th.label {
114
+ width: 250px;
115
+ }
116
+
117
+ .acf tr td.name,
118
+ .acf tr th.name {
119
+ width: 250px;
120
+ }
121
+
122
+ .acf tr td.type,
123
+ .acf tr th.type {
124
+ width: 150px;
125
+ }
126
+
127
+ .acf tr td.blank,
128
+ .acf tr th.blank {
129
+ border-right: 0 none;
130
+ }
131
+
132
+ .acf tr td.remove,
133
+ .acf tr th.remove {
134
+ width: 20px;
135
+ }
136
+
137
+ .acf tr td {
138
+ background: transparent;
139
+ border-right: 1px solid #f1f1f1;
140
+ padding: 8px;
141
+ position: relative;
142
+ }
143
+
144
+ .acf tr td:last-child{
145
+ border-right: 0 none;
146
+ }
147
+
148
+ .acf tr td input {
149
+ width: 99.99%;
150
+ margin: 0;
151
+ }
152
+
153
+ .acf tr td select {
154
+ width: 120px;
155
+ margin: 0;
156
+ }
157
+
158
+
159
+ #acf_fields .table_footer {
160
+ position: relative;
161
+ overflow: hidden;
162
+ padding: 8px;
163
+ border-top: 1px solid #DFDFDF;
164
+ background: #EAF2FA;
165
+ }
166
+
167
+ #acf_fields .table_footer .order_message {
168
+ background: url(../images/drag_and_drop_to_reorder.png);
169
+ width: 161px;
170
+ height: 23px;
171
+ float: left;
172
+ margin-left: 5px;
173
+ }
174
+
175
+ #acf_fields .table_footer a#add_field{
176
+ display: block;
177
+ float: right;
178
+ margin: 0;
179
+ text-align: center;
180
+ width: 70px;
181
+ }
182
+
183
+ a.remove_field {
184
+ display: block;
185
+ width: 16px;
186
+ height: 16px;
187
+ background: url(../images/button_remove.png) 0 0 no-repeat;
188
+ visibility: hidden;
189
+ }
190
+
191
+ a.remove_field:hover {
192
+ background-position: 0 100%;
193
+ }
194
+
195
+ a.field_options_button {
196
+ width: 22px;
197
+ height: 31px;
198
+ background: url(../images/field_options.png) 0% 0%;
199
+ display: block;
200
+ position: absolute;
201
+ margin-left: 123px;
202
+ }
203
+
204
+ .acf > tbody > tr > td > select {
205
+ float: left;
206
+ }
207
+
208
+ a.field_options_button:hover {
209
+ background-position: 0% 50%;
210
+ }
211
+
212
+
213
+ .field.options_open table.acf
214
+ {
215
+ border-bottom:#cccccc solid 1px;
216
+ }
217
+
218
+ .field.options_open a.field_options_button {
219
+ background-position: 0% 100%;
220
+ }
221
+
222
+ .inline_metabox {
223
+ border: 0 none;
224
+ width: 100%;
225
+ }
226
+
227
+ .inline_metabox h3 {
228
+ border: 0 none;
229
+ }
230
+ /*---------------------------------------------------------------------------------------------
231
+ Field Options
232
+ ---------------------------------------------------------------------------------------------*/
233
+ .field_options {
234
+ background: #DFDFDF;
235
+ position: relative;
236
+ overflow: hidden;
237
+ }
238
+
239
+ .field_options .field_option {
240
+ display: none;
241
+ position: relative;
242
+ overflow: hidden;
243
+ padding: 6px;
244
+ }
245
+
246
+ .field_options .field_option.open {
247
+ display: block;
248
+ }
249
+
250
+ .field_options .field_option table {
251
+ border: #CCCCCC solid 1px;
252
+ -moz-border-radius: 5px; -webkit-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px;
253
+ }
254
+ /*
255
+ #poststuff .inside .field_options .field_option p {
256
+ font-size: 11px;
257
+ color: #666;
258
+ margin: 2px 0 0;
259
+ }
260
+
261
+ .field_options .field_option label{
262
+ padding-top: 7px;
263
+ display: block;
264
+ font-size: 12px;
265
+ }
266
+
267
+ #acf_fields .field_options .field_option table {
268
+ width: auto;
269
+ vertical-align: top;
270
+ padding: 8px;
271
+ }
272
+
273
+ .field_options .field_option table td{
274
+ padding: 8px;
275
+ font-size: 11px;
276
+ vertical-align: top;
277
+ }
278
+
279
+ .field_options .field_option td.label {
280
+ width: 244px;
281
+ padding-left: 44px;
282
+ }
283
+ */
284
+ .field_options .field_option textarea {
285
+ width: 300px;
286
+
287
+ }
css/style.global.css ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ width: 300px;
41
+ float: left;
42
+ }
43
+
44
+ table.acf_input > tbody > tr > td > p {
45
+ margin: 4px 6px !important;
46
+ color: #BBB;
47
+ float: left;
48
+ }
css/style.info.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ }
css/style.input.css ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .postbox#acf_input {
2
+ border: #DFDFDF solid 0px;
3
+ overflow: hidden;
4
+ background: transparent;
5
+ }
6
+
7
+ .postbox#acf_input h3.hndle{
8
+ display: none;
9
+ }
10
+
11
+ .postbox#acf_input .inside {
12
+ margin: 0;
13
+ }
14
+
15
+
16
+ .postbox#acf_input .handlediv {
17
+ display: none;
18
+ height: 0;
19
+ width: 0;
20
+ }
21
+ .acf_wysiwyg {
22
+ border: #DFDFDF solid 1px;
23
+ overflow: hidden;
24
+ }
25
+
26
+ #post-body .acf_wysiwyg .wp_themeSkin .mceStatusbar a.mceResize {
27
+ top: -2px !important;
28
+ }
29
+
30
+ table.acf_input > tbody > tr > td > input[type="text"],
31
+ table.acf_input > tbody > tr > td > textarea {
32
+ width: 99.8%;
33
+ }
34
+
35
+ .acf_image_uploader {
36
+ position: relative;
37
+ float: left;
38
+ }
39
+
40
+ .acf_image_uploader iframe {
41
+ display: block;
42
+ overflow: hidden;
43
+ height: 40px;
44
+ width: 245px;
45
+ float: left;
46
+ }
47
+
48
+ .acf_image_uploader .loading {
49
+ float: left;
50
+ height: 16px;
51
+ width: 16px;
52
+ margin: 3px 0 0;
53
+ background: url(../images/loading.gif) 50% 50% no-repeat;
54
+ }
55
+
56
+ .acf_image_uploader iframe.hide {
57
+ display: none;
58
+ }
59
+
60
+ .acf_image_uploader a.remove_image {
61
+ width: 16px;
62
+ height: 16px;
63
+ background: url(../images/button_remove.png) 0 0 no-repeat;
64
+ position: absolute;
65
+ top:0;
66
+ left: 0;
67
+ cursor: pointer;
68
+ margin: -3px 0 0 -3px;
69
+ display: none;
70
+ }
71
+
72
+ .acf_image_uploader:hover a.remove_image {
73
+ display: block;
74
+ }
75
+
76
+ .acf_image_uploader:hover a.remove_image.hide {
77
+ display: none;
78
+ }
79
+
80
+ .acf_image_uploader a.remove_image:hover {
81
+ background-position: 0% 100%;
82
+ }
83
+
84
+ .acf_image_uploader img {
85
+ height: 100px;
86
+ width: auto;
87
+ padding: 3px;
88
+ background: #FFF;
89
+ border: #d8d8d8 solid 1px;
90
+ }
91
+
92
+ table.acf_input {
93
+ border: 0 none;
94
+ border-top: 1px solid #eeeeee;
95
+ border-bottom: 1px solid #FFFFFF;
96
+ }
97
+
98
+ table.acf_input {
99
+ background: transparent;
100
+ }
101
+
102
+ table.acf_input > tbody > tr > td {
103
+ border-bottom: 1px solid #eeeeee;
104
+ border-top: 1px solid #FFFFFF;
105
+ padding: 8px;
106
+ }
107
+
108
+ table.acf_input > tbody > tr > td > label {
109
+ color: #21759B;
110
+ font-size: 12px;
111
+ font-weight: bold;
112
+ padding: 0 0 8px;
113
+ text-shadow: 0 1px 0 #FFFFFF;
114
+ }
115
+ table.acf_input > tbody > tr:last-child td {
116
+ border-bottom: 1px solid #eeeeee;
117
+ }
118
+
119
+ table.acf_input > tbody > tr > td > label {
120
+ width: auto;
121
+ }
css/style.location.css ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*.postbox#acf_location {
2
+ border: none;
3
+ }
4
+
5
+ .postbox#acf_location h3 {
6
+ background: transparent none;
7
+ }
8
+
9
+ .postbox#acf_location .hndlediv {
10
+ display: none;
11
+ }
12
+
13
+
14
+ .postbox#acf_location .inside {
15
+ background: transparent;
16
+ margin: 0;
17
+ }*/
18
+
19
+ .postbox#acf_location h3 span.description {
20
+ font-size: 11px;
21
+ color: #666;
22
+ font-weight: normal;
23
+ font-style: normal;
24
+ padding-left: 4px;
25
+ }
26
+
27
+ table.acf_input > tbody > tr > td > select[multiple="multiple"] {
28
+ float: left;
29
+ width: 300px;
30
+ height: auto !important;
31
+ }
css/style.options.css ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .postbox#acf_options .inner {
2
+ background: none repeat scroll 0 0 #F9F9F9;
3
+ }
4
+
5
+ .postbox#acf_options h3 span.description {
6
+ font-size: 11px;
7
+ color: #666;
8
+ font-weight: normal;
9
+ font-style: normal;
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
+
23
+ ul.checkbox_list li input {
24
+ margin: 2px 5px 0 0;
25
+ vertical-align: top;
26
+ }
images/button_add.png ADDED
Binary file
images/button_remove.png ADDED
Binary file
images/donate.png ADDED
Binary file
images/drag_and_drop_to_reorder.png ADDED
Binary file
images/elliot_condon.png ADDED
Binary file
images/field_options.png ADDED
Binary file
images/loading.gif ADDED
Binary file
images/need_help.png ADDED
Binary file
images/resources.png ADDED
Binary file
js/functions.fields.js ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+
3
+ // exists
4
+ $.fn.exists = function(){return jQuery(this).length>0;}
5
+
6
+
7
+ // elements
8
+ var div = $('div.postbox#acf_fields');
9
+ var fields = div.find('.fields');
10
+
11
+
12
+ // vars
13
+ var total_fields = parseInt(div.find('input[name=total_fields]').attr('value')) - 1;
14
+ var fields_limit = parseInt(div.find('input[name=fields_limit]').attr('value')) -1;
15
+
16
+
17
+ div.find('a#add_field').unbind("click").click(function(){
18
+
19
+ // limit fields
20
+ if(total_fields >= fields_limit)
21
+ {
22
+ alert('Field limit reached!');
23
+ return false;
24
+ }
25
+
26
+ // increase total fields
27
+ total_fields++;
28
+
29
+ // clone last tr
30
+ var new_field = fields.find('.field:last-child').clone(true);
31
+
32
+ // update names of input, textarea and all other elements that have name
33
+ new_field.find('[name]').each(function()
34
+ {
35
+ var name = $(this).attr('name').replace('[fields]['+(total_fields-1)+']','[fields]['+(total_fields)+']');
36
+ $(this).attr('name', name);
37
+ $(this).val('');
38
+ $(this).attr('checked','');
39
+ $(this).attr('selected','');
40
+ });
41
+
42
+ // append to table
43
+ fields.append(new_field);
44
+
45
+ new_field.find('select.type').trigger('change');
46
+
47
+
48
+ // update order numbers
49
+ update_order_numbers();
50
+
51
+ return false;
52
+ });
53
+
54
+ // update order numbers
55
+ function update_order_numbers(){
56
+ fields.find('.field').each(function(i){
57
+ $(this).find('td.order').html(i+1);
58
+ });
59
+ }
60
+
61
+ // sortable tr
62
+ fields.sortable({
63
+ update: function(event, ui){update_order_numbers();},
64
+ handle: 'table'
65
+ });
66
+
67
+
68
+ // add default names
69
+ fields.find('.field').each(function(){
70
+
71
+ var _this = $(this);
72
+
73
+ // auto complete name
74
+ _this.find('input.name').unbind('focus').focus(function()
75
+ {
76
+ var _this = $(this).parents('.field');
77
+ if($(this).val() == "")
78
+ {
79
+ var label = _this.find('input.label').val();
80
+ label = label.toLowerCase().split(' ').join('_').split('\'').join('');
81
+ $(this).val(label);
82
+ }
83
+ });
84
+
85
+ // add remove button functionality
86
+ _this.find('a.remove_field').unbind('click').click(function()
87
+ {
88
+ if(fields.find('.field').length <= 1)
89
+ {
90
+ return false;
91
+ }
92
+
93
+ var _this = $(this).parents('.field');
94
+ _this.fadeTo(300,0,function(){
95
+ _this.animate({'height':0}, 300, function(){
96
+ _this.remove();
97
+ update_order_numbers();
98
+ });
99
+ });
100
+
101
+ return false;
102
+ });
103
+
104
+ // show options for type
105
+ _this.find('select.type').change(function()
106
+ {
107
+ var _this = $(this).parents('.field');
108
+
109
+ // store selected value
110
+ var selected = $(this).val();
111
+ var td = $(this).parent();
112
+
113
+ // remove preivous field option button
114
+ td.find('a.field_options_button').remove();
115
+ _this.find('div.field_options div.field_option').hide();
116
+ _this.find('div.field_options div.field_option [name]').attr('disabled', true);
117
+
118
+ // if options...
119
+ if(_this.find('div.field_options').find('div.field_option#'+selected).exists())
120
+ {
121
+ var a = $('<a class="field_options_button" href="javascript:;"></a>');
122
+ td.append(a);
123
+
124
+ a.click(function(){
125
+ if(!$(this).parents('.field').is('.options_open'))
126
+ {
127
+ $(this).parents('.field').addClass('options_open');
128
+ $(this).parents('.field').find('div.field_options div.field_option#'+selected).animate({'height':'toggle'}, 500);
129
+ }
130
+ else
131
+ {
132
+ $(this).parents('.field').find('div.field_options div.field_option#'+selected).animate({'height':'toggle'}, 500, function(){
133
+ $(this).parents('.field').removeClass('options_open');
134
+ });
135
+ }
136
+
137
+ $(this).parents('.field').find('div.field_options div.field_option#'+selected+' [name]').removeAttr('disabled');
138
+ });
139
+ /*var inline_div = td.find('div.field_option#'+selected);
140
+
141
+
142
+
143
+ a.click(function(){
144
+
145
+ inline_div.attr('id','acf_inline_option');
146
+
147
+ $.fancybox({
148
+ padding : 0,
149
+ type : 'inline',
150
+ href : '#acf_inline_option',
151
+ autoDimensions : true,
152
+ overlayColor : '#000',
153
+ onClosed : function(){
154
+ inline_div.attr('id',selected);
155
+ }
156
+ });
157
+
158
+ });*/
159
+
160
+ }
161
+
162
+
163
+
164
+
165
+ //$(this).parents('tr').find('.field_options .field_option').removeClass('open').find('[name]').attr('disabled', true);
166
+ //$(this).parents('tr').find('.field_options .field_option#'+selected).addClass('open').find('[name]').removeAttr('disabled');
167
+
168
+ }).trigger('change');
169
+
170
+
171
+ });
172
+
173
+
174
+
175
+ });
js/functions.info.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+
3
+ $.fn.exists = function(){return jQuery(this).length>0;}
4
+
5
+ // elements
6
+ var div = $('.postbox#acf_input');
7
+ var table = div.find('table#acf_input');
8
+
9
+
10
+ // add code to tinymce
11
+ tinyMCE.settings.theme_advanced_buttons1 += ",|,add_image,add_video,add_audio,add_media";
12
+ tinyMCE.settings.theme_advanced_buttons2 += ",code";
13
+
14
+
15
+ // create wysiwyg's
16
+ table.find('.acf_wysiwyg textarea').each(function(i)
17
+ {
18
+ // make i start from 1 to match row number
19
+ var id = 'acf_wysiwyg_'+(i+1);
20
+ $(this).attr('id',id);
21
+
22
+ tinyMCE.execCommand('mceAddControl', false, id);
23
+
24
+ });
25
+
26
+
27
+ // hide meta boxes
28
+
29
+ var screen_options = $('#screen-meta');
30
+
31
+ // hide content_editor
32
+ if(!div.find('input[name=show_content_editor]').exists())
33
+ {
34
+ $('#postdivrich').hide();
35
+ }
36
+
37
+ // hide custom_fields
38
+ if(!div.find('input[name=show_custom_fields]').exists())
39
+ {
40
+ $('#postcustom').hide();
41
+ screen_options.find('label[for=postcustom-hide]').hide();
42
+ }
43
+
44
+ // hide discussion
45
+ if(!div.find('input[name=show_discussion]').exists())
46
+ {
47
+ $('#commentstatusdiv').hide();
48
+ screen_options.find('label[for=commentstatusdiv-hide]').hide();
49
+ }
50
+
51
+ // hide comments
52
+ if(!div.find('input[name=show_comments]').exists())
53
+ {
54
+ $('#commentsdiv').hide();
55
+ screen_options.find('label[for=commentsdiv-hide]').hide();
56
+ }
57
+
58
+ // hide slug
59
+ if(!div.find('input[name=show_slug]').exists())
60
+ {
61
+ $('#slugdiv').hide();
62
+ screen_options.find('label[for=slugdiv-hide]').hide();
63
+ }
64
+
65
+ // hide author
66
+ if(!div.find('input[name=show_author]').exists())
67
+ {
68
+ $('#authordiv').hide();
69
+ screen_options.find('label[for=authordiv-hide]').hide();
70
+ }
71
+
72
+ screen_options.find('label[for=acf_input-hide]').hide();
73
+
74
+
75
+ // images iframe
76
+
77
+ function setup_iframes()
78
+ {
79
+
80
+ table.find('.acf_image_uploader').each(function(){
81
+
82
+ var div = $(this);
83
+ var iframe = div.find('iframe');
84
+
85
+ iframe.contents().find('input#acf_image').unbind('change').change(function(){
86
+
87
+ // set up load event
88
+ iframe.unbind("load").load(function(){
89
+
90
+ var result = $(this).contents().find('body .result').html();
91
+
92
+ if(result == null)
93
+ {
94
+ //alert('null');
95
+ }
96
+ else if(result == '0')
97
+ {
98
+ //alert('0');
99
+ //window.history.back();
100
+ }
101
+ else
102
+ {
103
+ //alert(result);
104
+ div.children('input[type=hidden]').attr('value',result);
105
+
106
+ div.append('<img src="'+result+'" width="100" height="100" />');
107
+ div.find('img').hide().load(function(){
108
+ $(this).fadeIn(500);
109
+ div.children('a.remove_image').removeClass('hide');
110
+ });
111
+ //iframe.history.back();
112
+ div.find('iframe').addClass('hide');
113
+ }
114
+
115
+ div.find('.loading').remove();
116
+ setup_iframes();
117
+
118
+ });
119
+
120
+ // send image
121
+ iframe.contents().find('form').submit();
122
+
123
+ // add loading div
124
+ div.append('<div class="loading"></div>');
125
+ });
126
+
127
+ div.find('a.remove_image').unbind('click').click(function()
128
+ {
129
+ div.find('input[type=hidden]').val('');
130
+ div.find('img').remove();
131
+ div.find('iframe').removeClass('hide');
132
+ $(this).addClass('hide');
133
+
134
+ return false;
135
+ });
136
+ });
137
+
138
+ }
139
+
140
+ setup_iframes();
141
+
142
+
143
+
144
+ });
readme.txt ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 and more! Hide unwanted metaboxes and assign to any edit page!
10
+
11
+ == Description ==
12
+
13
+ Advanced Custom Fields is the perfect solution for any wordpress website which needs more flexible data like other Content Management Systems.
14
+
15
+ * Visually create your Fields
16
+ * Select from multiple input types (text, textarea, wysiwyg, image upload, page link, select, checkbox, more to come)
17
+ * Assign your fields to multiple edit pages (specific ID's, post types, post slugs, parent ID's, template names)
18
+ * Add, Edit and reorder infinite rows to your fields
19
+ * Easily load data through a simple and friendly API
20
+ * Uses the native WordPress custom post type for ease of use and fast processing
21
+
22
+ = Field Types =
23
+ * Text (type text, api returns text)
24
+ * Text Area (type text, api returns text with `<br />` tags)
25
+ * WYSIWYG (a wordpress wysiwyg editor, api returns html)
26
+ * Image / File (upload an image, api returns the url)
27
+ * Select (drop down list of choices, api returns chosen item)
28
+ * Checkbox (tick for a list of choices, api returns array of choices)
29
+ * Page Link (select a page, post or custom post type form a drop down menu, api returns the url)
30
+ *
31
+
32
+ = Tested on =
33
+ * Mac Firefox :)
34
+ * Mac Safari :)
35
+ * Mac Chrome :)
36
+ * PC Firefox :)
37
+ * PC ie7 :S
38
+
39
+ = Video Tutorials =
40
+ http://plugins.elliotcondon.com/advanced-custom-fields/user-guide/
41
+
42
+ = Website =
43
+ http://plugins.elliotcondon.com/advanced-custom-fields/
44
+
45
+ = Forum Support =
46
+ http://support.plugins.elliotcondon.com/categories/advanced-custom-fields/
47
+
48
+ = Please Vote and Enjoy =
49
+
50
+ == Installation ==
51
+
52
+ 1. Upload 'advanced-custom-fields' to the '/wp-content/plugins/' directory
53
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
54
+ 3. Click on Settings -> Adv Custom Fields and create your first matrix!
55
+
56
+
57
+ == Frequently Asked Questions ==
58
+ Please View the forum
59
+ http://support.plugins.elliotcondon.com/categories/advanced-custom-fields/
60
+
61
+
62
+ == Screenshots ==
63
+ Video Tutorials
64
+ http://plugins.elliotcondon.com/advanced-custom-fields/user-guide/
65
+
66
+
67
+ == Changelog ==
68
+
69
+
70
+ = 1.0.0 =
71
+ * Advanced Custom Fields.