Version Description
- Taxonomy field: Fixed issue causing selected terms to appear as numbers - http://support.advancedcustomfields.com/forums/topic/latest-update-4-2-0-taxonomy-field-not-working-correctly/
- Revisions: Fixed WP 3.6 revisions - http://support.advancedcustomfields.com/forums/topic/wordpress-3-6-revisions-custom-fields-no-longer-tracked/
- Relationship Field: Add new option for return_format
- Location Rule - Add new rule for post status - http://support.advancedcustomfields.com/forums/topic/location-rules-post-status/
- Location Rule: Add 'super admin' to users rule - thanks to Ryan Nielson - https://github.com/RyanNielson/acf/commit/191abf35754c242f2ff75ac33ff8a4dca963a6cc
- Core: Fixed pre_save_post $post_id issue - http://support.advancedcustomfields.com/forums/topic/frontend-form-issues-pre_save_post-save_post/
- Core: Fix minor CSS but in media modal - http://support.advancedcustomfields.com/forums/topic/minor-css-issue-in-media-upload-lightbox/#post-2138
- File field: Fix minor 'strict standards' warning - http://support.advancedcustomfields.com/forums/topic/strict-standards-error-on-file-upload/
- Image field: Fix minor CSS issue - http://support.advancedcustomfields.com/forums/topic/firefox-repeaterimage-css/
Download this release
Release Info
Developer | elliotcondon |
Plugin | Advanced Custom Fields |
Version | 4.2.1 |
Comparing to | |
See all releases |
Code changes from version 4.2.0 to 4.2.1
- acf.php +10 -5
- core/controllers/field_group.php +19 -0
- core/controllers/input.php +0 -116
- core/controllers/location.php +69 -7
- core/controllers/revisions.php +251 -0
- core/fields/_functions.php +4 -4
- core/fields/file.php +3 -1
- core/fields/image.php +0 -7
- core/fields/relationship.php +126 -37
- core/views/meta_box_location.php +4 -3
- css/input.css +20 -1
- js/input.min.js +1 -1
- readme.txt +19 -0
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: 4.2.
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
@@ -38,6 +38,7 @@ if( is_admin() )
|
|
38 |
include_once('core/controllers/upgrade.php');
|
39 |
}
|
40 |
|
|
|
41 |
include_once('core/controllers/everything_fields.php');
|
42 |
}
|
43 |
|
@@ -67,7 +68,7 @@ class Acf
|
|
67 |
'path' => apply_filters('acf/helpers/get_path', __FILE__),
|
68 |
'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
|
69 |
'hook' => basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ),
|
70 |
-
'version' => '4.2.
|
71 |
'upgrade_version' => '3.4.1',
|
72 |
);
|
73 |
|
@@ -284,7 +285,7 @@ class Acf
|
|
284 |
foreach( $value as $k => $v )
|
285 |
{
|
286 |
// bail early for restricted pieces
|
287 |
-
if( in_array($k, $restricted) )
|
288 |
{
|
289 |
continue;
|
290 |
}
|
@@ -711,6 +712,8 @@ class Acf
|
|
711 |
function save_post_lock( $post_id )
|
712 |
{
|
713 |
$GLOBALS['acf_save_lock'] = $post_id;
|
|
|
|
|
714 |
}
|
715 |
|
716 |
|
@@ -730,6 +733,8 @@ class Acf
|
|
730 |
function save_post_unlock( $post_id )
|
731 |
{
|
732 |
$GLOBALS['acf_save_lock'] = false;
|
|
|
|
|
733 |
}
|
734 |
|
735 |
|
@@ -747,7 +752,7 @@ class Acf
|
|
747 |
// load from post
|
748 |
if( !isset($_POST['fields']) )
|
749 |
{
|
750 |
-
return
|
751 |
}
|
752 |
|
753 |
|
@@ -769,7 +774,7 @@ class Acf
|
|
769 |
// if($fields)
|
770 |
|
771 |
|
772 |
-
return
|
773 |
}
|
774 |
|
775 |
|
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: 4.2.2
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
38 |
include_once('core/controllers/upgrade.php');
|
39 |
}
|
40 |
|
41 |
+
include_once('core/controllers/revisions.php');
|
42 |
include_once('core/controllers/everything_fields.php');
|
43 |
}
|
44 |
|
68 |
'path' => apply_filters('acf/helpers/get_path', __FILE__),
|
69 |
'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
|
70 |
'hook' => basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ),
|
71 |
+
'version' => '4.2.2',
|
72 |
'upgrade_version' => '3.4.1',
|
73 |
);
|
74 |
|
285 |
foreach( $value as $k => $v )
|
286 |
{
|
287 |
// bail early for restricted pieces
|
288 |
+
if( in_array($k, $restricted, true) )
|
289 |
{
|
290 |
continue;
|
291 |
}
|
712 |
function save_post_lock( $post_id )
|
713 |
{
|
714 |
$GLOBALS['acf_save_lock'] = $post_id;
|
715 |
+
|
716 |
+
return $post_id;
|
717 |
}
|
718 |
|
719 |
|
733 |
function save_post_unlock( $post_id )
|
734 |
{
|
735 |
$GLOBALS['acf_save_lock'] = false;
|
736 |
+
|
737 |
+
return $post_id;
|
738 |
}
|
739 |
|
740 |
|
752 |
// load from post
|
753 |
if( !isset($_POST['fields']) )
|
754 |
{
|
755 |
+
return $post_id;
|
756 |
}
|
757 |
|
758 |
|
774 |
// if($fields)
|
775 |
|
776 |
|
777 |
+
return $post_id;
|
778 |
}
|
779 |
|
780 |
|
core/controllers/field_group.php
CHANGED
@@ -701,11 +701,30 @@ class acf_field_group
|
|
701 |
|
702 |
break;
|
703 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
704 |
case "user_type" :
|
705 |
|
706 |
global $wp_roles;
|
707 |
|
708 |
$choices = $wp_roles->get_names();
|
|
|
|
|
|
|
|
|
|
|
709 |
|
710 |
break;
|
711 |
|
701 |
|
702 |
break;
|
703 |
|
704 |
+
case "post_status" :
|
705 |
+
|
706 |
+
$choices = array(
|
707 |
+
'publish' => __( 'Publish' ),
|
708 |
+
'pending' => __( 'Pending Review' ),
|
709 |
+
'draft' => __( 'Draft' ),
|
710 |
+
'future' => __( 'Future' ),
|
711 |
+
'private' => __( 'Private' ),
|
712 |
+
'inherit' => __( 'Revision' ),
|
713 |
+
'trash' => __( 'Trash' )
|
714 |
+
);
|
715 |
+
|
716 |
+
break;
|
717 |
+
|
718 |
case "user_type" :
|
719 |
|
720 |
global $wp_roles;
|
721 |
|
722 |
$choices = $wp_roles->get_names();
|
723 |
+
|
724 |
+
if( is_multisite() )
|
725 |
+
{
|
726 |
+
$choices['super_admin'] = __('Super Admin');
|
727 |
+
}
|
728 |
|
729 |
break;
|
730 |
|
core/controllers/input.php
CHANGED
@@ -35,13 +35,6 @@ class acf_input
|
|
35 |
add_action('acf/input/admin_enqueue_scripts', array($this, 'input_admin_enqueue_scripts'));
|
36 |
|
37 |
|
38 |
-
add_action('wp_restore_post_revision', array($this, 'wp_restore_post_revision'), 10, 2 );
|
39 |
-
|
40 |
-
|
41 |
-
// filters
|
42 |
-
add_filter('_wp_post_revision_fields', array($this, 'wp_post_revision_fields') );
|
43 |
-
|
44 |
-
|
45 |
// ajax acf/update_field_groups
|
46 |
add_action('wp_ajax_acf/input/render_fields', array($this, 'ajax_render_fields'));
|
47 |
add_action('wp_ajax_acf/input/get_style', array($this, 'ajax_get_style'));
|
@@ -594,115 +587,6 @@ class acf_input
|
|
594 |
'acf-datepicker',
|
595 |
));
|
596 |
}
|
597 |
-
|
598 |
-
|
599 |
-
/*
|
600 |
-
* wp_restore_post_revision
|
601 |
-
*
|
602 |
-
* @description:
|
603 |
-
* @since 3.4.4
|
604 |
-
* @created: 4/09/12
|
605 |
-
*/
|
606 |
-
|
607 |
-
function wp_restore_post_revision( $parent_id, $revision_id )
|
608 |
-
{
|
609 |
-
global $wpdb;
|
610 |
-
|
611 |
-
|
612 |
-
// get field from postmeta
|
613 |
-
$rows = $wpdb->get_results( $wpdb->prepare(
|
614 |
-
"SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key NOT LIKE %s",
|
615 |
-
$revision_id,
|
616 |
-
'\_%'
|
617 |
-
), ARRAY_A);
|
618 |
-
|
619 |
-
|
620 |
-
if( $rows )
|
621 |
-
{
|
622 |
-
foreach( $rows as $row )
|
623 |
-
{
|
624 |
-
update_post_meta( $parent_id, $row['meta_key'], $row['meta_value'] );
|
625 |
-
}
|
626 |
-
}
|
627 |
-
|
628 |
-
}
|
629 |
-
|
630 |
-
|
631 |
-
/*
|
632 |
-
* wp_post_revision_fields
|
633 |
-
*
|
634 |
-
* @description:
|
635 |
-
* @since 3.4.4
|
636 |
-
* @created: 4/09/12
|
637 |
-
*/
|
638 |
-
|
639 |
-
function wp_post_revision_fields( $fields ) {
|
640 |
-
|
641 |
-
global $post, $wpdb, $revision, $left_revision, $right_revision, $pagenow;
|
642 |
-
|
643 |
-
|
644 |
-
if( $pagenow != "revision.php" )
|
645 |
-
{
|
646 |
-
return $fields;
|
647 |
-
}
|
648 |
-
|
649 |
-
|
650 |
-
// get field from postmeta
|
651 |
-
$rows = $wpdb->get_results( $wpdb->prepare(
|
652 |
-
"SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key NOT LIKE %s",
|
653 |
-
$post->ID,
|
654 |
-
'\_%'
|
655 |
-
), ARRAY_A);
|
656 |
-
|
657 |
-
|
658 |
-
if( $rows )
|
659 |
-
{
|
660 |
-
foreach( $rows as $row )
|
661 |
-
{
|
662 |
-
$fields[ $row['meta_key'] ] = ucwords( str_replace('_', ' ', $row['meta_key']) );
|
663 |
-
|
664 |
-
|
665 |
-
// left vs right
|
666 |
-
if( isset($_GET['left']) && isset($_GET['right']) )
|
667 |
-
{
|
668 |
-
$left = get_metadata( 'post', $_GET['left'], $row['meta_key'], true );
|
669 |
-
$right = get_metadata( 'post', $_GET['right'], $row['meta_key'], true );
|
670 |
-
|
671 |
-
// format arrays
|
672 |
-
if( is_array($left) )
|
673 |
-
{
|
674 |
-
$left = implode(', ', $left);
|
675 |
-
}
|
676 |
-
if( is_array($right) )
|
677 |
-
{
|
678 |
-
$right = implode(', ', $right);
|
679 |
-
}
|
680 |
-
|
681 |
-
|
682 |
-
$left_revision->$row['meta_key'] = $left;
|
683 |
-
$right_revision->$row['meta_key'] = $right;
|
684 |
-
}
|
685 |
-
else
|
686 |
-
{
|
687 |
-
$left = get_metadata( 'post', $revision->ID, $row['meta_key'], true );
|
688 |
-
|
689 |
-
// format arrays
|
690 |
-
if( is_array($left) )
|
691 |
-
{
|
692 |
-
$left = implode(', ', $left);
|
693 |
-
}
|
694 |
-
|
695 |
-
$revision->$row['meta_key'] = $left;
|
696 |
-
}
|
697 |
-
|
698 |
-
}
|
699 |
-
}
|
700 |
-
|
701 |
-
|
702 |
-
return $fields;
|
703 |
-
|
704 |
-
}
|
705 |
-
|
706 |
|
707 |
}
|
708 |
|
35 |
add_action('acf/input/admin_enqueue_scripts', array($this, 'input_admin_enqueue_scripts'));
|
36 |
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
// ajax acf/update_field_groups
|
39 |
add_action('wp_ajax_acf/input/render_fields', array($this, 'ajax_render_fields'));
|
40 |
add_action('wp_ajax_acf/input/get_style', array($this, 'ajax_get_style'));
|
587 |
'acf-datepicker',
|
588 |
));
|
589 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
590 |
|
591 |
}
|
592 |
|
core/controllers/location.php
CHANGED
@@ -43,6 +43,7 @@ class acf_location
|
|
43 |
add_filter('acf/location/rule_match/post', array($this, 'rule_match_post'), 10, 3);
|
44 |
add_filter('acf/location/rule_match/post_category', array($this, 'rule_match_post_category'), 10, 3);
|
45 |
add_filter('acf/location/rule_match/post_format', array($this, 'rule_match_post_format'), 10, 3);
|
|
|
46 |
add_filter('acf/location/rule_match/taxonomy', array($this, 'rule_match_taxonomy'), 10, 3);
|
47 |
|
48 |
// Other
|
@@ -593,13 +594,28 @@ class acf_location
|
|
593 |
$user = wp_get_current_user();
|
594 |
|
595 |
if( $rule['operator'] == "==" )
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
|
604 |
return $match;
|
605 |
|
@@ -712,6 +728,52 @@ class acf_location
|
|
712 |
}
|
713 |
|
714 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
715 |
/*
|
716 |
* rule_match_taxonomy
|
717 |
*
|
43 |
add_filter('acf/location/rule_match/post', array($this, 'rule_match_post'), 10, 3);
|
44 |
add_filter('acf/location/rule_match/post_category', array($this, 'rule_match_post_category'), 10, 3);
|
45 |
add_filter('acf/location/rule_match/post_format', array($this, 'rule_match_post_format'), 10, 3);
|
46 |
+
add_filter('acf/location/rule_match/post_status', array($this, 'rule_match_post_status'), 10, 3);
|
47 |
add_filter('acf/location/rule_match/taxonomy', array($this, 'rule_match_taxonomy'), 10, 3);
|
48 |
|
49 |
// Other
|
594 |
$user = wp_get_current_user();
|
595 |
|
596 |
if( $rule['operator'] == "==" )
|
597 |
+
{
|
598 |
+
if( $rule['value'] == 'super_admin' )
|
599 |
+
{
|
600 |
+
$match = is_super_admin( $user->ID );
|
601 |
+
}
|
602 |
+
else
|
603 |
+
{
|
604 |
+
$match = in_array( $rule['value'], $user->roles );
|
605 |
+
}
|
606 |
+
|
607 |
+
}
|
608 |
+
elseif( $rule['operator'] == "!=" )
|
609 |
+
{
|
610 |
+
if( $rule['value'] == 'super_admin' )
|
611 |
+
{
|
612 |
+
$match = !is_super_admin( $user->ID );
|
613 |
+
}
|
614 |
+
else
|
615 |
+
{
|
616 |
+
$match = ( ! in_array( $rule['value'], $user->roles ) );
|
617 |
+
}
|
618 |
+
}
|
619 |
|
620 |
return $match;
|
621 |
|
728 |
}
|
729 |
|
730 |
|
731 |
+
/*
|
732 |
+
* rule_match_post_status
|
733 |
+
*
|
734 |
+
* @description:
|
735 |
+
* @since: 3.5.7
|
736 |
+
* @created: 3/01/13
|
737 |
+
*/
|
738 |
+
|
739 |
+
function rule_match_post_status( $match, $rule, $options )
|
740 |
+
{
|
741 |
+
// validate
|
742 |
+
if( !$options['post_id'] )
|
743 |
+
{
|
744 |
+
return false;
|
745 |
+
}
|
746 |
+
|
747 |
+
|
748 |
+
// vars
|
749 |
+
$post_status = get_post_status( $options['post_id'] );
|
750 |
+
|
751 |
+
|
752 |
+
// auto-draft = draft
|
753 |
+
if( $post_status == 'auto-draft' )
|
754 |
+
{
|
755 |
+
$post_status = 'draft';
|
756 |
+
}
|
757 |
+
|
758 |
+
|
759 |
+
// match
|
760 |
+
if($rule['operator'] == "==")
|
761 |
+
{
|
762 |
+
$match = ( $post_status === $rule['value'] );
|
763 |
+
|
764 |
+
}
|
765 |
+
elseif($rule['operator'] == "!=")
|
766 |
+
{
|
767 |
+
$match = ( $post_status !== $rule['value'] );
|
768 |
+
}
|
769 |
+
|
770 |
+
|
771 |
+
// return
|
772 |
+
return $match;
|
773 |
+
|
774 |
+
}
|
775 |
+
|
776 |
+
|
777 |
/*
|
778 |
* rule_match_taxonomy
|
779 |
*
|
core/controllers/revisions.php
ADDED
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Revisions
|
5 |
+
*
|
6 |
+
* This Class contains all the functionality for adding ACF fields to the WP revisions interface
|
7 |
+
*
|
8 |
+
* @type class
|
9 |
+
* @date 11/08/13
|
10 |
+
*/
|
11 |
+
|
12 |
+
class acf_revisions
|
13 |
+
{
|
14 |
+
|
15 |
+
/*
|
16 |
+
* __construct
|
17 |
+
*
|
18 |
+
* A good place to add actions / filters
|
19 |
+
*
|
20 |
+
* @type function
|
21 |
+
* @date 11/08/13
|
22 |
+
*
|
23 |
+
* @param N/A
|
24 |
+
* @return N/A
|
25 |
+
*/
|
26 |
+
|
27 |
+
function __construct()
|
28 |
+
{
|
29 |
+
// actions
|
30 |
+
add_action('wp_restore_post_revision', array($this, 'wp_restore_post_revision'), 10, 2 );
|
31 |
+
|
32 |
+
|
33 |
+
// filters
|
34 |
+
add_filter('_wp_post_revision_fields', array($this, 'wp_post_revision_fields') );
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
/*
|
39 |
+
* wp_post_revision_fields
|
40 |
+
*
|
41 |
+
* This filter will add the ACF fields to the returned array
|
42 |
+
* Versions 3.5 and 3.6 of WP feature different uses of the revisions filters, so there are
|
43 |
+
* some hacks to allow both versions to work correctly
|
44 |
+
*
|
45 |
+
* @type filter
|
46 |
+
* @date 11/08/13
|
47 |
+
*
|
48 |
+
* @param $post_id (int)
|
49 |
+
* @return $post_id (int)
|
50 |
+
*/
|
51 |
+
|
52 |
+
function wp_post_revision_fields( $return ) {
|
53 |
+
|
54 |
+
//globals
|
55 |
+
global $post, $pagenow;
|
56 |
+
|
57 |
+
|
58 |
+
// validate
|
59 |
+
$allowed = false;
|
60 |
+
|
61 |
+
|
62 |
+
// Normal revisions page
|
63 |
+
if( $pagenow == 'revision.php' )
|
64 |
+
{
|
65 |
+
$allowed = true;
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
// WP 3.6 AJAX revision
|
70 |
+
if( $pagenow == 'admin-ajax.php' && isset($_POST['action']) && $_POST['action'] == 'get-revision-diffs' )
|
71 |
+
{
|
72 |
+
$allowed = true;
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
// bail
|
77 |
+
if( !$allowed )
|
78 |
+
{
|
79 |
+
return $return;
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
// vars
|
84 |
+
$post_id = 0;
|
85 |
+
|
86 |
+
|
87 |
+
// determin $post_id
|
88 |
+
if( isset($_POST['post_id']) )
|
89 |
+
{
|
90 |
+
$post_id = $_POST['post_id'];
|
91 |
+
}
|
92 |
+
elseif( isset($post->ID) )
|
93 |
+
{
|
94 |
+
$post_id = $post->ID;
|
95 |
+
}
|
96 |
+
else
|
97 |
+
{
|
98 |
+
return $return;
|
99 |
+
}
|
100 |
+
|
101 |
+
|
102 |
+
// get field objects
|
103 |
+
$fields = get_field_objects( $post_id, array('format_value' => false ) );
|
104 |
+
|
105 |
+
|
106 |
+
if( $fields )
|
107 |
+
{
|
108 |
+
foreach( $fields as $field )
|
109 |
+
{
|
110 |
+
// dud field?
|
111 |
+
if( !$field || !isset($field['name']) || !$field['name'] )
|
112 |
+
{
|
113 |
+
continue;
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
// Add field key / label
|
118 |
+
$return[ $field['name'] ] = $field['label'];
|
119 |
+
|
120 |
+
|
121 |
+
// load value
|
122 |
+
add_filter('_wp_post_revision_field_' . $field['name'], array($this, 'wp_post_revision_field'), 10, 4);
|
123 |
+
|
124 |
+
|
125 |
+
// WP 3.5: left vs right
|
126 |
+
// Add a value of the revision ID (as there is no way to determin this within the '_wp_post_revision_field_' filter!)
|
127 |
+
if( isset($_GET['action'], $_GET['left'], $_GET['right']) && $_GET['action'] == 'diff' )
|
128 |
+
{
|
129 |
+
global $left_revision, $right_revision;
|
130 |
+
|
131 |
+
$left_revision->$field['name'] = 'revision_id=' . $_GET['left'];
|
132 |
+
$right_revision->$field['name'] = 'revision_id=' . $_GET['right'];
|
133 |
+
}
|
134 |
+
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
return $return;
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
/*
|
144 |
+
* wp_post_revision_field
|
145 |
+
*
|
146 |
+
* This filter will load the value for the given field and return it for rendering
|
147 |
+
*
|
148 |
+
* @type filter
|
149 |
+
* @date 11/08/13
|
150 |
+
*
|
151 |
+
* @param $value (mixed) should be false as it has not yet been loaded
|
152 |
+
* @param $field_name (string) The name of the field
|
153 |
+
* @param $post (mixed) Holds the $post object to load from - in WP 3.5, this is not passed!
|
154 |
+
* @param $direction (string) to / from - not used
|
155 |
+
* @return $value (string)
|
156 |
+
*/
|
157 |
+
|
158 |
+
function wp_post_revision_field( $value, $field_name, $post = null, $direction = false)
|
159 |
+
{
|
160 |
+
// vars
|
161 |
+
$post_id = 0;
|
162 |
+
|
163 |
+
|
164 |
+
// determin $post_id
|
165 |
+
if( isset($post->ID) )
|
166 |
+
{
|
167 |
+
// WP 3.6
|
168 |
+
$post_id = $post->ID;
|
169 |
+
}
|
170 |
+
elseif( isset($_GET['revision']) )
|
171 |
+
{
|
172 |
+
// WP 3.5
|
173 |
+
$post_id = (int) $_GET['revision'];
|
174 |
+
}
|
175 |
+
elseif( strpos($value, 'revision_id=') !== false )
|
176 |
+
{
|
177 |
+
// WP 3.5 (left vs right)
|
178 |
+
$post_id = (int) str_replace('revision_id=', '', $value);
|
179 |
+
}
|
180 |
+
|
181 |
+
|
182 |
+
// load field
|
183 |
+
$field = get_field_object($field_name, $post_id, array('format_value' => false ));
|
184 |
+
$value = $field['value'];
|
185 |
+
|
186 |
+
|
187 |
+
// default formatting
|
188 |
+
if( is_array($value) )
|
189 |
+
{
|
190 |
+
$value = implode(', ', $value);
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
// format
|
195 |
+
if( $value )
|
196 |
+
{
|
197 |
+
// image?
|
198 |
+
if( $field['type'] == 'image' || $field['type'] == 'file' )
|
199 |
+
{
|
200 |
+
$url = wp_get_attachment_url($value);
|
201 |
+
$value = $value . ' (' . $url . ')';
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
|
206 |
+
// return
|
207 |
+
return $value;
|
208 |
+
}
|
209 |
+
|
210 |
+
|
211 |
+
/*
|
212 |
+
* wp_restore_post_revision
|
213 |
+
*
|
214 |
+
* This action will copy and paste the metadata from a revision to the post
|
215 |
+
*
|
216 |
+
* @type action
|
217 |
+
* @date 11/08/13
|
218 |
+
*
|
219 |
+
* @param $parent_id (int) the destination post
|
220 |
+
* @return $revision_id (int) the source post
|
221 |
+
*/
|
222 |
+
|
223 |
+
function wp_restore_post_revision( $parent_id, $revision_id )
|
224 |
+
{
|
225 |
+
global $wpdb;
|
226 |
+
|
227 |
+
|
228 |
+
// get field from postmeta
|
229 |
+
$rows = $wpdb->get_results( $wpdb->prepare(
|
230 |
+
"SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key NOT LIKE %s",
|
231 |
+
$revision_id,
|
232 |
+
'\_%'
|
233 |
+
), ARRAY_A);
|
234 |
+
|
235 |
+
|
236 |
+
if( $rows )
|
237 |
+
{
|
238 |
+
foreach( $rows as $row )
|
239 |
+
{
|
240 |
+
update_post_meta( $parent_id, $row['meta_key'], $row['meta_value'] );
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
}
|
245 |
+
|
246 |
+
|
247 |
+
}
|
248 |
+
|
249 |
+
new acf_revisions();
|
250 |
+
|
251 |
+
?>
|
core/fields/_functions.php
CHANGED
@@ -331,12 +331,12 @@ class acf_field_functions
|
|
331 |
$field = $row['meta_value'];
|
332 |
$field = maybe_unserialize( $field );
|
333 |
$field = maybe_unserialize( $field ); // run again for WPML
|
|
|
|
|
|
|
|
|
334 |
}
|
335 |
|
336 |
-
|
337 |
-
// add field_group ID
|
338 |
-
$field['field_group'] = $row['post_id'];
|
339 |
-
|
340 |
}
|
341 |
}
|
342 |
|
331 |
$field = $row['meta_value'];
|
332 |
$field = maybe_unserialize( $field );
|
333 |
$field = maybe_unserialize( $field ); // run again for WPML
|
334 |
+
|
335 |
+
|
336 |
+
// add field_group ID
|
337 |
+
$field['field_group'] = $row['post_id'];
|
338 |
}
|
339 |
|
|
|
|
|
|
|
|
|
340 |
}
|
341 |
}
|
342 |
|
core/fields/file.php
CHANGED
@@ -80,7 +80,9 @@ class acf_field_file extends acf_field
|
|
80 |
$o['title'] = $file->post_title;
|
81 |
$o['size'] = size_format(filesize( get_attached_file( $file->ID ) ));
|
82 |
$o['url'] = wp_get_attachment_url( $file->ID );
|
83 |
-
|
|
|
|
|
84 |
}
|
85 |
}
|
86 |
|
80 |
$o['title'] = $file->post_title;
|
81 |
$o['size'] = size_format(filesize( get_attached_file( $file->ID ) ));
|
82 |
$o['url'] = wp_get_attachment_url( $file->ID );
|
83 |
+
|
84 |
+
$explode = explode('/', $o['url']);
|
85 |
+
$o['name'] = end( $explode );
|
86 |
}
|
87 |
}
|
88 |
|
core/fields/image.php
CHANGED
@@ -198,13 +198,6 @@ class acf_field_image extends acf_field
|
|
198 |
|
199 |
function format_value_for_api( $value, $post_id, $field )
|
200 |
{
|
201 |
-
// vars
|
202 |
-
$defaults = array(
|
203 |
-
'save_format' => 'url',
|
204 |
-
);
|
205 |
-
|
206 |
-
$field = array_merge($defaults, $field);
|
207 |
-
|
208 |
|
209 |
// validate
|
210 |
if( !$value )
|
198 |
|
199 |
function format_value_for_api( $value, $post_id, $field )
|
200 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
// validate
|
203 |
if( !$value )
|
core/fields/relationship.php
CHANGED
@@ -18,11 +18,12 @@ class acf_field_relationship extends acf_field
|
|
18 |
$this->label = __("Relationship",'acf');
|
19 |
$this->category = __("Relational",'acf');
|
20 |
$this->defaults = array(
|
21 |
-
'post_type'
|
22 |
-
'max'
|
23 |
-
'taxonomy'
|
24 |
-
'filters'
|
25 |
-
'result_elements'
|
|
|
26 |
);
|
27 |
$this->l10n = array(
|
28 |
'max' => __("Maximum values reached ( {max} values )",'acf'),
|
@@ -144,7 +145,7 @@ class acf_field_relationship extends acf_field
|
|
144 |
'paged' => 1,
|
145 |
'orderby' => 'title',
|
146 |
'order' => 'ASC',
|
147 |
-
'post_status' =>
|
148 |
'suppress_filters' => false,
|
149 |
's' => '',
|
150 |
'lang' => false,
|
@@ -563,6 +564,26 @@ class acf_field_relationship extends acf_field
|
|
563 |
$key = $field['name'];
|
564 |
|
565 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
567 |
<td class="label">
|
568 |
<label for=""><?php _e("Post Type",'acf'); ?></label>
|
@@ -698,51 +719,27 @@ class acf_field_relationship extends acf_field
|
|
698 |
|
699 |
|
700 |
// Pre 3.3.3, the value is a string coma seperated
|
701 |
-
if(
|
702 |
{
|
703 |
$value = explode(',', $value);
|
704 |
}
|
705 |
|
706 |
|
707 |
// empty?
|
708 |
-
if( empty($value) )
|
709 |
{
|
710 |
return $value;
|
711 |
}
|
712 |
|
713 |
|
714 |
-
//
|
715 |
-
$
|
716 |
-
'numberposts' => -1,
|
717 |
-
'post__in' => $value,
|
718 |
-
'post_type' => apply_filters('acf/get_post_types', array()),
|
719 |
-
'post_status' => array('publish', 'private', 'draft', 'inherit', 'future'),
|
720 |
-
));
|
721 |
-
|
722 |
|
723 |
-
$ordered_posts = array();
|
724 |
-
foreach( $posts as $p )
|
725 |
-
{
|
726 |
-
// create array to hold value data
|
727 |
-
$ordered_posts[ $p->ID ] = $p;
|
728 |
-
}
|
729 |
|
|
|
|
|
730 |
|
731 |
-
// override value array with attachments
|
732 |
-
foreach( $value as $k => $v)
|
733 |
-
{
|
734 |
-
// check that post exists (my have been trashed)
|
735 |
-
if( !isset($ordered_posts[ $v ]) )
|
736 |
-
{
|
737 |
-
unset( $value[ $k ] );
|
738 |
-
}
|
739 |
-
else
|
740 |
-
{
|
741 |
-
$value[ $k ] = $ordered_posts[ $v ];
|
742 |
-
}
|
743 |
-
}
|
744 |
|
745 |
-
|
746 |
// return value
|
747 |
return $value;
|
748 |
}
|
@@ -766,7 +763,99 @@ class acf_field_relationship extends acf_field
|
|
766 |
|
767 |
function format_value_for_api( $value, $post_id, $field )
|
768 |
{
|
769 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
}
|
771 |
|
772 |
|
18 |
$this->label = __("Relationship",'acf');
|
19 |
$this->category = __("Relational",'acf');
|
20 |
$this->defaults = array(
|
21 |
+
'post_type' => array('all'),
|
22 |
+
'max' => '',
|
23 |
+
'taxonomy' => array('all'),
|
24 |
+
'filters' => array('search'),
|
25 |
+
'result_elements' => array('post_title', 'post_type'),
|
26 |
+
'return_format' => 'object'
|
27 |
);
|
28 |
$this->l10n = array(
|
29 |
'max' => __("Maximum values reached ( {max} values )",'acf'),
|
145 |
'paged' => 1,
|
146 |
'orderby' => 'title',
|
147 |
'order' => 'ASC',
|
148 |
+
'post_status' => 'any',
|
149 |
'suppress_filters' => false,
|
150 |
's' => '',
|
151 |
'lang' => false,
|
564 |
$key = $field['name'];
|
565 |
|
566 |
?>
|
567 |
+
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
568 |
+
<td class="label">
|
569 |
+
<label><?php _e("Return Format",'acf'); ?></label>
|
570 |
+
<p><?php _e("Specify the returned value on front end",'acf') ?></p>
|
571 |
+
</td>
|
572 |
+
<td>
|
573 |
+
<?php
|
574 |
+
do_action('acf/create_field', array(
|
575 |
+
'type' => 'radio',
|
576 |
+
'name' => 'fields['.$key.'][return_format]',
|
577 |
+
'value' => $field['return_format'],
|
578 |
+
'layout' => 'horizontal',
|
579 |
+
'choices' => array(
|
580 |
+
'object' => __("Post Objects",'acf'),
|
581 |
+
'id' => __("Post IDs",'acf')
|
582 |
+
)
|
583 |
+
));
|
584 |
+
?>
|
585 |
+
</td>
|
586 |
+
</tr>
|
587 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
588 |
<td class="label">
|
589 |
<label for=""><?php _e("Post Type",'acf'); ?></label>
|
719 |
|
720 |
|
721 |
// Pre 3.3.3, the value is a string coma seperated
|
722 |
+
if( is_string($value) )
|
723 |
{
|
724 |
$value = explode(',', $value);
|
725 |
}
|
726 |
|
727 |
|
728 |
// empty?
|
729 |
+
if( !is_array($value) || empty($value) )
|
730 |
{
|
731 |
return $value;
|
732 |
}
|
733 |
|
734 |
|
735 |
+
// convert to integers
|
736 |
+
$value = array_map('intval', $value);
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
|
|
|
|
|
|
|
|
|
|
|
|
|
738 |
|
739 |
+
// convert into post objects
|
740 |
+
$value = $this->get_posts( $value );
|
741 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
742 |
|
|
|
743 |
// return value
|
744 |
return $value;
|
745 |
}
|
763 |
|
764 |
function format_value_for_api( $value, $post_id, $field )
|
765 |
{
|
766 |
+
// empty?
|
767 |
+
if( !$value )
|
768 |
+
{
|
769 |
+
return $value;
|
770 |
+
}
|
771 |
+
|
772 |
+
|
773 |
+
// Pre 3.3.3, the value is a string coma seperated
|
774 |
+
if( is_string($value) )
|
775 |
+
{
|
776 |
+
$value = explode(',', $value);
|
777 |
+
}
|
778 |
+
|
779 |
+
|
780 |
+
// empty?
|
781 |
+
if( !is_array($value) || empty($value) )
|
782 |
+
{
|
783 |
+
return $value;
|
784 |
+
}
|
785 |
+
|
786 |
+
|
787 |
+
// convert to integers
|
788 |
+
$value = array_map('intval', $value);
|
789 |
+
|
790 |
+
|
791 |
+
// return format
|
792 |
+
if( $field['return_format'] == 'object' )
|
793 |
+
{
|
794 |
+
$value = $this->get_posts( $value );
|
795 |
+
}
|
796 |
+
|
797 |
+
|
798 |
+
// return
|
799 |
+
return $value;
|
800 |
+
|
801 |
+
}
|
802 |
+
|
803 |
+
|
804 |
+
/*
|
805 |
+
* get_posts
|
806 |
+
*
|
807 |
+
* This function will take an array of post_id's ($value) and return an array of post_objects
|
808 |
+
*
|
809 |
+
* @type function
|
810 |
+
* @date 7/08/13
|
811 |
+
*
|
812 |
+
* @param $post_ids (array) the array of post ID's
|
813 |
+
* @return (array) an array of post objects
|
814 |
+
*/
|
815 |
+
|
816 |
+
function get_posts( $post_ids )
|
817 |
+
{
|
818 |
+
// validate
|
819 |
+
if( empty($post_ids) )
|
820 |
+
{
|
821 |
+
return $post_ids;
|
822 |
+
}
|
823 |
+
|
824 |
+
|
825 |
+
// vars
|
826 |
+
$r = array();
|
827 |
+
|
828 |
+
|
829 |
+
// find posts (DISTINCT POSTS)
|
830 |
+
$posts = get_posts(array(
|
831 |
+
'numberposts' => -1,
|
832 |
+
'post__in' => $post_ids,
|
833 |
+
'post_type' => 'any',
|
834 |
+
'post_status' => 'any',
|
835 |
+
));
|
836 |
+
|
837 |
+
|
838 |
+
$ordered_posts = array();
|
839 |
+
foreach( $posts as $p )
|
840 |
+
{
|
841 |
+
// create array to hold value data
|
842 |
+
$ordered_posts[ $p->ID ] = $p;
|
843 |
+
}
|
844 |
+
|
845 |
+
|
846 |
+
// override value array with attachments
|
847 |
+
foreach( $post_ids as $k => $v)
|
848 |
+
{
|
849 |
+
// check that post exists (my have been trashed)
|
850 |
+
if( isset($ordered_posts[ $v ]) )
|
851 |
+
{
|
852 |
+
$r[] = $ordered_posts[ $v ];
|
853 |
+
}
|
854 |
+
}
|
855 |
+
|
856 |
+
|
857 |
+
// return
|
858 |
+
return $r;
|
859 |
}
|
860 |
|
861 |
|
core/views/meta_box_location.php
CHANGED
@@ -85,12 +85,13 @@ if( empty($groups) )
|
|
85 |
'post' => __("Post",'acf'),
|
86 |
'post_category' => __("Post Category",'acf'),
|
87 |
'post_format' => __("Post Format",'acf'),
|
|
|
88 |
'taxonomy' => __("Post Taxonomy",'acf'),
|
89 |
),
|
90 |
__("Other",'acf') => array(
|
91 |
-
'
|
92 |
-
'
|
93 |
-
'
|
94 |
)
|
95 |
);
|
96 |
|
85 |
'post' => __("Post",'acf'),
|
86 |
'post_category' => __("Post Category",'acf'),
|
87 |
'post_format' => __("Post Format",'acf'),
|
88 |
+
'post_status' => __("Post Status",'acf'),
|
89 |
'taxonomy' => __("Post Taxonomy",'acf'),
|
90 |
),
|
91 |
__("Other",'acf') => array(
|
92 |
+
'ef_media' => __("Attachment",'acf'),
|
93 |
+
'ef_taxonomy' => __("Term",'acf'),
|
94 |
+
'ef_user' => __("User",'acf'),
|
95 |
)
|
96 |
);
|
97 |
|
css/input.css
CHANGED
@@ -222,7 +222,7 @@
|
|
222 |
|
223 |
.acf-image-uploader img {
|
224 |
box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
|
225 |
-
|
226 |
height: auto;
|
227 |
display: block;
|
228 |
min-width: 30px;
|
@@ -240,6 +240,15 @@
|
|
240 |
width: auto;
|
241 |
}
|
242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
/*
|
245 |
* Hover
|
@@ -396,6 +405,16 @@
|
|
396 |
margin: 5px 0 0;
|
397 |
}
|
398 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
|
400 |
/* Sidebar: Expand */
|
401 |
.media-modal.acf-expanded .attachment-info .thumbnail {
|
222 |
|
223 |
.acf-image-uploader img {
|
224 |
box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
|
225 |
+
width: 100%;
|
226 |
height: auto;
|
227 |
display: block;
|
228 |
min-width: 30px;
|
240 |
width: auto;
|
241 |
}
|
242 |
|
243 |
+
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
244 |
+
|
245 |
+
.acf-image-uploader img {
|
246 |
+
width: auto;
|
247 |
+
max-width: 100%;
|
248 |
+
}
|
249 |
+
|
250 |
+
}
|
251 |
+
|
252 |
|
253 |
/*
|
254 |
* Hover
|
405 |
margin: 5px 0 0;
|
406 |
}
|
407 |
|
408 |
+
.media-modal .media-sidebar .setting span,
|
409 |
+
.media-modal .compat-item label span {
|
410 |
+
padding-top: 7px;
|
411 |
+
}
|
412 |
+
|
413 |
+
.media-modal .attachment-display-settings .setting span {
|
414 |
+
margin-top: 0;
|
415 |
+
margin-right: 3%;
|
416 |
+
}
|
417 |
+
|
418 |
|
419 |
/* Sidebar: Expand */
|
420 |
.media-modal.acf-expanded .attachment-info .thumbnail {
|
js/input.min.js
CHANGED
@@ -8,4 +8,4 @@
|
|
8 |
*
|
9 |
* @param N/A
|
10 |
* @return N/A
|
11 |
-
*/var acf={ajaxurl:"",admin_url:"",wp_version:"",post_id:0,nonce:"",l10n:null,o:null,helpers:{get_atts:null,version_compare:null,uniqid:null,sortable:null,add_message:null,is_clone_field:null,url_to_object:null},validation:null,conditional_logic:null,media:null,fields:{date_picker:null,color_picker:null,Image:null,file:null,wysiwyg:null,gallery:null,relationship:{timeout:null,update_results:function(){},hide_results:function(){},text:{max:"Maximum values reached ( {max} values )"}}}};(function(e){acf.helpers.isset=function(){var e=arguments,t=e.length,n=0,r;if(t===0)throw new Error("Empty isset");while(n!==t){if(e[n]===r||e[n]===null)return!1;n++}return!0};acf.helpers.get_atts=function(t){var n={};e.each(t[0].attributes,function(e,t){t.name.substr(0,5)=="data-"&&(n[t.name.replace("data-","")]=t.value)});return n};acf.helpers.version_compare=function(e,t){if(typeof e+typeof t!="stringstring")return!1;var n=e.split("."),r=t.split("."),i=0,s=Math.max(n.length,r.length);for(;i<s;i++){if(n[i]&&!r[i]&&parseInt(n[i])>0||parseInt(n[i])>parseInt(r[i]))return 1;if(r[i]&&!n[i]&&parseInt(r[i])>0||parseInt(n[i])<parseInt(r[i]))return-1}return 0};acf.helpers.uniqid=function(){var e=new Date;return e.getTime()};acf.helpers.url_to_object=function(e){var t={},n=e.split("&");for(i in n){var r=n[i].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t};acf.helpers.sortable=function(t,n){n.children().each(function(){e(this).width(e(this).width())});return n};acf.helpers.is_clone_field=function(e){return e.attr("name")&&e.attr("name").indexOf("[acfcloneindex]")!=-1?!0:!1};acf.helpers.add_message=function(t,n){var t=e('<div class="acf-message-wrapper"><div class="message updated"><p>'+t+"</p></div></div>");n.prepend(t);setTimeout(function(){t.animate({opacity:0},250,function(){t.remove()})},1500)};e.fn.exists=function(){return e(this).length>0};acf.media={div:null,frame:null,clear_frame:function(){if(!this.frame)return;this.frame.detach();this.frame.dispose();this.frame=null},type:function(){var e="thickbox";typeof wp=="object"&&(e="backbone");return e},init:function(){var t=wp.media.view.AttachmentCompat.prototype;t.orig_render=t.render;t.orig_dispose=t.dispose;t.className="compat-item acf_postbox no_box";t.render=function(){var t=this;if(t.ignore_render)return this;this.orig_render();setTimeout(function(){var n=t.$el.closest(".media-modal");if(n.hasClass("acf-media-modal"))return;if(n.find(".media-frame-router .acf-expand-details").exists())return;var r=e(['<a href="#" class="acf-expand-details">','<span class="icon"></span>','<span class="is-closed">'+acf.l10n.core.expand_details+"</span>",'<span class="is-open">'+acf.l10n.core.collapse_details+"</span>","</a>"].join(""));r.on("click",function(e){e.preventDefault();n.hasClass("acf-expanded")?n.removeClass("acf-expanded"):n.addClass("acf-expanded")});n.find(".media-frame-router").append(r)},0);setTimeout(function(){e(document).trigger("acf/setup_fields",t.$el)},50);return this};t.dispose=function(){e(document).trigger("acf/remove_fields",[this.$el]);this.orig_dispose()};t.save=function(e){var t={},n={};e&&e.preventDefault();_.each(this.$el.serializeArray(),function(e){if(e.name.slice(-2)==="[]"){e.name=e.name.replace("[]","");typeof n[e.name]=="undefined"&&(n[e.name]=-1);n[e.name]++;e.name+="["+n[e.name]+"]"}t[e.name]=e.value});this.ignore_render=!0;this.model.saveCompat(t)}}};acf.conditional_logic={items:[],init:function(){var t=this;e(document).on("change",".field input, .field textarea, .field select",function(){t.change()});t.change()},change:function(){var t=this;e.each(this.items,function(n,r){var i=!0,s=e(".field_key-"+r.field);r.allorany=="any"&&(i=!1);e.each(r.rules,function(e,n){var s=t.calculate(n);if(r.allorany=="all"){if(s==0){i=!1;return!1}}else if(s==1){i=!0;return!1}});if(i){s.find("input, textarea, select").removeAttr("disabled");s.removeClass("acf-conditional_logic-hide").addClass("acf-conditional_logic-show")}else{s.find("input, textarea, select").attr("disabled","disabled");s.removeClass("acf-conditional_logic-show").addClass("acf-conditional_logic-hide")}})},calculate:function(t){var n=e(".field_key-"+t.field),r=!1;if(n.hasClass("field_type-true_false")||n.hasClass("field_type-checkbox")||n.hasClass("field_type-radio")){var i=n.find('input[value="'+t.value+'"]:checked').exists();t.operator=="=="?i&&(r=!0):i||(r=!0)}else{var s=n.find("input, textarea, select").last().val();e.isArray(s)||(s=[s]);t.operator=="=="?e.inArray(t.value,s)>-1&&(r=!0):e.inArray(t.value,s)<0&&(r=!0)}return r}};e(document).ready(function(){acf.conditional_logic.init();e(".acf_postbox > .inside > .options").each(function(){e(this).closest(".acf_postbox").addClass(e(this).attr("data-layout"))})});e(window).load(function(){acf.media.init();setTimeout(function(){try{wp.media.view.settings.post.id=acf.post_id}catch(t){}e(document).trigger("acf/setup_fields",[e("#poststuff")])},10)});acf.fields.gallery={add:function(){},edit:function(){},update_count:function(){},hide_selected_items:function(){},text:{title_add:"Select Images"}}})(jQuery);(function(e){var t=acf.fields.color_picker={$el:null,$input:null,set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="text"]');return this},init:function(){if(acf.helpers.is_clone_field(this.$input))return;this.$input.wpColorPicker()}};e(document).on("acf/setup_fields",function(n,r){e(r).find(".acf-color_picker").each(function(){t.set({$el:e(this)}).init()})})})(jQuery);(function(e){acf.fields.date_picker={$el:null,$input:null,$hidden:null,o:{},set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="text"]');this.$hidden=this.$el.find('input[type="hidden"]');this.o=acf.helpers.get_atts(this.$el);return this},init:function(){if(acf.helpers.is_clone_field(this.$hidden))return;this.$input.val(this.$hidden.val());var t=e.extend({},acf.l10n.date_picker,{dateFormat:this.o.save_format,altField:this.$hidden,altFormat:this.o.save_format,changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.o.first_day});this.$input.addClass("active").datepicker(t);this.$input.datepicker("option","dateFormat",this.o.display_format);e("body > #ui-datepicker-div").length>0&&e("#ui-datepicker-div").wrap('<div class="ui-acf" />')},blur:function(){this.$input.val()||this.$hidden.val("")}};e(document).on("acf/setup_fields",function(t,n){e(n).find(".acf-date_picker").each(function(){acf.fields.date_picker.set({$el:e(this)}).init()})});e(document).on("blur",'.acf-date_picker input[type="text"]',function(t){acf.fields.date_picker.set({$el:e(this).parent()}).blur()})})(jQuery);(function(e){var t=acf.media;acf.fields.image={$el:null,$input:null,o:{},set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="hidden"]');this.o=acf.helpers.get_atts(this.$el);this.o.multiple=this.$el.closest(".repeater").exists()?!0:!1;this.o.query={type:"image"};this.o.library=="uploadedTo"&&(this.o.query.uploadedTo=acf.o.post_id);return this},init:function(){if(acf.helpers.is_clone_field(this.$input))return},add:function(e){var n=t.div;n.find(".acf-image-image").attr("src",e.url);n.find(".acf-image-value").val(e.id).trigger("change");n.addClass("active");n.closest(".field").removeClass("error")},edit:function(){var e=this.$input.val();t.div=this.$el;t.clear_frame();t.frame=wp.media({title:acf.l10n.image.edit,multiple:!1,button:{text:acf.l10n.image.update}});t.frame.on("open",function(){t.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var n=t.frame.state().get("selection"),r=wp.media.attachment(e);r.fetch();n.add(r)});t.frame.on("close",function(){t.frame.$el.closest(".media-modal").removeClass("acf-media-modal")});acf.media.frame.open()},remove:function(){this.$el.find(".acf-image-image").attr("src","");this.$el.find(".acf-image-value").val("").trigger("change");this.$el.removeClass("active")},popup:function(){var n=this;t.div=this.$el;t.clear_frame();t.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(n.o.query),multiple:n.o.multiple,title:acf.l10n.image.select,priority:20,filterable:"all"})]});acf.media.frame.on("content:activate",function(){var t=null,r=null;try{t=acf.media.frame.content.get().toolbar;r=t.get("filters")}catch(i){}if(!r)return!1;e.each(r.filters,function(e,t){t.props.type="image"});if(n.o.library=="uploadedTo"){r.$el.find('option[value="uploaded"]').remove();r.$el.after("<span>"+acf.l10n.image.uploadedTo+"</span>");e.each(r.filters,function(e,t){t.props.uploadedTo=acf.o.post_id})}r.$el.find("option").each(function(){var t=e(this).attr("value");if(t=="uploaded"&&n.o.library=="all")return;t.indexOf("image")===-1&&e(this).remove()});r.$el.val("image").trigger("change")});acf.media.frame.on("select",function(){selection=t.frame.state().get("selection");if(selection){var e=0;selection.each(function(r){e++;if(e>1){var s=t.div.closest("td"),o=s.closest(".row"),u=o.closest(".repeater"),a=s.attr("data-field_key"),f="td .acf-image-uploader:first";a&&(f='td[data-field_key="'+a+'"] .acf-image-uploader');o.next(".row").exists()||u.find(".add-row-end").trigger("click");t.div=o.next(".row").find(f)}var l={id:r.id,url:r.attributes.url};r.attributes.sizes&&r.attributes.sizes[n.o.preview_size]&&(l.url=r.attributes.sizes[n.o.preview_size].url);acf.fields.image.add(l)})}});acf.media.frame.open();return!1},text:{title_add:"Select Image",title_edit:"Edit Image"}};e(document).on("click",".acf-image-uploader .acf-button-edit",function(t){t.preventDefault();acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).edit()});e(document).on("click",".acf-image-uploader .acf-button-delete",function(t){t.preventDefault();acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).remove()});e(document).on("click",".acf-image-uploader .add-image",function(t){t.preventDefault();acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).popup()})})(jQuery);(function(e){var t=acf.media;acf.fields.file={$el:null,$input:null,o:{},set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="hidden"]');this.o=acf.helpers.get_atts(this.$el);this.o.multiple=this.$el.closest(".repeater").exists()?!0:!1;this.o.query={};this.o.library=="uploadedTo"&&(this.o.query.uploadedTo=acf.o.post_id);return this},init:function(){if(acf.helpers.is_clone_field(this.$input))return},add:function(e){var n=t.div;n.find(".acf-file-icon").attr("src",e.icon);n.find(".acf-file-title").text(e.title);n.find(".acf-file-name").text(e.name).attr("href",e.url);n.find(".acf-file-size").text(e.size);n.find(".acf-file-value").val(e.id).trigger("change");n.addClass("active");n.closest(".field").removeClass("error")},edit:function(){var e=this.$input.val();t.div=this.$el;t.clear_frame();t.frame=wp.media({title:acf.l10n.file.edit,multiple:!1,button:{text:acf.l10n.file.update}});t.frame.on("open",function(){t.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var n=t.frame.state().get("selection"),r=wp.media.attachment(e);r.fetch();n.add(r)});t.frame.on("close",function(){t.frame.$el.closest(".media-modal").removeClass("acf-media-modal")});acf.media.frame.open()},remove:function(){this.$el.find(".acf-file-icon").attr("src","");this.$el.find(".acf-file-title").text("");this.$el.find(".acf-file-name").text("").attr("href","");this.$el.find(".acf-file-size").text("");this.$el.find(".acf-file-value").val("").trigger("change");this.$el.removeClass("active")},popup:function(){var n=this;t.div=this.$el;t.clear_frame();t.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(n.o.query),multiple:n.o.multiple,title:acf.l10n.file.select,priority:20,filterable:"all"})]});acf.media.frame.on("content:activate",function(){var t=null,r=null;try{t=acf.media.frame.content.get().toolbar;r=t.get("filters")}catch(i){}if(!r)return!1;if(n.o.library=="uploadedTo"){r.$el.find('option[value="uploaded"]').remove();r.$el.after("<span>"+acf.l10n.file.uploadedTo+"</span>");e.each(r.filters,function(e,t){t.props.uploadedTo=acf.o.post_id})}});acf.media.frame.on("select",function(){selection=t.frame.state().get("selection");if(selection){var e=0;selection.each(function(n){e++;if(e>1){var r=t.div.closest("td"),s=r.closest(".row"),o=s.closest(".repeater"),u=r.attr("data-field_key"),a="td .acf-file-uploader:first";u&&(a='td[data-field_key="'+u+'"] .acf-file-uploader');s.next(".row").exists()||o.find(".add-row-end").trigger("click");t.div=s.next(".row").find(a)}var f={id:n.id,title:n.attributes.title,name:n.attributes.filename,url:n.attributes.url,icon:n.attributes.icon,size:n.attributes.filesize};acf.fields.file.add(f)})}});acf.media.frame.open();return!1}};e(document).on("click",".acf-file-uploader .acf-button-edit",function(t){t.preventDefault();acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).edit()});e(document).on("click",".acf-file-uploader .acf-button-delete",function(t){t.preventDefault();acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).remove()});e(document).on("click",".acf-file-uploader .add-file",function(t){t.preventDefault();acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).popup()})})(jQuery);(function(e){acf.fields.radio={$el:null,$input:null,$other:null,farbtastic:null,set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="radio"]:checked');this.$other=this.$el.find('input[type="text"]');return this},change:function(){if(this.$input.val()=="other"){this.$other.attr("name",this.$input.attr("name"));this.$other.show()}else{this.$other.attr("name","");this.$other.hide()}}};e(document).on("change",'.acf-radio-list input[type="radio"]',function(t){acf.fields.radio.set({$el:e(this).closest(".acf-radio-list")}).change()})})(jQuery);(function(e){e(document).on("acf/setup_fields",function(t,n){e(n).find(".acf-tab").each(function(){var t=e(this),n=t.parent(),r=n.parent(),i=t.attr("data-id"),s=t.html();if(t.hasClass("acf-tab-added"))return;t.addClass("acf-tab-added");r.children(".acf-tab-group").exists()||r.children(".field_type-tab:first").before('<ul class="hl clearfix acf-tab-group"></ul>');r.children(".acf-tab-group").append('<li class="field_key-'+i+'" data-field_key="'+i+'"><a class="acf-tab-button" href="#" data-id="'+i+'">'+s+"</a></li>")});e(n).find(".acf-tab-group").each(function(){e(this).find("li:first a").trigger("click")})});e(document).on("click",".acf-tab-button",function(t){t.preventDefault();var n=e(this),r=n.closest("ul"),i=r.parent(),s=n.attr("data-id");r.find("li").removeClass("active");n.parent("li").addClass("active");i.children(".field_type-tab").each(function(){var t=e(this);t.hasClass("field_key-"+s)?t.nextUntil(".field_type-tab").removeClass("acf-tab_group-hide").addClass("acf-tab_group-show"):t.nextUntil(".field_type-tab").removeClass("acf-tab_group-show").addClass("acf-tab_group-hide")});n.trigger("blur")})})(jQuery);(function(e){var t=acf.fields.wysiwyg={$el:null,$textarea:null,o:{},set:function(t){e.extend(this,t);this.$textarea=this.$el.find("textarea");this.o=acf.helpers.get_atts(this.$el);this.o.id=this.$textarea.attr("id");return this},has_tinymce:function(){var e=!1;typeof tinyMCE=="object"&&(e=!0);return e},init:function(){if(acf.helpers.is_clone_field(this.$textarea))return;var t=e.extend({},tinyMCE.settings);tinyMCE.settings.theme_advanced_buttons1="";tinyMCE.settings.theme_advanced_buttons2="";tinyMCE.settings.theme_advanced_buttons3="";tinyMCE.settings.theme_advanced_buttons4="";acf.helpers.isset(this.toolbars[this.o.toolbar])&&e.each(this.toolbars[this.o.toolbar],function(e,t){tinyMCE.settings[e]=t});tinyMCE.execCommand("mceAddControl",!1,this.o.id);e(document).trigger("acf/wysiwyg/load",this.o.id);this.add_events();tinyMCE.settings=t;wpActiveEditor=null},add_events:function(){var t=this.o.id,n=tinyMCE.get(t);if(!n)return;var r=e("#wp-"+t+"-wrap"),i=e(n.getBody());r.on("click",function(){e(document).trigger("acf/wysiwyg/click",t)});i.on("focus",function(){e(document).trigger("acf/wysiwyg/focus",t)});i.on("blur",function(){e(document).trigger("acf/wysiwyg/blur",t)})},destroy:function(){var e=this.o.id,t=tinyMCE.get(e);if(t){var n=t.getContent();tinyMCE.execCommand("mceRemoveControl",!1,e);this.$textarea.val(n)}wpActiveEditor=null}};e(document).on("acf/setup_fields",function(n,r){if(!t.has_tinymce())return;e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()});setTimeout(function(){e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).init()})},0)});e(document).on("acf/remove_fields",function(n,r){if(!t.has_tinymce())return;r.find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()})});e(document).on("acf/wysiwyg/click",function(t,n){wpActiveEditor=n;container=e("#wp-"+n+"-wrap").closest(".field").removeClass("error")});e(document).on("acf/wysiwyg/focus",function(t,n){wpActiveEditor=n;container=e("#wp-"+n+"-wrap").closest(".field").removeClass("error")});e(document).on("acf/wysiwyg/blur",function(t,n){wpActiveEditor=null;var r=tinyMCE.get(n);if(!r)return;var i=r.getElement();r.save();e(i).trigger("change")});e(document).on("acf/sortable_start",function(n,r){if(!t.has_tinymce())return;e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()})});e(document).on("acf/sortable_stop",function(n,r){if(!t.has_tinymce())return;e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).init()})});e(window).load(function(){if(!t.has_tinymce())return;var n=e("#wp-content-wrap").exists(),r=e("#wp-acf_settings-wrap").exists();mode="tmce";r&&e("#wp-acf_settings-wrap").hasClass("html-active")&&(mode="html");setTimeout(function(){r&&mode=="html"&&e("#acf_settings-tmce").trigger("click")},1);setTimeout(function(){r&&mode=="html"&&e("#acf_settings-html").trigger("click");n&&t.set({$el:e("#wp-content-wrap")}).add_events()},11)});e(document).on("click",".acf_wysiwyg a.mce_fullscreen",function(){var t=e(this).closest(".acf_wysiwyg"),n=t.attr("data-upload");n=="no"&&e("#mce_fullscreen_container td.mceToolbar .mce_add_media").remove()})})(jQuery);(function(e){acf.fields.relationship={$el:null,$input:null,$left:null,$right:null,o:{},timeout:null,set:function(t){e.extend(this,t);this.$input=this.$el.children('input[type="hidden"]');this.$left=this.$el.find(".relationship_left"),this.$right=this.$el.find(".relationship_right");this.o=acf.helpers.get_atts(this.$el);return this},init:function(){var t=this;if(acf.helpers.is_clone_field(this.$input))return;this.$right.find(".relationship_list").height(this.$left.height()-2);this.$right.find(".relationship_list").sortable({axis:"y",items:"> li",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,update:function(){t.$input.trigger("change")}});var n=this.$el;this.$left.find(".relationship_list").scrollTop(0).on("scroll",function(r){if(n.hasClass("loading")||n.hasClass("no-results"))return;if(e(this).scrollTop()+e(this).innerHeight()>=e(this).get(0).scrollHeight){var i=parseInt(n.attr("data-paged"));n.attr("data-paged",i+1);t.set({$el:n}).fetch()}});this.fetch()},fetch:function(){var t=this,n=this.$el;n.addClass("loading");e.ajax({url:acf.o.ajaxurl,type:"post",dataType:"json",data:e.extend({action:"acf/fields/relationship/query_posts",post_id:acf.o.post_id,nonce:acf.o.nonce},this.o),success:function(e){t.set({$el:n}).render(e)}})},render:function(t){var n=this;this.$el.removeClass("no-results").removeClass("loading");this.o.paged==1&&this.$el.find(".relationship_left li:not(.load-more)").remove();if(!t||!t.html){this.$el.addClass("no-results");return}this.$el.find(".relationship_left .load-more").before(t.html);t.next_page_exists||this.$el.addClass("no-results");this.$left.find("a").each(function(){var t=e(this).attr("data-post_id");n.$right.find('a[data-post_id="'+t+'"]').exists()&&e(this).parent().addClass("hide")})},add:function(e){var t=e.attr("data-post_id"),n=e.html();if(this.$right.find("a").length>=this.o.max){alert(acf.l10n.relationship.max.replace("{max}",this.o.max));return!1}if(e.parent().hasClass("hide"))return!1;e.parent().addClass("hide");var r={post_id:e.attr("data-post_id"),title:e.html(),name:this.$input.attr("name")},i=_.template(acf.l10n.relationship.tmpl_li,r);this.$right.find(".relationship_list").append(i);this.$input.trigger("change");this.$el.closest(".field").removeClass("error")},remove:function(e){e.parent().remove();this.$left.find('a[data-post_id="'+e.attr("data-post_id")+'"]').parent("li").removeClass("hide");this.$input.trigger("change")}};e(document).on("acf/setup_fields",function(t,n){e(n).find(".acf_relationship").each(function(){acf.fields.relationship.set({$el:e(this)}).init()})});e(document).on("change",".acf_relationship .select-post_type",function(t){var n=e(this).val(),r=e(this).closest(".acf_relationship");r.attr("data-post_type",n);r.attr("data-paged",1);acf.fields.relationship.set({$el:r}).fetch()});e(document).on("click",".acf_relationship .relationship_left .relationship_list a",function(t){t.preventDefault();acf.fields.relationship.set({$el:e(this).closest(".acf_relationship")}).add(e(this));e(this).blur()});e(document).on("click",".acf_relationship .relationship_right .relationship_list a",function(t){t.preventDefault();acf.fields.relationship.set({$el:e(this).closest(".acf_relationship")}).remove(e(this));e(this).blur()});e(document).on("keyup",".acf_relationship input.relationship_search",function(t){var n=e(this).val(),r=e(this).closest(".acf_relationship");r.attr("data-s",n);r.attr("data-paged",1);clearTimeout(acf.fields.relationship.timeout);acf.fields.relationship.timeout=setTimeout(function(){acf.fields.relationship.set({$el:r}).fetch()},500)});e(document).on("keypress",".acf_relationship input.relationship_search",function(e){e.which==13&&e.preventDefault()})})(jQuery);(function(e){acf.validation={status:!0,disabled:!1,run:function(){var t=this;t.status=!0;e(".postbox:not(.acf-hidden) .field.required, .form-field.required").each(function(){var n=e(this);n.data("validation",!0);if(n.hasClass("acf-conditional_logic-hide"))return;if(n.hasClass("acf-tab_group-hide")&&n.prevAll(".field_type-tab:first").hasClass("acf-conditional_logic-hide"))return;n.find('input[type="text"], input[type="email"], input[type="number"], input[type="hidden"], textarea').val()==""&&n.data("validation",!1);if(n.find(".acf_wysiwyg").exists()&&typeof tinyMCE=="object"){n.data("validation",!0);var r=n.find(".wp-editor-area").attr("id"),i=tinyMCE.get(r);i&&!i.getContent()&&n.data("validation",!1)}if(n.find("select").exists()){n.data("validation",!0);(n.find("select").val()=="null"||!n.find("select").val())&&n.data("validation",!1)}if(n.find('input[type="radio"]').exists()){n.data("validation",!1);n.find('input[type="radio"]:checked').exists()&&n.data("validation",!0)}if(n.find('input[type="checkbox"]').exists()){n.data("validation",!1);n.find('input[type="checkbox"]:checked').exists()&&n.data("validation",!0)}if(n.find(".acf_relationship").exists()){n.data("validation",!1);n.find(".acf_relationship .relationship_right input").exists()&&n.data("validation",!0)}if(n.find(".repeater").exists()){n.data("validation",!1);n.find(".repeater tr.row").exists()&&n.data("validation",!0)}if(n.find(".acf_flexible_content").exists()){n.data("validation",!1);n.find(".acf_flexible_content .values table").exists()&&n.data("validation",!0)}if(n.find(".acf-gallery").exists()){n.data("validation",!1);n.find(".acf-gallery .thumbnail").exists()&&n.data("validation",!0)}e(document).trigger("acf/validate_field",n);if(!n.data("validation")){t.status=!1;n.closest(".field").addClass("error")}})}};e(document).on("focus click",".field.required input, .field.required textarea, .field.required select",function(t){e(this).closest(".field").removeClass("error")});e(document).on("click","#save-post",function(){acf.validation.disabled=!0});e(document).on("submit","#post",function(){if(acf.validation.disabled)return!0;acf.validation.run();if(!acf.validation.status){var t=e(this);t.siblings("#message").remove();t.before('<div id="message" class="error"><p>'+acf.l10n.validation.error+"</p></div>");e("#publish").removeClass("button-primary-disabled");e("#ajax-loading").attr("style","");e("#publishing-action .spinner").hide();return!1}e(".acf_postbox.acf-hidden").remove();return!0})})(jQuery);(function(e){acf.screen={action:"acf/location/match_field_groups_ajax",post_id:0,page_template:0,page_parent:0,page_type:0,post_category:0,post_format:0,taxonomy:0,lang:0,nonce:0};e(document).ready(function(){acf.screen.post_id=acf.o.post_id;acf.screen.nonce=acf.o.nonce;if(e("#icl-als-first").length>0){var t=e("#icl-als-first").children("a").attr("href"),n=new RegExp("lang=([^&#]*)"),r=n.exec(t);acf.screen.lang=r[1]}});e(document).on("acf/update_field_groups",function(){e.ajax({url:ajaxurl,data:acf.screen,type:"post",dataType:"json",success:function(t){if(!t)return!1;e(".acf_postbox").addClass("acf-hidden");e(".acf_postbox-toggle").addClass("acf-hidden");if(t.length==0)return!1;e.each(t,function(t,n){var r=e("#acf_"+n),i=e('#adv-settings .acf_postbox-toggle[for="acf_'+n+'-hide"]');r.removeClass("acf-hidden hide-if-js");i.removeClass("acf-hidden");i.find('input[type="checkbox"]').attr("checked","checked");r.find(".acf-replace-with-fields").each(function(){var t=e(this);e.ajax({url:ajaxurl,data:{action:"acf/input/render_fields",acf_id:n,post_id:acf.o.post_id,nonce:acf.o.nonce},type:"post",dataType:"html",success:function(n){t.replaceWith(n);e(document).trigger("acf/setup_fields",r)}})})});e.ajax({url:ajaxurl,data:{action:"acf/input/get_style",acf_id:t[0],nonce:acf.o.nonce},type:"post",dataType:"html",success:function(t){e("#acf_style").html(t)}})}})});e(document).on("change","#page_template",function(){acf.screen.page_template=e(this).val();e(document).trigger("acf/update_field_groups")});e(document).on("change","#parent_id",function(){var t=e(this).val();if(t!=""){acf.screen.page_type="child";acf.screen.page_parent=t}else{acf.screen.page_type="parent";acf.screen.page_parent=0}e(document).trigger("acf/update_field_groups")});e(document).on("change",'#post-formats-select input[type="radio"]',function(){var t=e(this).val();t=="0"&&(t="standard");acf.screen.post_format=t;e(document).trigger("acf/update_field_groups")});e(document).on("change",'.categorychecklist input[type="checkbox"]',function(){setTimeout(function(){var t=[];e('.categorychecklist input[type="checkbox"]:checked').each(function(){if(e(this).is(":hidden")||e(this).is(":disabled"))return;t.push(e(this).val())});acf.screen.post_category=t;acf.screen.taxonomy=t;e(document).trigger("acf/update_field_groups")},1)})})(jQuery);
|
8 |
*
|
9 |
* @param N/A
|
10 |
* @return N/A
|
11 |
+
*/var acf={ajaxurl:"",admin_url:"",wp_version:"",post_id:0,nonce:"",l10n:null,o:null,helpers:{get_atts:null,version_compare:null,uniqid:null,sortable:null,add_message:null,is_clone_field:null,url_to_object:null},validation:null,conditional_logic:null,media:null,fields:{date_picker:null,color_picker:null,Image:null,file:null,wysiwyg:null,gallery:null,relationship:null}};(function(e){acf.helpers.isset=function(){var e=arguments,t=e.length,n=0,r;if(t===0)throw new Error("Empty isset");while(n!==t){if(e[n]===r||e[n]===null)return!1;n++}return!0};acf.helpers.get_atts=function(t){var n={};e.each(t[0].attributes,function(e,t){t.name.substr(0,5)=="data-"&&(n[t.name.replace("data-","")]=t.value)});return n};acf.helpers.version_compare=function(e,t){if(typeof e+typeof t!="stringstring")return!1;var n=e.split("."),r=t.split("."),i=0,s=Math.max(n.length,r.length);for(;i<s;i++){if(n[i]&&!r[i]&&parseInt(n[i])>0||parseInt(n[i])>parseInt(r[i]))return 1;if(r[i]&&!n[i]&&parseInt(r[i])>0||parseInt(n[i])<parseInt(r[i]))return-1}return 0};acf.helpers.uniqid=function(){var e=new Date;return e.getTime()};acf.helpers.url_to_object=function(e){var t={},n=e.split("&");for(i in n){var r=n[i].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t};acf.helpers.sortable=function(t,n){n.children().each(function(){e(this).width(e(this).width())});return n};acf.helpers.is_clone_field=function(e){return e.attr("name")&&e.attr("name").indexOf("[acfcloneindex]")!=-1?!0:!1};acf.helpers.add_message=function(t,n){var t=e('<div class="acf-message-wrapper"><div class="message updated"><p>'+t+"</p></div></div>");n.prepend(t);setTimeout(function(){t.animate({opacity:0},250,function(){t.remove()})},1500)};e.fn.exists=function(){return e(this).length>0};acf.media={div:null,frame:null,clear_frame:function(){if(!this.frame)return;this.frame.detach();this.frame.dispose();this.frame=null},type:function(){var e="thickbox";typeof wp=="object"&&(e="backbone");return e},init:function(){var t=wp.media.view.AttachmentCompat.prototype;t.orig_render=t.render;t.orig_dispose=t.dispose;t.className="compat-item acf_postbox no_box";t.render=function(){var t=this;if(t.ignore_render)return this;this.orig_render();setTimeout(function(){var n=t.$el.closest(".media-modal");if(n.hasClass("acf-media-modal"))return;if(n.find(".media-frame-router .acf-expand-details").exists())return;var r=e(['<a href="#" class="acf-expand-details">','<span class="icon"></span>','<span class="is-closed">'+acf.l10n.core.expand_details+"</span>",'<span class="is-open">'+acf.l10n.core.collapse_details+"</span>","</a>"].join(""));r.on("click",function(e){e.preventDefault();n.hasClass("acf-expanded")?n.removeClass("acf-expanded"):n.addClass("acf-expanded")});n.find(".media-frame-router").append(r)},0);setTimeout(function(){e(document).trigger("acf/setup_fields",t.$el)},50);return this};t.dispose=function(){e(document).trigger("acf/remove_fields",[this.$el]);this.orig_dispose()};t.save=function(e){var t={},n={};e&&e.preventDefault();_.each(this.$el.serializeArray(),function(e){if(e.name.slice(-2)==="[]"){e.name=e.name.replace("[]","");typeof n[e.name]=="undefined"&&(n[e.name]=-1);n[e.name]++;e.name+="["+n[e.name]+"]"}t[e.name]=e.value});this.ignore_render=!0;this.model.saveCompat(t)}}};acf.conditional_logic={items:[],init:function(){var t=this;e(document).on("change",".field input, .field textarea, .field select",function(){t.change()});t.change()},change:function(){var t=this;e.each(this.items,function(n,r){var i=!0,s=e(".field_key-"+r.field);r.allorany=="any"&&(i=!1);e.each(r.rules,function(e,n){var s=t.calculate(n);if(r.allorany=="all"){if(s==0){i=!1;return!1}}else if(s==1){i=!0;return!1}});if(i){s.find("input, textarea, select").removeAttr("disabled");s.removeClass("acf-conditional_logic-hide").addClass("acf-conditional_logic-show")}else{s.find("input, textarea, select").attr("disabled","disabled");s.removeClass("acf-conditional_logic-show").addClass("acf-conditional_logic-hide")}})},calculate:function(t){var n=e(".field_key-"+t.field),r=!1;if(n.hasClass("field_type-true_false")||n.hasClass("field_type-checkbox")||n.hasClass("field_type-radio")){var i=n.find('input[value="'+t.value+'"]:checked').exists();t.operator=="=="?i&&(r=!0):i||(r=!0)}else{var s=n.find("input, textarea, select").last().val();e.isArray(s)||(s=[s]);t.operator=="=="?e.inArray(t.value,s)>-1&&(r=!0):e.inArray(t.value,s)<0&&(r=!0)}return r}};e(document).ready(function(){acf.conditional_logic.init();e(".acf_postbox > .inside > .options").each(function(){e(this).closest(".acf_postbox").addClass(e(this).attr("data-layout"))})});e(window).load(function(){acf.media.init();setTimeout(function(){try{wp.media.view.settings.post.id=acf.post_id}catch(t){}e(document).trigger("acf/setup_fields",[e("#poststuff")])},10)});acf.fields.gallery={add:function(){},edit:function(){},update_count:function(){},hide_selected_items:function(){},text:{title_add:"Select Images"}}})(jQuery);(function(e){acf.screen={action:"acf/location/match_field_groups_ajax",post_id:0,page_template:0,page_parent:0,page_type:0,post_category:0,post_format:0,taxonomy:0,lang:0,nonce:0};e(document).ready(function(){acf.screen.post_id=acf.o.post_id;acf.screen.nonce=acf.o.nonce;if(e("#icl-als-first").length>0){var t=e("#icl-als-first").children("a").attr("href"),n=new RegExp("lang=([^&#]*)"),r=n.exec(t);acf.screen.lang=r[1]}});e(document).on("acf/update_field_groups",function(){e.ajax({url:ajaxurl,data:acf.screen,type:"post",dataType:"json",success:function(t){if(!t)return!1;e(".acf_postbox").addClass("acf-hidden");e(".acf_postbox-toggle").addClass("acf-hidden");if(t.length==0)return!1;e.each(t,function(t,n){var r=e("#acf_"+n),i=e('#adv-settings .acf_postbox-toggle[for="acf_'+n+'-hide"]');r.removeClass("acf-hidden hide-if-js");i.removeClass("acf-hidden");i.find('input[type="checkbox"]').attr("checked","checked");r.find(".acf-replace-with-fields").each(function(){var t=e(this);e.ajax({url:ajaxurl,data:{action:"acf/input/render_fields",acf_id:n,post_id:acf.o.post_id,nonce:acf.o.nonce},type:"post",dataType:"html",success:function(n){t.replaceWith(n);e(document).trigger("acf/setup_fields",r)}})})});e.ajax({url:ajaxurl,data:{action:"acf/input/get_style",acf_id:t[0],nonce:acf.o.nonce},type:"post",dataType:"html",success:function(t){e("#acf_style").html(t)}})}})});e(document).on("change","#page_template",function(){acf.screen.page_template=e(this).val();e(document).trigger("acf/update_field_groups")});e(document).on("change","#parent_id",function(){var t=e(this).val();if(t!=""){acf.screen.page_type="child";acf.screen.page_parent=t}else{acf.screen.page_type="parent";acf.screen.page_parent=0}e(document).trigger("acf/update_field_groups")});e(document).on("change",'#post-formats-select input[type="radio"]',function(){var t=e(this).val();t=="0"&&(t="standard");acf.screen.post_format=t;e(document).trigger("acf/update_field_groups")});e(document).on("change",'.categorychecklist input[type="checkbox"]',function(){setTimeout(function(){var t=[];e('.categorychecklist input[type="checkbox"]:checked').each(function(){if(e(this).is(":hidden")||e(this).is(":disabled"))return;t.push(e(this).val())});acf.screen.post_category=t;acf.screen.taxonomy=t;e(document).trigger("acf/update_field_groups")},1)})})(jQuery);(function(e){var t=acf.fields.color_picker={$el:null,$input:null,set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="text"]');return this},init:function(){if(acf.helpers.is_clone_field(this.$input))return;this.$input.wpColorPicker()}};e(document).on("acf/setup_fields",function(n,r){e(r).find(".acf-color_picker").each(function(){t.set({$el:e(this)}).init()})})})(jQuery);(function(e){acf.fields.date_picker={$el:null,$input:null,$hidden:null,o:{},set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="text"]');this.$hidden=this.$el.find('input[type="hidden"]');this.o=acf.helpers.get_atts(this.$el);return this},init:function(){if(acf.helpers.is_clone_field(this.$hidden))return;this.$input.val(this.$hidden.val());var t=e.extend({},acf.l10n.date_picker,{dateFormat:this.o.save_format,altField:this.$hidden,altFormat:this.o.save_format,changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.o.first_day});this.$input.addClass("active").datepicker(t);this.$input.datepicker("option","dateFormat",this.o.display_format);e("body > #ui-datepicker-div").length>0&&e("#ui-datepicker-div").wrap('<div class="ui-acf" />')},blur:function(){this.$input.val()||this.$hidden.val("")}};e(document).on("acf/setup_fields",function(t,n){e(n).find(".acf-date_picker").each(function(){acf.fields.date_picker.set({$el:e(this)}).init()})});e(document).on("blur",'.acf-date_picker input[type="text"]',function(t){acf.fields.date_picker.set({$el:e(this).parent()}).blur()})})(jQuery);(function(e){var t=acf.media;acf.fields.file={$el:null,$input:null,o:{},set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="hidden"]');this.o=acf.helpers.get_atts(this.$el);this.o.multiple=this.$el.closest(".repeater").exists()?!0:!1;this.o.query={};this.o.library=="uploadedTo"&&(this.o.query.uploadedTo=acf.o.post_id);return this},init:function(){if(acf.helpers.is_clone_field(this.$input))return},add:function(e){var n=t.div;n.find(".acf-file-icon").attr("src",e.icon);n.find(".acf-file-title").text(e.title);n.find(".acf-file-name").text(e.name).attr("href",e.url);n.find(".acf-file-size").text(e.size);n.find(".acf-file-value").val(e.id).trigger("change");n.addClass("active");n.closest(".field").removeClass("error")},edit:function(){var e=this.$input.val();t.div=this.$el;t.clear_frame();t.frame=wp.media({title:acf.l10n.file.edit,multiple:!1,button:{text:acf.l10n.file.update}});t.frame.on("open",function(){t.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var n=t.frame.state().get("selection"),r=wp.media.attachment(e);r.fetch();n.add(r)});t.frame.on("close",function(){t.frame.$el.closest(".media-modal").removeClass("acf-media-modal")});acf.media.frame.open()},remove:function(){this.$el.find(".acf-file-icon").attr("src","");this.$el.find(".acf-file-title").text("");this.$el.find(".acf-file-name").text("").attr("href","");this.$el.find(".acf-file-size").text("");this.$el.find(".acf-file-value").val("").trigger("change");this.$el.removeClass("active")},popup:function(){var n=this;t.div=this.$el;t.clear_frame();t.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(n.o.query),multiple:n.o.multiple,title:acf.l10n.file.select,priority:20,filterable:"all"})]});acf.media.frame.on("content:activate",function(){var t=null,r=null;try{t=acf.media.frame.content.get().toolbar;r=t.get("filters")}catch(i){}if(!r)return!1;if(n.o.library=="uploadedTo"){r.$el.find('option[value="uploaded"]').remove();r.$el.after("<span>"+acf.l10n.file.uploadedTo+"</span>");e.each(r.filters,function(e,t){t.props.uploadedTo=acf.o.post_id})}});acf.media.frame.on("select",function(){selection=t.frame.state().get("selection");if(selection){var e=0;selection.each(function(n){e++;if(e>1){var r=t.div.closest("td"),s=r.closest(".row"),o=s.closest(".repeater"),u=r.attr("data-field_key"),a="td .acf-file-uploader:first";u&&(a='td[data-field_key="'+u+'"] .acf-file-uploader');s.next(".row").exists()||o.find(".add-row-end").trigger("click");t.div=s.next(".row").find(a)}var f={id:n.id,title:n.attributes.title,name:n.attributes.filename,url:n.attributes.url,icon:n.attributes.icon,size:n.attributes.filesize};acf.fields.file.add(f)})}});acf.media.frame.open();return!1}};e(document).on("click",".acf-file-uploader .acf-button-edit",function(t){t.preventDefault();acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).edit()});e(document).on("click",".acf-file-uploader .acf-button-delete",function(t){t.preventDefault();acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).remove()});e(document).on("click",".acf-file-uploader .add-file",function(t){t.preventDefault();acf.fields.file.set({$el:e(this).closest(".acf-file-uploader")}).popup()})})(jQuery);(function(e){var t=acf.media;acf.fields.image={$el:null,$input:null,o:{},set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="hidden"]');this.o=acf.helpers.get_atts(this.$el);this.o.multiple=this.$el.closest(".repeater").exists()?!0:!1;this.o.query={type:"image"};this.o.library=="uploadedTo"&&(this.o.query.uploadedTo=acf.o.post_id);return this},init:function(){if(acf.helpers.is_clone_field(this.$input))return},add:function(e){var n=t.div;n.find(".acf-image-image").attr("src",e.url);n.find(".acf-image-value").val(e.id).trigger("change");n.addClass("active");n.closest(".field").removeClass("error")},edit:function(){var e=this.$input.val();t.div=this.$el;t.clear_frame();t.frame=wp.media({title:acf.l10n.image.edit,multiple:!1,button:{text:acf.l10n.image.update}});t.frame.on("open",function(){t.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var n=t.frame.state().get("selection"),r=wp.media.attachment(e);r.fetch();n.add(r)});t.frame.on("close",function(){t.frame.$el.closest(".media-modal").removeClass("acf-media-modal")});acf.media.frame.open()},remove:function(){this.$el.find(".acf-image-image").attr("src","");this.$el.find(".acf-image-value").val("").trigger("change");this.$el.removeClass("active")},popup:function(){var n=this;t.div=this.$el;t.clear_frame();t.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(n.o.query),multiple:n.o.multiple,title:acf.l10n.image.select,priority:20,filterable:"all"})]});acf.media.frame.on("content:activate",function(){var t=null,r=null;try{t=acf.media.frame.content.get().toolbar;r=t.get("filters")}catch(i){}if(!r)return!1;e.each(r.filters,function(e,t){t.props.type="image"});if(n.o.library=="uploadedTo"){r.$el.find('option[value="uploaded"]').remove();r.$el.after("<span>"+acf.l10n.image.uploadedTo+"</span>");e.each(r.filters,function(e,t){t.props.uploadedTo=acf.o.post_id})}r.$el.find("option").each(function(){var t=e(this).attr("value");if(t=="uploaded"&&n.o.library=="all")return;t.indexOf("image")===-1&&e(this).remove()});r.$el.val("image").trigger("change")});acf.media.frame.on("select",function(){selection=t.frame.state().get("selection");if(selection){var e=0;selection.each(function(r){e++;if(e>1){var s=t.div.closest("td"),o=s.closest(".row"),u=o.closest(".repeater"),a=s.attr("data-field_key"),f="td .acf-image-uploader:first";a&&(f='td[data-field_key="'+a+'"] .acf-image-uploader');o.next(".row").exists()||u.find(".add-row-end").trigger("click");t.div=o.next(".row").find(f)}var l={id:r.id,url:r.attributes.url};r.attributes.sizes&&r.attributes.sizes[n.o.preview_size]&&(l.url=r.attributes.sizes[n.o.preview_size].url);acf.fields.image.add(l)})}});acf.media.frame.open();return!1},text:{title_add:"Select Image",title_edit:"Edit Image"}};e(document).on("click",".acf-image-uploader .acf-button-edit",function(t){t.preventDefault();acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).edit()});e(document).on("click",".acf-image-uploader .acf-button-delete",function(t){t.preventDefault();acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).remove()});e(document).on("click",".acf-image-uploader .add-image",function(t){t.preventDefault();acf.fields.image.set({$el:e(this).closest(".acf-image-uploader")}).popup()})})(jQuery);(function(e){acf.fields.radio={$el:null,$input:null,$other:null,farbtastic:null,set:function(t){e.extend(this,t);this.$input=this.$el.find('input[type="radio"]:checked');this.$other=this.$el.find('input[type="text"]');return this},change:function(){if(this.$input.val()=="other"){this.$other.attr("name",this.$input.attr("name"));this.$other.show()}else{this.$other.attr("name","");this.$other.hide()}}};e(document).on("change",'.acf-radio-list input[type="radio"]',function(t){acf.fields.radio.set({$el:e(this).closest(".acf-radio-list")}).change()})})(jQuery);(function(e){acf.fields.relationship={$el:null,$input:null,$left:null,$right:null,o:{},timeout:null,set:function(t){e.extend(this,t);this.$input=this.$el.children('input[type="hidden"]');this.$left=this.$el.find(".relationship_left"),this.$right=this.$el.find(".relationship_right");this.o=acf.helpers.get_atts(this.$el);return this},init:function(){var t=this;if(acf.helpers.is_clone_field(this.$input))return;this.$right.find(".relationship_list").height(this.$left.height()-2);this.$right.find(".relationship_list").sortable({axis:"y",items:"> li",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,update:function(){t.$input.trigger("change")}});var n=this.$el;this.$left.find(".relationship_list").scrollTop(0).on("scroll",function(r){if(n.hasClass("loading")||n.hasClass("no-results"))return;if(e(this).scrollTop()+e(this).innerHeight()>=e(this).get(0).scrollHeight){var i=parseInt(n.attr("data-paged"));n.attr("data-paged",i+1);t.set({$el:n}).fetch()}});this.fetch()},fetch:function(){var t=this,n=this.$el;n.addClass("loading");e.ajax({url:acf.o.ajaxurl,type:"post",dataType:"json",data:e.extend({action:"acf/fields/relationship/query_posts",post_id:acf.o.post_id,nonce:acf.o.nonce},this.o),success:function(e){t.set({$el:n}).render(e)}})},render:function(t){var n=this;this.$el.removeClass("no-results").removeClass("loading");this.o.paged==1&&this.$el.find(".relationship_left li:not(.load-more)").remove();if(!t||!t.html){this.$el.addClass("no-results");return}this.$el.find(".relationship_left .load-more").before(t.html);t.next_page_exists||this.$el.addClass("no-results");this.$left.find("a").each(function(){var t=e(this).attr("data-post_id");n.$right.find('a[data-post_id="'+t+'"]').exists()&&e(this).parent().addClass("hide")})},add:function(e){var t=e.attr("data-post_id"),n=e.html();if(this.$right.find("a").length>=this.o.max){alert(acf.l10n.relationship.max.replace("{max}",this.o.max));return!1}if(e.parent().hasClass("hide"))return!1;e.parent().addClass("hide");var r={post_id:e.attr("data-post_id"),title:e.html(),name:this.$input.attr("name")},i=_.template(acf.l10n.relationship.tmpl_li,r);this.$right.find(".relationship_list").append(i);this.$input.trigger("change");this.$el.closest(".field").removeClass("error")},remove:function(e){e.parent().remove();this.$left.find('a[data-post_id="'+e.attr("data-post_id")+'"]').parent("li").removeClass("hide");this.$input.trigger("change")}};e(document).on("acf/setup_fields",function(t,n){e(n).find(".acf_relationship").each(function(){acf.fields.relationship.set({$el:e(this)}).init()})});e(document).on("change",".acf_relationship .select-post_type",function(t){var n=e(this).val(),r=e(this).closest(".acf_relationship");r.attr("data-post_type",n);r.attr("data-paged",1);acf.fields.relationship.set({$el:r}).fetch()});e(document).on("click",".acf_relationship .relationship_left .relationship_list a",function(t){t.preventDefault();acf.fields.relationship.set({$el:e(this).closest(".acf_relationship")}).add(e(this));e(this).blur()});e(document).on("click",".acf_relationship .relationship_right .relationship_list a",function(t){t.preventDefault();acf.fields.relationship.set({$el:e(this).closest(".acf_relationship")}).remove(e(this));e(this).blur()});e(document).on("keyup",".acf_relationship input.relationship_search",function(t){var n=e(this).val(),r=e(this).closest(".acf_relationship");r.attr("data-s",n);r.attr("data-paged",1);clearTimeout(acf.fields.relationship.timeout);acf.fields.relationship.timeout=setTimeout(function(){acf.fields.relationship.set({$el:r}).fetch()},500)});e(document).on("keypress",".acf_relationship input.relationship_search",function(e){e.which==13&&e.preventDefault()})})(jQuery);(function(e){e(document).on("acf/setup_fields",function(t,n){e(n).find(".acf-tab").each(function(){var t=e(this),n=t.parent(),r=n.parent(),i=t.attr("data-id"),s=t.html();if(t.hasClass("acf-tab-added"))return;t.addClass("acf-tab-added");r.children(".acf-tab-group").exists()||r.children(".field_type-tab:first").before('<ul class="hl clearfix acf-tab-group"></ul>');r.children(".acf-tab-group").append('<li class="field_key-'+i+'" data-field_key="'+i+'"><a class="acf-tab-button" href="#" data-id="'+i+'">'+s+"</a></li>")});e(n).find(".acf-tab-group").each(function(){e(this).find("li:first a").trigger("click")})});e(document).on("click",".acf-tab-button",function(t){t.preventDefault();var n=e(this),r=n.closest("ul"),i=r.parent(),s=n.attr("data-id");r.find("li").removeClass("active");n.parent("li").addClass("active");i.children(".field_type-tab").each(function(){var t=e(this);t.hasClass("field_key-"+s)?t.nextUntil(".field_type-tab").removeClass("acf-tab_group-hide").addClass("acf-tab_group-show"):t.nextUntil(".field_type-tab").removeClass("acf-tab_group-show").addClass("acf-tab_group-hide")});n.trigger("blur")})})(jQuery);(function(e){acf.validation={status:!0,disabled:!1,run:function(){var t=this;t.status=!0;e(".postbox:not(.acf-hidden) .field.required, .form-field.required").each(function(){var n=e(this);n.data("validation",!0);if(n.hasClass("acf-conditional_logic-hide"))return;if(n.hasClass("acf-tab_group-hide")&&n.prevAll(".field_type-tab:first").hasClass("acf-conditional_logic-hide"))return;n.find('input[type="text"], input[type="email"], input[type="number"], input[type="hidden"], textarea').val()==""&&n.data("validation",!1);if(n.find(".acf_wysiwyg").exists()&&typeof tinyMCE=="object"){n.data("validation",!0);var r=n.find(".wp-editor-area").attr("id"),i=tinyMCE.get(r);i&&!i.getContent()&&n.data("validation",!1)}if(n.find("select").exists()){n.data("validation",!0);(n.find("select").val()=="null"||!n.find("select").val())&&n.data("validation",!1)}if(n.find('input[type="radio"]').exists()){n.data("validation",!1);n.find('input[type="radio"]:checked').exists()&&n.data("validation",!0)}if(n.find('input[type="checkbox"]').exists()){n.data("validation",!1);n.find('input[type="checkbox"]:checked').exists()&&n.data("validation",!0)}if(n.find(".acf_relationship").exists()){n.data("validation",!1);n.find(".acf_relationship .relationship_right input").exists()&&n.data("validation",!0)}if(n.find(".repeater").exists()){n.data("validation",!1);n.find(".repeater tr.row").exists()&&n.data("validation",!0)}if(n.find(".acf_flexible_content").exists()){n.data("validation",!1);n.find(".acf_flexible_content .values table").exists()&&n.data("validation",!0)}if(n.find(".acf-gallery").exists()){n.data("validation",!1);n.find(".acf-gallery .thumbnail").exists()&&n.data("validation",!0)}e(document).trigger("acf/validate_field",n);if(!n.data("validation")){t.status=!1;n.closest(".field").addClass("error")}})}};e(document).on("focus click",".field.required input, .field.required textarea, .field.required select",function(t){e(this).closest(".field").removeClass("error")});e(document).on("click","#save-post",function(){acf.validation.disabled=!0});e(document).on("submit","#post",function(){if(acf.validation.disabled)return!0;acf.validation.run();if(!acf.validation.status){var t=e(this);t.siblings("#message").remove();t.before('<div id="message" class="error"><p>'+acf.l10n.validation.error+"</p></div>");e("#publish").removeClass("button-primary-disabled");e("#ajax-loading").attr("style","");e("#publishing-action .spinner").hide();return!1}e(".acf_postbox.acf-hidden").remove();return!0})})(jQuery);(function(e){var t=acf.fields.wysiwyg={$el:null,$textarea:null,o:{},set:function(t){e.extend(this,t);this.$textarea=this.$el.find("textarea");this.o=acf.helpers.get_atts(this.$el);this.o.id=this.$textarea.attr("id");return this},has_tinymce:function(){var e=!1;typeof tinyMCE=="object"&&(e=!0);return e},init:function(){if(acf.helpers.is_clone_field(this.$textarea))return;var t=e.extend({},tinyMCE.settings);tinyMCE.settings.theme_advanced_buttons1="";tinyMCE.settings.theme_advanced_buttons2="";tinyMCE.settings.theme_advanced_buttons3="";tinyMCE.settings.theme_advanced_buttons4="";acf.helpers.isset(this.toolbars[this.o.toolbar])&&e.each(this.toolbars[this.o.toolbar],function(e,t){tinyMCE.settings[e]=t});tinyMCE.execCommand("mceAddControl",!1,this.o.id);e(document).trigger("acf/wysiwyg/load",this.o.id);this.add_events();tinyMCE.settings=t;wpActiveEditor=null},add_events:function(){var t=this.o.id,n=tinyMCE.get(t);if(!n)return;var r=e("#wp-"+t+"-wrap"),i=e(n.getBody());r.on("click",function(){e(document).trigger("acf/wysiwyg/click",t)});i.on("focus",function(){e(document).trigger("acf/wysiwyg/focus",t)});i.on("blur",function(){e(document).trigger("acf/wysiwyg/blur",t)})},destroy:function(){var e=this.o.id,t=tinyMCE.get(e);if(t){var n=t.getContent();tinyMCE.execCommand("mceRemoveControl",!1,e);this.$textarea.val(n)}wpActiveEditor=null}};e(document).on("acf/setup_fields",function(n,r){if(!t.has_tinymce())return;e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()});setTimeout(function(){e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).init()})},0)});e(document).on("acf/remove_fields",function(n,r){if(!t.has_tinymce())return;r.find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()})});e(document).on("acf/wysiwyg/click",function(t,n){wpActiveEditor=n;container=e("#wp-"+n+"-wrap").closest(".field").removeClass("error")});e(document).on("acf/wysiwyg/focus",function(t,n){wpActiveEditor=n;container=e("#wp-"+n+"-wrap").closest(".field").removeClass("error")});e(document).on("acf/wysiwyg/blur",function(t,n){wpActiveEditor=null;var r=tinyMCE.get(n);if(!r)return;var i=r.getElement();r.save();e(i).trigger("change")});e(document).on("acf/sortable_start",function(n,r){if(!t.has_tinymce())return;e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).destroy()})});e(document).on("acf/sortable_stop",function(n,r){if(!t.has_tinymce())return;e(r).find(".acf_wysiwyg").each(function(){t.set({$el:e(this)}).init()})});e(window).load(function(){if(!t.has_tinymce())return;var n=e("#wp-content-wrap").exists(),r=e("#wp-acf_settings-wrap").exists();mode="tmce";r&&e("#wp-acf_settings-wrap").hasClass("html-active")&&(mode="html");setTimeout(function(){r&&mode=="html"&&e("#acf_settings-tmce").trigger("click")},1);setTimeout(function(){r&&mode=="html"&&e("#acf_settings-html").trigger("click");n&&t.set({$el:e("#wp-content-wrap")}).add_events()},11)});e(document).on("click",".acf_wysiwyg a.mce_fullscreen",function(){var t=e(this).closest(".acf_wysiwyg"),n=t.attr("data-upload");n=="no"&&e("#mce_fullscreen_container td.mceToolbar .mce_add_media").remove()})})(jQuery);
|
readme.txt
CHANGED
@@ -105,6 +105,25 @@ http://support.advancedcustomfields.com/
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
= 4.2.0 =
|
109 |
* IMPORTANT: ACF now requires a minimum WordPress version of 3.5.0
|
110 |
* Full integration between attachments and custom fields!
|
105 |
|
106 |
== Changelog ==
|
107 |
|
108 |
+
= 4.2.2 =
|
109 |
+
* Field group: Added 'High (after title)' position for a metabox - http://support.advancedcustomfields.com/forums/topic/position-after-title-solution-inside/
|
110 |
+
* Relatinoship field: Fixed bug with 'exclude_from_search' post types
|
111 |
+
* Image / File field: Improved edit popup efficiency and fixed bug when 'upload' is last active mode - http://support.advancedcustomfields.com/forums/topic/edit-image-only-shows-add-new-screen/
|
112 |
+
* JS: Added un compressed input.js file
|
113 |
+
* JS: Fixed but with options page / taxonomy field - http://support.advancedcustomfields.com/forums/topic/checkbox-issues/
|
114 |
+
* Language: Updated Persian Translation - thanks to Ghaem Omidi
|
115 |
+
|
116 |
+
= 4.2.1 =
|
117 |
+
* Taxonomy field: Fixed issue causing selected terms to appear as numbers - http://support.advancedcustomfields.com/forums/topic/latest-update-4-2-0-taxonomy-field-not-working-correctly/
|
118 |
+
* Revisions: Fixed WP 3.6 revisions - http://support.advancedcustomfields.com/forums/topic/wordpress-3-6-revisions-custom-fields-no-longer-tracked/
|
119 |
+
* Relationship Field: Add new option for return_format
|
120 |
+
* Location Rule - Add new rule for post status - http://support.advancedcustomfields.com/forums/topic/location-rules-post-status/
|
121 |
+
* Location Rule: Add 'super admin' to users rule - thanks to Ryan Nielson - https://github.com/RyanNielson/acf/commit/191abf35754c242f2ff75ac33ff8a4dca963a6cc
|
122 |
+
* Core: Fixed pre_save_post $post_id issue - http://support.advancedcustomfields.com/forums/topic/frontend-form-issues-pre_save_post-save_post/
|
123 |
+
* Core: Fix minor CSS but in media modal - http://support.advancedcustomfields.com/forums/topic/minor-css-issue-in-media-upload-lightbox/#post-2138
|
124 |
+
* File field: Fix minor 'strict standards' warning - http://support.advancedcustomfields.com/forums/topic/strict-standards-error-on-file-upload/
|
125 |
+
* Image field: Fix minor CSS issue - http://support.advancedcustomfields.com/forums/topic/firefox-repeaterimage-css/
|
126 |
+
|
127 |
= 4.2.0 =
|
128 |
* IMPORTANT: ACF now requires a minimum WordPress version of 3.5.0
|
129 |
* Full integration between attachments and custom fields!
|