Version Description
- Fixed API returning true for repeater fields with no data
- Added get_fields back into the api!
- Fixed field type select from showing multiple repeater activation messages
Download this release
Release Info
Developer | elliotcondon |
Plugin | Advanced Custom Fields |
Version | 2.1.3 |
Comparing to | |
See all releases |
Code changes from version 2.1.1 to 2.1.3
- acf.php +3 -2
- core/actions/init.php +1 -1
- core/admin/input_meta_box.php +37 -40
- core/admin/options_page.php +38 -14
- core/api.php +79 -4
- core/fields/checkbox.php +1 -1
- core/fields/file.php +1 -1
- core/fields/wysiwyg.php +10 -2
- css/style.global.css +4 -1
- css/style.input.css +0 -1
- images/backgrounds.psd +0 -0
- js/functions.fields.js +1 -1
- js/functions.input.js +44 -38
- readme.txt +13 -0
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: 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.1.
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
@@ -51,7 +51,8 @@ class Acf
|
|
51 |
$this->dir = plugins_url('',__FILE__);
|
52 |
$this->siteurl = get_bloginfo('url');
|
53 |
$this->wpadminurl = admin_url();
|
54 |
-
$this->version = '2.1.
|
|
|
55 |
$this->activated_fields = $this->get_activated_fields();
|
56 |
$this->options_page = new Acf_options_page($this);
|
57 |
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://plugins.elliotcondon.com/advanced-custom-fields/
|
5 |
Description: 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.1.3
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
51 |
$this->dir = plugins_url('',__FILE__);
|
52 |
$this->siteurl = get_bloginfo('url');
|
53 |
$this->wpadminurl = admin_url();
|
54 |
+
$this->version = '2.1.3';
|
55 |
+
$this->upgrade_version = '2.1.0'; // this is the latest version which requires an upgrade
|
56 |
$this->activated_fields = $this->get_activated_fields();
|
57 |
$this->options_page = new Acf_options_page($this);
|
58 |
|
core/actions/init.php
CHANGED
@@ -15,7 +15,7 @@ if(isset($_POST['acf_upgrade']))
|
|
15 |
else
|
16 |
{
|
17 |
// if current version is less than the latest upgrade version, show the upgrade message
|
18 |
-
if(version_compare($version
|
19 |
{
|
20 |
global $acf_temp_mesage;
|
21 |
$acf_temp_mesage = '<form method="post"><p>Advanced Custom Fields v' . $this->version . ' requires a database upgrade. Please <a href="http://codex.wordpress.org/Backing_Up_Your_Database">backup your database</a> then click <input type="submit" class="button" name="acf_upgrade" value="Upgrade Database" /></p></form>';
|
15 |
else
|
16 |
{
|
17 |
// if current version is less than the latest upgrade version, show the upgrade message
|
18 |
+
if(version_compare($version,$this->upgrade_version) < 0)
|
19 |
{
|
20 |
global $acf_temp_mesage;
|
21 |
$acf_temp_mesage = '<form method="post"><p>Advanced Custom Fields v' . $this->version . ' requires a database upgrade. Please <a href="http://codex.wordpress.org/Backing_Up_Your_Database">backup your database</a> then click <input type="submit" class="button" name="acf_upgrade" value="Upgrade Database" /></p></form>';
|
core/admin/input_meta_box.php
CHANGED
@@ -115,56 +115,53 @@
|
|
115 |
// post off and find new fields
|
116 |
$.post(ajaxurl, data, function(data) {
|
117 |
|
118 |
-
|
|
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
}, 500);*/
|
127 |
-
|
128 |
-
$('#acf_fields_ajax .acf_ajax_fields').each(function(){
|
129 |
-
|
130 |
-
old_divs[$(this).attr('data-acf_id')] = $(this);
|
131 |
-
|
132 |
-
$(this).remove();
|
133 |
-
});
|
134 |
|
135 |
-
|
136 |
-
divs.each(function(){
|
137 |
-
|
138 |
-
if(old_divs[$(this).attr('data-acf_id')])
|
139 |
-
{
|
140 |
-
$('#acf_fields_ajax').append(old_divs[$(this).attr('data-acf_id')]);
|
141 |
-
}
|
142 |
-
else
|
143 |
-
{
|
144 |
-
$('#acf_fields_ajax').append($(this));
|
145 |
-
}
|
146 |
-
|
147 |
-
});
|
148 |
|
|
|
|
|
|
|
|
|
|
|
149 |
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
|
|
|
|
154 |
$('#acf_fields_ajax').append($(this));
|
155 |
-
}
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
162 |
|
163 |
|
|
|
|
|
|
|
164 |
});
|
165 |
}
|
166 |
|
167 |
-
|
|
|
|
|
168 |
|
169 |
|
170 |
})(jQuery);
|
115 |
// post off and find new fields
|
116 |
$.post(ajaxurl, data, function(data) {
|
117 |
|
118 |
+
var new_divs = [];
|
119 |
+
var old_divs = [];
|
120 |
|
121 |
+
/*$('#acf_input').removeClass('loading');
|
122 |
+
$('#acf_fields_ajax').animate({
|
123 |
+
opacity : 1
|
124 |
+
}, 500);*/
|
125 |
+
|
126 |
+
$('#acf_fields_ajax .acf_ajax_fields').each(function(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
+
old_divs[$(this).attr('data-acf_id')] = $(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
+
$(this).remove();
|
131 |
+
});
|
132 |
+
|
133 |
+
var divs = $(data).filter(function(){ return $(this).is('.acf_ajax_fields') });
|
134 |
+
divs.each(function(){
|
135 |
|
136 |
+
if(old_divs[$(this).attr('data-acf_id')])
|
137 |
+
{
|
138 |
+
$('#acf_fields_ajax').append(old_divs[$(this).attr('data-acf_id')]);
|
139 |
+
}
|
140 |
+
else
|
141 |
+
{
|
142 |
$('#acf_fields_ajax').append($(this));
|
143 |
+
}
|
144 |
+
|
145 |
+
});
|
146 |
+
|
147 |
+
|
148 |
+
// new dynamic style
|
149 |
+
$('#acf_fields_ajax #acf_dynamic_style').remove();
|
150 |
+
var style = $(data).filter(function(){ return $(this).is('style')});
|
151 |
+
style.each(function(){
|
152 |
+
$('#acf_fields_ajax').append($(this));
|
153 |
+
});
|
154 |
|
155 |
|
156 |
+
$('body').setup_acf();
|
157 |
+
|
158 |
+
|
159 |
});
|
160 |
}
|
161 |
|
162 |
+
$(document).ready(function(){
|
163 |
+
update_fields();
|
164 |
+
});
|
165 |
|
166 |
|
167 |
})(jQuery);
|
core/admin/options_page.php
CHANGED
@@ -73,6 +73,7 @@ class Acf_options_page
|
|
73 |
|
74 |
// Add admin head
|
75 |
add_action('admin_head-'.$options_page, array($this,'admin_head'));
|
|
|
76 |
|
77 |
}
|
78 |
|
@@ -113,6 +114,20 @@ class Acf_options_page
|
|
113 |
}
|
114 |
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
/*---------------------------------------------------------------------------------------------
|
117 |
* admin_print_scripts / admin_print_styles
|
118 |
*
|
@@ -122,20 +137,22 @@ class Acf_options_page
|
|
122 |
---------------------------------------------------------------------------------------------*/
|
123 |
function admin_print_scripts() {
|
124 |
|
125 |
-
wp_enqueue_script(
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
139 |
|
140 |
}
|
141 |
|
@@ -374,6 +391,13 @@ class Acf_options_page
|
|
374 |
</div>
|
375 |
</form>
|
376 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
<?php
|
378 |
}
|
379 |
|
73 |
|
74 |
// Add admin head
|
75 |
add_action('admin_head-'.$options_page, array($this,'admin_head'));
|
76 |
+
add_action('admin_footer-'.$options_page, array($this,'admin_footer'));
|
77 |
|
78 |
}
|
79 |
|
114 |
}
|
115 |
|
116 |
|
117 |
+
/*--------------------------------------------------------------------------------------
|
118 |
+
*
|
119 |
+
* admin_footer
|
120 |
+
*
|
121 |
+
* @author Elliot Condon
|
122 |
+
* @since 2.0.4
|
123 |
+
*
|
124 |
+
*-------------------------------------------------------------------------------------*/
|
125 |
+
function admin_footer()
|
126 |
+
{
|
127 |
+
wp_preload_dialogs( array( 'plugins' => 'safari,inlinepopups,spellchecker,paste,wordpress,media,fullscreen,wpeditimage,wpgallery,tabfocus' ) );
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
/*---------------------------------------------------------------------------------------------
|
132 |
* admin_print_scripts / admin_print_styles
|
133 |
*
|
137 |
---------------------------------------------------------------------------------------------*/
|
138 |
function admin_print_scripts() {
|
139 |
|
140 |
+
wp_enqueue_script(array(
|
141 |
+
'jquery',
|
142 |
+
'jquery-ui-core',
|
143 |
+
|
144 |
+
// wysiwyg
|
145 |
+
'editor',
|
146 |
+
'thickbox',
|
147 |
+
'media-upload',
|
148 |
+
'word-count',
|
149 |
+
'post',
|
150 |
+
'editor-functions',
|
151 |
+
|
152 |
+
// repeater
|
153 |
+
'jquery-ui-sortable'
|
154 |
+
|
155 |
+
));
|
156 |
|
157 |
}
|
158 |
|
391 |
</div>
|
392 |
</form>
|
393 |
</div>
|
394 |
+
<script type="text/javascript">
|
395 |
+
(function($){
|
396 |
+
$(document).ready(function(){
|
397 |
+
$('body').setup_acf();
|
398 |
+
});
|
399 |
+
})(jQuery);
|
400 |
+
</script>
|
401 |
<?php
|
402 |
}
|
403 |
|
core/api.php
CHANGED
@@ -7,7 +7,71 @@ $acf_global = array(
|
|
7 |
'post_id' => 0,
|
8 |
'order_no' => -1,
|
9 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
/*--------------------------------------------------------------------------------------
|
12 |
*
|
13 |
* get_field
|
@@ -57,15 +121,26 @@ function get_field($field_name, $post_id = false)
|
|
57 |
}
|
58 |
|
59 |
|
|
|
|
|
|
|
|
|
|
|
60 |
// repeater field
|
61 |
-
if(
|
62 |
{
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
|
66 |
|
67 |
-
// normal field
|
68 |
-
$field = $results[0];
|
69 |
$value = $field->value;
|
70 |
|
71 |
|
7 |
'post_id' => 0,
|
8 |
'order_no' => -1,
|
9 |
);
|
10 |
+
|
11 |
+
|
12 |
+
/*--------------------------------------------------------------------------------------
|
13 |
+
*
|
14 |
+
* get_fields
|
15 |
+
*
|
16 |
+
* @author Elliot Condon
|
17 |
+
* @since 1.0.3
|
18 |
+
*
|
19 |
+
*-------------------------------------------------------------------------------------*/
|
20 |
+
|
21 |
+
function get_fields($post_id = false)
|
22 |
+
{
|
23 |
+
global $post;
|
24 |
+
global $wpdb;
|
25 |
+
global $acf;
|
26 |
+
|
27 |
+
|
28 |
+
$values = array();
|
29 |
+
|
30 |
+
|
31 |
+
// tables
|
32 |
+
$acf_values = $wpdb->prefix.'acf_values';
|
33 |
+
$acf_fields = $wpdb->prefix.'acf_fields';
|
34 |
+
$wp_postmeta = $wpdb->prefix.'postmeta';
|
35 |
+
|
36 |
+
|
37 |
+
if(!$post_id)
|
38 |
+
{
|
39 |
+
$post_id = $post->ID;
|
40 |
+
}
|
41 |
+
elseif($post_id == "options")
|
42 |
+
{
|
43 |
+
$post_id = 0;
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
$sql = "SELECT f.name
|
48 |
+
FROM $wp_postmeta m
|
49 |
+
LEFT JOIN $acf_values v ON m.meta_id = v.value
|
50 |
+
LEFT JOIN $acf_fields f ON v.field_id = f.id
|
51 |
+
WHERE m.post_id = '$post_id' AND f.name != 'NULL'";
|
52 |
|
53 |
+
$results = $wpdb->get_results($sql);
|
54 |
+
|
55 |
+
|
56 |
+
// no value
|
57 |
+
if(!$results)
|
58 |
+
{
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
// repeater field
|
64 |
+
foreach($results as $field)
|
65 |
+
{
|
66 |
+
$values[$field->name] = get_field($field->name, $post_id);
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
return $values;
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
/*--------------------------------------------------------------------------------------
|
76 |
*
|
77 |
* get_field
|
121 |
}
|
122 |
|
123 |
|
124 |
+
|
125 |
+
// normal field
|
126 |
+
$field = $results[0];
|
127 |
+
|
128 |
+
|
129 |
// repeater field
|
130 |
+
if($field->type == 'repeater')
|
131 |
{
|
132 |
+
$has_values = false;
|
133 |
+
foreach($results as $result)
|
134 |
+
{
|
135 |
+
if($result->value)
|
136 |
+
{
|
137 |
+
$has_values = true;
|
138 |
+
}
|
139 |
+
}
|
140 |
+
return $has_values;
|
141 |
}
|
142 |
|
143 |
|
|
|
|
|
144 |
$value = $field->value;
|
145 |
|
146 |
|
core/fields/checkbox.php
CHANGED
@@ -164,7 +164,7 @@ class acf_Checkbox
|
|
164 |
* @since 1.1
|
165 |
*
|
166 |
---------------------------------------------------------------------------------------------*/
|
167 |
-
function format_value_for_api($value, $options)
|
168 |
{
|
169 |
if(is_array(unserialize($value)))
|
170 |
{
|
164 |
* @since 1.1
|
165 |
*
|
166 |
---------------------------------------------------------------------------------------------*/
|
167 |
+
function format_value_for_api($value, $options = null)
|
168 |
{
|
169 |
if(is_array(unserialize($value)))
|
170 |
{
|
core/fields/file.php
CHANGED
@@ -12,7 +12,7 @@ class acf_File
|
|
12 |
$this->title = __('File','acf');
|
13 |
$this->parent = $parent;
|
14 |
|
15 |
-
add_action(
|
16 |
add_filter('media_send_to_editor', array($this, 'media_send_to_editor'), 15, 2 );
|
17 |
//add_action('admin_init', array($this, 'admin_init'));
|
18 |
|
12 |
$this->title = __('File','acf');
|
13 |
$this->parent = $parent;
|
14 |
|
15 |
+
add_action('admin_head-media-upload-popup', array($this, 'popup_head'));
|
16 |
add_filter('media_send_to_editor', array($this, 'media_send_to_editor'), 15, 2 );
|
17 |
//add_action('admin_init', array($this, 'admin_init'));
|
18 |
|
core/fields/wysiwyg.php
CHANGED
@@ -13,9 +13,17 @@ class acf_Wysiwyg
|
|
13 |
|
14 |
function html($field)
|
15 |
{
|
16 |
-
echo '<div class="acf_wysiwyg"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
echo wp_richedit_pre($field->value);
|
18 |
-
echo '</textarea></div>';
|
19 |
}
|
20 |
|
21 |
function format_value_for_api($value, $options = null)
|
13 |
|
14 |
function html($field)
|
15 |
{
|
16 |
+
echo '<div class="acf_wysiwyg">';
|
17 |
+
?>
|
18 |
+
<div id="editor-toolbar" style="display:none;">
|
19 |
+
|
20 |
+
<div id="media-buttons">
|
21 |
+
Upload/Insert <a title="Add an Image" class="thickbox" id="add_image" href="media-upload.php?post_id=1802&type=image&TB_iframe=1&width=640&height=314"><img onclick="return false;" alt="Add an Image" src="http://localhost:8888/acf/wp-admin/images/media-button-image.gif?ver=20100531"></a><a title="Add Video" class="thickbox" id="add_video" href="media-upload.php?post_id=1802&type=video&TB_iframe=1&width=640&height=314"><img onclick="return false;" alt="Add Video" src="http://localhost:8888/acf/wp-admin/images/media-button-video.gif?ver=20100531"></a><a title="Add Audio" class="thickbox" id="add_audio" href="media-upload.php?post_id=1802&type=audio&TB_iframe=1&width=640&height=314"><img onclick="return false;" alt="Add Audio" src="http://localhost:8888/acf/wp-admin/images/media-button-music.gif?ver=20100531"></a><a title="Add Media" class="thickbox" id="add_media" href="media-upload.php?post_id=1802&TB_iframe=1&width=640&height=314"><img onclick="return false;" alt="Add Media" src="http://localhost:8888/acf/wp-admin/images/media-button-other.gif?ver=20100531"></a> </div>
|
22 |
+
</div>
|
23 |
+
<?php
|
24 |
+
echo '<div id="editorcontainer"><textarea name="'.$field->input_name.'" >';
|
25 |
echo wp_richedit_pre($field->value);
|
26 |
+
echo '</textarea></div></div>';
|
27 |
}
|
28 |
|
29 |
function format_value_for_api($value, $options = null)
|
css/style.global.css
CHANGED
@@ -74,10 +74,13 @@ ul.radio_list {
|
|
74 |
|
75 |
ul.radio_list input[type="radio"] {
|
76 |
margin-right: 5px;
|
77 |
-
|
78 |
}
|
79 |
|
80 |
ul.radio_list.horizontal li {
|
81 |
float: left;
|
82 |
margin-right: 20px;
|
83 |
}
|
|
|
|
|
|
|
|
74 |
|
75 |
ul.radio_list input[type="radio"] {
|
76 |
margin-right: 5px;
|
|
|
77 |
}
|
78 |
|
79 |
ul.radio_list.horizontal li {
|
80 |
float: left;
|
81 |
margin-right: 20px;
|
82 |
}
|
83 |
+
|
84 |
+
ul.checkbox_list input[type="checkbox"] {
|
85 |
+
margin-right: 5px;
|
86 |
+
}
|
css/style.input.css
CHANGED
@@ -68,7 +68,6 @@
|
|
68 |
}
|
69 |
|
70 |
.acf_wysiwyg {
|
71 |
-
border: #DFDFDF solid 1px;
|
72 |
overflow: hidden;
|
73 |
background: #fff;
|
74 |
}
|
68 |
}
|
69 |
|
70 |
.acf_wysiwyg {
|
|
|
71 |
overflow: hidden;
|
72 |
background: #fff;
|
73 |
}
|
images/backgrounds.psd
DELETED
Binary file
|
js/functions.fields.js
CHANGED
@@ -130,7 +130,7 @@
|
|
130 |
var type = $(this).val();
|
131 |
|
132 |
// does it have repeater?
|
133 |
-
if(!$(this).find('option[value="repeater"]').exists())
|
134 |
{
|
135 |
if($(this).closest('.repeater').length == 0)
|
136 |
{
|
130 |
var type = $(this).val();
|
131 |
|
132 |
// does it have repeater?
|
133 |
+
if(!$(this).find('option[value="repeater"]').exists() && !$(this).find('option[value="null"]').exists())
|
134 |
{
|
135 |
if($(this).closest('.repeater').length == 0)
|
136 |
{
|
js/functions.input.js
CHANGED
@@ -27,12 +27,29 @@ window.acf_div = null;
|
|
27 |
|
28 |
$(this).find('.acf_wysiwyg').each(function(){
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
if($(this).find('table').exists())
|
32 |
{
|
33 |
//alert('had wysiwyg')
|
34 |
-
$(this).children('span').remove();
|
35 |
-
$(this).children('textarea').removeAttr('aria-hidden').removeAttr('style');
|
36 |
}
|
37 |
|
38 |
// get a unique id
|
@@ -46,10 +63,20 @@ window.acf_div = null;
|
|
46 |
tinyMCE.execCommand('mceAddControl', false, id);
|
47 |
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
});
|
51 |
|
52 |
-
}
|
53 |
|
54 |
|
55 |
/*----------------------------------------------------------------------
|
@@ -120,9 +147,12 @@ window.acf_div = null;
|
|
120 |
*---------------------------------------------------------------------*/
|
121 |
|
122 |
$.fn.setup_file = function(){
|
123 |
-
|
124 |
-
$(this).find('.acf_file_uploader').each(function(){
|
125 |
|
|
|
|
|
|
|
|
|
|
|
126 |
var div = $(this);
|
127 |
|
128 |
div.find('p.no_file input.button').click(function(){
|
@@ -131,7 +161,7 @@ window.acf_div = null;
|
|
131 |
window.acf_div = div;
|
132 |
|
133 |
// show the thickbox
|
134 |
-
tb_show('Add File to field', 'media-upload.php?type=file&acf_type=file&TB_iframe=1');
|
135 |
|
136 |
return false;
|
137 |
});
|
@@ -281,7 +311,7 @@ window.acf_div = null;
|
|
281 |
$(this).children('td.order').html(i+1);
|
282 |
});
|
283 |
|
284 |
-
}
|
285 |
|
286 |
|
287 |
/*----------------------------------------------------------------------
|
@@ -291,7 +321,6 @@ window.acf_div = null;
|
|
291 |
*---------------------------------------------------------------------*/
|
292 |
$.fn.make_sortable = function(){
|
293 |
|
294 |
-
//alert('make sortable');
|
295 |
var r = $(this);
|
296 |
|
297 |
var fixHelper = function(e, ui) {
|
@@ -313,25 +342,16 @@ window.acf_div = null;
|
|
313 |
helper: fixHelper,
|
314 |
start: function(event, ui)
|
315 |
{
|
316 |
-
|
317 |
-
/*if(ui.item.find('.acf_wysiwyg').exists())
|
318 |
-
{
|
319 |
-
var id = ui.item.find('.acf_wysiwyg textarea').attr('id');
|
320 |
-
tinyMCE.execCommand("mceRemoveControl", false, id);
|
321 |
-
}*/
|
322 |
},
|
323 |
stop: function(event, ui)
|
324 |
{
|
325 |
ui.item.setup_wysiwyg();
|
326 |
-
/*if(ui.item.find('.acf_wysiwyg').exists())
|
327 |
-
{
|
328 |
-
var id = ui.item.find('.acf_wysiwyg textarea').attr('id');
|
329 |
-
tinyMCE.execCommand("mceAddControl", false, id);
|
330 |
-
}*/
|
331 |
}
|
332 |
});
|
333 |
-
}
|
334 |
|
|
|
335 |
|
336 |
|
337 |
/*----------------------------------------------------------------------
|
@@ -351,7 +371,7 @@ window.acf_div = null;
|
|
351 |
|
352 |
var name = wysiwyg.find('textarea').first().attr('name');
|
353 |
|
354 |
-
wysiwyg.html('<textarea name="'+name+'"></textarea>');
|
355 |
}
|
356 |
|
357 |
|
@@ -428,30 +448,16 @@ window.acf_div = null;
|
|
428 |
|
429 |
$.fn.setup_acf = function()
|
430 |
{
|
431 |
-
|
432 |
var div = $('#acf_fields_ajax');
|
433 |
|
434 |
|
435 |
-
if(typeof(tinyMCE) != "undefined")
|
436 |
-
{
|
437 |
-
if(tinyMCE.settings.theme_advanced_buttons1)
|
438 |
-
{
|
439 |
-
tinyMCE.settings.theme_advanced_buttons1 += ",|,add_image,add_video,add_audio,add_media";
|
440 |
-
}
|
441 |
-
|
442 |
-
if(tinyMCE.settings.theme_advanced_buttons2)
|
443 |
-
{
|
444 |
-
tinyMCE.settings.theme_advanced_buttons2 += ",code";
|
445 |
-
}
|
446 |
-
}
|
447 |
-
|
448 |
-
|
449 |
div.setup_wysiwyg();
|
450 |
div.setup_datepicker();
|
451 |
div.setup_image();
|
452 |
div.setup_file();
|
453 |
div.setup_repeater();
|
454 |
-
}
|
455 |
|
456 |
|
457 |
|
@@ -463,7 +469,7 @@ window.acf_div = null;
|
|
463 |
|
464 |
$(document).ready(function(){
|
465 |
|
466 |
-
|
467 |
|
468 |
});
|
469 |
|
27 |
|
28 |
$(this).find('.acf_wysiwyg').each(function(){
|
29 |
|
30 |
+
var tiny_1_old = '';
|
31 |
+
var tiny_2_old = '';
|
32 |
+
|
33 |
+
// setup extra tinymce buttons
|
34 |
+
if(tinyMCE.settings.theme_advanced_buttons1)
|
35 |
+
{
|
36 |
+
tiny_1_old = tinyMCE.settings.theme_advanced_buttons1;
|
37 |
+
tinyMCE.settings.theme_advanced_buttons1 += ",|,add_image,add_video,add_audio,add_media";
|
38 |
+
}
|
39 |
+
|
40 |
+
if(tinyMCE.settings.theme_advanced_buttons2)
|
41 |
+
{
|
42 |
+
tiny_2_old = tinyMCE.settings.theme_advanced_buttons2;
|
43 |
+
tinyMCE.settings.theme_advanced_buttons2 += ",code";
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
|
48 |
if($(this).find('table').exists())
|
49 |
{
|
50 |
//alert('had wysiwyg')
|
51 |
+
$(this).children('#editorcontainer').children('span').remove();
|
52 |
+
$(this).children('#editorcontainer').children('textarea').removeAttr('aria-hidden').removeAttr('style');
|
53 |
}
|
54 |
|
55 |
// get a unique id
|
63 |
tinyMCE.execCommand('mceAddControl', false, id);
|
64 |
|
65 |
|
66 |
+
// restore old tinymce buttons
|
67 |
+
if(tinyMCE.settings.theme_advanced_buttons1)
|
68 |
+
{
|
69 |
+
tinyMCE.settings.theme_advanced_buttons1 = tiny_1_old;
|
70 |
+
}
|
71 |
+
|
72 |
+
if(tinyMCE.settings.theme_advanced_buttons2)
|
73 |
+
{
|
74 |
+
tinyMCE.settings.theme_advanced_buttons2 = tiny_2_old;
|
75 |
+
}
|
76 |
|
77 |
});
|
78 |
|
79 |
+
};
|
80 |
|
81 |
|
82 |
/*----------------------------------------------------------------------
|
147 |
*---------------------------------------------------------------------*/
|
148 |
|
149 |
$.fn.setup_file = function(){
|
|
|
|
|
150 |
|
151 |
+
var post_id = $('input#post_ID').val();
|
152 |
+
|
153 |
+
$(this).find('.acf_file_uploader').each(function(){
|
154 |
+
|
155 |
+
console.log('file setup');
|
156 |
var div = $(this);
|
157 |
|
158 |
div.find('p.no_file input.button').click(function(){
|
161 |
window.acf_div = div;
|
162 |
|
163 |
// show the thickbox
|
164 |
+
tb_show('Add File to field', 'media-upload.php?post_id='+post_id+'&type=file&acf_type=file&TB_iframe=1');
|
165 |
|
166 |
return false;
|
167 |
});
|
311 |
$(this).children('td.order').html(i+1);
|
312 |
});
|
313 |
|
314 |
+
};
|
315 |
|
316 |
|
317 |
/*----------------------------------------------------------------------
|
321 |
*---------------------------------------------------------------------*/
|
322 |
$.fn.make_sortable = function(){
|
323 |
|
|
|
324 |
var r = $(this);
|
325 |
|
326 |
var fixHelper = function(e, ui) {
|
342 |
helper: fixHelper,
|
343 |
start: function(event, ui)
|
344 |
{
|
345 |
+
|
|
|
|
|
|
|
|
|
|
|
346 |
},
|
347 |
stop: function(event, ui)
|
348 |
{
|
349 |
ui.item.setup_wysiwyg();
|
|
|
|
|
|
|
|
|
|
|
350 |
}
|
351 |
});
|
352 |
+
};
|
353 |
|
354 |
+
|
355 |
|
356 |
|
357 |
/*----------------------------------------------------------------------
|
371 |
|
372 |
var name = wysiwyg.find('textarea').first().attr('name');
|
373 |
|
374 |
+
wysiwyg.html('<div id="editorcontainer"><textarea name="'+name+'"></textarea></div>');
|
375 |
}
|
376 |
|
377 |
|
448 |
|
449 |
$.fn.setup_acf = function()
|
450 |
{
|
451 |
+
|
452 |
var div = $('#acf_fields_ajax');
|
453 |
|
454 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
div.setup_wysiwyg();
|
456 |
div.setup_datepicker();
|
457 |
div.setup_image();
|
458 |
div.setup_file();
|
459 |
div.setup_repeater();
|
460 |
+
};
|
461 |
|
462 |
|
463 |
|
469 |
|
470 |
$(document).ready(function(){
|
471 |
|
472 |
+
|
473 |
|
474 |
});
|
475 |
|
readme.txt
CHANGED
@@ -81,6 +81,19 @@ http://support.plugins.elliotcondon.com/categories/advanced-custom-fields/
|
|
81 |
|
82 |
== Changelog ==
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
= 2.1.1 =
|
85 |
* Fixed Javascript bugs on edit pages
|
86 |
|
81 |
|
82 |
== Changelog ==
|
83 |
|
84 |
+
= 2.1.3 =
|
85 |
+
* Fixed API returning true for repeater fields with no data
|
86 |
+
* Added get_fields back into the api!
|
87 |
+
* Fixed field type select from showing multiple repeater activation messages
|
88 |
+
|
89 |
+
|
90 |
+
= 2.1.2 =
|
91 |
+
* Fixed repeater sortable bug on options page
|
92 |
+
* Fixed wysiwyg image insert on options page
|
93 |
+
* Fixed checkbox value error
|
94 |
+
* Tidied up javascript + wysiwyg functions
|
95 |
+
|
96 |
+
|
97 |
= 2.1.1 =
|
98 |
* Fixed Javascript bugs on edit pages
|
99 |
|