initial commit

This commit is contained in:
2024-04-29 13:12:44 +05:45
commit 34887303c5
19300 changed files with 5268802 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,197 @@
103.225.244.23
103.225.244.118
103.225.244.200
103.225.244.52
103.225.244.120
103.225.244.127
122.254.91.234
103.225.244.86
103.225.244.225
103.225.244.247
103.225.244.81
103.225.244.55
27.34.20.0
43.245.87.80
27.34.20.100
202.51.89.226
27.34.20.103
103.225.244.114
103.225.244.246
27.34.113.91
103.225.244.157
27.34.25.179
27.34.20.113
103.225.244.224
122.254.85.21
162.241.194.200
110.44.127.196
103.225.244.109
110.44.120.194
103.225.244.144
27.34.13.241
103.225.244.65
110.44.115.154
27.34.113.147
27.34.25.208
27.34.12.155
103.225.244.3
27.34.25.124
110.44.115.167
110.44.127.172
110.44.115.159
110.44.125.165
202.51.76.205
113.199.156.34
27.34.25.111
103.225.244.27
45.123.221.3
103.225.244.189
27.34.68.125
202.51.76.46
43.245.86.9
110.44.115.236
110.44.115.146
202.51.76.70
103.10.31.101
110.44.127.205
43.245.86.26
103.225.244.84
45.123.222.79
103.225.244.112
27.34.25.191
27.34.20.132
27.34.68.192
27.34.113.217
103.225.244.97
103.225.244.156
110.44.127.174
43.245.86.114
27.34.20.173
27.34.20.200
113.199.163.42
202.51.88.16
124.41.238.28
103.147.63.51
27.34.25.255
103.225.244.57
27.34.12.224
27.34.30.252
124.41.238.243
103.1.93.180
27.34.13.239
103.225.244.107
27.34.113.252
27.34.25.80
27.34.25.83
124.41.238.176
120.89.104.37
27.34.22.223
202.51.88.247
27.34.22.63
202.70.84.125
124.41.238.5
27.34.22.131
113.199.229.98
103.225.244.121
202.51.88.198
27.34.22.122
27.34.22.174
120.89.104.125
27.34.25.139
103.225.244.147
113.199.230.23
110.44.127.176
110.44.125.179
27.34.13.150
113.199.228.117
27.34.13.79
27.34.25.130
27.34.25.148
103.225.244.17
113.199.229.169
113.199.231.187
27.34.25.246
103.225.244.140
27.34.25.36
27.34.22.111
27.34.22.119
27.34.45.233
27.34.13.148
27.34.25.221
103.225.244.29
27.34.115.133
110.44.120.200
27.34.25.169
110.44.120.206
27.34.12.222
103.225.244.37
27.34.50.166
27.34.50.136
27.34.25.226
27.34.22.252
103.225.244.105
103.225.244.92
103.225.244.186
113.199.230.88
116.66.195.186
113.199.187.11
103.1.93.10
113.199.229.255
27.34.20.18
113.199.228.48
103.225.244.100
45.123.222.215
27.34.25.177
103.225.244.183
113.199.228.134
202.51.88.189
27.34.25.234
27.34.25.70
27.34.30.175
27.34.45.17
27.34.30.40
113.199.229.90
120.89.104.62
27.34.20.14
110.44.115.148
110.44.121.226
103.225.244.70
103.225.244.89
103.225.244.145
103.225.244.185
27.34.25.71
113.199.231.69
113.199.230.194
27.34.25.68
27.34.25.197
103.225.244.132
103.225.244.155
113.199.229.38
113.199.228.58
27.34.30.220
202.51.87.135
110.44.127.201
103.225.244.101
27.34.30.185
27.34.113.175
27.34.113.56
27.34.113.136
202.51.76.89
27.34.27.87
163.53.27.150
110.44.127.177
110.44.125.10
113.199.230.42
113.199.230.5
103.225.244.91
103.225.244.95
103.225.244.36
103.225.244.166
103.225.244.135
202.166.197.253
110.44.118.100
103.10.31.88
202.51.86.212
110.44.115.200
27.34.68.162
::1

View File

@@ -0,0 +1,667 @@
<?php
/*
Plugin Name: Advanced Custom Fields PRO
Plugin URI: https://www.advancedcustomfields.com
Description: Customize WordPress with powerful, professional and intuitive fields.
Version: 5.10.2
Author: Delicious Brains
Author URI: https://www.advancedcustomfields.com
Text Domain: acf
Domain Path: /lang
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF' ) ) :
class ACF {
/** @var string The plugin version number. */
var $version = '5.10.2';
/** @var array The plugin settings array. */
var $settings = array();
/** @var array The plugin data array. */
var $data = array();
/** @var array Storage for class instances. */
var $instances = array();
/**
* __construct
*
* A dummy constructor to ensure ACF is only setup once.
*
* @date 23/06/12
* @since 5.0.0
*
* @param void
* @return void
*/
function __construct() {
// Do nothing.
}
/**
* initialize
*
* Sets up the ACF plugin.
*
* @date 28/09/13
* @since 5.0.0
*
* @param void
* @return void
*/
function initialize() {
// Define constants.
$this->define( 'ACF', true );
$this->define( 'ACF_PATH', plugin_dir_path( __FILE__ ) );
$this->define( 'ACF_BASENAME', plugin_basename( __FILE__ ) );
$this->define( 'ACF_VERSION', $this->version );
$this->define( 'ACF_MAJOR_VERSION', 5 );
// Define settings.
$this->settings = array(
'name' => __( 'Advanced Custom Fields', 'acf' ),
'slug' => dirname( ACF_BASENAME ),
'version' => ACF_VERSION,
'basename' => ACF_BASENAME,
'path' => ACF_PATH,
'file' => __FILE__,
'url' => plugin_dir_url( __FILE__ ),
'show_admin' => true,
'show_updates' => true,
'stripslashes' => false,
'local' => true,
'json' => true,
'save_json' => '',
'load_json' => array(),
'default_language' => '',
'current_language' => '',
'capability' => 'manage_options',
'uploader' => 'wp',
'autoload' => false,
'l10n' => true,
'l10n_textdomain' => '',
'google_api_key' => '',
'google_api_client' => '',
'enqueue_google_maps' => true,
'enqueue_select2' => true,
'enqueue_datepicker' => true,
'enqueue_datetimepicker' => true,
'select2_version' => 4,
'row_index_offset' => 1,
'remove_wp_meta_box' => true,
);
// Include utility functions.
include_once ACF_PATH . 'includes/acf-utility-functions.php';
// Include previous API functions.
acf_include( 'includes/api/api-helpers.php' );
acf_include( 'includes/api/api-template.php' );
acf_include( 'includes/api/api-term.php' );
// Include classes.
acf_include( 'includes/class-acf-data.php' );
acf_include( 'includes/fields/class-acf-field.php' );
acf_include( 'includes/locations/abstract-acf-legacy-location.php' );
acf_include( 'includes/locations/abstract-acf-location.php' );
// Include functions.
acf_include( 'includes/acf-helper-functions.php' );
acf_include( 'includes/acf-hook-functions.php' );
acf_include( 'includes/acf-field-functions.php' );
acf_include( 'includes/acf-field-group-functions.php' );
acf_include( 'includes/acf-form-functions.php' );
acf_include( 'includes/acf-meta-functions.php' );
acf_include( 'includes/acf-post-functions.php' );
acf_include( 'includes/acf-user-functions.php' );
acf_include( 'includes/acf-value-functions.php' );
acf_include( 'includes/acf-input-functions.php' );
acf_include( 'includes/acf-wp-functions.php' );
// Include core.
acf_include( 'includes/fields.php' );
acf_include( 'includes/locations.php' );
acf_include( 'includes/assets.php' );
acf_include( 'includes/compatibility.php' );
acf_include( 'includes/deprecated.php' );
acf_include( 'includes/l10n.php' );
acf_include( 'includes/local-fields.php' );
acf_include( 'includes/local-meta.php' );
acf_include( 'includes/local-json.php' );
acf_include( 'includes/loop.php' );
acf_include( 'includes/media.php' );
acf_include( 'includes/revisions.php' );
acf_include( 'includes/updates.php' );
acf_include( 'includes/upgrades.php' );
acf_include( 'includes/validation.php' );
// Include ajax.
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-user-setting.php' );
acf_include( 'includes/ajax/class-acf-ajax-upgrade.php' );
acf_include( 'includes/ajax/class-acf-ajax-query.php' );
acf_include( 'includes/ajax/class-acf-ajax-query-users.php' );
acf_include( 'includes/ajax/class-acf-ajax-local-json-diff.php' );
// Include forms.
acf_include( 'includes/forms/form-attachment.php' );
acf_include( 'includes/forms/form-comment.php' );
acf_include( 'includes/forms/form-customizer.php' );
acf_include( 'includes/forms/form-front.php' );
acf_include( 'includes/forms/form-nav-menu.php' );
acf_include( 'includes/forms/form-post.php' );
acf_include( 'includes/forms/form-gutenberg.php' );
acf_include( 'includes/forms/form-taxonomy.php' );
acf_include( 'includes/forms/form-user.php' );
acf_include( 'includes/forms/form-widget.php' );
// Include admin.
if ( is_admin() ) {
acf_include( 'includes/admin/admin.php' );
acf_include( 'includes/admin/admin-field-group.php' );
acf_include( 'includes/admin/admin-field-groups.php' );
acf_include( 'includes/admin/admin-notices.php' );
acf_include( 'includes/admin/admin-tools.php' );
acf_include( 'includes/admin/admin-upgrade.php' );
}
// Include legacy.
acf_include( 'includes/legacy/legacy-locations.php' );
// Include PRO.
acf_include( 'pro/acf-pro.php' );
// Include tests.
if ( defined( 'ACF_DEV' ) && ACF_DEV ) {
acf_include( 'tests/tests.php' );
}
// Add actions.
add_action( 'init', array( $this, 'init' ), 5 );
add_action( 'init', array( $this, 'register_post_types' ), 5 );
add_action( 'init', array( $this, 'register_post_status' ), 5 );
// Add filters.
add_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 );
}
/**
* init
*
* Completes the setup process on "init" of earlier.
*
* @date 28/09/13
* @since 5.0.0
*
* @param void
* @return void
*/
function init() {
// Bail early if called directly from functions.php or plugin file.
if ( ! did_action( 'plugins_loaded' ) ) {
return;
}
// This function may be called directly from template functions. Bail early if already did this.
if ( acf_did( 'init' ) ) {
return;
}
// Update url setting. Allows other plugins to modify the URL (force SSL).
acf_update_setting( 'url', plugin_dir_url( __FILE__ ) );
// Load textdomain file.
acf_load_textdomain();
// Include 3rd party compatiblity.
acf_include( 'includes/third-party.php' );
// Include wpml support.
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
acf_include( 'includes/wpml.php' );
}
// Include fields.
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-number.php' );
acf_include( 'includes/fields/class-acf-field-range.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-password.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-wysiwyg.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-checkbox.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-true_false.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-page_link.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-user.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_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-message.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-group.php' );
/**
* 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 );
// Include locations.
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-status.php' );
acf_include( 'includes/locations/class-acf-location-post-format.php' );
acf_include( 'includes/locations/class-acf-location-post-category.php' );
acf_include( 'includes/locations/class-acf-location-post-taxonomy.php' );
acf_include( 'includes/locations/class-acf-location-post.php' );
acf_include( 'includes/locations/class-acf-location-page-template.php' );
acf_include( 'includes/locations/class-acf-location-page-type.php' );
acf_include( 'includes/locations/class-acf-location-page-parent.php' );
acf_include( 'includes/locations/class-acf-location-page.php' );
acf_include( 'includes/locations/class-acf-location-current-user.php' );
acf_include( 'includes/locations/class-acf-location-current-user-role.php' );
acf_include( 'includes/locations/class-acf-location-user-form.php' );
acf_include( 'includes/locations/class-acf-location-user-role.php' );
acf_include( 'includes/locations/class-acf-location-taxonomy.php' );
acf_include( 'includes/locations/class-acf-location-attachment.php' );
acf_include( 'includes/locations/class-acf-location-comment.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-item.php' );
/**
* 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 );
/**
* 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 );
/**
* Fires after ACF is completely "initialized".
*
* @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
*
* Registers the ACF post types.
*
* @date 22/10/2015
* @since 5.3.2
*
* @param void
* @return void
*/
function register_post_types() {
// Vars.
$cap = acf_get_setting( 'capability' );
// Register the Field Group post type.
register_post_type(
'acf-field-group',
array(
'labels' => array(
'name' => __( 'Field Groups', 'acf' ),
'singular_name' => __( 'Field Group', 'acf' ),
'add_new' => __( 'Add New', 'acf' ),
'add_new_item' => __( 'Add New Field Group', 'acf' ),
'edit_item' => __( 'Edit Field Group', 'acf' ),
'new_item' => __( 'New Field Group', 'acf' ),
'view_item' => __( 'View Field Group', 'acf' ),
'search_items' => __( 'Search Field Groups', 'acf' ),
'not_found' => __( 'No Field Groups found', 'acf' ),
'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ),
),
'public' => false,
'hierarchical' => true,
'show_ui' => true,
'show_in_menu' => false,
'_builtin' => false,
'capability_type' => 'post',
'capabilities' => array(
'edit_post' => $cap,
'delete_post' => $cap,
'edit_posts' => $cap,
'delete_posts' => $cap,
),
'supports' => array( 'title' ),
'rewrite' => false,
'query_var' => false,
)
);
// Register the Field post type.
register_post_type(
'acf-field',
array(
'labels' => array(
'name' => __( 'Fields', 'acf' ),
'singular_name' => __( 'Field', 'acf' ),
'add_new' => __( 'Add New', 'acf' ),
'add_new_item' => __( 'Add New Field', 'acf' ),
'edit_item' => __( 'Edit Field', 'acf' ),
'new_item' => __( 'New Field', 'acf' ),
'view_item' => __( 'View Field', 'acf' ),
'search_items' => __( 'Search Fields', 'acf' ),
'not_found' => __( 'No Fields found', 'acf' ),
'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ),
),
'public' => false,
'hierarchical' => true,
'show_ui' => false,
'show_in_menu' => false,
'_builtin' => false,
'capability_type' => 'post',
'capabilities' => array(
'edit_post' => $cap,
'delete_post' => $cap,
'edit_posts' => $cap,
'delete_posts' => $cap,
),
'supports' => array( 'title' ),
'rewrite' => false,
'query_var' => false,
)
);
}
/**
* register_post_status
*
* Registers the ACF post statuses.
*
* @date 22/10/2015
* @since 5.3.2
*
* @param void
* @return void
*/
function register_post_status() {
// Register the Disabled post status.
register_post_status(
'acf-disabled',
array(
'label' => _x( 'Disabled', 'post status', 'acf' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'acf' ),
)
);
}
/**
* posts_where
*
* Filters the $where clause allowing for custom WP_Query args.
*
* @date 31/8/19
* @since 5.8.1
*
* @param string $where The WHERE clause.
* @return WP_Query $wp_query The query object.
*/
function posts_where( $where, $wp_query ) {
global $wpdb;
// Add custom "acf_field_key" arg.
if ( $field_key = $wp_query->get( 'acf_field_key' ) ) {
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_name = %s", $field_key );
}
// Add custom "acf_field_name" arg.
if ( $field_name = $wp_query->get( 'acf_field_name' ) ) {
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_excerpt = %s", $field_name );
}
// Add custom "acf_group_key" arg.
if ( $group_key = $wp_query->get( 'acf_group_key' ) ) {
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_name = %s", $group_key );
}
// Return.
return $where;
}
/**
* define
*
* Defines a constant if doesnt already exist.
*
* @date 3/5/17
* @since 5.5.13
*
* @param string $name The constant name.
* @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 ) {
return isset( $this->settings[ $name ] );
}
/**
* get_setting
*
* Returns a setting or null if doesn't exist.
*
* @date 28/09/13
* @since 5.0.0
*
* @param string $name The setting name.
* @return mixed
*/
function get_setting( $name ) {
return isset( $this->settings[ $name ] ) ? $this->settings[ $name ] : null;
}
/**
* update_setting
*
* Updates a setting for the given name and value.
*
* @date 28/09/13
* @since 5.0.0
*
* @param string $name The setting name.
* @param mixed $value The setting value.
* @return true
*/
function update_setting( $name, $value ) {
$this->settings[ $name ] = $value;
return true;
}
/**
* get_data
*
* Returns data or null if doesn't exist.
*
* @date 28/09/13
* @since 5.0.0
*
* @param string $name The data name.
* @return mixed
*/
function get_data( $name ) {
return isset( $this->data[ $name ] ) ? $this->data[ $name ] : null;
}
/**
* set_data
*
* Sets data for the given name and value.
*
* @date 28/09/13
* @since 5.0.0
*
* @param string $name The data name.
* @param mixed $value The data value.
* @return void
*/
function set_data( $name, $value ) {
$this->data[ $name ] = $value;
}
/**
* get_instance
*
* Returns an instance or null if doesn't exist.
*
* @date 13/2/18
* @since 5.6.9
*
* @param string $class The instance class name.
* @return object
*/
function get_instance( $class ) {
$name = strtolower( $class );
return isset( $this->instances[ $name ] ) ? $this->instances[ $name ] : null;
}
/**
* new_instance
*
* Creates and stores an instance of the given class.
*
* @date 13/2/18
* @since 5.6.9
*
* @param string $class The instance class name.
* @return object
*/
function new_instance( $class ) {
$instance = new $class();
$name = strtolower( $class );
$this->instances[ $name ] = $instance;
return $instance;
}
/**
* Magic __isset method for backwards compatibility.
*
* @date 24/4/20
* @since 5.9.0
*
* @param string $key Key name.
* @return bool
*/
public function __isset( $key ) {
return in_array( $key, array( 'locations', 'json' ) );
}
/**
* Magic __get method for backwards compatibility.
*
* @date 24/4/20
* @since 5.9.0
*
* @param string $key Key name.
* @return mixed
*/
public function __get( $key ) {
switch ( $key ) {
case 'locations':
return acf_get_instance( 'ACF_Legacy_Locations' );
case 'json':
return acf_get_instance( 'ACF_Local_JSON' );
}
return null;
}
}
/*
* acf
*
* 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.
*
* Example: <?php $acf = acf(); ?>
*
* @date 4/09/13
* @since 4.3.0
*
* @param void
* @return ACF
*/
function acf() {
global $acf;
// Instantiate only once.
if ( ! isset( $acf ) ) {
$acf = new ACF();
$acf->initialize();
}
return $acf;
}
// Instantiate.
acf();
endif; // class_exists check

View File

@@ -0,0 +1,316 @@
/*--------------------------------------------------------------------------------------------
*
* Dark mode
*
* WordPress plugin: https://en-au.wordpress.org/plugins/dark-mode/
* Github Documentation: https://github.com/danieltj27/Dark-Mode/wiki/Help:-Plugin-Compatibility-Guide
*
*--------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------
*
* Global
*
*---------------------------------------------------------------------------------------------*/
.acf-box {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
.acf-box .title,
.acf-box .footer {
border-color: #23282d;
}
.acf-box h2 {
color: #bbc8d4;
}
.acf-box table, .acf-box tbody, .acf-box tr {
background: transparent !important;
}
.acf-thead {
color: #bbc8d4;
border-color: #191f25;
}
.acf-tfoot {
background-color: #2d3136;
border-color: #23282d;
}
.acf-table.-clear,
.acf-table.-clear tr {
background: transparent !important;
}
.acf-loading-overlay {
background: rgba(0, 0, 0, 0.5);
}
/*---------------------------------------------------------------------------------------------
*
* Fields
*
*---------------------------------------------------------------------------------------------*/
.acf-fields > .acf-field {
border-color: #23282d;
}
.acf-fields.-left > .acf-field:before {
background: rgba(0, 0, 0, 0.1);
border-color: #23282d;
}
.acf-fields.-border {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
.acf-field[data-width] + .acf-field[data-width] {
border-color: #23282d;
}
.acf-input-prepend,
.acf-input-append {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
.acf-fields > .acf-tab-wrap {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
.acf-fields > .acf-tab-wrap .acf-tab-group {
background-color: #2d3136;
border-color: #23282d;
}
.acf-fields > .acf-tab-wrap .acf-tab-group li a {
background-color: #2d3136;
border-color: #23282d;
}
.acf-fields > .acf-tab-wrap .acf-tab-group li a:hover {
background-color: #2d3136;
border-color: #23282d;
color: #bbc8d4;
}
.acf-fields > .acf-tab-wrap .acf-tab-group li.active a {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
.acf-fields.-sidebar:before {
background-color: #2d3136;
border-color: #23282d;
}
.acf-fields.-sidebar.-left:before {
background-color: #2d3136;
border-color: #23282d;
background: #23282d;
}
.acf-fields.-sidebar.-left > .acf-tab-wrap.-left .acf-tab-group li a {
background-color: #2d3136;
border-color: #23282d;
}
.acf-fields.-sidebar.-left > .acf-tab-wrap.-left .acf-tab-group li.active a {
background-color: #2d3136;
border-color: #23282d;
}
.acf-file-uploader .show-if-value {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
.acf-file-uploader .show-if-value .file-icon {
background-color: #2d3136;
border-color: #23282d;
}
.acf-oembed {
background-color: #2d3136;
border-color: #23282d;
}
.acf-oembed .title {
background-color: #50626f;
border-color: #191f25;
color: #fff;
}
.acf-gallery {
background-color: #2d3136;
border-color: #23282d;
}
.acf-gallery .acf-gallery-main {
background: #23282d;
}
.acf-gallery .acf-gallery-attachment .margin {
background-color: #2d3136;
border-color: #23282d;
}
.acf-gallery .acf-gallery-side {
background-color: #2d3136;
border-color: #23282d;
}
.acf-gallery .acf-gallery-side .acf-gallery-side-info {
background-color: #2d3136;
border-color: #23282d;
}
.acf-gallery .acf-gallery-toolbar {
background-color: #2d3136;
border-color: #23282d;
}
.acf-button-group label:not(.selected) {
background-color: #2d3136;
border-color: #23282d;
}
.acf-switch:not(.-on) {
background-color: #2d3136;
border-color: #23282d;
}
.acf-switch:not(.-on) .acf-switch-slider {
background-color: #50626f;
border-color: #191f25;
color: #fff;
}
.acf-link .link-wrap {
background-color: #2d3136;
border-color: #23282d;
}
.acf-relationship .filters {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
.acf-relationship .selection {
background-color: #2d3136;
border-color: #23282d;
}
.acf-relationship .selection .choices,
.acf-relationship .selection .choices-list,
.acf-relationship .selection .values {
background-color: #2d3136;
border-color: #23282d;
}
.acf-taxonomy-field .categorychecklist-holder {
background-color: #2d3136;
border-color: #23282d;
}
.acf-google-map {
background-color: #2d3136;
border-color: #23282d;
}
.acf-google-map .title {
background-color: #50626f;
border-color: #191f25;
color: #fff;
}
.acf-accordion {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
.acf-field.acf-accordion .acf-accordion-content > .acf-fields {
border-color: #191f25;
}
.acf-flexible-content .layout {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
.acf-flexible-content .layout .acf-fc-layout-handle {
background-color: #2d3136;
border-color: #23282d;
}
.acf-flexible-content .layout .acf-fc-layout-handle .acf-fc-layout-order {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
#wpbody .acf-table {
background-color: #2d3136;
border-color: #23282d;
}
#wpbody .acf-table > tbody > tr,
#wpbody .acf-table > thead > tr {
background: transparent;
}
#wpbody .acf-table > tbody > tr > td,
#wpbody .acf-table > tbody > tr > th,
#wpbody .acf-table > thead > tr > td,
#wpbody .acf-table > thead > tr > th {
border-color: #191f25;
}
.acf-field select optgroup, .acf-field select optgroup:nth-child(2n) {
background: #50626f;
}
/*---------------------------------------------------------------------------------------------
*
* Field Group
*
*---------------------------------------------------------------------------------------------*/
#acf-field-group-fields .acf-field-list-wrap {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
#acf-field-group-fields .acf-field-list .no-fields-message {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
}
#acf-field-group-fields .acf-field-object {
background-color: #32373c;
border-color: #191f25;
color: #bbc8d4;
border-color: #23282d;
}
#acf-field-group-fields .acf-field-object table, #acf-field-group-fields .acf-field-object tbody, #acf-field-group-fields .acf-field-object tr, #acf-field-group-fields .acf-field-object td, #acf-field-group-fields .acf-field-object th {
background: transparent;
border-color: #23282d;
}
#acf-field-group-fields .acf-field-object .acf-field .acf-label {
background-color: #2d3136;
border-color: #23282d;
}
#acf-field-group-fields .acf-field-object.ui-sortable-helper {
border-color: #191f25;
box-shadow: none;
}
#acf-field-group-fields .acf-field-object.ui-sortable-placeholder {
background-color: #2d3136;
border-color: #23282d;
box-shadow: none;
}
#acf-field-group-fields .acf-field-object + .acf-field-object-tab::before,
#acf-field-group-fields .acf-field-object + .acf-field-object-accordion::before {
background-color: #2d3136;
border-color: #23282d;
}
/*---------------------------------------------------------------------------------------------
*
* Admin: Tools
*
*---------------------------------------------------------------------------------------------*/
.acf-meta-box-wrap .acf-fields {
background-color: #50626f;
border-color: #191f25;
color: #fff;
background: transparent;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,481 @@
/*--------------------------------------------------------------------------------------------
*
* Vars
*
*--------------------------------------------------------------------------------------------*/
/* colors */
/* acf-field */
/* responsive */
/*--------------------------------------------------------------------------------------------
*
* Mixins
*
*--------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------
*
* Field Group
*
*--------------------------------------------------------------------------------------------*/
#acf-field-group-fields > .inside,
#acf-field-group-locations > .inside,
#acf-field-group-options > .inside {
padding: 0;
margin: 0;
}
.postbox .handle-order-higher,
.postbox .handle-order-lower {
display: none;
}
/*---------------------------------------------------------------------------------------------
*
* Postbox: Publish
*
*---------------------------------------------------------------------------------------------*/
#minor-publishing-actions,
#misc-publishing-actions #visibility,
#misc-publishing-actions .edit-timestamp {
display: none;
}
#minor-publishing {
border-bottom: 0 none;
}
#misc-pub-section {
border-bottom: 0 none;
}
#misc-publishing-actions .misc-pub-section {
border-bottom-color: #F5F5F5;
}
/*---------------------------------------------------------------------------------------------
*
* Postbox: Fields
*
*---------------------------------------------------------------------------------------------*/
#acf-field-group-fields {
border: 0 none;
box-shadow: none;
/* links */
/* table header */
/* show keys */
/* fields */
}
#acf-field-group-fields > .postbox-header,
#acf-field-group-fields > .handlediv,
#acf-field-group-fields > .hndle {
display: none;
}
#acf-field-group-fields a {
text-decoration: none;
}
#acf-field-group-fields a:active, #acf-field-group-fields a:focus {
outline: none;
box-shadow: none;
}
#acf-field-group-fields .li-field-order {
width: 20%;
}
#acf-field-group-fields .li-field-label {
width: 30%;
}
#acf-field-group-fields .li-field-name {
width: 25%;
}
#acf-field-group-fields .li-field-type {
width: 25%;
}
#acf-field-group-fields .li-field-key {
display: none;
}
#acf-field-group-fields.show-field-keys .li-field-label,
#acf-field-group-fields.show-field-keys .li-field-name,
#acf-field-group-fields.show-field-keys .li-field-type,
#acf-field-group-fields.show-field-keys .li-field-key {
width: 20%;
}
#acf-field-group-fields.show-field-keys .li-field-key {
display: block;
}
#acf-field-group-fields .acf-field-list-wrap {
border: #ccd0d4 solid 1px;
}
#acf-field-group-fields .acf-field-list {
background: #f5f5f5;
margin-top: -1px;
/* no fields */
/* empty */
}
#acf-field-group-fields .acf-field-list .no-fields-message {
padding: 15px 15px;
background: #fff;
display: none;
}
#acf-field-group-fields .acf-field-list.-empty .no-fields-message {
display: block;
}
.acf-admin-3-8 #acf-field-group-fields .acf-field-list-wrap {
border-color: #dfdfdf;
}
/* field object */
.acf-field-object {
border-top: #eeeeee solid 1px;
background: #fff;
/* sortable */
/* meta */
/* handle */
/* open */
/*
// debug
&[data-save="meta"] {
> .handle {
border-left: #ffb700 solid 5px !important;
}
}
&[data-save="settings"] {
> .handle {
border-left: #0ec563 solid 5px !important;
}
}
*/
/* hover */
/* settings */
/* conditional logic */
}
.acf-field-object.ui-sortable-helper {
border-top-color: #fff;
box-shadow: 0 0 0 1px #DFDFDF, 0 1px 4px rgba(0, 0, 0, 0.1);
}
.acf-field-object.ui-sortable-placeholder {
box-shadow: 0 -1px 0 0 #DFDFDF;
visibility: visible !important;
background: #F9F9F9;
border-top-color: transparent;
min-height: 54px;
}
.acf-field-object.ui-sortable-placeholder:after, .acf-field-object.ui-sortable-placeholder:before {
visibility: hidden;
}
.acf-field-object > .meta {
display: none;
}
.acf-field-object > .handle a {
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
}
.acf-field-object > .handle li {
padding-top: 10px;
padding-bottom: 10px;
word-wrap: break-word;
}
.acf-field-object > .handle .acf-icon {
margin: 1px 0 0;
cursor: move;
background: transparent;
float: left;
height: 28px;
line-height: 26px;
width: 28px;
font-size: 13px;
color: #444;
position: relative;
z-index: 1;
}
.acf-field-object > .handle strong {
display: block;
padding-bottom: 6px;
font-size: 14px;
line-height: 14px;
min-height: 14px;
}
.acf-field-object > .handle .row-options {
visibility: hidden;
}
.acf-field-object > .handle .row-options a {
margin-right: 4px;
}
.acf-field-object > .handle .row-options a.delete-field {
color: #a00;
}
.acf-field-object > .handle .row-options a.delete-field:hover {
color: #f00;
}
.acf-field-object.open + .acf-field-object {
border-top-color: #E1E1E1;
}
.acf-field-object.open > .handle {
background: #2a9bd9;
border: #2696d3 solid 1px;
text-shadow: #268FBB 0 1px 0;
color: #fff;
position: relative;
margin: -1px -1px 0 -1px;
}
.acf-field-object.open > .handle a {
color: #fff !important;
}
.acf-field-object.open > .handle a:hover {
text-decoration: underline !important;
}
.acf-field-object.open > .handle .acf-icon {
border-color: #fff;
color: #fff;
}
.acf-field-object.open > .handle .acf-required {
color: #fff;
}
.acf-field-object:hover > .handle .row-options, .acf-field-object.-hover > .handle .row-options {
visibility: visible;
}
.acf-field-object > .settings {
display: none;
width: 100%;
}
.acf-field-object > .settings > .acf-table {
border: none;
}
.acf-field-object .rule-groups {
margin-top: 20px;
}
/*---------------------------------------------------------------------------------------------
*
* Postbox: Locations
*
*---------------------------------------------------------------------------------------------*/
.rule-groups h4 {
margin: 3px 0;
}
.rule-groups .rule-group {
margin: 0 0 5px;
}
.rule-groups .rule-group h4 {
margin: 0 0 3px;
}
.rule-groups .rule-group td.param {
width: 35%;
}
.rule-groups .rule-group td.operator {
width: 20%;
}
.rule-groups .rule-group td.add {
width: 40px;
}
.rule-groups .rule-group td.remove {
width: 28px;
vertical-align: middle;
}
.rule-groups .rule-group td.remove a {
visibility: hidden;
}
.rule-groups .rule-group tr:hover td.remove a {
visibility: visible;
}
.rule-groups .rule-group select:empty {
background: #f8f8f8;
}
.rule-groups:not(.rule-groups-multiple) .rule-group:first-child tr:first-child td.remove a {
/* Don't allow user to delete the only rule group */
visibility: hidden !important;
}
/*---------------------------------------------------------------------------------------------
*
* Options
*
*---------------------------------------------------------------------------------------------*/
#acf-field-group-options tr[data-name=hide_on_screen] li {
float: left;
width: 33%;
}
@media (max-width: 1100px) {
#acf-field-group-options tr[data-name=hide_on_screen] li {
width: 50%;
}
}
/*---------------------------------------------------------------------------------------------
*
* Conditional Logic
*
*---------------------------------------------------------------------------------------------*/
table.conditional-logic-rules {
background: transparent;
border: 0 none;
border-radius: 0;
}
table.conditional-logic-rules tbody td {
background: transparent;
border: 0 none !important;
padding: 5px 2px !important;
}
/*---------------------------------------------------------------------------------------------
*
* Field: Tab
*
*---------------------------------------------------------------------------------------------*/
.acf-field-object-tab .acf-field-setting-name, .acf-field-object-accordion .acf-field-setting-name,
.acf-field-object-tab .acf-field-setting-instructions,
.acf-field-object-accordion .acf-field-setting-instructions,
.acf-field-object-tab .acf-field-setting-required,
.acf-field-object-accordion .acf-field-setting-required,
.acf-field-object-tab .acf-field-setting-warning,
.acf-field-object-accordion .acf-field-setting-warning,
.acf-field-object-tab .acf-field-setting-wrapper,
.acf-field-object-accordion .acf-field-setting-wrapper {
display: none;
}
.acf-field-object-tab .li-field-name, .acf-field-object-accordion .li-field-name {
visibility: hidden;
}
.acf-field-object + .acf-field-object-tab:before, .acf-field-object + .acf-field-object-accordion:before {
display: block;
content: "";
height: 5px;
width: 100%;
background: #f5f5f5;
border-top: #e1e1e1 solid 1px;
border-bottom: #e1e1e1 solid 1px;
margin-top: -1px;
}
.acf-admin-3-8 .acf-field-object + .acf-field-object-tab:before, .acf-admin-3-8 .acf-field-object + .acf-field-object-accordion:before {
border-color: #E5E5E5;
}
.acf-field-object-tab p:first-child, .acf-field-object-accordion p:first-child {
margin: 0.5em 0;
}
/*---------------------------------------------------------------------------------------------
*
* Field: Accordion
*
*---------------------------------------------------------------------------------------------*/
.acf-field-object-accordion .acf-field-setting-instructions {
display: table-row;
}
/*---------------------------------------------------------------------------------------------
*
* Field: Message
*
*---------------------------------------------------------------------------------------------*/
.acf-field-object-message tr[data-name=name],
.acf-field-object-message tr[data-name=instructions],
.acf-field-object-message tr[data-name=required] {
display: none !important;
}
.acf-field-object-message .li-field-name {
visibility: hidden;
}
.acf-field-object-message textarea {
height: 175px !important;
}
/*---------------------------------------------------------------------------------------------
*
* Field: Separator
*
*---------------------------------------------------------------------------------------------*/
.acf-field-object-separator tr[data-name=name],
.acf-field-object-separator tr[data-name=instructions],
.acf-field-object-separator tr[data-name=required] {
display: none !important;
}
/*---------------------------------------------------------------------------------------------
*
* Field: Date Picker
*
*---------------------------------------------------------------------------------------------*/
.acf-field-object-date-picker .acf-radio-list li,
.acf-field-object-time-picker .acf-radio-list li,
.acf-field-object-date-time-picker .acf-radio-list li {
line-height: 25px;
}
.acf-field-object-date-picker .acf-radio-list span,
.acf-field-object-time-picker .acf-radio-list span,
.acf-field-object-date-time-picker .acf-radio-list span {
display: inline-block;
min-width: 10em;
}
.acf-field-object-date-picker .acf-radio-list input[type=text],
.acf-field-object-time-picker .acf-radio-list input[type=text],
.acf-field-object-date-time-picker .acf-radio-list input[type=text] {
width: 100px;
}
.acf-field-object-date-time-picker .acf-radio-list span {
min-width: 15em;
}
.acf-field-object-date-time-picker .acf-radio-list input[type=text] {
width: 200px;
}
/*--------------------------------------------------------------------------------------------
*
* Slug
*
*--------------------------------------------------------------------------------------------*/
#slugdiv .inside {
padding: 12px;
margin: 0;
}
#slugdiv input[type=text] {
width: 100%;
height: 28px;
font-size: 14px;
}
/*--------------------------------------------------------------------------------------------
*
* RTL
*
*--------------------------------------------------------------------------------------------*/
html[dir=rtl] .acf-field-object.open > .handle {
margin: -1px -1px 0;
}
html[dir=rtl] .acf-field-object.open > .handle .acf-icon {
float: right;
}
html[dir=rtl] .acf-field-object.open > .handle .li-field-order {
padding-left: 0 !important;
padding-right: 15px !important;
}
/*---------------------------------------------------------------------------------------------
*
* Device
*
*---------------------------------------------------------------------------------------------*/
@media only screen and (max-width: 850px) {
tr.acf-field,
td.acf-label,
td.acf-input {
display: block !important;
width: auto !important;
border: 0 none !important;
}
tr.acf-field {
border-top: #ededed solid 1px !important;
margin-bottom: 0 !important;
}
td.acf-label {
background: transparent !important;
padding-bottom: 0 !important;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,67 @@
/*--------------------------------------------------------------------------------------------
*
* Vars
*
*--------------------------------------------------------------------------------------------*/
/* colors */
/* acf-field */
/* responsive */
/*--------------------------------------------------------------------------------------------
*
* Mixins
*
*--------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------
*
* Flexible Content
*
*---------------------------------------------------------------------------------------------*/
.acf-field-setting-fc_layout .acf-fc-meta {
margin: 0 0 10px;
padding: 0;
}
.acf-field-setting-fc_layout .acf-fc-meta li {
margin: 0 0 10px;
padding: 0;
}
.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display,
.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-min {
float: left;
width: 33%;
padding-right: 10px;
}
.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-label .acf-input-prepend,
.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-name .acf-input-prepend,
.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display .acf-input-prepend {
min-width: 60px;
}
.acf-field-setting-fc_layout .acf-fl-actions {
visibility: hidden;
}
.acf-field-setting-fc_layout .acf-fl-actions .reorder-layout {
cursor: move;
}
.acf-field-setting-fc_layout .acf-fl-actions a {
padding: 1px 0;
font-size: 13px;
line-height: 20px;
}
.acf-field-setting-fc_layout:hover .acf-fl-actions, .acf-field-setting-fc_layout.-hover .acf-fl-actions {
visibility: visible;
}
/*---------------------------------------------------------------------------------------------
*
* Clone
*
*---------------------------------------------------------------------------------------------*/
.acf-field-object-clone {
/* group */
/* seamless */
}
.acf-field-object-clone[data-display=seamless] .acf-field-setting-instructions,
.acf-field-object-clone[data-display=seamless] .acf-field-setting-layout,
.acf-field-object-clone[data-display=seamless] .acf-field-setting-wrapper,
.acf-field-object-clone[data-display=seamless] .acf-field-setting-conditional_logic {
display: none;
}

View File

@@ -0,0 +1 @@
.acf-field-setting-fc_layout .acf-fc-meta{margin:0 0 10px;padding:0}.acf-field-setting-fc_layout .acf-fc-meta li{margin:0 0 10px;padding:0}.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-min{float:left;width:33%;padding-right:10px}.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display .acf-input-prepend,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-label .acf-input-prepend,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-name .acf-input-prepend{min-width:60px}.acf-field-setting-fc_layout .acf-fl-actions{visibility:hidden}.acf-field-setting-fc_layout .acf-fl-actions .reorder-layout{cursor:move}.acf-field-setting-fc_layout .acf-fl-actions a{padding:1px 0;font-size:13px;line-height:20px}.acf-field-setting-fc_layout.-hover .acf-fl-actions,.acf-field-setting-fc_layout:hover .acf-fl-actions{visibility:visible}.acf-field-object-clone[data-display=seamless] .acf-field-setting-conditional_logic,.acf-field-object-clone[data-display=seamless] .acf-field-setting-instructions,.acf-field-object-clone[data-display=seamless] .acf-field-setting-layout,.acf-field-object-clone[data-display=seamless] .acf-field-setting-wrapper{display:none}

View File

@@ -0,0 +1,683 @@
/*--------------------------------------------------------------------------------------------
*
* Vars
*
*--------------------------------------------------------------------------------------------*/
/* colors */
/* acf-field */
/* responsive */
/*--------------------------------------------------------------------------------------------
*
* Mixins
*
*--------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------
*
* Repeater
*
*---------------------------------------------------------------------------------------------*/
.acf-repeater {
/* table */
/* row handle (add/remove) */
/* add in spacer to th (force correct width) */
/* row */
/* sortable */
/* layouts */
/*
&.-row > table > tbody > tr:before,
&.-block > table > tbody > tr:before {
content: "";
display: table-row;
height: 2px;
background: #f00;
}
*/
/* empty */
/* collapsed */
/* collapsed (block layout) */
/* collapsed (table layout) */
}
.acf-repeater > table {
margin: 0 0 8px;
background: #F9F9F9;
}
.acf-repeater .acf-row-handle {
width: 16px;
text-align: center !important;
vertical-align: middle !important;
position: relative;
/* icons */
/* .order */
/* remove */
}
.acf-repeater .acf-row-handle .acf-icon {
display: none;
position: absolute;
top: 0;
margin: -8px 0 0 -2px;
/* minus icon */
}
.acf-repeater .acf-row-handle .acf-icon.-minus {
top: 50%;
/* ie fix */
}
body.browser-msie .acf-repeater .acf-row-handle .acf-icon.-minus {
top: 25px;
}
.acf-repeater .acf-row-handle.order {
background: #f4f4f4;
cursor: move;
color: #aaa;
text-shadow: #fff 0 1px 0;
}
.acf-repeater .acf-row-handle.order:hover {
color: #666;
}
.acf-repeater .acf-row-handle.order + td {
border-left-color: #DFDFDF;
}
.acf-repeater .acf-row-handle.remove {
background: #F9F9F9;
border-left-color: #DFDFDF;
}
.acf-repeater th.acf-row-handle:before {
content: "";
width: 16px;
display: block;
height: 1px;
}
.acf-repeater .acf-row {
/* hide clone */
/* hover */
}
.acf-repeater .acf-row.acf-clone {
display: none !important;
}
.acf-repeater .acf-row:hover, .acf-repeater .acf-row.-hover {
/* icons */
}
.acf-repeater .acf-row:hover > .acf-row-handle .acf-icon, .acf-repeater .acf-row.-hover > .acf-row-handle .acf-icon {
display: block;
}
.acf-repeater .acf-row:hover > .acf-row-handle .acf-icon.show-on-shift, .acf-repeater .acf-row.-hover > .acf-row-handle .acf-icon.show-on-shift {
display: none;
}
body.acf-keydown-shift .acf-repeater .acf-row:hover > .acf-row-handle .acf-icon.show-on-shift, body.acf-keydown-shift .acf-repeater .acf-row.-hover > .acf-row-handle .acf-icon.show-on-shift {
display: block;
}
body.acf-keydown-shift .acf-repeater .acf-row:hover > .acf-row-handle .acf-icon.hide-on-shift, body.acf-keydown-shift .acf-repeater .acf-row.-hover > .acf-row-handle .acf-icon.hide-on-shift {
display: none;
}
.acf-repeater > table > tbody > tr.ui-sortable-helper {
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}
.acf-repeater > table > tbody > tr.ui-sortable-placeholder {
visibility: visible !important;
}
.acf-repeater > table > tbody > tr.ui-sortable-placeholder td {
background: #F9F9F9;
}
.acf-repeater.-row > table > tbody > tr > td, .acf-repeater.-block > table > tbody > tr > td {
border-top-color: #E1E1E1;
}
.acf-repeater.-empty > table > thead > tr > th {
border-bottom: 0 none;
}
.acf-repeater.-empty.-row > table, .acf-repeater.-empty.-block > table {
display: none;
}
.acf-repeater .acf-row.-collapsed > .acf-field {
display: none !important;
}
.acf-repeater .acf-row.-collapsed > td.acf-field.-collapsed-target {
display: table-cell !important;
}
.acf-repeater .acf-row.-collapsed > .acf-fields > * {
display: none !important;
}
.acf-repeater .acf-row.-collapsed > .acf-fields > .acf-field.-collapsed-target {
display: block !important;
}
.acf-repeater .acf-row.-collapsed > .acf-fields > .acf-field.-collapsed-target[data-width] {
float: none !important;
width: auto !important;
}
.acf-repeater.-table .acf-row.-collapsed .acf-field.-collapsed-target {
border-left-color: #dfdfdf;
}
.acf-repeater.-max .acf-icon[data-event=add-row] {
display: none !important;
}
/*---------------------------------------------------------------------------------------------
*
* Flexible Content
*
*---------------------------------------------------------------------------------------------*/
.acf-flexible-content {
position: relative;
}
.acf-flexible-content > .clones {
display: none;
}
.acf-flexible-content > .values {
margin: 0 0 8px;
}
.acf-flexible-content > .values > .ui-sortable-placeholder {
visibility: visible !important;
border: 1px dashed #b4b9be;
box-shadow: none;
background: transparent;
}
.acf-flexible-content .layout {
position: relative;
margin: 20px 0 0;
background: #fff;
border: 1px solid #ccd0d4;
}
.acf-flexible-content .layout:first-child {
margin-top: 0;
}
.acf-flexible-content .layout .acf-fc-layout-handle {
display: block;
position: relative;
padding: 8px 10px;
cursor: move;
border-bottom: #ccd0d4 solid 1px;
color: #444;
font-size: 14px;
line-height: 1.4em;
}
.acf-flexible-content .layout .acf-fc-layout-order {
display: block;
width: 20px;
height: 20px;
border-radius: 10px;
display: inline-block;
text-align: center;
line-height: 20px;
margin: 0 2px 0 0;
background: #F1F1F1;
font-size: 12px;
color: #444;
}
html[dir=rtl] .acf-flexible-content .layout .acf-fc-layout-order {
float: right;
margin-right: 0;
margin-left: 5px;
}
.acf-flexible-content .layout .acf-fc-layout-controls {
position: absolute;
top: 8px;
right: 8px;
}
.acf-flexible-content .layout .acf-fc-layout-controls .acf-icon {
display: block;
float: left;
margin: 0 0 0 5px;
}
.acf-flexible-content .layout .acf-fc-layout-controls .acf-icon.-plus, .acf-flexible-content .layout .acf-fc-layout-controls .acf-icon.-minus, .acf-flexible-content .layout .acf-fc-layout-controls .acf-icon.-duplicate {
visibility: hidden;
}
html[dir=rtl] .acf-flexible-content .layout .acf-fc-layout-controls {
right: auto;
left: 9px;
}
.acf-flexible-content .layout.is-selected {
border-color: #7e8993;
}
.acf-flexible-content .layout.is-selected .acf-fc-layout-handle {
border-color: #7e8993;
}
.acf-flexible-content .layout:hover .acf-fc-layout-controls .acf-icon.-plus, .acf-flexible-content .layout:hover .acf-fc-layout-controls .acf-icon.-minus, .acf-flexible-content .layout:hover .acf-fc-layout-controls .acf-icon.-duplicate, .acf-flexible-content .layout.-hover .acf-fc-layout-controls .acf-icon.-plus, .acf-flexible-content .layout.-hover .acf-fc-layout-controls .acf-icon.-minus, .acf-flexible-content .layout.-hover .acf-fc-layout-controls .acf-icon.-duplicate {
visibility: visible;
}
.acf-flexible-content .layout.-collapsed > .acf-fc-layout-handle {
border-bottom-width: 0;
}
.acf-flexible-content .layout.-collapsed > .acf-fields,
.acf-flexible-content .layout.-collapsed > .acf-table {
display: none;
}
.acf-flexible-content .layout > .acf-table {
border: 0 none;
box-shadow: none;
}
.acf-flexible-content .layout > .acf-table > tbody > tr {
background: #fff;
}
.acf-flexible-content .layout > .acf-table > thead > tr > th {
background: #F9F9F9;
}
.acf-flexible-content .no-value-message {
padding: 19px;
border: #ccc dashed 2px;
text-align: center;
display: none;
}
.acf-flexible-content.-empty > .no-value-message {
display: block;
}
.acf-fc-popup {
padding: 5px 0;
z-index: 900001;
min-width: 135px;
}
.acf-fc-popup ul, .acf-fc-popup li {
list-style: none;
display: block;
margin: 0;
padding: 0;
}
.acf-fc-popup li {
position: relative;
float: none;
white-space: nowrap;
}
.acf-fc-popup .badge {
display: inline-block;
border-radius: 8px;
font-size: 9px;
line-height: 15px;
padding: 0 5px;
background: #d54e21;
text-align: center;
color: #fff;
vertical-align: top;
margin: 0 0 0 5px;
}
.acf-fc-popup a {
color: #eee;
padding: 5px 10px;
display: block;
text-decoration: none;
position: relative;
}
.acf-fc-popup a:hover {
background: #0073aa;
color: #fff;
}
.acf-fc-popup a.disabled {
color: #888;
background: transparent;
}
/*---------------------------------------------------------------------------------------------
*
* Galery
*
*---------------------------------------------------------------------------------------------*/
.acf-gallery {
border: #ccd0d4 solid 1px;
height: 400px;
position: relative;
/* main */
/* attachments */
/* attachment */
/* toolbar */
/* sidebar */
/* side info */
/* side data */
/* column widths */
/* resizable */
}
.acf-gallery .acf-gallery-main {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #fff;
z-index: 2;
}
.acf-gallery .acf-gallery-attachments {
position: absolute;
top: 0;
right: 0;
bottom: 48px;
left: 0;
padding: 5px;
overflow: auto;
overflow-x: hidden;
}
.acf-gallery .acf-gallery-attachment {
width: 25%;
float: left;
cursor: pointer;
position: relative;
/* hover */
/* sortable */
/* active */
/* icon */
/* rtl */
}
.acf-gallery .acf-gallery-attachment .margin {
margin: 5px;
border: #d5d9dd solid 1px;
position: relative;
overflow: hidden;
background: #eee;
}
.acf-gallery .acf-gallery-attachment .margin:before {
content: "";
display: block;
padding-top: 100%;
}
.acf-gallery .acf-gallery-attachment .thumbnail {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transform: translate(50%, 50%);
}
html[dir=rtl] .acf-gallery .acf-gallery-attachment .thumbnail {
transform: translate(-50%, 50%);
}
.acf-gallery .acf-gallery-attachment .thumbnail img {
display: block;
height: auto;
max-height: 100%;
width: auto;
transform: translate(-50%, -50%);
}
html[dir=rtl] .acf-gallery .acf-gallery-attachment .thumbnail img {
transform: translate(50%, -50%);
}
.acf-gallery .acf-gallery-attachment .filename {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 5%;
background: #F4F4F4;
background: rgba(255, 255, 255, 0.8);
border-top: #DFDFDF solid 1px;
font-weight: bold;
text-align: center;
word-wrap: break-word;
max-height: 90%;
overflow: hidden;
}
.acf-gallery .acf-gallery-attachment .actions {
position: absolute;
top: 0;
right: 0;
display: none;
}
.acf-gallery .acf-gallery-attachment:hover .actions {
display: block;
}
.acf-gallery .acf-gallery-attachment.ui-sortable-helper .margin {
border: none;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.acf-gallery .acf-gallery-attachment.ui-sortable-placeholder .margin {
background: #F1F1F1;
border: none;
}
.acf-gallery .acf-gallery-attachment.ui-sortable-placeholder .margin * {
display: none !important;
}
.acf-gallery .acf-gallery-attachment.active .margin {
box-shadow: 0 0 0 1px #FFFFFF, 0 0 0 5px #0073aa;
}
.acf-gallery .acf-gallery-attachment.-icon .thumbnail img {
transform: translate(-50%, -70%);
}
html[dir=rtl] .acf-gallery .acf-gallery-attachment {
float: right;
}
.acf-gallery.sidebar-open {
/* hide attachment actions when sidebar is open */
/* allow sidebar to move over main for small widths (widget edit box) */
}
.acf-gallery.sidebar-open .acf-gallery-attachment .actions {
display: none;
}
.acf-gallery.sidebar-open .acf-gallery-side {
z-index: 2;
}
.acf-gallery .acf-gallery-toolbar {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 10px;
border-top: #d5d9dd solid 1px;
background: #fff;
min-height: 28px;
}
.acf-gallery .acf-gallery-toolbar .acf-hl li {
line-height: 24px;
}
.acf-gallery .acf-gallery-toolbar .bulk-actions-select {
width: auto;
margin: 0 1px 0 0;
}
.acf-gallery .acf-gallery-side {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 0;
background: #F9F9F9;
border-left: #ccd0d4 solid 1px;
z-index: 1;
overflow: hidden;
}
.acf-gallery .acf-gallery-side .acf-gallery-side-inner {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 349px;
}
.acf-gallery .acf-gallery-side-info {
position: relative;
width: 100%;
padding: 10px;
margin: -10px 0 15px -10px;
background: #F1F1F1;
border-bottom: #DFDFDF solid 1px;
}
.acf-gallery .acf-gallery-side-info:after {
display: block;
clear: both;
content: "";
}
html[dir=rtl] .acf-gallery .acf-gallery-side-info {
margin-left: 0;
margin-right: -10px;
}
.acf-gallery .acf-gallery-side-info img {
float: left;
width: auto;
max-width: 65px;
max-height: 65px;
margin: 0 10px 1px 0;
background: #FFFFFF;
padding: 3px;
border: #ccd0d4 solid 1px;
border-radius: 1px;
/* rtl */
}
html[dir=rtl] .acf-gallery .acf-gallery-side-info img {
float: right;
margin: 0 0 0 10px;
}
.acf-gallery .acf-gallery-side-info p {
font-size: 13px;
line-height: 15px;
margin: 3px 0;
word-break: break-all;
color: #666;
}
.acf-gallery .acf-gallery-side-info p strong {
color: #000;
}
.acf-gallery .acf-gallery-side-info a {
text-decoration: none;
}
.acf-gallery .acf-gallery-side-info a.acf-gallery-edit {
color: #21759b;
}
.acf-gallery .acf-gallery-side-info a.acf-gallery-remove {
color: #bc0b0b;
}
.acf-gallery .acf-gallery-side-info a:hover {
text-decoration: underline;
}
.acf-gallery .acf-gallery-side-data {
position: absolute;
top: 0;
right: 0;
bottom: 48px;
left: 0;
overflow: auto;
overflow-x: inherit;
padding: 10px;
}
.acf-gallery .acf-gallery-side-data .acf-label,
.acf-gallery .acf-gallery-side-data th.label {
color: #666666;
font-size: 12px;
line-height: 25px;
padding: 0 4px 8px 0 !important;
width: auto !important;
vertical-align: top;
}
html[dir=rtl] .acf-gallery .acf-gallery-side-data .acf-label,
html[dir=rtl] .acf-gallery .acf-gallery-side-data th.label {
padding: 0 0 8px 4px !important;
}
.acf-gallery .acf-gallery-side-data .acf-label label,
.acf-gallery .acf-gallery-side-data th.label label {
font-weight: normal;
}
.acf-gallery .acf-gallery-side-data .acf-input,
.acf-gallery .acf-gallery-side-data td.field {
padding: 0 0 8px !important;
}
.acf-gallery .acf-gallery-side-data textarea {
min-height: 0;
height: 60px;
}
.acf-gallery .acf-gallery-side-data p.help {
font-size: 12px;
}
.acf-gallery .acf-gallery-side-data p.help:hover {
font-weight: normal;
}
.acf-gallery[data-columns="1"] .acf-gallery-attachment {
width: 100%;
}
.acf-gallery[data-columns="2"] .acf-gallery-attachment {
width: 50%;
}
.acf-gallery[data-columns="3"] .acf-gallery-attachment {
width: 33.333%;
}
.acf-gallery[data-columns="4"] .acf-gallery-attachment {
width: 25%;
}
.acf-gallery[data-columns="5"] .acf-gallery-attachment {
width: 20%;
}
.acf-gallery[data-columns="6"] .acf-gallery-attachment {
width: 16.666%;
}
.acf-gallery[data-columns="7"] .acf-gallery-attachment {
width: 14.285%;
}
.acf-gallery[data-columns="8"] .acf-gallery-attachment {
width: 12.5%;
}
.acf-gallery .ui-resizable-handle {
display: block;
position: absolute;
}
.acf-gallery .ui-resizable-s {
bottom: -5px;
cursor: ns-resize;
height: 7px;
left: 0;
width: 100%;
}
/* media modal selected */
.acf-media-modal .attachment.acf-selected {
box-shadow: 0 0 0 3px #fff inset, 0 0 0 7px #0073aa inset !important;
}
.acf-media-modal .attachment.acf-selected .check {
display: none !important;
}
.acf-media-modal .attachment.acf-selected .thumbnail {
opacity: 0.25 !important;
}
.acf-media-modal .attachment.acf-selected .attachment-preview:before {
background: rgba(0, 0, 0, 0.15);
z-index: 1;
position: relative;
}
/*--------------------------------------------------------------------------------------------
*
* ACF Blocks
*
*--------------------------------------------------------------------------------------------*/
.acf-block-component .components-placeholder {
margin: 0;
}
.acf-block-component .acf-block-fields {
background: #fff;
text-align: left;
font-size: 13px;
line-height: 1.4em;
color: #444;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}
html[dir=rtl] .acf-block-component .acf-block-fields {
text-align: right;
}
.acf-block-component .acf-block-fields p {
font-size: 13px;
line-height: 1.5;
}
.acf-block-body .acf-block-fields {
border: #adb2ad solid 1px;
}
.acf-block-body .acf-block-fields .acf-tab-wrap .acf-tab-group {
margin-left: 0;
padding: 16px 20px 0;
}
.acf-block-body .acf-fields > .acf-field {
padding: 16px 20px;
}
.acf-block-body .acf-fields > .acf-field.acf-accordion {
border-color: #adb2ad;
}
.acf-block-body .acf-fields > .acf-field.acf-accordion .acf-accordion-title {
padding: 16px 20px;
}
.acf-block-body .acf-block-preview {
min-height: 10px;
}
.acf-block-panel .acf-block-fields {
border-top: #e2e4e7 solid 1px;
min-height: 1px;
}
.acf-block-panel .acf-block-fields:empty {
border-top: none;
}
.acf-block-panel .acf-block-fields .acf-tab-wrap {
background: transparent;
}
.components-panel__body .acf-block-panel {
margin: 16px -16px -16px;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,480 @@
(function($){
/*
* Repeater
*
* This field type requires some extra logic for its settings
*
* @type function
* @date 24/10/13
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
var RepeaterCollapsedFieldSetting = acf.FieldSetting.extend({
type: 'repeater',
name: 'collapsed',
events: {
'focus select': 'onFocus',
},
onFocus: function( e, $el ){
// vars
var $select = $el;
// collapsed
var choices = [];
// keep 'null' choice
choices.push({
label: $select.find('option[value=""]').text(),
value: ''
});
// find sub fields
var $list = this.fieldObject.$('.acf-field-list:first');
var fields = acf.getFieldObjects({
list: $list
});
// loop
fields.map(function( field ){
choices.push({
label: field.prop('label'),
value: field.prop('key')
});
});
// render
acf.renderSelect( $select, choices );
}
});
acf.registerFieldSetting( RepeaterCollapsedFieldSetting );
})(jQuery);
(function($){
/**
* CloneDisplayFieldSetting
*
* Extra logic for this field setting
*
* @date 18/4/18
* @since 5.6.9
*
* @param void
* @return void
*/
var FlexibleContentLayoutFieldSetting = acf.FieldSetting.extend({
type: 'flexible_content',
name: 'fc_layout',
events: {
'blur .layout-label': 'onChangeLabel',
'click .add-layout': 'onClickAdd',
'click .duplicate-layout': 'onClickDuplicate',
'click .delete-layout': 'onClickDelete'
},
$input: function( name ){
return $('#' + this.getInputId() + '-' + name);
},
$list: function(){
return this.$('.acf-field-list:first');
},
getInputId: function(){
return this.fieldObject.getInputId() + '-layouts-' + this.field.get('id');
},
// get all sub fields
getFields: function(){
return acf.getFieldObjects({ parent: this.$el });
},
// get imediate children
getChildren: function(){
return acf.getFieldObjects({ list: this.$list() });
},
initialize: function(){
// add sortable
var $tbody = this.$el.parent();
if( !$tbody.hasClass('ui-sortable') ) {
$tbody.sortable({
items: '> .acf-field-setting-fc_layout',
handle: '.reorder-layout',
forceHelperSize: true,
forcePlaceholderSize: true,
scroll: true,
stop: this.proxy(function(event, ui) {
this.fieldObject.save();
})
});
}
// add meta to sub fields
this.updateFieldLayouts();
},
updateFieldLayouts: function(){
this.getChildren().map(this.updateFieldLayout, this);
},
updateFieldLayout: function( field ){
field.prop('parent_layout', this.get('id'));
},
onChangeLabel: function( e, $el ){
// vars
var label = $el.val();
var $name = this.$input('name');
// render name
if( $name.val() == '' ) {
acf.val($name, acf.strSanitize(label));
}
},
onClickAdd: function( e, $el ){
// vars
var prevKey = this.get('id');
var newKey = acf.uniqid('layout_');
// duplicate
$layout = acf.duplicate({
$el: this.$el,
search: prevKey,
replace: newKey,
after: function( $el, $el2 ){
// vars
var $list = $el2.find('.acf-field-list:first');
// remove sub fields
$list.children('.acf-field-object').remove();
// show empty
$list.addClass('-empty');
// reset layout meta values
$el2.find('.acf-fc-meta input').val('');
}
});
// get layout
var layout = acf.getFieldSetting( $layout );
// update hidden input
layout.$input('key').val( newKey );
// save
this.fieldObject.save();
},
onClickDuplicate: function( e, $el ){
// vars
var prevKey = this.get('id');
var newKey = acf.uniqid('layout_');
// duplicate
$layout = acf.duplicate({
$el: this.$el,
search: prevKey,
replace: newKey
});
// get all fields in new layout similar to fieldManager.onDuplicateField().
// important to run field.wipe() before making any changes to the "parent_layout" prop
// to ensure the correct input is modified.
var children = acf.getFieldObjects({ parent: $layout });
if( children.length ) {
// loop
children.map(function( child ){
// wipe field
child.wipe();
// update parent
child.updateParent();
});
// action
acf.doAction('duplicate_field_objects', children, this.fieldObject, this.fieldObject);
}
// get layout
var layout = acf.getFieldSetting( $layout );
// update hidden input
layout.$input('key').val( newKey );
// save
this.fieldObject.save();
},
onClickDelete: function( e, $el ){
// Bypass confirmation when holding down "shift" key.
if( e.shiftKey ) {
return this.delete();
}
// add class
this.$el.addClass('-hover');
// add tooltip
var tooltip = acf.newTooltip({
confirmRemove: true,
target: $el,
context: this,
confirm: function(){
this.delete();
},
cancel: function(){
this.$el.removeClass('-hover');
}
});
},
delete: function(){
// vars
var $siblings = this.$el.siblings('.acf-field-setting-fc_layout');
// validate
if( !$siblings.length ) {
alert( acf.__('Flexible Content requires at least 1 layout') );
return false;
}
// delete sub fields
this.getFields().map(function( child ){
child.delete({
animate: false
});
});
// remove tr
acf.remove( this.$el );
// save
this.fieldObject.save();
}
});
acf.registerFieldSetting( FlexibleContentLayoutFieldSetting );
/**
* flexibleContentHelper
*
* description
*
* @date 19/4/18
* @since 5.6.9
*
* @param type $var Description. Default.
* @return type Description.
*/
var flexibleContentHelper = new acf.Model({
actions: {
'sortstop_field_object': 'updateParentLayout',
'change_field_object_parent': 'updateParentLayout'
},
updateParentLayout: function( fieldObject ){
// vars
var parent = fieldObject.getParent();
// delete meta
if( !parent || parent.prop('type') !== 'flexible_content' ) {
fieldObject.prop('parent_layout', null);
return;
}
// get layout
var $layout = fieldObject.$el.closest('.acf-field-setting-fc_layout');
var layout = acf.getFieldSetting($layout);
// check if previous prop exists
// - if not, set prop to allow following code to trigger 'change' and save the field
if( !fieldObject.has('parent_layout') ) {
fieldObject.prop('parent_layout', 0);
}
// update meta
fieldObject.prop('parent_layout', layout.get('id'));
}
});
})(jQuery);
(function($){
/**
* CloneDisplayFieldSetting
*
* Extra logic for this field setting
*
* @date 18/4/18
* @since 5.6.9
*
* @param void
* @return void
*/
var CloneDisplayFieldSetting = acf.FieldSetting.extend({
type: 'clone',
name: 'display',
render: function(){
// vars
var display = this.field.val();
// set data attribute used by CSS to hide/show
this.$fieldObject.attr('data-display', display);
}
});
acf.registerFieldSetting( CloneDisplayFieldSetting );
/**
* ClonePrefixLabelFieldSetting
*
* Extra logic for this field setting
*
* @date 18/4/18
* @since 5.6.9
*
* @param void
* @return void
*/
var ClonePrefixLabelFieldSetting = acf.FieldSetting.extend({
type: 'clone',
name: 'prefix_label',
render: function(){
// vars
var prefix = '';
// if checked
if( this.field.val() ) {
prefix = this.fieldObject.prop('label') + ' ';
}
// update HTML
this.$('code').html( prefix + '%field_label%' );
}
});
acf.registerFieldSetting( ClonePrefixLabelFieldSetting );
/**
* ClonePrefixNameFieldSetting
*
* Extra logic for this field setting
*
* @date 18/4/18
* @since 5.6.9
*
* @param void
* @return void
*/
var ClonePrefixNameFieldSetting = acf.FieldSetting.extend({
type: 'clone',
name: 'prefix_name',
render: function(){
// vars
var prefix = '';
// if checked
if( this.field.val() ) {
prefix = this.fieldObject.prop('name') + '_';
}
// update HTML
this.$('code').html( prefix + '%field_name%' );
}
});
acf.registerFieldSetting( ClonePrefixNameFieldSetting );
/**
* cloneFieldSelectHelper
*
* Customizes the clone field setting Select2 isntance
*
* @date 18/4/18
* @since 5.6.9
*
* @param void
* @return void
*/
var cloneFieldSelectHelper = new acf.Model({
filters: {
'select2_args': 'select2Args'
},
select2Args: function( options, $select, data, $el, instance ){
// check
if( data.ajaxAction == 'acf/fields/clone/query' ) {
// remain open on select
options.closeOnSelect = false;
// customize ajaxData function
instance.data.ajaxData = this.ajaxData;
}
// return
return options;
},
ajaxData: function( data ){
// find current fields
data.fields = {};
// loop
acf.getFieldObjects().map(function(fieldObject){
// append
data.fields[ fieldObject.prop('key') ] = {
key: fieldObject.prop('key'),
type: fieldObject.prop('type'),
label: fieldObject.prop('label'),
ancestors: fieldObject.getParents().length
};
});
// append title
data.title = $('#title').val();
// return
return data;
}
});
})(jQuery);

View File

@@ -0,0 +1 @@
!function(){var e=acf.FieldSetting.extend({type:"repeater",name:"collapsed",events:{"focus select":"onFocus"},onFocus:function(e,t){var i=t,a=[];a.push({label:i.find('option[value=""]').text(),value:""});t=this.fieldObject.$(".acf-field-list:first");acf.getFieldObjects({list:t}).map(function(e){a.push({label:e.prop("label"),value:e.prop("key")})}),acf.renderSelect(i,a)}});acf.registerFieldSetting(e)}(jQuery),function(t){var e=acf.FieldSetting.extend({type:"flexible_content",name:"fc_layout",events:{"blur .layout-label":"onChangeLabel","click .add-layout":"onClickAdd","click .duplicate-layout":"onClickDuplicate","click .delete-layout":"onClickDelete"},$input:function(e){return t("#"+this.getInputId()+"-"+e)},$list:function(){return this.$(".acf-field-list:first")},getInputId:function(){return this.fieldObject.getInputId()+"-layouts-"+this.field.get("id")},getFields:function(){return acf.getFieldObjects({parent:this.$el})},getChildren:function(){return acf.getFieldObjects({list:this.$list()})},initialize:function(){var e=this.$el.parent();e.hasClass("ui-sortable")||e.sortable({items:"> .acf-field-setting-fc_layout",handle:".reorder-layout",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,stop:this.proxy(function(e,t){this.fieldObject.save()})}),this.updateFieldLayouts()},updateFieldLayouts:function(){this.getChildren().map(this.updateFieldLayout,this)},updateFieldLayout:function(e){e.prop("parent_layout",this.get("id"))},onChangeLabel:function(e,t){var i=t.val(),t=this.$input("name");""==t.val()&&acf.val(t,acf.strSanitize(i))},onClickAdd:function(e,t){var i=this.get("id"),a=acf.uniqid("layout_");$layout=acf.duplicate({$el:this.$el,search:i,replace:a,after:function(e,t){var i=t.find(".acf-field-list:first");i.children(".acf-field-object").remove(),i.addClass("-empty"),t.find(".acf-fc-meta input").val("")}}),acf.getFieldSetting($layout).$input("key").val(a),this.fieldObject.save()},onClickDuplicate:function(e,t){var i=this.get("id"),a=acf.uniqid("layout_");$layout=acf.duplicate({$el:this.$el,search:i,replace:a});i=acf.getFieldObjects({parent:$layout});i.length&&(i.map(function(e){e.wipe(),e.updateParent()}),acf.doAction("duplicate_field_objects",i,this.fieldObject,this.fieldObject)),acf.getFieldSetting($layout).$input("key").val(a),this.fieldObject.save()},onClickDelete:function(e,t){if(e.shiftKey)return this.delete();this.$el.addClass("-hover");acf.newTooltip({confirmRemove:!0,target:t,context:this,confirm:function(){this.delete()},cancel:function(){this.$el.removeClass("-hover")}})},delete:function(){if(!this.$el.siblings(".acf-field-setting-fc_layout").length)return alert(acf.__("Flexible Content requires at least 1 layout")),!1;this.getFields().map(function(e){e.delete({animate:!1})}),acf.remove(this.$el),this.fieldObject.save()}});acf.registerFieldSetting(e);new acf.Model({actions:{sortstop_field_object:"updateParentLayout",change_field_object_parent:"updateParentLayout"},updateParentLayout:function(e){var t=e.getParent();t&&"flexible_content"===t.prop("type")?(t=e.$el.closest(".acf-field-setting-fc_layout"),t=acf.getFieldSetting(t),e.has("parent_layout")||e.prop("parent_layout",0),e.prop("parent_layout",t.get("id"))):e.prop("parent_layout",null)}})}(jQuery),function(e){var t=acf.FieldSetting.extend({type:"clone",name:"display",render:function(){var e=this.field.val();this.$fieldObject.attr("data-display",e)}});acf.registerFieldSetting(t);t=acf.FieldSetting.extend({type:"clone",name:"prefix_label",render:function(){var e="";this.field.val()&&(e=this.fieldObject.prop("label")+" "),this.$("code").html(e+"%field_label%")}});acf.registerFieldSetting(t);t=acf.FieldSetting.extend({type:"clone",name:"prefix_name",render:function(){var e="";this.field.val()&&(e=this.fieldObject.prop("name")+"_"),this.$("code").html(e+"%field_name%")}});acf.registerFieldSetting(t);new acf.Model({filters:{select2_args:"select2Args"},select2Args:function(e,t,i,a,l){return"acf/fields/clone/query"==i.ajaxAction&&(e.closeOnSelect=!1,l.data.ajaxData=this.ajaxData),e},ajaxData:function(t){return t.fields={},acf.getFieldObjects().map(function(e){t.fields[e.prop("key")]={key:e.prop("key"),type:e.prop("type"),label:e.prop("label"),ancestors:e.getParents().length}}),t.title=e("#title").val(),t}})}(jQuery);

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,6 @@
<svg width="16" height="14" viewBox="0 0 16 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.0007 5.3894H1.03223" stroke="#425FDD" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8.8642 12.6272C8.4484 13.0748 7.74042 13.1294 7.26844 12.7363C7.22349 12.6927 7.17854 12.6599 7.14482 12.6162L1.27873 6.04436H1.2776C0.929234 5.6513 0.906759 5.08353 1.22142 4.66863L3.70495 1.43674C3.90723 1.15286 4.24437 1 4.60397 1H11.3466C11.695 1 12.0321 1.15286 12.2456 1.43674L14.7404 4.65771C15.0551 5.0617 15.0326 5.62946 14.6842 6.02253L8.8642 12.6272Z" stroke="#425FDD" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4.12207 1.15283L7.83052 12.9885" stroke="#425FDD" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.9096 1.15283L8.24609 12.9776" stroke="#425FDD" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -0,0 +1,635 @@
/**!
* wp-color-picker-alpha
*
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
* Only run in input and is defined data alpha in true
*
* Version: 3.0.0
* https://github.com/kallookoo/wp-color-picker-alpha
* Licensed under the GPLv2 license or later.
*/
( function( $, undef ) {
var wpColorPickerAlpha = {
'version' : 300
};
// Always try to use the last version of this script.
if ( 'wpColorPickerAlpha' in window && 'version' in window.wpColorPickerAlpha ) {
var version = parseInt( window.wpColorPickerAlpha.version, 10 );
if ( ! isNaN( version ) && version >= wpColorPickerAlpha.version ) {
return;
}
}
// Prevent multiple initiations
if ( Color.fn.hasOwnProperty( 'to_s' ) ) {
return;
}
// Create new method to replace the `Color.toString()` inside the scripts.
Color.fn.to_s = function( type ) {
type = ( type || 'hex' );
// Change hex to rgba to return the correct color.
if ( 'hex' === type && this._alpha < 1 ) {
type = 'rgba';
}
var color = '';
if ( 'hex' === type ) {
color = this.toString();
} else if ( ! this.error ) {
color = this.toCSS( type ).replace( /\(\s+/, '(' ).replace( /\s+\)/, ')' );
}
return color;
}
// Register the global variable.
window.wpColorPickerAlpha = wpColorPickerAlpha;
// Background image encoded
var backgroundImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==';
/**
* Iris
*/
$.widget( 'a8c.iris', $.a8c.iris, {
/**
* Alpha options
*
* @since 3.0.0
*
* @type {Object}
*/
alphaOptions: {
alphaEnabled: false,
},
/**
* Get the current color or the new color.
*
* @since 3.0.0
* @access private
*
* @param {Object|*} The color instance if not defined return the cuurent color.
*
* @return {string} The element's color.
*/
_getColor: function( color ) {
if ( color === undef ) {
color = this._color;
}
if ( this.alphaOptions.alphaEnabled ) {
color = color.to_s( this.alphaOptions.alphaColorType );
if ( ! this.alphaOptions.alphaColorWithSpace ) {
color = color.replace( /\s+/g, '' );
}
return color;
}
return color.toString();
},
/**
* Create widget
*
* @since 3.0.0
* @access private
*
* @return {void}
*/
_create: function() {
try {
// Try to get the wpColorPicker alpha options.
this.alphaOptions = this.element.wpColorPicker( 'instance' ).alphaOptions;
} catch( e ) {}
// We make sure there are all options
$.extend( {}, this.alphaOptions, {
alphaEnabled: false,
alphaCustomWidth: 130,
alphaReset: false,
alphaColorType: 'hex',
alphaColorWithSpace: false,
} );
this._super();
},
/**
* Binds event listeners to the Iris.
*
* @since 3.0.0
* @access private
*
* @return {void}
*/
_addInputListeners: function( input ) {
var self = this,
debounceTimeout = 100,
callback = function( event ){
var val = input.val(),
color = new Color( val ),
val = val.replace( /^(#|(rgb|hsl)a?)/, '' ),
type = self.alphaOptions.alphaColorType;
input.removeClass( 'iris-error' );
if ( ! color.error ) {
// let's not do this on keyup for hex shortcodes
if ( 'hex' !== type || ! ( event.type === 'keyup' && val.match( /^[0-9a-fA-F]{3}$/ ) ) ) {
// Compare color ( #AARRGGBB )
if ( color.toIEOctoHex() !== self._color.toIEOctoHex() ) {
self._setOption( 'color', self._getColor( color ) );
}
}
} else if ( val !== '' ) {
input.addClass( 'iris-error' );
}
};
input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) );
// If we initialized hidden, show on first focus. The rest is up to you.
if ( self.options.hide ) {
input.one( 'focus', function() {
self.show();
});
}
},
/**
* Init Controls
*
* @since 3.0.0
* @access private
*
* @return {void}
*/
_initControls: function() {
this._super();
if ( this.alphaOptions.alphaEnabled ) {
// Create Alpha controls
var self = this,
stripAlpha = self.controls.strip.clone(false, false),
stripAlphaSlider = stripAlpha.find( '.iris-slider-offset' ),
controls = {
stripAlpha : stripAlpha,
stripAlphaSlider : stripAlphaSlider
};
stripAlpha.addClass( 'iris-strip-alpha' );
stripAlphaSlider.addClass( 'iris-slider-offset-alpha' );
stripAlpha.appendTo( self.picker.find( '.iris-picker-inner' ) );
// Push new controls
$.each( controls, function( k, v ) {
self.controls[k] = v;
} );
// Create slider
self.controls.stripAlphaSlider.slider( {
orientation : 'vertical',
min : 0,
max : 100,
step : 1,
value : parseInt( self._color._alpha * 100 ),
slide : function( event, ui ) {
self.active = 'strip';
// Update alpha value
self._color._alpha = parseFloat( ui.value / 100 );
self._change.apply( self, arguments );
}
} );
}
},
/**
* Create the controls sizes
*
* @since 3.0.0
* @access private
*
* @param {bool} reset Set to True for recreate the controls sizes.
*
* @return {void}
*/
_dimensions: function( reset ) {
this._super( reset );
if ( this.alphaOptions.alphaEnabled ) {
var self = this,
opts = self.options,
controls = self.controls,
square = controls.square,
strip = self.picker.find( '.iris-strip' ),
innerWidth, squareWidth, stripWidth, stripMargin, totalWidth;
/**
* I use Math.round() to avoid possible size errors,
* this function returns the value of a number rounded
* to the nearest integer.
*
* The width to append all widgets,
* if border is enabled, 22 is subtracted.
* 20 for css left and right property
* 2 for css border
*/
innerWidth = Math.round( self.picker.outerWidth( true ) - ( opts.border ? 22 : 0 ) );
// The width of the draggable, aka square.
squareWidth = Math.round( square.outerWidth() );
// The width for the sliders
stripWidth = Math.round( ( innerWidth - squareWidth ) / 2 );
// The margin for the sliders
stripMargin = Math.round( stripWidth / 2 );
// The total width of the elements.
totalWidth = Math.round( squareWidth + ( stripWidth * 2 ) + ( stripMargin * 2 ) );
// Check and change if necessary.
while ( totalWidth > innerWidth ) {
stripWidth = Math.round( stripWidth - 2 );
stripMargin = Math.round( stripMargin - 1 );
totalWidth = Math.round( squareWidth + ( stripWidth * 2 ) + ( stripMargin * 2 ) );
}
square.css( 'margin', '0' );
strip.width( stripWidth ).css( 'margin-left', stripMargin + 'px' );
}
},
/**
* Callback to update the controls and the current color.
*
* @since 3.0.0
* @access private
*
* @return {void}
*/
_change: function() {
var self = this,
active = self.active;
self._super();
if ( self.alphaOptions.alphaEnabled ) {
var controls = self.controls,
alpha = parseInt( self._color._alpha * 100 ),
color = self._color.toRgb(),
gradient = [
'rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%',
'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'
],
target = self.picker.closest( '.wp-picker-container' ).find( '.wp-color-result' );
self.options.color = self._getColor();
// Generate background slider alpha, only for CSS3.
controls.stripAlpha.css( { 'background' : 'linear-gradient(to bottom, ' + gradient.join( ', ' ) + '), url(' + backgroundImage + ')' } );
// Update alpha value
if ( active ) {
controls.stripAlphaSlider.slider( 'value', alpha );
}
if ( ! self._color.error ) {
self.element.removeClass( 'iris-error' ).val( self.options.color );
}
self.picker.find( '.iris-palette-container' ).on( 'click.palette', '.iris-palette', function() {
var color = $( this ).data( 'color' );
if ( self.alphaOptions.alphaReset ) {
self._color._alpha = 1;
color = self._getColor();
}
self._setOption( 'color', color );
} );
}
},
/**
* Paint dimensions.
*
* @since 3.0.0
* @access private
*
* @param {string} origin Origin (position).
* @param {string} control Type of the control,
*
* @return {void}
*/
_paintDimension: function( origin, control ) {
var self = this,
color = false;
// Fix for slider hue opacity.
if ( self.alphaOptions.alphaEnabled && 'strip' === control ) {
color = self._color;
self._color = new Color( color.toString() );
self.hue = self._color.h();
}
self._super( origin, control );
// Restore the color after paint.
if ( color ) {
self._color = color;
}
},
/**
* To update the options, see original source to view the available options.
*
* @since 3.0.0
*
* @param {string} key The Option name.
* @param {mixed} value The Option value to update.
*
* @return {void}
*/
_setOption: function( key, value ) {
var self = this;
if ( 'color' === key && self.alphaOptions.alphaEnabled ) {
// cast to string in case we have a number
value = '' + value;
newColor = new Color( value ).setHSpace( self.options.mode );
// Check if error && Check the color to prevent callbacks with the same color.
if ( ! newColor.error && self._getColor( newColor ) !== self._getColor() ) {
self._color = newColor;
self.options.color = self._getColor();
self.active = 'external';
self._change();
}
} else {
return self._super( key, value );
}
},
/**
* Returns the iris object if no new color is provided. If a new color is provided, it sets the new color.
*
* @param newColor {string|*} The new color to use. Can be undefined.
*
* @since 3.0.0
*
* @return {string} The element's color.
*/
color: function( newColor ) {
if ( newColor === true ) {
return this._color.clone();
}
if ( newColor === undef ) {
return this._getColor();
}
this.option( 'color', newColor );
},
} );
/**
* wpColorPicker
*/
$.widget( 'wp.wpColorPicker', $.wp.wpColorPicker, {
/**
* Alpha options
*
* @since 3.0.0
*
* @type {Object}
*/
alphaOptions: {
alphaEnabled: false,
},
/**
* Get the alpha options.
*
* @since 3.0.0
* @access private
*
* @return {object} The current alpha options.
*/
_getAlphaOptions: function() {
var el = this.element,
type = ( el.data( 'type' ) || this.options.type ),
color = ( el.data( 'defaultColor' ) || el.val() ),
options = {
alphaEnabled: ( el.data( 'alphaEnabled' ) || false ),
alphaCustomWidth: 130,
alphaReset: false,
alphaColorType: 'rgb',
alphaColorWithSpace: false,
};
if ( options.alphaEnabled ) {
options.alphaEnabled = ( el.is( 'input' ) && 'full' === type );
}
if ( ! options.alphaEnabled ) {
return options;
}
options.alphaColorWithSpace = ( color && color.match( /\s/ ) );
$.each( options, function( name, defaultValue ) {
var value = ( el.data( name ) || defaultValue );
switch ( name ) {
case 'alphaCustomWidth':
value = ( value ? parseInt( value, 10 ) : 0 );
value = ( isNaN( value ) ? defaultValue : value );
break;
case 'alphaColorType':
if ( ! value.match( /^(hex|(rgb|hsl)a?)$/ ) ) {
if ( color && color.match( /^#/ ) ) {
value = 'hex';
} else if ( color && color.match( /^hsla?/ ) ) {
value = 'hsl';
} else {
value = defaultValue;
}
}
break;
default:
value = !!value;
break;
}
options[name] = value;
} );
return options;
},
/**
* Create widget
*
* @since 3.0.0
* @access private
*
* @return {void}
*/
_create: function() {
// Return early if Iris support is missing.
if ( ! $.support.iris ) {
return;
}
// Set the alpha options for the current instance.
this.alphaOptions = this._getAlphaOptions();
// Create widget.
this._super();
},
/**
* Binds event listeners to the color picker and create options, etc...
*
* @since 3.0.0
* @access private
*
* @return {void}
*/
_addListeners: function() {
if ( ! this.alphaOptions.alphaEnabled ) {
return this._super();
}
var self = this,
el = self.element,
isDeprecated = self.toggler.is( 'a' );
this.alphaOptions.defaultWidth = el.width();
if ( this.alphaOptions.alphaCustomWidth ) {
el.width( parseInt( this.alphaOptions.defaultWidth + this.alphaOptions.alphaCustomWidth, 10 ) );
}
self.toggler.css( {
'position': 'relative',
'background-image' : 'url(' + backgroundImage + ')'
} );
if ( isDeprecated ) {
self.toggler.html( '<span class="color-alpha" />' );
} else {
self.toggler.append( '<span class="color-alpha" />' );
}
self.colorAlpha = self.toggler.find( 'span.color-alpha' ).css( {
'width' : '30px',
'height' : '100%',
'position' : 'absolute',
'top' : 0,
'background-color' : el.val(),
} );
// Define the correct position for ltr or rtl direction.
if ( 'ltr' === self.colorAlpha.css( 'direction' ) ) {
self.colorAlpha.css( {
'border-bottom-left-radius' : '2px',
'border-top-left-radius' : '2px',
'left' : 0
} );
} else {
self.colorAlpha.css( {
'border-bottom-right-radius' : '2px',
'border-top-right-radius' : '2px',
'right' : 0
} );
}
el.iris( {
/**
* @summary Handles the onChange event if one has been defined in the options.
*
* Handles the onChange event if one has been defined in the options and additionally
* sets the background color for the toggler element.
*
* @since 3.0.0
*
* @param {Event} event The event that's being called.
* @param {HTMLElement} ui The HTMLElement containing the color picker.
*
* @returns {void}
*/
change: function( event, ui ) {
self.colorAlpha.css( { 'background-color': ui.color.to_s( self.alphaOptions.alphaColorType ) } );
// fire change callback if we have one
if ( $.isFunction( self.options.change ) ) {
self.options.change.call( this, event, ui );
}
}
} );
/**
* Prevent any clicks inside this widget from leaking to the top and closing it.
*
* @since 3.0.0
*
* @param {Event} event The event that's being called.
*
* @return {void}
*/
self.wrap.on( 'click.wpcolorpicker', function( event ) {
event.stopPropagation();
});
/**
* Open or close the color picker depending on the class.
*
* @since 3.0.0
*/
self.toggler.click( function() {
if ( self.toggler.hasClass( 'wp-picker-open' ) ) {
self.close();
} else {
self.open();
}
});
/**
* Checks if value is empty when changing the color in the color picker.
* If so, the background color is cleared.
*
* @since 3.0.0
*
* @param {Event} event The event that's being called.
*
* @return {void}
*/
el.change( function( event ) {
var val = $( this ).val();
if ( el.hasClass( 'iris-error' ) || val === '' || val.match( /^(#|(rgb|hsl)a?)$/ ) ) {
if ( isDeprecated ) {
self.toggler.removeAttr( 'style' );
}
self.colorAlpha.css( 'background-color', '' );
// fire clear callback if we have one
if ( $.isFunction( self.options.clear ) ) {
self.options.clear.call( this, event );
}
}
} );
/**
* Enables the user to either clear the color in the color picker or revert back to the default color.
*
* @since 3.0.0
*
* @param {Event} event The event that's being called.
*
* @return {void}
*/
self.button.click( function( event ) {
if ( $( this ).hasClass( 'wp-picker-default' ) ) {
el.val( self.options.defaultColor ).change();
} else if ( $( this ).hasClass( 'wp-picker-clear' ) ) {
el.val( '' );
if ( isDeprecated ) {
self.toggler.removeAttr( 'style' );
}
self.colorAlpha.css( 'background-color', '' );
// fire clear callback if we have one
if ( $.isFunction( self.options.clear ) ) {
self.options.clear.call( this, event );
}
el.trigger( 'change' );
}
} );
},
} );
} ( jQuery ) );

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,650 @@
/*! jQuery UI - v1.11.4 - 2016-05-31
* http://jqueryui.com
* Includes: core.css, datepicker.css, theme.css
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=%22Open%20Sans%22%2C%E2%80%8B%20sans-serif&fsDefault=14px&fwDefault=normal&cornerRadius=3&bgColorHeader=%23ffffff&bgTextureHeader=highlight_soft&borderColorHeader=%23ffffff&fcHeader=%23222222&iconColorHeader=%23DDDDDD&bgColorContent=%23ffffff&bgTextureContent=flat&borderColorContent=%23E1E1E1&fcContent=%23444444&iconColorContent=%23444444&bgColorDefault=%23F9F9F9&bgTextureDefault=flat&borderColorDefault=%23F0F0F0&fcDefault=%23444444&iconColorDefault=%23444444&bgColorHover=%2398b7e8&bgTextureHover=flat&borderColorHover=%2398b7e8&fcHover=%23ffffff&iconColorHover=%23ffffff&bgColorActive=%233875d7&bgTextureActive=flat&borderColorActive=%233875d7&fcActive=%23ffffff&iconColorActive=%23ffffff&bgColorHighlight=%23ffffff&bgTextureHighlight=flat&borderColorHighlight=%23aaaaaa&fcHighlight=%23444444&iconColorHighlight=%23444444&bgColorError=%23E14D43&bgTextureError=flat&borderColorError=%23E14D43&fcError=%23ffffff&iconColorError=%23ffffff&bgColorOverlay=%23ffffff&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=%23aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px&bgImgOpacityHeader=0&bgImgOpacityContent=&bgImgOpacityDefault=0&bgImgOpacityHover=0&bgImgOpacityActive=0&bgImgOpacityHighlight=0&bgImgOpacityError=0
* Copyright jQuery Foundation and other contributors; Licensed MIT */
/* Layout helpers
----------------------------------*/
.ui-helper-hidden {
display: none;
}
.ui-helper-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.ui-helper-reset {
margin: 0;
padding: 0;
border: 0;
outline: 0;
line-height: 1.3;
text-decoration: none;
font-size: 100%;
list-style: none;
}
.ui-helper-clearfix:before,
.ui-helper-clearfix:after {
content: "";
display: table;
border-collapse: collapse;
}
.ui-helper-clearfix:after {
clear: both;
}
.ui-helper-clearfix {
min-height: 0; /* support: IE7 */
}
.ui-helper-zfix {
width: 100%;
height: 100%;
top: 0;
left: 0;
position: absolute;
opacity: 0;
filter:Alpha(Opacity=0); /* support: IE8 */
}
.ui-front {
z-index: 100;
}
/* Interaction Cues
----------------------------------*/
.ui-state-disabled {
cursor: default !important;
}
/* Icons
----------------------------------*/
/* states and images */
.ui-icon {
display: block;
text-indent: -99999px;
overflow: hidden;
background-repeat: no-repeat;
}
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.ui-datepicker {
width: 17em;
padding: .2em .2em 0;
display: none;
}
.ui-datepicker .ui-datepicker-header {
position: relative;
padding: .2em 0;
}
.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next {
position: absolute;
top: 2px;
width: 1.8em;
height: 1.8em;
}
.ui-datepicker .ui-datepicker-prev-hover,
.ui-datepicker .ui-datepicker-next-hover {
top: 1px;
}
.ui-datepicker .ui-datepicker-prev {
left: 2px;
}
.ui-datepicker .ui-datepicker-next {
right: 2px;
}
.ui-datepicker .ui-datepicker-prev-hover {
left: 1px;
}
.ui-datepicker .ui-datepicker-next-hover {
right: 1px;
}
.ui-datepicker .ui-datepicker-prev span,
.ui-datepicker .ui-datepicker-next span {
display: block;
position: absolute;
left: 50%;
margin-left: -8px;
top: 50%;
margin-top: -8px;
}
.ui-datepicker .ui-datepicker-title {
margin: 0 2.3em;
line-height: 1.8em;
text-align: center;
}
.ui-datepicker .ui-datepicker-title select {
font-size: 1em;
margin: 1px 0;
}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year {
width: 45%;
}
.ui-datepicker table {
width: 100%;
font-size: .9em;
border-collapse: collapse;
margin: 0 0 .4em;
}
.ui-datepicker th {
padding: .7em .3em;
text-align: center;
font-weight: bold;
border: 0;
}
.ui-datepicker td {
border: 0;
padding: 1px;
}
.ui-datepicker td span,
.ui-datepicker td a {
display: block;
padding: .2em;
text-align: right;
text-decoration: none;
}
.ui-datepicker .ui-datepicker-buttonpane {
background-image: none;
margin: .7em 0 0 0;
padding: 0 .2em;
border-left: 0;
border-right: 0;
border-bottom: 0;
}
.ui-datepicker .ui-datepicker-buttonpane button {
float: right;
margin: .5em .2em .4em;
cursor: pointer;
padding: .2em .6em .3em .6em;
width: auto;
overflow: visible;
}
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
float: left;
}
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi {
width: auto;
}
.ui-datepicker-multi .ui-datepicker-group {
float: left;
}
.ui-datepicker-multi .ui-datepicker-group table {
width: 95%;
margin: 0 auto .4em;
}
.ui-datepicker-multi-2 .ui-datepicker-group {
width: 50%;
}
.ui-datepicker-multi-3 .ui-datepicker-group {
width: 33.3%;
}
.ui-datepicker-multi-4 .ui-datepicker-group {
width: 25%;
}
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
border-left-width: 0;
}
.ui-datepicker-multi .ui-datepicker-buttonpane {
clear: left;
}
.ui-datepicker-row-break {
clear: both;
width: 100%;
font-size: 0;
}
/* RTL support */
.ui-datepicker-rtl {
direction: rtl;
}
.ui-datepicker-rtl .ui-datepicker-prev {
right: 2px;
left: auto;
}
.ui-datepicker-rtl .ui-datepicker-next {
left: 2px;
right: auto;
}
.ui-datepicker-rtl .ui-datepicker-prev:hover {
right: 1px;
left: auto;
}
.ui-datepicker-rtl .ui-datepicker-next:hover {
left: 1px;
right: auto;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane {
clear: right;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane button {
float: left;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
.ui-datepicker-rtl .ui-datepicker-group {
float: right;
}
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
border-right-width: 0;
border-left-width: 1px;
}
/* Component containers
----------------------------------*/
.acf-ui-datepicker .ui-widget {
font-family: inherit;
font-size: 14px;
}
.acf-ui-datepicker .ui-widget .ui-widget {
font-size: 1em;
}
.acf-ui-datepicker .ui-widget input,
.acf-ui-datepicker .ui-widget select,
.acf-ui-datepicker .ui-widget textarea,
.acf-ui-datepicker .ui-widget button {
font-family: inherit;
font-size: 1em;
}
.acf-ui-datepicker .ui-widget-content {
border: 1px solid #E1E1E1;
background: #ffffff;
color: #444444;
}
.acf-ui-datepicker .ui-widget-content a {
color: #444444;
}
.acf-ui-datepicker .ui-widget-header {
border: 1px solid #ffffff;
background: #ffffff url("images/ui-bg_highlight-soft_0_ffffff_1x100.png") 50% 50% repeat-x;
color: #222222;
font-weight: bold;
}
.acf-ui-datepicker .ui-widget-header a {
color: #222222;
}
/* Interaction states
----------------------------------*/
.acf-ui-datepicker .ui-state-default,
.acf-ui-datepicker .ui-widget-content .ui-state-default,
.acf-ui-datepicker .ui-widget-header .ui-state-default {
border: 1px solid #F0F0F0;
background: #F9F9F9;
font-weight: normal;
color: #444444;
}
.acf-ui-datepicker .ui-state-default a,
.acf-ui-datepicker .ui-state-default a:link,
.acf-ui-datepicker .ui-state-default a:visited {
color: #444444;
text-decoration: none;
}
.acf-ui-datepicker .ui-state-hover,
.acf-ui-datepicker .ui-widget-content .ui-state-hover,
.acf-ui-datepicker .ui-widget-header .ui-state-hover,
.acf-ui-datepicker .ui-state-focus,
.acf-ui-datepicker .ui-widget-content .ui-state-focus,
.acf-ui-datepicker .ui-widget-header .ui-state-focus {
border: 1px solid #98b7e8;
background: #98b7e8;
font-weight: normal;
color: #ffffff;
}
.acf-ui-datepicker .ui-state-hover a,
.acf-ui-datepicker .ui-state-hover a:hover,
.acf-ui-datepicker .ui-state-hover a:link,
.acf-ui-datepicker .ui-state-hover a:visited,
.acf-ui-datepicker .ui-state-focus a,
.acf-ui-datepicker .ui-state-focus a:hover,
.acf-ui-datepicker .ui-state-focus a:link,
.acf-ui-datepicker .ui-state-focus a:visited {
color: #ffffff;
text-decoration: none;
}
.acf-ui-datepicker .ui-state-active,
.acf-ui-datepicker .ui-widget-content .ui-state-active,
.acf-ui-datepicker .ui-widget-header .ui-state-active {
border: 1px solid #3875d7;
background: #3875d7;
font-weight: normal;
color: #ffffff;
}
.acf-ui-datepicker .ui-state-active a,
.acf-ui-datepicker .ui-state-active a:link,
.acf-ui-datepicker .ui-state-active a:visited {
color: #ffffff;
text-decoration: none;
}
/* Interaction Cues
----------------------------------*/
.acf-ui-datepicker .ui-state-highlight,
.acf-ui-datepicker .ui-widget-content .ui-state-highlight,
.acf-ui-datepicker .ui-widget-header .ui-state-highlight {
border: 1px solid #aaaaaa;
background: #ffffff;
color: #444444;
}
.acf-ui-datepicker .ui-state-highlight a,
.acf-ui-datepicker .ui-widget-content .ui-state-highlight a,
.acf-ui-datepicker .ui-widget-header .ui-state-highlight a {
color: #444444;
}
.acf-ui-datepicker .ui-state-error,
.acf-ui-datepicker .ui-widget-content .ui-state-error,
.acf-ui-datepicker .ui-widget-header .ui-state-error {
border: 1px solid #E14D43;
background: #E14D43;
color: #ffffff;
}
.acf-ui-datepicker .ui-state-error a,
.acf-ui-datepicker .ui-widget-content .ui-state-error a,
.acf-ui-datepicker .ui-widget-header .ui-state-error a {
color: #ffffff;
}
.acf-ui-datepicker .ui-state-error-text,
.acf-ui-datepicker .ui-widget-content .ui-state-error-text,
.acf-ui-datepicker .ui-widget-header .ui-state-error-text {
color: #ffffff;
}
.acf-ui-datepicker .ui-priority-primary,
.acf-ui-datepicker .ui-widget-content .ui-priority-primary,
.acf-ui-datepicker .ui-widget-header .ui-priority-primary {
font-weight: bold;
}
.acf-ui-datepicker .ui-priority-secondary,
.acf-ui-datepicker .ui-widget-content .ui-priority-secondary,
.acf-ui-datepicker .ui-widget-header .ui-priority-secondary {
opacity: .7;
filter:Alpha(Opacity=70); /* support: IE8 */
font-weight: normal;
}
.acf-ui-datepicker .ui-state-disabled,
.acf-ui-datepicker .ui-widget-content .ui-state-disabled,
.acf-ui-datepicker .ui-widget-header .ui-state-disabled {
opacity: .35;
filter:Alpha(Opacity=35); /* support: IE8 */
background-image: none;
}
.acf-ui-datepicker .ui-state-disabled .ui-icon {
filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
}
/* Icons
----------------------------------*/
/* states and images */
.acf-ui-datepicker .ui-icon {
width: 16px;
height: 16px;
}
.acf-ui-datepicker .ui-icon,
.acf-ui-datepicker .ui-widget-content .ui-icon {
background-image: url("images/ui-icons_444444_256x240.png");
}
.acf-ui-datepicker .ui-widget-header .ui-icon {
background-image: url("images/ui-icons_DDDDDD_256x240.png");
}
.acf-ui-datepicker .ui-state-default .ui-icon {
background-image: url("images/ui-icons_444444_256x240.png");
}
.acf-ui-datepicker .ui-state-hover .ui-icon,
.acf-ui-datepicker .ui-state-focus .ui-icon {
background-image: url("images/ui-icons_ffffff_256x240.png");
}
.acf-ui-datepicker .ui-state-active .ui-icon {
background-image: url("images/ui-icons_ffffff_256x240.png");
}
.acf-ui-datepicker .ui-state-highlight .ui-icon {
background-image: url("images/ui-icons_444444_256x240.png");
}
.acf-ui-datepicker .ui-state-error .ui-icon,
.acf-ui-datepicker .ui-state-error-text .ui-icon {
background-image: url("images/ui-icons_ffffff_256x240.png");
}
/* positioning */
.acf-ui-datepicker .ui-icon-blank { background-position: 16px 16px; }
.acf-ui-datepicker .ui-icon-carat-1-n { background-position: 0 0; }
.acf-ui-datepicker .ui-icon-carat-1-ne { background-position: -16px 0; }
.acf-ui-datepicker .ui-icon-carat-1-e { background-position: -32px 0; }
.acf-ui-datepicker .ui-icon-carat-1-se { background-position: -48px 0; }
.acf-ui-datepicker .ui-icon-carat-1-s { background-position: -64px 0; }
.acf-ui-datepicker .ui-icon-carat-1-sw { background-position: -80px 0; }
.acf-ui-datepicker .ui-icon-carat-1-w { background-position: -96px 0; }
.acf-ui-datepicker .ui-icon-carat-1-nw { background-position: -112px 0; }
.acf-ui-datepicker .ui-icon-carat-2-n-s { background-position: -128px 0; }
.acf-ui-datepicker .ui-icon-carat-2-e-w { background-position: -144px 0; }
.acf-ui-datepicker .ui-icon-triangle-1-n { background-position: 0 -16px; }
.acf-ui-datepicker .ui-icon-triangle-1-ne { background-position: -16px -16px; }
.acf-ui-datepicker .ui-icon-triangle-1-e { background-position: -32px -16px; }
.acf-ui-datepicker .ui-icon-triangle-1-se { background-position: -48px -16px; }
.acf-ui-datepicker .ui-icon-triangle-1-s { background-position: -64px -16px; }
.acf-ui-datepicker .ui-icon-triangle-1-sw { background-position: -80px -16px; }
.acf-ui-datepicker .ui-icon-triangle-1-w { background-position: -96px -16px; }
.acf-ui-datepicker .ui-icon-triangle-1-nw { background-position: -112px -16px; }
.acf-ui-datepicker .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.acf-ui-datepicker .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.acf-ui-datepicker .ui-icon-arrow-1-n { background-position: 0 -32px; }
.acf-ui-datepicker .ui-icon-arrow-1-ne { background-position: -16px -32px; }
.acf-ui-datepicker .ui-icon-arrow-1-e { background-position: -32px -32px; }
.acf-ui-datepicker .ui-icon-arrow-1-se { background-position: -48px -32px; }
.acf-ui-datepicker .ui-icon-arrow-1-s { background-position: -64px -32px; }
.acf-ui-datepicker .ui-icon-arrow-1-sw { background-position: -80px -32px; }
.acf-ui-datepicker .ui-icon-arrow-1-w { background-position: -96px -32px; }
.acf-ui-datepicker .ui-icon-arrow-1-nw { background-position: -112px -32px; }
.acf-ui-datepicker .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.acf-ui-datepicker .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.acf-ui-datepicker .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.acf-ui-datepicker .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.acf-ui-datepicker .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.acf-ui-datepicker .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.acf-ui-datepicker .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.acf-ui-datepicker .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.acf-ui-datepicker .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.acf-ui-datepicker .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.acf-ui-datepicker .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.acf-ui-datepicker .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.acf-ui-datepicker .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.acf-ui-datepicker .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.acf-ui-datepicker .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.acf-ui-datepicker .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.acf-ui-datepicker .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.acf-ui-datepicker .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.acf-ui-datepicker .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.acf-ui-datepicker .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.acf-ui-datepicker .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.acf-ui-datepicker .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.acf-ui-datepicker .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.acf-ui-datepicker .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.acf-ui-datepicker .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.acf-ui-datepicker .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.acf-ui-datepicker .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.acf-ui-datepicker .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.acf-ui-datepicker .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.acf-ui-datepicker .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.acf-ui-datepicker .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.acf-ui-datepicker .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.acf-ui-datepicker .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.acf-ui-datepicker .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.acf-ui-datepicker .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.acf-ui-datepicker .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.acf-ui-datepicker .ui-icon-arrow-4 { background-position: 0 -80px; }
.acf-ui-datepicker .ui-icon-arrow-4-diag { background-position: -16px -80px; }
.acf-ui-datepicker .ui-icon-extlink { background-position: -32px -80px; }
.acf-ui-datepicker .ui-icon-newwin { background-position: -48px -80px; }
.acf-ui-datepicker .ui-icon-refresh { background-position: -64px -80px; }
.acf-ui-datepicker .ui-icon-shuffle { background-position: -80px -80px; }
.acf-ui-datepicker .ui-icon-transfer-e-w { background-position: -96px -80px; }
.acf-ui-datepicker .ui-icon-transferthick-e-w { background-position: -112px -80px; }
.acf-ui-datepicker .ui-icon-folder-collapsed { background-position: 0 -96px; }
.acf-ui-datepicker .ui-icon-folder-open { background-position: -16px -96px; }
.acf-ui-datepicker .ui-icon-document { background-position: -32px -96px; }
.acf-ui-datepicker .ui-icon-document-b { background-position: -48px -96px; }
.acf-ui-datepicker .ui-icon-note { background-position: -64px -96px; }
.acf-ui-datepicker .ui-icon-mail-closed { background-position: -80px -96px; }
.acf-ui-datepicker .ui-icon-mail-open { background-position: -96px -96px; }
.acf-ui-datepicker .ui-icon-suitcase { background-position: -112px -96px; }
.acf-ui-datepicker .ui-icon-comment { background-position: -128px -96px; }
.acf-ui-datepicker .ui-icon-person { background-position: -144px -96px; }
.acf-ui-datepicker .ui-icon-print { background-position: -160px -96px; }
.acf-ui-datepicker .ui-icon-trash { background-position: -176px -96px; }
.acf-ui-datepicker .ui-icon-locked { background-position: -192px -96px; }
.acf-ui-datepicker .ui-icon-unlocked { background-position: -208px -96px; }
.acf-ui-datepicker .ui-icon-bookmark { background-position: -224px -96px; }
.acf-ui-datepicker .ui-icon-tag { background-position: -240px -96px; }
.acf-ui-datepicker .ui-icon-home { background-position: 0 -112px; }
.acf-ui-datepicker .ui-icon-flag { background-position: -16px -112px; }
.acf-ui-datepicker .ui-icon-calendar { background-position: -32px -112px; }
.acf-ui-datepicker .ui-icon-cart { background-position: -48px -112px; }
.acf-ui-datepicker .ui-icon-pencil { background-position: -64px -112px; }
.acf-ui-datepicker .ui-icon-clock { background-position: -80px -112px; }
.acf-ui-datepicker .ui-icon-disk { background-position: -96px -112px; }
.acf-ui-datepicker .ui-icon-calculator { background-position: -112px -112px; }
.acf-ui-datepicker .ui-icon-zoomin { background-position: -128px -112px; }
.acf-ui-datepicker .ui-icon-zoomout { background-position: -144px -112px; }
.acf-ui-datepicker .ui-icon-search { background-position: -160px -112px; }
.acf-ui-datepicker .ui-icon-wrench { background-position: -176px -112px; }
.acf-ui-datepicker .ui-icon-gear { background-position: -192px -112px; }
.acf-ui-datepicker .ui-icon-heart { background-position: -208px -112px; }
.acf-ui-datepicker .ui-icon-star { background-position: -224px -112px; }
.acf-ui-datepicker .ui-icon-link { background-position: -240px -112px; }
.acf-ui-datepicker .ui-icon-cancel { background-position: 0 -128px; }
.acf-ui-datepicker .ui-icon-plus { background-position: -16px -128px; }
.acf-ui-datepicker .ui-icon-plusthick { background-position: -32px -128px; }
.acf-ui-datepicker .ui-icon-minus { background-position: -48px -128px; }
.acf-ui-datepicker .ui-icon-minusthick { background-position: -64px -128px; }
.acf-ui-datepicker .ui-icon-close { background-position: -80px -128px; }
.acf-ui-datepicker .ui-icon-closethick { background-position: -96px -128px; }
.acf-ui-datepicker .ui-icon-key { background-position: -112px -128px; }
.acf-ui-datepicker .ui-icon-lightbulb { background-position: -128px -128px; }
.acf-ui-datepicker .ui-icon-scissors { background-position: -144px -128px; }
.acf-ui-datepicker .ui-icon-clipboard { background-position: -160px -128px; }
.acf-ui-datepicker .ui-icon-copy { background-position: -176px -128px; }
.acf-ui-datepicker .ui-icon-contact { background-position: -192px -128px; }
.acf-ui-datepicker .ui-icon-image { background-position: -208px -128px; }
.acf-ui-datepicker .ui-icon-video { background-position: -224px -128px; }
.acf-ui-datepicker .ui-icon-script { background-position: -240px -128px; }
.acf-ui-datepicker .ui-icon-alert { background-position: 0 -144px; }
.acf-ui-datepicker .ui-icon-info { background-position: -16px -144px; }
.acf-ui-datepicker .ui-icon-notice { background-position: -32px -144px; }
.acf-ui-datepicker .ui-icon-help { background-position: -48px -144px; }
.acf-ui-datepicker .ui-icon-check { background-position: -64px -144px; }
.acf-ui-datepicker .ui-icon-bullet { background-position: -80px -144px; }
.acf-ui-datepicker .ui-icon-radio-on { background-position: -96px -144px; }
.acf-ui-datepicker .ui-icon-radio-off { background-position: -112px -144px; }
.acf-ui-datepicker .ui-icon-pin-w { background-position: -128px -144px; }
.acf-ui-datepicker .ui-icon-pin-s { background-position: -144px -144px; }
.acf-ui-datepicker .ui-icon-play { background-position: 0 -160px; }
.acf-ui-datepicker .ui-icon-pause { background-position: -16px -160px; }
.acf-ui-datepicker .ui-icon-seek-next { background-position: -32px -160px; }
.acf-ui-datepicker .ui-icon-seek-prev { background-position: -48px -160px; }
.acf-ui-datepicker .ui-icon-seek-end { background-position: -64px -160px; }
.acf-ui-datepicker .ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.acf-ui-datepicker .ui-icon-seek-first { background-position: -80px -160px; }
.acf-ui-datepicker .ui-icon-stop { background-position: -96px -160px; }
.acf-ui-datepicker .ui-icon-eject { background-position: -112px -160px; }
.acf-ui-datepicker .ui-icon-volume-off { background-position: -128px -160px; }
.acf-ui-datepicker .ui-icon-volume-on { background-position: -144px -160px; }
.acf-ui-datepicker .ui-icon-power { background-position: 0 -176px; }
.acf-ui-datepicker .ui-icon-signal-diag { background-position: -16px -176px; }
.acf-ui-datepicker .ui-icon-signal { background-position: -32px -176px; }
.acf-ui-datepicker .ui-icon-battery-0 { background-position: -48px -176px; }
.acf-ui-datepicker .ui-icon-battery-1 { background-position: -64px -176px; }
.acf-ui-datepicker .ui-icon-battery-2 { background-position: -80px -176px; }
.acf-ui-datepicker .ui-icon-battery-3 { background-position: -96px -176px; }
.acf-ui-datepicker .ui-icon-circle-plus { background-position: 0 -192px; }
.acf-ui-datepicker .ui-icon-circle-minus { background-position: -16px -192px; }
.acf-ui-datepicker .ui-icon-circle-close { background-position: -32px -192px; }
.acf-ui-datepicker .ui-icon-circle-triangle-e { background-position: -48px -192px; }
.acf-ui-datepicker .ui-icon-circle-triangle-s { background-position: -64px -192px; }
.acf-ui-datepicker .ui-icon-circle-triangle-w { background-position: -80px -192px; }
.acf-ui-datepicker .ui-icon-circle-triangle-n { background-position: -96px -192px; }
.acf-ui-datepicker .ui-icon-circle-arrow-e { background-position: -112px -192px; }
.acf-ui-datepicker .ui-icon-circle-arrow-s { background-position: -128px -192px; }
.acf-ui-datepicker .ui-icon-circle-arrow-w { background-position: -144px -192px; }
.acf-ui-datepicker .ui-icon-circle-arrow-n { background-position: -160px -192px; }
.acf-ui-datepicker .ui-icon-circle-zoomin { background-position: -176px -192px; }
.acf-ui-datepicker .ui-icon-circle-zoomout { background-position: -192px -192px; }
.acf-ui-datepicker .ui-icon-circle-check { background-position: -208px -192px; }
.acf-ui-datepicker .ui-icon-circlesmall-plus { background-position: 0 -208px; }
.acf-ui-datepicker .ui-icon-circlesmall-minus { background-position: -16px -208px; }
.acf-ui-datepicker .ui-icon-circlesmall-close { background-position: -32px -208px; }
.acf-ui-datepicker .ui-icon-squaresmall-plus { background-position: -48px -208px; }
.acf-ui-datepicker .ui-icon-squaresmall-minus { background-position: -64px -208px; }
.acf-ui-datepicker .ui-icon-squaresmall-close { background-position: -80px -208px; }
.acf-ui-datepicker .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.acf-ui-datepicker .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.acf-ui-datepicker .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.acf-ui-datepicker .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.acf-ui-datepicker .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.acf-ui-datepicker .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.acf-ui-datepicker .ui-corner-all,
.acf-ui-datepicker .ui-corner-top,
.acf-ui-datepicker .ui-corner-left,
.acf-ui-datepicker .ui-corner-tl {
border-top-left-radius: 3px;
}
.acf-ui-datepicker .ui-corner-all,
.acf-ui-datepicker .ui-corner-top,
.acf-ui-datepicker .ui-corner-right,
.acf-ui-datepicker .ui-corner-tr {
border-top-right-radius: 3px;
}
.acf-ui-datepicker .ui-corner-all,
.acf-ui-datepicker .ui-corner-bottom,
.acf-ui-datepicker .ui-corner-left,
.acf-ui-datepicker .ui-corner-bl {
border-bottom-left-radius: 3px;
}
.acf-ui-datepicker .ui-corner-all,
.acf-ui-datepicker .ui-corner-bottom,
.acf-ui-datepicker .ui-corner-right,
.acf-ui-datepicker .ui-corner-br {
border-bottom-right-radius: 3px;
}
/* Overlays */
.acf-ui-datepicker .ui-widget-overlay {
background: #ffffff;
opacity: .3;
filter: Alpha(Opacity=30); /* support: IE8 */
}
.acf-ui-datepicker .ui-widget-shadow {
margin: -8px 0 0 -8px;
padding: 8px;
background: #aaaaaa;
opacity: .3;
filter: Alpha(Opacity=30); /* support: IE8 */
border-radius: 8px;
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,704 @@
/*
Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014
*/
.select2-container {
margin: 0;
position: relative;
display: inline-block;
/* inline-block for ie7 */
zoom: 1;
*display: inline;
vertical-align: middle;
}
.select2-container,
.select2-drop,
.select2-search,
.select2-search input {
/*
Force border-box so that % widths fit the parent
container without overlap because of margin/padding.
More Info : http://www.quirksmode.org/css/box.html
*/
-webkit-box-sizing: border-box; /* webkit */
-moz-box-sizing: border-box; /* firefox */
box-sizing: border-box; /* css3 */
}
.select2-container .select2-choice {
display: block;
height: 26px;
padding: 0 0 0 8px;
overflow: hidden;
position: relative;
border: 1px solid #aaa;
white-space: nowrap;
line-height: 26px;
color: #444;
text-decoration: none;
border-radius: 4px;
background-clip: padding-box;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #fff;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.5, #fff));
background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 50%);
background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 50%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#eeeeee', GradientType = 0);
background-image: linear-gradient(to top, #eee 0%, #fff 50%);
}
html[dir="rtl"] .select2-container .select2-choice {
padding: 0 8px 0 0;
}
.select2-container.select2-drop-above .select2-choice {
border-bottom-color: #aaa;
border-radius: 0 0 4px 4px;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.9, #fff));
background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 90%);
background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 90%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
background-image: linear-gradient(to bottom, #eee 0%, #fff 90%);
}
.select2-container.select2-allowclear .select2-choice .select2-chosen {
margin-right: 42px;
}
.select2-container .select2-choice > .select2-chosen {
margin-right: 26px;
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
float: none;
width: auto;
}
html[dir="rtl"] .select2-container .select2-choice > .select2-chosen {
margin-left: 26px;
margin-right: 0;
}
.select2-container .select2-choice abbr {
display: none;
width: 12px;
height: 12px;
position: absolute;
right: 24px;
top: 8px;
font-size: 1px;
text-decoration: none;
border: 0;
background: url('select2.png') right top no-repeat;
cursor: pointer;
outline: 0;
}
.select2-container.select2-allowclear .select2-choice abbr {
display: inline-block;
}
.select2-container .select2-choice abbr:hover {
background-position: right -11px;
cursor: pointer;
}
.select2-drop-mask {
border: 0;
margin: 0;
padding: 0;
position: fixed;
left: 0;
top: 0;
min-height: 100%;
min-width: 100%;
height: auto;
width: auto;
opacity: 0;
z-index: 9998;
/* styles required for IE to work */
background-color: #fff;
filter: alpha(opacity=0);
}
.select2-drop {
width: 100%;
margin-top: -1px;
position: absolute;
z-index: 9999;
top: 100%;
background: #fff;
color: #000;
border: 1px solid #aaa;
border-top: 0;
border-radius: 0 0 4px 4px;
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
}
.select2-drop.select2-drop-above {
margin-top: 1px;
border-top: 1px solid #aaa;
border-bottom: 0;
border-radius: 4px 4px 0 0;
-webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
}
.select2-drop-active {
border: 1px solid #5897fb;
border-top: none;
}
.select2-drop.select2-drop-above.select2-drop-active {
border-top: 1px solid #5897fb;
}
.select2-drop-auto-width {
border-top: 1px solid #aaa;
width: auto;
}
.select2-drop-auto-width .select2-search {
padding-top: 4px;
}
.select2-container .select2-choice .select2-arrow {
display: inline-block;
width: 18px;
height: 100%;
position: absolute;
right: 0;
top: 0;
border-left: 1px solid #aaa;
border-radius: 0 4px 4px 0;
background-clip: padding-box;
background: #ccc;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc', GradientType = 0);
background-image: linear-gradient(to top, #ccc 0%, #eee 60%);
}
html[dir="rtl"] .select2-container .select2-choice .select2-arrow {
left: 0;
right: auto;
border-left: none;
border-right: 1px solid #aaa;
border-radius: 4px 0 0 4px;
}
.select2-container .select2-choice .select2-arrow b {
display: block;
width: 100%;
height: 100%;
background: url('select2.png') no-repeat 0 1px;
}
html[dir="rtl"] .select2-container .select2-choice .select2-arrow b {
background-position: 2px 1px;
}
.select2-search {
display: inline-block;
width: 100%;
min-height: 26px;
margin: 0;
padding-left: 4px;
padding-right: 4px;
position: relative;
z-index: 10000;
white-space: nowrap;
}
.select2-search input {
width: 100%;
height: auto !important;
min-height: 26px;
padding: 4px 20px 4px 5px;
margin: 0;
outline: 0;
font-family: sans-serif;
font-size: 1em;
border: 1px solid #aaa;
border-radius: 0;
-webkit-box-shadow: none;
box-shadow: none;
background: #fff url('select2.png') no-repeat 100% -22px;
background: url('select2.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
background: url('select2.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('select2.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('select2.png') no-repeat 100% -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
}
html[dir="rtl"] .select2-search input {
padding: 4px 5px 4px 20px;
background: #fff url('select2.png') no-repeat -37px -22px;
background: url('select2.png') no-repeat -37px -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
background: url('select2.png') no-repeat -37px -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('select2.png') no-repeat -37px -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('select2.png') no-repeat -37px -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
}
.select2-drop.select2-drop-above .select2-search input {
margin-top: 4px;
}
.select2-search input.select2-active {
background: #fff url('select2-spinner.gif') no-repeat 100%;
background: url('select2-spinner.gif') no-repeat 100%, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
background: url('select2-spinner.gif') no-repeat 100%, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('select2-spinner.gif') no-repeat 100%, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('select2-spinner.gif') no-repeat 100%, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
}
.select2-container-active .select2-choice,
.select2-container-active .select2-choices {
border: 1px solid #5897fb;
outline: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
box-shadow: 0 0 5px rgba(0, 0, 0, .3);
}
.select2-dropdown-open .select2-choice {
border-bottom-color: transparent;
-webkit-box-shadow: 0 1px 0 #fff inset;
box-shadow: 0 1px 0 #fff inset;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
background-color: #eee;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #fff), color-stop(0.5, #eee));
background-image: -webkit-linear-gradient(center bottom, #fff 0%, #eee 50%);
background-image: -moz-linear-gradient(center bottom, #fff 0%, #eee 50%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
background-image: linear-gradient(to top, #fff 0%, #eee 50%);
}
.select2-dropdown-open.select2-drop-above .select2-choice,
.select2-dropdown-open.select2-drop-above .select2-choices {
border: 1px solid #5897fb;
border-top-color: transparent;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(0.5, #eee));
background-image: -webkit-linear-gradient(center top, #fff 0%, #eee 50%);
background-image: -moz-linear-gradient(center top, #fff 0%, #eee 50%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
background-image: linear-gradient(to bottom, #fff 0%, #eee 50%);
}
.select2-dropdown-open .select2-choice .select2-arrow {
background: transparent;
border-left: none;
filter: none;
}
html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow {
border-right: none;
}
.select2-dropdown-open .select2-choice .select2-arrow b {
background-position: -18px 1px;
}
html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow b {
background-position: -16px 1px;
}
.select2-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
/* results */
.select2-results {
max-height: 200px;
padding: 0 0 0 4px;
margin: 4px 4px 4px 0;
position: relative;
overflow-x: hidden;
overflow-y: auto;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
html[dir="rtl"] .select2-results {
padding: 0 4px 0 0;
margin: 4px 0 4px 4px;
}
.select2-results ul.select2-result-sub {
margin: 0;
padding-left: 0;
}
.select2-results li {
list-style: none;
display: list-item;
background-image: none;
}
.select2-results li.select2-result-with-children > .select2-result-label {
font-weight: bold;
}
.select2-results .select2-result-label {
padding: 3px 7px 4px;
margin: 0;
cursor: pointer;
min-height: 1em;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.select2-results-dept-1 .select2-result-label { padding-left: 20px }
.select2-results-dept-2 .select2-result-label { padding-left: 40px }
.select2-results-dept-3 .select2-result-label { padding-left: 60px }
.select2-results-dept-4 .select2-result-label { padding-left: 80px }
.select2-results-dept-5 .select2-result-label { padding-left: 100px }
.select2-results-dept-6 .select2-result-label { padding-left: 110px }
.select2-results-dept-7 .select2-result-label { padding-left: 120px }
.select2-results .select2-highlighted {
background: #3875d7;
color: #fff;
}
.select2-results li em {
background: #feffde;
font-style: normal;
}
.select2-results .select2-highlighted em {
background: transparent;
}
.select2-results .select2-highlighted ul {
background: #fff;
color: #000;
}
.select2-results .select2-no-results,
.select2-results .select2-searching,
.select2-results .select2-ajax-error,
.select2-results .select2-selection-limit {
background: #f4f4f4;
display: list-item;
padding-left: 5px;
}
/*
disabled look for disabled choices in the results dropdown
*/
.select2-results .select2-disabled.select2-highlighted {
color: #666;
background: #f4f4f4;
display: list-item;
cursor: default;
}
.select2-results .select2-disabled {
background: #f4f4f4;
display: list-item;
cursor: default;
}
.select2-results .select2-selected {
display: none;
}
.select2-more-results.select2-active {
background: #f4f4f4 url('select2-spinner.gif') no-repeat 100%;
}
.select2-results .select2-ajax-error {
background: rgba(255, 50, 50, .2);
}
.select2-more-results {
background: #f4f4f4;
display: list-item;
}
/* disabled styles */
.select2-container.select2-container-disabled .select2-choice {
background-color: #f4f4f4;
background-image: none;
border: 1px solid #ddd;
cursor: default;
}
.select2-container.select2-container-disabled .select2-choice .select2-arrow {
background-color: #f4f4f4;
background-image: none;
border-left: 0;
}
.select2-container.select2-container-disabled .select2-choice abbr {
display: none;
}
/* multiselect */
.select2-container-multi .select2-choices {
height: auto !important;
height: 1%;
margin: 0;
padding: 0 5px 0 0;
position: relative;
border: 1px solid #aaa;
cursor: text;
overflow: hidden;
background-color: #fff;
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eee), color-stop(15%, #fff));
background-image: -webkit-linear-gradient(top, #eee 1%, #fff 15%);
background-image: -moz-linear-gradient(top, #eee 1%, #fff 15%);
background-image: linear-gradient(to bottom, #eee 1%, #fff 15%);
}
html[dir="rtl"] .select2-container-multi .select2-choices {
padding: 0 0 0 5px;
}
.select2-locked {
padding: 3px 5px 3px 5px !important;
}
.select2-container-multi .select2-choices {
min-height: 26px;
}
.select2-container-multi.select2-container-active .select2-choices {
border: 1px solid #5897fb;
outline: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
box-shadow: 0 0 5px rgba(0, 0, 0, .3);
}
.select2-container-multi .select2-choices li {
float: left;
list-style: none;
}
html[dir="rtl"] .select2-container-multi .select2-choices li
{
float: right;
}
.select2-container-multi .select2-choices .select2-search-field {
margin: 0;
padding: 0;
white-space: nowrap;
}
.select2-container-multi .select2-choices .select2-search-field input {
padding: 5px;
margin: 1px 0;
font-family: sans-serif;
font-size: 100%;
color: #666;
outline: 0;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
background: transparent !important;
}
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
background: #fff url('select2-spinner.gif') no-repeat 100% !important;
}
.select2-default {
color: #999 !important;
}
.select2-container-multi .select2-choices .select2-search-choice {
padding: 3px 5px 3px 18px;
margin: 3px 0 3px 5px;
position: relative;
line-height: 13px;
color: #333;
cursor: default;
border: 1px solid #aaaaaa;
border-radius: 3px;
-webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
background-clip: padding-box;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #e4e4e4;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee));
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
}
html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice
{
margin: 3px 5px 3px 0;
padding: 3px 18px 3px 5px;
}
.select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
cursor: default;
}
.select2-container-multi .select2-choices .select2-search-choice-focus {
background: #d4d4d4;
}
.select2-search-choice-close {
display: block;
width: 12px;
height: 13px;
position: absolute;
right: 3px;
top: 4px;
font-size: 1px;
outline: none;
background: url('select2.png') right top no-repeat;
}
html[dir="rtl"] .select2-search-choice-close {
right: auto;
left: 3px;
}
.select2-container-multi .select2-search-choice-close {
left: 3px;
}
html[dir="rtl"] .select2-container-multi .select2-search-choice-close {
left: auto;
right: 2px;
}
.select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover {
background-position: right -11px;
}
.select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close {
background-position: right -11px;
}
/* disabled styles */
.select2-container-multi.select2-container-disabled .select2-choices {
background-color: #f4f4f4;
background-image: none;
border: 1px solid #ddd;
cursor: default;
}
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice {
padding: 3px 5px 3px 5px;
border: 1px solid #ddd;
background-image: none;
background-color: #f4f4f4;
}
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close { display: none;
background: none;
}
/* end multiselect */
.select2-result-selectable .select2-match,
.select2-result-unselectable .select2-match {
text-decoration: underline;
}
.select2-offscreen, .select2-offscreen:focus {
clip: rect(0 0 0 0) !important;
width: 1px !important;
height: 1px !important;
border: 0 !important;
margin: 0 !important;
padding: 0 !important;
overflow: hidden !important;
position: absolute !important;
outline: 0 !important;
left: 0px !important;
top: 0px !important;
}
.select2-display-none {
display: none;
}
.select2-measure-scrollbar {
position: absolute;
top: -10000px;
left: -10000px;
width: 100px;
height: 100px;
overflow: scroll;
}
/* Retina-ize icons */
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 2dppx) {
.select2-search input,
.select2-search-choice-close,
.select2-container .select2-choice abbr,
.select2-container .select2-choice .select2-arrow b {
background-image: url('select2x2.png') !important;
background-repeat: no-repeat !important;
background-size: 60px 40px !important;
}
.select2-search input {
background-position: 100% -21px !important;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

View File

@@ -0,0 +1,481 @@
.select2-container {
box-sizing: border-box;
display: inline-block;
margin: 0;
position: relative;
vertical-align: middle; }
.select2-container .select2-selection--single {
box-sizing: border-box;
cursor: pointer;
display: block;
height: 28px;
user-select: none;
-webkit-user-select: none; }
.select2-container .select2-selection--single .select2-selection__rendered {
display: block;
padding-left: 8px;
padding-right: 20px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; }
.select2-container .select2-selection--single .select2-selection__clear {
position: relative; }
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
padding-right: 8px;
padding-left: 20px; }
.select2-container .select2-selection--multiple {
box-sizing: border-box;
cursor: pointer;
display: block;
min-height: 32px;
user-select: none;
-webkit-user-select: none; }
.select2-container .select2-selection--multiple .select2-selection__rendered {
display: inline-block;
overflow: hidden;
padding-left: 8px;
text-overflow: ellipsis;
white-space: nowrap; }
.select2-container .select2-search--inline {
float: left; }
.select2-container .select2-search--inline .select2-search__field {
box-sizing: border-box;
border: none;
font-size: 100%;
margin-top: 5px;
padding: 0; }
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; }
.select2-dropdown {
background-color: white;
border: 1px solid #aaa;
border-radius: 4px;
box-sizing: border-box;
display: block;
position: absolute;
left: -100000px;
width: 100%;
z-index: 1051; }
.select2-results {
display: block; }
.select2-results__options {
list-style: none;
margin: 0;
padding: 0; }
.select2-results__option {
padding: 6px;
user-select: none;
-webkit-user-select: none; }
.select2-results__option[aria-selected] {
cursor: pointer; }
.select2-container--open .select2-dropdown {
left: 0; }
.select2-container--open .select2-dropdown--above {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--open .select2-dropdown--below {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-search--dropdown {
display: block;
padding: 4px; }
.select2-search--dropdown .select2-search__field {
padding: 4px;
width: 100%;
box-sizing: border-box; }
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; }
.select2-search--dropdown.select2-search--hide {
display: none; }
.select2-close-mask {
border: 0;
margin: 0;
padding: 0;
display: block;
position: fixed;
left: 0;
top: 0;
min-height: 100%;
min-width: 100%;
height: auto;
width: auto;
opacity: 0;
z-index: 99;
background-color: #fff;
filter: alpha(opacity=0); }
.select2-hidden-accessible {
border: 0 !important;
clip: rect(0 0 0 0) !important;
-webkit-clip-path: inset(50%) !important;
clip-path: inset(50%) !important;
height: 1px !important;
overflow: hidden !important;
padding: 0 !important;
position: absolute !important;
width: 1px !important;
white-space: nowrap !important; }
.select2-container--default .select2-selection--single {
background-color: #fff;
border: 1px solid #aaa;
border-radius: 4px; }
.select2-container--default .select2-selection--single .select2-selection__rendered {
color: #444;
line-height: 28px; }
.select2-container--default .select2-selection--single .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold; }
.select2-container--default .select2-selection--single .select2-selection__placeholder {
color: #999; }
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
position: absolute;
top: 1px;
right: 1px;
width: 20px; }
.select2-container--default .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0; }
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
float: left; }
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
left: 1px;
right: auto; }
.select2-container--default.select2-container--disabled .select2-selection--single {
background-color: #eee;
cursor: default; }
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
display: none; }
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px; }
.select2-container--default .select2-selection--multiple {
background-color: white;
border: 1px solid #aaa;
border-radius: 4px;
cursor: text; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
box-sizing: border-box;
list-style: none;
margin: 0;
padding: 0 5px;
width: 100%; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
list-style: none; }
.select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-top: 5px;
margin-right: 10px;
padding: 1px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4;
border: 1px solid #aaa;
border-radius: 4px;
cursor: default;
float: left;
margin-right: 5px;
margin-top: 5px;
padding: 0 5px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
color: #999;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-right: 2px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #333; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
float: right; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
margin-left: 5px;
margin-right: auto; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px;
margin-right: auto; }
.select2-container--default.select2-container--focus .select2-selection--multiple {
border: solid black 1px;
outline: 0; }
.select2-container--default.select2-container--disabled .select2-selection--multiple {
background-color: #eee;
cursor: default; }
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
display: none; }
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--default .select2-search--dropdown .select2-search__field {
border: 1px solid #aaa; }
.select2-container--default .select2-search--inline .select2-search__field {
background: transparent;
border: none;
outline: 0;
box-shadow: none;
-webkit-appearance: textfield; }
.select2-container--default .select2-results > .select2-results__options {
max-height: 200px;
overflow-y: auto; }
.select2-container--default .select2-results__option[role=group] {
padding: 0; }
.select2-container--default .select2-results__option[aria-disabled=true] {
color: #999; }
.select2-container--default .select2-results__option[aria-selected=true] {
background-color: #ddd; }
.select2-container--default .select2-results__option .select2-results__option {
padding-left: 1em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
padding-left: 0; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
margin-left: -1em;
padding-left: 2em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -2em;
padding-left: 3em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -3em;
padding-left: 4em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -4em;
padding-left: 5em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -5em;
padding-left: 6em; }
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #5897fb;
color: white; }
.select2-container--default .select2-results__group {
cursor: default;
display: block;
padding: 6px; }
.select2-container--classic .select2-selection--single {
background-color: #f7f7f7;
border: 1px solid #aaa;
border-radius: 4px;
outline: 0;
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
.select2-container--classic .select2-selection--single:focus {
border: 1px solid #5897fb; }
.select2-container--classic .select2-selection--single .select2-selection__rendered {
color: #444;
line-height: 28px; }
.select2-container--classic .select2-selection--single .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-right: 10px; }
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
color: #999; }
.select2-container--classic .select2-selection--single .select2-selection__arrow {
background-color: #ddd;
border: none;
border-left: 1px solid #aaa;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
height: 26px;
position: absolute;
top: 1px;
right: 1px;
width: 20px;
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0; }
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
float: left; }
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
border: none;
border-right: 1px solid #aaa;
border-radius: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
left: 1px;
right: auto; }
.select2-container--classic.select2-container--open .select2-selection--single {
border: 1px solid #5897fb; }
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
background: transparent;
border: none; }
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px; }
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
.select2-container--classic .select2-selection--multiple {
background-color: white;
border: 1px solid #aaa;
border-radius: 4px;
cursor: text;
outline: 0; }
.select2-container--classic .select2-selection--multiple:focus {
border: 1px solid #5897fb; }
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
list-style: none;
margin: 0;
padding: 0 5px; }
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
display: none; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4;
border: 1px solid #aaa;
border-radius: 4px;
cursor: default;
float: left;
margin-right: 5px;
margin-top: 5px;
padding: 0 5px; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
color: #888;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-right: 2px; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #555; }
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
float: right;
margin-left: 5px;
margin-right: auto; }
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px;
margin-right: auto; }
.select2-container--classic.select2-container--open .select2-selection--multiple {
border: 1px solid #5897fb; }
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--classic .select2-search--dropdown .select2-search__field {
border: 1px solid #aaa;
outline: 0; }
.select2-container--classic .select2-search--inline .select2-search__field {
outline: 0;
box-shadow: none; }
.select2-container--classic .select2-dropdown {
background-color: white;
border: 1px solid transparent; }
.select2-container--classic .select2-dropdown--above {
border-bottom: none; }
.select2-container--classic .select2-dropdown--below {
border-top: none; }
.select2-container--classic .select2-results > .select2-results__options {
max-height: 200px;
overflow-y: auto; }
.select2-container--classic .select2-results__option[role=group] {
padding: 0; }
.select2-container--classic .select2-results__option[aria-disabled=true] {
color: grey; }
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
background-color: #3875d7;
color: white; }
.select2-container--classic .select2-results__group {
cursor: default;
display: block;
padding: 6px; }
.select2-container--classic.select2-container--open .select2-dropdown {
border-color: #5897fb; }

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,30 @@
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
.ui-timepicker-div dl dd { margin: 0 10px 10px 40%; }
.ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
.ui-timepicker-div .ui_tpicker_unit_hide{ display: none; }
.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input { background: none; color: inherit; border: none; outline: none; border-bottom: solid 1px #555; width: 95%; }
.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input:focus { border-bottom-color: #aaa; }
.ui-timepicker-rtl{ direction: rtl; }
.ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
.ui-timepicker-rtl dl dt{ float: right; clear: right; }
.ui-timepicker-rtl dl dd { margin: 0 40% 10px 10px; }
/* Shortened version style */
.ui-timepicker-div.ui-timepicker-oneLine { padding-right: 2px; }
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,
.ui-timepicker-div.ui-timepicker-oneLine dt { display: none; }
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label { display: block; padding-top: 2px; }
.ui-timepicker-div.ui-timepicker-oneLine dl { text-align: right; }
.ui-timepicker-div.ui-timepicker-oneLine dl dd,
.ui-timepicker-div.ui-timepicker-oneLine dl dd > div { display:inline-block; margin:0; }
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before { content:':'; display:inline-block; }
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before { content:'.'; display:inline-block; }
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{ display: none; }

View File

@@ -0,0 +1,5 @@
/*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
* http://trentrichardson.com/examples/timepicker
* Copyright (c) 2016 Trent Richardson; Licensed MIT */
.ui-timepicker-div .ui-widget-header{margin-bottom:8px}.ui-timepicker-div dl{text-align:left}.ui-timepicker-div dl dt{float:left;clear:left;padding:0 0 0 5px}.ui-timepicker-div dl dd{margin:0 10px 10px 40%}.ui-timepicker-div td{font-size:90%}.ui-tpicker-grid-label{background:0 0;border:0;margin:0;padding:0}.ui-timepicker-div .ui_tpicker_unit_hide{display:none}.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input{background:0 0;color:inherit;border:0;outline:0;border-bottom:solid 1px #555;width:95%}.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input:focus{border-bottom-color:#aaa}.ui-timepicker-rtl{direction:rtl}.ui-timepicker-rtl dl{text-align:right;padding:0 5px 0 0}.ui-timepicker-rtl dl dt{float:right;clear:right}.ui-timepicker-rtl dl dd{margin:0 40% 10px 10px}.ui-timepicker-div.ui-timepicker-oneLine{padding-right:2px}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,.ui-timepicker-div.ui-timepicker-oneLine dt{display:none}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label{display:block;padding-top:2px}.ui-timepicker-div.ui-timepicker-oneLine dl{text-align:right}.ui-timepicker-div.ui-timepicker-oneLine dl dd,.ui-timepicker-div.ui-timepicker-oneLine dl dd>div{display:inline-block;margin:0}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before{content:':';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before{content:'.';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{display:none}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,168 @@
<?php
// Register store for form data.
acf_register_store( 'form' );
/**
* acf_set_form_data
*
* Sets data about the current form.
*
* @date 6/10/13
* @since 5.0.0
*
* @param string $name The store name.
* @param array $data Array of data to start the store with.
* @return ACF_Data
*/
function acf_set_form_data( $name = '', $data = false ) {
return acf_get_store( 'form' )->set( $name, $data );
}
/**
* acf_get_form_data
*
* Gets data about the current form.
*
* @date 6/10/13
* @since 5.0.0
*
* @param string $name The store name.
* @return mixed
*/
function acf_get_form_data( $name = '' ) {
return acf_get_store( 'form' )->get( $name );
}
/**
* acf_form_data
*
* Called within a form to set important information and render hidden inputs.
*
* @date 15/10/13
* @since 5.0.0
*
* @param void
* @return void
*/
function acf_form_data( $data = array() ) {
// Apply defaults.
$data = wp_parse_args(
$data,
array(
/** @type string The current screen (post, user, taxonomy, etc). */
'screen' => 'post',
/** @type int|string The ID of current post being edited. */
'post_id' => 0,
/** @type bool Enables AJAX validation. */
'validation' => true,
)
);
// Create nonce using screen.
$data['nonce'] = wp_create_nonce( $data['screen'] );
// Append "changed" input used within "_wp_post_revision_fields" action.
$data['changed'] = 0;
// Set data.
acf_set_form_data( $data );
// Render HTML.
?>
<div id="acf-form-data" class="acf-hidden">
<?php
// Create hidden inputs from $data
foreach ( $data as $name => $value ) {
acf_hidden_input(
array(
'id' => '_acf_' . $name,
'name' => '_acf_' . $name,
'value' => $value,
)
);
}
/**
* Fires within the #acf-form-data element to add extra HTML.
*
* @date 15/10/13
* @since 5.0.0
*
* @param array $data The form data.
*/
do_action( 'acf/form_data', $data );
do_action( 'acf/input/form_data', $data );
?>
</div>
<?php
}
/**
* acf_save_post
*
* Saves the $_POST data.
*
* @date 15/10/13
* @since 5.0.0
*
* @param int|string $post_id The post id.
* @param array $values An array of values to override $_POST.
* @return bool True if save was successful.
*/
function acf_save_post( $post_id = 0, $values = null ) {
// Override $_POST data with $values.
if ( $values !== null ) {
$_POST['acf'] = $values;
}
// Bail early if no data to save.
if ( empty( $_POST['acf'] ) ) {
return false;
}
// Set form data (useful in various filters/actions).
acf_set_form_data( 'post_id', $post_id );
// Filter $_POST data for users without the 'unfiltered_html' capability.
if ( ! acf_allow_unfiltered_html() ) {
$_POST['acf'] = wp_kses_post_deep( $_POST['acf'] );
}
// Do generic action.
do_action( 'acf/save_post', $post_id );
// Return true.
return true;
}
/**
* _acf_do_save_post
*
* Private function hooked into 'acf/save_post' to actually save the $_POST data.
* This allows developers to hook in before and after ACF has actually saved the data.
*
* @date 11/1/19
* @since 5.7.10
*
* @param int|string $post_id The post id.
* @return void
*/
function _acf_do_save_post( $post_id = 0 ) {
// Check and update $_POST data.
if ( $_POST['acf'] ) {
acf_update_values( $_POST['acf'], $post_id );
}
}
// Run during generic action.
add_action( 'acf/save_post', '_acf_do_save_post' );

View File

@@ -0,0 +1,470 @@
<?php
/*
* acf_is_empty
*
* Returns true if the value provided is considered "empty". Allows numbers such as 0.
*
* @date 6/7/16
* @since 5.4.0
*
* @param mixed $var The value to check.
* @return bool
*/
function acf_is_empty( $var ) {
return ( ! $var && ! is_numeric( $var ) );
}
/**
* acf_not_empty
*
* Returns true if the value provided is considered "not empty". Allows numbers such as 0.
*
* @date 15/7/19
* @since 5.8.1
*
* @param mixed $var The value to check.
* @return bool
*/
function acf_not_empty( $var ) {
return ( $var || is_numeric( $var ) );
}
/**
* acf_uniqid
*
* Returns a unique numeric based id.
*
* @date 9/1/19
* @since 5.7.10
*
* @param string $prefix The id prefix. Defaults to 'acf'.
* @return string
*/
function acf_uniqid( $prefix = 'acf' ) {
// Instantiate global counter.
global $acf_uniqid;
if ( ! isset( $acf_uniqid ) ) {
$acf_uniqid = 1;
}
// Return id.
return $prefix . '-' . $acf_uniqid++;
}
/**
* acf_merge_attributes
*
* Merges together two arrays but with extra functionality to append class names.
*
* @date 22/1/19
* @since 5.7.10
*
* @param array $array1 An array of attributes.
* @param array $array2 An array of attributes.
* @return array
*/
function acf_merge_attributes( $array1, $array2 ) {
// Merge together attributes.
$array3 = array_merge( $array1, $array2 );
// Append together special attributes.
foreach ( array( 'class', 'style' ) as $key ) {
if ( isset( $array1[ $key ] ) && isset( $array2[ $key ] ) ) {
$array3[ $key ] = trim( $array1[ $key ] ) . ' ' . trim( $array2[ $key ] );
}
}
// Return.
return $array3;
}
/**
* acf_cache_key
*
* Returns a filtered cache key.
*
* @date 25/1/19
* @since 5.7.11
*
* @param string $key The cache key.
* @return string
*/
function acf_cache_key( $key = '' ) {
/**
* Filters the cache key.
*
* @date 25/1/19
* @since 5.7.11
*
* @param string $key The cache key.
* @param string $original_key The original cache key.
*/
return apply_filters( 'acf/get_cache_key', $key, $key );
}
/**
* acf_request_args
*
* Returns an array of $_REQUEST values using the provided defaults.
*
* @date 28/2/19
* @since 5.7.13
*
* @param array $args An array of args.
* @return array
*/
function acf_request_args( $args = array() ) {
foreach ( $args as $k => $v ) {
$args[ $k ] = isset( $_REQUEST[ $k ] ) ? $_REQUEST[ $k ] : $args[ $k ];
}
return $args;
}
/**
* Returns a single $_REQUEST arg with fallback.
*
* @date 23/10/20
* @since 5.9.2
*
* @param string $key The property name.
* @param mixed $default The default value to fallback to.
* @return mixed
*/
function acf_request_arg( $name = '', $default = null ) {
return isset( $_REQUEST[ $name ] ) ? $_REQUEST[ $name ] : $default;
}
// Register store.
acf_register_store( 'filters' );
/**
* acf_enable_filter
*
* Enables a filter with the given name.
*
* @date 14/7/16
* @since 5.4.0
*
* @param string name The modifer name.
* @return void
*/
function acf_enable_filter( $name = '' ) {
acf_get_store( 'filters' )->set( $name, true );
}
/**
* acf_disable_filter
*
* Disables a filter with the given name.
*
* @date 14/7/16
* @since 5.4.0
*
* @param string name The modifer name.
* @return void
*/
function acf_disable_filter( $name = '' ) {
acf_get_store( 'filters' )->set( $name, false );
}
/**
* acf_is_filter_enabled
*
* Returns the state of a filter for the given name.
*
* @date 14/7/16
* @since 5.4.0
*
* @param string name The modifer name.
* @return array
*/
function acf_is_filter_enabled( $name = '' ) {
return acf_get_store( 'filters' )->get( $name );
}
/**
* acf_get_filters
*
* Returns an array of filters in their current state.
*
* @date 14/7/16
* @since 5.4.0
*
* @param void
* @return array
*/
function acf_get_filters() {
return acf_get_store( 'filters' )->get();
}
/**
* acf_set_filters
*
* Sets an array of filter states.
*
* @date 14/7/16
* @since 5.4.0
*
* @param array $filters An Array of modifers
* @return array
*/
function acf_set_filters( $filters = array() ) {
acf_get_store( 'filters' )->set( $filters );
}
/**
* acf_disable_filters
*
* Disables all filters and returns the previous state.
*
* @date 14/7/16
* @since 5.4.0
*
* @param void
* @return array
*/
function acf_disable_filters() {
// Get state.
$prev_state = acf_get_filters();
// Set all modifers as false.
acf_set_filters( array_map( '__return_false', $prev_state ) );
// Return prev state.
return $prev_state;
}
/**
* acf_enable_filters
*
* Enables all or an array of specific filters and returns the previous state.
*
* @date 14/7/16
* @since 5.4.0
*
* @param array $filters An Array of modifers
* @return array
*/
function acf_enable_filters( $filters = array() ) {
// Get state.
$prev_state = acf_get_filters();
// Allow specific filters to be enabled.
if ( $filters ) {
acf_set_filters( $filters );
// Set all modifers as true.
} else {
acf_set_filters( array_map( '__return_true', $prev_state ) );
}
// Return prev state.
return $prev_state;
}
/**
* acf_idval
*
* Parses the provided value for an ID.
*
* @date 29/3/19
* @since 5.7.14
*
* @param mixed $value A value to parse.
* @return int
*/
function acf_idval( $value ) {
// Check if value is numeric.
if ( is_numeric( $value ) ) {
return (int) $value;
// Check if value is array.
} elseif ( is_array( $value ) ) {
return (int) isset( $value['ID'] ) ? $value['ID'] : 0;
// Check if value is object.
} elseif ( is_object( $value ) ) {
return (int) isset( $value->ID ) ? $value->ID : 0;
}
// Return default.
return 0;
}
/**
* acf_maybe_idval
*
* Checks value for potential id value.
*
* @date 6/4/19
* @since 5.7.14
*
* @param mixed $value A value to parse.
* @return mixed
*/
function acf_maybe_idval( $value ) {
if ( $id = acf_idval( $value ) ) {
return $id;
}
return $value;
}
/**
* acf_numval
*
* Casts the provided value as eiter an int or float using a simple hack.
*
* @date 11/4/19
* @since 5.7.14
*
* @param mixed $value A value to parse.
* @return (int|float)
*/
function acf_numval( $value ) {
return ( intval( $value ) == floatval( $value ) ) ? intval( $value ) : floatval( $value );
}
/**
* acf_idify
*
* Returns an id attribute friendly string.
*
* @date 24/12/17
* @since 5.6.5
*
* @param string $str The string to convert.
* @return string
*/
function acf_idify( $str = '' ) {
return str_replace( array( '][', '[', ']' ), array( '-', '-', '' ), strtolower( $str ) );
}
/**
* acf_slugify
*
* Returns a slug friendly string.
*
* @date 24/12/17
* @since 5.6.5
*
* @param string $str The string to convert.
* @param string $glue The glue between each slug piece.
* @return string
*/
function acf_slugify( $str = '', $glue = '-' ) {
return str_replace( array( '_', '-', '/', ' ' ), $glue, strtolower( $str ) );
}
/**
* Returns a string with correct full stop punctuation.
*
* @date 12/7/19
* @since 5.8.2
*
* @param string $str The string to format.
* @return string
*/
function acf_punctify( $str = '' ) {
if ( substr( trim( strip_tags( $str ) ), -1 ) !== '.' ) {
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;
}
}
/**
* Returns the length of a string that has been submitted via $_POST.
*
* Uses the following process:
* 1. Unslash the string because posted values will be slashed.
* 2. Decode special characters because wp_kses() will normalize entities.
* 3. Treat line-breaks as a single character instead of two.
* 4. Use mb_strlen() to accomodate special characters.
*
* @date 04/06/2020
* @since 5.9.0
*
* @param string $str The string to review.
* @return int
*/
function acf_strlen( $str ) {
return mb_strlen( str_replace( "\r\n", "\n", wp_specialchars_decode( wp_unslash( $str ) ) ) );
}
/**
* Returns a value with default fallback.
*
* @date 6/4/20
* @since 5.9.0
*
* @param mixed $value The value.
* @param mixed $default_value The default value.
* @return mixed
*/
function acf_with_default( $value, $default_value ) {
return $value ? $value : $default_value;
}
/**
* Returns the current priority of a running action.
*
* @date 14/07/2020
* @since 5.9.0
*
* @param string $action The action name.
* @return int|bool
*/
function acf_doing_action( $action ) {
global $wp_filter;
if ( isset( $wp_filter[ $action ] ) ) {
return $wp_filter[ $action ]->current_priority();
}
return false;
}
/**
* Returns the current URL.
*
* @date 23/01/2015
* @since 5.1.5
*
* @param void
* @return string
*/
function acf_get_current_url() {
// Ensure props exist to avoid PHP Notice during CLI commands.
if ( isset( $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'] ) ) {
return ( is_ssl() ? 'https' : 'http' ) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}
return '';
}

View File

@@ -0,0 +1,230 @@
<?php
// Register store.
acf_register_store( 'hook-variations' );
/**
* acf_add_filter_variations
*
* Registers variations for the given filter.
*
* @date 26/1/19
* @since 5.7.11
*
* @param string $filter The filter name.
* @param array $variations An array variation keys.
* @param int $index The param index to find variation values.
* @return void
*/
function acf_add_filter_variations( $filter = '', $variations = array(), $index = 0 ) {
// Store replacement data.
acf_get_store( 'hook-variations' )->set(
$filter,
array(
'type' => 'filter',
'variations' => $variations,
'index' => $index,
)
);
// Add generic handler.
// Use a priotiry of 10, and accepted args of 10 (ignored by WP).
add_filter( $filter, '_acf_apply_hook_variations', 10, 10 );
}
/**
* acf_add_action_variations
*
* Registers variations for the given action.
*
* @date 26/1/19
* @since 5.7.11
*
* @param string $action The action name.
* @param array $variations An array variation keys.
* @param int $index The param index to find variation values.
* @return void
*/
function acf_add_action_variations( $action = '', $variations = array(), $index = 0 ) {
// Store replacement data.
acf_get_store( 'hook-variations' )->set(
$action,
array(
'type' => 'action',
'variations' => $variations,
'index' => $index,
)
);
// Add generic handler.
// Use a priotiry of 10, and accepted args of 10 (ignored by WP).
add_action( $action, '_acf_apply_hook_variations', 10, 10 );
}
/**
* _acf_apply_hook_variations
*
* Applys hook variations during apply_filters() or do_action().
*
* @date 25/1/19
* @since 5.7.11
*
* @param mixed
* @return mixed
*/
function _acf_apply_hook_variations() {
// Get current filter.
$filter = current_filter();
// Get args provided.
$args = func_get_args();
// Get variation information.
$variations = acf_get_store( 'hook-variations' )->get( $filter );
extract( $variations );
// Find field in args using index.
$field = $args[ $index ];
// Loop over variations and apply filters.
foreach ( $variations as $variation ) {
// Get value from field.
// First look for "backup" value ("_name", "_key").
if ( isset( $field[ "_$variation" ] ) ) {
$value = $field[ "_$variation" ];
} elseif ( isset( $field[ $variation ] ) ) {
$value = $field[ $variation ];
} else {
continue;
}
// Apply filters.
if ( $type === 'filter' ) {
$args[0] = apply_filters_ref_array( "$filter/$variation=$value", $args );
// Or do action.
} else {
do_action_ref_array( "$filter/$variation=$value", $args );
}
}
// Return first arg.
return $args[0];
}
// Register store.
acf_register_store( 'deprecated-hooks' );
/**
* acf_add_deprecated_filter
*
* Registers a deprecated filter to run during the replacement.
*
* @date 25/1/19
* @since 5.7.11
*
* @param string $deprecated The deprecated hook.
* @param string $version The version this hook was deprecated.
* @param string $replacement The replacement hook.
* @return void
*/
function acf_add_deprecated_filter( $deprecated, $version, $replacement ) {
// Store replacement data.
acf_get_store( 'deprecated-hooks' )->append(
array(
'type' => 'filter',
'deprecated' => $deprecated,
'replacement' => $replacement,
'version' => $version,
)
);
// Add generic handler.
// Use a priotiry of 10, and accepted args of 10 (ignored by WP).
add_filter( $replacement, '_acf_apply_deprecated_hook', 10, 10 );
}
/**
* acf_add_deprecated_action
*
* Registers a deprecated action to run during the replacement.
*
* @date 25/1/19
* @since 5.7.11
*
* @param string $deprecated The deprecated hook.
* @param string $version The version this hook was deprecated.
* @param string $replacement The replacement hook.
* @return void
*/
function acf_add_deprecated_action( $deprecated, $version, $replacement ) {
// Store replacement data.
acf_get_store( 'deprecated-hooks' )->append(
array(
'type' => 'action',
'deprecated' => $deprecated,
'replacement' => $replacement,
'version' => $version,
)
);
// Add generic handler.
// Use a priotiry of 10, and accepted args of 10 (ignored by WP).
add_filter( $replacement, '_acf_apply_deprecated_hook', 10, 10 );
}
/**
* _acf_apply_deprecated_hook
*
* Applys a deprecated filter during apply_filters() or do_action().
*
* @date 25/1/19
* @since 5.7.11
*
* @param mixed
* @return mixed
*/
function _acf_apply_deprecated_hook() {
// Get current hook.
$hook = current_filter();
// Get args provided.
$args = func_get_args();
// Get deprecated items for this hook.
$items = acf_get_store( 'deprecated-hooks' )->query( array( 'replacement' => $hook ) );
// Loop over results.
foreach ( $items as $item ) {
// Extract data.
extract( $item );
// Check if anyone is hooked into this deprecated hook.
if ( has_filter( $deprecated ) ) {
// Log warning.
// _deprecated_hook( $deprecated, $version, $hook );
// Apply filters.
if ( $type === 'filter' ) {
$args[0] = apply_filters_ref_array( $deprecated, $args );
// Or do action.
} else {
do_action_ref_array( $deprecated, $args );
}
}
}
// Return first arg.
return $args[0];
}

View File

@@ -0,0 +1,497 @@
<?php
/**
* acf_filter_attrs
*
* Filters out empty attrs from the provided array.
*
* @date 11/6/19
* @since 5.8.1
*
* @param array $attrs The array of attrs.
* @return array
*/
function acf_filter_attrs( $attrs ) {
// Filter out empty attrs but allow "0" values.
$filtered = array_filter( $attrs, 'acf_not_empty' );
// Correct specific attributes (required="required").
foreach ( array( 'required', 'readonly', 'disabled', 'multiple' ) as $key ) {
unset( $filtered[ $key ] );
if ( ! empty( $attrs[ $key ] ) ) {
$filtered[ $key ] = $key;
}
}
return $filtered;
}
/**
* acf_esc_attrs
*
* Generated valid HTML from an array of attrs.
*
* @date 11/6/19
* @since 5.8.1
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_esc_attrs( $attrs ) {
$html = '';
// Loop over attrs and validate data types.
foreach ( $attrs as $k => $v ) {
// String (but don't trim value).
if ( is_string( $v ) && ( $k !== 'value' ) ) {
$v = trim( $v );
// Boolean
} elseif ( is_bool( $v ) ) {
$v = $v ? 1 : 0;
// Object
} elseif ( is_array( $v ) || is_object( $v ) ) {
$v = json_encode( $v );
}
// Generate HTML.
$html .= sprintf( ' %s="%s"', esc_attr( $k ), esc_attr( $v ) );
}
// Return trimmed.
return trim( $html );
}
/**
* Sanitizes text content and strips out disallowed HTML.
*
* This function emulates `wp_kses_post()` with a context of "acf" for extensibility.
*
* @date 16/4/21
* @since 5.9.6
*
* @param string $string
* @return string
*/
function acf_esc_html( $string = '' ) {
return wp_kses( (string) $string, 'acf' );
}
/**
* Private callback for the "wp_kses_allowed_html" filter used to return allowed HTML for "acf" context.
*
* @date 16/4/21
* @since 5.9.6
*
* @param array $tags An array of allowed tags.
* @param string $context The context name.
* @return array.
*/
function _acf_kses_allowed_html( $tags, $context ) {
global $allowedposttags;
if ( $context === 'acf' ) {
return $allowedposttags;
}
return $tags;
}
add_filter( 'wp_kses_allowed_html', '_acf_kses_allowed_html', 0, 2 );
/**
* acf_html_input
*
* Returns the HTML of an input.
*
* @date 13/6/19
* @since 5.8.1
*
* @param array $attrs The array of attrs.
* @return string
*/
// function acf_html_input( $attrs = array() ) {
// return sprintf( '<input %s/>', acf_esc_attrs($attrs) );
// }
/**
* acf_hidden_input
*
* Renders the HTML of a hidden input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_hidden_input( $attrs = array() ) {
echo acf_get_hidden_input( $attrs );
}
/**
* acf_get_hidden_input
*
* Returns the HTML of a hidden input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_get_hidden_input( $attrs = array() ) {
return sprintf( '<input type="hidden" %s/>', acf_esc_attrs( $attrs ) );
}
/**
* acf_text_input
*
* Renders the HTML of a text input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_text_input( $attrs = array() ) {
echo acf_get_text_input( $attrs );
}
/**
* acf_get_text_input
*
* Returns the HTML of a text input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_get_text_input( $attrs = array() ) {
$attrs = wp_parse_args(
$attrs,
array(
'type' => 'text',
)
);
if ( isset( $attrs['value'] ) && is_string( $attrs['value'] ) ) {
$attrs['value'] = htmlspecialchars( $attrs['value'] );
}
return sprintf( '<input %s/>', acf_esc_attrs( $attrs ) );
}
/**
* acf_file_input
*
* Renders the HTML of a file input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_file_input( $attrs = array() ) {
echo acf_get_file_input( $attrs );
}
/**
* acf_get_file_input
*
* Returns the HTML of a file input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_get_file_input( $attrs = array() ) {
return sprintf( '<input type="file" %s/>', acf_esc_attrs( $attrs ) );
}
/**
* acf_textarea_input
*
* Renders the HTML of a textarea input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_textarea_input( $attrs = array() ) {
echo acf_get_textarea_input( $attrs );
}
/**
* acf_get_textarea_input
*
* Returns the HTML of a textarea input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_get_textarea_input( $attrs = array() ) {
$value = '';
if ( isset( $attrs['value'] ) ) {
$value = $attrs['value'];
unset( $attrs['value'] );
}
return sprintf( '<textarea %s>%s</textarea>', acf_esc_attrs( $attrs ), esc_textarea( $value ) );
}
/**
* acf_checkbox_input
*
* Renders the HTML of a checkbox input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_checkbox_input( $attrs = array() ) {
echo acf_get_checkbox_input( $attrs );
}
/**
* acf_get_checkbox_input
*
* Returns the HTML of a checkbox input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_get_checkbox_input( $attrs = array() ) {
// Allow radio or checkbox type.
$attrs = wp_parse_args(
$attrs,
array(
'type' => 'checkbox',
)
);
// Get label.
$label = '';
if ( isset( $attrs['label'] ) ) {
$label = $attrs['label'];
unset( $attrs['label'] );
}
// Render.
$checked = isset( $attrs['checked'] );
return '<label' . ( $checked ? ' class="selected"' : '' ) . '><input ' . acf_esc_attr( $attrs ) . '/> ' . acf_esc_html( $label ) . '</label>';
}
/**
* acf_radio_input
*
* Renders the HTML of a radio input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_radio_input( $attrs = array() ) {
echo acf_get_radio_input( $attrs );
}
/**
* acf_get_radio_input
*
* Returns the HTML of a radio input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_get_radio_input( $attrs = array() ) {
$attrs['type'] = 'radio';
return acf_get_checkbox_input( $attrs );
}
/**
* acf_select_input
*
* Renders the HTML of a select input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_select_input( $attrs = array() ) {
echo acf_get_select_input( $attrs );
}
/**
* acf_select_input
*
* Returns the HTML of a select input.
*
* @date 3/02/2014
* @since 5.0.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_get_select_input( $attrs = array() ) {
$value = (array) acf_extract_var( $attrs, 'value' );
$choices = (array) acf_extract_var( $attrs, 'choices' );
return sprintf(
'<select %s>%s</select>',
acf_esc_attrs( $attrs ),
acf_walk_select_input( $choices, $value )
);
}
/**
* acf_walk_select_input
*
* Returns the HTML of a select input's choices.
*
* @date 27/6/17
* @since 5.6.0
*
* @param array $choices The choices to walk through.
* @param array $values The selected choices.
* @param array $depth The current walk depth.
* @return string
*/
function acf_walk_select_input( $choices = array(), $values = array(), $depth = 0 ) {
$html = '';
// Sanitize values for 'selected' matching (only once).
if ( $depth == 0 ) {
$values = array_map( 'esc_attr', $values );
}
// Loop over choices and append to html.
if ( $choices ) {
foreach ( $choices as $value => $label ) {
// Multiple (optgroup)
if ( is_array( $label ) ) {
$html .= sprintf(
'<optgroup label="%s">%s</optgroup>',
esc_attr( $value ),
acf_walk_select_input( $label, $values, $depth + 1 )
);
// single (option)
} else {
$attrs = array(
'value' => $value,
);
// If is selected.
$pos = array_search( esc_attr( $value ), $values );
if ( $pos !== false ) {
$attrs['selected'] = 'selected';
$attrs['data-i'] = $pos;
}
$html .= sprintf( '<option %s>%s</option>', acf_esc_attr( $attrs ), esc_html( $label ) );
}
}
}
return $html;
}
/**
* acf_clean_atts
*
* See acf_filter_attrs().
*
* @date 3/10/17
* @since 5.6.3
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_clean_atts( $attrs ) {
return acf_filter_attrs( $attrs );
}
/**
* acf_esc_atts
*
* See acf_esc_attrs().
*
* @date 27/6/17
* @since 5.6.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_esc_atts( $attrs ) {
return acf_esc_attrs( $attrs );
}
/**
* acf_esc_attr
*
* See acf_esc_attrs().
*
* @date 13/6/19
* @since 5.8.1
* @deprecated 5.6.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_esc_attr( $attrs ) {
return acf_esc_attrs( $attrs );
}
/**
* acf_esc_attr_e
*
* See acf_esc_attrs().
*
* @date 13/6/19
* @since 5.8.1
* @deprecated 5.6.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_esc_attr_e( $attrs ) {
echo acf_esc_attrs( $attrs );
}
/**
* acf_esc_atts_e
*
* See acf_esc_attrs().
*
* @date 13/6/19
* @since 5.8.1
* @deprecated 5.6.0
*
* @param array $attrs The array of attrs.
* @return string
*/
function acf_esc_atts_e( $attrs ) {
echo acf_esc_attrs( $attrs );
}

View File

@@ -0,0 +1,382 @@
<?php
/**
* acf_get_meta
*
* Returns an array of "ACF only" meta for the given post_id.
*
* @date 9/10/18
* @since 5.8.0
*
* @param mixed $post_id The post_id for this data.
* @return array
*/
function acf_get_meta( $post_id = 0 ) {
// Allow filter to short-circuit load_value logic.
$null = apply_filters( 'acf/pre_load_meta', null, $post_id );
if ( $null !== null ) {
return ( $null === '__return_null' ) ? null : $null;
}
// Decode $post_id for $type and $id.
extract( acf_decode_post_id( $post_id ) );
// Determine CRUD function.
// - Relies on decoded post_id result to identify option or meta types.
// - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
if ( $type === 'option' ) {
$allmeta = acf_get_option_meta( $id );
} else {
$allmeta = get_metadata( $type, $id, '' );
}
// Loop over meta and check that a reference exists for each value.
$meta = array();
if ( $allmeta ) {
foreach ( $allmeta as $key => $value ) {
// If a reference exists for this value, add it to the meta array.
if ( isset( $allmeta[ "_$key" ] ) ) {
$meta[ $key ] = $allmeta[ $key ][0];
$meta[ "_$key" ] = $allmeta[ "_$key" ][0];
}
}
}
// Unserialized results (get_metadata does not unserialize if $key is empty).
$meta = array_map( 'maybe_unserialize', $meta );
/**
* Filters the $meta array after it has been loaded.
*
* @date 25/1/19
* @since 5.7.11
*
* @param array $meta The arary of loaded meta.
* @param string $post_id The $post_id for this meta.
*/
return apply_filters( 'acf/load_meta', $meta, $post_id );
}
/**
* acf_get_option_meta
*
* Returns an array of meta for the given wp_option name prefix in the same format as get_post_meta().
*
* @date 9/10/18
* @since 5.8.0
*
* @param string $prefix The wp_option name prefix.
* @return array
*/
function acf_get_option_meta( $prefix = '' ) {
// Globals.
global $wpdb;
// Vars.
$meta = array();
$search = "{$prefix}_%";
$_search = "_{$prefix}_%";
// Escape underscores for LIKE.
$search = str_replace( '_', '\_', $search );
$_search = str_replace( '_', '\_', $_search );
// Query database for results.
$rows = $wpdb->get_results(
$wpdb->prepare(
"SELECT *
FROM $wpdb->options
WHERE option_name LIKE %s
OR option_name LIKE %s",
$search,
$_search
),
ARRAY_A
);
// Loop over results and append meta (removing the $prefix from the option name).
$len = strlen( "{$prefix}_" );
foreach ( $rows as $row ) {
$meta[ substr( $row['option_name'], $len ) ][] = $row['option_value'];
}
// Return results.
return $meta;
}
/**
* acf_get_metadata
*
* Retrieves specific metadata from the database.
*
* @date 16/10/2015
* @since 5.2.3
*
* @param (int|string) $post_id The post id.
* @param string $name The meta name.
* @param bool $hidden If the meta is hidden (starts with an underscore).
* @return mixed
*/
function acf_get_metadata( $post_id = 0, $name = '', $hidden = false ) {
// Allow filter to short-circuit logic.
$null = apply_filters( 'acf/pre_load_metadata', null, $post_id, $name, $hidden );
if ( $null !== null ) {
return ( $null === '__return_null' ) ? null : $null;
}
// Decode $post_id for $type and $id.
extract( acf_decode_post_id( $post_id ) );
// Hidden meta uses an underscore prefix.
$prefix = $hidden ? '_' : '';
// Bail early if no $id (possible during new acf_form).
if ( ! $id ) {
return null;
}
// Determine CRUD function.
// - Relies on decoded post_id result to identify option or meta types.
// - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
if ( $type === 'option' ) {
return get_option( "{$prefix}{$id}_{$name}", null );
} else {
$meta = get_metadata( $type, $id, "{$prefix}{$name}", false );
return isset( $meta[0] ) ? $meta[0] : null;
}
}
/**
* acf_update_metadata
*
* Updates metadata in the database.
*
* @date 16/10/2015
* @since 5.2.3
*
* @param (int|string) $post_id The post id.
* @param string $name The meta name.
* @param mixed $value The meta value.
* @param bool $hidden If the meta is hidden (starts with an underscore).
* @return (int|bool) Meta ID if the key didn't exist, true on successful update, false on failure.
*/
function acf_update_metadata( $post_id = 0, $name = '', $value = '', $hidden = false ) {
// Allow filter to short-circuit logic.
$pre = apply_filters( 'acf/pre_update_metadata', null, $post_id, $name, $value, $hidden );
if ( $pre !== null ) {
return $pre;
}
// Decode $post_id for $type and $id.
extract( acf_decode_post_id( $post_id ) );
// Hidden meta uses an underscore prefix.
$prefix = $hidden ? '_' : '';
// Bail early if no $id (possible during new acf_form).
if ( ! $id ) {
return false;
}
// Determine CRUD function.
// - Relies on decoded post_id result to identify option or meta types.
// - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
if ( $type === 'option' ) {
$value = wp_unslash( $value );
$autoload = (bool) acf_get_setting( 'autoload' );
return update_option( "{$prefix}{$id}_{$name}", $value, $autoload );
} else {
return update_metadata( $type, $id, "{$prefix}{$name}", $value );
}
}
/**
* acf_delete_metadata
*
* Deletes metadata from the database.
*
* @date 16/10/2015
* @since 5.2.3
*
* @param (int|string) $post_id The post id.
* @param string $name The meta name.
* @param bool $hidden If the meta is hidden (starts with an underscore).
* @return bool
*/
function acf_delete_metadata( $post_id = 0, $name = '', $hidden = false ) {
// Allow filter to short-circuit logic.
$pre = apply_filters( 'acf/pre_delete_metadata', null, $post_id, $name, $hidden );
if ( $pre !== null ) {
return $pre;
}
// Decode $post_id for $type and $id.
extract( acf_decode_post_id( $post_id ) );
// Hidden meta uses an underscore prefix.
$prefix = $hidden ? '_' : '';
// Bail early if no $id (possible during new acf_form).
if ( ! $id ) {
return false;
}
// Determine CRUD function.
// - Relies on decoded post_id result to identify option or meta types.
// - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
if ( $type === 'option' ) {
return delete_option( "{$prefix}{$id}_{$name}" );
} else {
return delete_metadata( $type, $id, "{$prefix}{$name}" );
}
}
/**
* acf_copy_postmeta
*
* Copies meta from one post to another. Useful for saving and restoring revisions.
*
* @date 25/06/2016
* @since 5.3.8
*
* @param (int|string) $from_post_id The post id to copy from.
* @param (int|string) $to_post_id The post id to paste to.
* @return void
*/
function acf_copy_metadata( $from_post_id = 0, $to_post_id = 0 ) {
// Get all postmeta.
$meta = acf_get_meta( $from_post_id );
// Check meta.
if ( $meta ) {
// Slash data. WP expects all data to be slashed and will unslash it (fixes '\' character issues).
$meta = wp_slash( $meta );
// Loop over meta.
foreach ( $meta as $name => $value ) {
acf_update_metadata( $to_post_id, $name, $value );
}
}
}
/**
* acf_copy_postmeta
*
* Copies meta from one post to another. Useful for saving and restoring revisions.
*
* @date 25/06/2016
* @since 5.3.8
* @deprecated 5.7.11
*
* @param int $from_post_id The post id to copy from.
* @param int $to_post_id The post id to paste to.
* @return void
*/
function acf_copy_postmeta( $from_post_id = 0, $to_post_id = 0 ) {
return acf_copy_metadata( $from_post_id, $to_post_id );
}
/**
* acf_get_meta_field
*
* Returns a field using the provided $id and $post_id parameters.
* Looks for a reference to help loading the correct field via name.
*
* @date 21/1/19
* @since 5.7.10
*
* @param string $key The meta name (field name).
* @param (int|string) $post_id The post_id where this field's value is saved.
* @return (array|false) The field array.
*/
function acf_get_meta_field( $key = 0, $post_id = 0 ) {
// Try reference.
$field_key = acf_get_reference( $key, $post_id );
if ( $field_key ) {
$field = acf_get_field( $field_key );
if ( $field ) {
$field['name'] = $key;
return $field;
}
}
// Return false.
return false;
}
/**
* acf_get_metaref
*
* Retrieves reference metadata from the database.
*
* @date 16/10/2015
* @since 5.2.3
*
* @param (int|string) $post_id The post id.
* @param string type The reference type (fields|groups).
* @param string $name An optional specific name
* @return mixed
*/
function acf_get_metaref( $post_id = 0, $type = 'fields', $name = '' ) {
// Load existing meta.
$meta = acf_get_metadata( $post_id, "_acf_$type" );
// Handle no meta.
if ( ! $meta ) {
return $name ? '' : array();
}
// Return specific reference.
if ( $name ) {
return isset( $meta[ $name ] ) ? $meta[ $name ] : '';
// Or return all references.
} else {
return $meta;
}
}
/**
* acf_update_metaref
*
* Updates reference metadata in the database.
*
* @date 16/10/2015
* @since 5.2.3
*
* @param (int|string) $post_id The post id.
* @param string type The reference type (fields|groups).
* @param array $references An array of references.
* @return (int|bool) Meta ID if the key didn't exist, true on successful update, false on failure.
*/
function acf_update_metaref( $post_id = 0, $type = 'fields', $references = array() ) {
// Get current references.
$current = acf_get_metaref( $post_id, $type );
// Merge in new references.
$references = array_merge( $current, $references );
// Simplify groups
if ( $type === 'groups' ) {
$references = array_values( $references );
}
// Remove duplicate references.
$references = array_unique( $references );
// Update metadata.
return acf_update_metadata( $post_id, "_acf_$type", $references );
}

View File

@@ -0,0 +1,40 @@
<?php
/**
* Returns available templates for each post type.
*
* @date 29/8/17
* @since 5.6.2
*
* @param void
* @return array
*/
function acf_get_post_templates() {
// Check store.
$cache = acf_get_data( 'post_templates' );
if ( $cache !== null ) {
return $cache;
}
// Initialize templates with default placeholder for pages.
$post_templates = array();
$post_templates['page'] = array();
// Loop over post types and append their templates.
if ( method_exists( 'WP_Theme', 'get_page_templates' ) ) {
$post_types = get_post_types();
foreach ( $post_types as $post_type ) {
$templates = wp_get_theme()->get_page_templates( null, $post_type );
if ( $templates ) {
$post_templates[ $post_type ] = $templates;
}
}
}
// Update store.
acf_set_data( 'post_templates', $post_templates );
// Return templates.
return $post_templates;
}

View File

@@ -0,0 +1,119 @@
<?php
/**
* acf_get_users
*
* Similar to the get_users() function but with extra functionality.
*
* @date 9/1/19
* @since 5.7.10
*
* @param array $args The query args.
* @return array
*/
function acf_get_users( $args = array() ) {
// Get users.
$users = get_users( $args );
// Maintain order.
if ( $users && $args['include'] ) {
// Generate order array.
$order = array();
foreach ( $users as $i => $user ) {
$order[ $i ] = array_search( $user->ID, $args['include'] );
}
// Sort results.
array_multisort( $order, $users );
}
// Return
return $users;
}
/**
* acf_get_user_result
*
* Returns a result containing "id" and "text" for the given user.
*
* @date 21/5/19
* @since 5.8.1
*
* @param WP_User $user The user object.
* @return array
*/
function acf_get_user_result( $user ) {
// Vars.
$id = $user->ID;
$text = $user->user_login;
// Add name.
if ( $user->first_name && $user->last_name ) {
$text .= " ({$user->first_name} {$user->last_name})";
} elseif ( $user->first_name ) {
$text .= " ({$user->first_name})";
}
return compact( 'id', 'text' );
}
/**
* acf_get_user_role_labels
*
* Returns an array of user roles in the format "name => label".
*
* @date 20/5/19
* @since 5.8.1
*
* @param array $roles A specific array of roles.
* @return array
*/
function acf_get_user_role_labels( $roles = array() ) {
$all_roles = wp_roles()->get_names();
// Load all roles if none provided.
if ( empty( $roles ) ) {
$roles = array_keys( $all_roles );
}
// Loop over roles and populare labels.
$lables = array();
foreach ( $roles as $role ) {
if ( isset( $all_roles[ $role ] ) ) {
$lables[ $role ] = translate_user_role( $all_roles[ $role ] );
}
}
// Return labels.
return $lables;
}
/**
* acf_allow_unfiltered_html
*
* Returns true if the current user is allowed to save unfiltered HTML.
*
* @date 9/1/19
* @since 5.7.10
*
* @param void
* @return bool
*/
function acf_allow_unfiltered_html() {
// Check capability.
$allow_unfiltered_html = current_user_can( 'unfiltered_html' );
/**
* Filters whether the current user is allowed to save unfiltered HTML.
*
* @date 9/1/19
* @since 5.7.10
*
* @param bool allow_unfiltered_html The result.
*/
return apply_filters( 'acf/allow_unfiltered_html', $allow_unfiltered_html );
}

View File

@@ -0,0 +1,158 @@
<?php
// Globals.
global $acf_stores, $acf_instances;
// Initialize plaeholders.
$acf_stores = array();
$acf_instances = array();
/**
* acf_new_instance
*
* Creates a new instance of the given class and stores it in the instances data store.
*
* @date 9/1/19
* @since 5.7.10
*
* @param string $class The class name.
* @return object The instance.
*/
function acf_new_instance( $class = '' ) {
global $acf_instances;
return $acf_instances[ $class ] = new $class();
}
/**
* acf_get_instance
*
* Returns an instance for the given class.
*
* @date 9/1/19
* @since 5.7.10
*
* @param string $class The class name.
* @return object The instance.
*/
function acf_get_instance( $class = '' ) {
global $acf_instances;
if ( ! isset( $acf_instances[ $class ] ) ) {
$acf_instances[ $class ] = new $class();
}
return $acf_instances[ $class ];
}
/**
* acf_register_store
*
* Registers a data store.
*
* @date 9/1/19
* @since 5.7.10
*
* @param string $name The store name.
* @param array $data Array of data to start the store with.
* @return ACF_Data
*/
function acf_register_store( $name = '', $data = false ) {
// Create store.
$store = new ACF_Data( $data );
// Register store.
global $acf_stores;
$acf_stores[ $name ] = $store;
// Return store.
return $store;
}
/**
* acf_get_store
*
* Returns a data store.
*
* @date 9/1/19
* @since 5.7.10
*
* @param string $name The store name.
* @return ACF_Data
*/
function acf_get_store( $name = '' ) {
global $acf_stores;
return isset( $acf_stores[ $name ] ) ? $acf_stores[ $name ] : false;
}
/**
* acf_switch_stores
*
* Triggered when switching between sites on a multisite installation.
*
* @date 13/2/19
* @since 5.7.11
*
* @param int $site_id New blog ID.
* @param int prev_blog_id Prev blog ID.
* @return void
*/
function acf_switch_stores( $site_id, $prev_site_id ) {
// Loop over stores and call switch_site().
global $acf_stores;
foreach ( $acf_stores as $store ) {
$store->switch_site( $site_id, $prev_site_id );
}
}
add_action( 'switch_blog', 'acf_switch_stores', 10, 2 );
/**
* acf_get_path
*
* Returns the plugin path to a specified file.
*
* @date 28/9/13
* @since 5.0.0
*
* @param string $filename The specified file.
* @return string
*/
function acf_get_path( $filename = '' ) {
return ACF_PATH . ltrim( $filename, '/' );
}
/**
* acf_get_url
*
* Returns the plugin url to a specified file.
* This function also defines the ACF_URL constant.
*
* @date 12/12/17
* @since 5.6.8
*
* @param string $filename The specified file.
* @return string
*/
function acf_get_url( $filename = '' ) {
if ( ! defined( 'ACF_URL' ) ) {
define( 'ACF_URL', acf_get_setting( 'url' ) );
}
return ACF_URL . ltrim( $filename, '/' );
}
/*
* acf_include
*
* Includes a file within the ACF plugin.
*
* @date 10/3/14
* @since 5.0.0
*
* @param string $filename The specified file.
* @return void
*/
function acf_include( $filename = '' ) {
$file_path = acf_get_path( $filename );
if ( file_exists( $file_path ) ) {
include_once $file_path;
}
}

View File

@@ -0,0 +1,324 @@
<?php
// Register store.
acf_register_store( 'values' )->prop( 'multisite', true );
/**
* acf_get_reference
*
* Retrieves the field key for a given field name and post_id.
*
* @date 26/1/18
* @since 5.6.5
*
* @param string $field_name The name of the field. eg 'sub_heading'.
* @param mixed $post_id The post_id of which the value is saved against.
* @return string The field key.
*/
function acf_get_reference( $field_name, $post_id ) {
// Allow filter to short-circuit load_value logic.
$reference = apply_filters( 'acf/pre_load_reference', null, $field_name, $post_id );
if ( $reference !== null ) {
return $reference;
}
// Get hidden meta for this field name.
$reference = acf_get_metadata( $post_id, $field_name, true );
/**
* Filters the reference value.
*
* @date 25/1/19
* @since 5.7.11
*
* @param string $reference The reference value.
* @param string $field_name The field name.
* @param (int|string) $post_id The post ID where meta is stored.
*/
return apply_filters( 'acf/load_reference', $reference, $field_name, $post_id );
}
/**
* Retrieves the value for a given field and post_id.
*
* @date 28/09/13
* @since 5.0.0
*
* @param int|string $post_id The post id.
* @param array $field The field array.
* @return mixed
*/
function acf_get_value( $post_id, $field ) {
// Allow filter to short-circuit load_value logic.
$value = apply_filters( 'acf/pre_load_value', null, $post_id, $field );
if ( $value !== null ) {
return $value;
}
// Get field name.
$field_name = $field['name'];
// Check store.
$store = acf_get_store( 'values' );
if ( $store->has( "$post_id:$field_name" ) ) {
return $store->get( "$post_id:$field_name" );
}
// Load value from database.
$value = acf_get_metadata( $post_id, $field_name );
// Use field's default_value if no meta was found.
if ( $value === null && isset( $field['default_value'] ) ) {
$value = $field['default_value'];
}
/**
* Filters the $value after it has been loaded.
*
* @date 28/09/13
* @since 5.0.0
*
* @param mixed $value The value to preview.
* @param string $post_id The post ID for this value.
* @param array $field The field array.
*/
$value = apply_filters( 'acf/load_value', $value, $post_id, $field );
// Update store.
$store->set( "$post_id:$field_name", $value );
// Return value.
return $value;
}
// Register variation.
acf_add_filter_variations( 'acf/load_value', array( 'type', 'name', 'key' ), 2 );
/**
* acf_format_value
*
* Returns a formatted version of the provided value.
*
* @date 28/09/13
* @since 5.0.0
*
* @param mixed $value The field value.
* @param (int|string) $post_id The post id.
* @param array $field The field array.
* @return mixed.
*/
function acf_format_value( $value, $post_id, $field ) {
// Allow filter to short-circuit load_value logic.
$check = apply_filters( 'acf/pre_format_value', null, $value, $post_id, $field );
if ( $check !== null ) {
return $check;
}
// Get field name.
$field_name = $field['name'];
// Check store.
$store = acf_get_store( 'values' );
if ( $store->has( "$post_id:$field_name:formatted" ) ) {
return $store->get( "$post_id:$field_name:formatted" );
}
/**
* Filters the $value for use in a template function.
*
* @date 28/09/13
* @since 5.0.0
*
* @param mixed $value The value to preview.
* @param string $post_id The post ID for this value.
* @param array $field The field array.
*/
$value = apply_filters( 'acf/format_value', $value, $post_id, $field );
// Update store.
$store->set( "$post_id:$field_name:formatted", $value );
// Return value.
return $value;
}
// Register variation.
acf_add_filter_variations( 'acf/format_value', array( 'type', 'name', 'key' ), 2 );
/**
* acf_update_value
*
* Updates the value for a given field and post_id.
*
* @date 28/09/13
* @since 5.0.0
*
* @param mixed $value The new value.
* @param (int|string) $post_id The post id.
* @param array $field The field array.
* @return bool.
*/
function acf_update_value( $value, $post_id, $field ) {
// Allow filter to short-circuit update_value logic.
$check = apply_filters( 'acf/pre_update_value', null, $value, $post_id, $field );
if ( $check !== null ) {
return $check;
}
/**
* Filters the $value before it is updated.
*
* @date 28/09/13
* @since 5.0.0
*
* @param mixed $value The value to update.
* @param string $post_id The post ID for this value.
* @param array $field The field array.
* @param mixed $original The original value before modification.
*/
$value = apply_filters( 'acf/update_value', $value, $post_id, $field, $value );
// Allow null to delete value.
if ( $value === null ) {
return acf_delete_value( $post_id, $field );
}
// Update meta.
$return = acf_update_metadata( $post_id, $field['name'], $value );
// Update reference.
acf_update_metadata( $post_id, $field['name'], $field['key'], true );
// Delete stored data.
acf_flush_value_cache( $post_id, $field['name'] );
// Return update status.
return $return;
}
// Register variation.
acf_add_filter_variations( 'acf/update_value', array( 'type', 'name', 'key' ), 2 );
/**
* acf_update_values
*
* Updates an array of values.
*
* @date 26/2/19
* @since 5.7.13
*
* @param array values The array of values.
* @param (int|string) $post_id The post id.
* @return void
*/
function acf_update_values( $values, $post_id ) {
// Loop over values.
foreach ( $values as $key => $value ) {
// Get field.
$field = acf_get_field( $key );
// Update value.
if ( $field ) {
acf_update_value( $value, $post_id, $field );
}
}
}
/**
* acf_flush_value_cache
*
* Deletes all cached data for this value.
*
* @date 22/1/19
* @since 5.7.10
*
* @param (int|string) $post_id The post id.
* @param string $field_name The field name.
* @return void
*/
function acf_flush_value_cache( $post_id = 0, $field_name = '' ) {
// Delete stored data.
acf_get_store( 'values' )
->remove( "$post_id:$field_name" )
->remove( "$post_id:$field_name:formatted" );
}
/**
* acf_delete_value
*
* Deletes the value for a given field and post_id.
*
* @date 28/09/13
* @since 5.0.0
*
* @param (int|string) $post_id The post id.
* @param array $field The field array.
* @return bool.
*/
function acf_delete_value( $post_id, $field ) {
/**
* Fires before a value is deleted.
*
* @date 28/09/13
* @since 5.0.0
*
* @param string $post_id The post ID for this value.
* @param mixed $name The meta name.
* @param array $field The field array.
*/
do_action( 'acf/delete_value', $post_id, $field['name'], $field );
// Delete meta.
$return = acf_delete_metadata( $post_id, $field['name'] );
// Delete reference.
acf_delete_metadata( $post_id, $field['name'], true );
// Delete stored data.
acf_flush_value_cache( $post_id, $field['name'] );
// Return delete status.
return $return;
}
// Register variation.
acf_add_filter_variations( 'acf/delete_value', array( 'type', 'name', 'key' ), 2 );
/**
* acf_preview_value
*
* Return a human friendly 'preview' for a given field value.
*
* @date 28/09/13
* @since 5.0.0
*
* @param mixed $value The new value.
* @param (int|string) $post_id The post id.
* @param array $field The field array.
* @return bool.
*/
function acf_preview_value( $value, $post_id, $field ) {
/**
* Filters the $value before used in HTML.
*
* @date 24/10/16
* @since 5.5.0
*
* @param mixed $value The value to preview.
* @param string $post_id The post ID for this value.
* @param array $field The field array.
*/
return apply_filters( 'acf/preview_value', $value, $post_id, $field );
}
// Register variation.
acf_add_filter_variations( 'acf/preview_value', array( 'type', 'name', 'key' ), 2 );

View File

@@ -0,0 +1,218 @@
<?php
/**
* Returns a WordPress object type.
*
* @date 1/4/20
* @since 5.9.0
*
* @param string $object_type The object type (post, term, user, etc).
* @param string $object_subtype Optional object subtype (post type, taxonomy).
* @return object
*/
function acf_get_object_type( $object_type, $object_subtype = '' ) {
$props = array(
'type' => $object_type,
'subtype' => $object_subtype,
'name' => '',
'label' => '',
'icon' => '',
);
// Set unique identifier as name.
if ( $object_subtype ) {
$props['name'] = "$object_type/$object_subtype";
} else {
$props['name'] = $object_type;
}
// Set label and icon.
switch ( $object_type ) {
case 'post':
if ( $object_subtype ) {
$post_type = get_post_type_object( $object_subtype );
if ( $post_type ) {
$props['label'] = $post_type->labels->name;
$props['icon'] = acf_with_default( $post_type->menu_icon, 'dashicons-admin-post' );
} else {
return false;
}
} else {
$props['label'] = __( 'Posts', 'acf' );
$props['icon'] = 'dashicons-admin-post';
}
break;
case 'term':
if ( $object_subtype ) {
$taxonomy = get_taxonomy( $object_subtype );
if ( $taxonomy ) {
$props['label'] = $taxonomy->labels->name;
} else {
return false;
}
} else {
$props['label'] = __( 'Taxonomies', 'acf' );
}
$props['icon'] = 'dashicons-tag';
break;
case 'attachment':
$props['label'] = __( 'Attachments', 'acf' );
$props['icon'] = 'dashicons-admin-media';
break;
case 'comment':
$props['label'] = __( 'Comments', 'acf' );
$props['icon'] = 'dashicons-admin-comments';
break;
case 'widget':
$props['label'] = __( 'Widgets', 'acf' );
$props['icon'] = 'dashicons-screenoptions';
break;
case 'menu':
$props['label'] = __( 'Menus', 'acf' );
$props['icon'] = 'dashicons-admin-appearance';
break;
case 'menu_item':
$props['label'] = __( 'Menu items', 'acf' );
$props['icon'] = 'dashicons-admin-appearance';
break;
case 'user':
$props['label'] = __( 'Users', 'acf' );
$props['icon'] = 'dashicons-admin-users';
break;
case 'option':
$props['label'] = __( 'Options', 'acf' );
$props['icon'] = 'dashicons-admin-generic';
break;
case 'block':
$props['label'] = __( 'Blocks', 'acf' );
$props['icon'] = acf_version_compare( 'wp', '>=', '5.5' ) ? 'dashicons-block-default' : 'dashicons-layout';
break;
default:
return false;
}
// Convert to object.
$object = (object) $props;
/**
* Filters the object type.
*
* @date 6/4/20
* @since 5.9.0
*
* @param object $object The object props.
* @param string $object_type The object type (post, term, user, etc).
* @param string $object_subtype Optional object subtype (post type, taxonomy).
*/
return apply_filters( 'acf/get_object_type', $object, $object_type, $object_subtype );
}
/**
* Decodes a post_id value such as 1 or "user_1" into an array containing the type and ID.
*
* @date 25/1/19
* @since 5.7.11
*
* @param (int|string) $post_id The post id.
* @return array
*/
function acf_decode_post_id( $post_id = 0 ) {
$type = '';
$id = 0;
// Interpret numeric value (123).
if ( is_numeric( $post_id ) ) {
$type = 'post';
$id = $post_id;
// Interpret string value ("user_123" or "option").
} elseif ( is_string( $post_id ) ) {
$i = strrpos( $post_id, '_' );
if ( $i > 0 ) {
$type = substr( $post_id, 0, $i );
$id = substr( $post_id, $i + 1 );
} else {
$type = $post_id;
$id = '';
}
// Handle incorrect param type.
} else {
return compact( 'type', 'id' );
}
// Validate props based on param format.
$format = $type . '_' . ( is_numeric( $id ) ? '%d' : '%s' );
switch ( $format ) {
case 'post_%d':
$type = 'post';
$id = absint( $id );
break;
case 'term_%d':
$type = 'term';
$id = absint( $id );
break;
case 'attachment_%d':
$type = 'post';
$id = absint( $id );
break;
case 'comment_%d':
$type = 'comment';
$id = absint( $id );
break;
case 'widget_%s':
case 'widget_%d':
$type = 'option';
$id = $post_id;
break;
case 'menu_%d':
$type = 'term';
$id = absint( $id );
break;
case 'menu_item_%d':
$type = 'post';
$id = absint( $id );
break;
case 'user_%d':
$type = 'user';
$id = absint( $id );
break;
case 'block_%s':
$type = 'block';
$id = $post_id;
break;
case 'option_%s':
$type = 'option';
$id = $post_id;
break;
case 'blog_%d':
case 'site_%d':
// Allow backwards compatibility for custom taxonomies.
$type = taxonomy_exists( $type ) ? 'term' : 'blog';
$id = absint( $id );
break;
default:
// Check for taxonomy name.
if ( taxonomy_exists( $type ) && is_numeric( $id ) ) {
$type = 'term';
$id = absint( $id );
break;
}
// Treat unknown post_id format as an option.
$type = 'option';
$id = $post_id;
break;
}
/**
* Filters the decoded post_id information.
*
* @date 25/1/19
* @since 5.7.11
*
* @param array $props An array containing "type" and "id" information.
* @param (int|string) $post_id The post id.
*/
return apply_filters( 'acf/decode_post_id', compact( 'type', 'id' ), $post_id );
}

View File

@@ -0,0 +1,820 @@
<?php
/*
* ACF Admin Field Group Class
*
* All the logic for editing a field group
*
* @class acf_admin_field_group
* @package ACF
* @subpackage Admin
*/
if ( ! class_exists( 'acf_admin_field_group' ) ) :
class acf_admin_field_group {
/*
* __construct
*
* This function will setup the class functionality
*
* @type function
* @date 5/03/2014
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
function __construct() {
// actions
add_action( 'current_screen', array( $this, 'current_screen' ) );
add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );
// ajax
add_action( 'wp_ajax_acf/field_group/render_field_settings', array( $this, 'ajax_render_field_settings' ) );
add_action( 'wp_ajax_acf/field_group/render_location_rule', array( $this, 'ajax_render_location_rule' ) );
add_action( 'wp_ajax_acf/field_group/move_field', array( $this, 'ajax_move_field' ) );
// filters
add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
add_filter( 'use_block_editor_for_post_type', array( $this, 'use_block_editor_for_post_type' ), 10, 2 );
}
/**
* use_block_editor_for_post_type
*
* Prevents the block editor from loading when editing an ACF field group.
*
* @date 7/12/18
* @since 5.8.0
*
* @param bool $use_block_editor Whether the post type can be edited or not. Default true.
* @param string $post_type The post type being checked.
* @return bool
*/
function use_block_editor_for_post_type( $use_block_editor, $post_type ) {
if ( $post_type === 'acf-field-group' ) {
return false;
}
return $use_block_editor;
}
/*
* post_updated_messages
*
* This function will customize the message shown when editing a field group
*
* @type action (post_updated_messages)
* @date 30/04/2014
* @since 5.0.0
*
* @param $messages (array)
* @return $messages
*/
function post_updated_messages( $messages ) {
// append to messages
$messages['acf-field-group'] = array(
0 => '', // Unused. Messages start at index 1.
1 => __( 'Field group updated.', 'acf' ),
2 => __( 'Field group updated.', 'acf' ),
3 => __( 'Field group deleted.', 'acf' ),
4 => __( 'Field group updated.', 'acf' ),
5 => false, // field group does not support revisions
6 => __( 'Field group published.', 'acf' ),
7 => __( 'Field group saved.', 'acf' ),
8 => __( 'Field group submitted.', 'acf' ),
9 => __( 'Field group scheduled for.', 'acf' ),
10 => __( 'Field group draft updated.', 'acf' ),
);
// return
return $messages;
}
/*
* current_screen
*
* This function is fired when loading the admin page before HTML has been rendered.
*
* @type action (current_screen)
* @date 21/07/2014
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
function current_screen() {
// validate screen
if ( ! acf_is_screen( 'acf-field-group' ) ) {
return;
}
// disable filters to ensure ACF loads raw data from DB
acf_disable_filters();
// enqueue scripts
acf_enqueue_scripts();
// actions
add_action( 'acf/input/admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
add_action( 'acf/input/admin_head', array( $this, 'admin_head' ) );
add_action( 'acf/input/form_data', array( $this, 'form_data' ) );
add_action( 'acf/input/admin_footer', array( $this, 'admin_footer' ) );
// filters
add_filter( 'acf/input/admin_l10n', array( $this, 'admin_l10n' ) );
}
/*
* admin_enqueue_scripts
*
* This action is run after post query but before any admin script / head actions.
* It is a good place to register all actions.
*
* @type action (admin_enqueue_scripts)
* @date 30/06/2014
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
function admin_enqueue_scripts() {
// no autosave
wp_dequeue_script( 'autosave' );
// custom scripts
wp_enqueue_style( 'acf-field-group' );
wp_enqueue_script( 'acf-field-group' );
// localize text
acf_localize_text(
array(
'The string "field_" may not be used at the start of a field name' => __( 'The string "field_" may not be used at the start of a field name', 'acf' ),
'This field cannot be moved until its changes have been saved' => __( 'This field cannot be moved until its changes have been saved', 'acf' ),
'Field group title is required' => __( 'Field group title is required', 'acf' ),
'Move to trash. Are you sure?' => __( 'Move to trash. Are you sure?', 'acf' ),
'No toggle fields available' => __( 'No toggle fields available', 'acf' ),
'Move Custom Field' => __( 'Move Custom Field', 'acf' ),
'Checked' => __( 'Checked', 'acf' ),
'(no label)' => __( '(no label)', 'acf' ),
'(this field)' => __( '(this field)', 'acf' ),
'copy' => __( 'copy', 'acf' ),
'or' => __( 'or', 'acf' ),
'Show this field group if' => __( 'Show this field group if', 'acf' ),
'Null' => __( 'Null', 'acf' ),
// Conditions
'Has any value' => __( 'Has any value', 'acf' ),
'Has no value' => __( 'Has no value', 'acf' ),
'Value is equal to' => __( 'Value is equal to', 'acf' ),
'Value is not equal to' => __( 'Value is not equal to', 'acf' ),
'Value matches pattern' => __( 'Value matches pattern', 'acf' ),
'Value contains' => __( 'Value contains', 'acf' ),
'Value is greater than' => __( 'Value is greater than', 'acf' ),
'Value is less than' => __( 'Value is less than', 'acf' ),
'Selection is greater than' => __( 'Selection is greater than', 'acf' ),
'Selection is less than' => __( 'Selection is less than', 'acf' ),
// Pro-only fields
'Repeater (Pro only)' => __( 'Repeater (Pro only)', 'acf' ),
'Flexibly Content (Pro only)' => __( 'Flexible Content (Pro only)', 'acf' ),
'Clone (Pro only)' => __( 'Clone (Pro only)', 'acf' ),
'Gallery (Pro only)' => __( 'Gallery (Pro only)', 'acf' ),
)
);
// localize data
acf_localize_data(
array(
'fieldTypes' => acf_get_field_types_info(),
)
);
// 3rd party hook
do_action( 'acf/field_group/admin_enqueue_scripts' );
}
/*
* admin_head
*
* This function will setup all functionality for the field group edit page to work
*
* @type action (admin_head)
* @date 23/06/12
* @since 3.1.8
*
* @param $post_id (int)
* @return $post_id (int)
*/
function admin_head() {
// global
global $post, $field_group;
// set global var
$field_group = acf_get_field_group( $post->ID );
// metaboxes
add_meta_box( 'acf-field-group-fields', __( 'Fields', 'acf' ), array( $this, 'mb_fields' ), 'acf-field-group', 'normal', 'high' );
add_meta_box( 'acf-field-group-locations', __( 'Location', 'acf' ), array( $this, 'mb_locations' ), 'acf-field-group', 'normal', 'high' );
add_meta_box( 'acf-field-group-options', __( 'Settings', 'acf' ), array( $this, 'mb_options' ), 'acf-field-group', 'normal', 'high' );
// actions
add_action( 'post_submitbox_misc_actions', array( $this, 'post_submitbox_misc_actions' ), 10, 0 );
add_action( 'edit_form_after_title', array( $this, 'edit_form_after_title' ), 10, 0 );
// filters
add_filter( 'screen_settings', array( $this, 'screen_settings' ), 10, 1 );
// 3rd party hook
do_action( 'acf/field_group/admin_head' );
}
/*
* edit_form_after_title
*
* This action will allow ACF to render metaboxes after the title
*
* @type action
* @date 17/08/13
*
* @param n/a
* @return n/a
*/
function edit_form_after_title() {
// globals
global $post;
// render post data
acf_form_data(
array(
'screen' => 'field_group',
'post_id' => $post->ID,
'delete_fields' => 0,
'validation' => 0,
)
);
}
/*
* form_data
*
* This function will add extra HTML to the acf form data element
*
* @type function
* @date 31/05/2016
* @since 5.3.8
*
* @param n/a
* @return n/a
*/
function form_data( $args ) {
// do action
do_action( 'acf/field_group/form_data', $args );
}
/*
* admin_l10n
*
* This function will append extra l10n strings to the acf JS object
*
* @type function
* @date 31/05/2016
* @since 5.3.8
*
* @param $l10n (array)
* @return $l10n
*/
function admin_l10n( $l10n ) {
return apply_filters( 'acf/field_group/admin_l10n', $l10n );
}
/*
* admin_footer
*
* description
*
* @type function
* @date 11/01/2016
* @since 5.3.2
*
* @param $post_id (int)
* @return $post_id (int)
*/
function admin_footer() {
// 3rd party hook
do_action( 'acf/field_group/admin_footer' );
}
/*
* screen_settings
*
* description
*
* @type function
* @date 26/01/13
* @since 3.6.0
*
* @param $current (string)
* @return $current
*/
function screen_settings( $html ) {
// vars
$checked = acf_get_user_setting( 'show_field_keys' ) ? 'checked="checked"' : '';
// append
$html .= '<div id="acf-append-show-on-screen" class="acf-hidden">';
$html .= '<label for="acf-field-key-hide"><input id="acf-field-key-hide" type="checkbox" value="1" name="show_field_keys" ' . $checked . ' /> ' . __( 'Field Keys', 'acf' ) . '</label>';
$html .= '</div>';
// return
return $html;
}
/*
* post_submitbox_misc_actions
*
* This function will customize the publish metabox
*
* @type function
* @date 17/07/2015
* @since 5.2.9
*
* @param n/a
* @return n/a
*/
function post_submitbox_misc_actions() {
global $field_group;
$status_label = $field_group['active'] ? _x( 'Active', 'post status', 'acf' ) : _x( 'Disabled', 'post status', 'acf' );
?>
<script type="text/javascript">
(function($) {
$('#post-status-display').html( '<?php echo esc_html( $status_label ); ?>' );
})(jQuery);
</script>
<?php
}
/*
* save_post
*
* This function will save all the field group data
*
* @type function
* @date 23/06/12
* @since 1.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function save_post( $post_id, $post ) {
// do not save if this is an auto save routine
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return $post_id;
}
// bail early if not acf-field-group
if ( $post->post_type !== 'acf-field-group' ) {
return $post_id;
}
// only save once! WordPress save's a revision as well.
if ( wp_is_post_revision( $post_id ) ) {
return $post_id;
}
// verify nonce
if ( ! acf_verify_nonce( 'field_group' ) ) {
return $post_id;
}
// Bail early if request came from an unauthorised user.
if ( ! current_user_can( acf_get_setting( 'capability' ) ) ) {
return $post_id;
}
// disable filters to ensure ACF loads raw data from DB
acf_disable_filters();
// save fields
if ( ! empty( $_POST['acf_fields'] ) ) {
// loop
foreach ( $_POST['acf_fields'] as $field ) {
// vars
$specific = false;
$save = acf_extract_var( $field, 'save' );
// only saved field if has changed
if ( $save == 'meta' ) {
$specific = array(
'menu_order',
'post_parent',
);
}
// set parent
if ( ! $field['parent'] ) {
$field['parent'] = $post_id;
}
// save field
acf_update_field( $field, $specific );
}
}
// delete fields
if ( $_POST['_acf_delete_fields'] ) {
// clean
$ids = explode( '|', $_POST['_acf_delete_fields'] );
$ids = array_map( 'intval', $ids );
// loop
foreach ( $ids as $id ) {
// bai early if no id
if ( ! $id ) {
continue;
}
// delete
acf_delete_field( $id );
}
}
// add args
$_POST['acf_field_group']['ID'] = $post_id;
$_POST['acf_field_group']['title'] = $_POST['post_title'];
// save field group
acf_update_field_group( $_POST['acf_field_group'] );
// return
return $post_id;
}
/*
* mb_fields
*
* This function will render the HTML for the medtabox 'acf-field-group-fields'
*
* @type function
* @date 28/09/13
* @since 5.0.0
*
* @param N/A
* @return N/A
*/
function mb_fields() {
// global
global $field_group;
// get fields
$view = array(
'fields' => acf_get_fields( $field_group ),
'parent' => 0,
);
// load view
acf_get_view( 'field-group-fields', $view );
}
/*
* mb_options
*
* This function will render the HTML for the medtabox 'acf-field-group-options'
*
* @type function
* @date 28/09/13
* @since 5.0.0
*
* @param N/A
* @return N/A
*/
function mb_options() {
// global
global $field_group;
// field key (leave in for compatibility)
if ( ! acf_is_field_group_key( $field_group['key'] ) ) {
$field_group['key'] = uniqid( 'group_' );
}
// view
acf_get_view( 'field-group-options' );
}
/*
* mb_locations
*
* This function will render the HTML for the medtabox 'acf-field-group-locations'
*
* @type function
* @date 28/09/13
* @since 5.0.0
*
* @param N/A
* @return N/A
*/
function mb_locations() {
// global
global $field_group;
// UI needs at lease 1 location rule
if ( empty( $field_group['location'] ) ) {
$field_group['location'] = array(
// group 0
array(
// rule 0
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
),
);
}
// view
acf_get_view( 'field-group-locations' );
}
/*
* ajax_render_location_rule
*
* This function can be accessed via an AJAX action and will return the result from the render_location_value function
*
* @type function (ajax)
* @date 30/09/13
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
function ajax_render_location_rule() {
// validate
if ( ! acf_verify_ajax() ) {
die();
}
// verify user capability
if ( ! acf_current_user_can_admin() ) {
die();
}
// validate rule
$rule = acf_validate_location_rule( $_POST['rule'] );
// view
acf_get_view(
'html-location-rule',
array(
'rule' => $rule,
)
);
// die
die();
}
/*
* ajax_render_field_settings
*
* This function will return HTML containing the field's settings based on it's new type
*
* @type function (ajax)
* @date 30/09/13
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
function ajax_render_field_settings() {
// validate
if ( ! acf_verify_ajax() ) {
die();
}
// verify user capability
if ( ! acf_current_user_can_admin() ) {
die();
}
// vars
$field = acf_maybe_get_POST( 'field' );
// check
if ( ! $field ) {
die();
}
// set prefix
$field['prefix'] = acf_maybe_get_POST( 'prefix' );
// validate
$field = acf_get_valid_field( $field );
// render
do_action( "acf/render_field_settings/type={$field['type']}", $field );
// return
die();
}
/*
* ajax_move_field
*
* description
*
* @type function
* @date 20/01/2014
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function ajax_move_field() {
// disable filters to ensure ACF loads raw data from DB
acf_disable_filters();
$args = acf_parse_args(
$_POST,
array(
'nonce' => '',
'post_id' => 0,
'field_id' => 0,
'field_group_id' => 0,
)
);
// verify nonce
if ( ! wp_verify_nonce( $args['nonce'], 'acf_nonce' ) ) {
die();
}
// verify user capability
if ( ! acf_current_user_can_admin() ) {
die();
}
// confirm?
if ( $args['field_id'] && $args['field_group_id'] ) {
// vars
$field = acf_get_field( $args['field_id'] );
$field_group = acf_get_field_group( $args['field_group_id'] );
// update parent
$field['parent'] = $field_group['ID'];
// remove conditional logic
$field['conditional_logic'] = 0;
// update field
acf_update_field( $field );
// Output HTML.
$link = '<a href="' . admin_url( 'post.php?post=' . $field_group['ID'] . '&action=edit' ) . '" target="_blank">' . esc_html( $field_group['title'] ) . '</a>';
echo '' .
'<p><strong>' . __( 'Move Complete.', 'acf' ) . '</strong></p>' .
'<p>' . sprintf(
acf_punctify( __( 'The %1$s field can now be found in the %2$s field group', 'acf' ) ),
esc_html( $field['label'] ),
$link
) . '</p>' .
'<a href="#" class="button button-primary acf-close-popup">' . __( 'Close Window', 'acf' ) . '</a>';
die();
}
// get all field groups
$field_groups = acf_get_field_groups();
$choices = array();
// check
if ( ! empty( $field_groups ) ) {
// loop
foreach ( $field_groups as $field_group ) {
// bail early if no ID
if ( ! $field_group['ID'] ) {
continue;
}
// bail ealry if is current
if ( $field_group['ID'] == $args['post_id'] ) {
continue;
}
// append
$choices[ $field_group['ID'] ] = $field_group['title'];
}
}
// render options
$field = acf_get_valid_field(
array(
'type' => 'select',
'name' => 'acf_field_group',
'choices' => $choices,
)
);
echo '<p>' . __( 'Please select the destination for this field', 'acf' ) . '</p>';
echo '<form id="acf-move-field-form">';
// render
acf_render_field_wrap( $field );
echo '<button type="submit" class="button button-primary">' . __( 'Move Field', 'acf' ) . '</button>';
echo '</form>';
// die
die();
}
}
// initialize
new acf_admin_field_group();
endif;
?>

View File

@@ -0,0 +1,885 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
class ACF_Admin_Field_Groups {
/**
* Array of field groups availbale for sync.
*
* @since 5.9.0
* @var array
*/
public $sync = array();
/**
* The current view (post_status).
*
* @since 5.9.0
* @var string
*/
public $view = '';
/**
* Constructor.
*
* @date 5/03/2014
* @since 5.0.0
*
* @param void
* @return void
*/
public function __construct() {
// Add hooks.
add_action( 'load-edit.php', array( $this, 'handle_redirection' ) );
add_action( 'current_screen', array( $this, 'current_screen' ) );
// Handle post status change events.
add_action( 'trashed_post', array( $this, 'trashed_post' ) );
add_action( 'untrashed_post', array( $this, 'untrashed_post' ) );
add_action( 'deleted_post', array( $this, 'deleted_post' ) );
}
/**
* Returns the Field Groups admin URL.
*
* @date 27/3/20
* @since 5.9.0
*
* @param string $params Extra URL params.
* @return string
*/
public function get_admin_url( $params = '' ) {
return admin_url( "edit.php?post_type=acf-field-group{$params}" );
}
/**
* Returns the Field Groups admin URL taking into account the current view.
*
* @date 27/3/20
* @since 5.9.0
*
* @param string $params Extra URL params.
* @return string
*/
public function get_current_admin_url( $params = '' ) {
return $this->get_admin_url( ( $this->view ? '&post_status=' . $this->view : '' ) . $params );
}
/**
* Redirects users from ACF 4.0 admin page.
*
* @date 17/9/18
* @since 5.7.6
*
* @param void
* @return void
*/
public function handle_redirection() {
if ( isset( $_GET['post_type'] ) && $_GET['post_type'] === 'acf' ) {
wp_redirect( $this->get_admin_url() );
exit;
}
}
/**
* Constructor for the Field Groups admin page.
*
* @date 21/07/2014
* @since 5.0.0
*
* @param void
* @return void
*/
public function current_screen() {
// Bail early if not Field Groups admin page.
if ( ! acf_is_screen( 'edit-acf-field-group' ) ) {
return;
}
// Get the current view.
$this->view = isset( $_GET['post_status'] ) ? sanitize_text_field( $_GET['post_status'] ) : '';
// Setup and check for custom actions..
$this->setup_sync();
$this->check_sync();
$this->check_duplicate();
// Modify publish post status text and order.
global $wp_post_statuses;
$wp_post_statuses['publish']->label_count = _n_noop( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', 'acf' );
$wp_post_statuses['trash'] = acf_extract_var( $wp_post_statuses, 'trash' );
// Add hooks.
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
add_action( 'admin_body_class', array( $this, 'admin_body_class' ) );
add_filter( 'views_edit-acf-field-group', array( $this, 'admin_table_views' ), 10, 1 );
add_filter( 'manage_acf-field-group_posts_columns', array( $this, 'admin_table_columns' ), 10, 1 );
add_action( 'manage_acf-field-group_posts_custom_column', array( $this, 'admin_table_columns_html' ), 10, 2 );
add_filter( 'display_post_states', array( $this, 'display_post_states' ), 10, 2 );
add_filter( 'bulk_actions-edit-acf-field-group', array( $this, 'admin_table_bulk_actions' ), 10, 1 );
add_action( 'admin_footer', array( $this, 'admin_footer' ), 1 );
if ( $this->view !== 'trash' ) {
add_filter( 'page_row_actions', array( $this, 'page_row_actions' ), 10, 2 );
}
// Add hooks for "sync" view.
if ( $this->view === 'sync' ) {
add_action( 'admin_footer', array( $this, 'admin_footer__sync' ), 1 );
}
}
/**
* Sets up the field groups ready for sync.
*
* @date 17/4/20
* @since 5.9.0
*
* @param void
* @return void
*/
public function setup_sync() {
// Review local json field groups.
if ( acf_get_local_json_files() ) {
// Get all groups in a single cached query to check if sync is available.
$all_field_groups = acf_get_field_groups();
foreach ( $all_field_groups as $field_group ) {
// Extract vars.
$local = acf_maybe_get( $field_group, 'local' );
$modified = acf_maybe_get( $field_group, 'modified' );
$private = acf_maybe_get( $field_group, 'private' );
// Ignore if is private.
if ( $private ) {
continue;
// Ignore not local "json".
} elseif ( $local !== 'json' ) {
continue;
// Append to sync if not yet in database.
} elseif ( ! $field_group['ID'] ) {
$this->sync[ $field_group['key'] ] = $field_group;
// Append to sync if "json" modified time is newer than database.
} elseif ( $modified && $modified > get_post_modified_time( 'U', true, $field_group['ID'] ) ) {
$this->sync[ $field_group['key'] ] = $field_group;
}
}
}
}
/**
* Enqueues admin scripts.
*
* @date 18/4/20
* @since 5.9.0
*
* @param void
* @return void
*/
public function admin_enqueue_scripts() {
acf_enqueue_script( 'acf' );
// Localize text.
acf_localize_text(
array(
'Review local JSON changes' => __( 'Review local JSON changes', 'acf' ),
'Loading diff' => __( 'Loading diff', 'acf' ),
'Sync changes' => __( 'Sync changes', 'acf' ),
)
);
}
/**
* Modifies the admin body class.
*
* @date 18/4/20
* @since 5.9.0
*
* @param string $classes Space-separated list of CSS classes.
* @return string
*/
public function admin_body_class( $classes ) {
$classes .= ' acf-admin-field-groups';
if ( $this->view ) {
$classes .= " view-{$this->view}";
}
return $classes;
}
/**
* returns the disabled post state HTML.
*
* @date 17/4/20
* @since 5.9.0
*
* @param void
* @return string
*/
public function get_disabled_post_state() {
return '<span class="dashicons dashicons-hidden"></span> ' . _x( 'Disabled', 'post status', 'acf' );
}
/**
* Adds the "disabled" post state for the admin table title.
*
* @date 1/4/20
* @since 5.9.0
*
* @param array $post_states An array of post display states.
* @param WP_Post $post The current post object.
* @return array
*/
public function display_post_states( $post_states, $post ) {
if ( $post->post_status === 'acf-disabled' ) {
$post_states['acf-disabled'] = $this->get_disabled_post_state();
}
return $post_states;
}
/**
* Customizes the admin table columns.
*
* @date 1/4/20
* @since 5.9.0
*
* @param array $columns The columns array.
* @return array
*/
public function admin_table_columns( $_columns ) {
$columns = array(
'cb' => $_columns['cb'],
'title' => $_columns['title'],
'acf-description' => __( 'Description', 'acf' ),
'acf-key' => __( 'Key', 'acf' ),
'acf-location' => __( 'Location', 'acf' ),
'acf-count' => __( 'Fields', 'acf' ),
);
if ( acf_get_local_json_files() ) {
$columns['acf-json'] = __( 'Local JSON', 'acf' );
}
return $columns;
}
/**
* Renders the admin table column HTML
*
* @date 1/4/20
* @since 5.9.0
*
* @param string $column_name The name of the column to display.
* @param int $post_id The current post ID.
* @return void
*/
public function admin_table_columns_html( $column_name, $post_id ) {
$field_group = acf_get_field_group( $post_id );
if ( $field_group ) {
$this->render_admin_table_column( $column_name, $field_group );
}
}
/**
* Renders a specific admin table column.
*
* @date 17/4/20
* @since 5.9.0
*
* @param string $column_name The name of the column to display.
* @param array $field_group The field group.
* @return void
*/
public function render_admin_table_column( $column_name, $field_group ) {
switch ( $column_name ) {
// Key.
case 'acf-key':
echo esc_html( $field_group['key'] );
break;
// Description.
case 'acf-description':
if ( $field_group['description'] ) {
echo '<span class="acf-description">' . acf_esc_html( $field_group['description'] ) . '</span>';
}
break;
// Location.
case 'acf-location':
$this->render_admin_table_column_locations( $field_group );
break;
// Count.
case 'acf-count':
echo esc_html( acf_get_field_count( $field_group ) );
break;
// Local JSON.
case 'acf-json':
$this->render_admin_table_column_local_status( $field_group );
break;
}
}
/**
* Displays a visual representation of the field group's locations.
*
* @date 1/4/20
* @since 5.9.0
*
* @param array $field_group The field group.
* @return void
*/
public function render_admin_table_column_locations( $field_group ) {
$objects = array();
// Loop over location rules and determine connected object types.
if ( $field_group['location'] ) {
foreach ( $field_group['location'] as $i => $rules ) {
// Determine object types for each rule.
foreach ( $rules as $j => $rule ) {
// Get location type and subtype for the current rule.
$location = acf_get_location_rule( $rule['param'] );
$location_object_type = '';
$location_object_subtype = '';
if ( $location ) {
$location_object_type = $location->get_object_type( $rule );
$location_object_subtype = $location->get_object_subtype( $rule );
}
$rules[ $j ]['object_type'] = $location_object_type;
$rules[ $j ]['object_subtype'] = $location_object_subtype;
}
// Now that each $rule conains object type data...
$object_types = array_column( $rules, 'object_type' );
$object_types = array_filter( $object_types );
$object_types = array_values( $object_types );
if ( $object_types ) {
$object_type = $object_types[0];
} else {
continue;
}
$object_subtypes = array_column( $rules, 'object_subtype' );
$object_subtypes = array_filter( $object_subtypes );
$object_subtypes = array_values( $object_subtypes );
$object_subtypes = array_map( 'acf_array', $object_subtypes );
if ( count( $object_subtypes ) > 1 ) {
$object_subtypes = call_user_func_array( 'array_intersect', $object_subtypes );
$object_subtypes = array_values( $object_subtypes );
} elseif ( $object_subtypes ) {
$object_subtypes = $object_subtypes[0];
} else {
$object_subtypes = array( '' );
}
// Append to objects.
foreach ( $object_subtypes as $object_subtype ) {
$object = acf_get_object_type( $object_type, $object_subtype );
if ( $object ) {
$objects[ $object->name ] = $object;
}
}
}
}
// Reset keys.
$objects = array_values( $objects );
// Display.
$html = '';
if ( $objects ) {
$limit = 3;
$total = count( $objects );
// Icon.
$html .= '<span class="dashicons ' . $objects[0]->icon . ( $total > 1 ? ' acf-multi-dashicon' : '' ) . '"></span> ';
// Labels.
$labels = array_column( $objects, 'label' );
$labels = array_slice( $labels, 0, 3 );
$html .= implode( ', ', $labels );
// More.
if ( $total > $limit ) {
$html .= ', ...';
}
} else {
$html = '<span class="dashicons dashicons-businesswoman"></span> ' . __( 'Various', 'acf' );
}
// Filter.
echo acf_esc_html( $html );
}
/**
* Returns a human readable file location.
*
* @date 17/4/20
* @since 5.9.0
*
* @param string $file The full file path.
* @return string
*/
public function get_human_readable_file_location( $file ) {
// Generate friendly file path.
$theme_path = get_stylesheet_directory();
if ( strpos( $file, $theme_path ) !== false ) {
$rel_file = str_replace( $theme_path, '', $file );
$located = sprintf( __( 'Located in theme: %s', 'acf' ), $rel_file );
} elseif ( strpos( $file, WP_PLUGIN_DIR ) !== false ) {
$rel_file = str_replace( WP_PLUGIN_DIR, '', $file );
$located = sprintf( __( 'Located in plugin: %s', 'acf' ), $rel_file );
} else {
$rel_file = str_replace( ABSPATH, '', $file );
$located = sprintf( __( 'Located in: %s', 'acf' ), $rel_file );
}
return $located;
}
/**
* Displays the local JSON status of a field group.
*
* @date 14/4/20
* @since 5.9.0
*
* @param type $var Description. Default.
* @return type Description.
*/
public function render_admin_table_column_local_status( $field_group ) {
$json = acf_get_local_json_files();
if ( isset( $json[ $field_group['key'] ] ) ) {
$file = $json[ $field_group['key'] ];
if ( isset( $this->sync[ $field_group['key'] ] ) ) {
$url = $this->get_admin_url( '&acfsync=' . $field_group['key'] . '&_wpnonce=' . wp_create_nonce( 'bulk-posts' ) );
echo '<strong>' . __( 'Sync available', 'acf' ) . '</strong>';
if ( $field_group['ID'] ) {
echo '<div class="row-actions">
<span class="sync"><a href="' . esc_url( $url ) . '">' . __( 'Sync', 'acf' ) . '</a> | </span>
<span class="review"><a href="#" data-event="review-sync" data-id="' . esc_attr( $field_group['ID'] ) . '" data-href="' . esc_url( $url ) . '">' . __( 'Review changes', 'acf' ) . '</a></span>
</div>';
} else {
echo '<div class="row-actions">
<span class="sync"><a href="' . esc_url( $url ) . '">' . __( 'Import', 'acf' ) . '</a></span>
</div>';
}
} else {
echo __( 'Saved', 'acf' );
}
} else {
echo '<span class="acf-secondary-text">' . __( 'Awaiting save', 'acf' ) . '</span>';
}
}
/**
* Customizes the page row actions visible on hover.
*
* @date 14/4/20
* @since 5.9.0
*
* @param array $actions The array of actions HTML.
* @param WP_Post $post The post.
* @return array
*/
public function page_row_actions( $actions, $post ) {
// Remove "Quick Edit" action.
unset( $actions['inline'], $actions['inline hide-if-no-js'] );
// Append "Duplicate" action.
$duplicate_action_url = $this->get_admin_url( '&acfduplicate=' . $post->ID . '&_wpnonce=' . wp_create_nonce( 'bulk-posts' ) );
$actions['acfduplicate'] = '<a href="' . esc_url( $duplicate_action_url ) . '" aria-label="' . esc_attr__( 'Duplicate this item', 'acf' ) . '">' . __( 'Duplicate', 'acf' ) . '</a>';
// Return actions in custom order.
$order = array( 'edit', 'acfduplicate', 'trash' );
return array_merge( array_flip( $order ), $actions );
}
/**
* Modifies the admin table bulk actions dropdown.
*
* @date 15/4/20
* @since 5.9.0
*
* @param array $actions The actions array.
* @return array
*/
public function admin_table_bulk_actions( $actions ) {
// Add "duplicate" action.
if ( $this->view !== 'sync' ) {
$actions['acfduplicate'] = __( 'Duplicate', 'acf' );
}
// Add "Sync" action.
if ( $this->sync ) {
if ( $this->view === 'sync' ) {
$actions = array();
}
$actions['acfsync'] = __( 'Sync changes', 'acf' );
}
return $actions;
}
/**
* Checks for the custom "duplicate" action.
*
* @date 15/4/20
* @since 5.9.0
*
* @param void
* @return void
*/
public function check_duplicate() {
// Display notice on success redirect.
if ( isset( $_GET['acfduplicatecomplete'] ) ) {
$ids = array_map( 'intval', explode( ',', $_GET['acfduplicatecomplete'] ) );
// Generate text.
$text = sprintf(
_n( 'Field group duplicated.', '%s field groups duplicated.', count( $ids ), 'acf' ),
count( $ids )
);
// Append links to text.
$links = array();
foreach ( $ids as $id ) {
$links[] = '<a href="' . get_edit_post_link( $id ) . '">' . get_the_title( $id ) . '</a>';
}
$text .= ' ' . implode( ', ', $links );
// Add notice.
acf_add_admin_notice( $text, 'success' );
return;
}
// Find items to duplicate.
$ids = array();
if ( isset( $_GET['acfduplicate'] ) ) {
$ids[] = intval( $_GET['acfduplicate'] );
} elseif ( isset( $_GET['post'], $_GET['action2'] ) && $_GET['action2'] === 'acfduplicate' ) {
$ids = array_map( 'intval', $_GET['post'] );
}
if ( $ids ) {
check_admin_referer( 'bulk-posts' );
// Duplicate field groups and generate array of new IDs.
$new_ids = array();
foreach ( $ids as $id ) {
$field_group = acf_duplicate_field_group( $id );
$new_ids[] = $field_group['ID'];
}
// Redirect.
wp_redirect( $this->get_admin_url( '&acfduplicatecomplete=' . implode( ',', $new_ids ) ) );
exit;
}
}
/**
* Checks for the custom "acfsync" action.
*
* @date 15/4/20
* @since 5.9.0
*
* @param void
* @return void
*/
public function check_sync() {
// Display notice on success redirect.
if ( isset( $_GET['acfsynccomplete'] ) ) {
$ids = array_map( 'intval', explode( ',', $_GET['acfsynccomplete'] ) );
// Generate text.
$text = sprintf(
_n( 'Field group synchronised.', '%s field groups synchronised.', count( $ids ), 'acf' ),
count( $ids )
);
// Append links to text.
$links = array();
foreach ( $ids as $id ) {
$links[] = '<a href="' . get_edit_post_link( $id ) . '">' . get_the_title( $id ) . '</a>';
}
$text .= ' ' . implode( ', ', $links );
// Add notice.
acf_add_admin_notice( $text, 'success' );
return;
}
// Find items to sync.
$keys = array();
if ( isset( $_GET['acfsync'] ) ) {
$keys[] = sanitize_text_field( $_GET['acfsync'] );
} elseif ( isset( $_GET['post'], $_GET['action2'] ) && $_GET['action2'] === 'acfsync' ) {
$keys = array_map( 'sanitize_text_field', $_GET['post'] );
}
if ( $keys && $this->sync ) {
check_admin_referer( 'bulk-posts' );
// Disabled "Local JSON" controller to prevent the .json file from being modified during import.
acf_update_setting( 'json', false );
// Sync field groups and generate array of new IDs.
$files = acf_get_local_json_files();
$new_ids = array();
foreach ( $this->sync as $key => $field_group ) {
if ( $field_group['key'] && in_array( $field_group['key'], $keys ) ) {
// Import.
} elseif ( $field_group['ID'] && in_array( $field_group['ID'], $keys ) ) {
// Import.
} else {
// Ignore.
continue;
}
$local_field_group = json_decode( file_get_contents( $files[ $key ] ), true );
$local_field_group['ID'] = $field_group['ID'];
$result = acf_import_field_group( $local_field_group );
$new_ids[] = $result['ID'];
}
// Redirect.
wp_redirect( $this->get_current_admin_url( '&acfsynccomplete=' . implode( ',', $new_ids ) ) );
exit;
}
}
/**
* Customizes the admin table subnav.
*
* @date 17/4/20
* @since 5.9.0
*
* @param array $views The available views.
* @return array
*/
public function admin_table_views( $views ) {
global $wp_list_table, $wp_query;
// Count items.
$count = count( $this->sync );
// Append "sync" link to subnav.
if ( $count ) {
$views['sync'] = sprintf(
'<a %s href="%s">%s <span class="count">(%s)</span></a>',
( $this->view === 'sync' ? 'class="current"' : '' ),
esc_url( $this->get_admin_url( '&post_status=sync' ) ),
esc_html( __( 'Sync available', 'acf' ) ),
$count
);
}
// Modify table pagination args to match JSON data.
if ( $this->view === 'sync' ) {
$wp_list_table->set_pagination_args(
array(
'total_items' => $count,
'total_pages' => 1,
'per_page' => $count,
)
);
$wp_query->post_count = 1; // At least one post is needed to render bulk drop-down.
}
return $views;
}
/**
* Prints scripts into the admin footer.
*
* @date 20/4/20
* @since 5.9.0
*
* @param void
* @return void
*/
function admin_footer() {
?>
<script type="text/javascript">
(function($){
// Displays a modal comparing local changes.
function reviewSync( props ) {
var modal = acf.newModal({
title: acf.__('Review local JSON changes'),
content: '<p class="acf-modal-feedback"><i class="acf-loading"></i> ' + acf.__('Loading diff') + '</p>',
toolbar: '<a href="' + props.href + '" class="button button-primary button-sync-changes disabled">' + acf.__('Sync changes') + '</a>',
});
// Call AJAX.
var xhr = $.ajax({
url: acf.get('ajaxurl'),
method: 'POST',
dataType: 'json',
data: acf.prepareForAjax({
action: 'acf/ajax/local_json_diff',
id: props.id
})
})
.done(function( data, textStatus, jqXHR ) {
modal.content( data.html );
modal.$('.button-sync-changes').removeClass('disabled');
})
.fail(function( jqXHR, textStatus, errorThrown ) {
if( error = acf.getXhrError(jqXHR) ) {
modal.content( '<p class="acf-modal-feedback error">' + error + '</p>' );
}
});
}
// Add event listener.
$(document).on('click', 'a[data-event="review-sync"]', function( e ){
e.preventDefault();
reviewSync( $(this).data() );
});
})(jQuery);
</script>
<?php
}
/**
* Customizes the admin table HTML when viewing "sync" post_status.
*
* @date 17/4/20
* @since 5.9.0
*
* @param array $views The available views.
* @return array
*/
public function admin_footer__sync() {
global $wp_list_table;
// Get table columns.
$columns = $wp_list_table->get_columns();
$hidden = get_hidden_columns( $wp_list_table->screen );
?>
<div style="display: none;">
<table>
<tbody id="acf-the-list">
<?php
foreach ( $this->sync as $k => $field_group ) {
echo '<tr>';
foreach ( $columns as $column_name => $column_label ) {
$el = 'td';
if ( $column_name === 'cb' ) {
$el = 'th';
$classes = 'check-column';
$column_label = '';
} elseif ( $column_name === 'title' ) {
$classes = "$column_name column-$column_name column-primary";
} else {
$classes = "$column_name column-$column_name";
}
if ( in_array( $column_name, $hidden, true ) ) {
$classes .= ' hidden';
}
echo "<$el class=\"$classes\" data-colname=\"$column_label\">";
switch ( $column_name ) {
// Checkbox.
case 'cb':
echo '<label for="cb-select-' . esc_attr( $k ) . '" class="screen-reader-text">' . esc_html( sprintf( __( 'Select %s', 'acf' ), $field_group['title'] ) ) . '</label>';
echo '<input id="cb-select-' . esc_attr( $k ) . '" type="checkbox" value="' . esc_attr( $k ) . '" name="post[]">';
break;
// Title.
case 'title':
$post_state = '';
if ( ! $field_group['active'] ) {
$post_state = ' — <span class="post-state">' . $this->get_disabled_post_state() . '</span>';
}
echo '<strong><span class="row-title">' . esc_html( $field_group['title'] ) . '</span>' . $post_state . '</strong>';
echo '<div class="row-actions"><span class="file acf-secondary-text">' . $this->get_human_readable_file_location( $field_group['local_file'] ) . '</span></div>';
echo '<button type="button" class="toggle-row"><span class="screen-reader-text">Show more details</span></button>';
break;
// All other columns.
default:
$this->render_admin_table_column( $column_name, $field_group );
break;
}
echo "</$el>";
}
echo '</tr>';
}
?>
</tbody>
</table>
</div>
<script type="text/javascript">
(function($){
$('#the-list').html( $('#acf-the-list').children() );
})(jQuery);
</script>
<?php
}
/**
* Fires when trashing a field group post.
*
* @date 8/01/2014
* @since 5.0.0
*
* @param int $post_id The post ID.
* @return void
*/
public function trashed_post( $post_id ) {
if ( get_post_type( $post_id ) === 'acf-field-group' ) {
acf_trash_field_group( $post_id );
}
}
/**
* Fires when untrashing a field group post.
*
* @date 8/01/2014
* @since 5.0.0
*
* @param int $post_id The post ID.
* @return void
*/
public function untrashed_post( $post_id ) {
if ( get_post_type( $post_id ) === 'acf-field-group' ) {
acf_untrash_field_group( $post_id );
}
}
/**
* Fires when deleting a field group post.
*
* @date 8/01/2014
* @since 5.0.0
*
* @param int $post_id The post ID.
* @return void
*/
public function deleted_post( $post_id ) {
if ( get_post_type( $post_id ) === 'acf-field-group' ) {
acf_delete_field_group( $post_id );
}
}
}
// Instantiate.
acf_new_instance( 'ACF_Admin_Field_Groups' );
endif; // class_exists check

View File

@@ -0,0 +1,140 @@
<?php
/**
* ACF Admin Notices
*
* Functions and classes to manage admin notices.
*
* @date 10/1/19
* @since 5.7.10
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Register notices store.
acf_register_store( 'notices' );
/**
* ACF_Admin_Notice
*
* Class used to create an admin notice.
*
* @date 10/1/19
* @since 5.7.10
*/
if ( ! class_exists( 'ACF_Admin_Notice' ) ) :
class ACF_Admin_Notice extends ACF_Data {
/** @var array Storage for data. */
var $data = array(
/** @type string Text displayed in notice. */
'text' => '',
/** @type string The type of notice (warning, error, success, info). */
'type' => 'info',
/** @type bool If the notice can be dismissed. */
'dismissible' => true,
);
/**
* render
*
* Renders the notice HTML.
*
* @date 27/12/18
* @since 5.8.0
*
* @param void
* @return void
*/
function render() {
$notice_text = $this->get( 'text' );
$notice_type = $this->get( 'type' );
$is_dismissible = $this->get( 'dismissible' );
printf(
'<div class="acf-admin-notice notice notice-%s %s">%s</div>',
esc_attr( $notice_type ),
$is_dismissible ? 'is-dismissible' : '',
acf_esc_html( wpautop( acf_punctify( $notice_text ) ) )
);
}
}
endif; // class_exists check
/**
* acf_new_admin_notice
*
* Instantiates and returns a new model.
*
* @date 23/12/18
* @since 5.8.0
*
* @param array $data Optional data to set.
* @return ACF_Admin_Notice
*/
function acf_new_admin_notice( $data = false ) {
// Create notice.
$instance = new ACF_Admin_Notice( $data );
// Register notice.
acf_get_store( 'notices' )->set( $instance->cid, $instance );
// Return notice.
return $instance;
}
/**
* acf_render_admin_notices
*
* Renders all admin notices HTML.
*
* @date 10/1/19
* @since 5.7.10
*
* @param void
* @return void
*/
function acf_render_admin_notices() {
// Get notices.
$notices = acf_get_store( 'notices' )->get_data();
// Loop over notices and render.
if ( $notices ) {
foreach ( $notices as $notice ) {
$notice->render();
}
}
}
// Render notices during admin action.
add_action( 'admin_notices', 'acf_render_admin_notices', 99 );
/**
* acf_add_admin_notice
*
* Creates and returns a new notice.
*
* @date 17/10/13
* @since 5.0.0
*
* @param string $text The admin notice text.
* @param string $class The type of notice (warning, error, success, info).
* @return ACF_Admin_Notice
*/
function acf_add_admin_notice( $text = '', $type = 'info' ) {
return acf_new_admin_notice(
array(
'text' => $text,
'type' => $type,
)
);
}

View File

@@ -0,0 +1,347 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'acf_admin_tools' ) ) :
class acf_admin_tools {
/** @var array Contains an array of admin tool instances */
var $tools = array();
/** @var string The active tool */
var $active = '';
/**
* __construct
*
* This function will setup the class functionality
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function __construct() {
// actions
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
}
/**
* register_tool
*
* This function will store a tool tool class
*
* @date 10/10/17
* @since 5.6.3
*
* @param string $class
* @return n/a
*/
function register_tool( $class ) {
$instance = new $class();
$this->tools[ $instance->name ] = $instance;
}
/**
* get_tool
*
* This function will return a tool tool class
*
* @date 10/10/17
* @since 5.6.3
*
* @param string $name
* @return n/a
*/
function get_tool( $name ) {
return isset( $this->tools[ $name ] ) ? $this->tools[ $name ] : null;
}
/**
* get_tools
*
* This function will return an array of all tools
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return array
*/
function get_tools() {
return $this->tools;
}
/*
* admin_menu
*
* This function will add the ACF menu item to the WP admin
*
* @type action (admin_menu)
* @date 28/09/13
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
function admin_menu() {
// bail early if no show_admin
if ( ! acf_get_setting( 'show_admin' ) ) {
return;
}
// add page
$page = add_submenu_page( 'edit.php?post_type=acf-field-group', __( 'Tools', 'acf' ), __( 'Tools', 'acf' ), acf_get_setting( 'capability' ), 'acf-tools', array( $this, 'html' ) );
// actions
add_action( 'load-' . $page, array( $this, 'load' ) );
}
/**
* load
*
* description
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function load() {
// disable filters (default to raw data)
acf_disable_filters();
// include tools
$this->include_tools();
// check submit
$this->check_submit();
// load acf scripts
acf_enqueue_scripts();
}
/**
* include_tools
*
* description
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function include_tools() {
// include
acf_include( 'includes/admin/tools/class-acf-admin-tool.php' );
acf_include( 'includes/admin/tools/class-acf-admin-tool-export.php' );
acf_include( 'includes/admin/tools/class-acf-admin-tool-import.php' );
// action
do_action( 'acf/include_admin_tools' );
}
/**
* check_submit
*
* description
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function check_submit() {
// loop
foreach ( $this->get_tools() as $tool ) {
// load
$tool->load();
// submit
if ( acf_verify_nonce( $tool->name ) ) {
$tool->submit();
}
}
}
/**
* html
*
* description
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function html() {
// vars
$screen = get_current_screen();
$active = acf_maybe_get_GET( 'tool' );
// view
$view = array(
'screen_id' => $screen->id,
'active' => $active,
);
// register metaboxes
foreach ( $this->get_tools() as $tool ) {
// check active
if ( $active && $active !== $tool->name ) {
continue;
}
// add metabox
add_meta_box( 'acf-admin-tool-' . $tool->name, acf_esc_html( $tool->title ), array( $this, 'metabox_html' ), $screen->id, 'normal', 'default', array( 'tool' => $tool->name ) );
}
// view
acf_get_view( 'html-admin-tools', $view );
}
/**
* meta_box_html
*
* description
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function metabox_html( $post, $metabox ) {
// vars
$tool = $this->get_tool( $metabox['args']['tool'] );
?>
<form method="post">
<?php $tool->html(); ?>
<?php acf_nonce_input( $tool->name ); ?>
</form>
<?php
}
}
// initialize
acf()->admin_tools = new acf_admin_tools();
endif; // class_exists check
/*
* acf_register_admin_tool
*
* alias of acf()->admin_tools->register_tool()
*
* @type function
* @date 31/5/17
* @since 5.6.0
*
* @param n/a
* @return n/a
*/
function acf_register_admin_tool( $class ) {
return acf()->admin_tools->register_tool( $class );
}
/*
* acf_get_admin_tools_url
*
* This function will return the admin URL to the tools page
*
* @type function
* @date 31/5/17
* @since 5.6.0
*
* @param n/a
* @return n/a
*/
function acf_get_admin_tools_url() {
return admin_url( 'edit.php?post_type=acf-field-group&page=acf-tools' );
}
/*
* acf_get_admin_tool_url
*
* This function will return the admin URL to the tools page
*
* @type function
* @date 31/5/17
* @since 5.6.0
*
* @param n/a
* @return n/a
*/
function acf_get_admin_tool_url( $tool = '' ) {
return acf_get_admin_tools_url() . '&tool=' . $tool;
}
?>

View File

@@ -0,0 +1,246 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
class ACF_Admin_Upgrade {
/**
* __construct
*
* Sets up the class functionality.
*
* @date 31/7/18
* @since 5.7.2
*
* @param void
* @return void
*/
function __construct() {
// actions
add_action( 'admin_menu', array( $this, 'admin_menu' ), 20 );
if ( is_multisite() ) {
add_action( 'network_admin_menu', array( $this, 'network_admin_menu' ), 20 );
}
}
/**
* admin_menu
*
* Setus up logic if DB Upgrade is needed on a single site.
*
* @date 24/8/18
* @since 5.7.4
*
* @param void
* @return void
*/
function admin_menu() {
// check if upgrade is avaialble
if ( acf_has_upgrade() ) {
// add notice
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
// add page
$page = add_submenu_page( 'index.php', __( 'Upgrade Database', 'acf' ), __( 'Upgrade Database', 'acf' ), acf_get_setting( 'capability' ), 'acf-upgrade', array( $this, 'admin_html' ) );
// actions
add_action( 'load-' . $page, array( $this, 'admin_load' ) );
}
}
/**
* network_admin_menu
*
* Sets up admin logic if DB Upgrade is required on a multi site.
*
* @date 24/8/18
* @since 5.7.4
*
* @param void
* @return void
*/
function network_admin_menu() {
// Vars.
$upgrade = false;
// Loop over sites and check for upgrades.
$sites = get_sites( array( 'number' => 0 ) );
if ( $sites ) {
// Unhook action to avoid memory issue (as seen in wp-includes/ms-site.php).
remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
foreach ( $sites as $site ) {
// Switch site.
switch_to_blog( $site->blog_id );
// Check for upgrade.
$site_upgrade = acf_has_upgrade();
// Restore site.
// Ideally, we would switch back to the original site at after looping, however,
// the restore_current_blog() is needed to modify global vars.
restore_current_blog();
// Check if upgrade was found.
if ( $site_upgrade ) {
$upgrade = true;
break;
}
}
add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
}
// Bail early if no upgrade is needed.
if ( ! $upgrade ) {
return;
}
// Add notice.
add_action( 'network_admin_notices', array( $this, 'network_admin_notices' ) );
// Add page.
$page = add_submenu_page(
'index.php',
__( 'Upgrade Database', 'acf' ),
__( 'Upgrade Database', 'acf' ),
acf_get_setting( 'capability' ),
'acf-upgrade-network',
array( $this, 'network_admin_html' )
);
add_action( "load-$page", array( $this, 'network_admin_load' ) );
}
/**
* admin_load
*
* Runs during the loading of the admin page.
*
* @date 24/8/18
* @since 5.7.4
*
* @param type $var Description. Default.
* @return type Description.
*/
function admin_load() {
// remove prompt
remove_action( 'admin_notices', array( $this, 'admin_notices' ) );
// Enqueue core script.
acf_enqueue_script( 'acf' );
}
/**
* network_admin_load
*
* Runs during the loading of the network admin page.
*
* @date 24/8/18
* @since 5.7.4
*
* @param type $var Description. Default.
* @return type Description.
*/
function network_admin_load() {
// remove prompt
remove_action( 'network_admin_notices', array( $this, 'network_admin_notices' ) );
// Enqueue core script.
acf_enqueue_script( 'acf' );
}
/**
* admin_notices
*
* Displays the DB Upgrade prompt.
*
* @date 23/8/18
* @since 5.7.3
*
* @param void
* @return void
*/
function admin_notices() {
// vars
$view = array(
'button_text' => __( 'Upgrade Database', 'acf' ),
'button_url' => admin_url( 'index.php?page=acf-upgrade' ),
'confirm' => true,
);
// view
acf_get_view( 'html-notice-upgrade', $view );
}
/**
* network_admin_notices
*
* Displays the DB Upgrade prompt on a multi site.
*
* @date 23/8/18
* @since 5.7.3
*
* @param void
* @return void
*/
function network_admin_notices() {
// vars
$view = array(
'button_text' => __( 'Review sites & upgrade', 'acf' ),
'button_url' => network_admin_url( 'index.php?page=acf-upgrade-network' ),
'confirm' => false,
);
// view
acf_get_view( 'html-notice-upgrade', $view );
}
/**
* admin_html
*
* Displays the HTML for the admin page.
*
* @date 24/8/18
* @since 5.7.4
*
* @param void
* @return void
*/
function admin_html() {
acf_get_view( 'html-admin-page-upgrade' );
}
/**
* network_admin_html
*
* Displays the HTML for the network upgrade admin page.
*
* @date 24/8/18
* @since 5.7.4
*
* @param void
* @return void
*/
function network_admin_html() {
acf_get_view( 'html-admin-page-upgrade-network' );
}
}
// instantiate
acf_new_instance( 'ACF_Admin_Upgrade' );
endif; // class_exists check

View File

@@ -0,0 +1,209 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Admin' ) ) :
class ACF_Admin {
/**
* Constructor.
*
* @date 23/06/12
* @since 5.0.0
*
* @param void
* @return void
*/
function __construct() {
// Add actions.
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
add_action( 'admin_body_class', array( $this, 'admin_body_class' ) );
add_action( 'current_screen', array( $this, 'current_screen' ) );
}
/**
* Adds the ACF menu item.
*
* @date 28/09/13
* @since 5.0.0
*
* @param void
* @return void
*/
function admin_menu() {
// Bail early if ACF is hidden.
if ( ! acf_get_setting( 'show_admin' ) ) {
return;
}
// Vars.
$slug = 'edit.php?post_type=acf-field-group';
$cap = acf_get_setting( 'capability' );
// Add menu items.
add_menu_page( __( 'Custom Fields', 'acf' ), __( 'Custom Fields', 'acf' ), $cap, $slug, false, 'dashicons-welcome-widgets-menus', 80 );
add_submenu_page( $slug, __( 'Field Groups', 'acf' ), __( 'Field Groups', 'acf' ), $cap, $slug );
add_submenu_page( $slug, __( 'Add New', 'acf' ), __( 'Add New', 'acf' ), $cap, 'post-new.php?post_type=acf-field-group' );
}
/**
* Enqueues global admin styling.
*
* @date 28/09/13
* @since 5.0.0
*
* @param void
* @return void
*/
function admin_enqueue_scripts() {
wp_enqueue_style( 'acf-global' );
}
/**
* Appends custom admin body classes.
*
* @date 5/11/19
* @since 5.8.7
*
* @param string $classes Space-separated list of CSS classes.
* @return string
*/
function admin_body_class( $classes ) {
global $wp_version;
// Determine body class version.
$wp_minor_version = floatval( $wp_version );
if ( $wp_minor_version >= 5.3 ) {
$classes .= ' acf-admin-5-3';
} else {
$classes .= ' acf-admin-3-8';
}
// Add browser for specific CSS.
$classes .= ' acf-browser-' . acf_get_browser();
// Return classes.
return $classes;
}
/**
* Adds custom functionality to "ACF" admin pages.
*
* @date 7/4/20
* @since 5.9.0
*
* @param void
* @return void
*/
function current_screen( $screen ) {
// Determine if the current page being viewed is "ACF" related.
if ( isset( $screen->post_type ) && $screen->post_type === 'acf-field-group' ) {
add_action( 'in_admin_header', array( $this, 'in_admin_header' ) );
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
$this->setup_help_tab();
}
}
/**
* Sets up the admin help tab.
*
* @date 20/4/20
* @since 5.9.0
*
* @param void
* @return void
*/
public function setup_help_tab() {
$screen = get_current_screen();
// Overview tab.
$screen->add_help_tab(
array(
'id' => 'overview',
'title' => __( 'Overview', 'acf' ),
'content' =>
'<p><strong>' . __( 'Overview', 'acf' ) . '</strong></p>' .
'<p>' . __( 'The Advanced Custom Fields plugin provides a visual form builder to customize WordPress edit screens with extra fields, and an intuitive API to display custom field values in any theme template file.', 'acf' ) . '</p>' .
'<p>' . sprintf(
__( 'Before creating your first Field Group, we recommend first reading our <a href="%s" target="_blank">Getting started</a> guide to familiarize yourself with the plugin\'s philosophy and best practises.', 'acf' ),
'https://www.advancedcustomfields.com/resources/getting-started-with-acf/'
) . '</p>' .
'<p>' . __( 'Please use the Help & Support tab to get in touch should you find yourself requiring assistance.', 'acf' ) . '</p>' .
'',
)
);
// Help tab.
$screen->add_help_tab(
array(
'id' => 'help',
'title' => __( 'Help & Support', 'acf' ),
'content' =>
'<p><strong>' . __( 'Help & Support', 'acf' ) . '</strong></p>' .
'<p>' . __( 'We are fanatical about support, and want you to get the best out of your website with ACF. If you run into any difficulties, there are several places you can find help:', 'acf' ) . '</p>' .
'<ul>' .
'<li>' . sprintf(
__( '<a href="%s" target="_blank">Documentation</a>. Our extensive documentation contains references and guides for most situations you may encounter.', 'acf' ),
'https://www.advancedcustomfields.com/resources/'
) . '</li>' .
'<li>' . sprintf(
__( '<a href="%s" target="_blank">Discussions</a>. We have an active and friendly community on our Community Forums who may be able to help you figure out the how-tos of the ACF world.', 'acf' ),
'https://support.advancedcustomfields.com/'
) . '</li>' .
'<li>' . sprintf(
__( '<a href="%s" target="_blank">Help Desk</a>. The support professionals on our Help Desk will assist with your more in depth, technical challenges.', 'acf' ),
'https://www.advancedcustomfields.com/support/'
) . '</li>' .
'</ul>',
)
);
// Sidebar.
$screen->set_help_sidebar(
'<p><strong>' . __( 'Information', 'acf' ) . '</strong></p>' .
'<p><span class="dashicons dashicons-admin-plugins"></span> ' . sprintf( __( 'Version %s', 'acf' ), ACF_VERSION ) . '</p>' .
'<p><span class="dashicons dashicons-wordpress"></span> <a href="https://wordpress.org/plugins/advanced-custom-fields/" target="_blank">' . __( 'View details', 'acf' ) . '</a></p>' .
'<p><span class="dashicons dashicons-admin-home"></span> <a href="https://www.advancedcustomfields.com/" target="_blank" target="_blank">' . __( 'Visit website', 'acf' ) . '</a></p>' .
''
);
}
/**
* Renders the admin navigation element.
*
* @date 27/3/20
* @since 5.9.0
*
* @param void
* @return void
*/
function in_admin_header() {
acf_get_view( 'html-admin-navigation' );
}
/**
* Modifies the admin footer text.
*
* @date 7/4/20
* @since 5.9.0
*
* @param string $text The admin footer text.
* @return string
*/
function admin_footer_text( $text ) {
// Use RegExp to append "ACF" after the <a> element allowing translations to read correctly.
return preg_replace( '/(<a[\S\s]+?\/a>)/', '$1 ' . __( 'and', 'acf' ) . ' <a href="https://www.advancedcustomfields.com" target="_blank">ACF</a>', $text, 1 );
}
}
// Instantiate.
acf_new_instance( 'ACF_Admin' );
endif; // class_exists check

View File

@@ -0,0 +1,580 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
class ACF_Admin_Tool_Export extends ACF_Admin_Tool {
/** @var string View context */
var $view = '';
/** @var array Export data */
var $json = '';
/**
* initialize
*
* This function will initialize the admin tool
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function initialize() {
// vars
$this->name = 'export';
$this->title = __( 'Export Field Groups', 'acf' );
// active
if ( $this->is_active() ) {
$this->title .= ' - ' . __( 'Generate PHP', 'acf' );
}
}
/**
* submit
*
* This function will run when the tool's form has been submit
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function submit() {
// vars
$action = acf_maybe_get_POST( 'action' );
// download
if ( $action === 'download' ) {
$this->submit_download();
// generate
} elseif ( $action === 'generate' ) {
$this->submit_generate();
}
}
/**
* submit_download
*
* description
*
* @date 17/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function submit_download() {
// vars
$json = $this->get_selected();
// validate
if ( $json === false ) {
return acf_add_admin_notice( __( 'No field groups selected', 'acf' ), 'warning' );
}
// headers
$file_name = 'acf-export-' . date( 'Y-m-d' ) . '.json';
header( 'Content-Description: File Transfer' );
header( "Content-Disposition: attachment; filename={$file_name}" );
header( 'Content-Type: application/json; charset=utf-8' );
// return
echo acf_json_encode( $json );
die;
}
/**
* submit_generate
*
* description
*
* @date 17/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function submit_generate() {
// vars
$keys = $this->get_selected_keys();
// validate
if ( ! $keys ) {
return acf_add_admin_notice( __( 'No field groups selected', 'acf' ), 'warning' );
}
// url
$url = add_query_arg( 'keys', implode( '+', $keys ), $this->get_url() );
// redirect
wp_redirect( $url );
exit;
}
/**
* load
*
* description
*
* @date 21/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function load() {
// active
if ( $this->is_active() ) {
// get selected keys
$selected = $this->get_selected_keys();
// add notice
if ( $selected ) {
$count = count( $selected );
$text = sprintf( _n( 'Exported 1 field group.', 'Exported %s field groups.', $count, 'acf' ), $count );
acf_add_admin_notice( $text, 'success' );
}
}
}
/**
* html
*
* This function will output the metabox HTML
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function html() {
// single (generate PHP)
if ( $this->is_active() ) {
$this->html_single();
// archive
} else {
$this->html_archive();
}
}
/**
* html_field_selection
*
* description
*
* @date 24/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function html_field_selection() {
// vars
$choices = array();
$selected = $this->get_selected_keys();
$field_groups = acf_get_field_groups();
// loop
if ( $field_groups ) {
foreach ( $field_groups as $field_group ) {
$choices[ $field_group['key'] ] = esc_html( $field_group['title'] );
}
}
// render
acf_render_field_wrap(
array(
'label' => __( 'Select Field Groups', 'acf' ),
'type' => 'checkbox',
'name' => 'keys',
'prefix' => false,
'value' => $selected,
'toggle' => true,
'choices' => $choices,
)
);
}
/**
* html_panel_selection
*
* description
*
* @date 21/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function html_panel_selection() {
?>
<div class="acf-panel acf-panel-selection">
<h3 class="acf-panel-title"><?php _e( 'Select Field Groups', 'acf' ); ?> <i class="dashicons dashicons-arrow-right"></i></h3>
<div class="acf-panel-inside">
<?php $this->html_field_selection(); ?>
</div>
</div>
<?php
}
/**
* html_panel_settings
*
* description
*
* @date 21/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function html_panel_settings() {
?>
<div class="acf-panel acf-panel-settings">
<h3 class="acf-panel-title"><?php _e( 'Settings', 'acf' ); ?> <i class="dashicons dashicons-arrow-right"></i></h3>
<div class="acf-panel-inside">
<?php
/*
acf_render_field_wrap(array(
'label' => __('Empty settings', 'acf'),
'type' => 'select',
'name' => 'minimal',
'prefix' => false,
'value' => '',
'choices' => array(
'all' => __('Include all settings', 'acf'),
'minimal' => __('Ignore empty settings', 'acf'),
)
));
*/
?>
</div>
</div>
<?php
}
/**
* html_archive
*
* description
*
* @date 20/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function html_archive() {
?>
<p><?php _e( 'Select the field groups you would like to export and then select your export method. Use the download button to export to a .json file which you can then import to another ACF installation. Use the generate button to export to PHP code which you can place in your theme.', 'acf' ); ?></p>
<div class="acf-fields">
<?php $this->html_field_selection(); ?>
</div>
<p class="acf-submit">
<button type="submit" name="action" class="button button-primary" value="download"><?php _e( 'Export File', 'acf' ); ?></button>
<button type="submit" name="action" class="button" value="generate"><?php _e( 'Generate PHP', 'acf' ); ?></button>
</p>
<?php
}
/**
* html_single
*
* description
*
* @date 20/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function html_single() {
?>
<div class="acf-postbox-columns">
<div class="acf-postbox-main">
<?php $this->html_generate(); ?>
</div>
<div class="acf-postbox-side">
<?php $this->html_panel_selection(); ?>
<p class="acf-submit">
<button type="submit" name="action" class="button button-primary" value="generate"><?php _e( 'Generate PHP', 'acf' ); ?></button>
</p>
</div>
</div>
<?php
}
/**
* html_generate
*
* description
*
* @date 17/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function html_generate() {
// prevent default translation and fake __() within string
acf_update_setting( 'l10n_var_export', true );
// vars
$json = $this->get_selected();
$str_replace = array(
' ' => "\t",
"'!!__(!!\'" => "__('",
"!!\', !!\'" => "', '",
"!!\')!!'" => "')",
'array (' => 'array(',
);
$preg_replace = array(
'/([\t\r\n]+?)array/' => 'array',
'/[0-9]+ => array/' => 'array',
);
?>
<p><?php _e( "The following code can be used to register a local version of the selected field group(s). A local field group can provide many benefits such as faster load times, version control & dynamic fields/settings. Simply copy and paste the following code to your theme's functions.php file or include it within an external file.", 'acf' ); ?></p>
<textarea id="acf-export-textarea" readonly="true">
<?php
echo "if( function_exists('acf_add_local_field_group') ):" . "\r\n" . "\r\n";
foreach ( $json as $field_group ) {
// code
$code = var_export( $field_group, true );
// change double spaces to tabs
$code = str_replace( array_keys( $str_replace ), array_values( $str_replace ), $code );
// correctly formats "=> array("
$code = preg_replace( array_keys( $preg_replace ), array_values( $preg_replace ), $code );
// esc_textarea
$code = esc_textarea( $code );
// echo
echo "acf_add_local_field_group({$code});" . "\r\n" . "\r\n";
}
echo 'endif;';
?>
</textarea>
<p class="acf-submit">
<a class="button" id="acf-export-copy"><?php _e( 'Copy to clipboard', 'acf' ); ?></a>
</p>
<script type="text/javascript">
(function($){
// vars
var $a = $('#acf-export-copy');
var $textarea = $('#acf-export-textarea');
// remove $a if 'copy' is not supported
if( !document.queryCommandSupported('copy') ) {
return $a.remove();
}
// event
$a.on('click', function( e ){
// prevent default
e.preventDefault();
// select
$textarea.get(0).select();
// try
try {
// copy
var copy = document.execCommand('copy');
if( !copy ) return;
// tooltip
acf.newTooltip({
text: "<?php _e( 'Copied', 'acf' ); ?>",
timeout: 250,
target: $(this),
});
} catch (err) {
// do nothing
}
});
})(jQuery);
</script>
<?php
}
/**
* get_selected_keys
*
* This function will return an array of field group keys that have been selected
*
* @date 20/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function get_selected_keys() {
// check $_POST
if ( $keys = acf_maybe_get_POST( 'keys' ) ) {
return (array) $keys;
}
// check $_GET
if ( $keys = acf_maybe_get_GET( 'keys' ) ) {
$keys = str_replace( ' ', '+', $keys );
return explode( '+', $keys );
}
// return
return false;
}
/**
* get_selected
*
* This function will return the JSON data for given $_POST args
*
* @date 17/10/17
* @since 5.6.3
*
* @param n/a
* @return array
*/
function get_selected() {
// vars
$selected = $this->get_selected_keys();
$json = array();
// bail early if no keys
if ( ! $selected ) {
return false;
}
// construct JSON
foreach ( $selected as $key ) {
// load field group
$field_group = acf_get_field_group( $key );
// validate field group
if ( empty( $field_group ) ) {
continue;
}
// load fields
$field_group['fields'] = acf_get_fields( $field_group );
// prepare for export
$field_group = acf_prepare_field_group_for_export( $field_group );
// add to json array
$json[] = $field_group;
}
// return
return $json;
}
}
// initialize
acf_register_admin_tool( 'ACF_Admin_Tool_Export' );
endif; // class_exists check
?>

View File

@@ -0,0 +1,161 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
class ACF_Admin_Tool_Import extends ACF_Admin_Tool {
/**
* initialize
*
* This function will initialize the admin tool
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function initialize() {
// vars
$this->name = 'import';
$this->title = __( 'Import Field Groups', 'acf' );
$this->icon = 'dashicons-upload';
}
/**
* html
*
* This function will output the metabox HTML
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function html() {
?>
<p><?php _e( 'Select the Advanced Custom Fields JSON file you would like to import. When you click the import button below, ACF will import the field groups.', 'acf' ); ?></p>
<div class="acf-fields">
<?php
acf_render_field_wrap(
array(
'label' => __( 'Select File', 'acf' ),
'type' => 'file',
'name' => 'acf_import_file',
'value' => false,
'uploader' => 'basic',
)
);
?>
</div>
<p class="acf-submit">
<input type="submit" class="button button-primary" value="<?php _e( 'Import File', 'acf' ); ?>" />
</p>
<?php
}
/**
* submit
*
* This function will run when the tool's form has been submit
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function submit() {
// Check file size.
if ( empty( $_FILES['acf_import_file']['size'] ) ) {
return acf_add_admin_notice( __( 'No file selected', 'acf' ), 'warning' );
}
// Get file data.
$file = $_FILES['acf_import_file'];
// Check errors.
if ( $file['error'] ) {
return acf_add_admin_notice( __( 'Error uploading file. Please try again', 'acf' ), 'warning' );
}
// Check file type.
if ( pathinfo( $file['name'], PATHINFO_EXTENSION ) !== 'json' ) {
return acf_add_admin_notice( __( 'Incorrect file type', 'acf' ), 'warning' );
}
// Read JSON.
$json = file_get_contents( $file['tmp_name'] );
$json = json_decode( $json, true );
// Check if empty.
if ( ! $json || ! is_array( $json ) ) {
return acf_add_admin_notice( __( 'Import file empty', 'acf' ), 'warning' );
}
// Ensure $json is an array of groups.
if ( isset( $json['key'] ) ) {
$json = array( $json );
}
// Remeber imported field group ids.
$ids = array();
// Loop over json
foreach ( $json as $field_group ) {
// Search database for existing field group.
$post = acf_get_field_group_post( $field_group['key'] );
if ( $post ) {
$field_group['ID'] = $post->ID;
}
// Import field group.
$field_group = acf_import_field_group( $field_group );
// append message
$ids[] = $field_group['ID'];
}
// Count number of imported field groups.
$total = count( $ids );
// Generate text.
$text = sprintf( _n( 'Imported 1 field group', 'Imported %s field groups', $total, 'acf' ), $total );
// Add links to text.
$links = array();
foreach ( $ids as $id ) {
$links[] = '<a href="' . get_edit_post_link( $id ) . '">' . get_the_title( $id ) . '</a>';
}
$text .= ' ' . implode( ', ', $links );
// Add notice
acf_add_admin_notice( $text, 'success' );
}
}
// initialize
acf_register_admin_tool( 'ACF_Admin_Tool_Import' );
endif; // class_exists check
?>

View File

@@ -0,0 +1,194 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
class ACF_Admin_Tool {
/** @var string Tool name */
var $name = '';
/** @var string Tool title */
var $title = '';
/** @var string Dashicon slug */
// var $icon = '';
/** @var boolean Redirect form to single */
// var $redirect = false;
/**
* get_name
*
* This function will return the Tool's name
*
* @date 19/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function get_name() {
return $this->name;
}
/**
* get_title
*
* This function will return the Tool's title
*
* @date 19/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function get_title() {
return $this->title;
}
/**
* get_url
*
* This function will return the Tool's title
*
* @date 19/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function get_url() {
return acf_get_admin_tool_url( $this->name );
}
/**
* is_active
*
* This function will return true if the tool is active
*
* @date 19/10/17
* @since 5.6.3
*
* @param n/a
* @return bool
*/
function is_active() {
return acf_maybe_get_GET( 'tool' ) === $this->name;
}
/*
* __construct
*
* This function will setup the class functionality
*
* @type function
* @date 27/6/17
* @since 5.6.0
*
* @param n/a
* @return n/a
*/
function __construct() {
// initialize
$this->initialize();
}
/**
* initialize
*
* This function will initialize the admin tool
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function initialize() {
/* do nothing */
}
/**
* load
*
* This function is called during the admin page load
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function load() {
/* do nothing */
}
/**
* html
*
* This function will output the metabox HTML
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function html() {
}
/**
* submit
*
* This function will run when the tool's form has been submit
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function submit() {
}
}
endif; // class_exists check

View File

@@ -0,0 +1,177 @@
<?php
// vars
$disabled = false;
// empty
if ( empty( $field['conditional_logic'] ) ) {
$disabled = true;
$field['conditional_logic'] = array(
// group 0
array(
// rule 0
array(),
),
);
}
?>
<tr class="acf-field acf-field-true-false acf-field-setting-conditional_logic" data-type="true_false" data-name="conditional_logic">
<td class="acf-label">
<label><?php _e( 'Conditional Logic', 'acf' ); ?></label>
</td>
<td class="acf-input">
<?php
acf_render_field(
array(
'type' => 'true_false',
'name' => 'conditional_logic',
'prefix' => $field['prefix'],
'value' => $disabled ? 0 : 1,
'ui' => 1,
'class' => 'conditions-toggle',
)
);
?>
<div class="rule-groups"
<?php
if ( $disabled ) :
?>
style="display:none;"<?php endif; ?>>
<?php
foreach ( $field['conditional_logic'] as $group_id => $group ) :
// validate
if ( empty( $group ) ) {
continue;
}
// vars
// $group_id must be completely different to $rule_id to avoid JS issues
$group_id = "group_{$group_id}";
$h4 = ( $group_id == 'group_0' ) ? __( 'Show this field if', 'acf' ) : __( 'or', 'acf' );
?>
<div class="rule-group" data-id="<?php echo $group_id; ?>">
<h4><?php echo $h4; ?></h4>
<table class="acf-table -clear">
<tbody>
<?php
foreach ( $group as $rule_id => $rule ) :
// valid rule
$rule = wp_parse_args(
$rule,
array(
'field' => '',
'operator' => '',
'value' => '',
)
);
// vars
// $group_id must be completely different to $rule_id to avoid JS issues
$rule_id = "rule_{$rule_id}";
$prefix = "{$field['prefix']}[conditional_logic][{$group_id}][{$rule_id}]";
// data attributes
$attributes = array(
'data-id' => $rule_id,
'data-field' => $rule['field'],
'data-operator' => $rule['operator'],
'data-value' => $rule['value'],
);
?>
<tr class="rule" <?php acf_esc_attr_e( $attributes ); ?>>
<td class="param">
<?php
acf_render_field(
array(
'type' => 'select',
'prefix' => $prefix,
'name' => 'field',
'class' => 'condition-rule-field',
'disabled' => $disabled,
'value' => $rule['field'],
'choices' => array(
$rule['field'] => $rule['field'],
),
)
);
?>
</td>
<td class="operator">
<?php
acf_render_field(
array(
'type' => 'select',
'prefix' => $prefix,
'name' => 'operator',
'class' => 'condition-rule-operator',
'disabled' => $disabled,
'value' => $rule['operator'],
'choices' => array(
$rule['operator'] => $rule['operator'],
),
)
);
?>
</td>
<td class="value">
<?php
// create field
acf_render_field(
array(
'type' => 'select',
'prefix' => $prefix,
'name' => 'value',
'class' => 'condition-rule-value',
'disabled' => $disabled,
'value' => $rule['value'],
'choices' => array(
$rule['value'] => $rule['value'],
),
)
);
?>
</td>
<td class="add">
<a href="#" class="button add-conditional-rule"><?php _e( 'and', 'acf' ); ?></a>
</td>
<td class="remove">
<a href="#" class="acf-icon -minus remove-conditional-rule"></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endforeach; ?>
<h4><?php _e( 'or', 'acf' ); ?></h4>
<a href="#" class="button add-conditional-group"><?php _e( 'Add rule group', 'acf' ); ?></a>
</div>
</td>
</tr>

View File

@@ -0,0 +1,224 @@
<?php
// Define input name prefix using unique identifier.
$input_prefix = 'acf_fields[' . $field['ID'] . ']';
$input_id = acf_idify( $input_prefix );
// Update field props.
$field['prefix'] = $input_prefix;
// Elements.
$div_attrs = array(
'class' => 'acf-field-object acf-field-object-' . acf_slugify( $field['type'] ),
'data-id' => $field['ID'],
'data-key' => $field['key'],
'data-type' => $field['type'],
);
// Misc template vars.
$field_label = acf_get_field_label( $field, 'admin' );
$field_type_label = acf_get_field_type_label( $field['type'] );
?>
<div <?php echo acf_esc_attr( $div_attrs ); ?>>
<div class="meta">
<?php
$meta_inputs = array(
'ID' => $field['ID'],
'key' => $field['key'],
'parent' => $field['parent'],
'menu_order' => $i,
'save' => '',
);
foreach ( $meta_inputs as $k => $v ) :
acf_hidden_input(
array(
'name' => $input_prefix . '[' . $k . ']',
'value' => $v,
'id' => $input_id . '-' . $k,
)
);
endforeach;
?>
</div>
<div class="handle">
<ul class="acf-hl acf-tbody">
<li class="li-field-order">
<span class="acf-icon acf-sortable-handle" title="<?php _e( 'Drag to reorder', 'acf' ); ?>"><?php echo ( $i + 1 ); ?></span>
</li>
<li class="li-field-label">
<strong>
<a class="edit-field" title="<?php _e( 'Edit field', 'acf' ); ?>" href="#"><?php echo acf_esc_html( $field_label ); ?></a>
</strong>
<div class="row-options">
<a class="edit-field" title="<?php _e( 'Edit field', 'acf' ); ?>" href="#"><?php _e( 'Edit', 'acf' ); ?></a>
<a class="duplicate-field" title="<?php _e( 'Duplicate field', 'acf' ); ?>" href="#"><?php _e( 'Duplicate', 'acf' ); ?></a>
<a class="move-field" title="<?php _e( 'Move field to another group', 'acf' ); ?>" href="#"><?php _e( 'Move', 'acf' ); ?></a>
<a class="delete-field" title="<?php _e( 'Delete field', 'acf' ); ?>" href="#"><?php _e( 'Delete', 'acf' ); ?></a>
</div>
</li>
<?php // whitespace before field name looks odd but fixes chrome bug selecting all text in row ?>
<li class="li-field-name"> <?php echo esc_html( $field['name'] ); ?></li>
<li class="li-field-key"> <?php echo esc_html( $field['key'] ); ?></li>
<li class="li-field-type"> <?php echo esc_html( $field_type_label ); ?></li>
</ul>
</div>
<div class="settings">
<table class="acf-table">
<tbody class="acf-field-settings">
<?php
// label
acf_render_field_setting(
$field,
array(
'label' => __( 'Field Label', 'acf' ),
'instructions' => __( 'This is the name which will appear on the EDIT page', 'acf' ),
'name' => 'label',
'type' => 'text',
'class' => 'field-label',
),
true
);
// name
acf_render_field_setting(
$field,
array(
'label' => __( 'Field Name', 'acf' ),
'instructions' => __( 'Single word, no spaces. Underscores and dashes allowed', 'acf' ),
'name' => 'name',
'type' => 'text',
'class' => 'field-name',
),
true
);
// type
acf_render_field_setting(
$field,
array(
'label' => __( 'Field Type', 'acf' ),
'instructions' => '',
'type' => 'select',
'name' => 'type',
'choices' => acf_get_grouped_field_types(),
'class' => 'field-type',
),
true
);
// instructions
acf_render_field_setting(
$field,
array(
'label' => __( 'Instructions', 'acf' ),
'instructions' => __( 'Instructions for authors. Shown when submitting data', 'acf' ),
'type' => 'textarea',
'name' => 'instructions',
'rows' => 5,
),
true
);
// required
acf_render_field_setting(
$field,
array(
'label' => __( 'Required?', 'acf' ),
'instructions' => '',
'type' => 'true_false',
'name' => 'required',
'ui' => 1,
'class' => 'field-required',
),
true
);
// 3rd party settings
do_action( 'acf/render_field_settings', $field );
// type specific settings
do_action( "acf/render_field_settings/type={$field['type']}", $field );
// conditional logic
acf_get_view( 'field-group-field-conditional-logic', array( 'field' => $field ) );
// wrapper
acf_render_field_wrap(
array(
'label' => __( 'Wrapper Attributes', 'acf' ),
'instructions' => '',
'type' => 'number',
'name' => 'width',
'prefix' => $field['prefix'] . '[wrapper]',
'value' => $field['wrapper']['width'],
'prepend' => __( 'width', 'acf' ),
'append' => '%',
'wrapper' => array(
'data-name' => 'wrapper',
'class' => 'acf-field-setting-wrapper',
),
),
'tr'
);
acf_render_field_wrap(
array(
'label' => '',
'instructions' => '',
'type' => 'text',
'name' => 'class',
'prefix' => $field['prefix'] . '[wrapper]',
'value' => $field['wrapper']['class'],
'prepend' => __( 'class', 'acf' ),
'wrapper' => array(
'data-append' => 'wrapper',
),
),
'tr'
);
acf_render_field_wrap(
array(
'label' => '',
'instructions' => '',
'type' => 'text',
'name' => 'id',
'prefix' => $field['prefix'] . '[wrapper]',
'value' => $field['wrapper']['id'],
'prepend' => __( 'id', 'acf' ),
'wrapper' => array(
'data-append' => 'wrapper',
),
),
'tr'
);
?>
<tr class="acf-field acf-field-save">
<td class="acf-label"></td>
<td class="acf-input">
<ul class="acf-hl">
<li>
<a class="button edit-field" title="<?php _e( 'Close Field', 'acf' ); ?>" href="#"><?php _e( 'Close Field', 'acf' ); ?></a>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1,76 @@
<div class="acf-field-list-wrap">
<ul class="acf-hl acf-thead">
<li class="li-field-order"><?php _e( 'Order', 'acf' ); ?></li>
<li class="li-field-label"><?php _e( 'Label', 'acf' ); ?></li>
<li class="li-field-name"><?php _e( 'Name', 'acf' ); ?></li>
<li class="li-field-key"><?php _e( 'Key', 'acf' ); ?></li>
<li class="li-field-type"><?php _e( 'Type', 'acf' ); ?></li>
</ul>
<div class="acf-field-list
<?php
if ( ! $fields ) {
echo ' -empty'; }
?>
">
<div class="no-fields-message">
<?php _e( 'No fields. Click the <strong>+ Add Field</strong> button to create your first field.', 'acf' ); ?>
</div>
<?php
if ( $fields ) :
foreach ( $fields as $i => $field ) :
acf_get_view(
'field-group-field',
array(
'field' => $field,
'i' => $i,
)
);
endforeach;
endif;
?>
</div>
<ul class="acf-hl acf-tfoot">
<li class="acf-fr">
<a href="#" class="button button-primary button-large add-field"><?php _e( '+ Add Field', 'acf' ); ?></a>
</li>
</ul>
<?php
if ( ! $parent ) :
// get clone
$clone = acf_get_valid_field(
array(
'ID' => 'acfcloneindex',
'key' => 'acfcloneindex',
'label' => __( 'New Field', 'acf' ),
'name' => 'new_field',
'type' => 'text',
)
);
?>
<script type="text/html" id="tmpl-acf-field">
<?php
acf_get_view(
'field-group-field',
array(
'field' => $clone,
'i' => 0,
)
);
?>
</script>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,52 @@
<?php
// global
global $field_group;
?>
<div class="acf-field">
<div class="acf-label">
<label><?php _e( 'Rules', 'acf' ); ?></label>
<p class="description"><?php _e( 'Create a set of rules to determine which edit screens will use these advanced custom fields', 'acf' ); ?></p>
</div>
<div class="acf-input">
<div class="rule-groups">
<?php
foreach ( $field_group['location'] as $i => $group ) :
// bail ealry if no group
if ( empty( $group ) ) {
return;
}
// view
acf_get_view(
'html-location-group',
array(
'group' => $group,
'group_id' => "group_{$i}",
)
);
endforeach;
?>
<h4><?php _e( 'or', 'acf' ); ?></h4>
<a href="#" class="button add-location-group"><?php _e( 'Add rule group', 'acf' ); ?></a>
</div>
</div>
</div>
<script type="text/javascript">
if( typeof acf !== 'undefined' ) {
acf.newPostbox({
'id': 'acf-field-group-locations',
'label': 'left'
});
}
</script>

View File

@@ -0,0 +1,171 @@
<?php
// global
global $field_group;
// active
acf_render_field_wrap(
array(
'label' => __( 'Active', 'acf' ),
'instructions' => '',
'type' => 'true_false',
'name' => 'active',
'prefix' => 'acf_field_group',
'value' => $field_group['active'],
'ui' => 1,
// 'ui_on_text' => __('Active', 'acf'),
// 'ui_off_text' => __('Inactive', 'acf'),
)
);
// style
acf_render_field_wrap(
array(
'label' => __( 'Style', 'acf' ),
'instructions' => '',
'type' => 'select',
'name' => 'style',
'prefix' => 'acf_field_group',
'value' => $field_group['style'],
'choices' => array(
'default' => __( 'Standard (WP metabox)', 'acf' ),
'seamless' => __( 'Seamless (no metabox)', 'acf' ),
),
)
);
// position
acf_render_field_wrap(
array(
'label' => __( 'Position', 'acf' ),
'instructions' => '',
'type' => 'select',
'name' => 'position',
'prefix' => 'acf_field_group',
'value' => $field_group['position'],
'choices' => array(
'acf_after_title' => __( 'High (after title)', 'acf' ),
'normal' => __( 'Normal (after content)', 'acf' ),
'side' => __( 'Side', 'acf' ),
),
'default_value' => 'normal',
)
);
// label_placement
acf_render_field_wrap(
array(
'label' => __( 'Label placement', 'acf' ),
'instructions' => '',
'type' => 'select',
'name' => 'label_placement',
'prefix' => 'acf_field_group',
'value' => $field_group['label_placement'],
'choices' => array(
'top' => __( 'Top aligned', 'acf' ),
'left' => __( 'Left aligned', 'acf' ),
),
)
);
// instruction_placement
acf_render_field_wrap(
array(
'label' => __( 'Instruction placement', 'acf' ),
'instructions' => '',
'type' => 'select',
'name' => 'instruction_placement',
'prefix' => 'acf_field_group',
'value' => $field_group['instruction_placement'],
'choices' => array(
'label' => __( 'Below labels', 'acf' ),
'field' => __( 'Below fields', 'acf' ),
),
)
);
// menu_order
acf_render_field_wrap(
array(
'label' => __( 'Order No.', 'acf' ),
'instructions' => __( 'Field groups with a lower order will appear first', 'acf' ),
'type' => 'number',
'name' => 'menu_order',
'prefix' => 'acf_field_group',
'value' => $field_group['menu_order'],
)
);
// description
acf_render_field_wrap(
array(
'label' => __( 'Description', 'acf' ),
'instructions' => __( 'Shown in field group list', 'acf' ),
'type' => 'text',
'name' => 'description',
'prefix' => 'acf_field_group',
'value' => $field_group['description'],
)
);
// hide on screen
$choices = array(
'permalink' => __( 'Permalink', 'acf' ),
'the_content' => __( 'Content Editor', 'acf' ),
'excerpt' => __( 'Excerpt', 'acf' ),
'custom_fields' => __( 'Custom Fields', 'acf' ),
'discussion' => __( 'Discussion', 'acf' ),
'comments' => __( 'Comments', 'acf' ),
'revisions' => __( 'Revisions', 'acf' ),
'slug' => __( 'Slug', 'acf' ),
'author' => __( 'Author', 'acf' ),
'format' => __( 'Format', 'acf' ),
'page_attributes' => __( 'Page Attributes', 'acf' ),
'featured_image' => __( 'Featured Image', 'acf' ),
'categories' => __( 'Categories', 'acf' ),
'tags' => __( 'Tags', 'acf' ),
'send-trackbacks' => __( 'Send Trackbacks', 'acf' ),
);
if ( acf_get_setting( 'remove_wp_meta_box' ) ) {
unset( $choices['custom_fields'] );
}
acf_render_field_wrap(
array(
'label' => __( 'Hide on screen', 'acf' ),
'instructions' => __( '<b>Select</b> items to <b>hide</b> them from the edit screen.', 'acf' ) . '<br /><br />' . __( "If multiple field groups appear on an edit screen, the first field group's options will be used (the one with the lowest order number)", 'acf' ),
'type' => 'checkbox',
'name' => 'hide_on_screen',
'prefix' => 'acf_field_group',
'value' => $field_group['hide_on_screen'],
'toggle' => true,
'choices' => $choices,
)
);
// 3rd party settings
do_action( 'acf/render_field_group_settings', $field_group );
?>
<div class="acf-hidden">
<input type="hidden" name="acf_field_group[key]" value="<?php echo $field_group['key']; ?>" />
</div>
<script type="text/javascript">
if( typeof acf !== 'undefined' ) {
acf.newPostbox({
'id': 'acf-field-group-options',
'label': 'left'
});
}
</script>

View File

@@ -0,0 +1,93 @@
<?php
/**
* The template for displaying admin navigation.
*
* @date 27/3/20
* @since 5.9.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
global $submenu, $parent_file, $submenu_file, $plugin_page, $pagenow;
// Vars.
$parent_slug = 'edit.php?post_type=acf-field-group';
// Generate array of navigation items.
$tabs = array();
if ( isset( $submenu[ $parent_slug ] ) ) {
foreach ( $submenu[ $parent_slug ] as $i => $sub_item ) {
// Check user can access page.
if ( ! current_user_can( $sub_item[1] ) ) {
continue;
}
// Ignore "Add New".
if ( $i === 1 ) {
continue;
}
// Define tab.
$tab = array(
'text' => $sub_item[0],
'url' => $sub_item[2],
);
// Convert submenu slug "test" to "$parent_slug&page=test".
if ( ! strpos( $sub_item[2], '.php' ) ) {
$tab['url'] = add_query_arg( array( 'page' => $sub_item[2] ), $parent_slug );
}
// Detect active state.
if ( $submenu_file === $sub_item[2] || $plugin_page === $sub_item[2] ) {
$tab['is_active'] = true;
}
// Special case for "Add New" page.
if ( $i === 0 && $submenu_file === 'post-new.php?post_type=acf-field-group' ) {
$tab['is_active'] = true;
}
$tabs[] = $tab;
}
}
/**
* Filters the admin navigation tabs.
*
* @date 27/3/20
* @since 5.9.0
*
* @param array $tabs The array of navigation tabs.
*/
$tabs = apply_filters( 'acf/admin/toolbar', $tabs );
// Bail early if set to false.
if ( $tabs === false ) {
return;
}
?>
<div class="acf-admin-toolbar">
<h2><i class="acf-tab-icon dashicons dashicons-welcome-widgets-menus"></i> <?php echo acf_get_setting( 'name' ); ?></h2>
<?php
foreach ( $tabs as $tab ) {
printf(
'<a class="acf-tab%s" href="%s">%s</a>',
! empty( $tab['is_active'] ) ? ' is-active' : '',
esc_url( $tab['url'] ),
acf_esc_html( $tab['text'] )
);
}
?>
<?php if ( ! defined( 'ACF_PRO' ) || ! ACF_PRO ) : ?>
<a target="_blank" href="https://www.advancedcustomfields.com/pro/?utm_source=ACF%2BFree&utm_medium=insideplugin&utm_campaign=ACF%2Bupgrade" class="btn-upgrade">
<img src="<?php echo acf_get_url( 'assets/images/icon-upgrade-pro.svg' ); ?>" />
<p><?php _e( 'Upgrade to Pro', 'acf' ); ?></p>
</a>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,196 @@
<?php
/**
* Network Admin Database Upgrade
*
* Shows the databse upgrade process.
*
* @date 24/8/18
* @since 5.7.4
* @param void
*/
?>
<style type="text/css">
/* hide steps */
.show-on-complete {
display: none;
}
</style>
<div id="acf-upgrade-wrap" class="wrap">
<h1><?php _e( 'Upgrade Database', 'acf' ); ?></h1>
<p><?php echo sprintf( __( 'The following sites require a DB upgrade. Check the ones you want to update and then click %s.', 'acf' ), '"' . __( 'Upgrade Sites', 'acf' ) . '"' ); ?></p>
<p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites"></p>
<table class="wp-list-table widefat">
<thead>
<tr>
<td class="manage-column check-column" scope="col">
<input type="checkbox" id="sites-select-all">
</td>
<th class="manage-column" scope="col" style="width:33%;">
<label for="sites-select-all"><?php _e( 'Site', 'acf' ); ?></label>
</th>
<th><?php _e( 'Description', 'acf' ); ?></th>
</tr>
</thead>
<tfoot>
<tr>
<td class="manage-column check-column" scope="col">
<input type="checkbox" id="sites-select-all-2">
</td>
<th class="manage-column" scope="col">
<label for="sites-select-all-2"><?php _e( 'Site', 'acf' ); ?></label>
</th>
<th><?php _e( 'Description', 'acf' ); ?></th>
</tr>
</tfoot>
<tbody id="the-list">
<?php
$sites = acf_get_sites();
if ( $sites ) :
foreach ( $sites as $i => $site ) :
// switch blog
switch_to_blog( $site['blog_id'] );
?>
<tr
<?php
if ( $i % 2 == 0 ) :
?>
class="alternate"<?php endif; ?>>
<th class="check-column" scope="row">
<?php if ( acf_has_upgrade() ) : ?>
<input type="checkbox" value="<?php echo $site['blog_id']; ?>" name="checked[]">
<?php endif; ?>
</th>
<td>
<strong><?php echo get_bloginfo( 'name' ); ?></strong><br /><?php echo home_url(); ?>
</td>
<td>
<?php if ( acf_has_upgrade() ) : ?>
<span class="response"><?php printf( __( 'Site requires database upgrade from %1$s to %2$s', 'acf' ), acf_get_db_version(), ACF_VERSION ); ?></span>
<?php else : ?>
<?php _e( 'Site is up to date', 'acf' ); ?>
<?php endif; ?>
</td>
</tr>
<?php
// restore
restore_current_blog();
endforeach;
endif;
?>
</tbody>
</table>
<p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites-2"></p>
<p class="show-on-complete"><?php echo sprintf( __( 'Database Upgrade complete. <a href="%s">Return to network dashboard</a>', 'acf' ), network_admin_url() ); ?></p>
<script type="text/javascript">
(function($) {
var upgrader = new acf.Model({
events: {
'click #upgrade-sites': 'onClick',
'click #upgrade-sites-2': 'onClick'
},
$inputs: function(){
return $('#the-list input:checked');
},
onClick: function( e, $el ){
// prevent default
e.preventDefault();
// bail early if no selection
if( !this.$inputs().length ) {
return alert('<?php _e( 'Please select at least one site to upgrade.', 'acf' ); ?>');
}
// confirm action
if( !confirm("<?php _e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf' ); ?>") ) {
return;
}
// upgrade
this.upgrade();
},
upgrade: function(){
// vars
var $inputs = this.$inputs();
// bail early if no sites selected
if( !$inputs.length ) {
return this.complete();
}
// disable buttons
$('.button').prop('disabled', true);
// vars
var $input = $inputs.first();
var $row = $input.closest('tr');
var text = '';
var success = false;
// show loading
$row.find('.response').html('<i class="acf-loading"></i></span> <?php printf( __( 'Upgrading data to version %s', 'acf' ), ACF_VERSION ); ?>');
// send ajax request to upgrade DB
$.ajax({
url: acf.get('ajaxurl'),
dataType: 'json',
type: 'post',
data: acf.prepareForAjax({
action: 'acf/ajax/upgrade',
blog_id: $input.val()
}),
success: function( json ){
success = true;
$input.remove();
text = '<?php _e( 'Upgrade complete.', 'acf' ); ?>';
},
error: function( jqXHR, textStatus, errorThrown ){
text = '<?php _e( 'Upgrade failed.', 'acf' ); ?>';
if( error = acf.getXhrError(jqXHR) ) {
text += ' <code>' + error + '</code>';
}
},
complete: this.proxy(function(){
// display text
$row.find('.response').html( text );
// if successful upgrade, proceed to next site. Otherwise, skip to complete.
if( success ) {
this.upgrade();
} else {
this.complete();
}
})
});
},
complete: function(){
// enable buttons
$('.button').prop('disabled', false);
// show message
$('.show-on-complete').show();
}
});
})(jQuery);
</script>
</div>

View File

@@ -0,0 +1,97 @@
<?php
/**
* Admin Database Upgrade
*
* Shows the databse upgrade process.
*
* @date 24/8/18
* @since 5.7.4
* @param void
*/
?>
<style type="text/css">
/* hide steps */
.step-1,
.step-2,
.step-3 {
display: none;
}
</style>
<div id="acf-upgrade-wrap" class="wrap">
<h1><?php _e( 'Upgrade Database', 'acf' ); ?></h1>
<?php if ( acf_has_upgrade() ) : ?>
<p><?php _e( 'Reading upgrade tasks...', 'acf' ); ?></p>
<p class="step-1"><i class="acf-loading"></i> <?php printf( __( 'Upgrading data to version %s', 'acf' ), ACF_VERSION ); ?></p>
<p class="step-2"></p>
<p class="step-3"><?php echo sprintf( __( 'Database upgrade complete. <a href="%s">See what\'s new</a>', 'acf' ), admin_url( 'edit.php?post_type=acf-field-group' ) ); ?></p>
<script type="text/javascript">
(function($) {
var upgrader = new acf.Model({
initialize: function(){
// allow user to read message for 1 second
this.setTimeout( this.upgrade, 1000 );
},
upgrade: function(){
// show step 1
$('.step-1').show();
// vars
var response = '';
var success = false;
// send ajax request to upgrade DB
$.ajax({
url: acf.get('ajaxurl'),
dataType: 'json',
type: 'post',
data: acf.prepareForAjax({
action: 'acf/ajax/upgrade'
}),
success: function( json ){
success = true;
},
error: function( jqXHR, textStatus, errorThrown ){
response = '<?php _e( 'Upgrade failed.', 'acf' ); ?>';
if( error = acf.getXhrError(jqXHR) ) {
response += ' <code>' + error + '</code>';
}
},
complete: this.proxy(function(){
// remove spinner
$('.acf-loading').hide();
// display response
if( response ) {
$('.step-2').show().html( response );
}
// display success
if( success ) {
$('.step-3').show();
}
})
});
}
});
})(jQuery);
</script>
<?php else : ?>
<p><?php _e( 'No updates available.', 'acf' ); ?></p>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,30 @@
<?php
/**
* html-admin-tools
*
* View to output admin tools for both archive and single
*
* @date 20/10/17
* @since 5.6.3
*
* @param string $screen_id The screen ID used to display metaboxes
* @param string $active The active Tool
* @return n/a
*/
$class = $active ? 'single' : 'grid';
?>
<div class="wrap" id="acf-admin-tools">
<h1><?php _e( 'Tools', 'acf' ); ?> <?php
if ( $active ) :
?>
<a class="page-title-action" href="<?php echo acf_get_admin_tools_url(); ?>"><?php _e( 'Back to all tools', 'acf' ); ?></a><?php endif; ?></h1>
<div class="acf-meta-box-wrap -<?php echo $class; ?>">
<?php do_meta_boxes( $screen_id, 'normal', '' ); ?>
</div>
</div>

View File

@@ -0,0 +1,30 @@
<div class="rule-group" data-id="<?php echo $group_id; ?>">
<h4><?php echo ( $group_id == 'group_0' ) ? __( 'Show this field group if', 'acf' ) : __( 'or', 'acf' ); ?></h4>
<table class="acf-table -clear">
<tbody>
<?php
foreach ( $group as $i => $rule ) :
// validate rule
$rule = acf_validate_location_rule( $rule );
// append id and group
$rule['id'] = "rule_{$i}";
$rule['group'] = $group_id;
// view
acf_get_view(
'html-location-rule',
array(
'rule' => $rule,
)
);
endforeach;
?>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,97 @@
<?php
// vars
$prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . ']';
?>
<tr data-id="<?php echo $rule['id']; ?>">
<td class="param">
<?php
// vars
$choices = acf_get_location_rule_types();
// array
if ( is_array( $choices ) ) {
acf_render_field(
array(
'type' => 'select',
'name' => 'param',
'prefix' => $prefix,
'value' => $rule['param'],
'choices' => $choices,
'class' => 'refresh-location-rule',
)
);
}
?>
</td>
<td class="operator">
<?php
// vars
$choices = acf_get_location_rule_operators( $rule );
// array
if ( is_array( $choices ) ) {
acf_render_field(
array(
'type' => 'select',
'name' => 'operator',
'prefix' => $prefix,
'value' => $rule['operator'],
'choices' => $choices,
)
);
// custom
} else {
echo $choices;
}
?>
</td>
<td class="value">
<?php
// vars
$choices = acf_get_location_rule_values( $rule );
// array
if ( is_array( $choices ) ) {
acf_render_field(
array(
'type' => 'select',
'name' => 'value',
'prefix' => $prefix,
'value' => $rule['value'],
'choices' => $choices,
)
);
// custom
} else {
echo $choices;
}
?>
</td>
<td class="add">
<a href="#" class="button add-location-rule"><?php _e( 'and', 'acf' ); ?></a>
</td>
<td class="remove">
<a href="#" class="acf-icon -minus remove-location-rule"></a>
</td>
</tr>

View File

@@ -0,0 +1,50 @@
<?php
// 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="notice">
<div class="col-content">
<img src="<?php echo acf_get_url( 'assets/images/acf-logo.png' ); ?>" />
<h2><?php _e( 'Database Upgrade Required', 'acf' ); ?></h2>
<p><?php printf( __( 'Thank you for updating to %1$s v%2$s!', 'acf' ), acf_get_setting( 'name' ), acf_get_setting( 'version' ) ); ?><br /><?php _e( 'This version contains improvements to your database and requires an upgrade.', 'acf' ); ?></p>
<?php if ( ! empty( $plugins ) ) : ?>
<p><?php printf( __( 'Please also check all premium add-ons (%s) are updated to the latest version.', 'acf' ), implode( ', ', $plugins ) ); ?></p>
<?php endif; ?>
</div>
<div class="col-actions">
<a id="acf-upgrade-button" href="<?php echo $button_url; ?>" class="button button-primary button-hero"><?php echo $button_text; ?></a>
</div>
</div>
<?php if ( $confirm ) : ?>
<script type="text/javascript">
(function($) {
$("#acf-upgrade-button").on("click", function(){
return confirm("<?php _e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf' ); ?>");
});
})(jQuery);
</script>
<?php endif; ?>

View File

@@ -0,0 +1,103 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Ajax_Check_Screen' ) ) :
class ACF_Ajax_Check_Screen extends ACF_Ajax {
/** @var string The AJAX action name. */
var $action = 'acf/ajax/check_screen';
/** @var bool Prevents access for non-logged in users. */
var $public = false;
/**
* get_response
*
* Returns the response data to sent back.
*
* @date 31/7/18
* @since 5.7.2
*
* @param array $request The request args.
* @return mixed The response data or WP_Error.
*/
function get_response( $request ) {
// vars
$args = wp_parse_args(
$this->request,
array(
'screen' => '',
'post_id' => 0,
'ajax' => true,
'exists' => array(),
)
);
// vars
$response = array(
'results' => array(),
'style' => '',
);
// get field groups
$field_groups = acf_get_field_groups( $args );
// loop through field groups
if ( $field_groups ) {
foreach ( $field_groups as $i => $field_group ) {
// vars
$item = array(
'id' => 'acf-' . $field_group['key'],
'key' => $field_group['key'],
'title' => $field_group['title'],
'position' => $field_group['position'],
'style' => $field_group['style'],
'label' => $field_group['label_placement'],
'edit' => acf_get_field_group_edit_link( $field_group['ID'] ),
'html' => '',
);
// append html if doesnt already exist on page
if ( ! in_array( $field_group['key'], $args['exists'] ) ) {
// load fields
$fields = acf_get_fields( $field_group );
// get field HTML
ob_start();
// render
acf_render_fields( $fields, $args['post_id'], 'div', $field_group['instruction_placement'] );
$item['html'] = ob_get_clean();
}
// append
$response['results'][] = $item;
}
// Get style from first field group.
$response['style'] = acf_get_field_group_style( $field_groups[0] );
}
// Custom metabox order.
if ( $this->get( 'screen' ) == 'post' ) {
$response['sorted'] = get_user_option( 'meta-box-order_' . $this->get( 'post_type' ) );
}
// return
return $response;
}
}
acf_new_instance( 'ACF_Ajax_Check_Screen' );
endif; // class_exists check

View File

@@ -0,0 +1,82 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Ajax_Local_JSON_Diff' ) ) :
class ACF_Ajax_Local_JSON_Diff extends ACF_Ajax {
/** @var string The AJAX action name. */
var $action = 'acf/ajax/local_json_diff';
/** @var bool Prevents access for non-logged in users. */
var $public = false;
/**
* get_response
*
* Returns the response data to sent back.
*
* @date 31/7/18
* @since 5.7.2
*
* @param array $request The request args.
* @return mixed The response data or WP_Error.
*/
function get_response( $request ) {
$json = array();
// Extract props.
$id = isset( $request['id'] ) ? intval( $request['id'] ) : 0;
// Bail ealry if missing props.
if ( ! $id ) {
return new WP_Error( 'acf_invalid_param', __( 'Invalid field group parameter(s).', 'acf' ), array( 'status' => 404 ) );
}
// Disable filters and load field group directly from database.
acf_disable_filters();
$field_group = acf_get_field_group( $id );
if ( ! $field_group ) {
return new WP_Error( 'acf_invalid_id', __( 'Invalid field group ID.', 'acf' ), array( 'status' => 404 ) );
}
$field_group['fields'] = acf_get_fields( $field_group );
$field_group['modified'] = get_post_modified_time( 'U', true, $field_group['ID'] );
$field_group = acf_prepare_field_group_for_export( $field_group );
// Load local field group file.
$files = acf_get_local_json_files();
$key = $field_group['key'];
if ( ! isset( $files[ $key ] ) ) {
return new WP_Error( 'acf_cannot_compare', __( 'Sorry, this field group is unavailable for diff comparison.', 'acf' ), array( 'status' => 404 ) );
}
$local_field_group = json_decode( file_get_contents( $files[ $key ] ), true );
// Render diff HTML.
$date_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
$date_template = __( 'Last updated: %s', 'acf' );
$json['html'] = '
<div class="acf-diff">
<div class="acf-diff-title">
<div class="acf-diff-title-left">
<strong>' . __( 'Original field group', 'acf' ) . '</strong>
<span>' . sprintf( $date_template, wp_date( $date_format, $field_group['modified'] ) ) . '</span>
</div>
<div class="acf-diff-title-right">
<strong>' . __( 'JSON field group (newer)', 'acf' ) . '</strong>
<span>' . sprintf( $date_template, wp_date( $date_format, $local_field_group['modified'] ) ) . '</span>
</div>
</div>
<div class="acf-diff-content">
' . wp_text_diff( acf_json_encode( $field_group ), acf_json_encode( $local_field_group ) ) . '
</div>
</div>';
return $json;
}
}
acf_new_instance( 'ACF_Ajax_Local_JSON_Diff' );
endif; // class_exists check

View File

@@ -0,0 +1,275 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Ajax_Query_Users' ) ) :
class ACF_Ajax_Query_Users extends ACF_Ajax_Query {
/** @var string The AJAX action name. */
var $action = 'acf/ajax/query_users';
/**
* init_request
*
* Called at the beginning of a request to setup properties.
*
* @date 23/5/19
* @since 5.8.1
*
* @param array $request The request args.
* @return void
*/
function init_request( $request ) {
parent::init_request( $request );
// Customize query.
add_filter( 'user_search_columns', array( $this, 'filter_search_columns' ), 10, 3 );
/**
* Fires when a request is made.
*
* @date 21/5/19
* @since 5.8.1
*
* @param array $request The query request.
* @param ACF_Ajax_Query $query The query object.
*/
do_action( 'acf/ajax/query_users/init', $request, $this );
}
/**
* get_args
*
* Returns an array of args for this query.
*
* @date 31/7/18
* @since 5.7.2
*
* @param array $request The request args.
* @return array
*/
function get_args( $request ) {
$args = parent::get_args( $request );
$args['number'] = $this->per_page;
$args['paged'] = $this->page;
if ( $this->is_search ) {
$args['search'] = "*{$this->search}*";
}
/**
* Filters the query args.
*
* @date 21/5/19
* @since 5.8.1
*
* @param array $args The query args.
* @param array $request The query request.
* @param ACF_Ajax_Query $query The query object.
*/
return apply_filters( 'acf/ajax/query_users/args', $args, $request, $this );
}
/**
* Prepares args for the get_results() method.
*
* @date 23/3/20
* @since 5.8.9
*
* @param array args The query args.
* @return array
*/
function prepare_args( $args ) {
// Parse pagination args that may have been modified.
if ( isset( $args['users_per_page'] ) ) {
$this->per_page = intval( $args['users_per_page'] );
unset( $args['users_per_page'] );
} elseif ( isset( $args['number'] ) ) {
$this->per_page = intval( $args['number'] );
}
if ( isset( $args['paged'] ) ) {
$this->page = intval( $args['paged'] );
unset( $args['paged'] );
}
// Set pagination args for fine control.
$args['number'] = $this->per_page;
$args['offset'] = $this->per_page * ( $this->page - 1 );
$args['count_total'] = true;
return $args;
}
/**
* get_results
*
* Returns an array of results for the given args.
*
* @date 31/7/18
* @since 5.7.2
*
* @param array args The query args.
* @return array
*/
function get_results( $args ) {
$results = array();
// Prepare args for quey.
$args = $this->prepare_args( $args );
// Get result groups.
if ( ! empty( $args['role__in'] ) ) {
$roles = acf_get_user_role_labels( $args['role__in'] );
} else {
$roles = acf_get_user_role_labels();
}
// Return a flat array of results when searching or when queriying one group only.
if ( $this->is_search || count( $roles ) === 1 ) {
// Query users and append to results.
$wp_user_query = new WP_User_Query( $args );
$users = (array) $wp_user_query->get_results();
$total_users = $wp_user_query->get_total();
foreach ( $users as $user ) {
$results[] = $this->get_result( $user );
}
// Determine if more results exist.
// As this query does not return grouped results, the calculation can be exact (">").
$this->more = ( $total_users > count( $users ) + $args['offset'] );
// Otherwise, group results via role.
} else {
// Unset args that will interfer with query results.
unset( $args['role__in'], $args['role__not_in'] );
// Loop over each role.
foreach ( $roles as $role => $role_label ) {
// Query users (for this role only).
$args['role'] = $role;
$wp_user_query = new WP_User_Query( $args );
$users = (array) $wp_user_query->get_results();
$total_users = $wp_user_query->get_total();
// acf_log( $args );
// acf_log( '- ', count($users) );
// acf_log( '- ', $total_users );
// If users were found for this query...
if ( $users ) {
// Append optgroup of results.
$role_results = array();
foreach ( $users as $user ) {
$role_results[] = $this->get_result( $user );
}
$results[] = array(
'text' => $role_label,
'children' => $role_results,
);
// End loop when enough results have been found.
if ( count( $users ) === $args['number'] ) {
// Determine if more results exist.
// As this query does return grouped results, the calculation is best left fuzzy to avoid querying the next group (">=").
$this->more = ( $total_users >= count( $users ) + $args['offset'] );
break;
// Otherwise, modify the args so that the next query can continue on correctly.
} else {
$args['offset'] = 0;
$args['number'] -= count( $users );
}
// If no users were found (for the current pagination args), but there were users found for previous pages...
// Modify the args so that the next query is offset slightly less (the number of total users) and can continue on correctly.
} elseif ( $total_users ) {
$args['offset'] -= $total_users;
continue;
// Ignore roles that will never return a result.
} else {
continue;
}
}
}
/**
* Filters the query results.
*
* @date 21/5/19
* @since 5.8.1
*
* @param array $results The query results.
* @param array $args The query args.
* @param ACF_Ajax_Query $query The query object.
*/
return apply_filters( 'acf/ajax/query_users/results', $results, $args, $this );
}
/**
* get_result
*
* Returns a single result for the given item object.
*
* @date 31/7/18
* @since 5.7.2
*
* @param mixed $item A single item from the queried results.
* @return string
*/
function get_result( $user ) {
$item = acf_get_user_result( $user );
/**
* Filters the result item.
*
* @date 21/5/19
* @since 5.8.1
*
* @param array $item The choice id and text.
* @param ACF_User $user The user object.
* @param ACF_Ajax_Query $query The query object.
*/
return apply_filters( 'acf/ajax/query_users/result', $item, $user, $this );
}
/**
* Filters the WP_User_Query search columns.
*
* @date 9/3/20
* @since 5.8.8
*
* @param array $columns An array of column names to be searched.
* @param string $search The search term.
* @param WP_User_Query $WP_User_Query The WP_User_Query instance.
* @return array
*/
function filter_search_columns( $columns, $search, $WP_User_Query ) {
/**
* Filters the column names to be searched.
*
* @date 21/5/19
* @since 5.8.1
*
* @param array $columns An array of column names to be searched.
* @param string $search The search term.
* @param WP_User_Query $WP_User_Query The WP_User_Query instance.
* @param ACF_Ajax_Query $query The query object.
*/
return apply_filters( 'acf/ajax/query_users/search_columns', $columns, $search, $WP_User_Query, $this );
}
}
acf_new_instance( 'ACF_Ajax_Query_Users' );
endif; // class_exists check

View File

@@ -0,0 +1,152 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Ajax_Query' ) ) :
class ACF_Ajax_Query extends ACF_Ajax {
/** @var bool Prevents access for non-logged in users. */
var $public = true;
/** @var int The page of results to return. */
var $page = 1;
/** @var int The number of results per page. */
var $per_page = 20;
/** @var bool Signifies whether or not this AJAX query has more pages to load. */
var $more = false;
/** @var string The searched term. */
var $search = '';
/** @var bool Signifies whether the current query is a search. */
var $is_search = false;
/** @var (int|string) The post_id being edited. */
var $post_id = 0;
/** @var array The ACF field related to this query. */
var $field = false;
/**
* get_response
*
* Returns the response data to sent back.
*
* @date 31/7/18
* @since 5.7.2
*
* @param array $request The request args.
* @return (array|WP_Error) The response data or WP_Error.
*/
function get_response( $request ) {
// Init request.
$this->init_request( $request );
// Get query args.
$args = $this->get_args( $request );
// Get query results.
$results = $this->get_results( $args );
if ( is_wp_error( $results ) ) {
return $results;
}
// Return response.
return array(
'results' => $results,
'more' => $this->more,
);
}
/**
* init_request
*
* Called at the beginning of a request to setup properties.
*
* @date 23/5/19
* @since 5.8.1
*
* @param array $request The request args.
* @return void
*/
function init_request( $request ) {
// Get field for this query.
if ( isset( $request['field_key'] ) ) {
$this->field = acf_get_field( $request['field_key'] );
}
// Update query properties.
if ( isset( $request['page'] ) ) {
$this->page = intval( $request['page'] );
}
if ( isset( $request['per_page'] ) ) {
$this->per_page = intval( $request['per_page'] );
}
if ( isset( $request['search'] ) && acf_not_empty( $request['search'] ) ) {
$this->search = sanitize_text_field( $request['search'] );
$this->is_search = true;
}
if ( isset( $request['post_id'] ) ) {
$this->post_id = $request['post_id'];
}
}
/**
* get_args
*
* Returns an array of args for this query.
*
* @date 31/7/18
* @since 5.7.2
*
* @param array $request The request args.
* @return array
*/
function get_args( $request ) {
// Allow for custom "query" arg.
if ( isset( $request['query'] ) ) {
return (array) $request['query'];
}
return array();
}
/**
* get_items
*
* Returns an array of results for the given args.
*
* @date 31/7/18
* @since 5.7.2
*
* @param array args The query args.
* @return array
*/
function get_results( $args ) {
return array();
}
/**
* get_item
*
* Returns a single result for the given item object.
*
* @date 31/7/18
* @since 5.7.2
*
* @param mixed $item A single item from the queried results.
* @return array An array containing "id" and "text".
*/
function get_result( $item ) {
return false;
}
}
endif; // class_exists check

View File

@@ -0,0 +1,56 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Ajax_Upgrade' ) ) :
class ACF_Ajax_Upgrade extends ACF_Ajax {
/** @var string The AJAX action name */
var $action = 'acf/ajax/upgrade';
/**
* get_response
*
* Returns the response data to sent back.
*
* @date 31/7/18
* @since 5.7.2
*
* @param array $request The request args.
* @return mixed The response data or WP_Error.
*/
function get_response( $request ) {
// Switch blog.
if ( isset( $request['blog_id'] ) ) {
switch_to_blog( $request['blog_id'] );
}
// Bail early if no upgrade avaiable.
if ( ! acf_has_upgrade() ) {
return new WP_Error( 'upgrade_error', __( 'No updates available.', 'acf' ) );
}
// Listen for output.
ob_start();
// Run upgrades.
acf_upgrade_all();
// Store output.
$error = ob_get_clean();
// Return error or success.
if ( $error ) {
return new WP_Error( 'upgrade_error', $error );
}
return true;
}
}
acf_new_instance( 'ACF_Ajax_Upgrade' );
endif; // class_exists check

View File

@@ -0,0 +1,43 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Ajax_User_Setting' ) ) :
class ACF_Ajax_User_Setting extends ACF_Ajax {
/** @var string The AJAX action name. */
var $action = 'acf/ajax/user_setting';
/** @var bool Prevents access for non-logged in users. */
var $public = true;
/**
* get_response
*
* Returns the response data to sent back.
*
* @date 31/7/18
* @since 5.7.2
*
* @param array $request The request args.
* @return mixed The response data or WP_Error.
*/
function get_response( $request ) {
// update
if ( $this->has( 'value' ) ) {
return acf_update_user_setting( $this->get( 'name' ), $this->get( 'value' ) );
// get
} else {
return acf_get_user_setting( $this->get( 'name' ) );
}
}
}
acf_new_instance( 'ACF_Ajax_User_Setting' );
endif; // class_exists check

View File

@@ -0,0 +1,232 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'ACF_Ajax' ) ) :
class ACF_Ajax {
/** @var string The AJAX action name. */
var $action = '';
/** @var array The $_REQUEST data. */
var $request;
/** @var bool Prevents access for non-logged in users. */
var $public = false;
/**
* __construct
*
* Sets up the class functionality.
*
* @date 31/7/18
* @since 5.7.2
*
* @param void
* @return void
*/
function __construct() {
$this->initialize();
$this->add_actions();
}
/**
* has
*
* Returns true if the request has data for the given key.
*
* @date 31/7/18
* @since 5.7.2
*
* @param string $key The data key.
* @return boolean
*/
function has( $key = '' ) {
return isset( $this->request[ $key ] );
}
/**
* get
*
* Returns request data for the given key.
*
* @date 31/7/18
* @since 5.7.2
*
* @param string $key The data key.
* @return mixed
*/
function get( $key = '' ) {
return isset( $this->request[ $key ] ) ? $this->request[ $key ] : null;
}
/**
* Sets request data for the given key.
*
* @date 31/7/18
* @since 5.7.2
*
* @param string $key The data key.
* @param mixed $value The data value.
* @return ACF_Ajax
*/
function set( $key = '', $value = null ) {
$this->request[ $key ] = $value;
return $this;
}
/**
* initialize
*
* Allows easy access to modifying properties without changing constructor.
*
* @date 31/7/18
* @since 5.7.2
*
* @param void
* @return void
*/
function initialize() {
/* do nothing */
}
/**
* add_actions
*
* Adds the ajax actions for this response.
*
* @date 31/7/18
* @since 5.7.2
*
* @param void
* @return void
*/
function add_actions() {
// add action for logged-in users
add_action( "wp_ajax_{$this->action}", array( $this, 'request' ) );
// add action for non logged-in users
if ( $this->public ) {
add_action( "wp_ajax_nopriv_{$this->action}", array( $this, 'request' ) );
}
}
/**
* request
*
* Callback for ajax action. Sets up properties and calls the get_response() function.
*
* @date 1/8/18
* @since 5.7.2
*
* @param void
* @return void
*/
function request() {
// Store data for has() and get() functions.
$this->request = wp_unslash( $_REQUEST );
// Verify request and handle error.
$error = $this->verify_request( $this->request );
if ( is_wp_error( $error ) ) {
$this->send( $error );
}
// Send response.
$this->send( $this->get_response( $this->request ) );
}
/**
* Verifies the request.
*
* @date 9/3/20
* @since 5.8.8
*
* @param array $request The request args.
* @return (bool|WP_Error) True on success, WP_Error on fail.
*/
function verify_request( $request ) {
// Verify nonce.
if ( ! acf_verify_ajax() ) {
return new WP_Error( 'acf_invalid_nonce', __( 'Invalid nonce.', 'acf' ), array( 'status' => 404 ) );
}
return true;
}
/**
* get_response
*
* Returns the response data to sent back.
*
* @date 31/7/18
* @since 5.7.2
*
* @param array $request The request args.
* @return mixed The response data or WP_Error.
*/
function get_response( $request ) {
return true;
}
/**
* send
*
* Sends back JSON based on the $response as either success or failure.
*
* @date 31/7/18
* @since 5.7.2
*
* @param mixed $response The response to send back.
* @return void
*/
function send( $response ) {
// Return error.
if ( is_wp_error( $response ) ) {
$this->send_error( $response );
// Return success.
} else {
wp_send_json( $response );
}
}
/**
* Sends a JSON response for the given WP_Error object.
*
* @date 8/3/20
* @since 5.8.8
*
* @param WP_Error error The error object.
* @return void
*/
function send_error( $error ) {
// Get error status
$error_data = $error->get_error_data();
if ( is_array( $error_data ) && isset( $error_data['status'] ) ) {
$status_code = $error_data['status'];
} else {
$status_code = 500;
}
wp_send_json(
array(
'code' => $error->get_error_code(),
'message' => $error->get_error_message(),
'data' => $error->get_error_data(),
),
$status_code
);
}
}
endif; // class_exists check

View File

@@ -0,0 +1,522 @@
<?php
/*
* acf_get_taxonomies
*
* Returns an array of taxonomy names.
*
* @date 7/10/13
* @since 5.0.0
*
* @param array $args An array of args used in the get_taxonomies() function.
* @return array An array of taxonomy names.
*/
function acf_get_taxonomies( $args = array() ) {
// vars
$taxonomies = array();
// get taxonomy objects
$objects = get_taxonomies( $args, 'objects' );
// loop
foreach ( $objects as $i => $object ) {
// bail early if is builtin (WP) private post type
// - nav_menu_item, revision, customize_changeset, etc
if ( $object->_builtin && ! $object->public ) {
continue;
}
// append
$taxonomies[] = $i;
}
// custom post_type arg which does not yet exist in core
if ( isset( $args['post_type'] ) ) {
$taxonomies = acf_get_taxonomies_for_post_type( $args['post_type'] );
}
// filter
$taxonomies = apply_filters( 'acf/get_taxonomies', $taxonomies, $args );
// return
return $taxonomies;
}
/**
* acf_get_taxonomies_for_post_type
*
* Returns an array of taxonomies for a given post type(s)
*
* @date 7/9/18
* @since 5.7.5
*
* @param string|array $post_types The post types to compare against.
* @return array
*/
function acf_get_taxonomies_for_post_type( $post_types = 'post' ) {
// vars
$taxonomies = array();
// loop
foreach ( (array) $post_types as $post_type ) {
$object_taxonomies = get_object_taxonomies( $post_type );
foreach ( (array) $object_taxonomies as $taxonomy ) {
$taxonomies[] = $taxonomy;
}
}
// remove duplicates
$taxonomies = array_unique( $taxonomies );
// return
return $taxonomies;
}
/*
* acf_get_taxonomy_labels
*
* Returns an array of taxonomies in the format "name => label" for use in a select field.
*
* @date 3/8/18
* @since 5.7.2
*
* @param array $taxonomies Optional. An array of specific taxonomies to return.
* @return array
*/
function acf_get_taxonomy_labels( $taxonomies = array() ) {
// default
if ( empty( $taxonomies ) ) {
$taxonomies = acf_get_taxonomies();
}
// vars
$ref = array();
$data = array();
// loop
foreach ( $taxonomies as $taxonomy ) {
// vars
$object = get_taxonomy( $taxonomy );
$label = $object->labels->singular_name;
// append
$data[ $taxonomy ] = $label;
// increase counter
if ( ! isset( $ref[ $label ] ) ) {
$ref[ $label ] = 0;
}
$ref[ $label ]++;
}
// show taxonomy name next to label for shared labels
foreach ( $data as $taxonomy => $label ) {
if ( $ref[ $label ] > 1 ) {
$data[ $taxonomy ] .= ' (' . $taxonomy . ')';
}
}
// return
return $data;
}
/**
* acf_get_term_title
*
* Returns the title for this term object.
*
* @date 10/9/18
* @since 5.0.0
*
* @param object $term The WP_Term object.
* @return string
*/
function acf_get_term_title( $term ) {
$title = $term->name;
// Allow for empty name.
if ( $title === '' ) {
$title = __( '(no title)', 'acf' );
}
// Prepend ancestors indentation.
if ( is_taxonomy_hierarchical( $term->taxonomy ) ) {
$ancestors = get_ancestors( $term->term_id, $term->taxonomy );
$title = str_repeat( '- ', count( $ancestors ) ) . $title;
}
return $title;
}
/**
* acf_get_grouped_terms
*
* Returns an array of terms for the given query $args and groups by taxonomy name.
*
* @date 2/8/18
* @since 5.7.2
*
* @param array $args An array of args used in the get_terms() function.
* @return array
*/
function acf_get_grouped_terms( $args ) {
// vars
$data = array();
// defaults
$args = wp_parse_args(
$args,
array(
'taxonomy' => null,
'hide_empty' => false,
'update_term_meta_cache' => false,
)
);
// vars
$taxonomies = acf_get_taxonomy_labels( acf_get_array( $args['taxonomy'] ) );
$is_single = ( count( $taxonomies ) == 1 );
// specify exact taxonomies required for _acf_terms_clauses() to work.
$args['taxonomy'] = array_keys( $taxonomies );
// add filter to group results by taxonomy
if ( ! $is_single ) {
add_filter( 'terms_clauses', '_acf_terms_clauses', 10, 3 );
}
// get terms
$terms = get_terms( $args );
// remove this filter (only once)
if ( ! $is_single ) {
remove_filter( 'terms_clauses', '_acf_terms_clauses', 10, 3 );
}
// loop
foreach ( $taxonomies as $taxonomy => $label ) {
// vars
$this_terms = array();
// populate $this_terms
foreach ( $terms as $term ) {
if ( $term->taxonomy == $taxonomy ) {
$this_terms[] = $term;
}
}
// bail early if no $items
if ( empty( $this_terms ) ) {
continue;
}
// sort into hierachial order
// this will fail if a search has taken place because parents wont exist
if ( is_taxonomy_hierarchical( $taxonomy ) && empty( $args['s'] ) ) {
// get all terms from this taxonomy
$all_terms = get_terms(
array_merge(
$args,
array(
'number' => 0,
'offset' => 0,
'taxonomy' => $taxonomy,
)
)
);
// vars
$length = count( $this_terms );
$offset = 0;
// find starting point (offset)
foreach ( $all_terms as $i => $term ) {
if ( $term->term_id == $this_terms[0]->term_id ) {
$offset = $i;
break;
}
}
// order terms
$parent = acf_maybe_get( $args, 'parent', 0 );
$parent = acf_maybe_get( $args, 'child_of', $parent );
$ordered_terms = _get_term_children( $parent, $all_terms, $taxonomy );
// compare aray lengths
// if $ordered_posts is smaller than $all_posts, WP has lost posts during the get_page_children() function
// this is possible when get_post( $args ) filter out parents (via taxonomy, meta and other search parameters)
if ( count( $ordered_terms ) == count( $all_terms ) ) {
$this_terms = array_slice( $ordered_terms, $offset, $length );
}
}
// populate group
$data[ $label ] = array();
foreach ( $this_terms as $term ) {
$data[ $label ][ $term->term_id ] = $term;
}
}
// return
return $data;
}
/**
* _acf_terms_clauses
*
* Used in the 'terms_clauses' filter to order terms by taxonomy name.
*
* @date 2/8/18
* @since 5.7.2
*
* @param array $pieces Terms query SQL clauses.
* @param array $taxonomies An array of taxonomies.
* @param array $args An array of terms query arguments.
* @return array $pieces
*/
function _acf_terms_clauses( $pieces, $taxonomies, $args ) {
// prepend taxonomy to 'orderby' SQL
if ( is_array( $taxonomies ) ) {
$sql = "FIELD(tt.taxonomy,'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "')";
$pieces['orderby'] = str_replace( 'ORDER BY', "ORDER BY $sql,", $pieces['orderby'] );
}
// return
return $pieces;
}
/**
* acf_get_pretty_taxonomies
*
* Deprecated in favor of acf_get_taxonomy_labels() function.
*
* @date 7/10/13
* @since 5.0.0
* @deprecated 5.7.2
*/
function acf_get_pretty_taxonomies( $taxonomies = array() ) {
return acf_get_taxonomy_labels( $taxonomies );
}
/**
* acf_get_term
*
* Similar to get_term() but with some extra functionality.
*
* @date 19/8/18
* @since 5.7.3
*
* @param mixed $term_id The term ID or a string of "taxonomy:slug".
* @param string $taxonomy The taxonomyname.
* @return WP_Term
*/
function acf_get_term( $term_id, $taxonomy = '' ) {
// allow $term_id parameter to be a string of "taxonomy:slug" or "taxonomy:id"
if ( is_string( $term_id ) && strpos( $term_id, ':' ) ) {
list( $taxonomy, $term_id ) = explode( ':', $term_id );
$term = get_term_by( 'slug', $term_id, $taxonomy );
if ( $term ) {
return $term;
}
}
// return
return get_term( $term_id, $taxonomy );
}
/**
* acf_encode_term
*
* Returns a "taxonomy:slug" string for a given WP_Term.
*
* @date 27/8/18
* @since 5.7.4
*
* @param WP_Term $term The term object.
* @return string
*/
function acf_encode_term( $term ) {
return "{$term->taxonomy}:{$term->slug}";
}
/**
* acf_decode_term
*
* Decodes a "taxonomy:slug" string into an array of taxonomy and slug.
*
* @date 27/8/18
* @since 5.7.4
*
* @param WP_Term $term The term object.
* @return string
*/
function acf_decode_term( $string ) {
if ( is_string( $string ) && strpos( $string, ':' ) ) {
list( $taxonomy, $slug ) = explode( ':', $string );
return compact( 'taxonomy', 'slug' );
}
return false;
}
/**
* acf_get_encoded_terms
*
* Returns an array of WP_Term objects from an array of encoded strings
*
* @date 9/9/18
* @since 5.7.5
*
* @param array $values The array of encoded strings.
* @return array
*/
function acf_get_encoded_terms( $values ) {
// vars
$terms = array();
// loop over values
foreach ( (array) $values as $value ) {
// find term from string
$term = acf_get_term( $value );
// append
if ( $term instanceof WP_Term ) {
$terms[] = $term;
}
}
// return
return $terms;
}
/**
* acf_get_choices_from_terms
*
* Returns an array of choices from the terms provided.
*
* @date 8/9/18
* @since 5.7.5
*
* @param array $values and array of WP_Terms objects or encoded strings.
* @param string $format The value format (term_id, slug).
* @return array
*/
function acf_get_choices_from_terms( $terms, $format = 'term_id' ) {
// vars
$groups = array();
// get taxonomy lables
$labels = acf_get_taxonomy_labels();
// convert array of encoded strings to terms
$term = reset( $terms );
if ( ! $term instanceof WP_Term ) {
$terms = acf_get_encoded_terms( $terms );
}
// loop over terms
foreach ( $terms as $term ) {
$group = $labels[ $term->taxonomy ];
$choice = acf_get_choice_from_term( $term, $format );
$groups[ $group ][ $choice['id'] ] = $choice['text'];
}
// return
return $groups;
}
/**
* acf_get_choices_from_grouped_terms
*
* Returns an array of choices from the grouped terms provided.
*
* @date 8/9/18
* @since 5.7.5
*
* @param array $value A grouped array of WP_Terms objects.
* @param string $format The value format (term_id, slug).
* @return array
*/
function acf_get_choices_from_grouped_terms( $value, $format = 'term_id' ) {
// vars
$groups = array();
// loop over values
foreach ( $value as $group => $terms ) {
$groups[ $group ] = array();
foreach ( $terms as $term_id => $term ) {
$choice = acf_get_choice_from_term( $term, $format );
$groups[ $group ][ $choice['id'] ] = $choice['text'];
}
}
// return
return $groups;
}
/**
* acf_get_choice_from_term
*
* Returns an array containing the id and text for this item.
*
* @date 10/9/18
* @since 5.7.6
*
* @param object $item The item object such as WP_Post or WP_Term.
* @param string $format The value format (term_id, slug)
* @return array
*/
function acf_get_choice_from_term( $term, $format = 'term_id' ) {
// vars
$id = $term->term_id;
$text = acf_get_term_title( $term );
// return format
if ( $format == 'slug' ) {
$id = acf_encode_term( $term );
}
// return
return array(
'id' => $id,
'text' => $text,
);
}
/**
* Returns a valid post_id string for a given term and taxonomy.
* No longer needed since WP introduced the termmeta table in WP 4.4.
*
* @date 6/2/17
* @since 5.5.6
* @deprecated 5.9.2
*
* @param $taxonomy (string) The taxonomy type.
* @param $term_id (int) The term ID.
* @return (string)
*/
function acf_get_term_post_id( $taxonomy, $term_id ) {
_deprecated_function( __FUNCTION__, '5.9.2', 'string format term_%d' );
return 'term_' . $term_id;
}

Some files were not shown because too many files have changed in this diff Show More