Merge branch 'release/5.8.4' into develop
This commit is contained in:
commit
9e16f47281
600
acf.php
600
acf.php
|
|
@ -3,7 +3,7 @@
|
||||||
Plugin Name: Advanced Custom Fields PRO
|
Plugin Name: Advanced Custom Fields PRO
|
||||||
Plugin URI: https://www.advancedcustomfields.com
|
Plugin URI: https://www.advancedcustomfields.com
|
||||||
Description: Customize WordPress with powerful, professional and intuitive fields.
|
Description: Customize WordPress with powerful, professional and intuitive fields.
|
||||||
Version: 5.8.3
|
Version: 5.8.4
|
||||||
Author: Elliot Condon
|
Author: Elliot Condon
|
||||||
Author URI: https://www.advancedcustomfields.com
|
Author URI: https://www.advancedcustomfields.com
|
||||||
Text Domain: acf
|
Text Domain: acf
|
||||||
|
|
@ -16,77 +16,62 @@ if( ! class_exists('ACF') ) :
|
||||||
|
|
||||||
class ACF {
|
class ACF {
|
||||||
|
|
||||||
/** @var string The plugin version number */
|
/** @var string The plugin version number. */
|
||||||
var $version = '5.8.3';
|
var $version = '5.8.4';
|
||||||
|
|
||||||
/** @var array The plugin settings array */
|
/** @var array The plugin settings array. */
|
||||||
var $settings = array();
|
var $settings = array();
|
||||||
|
|
||||||
/** @var array The plugin data array */
|
/** @var array The plugin data array. */
|
||||||
var $data = array();
|
var $data = array();
|
||||||
|
|
||||||
/** @var array Storage for class instances */
|
/** @var array Storage for class instances. */
|
||||||
var $instances = array();
|
var $instances = array();
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
* __construct
|
||||||
* __construct
|
*
|
||||||
*
|
* A dummy constructor to ensure ACF is only setup once.
|
||||||
* A dummy constructor to ensure ACF is only initialized once
|
*
|
||||||
*
|
* @date 23/06/12
|
||||||
* @type function
|
* @since 5.0.0
|
||||||
* @date 23/06/12
|
*
|
||||||
* @since 5.0.0
|
* @param void
|
||||||
*
|
* @return void
|
||||||
* @param N/A
|
*/
|
||||||
* @return N/A
|
|
||||||
*/
|
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
|
// Do nothing.
|
||||||
/* Do nothing here */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
* initialize
|
||||||
* initialize
|
*
|
||||||
*
|
* Sets up the ACF plugin.
|
||||||
* The real constructor to initialize ACF
|
*
|
||||||
*
|
* @date 28/09/13
|
||||||
* @type function
|
* @since 5.0.0
|
||||||
* @date 28/09/13
|
*
|
||||||
* @since 5.0.0
|
* @param void
|
||||||
*
|
* @return void
|
||||||
* @param $post_id (int)
|
*/
|
||||||
* @return $post_id (int)
|
|
||||||
*/
|
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
|
|
||||||
// vars
|
// Define constants.
|
||||||
$version = $this->version;
|
$this->define( 'ACF', true );
|
||||||
$basename = plugin_basename( __FILE__ );
|
$this->define( 'ACF_PATH', plugin_dir_path( __FILE__ ) );
|
||||||
$path = plugin_dir_path( __FILE__ );
|
$this->define( 'ACF_BASENAME', plugin_basename( __FILE__ ) );
|
||||||
$url = plugin_dir_url( __FILE__ );
|
$this->define( 'ACF_VERSION', $this->version );
|
||||||
$slug = dirname($basename);
|
$this->define( 'ACF_MAJOR_VERSION', 5 );
|
||||||
|
|
||||||
|
// Define settings.
|
||||||
// settings
|
|
||||||
$this->settings = array(
|
$this->settings = array(
|
||||||
|
'name' => __('Advanced Custom Fields', 'acf'),
|
||||||
// basic
|
'slug' => dirname( ACF_BASENAME ),
|
||||||
'name' => __('Advanced Custom Fields', 'acf'),
|
'version' => ACF_VERSION,
|
||||||
'version' => $version,
|
'basename' => ACF_BASENAME,
|
||||||
|
'path' => ACF_PATH,
|
||||||
// urls
|
'file' => __FILE__,
|
||||||
'file' => __FILE__,
|
'url' => plugin_dir_url( __FILE__ ),
|
||||||
'basename' => $basename,
|
|
||||||
'path' => $path,
|
|
||||||
'url' => $url,
|
|
||||||
'slug' => $slug,
|
|
||||||
|
|
||||||
// options
|
|
||||||
'show_admin' => true,
|
'show_admin' => true,
|
||||||
'show_updates' => true,
|
'show_updates' => true,
|
||||||
'stripslashes' => false,
|
'stripslashes' => false,
|
||||||
|
|
@ -112,12 +97,6 @@ class ACF {
|
||||||
'remove_wp_meta_box' => true
|
'remove_wp_meta_box' => true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// constants
|
|
||||||
$this->define( 'ACF', true );
|
|
||||||
$this->define( 'ACF_VERSION', $version );
|
|
||||||
$this->define( 'ACF_PATH', $path );
|
|
||||||
|
|
||||||
// Include utility functions.
|
// Include utility functions.
|
||||||
include_once( ACF_PATH . 'includes/acf-utility-functions.php');
|
include_once( ACF_PATH . 'includes/acf-utility-functions.php');
|
||||||
|
|
||||||
|
|
@ -128,6 +107,8 @@ class ACF {
|
||||||
|
|
||||||
// Include classes.
|
// Include classes.
|
||||||
acf_include('includes/class-acf-data.php');
|
acf_include('includes/class-acf-data.php');
|
||||||
|
acf_include('includes/fields/class-acf-field.php');
|
||||||
|
acf_include('includes/locations/class-acf-location.php');
|
||||||
|
|
||||||
// Include functions.
|
// Include functions.
|
||||||
acf_include('includes/acf-helper-functions.php');
|
acf_include('includes/acf-helper-functions.php');
|
||||||
|
|
@ -141,17 +122,9 @@ class ACF {
|
||||||
acf_include('includes/acf-value-functions.php');
|
acf_include('includes/acf-value-functions.php');
|
||||||
acf_include('includes/acf-input-functions.php');
|
acf_include('includes/acf-input-functions.php');
|
||||||
|
|
||||||
// fields
|
// Include core.
|
||||||
acf_include('includes/fields.php');
|
acf_include('includes/fields.php');
|
||||||
acf_include('includes/fields/class-acf-field.php');
|
|
||||||
|
|
||||||
|
|
||||||
// locations
|
|
||||||
acf_include('includes/locations.php');
|
acf_include('includes/locations.php');
|
||||||
acf_include('includes/locations/class-acf-location.php');
|
|
||||||
|
|
||||||
|
|
||||||
// core
|
|
||||||
acf_include('includes/assets.php');
|
acf_include('includes/assets.php');
|
||||||
acf_include('includes/compatibility.php');
|
acf_include('includes/compatibility.php');
|
||||||
acf_include('includes/deprecated.php');
|
acf_include('includes/deprecated.php');
|
||||||
|
|
@ -166,13 +139,13 @@ class ACF {
|
||||||
acf_include('includes/upgrades.php');
|
acf_include('includes/upgrades.php');
|
||||||
acf_include('includes/validation.php');
|
acf_include('includes/validation.php');
|
||||||
|
|
||||||
// ajax
|
// Include ajax.
|
||||||
acf_include('includes/ajax/class-acf-ajax.php');
|
acf_include('includes/ajax/class-acf-ajax.php');
|
||||||
acf_include('includes/ajax/class-acf-ajax-check-screen.php');
|
acf_include('includes/ajax/class-acf-ajax-check-screen.php');
|
||||||
acf_include('includes/ajax/class-acf-ajax-user-setting.php');
|
acf_include('includes/ajax/class-acf-ajax-user-setting.php');
|
||||||
acf_include('includes/ajax/class-acf-ajax-upgrade.php');
|
acf_include('includes/ajax/class-acf-ajax-upgrade.php');
|
||||||
|
|
||||||
// forms
|
// Include forms.
|
||||||
acf_include('includes/forms/form-attachment.php');
|
acf_include('includes/forms/form-attachment.php');
|
||||||
acf_include('includes/forms/form-comment.php');
|
acf_include('includes/forms/form-comment.php');
|
||||||
acf_include('includes/forms/form-customizer.php');
|
acf_include('includes/forms/form-customizer.php');
|
||||||
|
|
@ -184,8 +157,7 @@ class ACF {
|
||||||
acf_include('includes/forms/form-user.php');
|
acf_include('includes/forms/form-user.php');
|
||||||
acf_include('includes/forms/form-widget.php');
|
acf_include('includes/forms/form-widget.php');
|
||||||
|
|
||||||
|
// Include admin.
|
||||||
// admin
|
|
||||||
if( is_admin() ) {
|
if( is_admin() ) {
|
||||||
acf_include('includes/admin/admin.php');
|
acf_include('includes/admin/admin.php');
|
||||||
acf_include('includes/admin/admin-field-group.php');
|
acf_include('includes/admin/admin-field-group.php');
|
||||||
|
|
@ -196,8 +168,7 @@ class ACF {
|
||||||
acf_include('includes/admin/settings-info.php');
|
acf_include('includes/admin/settings-info.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Include PRO.
|
||||||
// pro
|
|
||||||
acf_include('pro/acf-pro.php');
|
acf_include('pro/acf-pro.php');
|
||||||
|
|
||||||
// Include tests.
|
// Include tests.
|
||||||
|
|
@ -205,63 +176,53 @@ class ACF {
|
||||||
acf_include('tests/tests.php');
|
acf_include('tests/tests.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
// actions
|
// Add actions.
|
||||||
add_action('init', array($this, 'init'), 5);
|
add_action( 'init', array($this, 'init'), 5 );
|
||||||
add_action('init', array($this, 'register_post_types'), 5);
|
add_action( 'init', array($this, 'register_post_types'), 5 );
|
||||||
add_action('init', array($this, 'register_post_status'), 5);
|
add_action( 'init', array($this, 'register_post_status'), 5 );
|
||||||
|
|
||||||
|
// Add filters.
|
||||||
// filters
|
add_filter( 'posts_where', array($this, 'posts_where'), 10, 2 );
|
||||||
add_filter('posts_where', array($this, 'posts_where'), 10, 2 );
|
|
||||||
//add_filter('posts_request', array($this, 'posts_request'), 10, 1 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
* init
|
||||||
* init
|
*
|
||||||
*
|
* Completes the setup process on "init" of earlier.
|
||||||
* This function will run after all plugins and theme functions have been included
|
*
|
||||||
*
|
* @date 28/09/13
|
||||||
* @type action (init)
|
* @since 5.0.0
|
||||||
* @date 28/09/13
|
*
|
||||||
* @since 5.0.0
|
* @param void
|
||||||
*
|
* @return void
|
||||||
* @param N/A
|
*/
|
||||||
* @return N/A
|
|
||||||
*/
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
||||||
// bail early if too early
|
// Bail early if called directly from functions.php or plugin file.
|
||||||
// ensures all plugins have a chance to add fields, etc
|
if( !did_action('plugins_loaded') ) {
|
||||||
if( !did_action('plugins_loaded') ) return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function may be called directly from template functions. Bail early if already did this.
|
||||||
|
if( acf_did('init') ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// bail early if already init
|
// Update url setting. Allows other plugins to modify the URL (force SSL).
|
||||||
if( acf_has_done('init') ) return;
|
acf_update_setting( 'url', plugin_dir_url( __FILE__ ) );
|
||||||
|
|
||||||
|
// Load textdomain file.
|
||||||
// vars
|
|
||||||
$major = intval( acf_get_setting('version') );
|
|
||||||
|
|
||||||
|
|
||||||
// update url
|
|
||||||
// - allow another plugin to modify dir (maybe force SSL)
|
|
||||||
acf_update_setting('url', plugin_dir_url( __FILE__ ));
|
|
||||||
|
|
||||||
|
|
||||||
// textdomain
|
|
||||||
acf_load_textdomain();
|
acf_load_textdomain();
|
||||||
|
|
||||||
// include 3rd party support
|
// Include 3rd party compatiblity.
|
||||||
acf_include('includes/third-party.php');
|
acf_include('includes/third-party.php');
|
||||||
|
|
||||||
// include wpml support
|
// Include wpml support.
|
||||||
if( defined('ICL_SITEPRESS_VERSION') ) {
|
if( defined('ICL_SITEPRESS_VERSION') ) {
|
||||||
acf_include('includes/wpml.php');
|
acf_include('includes/wpml.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
// fields
|
// Include fields.
|
||||||
acf_include('includes/fields/class-acf-field-text.php');
|
acf_include('includes/fields/class-acf-field-text.php');
|
||||||
acf_include('includes/fields/class-acf-field-textarea.php');
|
acf_include('includes/fields/class-acf-field-textarea.php');
|
||||||
acf_include('includes/fields/class-acf-field-number.php');
|
acf_include('includes/fields/class-acf-field-number.php');
|
||||||
|
|
@ -269,39 +230,42 @@ class ACF {
|
||||||
acf_include('includes/fields/class-acf-field-email.php');
|
acf_include('includes/fields/class-acf-field-email.php');
|
||||||
acf_include('includes/fields/class-acf-field-url.php');
|
acf_include('includes/fields/class-acf-field-url.php');
|
||||||
acf_include('includes/fields/class-acf-field-password.php');
|
acf_include('includes/fields/class-acf-field-password.php');
|
||||||
|
|
||||||
acf_include('includes/fields/class-acf-field-image.php');
|
acf_include('includes/fields/class-acf-field-image.php');
|
||||||
acf_include('includes/fields/class-acf-field-file.php');
|
acf_include('includes/fields/class-acf-field-file.php');
|
||||||
acf_include('includes/fields/class-acf-field-wysiwyg.php');
|
acf_include('includes/fields/class-acf-field-wysiwyg.php');
|
||||||
acf_include('includes/fields/class-acf-field-oembed.php');
|
acf_include('includes/fields/class-acf-field-oembed.php');
|
||||||
|
|
||||||
acf_include('includes/fields/class-acf-field-select.php');
|
acf_include('includes/fields/class-acf-field-select.php');
|
||||||
acf_include('includes/fields/class-acf-field-checkbox.php');
|
acf_include('includes/fields/class-acf-field-checkbox.php');
|
||||||
acf_include('includes/fields/class-acf-field-radio.php');
|
acf_include('includes/fields/class-acf-field-radio.php');
|
||||||
acf_include('includes/fields/class-acf-field-button-group.php');
|
acf_include('includes/fields/class-acf-field-button-group.php');
|
||||||
acf_include('includes/fields/class-acf-field-true_false.php');
|
acf_include('includes/fields/class-acf-field-true_false.php');
|
||||||
|
|
||||||
acf_include('includes/fields/class-acf-field-link.php');
|
acf_include('includes/fields/class-acf-field-link.php');
|
||||||
acf_include('includes/fields/class-acf-field-post_object.php');
|
acf_include('includes/fields/class-acf-field-post_object.php');
|
||||||
acf_include('includes/fields/class-acf-field-page_link.php');
|
acf_include('includes/fields/class-acf-field-page_link.php');
|
||||||
acf_include('includes/fields/class-acf-field-relationship.php');
|
acf_include('includes/fields/class-acf-field-relationship.php');
|
||||||
acf_include('includes/fields/class-acf-field-taxonomy.php');
|
acf_include('includes/fields/class-acf-field-taxonomy.php');
|
||||||
acf_include('includes/fields/class-acf-field-user.php');
|
acf_include('includes/fields/class-acf-field-user.php');
|
||||||
|
|
||||||
acf_include('includes/fields/class-acf-field-google-map.php');
|
acf_include('includes/fields/class-acf-field-google-map.php');
|
||||||
acf_include('includes/fields/class-acf-field-date_picker.php');
|
acf_include('includes/fields/class-acf-field-date_picker.php');
|
||||||
acf_include('includes/fields/class-acf-field-date_time_picker.php');
|
acf_include('includes/fields/class-acf-field-date_time_picker.php');
|
||||||
acf_include('includes/fields/class-acf-field-time_picker.php');
|
acf_include('includes/fields/class-acf-field-time_picker.php');
|
||||||
acf_include('includes/fields/class-acf-field-color_picker.php');
|
acf_include('includes/fields/class-acf-field-color_picker.php');
|
||||||
|
|
||||||
acf_include('includes/fields/class-acf-field-message.php');
|
acf_include('includes/fields/class-acf-field-message.php');
|
||||||
acf_include('includes/fields/class-acf-field-accordion.php');
|
acf_include('includes/fields/class-acf-field-accordion.php');
|
||||||
acf_include('includes/fields/class-acf-field-tab.php');
|
acf_include('includes/fields/class-acf-field-tab.php');
|
||||||
acf_include('includes/fields/class-acf-field-group.php');
|
acf_include('includes/fields/class-acf-field-group.php');
|
||||||
do_action('acf/include_field_types', $major);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires after field types have been included.
|
||||||
|
*
|
||||||
|
* @date 28/09/13
|
||||||
|
* @since 5.0.0
|
||||||
|
*
|
||||||
|
* @param int $major_version The major version of ACF.
|
||||||
|
*/
|
||||||
|
do_action( 'acf/include_field_types', ACF_MAJOR_VERSION );
|
||||||
|
|
||||||
// locations
|
// Include locations.
|
||||||
acf_include('includes/locations/class-acf-location-post-type.php');
|
acf_include('includes/locations/class-acf-location-post-type.php');
|
||||||
acf_include('includes/locations/class-acf-location-post-template.php');
|
acf_include('includes/locations/class-acf-location-post-template.php');
|
||||||
acf_include('includes/locations/class-acf-location-post-status.php');
|
acf_include('includes/locations/class-acf-location-post-status.php');
|
||||||
|
|
@ -323,38 +287,55 @@ class ACF {
|
||||||
acf_include('includes/locations/class-acf-location-widget.php');
|
acf_include('includes/locations/class-acf-location-widget.php');
|
||||||
acf_include('includes/locations/class-acf-location-nav-menu.php');
|
acf_include('includes/locations/class-acf-location-nav-menu.php');
|
||||||
acf_include('includes/locations/class-acf-location-nav-menu-item.php');
|
acf_include('includes/locations/class-acf-location-nav-menu-item.php');
|
||||||
do_action('acf/include_location_rules', $major);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires after location types have been included.
|
||||||
|
*
|
||||||
|
* @date 28/09/13
|
||||||
|
* @since 5.0.0
|
||||||
|
*
|
||||||
|
* @param int $major_version The major version of ACF.
|
||||||
|
*/
|
||||||
|
do_action( 'acf/include_location_rules', ACF_MAJOR_VERSION );
|
||||||
|
|
||||||
// local fields
|
/**
|
||||||
do_action('acf/include_fields', $major);
|
* Fires during initialization. Used to add local fields.
|
||||||
|
*
|
||||||
|
* @date 28/09/13
|
||||||
|
* @since 5.0.0
|
||||||
|
*
|
||||||
|
* @param int $major_version The major version of ACF.
|
||||||
|
*/
|
||||||
|
do_action( 'acf/include_fields', ACF_MAJOR_VERSION );
|
||||||
|
|
||||||
|
/**
|
||||||
// action for 3rd party
|
* Fires after ACF is completely "initialized".
|
||||||
do_action('acf/init');
|
*
|
||||||
|
* @date 28/09/13
|
||||||
|
* @since 5.0.0
|
||||||
|
*
|
||||||
|
* @param int $major_version The major version of ACF.
|
||||||
|
*/
|
||||||
|
do_action( 'acf/init', ACF_MAJOR_VERSION );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
* register_post_types
|
||||||
* register_post_types
|
*
|
||||||
*
|
* Registers the ACF post types.
|
||||||
* This function will register post types and statuses
|
*
|
||||||
*
|
* @date 22/10/2015
|
||||||
* @type function
|
* @since 5.3.2
|
||||||
* @date 22/10/2015
|
*
|
||||||
* @since 5.3.2
|
* @param void
|
||||||
*
|
* @return void
|
||||||
* @param n/a
|
*/
|
||||||
* @return n/a
|
|
||||||
*/
|
|
||||||
|
|
||||||
function register_post_types() {
|
function register_post_types() {
|
||||||
|
|
||||||
// vars
|
// Vars.
|
||||||
$cap = acf_get_setting('capability');
|
$cap = acf_get_setting('capability');
|
||||||
|
|
||||||
|
// Register the Field Group post type.
|
||||||
// register post type 'acf-field-group'
|
|
||||||
register_post_type('acf-field-group', array(
|
register_post_type('acf-field-group', array(
|
||||||
'labels' => array(
|
'labels' => array(
|
||||||
'name' => __( 'Field Groups', 'acf' ),
|
'name' => __( 'Field Groups', 'acf' ),
|
||||||
|
|
@ -369,7 +350,9 @@ class ACF {
|
||||||
'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ),
|
'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ),
|
||||||
),
|
),
|
||||||
'public' => false,
|
'public' => false,
|
||||||
|
'hierarchical' => true,
|
||||||
'show_ui' => true,
|
'show_ui' => true,
|
||||||
|
'show_in_menu' => false,
|
||||||
'_builtin' => false,
|
'_builtin' => false,
|
||||||
'capability_type' => 'post',
|
'capability_type' => 'post',
|
||||||
'capabilities' => array(
|
'capabilities' => array(
|
||||||
|
|
@ -378,15 +361,13 @@ class ACF {
|
||||||
'edit_posts' => $cap,
|
'edit_posts' => $cap,
|
||||||
'delete_posts' => $cap,
|
'delete_posts' => $cap,
|
||||||
),
|
),
|
||||||
'hierarchical' => true,
|
'supports' => array('title'),
|
||||||
'rewrite' => false,
|
'rewrite' => false,
|
||||||
'query_var' => false,
|
'query_var' => false,
|
||||||
'supports' => array('title'),
|
|
||||||
'show_in_menu' => false,
|
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
// register post type 'acf-field'
|
// Register the Field post type.
|
||||||
register_post_type('acf-field', array(
|
register_post_type('acf-field', array(
|
||||||
'labels' => array(
|
'labels' => array(
|
||||||
'name' => __( 'Fields', 'acf' ),
|
'name' => __( 'Fields', 'acf' ),
|
||||||
|
|
@ -401,7 +382,9 @@ class ACF {
|
||||||
'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ),
|
'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ),
|
||||||
),
|
),
|
||||||
'public' => false,
|
'public' => false,
|
||||||
|
'hierarchical' => true,
|
||||||
'show_ui' => false,
|
'show_ui' => false,
|
||||||
|
'show_in_menu' => false,
|
||||||
'_builtin' => false,
|
'_builtin' => false,
|
||||||
'capability_type' => 'post',
|
'capability_type' => 'post',
|
||||||
'capabilities' => array(
|
'capabilities' => array(
|
||||||
|
|
@ -410,32 +393,26 @@ class ACF {
|
||||||
'edit_posts' => $cap,
|
'edit_posts' => $cap,
|
||||||
'delete_posts' => $cap,
|
'delete_posts' => $cap,
|
||||||
),
|
),
|
||||||
'hierarchical' => true,
|
'supports' => array('title'),
|
||||||
'rewrite' => false,
|
'rewrite' => false,
|
||||||
'query_var' => false,
|
'query_var' => false,
|
||||||
'supports' => array('title'),
|
|
||||||
'show_in_menu' => false,
|
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
* register_post_status
|
||||||
* register_post_status
|
*
|
||||||
*
|
* Registers the ACF post statuses.
|
||||||
* This function will register custom post statuses
|
*
|
||||||
*
|
* @date 22/10/2015
|
||||||
* @type function
|
* @since 5.3.2
|
||||||
* @date 22/10/2015
|
*
|
||||||
* @since 5.3.2
|
* @param void
|
||||||
*
|
* @return void
|
||||||
* @param $post_id (int)
|
*/
|
||||||
* @return $post_id (int)
|
|
||||||
*/
|
|
||||||
|
|
||||||
function register_post_status() {
|
function register_post_status() {
|
||||||
|
|
||||||
// acf-disabled
|
// Register the Disabled post status.
|
||||||
register_post_status('acf-disabled', array(
|
register_post_status('acf-disabled', array(
|
||||||
'label' => __( 'Inactive', 'acf' ),
|
'label' => __( 'Inactive', 'acf' ),
|
||||||
'public' => true,
|
'public' => true,
|
||||||
|
|
@ -444,237 +421,198 @@ class ACF {
|
||||||
'show_in_admin_status_list' => true,
|
'show_in_admin_status_list' => true,
|
||||||
'label_count' => _n_noop( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', 'acf' ),
|
'label_count' => _n_noop( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', 'acf' ),
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
* posts_where
|
||||||
* posts_where
|
*
|
||||||
*
|
* Filters the $where clause allowing for custom WP_Query args.
|
||||||
* This function will add in some new parameters to the WP_Query args allowing fields to be found via key / name
|
*
|
||||||
*
|
* @date 31/8/19
|
||||||
* @type filter
|
* @since 5.8.1
|
||||||
* @date 5/12/2013
|
*
|
||||||
* @since 5.0.0
|
* @param string $where The WHERE clause.
|
||||||
*
|
* @return WP_Query $wp_query The query object.
|
||||||
* @param $where (string)
|
*/
|
||||||
* @param $wp_query (object)
|
|
||||||
* @return $where (string)
|
|
||||||
*/
|
|
||||||
|
|
||||||
function posts_where( $where, $wp_query ) {
|
function posts_where( $where, $wp_query ) {
|
||||||
|
|
||||||
// global
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
|
// Add custom "acf_field_key" arg.
|
||||||
// acf_field_key
|
|
||||||
if( $field_key = $wp_query->get('acf_field_key') ) {
|
if( $field_key = $wp_query->get('acf_field_key') ) {
|
||||||
$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key );
|
$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key );
|
||||||
}
|
}
|
||||||
|
|
||||||
// acf_field_name
|
// Add custom "acf_field_name" arg.
|
||||||
if( $field_name = $wp_query->get('acf_field_name') ) {
|
if( $field_name = $wp_query->get('acf_field_name') ) {
|
||||||
$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name );
|
$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name );
|
||||||
}
|
}
|
||||||
|
|
||||||
// acf_group_key
|
// Add custom "acf_group_key" arg.
|
||||||
if( $group_key = $wp_query->get('acf_group_key') ) {
|
if( $group_key = $wp_query->get('acf_group_key') ) {
|
||||||
$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key );
|
$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return.
|
||||||
// return
|
|
||||||
return $where;
|
return $where;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* define
|
|
||||||
*
|
|
||||||
* This function will safely define a constant
|
|
||||||
*
|
|
||||||
* @type function
|
|
||||||
* @date 3/5/17
|
|
||||||
* @since 5.5.13
|
|
||||||
*
|
|
||||||
* @param $name (string)
|
|
||||||
* @param $value (mixed)
|
|
||||||
* @return n/a
|
|
||||||
*/
|
|
||||||
|
|
||||||
function define( $name, $value = true ) {
|
|
||||||
|
|
||||||
if( !defined($name) ) {
|
|
||||||
define( $name, $value );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* has_setting
|
* define
|
||||||
*
|
*
|
||||||
* Returns true if has setting.
|
* Defines a constant if doesnt already exist.
|
||||||
*
|
*
|
||||||
* @date 2/2/18
|
* @date 3/5/17
|
||||||
* @since 5.6.5
|
* @since 5.5.13
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name The constant name.
|
||||||
* @return boolean
|
* @param mixed $value The constant value.
|
||||||
*/
|
* @return void
|
||||||
|
*/
|
||||||
|
function define( $name, $value = true ) {
|
||||||
|
if( !defined($name) ) {
|
||||||
|
define( $name, $value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* has_setting
|
||||||
|
*
|
||||||
|
* Returns true if a setting exists for this name.
|
||||||
|
*
|
||||||
|
* @date 2/2/18
|
||||||
|
* @since 5.6.5
|
||||||
|
*
|
||||||
|
* @param string $name The setting name.
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
function has_setting( $name ) {
|
function has_setting( $name ) {
|
||||||
return isset($this->settings[ $name ]);
|
return isset($this->settings[ $name ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_setting
|
* get_setting
|
||||||
*
|
*
|
||||||
* Returns a setting.
|
* Returns a setting or null if doesn't exist.
|
||||||
*
|
*
|
||||||
* @date 28/09/13
|
* @date 28/09/13
|
||||||
* @since 5.0.0
|
* @since 5.0.0
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name The setting name.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function get_setting( $name ) {
|
function get_setting( $name ) {
|
||||||
return isset($this->settings[ $name ]) ? $this->settings[ $name ] : null;
|
return isset($this->settings[ $name ]) ? $this->settings[ $name ] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update_setting
|
* update_setting
|
||||||
*
|
*
|
||||||
* Updates a setting.
|
* Updates a setting for the given name and value.
|
||||||
*
|
*
|
||||||
* @date 28/09/13
|
* @date 28/09/13
|
||||||
* @since 5.0.0
|
* @since 5.0.0
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name The setting name.
|
||||||
* @param mixed $value
|
* @param mixed $value The setting value.
|
||||||
* @return n/a
|
* @return true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function update_setting( $name, $value ) {
|
function update_setting( $name, $value ) {
|
||||||
$this->settings[ $name ] = $value;
|
$this->settings[ $name ] = $value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_data
|
* get_data
|
||||||
*
|
*
|
||||||
* Returns data.
|
* Returns data or null if doesn't exist.
|
||||||
*
|
*
|
||||||
* @date 28/09/13
|
* @date 28/09/13
|
||||||
* @since 5.0.0
|
* @since 5.0.0
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name The data name.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function get_data( $name ) {
|
function get_data( $name ) {
|
||||||
return isset($this->data[ $name ]) ? $this->data[ $name ] : null;
|
return isset($this->data[ $name ]) ? $this->data[ $name ] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set_data
|
* set_data
|
||||||
*
|
*
|
||||||
* Sets data.
|
* Sets data for the given name and value.
|
||||||
*
|
*
|
||||||
* @date 28/09/13
|
* @date 28/09/13
|
||||||
* @since 5.0.0
|
* @since 5.0.0
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name The data name.
|
||||||
* @param mixed $value
|
* @param mixed $value The data value.
|
||||||
* @return n/a
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function set_data( $name, $value ) {
|
function set_data( $name, $value ) {
|
||||||
$this->data[ $name ] = $value;
|
$this->data[ $name ] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_instance
|
* get_instance
|
||||||
*
|
*
|
||||||
* Returns an instance.
|
* Returns an instance or null if doesn't exist.
|
||||||
*
|
*
|
||||||
* @date 13/2/18
|
* @date 13/2/18
|
||||||
* @since 5.6.9
|
* @since 5.6.9
|
||||||
*
|
*
|
||||||
* @param string $class The instance class name.
|
* @param string $class The instance class name.
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function get_instance( $class ) {
|
function get_instance( $class ) {
|
||||||
$name = strtolower($class);
|
$name = strtolower($class);
|
||||||
return isset($this->instances[ $name ]) ? $this->instances[ $name ] : null;
|
return isset($this->instances[ $name ]) ? $this->instances[ $name ] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new_instance
|
* new_instance
|
||||||
*
|
*
|
||||||
* Creates and stores an instance.
|
* Creates and stores an instance of the given class.
|
||||||
*
|
*
|
||||||
* @date 13/2/18
|
* @date 13/2/18
|
||||||
* @since 5.6.9
|
* @since 5.6.9
|
||||||
*
|
*
|
||||||
* @param string $class The instance class name.
|
* @param string $class The instance class name.
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function new_instance( $class ) {
|
function new_instance( $class ) {
|
||||||
$instance = new $class();
|
$instance = new $class();
|
||||||
$name = strtolower($class);
|
$name = strtolower($class);
|
||||||
$this->instances[ $name ] = $instance;
|
$this->instances[ $name ] = $instance;
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* acf
|
* acf
|
||||||
*
|
*
|
||||||
* The main function responsible for returning the one true acf Instance to functions everywhere.
|
* The main function responsible for returning the one true acf Instance to functions everywhere.
|
||||||
* Use this function like you would a global variable, except without needing to declare the global.
|
* Use this function like you would a global variable, except without needing to declare the global.
|
||||||
*
|
*
|
||||||
* Example: <?php $acf = acf(); ?>
|
* Example: <?php $acf = acf(); ?>
|
||||||
*
|
*
|
||||||
* @type function
|
* @date 4/09/13
|
||||||
* @date 4/09/13
|
* @since 4.3.0
|
||||||
* @since 4.3.0
|
*
|
||||||
*
|
* @param void
|
||||||
* @param N/A
|
* @return ACF
|
||||||
* @return (object)
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
function acf() {
|
function acf() {
|
||||||
|
|
||||||
// globals
|
|
||||||
global $acf;
|
global $acf;
|
||||||
|
|
||||||
|
// Instantiate only once.
|
||||||
// initialize
|
|
||||||
if( !isset($acf) ) {
|
if( !isset($acf) ) {
|
||||||
$acf = new ACF();
|
$acf = new ACF();
|
||||||
$acf->initialize();
|
$acf->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// return
|
|
||||||
return $acf;
|
return $acf;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Instantiate.
|
||||||
// initialize
|
|
||||||
acf();
|
acf();
|
||||||
|
|
||||||
|
|
||||||
endif; // class_exists check
|
endif; // class_exists check
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -2103,6 +2103,168 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* acf.debounce
|
||||||
|
*
|
||||||
|
* Returns a debounced version of the passed function which will postpone its execution until after `wait` milliseconds have elapsed since the last time it was invoked.
|
||||||
|
*
|
||||||
|
* @date 28/8/19
|
||||||
|
* @since 5.8.1
|
||||||
|
*
|
||||||
|
* @param function callback The callback function.
|
||||||
|
* @return int wait The number of milliseconds to wait.
|
||||||
|
*/
|
||||||
|
acf.debounce = function( callback, wait ){
|
||||||
|
var timeout;
|
||||||
|
return function(){
|
||||||
|
var context = this;
|
||||||
|
var args = arguments;
|
||||||
|
var later = function(){
|
||||||
|
callback.apply( context, args );
|
||||||
|
};
|
||||||
|
clearTimeout( timeout );
|
||||||
|
timeout = setTimeout( later, wait );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* acf.throttle
|
||||||
|
*
|
||||||
|
* Returns a throttled version of the passed function which will allow only one execution per `limit` time period.
|
||||||
|
*
|
||||||
|
* @date 28/8/19
|
||||||
|
* @since 5.8.1
|
||||||
|
*
|
||||||
|
* @param function callback The callback function.
|
||||||
|
* @return int wait The number of milliseconds to wait.
|
||||||
|
*/
|
||||||
|
acf.throttle = function( callback, limit ){
|
||||||
|
var busy = false;
|
||||||
|
return function(){
|
||||||
|
if( busy ) return;
|
||||||
|
busy = true;
|
||||||
|
setTimeout(function(){
|
||||||
|
busy = false;
|
||||||
|
}, limit);
|
||||||
|
callback.apply( this, arguments );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* acf.isInView
|
||||||
|
*
|
||||||
|
* Returns true if the given element is in view.
|
||||||
|
*
|
||||||
|
* @date 29/8/19
|
||||||
|
* @since 5.8.1
|
||||||
|
*
|
||||||
|
* @param elem el The dom element to inspect.
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
acf.isInView = function( el ){
|
||||||
|
var rect = el.getBoundingClientRect();
|
||||||
|
return (
|
||||||
|
rect.top !== rect.bottom &&
|
||||||
|
rect.top >= 0 &&
|
||||||
|
rect.left >= 0 &&
|
||||||
|
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
|
||||||
|
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* acf.onceInView
|
||||||
|
*
|
||||||
|
* Watches for a dom element to become visible in the browser and then excecutes the passed callback.
|
||||||
|
*
|
||||||
|
* @date 28/8/19
|
||||||
|
* @since 5.8.1
|
||||||
|
*
|
||||||
|
* @param dom el The dom element to inspect.
|
||||||
|
* @param function callback The callback function.
|
||||||
|
*/
|
||||||
|
acf.onceInView = (function() {
|
||||||
|
|
||||||
|
// Define list.
|
||||||
|
var items = [];
|
||||||
|
var id = 0;
|
||||||
|
|
||||||
|
// Define check function.
|
||||||
|
var check = function() {
|
||||||
|
items.forEach(function( item ){
|
||||||
|
if( acf.isInView(item.el) ) {
|
||||||
|
item.callback.apply( this );
|
||||||
|
pop( item.id );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// And create a debounced version.
|
||||||
|
var debounced = acf.debounce( check, 300 );
|
||||||
|
|
||||||
|
// Define add function.
|
||||||
|
var push = function( el, callback ) {
|
||||||
|
|
||||||
|
// Add event listener.
|
||||||
|
if( !items.length ) {
|
||||||
|
$(window).on( 'scroll resize', debounced ).on( 'acfrefresh orientationchange', check );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append to list.
|
||||||
|
items.push({ id: id++, el: el, callback: callback });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define remove function.
|
||||||
|
var pop = function( id ) {
|
||||||
|
|
||||||
|
// Remove from list.
|
||||||
|
items = items.filter(function(item) {
|
||||||
|
return (item.id !== id);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Clean up listener.
|
||||||
|
if( !items.length ) {
|
||||||
|
$(window).off( 'scroll resize', debounced ).off( 'acfrefresh orientationchange', check );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define returned function.
|
||||||
|
return function( el, callback ){
|
||||||
|
|
||||||
|
// Allow jQuery object.
|
||||||
|
if( el instanceof jQuery )
|
||||||
|
el = el[0];
|
||||||
|
|
||||||
|
// Execute callback if already in view or add to watch list.
|
||||||
|
if( acf.isInView(el) ) {
|
||||||
|
callback.apply( this );
|
||||||
|
} else {
|
||||||
|
push( el, callback );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* acf.once
|
||||||
|
*
|
||||||
|
* Creates a function that is restricted to invoking `func` once.
|
||||||
|
*
|
||||||
|
* @date 2/9/19
|
||||||
|
* @since 5.8.1
|
||||||
|
*
|
||||||
|
* @param function func The function to restrict.
|
||||||
|
* @return function
|
||||||
|
*/
|
||||||
|
acf.once = function( func ){
|
||||||
|
var i = 0;
|
||||||
|
return function(){
|
||||||
|
if( i++ > 0 ) {
|
||||||
|
return (func = undefined);
|
||||||
|
}
|
||||||
|
return func.apply(this, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* exists
|
* exists
|
||||||
*
|
*
|
||||||
|
|
@ -6828,7 +6990,7 @@
|
||||||
getNodeValue: function(){
|
getNodeValue: function(){
|
||||||
var $node = this.get('node');
|
var $node = this.get('node');
|
||||||
return {
|
return {
|
||||||
title: $node.html(),
|
title: acf.decode( $node.html() ),
|
||||||
url: $node.attr('href'),
|
url: $node.attr('href'),
|
||||||
target: $node.attr('target')
|
target: $node.attr('target')
|
||||||
};
|
};
|
||||||
|
|
@ -6836,7 +6998,7 @@
|
||||||
|
|
||||||
setNodeValue: function( val ){
|
setNodeValue: function( val ){
|
||||||
var $node = this.get('node');
|
var $node = this.get('node');
|
||||||
$node.html( val.title );
|
$node.text( val.title );
|
||||||
$node.attr('href', val.url);
|
$node.attr('href', val.url);
|
||||||
$node.attr('target', val.target);
|
$node.attr('target', val.target);
|
||||||
$node.trigger('change');
|
$node.trigger('change');
|
||||||
|
|
@ -7205,8 +7367,7 @@
|
||||||
'change [data-filter]': 'onChangeFilter',
|
'change [data-filter]': 'onChangeFilter',
|
||||||
'keyup [data-filter]': 'onChangeFilter',
|
'keyup [data-filter]': 'onChangeFilter',
|
||||||
'click .choices-list .acf-rel-item': 'onClickAdd',
|
'click .choices-list .acf-rel-item': 'onClickAdd',
|
||||||
'click [data-name="remove_item"]': 'onClickRemove',
|
'click [data-name="remove_item"]': 'onClickRemove',
|
||||||
'mouseover': 'onHover'
|
|
||||||
},
|
},
|
||||||
|
|
||||||
$control: function(){
|
$control: function(){
|
||||||
|
|
@ -7252,60 +7413,59 @@
|
||||||
].join('');
|
].join('');
|
||||||
},
|
},
|
||||||
|
|
||||||
addSortable: function( self ){
|
|
||||||
|
|
||||||
// sortable
|
|
||||||
this.$list('values').sortable({
|
|
||||||
items: 'li',
|
|
||||||
forceHelperSize: true,
|
|
||||||
forcePlaceholderSize: true,
|
|
||||||
scroll: true,
|
|
||||||
update: function(){
|
|
||||||
self.$input().trigger('change');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(){
|
initialize: function(){
|
||||||
|
|
||||||
// scroll
|
// Delay initialization until "interacted with" or "in view".
|
||||||
var onScroll = this.proxy(function(e){
|
var delayed = this.proxy(acf.once(function(){
|
||||||
|
|
||||||
// bail early if no more results
|
// Add sortable.
|
||||||
if( this.get('loading') || !this.get('more') ) {
|
this.$list('values').sortable({
|
||||||
return;
|
items: 'li',
|
||||||
}
|
forceHelperSize: true,
|
||||||
|
forcePlaceholderSize: true,
|
||||||
|
scroll: true,
|
||||||
|
update: this.proxy(function(){
|
||||||
|
this.$input().trigger('change');
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
// Scrolled to bottom
|
// Avoid browser remembering old scroll position and add event.
|
||||||
var $list = this.$list('choices');
|
this.$list('choices').scrollTop(0).on('scroll', this.proxy(this.onScrollChoices));
|
||||||
var scrollTop = Math.ceil( $list.scrollTop() );
|
|
||||||
var scrollHeight = Math.ceil( $list[0].scrollHeight );
|
|
||||||
var innerHeight = Math.ceil( $list.innerHeight() );
|
|
||||||
var paged = this.get('paged') || 1;
|
|
||||||
if( (scrollTop + innerHeight) >= scrollHeight ) {
|
|
||||||
|
|
||||||
// update paged
|
|
||||||
this.set('paged', (paged+1));
|
|
||||||
|
|
||||||
// fetch
|
|
||||||
this.fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
// Fetch choices.
|
||||||
|
this.fetch();
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
this.$list('choices').scrollTop(0).on('scroll', onScroll);
|
// Bind "interacted with".
|
||||||
|
this.$el.one( 'mouseover', delayed );
|
||||||
|
this.$el.one( 'focus', 'input', delayed );
|
||||||
|
|
||||||
// fetch
|
// Bind "in view".
|
||||||
this.fetch();
|
acf.onceInView( this.$el, delayed );
|
||||||
},
|
},
|
||||||
|
|
||||||
onHover: function( e ){
|
onScrollChoices: function(e){
|
||||||
|
|
||||||
|
// bail early if no more results
|
||||||
|
if( this.get('loading') || !this.get('more') ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// only once
|
// Scrolled to bottom
|
||||||
$().off(e);
|
var $list = this.$list('choices');
|
||||||
|
var scrollTop = Math.ceil( $list.scrollTop() );
|
||||||
// add sortable
|
var scrollHeight = Math.ceil( $list[0].scrollHeight );
|
||||||
this.addSortable( this );
|
var innerHeight = Math.ceil( $list.innerHeight() );
|
||||||
|
var paged = this.get('paged') || 1;
|
||||||
|
if( (scrollTop + innerHeight) >= scrollHeight ) {
|
||||||
|
|
||||||
|
// update paged
|
||||||
|
this.set('paged', (paged+1));
|
||||||
|
|
||||||
|
// fetch
|
||||||
|
this.fetch();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onKeypressFilter: function( e, $el ){
|
onKeypressFilter: function( e, $el ){
|
||||||
|
|
@ -13260,6 +13420,10 @@
|
||||||
*/
|
*/
|
||||||
addInputEvents: function( $el ){
|
addInputEvents: function( $el ){
|
||||||
|
|
||||||
|
// Bug exists in Safari where custom "invalid" handeling prevents draft from saving.
|
||||||
|
if( acf.get('browser') === 'safari' )
|
||||||
|
return;
|
||||||
|
|
||||||
// vars
|
// vars
|
||||||
var $inputs = $('.acf-field [name]', $el);
|
var $inputs = $('.acf-field [name]', $el);
|
||||||
|
|
||||||
|
|
@ -13492,6 +13656,7 @@
|
||||||
clearTimeout( this.timeout );
|
clearTimeout( this.timeout );
|
||||||
this.timeout = setTimeout(function(){
|
this.timeout = setTimeout(function(){
|
||||||
acf.doAction('refresh');
|
acf.doAction('refresh');
|
||||||
|
$(window).trigger('acfrefresh');
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -233,6 +233,10 @@ function acf_validate_field( $field = array() ) {
|
||||||
//'attributes' => array()
|
//'attributes' => array()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Convert types.
|
||||||
|
$field['ID'] = (int) $field['ID'];
|
||||||
|
$field['menu_order'] = (int) $field['menu_order'];
|
||||||
|
|
||||||
// Add backwards compatibility for wrapper attributes.
|
// Add backwards compatibility for wrapper attributes.
|
||||||
// Todo: Remove need for this.
|
// Todo: Remove need for this.
|
||||||
$field['wrapper'] = wp_parse_args($field['wrapper'], array(
|
$field['wrapper'] = wp_parse_args($field['wrapper'], array(
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,10 @@ function acf_validate_field_group( $field_group = array() ) {
|
||||||
'description' => '',
|
'description' => '',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Convert types.
|
||||||
|
$field_group['ID'] = (int) $field_group['ID'];
|
||||||
|
$field_group['menu_order'] = (int) $field_group['menu_order'];
|
||||||
|
|
||||||
// Field group is now valid.
|
// Field group is now valid.
|
||||||
$field_group['_valid'] = 1;
|
$field_group['_valid'] = 1;
|
||||||
|
|
||||||
|
|
@ -515,6 +519,8 @@ function acf_update_field_group( $field_group ) {
|
||||||
'post_excerpt' => sanitize_title( $field_group['title'] ),
|
'post_excerpt' => sanitize_title( $field_group['title'] ),
|
||||||
'post_content' => maybe_serialize( $_field_group ),
|
'post_content' => maybe_serialize( $_field_group ),
|
||||||
'menu_order' => $field_group['menu_order'],
|
'menu_order' => $field_group['menu_order'],
|
||||||
|
'comment_status' => 'closed',
|
||||||
|
'ping_status' => 'closed',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Unhook wp_targeted_link_rel() filter from WP 5.1 corrupting serialized data.
|
// Unhook wp_targeted_link_rel() filter from WP 5.1 corrupting serialized data.
|
||||||
|
|
|
||||||
|
|
@ -362,4 +362,26 @@ function acf_punctify( $str = '' ) {
|
||||||
return trim($str, '.') . '.';
|
return trim($str, '.') . '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* acf_did
|
||||||
|
*
|
||||||
|
* Returns true if ACF already did an event.
|
||||||
|
*
|
||||||
|
* @date 30/8/19
|
||||||
|
* @since 5.8.1
|
||||||
|
*
|
||||||
|
* @param string $name The name of the event.
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function acf_did( $name ) {
|
||||||
|
|
||||||
|
// Return true if already did the event (preventing event).
|
||||||
|
if( acf_get_data("acf_did_$name") ) {
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Otherwise, update store and return false (alowing event).
|
||||||
|
} else {
|
||||||
|
acf_set_data("acf_did_$name", true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -92,12 +92,14 @@ function acf_get_meta( $post_id = 0 ) {
|
||||||
|
|
||||||
// Loop over meta and check that a reference exists for each value.
|
// Loop over meta and check that a reference exists for each value.
|
||||||
$meta = array();
|
$meta = array();
|
||||||
foreach( $allmeta as $key => $value ) {
|
if( $allmeta ) {
|
||||||
|
foreach( $allmeta as $key => $value ) {
|
||||||
// If a reference exists for this value, add it to the meta array.
|
|
||||||
if( isset($allmeta["_$key"]) ) {
|
// If a reference exists for this value, add it to the meta array.
|
||||||
$meta[ $key ] = $allmeta[ $key ][0];
|
if( isset($allmeta["_$key"]) ) {
|
||||||
$meta[ "_$key" ] = $allmeta[ "_$key" ][0];
|
$meta[ $key ] = $allmeta[ $key ][0];
|
||||||
|
$meta[ "_$key" ] = $allmeta[ "_$key" ][0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,17 +15,14 @@
|
||||||
<h2><?php _e("A Smoother Experience", 'acf'); ?> </h2>
|
<h2><?php _e("A Smoother Experience", 'acf'); ?> </h2>
|
||||||
<div class="acf-three-col">
|
<div class="acf-three-col">
|
||||||
<div>
|
<div>
|
||||||
<p><img src="https://assets.advancedcustomfields.com/info/5.0.0/select2.png" /></p>
|
|
||||||
<h3><?php _e("Improved Usability", 'acf'); ?></h3>
|
<h3><?php _e("Improved Usability", 'acf'); ?></h3>
|
||||||
<p><?php _e("Including the popular Select2 library has improved both usability and speed across a number of field types including post object, page link, taxonomy and select.", 'acf'); ?></p>
|
<p><?php _e("Including the popular Select2 library has improved both usability and speed across a number of field types including post object, page link, taxonomy and select.", 'acf'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p><img src="https://assets.advancedcustomfields.com/info/5.0.0/design.png" /></p>
|
|
||||||
<h3><?php _e("Improved Design", 'acf'); ?></h3>
|
<h3><?php _e("Improved Design", 'acf'); ?></h3>
|
||||||
<p><?php _e("Many fields have undergone a visual refresh to make ACF look better than ever! Noticeable changes are seen on the gallery, relationship and oEmbed (new) fields!", 'acf'); ?></p>
|
<p><?php _e("Many fields have undergone a visual refresh to make ACF look better than ever! Noticeable changes are seen on the gallery, relationship and oEmbed (new) fields!", 'acf'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p><img src="https://assets.advancedcustomfields.com/info/5.0.0/sub-fields.png" /></p>
|
|
||||||
<h3><?php _e("Improved Data", 'acf'); ?></h3>
|
<h3><?php _e("Improved Data", 'acf'); ?></h3>
|
||||||
<p><?php _e("Redesigning the data architecture has allowed sub fields to live independently from their parents. This allows you to drag and drop fields in and out of parent fields!", 'acf'); ?></p>
|
<p><?php _e("Redesigning the data architecture has allowed sub fields to live independently from their parents. This allows you to drag and drop fields in and out of parent fields!", 'acf'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -557,8 +557,16 @@ class acf_field_checkbox extends acf_field {
|
||||||
|
|
||||||
function format_value( $value, $post_id, $field ) {
|
function format_value( $value, $post_id, $field ) {
|
||||||
|
|
||||||
return acf_get_field_type('select')->format_value( $value, $post_id, $field );
|
// Bail early if is empty.
|
||||||
|
if( acf_is_empty($value) ) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Always convert to array of items.
|
||||||
|
$value = acf_array($value);
|
||||||
|
|
||||||
|
// Return.
|
||||||
|
return acf_get_field_type('select')->format_value( $value, $post_id, $field );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,6 @@ class ACF_Updates {
|
||||||
/** @var array The array of registered plugins */
|
/** @var array The array of registered plugins */
|
||||||
var $plugins = array();
|
var $plugins = array();
|
||||||
|
|
||||||
/** @var boolean Dev mode */
|
|
||||||
var $dev = false;
|
|
||||||
|
|
||||||
/** @var int Counts the number of plugin update checks */
|
/** @var int Counts the number of plugin update checks */
|
||||||
var $checked = 0;
|
var $checked = 0;
|
||||||
|
|
||||||
|
|
@ -114,10 +111,9 @@ class ACF_Updates {
|
||||||
// vars
|
// vars
|
||||||
$url = 'https://connect.advancedcustomfields.com/' . $query;
|
$url = 'https://connect.advancedcustomfields.com/' . $query;
|
||||||
|
|
||||||
// development mode
|
// Development mode
|
||||||
if( $this->dev ) {
|
if( defined('ACF_DEV') && ACF_DEV ) {
|
||||||
$url = 'http://connect/' . $query;
|
$url = 'http://connect/' . $query;
|
||||||
acf_log('acf connect: '. $url, $body);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// post
|
// post
|
||||||
|
|
|
||||||
10
readme.txt
10
readme.txt
|
|
@ -67,6 +67,16 @@ From your WordPress dashboard
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 5.8.4 =
|
||||||
|
*Release Date - 3 September 2019*
|
||||||
|
|
||||||
|
* New - Optimized Relationship field by delaying AJAX call until UI is visible.
|
||||||
|
* Fix - Fixed bug incorrectly escaping HTML in the Link field title.
|
||||||
|
* Fix - Fixed bug showing Discussion and Comment metaboxes for newly imported field groups.
|
||||||
|
* Fix - Fixed PHP warning when loading meta from Post 0.
|
||||||
|
* Dev - Ensure Checkbox field value is an array even when empty.
|
||||||
|
* Dev - Added new `ACF_MAJOR_VERSION` constant.
|
||||||
|
|
||||||
= 5.8.3 =
|
= 5.8.3 =
|
||||||
*Release Date - 7 August 2019*
|
*Release Date - 7 August 2019*
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue