Merge branch 'release/5.5.3'
This commit is contained in:
commit
c4764a9b6e
6
acf.php
6
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.2
|
||||
Version: 5.5.3
|
||||
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.2',
|
||||
'version' => '5.5.3',
|
||||
|
||||
// urls
|
||||
'basename' => plugin_basename( __FILE__ ),
|
||||
|
|
@ -203,7 +203,7 @@ class acf {
|
|||
|
||||
|
||||
// set text domain
|
||||
load_textdomain( 'acf', acf_get_path( 'lang/acf-' . get_locale() . '.mo' ) );
|
||||
load_textdomain( 'acf', acf_get_path( 'lang/acf-' . acf_get_locale() . '.mo' ) );
|
||||
|
||||
|
||||
// include wpml support
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ function acf_update_550_termmeta() { //acf_log('acf_update_550_termmeta');
|
|||
// loop
|
||||
foreach( $taxonomies as $taxonomy ) {
|
||||
|
||||
acf_update_550_taxonomy( $taxonomy );
|
||||
acf_update_550_taxonomy( $taxonomy->name );
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -424,54 +424,13 @@ function acf_update_550_termmeta() { //acf_log('acf_update_550_termmeta');
|
|||
|
||||
function acf_update_550_taxonomy( $taxonomy ) { //acf_log('acf_update_550_taxonomy', $taxonomy);
|
||||
|
||||
// vars
|
||||
$terms = get_terms($taxonomy->name, array( 'hide_empty' => false ));
|
||||
|
||||
|
||||
// bail early if no terms
|
||||
if( !$terms ) return;
|
||||
|
||||
|
||||
// loop
|
||||
foreach( $terms as $term ) {
|
||||
|
||||
acf_update_550_term( $term );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// action for 3rd party
|
||||
do_action('acf/update_550_taxonomy', $taxonomy);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_update_550_term
|
||||
*
|
||||
* This function will migrate term meta for a specific term
|
||||
*
|
||||
* @type function
|
||||
* @date 3/09/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $term (object)
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function acf_update_550_term( $term ) { //acf_log('acf_update_550_term', $term);
|
||||
|
||||
// global
|
||||
global $wpdb;
|
||||
|
||||
|
||||
// vars
|
||||
$meta = array();
|
||||
$post_id = $term->taxonomy . '_' . $term->term_id;
|
||||
|
||||
|
||||
// vars
|
||||
$search = $post_id . '_%';
|
||||
$search = $taxonomy . '_%';
|
||||
$_search = '_' . $search;
|
||||
|
||||
|
||||
|
|
@ -482,6 +441,7 @@ function acf_update_550_term( $term ) { //acf_log('acf_update_550_term', $term);
|
|||
|
||||
|
||||
// search
|
||||
// results show faster query times using 2 LIKE vs 2 wildcards
|
||||
$rows = $wpdb->get_results($wpdb->prepare(
|
||||
"SELECT *
|
||||
FROM $wpdb->options
|
||||
|
|
@ -492,61 +452,52 @@ function acf_update_550_term( $term ) { //acf_log('acf_update_550_term', $term);
|
|||
), ARRAY_A);
|
||||
|
||||
|
||||
// bail early if no row
|
||||
// bail early if no rows
|
||||
if( empty($rows) ) return;
|
||||
|
||||
|
||||
// vars
|
||||
$search = $post_id . '_';
|
||||
$search = $taxonomy . '_';
|
||||
$_search = '_' . $search;
|
||||
|
||||
|
||||
// loop
|
||||
foreach( $rows as $row ) {
|
||||
|
||||
// use regex to find (_)taxonomy_(term_id)_(field_name)
|
||||
$matches = null;
|
||||
$regexp = '/^(_?)' . $taxonomy . '_(\d+)_(.+)/';
|
||||
|
||||
|
||||
// bail early if no match
|
||||
if( !preg_match($regexp, $row['option_name'], $matches) ) continue;
|
||||
|
||||
|
||||
/*
|
||||
Array
|
||||
(
|
||||
[0] => category_3_color
|
||||
[1] =>
|
||||
[2] => 3
|
||||
[3] => color
|
||||
)
|
||||
*/
|
||||
|
||||
|
||||
// vars
|
||||
$name = $row['option_name'];
|
||||
$term_id = $matches[2];
|
||||
$name = $matches[1] . $matches[3];
|
||||
$value = $row['option_value'];
|
||||
|
||||
|
||||
// extract $post_id from options name
|
||||
if( strpos($name, $search) === 0 ) {
|
||||
|
||||
$name = substr($name, strlen($search));
|
||||
|
||||
// extract _$post_id from options name
|
||||
} elseif( strpos($name, $_search) === 0 ) {
|
||||
|
||||
$name = '_' . substr($name, strlen($_search));
|
||||
|
||||
// $post_id not found at begining of name (false result)
|
||||
} else {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// append
|
||||
$meta[ $name ] = $row['option_value'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
// bail ealry if no meta
|
||||
if( empty($meta) ) return;
|
||||
|
||||
|
||||
// loop
|
||||
foreach( $meta as $name => $value ) {
|
||||
|
||||
// update
|
||||
update_metadata( 'term', $term->term_id, $name, $value );
|
||||
update_metadata( 'term', $term_id, $name, $value );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// action for 3rd party
|
||||
do_action('acf/update_550_term', $term);
|
||||
do_action('acf/update_550_taxonomy', $taxonomy);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -394,6 +394,10 @@ function _acf_get_field_group_by_id( $post_id = 0 ) {
|
|||
$field_group = maybe_unserialize( $post->post_content );
|
||||
|
||||
|
||||
// new field group does not contain any post_content
|
||||
if( empty($field_group) ) $field_group = array();
|
||||
|
||||
|
||||
// update attributes
|
||||
$field_group['ID'] = $post->ID;
|
||||
$field_group['title'] = $post->post_title;
|
||||
|
|
|
|||
|
|
@ -1021,6 +1021,26 @@ function acf_get_full_version( $version = '1' ) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_locale
|
||||
*
|
||||
* This function is a wrapper for the get_locale() function
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/16
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return (string)
|
||||
*/
|
||||
|
||||
function acf_get_locale() {
|
||||
|
||||
return function_exists('get_user_locale') ? get_user_locale() : get_locale();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_terms
|
||||
*
|
||||
|
|
@ -2925,6 +2945,10 @@ function acf_get_valid_post_id( $post_id = 0 ) {
|
|||
}
|
||||
|
||||
|
||||
// filter for 3rd party
|
||||
$post_id = apply_filters('acf/get_valid_post_id', $post_id);
|
||||
|
||||
|
||||
// return
|
||||
return $post_id;
|
||||
|
||||
|
|
|
|||
|
|
@ -546,29 +546,34 @@
|
|||
var label = $el.find('.field-label:first').val(),
|
||||
name = $el.find('.field-name:first').val(),
|
||||
type = $el.find('.field-type:first option:selected').text(),
|
||||
required = $el.find('.field-required:first').prop('checked');
|
||||
required = $el.find('.field-required:first').prop('checked'),
|
||||
$handle = $el.children('.handle');
|
||||
|
||||
|
||||
// update label
|
||||
$el.find('> .handle .li-field-label strong a').text( label );
|
||||
$handle.find('.li-field-label strong a').text( label );
|
||||
|
||||
|
||||
// update required
|
||||
$el.find('> .handle .li-field-label .acf-required').remove();
|
||||
$handle.find('.li-field-label .acf-required').remove();
|
||||
|
||||
if( required ) {
|
||||
|
||||
$el.find('> .handle .li-field-label strong').append('<span class="acf-required">*</span>');
|
||||
$handle.find('.li-field-label strong').append('<span class="acf-required">*</span>');
|
||||
|
||||
}
|
||||
|
||||
|
||||
// update name
|
||||
$el.find('> .handle .li-field-name').text( name );
|
||||
$handle.find('.li-field-name').text( name );
|
||||
|
||||
|
||||
// update type
|
||||
$el.find('> .handle .li-field-type').text( type );
|
||||
$handle.find('.li-field-type').text( type );
|
||||
|
||||
|
||||
// action for 3rd party customization
|
||||
acf.do_action('render_field_handle', $el, $handle);
|
||||
|
||||
},
|
||||
|
||||
|
|
@ -1436,6 +1441,10 @@
|
|||
|
||||
}
|
||||
|
||||
|
||||
// action for 3rd party customization
|
||||
acf.do_action('change_field_name', $el);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -3320,6 +3320,7 @@ var acf;
|
|||
'change #parent_id': '_change_parent',
|
||||
'change #post-formats-select input': '_change_format',
|
||||
'change .categorychecklist input': '_change_term',
|
||||
'change .categorychecklist select': '_change_term',
|
||||
'change .acf-taxonomy-field[data-save="1"] input': '_change_term',
|
||||
'change .acf-taxonomy-field[data-save="1"] select': '_change_term'
|
||||
},
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -267,21 +267,22 @@ class acf_input {
|
|||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
acf = acf || {};
|
||||
var acf = acf || null;
|
||||
if( acf ) {
|
||||
|
||||
acf.o = <?php echo json_encode($o); ?>;
|
||||
acf.l10n = <?php echo json_encode($l10n); ?>;
|
||||
<?php do_action('acf/input/admin_footer_js'); ?>
|
||||
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
||||
|
||||
// action
|
||||
do_action('acf/input/admin_footer');
|
||||
|
||||
do_action('acf/input/admin_footer');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
acf.do_action('prepare');
|
||||
if( acf ) acf.do_action('prepare');
|
||||
</script>
|
||||
<?php
|
||||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ class acf_media {
|
|||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
acf.media.mime_types = <?php echo json_encode( get_allowed_mime_types() ); ?>;
|
||||
if( acf ) acf.media.mime_types = <?php echo json_encode( get_allowed_mime_types() ); ?>;
|
||||
</script>
|
||||
<?php
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ class acf_wpml_compatibility {
|
|||
$this->lang = ICL_LANGUAGE_CODE;
|
||||
|
||||
|
||||
// check for custom lang
|
||||
if( isset($_POST['_acflang']) ) $this->lang = $_POST['_acflang'];
|
||||
|
||||
|
||||
// update settings
|
||||
acf_update_setting('default_language', $sitepress->get_default_language());
|
||||
acf_update_setting('current_language', $this->lang);
|
||||
|
|
@ -47,6 +51,7 @@ class acf_wpml_compatibility {
|
|||
add_action('acf/update_500_field_group', array($this, 'update_500_field_group'), 10, 2);
|
||||
add_action('acf/update_field_group', array($this, 'update_field_group'), 2, 1);
|
||||
add_action('icl_make_duplicate', array($this, 'icl_make_duplicate'), 10, 4);
|
||||
add_action('acf/input/form_data', array($this, 'acf_input_form_data'), 10, 1);
|
||||
|
||||
|
||||
// filters
|
||||
|
|
@ -447,6 +452,31 @@ class acf_wpml_compatibility {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_input_form_data
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/16
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function acf_input_form_data( $data ) {
|
||||
|
||||
// bail early if not options
|
||||
if( $data['nonce'] !== 'options' ) return;
|
||||
|
||||
|
||||
// add hidden input
|
||||
acf_hidden_input(array('name' => '_acflang', 'value' => $this->lang));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new acf_wpml_compatibility();
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ class acf_field_google_map extends acf_field {
|
|||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
acf.fields.google_map.url = '<?php echo $url; ?>';
|
||||
if( acf ) acf.fields.google_map.url = '<?php echo $url; ?>';
|
||||
</script>
|
||||
<?php
|
||||
|
||||
|
|
|
|||
|
|
@ -48,10 +48,6 @@ class acf_field_wysiwyg extends acf_field {
|
|||
$this->add_filters();
|
||||
|
||||
|
||||
// actions
|
||||
add_action('acf/input/admin_footer', array($this, 'input_admin_footer'));
|
||||
|
||||
|
||||
// do not delete!
|
||||
parent::__construct();
|
||||
|
||||
|
|
@ -255,7 +251,7 @@ class acf_field_wysiwyg extends acf_field {
|
|||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
acf.fields.wysiwyg.toolbars = <?php echo json_encode($json); ?>;
|
||||
if( acf ) acf.fields.wysiwyg.toolbars = <?php echo json_encode($json); ?>;
|
||||
</script>
|
||||
<?php
|
||||
|
||||
|
|
|
|||
|
|
@ -136,8 +136,8 @@ class acf_pro {
|
|||
|
||||
|
||||
// register scripts
|
||||
wp_register_script( 'acf-pro-input', acf_get_dir( "pro/assets/js/acf-pro-input{$min}.js" ), false, acf_get_setting('version') );
|
||||
wp_register_script( 'acf-pro-field-group', acf_get_dir( "pro/assets/js/acf-pro-field-group{$min}.js" ), false, acf_get_setting('version') );
|
||||
wp_register_script( 'acf-pro-input', acf_get_dir( "pro/assets/js/acf-pro-input{$min}.js" ), array('acf-input'), acf_get_setting('version') );
|
||||
wp_register_script( 'acf-pro-field-group', acf_get_dir( "pro/assets/js/acf-pro-field-group{$min}.js" ), array('acf-field-group'), acf_get_setting('version') );
|
||||
|
||||
|
||||
// register styles
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ class acf_pro_options_page {
|
|||
* @date 24/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
function rule_match( $match, $rule, $options ) {
|
||||
|
|
@ -155,8 +155,8 @@ class acf_pro_options_page {
|
|||
* @date 24/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
function admin_menu() {
|
||||
|
|
@ -214,22 +214,22 @@ class acf_pro_options_page {
|
|||
$this->page = acf_get_options_page($plugin_page);
|
||||
|
||||
|
||||
// get post_id (allow lang modification)
|
||||
$this->page['post_id'] = acf_get_valid_post_id($this->page['post_id']);
|
||||
|
||||
|
||||
// verify and remove nonce
|
||||
if( acf_verify_nonce('options') ) {
|
||||
|
||||
// save data
|
||||
if( acf_validate_save_post(true) ) {
|
||||
|
||||
// get post_id (allow lang modification)
|
||||
$post_id = acf_get_valid_post_id($this->page['post_id']);
|
||||
|
||||
|
||||
// set autoload
|
||||
acf_update_setting('autoload', $this->page['autoload']);
|
||||
|
||||
|
||||
// save
|
||||
acf_save_post( $post_id );
|
||||
acf_save_post( $this->page['post_id'] );
|
||||
|
||||
|
||||
// redirect
|
||||
|
|
@ -265,8 +265,8 @@ class acf_pro_options_page {
|
|||
* @date 23/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
function admin_enqueue_scripts() {
|
||||
|
|
@ -364,8 +364,8 @@ class acf_pro_options_page {
|
|||
* @date 23/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function postbox_submitdiv( $post, $args ) {
|
||||
|
|
@ -395,8 +395,9 @@ class acf_pro_options_page {
|
|||
* @date 24/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param $post (object)
|
||||
* @param $args (array)
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function postbox_acf( $post, $args ) {
|
||||
|
|
@ -418,11 +419,6 @@ class acf_pro_options_page {
|
|||
);
|
||||
|
||||
|
||||
// get post_id (allow lang modification)
|
||||
$post_id = acf_get_valid_post_id($this->page['post_id']);
|
||||
|
||||
|
||||
|
||||
// edit_url
|
||||
if( $field_group['ID'] && acf_current_user_can_admin() ) {
|
||||
|
||||
|
|
@ -436,7 +432,7 @@ class acf_pro_options_page {
|
|||
|
||||
|
||||
// render
|
||||
acf_render_fields( $post_id, $fields, 'div', $field_group['instruction_placement'] );
|
||||
acf_render_fields( $this->page['post_id'], $fields, 'div', $field_group['instruction_placement'] );
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ extract($args);
|
|||
|
||||
// render post data
|
||||
acf_form_data(array(
|
||||
'post_id' => 'options',
|
||||
'post_id' => $page['post_id'],
|
||||
'nonce' => 'options',
|
||||
));
|
||||
|
||||
|
|
|
|||
1384
readme.txt
1384
readme.txt
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue