Version Description
- [Fixed] Fix IE regex issue (thanks to Ben Heller - http://spruce.it)
- [Added] Check for more translatable strings (thanks to Derk Oosterveld - www.inpoint.nl)
- [Fixed] Fix location rule post category bug
- [Updated] Added all post status to page / post location rules - http://support.advancedcustomfields.com/discussion/2624/scheduled-pages
- [Updated] Updated the page link field to rely on the post_object field
- [Added] Add $post_id parameter to the [acf] shortcode
Download this release
Release Info
Developer | elliotcondon |
Plugin | Advanced Custom Fields |
Version | 3.3.6 |
Comparing to | |
See all releases |
Code changes from version 3.3.5 to 3.3.6
- acf.php +3 -3
- core/api.php +8 -4
- core/controllers/field_group.php +24 -10
- core/controllers/options_page.php +1 -1
- core/controllers/settings.php +8 -8
- core/fields/file.php +2 -2
- core/fields/gallery.php +1 -1
- core/fields/page_link.php +20 -147
- core/fields/post_object.php +2 -2
- core/fields/relationship.php +1 -2
- core/views/meta_box_fields.php +3 -3
- js/input-actions.js +36 -29
- js/input-ajax.js +5 -13
- readme.txt +10 -2
acf.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://www.advancedcustomfields.com/
|
5 |
Description: Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerfull API, it’s a must have for any web developer working with WordPress. Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker, repeater, flexible content, gallery and more!
|
6 |
-
Version: 3.3.
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
@@ -47,7 +47,7 @@ class Acf
|
|
47 |
// vars
|
48 |
$this->path = plugin_dir_path(__FILE__);
|
49 |
$this->dir = plugins_url('',__FILE__);
|
50 |
-
$this->version = '3.3.
|
51 |
$this->upgrade_version = '3.3.3'; // this is the latest version which requires an upgrade
|
52 |
$this->cache = array(); // basic array cache to hold data throughout the page load
|
53 |
|
@@ -865,7 +865,7 @@ class Acf
|
|
865 |
if(isset($_POST['page_type']) && $_POST['page_type'] != 'false') $overrides['page_type'] = $_POST['page_type'];
|
866 |
if(isset($_POST['page']) && $_POST['page'] != 'false') $overrides['page'] = $_POST['page'];
|
867 |
if(isset($_POST['post']) && $_POST['post'] != 'false') $overrides['post'] = $_POST['post'];
|
868 |
-
if(isset($_POST['post_category']) && $_POST['post_category'] != 'false') $overrides['
|
869 |
if(isset($_POST['post_format']) && $_POST['post_format'] != 'false') $overrides['post_format'] = $_POST['post_format'];
|
870 |
if(isset($_POST['taxonomy']) && $_POST['taxonomy'] != 'false') $overrides['taxonomy'] = $_POST['taxonomy'];
|
871 |
}
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://www.advancedcustomfields.com/
|
5 |
Description: Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerfull API, it’s a must have for any web developer working with WordPress. Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker, repeater, flexible content, gallery and more!
|
6 |
+
Version: 3.3.6
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
47 |
// vars
|
48 |
$this->path = plugin_dir_path(__FILE__);
|
49 |
$this->dir = plugins_url('',__FILE__);
|
50 |
+
$this->version = '3.3.6';
|
51 |
$this->upgrade_version = '3.3.3'; // this is the latest version which requires an upgrade
|
52 |
$this->cache = array(); // basic array cache to hold data throughout the page load
|
53 |
|
865 |
if(isset($_POST['page_type']) && $_POST['page_type'] != 'false') $overrides['page_type'] = $_POST['page_type'];
|
866 |
if(isset($_POST['page']) && $_POST['page'] != 'false') $overrides['page'] = $_POST['page'];
|
867 |
if(isset($_POST['post']) && $_POST['post'] != 'false') $overrides['post'] = $_POST['post'];
|
868 |
+
if(isset($_POST['post_category']) && $_POST['post_category'] != 'false') $overrides['post_category'] = $_POST['post_category'];
|
869 |
if(isset($_POST['post_format']) && $_POST['post_format'] != 'false') $overrides['post_format'] = $_POST['post_format'];
|
870 |
if(isset($_POST['taxonomy']) && $_POST['taxonomy'] != 'false') $overrides['taxonomy'] = $_POST['taxonomy'];
|
871 |
}
|
core/api.php
CHANGED
@@ -437,21 +437,25 @@ function acf_shortcode( $atts )
|
|
437 |
{
|
438 |
// extract attributs
|
439 |
extract( shortcode_atts( array(
|
440 |
-
'field' => ""
|
|
|
441 |
), $atts ) );
|
442 |
|
|
|
443 |
// $field is requird
|
444 |
-
if(!$field || $field == "")
|
445 |
{
|
446 |
return "";
|
447 |
}
|
448 |
|
|
|
449 |
// get value and return it
|
450 |
-
$value = get_field($field);
|
|
|
451 |
|
452 |
if(is_array($value))
|
453 |
{
|
454 |
-
$value = @implode(', ',$value);
|
455 |
}
|
456 |
|
457 |
return $value;
|
437 |
{
|
438 |
// extract attributs
|
439 |
extract( shortcode_atts( array(
|
440 |
+
'field' => "",
|
441 |
+
'post_id' => false,
|
442 |
), $atts ) );
|
443 |
|
444 |
+
|
445 |
// $field is requird
|
446 |
+
if( !$field || $field == "" )
|
447 |
{
|
448 |
return "";
|
449 |
}
|
450 |
|
451 |
+
|
452 |
// get value and return it
|
453 |
+
$value = get_field( $field, $post_id );
|
454 |
+
|
455 |
|
456 |
if(is_array($value))
|
457 |
{
|
458 |
+
$value = @implode( ', ',$value );
|
459 |
}
|
460 |
|
461 |
return $value;
|
core/controllers/field_group.php
CHANGED
@@ -290,31 +290,32 @@ class acf_field_group
|
|
290 |
'post_type' => 'page',
|
291 |
'sort_column' => 'menu_order',
|
292 |
'order' => 'ASC',
|
293 |
-
'post_status' => array('publish', 'private', 'draft'),
|
294 |
'suppress_filters' => false,
|
295 |
));
|
296 |
|
297 |
foreach($pages as $page)
|
298 |
{
|
299 |
-
$
|
300 |
$ancestors = get_ancestors($page->ID, 'page');
|
301 |
if($ancestors)
|
302 |
{
|
303 |
foreach($ancestors as $a)
|
304 |
{
|
305 |
-
$
|
306 |
}
|
307 |
}
|
308 |
-
|
|
|
309 |
|
310 |
|
311 |
// status
|
312 |
-
if($page->post_status
|
313 |
{
|
314 |
-
$
|
315 |
}
|
316 |
|
317 |
-
$choices[$page->ID] = $
|
318 |
|
319 |
}
|
320 |
|
@@ -346,10 +347,23 @@ class acf_field_group
|
|
346 |
|
347 |
case "post" :
|
348 |
|
349 |
-
$posts = get_posts(
|
350 |
-
|
|
|
|
|
|
|
|
|
|
|
351 |
{
|
352 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
}
|
354 |
|
355 |
break;
|
290 |
'post_type' => 'page',
|
291 |
'sort_column' => 'menu_order',
|
292 |
'order' => 'ASC',
|
293 |
+
'post_status' => array('publish', 'private', 'draft', 'inherit', 'future'),
|
294 |
'suppress_filters' => false,
|
295 |
));
|
296 |
|
297 |
foreach($pages as $page)
|
298 |
{
|
299 |
+
$title = '';
|
300 |
$ancestors = get_ancestors($page->ID, 'page');
|
301 |
if($ancestors)
|
302 |
{
|
303 |
foreach($ancestors as $a)
|
304 |
{
|
305 |
+
$title .= '- ';
|
306 |
}
|
307 |
}
|
308 |
+
|
309 |
+
$title .= apply_filters( 'the_title', $page->post_title, $page->ID );
|
310 |
|
311 |
|
312 |
// status
|
313 |
+
if($page->post_status != "publish")
|
314 |
{
|
315 |
+
$title .= " ($page->post_status)";
|
316 |
}
|
317 |
|
318 |
+
$choices[$page->ID] = $title;
|
319 |
|
320 |
}
|
321 |
|
347 |
|
348 |
case "post" :
|
349 |
|
350 |
+
$posts = get_posts(array(
|
351 |
+
'numberposts' => '-1',
|
352 |
+
'post_status' => array('publish', 'private', 'draft', 'inherit', 'future'),
|
353 |
+
'suppress_filters' => false,
|
354 |
+
));
|
355 |
+
|
356 |
+
foreach($posts as $post)
|
357 |
{
|
358 |
+
$title = apply_filters( 'the_title', $post->post_title, $post->ID );
|
359 |
+
|
360 |
+
// status
|
361 |
+
if($post->post_status != "publish")
|
362 |
+
{
|
363 |
+
$title .= " ($post->post_status)";
|
364 |
+
}
|
365 |
+
|
366 |
+
$choices[$post->ID] = $title;
|
367 |
}
|
368 |
|
369 |
break;
|
core/controllers/options_page.php
CHANGED
@@ -260,7 +260,7 @@ class acf_options_page
|
|
260 |
<h3 class="hndle"><span><?php _e("Publish",'acf'); ?></span></h3>
|
261 |
<div class="inside">
|
262 |
<input type="hidden" name="HTTP_REFERER" value="<?php echo $_SERVER['HTTP_REFERER'] ?>" />
|
263 |
-
<input type="submit" class="acf-button" value="Save Options" name="update_options" />
|
264 |
</div>
|
265 |
</div>
|
266 |
|
260 |
<h3 class="hndle"><span><?php _e("Publish",'acf'); ?></span></h3>
|
261 |
<div class="inside">
|
262 |
<input type="hidden" name="HTTP_REFERER" value="<?php echo $_SERVER['HTTP_REFERER'] ?>" />
|
263 |
+
<input type="submit" class="acf-button" value="<?php _e("Save Options",'acf'); ?>" name="update_options" />
|
264 |
</div>
|
265 |
</div>
|
266 |
|
core/controllers/settings.php
CHANGED
@@ -199,13 +199,13 @@ if($action == ""):
|
|
199 |
<?php if($this->parent->is_field_unlocked('repeater')){
|
200 |
echo '<span class="activation_code">XXXX-XXXX-XXXX-'.substr($this->parent->get_license_key('repeater'),-4) .'</span>';
|
201 |
echo '<input type="hidden" name="acf_field_deactivate" value="repeater" />';
|
202 |
-
echo '<input type="submit" class="button" value="Deactivate" />';
|
203 |
}
|
204 |
else
|
205 |
{
|
206 |
echo '<input type="text" name="key" value="" />';
|
207 |
echo '<input type="hidden" name="acf_field_activate" value="repeater" />';
|
208 |
-
echo '<input type="submit" class="button" value="Activate" />';
|
209 |
} ?>
|
210 |
</form>
|
211 |
</td>
|
@@ -218,13 +218,13 @@ if($action == ""):
|
|
218 |
<?php if($this->parent->is_field_unlocked('flexible_content')){
|
219 |
echo '<span class="activation_code">XXXX-XXXX-XXXX-'.substr($this->parent->get_license_key('flexible_content'),-4) .'</span>';
|
220 |
echo '<input type="hidden" name="acf_field_deactivate" value="flexible_content" />';
|
221 |
-
echo '<input type="submit" class="button" value="Deactivate" />';
|
222 |
}
|
223 |
else
|
224 |
{
|
225 |
echo '<input type="text" name="key" value="" />';
|
226 |
echo '<input type="hidden" name="acf_field_activate" value="flexible_content" />';
|
227 |
-
echo '<input type="submit" class="button" value="Activate" />';
|
228 |
} ?>
|
229 |
</form>
|
230 |
</td>
|
@@ -237,13 +237,13 @@ if($action == ""):
|
|
237 |
<?php if($this->parent->is_field_unlocked('gallery')){
|
238 |
echo '<span class="activation_code">XXXX-XXXX-XXXX-'.substr($this->parent->get_license_key('gallery'),-4) .'</span>';
|
239 |
echo '<input type="hidden" name="acf_field_deactivate" value="gallery" />';
|
240 |
-
echo '<input type="submit" class="button" value="Deactivate" />';
|
241 |
}
|
242 |
else
|
243 |
{
|
244 |
echo '<input type="text" name="key" value="" />';
|
245 |
echo '<input type="hidden" name="acf_field_activate" value="gallery" />';
|
246 |
-
echo '<input type="submit" class="button" value="Activate" />';
|
247 |
} ?>
|
248 |
</form>
|
249 |
</td>
|
@@ -256,13 +256,13 @@ if($action == ""):
|
|
256 |
<?php if($this->parent->is_field_unlocked('options_page')){
|
257 |
echo '<span class="activation_code">XXXX-XXXX-XXXX-'.substr($this->parent->get_license_key('options_page'),-4) .'</span>';
|
258 |
echo '<input type="hidden" name="acf_field_deactivate" value="options_page" />';
|
259 |
-
echo '<input type="submit" class="button" value="Deactivate" />';
|
260 |
}
|
261 |
else
|
262 |
{
|
263 |
echo '<input type="text" name="key" value="" />';
|
264 |
echo '<input type="hidden" name="acf_field_activate" value="options_page" />';
|
265 |
-
echo '<input type="submit" class="button" value="Activate" />';
|
266 |
} ?>
|
267 |
</form>
|
268 |
</td>
|
199 |
<?php if($this->parent->is_field_unlocked('repeater')){
|
200 |
echo '<span class="activation_code">XXXX-XXXX-XXXX-'.substr($this->parent->get_license_key('repeater'),-4) .'</span>';
|
201 |
echo '<input type="hidden" name="acf_field_deactivate" value="repeater" />';
|
202 |
+
echo '<input type="submit" class="button" value="' . __("Deactivate",'acf') . '" />';
|
203 |
}
|
204 |
else
|
205 |
{
|
206 |
echo '<input type="text" name="key" value="" />';
|
207 |
echo '<input type="hidden" name="acf_field_activate" value="repeater" />';
|
208 |
+
echo '<input type="submit" class="button" value="' . __("Activate",'acf') . '" />';
|
209 |
} ?>
|
210 |
</form>
|
211 |
</td>
|
218 |
<?php if($this->parent->is_field_unlocked('flexible_content')){
|
219 |
echo '<span class="activation_code">XXXX-XXXX-XXXX-'.substr($this->parent->get_license_key('flexible_content'),-4) .'</span>';
|
220 |
echo '<input type="hidden" name="acf_field_deactivate" value="flexible_content" />';
|
221 |
+
echo '<input type="submit" class="button" value="' . __("Deactivate",'acf') . '" />';
|
222 |
}
|
223 |
else
|
224 |
{
|
225 |
echo '<input type="text" name="key" value="" />';
|
226 |
echo '<input type="hidden" name="acf_field_activate" value="flexible_content" />';
|
227 |
+
echo '<input type="submit" class="button" value="' . __("Activate",'acf') . '" />';
|
228 |
} ?>
|
229 |
</form>
|
230 |
</td>
|
237 |
<?php if($this->parent->is_field_unlocked('gallery')){
|
238 |
echo '<span class="activation_code">XXXX-XXXX-XXXX-'.substr($this->parent->get_license_key('gallery'),-4) .'</span>';
|
239 |
echo '<input type="hidden" name="acf_field_deactivate" value="gallery" />';
|
240 |
+
echo '<input type="submit" class="button" value="' . __("Deactivate",'acf') . '" />';
|
241 |
}
|
242 |
else
|
243 |
{
|
244 |
echo '<input type="text" name="key" value="" />';
|
245 |
echo '<input type="hidden" name="acf_field_activate" value="gallery" />';
|
246 |
+
echo '<input type="submit" class="button" value="' . __("Activate",'acf') . '" />';
|
247 |
} ?>
|
248 |
</form>
|
249 |
</td>
|
256 |
<?php if($this->parent->is_field_unlocked('options_page')){
|
257 |
echo '<span class="activation_code">XXXX-XXXX-XXXX-'.substr($this->parent->get_license_key('options_page'),-4) .'</span>';
|
258 |
echo '<input type="hidden" name="acf_field_deactivate" value="options_page" />';
|
259 |
+
echo '<input type="submit" class="button" value="' . __("Deactivate",'acf') . '" />';
|
260 |
}
|
261 |
else
|
262 |
{
|
263 |
echo '<input type="text" name="key" value="" />';
|
264 |
echo '<input type="hidden" name="acf_field_activate" value="options_page" />';
|
265 |
+
echo '<input type="submit" class="button" value="' . __("Activate",'acf') . '" />';
|
266 |
} ?>
|
267 |
</form>
|
268 |
</td>
|
core/fields/file.php
CHANGED
@@ -231,8 +231,8 @@ class acf_File extends acf_Field
|
|
231 |
'value' => $field['save_format'],
|
232 |
'layout' => 'horizontal',
|
233 |
'choices' => array(
|
234 |
-
'url' =>
|
235 |
-
'id' =>
|
236 |
)
|
237 |
));
|
238 |
?>
|
231 |
'value' => $field['save_format'],
|
232 |
'layout' => 'horizontal',
|
233 |
'choices' => array(
|
234 |
+
'url' => __("File URL",'acf'),
|
235 |
+
'id' => __("Attachment ID",'acf')
|
236 |
)
|
237 |
));
|
238 |
?>
|
core/fields/gallery.php
CHANGED
@@ -263,7 +263,7 @@ class acf_Gallery extends acf_Field
|
|
263 |
<li class="view-grid-li active"><div class="divider divider-left"></div><a class="ir view-grid" href="#"><?php _e("Grid",'acf'); ?></a><div class="divider"></div></li>
|
264 |
<li class="view-list-li"><a class="ir view-list" href="#"><?php _e("List",'acf'); ?></a><div class="divider"></div></li>
|
265 |
<li class="count-li right">
|
266 |
-
<span class="count" data-0="No images selected" data-1="1 image selected" data-2="{count} images selected"></span>
|
267 |
</li>
|
268 |
</ul>
|
269 |
</div>
|
263 |
<li class="view-grid-li active"><div class="divider divider-left"></div><a class="ir view-grid" href="#"><?php _e("Grid",'acf'); ?></a><div class="divider"></div></li>
|
264 |
<li class="view-list-li"><a class="ir view-list" href="#"><?php _e("List",'acf'); ?></a><div class="divider"></div></li>
|
265 |
<li class="count-li right">
|
266 |
+
<span class="count" data-0="<?php _e("No images selected",'acf'); ?>" data-1="<?php _e("1 image selected",'acf'); ?>" data-2="<?php _e("{count} images selected",'acf'); ?>"></span>
|
267 |
</li>
|
268 |
</ul>
|
269 |
</div>
|
core/fields/page_link.php
CHANGED
@@ -35,140 +35,10 @@ class acf_Page_link extends acf_Field
|
|
35 |
|
36 |
function create_field($field)
|
37 |
{
|
38 |
-
//
|
39 |
-
$field['
|
40 |
-
$field['post_type'] = isset($field['post_type']) ? $field['post_type'] : false;
|
41 |
-
//$field['meta_key'] = isset($field['meta_key']) ? $field['meta_key'] : false;
|
42 |
-
//$field['meta_value'] = isset($field['meta_value']) ? $field['meta_value'] : false;
|
43 |
|
44 |
-
|
45 |
-
if(!$field['post_type'] || !is_array($field['post_type']) || $field['post_type'][0] == "")
|
46 |
-
{
|
47 |
-
$field['post_type'] = get_post_types(array('public' => true));
|
48 |
-
foreach($field['post_type'] as $key => $value)
|
49 |
-
{
|
50 |
-
if($value == 'attachment')
|
51 |
-
{
|
52 |
-
unset($field['post_type'][$key]);
|
53 |
-
}
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
// multiple select
|
58 |
-
$multiple = '';
|
59 |
-
if($field['multiple'] == '1')
|
60 |
-
{
|
61 |
-
$multiple = ' multiple="multiple" size="5" ';
|
62 |
-
$field['name'] .= '[]';
|
63 |
-
}
|
64 |
-
|
65 |
-
// html
|
66 |
-
echo '<select id="' . $field['name'] . '" class="' . $field['class'] . '" name="' . $field['name'] . '" ' . $multiple . ' >';
|
67 |
-
|
68 |
-
// null
|
69 |
-
if($field['allow_null'] == '1')
|
70 |
-
{
|
71 |
-
echo '<option value="null"> - ' . __("Select",'acf') . ' - </option>';
|
72 |
-
}
|
73 |
-
|
74 |
-
foreach($field['post_type'] as $post_type)
|
75 |
-
{
|
76 |
-
// get posts
|
77 |
-
$posts = false;
|
78 |
-
|
79 |
-
if(is_post_type_hierarchical($post_type))
|
80 |
-
{
|
81 |
-
// get pages
|
82 |
-
$posts = get_pages(array(
|
83 |
-
'numberposts' => -1,
|
84 |
-
'post_type' => $post_type,
|
85 |
-
'sort_column' => 'menu_order',
|
86 |
-
'order' => 'ASC',
|
87 |
-
'post_status' => array('publish', 'private', 'draft', 'inherit', 'future'),
|
88 |
-
'suppress_filters' => false,
|
89 |
-
//'meta_key' => $field['meta_key'],
|
90 |
-
//'meta_value' => $field['meta_value'],
|
91 |
-
));
|
92 |
-
}
|
93 |
-
else
|
94 |
-
{
|
95 |
-
// get posts
|
96 |
-
$posts = get_posts(array(
|
97 |
-
'numberposts' => -1,
|
98 |
-
'post_type' => $post_type,
|
99 |
-
'orderby' => 'title',
|
100 |
-
'order' => 'ASC',
|
101 |
-
'post_status' => array('publish', 'private', 'draft'),
|
102 |
-
'suppress_filters' => false,
|
103 |
-
//'meta_key' => $field['meta_key'],
|
104 |
-
//'meta_value' => $field['meta_value'],
|
105 |
-
));
|
106 |
-
}
|
107 |
-
|
108 |
-
|
109 |
-
// if posts, make a group for them
|
110 |
-
if($posts)
|
111 |
-
{
|
112 |
-
$post_type_object = get_post_type_object($post_type);
|
113 |
-
$post_type_name = $post_type_object->labels->name;
|
114 |
-
|
115 |
-
echo '<optgroup label="'.$post_type_name.'">';
|
116 |
-
|
117 |
-
foreach($posts as $post)
|
118 |
-
{
|
119 |
-
$key = $post->ID;
|
120 |
-
|
121 |
-
$value = '';
|
122 |
-
$ancestors = get_ancestors($post->ID, $post_type);
|
123 |
-
if($ancestors)
|
124 |
-
{
|
125 |
-
foreach($ancestors as $a)
|
126 |
-
{
|
127 |
-
$value .= '– ';
|
128 |
-
}
|
129 |
-
}
|
130 |
-
$value .= get_the_title($post->ID);
|
131 |
-
|
132 |
-
// status
|
133 |
-
if($post->post_status == "private" || $post->post_status == "draft")
|
134 |
-
{
|
135 |
-
$value .= " ($post->post_status)";
|
136 |
-
}
|
137 |
-
|
138 |
-
$selected = '';
|
139 |
-
|
140 |
-
|
141 |
-
if(is_array($field['value']))
|
142 |
-
{
|
143 |
-
// 2. If the value is an array (multiple select), loop through values and check if it is selected
|
144 |
-
if(in_array($key, $field['value']))
|
145 |
-
{
|
146 |
-
$selected = 'selected="selected"';
|
147 |
-
}
|
148 |
-
}
|
149 |
-
else
|
150 |
-
{
|
151 |
-
// 3. this is not a multiple select, just check normaly
|
152 |
-
if($key == $field['value'])
|
153 |
-
{
|
154 |
-
$selected = 'selected="selected"';
|
155 |
-
}
|
156 |
-
}
|
157 |
-
|
158 |
-
|
159 |
-
echo '<option value="'.$key.'" '.$selected.'>'.$value.'</option>';
|
160 |
-
|
161 |
-
|
162 |
-
}
|
163 |
-
|
164 |
-
echo '</optgroup>';
|
165 |
-
|
166 |
-
}// endif
|
167 |
-
|
168 |
-
}// endforeach
|
169 |
-
|
170 |
-
|
171 |
-
echo '</select>';
|
172 |
|
173 |
}
|
174 |
|
@@ -186,35 +56,38 @@ class acf_Page_link extends acf_Field
|
|
186 |
function create_options($key, $field)
|
187 |
{
|
188 |
// defaults
|
189 |
-
$
|
190 |
-
|
191 |
-
|
|
|
|
|
192 |
|
|
|
|
|
193 |
?>
|
194 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
195 |
<td class="label">
|
196 |
<label for=""><?php _e("Post Type",'acf'); ?></label>
|
197 |
-
<p class="description"><?php _e("Filter posts by selecting a post type<br />
|
198 |
-
Tip: deselect all post types to show all post type's posts",'acf'); ?></p>
|
199 |
</td>
|
200 |
<td>
|
201 |
<?php
|
202 |
-
$post_types = array('' => __("All",'acf'));
|
203 |
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
|
213 |
$this->parent->create_field(array(
|
214 |
'type' => 'select',
|
215 |
'name' => 'fields['.$key.'][post_type]',
|
216 |
'value' => $field['post_type'],
|
217 |
-
'choices' => $
|
218 |
'multiple' => '1',
|
219 |
));
|
220 |
?>
|
35 |
|
36 |
function create_field($field)
|
37 |
{
|
38 |
+
// let post_object create the field
|
39 |
+
$field['type'] = 'post_object';
|
|
|
|
|
|
|
40 |
|
41 |
+
$this->parent->create_field( $field );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
}
|
44 |
|
56 |
function create_options($key, $field)
|
57 |
{
|
58 |
// defaults
|
59 |
+
$defaults = array(
|
60 |
+
'post_type' => '',
|
61 |
+
'multiple' => '0',
|
62 |
+
'allow_null' => '0',
|
63 |
+
);
|
64 |
|
65 |
+
$field = array_merge($defaults, $field);
|
66 |
+
|
67 |
?>
|
68 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
69 |
<td class="label">
|
70 |
<label for=""><?php _e("Post Type",'acf'); ?></label>
|
|
|
|
|
71 |
</td>
|
72 |
<td>
|
73 |
<?php
|
|
|
74 |
|
75 |
+
$choices = array(
|
76 |
+
'' => __("All",'acf')
|
77 |
+
);
|
78 |
+
|
79 |
+
$post_types = get_post_types( array('public' => true) );
|
80 |
|
81 |
+
foreach( $post_types as $post_type )
|
82 |
+
{
|
83 |
+
$choices[$post_type] = $post_type;
|
84 |
+
}
|
85 |
|
86 |
$this->parent->create_field(array(
|
87 |
'type' => 'select',
|
88 |
'name' => 'fields['.$key.'][post_type]',
|
89 |
'value' => $field['post_type'],
|
90 |
+
'choices' => $choices,
|
91 |
'multiple' => '1',
|
92 |
));
|
93 |
?>
|
core/fields/post_object.php
CHANGED
@@ -147,11 +147,11 @@ class acf_Post_object extends acf_Field
|
|
147 |
|
148 |
|
149 |
// status
|
150 |
-
if($post->post_status
|
151 |
{
|
152 |
$title .= " ($post->post_status)";
|
153 |
}
|
154 |
-
|
155 |
|
156 |
// add to choices
|
157 |
if( count($field['post_type']) == 1 )
|
147 |
|
148 |
|
149 |
// status
|
150 |
+
if($post->post_status != "publish")
|
151 |
{
|
152 |
$title .= " ($post->post_status)";
|
153 |
}
|
154 |
+
|
155 |
|
156 |
// add to choices
|
157 |
if( count($field['post_type']) == 1 )
|
core/fields/relationship.php
CHANGED
@@ -130,9 +130,8 @@ class acf_Relationship extends acf_Field
|
|
130 |
// find title. Could use get_the_title, but that uses get_post(), so I think this uses less Memory
|
131 |
$title = apply_filters( 'the_title', $post->post_title, $post->ID );
|
132 |
|
133 |
-
|
134 |
// status
|
135 |
-
if($post->post_status
|
136 |
{
|
137 |
$title .= " ($post->post_status)";
|
138 |
}
|
130 |
// find title. Could use get_the_title, but that uses get_post(), so I think this uses less Memory
|
131 |
$title = apply_filters( 'the_title', $post->post_title, $post->ID );
|
132 |
|
|
|
133 |
// status
|
134 |
+
if($post->post_status != "publish")
|
135 |
{
|
136 |
$title .= " ($post->post_status)";
|
137 |
}
|
core/views/meta_box_fields.php
CHANGED
@@ -23,7 +23,7 @@ $fields = $this->parent->get_acf_fields( $post->ID );
|
|
23 |
// add clone
|
24 |
$fields[999] = array(
|
25 |
'label' => __("New Field",'acf'),
|
26 |
-
'name' =>
|
27 |
'type' => 'text',
|
28 |
'order_no' => '1',
|
29 |
'instructions' => '',
|
@@ -167,8 +167,8 @@ foreach( $this->parent->fields as $field )
|
|
167 |
'name' => 'fields['.$key.'][required]',
|
168 |
'value' => $field['required'],
|
169 |
'choices' => array(
|
170 |
-
'1' =>
|
171 |
-
'0' =>
|
172 |
),
|
173 |
'layout' => 'horizontal',
|
174 |
));
|
23 |
// add clone
|
24 |
$fields[999] = array(
|
25 |
'label' => __("New Field",'acf'),
|
26 |
+
'name' => __("new_field",'acf'),
|
27 |
'type' => 'text',
|
28 |
'order_no' => '1',
|
29 |
'instructions' => '',
|
167 |
'name' => 'fields['.$key.'][required]',
|
168 |
'value' => $field['required'],
|
169 |
'choices' => array(
|
170 |
+
'1' => __("Yes",'acf'),
|
171 |
+
'0' => __("No",'acf'),
|
172 |
),
|
173 |
'layout' => 'horizontal',
|
174 |
));
|
js/input-actions.js
CHANGED
@@ -646,19 +646,18 @@ var acf = {
|
|
646 |
|
647 |
div.removeClass('no-results').removeClass('loading');
|
648 |
|
649 |
-
//
|
650 |
-
if(
|
651 |
{
|
652 |
-
div.addClass('no-results');
|
653 |
left.find('li:not(.load-more)').remove();
|
654 |
-
return;
|
655 |
}
|
656 |
|
657 |
|
658 |
-
//
|
659 |
-
if(
|
660 |
{
|
661 |
-
|
|
|
662 |
}
|
663 |
|
664 |
|
@@ -711,31 +710,39 @@ var acf = {
|
|
711 |
// add tinymce to all wysiwyg fields
|
712 |
$(this).find('.acf_wysiwyg textarea').each(function(){
|
713 |
|
|
|
|
|
|
|
|
|
|
|
714 |
|
715 |
-
|
|
|
|
|
716 |
{
|
717 |
-
|
718 |
-
|
719 |
-
tinyMCE.settings.theme_advanced_buttons1 = acf_wysiwyg_buttons.theme_advanced_buttons1;
|
720 |
-
tinyMCE.settings.theme_advanced_buttons2 = acf_wysiwyg_buttons.theme_advanced_buttons2;
|
721 |
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
|
|
737 |
}
|
|
|
738 |
|
|
|
739 |
wpActiveEditor = null;
|
740 |
tinyMCE.execCommand('mceAddControl', false, $(this).attr('id'));
|
741 |
|
@@ -942,7 +949,7 @@ var acf = {
|
|
942 |
|
943 |
// create and add the new field
|
944 |
var new_id = uniqid(),
|
945 |
-
new_field_html = repeater.find('> table > tbody > tr.row-clone').html().replace(/(="[\w-\[\]]*?)(\[999\])/g, '$1[' + new_id + ']'),
|
946 |
new_field = $('<tr class="row"></tr>').append( new_field_html );
|
947 |
|
948 |
|
@@ -1168,7 +1175,7 @@ var acf = {
|
|
1168 |
|
1169 |
// create new field
|
1170 |
var new_id = uniqid(),
|
1171 |
-
new_field_html = div.find('> .clones > .layout[data-layout="' + layout + '"]').html().replace(/(="[\w-\[\]]*?)(\[999\])/g, '$1[' + new_id + ']'),
|
1172 |
new_field = $('<div class="layout" data-layout="' + layout + '"></div>').append( new_field_html );
|
1173 |
|
1174 |
|
646 |
|
647 |
div.removeClass('no-results').removeClass('loading');
|
648 |
|
649 |
+
// new search?
|
650 |
+
if( paged == 1 )
|
651 |
{
|
|
|
652 |
left.find('li:not(.load-more)').remove();
|
|
|
653 |
}
|
654 |
|
655 |
|
656 |
+
// no results?
|
657 |
+
if( !html )
|
658 |
{
|
659 |
+
div.addClass('no-results');
|
660 |
+
return;
|
661 |
}
|
662 |
|
663 |
|
710 |
// add tinymce to all wysiwyg fields
|
711 |
$(this).find('.acf_wysiwyg textarea').each(function(){
|
712 |
|
713 |
+
// don't instantiate if it is a row clone
|
714 |
+
if( $(this).attr('id').indexOf('[999]') >= 0 )
|
715 |
+
{
|
716 |
+
return;
|
717 |
+
}
|
718 |
|
719 |
+
|
720 |
+
// validate tinymce
|
721 |
+
if( tinyMCE == undefined || tinyMCE.settings == undefined )
|
722 |
{
|
723 |
+
return;
|
724 |
+
}
|
|
|
|
|
725 |
|
726 |
+
|
727 |
+
// reset buttons
|
728 |
+
tinyMCE.settings.theme_advanced_buttons1 = acf_wysiwyg_buttons.theme_advanced_buttons1;
|
729 |
+
tinyMCE.settings.theme_advanced_buttons2 = acf_wysiwyg_buttons.theme_advanced_buttons2;
|
730 |
+
|
731 |
+
var toolbar = $(this).closest('.acf_wysiwyg').attr('data-toolbar');
|
732 |
+
|
733 |
+
if(toolbar == 'basic')
|
734 |
+
{
|
735 |
+
tinyMCE.settings.theme_advanced_buttons1 = "bold, italic, underline, blockquote, |, strikethrough, bullist, numlist, justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen";
|
736 |
+
tinyMCE.settings.theme_advanced_buttons2 = "";
|
737 |
+
}
|
738 |
+
else
|
739 |
+
{
|
740 |
+
// add images + code buttons
|
741 |
+
tinyMCE.settings.theme_advanced_buttons2 += ",code";
|
742 |
}
|
743 |
+
|
744 |
|
745 |
+
// activate editor
|
746 |
wpActiveEditor = null;
|
747 |
tinyMCE.execCommand('mceAddControl', false, $(this).attr('id'));
|
748 |
|
949 |
|
950 |
// create and add the new field
|
951 |
var new_id = uniqid(),
|
952 |
+
new_field_html = repeater.find('> table > tbody > tr.row-clone').html().replace(/(=["]*[\w-\[\]]*?)(\[999\])/g, '$1[' + new_id + ']'),
|
953 |
new_field = $('<tr class="row"></tr>').append( new_field_html );
|
954 |
|
955 |
|
1175 |
|
1176 |
// create new field
|
1177 |
var new_id = uniqid(),
|
1178 |
+
new_field_html = div.find('> .clones > .layout[data-layout="' + layout + '"]').html().replace(/(=["]*[\w-\[\]]*?)(\[999\])/g, '$1[' + new_id + ']'),
|
1179 |
new_field = $('<div class="layout" data-layout="' + layout + '"></div>').append( new_field_html );
|
1180 |
|
1181 |
|
js/input-ajax.js
CHANGED
@@ -178,26 +178,18 @@
|
|
178 |
|
179 |
|
180 |
// vars
|
181 |
-
var category = ( $(this).closest('#categorychecklist').exists() ) ? true : false;
|
182 |
var values = ['0'];
|
183 |
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
values.push($(this).val())
|
188 |
});
|
189 |
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
}
|
195 |
-
else
|
196 |
-
{
|
197 |
-
acf.data.taxonomy = values;
|
198 |
-
}
|
199 |
|
200 |
-
|
201 |
update_fields();
|
202 |
|
203 |
});
|
178 |
|
179 |
|
180 |
// vars
|
|
|
181 |
var values = ['0'];
|
182 |
|
183 |
|
184 |
+
$('.categorychecklist input[type="checkbox"]:checked').each(function(){
|
185 |
+
values.push($(this).val());
|
|
|
186 |
});
|
187 |
|
188 |
|
189 |
+
acf.data.post_category = values;
|
190 |
+
acf.data.taxonomy = values;
|
191 |
+
|
|
|
|
|
|
|
|
|
|
|
192 |
|
|
|
193 |
update_fields();
|
194 |
|
195 |
});
|
readme.txt
CHANGED
@@ -51,7 +51,7 @@ http://www.advancedcustomfields.com/docs/getting-started/
|
|
51 |
http://www.advancedcustomfields.com/docs/field-types/
|
52 |
|
53 |
= Bug Submission and Forum Support =
|
54 |
-
http://
|
55 |
|
56 |
= Please Vote and Enjoy =
|
57 |
Your votes really make a difference! Thanks.
|
@@ -70,7 +70,7 @@ Your votes really make a difference! Thanks.
|
|
70 |
|
71 |
= Q. I have a question =
|
72 |
A. Chances are, someone else has asked it. Check out the support forum at:
|
73 |
-
http://
|
74 |
|
75 |
|
76 |
== Screenshots ==
|
@@ -85,6 +85,14 @@ http://www.advancedcustomfields.com/support/
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
= 3.3.5 =
|
89 |
* [Fixed] Fix location rule bug for taxonomy.
|
90 |
|
51 |
http://www.advancedcustomfields.com/docs/field-types/
|
52 |
|
53 |
= Bug Submission and Forum Support =
|
54 |
+
http://support.advancedcustomfields.com/
|
55 |
|
56 |
= Please Vote and Enjoy =
|
57 |
Your votes really make a difference! Thanks.
|
70 |
|
71 |
= Q. I have a question =
|
72 |
A. Chances are, someone else has asked it. Check out the support forum at:
|
73 |
+
http://support.advancedcustomfields.com/
|
74 |
|
75 |
|
76 |
== Screenshots ==
|
85 |
|
86 |
== Changelog ==
|
87 |
|
88 |
+
= 3.3.6 =
|
89 |
+
* [Fixed] Fix IE regex issue (thanks to Ben Heller - http://spruce.it)
|
90 |
+
* [Added] Check for more translatable strings (thanks to Derk Oosterveld - www.inpoint.nl)
|
91 |
+
* [Fixed] Fix location rule post category bug
|
92 |
+
* [Updated] Added all post status to page / post location rules - http://support.advancedcustomfields.com/discussion/2624/scheduled-pages
|
93 |
+
* [Updated] Updated the page link field to rely on the post_object field
|
94 |
+
* [Added] Add $post_id parameter to the [acf] shortcode
|
95 |
+
|
96 |
= 3.3.5 =
|
97 |
* [Fixed] Fix location rule bug for taxonomy.
|
98 |
|