Merge branch 'release/5.5.11'
This commit is contained in:
commit
a69d709383
13
acf.php
13
acf.php
|
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: Advanced Custom Fields PRO
|
||||
Plugin URI: https://www.advancedcustomfields.com/
|
||||
Description: Customise WordPress with powerful, professional and intuitive fields
|
||||
Version: 5.5.10
|
||||
Version: 5.5.11
|
||||
Author: Elliot Condon
|
||||
Author URI: http://www.elliotcondon.com/
|
||||
Copyright: Elliot Condon
|
||||
|
|
@ -58,7 +58,7 @@ class acf {
|
|||
|
||||
// basic
|
||||
'name' => __('Advanced Custom Fields', 'acf'),
|
||||
'version' => '5.5.10',
|
||||
'version' => '5.5.11',
|
||||
|
||||
// urls
|
||||
'basename' => plugin_basename( __FILE__ ),
|
||||
|
|
@ -184,16 +184,13 @@ class acf {
|
|||
|
||||
function init() {
|
||||
|
||||
// bail early if a plugin called get_field early
|
||||
// bail early if too early
|
||||
// ensures all plugins have a chance to add fields, etc
|
||||
if( !did_action('plugins_loaded') ) return;
|
||||
|
||||
|
||||
// bail early if already init
|
||||
if( acf_get_setting('init') ) return;
|
||||
|
||||
|
||||
// only run once
|
||||
acf_update_setting('init', true);
|
||||
if( acf_has_done('init') ) return;
|
||||
|
||||
|
||||
// vars
|
||||
|
|
|
|||
|
|
@ -254,7 +254,9 @@ function acf_get_sites() {
|
|||
// WP >= 4.6
|
||||
if( function_exists('get_sites') ) {
|
||||
|
||||
$_sites = get_sites();
|
||||
$_sites = get_sites(array(
|
||||
'number' => 0
|
||||
));
|
||||
|
||||
foreach( $_sites as $_site ) {
|
||||
|
||||
|
|
@ -266,7 +268,9 @@ function acf_get_sites() {
|
|||
// WP < 4.6
|
||||
} else {
|
||||
|
||||
$sites = wp_get_sites();
|
||||
$sites = wp_get_sites(array(
|
||||
'limit' => 0
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ class acf_admin_install {
|
|||
/*
|
||||
* admin_notices
|
||||
*
|
||||
* This function will render any admin notices
|
||||
* This function will render the DB Upgrade notice
|
||||
*
|
||||
* @type function
|
||||
* @date 17/10/13
|
||||
|
|
|
|||
|
|
@ -1,14 +1,27 @@
|
|||
<?php
|
||||
|
||||
// defaults
|
||||
$args = wp_parse_args($args, array(
|
||||
'button_url' => '',
|
||||
'button_text' => '',
|
||||
'confirm' => true
|
||||
));
|
||||
// vars
|
||||
$button_url = '';
|
||||
$button_text = '';
|
||||
$confirm = true;
|
||||
|
||||
|
||||
// extract
|
||||
extract($args);
|
||||
|
||||
|
||||
// calculate add-ons (non pro only)
|
||||
$plugins = array();
|
||||
|
||||
if( !acf_get_setting('pro') ) {
|
||||
|
||||
if( is_plugin_active('acf-repeater/acf-repeater.php') ) $plugins[] = __("Repeater",'acf');
|
||||
if( is_plugin_active('acf-flexible-content/acf-flexible-content.php') ) $plugins[] = __("Flexible Content",'acf');
|
||||
if( is_plugin_active('acf-gallery/acf-gallery.php') ) $plugins[] = __("Gallery",'acf');
|
||||
if( is_plugin_active('acf-options-page/acf-options-page.php') ) $plugins[] = __("Options Page",'acf');
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<div id="acf-upgrade-notice" class="acf-cf">
|
||||
|
||||
|
|
@ -24,6 +37,10 @@ extract($args);
|
|||
|
||||
<p><?php printf(__("Thank you for updating to %s v%s!", 'acf'), acf_get_setting('name'), acf_get_setting('version') ); ?><br /><?php _e("Before you start using the new awesome features, please update your database to the newest version.", 'acf'); ?></p>
|
||||
|
||||
<?php if( !empty($plugins) ): ?>
|
||||
<p><?php printf(__("Please also ensure any premium add-ons (%s) have first been updated to the latest version.", 'acf'), implode(', ', $plugins) ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<p><a id="acf-notice-action" href="<?php echo $button_url; ?>" class="button button-primary"><?php echo $button_text; ?></a></p>
|
||||
|
||||
<?php if( $confirm ): ?>
|
||||
|
|
|
|||
|
|
@ -1026,57 +1026,49 @@ function _acf_get_field_by_name( $name = '', $db_only = false ) {
|
|||
|
||||
function acf_maybe_get_field( $selector, $post_id = false, $strict = true ) {
|
||||
|
||||
// complete init
|
||||
// this function may be used in a theme file before the init action has been run
|
||||
acf()->init();
|
||||
// init
|
||||
acf_init();
|
||||
|
||||
|
||||
// vars
|
||||
$field_name = false;
|
||||
// bail early if is field key
|
||||
if( acf_is_field_key($selector) ) {
|
||||
|
||||
return acf_get_field( $selector );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// save selector as field_name (could be sub field name 'images_0_image')
|
||||
$field_name = $selector;
|
||||
|
||||
|
||||
// get valid post_id
|
||||
$post_id = acf_get_valid_post_id( $post_id );
|
||||
|
||||
|
||||
// load field reference if not a field_key
|
||||
if( !acf_is_field_key($selector) ) {
|
||||
|
||||
// save selector as field_name (could be sub field name)
|
||||
$field_name = $selector;
|
||||
|
||||
|
||||
// get reference
|
||||
$field_key = acf_get_field_reference( $selector, $post_id );
|
||||
|
||||
|
||||
// update selector
|
||||
if( $field_key ) {
|
||||
|
||||
$selector = $field_key;
|
||||
|
||||
// bail early if no reference
|
||||
} elseif( $strict ) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// get field key
|
||||
// get field
|
||||
$field = acf_get_field( $selector );
|
||||
|
||||
|
||||
// bail early if no field
|
||||
if( !$field ) return false;
|
||||
|
||||
|
||||
// Override name - allows the $selector to be a sub field (images_0_image)
|
||||
if( $field_name ) {
|
||||
|
||||
$field['name'] = $field_name;
|
||||
|
||||
}
|
||||
// update name
|
||||
if( $field ) $field['name'] = $field_name;
|
||||
|
||||
|
||||
// return
|
||||
|
|
@ -1709,18 +1701,14 @@ function acf_prepare_fields_for_import( $fields = false ) {
|
|||
$field = acf_prepare_field_for_import( $fields[ $i ] );
|
||||
|
||||
|
||||
// ensure $field is an array of fields
|
||||
// this allows for multiepl sub fields to be returned
|
||||
if( acf_is_associative_array($field) ) {
|
||||
|
||||
$field = array( $field );
|
||||
|
||||
}
|
||||
|
||||
// allow multiple fields to be returned ($field + $sub_fields)
|
||||
if( acf_is_sequential_array($field) ) {
|
||||
|
||||
// merge in $field (1 or more fields)
|
||||
array_splice($fields, $i, 1, $field);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// $i
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -81,6 +81,26 @@ function acf_update_setting( $name, $value ) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_init
|
||||
*
|
||||
* alias of acf()->init()
|
||||
*
|
||||
* @type function
|
||||
* @date 28/09/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function acf_init() {
|
||||
|
||||
acf()->init();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_append_setting
|
||||
*
|
||||
|
|
@ -4159,12 +4179,17 @@ function acf_translate_keys( $array, $keys ) {
|
|||
|
||||
function acf_translate( $string ) {
|
||||
|
||||
// vars
|
||||
$l10n = acf_get_setting('l10n');
|
||||
$textdomain = acf_get_setting('l10n_textdomain');
|
||||
|
||||
|
||||
// bail early if not enabled
|
||||
if( !acf_get_setting('l10n') ) return $string;
|
||||
if( !$l10n ) return $string;
|
||||
|
||||
|
||||
// bail early if no textdomain
|
||||
if( !acf_get_setting('l10n_textdomain') ) return $string;
|
||||
if( !$textdomain ) return $string;
|
||||
|
||||
|
||||
// is array
|
||||
|
|
@ -4186,13 +4211,18 @@ function acf_translate( $string ) {
|
|||
// allow for var_export export
|
||||
if( acf_get_setting('l10n_var_export') ){
|
||||
|
||||
return "!!__(!!'" . $string . "!!', !!'" . acf_get_setting('l10n_textdomain') . "!!')!!";
|
||||
// bail early if already translated
|
||||
if( substr($string, 0, 7) === '!!__(!!' ) return $string;
|
||||
|
||||
|
||||
// return
|
||||
return "!!__(!!'" . $string . "!!', !!'" . $textdomain . "!!')!!";
|
||||
|
||||
}
|
||||
|
||||
|
||||
// vars
|
||||
return __( $string, acf_get_setting('l10n_textdomain') );
|
||||
return __( $string, $textdomain );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ function get_field_objects( $post_id = false, $format_value = true, $load_value
|
|||
|
||||
// get field
|
||||
$field_key = $meta["_{$k}"][0];
|
||||
$field = acf_get_field( $field_key );
|
||||
$field = acf_maybe_get_field( $field_key );
|
||||
|
||||
|
||||
// bail early if no field, or if the field's name is different to $k
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ function acf_update_value( $value = null, $post_id = 0, $field ) {
|
|||
// filter for 3rd party customization
|
||||
$value = apply_filters( "acf/update_value", $value, $post_id, $field );
|
||||
$value = apply_filters( "acf/update_value/type={$field['type']}", $value, $post_id, $field );
|
||||
$value = apply_filters( "acf/update_value/name={$field['name']}", $value, $post_id, $field );
|
||||
$value = apply_filters( "acf/update_value/name={$field['_name']}", $value, $post_id, $field );
|
||||
$value = apply_filters( "acf/update_value/key={$field['key']}", $value, $post_id, $field );
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -698,21 +698,6 @@ a.acf-icon.-cancel.grey:hover {
|
|||
}
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
*
|
||||
* media-modal
|
||||
*
|
||||
*---------------------------------------------------------------------------------------------*/
|
||||
/* media fix */
|
||||
.media-modal .acf-field * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.media-modal .acf-table {
|
||||
table-layout: auto;
|
||||
}
|
||||
.media-item .describe .acf-table > thead > tr > th {
|
||||
width: auto;
|
||||
}
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
*
|
||||
* wp-admin
|
||||
*
|
||||
*---------------------------------------------------------------------------------------------*/
|
||||
|
|
|
|||
|
|
@ -1851,8 +1851,8 @@ html[dir="rtl"] .acf-taxonomy-field[data-type="select"] .acf-icon {
|
|||
.media-modal.acf-expanded .acf-expand-details .is-closed {
|
||||
display: none;
|
||||
}
|
||||
.media-modal.acf-expanded .media-toolbar,
|
||||
.media-modal.acf-expanded .attachments {
|
||||
.media-modal.acf-expanded .attachments-browser .media-toolbar,
|
||||
.media-modal.acf-expanded .attachments-browser .attachments {
|
||||
right: 740px;
|
||||
}
|
||||
.media-modal.acf-expanded .media-sidebar {
|
||||
|
|
@ -1974,6 +1974,7 @@ body.major-4 .acf-media-modal.-edit .media-frame-content {
|
|||
padding: 0 16px;
|
||||
/* WP details */
|
||||
/* ACF fields */
|
||||
/* WP required message */
|
||||
}
|
||||
.acf-media-modal.-edit .media-sidebar .attachment-details {
|
||||
overflow: visible;
|
||||
|
|
@ -2010,6 +2011,9 @@ body.major-4 .acf-media-modal.-edit .media-frame-content {
|
|||
.acf-media-modal.-edit .media-sidebar .compat-attachment-fields > tbody > .acf-field p.description {
|
||||
margin-top: 3px;
|
||||
}
|
||||
.acf-media-modal.-edit .media-sidebar .media-types-required-info {
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.acf-media-modal.-edit {
|
||||
top: 30px;
|
||||
|
|
|
|||
|
|
@ -1836,38 +1836,221 @@ var acf;
|
|||
|
||||
str_sanitize: function( string ) {
|
||||
|
||||
// vars
|
||||
var string2 = '',
|
||||
replace = {
|
||||
'æ': 'a',
|
||||
'å': 'a',
|
||||
'á': 'a',
|
||||
'ä': 'a',
|
||||
'č': 'c',
|
||||
'ď': 'd',
|
||||
'è': 'e',
|
||||
'é': 'e',
|
||||
'ě': 'e',
|
||||
'ë': 'e',
|
||||
'í': 'i',
|
||||
'ĺ': 'l',
|
||||
'ľ': 'l',
|
||||
'ň': 'n',
|
||||
'ø': 'o',
|
||||
'ó': 'o',
|
||||
'ô': 'o',
|
||||
'ő': 'o',
|
||||
'ö': 'o',
|
||||
'ŕ': 'r',
|
||||
'š': 's',
|
||||
'ť': 't',
|
||||
'ú': 'u',
|
||||
'ů': 'u',
|
||||
'ű': 'u',
|
||||
'ü': 'u',
|
||||
'ý': 'y',
|
||||
'ř': 'r',
|
||||
'ž': 'z',
|
||||
// chars (https://jsperf.com/replace-foreign-characters)
|
||||
var map = {
|
||||
"À": "A",
|
||||
"Á": "A",
|
||||
"Â": "A",
|
||||
"Ã": "A",
|
||||
"Ä": "A",
|
||||
"Å": "A",
|
||||
"Æ": "AE",
|
||||
"Ç": "C",
|
||||
"È": "E",
|
||||
"É": "E",
|
||||
"Ê": "E",
|
||||
"Ë": "E",
|
||||
"Ì": "I",
|
||||
"Í": "I",
|
||||
"Î": "I",
|
||||
"Ï": "I",
|
||||
"Ð": "D",
|
||||
"Ñ": "N",
|
||||
"Ò": "O",
|
||||
"Ó": "O",
|
||||
"Ô": "O",
|
||||
"Õ": "O",
|
||||
"Ö": "O",
|
||||
"Ø": "O",
|
||||
"Ù": "U",
|
||||
"Ú": "U",
|
||||
"Û": "U",
|
||||
"Ü": "U",
|
||||
"Ý": "Y",
|
||||
"ß": "s",
|
||||
"à": "a",
|
||||
"á": "a",
|
||||
"â": "a",
|
||||
"ã": "a",
|
||||
"ä": "a",
|
||||
"å": "a",
|
||||
"æ": "ae",
|
||||
"ç": "c",
|
||||
"è": "e",
|
||||
"é": "e",
|
||||
"ê": "e",
|
||||
"ë": "e",
|
||||
"ì": "i",
|
||||
"í": "i",
|
||||
"î": "i",
|
||||
"ï": "i",
|
||||
"ñ": "n",
|
||||
"ò": "o",
|
||||
"ó": "o",
|
||||
"ô": "o",
|
||||
"õ": "o",
|
||||
"ö": "o",
|
||||
"ø": "o",
|
||||
"ù": "u",
|
||||
"ú": "u",
|
||||
"û": "u",
|
||||
"ü": "u",
|
||||
"ý": "y",
|
||||
"ÿ": "y",
|
||||
"Ā": "A",
|
||||
"ā": "a",
|
||||
"Ă": "A",
|
||||
"ă": "a",
|
||||
"Ą": "A",
|
||||
"ą": "a",
|
||||
"Ć": "C",
|
||||
"ć": "c",
|
||||
"Ĉ": "C",
|
||||
"ĉ": "c",
|
||||
"Ċ": "C",
|
||||
"ċ": "c",
|
||||
"Č": "C",
|
||||
"č": "c",
|
||||
"Ď": "D",
|
||||
"ď": "d",
|
||||
"Đ": "D",
|
||||
"đ": "d",
|
||||
"Ē": "E",
|
||||
"ē": "e",
|
||||
"Ĕ": "E",
|
||||
"ĕ": "e",
|
||||
"Ė": "E",
|
||||
"ė": "e",
|
||||
"Ę": "E",
|
||||
"ę": "e",
|
||||
"Ě": "E",
|
||||
"ě": "e",
|
||||
"Ĝ": "G",
|
||||
"ĝ": "g",
|
||||
"Ğ": "G",
|
||||
"ğ": "g",
|
||||
"Ġ": "G",
|
||||
"ġ": "g",
|
||||
"Ģ": "G",
|
||||
"ģ": "g",
|
||||
"Ĥ": "H",
|
||||
"ĥ": "h",
|
||||
"Ħ": "H",
|
||||
"ħ": "h",
|
||||
"Ĩ": "I",
|
||||
"ĩ": "i",
|
||||
"Ī": "I",
|
||||
"ī": "i",
|
||||
"Ĭ": "I",
|
||||
"ĭ": "i",
|
||||
"Į": "I",
|
||||
"į": "i",
|
||||
"İ": "I",
|
||||
"ı": "i",
|
||||
"IJ": "IJ",
|
||||
"ij": "ij",
|
||||
"Ĵ": "J",
|
||||
"ĵ": "j",
|
||||
"Ķ": "K",
|
||||
"ķ": "k",
|
||||
"Ĺ": "L",
|
||||
"ĺ": "l",
|
||||
"Ļ": "L",
|
||||
"ļ": "l",
|
||||
"Ľ": "L",
|
||||
"ľ": "l",
|
||||
"Ŀ": "L",
|
||||
"ŀ": "l",
|
||||
"Ł": "l",
|
||||
"ł": "l",
|
||||
"Ń": "N",
|
||||
"ń": "n",
|
||||
"Ņ": "N",
|
||||
"ņ": "n",
|
||||
"Ň": "N",
|
||||
"ň": "n",
|
||||
"ʼn": "n",
|
||||
"Ō": "O",
|
||||
"ō": "o",
|
||||
"Ŏ": "O",
|
||||
"ŏ": "o",
|
||||
"Ő": "O",
|
||||
"ő": "o",
|
||||
"Œ": "OE",
|
||||
"œ": "oe",
|
||||
"Ŕ": "R",
|
||||
"ŕ": "r",
|
||||
"Ŗ": "R",
|
||||
"ŗ": "r",
|
||||
"Ř": "R",
|
||||
"ř": "r",
|
||||
"Ś": "S",
|
||||
"ś": "s",
|
||||
"Ŝ": "S",
|
||||
"ŝ": "s",
|
||||
"Ş": "S",
|
||||
"ş": "s",
|
||||
"Š": "S",
|
||||
"š": "s",
|
||||
"Ţ": "T",
|
||||
"ţ": "t",
|
||||
"Ť": "T",
|
||||
"ť": "t",
|
||||
"Ŧ": "T",
|
||||
"ŧ": "t",
|
||||
"Ũ": "U",
|
||||
"ũ": "u",
|
||||
"Ū": "U",
|
||||
"ū": "u",
|
||||
"Ŭ": "U",
|
||||
"ŭ": "u",
|
||||
"Ů": "U",
|
||||
"ů": "u",
|
||||
"Ű": "U",
|
||||
"ű": "u",
|
||||
"Ų": "U",
|
||||
"ų": "u",
|
||||
"Ŵ": "W",
|
||||
"ŵ": "w",
|
||||
"Ŷ": "Y",
|
||||
"ŷ": "y",
|
||||
"Ÿ": "Y",
|
||||
"Ź": "Z",
|
||||
"ź": "z",
|
||||
"Ż": "Z",
|
||||
"ż": "z",
|
||||
"Ž": "Z",
|
||||
"ž": "z",
|
||||
"ſ": "s",
|
||||
"ƒ": "f",
|
||||
"Ơ": "O",
|
||||
"ơ": "o",
|
||||
"Ư": "U",
|
||||
"ư": "u",
|
||||
"Ǎ": "A",
|
||||
"ǎ": "a",
|
||||
"Ǐ": "I",
|
||||
"ǐ": "i",
|
||||
"Ǒ": "O",
|
||||
"ǒ": "o",
|
||||
"Ǔ": "U",
|
||||
"ǔ": "u",
|
||||
"Ǖ": "U",
|
||||
"ǖ": "u",
|
||||
"Ǘ": "U",
|
||||
"ǘ": "u",
|
||||
"Ǚ": "U",
|
||||
"ǚ": "u",
|
||||
"Ǜ": "U",
|
||||
"ǜ": "u",
|
||||
"Ǻ": "A",
|
||||
"ǻ": "a",
|
||||
"Ǽ": "AE",
|
||||
"ǽ": "ae",
|
||||
"Ǿ": "O",
|
||||
"ǿ": "o",
|
||||
|
||||
// extra
|
||||
' ': '_',
|
||||
'\'': '',
|
||||
'?': '',
|
||||
|
|
@ -1875,6 +2058,7 @@ var acf;
|
|||
'\\': '',
|
||||
'.': '',
|
||||
',': '',
|
||||
'`': '',
|
||||
'>': '',
|
||||
'<': '',
|
||||
'"': '',
|
||||
|
|
@ -1888,33 +2072,20 @@ var acf;
|
|||
};
|
||||
|
||||
|
||||
// lowercase
|
||||
// vars
|
||||
var regexp = /\W/g,
|
||||
mapping = function (c) { return (typeof map[c] !== 'undefined') ? map[c] : c; };
|
||||
|
||||
|
||||
// replace
|
||||
string = string.replace(regexp, mapping);
|
||||
|
||||
|
||||
// lower case
|
||||
string = string.toLowerCase();
|
||||
|
||||
|
||||
// loop through characters
|
||||
for( i = 0; i < string.length; i++ ) {
|
||||
|
||||
// character
|
||||
var c = string.charAt(i);
|
||||
|
||||
|
||||
// override c with replacement
|
||||
if( typeof replace[c] !== 'undefined' ) {
|
||||
|
||||
c = replace[c];
|
||||
|
||||
}
|
||||
|
||||
|
||||
// append
|
||||
string2 += c;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return string2;
|
||||
return string;
|
||||
|
||||
},
|
||||
|
||||
|
|
@ -5417,17 +5588,27 @@ var acf;
|
|||
get_file_info: function( $file_input, $hidden_input ){
|
||||
|
||||
// vars
|
||||
var attachment = {};
|
||||
var val = $file_input.val(),
|
||||
attachment = {};
|
||||
|
||||
|
||||
// bail early if no value
|
||||
if( !val ) {
|
||||
|
||||
$hidden_input.val('');
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// url
|
||||
attachment.url = $file_input.val();
|
||||
attachment.url = val;
|
||||
|
||||
|
||||
// modern browsers
|
||||
var files = $file_input[0].files;
|
||||
|
||||
if( files ){
|
||||
if( files.length ){
|
||||
|
||||
// vars
|
||||
var file = files[0];
|
||||
|
|
@ -5805,6 +5986,10 @@ var acf;
|
|||
});
|
||||
|
||||
|
||||
// action for 3rd party customization
|
||||
acf.do_action('google_map_init', this.map, this.map.marker, this.$field);
|
||||
|
||||
|
||||
// add to maps
|
||||
this.maps[ this.o.id ] = this.map;
|
||||
|
||||
|
|
@ -7640,29 +7825,14 @@ var acf;
|
|||
// extend
|
||||
wp.media.view.AttachmentCompat = AttachmentCompat.extend({
|
||||
|
||||
render: function() {
|
||||
|
||||
// reference
|
||||
var self = this;
|
||||
|
||||
|
||||
// validate
|
||||
if( this.ignore_render ) return this;
|
||||
|
||||
|
||||
// add button
|
||||
setTimeout(function(){
|
||||
add_acf_expand_button: function(){
|
||||
|
||||
// vars
|
||||
var $media_model = self.$el.closest('.media-modal');
|
||||
var $el = this.$el.closest('.media-modal');
|
||||
|
||||
|
||||
// does button already exist?
|
||||
if( $media_model.find('.media-frame-router .acf-expand-details').exists() ) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
if( $el.find('.media-frame-router .acf-expand-details').exists() ) return;
|
||||
|
||||
|
||||
// create button
|
||||
|
|
@ -7679,13 +7849,13 @@ var acf;
|
|||
|
||||
e.preventDefault();
|
||||
|
||||
if( $media_model.hasClass('acf-expanded') ) {
|
||||
if( $el.hasClass('acf-expanded') ) {
|
||||
|
||||
$media_model.removeClass('acf-expanded');
|
||||
$el.removeClass('acf-expanded');
|
||||
|
||||
} else {
|
||||
|
||||
$media_model.addClass('acf-expanded');
|
||||
$el.addClass('acf-expanded');
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -7693,8 +7863,24 @@ var acf;
|
|||
|
||||
|
||||
// append
|
||||
$media_model.find('.media-frame-router').append( $a );
|
||||
$el.find('.media-frame-router').append( $a );
|
||||
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
||||
// validate
|
||||
if( this.ignore_render ) return this;
|
||||
|
||||
|
||||
// reference
|
||||
var self = this;
|
||||
|
||||
|
||||
// add expand button
|
||||
setTimeout(function(){
|
||||
|
||||
self.add_acf_expand_button();
|
||||
|
||||
}, 0);
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -6,6 +6,8 @@ if( ! class_exists('acf_fields') ) :
|
|||
|
||||
class acf_fields {
|
||||
|
||||
var $types = array();
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
|
|
@ -22,8 +24,7 @@ class acf_fields {
|
|||
|
||||
function __construct() {
|
||||
|
||||
// vars
|
||||
$this->types = array();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
180
core/local.php
180
core/local.php
|
|
@ -7,7 +7,8 @@ if( ! class_exists('acf_local') ) :
|
|||
class acf_local {
|
||||
|
||||
// vars
|
||||
var $temp = array(),
|
||||
var $temp_groups = array(),
|
||||
$temp_fields = array(),
|
||||
$groups = array(),
|
||||
$fields = array(),
|
||||
$reference = array(),
|
||||
|
|
@ -88,7 +89,8 @@ class acf_local {
|
|||
function reset() {
|
||||
|
||||
// vars
|
||||
$this->temp = array();
|
||||
$this->temp_groups = array();
|
||||
$this->temp_fields = array();
|
||||
$this->groups = array();
|
||||
$this->fields = array();
|
||||
$this->reference = array();
|
||||
|
|
@ -122,6 +124,84 @@ class acf_local {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* is_ready
|
||||
*
|
||||
* This function will return true when ACF has included all field types and is ready to import
|
||||
* Importing fields too early will cause issues where sub fields have not been extracted correctly
|
||||
*
|
||||
* @type function
|
||||
* @date 13/3/17
|
||||
* @since 5.5.10
|
||||
*
|
||||
* @param n/a
|
||||
* @return (boolean)
|
||||
*/
|
||||
|
||||
function is_ready() {
|
||||
|
||||
return did_action('acf/include_fields');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_include_fields
|
||||
*
|
||||
* This function include any $temp data
|
||||
*
|
||||
* @type function
|
||||
* @date 8/2/17
|
||||
* @since 5.5.6
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function acf_include_fields() {
|
||||
|
||||
// field groups
|
||||
if( !empty($this->temp_groups) ) {
|
||||
|
||||
// loop
|
||||
foreach( $this->temp_groups as $i => $temp ) {
|
||||
|
||||
// add
|
||||
$this->add_field_group($temp);
|
||||
|
||||
|
||||
// unset
|
||||
unset($this->temp_groups[ $i ]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// fields
|
||||
if( !empty($this->temp_fields) ) {
|
||||
|
||||
// prepare
|
||||
$this->temp_fields = acf_prepare_fields_for_import( $this->temp_fields );
|
||||
|
||||
|
||||
// loop
|
||||
foreach( $this->temp_fields as $i => $temp ) {
|
||||
|
||||
// add
|
||||
$this->add_field($temp);
|
||||
|
||||
|
||||
// unset
|
||||
unset($this->temp_fields[ $i ]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* add_parent_reference
|
||||
*
|
||||
|
|
@ -178,6 +258,36 @@ class acf_local {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* maybe_add_field
|
||||
*
|
||||
* This function will either import or add to temp
|
||||
*
|
||||
* @type function
|
||||
* @date 9/2/17
|
||||
* @since 5.5.6
|
||||
*
|
||||
* @param $field (array)
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function maybe_add_field( $field ) {
|
||||
|
||||
// add
|
||||
if( $this->is_ready() ) {
|
||||
|
||||
$this->add_field( $field );
|
||||
|
||||
// add to temp
|
||||
} else {
|
||||
|
||||
$this->temp_fields[] = $field;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* add_field
|
||||
*
|
||||
|
|
@ -344,74 +454,32 @@ class acf_local {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_include_fields
|
||||
*
|
||||
* This function include any $temp field groups during the 'acf/include_fields' action
|
||||
*
|
||||
* @type function
|
||||
* @date 8/2/17
|
||||
* @since 5.5.6
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function acf_include_fields() {
|
||||
|
||||
// bail ealry if no temp
|
||||
if( empty($this->temp) ) return;
|
||||
|
||||
|
||||
// loop
|
||||
foreach( $this->temp as $i => $temp ) {
|
||||
|
||||
// add
|
||||
$this->add_field_group($temp);
|
||||
|
||||
|
||||
// unset
|
||||
unset($this->temp[ $i ]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* maybe_add_field_group
|
||||
*
|
||||
* This function will determine if it is too early to 'add' a field group and if so will add to $temp
|
||||
* Field groups added to $temp will be included during the 'acf/include_fields' action which ensures all field types exist
|
||||
* This function will either import or add to temp
|
||||
*
|
||||
* @type function
|
||||
* @date 9/2/17
|
||||
* @since 5.5.6
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param $field_group (array)
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function maybe_add_field_group( $field_group ) {
|
||||
|
||||
// add to temp if too early
|
||||
if( !did_action('acf/include_fields') ) {
|
||||
|
||||
// append
|
||||
$this->temp[] = $field_group;
|
||||
|
||||
|
||||
// return
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// add
|
||||
if( $this->is_ready() ) {
|
||||
|
||||
$this->add_field_group( $field_group );
|
||||
|
||||
// add to temp
|
||||
} else {
|
||||
|
||||
// return
|
||||
return true;
|
||||
$this->temp_groups[] = $field_group;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -865,7 +933,7 @@ function acf_add_local_field_group( $field_group ) {
|
|||
|
||||
function acf_remove_local_field_group( $key = '' ) {
|
||||
|
||||
// missing
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -905,7 +973,7 @@ function acf_get_local_field_groups() {
|
|||
// field
|
||||
function acf_add_local_field( $field ) {
|
||||
|
||||
return acf_local()->add_field( $field );
|
||||
return acf_local()->maybe_add_field( $field );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -385,6 +385,10 @@ class acf_field_checkbox extends acf_field {
|
|||
if( isset($field['choices'][ $v ]) ) continue;
|
||||
|
||||
|
||||
// unslash (fixes serialize single quote issue)
|
||||
$v = wp_unslash($v);
|
||||
|
||||
|
||||
// append
|
||||
$field['choices'][ $v ] = $v;
|
||||
|
||||
|
|
|
|||
|
|
@ -383,6 +383,10 @@ class acf_field_radio extends acf_field {
|
|||
if( !$field['ID'] ) return $value;
|
||||
|
||||
|
||||
// unslash (fixes serialize single quote issue)
|
||||
$value = wp_unslash($value);
|
||||
|
||||
|
||||
// update $field
|
||||
$field['choices'][ $value ] = $value;
|
||||
|
||||
|
|
|
|||
Binary file not shown.
1046
lang/acf-de_CH.po
1046
lang/acf-de_CH.po
File diff suppressed because it is too large
Load Diff
Binary file not shown.
1750
lang/acf-fr_FR.po
1750
lang/acf-fr_FR.po
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,10 @@
|
|||
<?php
|
||||
|
||||
class acf_pro_options_page {
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
if( ! class_exists('acf_admin_options_page') ) :
|
||||
|
||||
class acf_admin_options_page {
|
||||
|
||||
var $page;
|
||||
|
||||
|
|
@ -473,6 +477,9 @@ if( typeof acf !== 'undefined' ) {
|
|||
|
||||
}
|
||||
|
||||
new acf_pro_options_page();
|
||||
// initialize
|
||||
new acf_admin_options_page();
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
@ -13,6 +13,8 @@
|
|||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
if( ! function_exists('acf_get_valid_options_page') ):
|
||||
|
||||
function acf_get_valid_options_page( $page = '' ) {
|
||||
|
||||
// allow for string
|
||||
|
|
@ -91,6 +93,8 @@ function acf_get_valid_options_page( $page = '' ) {
|
|||
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
/*
|
||||
* acf_pro_get_option_page
|
||||
|
|
@ -105,6 +109,8 @@ function acf_get_valid_options_page( $page = '' ) {
|
|||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
if( ! function_exists('acf_get_options_page') ):
|
||||
|
||||
function acf_get_options_page( $slug ) {
|
||||
|
||||
// bail early if page doens't exist
|
||||
|
|
@ -128,6 +134,8 @@ function acf_get_options_page( $slug ) {
|
|||
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
/*
|
||||
* acf_pro_get_option_pages
|
||||
|
|
@ -142,6 +150,8 @@ function acf_get_options_page( $slug ) {
|
|||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
if( ! function_exists('acf_get_options_pages') ):
|
||||
|
||||
function acf_get_options_pages() {
|
||||
|
||||
// global
|
||||
|
|
@ -244,6 +254,8 @@ function acf_get_options_pages() {
|
|||
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
/*
|
||||
* acf_update_options_page
|
||||
|
|
@ -258,6 +270,8 @@ function acf_get_options_pages() {
|
|||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
if( ! function_exists('acf_update_options_page') ):
|
||||
|
||||
function acf_update_options_page( $data ) {
|
||||
|
||||
// bail early if no menu_slug
|
||||
|
|
@ -296,6 +310,8 @@ function acf_update_options_page( $data ) {
|
|||
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
/*
|
||||
* acf_add_options_page
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
initialize: function(){
|
||||
|
||||
// disable clone
|
||||
acf.disable_form( this.$clone );
|
||||
acf.disable_form( this.$clone, 'repeater' );
|
||||
|
||||
|
||||
// render
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
|
||||
|
||||
// enable
|
||||
acf.enable_form( $el );
|
||||
acf.enable_form( $el, 'repeater' );
|
||||
|
||||
|
||||
// move row
|
||||
|
|
@ -400,8 +400,8 @@
|
|||
|
||||
initialize: function(){
|
||||
|
||||
// disable clone inputs
|
||||
this.$clones.find('input, textarea, select').attr('disabled', 'disabled');
|
||||
// disable clone
|
||||
acf.disable_form( this.$clones, 'flexible_content' );
|
||||
|
||||
|
||||
// render
|
||||
|
|
@ -688,8 +688,8 @@
|
|||
$el = acf.duplicate( $clone );
|
||||
|
||||
|
||||
// enable inputs (ignore inputs disabled for life)
|
||||
$el.find('input, textarea, select').not('.acf-disabled').removeAttr('disabled');
|
||||
// enable
|
||||
acf.enable_form( $el, 'flexible_content' );
|
||||
|
||||
|
||||
// hide no values message
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -2,7 +2,7 @@
|
|||
Contributors: elliotcondon
|
||||
Tags: acf, advanced, custom, field, fields, custom field, custom fields, simple fields, magic fields, more fields, repeater, edit
|
||||
Requires at least: 3.6.0
|
||||
Tested up to: 4.7.0
|
||||
Tested up to: 4.8.0
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
|
|
@ -106,6 +106,12 @@ http://support.advancedcustomfields.com/
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 5.5.11 =
|
||||
* Google Map field: Added new 'google_map_init' JS action
|
||||
* Core: Minor fixes and improvements
|
||||
* Language: Updated Swiss German translation - thanks to Raphael Hüni
|
||||
* Language: Updated French translation - thanks to Maxime Bernard-Jacquet
|
||||
|
||||
= 5.5.10 =
|
||||
* API: Added new functionality to the `acf_form()` function:
|
||||
* - added new 'html_updated_message' setting
|
||||
|
|
|
|||
Loading…
Reference in New Issue