diff --git a/package.json b/package.json
index b4b1508..fc5955b 100644
--- a/package.json
+++ b/package.json
@@ -4,5 +4,11 @@
"repository": "git@gitlab.com:website-saburly/v2-backend.git",
"author": "Saburly",
"license": "UNLICENSED",
- "private": true
+ "private": true,
+ "scripts": {
+ "preinstall": "chmod +x install.sh && chmod +x mysql_config.sh && ./install.sh",
+ "postinstall": "robo wordpress:setup",
+ "start": "wp server",
+ "lint": "phpcs -v wordpress/wp-content/themes/saburly-headless/. RoboFile.php"
+ }
}
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/acf-to-wp-api/README.md b/wordpress/wp-content/plugins/acf-to-wp-api/README.md
new file mode 100644
index 0000000..a908697
--- /dev/null
+++ b/wordpress/wp-content/plugins/acf-to-wp-api/README.md
@@ -0,0 +1,83 @@
+# ACF to WP-API
+
+[](https://gitter.im/times/acf-to-wp-api?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+Contributors: chrishutchinson, kokarn, ramvi
+Tags: acf, api, wp-api
+Requires at least: 3.9.0
+Tested up to: 4.7.3
+Stable tag: 1.4.0
+License: MIT
+License URI: http://opensource.org/licenses/MIT
+
+Plugs Advanced Custom Fields (ACF) data into the WordPress JSON API (WP-API).
+
+## Description
+
+Puts all ACF fields from posts, pages, custom post types, comments, attachments and taxonomy terms, into the WP-API output under the 'acf' key. Creates a new `/option` endpoint returning options (requires ACF Options Page plugin).
+
+## Installation
+
+1. Unzip and upload the `acf-to-wp-api` directory to `/wp-content/plugins/`.
+2. Activate the plugin through the 'Plugins' menu in WordPress
+
+## Frequently Asked Questions
+
+#### How can I log and issue or contribute code?
+See the `CONTRIBUTING.md` file.
+
+#### How can I filter posts on a custom field?
+See issue #13 for example code to do this.
+
+## Options Endpoints
+
+### `/wp-json/wp/v2/acf/options`
+Request a list of all options configured in ACF
+
+### `/wp-json/wp/v2/acf/options/{option-name}`
+Request a specific option, by passing in the option name
+
+## Changelog
+
+### 1.4.0
+
+* Compatibility improvements for WordPress 4.7
+
+### 1.3.3
+
+* Compatibility fix for V2.0Beta9
+
+### 1.3.2
+
+* Adds support for custom post types when using v2 of the REST API
+
+### 1.3.1
+
+* Fix to support PHP < 5.4
+
+### 1.3.0
+
+* Add support for v2 of WP-API
+* Restructure of much of the code, adding documentation throughout
+* Add an additional endpoint for requesting single option values
+* Tested with WordPress 4.3.0
+
+### 1.2.1
+
+* Tested with WordPress 4.2.1
+
+### 1.2.0
+
+* Added ACF data to comments (Thanks @ramvi).
+
+### 1.1.0
+
+* Add `/option` endpoint for ACF options add-on (Thanks @kokarn).
+
+### 1.0.1
+
+* Fix for addACFDataTerm.
+
+### 1.0.0
+
+* Initial release.
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/acf-to-wp-api/acf-to-wp-api.php b/wordpress/wp-content/plugins/acf-to-wp-api/acf-to-wp-api.php
new file mode 100644
index 0000000..a2dd75a
--- /dev/null
+++ b/wordpress/wp-content/plugins/acf-to-wp-api/acf-to-wp-api.php
@@ -0,0 +1,560 @@
+
+ *
+ * @since 1.4.0 Improved API version checking
+ * @since 1.3.3 Compatibility fix for V2.0Beta9
+ * @since 1.3.0 Updated to support version 2 of the WP-API
+ * @since 1.0.0
+ */
+ function __construct() {
+ // Setup defaults
+ $this->plugin = new StdClass;
+ $this->plugin->title = 'ACF to WP API';
+ $this->plugin->name = 'acf-to-wp-api';
+ $this->plugin->folder = WP_PLUGIN_DIR . '/' . $this->plugin->name;
+ $this->plugin->url = WP_PLUGIN_URL . '/' . str_replace(basename( __FILE__), "", plugin_basename(__FILE__));
+ $this->plugin->version = '1.4.0';
+
+ $this->apiVersion = $this->_getAPIVersion();
+
+ // Version One
+ if($this->_isAPIVersionOne()) {
+ $this->_versionOneSetup();
+ }
+
+ // Version Two
+ if($this->_isAPIVersionTwo()) {
+ $this->_versionTwoSetup();
+ }
+ }
+ /**
+ * Die and dump
+ *
+ * @author Chris Hutchinson
+ *
+ * @param mixed $data The data to be dumped to the screen
+ *
+ * @return void
+ *
+ * @since 1.3.0
+ */
+ private function dd($data) {
+ if( WP_DEBUG ) {
+ echo '';
+ print_r($data);
+ echo ' ';
+ die();
+ }
+ }
+
+ /**
+ * Adds the required filters and hooks for version 1 of the REST API
+ * @author Chris Hutchinson
+ *
+ * @return void
+ *
+ * @since 1.3.0
+ */
+ private function _versionOneSetup() {
+ // Filters
+ add_filter( 'json_prepare_post', array( $this, 'addACFDataPost'), 10, 3 ); // Posts
+ add_filter( 'json_prepare_term', array( $this, 'addACFDataTerm'), 10, 3 ); // Taxonomy Terms
+ add_filter( 'json_prepare_user', array( $this, 'addACFDataUser'), 10, 3 ); // Users
+ add_filter( 'json_prepare_comment', array( $this, 'addACFDataComment'), 10, 3 ); // Comments
+
+ // Endpoints
+ add_filter( 'json_endpoints', array( $this, 'registerRoutes' ), 10, 3 );
+ }
+
+ /**
+ * Adds the required filters and hooks for version 2 of the REST API
+ * @author Chris Hutchinson
+ *
+ * @return void
+ *
+ * @since 1.3.0
+ */
+ private function _versionTwoSetup() {
+ // Actions
+ add_action( 'rest_api_init', array( $this, 'addACFDataPostV2' ) ); // Posts
+ add_action( 'rest_api_init', array( $this, 'addACFDataTermV2' ) ); // Taxonomy Terms
+ add_action( 'rest_api_init', array( $this, 'addACFDataUserV2' ) ); // Users
+ add_action( 'rest_api_init', array( $this, 'addACFDataCommentV2' ) ); // Comments
+
+ add_action( 'rest_api_init', array( $this, 'addACFOptionRouteV2') );
+ }
+
+ /**
+ * Returns the WP REST API version, assumes version 2
+ * if can't find any other version
+ *
+ * @return string The version number, set by WP REST API
+ *
+ * @since 1.3.2
+ */
+ private function _getAPIVersion() {
+ $version = 2;
+
+ if ( defined('REST_API_VERSION') ) {
+ $version = REST_API_VERSION;
+ } else {
+ $version = get_option( 'rest_api_plugin_version', get_option( 'json_api_plugin_version', null ) );
+ }
+
+ return $version;
+ }
+
+ /**
+ * Gets the version number of the WP REST API
+ *
+ * @author Chris Hutchinson
+ *
+ * @return int The base version number
+ *
+ * @since 1.3.0
+ */
+ private function _getAPIBaseVersion() {
+ $version = $this->apiVersion;
+
+ if( is_null( $version ) ) {
+ return false;
+ }
+
+ $baseNumber = (int) substr( $version, 0, 1 );
+
+ if( $baseNumber > 0 ) {
+ return $baseNumber;
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if the current API base version is version 1
+ *
+ * @return boolean True if the current API version is 1
+ *
+ * @since 1.3.0
+ */
+ private function _isAPIVersionOne() {
+ if($this->_getAPIBaseVersion() === 1) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if the current API base version is version 2
+ *
+ * @return boolean True if the current API version is 2
+ *
+ * @since 1.3.0
+ */
+ private function _isAPIVersionTwo() {
+ if($this->_getAPIBaseVersion() === 2) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Add data to users
+ *
+ * @param array $data The current ACF data
+ * @param int $user The ID of the user
+ * @param string $context The context the data is being requested in
+ *
+ * @since 1.1.0
+ */
+ function addACFDataUser( $data, $user, $context ) {
+ $data['acf'] = $this->_getData( $user->ID, 'user' );
+ return $data;
+ }
+
+ /**
+ * Add data to terms
+ *
+ * @param array $data The current ACF data
+ * @param int $term The ID of the term
+ * @param string $context The context the data is being requested in
+ *
+ * @since 1.1.0
+ */
+ function addACFDataTerm( $data, $term, $context = null ) {
+ $data['acf'] = get_fields( $term, 'term' );
+ return $data;
+ }
+
+ /**
+ * Add data to Posts, Custom Post Types, Pages & Attachments
+ *
+ * @param array $data The current ACF data
+ * @param int $post The ID of the record
+ * @param string $context The context the data is being requested in
+ *
+ * @since 1.1.0
+ */
+ function addACFDataPost( $data, $post, $context ) {
+ $data['acf'] = $this->_getData( $post['ID'] );
+ return $data;
+ }
+
+ /**
+ * Registers the `acf` field against posts
+ *
+ * @return void
+ *
+ * @since 1.3.2 Adds support for pages and public custom post types
+ * @since 1.3.0
+ */
+ function addACFDataPostV2() {
+ // Posts
+ register_rest_field( 'post',
+ 'acf',
+ array(
+ 'get_callback' => array( $this, 'addACFDataPostV2cb' ),
+ 'update_callback' => null,
+ 'schema' => null,
+ )
+ );
+
+ // Pages
+ register_rest_field( 'page',
+ 'acf',
+ array(
+ 'get_callback' => array( $this, 'addACFDataPostV2cb' ),
+ 'update_callback' => null,
+ 'schema' => null,
+ )
+ );
+
+ // Public custom post types
+ $types = get_post_types(array(
+ 'public' => true,
+ '_builtin' => false
+ ));
+ foreach($types as $key => $type) {
+ register_rest_field( $type,
+ 'acf',
+ array(
+ 'get_callback' => array( $this, 'addACFDataPostV2cb' ),
+ 'update_callback' => null,
+ 'schema' => null,
+ )
+ );
+ }
+ }
+
+ /**
+ * Returns the ACF data to be added to the JSON response posts
+ *
+ * @author Chris Hutchinson
+ *
+ * @param array $object The object to get data for
+ * @param string $fieldName The name of the field being completed
+ * @param object $request The WP_REST_REQUEST object
+ *
+ * @return array The data for this object type
+ *
+ * @see ACFtoWPAPI::addACFDataPostV2()
+ *
+ * @since 1.3.0
+ */
+ function addACFDataPostV2cb($object, $fieldName, $request) {
+ return $this->_getData($object['id']);
+ }
+
+ /**
+ * Registers the `acf` field against taxonomy terms
+ *
+ * @return void
+ *
+ * @since 1.3.0
+ */
+ function addACFDataTermV2() {
+ register_rest_field( 'term',
+ 'acf',
+ array(
+ 'get_callback' => array( $this, 'addACFDataTermV2cb' ),
+ 'update_callback' => null,
+ 'schema' => null,
+ )
+ );
+ }
+
+ /**
+ * Returns the ACF data to be added to the JSON response for taxonomy terms
+ *
+ * @author Chris Hutchinson
+ *
+ * @param array $object The object to get data for
+ * @param string $fieldName The name of the field being completed
+ * @param object $request The WP_REST_REQUEST object
+ *
+ * @return array The data for this object type
+ *
+ * @see ACFtoWPAPI::addACFDataTermV2()
+ *
+ * @since 1.3.0
+ */
+ function addACFDataTermV2cb($object, $fieldName, $request) {
+ return $this->_getData($object['id'], 'term', $object);
+ }
+
+ /**
+ * Registers the `acf` field against users
+ *
+ * @return void
+ *
+ * @since 1.3.0
+ */
+ function addACFDataUserV2() {
+ register_rest_field( 'user',
+ 'acf',
+ array(
+ 'get_callback' => array( $this, 'addACFDataUserV2cb' ),
+ 'update_callback' => null,
+ 'schema' => null,
+ )
+ );
+ }
+
+ /**
+ * Returns the ACF data to be added to the JSON response for users
+ *
+ * @author Chris Hutchinson
+ *
+ * @param array $object The object to get data for
+ * @param string $fieldName The name of the field being completed
+ * @param object $request The WP_REST_REQUEST object
+ *
+ * @return array The data for this object type
+ *
+ * @see ACFtoWPAPI::addACFDataUserV2()
+ *
+ * @since 1.3.0
+ */
+ function addACFDataUserV2cb($object, $fieldName, $request) {
+ return $this->_getData( $object['id'], 'user' );
+ }
+
+ /**
+ * Registers the `acf` field against comments
+ *
+ * @return void
+ *
+ * @since 1.3.0
+ */
+ function addACFDataCommentV2() {
+ register_rest_field( 'comment',
+ 'acf',
+ array(
+ 'get_callback' => array( $this, 'addACFDataCommentV2cb' ),
+ 'update_callback' => null,
+ 'schema' => null,
+ )
+ );
+ }
+
+ /**
+ * Returns the ACF data to be added to the JSON response for comments
+ *
+ * @author Chris Hutchinson
+ *
+ * @param array $object The object to get data for
+ * @param string $fieldName The name of the field being completed
+ * @param object $request The WP_REST_REQUEST object
+ *
+ * @return array The data for this object type
+ *
+ * @see ACFtoWPAPI::addACFDataCommentV2()
+ *
+ * @since 1.3.0
+ */
+ function addACFDataCommentV2cb( $object, $fieldName, $request ) {
+ return $this->_getData( $object['id'], 'comment' );
+ }
+
+ /**
+ * Returns an array of Advanced Custom Fields data for the given record
+ *
+ * @author Chris Hutchinson
+ *
+ * @param int $id The ID of the object to get
+ * @param string $type The type of the object to get
+ * @param array $object The full object being requested, only required for specific $types
+ *
+ * @return array The Advanced Custom Fields data for the supplied record
+ *
+ * @since 1.3.0
+ */
+ private function _getData($id, $type = 'post', $object = array()) {
+ switch($type) {
+ case 'post':
+ default:
+ return get_fields($id);
+ break;
+ case 'term':
+ return get_fields($object['taxonomy'] . '_' . $id);
+ break;
+ case 'user':
+ return get_fields('user_' . $id);
+ break;
+ case 'comment':
+ return get_fields('comment_' . $id);
+ break;
+ case 'options':
+ return get_fields('option');
+ break;
+ }
+ }
+
+ /**
+ * Registers the routes for all and single options
+ *
+ * @author Chris Hutchinson
+ *
+ * @return void
+ *
+ * @since 1.3.1 Switched to array() notation (over [] notation) to support PHP < 5.4
+ * @since 1.3.0
+ */
+ function addACFOptionRouteV2() {
+ register_rest_route( 'wp/v2/acf', '/options', array(
+ 'methods' => array(
+ 'GET'
+ ),
+ 'callback' => array( $this, 'addACFOptionRouteV2cb' )
+ ) );
+
+ register_rest_route( 'wp/v2/acf', '/options/(?P.+)', array(
+ 'methods' => array(
+ 'GET'
+ ),
+ 'callback' => array( $this, 'addACFOptionRouteV2cb' )
+ ) );
+ }
+
+ /**
+ * The callback for the `wp/v2/acf/options` endpoint
+ *
+ * @author Chris Hutchinson
+ *
+ * @param WP_REST_Request $request The WP_REST_Request object
+ *
+ * @return array|string The single requested option, or all options
+ *
+ * @see ACFtoWPAPI::addACFOptionRouteV2()
+ *
+ * @since 1.3.0
+ */
+ function addACFOptionRouteV2cb( WP_REST_Request $request ) {
+ if($request['option']) {
+ return get_field($request['option'], 'option');
+ }
+
+ return get_fields('option');
+ }
+
+ /**
+ * Returns data for comments (WP API v1)
+ *
+ * @author Chris Hutchinson
+ *
+ * @param array $data The response data to be extended
+ * @param object $comment The comment being requested
+ * @param string $context The context the data is being requested in
+ *
+ * @return array The extended $data array, with ACF data
+ *
+ * @since 1.1.0
+ *
+ */
+ function addACFDataComment($data, $comment, $context) {
+ $data['acf'] = $this->_getData('comment_' . $comment->comment_ID);
+ return $data;
+ }
+
+ /**
+ * Returns data for options (WP API v1)
+ *
+ * @author github.com/kokarn
+ *
+ * @return array The options data
+ *
+ * @since 1.1.0
+ *
+ */
+ function getACFOptions() {
+ return get_fields('options');
+ }
+
+ /**
+ * Returns a single option based on the supplied name (WP API v1)
+ *
+ * @author github.com/asquel
+ *
+ * @param string $name The option name being requested
+ *
+ * @return mixed The data for the supplied option
+ *
+ * @since 1.3.0
+ */
+ function getACFOption($name) {
+ return get_field($name, 'option');
+ }
+
+ /**
+ * Registers additional routes (WP API v1)
+ *
+ * @author github.com/kokarn
+ *
+ * @return array The routes data
+ *
+ * @since 1.1.0
+ *
+ */
+ function registerRoutes( $routes ) {
+ $routes['/option'] = array(
+ array( array( $this, 'getACFOptions' ), WP_JSON_Server::READABLE )
+ );
+ $routes['/options'] = array(
+ array( array( $this, 'getACFOptions' ), WP_JSON_Server::READABLE )
+ );
+
+ $routes['/options/(?P[\w-]+)'] = array(
+ array( array( $this, 'getACFOption' ), WP_JSON_Server::READABLE ),
+ );
+
+ return $routes;
+ }
+
+}
+
+$ACFtoWPAPI = new ACFtoWPAPI();
diff --git a/wordpress/wp-content/plugins/acf-to-wp-api/readme.txt b/wordpress/wp-content/plugins/acf-to-wp-api/readme.txt
new file mode 100644
index 0000000..e9f869b
--- /dev/null
+++ b/wordpress/wp-content/plugins/acf-to-wp-api/readme.txt
@@ -0,0 +1,76 @@
+=== ACF to WP-API ===
+Contributors: chrishutchinson, kokarn, ramvi
+Tags: acf, api, wp-api
+Requires at least: 3.9.0
+Tested up to: 4.7.3
+Stable tag: 1.4.0
+License: MIT
+License URI: http://opensource.org/licenses/MIT
+
+Plugs Advanced Custom Fields (ACF) data into the WordPress JSON API (WP-API).
+
+== Description ==
+
+Puts all ACF fields from posts, pages, custom post types, comments, attachments and taxonomy terms, into the WP-API output under the 'acf' key. Creates a new `/option` endpoint returning options (requires ACF Options Page plugin).
+
+== Installation ==
+
+1. Unzip and upload the `acf-to-wp-api` directory to `/wp-content/plugins/`.
+2. Activate the plugin through the 'Plugins' menu in WordPress
+
+== Frequently Asked Questions ==
+
+= How can I log and issue or contribute code? =
+
+See the `CONTRIBUTING.md` file.
+
+= How can I filter posts on a custom field?
+
+See GitHub issue #13 (http://github.com/times/acf-to-wp-api/issues/13) for example code to do this.
+
+== Screenshots ==
+
+== Changelog ==
+
+= 1.4.0 =
+
+* Compatibility improvements for WordPress 4.7
+
+= 1.3.3 =
+
+* Compatibility fix for V2.0Beta9
+
+= 1.3.2 =
+
+* Adds support for custom post types when using v2 of the REST API
+
+= 1.3.1 =
+
+* Fix to support PHP < 5.4
+
+= 1.3.0 =
+
+* Add support for v2 of WP-API
+* Restructure of much of the code, adding documentation throughout
+* Add an additional endpoint for requesting single option values
+* Tested with WordPress 4.3.0
+
+= 1.2.1 =
+
+* Tested with WordPress 4.2.1
+
+= 1.2.0 =
+
+* Added ACF data to comments (Thanks @ramvi).
+
+= 1.1.0 =
+
+* Add `option` endpoint for ACF options add-on (Thanks @kokarn).
+
+= 1.0.1 =
+
+* Fix for addACFDataTerm.
+
+= 1.0.0 =
+
+* Initial release.
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/acf.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/acf.php
new file mode 100644
index 0000000..fd7b722
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/acf.php
@@ -0,0 +1,666 @@
+settings = array(
+
+ // basic
+ 'name' => __('Advanced Custom Fields', 'acf'),
+ 'version' => $this->version,
+
+ // urls
+ 'file' => __FILE__,
+ 'basename' => plugin_basename( __FILE__ ),
+ 'path' => plugin_dir_path( __FILE__ ),
+ 'dir' => plugin_dir_url( __FILE__ ),
+
+ // options
+ '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
+ );
+
+
+ // constants
+ $this->define( 'ACF', true );
+ $this->define( 'ACF_VERSION', $this->settings['version'] );
+ $this->define( 'ACF_PATH', $this->settings['path'] );
+
+
+ // api
+ include_once( ACF_PATH . 'includes/api/api-helpers.php');
+ acf_include('includes/api/api-input.php');
+ acf_include('includes/api/api-value.php');
+ acf_include('includes/api/api-field.php');
+ acf_include('includes/api/api-field-group.php');
+ acf_include('includes/api/api-template.php');
+
+
+ // fields
+ acf_include('includes/fields.php');
+ acf_include('includes/fields/class-acf-field.php');
+
+
+ // locations
+ acf_include('includes/locations.php');
+ acf_include('includes/locations/class-acf-location.php');
+
+
+ // core
+ acf_include('includes/ajax.php');
+ acf_include('includes/cache.php');
+ acf_include('includes/compatibility.php');
+ acf_include('includes/deprecated.php');
+ acf_include('includes/input.php');
+ acf_include('includes/json.php');
+ acf_include('includes/local.php');
+ acf_include('includes/loop.php');
+ acf_include('includes/media.php');
+ acf_include('includes/revisions.php');
+ acf_include('includes/third_party.php');
+ acf_include('includes/updates.php');
+ acf_include('includes/validation.php');
+
+
+ // 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-taxonomy.php');
+ acf_include('includes/forms/form-user.php');
+ acf_include('includes/forms/form-widget.php');
+
+
+ // 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/install.php');
+ acf_include('includes/admin/admin-tools.php');
+ acf_include('includes/admin/settings-info.php');
+
+
+ // network
+ if( is_network_admin() ) {
+
+ acf_include('includes/admin/install-network.php');
+
+ }
+ }
+
+
+ // pro
+ acf_include('pro/acf-pro.php');
+
+
+ // 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_action('init', array($this, 'register_assets'), 5);
+
+
+ // filters
+ add_filter('posts_where', array($this, 'posts_where'), 10, 2 );
+ //add_filter('posts_request', array($this, 'posts_request'), 10, 1 );
+
+ }
+
+
+ /*
+ * init
+ *
+ * This function will run after all plugins and theme functions have been included
+ *
+ * @type action (init)
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param N/A
+ * @return N/A
+ */
+
+ function init() {
+
+ // bail early if too early
+ // ensures all plugins have a chance to add fields, etc
+ if( !did_action('plugins_loaded') ) return;
+
+
+ // bail early if already init
+ if( acf_has_done('init') ) return;
+
+
+ // vars
+ $major = intval( acf_get_setting('version') );
+
+
+ // redeclare dir
+ // - allow another plugin to modify dir (maybe force SSL)
+ acf_update_setting('dir', plugin_dir_url( __FILE__ ));
+
+
+ // textdomain
+ $this->load_plugin_textdomain();
+
+
+ // include wpml support
+ if( defined('ICL_SITEPRESS_VERSION') ) {
+ acf_include('includes/wpml.php');
+ }
+
+
+ // 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');
+ do_action('acf/include_field_types', $major);
+
+
+ // 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');
+ do_action('acf/include_location_rules', $major);
+
+
+ // local fields
+ do_action('acf/include_fields', $major);
+
+
+ // action for 3rd party
+ do_action('acf/init');
+
+ }
+
+
+ /*
+ * load_plugin_textdomain
+ *
+ * This function will load the textdomain file
+ *
+ * @type function
+ * @date 3/5/17
+ * @since 5.5.13
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function load_plugin_textdomain() {
+
+ // vars
+ $domain = 'acf';
+ $locale = apply_filters( 'plugin_locale', acf_get_locale(), $domain );
+ $mofile = $domain . '-' . $locale . '.mo';
+
+
+ // load from the languages directory first
+ load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile );
+
+
+ // redirect missing translations
+ $mofile = str_replace('fr_CA', 'fr_FR', $mofile);
+
+
+ // load from plugin lang folder
+ load_textdomain( $domain, acf_get_path( 'lang/' . $mofile ) );
+
+ }
+
+
+ /*
+ * register_post_types
+ *
+ * This function will register post types and statuses
+ *
+ * @type function
+ * @date 22/10/2015
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function register_post_types() {
+
+ // vars
+ $cap = acf_get_setting('capability');
+
+
+ // register post type 'acf-field-group'
+ 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,
+ 'show_ui' => true,
+ '_builtin' => false,
+ 'capability_type' => 'post',
+ 'capabilities' => array(
+ 'edit_post' => $cap,
+ 'delete_post' => $cap,
+ 'edit_posts' => $cap,
+ 'delete_posts' => $cap,
+ ),
+ 'hierarchical' => true,
+ 'rewrite' => false,
+ 'query_var' => false,
+ 'supports' => array('title'),
+ 'show_in_menu' => false,
+ ));
+
+
+ // register post type 'acf-field'
+ 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,
+ 'show_ui' => false,
+ '_builtin' => false,
+ 'capability_type' => 'post',
+ 'capabilities' => array(
+ 'edit_post' => $cap,
+ 'delete_post' => $cap,
+ 'edit_posts' => $cap,
+ 'delete_posts' => $cap,
+ ),
+ 'hierarchical' => true,
+ 'rewrite' => false,
+ 'query_var' => false,
+ 'supports' => array('title'),
+ 'show_in_menu' => false,
+ ));
+
+ }
+
+
+ /*
+ * register_post_status
+ *
+ * This function will register custom post statuses
+ *
+ * @type function
+ * @date 22/10/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function register_post_status() {
+
+ // acf-disabled
+ register_post_status('acf-disabled', array(
+ 'label' => __( 'Inactive', 'acf' ),
+ 'public' => true,
+ 'exclude_from_search' => false,
+ 'show_in_admin_all_list' => true,
+ 'show_in_admin_status_list' => true,
+ 'label_count' => _n_noop( 'Inactive (%s) ', 'Inactive (%s) ', 'acf' ),
+ ));
+
+ }
+
+
+ /*
+ * register_assets
+ *
+ * This function will register scripts and styles
+ *
+ * @type function
+ * @date 22/10/2015
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function register_assets() {
+
+ // vars
+ $version = acf_get_setting('version');
+ $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
+
+
+ // scripts
+ wp_register_script('acf-input', acf_get_dir("assets/js/acf-input{$min}.js"), array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable'), $version );
+ wp_register_script('acf-field-group', acf_get_dir("assets/js/acf-field-group{$min}.js"), array('acf-input'), $version );
+
+
+ // styles
+ wp_register_style('acf-global', acf_get_dir('assets/css/acf-global.css'), array(), $version );
+ wp_register_style('acf-input', acf_get_dir('assets/css/acf-input.css'), array('acf-global'), $version );
+ wp_register_style('acf-field-group', acf_get_dir('assets/css/acf-field-group.css'), array('acf-input'), $version );
+
+ }
+
+
+ /*
+ * posts_where
+ *
+ * This function will add in some new parameters to the WP_Query args allowing fields to be found via key / name
+ *
+ * @type filter
+ * @date 5/12/2013
+ * @since 5.0.0
+ *
+ * @param $where (string)
+ * @param $wp_query (object)
+ * @return $where (string)
+ */
+
+ function posts_where( $where, $wp_query ) {
+
+ // global
+ global $wpdb;
+
+
+ // acf_field_key
+ if( $field_key = $wp_query->get('acf_field_key') ) {
+
+ $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key );
+
+ }
+
+
+ // acf_field_name
+ if( $field_name = $wp_query->get('acf_field_name') ) {
+
+ $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name );
+
+ }
+
+
+ // acf_group_key
+ if( $group_key = $wp_query->get('acf_group_key') ) {
+
+ $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key );
+
+ }
+
+
+ // return
+ return $where;
+
+ }
+
+
+ /*
+ * define
+ *
+ * This function will safely define a constant
+ *
+ * @type function
+ * @date 3/5/17
+ * @since 5.5.13
+ *
+ * @param $name (string)
+ * @param $value (mixed)
+ * @return n/a
+ */
+
+ function define( $name, $value = true ) {
+
+ if( !defined($name) ) define( $name, $value );
+
+ }
+
+
+ /*
+ * get_setting
+ *
+ * This function will return a value from the settings array found in the acf object
+ *
+ * @type function
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param $name (string) the setting name to return
+ * @param $value (mixed) default value
+ * @return $value
+ */
+
+ function get_setting( $name, $value = null ) {
+
+ // check settings
+ if( isset($this->settings[ $name ]) ) {
+
+ $value = $this->settings[ $name ];
+
+ }
+
+
+ // filter for 3rd party customization
+ if( substr($name, 0, 1) !== '_' ) {
+
+ $value = apply_filters( "acf/settings/{$name}", $value );
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * update_setting
+ *
+ * This function will update a value into the settings array found in the acf object
+ *
+ * @type function
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param $name (string)
+ * @param $value (mixed)
+ * @return n/a
+ */
+
+ function update_setting( $name, $value ) {
+
+ $this->settings[ $name ] = $value;
+
+ return true;
+
+ }
+
+}
+
+
+/*
+* 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:
+*
+* @type function
+* @date 4/09/13
+* @since 4.3.0
+*
+* @param N/A
+* @return (object)
+*/
+
+function acf() {
+
+ global $acf;
+
+ if( !isset($acf) ) {
+
+ $acf = new acf();
+
+ $acf->initialize();
+
+ }
+
+ return $acf;
+
+}
+
+
+// initialize
+acf();
+
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/css/acf-field-group.css b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/css/acf-field-group.css
new file mode 100644
index 0000000..8b9c9da
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/css/acf-field-group.css
@@ -0,0 +1,432 @@
+/*--------------------------------------------------------------------------------------------
+*
+* Vars
+*
+*--------------------------------------------------------------------------------------------*/
+/* colors */
+/* acf-field */
+/* responsive */
+/*--------------------------------------------------------------------------------------------
+*
+* Mixins
+*
+*--------------------------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------------------------
+*
+* Global
+*
+*---------------------------------------------------------------------------------------------*/
+#adv-settings .show-field-keys label {
+ padding: 0 5px;
+}
+#acf-field-group-fields > .inside,
+#acf-field-group-locations > .inside,
+#acf-field-group-options > .inside {
+ padding: 0;
+ margin: 0;
+}
+.acf-field p.description {
+ font-style: normal;
+ font-size: 12px;
+ color: #777777;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Postbox: Publish
+*
+*---------------------------------------------------------------------------------------------*/
+#minor-publishing-actions,
+#misc-publishing-actions #visibility {
+ 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;
+ /* metabox */
+ /* links */
+ /* no fields */
+ /* table header */
+ /* show keys */
+ /* fields */
+}
+#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 .no-fields-message {
+ padding: 15px 15px;
+ background: #fff;
+}
+#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: #DFDFDF solid 1px;
+}
+#acf-field-group-fields .acf-field-list {
+ background: #F9F9F9;
+ margin-top: -1px;
+}
+/* field object */
+.acf-field-object {
+ border-top: #F0F0F0 solid 1px;
+ background: #fff;
+ /* sortable */
+ /* meta */
+ /* handle */
+ /* open */
+ /* 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: 28px;
+ 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 {
+ 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: 15px 0 5px;
+}
+.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;
+ visibility: hidden;
+}
+.rule-groups .rule-group tr:hover td.remove {
+ visibility: visible;
+}
+/* Don't allow user to delete the first field group */
+.rule-groups .rule-group:first-child tr:first-child td.remove {
+ 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-tab .acf-field-setting-instructions,
+.acf-field-object-tab .acf-field-setting-required,
+.acf-field-object-tab .acf-field-setting-warning,
+.acf-field-object-tab .acf-field-setting-wrapper,
+.acf-field-object-accordion .acf-field-setting-name,
+.acf-field-object-accordion .acf-field-setting-instructions,
+.acf-field-object-accordion .acf-field-setting-required,
+.acf-field-object-accordion .acf-field-setting-warning,
+.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: #f9f9f9;
+ border-bottom: #f0f0f0 solid 1px;
+}
+.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;
+ }
+}
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/css/acf-global.css b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/css/acf-global.css
new file mode 100644
index 0000000..492e079
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/css/acf-global.css
@@ -0,0 +1,1480 @@
+/*--------------------------------------------------------------------------------------------
+*
+* Vars
+*
+*--------------------------------------------------------------------------------------------*/
+/* colors */
+/* acf-field */
+/* responsive */
+/*--------------------------------------------------------------------------------------------
+*
+* Mixins
+*
+*--------------------------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------------------------
+*
+* General
+*
+*--------------------------------------------------------------------------------------------*/
+/* box-sizing */
+/*
+[class^="acf-"] {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+*/
+/* Horizontal List */
+.acf-hl {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+ display: block;
+ position: relative;
+}
+.acf-hl > li {
+ float: left;
+ display: block;
+ margin: 0;
+ padding: 0;
+}
+.acf-hl > li.acf-fr {
+ float: right;
+}
+/* Horizontal List: Clearfix */
+.acf-hl:before,
+.acf-hl:after,
+.acf-bl:before,
+.acf-bl:after,
+.acf-cf:before,
+.acf-cf:after {
+ content: "";
+ display: block;
+ line-height: 0;
+}
+.acf-hl:after,
+.acf-bl:after,
+.acf-cf:after {
+ clear: both;
+}
+/* Block List */
+.acf-bl {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+ display: block;
+ position: relative;
+}
+.acf-bl > li {
+ display: block;
+ margin: 0;
+ padding: 0;
+ float: none;
+}
+/* Full width */
+img.acf-fw {
+ width: 100%;
+}
+/* Browser */
+.acf-visible {
+ display: block;
+ visibility: visible;
+}
+.acf-hidden {
+ display: none;
+ visibility: visible;
+}
+/* Float */
+.acf-fl {
+ float: left;
+}
+.acf-fr {
+ float: right;
+}
+.acf-fn {
+ float: none;
+}
+/* Align */
+.acf-al {
+ text-align: left;
+}
+.acf-ar {
+ text-align: right;
+}
+.acf-ac {
+ text-align: center;
+}
+/* loading */
+.acf-loading,
+.acf-spinner {
+ display: inline-block;
+ height: 20px;
+ width: 20px;
+ vertical-align: text-top;
+ background: transparent url(../images/spinner.gif) no-repeat 50% 50%;
+}
+/* spinner */
+.acf-spinner {
+ display: none;
+}
+.acf-spinner.is-active {
+ display: inline-block;
+}
+/* WP < 4.2 */
+.spinner.is-active {
+ display: inline-block;
+}
+/* required */
+.acf-required {
+ color: #f00;
+}
+/* show on hover */
+.acf-soh .acf-soh-target {
+ -webkit-transition: opacity 0.25s 0s ease-in-out, visibility 0s linear 0.25s;
+ -moz-transition: opacity 0.25s 0s ease-in-out, visibility 0s linear 0.25s;
+ -o-transition: opacity 0.25s 0s ease-in-out, visibility 0s linear 0.25s;
+ transition: opacity 0.25s 0s ease-in-out, visibility 0s linear 0.25s;
+ visibility: hidden;
+ opacity: 0;
+}
+.acf-soh:hover .acf-soh-target {
+ -webkit-transition-delay: 0s;
+ -moz-transition-delay: 0s;
+ -o-transition-delay: 0s;
+ transition-delay: 0s;
+ visibility: visible;
+ opacity: 1;
+}
+/* show if value */
+.show-if-value {
+ display: none;
+}
+.hide-if-value {
+ display: block;
+}
+.has-value .show-if-value {
+ display: block;
+}
+.has-value .hide-if-value {
+ display: none;
+}
+/* select2 WP animation fix */
+.select2-search-choice-close {
+ -webkit-transition: none;
+ -moz-transition: none;
+ -o-transition: none;
+ transition: none;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* tooltip
+*
+*---------------------------------------------------------------------------------------------*/
+/* tooltip */
+.acf-tooltip {
+ background: #2F353E;
+ border-radius: 5px;
+ color: #fff;
+ padding: 5px 10px;
+ position: absolute;
+ font-size: 12px;
+ z-index: 900000;
+ /* tip */
+ /* positions */
+}
+.acf-tooltip:before {
+ border: solid;
+ border-color: transparent;
+ border-width: 6px;
+ content: "";
+ position: absolute;
+}
+.acf-tooltip.top {
+ margin-top: -8px;
+}
+.acf-tooltip.top:before {
+ top: 100%;
+ left: 50%;
+ margin-left: -6px;
+ border-top-color: #2F353E;
+ border-bottom-width: 0;
+}
+.acf-tooltip.right {
+ margin-right: -8px;
+}
+.acf-tooltip.right:before {
+ top: 50%;
+ margin-top: -6px;
+ right: 100%;
+ border-right-color: #2F353E;
+ border-left-width: 0;
+}
+.acf-tooltip.bottom {
+ margin-bottom: -8px;
+}
+.acf-tooltip.bottom:before {
+ bottom: 100%;
+ left: 50%;
+ margin-left: -6px;
+ border-bottom-color: #2F353E;
+ border-top-width: 0;
+}
+.acf-tooltip.left {
+ margin-left: -8px;
+}
+.acf-tooltip.left:before {
+ top: 50%;
+ margin-top: -6px;
+ left: 100%;
+ border-left-color: #2F353E;
+ border-right-width: 0;
+}
+/* confirm */
+.acf-tooltip.-confirm {
+ z-index: 900001;
+}
+.acf-tooltip.-confirm a {
+ text-decoration: none;
+ color: #9ea3a8;
+}
+.acf-tooltip.-confirm a:hover {
+ text-decoration: underline;
+}
+.acf-tooltip.-confirm a.-red {
+ color: #F55E4F;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* callout
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-callout {
+ margin: 20px 0;
+ padding: 20px;
+ background-color: #FCF8F2;
+ border-left: 3px solid #F0AD4E;
+}
+.acf-callout h4 {
+ color: #F0AD4E;
+ margin: 0 !important;
+}
+.acf-callout p {
+ margin-bottom: 0;
+}
+.acf-callout.danger {
+ border-color: #D9534F;
+ background-color: #FDF7F7;
+}
+.acf-callout.danger h4 {
+ color: #D9534F;
+}
+.acf-callout.success {
+ background-color: #f4faf6;
+ border-color: #bcf1c5;
+}
+.acf-callout.success h4 {
+ color: #3aad60;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* acf-icon
+*
+*--------------------------------------------------------------------------------------------*/
+@font-face {
+ font-family: 'acf';
+ src: url('../font/acf.eot?57601716');
+ src: url('../font/acf.eot?57601716#iefix') format('embedded-opentype'), url('../font/acf.woff2?57601716') format('woff2'), url('../font/acf.woff?57601716') format('woff'), url('../font/acf.ttf?57601716') format('truetype'), url('../font/acf.svg?57601716#acf') format('svg');
+ font-weight: normal;
+ font-style: normal;
+}
+.acf-icon:before {
+ font-family: "acf";
+ font-style: normal;
+ font-weight: normal;
+ speak: none;
+ display: inline-block;
+ text-decoration: inherit;
+ width: 1em;
+ text-align: center;
+ /* opacity: .8; */
+ /* For safety - reset parent styles, that can break glyph codes*/
+ font-variant: normal;
+ text-transform: none;
+ /* fix buttons height, for twitter bootstrap */
+ line-height: 1em;
+ /* Font smoothing. That was taken from TWBS */
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ /* more consistent vertical align */
+ position: relative;
+}
+.acf-icon.-plus:before {
+ content: '\e800';
+}
+/* '' */
+.acf-icon.-minus:before {
+ content: '\e801';
+}
+/* '' */
+.acf-icon.-cancel:before {
+ content: '\e802';
+}
+/* '' */
+.acf-icon.-pencil:before {
+ content: '\e803';
+ top: -1px;
+}
+/* '' */
+.acf-icon.-location:before {
+ content: '\e804';
+}
+/* '' */
+.acf-icon.-down:before {
+ content: '\e805';
+ top: 1px;
+}
+/* '' */
+.acf-icon.-left:before {
+ content: '\e806';
+ left: -1px;
+}
+/* '' */
+.acf-icon.-right:before {
+ content: '\e807';
+ left: 1px;
+}
+/* '' */
+.acf-icon.-up:before {
+ content: '\e808';
+ top: -1px;
+}
+/* '' */
+.acf-icon.-sync:before {
+ content: '\e809';
+}
+/* '' */
+.acf-icon.-globe:before {
+ content: '\e80a';
+}
+/* '' */
+.acf-icon.-picture:before {
+ content: '\e80b';
+}
+/* '' */
+.acf-icon.-check:before {
+ content: '\e80c';
+}
+/* '' */
+.acf-icon.-dot-3:before {
+ content: '\e80d';
+}
+/* '' */
+.acf-icon.-arrow-combo:before {
+ content: '\e80e';
+}
+/* '' */
+.acf-icon.-arrow-up:before {
+ content: '\e810';
+ top: -1px;
+}
+/* '' */
+.acf-icon.-arrow-down:before {
+ content: '\e80f';
+ top: 1px;
+}
+/* '' */
+.acf-icon.-search:before {
+ content: '\e811';
+}
+/* '' */
+.acf-icon.-link-ext:before {
+ content: '\f08e';
+}
+/* '' */
+/* collapse */
+.acf-icon.-collapse:before {
+ content: '\e810';
+ top: -1px;
+}
+/* arrow-up */
+.-collapsed .acf-icon.-collapse:before {
+ content: '\e80f';
+ top: 1px;
+}
+/* arrow-down */
+/* default */
+.acf-icon {
+ display: inline-block;
+ height: 26px;
+ width: 26px;
+ border: transparent solid 1px;
+ border-radius: 100%;
+ font-size: 16px;
+ line-height: 26px;
+ text-align: center;
+ text-decoration: none;
+ vertical-align: top;
+}
+/* elements */
+span.acf-icon {
+ color: #999;
+ border-color: #BBB;
+ background-color: #fff;
+}
+/* icon */
+a.acf-icon {
+ color: #999;
+ border-color: #BBB;
+ background-color: #fff;
+ position: relative;
+ overflow: hidden;
+ transition: none;
+ /* clear */
+ /* light*/
+ /* states */
+ /* remove WP outline box-shadow */
+ /* red */
+}
+a.acf-icon.-clear {
+ color: #444;
+ background: transparent;
+ border: none;
+}
+a.acf-icon.light {
+ border: none;
+ padding: 1px;
+ background: #F5F5F5;
+ color: #72777c;
+}
+a.acf-icon:hover {
+ border-color: transparent;
+ background: #2a9bd9;
+ color: #fff;
+}
+a.acf-icon:active {
+ color: #fff;
+ background-color: #238cc6;
+}
+a.acf-icon:active,
+a.acf-icon:focus {
+ outline: none;
+ box-shadow: none;
+}
+a.acf-icon.-minus:hover,
+a.acf-icon.-cancel:hover {
+ background-color: #F55E4F;
+}
+a.acf-icon.-minus:active,
+a.acf-icon.-cancel:active {
+ background-color: #f44837;
+}
+/* minor tweaks */
+.acf-icon.-pencil {
+ font-size: 15px;
+}
+.acf-icon.-location {
+ font-size: 18px;
+}
+/* sizes */
+.acf-icon.small,
+.acf-icon.-small {
+ width: 18px;
+ height: 18px;
+ line-height: 18px;
+ font-size: 14px;
+}
+/* dark */
+.acf-icon.dark {
+ border-color: transparent;
+ background: #23282D;
+ color: #eee;
+}
+a.acf-icon.dark:hover {
+ border-color: transparent;
+ background: #191E23;
+ color: #00b9eb;
+}
+a.acf-icon.-minus.dark:hover,
+a.acf-icon.-cancel.dark:hover {
+ color: #D54E21;
+}
+/* grey */
+.acf-icon.grey {
+ border-color: transparent;
+ background: #b4b9be;
+ color: #fff;
+}
+a.acf-icon.grey:hover {
+ border-color: transparent;
+ background: #00A0D2;
+ color: #fff;
+}
+a.acf-icon.-minus.grey:hover,
+a.acf-icon.-cancel.grey:hover {
+ background: #32373C;
+}
+/* red */
+.acf-icon.red {
+ border-color: transparent;
+ background-color: #F55E4F;
+ color: #fff;
+}
+/* yellow */
+.acf-icon.yellow {
+ border-color: transparent;
+ background-color: #FDBC40;
+ color: #fff;
+}
+/* logo */
+.acf-icon.logo {
+ width: 150px;
+ height: 150px;
+ background: #5EE8BF;
+ border: 0 none;
+ position: absolute;
+ right: 0;
+ top: 0;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* Sprite
+*
+*--------------------------------------------------------------------------------------------*/
+[class^="acf-sprite-"] {
+ display: inline-block;
+ width: 16px;
+ height: 16px;
+ background: url(../images/sprite.png);
+}
+.acf-icon [class^="acf-sprite-"] {
+ margin: 1px auto 0;
+}
+.acf-sprite-logo {
+ background-position: 0 0;
+ width: 100px;
+ height: 46px;
+}
+.acf-icon .acf-sprite-logo {
+ margin-top: 52px;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* acf-box
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-box {
+ background: #FFFFFF;
+ border: 1px solid #E5E5E5;
+ position: relative;
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
+ /* title */
+ /* footer */
+}
+.acf-box .title {
+ border-bottom: 1px solid #EEEEEE;
+ margin: 0;
+ padding: 15px;
+ background: #FFFFFF;
+}
+.acf-box .title h3 {
+ font-size: 14px;
+ line-height: 1em;
+ margin: 0;
+ padding: 0;
+}
+.acf-box .inner {
+ padding: 15px;
+}
+.acf-box h2 {
+ color: #333333;
+ font-size: 26px;
+ line-height: 1.25em;
+ margin: 0.25em 0 0.75em;
+ padding: 0;
+}
+.acf-box h3 {
+ margin: 1.5em 0 0;
+}
+.acf-box p {
+ margin-top: 0.5em;
+}
+.acf-box a {
+ text-decoration: none;
+}
+.acf-box i.dashicons-external {
+ margin-top: -1px;
+}
+.acf-box .footer {
+ background: #fff;
+ border-top: 1px solid #eee;
+ padding: 12px;
+ font-size: 13px;
+ line-height: 1.5;
+}
+.acf-box .footer p {
+ margin: 0;
+}
+/* error */
+.acf-error-message {
+ position: relative;
+ display: block;
+ background: #F55E4F;
+ margin: 5px 0 15px;
+ padding: 1px 12px;
+ min-height: 0px;
+ border-left: #dd4232 solid 4px;
+}
+.acf-error-message p {
+ font-size: 13px !important;
+ line-height: 1.5;
+ margin: 0.5em 0;
+ padding: 2px;
+ text-shadow: none;
+ color: #fff;
+}
+.acf-error-message .acf-icon {
+ position: absolute;
+ top: 9px;
+ right: 12px;
+ background-color: #dd4232;
+ border-color: transparent;
+ color: #fff;
+}
+/* important to include .-cancel to override .acf-icon.-cancel class */
+.acf-error-message .acf-icon.-cancel:hover {
+ background-color: #191e23;
+ color: #F55E4F;
+}
+/* success */
+.acf-error-message.-success {
+ background-color: #46b450;
+ border-color: #32973b;
+}
+.acf-error-message.-success .acf-icon {
+ background-color: #32973b;
+}
+.acf-error-message.-success .acf-icon.-cancel:hover {
+ background-color: #191e23;
+ color: #46b450;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* acf-table
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-table {
+ border: #DFDFDF solid 1px;
+ background: #fff;
+ border-spacing: 0;
+ border-radius: 0;
+ table-layout: auto;
+ padding: 0;
+ margin: 0;
+ width: 100%;
+ clear: both;
+ /* defaults */
+ /* thead */
+ /* tbody */
+ /* -clear */
+}
+.acf-table > tbody > tr > th,
+.acf-table > thead > tr > th,
+.acf-table > tbody > tr > td,
+.acf-table > thead > tr > td {
+ padding: 8px;
+ vertical-align: top;
+ background: #fff;
+ text-align: left;
+ border-style: solid;
+ font-weight: normal;
+}
+.acf-table > tbody > tr > th,
+.acf-table > thead > tr > th {
+ position: relative;
+ color: #333333;
+}
+.acf-table > thead > tr > th {
+ border-color: #E1E1E1;
+ border-width: 0 0 1px 1px;
+}
+.acf-table > thead > tr > th:first-child {
+ border-left-width: 0;
+}
+.acf-table > tbody > tr {
+ z-index: 1;
+}
+.acf-table > tbody > tr > td {
+ border-color: #EDEDED;
+ border-width: 1px 0 0 1px;
+}
+.acf-table > tbody > tr > td:first-child {
+ border-left-width: 0;
+}
+.acf-table > tbody > tr:first-child > td {
+ border-top-width: 0;
+}
+.acf-table.-clear {
+ border: 0 none;
+}
+.acf-table.-clear > tbody > tr > td,
+.acf-table.-clear > thead > tr > td,
+.acf-table.-clear > tbody > tr > th,
+.acf-table.-clear > thead > tr > th {
+ border: 0 none;
+ padding: 4px;
+}
+/* remove tr */
+.acf-remove-element {
+ -webkit-transition: all 0.25s ease-out;
+ -moz-transition: all 0.25s ease-out;
+ -o-transition: all 0.25s ease-out;
+ transition: all 0.25s ease-out;
+ transform: translate(50px, 0);
+ opacity: 0;
+}
+/* fade-up */
+.acf-fade-up {
+ -webkit-transition: all 0.25s ease-out;
+ -moz-transition: all 0.25s ease-out;
+ -o-transition: all 0.25s ease-out;
+ transition: all 0.25s ease-out;
+ transform: translate(0, -10px);
+ opacity: 0;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* wp-admin
+*
+*---------------------------------------------------------------------------------------------*/
+/* Menu */
+#adminmenu a[href="edit.php?post_type=acf-field-group&page=acf-settings-info"] {
+ display: none;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Field Group List
+*
+*---------------------------------------------------------------------------------------------*/
+#icon-edit.icon32-posts-acf-field-group {
+ background-position: -11px -5px;
+}
+#acf-field-group-wrap .tablenav,
+#acf-field-group-wrap p.search-box {
+ display: none;
+}
+#acf-field-group-wrap .wp-list-table .column-acf-fg-description,
+#acf-field-group-wrap .wp-list-table .column-acf-fg-description:before {
+ display: none !important;
+ /* important needed to override mobile */
+}
+#acf-field-group-wrap .wp-list-table .column-acf-fg-count {
+ width: 10%;
+}
+#acf-field-group-wrap .wp-list-table .column-acf-fg-status {
+ width: 10%;
+}
+#acf-field-group-wrap .tablenav.bottom {
+ display: block;
+}
+#acf-field-group-wrap .acf-description {
+ font-weight: normal;
+ font-size: 13px;
+ color: #999;
+ margin-left: 7px;
+ font-style: italic;
+}
+/* subsubsub */
+#acf-field-group-wrap .subsubsub {
+ /* WPML */
+ margin-bottom: 3px;
+ /* search */
+}
+#acf-field-group-wrap .subsubsub ul {
+ margin: 0;
+}
+#acf-field-group-wrap .subsubsub + .subsubsub {
+ margin-top: 0;
+}
+#acf-field-group-wrap .subsubsub a:focus {
+ box-shadow: none;
+}
+/* columns (replicate post edit layout) */
+.acf-columns-2 {
+ margin-right: 300px;
+ clear: both;
+ /* rtl */
+}
+.acf-columns-2:after {
+ clear: both;
+ content: "";
+ display: table;
+}
+html[dir="rtl"] .acf-columns-2 {
+ margin-right: 0;
+ margin-left: 300px;
+}
+.acf-columns-2 .acf-column-1 {
+ float: left;
+ width: 100%;
+ /* rtl */
+}
+html[dir="rtl"] .acf-columns-2 .acf-column-1 {
+ float: right;
+}
+.acf-columns-2 .acf-column-2 {
+ float: right;
+ margin-right: -300px;
+ width: 280px;
+ /* rtl */
+}
+html[dir="rtl"] .acf-columns-2 .acf-column-2 {
+ float: left;
+ margin-right: 0;
+ margin-left: -300px;
+}
+/* search */
+#acf-field-group-wrap .search-box:after {
+ display: block;
+ content: "";
+ height: 5px;
+}
+.acf-clear {
+ clear: both;
+}
+/* mobile compatibilty */
+@media screen and (max-width: 782px) {
+ #acf-field-group-wrap #the-list .acf-icon:after {
+ content: attr(title);
+ position: absolute;
+ margin-left: 5px;
+ font-size: 13px;
+ line-height: 18px;
+ font-style: normal;
+ color: #444;
+ }
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Fake table
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-thead,
+.acf-tbody,
+.acf-tfoot {
+ width: 100%;
+ padding: 0;
+ margin: 0;
+}
+.acf-thead > li,
+.acf-tbody > li,
+.acf-tfoot > li {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ padding: 8px 15px;
+ font-size: 12px;
+ line-height: 14px;
+}
+.acf-thead {
+ background: #FFFFFF;
+ border-bottom: #E1E1E1 solid 1px;
+}
+.acf-thead > li {
+ font-size: 14px;
+ line-height: 1.4em;
+ font-family: "Open Sans", sans-serif;
+ color: #222222;
+ font-weight: bold;
+}
+.acf-tfoot {
+ background: #f5f5f5;
+ border-top: #dddddd solid 1px;
+}
+.acf-tfoot > li {
+ color: #7A9BBE;
+ font-size: 12px;
+ line-height: 27px;
+}
+.acf-tfoot > li.comic-sans {
+ font-family: Comic Sans MS, sans-serif;
+ font-size: 11px;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* Settings
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-settings-wrap .acf-box {
+ margin: 20px 0;
+}
+.acf-settings-wrap table {
+ margin: 0;
+}
+.acf-settings-wrap table .button {
+ vertical-align: middle;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* Settings: Add-ons
+*
+*--------------------------------------------------------------------------------------------*/
+.add-ons-list {
+ margin: 20px 0 0 -18px;
+ max-width: 960px;
+}
+.add-ons-list .add-on {
+ width: 220px;
+ margin: 0 0 20px 18px;
+ float: left;
+}
+.add-ons-list .add-on .inner {
+ min-height: 90px;
+}
+.add-ons-list .add-on-acf-pro {
+ width: 940px;
+}
+.add-ons-list .add-on .thumbnail img {
+ display: block;
+}
+.add-ons-list .add-on h3 a {
+ color: inherit;
+ text-decoration: none;
+}
+.add-ons-list .add-on h3 {
+ margin: 0.5em 0;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* acf-popup
+*
+*--------------------------------------------------------------------------------------------*/
+#acf-popup {
+ position: fixed;
+ z-index: 900000;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+}
+#acf-popup .bg {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 0;
+ background: rgba(0, 0, 0, 0.25);
+}
+#acf-popup .acf-popup-box {
+ position: absolute;
+ z-index: 1;
+ width: 300px;
+ height: 300px;
+ left: 50%;
+ top: 50%;
+ margin: -150px 0 0 -150px;
+ border-color: #aaaaaa;
+}
+#acf-popup .title .acf-icon {
+ position: absolute;
+ top: 10px;
+ right: 10px;
+}
+html[dir="rtl"] #acf-popup .title .acf-icon {
+ right: auto;
+ left: 10px;
+}
+#acf-popup .acf-popup-box .inner,
+#acf-popup .acf-popup-box .loading {
+ position: absolute;
+ top: 44px;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 1;
+}
+#acf-popup .acf-popup-box .loading {
+ background: rgba(0, 0, 0, 0.1);
+ z-index: 2;
+ border-top: #DDDDDD solid 1px;
+ display: none;
+}
+#acf-popup .acf-popup-box .loading .acf-loading {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ margin: -10px 0 0 -10px;
+}
+#acf-popup .inner > *:first-child {
+ margin-top: 0;
+}
+/* submit p */
+.acf-submit {
+ margin-bottom: 0;
+}
+.acf-submit span {
+ float: right;
+ color: #999;
+}
+.acf-submit .acf-loading {
+ display: none;
+}
+.acf-submit .button {
+ margin-right: 5px;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* upgrade notice
+*
+*--------------------------------------------------------------------------------------------*/
+#acf-upgrade-notice {
+ margin-left: -20px;
+ background: #fff;
+ border-bottom: #E5E5E5 solid 1px;
+}
+#acf-upgrade-notice .inner {
+ padding: 20px;
+}
+#acf-upgrade-notice .logo {
+ position: relative;
+ float: left;
+}
+#acf-upgrade-notice .content {
+ margin-left: 170px;
+ max-width: 710px;
+}
+#acf-upgrade-notice p {
+ font-size: 14px;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* Welcome
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-wrap h1 {
+ margin-top: 0;
+ padding-top: 20px;
+}
+.acf-wrap .about-text {
+ margin-top: 0.5em;
+ min-height: 50px;
+}
+.acf-wrap .about-headline-callout {
+ font-size: 2.4em;
+ font-weight: 300;
+ line-height: 1.3;
+ margin: 1.1em 0 0.2em;
+ text-align: center;
+}
+.acf-wrap .feature-section {
+ margin-top: 40px;
+ padding-bottom: 20px;
+}
+.acf-three-col img {
+ border: #DDDDDD solid 1px;
+ margin: 0 0 20px;
+}
+.acf-three-col {
+ position: relative;
+ overflow: hidden;
+}
+.acf-three-col > div {
+ float: left;
+ margin: 0 0 15px 5%;
+ position: relative;
+ width: 30%;
+}
+.acf-three-col > div:first-child,
+.acf-three-col > br + div {
+ margin-left: 0;
+ clear: left;
+}
+.acf-three-col > br {
+ display: none;
+}
+.acf-wrap .acf-three-col h3,
+.acf-wrap .acf-three-col h4 {
+ margin-top: 0;
+}
+.acf-wrap .changelog {
+ list-style: disc;
+ padding-left: 15px;
+}
+.acf-wrap .changelog li {
+ margin: 0 0 0.75em;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* acf-hl cols
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-hl[data-cols] {
+ margin-left: -10px;
+ margin-right: -10px;
+}
+.acf-hl[data-cols] > li {
+ padding: 0 10px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+/* sizes */
+.acf-hl[data-cols="2"] > li {
+ width: 50%;
+}
+.acf-hl[data-cols="3"] > li {
+ width: 33.333%;
+}
+.acf-hl[data-cols="4"] > li {
+ width: 25%;
+}
+/* mobile */
+@media screen and (max-width: 782px) {
+ .acf-hl[data-cols] {
+ margin-left: 0;
+ margin-right: 0;
+ margin-top: -10px;
+ }
+ .acf-hl[data-cols] > li {
+ width: 100% !important;
+ padding: 10px 0 0;
+ }
+}
+/*--------------------------------------------------------------------------------------------
+*
+* misc
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-actions {
+ text-align: right;
+ z-index: 1;
+ /* hover */
+ /* rtl */
+}
+.acf-actions a {
+ margin-left: 4px;
+}
+.acf-actions.-hover {
+ position: absolute;
+ display: none;
+ top: 0;
+ right: 0;
+ padding: 5px;
+}
+html[dir="rtl"] .acf-actions a {
+ margin-left: 0;
+ margin-right: 4px;
+}
+html[dir="rtl"] .acf-actions.-hover {
+ right: auto;
+ left: 0;
+}
+/* ul compatibility */
+ul.acf-actions li {
+ float: right;
+ margin-left: 4px;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* Plugins
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-plugin-upgrade-notice {
+ font-weight: normal;
+ color: #fff;
+ background: #d54d21;
+ padding: 1em;
+ margin: 9px 0;
+}
+.acf-plugin-upgrade-notice:before {
+ content: "\f348";
+ display: inline-block;
+ font: 400 18px/1 dashicons;
+ speak: none;
+ margin: 0 8px 0 -2px;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ vertical-align: top;
+}
+.acf-plugin-upgrade-notice h4 {
+ display: none;
+}
+.acf-plugin-upgrade-notice ul,
+.acf-plugin-upgrade-notice li {
+ display: inline;
+ color: inherit;
+ list-style: none;
+}
+.acf-plugin-upgrade-notice li:after {
+ content: '. ';
+ display: inline;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* RTL
+*
+*--------------------------------------------------------------------------------------------*/
+html[dir="rtl"] .acf-fl {
+ float: right;
+}
+html[dir="rtl"] .acf-fr {
+ float: left;
+}
+html[dir="rtl"] .acf-hl > li {
+ float: right;
+}
+html[dir="rtl"] .acf-hl > li.acf-fr {
+ float: left;
+}
+html[dir="rtl"] .acf-icon.logo {
+ left: 0;
+ right: auto;
+}
+html[dir="rtl"] .acf-table thead th {
+ text-align: right;
+ border-right-width: 1px;
+ border-left-width: 0px;
+}
+html[dir="rtl"] .acf-table > tbody > tr > td {
+ text-align: right;
+ border-right-width: 1px;
+ border-left-width: 0px;
+}
+html[dir="rtl"] .acf-table > thead > tr > th:first-child,
+html[dir="rtl"] .acf-table > tbody > tr > td:first-child {
+ border-right-width: 0;
+}
+html[dir="rtl"] .acf-table > tbody > tr > td.order + td {
+ border-right-color: #e1e1e1;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* acf-postbox-columns
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-postbox-columns {
+ position: relative;
+ margin-top: -11px;
+ margin-bottom: -11px;
+ margin-left: -12px;
+ margin-right: 268px;
+}
+.acf-postbox-columns:after {
+ clear: both;
+ content: "";
+ display: table;
+}
+.acf-postbox-columns .acf-postbox-main,
+.acf-postbox-columns .acf-postbox-side {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ padding: 0 12px 12px;
+}
+.acf-postbox-columns .acf-postbox-main {
+ float: left;
+ width: 100%;
+}
+.acf-postbox-columns .acf-postbox-side {
+ float: right;
+ width: 280px;
+ margin-right: -280px;
+}
+.acf-postbox-columns .acf-postbox-side:before {
+ content: "";
+ display: block;
+ position: absolute;
+ width: 1px;
+ height: 100%;
+ top: 0;
+ right: 0;
+ background: #ebebeb;
+}
+/* mobile */
+@media only screen and (max-width: 850px) {
+ .acf-postbox-columns {
+ margin: 0;
+ }
+ .acf-postbox-columns .acf-postbox-main,
+ .acf-postbox-columns .acf-postbox-side {
+ float: none;
+ width: auto;
+ margin: 0;
+ padding: 0;
+ }
+ .acf-postbox-columns .acf-postbox-side {
+ margin-top: 1em;
+ }
+ .acf-postbox-columns .acf-postbox-side:before {
+ display: none;
+ }
+}
+/*---------------------------------------------------------------------------------------------
+*
+* acf-panel
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-panel {
+ margin-top: -1px;
+ border-top: 1px solid #e2e4e7;
+ border-bottom: 1px solid #e2e4e7;
+ /* open */
+ /* inside postbox */
+ /* fields */
+}
+.acf-panel .acf-panel-title {
+ margin: 0;
+ padding: 12px;
+ font-weight: bold;
+ cursor: pointer;
+ font-size: inherit;
+}
+.acf-panel .acf-panel-title i {
+ float: right;
+}
+.acf-panel .acf-panel-inside {
+ margin: 0;
+ padding: 0 12px 12px;
+ display: none;
+}
+.acf-panel.-open .acf-panel-inside {
+ display: block;
+}
+.postbox .acf-panel {
+ margin-left: -12px;
+ margin-right: -12px;
+}
+.acf-panel .acf-field {
+ margin: 20px 0 0;
+}
+.acf-panel .acf-field .acf-label label {
+ color: #555d66;
+ font-weight: normal;
+}
+.acf-panel .acf-field:first-child {
+ margin-top: 0;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Admin Tools
+*
+*---------------------------------------------------------------------------------------------*/
+#acf-admin-tools .notice {
+ margin-top: 10px;
+}
+.acf-meta-box-wrap {
+ margin-top: 10px;
+ /* acf-fields */
+}
+.acf-meta-box-wrap .postbox {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+.acf-meta-box-wrap .postbox .inside {
+ margin-bottom: 0;
+}
+.acf-meta-box-wrap .postbox .hndle {
+ font-size: 14px;
+ padding: 8px 12px;
+ margin: 0;
+ line-height: 1.4;
+}
+.acf-meta-box-wrap .postbox .handlediv {
+ display: none;
+}
+.acf-meta-box-wrap .acf-fields {
+ border: #ebebeb solid 1px;
+ background: #fafafa;
+ border-radius: 3px;
+}
+/* grid */
+.acf-meta-box-wrap.-grid {
+ margin-left: 8px;
+ margin-right: 8px;
+}
+.acf-meta-box-wrap.-grid .postbox {
+ float: left;
+ clear: left;
+ width: 50%;
+ margin: 0 0 16px;
+}
+.acf-meta-box-wrap.-grid .postbox:nth-child(odd) {
+ margin-left: -8px;
+}
+.acf-meta-box-wrap.-grid .postbox:nth-child(even) {
+ float: right;
+ clear: right;
+ margin-right: -8px;
+}
+/* mobile */
+@media only screen and (max-width: 850px) {
+ .acf-meta-box-wrap.-grid {
+ margin-left: 0;
+ margin-right: 0;
+ }
+ .acf-meta-box-wrap.-grid .postbox {
+ margin-left: 0 !important;
+ margin-right: 0 !important;
+ width: 100%;
+ }
+}
+/* export tool */
+#acf-admin-tool-export {
+ /* panel: selection */
+}
+#acf-admin-tool-export p {
+ max-width: 800px;
+}
+#acf-admin-tool-export ul {
+ column-width: 200px;
+}
+#acf-admin-tool-export .acf-postbox-side .button {
+ margin: 0;
+ width: 100%;
+}
+#acf-admin-tool-export textarea {
+ display: block;
+ width: 100%;
+ min-height: 500px;
+ background: #fafafa;
+ box-shadow: none;
+ padding: 7px;
+ border-radius: 3px;
+}
+#acf-admin-tool-export .acf-panel-selection .acf-label {
+ display: none;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Retina
+*
+*---------------------------------------------------------------------------------------------*/
+@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) {
+ [class^="acf-sprite-"],
+ [class*=" acf-sprite-"] {
+ background-image: url(../images/sprite@2x.png);
+ background-size: 250px 250px;
+ }
+ .acf-loading,
+ .acf-spinner {
+ background-image: url(../images/spinner@2x.gif);
+ background-size: 20px 20px;
+ }
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Device
+*
+*---------------------------------------------------------------------------------------------*/
+@media only screen and (max-width: 850px) {
+ .acf-columns-2 {
+ margin-right: 0;
+ }
+ .acf-columns-2 .acf-column-1,
+ .acf-columns-2 .acf-column-2 {
+ float: none;
+ width: auto;
+ margin: 0;
+ }
+}
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/css/acf-input.css b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/css/acf-input.css
new file mode 100644
index 0000000..3e80685
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/css/acf-input.css
@@ -0,0 +1,2661 @@
+/*--------------------------------------------------------------------------------------------
+*
+* Vars
+*
+*--------------------------------------------------------------------------------------------*/
+/* colors */
+/* acf-field */
+/* responsive */
+/*--------------------------------------------------------------------------------------------
+*
+* Mixins
+*
+*--------------------------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------------------------
+*
+* acf-field
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-field,
+.acf-field .acf-label,
+.acf-field .acf-input {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ position: relative;
+}
+.acf-field {
+ margin: 15px 0;
+ clear: both;
+}
+.acf-field p.description {
+ display: block;
+ margin: 0;
+ padding: 0;
+}
+.acf-field .acf-label {
+ vertical-align: top;
+ margin: 0 0 10px;
+}
+.acf-field .acf-label label {
+ display: block;
+ font-weight: bold;
+ margin: 0 0 3px;
+ padding: 0;
+}
+.acf-field .acf-label:empty {
+ margin-bottom: 0;
+}
+.acf-field .acf-input {
+ vertical-align: top;
+}
+.acf-field .acf-input > p.description {
+ margin-top: 5px;
+}
+.acf-field .acf-error-message {
+ background: #F55E4F;
+ color: #fff;
+ margin: 0 0 10px;
+ display: inline-block;
+ border-radius: 3px;
+ border-left: none;
+}
+.acf-field .acf-error-message:after {
+ content: "";
+ display: block;
+ width: 0;
+ height: 0;
+ border: transparent 5px solid;
+ border-top-color: #F55E4F;
+ position: absolute;
+ bottom: -10px;
+ left: 10px;
+}
+.acf-fieldtd,
+.acf-fieldtr {
+ margin: 0;
+}
+.acf-field[data-width] {
+ float: left;
+ clear: none;
+ /*
+ @media screen and (max-width: @sm) {
+ float: none;
+ width: auto;
+ border-left-width: 0;
+ border-right-width: 0;
+ }
+*/
+}
+.acf-field[data-width] + .acf-field[data-width] {
+ border-left: 1px solid #eeeeee;
+}
+html[dir="rtl"] .acf-field[data-width] {
+ float: right;
+}
+html[dir="rtl"] .acf-field[data-width] + .acf-field[data-width] {
+ border-left: none;
+ border-right: 1px solid #eeeeee;
+}
+.acf-field[data-width]td,
+.acf-field[data-width]tr {
+ float: none;
+}
+.acf-field.-c0 {
+ clear: both;
+ border-left-width: 0 !important;
+}
+html[dir="rtl"] .acf-field.-c0 {
+ border-left-width: 1px !important;
+ border-right-width: 0 !important;
+}
+.acf-field.-r0 {
+ border-top-width: 0 !important;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* acf-fields
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-fields {
+ position: relative;
+}
+.acf-fields:after {
+ clear: both;
+ content: "";
+ display: table;
+}
+.acf-fields.-border {
+ border: #dfdfdf solid 1px;
+ background: #fff;
+}
+.acf-fields > .acf-field {
+ position: relative;
+ margin: 0;
+ padding: 15px 12px;
+ border-top: #EEEEEE solid 1px;
+}
+.acf-fields > .acf-field:first-child {
+ border-top-width: 0;
+}
+td.acf-fields {
+ padding: 0 !important;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* acf-fields (clear)
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-fields.-clear > .acf-field {
+ border: none;
+ padding: 0;
+ margin: 15px 0;
+}
+.acf-fields.-clear > .acf-field[data-width] {
+ border: none !important;
+}
+.acf-fields.-clear > .acf-field > .acf-label {
+ padding: 0;
+}
+.acf-fields.-clear > .acf-field > .acf-input {
+ padding: 0;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* acf-fields (left)
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-fields.-left > .acf-field {
+ padding: 15px 0;
+}
+.acf-fields.-left > .acf-field:after {
+ clear: both;
+ content: "";
+ display: table;
+}
+.acf-fields.-left > .acf-field:before {
+ content: "";
+ display: block;
+ position: absolute;
+ z-index: 0;
+ background: #F9F9F9;
+ border-color: #E1E1E1;
+ border-style: solid;
+ border-width: 0 1px 0 0;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ width: 20%;
+}
+.acf-fields.-left > .acf-field[data-width] {
+ float: none;
+ width: auto !important;
+ border-left-width: 0 !important;
+ border-right-width: 0 !important;
+}
+.acf-fields.-left > .acf-field > .acf-label {
+ float: left;
+ width: 20%;
+ margin: 0;
+ padding: 0 12px;
+}
+.acf-fields.-left > .acf-field > .acf-input {
+ float: left;
+ width: 80%;
+ margin: 0;
+ padding: 0 12px;
+}
+html[dir="rtl"] .acf-fields.-left > .acf-field:before {
+ border-width: 0 0 0 1px;
+ left: auto;
+ right: 0;
+}
+html[dir="rtl"] .acf-fields.-left > .acf-field > .acf-label {
+ float: right;
+}
+html[dir="rtl"] .acf-fields.-left > .acf-field > .acf-input {
+ float: right;
+}
+@media screen and (max-width: 782px) {
+ .acf-fields.-left > .acf-field:before {
+ display: none;
+ }
+ .acf-fields.-left > .acf-field > .acf-label {
+ width: 100%;
+ margin-bottom: 10px;
+ }
+ .acf-fields.-left > .acf-field > .acf-input {
+ width: 100%;
+ }
+}
+/* clear + left */
+.acf-fields.-clear.-left > .acf-field {
+ padding: 0;
+ border: none;
+}
+.acf-fields.-clear.-left > .acf-field:before {
+ display: none;
+}
+.acf-fields.-clear.-left > .acf-field > .acf-label {
+ padding: 0;
+}
+.acf-fields.-clear.-left > .acf-field > .acf-input {
+ padding: 0;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* acf-table
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-table tr.acf-field > td.acf-label {
+ padding: 15px 12px;
+ margin: 0;
+ background: #F9F9F9;
+ width: 20%;
+}
+.acf-table tr.acf-field > td.acf-input {
+ padding: 15px 12px;
+ margin: 0;
+ border-left-color: #E1E1E1;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* acf-postbox
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-postbox {
+ position: relative;
+ /* position high */
+ /* inside */
+ /* hndle */
+}
+#acf_after_title-sortables .acf-postbox {
+ margin: 20px 0 0;
+}
+.acf-postbox > .inside {
+ margin: 0 !important;
+ /* override WP style - do not delete - you have tried this before */
+ padding: 0 !important;
+ /* override WP style - do not delete - you have tried this before */
+}
+.acf-postbox > .hndle {
+ /* edit field group */
+}
+.acf-postbox > .hndle .acf-hndle-cog {
+ color: #AAAAAA;
+ font-size: 16px;
+ line-height: 20px;
+ padding: 0 2px;
+ float: right;
+ position: relative;
+ display: none;
+}
+.acf-postbox > .hndle .acf-hndle-cog:hover {
+ color: #777777;
+}
+.acf-postbox > .hndle:hover .acf-hndle-cog,
+.acf-postbox > .hndle.hover .acf-hndle-cog {
+ display: block;
+}
+.acf-postbox .acf-replace-with-fields {
+ padding: 15px;
+ text-align: center;
+}
+/* seamless */
+.acf-postbox.seamless {
+ border: 0 none;
+ background: transparent;
+ box-shadow: none;
+ /* hide hndle */
+ /* inside */
+}
+.acf-postbox.seamless > .hndle,
+.acf-postbox.seamless > .handlediv {
+ display: none;
+}
+.acf-postbox.seamless > .inside {
+ display: block !important;
+ /* stop metabox from hiding when closed */
+ margin-left: -12px !important;
+ margin-right: -12px !important;
+}
+.acf-postbox.seamless > .inside > .acf-field {
+ border-color: transparent;
+}
+/* seamless (left) */
+.acf-postbox.seamless > .acf-fields.-left {
+ /* hide sidebar bg */
+ /* mobile */
+}
+.acf-postbox.seamless > .acf-fields.-left > .acf-field:before {
+ display: none;
+}
+@media screen and (max-width: 782px) {
+ .acf-postbox.seamless > .acf-fields.-left {
+ /* remove padding */
+ }
+ .acf-postbox.seamless > .acf-fields.-left > .acf-field > .acf-label,
+ .acf-postbox.seamless > .acf-fields.-left > .acf-field > .acf-input {
+ padding: 0;
+ }
+}
+/* override WP CSS */
+.metabox-prefs label.acf-hidden {
+ display: none;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Inputs
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-field input[type="text"],
+.acf-field input[type="password"],
+.acf-field input[type="number"],
+.acf-field input[type="search"],
+.acf-field input[type="email"],
+.acf-field input[type="url"],
+.acf-field textarea,
+.acf-field select {
+ width: 100%;
+ padding: 3px 5px;
+ resize: none;
+ margin: 0;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ font-size: 14px;
+ line-height: 1.4;
+}
+.acf-field input[type="text"]:disabled,
+.acf-field input[type="password"]:disabled,
+.acf-field input[type="number"]:disabled,
+.acf-field input[type="search"]:disabled,
+.acf-field input[type="email"]:disabled,
+.acf-field input[type="url"]:disabled,
+.acf-field textarea:disabled,
+.acf-field select:disabled {
+ background: #f8f8f8;
+}
+.acf-field input[type="text"][readonly],
+.acf-field input[type="password"][readonly],
+.acf-field input[type="number"][readonly],
+.acf-field input[type="search"][readonly],
+.acf-field input[type="email"][readonly],
+.acf-field input[type="url"][readonly],
+.acf-field textarea[readonly],
+.acf-field select[readonly] {
+ background: #f8f8f8;
+}
+.acf-field textarea {
+ resize: vertical;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Text
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-input-prepend,
+.acf-input-append {
+ font-size: 13px;
+ line-height: 20px;
+ height: 20px;
+ padding: 3px 7px;
+ background: #F4F4F4;
+ border: #DFDFDF solid 1px;
+}
+.acf-input-prepend {
+ float: left;
+ border-right-width: 0;
+ border-radius: 3px 0 0 3px;
+}
+.acf-input-append {
+ float: right;
+ border-left-width: 0;
+ border-radius: 0 3px 3px 0;
+}
+.acf-input-wrap {
+ position: relative;
+ overflow: hidden;
+}
+.acf-input-wrap input {
+ height: 28px;
+ margin: 0;
+}
+input.acf-is-prepended {
+ border-radius: 0 3px 3px 0 !important;
+}
+input.acf-is-appended {
+ border-radius: 3px 0 0 3px !important;
+}
+input.acf-is-prepended.acf-is-appended {
+ border-radius: 0 !important;
+}
+/* rtl */
+html[dir="rtl"] .acf-input-prepend {
+ border-left-width: 0;
+ border-right-width: 1px;
+ border-radius: 0 3px 3px 0;
+ float: right;
+}
+html[dir="rtl"] .acf-input-append {
+ border-left-width: 1px;
+ border-right-width: 0;
+ border-radius: 3px 0 0 3px;
+ float: left;
+}
+html[dir="rtl"] input.acf-is-prepended {
+ border-radius: 3px 0 0 3px !important;
+}
+html[dir="rtl"] input.acf-is-appended {
+ border-radius: 0 3px 3px 0 !important;
+}
+html[dir="rtl"] input.acf-is-prepended.acf-is-appended {
+ border-radius: 0 !important;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Color Picker
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-color-picker .wp-picker-active {
+ position: relative;
+ z-index: 1;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Url
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-url i {
+ position: absolute;
+ top: 4px;
+ left: 4px;
+ opacity: 0.5;
+ color: #A9A9A9;
+}
+.acf-url input[type="url"] {
+ padding-left: 25px;
+}
+.acf-url.-valid i {
+ opacity: 1;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Select
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-field select {
+ padding: 2px;
+}
+.acf-field select optgroup {
+ padding: 5px;
+ background: #fff;
+}
+.acf-field select option {
+ padding: 3px;
+}
+.acf-field select optgroup option {
+ padding-left: 5px;
+}
+.acf-field select optgroup:nth-child(2n) {
+ background: #F9F9F9;
+}
+.acf-field .select2-input {
+ max-width: 200px;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Select2 (v3)
+*
+*---------------------------------------------------------------------------------------------*/
+.select2-container.-acf {
+ /* open */
+ /* single open */
+}
+.select2-container.-acf .select2-choices {
+ background: #fff;
+ border-color: #ddd;
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07) inset;
+ min-height: 31px;
+}
+.select2-container.-acf .select2-choices .select2-search-choice {
+ margin: 5px 0 5px 5px;
+ padding: 3px 5px 3px 18px;
+ border-color: #bbb;
+ background: #f9f9f9;
+ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset;
+ /* sortable item*/
+ /* sortable shadow */
+}
+.select2-container.-acf .select2-choices .select2-search-choice.ui-sortable-helper {
+ background: #5897fb;
+ border-color: #3f87fa;
+ color: #fff;
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
+}
+.select2-container.-acf .select2-choices .select2-search-choice.ui-sortable-helper a {
+ visibility: hidden;
+}
+.select2-container.-acf .select2-choices .select2-search-choice.ui-sortable-placeholder {
+ background-color: #f7f7f7;
+ border-color: #f7f7f7;
+ visibility: visible !important;
+}
+.select2-container.-acf .select2-choices .select2-search-choice-focus {
+ border-color: #999;
+}
+.select2-container.-acf .select2-choices .select2-search-field input {
+ height: 31px;
+ line-height: 22px;
+ margin: 0;
+ padding: 5px 5px 5px 7px;
+}
+.select2-container.-acf .select2-choice {
+ border-color: #BBBBBB;
+}
+.select2-container.-acf .select2-choice .select2-arrow {
+ background: transparent;
+ border-left-color: #DFDFDF;
+ padding-left: 1px;
+}
+.select2-container.-acf .select2-choice .select2-result-description {
+ display: none;
+}
+.select2-container.-acf.select2-container-active .select2-choices,
+.select2-container.-acf.select2-dropdown-open .select2-choices {
+ border-color: #5B9DD9;
+ border-radius: 3px 3px 0 0;
+}
+.select2-container.-acf.select2-dropdown-open .select2-choice {
+ background: #fff;
+ border-color: #5B9DD9;
+}
+/* rtl */
+html[dir="rtl"] .select2-container.-acf .select2-search-choice-close {
+ left: 24px;
+}
+html[dir="rtl"] .select2-container.-acf .select2-choice > .select2-chosen {
+ margin-left: 42px;
+}
+html[dir="rtl"] .select2-container.-acf .select2-choice .select2-arrow {
+ padding-left: 0;
+ padding-right: 1px;
+}
+/* description */
+.select2-drop {
+ /* search*/
+ /* result */
+}
+.select2-drop .select2-search {
+ padding: 4px 4px 0;
+}
+.select2-drop .select2-result {
+ /* hover*/
+}
+.select2-drop .select2-result .select2-result-description {
+ color: #999;
+ font-size: 12px;
+ margin-left: 5px;
+}
+.select2-drop .select2-result.select2-highlighted .select2-result-description {
+ color: #fff;
+ opacity: 0.75;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Select2 (v4)
+*
+*---------------------------------------------------------------------------------------------*/
+.select2-container.-acf li {
+ margin-bottom: 0;
+}
+.select2-container--default.-acf .select2-selection--multiple {
+ /* multiple choice item */
+}
+.select2-container--default.-acf .select2-selection--multiple .select2-search--inline:first-child {
+ float: none;
+}
+.select2-container--default.-acf .select2-selection--multiple .select2-search--inline:first-child input {
+ width: 100% !important;
+}
+.select2-container--default.-acf .select2-selection--multiple .select2-selection__choice {
+ background-color: #f7f7f7;
+ border-color: #cccccc;
+ /* sortable item*/
+ /* sortable shadow */
+}
+.select2-container--default.-acf .select2-selection--multiple .select2-selection__choice.ui-sortable-helper {
+ background: #5897fb;
+ border-color: #3f87fa;
+ color: #fff;
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
+}
+.select2-container--default.-acf .select2-selection--multiple .select2-selection__choice.ui-sortable-helper span {
+ visibility: hidden;
+}
+.select2-container--default.-acf .select2-selection--multiple .select2-selection__choice.ui-sortable-placeholder {
+ background-color: #f7f7f7;
+ border-color: #f7f7f7;
+ visibility: visible !important;
+}
+.select2-container .select2-dropdown {
+ z-index: 900000;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Link
+*
+*---------------------------------------------------------------------------------------------*/
+.link-wrap {
+ border: #dddddd solid 1px;
+ border-radius: 3px;
+ padding: 5px;
+ line-height: 26px;
+ background: #fff;
+ word-wrap: break-word;
+ word-break: break-all;
+}
+.link-wrap .link-title {
+ padding: 0 5px;
+}
+.acf-link {
+ /* value */
+ /* external */
+}
+.acf-link .link-wrap,
+.acf-link .acf-icon.-link-ext {
+ display: none;
+}
+.acf-link.-value .button {
+ display: none;
+}
+.acf-link.-value .link-wrap {
+ display: inline-block;
+}
+.acf-link.-external .acf-icon.-link-ext {
+ display: inline-block;
+}
+#wp-link-backdrop {
+ z-index: 900000 !important;
+}
+#wp-link-wrap {
+ z-index: 900001 !important;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Radio
+*
+*---------------------------------------------------------------------------------------------*/
+ul.acf-radio-list,
+ul.acf-checkbox-list {
+ background: transparent;
+ position: relative;
+ padding: 1px;
+ margin: 0;
+ /* hl */
+ /* rtl */
+}
+ul.acf-radio-list li,
+ul.acf-checkbox-list li {
+ font-size: 13px;
+ line-height: 22px;
+ margin: 0;
+ position: relative;
+ word-wrap: break-word;
+ /* attachment sidebar fix*/
+}
+ul.acf-radio-list li label,
+ul.acf-checkbox-list li label {
+ display: inline;
+}
+ul.acf-radio-list li input[type="checkbox"],
+ul.acf-checkbox-list li input[type="checkbox"],
+ul.acf-radio-list li input[type="radio"],
+ul.acf-checkbox-list li input[type="radio"] {
+ margin: -1px 4px 0 0;
+ vertical-align: middle;
+}
+ul.acf-radio-list li input[type="text"],
+ul.acf-checkbox-list li input[type="text"] {
+ width: auto;
+ vertical-align: middle;
+ margin: 2px 0;
+}
+ul.acf-radio-list li span,
+ul.acf-checkbox-list li span {
+ float: none;
+}
+ul.acf-radio-list li i,
+ul.acf-checkbox-list li i {
+ vertical-align: middle;
+}
+ul.acf-radio-list.acf-hl li,
+ul.acf-checkbox-list.acf-hl li {
+ margin-right: 20px;
+ clear: none;
+}
+html[dir="rtl"] ul.acf-radio-list input[type="checkbox"],
+html[dir="rtl"] ul.acf-checkbox-list input[type="checkbox"],
+html[dir="rtl"] ul.acf-radio-list input[type="radio"],
+html[dir="rtl"] ul.acf-checkbox-list input[type="radio"] {
+ margin-left: 4px;
+ margin-right: 0;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Button Group
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-button-group {
+ display: inline-block;
+ /* default (horizontal) */
+ padding-left: 1px;
+ display: inline-flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ /* vertical */
+}
+.acf-button-group label {
+ display: inline-block;
+ border: #ccc solid 1px;
+ position: relative;
+ z-index: 1;
+ padding: 5px 10px;
+ background: #fff;
+}
+.acf-button-group label:hover {
+ border-color: #999999;
+ z-index: 2;
+}
+.acf-button-group label.selected {
+ border-color: #2b9af3;
+ background: #309cf3;
+ color: #fff;
+ z-index: 2;
+}
+.acf-button-group label.selected:hover {
+ background: #48a8f4;
+}
+.acf-button-group input {
+ display: none;
+}
+.acf-button-group label {
+ margin: 0 0 0 -1px;
+ flex: 1;
+ text-align: center;
+ white-space: nowrap;
+}
+.acf-button-group label:first-child {
+ border-radius: 3px 0 0 3px;
+}
+.acf-button-group label:last-child {
+ border-radius: 0 3px 3px 0;
+}
+.acf-button-group label:only-child {
+ border-radius: 3px;
+}
+.acf-button-group.-vertical {
+ padding-left: 0;
+ padding-top: 1px;
+ flex-direction: column;
+}
+.acf-button-group.-vertical label {
+ margin: -1px 0 0 0;
+}
+.acf-button-group.-vertical label:first-child {
+ border-radius: 3px 3px 0 0;
+}
+.acf-button-group.-vertical label:last-child {
+ border-radius: 0 0 3px 3px;
+}
+.acf-button-group.-vertical label:only-child {
+ border-radius: 3px;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Checkbox
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-checkbox-list .button {
+ margin: 10px 0 0;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* True / False
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-switch {
+ display: inline-block;
+ border-radius: 5px;
+ cursor: pointer;
+ position: relative;
+ background: #f8f8f8;
+ height: 30px;
+ vertical-align: middle;
+ border: #ccc solid 1px;
+ -webkit-transition: background 0.25s ease;
+ -moz-transition: background 0.25s ease;
+ -o-transition: background 0.25s ease;
+ transition: background 0.25s ease;
+ /* hover */
+ /* active */
+ /* focus */
+ /* message */
+}
+.acf-switch span {
+ display: inline-block;
+ float: left;
+ text-align: center;
+ font-size: 13px;
+ line-height: 22px;
+ padding: 4px 10px;
+ min-width: 15px;
+}
+.acf-switch span i {
+ vertical-align: middle;
+}
+.acf-switch .acf-switch-on {
+ color: #fff;
+ text-shadow: #1f7db1 0 1px 0;
+}
+.acf-switch .acf-switch-slider {
+ position: absolute;
+ top: 2px;
+ left: 2px;
+ bottom: 2px;
+ right: 50%;
+ z-index: 1;
+ background: #fff;
+ border-radius: 3px;
+ border: #ccc solid 1px;
+ -webkit-transition: all 0.25s ease;
+ -moz-transition: all 0.25s ease;
+ -o-transition: all 0.25s ease;
+ transition: all 0.25s ease;
+ transition-property: left, right;
+}
+.acf-switch:hover .acf-switch-slider {
+ border-color: #b3b3b3;
+}
+.acf-switch.-on {
+ background: #309cf3;
+ border-color: #2b9af3;
+ /* hover */
+}
+.acf-switch.-on .acf-switch-slider {
+ left: 50%;
+ right: 2px;
+ border-color: #0d84e3;
+}
+.acf-switch.-on:hover {
+ background: #48a8f4;
+}
+.acf-switch.-focus .acf-switch-slider {
+ border-color: #5b9dd9;
+ box-shadow: 0 0 2px rgba(30, 140, 190, 0.5);
+}
+.acf-switch.-focus.-on .acf-switch-slider {
+ border-color: #185e85;
+ box-shadow: 0 0 2px #1f7db1;
+}
+.acf-switch + span {
+ margin-left: 6px;
+}
+/* checkbox */
+.acf-switch-input {
+ opacity: 0;
+ position: absolute;
+ margin: 0;
+}
+/* in media modal */
+.compat-item .acf-true-false .message {
+ float: none;
+ padding: 0;
+ vertical-align: middle;
+}
+/*--------------------------------------------------------------------------
+*
+* Google Map
+*
+*-------------------------------------------------------------------------*/
+.acf-google-map {
+ position: relative;
+ border: #DFDFDF solid 1px;
+ background: #fff;
+ /* default is focused */
+ /* -search */
+ /* -value */
+ /* -loading */
+}
+.acf-google-map .title {
+ position: relative;
+ border-bottom: #DFDFDF solid 1px;
+}
+.acf-google-map .title .search {
+ margin: 0;
+ font-size: 14px;
+ line-height: 30px;
+ height: 40px;
+ padding: 5px 10px;
+ border: 0 none;
+ box-shadow: none;
+ border-radius: 0;
+ font-family: inherit;
+ cursor: text;
+}
+.acf-google-map .title .acf-loading {
+ position: absolute;
+ top: 10px;
+ right: 11px;
+ display: none;
+}
+.acf-google-map .title:hover .acf-actions {
+ display: block;
+}
+.acf-google-map .canvas {
+ height: 400px;
+}
+.acf-google-map .title .acf-icon.-location {
+ display: inline-block;
+}
+.acf-google-map .title .acf-icon.-cancel {
+ display: none;
+}
+.acf-google-map .title .acf-icon.-search {
+ display: none;
+}
+.acf-google-map.-search .title .acf-icon.-location {
+ display: none;
+}
+.acf-google-map.-search .title .acf-icon.-cancel {
+ display: inline-block;
+}
+.acf-google-map.-search .title .acf-icon.-search {
+ display: inline-block;
+}
+.acf-google-map.-value .title .search {
+ font-weight: bold;
+}
+.acf-google-map.-value .title .acf-icon.-location {
+ display: none;
+}
+.acf-google-map.-value .title .acf-icon.-cancel {
+ display: inline-block;
+}
+.acf-google-map.-value .title .acf-icon.-search {
+ display: none;
+}
+.acf-google-map.-loading .title a {
+ display: none !important;
+}
+.acf-google-map.-loading .title i {
+ display: inline-block;
+}
+/* autocomplete */
+.pac-container {
+ border-width: 1px 0;
+ box-shadow: none;
+}
+.pac-container:after {
+ display: none;
+}
+.pac-container .pac-item:first-child {
+ border-top: 0 none;
+}
+.pac-container .pac-item {
+ padding: 5px 10px;
+ cursor: pointer;
+}
+html[dir="rtl"] .pac-container .pac-item {
+ text-align: right;
+}
+/*--------------------------------------------------------------------------
+*
+* Relationship
+*
+*-------------------------------------------------------------------------*/
+.acf-relationship {
+ background: #fff;
+ /* filters (top) */
+ /* list */
+ /* selection (bottom) */
+}
+.acf-relationship .filters {
+ border: #DFDFDF solid 1px;
+ background: #fff;
+ /* widths */
+}
+.acf-relationship .filters:after {
+ clear: both;
+ content: "";
+ display: table;
+}
+.acf-relationship .filters .filter {
+ margin: 0;
+ padding: 0;
+ float: left;
+ width: 100%;
+ /* inner padding */
+}
+.acf-relationship .filters .filter span {
+ display: block;
+ padding: 7px 7px 7px 0;
+}
+.acf-relationship .filters .filter:first-child span {
+ padding-left: 7px;
+}
+.acf-relationship .filters .filter input,
+.acf-relationship .filters .filter select {
+ height: 28px;
+ line-height: 28px;
+ padding: 2px;
+ width: 100%;
+ margin: 0;
+ float: none;
+ /* potential fix for media popup? */
+}
+.acf-relationship .filters .filter input:focus,
+.acf-relationship .filters .filter select:focus,
+.acf-relationship .filters .filter input:active,
+.acf-relationship .filters .filter select:active {
+ outline: none;
+ box-shadow: none;
+}
+.acf-relationship .filters .filter input {
+ border-color: transparent;
+ box-shadow: none;
+}
+.acf-relationship .filters.-f2 .filter {
+ width: 50%;
+}
+.acf-relationship .filters.-f3 .filter {
+ width: 25%;
+}
+.acf-relationship .filters.-f3 .filter.-search {
+ width: 50%;
+}
+.acf-relationship .list {
+ margin: 0;
+ padding: 5px;
+ height: 160px;
+ overflow: auto;
+}
+.acf-relationship .list .acf-rel-label,
+.acf-relationship .list .acf-rel-item,
+.acf-relationship .list p {
+ padding: 5px 7px;
+ margin: 0;
+ display: block;
+ position: relative;
+ min-height: 18px;
+}
+.acf-relationship .list .acf-rel-label {
+ font-weight: bold;
+}
+.acf-relationship .list .acf-rel-item {
+ cursor: pointer;
+ /* hover */
+ /* disabled */
+}
+.acf-relationship .list .acf-rel-item b {
+ text-decoration: underline;
+ font-weight: normal;
+}
+.acf-relationship .list .acf-rel-item .thumbnail {
+ background: #e0e0e0;
+ width: 22px;
+ height: 22px;
+ float: left;
+ margin: -2px 5px 0 0;
+}
+.acf-relationship .list .acf-rel-item .thumbnail img {
+ max-width: 22px;
+ max-height: 22px;
+ margin: 0 auto;
+ display: block;
+}
+.acf-relationship .list .acf-rel-item .thumbnail.-icon {
+ background: #fff;
+}
+.acf-relationship .list .acf-rel-item .thumbnail.-icon img {
+ max-height: 20px;
+ margin-top: 1px;
+}
+.acf-relationship .list .acf-rel-item:hover {
+ background: #3875D7;
+ color: #fff;
+}
+.acf-relationship .list .acf-rel-item:hover .thumbnail {
+ background: #a2bfec;
+}
+.acf-relationship .list .acf-rel-item:hover .thumbnail.-icon {
+ background: #fff;
+}
+.acf-relationship .list .acf-rel-item.disabled {
+ opacity: 0.5;
+}
+.acf-relationship .list .acf-rel-item.disabled:hover {
+ background: transparent;
+ color: #333;
+ cursor: default;
+}
+.acf-relationship .list .acf-rel-item.disabled:hover .thumbnail {
+ background: #e0e0e0;
+}
+.acf-relationship .list .acf-rel-item.disabled:hover .thumbnail.-icon {
+ background: #fff;
+}
+.acf-relationship .list ul {
+ padding-bottom: 5px;
+}
+.acf-relationship .list ul .acf-rel-label,
+.acf-relationship .list ul .acf-rel-item,
+.acf-relationship .list ul p {
+ padding-left: 20px;
+}
+.acf-relationship .selection {
+ border: #DFDFDF solid 1px;
+ position: relative;
+ margin-top: -1px;
+ /* choices */
+ /* values */
+}
+.acf-relationship .selection:after {
+ clear: both;
+ content: "";
+ display: table;
+}
+.acf-relationship .selection .values,
+.acf-relationship .selection .choices {
+ width: 50%;
+ background: #fff;
+ float: left;
+}
+.acf-relationship .selection .choices {
+ background: #F9F9F9;
+}
+.acf-relationship .selection .choices .list {
+ border-right: #DFDFDF solid 1px;
+}
+.acf-relationship .selection .values .acf-icon {
+ position: absolute;
+ top: 4px;
+ right: 7px;
+ display: none;
+ /* rtl */
+}
+html[dir="rtl"] .acf-relationship .selection .values .acf-icon {
+ right: auto;
+ left: 7px;
+}
+.acf-relationship .selection .values .acf-rel-item:hover .acf-icon {
+ display: block;
+}
+.acf-relationship .selection .values .acf-rel-item {
+ cursor: move;
+}
+.acf-relationship .selection .values .acf-rel-item b {
+ text-decoration: none;
+}
+/* menu item fix */
+.menu-item .acf-relationship ul {
+ width: auto;
+}
+.menu-item .acf-relationship li {
+ display: block;
+}
+/*--------------------------------------------------------------------------
+*
+* WYSIWYG
+*
+*-------------------------------------------------------------------------*/
+.acf-editor-wrap {
+ /* delay */
+}
+.acf-editor-wrap.delay .acf-editor-toolbar {
+ content: "";
+ display: block;
+ background: #f5f5f5;
+ border-bottom: #dddddd solid 1px;
+ color: #555d66;
+ padding: 10px;
+}
+.acf-editor-wrap.delay textarea {
+ padding: 10px;
+}
+.acf-editor-wrap iframe {
+ min-height: 200px;
+}
+.acf-editor-wrap .wp-editor-container {
+ border: 1px solid #E5E5E5;
+ box-shadow: none;
+}
+#mce_fullscreen_container {
+ z-index: 900000 !important;
+}
+/* WP < 4.1 */
+.acf-editor-wrap .wp-switch-editor {
+ float: left;
+ -moz-box-sizing: content-box;
+ -webkit-box-sizing: content-box;
+ box-sizing: content-box;
+}
+.acf-editor-wrap.tmce-active .wp-editor-area {
+ color: #333 !important;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Tab
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-field-tab {
+ display: none !important;
+}
+.hidden-by-tab {
+ display: none !important;
+}
+.acf-tab-wrap {
+ clear: both;
+ z-index: 1;
+}
+.acf-tab-group {
+ border-bottom: #ccc solid 1px;
+ padding: 10px 10px 0;
+}
+.acf-tab-group li {
+ margin: 0 0.5em 0 0;
+}
+.acf-tab-group li a {
+ padding: 5px 10px;
+ display: block;
+ color: #555;
+ font-size: 14px;
+ font-weight: 600;
+ line-height: 24px;
+ border: #ccc solid 1px;
+ border-bottom: 0 none;
+ text-decoration: none;
+ background: #e5e5e5;
+ transition: none;
+}
+.acf-tab-group li a:hover {
+ background: #FFF;
+}
+.acf-tab-group li a:focus {
+ outline: none;
+ box-shadow: none;
+}
+html[dir="rtl"] .acf-tab-group li {
+ margin: 0 0 0 0.5em;
+}
+.acf-tab-group li.active a {
+ background: #F1F1F1;
+ color: #000;
+ padding-bottom: 6px;
+ margin-bottom: -1px;
+ position: relative;
+ z-index: 1;
+}
+.acf-fields > .acf-tab-wrap {
+ background: #F9F9F9;
+}
+.acf-fields > .acf-tab-wrap .acf-tab-group {
+ position: relative;
+ z-index: 1;
+ margin-bottom: -1px;
+ border-top: #DFDFDF solid 1px;
+ border-bottom: #DFDFDF solid 1px;
+}
+.acf-fields > .acf-tab-wrap .acf-tab-group li a {
+ background: #f1f1f1;
+}
+.acf-fields > .acf-tab-wrap .acf-tab-group li a:hover {
+ background: #FFF;
+}
+.acf-fields > .acf-tab-wrap .acf-tab-group li.active a {
+ background: #FFFFFF;
+}
+.acf-fields > .acf-tab-wrap:first-child .acf-tab-group {
+ border-top: none;
+}
+.acf-fields.-left > .acf-tab-wrap .acf-tab-group {
+ padding-left: 20%;
+ /* mobile */
+ /* rtl */
+}
+@media screen and (max-width: 782px) {
+ .acf-fields.-left > .acf-tab-wrap .acf-tab-group {
+ padding-left: 10px;
+ }
+}
+html[dir="rtl"] .acf-fields.-left > .acf-tab-wrap .acf-tab-group {
+ padding-left: 0;
+ padding-right: 20%;
+ /* mobile */
+}
+@media screen and (max-width: 850px) {
+ html[dir="rtl"] .acf-fields.-left > .acf-tab-wrap .acf-tab-group {
+ padding-right: 10px;
+ }
+}
+.acf-tab-wrap.-left .acf-tab-group {
+ position: absolute;
+ left: 0;
+ width: 20%;
+ border: 0 none;
+ padding: 0 !important;
+ /* important overrides 'left aligned labels' */
+ margin: 1px 0 0;
+}
+.acf-tab-wrap.-left .acf-tab-group li {
+ float: none;
+ margin: -1px 0 0;
+}
+.acf-tab-wrap.-left .acf-tab-group li a {
+ border: 1px solid #ededed;
+ font-size: 13px;
+ line-height: 18px;
+ color: #0073aa;
+ padding: 10px;
+ margin: 0;
+ font-weight: normal;
+ border-width: 1px 0;
+ border-radius: 0;
+ background: transparent;
+}
+.acf-tab-wrap.-left .acf-tab-group li a:hover {
+ color: #00a0d2;
+}
+.acf-tab-wrap.-left .acf-tab-group li.active a {
+ border-color: #DFDFDF;
+ color: #000;
+ margin-right: -1px;
+ background: #fff;
+}
+html[dir="rtl"] .acf-tab-wrap.-left .acf-tab-group {
+ left: auto;
+ right: 0;
+}
+html[dir="rtl"] .acf-tab-wrap.-left .acf-tab-group li.active a {
+ margin-right: 0;
+ margin-left: -1px;
+}
+.acf-field + .acf-tab-wrap.-left:before {
+ content: "";
+ display: block;
+ position: relative;
+ z-index: 1;
+ height: 10px;
+ border-top: #DFDFDF solid 1px;
+ border-bottom: #DFDFDF solid 1px;
+ margin-bottom: -1px;
+}
+.acf-tab-wrap.-left:first-child .acf-tab-group li:first-child a {
+ border-top: none;
+}
+/* sidebar */
+.acf-fields.-sidebar {
+ padding: 0 0 0 20% !important;
+ position: relative;
+ /* before */
+ /* rtl */
+}
+.acf-fields.-sidebar:before {
+ content: "";
+ display: block;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 20%;
+ bottom: 0;
+ border-right: #DFDFDF solid 1px;
+ background: #F9F9F9;
+ z-index: 1;
+}
+html[dir="rtl"] .acf-fields.-sidebar {
+ padding: 0 20% 0 0 !important;
+}
+html[dir="rtl"] .acf-fields.-sidebar:before {
+ border-left: #DFDFDF solid 1px;
+ border-right-width: 0;
+ left: auto;
+ right: 0;
+}
+.acf-fields.-sidebar.-left {
+ padding: 0 0 0 180px !important;
+ /* rtl */
+}
+html[dir="rtl"] .acf-fields.-sidebar.-left {
+ padding: 0 180px 0 0 !important;
+}
+.acf-fields.-sidebar.-left:before {
+ background: #F1F1F1;
+ border-color: #dfdfdf;
+ width: 180px;
+}
+.acf-fields.-sidebar.-left > .acf-tab-wrap.-left .acf-tab-group {
+ width: 180px;
+}
+.acf-fields.-sidebar.-left > .acf-tab-wrap.-left .acf-tab-group li a {
+ border-color: #e4e4e4;
+}
+.acf-fields.-sidebar.-left > .acf-tab-wrap.-left .acf-tab-group li.active a {
+ background: #F9F9F9;
+}
+.acf-fields.-sidebar > .acf-field-tab + .acf-field {
+ border-top: none;
+}
+.acf-fields.-clear > .acf-tab-wrap {
+ background: transparent;
+}
+.acf-fields.-clear > .acf-tab-wrap .acf-tab-group {
+ margin-top: 0;
+ border-top: none;
+ padding-left: 0;
+ padding-right: 0;
+}
+.acf-fields.-clear > .acf-tab-wrap .acf-tab-group li a {
+ background: #e5e5e5;
+}
+.acf-fields.-clear > .acf-tab-wrap .acf-tab-group li a:hover {
+ background: #fff;
+}
+.acf-fields.-clear > .acf-tab-wrap .acf-tab-group li.active a {
+ background: #f1f1f1;
+}
+/* seamless */
+.acf-postbox.seamless > .acf-fields.-sidebar {
+ margin-left: 0 !important;
+}
+.acf-postbox.seamless > .acf-fields.-sidebar:before {
+ background: transparent;
+}
+.acf-postbox.seamless > .acf-fields > .acf-tab-wrap {
+ background: transparent;
+ margin-bottom: 10px;
+ padding-left: 12px;
+ padding-right: 12px;
+}
+.acf-postbox.seamless > .acf-fields > .acf-tab-wrap .acf-tab-group {
+ border-top: 0 none;
+}
+.acf-postbox.seamless > .acf-fields > .acf-tab-wrap .acf-tab-group li a {
+ background: #e5e5e5;
+}
+.acf-postbox.seamless > .acf-fields > .acf-tab-wrap .acf-tab-group li a:hover {
+ background: #fff;
+}
+.acf-postbox.seamless > .acf-fields > .acf-tab-wrap .acf-tab-group li.active a {
+ background: #f1f1f1;
+}
+.acf-postbox.seamless > .acf-fields > .acf-tab-wrap.-left:before {
+ border-top: none;
+ height: auto;
+}
+.acf-postbox.seamless > .acf-fields > .acf-tab-wrap.-left .acf-tab-group {
+ margin-bottom: 0;
+}
+.acf-postbox.seamless > .acf-fields > .acf-tab-wrap.-left .acf-tab-group li a {
+ border-width: 1px 0 1px 1px !important;
+ border-color: #cccccc;
+ background: #e5e5e5;
+}
+.acf-postbox.seamless > .acf-fields > .acf-tab-wrap.-left .acf-tab-group li.active a {
+ background: #f1f1f1;
+}
+.menu-edit .acf-fields.-clear > .acf-tab-wrap .acf-tab-group li a,
+.widget .acf-fields.-clear > .acf-tab-wrap .acf-tab-group li a {
+ background: #f1f1f1;
+}
+.menu-edit .acf-fields.-clear > .acf-tab-wrap .acf-tab-group li a:hover,
+.widget .acf-fields.-clear > .acf-tab-wrap .acf-tab-group li a:hover,
+.menu-edit .acf-fields.-clear > .acf-tab-wrap .acf-tab-group li.active a,
+.widget .acf-fields.-clear > .acf-tab-wrap .acf-tab-group li.active a {
+ background: #fff;
+}
+.compat-item .acf-tab-wrap td {
+ display: block;
+}
+/* within gallery sidebar */
+.acf-gallery-side .acf-tab-wrap {
+ border-top: 0 none !important;
+}
+.acf-gallery-side .acf-tab-wrap .acf-tab-group {
+ margin: 10px 0 !important;
+ padding: 0 !important;
+}
+.acf-gallery-side .acf-tab-group li.active a {
+ background: #F9F9F9 !important;
+}
+/* withing widget */
+.widget .acf-tab-group {
+ border-bottom-color: #e8e8e8;
+}
+.widget .acf-tab-group li a {
+ background: #F1F1F1;
+}
+.widget .acf-tab-group li.active a {
+ background: #fff;
+}
+/* media popup (edit image) */
+.media-modal.acf-expanded .compat-attachment-fields > tbody > tr.acf-tab-wrap .acf-tab-group {
+ padding-left: 23%;
+ border-bottom-color: #DDDDDD;
+}
+/* table */
+.form-table > tbody > tr.acf-tab-wrap .acf-tab-group {
+ padding: 0 5px 0 210px;
+}
+/* rtl */
+html[dir="rtl"] .form-table > tbody > tr.acf-tab-wrap .acf-tab-group {
+ padding: 0 210px 0 5px;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* oembed
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-oembed {
+ position: relative;
+ border: #DFDFDF solid 1px;
+ background: #fff;
+}
+.acf-oembed .title {
+ position: relative;
+ border-bottom: #DFDFDF solid 1px;
+ padding: 5px 10px;
+}
+.acf-oembed .title h4,
+.acf-oembed .title input[type="text"] {
+ margin: 0;
+ font-size: 14px;
+ line-height: 30px;
+ height: 30px;
+ padding: 0;
+ border: 0 none;
+ box-shadow: none;
+ border-radius: 0;
+ font-family: inherit;
+ cursor: text;
+}
+.acf-oembed .title .search {
+ height: auto;
+ border: 0 none;
+}
+.acf-oembed .title .acf-actions {
+ padding: 6px;
+}
+.acf-oembed .title:hover .acf-actions {
+ display: block;
+}
+.acf-oembed .canvas {
+ position: relative;
+ min-height: 250px;
+ background: #F9F9F9;
+}
+.acf-oembed .canvas .canvas-media {
+ position: relative;
+ z-index: 1;
+}
+.acf-oembed .canvas iframe {
+ display: block;
+ margin: 0;
+ padding: 0;
+ width: 100%;
+}
+.acf-oembed .canvas .acf-icon.-picture {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ margin: -21px 0 0 -21px;
+ z-index: 0;
+ height: 42px;
+ width: 42px;
+ font-size: 42px;
+ color: #999;
+}
+.acf-oembed .canvas .canvas-loading {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(255, 255, 255, 0.9);
+ display: none;
+ z-index: 2;
+}
+.acf-oembed .canvas .canvas-loading i {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ margin: -10px 0 0 -10px;
+}
+.acf-oembed .canvas .canvas-error {
+ position: absolute;
+ top: 50%;
+ left: 0%;
+ right: 0%;
+ margin: -9px 0 0 0;
+ text-align: center;
+ display: none;
+}
+.acf-oembed .canvas .canvas-error p {
+ padding: 8px;
+ margin: 0;
+ display: inline;
+}
+.acf-oembed.has-value .canvas {
+ min-height: 0;
+}
+/* states */
+.acf-oembed .title-value {
+ display: none;
+}
+.acf-oembed .title-search {
+ display: block;
+}
+.acf-oembed.has-value .title-value {
+ display: block;
+}
+.acf-oembed.has-value .title-search {
+ display: none;
+}
+.acf-oembed.has-value .canvas .acf-icon {
+ display: none;
+}
+.acf-oembed.is-editing .title-value {
+ display: none;
+}
+.acf-oembed.is-editing .title-search {
+ display: block;
+}
+.acf-oembed.is-loading .canvas-loading {
+ display: block;
+}
+.acf-oembed.is-loading .title .acf-icon {
+ display: none;
+}
+.acf-oembed.has-error .canvas-error {
+ display: block;
+}
+.acf-oembed.has-error .canvas .acf-icon {
+ display: none;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* Image
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-image-uploader {
+ position: relative;
+ /* image wrap*/
+ /* input */
+ /* rtl */
+}
+.acf-image-uploader:after {
+ clear: both;
+ content: "";
+ display: table;
+}
+.acf-image-uploader p {
+ margin: 0;
+}
+.acf-image-uploader .image-wrap {
+ position: relative;
+ float: left;
+ /* hover */
+}
+.acf-image-uploader .image-wrap img {
+ max-width: 100%;
+ width: auto;
+ height: auto;
+ display: block;
+ min-width: 30px;
+ min-height: 30px;
+ background: #f1f1f1;
+ margin: 0;
+ padding: 0;
+ /* svg */
+}
+.acf-image-uploader .image-wrap img[src$=".svg"] {
+ min-height: 100px;
+ min-width: 100px;
+}
+.acf-image-uploader .image-wrap:hover .acf-actions {
+ display: block;
+}
+.acf-image-uploader input.button {
+ width: auto;
+}
+html[dir="rtl"] .acf-image-uploader .image-wrap {
+ float: right;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* File
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-file-uploader {
+ position: relative;
+ /* hover */
+ /* rtl */
+}
+.acf-file-uploader p {
+ margin: 0;
+}
+.acf-file-uploader .file-wrap {
+ border: #DFDFDF solid 1px;
+ min-height: 84px;
+ position: relative;
+ background: #fff;
+}
+.acf-file-uploader .file-icon {
+ position: absolute;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ padding: 10px;
+ background: #F1F1F1;
+ border-right: #E5E5E5 solid 1px;
+}
+.acf-file-uploader .file-icon img {
+ display: block;
+ padding: 0;
+ margin: 0;
+ max-width: 48px;
+}
+.acf-file-uploader .file-info {
+ padding: 10px;
+ margin-left: 69px;
+}
+.acf-file-uploader .file-info p {
+ margin: 0 0 2px;
+ font-size: 13px;
+ line-height: 1.4em;
+ word-break: break-all;
+}
+.acf-file-uploader .file-info a {
+ text-decoration: none;
+}
+.acf-file-uploader:hover .acf-actions {
+ display: block;
+}
+html[dir="rtl"] .acf-file-uploader .file-icon {
+ left: auto;
+ right: 0;
+ border-left: #E5E5E5 solid 1px;
+ border-right: none;
+}
+html[dir="rtl"] .acf-file-uploader .file-info {
+ margin-right: 69px;
+ margin-left: 0;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Date Picker
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-ui-datepicker .ui-datepicker {
+ z-index: 900000 !important;
+}
+.acf-ui-datepicker .ui-datepicker .ui-widget-header a {
+ cursor: pointer;
+ transition: none;
+}
+/* fix highlight state overriding hover / active */
+.acf-ui-datepicker .ui-state-highlight.ui-state-hover {
+ border: 1px solid #98b7e8 !important;
+ background: #98b7e8 !important;
+ font-weight: normal !important;
+ color: #ffffff !important;
+}
+.acf-ui-datepicker .ui-state-highlight.ui-state-active {
+ border: 1px solid #3875d7 !important;
+ background: #3875d7 !important;
+ font-weight: normal !important;
+ color: #ffffff !important;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Separator field
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-field-separator {
+ /* fields */
+}
+.acf-field-separator .acf-label {
+ margin-bottom: 0;
+}
+.acf-field-separator .acf-label label {
+ font-weight: normal;
+}
+.acf-field-separator .acf-input {
+ display: none;
+}
+.acf-fields > .acf-field-separator {
+ background: #f9f9f9;
+ border-bottom: 1px solid #dfdfdf;
+ border-top: 1px solid #dfdfdf;
+ margin-bottom: -1px;
+ z-index: 2;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Taxonomy
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-taxonomy-field {
+ position: relative;
+ /* hover */
+ /* select */
+}
+.acf-taxonomy-field .categorychecklist-holder {
+ border: #DFDFDF solid 1px;
+ border-radius: 3px;
+ max-height: 200px;
+ overflow: auto;
+}
+.acf-taxonomy-field .acf-checkbox-list {
+ margin: 0;
+ padding: 10px;
+}
+.acf-taxonomy-field .acf-checkbox-list ul.children {
+ padding-left: 18px;
+}
+.acf-taxonomy-field:hover .acf-actions {
+ display: block;
+}
+.acf-taxonomy-field[data-type="select"] .acf-actions {
+ padding: 0;
+ margin: -9px;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Range
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-range-wrap {
+ /* rtl */
+}
+.acf-range-wrap .acf-append,
+.acf-range-wrap .acf-prepend {
+ display: inline-block;
+ vertical-align: middle;
+ line-height: 28px;
+ margin: 0 7px 0 0;
+}
+.acf-range-wrap .acf-append {
+ margin: 0 0 0 7px;
+}
+.acf-range-wrap input[type="range"] {
+ display: inline-block;
+ padding: 0;
+ margin: 0;
+ vertical-align: middle;
+ height: 28px;
+}
+.acf-range-wrap input[type="range"]:focus {
+ outline: none;
+}
+.acf-range-wrap input[type="number"] {
+ display: inline-block;
+ min-width: 3em;
+ margin-left: 10px;
+ vertical-align: middle;
+}
+html[dir="rtl"] .acf-range-wrap input[type="number"] {
+ margin-right: 10px;
+ margin-left: 0;
+}
+html[dir="rtl"] .acf-range-wrap .acf-append {
+ margin: 0 7px 0 0;
+}
+html[dir="rtl"] .acf-range-wrap .acf-prepend {
+ margin: 0 0 0 7px;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* acf-accordion
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-accordion {
+ margin: 0;
+ padding: 0;
+ background: #fff;
+ /* title */
+ /* open */
+}
+.acf-accordion .acf-accordion-title {
+ margin: 0;
+ padding: 12px;
+ font-weight: bold;
+ cursor: pointer;
+ font-size: inherit;
+ font-size: 13px;
+ line-height: 1.4em;
+}
+.acf-accordion .acf-accordion-title label {
+ margin: 0;
+ padding: 0;
+ font-size: 13px;
+ line-height: 1.4em;
+}
+.acf-accordion .acf-accordion-title p {
+ font-weight: normal;
+}
+.acf-accordion .acf-accordion-title .acf-accordion-icon {
+ float: right;
+}
+.acf-accordion .acf-accordion-content {
+ margin: 0;
+ padding: 0 12px 12px;
+ display: none;
+}
+.acf-accordion.-open > .acf-accordion-content {
+ display: block;
+}
+/* field specific */
+.acf-field.acf-accordion {
+ padding: 0;
+ border-color: #dfdfdf;
+}
+.acf-field.acf-accordion .acf-accordion-title {
+ padding: 12px !important;
+ float: none !important;
+ width: auto !important;
+}
+.acf-field.acf-accordion .acf-accordion-content {
+ padding: 0;
+ float: none !important;
+ width: auto !important;
+}
+.acf-field.acf-accordion .acf-accordion-content > .acf-fields {
+ border-top: #EEEEEE solid 1px;
+}
+.acf-field.acf-accordion .acf-accordion-content > .acf-fields.-clear {
+ padding: 0 12px 15px;
+}
+/* field specific (left) */
+.acf-fields.-left > .acf-field.acf-accordion {
+ padding: 0 !important;
+}
+.acf-fields.-left > .acf-field.acf-accordion:before {
+ display: none;
+}
+.acf-fields.-left > .acf-field.acf-accordion .acf-accordion-title {
+ width: auto;
+ margin: 0 !important;
+ padding: 12px;
+ float: none !important;
+}
+.acf-fields.-left > .acf-field.acf-accordion .acf-accordion-content {
+ padding: 0 !important;
+}
+/* field specific (clear) */
+.acf-fields.-clear > .acf-field.acf-accordion {
+ border: #cccccc solid 1px;
+ background: transparent;
+}
+.acf-fields.-clear > .acf-field.acf-accordion + .acf-field.acf-accordion {
+ margin-top: -16px;
+}
+/* table */
+tr.acf-field.acf-accordion {
+ background: transparent;
+}
+tr.acf-field.acf-accordion > .acf-input {
+ padding: 0 !important;
+ border: #cccccc solid 1px;
+}
+tr.acf-field.acf-accordion .acf-accordion-content {
+ padding: 0 12px 12px;
+}
+/* #addtag */
+#addtag div.acf-field.error {
+ border: 0 none;
+ padding: 8px 0;
+}
+#addtag > .acf-field.acf-accordion {
+ padding-right: 0;
+ margin-right: 5%;
+}
+#addtag > .acf-field.acf-accordion + p.submit {
+ margin-top: 0;
+}
+/* border */
+tr.acf-accordion {
+ margin: 15px 0 !important;
+}
+tr.acf-accordion + tr.acf-accordion {
+ margin-top: -16px !important;
+}
+/* seamless */
+.acf-postbox.seamless > .acf-fields > .acf-accordion {
+ margin-left: 12px !important;
+ margin-right: 12px !important;
+}
+/* rtl */
+/* menu item */
+/*
+.menu-item-settings > .field-acf > .acf-field.acf-accordion {
+ border: #dfdfdf solid 1px;
+ margin: 10px -13px 10px -11px;
+
+ + .acf-field.acf-accordion {
+ margin-top: -11px;
+ }
+}
+*/
+/* widget */
+.widget .widget-content > .acf-field.acf-accordion {
+ border: #dfdfdf solid 1px;
+ margin-bottom: 10px;
+}
+.widget .widget-content > .acf-field.acf-accordion .acf-accordion-title {
+ margin-bottom: 0;
+}
+.widget .widget-content > .acf-field.acf-accordion + .acf-field.acf-accordion {
+ margin-top: -11px;
+}
+.acf-postbox.seamless > .acf-fields > .acf-field.acf-accordion {
+ border: #e5e5e5 solid 1px;
+}
+.acf-postbox.seamless > .acf-fields > .acf-field.acf-accordion + .acf-field.acf-accordion {
+ margin-top: -1px;
+}
+.media-modal .compat-attachment-fields .acf-field.acf-accordion + .acf-field.acf-accordion {
+ margin-top: -1px;
+}
+.media-modal .compat-attachment-fields .acf-field.acf-accordion > .acf-input {
+ width: 100%;
+}
+.media-modal .compat-attachment-fields .acf-field.acf-accordion .compat-attachment-fields > tbody > tr > td {
+ padding-bottom: 5px;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Attachment Form (single page)
+*
+*---------------------------------------------------------------------------------------------*/
+#post .compat-attachment-fields .compat-field-acf-form-data {
+ display: none;
+}
+#post .compat-attachment-fields,
+#post .compat-attachment-fields > tbody,
+#post .compat-attachment-fields > tbody > tr,
+#post .compat-attachment-fields > tbody > tr > th,
+#post .compat-attachment-fields > tbody > tr > td {
+ display: block;
+}
+#post .compat-attachment-fields > tbody > .acf-field {
+ margin: 15px 0;
+}
+#post .compat-attachment-fields > tbody > .acf-field > .acf-label {
+ margin: 0;
+}
+#post .compat-attachment-fields > tbody > .acf-field > .acf-label label {
+ margin: 0;
+ padding: 0;
+}
+#post .compat-attachment-fields > tbody > .acf-field > .acf-label label p {
+ margin: 0 0 3px !important;
+}
+#post .compat-attachment-fields > tbody > .acf-field > .acf-input {
+ margin: 0;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Media Model
+*
+*---------------------------------------------------------------------------------------------*/
+/* WP sets tables to act as divs. ACF uses tables, so these muct be reset */
+.media-modal .compat-attachment-fields td.acf-input table {
+ display: table;
+ table-layout: auto;
+}
+.media-modal .compat-attachment-fields td.acf-input table tbody {
+ display: table-row-group;
+}
+.media-modal .compat-attachment-fields td.acf-input table tr {
+ display: table-row;
+}
+.media-modal .compat-attachment-fields td.acf-input table td,
+.media-modal .compat-attachment-fields td.acf-input table th {
+ display: table-cell;
+}
+/* field widths floats */
+.media-modal .compat-attachment-fields > tbody > .acf-field {
+ margin: 5px 0;
+}
+.media-modal .compat-attachment-fields > tbody > .acf-field > .acf-label {
+ min-width: 30%;
+ margin: 0;
+ padding: 0;
+ text-align: right;
+ display: block;
+ float: left;
+}
+.media-modal .compat-attachment-fields > tbody > .acf-field > .acf-label > label {
+ padding-top: 6px;
+ margin: 0;
+ color: #666666;
+ font-weight: 400;
+ line-height: 16px;
+}
+.media-modal .compat-attachment-fields > tbody > .acf-field > .acf-input {
+ width: 65%;
+ margin: 0;
+ padding: 0;
+ float: right;
+ display: block;
+}
+.media-modal .compat-attachment-fields > tbody > .acf-field p.description {
+ margin: 0;
+}
+/* restricted selection (copy of WP .upload-errors)*/
+.acf-selection-error {
+ background: #ffebe8;
+ border: 1px solid #c00;
+ border-radius: 3px;
+ padding: 8px;
+ margin: 20px 0 0;
+}
+.acf-selection-error .selection-error-label {
+ background: #CC0000;
+ border-radius: 3px;
+ color: #fff;
+ font-weight: bold;
+ margin-right: 8px;
+ padding: 2px 4px;
+}
+.acf-selection-error .selection-error-message {
+ color: #b44;
+ display: block;
+ padding-top: 8px;
+ word-wrap: break-word;
+ white-space: pre-wrap;
+}
+/* disabled attachment */
+.media-modal .attachment.acf-disabled .thumbnail {
+ opacity: 0.25 !important;
+}
+.media-modal .attachment.acf-disabled .attachment-preview:before {
+ background: rgba(0, 0, 0, 0.15);
+ z-index: 1;
+ position: relative;
+}
+/* misc */
+.media-modal {
+ /* compat-item */
+ /* fix % margin which causes .acf-uploadedTo to drop down below select */
+ /* allow line breaks in upload error */
+ /* fix required span */
+ /* sidebar */
+ /* mobile md */
+}
+.media-modal .compat-field-acf-form-data,
+.media-modal .compat-field-acf-blank {
+ display: none !important;
+}
+.media-modal select.attachment-filters {
+ margin-right: 6px !important;
+ vertical-align: middle;
+}
+.media-modal .acf-uploadedTo {
+ line-height: 28px;
+ height: 28px;
+ display: inline-block;
+ position: relative;
+ margin: 11px 6px 0 0;
+ vertical-align: middle;
+}
+.media-modal .upload-error-message {
+ white-space: pre-wrap;
+}
+.media-modal .acf-required {
+ padding: 0 !important;
+ margin: 0 !important;
+ float: none !important;
+ color: #f00 !important;
+}
+.media-modal .media-sidebar .compat-item {
+ padding-bottom: 20px;
+}
+@media (max-width: 900px) {
+ .media-modal {
+ /* label */
+ /* field */
+ }
+ .media-modal .setting span,
+ .media-modal .compat-attachment-fields > tbody > .acf-field > .acf-label {
+ width: 98%;
+ float: none;
+ text-align: left;
+ min-height: 0;
+ padding: 0;
+ }
+ .media-modal .setting input,
+ .media-modal .setting textarea,
+ .media-modal .compat-attachment-fields > tbody > .acf-field > .acf-input {
+ float: none;
+ height: auto;
+ max-width: none;
+ width: 98%;
+ }
+}
+/*---------------------------------------------------------------------------------------------
+*
+* Media Model (expand details)
+*
+*---------------------------------------------------------------------------------------------*/
+.media-modal .acf-expand-details {
+ float: right;
+ padding: 1px 10px;
+ margin-right: 6px;
+ height: 18px;
+ line-height: 18px;
+ color: #AAAAAA;
+ font-size: 12px;
+}
+.media-modal .acf-expand-details:focus,
+.media-modal .acf-expand-details:active {
+ outline: 0 none;
+ box-shadow: none;
+ color: #AAAAAA;
+}
+.media-modal .acf-expand-details:hover {
+ color: #666666 !important;
+}
+.media-modal .acf-expand-details span {
+ display: block;
+ float: left;
+}
+.media-modal .acf-expand-details .acf-icon {
+ margin: 0 4px 0 0;
+}
+.media-modal .acf-expand-details:hover .acf-icon {
+ border-color: #AAAAAA;
+}
+.media-modal .acf-expand-details .is-open {
+ display: none;
+}
+.media-modal .acf-expand-details .is-closed {
+ display: block;
+}
+/* expanded */
+.media-modal.acf-expanded {
+ /* toggle */
+ /* resize */
+ /* label & fields */
+ /* mobile md */
+}
+.media-modal.acf-expanded .acf-expand-details .is-open {
+ display: block;
+}
+.media-modal.acf-expanded .acf-expand-details .is-closed {
+ display: none;
+}
+.media-modal.acf-expanded .attachments-browser .media-toolbar,
+.media-modal.acf-expanded .attachments-browser .attachments {
+ right: 740px;
+}
+.media-modal.acf-expanded .media-sidebar {
+ width: 708px;
+}
+.media-modal.acf-expanded .media-sidebar {
+ /* label */
+ /* field */
+ /* larger thumbnail */
+}
+.media-modal.acf-expanded .media-sidebar .attachment-info .thumbnail,
+.media-modal.acf-expanded .media-sidebar .setting span,
+.media-modal.acf-expanded .media-sidebar .compat-attachment-fields > tbody > .acf-field > .acf-label {
+ min-width: 20%;
+}
+.media-modal.acf-expanded .media-sidebar .attachment-info .details,
+.media-modal.acf-expanded .media-sidebar .setting input,
+.media-modal.acf-expanded .media-sidebar .setting textarea,
+.media-modal.acf-expanded .media-sidebar .compat-attachment-fields > tbody > .acf-field > .acf-input {
+ min-width: 77%;
+}
+.media-modal.acf-expanded .media-sidebar .setting span {
+ margin-right: 2%;
+}
+.media-modal.acf-expanded .media-sidebar .attachment-info .thumbnail {
+ max-height: none;
+}
+.media-modal.acf-expanded .media-sidebar .attachment-info .thumbnail img {
+ max-width: 100%;
+ max-height: 200px;
+}
+.media-modal.acf-expanded .media-sidebar .attachment-info .details {
+ float: right;
+}
+@media (max-width: 900px) {
+ .media-modal.acf-expanded {
+ /* resize */
+ }
+ .media-modal.acf-expanded .attachments-browser .media-toolbar {
+ display: none;
+ }
+ .media-modal.acf-expanded .attachments {
+ display: none;
+ }
+ .media-modal.acf-expanded .media-sidebar {
+ width: auto;
+ max-width: none !important;
+ }
+ .media-modal.acf-expanded .media-sidebar .attachment-info .thumbnail {
+ min-width: 30%;
+ margin: 0;
+ }
+ .media-modal.acf-expanded .media-sidebar .attachment-info .details {
+ min-width: 67%;
+ }
+}
+/*---------------------------------------------------------------------------------------------
+*
+* ACF Media Model
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-media-modal {
+ /* hide embed settings */
+}
+.acf-media-modal .media-embed .setting.align,
+.acf-media-modal .media-embed .setting.link-to {
+ display: none;
+}
+/*---------------------------------------------------------------------------------------------
+*
+* ACF Media Model (Select Mode)
+*
+*---------------------------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------------------------
+*
+* ACF Media Model (Edit Mode)
+*
+*---------------------------------------------------------------------------------------------*/
+.acf-media-modal.-edit {
+ /* resize modal */
+ left: 15%;
+ right: 15%;
+ top: 100px;
+ bottom: 100px;
+ /* hide elements */
+ /* full width */
+ /* tidy up incorrect distance */
+ /* WP4 */
+ /* title box shadow (to match media grid) */
+ /* sidebar */
+ /* mobile md */
+ /* mobile sm */
+}
+.acf-media-modal.-edit .media-frame-menu,
+.acf-media-modal.-edit .media-frame-router,
+.acf-media-modal.-edit .media-frame-content .attachments,
+.acf-media-modal.-edit .media-frame-content .media-toolbar {
+ display: none;
+}
+.acf-media-modal.-edit .media-frame-title,
+.acf-media-modal.-edit .media-frame-content,
+.acf-media-modal.-edit .media-frame-toolbar,
+.acf-media-modal.-edit .media-sidebar {
+ width: auto;
+ left: 0;
+ right: 0;
+}
+.acf-media-modal.-edit .media-frame-content {
+ top: 56px;
+}
+body.major-4 .acf-media-modal.-edit .media-frame-content {
+ top: 50px;
+}
+.acf-media-modal.-edit .media-frame-title {
+ border-bottom: 1px solid #DFDFDF;
+ box-shadow: 0 4px 4px -4px rgba(0, 0, 0, 0.1);
+}
+.acf-media-modal.-edit .media-sidebar {
+ padding: 0 16px;
+ /* WP details */
+ /* ACF fields */
+ /* WP required message */
+}
+.acf-media-modal.-edit .media-sidebar .attachment-details {
+ overflow: visible;
+ /* hide 'Attachment Details' heading */
+ /* remove overflow */
+ /* move thumbnail */
+}
+.acf-media-modal.-edit .media-sidebar .attachment-details > h3,
+.acf-media-modal.-edit .media-sidebar .attachment-details > h2 {
+ display: none;
+}
+.acf-media-modal.-edit .media-sidebar .attachment-details .attachment-info {
+ background: #fff;
+ border-bottom: #dddddd solid 1px;
+ padding: 16px;
+ margin: 0 -16px 16px;
+}
+.acf-media-modal.-edit .media-sidebar .attachment-details .thumbnail {
+ margin: 0 16px 0 0;
+}
+.acf-media-modal.-edit .media-sidebar .attachment-details .setting {
+ display: block;
+ overflow: hidden;
+ float: none;
+ width: auto;
+ margin: 0 0 5px;
+}
+.acf-media-modal.-edit .media-sidebar .attachment-details .setting span {
+ margin: 0;
+}
+.acf-media-modal.-edit .media-sidebar .compat-attachment-fields > tbody > .acf-field {
+ margin: 0 0 5px;
+}
+.acf-media-modal.-edit .media-sidebar .compat-attachment-fields > tbody > .acf-field p.description {
+ margin-top: 3px;
+}
+.acf-media-modal.-edit .media-sidebar .media-types-required-info {
+ display: none;
+}
+@media (max-width: 900px) {
+ .acf-media-modal.-edit {
+ top: 30px;
+ right: 30px;
+ bottom: 30px;
+ left: 30px;
+ }
+}
+@media (max-width: 640px) {
+ .acf-media-modal.-edit {
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ }
+ .acf-media-modal.-edit .media-sidebar {
+ bottom: 0 !important;
+ }
+}
+/*--------------------------------------------------------------------------------------------
+*
+* User
+*
+*--------------------------------------------------------------------------------------------*/
+.form-table > tbody {
+ /* field */
+ /* tab wrap */
+ /* misc */
+}
+.form-table > tbody > .acf-field {
+ /* label */
+ /* input */
+}
+.form-table > tbody > .acf-field > .acf-label {
+ padding: 20px 10px 20px 0;
+ width: 200px;
+ /* rtl */
+}
+html[dir="rtl"] .form-table > tbody > .acf-field > .acf-label {
+ padding: 20px 0 20px 10px;
+}
+.form-table > tbody > .acf-field > .acf-label label {
+ font-size: 14px;
+ color: #23282d;
+}
+.form-table > tbody > .acf-field > .acf-input {
+ padding: 15px 10px;
+ /* rtl */
+}
+html[dir="rtl"] .form-table > tbody > .acf-field > .acf-input {
+ padding: 15px 10px 15px 5%;
+}
+.form-table > tbody > .acf-tab-wrap td {
+ padding: 15px 5% 15px 0;
+ /* rtl */
+}
+html[dir="rtl"] .form-table > tbody > .acf-tab-wrap td {
+ padding: 15px 0 15px 5%;
+}
+.form-table > tbody .form-table th.acf-th {
+ width: auto;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* Term
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-addterm-fields {
+ padding-right: 5%;
+}
+.acf-addterm-fields > .acf-field > .acf-label {
+ margin: 0;
+}
+.acf-addterm-fields > .acf-field > .acf-label label {
+ font-size: 12px;
+ font-weight: normal;
+}
+p.submit .spinner,
+p.submit .acf-spinner {
+ vertical-align: top;
+ float: none;
+ margin: 4px 4px 0;
+}
+#edittag .acf-fields.-left > .acf-field {
+ padding-left: 220px;
+}
+#edittag .acf-fields.-left > .acf-field:before {
+ width: 209px;
+}
+#edittag .acf-fields.-left > .acf-field > .acf-label {
+ width: 220px;
+ margin-left: -220px;
+ padding: 0 10px;
+}
+#edittag .acf-fields.-left > .acf-field > .acf-input {
+ padding: 0;
+}
+#edittag > .acf-fields.-left {
+ width: 96%;
+}
+#edittag > .acf-fields.-left > .acf-field > .acf-label {
+ padding-left: 0;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* Comment
+*
+*--------------------------------------------------------------------------------------------*/
+.editcomment td:first-child {
+ white-space: nowrap;
+ width: 131px;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* Widget
+*
+*--------------------------------------------------------------------------------------------*/
+#widgets-right .widget .acf-field .description {
+ padding-left: 0;
+ padding-right: 0;
+}
+.acf-widget-fields > .acf-field .acf-label {
+ margin-bottom: 5px;
+}
+.acf-widget-fields > .acf-field .acf-label label {
+ font-weight: normal;
+ margin: 0;
+}
+.widget form > .acf-error-message {
+ margin-top: 15px;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* Nav Menu
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-menu-settings {
+ border-top: 1px solid #eee;
+ margin-top: 2em;
+}
+.acf-menu-settings.-seamless {
+ border-top: none;
+ margin-top: 15px;
+}
+.acf-menu-settings.-seamless > h2 {
+ display: none;
+}
+.acf-menu-item-fields {
+ margin-right: 10px;
+ float: left;
+}
+/*--------------------------------------------------------------------------------------------
+*
+* Confirm remove
+*
+*--------------------------------------------------------------------------------------------*/
+.acf-temp-remove {
+ position: relative;
+ opacity: 1;
+ -webkit-transition: all 0.25s ease;
+ -moz-transition: all 0.25s ease;
+ -o-transition: all 0.25s ease;
+ transition: all 0.25s ease;
+ overflow: hidden;
+ /* overlay prevents hover */
+}
+.acf-temp-remove:after {
+ display: block;
+ content: "";
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 99;
+}
+/*--------------------------------------------------------------------------
+*
+* Conditional Logic
+*
+*-------------------------------------------------------------------------*/
+/* Hide */
+.hidden-by-conditional-logic {
+ display: none !important;
+}
+/* Hide (appear empty) */
+.hidden-by-conditional-logic.appear-empty {
+ display: table-cell !important;
+}
+.hidden-by-conditional-logic.appear-empty .acf-input {
+ display: none !important;
+}
+/*--------------------------------------------------------------------------
+*
+* 3rd Party
+*
+*-------------------------------------------------------------------------*/
+/* Tabify shows hidden postboxes */
+.acf-postbox.acf-hidden {
+ display: none !important;
+}
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/LICENSE.txt b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/LICENSE.txt
new file mode 100644
index 0000000..f92d39c
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/LICENSE.txt
@@ -0,0 +1,48 @@
+Font license info
+
+
+## Entypo
+
+ Copyright (C) 2012 by Daniel Bruce
+
+ Author: Daniel Bruce
+ License: SIL (http://scripts.sil.org/OFL)
+ Homepage: http://www.entypo.com
+
+
+## Typicons
+
+ (c) Stephen Hutchings 2012
+
+ Author: Stephen Hutchings
+ License: SIL (http://scripts.sil.org/OFL)
+ Homepage: http://typicons.com/
+
+
+## Font Awesome
+
+ Copyright (C) 2016 by Dave Gandy
+
+ Author: Dave Gandy
+ License: SIL ()
+ Homepage: http://fortawesome.github.com/Font-Awesome/
+
+
+## Elusive
+
+ Copyright (C) 2013 by Aristeides Stathopoulos
+
+ Author: Aristeides Stathopoulos
+ License: SIL (http://scripts.sil.org/OFL)
+ Homepage: http://aristeides.com/
+
+
+## Modern Pictograms
+
+ Copyright (c) 2012 by John Caserta. All rights reserved.
+
+ Author: John Caserta
+ License: SIL (http://scripts.sil.org/OFL)
+ Homepage: http://thedesignoffice.org/project/modern-pictograms/
+
+
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/README.txt b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/README.txt
new file mode 100644
index 0000000..beaab33
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/README.txt
@@ -0,0 +1,75 @@
+This webfont is generated by http://fontello.com open source project.
+
+
+================================================================================
+Please, note, that you should obey original font licenses, used to make this
+webfont pack. Details available in LICENSE.txt file.
+
+- Usually, it's enough to publish content of LICENSE.txt file somewhere on your
+ site in "About" section.
+
+- If your project is open-source, usually, it will be ok to make LICENSE.txt
+ file publicly available in your repository.
+
+- Fonts, used in Fontello, don't require a clickable link on your site.
+ But any kind of additional authors crediting is welcome.
+================================================================================
+
+
+Comments on archive content
+---------------------------
+
+- /font/* - fonts in different formats
+
+- /css/* - different kinds of css, for all situations. Should be ok with
+ twitter bootstrap. Also, you can skip style and assign icon classes
+ directly to text elements, if you don't mind about IE7.
+
+- demo.html - demo file, to show your webfont content
+
+- LICENSE.txt - license info about source fonts, used to build your one.
+
+- config.json - keeps your settings. You can import it back into fontello
+ anytime, to continue your work
+
+
+Why so many CSS files ?
+-----------------------
+
+Because we like to fit all your needs :)
+
+- basic file, .css - is usually enough, it contains @font-face
+ and character code definitions
+
+- *-ie7.css - if you need IE7 support, but still don't wish to put char codes
+ directly into html
+
+- *-codes.css and *-ie7-codes.css - if you like to use your own @font-face
+ rules, but still wish to benefit from css generation. That can be very
+ convenient for automated asset build systems. When you need to update font -
+ no need to manually edit files, just override old version with archive
+ content. See fontello source code for examples.
+
+- *-embedded.css - basic css file, but with embedded WOFF font, to avoid
+ CORS issues in Firefox and IE9+, when fonts are hosted on the separate domain.
+ We strongly recommend to resolve this issue by `Access-Control-Allow-Origin`
+ server headers. But if you ok with dirty hack - this file is for you. Note,
+ that data url moved to separate @font-face to avoid problems with
+
+
+Copyright (C) 2017 by original authors @ fontello.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/acf.ttf b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/acf.ttf
new file mode 100644
index 0000000..cf96a92
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/acf.ttf differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/acf.woff b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/acf.woff
new file mode 100644
index 0000000..9551539
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/acf.woff differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/acf.woff2 b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/acf.woff2
new file mode 100644
index 0000000..5835f80
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/acf.woff2 differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/config.json b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/config.json
new file mode 100644
index 0000000..874f6cc
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/font/config.json
@@ -0,0 +1,124 @@
+{
+ "name": "acf",
+ "css_prefix_text": "acf-icon-",
+ "css_use_suffix": false,
+ "hinting": true,
+ "units_per_em": 1000,
+ "ascent": 850,
+ "glyphs": [
+ {
+ "uid": "a73c5deb486c8d66249811642e5d719a",
+ "css": "sync",
+ "code": 59401,
+ "src": "fontawesome"
+ },
+ {
+ "uid": "7222571caa5c15f83dcfd447c58d68d9",
+ "css": "search",
+ "code": 59409,
+ "src": "entypo"
+ },
+ {
+ "uid": "14017aae737730faeda4a6fd8fb3a5f0",
+ "css": "check",
+ "code": 59404,
+ "src": "entypo"
+ },
+ {
+ "uid": "c709da589c923ba3c2ad48d9fc563e93",
+ "css": "cancel",
+ "code": 59394,
+ "src": "entypo"
+ },
+ {
+ "uid": "70370693ada58ef0a60fa0984fe8d52a",
+ "css": "plus",
+ "code": 59392,
+ "src": "entypo"
+ },
+ {
+ "uid": "1256e3054823e304d7e452a589cf8bb8",
+ "css": "minus",
+ "code": 59393,
+ "src": "entypo"
+ },
+ {
+ "uid": "a42b598e4298f3319b25a2702a02e7ff",
+ "css": "location",
+ "code": 59396,
+ "src": "entypo"
+ },
+ {
+ "uid": "0a3192de65a73ca1501b073ad601f87d",
+ "css": "arrow-combo",
+ "code": 59406,
+ "src": "entypo"
+ },
+ {
+ "uid": "8704cd847a47b64265b8bb110c8b4d62",
+ "css": "down",
+ "code": 59397,
+ "src": "entypo"
+ },
+ {
+ "uid": "c311c48d79488965b0fab7f9cd12b6b5",
+ "css": "left",
+ "code": 59398,
+ "src": "entypo"
+ },
+ {
+ "uid": "749e7d90a9182938180f1d2d8c33584e",
+ "css": "right",
+ "code": 59399,
+ "src": "entypo"
+ },
+ {
+ "uid": "9c7ff134960bb5a82404e4aeaab366d9",
+ "css": "up",
+ "code": 59400,
+ "src": "entypo"
+ },
+ {
+ "uid": "6a12c2b74456ea21cc984e11dec227a1",
+ "css": "globe",
+ "code": 59402,
+ "src": "entypo"
+ },
+ {
+ "uid": "d10920db2e79c997c5e783279291970c",
+ "css": "dot-3",
+ "code": 59405,
+ "src": "entypo"
+ },
+ {
+ "uid": "1e77a2yvsq3owssduo2lcgsiven57iv5",
+ "css": "pencil",
+ "code": 59395,
+ "src": "typicons"
+ },
+ {
+ "uid": "8ax1xqcbzz1hobyd4i7f0unwib1bztip",
+ "css": "arrow-down",
+ "code": 59407,
+ "src": "modernpics"
+ },
+ {
+ "uid": "6ipws8y9gej6vbloufvhi5qux7rluf64",
+ "css": "arrow-up",
+ "code": 59408,
+ "src": "modernpics"
+ },
+ {
+ "uid": "a1be363d4de9be39857893d4134f6215",
+ "css": "picture",
+ "code": 59403,
+ "src": "elusive"
+ },
+ {
+ "uid": "e15f0d620a7897e2035c18c80142f6d9",
+ "css": "link-ext",
+ "code": 61582,
+ "src": "fontawesome"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/spinner.gif b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/spinner.gif
new file mode 100644
index 0000000..d5df195
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/spinner.gif differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/spinner@2x.gif b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/spinner@2x.gif
new file mode 100644
index 0000000..d0eda93
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/spinner@2x.gif differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/sprite.png b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/sprite.png
new file mode 100644
index 0000000..b017733
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/sprite.png differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/sprite@2x.png b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/sprite@2x.png
new file mode 100644
index 0000000..e5f9102
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/images/sprite@2x.png differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-bg_highlight-soft_0_ffffff_1x100.png b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-bg_highlight-soft_0_ffffff_1x100.png
new file mode 100644
index 0000000..f9fd670
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-bg_highlight-soft_0_ffffff_1x100.png differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-icons_444444_256x240.png b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-icons_444444_256x240.png
new file mode 100644
index 0000000..37c4124
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-icons_444444_256x240.png differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-icons_DDDDDD_256x240.png b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-icons_DDDDDD_256x240.png
new file mode 100644
index 0000000..01d7eb1
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-icons_DDDDDD_256x240.png differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-icons_ffffff_256x240.png b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-icons_ffffff_256x240.png
new file mode 100644
index 0000000..b412563
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/images/ui-icons_ffffff_256x240.png differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/jquery-ui.css b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/jquery-ui.css
new file mode 100644
index 0000000..82b9f73
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/jquery-ui.css
@@ -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: 3;
+}
+.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: 3;
+}
+.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: 3;
+}
+.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: 3;
+}
+
+/* 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;
+}
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/jquery-ui.min.css b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/jquery-ui.min.css
new file mode 100644
index 0000000..41084fa
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/datepicker/jquery-ui.min.css
@@ -0,0 +1,7 @@
+/*! 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 */
+
+.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}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.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}.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}.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}.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:#fff;color:#444}.acf-ui-datepicker .ui-widget-content a{color:#444}.acf-ui-datepicker .ui-widget-header{border:1px solid #fff;background:#fff url("images/ui-bg_highlight-soft_0_ffffff_1x100.png") 50% 50% repeat-x;color:#222;font-weight:bold}.acf-ui-datepicker .ui-widget-header a{color:#222}.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:#444}.acf-ui-datepicker .ui-state-default a,.acf-ui-datepicker .ui-state-default a:link,.acf-ui-datepicker .ui-state-default a:visited{color:#444;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:#fff}.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:#fff;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:#fff}.acf-ui-datepicker .ui-state-active a,.acf-ui-datepicker .ui-state-active a:link,.acf-ui-datepicker .ui-state-active a:visited{color:#fff;text-decoration:none}.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 #aaa;background:#fff;color:#444}.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:#444}.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:#fff}.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:#fff}.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:#fff}.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);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);background-image:none}.acf-ui-datepicker .ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.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")}.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}.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}.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:3}.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:3}.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:3}.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:3}.acf-ui-datepicker .ui-widget-overlay{background:#fff;opacity:.3;filter:Alpha(Opacity=30)}.acf-ui-datepicker .ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px}
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2-spinner.gif b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2-spinner.gif
new file mode 100644
index 0000000..d44cf73
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2-spinner.gif differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.css b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.css
new file mode 100644
index 0000000..2d07a03
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.css
@@ -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;
+ }
+}
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js
new file mode 100644
index 0000000..7590b82
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js
@@ -0,0 +1,3541 @@
+/*
+Copyright 2012 Igor Vaynberg
+
+Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014
+
+This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
+General Public License version 2 (the "GPL License"). You may choose either license to govern your
+use of this software only upon the condition that you accept all of the terms of either the Apache
+License or the GPL License.
+
+You may obtain a copy of the Apache License and the GPL License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+ http://www.gnu.org/licenses/gpl-2.0.html
+
+Unless required by applicable law or agreed to in writing, software distributed under the
+Apache License or the GPL License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied. See the Apache License and the GPL License for
+the specific language governing permissions and limitations under the Apache License and the GPL License.
+*/
+(function ($) {
+ if(typeof $.fn.each2 == "undefined") {
+ $.extend($.fn, {
+ /*
+ * 4-10 times faster .each replacement
+ * use it carefully, as it overrides jQuery context of element on each iteration
+ */
+ each2 : function (c) {
+ var j = $([0]), i = -1, l = this.length;
+ while (
+ ++i < l
+ && (j.context = j[0] = this[i])
+ && c.call(j[0], i, j) !== false //"this"=DOM, i=index, j=jQuery object
+ );
+ return this;
+ }
+ });
+ }
+})(jQuery);
+
+(function ($, undefined) {
+ "use strict";
+ /*global document, window, jQuery, console */
+
+ if (window.Select2 !== undefined) {
+ return;
+ }
+
+ var AbstractSelect2, SingleSelect2, MultiSelect2, nextUid, sizer,
+ lastMousePosition={x:0,y:0}, $document, scrollBarDimensions,
+
+ KEY = {
+ TAB: 9,
+ ENTER: 13,
+ ESC: 27,
+ SPACE: 32,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ SHIFT: 16,
+ CTRL: 17,
+ ALT: 18,
+ PAGE_UP: 33,
+ PAGE_DOWN: 34,
+ HOME: 36,
+ END: 35,
+ BACKSPACE: 8,
+ DELETE: 46,
+ isArrow: function (k) {
+ k = k.which ? k.which : k;
+ switch (k) {
+ case KEY.LEFT:
+ case KEY.RIGHT:
+ case KEY.UP:
+ case KEY.DOWN:
+ return true;
+ }
+ return false;
+ },
+ isControl: function (e) {
+ var k = e.which;
+ switch (k) {
+ case KEY.SHIFT:
+ case KEY.CTRL:
+ case KEY.ALT:
+ return true;
+ }
+
+ if (e.metaKey) return true;
+
+ return false;
+ },
+ isFunctionKey: function (k) {
+ k = k.which ? k.which : k;
+ return k >= 112 && k <= 123;
+ }
+ },
+ MEASURE_SCROLLBAR_TEMPLATE = "
",
+
+ DIACRITICS = {"\u24B6":"A","\uFF21":"A","\u00C0":"A","\u00C1":"A","\u00C2":"A","\u1EA6":"A","\u1EA4":"A","\u1EAA":"A","\u1EA8":"A","\u00C3":"A","\u0100":"A","\u0102":"A","\u1EB0":"A","\u1EAE":"A","\u1EB4":"A","\u1EB2":"A","\u0226":"A","\u01E0":"A","\u00C4":"A","\u01DE":"A","\u1EA2":"A","\u00C5":"A","\u01FA":"A","\u01CD":"A","\u0200":"A","\u0202":"A","\u1EA0":"A","\u1EAC":"A","\u1EB6":"A","\u1E00":"A","\u0104":"A","\u023A":"A","\u2C6F":"A","\uA732":"AA","\u00C6":"AE","\u01FC":"AE","\u01E2":"AE","\uA734":"AO","\uA736":"AU","\uA738":"AV","\uA73A":"AV","\uA73C":"AY","\u24B7":"B","\uFF22":"B","\u1E02":"B","\u1E04":"B","\u1E06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24B8":"C","\uFF23":"C","\u0106":"C","\u0108":"C","\u010A":"C","\u010C":"C","\u00C7":"C","\u1E08":"C","\u0187":"C","\u023B":"C","\uA73E":"C","\u24B9":"D","\uFF24":"D","\u1E0A":"D","\u010E":"D","\u1E0C":"D","\u1E10":"D","\u1E12":"D","\u1E0E":"D","\u0110":"D","\u018B":"D","\u018A":"D","\u0189":"D","\uA779":"D","\u01F1":"DZ","\u01C4":"DZ","\u01F2":"Dz","\u01C5":"Dz","\u24BA":"E","\uFF25":"E","\u00C8":"E","\u00C9":"E","\u00CA":"E","\u1EC0":"E","\u1EBE":"E","\u1EC4":"E","\u1EC2":"E","\u1EBC":"E","\u0112":"E","\u1E14":"E","\u1E16":"E","\u0114":"E","\u0116":"E","\u00CB":"E","\u1EBA":"E","\u011A":"E","\u0204":"E","\u0206":"E","\u1EB8":"E","\u1EC6":"E","\u0228":"E","\u1E1C":"E","\u0118":"E","\u1E18":"E","\u1E1A":"E","\u0190":"E","\u018E":"E","\u24BB":"F","\uFF26":"F","\u1E1E":"F","\u0191":"F","\uA77B":"F","\u24BC":"G","\uFF27":"G","\u01F4":"G","\u011C":"G","\u1E20":"G","\u011E":"G","\u0120":"G","\u01E6":"G","\u0122":"G","\u01E4":"G","\u0193":"G","\uA7A0":"G","\uA77D":"G","\uA77E":"G","\u24BD":"H","\uFF28":"H","\u0124":"H","\u1E22":"H","\u1E26":"H","\u021E":"H","\u1E24":"H","\u1E28":"H","\u1E2A":"H","\u0126":"H","\u2C67":"H","\u2C75":"H","\uA78D":"H","\u24BE":"I","\uFF29":"I","\u00CC":"I","\u00CD":"I","\u00CE":"I","\u0128":"I","\u012A":"I","\u012C":"I","\u0130":"I","\u00CF":"I","\u1E2E":"I","\u1EC8":"I","\u01CF":"I","\u0208":"I","\u020A":"I","\u1ECA":"I","\u012E":"I","\u1E2C":"I","\u0197":"I","\u24BF":"J","\uFF2A":"J","\u0134":"J","\u0248":"J","\u24C0":"K","\uFF2B":"K","\u1E30":"K","\u01E8":"K","\u1E32":"K","\u0136":"K","\u1E34":"K","\u0198":"K","\u2C69":"K","\uA740":"K","\uA742":"K","\uA744":"K","\uA7A2":"K","\u24C1":"L","\uFF2C":"L","\u013F":"L","\u0139":"L","\u013D":"L","\u1E36":"L","\u1E38":"L","\u013B":"L","\u1E3C":"L","\u1E3A":"L","\u0141":"L","\u023D":"L","\u2C62":"L","\u2C60":"L","\uA748":"L","\uA746":"L","\uA780":"L","\u01C7":"LJ","\u01C8":"Lj","\u24C2":"M","\uFF2D":"M","\u1E3E":"M","\u1E40":"M","\u1E42":"M","\u2C6E":"M","\u019C":"M","\u24C3":"N","\uFF2E":"N","\u01F8":"N","\u0143":"N","\u00D1":"N","\u1E44":"N","\u0147":"N","\u1E46":"N","\u0145":"N","\u1E4A":"N","\u1E48":"N","\u0220":"N","\u019D":"N","\uA790":"N","\uA7A4":"N","\u01CA":"NJ","\u01CB":"Nj","\u24C4":"O","\uFF2F":"O","\u00D2":"O","\u00D3":"O","\u00D4":"O","\u1ED2":"O","\u1ED0":"O","\u1ED6":"O","\u1ED4":"O","\u00D5":"O","\u1E4C":"O","\u022C":"O","\u1E4E":"O","\u014C":"O","\u1E50":"O","\u1E52":"O","\u014E":"O","\u022E":"O","\u0230":"O","\u00D6":"O","\u022A":"O","\u1ECE":"O","\u0150":"O","\u01D1":"O","\u020C":"O","\u020E":"O","\u01A0":"O","\u1EDC":"O","\u1EDA":"O","\u1EE0":"O","\u1EDE":"O","\u1EE2":"O","\u1ECC":"O","\u1ED8":"O","\u01EA":"O","\u01EC":"O","\u00D8":"O","\u01FE":"O","\u0186":"O","\u019F":"O","\uA74A":"O","\uA74C":"O","\u01A2":"OI","\uA74E":"OO","\u0222":"OU","\u24C5":"P","\uFF30":"P","\u1E54":"P","\u1E56":"P","\u01A4":"P","\u2C63":"P","\uA750":"P","\uA752":"P","\uA754":"P","\u24C6":"Q","\uFF31":"Q","\uA756":"Q","\uA758":"Q","\u024A":"Q","\u24C7":"R","\uFF32":"R","\u0154":"R","\u1E58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1E5A":"R","\u1E5C":"R","\u0156":"R","\u1E5E":"R","\u024C":"R","\u2C64":"R","\uA75A":"R","\uA7A6":"R","\uA782":"R","\u24C8":"S","\uFF33":"S","\u1E9E":"S","\u015A":"S","\u1E64":"S","\u015C":"S","\u1E60":"S","\u0160":"S","\u1E66":"S","\u1E62":"S","\u1E68":"S","\u0218":"S","\u015E":"S","\u2C7E":"S","\uA7A8":"S","\uA784":"S","\u24C9":"T","\uFF34":"T","\u1E6A":"T","\u0164":"T","\u1E6C":"T","\u021A":"T","\u0162":"T","\u1E70":"T","\u1E6E":"T","\u0166":"T","\u01AC":"T","\u01AE":"T","\u023E":"T","\uA786":"T","\uA728":"TZ","\u24CA":"U","\uFF35":"U","\u00D9":"U","\u00DA":"U","\u00DB":"U","\u0168":"U","\u1E78":"U","\u016A":"U","\u1E7A":"U","\u016C":"U","\u00DC":"U","\u01DB":"U","\u01D7":"U","\u01D5":"U","\u01D9":"U","\u1EE6":"U","\u016E":"U","\u0170":"U","\u01D3":"U","\u0214":"U","\u0216":"U","\u01AF":"U","\u1EEA":"U","\u1EE8":"U","\u1EEE":"U","\u1EEC":"U","\u1EF0":"U","\u1EE4":"U","\u1E72":"U","\u0172":"U","\u1E76":"U","\u1E74":"U","\u0244":"U","\u24CB":"V","\uFF36":"V","\u1E7C":"V","\u1E7E":"V","\u01B2":"V","\uA75E":"V","\u0245":"V","\uA760":"VY","\u24CC":"W","\uFF37":"W","\u1E80":"W","\u1E82":"W","\u0174":"W","\u1E86":"W","\u1E84":"W","\u1E88":"W","\u2C72":"W","\u24CD":"X","\uFF38":"X","\u1E8A":"X","\u1E8C":"X","\u24CE":"Y","\uFF39":"Y","\u1EF2":"Y","\u00DD":"Y","\u0176":"Y","\u1EF8":"Y","\u0232":"Y","\u1E8E":"Y","\u0178":"Y","\u1EF6":"Y","\u1EF4":"Y","\u01B3":"Y","\u024E":"Y","\u1EFE":"Y","\u24CF":"Z","\uFF3A":"Z","\u0179":"Z","\u1E90":"Z","\u017B":"Z","\u017D":"Z","\u1E92":"Z","\u1E94":"Z","\u01B5":"Z","\u0224":"Z","\u2C7F":"Z","\u2C6B":"Z","\uA762":"Z","\u24D0":"a","\uFF41":"a","\u1E9A":"a","\u00E0":"a","\u00E1":"a","\u00E2":"a","\u1EA7":"a","\u1EA5":"a","\u1EAB":"a","\u1EA9":"a","\u00E3":"a","\u0101":"a","\u0103":"a","\u1EB1":"a","\u1EAF":"a","\u1EB5":"a","\u1EB3":"a","\u0227":"a","\u01E1":"a","\u00E4":"a","\u01DF":"a","\u1EA3":"a","\u00E5":"a","\u01FB":"a","\u01CE":"a","\u0201":"a","\u0203":"a","\u1EA1":"a","\u1EAD":"a","\u1EB7":"a","\u1E01":"a","\u0105":"a","\u2C65":"a","\u0250":"a","\uA733":"aa","\u00E6":"ae","\u01FD":"ae","\u01E3":"ae","\uA735":"ao","\uA737":"au","\uA739":"av","\uA73B":"av","\uA73D":"ay","\u24D1":"b","\uFF42":"b","\u1E03":"b","\u1E05":"b","\u1E07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24D2":"c","\uFF43":"c","\u0107":"c","\u0109":"c","\u010B":"c","\u010D":"c","\u00E7":"c","\u1E09":"c","\u0188":"c","\u023C":"c","\uA73F":"c","\u2184":"c","\u24D3":"d","\uFF44":"d","\u1E0B":"d","\u010F":"d","\u1E0D":"d","\u1E11":"d","\u1E13":"d","\u1E0F":"d","\u0111":"d","\u018C":"d","\u0256":"d","\u0257":"d","\uA77A":"d","\u01F3":"dz","\u01C6":"dz","\u24D4":"e","\uFF45":"e","\u00E8":"e","\u00E9":"e","\u00EA":"e","\u1EC1":"e","\u1EBF":"e","\u1EC5":"e","\u1EC3":"e","\u1EBD":"e","\u0113":"e","\u1E15":"e","\u1E17":"e","\u0115":"e","\u0117":"e","\u00EB":"e","\u1EBB":"e","\u011B":"e","\u0205":"e","\u0207":"e","\u1EB9":"e","\u1EC7":"e","\u0229":"e","\u1E1D":"e","\u0119":"e","\u1E19":"e","\u1E1B":"e","\u0247":"e","\u025B":"e","\u01DD":"e","\u24D5":"f","\uFF46":"f","\u1E1F":"f","\u0192":"f","\uA77C":"f","\u24D6":"g","\uFF47":"g","\u01F5":"g","\u011D":"g","\u1E21":"g","\u011F":"g","\u0121":"g","\u01E7":"g","\u0123":"g","\u01E5":"g","\u0260":"g","\uA7A1":"g","\u1D79":"g","\uA77F":"g","\u24D7":"h","\uFF48":"h","\u0125":"h","\u1E23":"h","\u1E27":"h","\u021F":"h","\u1E25":"h","\u1E29":"h","\u1E2B":"h","\u1E96":"h","\u0127":"h","\u2C68":"h","\u2C76":"h","\u0265":"h","\u0195":"hv","\u24D8":"i","\uFF49":"i","\u00EC":"i","\u00ED":"i","\u00EE":"i","\u0129":"i","\u012B":"i","\u012D":"i","\u00EF":"i","\u1E2F":"i","\u1EC9":"i","\u01D0":"i","\u0209":"i","\u020B":"i","\u1ECB":"i","\u012F":"i","\u1E2D":"i","\u0268":"i","\u0131":"i","\u24D9":"j","\uFF4A":"j","\u0135":"j","\u01F0":"j","\u0249":"j","\u24DA":"k","\uFF4B":"k","\u1E31":"k","\u01E9":"k","\u1E33":"k","\u0137":"k","\u1E35":"k","\u0199":"k","\u2C6A":"k","\uA741":"k","\uA743":"k","\uA745":"k","\uA7A3":"k","\u24DB":"l","\uFF4C":"l","\u0140":"l","\u013A":"l","\u013E":"l","\u1E37":"l","\u1E39":"l","\u013C":"l","\u1E3D":"l","\u1E3B":"l","\u017F":"l","\u0142":"l","\u019A":"l","\u026B":"l","\u2C61":"l","\uA749":"l","\uA781":"l","\uA747":"l","\u01C9":"lj","\u24DC":"m","\uFF4D":"m","\u1E3F":"m","\u1E41":"m","\u1E43":"m","\u0271":"m","\u026F":"m","\u24DD":"n","\uFF4E":"n","\u01F9":"n","\u0144":"n","\u00F1":"n","\u1E45":"n","\u0148":"n","\u1E47":"n","\u0146":"n","\u1E4B":"n","\u1E49":"n","\u019E":"n","\u0272":"n","\u0149":"n","\uA791":"n","\uA7A5":"n","\u01CC":"nj","\u24DE":"o","\uFF4F":"o","\u00F2":"o","\u00F3":"o","\u00F4":"o","\u1ED3":"o","\u1ED1":"o","\u1ED7":"o","\u1ED5":"o","\u00F5":"o","\u1E4D":"o","\u022D":"o","\u1E4F":"o","\u014D":"o","\u1E51":"o","\u1E53":"o","\u014F":"o","\u022F":"o","\u0231":"o","\u00F6":"o","\u022B":"o","\u1ECF":"o","\u0151":"o","\u01D2":"o","\u020D":"o","\u020F":"o","\u01A1":"o","\u1EDD":"o","\u1EDB":"o","\u1EE1":"o","\u1EDF":"o","\u1EE3":"o","\u1ECD":"o","\u1ED9":"o","\u01EB":"o","\u01ED":"o","\u00F8":"o","\u01FF":"o","\u0254":"o","\uA74B":"o","\uA74D":"o","\u0275":"o","\u01A3":"oi","\u0223":"ou","\uA74F":"oo","\u24DF":"p","\uFF50":"p","\u1E55":"p","\u1E57":"p","\u01A5":"p","\u1D7D":"p","\uA751":"p","\uA753":"p","\uA755":"p","\u24E0":"q","\uFF51":"q","\u024B":"q","\uA757":"q","\uA759":"q","\u24E1":"r","\uFF52":"r","\u0155":"r","\u1E59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1E5B":"r","\u1E5D":"r","\u0157":"r","\u1E5F":"r","\u024D":"r","\u027D":"r","\uA75B":"r","\uA7A7":"r","\uA783":"r","\u24E2":"s","\uFF53":"s","\u00DF":"s","\u015B":"s","\u1E65":"s","\u015D":"s","\u1E61":"s","\u0161":"s","\u1E67":"s","\u1E63":"s","\u1E69":"s","\u0219":"s","\u015F":"s","\u023F":"s","\uA7A9":"s","\uA785":"s","\u1E9B":"s","\u24E3":"t","\uFF54":"t","\u1E6B":"t","\u1E97":"t","\u0165":"t","\u1E6D":"t","\u021B":"t","\u0163":"t","\u1E71":"t","\u1E6F":"t","\u0167":"t","\u01AD":"t","\u0288":"t","\u2C66":"t","\uA787":"t","\uA729":"tz","\u24E4":"u","\uFF55":"u","\u00F9":"u","\u00FA":"u","\u00FB":"u","\u0169":"u","\u1E79":"u","\u016B":"u","\u1E7B":"u","\u016D":"u","\u00FC":"u","\u01DC":"u","\u01D8":"u","\u01D6":"u","\u01DA":"u","\u1EE7":"u","\u016F":"u","\u0171":"u","\u01D4":"u","\u0215":"u","\u0217":"u","\u01B0":"u","\u1EEB":"u","\u1EE9":"u","\u1EEF":"u","\u1EED":"u","\u1EF1":"u","\u1EE5":"u","\u1E73":"u","\u0173":"u","\u1E77":"u","\u1E75":"u","\u0289":"u","\u24E5":"v","\uFF56":"v","\u1E7D":"v","\u1E7F":"v","\u028B":"v","\uA75F":"v","\u028C":"v","\uA761":"vy","\u24E6":"w","\uFF57":"w","\u1E81":"w","\u1E83":"w","\u0175":"w","\u1E87":"w","\u1E85":"w","\u1E98":"w","\u1E89":"w","\u2C73":"w","\u24E7":"x","\uFF58":"x","\u1E8B":"x","\u1E8D":"x","\u24E8":"y","\uFF59":"y","\u1EF3":"y","\u00FD":"y","\u0177":"y","\u1EF9":"y","\u0233":"y","\u1E8F":"y","\u00FF":"y","\u1EF7":"y","\u1E99":"y","\u1EF5":"y","\u01B4":"y","\u024F":"y","\u1EFF":"y","\u24E9":"z","\uFF5A":"z","\u017A":"z","\u1E91":"z","\u017C":"z","\u017E":"z","\u1E93":"z","\u1E95":"z","\u01B6":"z","\u0225":"z","\u0240":"z","\u2C6C":"z","\uA763":"z","\u0386":"\u0391","\u0388":"\u0395","\u0389":"\u0397","\u038A":"\u0399","\u03AA":"\u0399","\u038C":"\u039F","\u038E":"\u03A5","\u03AB":"\u03A5","\u038F":"\u03A9","\u03AC":"\u03B1","\u03AD":"\u03B5","\u03AE":"\u03B7","\u03AF":"\u03B9","\u03CA":"\u03B9","\u0390":"\u03B9","\u03CC":"\u03BF","\u03CD":"\u03C5","\u03CB":"\u03C5","\u03B0":"\u03C5","\u03C9":"\u03C9","\u03C2":"\u03C3"};
+
+ $document = $(document);
+
+ nextUid=(function() { var counter=1; return function() { return counter++; }; }());
+
+
+ function reinsertElement(element) {
+ var placeholder = $(document.createTextNode(''));
+
+ element.before(placeholder);
+ placeholder.before(element);
+ placeholder.remove();
+ }
+
+ function stripDiacritics(str) {
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
+ function match(a) {
+ return DIACRITICS[a] || a;
+ }
+
+ return str.replace(/[^\u0000-\u007E]/g, match);
+ }
+
+ function indexOf(value, array) {
+ var i = 0, l = array.length;
+ for (; i < l; i = i + 1) {
+ if (equal(value, array[i])) return i;
+ }
+ return -1;
+ }
+
+ function measureScrollbar () {
+ var $template = $( MEASURE_SCROLLBAR_TEMPLATE );
+ $template.appendTo(document.body);
+
+ var dim = {
+ width: $template.width() - $template[0].clientWidth,
+ height: $template.height() - $template[0].clientHeight
+ };
+ $template.remove();
+
+ return dim;
+ }
+
+ /**
+ * Compares equality of a and b
+ * @param a
+ * @param b
+ */
+ function equal(a, b) {
+ if (a === b) return true;
+ if (a === undefined || b === undefined) return false;
+ if (a === null || b === null) return false;
+ // Check whether 'a' or 'b' is a string (primitive or object).
+ // The concatenation of an empty string (+'') converts its argument to a string's primitive.
+ if (a.constructor === String) return a+'' === b+''; // a+'' - in case 'a' is a String object
+ if (b.constructor === String) return b+'' === a+''; // b+'' - in case 'b' is a String object
+ return false;
+ }
+
+ /**
+ * Splits the string into an array of values, transforming each value. An empty array is returned for nulls or empty
+ * strings
+ * @param string
+ * @param separator
+ */
+ function splitVal(string, separator, transform) {
+ var val, i, l;
+ if (string === null || string.length < 1) return [];
+ val = string.split(separator);
+ for (i = 0, l = val.length; i < l; i = i + 1) val[i] = transform(val[i]);
+ return val;
+ }
+
+ function getSideBorderPadding(element) {
+ return element.outerWidth(false) - element.width();
+ }
+
+ function installKeyUpChangeEvent(element) {
+ var key="keyup-change-value";
+ element.on("keydown", function () {
+ if ($.data(element, key) === undefined) {
+ $.data(element, key, element.val());
+ }
+ });
+ element.on("keyup", function () {
+ var val= $.data(element, key);
+ if (val !== undefined && element.val() !== val) {
+ $.removeData(element, key);
+ element.trigger("keyup-change");
+ }
+ });
+ }
+
+
+ /**
+ * filters mouse events so an event is fired only if the mouse moved.
+ *
+ * filters out mouse events that occur when mouse is stationary but
+ * the elements under the pointer are scrolled.
+ */
+ function installFilteredMouseMove(element) {
+ element.on("mousemove", function (e) {
+ var lastpos = lastMousePosition;
+ if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
+ $(e.target).trigger("mousemove-filtered", e);
+ }
+ });
+ }
+
+ /**
+ * Debounces a function. Returns a function that calls the original fn function only if no invocations have been made
+ * within the last quietMillis milliseconds.
+ *
+ * @param quietMillis number of milliseconds to wait before invoking fn
+ * @param fn function to be debounced
+ * @param ctx object to be used as this reference within fn
+ * @return debounced version of fn
+ */
+ function debounce(quietMillis, fn, ctx) {
+ ctx = ctx || undefined;
+ var timeout;
+ return function () {
+ var args = arguments;
+ window.clearTimeout(timeout);
+ timeout = window.setTimeout(function() {
+ fn.apply(ctx, args);
+ }, quietMillis);
+ };
+ }
+
+ function installDebouncedScroll(threshold, element) {
+ var notify = debounce(threshold, function (e) { element.trigger("scroll-debounced", e);});
+ element.on("scroll", function (e) {
+ if (indexOf(e.target, element.get()) >= 0) notify(e);
+ });
+ }
+
+ function focus($el) {
+ if ($el[0] === document.activeElement) return;
+
+ /* set the focus in a 0 timeout - that way the focus is set after the processing
+ of the current event has finished - which seems like the only reliable way
+ to set focus */
+ window.setTimeout(function() {
+ var el=$el[0], pos=$el.val().length, range;
+
+ $el.focus();
+
+ /* make sure el received focus so we do not error out when trying to manipulate the caret.
+ sometimes modals or others listeners may steal it after its set */
+ var isVisible = (el.offsetWidth > 0 || el.offsetHeight > 0);
+ if (isVisible && el === document.activeElement) {
+
+ /* after the focus is set move the caret to the end, necessary when we val()
+ just before setting focus */
+ if(el.setSelectionRange)
+ {
+ el.setSelectionRange(pos, pos);
+ }
+ else if (el.createTextRange) {
+ range = el.createTextRange();
+ range.collapse(false);
+ range.select();
+ }
+ }
+ }, 0);
+ }
+
+ function getCursorInfo(el) {
+ el = $(el)[0];
+ var offset = 0;
+ var length = 0;
+ if ('selectionStart' in el) {
+ offset = el.selectionStart;
+ length = el.selectionEnd - offset;
+ } else if ('selection' in document) {
+ el.focus();
+ var sel = document.selection.createRange();
+ length = document.selection.createRange().text.length;
+ sel.moveStart('character', -el.value.length);
+ offset = sel.text.length - length;
+ }
+ return { offset: offset, length: length };
+ }
+
+ function killEvent(event) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ function killEventImmediately(event) {
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }
+
+ function measureTextWidth(e) {
+ if (!sizer){
+ var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
+ sizer = $(document.createElement("div")).css({
+ position: "absolute",
+ left: "-10000px",
+ top: "-10000px",
+ display: "none",
+ fontSize: style.fontSize,
+ fontFamily: style.fontFamily,
+ fontStyle: style.fontStyle,
+ fontWeight: style.fontWeight,
+ letterSpacing: style.letterSpacing,
+ textTransform: style.textTransform,
+ whiteSpace: "nowrap"
+ });
+ sizer.attr("class","select2-sizer");
+ $(document.body).append(sizer);
+ }
+ sizer.text(e.val());
+ return sizer.width();
+ }
+
+ function syncCssClasses(dest, src, adapter) {
+ var classes, replacements = [], adapted;
+
+ classes = $.trim(dest.attr("class"));
+
+ if (classes) {
+ classes = '' + classes; // for IE which returns object
+
+ $(classes.split(/\s+/)).each2(function() {
+ if (this.indexOf("select2-") === 0) {
+ replacements.push(this);
+ }
+ });
+ }
+
+ classes = $.trim(src.attr("class"));
+
+ if (classes) {
+ classes = '' + classes; // for IE which returns object
+
+ $(classes.split(/\s+/)).each2(function() {
+ if (this.indexOf("select2-") !== 0) {
+ adapted = adapter(this);
+
+ if (adapted) {
+ replacements.push(adapted);
+ }
+ }
+ });
+ }
+
+ dest.attr("class", replacements.join(" "));
+ }
+
+
+ function markMatch(text, term, markup, escapeMarkup) {
+ var match=stripDiacritics(text.toUpperCase()).indexOf(stripDiacritics(term.toUpperCase())),
+ tl=term.length;
+
+ if (match<0) {
+ markup.push(escapeMarkup(text));
+ return;
+ }
+
+ markup.push(escapeMarkup(text.substring(0, match)));
+ markup.push("");
+ markup.push(escapeMarkup(text.substring(match, match + tl)));
+ markup.push(" ");
+ markup.push(escapeMarkup(text.substring(match + tl, text.length)));
+ }
+
+ function defaultEscapeMarkup(markup) {
+ var replace_map = {
+ '\\': '\',
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": ''',
+ "/": '/'
+ };
+
+ return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
+ return replace_map[match];
+ });
+ }
+
+ /**
+ * Produces an ajax-based query function
+ *
+ * @param options object containing configuration parameters
+ * @param options.params parameter map for the transport ajax call, can contain such options as cache, jsonpCallback, etc. see $.ajax
+ * @param options.transport function that will be used to execute the ajax request. must be compatible with parameters supported by $.ajax
+ * @param options.url url for the data
+ * @param options.data a function(searchTerm, pageNumber, context) that should return an object containing query string parameters for the above url.
+ * @param options.dataType request data type: ajax, jsonp, other datatypes supported by jQuery's $.ajax function or the transport function if specified
+ * @param options.quietMillis (optional) milliseconds to wait before making the ajaxRequest, helps debounce the ajax function if invoked too often
+ * @param options.results a function(remoteData, pageNumber, query) that converts data returned form the remote request to the format expected by Select2.
+ * The expected format is an object containing the following keys:
+ * results array of objects that will be used as choices
+ * more (optional) boolean indicating whether there are more results available
+ * Example: {results:[{id:1, text:'Red'},{id:2, text:'Blue'}], more:true}
+ */
+ function ajax(options) {
+ var timeout, // current scheduled but not yet executed request
+ handler = null,
+ quietMillis = options.quietMillis || 100,
+ ajaxUrl = options.url,
+ self = this;
+
+ return function (query) {
+ window.clearTimeout(timeout);
+ timeout = window.setTimeout(function () {
+ var data = options.data, // ajax data function
+ url = ajaxUrl, // ajax url string or function
+ transport = options.transport || $.fn.select2.ajaxDefaults.transport,
+ // deprecated - to be removed in 4.0 - use params instead
+ deprecated = {
+ type: options.type || 'GET', // set type of request (GET or POST)
+ cache: options.cache || false,
+ jsonpCallback: options.jsonpCallback||undefined,
+ dataType: options.dataType||"json"
+ },
+ params = $.extend({}, $.fn.select2.ajaxDefaults.params, deprecated);
+
+ data = data ? data.call(self, query.term, query.page, query.context) : null;
+ url = (typeof url === 'function') ? url.call(self, query.term, query.page, query.context) : url;
+
+ if (handler && typeof handler.abort === "function") { handler.abort(); }
+
+ if (options.params) {
+ if ($.isFunction(options.params)) {
+ $.extend(params, options.params.call(self));
+ } else {
+ $.extend(params, options.params);
+ }
+ }
+
+ $.extend(params, {
+ url: url,
+ dataType: options.dataType,
+ data: data,
+ success: function (data) {
+ // TODO - replace query.page with query so users have access to term, page, etc.
+ // added query as third paramter to keep backwards compatibility
+ var results = options.results(data, query.page, query);
+ query.callback(results);
+ },
+ error: function(jqXHR, textStatus, errorThrown){
+ var results = {
+ hasError: true,
+ jqXHR: jqXHR,
+ textStatus: textStatus,
+ errorThrown: errorThrown
+ };
+
+ query.callback(results);
+ }
+ });
+ handler = transport.call(self, params);
+ }, quietMillis);
+ };
+ }
+
+ /**
+ * Produces a query function that works with a local array
+ *
+ * @param options object containing configuration parameters. The options parameter can either be an array or an
+ * object.
+ *
+ * If the array form is used it is assumed that it contains objects with 'id' and 'text' keys.
+ *
+ * If the object form is used it is assumed that it contains 'data' and 'text' keys. The 'data' key should contain
+ * an array of objects that will be used as choices. These objects must contain at least an 'id' key. The 'text'
+ * key can either be a String in which case it is expected that each element in the 'data' array has a key with the
+ * value of 'text' which will be used to match choices. Alternatively, text can be a function(item) that can extract
+ * the text.
+ */
+ function local(options) {
+ var data = options, // data elements
+ dataText,
+ tmp,
+ text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
+
+ if ($.isArray(data)) {
+ tmp = data;
+ data = { results: tmp };
+ }
+
+ if ($.isFunction(data) === false) {
+ tmp = data;
+ data = function() { return tmp; };
+ }
+
+ var dataItem = data();
+ if (dataItem.text) {
+ text = dataItem.text;
+ // if text is not a function we assume it to be a key name
+ if (!$.isFunction(text)) {
+ dataText = dataItem.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available
+ text = function (item) { return item[dataText]; };
+ }
+ }
+
+ return function (query) {
+ var t = query.term, filtered = { results: [] }, process;
+ if (t === "") {
+ query.callback(data());
+ return;
+ }
+
+ process = function(datum, collection) {
+ var group, attr;
+ datum = datum[0];
+ if (datum.children) {
+ group = {};
+ for (attr in datum) {
+ if (datum.hasOwnProperty(attr)) group[attr]=datum[attr];
+ }
+ group.children=[];
+ $(datum.children).each2(function(i, childDatum) { process(childDatum, group.children); });
+ if (group.children.length || query.matcher(t, text(group), datum)) {
+ collection.push(group);
+ }
+ } else {
+ if (query.matcher(t, text(datum), datum)) {
+ collection.push(datum);
+ }
+ }
+ };
+
+ $(data().results).each2(function(i, datum) { process(datum, filtered.results); });
+ query.callback(filtered);
+ };
+ }
+
+ // TODO javadoc
+ function tags(data) {
+ var isFunc = $.isFunction(data);
+ return function (query) {
+ var t = query.term, filtered = {results: []};
+ var result = isFunc ? data(query) : data;
+ if ($.isArray(result)) {
+ $(result).each(function () {
+ var isObject = this.text !== undefined,
+ text = isObject ? this.text : this;
+ if (t === "" || query.matcher(t, text)) {
+ filtered.results.push(isObject ? this : {id: this, text: this});
+ }
+ });
+ query.callback(filtered);
+ }
+ };
+ }
+
+ /**
+ * Checks if the formatter function should be used.
+ *
+ * Throws an error if it is not a function. Returns true if it should be used,
+ * false if no formatting should be performed.
+ *
+ * @param formatter
+ */
+ function checkFormatter(formatter, formatterName) {
+ if ($.isFunction(formatter)) return true;
+ if (!formatter) return false;
+ if (typeof(formatter) === 'string') return true;
+ throw new Error(formatterName +" must be a string, function, or falsy value");
+ }
+
+ /**
+ * Returns a given value
+ * If given a function, returns its output
+ *
+ * @param val string|function
+ * @param context value of "this" to be passed to function
+ * @returns {*}
+ */
+ function evaluate(val, context) {
+ if ($.isFunction(val)) {
+ var args = Array.prototype.slice.call(arguments, 2);
+ return val.apply(context, args);
+ }
+ return val;
+ }
+
+ function countResults(results) {
+ var count = 0;
+ $.each(results, function(i, item) {
+ if (item.children) {
+ count += countResults(item.children);
+ } else {
+ count++;
+ }
+ });
+ return count;
+ }
+
+ /**
+ * Default tokenizer. This function uses breaks the input on substring match of any string from the
+ * opts.tokenSeparators array and uses opts.createSearchChoice to create the choice object. Both of those
+ * two options have to be defined in order for the tokenizer to work.
+ *
+ * @param input text user has typed so far or pasted into the search field
+ * @param selection currently selected choices
+ * @param selectCallback function(choice) callback tho add the choice to selection
+ * @param opts select2's opts
+ * @return undefined/null to leave the current input unchanged, or a string to change the input to the returned value
+ */
+ function defaultTokenizer(input, selection, selectCallback, opts) {
+ var original = input, // store the original so we can compare and know if we need to tell the search to update its text
+ dupe = false, // check for whether a token we extracted represents a duplicate selected choice
+ token, // token
+ index, // position at which the separator was found
+ i, l, // looping variables
+ separator; // the matched separator
+
+ if (!opts.createSearchChoice || !opts.tokenSeparators || opts.tokenSeparators.length < 1) return undefined;
+
+ while (true) {
+ index = -1;
+
+ for (i = 0, l = opts.tokenSeparators.length; i < l; i++) {
+ separator = opts.tokenSeparators[i];
+ index = input.indexOf(separator);
+ if (index >= 0) break;
+ }
+
+ if (index < 0) break; // did not find any token separator in the input string, bail
+
+ token = input.substring(0, index);
+ input = input.substring(index + separator.length);
+
+ if (token.length > 0) {
+ token = opts.createSearchChoice.call(this, token, selection);
+ if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
+ dupe = false;
+ for (i = 0, l = selection.length; i < l; i++) {
+ if (equal(opts.id(token), opts.id(selection[i]))) {
+ dupe = true; break;
+ }
+ }
+
+ if (!dupe) selectCallback(token);
+ }
+ }
+ }
+
+ if (original!==input) return input;
+ }
+
+ function cleanupJQueryElements() {
+ var self = this;
+
+ $.each(arguments, function (i, element) {
+ self[element].remove();
+ self[element] = null;
+ });
+ }
+
+ /**
+ * Creates a new class
+ *
+ * @param superClass
+ * @param methods
+ */
+ function clazz(SuperClass, methods) {
+ var constructor = function () {};
+ constructor.prototype = new SuperClass;
+ constructor.prototype.constructor = constructor;
+ constructor.prototype.parent = SuperClass.prototype;
+ constructor.prototype = $.extend(constructor.prototype, methods);
+ return constructor;
+ }
+
+ AbstractSelect2 = clazz(Object, {
+
+ // abstract
+ bind: function (func) {
+ var self = this;
+ return function () {
+ func.apply(self, arguments);
+ };
+ },
+
+ // abstract
+ init: function (opts) {
+ var results, search, resultsSelector = ".select2-results";
+
+ // prepare options
+ this.opts = opts = this.prepareOpts(opts);
+
+ this.id=opts.id;
+
+ // destroy if called on an existing component
+ if (opts.element.data("select2") !== undefined &&
+ opts.element.data("select2") !== null) {
+ opts.element.data("select2").destroy();
+ }
+
+ this.container = this.createContainer();
+
+ this.liveRegion = $('.select2-hidden-accessible');
+ if (this.liveRegion.length == 0) {
+ this.liveRegion = $("", {
+ role: "status",
+ "aria-live": "polite"
+ })
+ .addClass("select2-hidden-accessible")
+ .appendTo(document.body);
+ }
+
+ this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid());
+ this.containerEventName= this.containerId
+ .replace(/([.])/g, '_')
+ .replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
+ this.container.attr("id", this.containerId);
+
+ this.container.attr("title", opts.element.attr("title"));
+
+ this.body = $(document.body);
+
+ syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
+
+ this.container.attr("style", opts.element.attr("style"));
+ this.container.css(evaluate(opts.containerCss, this.opts.element));
+ this.container.addClass(evaluate(opts.containerCssClass, this.opts.element));
+
+ this.elementTabIndex = this.opts.element.attr("tabindex");
+
+ // swap container for the element
+ this.opts.element
+ .data("select2", this)
+ .attr("tabindex", "-1")
+ .before(this.container)
+ .on("click.select2", killEvent); // do not leak click events
+
+ this.container.data("select2", this);
+
+ this.dropdown = this.container.find(".select2-drop");
+
+ syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
+
+ this.dropdown.addClass(evaluate(opts.dropdownCssClass, this.opts.element));
+ this.dropdown.data("select2", this);
+ this.dropdown.on("click", killEvent);
+
+ this.results = results = this.container.find(resultsSelector);
+ this.search = search = this.container.find("input.select2-input");
+
+ this.queryCount = 0;
+ this.resultsPage = 0;
+ this.context = null;
+
+ // initialize the container
+ this.initContainer();
+
+ this.container.on("click", killEvent);
+
+ installFilteredMouseMove(this.results);
+
+ this.dropdown.on("mousemove-filtered", resultsSelector, this.bind(this.highlightUnderEvent));
+ this.dropdown.on("touchstart touchmove touchend", resultsSelector, this.bind(function (event) {
+ this._touchEvent = true;
+ this.highlightUnderEvent(event);
+ }));
+ this.dropdown.on("touchmove", resultsSelector, this.bind(this.touchMoved));
+ this.dropdown.on("touchstart touchend", resultsSelector, this.bind(this.clearTouchMoved));
+
+ // Waiting for a click event on touch devices to select option and hide dropdown
+ // otherwise click will be triggered on an underlying element
+ this.dropdown.on('click', this.bind(function (event) {
+ if (this._touchEvent) {
+ this._touchEvent = false;
+ this.selectHighlighted();
+ }
+ }));
+
+ installDebouncedScroll(80, this.results);
+ this.dropdown.on("scroll-debounced", resultsSelector, this.bind(this.loadMoreIfNeeded));
+
+ // do not propagate change event from the search field out of the component
+ $(this.container).on("change", ".select2-input", function(e) {e.stopPropagation();});
+ $(this.dropdown).on("change", ".select2-input", function(e) {e.stopPropagation();});
+
+ // if jquery.mousewheel plugin is installed we can prevent out-of-bounds scrolling of results via mousewheel
+ if ($.fn.mousewheel) {
+ results.mousewheel(function (e, delta, deltaX, deltaY) {
+ var top = results.scrollTop();
+ if (deltaY > 0 && top - deltaY <= 0) {
+ results.scrollTop(0);
+ killEvent(e);
+ } else if (deltaY < 0 && results.get(0).scrollHeight - results.scrollTop() + deltaY <= results.height()) {
+ results.scrollTop(results.get(0).scrollHeight - results.height());
+ killEvent(e);
+ }
+ });
+ }
+
+ installKeyUpChangeEvent(search);
+ search.on("keyup-change input paste", this.bind(this.updateResults));
+ search.on("focus", function () { search.addClass("select2-focused"); });
+ search.on("blur", function () { search.removeClass("select2-focused");});
+
+ this.dropdown.on("mouseup", resultsSelector, this.bind(function (e) {
+ if ($(e.target).closest(".select2-result-selectable").length > 0) {
+ this.highlightUnderEvent(e);
+ this.selectHighlighted(e);
+ }
+ }));
+
+ // trap all mouse events from leaving the dropdown. sometimes there may be a modal that is listening
+ // for mouse events outside of itself so it can close itself. since the dropdown is now outside the select2's
+ // dom it will trigger the popup close, which is not what we want
+ // focusin can cause focus wars between modals and select2 since the dropdown is outside the modal.
+ this.dropdown.on("click mouseup mousedown touchstart touchend focusin", function (e) { e.stopPropagation(); });
+
+ this.nextSearchTerm = undefined;
+
+ if ($.isFunction(this.opts.initSelection)) {
+ // initialize selection based on the current value of the source element
+ this.initSelection();
+
+ // if the user has provided a function that can set selection based on the value of the source element
+ // we monitor the change event on the element and trigger it, allowing for two way synchronization
+ this.monitorSource();
+ }
+
+ if (opts.maximumInputLength !== null) {
+ this.search.attr("maxlength", opts.maximumInputLength);
+ }
+
+ var disabled = opts.element.prop("disabled");
+ if (disabled === undefined) disabled = false;
+ this.enable(!disabled);
+
+ var readonly = opts.element.prop("readonly");
+ if (readonly === undefined) readonly = false;
+ this.readonly(readonly);
+
+ // Calculate size of scrollbar
+ scrollBarDimensions = scrollBarDimensions || measureScrollbar();
+
+ this.autofocus = opts.element.prop("autofocus");
+ opts.element.prop("autofocus", false);
+ if (this.autofocus) this.focus();
+
+ this.search.attr("placeholder", opts.searchInputPlaceholder);
+ },
+
+ // abstract
+ destroy: function () {
+ var element=this.opts.element, select2 = element.data("select2"), self = this;
+
+ this.close();
+
+ if (element.length && element[0].detachEvent && self._sync) {
+ element.each(function () {
+ if (self._sync) {
+ this.detachEvent("onpropertychange", self._sync);
+ }
+ });
+ }
+ if (this.propertyObserver) {
+ this.propertyObserver.disconnect();
+ this.propertyObserver = null;
+ }
+ this._sync = null;
+
+ if (select2 !== undefined) {
+ select2.container.remove();
+ select2.liveRegion.remove();
+ select2.dropdown.remove();
+ element
+ .show()
+ .removeData("select2")
+ .off(".select2")
+ .prop("autofocus", this.autofocus || false);
+ if (this.elementTabIndex) {
+ element.attr({tabindex: this.elementTabIndex});
+ } else {
+ element.removeAttr("tabindex");
+ }
+ element.show();
+ }
+
+ cleanupJQueryElements.call(this,
+ "container",
+ "liveRegion",
+ "dropdown",
+ "results",
+ "search"
+ );
+ },
+
+ // abstract
+ optionToData: function(element) {
+ if (element.is("option")) {
+ return {
+ id:element.prop("value"),
+ text:element.text(),
+ element: element.get(),
+ css: element.attr("class"),
+ disabled: element.prop("disabled"),
+ locked: equal(element.attr("locked"), "locked") || equal(element.data("locked"), true)
+ };
+ } else if (element.is("optgroup")) {
+ return {
+ text:element.attr("label"),
+ children:[],
+ element: element.get(),
+ css: element.attr("class")
+ };
+ }
+ },
+
+ // abstract
+ prepareOpts: function (opts) {
+ var element, select, idKey, ajaxUrl, self = this;
+
+ element = opts.element;
+
+ if (element.get(0).tagName.toLowerCase() === "select") {
+ this.select = select = opts.element;
+ }
+
+ if (select) {
+ // these options are not allowed when attached to a select because they are picked up off the element itself
+ $.each(["id", "multiple", "ajax", "query", "createSearchChoice", "initSelection", "data", "tags"], function () {
+ if (this in opts) {
+ throw new Error("Option '" + this + "' is not allowed for Select2 when attached to a element.");
+ }
+ });
+ }
+
+ opts = $.extend({}, {
+ populateResults: function(container, results, query) {
+ var populate, id=this.opts.id, liveRegion=this.liveRegion;
+
+ populate=function(results, container, depth) {
+
+ var i, l, result, selectable, disabled, compound, node, label, innerContainer, formatted;
+
+ results = opts.sortResults(results, container, query);
+
+ // collect the created nodes for bulk append
+ var nodes = [];
+ for (i = 0, l = results.length; i < l; i = i + 1) {
+
+ result=results[i];
+
+ disabled = (result.disabled === true);
+ selectable = (!disabled) && (id(result) !== undefined);
+
+ compound=result.children && result.children.length > 0;
+
+ node=$(" ");
+ node.addClass("select2-results-dept-"+depth);
+ node.addClass("select2-result");
+ node.addClass(selectable ? "select2-result-selectable" : "select2-result-unselectable");
+ if (disabled) { node.addClass("select2-disabled"); }
+ if (compound) { node.addClass("select2-result-with-children"); }
+ node.addClass(self.opts.formatResultCssClass(result));
+ node.attr("role", "presentation");
+
+ label=$(document.createElement("div"));
+ label.addClass("select2-result-label");
+ label.attr("id", "select2-result-label-" + nextUid());
+ label.attr("role", "option");
+
+ formatted=opts.formatResult(result, label, query, self.opts.escapeMarkup);
+ if (formatted!==undefined) {
+ label.html(formatted);
+ node.append(label);
+ }
+
+
+ if (compound) {
+
+ innerContainer=$("");
+ innerContainer.addClass("select2-result-sub");
+ populate(result.children, innerContainer, depth+1);
+ node.append(innerContainer);
+ }
+
+ node.data("select2-data", result);
+ nodes.push(node[0]);
+ }
+
+ // bulk append the created nodes
+ container.append(nodes);
+ liveRegion.text(opts.formatMatches(results.length));
+ };
+
+ populate(results, container, 0);
+ }
+ }, $.fn.select2.defaults, opts);
+
+ if (typeof(opts.id) !== "function") {
+ idKey = opts.id;
+ opts.id = function (e) { return e[idKey]; };
+ }
+
+ if ($.isArray(opts.element.data("select2Tags"))) {
+ if ("tags" in opts) {
+ throw "tags specified as both an attribute 'data-select2-tags' and in options of Select2 " + opts.element.attr("id");
+ }
+ opts.tags=opts.element.data("select2Tags");
+ }
+
+ if (select) {
+ opts.query = this.bind(function (query) {
+ var data = { results: [], more: false },
+ term = query.term,
+ children, placeholderOption, process;
+
+ process=function(element, collection) {
+ var group;
+ if (element.is("option")) {
+ if (query.matcher(term, element.text(), element)) {
+ collection.push(self.optionToData(element));
+ }
+ } else if (element.is("optgroup")) {
+ group=self.optionToData(element);
+ element.children().each2(function(i, elm) { process(elm, group.children); });
+ if (group.children.length>0) {
+ collection.push(group);
+ }
+ }
+ };
+
+ children=element.children();
+
+ // ignore the placeholder option if there is one
+ if (this.getPlaceholder() !== undefined && children.length > 0) {
+ placeholderOption = this.getPlaceholderOption();
+ if (placeholderOption) {
+ children=children.not(placeholderOption);
+ }
+ }
+
+ children.each2(function(i, elm) { process(elm, data.results); });
+
+ query.callback(data);
+ });
+ // this is needed because inside val() we construct choices from options and their id is hardcoded
+ opts.id=function(e) { return e.id; };
+ } else {
+ if (!("query" in opts)) {
+
+ if ("ajax" in opts) {
+ ajaxUrl = opts.element.data("ajax-url");
+ if (ajaxUrl && ajaxUrl.length > 0) {
+ opts.ajax.url = ajaxUrl;
+ }
+ opts.query = ajax.call(opts.element, opts.ajax);
+ } else if ("data" in opts) {
+ opts.query = local(opts.data);
+ } else if ("tags" in opts) {
+ opts.query = tags(opts.tags);
+ if (opts.createSearchChoice === undefined) {
+ opts.createSearchChoice = function (term) { return {id: $.trim(term), text: $.trim(term)}; };
+ }
+ if (opts.initSelection === undefined) {
+ opts.initSelection = function (element, callback) {
+ var data = [];
+ $(splitVal(element.val(), opts.separator, opts.transformVal)).each(function () {
+ var obj = { id: this, text: this },
+ tags = opts.tags;
+ if ($.isFunction(tags)) tags=tags();
+ $(tags).each(function() { if (equal(this.id, obj.id)) { obj = this; return false; } });
+ data.push(obj);
+ });
+
+ callback(data);
+ };
+ }
+ }
+ }
+ }
+ if (typeof(opts.query) !== "function") {
+ throw "query function not defined for Select2 " + opts.element.attr("id");
+ }
+
+ if (opts.createSearchChoicePosition === 'top') {
+ opts.createSearchChoicePosition = function(list, item) { list.unshift(item); };
+ }
+ else if (opts.createSearchChoicePosition === 'bottom') {
+ opts.createSearchChoicePosition = function(list, item) { list.push(item); };
+ }
+ else if (typeof(opts.createSearchChoicePosition) !== "function") {
+ throw "invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";
+ }
+
+ return opts;
+ },
+
+ /**
+ * Monitor the original element for changes and update select2 accordingly
+ */
+ // abstract
+ monitorSource: function () {
+ var el = this.opts.element, observer, self = this;
+
+ el.on("change.select2", this.bind(function (e) {
+ if (this.opts.element.data("select2-change-triggered") !== true) {
+ this.initSelection();
+ }
+ }));
+
+ this._sync = this.bind(function () {
+
+ // sync enabled state
+ var disabled = el.prop("disabled");
+ if (disabled === undefined) disabled = false;
+ this.enable(!disabled);
+
+ var readonly = el.prop("readonly");
+ if (readonly === undefined) readonly = false;
+ this.readonly(readonly);
+
+ if (this.container) {
+ syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
+ this.container.addClass(evaluate(this.opts.containerCssClass, this.opts.element));
+ }
+
+ if (this.dropdown) {
+ syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
+ this.dropdown.addClass(evaluate(this.opts.dropdownCssClass, this.opts.element));
+ }
+
+ });
+
+ // IE8-10 (IE9/10 won't fire propertyChange via attachEventListener)
+ if (el.length && el[0].attachEvent) {
+ el.each(function() {
+ this.attachEvent("onpropertychange", self._sync);
+ });
+ }
+
+ // safari, chrome, firefox, IE11
+ observer = window.MutationObserver || window.WebKitMutationObserver|| window.MozMutationObserver;
+ if (observer !== undefined) {
+ if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; }
+ this.propertyObserver = new observer(function (mutations) {
+ $.each(mutations, self._sync);
+ });
+ this.propertyObserver.observe(el.get(0), { attributes:true, subtree:false });
+ }
+ },
+
+ // abstract
+ triggerSelect: function(data) {
+ var evt = $.Event("select2-selecting", { val: this.id(data), object: data, choice: data });
+ this.opts.element.trigger(evt);
+ return !evt.isDefaultPrevented();
+ },
+
+ /**
+ * Triggers the change event on the source element
+ */
+ // abstract
+ triggerChange: function (details) {
+
+ details = details || {};
+ details= $.extend({}, details, { type: "change", val: this.val() });
+ // prevents recursive triggering
+ this.opts.element.data("select2-change-triggered", true);
+ this.opts.element.trigger(details);
+ this.opts.element.data("select2-change-triggered", false);
+
+ // some validation frameworks ignore the change event and listen instead to keyup, click for selects
+ // so here we trigger the click event manually
+ this.opts.element.click();
+
+ // ValidationEngine ignores the change event and listens instead to blur
+ // so here we trigger the blur event manually if so desired
+ if (this.opts.blurOnChange)
+ this.opts.element.blur();
+ },
+
+ //abstract
+ isInterfaceEnabled: function()
+ {
+ return this.enabledInterface === true;
+ },
+
+ // abstract
+ enableInterface: function() {
+ var enabled = this._enabled && !this._readonly,
+ disabled = !enabled;
+
+ if (enabled === this.enabledInterface) return false;
+
+ this.container.toggleClass("select2-container-disabled", disabled);
+ this.close();
+ this.enabledInterface = enabled;
+
+ return true;
+ },
+
+ // abstract
+ enable: function(enabled) {
+ if (enabled === undefined) enabled = true;
+ if (this._enabled === enabled) return;
+ this._enabled = enabled;
+
+ this.opts.element.prop("disabled", !enabled);
+ this.enableInterface();
+ },
+
+ // abstract
+ disable: function() {
+ this.enable(false);
+ },
+
+ // abstract
+ readonly: function(enabled) {
+ if (enabled === undefined) enabled = false;
+ if (this._readonly === enabled) return;
+ this._readonly = enabled;
+
+ this.opts.element.prop("readonly", enabled);
+ this.enableInterface();
+ },
+
+ // abstract
+ opened: function () {
+ return (this.container) ? this.container.hasClass("select2-dropdown-open") : false;
+ },
+
+ // abstract
+ positionDropdown: function() {
+ var $dropdown = this.dropdown,
+ container = this.container,
+ offset = container.offset(),
+ height = container.outerHeight(false),
+ width = container.outerWidth(false),
+ dropHeight = $dropdown.outerHeight(false),
+ $window = $(window),
+ windowWidth = $window.width(),
+ windowHeight = $window.height(),
+ viewPortRight = $window.scrollLeft() + windowWidth,
+ viewportBottom = $window.scrollTop() + windowHeight,
+ dropTop = offset.top + height,
+ dropLeft = offset.left,
+ enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
+ enoughRoomAbove = (offset.top - dropHeight) >= $window.scrollTop(),
+ dropWidth = $dropdown.outerWidth(false),
+ enoughRoomOnRight = function() {
+ return dropLeft + dropWidth <= viewPortRight;
+ },
+ enoughRoomOnLeft = function() {
+ return offset.left + viewPortRight + container.outerWidth(false) > dropWidth;
+ },
+ aboveNow = $dropdown.hasClass("select2-drop-above"),
+ bodyOffset,
+ above,
+ changeDirection,
+ css,
+ resultsListNode;
+
+ // always prefer the current above/below alignment, unless there is not enough room
+ if (aboveNow) {
+ above = true;
+ if (!enoughRoomAbove && enoughRoomBelow) {
+ changeDirection = true;
+ above = false;
+ }
+ } else {
+ above = false;
+ if (!enoughRoomBelow && enoughRoomAbove) {
+ changeDirection = true;
+ above = true;
+ }
+ }
+
+ //if we are changing direction we need to get positions when dropdown is hidden;
+ if (changeDirection) {
+ $dropdown.hide();
+ offset = this.container.offset();
+ height = this.container.outerHeight(false);
+ width = this.container.outerWidth(false);
+ dropHeight = $dropdown.outerHeight(false);
+ viewPortRight = $window.scrollLeft() + windowWidth;
+ viewportBottom = $window.scrollTop() + windowHeight;
+ dropTop = offset.top + height;
+ dropLeft = offset.left;
+ dropWidth = $dropdown.outerWidth(false);
+ $dropdown.show();
+
+ // fix so the cursor does not move to the left within the search-textbox in IE
+ this.focusSearch();
+ }
+
+ if (this.opts.dropdownAutoWidth) {
+ resultsListNode = $('.select2-results', $dropdown)[0];
+ $dropdown.addClass('select2-drop-auto-width');
+ $dropdown.css('width', '');
+ // Add scrollbar width to dropdown if vertical scrollbar is present
+ dropWidth = $dropdown.outerWidth(false) + (resultsListNode.scrollHeight === resultsListNode.clientHeight ? 0 : scrollBarDimensions.width);
+ dropWidth > width ? width = dropWidth : dropWidth = width;
+ dropHeight = $dropdown.outerHeight(false);
+ }
+ else {
+ this.container.removeClass('select2-drop-auto-width');
+ }
+
+ //console.log("below/ droptop:", dropTop, "dropHeight", dropHeight, "sum", (dropTop+dropHeight)+" viewport bottom", viewportBottom, "enough?", enoughRoomBelow);
+ //console.log("above/ offset.top", offset.top, "dropHeight", dropHeight, "top", (offset.top-dropHeight), "scrollTop", this.body.scrollTop(), "enough?", enoughRoomAbove);
+
+ // fix positioning when body has an offset and is not position: static
+ if (this.body.css('position') !== 'static') {
+ bodyOffset = this.body.offset();
+ dropTop -= bodyOffset.top;
+ dropLeft -= bodyOffset.left;
+ }
+
+ if (!enoughRoomOnRight() && enoughRoomOnLeft()) {
+ dropLeft = offset.left + this.container.outerWidth(false) - dropWidth;
+ }
+
+ css = {
+ left: dropLeft,
+ width: width
+ };
+
+ if (above) {
+ css.top = offset.top - dropHeight;
+ css.bottom = 'auto';
+ this.container.addClass("select2-drop-above");
+ $dropdown.addClass("select2-drop-above");
+ }
+ else {
+ css.top = dropTop;
+ css.bottom = 'auto';
+ this.container.removeClass("select2-drop-above");
+ $dropdown.removeClass("select2-drop-above");
+ }
+ css = $.extend(css, evaluate(this.opts.dropdownCss, this.opts.element));
+
+ $dropdown.css(css);
+ },
+
+ // abstract
+ shouldOpen: function() {
+ var event;
+
+ if (this.opened()) return false;
+
+ if (this._enabled === false || this._readonly === true) return false;
+
+ event = $.Event("select2-opening");
+ this.opts.element.trigger(event);
+ return !event.isDefaultPrevented();
+ },
+
+ // abstract
+ clearDropdownAlignmentPreference: function() {
+ // clear the classes used to figure out the preference of where the dropdown should be opened
+ this.container.removeClass("select2-drop-above");
+ this.dropdown.removeClass("select2-drop-above");
+ },
+
+ /**
+ * Opens the dropdown
+ *
+ * @return {Boolean} whether or not dropdown was opened. This method will return false if, for example,
+ * the dropdown is already open, or if the 'open' event listener on the element called preventDefault().
+ */
+ // abstract
+ open: function () {
+
+ if (!this.shouldOpen()) return false;
+
+ this.opening();
+
+ // Only bind the document mousemove when the dropdown is visible
+ $document.on("mousemove.select2Event", function (e) {
+ lastMousePosition.x = e.pageX;
+ lastMousePosition.y = e.pageY;
+ });
+
+ return true;
+ },
+
+ /**
+ * Performs the opening of the dropdown
+ */
+ // abstract
+ opening: function() {
+ var cid = this.containerEventName,
+ scroll = "scroll." + cid,
+ resize = "resize."+cid,
+ orient = "orientationchange."+cid,
+ mask;
+
+ this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
+
+ this.clearDropdownAlignmentPreference();
+
+ if(this.dropdown[0] !== this.body.children().last()[0]) {
+ this.dropdown.detach().appendTo(this.body);
+ }
+
+ // create the dropdown mask if doesn't already exist
+ mask = $("#select2-drop-mask");
+ if (mask.length === 0) {
+ mask = $(document.createElement("div"));
+ mask.attr("id","select2-drop-mask").attr("class","select2-drop-mask");
+ mask.hide();
+ mask.appendTo(this.body);
+ mask.on("mousedown touchstart click", function (e) {
+ // Prevent IE from generating a click event on the body
+ reinsertElement(mask);
+
+ var dropdown = $("#select2-drop"), self;
+ if (dropdown.length > 0) {
+ self=dropdown.data("select2");
+ if (self.opts.selectOnBlur) {
+ self.selectHighlighted({noFocus: true});
+ }
+ self.close();
+ e.preventDefault();
+ e.stopPropagation();
+ }
+ });
+ }
+
+ // ensure the mask is always right before the dropdown
+ if (this.dropdown.prev()[0] !== mask[0]) {
+ this.dropdown.before(mask);
+ }
+
+ // move the global id to the correct dropdown
+ $("#select2-drop").removeAttr("id");
+ this.dropdown.attr("id", "select2-drop");
+
+ // show the elements
+ mask.show();
+
+ this.positionDropdown();
+ this.dropdown.show();
+ this.positionDropdown();
+
+ this.dropdown.addClass("select2-drop-active");
+
+ // attach listeners to events that can change the position of the container and thus require
+ // the position of the dropdown to be updated as well so it does not come unglued from the container
+ var that = this;
+ this.container.parents().add(window).each(function () {
+ $(this).on(resize+" "+scroll+" "+orient, function (e) {
+ if (that.opened()) that.positionDropdown();
+ });
+ });
+
+
+ },
+
+ // abstract
+ close: function () {
+ if (!this.opened()) return;
+
+ var cid = this.containerEventName,
+ scroll = "scroll." + cid,
+ resize = "resize."+cid,
+ orient = "orientationchange."+cid;
+
+ // unbind event listeners
+ this.container.parents().add(window).each(function () { $(this).off(scroll).off(resize).off(orient); });
+
+ this.clearDropdownAlignmentPreference();
+
+ $("#select2-drop-mask").hide();
+ this.dropdown.removeAttr("id"); // only the active dropdown has the select2-drop id
+ this.dropdown.hide();
+ this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active");
+ this.results.empty();
+
+ // Now that the dropdown is closed, unbind the global document mousemove event
+ $document.off("mousemove.select2Event");
+
+ this.clearSearch();
+ this.search.removeClass("select2-active");
+ this.opts.element.trigger($.Event("select2-close"));
+ },
+
+ /**
+ * Opens control, sets input value, and updates results.
+ */
+ // abstract
+ externalSearch: function (term) {
+ this.open();
+ this.search.val(term);
+ this.updateResults(false);
+ },
+
+ // abstract
+ clearSearch: function () {
+
+ },
+
+ //abstract
+ getMaximumSelectionSize: function() {
+ return evaluate(this.opts.maximumSelectionSize, this.opts.element);
+ },
+
+ // abstract
+ ensureHighlightVisible: function () {
+ var results = this.results, children, index, child, hb, rb, y, more, topOffset;
+
+ index = this.highlight();
+
+ if (index < 0) return;
+
+ if (index == 0) {
+
+ // if the first element is highlighted scroll all the way to the top,
+ // that way any unselectable headers above it will also be scrolled
+ // into view
+
+ results.scrollTop(0);
+ return;
+ }
+
+ children = this.findHighlightableChoices().find('.select2-result-label');
+
+ child = $(children[index]);
+
+ topOffset = (child.offset() || {}).top || 0;
+
+ hb = topOffset + child.outerHeight(true);
+
+ // if this is the last child lets also make sure select2-more-results is visible
+ if (index === children.length - 1) {
+ more = results.find("li.select2-more-results");
+ if (more.length > 0) {
+ hb = more.offset().top + more.outerHeight(true);
+ }
+ }
+
+ rb = results.offset().top + results.outerHeight(false);
+ if (hb > rb) {
+ results.scrollTop(results.scrollTop() + (hb - rb));
+ }
+ y = topOffset - results.offset().top;
+
+ // make sure the top of the element is visible
+ if (y < 0 && child.css('display') != 'none' ) {
+ results.scrollTop(results.scrollTop() + y); // y is negative
+ }
+ },
+
+ // abstract
+ findHighlightableChoices: function() {
+ return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)");
+ },
+
+ // abstract
+ moveHighlight: function (delta) {
+ var choices = this.findHighlightableChoices(),
+ index = this.highlight();
+
+ while (index > -1 && index < choices.length) {
+ index += delta;
+ var choice = $(choices[index]);
+ if (choice.hasClass("select2-result-selectable") && !choice.hasClass("select2-disabled") && !choice.hasClass("select2-selected")) {
+ this.highlight(index);
+ break;
+ }
+ }
+ },
+
+ // abstract
+ highlight: function (index) {
+ var choices = this.findHighlightableChoices(),
+ choice,
+ data;
+
+ if (arguments.length === 0) {
+ return indexOf(choices.filter(".select2-highlighted")[0], choices.get());
+ }
+
+ if (index >= choices.length) index = choices.length - 1;
+ if (index < 0) index = 0;
+
+ this.removeHighlight();
+
+ choice = $(choices[index]);
+ choice.addClass("select2-highlighted");
+
+ // ensure assistive technology can determine the active choice
+ this.search.attr("aria-activedescendant", choice.find(".select2-result-label").attr("id"));
+
+ this.ensureHighlightVisible();
+
+ this.liveRegion.text(choice.text());
+
+ data = choice.data("select2-data");
+ if (data) {
+ this.opts.element.trigger({ type: "select2-highlight", val: this.id(data), choice: data });
+ }
+ },
+
+ removeHighlight: function() {
+ this.results.find(".select2-highlighted").removeClass("select2-highlighted");
+ },
+
+ touchMoved: function() {
+ this._touchMoved = true;
+ },
+
+ clearTouchMoved: function() {
+ this._touchMoved = false;
+ },
+
+ // abstract
+ countSelectableResults: function() {
+ return this.findHighlightableChoices().length;
+ },
+
+ // abstract
+ highlightUnderEvent: function (event) {
+ var el = $(event.target).closest(".select2-result-selectable");
+ if (el.length > 0 && !el.is(".select2-highlighted")) {
+ var choices = this.findHighlightableChoices();
+ this.highlight(choices.index(el));
+ } else if (el.length == 0) {
+ // if we are over an unselectable item remove all highlights
+ this.removeHighlight();
+ }
+ },
+
+ // abstract
+ loadMoreIfNeeded: function () {
+ var results = this.results,
+ more = results.find("li.select2-more-results"),
+ below, // pixels the element is below the scroll fold, below==0 is when the element is starting to be visible
+ page = this.resultsPage + 1,
+ self=this,
+ term=this.search.val(),
+ context=this.context;
+
+ if (more.length === 0) return;
+ below = more.offset().top - results.offset().top - results.height();
+
+ if (below <= this.opts.loadMorePadding) {
+ more.addClass("select2-active");
+ this.opts.query({
+ element: this.opts.element,
+ term: term,
+ page: page,
+ context: context,
+ matcher: this.opts.matcher,
+ callback: this.bind(function (data) {
+
+ // ignore a response if the select2 has been closed before it was received
+ if (!self.opened()) return;
+
+
+ self.opts.populateResults.call(this, results, data.results, {term: term, page: page, context:context});
+ self.postprocessResults(data, false, false);
+
+ if (data.more===true) {
+ more.detach().appendTo(results).html(self.opts.escapeMarkup(evaluate(self.opts.formatLoadMore, self.opts.element, page+1)));
+ window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
+ } else {
+ more.remove();
+ }
+ self.positionDropdown();
+ self.resultsPage = page;
+ self.context = data.context;
+ this.opts.element.trigger({ type: "select2-loaded", items: data });
+ })});
+ }
+ },
+
+ /**
+ * Default tokenizer function which does nothing
+ */
+ tokenize: function() {
+
+ },
+
+ /**
+ * @param initial whether or not this is the call to this method right after the dropdown has been opened
+ */
+ // abstract
+ updateResults: function (initial) {
+ var search = this.search,
+ results = this.results,
+ opts = this.opts,
+ data,
+ self = this,
+ input,
+ term = search.val(),
+ lastTerm = $.data(this.container, "select2-last-term"),
+ // sequence number used to drop out-of-order responses
+ queryNumber;
+
+ // prevent duplicate queries against the same term
+ if (initial !== true && lastTerm && equal(term, lastTerm)) return;
+
+ $.data(this.container, "select2-last-term", term);
+
+ // if the search is currently hidden we do not alter the results
+ if (initial !== true && (this.showSearchInput === false || !this.opened())) {
+ return;
+ }
+
+ function postRender() {
+ search.removeClass("select2-active");
+ self.positionDropdown();
+ if (results.find('.select2-no-results,.select2-selection-limit,.select2-searching').length) {
+ self.liveRegion.text(results.text());
+ }
+ else {
+ self.liveRegion.text(self.opts.formatMatches(results.find('.select2-result-selectable:not(".select2-selected")').length));
+ }
+ }
+
+ function render(html) {
+ results.html(html);
+ postRender();
+ }
+
+ queryNumber = ++this.queryCount;
+
+ var maxSelSize = this.getMaximumSelectionSize();
+ if (maxSelSize >=1) {
+ data = this.data();
+ if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
+ render("" + evaluate(opts.formatSelectionTooBig, opts.element, maxSelSize) + " ");
+ return;
+ }
+ }
+
+ if (search.val().length < opts.minimumInputLength) {
+ if (checkFormatter(opts.formatInputTooShort, "formatInputTooShort")) {
+ render("" + evaluate(opts.formatInputTooShort, opts.element, search.val(), opts.minimumInputLength) + " ");
+ } else {
+ render("");
+ }
+ if (initial && this.showSearch) this.showSearch(true);
+ return;
+ }
+
+ if (opts.maximumInputLength && search.val().length > opts.maximumInputLength) {
+ if (checkFormatter(opts.formatInputTooLong, "formatInputTooLong")) {
+ render("" + evaluate(opts.formatInputTooLong, opts.element, search.val(), opts.maximumInputLength) + " ");
+ } else {
+ render("");
+ }
+ return;
+ }
+
+ if (opts.formatSearching && this.findHighlightableChoices().length === 0) {
+ render("" + evaluate(opts.formatSearching, opts.element) + " ");
+ }
+
+ search.addClass("select2-active");
+
+ this.removeHighlight();
+
+ // give the tokenizer a chance to pre-process the input
+ input = this.tokenize();
+ if (input != undefined && input != null) {
+ search.val(input);
+ }
+
+ this.resultsPage = 1;
+
+ opts.query({
+ element: opts.element,
+ term: search.val(),
+ page: this.resultsPage,
+ context: null,
+ matcher: opts.matcher,
+ callback: this.bind(function (data) {
+ var def; // default choice
+
+ // ignore old responses
+ if (queryNumber != this.queryCount) {
+ return;
+ }
+
+ // ignore a response if the select2 has been closed before it was received
+ if (!this.opened()) {
+ this.search.removeClass("select2-active");
+ return;
+ }
+
+ // handle ajax error
+ if(data.hasError !== undefined && checkFormatter(opts.formatAjaxError, "formatAjaxError")) {
+ render("" + evaluate(opts.formatAjaxError, opts.element, data.jqXHR, data.textStatus, data.errorThrown) + " ");
+ return;
+ }
+
+ // save context, if any
+ this.context = (data.context===undefined) ? null : data.context;
+ // create a default choice and prepend it to the list
+ if (this.opts.createSearchChoice && search.val() !== "") {
+ def = this.opts.createSearchChoice.call(self, search.val(), data.results);
+ if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
+ if ($(data.results).filter(
+ function () {
+ return equal(self.id(this), self.id(def));
+ }).length === 0) {
+ this.opts.createSearchChoicePosition(data.results, def);
+ }
+ }
+ }
+
+ if (data.results.length === 0 && checkFormatter(opts.formatNoMatches, "formatNoMatches")) {
+ render("" + evaluate(opts.formatNoMatches, opts.element, search.val()) + " ");
+ return;
+ }
+
+ results.empty();
+ self.opts.populateResults.call(this, results, data.results, {term: search.val(), page: this.resultsPage, context:null});
+
+ if (data.more === true && checkFormatter(opts.formatLoadMore, "formatLoadMore")) {
+ results.append("" + opts.escapeMarkup(evaluate(opts.formatLoadMore, opts.element, this.resultsPage)) + " ");
+ window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
+ }
+
+ this.postprocessResults(data, initial);
+
+ postRender();
+
+ this.opts.element.trigger({ type: "select2-loaded", items: data });
+ })});
+ },
+
+ // abstract
+ cancel: function () {
+ this.close();
+ },
+
+ // abstract
+ blur: function () {
+ // if selectOnBlur == true, select the currently highlighted option
+ if (this.opts.selectOnBlur)
+ this.selectHighlighted({noFocus: true});
+
+ this.close();
+ this.container.removeClass("select2-container-active");
+ // synonymous to .is(':focus'), which is available in jquery >= 1.6
+ if (this.search[0] === document.activeElement) { this.search.blur(); }
+ this.clearSearch();
+ this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
+ },
+
+ // abstract
+ focusSearch: function () {
+ focus(this.search);
+ },
+
+ // abstract
+ selectHighlighted: function (options) {
+ if (this._touchMoved) {
+ this.clearTouchMoved();
+ return;
+ }
+ var index=this.highlight(),
+ highlighted=this.results.find(".select2-highlighted"),
+ data = highlighted.closest('.select2-result').data("select2-data");
+
+ if (data) {
+ this.highlight(index);
+ this.onSelect(data, options);
+ } else if (options && options.noFocus) {
+ this.close();
+ }
+ },
+
+ // abstract
+ getPlaceholder: function () {
+ var placeholderOption;
+ return this.opts.element.attr("placeholder") ||
+ this.opts.element.attr("data-placeholder") || // jquery 1.4 compat
+ this.opts.element.data("placeholder") ||
+ this.opts.placeholder ||
+ ((placeholderOption = this.getPlaceholderOption()) !== undefined ? placeholderOption.text() : undefined);
+ },
+
+ // abstract
+ getPlaceholderOption: function() {
+ if (this.select) {
+ var firstOption = this.select.children('option').first();
+ if (this.opts.placeholderOption !== undefined ) {
+ //Determine the placeholder option based on the specified placeholderOption setting
+ return (this.opts.placeholderOption === "first" && firstOption) ||
+ (typeof this.opts.placeholderOption === "function" && this.opts.placeholderOption(this.select));
+ } else if ($.trim(firstOption.text()) === "" && firstOption.val() === "") {
+ //No explicit placeholder option specified, use the first if it's blank
+ return firstOption;
+ }
+ }
+ },
+
+ /**
+ * Get the desired width for the container element. This is
+ * derived first from option `width` passed to select2, then
+ * the inline 'style' on the original element, and finally
+ * falls back to the jQuery calculated element width.
+ */
+ // abstract
+ initContainerWidth: function () {
+ function resolveContainerWidth() {
+ var style, attrs, matches, i, l, attr;
+
+ if (this.opts.width === "off") {
+ return null;
+ } else if (this.opts.width === "element"){
+ return this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px';
+ } else if (this.opts.width === "copy" || this.opts.width === "resolve") {
+ // check if there is inline style on the element that contains width
+ style = this.opts.element.attr('style');
+ if (style !== undefined) {
+ attrs = style.split(';');
+ for (i = 0, l = attrs.length; i < l; i = i + 1) {
+ attr = attrs[i].replace(/\s/g, '');
+ matches = attr.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i);
+ if (matches !== null && matches.length >= 1)
+ return matches[1];
+ }
+ }
+
+ if (this.opts.width === "resolve") {
+ // next check if css('width') can resolve a width that is percent based, this is sometimes possible
+ // when attached to input type=hidden or elements hidden via css
+ style = this.opts.element.css('width');
+ if (style.indexOf("%") > 0) return style;
+
+ // finally, fallback on the calculated width of the element
+ return (this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px');
+ }
+
+ return null;
+ } else if ($.isFunction(this.opts.width)) {
+ return this.opts.width();
+ } else {
+ return this.opts.width;
+ }
+ };
+
+ var width = resolveContainerWidth.call(this);
+ if (width !== null) {
+ this.container.css("width", width);
+ }
+ }
+ });
+
+ SingleSelect2 = clazz(AbstractSelect2, {
+
+ // single
+
+ createContainer: function () {
+ var container = $(document.createElement("div")).attr({
+ "class": "select2-container"
+ }).html([
+ "",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ "",
+ "
",
+ " ",
+ " ",
+ "
",
+ "
",
+ "
"].join(""));
+ return container;
+ },
+
+ // single
+ enableInterface: function() {
+ if (this.parent.enableInterface.apply(this, arguments)) {
+ this.focusser.prop("disabled", !this.isInterfaceEnabled());
+ }
+ },
+
+ // single
+ opening: function () {
+ var el, range, len;
+
+ if (this.opts.minimumResultsForSearch >= 0) {
+ this.showSearch(true);
+ }
+
+ this.parent.opening.apply(this, arguments);
+
+ if (this.showSearchInput !== false) {
+ // IE appends focusser.val() at the end of field :/ so we manually insert it at the beginning using a range
+ // all other browsers handle this just fine
+
+ this.search.val(this.focusser.val());
+ }
+ if (this.opts.shouldFocusInput(this)) {
+ this.search.focus();
+ // move the cursor to the end after focussing, otherwise it will be at the beginning and
+ // new text will appear *before* focusser.val()
+ el = this.search.get(0);
+ if (el.createTextRange) {
+ range = el.createTextRange();
+ range.collapse(false);
+ range.select();
+ } else if (el.setSelectionRange) {
+ len = this.search.val().length;
+ el.setSelectionRange(len, len);
+ }
+ }
+
+ // initializes search's value with nextSearchTerm (if defined by user)
+ // ignore nextSearchTerm if the dropdown is opened by the user pressing a letter
+ if(this.search.val() === "") {
+ if(this.nextSearchTerm != undefined){
+ this.search.val(this.nextSearchTerm);
+ this.search.select();
+ }
+ }
+
+ this.focusser.prop("disabled", true).val("");
+ this.updateResults(true);
+ this.opts.element.trigger($.Event("select2-open"));
+ },
+
+ // single
+ close: function () {
+ if (!this.opened()) return;
+ this.parent.close.apply(this, arguments);
+
+ this.focusser.prop("disabled", false);
+
+ if (this.opts.shouldFocusInput(this)) {
+ this.focusser.focus();
+ }
+ },
+
+ // single
+ focus: function () {
+ if (this.opened()) {
+ this.close();
+ } else {
+ this.focusser.prop("disabled", false);
+ if (this.opts.shouldFocusInput(this)) {
+ this.focusser.focus();
+ }
+ }
+ },
+
+ // single
+ isFocused: function () {
+ return this.container.hasClass("select2-container-active");
+ },
+
+ // single
+ cancel: function () {
+ this.parent.cancel.apply(this, arguments);
+ this.focusser.prop("disabled", false);
+
+ if (this.opts.shouldFocusInput(this)) {
+ this.focusser.focus();
+ }
+ },
+
+ // single
+ destroy: function() {
+ $("label[for='" + this.focusser.attr('id') + "']")
+ .attr('for', this.opts.element.attr("id"));
+ this.parent.destroy.apply(this, arguments);
+
+ cleanupJQueryElements.call(this,
+ "selection",
+ "focusser"
+ );
+ },
+
+ // single
+ initContainer: function () {
+
+ var selection,
+ container = this.container,
+ dropdown = this.dropdown,
+ idSuffix = nextUid(),
+ elementLabel;
+
+ if (this.opts.minimumResultsForSearch < 0) {
+ this.showSearch(false);
+ } else {
+ this.showSearch(true);
+ }
+
+ this.selection = selection = container.find(".select2-choice");
+
+ this.focusser = container.find(".select2-focusser");
+
+ // add aria associations
+ selection.find(".select2-chosen").attr("id", "select2-chosen-"+idSuffix);
+ this.focusser.attr("aria-labelledby", "select2-chosen-"+idSuffix);
+ this.results.attr("id", "select2-results-"+idSuffix);
+ this.search.attr("aria-owns", "select2-results-"+idSuffix);
+
+ // rewrite labels from original element to focusser
+ this.focusser.attr("id", "s2id_autogen"+idSuffix);
+
+ elementLabel = $("label[for='" + this.opts.element.attr("id") + "']");
+ this.opts.element.focus(this.bind(function () { this.focus(); }));
+
+ this.focusser.prev()
+ .text(elementLabel.text())
+ .attr('for', this.focusser.attr('id'));
+
+ // Ensure the original element retains an accessible name
+ var originalTitle = this.opts.element.attr("title");
+ this.opts.element.attr("title", (originalTitle || elementLabel.text()));
+
+ this.focusser.attr("tabindex", this.elementTabIndex);
+
+ // write label for search field using the label from the focusser element
+ this.search.attr("id", this.focusser.attr('id') + '_search');
+
+ this.search.prev()
+ .text($("label[for='" + this.focusser.attr('id') + "']").text())
+ .attr('for', this.search.attr('id'));
+
+ this.search.on("keydown", this.bind(function (e) {
+ if (!this.isInterfaceEnabled()) return;
+
+ // filter 229 keyCodes (input method editor is processing key input)
+ if (229 == e.keyCode) return;
+
+ if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
+ // prevent the page from scrolling
+ killEvent(e);
+ return;
+ }
+
+ switch (e.which) {
+ case KEY.UP:
+ case KEY.DOWN:
+ this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
+ killEvent(e);
+ return;
+ case KEY.ENTER:
+ this.selectHighlighted();
+ killEvent(e);
+ return;
+ case KEY.TAB:
+ this.selectHighlighted({noFocus: true});
+ return;
+ case KEY.ESC:
+ this.cancel(e);
+ killEvent(e);
+ return;
+ }
+ }));
+
+ this.search.on("blur", this.bind(function(e) {
+ // a workaround for chrome to keep the search field focussed when the scroll bar is used to scroll the dropdown.
+ // without this the search field loses focus which is annoying
+ if (document.activeElement === this.body.get(0)) {
+ window.setTimeout(this.bind(function() {
+ if (this.opened()) {
+ this.search.focus();
+ }
+ }), 0);
+ }
+ }));
+
+ this.focusser.on("keydown", this.bind(function (e) {
+ if (!this.isInterfaceEnabled()) return;
+
+ if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {
+ return;
+ }
+
+ if (this.opts.openOnEnter === false && e.which === KEY.ENTER) {
+ killEvent(e);
+ return;
+ }
+
+ if (e.which == KEY.DOWN || e.which == KEY.UP
+ || (e.which == KEY.ENTER && this.opts.openOnEnter)) {
+
+ if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) return;
+
+ this.open();
+ killEvent(e);
+ return;
+ }
+
+ if (e.which == KEY.DELETE || e.which == KEY.BACKSPACE) {
+ if (this.opts.allowClear) {
+ this.clear();
+ }
+ killEvent(e);
+ return;
+ }
+ }));
+
+
+ installKeyUpChangeEvent(this.focusser);
+ this.focusser.on("keyup-change input", this.bind(function(e) {
+ if (this.opts.minimumResultsForSearch >= 0) {
+ e.stopPropagation();
+ if (this.opened()) return;
+ this.open();
+ }
+ }));
+
+ selection.on("mousedown touchstart", "abbr", this.bind(function (e) {
+ if (!this.isInterfaceEnabled()) {
+ return;
+ }
+
+ this.clear();
+ killEventImmediately(e);
+ this.close();
+
+ if (this.selection) {
+ this.selection.focus();
+ }
+ }));
+
+ selection.on("mousedown touchstart", this.bind(function (e) {
+ // Prevent IE from generating a click event on the body
+ reinsertElement(selection);
+
+ if (!this.container.hasClass("select2-container-active")) {
+ this.opts.element.trigger($.Event("select2-focus"));
+ }
+
+ if (this.opened()) {
+ this.close();
+ } else if (this.isInterfaceEnabled()) {
+ this.open();
+ }
+
+ killEvent(e);
+ }));
+
+ dropdown.on("mousedown touchstart", this.bind(function() {
+ if (this.opts.shouldFocusInput(this)) {
+ this.search.focus();
+ }
+ }));
+
+ selection.on("focus", this.bind(function(e) {
+ killEvent(e);
+ }));
+
+ this.focusser.on("focus", this.bind(function(){
+ if (!this.container.hasClass("select2-container-active")) {
+ this.opts.element.trigger($.Event("select2-focus"));
+ }
+ this.container.addClass("select2-container-active");
+ })).on("blur", this.bind(function() {
+ if (!this.opened()) {
+ this.container.removeClass("select2-container-active");
+ this.opts.element.trigger($.Event("select2-blur"));
+ }
+ }));
+ this.search.on("focus", this.bind(function(){
+ if (!this.container.hasClass("select2-container-active")) {
+ this.opts.element.trigger($.Event("select2-focus"));
+ }
+ this.container.addClass("select2-container-active");
+ }));
+
+ this.initContainerWidth();
+ this.opts.element.hide();
+ this.setPlaceholder();
+
+ },
+
+ // single
+ clear: function(triggerChange) {
+ var data=this.selection.data("select2-data");
+ if (data) { // guard against queued quick consecutive clicks
+ var evt = $.Event("select2-clearing");
+ this.opts.element.trigger(evt);
+ if (evt.isDefaultPrevented()) {
+ return;
+ }
+ var placeholderOption = this.getPlaceholderOption();
+ this.opts.element.val(placeholderOption ? placeholderOption.val() : "");
+ this.selection.find(".select2-chosen").empty();
+ this.selection.removeData("select2-data");
+ this.setPlaceholder();
+
+ if (triggerChange !== false){
+ this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
+ this.triggerChange({removed:data});
+ }
+ }
+ },
+
+ /**
+ * Sets selection based on source element's value
+ */
+ // single
+ initSelection: function () {
+ var selected;
+ if (this.isPlaceholderOptionSelected()) {
+ this.updateSelection(null);
+ this.close();
+ this.setPlaceholder();
+ } else {
+ var self = this;
+ this.opts.initSelection.call(null, this.opts.element, function(selected){
+ if (selected !== undefined && selected !== null) {
+ self.updateSelection(selected);
+ self.close();
+ self.setPlaceholder();
+ self.nextSearchTerm = self.opts.nextSearchTerm(selected, self.search.val());
+ }
+ });
+ }
+ },
+
+ isPlaceholderOptionSelected: function() {
+ var placeholderOption;
+ if (this.getPlaceholder() === undefined) return false; // no placeholder specified so no option should be considered
+ return ((placeholderOption = this.getPlaceholderOption()) !== undefined && placeholderOption.prop("selected"))
+ || (this.opts.element.val() === "")
+ || (this.opts.element.val() === undefined)
+ || (this.opts.element.val() === null);
+ },
+
+ // single
+ prepareOpts: function () {
+ var opts = this.parent.prepareOpts.apply(this, arguments),
+ self=this;
+
+ if (opts.element.get(0).tagName.toLowerCase() === "select") {
+ // install the selection initializer
+ opts.initSelection = function (element, callback) {
+ var selected = element.find("option").filter(function() { return this.selected && !this.disabled });
+ // a single select box always has a value, no need to null check 'selected'
+ callback(self.optionToData(selected));
+ };
+ } else if ("data" in opts) {
+ // install default initSelection when applied to hidden input and data is local
+ opts.initSelection = opts.initSelection || function (element, callback) {
+ var id = element.val();
+ //search in data by id, storing the actual matching item
+ var match = null;
+ opts.query({
+ matcher: function(term, text, el){
+ var is_match = equal(id, opts.id(el));
+ if (is_match) {
+ match = el;
+ }
+ return is_match;
+ },
+ callback: !$.isFunction(callback) ? $.noop : function() {
+ callback(match);
+ }
+ });
+ };
+ }
+
+ return opts;
+ },
+
+ // single
+ getPlaceholder: function() {
+ // if a placeholder is specified on a single select without a valid placeholder option ignore it
+ if (this.select) {
+ if (this.getPlaceholderOption() === undefined) {
+ return undefined;
+ }
+ }
+
+ return this.parent.getPlaceholder.apply(this, arguments);
+ },
+
+ // single
+ setPlaceholder: function () {
+ var placeholder = this.getPlaceholder();
+
+ if (this.isPlaceholderOptionSelected() && placeholder !== undefined) {
+
+ // check for a placeholder option if attached to a select
+ if (this.select && this.getPlaceholderOption() === undefined) return;
+
+ this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(placeholder));
+
+ this.selection.addClass("select2-default");
+
+ this.container.removeClass("select2-allowclear");
+ }
+ },
+
+ // single
+ postprocessResults: function (data, initial, noHighlightUpdate) {
+ var selected = 0, self = this, showSearchInput = true;
+
+ // find the selected element in the result list
+
+ this.findHighlightableChoices().each2(function (i, elm) {
+ if (equal(self.id(elm.data("select2-data")), self.opts.element.val())) {
+ selected = i;
+ return false;
+ }
+ });
+
+ // and highlight it
+ if (noHighlightUpdate !== false) {
+ if (initial === true && selected >= 0) {
+ this.highlight(selected);
+ } else {
+ this.highlight(0);
+ }
+ }
+
+ // hide the search box if this is the first we got the results and there are enough of them for search
+
+ if (initial === true) {
+ var min = this.opts.minimumResultsForSearch;
+ if (min >= 0) {
+ this.showSearch(countResults(data.results) >= min);
+ }
+ }
+ },
+
+ // single
+ showSearch: function(showSearchInput) {
+ if (this.showSearchInput === showSearchInput) return;
+
+ this.showSearchInput = showSearchInput;
+
+ this.dropdown.find(".select2-search").toggleClass("select2-search-hidden", !showSearchInput);
+ this.dropdown.find(".select2-search").toggleClass("select2-offscreen", !showSearchInput);
+ //add "select2-with-searchbox" to the container if search box is shown
+ $(this.dropdown, this.container).toggleClass("select2-with-searchbox", showSearchInput);
+ },
+
+ // single
+ onSelect: function (data, options) {
+
+ if (!this.triggerSelect(data)) { return; }
+
+ var old = this.opts.element.val(),
+ oldData = this.data();
+
+ this.opts.element.val(this.id(data));
+ this.updateSelection(data);
+
+ this.opts.element.trigger({ type: "select2-selected", val: this.id(data), choice: data });
+
+ this.nextSearchTerm = this.opts.nextSearchTerm(data, this.search.val());
+ this.close();
+
+ if ((!options || !options.noFocus) && this.opts.shouldFocusInput(this)) {
+ this.focusser.focus();
+ }
+
+ if (!equal(old, this.id(data))) {
+ this.triggerChange({ added: data, removed: oldData });
+ }
+ },
+
+ // single
+ updateSelection: function (data) {
+
+ var container=this.selection.find(".select2-chosen"), formatted, cssClass;
+
+ this.selection.data("select2-data", data);
+
+ container.empty();
+ if (data !== null) {
+ formatted=this.opts.formatSelection(data, container, this.opts.escapeMarkup);
+ }
+ if (formatted !== undefined) {
+ container.append(formatted);
+ }
+ cssClass=this.opts.formatSelectionCssClass(data, container);
+ if (cssClass !== undefined) {
+ container.addClass(cssClass);
+ }
+
+ this.selection.removeClass("select2-default");
+
+ if (this.opts.allowClear && this.getPlaceholder() !== undefined) {
+ this.container.addClass("select2-allowclear");
+ }
+ },
+
+ // single
+ val: function () {
+ var val,
+ triggerChange = false,
+ data = null,
+ self = this,
+ oldData = this.data();
+
+ if (arguments.length === 0) {
+ return this.opts.element.val();
+ }
+
+ val = arguments[0];
+
+ if (arguments.length > 1) {
+ triggerChange = arguments[1];
+ }
+
+ if (this.select) {
+ this.select
+ .val(val)
+ .find("option").filter(function() { return this.selected }).each2(function (i, elm) {
+ data = self.optionToData(elm);
+ return false;
+ });
+ this.updateSelection(data);
+ this.setPlaceholder();
+ if (triggerChange) {
+ this.triggerChange({added: data, removed:oldData});
+ }
+ } else {
+ // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
+ if (!val && val !== 0) {
+ this.clear(triggerChange);
+ return;
+ }
+ if (this.opts.initSelection === undefined) {
+ throw new Error("cannot call val() if initSelection() is not defined");
+ }
+ this.opts.element.val(val);
+ this.opts.initSelection(this.opts.element, function(data){
+ self.opts.element.val(!data ? "" : self.id(data));
+ self.updateSelection(data);
+ self.setPlaceholder();
+ if (triggerChange) {
+ self.triggerChange({added: data, removed:oldData});
+ }
+ });
+ }
+ },
+
+ // single
+ clearSearch: function () {
+ this.search.val("");
+ this.focusser.val("");
+ },
+
+ // single
+ data: function(value) {
+ var data,
+ triggerChange = false;
+
+ if (arguments.length === 0) {
+ data = this.selection.data("select2-data");
+ if (data == undefined) data = null;
+ return data;
+ } else {
+ if (arguments.length > 1) {
+ triggerChange = arguments[1];
+ }
+ if (!value) {
+ this.clear(triggerChange);
+ } else {
+ data = this.data();
+ this.opts.element.val(!value ? "" : this.id(value));
+ this.updateSelection(value);
+ if (triggerChange) {
+ this.triggerChange({added: value, removed:data});
+ }
+ }
+ }
+ }
+ });
+
+ MultiSelect2 = clazz(AbstractSelect2, {
+
+ // multi
+ createContainer: function () {
+ var container = $(document.createElement("div")).attr({
+ "class": "select2-container select2-container-multi"
+ }).html([
+ "",
+ ""].join(""));
+ return container;
+ },
+
+ // multi
+ prepareOpts: function () {
+ var opts = this.parent.prepareOpts.apply(this, arguments),
+ self=this;
+
+ // TODO validate placeholder is a string if specified
+ if (opts.element.get(0).tagName.toLowerCase() === "select") {
+ // install the selection initializer
+ opts.initSelection = function (element, callback) {
+
+ var data = [];
+
+ element.find("option").filter(function() { return this.selected && !this.disabled }).each2(function (i, elm) {
+ data.push(self.optionToData(elm));
+ });
+ callback(data);
+ };
+ } else if ("data" in opts) {
+ // install default initSelection when applied to hidden input and data is local
+ opts.initSelection = opts.initSelection || function (element, callback) {
+ var ids = splitVal(element.val(), opts.separator, opts.transformVal);
+ //search in data by array of ids, storing matching items in a list
+ var matches = [];
+ opts.query({
+ matcher: function(term, text, el){
+ var is_match = $.grep(ids, function(id) {
+ return equal(id, opts.id(el));
+ }).length;
+ if (is_match) {
+ matches.push(el);
+ }
+ return is_match;
+ },
+ callback: !$.isFunction(callback) ? $.noop : function() {
+ // reorder matches based on the order they appear in the ids array because right now
+ // they are in the order in which they appear in data array
+ var ordered = [];
+ for (var i = 0; i < ids.length; i++) {
+ var id = ids[i];
+ for (var j = 0; j < matches.length; j++) {
+ var match = matches[j];
+ if (equal(id, opts.id(match))) {
+ ordered.push(match);
+ matches.splice(j, 1);
+ break;
+ }
+ }
+ }
+ callback(ordered);
+ }
+ });
+ };
+ }
+
+ return opts;
+ },
+
+ // multi
+ selectChoice: function (choice) {
+
+ var selected = this.container.find(".select2-search-choice-focus");
+ if (selected.length && choice && choice[0] == selected[0]) {
+
+ } else {
+ if (selected.length) {
+ this.opts.element.trigger("choice-deselected", selected);
+ }
+ selected.removeClass("select2-search-choice-focus");
+ if (choice && choice.length) {
+ this.close();
+ choice.addClass("select2-search-choice-focus");
+ this.opts.element.trigger("choice-selected", choice);
+ }
+ }
+ },
+
+ // multi
+ destroy: function() {
+ $("label[for='" + this.search.attr('id') + "']")
+ .attr('for', this.opts.element.attr("id"));
+ this.parent.destroy.apply(this, arguments);
+
+ cleanupJQueryElements.call(this,
+ "searchContainer",
+ "selection"
+ );
+ },
+
+ // multi
+ initContainer: function () {
+
+ var selector = ".select2-choices", selection;
+
+ this.searchContainer = this.container.find(".select2-search-field");
+ this.selection = selection = this.container.find(selector);
+
+ var _this = this;
+ this.selection.on("click", ".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)", function (e) {
+ _this.search[0].focus();
+ _this.selectChoice($(this));
+ });
+
+ // rewrite labels from original element to focusser
+ this.search.attr("id", "s2id_autogen"+nextUid());
+
+ this.search.prev()
+ .text($("label[for='" + this.opts.element.attr("id") + "']").text())
+ .attr('for', this.search.attr('id'));
+ this.opts.element.focus(this.bind(function () { this.focus(); }));
+
+ this.search.on("input paste", this.bind(function() {
+ if (this.search.attr('placeholder') && this.search.val().length == 0) return;
+ if (!this.isInterfaceEnabled()) return;
+ if (!this.opened()) {
+ this.open();
+ }
+ }));
+
+ this.search.attr("tabindex", this.elementTabIndex);
+
+ this.keydowns = 0;
+ this.search.on("keydown", this.bind(function (e) {
+ if (!this.isInterfaceEnabled()) return;
+
+ ++this.keydowns;
+ var selected = selection.find(".select2-search-choice-focus");
+ var prev = selected.prev(".select2-search-choice:not(.select2-locked)");
+ var next = selected.next(".select2-search-choice:not(.select2-locked)");
+ var pos = getCursorInfo(this.search);
+
+ if (selected.length &&
+ (e.which == KEY.LEFT || e.which == KEY.RIGHT || e.which == KEY.BACKSPACE || e.which == KEY.DELETE || e.which == KEY.ENTER)) {
+ var selectedChoice = selected;
+ if (e.which == KEY.LEFT && prev.length) {
+ selectedChoice = prev;
+ }
+ else if (e.which == KEY.RIGHT) {
+ selectedChoice = next.length ? next : null;
+ }
+ else if (e.which === KEY.BACKSPACE) {
+ if (this.unselect(selected.first())) {
+ this.search.width(10);
+ selectedChoice = prev.length ? prev : next;
+ }
+ } else if (e.which == KEY.DELETE) {
+ if (this.unselect(selected.first())) {
+ this.search.width(10);
+ selectedChoice = next.length ? next : null;
+ }
+ } else if (e.which == KEY.ENTER) {
+ selectedChoice = null;
+ }
+
+ this.selectChoice(selectedChoice);
+ killEvent(e);
+ if (!selectedChoice || !selectedChoice.length) {
+ this.open();
+ }
+ return;
+ } else if (((e.which === KEY.BACKSPACE && this.keydowns == 1)
+ || e.which == KEY.LEFT) && (pos.offset == 0 && !pos.length)) {
+
+ this.selectChoice(selection.find(".select2-search-choice:not(.select2-locked)").last());
+ killEvent(e);
+ return;
+ } else {
+ this.selectChoice(null);
+ }
+
+ if (this.opened()) {
+ switch (e.which) {
+ case KEY.UP:
+ case KEY.DOWN:
+ this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
+ killEvent(e);
+ return;
+ case KEY.ENTER:
+ this.selectHighlighted();
+ killEvent(e);
+ return;
+ case KEY.TAB:
+ this.selectHighlighted({noFocus:true});
+ this.close();
+ return;
+ case KEY.ESC:
+ this.cancel(e);
+ killEvent(e);
+ return;
+ }
+ }
+
+ if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
+ || e.which === KEY.BACKSPACE || e.which === KEY.ESC) {
+ return;
+ }
+
+ if (e.which === KEY.ENTER) {
+ if (this.opts.openOnEnter === false) {
+ return;
+ } else if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
+ return;
+ }
+ }
+
+ this.open();
+
+ if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
+ // prevent the page from scrolling
+ killEvent(e);
+ }
+
+ if (e.which === KEY.ENTER) {
+ // prevent form from being submitted
+ killEvent(e);
+ }
+
+ }));
+
+ this.search.on("keyup", this.bind(function (e) {
+ this.keydowns = 0;
+ this.resizeSearch();
+ })
+ );
+
+ this.search.on("blur", this.bind(function(e) {
+ this.container.removeClass("select2-container-active");
+ this.search.removeClass("select2-focused");
+ this.selectChoice(null);
+ if (!this.opened()) this.clearSearch();
+ e.stopImmediatePropagation();
+ this.opts.element.trigger($.Event("select2-blur"));
+ }));
+
+ this.container.on("click", selector, this.bind(function (e) {
+ if (!this.isInterfaceEnabled()) return;
+ if ($(e.target).closest(".select2-search-choice").length > 0) {
+ // clicked inside a select2 search choice, do not open
+ return;
+ }
+ this.selectChoice(null);
+ this.clearPlaceholder();
+ if (!this.container.hasClass("select2-container-active")) {
+ this.opts.element.trigger($.Event("select2-focus"));
+ }
+ this.open();
+ this.focusSearch();
+ e.preventDefault();
+ }));
+
+ this.container.on("focus", selector, this.bind(function () {
+ if (!this.isInterfaceEnabled()) return;
+ if (!this.container.hasClass("select2-container-active")) {
+ this.opts.element.trigger($.Event("select2-focus"));
+ }
+ this.container.addClass("select2-container-active");
+ this.dropdown.addClass("select2-drop-active");
+ this.clearPlaceholder();
+ }));
+
+ this.initContainerWidth();
+ this.opts.element.hide();
+
+ // set the placeholder if necessary
+ this.clearSearch();
+ },
+
+ // multi
+ enableInterface: function() {
+ if (this.parent.enableInterface.apply(this, arguments)) {
+ this.search.prop("disabled", !this.isInterfaceEnabled());
+ }
+ },
+
+ // multi
+ initSelection: function () {
+ var data;
+ if (this.opts.element.val() === "" && this.opts.element.text() === "") {
+ this.updateSelection([]);
+ this.close();
+ // set the placeholder if necessary
+ this.clearSearch();
+ }
+ if (this.select || this.opts.element.val() !== "") {
+ var self = this;
+ this.opts.initSelection.call(null, this.opts.element, function(data){
+ if (data !== undefined && data !== null) {
+ self.updateSelection(data);
+ self.close();
+ // set the placeholder if necessary
+ self.clearSearch();
+ }
+ });
+ }
+ },
+
+ // multi
+ clearSearch: function () {
+ var placeholder = this.getPlaceholder(),
+ maxWidth = this.getMaxSearchWidth();
+
+ if (placeholder !== undefined && this.getVal().length === 0 && this.search.hasClass("select2-focused") === false) {
+ this.search.val(placeholder).addClass("select2-default");
+ // stretch the search box to full width of the container so as much of the placeholder is visible as possible
+ // we could call this.resizeSearch(), but we do not because that requires a sizer and we do not want to create one so early because of a firefox bug, see #944
+ this.search.width(maxWidth > 0 ? maxWidth : this.container.css("width"));
+ } else {
+ this.search.val("").width(10);
+ }
+ },
+
+ // multi
+ clearPlaceholder: function () {
+ if (this.search.hasClass("select2-default")) {
+ this.search.val("").removeClass("select2-default");
+ }
+ },
+
+ // multi
+ opening: function () {
+ this.clearPlaceholder(); // should be done before super so placeholder is not used to search
+ this.resizeSearch();
+
+ this.parent.opening.apply(this, arguments);
+
+ this.focusSearch();
+
+ // initializes search's value with nextSearchTerm (if defined by user)
+ // ignore nextSearchTerm if the dropdown is opened by the user pressing a letter
+ if(this.search.val() === "") {
+ if(this.nextSearchTerm != undefined){
+ this.search.val(this.nextSearchTerm);
+ this.search.select();
+ }
+ }
+
+ this.updateResults(true);
+ if (this.opts.shouldFocusInput(this)) {
+ this.search.focus();
+ }
+ this.opts.element.trigger($.Event("select2-open"));
+ },
+
+ // multi
+ close: function () {
+ if (!this.opened()) return;
+ this.parent.close.apply(this, arguments);
+ },
+
+ // multi
+ focus: function () {
+ this.close();
+ this.search.focus();
+ },
+
+ // multi
+ isFocused: function () {
+ return this.search.hasClass("select2-focused");
+ },
+
+ // multi
+ updateSelection: function (data) {
+ var ids = [], filtered = [], self = this;
+
+ // filter out duplicates
+ $(data).each(function () {
+ if (indexOf(self.id(this), ids) < 0) {
+ ids.push(self.id(this));
+ filtered.push(this);
+ }
+ });
+ data = filtered;
+
+ this.selection.find(".select2-search-choice").remove();
+ $(data).each(function () {
+ self.addSelectedChoice(this);
+ });
+ self.postprocessResults();
+ },
+
+ // multi
+ tokenize: function() {
+ var input = this.search.val();
+ input = this.opts.tokenizer.call(this, input, this.data(), this.bind(this.onSelect), this.opts);
+ if (input != null && input != undefined) {
+ this.search.val(input);
+ if (input.length > 0) {
+ this.open();
+ }
+ }
+
+ },
+
+ // multi
+ onSelect: function (data, options) {
+
+ if (!this.triggerSelect(data) || data.text === "") { return; }
+
+ this.addSelectedChoice(data);
+
+ this.opts.element.trigger({ type: "selected", val: this.id(data), choice: data });
+
+ // keep track of the search's value before it gets cleared
+ this.nextSearchTerm = this.opts.nextSearchTerm(data, this.search.val());
+
+ this.clearSearch();
+ this.updateResults();
+
+ if (this.select || !this.opts.closeOnSelect) this.postprocessResults(data, false, this.opts.closeOnSelect===true);
+
+ if (this.opts.closeOnSelect) {
+ this.close();
+ this.search.width(10);
+ } else {
+ if (this.countSelectableResults()>0) {
+ this.search.width(10);
+ this.resizeSearch();
+ if (this.getMaximumSelectionSize() > 0 && this.val().length >= this.getMaximumSelectionSize()) {
+ // if we reached max selection size repaint the results so choices
+ // are replaced with the max selection reached message
+ this.updateResults(true);
+ } else {
+ // initializes search's value with nextSearchTerm and update search result
+ if(this.nextSearchTerm != undefined){
+ this.search.val(this.nextSearchTerm);
+ this.updateResults();
+ this.search.select();
+ }
+ }
+ this.positionDropdown();
+ } else {
+ // if nothing left to select close
+ this.close();
+ this.search.width(10);
+ }
+ }
+
+ // since its not possible to select an element that has already been
+ // added we do not need to check if this is a new element before firing change
+ this.triggerChange({ added: data });
+
+ if (!options || !options.noFocus)
+ this.focusSearch();
+ },
+
+ // multi
+ cancel: function () {
+ this.close();
+ this.focusSearch();
+ },
+
+ addSelectedChoice: function (data) {
+ var enableChoice = !data.locked,
+ enabledItem = $(
+ "" +
+ "
" +
+ " " +
+ " "),
+ disabledItem = $(
+ "" +
+ "
" +
+ " ");
+ var choice = enableChoice ? enabledItem : disabledItem,
+ id = this.id(data),
+ val = this.getVal(),
+ formatted,
+ cssClass;
+
+ formatted=this.opts.formatSelection(data, choice.find("div"), this.opts.escapeMarkup);
+ if (formatted != undefined) {
+ choice.find("div").replaceWith($("
").html(formatted));
+ }
+ cssClass=this.opts.formatSelectionCssClass(data, choice.find("div"));
+ if (cssClass != undefined) {
+ choice.addClass(cssClass);
+ }
+
+ if(enableChoice){
+ choice.find(".select2-search-choice-close")
+ .on("mousedown", killEvent)
+ .on("click dblclick", this.bind(function (e) {
+ if (!this.isInterfaceEnabled()) return;
+
+ this.unselect($(e.target));
+ this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
+ killEvent(e);
+ this.close();
+ this.focusSearch();
+ })).on("focus", this.bind(function () {
+ if (!this.isInterfaceEnabled()) return;
+ this.container.addClass("select2-container-active");
+ this.dropdown.addClass("select2-drop-active");
+ }));
+ }
+
+ choice.data("select2-data", data);
+ choice.insertBefore(this.searchContainer);
+
+ val.push(id);
+ this.setVal(val);
+ },
+
+ // multi
+ unselect: function (selected) {
+ var val = this.getVal(),
+ data,
+ index;
+ selected = selected.closest(".select2-search-choice");
+
+ if (selected.length === 0) {
+ throw "Invalid argument: " + selected + ". Must be .select2-search-choice";
+ }
+
+ data = selected.data("select2-data");
+
+ if (!data) {
+ // prevent a race condition when the 'x' is clicked really fast repeatedly the event can be queued
+ // and invoked on an element already removed
+ return;
+ }
+
+ var evt = $.Event("select2-removing");
+ evt.val = this.id(data);
+ evt.choice = data;
+ this.opts.element.trigger(evt);
+
+ if (evt.isDefaultPrevented()) {
+ return false;
+ }
+
+ while((index = indexOf(this.id(data), val)) >= 0) {
+ val.splice(index, 1);
+ this.setVal(val);
+ if (this.select) this.postprocessResults();
+ }
+
+ selected.remove();
+
+ this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
+ this.triggerChange({ removed: data });
+
+ return true;
+ },
+
+ // multi
+ postprocessResults: function (data, initial, noHighlightUpdate) {
+ var val = this.getVal(),
+ choices = this.results.find(".select2-result"),
+ compound = this.results.find(".select2-result-with-children"),
+ self = this;
+
+ choices.each2(function (i, choice) {
+ var id = self.id(choice.data("select2-data"));
+ if (indexOf(id, val) >= 0) {
+ choice.addClass("select2-selected");
+ // mark all children of the selected parent as selected
+ choice.find(".select2-result-selectable").addClass("select2-selected");
+ }
+ });
+
+ compound.each2(function(i, choice) {
+ // hide an optgroup if it doesn't have any selectable children
+ if (!choice.is('.select2-result-selectable')
+ && choice.find(".select2-result-selectable:not(.select2-selected)").length === 0) {
+ choice.addClass("select2-selected");
+ }
+ });
+
+ if (this.highlight() == -1 && noHighlightUpdate !== false && this.opts.closeOnSelect === true){
+ self.highlight(0);
+ }
+
+ //If all results are chosen render formatNoMatches
+ if(!this.opts.createSearchChoice && !choices.filter('.select2-result:not(.select2-selected)').length > 0){
+ if(!data || data && !data.more && this.results.find(".select2-no-results").length === 0) {
+ if (checkFormatter(self.opts.formatNoMatches, "formatNoMatches")) {
+ this.results.append("" + evaluate(self.opts.formatNoMatches, self.opts.element, self.search.val()) + " ");
+ }
+ }
+ }
+
+ },
+
+ // multi
+ getMaxSearchWidth: function() {
+ return this.selection.width() - getSideBorderPadding(this.search);
+ },
+
+ // multi
+ resizeSearch: function () {
+ var minimumWidth, left, maxWidth, containerLeft, searchWidth,
+ sideBorderPadding = getSideBorderPadding(this.search);
+
+ minimumWidth = measureTextWidth(this.search) + 10;
+
+ left = this.search.offset().left;
+
+ maxWidth = this.selection.width();
+ containerLeft = this.selection.offset().left;
+
+ searchWidth = maxWidth - (left - containerLeft) - sideBorderPadding;
+
+ if (searchWidth < minimumWidth) {
+ searchWidth = maxWidth - sideBorderPadding;
+ }
+
+ if (searchWidth < 40) {
+ searchWidth = maxWidth - sideBorderPadding;
+ }
+
+ if (searchWidth <= 0) {
+ searchWidth = minimumWidth;
+ }
+
+ this.search.width(Math.floor(searchWidth));
+ },
+
+ // multi
+ getVal: function () {
+ var val;
+ if (this.select) {
+ val = this.select.val();
+ return val === null ? [] : val;
+ } else {
+ val = this.opts.element.val();
+ return splitVal(val, this.opts.separator, this.opts.transformVal);
+ }
+ },
+
+ // multi
+ setVal: function (val) {
+ var unique;
+ if (this.select) {
+ this.select.val(val);
+ } else {
+ unique = [];
+ // filter out duplicates
+ $(val).each(function () {
+ if (indexOf(this, unique) < 0) unique.push(this);
+ });
+ this.opts.element.val(unique.length === 0 ? "" : unique.join(this.opts.separator));
+ }
+ },
+
+ // multi
+ buildChangeDetails: function (old, current) {
+ var current = current.slice(0),
+ old = old.slice(0);
+
+ // remove intersection from each array
+ for (var i = 0; i < current.length; i++) {
+ for (var j = 0; j < old.length; j++) {
+ if (equal(this.opts.id(current[i]), this.opts.id(old[j]))) {
+ current.splice(i, 1);
+ if(i>0){
+ i--;
+ }
+ old.splice(j, 1);
+ j--;
+ }
+ }
+ }
+
+ return {added: current, removed: old};
+ },
+
+
+ // multi
+ val: function (val, triggerChange) {
+ var oldData, self=this;
+
+ if (arguments.length === 0) {
+ return this.getVal();
+ }
+
+ oldData=this.data();
+ if (!oldData.length) oldData=[];
+
+ // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
+ if (!val && val !== 0) {
+ this.opts.element.val("");
+ this.updateSelection([]);
+ this.clearSearch();
+ if (triggerChange) {
+ this.triggerChange({added: this.data(), removed: oldData});
+ }
+ return;
+ }
+
+ // val is a list of ids
+ this.setVal(val);
+
+ if (this.select) {
+ this.opts.initSelection(this.select, this.bind(this.updateSelection));
+ if (triggerChange) {
+ this.triggerChange(this.buildChangeDetails(oldData, this.data()));
+ }
+ } else {
+ if (this.opts.initSelection === undefined) {
+ throw new Error("val() cannot be called if initSelection() is not defined");
+ }
+
+ this.opts.initSelection(this.opts.element, function(data){
+ var ids=$.map(data, self.id);
+ self.setVal(ids);
+ self.updateSelection(data);
+ self.clearSearch();
+ if (triggerChange) {
+ self.triggerChange(self.buildChangeDetails(oldData, self.data()));
+ }
+ });
+ }
+ this.clearSearch();
+ },
+
+ // multi
+ onSortStart: function() {
+ if (this.select) {
+ throw new Error("Sorting of elements is not supported when attached to . Attach to instead.");
+ }
+
+ // collapse search field into 0 width so its container can be collapsed as well
+ this.search.width(0);
+ // hide the container
+ this.searchContainer.hide();
+ },
+
+ // multi
+ onSortEnd:function() {
+
+ var val=[], self=this;
+
+ // show search and move it to the end of the list
+ this.searchContainer.show();
+ // make sure the search container is the last item in the list
+ this.searchContainer.appendTo(this.searchContainer.parent());
+ // since we collapsed the width in dragStarted, we resize it here
+ this.resizeSearch();
+
+ // update selection
+ this.selection.find(".select2-search-choice").each(function() {
+ val.push(self.opts.id($(this).data("select2-data")));
+ });
+ this.setVal(val);
+ this.triggerChange();
+ },
+
+ // multi
+ data: function(values, triggerChange) {
+ var self=this, ids, old;
+ if (arguments.length === 0) {
+ return this.selection
+ .children(".select2-search-choice")
+ .map(function() { return $(this).data("select2-data"); })
+ .get();
+ } else {
+ old = this.data();
+ if (!values) { values = []; }
+ ids = $.map(values, function(e) { return self.opts.id(e); });
+ this.setVal(ids);
+ this.updateSelection(values);
+ this.clearSearch();
+ if (triggerChange) {
+ this.triggerChange(this.buildChangeDetails(old, this.data()));
+ }
+ }
+ }
+ });
+
+ $.fn.select2 = function () {
+
+ var args = Array.prototype.slice.call(arguments, 0),
+ opts,
+ select2,
+ method, value, multiple,
+ allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "disable", "readonly", "positionDropdown", "data", "search"],
+ valueMethods = ["opened", "isFocused", "container", "dropdown"],
+ propertyMethods = ["val", "data"],
+ methodsMap = { search: "externalSearch" };
+
+ this.each(function () {
+ if (args.length === 0 || typeof(args[0]) === "object") {
+ opts = args.length === 0 ? {} : $.extend({}, args[0]);
+ opts.element = $(this);
+
+ if (opts.element.get(0).tagName.toLowerCase() === "select") {
+ multiple = opts.element.prop("multiple");
+ } else {
+ multiple = opts.multiple || false;
+ if ("tags" in opts) {opts.multiple = multiple = true;}
+ }
+
+ select2 = multiple ? new window.Select2["class"].multi() : new window.Select2["class"].single();
+ select2.init(opts);
+ } else if (typeof(args[0]) === "string") {
+
+ if (indexOf(args[0], allowedMethods) < 0) {
+ throw "Unknown method: " + args[0];
+ }
+
+ value = undefined;
+ select2 = $(this).data("select2");
+ if (select2 === undefined) return;
+
+ method=args[0];
+
+ if (method === "container") {
+ value = select2.container;
+ } else if (method === "dropdown") {
+ value = select2.dropdown;
+ } else {
+ if (methodsMap[method]) method = methodsMap[method];
+
+ value = select2[method].apply(select2, args.slice(1));
+ }
+ if (indexOf(args[0], valueMethods) >= 0
+ || (indexOf(args[0], propertyMethods) >= 0 && args.length == 1)) {
+ return false; // abort the iteration, ready to return first matched value
+ }
+ } else {
+ throw "Invalid arguments to select2 plugin: " + args;
+ }
+ });
+ return (value === undefined) ? this : value;
+ };
+
+ // plugin defaults, accessible to users
+ $.fn.select2.defaults = {
+ width: "copy",
+ loadMorePadding: 0,
+ closeOnSelect: true,
+ openOnEnter: true,
+ containerCss: {},
+ dropdownCss: {},
+ containerCssClass: "",
+ dropdownCssClass: "",
+ formatResult: function(result, container, query, escapeMarkup) {
+ var markup=[];
+ markMatch(this.text(result), query.term, markup, escapeMarkup);
+ return markup.join("");
+ },
+ transformVal: function(val) {
+ return $.trim(val);
+ },
+ formatSelection: function (data, container, escapeMarkup) {
+ return data ? escapeMarkup(this.text(data)) : undefined;
+ },
+ sortResults: function (results, container, query) {
+ return results;
+ },
+ formatResultCssClass: function(data) {return data.css;},
+ formatSelectionCssClass: function(data, container) {return undefined;},
+ minimumResultsForSearch: 0,
+ minimumInputLength: 0,
+ maximumInputLength: null,
+ maximumSelectionSize: 0,
+ id: function (e) { return e == undefined ? null : e.id; },
+ text: function (e) {
+ if (e && this.data && this.data.text) {
+ if ($.isFunction(this.data.text)) {
+ return this.data.text(e);
+ } else {
+ return e[this.data.text];
+ }
+ } else {
+ return e.text;
+ }
+ },
+ matcher: function(term, text) {
+ return stripDiacritics(''+text).toUpperCase().indexOf(stripDiacritics(''+term).toUpperCase()) >= 0;
+ },
+ separator: ",",
+ tokenSeparators: [],
+ tokenizer: defaultTokenizer,
+ escapeMarkup: defaultEscapeMarkup,
+ blurOnChange: false,
+ selectOnBlur: false,
+ adaptContainerCssClass: function(c) { return c; },
+ adaptDropdownCssClass: function(c) { return null; },
+ nextSearchTerm: function(selectedObject, currentSearchTerm) { return undefined; },
+ searchInputPlaceholder: '',
+ createSearchChoicePosition: 'top',
+ shouldFocusInput: function (instance) {
+ // Attempt to detect touch devices
+ var supportsTouchEvents = (('ontouchstart' in window) ||
+ (navigator.msMaxTouchPoints > 0));
+
+ // Only devices which support touch events should be special cased
+ if (!supportsTouchEvents) {
+ return true;
+ }
+
+ // Never focus the input if search is disabled
+ if (instance.opts.minimumResultsForSearch < 0) {
+ return false;
+ }
+
+ return true;
+ }
+ };
+
+ $.fn.select2.locales = [];
+
+ $.fn.select2.locales['en'] = {
+ formatMatches: function (matches) { if (matches === 1) { return "One result is available, press enter to select it."; } return matches + " results are available, use up and down arrow keys to navigate."; },
+ formatNoMatches: function () { return "No matches found"; },
+ formatAjaxError: function (jqXHR, textStatus, errorThrown) { return "Loading failed"; },
+ formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " or more character" + (n == 1 ? "" : "s"); },
+ formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1 ? "" : "s"); },
+ formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); },
+ formatLoadMore: function (pageNumber) { return "Loading more results…"; },
+ formatSearching: function () { return "Searching…"; }
+ };
+
+ $.extend($.fn.select2.defaults, $.fn.select2.locales['en']);
+
+ $.fn.select2.ajaxDefaults = {
+ transport: $.ajax,
+ params: {
+ type: "GET",
+ cache: false,
+ dataType: "json"
+ }
+ };
+
+ // exports
+ window.Select2 = {
+ query: {
+ ajax: ajax,
+ local: local,
+ tags: tags
+ }, util: {
+ debounce: debounce,
+ markMatch: markMatch,
+ escapeMarkup: defaultEscapeMarkup,
+ stripDiacritics: stripDiacritics
+ }, "class": {
+ "abstract": AbstractSelect2,
+ "single": SingleSelect2,
+ "multi": MultiSelect2
+ }
+ };
+
+}(jQuery));
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.min.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.min.js
new file mode 100644
index 0000000..b56419e
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.min.js
@@ -0,0 +1,23 @@
+/*
+Copyright 2014 Igor Vaynberg
+
+Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014
+
+This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
+General Public License version 2 (the "GPL License"). You may choose either license to govern your
+use of this software only upon the condition that you accept all of the terms of either the Apache
+License or the GPL License.
+
+You may obtain a copy of the Apache License and the GPL License at:
+
+http://www.apache.org/licenses/LICENSE-2.0
+http://www.gnu.org/licenses/gpl-2.0.html
+
+Unless required by applicable law or agreed to in writing, software distributed under the Apache License
+or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+either express or implied. See the Apache License and the GPL License for the specific language governing
+permissions and limitations under the Apache License and the GPL License.
+*/
+!function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++dc;c+=1)if(r(a,b[c]))return c;return-1}function q(){var b=a(l);b.appendTo(document.body);var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function r(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function s(a,b,c){var d,e,f;if(null===a||a.length<1)return[];for(d=a.split(b),e=0,f=d.length;f>e;e+=1)d[e]=c(d[e]);return d}function t(a){return a.outerWidth(!1)-a.width()}function u(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function v(c){c.on("mousemove",function(c){var d=h;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function w(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function x(a,b){var c=w(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){p(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus();var e=b.offsetWidth>0||b.offsetHeight>0;e&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!g){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);g=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),g.attr("class","select2-sizer"),a(document.body).append(g)}return g.text(b.val()),g.width()}function D(b,c,d){var e,g,f=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(g))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=o(a.toUpperCase()).indexOf(o(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push(""),c.push(d(a.substring(e,e+f))),c.push(" "),c.push(d(a.substring(e+f,a.length))),void 0)}function F(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&"function"==typeof e.abort&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page,i);i.callback(b)},error:function(a,b,c){var d={hasError:!0,jqXHR:a,textStatus:b,errorThrown:c};i.callback(d)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?(b.callback(c()),void 0):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),b.callback(e),void 0)}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]},h=d?c(e):c;a.isArray(h)&&(a(h).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g))}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;if("string"==typeof b)return!0;throw new Error(c+" must be a string, function, or falsy value")}function K(b,c){if(a.isFunction(b)){var d=Array.prototype.slice.call(arguments,2);return b.apply(c,d)}return b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(r(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(){var b=this;a.each(arguments,function(a,c){b[c].remove(),b[c]=null})}function O(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,i,j,h={x:0,y:0},k={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case k.LEFT:case k.RIGHT:case k.UP:case k.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case k.SHIFT:case k.CTRL:case k.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="
",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z","\u0386":"\u0391","\u0388":"\u0395","\u0389":"\u0397","\u038a":"\u0399","\u03aa":"\u0399","\u038c":"\u039f","\u038e":"\u03a5","\u03ab":"\u03a5","\u038f":"\u03a9","\u03ac":"\u03b1","\u03ad":"\u03b5","\u03ae":"\u03b7","\u03af":"\u03b9","\u03ca":"\u03b9","\u0390":"\u03b9","\u03cc":"\u03bf","\u03cd":"\u03c5","\u03cb":"\u03c5","\u03b0":"\u03c5","\u03c9":"\u03c9","\u03c2":"\u03c3"};i=a(document),f=function(){var a=1;return function(){return a++}}(),c=O(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,g=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=a(".select2-hidden-accessible"),0==this.liveRegion.length&&(this.liveRegion=a("",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body)),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+f()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",c.element.attr("title")),this.body=a(document.body),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss,this.opts.element)),this.container.addClass(K(c.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",A),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",A),this.results=d=this.container.find(g),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),v(this.results),this.dropdown.on("mousemove-filtered",g,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",g,this.bind(function(a){this._touchEvent=!0,this.highlightUnderEvent(a)})),this.dropdown.on("touchmove",g,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",g,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),x(80,this.results),this.dropdown.on("scroll-debounced",g,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),u(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",g,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(a){a.stopPropagation()}),this.nextSearchTerm=b,a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),j=j||q(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",c.searchInputPlaceholder)},destroy:function(){var a=this.opts.element,c=a.data("select2"),d=this;this.close(),a.length&&a[0].detachEvent&&d._sync&&a.each(function(){d._sync&&this.detachEvent("onpropertychange",d._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,c!==b&&(c.container.remove(),c.liveRegion.remove(),c.dropdown.remove(),a.show().removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show()),N.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:r(a.attr("locked"),"locked")||r(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,g,h,i=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a element.")}),c=a.extend({},{populateResults:function(d,e,g){var h,j=this.opts.id,k=this.liveRegion;h=function(d,e,l){var m,n,o,p,q,r,s,t,u,v;d=c.sortResults(d,e,g);var w=[];for(m=0,n=d.length;n>m;m+=1)o=d[m],q=o.disabled===!0,p=!q&&j(o)!==b,r=o.children&&o.children.length>0,s=a(" "),s.addClass("select2-results-dept-"+l),s.addClass("select2-result"),s.addClass(p?"select2-result-selectable":"select2-result-unselectable"),q&&s.addClass("select2-disabled"),r&&s.addClass("select2-result-with-children"),s.addClass(i.opts.formatResultCssClass(o)),s.attr("role","presentation"),t=a(document.createElement("div")),t.addClass("select2-result-label"),t.attr("id","select2-result-label-"+f()),t.attr("role","option"),v=c.formatResult(o,t,g,i.opts.escapeMarkup),v!==b&&(t.html(v),s.append(t)),r&&(u=a(""),u.addClass("select2-result-sub"),h(o.children,u,l+1),s.append(u)),s.data("select2-data",o),w.push(s[0]);e.append(w),k.text(c.formatMatches(d.length))},h(e,d,0)}},a.fn.select2.defaults,c),"function"!=typeof c.id&&(g=c.id,c.id=function(a){return a[g]}),a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(e?(c.query=this.bind(function(a){var f,g,h,c={results:[],more:!1},e=a.term;h=function(b,c){var d;b.is("option")?a.matcher(e,b.text(),b)&&c.push(i.optionToData(b)):b.is("optgroup")&&(d=i.optionToData(b),b.children().each2(function(a,b){h(b,d.children)}),d.children.length>0&&c.push(d))},f=d.children(),this.getPlaceholder()!==b&&f.length>0&&(g=this.getPlaceholderOption(),g&&(f=f.not(g))),f.each2(function(a,b){h(b,c.results)}),a.callback(c)}),c.id=function(a){return a.id}):"query"in c||("ajax"in c?(h=c.element.data("ajax-url"),h&&h.length>0&&(c.ajax.url=h),c.query=G.call(c.element,c.ajax)):"data"in c?c.query=H(c.data):"tags"in c&&(c.query=I(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(b){return{id:a.trim(b),text:a.trim(b)}}),c.initSelection===b&&(c.initSelection=function(b,d){var e=[];a(s(b.val(),c.separator,c.transformVal)).each(function(){var b={id:this,text:this},d=c.tags;a.isFunction(d)&&(d=d()),a(d).each(function(){return r(this.id,b.id)?(b=this,!1):void 0}),e.push(b)}),d(e)}))),"function"!=typeof c.query)throw"query function not defined for Select2 "+c.element.attr("id");if("top"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.unshift(b)};else if("bottom"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.push(b)};else if("function"!=typeof c.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return c},monitorSource:function(){var d,c=this.opts.element,e=this;c.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var a=c.prop("disabled");a===b&&(a=!1),this.enable(!a);var d=c.prop("readonly");d===b&&(d=!1),this.readonly(d),this.container&&(D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(K(this.opts.containerCssClass,this.opts.element))),this.dropdown&&(D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(this.opts.dropdownCssClass,this.opts.element)))}),c.length&&c[0].attachEvent&&c.each(function(){this.attachEvent("onpropertychange",e._sync)}),d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,d!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new d(function(b){a.each(b,e._sync)}),this.propertyObserver.observe(c.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2-selecting",{val:this.id(b),object:b,choice:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){a===b&&(a=!0),this._enabled!==a&&(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(a){a===b&&(a=!1),this._readonly!==a&&(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface())},opened:function(){return this.container?this.container.hasClass("select2-dropdown-open"):!1},positionDropdown:function(){var v,w,x,y,z,b=this.dropdown,c=this.container,d=c.offset(),e=c.outerHeight(!1),f=c.outerWidth(!1),g=b.outerHeight(!1),h=a(window),i=h.width(),k=h.height(),l=h.scrollLeft()+i,m=h.scrollTop()+k,n=d.top+e,o=d.left,p=m>=n+g,q=d.top-g>=h.scrollTop(),r=b.outerWidth(!1),s=function(){return l>=o+r},t=function(){return d.left+l+c.outerWidth(!1)>r},u=b.hasClass("select2-drop-above");u?(w=!0,!q&&p&&(x=!0,w=!1)):(w=!1,!p&&q&&(x=!0,w=!0)),x&&(b.hide(),d=this.container.offset(),e=this.container.outerHeight(!1),f=this.container.outerWidth(!1),g=b.outerHeight(!1),l=h.scrollLeft()+i,m=h.scrollTop()+k,n=d.top+e,o=d.left,r=b.outerWidth(!1),b.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(z=a(".select2-results",b)[0],b.addClass("select2-drop-auto-width"),b.css("width",""),r=b.outerWidth(!1)+(z.scrollHeight===z.clientHeight?0:j.width),r>f?f=r:r=f,g=b.outerHeight(!1)):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(v=this.body.offset(),n-=v.top,o-=v.left),!s()&&t()&&(o=d.left+this.container.outerWidth(!1)-r),y={left:o,width:f},w?(y.top=d.top-g,y.bottom="auto",this.container.addClass("select2-drop-above"),b.addClass("select2-drop-above")):(y.top=n,y.bottom="auto",this.container.removeClass("select2-drop-above"),b.removeClass("select2-drop-above")),y=a.extend(y,K(this.opts.dropdownCss,this.opts.element)),b.css(y)},shouldOpen:function(){var b;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(b=a.Event("select2-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),i.on("mousemove.select2Event",function(a){h.x=a.pageX,h.y=a.pageY}),!0):!1},opening:function(){var f,b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),f=a("#select2-drop-mask"),0===f.length&&(f=a(document.createElement("div")),f.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),f.hide(),f.appendTo(this.body),f.on("mousedown touchstart click",function(b){n(f);var d,c=a("#select2-drop");c.length>0&&(d=c.data("select2"),d.opts.selectOnBlur&&d.selectHighlighted({noFocus:!0}),d.close(),b.preventDefault(),b.stopPropagation())})),this.dropdown.prev()[0]!==f[0]&&this.dropdown.before(f),a("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),f.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var g=this;this.container.parents().add(window).each(function(){a(this).on(d+" "+c+" "+e,function(){g.opened()&&g.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),i.off("mousemove.select2Event"),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(a.Event("select2-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return K(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var c,d,e,f,g,h,i,j,b=this.results;if(d=this.highlight(),!(0>d)){if(0==d)return b.scrollTop(0),void 0;c=this.findHighlightableChoices().find(".select2-result-label"),e=a(c[d]),j=(e.offset()||{}).top||0,f=j+e.outerHeight(!0),d===c.length-1&&(i=b.find("li.select2-more-results"),i.length>0&&(f=i.offset().top+i.outerHeight(!0))),g=b.offset().top+b.outerHeight(!1),f>g&&b.scrollTop(b.scrollTop()+(f-g)),h=j-b.offset().top,0>h&&"none"!=e.css("display")&&b.scrollTop(b.scrollTop()+h)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&d=c.length&&(b=c.length-1),0>b&&(b=0),this.removeHighlight(),d=a(c[b]),d.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",d.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(d.text()),e=d.data("select2-data"),e&&this.opts.element.trigger({type:"select2-highlight",val:this.id(e),choice:e}),void 0)},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(b){var c=a(b.target).closest(".select2-result-selectable");if(c.length>0&&!c.is(".select2-highlighted")){var d=this.findHighlightableChoices();this.highlight(d.index(c))}else 0==c.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var c,a=this.results,b=a.find("li.select2-more-results"),d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-a.height(),c<=this.opts.loadMorePadding&&(b.addClass("select2-active"),this.opts.query({element:this.opts.element,term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),e.postprocessResults(c,!1,!1),c.more===!0?(b.detach().appendTo(a).html(e.opts.escapeMarkup(K(e.opts.formatLoadMore,e.opts.element,d+1))),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d,e.context=c.context,this.opts.element.trigger({type:"select2-loaded",items:c}))})})))},tokenize:function(){},updateResults:function(c){function m(){d.removeClass("select2-active"),h.positionDropdown(),e.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?h.liveRegion.text(e.text()):h.liveRegion.text(h.opts.formatMatches(e.find('.select2-result-selectable:not(".select2-selected")').length))}function n(a){e.html(a),m()}var g,i,l,d=this.search,e=this.results,f=this.opts,h=this,j=d.val(),k=a.data(this.container,"select2-last-term");if((c===!0||!k||!r(j,k))&&(a.data(this.container,"select2-last-term",j),c===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var o=this.getMaximumSelectionSize();if(o>=1&&(g=this.data(),a.isArray(g)&&g.length>=o&&J(f.formatSelectionTooBig,"formatSelectionTooBig")))return n(""+K(f.formatSelectionTooBig,f.element,o)+" "),void 0;if(d.val().length"+K(f.formatInputTooShort,f.element,d.val(),f.minimumInputLength)+""):n(""),c&&this.showSearch&&this.showSearch(!0),void 0;if(f.maximumInputLength&&d.val().length>f.maximumInputLength)return J(f.formatInputTooLong,"formatInputTooLong")?n(""+K(f.formatInputTooLong,f.element,d.val(),f.maximumInputLength)+" "):n(""),void 0;f.formatSearching&&0===this.findHighlightableChoices().length&&n(""+K(f.formatSearching,f.element)+" "),d.addClass("select2-active"),this.removeHighlight(),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;if(l==this.queryCount){if(!this.opened())return this.search.removeClass("select2-active"),void 0;if(g.hasError!==b&&J(f.formatAjaxError,"formatAjaxError"))return n(""+K(f.formatAjaxError,f.element,g.jqXHR,g.textStatus,g.errorThrown)+" "),void 0;if(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return r(h.id(this),h.id(i))}).length&&this.opts.createSearchChoicePosition(g.results,i)),0===g.results.length&&J(f.formatNoMatches,"formatNoMatches"))return n(""+K(f.formatNoMatches,f.element,d.val())+" "),void 0;e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&J(f.formatLoadMore,"formatLoadMore")&&(e.append(""+f.escapeMarkup(K(f.formatLoadMore,f.element,this.resultsPage))+" "),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),m(),this.opts.element.trigger({type:"select2-loaded",items:g})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(a){if(this._touchMoved)return this.clearTouchMoved(),void 0;var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var c=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&c||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.trim(c.text())&&""===c.val())return c}},initContainerWidth:function(){function c(){var c,d,e,f,g,h;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(c=this.opts.element.attr("style"),c!==b)for(d=c.split(";"),f=0,g=d.length;g>f;f+=1)if(h=d[f].replace(/\s/g,""),e=h.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==e&&e.length>=1)return e[1];return"resolve"===this.opts.width?(c=this.opts.element.css("width"),c.indexOf("%")>0?c:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var d=c.call(this);null!==d&&this.container.css("width",d)}}),d=O(c,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container"}).html([""," "," "," "," "," ",""].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var c,d,e;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),c=this.search.get(0),c.createTextRange?(d=c.createTextRange(),d.collapse(!1),d.select()):c.setSelectionRange&&(e=this.search.val().length,c.setSelectionRange(e,e))),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"selection","focusser")},initContainer:function(){var b,g,c=this.container,d=this.dropdown,e=f();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=c.find(".select2-choice"),this.focusser=c.find(".select2-focusser"),b.find(".select2-chosen").attr("id","select2-chosen-"+e),this.focusser.attr("aria-labelledby","select2-chosen-"+e),this.results.attr("id","select2-results-"+e),this.search.attr("aria-owns","select2-results-"+e),this.focusser.attr("id","s2id_autogen"+e),g=a("label[for='"+this.opts.element.attr("id")+"']"),this.opts.element.focus(this.bind(function(){this.focus()})),this.focusser.prev().text(g.text()).attr("for",this.focusser.attr("id"));var h=this.opts.element.attr("title");this.opts.element.attr("title",h||g.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(a("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&229!=a.keyCode){if(a.which===k.PAGE_UP||a.which===k.PAGE_DOWN)return A(a),void 0;switch(a.which){case k.UP:case k.DOWN:return this.moveHighlight(a.which===k.UP?-1:1),A(a),void 0;case k.ENTER:return this.selectHighlighted(),A(a),void 0;case k.TAB:return this.selectHighlighted({noFocus:!0}),void 0;case k.ESC:return this.cancel(a),A(a),void 0}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==k.TAB&&!k.isControl(a)&&!k.isFunctionKey(a)&&a.which!==k.ESC){if(this.opts.openOnEnter===!1&&a.which===k.ENTER)return A(a),void 0;if(a.which==k.DOWN||a.which==k.UP||a.which==k.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),A(a),void 0}return a.which==k.DELETE||a.which==k.BACKSPACE?(this.opts.allowClear&&this.clear(),A(a),void 0):void 0}})),u(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown touchstart","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),B(a),this.close(),this.selection&&this.selection.focus())})),b.on("mousedown touchstart",this.bind(function(c){n(b),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),A(c)})),d.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),b.on("focus",this.bind(function(a){A(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.hide(),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2-data");if(c){var d=a.Event("select2-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder(),c.nextSearchTerm=c.opts.nextSearchTerm(a,c.search.val()))})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()===b?!1:(a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val()},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected&&!this.disabled});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=r(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){return r(e.id(b.data("select2-data")),e.opts.element.val())?(d=a,!1):void 0}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var g=this.opts.minimumResultsForSearch;g>=0&&this.showSearch(L(a.results)>=g)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.close(),b&&b.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),r(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),c.empty(),null!==a&&(d=this.opts.formatSelection(a,c,this.opts.escapeMarkup)),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1]),this.select)this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return this.clear(c),void 0;if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2-data"),c==b&&(c=null),c):(arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),e=O(c,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["",""].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=s(c.val(),b.separator,b.transformVal),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return r(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;c0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",b,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.hide(),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c=[],d=[],e=this;a(b).each(function(){p(e.id(this),c)<0&&(c.push(e.id(this)),d.push(this))}),b=d,this.selection.find(".select2-search-choice").remove(),a(b).each(function(){e.addSelectedChoice(this)}),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,c){this.triggerSelect(a)&&""!==a.text&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.clearSearch(),this.updateResults(),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),c&&c.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(c){var j,k,d=!c.locked,e=a("
"),f=a("
"),g=d?e:f,h=this.id(c),i=this.getVal();j=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),j!=b&&g.find("div").replaceWith(a("
").html(j)),k=this.opts.formatSelectionCssClass(c,g.find("div")),k!=b&&g.addClass(k),d&&g.find(".select2-search-choice-close").on("mousedown",A).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),A(b),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),g.data("select2-data",c),g.insertBefore(this.searchContainer),i.push(h),this.setVal(i)},unselect:function(b){var d,e,c=this.getVal();if(b=b.closest(".select2-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2-search-choice";if(d=b.data("select2-data")){var f=a.Event("select2-removing");if(f.val=this.id(d),f.choice=d,this.opts.element.trigger(f),f.isDefaultPrevented())return!1;for(;(e=p(this.id(d),c))>=0;)c.splice(e,1),this.setVal(c),this.select&&this.postprocessResults();return b.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(d),choice:d}),this.triggerChange({removed:d}),!0}},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2-result"),f=this.results.find(".select2-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2-data"));p(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),f.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),-1==this.highlight()&&c!==!1&&this.opts.closeOnSelect===!0&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&J(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append(""+K(g.opts.formatNoMatches,g.opts.element,g.search.val())+" ")},getMaxSearchWidth:function(){return this.selection.width()-t(this.search)},resizeSearch:function(){var a,b,c,d,e,f=t(this.search);a=C(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),s(a,this.opts.separator,this.opts.transformVal))},setVal:function(b){var c;this.select?this.select.val(b):(c=[],a(b).each(function(){p(this,c)<0&&c.push(this)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator)))},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;c0&&c--,a.splice(d,1),d--);return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),d&&this.triggerChange({added:this.data(),removed:e}),void 0;if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to . Attach to instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var e,f,d=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(f=this.data(),b||(b=[]),e=a.map(b,function(a){return d.opts.id(a)}),this.setVal(e),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(f,this.data())),void 0)}}),a.fn.select2=function(){var d,e,f,g,h,c=Array.prototype.slice.call(arguments,0),i=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],j=["opened","isFocused","container","dropdown"],k=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?h=d.element.prop("multiple"):(h=d.multiple||!1,"tags"in d&&(d.multiple=h=!0)),e=h?new window.Select2["class"].multi:new window.Select2["class"].single,e.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(p(c[0],i)<0)throw"Unknown method: "+c[0];if(g=b,e=a(this).data("select2"),e===b)return;if(f=c[0],"container"===f?g=e.container:"dropdown"===f?g=e.dropdown:(l[f]&&(f=l[f]),g=e[f].apply(e,c.slice(1))),p(c[0],j)>=0||p(c[0],k)>=0&&1==c.length)return!1}}),g===b?this:g},a.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return E(this.text(a),c.term,e,d),e.join("")},transformVal:function(b){return a.trim(b)},formatSelection:function(a,c,d){return a?d(this.text(a)):b},sortResults:function(a){return a},formatResultCssClass:function(a){return a.css},formatSelectionCssClass:function(){return b},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a==b?null:a.id},text:function(b){return b&&this.data&&this.data.text?a.isFunction(this.data.text)?this.data.text(b):b[this.data.text]:b.text
+},matcher:function(a,b){return o(""+b).toUpperCase().indexOf(o(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:M,escapeMarkup:F,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return b},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(a){var b="ontouchstart"in window||navigator.msMaxTouchPoints>0;return b?a.opts.minimumResultsForSearch<0?!1:!0:!0}},a.fn.select2.locales=[],a.fn.select2.locales.en={formatMatches:function(a){return 1===a?"One result is available, press enter to select it.":a+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatAjaxError:function(){return"Loading failed"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" or more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results\u2026"},formatSearching:function(){return"Searching\u2026"}},a.extend(a.fn.select2.defaults,a.fn.select2.locales.en),a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:G,local:H,tags:I},util:{debounce:w,markMatch:E,escapeMarkup:F,stripDiacritics:o},"class":{"abstract":c,single:d,multi:e}}}}(jQuery);
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.png b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.png
new file mode 100644
index 0000000..88566bf
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.png differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2x2.png b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2x2.png
new file mode 100644
index 0000000..36c2cc2
Binary files /dev/null and b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2x2.png differ
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.css b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.css
new file mode 100644
index 0000000..447b2b8
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.css
@@ -0,0 +1,484 @@
+.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;
+ height: 1px !important;
+ margin: -1px !important;
+ overflow: hidden !important;
+ padding: 0 !important;
+ position: absolute !important;
+ width: 1px !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__placeholder {
+ color: #999;
+ margin-top: 5px;
+ float: left; }
+ .select2-container--default .select2-selection--multiple .select2-selection__clear {
+ cursor: pointer;
+ float: right;
+ font-weight: bold;
+ margin-top: 5px;
+ margin-right: 10px; }
+ .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-selection__placeholder, .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; }
+
+.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
+ 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; }
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js
new file mode 100644
index 0000000..e750834
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js
@@ -0,0 +1,6436 @@
+/*!
+ * Select2 4.0.3
+ * https://select2.github.io
+ *
+ * Released under the MIT license
+ * https://github.com/select2/select2/blob/master/LICENSE.md
+ */
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS
+ factory(require('jquery'));
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function (jQuery) {
+ // This is needed so we can catch the AMD loader configuration and use it
+ // The inner file should be wrapped (by `banner.start.js`) in a function that
+ // returns the AMD loader references.
+ var S2 =
+(function () {
+ // Restore the Select2 AMD loader so it can be used
+ // Needed mostly in the language files, where the loader is not inserted
+ if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
+ var S2 = jQuery.fn.select2.amd;
+ }
+var S2;(function () { if (!S2 || !S2.requirejs) {
+if (!S2) { S2 = {}; } else { require = S2; }
+/**
+ * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/almond for details
+ */
+//Going sloppy to avoid 'use strict' string cost, but strict practices should
+//be followed.
+/*jslint sloppy: true */
+/*global setTimeout: false */
+
+var requirejs, require, define;
+(function (undef) {
+ var main, req, makeMap, handlers,
+ defined = {},
+ waiting = {},
+ config = {},
+ defining = {},
+ hasOwn = Object.prototype.hasOwnProperty,
+ aps = [].slice,
+ jsSuffixRegExp = /\.js$/;
+
+ function hasProp(obj, prop) {
+ return hasOwn.call(obj, prop);
+ }
+
+ /**
+ * Given a relative module name, like ./something, normalize it to
+ * a real name that can be mapped to a path.
+ * @param {String} name the relative name
+ * @param {String} baseName a real name that the name arg is relative
+ * to.
+ * @returns {String} normalized name
+ */
+ function normalize(name, baseName) {
+ var nameParts, nameSegment, mapValue, foundMap, lastIndex,
+ foundI, foundStarMap, starI, i, j, part,
+ baseParts = baseName && baseName.split("/"),
+ map = config.map,
+ starMap = (map && map['*']) || {};
+
+ //Adjust any relative paths.
+ if (name && name.charAt(0) === ".") {
+ //If have a base name, try to normalize against it,
+ //otherwise, assume it is a top-level require that will
+ //be relative to baseUrl in the end.
+ if (baseName) {
+ name = name.split('/');
+ lastIndex = name.length - 1;
+
+ // Node .js allowance:
+ if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
+ name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
+ }
+
+ //Lop off the last part of baseParts, so that . matches the
+ //"directory" and not name of the baseName's module. For instance,
+ //baseName of "one/two/three", maps to "one/two/three.js", but we
+ //want the directory, "one/two" for this normalization.
+ name = baseParts.slice(0, baseParts.length - 1).concat(name);
+
+ //start trimDots
+ for (i = 0; i < name.length; i += 1) {
+ part = name[i];
+ if (part === ".") {
+ name.splice(i, 1);
+ i -= 1;
+ } else if (part === "..") {
+ if (i === 1 && (name[2] === '..' || name[0] === '..')) {
+ //End of the line. Keep at least one non-dot
+ //path segment at the front so it can be mapped
+ //correctly to disk. Otherwise, there is likely
+ //no path mapping for a path starting with '..'.
+ //This can still fail, but catches the most reasonable
+ //uses of ..
+ break;
+ } else if (i > 0) {
+ name.splice(i - 1, 2);
+ i -= 2;
+ }
+ }
+ }
+ //end trimDots
+
+ name = name.join("/");
+ } else if (name.indexOf('./') === 0) {
+ // No baseName, so this is ID is resolved relative
+ // to baseUrl, pull off the leading dot.
+ name = name.substring(2);
+ }
+ }
+
+ //Apply map config if available.
+ if ((baseParts || starMap) && map) {
+ nameParts = name.split('/');
+
+ for (i = nameParts.length; i > 0; i -= 1) {
+ nameSegment = nameParts.slice(0, i).join("/");
+
+ if (baseParts) {
+ //Find the longest baseName segment match in the config.
+ //So, do joins on the biggest to smallest lengths of baseParts.
+ for (j = baseParts.length; j > 0; j -= 1) {
+ mapValue = map[baseParts.slice(0, j).join('/')];
+
+ //baseName segment has config, find if it has one for
+ //this name.
+ if (mapValue) {
+ mapValue = mapValue[nameSegment];
+ if (mapValue) {
+ //Match, update name to the new value.
+ foundMap = mapValue;
+ foundI = i;
+ break;
+ }
+ }
+ }
+ }
+
+ if (foundMap) {
+ break;
+ }
+
+ //Check for a star map match, but just hold on to it,
+ //if there is a shorter segment match later in a matching
+ //config, then favor over this star map.
+ if (!foundStarMap && starMap && starMap[nameSegment]) {
+ foundStarMap = starMap[nameSegment];
+ starI = i;
+ }
+ }
+
+ if (!foundMap && foundStarMap) {
+ foundMap = foundStarMap;
+ foundI = starI;
+ }
+
+ if (foundMap) {
+ nameParts.splice(0, foundI, foundMap);
+ name = nameParts.join('/');
+ }
+ }
+
+ return name;
+ }
+
+ function makeRequire(relName, forceSync) {
+ return function () {
+ //A version of a require function that passes a moduleName
+ //value for items that may need to
+ //look up paths relative to the moduleName
+ var args = aps.call(arguments, 0);
+
+ //If first arg is not require('string'), and there is only
+ //one arg, it is the array form without a callback. Insert
+ //a null so that the following concat is correct.
+ if (typeof args[0] !== 'string' && args.length === 1) {
+ args.push(null);
+ }
+ return req.apply(undef, args.concat([relName, forceSync]));
+ };
+ }
+
+ function makeNormalize(relName) {
+ return function (name) {
+ return normalize(name, relName);
+ };
+ }
+
+ function makeLoad(depName) {
+ return function (value) {
+ defined[depName] = value;
+ };
+ }
+
+ function callDep(name) {
+ if (hasProp(waiting, name)) {
+ var args = waiting[name];
+ delete waiting[name];
+ defining[name] = true;
+ main.apply(undef, args);
+ }
+
+ if (!hasProp(defined, name) && !hasProp(defining, name)) {
+ throw new Error('No ' + name);
+ }
+ return defined[name];
+ }
+
+ //Turns a plugin!resource to [plugin, resource]
+ //with the plugin being undefined if the name
+ //did not have a plugin prefix.
+ function splitPrefix(name) {
+ var prefix,
+ index = name ? name.indexOf('!') : -1;
+ if (index > -1) {
+ prefix = name.substring(0, index);
+ name = name.substring(index + 1, name.length);
+ }
+ return [prefix, name];
+ }
+
+ /**
+ * Makes a name map, normalizing the name, and using a plugin
+ * for normalization if necessary. Grabs a ref to plugin
+ * too, as an optimization.
+ */
+ makeMap = function (name, relName) {
+ var plugin,
+ parts = splitPrefix(name),
+ prefix = parts[0];
+
+ name = parts[1];
+
+ if (prefix) {
+ prefix = normalize(prefix, relName);
+ plugin = callDep(prefix);
+ }
+
+ //Normalize according
+ if (prefix) {
+ if (plugin && plugin.normalize) {
+ name = plugin.normalize(name, makeNormalize(relName));
+ } else {
+ name = normalize(name, relName);
+ }
+ } else {
+ name = normalize(name, relName);
+ parts = splitPrefix(name);
+ prefix = parts[0];
+ name = parts[1];
+ if (prefix) {
+ plugin = callDep(prefix);
+ }
+ }
+
+ //Using ridiculous property names for space reasons
+ return {
+ f: prefix ? prefix + '!' + name : name, //fullName
+ n: name,
+ pr: prefix,
+ p: plugin
+ };
+ };
+
+ function makeConfig(name) {
+ return function () {
+ return (config && config.config && config.config[name]) || {};
+ };
+ }
+
+ handlers = {
+ require: function (name) {
+ return makeRequire(name);
+ },
+ exports: function (name) {
+ var e = defined[name];
+ if (typeof e !== 'undefined') {
+ return e;
+ } else {
+ return (defined[name] = {});
+ }
+ },
+ module: function (name) {
+ return {
+ id: name,
+ uri: '',
+ exports: defined[name],
+ config: makeConfig(name)
+ };
+ }
+ };
+
+ main = function (name, deps, callback, relName) {
+ var cjsModule, depName, ret, map, i,
+ args = [],
+ callbackType = typeof callback,
+ usingExports;
+
+ //Use name if no relName
+ relName = relName || name;
+
+ //Call the callback to define the module, if necessary.
+ if (callbackType === 'undefined' || callbackType === 'function') {
+ //Pull out the defined dependencies and pass the ordered
+ //values to the callback.
+ //Default to [require, exports, module] if no deps
+ deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
+ for (i = 0; i < deps.length; i += 1) {
+ map = makeMap(deps[i], relName);
+ depName = map.f;
+
+ //Fast path CommonJS standard dependencies.
+ if (depName === "require") {
+ args[i] = handlers.require(name);
+ } else if (depName === "exports") {
+ //CommonJS module spec 1.1
+ args[i] = handlers.exports(name);
+ usingExports = true;
+ } else if (depName === "module") {
+ //CommonJS module spec 1.1
+ cjsModule = args[i] = handlers.module(name);
+ } else if (hasProp(defined, depName) ||
+ hasProp(waiting, depName) ||
+ hasProp(defining, depName)) {
+ args[i] = callDep(depName);
+ } else if (map.p) {
+ map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
+ args[i] = defined[depName];
+ } else {
+ throw new Error(name + ' missing ' + depName);
+ }
+ }
+
+ ret = callback ? callback.apply(defined[name], args) : undefined;
+
+ if (name) {
+ //If setting exports via "module" is in play,
+ //favor that over return value and exports. After that,
+ //favor a non-undefined return value over exports use.
+ if (cjsModule && cjsModule.exports !== undef &&
+ cjsModule.exports !== defined[name]) {
+ defined[name] = cjsModule.exports;
+ } else if (ret !== undef || !usingExports) {
+ //Use the return value from the function.
+ defined[name] = ret;
+ }
+ }
+ } else if (name) {
+ //May just be an object definition for the module. Only
+ //worry about defining if have a module name.
+ defined[name] = callback;
+ }
+ };
+
+ requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
+ if (typeof deps === "string") {
+ if (handlers[deps]) {
+ //callback in this case is really relName
+ return handlers[deps](callback);
+ }
+ //Just return the module wanted. In this scenario, the
+ //deps arg is the module name, and second arg (if passed)
+ //is just the relName.
+ //Normalize module name, if it contains . or ..
+ return callDep(makeMap(deps, callback).f);
+ } else if (!deps.splice) {
+ //deps is a config object, not an array.
+ config = deps;
+ if (config.deps) {
+ req(config.deps, config.callback);
+ }
+ if (!callback) {
+ return;
+ }
+
+ if (callback.splice) {
+ //callback is an array, which means it is a dependency list.
+ //Adjust args if there are dependencies
+ deps = callback;
+ callback = relName;
+ relName = null;
+ } else {
+ deps = undef;
+ }
+ }
+
+ //Support require(['a'])
+ callback = callback || function () {};
+
+ //If relName is a function, it is an errback handler,
+ //so remove it.
+ if (typeof relName === 'function') {
+ relName = forceSync;
+ forceSync = alt;
+ }
+
+ //Simulate async callback;
+ if (forceSync) {
+ main(undef, deps, callback, relName);
+ } else {
+ //Using a non-zero value because of concern for what old browsers
+ //do, and latest browsers "upgrade" to 4 if lower value is used:
+ //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
+ //If want a value immediately, use require('id') instead -- something
+ //that works in almond on the global level, but not guaranteed and
+ //unlikely to work in other AMD implementations.
+ setTimeout(function () {
+ main(undef, deps, callback, relName);
+ }, 4);
+ }
+
+ return req;
+ };
+
+ /**
+ * Just drops the config on the floor, but returns req in case
+ * the config return value is used.
+ */
+ req.config = function (cfg) {
+ return req(cfg);
+ };
+
+ /**
+ * Expose module registry for debugging and tooling
+ */
+ requirejs._defined = defined;
+
+ define = function (name, deps, callback) {
+ if (typeof name !== 'string') {
+ throw new Error('See almond README: incorrect module build, no module name');
+ }
+
+ //This module may not have dependencies
+ if (!deps.splice) {
+ //deps is not an array, so probably means
+ //an object literal or factory function for
+ //the value. Adjust args.
+ callback = deps;
+ deps = [];
+ }
+
+ if (!hasProp(defined, name) && !hasProp(waiting, name)) {
+ waiting[name] = [name, deps, callback];
+ }
+ };
+
+ define.amd = {
+ jQuery: true
+ };
+}());
+
+S2.requirejs = requirejs;S2.require = require;S2.define = define;
+}
+}());
+S2.define("almond", function(){});
+
+/* global jQuery:false, $:false */
+S2.define('jquery',[],function () {
+ var _$ = jQuery || $;
+
+ if (_$ == null && console && console.error) {
+ console.error(
+ 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
+ 'found. Make sure that you are including jQuery before Select2 on your ' +
+ 'web page.'
+ );
+ }
+
+ return _$;
+});
+
+S2.define('select2/utils',[
+ 'jquery'
+], function ($) {
+ var Utils = {};
+
+ Utils.Extend = function (ChildClass, SuperClass) {
+ var __hasProp = {}.hasOwnProperty;
+
+ function BaseConstructor () {
+ this.constructor = ChildClass;
+ }
+
+ for (var key in SuperClass) {
+ if (__hasProp.call(SuperClass, key)) {
+ ChildClass[key] = SuperClass[key];
+ }
+ }
+
+ BaseConstructor.prototype = SuperClass.prototype;
+ ChildClass.prototype = new BaseConstructor();
+ ChildClass.__super__ = SuperClass.prototype;
+
+ return ChildClass;
+ };
+
+ function getMethods (theClass) {
+ var proto = theClass.prototype;
+
+ var methods = [];
+
+ for (var methodName in proto) {
+ var m = proto[methodName];
+
+ if (typeof m !== 'function') {
+ continue;
+ }
+
+ if (methodName === 'constructor') {
+ continue;
+ }
+
+ methods.push(methodName);
+ }
+
+ return methods;
+ }
+
+ Utils.Decorate = function (SuperClass, DecoratorClass) {
+ var decoratedMethods = getMethods(DecoratorClass);
+ var superMethods = getMethods(SuperClass);
+
+ function DecoratedClass () {
+ var unshift = Array.prototype.unshift;
+
+ var argCount = DecoratorClass.prototype.constructor.length;
+
+ var calledConstructor = SuperClass.prototype.constructor;
+
+ if (argCount > 0) {
+ unshift.call(arguments, SuperClass.prototype.constructor);
+
+ calledConstructor = DecoratorClass.prototype.constructor;
+ }
+
+ calledConstructor.apply(this, arguments);
+ }
+
+ DecoratorClass.displayName = SuperClass.displayName;
+
+ function ctr () {
+ this.constructor = DecoratedClass;
+ }
+
+ DecoratedClass.prototype = new ctr();
+
+ for (var m = 0; m < superMethods.length; m++) {
+ var superMethod = superMethods[m];
+
+ DecoratedClass.prototype[superMethod] =
+ SuperClass.prototype[superMethod];
+ }
+
+ var calledMethod = function (methodName) {
+ // Stub out the original method if it's not decorating an actual method
+ var originalMethod = function () {};
+
+ if (methodName in DecoratedClass.prototype) {
+ originalMethod = DecoratedClass.prototype[methodName];
+ }
+
+ var decoratedMethod = DecoratorClass.prototype[methodName];
+
+ return function () {
+ var unshift = Array.prototype.unshift;
+
+ unshift.call(arguments, originalMethod);
+
+ return decoratedMethod.apply(this, arguments);
+ };
+ };
+
+ for (var d = 0; d < decoratedMethods.length; d++) {
+ var decoratedMethod = decoratedMethods[d];
+
+ DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
+ }
+
+ return DecoratedClass;
+ };
+
+ var Observable = function () {
+ this.listeners = {};
+ };
+
+ Observable.prototype.on = function (event, callback) {
+ this.listeners = this.listeners || {};
+
+ if (event in this.listeners) {
+ this.listeners[event].push(callback);
+ } else {
+ this.listeners[event] = [callback];
+ }
+ };
+
+ Observable.prototype.trigger = function (event) {
+ var slice = Array.prototype.slice;
+ var params = slice.call(arguments, 1);
+
+ this.listeners = this.listeners || {};
+
+ // Params should always come in as an array
+ if (params == null) {
+ params = [];
+ }
+
+ // If there are no arguments to the event, use a temporary object
+ if (params.length === 0) {
+ params.push({});
+ }
+
+ // Set the `_type` of the first object to the event
+ params[0]._type = event;
+
+ if (event in this.listeners) {
+ this.invoke(this.listeners[event], slice.call(arguments, 1));
+ }
+
+ if ('*' in this.listeners) {
+ this.invoke(this.listeners['*'], arguments);
+ }
+ };
+
+ Observable.prototype.invoke = function (listeners, params) {
+ for (var i = 0, len = listeners.length; i < len; i++) {
+ listeners[i].apply(this, params);
+ }
+ };
+
+ Utils.Observable = Observable;
+
+ Utils.generateChars = function (length) {
+ var chars = '';
+
+ for (var i = 0; i < length; i++) {
+ var randomChar = Math.floor(Math.random() * 36);
+ chars += randomChar.toString(36);
+ }
+
+ return chars;
+ };
+
+ Utils.bind = function (func, context) {
+ return function () {
+ func.apply(context, arguments);
+ };
+ };
+
+ Utils._convertData = function (data) {
+ for (var originalKey in data) {
+ var keys = originalKey.split('-');
+
+ var dataLevel = data;
+
+ if (keys.length === 1) {
+ continue;
+ }
+
+ for (var k = 0; k < keys.length; k++) {
+ var key = keys[k];
+
+ // Lowercase the first letter
+ // By default, dash-separated becomes camelCase
+ key = key.substring(0, 1).toLowerCase() + key.substring(1);
+
+ if (!(key in dataLevel)) {
+ dataLevel[key] = {};
+ }
+
+ if (k == keys.length - 1) {
+ dataLevel[key] = data[originalKey];
+ }
+
+ dataLevel = dataLevel[key];
+ }
+
+ delete data[originalKey];
+ }
+
+ return data;
+ };
+
+ Utils.hasScroll = function (index, el) {
+ // Adapted from the function created by @ShadowScripter
+ // and adapted by @BillBarry on the Stack Exchange Code Review website.
+ // The original code can be found at
+ // http://codereview.stackexchange.com/q/13338
+ // and was designed to be used with the Sizzle selector engine.
+
+ var $el = $(el);
+ var overflowX = el.style.overflowX;
+ var overflowY = el.style.overflowY;
+
+ //Check both x and y declarations
+ if (overflowX === overflowY &&
+ (overflowY === 'hidden' || overflowY === 'visible')) {
+ return false;
+ }
+
+ if (overflowX === 'scroll' || overflowY === 'scroll') {
+ return true;
+ }
+
+ return ($el.innerHeight() < el.scrollHeight ||
+ $el.innerWidth() < el.scrollWidth);
+ };
+
+ Utils.escapeMarkup = function (markup) {
+ var replaceMap = {
+ '\\': '\',
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ '\'': ''',
+ '/': '/'
+ };
+
+ // Do not try to escape the markup if it's not a string
+ if (typeof markup !== 'string') {
+ return markup;
+ }
+
+ return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
+ return replaceMap[match];
+ });
+ };
+
+ // Append an array of jQuery nodes to a given element.
+ Utils.appendMany = function ($element, $nodes) {
+ // jQuery 1.7.x does not support $.fn.append() with an array
+ // Fall back to a jQuery object collection using $.fn.add()
+ if ($.fn.jquery.substr(0, 3) === '1.7') {
+ var $jqNodes = $();
+
+ $.map($nodes, function (node) {
+ $jqNodes = $jqNodes.add(node);
+ });
+
+ $nodes = $jqNodes;
+ }
+
+ $element.append($nodes);
+ };
+
+ return Utils;
+});
+
+S2.define('select2/results',[
+ 'jquery',
+ './utils'
+], function ($, Utils) {
+ function Results ($element, options, dataAdapter) {
+ this.$element = $element;
+ this.data = dataAdapter;
+ this.options = options;
+
+ Results.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(Results, Utils.Observable);
+
+ Results.prototype.render = function () {
+ var $results = $(
+ ''
+ );
+
+ if (this.options.get('multiple')) {
+ $results.attr('aria-multiselectable', 'true');
+ }
+
+ this.$results = $results;
+
+ return $results;
+ };
+
+ Results.prototype.clear = function () {
+ this.$results.empty();
+ };
+
+ Results.prototype.displayMessage = function (params) {
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ this.clear();
+ this.hideLoading();
+
+ var $message = $(
+ ' '
+ );
+
+ var message = this.options.get('translations').get(params.message);
+
+ $message.append(
+ escapeMarkup(
+ message(params.args)
+ )
+ );
+
+ $message[0].className += ' select2-results__message';
+
+ this.$results.append($message);
+ };
+
+ Results.prototype.hideMessages = function () {
+ this.$results.find('.select2-results__message').remove();
+ };
+
+ Results.prototype.append = function (data) {
+ this.hideLoading();
+
+ var $options = [];
+
+ if (data.results == null || data.results.length === 0) {
+ if (this.$results.children().length === 0) {
+ this.trigger('results:message', {
+ message: 'noResults'
+ });
+ }
+
+ return;
+ }
+
+ data.results = this.sort(data.results);
+
+ for (var d = 0; d < data.results.length; d++) {
+ var item = data.results[d];
+
+ var $option = this.option(item);
+
+ $options.push($option);
+ }
+
+ this.$results.append($options);
+ };
+
+ Results.prototype.position = function ($results, $dropdown) {
+ var $resultsContainer = $dropdown.find('.select2-results');
+ $resultsContainer.append($results);
+ };
+
+ Results.prototype.sort = function (data) {
+ var sorter = this.options.get('sorter');
+
+ return sorter(data);
+ };
+
+ Results.prototype.highlightFirstItem = function () {
+ var $options = this.$results
+ .find('.select2-results__option[aria-selected]');
+
+ var $selected = $options.filter('[aria-selected=true]');
+
+ // Check if there are any selected options
+ if ($selected.length > 0) {
+ // If there are selected options, highlight the first
+ $selected.first().trigger('mouseenter');
+ } else {
+ // If there are no selected options, highlight the first option
+ // in the dropdown
+ $options.first().trigger('mouseenter');
+ }
+
+ this.ensureHighlightVisible();
+ };
+
+ Results.prototype.setClasses = function () {
+ var self = this;
+
+ this.data.current(function (selected) {
+ var selectedIds = $.map(selected, function (s) {
+ return s.id.toString();
+ });
+
+ var $options = self.$results
+ .find('.select2-results__option[aria-selected]');
+
+ $options.each(function () {
+ var $option = $(this);
+
+ var item = $.data(this, 'data');
+
+ // id needs to be converted to a string when comparing
+ var id = '' + item.id;
+
+ if ((item.element != null && item.element.selected) ||
+ (item.element == null && $.inArray(id, selectedIds) > -1)) {
+ $option.attr('aria-selected', 'true');
+ } else {
+ $option.attr('aria-selected', 'false');
+ }
+ });
+
+ });
+ };
+
+ Results.prototype.showLoading = function (params) {
+ this.hideLoading();
+
+ var loadingMore = this.options.get('translations').get('searching');
+
+ var loading = {
+ disabled: true,
+ loading: true,
+ text: loadingMore(params)
+ };
+ var $loading = this.option(loading);
+ $loading.className += ' loading-results';
+
+ this.$results.prepend($loading);
+ };
+
+ Results.prototype.hideLoading = function () {
+ this.$results.find('.loading-results').remove();
+ };
+
+ Results.prototype.option = function (data) {
+ var option = document.createElement('li');
+ option.className = 'select2-results__option';
+
+ var attrs = {
+ 'role': 'treeitem',
+ 'aria-selected': 'false'
+ };
+
+ if (data.disabled) {
+ delete attrs['aria-selected'];
+ attrs['aria-disabled'] = 'true';
+ }
+
+ if (data.id == null) {
+ delete attrs['aria-selected'];
+ }
+
+ if (data._resultId != null) {
+ option.id = data._resultId;
+ }
+
+ if (data.title) {
+ option.title = data.title;
+ }
+
+ if (data.children) {
+ attrs.role = 'group';
+ attrs['aria-label'] = data.text;
+ delete attrs['aria-selected'];
+ }
+
+ for (var attr in attrs) {
+ var val = attrs[attr];
+
+ option.setAttribute(attr, val);
+ }
+
+ if (data.children) {
+ var $option = $(option);
+
+ var label = document.createElement('strong');
+ label.className = 'select2-results__group';
+
+ var $label = $(label);
+ this.template(data, label);
+
+ var $children = [];
+
+ for (var c = 0; c < data.children.length; c++) {
+ var child = data.children[c];
+
+ var $child = this.option(child);
+
+ $children.push($child);
+ }
+
+ var $childrenContainer = $('', {
+ 'class': 'select2-results__options select2-results__options--nested'
+ });
+
+ $childrenContainer.append($children);
+
+ $option.append(label);
+ $option.append($childrenContainer);
+ } else {
+ this.template(data, option);
+ }
+
+ $.data(option, 'data', data);
+
+ return option;
+ };
+
+ Results.prototype.bind = function (container, $container) {
+ var self = this;
+
+ var id = container.id + '-results';
+
+ this.$results.attr('id', id);
+
+ container.on('results:all', function (params) {
+ self.clear();
+ self.append(params.data);
+
+ if (container.isOpen()) {
+ self.setClasses();
+ self.highlightFirstItem();
+ }
+ });
+
+ container.on('results:append', function (params) {
+ self.append(params.data);
+
+ if (container.isOpen()) {
+ self.setClasses();
+ }
+ });
+
+ container.on('query', function (params) {
+ self.hideMessages();
+ self.showLoading(params);
+ });
+
+ container.on('select', function () {
+ if (!container.isOpen()) {
+ return;
+ }
+
+ self.setClasses();
+ self.highlightFirstItem();
+ });
+
+ container.on('unselect', function () {
+ if (!container.isOpen()) {
+ return;
+ }
+
+ self.setClasses();
+ self.highlightFirstItem();
+ });
+
+ container.on('open', function () {
+ // When the dropdown is open, aria-expended="true"
+ self.$results.attr('aria-expanded', 'true');
+ self.$results.attr('aria-hidden', 'false');
+
+ self.setClasses();
+ self.ensureHighlightVisible();
+ });
+
+ container.on('close', function () {
+ // When the dropdown is closed, aria-expended="false"
+ self.$results.attr('aria-expanded', 'false');
+ self.$results.attr('aria-hidden', 'true');
+ self.$results.removeAttr('aria-activedescendant');
+ });
+
+ container.on('results:toggle', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ if ($highlighted.length === 0) {
+ return;
+ }
+
+ $highlighted.trigger('mouseup');
+ });
+
+ container.on('results:select', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ if ($highlighted.length === 0) {
+ return;
+ }
+
+ var data = $highlighted.data('data');
+
+ if ($highlighted.attr('aria-selected') == 'true') {
+ self.trigger('close', {});
+ } else {
+ self.trigger('select', {
+ data: data
+ });
+ }
+ });
+
+ container.on('results:previous', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ var $options = self.$results.find('[aria-selected]');
+
+ var currentIndex = $options.index($highlighted);
+
+ // If we are already at te top, don't move further
+ if (currentIndex === 0) {
+ return;
+ }
+
+ var nextIndex = currentIndex - 1;
+
+ // If none are highlighted, highlight the first
+ if ($highlighted.length === 0) {
+ nextIndex = 0;
+ }
+
+ var $next = $options.eq(nextIndex);
+
+ $next.trigger('mouseenter');
+
+ var currentOffset = self.$results.offset().top;
+ var nextTop = $next.offset().top;
+ var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
+
+ if (nextIndex === 0) {
+ self.$results.scrollTop(0);
+ } else if (nextTop - currentOffset < 0) {
+ self.$results.scrollTop(nextOffset);
+ }
+ });
+
+ container.on('results:next', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ var $options = self.$results.find('[aria-selected]');
+
+ var currentIndex = $options.index($highlighted);
+
+ var nextIndex = currentIndex + 1;
+
+ // If we are at the last option, stay there
+ if (nextIndex >= $options.length) {
+ return;
+ }
+
+ var $next = $options.eq(nextIndex);
+
+ $next.trigger('mouseenter');
+
+ var currentOffset = self.$results.offset().top +
+ self.$results.outerHeight(false);
+ var nextBottom = $next.offset().top + $next.outerHeight(false);
+ var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
+
+ if (nextIndex === 0) {
+ self.$results.scrollTop(0);
+ } else if (nextBottom > currentOffset) {
+ self.$results.scrollTop(nextOffset);
+ }
+ });
+
+ container.on('results:focus', function (params) {
+ params.element.addClass('select2-results__option--highlighted');
+ });
+
+ container.on('results:message', function (params) {
+ self.displayMessage(params);
+ });
+
+ if ($.fn.mousewheel) {
+ this.$results.on('mousewheel', function (e) {
+ var top = self.$results.scrollTop();
+
+ var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
+
+ var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
+ var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
+
+ if (isAtTop) {
+ self.$results.scrollTop(0);
+
+ e.preventDefault();
+ e.stopPropagation();
+ } else if (isAtBottom) {
+ self.$results.scrollTop(
+ self.$results.get(0).scrollHeight - self.$results.height()
+ );
+
+ e.preventDefault();
+ e.stopPropagation();
+ }
+ });
+ }
+
+ this.$results.on('mouseup', '.select2-results__option[aria-selected]',
+ function (evt) {
+ var $this = $(this);
+
+ var data = $this.data('data');
+
+ if ($this.attr('aria-selected') === 'true') {
+ if (self.options.get('multiple')) {
+ self.trigger('unselect', {
+ originalEvent: evt,
+ data: data
+ });
+ } else {
+ self.trigger('close', {});
+ }
+
+ return;
+ }
+
+ self.trigger('select', {
+ originalEvent: evt,
+ data: data
+ });
+ });
+
+ this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
+ function (evt) {
+ var data = $(this).data('data');
+
+ self.getHighlightedResults()
+ .removeClass('select2-results__option--highlighted');
+
+ self.trigger('results:focus', {
+ data: data,
+ element: $(this)
+ });
+ });
+ };
+
+ Results.prototype.getHighlightedResults = function () {
+ var $highlighted = this.$results
+ .find('.select2-results__option--highlighted');
+
+ return $highlighted;
+ };
+
+ Results.prototype.destroy = function () {
+ this.$results.remove();
+ };
+
+ Results.prototype.ensureHighlightVisible = function () {
+ var $highlighted = this.getHighlightedResults();
+
+ if ($highlighted.length === 0) {
+ return;
+ }
+
+ var $options = this.$results.find('[aria-selected]');
+
+ var currentIndex = $options.index($highlighted);
+
+ var currentOffset = this.$results.offset().top;
+ var nextTop = $highlighted.offset().top;
+ var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
+
+ var offsetDelta = nextTop - currentOffset;
+ nextOffset -= $highlighted.outerHeight(false) * 2;
+
+ if (currentIndex <= 2) {
+ this.$results.scrollTop(0);
+ } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
+ this.$results.scrollTop(nextOffset);
+ }
+ };
+
+ Results.prototype.template = function (result, container) {
+ var template = this.options.get('templateResult');
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ var content = template(result, container);
+
+ if (content == null) {
+ container.style.display = 'none';
+ } else if (typeof content === 'string') {
+ container.innerHTML = escapeMarkup(content);
+ } else {
+ $(container).append(content);
+ }
+ };
+
+ return Results;
+});
+
+S2.define('select2/keys',[
+
+], function () {
+ var KEYS = {
+ BACKSPACE: 8,
+ TAB: 9,
+ ENTER: 13,
+ SHIFT: 16,
+ CTRL: 17,
+ ALT: 18,
+ ESC: 27,
+ SPACE: 32,
+ PAGE_UP: 33,
+ PAGE_DOWN: 34,
+ END: 35,
+ HOME: 36,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ DELETE: 46
+ };
+
+ return KEYS;
+});
+
+S2.define('select2/selection/base',[
+ 'jquery',
+ '../utils',
+ '../keys'
+], function ($, Utils, KEYS) {
+ function BaseSelection ($element, options) {
+ this.$element = $element;
+ this.options = options;
+
+ BaseSelection.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(BaseSelection, Utils.Observable);
+
+ BaseSelection.prototype.render = function () {
+ var $selection = $(
+ '' +
+ ' '
+ );
+
+ this._tabindex = 0;
+
+ if (this.$element.data('old-tabindex') != null) {
+ this._tabindex = this.$element.data('old-tabindex');
+ } else if (this.$element.attr('tabindex') != null) {
+ this._tabindex = this.$element.attr('tabindex');
+ }
+
+ $selection.attr('title', this.$element.attr('title'));
+ $selection.attr('tabindex', this._tabindex);
+
+ this.$selection = $selection;
+
+ return $selection;
+ };
+
+ BaseSelection.prototype.bind = function (container, $container) {
+ var self = this;
+
+ var id = container.id + '-container';
+ var resultsId = container.id + '-results';
+
+ this.container = container;
+
+ this.$selection.on('focus', function (evt) {
+ self.trigger('focus', evt);
+ });
+
+ this.$selection.on('blur', function (evt) {
+ self._handleBlur(evt);
+ });
+
+ this.$selection.on('keydown', function (evt) {
+ self.trigger('keypress', evt);
+
+ if (evt.which === KEYS.SPACE) {
+ evt.preventDefault();
+ }
+ });
+
+ container.on('results:focus', function (params) {
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
+ });
+
+ container.on('selection:update', function (params) {
+ self.update(params.data);
+ });
+
+ container.on('open', function () {
+ // When the dropdown is open, aria-expanded="true"
+ self.$selection.attr('aria-expanded', 'true');
+ self.$selection.attr('aria-owns', resultsId);
+
+ self._attachCloseHandler(container);
+ });
+
+ container.on('close', function () {
+ // When the dropdown is closed, aria-expanded="false"
+ self.$selection.attr('aria-expanded', 'false');
+ self.$selection.removeAttr('aria-activedescendant');
+ self.$selection.removeAttr('aria-owns');
+
+ self.$selection.focus();
+
+ self._detachCloseHandler(container);
+ });
+
+ container.on('enable', function () {
+ self.$selection.attr('tabindex', self._tabindex);
+ });
+
+ container.on('disable', function () {
+ self.$selection.attr('tabindex', '-1');
+ });
+ };
+
+ BaseSelection.prototype._handleBlur = function (evt) {
+ var self = this;
+
+ // This needs to be delayed as the active element is the body when the tab
+ // key is pressed, possibly along with others.
+ window.setTimeout(function () {
+ // Don't trigger `blur` if the focus is still in the selection
+ if (
+ (document.activeElement == self.$selection[0]) ||
+ ($.contains(self.$selection[0], document.activeElement))
+ ) {
+ return;
+ }
+
+ self.trigger('blur', evt);
+ }, 1);
+ };
+
+ BaseSelection.prototype._attachCloseHandler = function (container) {
+ var self = this;
+
+ $(document.body).on('mousedown.select2.' + container.id, function (e) {
+ var $target = $(e.target);
+
+ var $select = $target.closest('.select2');
+
+ var $all = $('.select2.select2-container--open');
+
+ $all.each(function () {
+ var $this = $(this);
+
+ if (this == $select[0]) {
+ return;
+ }
+
+ var $element = $this.data('element');
+
+ $element.select2('close');
+ });
+ });
+ };
+
+ BaseSelection.prototype._detachCloseHandler = function (container) {
+ $(document.body).off('mousedown.select2.' + container.id);
+ };
+
+ BaseSelection.prototype.position = function ($selection, $container) {
+ var $selectionContainer = $container.find('.selection');
+ $selectionContainer.append($selection);
+ };
+
+ BaseSelection.prototype.destroy = function () {
+ this._detachCloseHandler(this.container);
+ };
+
+ BaseSelection.prototype.update = function (data) {
+ throw new Error('The `update` method must be defined in child classes.');
+ };
+
+ return BaseSelection;
+});
+
+S2.define('select2/selection/single',[
+ 'jquery',
+ './base',
+ '../utils',
+ '../keys'
+], function ($, BaseSelection, Utils, KEYS) {
+ function SingleSelection () {
+ SingleSelection.__super__.constructor.apply(this, arguments);
+ }
+
+ Utils.Extend(SingleSelection, BaseSelection);
+
+ SingleSelection.prototype.render = function () {
+ var $selection = SingleSelection.__super__.render.call(this);
+
+ $selection.addClass('select2-selection--single');
+
+ $selection.html(
+ ' ' +
+ '' +
+ ' ' +
+ ' '
+ );
+
+ return $selection;
+ };
+
+ SingleSelection.prototype.bind = function (container, $container) {
+ var self = this;
+
+ SingleSelection.__super__.bind.apply(this, arguments);
+
+ var id = container.id + '-container';
+
+ this.$selection.find('.select2-selection__rendered').attr('id', id);
+ this.$selection.attr('aria-labelledby', id);
+
+ this.$selection.on('mousedown', function (evt) {
+ // Only respond to left clicks
+ if (evt.which !== 1) {
+ return;
+ }
+
+ self.trigger('toggle', {
+ originalEvent: evt
+ });
+ });
+
+ this.$selection.on('focus', function (evt) {
+ // User focuses on the container
+ });
+
+ this.$selection.on('blur', function (evt) {
+ // User exits the container
+ });
+
+ container.on('focus', function (evt) {
+ if (!container.isOpen()) {
+ self.$selection.focus();
+ }
+ });
+
+ container.on('selection:update', function (params) {
+ self.update(params.data);
+ });
+ };
+
+ SingleSelection.prototype.clear = function () {
+ this.$selection.find('.select2-selection__rendered').empty();
+ };
+
+ SingleSelection.prototype.display = function (data, container) {
+ var template = this.options.get('templateSelection');
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ return escapeMarkup(template(data, container));
+ };
+
+ SingleSelection.prototype.selectionContainer = function () {
+ return $(' ');
+ };
+
+ SingleSelection.prototype.update = function (data) {
+ if (data.length === 0) {
+ this.clear();
+ return;
+ }
+
+ var selection = data[0];
+
+ var $rendered = this.$selection.find('.select2-selection__rendered');
+ var formatted = this.display(selection, $rendered);
+
+ $rendered.empty().append(formatted);
+ $rendered.prop('title', selection.title || selection.text);
+ };
+
+ return SingleSelection;
+});
+
+S2.define('select2/selection/multiple',[
+ 'jquery',
+ './base',
+ '../utils'
+], function ($, BaseSelection, Utils) {
+ function MultipleSelection ($element, options) {
+ MultipleSelection.__super__.constructor.apply(this, arguments);
+ }
+
+ Utils.Extend(MultipleSelection, BaseSelection);
+
+ MultipleSelection.prototype.render = function () {
+ var $selection = MultipleSelection.__super__.render.call(this);
+
+ $selection.addClass('select2-selection--multiple');
+
+ $selection.html(
+ ''
+ );
+
+ return $selection;
+ };
+
+ MultipleSelection.prototype.bind = function (container, $container) {
+ var self = this;
+
+ MultipleSelection.__super__.bind.apply(this, arguments);
+
+ this.$selection.on('click', function (evt) {
+ self.trigger('toggle', {
+ originalEvent: evt
+ });
+ });
+
+ this.$selection.on(
+ 'click',
+ '.select2-selection__choice__remove',
+ function (evt) {
+ // Ignore the event if it is disabled
+ if (self.options.get('disabled')) {
+ return;
+ }
+
+ var $remove = $(this);
+ var $selection = $remove.parent();
+
+ var data = $selection.data('data');
+
+ self.trigger('unselect', {
+ originalEvent: evt,
+ data: data
+ });
+ }
+ );
+ };
+
+ MultipleSelection.prototype.clear = function () {
+ this.$selection.find('.select2-selection__rendered').empty();
+ };
+
+ MultipleSelection.prototype.display = function (data, container) {
+ var template = this.options.get('templateSelection');
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ return escapeMarkup(template(data, container));
+ };
+
+ MultipleSelection.prototype.selectionContainer = function () {
+ var $container = $(
+ '' +
+ '' +
+ '×' +
+ ' ' +
+ ' '
+ );
+
+ return $container;
+ };
+
+ MultipleSelection.prototype.update = function (data) {
+ this.clear();
+
+ if (data.length === 0) {
+ return;
+ }
+
+ var $selections = [];
+
+ for (var d = 0; d < data.length; d++) {
+ var selection = data[d];
+
+ var $selection = this.selectionContainer();
+ var formatted = this.display(selection, $selection);
+
+ $selection.append(formatted);
+ $selection.prop('title', selection.title || selection.text);
+
+ $selection.data('data', selection);
+
+ $selections.push($selection);
+ }
+
+ var $rendered = this.$selection.find('.select2-selection__rendered');
+
+ Utils.appendMany($rendered, $selections);
+ };
+
+ return MultipleSelection;
+});
+
+S2.define('select2/selection/placeholder',[
+ '../utils'
+], function (Utils) {
+ function Placeholder (decorated, $element, options) {
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
+
+ decorated.call(this, $element, options);
+ }
+
+ Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
+ if (typeof placeholder === 'string') {
+ placeholder = {
+ id: '',
+ text: placeholder
+ };
+ }
+
+ return placeholder;
+ };
+
+ Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
+ var $placeholder = this.selectionContainer();
+
+ $placeholder.html(this.display(placeholder));
+ $placeholder.addClass('select2-selection__placeholder')
+ .removeClass('select2-selection__choice');
+
+ return $placeholder;
+ };
+
+ Placeholder.prototype.update = function (decorated, data) {
+ var singlePlaceholder = (
+ data.length == 1 && data[0].id != this.placeholder.id
+ );
+ var multipleSelections = data.length > 1;
+
+ if (multipleSelections || singlePlaceholder) {
+ return decorated.call(this, data);
+ }
+
+ this.clear();
+
+ var $placeholder = this.createPlaceholder(this.placeholder);
+
+ this.$selection.find('.select2-selection__rendered').append($placeholder);
+ };
+
+ return Placeholder;
+});
+
+S2.define('select2/selection/allowClear',[
+ 'jquery',
+ '../keys'
+], function ($, KEYS) {
+ function AllowClear () { }
+
+ AllowClear.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ if (this.placeholder == null) {
+ if (this.options.get('debug') && window.console && console.error) {
+ console.error(
+ 'Select2: The `allowClear` option should be used in combination ' +
+ 'with the `placeholder` option.'
+ );
+ }
+ }
+
+ this.$selection.on('mousedown', '.select2-selection__clear',
+ function (evt) {
+ self._handleClear(evt);
+ });
+
+ container.on('keypress', function (evt) {
+ self._handleKeyboardClear(evt, container);
+ });
+ };
+
+ AllowClear.prototype._handleClear = function (_, evt) {
+ // Ignore the event if it is disabled
+ if (this.options.get('disabled')) {
+ return;
+ }
+
+ var $clear = this.$selection.find('.select2-selection__clear');
+
+ // Ignore the event if nothing has been selected
+ if ($clear.length === 0) {
+ return;
+ }
+
+ evt.stopPropagation();
+
+ var data = $clear.data('data');
+
+ for (var d = 0; d < data.length; d++) {
+ var unselectData = {
+ data: data[d]
+ };
+
+ // Trigger the `unselect` event, so people can prevent it from being
+ // cleared.
+ this.trigger('unselect', unselectData);
+
+ // If the event was prevented, don't clear it out.
+ if (unselectData.prevented) {
+ return;
+ }
+ }
+
+ this.$element.val(this.placeholder.id).trigger('change');
+
+ this.trigger('toggle', {});
+ };
+
+ AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
+ if (container.isOpen()) {
+ return;
+ }
+
+ if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
+ this._handleClear(evt);
+ }
+ };
+
+ AllowClear.prototype.update = function (decorated, data) {
+ decorated.call(this, data);
+
+ if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
+ data.length === 0) {
+ return;
+ }
+
+ var $remove = $(
+ '' +
+ '×' +
+ ' '
+ );
+ $remove.data('data', data);
+
+ this.$selection.find('.select2-selection__rendered').prepend($remove);
+ };
+
+ return AllowClear;
+});
+
+S2.define('select2/selection/search',[
+ 'jquery',
+ '../utils',
+ '../keys'
+], function ($, Utils, KEYS) {
+ function Search (decorated, $element, options) {
+ decorated.call(this, $element, options);
+ }
+
+ Search.prototype.render = function (decorated) {
+ var $search = $(
+ '' +
+ ' ' +
+ ' '
+ );
+
+ this.$searchContainer = $search;
+ this.$search = $search.find('input');
+
+ var $rendered = decorated.call(this);
+
+ this._transferTabIndex();
+
+ return $rendered;
+ };
+
+ Search.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('open', function () {
+ self.$search.trigger('focus');
+ });
+
+ container.on('close', function () {
+ self.$search.val('');
+ self.$search.removeAttr('aria-activedescendant');
+ self.$search.trigger('focus');
+ });
+
+ container.on('enable', function () {
+ self.$search.prop('disabled', false);
+
+ self._transferTabIndex();
+ });
+
+ container.on('disable', function () {
+ self.$search.prop('disabled', true);
+ });
+
+ container.on('focus', function (evt) {
+ self.$search.trigger('focus');
+ });
+
+ container.on('results:focus', function (params) {
+ self.$search.attr('aria-activedescendant', params.id);
+ });
+
+ this.$selection.on('focusin', '.select2-search--inline', function (evt) {
+ self.trigger('focus', evt);
+ });
+
+ this.$selection.on('focusout', '.select2-search--inline', function (evt) {
+ self._handleBlur(evt);
+ });
+
+ this.$selection.on('keydown', '.select2-search--inline', function (evt) {
+ evt.stopPropagation();
+
+ self.trigger('keypress', evt);
+
+ self._keyUpPrevented = evt.isDefaultPrevented();
+
+ var key = evt.which;
+
+ if (key === KEYS.BACKSPACE && self.$search.val() === '') {
+ var $previousChoice = self.$searchContainer
+ .prev('.select2-selection__choice');
+
+ if ($previousChoice.length > 0) {
+ var item = $previousChoice.data('data');
+
+ self.searchRemoveChoice(item);
+
+ evt.preventDefault();
+ }
+ }
+ });
+
+ // Try to detect the IE version should the `documentMode` property that
+ // is stored on the document. This is only implemented in IE and is
+ // slightly cleaner than doing a user agent check.
+ // This property is not available in Edge, but Edge also doesn't have
+ // this bug.
+ var msie = document.documentMode;
+ var disableInputEvents = msie && msie <= 11;
+
+ // Workaround for browsers which do not support the `input` event
+ // This will prevent double-triggering of events for browsers which support
+ // both the `keyup` and `input` events.
+ this.$selection.on(
+ 'input.searchcheck',
+ '.select2-search--inline',
+ function (evt) {
+ // IE will trigger the `input` event when a placeholder is used on a
+ // search box. To get around this issue, we are forced to ignore all
+ // `input` events in IE and keep using `keyup`.
+ if (disableInputEvents) {
+ self.$selection.off('input.search input.searchcheck');
+ return;
+ }
+
+ // Unbind the duplicated `keyup` event
+ self.$selection.off('keyup.search');
+ }
+ );
+
+ this.$selection.on(
+ 'keyup.search input.search',
+ '.select2-search--inline',
+ function (evt) {
+ // IE will trigger the `input` event when a placeholder is used on a
+ // search box. To get around this issue, we are forced to ignore all
+ // `input` events in IE and keep using `keyup`.
+ if (disableInputEvents && evt.type === 'input') {
+ self.$selection.off('input.search input.searchcheck');
+ return;
+ }
+
+ var key = evt.which;
+
+ // We can freely ignore events from modifier keys
+ if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
+ return;
+ }
+
+ // Tabbing will be handled during the `keydown` phase
+ if (key == KEYS.TAB) {
+ return;
+ }
+
+ self.handleSearch(evt);
+ }
+ );
+ };
+
+ /**
+ * This method will transfer the tabindex attribute from the rendered
+ * selection to the search box. This allows for the search box to be used as
+ * the primary focus instead of the selection container.
+ *
+ * @private
+ */
+ Search.prototype._transferTabIndex = function (decorated) {
+ this.$search.attr('tabindex', this.$selection.attr('tabindex'));
+ this.$selection.attr('tabindex', '-1');
+ };
+
+ Search.prototype.createPlaceholder = function (decorated, placeholder) {
+ this.$search.attr('placeholder', placeholder.text);
+ };
+
+ Search.prototype.update = function (decorated, data) {
+ var searchHadFocus = this.$search[0] == document.activeElement;
+
+ this.$search.attr('placeholder', '');
+
+ decorated.call(this, data);
+
+ this.$selection.find('.select2-selection__rendered')
+ .append(this.$searchContainer);
+
+ this.resizeSearch();
+ if (searchHadFocus) {
+ this.$search.focus();
+ }
+ };
+
+ Search.prototype.handleSearch = function () {
+ this.resizeSearch();
+
+ if (!this._keyUpPrevented) {
+ var input = this.$search.val();
+
+ this.trigger('query', {
+ term: input
+ });
+ }
+
+ this._keyUpPrevented = false;
+ };
+
+ Search.prototype.searchRemoveChoice = function (decorated, item) {
+ this.trigger('unselect', {
+ data: item
+ });
+
+ this.$search.val(item.text);
+ this.handleSearch();
+ };
+
+ Search.prototype.resizeSearch = function () {
+ this.$search.css('width', '25px');
+
+ var width = '';
+
+ if (this.$search.attr('placeholder') !== '') {
+ width = this.$selection.find('.select2-selection__rendered').innerWidth();
+ } else {
+ var minimumWidth = this.$search.val().length + 1;
+
+ width = (minimumWidth * 0.75) + 'em';
+ }
+
+ this.$search.css('width', width);
+ };
+
+ return Search;
+});
+
+S2.define('select2/selection/eventRelay',[
+ 'jquery'
+], function ($) {
+ function EventRelay () { }
+
+ EventRelay.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+ var relayEvents = [
+ 'open', 'opening',
+ 'close', 'closing',
+ 'select', 'selecting',
+ 'unselect', 'unselecting'
+ ];
+
+ var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
+
+ decorated.call(this, container, $container);
+
+ container.on('*', function (name, params) {
+ // Ignore events that should not be relayed
+ if ($.inArray(name, relayEvents) === -1) {
+ return;
+ }
+
+ // The parameters should always be an object
+ params = params || {};
+
+ // Generate the jQuery event for the Select2 event
+ var evt = $.Event('select2:' + name, {
+ params: params
+ });
+
+ self.$element.trigger(evt);
+
+ // Only handle preventable events if it was one
+ if ($.inArray(name, preventableEvents) === -1) {
+ return;
+ }
+
+ params.prevented = evt.isDefaultPrevented();
+ });
+ };
+
+ return EventRelay;
+});
+
+S2.define('select2/translation',[
+ 'jquery',
+ 'require'
+], function ($, require) {
+ function Translation (dict) {
+ this.dict = dict || {};
+ }
+
+ Translation.prototype.all = function () {
+ return this.dict;
+ };
+
+ Translation.prototype.get = function (key) {
+ return this.dict[key];
+ };
+
+ Translation.prototype.extend = function (translation) {
+ this.dict = $.extend({}, translation.all(), this.dict);
+ };
+
+ // Static functions
+
+ Translation._cache = {};
+
+ Translation.loadPath = function (path) {
+ if (!(path in Translation._cache)) {
+ var translations = require(path);
+
+ Translation._cache[path] = translations;
+ }
+
+ return new Translation(Translation._cache[path]);
+ };
+
+ return Translation;
+});
+
+S2.define('select2/diacritics',[
+
+], function () {
+ var diacritics = {
+ '\u24B6': 'A',
+ '\uFF21': 'A',
+ '\u00C0': 'A',
+ '\u00C1': 'A',
+ '\u00C2': 'A',
+ '\u1EA6': 'A',
+ '\u1EA4': 'A',
+ '\u1EAA': 'A',
+ '\u1EA8': 'A',
+ '\u00C3': 'A',
+ '\u0100': 'A',
+ '\u0102': 'A',
+ '\u1EB0': 'A',
+ '\u1EAE': 'A',
+ '\u1EB4': 'A',
+ '\u1EB2': 'A',
+ '\u0226': 'A',
+ '\u01E0': 'A',
+ '\u00C4': 'A',
+ '\u01DE': 'A',
+ '\u1EA2': 'A',
+ '\u00C5': 'A',
+ '\u01FA': 'A',
+ '\u01CD': 'A',
+ '\u0200': 'A',
+ '\u0202': 'A',
+ '\u1EA0': 'A',
+ '\u1EAC': 'A',
+ '\u1EB6': 'A',
+ '\u1E00': 'A',
+ '\u0104': 'A',
+ '\u023A': 'A',
+ '\u2C6F': 'A',
+ '\uA732': 'AA',
+ '\u00C6': 'AE',
+ '\u01FC': 'AE',
+ '\u01E2': 'AE',
+ '\uA734': 'AO',
+ '\uA736': 'AU',
+ '\uA738': 'AV',
+ '\uA73A': 'AV',
+ '\uA73C': 'AY',
+ '\u24B7': 'B',
+ '\uFF22': 'B',
+ '\u1E02': 'B',
+ '\u1E04': 'B',
+ '\u1E06': 'B',
+ '\u0243': 'B',
+ '\u0182': 'B',
+ '\u0181': 'B',
+ '\u24B8': 'C',
+ '\uFF23': 'C',
+ '\u0106': 'C',
+ '\u0108': 'C',
+ '\u010A': 'C',
+ '\u010C': 'C',
+ '\u00C7': 'C',
+ '\u1E08': 'C',
+ '\u0187': 'C',
+ '\u023B': 'C',
+ '\uA73E': 'C',
+ '\u24B9': 'D',
+ '\uFF24': 'D',
+ '\u1E0A': 'D',
+ '\u010E': 'D',
+ '\u1E0C': 'D',
+ '\u1E10': 'D',
+ '\u1E12': 'D',
+ '\u1E0E': 'D',
+ '\u0110': 'D',
+ '\u018B': 'D',
+ '\u018A': 'D',
+ '\u0189': 'D',
+ '\uA779': 'D',
+ '\u01F1': 'DZ',
+ '\u01C4': 'DZ',
+ '\u01F2': 'Dz',
+ '\u01C5': 'Dz',
+ '\u24BA': 'E',
+ '\uFF25': 'E',
+ '\u00C8': 'E',
+ '\u00C9': 'E',
+ '\u00CA': 'E',
+ '\u1EC0': 'E',
+ '\u1EBE': 'E',
+ '\u1EC4': 'E',
+ '\u1EC2': 'E',
+ '\u1EBC': 'E',
+ '\u0112': 'E',
+ '\u1E14': 'E',
+ '\u1E16': 'E',
+ '\u0114': 'E',
+ '\u0116': 'E',
+ '\u00CB': 'E',
+ '\u1EBA': 'E',
+ '\u011A': 'E',
+ '\u0204': 'E',
+ '\u0206': 'E',
+ '\u1EB8': 'E',
+ '\u1EC6': 'E',
+ '\u0228': 'E',
+ '\u1E1C': 'E',
+ '\u0118': 'E',
+ '\u1E18': 'E',
+ '\u1E1A': 'E',
+ '\u0190': 'E',
+ '\u018E': 'E',
+ '\u24BB': 'F',
+ '\uFF26': 'F',
+ '\u1E1E': 'F',
+ '\u0191': 'F',
+ '\uA77B': 'F',
+ '\u24BC': 'G',
+ '\uFF27': 'G',
+ '\u01F4': 'G',
+ '\u011C': 'G',
+ '\u1E20': 'G',
+ '\u011E': 'G',
+ '\u0120': 'G',
+ '\u01E6': 'G',
+ '\u0122': 'G',
+ '\u01E4': 'G',
+ '\u0193': 'G',
+ '\uA7A0': 'G',
+ '\uA77D': 'G',
+ '\uA77E': 'G',
+ '\u24BD': 'H',
+ '\uFF28': 'H',
+ '\u0124': 'H',
+ '\u1E22': 'H',
+ '\u1E26': 'H',
+ '\u021E': 'H',
+ '\u1E24': 'H',
+ '\u1E28': 'H',
+ '\u1E2A': 'H',
+ '\u0126': 'H',
+ '\u2C67': 'H',
+ '\u2C75': 'H',
+ '\uA78D': 'H',
+ '\u24BE': 'I',
+ '\uFF29': 'I',
+ '\u00CC': 'I',
+ '\u00CD': 'I',
+ '\u00CE': 'I',
+ '\u0128': 'I',
+ '\u012A': 'I',
+ '\u012C': 'I',
+ '\u0130': 'I',
+ '\u00CF': 'I',
+ '\u1E2E': 'I',
+ '\u1EC8': 'I',
+ '\u01CF': 'I',
+ '\u0208': 'I',
+ '\u020A': 'I',
+ '\u1ECA': 'I',
+ '\u012E': 'I',
+ '\u1E2C': 'I',
+ '\u0197': 'I',
+ '\u24BF': 'J',
+ '\uFF2A': 'J',
+ '\u0134': 'J',
+ '\u0248': 'J',
+ '\u24C0': 'K',
+ '\uFF2B': 'K',
+ '\u1E30': 'K',
+ '\u01E8': 'K',
+ '\u1E32': 'K',
+ '\u0136': 'K',
+ '\u1E34': 'K',
+ '\u0198': 'K',
+ '\u2C69': 'K',
+ '\uA740': 'K',
+ '\uA742': 'K',
+ '\uA744': 'K',
+ '\uA7A2': 'K',
+ '\u24C1': 'L',
+ '\uFF2C': 'L',
+ '\u013F': 'L',
+ '\u0139': 'L',
+ '\u013D': 'L',
+ '\u1E36': 'L',
+ '\u1E38': 'L',
+ '\u013B': 'L',
+ '\u1E3C': 'L',
+ '\u1E3A': 'L',
+ '\u0141': 'L',
+ '\u023D': 'L',
+ '\u2C62': 'L',
+ '\u2C60': 'L',
+ '\uA748': 'L',
+ '\uA746': 'L',
+ '\uA780': 'L',
+ '\u01C7': 'LJ',
+ '\u01C8': 'Lj',
+ '\u24C2': 'M',
+ '\uFF2D': 'M',
+ '\u1E3E': 'M',
+ '\u1E40': 'M',
+ '\u1E42': 'M',
+ '\u2C6E': 'M',
+ '\u019C': 'M',
+ '\u24C3': 'N',
+ '\uFF2E': 'N',
+ '\u01F8': 'N',
+ '\u0143': 'N',
+ '\u00D1': 'N',
+ '\u1E44': 'N',
+ '\u0147': 'N',
+ '\u1E46': 'N',
+ '\u0145': 'N',
+ '\u1E4A': 'N',
+ '\u1E48': 'N',
+ '\u0220': 'N',
+ '\u019D': 'N',
+ '\uA790': 'N',
+ '\uA7A4': 'N',
+ '\u01CA': 'NJ',
+ '\u01CB': 'Nj',
+ '\u24C4': 'O',
+ '\uFF2F': 'O',
+ '\u00D2': 'O',
+ '\u00D3': 'O',
+ '\u00D4': 'O',
+ '\u1ED2': 'O',
+ '\u1ED0': 'O',
+ '\u1ED6': 'O',
+ '\u1ED4': 'O',
+ '\u00D5': 'O',
+ '\u1E4C': 'O',
+ '\u022C': 'O',
+ '\u1E4E': 'O',
+ '\u014C': 'O',
+ '\u1E50': 'O',
+ '\u1E52': 'O',
+ '\u014E': 'O',
+ '\u022E': 'O',
+ '\u0230': 'O',
+ '\u00D6': 'O',
+ '\u022A': 'O',
+ '\u1ECE': 'O',
+ '\u0150': 'O',
+ '\u01D1': 'O',
+ '\u020C': 'O',
+ '\u020E': 'O',
+ '\u01A0': 'O',
+ '\u1EDC': 'O',
+ '\u1EDA': 'O',
+ '\u1EE0': 'O',
+ '\u1EDE': 'O',
+ '\u1EE2': 'O',
+ '\u1ECC': 'O',
+ '\u1ED8': 'O',
+ '\u01EA': 'O',
+ '\u01EC': 'O',
+ '\u00D8': 'O',
+ '\u01FE': 'O',
+ '\u0186': 'O',
+ '\u019F': 'O',
+ '\uA74A': 'O',
+ '\uA74C': 'O',
+ '\u01A2': 'OI',
+ '\uA74E': 'OO',
+ '\u0222': 'OU',
+ '\u24C5': 'P',
+ '\uFF30': 'P',
+ '\u1E54': 'P',
+ '\u1E56': 'P',
+ '\u01A4': 'P',
+ '\u2C63': 'P',
+ '\uA750': 'P',
+ '\uA752': 'P',
+ '\uA754': 'P',
+ '\u24C6': 'Q',
+ '\uFF31': 'Q',
+ '\uA756': 'Q',
+ '\uA758': 'Q',
+ '\u024A': 'Q',
+ '\u24C7': 'R',
+ '\uFF32': 'R',
+ '\u0154': 'R',
+ '\u1E58': 'R',
+ '\u0158': 'R',
+ '\u0210': 'R',
+ '\u0212': 'R',
+ '\u1E5A': 'R',
+ '\u1E5C': 'R',
+ '\u0156': 'R',
+ '\u1E5E': 'R',
+ '\u024C': 'R',
+ '\u2C64': 'R',
+ '\uA75A': 'R',
+ '\uA7A6': 'R',
+ '\uA782': 'R',
+ '\u24C8': 'S',
+ '\uFF33': 'S',
+ '\u1E9E': 'S',
+ '\u015A': 'S',
+ '\u1E64': 'S',
+ '\u015C': 'S',
+ '\u1E60': 'S',
+ '\u0160': 'S',
+ '\u1E66': 'S',
+ '\u1E62': 'S',
+ '\u1E68': 'S',
+ '\u0218': 'S',
+ '\u015E': 'S',
+ '\u2C7E': 'S',
+ '\uA7A8': 'S',
+ '\uA784': 'S',
+ '\u24C9': 'T',
+ '\uFF34': 'T',
+ '\u1E6A': 'T',
+ '\u0164': 'T',
+ '\u1E6C': 'T',
+ '\u021A': 'T',
+ '\u0162': 'T',
+ '\u1E70': 'T',
+ '\u1E6E': 'T',
+ '\u0166': 'T',
+ '\u01AC': 'T',
+ '\u01AE': 'T',
+ '\u023E': 'T',
+ '\uA786': 'T',
+ '\uA728': 'TZ',
+ '\u24CA': 'U',
+ '\uFF35': 'U',
+ '\u00D9': 'U',
+ '\u00DA': 'U',
+ '\u00DB': 'U',
+ '\u0168': 'U',
+ '\u1E78': 'U',
+ '\u016A': 'U',
+ '\u1E7A': 'U',
+ '\u016C': 'U',
+ '\u00DC': 'U',
+ '\u01DB': 'U',
+ '\u01D7': 'U',
+ '\u01D5': 'U',
+ '\u01D9': 'U',
+ '\u1EE6': 'U',
+ '\u016E': 'U',
+ '\u0170': 'U',
+ '\u01D3': 'U',
+ '\u0214': 'U',
+ '\u0216': 'U',
+ '\u01AF': 'U',
+ '\u1EEA': 'U',
+ '\u1EE8': 'U',
+ '\u1EEE': 'U',
+ '\u1EEC': 'U',
+ '\u1EF0': 'U',
+ '\u1EE4': 'U',
+ '\u1E72': 'U',
+ '\u0172': 'U',
+ '\u1E76': 'U',
+ '\u1E74': 'U',
+ '\u0244': 'U',
+ '\u24CB': 'V',
+ '\uFF36': 'V',
+ '\u1E7C': 'V',
+ '\u1E7E': 'V',
+ '\u01B2': 'V',
+ '\uA75E': 'V',
+ '\u0245': 'V',
+ '\uA760': 'VY',
+ '\u24CC': 'W',
+ '\uFF37': 'W',
+ '\u1E80': 'W',
+ '\u1E82': 'W',
+ '\u0174': 'W',
+ '\u1E86': 'W',
+ '\u1E84': 'W',
+ '\u1E88': 'W',
+ '\u2C72': 'W',
+ '\u24CD': 'X',
+ '\uFF38': 'X',
+ '\u1E8A': 'X',
+ '\u1E8C': 'X',
+ '\u24CE': 'Y',
+ '\uFF39': 'Y',
+ '\u1EF2': 'Y',
+ '\u00DD': 'Y',
+ '\u0176': 'Y',
+ '\u1EF8': 'Y',
+ '\u0232': 'Y',
+ '\u1E8E': 'Y',
+ '\u0178': 'Y',
+ '\u1EF6': 'Y',
+ '\u1EF4': 'Y',
+ '\u01B3': 'Y',
+ '\u024E': 'Y',
+ '\u1EFE': 'Y',
+ '\u24CF': 'Z',
+ '\uFF3A': 'Z',
+ '\u0179': 'Z',
+ '\u1E90': 'Z',
+ '\u017B': 'Z',
+ '\u017D': 'Z',
+ '\u1E92': 'Z',
+ '\u1E94': 'Z',
+ '\u01B5': 'Z',
+ '\u0224': 'Z',
+ '\u2C7F': 'Z',
+ '\u2C6B': 'Z',
+ '\uA762': 'Z',
+ '\u24D0': 'a',
+ '\uFF41': 'a',
+ '\u1E9A': 'a',
+ '\u00E0': 'a',
+ '\u00E1': 'a',
+ '\u00E2': 'a',
+ '\u1EA7': 'a',
+ '\u1EA5': 'a',
+ '\u1EAB': 'a',
+ '\u1EA9': 'a',
+ '\u00E3': 'a',
+ '\u0101': 'a',
+ '\u0103': 'a',
+ '\u1EB1': 'a',
+ '\u1EAF': 'a',
+ '\u1EB5': 'a',
+ '\u1EB3': 'a',
+ '\u0227': 'a',
+ '\u01E1': 'a',
+ '\u00E4': 'a',
+ '\u01DF': 'a',
+ '\u1EA3': 'a',
+ '\u00E5': 'a',
+ '\u01FB': 'a',
+ '\u01CE': 'a',
+ '\u0201': 'a',
+ '\u0203': 'a',
+ '\u1EA1': 'a',
+ '\u1EAD': 'a',
+ '\u1EB7': 'a',
+ '\u1E01': 'a',
+ '\u0105': 'a',
+ '\u2C65': 'a',
+ '\u0250': 'a',
+ '\uA733': 'aa',
+ '\u00E6': 'ae',
+ '\u01FD': 'ae',
+ '\u01E3': 'ae',
+ '\uA735': 'ao',
+ '\uA737': 'au',
+ '\uA739': 'av',
+ '\uA73B': 'av',
+ '\uA73D': 'ay',
+ '\u24D1': 'b',
+ '\uFF42': 'b',
+ '\u1E03': 'b',
+ '\u1E05': 'b',
+ '\u1E07': 'b',
+ '\u0180': 'b',
+ '\u0183': 'b',
+ '\u0253': 'b',
+ '\u24D2': 'c',
+ '\uFF43': 'c',
+ '\u0107': 'c',
+ '\u0109': 'c',
+ '\u010B': 'c',
+ '\u010D': 'c',
+ '\u00E7': 'c',
+ '\u1E09': 'c',
+ '\u0188': 'c',
+ '\u023C': 'c',
+ '\uA73F': 'c',
+ '\u2184': 'c',
+ '\u24D3': 'd',
+ '\uFF44': 'd',
+ '\u1E0B': 'd',
+ '\u010F': 'd',
+ '\u1E0D': 'd',
+ '\u1E11': 'd',
+ '\u1E13': 'd',
+ '\u1E0F': 'd',
+ '\u0111': 'd',
+ '\u018C': 'd',
+ '\u0256': 'd',
+ '\u0257': 'd',
+ '\uA77A': 'd',
+ '\u01F3': 'dz',
+ '\u01C6': 'dz',
+ '\u24D4': 'e',
+ '\uFF45': 'e',
+ '\u00E8': 'e',
+ '\u00E9': 'e',
+ '\u00EA': 'e',
+ '\u1EC1': 'e',
+ '\u1EBF': 'e',
+ '\u1EC5': 'e',
+ '\u1EC3': 'e',
+ '\u1EBD': 'e',
+ '\u0113': 'e',
+ '\u1E15': 'e',
+ '\u1E17': 'e',
+ '\u0115': 'e',
+ '\u0117': 'e',
+ '\u00EB': 'e',
+ '\u1EBB': 'e',
+ '\u011B': 'e',
+ '\u0205': 'e',
+ '\u0207': 'e',
+ '\u1EB9': 'e',
+ '\u1EC7': 'e',
+ '\u0229': 'e',
+ '\u1E1D': 'e',
+ '\u0119': 'e',
+ '\u1E19': 'e',
+ '\u1E1B': 'e',
+ '\u0247': 'e',
+ '\u025B': 'e',
+ '\u01DD': 'e',
+ '\u24D5': 'f',
+ '\uFF46': 'f',
+ '\u1E1F': 'f',
+ '\u0192': 'f',
+ '\uA77C': 'f',
+ '\u24D6': 'g',
+ '\uFF47': 'g',
+ '\u01F5': 'g',
+ '\u011D': 'g',
+ '\u1E21': 'g',
+ '\u011F': 'g',
+ '\u0121': 'g',
+ '\u01E7': 'g',
+ '\u0123': 'g',
+ '\u01E5': 'g',
+ '\u0260': 'g',
+ '\uA7A1': 'g',
+ '\u1D79': 'g',
+ '\uA77F': 'g',
+ '\u24D7': 'h',
+ '\uFF48': 'h',
+ '\u0125': 'h',
+ '\u1E23': 'h',
+ '\u1E27': 'h',
+ '\u021F': 'h',
+ '\u1E25': 'h',
+ '\u1E29': 'h',
+ '\u1E2B': 'h',
+ '\u1E96': 'h',
+ '\u0127': 'h',
+ '\u2C68': 'h',
+ '\u2C76': 'h',
+ '\u0265': 'h',
+ '\u0195': 'hv',
+ '\u24D8': 'i',
+ '\uFF49': 'i',
+ '\u00EC': 'i',
+ '\u00ED': 'i',
+ '\u00EE': 'i',
+ '\u0129': 'i',
+ '\u012B': 'i',
+ '\u012D': 'i',
+ '\u00EF': 'i',
+ '\u1E2F': 'i',
+ '\u1EC9': 'i',
+ '\u01D0': 'i',
+ '\u0209': 'i',
+ '\u020B': 'i',
+ '\u1ECB': 'i',
+ '\u012F': 'i',
+ '\u1E2D': 'i',
+ '\u0268': 'i',
+ '\u0131': 'i',
+ '\u24D9': 'j',
+ '\uFF4A': 'j',
+ '\u0135': 'j',
+ '\u01F0': 'j',
+ '\u0249': 'j',
+ '\u24DA': 'k',
+ '\uFF4B': 'k',
+ '\u1E31': 'k',
+ '\u01E9': 'k',
+ '\u1E33': 'k',
+ '\u0137': 'k',
+ '\u1E35': 'k',
+ '\u0199': 'k',
+ '\u2C6A': 'k',
+ '\uA741': 'k',
+ '\uA743': 'k',
+ '\uA745': 'k',
+ '\uA7A3': 'k',
+ '\u24DB': 'l',
+ '\uFF4C': 'l',
+ '\u0140': 'l',
+ '\u013A': 'l',
+ '\u013E': 'l',
+ '\u1E37': 'l',
+ '\u1E39': 'l',
+ '\u013C': 'l',
+ '\u1E3D': 'l',
+ '\u1E3B': 'l',
+ '\u017F': 'l',
+ '\u0142': 'l',
+ '\u019A': 'l',
+ '\u026B': 'l',
+ '\u2C61': 'l',
+ '\uA749': 'l',
+ '\uA781': 'l',
+ '\uA747': 'l',
+ '\u01C9': 'lj',
+ '\u24DC': 'm',
+ '\uFF4D': 'm',
+ '\u1E3F': 'm',
+ '\u1E41': 'm',
+ '\u1E43': 'm',
+ '\u0271': 'm',
+ '\u026F': 'm',
+ '\u24DD': 'n',
+ '\uFF4E': 'n',
+ '\u01F9': 'n',
+ '\u0144': 'n',
+ '\u00F1': 'n',
+ '\u1E45': 'n',
+ '\u0148': 'n',
+ '\u1E47': 'n',
+ '\u0146': 'n',
+ '\u1E4B': 'n',
+ '\u1E49': 'n',
+ '\u019E': 'n',
+ '\u0272': 'n',
+ '\u0149': 'n',
+ '\uA791': 'n',
+ '\uA7A5': 'n',
+ '\u01CC': 'nj',
+ '\u24DE': 'o',
+ '\uFF4F': 'o',
+ '\u00F2': 'o',
+ '\u00F3': 'o',
+ '\u00F4': 'o',
+ '\u1ED3': 'o',
+ '\u1ED1': 'o',
+ '\u1ED7': 'o',
+ '\u1ED5': 'o',
+ '\u00F5': 'o',
+ '\u1E4D': 'o',
+ '\u022D': 'o',
+ '\u1E4F': 'o',
+ '\u014D': 'o',
+ '\u1E51': 'o',
+ '\u1E53': 'o',
+ '\u014F': 'o',
+ '\u022F': 'o',
+ '\u0231': 'o',
+ '\u00F6': 'o',
+ '\u022B': 'o',
+ '\u1ECF': 'o',
+ '\u0151': 'o',
+ '\u01D2': 'o',
+ '\u020D': 'o',
+ '\u020F': 'o',
+ '\u01A1': 'o',
+ '\u1EDD': 'o',
+ '\u1EDB': 'o',
+ '\u1EE1': 'o',
+ '\u1EDF': 'o',
+ '\u1EE3': 'o',
+ '\u1ECD': 'o',
+ '\u1ED9': 'o',
+ '\u01EB': 'o',
+ '\u01ED': 'o',
+ '\u00F8': 'o',
+ '\u01FF': 'o',
+ '\u0254': 'o',
+ '\uA74B': 'o',
+ '\uA74D': 'o',
+ '\u0275': 'o',
+ '\u01A3': 'oi',
+ '\u0223': 'ou',
+ '\uA74F': 'oo',
+ '\u24DF': 'p',
+ '\uFF50': 'p',
+ '\u1E55': 'p',
+ '\u1E57': 'p',
+ '\u01A5': 'p',
+ '\u1D7D': 'p',
+ '\uA751': 'p',
+ '\uA753': 'p',
+ '\uA755': 'p',
+ '\u24E0': 'q',
+ '\uFF51': 'q',
+ '\u024B': 'q',
+ '\uA757': 'q',
+ '\uA759': 'q',
+ '\u24E1': 'r',
+ '\uFF52': 'r',
+ '\u0155': 'r',
+ '\u1E59': 'r',
+ '\u0159': 'r',
+ '\u0211': 'r',
+ '\u0213': 'r',
+ '\u1E5B': 'r',
+ '\u1E5D': 'r',
+ '\u0157': 'r',
+ '\u1E5F': 'r',
+ '\u024D': 'r',
+ '\u027D': 'r',
+ '\uA75B': 'r',
+ '\uA7A7': 'r',
+ '\uA783': 'r',
+ '\u24E2': 's',
+ '\uFF53': 's',
+ '\u00DF': 's',
+ '\u015B': 's',
+ '\u1E65': 's',
+ '\u015D': 's',
+ '\u1E61': 's',
+ '\u0161': 's',
+ '\u1E67': 's',
+ '\u1E63': 's',
+ '\u1E69': 's',
+ '\u0219': 's',
+ '\u015F': 's',
+ '\u023F': 's',
+ '\uA7A9': 's',
+ '\uA785': 's',
+ '\u1E9B': 's',
+ '\u24E3': 't',
+ '\uFF54': 't',
+ '\u1E6B': 't',
+ '\u1E97': 't',
+ '\u0165': 't',
+ '\u1E6D': 't',
+ '\u021B': 't',
+ '\u0163': 't',
+ '\u1E71': 't',
+ '\u1E6F': 't',
+ '\u0167': 't',
+ '\u01AD': 't',
+ '\u0288': 't',
+ '\u2C66': 't',
+ '\uA787': 't',
+ '\uA729': 'tz',
+ '\u24E4': 'u',
+ '\uFF55': 'u',
+ '\u00F9': 'u',
+ '\u00FA': 'u',
+ '\u00FB': 'u',
+ '\u0169': 'u',
+ '\u1E79': 'u',
+ '\u016B': 'u',
+ '\u1E7B': 'u',
+ '\u016D': 'u',
+ '\u00FC': 'u',
+ '\u01DC': 'u',
+ '\u01D8': 'u',
+ '\u01D6': 'u',
+ '\u01DA': 'u',
+ '\u1EE7': 'u',
+ '\u016F': 'u',
+ '\u0171': 'u',
+ '\u01D4': 'u',
+ '\u0215': 'u',
+ '\u0217': 'u',
+ '\u01B0': 'u',
+ '\u1EEB': 'u',
+ '\u1EE9': 'u',
+ '\u1EEF': 'u',
+ '\u1EED': 'u',
+ '\u1EF1': 'u',
+ '\u1EE5': 'u',
+ '\u1E73': 'u',
+ '\u0173': 'u',
+ '\u1E77': 'u',
+ '\u1E75': 'u',
+ '\u0289': 'u',
+ '\u24E5': 'v',
+ '\uFF56': 'v',
+ '\u1E7D': 'v',
+ '\u1E7F': 'v',
+ '\u028B': 'v',
+ '\uA75F': 'v',
+ '\u028C': 'v',
+ '\uA761': 'vy',
+ '\u24E6': 'w',
+ '\uFF57': 'w',
+ '\u1E81': 'w',
+ '\u1E83': 'w',
+ '\u0175': 'w',
+ '\u1E87': 'w',
+ '\u1E85': 'w',
+ '\u1E98': 'w',
+ '\u1E89': 'w',
+ '\u2C73': 'w',
+ '\u24E7': 'x',
+ '\uFF58': 'x',
+ '\u1E8B': 'x',
+ '\u1E8D': 'x',
+ '\u24E8': 'y',
+ '\uFF59': 'y',
+ '\u1EF3': 'y',
+ '\u00FD': 'y',
+ '\u0177': 'y',
+ '\u1EF9': 'y',
+ '\u0233': 'y',
+ '\u1E8F': 'y',
+ '\u00FF': 'y',
+ '\u1EF7': 'y',
+ '\u1E99': 'y',
+ '\u1EF5': 'y',
+ '\u01B4': 'y',
+ '\u024F': 'y',
+ '\u1EFF': 'y',
+ '\u24E9': 'z',
+ '\uFF5A': 'z',
+ '\u017A': 'z',
+ '\u1E91': 'z',
+ '\u017C': 'z',
+ '\u017E': 'z',
+ '\u1E93': 'z',
+ '\u1E95': 'z',
+ '\u01B6': 'z',
+ '\u0225': 'z',
+ '\u0240': 'z',
+ '\u2C6C': 'z',
+ '\uA763': 'z',
+ '\u0386': '\u0391',
+ '\u0388': '\u0395',
+ '\u0389': '\u0397',
+ '\u038A': '\u0399',
+ '\u03AA': '\u0399',
+ '\u038C': '\u039F',
+ '\u038E': '\u03A5',
+ '\u03AB': '\u03A5',
+ '\u038F': '\u03A9',
+ '\u03AC': '\u03B1',
+ '\u03AD': '\u03B5',
+ '\u03AE': '\u03B7',
+ '\u03AF': '\u03B9',
+ '\u03CA': '\u03B9',
+ '\u0390': '\u03B9',
+ '\u03CC': '\u03BF',
+ '\u03CD': '\u03C5',
+ '\u03CB': '\u03C5',
+ '\u03B0': '\u03C5',
+ '\u03C9': '\u03C9',
+ '\u03C2': '\u03C3'
+ };
+
+ return diacritics;
+});
+
+S2.define('select2/data/base',[
+ '../utils'
+], function (Utils) {
+ function BaseAdapter ($element, options) {
+ BaseAdapter.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(BaseAdapter, Utils.Observable);
+
+ BaseAdapter.prototype.current = function (callback) {
+ throw new Error('The `current` method must be defined in child classes.');
+ };
+
+ BaseAdapter.prototype.query = function (params, callback) {
+ throw new Error('The `query` method must be defined in child classes.');
+ };
+
+ BaseAdapter.prototype.bind = function (container, $container) {
+ // Can be implemented in subclasses
+ };
+
+ BaseAdapter.prototype.destroy = function () {
+ // Can be implemented in subclasses
+ };
+
+ BaseAdapter.prototype.generateResultId = function (container, data) {
+ var id = container.id + '-result-';
+
+ id += Utils.generateChars(4);
+
+ if (data.id != null) {
+ id += '-' + data.id.toString();
+ } else {
+ id += '-' + Utils.generateChars(4);
+ }
+ return id;
+ };
+
+ return BaseAdapter;
+});
+
+S2.define('select2/data/select',[
+ './base',
+ '../utils',
+ 'jquery'
+], function (BaseAdapter, Utils, $) {
+ function SelectAdapter ($element, options) {
+ this.$element = $element;
+ this.options = options;
+
+ SelectAdapter.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(SelectAdapter, BaseAdapter);
+
+ SelectAdapter.prototype.current = function (callback) {
+ var data = [];
+ var self = this;
+
+ this.$element.find(':selected').each(function () {
+ var $option = $(this);
+
+ var option = self.item($option);
+
+ data.push(option);
+ });
+
+ callback(data);
+ };
+
+ SelectAdapter.prototype.select = function (data) {
+ var self = this;
+
+ data.selected = true;
+
+ // If data.element is a DOM node, use it instead
+ if ($(data.element).is('option')) {
+ data.element.selected = true;
+
+ this.$element.trigger('change');
+
+ return;
+ }
+
+ if (this.$element.prop('multiple')) {
+ this.current(function (currentData) {
+ var val = [];
+
+ data = [data];
+ data.push.apply(data, currentData);
+
+ for (var d = 0; d < data.length; d++) {
+ var id = data[d].id;
+
+ if ($.inArray(id, val) === -1) {
+ val.push(id);
+ }
+ }
+
+ self.$element.val(val);
+ self.$element.trigger('change');
+ });
+ } else {
+ var val = data.id;
+
+ this.$element.val(val);
+ this.$element.trigger('change');
+ }
+ };
+
+ SelectAdapter.prototype.unselect = function (data) {
+ var self = this;
+
+ if (!this.$element.prop('multiple')) {
+ return;
+ }
+
+ data.selected = false;
+
+ if ($(data.element).is('option')) {
+ data.element.selected = false;
+
+ this.$element.trigger('change');
+
+ return;
+ }
+
+ this.current(function (currentData) {
+ var val = [];
+
+ for (var d = 0; d < currentData.length; d++) {
+ var id = currentData[d].id;
+
+ if (id !== data.id && $.inArray(id, val) === -1) {
+ val.push(id);
+ }
+ }
+
+ self.$element.val(val);
+
+ self.$element.trigger('change');
+ });
+ };
+
+ SelectAdapter.prototype.bind = function (container, $container) {
+ var self = this;
+
+ this.container = container;
+
+ container.on('select', function (params) {
+ self.select(params.data);
+ });
+
+ container.on('unselect', function (params) {
+ self.unselect(params.data);
+ });
+ };
+
+ SelectAdapter.prototype.destroy = function () {
+ // Remove anything added to child elements
+ this.$element.find('*').each(function () {
+ // Remove any custom data set by Select2
+ $.removeData(this, 'data');
+ });
+ };
+
+ SelectAdapter.prototype.query = function (params, callback) {
+ var data = [];
+ var self = this;
+
+ var $options = this.$element.children();
+
+ $options.each(function () {
+ var $option = $(this);
+
+ if (!$option.is('option') && !$option.is('optgroup')) {
+ return;
+ }
+
+ var option = self.item($option);
+
+ var matches = self.matches(params, option);
+
+ if (matches !== null) {
+ data.push(matches);
+ }
+ });
+
+ callback({
+ results: data
+ });
+ };
+
+ SelectAdapter.prototype.addOptions = function ($options) {
+ Utils.appendMany(this.$element, $options);
+ };
+
+ SelectAdapter.prototype.option = function (data) {
+ var option;
+
+ if (data.children) {
+ option = document.createElement('optgroup');
+ option.label = data.text;
+ } else {
+ option = document.createElement('option');
+
+ if (option.textContent !== undefined) {
+ option.textContent = data.text;
+ } else {
+ option.innerText = data.text;
+ }
+ }
+
+ if (data.id) {
+ option.value = data.id;
+ }
+
+ if (data.disabled) {
+ option.disabled = true;
+ }
+
+ if (data.selected) {
+ option.selected = true;
+ }
+
+ if (data.title) {
+ option.title = data.title;
+ }
+
+ var $option = $(option);
+
+ var normalizedData = this._normalizeItem(data);
+ normalizedData.element = option;
+
+ // Override the option's data with the combined data
+ $.data(option, 'data', normalizedData);
+
+ return $option;
+ };
+
+ SelectAdapter.prototype.item = function ($option) {
+ var data = {};
+
+ data = $.data($option[0], 'data');
+
+ if (data != null) {
+ return data;
+ }
+
+ if ($option.is('option')) {
+ data = {
+ id: $option.val(),
+ text: $option.text(),
+ disabled: $option.prop('disabled'),
+ selected: $option.prop('selected'),
+ title: $option.prop('title')
+ };
+ } else if ($option.is('optgroup')) {
+ data = {
+ text: $option.prop('label'),
+ children: [],
+ title: $option.prop('title')
+ };
+
+ var $children = $option.children('option');
+ var children = [];
+
+ for (var c = 0; c < $children.length; c++) {
+ var $child = $($children[c]);
+
+ var child = this.item($child);
+
+ children.push(child);
+ }
+
+ data.children = children;
+ }
+
+ data = this._normalizeItem(data);
+ data.element = $option[0];
+
+ $.data($option[0], 'data', data);
+
+ return data;
+ };
+
+ SelectAdapter.prototype._normalizeItem = function (item) {
+ if (!$.isPlainObject(item)) {
+ item = {
+ id: item,
+ text: item
+ };
+ }
+
+ item = $.extend({}, {
+ text: ''
+ }, item);
+
+ var defaults = {
+ selected: false,
+ disabled: false
+ };
+
+ if (item.id != null) {
+ item.id = item.id.toString();
+ }
+
+ if (item.text != null) {
+ item.text = item.text.toString();
+ }
+
+ if (item._resultId == null && item.id && this.container != null) {
+ item._resultId = this.generateResultId(this.container, item);
+ }
+
+ return $.extend({}, defaults, item);
+ };
+
+ SelectAdapter.prototype.matches = function (params, data) {
+ var matcher = this.options.get('matcher');
+
+ return matcher(params, data);
+ };
+
+ return SelectAdapter;
+});
+
+S2.define('select2/data/array',[
+ './select',
+ '../utils',
+ 'jquery'
+], function (SelectAdapter, Utils, $) {
+ function ArrayAdapter ($element, options) {
+ var data = options.get('data') || [];
+
+ ArrayAdapter.__super__.constructor.call(this, $element, options);
+
+ this.addOptions(this.convertToOptions(data));
+ }
+
+ Utils.Extend(ArrayAdapter, SelectAdapter);
+
+ ArrayAdapter.prototype.select = function (data) {
+ var $option = this.$element.find('option').filter(function (i, elm) {
+ return elm.value == data.id.toString();
+ });
+
+ if ($option.length === 0) {
+ $option = this.option(data);
+
+ this.addOptions($option);
+ }
+
+ ArrayAdapter.__super__.select.call(this, data);
+ };
+
+ ArrayAdapter.prototype.convertToOptions = function (data) {
+ var self = this;
+
+ var $existing = this.$element.find('option');
+ var existingIds = $existing.map(function () {
+ return self.item($(this)).id;
+ }).get();
+
+ var $options = [];
+
+ // Filter out all items except for the one passed in the argument
+ function onlyItem (item) {
+ return function () {
+ return $(this).val() == item.id;
+ };
+ }
+
+ for (var d = 0; d < data.length; d++) {
+ var item = this._normalizeItem(data[d]);
+
+ // Skip items which were pre-loaded, only merge the data
+ if ($.inArray(item.id, existingIds) >= 0) {
+ var $existingOption = $existing.filter(onlyItem(item));
+
+ var existingData = this.item($existingOption);
+ var newData = $.extend(true, {}, item, existingData);
+
+ var $newOption = this.option(newData);
+
+ $existingOption.replaceWith($newOption);
+
+ continue;
+ }
+
+ var $option = this.option(item);
+
+ if (item.children) {
+ var $children = this.convertToOptions(item.children);
+
+ Utils.appendMany($option, $children);
+ }
+
+ $options.push($option);
+ }
+
+ return $options;
+ };
+
+ return ArrayAdapter;
+});
+
+S2.define('select2/data/ajax',[
+ './array',
+ '../utils',
+ 'jquery'
+], function (ArrayAdapter, Utils, $) {
+ function AjaxAdapter ($element, options) {
+ this.ajaxOptions = this._applyDefaults(options.get('ajax'));
+
+ if (this.ajaxOptions.processResults != null) {
+ this.processResults = this.ajaxOptions.processResults;
+ }
+
+ AjaxAdapter.__super__.constructor.call(this, $element, options);
+ }
+
+ Utils.Extend(AjaxAdapter, ArrayAdapter);
+
+ AjaxAdapter.prototype._applyDefaults = function (options) {
+ var defaults = {
+ data: function (params) {
+ return $.extend({}, params, {
+ q: params.term
+ });
+ },
+ transport: function (params, success, failure) {
+ var $request = $.ajax(params);
+
+ $request.then(success);
+ $request.fail(failure);
+
+ return $request;
+ }
+ };
+
+ return $.extend({}, defaults, options, true);
+ };
+
+ AjaxAdapter.prototype.processResults = function (results) {
+ return results;
+ };
+
+ AjaxAdapter.prototype.query = function (params, callback) {
+ var matches = [];
+ var self = this;
+
+ if (this._request != null) {
+ // JSONP requests cannot always be aborted
+ if ($.isFunction(this._request.abort)) {
+ this._request.abort();
+ }
+
+ this._request = null;
+ }
+
+ var options = $.extend({
+ type: 'GET'
+ }, this.ajaxOptions);
+
+ if (typeof options.url === 'function') {
+ options.url = options.url.call(this.$element, params);
+ }
+
+ if (typeof options.data === 'function') {
+ options.data = options.data.call(this.$element, params);
+ }
+
+ function request () {
+ var $request = options.transport(options, function (data) {
+ var results = self.processResults(data, params);
+
+ if (self.options.get('debug') && window.console && console.error) {
+ // Check to make sure that the response included a `results` key.
+ if (!results || !results.results || !$.isArray(results.results)) {
+ console.error(
+ 'Select2: The AJAX results did not return an array in the ' +
+ '`results` key of the response.'
+ );
+ }
+ }
+
+ callback(results);
+ }, function () {
+ // Attempt to detect if a request was aborted
+ // Only works if the transport exposes a status property
+ if ($request.status && $request.status === '0') {
+ return;
+ }
+
+ self.trigger('results:message', {
+ message: 'errorLoading'
+ });
+ });
+
+ self._request = $request;
+ }
+
+ if (this.ajaxOptions.delay && params.term != null) {
+ if (this._queryTimeout) {
+ window.clearTimeout(this._queryTimeout);
+ }
+
+ this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
+ } else {
+ request();
+ }
+ };
+
+ return AjaxAdapter;
+});
+
+S2.define('select2/data/tags',[
+ 'jquery'
+], function ($) {
+ function Tags (decorated, $element, options) {
+ var tags = options.get('tags');
+
+ var createTag = options.get('createTag');
+
+ if (createTag !== undefined) {
+ this.createTag = createTag;
+ }
+
+ var insertTag = options.get('insertTag');
+
+ if (insertTag !== undefined) {
+ this.insertTag = insertTag;
+ }
+
+ decorated.call(this, $element, options);
+
+ if ($.isArray(tags)) {
+ for (var t = 0; t < tags.length; t++) {
+ var tag = tags[t];
+ var item = this._normalizeItem(tag);
+
+ var $option = this.option(item);
+
+ this.$element.append($option);
+ }
+ }
+ }
+
+ Tags.prototype.query = function (decorated, params, callback) {
+ var self = this;
+
+ this._removeOldTags();
+
+ if (params.term == null || params.page != null) {
+ decorated.call(this, params, callback);
+ return;
+ }
+
+ function wrapper (obj, child) {
+ var data = obj.results;
+
+ for (var i = 0; i < data.length; i++) {
+ var option = data[i];
+
+ var checkChildren = (
+ option.children != null &&
+ !wrapper({
+ results: option.children
+ }, true)
+ );
+
+ var checkText = option.text === params.term;
+
+ if (checkText || checkChildren) {
+ if (child) {
+ return false;
+ }
+
+ obj.data = data;
+ callback(obj);
+
+ return;
+ }
+ }
+
+ if (child) {
+ return true;
+ }
+
+ var tag = self.createTag(params);
+
+ if (tag != null) {
+ var $option = self.option(tag);
+ $option.attr('data-select2-tag', true);
+
+ self.addOptions([$option]);
+
+ self.insertTag(data, tag);
+ }
+
+ obj.results = data;
+
+ callback(obj);
+ }
+
+ decorated.call(this, params, wrapper);
+ };
+
+ Tags.prototype.createTag = function (decorated, params) {
+ var term = $.trim(params.term);
+
+ if (term === '') {
+ return null;
+ }
+
+ return {
+ id: term,
+ text: term
+ };
+ };
+
+ Tags.prototype.insertTag = function (_, data, tag) {
+ data.unshift(tag);
+ };
+
+ Tags.prototype._removeOldTags = function (_) {
+ var tag = this._lastTag;
+
+ var $options = this.$element.find('option[data-select2-tag]');
+
+ $options.each(function () {
+ if (this.selected) {
+ return;
+ }
+
+ $(this).remove();
+ });
+ };
+
+ return Tags;
+});
+
+S2.define('select2/data/tokenizer',[
+ 'jquery'
+], function ($) {
+ function Tokenizer (decorated, $element, options) {
+ var tokenizer = options.get('tokenizer');
+
+ if (tokenizer !== undefined) {
+ this.tokenizer = tokenizer;
+ }
+
+ decorated.call(this, $element, options);
+ }
+
+ Tokenizer.prototype.bind = function (decorated, container, $container) {
+ decorated.call(this, container, $container);
+
+ this.$search = container.dropdown.$search || container.selection.$search ||
+ $container.find('.select2-search__field');
+ };
+
+ Tokenizer.prototype.query = function (decorated, params, callback) {
+ var self = this;
+
+ function createAndSelect (data) {
+ // Normalize the data object so we can use it for checks
+ var item = self._normalizeItem(data);
+
+ // Check if the data object already exists as a tag
+ // Select it if it doesn't
+ var $existingOptions = self.$element.find('option').filter(function () {
+ return $(this).val() === item.id;
+ });
+
+ // If an existing option wasn't found for it, create the option
+ if (!$existingOptions.length) {
+ var $option = self.option(item);
+ $option.attr('data-select2-tag', true);
+
+ self._removeOldTags();
+ self.addOptions([$option]);
+ }
+
+ // Select the item, now that we know there is an option for it
+ select(item);
+ }
+
+ function select (data) {
+ self.trigger('select', {
+ data: data
+ });
+ }
+
+ params.term = params.term || '';
+
+ var tokenData = this.tokenizer(params, this.options, createAndSelect);
+
+ if (tokenData.term !== params.term) {
+ // Replace the search term if we have the search box
+ if (this.$search.length) {
+ this.$search.val(tokenData.term);
+ this.$search.focus();
+ }
+
+ params.term = tokenData.term;
+ }
+
+ decorated.call(this, params, callback);
+ };
+
+ Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
+ var separators = options.get('tokenSeparators') || [];
+ var term = params.term;
+ var i = 0;
+
+ var createTag = this.createTag || function (params) {
+ return {
+ id: params.term,
+ text: params.term
+ };
+ };
+
+ while (i < term.length) {
+ var termChar = term[i];
+
+ if ($.inArray(termChar, separators) === -1) {
+ i++;
+
+ continue;
+ }
+
+ var part = term.substr(0, i);
+ var partParams = $.extend({}, params, {
+ term: part
+ });
+
+ var data = createTag(partParams);
+
+ if (data == null) {
+ i++;
+ continue;
+ }
+
+ callback(data);
+
+ // Reset the term to not include the tokenized portion
+ term = term.substr(i + 1) || '';
+ i = 0;
+ }
+
+ return {
+ term: term
+ };
+ };
+
+ return Tokenizer;
+});
+
+S2.define('select2/data/minimumInputLength',[
+
+], function () {
+ function MinimumInputLength (decorated, $e, options) {
+ this.minimumInputLength = options.get('minimumInputLength');
+
+ decorated.call(this, $e, options);
+ }
+
+ MinimumInputLength.prototype.query = function (decorated, params, callback) {
+ params.term = params.term || '';
+
+ if (params.term.length < this.minimumInputLength) {
+ this.trigger('results:message', {
+ message: 'inputTooShort',
+ args: {
+ minimum: this.minimumInputLength,
+ input: params.term,
+ params: params
+ }
+ });
+
+ return;
+ }
+
+ decorated.call(this, params, callback);
+ };
+
+ return MinimumInputLength;
+});
+
+S2.define('select2/data/maximumInputLength',[
+
+], function () {
+ function MaximumInputLength (decorated, $e, options) {
+ this.maximumInputLength = options.get('maximumInputLength');
+
+ decorated.call(this, $e, options);
+ }
+
+ MaximumInputLength.prototype.query = function (decorated, params, callback) {
+ params.term = params.term || '';
+
+ if (this.maximumInputLength > 0 &&
+ params.term.length > this.maximumInputLength) {
+ this.trigger('results:message', {
+ message: 'inputTooLong',
+ args: {
+ maximum: this.maximumInputLength,
+ input: params.term,
+ params: params
+ }
+ });
+
+ return;
+ }
+
+ decorated.call(this, params, callback);
+ };
+
+ return MaximumInputLength;
+});
+
+S2.define('select2/data/maximumSelectionLength',[
+
+], function (){
+ function MaximumSelectionLength (decorated, $e, options) {
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
+
+ decorated.call(this, $e, options);
+ }
+
+ MaximumSelectionLength.prototype.query =
+ function (decorated, params, callback) {
+ var self = this;
+
+ this.current(function (currentData) {
+ var count = currentData != null ? currentData.length : 0;
+ if (self.maximumSelectionLength > 0 &&
+ count >= self.maximumSelectionLength) {
+ self.trigger('results:message', {
+ message: 'maximumSelected',
+ args: {
+ maximum: self.maximumSelectionLength
+ }
+ });
+ return;
+ }
+ decorated.call(self, params, callback);
+ });
+ };
+
+ return MaximumSelectionLength;
+});
+
+S2.define('select2/dropdown',[
+ 'jquery',
+ './utils'
+], function ($, Utils) {
+ function Dropdown ($element, options) {
+ this.$element = $element;
+ this.options = options;
+
+ Dropdown.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(Dropdown, Utils.Observable);
+
+ Dropdown.prototype.render = function () {
+ var $dropdown = $(
+ '' +
+ ' ' +
+ ' '
+ );
+
+ $dropdown.attr('dir', this.options.get('dir'));
+
+ this.$dropdown = $dropdown;
+
+ return $dropdown;
+ };
+
+ Dropdown.prototype.bind = function () {
+ // Should be implemented in subclasses
+ };
+
+ Dropdown.prototype.position = function ($dropdown, $container) {
+ // Should be implmented in subclasses
+ };
+
+ Dropdown.prototype.destroy = function () {
+ // Remove the dropdown from the DOM
+ this.$dropdown.remove();
+ };
+
+ return Dropdown;
+});
+
+S2.define('select2/dropdown/search',[
+ 'jquery',
+ '../utils'
+], function ($, Utils) {
+ function Search () { }
+
+ Search.prototype.render = function (decorated) {
+ var $rendered = decorated.call(this);
+
+ var $search = $(
+ '' +
+ ' ' +
+ ' '
+ );
+
+ this.$searchContainer = $search;
+ this.$search = $search.find('input');
+
+ $rendered.prepend($search);
+
+ return $rendered;
+ };
+
+ Search.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ this.$search.on('keydown', function (evt) {
+ self.trigger('keypress', evt);
+
+ self._keyUpPrevented = evt.isDefaultPrevented();
+ });
+
+ // Workaround for browsers which do not support the `input` event
+ // This will prevent double-triggering of events for browsers which support
+ // both the `keyup` and `input` events.
+ this.$search.on('input', function (evt) {
+ // Unbind the duplicated `keyup` event
+ $(this).off('keyup');
+ });
+
+ this.$search.on('keyup input', function (evt) {
+ self.handleSearch(evt);
+ });
+
+ container.on('open', function () {
+ self.$search.attr('tabindex', 0);
+
+ self.$search.focus();
+
+ window.setTimeout(function () {
+ self.$search.focus();
+ }, 0);
+ });
+
+ container.on('close', function () {
+ self.$search.attr('tabindex', -1);
+
+ self.$search.val('');
+ });
+
+ container.on('focus', function () {
+ if (container.isOpen()) {
+ self.$search.focus();
+ }
+ });
+
+ container.on('results:all', function (params) {
+ if (params.query.term == null || params.query.term === '') {
+ var showSearch = self.showSearch(params);
+
+ if (showSearch) {
+ self.$searchContainer.removeClass('select2-search--hide');
+ } else {
+ self.$searchContainer.addClass('select2-search--hide');
+ }
+ }
+ });
+ };
+
+ Search.prototype.handleSearch = function (evt) {
+ if (!this._keyUpPrevented) {
+ var input = this.$search.val();
+
+ this.trigger('query', {
+ term: input
+ });
+ }
+
+ this._keyUpPrevented = false;
+ };
+
+ Search.prototype.showSearch = function (_, params) {
+ return true;
+ };
+
+ return Search;
+});
+
+S2.define('select2/dropdown/hidePlaceholder',[
+
+], function () {
+ function HidePlaceholder (decorated, $element, options, dataAdapter) {
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
+
+ decorated.call(this, $element, options, dataAdapter);
+ }
+
+ HidePlaceholder.prototype.append = function (decorated, data) {
+ data.results = this.removePlaceholder(data.results);
+
+ decorated.call(this, data);
+ };
+
+ HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
+ if (typeof placeholder === 'string') {
+ placeholder = {
+ id: '',
+ text: placeholder
+ };
+ }
+
+ return placeholder;
+ };
+
+ HidePlaceholder.prototype.removePlaceholder = function (_, data) {
+ var modifiedData = data.slice(0);
+
+ for (var d = data.length - 1; d >= 0; d--) {
+ var item = data[d];
+
+ if (this.placeholder.id === item.id) {
+ modifiedData.splice(d, 1);
+ }
+ }
+
+ return modifiedData;
+ };
+
+ return HidePlaceholder;
+});
+
+S2.define('select2/dropdown/infiniteScroll',[
+ 'jquery'
+], function ($) {
+ function InfiniteScroll (decorated, $element, options, dataAdapter) {
+ this.lastParams = {};
+
+ decorated.call(this, $element, options, dataAdapter);
+
+ this.$loadingMore = this.createLoadingMore();
+ this.loading = false;
+ }
+
+ InfiniteScroll.prototype.append = function (decorated, data) {
+ this.$loadingMore.remove();
+ this.loading = false;
+
+ decorated.call(this, data);
+
+ if (this.showLoadingMore(data)) {
+ this.$results.append(this.$loadingMore);
+ }
+ };
+
+ InfiniteScroll.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('query', function (params) {
+ self.lastParams = params;
+ self.loading = true;
+ });
+
+ container.on('query:append', function (params) {
+ self.lastParams = params;
+ self.loading = true;
+ });
+
+ this.$results.on('scroll', function () {
+ var isLoadMoreVisible = $.contains(
+ document.documentElement,
+ self.$loadingMore[0]
+ );
+
+ if (self.loading || !isLoadMoreVisible) {
+ return;
+ }
+
+ var currentOffset = self.$results.offset().top +
+ self.$results.outerHeight(false);
+ var loadingMoreOffset = self.$loadingMore.offset().top +
+ self.$loadingMore.outerHeight(false);
+
+ if (currentOffset + 50 >= loadingMoreOffset) {
+ self.loadMore();
+ }
+ });
+ };
+
+ InfiniteScroll.prototype.loadMore = function () {
+ this.loading = true;
+
+ var params = $.extend({}, {page: 1}, this.lastParams);
+
+ params.page++;
+
+ this.trigger('query:append', params);
+ };
+
+ InfiniteScroll.prototype.showLoadingMore = function (_, data) {
+ return data.pagination && data.pagination.more;
+ };
+
+ InfiniteScroll.prototype.createLoadingMore = function () {
+ var $option = $(
+ ' '
+ );
+
+ var message = this.options.get('translations').get('loadingMore');
+
+ $option.html(message(this.lastParams));
+
+ return $option;
+ };
+
+ return InfiniteScroll;
+});
+
+S2.define('select2/dropdown/attachBody',[
+ 'jquery',
+ '../utils'
+], function ($, Utils) {
+ function AttachBody (decorated, $element, options) {
+ this.$dropdownParent = options.get('dropdownParent') || $(document.body);
+
+ decorated.call(this, $element, options);
+ }
+
+ AttachBody.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ var setupResultsEvents = false;
+
+ decorated.call(this, container, $container);
+
+ container.on('open', function () {
+ self._showDropdown();
+ self._attachPositioningHandler(container);
+
+ if (!setupResultsEvents) {
+ setupResultsEvents = true;
+
+ container.on('results:all', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ container.on('results:append', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+ }
+ });
+
+ container.on('close', function () {
+ self._hideDropdown();
+ self._detachPositioningHandler(container);
+ });
+
+ this.$dropdownContainer.on('mousedown', function (evt) {
+ evt.stopPropagation();
+ });
+ };
+
+ AttachBody.prototype.destroy = function (decorated) {
+ decorated.call(this);
+
+ this.$dropdownContainer.remove();
+ };
+
+ AttachBody.prototype.position = function (decorated, $dropdown, $container) {
+ // Clone all of the container classes
+ $dropdown.attr('class', $container.attr('class'));
+
+ $dropdown.removeClass('select2');
+ $dropdown.addClass('select2-container--open');
+
+ $dropdown.css({
+ position: 'absolute',
+ top: -999999
+ });
+
+ this.$container = $container;
+ };
+
+ AttachBody.prototype.render = function (decorated) {
+ var $container = $(' ');
+
+ var $dropdown = decorated.call(this);
+ $container.append($dropdown);
+
+ this.$dropdownContainer = $container;
+
+ return $container;
+ };
+
+ AttachBody.prototype._hideDropdown = function (decorated) {
+ this.$dropdownContainer.detach();
+ };
+
+ AttachBody.prototype._attachPositioningHandler =
+ function (decorated, container) {
+ var self = this;
+
+ var scrollEvent = 'scroll.select2.' + container.id;
+ var resizeEvent = 'resize.select2.' + container.id;
+ var orientationEvent = 'orientationchange.select2.' + container.id;
+
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
+ $watchers.each(function () {
+ $(this).data('select2-scroll-position', {
+ x: $(this).scrollLeft(),
+ y: $(this).scrollTop()
+ });
+ });
+
+ $watchers.on(scrollEvent, function (ev) {
+ var position = $(this).data('select2-scroll-position');
+ $(this).scrollTop(position.y);
+ });
+
+ $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
+ function (e) {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+ };
+
+ AttachBody.prototype._detachPositioningHandler =
+ function (decorated, container) {
+ var scrollEvent = 'scroll.select2.' + container.id;
+ var resizeEvent = 'resize.select2.' + container.id;
+ var orientationEvent = 'orientationchange.select2.' + container.id;
+
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
+ $watchers.off(scrollEvent);
+
+ $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
+ };
+
+ AttachBody.prototype._positionDropdown = function () {
+ var $window = $(window);
+
+ var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
+ var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
+
+ var newDirection = null;
+
+ var offset = this.$container.offset();
+
+ offset.bottom = offset.top + this.$container.outerHeight(false);
+
+ var container = {
+ height: this.$container.outerHeight(false)
+ };
+
+ container.top = offset.top;
+ container.bottom = offset.top + container.height;
+
+ var dropdown = {
+ height: this.$dropdown.outerHeight(false)
+ };
+
+ var viewport = {
+ top: $window.scrollTop(),
+ bottom: $window.scrollTop() + $window.height()
+ };
+
+ var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
+ var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
+
+ var css = {
+ left: offset.left,
+ top: container.bottom
+ };
+
+ // Determine what the parent element is to use for calciulating the offset
+ var $offsetParent = this.$dropdownParent;
+
+ // For statically positoned elements, we need to get the element
+ // that is determining the offset
+ if ($offsetParent.css('position') === 'static') {
+ $offsetParent = $offsetParent.offsetParent();
+ }
+
+ var parentOffset = $offsetParent.offset();
+
+ css.top -= parentOffset.top;
+ css.left -= parentOffset.left;
+
+ if (!isCurrentlyAbove && !isCurrentlyBelow) {
+ newDirection = 'below';
+ }
+
+ if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
+ newDirection = 'above';
+ } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
+ newDirection = 'below';
+ }
+
+ if (newDirection == 'above' ||
+ (isCurrentlyAbove && newDirection !== 'below')) {
+ css.top = container.top - parentOffset.top - dropdown.height;
+ }
+
+ if (newDirection != null) {
+ this.$dropdown
+ .removeClass('select2-dropdown--below select2-dropdown--above')
+ .addClass('select2-dropdown--' + newDirection);
+ this.$container
+ .removeClass('select2-container--below select2-container--above')
+ .addClass('select2-container--' + newDirection);
+ }
+
+ this.$dropdownContainer.css(css);
+ };
+
+ AttachBody.prototype._resizeDropdown = function () {
+ var css = {
+ width: this.$container.outerWidth(false) + 'px'
+ };
+
+ if (this.options.get('dropdownAutoWidth')) {
+ css.minWidth = css.width;
+ css.position = 'relative';
+ css.width = 'auto';
+ }
+
+ this.$dropdown.css(css);
+ };
+
+ AttachBody.prototype._showDropdown = function (decorated) {
+ this.$dropdownContainer.appendTo(this.$dropdownParent);
+
+ this._positionDropdown();
+ this._resizeDropdown();
+ };
+
+ return AttachBody;
+});
+
+S2.define('select2/dropdown/minimumResultsForSearch',[
+
+], function () {
+ function countResults (data) {
+ var count = 0;
+
+ for (var d = 0; d < data.length; d++) {
+ var item = data[d];
+
+ if (item.children) {
+ count += countResults(item.children);
+ } else {
+ count++;
+ }
+ }
+
+ return count;
+ }
+
+ function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
+ this.minimumResultsForSearch = options.get('minimumResultsForSearch');
+
+ if (this.minimumResultsForSearch < 0) {
+ this.minimumResultsForSearch = Infinity;
+ }
+
+ decorated.call(this, $element, options, dataAdapter);
+ }
+
+ MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
+ if (countResults(params.data.results) < this.minimumResultsForSearch) {
+ return false;
+ }
+
+ return decorated.call(this, params);
+ };
+
+ return MinimumResultsForSearch;
+});
+
+S2.define('select2/dropdown/selectOnClose',[
+
+], function () {
+ function SelectOnClose () { }
+
+ SelectOnClose.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('close', function (params) {
+ self._handleSelectOnClose(params);
+ });
+ };
+
+ SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
+ if (params && params.originalSelect2Event != null) {
+ var event = params.originalSelect2Event;
+
+ // Don't select an item if the close event was triggered from a select or
+ // unselect event
+ if (event._type === 'select' || event._type === 'unselect') {
+ return;
+ }
+ }
+
+ var $highlightedResults = this.getHighlightedResults();
+
+ // Only select highlighted results
+ if ($highlightedResults.length < 1) {
+ return;
+ }
+
+ var data = $highlightedResults.data('data');
+
+ // Don't re-select already selected resulte
+ if (
+ (data.element != null && data.element.selected) ||
+ (data.element == null && data.selected)
+ ) {
+ return;
+ }
+
+ this.trigger('select', {
+ data: data
+ });
+ };
+
+ return SelectOnClose;
+});
+
+S2.define('select2/dropdown/closeOnSelect',[
+
+], function () {
+ function CloseOnSelect () { }
+
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('select', function (evt) {
+ self._selectTriggered(evt);
+ });
+
+ container.on('unselect', function (evt) {
+ self._selectTriggered(evt);
+ });
+ };
+
+ CloseOnSelect.prototype._selectTriggered = function (_, evt) {
+ var originalEvent = evt.originalEvent;
+
+ // Don't close if the control key is being held
+ if (originalEvent && originalEvent.ctrlKey) {
+ return;
+ }
+
+ this.trigger('close', {
+ originalEvent: originalEvent,
+ originalSelect2Event: evt
+ });
+ };
+
+ return CloseOnSelect;
+});
+
+S2.define('select2/i18n/en',[],function () {
+ // English
+ return {
+ errorLoading: function () {
+ return 'The results could not be loaded.';
+ },
+ inputTooLong: function (args) {
+ var overChars = args.input.length - args.maximum;
+
+ var message = 'Please delete ' + overChars + ' character';
+
+ if (overChars != 1) {
+ message += 's';
+ }
+
+ return message;
+ },
+ inputTooShort: function (args) {
+ var remainingChars = args.minimum - args.input.length;
+
+ var message = 'Please enter ' + remainingChars + ' or more characters';
+
+ return message;
+ },
+ loadingMore: function () {
+ return 'Loading more results…';
+ },
+ maximumSelected: function (args) {
+ var message = 'You can only select ' + args.maximum + ' item';
+
+ if (args.maximum != 1) {
+ message += 's';
+ }
+
+ return message;
+ },
+ noResults: function () {
+ return 'No results found';
+ },
+ searching: function () {
+ return 'Searching…';
+ }
+ };
+});
+
+S2.define('select2/defaults',[
+ 'jquery',
+ 'require',
+
+ './results',
+
+ './selection/single',
+ './selection/multiple',
+ './selection/placeholder',
+ './selection/allowClear',
+ './selection/search',
+ './selection/eventRelay',
+
+ './utils',
+ './translation',
+ './diacritics',
+
+ './data/select',
+ './data/array',
+ './data/ajax',
+ './data/tags',
+ './data/tokenizer',
+ './data/minimumInputLength',
+ './data/maximumInputLength',
+ './data/maximumSelectionLength',
+
+ './dropdown',
+ './dropdown/search',
+ './dropdown/hidePlaceholder',
+ './dropdown/infiniteScroll',
+ './dropdown/attachBody',
+ './dropdown/minimumResultsForSearch',
+ './dropdown/selectOnClose',
+ './dropdown/closeOnSelect',
+
+ './i18n/en'
+], function ($, require,
+
+ ResultsList,
+
+ SingleSelection, MultipleSelection, Placeholder, AllowClear,
+ SelectionSearch, EventRelay,
+
+ Utils, Translation, DIACRITICS,
+
+ SelectData, ArrayData, AjaxData, Tags, Tokenizer,
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
+
+ Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
+
+ EnglishTranslation) {
+ function Defaults () {
+ this.reset();
+ }
+
+ Defaults.prototype.apply = function (options) {
+ options = $.extend(true, {}, this.defaults, options);
+
+ if (options.dataAdapter == null) {
+ if (options.ajax != null) {
+ options.dataAdapter = AjaxData;
+ } else if (options.data != null) {
+ options.dataAdapter = ArrayData;
+ } else {
+ options.dataAdapter = SelectData;
+ }
+
+ if (options.minimumInputLength > 0) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ MinimumInputLength
+ );
+ }
+
+ if (options.maximumInputLength > 0) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ MaximumInputLength
+ );
+ }
+
+ if (options.maximumSelectionLength > 0) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ MaximumSelectionLength
+ );
+ }
+
+ if (options.tags) {
+ options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
+ }
+
+ if (options.tokenSeparators != null || options.tokenizer != null) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ Tokenizer
+ );
+ }
+
+ if (options.query != null) {
+ var Query = require(options.amdBase + 'compat/query');
+
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ Query
+ );
+ }
+
+ if (options.initSelection != null) {
+ var InitSelection = require(options.amdBase + 'compat/initSelection');
+
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ InitSelection
+ );
+ }
+ }
+
+ if (options.resultsAdapter == null) {
+ options.resultsAdapter = ResultsList;
+
+ if (options.ajax != null) {
+ options.resultsAdapter = Utils.Decorate(
+ options.resultsAdapter,
+ InfiniteScroll
+ );
+ }
+
+ if (options.placeholder != null) {
+ options.resultsAdapter = Utils.Decorate(
+ options.resultsAdapter,
+ HidePlaceholder
+ );
+ }
+
+ if (options.selectOnClose) {
+ options.resultsAdapter = Utils.Decorate(
+ options.resultsAdapter,
+ SelectOnClose
+ );
+ }
+ }
+
+ if (options.dropdownAdapter == null) {
+ if (options.multiple) {
+ options.dropdownAdapter = Dropdown;
+ } else {
+ var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
+
+ options.dropdownAdapter = SearchableDropdown;
+ }
+
+ if (options.minimumResultsForSearch !== 0) {
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ MinimumResultsForSearch
+ );
+ }
+
+ if (options.closeOnSelect) {
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ CloseOnSelect
+ );
+ }
+
+ if (
+ options.dropdownCssClass != null ||
+ options.dropdownCss != null ||
+ options.adaptDropdownCssClass != null
+ ) {
+ var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
+
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ DropdownCSS
+ );
+ }
+
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ AttachBody
+ );
+ }
+
+ if (options.selectionAdapter == null) {
+ if (options.multiple) {
+ options.selectionAdapter = MultipleSelection;
+ } else {
+ options.selectionAdapter = SingleSelection;
+ }
+
+ // Add the placeholder mixin if a placeholder was specified
+ if (options.placeholder != null) {
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ Placeholder
+ );
+ }
+
+ if (options.allowClear) {
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ AllowClear
+ );
+ }
+
+ if (options.multiple) {
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ SelectionSearch
+ );
+ }
+
+ if (
+ options.containerCssClass != null ||
+ options.containerCss != null ||
+ options.adaptContainerCssClass != null
+ ) {
+ var ContainerCSS = require(options.amdBase + 'compat/containerCss');
+
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ ContainerCSS
+ );
+ }
+
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ EventRelay
+ );
+ }
+
+ if (typeof options.language === 'string') {
+ // Check if the language is specified with a region
+ if (options.language.indexOf('-') > 0) {
+ // Extract the region information if it is included
+ var languageParts = options.language.split('-');
+ var baseLanguage = languageParts[0];
+
+ options.language = [options.language, baseLanguage];
+ } else {
+ options.language = [options.language];
+ }
+ }
+
+ if ($.isArray(options.language)) {
+ var languages = new Translation();
+ options.language.push('en');
+
+ var languageNames = options.language;
+
+ for (var l = 0; l < languageNames.length; l++) {
+ var name = languageNames[l];
+ var language = {};
+
+ try {
+ // Try to load it with the original name
+ language = Translation.loadPath(name);
+ } catch (e) {
+ try {
+ // If we couldn't load it, check if it wasn't the full path
+ name = this.defaults.amdLanguageBase + name;
+ language = Translation.loadPath(name);
+ } catch (ex) {
+ // The translation could not be loaded at all. Sometimes this is
+ // because of a configuration problem, other times this can be
+ // because of how Select2 helps load all possible translation files.
+ if (options.debug && window.console && console.warn) {
+ console.warn(
+ 'Select2: The language file for "' + name + '" could not be ' +
+ 'automatically loaded. A fallback will be used instead.'
+ );
+ }
+
+ continue;
+ }
+ }
+
+ languages.extend(language);
+ }
+
+ options.translations = languages;
+ } else {
+ var baseTranslation = Translation.loadPath(
+ this.defaults.amdLanguageBase + 'en'
+ );
+ var customTranslation = new Translation(options.language);
+
+ customTranslation.extend(baseTranslation);
+
+ options.translations = customTranslation;
+ }
+
+ return options;
+ };
+
+ Defaults.prototype.reset = function () {
+ function stripDiacritics (text) {
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
+ function match(a) {
+ return DIACRITICS[a] || a;
+ }
+
+ return text.replace(/[^\u0000-\u007E]/g, match);
+ }
+
+ function matcher (params, data) {
+ // Always return the object if there is nothing to compare
+ if ($.trim(params.term) === '') {
+ return data;
+ }
+
+ // Do a recursive check for options with children
+ if (data.children && data.children.length > 0) {
+ // Clone the data object if there are children
+ // This is required as we modify the object to remove any non-matches
+ var match = $.extend(true, {}, data);
+
+ // Check each child of the option
+ for (var c = data.children.length - 1; c >= 0; c--) {
+ var child = data.children[c];
+
+ var matches = matcher(params, child);
+
+ // If there wasn't a match, remove the object in the array
+ if (matches == null) {
+ match.children.splice(c, 1);
+ }
+ }
+
+ // If any children matched, return the new object
+ if (match.children.length > 0) {
+ return match;
+ }
+
+ // If there were no matching children, check just the plain object
+ return matcher(params, match);
+ }
+
+ var original = stripDiacritics(data.text).toUpperCase();
+ var term = stripDiacritics(params.term).toUpperCase();
+
+ // Check if the text contains the term
+ if (original.indexOf(term) > -1) {
+ return data;
+ }
+
+ // If it doesn't contain the term, don't return anything
+ return null;
+ }
+
+ this.defaults = {
+ amdBase: './',
+ amdLanguageBase: './i18n/',
+ closeOnSelect: true,
+ debug: false,
+ dropdownAutoWidth: false,
+ escapeMarkup: Utils.escapeMarkup,
+ language: EnglishTranslation,
+ matcher: matcher,
+ minimumInputLength: 0,
+ maximumInputLength: 0,
+ maximumSelectionLength: 0,
+ minimumResultsForSearch: 0,
+ selectOnClose: false,
+ sorter: function (data) {
+ return data;
+ },
+ templateResult: function (result) {
+ return result.text;
+ },
+ templateSelection: function (selection) {
+ return selection.text;
+ },
+ theme: 'default',
+ width: 'resolve'
+ };
+ };
+
+ Defaults.prototype.set = function (key, value) {
+ var camelKey = $.camelCase(key);
+
+ var data = {};
+ data[camelKey] = value;
+
+ var convertedData = Utils._convertData(data);
+
+ $.extend(this.defaults, convertedData);
+ };
+
+ var defaults = new Defaults();
+
+ return defaults;
+});
+
+S2.define('select2/options',[
+ 'require',
+ 'jquery',
+ './defaults',
+ './utils'
+], function (require, $, Defaults, Utils) {
+ function Options (options, $element) {
+ this.options = options;
+
+ if ($element != null) {
+ this.fromElement($element);
+ }
+
+ this.options = Defaults.apply(this.options);
+
+ if ($element && $element.is('input')) {
+ var InputCompat = require(this.get('amdBase') + 'compat/inputData');
+
+ this.options.dataAdapter = Utils.Decorate(
+ this.options.dataAdapter,
+ InputCompat
+ );
+ }
+ }
+
+ Options.prototype.fromElement = function ($e) {
+ var excludedData = ['select2'];
+
+ if (this.options.multiple == null) {
+ this.options.multiple = $e.prop('multiple');
+ }
+
+ if (this.options.disabled == null) {
+ this.options.disabled = $e.prop('disabled');
+ }
+
+ if (this.options.language == null) {
+ if ($e.prop('lang')) {
+ this.options.language = $e.prop('lang').toLowerCase();
+ } else if ($e.closest('[lang]').prop('lang')) {
+ this.options.language = $e.closest('[lang]').prop('lang');
+ }
+ }
+
+ if (this.options.dir == null) {
+ if ($e.prop('dir')) {
+ this.options.dir = $e.prop('dir');
+ } else if ($e.closest('[dir]').prop('dir')) {
+ this.options.dir = $e.closest('[dir]').prop('dir');
+ } else {
+ this.options.dir = 'ltr';
+ }
+ }
+
+ $e.prop('disabled', this.options.disabled);
+ $e.prop('multiple', this.options.multiple);
+
+ if ($e.data('select2Tags')) {
+ if (this.options.debug && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `data-select2-tags` attribute has been changed to ' +
+ 'use the `data-data` and `data-tags="true"` attributes and will be ' +
+ 'removed in future versions of Select2.'
+ );
+ }
+
+ $e.data('data', $e.data('select2Tags'));
+ $e.data('tags', true);
+ }
+
+ if ($e.data('ajaxUrl')) {
+ if (this.options.debug && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `data-ajax-url` attribute has been changed to ' +
+ '`data-ajax--url` and support for the old attribute will be removed' +
+ ' in future versions of Select2.'
+ );
+ }
+
+ $e.attr('ajax--url', $e.data('ajaxUrl'));
+ $e.data('ajax--url', $e.data('ajaxUrl'));
+ }
+
+ var dataset = {};
+
+ // Prefer the element's `dataset` attribute if it exists
+ // jQuery 1.x does not correctly handle data attributes with multiple dashes
+ if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
+ dataset = $.extend(true, {}, $e[0].dataset, $e.data());
+ } else {
+ dataset = $e.data();
+ }
+
+ var data = $.extend(true, {}, dataset);
+
+ data = Utils._convertData(data);
+
+ for (var key in data) {
+ if ($.inArray(key, excludedData) > -1) {
+ continue;
+ }
+
+ if ($.isPlainObject(this.options[key])) {
+ $.extend(this.options[key], data[key]);
+ } else {
+ this.options[key] = data[key];
+ }
+ }
+
+ return this;
+ };
+
+ Options.prototype.get = function (key) {
+ return this.options[key];
+ };
+
+ Options.prototype.set = function (key, val) {
+ this.options[key] = val;
+ };
+
+ return Options;
+});
+
+S2.define('select2/core',[
+ 'jquery',
+ './options',
+ './utils',
+ './keys'
+], function ($, Options, Utils, KEYS) {
+ var Select2 = function ($element, options) {
+ if ($element.data('select2') != null) {
+ $element.data('select2').destroy();
+ }
+
+ this.$element = $element;
+
+ this.id = this._generateId($element);
+
+ options = options || {};
+
+ this.options = new Options(options, $element);
+
+ Select2.__super__.constructor.call(this);
+
+ // Set up the tabindex
+
+ var tabindex = $element.attr('tabindex') || 0;
+ $element.data('old-tabindex', tabindex);
+ $element.attr('tabindex', '-1');
+
+ // Set up containers and adapters
+
+ var DataAdapter = this.options.get('dataAdapter');
+ this.dataAdapter = new DataAdapter($element, this.options);
+
+ var $container = this.render();
+
+ this._placeContainer($container);
+
+ var SelectionAdapter = this.options.get('selectionAdapter');
+ this.selection = new SelectionAdapter($element, this.options);
+ this.$selection = this.selection.render();
+
+ this.selection.position(this.$selection, $container);
+
+ var DropdownAdapter = this.options.get('dropdownAdapter');
+ this.dropdown = new DropdownAdapter($element, this.options);
+ this.$dropdown = this.dropdown.render();
+
+ this.dropdown.position(this.$dropdown, $container);
+
+ var ResultsAdapter = this.options.get('resultsAdapter');
+ this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
+ this.$results = this.results.render();
+
+ this.results.position(this.$results, this.$dropdown);
+
+ // Bind events
+
+ var self = this;
+
+ // Bind the container to all of the adapters
+ this._bindAdapters();
+
+ // Register any DOM event handlers
+ this._registerDomEvents();
+
+ // Register any internal event handlers
+ this._registerDataEvents();
+ this._registerSelectionEvents();
+ this._registerDropdownEvents();
+ this._registerResultsEvents();
+ this._registerEvents();
+
+ // Set the initial state
+ this.dataAdapter.current(function (initialData) {
+ self.trigger('selection:update', {
+ data: initialData
+ });
+ });
+
+ // Hide the original select
+ $element.addClass('select2-hidden-accessible');
+ $element.attr('aria-hidden', 'true');
+
+ // Synchronize any monitored attributes
+ this._syncAttributes();
+
+ $element.data('select2', this);
+ };
+
+ Utils.Extend(Select2, Utils.Observable);
+
+ Select2.prototype._generateId = function ($element) {
+ var id = '';
+
+ if ($element.attr('id') != null) {
+ id = $element.attr('id');
+ } else if ($element.attr('name') != null) {
+ id = $element.attr('name') + '-' + Utils.generateChars(2);
+ } else {
+ id = Utils.generateChars(4);
+ }
+
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
+ id = 'select2-' + id;
+
+ return id;
+ };
+
+ Select2.prototype._placeContainer = function ($container) {
+ $container.insertAfter(this.$element);
+
+ var width = this._resolveWidth(this.$element, this.options.get('width'));
+
+ if (width != null) {
+ $container.css('width', width);
+ }
+ };
+
+ Select2.prototype._resolveWidth = function ($element, method) {
+ var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
+
+ if (method == 'resolve') {
+ var styleWidth = this._resolveWidth($element, 'style');
+
+ if (styleWidth != null) {
+ return styleWidth;
+ }
+
+ return this._resolveWidth($element, 'element');
+ }
+
+ if (method == 'element') {
+ var elementWidth = $element.outerWidth(false);
+
+ if (elementWidth <= 0) {
+ return 'auto';
+ }
+
+ return elementWidth + 'px';
+ }
+
+ if (method == 'style') {
+ var style = $element.attr('style');
+
+ if (typeof(style) !== 'string') {
+ return null;
+ }
+
+ var attrs = style.split(';');
+
+ for (var i = 0, l = attrs.length; i < l; i = i + 1) {
+ var attr = attrs[i].replace(/\s/g, '');
+ var matches = attr.match(WIDTH);
+
+ if (matches !== null && matches.length >= 1) {
+ return matches[1];
+ }
+ }
+
+ return null;
+ }
+
+ return method;
+ };
+
+ Select2.prototype._bindAdapters = function () {
+ this.dataAdapter.bind(this, this.$container);
+ this.selection.bind(this, this.$container);
+
+ this.dropdown.bind(this, this.$container);
+ this.results.bind(this, this.$container);
+ };
+
+ Select2.prototype._registerDomEvents = function () {
+ var self = this;
+
+ this.$element.on('change.select2', function () {
+ self.dataAdapter.current(function (data) {
+ self.trigger('selection:update', {
+ data: data
+ });
+ });
+ });
+
+ this.$element.on('focus.select2', function (evt) {
+ self.trigger('focus', evt);
+ });
+
+ this._syncA = Utils.bind(this._syncAttributes, this);
+ this._syncS = Utils.bind(this._syncSubtree, this);
+
+ if (this.$element[0].attachEvent) {
+ this.$element[0].attachEvent('onpropertychange', this._syncA);
+ }
+
+ var observer = window.MutationObserver ||
+ window.WebKitMutationObserver ||
+ window.MozMutationObserver
+ ;
+
+ if (observer != null) {
+ this._observer = new observer(function (mutations) {
+ $.each(mutations, self._syncA);
+ $.each(mutations, self._syncS);
+ });
+ this._observer.observe(this.$element[0], {
+ attributes: true,
+ childList: true,
+ subtree: false
+ });
+ } else if (this.$element[0].addEventListener) {
+ this.$element[0].addEventListener(
+ 'DOMAttrModified',
+ self._syncA,
+ false
+ );
+ this.$element[0].addEventListener(
+ 'DOMNodeInserted',
+ self._syncS,
+ false
+ );
+ this.$element[0].addEventListener(
+ 'DOMNodeRemoved',
+ self._syncS,
+ false
+ );
+ }
+ };
+
+ Select2.prototype._registerDataEvents = function () {
+ var self = this;
+
+ this.dataAdapter.on('*', function (name, params) {
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerSelectionEvents = function () {
+ var self = this;
+ var nonRelayEvents = ['toggle', 'focus'];
+
+ this.selection.on('toggle', function () {
+ self.toggleDropdown();
+ });
+
+ this.selection.on('focus', function (params) {
+ self.focus(params);
+ });
+
+ this.selection.on('*', function (name, params) {
+ if ($.inArray(name, nonRelayEvents) !== -1) {
+ return;
+ }
+
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerDropdownEvents = function () {
+ var self = this;
+
+ this.dropdown.on('*', function (name, params) {
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerResultsEvents = function () {
+ var self = this;
+
+ this.results.on('*', function (name, params) {
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerEvents = function () {
+ var self = this;
+
+ this.on('open', function () {
+ self.$container.addClass('select2-container--open');
+ });
+
+ this.on('close', function () {
+ self.$container.removeClass('select2-container--open');
+ });
+
+ this.on('enable', function () {
+ self.$container.removeClass('select2-container--disabled');
+ });
+
+ this.on('disable', function () {
+ self.$container.addClass('select2-container--disabled');
+ });
+
+ this.on('blur', function () {
+ self.$container.removeClass('select2-container--focus');
+ });
+
+ this.on('query', function (params) {
+ if (!self.isOpen()) {
+ self.trigger('open', {});
+ }
+
+ this.dataAdapter.query(params, function (data) {
+ self.trigger('results:all', {
+ data: data,
+ query: params
+ });
+ });
+ });
+
+ this.on('query:append', function (params) {
+ this.dataAdapter.query(params, function (data) {
+ self.trigger('results:append', {
+ data: data,
+ query: params
+ });
+ });
+ });
+
+ this.on('keypress', function (evt) {
+ var key = evt.which;
+
+ if (self.isOpen()) {
+ if (key === KEYS.ESC || key === KEYS.TAB ||
+ (key === KEYS.UP && evt.altKey)) {
+ self.close();
+
+ evt.preventDefault();
+ } else if (key === KEYS.ENTER) {
+ self.trigger('results:select', {});
+
+ evt.preventDefault();
+ } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
+ self.trigger('results:toggle', {});
+
+ evt.preventDefault();
+ } else if (key === KEYS.UP) {
+ self.trigger('results:previous', {});
+
+ evt.preventDefault();
+ } else if (key === KEYS.DOWN) {
+ self.trigger('results:next', {});
+
+ evt.preventDefault();
+ }
+ } else {
+ if (key === KEYS.ENTER || key === KEYS.SPACE ||
+ (key === KEYS.DOWN && evt.altKey)) {
+ self.open();
+
+ evt.preventDefault();
+ }
+ }
+ });
+ };
+
+ Select2.prototype._syncAttributes = function () {
+ this.options.set('disabled', this.$element.prop('disabled'));
+
+ if (this.options.get('disabled')) {
+ if (this.isOpen()) {
+ this.close();
+ }
+
+ this.trigger('disable', {});
+ } else {
+ this.trigger('enable', {});
+ }
+ };
+
+ Select2.prototype._syncSubtree = function (evt, mutations) {
+ var changed = false;
+ var self = this;
+
+ // Ignore any mutation events raised for elements that aren't options or
+ // optgroups. This handles the case when the select element is destroyed
+ if (
+ evt && evt.target && (
+ evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
+ )
+ ) {
+ return;
+ }
+
+ if (!mutations) {
+ // If mutation events aren't supported, then we can only assume that the
+ // change affected the selections
+ changed = true;
+ } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
+ for (var n = 0; n < mutations.addedNodes.length; n++) {
+ var node = mutations.addedNodes[n];
+
+ if (node.selected) {
+ changed = true;
+ }
+ }
+ } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
+ changed = true;
+ }
+
+ // Only re-pull the data if we think there is a change
+ if (changed) {
+ this.dataAdapter.current(function (currentData) {
+ self.trigger('selection:update', {
+ data: currentData
+ });
+ });
+ }
+ };
+
+ /**
+ * Override the trigger method to automatically trigger pre-events when
+ * there are events that can be prevented.
+ */
+ Select2.prototype.trigger = function (name, args) {
+ var actualTrigger = Select2.__super__.trigger;
+ var preTriggerMap = {
+ 'open': 'opening',
+ 'close': 'closing',
+ 'select': 'selecting',
+ 'unselect': 'unselecting'
+ };
+
+ if (args === undefined) {
+ args = {};
+ }
+
+ if (name in preTriggerMap) {
+ var preTriggerName = preTriggerMap[name];
+ var preTriggerArgs = {
+ prevented: false,
+ name: name,
+ args: args
+ };
+
+ actualTrigger.call(this, preTriggerName, preTriggerArgs);
+
+ if (preTriggerArgs.prevented) {
+ args.prevented = true;
+
+ return;
+ }
+ }
+
+ actualTrigger.call(this, name, args);
+ };
+
+ Select2.prototype.toggleDropdown = function () {
+ if (this.options.get('disabled')) {
+ return;
+ }
+
+ if (this.isOpen()) {
+ this.close();
+ } else {
+ this.open();
+ }
+ };
+
+ Select2.prototype.open = function () {
+ if (this.isOpen()) {
+ return;
+ }
+
+ this.trigger('query', {});
+ };
+
+ Select2.prototype.close = function () {
+ if (!this.isOpen()) {
+ return;
+ }
+
+ this.trigger('close', {});
+ };
+
+ Select2.prototype.isOpen = function () {
+ return this.$container.hasClass('select2-container--open');
+ };
+
+ Select2.prototype.hasFocus = function () {
+ return this.$container.hasClass('select2-container--focus');
+ };
+
+ Select2.prototype.focus = function (data) {
+ // No need to re-trigger focus events if we are already focused
+ if (this.hasFocus()) {
+ return;
+ }
+
+ this.$container.addClass('select2-container--focus');
+ this.trigger('focus', {});
+ };
+
+ Select2.prototype.enable = function (args) {
+ if (this.options.get('debug') && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `select2("enable")` method has been deprecated and will' +
+ ' be removed in later Select2 versions. Use $element.prop("disabled")' +
+ ' instead.'
+ );
+ }
+
+ if (args == null || args.length === 0) {
+ args = [true];
+ }
+
+ var disabled = !args[0];
+
+ this.$element.prop('disabled', disabled);
+ };
+
+ Select2.prototype.data = function () {
+ if (this.options.get('debug') &&
+ arguments.length > 0 && window.console && console.warn) {
+ console.warn(
+ 'Select2: Data can no longer be set using `select2("data")`. You ' +
+ 'should consider setting the value instead using `$element.val()`.'
+ );
+ }
+
+ var data = [];
+
+ this.dataAdapter.current(function (currentData) {
+ data = currentData;
+ });
+
+ return data;
+ };
+
+ Select2.prototype.val = function (args) {
+ if (this.options.get('debug') && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `select2("val")` method has been deprecated and will be' +
+ ' removed in later Select2 versions. Use $element.val() instead.'
+ );
+ }
+
+ if (args == null || args.length === 0) {
+ return this.$element.val();
+ }
+
+ var newVal = args[0];
+
+ if ($.isArray(newVal)) {
+ newVal = $.map(newVal, function (obj) {
+ return obj.toString();
+ });
+ }
+
+ this.$element.val(newVal).trigger('change');
+ };
+
+ Select2.prototype.destroy = function () {
+ this.$container.remove();
+
+ if (this.$element[0].detachEvent) {
+ this.$element[0].detachEvent('onpropertychange', this._syncA);
+ }
+
+ if (this._observer != null) {
+ this._observer.disconnect();
+ this._observer = null;
+ } else if (this.$element[0].removeEventListener) {
+ this.$element[0]
+ .removeEventListener('DOMAttrModified', this._syncA, false);
+ this.$element[0]
+ .removeEventListener('DOMNodeInserted', this._syncS, false);
+ this.$element[0]
+ .removeEventListener('DOMNodeRemoved', this._syncS, false);
+ }
+
+ this._syncA = null;
+ this._syncS = null;
+
+ this.$element.off('.select2');
+ this.$element.attr('tabindex', this.$element.data('old-tabindex'));
+
+ this.$element.removeClass('select2-hidden-accessible');
+ this.$element.attr('aria-hidden', 'false');
+ this.$element.removeData('select2');
+
+ this.dataAdapter.destroy();
+ this.selection.destroy();
+ this.dropdown.destroy();
+ this.results.destroy();
+
+ this.dataAdapter = null;
+ this.selection = null;
+ this.dropdown = null;
+ this.results = null;
+ };
+
+ Select2.prototype.render = function () {
+ var $container = $(
+ '' +
+ ' ' +
+ ' ' +
+ ' '
+ );
+
+ $container.attr('dir', this.options.get('dir'));
+
+ this.$container = $container;
+
+ this.$container.addClass('select2-container--' + this.options.get('theme'));
+
+ $container.data('element', this.$element);
+
+ return $container;
+ };
+
+ return Select2;
+});
+
+S2.define('select2/compat/utils',[
+ 'jquery'
+], function ($) {
+ function syncCssClasses ($dest, $src, adapter) {
+ var classes, replacements = [], adapted;
+
+ classes = $.trim($dest.attr('class'));
+
+ if (classes) {
+ classes = '' + classes; // for IE which returns object
+
+ $(classes.split(/\s+/)).each(function () {
+ // Save all Select2 classes
+ if (this.indexOf('select2-') === 0) {
+ replacements.push(this);
+ }
+ });
+ }
+
+ classes = $.trim($src.attr('class'));
+
+ if (classes) {
+ classes = '' + classes; // for IE which returns object
+
+ $(classes.split(/\s+/)).each(function () {
+ // Only adapt non-Select2 classes
+ if (this.indexOf('select2-') !== 0) {
+ adapted = adapter(this);
+
+ if (adapted != null) {
+ replacements.push(adapted);
+ }
+ }
+ });
+ }
+
+ $dest.attr('class', replacements.join(' '));
+ }
+
+ return {
+ syncCssClasses: syncCssClasses
+ };
+});
+
+S2.define('select2/compat/containerCss',[
+ 'jquery',
+ './utils'
+], function ($, CompatUtils) {
+ // No-op CSS adapter that discards all classes by default
+ function _containerAdapter (clazz) {
+ return null;
+ }
+
+ function ContainerCSS () { }
+
+ ContainerCSS.prototype.render = function (decorated) {
+ var $container = decorated.call(this);
+
+ var containerCssClass = this.options.get('containerCssClass') || '';
+
+ if ($.isFunction(containerCssClass)) {
+ containerCssClass = containerCssClass(this.$element);
+ }
+
+ var containerCssAdapter = this.options.get('adaptContainerCssClass');
+ containerCssAdapter = containerCssAdapter || _containerAdapter;
+
+ if (containerCssClass.indexOf(':all:') !== -1) {
+ containerCssClass = containerCssClass.replace(':all:', '');
+
+ var _cssAdapter = containerCssAdapter;
+
+ containerCssAdapter = function (clazz) {
+ var adapted = _cssAdapter(clazz);
+
+ if (adapted != null) {
+ // Append the old one along with the adapted one
+ return adapted + ' ' + clazz;
+ }
+
+ return clazz;
+ };
+ }
+
+ var containerCss = this.options.get('containerCss') || {};
+
+ if ($.isFunction(containerCss)) {
+ containerCss = containerCss(this.$element);
+ }
+
+ CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter);
+
+ $container.css(containerCss);
+ $container.addClass(containerCssClass);
+
+ return $container;
+ };
+
+ return ContainerCSS;
+});
+
+S2.define('select2/compat/dropdownCss',[
+ 'jquery',
+ './utils'
+], function ($, CompatUtils) {
+ // No-op CSS adapter that discards all classes by default
+ function _dropdownAdapter (clazz) {
+ return null;
+ }
+
+ function DropdownCSS () { }
+
+ DropdownCSS.prototype.render = function (decorated) {
+ var $dropdown = decorated.call(this);
+
+ var dropdownCssClass = this.options.get('dropdownCssClass') || '';
+
+ if ($.isFunction(dropdownCssClass)) {
+ dropdownCssClass = dropdownCssClass(this.$element);
+ }
+
+ var dropdownCssAdapter = this.options.get('adaptDropdownCssClass');
+ dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter;
+
+ if (dropdownCssClass.indexOf(':all:') !== -1) {
+ dropdownCssClass = dropdownCssClass.replace(':all:', '');
+
+ var _cssAdapter = dropdownCssAdapter;
+
+ dropdownCssAdapter = function (clazz) {
+ var adapted = _cssAdapter(clazz);
+
+ if (adapted != null) {
+ // Append the old one along with the adapted one
+ return adapted + ' ' + clazz;
+ }
+
+ return clazz;
+ };
+ }
+
+ var dropdownCss = this.options.get('dropdownCss') || {};
+
+ if ($.isFunction(dropdownCss)) {
+ dropdownCss = dropdownCss(this.$element);
+ }
+
+ CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter);
+
+ $dropdown.css(dropdownCss);
+ $dropdown.addClass(dropdownCssClass);
+
+ return $dropdown;
+ };
+
+ return DropdownCSS;
+});
+
+S2.define('select2/compat/initSelection',[
+ 'jquery'
+], function ($) {
+ function InitSelection (decorated, $element, options) {
+ if (options.get('debug') && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `initSelection` option has been deprecated in favor' +
+ ' of a custom data adapter that overrides the `current` method. ' +
+ 'This method is now called multiple times instead of a single ' +
+ 'time when the instance is initialized. Support will be removed ' +
+ 'for the `initSelection` option in future versions of Select2'
+ );
+ }
+
+ this.initSelection = options.get('initSelection');
+ this._isInitialized = false;
+
+ decorated.call(this, $element, options);
+ }
+
+ InitSelection.prototype.current = function (decorated, callback) {
+ var self = this;
+
+ if (this._isInitialized) {
+ decorated.call(this, callback);
+
+ return;
+ }
+
+ this.initSelection.call(null, this.$element, function (data) {
+ self._isInitialized = true;
+
+ if (!$.isArray(data)) {
+ data = [data];
+ }
+
+ callback(data);
+ });
+ };
+
+ return InitSelection;
+});
+
+S2.define('select2/compat/inputData',[
+ 'jquery'
+], function ($) {
+ function InputData (decorated, $element, options) {
+ this._currentData = [];
+ this._valueSeparator = options.get('valueSeparator') || ',';
+
+ if ($element.prop('type') === 'hidden') {
+ if (options.get('debug') && console && console.warn) {
+ console.warn(
+ 'Select2: Using a hidden input with Select2 is no longer ' +
+ 'supported and may stop working in the future. It is recommended ' +
+ 'to use a `` element instead.'
+ );
+ }
+ }
+
+ decorated.call(this, $element, options);
+ }
+
+ InputData.prototype.current = function (_, callback) {
+ function getSelected (data, selectedIds) {
+ var selected = [];
+
+ if (data.selected || $.inArray(data.id, selectedIds) !== -1) {
+ data.selected = true;
+ selected.push(data);
+ } else {
+ data.selected = false;
+ }
+
+ if (data.children) {
+ selected.push.apply(selected, getSelected(data.children, selectedIds));
+ }
+
+ return selected;
+ }
+
+ var selected = [];
+
+ for (var d = 0; d < this._currentData.length; d++) {
+ var data = this._currentData[d];
+
+ selected.push.apply(
+ selected,
+ getSelected(
+ data,
+ this.$element.val().split(
+ this._valueSeparator
+ )
+ )
+ );
+ }
+
+ callback(selected);
+ };
+
+ InputData.prototype.select = function (_, data) {
+ if (!this.options.get('multiple')) {
+ this.current(function (allData) {
+ $.map(allData, function (data) {
+ data.selected = false;
+ });
+ });
+
+ this.$element.val(data.id);
+ this.$element.trigger('change');
+ } else {
+ var value = this.$element.val();
+ value += this._valueSeparator + data.id;
+
+ this.$element.val(value);
+ this.$element.trigger('change');
+ }
+ };
+
+ InputData.prototype.unselect = function (_, data) {
+ var self = this;
+
+ data.selected = false;
+
+ this.current(function (allData) {
+ var values = [];
+
+ for (var d = 0; d < allData.length; d++) {
+ var item = allData[d];
+
+ if (data.id == item.id) {
+ continue;
+ }
+
+ values.push(item.id);
+ }
+
+ self.$element.val(values.join(self._valueSeparator));
+ self.$element.trigger('change');
+ });
+ };
+
+ InputData.prototype.query = function (_, params, callback) {
+ var results = [];
+
+ for (var d = 0; d < this._currentData.length; d++) {
+ var data = this._currentData[d];
+
+ var matches = this.matches(params, data);
+
+ if (matches !== null) {
+ results.push(matches);
+ }
+ }
+
+ callback({
+ results: results
+ });
+ };
+
+ InputData.prototype.addOptions = function (_, $options) {
+ var options = $.map($options, function ($option) {
+ return $.data($option[0], 'data');
+ });
+
+ this._currentData.push.apply(this._currentData, options);
+ };
+
+ return InputData;
+});
+
+S2.define('select2/compat/matcher',[
+ 'jquery'
+], function ($) {
+ function oldMatcher (matcher) {
+ function wrappedMatcher (params, data) {
+ var match = $.extend(true, {}, data);
+
+ if (params.term == null || $.trim(params.term) === '') {
+ return match;
+ }
+
+ if (data.children) {
+ for (var c = data.children.length - 1; c >= 0; c--) {
+ var child = data.children[c];
+
+ // Check if the child object matches
+ // The old matcher returned a boolean true or false
+ var doesMatch = matcher(params.term, child.text, child);
+
+ // If the child didn't match, pop it off
+ if (!doesMatch) {
+ match.children.splice(c, 1);
+ }
+ }
+
+ if (match.children.length > 0) {
+ return match;
+ }
+ }
+
+ if (matcher(params.term, data.text, data)) {
+ return match;
+ }
+
+ return null;
+ }
+
+ return wrappedMatcher;
+ }
+
+ return oldMatcher;
+});
+
+S2.define('select2/compat/query',[
+
+], function () {
+ function Query (decorated, $element, options) {
+ if (options.get('debug') && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `query` option has been deprecated in favor of a ' +
+ 'custom data adapter that overrides the `query` method. Support ' +
+ 'will be removed for the `query` option in future versions of ' +
+ 'Select2.'
+ );
+ }
+
+ decorated.call(this, $element, options);
+ }
+
+ Query.prototype.query = function (_, params, callback) {
+ params.callback = callback;
+
+ var query = this.options.get('query');
+
+ query.call(null, params);
+ };
+
+ return Query;
+});
+
+S2.define('select2/dropdown/attachContainer',[
+
+], function () {
+ function AttachContainer (decorated, $element, options) {
+ decorated.call(this, $element, options);
+ }
+
+ AttachContainer.prototype.position =
+ function (decorated, $dropdown, $container) {
+ var $dropdownContainer = $container.find('.dropdown-wrapper');
+ $dropdownContainer.append($dropdown);
+
+ $dropdown.addClass('select2-dropdown--below');
+ $container.addClass('select2-container--below');
+ };
+
+ return AttachContainer;
+});
+
+S2.define('select2/dropdown/stopPropagation',[
+
+], function () {
+ function StopPropagation () { }
+
+ StopPropagation.prototype.bind = function (decorated, container, $container) {
+ decorated.call(this, container, $container);
+
+ var stoppedEvents = [
+ 'blur',
+ 'change',
+ 'click',
+ 'dblclick',
+ 'focus',
+ 'focusin',
+ 'focusout',
+ 'input',
+ 'keydown',
+ 'keyup',
+ 'keypress',
+ 'mousedown',
+ 'mouseenter',
+ 'mouseleave',
+ 'mousemove',
+ 'mouseover',
+ 'mouseup',
+ 'search',
+ 'touchend',
+ 'touchstart'
+ ];
+
+ this.$dropdown.on(stoppedEvents.join(' '), function (evt) {
+ evt.stopPropagation();
+ });
+ };
+
+ return StopPropagation;
+});
+
+S2.define('select2/selection/stopPropagation',[
+
+], function () {
+ function StopPropagation () { }
+
+ StopPropagation.prototype.bind = function (decorated, container, $container) {
+ decorated.call(this, container, $container);
+
+ var stoppedEvents = [
+ 'blur',
+ 'change',
+ 'click',
+ 'dblclick',
+ 'focus',
+ 'focusin',
+ 'focusout',
+ 'input',
+ 'keydown',
+ 'keyup',
+ 'keypress',
+ 'mousedown',
+ 'mouseenter',
+ 'mouseleave',
+ 'mousemove',
+ 'mouseover',
+ 'mouseup',
+ 'search',
+ 'touchend',
+ 'touchstart'
+ ];
+
+ this.$selection.on(stoppedEvents.join(' '), function (evt) {
+ evt.stopPropagation();
+ });
+ };
+
+ return StopPropagation;
+});
+
+/*!
+ * jQuery Mousewheel 3.1.13
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ */
+
+(function (factory) {
+ if ( typeof S2.define === 'function' && S2.define.amd ) {
+ // AMD. Register as an anonymous module.
+ S2.define('jquery-mousewheel',['jquery'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS style for Browserify
+ module.exports = factory;
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function ($) {
+
+ var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
+ toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
+ ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
+ slice = Array.prototype.slice,
+ nullLowestDeltaTimeout, lowestDelta;
+
+ if ( $.event.fixHooks ) {
+ for ( var i = toFix.length; i; ) {
+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
+ }
+ }
+
+ var special = $.event.special.mousewheel = {
+ version: '3.1.12',
+
+ setup: function() {
+ if ( this.addEventListener ) {
+ for ( var i = toBind.length; i; ) {
+ this.addEventListener( toBind[--i], handler, false );
+ }
+ } else {
+ this.onmousewheel = handler;
+ }
+ // Store the line height and page height for this particular element
+ $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
+ $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
+ },
+
+ teardown: function() {
+ if ( this.removeEventListener ) {
+ for ( var i = toBind.length; i; ) {
+ this.removeEventListener( toBind[--i], handler, false );
+ }
+ } else {
+ this.onmousewheel = null;
+ }
+ // Clean up the data we added to the element
+ $.removeData(this, 'mousewheel-line-height');
+ $.removeData(this, 'mousewheel-page-height');
+ },
+
+ getLineHeight: function(elem) {
+ var $elem = $(elem),
+ $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
+ if (!$parent.length) {
+ $parent = $('body');
+ }
+ return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
+ },
+
+ getPageHeight: function(elem) {
+ return $(elem).height();
+ },
+
+ settings: {
+ adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
+ normalizeOffset: true // calls getBoundingClientRect for each event
+ }
+ };
+
+ $.fn.extend({
+ mousewheel: function(fn) {
+ return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
+ },
+
+ unmousewheel: function(fn) {
+ return this.unbind('mousewheel', fn);
+ }
+ });
+
+
+ function handler(event) {
+ var orgEvent = event || window.event,
+ args = slice.call(arguments, 1),
+ delta = 0,
+ deltaX = 0,
+ deltaY = 0,
+ absDelta = 0,
+ offsetX = 0,
+ offsetY = 0;
+ event = $.event.fix(orgEvent);
+ event.type = 'mousewheel';
+
+ // Old school scrollwheel delta
+ if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
+ if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
+ if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
+ if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
+
+ // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
+ if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
+ deltaX = deltaY * -1;
+ deltaY = 0;
+ }
+
+ // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
+ delta = deltaY === 0 ? deltaX : deltaY;
+
+ // New school wheel delta (wheel event)
+ if ( 'deltaY' in orgEvent ) {
+ deltaY = orgEvent.deltaY * -1;
+ delta = deltaY;
+ }
+ if ( 'deltaX' in orgEvent ) {
+ deltaX = orgEvent.deltaX;
+ if ( deltaY === 0 ) { delta = deltaX * -1; }
+ }
+
+ // No change actually happened, no reason to go any further
+ if ( deltaY === 0 && deltaX === 0 ) { return; }
+
+ // Need to convert lines and pages to pixels if we aren't already in pixels
+ // There are three delta modes:
+ // * deltaMode 0 is by pixels, nothing to do
+ // * deltaMode 1 is by lines
+ // * deltaMode 2 is by pages
+ if ( orgEvent.deltaMode === 1 ) {
+ var lineHeight = $.data(this, 'mousewheel-line-height');
+ delta *= lineHeight;
+ deltaY *= lineHeight;
+ deltaX *= lineHeight;
+ } else if ( orgEvent.deltaMode === 2 ) {
+ var pageHeight = $.data(this, 'mousewheel-page-height');
+ delta *= pageHeight;
+ deltaY *= pageHeight;
+ deltaX *= pageHeight;
+ }
+
+ // Store lowest absolute delta to normalize the delta values
+ absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
+
+ if ( !lowestDelta || absDelta < lowestDelta ) {
+ lowestDelta = absDelta;
+
+ // Adjust older deltas if necessary
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
+ lowestDelta /= 40;
+ }
+ }
+
+ // Adjust older deltas if necessary
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
+ // Divide all the things by 40!
+ delta /= 40;
+ deltaX /= 40;
+ deltaY /= 40;
+ }
+
+ // Get a whole, normalized value for the deltas
+ delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
+ deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
+ deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
+
+ // Normalise offsetX and offsetY properties
+ if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
+ var boundingRect = this.getBoundingClientRect();
+ offsetX = event.clientX - boundingRect.left;
+ offsetY = event.clientY - boundingRect.top;
+ }
+
+ // Add information to the event object
+ event.deltaX = deltaX;
+ event.deltaY = deltaY;
+ event.deltaFactor = lowestDelta;
+ event.offsetX = offsetX;
+ event.offsetY = offsetY;
+ // Go ahead and set deltaMode to 0 since we converted to pixels
+ // Although this is a little odd since we overwrite the deltaX/Y
+ // properties with normalized deltas.
+ event.deltaMode = 0;
+
+ // Add event and delta to the front of the arguments
+ args.unshift(event, delta, deltaX, deltaY);
+
+ // Clearout lowestDelta after sometime to better
+ // handle multiple device types that give different
+ // a different lowestDelta
+ // Ex: trackpad = 3 and mouse wheel = 120
+ if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
+ nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
+
+ return ($.event.dispatch || $.event.handle).apply(this, args);
+ }
+
+ function nullLowestDelta() {
+ lowestDelta = null;
+ }
+
+ function shouldAdjustOldDeltas(orgEvent, absDelta) {
+ // If this is an older event and the delta is divisable by 120,
+ // then we are assuming that the browser is treating this as an
+ // older mouse wheel event and that we should divide the deltas
+ // by 40 to try and get a more usable deltaFactor.
+ // Side note, this actually impacts the reported scroll distance
+ // in older browsers and can cause scrolling to be slower than native.
+ // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
+ return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
+ }
+
+}));
+
+S2.define('jquery.select2',[
+ 'jquery',
+ 'jquery-mousewheel',
+
+ './select2/core',
+ './select2/defaults'
+], function ($, _, Select2, Defaults) {
+ if ($.fn.select2 == null) {
+ // All methods that should return the element
+ var thisMethods = ['open', 'close', 'destroy'];
+
+ $.fn.select2 = function (options) {
+ options = options || {};
+
+ if (typeof options === 'object') {
+ this.each(function () {
+ var instanceOptions = $.extend(true, {}, options);
+
+ var instance = new Select2($(this), instanceOptions);
+ });
+
+ return this;
+ } else if (typeof options === 'string') {
+ var ret;
+ var args = Array.prototype.slice.call(arguments, 1);
+
+ this.each(function () {
+ var instance = $(this).data('select2');
+
+ if (instance == null && window.console && console.error) {
+ console.error(
+ 'The select2(\'' + options + '\') method was called on an ' +
+ 'element that is not using Select2.'
+ );
+ }
+
+ ret = instance[options].apply(instance, args);
+ });
+
+ // Check if we should be returning `this`
+ if ($.inArray(options, thisMethods) > -1) {
+ return this;
+ }
+
+ return ret;
+ } else {
+ throw new Error('Invalid arguments for Select2: ' + options);
+ }
+ };
+ }
+
+ if ($.fn.select2.defaults == null) {
+ $.fn.select2.defaults = Defaults;
+ }
+
+ return Select2;
+});
+
+ // Return the AMD loader configuration so it can be used outside of this file
+ return {
+ define: S2.define,
+ require: S2.require
+ };
+}());
+
+ // Autoload the jQuery bindings
+ // We know that all of the modules exist above this, so we're safe
+ var select2 = S2.require('jquery.select2');
+
+ // Hold the AMD module references on the jQuery function that was just loaded
+ // This allows Select2 to use the internal loader outside of this file, such
+ // as in the language files.
+ jQuery.fn.select2.amd = S2;
+
+ // Return the Select2 instance for anyone who is importing it.
+ return select2;
+}));
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.min.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.min.js
new file mode 100644
index 0000000..684edf3
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.min.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;hc;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a(' '),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a(' ');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(' '),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a(" ")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html(''),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('× ');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e0||0===c.length)){var d=a('× ');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a(' ');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");
+if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a(' ');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a(' ');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a(' '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(" "),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null;
+},e.prototype.render=function(){var b=a(' ');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&(f=d(this),null!=f&&g.push(f))})),b.attr("class",g.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;return this._isInitialized?void b.call(this,c):void this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `` element instead."),a.call(this,b,c)}return b.prototype.current=function(b,c){function d(b,c){var e=[];return b.selected||-1!==a.inArray(b.id,c)?(b.selected=!0,e.push(b)):b.selected=!1,b.children&&e.push.apply(e,d(b.children,c)),e}for(var e=[],f=0;f=0;f--){var g=d.children[f],h=b(c.term,g.text,g);h||e.children.splice(f,1)}if(e.children.length>0)return e}return b(c.term,d.text,d)?e:null}return c}return b}),b.define("select2/compat/query",[],function(){function a(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `query` option has been deprecated in favor of a custom data adapter that overrides the `query` method. Support will be removed for the `query` option in future versions of Select2."),a.call(this,b,c)}return a.prototype.query=function(a,b,c){b.callback=c;var d=this.options.get("query");d.call(null,b)},a}),b.define("select2/dropdown/attachContainer",[],function(){function a(a,b,c){a.call(this,b,c)}return a.prototype.position=function(a,b,c){var d=c.find(".dropdown-wrapper");d.append(b),b.addClass("select2-dropdown--below"),c.addClass("select2-container--below")},a}),b.define("select2/dropdown/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$dropdown.on(d.join(" "),function(a){a.stopPropagation()})},a}),b.define("select2/selection/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$selection.on(d.join(" "),function(a){a.stopPropagation()})},a}),function(c){"function"==typeof b.define&&b.define.amd?b.define("jquery-mousewheel",["jquery"],c):"object"==typeof exports?module.exports=c:c(a)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js
new file mode 100644
index 0000000..13b84fa
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js
@@ -0,0 +1,5725 @@
+/*!
+ * Select2 4.0.3
+ * https://select2.github.io
+ *
+ * Released under the MIT license
+ * https://github.com/select2/select2/blob/master/LICENSE.md
+ */
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS
+ factory(require('jquery'));
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function (jQuery) {
+ // This is needed so we can catch the AMD loader configuration and use it
+ // The inner file should be wrapped (by `banner.start.js`) in a function that
+ // returns the AMD loader references.
+ var S2 =
+(function () {
+ // Restore the Select2 AMD loader so it can be used
+ // Needed mostly in the language files, where the loader is not inserted
+ if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
+ var S2 = jQuery.fn.select2.amd;
+ }
+var S2;(function () { if (!S2 || !S2.requirejs) {
+if (!S2) { S2 = {}; } else { require = S2; }
+/**
+ * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/almond for details
+ */
+//Going sloppy to avoid 'use strict' string cost, but strict practices should
+//be followed.
+/*jslint sloppy: true */
+/*global setTimeout: false */
+
+var requirejs, require, define;
+(function (undef) {
+ var main, req, makeMap, handlers,
+ defined = {},
+ waiting = {},
+ config = {},
+ defining = {},
+ hasOwn = Object.prototype.hasOwnProperty,
+ aps = [].slice,
+ jsSuffixRegExp = /\.js$/;
+
+ function hasProp(obj, prop) {
+ return hasOwn.call(obj, prop);
+ }
+
+ /**
+ * Given a relative module name, like ./something, normalize it to
+ * a real name that can be mapped to a path.
+ * @param {String} name the relative name
+ * @param {String} baseName a real name that the name arg is relative
+ * to.
+ * @returns {String} normalized name
+ */
+ function normalize(name, baseName) {
+ var nameParts, nameSegment, mapValue, foundMap, lastIndex,
+ foundI, foundStarMap, starI, i, j, part,
+ baseParts = baseName && baseName.split("/"),
+ map = config.map,
+ starMap = (map && map['*']) || {};
+
+ //Adjust any relative paths.
+ if (name && name.charAt(0) === ".") {
+ //If have a base name, try to normalize against it,
+ //otherwise, assume it is a top-level require that will
+ //be relative to baseUrl in the end.
+ if (baseName) {
+ name = name.split('/');
+ lastIndex = name.length - 1;
+
+ // Node .js allowance:
+ if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
+ name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
+ }
+
+ //Lop off the last part of baseParts, so that . matches the
+ //"directory" and not name of the baseName's module. For instance,
+ //baseName of "one/two/three", maps to "one/two/three.js", but we
+ //want the directory, "one/two" for this normalization.
+ name = baseParts.slice(0, baseParts.length - 1).concat(name);
+
+ //start trimDots
+ for (i = 0; i < name.length; i += 1) {
+ part = name[i];
+ if (part === ".") {
+ name.splice(i, 1);
+ i -= 1;
+ } else if (part === "..") {
+ if (i === 1 && (name[2] === '..' || name[0] === '..')) {
+ //End of the line. Keep at least one non-dot
+ //path segment at the front so it can be mapped
+ //correctly to disk. Otherwise, there is likely
+ //no path mapping for a path starting with '..'.
+ //This can still fail, but catches the most reasonable
+ //uses of ..
+ break;
+ } else if (i > 0) {
+ name.splice(i - 1, 2);
+ i -= 2;
+ }
+ }
+ }
+ //end trimDots
+
+ name = name.join("/");
+ } else if (name.indexOf('./') === 0) {
+ // No baseName, so this is ID is resolved relative
+ // to baseUrl, pull off the leading dot.
+ name = name.substring(2);
+ }
+ }
+
+ //Apply map config if available.
+ if ((baseParts || starMap) && map) {
+ nameParts = name.split('/');
+
+ for (i = nameParts.length; i > 0; i -= 1) {
+ nameSegment = nameParts.slice(0, i).join("/");
+
+ if (baseParts) {
+ //Find the longest baseName segment match in the config.
+ //So, do joins on the biggest to smallest lengths of baseParts.
+ for (j = baseParts.length; j > 0; j -= 1) {
+ mapValue = map[baseParts.slice(0, j).join('/')];
+
+ //baseName segment has config, find if it has one for
+ //this name.
+ if (mapValue) {
+ mapValue = mapValue[nameSegment];
+ if (mapValue) {
+ //Match, update name to the new value.
+ foundMap = mapValue;
+ foundI = i;
+ break;
+ }
+ }
+ }
+ }
+
+ if (foundMap) {
+ break;
+ }
+
+ //Check for a star map match, but just hold on to it,
+ //if there is a shorter segment match later in a matching
+ //config, then favor over this star map.
+ if (!foundStarMap && starMap && starMap[nameSegment]) {
+ foundStarMap = starMap[nameSegment];
+ starI = i;
+ }
+ }
+
+ if (!foundMap && foundStarMap) {
+ foundMap = foundStarMap;
+ foundI = starI;
+ }
+
+ if (foundMap) {
+ nameParts.splice(0, foundI, foundMap);
+ name = nameParts.join('/');
+ }
+ }
+
+ return name;
+ }
+
+ function makeRequire(relName, forceSync) {
+ return function () {
+ //A version of a require function that passes a moduleName
+ //value for items that may need to
+ //look up paths relative to the moduleName
+ var args = aps.call(arguments, 0);
+
+ //If first arg is not require('string'), and there is only
+ //one arg, it is the array form without a callback. Insert
+ //a null so that the following concat is correct.
+ if (typeof args[0] !== 'string' && args.length === 1) {
+ args.push(null);
+ }
+ return req.apply(undef, args.concat([relName, forceSync]));
+ };
+ }
+
+ function makeNormalize(relName) {
+ return function (name) {
+ return normalize(name, relName);
+ };
+ }
+
+ function makeLoad(depName) {
+ return function (value) {
+ defined[depName] = value;
+ };
+ }
+
+ function callDep(name) {
+ if (hasProp(waiting, name)) {
+ var args = waiting[name];
+ delete waiting[name];
+ defining[name] = true;
+ main.apply(undef, args);
+ }
+
+ if (!hasProp(defined, name) && !hasProp(defining, name)) {
+ throw new Error('No ' + name);
+ }
+ return defined[name];
+ }
+
+ //Turns a plugin!resource to [plugin, resource]
+ //with the plugin being undefined if the name
+ //did not have a plugin prefix.
+ function splitPrefix(name) {
+ var prefix,
+ index = name ? name.indexOf('!') : -1;
+ if (index > -1) {
+ prefix = name.substring(0, index);
+ name = name.substring(index + 1, name.length);
+ }
+ return [prefix, name];
+ }
+
+ /**
+ * Makes a name map, normalizing the name, and using a plugin
+ * for normalization if necessary. Grabs a ref to plugin
+ * too, as an optimization.
+ */
+ makeMap = function (name, relName) {
+ var plugin,
+ parts = splitPrefix(name),
+ prefix = parts[0];
+
+ name = parts[1];
+
+ if (prefix) {
+ prefix = normalize(prefix, relName);
+ plugin = callDep(prefix);
+ }
+
+ //Normalize according
+ if (prefix) {
+ if (plugin && plugin.normalize) {
+ name = plugin.normalize(name, makeNormalize(relName));
+ } else {
+ name = normalize(name, relName);
+ }
+ } else {
+ name = normalize(name, relName);
+ parts = splitPrefix(name);
+ prefix = parts[0];
+ name = parts[1];
+ if (prefix) {
+ plugin = callDep(prefix);
+ }
+ }
+
+ //Using ridiculous property names for space reasons
+ return {
+ f: prefix ? prefix + '!' + name : name, //fullName
+ n: name,
+ pr: prefix,
+ p: plugin
+ };
+ };
+
+ function makeConfig(name) {
+ return function () {
+ return (config && config.config && config.config[name]) || {};
+ };
+ }
+
+ handlers = {
+ require: function (name) {
+ return makeRequire(name);
+ },
+ exports: function (name) {
+ var e = defined[name];
+ if (typeof e !== 'undefined') {
+ return e;
+ } else {
+ return (defined[name] = {});
+ }
+ },
+ module: function (name) {
+ return {
+ id: name,
+ uri: '',
+ exports: defined[name],
+ config: makeConfig(name)
+ };
+ }
+ };
+
+ main = function (name, deps, callback, relName) {
+ var cjsModule, depName, ret, map, i,
+ args = [],
+ callbackType = typeof callback,
+ usingExports;
+
+ //Use name if no relName
+ relName = relName || name;
+
+ //Call the callback to define the module, if necessary.
+ if (callbackType === 'undefined' || callbackType === 'function') {
+ //Pull out the defined dependencies and pass the ordered
+ //values to the callback.
+ //Default to [require, exports, module] if no deps
+ deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
+ for (i = 0; i < deps.length; i += 1) {
+ map = makeMap(deps[i], relName);
+ depName = map.f;
+
+ //Fast path CommonJS standard dependencies.
+ if (depName === "require") {
+ args[i] = handlers.require(name);
+ } else if (depName === "exports") {
+ //CommonJS module spec 1.1
+ args[i] = handlers.exports(name);
+ usingExports = true;
+ } else if (depName === "module") {
+ //CommonJS module spec 1.1
+ cjsModule = args[i] = handlers.module(name);
+ } else if (hasProp(defined, depName) ||
+ hasProp(waiting, depName) ||
+ hasProp(defining, depName)) {
+ args[i] = callDep(depName);
+ } else if (map.p) {
+ map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
+ args[i] = defined[depName];
+ } else {
+ throw new Error(name + ' missing ' + depName);
+ }
+ }
+
+ ret = callback ? callback.apply(defined[name], args) : undefined;
+
+ if (name) {
+ //If setting exports via "module" is in play,
+ //favor that over return value and exports. After that,
+ //favor a non-undefined return value over exports use.
+ if (cjsModule && cjsModule.exports !== undef &&
+ cjsModule.exports !== defined[name]) {
+ defined[name] = cjsModule.exports;
+ } else if (ret !== undef || !usingExports) {
+ //Use the return value from the function.
+ defined[name] = ret;
+ }
+ }
+ } else if (name) {
+ //May just be an object definition for the module. Only
+ //worry about defining if have a module name.
+ defined[name] = callback;
+ }
+ };
+
+ requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
+ if (typeof deps === "string") {
+ if (handlers[deps]) {
+ //callback in this case is really relName
+ return handlers[deps](callback);
+ }
+ //Just return the module wanted. In this scenario, the
+ //deps arg is the module name, and second arg (if passed)
+ //is just the relName.
+ //Normalize module name, if it contains . or ..
+ return callDep(makeMap(deps, callback).f);
+ } else if (!deps.splice) {
+ //deps is a config object, not an array.
+ config = deps;
+ if (config.deps) {
+ req(config.deps, config.callback);
+ }
+ if (!callback) {
+ return;
+ }
+
+ if (callback.splice) {
+ //callback is an array, which means it is a dependency list.
+ //Adjust args if there are dependencies
+ deps = callback;
+ callback = relName;
+ relName = null;
+ } else {
+ deps = undef;
+ }
+ }
+
+ //Support require(['a'])
+ callback = callback || function () {};
+
+ //If relName is a function, it is an errback handler,
+ //so remove it.
+ if (typeof relName === 'function') {
+ relName = forceSync;
+ forceSync = alt;
+ }
+
+ //Simulate async callback;
+ if (forceSync) {
+ main(undef, deps, callback, relName);
+ } else {
+ //Using a non-zero value because of concern for what old browsers
+ //do, and latest browsers "upgrade" to 4 if lower value is used:
+ //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
+ //If want a value immediately, use require('id') instead -- something
+ //that works in almond on the global level, but not guaranteed and
+ //unlikely to work in other AMD implementations.
+ setTimeout(function () {
+ main(undef, deps, callback, relName);
+ }, 4);
+ }
+
+ return req;
+ };
+
+ /**
+ * Just drops the config on the floor, but returns req in case
+ * the config return value is used.
+ */
+ req.config = function (cfg) {
+ return req(cfg);
+ };
+
+ /**
+ * Expose module registry for debugging and tooling
+ */
+ requirejs._defined = defined;
+
+ define = function (name, deps, callback) {
+ if (typeof name !== 'string') {
+ throw new Error('See almond README: incorrect module build, no module name');
+ }
+
+ //This module may not have dependencies
+ if (!deps.splice) {
+ //deps is not an array, so probably means
+ //an object literal or factory function for
+ //the value. Adjust args.
+ callback = deps;
+ deps = [];
+ }
+
+ if (!hasProp(defined, name) && !hasProp(waiting, name)) {
+ waiting[name] = [name, deps, callback];
+ }
+ };
+
+ define.amd = {
+ jQuery: true
+ };
+}());
+
+S2.requirejs = requirejs;S2.require = require;S2.define = define;
+}
+}());
+S2.define("almond", function(){});
+
+/* global jQuery:false, $:false */
+S2.define('jquery',[],function () {
+ var _$ = jQuery || $;
+
+ if (_$ == null && console && console.error) {
+ console.error(
+ 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
+ 'found. Make sure that you are including jQuery before Select2 on your ' +
+ 'web page.'
+ );
+ }
+
+ return _$;
+});
+
+S2.define('select2/utils',[
+ 'jquery'
+], function ($) {
+ var Utils = {};
+
+ Utils.Extend = function (ChildClass, SuperClass) {
+ var __hasProp = {}.hasOwnProperty;
+
+ function BaseConstructor () {
+ this.constructor = ChildClass;
+ }
+
+ for (var key in SuperClass) {
+ if (__hasProp.call(SuperClass, key)) {
+ ChildClass[key] = SuperClass[key];
+ }
+ }
+
+ BaseConstructor.prototype = SuperClass.prototype;
+ ChildClass.prototype = new BaseConstructor();
+ ChildClass.__super__ = SuperClass.prototype;
+
+ return ChildClass;
+ };
+
+ function getMethods (theClass) {
+ var proto = theClass.prototype;
+
+ var methods = [];
+
+ for (var methodName in proto) {
+ var m = proto[methodName];
+
+ if (typeof m !== 'function') {
+ continue;
+ }
+
+ if (methodName === 'constructor') {
+ continue;
+ }
+
+ methods.push(methodName);
+ }
+
+ return methods;
+ }
+
+ Utils.Decorate = function (SuperClass, DecoratorClass) {
+ var decoratedMethods = getMethods(DecoratorClass);
+ var superMethods = getMethods(SuperClass);
+
+ function DecoratedClass () {
+ var unshift = Array.prototype.unshift;
+
+ var argCount = DecoratorClass.prototype.constructor.length;
+
+ var calledConstructor = SuperClass.prototype.constructor;
+
+ if (argCount > 0) {
+ unshift.call(arguments, SuperClass.prototype.constructor);
+
+ calledConstructor = DecoratorClass.prototype.constructor;
+ }
+
+ calledConstructor.apply(this, arguments);
+ }
+
+ DecoratorClass.displayName = SuperClass.displayName;
+
+ function ctr () {
+ this.constructor = DecoratedClass;
+ }
+
+ DecoratedClass.prototype = new ctr();
+
+ for (var m = 0; m < superMethods.length; m++) {
+ var superMethod = superMethods[m];
+
+ DecoratedClass.prototype[superMethod] =
+ SuperClass.prototype[superMethod];
+ }
+
+ var calledMethod = function (methodName) {
+ // Stub out the original method if it's not decorating an actual method
+ var originalMethod = function () {};
+
+ if (methodName in DecoratedClass.prototype) {
+ originalMethod = DecoratedClass.prototype[methodName];
+ }
+
+ var decoratedMethod = DecoratorClass.prototype[methodName];
+
+ return function () {
+ var unshift = Array.prototype.unshift;
+
+ unshift.call(arguments, originalMethod);
+
+ return decoratedMethod.apply(this, arguments);
+ };
+ };
+
+ for (var d = 0; d < decoratedMethods.length; d++) {
+ var decoratedMethod = decoratedMethods[d];
+
+ DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
+ }
+
+ return DecoratedClass;
+ };
+
+ var Observable = function () {
+ this.listeners = {};
+ };
+
+ Observable.prototype.on = function (event, callback) {
+ this.listeners = this.listeners || {};
+
+ if (event in this.listeners) {
+ this.listeners[event].push(callback);
+ } else {
+ this.listeners[event] = [callback];
+ }
+ };
+
+ Observable.prototype.trigger = function (event) {
+ var slice = Array.prototype.slice;
+ var params = slice.call(arguments, 1);
+
+ this.listeners = this.listeners || {};
+
+ // Params should always come in as an array
+ if (params == null) {
+ params = [];
+ }
+
+ // If there are no arguments to the event, use a temporary object
+ if (params.length === 0) {
+ params.push({});
+ }
+
+ // Set the `_type` of the first object to the event
+ params[0]._type = event;
+
+ if (event in this.listeners) {
+ this.invoke(this.listeners[event], slice.call(arguments, 1));
+ }
+
+ if ('*' in this.listeners) {
+ this.invoke(this.listeners['*'], arguments);
+ }
+ };
+
+ Observable.prototype.invoke = function (listeners, params) {
+ for (var i = 0, len = listeners.length; i < len; i++) {
+ listeners[i].apply(this, params);
+ }
+ };
+
+ Utils.Observable = Observable;
+
+ Utils.generateChars = function (length) {
+ var chars = '';
+
+ for (var i = 0; i < length; i++) {
+ var randomChar = Math.floor(Math.random() * 36);
+ chars += randomChar.toString(36);
+ }
+
+ return chars;
+ };
+
+ Utils.bind = function (func, context) {
+ return function () {
+ func.apply(context, arguments);
+ };
+ };
+
+ Utils._convertData = function (data) {
+ for (var originalKey in data) {
+ var keys = originalKey.split('-');
+
+ var dataLevel = data;
+
+ if (keys.length === 1) {
+ continue;
+ }
+
+ for (var k = 0; k < keys.length; k++) {
+ var key = keys[k];
+
+ // Lowercase the first letter
+ // By default, dash-separated becomes camelCase
+ key = key.substring(0, 1).toLowerCase() + key.substring(1);
+
+ if (!(key in dataLevel)) {
+ dataLevel[key] = {};
+ }
+
+ if (k == keys.length - 1) {
+ dataLevel[key] = data[originalKey];
+ }
+
+ dataLevel = dataLevel[key];
+ }
+
+ delete data[originalKey];
+ }
+
+ return data;
+ };
+
+ Utils.hasScroll = function (index, el) {
+ // Adapted from the function created by @ShadowScripter
+ // and adapted by @BillBarry on the Stack Exchange Code Review website.
+ // The original code can be found at
+ // http://codereview.stackexchange.com/q/13338
+ // and was designed to be used with the Sizzle selector engine.
+
+ var $el = $(el);
+ var overflowX = el.style.overflowX;
+ var overflowY = el.style.overflowY;
+
+ //Check both x and y declarations
+ if (overflowX === overflowY &&
+ (overflowY === 'hidden' || overflowY === 'visible')) {
+ return false;
+ }
+
+ if (overflowX === 'scroll' || overflowY === 'scroll') {
+ return true;
+ }
+
+ return ($el.innerHeight() < el.scrollHeight ||
+ $el.innerWidth() < el.scrollWidth);
+ };
+
+ Utils.escapeMarkup = function (markup) {
+ var replaceMap = {
+ '\\': '\',
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ '\'': ''',
+ '/': '/'
+ };
+
+ // Do not try to escape the markup if it's not a string
+ if (typeof markup !== 'string') {
+ return markup;
+ }
+
+ return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
+ return replaceMap[match];
+ });
+ };
+
+ // Append an array of jQuery nodes to a given element.
+ Utils.appendMany = function ($element, $nodes) {
+ // jQuery 1.7.x does not support $.fn.append() with an array
+ // Fall back to a jQuery object collection using $.fn.add()
+ if ($.fn.jquery.substr(0, 3) === '1.7') {
+ var $jqNodes = $();
+
+ $.map($nodes, function (node) {
+ $jqNodes = $jqNodes.add(node);
+ });
+
+ $nodes = $jqNodes;
+ }
+
+ $element.append($nodes);
+ };
+
+ return Utils;
+});
+
+S2.define('select2/results',[
+ 'jquery',
+ './utils'
+], function ($, Utils) {
+ function Results ($element, options, dataAdapter) {
+ this.$element = $element;
+ this.data = dataAdapter;
+ this.options = options;
+
+ Results.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(Results, Utils.Observable);
+
+ Results.prototype.render = function () {
+ var $results = $(
+ ''
+ );
+
+ if (this.options.get('multiple')) {
+ $results.attr('aria-multiselectable', 'true');
+ }
+
+ this.$results = $results;
+
+ return $results;
+ };
+
+ Results.prototype.clear = function () {
+ this.$results.empty();
+ };
+
+ Results.prototype.displayMessage = function (params) {
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ this.clear();
+ this.hideLoading();
+
+ var $message = $(
+ ' '
+ );
+
+ var message = this.options.get('translations').get(params.message);
+
+ $message.append(
+ escapeMarkup(
+ message(params.args)
+ )
+ );
+
+ $message[0].className += ' select2-results__message';
+
+ this.$results.append($message);
+ };
+
+ Results.prototype.hideMessages = function () {
+ this.$results.find('.select2-results__message').remove();
+ };
+
+ Results.prototype.append = function (data) {
+ this.hideLoading();
+
+ var $options = [];
+
+ if (data.results == null || data.results.length === 0) {
+ if (this.$results.children().length === 0) {
+ this.trigger('results:message', {
+ message: 'noResults'
+ });
+ }
+
+ return;
+ }
+
+ data.results = this.sort(data.results);
+
+ for (var d = 0; d < data.results.length; d++) {
+ var item = data.results[d];
+
+ var $option = this.option(item);
+
+ $options.push($option);
+ }
+
+ this.$results.append($options);
+ };
+
+ Results.prototype.position = function ($results, $dropdown) {
+ var $resultsContainer = $dropdown.find('.select2-results');
+ $resultsContainer.append($results);
+ };
+
+ Results.prototype.sort = function (data) {
+ var sorter = this.options.get('sorter');
+
+ return sorter(data);
+ };
+
+ Results.prototype.highlightFirstItem = function () {
+ var $options = this.$results
+ .find('.select2-results__option[aria-selected]');
+
+ var $selected = $options.filter('[aria-selected=true]');
+
+ // Check if there are any selected options
+ if ($selected.length > 0) {
+ // If there are selected options, highlight the first
+ $selected.first().trigger('mouseenter');
+ } else {
+ // If there are no selected options, highlight the first option
+ // in the dropdown
+ $options.first().trigger('mouseenter');
+ }
+
+ this.ensureHighlightVisible();
+ };
+
+ Results.prototype.setClasses = function () {
+ var self = this;
+
+ this.data.current(function (selected) {
+ var selectedIds = $.map(selected, function (s) {
+ return s.id.toString();
+ });
+
+ var $options = self.$results
+ .find('.select2-results__option[aria-selected]');
+
+ $options.each(function () {
+ var $option = $(this);
+
+ var item = $.data(this, 'data');
+
+ // id needs to be converted to a string when comparing
+ var id = '' + item.id;
+
+ if ((item.element != null && item.element.selected) ||
+ (item.element == null && $.inArray(id, selectedIds) > -1)) {
+ $option.attr('aria-selected', 'true');
+ } else {
+ $option.attr('aria-selected', 'false');
+ }
+ });
+
+ });
+ };
+
+ Results.prototype.showLoading = function (params) {
+ this.hideLoading();
+
+ var loadingMore = this.options.get('translations').get('searching');
+
+ var loading = {
+ disabled: true,
+ loading: true,
+ text: loadingMore(params)
+ };
+ var $loading = this.option(loading);
+ $loading.className += ' loading-results';
+
+ this.$results.prepend($loading);
+ };
+
+ Results.prototype.hideLoading = function () {
+ this.$results.find('.loading-results').remove();
+ };
+
+ Results.prototype.option = function (data) {
+ var option = document.createElement('li');
+ option.className = 'select2-results__option';
+
+ var attrs = {
+ 'role': 'treeitem',
+ 'aria-selected': 'false'
+ };
+
+ if (data.disabled) {
+ delete attrs['aria-selected'];
+ attrs['aria-disabled'] = 'true';
+ }
+
+ if (data.id == null) {
+ delete attrs['aria-selected'];
+ }
+
+ if (data._resultId != null) {
+ option.id = data._resultId;
+ }
+
+ if (data.title) {
+ option.title = data.title;
+ }
+
+ if (data.children) {
+ attrs.role = 'group';
+ attrs['aria-label'] = data.text;
+ delete attrs['aria-selected'];
+ }
+
+ for (var attr in attrs) {
+ var val = attrs[attr];
+
+ option.setAttribute(attr, val);
+ }
+
+ if (data.children) {
+ var $option = $(option);
+
+ var label = document.createElement('strong');
+ label.className = 'select2-results__group';
+
+ var $label = $(label);
+ this.template(data, label);
+
+ var $children = [];
+
+ for (var c = 0; c < data.children.length; c++) {
+ var child = data.children[c];
+
+ var $child = this.option(child);
+
+ $children.push($child);
+ }
+
+ var $childrenContainer = $('', {
+ 'class': 'select2-results__options select2-results__options--nested'
+ });
+
+ $childrenContainer.append($children);
+
+ $option.append(label);
+ $option.append($childrenContainer);
+ } else {
+ this.template(data, option);
+ }
+
+ $.data(option, 'data', data);
+
+ return option;
+ };
+
+ Results.prototype.bind = function (container, $container) {
+ var self = this;
+
+ var id = container.id + '-results';
+
+ this.$results.attr('id', id);
+
+ container.on('results:all', function (params) {
+ self.clear();
+ self.append(params.data);
+
+ if (container.isOpen()) {
+ self.setClasses();
+ self.highlightFirstItem();
+ }
+ });
+
+ container.on('results:append', function (params) {
+ self.append(params.data);
+
+ if (container.isOpen()) {
+ self.setClasses();
+ }
+ });
+
+ container.on('query', function (params) {
+ self.hideMessages();
+ self.showLoading(params);
+ });
+
+ container.on('select', function () {
+ if (!container.isOpen()) {
+ return;
+ }
+
+ self.setClasses();
+ self.highlightFirstItem();
+ });
+
+ container.on('unselect', function () {
+ if (!container.isOpen()) {
+ return;
+ }
+
+ self.setClasses();
+ self.highlightFirstItem();
+ });
+
+ container.on('open', function () {
+ // When the dropdown is open, aria-expended="true"
+ self.$results.attr('aria-expanded', 'true');
+ self.$results.attr('aria-hidden', 'false');
+
+ self.setClasses();
+ self.ensureHighlightVisible();
+ });
+
+ container.on('close', function () {
+ // When the dropdown is closed, aria-expended="false"
+ self.$results.attr('aria-expanded', 'false');
+ self.$results.attr('aria-hidden', 'true');
+ self.$results.removeAttr('aria-activedescendant');
+ });
+
+ container.on('results:toggle', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ if ($highlighted.length === 0) {
+ return;
+ }
+
+ $highlighted.trigger('mouseup');
+ });
+
+ container.on('results:select', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ if ($highlighted.length === 0) {
+ return;
+ }
+
+ var data = $highlighted.data('data');
+
+ if ($highlighted.attr('aria-selected') == 'true') {
+ self.trigger('close', {});
+ } else {
+ self.trigger('select', {
+ data: data
+ });
+ }
+ });
+
+ container.on('results:previous', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ var $options = self.$results.find('[aria-selected]');
+
+ var currentIndex = $options.index($highlighted);
+
+ // If we are already at te top, don't move further
+ if (currentIndex === 0) {
+ return;
+ }
+
+ var nextIndex = currentIndex - 1;
+
+ // If none are highlighted, highlight the first
+ if ($highlighted.length === 0) {
+ nextIndex = 0;
+ }
+
+ var $next = $options.eq(nextIndex);
+
+ $next.trigger('mouseenter');
+
+ var currentOffset = self.$results.offset().top;
+ var nextTop = $next.offset().top;
+ var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
+
+ if (nextIndex === 0) {
+ self.$results.scrollTop(0);
+ } else if (nextTop - currentOffset < 0) {
+ self.$results.scrollTop(nextOffset);
+ }
+ });
+
+ container.on('results:next', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ var $options = self.$results.find('[aria-selected]');
+
+ var currentIndex = $options.index($highlighted);
+
+ var nextIndex = currentIndex + 1;
+
+ // If we are at the last option, stay there
+ if (nextIndex >= $options.length) {
+ return;
+ }
+
+ var $next = $options.eq(nextIndex);
+
+ $next.trigger('mouseenter');
+
+ var currentOffset = self.$results.offset().top +
+ self.$results.outerHeight(false);
+ var nextBottom = $next.offset().top + $next.outerHeight(false);
+ var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
+
+ if (nextIndex === 0) {
+ self.$results.scrollTop(0);
+ } else if (nextBottom > currentOffset) {
+ self.$results.scrollTop(nextOffset);
+ }
+ });
+
+ container.on('results:focus', function (params) {
+ params.element.addClass('select2-results__option--highlighted');
+ });
+
+ container.on('results:message', function (params) {
+ self.displayMessage(params);
+ });
+
+ if ($.fn.mousewheel) {
+ this.$results.on('mousewheel', function (e) {
+ var top = self.$results.scrollTop();
+
+ var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
+
+ var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
+ var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
+
+ if (isAtTop) {
+ self.$results.scrollTop(0);
+
+ e.preventDefault();
+ e.stopPropagation();
+ } else if (isAtBottom) {
+ self.$results.scrollTop(
+ self.$results.get(0).scrollHeight - self.$results.height()
+ );
+
+ e.preventDefault();
+ e.stopPropagation();
+ }
+ });
+ }
+
+ this.$results.on('mouseup', '.select2-results__option[aria-selected]',
+ function (evt) {
+ var $this = $(this);
+
+ var data = $this.data('data');
+
+ if ($this.attr('aria-selected') === 'true') {
+ if (self.options.get('multiple')) {
+ self.trigger('unselect', {
+ originalEvent: evt,
+ data: data
+ });
+ } else {
+ self.trigger('close', {});
+ }
+
+ return;
+ }
+
+ self.trigger('select', {
+ originalEvent: evt,
+ data: data
+ });
+ });
+
+ this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
+ function (evt) {
+ var data = $(this).data('data');
+
+ self.getHighlightedResults()
+ .removeClass('select2-results__option--highlighted');
+
+ self.trigger('results:focus', {
+ data: data,
+ element: $(this)
+ });
+ });
+ };
+
+ Results.prototype.getHighlightedResults = function () {
+ var $highlighted = this.$results
+ .find('.select2-results__option--highlighted');
+
+ return $highlighted;
+ };
+
+ Results.prototype.destroy = function () {
+ this.$results.remove();
+ };
+
+ Results.prototype.ensureHighlightVisible = function () {
+ var $highlighted = this.getHighlightedResults();
+
+ if ($highlighted.length === 0) {
+ return;
+ }
+
+ var $options = this.$results.find('[aria-selected]');
+
+ var currentIndex = $options.index($highlighted);
+
+ var currentOffset = this.$results.offset().top;
+ var nextTop = $highlighted.offset().top;
+ var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
+
+ var offsetDelta = nextTop - currentOffset;
+ nextOffset -= $highlighted.outerHeight(false) * 2;
+
+ if (currentIndex <= 2) {
+ this.$results.scrollTop(0);
+ } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
+ this.$results.scrollTop(nextOffset);
+ }
+ };
+
+ Results.prototype.template = function (result, container) {
+ var template = this.options.get('templateResult');
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ var content = template(result, container);
+
+ if (content == null) {
+ container.style.display = 'none';
+ } else if (typeof content === 'string') {
+ container.innerHTML = escapeMarkup(content);
+ } else {
+ $(container).append(content);
+ }
+ };
+
+ return Results;
+});
+
+S2.define('select2/keys',[
+
+], function () {
+ var KEYS = {
+ BACKSPACE: 8,
+ TAB: 9,
+ ENTER: 13,
+ SHIFT: 16,
+ CTRL: 17,
+ ALT: 18,
+ ESC: 27,
+ SPACE: 32,
+ PAGE_UP: 33,
+ PAGE_DOWN: 34,
+ END: 35,
+ HOME: 36,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ DELETE: 46
+ };
+
+ return KEYS;
+});
+
+S2.define('select2/selection/base',[
+ 'jquery',
+ '../utils',
+ '../keys'
+], function ($, Utils, KEYS) {
+ function BaseSelection ($element, options) {
+ this.$element = $element;
+ this.options = options;
+
+ BaseSelection.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(BaseSelection, Utils.Observable);
+
+ BaseSelection.prototype.render = function () {
+ var $selection = $(
+ '' +
+ ' '
+ );
+
+ this._tabindex = 0;
+
+ if (this.$element.data('old-tabindex') != null) {
+ this._tabindex = this.$element.data('old-tabindex');
+ } else if (this.$element.attr('tabindex') != null) {
+ this._tabindex = this.$element.attr('tabindex');
+ }
+
+ $selection.attr('title', this.$element.attr('title'));
+ $selection.attr('tabindex', this._tabindex);
+
+ this.$selection = $selection;
+
+ return $selection;
+ };
+
+ BaseSelection.prototype.bind = function (container, $container) {
+ var self = this;
+
+ var id = container.id + '-container';
+ var resultsId = container.id + '-results';
+
+ this.container = container;
+
+ this.$selection.on('focus', function (evt) {
+ self.trigger('focus', evt);
+ });
+
+ this.$selection.on('blur', function (evt) {
+ self._handleBlur(evt);
+ });
+
+ this.$selection.on('keydown', function (evt) {
+ self.trigger('keypress', evt);
+
+ if (evt.which === KEYS.SPACE) {
+ evt.preventDefault();
+ }
+ });
+
+ container.on('results:focus', function (params) {
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
+ });
+
+ container.on('selection:update', function (params) {
+ self.update(params.data);
+ });
+
+ container.on('open', function () {
+ // When the dropdown is open, aria-expanded="true"
+ self.$selection.attr('aria-expanded', 'true');
+ self.$selection.attr('aria-owns', resultsId);
+
+ self._attachCloseHandler(container);
+ });
+
+ container.on('close', function () {
+ // When the dropdown is closed, aria-expanded="false"
+ self.$selection.attr('aria-expanded', 'false');
+ self.$selection.removeAttr('aria-activedescendant');
+ self.$selection.removeAttr('aria-owns');
+
+ self.$selection.focus();
+
+ self._detachCloseHandler(container);
+ });
+
+ container.on('enable', function () {
+ self.$selection.attr('tabindex', self._tabindex);
+ });
+
+ container.on('disable', function () {
+ self.$selection.attr('tabindex', '-1');
+ });
+ };
+
+ BaseSelection.prototype._handleBlur = function (evt) {
+ var self = this;
+
+ // This needs to be delayed as the active element is the body when the tab
+ // key is pressed, possibly along with others.
+ window.setTimeout(function () {
+ // Don't trigger `blur` if the focus is still in the selection
+ if (
+ (document.activeElement == self.$selection[0]) ||
+ ($.contains(self.$selection[0], document.activeElement))
+ ) {
+ return;
+ }
+
+ self.trigger('blur', evt);
+ }, 1);
+ };
+
+ BaseSelection.prototype._attachCloseHandler = function (container) {
+ var self = this;
+
+ $(document.body).on('mousedown.select2.' + container.id, function (e) {
+ var $target = $(e.target);
+
+ var $select = $target.closest('.select2');
+
+ var $all = $('.select2.select2-container--open');
+
+ $all.each(function () {
+ var $this = $(this);
+
+ if (this == $select[0]) {
+ return;
+ }
+
+ var $element = $this.data('element');
+
+ $element.select2('close');
+ });
+ });
+ };
+
+ BaseSelection.prototype._detachCloseHandler = function (container) {
+ $(document.body).off('mousedown.select2.' + container.id);
+ };
+
+ BaseSelection.prototype.position = function ($selection, $container) {
+ var $selectionContainer = $container.find('.selection');
+ $selectionContainer.append($selection);
+ };
+
+ BaseSelection.prototype.destroy = function () {
+ this._detachCloseHandler(this.container);
+ };
+
+ BaseSelection.prototype.update = function (data) {
+ throw new Error('The `update` method must be defined in child classes.');
+ };
+
+ return BaseSelection;
+});
+
+S2.define('select2/selection/single',[
+ 'jquery',
+ './base',
+ '../utils',
+ '../keys'
+], function ($, BaseSelection, Utils, KEYS) {
+ function SingleSelection () {
+ SingleSelection.__super__.constructor.apply(this, arguments);
+ }
+
+ Utils.Extend(SingleSelection, BaseSelection);
+
+ SingleSelection.prototype.render = function () {
+ var $selection = SingleSelection.__super__.render.call(this);
+
+ $selection.addClass('select2-selection--single');
+
+ $selection.html(
+ ' ' +
+ '' +
+ ' ' +
+ ' '
+ );
+
+ return $selection;
+ };
+
+ SingleSelection.prototype.bind = function (container, $container) {
+ var self = this;
+
+ SingleSelection.__super__.bind.apply(this, arguments);
+
+ var id = container.id + '-container';
+
+ this.$selection.find('.select2-selection__rendered').attr('id', id);
+ this.$selection.attr('aria-labelledby', id);
+
+ this.$selection.on('mousedown', function (evt) {
+ // Only respond to left clicks
+ if (evt.which !== 1) {
+ return;
+ }
+
+ self.trigger('toggle', {
+ originalEvent: evt
+ });
+ });
+
+ this.$selection.on('focus', function (evt) {
+ // User focuses on the container
+ });
+
+ this.$selection.on('blur', function (evt) {
+ // User exits the container
+ });
+
+ container.on('focus', function (evt) {
+ if (!container.isOpen()) {
+ self.$selection.focus();
+ }
+ });
+
+ container.on('selection:update', function (params) {
+ self.update(params.data);
+ });
+ };
+
+ SingleSelection.prototype.clear = function () {
+ this.$selection.find('.select2-selection__rendered').empty();
+ };
+
+ SingleSelection.prototype.display = function (data, container) {
+ var template = this.options.get('templateSelection');
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ return escapeMarkup(template(data, container));
+ };
+
+ SingleSelection.prototype.selectionContainer = function () {
+ return $(' ');
+ };
+
+ SingleSelection.prototype.update = function (data) {
+ if (data.length === 0) {
+ this.clear();
+ return;
+ }
+
+ var selection = data[0];
+
+ var $rendered = this.$selection.find('.select2-selection__rendered');
+ var formatted = this.display(selection, $rendered);
+
+ $rendered.empty().append(formatted);
+ $rendered.prop('title', selection.title || selection.text);
+ };
+
+ return SingleSelection;
+});
+
+S2.define('select2/selection/multiple',[
+ 'jquery',
+ './base',
+ '../utils'
+], function ($, BaseSelection, Utils) {
+ function MultipleSelection ($element, options) {
+ MultipleSelection.__super__.constructor.apply(this, arguments);
+ }
+
+ Utils.Extend(MultipleSelection, BaseSelection);
+
+ MultipleSelection.prototype.render = function () {
+ var $selection = MultipleSelection.__super__.render.call(this);
+
+ $selection.addClass('select2-selection--multiple');
+
+ $selection.html(
+ ''
+ );
+
+ return $selection;
+ };
+
+ MultipleSelection.prototype.bind = function (container, $container) {
+ var self = this;
+
+ MultipleSelection.__super__.bind.apply(this, arguments);
+
+ this.$selection.on('click', function (evt) {
+ self.trigger('toggle', {
+ originalEvent: evt
+ });
+ });
+
+ this.$selection.on(
+ 'click',
+ '.select2-selection__choice__remove',
+ function (evt) {
+ // Ignore the event if it is disabled
+ if (self.options.get('disabled')) {
+ return;
+ }
+
+ var $remove = $(this);
+ var $selection = $remove.parent();
+
+ var data = $selection.data('data');
+
+ self.trigger('unselect', {
+ originalEvent: evt,
+ data: data
+ });
+ }
+ );
+ };
+
+ MultipleSelection.prototype.clear = function () {
+ this.$selection.find('.select2-selection__rendered').empty();
+ };
+
+ MultipleSelection.prototype.display = function (data, container) {
+ var template = this.options.get('templateSelection');
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ return escapeMarkup(template(data, container));
+ };
+
+ MultipleSelection.prototype.selectionContainer = function () {
+ var $container = $(
+ '' +
+ '' +
+ '×' +
+ ' ' +
+ ' '
+ );
+
+ return $container;
+ };
+
+ MultipleSelection.prototype.update = function (data) {
+ this.clear();
+
+ if (data.length === 0) {
+ return;
+ }
+
+ var $selections = [];
+
+ for (var d = 0; d < data.length; d++) {
+ var selection = data[d];
+
+ var $selection = this.selectionContainer();
+ var formatted = this.display(selection, $selection);
+
+ $selection.append(formatted);
+ $selection.prop('title', selection.title || selection.text);
+
+ $selection.data('data', selection);
+
+ $selections.push($selection);
+ }
+
+ var $rendered = this.$selection.find('.select2-selection__rendered');
+
+ Utils.appendMany($rendered, $selections);
+ };
+
+ return MultipleSelection;
+});
+
+S2.define('select2/selection/placeholder',[
+ '../utils'
+], function (Utils) {
+ function Placeholder (decorated, $element, options) {
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
+
+ decorated.call(this, $element, options);
+ }
+
+ Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
+ if (typeof placeholder === 'string') {
+ placeholder = {
+ id: '',
+ text: placeholder
+ };
+ }
+
+ return placeholder;
+ };
+
+ Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
+ var $placeholder = this.selectionContainer();
+
+ $placeholder.html(this.display(placeholder));
+ $placeholder.addClass('select2-selection__placeholder')
+ .removeClass('select2-selection__choice');
+
+ return $placeholder;
+ };
+
+ Placeholder.prototype.update = function (decorated, data) {
+ var singlePlaceholder = (
+ data.length == 1 && data[0].id != this.placeholder.id
+ );
+ var multipleSelections = data.length > 1;
+
+ if (multipleSelections || singlePlaceholder) {
+ return decorated.call(this, data);
+ }
+
+ this.clear();
+
+ var $placeholder = this.createPlaceholder(this.placeholder);
+
+ this.$selection.find('.select2-selection__rendered').append($placeholder);
+ };
+
+ return Placeholder;
+});
+
+S2.define('select2/selection/allowClear',[
+ 'jquery',
+ '../keys'
+], function ($, KEYS) {
+ function AllowClear () { }
+
+ AllowClear.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ if (this.placeholder == null) {
+ if (this.options.get('debug') && window.console && console.error) {
+ console.error(
+ 'Select2: The `allowClear` option should be used in combination ' +
+ 'with the `placeholder` option.'
+ );
+ }
+ }
+
+ this.$selection.on('mousedown', '.select2-selection__clear',
+ function (evt) {
+ self._handleClear(evt);
+ });
+
+ container.on('keypress', function (evt) {
+ self._handleKeyboardClear(evt, container);
+ });
+ };
+
+ AllowClear.prototype._handleClear = function (_, evt) {
+ // Ignore the event if it is disabled
+ if (this.options.get('disabled')) {
+ return;
+ }
+
+ var $clear = this.$selection.find('.select2-selection__clear');
+
+ // Ignore the event if nothing has been selected
+ if ($clear.length === 0) {
+ return;
+ }
+
+ evt.stopPropagation();
+
+ var data = $clear.data('data');
+
+ for (var d = 0; d < data.length; d++) {
+ var unselectData = {
+ data: data[d]
+ };
+
+ // Trigger the `unselect` event, so people can prevent it from being
+ // cleared.
+ this.trigger('unselect', unselectData);
+
+ // If the event was prevented, don't clear it out.
+ if (unselectData.prevented) {
+ return;
+ }
+ }
+
+ this.$element.val(this.placeholder.id).trigger('change');
+
+ this.trigger('toggle', {});
+ };
+
+ AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
+ if (container.isOpen()) {
+ return;
+ }
+
+ if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
+ this._handleClear(evt);
+ }
+ };
+
+ AllowClear.prototype.update = function (decorated, data) {
+ decorated.call(this, data);
+
+ if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
+ data.length === 0) {
+ return;
+ }
+
+ var $remove = $(
+ '' +
+ '×' +
+ ' '
+ );
+ $remove.data('data', data);
+
+ this.$selection.find('.select2-selection__rendered').prepend($remove);
+ };
+
+ return AllowClear;
+});
+
+S2.define('select2/selection/search',[
+ 'jquery',
+ '../utils',
+ '../keys'
+], function ($, Utils, KEYS) {
+ function Search (decorated, $element, options) {
+ decorated.call(this, $element, options);
+ }
+
+ Search.prototype.render = function (decorated) {
+ var $search = $(
+ '' +
+ ' ' +
+ ' '
+ );
+
+ this.$searchContainer = $search;
+ this.$search = $search.find('input');
+
+ var $rendered = decorated.call(this);
+
+ this._transferTabIndex();
+
+ return $rendered;
+ };
+
+ Search.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('open', function () {
+ self.$search.trigger('focus');
+ });
+
+ container.on('close', function () {
+ self.$search.val('');
+ self.$search.removeAttr('aria-activedescendant');
+ self.$search.trigger('focus');
+ });
+
+ container.on('enable', function () {
+ self.$search.prop('disabled', false);
+
+ self._transferTabIndex();
+ });
+
+ container.on('disable', function () {
+ self.$search.prop('disabled', true);
+ });
+
+ container.on('focus', function (evt) {
+ self.$search.trigger('focus');
+ });
+
+ container.on('results:focus', function (params) {
+ self.$search.attr('aria-activedescendant', params.id);
+ });
+
+ this.$selection.on('focusin', '.select2-search--inline', function (evt) {
+ self.trigger('focus', evt);
+ });
+
+ this.$selection.on('focusout', '.select2-search--inline', function (evt) {
+ self._handleBlur(evt);
+ });
+
+ this.$selection.on('keydown', '.select2-search--inline', function (evt) {
+ evt.stopPropagation();
+
+ self.trigger('keypress', evt);
+
+ self._keyUpPrevented = evt.isDefaultPrevented();
+
+ var key = evt.which;
+
+ if (key === KEYS.BACKSPACE && self.$search.val() === '') {
+ var $previousChoice = self.$searchContainer
+ .prev('.select2-selection__choice');
+
+ if ($previousChoice.length > 0) {
+ var item = $previousChoice.data('data');
+
+ self.searchRemoveChoice(item);
+
+ evt.preventDefault();
+ }
+ }
+ });
+
+ // Try to detect the IE version should the `documentMode` property that
+ // is stored on the document. This is only implemented in IE and is
+ // slightly cleaner than doing a user agent check.
+ // This property is not available in Edge, but Edge also doesn't have
+ // this bug.
+ var msie = document.documentMode;
+ var disableInputEvents = msie && msie <= 11;
+
+ // Workaround for browsers which do not support the `input` event
+ // This will prevent double-triggering of events for browsers which support
+ // both the `keyup` and `input` events.
+ this.$selection.on(
+ 'input.searchcheck',
+ '.select2-search--inline',
+ function (evt) {
+ // IE will trigger the `input` event when a placeholder is used on a
+ // search box. To get around this issue, we are forced to ignore all
+ // `input` events in IE and keep using `keyup`.
+ if (disableInputEvents) {
+ self.$selection.off('input.search input.searchcheck');
+ return;
+ }
+
+ // Unbind the duplicated `keyup` event
+ self.$selection.off('keyup.search');
+ }
+ );
+
+ this.$selection.on(
+ 'keyup.search input.search',
+ '.select2-search--inline',
+ function (evt) {
+ // IE will trigger the `input` event when a placeholder is used on a
+ // search box. To get around this issue, we are forced to ignore all
+ // `input` events in IE and keep using `keyup`.
+ if (disableInputEvents && evt.type === 'input') {
+ self.$selection.off('input.search input.searchcheck');
+ return;
+ }
+
+ var key = evt.which;
+
+ // We can freely ignore events from modifier keys
+ if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
+ return;
+ }
+
+ // Tabbing will be handled during the `keydown` phase
+ if (key == KEYS.TAB) {
+ return;
+ }
+
+ self.handleSearch(evt);
+ }
+ );
+ };
+
+ /**
+ * This method will transfer the tabindex attribute from the rendered
+ * selection to the search box. This allows for the search box to be used as
+ * the primary focus instead of the selection container.
+ *
+ * @private
+ */
+ Search.prototype._transferTabIndex = function (decorated) {
+ this.$search.attr('tabindex', this.$selection.attr('tabindex'));
+ this.$selection.attr('tabindex', '-1');
+ };
+
+ Search.prototype.createPlaceholder = function (decorated, placeholder) {
+ this.$search.attr('placeholder', placeholder.text);
+ };
+
+ Search.prototype.update = function (decorated, data) {
+ var searchHadFocus = this.$search[0] == document.activeElement;
+
+ this.$search.attr('placeholder', '');
+
+ decorated.call(this, data);
+
+ this.$selection.find('.select2-selection__rendered')
+ .append(this.$searchContainer);
+
+ this.resizeSearch();
+ if (searchHadFocus) {
+ this.$search.focus();
+ }
+ };
+
+ Search.prototype.handleSearch = function () {
+ this.resizeSearch();
+
+ if (!this._keyUpPrevented) {
+ var input = this.$search.val();
+
+ this.trigger('query', {
+ term: input
+ });
+ }
+
+ this._keyUpPrevented = false;
+ };
+
+ Search.prototype.searchRemoveChoice = function (decorated, item) {
+ this.trigger('unselect', {
+ data: item
+ });
+
+ this.$search.val(item.text);
+ this.handleSearch();
+ };
+
+ Search.prototype.resizeSearch = function () {
+ this.$search.css('width', '25px');
+
+ var width = '';
+
+ if (this.$search.attr('placeholder') !== '') {
+ width = this.$selection.find('.select2-selection__rendered').innerWidth();
+ } else {
+ var minimumWidth = this.$search.val().length + 1;
+
+ width = (minimumWidth * 0.75) + 'em';
+ }
+
+ this.$search.css('width', width);
+ };
+
+ return Search;
+});
+
+S2.define('select2/selection/eventRelay',[
+ 'jquery'
+], function ($) {
+ function EventRelay () { }
+
+ EventRelay.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+ var relayEvents = [
+ 'open', 'opening',
+ 'close', 'closing',
+ 'select', 'selecting',
+ 'unselect', 'unselecting'
+ ];
+
+ var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
+
+ decorated.call(this, container, $container);
+
+ container.on('*', function (name, params) {
+ // Ignore events that should not be relayed
+ if ($.inArray(name, relayEvents) === -1) {
+ return;
+ }
+
+ // The parameters should always be an object
+ params = params || {};
+
+ // Generate the jQuery event for the Select2 event
+ var evt = $.Event('select2:' + name, {
+ params: params
+ });
+
+ self.$element.trigger(evt);
+
+ // Only handle preventable events if it was one
+ if ($.inArray(name, preventableEvents) === -1) {
+ return;
+ }
+
+ params.prevented = evt.isDefaultPrevented();
+ });
+ };
+
+ return EventRelay;
+});
+
+S2.define('select2/translation',[
+ 'jquery',
+ 'require'
+], function ($, require) {
+ function Translation (dict) {
+ this.dict = dict || {};
+ }
+
+ Translation.prototype.all = function () {
+ return this.dict;
+ };
+
+ Translation.prototype.get = function (key) {
+ return this.dict[key];
+ };
+
+ Translation.prototype.extend = function (translation) {
+ this.dict = $.extend({}, translation.all(), this.dict);
+ };
+
+ // Static functions
+
+ Translation._cache = {};
+
+ Translation.loadPath = function (path) {
+ if (!(path in Translation._cache)) {
+ var translations = require(path);
+
+ Translation._cache[path] = translations;
+ }
+
+ return new Translation(Translation._cache[path]);
+ };
+
+ return Translation;
+});
+
+S2.define('select2/diacritics',[
+
+], function () {
+ var diacritics = {
+ '\u24B6': 'A',
+ '\uFF21': 'A',
+ '\u00C0': 'A',
+ '\u00C1': 'A',
+ '\u00C2': 'A',
+ '\u1EA6': 'A',
+ '\u1EA4': 'A',
+ '\u1EAA': 'A',
+ '\u1EA8': 'A',
+ '\u00C3': 'A',
+ '\u0100': 'A',
+ '\u0102': 'A',
+ '\u1EB0': 'A',
+ '\u1EAE': 'A',
+ '\u1EB4': 'A',
+ '\u1EB2': 'A',
+ '\u0226': 'A',
+ '\u01E0': 'A',
+ '\u00C4': 'A',
+ '\u01DE': 'A',
+ '\u1EA2': 'A',
+ '\u00C5': 'A',
+ '\u01FA': 'A',
+ '\u01CD': 'A',
+ '\u0200': 'A',
+ '\u0202': 'A',
+ '\u1EA0': 'A',
+ '\u1EAC': 'A',
+ '\u1EB6': 'A',
+ '\u1E00': 'A',
+ '\u0104': 'A',
+ '\u023A': 'A',
+ '\u2C6F': 'A',
+ '\uA732': 'AA',
+ '\u00C6': 'AE',
+ '\u01FC': 'AE',
+ '\u01E2': 'AE',
+ '\uA734': 'AO',
+ '\uA736': 'AU',
+ '\uA738': 'AV',
+ '\uA73A': 'AV',
+ '\uA73C': 'AY',
+ '\u24B7': 'B',
+ '\uFF22': 'B',
+ '\u1E02': 'B',
+ '\u1E04': 'B',
+ '\u1E06': 'B',
+ '\u0243': 'B',
+ '\u0182': 'B',
+ '\u0181': 'B',
+ '\u24B8': 'C',
+ '\uFF23': 'C',
+ '\u0106': 'C',
+ '\u0108': 'C',
+ '\u010A': 'C',
+ '\u010C': 'C',
+ '\u00C7': 'C',
+ '\u1E08': 'C',
+ '\u0187': 'C',
+ '\u023B': 'C',
+ '\uA73E': 'C',
+ '\u24B9': 'D',
+ '\uFF24': 'D',
+ '\u1E0A': 'D',
+ '\u010E': 'D',
+ '\u1E0C': 'D',
+ '\u1E10': 'D',
+ '\u1E12': 'D',
+ '\u1E0E': 'D',
+ '\u0110': 'D',
+ '\u018B': 'D',
+ '\u018A': 'D',
+ '\u0189': 'D',
+ '\uA779': 'D',
+ '\u01F1': 'DZ',
+ '\u01C4': 'DZ',
+ '\u01F2': 'Dz',
+ '\u01C5': 'Dz',
+ '\u24BA': 'E',
+ '\uFF25': 'E',
+ '\u00C8': 'E',
+ '\u00C9': 'E',
+ '\u00CA': 'E',
+ '\u1EC0': 'E',
+ '\u1EBE': 'E',
+ '\u1EC4': 'E',
+ '\u1EC2': 'E',
+ '\u1EBC': 'E',
+ '\u0112': 'E',
+ '\u1E14': 'E',
+ '\u1E16': 'E',
+ '\u0114': 'E',
+ '\u0116': 'E',
+ '\u00CB': 'E',
+ '\u1EBA': 'E',
+ '\u011A': 'E',
+ '\u0204': 'E',
+ '\u0206': 'E',
+ '\u1EB8': 'E',
+ '\u1EC6': 'E',
+ '\u0228': 'E',
+ '\u1E1C': 'E',
+ '\u0118': 'E',
+ '\u1E18': 'E',
+ '\u1E1A': 'E',
+ '\u0190': 'E',
+ '\u018E': 'E',
+ '\u24BB': 'F',
+ '\uFF26': 'F',
+ '\u1E1E': 'F',
+ '\u0191': 'F',
+ '\uA77B': 'F',
+ '\u24BC': 'G',
+ '\uFF27': 'G',
+ '\u01F4': 'G',
+ '\u011C': 'G',
+ '\u1E20': 'G',
+ '\u011E': 'G',
+ '\u0120': 'G',
+ '\u01E6': 'G',
+ '\u0122': 'G',
+ '\u01E4': 'G',
+ '\u0193': 'G',
+ '\uA7A0': 'G',
+ '\uA77D': 'G',
+ '\uA77E': 'G',
+ '\u24BD': 'H',
+ '\uFF28': 'H',
+ '\u0124': 'H',
+ '\u1E22': 'H',
+ '\u1E26': 'H',
+ '\u021E': 'H',
+ '\u1E24': 'H',
+ '\u1E28': 'H',
+ '\u1E2A': 'H',
+ '\u0126': 'H',
+ '\u2C67': 'H',
+ '\u2C75': 'H',
+ '\uA78D': 'H',
+ '\u24BE': 'I',
+ '\uFF29': 'I',
+ '\u00CC': 'I',
+ '\u00CD': 'I',
+ '\u00CE': 'I',
+ '\u0128': 'I',
+ '\u012A': 'I',
+ '\u012C': 'I',
+ '\u0130': 'I',
+ '\u00CF': 'I',
+ '\u1E2E': 'I',
+ '\u1EC8': 'I',
+ '\u01CF': 'I',
+ '\u0208': 'I',
+ '\u020A': 'I',
+ '\u1ECA': 'I',
+ '\u012E': 'I',
+ '\u1E2C': 'I',
+ '\u0197': 'I',
+ '\u24BF': 'J',
+ '\uFF2A': 'J',
+ '\u0134': 'J',
+ '\u0248': 'J',
+ '\u24C0': 'K',
+ '\uFF2B': 'K',
+ '\u1E30': 'K',
+ '\u01E8': 'K',
+ '\u1E32': 'K',
+ '\u0136': 'K',
+ '\u1E34': 'K',
+ '\u0198': 'K',
+ '\u2C69': 'K',
+ '\uA740': 'K',
+ '\uA742': 'K',
+ '\uA744': 'K',
+ '\uA7A2': 'K',
+ '\u24C1': 'L',
+ '\uFF2C': 'L',
+ '\u013F': 'L',
+ '\u0139': 'L',
+ '\u013D': 'L',
+ '\u1E36': 'L',
+ '\u1E38': 'L',
+ '\u013B': 'L',
+ '\u1E3C': 'L',
+ '\u1E3A': 'L',
+ '\u0141': 'L',
+ '\u023D': 'L',
+ '\u2C62': 'L',
+ '\u2C60': 'L',
+ '\uA748': 'L',
+ '\uA746': 'L',
+ '\uA780': 'L',
+ '\u01C7': 'LJ',
+ '\u01C8': 'Lj',
+ '\u24C2': 'M',
+ '\uFF2D': 'M',
+ '\u1E3E': 'M',
+ '\u1E40': 'M',
+ '\u1E42': 'M',
+ '\u2C6E': 'M',
+ '\u019C': 'M',
+ '\u24C3': 'N',
+ '\uFF2E': 'N',
+ '\u01F8': 'N',
+ '\u0143': 'N',
+ '\u00D1': 'N',
+ '\u1E44': 'N',
+ '\u0147': 'N',
+ '\u1E46': 'N',
+ '\u0145': 'N',
+ '\u1E4A': 'N',
+ '\u1E48': 'N',
+ '\u0220': 'N',
+ '\u019D': 'N',
+ '\uA790': 'N',
+ '\uA7A4': 'N',
+ '\u01CA': 'NJ',
+ '\u01CB': 'Nj',
+ '\u24C4': 'O',
+ '\uFF2F': 'O',
+ '\u00D2': 'O',
+ '\u00D3': 'O',
+ '\u00D4': 'O',
+ '\u1ED2': 'O',
+ '\u1ED0': 'O',
+ '\u1ED6': 'O',
+ '\u1ED4': 'O',
+ '\u00D5': 'O',
+ '\u1E4C': 'O',
+ '\u022C': 'O',
+ '\u1E4E': 'O',
+ '\u014C': 'O',
+ '\u1E50': 'O',
+ '\u1E52': 'O',
+ '\u014E': 'O',
+ '\u022E': 'O',
+ '\u0230': 'O',
+ '\u00D6': 'O',
+ '\u022A': 'O',
+ '\u1ECE': 'O',
+ '\u0150': 'O',
+ '\u01D1': 'O',
+ '\u020C': 'O',
+ '\u020E': 'O',
+ '\u01A0': 'O',
+ '\u1EDC': 'O',
+ '\u1EDA': 'O',
+ '\u1EE0': 'O',
+ '\u1EDE': 'O',
+ '\u1EE2': 'O',
+ '\u1ECC': 'O',
+ '\u1ED8': 'O',
+ '\u01EA': 'O',
+ '\u01EC': 'O',
+ '\u00D8': 'O',
+ '\u01FE': 'O',
+ '\u0186': 'O',
+ '\u019F': 'O',
+ '\uA74A': 'O',
+ '\uA74C': 'O',
+ '\u01A2': 'OI',
+ '\uA74E': 'OO',
+ '\u0222': 'OU',
+ '\u24C5': 'P',
+ '\uFF30': 'P',
+ '\u1E54': 'P',
+ '\u1E56': 'P',
+ '\u01A4': 'P',
+ '\u2C63': 'P',
+ '\uA750': 'P',
+ '\uA752': 'P',
+ '\uA754': 'P',
+ '\u24C6': 'Q',
+ '\uFF31': 'Q',
+ '\uA756': 'Q',
+ '\uA758': 'Q',
+ '\u024A': 'Q',
+ '\u24C7': 'R',
+ '\uFF32': 'R',
+ '\u0154': 'R',
+ '\u1E58': 'R',
+ '\u0158': 'R',
+ '\u0210': 'R',
+ '\u0212': 'R',
+ '\u1E5A': 'R',
+ '\u1E5C': 'R',
+ '\u0156': 'R',
+ '\u1E5E': 'R',
+ '\u024C': 'R',
+ '\u2C64': 'R',
+ '\uA75A': 'R',
+ '\uA7A6': 'R',
+ '\uA782': 'R',
+ '\u24C8': 'S',
+ '\uFF33': 'S',
+ '\u1E9E': 'S',
+ '\u015A': 'S',
+ '\u1E64': 'S',
+ '\u015C': 'S',
+ '\u1E60': 'S',
+ '\u0160': 'S',
+ '\u1E66': 'S',
+ '\u1E62': 'S',
+ '\u1E68': 'S',
+ '\u0218': 'S',
+ '\u015E': 'S',
+ '\u2C7E': 'S',
+ '\uA7A8': 'S',
+ '\uA784': 'S',
+ '\u24C9': 'T',
+ '\uFF34': 'T',
+ '\u1E6A': 'T',
+ '\u0164': 'T',
+ '\u1E6C': 'T',
+ '\u021A': 'T',
+ '\u0162': 'T',
+ '\u1E70': 'T',
+ '\u1E6E': 'T',
+ '\u0166': 'T',
+ '\u01AC': 'T',
+ '\u01AE': 'T',
+ '\u023E': 'T',
+ '\uA786': 'T',
+ '\uA728': 'TZ',
+ '\u24CA': 'U',
+ '\uFF35': 'U',
+ '\u00D9': 'U',
+ '\u00DA': 'U',
+ '\u00DB': 'U',
+ '\u0168': 'U',
+ '\u1E78': 'U',
+ '\u016A': 'U',
+ '\u1E7A': 'U',
+ '\u016C': 'U',
+ '\u00DC': 'U',
+ '\u01DB': 'U',
+ '\u01D7': 'U',
+ '\u01D5': 'U',
+ '\u01D9': 'U',
+ '\u1EE6': 'U',
+ '\u016E': 'U',
+ '\u0170': 'U',
+ '\u01D3': 'U',
+ '\u0214': 'U',
+ '\u0216': 'U',
+ '\u01AF': 'U',
+ '\u1EEA': 'U',
+ '\u1EE8': 'U',
+ '\u1EEE': 'U',
+ '\u1EEC': 'U',
+ '\u1EF0': 'U',
+ '\u1EE4': 'U',
+ '\u1E72': 'U',
+ '\u0172': 'U',
+ '\u1E76': 'U',
+ '\u1E74': 'U',
+ '\u0244': 'U',
+ '\u24CB': 'V',
+ '\uFF36': 'V',
+ '\u1E7C': 'V',
+ '\u1E7E': 'V',
+ '\u01B2': 'V',
+ '\uA75E': 'V',
+ '\u0245': 'V',
+ '\uA760': 'VY',
+ '\u24CC': 'W',
+ '\uFF37': 'W',
+ '\u1E80': 'W',
+ '\u1E82': 'W',
+ '\u0174': 'W',
+ '\u1E86': 'W',
+ '\u1E84': 'W',
+ '\u1E88': 'W',
+ '\u2C72': 'W',
+ '\u24CD': 'X',
+ '\uFF38': 'X',
+ '\u1E8A': 'X',
+ '\u1E8C': 'X',
+ '\u24CE': 'Y',
+ '\uFF39': 'Y',
+ '\u1EF2': 'Y',
+ '\u00DD': 'Y',
+ '\u0176': 'Y',
+ '\u1EF8': 'Y',
+ '\u0232': 'Y',
+ '\u1E8E': 'Y',
+ '\u0178': 'Y',
+ '\u1EF6': 'Y',
+ '\u1EF4': 'Y',
+ '\u01B3': 'Y',
+ '\u024E': 'Y',
+ '\u1EFE': 'Y',
+ '\u24CF': 'Z',
+ '\uFF3A': 'Z',
+ '\u0179': 'Z',
+ '\u1E90': 'Z',
+ '\u017B': 'Z',
+ '\u017D': 'Z',
+ '\u1E92': 'Z',
+ '\u1E94': 'Z',
+ '\u01B5': 'Z',
+ '\u0224': 'Z',
+ '\u2C7F': 'Z',
+ '\u2C6B': 'Z',
+ '\uA762': 'Z',
+ '\u24D0': 'a',
+ '\uFF41': 'a',
+ '\u1E9A': 'a',
+ '\u00E0': 'a',
+ '\u00E1': 'a',
+ '\u00E2': 'a',
+ '\u1EA7': 'a',
+ '\u1EA5': 'a',
+ '\u1EAB': 'a',
+ '\u1EA9': 'a',
+ '\u00E3': 'a',
+ '\u0101': 'a',
+ '\u0103': 'a',
+ '\u1EB1': 'a',
+ '\u1EAF': 'a',
+ '\u1EB5': 'a',
+ '\u1EB3': 'a',
+ '\u0227': 'a',
+ '\u01E1': 'a',
+ '\u00E4': 'a',
+ '\u01DF': 'a',
+ '\u1EA3': 'a',
+ '\u00E5': 'a',
+ '\u01FB': 'a',
+ '\u01CE': 'a',
+ '\u0201': 'a',
+ '\u0203': 'a',
+ '\u1EA1': 'a',
+ '\u1EAD': 'a',
+ '\u1EB7': 'a',
+ '\u1E01': 'a',
+ '\u0105': 'a',
+ '\u2C65': 'a',
+ '\u0250': 'a',
+ '\uA733': 'aa',
+ '\u00E6': 'ae',
+ '\u01FD': 'ae',
+ '\u01E3': 'ae',
+ '\uA735': 'ao',
+ '\uA737': 'au',
+ '\uA739': 'av',
+ '\uA73B': 'av',
+ '\uA73D': 'ay',
+ '\u24D1': 'b',
+ '\uFF42': 'b',
+ '\u1E03': 'b',
+ '\u1E05': 'b',
+ '\u1E07': 'b',
+ '\u0180': 'b',
+ '\u0183': 'b',
+ '\u0253': 'b',
+ '\u24D2': 'c',
+ '\uFF43': 'c',
+ '\u0107': 'c',
+ '\u0109': 'c',
+ '\u010B': 'c',
+ '\u010D': 'c',
+ '\u00E7': 'c',
+ '\u1E09': 'c',
+ '\u0188': 'c',
+ '\u023C': 'c',
+ '\uA73F': 'c',
+ '\u2184': 'c',
+ '\u24D3': 'd',
+ '\uFF44': 'd',
+ '\u1E0B': 'd',
+ '\u010F': 'd',
+ '\u1E0D': 'd',
+ '\u1E11': 'd',
+ '\u1E13': 'd',
+ '\u1E0F': 'd',
+ '\u0111': 'd',
+ '\u018C': 'd',
+ '\u0256': 'd',
+ '\u0257': 'd',
+ '\uA77A': 'd',
+ '\u01F3': 'dz',
+ '\u01C6': 'dz',
+ '\u24D4': 'e',
+ '\uFF45': 'e',
+ '\u00E8': 'e',
+ '\u00E9': 'e',
+ '\u00EA': 'e',
+ '\u1EC1': 'e',
+ '\u1EBF': 'e',
+ '\u1EC5': 'e',
+ '\u1EC3': 'e',
+ '\u1EBD': 'e',
+ '\u0113': 'e',
+ '\u1E15': 'e',
+ '\u1E17': 'e',
+ '\u0115': 'e',
+ '\u0117': 'e',
+ '\u00EB': 'e',
+ '\u1EBB': 'e',
+ '\u011B': 'e',
+ '\u0205': 'e',
+ '\u0207': 'e',
+ '\u1EB9': 'e',
+ '\u1EC7': 'e',
+ '\u0229': 'e',
+ '\u1E1D': 'e',
+ '\u0119': 'e',
+ '\u1E19': 'e',
+ '\u1E1B': 'e',
+ '\u0247': 'e',
+ '\u025B': 'e',
+ '\u01DD': 'e',
+ '\u24D5': 'f',
+ '\uFF46': 'f',
+ '\u1E1F': 'f',
+ '\u0192': 'f',
+ '\uA77C': 'f',
+ '\u24D6': 'g',
+ '\uFF47': 'g',
+ '\u01F5': 'g',
+ '\u011D': 'g',
+ '\u1E21': 'g',
+ '\u011F': 'g',
+ '\u0121': 'g',
+ '\u01E7': 'g',
+ '\u0123': 'g',
+ '\u01E5': 'g',
+ '\u0260': 'g',
+ '\uA7A1': 'g',
+ '\u1D79': 'g',
+ '\uA77F': 'g',
+ '\u24D7': 'h',
+ '\uFF48': 'h',
+ '\u0125': 'h',
+ '\u1E23': 'h',
+ '\u1E27': 'h',
+ '\u021F': 'h',
+ '\u1E25': 'h',
+ '\u1E29': 'h',
+ '\u1E2B': 'h',
+ '\u1E96': 'h',
+ '\u0127': 'h',
+ '\u2C68': 'h',
+ '\u2C76': 'h',
+ '\u0265': 'h',
+ '\u0195': 'hv',
+ '\u24D8': 'i',
+ '\uFF49': 'i',
+ '\u00EC': 'i',
+ '\u00ED': 'i',
+ '\u00EE': 'i',
+ '\u0129': 'i',
+ '\u012B': 'i',
+ '\u012D': 'i',
+ '\u00EF': 'i',
+ '\u1E2F': 'i',
+ '\u1EC9': 'i',
+ '\u01D0': 'i',
+ '\u0209': 'i',
+ '\u020B': 'i',
+ '\u1ECB': 'i',
+ '\u012F': 'i',
+ '\u1E2D': 'i',
+ '\u0268': 'i',
+ '\u0131': 'i',
+ '\u24D9': 'j',
+ '\uFF4A': 'j',
+ '\u0135': 'j',
+ '\u01F0': 'j',
+ '\u0249': 'j',
+ '\u24DA': 'k',
+ '\uFF4B': 'k',
+ '\u1E31': 'k',
+ '\u01E9': 'k',
+ '\u1E33': 'k',
+ '\u0137': 'k',
+ '\u1E35': 'k',
+ '\u0199': 'k',
+ '\u2C6A': 'k',
+ '\uA741': 'k',
+ '\uA743': 'k',
+ '\uA745': 'k',
+ '\uA7A3': 'k',
+ '\u24DB': 'l',
+ '\uFF4C': 'l',
+ '\u0140': 'l',
+ '\u013A': 'l',
+ '\u013E': 'l',
+ '\u1E37': 'l',
+ '\u1E39': 'l',
+ '\u013C': 'l',
+ '\u1E3D': 'l',
+ '\u1E3B': 'l',
+ '\u017F': 'l',
+ '\u0142': 'l',
+ '\u019A': 'l',
+ '\u026B': 'l',
+ '\u2C61': 'l',
+ '\uA749': 'l',
+ '\uA781': 'l',
+ '\uA747': 'l',
+ '\u01C9': 'lj',
+ '\u24DC': 'm',
+ '\uFF4D': 'm',
+ '\u1E3F': 'm',
+ '\u1E41': 'm',
+ '\u1E43': 'm',
+ '\u0271': 'm',
+ '\u026F': 'm',
+ '\u24DD': 'n',
+ '\uFF4E': 'n',
+ '\u01F9': 'n',
+ '\u0144': 'n',
+ '\u00F1': 'n',
+ '\u1E45': 'n',
+ '\u0148': 'n',
+ '\u1E47': 'n',
+ '\u0146': 'n',
+ '\u1E4B': 'n',
+ '\u1E49': 'n',
+ '\u019E': 'n',
+ '\u0272': 'n',
+ '\u0149': 'n',
+ '\uA791': 'n',
+ '\uA7A5': 'n',
+ '\u01CC': 'nj',
+ '\u24DE': 'o',
+ '\uFF4F': 'o',
+ '\u00F2': 'o',
+ '\u00F3': 'o',
+ '\u00F4': 'o',
+ '\u1ED3': 'o',
+ '\u1ED1': 'o',
+ '\u1ED7': 'o',
+ '\u1ED5': 'o',
+ '\u00F5': 'o',
+ '\u1E4D': 'o',
+ '\u022D': 'o',
+ '\u1E4F': 'o',
+ '\u014D': 'o',
+ '\u1E51': 'o',
+ '\u1E53': 'o',
+ '\u014F': 'o',
+ '\u022F': 'o',
+ '\u0231': 'o',
+ '\u00F6': 'o',
+ '\u022B': 'o',
+ '\u1ECF': 'o',
+ '\u0151': 'o',
+ '\u01D2': 'o',
+ '\u020D': 'o',
+ '\u020F': 'o',
+ '\u01A1': 'o',
+ '\u1EDD': 'o',
+ '\u1EDB': 'o',
+ '\u1EE1': 'o',
+ '\u1EDF': 'o',
+ '\u1EE3': 'o',
+ '\u1ECD': 'o',
+ '\u1ED9': 'o',
+ '\u01EB': 'o',
+ '\u01ED': 'o',
+ '\u00F8': 'o',
+ '\u01FF': 'o',
+ '\u0254': 'o',
+ '\uA74B': 'o',
+ '\uA74D': 'o',
+ '\u0275': 'o',
+ '\u01A3': 'oi',
+ '\u0223': 'ou',
+ '\uA74F': 'oo',
+ '\u24DF': 'p',
+ '\uFF50': 'p',
+ '\u1E55': 'p',
+ '\u1E57': 'p',
+ '\u01A5': 'p',
+ '\u1D7D': 'p',
+ '\uA751': 'p',
+ '\uA753': 'p',
+ '\uA755': 'p',
+ '\u24E0': 'q',
+ '\uFF51': 'q',
+ '\u024B': 'q',
+ '\uA757': 'q',
+ '\uA759': 'q',
+ '\u24E1': 'r',
+ '\uFF52': 'r',
+ '\u0155': 'r',
+ '\u1E59': 'r',
+ '\u0159': 'r',
+ '\u0211': 'r',
+ '\u0213': 'r',
+ '\u1E5B': 'r',
+ '\u1E5D': 'r',
+ '\u0157': 'r',
+ '\u1E5F': 'r',
+ '\u024D': 'r',
+ '\u027D': 'r',
+ '\uA75B': 'r',
+ '\uA7A7': 'r',
+ '\uA783': 'r',
+ '\u24E2': 's',
+ '\uFF53': 's',
+ '\u00DF': 's',
+ '\u015B': 's',
+ '\u1E65': 's',
+ '\u015D': 's',
+ '\u1E61': 's',
+ '\u0161': 's',
+ '\u1E67': 's',
+ '\u1E63': 's',
+ '\u1E69': 's',
+ '\u0219': 's',
+ '\u015F': 's',
+ '\u023F': 's',
+ '\uA7A9': 's',
+ '\uA785': 's',
+ '\u1E9B': 's',
+ '\u24E3': 't',
+ '\uFF54': 't',
+ '\u1E6B': 't',
+ '\u1E97': 't',
+ '\u0165': 't',
+ '\u1E6D': 't',
+ '\u021B': 't',
+ '\u0163': 't',
+ '\u1E71': 't',
+ '\u1E6F': 't',
+ '\u0167': 't',
+ '\u01AD': 't',
+ '\u0288': 't',
+ '\u2C66': 't',
+ '\uA787': 't',
+ '\uA729': 'tz',
+ '\u24E4': 'u',
+ '\uFF55': 'u',
+ '\u00F9': 'u',
+ '\u00FA': 'u',
+ '\u00FB': 'u',
+ '\u0169': 'u',
+ '\u1E79': 'u',
+ '\u016B': 'u',
+ '\u1E7B': 'u',
+ '\u016D': 'u',
+ '\u00FC': 'u',
+ '\u01DC': 'u',
+ '\u01D8': 'u',
+ '\u01D6': 'u',
+ '\u01DA': 'u',
+ '\u1EE7': 'u',
+ '\u016F': 'u',
+ '\u0171': 'u',
+ '\u01D4': 'u',
+ '\u0215': 'u',
+ '\u0217': 'u',
+ '\u01B0': 'u',
+ '\u1EEB': 'u',
+ '\u1EE9': 'u',
+ '\u1EEF': 'u',
+ '\u1EED': 'u',
+ '\u1EF1': 'u',
+ '\u1EE5': 'u',
+ '\u1E73': 'u',
+ '\u0173': 'u',
+ '\u1E77': 'u',
+ '\u1E75': 'u',
+ '\u0289': 'u',
+ '\u24E5': 'v',
+ '\uFF56': 'v',
+ '\u1E7D': 'v',
+ '\u1E7F': 'v',
+ '\u028B': 'v',
+ '\uA75F': 'v',
+ '\u028C': 'v',
+ '\uA761': 'vy',
+ '\u24E6': 'w',
+ '\uFF57': 'w',
+ '\u1E81': 'w',
+ '\u1E83': 'w',
+ '\u0175': 'w',
+ '\u1E87': 'w',
+ '\u1E85': 'w',
+ '\u1E98': 'w',
+ '\u1E89': 'w',
+ '\u2C73': 'w',
+ '\u24E7': 'x',
+ '\uFF58': 'x',
+ '\u1E8B': 'x',
+ '\u1E8D': 'x',
+ '\u24E8': 'y',
+ '\uFF59': 'y',
+ '\u1EF3': 'y',
+ '\u00FD': 'y',
+ '\u0177': 'y',
+ '\u1EF9': 'y',
+ '\u0233': 'y',
+ '\u1E8F': 'y',
+ '\u00FF': 'y',
+ '\u1EF7': 'y',
+ '\u1E99': 'y',
+ '\u1EF5': 'y',
+ '\u01B4': 'y',
+ '\u024F': 'y',
+ '\u1EFF': 'y',
+ '\u24E9': 'z',
+ '\uFF5A': 'z',
+ '\u017A': 'z',
+ '\u1E91': 'z',
+ '\u017C': 'z',
+ '\u017E': 'z',
+ '\u1E93': 'z',
+ '\u1E95': 'z',
+ '\u01B6': 'z',
+ '\u0225': 'z',
+ '\u0240': 'z',
+ '\u2C6C': 'z',
+ '\uA763': 'z',
+ '\u0386': '\u0391',
+ '\u0388': '\u0395',
+ '\u0389': '\u0397',
+ '\u038A': '\u0399',
+ '\u03AA': '\u0399',
+ '\u038C': '\u039F',
+ '\u038E': '\u03A5',
+ '\u03AB': '\u03A5',
+ '\u038F': '\u03A9',
+ '\u03AC': '\u03B1',
+ '\u03AD': '\u03B5',
+ '\u03AE': '\u03B7',
+ '\u03AF': '\u03B9',
+ '\u03CA': '\u03B9',
+ '\u0390': '\u03B9',
+ '\u03CC': '\u03BF',
+ '\u03CD': '\u03C5',
+ '\u03CB': '\u03C5',
+ '\u03B0': '\u03C5',
+ '\u03C9': '\u03C9',
+ '\u03C2': '\u03C3'
+ };
+
+ return diacritics;
+});
+
+S2.define('select2/data/base',[
+ '../utils'
+], function (Utils) {
+ function BaseAdapter ($element, options) {
+ BaseAdapter.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(BaseAdapter, Utils.Observable);
+
+ BaseAdapter.prototype.current = function (callback) {
+ throw new Error('The `current` method must be defined in child classes.');
+ };
+
+ BaseAdapter.prototype.query = function (params, callback) {
+ throw new Error('The `query` method must be defined in child classes.');
+ };
+
+ BaseAdapter.prototype.bind = function (container, $container) {
+ // Can be implemented in subclasses
+ };
+
+ BaseAdapter.prototype.destroy = function () {
+ // Can be implemented in subclasses
+ };
+
+ BaseAdapter.prototype.generateResultId = function (container, data) {
+ var id = container.id + '-result-';
+
+ id += Utils.generateChars(4);
+
+ if (data.id != null) {
+ id += '-' + data.id.toString();
+ } else {
+ id += '-' + Utils.generateChars(4);
+ }
+ return id;
+ };
+
+ return BaseAdapter;
+});
+
+S2.define('select2/data/select',[
+ './base',
+ '../utils',
+ 'jquery'
+], function (BaseAdapter, Utils, $) {
+ function SelectAdapter ($element, options) {
+ this.$element = $element;
+ this.options = options;
+
+ SelectAdapter.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(SelectAdapter, BaseAdapter);
+
+ SelectAdapter.prototype.current = function (callback) {
+ var data = [];
+ var self = this;
+
+ this.$element.find(':selected').each(function () {
+ var $option = $(this);
+
+ var option = self.item($option);
+
+ data.push(option);
+ });
+
+ callback(data);
+ };
+
+ SelectAdapter.prototype.select = function (data) {
+ var self = this;
+
+ data.selected = true;
+
+ // If data.element is a DOM node, use it instead
+ if ($(data.element).is('option')) {
+ data.element.selected = true;
+
+ this.$element.trigger('change');
+
+ return;
+ }
+
+ if (this.$element.prop('multiple')) {
+ this.current(function (currentData) {
+ var val = [];
+
+ data = [data];
+ data.push.apply(data, currentData);
+
+ for (var d = 0; d < data.length; d++) {
+ var id = data[d].id;
+
+ if ($.inArray(id, val) === -1) {
+ val.push(id);
+ }
+ }
+
+ self.$element.val(val);
+ self.$element.trigger('change');
+ });
+ } else {
+ var val = data.id;
+
+ this.$element.val(val);
+ this.$element.trigger('change');
+ }
+ };
+
+ SelectAdapter.prototype.unselect = function (data) {
+ var self = this;
+
+ if (!this.$element.prop('multiple')) {
+ return;
+ }
+
+ data.selected = false;
+
+ if ($(data.element).is('option')) {
+ data.element.selected = false;
+
+ this.$element.trigger('change');
+
+ return;
+ }
+
+ this.current(function (currentData) {
+ var val = [];
+
+ for (var d = 0; d < currentData.length; d++) {
+ var id = currentData[d].id;
+
+ if (id !== data.id && $.inArray(id, val) === -1) {
+ val.push(id);
+ }
+ }
+
+ self.$element.val(val);
+
+ self.$element.trigger('change');
+ });
+ };
+
+ SelectAdapter.prototype.bind = function (container, $container) {
+ var self = this;
+
+ this.container = container;
+
+ container.on('select', function (params) {
+ self.select(params.data);
+ });
+
+ container.on('unselect', function (params) {
+ self.unselect(params.data);
+ });
+ };
+
+ SelectAdapter.prototype.destroy = function () {
+ // Remove anything added to child elements
+ this.$element.find('*').each(function () {
+ // Remove any custom data set by Select2
+ $.removeData(this, 'data');
+ });
+ };
+
+ SelectAdapter.prototype.query = function (params, callback) {
+ var data = [];
+ var self = this;
+
+ var $options = this.$element.children();
+
+ $options.each(function () {
+ var $option = $(this);
+
+ if (!$option.is('option') && !$option.is('optgroup')) {
+ return;
+ }
+
+ var option = self.item($option);
+
+ var matches = self.matches(params, option);
+
+ if (matches !== null) {
+ data.push(matches);
+ }
+ });
+
+ callback({
+ results: data
+ });
+ };
+
+ SelectAdapter.prototype.addOptions = function ($options) {
+ Utils.appendMany(this.$element, $options);
+ };
+
+ SelectAdapter.prototype.option = function (data) {
+ var option;
+
+ if (data.children) {
+ option = document.createElement('optgroup');
+ option.label = data.text;
+ } else {
+ option = document.createElement('option');
+
+ if (option.textContent !== undefined) {
+ option.textContent = data.text;
+ } else {
+ option.innerText = data.text;
+ }
+ }
+
+ if (data.id) {
+ option.value = data.id;
+ }
+
+ if (data.disabled) {
+ option.disabled = true;
+ }
+
+ if (data.selected) {
+ option.selected = true;
+ }
+
+ if (data.title) {
+ option.title = data.title;
+ }
+
+ var $option = $(option);
+
+ var normalizedData = this._normalizeItem(data);
+ normalizedData.element = option;
+
+ // Override the option's data with the combined data
+ $.data(option, 'data', normalizedData);
+
+ return $option;
+ };
+
+ SelectAdapter.prototype.item = function ($option) {
+ var data = {};
+
+ data = $.data($option[0], 'data');
+
+ if (data != null) {
+ return data;
+ }
+
+ if ($option.is('option')) {
+ data = {
+ id: $option.val(),
+ text: $option.text(),
+ disabled: $option.prop('disabled'),
+ selected: $option.prop('selected'),
+ title: $option.prop('title')
+ };
+ } else if ($option.is('optgroup')) {
+ data = {
+ text: $option.prop('label'),
+ children: [],
+ title: $option.prop('title')
+ };
+
+ var $children = $option.children('option');
+ var children = [];
+
+ for (var c = 0; c < $children.length; c++) {
+ var $child = $($children[c]);
+
+ var child = this.item($child);
+
+ children.push(child);
+ }
+
+ data.children = children;
+ }
+
+ data = this._normalizeItem(data);
+ data.element = $option[0];
+
+ $.data($option[0], 'data', data);
+
+ return data;
+ };
+
+ SelectAdapter.prototype._normalizeItem = function (item) {
+ if (!$.isPlainObject(item)) {
+ item = {
+ id: item,
+ text: item
+ };
+ }
+
+ item = $.extend({}, {
+ text: ''
+ }, item);
+
+ var defaults = {
+ selected: false,
+ disabled: false
+ };
+
+ if (item.id != null) {
+ item.id = item.id.toString();
+ }
+
+ if (item.text != null) {
+ item.text = item.text.toString();
+ }
+
+ if (item._resultId == null && item.id && this.container != null) {
+ item._resultId = this.generateResultId(this.container, item);
+ }
+
+ return $.extend({}, defaults, item);
+ };
+
+ SelectAdapter.prototype.matches = function (params, data) {
+ var matcher = this.options.get('matcher');
+
+ return matcher(params, data);
+ };
+
+ return SelectAdapter;
+});
+
+S2.define('select2/data/array',[
+ './select',
+ '../utils',
+ 'jquery'
+], function (SelectAdapter, Utils, $) {
+ function ArrayAdapter ($element, options) {
+ var data = options.get('data') || [];
+
+ ArrayAdapter.__super__.constructor.call(this, $element, options);
+
+ this.addOptions(this.convertToOptions(data));
+ }
+
+ Utils.Extend(ArrayAdapter, SelectAdapter);
+
+ ArrayAdapter.prototype.select = function (data) {
+ var $option = this.$element.find('option').filter(function (i, elm) {
+ return elm.value == data.id.toString();
+ });
+
+ if ($option.length === 0) {
+ $option = this.option(data);
+
+ this.addOptions($option);
+ }
+
+ ArrayAdapter.__super__.select.call(this, data);
+ };
+
+ ArrayAdapter.prototype.convertToOptions = function (data) {
+ var self = this;
+
+ var $existing = this.$element.find('option');
+ var existingIds = $existing.map(function () {
+ return self.item($(this)).id;
+ }).get();
+
+ var $options = [];
+
+ // Filter out all items except for the one passed in the argument
+ function onlyItem (item) {
+ return function () {
+ return $(this).val() == item.id;
+ };
+ }
+
+ for (var d = 0; d < data.length; d++) {
+ var item = this._normalizeItem(data[d]);
+
+ // Skip items which were pre-loaded, only merge the data
+ if ($.inArray(item.id, existingIds) >= 0) {
+ var $existingOption = $existing.filter(onlyItem(item));
+
+ var existingData = this.item($existingOption);
+ var newData = $.extend(true, {}, item, existingData);
+
+ var $newOption = this.option(newData);
+
+ $existingOption.replaceWith($newOption);
+
+ continue;
+ }
+
+ var $option = this.option(item);
+
+ if (item.children) {
+ var $children = this.convertToOptions(item.children);
+
+ Utils.appendMany($option, $children);
+ }
+
+ $options.push($option);
+ }
+
+ return $options;
+ };
+
+ return ArrayAdapter;
+});
+
+S2.define('select2/data/ajax',[
+ './array',
+ '../utils',
+ 'jquery'
+], function (ArrayAdapter, Utils, $) {
+ function AjaxAdapter ($element, options) {
+ this.ajaxOptions = this._applyDefaults(options.get('ajax'));
+
+ if (this.ajaxOptions.processResults != null) {
+ this.processResults = this.ajaxOptions.processResults;
+ }
+
+ AjaxAdapter.__super__.constructor.call(this, $element, options);
+ }
+
+ Utils.Extend(AjaxAdapter, ArrayAdapter);
+
+ AjaxAdapter.prototype._applyDefaults = function (options) {
+ var defaults = {
+ data: function (params) {
+ return $.extend({}, params, {
+ q: params.term
+ });
+ },
+ transport: function (params, success, failure) {
+ var $request = $.ajax(params);
+
+ $request.then(success);
+ $request.fail(failure);
+
+ return $request;
+ }
+ };
+
+ return $.extend({}, defaults, options, true);
+ };
+
+ AjaxAdapter.prototype.processResults = function (results) {
+ return results;
+ };
+
+ AjaxAdapter.prototype.query = function (params, callback) {
+ var matches = [];
+ var self = this;
+
+ if (this._request != null) {
+ // JSONP requests cannot always be aborted
+ if ($.isFunction(this._request.abort)) {
+ this._request.abort();
+ }
+
+ this._request = null;
+ }
+
+ var options = $.extend({
+ type: 'GET'
+ }, this.ajaxOptions);
+
+ if (typeof options.url === 'function') {
+ options.url = options.url.call(this.$element, params);
+ }
+
+ if (typeof options.data === 'function') {
+ options.data = options.data.call(this.$element, params);
+ }
+
+ function request () {
+ var $request = options.transport(options, function (data) {
+ var results = self.processResults(data, params);
+
+ if (self.options.get('debug') && window.console && console.error) {
+ // Check to make sure that the response included a `results` key.
+ if (!results || !results.results || !$.isArray(results.results)) {
+ console.error(
+ 'Select2: The AJAX results did not return an array in the ' +
+ '`results` key of the response.'
+ );
+ }
+ }
+
+ callback(results);
+ }, function () {
+ // Attempt to detect if a request was aborted
+ // Only works if the transport exposes a status property
+ if ($request.status && $request.status === '0') {
+ return;
+ }
+
+ self.trigger('results:message', {
+ message: 'errorLoading'
+ });
+ });
+
+ self._request = $request;
+ }
+
+ if (this.ajaxOptions.delay && params.term != null) {
+ if (this._queryTimeout) {
+ window.clearTimeout(this._queryTimeout);
+ }
+
+ this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
+ } else {
+ request();
+ }
+ };
+
+ return AjaxAdapter;
+});
+
+S2.define('select2/data/tags',[
+ 'jquery'
+], function ($) {
+ function Tags (decorated, $element, options) {
+ var tags = options.get('tags');
+
+ var createTag = options.get('createTag');
+
+ if (createTag !== undefined) {
+ this.createTag = createTag;
+ }
+
+ var insertTag = options.get('insertTag');
+
+ if (insertTag !== undefined) {
+ this.insertTag = insertTag;
+ }
+
+ decorated.call(this, $element, options);
+
+ if ($.isArray(tags)) {
+ for (var t = 0; t < tags.length; t++) {
+ var tag = tags[t];
+ var item = this._normalizeItem(tag);
+
+ var $option = this.option(item);
+
+ this.$element.append($option);
+ }
+ }
+ }
+
+ Tags.prototype.query = function (decorated, params, callback) {
+ var self = this;
+
+ this._removeOldTags();
+
+ if (params.term == null || params.page != null) {
+ decorated.call(this, params, callback);
+ return;
+ }
+
+ function wrapper (obj, child) {
+ var data = obj.results;
+
+ for (var i = 0; i < data.length; i++) {
+ var option = data[i];
+
+ var checkChildren = (
+ option.children != null &&
+ !wrapper({
+ results: option.children
+ }, true)
+ );
+
+ var checkText = option.text === params.term;
+
+ if (checkText || checkChildren) {
+ if (child) {
+ return false;
+ }
+
+ obj.data = data;
+ callback(obj);
+
+ return;
+ }
+ }
+
+ if (child) {
+ return true;
+ }
+
+ var tag = self.createTag(params);
+
+ if (tag != null) {
+ var $option = self.option(tag);
+ $option.attr('data-select2-tag', true);
+
+ self.addOptions([$option]);
+
+ self.insertTag(data, tag);
+ }
+
+ obj.results = data;
+
+ callback(obj);
+ }
+
+ decorated.call(this, params, wrapper);
+ };
+
+ Tags.prototype.createTag = function (decorated, params) {
+ var term = $.trim(params.term);
+
+ if (term === '') {
+ return null;
+ }
+
+ return {
+ id: term,
+ text: term
+ };
+ };
+
+ Tags.prototype.insertTag = function (_, data, tag) {
+ data.unshift(tag);
+ };
+
+ Tags.prototype._removeOldTags = function (_) {
+ var tag = this._lastTag;
+
+ var $options = this.$element.find('option[data-select2-tag]');
+
+ $options.each(function () {
+ if (this.selected) {
+ return;
+ }
+
+ $(this).remove();
+ });
+ };
+
+ return Tags;
+});
+
+S2.define('select2/data/tokenizer',[
+ 'jquery'
+], function ($) {
+ function Tokenizer (decorated, $element, options) {
+ var tokenizer = options.get('tokenizer');
+
+ if (tokenizer !== undefined) {
+ this.tokenizer = tokenizer;
+ }
+
+ decorated.call(this, $element, options);
+ }
+
+ Tokenizer.prototype.bind = function (decorated, container, $container) {
+ decorated.call(this, container, $container);
+
+ this.$search = container.dropdown.$search || container.selection.$search ||
+ $container.find('.select2-search__field');
+ };
+
+ Tokenizer.prototype.query = function (decorated, params, callback) {
+ var self = this;
+
+ function createAndSelect (data) {
+ // Normalize the data object so we can use it for checks
+ var item = self._normalizeItem(data);
+
+ // Check if the data object already exists as a tag
+ // Select it if it doesn't
+ var $existingOptions = self.$element.find('option').filter(function () {
+ return $(this).val() === item.id;
+ });
+
+ // If an existing option wasn't found for it, create the option
+ if (!$existingOptions.length) {
+ var $option = self.option(item);
+ $option.attr('data-select2-tag', true);
+
+ self._removeOldTags();
+ self.addOptions([$option]);
+ }
+
+ // Select the item, now that we know there is an option for it
+ select(item);
+ }
+
+ function select (data) {
+ self.trigger('select', {
+ data: data
+ });
+ }
+
+ params.term = params.term || '';
+
+ var tokenData = this.tokenizer(params, this.options, createAndSelect);
+
+ if (tokenData.term !== params.term) {
+ // Replace the search term if we have the search box
+ if (this.$search.length) {
+ this.$search.val(tokenData.term);
+ this.$search.focus();
+ }
+
+ params.term = tokenData.term;
+ }
+
+ decorated.call(this, params, callback);
+ };
+
+ Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
+ var separators = options.get('tokenSeparators') || [];
+ var term = params.term;
+ var i = 0;
+
+ var createTag = this.createTag || function (params) {
+ return {
+ id: params.term,
+ text: params.term
+ };
+ };
+
+ while (i < term.length) {
+ var termChar = term[i];
+
+ if ($.inArray(termChar, separators) === -1) {
+ i++;
+
+ continue;
+ }
+
+ var part = term.substr(0, i);
+ var partParams = $.extend({}, params, {
+ term: part
+ });
+
+ var data = createTag(partParams);
+
+ if (data == null) {
+ i++;
+ continue;
+ }
+
+ callback(data);
+
+ // Reset the term to not include the tokenized portion
+ term = term.substr(i + 1) || '';
+ i = 0;
+ }
+
+ return {
+ term: term
+ };
+ };
+
+ return Tokenizer;
+});
+
+S2.define('select2/data/minimumInputLength',[
+
+], function () {
+ function MinimumInputLength (decorated, $e, options) {
+ this.minimumInputLength = options.get('minimumInputLength');
+
+ decorated.call(this, $e, options);
+ }
+
+ MinimumInputLength.prototype.query = function (decorated, params, callback) {
+ params.term = params.term || '';
+
+ if (params.term.length < this.minimumInputLength) {
+ this.trigger('results:message', {
+ message: 'inputTooShort',
+ args: {
+ minimum: this.minimumInputLength,
+ input: params.term,
+ params: params
+ }
+ });
+
+ return;
+ }
+
+ decorated.call(this, params, callback);
+ };
+
+ return MinimumInputLength;
+});
+
+S2.define('select2/data/maximumInputLength',[
+
+], function () {
+ function MaximumInputLength (decorated, $e, options) {
+ this.maximumInputLength = options.get('maximumInputLength');
+
+ decorated.call(this, $e, options);
+ }
+
+ MaximumInputLength.prototype.query = function (decorated, params, callback) {
+ params.term = params.term || '';
+
+ if (this.maximumInputLength > 0 &&
+ params.term.length > this.maximumInputLength) {
+ this.trigger('results:message', {
+ message: 'inputTooLong',
+ args: {
+ maximum: this.maximumInputLength,
+ input: params.term,
+ params: params
+ }
+ });
+
+ return;
+ }
+
+ decorated.call(this, params, callback);
+ };
+
+ return MaximumInputLength;
+});
+
+S2.define('select2/data/maximumSelectionLength',[
+
+], function (){
+ function MaximumSelectionLength (decorated, $e, options) {
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
+
+ decorated.call(this, $e, options);
+ }
+
+ MaximumSelectionLength.prototype.query =
+ function (decorated, params, callback) {
+ var self = this;
+
+ this.current(function (currentData) {
+ var count = currentData != null ? currentData.length : 0;
+ if (self.maximumSelectionLength > 0 &&
+ count >= self.maximumSelectionLength) {
+ self.trigger('results:message', {
+ message: 'maximumSelected',
+ args: {
+ maximum: self.maximumSelectionLength
+ }
+ });
+ return;
+ }
+ decorated.call(self, params, callback);
+ });
+ };
+
+ return MaximumSelectionLength;
+});
+
+S2.define('select2/dropdown',[
+ 'jquery',
+ './utils'
+], function ($, Utils) {
+ function Dropdown ($element, options) {
+ this.$element = $element;
+ this.options = options;
+
+ Dropdown.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(Dropdown, Utils.Observable);
+
+ Dropdown.prototype.render = function () {
+ var $dropdown = $(
+ '' +
+ ' ' +
+ ' '
+ );
+
+ $dropdown.attr('dir', this.options.get('dir'));
+
+ this.$dropdown = $dropdown;
+
+ return $dropdown;
+ };
+
+ Dropdown.prototype.bind = function () {
+ // Should be implemented in subclasses
+ };
+
+ Dropdown.prototype.position = function ($dropdown, $container) {
+ // Should be implmented in subclasses
+ };
+
+ Dropdown.prototype.destroy = function () {
+ // Remove the dropdown from the DOM
+ this.$dropdown.remove();
+ };
+
+ return Dropdown;
+});
+
+S2.define('select2/dropdown/search',[
+ 'jquery',
+ '../utils'
+], function ($, Utils) {
+ function Search () { }
+
+ Search.prototype.render = function (decorated) {
+ var $rendered = decorated.call(this);
+
+ var $search = $(
+ '' +
+ ' ' +
+ ' '
+ );
+
+ this.$searchContainer = $search;
+ this.$search = $search.find('input');
+
+ $rendered.prepend($search);
+
+ return $rendered;
+ };
+
+ Search.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ this.$search.on('keydown', function (evt) {
+ self.trigger('keypress', evt);
+
+ self._keyUpPrevented = evt.isDefaultPrevented();
+ });
+
+ // Workaround for browsers which do not support the `input` event
+ // This will prevent double-triggering of events for browsers which support
+ // both the `keyup` and `input` events.
+ this.$search.on('input', function (evt) {
+ // Unbind the duplicated `keyup` event
+ $(this).off('keyup');
+ });
+
+ this.$search.on('keyup input', function (evt) {
+ self.handleSearch(evt);
+ });
+
+ container.on('open', function () {
+ self.$search.attr('tabindex', 0);
+
+ self.$search.focus();
+
+ window.setTimeout(function () {
+ self.$search.focus();
+ }, 0);
+ });
+
+ container.on('close', function () {
+ self.$search.attr('tabindex', -1);
+
+ self.$search.val('');
+ });
+
+ container.on('focus', function () {
+ if (container.isOpen()) {
+ self.$search.focus();
+ }
+ });
+
+ container.on('results:all', function (params) {
+ if (params.query.term == null || params.query.term === '') {
+ var showSearch = self.showSearch(params);
+
+ if (showSearch) {
+ self.$searchContainer.removeClass('select2-search--hide');
+ } else {
+ self.$searchContainer.addClass('select2-search--hide');
+ }
+ }
+ });
+ };
+
+ Search.prototype.handleSearch = function (evt) {
+ if (!this._keyUpPrevented) {
+ var input = this.$search.val();
+
+ this.trigger('query', {
+ term: input
+ });
+ }
+
+ this._keyUpPrevented = false;
+ };
+
+ Search.prototype.showSearch = function (_, params) {
+ return true;
+ };
+
+ return Search;
+});
+
+S2.define('select2/dropdown/hidePlaceholder',[
+
+], function () {
+ function HidePlaceholder (decorated, $element, options, dataAdapter) {
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
+
+ decorated.call(this, $element, options, dataAdapter);
+ }
+
+ HidePlaceholder.prototype.append = function (decorated, data) {
+ data.results = this.removePlaceholder(data.results);
+
+ decorated.call(this, data);
+ };
+
+ HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
+ if (typeof placeholder === 'string') {
+ placeholder = {
+ id: '',
+ text: placeholder
+ };
+ }
+
+ return placeholder;
+ };
+
+ HidePlaceholder.prototype.removePlaceholder = function (_, data) {
+ var modifiedData = data.slice(0);
+
+ for (var d = data.length - 1; d >= 0; d--) {
+ var item = data[d];
+
+ if (this.placeholder.id === item.id) {
+ modifiedData.splice(d, 1);
+ }
+ }
+
+ return modifiedData;
+ };
+
+ return HidePlaceholder;
+});
+
+S2.define('select2/dropdown/infiniteScroll',[
+ 'jquery'
+], function ($) {
+ function InfiniteScroll (decorated, $element, options, dataAdapter) {
+ this.lastParams = {};
+
+ decorated.call(this, $element, options, dataAdapter);
+
+ this.$loadingMore = this.createLoadingMore();
+ this.loading = false;
+ }
+
+ InfiniteScroll.prototype.append = function (decorated, data) {
+ this.$loadingMore.remove();
+ this.loading = false;
+
+ decorated.call(this, data);
+
+ if (this.showLoadingMore(data)) {
+ this.$results.append(this.$loadingMore);
+ }
+ };
+
+ InfiniteScroll.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('query', function (params) {
+ self.lastParams = params;
+ self.loading = true;
+ });
+
+ container.on('query:append', function (params) {
+ self.lastParams = params;
+ self.loading = true;
+ });
+
+ this.$results.on('scroll', function () {
+ var isLoadMoreVisible = $.contains(
+ document.documentElement,
+ self.$loadingMore[0]
+ );
+
+ if (self.loading || !isLoadMoreVisible) {
+ return;
+ }
+
+ var currentOffset = self.$results.offset().top +
+ self.$results.outerHeight(false);
+ var loadingMoreOffset = self.$loadingMore.offset().top +
+ self.$loadingMore.outerHeight(false);
+
+ if (currentOffset + 50 >= loadingMoreOffset) {
+ self.loadMore();
+ }
+ });
+ };
+
+ InfiniteScroll.prototype.loadMore = function () {
+ this.loading = true;
+
+ var params = $.extend({}, {page: 1}, this.lastParams);
+
+ params.page++;
+
+ this.trigger('query:append', params);
+ };
+
+ InfiniteScroll.prototype.showLoadingMore = function (_, data) {
+ return data.pagination && data.pagination.more;
+ };
+
+ InfiniteScroll.prototype.createLoadingMore = function () {
+ var $option = $(
+ ' '
+ );
+
+ var message = this.options.get('translations').get('loadingMore');
+
+ $option.html(message(this.lastParams));
+
+ return $option;
+ };
+
+ return InfiniteScroll;
+});
+
+S2.define('select2/dropdown/attachBody',[
+ 'jquery',
+ '../utils'
+], function ($, Utils) {
+ function AttachBody (decorated, $element, options) {
+ this.$dropdownParent = options.get('dropdownParent') || $(document.body);
+
+ decorated.call(this, $element, options);
+ }
+
+ AttachBody.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ var setupResultsEvents = false;
+
+ decorated.call(this, container, $container);
+
+ container.on('open', function () {
+ self._showDropdown();
+ self._attachPositioningHandler(container);
+
+ if (!setupResultsEvents) {
+ setupResultsEvents = true;
+
+ container.on('results:all', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ container.on('results:append', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+ }
+ });
+
+ container.on('close', function () {
+ self._hideDropdown();
+ self._detachPositioningHandler(container);
+ });
+
+ this.$dropdownContainer.on('mousedown', function (evt) {
+ evt.stopPropagation();
+ });
+ };
+
+ AttachBody.prototype.destroy = function (decorated) {
+ decorated.call(this);
+
+ this.$dropdownContainer.remove();
+ };
+
+ AttachBody.prototype.position = function (decorated, $dropdown, $container) {
+ // Clone all of the container classes
+ $dropdown.attr('class', $container.attr('class'));
+
+ $dropdown.removeClass('select2');
+ $dropdown.addClass('select2-container--open');
+
+ $dropdown.css({
+ position: 'absolute',
+ top: -999999
+ });
+
+ this.$container = $container;
+ };
+
+ AttachBody.prototype.render = function (decorated) {
+ var $container = $(' ');
+
+ var $dropdown = decorated.call(this);
+ $container.append($dropdown);
+
+ this.$dropdownContainer = $container;
+
+ return $container;
+ };
+
+ AttachBody.prototype._hideDropdown = function (decorated) {
+ this.$dropdownContainer.detach();
+ };
+
+ AttachBody.prototype._attachPositioningHandler =
+ function (decorated, container) {
+ var self = this;
+
+ var scrollEvent = 'scroll.select2.' + container.id;
+ var resizeEvent = 'resize.select2.' + container.id;
+ var orientationEvent = 'orientationchange.select2.' + container.id;
+
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
+ $watchers.each(function () {
+ $(this).data('select2-scroll-position', {
+ x: $(this).scrollLeft(),
+ y: $(this).scrollTop()
+ });
+ });
+
+ $watchers.on(scrollEvent, function (ev) {
+ var position = $(this).data('select2-scroll-position');
+ $(this).scrollTop(position.y);
+ });
+
+ $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
+ function (e) {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+ };
+
+ AttachBody.prototype._detachPositioningHandler =
+ function (decorated, container) {
+ var scrollEvent = 'scroll.select2.' + container.id;
+ var resizeEvent = 'resize.select2.' + container.id;
+ var orientationEvent = 'orientationchange.select2.' + container.id;
+
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
+ $watchers.off(scrollEvent);
+
+ $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
+ };
+
+ AttachBody.prototype._positionDropdown = function () {
+ var $window = $(window);
+
+ var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
+ var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
+
+ var newDirection = null;
+
+ var offset = this.$container.offset();
+
+ offset.bottom = offset.top + this.$container.outerHeight(false);
+
+ var container = {
+ height: this.$container.outerHeight(false)
+ };
+
+ container.top = offset.top;
+ container.bottom = offset.top + container.height;
+
+ var dropdown = {
+ height: this.$dropdown.outerHeight(false)
+ };
+
+ var viewport = {
+ top: $window.scrollTop(),
+ bottom: $window.scrollTop() + $window.height()
+ };
+
+ var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
+ var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
+
+ var css = {
+ left: offset.left,
+ top: container.bottom
+ };
+
+ // Determine what the parent element is to use for calciulating the offset
+ var $offsetParent = this.$dropdownParent;
+
+ // For statically positoned elements, we need to get the element
+ // that is determining the offset
+ if ($offsetParent.css('position') === 'static') {
+ $offsetParent = $offsetParent.offsetParent();
+ }
+
+ var parentOffset = $offsetParent.offset();
+
+ css.top -= parentOffset.top;
+ css.left -= parentOffset.left;
+
+ if (!isCurrentlyAbove && !isCurrentlyBelow) {
+ newDirection = 'below';
+ }
+
+ if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
+ newDirection = 'above';
+ } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
+ newDirection = 'below';
+ }
+
+ if (newDirection == 'above' ||
+ (isCurrentlyAbove && newDirection !== 'below')) {
+ css.top = container.top - parentOffset.top - dropdown.height;
+ }
+
+ if (newDirection != null) {
+ this.$dropdown
+ .removeClass('select2-dropdown--below select2-dropdown--above')
+ .addClass('select2-dropdown--' + newDirection);
+ this.$container
+ .removeClass('select2-container--below select2-container--above')
+ .addClass('select2-container--' + newDirection);
+ }
+
+ this.$dropdownContainer.css(css);
+ };
+
+ AttachBody.prototype._resizeDropdown = function () {
+ var css = {
+ width: this.$container.outerWidth(false) + 'px'
+ };
+
+ if (this.options.get('dropdownAutoWidth')) {
+ css.minWidth = css.width;
+ css.position = 'relative';
+ css.width = 'auto';
+ }
+
+ this.$dropdown.css(css);
+ };
+
+ AttachBody.prototype._showDropdown = function (decorated) {
+ this.$dropdownContainer.appendTo(this.$dropdownParent);
+
+ this._positionDropdown();
+ this._resizeDropdown();
+ };
+
+ return AttachBody;
+});
+
+S2.define('select2/dropdown/minimumResultsForSearch',[
+
+], function () {
+ function countResults (data) {
+ var count = 0;
+
+ for (var d = 0; d < data.length; d++) {
+ var item = data[d];
+
+ if (item.children) {
+ count += countResults(item.children);
+ } else {
+ count++;
+ }
+ }
+
+ return count;
+ }
+
+ function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
+ this.minimumResultsForSearch = options.get('minimumResultsForSearch');
+
+ if (this.minimumResultsForSearch < 0) {
+ this.minimumResultsForSearch = Infinity;
+ }
+
+ decorated.call(this, $element, options, dataAdapter);
+ }
+
+ MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
+ if (countResults(params.data.results) < this.minimumResultsForSearch) {
+ return false;
+ }
+
+ return decorated.call(this, params);
+ };
+
+ return MinimumResultsForSearch;
+});
+
+S2.define('select2/dropdown/selectOnClose',[
+
+], function () {
+ function SelectOnClose () { }
+
+ SelectOnClose.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('close', function (params) {
+ self._handleSelectOnClose(params);
+ });
+ };
+
+ SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
+ if (params && params.originalSelect2Event != null) {
+ var event = params.originalSelect2Event;
+
+ // Don't select an item if the close event was triggered from a select or
+ // unselect event
+ if (event._type === 'select' || event._type === 'unselect') {
+ return;
+ }
+ }
+
+ var $highlightedResults = this.getHighlightedResults();
+
+ // Only select highlighted results
+ if ($highlightedResults.length < 1) {
+ return;
+ }
+
+ var data = $highlightedResults.data('data');
+
+ // Don't re-select already selected resulte
+ if (
+ (data.element != null && data.element.selected) ||
+ (data.element == null && data.selected)
+ ) {
+ return;
+ }
+
+ this.trigger('select', {
+ data: data
+ });
+ };
+
+ return SelectOnClose;
+});
+
+S2.define('select2/dropdown/closeOnSelect',[
+
+], function () {
+ function CloseOnSelect () { }
+
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('select', function (evt) {
+ self._selectTriggered(evt);
+ });
+
+ container.on('unselect', function (evt) {
+ self._selectTriggered(evt);
+ });
+ };
+
+ CloseOnSelect.prototype._selectTriggered = function (_, evt) {
+ var originalEvent = evt.originalEvent;
+
+ // Don't close if the control key is being held
+ if (originalEvent && originalEvent.ctrlKey) {
+ return;
+ }
+
+ this.trigger('close', {
+ originalEvent: originalEvent,
+ originalSelect2Event: evt
+ });
+ };
+
+ return CloseOnSelect;
+});
+
+S2.define('select2/i18n/en',[],function () {
+ // English
+ return {
+ errorLoading: function () {
+ return 'The results could not be loaded.';
+ },
+ inputTooLong: function (args) {
+ var overChars = args.input.length - args.maximum;
+
+ var message = 'Please delete ' + overChars + ' character';
+
+ if (overChars != 1) {
+ message += 's';
+ }
+
+ return message;
+ },
+ inputTooShort: function (args) {
+ var remainingChars = args.minimum - args.input.length;
+
+ var message = 'Please enter ' + remainingChars + ' or more characters';
+
+ return message;
+ },
+ loadingMore: function () {
+ return 'Loading more results…';
+ },
+ maximumSelected: function (args) {
+ var message = 'You can only select ' + args.maximum + ' item';
+
+ if (args.maximum != 1) {
+ message += 's';
+ }
+
+ return message;
+ },
+ noResults: function () {
+ return 'No results found';
+ },
+ searching: function () {
+ return 'Searching…';
+ }
+ };
+});
+
+S2.define('select2/defaults',[
+ 'jquery',
+ 'require',
+
+ './results',
+
+ './selection/single',
+ './selection/multiple',
+ './selection/placeholder',
+ './selection/allowClear',
+ './selection/search',
+ './selection/eventRelay',
+
+ './utils',
+ './translation',
+ './diacritics',
+
+ './data/select',
+ './data/array',
+ './data/ajax',
+ './data/tags',
+ './data/tokenizer',
+ './data/minimumInputLength',
+ './data/maximumInputLength',
+ './data/maximumSelectionLength',
+
+ './dropdown',
+ './dropdown/search',
+ './dropdown/hidePlaceholder',
+ './dropdown/infiniteScroll',
+ './dropdown/attachBody',
+ './dropdown/minimumResultsForSearch',
+ './dropdown/selectOnClose',
+ './dropdown/closeOnSelect',
+
+ './i18n/en'
+], function ($, require,
+
+ ResultsList,
+
+ SingleSelection, MultipleSelection, Placeholder, AllowClear,
+ SelectionSearch, EventRelay,
+
+ Utils, Translation, DIACRITICS,
+
+ SelectData, ArrayData, AjaxData, Tags, Tokenizer,
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
+
+ Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
+
+ EnglishTranslation) {
+ function Defaults () {
+ this.reset();
+ }
+
+ Defaults.prototype.apply = function (options) {
+ options = $.extend(true, {}, this.defaults, options);
+
+ if (options.dataAdapter == null) {
+ if (options.ajax != null) {
+ options.dataAdapter = AjaxData;
+ } else if (options.data != null) {
+ options.dataAdapter = ArrayData;
+ } else {
+ options.dataAdapter = SelectData;
+ }
+
+ if (options.minimumInputLength > 0) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ MinimumInputLength
+ );
+ }
+
+ if (options.maximumInputLength > 0) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ MaximumInputLength
+ );
+ }
+
+ if (options.maximumSelectionLength > 0) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ MaximumSelectionLength
+ );
+ }
+
+ if (options.tags) {
+ options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
+ }
+
+ if (options.tokenSeparators != null || options.tokenizer != null) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ Tokenizer
+ );
+ }
+
+ if (options.query != null) {
+ var Query = require(options.amdBase + 'compat/query');
+
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ Query
+ );
+ }
+
+ if (options.initSelection != null) {
+ var InitSelection = require(options.amdBase + 'compat/initSelection');
+
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ InitSelection
+ );
+ }
+ }
+
+ if (options.resultsAdapter == null) {
+ options.resultsAdapter = ResultsList;
+
+ if (options.ajax != null) {
+ options.resultsAdapter = Utils.Decorate(
+ options.resultsAdapter,
+ InfiniteScroll
+ );
+ }
+
+ if (options.placeholder != null) {
+ options.resultsAdapter = Utils.Decorate(
+ options.resultsAdapter,
+ HidePlaceholder
+ );
+ }
+
+ if (options.selectOnClose) {
+ options.resultsAdapter = Utils.Decorate(
+ options.resultsAdapter,
+ SelectOnClose
+ );
+ }
+ }
+
+ if (options.dropdownAdapter == null) {
+ if (options.multiple) {
+ options.dropdownAdapter = Dropdown;
+ } else {
+ var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
+
+ options.dropdownAdapter = SearchableDropdown;
+ }
+
+ if (options.minimumResultsForSearch !== 0) {
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ MinimumResultsForSearch
+ );
+ }
+
+ if (options.closeOnSelect) {
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ CloseOnSelect
+ );
+ }
+
+ if (
+ options.dropdownCssClass != null ||
+ options.dropdownCss != null ||
+ options.adaptDropdownCssClass != null
+ ) {
+ var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
+
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ DropdownCSS
+ );
+ }
+
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ AttachBody
+ );
+ }
+
+ if (options.selectionAdapter == null) {
+ if (options.multiple) {
+ options.selectionAdapter = MultipleSelection;
+ } else {
+ options.selectionAdapter = SingleSelection;
+ }
+
+ // Add the placeholder mixin if a placeholder was specified
+ if (options.placeholder != null) {
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ Placeholder
+ );
+ }
+
+ if (options.allowClear) {
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ AllowClear
+ );
+ }
+
+ if (options.multiple) {
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ SelectionSearch
+ );
+ }
+
+ if (
+ options.containerCssClass != null ||
+ options.containerCss != null ||
+ options.adaptContainerCssClass != null
+ ) {
+ var ContainerCSS = require(options.amdBase + 'compat/containerCss');
+
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ ContainerCSS
+ );
+ }
+
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ EventRelay
+ );
+ }
+
+ if (typeof options.language === 'string') {
+ // Check if the language is specified with a region
+ if (options.language.indexOf('-') > 0) {
+ // Extract the region information if it is included
+ var languageParts = options.language.split('-');
+ var baseLanguage = languageParts[0];
+
+ options.language = [options.language, baseLanguage];
+ } else {
+ options.language = [options.language];
+ }
+ }
+
+ if ($.isArray(options.language)) {
+ var languages = new Translation();
+ options.language.push('en');
+
+ var languageNames = options.language;
+
+ for (var l = 0; l < languageNames.length; l++) {
+ var name = languageNames[l];
+ var language = {};
+
+ try {
+ // Try to load it with the original name
+ language = Translation.loadPath(name);
+ } catch (e) {
+ try {
+ // If we couldn't load it, check if it wasn't the full path
+ name = this.defaults.amdLanguageBase + name;
+ language = Translation.loadPath(name);
+ } catch (ex) {
+ // The translation could not be loaded at all. Sometimes this is
+ // because of a configuration problem, other times this can be
+ // because of how Select2 helps load all possible translation files.
+ if (options.debug && window.console && console.warn) {
+ console.warn(
+ 'Select2: The language file for "' + name + '" could not be ' +
+ 'automatically loaded. A fallback will be used instead.'
+ );
+ }
+
+ continue;
+ }
+ }
+
+ languages.extend(language);
+ }
+
+ options.translations = languages;
+ } else {
+ var baseTranslation = Translation.loadPath(
+ this.defaults.amdLanguageBase + 'en'
+ );
+ var customTranslation = new Translation(options.language);
+
+ customTranslation.extend(baseTranslation);
+
+ options.translations = customTranslation;
+ }
+
+ return options;
+ };
+
+ Defaults.prototype.reset = function () {
+ function stripDiacritics (text) {
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
+ function match(a) {
+ return DIACRITICS[a] || a;
+ }
+
+ return text.replace(/[^\u0000-\u007E]/g, match);
+ }
+
+ function matcher (params, data) {
+ // Always return the object if there is nothing to compare
+ if ($.trim(params.term) === '') {
+ return data;
+ }
+
+ // Do a recursive check for options with children
+ if (data.children && data.children.length > 0) {
+ // Clone the data object if there are children
+ // This is required as we modify the object to remove any non-matches
+ var match = $.extend(true, {}, data);
+
+ // Check each child of the option
+ for (var c = data.children.length - 1; c >= 0; c--) {
+ var child = data.children[c];
+
+ var matches = matcher(params, child);
+
+ // If there wasn't a match, remove the object in the array
+ if (matches == null) {
+ match.children.splice(c, 1);
+ }
+ }
+
+ // If any children matched, return the new object
+ if (match.children.length > 0) {
+ return match;
+ }
+
+ // If there were no matching children, check just the plain object
+ return matcher(params, match);
+ }
+
+ var original = stripDiacritics(data.text).toUpperCase();
+ var term = stripDiacritics(params.term).toUpperCase();
+
+ // Check if the text contains the term
+ if (original.indexOf(term) > -1) {
+ return data;
+ }
+
+ // If it doesn't contain the term, don't return anything
+ return null;
+ }
+
+ this.defaults = {
+ amdBase: './',
+ amdLanguageBase: './i18n/',
+ closeOnSelect: true,
+ debug: false,
+ dropdownAutoWidth: false,
+ escapeMarkup: Utils.escapeMarkup,
+ language: EnglishTranslation,
+ matcher: matcher,
+ minimumInputLength: 0,
+ maximumInputLength: 0,
+ maximumSelectionLength: 0,
+ minimumResultsForSearch: 0,
+ selectOnClose: false,
+ sorter: function (data) {
+ return data;
+ },
+ templateResult: function (result) {
+ return result.text;
+ },
+ templateSelection: function (selection) {
+ return selection.text;
+ },
+ theme: 'default',
+ width: 'resolve'
+ };
+ };
+
+ Defaults.prototype.set = function (key, value) {
+ var camelKey = $.camelCase(key);
+
+ var data = {};
+ data[camelKey] = value;
+
+ var convertedData = Utils._convertData(data);
+
+ $.extend(this.defaults, convertedData);
+ };
+
+ var defaults = new Defaults();
+
+ return defaults;
+});
+
+S2.define('select2/options',[
+ 'require',
+ 'jquery',
+ './defaults',
+ './utils'
+], function (require, $, Defaults, Utils) {
+ function Options (options, $element) {
+ this.options = options;
+
+ if ($element != null) {
+ this.fromElement($element);
+ }
+
+ this.options = Defaults.apply(this.options);
+
+ if ($element && $element.is('input')) {
+ var InputCompat = require(this.get('amdBase') + 'compat/inputData');
+
+ this.options.dataAdapter = Utils.Decorate(
+ this.options.dataAdapter,
+ InputCompat
+ );
+ }
+ }
+
+ Options.prototype.fromElement = function ($e) {
+ var excludedData = ['select2'];
+
+ if (this.options.multiple == null) {
+ this.options.multiple = $e.prop('multiple');
+ }
+
+ if (this.options.disabled == null) {
+ this.options.disabled = $e.prop('disabled');
+ }
+
+ if (this.options.language == null) {
+ if ($e.prop('lang')) {
+ this.options.language = $e.prop('lang').toLowerCase();
+ } else if ($e.closest('[lang]').prop('lang')) {
+ this.options.language = $e.closest('[lang]').prop('lang');
+ }
+ }
+
+ if (this.options.dir == null) {
+ if ($e.prop('dir')) {
+ this.options.dir = $e.prop('dir');
+ } else if ($e.closest('[dir]').prop('dir')) {
+ this.options.dir = $e.closest('[dir]').prop('dir');
+ } else {
+ this.options.dir = 'ltr';
+ }
+ }
+
+ $e.prop('disabled', this.options.disabled);
+ $e.prop('multiple', this.options.multiple);
+
+ if ($e.data('select2Tags')) {
+ if (this.options.debug && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `data-select2-tags` attribute has been changed to ' +
+ 'use the `data-data` and `data-tags="true"` attributes and will be ' +
+ 'removed in future versions of Select2.'
+ );
+ }
+
+ $e.data('data', $e.data('select2Tags'));
+ $e.data('tags', true);
+ }
+
+ if ($e.data('ajaxUrl')) {
+ if (this.options.debug && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `data-ajax-url` attribute has been changed to ' +
+ '`data-ajax--url` and support for the old attribute will be removed' +
+ ' in future versions of Select2.'
+ );
+ }
+
+ $e.attr('ajax--url', $e.data('ajaxUrl'));
+ $e.data('ajax--url', $e.data('ajaxUrl'));
+ }
+
+ var dataset = {};
+
+ // Prefer the element's `dataset` attribute if it exists
+ // jQuery 1.x does not correctly handle data attributes with multiple dashes
+ if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
+ dataset = $.extend(true, {}, $e[0].dataset, $e.data());
+ } else {
+ dataset = $e.data();
+ }
+
+ var data = $.extend(true, {}, dataset);
+
+ data = Utils._convertData(data);
+
+ for (var key in data) {
+ if ($.inArray(key, excludedData) > -1) {
+ continue;
+ }
+
+ if ($.isPlainObject(this.options[key])) {
+ $.extend(this.options[key], data[key]);
+ } else {
+ this.options[key] = data[key];
+ }
+ }
+
+ return this;
+ };
+
+ Options.prototype.get = function (key) {
+ return this.options[key];
+ };
+
+ Options.prototype.set = function (key, val) {
+ this.options[key] = val;
+ };
+
+ return Options;
+});
+
+S2.define('select2/core',[
+ 'jquery',
+ './options',
+ './utils',
+ './keys'
+], function ($, Options, Utils, KEYS) {
+ var Select2 = function ($element, options) {
+ if ($element.data('select2') != null) {
+ $element.data('select2').destroy();
+ }
+
+ this.$element = $element;
+
+ this.id = this._generateId($element);
+
+ options = options || {};
+
+ this.options = new Options(options, $element);
+
+ Select2.__super__.constructor.call(this);
+
+ // Set up the tabindex
+
+ var tabindex = $element.attr('tabindex') || 0;
+ $element.data('old-tabindex', tabindex);
+ $element.attr('tabindex', '-1');
+
+ // Set up containers and adapters
+
+ var DataAdapter = this.options.get('dataAdapter');
+ this.dataAdapter = new DataAdapter($element, this.options);
+
+ var $container = this.render();
+
+ this._placeContainer($container);
+
+ var SelectionAdapter = this.options.get('selectionAdapter');
+ this.selection = new SelectionAdapter($element, this.options);
+ this.$selection = this.selection.render();
+
+ this.selection.position(this.$selection, $container);
+
+ var DropdownAdapter = this.options.get('dropdownAdapter');
+ this.dropdown = new DropdownAdapter($element, this.options);
+ this.$dropdown = this.dropdown.render();
+
+ this.dropdown.position(this.$dropdown, $container);
+
+ var ResultsAdapter = this.options.get('resultsAdapter');
+ this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
+ this.$results = this.results.render();
+
+ this.results.position(this.$results, this.$dropdown);
+
+ // Bind events
+
+ var self = this;
+
+ // Bind the container to all of the adapters
+ this._bindAdapters();
+
+ // Register any DOM event handlers
+ this._registerDomEvents();
+
+ // Register any internal event handlers
+ this._registerDataEvents();
+ this._registerSelectionEvents();
+ this._registerDropdownEvents();
+ this._registerResultsEvents();
+ this._registerEvents();
+
+ // Set the initial state
+ this.dataAdapter.current(function (initialData) {
+ self.trigger('selection:update', {
+ data: initialData
+ });
+ });
+
+ // Hide the original select
+ $element.addClass('select2-hidden-accessible');
+ $element.attr('aria-hidden', 'true');
+
+ // Synchronize any monitored attributes
+ this._syncAttributes();
+
+ $element.data('select2', this);
+ };
+
+ Utils.Extend(Select2, Utils.Observable);
+
+ Select2.prototype._generateId = function ($element) {
+ var id = '';
+
+ if ($element.attr('id') != null) {
+ id = $element.attr('id');
+ } else if ($element.attr('name') != null) {
+ id = $element.attr('name') + '-' + Utils.generateChars(2);
+ } else {
+ id = Utils.generateChars(4);
+ }
+
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
+ id = 'select2-' + id;
+
+ return id;
+ };
+
+ Select2.prototype._placeContainer = function ($container) {
+ $container.insertAfter(this.$element);
+
+ var width = this._resolveWidth(this.$element, this.options.get('width'));
+
+ if (width != null) {
+ $container.css('width', width);
+ }
+ };
+
+ Select2.prototype._resolveWidth = function ($element, method) {
+ var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
+
+ if (method == 'resolve') {
+ var styleWidth = this._resolveWidth($element, 'style');
+
+ if (styleWidth != null) {
+ return styleWidth;
+ }
+
+ return this._resolveWidth($element, 'element');
+ }
+
+ if (method == 'element') {
+ var elementWidth = $element.outerWidth(false);
+
+ if (elementWidth <= 0) {
+ return 'auto';
+ }
+
+ return elementWidth + 'px';
+ }
+
+ if (method == 'style') {
+ var style = $element.attr('style');
+
+ if (typeof(style) !== 'string') {
+ return null;
+ }
+
+ var attrs = style.split(';');
+
+ for (var i = 0, l = attrs.length; i < l; i = i + 1) {
+ var attr = attrs[i].replace(/\s/g, '');
+ var matches = attr.match(WIDTH);
+
+ if (matches !== null && matches.length >= 1) {
+ return matches[1];
+ }
+ }
+
+ return null;
+ }
+
+ return method;
+ };
+
+ Select2.prototype._bindAdapters = function () {
+ this.dataAdapter.bind(this, this.$container);
+ this.selection.bind(this, this.$container);
+
+ this.dropdown.bind(this, this.$container);
+ this.results.bind(this, this.$container);
+ };
+
+ Select2.prototype._registerDomEvents = function () {
+ var self = this;
+
+ this.$element.on('change.select2', function () {
+ self.dataAdapter.current(function (data) {
+ self.trigger('selection:update', {
+ data: data
+ });
+ });
+ });
+
+ this.$element.on('focus.select2', function (evt) {
+ self.trigger('focus', evt);
+ });
+
+ this._syncA = Utils.bind(this._syncAttributes, this);
+ this._syncS = Utils.bind(this._syncSubtree, this);
+
+ if (this.$element[0].attachEvent) {
+ this.$element[0].attachEvent('onpropertychange', this._syncA);
+ }
+
+ var observer = window.MutationObserver ||
+ window.WebKitMutationObserver ||
+ window.MozMutationObserver
+ ;
+
+ if (observer != null) {
+ this._observer = new observer(function (mutations) {
+ $.each(mutations, self._syncA);
+ $.each(mutations, self._syncS);
+ });
+ this._observer.observe(this.$element[0], {
+ attributes: true,
+ childList: true,
+ subtree: false
+ });
+ } else if (this.$element[0].addEventListener) {
+ this.$element[0].addEventListener(
+ 'DOMAttrModified',
+ self._syncA,
+ false
+ );
+ this.$element[0].addEventListener(
+ 'DOMNodeInserted',
+ self._syncS,
+ false
+ );
+ this.$element[0].addEventListener(
+ 'DOMNodeRemoved',
+ self._syncS,
+ false
+ );
+ }
+ };
+
+ Select2.prototype._registerDataEvents = function () {
+ var self = this;
+
+ this.dataAdapter.on('*', function (name, params) {
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerSelectionEvents = function () {
+ var self = this;
+ var nonRelayEvents = ['toggle', 'focus'];
+
+ this.selection.on('toggle', function () {
+ self.toggleDropdown();
+ });
+
+ this.selection.on('focus', function (params) {
+ self.focus(params);
+ });
+
+ this.selection.on('*', function (name, params) {
+ if ($.inArray(name, nonRelayEvents) !== -1) {
+ return;
+ }
+
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerDropdownEvents = function () {
+ var self = this;
+
+ this.dropdown.on('*', function (name, params) {
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerResultsEvents = function () {
+ var self = this;
+
+ this.results.on('*', function (name, params) {
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerEvents = function () {
+ var self = this;
+
+ this.on('open', function () {
+ self.$container.addClass('select2-container--open');
+ });
+
+ this.on('close', function () {
+ self.$container.removeClass('select2-container--open');
+ });
+
+ this.on('enable', function () {
+ self.$container.removeClass('select2-container--disabled');
+ });
+
+ this.on('disable', function () {
+ self.$container.addClass('select2-container--disabled');
+ });
+
+ this.on('blur', function () {
+ self.$container.removeClass('select2-container--focus');
+ });
+
+ this.on('query', function (params) {
+ if (!self.isOpen()) {
+ self.trigger('open', {});
+ }
+
+ this.dataAdapter.query(params, function (data) {
+ self.trigger('results:all', {
+ data: data,
+ query: params
+ });
+ });
+ });
+
+ this.on('query:append', function (params) {
+ this.dataAdapter.query(params, function (data) {
+ self.trigger('results:append', {
+ data: data,
+ query: params
+ });
+ });
+ });
+
+ this.on('keypress', function (evt) {
+ var key = evt.which;
+
+ if (self.isOpen()) {
+ if (key === KEYS.ESC || key === KEYS.TAB ||
+ (key === KEYS.UP && evt.altKey)) {
+ self.close();
+
+ evt.preventDefault();
+ } else if (key === KEYS.ENTER) {
+ self.trigger('results:select', {});
+
+ evt.preventDefault();
+ } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
+ self.trigger('results:toggle', {});
+
+ evt.preventDefault();
+ } else if (key === KEYS.UP) {
+ self.trigger('results:previous', {});
+
+ evt.preventDefault();
+ } else if (key === KEYS.DOWN) {
+ self.trigger('results:next', {});
+
+ evt.preventDefault();
+ }
+ } else {
+ if (key === KEYS.ENTER || key === KEYS.SPACE ||
+ (key === KEYS.DOWN && evt.altKey)) {
+ self.open();
+
+ evt.preventDefault();
+ }
+ }
+ });
+ };
+
+ Select2.prototype._syncAttributes = function () {
+ this.options.set('disabled', this.$element.prop('disabled'));
+
+ if (this.options.get('disabled')) {
+ if (this.isOpen()) {
+ this.close();
+ }
+
+ this.trigger('disable', {});
+ } else {
+ this.trigger('enable', {});
+ }
+ };
+
+ Select2.prototype._syncSubtree = function (evt, mutations) {
+ var changed = false;
+ var self = this;
+
+ // Ignore any mutation events raised for elements that aren't options or
+ // optgroups. This handles the case when the select element is destroyed
+ if (
+ evt && evt.target && (
+ evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
+ )
+ ) {
+ return;
+ }
+
+ if (!mutations) {
+ // If mutation events aren't supported, then we can only assume that the
+ // change affected the selections
+ changed = true;
+ } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
+ for (var n = 0; n < mutations.addedNodes.length; n++) {
+ var node = mutations.addedNodes[n];
+
+ if (node.selected) {
+ changed = true;
+ }
+ }
+ } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
+ changed = true;
+ }
+
+ // Only re-pull the data if we think there is a change
+ if (changed) {
+ this.dataAdapter.current(function (currentData) {
+ self.trigger('selection:update', {
+ data: currentData
+ });
+ });
+ }
+ };
+
+ /**
+ * Override the trigger method to automatically trigger pre-events when
+ * there are events that can be prevented.
+ */
+ Select2.prototype.trigger = function (name, args) {
+ var actualTrigger = Select2.__super__.trigger;
+ var preTriggerMap = {
+ 'open': 'opening',
+ 'close': 'closing',
+ 'select': 'selecting',
+ 'unselect': 'unselecting'
+ };
+
+ if (args === undefined) {
+ args = {};
+ }
+
+ if (name in preTriggerMap) {
+ var preTriggerName = preTriggerMap[name];
+ var preTriggerArgs = {
+ prevented: false,
+ name: name,
+ args: args
+ };
+
+ actualTrigger.call(this, preTriggerName, preTriggerArgs);
+
+ if (preTriggerArgs.prevented) {
+ args.prevented = true;
+
+ return;
+ }
+ }
+
+ actualTrigger.call(this, name, args);
+ };
+
+ Select2.prototype.toggleDropdown = function () {
+ if (this.options.get('disabled')) {
+ return;
+ }
+
+ if (this.isOpen()) {
+ this.close();
+ } else {
+ this.open();
+ }
+ };
+
+ Select2.prototype.open = function () {
+ if (this.isOpen()) {
+ return;
+ }
+
+ this.trigger('query', {});
+ };
+
+ Select2.prototype.close = function () {
+ if (!this.isOpen()) {
+ return;
+ }
+
+ this.trigger('close', {});
+ };
+
+ Select2.prototype.isOpen = function () {
+ return this.$container.hasClass('select2-container--open');
+ };
+
+ Select2.prototype.hasFocus = function () {
+ return this.$container.hasClass('select2-container--focus');
+ };
+
+ Select2.prototype.focus = function (data) {
+ // No need to re-trigger focus events if we are already focused
+ if (this.hasFocus()) {
+ return;
+ }
+
+ this.$container.addClass('select2-container--focus');
+ this.trigger('focus', {});
+ };
+
+ Select2.prototype.enable = function (args) {
+ if (this.options.get('debug') && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `select2("enable")` method has been deprecated and will' +
+ ' be removed in later Select2 versions. Use $element.prop("disabled")' +
+ ' instead.'
+ );
+ }
+
+ if (args == null || args.length === 0) {
+ args = [true];
+ }
+
+ var disabled = !args[0];
+
+ this.$element.prop('disabled', disabled);
+ };
+
+ Select2.prototype.data = function () {
+ if (this.options.get('debug') &&
+ arguments.length > 0 && window.console && console.warn) {
+ console.warn(
+ 'Select2: Data can no longer be set using `select2("data")`. You ' +
+ 'should consider setting the value instead using `$element.val()`.'
+ );
+ }
+
+ var data = [];
+
+ this.dataAdapter.current(function (currentData) {
+ data = currentData;
+ });
+
+ return data;
+ };
+
+ Select2.prototype.val = function (args) {
+ if (this.options.get('debug') && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `select2("val")` method has been deprecated and will be' +
+ ' removed in later Select2 versions. Use $element.val() instead.'
+ );
+ }
+
+ if (args == null || args.length === 0) {
+ return this.$element.val();
+ }
+
+ var newVal = args[0];
+
+ if ($.isArray(newVal)) {
+ newVal = $.map(newVal, function (obj) {
+ return obj.toString();
+ });
+ }
+
+ this.$element.val(newVal).trigger('change');
+ };
+
+ Select2.prototype.destroy = function () {
+ this.$container.remove();
+
+ if (this.$element[0].detachEvent) {
+ this.$element[0].detachEvent('onpropertychange', this._syncA);
+ }
+
+ if (this._observer != null) {
+ this._observer.disconnect();
+ this._observer = null;
+ } else if (this.$element[0].removeEventListener) {
+ this.$element[0]
+ .removeEventListener('DOMAttrModified', this._syncA, false);
+ this.$element[0]
+ .removeEventListener('DOMNodeInserted', this._syncS, false);
+ this.$element[0]
+ .removeEventListener('DOMNodeRemoved', this._syncS, false);
+ }
+
+ this._syncA = null;
+ this._syncS = null;
+
+ this.$element.off('.select2');
+ this.$element.attr('tabindex', this.$element.data('old-tabindex'));
+
+ this.$element.removeClass('select2-hidden-accessible');
+ this.$element.attr('aria-hidden', 'false');
+ this.$element.removeData('select2');
+
+ this.dataAdapter.destroy();
+ this.selection.destroy();
+ this.dropdown.destroy();
+ this.results.destroy();
+
+ this.dataAdapter = null;
+ this.selection = null;
+ this.dropdown = null;
+ this.results = null;
+ };
+
+ Select2.prototype.render = function () {
+ var $container = $(
+ '' +
+ ' ' +
+ ' ' +
+ ' '
+ );
+
+ $container.attr('dir', this.options.get('dir'));
+
+ this.$container = $container;
+
+ this.$container.addClass('select2-container--' + this.options.get('theme'));
+
+ $container.data('element', this.$element);
+
+ return $container;
+ };
+
+ return Select2;
+});
+
+S2.define('jquery-mousewheel',[
+ 'jquery'
+], function ($) {
+ // Used to shim jQuery.mousewheel for non-full builds.
+ return $;
+});
+
+S2.define('jquery.select2',[
+ 'jquery',
+ 'jquery-mousewheel',
+
+ './select2/core',
+ './select2/defaults'
+], function ($, _, Select2, Defaults) {
+ if ($.fn.select2 == null) {
+ // All methods that should return the element
+ var thisMethods = ['open', 'close', 'destroy'];
+
+ $.fn.select2 = function (options) {
+ options = options || {};
+
+ if (typeof options === 'object') {
+ this.each(function () {
+ var instanceOptions = $.extend(true, {}, options);
+
+ var instance = new Select2($(this), instanceOptions);
+ });
+
+ return this;
+ } else if (typeof options === 'string') {
+ var ret;
+ var args = Array.prototype.slice.call(arguments, 1);
+
+ this.each(function () {
+ var instance = $(this).data('select2');
+
+ if (instance == null && window.console && console.error) {
+ console.error(
+ 'The select2(\'' + options + '\') method was called on an ' +
+ 'element that is not using Select2.'
+ );
+ }
+
+ ret = instance[options].apply(instance, args);
+ });
+
+ // Check if we should be returning `this`
+ if ($.inArray(options, thisMethods) > -1) {
+ return this;
+ }
+
+ return ret;
+ } else {
+ throw new Error('Invalid arguments for Select2: ' + options);
+ }
+ };
+ }
+
+ if ($.fn.select2.defaults == null) {
+ $.fn.select2.defaults = Defaults;
+ }
+
+ return Select2;
+});
+
+ // Return the AMD loader configuration so it can be used outside of this file
+ return {
+ define: S2.define,
+ require: S2.require
+ };
+}());
+
+ // Autoload the jQuery bindings
+ // We know that all of the modules exist above this, so we're safe
+ var select2 = S2.require('jquery.select2');
+
+ // Hold the AMD module references on the jQuery function that was just loaded
+ // This allows Select2 to use the internal loader outside of this file, such
+ // as in the language files.
+ jQuery.fn.select2.amd = S2;
+
+ // Return the Select2 instance for anyone who is importing it.
+ return select2;
+}));
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.min.css b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.min.css
new file mode 100644
index 0000000..76de04d
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.min.css
@@ -0,0 +1 @@
+.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;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !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__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.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-selection__placeholder,.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, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 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, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 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, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 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, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 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}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{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:#fff;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:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.min.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.min.js
new file mode 100644
index 0000000..43f0a65
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.min.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;hc;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a(' '),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a(' ');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(' '),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a(" ")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html(''),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('× ');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e0||0===c.length)){var d=a('× ');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a(' ');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");
+if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a(' ');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a(' ');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a(' '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(" "),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null;
+},e.prototype.render=function(){var b=a(' ');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.css b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.css
new file mode 100644
index 0000000..586a7f0
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.css
@@ -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; }
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js
new file mode 100644
index 0000000..3da2a08
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js
@@ -0,0 +1,2295 @@
+/*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
+* http://trentrichardson.com/examples/timepicker
+* Copyright (c) 2016 Trent Richardson; Licensed MIT */
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(['jquery', 'jquery-ui'], factory);
+ } else {
+ factory(jQuery);
+ }
+}(function ($) {
+
+ /*
+ * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
+ */
+ $.ui.timepicker = $.ui.timepicker || {};
+ if ($.ui.timepicker.version) {
+ return;
+ }
+
+ /*
+ * Extend jQueryUI, get it started with our version number
+ */
+ $.extend($.ui, {
+ timepicker: {
+ version: "1.6.3"
+ }
+ });
+
+ /*
+ * Timepicker manager.
+ * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
+ * Settings for (groups of) time pickers are maintained in an instance object,
+ * allowing multiple different settings on the same page.
+ */
+ var Timepicker = function () {
+ this.regional = []; // Available regional settings, indexed by language code
+ this.regional[''] = { // Default regional settings
+ currentText: 'Now',
+ closeText: 'Done',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ timeOnlyTitle: 'Choose Time',
+ timeText: 'Time',
+ hourText: 'Hour',
+ minuteText: 'Minute',
+ secondText: 'Second',
+ millisecText: 'Millisecond',
+ microsecText: 'Microsecond',
+ timezoneText: 'Time Zone',
+ isRTL: false
+ };
+ this._defaults = { // Global defaults for all the datetime picker instances
+ showButtonPanel: true,
+ timeOnly: false,
+ timeOnlyShowDate: false,
+ showHour: null,
+ showMinute: null,
+ showSecond: null,
+ showMillisec: null,
+ showMicrosec: null,
+ showTimezone: null,
+ showTime: true,
+ stepHour: 1,
+ stepMinute: 1,
+ stepSecond: 1,
+ stepMillisec: 1,
+ stepMicrosec: 1,
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ microsec: 0,
+ timezone: null,
+ hourMin: 0,
+ minuteMin: 0,
+ secondMin: 0,
+ millisecMin: 0,
+ microsecMin: 0,
+ hourMax: 23,
+ minuteMax: 59,
+ secondMax: 59,
+ millisecMax: 999,
+ microsecMax: 999,
+ minDateTime: null,
+ maxDateTime: null,
+ maxTime: null,
+ minTime: null,
+ onSelect: null,
+ hourGrid: 0,
+ minuteGrid: 0,
+ secondGrid: 0,
+ millisecGrid: 0,
+ microsecGrid: 0,
+ alwaysSetTime: true,
+ separator: ' ',
+ altFieldTimeOnly: true,
+ altTimeFormat: null,
+ altSeparator: null,
+ altTimeSuffix: null,
+ altRedirectFocus: true,
+ pickerTimeFormat: null,
+ pickerTimeSuffix: null,
+ showTimepicker: true,
+ timezoneList: null,
+ addSliderAccess: false,
+ sliderAccessArgs: null,
+ controlType: 'slider',
+ oneLine: false,
+ defaultValue: null,
+ parse: 'strict',
+ afterInject: null
+ };
+ $.extend(this._defaults, this.regional['']);
+ };
+
+ $.extend(Timepicker.prototype, {
+ $input: null,
+ $altInput: null,
+ $timeObj: null,
+ inst: null,
+ hour_slider: null,
+ minute_slider: null,
+ second_slider: null,
+ millisec_slider: null,
+ microsec_slider: null,
+ timezone_select: null,
+ maxTime: null,
+ minTime: null,
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ microsec: 0,
+ timezone: null,
+ hourMinOriginal: null,
+ minuteMinOriginal: null,
+ secondMinOriginal: null,
+ millisecMinOriginal: null,
+ microsecMinOriginal: null,
+ hourMaxOriginal: null,
+ minuteMaxOriginal: null,
+ secondMaxOriginal: null,
+ millisecMaxOriginal: null,
+ microsecMaxOriginal: null,
+ ampm: '',
+ formattedDate: '',
+ formattedTime: '',
+ formattedDateTime: '',
+ timezoneList: null,
+ units: ['hour', 'minute', 'second', 'millisec', 'microsec'],
+ support: {},
+ control: null,
+
+ /*
+ * Override the default settings for all instances of the time picker.
+ * @param {Object} settings object - the new settings to use as defaults (anonymous object)
+ * @return {Object} the manager object
+ */
+ setDefaults: function (settings) {
+ extendRemove(this._defaults, settings || {});
+ return this;
+ },
+
+ /*
+ * Create a new Timepicker instance
+ */
+ _newInst: function ($input, opts) {
+ var tp_inst = new Timepicker(),
+ inlineSettings = {},
+ fns = {},
+ overrides, i;
+
+ for (var attrName in this._defaults) {
+ if (this._defaults.hasOwnProperty(attrName)) {
+ var attrValue = $input.attr('time:' + attrName);
+ if (attrValue) {
+ try {
+ inlineSettings[attrName] = eval(attrValue);
+ } catch (err) {
+ inlineSettings[attrName] = attrValue;
+ }
+ }
+ }
+ }
+
+ overrides = {
+ beforeShow: function (input, dp_inst) {
+ if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
+ return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
+ }
+ },
+ onChangeMonthYear: function (year, month, dp_inst) {
+ // Update the time as well : this prevents the time from disappearing from the $input field.
+ // tp_inst._updateDateTime(dp_inst);
+ if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
+ tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
+ }
+ },
+ onClose: function (dateText, dp_inst) {
+ if (tp_inst.timeDefined === true && $input.val() !== '') {
+ tp_inst._updateDateTime(dp_inst);
+ }
+ if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
+ tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
+ }
+ }
+ };
+ for (i in overrides) {
+ if (overrides.hasOwnProperty(i)) {
+ fns[i] = opts[i] || this._defaults[i] || null;
+ }
+ }
+
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {
+ evnts: fns,
+ timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
+ });
+ tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) {
+ return val.toUpperCase();
+ });
+ tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) {
+ return val.toUpperCase();
+ });
+
+ // detect which units are supported
+ tp_inst.support = detectSupport(
+ tp_inst._defaults.timeFormat +
+ (tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') +
+ (tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : ''));
+
+ // controlType is string - key to our this._controls
+ if (typeof(tp_inst._defaults.controlType) === 'string') {
+ if (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') {
+ tp_inst._defaults.controlType = 'select';
+ }
+ tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
+ }
+ // controlType is an object and must implement create, options, value methods
+ else {
+ tp_inst.control = tp_inst._defaults.controlType;
+ }
+
+ // prep the timezone options
+ var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60,
+ 0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840];
+ if (tp_inst._defaults.timezoneList !== null) {
+ timezoneList = tp_inst._defaults.timezoneList;
+ }
+ var tzl = timezoneList.length, tzi = 0, tzv = null;
+ if (tzl > 0 && typeof timezoneList[0] !== 'object') {
+ for (; tzi < tzl; tzi++) {
+ tzv = timezoneList[tzi];
+ timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };
+ }
+ }
+ tp_inst._defaults.timezoneList = timezoneList;
+
+ // set the default units
+ tp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :
+ ((new Date()).getTimezoneOffset() * -1);
+ tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin :
+ tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
+ tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin :
+ tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
+ tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin :
+ tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second;
+ tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin :
+ tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
+ tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin :
+ tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;
+ tp_inst.ampm = '';
+ tp_inst.$input = $input;
+
+ if (tp_inst._defaults.altField) {
+ tp_inst.$altInput = $(tp_inst._defaults.altField);
+ if (tp_inst._defaults.altRedirectFocus === true) {
+ tp_inst.$altInput.css({
+ cursor: 'pointer'
+ }).focus(function () {
+ $input.trigger("focus");
+ });
+ }
+ }
+
+ if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
+ tp_inst._defaults.minDate = new Date();
+ }
+ if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
+ tp_inst._defaults.maxDate = new Date();
+ }
+
+ // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
+ if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
+ tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
+ }
+ if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
+ tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
+ }
+ if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
+ tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
+ }
+ if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
+ tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
+ }
+ tp_inst.$input.bind('focus', function () {
+ tp_inst._onFocus();
+ });
+
+ return tp_inst;
+ },
+
+ /*
+ * add our sliders to the calendar
+ */
+ _addTimePicker: function (dp_inst) {
+ var currDT = $.trim((this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val());
+
+ this.timeDefined = this._parseTime(currDT);
+ this._limitMinMaxDateTime(dp_inst, false);
+ this._injectTimePicker();
+ this._afterInject();
+ },
+
+ /*
+ * parse the time string from input value or _setTime
+ */
+ _parseTime: function (timeString, withDate) {
+ if (!this.inst) {
+ this.inst = $.datepicker._getInst(this.$input[0]);
+ }
+
+ if (withDate || !this._defaults.timeOnly) {
+ var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
+ try {
+ var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
+ if (!parseRes.timeObj) {
+ return false;
+ }
+ $.extend(this, parseRes.timeObj);
+ } catch (err) {
+ $.timepicker.log("Error parsing the date/time string: " + err +
+ "\ndate/time string = " + timeString +
+ "\ntimeFormat = " + this._defaults.timeFormat +
+ "\ndateFormat = " + dp_dateFormat);
+ return false;
+ }
+ return true;
+ } else {
+ var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
+ if (!timeObj) {
+ return false;
+ }
+ $.extend(this, timeObj);
+ return true;
+ }
+ },
+
+ /*
+ * Handle callback option after injecting timepicker
+ */
+ _afterInject: function() {
+ var o = this.inst.settings;
+ if ($.isFunction(o.afterInject)) {
+ o.afterInject.call(this);
+ }
+ },
+
+ /*
+ * generate and inject html for timepicker into ui datepicker
+ */
+ _injectTimePicker: function () {
+ var $dp = this.inst.dpDiv,
+ o = this.inst.settings,
+ tp_inst = this,
+ litem = '',
+ uitem = '',
+ show = null,
+ max = {},
+ gridSize = {},
+ size = null,
+ i = 0,
+ l = 0;
+
+ // Prevent displaying twice
+ if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
+ var noDisplay = ' ui_tpicker_unit_hide',
+ html = '';
+ var $tp = $(html);
+
+ // if we only want time picker...
+ if (o.timeOnly === true) {
+ $tp.prepend('');
+ $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
+ }
+
+ // add sliders, adjust grids, add events
+ for (i = 0, l = tp_inst.units.length; i < l; i++) {
+ litem = tp_inst.units[i];
+ uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
+ show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
+
+ // add the slider
+ tp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]);
+
+ // adjust the grid and add click event
+ if (show && o[litem + 'Grid'] > 0) {
+ size = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']);
+ $tp.find('.ui_tpicker_' + litem + ' table').css({
+ width: size + "%",
+ marginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + "%"),
+ marginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + "%") : '0',
+ borderCollapse: 'collapse'
+ }).find("td").click(function (e) {
+ var $t = $(this),
+ h = $t.html(),
+ n = parseInt(h.replace(/[^0-9]/g), 10),
+ ap = h.replace(/[^apm]/ig),
+ f = $t.data('for'); // loses scope, so we use data-for
+
+ if (f === 'hour') {
+ if (ap.indexOf('p') !== -1 && n < 12) {
+ n += 12;
+ }
+ else {
+ if (ap.indexOf('a') !== -1 && n === 12) {
+ n = 0;
+ }
+ }
+ }
+
+ tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n);
+
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ }).css({
+ cursor: 'pointer',
+ width: (100 / gridSize[litem]) + '%',
+ textAlign: 'center',
+ overflow: 'hidden'
+ });
+ } // end if grid > 0
+ } // end for loop
+
+ // Add timezone options
+ this.timezone_select = $tp.find('.ui_tpicker_timezone').append(' ').find("select");
+ $.fn.append.apply(this.timezone_select,
+ $.map(o.timezoneList, function (val, idx) {
+ return $(" ").val(typeof val === "object" ? val.value : val).text(typeof val === "object" ? val.label : val);
+ }));
+ if (typeof(this.timezone) !== "undefined" && this.timezone !== null && this.timezone !== "") {
+ var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset() * -1;
+ if (local_timezone === this.timezone) {
+ selectLocalTimezone(tp_inst);
+ } else {
+ this.timezone_select.val(this.timezone);
+ }
+ } else {
+ if (typeof(this.hour) !== "undefined" && this.hour !== null && this.hour !== "") {
+ this.timezone_select.val(o.timezone);
+ } else {
+ selectLocalTimezone(tp_inst);
+ }
+ }
+ this.timezone_select.change(function () {
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ tp_inst._afterInject();
+ });
+ // End timezone options
+
+ // inject timepicker into datepicker
+ var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
+ if ($buttonPanel.length) {
+ $buttonPanel.before($tp);
+ } else {
+ $dp.append($tp);
+ }
+
+ this.$timeObj = $tp.find('.ui_tpicker_time_input');
+ this.$timeObj.change(function () {
+ var timeFormat = tp_inst.inst.settings.timeFormat;
+ var parsedTime = $.datepicker.parseTime(timeFormat, this.value);
+ var update = new Date();
+ if (parsedTime) {
+ update.setHours(parsedTime.hour);
+ update.setMinutes(parsedTime.minute);
+ update.setSeconds(parsedTime.second);
+ $.datepicker._setTime(tp_inst.inst, update);
+ } else {
+ this.value = tp_inst.formattedTime;
+ this.blur();
+ }
+ });
+
+ if (this.inst !== null) {
+ var timeDefined = this.timeDefined;
+ this._onTimeChange();
+ this.timeDefined = timeDefined;
+ }
+
+ // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
+ if (this._defaults.addSliderAccess) {
+ var sliderAccessArgs = this._defaults.sliderAccessArgs,
+ rtl = this._defaults.isRTL;
+ sliderAccessArgs.isRTL = rtl;
+
+ setTimeout(function () { // fix for inline mode
+ if ($tp.find('.ui-slider-access').length === 0) {
+ $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
+
+ // fix any grids since sliders are shorter
+ var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
+ if (sliderAccessWidth) {
+ $tp.find('table:visible').each(function () {
+ var $g = $(this),
+ oldWidth = $g.outerWidth(),
+ oldMarginLeft = $g.css(rtl ? 'marginRight' : 'marginLeft').toString().replace('%', ''),
+ newWidth = oldWidth - sliderAccessWidth,
+ newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
+ css = { width: newWidth, marginRight: 0, marginLeft: 0 };
+ css[rtl ? 'marginRight' : 'marginLeft'] = newMarginLeft;
+ $g.css(css);
+ });
+ }
+ }
+ }, 10);
+ }
+ // end slideAccess integration
+
+ tp_inst._limitMinMaxDateTime(this.inst, true);
+ }
+ },
+
+ /*
+ * This function tries to limit the ability to go outside the
+ * min/max date range
+ */
+ _limitMinMaxDateTime: function (dp_inst, adjustSliders) {
+ var o = this._defaults,
+ dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
+
+ if (!this._defaults.showTimepicker) {
+ return;
+ } // No time so nothing to check here
+
+ if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
+ var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
+ minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
+
+ if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {
+ this.hourMinOriginal = o.hourMin;
+ this.minuteMinOriginal = o.minuteMin;
+ this.secondMinOriginal = o.secondMin;
+ this.millisecMinOriginal = o.millisecMin;
+ this.microsecMinOriginal = o.microsecMin;
+ }
+
+ if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() === dp_date.getTime()) {
+ this._defaults.hourMin = minDateTime.getHours();
+ if (this.hour <= this._defaults.hourMin) {
+ this.hour = this._defaults.hourMin;
+ this._defaults.minuteMin = minDateTime.getMinutes();
+ if (this.minute <= this._defaults.minuteMin) {
+ this.minute = this._defaults.minuteMin;
+ this._defaults.secondMin = minDateTime.getSeconds();
+ if (this.second <= this._defaults.secondMin) {
+ this.second = this._defaults.secondMin;
+ this._defaults.millisecMin = minDateTime.getMilliseconds();
+ if (this.millisec <= this._defaults.millisecMin) {
+ this.millisec = this._defaults.millisecMin;
+ this._defaults.microsecMin = minDateTime.getMicroseconds();
+ } else {
+ if (this.microsec < this._defaults.microsecMin) {
+ this.microsec = this._defaults.microsecMin;
+ }
+ this._defaults.microsecMin = this.microsecMinOriginal;
+ }
+ } else {
+ this._defaults.millisecMin = this.millisecMinOriginal;
+ this._defaults.microsecMin = this.microsecMinOriginal;
+ }
+ } else {
+ this._defaults.secondMin = this.secondMinOriginal;
+ this._defaults.millisecMin = this.millisecMinOriginal;
+ this._defaults.microsecMin = this.microsecMinOriginal;
+ }
+ } else {
+ this._defaults.minuteMin = this.minuteMinOriginal;
+ this._defaults.secondMin = this.secondMinOriginal;
+ this._defaults.millisecMin = this.millisecMinOriginal;
+ this._defaults.microsecMin = this.microsecMinOriginal;
+ }
+ } else {
+ this._defaults.hourMin = this.hourMinOriginal;
+ this._defaults.minuteMin = this.minuteMinOriginal;
+ this._defaults.secondMin = this.secondMinOriginal;
+ this._defaults.millisecMin = this.millisecMinOriginal;
+ this._defaults.microsecMin = this.microsecMinOriginal;
+ }
+ }
+
+ if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
+ var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
+ maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
+
+ if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {
+ this.hourMaxOriginal = o.hourMax;
+ this.minuteMaxOriginal = o.minuteMax;
+ this.secondMaxOriginal = o.secondMax;
+ this.millisecMaxOriginal = o.millisecMax;
+ this.microsecMaxOriginal = o.microsecMax;
+ }
+
+ if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() === dp_date.getTime()) {
+ this._defaults.hourMax = maxDateTime.getHours();
+ if (this.hour >= this._defaults.hourMax) {
+ this.hour = this._defaults.hourMax;
+ this._defaults.minuteMax = maxDateTime.getMinutes();
+ if (this.minute >= this._defaults.minuteMax) {
+ this.minute = this._defaults.minuteMax;
+ this._defaults.secondMax = maxDateTime.getSeconds();
+ if (this.second >= this._defaults.secondMax) {
+ this.second = this._defaults.secondMax;
+ this._defaults.millisecMax = maxDateTime.getMilliseconds();
+ if (this.millisec >= this._defaults.millisecMax) {
+ this.millisec = this._defaults.millisecMax;
+ this._defaults.microsecMax = maxDateTime.getMicroseconds();
+ } else {
+ if (this.microsec > this._defaults.microsecMax) {
+ this.microsec = this._defaults.microsecMax;
+ }
+ this._defaults.microsecMax = this.microsecMaxOriginal;
+ }
+ } else {
+ this._defaults.millisecMax = this.millisecMaxOriginal;
+ this._defaults.microsecMax = this.microsecMaxOriginal;
+ }
+ } else {
+ this._defaults.secondMax = this.secondMaxOriginal;
+ this._defaults.millisecMax = this.millisecMaxOriginal;
+ this._defaults.microsecMax = this.microsecMaxOriginal;
+ }
+ } else {
+ this._defaults.minuteMax = this.minuteMaxOriginal;
+ this._defaults.secondMax = this.secondMaxOriginal;
+ this._defaults.millisecMax = this.millisecMaxOriginal;
+ this._defaults.microsecMax = this.microsecMaxOriginal;
+ }
+ } else {
+ this._defaults.hourMax = this.hourMaxOriginal;
+ this._defaults.minuteMax = this.minuteMaxOriginal;
+ this._defaults.secondMax = this.secondMaxOriginal;
+ this._defaults.millisecMax = this.millisecMaxOriginal;
+ this._defaults.microsecMax = this.microsecMaxOriginal;
+ }
+ }
+
+ if (dp_inst.settings.minTime!==null) {
+ var tempMinTime=new Date("01/01/1970 " + dp_inst.settings.minTime);
+ if (this.hourtempMaxTime.getHours()) {
+ this.hour=this._defaults.hourMax=tempMaxTime.getHours();
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else if (this.hour===tempMaxTime.getHours() && this.minute>tempMaxTime.getMinutes()) {
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else {
+ if (this._defaults.hourMax>tempMaxTime.getHours()) {
+ this._defaults.hourMax=tempMaxTime.getHours();
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else if (this._defaults.hourMax===tempMaxTime.getHours()===this.hour && this._defaults.minuteMax>tempMaxTime.getMinutes()) {
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else {
+ this._defaults.minuteMax=59;
+ }
+ }
+ }
+
+ if (adjustSliders !== undefined && adjustSliders === true) {
+ var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
+ minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
+ secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
+ millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10),
+ microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);
+
+ if (this.hour_slider) {
+ this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax, step: this._defaults.stepHour });
+ this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
+ }
+ if (this.minute_slider) {
+ this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax, step: this._defaults.stepMinute });
+ this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
+ }
+ if (this.second_slider) {
+ this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax, step: this._defaults.stepSecond });
+ this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
+ }
+ if (this.millisec_slider) {
+ this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax, step: this._defaults.stepMillisec });
+ this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
+ }
+ if (this.microsec_slider) {
+ this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax, step: this._defaults.stepMicrosec });
+ this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));
+ }
+ }
+
+ },
+
+ /*
+ * when a slider moves, set the internal time...
+ * on time change is also called when the time is updated in the text field
+ */
+ _onTimeChange: function () {
+ if (!this._defaults.showTimepicker) {
+ return;
+ }
+ var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
+ minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
+ second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
+ millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
+ microsec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false,
+ timezone = (this.timezone_select) ? this.timezone_select.val() : false,
+ o = this._defaults,
+ pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
+ pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
+
+ if (typeof(hour) === 'object') {
+ hour = false;
+ }
+ if (typeof(minute) === 'object') {
+ minute = false;
+ }
+ if (typeof(second) === 'object') {
+ second = false;
+ }
+ if (typeof(millisec) === 'object') {
+ millisec = false;
+ }
+ if (typeof(microsec) === 'object') {
+ microsec = false;
+ }
+ if (typeof(timezone) === 'object') {
+ timezone = false;
+ }
+
+ if (hour !== false) {
+ hour = parseInt(hour, 10);
+ }
+ if (minute !== false) {
+ minute = parseInt(minute, 10);
+ }
+ if (second !== false) {
+ second = parseInt(second, 10);
+ }
+ if (millisec !== false) {
+ millisec = parseInt(millisec, 10);
+ }
+ if (microsec !== false) {
+ microsec = parseInt(microsec, 10);
+ }
+ if (timezone !== false) {
+ timezone = timezone.toString();
+ }
+
+ var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
+
+ // If the update was done in the input field, the input field should not be updated.
+ // If the update was done using the sliders, update the input field.
+ var hasChanged = (
+ hour !== parseInt(this.hour,10) || // sliders should all be numeric
+ minute !== parseInt(this.minute,10) ||
+ second !== parseInt(this.second,10) ||
+ millisec !== parseInt(this.millisec,10) ||
+ microsec !== parseInt(this.microsec,10) ||
+ (this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
+ (this.timezone !== null && timezone !== this.timezone.toString()) // could be numeric or "EST" format, so use toString()
+ );
+
+ if (hasChanged) {
+
+ if (hour !== false) {
+ this.hour = hour;
+ }
+ if (minute !== false) {
+ this.minute = minute;
+ }
+ if (second !== false) {
+ this.second = second;
+ }
+ if (millisec !== false) {
+ this.millisec = millisec;
+ }
+ if (microsec !== false) {
+ this.microsec = microsec;
+ }
+ if (timezone !== false) {
+ this.timezone = timezone;
+ }
+
+ if (!this.inst) {
+ this.inst = $.datepicker._getInst(this.$input[0]);
+ }
+
+ this._limitMinMaxDateTime(this.inst, true);
+ }
+ if (this.support.ampm) {
+ this.ampm = ampm;
+ }
+
+ // Updates the time within the timepicker
+ this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
+ if (this.$timeObj) {
+ if (pickerTimeFormat === o.timeFormat) {
+ this.$timeObj.val(this.formattedTime + pickerTimeSuffix);
+ }
+ else {
+ this.$timeObj.val($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
+ }
+ /*
+ // Input loses focus when typing with picker open
+ // https://github.com/trentrichardson/jQuery-Timepicker-Addon/issues/848
+ if (this.$timeObj[0].setSelectionRange) {
+ var sPos = this.$timeObj[0].selectionStart;
+ var ePos = this.$timeObj[0].selectionEnd;
+ this.$timeObj[0].setSelectionRange(sPos, ePos);
+ }
+ */
+ }
+
+ this.timeDefined = true;
+ if (hasChanged) {
+ this._updateDateTime();
+ //this.$input.focus(); // may automatically open the picker on setDate
+ }
+ },
+
+ /*
+ * call custom onSelect.
+ * bind to sliders slidestop, and grid click.
+ */
+ _onSelectHandler: function () {
+ var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
+ var inputEl = this.$input ? this.$input[0] : null;
+ if (onSelect && inputEl) {
+ onSelect.apply(inputEl, [this.formattedDateTime, this]);
+ }
+ },
+
+ /*
+ * update our input with the new date time..
+ */
+ _updateDateTime: function (dp_inst) {
+ dp_inst = this.inst || dp_inst;
+ var dtTmp = (dp_inst.currentYear > 0?
+ new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
+ new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
+ dt = $.datepicker._daylightSavingAdjust(dtTmp),
+ //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
+ //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)),
+ dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
+ formatCfg = $.datepicker._getFormatConfig(dp_inst),
+ timeAvailable = dt !== null && this.timeDefined;
+ this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
+ var formattedDateTime = this.formattedDate;
+
+ // if a slider was changed but datepicker doesn't have a value yet, set it
+ if (dp_inst.lastVal === "") {
+ dp_inst.currentYear = dp_inst.selectedYear;
+ dp_inst.currentMonth = dp_inst.selectedMonth;
+ dp_inst.currentDay = dp_inst.selectedDay;
+ }
+
+ /*
+ * remove following lines to force every changes in date picker to change the input value
+ * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
+ * If the user manually empty the value in the input field, the date picker will never change selected value.
+ */
+ //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
+ // return;
+ //}
+
+ if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
+ formattedDateTime = this.formattedTime;
+ } else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
+ formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
+ }
+
+ this.formattedDateTime = formattedDateTime;
+
+ if (!this._defaults.showTimepicker) {
+ this.$input.val(this.formattedDate);
+ } else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) {
+ this.$altInput.val(this.formattedTime);
+ this.$input.val(this.formattedDate);
+ } else if (this.$altInput) {
+ this.$input.val(formattedDateTime);
+ var altFormattedDateTime = '',
+ altSeparator = this._defaults.altSeparator !== null ? this._defaults.altSeparator : this._defaults.separator,
+ altTimeSuffix = this._defaults.altTimeSuffix !== null ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
+
+ if (!this._defaults.timeOnly) {
+ if (this._defaults.altFormat) {
+ altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
+ }
+ else {
+ altFormattedDateTime = this.formattedDate;
+ }
+
+ if (altFormattedDateTime) {
+ altFormattedDateTime += altSeparator;
+ }
+ }
+
+ if (this._defaults.altTimeFormat !== null) {
+ altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
+ }
+ else {
+ altFormattedDateTime += this.formattedTime + altTimeSuffix;
+ }
+ this.$altInput.val(altFormattedDateTime);
+ } else {
+ this.$input.val(formattedDateTime);
+ }
+
+ this.$input.trigger("change");
+ },
+
+ _onFocus: function () {
+ if (!this.$input.val() && this._defaults.defaultValue) {
+ this.$input.val(this._defaults.defaultValue);
+ var inst = $.datepicker._getInst(this.$input.get(0)),
+ tp_inst = $.datepicker._get(inst, 'timepicker');
+ if (tp_inst) {
+ if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
+ try {
+ $.datepicker._updateDatepicker(inst);
+ } catch (err) {
+ $.timepicker.log(err);
+ }
+ }
+ }
+ }
+ },
+
+ /*
+ * Small abstraction to control types
+ * We can add more, just be sure to follow the pattern: create, options, value
+ */
+ _controls: {
+ // slider methods
+ slider: {
+ create: function (tp_inst, obj, unit, val, min, max, step) {
+ var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
+ return obj.prop('slide', null).slider({
+ orientation: "horizontal",
+ value: rtl ? val * -1 : val,
+ min: rtl ? max * -1 : min,
+ max: rtl ? min * -1 : max,
+ step: step,
+ slide: function (event, ui) {
+ tp_inst.control.value(tp_inst, $(this), unit, rtl ? ui.value * -1 : ui.value);
+ tp_inst._onTimeChange();
+ },
+ stop: function (event, ui) {
+ tp_inst._onSelectHandler();
+ }
+ });
+ },
+ options: function (tp_inst, obj, unit, opts, val) {
+ if (tp_inst._defaults.isRTL) {
+ if (typeof(opts) === 'string') {
+ if (opts === 'min' || opts === 'max') {
+ if (val !== undefined) {
+ return obj.slider(opts, val * -1);
+ }
+ return Math.abs(obj.slider(opts));
+ }
+ return obj.slider(opts);
+ }
+ var min = opts.min,
+ max = opts.max;
+ opts.min = opts.max = null;
+ if (min !== undefined) {
+ opts.max = min * -1;
+ }
+ if (max !== undefined) {
+ opts.min = max * -1;
+ }
+ return obj.slider(opts);
+ }
+ if (typeof(opts) === 'string' && val !== undefined) {
+ return obj.slider(opts, val);
+ }
+ return obj.slider(opts);
+ },
+ value: function (tp_inst, obj, unit, val) {
+ if (tp_inst._defaults.isRTL) {
+ if (val !== undefined) {
+ return obj.slider('value', val * -1);
+ }
+ return Math.abs(obj.slider('value'));
+ }
+ if (val !== undefined) {
+ return obj.slider('value', val);
+ }
+ return obj.slider('value');
+ }
+ },
+ // select methods
+ select: {
+ create: function (tp_inst, obj, unit, val, min, max, step) {
+ var sel = '',
+ format = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat;
+
+ for (var i = min; i <= max; i += step) {
+ sel += '';
+ if (unit === 'hour') {
+ sel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig, '')), {hour: i}, tp_inst._defaults);
+ }
+ else if (unit === 'millisec' || unit === 'microsec' || i >= 10) { sel += i; }
+ else {sel += '0' + i.toString(); }
+ sel += ' ';
+ }
+ sel += ' ';
+
+ obj.children('select').remove();
+
+ $(sel).appendTo(obj).change(function (e) {
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ tp_inst._afterInject();
+ });
+
+ return obj;
+ },
+ options: function (tp_inst, obj, unit, opts, val) {
+ var o = {},
+ $t = obj.children('select');
+ if (typeof(opts) === 'string') {
+ if (val === undefined) {
+ return $t.data(opts);
+ }
+ o[opts] = val;
+ }
+ else { o = opts; }
+ return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min>=0 ? o.min : $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
+ },
+ value: function (tp_inst, obj, unit, val) {
+ var $t = obj.children('select');
+ if (val !== undefined) {
+ return $t.val(val);
+ }
+ return $t.val();
+ }
+ }
+ } // end _controls
+
+ });
+
+ $.fn.extend({
+ /*
+ * shorthand just to use timepicker.
+ */
+ timepicker: function (o) {
+ o = o || {};
+ var tmp_args = Array.prototype.slice.call(arguments);
+
+ if (typeof o === 'object') {
+ tmp_args[0] = $.extend(o, {
+ timeOnly: true
+ });
+ }
+
+ return $(this).each(function () {
+ $.fn.datetimepicker.apply($(this), tmp_args);
+ });
+ },
+
+ /*
+ * extend timepicker to datepicker
+ */
+ datetimepicker: function (o) {
+ o = o || {};
+ var tmp_args = arguments;
+
+ if (typeof(o) === 'string') {
+ if (o === 'getDate' || (o === 'option' && tmp_args.length === 2 && typeof (tmp_args[1]) === 'string')) {
+ return $.fn.datepicker.apply($(this[0]), tmp_args);
+ } else {
+ return this.each(function () {
+ var $t = $(this);
+ $t.datepicker.apply($t, tmp_args);
+ });
+ }
+ } else {
+ return this.each(function () {
+ var $t = $(this);
+ $t.datepicker($.timepicker._newInst($t, o)._defaults);
+ });
+ }
+ }
+ });
+
+ /*
+ * Public Utility to parse date and time
+ */
+ $.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
+ var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
+ if (parseRes.timeObj) {
+ var t = parseRes.timeObj;
+ parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
+ parseRes.date.setMicroseconds(t.microsec);
+ }
+
+ return parseRes.date;
+ };
+
+ /*
+ * Public utility to parse time
+ */
+ $.datepicker.parseTime = function (timeFormat, timeString, options) {
+ var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),
+ iso8601 = (timeFormat.replace(/\'.*?\'/g, '').indexOf('Z') !== -1);
+
+ // Strict parse requires the timeString to match the timeFormat exactly
+ var strictParse = function (f, s, o) {
+
+ // pattern for standard and localized AM/PM markers
+ var getPatternAmpm = function (amNames, pmNames) {
+ var markers = [];
+ if (amNames) {
+ $.merge(markers, amNames);
+ }
+ if (pmNames) {
+ $.merge(markers, pmNames);
+ }
+ markers = $.map(markers, function (val) {
+ return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
+ });
+ return '(' + markers.join('|') + ')?';
+ };
+
+ // figure out position of time elements.. cause js cant do named captures
+ var getFormatPositions = function (timeFormat) {
+ var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),
+ orders = {
+ h: -1,
+ m: -1,
+ s: -1,
+ l: -1,
+ c: -1,
+ t: -1,
+ z: -1
+ };
+
+ if (finds) {
+ for (var i = 0; i < finds.length; i++) {
+ if (orders[finds[i].toString().charAt(0)] === -1) {
+ orders[finds[i].toString().charAt(0)] = i + 1;
+ }
+ }
+ }
+ return orders;
+ };
+
+ var regstr = '^' + f.toString()
+ .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
+ var ml = match.length;
+ switch (match.charAt(0).toLowerCase()) {
+ case 'h':
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
+ case 'm':
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
+ case 's':
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
+ case 'l':
+ return '(\\d?\\d?\\d)';
+ case 'c':
+ return '(\\d?\\d?\\d)';
+ case 'z':
+ return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
+ case 't':
+ return getPatternAmpm(o.amNames, o.pmNames);
+ default: // literal escaped in quotes
+ return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
+ }
+ })
+ .replace(/\s/g, '\\s?') +
+ o.timeSuffix + '$',
+ order = getFormatPositions(f),
+ ampm = '',
+ treg;
+
+ treg = s.match(new RegExp(regstr, 'i'));
+
+ var resTime = {
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ microsec: 0
+ };
+
+ if (treg) {
+ if (order.t !== -1) {
+ if (treg[order.t] === undefined || treg[order.t].length === 0) {
+ ampm = '';
+ resTime.ampm = '';
+ } else {
+ ampm = $.inArray(treg[order.t].toUpperCase(), $.map(o.amNames, function (x,i) { return x.toUpperCase(); })) !== -1 ? 'AM' : 'PM';
+ resTime.ampm = o[ampm === 'AM' ? 'amNames' : 'pmNames'][0];
+ }
+ }
+
+ if (order.h !== -1) {
+ if (ampm === 'AM' && treg[order.h] === '12') {
+ resTime.hour = 0; // 12am = 0 hour
+ } else {
+ if (ampm === 'PM' && treg[order.h] !== '12') {
+ resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
+ } else {
+ resTime.hour = Number(treg[order.h]);
+ }
+ }
+ }
+
+ if (order.m !== -1) {
+ resTime.minute = Number(treg[order.m]);
+ }
+ if (order.s !== -1) {
+ resTime.second = Number(treg[order.s]);
+ }
+ if (order.l !== -1) {
+ resTime.millisec = Number(treg[order.l]);
+ }
+ if (order.c !== -1) {
+ resTime.microsec = Number(treg[order.c]);
+ }
+ if (order.z !== -1 && treg[order.z] !== undefined) {
+ resTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]);
+ }
+
+
+ return resTime;
+ }
+ return false;
+ };// end strictParse
+
+ // First try JS Date, if that fails, use strictParse
+ var looseParse = function (f, s, o) {
+ try {
+ var d = new Date('2012-01-01 ' + s);
+ if (isNaN(d.getTime())) {
+ d = new Date('2012-01-01T' + s);
+ if (isNaN(d.getTime())) {
+ d = new Date('01/01/2012 ' + s);
+ if (isNaN(d.getTime())) {
+ throw "Unable to parse time with native Date: " + s;
+ }
+ }
+ }
+
+ return {
+ hour: d.getHours(),
+ minute: d.getMinutes(),
+ second: d.getSeconds(),
+ millisec: d.getMilliseconds(),
+ microsec: d.getMicroseconds(),
+ timezone: d.getTimezoneOffset() * -1
+ };
+ }
+ catch (err) {
+ try {
+ return strictParse(f, s, o);
+ }
+ catch (err2) {
+ $.timepicker.log("Unable to parse \ntimeString: " + s + "\ntimeFormat: " + f);
+ }
+ }
+ return false;
+ }; // end looseParse
+
+ if (typeof o.parse === "function") {
+ return o.parse(timeFormat, timeString, o);
+ }
+ if (o.parse === 'loose') {
+ return looseParse(timeFormat, timeString, o);
+ }
+ return strictParse(timeFormat, timeString, o);
+ };
+
+ /**
+ * Public utility to format the time
+ * @param {string} format format of the time
+ * @param {Object} time Object not a Date for timezones
+ * @param {Object} [options] essentially the regional[].. amNames, pmNames, ampm
+ * @returns {string} the formatted time
+ */
+ $.datepicker.formatTime = function (format, time, options) {
+ options = options || {};
+ options = $.extend({}, $.timepicker._defaults, options);
+ time = $.extend({
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ microsec: 0,
+ timezone: null
+ }, time);
+
+ var tmptime = format,
+ ampmName = options.amNames[0],
+ hour = parseInt(time.hour, 10);
+
+ if (hour > 11) {
+ ampmName = options.pmNames[0];
+ }
+
+ tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
+ switch (match) {
+ case 'HH':
+ return ('0' + hour).slice(-2);
+ case 'H':
+ return hour;
+ case 'hh':
+ return ('0' + convert24to12(hour)).slice(-2);
+ case 'h':
+ return convert24to12(hour);
+ case 'mm':
+ return ('0' + time.minute).slice(-2);
+ case 'm':
+ return time.minute;
+ case 'ss':
+ return ('0' + time.second).slice(-2);
+ case 's':
+ return time.second;
+ case 'l':
+ return ('00' + time.millisec).slice(-3);
+ case 'c':
+ return ('00' + time.microsec).slice(-3);
+ case 'z':
+ return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, false);
+ case 'Z':
+ return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, true);
+ case 'T':
+ return ampmName.charAt(0).toUpperCase();
+ case 'TT':
+ return ampmName.toUpperCase();
+ case 't':
+ return ampmName.charAt(0).toLowerCase();
+ case 'tt':
+ return ampmName.toLowerCase();
+ default:
+ return match.replace(/'/g, "");
+ }
+ });
+
+ return tmptime;
+ };
+
+ /*
+ * the bad hack :/ override datepicker so it doesn't close on select
+ // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
+ */
+ $.datepicker._base_selectDate = $.datepicker._selectDate;
+ $.datepicker._selectDate = function (id, dateStr) {
+ var inst = this._getInst($(id)[0]),
+ tp_inst = this._get(inst, 'timepicker'),
+ was_inline;
+
+ if (tp_inst && inst.settings.showTimepicker) {
+ tp_inst._limitMinMaxDateTime(inst, true);
+ was_inline = inst.inline;
+ inst.inline = inst.stay_open = true;
+ //This way the onSelect handler called from calendarpicker get the full dateTime
+ this._base_selectDate(id, dateStr);
+ inst.inline = was_inline;
+ inst.stay_open = false;
+ this._notifyChange(inst);
+ this._updateDatepicker(inst);
+ } else {
+ this._base_selectDate(id, dateStr);
+ }
+ };
+
+ /*
+ * second bad hack :/ override datepicker so it triggers an event when changing the input field
+ * and does not redraw the datepicker on every selectDate event
+ */
+ $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
+ $.datepicker._updateDatepicker = function (inst) {
+
+ // don't popup the datepicker if there is another instance already opened
+ var input = inst.input[0];
+ if ($.datepicker._curInst && $.datepicker._curInst !== inst && $.datepicker._datepickerShowing && $.datepicker._lastInput !== input) {
+ return;
+ }
+
+ if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
+
+ this._base_updateDatepicker(inst);
+
+ // Reload the time control when changing something in the input text field.
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ tp_inst._addTimePicker(inst);
+ }
+ }
+ };
+
+ /*
+ * third bad hack :/ override datepicker so it allows spaces and colon in the input field
+ */
+ $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
+ $.datepicker._doKeyPress = function (event) {
+ var inst = $.datepicker._getInst(event.target),
+ tp_inst = $.datepicker._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ if ($.datepicker._get(inst, 'constrainInput')) {
+ var ampm = tp_inst.support.ampm,
+ tz = tp_inst._defaults.showTimezone !== null ? tp_inst._defaults.showTimezone : tp_inst.support.timezone,
+ dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
+ datetimeChars = tp_inst._defaults.timeFormat.toString()
+ .replace(/[hms]/g, '')
+ .replace(/TT/g, ampm ? 'APM' : '')
+ .replace(/Tt/g, ampm ? 'AaPpMm' : '')
+ .replace(/tT/g, ampm ? 'AaPpMm' : '')
+ .replace(/T/g, ampm ? 'AP' : '')
+ .replace(/tt/g, ampm ? 'apm' : '')
+ .replace(/t/g, ampm ? 'ap' : '') +
+ " " + tp_inst._defaults.separator +
+ tp_inst._defaults.timeSuffix +
+ (tz ? tp_inst._defaults.timezoneList.join('') : '') +
+ (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
+ dateChars,
+ chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
+ return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
+ }
+ }
+
+ return $.datepicker._base_doKeyPress(event);
+ };
+
+ /*
+ * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
+ * Update any alternate field to synchronise with the main field.
+ */
+ $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
+ $.datepicker._updateAlternate = function (inst) {
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ var altField = tp_inst._defaults.altField;
+ if (altField) { // update alternate field too
+ var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
+ date = this._getDate(inst),
+ formatCfg = $.datepicker._getFormatConfig(inst),
+ altFormattedDateTime = '',
+ altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
+ altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
+ altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
+
+ altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
+ if (!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null) {
+ if (tp_inst._defaults.altFormat) {
+ altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
+ }
+ else {
+ altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
+ }
+ }
+ $(altField).val( inst.input.val() ? altFormattedDateTime : "");
+ }
+ }
+ else {
+ $.datepicker._base_updateAlternate(inst);
+ }
+ };
+
+ /*
+ * Override key up event to sync manual input changes.
+ */
+ $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
+ $.datepicker._doKeyUp = function (event) {
+ var inst = $.datepicker._getInst(event.target),
+ tp_inst = $.datepicker._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
+ try {
+ $.datepicker._updateDatepicker(inst);
+ } catch (err) {
+ $.timepicker.log(err);
+ }
+ }
+ }
+
+ return $.datepicker._base_doKeyUp(event);
+ };
+
+ /*
+ * override "Today" button to also grab the time and set it to input field.
+ */
+ $.datepicker._base_gotoToday = $.datepicker._gotoToday;
+ $.datepicker._gotoToday = function (id) {
+ var inst = this._getInst($(id)[0]);
+ this._base_gotoToday(id);
+ var tp_inst = this._get(inst, 'timepicker');
+ if (!tp_inst) {
+ return;
+ }
+
+ var tzoffset = $.timepicker.timezoneOffsetNumber(tp_inst.timezone);
+ var now = new Date();
+ now.setMinutes(now.getMinutes() + now.getTimezoneOffset() + parseInt(tzoffset, 10));
+ this._setTime(inst, now);
+ this._setDate(inst, now);
+ tp_inst._onSelectHandler();
+ };
+
+ /*
+ * Disable & enable the Time in the datetimepicker
+ */
+ $.datepicker._disableTimepickerDatepicker = function (target) {
+ var inst = this._getInst(target);
+ if (!inst) {
+ return;
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
+ if (tp_inst) {
+ inst.settings.showTimepicker = false;
+ tp_inst._defaults.showTimepicker = false;
+ tp_inst._updateDateTime(inst);
+ }
+ };
+
+ $.datepicker._enableTimepickerDatepicker = function (target) {
+ var inst = this._getInst(target);
+ if (!inst) {
+ return;
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
+ if (tp_inst) {
+ inst.settings.showTimepicker = true;
+ tp_inst._defaults.showTimepicker = true;
+ tp_inst._addTimePicker(inst); // Could be disabled on page load
+ tp_inst._updateDateTime(inst);
+ }
+ };
+
+ /*
+ * Create our own set time function
+ */
+ $.datepicker._setTime = function (inst, date) {
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ var defaults = tp_inst._defaults;
+
+ // calling _setTime with no date sets time to defaults
+ tp_inst.hour = date ? date.getHours() : defaults.hour;
+ tp_inst.minute = date ? date.getMinutes() : defaults.minute;
+ tp_inst.second = date ? date.getSeconds() : defaults.second;
+ tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
+ tp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec;
+
+ //check if within min/max times..
+ tp_inst._limitMinMaxDateTime(inst, true);
+
+ tp_inst._onTimeChange();
+ tp_inst._updateDateTime(inst);
+ }
+ };
+
+ /*
+ * Create new public method to set only time, callable as $().datepicker('setTime', date)
+ */
+ $.datepicker._setTimeDatepicker = function (target, date, withDate) {
+ var inst = this._getInst(target);
+ if (!inst) {
+ return;
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ this._setDateFromField(inst);
+ var tp_date;
+ if (date) {
+ if (typeof date === "string") {
+ tp_inst._parseTime(date, withDate);
+ tp_date = new Date();
+ tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
+ tp_date.setMicroseconds(tp_inst.microsec);
+ } else {
+ tp_date = new Date(date.getTime());
+ tp_date.setMicroseconds(date.getMicroseconds());
+ }
+ if (tp_date.toString() === 'Invalid Date') {
+ tp_date = undefined;
+ }
+ this._setTime(inst, tp_date);
+ }
+ }
+
+ };
+
+ /*
+ * override setDate() to allow setting time too within Date object
+ */
+ $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
+ $.datepicker._setDateDatepicker = function (target, _date) {
+ var inst = this._getInst(target);
+ var date = _date;
+ if (!inst) {
+ return;
+ }
+
+ if (typeof(_date) === 'string') {
+ date = new Date(_date);
+ if (!date.getTime()) {
+ this._base_setDateDatepicker.apply(this, arguments);
+ date = $(target).datepicker('getDate');
+ }
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+ var tp_date;
+ if (date instanceof Date) {
+ tp_date = new Date(date.getTime());
+ tp_date.setMicroseconds(date.getMicroseconds());
+ } else {
+ tp_date = date;
+ }
+
+ // This is important if you are using the timezone option, javascript's Date
+ // object will only return the timezone offset for the current locale, so we
+ // adjust it accordingly. If not using timezone option this won't matter..
+ // If a timezone is different in tp, keep the timezone as is
+ if (tp_inst && tp_date) {
+ // look out for DST if tz wasn't specified
+ if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
+ tp_inst.timezone = tp_date.getTimezoneOffset() * -1;
+ }
+ date = $.timepicker.timezoneAdjust(date, $.timepicker.timezoneOffsetString(-date.getTimezoneOffset()), tp_inst.timezone);
+ tp_date = $.timepicker.timezoneAdjust(tp_date, $.timepicker.timezoneOffsetString(-tp_date.getTimezoneOffset()), tp_inst.timezone);
+ }
+
+ this._updateDatepicker(inst);
+ this._base_setDateDatepicker.apply(this, arguments);
+ this._setTimeDatepicker(target, tp_date, true);
+ };
+
+ /*
+ * override getDate() to allow getting time too within Date object
+ */
+ $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
+ $.datepicker._getDateDatepicker = function (target, noDefault) {
+ var inst = this._getInst(target);
+ if (!inst) {
+ return;
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ // if it hasn't yet been defined, grab from field
+ if (inst.lastVal === undefined) {
+ this._setDateFromField(inst, noDefault);
+ }
+
+ var date = this._getDate(inst);
+
+ var currDT = null;
+
+ if (tp_inst.$altInput && tp_inst._defaults.altFieldTimeOnly) {
+ currDT = tp_inst.$input.val() + ' ' + tp_inst.$altInput.val();
+ }
+ else if (tp_inst.$input.get(0).tagName !== 'INPUT' && tp_inst.$altInput) {
+ /**
+ * in case the datetimepicker has been applied to a non-input tag for inline UI,
+ * and the user has not configured the plugin to display only time in altInput,
+ * pick current date time from the altInput (and hope for the best, for now, until "ER1" is applied)
+ *
+ * @todo ER1. Since altInput can have a totally difference format, convert it to standard format by reading input format from "altFormat" and "altTimeFormat" option values
+ */
+ currDT = tp_inst.$altInput.val();
+ }
+ else {
+ currDT = tp_inst.$input.val();
+ }
+
+ if (date && tp_inst._parseTime(currDT, !inst.settings.timeOnly)) {
+ date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
+ date.setMicroseconds(tp_inst.microsec);
+
+ // This is important if you are using the timezone option, javascript's Date
+ // object will only return the timezone offset for the current locale, so we
+ // adjust it accordingly. If not using timezone option this won't matter..
+ if (tp_inst.timezone != null) {
+ // look out for DST if tz wasn't specified
+ if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
+ tp_inst.timezone = date.getTimezoneOffset() * -1;
+ }
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone, $.timepicker.timezoneOffsetString(-date.getTimezoneOffset()));
+ }
+ }
+ return date;
+ }
+ return this._base_getDateDatepicker(target, noDefault);
+ };
+
+ /*
+ * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
+ * An option in datapicker to ignore extra format characters would be nicer.
+ */
+ $.datepicker._base_parseDate = $.datepicker.parseDate;
+ $.datepicker.parseDate = function (format, value, settings) {
+ var date;
+ try {
+ date = this._base_parseDate(format, value, settings);
+ } catch (err) {
+ // Hack! The error message ends with a colon, a space, and
+ // the "extra" characters. We rely on that instead of
+ // attempting to perfectly reproduce the parsing algorithm.
+ if (err.indexOf(":") >= 0) {
+ date = this._base_parseDate(format, value.substring(0, value.length - (err.length - err.indexOf(':') - 2)), settings);
+ $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
+ } else {
+ throw err;
+ }
+ }
+ return date;
+ };
+
+ /*
+ * override formatDate to set date with time to the input
+ */
+ $.datepicker._base_formatDate = $.datepicker._formatDate;
+ $.datepicker._formatDate = function (inst, day, month, year) {
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ tp_inst._updateDateTime(inst);
+ return tp_inst.$input.val();
+ }
+ return this._base_formatDate(inst);
+ };
+
+ /*
+ * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
+ */
+ $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
+ $.datepicker._optionDatepicker = function (target, name, value) {
+ var inst = this._getInst(target),
+ name_clone;
+ if (!inst) {
+ return null;
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ var min = null,
+ max = null,
+ onselect = null,
+ overrides = tp_inst._defaults.evnts,
+ fns = {},
+ prop,
+ ret,
+ oldVal,
+ $target;
+ if (typeof name === 'string') { // if min/max was set with the string
+ if (name === 'minDate' || name === 'minDateTime') {
+ min = value;
+ } else if (name === 'maxDate' || name === 'maxDateTime') {
+ max = value;
+ } else if (name === 'onSelect') {
+ onselect = value;
+ } else if (overrides.hasOwnProperty(name)) {
+ if (typeof (value) === 'undefined') {
+ return overrides[name];
+ }
+ fns[name] = value;
+ name_clone = {}; //empty results in exiting function after overrides updated
+ }
+ } else if (typeof name === 'object') { //if min/max was set with the JSON
+ if (name.minDate) {
+ min = name.minDate;
+ } else if (name.minDateTime) {
+ min = name.minDateTime;
+ } else if (name.maxDate) {
+ max = name.maxDate;
+ } else if (name.maxDateTime) {
+ max = name.maxDateTime;
+ }
+ for (prop in overrides) {
+ if (overrides.hasOwnProperty(prop) && name[prop]) {
+ fns[prop] = name[prop];
+ }
+ }
+ }
+ for (prop in fns) {
+ if (fns.hasOwnProperty(prop)) {
+ overrides[prop] = fns[prop];
+ if (!name_clone) { name_clone = $.extend({}, name); }
+ delete name_clone[prop];
+ }
+ }
+ if (name_clone && isEmptyObject(name_clone)) { return; }
+ if (min) { //if min was set
+ if (min === 0) {
+ min = new Date();
+ } else {
+ min = new Date(min);
+ }
+ tp_inst._defaults.minDate = min;
+ tp_inst._defaults.minDateTime = min;
+ } else if (max) { //if max was set
+ if (max === 0) {
+ max = new Date();
+ } else {
+ max = new Date(max);
+ }
+ tp_inst._defaults.maxDate = max;
+ tp_inst._defaults.maxDateTime = max;
+ } else if (onselect) {
+ tp_inst._defaults.onSelect = onselect;
+ }
+
+ // Datepicker will override our date when we call _base_optionDatepicker when
+ // calling minDate/maxDate, so we will first grab the value, call
+ // _base_optionDatepicker, then set our value back.
+ if(min || max){
+ $target = $(target);
+ oldVal = $target.datetimepicker('getDate');
+ ret = this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
+ $target.datetimepicker('setDate', oldVal);
+ return ret;
+ }
+ }
+ if (value === undefined) {
+ return this._base_optionDatepicker.call($.datepicker, target, name);
+ }
+ return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
+ };
+
+ /*
+ * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
+ * it will return false for all objects
+ */
+ var isEmptyObject = function (obj) {
+ var prop;
+ for (prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ return false;
+ }
+ }
+ return true;
+ };
+
+ /*
+ * jQuery extend now ignores nulls!
+ */
+ var extendRemove = function (target, props) {
+ $.extend(target, props);
+ for (var name in props) {
+ if (props[name] === null || props[name] === undefined) {
+ target[name] = props[name];
+ }
+ }
+ return target;
+ };
+
+ /*
+ * Determine by the time format which units are supported
+ * Returns an object of booleans for each unit
+ */
+ var detectSupport = function (timeFormat) {
+ var tf = timeFormat.replace(/'.*?'/g, '').toLowerCase(), // removes literals
+ isIn = function (f, t) { // does the format contain the token?
+ return f.indexOf(t) !== -1 ? true : false;
+ };
+ return {
+ hour: isIn(tf, 'h'),
+ minute: isIn(tf, 'm'),
+ second: isIn(tf, 's'),
+ millisec: isIn(tf, 'l'),
+ microsec: isIn(tf, 'c'),
+ timezone: isIn(tf, 'z'),
+ ampm: isIn(tf, 't') && isIn(timeFormat, 'h'),
+ iso8601: isIn(timeFormat, 'Z')
+ };
+ };
+
+ /*
+ * Converts 24 hour format into 12 hour
+ * Returns 12 hour without leading 0
+ */
+ var convert24to12 = function (hour) {
+ hour %= 12;
+
+ if (hour === 0) {
+ hour = 12;
+ }
+
+ return String(hour);
+ };
+
+ var computeEffectiveSetting = function (settings, property) {
+ return settings && settings[property] ? settings[property] : $.timepicker._defaults[property];
+ };
+
+ /*
+ * Splits datetime string into date and time substrings.
+ * Throws exception when date can't be parsed
+ * Returns {dateString: dateString, timeString: timeString}
+ */
+ var splitDateTime = function (dateTimeString, timeSettings) {
+ // The idea is to get the number separator occurrences in datetime and the time format requested (since time has
+ // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
+ var separator = computeEffectiveSetting(timeSettings, 'separator'),
+ format = computeEffectiveSetting(timeSettings, 'timeFormat'),
+ timeParts = format.split(separator), // how many occurrences of separator may be in our format?
+ timePartsLen = timeParts.length,
+ allParts = dateTimeString.split(separator),
+ allPartsLen = allParts.length;
+
+ if (allPartsLen > 1) {
+ return {
+ dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator),
+ timeString: allParts.splice(0, timePartsLen).join(separator)
+ };
+ }
+
+ return {
+ dateString: dateTimeString,
+ timeString: ''
+ };
+ };
+
+ /*
+ * Internal function to parse datetime interval
+ * Returns: {date: Date, timeObj: Object}, where
+ * date - parsed date without time (type Date)
+ * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
+ */
+ var parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
+ var date,
+ parts,
+ parsedTime;
+
+ parts = splitDateTime(dateTimeString, timeSettings);
+ date = $.datepicker._base_parseDate(dateFormat, parts.dateString, dateSettings);
+
+ if (parts.timeString === '') {
+ return {
+ date: date
+ };
+ }
+
+ parsedTime = $.datepicker.parseTime(timeFormat, parts.timeString, timeSettings);
+
+ if (!parsedTime) {
+ throw 'Wrong time format';
+ }
+
+ return {
+ date: date,
+ timeObj: parsedTime
+ };
+ };
+
+ /*
+ * Internal function to set timezone_select to the local timezone
+ */
+ var selectLocalTimezone = function (tp_inst, date) {
+ if (tp_inst && tp_inst.timezone_select) {
+ var now = date || new Date();
+ tp_inst.timezone_select.val(-now.getTimezoneOffset());
+ }
+ };
+
+ /*
+ * Create a Singleton Instance
+ */
+ $.timepicker = new Timepicker();
+
+ /**
+ * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
+ * @param {number} tzMinutes if not a number, less than -720 (-1200), or greater than 840 (+1400) this value is returned
+ * @param {boolean} iso8601 if true formats in accordance to iso8601 "+12:45"
+ * @return {string}
+ */
+ $.timepicker.timezoneOffsetString = function (tzMinutes, iso8601) {
+ if (isNaN(tzMinutes) || tzMinutes > 840 || tzMinutes < -720) {
+ return tzMinutes;
+ }
+
+ var off = tzMinutes,
+ minutes = off % 60,
+ hours = (off - minutes) / 60,
+ iso = iso8601 ? ':' : '',
+ tz = (off >= 0 ? '+' : '-') + ('0' + Math.abs(hours)).slice(-2) + iso + ('0' + Math.abs(minutes)).slice(-2);
+
+ if (tz === '+00:00') {
+ return 'Z';
+ }
+ return tz;
+ };
+
+ /**
+ * Get the number in minutes that represents a timezone string
+ * @param {string} tzString formatted like "+0500", "-1245", "Z"
+ * @return {number} the offset minutes or the original string if it doesn't match expectations
+ */
+ $.timepicker.timezoneOffsetNumber = function (tzString) {
+ var normalized = tzString.toString().replace(':', ''); // excuse any iso8601, end up with "+1245"
+
+ if (normalized.toUpperCase() === 'Z') { // if iso8601 with Z, its 0 minute offset
+ return 0;
+ }
+
+ if (!/^(\-|\+)\d{4}$/.test(normalized)) { // possibly a user defined tz, so just give it back
+ return parseInt(tzString, 10);
+ }
+
+ return ((normalized.substr(0, 1) === '-' ? -1 : 1) * // plus or minus
+ ((parseInt(normalized.substr(1, 2), 10) * 60) + // hours (converted to minutes)
+ parseInt(normalized.substr(3, 2), 10))); // minutes
+ };
+
+ /**
+ * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)
+ * @param {Date} date
+ * @param {string} fromTimezone formatted like "+0500", "-1245"
+ * @param {string} toTimezone formatted like "+0500", "-1245"
+ * @return {Date}
+ */
+ $.timepicker.timezoneAdjust = function (date, fromTimezone, toTimezone) {
+ var fromTz = $.timepicker.timezoneOffsetNumber(fromTimezone);
+ var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
+ if (!isNaN(toTz)) {
+ date.setMinutes(date.getMinutes() + (-fromTz) - (-toTz));
+ }
+ return date;
+ };
+
+ /**
+ * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
+ * enforce date range limits.
+ * n.b. The input value must be correctly formatted (reformatting is not supported)
+ * @param {Element} startTime
+ * @param {Element} endTime
+ * @param {Object} options Options for the timepicker() call
+ * @return {jQuery}
+ */
+ $.timepicker.timeRange = function (startTime, endTime, options) {
+ return $.timepicker.handleRange('timepicker', startTime, endTime, options);
+ };
+
+ /**
+ * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
+ * enforce date range limits.
+ * @param {Element} startTime
+ * @param {Element} endTime
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
+ * @param {string} method Can be used to specify the type of picker to be added
+ * @return {jQuery}
+ */
+ $.timepicker.datetimeRange = function (startTime, endTime, options) {
+ $.timepicker.handleRange('datetimepicker', startTime, endTime, options);
+ };
+
+ /**
+ * Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to
+ * enforce date range limits.
+ * @param {Element} startTime
+ * @param {Element} endTime
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
+ * @return {jQuery}
+ */
+ $.timepicker.dateRange = function (startTime, endTime, options) {
+ $.timepicker.handleRange('datepicker', startTime, endTime, options);
+ };
+
+ /**
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
+ * enforce date range limits.
+ * @param {string} method Can be used to specify the type of picker to be added
+ * @param {Element} startTime
+ * @param {Element} endTime
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
+ * @return {jQuery}
+ */
+ $.timepicker.handleRange = function (method, startTime, endTime, options) {
+ options = $.extend({}, {
+ minInterval: 0, // min allowed interval in milliseconds
+ maxInterval: 0, // max allowed interval in milliseconds
+ start: {}, // options for start picker
+ end: {} // options for end picker
+ }, options);
+
+ // for the mean time this fixes an issue with calling getDate with timepicker()
+ var timeOnly = false;
+ if(method === 'timepicker'){
+ timeOnly = true;
+ method = 'datetimepicker';
+ }
+
+ function checkDates(changed, other) {
+ var startdt = startTime[method]('getDate'),
+ enddt = endTime[method]('getDate'),
+ changeddt = changed[method]('getDate');
+
+ if (startdt !== null) {
+ var minDate = new Date(startdt.getTime()),
+ maxDate = new Date(startdt.getTime());
+
+ minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
+ maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
+
+ if (options.minInterval > 0 && minDate > enddt) { // minInterval check
+ endTime[method]('setDate', minDate);
+ }
+ else if (options.maxInterval > 0 && maxDate < enddt) { // max interval check
+ endTime[method]('setDate', maxDate);
+ }
+ else if (startdt > enddt) {
+ other[method]('setDate', changeddt);
+ }
+ }
+ }
+
+ function selected(changed, other, option) {
+ if (!changed.val()) {
+ return;
+ }
+ var date = changed[method].call(changed, 'getDate');
+ if (date !== null && options.minInterval > 0) {
+ if (option === 'minDate') {
+ date.setMilliseconds(date.getMilliseconds() + options.minInterval);
+ }
+ if (option === 'maxDate') {
+ date.setMilliseconds(date.getMilliseconds() - options.minInterval);
+ }
+ }
+
+ if (date.getTime) {
+ other[method].call(other, 'option', option, date);
+ }
+ }
+
+ $.fn[method].call(startTime, $.extend({
+ timeOnly: timeOnly,
+ onClose: function (dateText, inst) {
+ checkDates($(this), endTime);
+ },
+ onSelect: function (selectedDateTime) {
+ selected($(this), endTime, 'minDate');
+ }
+ }, options, options.start));
+ $.fn[method].call(endTime, $.extend({
+ timeOnly: timeOnly,
+ onClose: function (dateText, inst) {
+ checkDates($(this), startTime);
+ },
+ onSelect: function (selectedDateTime) {
+ selected($(this), startTime, 'maxDate');
+ }
+ }, options, options.end));
+
+ checkDates(startTime, endTime);
+
+ selected(startTime, endTime, 'minDate');
+ selected(endTime, startTime, 'maxDate');
+
+ return $([startTime.get(0), endTime.get(0)]);
+ };
+
+ /**
+ * Log error or data to the console during error or debugging
+ * @param {Object} err pass any type object to log to the console during error or debugging
+ * @return {void}
+ */
+ $.timepicker.log = function () {
+ // Older IE (9, maybe 10) throw error on accessing `window.console.log.apply`, so check first.
+ if (window.console && window.console.log && window.console.log.apply) {
+ window.console.log.apply(window.console, Array.prototype.slice.call(arguments));
+ }
+ };
+
+ /*
+ * Add util object to allow access to private methods for testability.
+ */
+ $.timepicker._util = {
+ _extendRemove: extendRemove,
+ _isEmptyObject: isEmptyObject,
+ _convert24to12: convert24to12,
+ _detectSupport: detectSupport,
+ _selectLocalTimezone: selectLocalTimezone,
+ _computeEffectiveSetting: computeEffectiveSetting,
+ _splitDateTime: splitDateTime,
+ _parseDateTimeInternal: parseDateTimeInternal
+ };
+
+ /*
+ * Microsecond support
+ */
+ if (!Date.prototype.getMicroseconds) {
+ Date.prototype.microseconds = 0;
+ Date.prototype.getMicroseconds = function () { return this.microseconds; };
+ Date.prototype.setMicroseconds = function (m) {
+ this.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000));
+ this.microseconds = m % 1000;
+ return this;
+ };
+ }
+
+ /*
+ * Keep up with the version
+ */
+ $.timepicker.version = "1.6.3";
+
+}));
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.min.css b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.min.css
new file mode 100644
index 0000000..7581fea
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.min.css
@@ -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}
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.min.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.min.js
new file mode 100644
index 0000000..e4423ce
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.min.js
@@ -0,0 +1,2 @@
+!function(e){"function"==typeof define&&define.amd?define(["jquery","jquery-ui"],e):e(jQuery)}(function($){if($.ui.timepicker=$.ui.timepicker||{},!$.ui.timepicker.version){$.extend($.ui,{timepicker:{version:"1.6.3"}});var Timepicker=function(){this.regional=[],this.regional[""]={currentText:"Now",closeText:"Done",amNames:["AM","A"],pmNames:["PM","P"],timeFormat:"HH:mm",timeSuffix:"",timeOnlyTitle:"Choose Time",timeText:"Time",hourText:"Hour",minuteText:"Minute",secondText:"Second",millisecText:"Millisecond",microsecText:"Microsecond",timezoneText:"Time Zone",isRTL:!1},this._defaults={showButtonPanel:!0,timeOnly:!1,timeOnlyShowDate:!1,showHour:null,showMinute:null,showSecond:null,showMillisec:null,showMicrosec:null,showTimezone:null,showTime:!0,stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,stepMicrosec:1,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMin:0,minuteMin:0,secondMin:0,millisecMin:0,microsecMin:0,hourMax:23,minuteMax:59,secondMax:59,millisecMax:999,microsecMax:999,minDateTime:null,maxDateTime:null,maxTime:null,minTime:null,onSelect:null,hourGrid:0,minuteGrid:0,secondGrid:0,millisecGrid:0,microsecGrid:0,alwaysSetTime:!0,separator:" ",altFieldTimeOnly:!0,altTimeFormat:null,altSeparator:null,altTimeSuffix:null,altRedirectFocus:!0,pickerTimeFormat:null,pickerTimeSuffix:null,showTimepicker:!0,timezoneList:null,addSliderAccess:!1,sliderAccessArgs:null,controlType:"slider",oneLine:!1,defaultValue:null,parse:"strict",afterInject:null},$.extend(this._defaults,this.regional[""])};$.extend(Timepicker.prototype,{$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,millisec_slider:null,microsec_slider:null,timezone_select:null,maxTime:null,minTime:null,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,millisecMinOriginal:null,microsecMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,millisecMaxOriginal:null,microsecMaxOriginal:null,ampm:"",formattedDate:"",formattedTime:"",formattedDateTime:"",timezoneList:null,units:["hour","minute","second","millisec","microsec"],support:{},control:null,setDefaults:function(e){return extendRemove(this._defaults,e||{}),this},_newInst:function($input,opts){var tp_inst=new Timepicker,inlineSettings={},fns={},overrides,i;for(var attrName in this._defaults)if(this._defaults.hasOwnProperty(attrName)){var attrValue=$input.attr("time:"+attrName);if(attrValue)try{inlineSettings[attrName]=eval(attrValue)}catch(e){inlineSettings[attrName]=attrValue}}overrides={beforeShow:function(e,t){if($.isFunction(tp_inst._defaults.evnts.beforeShow))return tp_inst._defaults.evnts.beforeShow.call($input[0],e,t,tp_inst)},onChangeMonthYear:function(e,t,i){$.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)&&tp_inst._defaults.evnts.onChangeMonthYear.call($input[0],e,t,i,tp_inst)},onClose:function(e,t){tp_inst.timeDefined===!0&&""!==$input.val()&&tp_inst._updateDateTime(t),$.isFunction(tp_inst._defaults.evnts.onClose)&&tp_inst._defaults.evnts.onClose.call($input[0],e,t,tp_inst)}};for(i in overrides)overrides.hasOwnProperty(i)&&(fns[i]=opts[i]||this._defaults[i]||null);tp_inst._defaults=$.extend({},this._defaults,inlineSettings,opts,overrides,{evnts:fns,timepicker:tp_inst}),tp_inst.amNames=$.map(tp_inst._defaults.amNames,function(e){return e.toUpperCase()}),tp_inst.pmNames=$.map(tp_inst._defaults.pmNames,function(e){return e.toUpperCase()}),tp_inst.support=detectSupport(tp_inst._defaults.timeFormat+(tp_inst._defaults.pickerTimeFormat?tp_inst._defaults.pickerTimeFormat:"")+(tp_inst._defaults.altTimeFormat?tp_inst._defaults.altTimeFormat:"")),"string"==typeof tp_inst._defaults.controlType?("slider"===tp_inst._defaults.controlType&&"undefined"==typeof $.ui.slider&&(tp_inst._defaults.controlType="select"),tp_inst.control=tp_inst._controls[tp_inst._defaults.controlType]):tp_inst.control=tp_inst._defaults.controlType;var timezoneList=[-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];null!==tp_inst._defaults.timezoneList&&(timezoneList=tp_inst._defaults.timezoneList);var tzl=timezoneList.length,tzi=0,tzv=null;if(tzl>0&&"object"!=typeof timezoneList[0])for(;tzitp_inst._defaults.hourMax?tp_inst._defaults.hourMax:tp_inst._defaults.hour,tp_inst.minute=tp_inst._defaults.minutetp_inst._defaults.minuteMax?tp_inst._defaults.minuteMax:tp_inst._defaults.minute,tp_inst.second=tp_inst._defaults.secondtp_inst._defaults.secondMax?tp_inst._defaults.secondMax:tp_inst._defaults.second,tp_inst.millisec=tp_inst._defaults.millisectp_inst._defaults.millisecMax?tp_inst._defaults.millisecMax:tp_inst._defaults.millisec,tp_inst.microsec=tp_inst._defaults.microsectp_inst._defaults.microsecMax?tp_inst._defaults.microsecMax:tp_inst._defaults.microsec,tp_inst.ampm="",tp_inst.$input=$input,tp_inst._defaults.altField&&(tp_inst.$altInput=$(tp_inst._defaults.altField),tp_inst._defaults.altRedirectFocus===!0&&tp_inst.$altInput.css({cursor:"pointer"}).focus(function(){$input.trigger("focus")})),0!==tp_inst._defaults.minDate&&0!==tp_inst._defaults.minDateTime||(tp_inst._defaults.minDate=new Date),0!==tp_inst._defaults.maxDate&&0!==tp_inst._defaults.maxDateTime||(tp_inst._defaults.maxDate=new Date),void 0!==tp_inst._defaults.minDate&&tp_inst._defaults.minDate instanceof Date&&(tp_inst._defaults.minDateTime=new Date(tp_inst._defaults.minDate.getTime())),void 0!==tp_inst._defaults.minDateTime&&tp_inst._defaults.minDateTime instanceof Date&&(tp_inst._defaults.minDate=new Date(tp_inst._defaults.minDateTime.getTime())),void 0!==tp_inst._defaults.maxDate&&tp_inst._defaults.maxDate instanceof Date&&(tp_inst._defaults.maxDateTime=new Date(tp_inst._defaults.maxDate.getTime())),void 0!==tp_inst._defaults.maxDateTime&&tp_inst._defaults.maxDateTime instanceof Date&&(tp_inst._defaults.maxDate=new Date(tp_inst._defaults.maxDateTime.getTime())),tp_inst.$input.bind("focus",function(){tp_inst._onFocus()}),tp_inst},_addTimePicker:function(e){var t=$.trim(this.$altInput&&this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val());this.timeDefined=this._parseTime(t),this._limitMinMaxDateTime(e,!1),this._injectTimePicker(),this._afterInject()},_parseTime:function(e,t){if(this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),t||!this._defaults.timeOnly){var i=$.datepicker._get(this.inst,"dateFormat");try{var s=parseDateTimeInternal(i,this._defaults.timeFormat,e,$.datepicker._getFormatConfig(this.inst),this._defaults);if(!s.timeObj)return!1;$.extend(this,s.timeObj)}catch(t){return $.timepicker.log("Error parsing the date/time string: "+t+"\ndate/time string = "+e+"\ntimeFormat = "+this._defaults.timeFormat+"\ndateFormat = "+i),!1}return!0}var n=$.datepicker.parseTime(this._defaults.timeFormat,e,this._defaults);return!!n&&($.extend(this,n),!0)},_afterInject:function(){var e=this.inst.settings;$.isFunction(e.afterInject)&&e.afterInject.call(this)},_injectTimePicker:function(){var e=this.inst.dpDiv,t=this.inst.settings,i=this,s="",n="",a=null,r={},l={},o=null,u=0,c=0;if(0===e.find("div.ui-timepicker-div").length&&t.showTimepicker){var m=" ui_tpicker_unit_hide",d=''+t.timeText+' ";for(u=0,c=this.units.length;u'+t[s+"Text"]+'
',a&&t[s+"Grid"]>0){if(d+='',"hour"===s)for(var p=t[s+"Min"];p<=r[s];p+=parseInt(t[s+"Grid"],10)){l[s]++;var h=$.datepicker.formatTime(this.support.ampm?"hht":"HH",{hour:p},t);d+=''+h+" "}else for(var f=t[s+"Min"];f<=r[s];f+=parseInt(t[s+"Grid"],10))l[s]++,d+=''+(f<10?"0":"")+f+" ";d+="
"}d+=" "}var _=null!==t.showTimezone?t.showTimezone:this.support.timezone;d+=''+t.timezoneText+" ",d+=' ',d+=" ";var g=$(d);for(t.timeOnly===!0&&(g.prepend('"),e.find(".ui-datepicker-header, .ui-datepicker-calendar").hide()),u=0,c=i.units.length;u0&&(o=100*l[s]*t[s+"Grid"]/(r[s]-t[s+"Min"]),g.find(".ui_tpicker_"+s+" table").css({width:o+"%",marginLeft:t.isRTL?"0":o/(-2*l[s])+"%",marginRight:t.isRTL?o/(-2*l[s])+"%":"0",borderCollapse:"collapse"}).find("td").click(function(e){var t=$(this),n=t.html(),a=parseInt(n.replace(/[^0-9]/g),10),r=n.replace(/[^apm]/gi),l=t.data("for");"hour"===l&&(r.indexOf("p")!==-1&&a<12?a+=12:r.indexOf("a")!==-1&&12===a&&(a=0)),i.control.value(i,i[l+"_slider"],s,a),i._onTimeChange(),i._onSelectHandler()}).css({cursor:"pointer",width:100/l[s]+"%",textAlign:"center",overflow:"hidden"}));if(this.timezone_select=g.find(".ui_tpicker_timezone").append(" ").find("select"),$.fn.append.apply(this.timezone_select,$.map(t.timezoneList,function(e,t){return $(" ").val("object"==typeof e?e.value:e).text("object"==typeof e?e.label:e)})),"undefined"!=typeof this.timezone&&null!==this.timezone&&""!==this.timezone){var M=new Date(this.inst.selectedYear,this.inst.selectedMonth,this.inst.selectedDay,12).getTimezoneOffset()*-1;M===this.timezone?selectLocalTimezone(i):this.timezone_select.val(this.timezone)}else"undefined"!=typeof this.hour&&null!==this.hour&&""!==this.hour?this.timezone_select.val(t.timezone):selectLocalTimezone(i);this.timezone_select.change(function(){i._onTimeChange(),i._onSelectHandler(),i._afterInject()});var v=e.find(".ui-datepicker-buttonpane");if(v.length?v.before(g):e.append(g),this.$timeObj=g.find(".ui_tpicker_time_input"),this.$timeObj.change(function(){var e=i.inst.settings.timeFormat,t=$.datepicker.parseTime(e,this.value),s=new Date;t?(s.setHours(t.hour),s.setMinutes(t.minute),s.setSeconds(t.second),$.datepicker._setTime(i.inst,s)):(this.value=i.formattedTime,this.blur())}),null!==this.inst){var k=this.timeDefined;this._onTimeChange(),this.timeDefined=k}if(this._defaults.addSliderAccess){var T=this._defaults.sliderAccessArgs,D=this._defaults.isRTL;T.isRTL=D,setTimeout(function(){if(0===g.find(".ui-slider-access").length){g.find(".ui-slider:visible").sliderAccess(T);var e=g.find(".ui-slider-access:eq(0)").outerWidth(!0);e&&g.find("table:visible").each(function(){var t=$(this),i=t.outerWidth(),s=t.css(D?"marginRight":"marginLeft").toString().replace("%",""),n=i-e,a=s*n/i+"%",r={width:n,marginRight:0,marginLeft:0};r[D?"marginRight":"marginLeft"]=a,t.css(r)})}},10)}i._limitMinMaxDateTime(this.inst,!0)}},_limitMinMaxDateTime:function(e,t){var i=this._defaults,s=new Date(e.selectedYear,e.selectedMonth,e.selectedDay);if(this._defaults.showTimepicker){if(null!==$.datepicker._get(e,"minDateTime")&&void 0!==$.datepicker._get(e,"minDateTime")&&s){var n=$.datepicker._get(e,"minDateTime"),a=new Date(n.getFullYear(),n.getMonth(),n.getDate(),0,0,0,0);null!==this.hourMinOriginal&&null!==this.minuteMinOriginal&&null!==this.secondMinOriginal&&null!==this.millisecMinOriginal&&null!==this.microsecMinOriginal||(this.hourMinOriginal=i.hourMin,this.minuteMinOriginal=i.minuteMin,this.secondMinOriginal=i.secondMin,this.millisecMinOriginal=i.millisecMin,this.microsecMinOriginal=i.microsecMin),e.settings.timeOnly||a.getTime()===s.getTime()?(this._defaults.hourMin=n.getHours(),this.hour<=this._defaults.hourMin?(this.hour=this._defaults.hourMin,this._defaults.minuteMin=n.getMinutes(),this.minute<=this._defaults.minuteMin?(this.minute=this._defaults.minuteMin,this._defaults.secondMin=n.getSeconds(),this.second<=this._defaults.secondMin?(this.second=this._defaults.secondMin,this._defaults.millisecMin=n.getMilliseconds(),this.millisec<=this._defaults.millisecMin?(this.millisec=this._defaults.millisecMin,this._defaults.microsecMin=n.getMicroseconds()):(this.microsec=this._defaults.hourMax?(this.hour=this._defaults.hourMax,this._defaults.minuteMax=r.getMinutes(),this.minute>=this._defaults.minuteMax?(this.minute=this._defaults.minuteMax,this._defaults.secondMax=r.getSeconds(),this.second>=this._defaults.secondMax?(this.second=this._defaults.secondMax,this._defaults.millisecMax=r.getMilliseconds(),this.millisec>=this._defaults.millisecMax?(this.millisec=this._defaults.millisecMax,this._defaults.microsecMax=r.getMicroseconds()):(this.microsec>this._defaults.microsecMax&&(this.microsec=this._defaults.microsecMax),this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.hourMax=this.hourMaxOriginal,this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)}if(null!==e.settings.minTime){var o=new Date("01/01/1970 "+e.settings.minTime);this.houru.getHours()?(this.hour=this._defaults.hourMax=u.getHours(),this.minute=this._defaults.minuteMax=u.getMinutes()):this.hour===u.getHours()&&this.minute>u.getMinutes()?this.minute=this._defaults.minuteMax=u.getMinutes():this._defaults.hourMax>u.getHours()?(this._defaults.hourMax=u.getHours(),this._defaults.minuteMax=u.getMinutes()):this._defaults.hourMax===u.getHours()===this.hour&&this._defaults.minuteMax>u.getMinutes()?this._defaults.minuteMax=u.getMinutes():this._defaults.minuteMax=59}if(void 0!==t&&t===!0){var c=parseInt(this._defaults.hourMax-(this._defaults.hourMax-this._defaults.hourMin)%this._defaults.stepHour,10),m=parseInt(this._defaults.minuteMax-(this._defaults.minuteMax-this._defaults.minuteMin)%this._defaults.stepMinute,10),d=parseInt(this._defaults.secondMax-(this._defaults.secondMax-this._defaults.secondMin)%this._defaults.stepSecond,10),p=parseInt(this._defaults.millisecMax-(this._defaults.millisecMax-this._defaults.millisecMin)%this._defaults.stepMillisec,10),h=parseInt(this._defaults.microsecMax-(this._defaults.microsecMax-this._defaults.microsecMin)%this._defaults.stepMicrosec,10);this.hour_slider&&(this.control.options(this,this.hour_slider,"hour",{min:this._defaults.hourMin,max:c,step:this._defaults.stepHour}),this.control.value(this,this.hour_slider,"hour",this.hour-this.hour%this._defaults.stepHour)),this.minute_slider&&(this.control.options(this,this.minute_slider,"minute",{min:this._defaults.minuteMin,max:m,step:this._defaults.stepMinute}),this.control.value(this,this.minute_slider,"minute",this.minute-this.minute%this._defaults.stepMinute)),this.second_slider&&(this.control.options(this,this.second_slider,"second",{min:this._defaults.secondMin,max:d,step:this._defaults.stepSecond}),this.control.value(this,this.second_slider,"second",this.second-this.second%this._defaults.stepSecond)),this.millisec_slider&&(this.control.options(this,this.millisec_slider,"millisec",{min:this._defaults.millisecMin,max:p,step:this._defaults.stepMillisec}),this.control.value(this,this.millisec_slider,"millisec",this.millisec-this.millisec%this._defaults.stepMillisec)),this.microsec_slider&&(this.control.options(this,this.microsec_slider,"microsec",{min:this._defaults.microsecMin,max:h,step:this._defaults.stepMicrosec}),this.control.value(this,this.microsec_slider,"microsec",this.microsec-this.microsec%this._defaults.stepMicrosec))}}},_onTimeChange:function(){if(this._defaults.showTimepicker){var e=!!this.hour_slider&&this.control.value(this,this.hour_slider,"hour"),t=!!this.minute_slider&&this.control.value(this,this.minute_slider,"minute"),i=!!this.second_slider&&this.control.value(this,this.second_slider,"second"),s=!!this.millisec_slider&&this.control.value(this,this.millisec_slider,"millisec"),n=!!this.microsec_slider&&this.control.value(this,this.microsec_slider,"microsec"),a=!!this.timezone_select&&this.timezone_select.val(),r=this._defaults,l=r.pickerTimeFormat||r.timeFormat,o=r.pickerTimeSuffix||r.timeSuffix;"object"==typeof e&&(e=!1),"object"==typeof t&&(t=!1),"object"==typeof i&&(i=!1),"object"==typeof s&&(s=!1),"object"==typeof n&&(n=!1),"object"==typeof a&&(a=!1),e!==!1&&(e=parseInt(e,10)),t!==!1&&(t=parseInt(t,10)),i!==!1&&(i=parseInt(i,10)),s!==!1&&(s=parseInt(s,10)),n!==!1&&(n=parseInt(n,10)),a!==!1&&(a=a.toString());var u=r[e<12?"amNames":"pmNames"][0],c=e!==parseInt(this.hour,10)||t!==parseInt(this.minute,10)||i!==parseInt(this.second,10)||s!==parseInt(this.millisec,10)||n!==parseInt(this.microsec,10)||this.ampm.length>0&&e<12!=($.inArray(this.ampm.toUpperCase(),this.amNames)!==-1)||null!==this.timezone&&a!==this.timezone.toString();c&&(e!==!1&&(this.hour=e),t!==!1&&(this.minute=t),i!==!1&&(this.second=i),s!==!1&&(this.millisec=s),n!==!1&&(this.microsec=n),a!==!1&&(this.timezone=a),this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),this._limitMinMaxDateTime(this.inst,!0)),this.support.ampm&&(this.ampm=u),this.formattedTime=$.datepicker.formatTime(r.timeFormat,this,r),this.$timeObj&&(l===r.timeFormat?this.$timeObj.val(this.formattedTime+o):this.$timeObj.val($.datepicker.formatTime(l,this,r)+o)),this.timeDefined=!0,c&&this._updateDateTime()}},_onSelectHandler:function(){var e=this._defaults.onSelect||this.inst.settings.onSelect,t=this.$input?this.$input[0]:null;e&&t&&e.apply(t,[this.formattedDateTime,this])},_updateDateTime:function(e){e=this.inst||e;var t=e.currentYear>0?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(e.selectedYear,e.selectedMonth,e.selectedDay),i=$.datepicker._daylightSavingAdjust(t),s=$.datepicker._get(e,"dateFormat"),n=$.datepicker._getFormatConfig(e),a=null!==i&&this.timeDefined;this.formattedDate=$.datepicker.formatDate(s,null===i?new Date:i,n);var r=this.formattedDate;if(""===e.lastVal&&(e.currentYear=e.selectedYear,e.currentMonth=e.selectedMonth,e.currentDay=e.selectedDay),this._defaults.timeOnly===!0&&this._defaults.timeOnlyShowDate===!1?r=this.formattedTime:(this._defaults.timeOnly!==!0&&(this._defaults.alwaysSetTime||a)||this._defaults.timeOnly===!0&&this._defaults.timeOnlyShowDate===!0)&&(r+=this._defaults.separator+this.formattedTime+this._defaults.timeSuffix),this.formattedDateTime=r,this._defaults.showTimepicker)if(this.$altInput&&this._defaults.timeOnly===!1&&this._defaults.altFieldTimeOnly===!0)this.$altInput.val(this.formattedTime),this.$input.val(this.formattedDate);else if(this.$altInput){this.$input.val(r);var l="",o=null!==this._defaults.altSeparator?this._defaults.altSeparator:this._defaults.separator,u=null!==this._defaults.altTimeSuffix?this._defaults.altTimeSuffix:this._defaults.timeSuffix;this._defaults.timeOnly||(l=this._defaults.altFormat?$.datepicker.formatDate(this._defaults.altFormat,null===i?new Date:i,n):this.formattedDate,l&&(l+=o)),l+=null!==this._defaults.altTimeFormat?$.datepicker.formatTime(this._defaults.altTimeFormat,this,this._defaults)+u:this.formattedTime+u,this.$altInput.val(l)}else this.$input.val(r);else this.$input.val(this.formattedDate);this.$input.trigger("change")},_onFocus:function(){if(!this.$input.val()&&this._defaults.defaultValue){this.$input.val(this._defaults.defaultValue);var e=$.datepicker._getInst(this.$input.get(0)),t=$.datepicker._get(e,"timepicker");if(t&&t._defaults.timeOnly&&e.input.val()!==e.lastVal)try{$.datepicker._updateDatepicker(e)}catch(e){$.timepicker.log(e)}}},_controls:{slider:{create:function(e,t,i,s,n,a,r){var l=e._defaults.isRTL;return t.prop("slide",null).slider({orientation:"horizontal",value:l?s*-1:s,min:l?a*-1:n,max:l?n*-1:a,step:r,slide:function(t,s){e.control.value(e,$(this),i,l?s.value*-1:s.value),e._onTimeChange()},stop:function(t,i){e._onSelectHandler()}})},options:function(e,t,i,s,n){if(e._defaults.isRTL){if("string"==typeof s)return"min"===s||"max"===s?void 0!==n?t.slider(s,n*-1):Math.abs(t.slider(s)):t.slider(s);var a=s.min,r=s.max;return s.min=s.max=null,void 0!==a&&(s.max=a*-1),void 0!==r&&(s.min=r*-1),t.slider(s)}return"string"==typeof s&&void 0!==n?t.slider(s,n):t.slider(s)},value:function(e,t,i,s){return e._defaults.isRTL?void 0!==s?t.slider("value",s*-1):Math.abs(t.slider("value")):void 0!==s?t.slider("value",s):t.slider("value")}},select:{create:function(e,t,i,s,n,a,r){for(var l='',o=e._defaults.pickerTimeFormat||e._defaults.timeFormat,u=n;u<=a;u+=r)l+='",l+="hour"===i?$.datepicker.formatTime($.trim(o.replace(/[^ht ]/gi,"")),{hour:u},e._defaults):"millisec"===i||"microsec"===i||u>=10?u:"0"+u.toString(),l+=" ";return l+=" ",t.children("select").remove(),$(l).appendTo(t).change(function(t){e._onTimeChange(),e._onSelectHandler(),e._afterInject()}),t},options:function(e,t,i,s,n){var a={},r=t.children("select");if("string"==typeof s){if(void 0===n)return r.data(s);a[s]=n}else a=s;return e.control.create(e,t,r.data("unit"),r.val(),a.min>=0?a.min:r.data("min"),a.max||r.data("max"),a.step||r.data("step"))},value:function(e,t,i,s){var n=t.children("select");return void 0!==s?n.val(s):n.val()}}}}),$.fn.extend({timepicker:function(e){e=e||{};var t=Array.prototype.slice.call(arguments);return"object"==typeof e&&(t[0]=$.extend(e,{timeOnly:!0})),$(this).each(function(){$.fn.datetimepicker.apply($(this),t)})},datetimepicker:function(e){e=e||{};var t=arguments;return"string"==typeof e?"getDate"===e||"option"===e&&2===t.length&&"string"==typeof t[1]?$.fn.datepicker.apply($(this[0]),t):this.each(function(){var e=$(this);e.datepicker.apply(e,t)}):this.each(function(){var t=$(this);t.datepicker($.timepicker._newInst(t,e)._defaults)})}}),$.datepicker.parseDateTime=function(e,t,i,s,n){var a=parseDateTimeInternal(e,t,i,s,n);if(a.timeObj){var r=a.timeObj;a.date.setHours(r.hour,r.minute,r.second,r.millisec),a.date.setMicroseconds(r.microsec)}return a.date},$.datepicker.parseTime=function(e,t,i){var s=extendRemove(extendRemove({},$.timepicker._defaults),i||{}),n=e.replace(/\'.*?\'/g,"").indexOf("Z")!==-1,a=function(e,t,i){var s=function(e,t){var i=[];return e&&$.merge(i,e),t&&$.merge(i,t),i=$.map(i,function(e){return e.replace(/[.*+?|()\[\]{}\\]/g,"\\$&")}),"("+i.join("|")+")?"},n=function(e){var t=e.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),i={h:-1,m:-1,s:-1,l:-1,c:-1,t:-1,z:-1};if(t)for(var s=0;s11&&(n=i.pmNames[0]),s=s.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(e){switch(e){case"HH":return("0"+a).slice(-2);case"H":return a;case"hh":return("0"+convert24to12(a)).slice(-2);case"h":return convert24to12(a);case"mm":return("0"+t.minute).slice(-2);case"m":return t.minute;case"ss":return("0"+t.second).slice(-2);case"s":return t.second;case"l":return("00"+t.millisec).slice(-3);case"c":return("00"+t.microsec).slice(-3);case"z":return $.timepicker.timezoneOffsetString(null===t.timezone?i.timezone:t.timezone,!1);case"Z":return $.timepicker.timezoneOffsetString(null===t.timezone?i.timezone:t.timezone,!0);case"T":return n.charAt(0).toUpperCase();case"TT":return n.toUpperCase();case"t":return n.charAt(0).toLowerCase();case"tt":return n.toLowerCase();default:return e.replace(/'/g,"")}})},$.datepicker._base_selectDate=$.datepicker._selectDate,$.datepicker._selectDate=function(e,t){var i=this._getInst($(e)[0]),s=this._get(i,"timepicker"),n;s&&i.settings.showTimepicker?(s._limitMinMaxDateTime(i,!0),n=i.inline,i.inline=i.stay_open=!0,this._base_selectDate(e,t),i.inline=n,i.stay_open=!1,this._notifyChange(i),this._updateDatepicker(i)):this._base_selectDate(e,t)},$.datepicker._base_updateDatepicker=$.datepicker._updateDatepicker,$.datepicker._updateDatepicker=function(e){var t=e.input[0];if(!($.datepicker._curInst&&$.datepicker._curInst!==e&&$.datepicker._datepickerShowing&&$.datepicker._lastInput!==t||"boolean"==typeof e.stay_open&&e.stay_open!==!1)){this._base_updateDatepicker(e);var i=this._get(e,"timepicker");i&&i._addTimePicker(e)}},$.datepicker._base_doKeyPress=$.datepicker._doKeyPress,$.datepicker._doKeyPress=function(e){var t=$.datepicker._getInst(e.target),i=$.datepicker._get(t,"timepicker");if(i&&$.datepicker._get(t,"constrainInput")){var s=i.support.ampm,n=null!==i._defaults.showTimezone?i._defaults.showTimezone:i.support.timezone,a=$.datepicker._possibleChars($.datepicker._get(t,"dateFormat")),r=i._defaults.timeFormat.toString().replace(/[hms]/g,"").replace(/TT/g,s?"APM":"").replace(/Tt/g,s?"AaPpMm":"").replace(/tT/g,s?"AaPpMm":"").replace(/T/g,s?"AP":"").replace(/tt/g,s?"apm":"").replace(/t/g,s?"ap":"")+" "+i._defaults.separator+i._defaults.timeSuffix+(n?i._defaults.timezoneList.join(""):"")+i._defaults.amNames.join("")+i._defaults.pmNames.join("")+a,l=String.fromCharCode(void 0===e.charCode?e.keyCode:e.charCode);return e.ctrlKey||l<" "||!a||r.indexOf(l)>-1}return $.datepicker._base_doKeyPress(e)},$.datepicker._base_updateAlternate=$.datepicker._updateAlternate,$.datepicker._updateAlternate=function(e){var t=this._get(e,"timepicker");if(t){var i=t._defaults.altField;if(i){var s=t._defaults.altFormat||t._defaults.dateFormat,n=this._getDate(e),a=$.datepicker._getFormatConfig(e),r="",l=t._defaults.altSeparator?t._defaults.altSeparator:t._defaults.separator,o=t._defaults.altTimeSuffix?t._defaults.altTimeSuffix:t._defaults.timeSuffix,u=null!==t._defaults.altTimeFormat?t._defaults.altTimeFormat:t._defaults.timeFormat;r+=$.datepicker.formatTime(u,t,t._defaults)+o,t._defaults.timeOnly||t._defaults.altFieldTimeOnly||null===n||(r=t._defaults.altFormat?$.datepicker.formatDate(t._defaults.altFormat,n,a)+l+r:t.formattedDate+l+r),$(i).val(e.input.val()?r:"")}}else $.datepicker._base_updateAlternate(e)},$.datepicker._base_doKeyUp=$.datepicker._doKeyUp,$.datepicker._doKeyUp=function(e){var t=$.datepicker._getInst(e.target),i=$.datepicker._get(t,"timepicker");if(i&&i._defaults.timeOnly&&t.input.val()!==t.lastVal)try{$.datepicker._updateDatepicker(t)}catch(e){
+$.timepicker.log(e)}return $.datepicker._base_doKeyUp(e)},$.datepicker._base_gotoToday=$.datepicker._gotoToday,$.datepicker._gotoToday=function(e){var t=this._getInst($(e)[0]);this._base_gotoToday(e);var i=this._get(t,"timepicker");if(i){var s=$.timepicker.timezoneOffsetNumber(i.timezone),n=new Date;n.setMinutes(n.getMinutes()+n.getTimezoneOffset()+parseInt(s,10)),this._setTime(t,n),this._setDate(t,n),i._onSelectHandler()}},$.datepicker._disableTimepickerDatepicker=function(e){var t=this._getInst(e);if(t){var i=this._get(t,"timepicker");$(e).datepicker("getDate"),i&&(t.settings.showTimepicker=!1,i._defaults.showTimepicker=!1,i._updateDateTime(t))}},$.datepicker._enableTimepickerDatepicker=function(e){var t=this._getInst(e);if(t){var i=this._get(t,"timepicker");$(e).datepicker("getDate"),i&&(t.settings.showTimepicker=!0,i._defaults.showTimepicker=!0,i._addTimePicker(t),i._updateDateTime(t))}},$.datepicker._setTime=function(e,t){var i=this._get(e,"timepicker");if(i){var s=i._defaults;i.hour=t?t.getHours():s.hour,i.minute=t?t.getMinutes():s.minute,i.second=t?t.getSeconds():s.second,i.millisec=t?t.getMilliseconds():s.millisec,i.microsec=t?t.getMicroseconds():s.microsec,i._limitMinMaxDateTime(e,!0),i._onTimeChange(),i._updateDateTime(e)}},$.datepicker._setTimeDatepicker=function(e,t,i){var s=this._getInst(e);if(s){var n=this._get(s,"timepicker");if(n){this._setDateFromField(s);var a;t&&("string"==typeof t?(n._parseTime(t,i),a=new Date,a.setHours(n.hour,n.minute,n.second,n.millisec),a.setMicroseconds(n.microsec)):(a=new Date(t.getTime()),a.setMicroseconds(t.getMicroseconds())),"Invalid Date"===a.toString()&&(a=void 0),this._setTime(s,a))}}},$.datepicker._base_setDateDatepicker=$.datepicker._setDateDatepicker,$.datepicker._setDateDatepicker=function(e,t){var i=this._getInst(e),s=t;if(i){"string"==typeof t&&(s=new Date(t),s.getTime()||(this._base_setDateDatepicker.apply(this,arguments),s=$(e).datepicker("getDate")));var n=this._get(i,"timepicker"),a;s instanceof Date?(a=new Date(s.getTime()),a.setMicroseconds(s.getMicroseconds())):a=s,n&&a&&(n.support.timezone||null!==n._defaults.timezone||(n.timezone=a.getTimezoneOffset()*-1),s=$.timepicker.timezoneAdjust(s,$.timepicker.timezoneOffsetString(-s.getTimezoneOffset()),n.timezone),a=$.timepicker.timezoneAdjust(a,$.timepicker.timezoneOffsetString(-a.getTimezoneOffset()),n.timezone)),this._updateDatepicker(i),this._base_setDateDatepicker.apply(this,arguments),this._setTimeDatepicker(e,a,!0)}},$.datepicker._base_getDateDatepicker=$.datepicker._getDateDatepicker,$.datepicker._getDateDatepicker=function(e,t){var i=this._getInst(e);if(i){var s=this._get(i,"timepicker");if(s){void 0===i.lastVal&&this._setDateFromField(i,t);var n=this._getDate(i),a=null;return a=s.$altInput&&s._defaults.altFieldTimeOnly?s.$input.val()+" "+s.$altInput.val():"INPUT"!==s.$input.get(0).tagName&&s.$altInput?s.$altInput.val():s.$input.val(),n&&s._parseTime(a,!i.settings.timeOnly)&&(n.setHours(s.hour,s.minute,s.second,s.millisec),n.setMicroseconds(s.microsec),null!=s.timezone&&(s.support.timezone||null!==s._defaults.timezone||(s.timezone=n.getTimezoneOffset()*-1),n=$.timepicker.timezoneAdjust(n,s.timezone,$.timepicker.timezoneOffsetString(-n.getTimezoneOffset())))),n}return this._base_getDateDatepicker(e,t)}},$.datepicker._base_parseDate=$.datepicker.parseDate,$.datepicker.parseDate=function(e,t,i){var s;try{s=this._base_parseDate(e,t,i)}catch(n){if(!(n.indexOf(":")>=0))throw n;s=this._base_parseDate(e,t.substring(0,t.length-(n.length-n.indexOf(":")-2)),i),$.timepicker.log("Error parsing the date string: "+n+"\ndate string = "+t+"\ndate format = "+e)}return s},$.datepicker._base_formatDate=$.datepicker._formatDate,$.datepicker._formatDate=function(e,t,i,s){var n=this._get(e,"timepicker");return n?(n._updateDateTime(e),n.$input.val()):this._base_formatDate(e)},$.datepicker._base_optionDatepicker=$.datepicker._optionDatepicker,$.datepicker._optionDatepicker=function(e,t,i){var s=this._getInst(e),n;if(!s)return null;var a=this._get(s,"timepicker");if(a){var r=null,l=null,o=null,u=a._defaults.evnts,c={},m,d,p,h;if("string"==typeof t){if("minDate"===t||"minDateTime"===t)r=i;else if("maxDate"===t||"maxDateTime"===t)l=i;else if("onSelect"===t)o=i;else if(u.hasOwnProperty(t)){if("undefined"==typeof i)return u[t];c[t]=i,n={}}}else if("object"==typeof t){t.minDate?r=t.minDate:t.minDateTime?r=t.minDateTime:t.maxDate?l=t.maxDate:t.maxDateTime&&(l=t.maxDateTime);for(m in u)u.hasOwnProperty(m)&&t[m]&&(c[m]=t[m])}for(m in c)c.hasOwnProperty(m)&&(u[m]=c[m],n||(n=$.extend({},t)),delete n[m]);if(n&&isEmptyObject(n))return;if(r?(r=0===r?new Date:new Date(r),a._defaults.minDate=r,a._defaults.minDateTime=r):l?(l=0===l?new Date:new Date(l),a._defaults.maxDate=l,a._defaults.maxDateTime=l):o&&(a._defaults.onSelect=o),r||l)return h=$(e),p=h.datetimepicker("getDate"),d=this._base_optionDatepicker.call($.datepicker,e,n||t,i),h.datetimepicker("setDate",p),d}return void 0===i?this._base_optionDatepicker.call($.datepicker,e,t):this._base_optionDatepicker.call($.datepicker,e,n||t,i)};var isEmptyObject=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0},extendRemove=function(e,t){$.extend(e,t);for(var i in t)null!==t[i]&&void 0!==t[i]||(e[i]=t[i]);return e},detectSupport=function(e){var t=e.replace(/'.*?'/g,"").toLowerCase(),i=function(e,t){return e.indexOf(t)!==-1};return{hour:i(t,"h"),minute:i(t,"m"),second:i(t,"s"),millisec:i(t,"l"),microsec:i(t,"c"),timezone:i(t,"z"),ampm:i(t,"t")&&i(e,"h"),iso8601:i(e,"Z")}},convert24to12=function(e){return e%=12,0===e&&(e=12),String(e)},computeEffectiveSetting=function(e,t){return e&&e[t]?e[t]:$.timepicker._defaults[t]},splitDateTime=function(e,t){var i=computeEffectiveSetting(t,"separator"),s=computeEffectiveSetting(t,"timeFormat"),n=s.split(i),a=n.length,r=e.split(i),l=r.length;return l>1?{dateString:r.splice(0,l-a).join(i),timeString:r.splice(0,a).join(i)}:{dateString:e,timeString:""}},parseDateTimeInternal=function(e,t,i,s,n){var a,r,l;if(r=splitDateTime(i,n),a=$.datepicker._base_parseDate(e,r.dateString,s),""===r.timeString)return{date:a};if(l=$.datepicker.parseTime(t,r.timeString,n),!l)throw"Wrong time format";return{date:a,timeObj:l}},selectLocalTimezone=function(e,t){if(e&&e.timezone_select){var i=t||new Date;e.timezone_select.val(-i.getTimezoneOffset())}};$.timepicker=new Timepicker,$.timepicker.timezoneOffsetString=function(e,t){if(isNaN(e)||e>840||e<-720)return e;var i=e,s=i%60,n=(i-s)/60,a=t?":":"",r=(i>=0?"+":"-")+("0"+Math.abs(n)).slice(-2)+a+("0"+Math.abs(s)).slice(-2);return"+00:00"===r?"Z":r},$.timepicker.timezoneOffsetNumber=function(e){var t=e.toString().replace(":","");return"Z"===t.toUpperCase()?0:/^(\-|\+)\d{4}$/.test(t)?("-"===t.substr(0,1)?-1:1)*(60*parseInt(t.substr(1,2),10)+parseInt(t.substr(3,2),10)):parseInt(e,10)},$.timepicker.timezoneAdjust=function(e,t,i){var s=$.timepicker.timezoneOffsetNumber(t),n=$.timepicker.timezoneOffsetNumber(i);return isNaN(n)||e.setMinutes(e.getMinutes()+-s- -n),e},$.timepicker.timeRange=function(e,t,i){return $.timepicker.handleRange("timepicker",e,t,i)},$.timepicker.datetimeRange=function(e,t,i){$.timepicker.handleRange("datetimepicker",e,t,i)},$.timepicker.dateRange=function(e,t,i){$.timepicker.handleRange("datepicker",e,t,i)},$.timepicker.handleRange=function(e,t,i,s){function n(n,a){var r=t[e]("getDate"),l=i[e]("getDate"),o=n[e]("getDate");if(null!==r){var u=new Date(r.getTime()),c=new Date(r.getTime());u.setMilliseconds(u.getMilliseconds()+s.minInterval),c.setMilliseconds(c.getMilliseconds()+s.maxInterval),s.minInterval>0&&u>l?i[e]("setDate",u):s.maxInterval>0&&cl&&a[e]("setDate",o)}}function a(t,i,n){if(t.val()){var a=t[e].call(t,"getDate");null!==a&&s.minInterval>0&&("minDate"===n&&a.setMilliseconds(a.getMilliseconds()+s.minInterval),"maxDate"===n&&a.setMilliseconds(a.getMilliseconds()-s.minInterval)),a.getTime&&i[e].call(i,"option",n,a)}}s=$.extend({},{minInterval:0,maxInterval:0,start:{},end:{}},s);var r=!1;return"timepicker"===e&&(r=!0,e="datetimepicker"),$.fn[e].call(t,$.extend({timeOnly:r,onClose:function(e,t){n($(this),i)},onSelect:function(e){a($(this),i,"minDate")}},s,s.start)),$.fn[e].call(i,$.extend({timeOnly:r,onClose:function(e,i){n($(this),t)},onSelect:function(e){a($(this),t,"maxDate")}},s,s.end)),n(t,i),a(t,i,"minDate"),a(i,t,"maxDate"),$([t.get(0),i.get(0)])},$.timepicker.log=function(){window.console&&window.console.log&&window.console.log.apply&&window.console.log.apply(window.console,Array.prototype.slice.call(arguments))},$.timepicker._util={_extendRemove:extendRemove,_isEmptyObject:isEmptyObject,_convert24to12:convert24to12,_detectSupport:detectSupport,_selectLocalTimezone:selectLocalTimezone,_computeEffectiveSetting:computeEffectiveSetting,_splitDateTime:splitDateTime,_parseDateTimeInternal:parseDateTimeInternal},Date.prototype.getMicroseconds||(Date.prototype.microseconds=0,Date.prototype.getMicroseconds=function(){return this.microseconds},Date.prototype.setMicroseconds=function(e){return this.setMilliseconds(this.getMilliseconds()+Math.floor(e/1e3)),this.microseconds=e%1e3,this}),$.timepicker.version="1.6.3"}});
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js
new file mode 100644
index 0000000..c7076f2
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js
@@ -0,0 +1,3183 @@
+(function($){
+
+ acf.field_group = acf.model.extend({
+
+ // vars
+ $fields: null,
+ $locations: null,
+ $options: null,
+
+ actions: {
+ 'ready': 'init'
+ },
+
+ events: {
+ 'submit #post': 'submit',
+ 'click a[href="#"]': 'preventDefault',
+ 'click .submitdelete': 'trash',
+ 'mouseenter .acf-field-list': 'sortable'
+ },
+
+
+ /*
+ * init
+ *
+ * This function will run on document ready and initialize the module
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ init: function(){
+
+ // $el
+ this.$fields = $('#acf-field-group-fields');
+ this.$locations = $('#acf-field-group-locations');
+ this.$options = $('#acf-field-group-options');
+
+
+ // disable validation
+ acf.validation.active = 0;
+
+ },
+
+
+ /*
+ * sortable
+ *
+ * This function will add sortable to the feild group list
+ * sortable is added on mouseover to speed up page load
+ *
+ * @type function
+ * @date 28/10/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ sortable: function( e ){
+
+ // bail early if already sortable
+ if( e.$el.hasClass('ui-sortable') ) {
+
+ return;
+
+ }
+
+
+ // vars
+ var self = this;
+
+
+ // sortable
+ e.$el.sortable({
+ handle: '.acf-sortable-handle',
+ connectWith: '.acf-field-list',
+ start: function(e, ui){
+ ui.placeholder.height( ui.item.height() );
+ },
+ update: function(event, ui){
+
+ // vars
+ var $el = ui.item;
+
+
+ // render
+ self.render_fields();
+
+
+ // actions
+ acf.do_action('sortstop', $el);
+
+ }
+ });
+
+ },
+
+
+ /*
+ * preventDefault
+ *
+ * This helper will preventDefault on all events for empty links
+ *
+ * @type function
+ * @date 18/08/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ preventDefault: function( e ){
+
+ e.preventDefault();
+
+ },
+
+
+ /*
+ * get_selector
+ *
+ * This function will return a valid selector for finding a field object
+ *
+ * @type function
+ * @date 15/01/2015
+ * @since 5.1.5
+ *
+ * @param s (string)
+ * @return (string)
+ */
+
+ get_selector: function( s ) {
+
+ // defaults
+ s = s || '';
+
+
+ // vars
+ var selector = '.acf-field-object';
+
+
+ // search
+ if( s ) {
+
+ // append
+ selector += '-' + s;
+
+
+ // replace underscores (split/join replaces all and is faster than regex!)
+ selector = selector.split('_').join('-');
+
+ }
+
+
+ // return
+ return selector;
+
+ },
+
+
+ /*
+ * render_fields
+ *
+ * This function is triggered by a change in field order, and will update the field icon number
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ render_fields: function(){
+
+ // reference
+ var self = this;
+
+
+ // update order numbers
+ $('.acf-field-list').each(function(){
+
+ // vars
+ var $fields = $(this).children('.acf-field-object');
+
+
+ // loop over fields
+ $fields.each(function( i ){
+
+ // update meta
+ self.update_field_meta( $(this), 'menu_order', i );
+
+
+ // update icon number
+ $(this).children('.handle').find('.acf-icon').html( i+1 );
+
+ });
+
+
+ // show no fields message
+ if( !$fields.exists() ){
+
+ $(this).children('.no-fields-message').show();
+
+ } else {
+
+ $(this).children('.no-fields-message').hide();
+
+ }
+
+ });
+
+ },
+
+
+ /*
+ * get_field_meta
+ *
+ * This function will return an input value for a field
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @param name
+ * @return (string)
+ */
+
+ get_field_meta: function( $el, name ){
+
+ //console.log( 'get_field_meta(%o, %o)', $el, name );
+
+ // vars
+ var $input = $el.find('> .meta > .input-' + name);
+
+
+ // bail early if no input
+ if( !$input.exists() ) {
+
+ //console.log( '- aborted due to no input' );
+ return false;
+
+ }
+
+
+ // return
+ return $input.val();
+
+ },
+
+
+ /*
+ * update_field_meta
+ *
+ * This function will update an input value for a field
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @param name
+ * @param value
+ * @return n/a
+ */
+
+ update_field_meta: function( $el, name, value ){
+
+ //console.log( 'update_field_meta(%o, %o, %o)', $el, name, value );
+
+ // vars
+ var $input = $el.find('> .meta > .input-' + name);
+
+
+ // create hidden input if doesn't exist
+ if( !$input.exists() ) {
+
+ // vars
+ var html = $el.find('> .meta > .input-ID').outerHTML();
+
+
+ // replcae
+ html = acf.str_replace('ID', name, html);
+
+
+ // update $input
+ $input = $(html);
+
+
+ // reset value
+ $input.val( value );
+
+
+ // append
+ $el.children('.meta').append( $input );
+
+ //console.log( '- created new input' );
+
+ }
+
+
+ // bail early if no change
+ if( $input.val() == value ) {
+
+ //console.log( '- aborted due to no change in input value' );
+ return;
+ }
+
+
+ // update value
+ $input.val( value );
+
+
+ // bail early if updating save
+ if( name == 'save' ) {
+
+ //console.log( '- aborted due to name == save' );
+ return;
+
+ }
+
+
+ // meta has changed, update save
+ this.save_field( $el, 'meta' );
+
+ },
+
+
+ /*
+ * delete_field_meta
+ *
+ * This function will return an input value for a field
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @param name
+ * @return (string)
+ */
+
+ delete_field_meta: function( $el, name ){
+
+ //console.log( 'delete_field_meta(%o, %o, %o)', $el, name );
+
+ // vars
+ var $input = $el.find('> .meta > .input-' + name);
+
+
+ // bail early if not exists
+ if( !$input.exists() ) {
+
+ //console.log( '- aborted due to no input' );
+ return;
+
+ }
+
+
+ // remove
+ $input.remove();
+
+
+ // meta has changed, update save
+ this.save_field( $el, 'meta' );
+
+ },
+
+
+ /*
+ * save_field
+ *
+ * This function will update the changed input for a given field making sure it is saved on submit
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return n/a
+ */
+
+ save_field: function( $el, type ){
+
+ //console.log('save_field(%o %o)', $el, type);
+
+ // defaults
+ type = type || 'settings';
+
+
+ // vars
+ var value = this.get_field_meta( $el, 'save' );
+
+
+ // bail early if already 'settings'
+ if( value == 'settings' ) {
+
+ return;
+
+ }
+
+
+ // bail early if no change
+ if( value == type ) {
+
+ return;
+
+ }
+
+
+ // update meta
+ this.update_field_meta( $el, 'save', type );
+
+
+ // action for 3rd party customization
+ acf.do_action('save_field', $el, type);
+
+ },
+
+
+ /*
+ * submit
+ *
+ * This function is triggered when submitting the form and provides validation prior to posting the data
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return (boolean)
+ */
+
+ submit: function( e ){
+
+ // reference
+ var self = this;
+
+
+ // vars
+ var $title = $('#titlewrap #title');
+
+
+ // title empty
+ if( !$title.val() ) {
+
+ // prevent default
+ e.preventDefault();
+
+
+ // unlock form
+ acf.validation.toggle( e.$el, 'unlock' );
+
+
+ // alert
+ alert( acf._e('title_is_required') );
+
+
+ // focus
+ $title.focus();
+
+ }
+
+
+ // close / delete fields
+ $('.acf-field-object').each(function(){
+
+ // vars
+ var save = self.get_field_meta( $(this), 'save'),
+ ID = self.get_field_meta( $(this), 'ID'),
+ open = $(this).hasClass('open');
+
+
+ // close
+ if( open ) {
+
+ self.close_field( $(this) );
+
+ }
+
+
+ // remove unnecessary inputs
+ if( save == 'settings' ) {
+
+ // allow all settings to save (new field, changed field)
+
+ } else if( save == 'meta' ) {
+
+ $(this).children('.settings').find('[name^="acf_fields[' + ID + ']"]').remove();
+
+ } else {
+
+ $(this).find('[name^="acf_fields[' + ID + ']"]').remove();
+
+ }
+
+ });
+
+ },
+
+
+ /*
+ * trash
+ *
+ * This function is triggered when moving the field group to trash
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return (boolean)
+ */
+
+ trash: function( e ){
+
+ var result = confirm( acf._e('move_to_trash') );
+
+ if( !result ) {
+
+ e.preventDefault();
+
+ }
+
+ },
+
+
+ /*
+ * render_field
+ *
+ * This function will update the field's info
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return n/a
+ */
+
+ render_field: function( $el ){
+
+ // vars
+ var label = $el.find('.field-label:first').val(),
+ name = $el.find('.field-name:first').val(),
+ type = $el.find('.field-type:first option:selected').text(),
+ required = $el.find('.field-required:first').prop('checked'),
+ $handle = $el.children('.handle');
+
+
+ // update label
+ $handle.find('.li-field-label strong a').html( label );
+
+
+ // update required
+ $handle.find('.li-field-label .acf-required').remove();
+
+ if( required ) {
+
+ $handle.find('.li-field-label strong').append('* ');
+
+ }
+
+
+ // update name
+ $handle.find('.li-field-name').text( name );
+
+
+ // update type
+ $handle.find('.li-field-type').text( type );
+
+
+ // action for 3rd party customization
+ acf.do_action('render_field_handle', $el, $handle);
+
+ },
+
+
+ /*
+ * edit_field
+ *
+ * This function is triggered when clicking on a field. It will open / close a fields settings
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return n/a
+ */
+
+ edit_field: function( $field ){
+
+ // toggle
+ if( $field.hasClass('open') ) {
+
+ this.close_field( $field );
+
+ } else {
+
+ this.open_field( $field );
+
+ }
+
+ },
+
+
+ /*
+ * open_field
+ *
+ * This function will open a fields settings
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return n/a
+ */
+
+ open_field: function( $el ){
+
+ // bail early if already open
+ if( $el.hasClass('open') ) {
+
+ return false;
+
+ }
+
+
+ // add class
+ $el.addClass('open');
+
+
+ // action for 3rd party customization
+ acf.do_action('open_field', $el);
+
+
+ // animate toggle
+ $el.children('.settings').animate({ 'height' : 'toggle' }, 250 );
+
+ },
+
+
+ /*
+ * close_field
+ *
+ * This function will open a fields settings
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return n/a
+ */
+
+ close_field: function( $el ){
+
+ // bail early if already closed
+ if( !$el.hasClass('open') ) {
+
+ return false;
+
+ }
+
+
+ // remove class
+ $el.removeClass('open');
+
+
+ // action for 3rd party customization
+ acf.do_action('close_field', $el);
+
+
+ // animate toggle
+ $el.children('.settings').animate({ 'height' : 'toggle' }, 250 );
+
+ },
+
+
+ /*
+ * wipe_field
+ *
+ * This function will prepare a new field by updating the input names
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return n/a
+ */
+
+ wipe_field: function( $el ){
+
+ // vars
+ var id = $el.attr('data-id'),
+ key = $el.attr('data-key'),
+ new_id = acf.get_uniqid(),
+ new_key = 'field_' + new_id;
+
+
+ // update attr
+ $el.attr('data-id', new_id);
+ $el.attr('data-key', new_key);
+ $el.attr('data-orig', key);
+
+
+ // update hidden inputs
+ this.update_field_meta( $el, 'ID', '' );
+ this.update_field_meta( $el, 'key', new_key );
+
+
+ // update attributes
+ $el.find('[id*="' + id + '"]').each(function(){
+
+ $(this).attr('id', $(this).attr('id').replace(id, new_id) );
+
+ });
+
+ $el.find('[name*="' + id + '"]').each(function(){
+
+ $(this).attr('name', $(this).attr('name').replace(id, new_id) );
+
+ });
+
+
+ // update key
+ $el.find('> .handle .pre-field-key').text( new_key );
+
+
+ // remove sortable classes
+ $el.find('.ui-sortable').removeClass('ui-sortable');
+
+
+ // action for 3rd party customization
+ acf.do_action('wipe_field', $el);
+
+ },
+
+
+ /*
+ * add_field
+ *
+ * This function will add a new field to a field list
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $fields
+ * @return n/a
+ */
+
+ add_field: function( $fields ){
+
+ // clone tr
+ var $el = $( $('#tmpl-acf-field').html() ),
+ $label = $el.find('.field-label:first'),
+ $name = $el.find('.field-name:first');
+
+
+ // update names
+ this.wipe_field( $el );
+
+
+ // append to table
+ $fields.append( $el );
+
+
+ // clear name
+ $label.val('');
+ $name.val('');
+
+
+ // focus after form has dropped down
+ setTimeout(function(){
+
+ $label.focus();
+
+ }, 251);
+
+
+ // update order numbers
+ this.render_fields();
+
+
+ // trigger append
+ acf.do_action('append', $el);
+
+
+ // open up form
+ this.edit_field( $el );
+
+
+ // action for 3rd party customization
+ acf.do_action('add_field', $el);
+
+ },
+
+
+ /*
+ * duplicate_field
+ *
+ * This function will duplicate a field
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return $el2
+ */
+
+ duplicate_field: function( $el ){
+
+ // allow acf to modify DOM
+ acf.do_action('before_duplicate', $el);
+
+
+ // vars
+ var $el2 = $el.clone(),
+ $label = $el2.find('.field-label:first'),
+ $name = $el2.find('.field-name:first');
+
+
+ // remove JS functionality
+ acf.do_action('remove', $el2);
+
+
+ // update names
+ this.wipe_field( $el2 );
+
+
+ // allow acf to modify DOM
+ acf.do_action('after_duplicate', $el, $el2);
+
+
+ // append to table
+ $el.after( $el2 );
+
+
+ // trigger append
+ acf.do_action('append', $el2);
+
+
+ // focus after form has dropped down
+ setTimeout(function(){
+
+ $label.focus();
+
+ }, 251);
+
+
+ // update order numbers
+ this.render_fields();
+
+
+ // open up form
+ if( $el.hasClass('open') ) {
+
+ this.close_field( $el );
+
+ } else {
+
+ this.open_field( $el2 );
+
+ }
+
+
+ // update new_field label / name
+ var label = $label.val(),
+ name = $name.val(),
+ end = name.split('_').pop(),
+ copy = acf._e('copy');
+
+
+ // look at last word
+ if( end.indexOf(copy) === 0 ) {
+
+ var i = end.replace(copy, '') * 1;
+ i = i ? i+1 : 2;
+
+ // replace
+ label = label.replace( end, copy + i );
+ name = name.replace( end, copy + i );
+
+ } else {
+
+ label += ' (' + copy + ')';
+ name += '_' + copy;
+
+ }
+
+
+ $label.val( label );
+ $name.val( name );
+
+
+ // save field
+ this.save_field( $el2 );
+
+
+ // render field
+ this.render_field( $el2 );
+
+
+ // action for 3rd party customization
+ acf.do_action('duplicate_field', $el2);
+
+
+ // return
+ return $el2;
+
+ },
+
+
+ /*
+ * move_field
+ *
+ * This function will launch a popup to move a field to another field group
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $field
+ * @return n/a
+ */
+
+ move_field: function( $field ){
+
+ // reference
+ var self = this;
+
+
+ // AJAX data
+ var ajax_data = acf.prepare_for_ajax({
+ action: 'acf/field_group/move_field',
+ field_id: this.get_field_meta( $field, 'ID' )
+ });
+
+
+ // vars
+ var warning = false;
+
+
+ // validate
+ if( !ajax_data.field_id ) {
+
+ // Case: field not saved to DB
+ warning = true;
+
+ } else if( this.get_field_meta( $field, 'save' ) == 'settings' ) {
+
+ // Case: field's settings have changed
+ warning = true;
+
+ } else {
+
+ // Case: sub field's settings have changed
+ $field.find('.acf-field-object').each(function(){
+
+ if( !self.get_field_meta( $(this), 'ID' ) ) {
+
+ // Case: field not saved to DB
+ warning = true;
+ return false;
+
+ } else if( self.get_field_meta( $(this), 'save' ) == 'settings' ) {
+
+ // Case: field's settings have changed
+ warning = true;
+
+ }
+
+ });
+
+ }
+
+
+ // bail early if can't move
+ if( warning ) {
+
+ alert( acf._e('move_field_warning') );
+ return;
+
+ }
+
+
+ // open popup
+ acf.open_popup({
+ title : acf._e('move_field'),
+ loading : true,
+ height : 145
+ });
+
+
+ // get HTML
+ $.ajax({
+ url: acf.get('ajaxurl'),
+ data: ajax_data,
+ type: 'post',
+ dataType: 'html',
+ success: function(html){
+
+ self.move_field_confirm( $field, html );
+
+ }
+ });
+
+ },
+
+
+ /*
+ * move_field_confirm
+ *
+ * This function will move a field to another field group
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ move_field_confirm: function( $field, html ){
+
+ // reference
+ var self = this;
+
+
+ // update popup
+ acf.update_popup({
+ content : html
+ });
+
+
+ // AJAX data
+ var ajax_data = acf.prepare_for_ajax({
+ 'action' : 'acf/field_group/move_field',
+ 'field_id' : this.get_field_meta($field, 'ID'),
+ 'field_group_id' : 0
+ });
+
+
+ // submit form
+ $('#acf-move-field-form').on('submit', function(){
+
+ ajax_data.field_group_id = $(this).find('select').val();
+
+
+ // get HTML
+ $.ajax({
+ url: acf.get('ajaxurl'),
+ data: ajax_data,
+ type: 'post',
+ dataType: 'html',
+ success: function(html){
+
+ acf.update_popup({
+ content : html
+ });
+
+
+ // remove the field without actually deleting it
+ self.remove_field( $field );
+
+ }
+ });
+
+ return false;
+
+ });
+
+ },
+
+
+ /*
+ * delete_field
+ *
+ * This function will delete a field
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @param animation
+ * @return n/a
+ */
+
+ delete_field: function( $el, animation ){
+
+ // defaults
+ animation = animation || true;
+
+
+ // vars
+ var id = this.get_field_meta($el, 'ID');
+
+
+ // add to remove list
+ if( id ) {
+
+ var $input = $('#_acf_delete_fields');
+ $input.val( $input.val() + '|' + id );
+
+ }
+
+
+ // action for 3rd party customization
+ acf.do_action('delete_field', $el);
+
+
+ // bail early if no animation
+ if( animation ) {
+
+ this.remove_field( $el );
+
+ }
+
+ },
+
+
+ /*
+ * remove_field
+ *
+ * This function will visualy remove a field
+ *
+ * @type function
+ * @date 24/10/2014
+ * @since 5.0.9
+ *
+ * @param $el
+ * @param animation
+ * @return n/a
+ */
+
+ remove_field: function( $el ){
+
+ // reference
+ var self = this;
+
+
+ // vars
+ var $field_list = $el.closest('.acf-field-list');
+
+
+ // set layout
+ $el.css({
+ height : $el.height(),
+ width : $el.width(),
+ position : 'absolute'
+ });
+
+
+ // wrap field
+ $el.wrap( '
' );
+
+
+ // fade $el
+ $el.animate({ opacity : 0 }, 250);
+
+
+ // close field
+ var end_height = 0,
+ $show = false;
+
+
+ if( !$field_list.children('.acf-field-object').length ) {
+
+ $show = $field_list.children('.no-fields-message');
+ end_height = $show.outerHeight();
+
+ }
+
+ $el.parent('.temp-field-wrap').animate({ height : end_height }, 250, function(){
+
+ // show another element
+ if( $show ) {
+
+ $show.show();
+
+ }
+
+
+ // action for 3rd party customization
+ acf.do_action('remove', $(this));
+
+
+ // remove $el
+ $(this).remove();
+
+
+ // render fields becuase they have changed
+ self.render_fields();
+
+ });
+
+ },
+
+
+ /*
+ * change_field_type
+ *
+ * This function will update the field's settings based on the new field type
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $select
+ * @return n/a
+ */
+
+ change_field_type: function( $select ){
+
+ // vars
+ var $tbody = $select.closest('tbody'),
+ $el = $tbody.closest('.acf-field-object'),
+ $parent = $el.parent().closest('.acf-field-object'),
+
+ key = $el.attr('data-key'),
+ old_type = $el.attr('data-type'),
+ new_type = $select.val();
+
+
+ // update class
+ $el.removeClass( 'acf-field-object-' + acf.str_replace('_', '-', old_type) );
+ $el.addClass( 'acf-field-object-' + acf.str_replace('_', '-', new_type) );
+
+
+ // update atts
+ $el.attr('data-type', new_type);
+ $el.data('type', new_type);
+
+
+ // abort XHR if this field is already loading AJAX data
+ if( $el.data('xhr') ) {
+
+ $el.data('xhr').abort();
+
+ }
+
+
+ // get settings
+ var $settings = $tbody.children('.acf-field[data-setting="' + old_type + '"]'),
+ html = '';
+
+
+ // populate settings html
+ $settings.each(function(){
+
+ html += $(this).outerHTML();
+
+ });
+
+
+ // remove settings
+ $settings.remove();
+
+
+ // save field settings html
+ acf.update( key + '_settings_' + old_type, html );
+
+
+ // render field
+ this.render_field( $el );
+
+
+ // show field options if they already exist
+ html = acf.get( key + '_settings_' + new_type );
+
+ if( html ) {
+
+ // append settings
+ $tbody.children('.acf-field[data-name="conditional_logic"]').before( html );
+
+
+ // remove field settings html
+ acf.update( key + '_settings_' + new_type, '' );
+
+
+ // trigger event
+ acf.do_action('change_field_type', $el);
+
+
+ // return
+ return;
+ }
+
+
+ // add loading
+ var $tr = $('
');
+
+
+ // add $tr
+ $tbody.children('.acf-field[data-name="conditional_logic"]').before( $tr );
+
+
+ var ajax_data = {
+ action : 'acf/field_group/render_field_settings',
+ nonce : acf.o.nonce,
+ parent : acf.o.post_id,
+ field_group : acf.o.post_id,
+ prefix : $select.attr('name').replace('[type]', ''),
+ type : new_type
+ };
+
+
+ // parent
+ if( $parent.exists() ) {
+
+ ajax_data.parent = this.get_field_meta( $parent, 'ID' );
+
+ }
+
+
+ // ajax
+ var xhr = $.ajax({
+ url: acf.o.ajaxurl,
+ data: ajax_data,
+ type: 'post',
+ dataType: 'html',
+ success: function( html ){
+
+ // bail early if no html
+ if( !html ) {
+
+ return;
+
+ }
+
+
+ // vars
+ var $new_tr = $(html);
+
+
+ // replace
+ $tr.after( $new_tr );
+
+
+ // trigger event
+ acf.do_action('append', $new_tr);
+ acf.do_action('change_field_type', $el);
+
+
+ },
+ complete : function(){
+
+ // this function will also be triggered by $el.data('xhr').abort();
+ $tr.remove();
+
+ }
+ });
+
+
+ // update el data
+ $el.data('xhr', xhr);
+
+ },
+
+ /*
+ * change_field_label
+ *
+ * This function is triggered when changing the field's label
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return n/a
+ */
+
+ change_field_label: function( $el ) {
+
+ // vars
+ var $label = $el.find('.field-label:first'),
+ $name = $el.find('.field-name:first'),
+ type = $el.attr('data-type');
+
+
+ // render name
+ if( $name.val() == '' ) {
+
+ // vars
+ var s = $label.val();
+
+
+ // sanitize
+ s = acf.str_sanitize(s);
+
+
+ // update name
+ $name.val( s ).trigger('change');
+
+ }
+
+
+ // render field
+ this.render_field( $el );
+
+
+ // action for 3rd party customization
+ acf.do_action('change_field_label', $el);
+
+ },
+
+ /*
+ * change_field_name
+ *
+ * This function is triggered when changing the field's name
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return n/a
+ */
+
+ change_field_name: function( $el ) {
+
+ // vars
+ var $name = $el.find('.field-name:first');
+
+ if( $name.val().substr(0, 6) === 'field_' ) {
+
+ alert( acf._e('field_name_start') );
+
+ setTimeout(function(){
+
+ $name.focus();
+
+ }, 1);
+
+ }
+
+
+ // action for 3rd party customization
+ acf.do_action('change_field_name', $el);
+
+ }
+
+ });
+
+
+ /*
+ * field
+ *
+ * This model will handle field events
+ *
+ * @type function
+ * @date 19/08/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ acf.field_group.field = acf.model.extend({
+
+ events: {
+ 'click .edit-field': 'edit',
+ 'click .duplicate-field': 'duplicate',
+ 'click .move-field': 'move',
+ 'click .delete-field': 'delete',
+ 'click .add-field': 'add',
+
+ 'change .field-type': 'change_type',
+ 'blur .field-label': 'change_label',
+ 'blur .field-name': 'change_name',
+
+ 'keyup .field-label': 'render',
+ 'keyup .field-name': 'render',
+ 'change .field-required': 'render',
+
+ 'change .acf-field-object input': 'save',
+ 'change .acf-field-object textarea': 'save',
+ 'change .acf-field-object select': 'save'
+ },
+
+ event: function( e ){
+
+ // append $field
+ e.$field = e.$el.closest('.acf-field-object');
+
+
+ // return
+ return e;
+
+ },
+
+
+ /*
+ * events
+ *
+ * description
+ *
+ * @type function
+ * @date 19/08/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ edit: function( e ){
+
+ acf.field_group.edit_field( e.$field );
+
+ },
+
+ duplicate: function( e ){
+
+ acf.field_group.duplicate_field( e.$field );
+
+ },
+
+ move: function( e ){
+
+ acf.field_group.move_field( e.$field );
+
+ },
+
+ delete: function( e ){
+
+ acf.field_group.delete_field( e.$field );
+
+ },
+
+ add: function( e ){
+
+ var $list = e.$el.closest('.acf-field-list-wrap').children('.acf-field-list');
+
+ acf.field_group.add_field( $list );
+
+ },
+
+ change_type: function( e ){
+
+ acf.field_group.change_field_type( e.$el );
+
+ },
+
+ change_label: function( e ){
+
+ acf.field_group.change_field_label( e.$field );
+
+ },
+
+ change_name: function( e ){
+
+ acf.field_group.change_field_name( e.$field );
+
+ },
+
+ render: function( e ){
+
+ acf.field_group.render_field( e.$field );
+
+ },
+
+ save: function( e ){
+
+ acf.field_group.save_field( e.$field );
+
+ }
+
+ });
+
+
+ /*
+ * conditions
+ *
+ * This model will handle conditional logic events
+ *
+ * @type function
+ * @date 19/08/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ acf.field_group.conditional_logic = acf.model.extend({
+
+ actions: {
+ 'open_field': 'render_field',
+ 'change_field_label': 'render_fields',
+ 'change_field_type': 'render_fields'
+ },
+
+ events: {
+ 'click .add-conditional-rule': 'add_rule',
+ 'click .add-conditional-group': 'add_group',
+ 'click .remove-conditional-rule': 'remove_rule',
+ 'change .conditional-toggle': 'change_toggle',
+ 'change .conditional-rule-param': 'change_param'
+ },
+
+
+ /*
+ * render_fields
+ *
+ * description
+ *
+ * @type function
+ * @date 19/08/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ render_fields: function(){
+
+ var self = this;
+
+ $('.acf-field-object.open').each(function(){
+
+ self.render_field( $(this) );
+
+ });
+
+ },
+
+
+ /*
+ * render_field
+ *
+ * This function will render the conditional logic fields for a given field
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $field
+ * @return n/a
+ */
+
+ render_field: function( $field ){
+
+ // reference
+ var self = this;
+
+
+ // vars
+ var key = $field.attr('data-key');
+ var $lists = $field.parents('.acf-field-list');
+ var $tr = $field.find('.acf-field-setting-conditional_logic:last');
+
+
+ // choices
+ var choices = [];
+
+
+ // loop over ancestor lists
+ $.each( $lists, function( i ){
+
+ // vars
+ var group = (i == 0) ? acf._e('sibling_fields') : acf._e('parent_fields');
+
+
+ // loop over fields
+ $(this).children('.acf-field-object').each(function(){
+
+ // vars
+ var $this_field = $(this),
+ this_key = $this_field.attr('data-key'),
+ this_type = $this_field.attr('data-type'),
+ this_label = $this_field.find('.field-label:first').val();
+
+
+ // validate
+ if( $.inArray(this_type, ['select', 'checkbox', 'true_false', 'radio', 'button_group']) === -1 ) {
+
+ return;
+
+ } else if( this_key == key ) {
+
+ return;
+
+ }
+
+
+ // add this field to available triggers
+ choices.push({
+ value: this_key,
+ label: this_label,
+ group: group
+ });
+
+ });
+
+ });
+
+
+ // empty?
+ if( !choices.length ) {
+
+ choices.push({
+ value: '',
+ label: acf._e('no_fields')
+ });
+
+ }
+
+
+ // create select fields
+ $tr.find('.rule').each(function(){
+
+ self.render_rule( $(this), choices );
+
+ });
+
+ },
+
+
+ /*
+ * populate_triggers
+ *
+ * description
+ *
+ * @type function
+ * @date 22/08/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ render_rule: function( $tr, triggers ) {
+
+ // vars
+ var $trigger = $tr.find('.conditional-rule-param'),
+ $value = $tr.find('.conditional-rule-value');
+
+
+ // populate triggers
+ if( triggers ) {
+
+ acf.render_select( $trigger, triggers );
+
+ }
+
+
+ // vars
+ var $field = $('.acf-field-object[data-key="' + $trigger.val() + '"]'),
+ field_type = $field.attr('data-type'),
+ choices = [];
+
+
+ // populate choices
+ if( field_type == "true_false" ) {
+
+ choices.push({
+ 'value': 1,
+ 'label': acf._e('checked')
+ });
+
+ // select
+ } else if( field_type == "select" || field_type == "checkbox" || field_type == "radio" || field_type == "button_group" ) {
+
+ // vars
+ var lines = $field.find('.acf-field[data-name="choices"] textarea').val().split("\n");
+
+ $.each(lines, function(i, line){
+
+ // explode
+ line = line.split(':');
+
+
+ // default label to value
+ line[1] = line[1] || line[0];
+
+
+ // append
+ choices.push({
+ 'value': $.trim( line[0] ),
+ 'label': $.trim( line[1] )
+ });
+
+ });
+
+
+ // allow null
+ var $allow_null = $field.find('.acf-field[data-name="allow_null"]');
+
+ if( $allow_null.exists() ) {
+
+ if( $allow_null.find('input:checked').val() == '1' ) {
+
+ choices.unshift({
+ 'value': '',
+ 'label': acf._e('null')
+ });
+
+ }
+
+ }
+
+ }
+
+
+ // update select
+ acf.render_select( $value, choices );
+
+ },
+
+
+ /*
+ * change_toggle
+ *
+ * This function is triggered by changing the 'Conditional Logic' radio button
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $input
+ * @return n/a
+ */
+
+ change_toggle: function( e ){
+
+ // vars
+ var $input = e.$el,
+ checked = e.$el.prop('checked'),
+ $td = $input.closest('.acf-input');
+
+
+ if( checked ) {
+
+ $td.find('.rule-groups').show();
+ $td.find('.rule-groups').find('[name]').prop('disabled', false);
+
+ } else {
+
+ $td.find('.rule-groups').hide();
+ $td.find('.rule-groups').find('[name]').prop('disabled', true);
+
+ }
+
+ },
+
+
+ /*
+ * change_trigger
+ *
+ * This function is triggered by changing a 'Conditional Logic' trigger
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $select
+ * @return n/a
+ */
+
+ change_param: function( e ){
+
+ // vars
+ var $rule = e.$el.closest('.rule');
+
+
+ // render
+ this.render_rule( $rule );
+
+ },
+
+
+ /*
+ * add_rule
+ *
+ * This function will add a new rule below the specified $tr
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $tr
+ * @return n/a
+ */
+
+ add_rule: function( e ){
+
+ // vars
+ var $tr = e.$el.closest('tr');
+
+
+ // duplicate
+ $tr2 = acf.duplicate( $tr );
+
+
+ // save field
+ $tr2.find('select:first').trigger('change');
+
+ },
+
+
+ /*
+ * remove_rule
+ *
+ * This function will remove the $tr and potentially the group
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $tr
+ * @return n/a
+ */
+
+ remove_rule: function( e ){
+
+ // vars
+ var $tr = e.$el.closest('tr');
+
+
+ // save field
+ $tr.find('select:first').trigger('change');
+
+
+ if( $tr.siblings('tr').length == 0 ) {
+
+ // remove group
+ $tr.closest('.rule-group').remove();
+
+ }
+
+
+ // remove tr
+ $tr.remove();
+
+
+ },
+
+
+ /*
+ * add_group
+ *
+ * This function will add a new rule group to the given $groups container
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $tr
+ * @return n/a
+ */
+
+ add_group: function( e ){
+
+ // vars
+ var $groups = e.$el.closest('.rule-groups'),
+ $group = $groups.find('.rule-group:last');
+
+
+ // duplicate
+ $group2 = acf.duplicate( $group );
+
+
+ // update h4
+ $group2.find('h4').text( acf._e('or') );
+
+
+ // remove all tr's except the first one
+ $group2.find('tr:not(:first)').remove();
+
+
+ // save field
+ $group2.find('select:first').trigger('change');
+
+ }
+
+ });
+
+
+ /*
+ * locations
+ *
+ * This model will handle location rule events
+ *
+ * @type function
+ * @date 19/08/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ acf.field_group.locations = acf.model.extend({
+
+ events: {
+ 'click .add-location-rule': 'add_rule',
+ 'click .add-location-group': 'add_group',
+ 'click .remove-location-rule': 'remove_rule',
+ 'change .refresh-location-rule': 'change_rule'
+ },
+
+
+ /*
+ * add_rule
+ *
+ * This function will add a new rule below the specified $tr
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $tr
+ * @return n/a
+ */
+
+ add_rule: function( e ){
+
+ // vars
+ var $tr = e.$el.closest('tr');
+
+
+ // duplicate
+ $tr2 = acf.duplicate( $tr );
+
+
+ // action
+ //acf.do_action('add_location_rule', $tr2);
+
+ },
+
+
+ /*
+ * remove_rule
+ *
+ * This function will remove the $tr and potentially the group
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $tr
+ * @return n/a
+ */
+
+ remove_rule: function( e ){
+
+ // vars
+ var $tr = e.$el.closest('tr');
+
+
+ // action
+ //acf.do_action('remove_location_rule', $tr);
+
+
+ // remove
+ if( $tr.siblings('tr').length == 0 ) {
+
+ // remove group
+ $tr.closest('.rule-group').remove();
+
+ } else {
+
+ // remove tr
+ $tr.remove();
+
+ }
+
+ },
+
+
+ /*
+ * add_group
+ *
+ * This function will add a new rule group to the given $groups container
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $tr
+ * @return n/a
+ */
+
+ add_group: function( e ){
+
+ // vars
+ var $groups = e.$el.closest('.rule-groups'),
+ $group = $groups.find('.rule-group:last');
+
+
+ // duplicate
+ $group2 = acf.duplicate( $group );
+
+
+ // update h4
+ $group2.find('h4').text( acf._e('or') );
+
+
+ // remove all tr's except the first one
+ $group2.find('tr:not(:first)').remove();
+
+
+ // vars
+ //var $tr = $group2.find('tr');
+
+
+ // action
+ //acf.do_action('add_location_rule', $tr);
+
+ },
+
+
+ /*
+ * change_rule
+ *
+ * This function is triggered when changing a location rule trigger
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $select
+ * @return n/a
+ */
+
+ change_rule: function( e ){
+
+ // vars
+ var $rule = e.$el.closest('tr');
+ var $group = $rule.closest('.rule-group');
+ var prefix = $rule.find('td.param select').attr('name').replace('[param]', '');
+
+
+ // ajax data
+ var ajaxdata = {
+ action: 'acf/field_group/render_location_rule',
+ rule: acf.serialize( $rule, prefix ),
+ };
+
+
+ // append to data
+ ajaxdata.rule.id = $rule.attr('data-id');
+ ajaxdata.rule.group = $group.attr('data-id');
+
+
+ // ajax
+ $.ajax({
+ url: acf.get('ajaxurl'),
+ data: acf.prepare_for_ajax(ajaxdata),
+ type: 'post',
+ dataType: 'html',
+ success: function( html ){
+
+ // bail early if no html
+ if( !html ) return;
+
+
+ // update
+ $rule.replaceWith( html );
+
+
+ // action
+ //acf.do_action('change_location_rule', $rule);
+
+ }
+ });
+
+ }
+ });
+
+
+ /*
+ * field
+ *
+ * This model sets up many of the field's interactions
+ *
+ * @type function
+ * @date 21/02/2014
+ * @since 3.5.1
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ acf.field_group.field_object = acf.model.extend({
+
+ // vars
+ type: '',
+ o: {},
+ $field: null,
+ $settings: null,
+
+ tag: function( tag ) {
+
+ // vars
+ var type = this.type;
+
+
+ // explode, add 'field' and implode
+ // - open => open_field
+ // - change_type => change_field_type
+ var tags = tag.split('_');
+ tags.splice(1, 0, 'field');
+ tag = tags.join('_');
+
+
+ // add type
+ if( type ) {
+ tag += '/type=' + type;
+ }
+
+
+ // return
+ return tag;
+
+ },
+
+ selector: function(){
+
+ // vars
+ var selector = '.acf-field-object';
+ var type = this.type;
+
+
+ // add type
+ if( type ) {
+ selector += '-' + type;
+ selector = acf.str_replace('_', '-', selector);
+ }
+
+
+ // return
+ return selector;
+
+ },
+
+ _add_action: function( name, callback ) {
+
+ // vars
+ var model = this;
+
+
+ // add action
+ acf.add_action( this.tag(name), function( $field ){
+
+ // focus
+ model.set('$field', $field);
+
+
+ // callback
+ model[ callback ].apply(model, arguments);
+
+ });
+
+ },
+
+ _add_filter: function( name, callback ) {
+
+ // vars
+ var model = this;
+
+
+ // add action
+ acf.add_filter( this.tag(name), function( $field ){
+
+ // focus
+ model.set('$field', $field);
+
+
+ // callback
+ model[ callback ].apply(model, arguments);
+
+ });
+
+ },
+
+ _add_event: function( name, callback ) {
+
+ // vars
+ var model = this;
+ var event = name.substr(0,name.indexOf(' '));
+ var selector = name.substr(name.indexOf(' ')+1);
+ var context = this.selector();
+
+
+ // add event
+ $(document).on(event, context + ' ' + selector, function( e ){
+
+ // append $el to event object
+ e.$el = $(this);
+ e.$field = e.$el.closest('.acf-field-object');
+
+
+ // focus
+ model.set('$field', e.$field);
+
+
+ // callback
+ model[ callback ].apply(model, [e]);
+
+ });
+
+ },
+
+ _set_$field: function(){
+
+ // vars
+ this.o = this.$field.data();
+
+
+ // els
+ this.$settings = this.$field.find('> .settings > table > tbody');
+
+
+ // focus
+ this.focus();
+
+ },
+
+ focus: function(){
+
+ // do nothing
+
+ },
+
+ setting: function( name ) {
+
+ return this.$settings.find('> .acf-field-setting-' + name);
+
+ }
+
+ });
+
+
+ /*
+ * field
+ *
+ * This model fires actions and filters for registered fields
+ *
+ * @type function
+ * @date 21/02/2014
+ * @since 3.5.1
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ acf.field_group.field_objects = acf.model.extend({
+
+ actions: {
+ 'save_field' : '_save_field',
+ 'open_field' : '_open_field',
+ 'close_field' : '_close_field',
+ 'wipe_field' : '_wipe_field',
+ 'add_field' : '_add_field',
+ 'duplicate_field' : '_duplicate_field',
+ 'delete_field' : '_delete_field',
+ 'change_field_type' : '_change_field_type',
+ 'change_field_label' : '_change_field_label',
+ 'change_field_name' : '_change_field_name',
+ 'render_field_settings' : '_render_field_settings'
+ },
+
+ _save_field: function( $el ){
+
+ acf.do_action('save_field/type=' + $el.data('type'), $el);
+
+ },
+
+ _open_field: function( $el ){
+
+ acf.do_action('open_field/type=' + $el.data('type'), $el);
+ acf.do_action('render_field_settings', $el);
+
+ },
+
+ _close_field: function( $el ){
+
+ acf.do_action('close_field/type=' + $el.data('type'), $el);
+
+ },
+
+ _wipe_field: function( $el ){
+
+ acf.do_action('wipe_field/type=' + $el.data('type'), $el);
+
+ },
+
+ _add_field: function( $el ){
+
+ acf.do_action('add_field/type=' + $el.data('type'), $el);
+
+ },
+
+ _duplicate_field: function( $el ){
+
+ acf.do_action('duplicate_field/type=' + $el.data('type'), $el);
+
+ },
+
+ _delete_field: function( $el ){
+
+ acf.do_action('delete_field/type=' + $el.data('type'), $el);
+
+ },
+
+ _change_field_type: function( $el ){
+
+ acf.do_action('change_field_type/type=' + $el.data('type'), $el);
+ acf.do_action('render_field_settings', $el);
+ },
+
+ _change_field_label: function( $el ){
+
+ acf.do_action('change_field_label/type=' + $el.data('type'), $el);
+
+ },
+
+ _change_field_name: function( $el ){
+
+ acf.do_action('change_field_name/type=' + $el.data('type'), $el);
+
+ },
+
+ _render_field_settings: function( $el ){
+
+ acf.do_action('render_field_settings/type=' + $el.data('type'), $el);
+
+ }
+
+ });
+
+
+
+ /*
+ * Append
+ *
+ * This model handles all logic to append fields together
+ *
+ * @type function
+ * @date 12/02/2015
+ * @since 5.5.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ acf.field_group.append = acf.model.extend({
+
+ actions: {
+ 'render_field_settings' : '_render_field_settings'
+ },
+
+ render: function( $el ){
+
+ // vars
+ var append = $el.data('append');
+
+
+ // find sibling
+ $sibling = $el.siblings('[data-name="' + append + '"]');
+
+
+ // bail early if no sibling
+ if( !$sibling.exists() ) return;
+
+
+ // vars
+ var $wrap = $sibling.children('.acf-input'),
+ $ul = $wrap.children('.acf-hl');
+
+
+ // append ul if doesn't exist
+ if( !$ul.exists() ) {
+
+ $wrap.wrapInner('');
+
+ $ul = $wrap.children('.acf-hl');
+
+ }
+
+
+ // create $li
+ var $li = $(' ').append( $el.children('.acf-input').children() );
+
+
+ // append $li
+ $ul.append( $li );
+
+
+ // update cols
+ $ul.attr('data-cols', $ul.children().length );
+
+
+ // remove
+ $el.remove();
+
+ },
+
+ _render_field_settings: function( $el ){
+
+ // reference
+ var self = this;
+
+
+ // loop
+ $el.find('.acf-field[data-append]').each(function(){
+
+ self.render( $(this) );
+
+ });
+
+ }
+
+ });
+
+
+
+ /*
+ * Select
+ *
+ * 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 acf_settings_select = acf.field_group.field_object.extend({
+
+ type: 'select',
+
+ actions: {
+ 'render_settings': 'render'
+ },
+
+ events: {
+ 'change .acf-field-setting-ui input': 'render'
+ },
+
+ render: function( $el ){
+
+ // ui checked
+ if( this.setting('ui input[type="checkbox"]').prop('checked') ) {
+
+ this.setting('ajax').show();
+
+ // ui not checked
+ } else {
+
+ this.setting('ajax').hide();
+ this.setting('ajax input[type="checkbox"]').prop('checked', false).trigger('change');
+
+ }
+
+ }
+
+ });
+
+
+ /*
+ * Radio
+ *
+ * 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 acf_settings_radio = acf.field_group.field_object.extend({
+
+ type: 'radio',
+
+ actions: {
+ 'render_settings': 'render'
+ },
+
+ events: {
+ 'change .acf-field-setting-other_choice input': 'render'
+ },
+
+ render: function( $el ){
+
+ // other_choice checked
+ if( this.setting('other_choice input[type="checkbox"]').prop('checked') ) {
+
+ this.setting('save_other_choice').show();
+
+ // other_choice not checked
+ } else {
+
+ this.setting('save_other_choice').hide();
+ this.setting('save_other_choice input[type="checkbox"]').prop('checked', false).trigger('change');
+
+ }
+
+ }
+
+ });
+
+
+ /*
+ * Radio
+ *
+ * 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 acf_settings_checkbox = acf.field_group.field_object.extend({
+
+ type: 'checkbox',
+
+ actions: {
+ 'render_settings': 'render'
+ },
+
+ events: {
+ 'change .acf-field-setting-allow_custom input': 'render'
+ },
+
+ render: function( $el ){
+
+ // other_choice checked
+ if( this.setting('allow_custom input[type="checkbox"]').prop('checked') ) {
+
+ this.setting('save_custom').show();
+
+ // other_choice not checked
+ } else {
+
+ this.setting('save_custom').hide();
+ this.setting('save_custom input[type="checkbox"]').prop('checked', false).trigger('change');
+
+ }
+
+ }
+
+ });
+
+
+ /*
+ * True false
+ *
+ * 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 acf_settings_true_false = acf.field_group.field_object.extend({
+
+ type: 'true_false',
+
+ actions: {
+ 'render_settings': 'render'
+ },
+
+ events: {
+ 'change .acf-field-setting-ui input': 'render'
+ },
+
+ render: function( $el ){
+
+ // ui checked
+ if( this.setting('ui input[type="checkbox"]').prop('checked') ) {
+
+ this.setting('ui_on_text').show();
+ this.setting('ui_off_text').show();
+
+ // ui not checked
+ } else {
+
+ this.setting('ui_on_text').hide();
+ this.setting('ui_off_text').hide();
+
+ }
+
+ }
+
+ });
+
+
+ /*
+ * Date Picker
+ *
+ * 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 acf_settings_date_picker = acf.field_group.field_object.extend({
+
+ type: 'date_picker',
+
+ actions: {
+ 'render_settings': 'render'
+ },
+
+ events: {
+ 'change .acf-field-setting-display_format input': 'render',
+ 'change .acf-field-setting-return_format input': 'render'
+ },
+
+ render: function( $el ){
+
+ this.render_list( this.setting('display_format') );
+ this.render_list( this.setting('return_format') );
+
+ },
+
+ render_list: function( $setting ){
+
+ // vars
+ var $ul = $setting.find('ul'),
+ $radio = $ul.find('input[type="radio"]:checked'),
+ $other = $ul.find('input[type="text"]');
+
+
+ // display val
+ if( $radio.val() != 'other' ) {
+
+ $other.val( $radio.val() );
+
+ }
+
+ }
+
+ });
+
+
+ /*
+ * Date Time Picker
+ *
+ * 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 acf_settings_date_time_picker = acf_settings_date_picker.extend({
+
+ type: 'date_time_picker'
+
+ });
+
+
+ /*
+ * Time Picker
+ *
+ * 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 acf_settings_date_time_picker = acf_settings_date_picker.extend({
+
+ type: 'time_picker'
+
+ });
+
+
+ /*
+ * tab
+ *
+ * description
+ *
+ * @type function
+ * @date 12/02/2015
+ * @since 5.1.5
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ var acf_settings_tab = acf.field_group.field_object.extend({
+
+ type: 'tab',
+
+ actions: {
+ 'render_settings': 'render'
+ },
+
+ render: function( $el ){
+
+ // clear name
+ this.setting('name input').val('').trigger('change');
+
+
+ // clear required
+ this.setting('required input[type="checkbox"]').prop('checked', false).trigger('change');
+
+ }
+
+ });
+
+
+ /*
+ * message
+ *
+ * description
+ *
+ * @type function
+ * @date 12/02/2015
+ * @since 5.1.5
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ var acf_settings_message = acf_settings_tab.extend({
+
+ type: 'message'
+
+ });
+
+
+ /*
+ * screen
+ *
+ * description
+ *
+ * @type function
+ * @date 23/07/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ acf.field_group.screen = acf.model.extend({
+
+ actions: {
+ 'ready': 'ready'
+ },
+
+ events: {
+ 'click #acf-field-key-hide': 'toggle'
+ },
+
+ ready: function(){
+
+ // vars
+ var $el = $('#adv-settings'),
+ $append = $el.find('#acf-append-show-on-screen');
+
+
+ // append
+ $el.find('.metabox-prefs').append( $append.html() );
+
+
+ // move br
+ $el.find('.metabox-prefs br').remove();
+
+
+ // remove
+ $append.remove();
+
+
+ // render
+ this.render();
+
+ },
+
+ toggle: function( e ){
+
+ // vars
+ var val = e.$el.prop('checked') ? 1 : 0;
+
+
+ // update user setting
+ acf.update_user_setting('show_field_keys', val);
+
+
+ // render $fields
+ this.render();
+
+ },
+
+ render: function(){
+
+ // vars
+ var options = acf.serialize( $('#adv-settings') );
+
+
+ // toggle class
+ var $fields = acf.field_group.$fields;
+
+
+ // show field keys
+ if( options.show_field_keys ) {
+
+ $fields.addClass('show-field-keys');
+
+ } else {
+
+ $fields.removeClass('show-field-keys');
+
+ }
+
+ }
+
+ });
+
+
+ /*
+ * sub fields
+ *
+ * description
+ *
+ * @type function
+ * @date 31/1/17
+ * @since 5.5.6
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ acf.field_group.sub_fields = acf.model.extend({
+
+ actions: {
+ 'open_field': 'update_field_parent',
+ 'sortstop': 'update_field_parent',
+ 'duplicate_field': 'duplicate_field',
+ 'delete_field': 'delete_field',
+ 'change_field_type': 'change_field_type'
+ },
+
+
+ /*
+ * fix_conditional_logic
+ *
+ * This function will update sub field conditional logic rules after duplication
+ *
+ * @type function
+ * @date 10/06/2014
+ * @since 5.0.0
+ *
+ * @param $fields (jquery selection)
+ * @return n/a
+ */
+
+ fix_conditional_logic : function( $fields ){
+
+ // build refernce
+ var ref = {};
+
+ $fields.each(function(){
+
+ ref[ $(this).attr('data-orig') ] = $(this).attr('data-key');
+
+ });
+
+
+ $fields.find('.conditional-rule-param').each(function(){
+
+ // vars
+ var key = $(this).val();
+
+
+ // bail early if val is not a ref key
+ if( !(key in ref) ) {
+
+ return;
+
+ }
+
+
+ // add option if doesn't yet exist
+ if( ! $(this).find('option[value="' + ref[key] + '"]').exists() ) {
+
+ $(this).append('' + ref[key] + ' ');
+
+ }
+
+
+ // set new val
+ $(this).val( ref[key] );
+
+ });
+
+ },
+
+
+ /*
+ * update_field_parent
+ *
+ * This function will update field meta such as parent
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return n/a
+ */
+
+ update_field_parent: function( $el ){
+
+ // bail early if not div.field (flexible content tr)
+ if( !$el.hasClass('acf-field-object') ) return;
+
+
+ // vars
+ var $parent = $el.parent().closest('.acf-field-object'),
+ val = acf.get('post_id');
+
+
+ // find parent
+ if( $parent.exists() ) {
+
+ // set as parent ID
+ val = acf.field_group.get_field_meta( $parent, 'ID' );
+
+
+ // if parent is new, no ID exists
+ if( !val ) {
+
+ val = acf.field_group.get_field_meta( $parent, 'key' );
+
+ }
+
+ }
+
+
+ // update parent
+ acf.field_group.update_field_meta( $el, 'parent', val );
+
+
+ // action for 3rd party customization
+ acf.do_action('update_field_parent', $el, $parent);
+
+ },
+
+
+ /*
+ * duplicate_field
+ *
+ * This function is triggered when duplicating a field
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return n/a
+ */
+
+ duplicate_field: function( $el ) {
+
+ // vars
+ var $fields = $el.find('.acf-field-object');
+
+
+ // bail early if $fields are empty
+ if( !$fields.exists() ) {
+
+ return;
+
+ }
+
+
+ // loop over sub fields
+ $fields.each(function(){
+
+ // vars
+ var $parent = $(this).parent().closest('.acf-field-object'),
+ key = acf.field_group.get_field_meta( $parent, 'key');
+
+
+ // wipe field
+ acf.field_group.wipe_field( $(this) );
+
+
+ // update parent
+ acf.field_group.update_field_meta( $(this), 'parent', key );
+
+
+ // save field
+ acf.field_group.save_field( $(this) );
+
+
+ });
+
+
+ // fix conditional logic rules
+ this.fix_conditional_logic( $fields );
+
+ },
+
+
+ /*
+ * delete_field
+ *
+ * This function is triggered when deleting a field
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $el
+ * @return n/a
+ */
+
+ delete_field : function( $el ){
+
+ $el.find('.acf-field-object').each(function(){
+
+ acf.field_group.delete_field( $(this), false );
+
+ });
+
+ },
+
+
+ /*
+ * change_field_type
+ *
+ * This function is triggered when changing a field type
+ *
+ * @type function
+ * @date 7/06/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ change_field_type : function( $el ) {
+
+ $el.find('.acf-field-object').each(function(){
+
+ acf.field_group.delete_field( $(this), false );
+
+ });
+
+ }
+
+ });
+
+})(jQuery);
+
+// @codekit-prepend "../js/field-group.js";
+
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.min.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.min.js
new file mode 100644
index 0000000..badd648
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.min.js
@@ -0,0 +1 @@
+!function($){acf.field_group=acf.model.extend({$fields:null,$locations:null,$options:null,actions:{ready:"init"},events:{"submit #post":"submit",'click a[href="#"]':"preventDefault","click .submitdelete":"trash","mouseenter .acf-field-list":"sortable"},init:function(){this.$fields=$("#acf-field-group-fields"),this.$locations=$("#acf-field-group-locations"),this.$options=$("#acf-field-group-options"),acf.validation.active=0},sortable:function(e){if(!e.$el.hasClass("ui-sortable")){var t=this;e.$el.sortable({handle:".acf-sortable-handle",connectWith:".acf-field-list",start:function(e,t){t.placeholder.height(t.item.height())},update:function(e,i){var a=i.item;t.render_fields(),acf.do_action("sortstop",a)}})}},preventDefault:function(e){e.preventDefault()},get_selector:function(e){e=e||"";var t=".acf-field-object";return e&&(t+="-"+e,t=t.split("_").join("-")),t},render_fields:function(){var e=this;$(".acf-field-list").each(function(){var t=$(this).children(".acf-field-object");t.each(function(t){e.update_field_meta($(this),"menu_order",t),$(this).children(".handle").find(".acf-icon").html(t+1)}),t.exists()?$(this).children(".no-fields-message").hide():$(this).children(".no-fields-message").show()})},get_field_meta:function(e,t){var i=e.find("> .meta > .input-"+t);return!!i.exists()&&i.val()},update_field_meta:function(e,t,i){var a=e.find("> .meta > .input-"+t);if(!a.exists()){var n=e.find("> .meta > .input-ID").outerHTML();n=acf.str_replace("ID",t,n),a=$(n),a.val(i),e.children(".meta").append(a)}a.val()!=i&&(a.val(i),"save"!=t&&this.save_field(e,"meta"))},delete_field_meta:function(e,t){var i=e.find("> .meta > .input-"+t);i.exists()&&(i.remove(),this.save_field(e,"meta"))},save_field:function(e,t){t=t||"settings";var i=this.get_field_meta(e,"save");"settings"!=i&&i!=t&&(this.update_field_meta(e,"save",t),acf.do_action("save_field",e,t))},submit:function(e){var t=this,i=$("#titlewrap #title");i.val()||(e.preventDefault(),acf.validation.toggle(e.$el,"unlock"),alert(acf._e("title_is_required")),i.focus()),$(".acf-field-object").each(function(){var e=t.get_field_meta($(this),"save"),i=t.get_field_meta($(this),"ID");$(this).hasClass("open")&&t.close_field($(this)),"settings"==e||("meta"==e?$(this).children(".settings").find('[name^="acf_fields['+i+']"]').remove():$(this).find('[name^="acf_fields['+i+']"]').remove())})},trash:function(e){confirm(acf._e("move_to_trash"))||e.preventDefault()},render_field:function(e){var t=e.find(".field-label:first").val(),i=e.find(".field-name:first").val(),a=e.find(".field-type:first option:selected").text(),n=e.find(".field-required:first").prop("checked"),d=e.children(".handle");d.find(".li-field-label strong a").html(t),d.find(".li-field-label .acf-required").remove(),n&&d.find(".li-field-label strong").append('* '),d.find(".li-field-name").text(i),d.find(".li-field-type").text(a),acf.do_action("render_field_handle",e,d)},edit_field:function(e){e.hasClass("open")?this.close_field(e):this.open_field(e)},open_field:function(e){if(e.hasClass("open"))return!1;e.addClass("open"),acf.do_action("open_field",e),e.children(".settings").animate({height:"toggle"},250)},close_field:function(e){if(!e.hasClass("open"))return!1;e.removeClass("open"),acf.do_action("close_field",e),e.children(".settings").animate({height:"toggle"},250)},wipe_field:function(e){var t=e.attr("data-id"),i=e.attr("data-key"),a=acf.get_uniqid(),n="field_"+a;e.attr("data-id",a),e.attr("data-key",n),e.attr("data-orig",i),this.update_field_meta(e,"ID",""),this.update_field_meta(e,"key",n),e.find('[id*="'+t+'"]').each(function(){$(this).attr("id",$(this).attr("id").replace(t,a))}),e.find('[name*="'+t+'"]').each(function(){$(this).attr("name",$(this).attr("name").replace(t,a))}),e.find("> .handle .pre-field-key").text(n),e.find(".ui-sortable").removeClass("ui-sortable"),acf.do_action("wipe_field",e)},add_field:function(e){var t=$($("#tmpl-acf-field").html()),i=t.find(".field-label:first"),a=t.find(".field-name:first");this.wipe_field(t),e.append(t),i.val(""),a.val(""),setTimeout(function(){i.focus()},251),this.render_fields(),acf.do_action("append",t),this.edit_field(t),acf.do_action("add_field",t)},duplicate_field:function(e){acf.do_action("before_duplicate",e);var t=e.clone(),i=t.find(".field-label:first"),a=t.find(".field-name:first");acf.do_action("remove",t),this.wipe_field(t),acf.do_action("after_duplicate",e,t),e.after(t),acf.do_action("append",t),setTimeout(function(){i.focus()},251),this.render_fields(),e.hasClass("open")?this.close_field(e):this.open_field(t);var n=i.val(),d=a.val(),l=d.split("_").pop(),f=acf._e("copy");if(0===l.indexOf(f)){var c=1*l.replace(f,"");c=c?c+1:2,n=n.replace(l,f+c),d=d.replace(l,f+c)}else n+=" ("+f+")",d+="_"+f;return i.val(n),a.val(d),this.save_field(t),this.render_field(t),acf.do_action("duplicate_field",t),t},move_field:function(e){var t=this,i=acf.prepare_for_ajax({action:"acf/field_group/move_field",field_id:this.get_field_meta(e,"ID")}),a=!1;if(i.field_id?"settings"==this.get_field_meta(e,"save")?a=!0:e.find(".acf-field-object").each(function(){if(!t.get_field_meta($(this),"ID"))return a=!0,!1;"settings"==t.get_field_meta($(this),"save")&&(a=!0)}):a=!0,a)return void alert(acf._e("move_field_warning"));acf.open_popup({title:acf._e("move_field"),loading:!0,height:145}),$.ajax({url:acf.get("ajaxurl"),data:i,type:"post",dataType:"html",success:function(i){t.move_field_confirm(e,i)}})},move_field_confirm:function(e,t){var i=this;acf.update_popup({content:t});var a=acf.prepare_for_ajax({action:"acf/field_group/move_field",field_id:this.get_field_meta(e,"ID"),field_group_id:0});$("#acf-move-field-form").on("submit",function(){return a.field_group_id=$(this).find("select").val(),$.ajax({url:acf.get("ajaxurl"),data:a,type:"post",dataType:"html",success:function(t){acf.update_popup({content:t}),i.remove_field(e)}}),!1})},delete_field:function(e,t){t=t||!0;var i=this.get_field_meta(e,"ID");if(i){var a=$("#_acf_delete_fields");a.val(a.val()+"|"+i)}acf.do_action("delete_field",e),t&&this.remove_field(e)},remove_field:function(e){var t=this,i=e.closest(".acf-field-list");e.css({height:e.height(),width:e.width(),position:"absolute"}),e.wrap('
'),e.animate({opacity:0},250);var a=0,n=!1;i.children(".acf-field-object").length||(n=i.children(".no-fields-message"),a=n.outerHeight()),e.parent(".temp-field-wrap").animate({height:a},250,function(){n&&n.show(),acf.do_action("remove",$(this)),$(this).remove(),t.render_fields()})},change_field_type:function(e){var t=e.closest("tbody"),i=t.closest(".acf-field-object"),a=i.parent().closest(".acf-field-object"),n=i.attr("data-key"),d=i.attr("data-type"),l=e.val();i.removeClass("acf-field-object-"+acf.str_replace("_","-",d)),i.addClass("acf-field-object-"+acf.str_replace("_","-",l)),i.attr("data-type",l),i.data("type",l),i.data("xhr")&&i.data("xhr").abort();var f=t.children('.acf-field[data-setting="'+d+'"]'),c="";if(f.each(function(){c+=$(this).outerHTML()}),f.remove(),acf.update(n+"_settings_"+d,c),this.render_field(i),c=acf.get(n+"_settings_"+l))return t.children('.acf-field[data-name="conditional_logic"]').before(c),acf.update(n+"_settings_"+l,""),void acf.do_action("change_field_type",i);var r=$('
');t.children('.acf-field[data-name="conditional_logic"]').before(r);var o={action:"acf/field_group/render_field_settings",nonce:acf.o.nonce,parent:acf.o.post_id,field_group:acf.o.post_id,prefix:e.attr("name").replace("[type]",""),type:l};a.exists()&&(o.parent=this.get_field_meta(a,"ID"));var s=$.ajax({url:acf.o.ajaxurl,data:o,type:"post",dataType:"html",success:function(e){if(e){var t=$(e);r.after(t),acf.do_action("append",t),acf.do_action("change_field_type",i)}},complete:function(){r.remove()}});i.data("xhr",s)},change_field_label:function(e){var t=e.find(".field-label:first"),i=e.find(".field-name:first"),a=e.attr("data-type");if(""==i.val()){var n=t.val();n=acf.str_sanitize(n),i.val(n).trigger("change")}this.render_field(e),acf.do_action("change_field_label",e)},change_field_name:function(e){var t=e.find(".field-name:first");"field_"===t.val().substr(0,6)&&(alert(acf._e("field_name_start")),setTimeout(function(){t.focus()},1)),acf.do_action("change_field_name",e)}}),acf.field_group.field=acf.model.extend({events:{"click .edit-field":"edit","click .duplicate-field":"duplicate","click .move-field":"move","click .delete-field":"delete","click .add-field":"add","change .field-type":"change_type","blur .field-label":"change_label","blur .field-name":"change_name","keyup .field-label":"render","keyup .field-name":"render","change .field-required":"render","change .acf-field-object input":"save","change .acf-field-object textarea":"save","change .acf-field-object select":"save"},event:function(e){return e.$field=e.$el.closest(".acf-field-object"),e},edit:function(e){acf.field_group.edit_field(e.$field)},duplicate:function(e){acf.field_group.duplicate_field(e.$field)},move:function(e){acf.field_group.move_field(e.$field)},delete:function(e){acf.field_group.delete_field(e.$field)},add:function(e){var t=e.$el.closest(".acf-field-list-wrap").children(".acf-field-list");acf.field_group.add_field(t)},change_type:function(e){acf.field_group.change_field_type(e.$el)},change_label:function(e){acf.field_group.change_field_label(e.$field)},change_name:function(e){acf.field_group.change_field_name(e.$field)},render:function(e){acf.field_group.render_field(e.$field)},save:function(e){acf.field_group.save_field(e.$field)}}),acf.field_group.conditional_logic=acf.model.extend({actions:{open_field:"render_field",change_field_label:"render_fields",change_field_type:"render_fields"},events:{"click .add-conditional-rule":"add_rule","click .add-conditional-group":"add_group","click .remove-conditional-rule":"remove_rule","change .conditional-toggle":"change_toggle","change .conditional-rule-param":"change_param"},render_fields:function(){var e=this;$(".acf-field-object.open").each(function(){e.render_field($(this))})},render_field:function(e){var t=this,i=e.attr("data-key"),a=e.parents(".acf-field-list"),n=e.find(".acf-field-setting-conditional_logic:last"),d=[];$.each(a,function(e){var t=0==e?acf._e("sibling_fields"):acf._e("parent_fields");$(this).children(".acf-field-object").each(function(){var e=$(this),a=e.attr("data-key"),n=e.attr("data-type"),l=e.find(".field-label:first").val();-1!==$.inArray(n,["select","checkbox","true_false","radio","button_group"])&&a!=i&&d.push({value:a,label:l,group:t})})}),d.length||d.push({value:"",label:acf._e("no_fields")}),n.find(".rule").each(function(){t.render_rule($(this),d)})},render_rule:function(e,t){var i=e.find(".conditional-rule-param"),a=e.find(".conditional-rule-value");t&&acf.render_select(i,t);var n=$('.acf-field-object[data-key="'+i.val()+'"]'),d=n.attr("data-type"),l=[];if("true_false"==d)l.push({value:1,label:acf._e("checked")});else if("select"==d||"checkbox"==d||"radio"==d||"button_group"==d){var f=n.find('.acf-field[data-name="choices"] textarea').val().split("\n");$.each(f,function(e,t){t=t.split(":"),t[1]=t[1]||t[0],l.push({value:$.trim(t[0]),label:$.trim(t[1])})});var c=n.find('.acf-field[data-name="allow_null"]');c.exists()&&"1"==c.find("input:checked").val()&&l.unshift({value:"",label:acf._e("null")})}acf.render_select(a,l)},change_toggle:function(e){var t=e.$el,i=e.$el.prop("checked"),a=t.closest(".acf-input");i?(a.find(".rule-groups").show(),a.find(".rule-groups").find("[name]").prop("disabled",!1)):(a.find(".rule-groups").hide(),a.find(".rule-groups").find("[name]").prop("disabled",!0))},change_param:function(e){var t=e.$el.closest(".rule");this.render_rule(t)},add_rule:function(e){var t=e.$el.closest("tr");$tr2=acf.duplicate(t),$tr2.find("select:first").trigger("change")},remove_rule:function(e){var t=e.$el.closest("tr");t.find("select:first").trigger("change"),0==t.siblings("tr").length&&t.closest(".rule-group").remove(),t.remove()},add_group:function(e){var t=e.$el.closest(".rule-groups"),i=t.find(".rule-group:last");$group2=acf.duplicate(i),$group2.find("h4").text(acf._e("or")),$group2.find("tr:not(:first)").remove(),$group2.find("select:first").trigger("change")}}),acf.field_group.locations=acf.model.extend({events:{"click .add-location-rule":"add_rule","click .add-location-group":"add_group","click .remove-location-rule":"remove_rule","change .refresh-location-rule":"change_rule"},add_rule:function(e){var t=e.$el.closest("tr");$tr2=acf.duplicate(t)},remove_rule:function(e){var t=e.$el.closest("tr");0==t.siblings("tr").length?t.closest(".rule-group").remove():t.remove()},add_group:function(e){var t=e.$el.closest(".rule-groups"),i=t.find(".rule-group:last");$group2=acf.duplicate(i),$group2.find("h4").text(acf._e("or")),$group2.find("tr:not(:first)").remove()},change_rule:function(e){var t=e.$el.closest("tr"),i=t.closest(".rule-group"),a=t.find("td.param select").attr("name").replace("[param]",""),n={action:"acf/field_group/render_location_rule",rule:acf.serialize(t,a)};n.rule.id=t.attr("data-id"),n.rule.group=i.attr("data-id"),$.ajax({url:acf.get("ajaxurl"),data:acf.prepare_for_ajax(n),type:"post",dataType:"html",success:function(e){e&&t.replaceWith(e)}})}}),acf.field_group.field_object=acf.model.extend({type:"",o:{},$field:null,$settings:null,tag:function(e){var t=this.type,i=e.split("_");return i.splice(1,0,"field"),e=i.join("_"),t&&(e+="/type="+t),e},selector:function(){var e=".acf-field-object",t=this.type;return t&&(e+="-"+t,e=acf.str_replace("_","-",e)),e},_add_action:function(e,t){var i=this;acf.add_action(this.tag(e),function(e){i.set("$field",e),i[t].apply(i,arguments)})},_add_filter:function(e,t){var i=this;acf.add_filter(this.tag(e),function(e){i.set("$field",e),i[t].apply(i,arguments)})},_add_event:function(e,t){var i=this,a=e.substr(0,e.indexOf(" ")),n=e.substr(e.indexOf(" ")+1),d=this.selector();$(document).on(a,d+" "+n,function(e){e.$el=$(this),e.$field=e.$el.closest(".acf-field-object"),i.set("$field",e.$field),i[t].apply(i,[e])})},_set_$field:function(){this.o=this.$field.data(),this.$settings=this.$field.find("> .settings > table > tbody"),this.focus()},focus:function(){},setting:function(e){return this.$settings.find("> .acf-field-setting-"+e)}}),acf.field_group.field_objects=acf.model.extend({actions:{save_field:"_save_field",open_field:"_open_field",close_field:"_close_field",wipe_field:"_wipe_field",add_field:"_add_field",duplicate_field:"_duplicate_field",delete_field:"_delete_field",change_field_type:"_change_field_type",change_field_label:"_change_field_label",change_field_name:"_change_field_name",render_field_settings:"_render_field_settings"},_save_field:function(e){acf.do_action("save_field/type="+e.data("type"),e)},_open_field:function(e){acf.do_action("open_field/type="+e.data("type"),e),acf.do_action("render_field_settings",e)},_close_field:function(e){acf.do_action("close_field/type="+e.data("type"),e)},_wipe_field:function(e){acf.do_action("wipe_field/type="+e.data("type"),e)},_add_field:function(e){acf.do_action("add_field/type="+e.data("type"),e)},_duplicate_field:function(e){acf.do_action("duplicate_field/type="+e.data("type"),e)},_delete_field:function(e){acf.do_action("delete_field/type="+e.data("type"),e)},_change_field_type:function(e){acf.do_action("change_field_type/type="+e.data("type"),e),acf.do_action("render_field_settings",e)},_change_field_label:function(e){acf.do_action("change_field_label/type="+e.data("type"),e)},_change_field_name:function(e){acf.do_action("change_field_name/type="+e.data("type"),e)},_render_field_settings:function(e){acf.do_action("render_field_settings/type="+e.data("type"),e)}}),acf.field_group.append=acf.model.extend({actions:{render_field_settings:"_render_field_settings"},render:function(e){var t=e.data("append");if($sibling=e.siblings('[data-name="'+t+'"]'),$sibling.exists()){var i=$sibling.children(".acf-input"),a=i.children(".acf-hl");a.exists()||(i.wrapInner(''),a=i.children(".acf-hl"));var n=$(" ").append(e.children(".acf-input").children());a.append(n),a.attr("data-cols",a.children().length),e.remove()}},_render_field_settings:function(e){var t=this;e.find(".acf-field[data-append]").each(function(){t.render($(this))})}});var e=acf.field_group.field_object.extend({type:"select",actions:{render_settings:"render"},events:{"change .acf-field-setting-ui input":"render"},render:function(e){this.setting('ui input[type="checkbox"]').prop("checked")?this.setting("ajax").show():(this.setting("ajax").hide(),this.setting('ajax input[type="checkbox"]').prop("checked",!1).trigger("change"))}}),t=acf.field_group.field_object.extend({type:"radio",actions:{render_settings:"render"},events:{"change .acf-field-setting-other_choice input":"render"},render:function(e){this.setting('other_choice input[type="checkbox"]').prop("checked")?this.setting("save_other_choice").show():(this.setting("save_other_choice").hide(),this.setting('save_other_choice input[type="checkbox"]').prop("checked",!1).trigger("change"))}}),i=acf.field_group.field_object.extend({type:"checkbox",actions:{render_settings:"render"},events:{"change .acf-field-setting-allow_custom input":"render"},render:function(e){this.setting('allow_custom input[type="checkbox"]').prop("checked")?this.setting("save_custom").show():(this.setting("save_custom").hide(),this.setting('save_custom input[type="checkbox"]').prop("checked",!1).trigger("change"))}}),a=acf.field_group.field_object.extend({type:"true_false",actions:{render_settings:"render"},events:{"change .acf-field-setting-ui input":"render"},render:function(e){this.setting('ui input[type="checkbox"]').prop("checked")?(this.setting("ui_on_text").show(),this.setting("ui_off_text").show()):(this.setting("ui_on_text").hide(),this.setting("ui_off_text").hide())}}),n=acf.field_group.field_object.extend({type:"date_picker",actions:{render_settings:"render"},events:{"change .acf-field-setting-display_format input":"render","change .acf-field-setting-return_format input":"render"},render:function(e){this.render_list(this.setting("display_format")),this.render_list(this.setting("return_format"))},render_list:function(e){var t=e.find("ul"),i=t.find('input[type="radio"]:checked'),a=t.find('input[type="text"]');"other"!=i.val()&&a.val(i.val())}}),d=n.extend({type:"date_time_picker"}),d=n.extend({type:"time_picker"}),l=acf.field_group.field_object.extend({type:"tab",actions:{render_settings:"render"},render:function(e){this.setting("name input").val("").trigger("change"),this.setting('required input[type="checkbox"]').prop("checked",!1).trigger("change")}}),f=l.extend({type:"message"});acf.field_group.screen=acf.model.extend({actions:{ready:"ready"},events:{"click #acf-field-key-hide":"toggle"},ready:function(){var e=$("#adv-settings"),t=e.find("#acf-append-show-on-screen");e.find(".metabox-prefs").append(t.html()),e.find(".metabox-prefs br").remove(),t.remove(),this.render()},toggle:function(e){var t=e.$el.prop("checked")?1:0;acf.update_user_setting("show_field_keys",t),this.render()},render:function(){var e=acf.serialize($("#adv-settings")),t=acf.field_group.$fields;e.show_field_keys?t.addClass("show-field-keys"):t.removeClass("show-field-keys")}}),acf.field_group.sub_fields=acf.model.extend({actions:{open_field:"update_field_parent",sortstop:"update_field_parent",duplicate_field:"duplicate_field",delete_field:"delete_field",change_field_type:"change_field_type"},fix_conditional_logic:function(e){var t={};e.each(function(){t[$(this).attr("data-orig")]=$(this).attr("data-key")}),e.find(".conditional-rule-param").each(function(){var e=$(this).val();e in t&&($(this).find('option[value="'+t[e]+'"]').exists()||$(this).append(''+t[e]+" "),$(this).val(t[e]))})},update_field_parent:function(e){if(e.hasClass("acf-field-object")){var t=e.parent().closest(".acf-field-object"),i=acf.get("post_id");t.exists()&&((i=acf.field_group.get_field_meta(t,"ID"))||(i=acf.field_group.get_field_meta(t,"key"))),acf.field_group.update_field_meta(e,"parent",i),acf.do_action("update_field_parent",e,t)}},duplicate_field:function(e){var t=e.find(".acf-field-object");t.exists()&&(t.each(function(){var e=$(this).parent().closest(".acf-field-object"),t=acf.field_group.get_field_meta(e,"key");acf.field_group.wipe_field($(this)),acf.field_group.update_field_meta($(this),"parent",t),acf.field_group.save_field($(this))}),this.fix_conditional_logic(t))},delete_field:function(e){e.find(".acf-field-object").each(function(){acf.field_group.delete_field($(this),!1)})},change_field_type:function(e){e.find(".acf-field-object").each(function(){acf.field_group.delete_field($(this),!1)})}})}(jQuery);
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-input.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-input.js
new file mode 100644
index 0000000..942e098
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-input.js
@@ -0,0 +1,14515 @@
+( function( window, undefined ) {
+ "use strict";
+
+ /**
+ * Handles managing all events for whatever you plug it into. Priorities for hooks are based on lowest to highest in
+ * that, lowest priority hooks are fired first.
+ */
+ var EventManager = function() {
+ /**
+ * Maintain a reference to the object scope so our public methods never get confusing.
+ */
+ var MethodsAvailable = {
+ removeFilter : removeFilter,
+ applyFilters : applyFilters,
+ addFilter : addFilter,
+ removeAction : removeAction,
+ doAction : doAction,
+ addAction : addAction,
+ storage : getStorage
+ };
+
+ /**
+ * Contains the hooks that get registered with this EventManager. The array for storage utilizes a "flat"
+ * object literal such that looking up the hook utilizes the native object literal hash.
+ */
+ var STORAGE = {
+ actions : {},
+ filters : {}
+ };
+
+ function getStorage() {
+
+ return STORAGE;
+
+ };
+
+ /**
+ * Adds an action to the event manager.
+ *
+ * @param action Must contain namespace.identifier
+ * @param callback Must be a valid callback function before this action is added
+ * @param [priority=10] Used to control when the function is executed in relation to other callbacks bound to the same hook
+ * @param [context] Supply a value to be used for this
+ */
+ function addAction( action, callback, priority, context ) {
+ if( typeof action === 'string' && typeof callback === 'function' ) {
+ priority = parseInt( ( priority || 10 ), 10 );
+ _addHook( 'actions', action, callback, priority, context );
+ }
+
+ return MethodsAvailable;
+ }
+
+ /**
+ * Performs an action if it exists. You can pass as many arguments as you want to this function; the only rule is
+ * that the first argument must always be the action.
+ */
+ function doAction( /* action, arg1, arg2, ... */ ) {
+ var args = Array.prototype.slice.call( arguments );
+ var action = args.shift();
+
+ if( typeof action === 'string' ) {
+ _runHook( 'actions', action, args );
+ }
+
+ return MethodsAvailable;
+ }
+
+ /**
+ * Removes the specified action if it contains a namespace.identifier & exists.
+ *
+ * @param action The action to remove
+ * @param [callback] Callback function to remove
+ */
+ function removeAction( action, callback ) {
+ if( typeof action === 'string' ) {
+ _removeHook( 'actions', action, callback );
+ }
+
+ return MethodsAvailable;
+ }
+
+ /**
+ * Adds a filter to the event manager.
+ *
+ * @param filter Must contain namespace.identifier
+ * @param callback Must be a valid callback function before this action is added
+ * @param [priority=10] Used to control when the function is executed in relation to other callbacks bound to the same hook
+ * @param [context] Supply a value to be used for this
+ */
+ function addFilter( filter, callback, priority, context ) {
+ if( typeof filter === 'string' && typeof callback === 'function' ) {
+ priority = parseInt( ( priority || 10 ), 10 );
+ _addHook( 'filters', filter, callback, priority, context );
+ }
+
+ return MethodsAvailable;
+ }
+
+ /**
+ * Performs a filter if it exists. You should only ever pass 1 argument to be filtered. The only rule is that
+ * the first argument must always be the filter.
+ */
+ function applyFilters( /* filter, filtered arg, arg2, ... */ ) {
+ var args = Array.prototype.slice.call( arguments );
+ var filter = args.shift();
+
+ if( typeof filter === 'string' ) {
+ return _runHook( 'filters', filter, args );
+ }
+
+ return MethodsAvailable;
+ }
+
+ /**
+ * Removes the specified filter if it contains a namespace.identifier & exists.
+ *
+ * @param filter The action to remove
+ * @param [callback] Callback function to remove
+ */
+ function removeFilter( filter, callback ) {
+ if( typeof filter === 'string') {
+ _removeHook( 'filters', filter, callback );
+ }
+
+ return MethodsAvailable;
+ }
+
+ /**
+ * Removes the specified hook by resetting the value of it.
+ *
+ * @param type Type of hook, either 'actions' or 'filters'
+ * @param hook The hook (namespace.identifier) to remove
+ * @private
+ */
+ function _removeHook( type, hook, callback, context ) {
+ if ( !STORAGE[ type ][ hook ] ) {
+ return;
+ }
+ if ( !callback ) {
+ STORAGE[ type ][ hook ] = [];
+ } else {
+ var handlers = STORAGE[ type ][ hook ];
+ var i;
+ if ( !context ) {
+ for ( i = handlers.length; i--; ) {
+ if ( handlers[i].callback === callback ) {
+ handlers.splice( i, 1 );
+ }
+ }
+ }
+ else {
+ for ( i = handlers.length; i--; ) {
+ var handler = handlers[i];
+ if ( handler.callback === callback && handler.context === context) {
+ handlers.splice( i, 1 );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Adds the hook to the appropriate storage container
+ *
+ * @param type 'actions' or 'filters'
+ * @param hook The hook (namespace.identifier) to add to our event manager
+ * @param callback The function that will be called when the hook is executed.
+ * @param priority The priority of this hook. Must be an integer.
+ * @param [context] A value to be used for this
+ * @private
+ */
+ function _addHook( type, hook, callback, priority, context ) {
+ var hookObject = {
+ callback : callback,
+ priority : priority,
+ context : context
+ };
+
+ // Utilize 'prop itself' : http://jsperf.com/hasownproperty-vs-in-vs-undefined/19
+ var hooks = STORAGE[ type ][ hook ];
+ if( hooks ) {
+ hooks.push( hookObject );
+ hooks = _hookInsertSort( hooks );
+ }
+ else {
+ hooks = [ hookObject ];
+ }
+
+ STORAGE[ type ][ hook ] = hooks;
+ }
+
+ /**
+ * Use an insert sort for keeping our hooks organized based on priority. This function is ridiculously faster
+ * than bubble sort, etc: http://jsperf.com/javascript-sort
+ *
+ * @param hooks The custom array containing all of the appropriate hooks to perform an insert sort on.
+ * @private
+ */
+ function _hookInsertSort( hooks ) {
+ var tmpHook, j, prevHook;
+ for( var i = 1, len = hooks.length; i < len; i++ ) {
+ tmpHook = hooks[ i ];
+ j = i;
+ while( ( prevHook = hooks[ j - 1 ] ) && prevHook.priority > tmpHook.priority ) {
+ hooks[ j ] = hooks[ j - 1 ];
+ --j;
+ }
+ hooks[ j ] = tmpHook;
+ }
+
+ return hooks;
+ }
+
+ /**
+ * Runs the specified hook. If it is an action, the value is not modified but if it is a filter, it is.
+ *
+ * @param type 'actions' or 'filters'
+ * @param hook The hook ( namespace.identifier ) to be ran.
+ * @param args Arguments to pass to the action/filter. If it's a filter, args is actually a single parameter.
+ * @private
+ */
+ function _runHook( type, hook, args ) {
+ var handlers = STORAGE[ type ][ hook ];
+
+ if ( !handlers ) {
+ return (type === 'filters') ? args[0] : false;
+ }
+
+ var i = 0, len = handlers.length;
+ if ( type === 'filters' ) {
+ for ( ; i < len; i++ ) {
+ args[ 0 ] = handlers[ i ].callback.apply( handlers[ i ].context, args );
+ }
+ } else {
+ for ( ; i < len; i++ ) {
+ handlers[ i ].callback.apply( handlers[ i ].context, args );
+ }
+ }
+
+ return ( type === 'filters' ) ? args[ 0 ] : true;
+ }
+
+ // return all of the publicly available methods
+ return MethodsAvailable;
+
+ };
+
+ window.wp = window.wp || {};
+ window.wp.hooks = new EventManager();
+
+} )( window );
+
+
+var acf;
+
+(function($){
+
+
+ /*
+ * exists
+ *
+ * This function will return true if a jQuery selection exists
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return (boolean)
+ */
+
+ $.fn.exists = function() {
+
+ return $(this).length>0;
+
+ };
+
+
+ /*
+ * outerHTML
+ *
+ * This function will return a string containing the HTML of the selected element
+ *
+ * @type function
+ * @date 19/11/2013
+ * @since 5.0.0
+ *
+ * @param $.fn
+ * @return (string)
+ */
+
+ $.fn.outerHTML = function() {
+
+ return $(this).get(0).outerHTML;
+
+ };
+
+
+ acf = {
+
+ // vars
+ l10n: {},
+ o: {},
+
+
+ /*
+ * update
+ *
+ * This function will update a value found in acf.o
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param k (string) the key
+ * @param v (mixed) the value
+ * @return n/a
+ */
+
+ update: function( k, v ){
+
+ this.o[ k ] = v;
+
+ },
+
+
+ /*
+ * get
+ *
+ * This function will return a value found in acf.o
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param k (string) the key
+ * @return v (mixed) the value
+ */
+
+ get: function( k ){
+
+ if( typeof this.o[ k ] !== 'undefined' ) {
+
+ return this.o[ k ];
+
+ }
+
+ return null;
+
+ },
+
+
+ /*
+ * _e
+ *
+ * This functiln will return a string found in acf.l10n
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param k1 (string) the first key to look for
+ * @param k2 (string) the second key to look for
+ * @return string (string)
+ */
+
+ _e: function( k1, k2 ){
+
+ // defaults
+ k2 = k2 || false;
+
+
+ // get context
+ var string = this.l10n[ k1 ] || '';
+
+
+ // get string
+ if( k2 ) {
+
+ string = string[ k2 ] || '';
+
+ }
+
+
+ // return
+ return string;
+
+ },
+
+
+ /*
+ * add_action
+ *
+ * This function uses wp.hooks to mimics WP add_action
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param
+ * @return
+ */
+
+ add_action: function() {
+
+ // vars
+ var a = arguments[0].split(' '),
+ l = a.length;
+
+
+ // loop
+ for( var i = 0; i < l; i++) {
+
+/*
+ // allow for special actions
+ if( a[i].indexOf('initialize') !== -1 ) {
+
+ a.push( a[i].replace('initialize', 'ready') );
+ a.push( a[i].replace('initialize', 'append') );
+ l = a.length;
+
+ continue;
+ }
+*/
+
+
+ // prefix action
+ arguments[0] = 'acf/' + a[i];
+
+
+ // add
+ wp.hooks.addAction.apply(this, arguments);
+
+ }
+
+
+ // return
+ return this;
+
+ },
+
+
+ /*
+ * remove_action
+ *
+ * This function uses wp.hooks to mimics WP remove_action
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param
+ * @return
+ */
+
+ remove_action: function() {
+
+ // prefix action
+ arguments[0] = 'acf/' + arguments[0];
+
+ wp.hooks.removeAction.apply(this, arguments);
+
+ return this;
+
+ },
+
+
+ /*
+ * do_action
+ *
+ * This function uses wp.hooks to mimics WP do_action
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param
+ * @return
+ */
+
+ do_action: function() { //console.log('acf.do_action(%o)', arguments);
+
+ // prefix action
+ arguments[0] = 'acf/' + arguments[0];
+
+ wp.hooks.doAction.apply(this, arguments);
+
+ return this;
+
+ },
+
+
+ /*
+ * add_filter
+ *
+ * This function uses wp.hooks to mimics WP add_filter
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param
+ * @return
+ */
+
+ add_filter: function() {
+
+ // prefix action
+ arguments[0] = 'acf/' + arguments[0];
+
+ wp.hooks.addFilter.apply(this, arguments);
+
+ return this;
+
+ },
+
+
+ /*
+ * remove_filter
+ *
+ * This function uses wp.hooks to mimics WP remove_filter
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param
+ * @return
+ */
+
+ remove_filter: function() {
+
+ // prefix action
+ arguments[0] = 'acf/' + arguments[0];
+
+ wp.hooks.removeFilter.apply(this, arguments);
+
+ return this;
+
+ },
+
+
+ /*
+ * apply_filters
+ *
+ * This function uses wp.hooks to mimics WP apply_filters
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param
+ * @return
+ */
+
+ apply_filters: function() { //console.log('acf.apply_filters(%o)', arguments);
+
+ // prefix action
+ arguments[0] = 'acf/' + arguments[0];
+
+ return wp.hooks.applyFilters.apply(this, arguments);
+
+ },
+
+
+ /*
+ * get_selector
+ *
+ * This function will return a valid selector for finding a field object
+ *
+ * @type function
+ * @date 15/01/2015
+ * @since 5.1.5
+ *
+ * @param s (string)
+ * @return (string)
+ */
+
+ get_selector: function( s ) {
+
+ // defaults
+ s = s || '';
+
+
+ // vars
+ var selector = '.acf-field';
+
+
+ // compatibility with object
+ if( $.isPlainObject(s) ) {
+
+ if( $.isEmptyObject(s) ) {
+
+ s = '';
+
+ } else {
+
+ for( k in s ) { s = s[k]; break; }
+
+ }
+
+ }
+
+
+ // search
+ if( s ) {
+
+ // append
+ selector += '-' + s;
+
+
+ // replace underscores (split/join replaces all and is faster than regex!)
+ selector = selector.split('_').join('-');
+
+
+ // remove potential double up
+ selector = selector.split('field-field-').join('field-');
+
+ }
+
+
+ // return
+ return selector;
+
+ },
+
+
+ /*
+ * get_fields
+ *
+ * This function will return a jQuery selection of fields
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param args (object)
+ * @param $el (jQuery) element to look within
+ * @param all (boolean) return all fields or allow filtering (for repeater)
+ * @return $fields (jQuery)
+ */
+
+ get_fields: function( s, $el, all ){
+
+ // debug
+ //console.log( 'acf.get_fields(%o, %o, %o)', args, $el, all );
+ //console.time("acf.get_fields");
+
+
+ // defaults
+ s = s || '';
+ $el = $el || false;
+ all = all || false;
+
+
+ // vars
+ var selector = this.get_selector(s);
+
+
+ // get child fields
+ var $fields = $( selector, $el );
+
+
+ // append context to fields if also matches selector.
+ // * Required for field group 'change_filed_type' append $tr to work
+ if( $el !== false ) {
+
+ $el.each(function(){
+
+ if( $(this).is(selector) ) {
+
+ $fields = $fields.add( $(this) );
+
+ }
+
+ });
+
+ }
+
+
+ // filter out fields
+ if( !all ) {
+
+ // remove clone fields
+ $fields = $fields.not('.acf-clone .acf-field');
+
+
+ // filter
+ $fields = acf.apply_filters('get_fields', $fields);
+
+ }
+
+
+ //console.log('get_fields(%o, %o, %o) %o', s, $el, all, $fields);
+ //console.log('acf.get_fields(%o):', this.get_selector(s) );
+ //console.timeEnd("acf.get_fields");
+
+
+ // return
+ return $fields;
+
+ },
+
+
+ /*
+ * get_field
+ *
+ * This function will return a jQuery selection based on a field key
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param field_key (string)
+ * @param $el (jQuery) element to look within
+ * @return $field (jQuery)
+ */
+
+ get_field: function( s, $el ){
+
+ // defaults
+ s = s || '';
+ $el = $el || false;
+
+
+ // get fields
+ var $fields = this.get_fields(s, $el, true);
+
+
+ // check if exists
+ if( $fields.exists() ) {
+
+ return $fields.first();
+
+ }
+
+
+ // return
+ return false;
+
+ },
+
+
+ /*
+ * get_closest_field
+ *
+ * This function will return the closest parent field
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param $el (jQuery) element to start from
+ * @param args (object)
+ * @return $field (jQuery)
+ */
+
+ get_closest_field : function( $el, s ){
+
+ // defaults
+ s = s || '';
+
+
+ // return
+ return $el.closest( this.get_selector(s) );
+
+ },
+
+
+ /*
+ * get_field_wrap
+ *
+ * This function will return the closest parent field
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param $el (jQuery) element to start from
+ * @return $field (jQuery)
+ */
+
+ get_field_wrap: function( $el ){
+
+ return $el.closest( this.get_selector() );
+
+ },
+
+
+ /*
+ * get_field_key
+ *
+ * This function will return the field's key
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param $field (jQuery)
+ * @return (string)
+ */
+
+ get_field_key: function( $field ){
+
+ return $field.data('key');
+
+ },
+
+
+ /*
+ * get_field_type
+ *
+ * This function will return the field's type
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param $field (jQuery)
+ * @return (string)
+ */
+
+ get_field_type: function( $field ){
+
+ return $field.data('type');
+
+ },
+
+
+ /*
+ * get_data
+ *
+ * This function will return attribute data for a given elemnt
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param $el (jQuery)
+ * @param name (mixed)
+ * @return (mixed)
+ */
+
+ get_data: function( $el, defaults ){
+
+ // get data
+ var data = $el.data();
+
+
+ // defaults
+ if( typeof defaults === 'object' ) {
+
+ data = this.parse_args( data, defaults );
+
+ }
+
+
+ // return
+ return data;
+
+ },
+
+
+ /*
+ * get_uniqid
+ *
+ * This function will return a unique string ID
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param prefix (string)
+ * @param more_entropy (boolean)
+ * @return (string)
+ */
+
+ get_uniqid : function( prefix, more_entropy ){
+
+ // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+ // + revised by: Kankrelune (http://www.webfaktory.info/)
+ // % note 1: Uses an internal counter (in php_js global) to avoid collision
+ // * example 1: uniqid();
+ // * returns 1: 'a30285b160c14'
+ // * example 2: uniqid('foo');
+ // * returns 2: 'fooa30285b1cd361'
+ // * example 3: uniqid('bar', true);
+ // * returns 3: 'bara20285b23dfd1.31879087'
+ if (typeof prefix === 'undefined') {
+ prefix = "";
+ }
+
+ var retId;
+ var formatSeed = function (seed, reqWidth) {
+ seed = parseInt(seed, 10).toString(16); // to hex str
+ if (reqWidth < seed.length) { // so long we split
+ return seed.slice(seed.length - reqWidth);
+ }
+ if (reqWidth > seed.length) { // so short we pad
+ return Array(1 + (reqWidth - seed.length)).join('0') + seed;
+ }
+ return seed;
+ };
+
+ // BEGIN REDUNDANT
+ if (!this.php_js) {
+ this.php_js = {};
+ }
+ // END REDUNDANT
+ if (!this.php_js.uniqidSeed) { // init seed with big random int
+ this.php_js.uniqidSeed = Math.floor(Math.random() * 0x75bcd15);
+ }
+ this.php_js.uniqidSeed++;
+
+ retId = prefix; // start with prefix, add current milliseconds hex string
+ retId += formatSeed(parseInt(new Date().getTime() / 1000, 10), 8);
+ retId += formatSeed(this.php_js.uniqidSeed, 5); // add seed hex string
+ if (more_entropy) {
+ // for more entropy we add a float lower to 10
+ retId += (Math.random() * 10).toFixed(8).toString();
+ }
+
+ return retId;
+
+ },
+
+
+ /*
+ * serialize_form
+ *
+ * This function will create an object of data containing all form inputs within an element
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param $el (jQuery selection)
+ * @return $post_id (int)
+ */
+
+ serialize_form: function(){
+
+ return this.serialize.apply( this, arguments );
+
+ },
+
+ serialize: function( $el, prefix ){
+
+ // defaults
+ prefix = prefix || '';
+
+
+ // vars
+ var data = {};
+ var names = {};
+ var values = $el.find('select, textarea, input').serializeArray();
+
+
+ // populate data
+ $.each( values, function( i, pair ) {
+
+ // vars
+ var name = pair.name;
+ var value = pair.value;
+
+
+ // prefix
+ if( prefix ) {
+
+ // bail early if does not contain
+ if( name.indexOf(prefix) !== 0 ) return;
+
+
+ // remove prefix
+ name = name.slice(prefix.length);
+
+
+ // name must not start as array piece
+ if( name.slice(0, 1) == '[' ) {
+
+ name = name.slice(1).replace(']', '');
+
+ }
+
+ }
+
+
+ // initiate name
+ if( name.slice(-2) === '[]' ) {
+
+ // remove []
+ name = name.slice(0, -2);
+
+
+ // initiate counter
+ if( typeof names[ name ] === 'undefined'){
+
+ names[ name ] = -1;
+
+ }
+
+
+ // increase counter
+ names[ name ]++;
+
+
+ // add key
+ name += '[' + names[ name ] +']';
+ }
+
+
+ // append to data
+ data[ name ] = value;
+
+ });
+
+
+ //console.log('serialize', data);
+
+
+ // return
+ return data;
+
+ },
+
+/*
+ serialize: function( $el, prefix ){
+
+ // defaults
+ prefix = prefix || '';
+
+
+ // vars
+ var data = {};
+ var $inputs = $el.find('select, textarea, input');
+
+
+ // loop
+ $inputs.each(function(){
+
+ // vars
+ var $el = $(this);
+ var name = $el.attr('name');
+ var val = $el.val();
+
+
+ // is array
+ var is_array = ( name.slice(-2) === '[]' );
+ if( is_array ) {
+ name = name.slice(0, -2);
+ }
+
+
+ // explode name
+ var bits = name.split('[');
+ var depth = bits.length;
+
+
+ // loop
+ for( var i = 0; i < depth; i++ ) {
+
+ // vars
+ var k = bits[i];
+
+
+ // end
+ if( i == depth-1 ) {
+
+
+
+
+ // not end
+ } else {
+
+ // must be object
+ if( typeof data[k] !== 'object' ) {
+ data[k] = {};
+ }
+
+ }
+
+
+ }
+
+
+ bits.map(function( s ){ return s.replace(']', ''); })
+
+
+ });
+
+ },
+*/
+
+
+ /*
+ * disable
+ *
+ * This function will disable an input
+ *
+ * @type function
+ * @date 22/09/2016
+ * @since 5.4.0
+ *
+ * @param $el (jQuery)
+ * @param context (string)
+ * @return n/a
+ */
+
+ disable: function( $input, context ){
+
+ // defaults
+ context = context || '';
+
+
+ // bail early if is .acf-disabled
+ if( $input.hasClass('acf-disabled') ) return false;
+
+
+ // always disable input
+ $input.prop('disabled', true);
+
+
+ // context
+ if( context ) {
+
+ // vars
+ var disabled = $input.data('acf_disabled') || [],
+ i = disabled.indexOf(context);
+
+
+ // append context if not found
+ if( i < 0 ) {
+
+ // append
+ disabled.push( context );
+
+
+ // update
+ $input.data('acf_disabled', disabled);
+
+ }
+ }
+
+
+ // return
+ return true;
+
+ },
+
+
+ /*
+ * enable
+ *
+ * This function will enable an input
+ *
+ * @type function
+ * @date 22/09/2016
+ * @since 5.4.0
+ *
+ * @param $el (jQuery)
+ * @param context (string)
+ * @return n/a
+ */
+
+ enable: function( $input, context ){
+
+ // defaults
+ context = context || '';
+
+
+ // bail early if is .acf-disabled
+ if( $input.hasClass('acf-disabled') ) return false;
+
+
+ // vars
+ var disabled = $input.data('acf_disabled') || [];
+
+
+ // context
+ if( context ) {
+
+ // vars
+ var i = disabled.indexOf(context);
+
+
+ // remove context if found
+ if( i > -1 ) {
+
+ // delete
+ disabled.splice(i, 1);
+
+
+ // update
+ $input.data('acf_disabled', disabled);
+
+ }
+ }
+
+
+ // bail early if other disabled exist
+ if( disabled.length ) return false;
+
+
+ // enable input
+ $input.prop('disabled', false);
+
+
+ // return
+ return true;
+
+ },
+
+
+ /*
+ * disable_el
+ *
+ * This function will disable all inputs within an element
+ *
+ * @type function
+ * @date 22/09/2016
+ * @since 5.4.0
+ *
+ * @param $el (jQuery)
+ * @param context (string)
+ * @return na
+ */
+
+ disable_el: function( $el, context ) {
+
+ // defaults
+ context = context || '';
+
+
+ // loop
+ $el.find('select, textarea, input').each(function(){
+
+ acf.disable( $(this), context );
+
+ });
+
+ },
+
+ disable_form: function( $el, context ) {
+
+ this.disable_el.apply( this, arguments );
+
+ },
+
+
+ /*
+ * enable_el
+ *
+ * This function will enable all inputs within an element
+ *
+ * @type function
+ * @date 22/09/2016
+ * @since 5.4.0
+ *
+ * @param $el (jQuery)
+ * @param context (string)
+ * @return na
+ */
+
+ enable_el: function( $el, context ) {
+
+ // defaults
+ context = context || '';
+
+
+ // loop
+ $el.find('select, textarea, input').each(function(){
+
+ acf.enable( $(this), context );
+
+ });
+
+ },
+
+ enable_form: function( $el, context ) {
+
+ this.enable_el.apply( this, arguments );
+
+ },
+
+
+ /*
+ * remove_tr
+ *
+ * This function will remove a tr element with animation
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param $tr (jQuery selection)
+ * @param callback (function) runs on complete
+ * @return n/a
+ */
+
+ remove_tr : function( $tr, callback ){
+
+ // vars
+ var height = $tr.height(),
+ children = $tr.children().length;
+
+
+ // add class
+ $tr.addClass('acf-remove-element');
+
+
+ // after animation
+ setTimeout(function(){
+
+ // remove class
+ $tr.removeClass('acf-remove-element');
+
+
+ // vars
+ $tr.html(' ');
+
+
+ $tr.children('td').animate({ height : 0}, 250, function(){
+
+ $tr.remove();
+
+ if( typeof(callback) == 'function' ) {
+
+ callback();
+
+ }
+
+
+ });
+
+
+ }, 250);
+
+ },
+
+
+ /*
+ * remove_el
+ *
+ * This function will remove an element with animation
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param $el (jQuery selection)
+ * @param callback (function) runs on complete
+ * @param end_height (int)
+ * @return n/a
+ */
+
+ remove_el : function( $el, callback, end_height ){
+
+ // defaults
+ end_height = end_height || 0;
+
+
+ // vars
+ var height = $el.height(),
+ width = $el.width(),
+ margin = $el.css('margin'),
+ outer_height = $el.outerHeight(true);
+
+
+ // action
+ acf.do_action('remove', $el);
+
+
+ // create wrap
+ $el.wrap('
');
+ var $wrap = $el.parent();
+
+
+ // set pos
+ $el.css({
+ height: height,
+ width: width,
+ margin: margin,
+ position: 'absolute'
+ });
+
+
+ // fade
+ setTimeout(function(){
+
+ // aniamte
+ $wrap.css({
+ opacity: 0,
+ height: end_height
+ });
+
+ }, 50);
+
+
+ // animate complete
+ setTimeout(function(){
+
+ // remove wrap
+ $wrap.remove();
+
+
+ // callback
+ if( typeof(callback) == 'function' ) {
+ callback.apply(this, arguments);
+ }
+
+ }, 301);
+
+ },
+
+
+ /*
+ * isset
+ *
+ * This function will return true if an object key exists
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param (object)
+ * @param key1 (string)
+ * @param key2 (string)
+ * @param ...
+ * @return (boolean)
+ */
+
+ isset : function(){
+
+ var a = arguments,
+ l = a.length,
+ c = null,
+ undef;
+
+ if (l === 0) {
+ throw new Error('Empty isset');
+ }
+
+ c = a[0];
+
+ for (i = 1; i < l; i++) {
+
+ if (a[i] === undef || c[ a[i] ] === undef) {
+ return false;
+ }
+
+ c = c[ a[i] ];
+
+ }
+
+ return true;
+
+ },
+
+
+ /*
+ * maybe_get
+ *
+ * This function will attempt to return a value and return null if not possible
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param obj (object) the array to look within
+ * @param key (key) the array key to look for. Nested values may be found using '/'
+ * @param value (mixed) the value returned if not found
+ * @return (mixed)
+ */
+
+ maybe_get: function( obj, key, value ){
+
+ // default
+ if( typeof value == 'undefined' ) value = null;
+
+
+ // convert type to string and split
+ keys = String(key).split('.');
+
+
+ // loop through keys
+ for( var i in keys ) {
+
+ // vars
+ var key = keys[i];
+
+
+ // bail ealry if not set
+ if( typeof obj[ key ] === 'undefined' ) {
+
+ return value;
+
+ }
+
+
+ // update obj
+ obj = obj[ key ];
+
+ }
+
+
+ // return
+ return obj;
+
+ },
+
+
+ /*
+ * open_popup
+ *
+ * This function will create and open a popup modal
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param args (object)
+ * @return n/a
+ */
+
+ open_popup : function( args ){
+
+ // vars
+ $popup = $('body > #acf-popup');
+
+
+ // already exists?
+ if( $popup.exists() ) {
+
+ return update_popup(args);
+
+ }
+
+
+ // template
+ var tmpl = [
+ ''
+ ].join('');
+
+
+ // append
+ $('body').append( tmpl );
+
+
+ $('#acf-popup').on('click', '.bg, .acf-close-popup', function( e ){
+
+ e.preventDefault();
+
+ acf.close_popup();
+
+ });
+
+
+ // update
+ return this.update_popup(args);
+
+ },
+
+
+ /*
+ * update_popup
+ *
+ * This function will update the content within a popup modal
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param args (object)
+ * @return n/a
+ */
+
+ update_popup : function( args ){
+
+ // vars
+ $popup = $('#acf-popup');
+
+
+ // validate
+ if( !$popup.exists() )
+ {
+ return false
+ }
+
+
+ // defaults
+ args = $.extend({}, {
+ title : '',
+ content : '',
+ width : 0,
+ height : 0,
+ loading : false
+ }, args);
+
+
+ if( args.title ) {
+
+ $popup.find('.title h3').html( args.title );
+
+ }
+
+ if( args.content ) {
+
+ $inner = $popup.find('.inner:first');
+
+ $inner.html( args.content );
+
+ acf.do_action('append', $inner);
+
+ // update height
+ $inner.attr('style', 'position: relative;');
+ args.height = $inner.outerHeight();
+ $inner.removeAttr('style');
+
+ }
+
+ if( args.width ) {
+
+ $popup.find('.acf-popup-box').css({
+ 'width' : args.width,
+ 'margin-left' : 0 - (args.width / 2)
+ });
+
+ }
+
+ if( args.height ) {
+
+ // add h3 height (44)
+ args.height += 44;
+
+ $popup.find('.acf-popup-box').css({
+ 'height' : args.height,
+ 'margin-top' : 0 - (args.height / 2)
+ });
+
+ }
+
+
+ if( args.loading ) {
+
+ $popup.find('.loading').show();
+
+ } else {
+
+ $popup.find('.loading').hide();
+
+ }
+
+ return $popup;
+ },
+
+
+ /*
+ * close_popup
+ *
+ * This function will close and remove a popup modal
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ close_popup : function(){
+
+ // vars
+ $popup = $('#acf-popup');
+
+
+ // already exists?
+ if( $popup.exists() )
+ {
+ $popup.remove();
+ }
+
+ },
+
+
+ /*
+ * update_user_setting
+ *
+ * This function will send an AJAX request to update a user setting
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ update_user_setting : function( name, value ) {
+
+ // ajax
+ $.ajax({
+ url : acf.get('ajaxurl'),
+ dataType : 'html',
+ type : 'post',
+ data : acf.prepare_for_ajax({
+ 'action' : 'acf/update_user_setting',
+ 'name' : name,
+ 'value' : value
+ })
+ });
+
+ },
+
+
+ /*
+ * prepare_for_ajax
+ *
+ * This function will prepare data for an AJAX request
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param args (object)
+ * @return args
+ */
+
+ prepare_for_ajax : function( args ) {
+
+ // vars
+ var data = {};
+
+
+ // $.ajax() expects all args to be 'non-nested'
+ $.each(args, function(k,v){
+
+ // object
+ if( $.isPlainObject(v) && !$.isEmptyObject(v) ) {
+
+ // loop
+ $.each(v, function(k2,v2){
+
+ // convert string
+ k2 = k2 + '';
+
+
+ // vars
+ var i = k2.indexOf('[');
+
+
+ // starts with [
+ if( i == 0 ) {
+
+ k2 = k + k2;
+
+ // contains [
+ } else if( i > 0 ) {
+
+ k2 = k + '[' + k2.slice(0, i) + ']' + k2.slice(i);
+
+ // no [
+ } else {
+
+ k2 = k + '[' + k2 + ']';
+
+ }
+
+
+ // append
+ data[k2] = v2;
+
+ });
+
+ // else
+ } else {
+
+ data[k] = v;
+
+ }
+
+ });
+
+
+ // required
+ data.nonce = acf.get('nonce');
+ data.post_id = acf.get('post_id');
+
+
+ // filter for 3rd party customization
+ data = acf.apply_filters('prepare_for_ajax', data);
+
+
+ // return
+ return data;
+
+ },
+
+
+ /*
+ * is_ajax_success
+ *
+ * This function will return true for a successful WP AJAX response
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param json (object)
+ * @return (boolean)
+ */
+
+ is_ajax_success : function( json ) {
+
+ if( json && json.success ) {
+
+ return true;
+
+ }
+
+ return false;
+
+ },
+
+
+ /*
+ * get_ajax_message
+ *
+ * This function will return an object containing error/message information
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param json (object)
+ * @return (boolean)
+ */
+
+ get_ajax_message: function( json ) {
+
+ // vars
+ var message = {
+ text: '',
+ type: 'error'
+ };
+
+
+ // bail early if no json
+ if( !json ) {
+
+ return message;
+
+ }
+
+
+ // PHP error (too may themes will have warnings / errors. Don't show these in ACF taxonomy popup)
+/*
+ if( typeof json === 'string' ) {
+
+ message.text = json;
+ return message;
+
+ }
+*/
+
+
+ // success
+ if( json.success ) {
+
+ message.type = 'success';
+
+ }
+
+
+ // message
+ if( json.data && json.data.message ) {
+
+ message.text = json.data.message;
+
+ }
+
+
+ // error
+ if( json.data && json.data.error ) {
+
+ message.text = json.data.error;
+
+ }
+
+
+ // return
+ return message;
+
+ },
+
+
+ /*
+ * is_in_view
+ *
+ * This function will return true if a jQuery element is visible in browser
+ *
+ * @type function
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param $el (jQuery)
+ * @return (boolean)
+ */
+
+ is_in_view: function( $el ) {
+
+ // vars
+ var elemTop = $el.offset().top,
+ elemBottom = elemTop + $el.height();
+
+
+ // bail early if hidden
+ if( elemTop === elemBottom ) {
+
+ return false;
+
+ }
+
+
+ // more vars
+ var docViewTop = $(window).scrollTop(),
+ docViewBottom = docViewTop + $(window).height();
+
+
+ // return
+ return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
+
+ },
+
+
+ /*
+ * val
+ *
+ * This function will update an elements value and trigger the change event if different
+ *
+ * @type function
+ * @date 16/10/2014
+ * @since 5.0.9
+ *
+ * @param $el (jQuery)
+ * @param val (mixed)
+ * @return n/a
+ */
+
+ val: function( $el, val ){
+
+ // vars
+ var orig = $el.val();
+
+
+ // update value
+ $el.val( val );
+
+
+ // trigger change
+ if( val != orig ) {
+
+ $el.trigger('change');
+
+ }
+
+ },
+
+
+ /*
+ * str_replace
+ *
+ * This function will perform a str replace similar to php function str_replace
+ *
+ * @type function
+ * @date 1/05/2015
+ * @since 5.2.3
+ *
+ * @param $search (string)
+ * @param $replace (string)
+ * @param $subject (string)
+ * @return (string)
+ */
+
+ str_replace: function( search, replace, subject ) {
+
+ return subject.split(search).join(replace);
+
+ },
+
+
+ /*
+ * str_sanitize
+ *
+ * description
+ *
+ * @type function
+ * @date 4/06/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ str_sanitize: function( string ) {
+
+ // chars (https://jsperf.com/replace-foreign-characters)
+ var map = {
+ "À": "A",
+ "Á": "A",
+ "Â": "A",
+ "Ã": "A",
+ "Ä": "A",
+ "Å": "A",
+ "Æ": "AE",
+ "Ç": "C",
+ "È": "E",
+ "É": "E",
+ "Ê": "E",
+ "Ë": "E",
+ "Ì": "I",
+ "Í": "I",
+ "Î": "I",
+ "Ï": "I",
+ "Ð": "D",
+ "Ñ": "N",
+ "Ò": "O",
+ "Ó": "O",
+ "Ô": "O",
+ "Õ": "O",
+ "Ö": "O",
+ "Ø": "O",
+ "Ù": "U",
+ "Ú": "U",
+ "Û": "U",
+ "Ü": "U",
+ "Ý": "Y",
+ "ß": "s",
+ "à": "a",
+ "á": "a",
+ "â": "a",
+ "ã": "a",
+ "ä": "a",
+ "å": "a",
+ "æ": "ae",
+ "ç": "c",
+ "è": "e",
+ "é": "e",
+ "ê": "e",
+ "ë": "e",
+ "ì": "i",
+ "í": "i",
+ "î": "i",
+ "ï": "i",
+ "ñ": "n",
+ "ò": "o",
+ "ó": "o",
+ "ô": "o",
+ "õ": "o",
+ "ö": "o",
+ "ø": "o",
+ "ù": "u",
+ "ú": "u",
+ "û": "u",
+ "ü": "u",
+ "ý": "y",
+ "ÿ": "y",
+ "Ā": "A",
+ "ā": "a",
+ "Ă": "A",
+ "ă": "a",
+ "Ą": "A",
+ "ą": "a",
+ "Ć": "C",
+ "ć": "c",
+ "Ĉ": "C",
+ "ĉ": "c",
+ "Ċ": "C",
+ "ċ": "c",
+ "Č": "C",
+ "č": "c",
+ "Ď": "D",
+ "ď": "d",
+ "Đ": "D",
+ "đ": "d",
+ "Ē": "E",
+ "ē": "e",
+ "Ĕ": "E",
+ "ĕ": "e",
+ "Ė": "E",
+ "ė": "e",
+ "Ę": "E",
+ "ę": "e",
+ "Ě": "E",
+ "ě": "e",
+ "Ĝ": "G",
+ "ĝ": "g",
+ "Ğ": "G",
+ "ğ": "g",
+ "Ġ": "G",
+ "ġ": "g",
+ "Ģ": "G",
+ "ģ": "g",
+ "Ĥ": "H",
+ "ĥ": "h",
+ "Ħ": "H",
+ "ħ": "h",
+ "Ĩ": "I",
+ "ĩ": "i",
+ "Ī": "I",
+ "ī": "i",
+ "Ĭ": "I",
+ "ĭ": "i",
+ "Į": "I",
+ "į": "i",
+ "İ": "I",
+ "ı": "i",
+ "IJ": "IJ",
+ "ij": "ij",
+ "Ĵ": "J",
+ "ĵ": "j",
+ "Ķ": "K",
+ "ķ": "k",
+ "Ĺ": "L",
+ "ĺ": "l",
+ "Ļ": "L",
+ "ļ": "l",
+ "Ľ": "L",
+ "ľ": "l",
+ "Ŀ": "L",
+ "ŀ": "l",
+ "Ł": "l",
+ "ł": "l",
+ "Ń": "N",
+ "ń": "n",
+ "Ņ": "N",
+ "ņ": "n",
+ "Ň": "N",
+ "ň": "n",
+ "ʼn": "n",
+ "Ō": "O",
+ "ō": "o",
+ "Ŏ": "O",
+ "ŏ": "o",
+ "Ő": "O",
+ "ő": "o",
+ "Œ": "OE",
+ "œ": "oe",
+ "Ŕ": "R",
+ "ŕ": "r",
+ "Ŗ": "R",
+ "ŗ": "r",
+ "Ř": "R",
+ "ř": "r",
+ "Ś": "S",
+ "ś": "s",
+ "Ŝ": "S",
+ "ŝ": "s",
+ "Ş": "S",
+ "ş": "s",
+ "Š": "S",
+ "š": "s",
+ "Ţ": "T",
+ "ţ": "t",
+ "Ť": "T",
+ "ť": "t",
+ "Ŧ": "T",
+ "ŧ": "t",
+ "Ũ": "U",
+ "ũ": "u",
+ "Ū": "U",
+ "ū": "u",
+ "Ŭ": "U",
+ "ŭ": "u",
+ "Ů": "U",
+ "ů": "u",
+ "Ű": "U",
+ "ű": "u",
+ "Ų": "U",
+ "ų": "u",
+ "Ŵ": "W",
+ "ŵ": "w",
+ "Ŷ": "Y",
+ "ŷ": "y",
+ "Ÿ": "Y",
+ "Ź": "Z",
+ "ź": "z",
+ "Ż": "Z",
+ "ż": "z",
+ "Ž": "Z",
+ "ž": "z",
+ "ſ": "s",
+ "ƒ": "f",
+ "Ơ": "O",
+ "ơ": "o",
+ "Ư": "U",
+ "ư": "u",
+ "Ǎ": "A",
+ "ǎ": "a",
+ "Ǐ": "I",
+ "ǐ": "i",
+ "Ǒ": "O",
+ "ǒ": "o",
+ "Ǔ": "U",
+ "ǔ": "u",
+ "Ǖ": "U",
+ "ǖ": "u",
+ "Ǘ": "U",
+ "ǘ": "u",
+ "Ǚ": "U",
+ "ǚ": "u",
+ "Ǜ": "U",
+ "ǜ": "u",
+ "Ǻ": "A",
+ "ǻ": "a",
+ "Ǽ": "AE",
+ "ǽ": "ae",
+ "Ǿ": "O",
+ "ǿ": "o",
+
+ // extra
+ ' ': '_',
+ '\'': '',
+ '?': '',
+ '/': '',
+ '\\': '',
+ '.': '',
+ ',': '',
+ '`': '',
+ '>': '',
+ '<': '',
+ '"': '',
+ '[': '',
+ ']': '',
+ '|': '',
+ '{': '',
+ '}': '',
+ '(': '',
+ ')': ''
+ };
+
+
+ // vars
+ var regexp = /\W/g,
+ mapping = function (c) { return (typeof map[c] !== 'undefined') ? map[c] : c; };
+
+
+ // replace
+ string = string.replace(regexp, mapping);
+
+
+ // lower case
+ string = string.toLowerCase();
+
+
+ // return
+ return string;
+
+ },
+
+
+ /*
+ * addslashes
+ *
+ * This function mimics the PHP addslashes function.
+ * Returns a string with backslashes before characters that need to be escaped.
+ *
+ * @type function
+ * @date 9/1/17
+ * @since 5.5.0
+ *
+ * @param text (string)
+ * @return (string)
+ */
+
+ addslashes: function(text){
+
+ return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
+
+ },
+
+
+ /**
+ * esc_html
+ *
+ * This function will escape HTML characters for safe use
+ *
+ * @source https://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery
+ * @date 20/9/17
+ * @since 5.6.3
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ esc_html: function( string ){
+
+ var entityMap = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": ''',
+ '/': '/',
+ '`': '`',
+ '=': '='
+ };
+
+ return String(string).replace(/[&<>"'`=\/]/g, function (s) {
+ return entityMap[s];
+ });
+
+ },
+
+
+ /*
+ * render_select
+ *
+ * This function will update a select field with new choices
+ *
+ * @type function
+ * @date 8/04/2014
+ * @since 5.0.0
+ *
+ * @param $select
+ * @param choices
+ * @return n/a
+ */
+
+ render_select: function( $select, choices ){
+
+ // vars
+ var value = $select.val();
+
+
+ // clear choices
+ $select.html('');
+
+
+ // bail early if no choices
+ if( !choices ) {
+
+ return;
+
+ }
+
+
+ // populate choices
+ $.each(choices, function( i, item ){
+
+ // vars
+ var $optgroup = $select;
+
+
+ // add group
+ if( item.group ) {
+
+ $optgroup = $select.find('optgroup[label="' + item.group + '"]');
+
+ if( !$optgroup.exists() ) {
+
+ $optgroup = $(' ');
+
+ $select.append( $optgroup );
+
+ }
+
+ }
+
+
+ // append select
+ $optgroup.append( '' + acf.esc_html(item.label) + ' ' );
+
+
+ // selectedIndex
+ if( value == item.value ) {
+
+ $select.prop('selectedIndex', i);
+
+ }
+
+ });
+
+ },
+
+
+ /*
+ * duplicate
+ *
+ * This function will duplicate and return an element
+ *
+ * @type function
+ * @date 22/08/2015
+ * @since 5.2.3
+ *
+ * @param $el (jQuery) object to be duplicated
+ * @param attr (string) attrbute name where $el id can be found
+ * @return $el2 (jQuery)
+ */
+
+ duplicate: function( args ){
+
+ //console.time('duplicate');
+
+
+ // backwards compatibility
+ // - array of settings added in v5.4.6
+ if( typeof args.length !== 'undefined' ) args = { $el: args };
+
+
+ // defaults
+ args = acf.parse_args(args, {
+ $el: false,
+ search: '',
+ replace: '',
+ before: function( $el ){},
+ after: function( $el, $el2 ){},
+ append: function( $el, $el2 ){ $el.after( $el2 ); }
+ });
+
+
+ // vars
+ var $el = args.$el,
+ $el2;
+
+
+ // search
+ if( !args.search ) args.search = $el.attr('data-id');
+
+
+ // replace
+ if( !args.replace ) args.replace = acf.get_uniqid();
+
+
+ // before
+ // - allow acf to modify DOM
+ // - fixes bug where select field option is not selected
+ args.before.apply( this, [$el] );
+ acf.do_action('before_duplicate', $el);
+
+
+ // clone
+ var $el2 = $el.clone();
+
+
+ // remove acf-clone (may be a clone)
+ $el2.removeClass('acf-clone');
+
+
+ // remove JS functionality
+ acf.do_action('remove', $el2);
+
+
+ // find / replace
+ if( args.search ) {
+
+ // replace data
+ $el2.attr('data-id', args.replace);
+
+
+ // replace ids
+ $el2.find('[id*="' + args.search + '"]').each(function(){
+
+ $(this).attr('id', $(this).attr('id').replace(args.search, args.replace) );
+
+ });
+
+
+ // replace names
+ $el2.find('[name*="' + args.search + '"]').each(function(){
+
+ $(this).attr('name', $(this).attr('name').replace(args.search, args.replace) );
+
+ });
+
+
+ // replace label for
+ $el2.find('label[for*="' + args.search + '"]').each(function(){
+
+ $(this).attr('for', $(this).attr('for').replace(args.search, args.replace) );
+
+ });
+
+ }
+
+
+ // remove ui-sortable
+ $el2.find('.ui-sortable').removeClass('ui-sortable');
+
+
+ // after
+ // - allow acf to modify DOM
+ acf.do_action('after_duplicate', $el, $el2 );
+ args.after.apply( this, [$el, $el2] );
+
+
+ // append
+ args.append.apply( this, [$el, $el2] );
+
+
+ // add JS functionality
+ // - allow element to be moved into a visible position before fire action
+ setTimeout(function(){
+
+ acf.do_action('append', $el2);
+
+ }, 1);
+
+
+ //console.timeEnd('duplicate');
+
+
+ // return
+ return $el2;
+
+ },
+
+ decode: function( string ){
+
+ return $('').html( string ).text();
+
+ },
+
+
+ /*
+ * parse_args
+ *
+ * This function will merge together defaults and args much like the WP wp_parse_args function
+ *
+ * @type function
+ * @date 11/04/2016
+ * @since 5.3.8
+ *
+ * @param args (object)
+ * @param defaults (object)
+ * @return args
+ */
+
+ parse_args: function( args, defaults ) {
+
+ // defaults
+ if( typeof args !== 'object' ) args = {};
+ if( typeof defaults !== 'object' ) defaults = {};
+
+
+ // return
+ return $.extend({}, defaults, args);
+
+ },
+
+
+ /*
+ * enqueue_script
+ *
+ * This function will append a script to the page
+ *
+ * @source https://www.nczonline.net/blog/2009/06/23/loading-javascript-without-blocking/
+ * @type function
+ * @date 27/08/2016
+ * @since 5.4.0
+ *
+ * @param url (string)
+ * @param callback (function)
+ * @return na
+ */
+
+ enqueue_script: function( url, callback ) {
+
+ // vars
+ var script = document.createElement('script');
+
+
+ // atts
+ script.type = "text/javascript";
+ script.src = url;
+ script.async = true;
+
+
+ // ie
+ if( script.readyState ) {
+
+ script.onreadystatechange = function(){
+
+ if( script.readyState == 'loaded' || script.readyState == 'complete' ){
+
+ script.onreadystatechange = null;
+ callback();
+
+ }
+
+ };
+
+ // normal browsers
+ } else {
+
+ script.onload = function(){
+ callback();
+ };
+
+ }
+
+
+ // append
+ document.body.appendChild(script);
+
+ }
+
+ };
+
+
+ /*
+ * acf.model
+ *
+ * This model acts as a scafold for action.event driven modules
+ *
+ * @type object
+ * @date 8/09/2014
+ * @since 5.0.0
+ *
+ * @param (object)
+ * @return (object)
+ */
+
+ acf.model = {
+
+ // vars
+ actions: {},
+ filters: {},
+ events: {},
+
+ extend: function( args ){
+
+ // extend
+ var model = $.extend( {}, this, args );
+
+
+ // setup actions
+ $.each(model.actions, function( name, callback ){
+
+ model._add_action( name, callback );
+
+ });
+
+
+ // setup filters
+ $.each(model.filters, function( name, callback ){
+
+ model._add_filter( name, callback );
+
+ });
+
+
+ // setup events
+ $.each(model.events, function( name, callback ){
+
+ model._add_event( name, callback );
+
+ });
+
+
+ // return
+ return model;
+
+ },
+
+ _add_action: function( name, callback ) {
+
+ // split
+ var model = this,
+ data = name.split(' ');
+
+
+ // add missing priority
+ var name = data[0] || '',
+ priority = data[1] || 10;
+
+
+ // add action
+ acf.add_action(name, model[ callback ], priority, model);
+
+ },
+
+ _add_filter: function( name, callback ) {
+
+ // split
+ var model = this,
+ data = name.split(' ');
+
+
+ // add missing priority
+ var name = data[0] || '',
+ priority = data[1] || 10;
+
+
+ // add action
+ acf.add_filter(name, model[ callback ], priority, model);
+
+ },
+
+ _add_event: function( name, callback ) {
+
+ // vars
+ var model = this,
+ i = name.indexOf(' '),
+ event = (i > 0) ? name.substr(0,i) : name,
+ selector = (i > 0) ? name.substr(i+1) : '';
+
+
+ // event
+ var fn = function( e ){
+
+ // append $el to event object
+ e.$el = $(this);
+
+
+ // event
+ if( typeof model.event === 'function' ) {
+ e = model.event( e );
+ }
+
+
+ // callback
+ model[ callback ].apply(model, arguments);
+
+ };
+
+
+ // add event
+ if( selector ) {
+ $(document).on(event, selector, fn);
+ } else {
+ $(document).on(event, fn);
+ }
+
+ },
+
+ get: function( name, value ){
+
+ // defaults
+ value = value || null;
+
+
+ // get
+ if( typeof this[ name ] !== 'undefined' ) {
+
+ value = this[ name ];
+
+ }
+
+
+ // return
+ return value;
+
+ },
+
+
+ set: function( name, value ){
+
+ // set
+ this[ name ] = value;
+
+
+ // function for 3rd party
+ if( typeof this[ '_set_' + name ] === 'function' ) {
+
+ this[ '_set_' + name ].apply(this);
+
+ }
+
+
+ // return for chaining
+ return this;
+
+ }
+
+ };
+
+
+ /*
+ * field
+ *
+ * This model sets up many of the field's interactions
+ *
+ * @type function
+ * @date 21/02/2014
+ * @since 3.5.1
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ acf.field = acf.model.extend({
+
+ // vars
+ type: '',
+ o: {},
+ $field: null,
+
+ _add_action: function( name, callback ) {
+
+ // vars
+ var model = this;
+
+
+ // update name
+ name = name + '_field/type=' + model.type;
+
+
+ // add action
+ acf.add_action(name, function( $field ){
+
+ // focus
+ model.set('$field', $field);
+
+
+ // callback
+ model[ callback ].apply(model, arguments);
+
+ });
+
+ },
+
+ _add_filter: function( name, callback ) {
+
+ // vars
+ var model = this;
+
+
+ // update name
+ name = name + '_field/type=' + model.type;
+
+
+ // add action
+ acf.add_filter(name, function( $field ){
+
+ // focus
+ model.set('$field', $field);
+
+
+ // callback
+ model[ callback ].apply(model, arguments);
+
+ });
+
+ },
+
+ _add_event: function( name, callback ) {
+
+ // vars
+ var model = this,
+ event = name.substr(0,name.indexOf(' ')),
+ selector = name.substr(name.indexOf(' ')+1),
+ context = acf.get_selector(model.type);
+
+
+ // add event
+ $(document).on(event, context + ' ' + selector, function( e ){
+
+ // vars
+ var $el = $(this);
+ var $field = acf.get_closest_field( $el, model.type );
+
+
+ // bail early if no field
+ if( !$field.length ) return;
+
+
+ // focus
+ if( !$field.is(model.$field) ) {
+ model.set('$field', $field);
+ }
+
+
+ // append to event
+ e.$el = $el;
+ e.$field = $field;
+
+
+ // callback
+ model[ callback ].apply(model, [e]);
+
+ });
+
+ },
+
+ _set_$field: function(){
+
+ // callback
+ if( typeof this.focus === 'function' ) {
+ this.focus();
+ }
+
+ },
+
+ // depreciated
+ doFocus: function( $field ){
+
+ return this.set('$field', $field);
+
+ }
+
+ });
+
+
+ /*
+ * field
+ *
+ * This model fires actions and filters for registered fields
+ *
+ * @type function
+ * @date 21/02/2014
+ * @since 3.5.1
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ acf.fields = acf.model.extend({
+
+ actions: {
+ 'prepare' : '_prepare',
+ 'prepare_field' : '_prepare_field',
+ 'ready' : '_ready',
+ 'ready_field' : '_ready_field',
+ 'append' : '_append',
+ 'append_field' : '_append_field',
+ 'load' : '_load',
+ 'load_field' : '_load_field',
+ 'remove' : '_remove',
+ 'remove_field' : '_remove_field',
+ 'sortstart' : '_sortstart',
+ 'sortstart_field' : '_sortstart_field',
+ 'sortstop' : '_sortstop',
+ 'sortstop_field' : '_sortstop_field',
+ 'show' : '_show',
+ 'show_field' : '_show_field',
+ 'hide' : '_hide',
+ 'hide_field' : '_hide_field'
+ },
+
+ // prepare
+ _prepare: function( $el ){
+
+ acf.get_fields('', $el).each(function(){
+
+ acf.do_action('prepare_field', $(this));
+
+ });
+
+ },
+
+ _prepare_field: function( $el ){
+
+ acf.do_action('prepare_field/type=' + $el.data('type'), $el);
+
+ },
+
+ // ready
+ _ready: function( $el ){
+
+ acf.get_fields('', $el).each(function(){
+
+ acf.do_action('ready_field', $(this));
+
+ });
+
+ },
+
+ _ready_field: function( $el ){
+
+ acf.do_action('ready_field/type=' + $el.data('type'), $el);
+
+ },
+
+ // append
+ _append: function( $el ){
+
+ acf.get_fields('', $el).each(function(){
+
+ acf.do_action('append_field', $(this));
+
+ });
+
+ },
+
+ _append_field: function( $el ){
+
+ acf.do_action('append_field/type=' + $el.data('type'), $el);
+
+ },
+
+ // load
+ _load: function( $el ){
+
+ acf.get_fields('', $el).each(function(){
+
+ acf.do_action('load_field', $(this));
+
+ });
+
+ },
+
+ _load_field: function( $el ){
+
+ acf.do_action('load_field/type=' + $el.data('type'), $el);
+
+ },
+
+ // remove
+ _remove: function( $el ){
+
+ acf.get_fields('', $el).each(function(){
+
+ acf.do_action('remove_field', $(this));
+
+ });
+
+ },
+
+ _remove_field: function( $el ){
+
+ acf.do_action('remove_field/type=' + $el.data('type'), $el);
+
+ },
+
+ // sortstart
+ _sortstart: function( $el, $placeholder ){
+
+ acf.get_fields('', $el).each(function(){
+
+ acf.do_action('sortstart_field', $(this), $placeholder);
+
+ });
+
+ },
+
+ _sortstart_field: function( $el, $placeholder ){
+
+ acf.do_action('sortstart_field/type=' + $el.data('type'), $el, $placeholder);
+
+ },
+
+ // sortstop
+ _sortstop: function( $el, $placeholder ){
+
+ acf.get_fields('', $el).each(function(){
+
+ acf.do_action('sortstop_field', $(this), $placeholder);
+
+ });
+
+ },
+
+ _sortstop_field: function( $el, $placeholder ){
+
+ acf.do_action('sortstop_field/type=' + $el.data('type'), $el, $placeholder);
+
+ },
+
+
+ // hide
+ _hide: function( $el, context ){
+
+ acf.get_fields('', $el).each(function(){
+
+ acf.do_action('hide_field', $(this), context);
+
+ });
+
+ },
+
+ _hide_field: function( $el, context ){
+
+ acf.do_action('hide_field/type=' + $el.data('type'), $el, context);
+
+ },
+
+ // show
+ _show: function( $el, context ){
+
+ acf.get_fields('', $el).each(function(){
+
+ acf.do_action('show_field', $(this), context);
+
+ });
+
+ },
+
+ _show_field: function( $el, context ){
+
+ acf.do_action('show_field/type=' + $el.data('type'), $el, context);
+
+ }
+
+ });
+
+
+ /*
+ * ready
+ *
+ * description
+ *
+ * @type function
+ * @date 19/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ $(document).ready(function(){
+
+ // action for 3rd party customization
+ acf.do_action('ready', $('body'));
+
+ });
+
+
+ /*
+ * load
+ *
+ * description
+ *
+ * @type function
+ * @date 19/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ $(window).on('load', function(){
+
+ // action for 3rd party customization
+ acf.do_action('load', $('body'));
+
+ });
+
+
+ /*
+ * layout
+ *
+ * This model handles the width layout for fields
+ *
+ * @type function
+ * @date 21/02/2014
+ * @since 3.5.1
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ acf.layout = acf.model.extend({
+
+ actions: {
+ 'refresh 99': 'refresh'
+ },
+
+ refresh: function( $el ){
+
+ // defaults
+ $el = $el || $('body');
+
+
+ // render
+ this.render_tables( $el );
+ this.render_groups( $el );
+
+ },
+
+ render_tables: function( $el ){
+
+ // reference
+ var self = this;
+
+
+ // vars
+ var $tables = $el.find('.acf-table:visible');
+
+
+ // appent self
+ if( $el.is('table') ) {
+ $tables = $tables.add( $el );
+ } else if( $el.is('tr') ) {
+ $tables = $tables.add( $el.closest('table') );
+ }
+
+
+ // loop
+ $tables.each(function(){
+
+ self.render_table( $(this) );
+
+ });
+
+ },
+
+ render_table: function( $table ){
+
+ // vars
+ var $ths = $table.find('> thead th.acf-th'),
+ colspan = 1,
+ available_width = 100;
+
+
+ // bail early if no $ths
+ if( !$ths.exists() ) return;
+
+
+ // vars
+ var $trs = $table.find('> tbody > tr'),
+ $tds = $trs.find('> td.acf-field');
+
+
+ // remove clones if has visible rows
+ if( $trs.hasClass('acf-clone') && $trs.length > 1 ) {
+
+ $tds = $trs.not('.acf-clone').find('> td.acf-field');
+
+ }
+
+
+ // render th/td visibility
+ $ths.each(function(){
+
+ // vars
+ var $th = $(this),
+ key = $th.attr('data-key'),
+ $td = $tds.filter('[data-key="'+key+'"]');
+
+ // clear class
+ $td.removeClass('appear-empty');
+ $th.removeClass('hidden-by-conditional-logic');
+
+
+ // no td
+ if( !$td.exists() ) {
+
+ // do nothing
+
+ // if all td are hidden
+ } else if( $td.not('.hidden-by-conditional-logic').length == 0 ) {
+
+ $th.addClass('hidden-by-conditional-logic');
+
+ // if 1 or more td are visible
+ } else {
+
+ $td.filter('.hidden-by-conditional-logic').addClass('appear-empty');
+
+ }
+
+ });
+
+
+
+ // clear widths
+ $ths.css('width', 'auto');
+
+
+ // update $ths
+ $ths = $ths.not('.hidden-by-conditional-logic');
+
+
+ // set colspan
+ colspan = $ths.length;
+
+
+ // set custom widths first
+ $ths.filter('[data-width]').each(function(){
+
+ // vars
+ var width = parseInt( $(this).attr('data-width') );
+
+
+ // remove from available
+ available_width -= width;
+
+
+ // set width
+ $(this).css('width', width + '%');
+
+ });
+
+
+ // update $ths
+ $ths = $ths.not('[data-width]');
+
+
+ // set custom widths first
+ $ths.each(function(){
+
+ // cal width
+ var width = available_width / $ths.length;
+
+
+ // set width
+ $(this).css('width', width + '%');
+
+ });
+
+
+ // update colspan
+ $table.find('.acf-row .acf-field.-collapsed-target').removeAttr('colspan');
+ $table.find('.acf-row.-collapsed .acf-field.-collapsed-target').attr('colspan', colspan);
+
+ },
+
+ render_groups: function( $el ){
+
+ // reference
+ var self = this;
+
+
+ // vars
+ var $groups = $el.find('.acf-fields:visible');
+
+
+ // appent self if is '.acf-fields'
+ if( $el && $el.is('.acf-fields') ) {
+
+ $groups = $groups.add( $el );
+
+ }
+
+
+ // loop
+ $groups.each(function(){
+
+ self.render_group( $(this) );
+
+ });
+
+ },
+
+ render_group: function( $el ){
+
+ // vars
+ var $els = $(),
+ top = 0,
+ height = 0,
+ cell = -1;
+
+
+ // get fields
+ var $fields = $el.children('.acf-field[data-width]:visible');
+
+
+ // bail early if no fields
+ if( !$fields.exists() ) return;
+
+
+ // bail ealry if is .-left
+ if( $el.hasClass('-left') ) {
+
+ $fields.removeAttr('data-width');
+ $fields.css('width', 'auto');
+ return;
+
+ }
+
+
+ // reset fields
+ $fields.removeClass('-r0 -c0').css({'min-height': 0});
+
+
+ // loop
+ $fields.each(function( i ){
+
+ // vars
+ var $el = $(this),
+ this_top = $el.position().top;
+
+
+ // set top
+ if( i == 0 ) top = this_top;
+
+
+ // detect new row
+ if( this_top != top ) {
+
+ // set previous heights
+ $els.css({'min-height': (height+1)+'px'});
+
+ // reset
+ $els = $();
+ top = $el.position().top; // don't use variable as this value may have changed due to min-height css
+ height = 0;
+ cell = -1;
+
+ }
+
+
+ // increase
+ cell++;
+
+
+ // set height
+ height = ($el.outerHeight() > height) ? $el.outerHeight() : height;
+
+
+ // append
+ $els = $els.add( $el );
+
+
+ // add classes
+ if( this_top == 0 ) {
+
+ $el.addClass('-r0');
+
+ } else if( cell == 0 ) {
+
+ $el.addClass('-c0');
+
+ }
+
+ });
+
+
+ // clean up
+ if( $els.exists() ) {
+
+ $els.css({'min-height': (height+1)+'px'});
+
+ }
+
+ }
+
+ });
+
+
+ /*
+ * Force revisions
+ *
+ * description
+ *
+ * @type function
+ * @date 19/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ $(document).on('change', '.acf-field input, .acf-field textarea, .acf-field select', function(){
+
+ // preview hack
+ var $input = $('#_acf_changed');
+ if( $input.length ) $input.val(1);
+
+
+ // action for 3rd party customization
+ acf.do_action('change', $(this));
+
+ });
+
+
+ /*
+ * preventDefault helper
+ *
+ * This function will prevent default of any link with an href of #
+ *
+ * @type function
+ * @date 24/07/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ $(document).on('click', '.acf-field a[href="#"]', function( e ){
+
+ e.preventDefault();
+
+ });
+
+
+ /*
+ * unload
+ *
+ * This model handles the unload prompt
+ *
+ * @type function
+ * @date 21/02/2014
+ * @since 3.5.1
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ acf.unload = acf.model.extend({
+
+ locked: 1,
+ active: 1,
+ changed: 0,
+
+ filters: {
+ 'validation_complete': 'validation_complete'
+ },
+
+ actions: {
+ 'ready': 'ready',
+ 'change': 'on',
+ },
+
+ ready: function(){
+
+ // unlock in 1s to avoid JS 'trigger change' bugs
+ setTimeout(function(){
+
+ acf.unload.locked = 0;
+
+ }, 1000);
+
+ },
+
+ events: {
+ 'submit form': 'off'
+ },
+
+ validation_complete: function( json, $form ){
+
+ if( json && json.errors ) {
+
+ this.on();
+
+ }
+
+ // return
+ return json;
+
+ },
+
+ on: function(){
+
+ // bail ealry if already changed, not active, or still locked
+ if( this.changed || !this.active || this.locked ) {
+
+ return;
+
+ }
+
+
+ // update
+ this.changed = 1;
+
+
+ // add event
+ $(window).on('beforeunload', this.unload);
+
+ },
+
+ off: function(){
+
+ // update
+ this.changed = 0;
+
+
+ // remove event
+ $(window).off('beforeunload', this.unload);
+
+ },
+
+ unload: function(){
+
+ // alert string
+ return acf._e('unload');
+
+ }
+
+ });
+
+
+ acf.tooltip = acf.model.extend({
+
+ events: {
+ 'mouseenter .acf-js-tooltip': '_on',
+ 'mouseup .acf-js-tooltip': '_off',
+ 'mouseleave .acf-js-tooltip': '_off'
+ },
+
+ tooltip: function( text, $el ){
+
+ // vars
+ var $tooltip = $('' + text + '
');
+
+
+ // append
+ $('body').append( $tooltip );
+
+
+ // position
+ var tolerance = 10;
+ target_w = $el.outerWidth(),
+ target_h = $el.outerHeight(),
+ target_t = $el.offset().top,
+ target_l = $el.offset().left,
+ tooltip_w = $tooltip.outerWidth(),
+ tooltip_h = $tooltip.outerHeight();
+
+
+ // calculate top
+ var top = target_t - tooltip_h,
+ left = target_l + (target_w / 2) - (tooltip_w / 2);
+
+
+ // too far left
+ if( left < tolerance ) {
+
+ $tooltip.addClass('right');
+
+ left = target_l + target_w;
+ top = target_t + (target_h / 2) - (tooltip_h / 2);
+
+
+ // too far right
+ } else if( (left + tooltip_w + tolerance) > $(window).width() ) {
+
+ $tooltip.addClass('left');
+
+ left = target_l - tooltip_w;
+ top = target_t + (target_h / 2) - (tooltip_h / 2);
+
+
+ // too far top
+ } else if( top - $(window).scrollTop() < tolerance ) {
+
+ $tooltip.addClass('bottom');
+
+ top = target_t + target_h;
+
+ } else {
+
+ $tooltip.addClass('top');
+
+ }
+
+
+ // update css
+ $tooltip.css({ 'top': top, 'left': left });
+
+
+ // return
+ return $tooltip;
+
+ },
+
+ temp: function( text, $el ){
+
+ // tooltip
+ var $el = this.tooltip( text, $el );
+ var time = 0;
+
+
+ // wait 250
+ time += 250;
+
+
+ // add class
+ setTimeout(function(){
+
+ $el.addClass('acf-fade-up');
+
+ }, time);
+
+
+ // wait 250
+ time += 250;
+
+
+ // remove
+ setTimeout(function(){
+
+ $el.remove();
+
+ }, time);
+
+ },
+
+ confirm: function( $el, callback, text, button_y, button_n ){
+
+ // defaults
+ text = text || acf._e('are_you_sure');
+ button_y = button_y || ''+acf._e('yes')+' ';
+ button_n = button_n || ''+acf._e('No')+' ';
+
+
+ // vars
+ var $tooltip = this.tooltip( text + ' ' + button_y + ' ' + button_n , $el);
+
+
+ // add class
+ $tooltip.addClass('-confirm');
+
+
+ // events
+ var event = function( e, result ){
+
+ // prevent all listeners
+ e.preventDefault();
+ e.stopImmediatePropagation();
+
+
+ // remove events
+ $el.off('click', event_y);
+ $tooltip.off('click', '.acf-confirm-y', event_y);
+ $tooltip.off('click', '.acf-confirm-n', event_n);
+ $('body').off('click', event_n);
+
+
+ // remove tooltip
+ $tooltip.remove();
+
+
+ // callback
+ callback.apply(null, [result]);
+
+ };
+
+ var event_y = function( e ){
+ event( e, true );
+ };
+
+ var event_n = function( e ){
+ event( e, false );
+ };
+
+
+ // add events
+ $tooltip.on('click', '.acf-confirm-y', event_y);
+ $tooltip.on('click', '.acf-confirm-n', event_n);
+ $el.on('click', event_y);
+ $('body').on('click', event_n);
+
+ },
+
+ confirm_remove: function( $el, callback ){
+
+ // vars
+ text = false; // default
+ button_y = ''+acf._e('remove')+' ';
+ button_n = ''+acf._e('cancel')+' ';
+
+
+ // confirm
+ this.confirm( $el, callback, false, button_y, button_n );
+
+ },
+
+ _on: function( e ){
+
+ // vars
+ var title = e.$el.attr('title');
+
+
+ // bail ealry if no title
+ if( !title ) return;
+
+
+ // create tooltip
+ var $tooltip = this.tooltip( title, e.$el );
+
+
+ // store as data
+ e.$el.data('acf-tooltip', {
+ 'title': title,
+ '$el': $tooltip
+ });
+
+
+ // clear title to avoid default browser tooltip
+ e.$el.attr('title', '');
+
+ },
+
+ _off: function( e ){
+
+ // vars
+ var tooltip = e.$el.data('acf-tooltip');
+
+
+ // bail early if no data
+ if( !tooltip ) return;
+
+
+ // remove tooltip
+ tooltip.$el.remove();
+
+
+ // restore title
+ e.$el.attr('title', tooltip.title);
+ }
+
+ });
+
+
+ acf.postbox = acf.model.extend({
+
+ events: {
+ 'mouseenter .acf-postbox .handlediv': 'on',
+ 'mouseleave .acf-postbox .handlediv': 'off'
+ },
+
+ on: function( e ){
+
+ e.$el.siblings('.hndle').addClass('hover');
+
+ },
+
+ off: function( e ){
+
+ e.$el.siblings('.hndle').removeClass('hover');
+
+ },
+
+ render: function( args ){
+
+ // defaults
+ args = $.extend({}, {
+ id: '',
+ key: '',
+ style: 'default',
+ label: 'top',
+ edit_url: '',
+ edit_title: '',
+ visibility: true
+ }, args);
+
+
+ // vars
+ var $postbox = $('#' + args.id),
+ $toggle = $('#' + args.id + '-hide'),
+ $label = $toggle.parent();
+
+
+
+ // add class
+ $postbox.addClass('acf-postbox');
+ $label.addClass('acf-postbox-toggle');
+
+
+ // remove class
+ $postbox.removeClass('hide-if-js');
+ $label.removeClass('hide-if-js');
+
+
+ // field group style
+ if( args.style !== 'default' ) {
+
+ $postbox.addClass( args.style );
+
+ }
+
+
+ // .inside class
+ $postbox.children('.inside').addClass('acf-fields').addClass('-' + args.label);
+
+
+ // visibility
+ if( args.visibility ) {
+
+ $toggle.prop('checked', true);
+
+ } else {
+
+ $postbox.addClass('acf-hidden');
+ $label.addClass('acf-hidden');
+
+ }
+
+
+ // edit_url
+ if( args.edit_url ) {
+
+ $postbox.children('.hndle').append(' ');
+
+ }
+
+ }
+
+ });
+
+
+ /**
+ * panel
+ *
+ * This model handles .acf-panel JS
+ *
+ * @date 21/10/17
+ * @since 5.6.3
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ var acf_panel = acf.model.extend({
+
+ events: {
+ 'click .acf-panel-title': '_click',
+ },
+
+ _click: function( e ){
+
+ // prevent Defailt
+ e.preventDefault();
+
+
+ // open close
+ this.toggle( e.$el.parent() );
+
+ },
+
+ is_open: function( $el ) {
+ return $el.hasClass('-open');
+ },
+
+ toggle: function( $el ){
+
+ // is open
+ if( this.is_open($el) ) {
+ this.close( $el );
+ } else {
+ this.open( $el );
+ }
+
+ },
+
+ open: function( $el ){
+ $el.addClass('-open');
+ $el.find('.acf-panel-title i').attr('class', 'dashicons dashicons-arrow-down');
+ },
+
+ close: function( $el ){
+ $el.removeClass('-open');
+ $el.find('.acf-panel-title i').attr('class', 'dashicons dashicons-arrow-right');
+ }
+
+ });
+
+
+ /**
+ * acf_h2_notice
+ *
+ * This model will move the .acf-notice element quickly without the WP flicker
+ *
+ * @date 21/10/17
+ * @since 5.6.3
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ acf.notice = acf.model.extend({
+
+ actions: {
+ 'prepare': 'prepare',
+ },
+
+ prepare: function(){
+
+ // vars
+ var $notice = $('.acf-notice');
+
+
+ // move
+ if( $notice.length ) {
+ $('h1:first').after( $notice );
+ }
+
+ },
+
+ html: function( text, type ){
+
+ },
+
+ success: function( text ){
+
+
+ },
+
+ error: function( text ){
+
+ },
+
+ warning: function( text ){
+
+ },
+
+ information: function( text ){
+
+ }
+
+ });
+
+
+ // Preferences
+ var preferences = localStorage.getItem('acf');
+ preferences = preferences ? JSON.parse(preferences) : {};
+
+
+ /**
+ * getPreferenceName
+ *
+ * Gets the true preference name.
+ * Converts "this.thing" to "thing-123" if editing post 123.
+ *
+ * @date 11/11/17
+ * @since 5.6.5
+ *
+ * @param string name
+ * @return string
+ */
+
+ var getPreferenceName = function( name ){
+ if( name.substr(0, 5) === 'this.' ) {
+ name = name.substr(5) + '-' + acf.get('post_id');
+ }
+ return name;
+ };
+
+
+ /**
+ * acf.getPreference
+ *
+ * Gets a preference setting or null if not set.
+ *
+ * @date 11/11/17
+ * @since 5.6.5
+ *
+ * @param string name
+ * @return mixed
+ */
+
+ acf.getPreference = function( name ){
+ name = getPreferenceName( name );
+ return preferences[ name ] || null;
+ }
+
+
+ /**
+ * acf.setPreference
+ *
+ * Sets a preference setting.
+ *
+ * @date 11/11/17
+ * @since 5.6.5
+ *
+ * @param string name
+ * @param mixed value
+ * @return n/a
+ */
+
+ acf.setPreference = function( name, value ){
+ name = getPreferenceName( name );
+ if( value === null ) {
+ delete preferences[ name ];
+ } else {
+ preferences[ name ] = value;
+ }
+ localStorage.setItem('acf', JSON.stringify(preferences));
+ }
+
+
+ /**
+ * acf.removePreference
+ *
+ * Removes a preference setting.
+ *
+ * @date 11/11/17
+ * @since 5.6.5
+ *
+ * @param string name
+ * @return n/a
+ */
+
+ acf.removePreference = function( name ){
+ acf.setPreference(name, null);
+ };
+
+
+
+ /*
+ * Sortable
+ *
+ * These functions will hook into the start and stop of a jQuery sortable event and modify the item and placeholder
+ *
+ * @type function
+ * @date 12/11/2013
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ $(document).on('sortstart', function( event, ui ) {
+ acf.do_action('sortstart', ui.item, ui.placeholder);
+ });
+
+ $(document).on('sortstop', function( event, ui ) {
+ acf.do_action('sortstop', ui.item, ui.placeholder);
+ });
+
+ acf.add_action('sortstart', function( $item, $placeholder ){
+
+ // if $item is a tr, apply some css to the elements
+ if( $item.is('tr') ) {
+
+ // temp set as relative to find widths
+ $item.css('position', 'relative');
+
+
+ // set widths for td children
+ $item.children().each(function(){
+
+ $(this).width($(this).width());
+
+ });
+
+
+ // revert position css
+ $item.css('position', 'absolute');
+
+
+ // add markup to the placeholder
+ $placeholder.html(' ');
+
+ }
+
+ });
+
+
+
+ /*
+ * before & after duplicate
+ *
+ * This function will modify the DOM before it is cloned. Primarily fixes a cloning issue with select elements
+ *
+ * @type function
+ * @date 16/05/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ acf.add_action('before_duplicate', function( $orig ){
+
+ // add 'selected' class
+ $orig.find('select option:selected').addClass('selected');
+
+ });
+
+ acf.add_action('after_duplicate', function( $orig, $duplicate ){
+
+ // set select values
+ $duplicate.find('select').each(function(){
+
+ // vars
+ var $select = $(this);
+
+
+ // bail early if is 'Stylized UI'
+ //if( $select.data('ui') ) return;
+
+
+ // vars
+ var val = [];
+
+
+ // loop
+ $select.find('option.selected').each(function(){
+
+ val.push( $(this).val() );
+
+ });
+
+
+ // set val
+ $select.val( val );
+
+ });
+
+
+ // remove 'selected' class
+ $orig.find('select option.selected').removeClass('selected');
+ $duplicate.find('select option.selected').removeClass('selected');
+
+ });
+
+
+
+/*
+ acf.test_rtl = acf.model.extend({
+
+ actions: {
+ 'ready': 'ready',
+ },
+
+ ready: function(){
+
+ $('html').attr('dir', 'rtl');
+
+ }
+
+ });
+*/
+
+
+
+/*
+
+
+ console.time("acf_test_ready");
+ console.time("acf_test_load");
+
+ acf.add_action('ready', function(){
+
+ console.timeEnd("acf_test_ready");
+
+ }, 999);
+
+ acf.add_action('load', function(){
+
+ console.timeEnd("acf_test_load");
+
+ }, 999);
+*/
+
+
+ /*
+ * indexOf
+ *
+ * This function will provide compatibility for ie8
+ *
+ * @type function
+ * @date 5/3/17
+ * @since 5.5.10
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ if( !Array.prototype.indexOf ) {
+
+ Array.prototype.indexOf = function(val) {
+ return $.inArray(val, this);
+ };
+
+ }
+
+})(jQuery);
+
+(function($){
+
+ acf.ajax = acf.model.extend({
+
+ active: false,
+ actions: {
+ 'ready': 'ready'
+ },
+ events: {
+ 'change #page_template': '_change_template',
+ 'change #parent_id': '_change_parent',
+ 'change #post-formats-select input': '_change_format',
+ 'change .categorychecklist input': '_change_term',
+ 'change .categorychecklist select': '_change_term',
+ 'change .acf-taxonomy-field[data-save="1"] input': '_change_term',
+ 'change .acf-taxonomy-field[data-save="1"] select': '_change_term'
+ },
+ o: {
+ //'post_id': 0,
+ //'page_template': 0,
+ //'page_parent': 0,
+ //'page_type': 0,
+ //'post_format': 0,
+ //'post_taxonomy': 0
+ },
+ xhr: null,
+
+ update: function( k, v ){
+
+ this.o[ k ] = v;
+
+ return this;
+
+ },
+
+ get: function( k ){
+
+ return this.o[ k ] || null;
+
+ },
+
+ ready: function(){
+
+ // update post_id
+ this.update('post_id', acf.get('post_id'));
+
+
+ // active
+ this.active = true;
+
+ },
+
+/*
+ timeout: null,
+ maybe_fetch: function(){
+
+ // reference
+ var self = this;
+
+
+ // abort timeout
+ if( this.timeout ) {
+
+ clearTimeout( this.timeout );
+
+ }
+
+
+ // fetch
+ this.timeout = setTimeout(function(){
+
+ self.fetch();
+
+ }, 100);
+
+ },
+*/
+
+ fetch: function(){
+
+ // bail early if not active
+ if( !this.active ) return;
+
+
+ // bail early if no ajax
+ if( !acf.get('ajax') ) return;
+
+
+ // abort XHR if is already loading AJAX data
+ if( this.xhr ) {
+
+ this.xhr.abort();
+
+ }
+
+
+ // vars
+ var self = this,
+ data = this.o;
+
+
+ // add action url
+ data.action = 'acf/post/get_field_groups';
+
+
+ // add ignore
+ data.exists = [];
+
+ $('.acf-postbox').not('.acf-hidden').each(function(){
+
+ data.exists.push( $(this).attr('id').substr(4) );
+
+ });
+
+
+ // ajax
+ this.xhr = $.ajax({
+ url: acf.get('ajaxurl'),
+ data: acf.prepare_for_ajax( data ),
+ type: 'post',
+ dataType: 'json',
+
+ success: function( json ){
+
+ if( acf.is_ajax_success( json ) ) {
+
+ self.render( json.data );
+
+ }
+
+ }
+ });
+
+ },
+
+ render: function( json ){
+
+ // hide
+ $('.acf-postbox').addClass('acf-hidden');
+ $('.acf-postbox-toggle').addClass('acf-hidden');
+
+
+ // reset style
+ $('#acf-style').html('');
+
+
+ // show the new postboxes
+ $.each(json, function( k, field_group ){
+
+ // vars
+ var $postbox = $('#acf-' + field_group.key),
+ $toggle = $('#acf-' + field_group.key + '-hide'),
+ $label = $toggle.parent();
+
+
+ // show
+ // use show() to force display when postbox has been hidden by 'Show on screen' toggle
+ $postbox.removeClass('acf-hidden hide-if-js').show();
+ $label.removeClass('acf-hidden hide-if-js').show();
+ $toggle.prop('checked', true);
+
+
+ // replace HTML if needed
+ var $replace = $postbox.find('.acf-replace-with-fields');
+
+ if( $replace.exists() ) {
+
+ $replace.replaceWith( field_group.html );
+
+ acf.do_action('append', $postbox);
+
+ }
+
+
+ // update style if needed
+ if( k === 0 ) {
+
+ $('#acf-style').html( field_group.style );
+
+ }
+
+
+ // enable inputs
+ $postbox.find('.acf-hidden-by-postbox').prop('disabled', false);
+
+ });
+
+
+ // disable inputs
+ $('.acf-postbox.acf-hidden').find('select, textarea, input').not(':disabled').each(function(){
+
+ $(this).addClass('acf-hidden-by-postbox').prop('disabled', true);
+
+ });
+
+ },
+
+ sync_taxonomy_terms: function(){
+
+ // vars
+ var values = [''];
+
+
+ // loop over term lists
+ $('.categorychecklist, .acf-taxonomy-field').each(function(){
+
+ // vars
+ var $el = $(this),
+ $checkbox = $el.find('input[type="checkbox"]').not(':disabled'),
+ $radio = $el.find('input[type="radio"]').not(':disabled'),
+ $select = $el.find('select').not(':disabled'),
+ $hidden = $el.find('input[type="hidden"]').not(':disabled');
+
+
+ // bail early if not a field which saves taxonomy terms to post
+ if( $el.is('.acf-taxonomy-field') && $el.attr('data-save') != '1' ) {
+
+ return;
+
+ }
+
+
+ // bail early if in attachment
+ if( $el.closest('.media-frame').exists() ) {
+
+ return;
+
+ }
+
+
+ // checkbox
+ if( $checkbox.exists() ) {
+
+ $checkbox.filter(':checked').each(function(){
+
+ values.push( $(this).val() );
+
+ });
+
+ } else if( $radio.exists() ) {
+
+ $radio.filter(':checked').each(function(){
+
+ values.push( $(this).val() );
+
+ });
+
+ } else if( $select.exists() ) {
+
+ $select.find('option:selected').each(function(){
+
+ values.push( $(this).val() );
+
+ });
+
+ } else if( $hidden.exists() ) {
+
+ $hidden.each(function(){
+
+ // ignor blank values
+ if( ! $(this).val() ) {
+
+ return;
+
+ }
+
+ values.push( $(this).val() );
+
+ });
+
+ }
+
+ });
+
+
+ // filter duplicates
+ values = values.filter (function (v, i, a) { return a.indexOf (v) == i });
+
+
+ // update screen
+ this.update( 'post_taxonomy', values ).fetch();
+
+ },
+
+
+ /*
+ * events
+ *
+ * description
+ *
+ * @type function
+ * @date 29/09/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ _change_template: function( e ){
+
+ // vars
+ var page_template = e.$el.val();
+
+
+ // update & fetch
+ this.update('page_template', page_template).fetch();
+
+ },
+
+ _change_parent: function( e ){
+
+ // vars
+ var page_type = 'parent',
+ page_parent = 0;
+
+
+ // if is child
+ if( e.$el.val() != "" ) {
+
+ page_type = 'child';
+ page_parent = e.$el.val();
+
+ }
+
+ // update & fetch
+ this.update('page_type', page_type).update('page_parent', page_parent).fetch();
+
+ },
+
+ _change_format: function( e ){
+
+ // vars
+ var post_format = e.$el.val();
+
+
+ // default
+ if( post_format == '0' ) {
+
+ post_format = 'standard';
+
+ }
+
+
+ // update & fetch
+ this.update('post_format', post_format).fetch();
+
+ },
+
+ _change_term: function( e ){
+
+ // reference
+ var self = this;
+
+
+ // bail early if within media popup
+ if( e.$el.closest('.media-frame').exists() ) {
+
+ return;
+
+ }
+
+
+ // set timeout to fix issue with chrome which does not register the change has yet happened
+ setTimeout(function(){
+
+ self.sync_taxonomy_terms();
+
+ }, 1);
+
+
+ }
+
+ });
+
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.button_group = acf.field.extend({
+
+ type: 'button_group',
+ $div: null,
+
+ events: {
+ 'click input[type="radio"]': 'click'
+ },
+
+ focus: function(){
+
+ // focus on $select
+ this.$div = this.$field.find('.acf-button-group');
+
+
+ // get options
+ this.o = acf.get_data(this.$div, {
+ allow_null: 0
+ });
+
+ },
+
+ click: function( e ){
+
+ // vars
+ var $radio = e.$el;
+ var $label = $radio.parent('label');
+ var selected = $label.hasClass('selected');
+
+
+ // remove previous selected
+ this.$div.find('.selected').removeClass('selected');
+
+
+ // add active class
+ $label.addClass('selected');
+
+
+ // allow null
+ if( this.o.allow_null && selected ) {
+
+ // unselect
+ e.$el.prop('checked', false);
+ $label.removeClass('selected');
+
+
+ // trigger change
+ e.$el.trigger('change');
+
+ }
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.checkbox = acf.field.extend({
+
+ type: 'checkbox',
+
+ events: {
+ 'change input': '_change',
+ 'click .acf-add-checkbox': '_add'
+ },
+
+
+ /*
+ * focus
+ *
+ * This function will setup variables when focused on a field
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ focus: function(){
+
+ // get elements
+ this.$ul = this.$field.find('ul');
+ this.$input = this.$field.find('input[type="hidden"]');
+
+ },
+
+
+ add: function(){
+
+ // vars
+ var name = this.$input.attr('name') + '[]';
+
+
+ // vars
+ var html = ' ';
+
+
+ // append
+ this.$ul.find('.acf-add-checkbox').parent('li').before( html );
+
+ },
+
+ _change: function( e ){
+
+ // vars
+ var $ul = this.$ul,
+ $inputs = $ul.find('input[type="checkbox"]').not('.acf-checkbox-toggle'),
+ checked = e.$el.is(':checked');
+
+
+ // is toggle?
+ if( e.$el.hasClass('acf-checkbox-toggle') ) {
+
+ // toggle all
+ $inputs.prop('checked', checked).trigger('change');
+
+
+ // return
+ return;
+
+ }
+
+
+ // is custom
+ if( e.$el.hasClass('acf-checkbox-custom') ) {
+
+ // vars
+ var $text = e.$el.next('input[type="text"]');
+
+
+ // toggle disabled
+ e.$el.next('input[type="text"]').prop('disabled', !checked);
+
+
+ // remove complelety if no value
+ if( !checked && $text.val() == '' ) {
+
+ e.$el.parent('li').remove();
+
+ }
+ }
+
+
+ // bail early if no toggle
+ if( !$ul.find('.acf-checkbox-toggle').exists() ) {
+
+ return;
+
+ }
+
+
+ // determine if all inputs are checked
+ var checked = ( $inputs.not(':checked').length == 0 );
+
+
+ // update toggle
+ $ul.find('.acf-checkbox-toggle').prop('checked', checked);
+
+ },
+
+ _add: function( e ){
+
+ this.add();
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.color_picker = acf.field.extend({
+
+ type: 'color_picker',
+ $input: null,
+ $hidden: null,
+
+ actions: {
+ 'ready': 'initialize',
+ 'append': 'initialize'
+ },
+
+ focus: function(){
+
+ this.$input = this.$field.find('input[type="text"]');
+ this.$hidden = this.$field.find('input[type="hidden"]');
+
+ },
+
+ initialize: function(){
+
+ // reference
+ var $input = this.$input,
+ $hidden = this.$hidden;
+
+
+ // trigger change function
+ var change_hidden = function(){
+
+ // timeout is required to ensure the $input val is correct
+ setTimeout(function(){
+
+ acf.val( $hidden, $input.val() );
+
+ }, 1);
+
+ }
+
+
+ // args
+ var args = {
+
+ defaultColor: false,
+ palettes: true,
+ hide: true,
+ change: change_hidden,
+ clear: change_hidden
+
+ }
+
+
+ // filter
+ var args = acf.apply_filters('color_picker_args', args, this.$field);
+
+
+ // iris
+ this.$input.wpColorPicker(args);
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($, undefined){
+
+ // vars
+ var hidden = 'hidden-by-conditional-logic';
+
+ // model
+ var conditionalLogic = acf.conditional_logic = acf.model.extend({
+
+ // storage of fields that have conditions
+ conditions: {},
+
+ // storage of fields that trigger a condition
+ triggers: {},
+
+ // reference to parent element of both the trigger and target
+ $parent: false,
+
+ // actions
+ actions: {
+ 'prepare 20': 'render',
+ 'append 20': 'render',
+ 'change': 'change'
+ },
+
+
+ /*
+ * add
+ *
+ * This function will add a set of conditional logic rules
+ *
+ * @type function
+ * @date 22/05/2015
+ * @since 5.2.3
+ *
+ * @param string target field key
+ * @param array conditions array of conditional logic groups
+ * @return $post_id (int)
+ */
+
+ add: function( target, conditions ){
+
+ // add triggers
+ for( var i in conditions ) {
+ var group = conditions[i];
+
+ for( var k in group ) {
+ var rule = group[k];
+
+ this.addTrigger( rule.field, target );
+ }
+ }
+
+
+ // add condition
+ this.setCondition( target, conditions );
+
+ },
+
+
+ /**
+ * getTrigger
+ *
+ * This function will return the fields that are triggered by this key.
+ *
+ * @date 15/11/17
+ * @since 5.6.5
+ *
+ * @param string key The trigger's key.
+ * @return mixed
+ */
+
+ getTrigger: function( key ){
+ return this.triggers[ key ] || null;
+ },
+
+
+ /**
+ * setTrigger
+ *
+ * This function will set the fields that are triggered by this key.
+ *
+ * @date 15/11/17
+ * @since 5.6.5
+ *
+ * @param string key The trigger's key.
+ * @return mixed
+ */
+
+ setTrigger: function( key, value ){
+ this.triggers[ key ] = value;
+ },
+
+
+ /**
+ * addTrigger
+ *
+ * This function will add a reference for a field that triggers another field's visibility
+ *
+ * @date 15/11/17
+ * @since 5.6.5
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ addTrigger: function( trigger, target ){
+
+ // vars
+ var triggers = this.getTrigger( trigger ) || {};
+
+ // append
+ triggers[ target ] = 1;
+
+ // set
+ this.setTrigger(trigger, triggers);
+
+ },
+
+
+ /**
+ * getConditions
+ *
+ * This function will return the conditions for all targets.
+ *
+ * @date 15/11/17
+ * @since 5.6.5
+ *
+ * @param string key The trigger's key.
+ * @return mixed
+ */
+
+ getConditions: function(){
+ return this.conditions;
+ },
+
+
+ /**
+ * getCondition
+ *
+ * This function will return the conditions for a target.
+ *
+ * @date 15/11/17
+ * @since 5.6.5
+ *
+ * @param string key The trigger's key.
+ * @return mixed
+ */
+
+ getCondition: function( key ){
+ return this.conditions[ key ] || null;
+ },
+
+
+ /**
+ * setCondition
+ *
+ * This function will set the conditions for a target.
+ *
+ * @date 15/11/17
+ * @since 5.6.5
+ *
+ * @param string key The trigger's key.
+ * @return mixed
+ */
+
+ setCondition: function( key, value ){
+ this.conditions[ key ] = value;
+ },
+
+
+ /*
+ * render
+ *
+ * This function will render all fields
+ *
+ * @type function
+ * @date 22/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ render: function( $el ){
+
+ // vars
+ $el = $el || false;
+
+ // get targets
+ var $targets = acf.get_fields( '', $el, true );
+
+ // render fields
+ this.renderFields( $targets );
+
+ // action for 3rd party customization
+ acf.do_action('refresh', $el);
+
+ },
+
+
+ /**
+ * findParent
+ *
+ * This function will find a parent that contains both the trigger and target
+ *
+ * @date 15/11/17
+ * @since 5.6.5
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ findTarget: function( $trigger, target ){
+
+ // vars
+ var self = this;
+
+ // reset scope
+ this.$parent = false;
+
+ // find all targets
+ var $targets = acf.get_fields(target, false, true);
+
+ // bail early if nothing found
+ if( !$targets.length ) return false;
+
+ // refine scope if more than 1 found
+ if( $targets.length > 1 ) {
+
+ // loop
+ $trigger.parents('.acf-row, .acf-table, .acf-fields').each(function(){
+
+ // vars
+ var $parent = $(this);
+ var $child = $parent.find( $targets );
+
+ // found
+ if( $child.length ) {
+ $targets = $child;
+ self.$parent = $parent;
+ return false;
+ }
+
+ });
+
+ }
+
+ // return
+ return $targets;
+
+ },
+
+
+ /*
+ * change
+ *
+ * This function is called when an input is changed and will render any fields which are considered targets of this trigger
+ *
+ * @type function
+ * @date 22/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ change: function( $input ){
+
+ // vars
+ var $trigger = acf.get_field_wrap($input);
+ var key = $trigger.data('key');
+ var trigger = this.getTrigger(key);
+
+ // bail early if this field is not a trigger
+ if( !trigger ) return false;
+
+ // loop
+ for( var target in trigger ) {
+
+ // get target(s)
+ var $targets = this.findTarget( $trigger, target );
+
+ // render
+ this.renderFields( $targets );
+
+ }
+
+ // action for 3rd party customization
+ acf.do_action('refresh', this.$parent);
+
+ },
+
+
+ /*
+ * renderFields
+ *
+ * This function will render a selection of fields
+ *
+ * @type function
+ * @date 22/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ renderFields: function( $targets ) {
+
+ // reference
+ var self = this;
+
+ // loop
+ $targets.each(function(){
+ self.renderField( $(this) );
+ });
+
+ },
+
+
+ /*
+ * render_field
+ *
+ * This function will render a field
+ *
+ * @type function
+ * @date 22/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ renderField : function( $target ){
+
+ // vars
+ var visibility = false;
+ var key = $target.data('key');
+ var condition = this.getCondition( key );
+
+ // bail early if this field does not contain any conditional logic
+ if( !condition ) return false;
+
+ // loop
+ for( var i = 0; i < condition.length; i++ ) {
+
+ // vars
+ var group = condition[i],
+ match_group = true;
+
+ // loop
+ for( var k = 0; k < group.length; k++ ) {
+
+ // vars
+ var rule = group[k];
+
+ // get trigger for rule
+ var $trigger = this.findTarget( $target, rule.field );
+
+ // break if rule did not validate
+ if( !this.calculate(rule, $trigger, $target) ) {
+ match_group = false;
+ break;
+ }
+ }
+
+ // set visibility if rule group did validate
+ if( match_group ) {
+ visibility = true;
+ break;
+ }
+ }
+
+ // hide / show
+ if( visibility ) {
+ this.showField( $target );
+ } else {
+ this.hideField( $target );
+ }
+
+ },
+
+
+ /*
+ * show_field
+ *
+ * This function will show a field
+ *
+ * @type function
+ * @date 22/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ showField: function( $field ){
+
+ // bail ealry if not hidden
+ //if( !$field.hasClass(hidden) ) return;
+
+ // vars
+ var key = $field.data('key');
+
+ // remove class
+ $field.removeClass(hidden);
+
+ // enable
+ acf.enable_form( $field, 'condition-'+key );
+
+ // action for 3rd party customization
+ acf.do_action('show_field', $field, 'conditional_logic' );
+
+ },
+
+
+ /*
+ * hide_field
+ *
+ * This function will hide a field
+ *
+ * @type function
+ * @date 22/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ hideField : function( $field ){
+
+ // bail ealry if hidden
+ //if( $field.hasClass(hidden) ) return;
+
+ // vars
+ var key = $field.data('key');
+
+ // add class
+ $field.addClass( hidden );
+
+ // disable
+ acf.disable_form( $field, 'condition-'+key );
+
+ // action for 3rd party customization
+ acf.do_action('hide_field', $field, 'conditional_logic' );
+
+ },
+
+
+ /*
+ * calculate
+ *
+ * This function will calculate if a rule matches based on the $trigger
+ *
+ * @type function
+ * @date 22/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ calculate: function( rule, $trigger, $target ){
+
+ // bail early if $trigger could not be found
+ if( !$trigger || !$target ) return false;
+
+
+ // debug
+ //console.log( 'calculate(%o, %o, %o)', rule, $trigger, $target);
+
+
+ // vars
+ var match = false,
+ type = $trigger.data('type');
+
+
+ // input with :checked
+ if( type == 'true_false' || type == 'checkbox' || type == 'radio' || type == 'button_group' ) {
+
+ match = this.calculate_checkbox( rule, $trigger );
+
+
+ } else if( type == 'select' ) {
+
+ match = this.calculate_select( rule, $trigger );
+
+ }
+
+
+ // reverse if 'not equal to'
+ if( rule.operator === "!=" ) {
+
+ match = !match;
+
+ }
+
+
+ // return
+ return match;
+
+ },
+
+ calculate_checkbox: function( rule, $trigger ){
+
+ // look for selected input
+ var match = $trigger.find('input[value="' + rule.value + '"]:checked').exists();
+
+
+ // override for "allow null"
+ if( rule.value === '' && !$trigger.find('input:checked').exists() ) {
+
+ match = true;
+
+ }
+
+
+ // return
+ return match;
+
+ },
+
+
+ calculate_select: function( rule, $trigger ){
+
+ // vars
+ var $select = $trigger.find('select'),
+ val = $select.val();
+
+
+ // check for no value
+ if( !val && !$.isNumeric(val) ) {
+
+ val = '';
+
+ }
+
+
+ // convert to array
+ if( !$.isArray(val) ) {
+
+ val = [ val ];
+
+ }
+
+
+ // calc
+ match = ($.inArray(rule.value, val) > -1);
+
+
+ // return
+ return match;
+
+ }
+
+ });
+
+
+ // compatibility
+ conditionalLogic.show_field = conditionalLogic.showField;
+ conditionalLogic.hide_field = conditionalLogic.hideField;
+
+
+})(jQuery);
+
+(function($){
+
+ /*
+ * acf.datepicker
+ *
+ * description
+ *
+ * @type function
+ * @date 16/12/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ acf.datepicker = acf.model.extend({
+
+ actions: {
+ 'ready 1': 'ready'
+ },
+
+ ready: function(){
+
+ // vars
+ var locale = acf.get('locale'),
+ rtl = acf.get('rtl')
+ l10n = acf._e('date_picker');
+
+
+ // bail ealry if no l10n (fiedl groups admin page)
+ if( !l10n ) return;
+
+
+ // bail ealry if no datepicker library
+ if( typeof $.datepicker === 'undefined' ) return;
+
+
+ // rtl
+ l10n.isRTL = rtl;
+
+
+ // append
+ $.datepicker.regional[ locale ] = l10n;
+ $.datepicker.setDefaults(l10n);
+
+ },
+
+
+ /*
+ * init
+ *
+ * This function will initialize JS
+ *
+ * @type function
+ * @date 2/06/2016
+ * @since 5.3.8
+ *
+ * @param $input (jQuery selector)
+ * @param args (object)
+ * @return n/a
+ */
+
+ init: function( $input, args ){
+
+ // bail ealry if no datepicker library
+ if( typeof $.datepicker === 'undefined' ) return;
+
+
+ // defaults
+ args = args || {};
+
+
+ // add date picker
+ $input.datepicker( args );
+
+
+ // wrap the datepicker (only if it hasn't already been wrapped)
+ if( $('body > #ui-datepicker-div').exists() ) {
+
+ $('body > #ui-datepicker-div').wrap('
');
+
+ }
+
+ },
+
+
+ /*
+ * init
+ *
+ * This function will remove JS
+ *
+ * @type function
+ * @date 2/06/2016
+ * @since 5.3.8
+ *
+ * @param $input (jQuery selector)
+ * @return n/a
+ */
+
+ destroy: function( $input ){
+
+ // do nothing
+
+ }
+
+ });
+
+ acf.fields.date_picker = acf.field.extend({
+
+ type: 'date_picker',
+ $el: null,
+ $input: null,
+ $hidden: null,
+
+ o: {},
+
+ actions: {
+ 'ready': 'initialize',
+ 'append': 'initialize'
+ },
+
+ events: {
+ 'blur input[type="text"]': 'blur'
+ },
+
+ focus: function(){
+
+ // get elements
+ this.$el = this.$field.find('.acf-date-picker');
+ this.$input = this.$el.find('input[type="text"]');
+ this.$hidden = this.$el.find('input[type="hidden"]');
+
+
+ // get options
+ this.o = acf.get_data( this.$el );
+
+ },
+
+ initialize: function(){
+
+ // save_format - compatibility with ACF < 5.0.0
+ if( this.o.save_format ) {
+
+ return this.initialize2();
+
+ }
+
+
+ // create options
+ var args = {
+ dateFormat: this.o.date_format,
+ altField: this.$hidden,
+ altFormat: 'yymmdd',
+ changeYear: true,
+ yearRange: "-100:+100",
+ changeMonth: true,
+ showButtonPanel: true,
+ firstDay: this.o.first_day
+ };
+
+
+ // filter for 3rd party customization
+ args = acf.apply_filters('date_picker_args', args, this.$field);
+
+
+ // add date picker
+ acf.datepicker.init( this.$input, args );
+
+
+ // action for 3rd party customization
+ acf.do_action('date_picker_init', this.$input, args, this.$field);
+
+ },
+
+ initialize2: function(){
+
+ // get and set value from alt field
+ this.$input.val( this.$hidden.val() );
+
+
+ // create options
+ var args = {
+ dateFormat: this.o.date_format,
+ altField: this.$hidden,
+ altFormat: this.o.save_format,
+ changeYear: true,
+ yearRange: "-100:+100",
+ changeMonth: true,
+ showButtonPanel: true,
+ firstDay: this.o.first_day
+ };
+
+
+ // filter for 3rd party customization
+ args = acf.apply_filters('date_picker_args', args, this.$field);
+
+
+ // backup
+ var dateFormat = args.dateFormat;
+
+
+ // change args.dateFormat
+ args.dateFormat = this.o.save_format;
+
+
+ // add date picker
+ acf.datepicker.init( this.$input, args );
+
+
+ // now change the format back to how it should be.
+ this.$input.datepicker( 'option', 'dateFormat', dateFormat );
+
+
+ // action for 3rd party customization
+ acf.do_action('date_picker_init', this.$input, args, this.$field);
+
+ },
+
+ blur: function(){
+
+ if( !this.$input.val() ) {
+
+ this.$hidden.val('');
+
+ }
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ /*
+ * acf.datepicker
+ *
+ * description
+ *
+ * @type function
+ * @date 16/12/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ acf.datetimepicker = acf.model.extend({
+
+ actions: {
+ 'ready 1': 'ready'
+ },
+
+ ready: function(){
+
+ // vars
+ var locale = acf.get('locale'),
+ rtl = acf.get('rtl')
+ l10n = acf._e('date_time_picker');
+
+
+ // bail ealry if no l10n (fiedl groups admin page)
+ if( !l10n ) return;
+
+
+ // bail ealry if no timepicker library
+ if( typeof $.timepicker === 'undefined' ) return;
+
+
+ // rtl
+ l10n.isRTL = rtl;
+
+
+ // append
+ $.timepicker.regional[ locale ] = l10n;
+ $.timepicker.setDefaults(l10n);
+
+ },
+
+
+ /*
+ * init
+ *
+ * This function will initialize JS
+ *
+ * @type function
+ * @date 2/06/2016
+ * @since 5.3.8
+ *
+ * @param $input (jQuery selector)
+ * @param args (object)
+ * @return n/a
+ */
+
+ init: function( $input, args ){
+
+ // bail ealry if no timepicker library
+ if( typeof $.timepicker === 'undefined' ) return;
+
+
+ // defaults
+ args = args || {};
+
+
+ // add date picker
+ $input.datetimepicker( args );
+
+
+ // wrap the datepicker (only if it hasn't already been wrapped)
+ if( $('body > #ui-datepicker-div').exists() ) {
+
+ $('body > #ui-datepicker-div').wrap('
');
+
+ }
+
+ },
+
+
+ /*
+ * init
+ *
+ * This function will remove JS
+ *
+ * @type function
+ * @date 2/06/2016
+ * @since 5.3.8
+ *
+ * @param $input (jQuery selector)
+ * @return n/a
+ */
+
+ destroy: function( $input ){
+
+ // do nothing
+
+ }
+
+ });
+
+
+ acf.fields.date_time_picker = acf.field.extend({
+
+ type: 'date_time_picker',
+ $el: null,
+ $input: null,
+ $hidden: null,
+
+ o: {},
+
+ actions: {
+ 'ready': 'initialize',
+ 'append': 'initialize'
+ },
+
+ events: {
+ 'blur input[type="text"]': 'blur'
+ },
+
+ focus: function(){
+
+ // get elements
+ this.$el = this.$field.find('.acf-date-time-picker');
+ this.$input = this.$el.find('input[type="text"]');
+ this.$hidden = this.$el.find('input[type="hidden"]');
+
+
+ // get options
+ this.o = acf.get_data( this.$el );
+
+ },
+
+ initialize: function(){
+
+ // create options
+ var args = {
+ dateFormat: this.o.date_format,
+ timeFormat: this.o.time_format,
+ altField: this.$hidden,
+ altFieldTimeOnly: false,
+ altFormat: 'yy-mm-dd',
+ altTimeFormat: 'HH:mm:ss',
+ changeYear: true,
+ yearRange: "-100:+100",
+ changeMonth: true,
+ showButtonPanel: true,
+ firstDay: this.o.first_day,
+ controlType: 'select',
+ oneLine: true
+ };
+
+
+ // filter for 3rd party customization
+ args = acf.apply_filters('date_time_picker_args', args, this.$field);
+
+
+ // add date time picker
+ acf.datetimepicker.init( this.$input, args );
+
+
+ // action for 3rd party customization
+ acf.do_action('date_time_picker_init', this.$input, args, this.$field);
+
+ },
+
+ blur: function(){
+
+ if( !this.$input.val() ) {
+
+ this.$hidden.val('');
+
+ }
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.file = acf.field.extend({
+
+ type: 'file',
+ $el: null,
+ $input: null,
+
+ actions: {
+ 'ready': 'initialize',
+ 'append': 'initialize'
+ },
+
+ events: {
+ 'click a[data-name="add"]': 'add',
+ 'click a[data-name="edit"]': 'edit',
+ 'click a[data-name="remove"]': 'remove',
+ 'change input[type="file"]': 'change'
+ },
+
+
+ /*
+ * focus
+ *
+ * This function will setup variables when focused on a field
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ focus: function(){
+
+ // get elements
+ this.$el = this.$field.find('.acf-file-uploader');
+ this.$input = this.$el.find('input[type="hidden"]');
+
+
+ // get options
+ this.o = acf.get_data( this.$el );
+
+ },
+
+
+ /*
+ * initialize
+ *
+ * This function is used to setup basic upload form attributes
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ initialize: function(){
+
+ // add attribute to form
+ if( this.o.uploader == 'basic' ) {
+
+ this.$el.closest('form').attr('enctype', 'multipart/form-data');
+
+ }
+
+ },
+
+
+ /*
+ * prepare
+ *
+ * This function will prepare an object of attachment data
+ * selecting a library image vs embed an image via url return different data
+ * this function will keep the 2 consistent
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param attachment (object)
+ * @return data (object)
+ */
+
+ prepare: function( attachment ) {
+
+ // defaults
+ attachment = attachment || {};
+
+
+ // bail ealry if already valid
+ if( attachment._valid ) return attachment;
+
+
+ // vars
+ var data = {
+ url: '',
+ alt: '',
+ title: '',
+ filename: '',
+ filesizeHumanReadable: '',
+ icon: '/wp-includes/images/media/default.png'
+ };
+
+
+ // wp image
+ if( attachment.id ) {
+
+ // update data
+ data = attachment.attributes;
+
+ }
+
+
+ // valid
+ data._valid = true;
+
+
+ // return
+ return data;
+
+ },
+
+
+ /*
+ * render
+ *
+ * This function will render the UI
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param attachment (obj)
+ * @return n/a
+ */
+
+ render: function( data ){
+
+ // prepare
+ data = this.prepare(data);
+
+
+ // update els
+ this.$el.find('img').attr({
+ src: data.icon,
+ alt: data.alt,
+ title: data.title
+ });
+ this.$el.find('[data-name="title"]').text( data.title );
+ this.$el.find('[data-name="filename"]').text( data.filename ).attr( 'href', data.url );
+ this.$el.find('[data-name="filesize"]').text( data.filesizeHumanReadable );
+
+
+ // vars
+ var val = '';
+
+
+ // WP attachment
+ if( data.id ) {
+
+ val = data.id;
+
+ }
+
+
+ // update val
+ acf.val( this.$input, val );
+
+
+ // update class
+ if( val ) {
+
+ this.$el.addClass('has-value');
+
+ } else {
+
+ this.$el.removeClass('has-value');
+
+ }
+
+ },
+
+
+ /*
+ * add
+ *
+ * event listener
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param e (event)
+ * @return n/a
+ */
+
+ add: function() {
+
+ // reference
+ var self = this,
+ $field = this.$field;
+
+
+ // get repeater
+ var $repeater = acf.get_closest_field( $field, 'repeater' );
+
+
+ // popup
+ var frame = acf.media.popup({
+
+ title: acf._e('file', 'select'),
+ mode: 'select',
+ type: '',
+ field: $field.data('key'),
+ multiple: $repeater.exists(),
+ library: this.o.library,
+ mime_types: this.o.mime_types,
+
+ select: function( attachment, i ) {
+
+ // select / add another image field?
+ if( i > 0 ) {
+
+ // vars
+ var key = $field.data('key'),
+ $tr = $field.closest('.acf-row');
+
+
+ // reset field
+ $field = false;
+
+
+ // find next image field
+ $tr.nextAll('.acf-row:visible').each(function(){
+
+ // get next $field
+ $field = acf.get_field( key, $(this) );
+
+
+ // bail early if $next was not found
+ if( !$field ) return;
+
+
+ // bail early if next file uploader has value
+ if( $field.find('.acf-file-uploader.has-value').exists() ) {
+
+ $field = false;
+ return;
+
+ }
+
+
+ // end loop if $next is found
+ return false;
+
+ });
+
+
+
+ // add extra row if next is not found
+ if( !$field ) {
+
+ $tr = acf.fields.repeater.doFocus( $repeater ).add();
+
+
+ // bail early if no $tr (maximum rows hit)
+ if( !$tr ) return false;
+
+
+ // get next $field
+ $field = acf.get_field( key, $tr );
+
+ }
+
+ }
+
+
+ // render
+ self.set('$field', $field).render( attachment );
+
+ }
+ });
+
+ },
+
+
+ /*
+ * edit
+ *
+ * event listener
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param e (event)
+ * @return n/a
+ */
+
+ edit: function() {
+
+ // reference
+ var self = this,
+ $field = this.$field;
+
+
+ // vars
+ var val = this.$input.val();
+
+
+ // bail early if no val
+ if( !val ) return;
+
+
+ // popup
+ var frame = acf.media.popup({
+
+ title: acf._e('file', 'edit'),
+ button: acf._e('file', 'update'),
+ mode: 'edit',
+ attachment: val,
+
+ select: function( attachment, i ) {
+
+ // render
+ self.set('$field', $field).render( attachment );
+
+ }
+
+ });
+
+ },
+
+
+ /*
+ * remove
+ *
+ * event listener
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param e (event)
+ * @return n/a
+ */
+
+ remove: function() {
+
+ // vars
+ var attachment = {};
+
+
+ // add file to field
+ this.render( attachment );
+
+ },
+
+
+ /*
+ * get_file_info
+ *
+ * This function will find basic file info and store it in a hidden input
+ *
+ * @type function
+ * @date 18/1/17
+ * @since 5.5.0
+ *
+ * @param $file_input (jQuery)
+ * @param $hidden_input (jQuery)
+ * @return n/a
+ */
+
+ get_file_info: function( $file_input, $hidden_input ){
+
+ // vars
+ var val = $file_input.val(),
+ attachment = {};
+
+
+ // bail early if no value
+ if( !val ) {
+
+ $hidden_input.val('');
+ return;
+
+ }
+
+
+ // url
+ attachment.url = val;
+
+
+ // modern browsers
+ var files = $file_input[0].files;
+
+ if( files.length ){
+
+ // vars
+ var file = files[0];
+
+
+ // update
+ attachment.size = file.size;
+ attachment.type = file.type;
+
+
+ // image
+ if( file.type.indexOf('image') > -1 ) {
+
+ // vars
+ var _url = window.URL || window.webkitURL;
+
+
+ // temp image
+ var img = new Image();
+
+ img.onload = function () {
+
+ // update
+ attachment.width = this.width;
+ attachment.height = this.height;
+
+
+ // set hidden input value
+ $hidden_input.val( jQuery.param(attachment) );
+
+ };
+
+ img.src = _url.createObjectURL(file);
+
+ }
+
+ }
+
+
+ // set hidden input value
+ $hidden_input.val( jQuery.param(attachment) );
+
+ },
+
+
+ /*
+ * change
+ *
+ * This function will update the hidden input when selecting a basic file to add basic validation
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param e (event)
+ * @return n/a
+ */
+
+ change: function( e ){
+
+ this.get_file_info( e.$el, this.$input );
+
+ }
+
+ });
+
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.google_map = acf.field.extend({
+
+ type: 'google_map',
+ url: '',
+ $el: null,
+ $search: null,
+
+ timeout: null,
+ status : '', // '', 'loading', 'ready'
+ geocoder : false,
+ map : false,
+ maps : {},
+ $pending: $(),
+
+ actions: {
+ // have considered changing to 'load', however, could cause issues with devs expecting the API to exist earlier
+ 'ready': 'initialize',
+ 'append': 'initialize',
+ 'show': 'show'
+ },
+
+ events: {
+ 'click a[data-name="clear"]': '_clear',
+ 'click a[data-name="locate"]': '_locate',
+ 'click a[data-name="search"]': '_search',
+ 'keydown .search': '_keydown',
+ 'keyup .search': '_keyup',
+ 'focus .search': '_focus',
+ 'blur .search': '_blur',
+ //'paste .search': '_paste',
+ 'mousedown .acf-google-map': '_mousedown'
+ },
+
+ focus: function(){
+
+ // get elements
+ this.$el = this.$field.find('.acf-google-map');
+ this.$search = this.$el.find('.search');
+
+
+ // get options
+ this.o = acf.get_data( this.$el );
+ this.o.id = this.$el.attr('id');
+
+
+ // get map
+ if( this.maps[ this.o.id ] ) {
+
+ this.map = this.maps[ this.o.id ];
+
+ }
+
+ },
+
+
+ /*
+ * is_ready
+ *
+ * This function will ensure google API is available and return a boolean for the current status
+ *
+ * @type function
+ * @date 19/11/2014
+ * @since 5.0.9
+ *
+ * @param n/a
+ * @return (boolean)
+ */
+
+ is_ready: function(){
+
+ // reference
+ var self = this;
+
+
+ // ready
+ if( this.status == 'ready' ) return true;
+
+
+ // loading
+ if( this.status == 'loading' ) return false;
+
+
+ // check exists (optimal)
+ if( acf.isset(window, 'google', 'maps', 'places') ) {
+
+ this.status = 'ready';
+ return true;
+
+ }
+
+
+ // check exists (ok)
+ if( acf.isset(window, 'google', 'maps') ) {
+
+ this.status = 'ready';
+
+ }
+
+
+ // attempt load google.maps.places
+ if( this.url ) {
+
+ // set status
+ this.status = 'loading';
+
+
+ // enqueue
+ acf.enqueue_script(this.url, function(){
+
+ // set status
+ self.status = 'ready';
+
+
+ // initialize pending
+ self.initialize_pending();
+
+ });
+
+ }
+
+
+ // ready
+ if( this.status == 'ready' ) return true;
+
+
+ // return
+ return false;
+
+ },
+
+
+ /*
+ * initialize_pending
+ *
+ * This function will initialize pending fields
+ *
+ * @type function
+ * @date 27/08/2016
+ * @since 5.4.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ initialize_pending: function(){
+
+ // reference
+ var self = this;
+
+ this.$pending.each(function(){
+
+ self.set('$field', $(this)).initialize();
+
+ });
+
+
+ // reset
+ this.$pending = $();
+
+ },
+
+
+ /*
+ * actions
+ *
+ * these functions are fired for this fields actions
+ *
+ * @type function
+ * @date 17/09/2015
+ * @since 5.2.3
+ *
+ * @param (mixed)
+ * @return n/a
+ */
+
+ initialize: function(){
+
+ // add to pending
+ if( !this.is_ready() ) {
+
+ this.$pending = this.$pending.add( this.$field );
+
+ return false;
+
+ }
+
+
+ // load geocode
+ if( !this.geocoder ) {
+
+ this.geocoder = new google.maps.Geocoder();
+
+ }
+
+
+ // reference
+ var self = this,
+ $field = this.$field,
+ $el = this.$el,
+ $search = this.$search;
+
+
+ // input value may be cached by browser, so update the search input to match
+ $search.val( this.$el.find('.input-address').val() );
+
+
+ // map
+ var map_args = acf.apply_filters('google_map_args', {
+
+ scrollwheel: false,
+ zoom: parseInt(this.o.zoom),
+ center: new google.maps.LatLng(this.o.lat, this.o.lng),
+ mapTypeId: google.maps.MapTypeId.ROADMAP
+
+ }, this.$field);
+
+
+ // create map
+ this.map = new google.maps.Map( this.$el.find('.canvas')[0], map_args);
+
+
+ // search
+ if( acf.isset(window, 'google', 'maps', 'places', 'Autocomplete') ) {
+
+ // vars
+ var autocomplete = new google.maps.places.Autocomplete( this.$search[0] );
+
+
+ // bind
+ autocomplete.bindTo('bounds', this.map);
+
+
+ // event
+ google.maps.event.addListener(autocomplete, 'place_changed', function( e ) {
+
+ // vars
+ var place = this.getPlace();
+
+
+ // search
+ self.search( place );
+
+ });
+
+
+ // append
+ this.map.autocomplete = autocomplete;
+
+ }
+
+
+ // marker
+ var marker_args = acf.apply_filters('google_map_marker_args', {
+
+ draggable: true,
+ raiseOnDrag: true,
+ map: this.map
+
+ }, this.$field);
+
+
+ // add marker
+ this.map.marker = new google.maps.Marker( marker_args );
+
+
+ // add references
+ this.map.$el = $el;
+ this.map.$field = $field;
+
+
+ // value exists?
+ var lat = $el.find('.input-lat').val(),
+ lng = $el.find('.input-lng').val();
+
+ if( lat && lng ) {
+
+ this.update(lat, lng).center();
+
+ }
+
+
+ // events
+ google.maps.event.addListener( this.map.marker, 'dragend', function(){
+
+ // vars
+ var position = this.map.marker.getPosition(),
+ lat = position.lat(),
+ lng = position.lng();
+
+ self.update( lat, lng ).sync();
+
+ });
+
+
+ google.maps.event.addListener( this.map, 'click', function( e ) {
+
+ // vars
+ var lat = e.latLng.lat(),
+ lng = e.latLng.lng();
+
+
+ self.update( lat, lng ).sync();
+
+ });
+
+
+ // action for 3rd party customization
+ acf.do_action('google_map_init', this.map, this.map.marker, this.$field);
+
+
+ // add to maps
+ this.maps[ this.o.id ] = this.map;
+
+ },
+
+ search: function( place ){
+
+ // reference
+ var self = this;
+
+
+ // vars
+ var address = this.$search.val();
+
+
+ // bail ealry if no address
+ if( !address ) {
+
+ return false;
+
+ }
+
+
+ // update input
+ this.$el.find('.input-address').val( address );
+
+
+ // is lat lng?
+ var latLng = address.split(',');
+
+ if( latLng.length == 2 ) {
+
+ var lat = latLng[0],
+ lng = latLng[1];
+
+
+ if( $.isNumeric(lat) && $.isNumeric(lng) ) {
+
+ // parse
+ lat = parseFloat(lat);
+ lng = parseFloat(lng);
+
+ self.update( lat, lng ).center();
+
+ return;
+
+ }
+
+ }
+
+
+ // if place exists
+ if( place && place.geometry ) {
+
+ var lat = place.geometry.location.lat(),
+ lng = place.geometry.location.lng();
+
+
+ // update
+ self.update( lat, lng ).center();
+
+
+ // bail early
+ return;
+
+ }
+
+
+ // add class
+ this.$el.addClass('-loading');
+
+ self.geocoder.geocode({ 'address' : address }, function( results, status ){
+
+ // remove class
+ self.$el.removeClass('-loading');
+
+
+ // validate
+ if( status != google.maps.GeocoderStatus.OK ) {
+
+ console.log('Geocoder failed due to: ' + status);
+ return;
+
+ } else if( !results[0] ) {
+
+ console.log('No results found');
+ return;
+
+ }
+
+
+ // get place
+ place = results[0];
+
+ var lat = place.geometry.location.lat(),
+ lng = place.geometry.location.lng();
+
+
+ self.update( lat, lng ).center();
+
+ });
+
+ },
+
+ update: function( lat, lng ){
+
+ // vars
+ var latlng = new google.maps.LatLng( lat, lng );
+
+
+ // update inputs
+ acf.val( this.$el.find('.input-lat'), lat );
+ acf.val( this.$el.find('.input-lng'), lng );
+
+
+ // update marker
+ this.map.marker.setPosition( latlng );
+
+
+ // show marker
+ this.map.marker.setVisible( true );
+
+
+ // update class
+ this.$el.addClass('-value');
+
+
+ // validation
+ this.$field.removeClass('error');
+
+
+ // action
+ acf.do_action('google_map_change', latlng, this.map, this.$field);
+
+
+ // blur input
+ this.$search.blur();
+
+
+ // return for chaining
+ return this;
+
+ },
+
+ center: function(){
+
+ // vars
+ var position = this.map.marker.getPosition(),
+ lat = this.o.lat,
+ lng = this.o.lng;
+
+
+ // if marker exists, center on the marker
+ if( position ) {
+
+ lat = position.lat();
+ lng = position.lng();
+
+ }
+
+
+ var latlng = new google.maps.LatLng( lat, lng );
+
+
+ // set center of map
+ this.map.setCenter( latlng );
+
+ },
+
+ sync: function(){
+
+ // reference
+ var self = this;
+
+
+ // vars
+ var position = this.map.marker.getPosition(),
+ latlng = new google.maps.LatLng( position.lat(), position.lng() );
+
+
+ // add class
+ this.$el.addClass('-loading');
+
+
+ // load
+ this.geocoder.geocode({ 'latLng' : latlng }, function( results, status ){
+
+ // remove class
+ self.$el.removeClass('-loading');
+
+
+ // validate
+ if( status != google.maps.GeocoderStatus.OK ) {
+
+ console.log('Geocoder failed due to: ' + status);
+ return;
+
+ } else if( !results[0] ) {
+
+ console.log('No results found');
+ return;
+
+ }
+
+
+ // get location
+ var location = results[0];
+
+
+ // update title
+ self.$search.val( location.formatted_address );
+
+
+ // update input
+ acf.val( self.$el.find('.input-address'), location.formatted_address );
+
+ });
+
+
+ // return for chaining
+ return this;
+
+ },
+
+ refresh: function(){
+
+ // bail early if not ready
+ if( !this.is_ready() ) {
+
+ return false;
+
+ }
+
+
+ // trigger resize on map
+ google.maps.event.trigger(this.map, 'resize');
+
+
+
+ // center map
+ this.center();
+
+ },
+
+ show: function(){
+
+ // vars
+ var self = this,
+ $field = this.$field;
+
+
+ // center map when it is shown (by a tab / collapsed row)
+ // - use delay to avoid rendering issues with browsers (ensures div is visible)
+ setTimeout(function(){
+
+ self.set('$field', $field).refresh();
+
+ }, 10);
+
+ },
+
+
+ /*
+ * events
+ *
+ * these functions are fired for this fields events
+ *
+ * @type function
+ * @date 17/09/2015
+ * @since 5.2.3
+ *
+ * @param e
+ * @return n/a
+ */
+
+ _clear: function( e ){ // console.log('_clear');
+
+ // remove Class
+ this.$el.removeClass('-value -loading -search');
+
+
+ // clear search
+ this.$search.val('');
+
+
+ // clear inputs
+ acf.val( this.$el.find('.input-address'), '' );
+ acf.val( this.$el.find('.input-lat'), '' );
+ acf.val( this.$el.find('.input-lng'), '' );
+
+
+ // hide marker
+ this.map.marker.setVisible( false );
+
+ },
+
+ _locate: function( e ){ // console.log('_locate');
+
+ // reference
+ var self = this;
+
+
+ // Try HTML5 geolocation
+ if( !navigator.geolocation ) {
+
+ alert( acf._e('google_map', 'browser_support') );
+ return this;
+
+ }
+
+
+ // add class
+ this.$el.addClass('-loading');
+
+
+ // load
+ navigator.geolocation.getCurrentPosition(function(position){
+
+ // remove class
+ self.$el.removeClass('-loading');
+
+
+ // vars
+ var lat = position.coords.latitude,
+ lng = position.coords.longitude;
+
+ self.update( lat, lng ).sync().center();
+
+ });
+
+ },
+
+ _search: function( e ){ // console.log('_search');
+
+ this.search();
+
+ },
+
+ _focus: function( e ){ // console.log('_focus');
+
+ // remove class
+ this.$el.removeClass('-value');
+
+
+ // toggle -search class
+ this._keyup();
+
+ },
+
+ _blur: function( e ){ // console.log('_blur');
+
+ // reference
+ var self = this;
+
+
+ // vars
+ var val = this.$el.find('.input-address').val();
+
+
+ // bail early if no val
+ if( !val ) {
+
+ return;
+
+ }
+
+
+ // revert search to hidden input value
+ this.timeout = setTimeout(function(){
+
+ self.$el.addClass('-value');
+ self.$search.val( val );
+
+ }, 100);
+
+ },
+
+/*
+ _paste: function( e ){ console.log('_paste');
+
+ // reference
+ var $search = this.$search;
+
+
+ // blur search
+ $search.blur();
+
+
+ // clear timeout
+ this._mousedown(e);
+
+
+ // focus on input
+ setTimeout(function(){
+
+ $search.focus();
+
+ }, 1);
+ },
+*/
+
+ _keydown: function( e ){ // console.log('_keydown');
+
+ // prevent form from submitting
+ if( e.which == 13 ) {
+
+ e.preventDefault();
+
+ }
+
+ },
+
+ _keyup: function( e ){ // console.log('_keyup');
+
+ // vars
+ var val = this.$search.val();
+
+
+ // toggle class
+ if( val ) {
+
+ this.$el.addClass('-search');
+
+ } else {
+
+ this.$el.removeClass('-search');
+
+ }
+
+ },
+
+ _mousedown: function( e ){ // console.log('_mousedown');
+
+ // reference
+ var self = this;
+
+
+ // clear timeout in 1ms (_mousedown will run before _blur)
+ setTimeout(function(){
+
+ clearTimeout( self.timeout );
+
+ }, 1);
+
+
+ }
+
+ });
+
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.image = acf.field.extend({
+
+ type: 'image',
+ $el: null,
+ $input: null,
+ $img: null,
+
+ actions: {
+ 'ready': 'initialize',
+ 'append': 'initialize'
+ },
+
+ events: {
+ 'click a[data-name="add"]': 'add',
+ 'click a[data-name="edit"]': 'edit',
+ 'click a[data-name="remove"]': 'remove',
+ 'change input[type="file"]': 'change'
+ },
+
+
+ /*
+ * focus
+ *
+ * This function will setup variables when focused on a field
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ focus: function(){
+
+ // vars
+ this.$el = this.$field.find('.acf-image-uploader');
+ this.$input = this.$el.find('input[type="hidden"]');
+ this.$img = this.$el.find('img');
+
+
+ // options
+ this.o = acf.get_data( this.$el );
+
+ },
+
+
+ /*
+ * initialize
+ *
+ * This function is used to setup basic upload form attributes
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ initialize: function(){
+
+ // add attribute to form
+ if( this.o.uploader == 'basic' ) {
+
+ this.$el.closest('form').attr('enctype', 'multipart/form-data');
+
+ }
+
+ },
+
+
+ /*
+ * prepare
+ *
+ * This function will prepare an object of attachment data
+ * selecting a library image vs embed an image via url return different data
+ * this function will keep the 2 consistent
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param attachment (object)
+ * @return data (object)
+ */
+
+ prepare: function( attachment ) {
+
+ // defaults
+ attachment = attachment || {};
+
+
+ // bail ealry if already valid
+ if( attachment._valid ) return attachment;
+
+
+ // vars
+ var data = {
+ url: '',
+ alt: '',
+ title: '',
+ caption: '',
+ description: '',
+ width: 0,
+ height: 0
+ };
+
+
+ // wp image
+ if( attachment.id ) {
+
+ // update data
+ data = attachment.attributes;
+
+
+ // maybe get preview size
+ data.url = acf.maybe_get(data, 'sizes.'+this.o.preview_size+'.url', data.url);
+
+ }
+
+
+ // valid
+ data._valid = true;
+
+
+ // return
+ return data;
+
+ },
+
+
+ /*
+ * render
+ *
+ * This function will render the UI
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param attachment (obj)
+ * @return n/a
+ */
+
+ render: function( data ){
+
+ // prepare
+ data = this.prepare(data);
+
+
+ // update image
+ this.$img.attr({
+ src: data.url,
+ alt: data.alt,
+ title: data.title
+ });
+
+
+ // vars
+ var val = '';
+
+
+ // WP attachment
+ if( data.id ) {
+
+ val = data.id;
+
+ }
+
+
+ // update val
+ acf.val( this.$input, val );
+
+
+ // update class
+ if( val ) {
+
+ this.$el.addClass('has-value');
+
+ } else {
+
+ this.$el.removeClass('has-value');
+
+ }
+
+ },
+
+
+ /*
+ * add
+ *
+ * event listener
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param e (event)
+ * @return n/a
+ */
+
+ add: function() {
+
+ // reference
+ var self = this,
+ $field = this.$field;
+
+
+ // get repeater
+ var $repeater = acf.get_closest_field( this.$field, 'repeater' );
+
+
+ // popup
+ var frame = acf.media.popup({
+
+ title: acf._e('image', 'select'),
+ mode: 'select',
+ type: 'image',
+ field: $field.data('key'),
+ multiple: $repeater.exists(),
+ library: this.o.library,
+ mime_types: this.o.mime_types,
+
+ select: function( attachment, i ) {
+
+ // select / add another image field?
+ if( i > 0 ) {
+
+ // vars
+ var key = $field.data('key'),
+ $tr = $field.closest('.acf-row');
+
+
+ // reset field
+ $field = false;
+
+
+ // find next image field
+ $tr.nextAll('.acf-row:visible').each(function(){
+
+ // get next $field
+ $field = acf.get_field( key, $(this) );
+
+
+ // bail early if $next was not found
+ if( !$field ) return;
+
+
+ // bail early if next file uploader has value
+ if( $field.find('.acf-image-uploader.has-value').exists() ) {
+
+ $field = false;
+ return;
+
+ }
+
+
+ // end loop if $next is found
+ return false;
+
+ });
+
+
+ // add extra row if next is not found
+ if( !$field ) {
+
+ $tr = acf.fields.repeater.doFocus( $repeater ).add();
+
+
+ // bail early if no $tr (maximum rows hit)
+ if( !$tr ) return false;
+
+
+ // get next $field
+ $field = acf.get_field( key, $tr );
+
+ }
+
+ }
+
+
+ // render
+ self.set('$field', $field).render( attachment );
+
+ }
+
+ });
+
+ },
+
+
+ /*
+ * edit
+ *
+ * event listener
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param e (event)
+ * @return n/a
+ */
+
+ edit: function() {
+
+ // reference
+ var self = this,
+ $field = this.$field;
+
+
+ // vars
+ var val = this.$input.val();
+
+
+ // bail early if no val
+ if( !val ) return;
+
+
+ // popup
+ var frame = acf.media.popup({
+
+ title: acf._e('image', 'edit'),
+ button: acf._e('image', 'update'),
+ mode: 'edit',
+ attachment: val,
+
+ select: function( attachment, i ) {
+
+ // render
+ self.set('$field', $field).render( attachment );
+
+ }
+
+ });
+
+ },
+
+
+ /*
+ * remove
+ *
+ * event listener
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param e (event)
+ * @return n/a
+ */
+
+ remove: function() {
+
+ // vars
+ var attachment = {};
+
+
+ // add file to field
+ this.render( attachment );
+
+ },
+
+
+ /*
+ * change
+ *
+ * This function will update the hidden input when selecting a basic file to add basic validation
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param e (event)
+ * @return n/a
+ */
+
+ change: function( e ){
+
+ acf.fields.file.get_file_info( e.$el, this.$input );
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.link = acf.field.extend({
+
+ type: 'link',
+ active: false,
+ $el: null,
+ $node: null,
+
+ events: {
+ 'click a[data-name="add"]': 'add',
+ 'click a[data-name="edit"]': 'edit',
+ 'click a[data-name="remove"]': 'remove',
+ 'change .link-node': 'change',
+ },
+
+
+ /*
+ * focus
+ *
+ * This function will setup variables when focused on a field
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ focus: function(){
+
+ // get elements
+ this.$el = this.$field.find('.acf-link');
+ this.$node = this.$el.find('.link-node');
+
+ },
+
+ add: function( e ){
+
+ acf.link.open( this.$node );
+
+ },
+
+ edit: function( e ){
+
+ this.add();
+
+ },
+
+ remove: function( e ){
+
+ this.val('');
+
+ },
+
+ change: function( e, value ){
+
+ // vars
+ var val = {
+ 'title': this.$node.html(),
+ 'url': this.$node.attr('href'),
+ 'target': this.$node.attr('target')
+ };
+
+
+ // vars
+ this.val( val );
+
+ },
+
+ val: function( val ){
+
+ // default
+ val = acf.parse_args(val, {
+ 'title': '',
+ 'url': '',
+ 'target': ''
+ });
+
+
+ // remove class
+ this.$el.removeClass('-value -external');
+
+
+ // add class
+ if( val.url ) this.$el.addClass('-value');
+ if( val.target === '_blank' ) this.$el.addClass('-external');
+
+
+ // update text
+ this.$el.find('.link-title').html( val.title );
+ this.$el.find('.link-url').attr('href', val.url).html( val.url );
+
+
+ // update inputs
+ this.$el.find('.input-title').val( val.title );
+ this.$el.find('.input-target').val( val.target );
+ this.$el.find('.input-url').val( val.url ).trigger('change');
+
+
+ // update node
+ this.$node.html(val.title);
+ this.$node.attr('href', val.url);
+ this.$node.attr('target', val.target);
+ }
+
+ });
+
+
+ /*
+ * acf.link
+ *
+ * This model will handle adding tabs and groups
+ *
+ * @type function
+ * @date 25/11/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ acf.link = acf.model.extend({
+
+ active: false,
+ $textarea: null,
+ $node: null,
+
+ events: {
+ 'click #wp-link-submit': '_update',
+ //'river-select .query-results': '_select',
+ 'wplink-open': '_open',
+ 'wplink-close': '_close',
+ },
+
+ atts: function( value ){
+
+ // update
+ if( typeof value !== 'undefined' ) {
+
+ this.$node.html( value.title );
+ this.$node.attr('href', value.url);
+ this.$node.attr('target', value.target);
+ this.$node.trigger('change', [value]);
+ return true;
+
+ }
+
+
+ // get
+ return {
+ 'title': this.$node.html(),
+ 'url': this.$node.attr('href'),
+ 'target': this.$node.attr('target')
+ };
+
+ },
+
+ inputs: function( value ){
+
+ // update
+ if( typeof value !== 'undefined' ) {
+
+ $('#wp-link-text').val( value.title );
+ $('#wp-link-url').val( value.url );
+ $('#wp-link-target').prop('checked', value.target === '_blank' );
+ return true;
+
+ }
+
+
+ // get
+ return {
+ 'title': $('#wp-link-text').val(),
+ 'url': $('#wp-link-url').val(),
+ 'target': $('#wp-link-target').prop('checked') ? '_blank' : ''
+ };
+
+ },
+
+ open: function( $node ){
+
+ // create textarea
+ var $textarea = $('');
+
+
+ // append textarea
+ $node.before( $textarea );
+
+
+ // update vars
+ this.active = true;
+ this.$node = $node;
+ this.$textarea = $textarea;
+
+
+ // get atts
+ var atts = this.atts();
+
+
+ // open link
+ wpLink.open( 'acf-link-textarea', atts.url, atts.title, null );
+
+
+ // always show title (WP will hide title if empty)
+ $('#wp-link-wrap').addClass('has-text-field');
+
+ },
+
+ reset: function(){
+
+ this.active = false;
+ this.$textarea.remove();
+ this.$textarea = null;
+ this.$node = null;
+
+ },
+
+ _select: function( e, $li ){
+
+ // get inputs
+ var val = this.inputs();
+
+
+ // update title
+ if( !val.title ) {
+
+ val.title = $li.find('.item-title').text();
+ this.inputs( val );
+
+ console.log(val);
+ }
+
+ },
+
+ _open: function( e ){
+
+ // bail early if not active
+ if( !this.active ) return;
+
+
+ // get atts
+ var val = this.atts();
+
+
+ // update WP inputs
+ this.inputs( val );
+
+ },
+
+ _close: function( e ){
+
+ // bail early if not active
+ if( !this.active ) return;
+
+
+ // reset vars
+ // use timeout to allow _update() function to check vars
+ setTimeout(function(){
+
+ acf.link.reset();
+
+ }, 100);
+
+ },
+
+ _update: function( e ){
+
+ // bail early if not active
+ if( !this.active ) return;
+
+
+ // get atts
+ var val = this.inputs();
+
+
+ // update node
+ this.atts( val );
+
+ }
+
+ });
+
+
+ // todo - listen to AJAX for wp-link-ajax and append post_id to value
+
+
+})(jQuery);
+
+(function($){
+
+ acf.media = acf.model.extend({
+
+ frames: [],
+ mime_types: {},
+
+ actions: {
+ 'ready': 'ready'
+ },
+
+
+ /*
+ * frame
+ *
+ * This function will return the current frame
+ *
+ * @type function
+ * @date 11/04/2016
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return frame (object)
+ */
+
+ frame: function(){
+
+ // vars
+ var i = this.frames.length - 1;
+
+
+ // bail early if no index
+ if( i < 0 ) return false;
+
+
+ // return
+ return this.frames[ i ];
+
+ },
+
+
+ /*
+ * destroy
+ *
+ * this function will destroy a frame
+ *
+ * @type function
+ * @date 11/04/2016
+ * @since 5.3.8
+ *
+ * @return frame (object)
+ * @return n/a
+ */
+
+ destroy: function( frame ) {
+
+ // detach
+ frame.detach();
+ frame.dispose();
+
+
+ // remove frame
+ frame = null;
+ this.frames.pop();
+
+ },
+
+
+ /*
+ * popup
+ *
+ * This function will create a wp media popup frame
+ *
+ * @type function
+ * @date 11/04/2016
+ * @since 5.3.8
+ *
+ * @param args (object)
+ * @return frame (object)
+ */
+
+ popup: function( args ) {
+
+ // vars
+ var post_id = acf.get('post_id'),
+ frame = false;
+
+
+ // validate post_id
+ if( !$.isNumeric(post_id) ) post_id = 0;
+
+
+ // settings
+ var settings = acf.parse_args( args, {
+ mode: 'select', // 'select', 'edit'
+ title: '', // 'Upload Image'
+ button: '', // 'Select Image'
+ type: '', // 'image', ''
+ field: '', // 'field_123'
+ mime_types: '', // 'pdf, etc'
+ library: 'all', // 'all', 'uploadedTo'
+ multiple: false, // false, true, 'add'
+ attachment: 0, // the attachment to edit
+ post_id: post_id, // the post being edited
+ select: function(){}
+ });
+
+
+ // id changed to attributes
+ if( settings.id ) settings.attachment = settings.id;
+
+
+ // create frame
+ var frame = this.new_media_frame( settings );
+
+
+ // append
+ this.frames.push( frame );
+
+
+ // open popup (allow frame customization before opening)
+ setTimeout(function(){
+
+ frame.open();
+
+ }, 1);
+
+
+ // return
+ return frame;
+
+ },
+
+
+ /*
+ * _get_media_frame_settings
+ *
+ * This function will return an object containing frame settings
+ *
+ * @type function
+ * @date 11/04/2016
+ * @since 5.3.8
+ *
+ * @param frame (object)
+ * @param settings (object)
+ * @return frame (object)
+ */
+
+ _get_media_frame_settings: function( frame, settings ){
+
+ // select
+ if( settings.mode === 'select' ) {
+
+ frame = this._get_select_frame_settings( frame, settings );
+
+ // edit
+ } else if( settings.mode === 'edit' ) {
+
+ frame = this._get_edit_frame_settings( frame, settings );
+
+ }
+
+
+ // return
+ return frame;
+
+ },
+
+ _get_select_frame_settings: function( frame, settings ){
+
+ // type
+ if( settings.type ) {
+
+ frame.library.type = settings.type;
+
+ }
+
+
+ // library
+ if( settings.library === 'uploadedTo' ) {
+
+ frame.library.uploadedTo = settings.post_id;
+
+ }
+
+
+ // button
+ frame._button = acf._e('media', 'select');
+
+
+ // return
+ return frame;
+
+ },
+
+ _get_edit_frame_settings: function( frame, settings ){
+
+ // post__in
+ frame.library.post__in = [ settings.attachment ];
+
+
+ // button
+ frame._button = acf._e('media', 'update');
+
+
+ // return
+ return frame;
+
+ },
+
+
+ /*
+ * _add_media_frame_events
+ *
+ * This function will add events to the frame object
+ *
+ * @type function
+ * @date 11/04/2016
+ * @since 5.3.8
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ _add_media_frame_events: function( frame, settings ){
+
+ // log events
+/*
+ frame.on('all', function( e ) {
+
+ console.log( 'frame all: %o', e );
+
+ });
+*/
+
+
+ // add class
+ frame.on('open',function() {
+
+ // add class
+ this.$el.closest('.media-modal').addClass('acf-media-modal -' +settings.mode );
+
+ }, frame);
+
+
+ // edit image view
+ // source: media-views.js:2410 editImageContent()
+ frame.on('content:render:edit-image', function(){
+
+ var image = this.state().get('image'),
+ view = new wp.media.view.EditImage( { model: image, controller: this } ).render();
+
+ this.content.set( view );
+
+ // after creating the wrapper view, load the actual editor via an ajax call
+ view.loadEditor();
+
+ }, frame);
+
+
+ // update toolbar button
+ frame.on( 'toolbar:create:select', function( toolbar ) {
+
+ toolbar.view = new wp.media.view.Toolbar.Select({
+ text: frame.options._button,
+ controller: this
+ });
+
+ }, frame );
+
+
+ // select image
+ frame.on('select', function() {
+
+ // get selected images
+ var state = frame.state(),
+ image = state.get('image'),
+ selection = state.get('selection');
+
+
+ // if editing image
+ if( image ) {
+
+ settings.select.apply( frame, [image, 0] );
+
+ return;
+
+ }
+
+
+ // if selecting images
+ if( selection ) {
+
+ // vars
+ var i = 0;
+
+
+ // loop
+ selection.each(function( attachment ){
+
+ settings.select.apply( frame, [attachment, i] );
+
+ i++;
+
+ });
+
+ return;
+
+ }
+
+ });
+
+
+ // close popup
+ frame.on('close',function(){
+
+ setTimeout(function(){
+
+ acf.media.destroy( frame );
+
+ }, 500);
+
+ });
+
+
+ // select
+ if( settings.mode === 'select' ) {
+
+ frame = this._add_select_frame_events( frame, settings );
+
+ // edit
+ } else if( settings.mode === 'edit' ) {
+
+ frame = this._add_edit_frame_events( frame, settings );
+
+ }
+
+
+ // return
+ return frame;
+
+ },
+
+ _add_select_frame_events: function( frame, settings ){
+
+ // reference
+ var self = this;
+
+
+ // plupload
+ // adds _acfuploader param to validate uploads
+ if( acf.isset(_wpPluploadSettings, 'defaults', 'multipart_params') ) {
+
+ // add _acfuploader so that Uploader will inherit
+ _wpPluploadSettings.defaults.multipart_params._acfuploader = settings.field;
+
+
+ // remove acf_field so future Uploaders won't inherit
+ frame.on('open', function(){
+
+ delete _wpPluploadSettings.defaults.multipart_params._acfuploader;
+
+ });
+
+ }
+
+
+ // modify DOM
+ frame.on('content:activate:browse', function(){
+
+ // populate above vars making sure to allow for failure
+ try {
+
+ var toolbar = frame.content.get().toolbar,
+ filters = toolbar.get('filters'),
+ search = toolbar.get('search');
+
+ } catch(e) {
+
+ // one of the objects was 'undefined'... perhaps the frame open is Upload Files
+ // console.log( 'error %o', e );
+ return;
+
+ }
+
+
+ // image
+ if( settings.type == 'image' ) {
+
+ // update all
+ filters.filters.all.text = acf._e('image', 'all');
+
+
+ // remove some filters
+ delete filters.filters.audio;
+ delete filters.filters.video;
+
+
+ // update all filters to show images
+ $.each( filters.filters, function( k, filter ){
+
+ if( filter.props.type === null ) {
+
+ filter.props.type = 'image';
+
+ }
+
+ });
+
+ }
+
+
+ // custom mime types
+ if( settings.mime_types ) {
+
+ // explode
+ var extra_types = settings.mime_types.split(' ').join('').split('.').join('').split(',');
+
+
+ // loop through mime_types
+ $.each( extra_types, function( i, type ){
+
+ // find mime
+ $.each( self.mime_types, function( t, mime ){
+
+ // continue if key does not match
+ if( t.indexOf(type) === -1 ) {
+
+ return;
+
+ }
+
+
+ // create new filter
+ var filter = {
+ text: type,
+ props: {
+ status: null,
+ type: mime,
+ uploadedTo: null,
+ orderby: 'date',
+ order: 'DESC'
+ },
+ priority: 20
+ };
+
+
+ // append filter
+ filters.filters[ mime ] = filter;
+
+ });
+
+ });
+
+ }
+
+
+ // uploaded to post
+ if( settings.library == 'uploadedTo' ) {
+
+ // remove some filters
+ delete filters.filters.unattached;
+ delete filters.filters.uploaded;
+
+
+ // add 'uploadedTo' text
+ filters.$el.parent().append('' + acf._e('image', 'uploadedTo') + ' ');
+
+
+ // add uploadedTo to filters
+ $.each( filters.filters, function( k, filter ){
+
+ filter.props.uploadedTo = settings.post_id;
+
+ });
+
+ }
+
+
+ // add _acfuploader to filters
+ $.each( filters.filters, function( k, filter ){
+
+ filter.props._acfuploader = settings.field;
+
+ });
+
+
+ // add _acfuplaoder to search
+ search.model.attributes._acfuploader = settings.field;
+
+
+ // render
+ if( typeof filters.refresh === 'function' ) {
+
+ filters.refresh();
+
+ }
+
+ });
+
+
+ // return
+ return frame;
+
+ },
+
+ _add_edit_frame_events: function( frame, settings ){
+
+ // add class
+ frame.on('open',function() {
+
+ // add class
+ this.$el.closest('.media-modal').addClass('acf-expanded');
+
+
+ // set to browse
+ if( this.content.mode() != 'browse' ) {
+
+ this.content.mode('browse');
+
+ }
+
+
+ // set selection
+ var state = this.state(),
+ selection = state.get('selection'),
+ attachment = wp.media.attachment( settings.attachment );
+
+
+ selection.add( attachment );
+
+ }, frame);
+
+
+ // return
+ return frame;
+
+ },
+
+
+ /*
+ * new_media_frame
+ *
+ * this function will create a new media frame
+ *
+ * @type function
+ * @date 11/04/2016
+ * @since 5.3.8
+ *
+ * @param settings (object)
+ * @return frame (object)
+ */
+
+ new_media_frame: function( settings ){
+
+ // vars
+ var attributes = {
+ title: settings.title,
+ multiple: settings.multiple,
+ library: {},
+ states: []
+ };
+
+
+ // get options
+ attributes = this._get_media_frame_settings( attributes, settings );
+
+
+ // create query
+ var Query = wp.media.query( attributes.library );
+
+
+ // add _acfuploader
+ // this is super wack!
+ // if you add _acfuploader to the options.library args, new uploads will not be added to the library view.
+ // this has been traced back to the wp.media.model.Query initialize function (which can't be overriden)
+ // Adding any custom args will cause the Attahcments to not observe the uploader queue
+ // To bypass this security issue, we add in the args AFTER the Query has been initialized
+ // options.library._acfuploader = settings.field;
+ if( acf.isset(Query, 'mirroring', 'args') ) {
+
+ Query.mirroring.args._acfuploader = settings.field;
+
+ }
+
+
+ // add states
+ attributes.states = [
+
+ // main state
+ new wp.media.controller.Library({
+ library: Query,
+ multiple: attributes.multiple,
+ title: attributes.title,
+ priority: 20,
+ filterable: 'all',
+ editable: true,
+
+ // If the user isn't allowed to edit fields,
+ // can they still edit it locally?
+ allowLocalEdits: true
+ })
+
+ ];
+
+
+ // edit image functionality (added in WP 3.9)
+ if( acf.isset(wp, 'media', 'controller', 'EditImage') ) {
+
+ attributes.states.push( new wp.media.controller.EditImage() );
+
+ }
+
+
+ // create frame
+ var frame = wp.media( attributes );
+
+
+ // add args reference
+ frame.acf = settings;
+
+
+ // add events
+ frame = this._add_media_frame_events( frame, settings );
+
+
+ // return
+ return frame;
+
+ },
+
+ ready: function(){
+
+ // vars
+ var version = acf.get('wp_version'),
+ browser = acf.get('browser'),
+ post_id = acf.get('post_id');
+
+
+ // update wp.media
+ if( acf.isset(window,'wp','media','view','settings','post') && $.isNumeric(post_id) ) {
+
+ wp.media.view.settings.post.id = post_id;
+
+ }
+
+
+ // append browser
+ if( browser ) {
+
+ $('body').addClass('browser-' + browser );
+
+ }
+
+
+ // append version
+ if( version ) {
+
+ // ensure is string
+ version = version + '';
+
+
+ // use only major version
+ major = version.substr(0,1);
+
+
+ // add body class
+ $('body').addClass('major-' + major);
+
+ }
+
+
+ // customize wp.media views
+ if( acf.isset(window, 'wp', 'media', 'view') ) {
+
+ //this.customize_Attachments();
+ //this.customize_Query();
+ //this.add_AcfEmbed();
+ this.customize_Attachment();
+ this.customize_AttachmentFiltersAll();
+ this.customize_AttachmentCompat();
+
+ }
+
+ },
+
+
+/*
+ add_AcfEmbed: function(){
+
+ //test urls
+ //(image) jpg: http://www.ml24.net/img/ml24_design_process_scion_frs_3d_rendering.jpg
+ //(image) svg: http://kompozer.net/images/svg/Mozilla_Firefox.svg
+ //(file) pdf: http://martinfowler.com/ieeeSoftware/whenType.pdf
+ //(video) mp4: https://videos.files.wordpress.com/kUJmAcSf/bbb_sunflower_1080p_30fps_normal_hd.mp4
+
+
+
+ // add view
+ wp.media.view.AcfEmbed = wp.media.view.Embed.extend({
+
+ initialize: function() {
+
+ // set attachments
+ this.model.props.attributes = this.controller.acf.attachment || {};
+
+
+ // refresh
+ wp.media.view.Embed.prototype.initialize.apply( this, arguments );
+
+ },
+
+ refresh: function() {
+
+ // vars
+ var attachment = acf.parse_args(this.model.props.attributes, {
+ url: '',
+ filename: '',
+ title: '',
+ caption: '',
+ alt: '',
+ description: '',
+ type: '',
+ ext: ''
+ });
+
+
+ // update attachment
+ if( attachment.url ) {
+
+ // filename
+ attachment.filename = attachment.url.split('/').pop().split('?')[0];
+
+
+ // update
+ attachment.ext = attachment.filename.split('.').pop();
+ attachment.type = /(jpe?g|png|gif|svg)/i.test(attachment.ext) ? 'image': 'file';
+
+ }
+
+
+ // auto generate title
+ if( attachment.filename && !attachment.title ) {
+
+ // replace
+ attachment.title = attachment.filename.split('-').join(' ').split('_').join(' ');
+
+
+ // uppercase first word
+ attachment.title = attachment.title.charAt(0).toUpperCase() + attachment.title.slice(1);
+
+
+ // remove extension
+ attachment.title = attachment.title.replace('.'+attachment.ext, '');
+
+
+ // update model
+ this.model.props.attributes.title = attachment.title;
+
+ }
+
+
+ // save somee extra data
+ this.model.props.attributes.filename = attachment.filename;
+ this.model.props.attributes.type = attachment.type;
+
+
+ // always show image view
+ // avoid this.model.set() to prevent listeners updating view
+ this.model.attributes.type = 'image';
+
+
+ // refresh
+ wp.media.view.Embed.prototype.refresh.apply( this, arguments );
+
+
+ // append title
+ this.$el.find('.setting.caption').before([
+ '',
+ 'Title ',
+ ' ',
+ ' '
+ ].join(''));
+
+
+ // append description
+ this.$el.find('.setting.alt-text').after([
+ '',
+ 'Description ',
+ '',
+ ' '
+ ].join(''));
+
+
+ // hide alt
+ if( attachment.type !== 'image' ) {
+
+ this.$el.find('.setting.alt-text').hide();
+
+ }
+
+ }
+
+ });
+
+ },
+*/
+/*
+
+ customize_Attachments: function(){
+
+ // vars
+ var Attachments = wp.media.model.Attachments;
+
+
+ wp.media.model.Attachments = Attachments.extend({
+
+ initialize: function( models, options ){
+
+ // console.log('My Attachments initialize: %o %o %o', this, models, options);
+
+ // return
+ return Attachments.prototype.initialize.apply( this, arguments );
+
+ },
+
+ sync: function( method, model, options ) {
+
+ // console.log('My Attachments sync: %o %o %o %o', this, method, model, options);
+
+
+ // return
+ return Attachments.prototype.sync.apply( this, arguments );
+
+ }
+
+ });
+
+ },
+
+ customize_Query: function(){
+
+ // console.log('customize Query!');
+
+ // vars
+ var Query = wp.media.model.Query;
+
+
+ wp.media.model.Query = {};
+
+ },
+*/
+
+ customize_Attachment: function(){
+
+ // vars
+ var AttachmentLibrary = wp.media.view.Attachment.Library;
+
+
+ // extend
+ wp.media.view.Attachment.Library = AttachmentLibrary.extend({
+
+ render: function() {
+
+ // vars
+ var frame = acf.media.frame(),
+ errors = acf.maybe_get(this, 'model.attributes.acf_errors');
+
+
+ // add class
+ // also make sure frame exists to prevent this logic running on a WP popup (such as feature image)
+ if( frame && errors ) {
+
+ this.$el.addClass('acf-disabled');
+
+ }
+
+
+ // return
+ return AttachmentLibrary.prototype.render.apply( this, arguments );
+
+ },
+
+
+ /*
+ * toggleSelection
+ *
+ * This function is called before an attachment is selected
+ * A good place to check for errors and prevent the 'select' function from being fired
+ *
+ * @type function
+ * @date 29/09/2016
+ * @since 5.4.0
+ *
+ * @param options (object)
+ * @return n/a
+ */
+
+ toggleSelection: function( options ) {
+
+ // vars
+ // source: wp-includes/js/media-views.js:2880
+ var collection = this.collection,
+ selection = this.options.selection,
+ model = this.model,
+ single = selection.single();
+
+
+ // vars
+ var frame = acf.media.frame(),
+ errors = acf.maybe_get(this, 'model.attributes.acf_errors'),
+ $sidebar = this.controller.$el.find('.media-frame-content .media-sidebar');
+
+
+ // remove previous error
+ $sidebar.children('.acf-selection-error').remove();
+
+
+ // show attachment details
+ $sidebar.children().removeClass('acf-hidden');
+
+
+ // add message
+ if( frame && errors ) {
+
+ // vars
+ var filename = acf.maybe_get(this, 'model.attributes.filename', '');
+
+
+ // hide attachment details
+ // Gallery field continues to show previously selected attachment...
+ $sidebar.children().addClass('acf-hidden');
+
+
+ // append message
+ $sidebar.prepend([
+ '',
+ '' + acf._e('restricted') +' ',
+ '' + filename + ' ',
+ '' + errors + ' ',
+ '
'
+ ].join(''));
+
+
+ // reset selection (unselects all attachments)
+ selection.reset();
+
+
+ // set single (attachment displayed in sidebar)
+ selection.single( model );
+
+
+ // return and prevent 'select' form being fired
+ return;
+
+ }
+
+
+ // return
+ AttachmentLibrary.prototype.toggleSelection.apply( this, arguments );
+
+ }
+
+ });
+
+ },
+
+ customize_AttachmentFiltersAll: function(){
+
+ // add function refresh
+ wp.media.view.AttachmentFilters.All.prototype.refresh = function(){
+
+ // Build `` elements.
+ this.$el.html( _.chain( this.filters ).map( function( filter, value ) {
+ return {
+ el: $( ' ' ).val( value ).html( filter.text )[0],
+ priority: filter.priority || 50
+ };
+ }, this ).sortBy('priority').pluck('el').value() );
+
+ };
+
+ },
+
+ customize_AttachmentCompat: function(){
+
+ // vars
+ var AttachmentCompat = wp.media.view.AttachmentCompat;
+
+
+ // extend
+ wp.media.view.AttachmentCompat = AttachmentCompat.extend({
+
+ add_acf_expand_button: function(){
+
+ // vars
+ var $el = this.$el.closest('.media-modal');
+
+
+ // does button already exist?
+ if( $el.find('.media-frame-router .acf-expand-details').exists() ) return;
+
+
+ // create button
+ var $a = $([
+ '',
+ ' ' + acf._e('expand_details') + ' ',
+ ' ' + acf._e('collapse_details') + ' ',
+ ' '
+ ].join(''));
+
+
+ // add events
+ $a.on('click', function( e ){
+
+ e.preventDefault();
+
+ if( $el.hasClass('acf-expanded') ) {
+
+ $el.removeClass('acf-expanded');
+
+ } else {
+
+ $el.addClass('acf-expanded');
+
+ }
+
+ });
+
+
+ // append
+ $el.find('.media-frame-router').append( $a );
+
+ },
+
+ render: function() {
+
+ // validate
+ if( this.ignore_render ) return this;
+
+
+ // reference
+ var self = this;
+
+
+ // add expand button
+ setTimeout(function(){
+
+ self.add_acf_expand_button();
+
+ }, 0);
+
+
+ // setup fields
+ // The clearTimout is needed to prevent many setup functions from running at the same time
+ clearTimeout( acf.media.render_timout );
+ acf.media.render_timout = setTimeout(function(){
+
+ acf.do_action('append', self.$el);
+
+ }, 50);
+
+
+ // return
+ return AttachmentCompat.prototype.render.apply( this, arguments );
+
+ },
+
+
+ dispose: function() {
+
+ // remove
+ acf.do_action('remove', this.$el);
+
+
+ // return
+ return AttachmentCompat.prototype.dispose.apply( this, arguments );
+
+ },
+
+
+ save: function( e ) {
+
+ if( e ) {
+
+ e.preventDefault();
+
+ }
+
+
+ // serialize form
+ var data = acf.serialize(this.$el);
+
+
+ // ignore render
+ this.ignore_render = true;
+
+
+ // save
+ this.model.saveCompat( data );
+
+ }
+
+
+ });
+
+ }
+
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.oembed = acf.field.extend({
+
+ type: 'oembed',
+ $el: null,
+
+ events: {
+ 'click [data-name="search-button"]': '_search',
+ 'click [data-name="clear-button"]': '_clear',
+ 'click [data-name="value-title"]': '_edit',
+ 'keypress [data-name="search-input"]': '_keypress',
+ 'keyup [data-name="search-input"]': '_keyup',
+ 'blur [data-name="search-input"]': '_blur'
+ },
+
+
+ /*
+ * focus
+ *
+ * This function will setup variables when focused on a field
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ focus: function(){
+
+ // vars
+ this.$el = this.$field.find('.acf-oembed');
+ this.$search = this.$el.find('[data-name="search-input"]');
+ this.$input = this.$el.find('[data-name="value-input"]');
+ this.$title = this.$el.find('[data-name="value-title"]');
+ this.$embed = this.$el.find('[data-name="value-embed"]');
+
+
+ // options
+ this.o = acf.get_data( this.$el );
+
+ },
+
+
+ /*
+ * maybe_search
+ *
+ * description
+ *
+ * @type function
+ * @date 14/10/16
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ maybe_search: function(){
+
+ // set url and focus
+ var old_url = this.$input.val(),
+ new_url = this.$search.val();
+
+
+ // bail early if no value
+ if( !new_url ) {
+
+ this.clear();
+ return;
+
+ }
+
+
+ // bail early if no change
+ if( new_url == old_url ) return;
+
+
+ // search
+ this.search();
+
+ },
+
+
+ /*
+ * search
+ *
+ * This function will search for an oembed
+ *
+ * @type function
+ * @date 13/10/16
+ * @since 5.4.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ search: function(){
+
+ // vars
+ var s = this.$search.val();
+
+
+ // fix missing 'http://' - causes the oembed code to error and fail
+ if( s.substr(0, 4) != 'http' ) {
+
+ s = 'http://' + s;
+ this.$search.val( s );
+
+ }
+
+
+ // show loading
+ this.$el.addClass('is-loading');
+
+
+ // AJAX data
+ var ajax_data = acf.prepare_for_ajax({
+ 'action' : 'acf/fields/oembed/search',
+ 's' : s,
+ 'field_key' : this.$field.data('key')
+ });
+
+
+ // abort XHR if this field is already loading AJAX data
+ if( this.$el.data('xhr') ) this.$el.data('xhr').abort();
+
+
+ // get HTML
+ var xhr = $.ajax({
+ url: acf.get('ajaxurl'),
+ data: ajax_data,
+ type: 'post',
+ dataType: 'json',
+ context: this,
+ success: this.search_success
+ });
+
+
+ // update el data
+ this.$el.data('xhr', xhr);
+
+ },
+
+ search_success: function( json ){
+
+ // vars
+ var s = this.$search.val();
+
+
+ // remove loading
+ this.$el.removeClass('is-loading');
+
+
+ // error
+ if( !json || !json.html ) {
+
+ this.$el.removeClass('has-value').addClass('has-error');
+ return;
+
+ }
+
+
+ // add classes
+ this.$el.removeClass('has-error').addClass('has-value');
+
+
+ // update vars
+ this.$input.val( s );
+ this.$title.html( s );
+ this.$embed.html( json.html );
+
+ },
+
+ clear: function(){
+
+ // update class
+ this.$el.removeClass('has-error has-value');
+
+
+ // clear search
+ this.$el.find('[data-name="search-input"]').val('');
+
+
+ // clear inputs
+ this.$input.val('');
+ this.$title.html('');
+ this.$embed.html('');
+
+ },
+
+ edit: function(){
+
+ // add class
+ this.$el.addClass('is-editing');
+
+
+ // set url and focus
+ this.$search.val( this.$title.text() ).focus();
+
+ },
+
+ blur: function( $el ){
+
+ // remove class
+ this.$el.removeClass('is-editing');
+
+
+ // maybe search
+ this.maybe_search();
+
+ },
+
+ _search: function( e ){ // console.log('_search');
+
+ this.search();
+
+ },
+
+ _clear: function( e ){ // console.log('_clear');
+
+ this.clear();
+
+ },
+
+ _edit: function( e ){ // console.log('_clear');
+
+ this.edit();
+
+ },
+
+ _keypress: function( e ){ // console.log('_keypress');
+
+ // don't submit form
+ if( e.which == 13 ) e.preventDefault();
+
+ },
+
+ _keyup: function( e ){ //console.log('_keypress', e.which);
+
+ // bail early if no value
+ if( !this.$search.val() ) return;
+
+
+ // maybe search
+ this.maybe_search();
+
+ },
+
+ _blur: function( e ){ // console.log('_blur');
+
+ this.blur();
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.radio = acf.field.extend({
+
+ type: 'radio',
+
+ $ul: null,
+
+ actions: {
+ 'ready': 'initialize',
+ 'append': 'initialize'
+ },
+
+ events: {
+ 'click input[type="radio"]': 'click'
+ },
+
+ focus: function(){
+
+ // focus on $select
+ this.$ul = this.$field.find('.acf-radio-list');
+
+
+ // get options
+ this.o = acf.get_data( this.$ul );
+
+ },
+
+
+ /*
+ * initialize
+ *
+ * This function will fix a bug found in Chrome.
+ * A radio input (for a given name) may only have 1 selected value. When used within a fc layout
+ * multiple times (clone field), the selected value (default value) will not be checked.
+ * This simply re-checks it.
+ *
+ * @type function
+ * @date 30/08/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ initialize: function(){
+
+ // find selected input and check it
+ this.$ul.find('.selected input').prop('checked', true);
+
+ },
+
+ click: function(e){
+
+ // vars
+ var $radio = e.$el,
+ $label = $radio.parent('label'),
+ selected = $label.hasClass('selected'),
+ val = $radio.val();
+
+
+ // remove previous selected
+ this.$ul.find('.selected').removeClass('selected');
+
+
+ // add active class
+ $label.addClass('selected');
+
+
+ // allow null
+ if( this.o.allow_null && selected ) {
+
+ // unselect
+ e.$el.prop('checked', false);
+ $label.removeClass('selected');
+ val = false;
+
+
+ // trigger change
+ e.$el.trigger('change');
+
+ }
+
+
+ // other
+ if( this.o.other_choice ) {
+
+ // vars
+ var $other = this.$ul.find('input[type="text"]');
+
+
+ // show
+ if( val === 'other' ) {
+
+ $other.prop('disabled', false).attr('name', $radio.attr('name'));
+
+ // hide
+ } else {
+
+ $other.prop('disabled', true).attr('name', '');
+
+ }
+
+ }
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.range = acf.field.extend({
+
+ type: 'range',
+ $el: null,
+ $range: null,
+ $input: null,
+
+ events: {
+ 'input input': '_change',
+ 'change input': '_change'
+ },
+
+ focus: function(){
+
+ // get elements
+ this.$el = this.$field.find('.acf-range-wrap');
+ this.$range = this.$el.children('input[type="range"]');
+ this.$input = this.$el.children('input[type="number"]');
+
+ },
+
+ _change: function( e ){
+
+ // get value from changed element
+ var val = e.$el.val();
+ var type = e.$el.attr('type');
+
+
+ // allow for cleared value
+ val = val || 0;
+
+
+ // update sibling
+ if( type === 'range' ) {
+
+ this.$input.val( val );
+
+ } else {
+
+ this.$range.val( val );
+
+ }
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.relationship = acf.field.extend({
+
+ type: 'relationship',
+
+ $el: null,
+ $input: null,
+ $filters: null,
+ $choices: null,
+ $values: null,
+
+ actions: {
+ 'ready': 'initialize',
+ 'append': 'initialize'
+ },
+
+ events: {
+ 'keypress [data-filter]': 'submit_filter',
+ 'change [data-filter]': 'change_filter',
+ 'keyup [data-filter]': 'change_filter',
+ 'click .choices .acf-rel-item': 'add_item',
+ 'click [data-name="remove_item"]': 'remove_item'
+ },
+
+ focus: function(){
+
+ // get elements
+ this.$el = this.$field.find('.acf-relationship');
+ this.$input = this.$el.children('input[type="hidden"]');
+ this.$choices = this.$el.find('.choices'),
+ this.$values = this.$el.find('.values');
+
+ // get options
+ this.o = acf.get_data( this.$el );
+
+ },
+
+ initialize: function(){
+
+ // reference
+ var self = this,
+ $field = this.$field,
+ $el = this.$el,
+ $input = this.$input;
+
+
+ // right sortable
+ this.$values.children('.list').sortable({
+ items: 'li',
+ forceHelperSize: true,
+ forcePlaceholderSize: true,
+ scroll: true,
+ update: function(){
+
+ $input.trigger('change');
+
+ }
+ });
+
+
+ this.$choices.children('.list').scrollTop(0).on('scroll', function(e){
+
+ // bail early if no more results
+ if( $el.hasClass('is-loading') || $el.hasClass('is-empty') ) {
+
+ return;
+
+ }
+
+
+ // Scrolled to bottom
+ if( Math.ceil( $(this).scrollTop() ) + $(this).innerHeight() >= $(this).get(0).scrollHeight ) {
+
+ // get paged
+ var paged = $el.data('paged') || 1;
+
+
+ // update paged
+ $el.data('paged', (paged+1) );
+
+
+ // fetch
+ self.set('$field', $field).fetch();
+
+ }
+
+ });
+
+
+/*
+ // scroll event
+ var maybe_fetch = function( e ){
+ console.log('scroll');
+ // remove listener
+ $(window).off('scroll', maybe_fetch);
+
+
+ // is field in view
+ if( acf.is_in_view($field) ) {
+
+ // fetch
+ self.doFocus($field);
+ self.fetch();
+
+
+ // return
+ return;
+ }
+
+
+ // add listener
+ setTimeout(function(){
+
+ $(window).on('scroll', maybe_fetch);
+
+ }, 500);
+
+ };
+*/
+
+
+ // fetch
+ this.fetch();
+
+ },
+
+/*
+ show: function(){
+
+ console.log('show field: %o', this.o.xhr);
+
+ // bail ealry if already loaded
+ if( typeof this.o.xhr !== 'undefined' ) {
+
+ return;
+
+ }
+
+
+ // is field in view
+ if( acf.is_in_view(this.$field) ) {
+
+ // fetch
+ this.fetch();
+
+ }
+
+ },
+*/
+
+ maybe_fetch: function(){
+
+ // reference
+ var self = this,
+ $field = this.$field;
+
+
+ // abort timeout
+ if( this.o.timeout ) {
+
+ clearTimeout( this.o.timeout );
+
+ }
+
+
+ // fetch
+ var timeout = setTimeout(function(){
+
+ self.doFocus($field);
+ self.fetch();
+
+ }, 300);
+
+ this.$el.data('timeout', timeout);
+
+ },
+
+ fetch: function(){
+
+ // reference
+ var self = this,
+ $field = this.$field;
+
+
+ // add class
+ this.$el.addClass('is-loading');
+
+
+ // abort XHR if this field is already loading AJAX data
+ if( this.o.xhr ) {
+
+ this.o.xhr.abort();
+ this.o.xhr = false;
+
+ }
+
+
+ // add to this.o
+ this.o.action = 'acf/fields/relationship/query';
+ this.o.field_key = $field.data('key');
+ this.o.post_id = acf.get('post_id');
+
+
+ // ready for ajax
+ var ajax_data = acf.prepare_for_ajax( this.o );
+
+
+ // clear html if is new query
+ if( ajax_data.paged == 1 ) {
+
+ this.$choices.children('.list').html('')
+
+ }
+
+
+ // add message
+ this.$choices.find('ul:last').append(' ' + acf._e('relationship', 'loading') + '
');
+
+
+ // get results
+ var xhr = $.ajax({
+ url: acf.get('ajaxurl'),
+ dataType: 'json',
+ type: 'post',
+ data: ajax_data,
+ success: function( json ){
+
+ self.set('$field', $field).render( json );
+
+ }
+ });
+
+
+ // update el data
+ this.$el.data('xhr', xhr);
+
+ },
+
+ render: function( json ){
+
+ // remove loading class
+ this.$el.removeClass('is-loading is-empty');
+
+
+ // remove p tag
+ this.$choices.find('p').remove();
+
+
+ // no results?
+ if( !json || !json.results || !json.results.length ) {
+
+ // add class
+ this.$el.addClass('is-empty');
+
+
+ // add message
+ if( this.o.paged == 1 ) {
+
+ this.$choices.children('.list').append('' + acf._e('relationship', 'empty') + '
');
+
+ }
+
+
+ // return
+ return;
+
+ }
+
+
+ // get new results
+ var $new = $( this.walker(json.results) );
+
+
+ // apply .disabled to left li's
+ this.$values.find('.acf-rel-item').each(function(){
+
+ $new.find('.acf-rel-item[data-id="' + $(this).data('id') + '"]').addClass('disabled');
+
+ });
+
+
+ // underline search match
+ // consider removing due to bug where matched strings within HTML attributes caused incorrect results
+ // Looks like Select2 v4 has moved away from highlighting results, so perhaps we should too
+/*
+ if( this.o.s ) {
+
+ // vars
+ var s = this.o.s;
+
+
+ // allow special characters to be used within regex
+ s = acf.addslashes(s);
+
+
+ // loop
+ $new.find('.acf-rel-item').each(function(){
+
+ // vars
+ var find = $(this).text(),
+ replace = find.replace( new RegExp('(' + s + ')', 'gi'), '$1 ');
+
+ $(this).html( $(this).html().replace(find, replace) );
+
+ });
+
+ }
+*/
+
+
+ // append
+ this.$choices.children('.list').append( $new );
+
+
+ // merge together groups
+ var label = '',
+ $list = null;
+
+ this.$choices.find('.acf-rel-label').each(function(){
+
+ if( $(this).text() == label ) {
+
+ $list.append( $(this).siblings('ul').html() );
+
+ $(this).parent().remove();
+
+ return;
+ }
+
+
+ // update vars
+ label = $(this).text();
+ $list = $(this).siblings('ul');
+
+ });
+
+
+ },
+
+ walker: function( data ){
+
+ // vars
+ var s = '';
+
+
+ // loop through data
+ if( $.isArray(data) ) {
+
+ for( var k in data ) {
+
+ s += this.walker( data[ k ] );
+
+ }
+
+ } else if( $.isPlainObject(data) ) {
+
+ // optgroup
+ if( data.children !== undefined ) {
+
+ s += '' + data.text + ' ';
+
+ s += this.walker( data.children );
+
+ s += ' ';
+
+ } else {
+
+ s += '' + data.text + ' ';
+
+ }
+
+ }
+
+
+ // return
+ return s;
+
+ },
+
+ submit_filter: function( e ){
+
+ // don't submit form
+ if( e.which == 13 ) {
+
+ e.preventDefault();
+
+ }
+
+ },
+
+ change_filter: function( e ){
+
+ // vars
+ var val = e.$el.val(),
+ filter = e.$el.data('filter');
+
+
+ // Bail early if filter has not changed
+ if( this.$el.data(filter) == val ) {
+
+ return;
+
+ }
+
+
+ // update attr
+ this.$el.data(filter, val);
+
+
+ // reset paged
+ this.$el.data('paged', 1);
+
+
+ // fetch
+ if( e.$el.is('select') ) {
+
+ this.fetch();
+
+ // search must go through timeout
+ } else {
+
+ this.maybe_fetch();
+
+ }
+
+ },
+
+ add_item: function( e ){
+
+ // max posts
+ if( this.o.max > 0 ) {
+
+ if( this.$values.find('.acf-rel-item').length >= this.o.max ) {
+
+ alert( acf._e('relationship', 'max').replace('{max}', this.o.max) );
+
+ return;
+
+ }
+
+ }
+
+
+ // can be added?
+ if( e.$el.hasClass('disabled') ) {
+
+ return false;
+
+ }
+
+
+ // disable
+ e.$el.addClass('disabled');
+
+
+ // template
+ var html = [
+ '',
+ ' ',
+ '' + e.$el.html(),
+ ' ',
+ ' ',
+ ' '].join('');
+
+
+ // add new li
+ this.$values.children('.list').append( html )
+
+
+ // trigger change on new_li
+ this.$input.trigger('change');
+
+
+ // validation
+ acf.validation.remove_error( this.$field );
+
+ },
+
+ remove_item : function( e ){
+
+ // vars
+ var $span = e.$el.parent(),
+ id = $span.data('id');
+
+
+ // remove
+ $span.parent('li').remove();
+
+
+ // show
+ this.$choices.find('.acf-rel-item[data-id="' + id + '"]').removeClass('disabled');
+
+
+ // trigger change on new_li
+ this.$input.trigger('change');
+
+ }
+
+ });
+
+
+})(jQuery);
+
+(function($){
+
+ // globals
+ var _select2,
+ _select23,
+ _select24;
+
+
+ /*
+ * acf.select2
+ *
+ * all logic to create select2 instances
+ *
+ * @type function
+ * @date 16/12/2015
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ _select2 = acf.select2 = acf.model.extend({
+
+ // vars
+ version: 0,
+ version3: null,
+ version4: null,
+
+
+ // actions
+ actions: {
+ 'ready 1': 'ready'
+ },
+
+
+ /*
+ * ready
+ *
+ * This function will run on document ready
+ *
+ * @type function
+ * @date 21/06/2016
+ * @since 5.3.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ ready: function(){
+
+ // determine Select2 version
+ this.version = this.get_version();
+
+
+ // ready
+ this.do_function('ready');
+
+ },
+
+
+ /*
+ * get_version
+ *
+ * This function will return the Select2 version
+ *
+ * @type function
+ * @date 29/4/17
+ * @since 5.5.13
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ get_version: function(){
+
+ if( acf.maybe_get(window, 'Select2') ) return 3;
+ if( acf.maybe_get(window, 'jQuery.fn.select2.amd') ) return 4;
+ return 0;
+
+ },
+
+
+ /*
+ * do_function
+ *
+ * This function will call the v3 or v4 equivelant function
+ *
+ * @type function
+ * @date 28/4/17
+ * @since 5.5.13
+ *
+ * @param name (string)
+ * @param args (array)
+ * @return (mixed)
+ */
+
+ do_function: function( name, args ){
+
+ // defaults
+ args = args || [];
+
+
+ // vars
+ var model = 'version'+this.version;
+
+
+ // bail early if not set
+ if( typeof this[model] === 'undefined' ||
+ typeof this[model][name] === 'undefined' ) return false;
+
+
+ // run
+ return this[model][name].apply( this, args );
+
+ },
+
+
+ /*
+ * get_data
+ *
+ * This function will look at a $select element and return an object choices
+ *
+ * @type function
+ * @date 24/12/2015
+ * @since 5.3.2
+ *
+ * @param $select (jQuery)
+ * @return (array)
+ */
+
+ get_data: function( $select, data ){
+
+ // reference
+ var self = this;
+
+
+ // defaults
+ data = data || [];
+
+
+ // loop over children
+ $select.children().each(function(){
+
+ // vars
+ var $el = $(this);
+
+
+ // optgroup
+ if( $el.is('optgroup') ) {
+
+ data.push({
+ 'text': $el.attr('label'),
+ 'children': self.get_data( $el )
+ });
+
+ // option
+ } else {
+
+ data.push({
+ 'id': $el.attr('value'),
+ 'text': $el.text()
+ });
+
+ }
+
+ });
+
+
+ // return
+ return data;
+
+ },
+
+
+ /*
+ * decode_data
+ *
+ * This function will take an array of choices and decode the text
+ * Changes '&' to '&' which fixes a bug (in Select2 v3 )when searching for '&'
+ *
+ * @type function
+ * @date 24/12/2015
+ * @since 5.3.2
+ *
+ * @param $select (jQuery)
+ * @return (array)
+ */
+
+ decode_data: function( data ) {
+
+ // bail ealry if no data
+ if( !data ) return [];
+
+
+ //loop
+ $.each(data, function(k, v){
+
+ // text
+ data[ k ].text = acf.decode( v.text );
+
+
+ // children
+ if( typeof v.children !== 'undefined' ) {
+
+ data[ k ].children = _select2.decode_data(v.children);
+
+ }
+
+ });
+
+
+ // return
+ return data;
+
+ },
+
+
+ /*
+ * count_data
+ *
+ * This function will take an array of choices and return the count
+ *
+ * @type function
+ * @date 24/12/2015
+ * @since 5.3.2
+ *
+ * @param data (array)
+ * @return (int)
+ */
+
+ count_data: function( data ) {
+
+ // vars
+ var i = 0;
+
+
+ // bail ealry if no data
+ if( !data ) return i;
+
+
+ //loop
+ $.each(data, function(k, v){
+
+ // increase
+ i++;
+
+
+ // children
+ if( typeof v.children !== 'undefined' ) {
+
+ i += v.children.length;
+
+ }
+
+ });
+
+
+ // return
+ return i;
+
+ },
+
+
+ /*
+ * get_ajax_data
+ *
+ * This function will return an array of data to send via AJAX
+ *
+ * @type function
+ * @date 19/07/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ get_ajax_data: function( args, params, $el, $field ){
+
+ // vars
+ var data = acf.prepare_for_ajax({
+ action: args.ajax_action,
+ field_key: args.key,
+ s: params.term || '',
+ paged: params.page || 1
+ });
+
+
+ // filter
+ data = acf.apply_filters( 'select2_ajax_data', data, args, $el, $field );
+
+
+ // return
+ return data;
+
+ },
+
+
+ /*
+ * get_ajax_results
+ *
+ * This function will return a valid AJAX response
+ *
+ * @type function
+ * @date 19/07/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ get_ajax_results: function( data, params ){
+
+ // vars
+ var valid = {
+ results: []
+ };
+
+
+ // bail early if no data
+ if( !data ) {
+
+ data = valid;
+
+ }
+
+
+ // allow for an array of choices
+ if( typeof data.results == 'undefined' ) {
+
+ valid.results = data;
+
+ data = valid;
+
+ }
+
+
+ // decode
+ data.results = this.decode_data(data.results);
+
+
+ // filter
+ data = acf.apply_filters( 'select2_ajax_results', data, params );
+
+
+ // return
+ return data;
+
+ },
+
+
+ /*
+ * get_value
+ *
+ * This function will return the selected options in a Select2 format
+ *
+ * @type function
+ * @date 5/01/2016
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ get_value: function( $select ){
+
+ // vars
+ var val = [],
+ $selected = $select.find('option:selected');
+
+
+ // bail early if no selected
+ if( !$selected.exists() ) return val;
+
+
+ // sort
+ $selected = $selected.sort(function(a, b) {
+
+ return +a.getAttribute('data-i') - +b.getAttribute('data-i');
+
+ });
+
+
+ // loop
+ $selected.each(function(){
+
+ // vars
+ var $el = $(this);
+
+
+ // append
+ val.push({
+ 'id': $el.attr('value'),
+ 'text': $el.text(),
+ '$el': $el
+ });
+
+ });
+
+
+ // return
+ return val;
+
+ },
+
+
+ /*
+ * get_input_value
+ *
+ * This function will return an array of values as per the hidden input
+ *
+ * @type function
+ * @date 29/4/17
+ * @since 5.5.13
+ *
+ * @param $input (jQuery)
+ * @return (array)
+ */
+
+ get_input_value: function( $input ) {
+
+ return $input.val().split('||');
+
+ },
+
+
+ /*
+ * sync_input_value
+ *
+ * This function will save the current selected values into the hidden input
+ *
+ * @type function
+ * @date 29/4/17
+ * @since 5.5.13
+ *
+ * @param $input (jQuery)
+ * @param $select (jQuery)
+ * @return n/a
+ */
+
+ sync_input_value: function( $input, $select ) {
+
+ $input.val( $select.val().join('||') );
+
+ },
+
+
+ /*
+ * add_option
+ *
+ * This function will add an element to a select (if it doesn't already exist)
+ *
+ * @type function
+ * @date 29/4/17
+ * @since 5.5.13
+ *
+ * @param $select (jQuery)
+ * @param value (string)
+ * @param label (string)
+ * @return n/a
+ */
+
+ add_option: function( $select, value, label ){
+
+ if( !$select.find('option[value="'+value+'"]').length ) {
+
+ $select.append(' '+label+' ');
+
+ }
+
+ },
+
+
+ /*
+ * select_option
+ *
+ * This function will select an option
+ *
+ * @type function
+ * @date 29/4/17
+ * @since 5.5.13
+ *
+ * @param $select (jQuery)
+ * @param value (string)
+ * @return n/a
+ */
+
+ select_option: function( $select, value ){
+
+ $select.find('option[value="'+value+'"]').prop('selected', true);
+ $select.trigger('change');
+
+ },
+
+
+ /*
+ * unselect_option
+ *
+ * This function will unselect an option
+ *
+ * @type function
+ * @date 29/4/17
+ * @since 5.5.13
+ *
+ * @param $select (jQuery)
+ * @param value (string)
+ * @return n/a
+ */
+
+ unselect_option: function( $select, value ){
+
+ $select.find('option[value="'+value+'"]').prop('selected', false);
+ $select.trigger('change');
+
+ },
+
+
+ /*
+ * Select2 v3 or v4 functions
+ *
+ * description
+ *
+ * @type function
+ * @date 29/4/17
+ * @since 5.5.10
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ init: function( $select, args, $field ){
+
+ this.do_function( 'init', arguments );
+
+ },
+
+ destroy: function( $select ){
+
+ this.do_function( 'destroy', arguments );
+
+ },
+
+ add_value: function( $select, value, label ){
+
+ this.do_function( 'add_value', arguments );
+
+ },
+
+ remove_value: function( $select, value ){
+
+ this.do_function( 'remove_value', arguments );
+
+ }
+
+ });
+
+
+ /*
+ * Select2 v3
+ *
+ * This model contains the Select2 v3 functions
+ *
+ * @type function
+ * @date 28/4/17
+ * @since 5.5.10
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ _select23 = _select2.version3 = {
+
+ ready: function(){
+
+ // vars
+ var locale = acf.get('locale'),
+ rtl = acf.get('rtl')
+ l10n = acf._e('select');
+
+
+ // bail ealry if no l10n
+ if( !l10n ) return;
+
+
+ // vars
+ var l10n_functions = {
+ formatMatches: function( matches ) {
+
+ if ( 1 === matches ) {
+ return l10n.matches_1;
+ }
+
+ return l10n.matches_n.replace('%d', matches);
+ },
+ formatNoMatches: function() {
+ return l10n.matches_0;
+ },
+ formatAjaxError: function() {
+ return l10n.load_fail;
+ },
+ formatInputTooShort: function( input, min ) {
+ var number = min - input.length;
+
+ if ( 1 === number ) {
+ return l10n.input_too_short_1;
+ }
+
+ return l10n.input_too_short_n.replace( '%d', number );
+ },
+ formatInputTooLong: function( input, max ) {
+ var number = input.length - max;
+
+ if ( 1 === number ) {
+ return l10n.input_too_long_1;
+ }
+
+ return l10n.input_too_long_n.replace( '%d', number );
+ },
+ formatSelectionTooBig: function( limit ) {
+ if ( 1 === limit ) {
+ return l10n.selection_too_long_1;
+ }
+
+ return l10n.selection_too_long_n.replace( '%d', limit );
+ },
+ formatLoadMore: function() {
+ return l10n.load_more;
+ },
+ formatSearching: function() {
+ return l10n.searching;
+ }
+ };
+
+
+ // ensure locales exists
+ // older versions of Select2 did not have a locale storage
+ $.fn.select2.locales = acf.maybe_get(window, 'jQuery.fn.select2.locales', {});
+
+
+ // append
+ $.fn.select2.locales[ locale ] = l10n_functions;
+ $.extend($.fn.select2.defaults, l10n_functions);
+
+ },
+
+ set_data: function( $select, data ){
+
+ // v3
+ if( this.version == 3 ) {
+
+ $select = $select.siblings('input');
+
+ }
+
+
+ // set data
+ $select.select2('data', data);
+
+ },
+
+ append_data: function( $select, data ){
+
+ // v3
+ if( this.version == 3 ) {
+
+ $select = $select.siblings('input');
+
+ }
+
+
+
+ // vars
+ var current = $select.select2('data') || [];
+
+
+ // append
+ current.push( data );
+
+
+ // set data
+ $select.select2('data', current);
+
+ },
+
+
+ /*
+ * init_v3
+ *
+ * This function will create a new Select2 for v3
+ *
+ * @type function
+ * @date 24/12/2015
+ * @since 5.3.2
+ *
+ * @param $select (jQuery)
+ * @return args (object)
+ */
+
+ init: function( $select, args, $field ){
+
+ // defaults
+ args = args || {};
+ $field = $field || null;
+
+
+ // merge
+ args = $.extend({
+ allow_null: false,
+ placeholder: '',
+ multiple: false,
+ ajax: false,
+ ajax_action: ''
+ }, args);
+
+
+ // vars
+ var $input = $select.siblings('input');
+
+
+ // bail early if no input
+ if( !$input.exists() ) return;
+
+
+ // select2 args
+ var select2_args = {
+ width: '100%',
+ containerCssClass: '-acf',
+ allowClear: args.allow_null,
+ placeholder: args.placeholder,
+ multiple: args.multiple,
+ separator: '||',
+ data: [],
+ escapeMarkup: function( m ){ return m; },
+ formatResult: function( result, container, query, escapeMarkup ){
+
+ // run default formatResult
+ var text = $.fn.select2.defaults.formatResult( result, container, query, escapeMarkup );
+
+
+ // append description
+ if( result.description ) {
+
+ text += ' ' + result.description + ' ';
+
+ }
+
+
+ // return
+ return text;
+
+ }
+ };
+
+
+ // value
+ var value = this.get_value( $select );
+
+
+ // multiple
+ if( args.multiple ) {
+
+ // vars
+ var name = $select.attr('name');
+
+
+ // add hidden input to each multiple selection
+ select2_args.formatSelection = function( object, $div ){
+
+ // vars
+ var html = ' ';
+
+
+ // append input
+ $div.parent().append(html);
+
+
+ // return
+ return object.text;
+
+ }
+
+ } else {
+
+ // change array to single object
+ value = acf.maybe_get(value, 0, false);
+
+
+ // if no allow_null, this single select must contain a selection
+ if( !args.allow_null && value ) {
+
+ $input.val( value.id );
+
+ }
+ }
+
+
+ // remove the blank option as we have a clear all button!
+ if( args.allow_null ) {
+
+ $select.find('option[value=""]').remove();
+
+ }
+
+
+ // get data
+ select2_args.data = this.get_data( $select );
+
+
+ // initial selection
+ select2_args.initSelection = function( element, callback ) {
+
+ callback( value );
+
+ };
+
+
+ // ajax
+ if( args.ajax ) {
+
+ select2_args.ajax = {
+ url: acf.get('ajaxurl'),
+ dataType: 'json',
+ type: 'post',
+ cache: false,
+ quietMillis: 250,
+ data: function( term, page ) {
+
+ // vars
+ var params = { 'term': term, 'page': page };
+
+
+ // return
+ return _select2.get_ajax_data(args, params, $input, $field);
+
+ },
+ results: function( data, page ){
+
+ // vars
+ var params = { 'page': page };
+
+
+ // merge together groups
+ setTimeout(function(){
+
+ _select23.merge_results();
+
+ }, 1);
+
+
+ // return
+ return _select2.get_ajax_results(data, params);
+
+ }
+ };
+
+ }
+
+
+ // attachment z-index fix
+ select2_args.dropdownCss = {
+ 'z-index' : '999999999'
+ };
+
+
+ // append args
+ select2_args.acf = args;
+
+
+ // filter for 3rd party customization
+ select2_args = acf.apply_filters( 'select2_args', select2_args, $select, args, $field );
+
+
+ // add select2
+ $input.select2( select2_args );
+
+
+ // vars
+ var $container = $input.select2('container');
+
+
+ // reorder DOM
+ // - this order is very important so don't change it
+ // - $select goes first so the input can override it. Fixes issue where conditional logic will enable the select
+ // - $input goes second to reset the input data
+ // - container goes last to allow multiple hidden inputs to override $input
+ $container.before( $select );
+ $container.before( $input );
+
+
+ // multiple
+ if( args.multiple ) {
+
+ // sortable
+ $container.find('ul.select2-choices').sortable({
+ start: function() {
+ $input.select2("onSortStart");
+ },
+ stop: function() {
+ $input.select2("onSortEnd");
+ }
+ });
+
+ }
+
+
+ // disbale select
+ $select.prop('disabled', true).addClass('acf-disabled acf-hidden');
+
+
+ // update select value
+ // this fixes a bug where select2 appears blank after duplicating a post_object field (field settings).
+ // the $select is disabled, so setting the value won't cause any issues (this is what select2 v4 does anyway).
+ $input.on('change', function(e) {
+
+ // add new data
+ if( e.added ) {
+
+ // add item
+ _select2.add_option($select, e.added.id, e.added.text);
+
+ }
+
+
+ // select
+ _select2.select_option($select, e.val);
+
+ });
+
+
+ // action for 3rd party customization
+ acf.do_action('select2_init', $input, select2_args, args, $field);
+
+ },
+
+
+ /*
+ * merge_results_v3
+ *
+ * description
+ *
+ * @type function
+ * @date 20/07/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ merge_results: function(){
+
+ // vars
+ var label = '',
+ $list = null;
+
+
+ // loop
+ $('#select2-drop .select2-result-with-children').each(function(){
+
+ // vars
+ var $label = $(this).children('.select2-result-label'),
+ $ul = $(this).children('.select2-result-sub');
+
+
+ // append group to previous
+ if( $label.text() == label ) {
+
+ $list.append( $ul.children() );
+
+ $(this).remove();
+
+ return;
+
+ }
+
+
+ // update vars
+ label = $label.text();
+ $list = $ul;
+
+ });
+
+ },
+
+
+ /*
+ * destroy
+ *
+ * This function will destroy a Select2
+ *
+ * @type function
+ * @date 24/12/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ destroy: function( $select ){
+
+ // vars
+ var $input = $select.siblings('input');
+
+
+ // destroy via api
+ if( $input.data('select2') ) {
+ $input.select2('destroy');
+ }
+
+
+ // destory via HTML (duplicating HTML deos not contain data)
+ $select.siblings('.select2-container').remove();
+
+
+ // enable select
+ $select.prop('disabled', false).removeClass('acf-disabled acf-hidden');
+ $input.attr('style', ''); // fixes bug causing hidden select2 element
+
+ },
+
+ add_value: function( $select, value, label ){
+
+ // add and select item
+ _select2.add_option($select, value, label);
+ _select2.select_option($select, value);
+
+
+ // vars
+ var $input = $select.siblings('input');
+
+
+ // new item
+ var item = {
+ 'id': value,
+ 'text': label
+ };
+
+
+ // single
+ if( !$select.data('multiple') ) {
+
+ return $input.select2('data', item);
+
+ }
+
+
+ // get existing value
+ var values = $input.select2('data') || [];
+
+
+ // append
+ values.push(item);
+
+
+ // set data
+ return $input.select2('data', values);
+
+ },
+
+ remove_value: function( $select, value ){
+
+ // unselect option
+ _select2.unselect_option($select, value);
+
+
+ // vars
+ var $input = $select.siblings('input'),
+ current = $input.select2('data');
+
+
+ // single
+ if( !$select.data('multiple') ) {
+
+ if( current && current.id == value ) {
+
+ $input.select2('data', null);
+
+ }
+
+ // multiple
+ } else {
+
+ // filter
+ current = $.grep(current, function( item ) {
+ return item.id != value;
+ });
+
+
+ // set data
+ $input.select2('data', current);
+
+ }
+
+ }
+
+
+ };
+
+
+ /*
+ * Select2 v4
+ *
+ * This model contains the Select2 v4 functions
+ *
+ * @type function
+ * @date 28/4/17
+ * @since 5.5.10
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ _select24 = _select2.version4 = {
+
+ init: function( $select, args, $field ){
+
+ // defaults
+ args = args || {};
+ $field = $field || null;
+
+
+ // merge
+ args = $.extend({
+ allow_null: false,
+ placeholder: '',
+ multiple: false,
+ ajax: false,
+ ajax_action: ''
+ }, args);
+
+
+ // vars
+ var $input = $select.siblings('input');
+
+
+ // bail early if no input
+ if( !$input.exists() ) return;
+
+
+ // select2 args
+ var select2_args = {
+ width: '100%',
+ allowClear: args.allow_null,
+ placeholder: args.placeholder,
+ multiple: args.multiple,
+ separator: '||',
+ data: [],
+ escapeMarkup: function( m ){ return m; }
+ };
+
+
+ // value
+ var value = this.get_value( $select );
+
+
+ // multiple
+ if( args.multiple ) {
+
+ // reorder opts
+ $.each(value, function( k, item ){
+
+ // detach and re-append to end
+ item.$el.detach().appendTo( $select );
+
+ });
+
+ } else {
+
+ // change array to single object
+ value = acf.maybe_get(value, 0, '');
+
+ }
+
+
+/*
+ // removed - Select2 does not show this value by default!
+ // remove the blank option as we have a clear all button!
+ if( args.allow_null ) {
+
+ $select.find('option[value=""]').remove();
+
+ }
+*/
+
+
+ // remove conflicting atts
+ if( !args.ajax ) {
+
+ $select.removeData('ajax');
+ $select.removeAttr('data-ajax');
+
+ } else {
+
+ select2_args.ajax = {
+ url: acf.get('ajaxurl'),
+ delay: 250,
+ dataType: 'json',
+ type: 'post',
+ cache: false,
+ data: function( params ) {
+
+ // return
+ return _select2.get_ajax_data(args, params, $select, $field);
+
+ },
+ processResults: function( data, params ){
+
+ // vars
+ var results = _select2.get_ajax_results(data, params);
+
+
+ // change to more
+ if( results.more ) {
+
+ results.pagination = { more: true };
+
+ }
+
+
+ // merge together groups
+ setTimeout(function(){
+
+ _select24.merge_results();
+
+ }, 1);
+
+
+ // return
+ return results
+
+ }
+
+ };
+
+ }
+
+
+ // filter for 3rd party customization
+ select2_args = acf.apply_filters( 'select2_args', select2_args, $select, args, $field );
+
+
+ // add select2
+ $select.select2( select2_args );
+
+
+ // get container (Select2 v4 deos not return this from constructor)
+ var $container = $select.next('.select2-container');
+
+
+ // reorder DOM
+ // - no need to reorder, the select field is needed to $_POST values
+
+
+ // multiple
+ if( args.multiple ) {
+
+ // vars
+ var $ul = $container.find('ul');
+
+
+ // sortable
+ $ul.sortable({
+
+ stop: function( e ) {
+
+ $ul.find('.select2-selection__choice').each(function() {
+
+ // vars
+ var $option = $( $(this).data('data').element );
+
+
+ // detach and re-append to end
+ $option.detach().appendTo( $select );
+
+
+ // trigger change on input (JS error if trigger on select)
+ $input.trigger('change');
+ // update input
+ //_select2.sync_input_value( $input, $select );
+
+ });
+
+ }
+
+ });
+
+
+ // on select, move to end
+ $select.on('select2:select', function( e ){
+
+ // vars
+ var $option = $(e.params.data.element);
+
+
+ // detach and re-append to end
+ $option.detach().appendTo( $select );
+
+
+ // trigger change
+ //$select.trigger('change');
+
+ });
+
+ }
+
+
+/*
+ // update input
+ $select.on('select2:select', function( e ){
+
+ // update input
+ _select2.sync_input_value( $input, $select );
+
+ });
+
+ $select.on('select2:unselect', function( e ){
+
+ // update input
+ _select2.sync_input_value( $input, $select );
+
+ });
+*/
+
+
+ // clear value (allows null to be saved)
+ $input.val('');
+
+
+ // add class
+ $container.addClass('-acf');
+
+
+ // action for 3rd party customization
+ acf.do_action('select2_init', $select, select2_args, args, $field);
+
+ },
+
+
+ /*
+ * merge_results_v4
+ *
+ * description
+ *
+ * @type function
+ * @date 20/07/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ merge_results: function(){
+
+ // vars
+ var $prev_options = null,
+ $prev_group = null;
+
+
+ // loop
+ $('.select2-results__option[role="group"]').each(function(){
+
+ // vars
+ var $options = $(this).children('ul'),
+ $group = $(this).children('strong');
+
+
+ // compare to previous
+ if( $prev_group !== null && $group.text() == $prev_group.text() ) {
+
+ $prev_options.append( $options.children() );
+
+ $(this).remove();
+
+ return;
+
+ }
+
+
+ // update vars
+ $prev_options = $options;
+ $prev_group = $group;
+
+ });
+
+ },
+
+ add_value: function( $select, value, label ){
+
+ // add and select item
+ _select2.add_option($select, value, label);
+ _select2.select_option($select, value);
+
+ },
+
+ remove_value: function( $select, value ){
+
+ // unselect
+ _select2.unselect_option($select, value);
+
+ },
+
+ destroy: function( $select ){
+
+ // destroy via api
+ if( $select.data('select2') ) {
+ $select.select2('destroy');
+ }
+
+
+ // destory via HTML (duplicating HTML deos not contain data)
+ $select.siblings('.select2-container').remove();
+
+ }
+
+ };
+
+
+ /*
+ * depreciated
+ *
+ * These functions have moved since v5.3.3
+ *
+ * @type function
+ * @date 11/12/2015
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ acf.add_select2 = function( $select, args ) {
+
+ _select2.init( $select, args );
+
+ }
+
+ acf.remove_select2 = function( $select ) {
+
+ _select2.destroy( $select );
+
+ }
+
+})(jQuery);
+
+(function($){
+
+ // select
+ acf.fields.select = acf.field.extend({
+
+ type: 'select',
+
+ $select: null,
+
+ actions: {
+ 'ready': 'render',
+ 'append': 'render',
+ 'remove': 'remove'
+ },
+
+ focus: function(){
+
+ // focus on $select
+ this.$select = this.$field.find('select');
+
+
+ // bail early if no select field
+ if( !this.$select.exists() ) return;
+
+
+ // get options
+ this.o = acf.get_data( this.$select );
+
+
+ // customize o
+ this.o = acf.parse_args(this.o, {
+ 'ajax_action': 'acf/fields/'+this.type+'/query',
+ 'key': this.$field.data('key')
+ });
+
+ },
+
+ render: function(){
+
+ // validate ui
+ if( !this.$select.exists() || !this.o.ui ) {
+
+ return false;
+
+ }
+
+
+ acf.select2.init( this.$select, this.o, this.$field );
+
+ },
+
+ remove: function(){
+
+ // validate ui
+ if( !this.$select.exists() || !this.o.ui ) {
+
+ return false;
+
+ }
+
+
+ // remove select2
+ acf.select2.destroy( this.$select );
+
+ }
+
+ });
+
+
+ // user
+ acf.fields.user = acf.fields.select.extend({
+
+ type: 'user'
+
+ });
+
+
+ // post_object
+ acf.fields.post_object = acf.fields.select.extend({
+
+ type: 'post_object'
+
+ });
+
+
+ // page_link
+ acf.fields.page_link = acf.fields.select.extend({
+
+ type: 'page_link'
+
+ });
+
+
+})(jQuery);
+
+(function($, undefined){
+
+ var i = 0;
+
+ acf.fields.accordion = acf.field.extend({
+
+ type: 'accordion',
+ $el: null,
+ $wrap: null,
+
+ actions: {
+ 'prepare': 'initialize',
+ 'append': 'initialize',
+ },
+
+ focus: function(){
+
+
+ },
+
+ initialize: function(){
+
+ // vars
+ var $field = this.$field;
+ var $label = $field.children('.acf-label');
+ var $input = $field.children('.acf-input');
+ var $wrap = $input.children('.acf-fields');
+ var settings = $wrap.data();
+
+
+ // bail early if is cell
+ if( $field.is('td') ) return;
+
+
+ // enpoint
+ if( settings.endpoint ) {
+ $field.remove();
+ return;
+ }
+
+
+ // force description into label
+ var $instructions = $input.children('.description')
+ if( $instructions.length ) {
+ $label.append( $instructions );
+ }
+
+
+ // table
+ if( $field.is('tr') ) {
+
+ // vars
+ var $table = $field.closest('table');
+ var $newLabel = $('
');
+ var $newInput = $('
');
+ var $newTable = $('');
+ var $newWrap = $(' ');
+
+ // dom
+ $newLabel.append( $label.html() );
+ $newTable.append( $newWrap );
+ $newInput.append( $newTable );
+ $input.append( $newLabel );
+ $input.append( $newInput );
+
+ // modify
+ $label.remove();
+ $wrap.remove();
+ $input.attr('colspan', 2);
+
+ // update vars
+ $label = $newLabel;
+ $input = $newInput;
+ $wrap = $newWrap;
+
+ }
+
+
+ // add classes
+ $field.addClass('acf-accordion');
+ $label.addClass('acf-accordion-title');
+ $input.addClass('acf-accordion-content');
+
+
+ // index
+ i++;
+
+
+ // multi-expand
+ if( settings.multi_expand ) {
+ $field.data('multi-expand', 1);
+ }
+
+
+ // open
+ var order = acf.getPreference('this.accordions') || [];
+ if( order[i-1] !== undefined ) {
+ settings.open = order[i-1];
+ }
+ if( settings.open ) {
+ $field.addClass('-open');
+ $input.css('display', 'block'); // needed for accordion to close smoothly
+ }
+
+
+ // add icon
+ $label.prepend(' ');
+
+
+ // classes
+ // - remove 'inside' which is a #poststuff WP class
+ var $parent = $field.parent();
+ $wrap.addClass( $parent.hasClass('-left') ? '-left' : '' );
+ $wrap.addClass( $parent.hasClass('-clear') ? '-clear' : '' );
+
+
+ // append
+ $wrap.append( $field.nextUntil('.acf-field-accordion', '.acf-field') );
+
+
+ // clean up
+ $wrap.removeAttr('data-open data-multi_expand data-endpoint');
+ }
+
+ });
+
+
+ /*
+ * accordionManager
+ *
+ * This model will handle adding accordions
+ *
+ * @type function
+ * @date 25/11/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ var accordionManager = acf.model.extend({
+
+ events: {
+ 'click .acf-accordion-title': '_click',
+ },
+
+ _click: function( e ){
+
+ // prevent Defailt
+ e.preventDefault();
+
+ // open close
+ this.toggle( e.$el.closest('.acf-accordion') );
+
+ },
+
+ isOpen: function( $el ) {
+ return $el.hasClass('-open');
+ },
+
+ toggle: function( $el ){
+
+ // is open
+ if( this.isOpen($el) ) {
+ this.close( $el );
+ } else {
+ this.open( $el );
+ }
+
+ },
+
+ open: function( $el ){
+
+ // open
+ $el.find('.acf-accordion-content:first').slideDown().css('display', 'block');
+ $el.find('.acf-accordion-icon:first').removeClass('dashicons-arrow-right').addClass('dashicons-arrow-down');
+ $el.addClass('-open');
+
+ // action
+ acf.do_action('show', $el);
+
+ // close siblings
+ if( !$el.data('multi-expand') ) {
+ $el.siblings('.acf-accordion.-open').each(function(){
+ accordionManager.close( $(this) );
+ });
+ }
+
+ // action
+ acf.do_action('refresh', $el);
+ },
+
+ close: function( $el ){
+
+ // close
+ $el.find('.acf-accordion-content:first').slideUp();
+ $el.find('.acf-accordion-icon:first').removeClass('dashicons-arrow-down').addClass('dashicons-arrow-right');
+ $el.removeClass('-open');
+
+ // action
+ acf.do_action('hide', $el);
+
+ }
+
+ });
+
+ $(window).on('unload', function(){
+
+ var order = [];
+ $('.acf-accordion').each(function(){
+ var open = $(this).hasClass('-open') ? 1 : 0;
+ order.push(open);
+ });
+ if( !order.length ) return;
+ acf.setPreference('this.accordions', order);
+
+ });
+
+
+ /**
+ * accordionValidation
+ *
+ * This model will handle validation of fields within an accordion
+ *
+ * @date 20/11/17
+ * @since 5.6.5
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ var accordionValidation = acf.model.extend({
+
+ active: 1,
+
+ events: {
+ 'invalidField .acf-accordion': 'invalidField'
+ },
+
+ invalidField: function( e ){
+
+ // bail early if already focused
+ if( !this.active ) return;
+
+ // block
+ this.block();
+
+ // open
+ accordionManager.open( e.$el );
+
+ },
+
+ block: function(){
+
+ // reference
+ var self = this;
+
+ // disable functionality for 1sec (allow next validation to work)
+ this.active = 0;
+
+ // timeout
+ setTimeout(function(){
+ self.active = 1;
+ }, 1000);
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ // vars
+ var hidden = 'hidden-by-conditional-logic';
+ var groupIndex = 0;
+ var tabIndex = 0;
+
+
+ /*
+ * tabs
+ *
+ * This model will handle adding tabs and groups
+ *
+ * @type function
+ * @date 25/11/2015
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ var tabs = acf.model.extend({
+
+ $fields: [],
+
+ actions: {
+ 'prepare 15': 'initialize',
+ 'append 15': 'initialize',
+ 'refresh 15': 'refresh'
+ },
+
+ events: {
+ 'click .acf-tab-button': '_click'
+ },
+
+ _click: function( e ){
+
+ // prevent Defailt
+ e.preventDefault();
+
+ // toggle
+ this.toggle( e.$el );
+
+ },
+
+ isOpen: function( $el ) {
+ return $el.hasClass('-open');
+ },
+
+ toggle: function( $a ){
+
+ // vars
+ var key = $a.data('key');
+ var $li = $a.parent();
+ var $wrap = $a.closest('.acf-tab-wrap');
+ var $active = $wrap.find('.active a');
+ var $field = $wrap.siblings('.acf-field[data-key="' + key + '"]');
+
+
+ // bail early if already open
+ if( this.isOpen($field) ) return;
+
+
+ // close
+ if( $active.length ) {
+
+ // vars
+ var activeKey = $active.data('key');
+ var $activeli = $active.parent();
+ var $activeField = $wrap.siblings('.acf-field[data-key="' + activeKey + '"]');
+
+ // hide
+ $activeli.removeClass('active');
+ this.close( $activeField );
+
+ }
+
+
+ // open
+ $li.addClass('active');
+ this.open( $field );
+
+
+ // action
+ // - allows acf.layout to fix floating field's min-height
+ acf.do_action('refresh', $wrap.parent() );
+
+ },
+
+ getFields: function( $field ){
+ return $field.nextUntil('.acf-field-tab', '.acf-field');
+ },
+
+ getWrap: function( $field ){
+ return $field.prevAll('.acf-tab-wrap:first');
+ },
+
+ getTab: function( $wrap, key ){
+ return $wrap.find('a[data-key="' + key + '"]');
+ },
+
+ open: function( $field ){
+
+ // show
+ this.getFields( $field ).each(function(){
+
+ $(this).removeClass('hidden-by-tab');
+ acf.do_action('show_field', $(this), 'tab');
+
+ });
+
+ },
+
+ close: function( $field ){
+
+ // show
+ this.getFields( $field ).each(function(){
+
+ $(this).addClass('hidden-by-tab');
+ acf.do_action('hide_field', $(this), 'tab');
+
+ });
+
+ },
+
+ addTab: function( $field ){
+ this.$fields.push( $field );
+ },
+
+ initialize: function(){
+
+ // bail ealry if no fields
+ if( !this.$fields.length ) return;
+
+ // loop
+ for( var i = 0; i < this.$fields.length; i++) {
+ this.createTab( this.$fields[ i ] );
+ }
+
+ // reset
+ this.$fields = [];
+
+ },
+
+ createTab: function( $field ){
+
+ // bail early if is cell
+ if( $field.is('td') ) return false;
+
+
+ // vars
+ var $label = $field.children('.acf-label');
+ var $input = $field.children('.acf-input');
+ var $wrap = this.getWrap( $field );
+ var $button = $field.find('.acf-tab-button');
+ var settings = $button.data();
+ var open = false;
+
+
+ // remove
+ $field.hide();
+ $label.remove();
+ $input.remove();
+
+
+ // create wrap
+ if( !$wrap.exists() || settings.endpoint ) {
+ $wrap = this.createTabWrap( $field, settings );
+ open = true;
+ }
+
+
+ // create tab
+ var $tab = $(' ').append( $button );
+
+
+ // open
+ if( open ) {
+ $tab.addClass('active');
+ this.open( $field );
+ } else {
+ this.close( $field );
+ }
+
+
+ // hide li
+ if( $button.html() == '' ) $tab.hide();
+
+
+ // append
+ $wrap.find('ul').append( $tab );
+
+
+ // toggle active tab
+ // previous attempts to integrate with above 'open' variable were uncessefull
+ // this separate toggle logic ensures the tab exists
+ tabIndex++;
+ var order = acf.getPreference('this.tabs') || [];
+ var index = order[ groupIndex-1 ] || 0;
+ if( index == tabIndex-1 && !open ) {
+ this.toggle( $button );
+ }
+
+
+ // return
+ return $tab;
+ },
+
+ createTabWrap: function( $field, settings ){
+
+ // vars
+ var $parent = $field.parent();
+ var $wrap = false;
+
+
+ // add sidebar for left placement
+ if( $parent.hasClass('acf-fields') && settings.placement == 'left' ) {
+ $parent.addClass('-sidebar');
+ }
+
+
+ // create wrap
+ if( $field.is('tr') ) {
+ $wrap = $(' ');
+ } else {
+ $wrap = $('');
+ }
+
+
+ // append
+ $field.before( $wrap );
+
+
+ // index
+ groupIndex++;
+ tabIndex = 0;
+
+
+ // return
+ return $wrap;
+
+ },
+
+ refresh: function( $el ){
+
+ // loop
+ $('.acf-tab-wrap', $el).each(function(){
+
+ // vars
+ var $wrap = $(this);
+
+
+ // fix left aligned min-height
+ if( $wrap.hasClass('-left') ) {
+
+ // vars
+ var $parent = $wrap.parent();
+ var attribute = $parent.is('td') ? 'height' : 'min-height';
+
+ // find height (minus 1 for border-bottom)
+ var height = $wrap.position().top + $wrap.children('ul').outerHeight(true) - 1;
+
+ // add css
+ $parent.css(attribute, height);
+
+ }
+
+ });
+
+ }
+
+ });
+
+
+
+ /**
+ * acf.fields.tab
+ *
+ * description
+ *
+ * @date 17/11/17
+ * @since 5.6.5
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ acf.fields.tab = acf.field.extend({
+
+ type: 'tab',
+ $el: null,
+ $wrap: null,
+
+ actions: {
+ 'prepare': 'initialize',
+ 'append': 'initialize',
+ 'hide': 'hide',
+ 'show': 'show'
+ },
+
+ focus: function(){
+
+ },
+
+ initialize: function(){
+
+ // add tab
+ tabs.addTab( this.$field );
+
+ },
+
+ hide: function( $field, context ){
+
+ // bail early if not conditional logic
+ if( context != 'conditional_logic' ) return;
+
+
+ // vars
+ var key = $field.data('key');
+ var $wrap = tabs.getWrap( $field );
+ var $tab = tabs.getTab( $wrap, key );
+ var $li = $tab.parent();
+
+ // bail early if $group does not exist (clone field)
+ if( !$wrap.exists() ) return;
+
+
+ // hide li
+ $li.addClass(hidden);
+
+
+ // hide fields
+ tabs.getFields( $field ).each(function(){
+ acf.conditional_logic.hide_field( $(this) );
+ });
+
+
+ // select other tab if active
+ if( $li.hasClass('active') ) {
+ $wrap.find('li:not(.'+hidden+'):first a').trigger('click');
+ }
+
+ },
+
+ show: function( $field, context ){
+
+ // bail early if not conditional logic
+ if( context != 'conditional_logic' ) return;
+
+
+ // vars
+ var key = $field.data('key');
+ var $wrap = tabs.getWrap( $field );
+ var $tab = tabs.getTab( $wrap, key );
+ var $li = $tab.parent();
+
+
+ // bail early if $group does not exist (clone field)
+ if( !$wrap.exists() ) return;
+
+
+ // show li
+ $li.removeClass(hidden);
+
+
+ // hide fields
+ tabs.getFields( $field ).each(function(){
+ acf.conditional_logic.show_field( $(this) );
+ });
+
+
+ // select tab if no other active
+ var $active = $li.siblings('.active');
+ if( !$active.exists() || $active.hasClass(hidden) ) {
+ tabs.toggle( $tab );
+ }
+
+ }
+
+ });
+
+
+ $(window).on('unload', function(){
+
+ var order = [];
+ $('.acf-tab-wrap').each(function(){
+ var active = $(this).find('.active').index() || 0;
+ order.push(active);
+ });
+ if( !order.length ) return;
+ acf.setPreference('this.tabs', order);
+
+ });
+
+
+ /*
+ * tab_validation
+ *
+ * This model will handle validation of fields within a tab group
+ *
+ * @type function
+ * @date 25/11/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ var tab_validation = acf.model.extend({
+
+ active: 1,
+
+ actions: {
+ 'invalid_field': 'invalid_field',
+ },
+
+ invalid_field: function( $field ){
+
+ // bail early if already focused
+ if( !this.active ) {
+ return;
+ }
+
+
+ // bail early if not hidden by tab
+ if( !$field.hasClass('hidden-by-tab') ) {
+ return;
+ }
+
+
+ // reference
+ var self = this;
+
+
+ // vars
+ var $tab = $field.prevAll('.acf-field-tab:first'),
+ $group = $field.prevAll('.acf-tab-wrap:first');
+
+
+ // focus
+ $group.find('a[data-key="' + $tab.data('key') + '"]').trigger('click');
+
+
+ // disable functionality for 1sec (allow next validation to work)
+ this.active = 0;
+
+ setTimeout(function(){
+
+ self.active = 1;
+
+ }, 1000);
+
+ }
+
+ });
+
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.time_picker = acf.field.extend({
+
+ type: 'time_picker',
+ $el: null,
+ $input: null,
+ $hidden: null,
+
+ o: {},
+
+ actions: {
+ 'ready': 'initialize',
+ 'append': 'initialize'
+ },
+
+ events: {
+ 'blur input[type="text"]': 'blur'
+ },
+
+ focus: function(){
+
+ // get elements
+ this.$el = this.$field.find('.acf-time-picker');
+ this.$input = this.$el.find('input[type="text"]');
+ this.$hidden = this.$el.find('input[type="hidden"]');
+
+
+ // get options
+ this.o = acf.get_data( this.$el );
+
+ },
+
+ initialize: function(){
+
+ // bail ealry if no timepicker library
+ if( typeof $.timepicker === 'undefined' ) return;
+
+
+ // create options
+ var args = {
+ timeFormat: this.o.time_format,
+ altField: this.$hidden,
+ altFieldTimeOnly: false,
+ altTimeFormat: 'HH:mm:ss',
+ showButtonPanel: true,
+ controlType: 'select',
+ oneLine: true,
+ closeText: acf._e('date_time_picker', 'selectText')
+ };
+
+
+ // add custom 'Close = Select' functionality
+ args.onClose = function( value, instance ){
+
+ // vars
+ var $div = instance.dpDiv,
+ $close = $div.find('.ui-datepicker-close');
+
+
+ // if clicking close button
+ if( !value && $close.is(':hover') ) {
+
+ // attempt to find new value
+ value = acf.maybe_get(instance, 'settings.timepicker.formattedTime');
+
+
+ // bail early if no value
+ if( !value ) return;
+
+
+ // update value
+ $.datepicker._setTime(instance);
+
+ }
+
+ };
+
+
+ // filter for 3rd party customization
+ args = acf.apply_filters('time_picker_args', args, this.$field);
+
+
+ // add date picker
+ this.$input.timepicker( args );
+
+
+ // wrap the datepicker (only if it hasn't already been wrapped)
+ if( $('body > #ui-datepicker-div').exists() ) {
+
+ $('body > #ui-datepicker-div').wrap('
');
+
+ }
+
+
+ // action for 3rd party customization
+ acf.do_action('time_picker_init', this.$input, args, this.$field);
+
+ },
+
+ blur: function(){
+
+ if( !this.$input.val() ) {
+
+ this.$hidden.val('');
+
+ }
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.true_false = acf.field.extend({
+
+ type: 'true_false',
+ $switch: null,
+ $input: null,
+
+ actions: {
+ 'prepare': 'render',
+ 'append': 'render',
+ 'show': 'render'
+ },
+
+ events: {
+ 'change .acf-switch-input': '_change',
+ 'focus .acf-switch-input': '_focus',
+ 'blur .acf-switch-input': '_blur',
+ 'keypress .acf-switch-input': '_keypress'
+ },
+
+
+ /*
+ * focus
+ *
+ * This function will setup variables when focused on a field
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ focus: function(){
+
+ // vars
+ this.$input = this.$field.find('.acf-switch-input');
+ this.$switch = this.$field.find('.acf-switch');
+
+ },
+
+
+ /*
+ * render
+ *
+ * This function is used to setup basic upload form attributes
+ *
+ * @type function
+ * @date 12/04/2016
+ * @since 5.3.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ render: function(){
+
+ // bail ealry if no $switch
+ if( !this.$switch.exists() ) return;
+
+
+ // vars
+ var $on = this.$switch.children('.acf-switch-on'),
+ $off = this.$switch.children('.acf-switch-off')
+ width = Math.max( $on.width(), $off.width() );
+
+
+ // bail ealry if no width
+ if( !width ) return;
+
+
+ // set widths
+ $on.css( 'min-width', width );
+ $off.css( 'min-width', width );
+
+ },
+
+
+ /*
+ * on
+ *
+ * description
+ *
+ * @type function
+ * @date 10/1/17
+ * @since 5.5.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ on: function() { //console.log('on');
+
+ this.$input.prop('checked', true);
+ this.$switch.addClass('-on');
+
+ },
+
+
+ /*
+ * off
+ *
+ * description
+ *
+ * @type function
+ * @date 10/1/17
+ * @since 5.5.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ off: function() { //console.log('off');
+
+ this.$input.prop('checked', false);
+ this.$switch.removeClass('-on');
+
+ },
+
+
+ /*
+ * change
+ *
+ * description
+ *
+ * @type function
+ * @date 12/10/16
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ _change: function( e ){
+
+ // vars
+ var checked = e.$el.prop('checked');
+
+
+ // enable
+ if( checked ) {
+
+ this.on();
+
+ // disable
+ } else {
+
+ this.off();
+
+ }
+
+ },
+
+
+ /*
+ * _focus
+ *
+ * description
+ *
+ * @type function
+ * @date 10/1/17
+ * @since 5.5.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ _focus: function( e ){
+
+ this.$switch.addClass('-focus');
+
+ },
+
+
+ /*
+ * _blur
+ *
+ * description
+ *
+ * @type function
+ * @date 10/1/17
+ * @since 5.5.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ _blur: function( e ){
+
+ this.$switch.removeClass('-focus');
+
+ },
+
+
+ /*
+ * _keypress
+ *
+ * description
+ *
+ * @type function
+ * @date 10/1/17
+ * @since 5.5.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ _keypress: function( e ){
+
+ // left
+ if( e.keyCode === 37 ) {
+
+ return this.off();
+
+ }
+
+
+ // right
+ if( e.keyCode === 39 ) {
+
+ return this.on();
+
+ }
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ // taxonomy
+ acf.fields.taxonomy = acf.field.extend({
+
+ type: 'taxonomy',
+ $el: null,
+
+ actions: {
+ 'ready': 'render',
+ 'append': 'render',
+ 'remove': 'remove'
+ },
+ events: {
+ 'click a[data-name="add"]': 'add_term'
+ },
+
+ focus: function(){
+
+ // $el
+ this.$el = this.$field.find('.acf-taxonomy-field');
+
+
+ // get options
+ this.o = acf.get_data(this.$el, {
+ save: '',
+ type: '',
+ taxonomy: ''
+ });
+
+
+ // extra
+ this.o.key = this.$field.data('key');
+
+ },
+
+ render: function(){
+
+ // attempt select2
+ var $select = this.$field.find('select');
+
+
+ // bail early if no select field
+ if( !$select.exists() ) return;
+
+
+ // select2 options
+ var args = acf.get_data( $select );
+
+
+ // customize args
+ args = acf.parse_args(args, {
+ 'pagination': true,
+ 'ajax_action': 'acf/fields/taxonomy/query',
+ 'key': this.o.key
+ });
+
+
+ // add select2
+ acf.select2.init( $select, args );
+
+ },
+
+ remove: function(){
+
+ // attempt select2
+ var $select = this.$field.find('select');
+
+
+ // validate ui
+ if( !$select.exists() ) return false;
+
+
+ // remove select2
+ acf.select2.destroy( $select );
+
+ },
+
+ add_term: function( e ){
+
+ // reference
+ var self = this;
+
+
+ // open popup
+ acf.open_popup({
+ title: e.$el.attr('title') || e.$el.data('title'),
+ loading: true,
+ height: 220
+ });
+
+
+
+ // AJAX data
+ var ajax_data = acf.prepare_for_ajax({
+ action: 'acf/fields/taxonomy/add_term',
+ field_key: this.o.key
+ });
+
+
+
+ // get HTML
+ $.ajax({
+ url: acf.get('ajaxurl'),
+ data: ajax_data,
+ type: 'post',
+ dataType: 'html',
+ success: function(html){
+
+ self.add_term_confirm( html );
+
+ }
+ });
+
+
+ },
+
+ add_term_confirm: function( html ){
+
+ // reference
+ var self = this;
+
+
+ // update popup
+ acf.update_popup({
+ content : html
+ });
+
+
+ // focus
+ $('#acf-popup input[name="term_name"]').focus();
+
+
+ // events
+ $('#acf-popup form').on('submit', function( e ){
+
+ // prevent default
+ e.preventDefault();
+
+
+ // submit
+ self.add_term_submit( $(this ));
+
+ });
+
+ },
+
+ add_term_submit: function( $form ){
+
+ // reference
+ var self = this;
+
+
+ // vars
+ var $submit = $form.find('.acf-submit'),
+ $name = $form.find('input[name="term_name"]'),
+ $parent = $form.find('select[name="term_parent"]');
+
+
+ // basic validation
+ if( $name.val() === '' ) {
+
+ $name.focus();
+ return false;
+
+ }
+
+
+ // show loading
+ $submit.find('button').attr('disabled', 'disabled');
+ $submit.find('.acf-spinner').addClass('is-active');
+
+
+ // vars
+ var ajax_data = acf.prepare_for_ajax({
+ action: 'acf/fields/taxonomy/add_term',
+ field_key: this.o.key,
+ term_name: $name.val(),
+ term_parent: $parent.exists() ? $parent.val() : 0
+ });
+
+
+ // save term
+ $.ajax({
+ url: acf.get('ajaxurl'),
+ data: ajax_data,
+ type: 'post',
+ dataType: 'json',
+ success: function( json ){
+
+ // vars
+ var message = acf.get_ajax_message(json);
+
+
+ // success
+ if( acf.is_ajax_success(json) ) {
+
+ // clear name
+ $name.val('');
+
+
+ // update term lists
+ self.append_new_term( json.data );
+
+ }
+
+
+ // message
+ if( message.text ) {
+
+ $submit.find('span').html( message.text );
+
+ }
+
+ },
+ complete: function(){
+
+ // reset button
+ $submit.find('button').removeAttr('disabled');
+
+
+ // hide loading
+ $submit.find('.acf-spinner').removeClass('is-active');
+
+
+ // remove message
+ $submit.find('span').delay(1500).fadeOut(250, function(){
+
+ $(this).html('');
+ $(this).show();
+
+ });
+
+
+ // focus
+ $name.focus();
+
+ }
+ });
+
+ },
+
+ append_new_term: function( term ){
+
+ // vars
+ var item = {
+ id: term.term_id,
+ text: term.term_label
+ };
+
+
+ // append to all taxonomy lists
+ $('.acf-taxonomy-field[data-taxonomy="' + this.o.taxonomy + '"]').each(function(){
+
+ // vars
+ var type = $(this).data('type');
+
+
+ // bail early if not checkbox/radio
+ if( type == 'radio' || type == 'checkbox' ) {
+
+ // allow
+
+ } else {
+
+ return;
+
+ }
+
+
+ // vars
+ var $hidden = $(this).children('input[type="hidden"]'),
+ $ul = $(this).find('ul:first'),
+ name = $hidden.attr('name');
+
+
+ // allow multiple selection
+ if( type == 'checkbox' ) {
+
+ name += '[]';
+
+ }
+
+
+ // create new li
+ var $li = $([
+ '',
+ '',
+ ' ',
+ '' + term.term_label + ' ',
+ ' ',
+ ' '
+ ].join(''));
+
+
+ // find parent
+ if( term.term_parent ) {
+
+ // vars
+ var $parent = $ul.find('li[data-id="' + term.term_parent + '"]');
+
+
+ // update vars
+ $ul = $parent.children('ul');
+
+
+ // create ul
+ if( !$ul.exists() ) {
+
+ $ul = $('');
+
+ $parent.append( $ul );
+
+ }
+
+ }
+
+
+ // append
+ $ul.append( $li );
+
+ });
+
+
+ // append to select
+ $('#acf-popup #term_parent').each(function(){
+
+ // vars
+ var $option = $('' + term.term_label + ' ');
+
+ if( term.term_parent ) {
+
+ $(this).children('option[value="' + term.term_parent + '"]').after( $option );
+
+ } else {
+
+ $(this).append( $option );
+
+ }
+
+ });
+
+
+ // set value
+ switch( this.o.type ) {
+
+ // select
+ case 'select':
+
+ //this.$el.children('input').select2('data', item);
+
+
+ // vars
+ var $select = this.$el.children('select');
+ acf.select2.add_value($select, term.term_id, term.term_label);
+
+
+ break;
+
+ case 'multi_select':
+
+/*
+ // vars
+ var $input = this.$el.children('input'),
+ value = $input.select2('data') || [];
+
+
+ // append
+ value.push( item );
+
+
+ // update
+ $input.select2('data', value);
+
+
+*/
+ // vars
+ var $select = this.$el.children('select');
+ acf.select2.add_value($select, term.term_id, term.term_label);
+
+
+ break;
+
+ case 'checkbox':
+ case 'radio':
+
+ // scroll to view
+ var $holder = this.$el.find('.categorychecklist-holder'),
+ $li = $holder.find('li[data-id="' + term.term_id + '"]'),
+ offet = $holder.get(0).scrollTop + ( $li.offset().top - $holder.offset().top );
+
+
+ // check input
+ $li.find('input').prop('checked', true);
+
+
+ // scroll to bottom
+ $holder.animate({scrollTop: offet}, '250');
+ break;
+
+ }
+
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.url = acf.field.extend({
+
+ type: 'url',
+ $input: null,
+
+ actions: {
+ 'ready': 'render',
+ 'append': 'render'
+
+ },
+
+ events: {
+ 'keyup input[type="url"]': 'render'
+ },
+
+ focus: function(){
+
+ this.$input = this.$field.find('input[type="url"]');
+
+ },
+
+ is_valid: function(){
+
+ // vars
+ var val = this.$input.val();
+
+
+ if( val.indexOf('://') !== -1 ) {
+
+ // url
+
+ } else if( val.indexOf('//') === 0 ) {
+
+ // protocol relative url
+
+ } else {
+
+ return false;
+
+ }
+
+
+ // return
+ return true;
+
+ },
+
+ render: function(){
+
+ // add class
+ if( this.is_valid() ) {
+
+ this.$input.parent().addClass('-valid');
+
+ // remove class
+ } else {
+
+ this.$input.parent().removeClass('-valid');
+
+ }
+
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.validation = acf.model.extend({
+
+ actions: {
+ 'ready': 'ready',
+ 'append': 'ready'
+ },
+
+ filters: {
+ 'validation_complete': 'validation_complete'
+ },
+
+ events: {
+ 'click #save-post': 'click_ignore',
+ 'click [type="submit"]': 'click_publish',
+ 'submit form': 'submit_form',
+ 'click .acf-error-message a': 'click_message'
+ },
+
+
+ // vars
+ active: 1,
+ ignore: 0,
+ busy: 0,
+ valid: true,
+ errors: [],
+
+
+ // classes
+ error_class: 'acf-error',
+ message_class: 'acf-error-message',
+
+
+ // el
+ $trigger: null,
+
+
+ /*
+ * ready
+ *
+ * This function will add 'non bubbling' events
+ *
+ * @type function
+ * @date 26/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ ready: function( $el ){
+
+ // vars
+ var $inputs = $('.acf-field input, .acf-field textarea, .acf-field select');
+
+
+ // bail early if no inputs
+ if( !$inputs.length ) return;
+
+
+ // reference
+ var self = this;
+
+
+ // event
+ $inputs.on('invalid', function( e ){
+
+ // vars
+ var $input = $(this);
+ var $field = acf.get_field_wrap( $input );
+
+
+ // event
+ $field.trigger('invalidField');
+
+
+ // action
+ acf.do_action('invalid', $input);
+ acf.do_action('invalid_field', $field);
+
+
+ // save draft (ignore validation)
+ if( acf.validation.ignore ) return;
+
+
+ // prevent default
+ // - prevents browser error message
+ // - also fixes chrome bug where 'hidden-by-tab' field throws focus error
+ e.preventDefault();
+
+
+ // append to errors
+ acf.validation.errors.push({
+ input: $input.attr('name'),
+ message: e.target.validationMessage
+ });
+
+
+ // invalid event has prevented the form from submitting
+ // trigger acf validation fetch (safe to call multiple times)
+ acf.validation.fetch( $input.closest('form') );
+
+ });
+
+ },
+
+
+ /*
+ * validation_complete
+ *
+ * This function will modify the JSON response and add local 'invalid' errors
+ *
+ * @type function
+ * @date 26/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ validation_complete: function( json, $form ) {
+
+ // bail early if no local errors
+ if( !this.errors.length ) return json;
+
+
+ // set valid
+ json.valid = 0;
+
+
+ // require array
+ json.errors = json.errors || [];
+
+
+ // vars
+ var inputs = [];
+
+
+ // populate inputs
+ if( json.errors.length ) {
+
+ for( i in json.errors ) {
+
+ inputs.push( json.errors[ i ].input );
+
+ }
+
+ }
+
+
+ // append
+ if( this.errors.length ) {
+
+ for( i in this.errors ) {
+
+ // vars
+ var error = this.errors[ i ];
+
+
+ // bail ealry if alreay exists
+ if( $.inArray(error.input, inputs) !== -1 ) continue;
+
+
+ // append
+ json.errors.push( error );
+
+ }
+
+ }
+
+
+ // reset
+ this.errors = [];
+
+
+ // return
+ return json;
+
+ },
+
+
+ /*
+ * click_message
+ *
+ * This function will dismiss the validation message
+ *
+ * @type function
+ * @date 26/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ click_message: function( e ) {
+
+ e.preventDefault();
+
+ acf.remove_el( e.$el.parent() );
+
+ },
+
+
+ /*
+ * click_ignore
+ *
+ * This event is trigered via submit butons which ignore validation
+ *
+ * @type function
+ * @date 4/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ click_ignore: function( e ) {
+
+ // reference
+ var self = this;
+
+
+ // vars
+ this.ignore = 1;
+ this.$trigger = e.$el;
+ this.$form = e.$el.closest('form');
+
+
+ // remove error message
+ $('.'+this.message_class).each(function(){
+ acf.remove_el( $(this) );
+ });
+
+
+ // ignore required inputs
+ this.ignore_required_inputs();
+
+
+ // maybe show errors
+ setTimeout(function(){
+ self.ignore = 0;
+ }, 100);
+
+ },
+
+
+ /**
+ * ignore_required_inputs
+ *
+ * This function will temporarily remove the 'required' attribute from all ACF inputs
+ *
+ * @date 23/10/17
+ * @since 5.6.3
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ ignore_required_inputs: function(){
+
+ // vars
+ var $inputs = $('.acf-field input[required], .acf-field textarea[required], .acf-field select[required]');
+
+
+ // bail early if no inputs
+ if( !$inputs.length ) return;
+
+
+ // remove required
+ $inputs.prop('required', false);
+
+
+ // timeout
+ setTimeout(function(){
+ $inputs.prop('required', true);
+ }, 100);
+
+ },
+
+
+ /*
+ * click_publish
+ *
+ * This event is trigered via submit butons which trigger validation
+ *
+ * @type function
+ * @date 4/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ click_publish: function( e ) {
+
+ this.$trigger = e.$el;
+
+ },
+
+
+ /*
+ * submit_form
+ *
+ * description
+ *
+ * @type function
+ * @date 4/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ submit_form: function( e ){
+
+ // bail early if not active
+ if( !this.active ) {
+
+ return true;
+
+ }
+
+
+ // ignore validation (only ignore once)
+ if( this.ignore ) {
+
+ this.ignore = 0;
+ return true;
+
+ }
+
+
+ // bail early if this form does not contain ACF data
+ if( !e.$el.find('#acf-form-data').exists() ) {
+
+ return true;
+
+ }
+
+
+ // bail early if is preview
+ var $preview = e.$el.find('#wp-preview');
+ if( $preview.exists() && $preview.val() ) {
+
+ // WP will lock form, unlock it
+ this.toggle( e.$el, 'unlock' );
+ return true;
+
+ }
+
+
+ // prevent default
+ e.preventDefault();
+
+
+ // run validation
+ this.fetch( e.$el );
+
+ },
+
+
+ /*
+ * lock
+ *
+ * description
+ *
+ * @type function
+ * @date 7/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ toggle: function( $form, state ){
+
+ // defaults
+ state = state || 'unlock';
+
+
+ // debug
+ //console.log('toggle %o, %o %o', this.$trigger, $form, state);
+
+ // vars
+ var $submit = null,
+ $spinner = null,
+ $parent = $('#submitdiv');
+
+
+ // 3rd party publish box
+ if( !$parent.exists() ) {
+
+ $parent = $('#submitpost');
+
+ }
+
+
+ // term, user
+ if( !$parent.exists() ) {
+
+ $parent = $form.find('p.submit').last();
+
+ }
+
+
+ // front end form
+ if( !$parent.exists() ) {
+
+ $parent = $form.find('.acf-form-submit');
+
+ }
+
+
+ // default
+ if( !$parent.exists() ) {
+
+ $parent = $form;
+
+ }
+
+
+ // find elements
+ // note: media edit page does not use .button, this is why we need to look for generic input[type="submit"]
+ $submit = $parent.find('input[type="submit"], .button');
+ $spinner = $parent.find('.spinner, .acf-spinner');
+
+
+ // hide all spinners (hides the preview spinner)
+ this.hide_spinner( $spinner );
+
+
+ // unlock
+ if( state == 'unlock' ) {
+
+ this.enable_submit( $submit );
+
+ // lock
+ } else if( state == 'lock' ) {
+
+ // show only last spinner (allow all spinners to be hidden - preview spinner + submit spinner)
+ this.disable_submit( $submit );
+ this.show_spinner( $spinner.last() );
+
+ }
+
+ },
+
+
+ /*
+ * fetch
+ *
+ * description
+ *
+ * @type function
+ * @date 4/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ fetch: function( $form ){
+
+ // bail aelry if already busy
+ if( this.busy ) return false;
+
+
+ // reference
+ var self = this;
+
+
+ // action for 3rd party
+ acf.do_action('validation_begin');
+
+
+ // vars
+ var data = acf.serialize($form);
+
+
+ // append AJAX action
+ data.action = 'acf/validate_save_post';
+
+
+ // prepare
+ data = acf.prepare_for_ajax(data);
+
+
+ // set busy
+ this.busy = 1;
+
+
+ // lock form
+ this.toggle( $form, 'lock' );
+
+
+ // ajax
+ $.ajax({
+ url: acf.get('ajaxurl'),
+ data: data,
+ type: 'post',
+ dataType: 'json',
+ success: function( json ){
+
+ // bail early if not json success
+ if( !acf.is_ajax_success(json) ) {
+
+ return;
+
+ }
+
+
+ self.fetch_success( $form, json.data );
+
+ },
+ complete: function(){
+
+ self.fetch_complete( $form );
+
+ }
+ });
+
+ },
+
+
+ /*
+ * fetch_complete
+ *
+ * description
+ *
+ * @type function
+ * @date 4/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ fetch_complete: function( $form ){
+
+ // set busy
+ this.busy = 0;
+
+
+ // unlock so WP can publish form
+ this.toggle( $form, 'unlock' );
+
+
+ // bail early if validationw as not valid
+ if( !this.valid ) return;
+
+
+ // update ignore (allow form submit to not run validation)
+ this.ignore = 1;
+
+
+ // remove previous error message
+ var $message = $form.children('.acf-error-message');
+
+ if( $message.exists() ) {
+
+ $message.addClass('-success');
+ $message.children('p').html( acf._e('validation_successful') );
+
+
+ // remove message
+ setTimeout(function(){
+
+ acf.remove_el( $message );
+
+ }, 2000);
+
+ }
+
+
+ // remove hidden postboxes (this will stop them from being posted to save)
+ $form.find('.acf-postbox.acf-hidden').remove();
+
+
+ // action for 3rd party customization
+ acf.do_action('submit', $form);
+
+
+ // submit form again
+ if( this.$trigger ) {
+
+ this.$trigger.click();
+
+ } else {
+
+ $form.submit();
+
+ }
+
+
+ // lock form
+ this.toggle( $form, 'lock' );
+
+ },
+
+
+ /*
+ * fetch_success
+ *
+ * description
+ *
+ * @type function
+ * @date 4/05/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ fetch_success: function( $form, json ){
+
+ // filter for 3rd party customization
+ json = acf.apply_filters('validation_complete', json, $form);
+
+
+ // validate json
+ if( !json || json.valid || !json.errors ) {
+
+ // set valid (allows fetch_complete to run)
+ this.valid = true;
+
+
+ // action for 3rd party
+ acf.do_action('validation_success');
+
+
+ // end function
+ return;
+
+ }
+
+
+ // action for 3rd party
+ acf.do_action('validation_failure');
+
+
+ // set valid (prevents fetch_complete from runing)
+ this.valid = false;
+
+
+ // reset trigger
+ this.$trigger = null;
+
+
+ // display errors
+ this.display_errors( json.errors, $form );
+
+ },
+
+
+ /**
+ * display_errors
+ *
+ * This function will display errors
+ *
+ * @date 23/10/17
+ * @since 5.6.3
+ *
+ * @param array errors
+ * @return n/a
+ */
+
+ display_errors: function( errors, $form ){
+
+ // bail early if no errors
+ if( !errors || !errors.length ) return;
+
+
+ // vars
+ var $message = $form.children('.acf-error-message');
+ var message = acf._e('validation_failed');
+ var count = 0;
+ var $scrollTo = null;
+
+
+ // loop
+ for( i = 0; i < errors.length; i++ ) {
+
+ // vars
+ var error = errors[ i ];
+
+
+ // general error
+ if( !error.input ) {
+ message += '. ' + error.message;
+ continue;
+ }
+
+
+ // get input
+ var $input = $form.find('[name="' + error.input + '"]').first();
+
+
+ // if $_POST value was an array, this $input may not exist
+ if( !$input.exists() ) {
+ $input = $form.find('[name^="' + error.input + '"]').first();
+ }
+
+
+ // bail early if input doesn't exist
+ if( !$input.exists() ) continue;
+
+
+ // increase
+ count++;
+
+
+ // now get field
+ var $field = acf.get_field_wrap( $input );
+
+
+ // add error
+ this.add_error( $field, error.message );
+
+
+ // set $scrollTo
+ if( $scrollTo === null ) {
+ $scrollTo = $field;
+ }
+
+ }
+
+
+ // message
+ if( count == 1 ) {
+ message += '. ' + acf._e('validation_failed_1');
+ } else if( count > 1 ) {
+ message += '. ' + acf._e('validation_failed_2').replace('%d', count);
+ }
+
+
+ // maybe create $message
+ if( !$message.exists() ) {
+ $message = $('');
+ $form.prepend( $message );
+ }
+
+
+ // update message
+ $message.children('p').html( message );
+
+
+ // if no $scrollTo, set to message
+ if( $scrollTo === null ) {
+ $scrollTo = $message;
+ }
+
+
+ // timeout
+ setTimeout(function(){
+ $("html, body").animate({ scrollTop: $scrollTo.offset().top - ( $(window).height() / 2 ) }, 500);
+ }, 10);
+
+ },
+
+
+ /*
+ * add_error
+ *
+ * This function will add error markup to a field
+ *
+ * @type function
+ * @date 4/05/2015
+ * @since 5.2.3
+ *
+ * @param $field (jQuery)
+ * @param message (string)
+ * @return n/a
+ */
+
+ add_error: function( $field, message ){
+
+ // reference
+ var self = this;
+
+
+ // add class
+ $field.addClass(this.error_class);
+
+
+ // add message
+ if( message !== undefined ) {
+
+ $field.children('.acf-input').children('.' + this.message_class).remove();
+ $field.children('.acf-input').prepend('');
+
+ }
+
+
+ // add event
+ var event = function(){
+
+ // remove error
+ self.remove_error( $field );
+
+
+ // remove self
+ $field.off('focus change', 'input, textarea, select', event);
+
+ }
+
+ $field.on('focus change', 'input, textarea, select', event);
+
+
+ // event
+ $field.trigger('invalidField');
+
+
+ // hook for 3rd party customization
+ acf.do_action('add_field_error', $field);
+ acf.do_action('invalid_field', $field);
+
+ },
+
+
+ /*
+ * remove_error
+ *
+ * This function will remove error markup from a field
+ *
+ * @type function
+ * @date 4/05/2015
+ * @since 5.2.3
+ *
+ * @param $field (jQuery)
+ * @return n/a
+ */
+
+ remove_error: function( $field ){
+
+ // var
+ var $message = $field.children('.acf-input').children('.' + this.message_class);
+
+
+ // remove class
+ $field.removeClass(this.error_class);
+
+
+ // remove message
+ setTimeout(function(){
+
+ acf.remove_el( $message );
+
+ }, 250);
+
+
+ // hook for 3rd party customization
+ acf.do_action('remove_field_error', $field);
+ acf.do_action('valid_field', $field);
+
+ },
+
+
+ /*
+ * add_warning
+ *
+ * This functino will add and auto remove an error message to a field
+ *
+ * @type function
+ * @date 4/05/2015
+ * @since 5.2.3
+ *
+ * @param $field (jQuery)
+ * @param message (string)
+ * @return n/a
+ */
+
+ add_warning: function( $field, message ){
+
+ this.add_error( $field, message );
+
+ setTimeout(function(){
+
+ acf.validation.remove_error( $field )
+
+ }, 1000);
+
+ },
+
+
+ /*
+ * show_spinner
+ *
+ * This function will show a spinner element. Logic changed in WP 4.2
+ *
+ * @type function
+ * @date 3/05/2015
+ * @since 5.2.3
+ *
+ * @param $spinner (jQuery)
+ * @return n/a
+ */
+
+ show_spinner: function( $spinner ){
+
+ // bail early if no spinner
+ if( !$spinner.exists() ) {
+
+ return;
+
+ }
+
+
+ // vars
+ var wp_version = acf.get('wp_version');
+
+
+ // show
+ if( parseFloat(wp_version) >= 4.2 ) {
+
+ $spinner.addClass('is-active');
+
+ } else {
+
+ $spinner.css('display', 'inline-block');
+
+ }
+
+ },
+
+
+ /*
+ * hide_spinner
+ *
+ * This function will hide a spinner element. Logic changed in WP 4.2
+ *
+ * @type function
+ * @date 3/05/2015
+ * @since 5.2.3
+ *
+ * @param $spinner (jQuery)
+ * @return n/a
+ */
+
+ hide_spinner: function( $spinner ){
+
+ // bail early if no spinner
+ if( !$spinner.exists() ) {
+
+ return;
+
+ }
+
+
+ // vars
+ var wp_version = acf.get('wp_version');
+
+
+ // hide
+ if( parseFloat(wp_version) >= 4.2 ) {
+
+ $spinner.removeClass('is-active');
+
+ } else {
+
+ $spinner.css('display', 'none');
+
+ }
+
+ },
+
+
+ /*
+ * disable_submit
+ *
+ * This function will disable the $trigger is possible
+ *
+ * @type function
+ * @date 3/05/2015
+ * @since 5.2.3
+ *
+ * @param $spinner (jQuery)
+ * @return n/a
+ */
+
+ disable_submit: function( $submit ){
+
+ // bail early if no submit
+ if( !$submit.exists() ) {
+
+ return;
+
+ }
+
+
+ // add class
+ $submit.addClass('disabled button-disabled button-primary-disabled');
+
+ },
+
+
+ /*
+ * enable_submit
+ *
+ * This function will enable the $trigger is possible
+ *
+ * @type function
+ * @date 3/05/2015
+ * @since 5.2.3
+ *
+ * @param $spinner (jQuery)
+ * @return n/a
+ */
+
+ enable_submit: function( $submit ){
+
+ // bail early if no submit
+ if( !$submit.exists() ) {
+
+ return;
+
+ }
+
+
+ // remove class
+ $submit.removeClass('disabled button-disabled button-primary-disabled');
+
+ }
+
+ });
+
+})(jQuery);
+
+(function($){
+
+ acf.fields.wysiwyg = acf.field.extend({
+
+ type: 'wysiwyg',
+ $el: null,
+ $textarea: null,
+ toolbars: {},
+
+ events: {
+ 'mousedown .acf-editor-wrap.delay': 'mousedown'
+ },
+
+ actions: {
+ 'load': 'initialize',
+ 'append': 'initialize',
+ 'remove': 'disable',
+ 'sortstart': 'disable',
+ 'sortstop': 'enable'
+ },
+
+ focus: function(){
+
+ // get elements
+ this.$el = this.$field.find('.wp-editor-wrap').last();
+ this.$textarea = this.$el.find('textarea');
+
+
+ // get options
+ this.o = acf.get_data(this.$el, {
+ toolbar: '',
+ active: this.$el.hasClass('tmce-active'),
+ id: this.$textarea.attr('id')
+ });
+
+ },
+
+ mousedown: function(e){
+
+ // prevent default
+ e.preventDefault();
+
+
+ // remove delay class
+ this.$el.removeClass('delay');
+ this.$el.find('.acf-editor-toolbar').remove();
+
+
+ // initialize
+ this.initialize();
+
+ },
+
+ initialize: function(){
+
+ // bail early if delay
+ if( this.$el.hasClass('delay') ) return;
+
+
+ // vars
+ var args = {
+ tinymce: true,
+ quicktags: true,
+ toolbar: this.o.toolbar,
+ mode: this.o.active ? 'visual' : 'text',
+ };
+
+
+ // generate new id
+ var old_id = this.o.id,
+ new_id = acf.get_uniqid('acf-editor-'),
+ html = this.$el.outerHTML();
+
+
+ // replace
+ html = acf.str_replace( old_id, new_id, html );
+
+
+ // swap
+ this.$el.replaceWith( html );
+
+
+ // update id
+ this.o.id = new_id;
+
+
+ // initialize
+ acf.tinymce.initialize( this.o.id, args, this.$field );
+
+ },
+
+ disable: function(){
+
+ acf.tinymce.destroy( this.o.id );
+
+ },
+
+ enable: function(){
+
+ if( this.o.active ) {
+ acf.tinymce.enable( this.o.id );
+ }
+
+ }
+
+ });
+
+
+ /*
+ * acf.tinymce
+ *
+ * description
+ *
+ * @type function
+ * @date 18/8/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ acf.tinymce = acf.model.extend({
+
+ toolbars: {},
+
+ actions: {
+ 'ready': 'ready'
+ },
+
+
+ /*
+ * ready
+ *
+ * This function will move the acf-hidden-wp-editor and fix the activeEditor
+ *
+ * @type function
+ * @date 18/8/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ ready: function(){
+
+ // vars
+ var $div = $('#acf-hidden-wp-editor');
+
+
+ // bail early if doesn't exist
+ if( !$div.exists() ) return;
+
+
+ // move to footer
+ $div.appendTo('body');
+
+
+ // bail early if no tinymce
+ if( !acf.isset(window,'tinymce','on') ) return;
+
+
+ // restore default activeEditor
+ tinymce.on('AddEditor', function( data ){
+
+ // vars
+ var editor = data.editor;
+
+
+ // bail early if not 'acf'
+ if( editor.id.substr(0, 3) !== 'acf' ) return;
+
+
+ // override if 'content' exists
+ editor = tinymce.editors.content || editor;
+
+
+ // update vars
+ tinymce.activeEditor = editor;
+ wpActiveEditor = editor.id;
+
+ });
+
+ },
+
+
+ /*
+ * defaults
+ *
+ * This function will return default mce and qt settings
+ *
+ * @type function
+ * @date 18/8/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ defaults: function(){
+
+ // bail early if no tinyMCEPreInit
+ if( typeof tinyMCEPreInit === 'undefined' ) return false;
+
+
+ // vars
+ var defaults = {
+ tinymce: tinyMCEPreInit.mceInit.acf_content,
+ quicktags: tinyMCEPreInit.qtInit.acf_content
+ };
+
+
+ // return
+ return defaults;
+
+ },
+
+
+ /*
+ * initialize
+ *
+ * This function will initialize the tinymce and quicktags instances
+ *
+ * @type function
+ * @date 18/8/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ initialize: function( id, args, $field ){
+
+ // defaults
+ args = args || {};
+ $field = $field || null;
+
+
+ // merge
+ args = acf.parse_args(args, {
+ tinymce: true,
+ quicktags: true,
+ toolbar: 'full',
+ mode: 'visual', // visual,text
+ });
+
+
+ // tinymce
+ if( args.tinymce ) {
+ this.initialize_tinymce( id, args, $field );
+ }
+
+
+ // quicktags
+ if( args.quicktags ) {
+ this.initialize_quicktags( id, args, $field );
+ }
+
+ },
+
+
+ /*
+ * initialize_tinymce
+ *
+ * This function will initialize the tinymce instance
+ *
+ * @type function
+ * @date 18/8/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ initialize_tinymce: function( id, args, $field ){
+
+ // vars
+ var $textarea = $('#'+id);
+ var defaults = this.defaults();
+ var toolbars = this.toolbars;
+
+
+ // bail early
+ if( typeof tinymce === 'undefined' ) return false;
+ if( !defaults ) return false;
+
+
+ // check if exists
+ if( tinymce.get(id) ) {
+ return this.enable( id );
+ }
+
+
+ // settings
+ init = $.extend( {}, defaults.tinymce, args.tinymce );
+ init.id = id;
+ init.selector = '#' + id;
+
+
+ // toolbar
+ var toolbar = args.toolbar;
+ if( toolbar && typeof toolbars[toolbar] !== 'undefined' ) {
+
+ for( var i = 1; i <= 4; i++ ) {
+ init[ 'toolbar' + i ] = toolbars[toolbar][i] || '';
+ }
+
+ }
+
+
+ // event
+ init.setup = function( ed ){
+
+ ed.on('focus', function(e) {
+ acf.validation.remove_error( $field );
+ });
+
+ ed.on('change', function(e) {
+ ed.save(); // save to textarea
+ $textarea.trigger('change');
+ });
+
+ $( ed.getWin() ).on('unload', function() {
+ acf.tinymce.remove( id );
+ });
+
+ };
+
+
+ // disable wp_autoresize_on (no solution yet for fixed toolbar)
+ init.wp_autoresize_on = false;
+
+
+ // hook for 3rd party customization
+ init = acf.apply_filters('wysiwyg_tinymce_settings', init, id, $field);
+
+
+ // z-index fix (caused too many conflicts)
+ //if( acf.isset(tinymce,'ui','FloatPanel') ) {
+ // tinymce.ui.FloatPanel.zIndex = 900000;
+ //}
+
+
+ // store settings
+ tinyMCEPreInit.mceInit[ id ] = init;
+
+
+ // visual tab is active
+ if( args.mode == 'visual' ) {
+
+ // init
+ tinymce.init( init );
+
+
+ // get editor
+ var ed = tinymce.get( id );
+
+
+ // action
+ acf.do_action('wysiwyg_tinymce_init', ed, ed.id, init, $field);
+
+ }
+
+ },
+
+
+ /*
+ * initialize_quicktags
+ *
+ * This function will initialize the quicktags instance
+ *
+ * @type function
+ * @date 18/8/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ initialize_quicktags: function( id, args, $field ){
+
+ // vars
+ var defaults = this.defaults();
+
+
+ // bail early
+ if( typeof quicktags === 'undefined' ) return false;
+ if( !defaults ) return false;
+
+
+ // settings
+ init = $.extend( {}, defaults.quicktags, args.quicktags );
+ init.id = id;
+
+
+ // filter
+ init = acf.apply_filters('wysiwyg_quicktags_settings', init, init.id, $field);
+
+
+ // store settings
+ tinyMCEPreInit.qtInit[ id ] = init;
+
+
+ // init
+ var ed = quicktags( init );
+
+
+ // generate HTML
+ this.build_quicktags( ed );
+
+
+ // action for 3rd party customization
+ acf.do_action('wysiwyg_quicktags_init', ed, ed.id, init, $field);
+
+ },
+
+
+ /*
+ * build_quicktags
+ *
+ * This function will build the quicktags HTML
+ *
+ * @type function
+ * @date 18/8/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ build_quicktags: function( ed ){
+
+ var canvas, name, settings, theButtons, html, ed, id, i, use, instanceId,
+ defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,';
+
+ canvas = ed.canvas;
+ name = ed.name;
+ settings = ed.settings;
+ html = '';
+ theButtons = {};
+ use = '';
+ instanceId = ed.id;
+
+ // set buttons
+ if ( settings.buttons ) {
+ use = ','+settings.buttons+',';
+ }
+
+ for ( i in edButtons ) {
+ if ( ! edButtons[i] ) {
+ continue;
+ }
+
+ id = edButtons[i].id;
+ if ( use && defaults.indexOf( ',' + id + ',' ) !== -1 && use.indexOf( ',' + id + ',' ) === -1 ) {
+ continue;
+ }
+
+ if ( ! edButtons[i].instance || edButtons[i].instance === instanceId ) {
+ theButtons[id] = edButtons[i];
+
+ if ( edButtons[i].html ) {
+ html += edButtons[i].html( name + '_' );
+ }
+ }
+ }
+
+ if ( use && use.indexOf(',dfw,') !== -1 ) {
+ theButtons.dfw = new QTags.DFWButton();
+ html += theButtons.dfw.html( name + '_' );
+ }
+
+ if ( 'rtl' === document.getElementsByTagName( 'html' )[0].dir ) {
+ theButtons.textdirection = new QTags.TextDirectionButton();
+ html += theButtons.textdirection.html( name + '_' );
+ }
+
+ ed.toolbar.innerHTML = html;
+ ed.theButtons = theButtons;
+
+ if ( typeof jQuery !== 'undefined' ) {
+ jQuery( document ).triggerHandler( 'quicktags-init', [ ed ] );
+ }
+
+ },
+
+ disable: function( id ){
+
+ this.destroy( id );
+
+ },
+
+ destroy: function( id ){
+
+ this.destroy_tinymce( id );
+
+ },
+
+ destroy_tinymce: function( id ){
+
+ // bail early
+ if( typeof tinymce === 'undefined' ) return false;
+
+
+ // get editor
+ var ed = tinymce.get( id );
+
+
+ // bail early if no editor
+ if( !ed ) return false;
+
+
+ // save
+ ed.save();
+
+
+ // destroy editor
+ ed.destroy();
+
+
+ // return
+ return true;
+
+ },
+
+ enable: function( id ){
+
+ this.enable_tinymce( id );
+
+ },
+
+ enable_tinymce: function( id ){
+
+ // bail early
+ if( typeof switchEditors === 'undefined' ) return false;
+
+
+ // bail ealry if not initialized
+ if( typeof tinyMCEPreInit.mceInit[ id ] === 'undefined' ) return false;
+
+
+ // toggle
+ switchEditors.go( id, 'tmce');
+
+
+ // return
+ return true;
+
+ },
+
+ });
+
+
+})(jQuery);
+
+// @codekit-prepend "../js/event-manager.js";
+// @codekit-prepend "../js/acf.js";
+// @codekit-prepend "../js/acf-ajax.js";
+// @codekit-prepend "../js/acf-button-group.js";
+// @codekit-prepend "../js/acf-checkbox.js";
+// @codekit-prepend "../js/acf-color-picker.js";
+// @codekit-prepend "../js/acf-conditional-logic.js";
+// @codekit-prepend "../js/acf-date-picker.js";
+// @codekit-prepend "../js/acf-date-time-picker.js";
+// @codekit-prepend "../js/acf-file.js";
+// @codekit-prepend "../js/acf-google-map.js";
+// @codekit-prepend "../js/acf-image.js";
+// @codekit-prepend "../js/acf-link.js";
+// @codekit-prepend "../js/acf-media.js";
+// @codekit-prepend "../js/acf-oembed.js";
+// @codekit-prepend "../js/acf-radio.js";
+// @codekit-prepend "../js/acf-range.js";
+// @codekit-prepend "../js/acf-relationship.js";
+// @codekit-prepend "../js/acf-select2.js";
+// @codekit-prepend "../js/acf-select.js";
+// @codekit-prepend "../js/acf-accordion.js";
+// @codekit-prepend "../js/acf-tab.js";
+// @codekit-prepend "../js/acf-time-picker.js";
+// @codekit-prepend "../js/acf-true-false.js";
+// @codekit-prepend "../js/acf-taxonomy.js";
+// @codekit-prepend "../js/acf-url.js";
+// @codekit-prepend "../js/acf-validation.js";
+// @codekit-prepend "../js/acf-wysiwyg.js";
+
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-input.min.js b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-input.min.js
new file mode 100644
index 0000000..40612de
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-input.min.js
@@ -0,0 +1,3 @@
+!function(e,t){"use strict";var i=function(){function e(){return u}function t(e,t,i,a){return"string"==typeof e&&"function"==typeof t&&(i=parseInt(i||10,10),l("actions",e,t,i,a)),f}function i(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t&&d("actions",t,e),f}function a(e,t){return"string"==typeof e&&r("actions",e,t),f}function n(e,t,i,a){return"string"==typeof e&&"function"==typeof t&&(i=parseInt(i||10,10),l("filters",e,t,i,a)),f}function s(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t?d("filters",t,e):f}function o(e,t){return"string"==typeof e&&r("filters",e,t),f}function r(e,t,i,a){if(u[e][t])if(i){var n=u[e][t],s;if(a)for(s=n.length;s--;){var o=n[s];o.callback===i&&o.context===a&&n.splice(s,1)}else for(s=n.length;s--;)n[s].callback===i&&n.splice(s,1)}else u[e][t]=[]}function l(e,t,i,a,n){var s={callback:i,priority:a,context:n},o=u[e][t];o?(o.push(s),o=c(o)):o=[s],u[e][t]=o}function c(e){for(var t,i,a,n=1,s=e.length;nt.priority;)e[i]=e[i-1],--i;e[i]=t}return e}function d(e,t,i){var a=u[e][t];if(!a)return"filters"===e&&i[0];var n=0,s=a.length;if("filters"===e)for(;n0},$.fn.outerHTML=function(){return $(this).get(0).outerHTML},acf={l10n:{},o:{},update:function(e,t){this.o[e]=t},get:function(e){return void 0!==this.o[e]?this.o[e]:null},_e:function(e,t){t=t||!1;var i=this.l10n[e]||"";return t&&(i=i[t]||""),i},add_action:function(){for(var e=arguments[0].split(" "),t=e.length,i=0;ie.length?Array(t-e.length+1).join("0")+e:e};return this.php_js||(this.php_js={}),this.php_js.uniqidSeed||(this.php_js.uniqidSeed=Math.floor(123456789*Math.random())),this.php_js.uniqidSeed++,i=e,i+=a(parseInt((new Date).getTime()/1e3,10),8),i+=a(this.php_js.uniqidSeed,5),t&&(i+=(10*Math.random()).toFixed(8).toString()),i},serialize_form:function(){return this.serialize.apply(this,arguments)},serialize:function(e,t){t=t||"";var i={},a={},n=e.find("select, textarea, input").serializeArray();return $.each(n,function(e,n){var s=n.name,o=n.value;if(t){if(0!==s.indexOf(t))return;s=s.slice(t.length),"["==s.slice(0,1)&&(s=s.slice(1).replace("]",""))}"[]"===s.slice(-2)&&(s=s.slice(0,-2),void 0===a[s]&&(a[s]=-1),a[s]++,s+="["+a[s]+"]"),i[s]=o}),i},disable:function(e,t){if(t=t||"",e.hasClass("acf-disabled"))return!1;if(e.prop("disabled",!0),t){var i=e.data("acf_disabled")||[];i.indexOf(t)<0&&(i.push(t),e.data("acf_disabled",i))}return!0},enable:function(e,t){if(t=t||"",e.hasClass("acf-disabled"))return!1;var i=e.data("acf_disabled")||[];if(t){var a=i.indexOf(t);a>-1&&(i.splice(a,1),e.data("acf_disabled",i))}return!i.length&&(e.prop("disabled",!1),!0)},disable_el:function(e,t){t=t||"",e.find("select, textarea, input").each(function(){acf.disable($(this),t)})},disable_form:function(e,t){this.disable_el.apply(this,arguments)},enable_el:function(e,t){t=t||"",e.find("select, textarea, input").each(function(){acf.enable($(this),t)})},enable_form:function(e,t){this.enable_el.apply(this,arguments)},remove_tr:function(e,t){var i=e.height(),a=e.children().length;e.addClass("acf-remove-element"),setTimeout(function(){e.removeClass("acf-remove-element"),e.html(' '),e.children("td").animate({height:0},250,function(){e.remove(),"function"==typeof t&&t()})},250)},remove_el:function(e,t,i){i=i||0;var a=e.height(),n=e.width(),s=e.css("margin"),o=e.outerHeight(!0);acf.do_action("remove",e),e.wrap('
');var r=e.parent();e.css({height:a,width:n,margin:s,position:"absolute"}),setTimeout(function(){r.css({opacity:0,height:i})},50),setTimeout(function(){r.remove(),"function"==typeof t&&t.apply(this,arguments)},301)},isset:function(){var e=arguments,t=e.length,a=null,n;if(0===t)throw new Error("Empty isset");for(a=e[0],i=1;i #acf-popup"),$popup.exists())return update_popup(e);var t=['"].join("");return $("body").append(t),$("#acf-popup").on("click",".bg, .acf-close-popup",function(e){e.preventDefault(),acf.close_popup()}),this.update_popup(e)},update_popup:function(e){return $popup=$("#acf-popup"),!!$popup.exists()&&(e=$.extend({},{title:"",content:"",width:0,height:0,loading:!1},e),e.title&&$popup.find(".title h3").html(e.title),e.content&&($inner=$popup.find(".inner:first"),$inner.html(e.content),acf.do_action("append",$inner),$inner.attr("style","position: relative;"),e.height=$inner.outerHeight(),$inner.removeAttr("style")),e.width&&$popup.find(".acf-popup-box").css({width:e.width,"margin-left":0-e.width/2}),e.height&&(e.height+=44,$popup.find(".acf-popup-box").css({height:e.height,"margin-top":0-e.height/2})),e.loading?$popup.find(".loading").show():$popup.find(".loading").hide(),$popup)},close_popup:function(){$popup=$("#acf-popup"),$popup.exists()&&$popup.remove()},update_user_setting:function(e,t){$.ajax({url:acf.get("ajaxurl"),dataType:"html",type:"post",data:acf.prepare_for_ajax({action:"acf/update_user_setting",name:e,value:t})})},prepare_for_ajax:function(e){var t={};return $.each(e,function(e,i){$.isPlainObject(i)&&!$.isEmptyObject(i)?$.each(i,function(i,a){i+="";var n=i.indexOf("[");i=0==n?e+i:n>0?e+"["+i.slice(0,n)+"]"+i.slice(n):e+"["+i+"]",t[i]=a}):t[e]=i}),t.nonce=acf.get("nonce"),t.post_id=acf.get("post_id"),t=acf.apply_filters("prepare_for_ajax",t)},is_ajax_success:function(e){return!(!e||!e.success)},get_ajax_message:function(e){var t={text:"",type:"error"};return e?(e.success&&(t.type="success"),e.data&&e.data.message&&(t.text=e.data.message),e.data&&e.data.error&&(t.text=e.data.error),t):t},is_in_view:function(e){var t=e.offset().top,i=t+e.height();if(t===i)return!1;var a=$(window).scrollTop();return i<=a+$(window).height()&&t>=a},val:function(e,t){var i=e.val();e.val(t),t!=i&&e.trigger("change")},str_replace:function(e,t,i){return i.split(e).join(t)},str_sanitize:function(e){var t={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","ß":"s","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Ĉ":"C","ĉ":"c","Ċ":"C","ċ":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"D","đ":"d","Ē":"E","ē":"e","Ĕ":"E","ĕ":"e","Ė":"E","ė":"e","Ę":"E","ę":"e","Ě":"E","ě":"e","Ĝ":"G","ĝ":"g","Ğ":"G","ğ":"g","Ġ":"G","ġ":"g","Ģ":"G","ģ":"g","Ĥ":"H","ĥ":"h","Ħ":"H","ħ":"h","Ĩ":"I","ĩ":"i","Ī":"I","ī":"i","Ĭ":"I","ĭ":"i","Į":"I","į":"i","İ":"I","ı":"i","IJ":"IJ","ij":"ij","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","Ĺ":"L","ĺ":"l","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ŀ":"L","ŀ":"l","Ł":"l","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","ʼn":"n","Ō":"O","ō":"o","Ŏ":"O","ŏ":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ŗ":"R","ŗ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ŝ":"S","ŝ":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ŧ":"T","ŧ":"t","Ũ":"U","ũ":"u","Ū":"U","ū":"u","Ŭ":"U","ŭ":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","ſ":"s","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Ǎ":"A","ǎ":"a","Ǐ":"I","ǐ":"i","Ǒ":"O","ǒ":"o","Ǔ":"U","ǔ":"u","Ǖ":"U","ǖ":"u","Ǘ":"U","ǘ":"u","Ǚ":"U","ǚ":"u","Ǜ":"U","ǜ":"u","Ǻ":"A","ǻ":"a","Ǽ":"AE","ǽ":"ae","Ǿ":"O","ǿ":"o"," ":"_","'":"","?":"","/":"","\\":"",".":"",",":"","`":"",">":"","<":"",'"':"","[":"","]":"","|":"","{":"","}":"","(":"",")":""},i=/\W/g,a=function(e){return void 0!==t[e]?t[e]:e};return e=e.replace(i,a),e=e.toLowerCase()},addslashes:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},esc_html:function(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(e).replace(/[&<>"'`=\/]/g,function(e){return t[e]})},render_select:function(e,t){var i=e.val();e.html(""),t&&$.each(t,function(t,a){var n=e;a.group&&(n=e.find('optgroup[label="'+a.group+'"]'),n.exists()||(n=$(' '),e.append(n))),n.append(''+acf.esc_html(a.label)+" "),i==a.value&&e.prop("selectedIndex",t)})},duplicate:function(e){void 0!==e.length&&(e={$el:e}),e=acf.parse_args(e,{$el:!1,search:"",replace:"",before:function(e){},after:function(e,t){},append:function(e,t){e.after(t)}});var t=e.$el,i;e.search||(e.search=t.attr("data-id")),e.replace||(e.replace=acf.get_uniqid()),e.before.apply(this,[t]),acf.do_action("before_duplicate",t);var i=t.clone();return i.removeClass("acf-clone"),acf.do_action("remove",i),e.search&&(i.attr("data-id",e.replace),i.find('[id*="'+e.search+'"]').each(function(){$(this).attr("id",$(this).attr("id").replace(e.search,e.replace))}),i.find('[name*="'+e.search+'"]').each(function(){$(this).attr("name",$(this).attr("name").replace(e.search,e.replace))}),i.find('label[for*="'+e.search+'"]').each(function(){$(this).attr("for",$(this).attr("for").replace(e.search,e.replace))})),i.find(".ui-sortable").removeClass("ui-sortable"),acf.do_action("after_duplicate",t,i),e.after.apply(this,[t,i]),e.append.apply(this,[t,i]),setTimeout(function(){acf.do_action("append",i)},1),i},decode:function(e){return $("").html(e).text()},parse_args:function(e,t){return"object"!=typeof e&&(e={}),"object"!=typeof t&&(t={}),$.extend({},t,e)},enqueue_script:function(e,t){var i=document.createElement("script");i.type="text/javascript",i.src=e,i.async=!0,i.readyState?i.onreadystatechange=function(){"loaded"!=i.readyState&&"complete"!=i.readyState||(i.onreadystatechange=null,t())}:i.onload=function(){t()},document.body.appendChild(i)}},acf.model={actions:{},filters:{},events:{},extend:function(e){var t=$.extend({},this,e);return $.each(t.actions,function(e,i){t._add_action(e,i)}),$.each(t.filters,function(e,i){t._add_filter(e,i)}),$.each(t.events,function(e,i){t._add_event(e,i)}),t},_add_action:function(e,t){var i=this,a=e.split(" "),e=a[0]||"",n=a[1]||10;acf.add_action(e,i[t],n,i)},_add_filter:function(e,t){var i=this,a=e.split(" "),e=a[0]||"",n=a[1]||10;acf.add_filter(e,i[t],n,i)},_add_event:function(e,t){var i=this,a=e.indexOf(" "),n=a>0?e.substr(0,a):e,s=a>0?e.substr(a+1):"",o=function(e){e.$el=$(this),"function"==typeof i.event&&(e=i.event(e)),i[t].apply(i,arguments)};s?$(document).on(n,s,o):$(document).on(n,o)},get:function(e,t){return t=t||null,void 0!==this[e]&&(t=this[e]),t},set:function(e,t){return this[e]=t,"function"==typeof this["_set_"+e]&&this["_set_"+e].apply(this),this}},acf.field=acf.model.extend({type:"",o:{},$field:null,_add_action:function(e,t){var i=this;e=e+"_field/type="+i.type,acf.add_action(e,function(e){i.set("$field",e),i[t].apply(i,arguments)})},_add_filter:function(e,t){var i=this;e=e+"_field/type="+i.type,acf.add_filter(e,function(e){i.set("$field",e),i[t].apply(i,arguments)})},_add_event:function(e,t){var i=this,a=e.substr(0,e.indexOf(" ")),n=e.substr(e.indexOf(" ")+1),s=acf.get_selector(i.type);$(document).on(a,s+" "+n,function(e){var a=$(this),n=acf.get_closest_field(a,i.type);n.length&&(n.is(i.$field)||i.set("$field",n),e.$el=a,e.$field=n,i[t].apply(i,[e]))})},_set_$field:function(){"function"==typeof this.focus&&this.focus()},doFocus:function(e){return this.set("$field",e)}}),acf.fields=acf.model.extend({actions:{prepare:"_prepare",prepare_field:"_prepare_field",ready:"_ready",ready_field:"_ready_field",append:"_append",append_field:"_append_field",load:"_load",load_field:"_load_field",remove:"_remove",remove_field:"_remove_field",sortstart:"_sortstart",sortstart_field:"_sortstart_field",sortstop:"_sortstop",sortstop_field:"_sortstop_field",show:"_show",show_field:"_show_field",hide:"_hide",hide_field:"_hide_field"},_prepare:function(e){acf.get_fields("",e).each(function(){acf.do_action("prepare_field",$(this))})},_prepare_field:function(e){acf.do_action("prepare_field/type="+e.data("type"),e)},_ready:function(e){acf.get_fields("",e).each(function(){acf.do_action("ready_field",$(this))})},_ready_field:function(e){acf.do_action("ready_field/type="+e.data("type"),e)},_append:function(e){acf.get_fields("",e).each(function(){acf.do_action("append_field",$(this))})},_append_field:function(e){acf.do_action("append_field/type="+e.data("type"),e)},_load:function(e){acf.get_fields("",e).each(function(){acf.do_action("load_field",$(this))})},_load_field:function(e){acf.do_action("load_field/type="+e.data("type"),e)},_remove:function(e){acf.get_fields("",e).each(function(){acf.do_action("remove_field",$(this))})},_remove_field:function(e){acf.do_action("remove_field/type="+e.data("type"),e)},_sortstart:function(e,t){acf.get_fields("",e).each(function(){acf.do_action("sortstart_field",$(this),t)})},_sortstart_field:function(e,t){acf.do_action("sortstart_field/type="+e.data("type"),e,t)},_sortstop:function(e,t){acf.get_fields("",e).each(function(){acf.do_action("sortstop_field",$(this),t)})},_sortstop_field:function(e,t){acf.do_action("sortstop_field/type="+e.data("type"),e,t)},_hide:function(e,t){acf.get_fields("",e).each(function(){acf.do_action("hide_field",$(this),t)})},_hide_field:function(e,t){acf.do_action("hide_field/type="+e.data("type"),e,t)},_show:function(e,t){acf.get_fields("",e).each(function(){acf.do_action("show_field",$(this),t)})},_show_field:function(e,t){acf.do_action("show_field/type="+e.data("type"),e,t)}}),$(document).ready(function(){acf.do_action("ready",$("body"))}),$(window).on("load",function(){acf.do_action("load",$("body"))}),acf.layout=acf.model.extend({actions:{"refresh 99":"refresh"},refresh:function(e){e=e||$("body"),this.render_tables(e),this.render_groups(e)},render_tables:function(e){var t=this,i=e.find(".acf-table:visible");e.is("table")?i=i.add(e):e.is("tr")&&(i=i.add(e.closest("table"))),i.each(function(){t.render_table($(this))})},render_table:function(e){var t=e.find("> thead th.acf-th"),i=1,a=100;if(t.exists()){var n=e.find("> tbody > tr"),s=n.find("> td.acf-field");n.hasClass("acf-clone")&&n.length>1&&(s=n.not(".acf-clone").find("> td.acf-field")),t.each(function(){var e=$(this),t=e.attr("data-key"),i=s.filter('[data-key="'+t+'"]');i.removeClass("appear-empty"),e.removeClass("hidden-by-conditional-logic"),i.exists()&&(0==i.not(".hidden-by-conditional-logic").length?e.addClass("hidden-by-conditional-logic"):i.filter(".hidden-by-conditional-logic").addClass("appear-empty"))}),t.css("width","auto"),t=t.not(".hidden-by-conditional-logic"),i=t.length,t.filter("[data-width]").each(function(){var e=parseInt($(this).attr("data-width"));a-=e,$(this).css("width",e+"%")}),t=t.not("[data-width]"),t.each(function(){var e=a/t.length;$(this).css("width",e+"%")}),e.find(".acf-row .acf-field.-collapsed-target").removeAttr("colspan"),e.find(".acf-row.-collapsed .acf-field.-collapsed-target").attr("colspan",i)}},render_groups:function(e){var t=this,i=e.find(".acf-fields:visible");e&&e.is(".acf-fields")&&(i=i.add(e)),i.each(function(){t.render_group($(this))})},render_group:function(e){var t=$(),i=0,a=0,n=-1,s=e.children(".acf-field[data-width]:visible");if(s.exists()){if(e.hasClass("-left"))return s.removeAttr("data-width"),void s.css("width","auto");s.removeClass("-r0 -c0").css({"min-height":0}),s.each(function(e){var s=$(this),o=s.position().top;0==e&&(i=o),o!=i&&(t.css({"min-height":a+1+"px"}),t=$(),i=s.position().top,a=0,n=-1),n++,a=s.outerHeight()>a?s.outerHeight():a,t=t.add(s),0==o?s.addClass("-r0"):0==n&&s.addClass("-c0")}),t.exists()&&t.css({"min-height":a+1+"px"})}}}),$(document).on("change",".acf-field input, .acf-field textarea, .acf-field select",function(){var e=$("#_acf_changed");e.length&&e.val(1),acf.do_action("change",$(this))}),$(document).on("click",'.acf-field a[href="#"]',function(e){e.preventDefault()}),acf.unload=acf.model.extend({locked:1,active:1,changed:0,filters:{validation_complete:"validation_complete"},actions:{ready:"ready",change:"on"},ready:function(){setTimeout(function(){acf.unload.locked=0},1e3)},events:{"submit form":"off"},validation_complete:function(e,t){return e&&e.errors&&this.on(),e},on:function(){this.changed||!this.active||this.locked||(this.changed=1,$(window).on("beforeunload",this.unload))},off:function(){this.changed=0,$(window).off("beforeunload",this.unload)},unload:function(){return acf._e("unload")}}),acf.tooltip=acf.model.extend({events:{"mouseenter .acf-js-tooltip":"_on","mouseup .acf-js-tooltip":"_off","mouseleave .acf-js-tooltip":"_off"},tooltip:function(e,t){var i=$(''+e+"
");$("body").append(i);var a=10;target_w=t.outerWidth(),target_h=t.outerHeight(),target_t=t.offset().top,target_l=t.offset().left,tooltip_w=i.outerWidth(),tooltip_h=i.outerHeight();var n=target_t-tooltip_h,s=target_l+target_w/2-tooltip_w/2;return s<10?(i.addClass("right"),s=target_l+target_w,n=target_t+target_h/2-tooltip_h/2):s+tooltip_w+10>$(window).width()?(i.addClass("left"),s=target_l-tooltip_w,n=target_t+target_h/2-tooltip_h/2):n-$(window).scrollTop()<10?(i.addClass("bottom"),n=target_t+target_h):i.addClass("top"),i.css({top:n,left:s}),i},temp:function(e,t){var t=this.tooltip(e,t),i=0;i+=250,setTimeout(function(){t.addClass("acf-fade-up")},i),i+=250,setTimeout(function(){t.remove()},i)},confirm:function(e,t,i,a,n){i=i||acf._e("are_you_sure"),a=a||''+acf._e("yes")+" ",n=n||''+acf._e("No")+" ";var s=this.tooltip(i+" "+a+" "+n,e);s.addClass("-confirm");var o=function(i,a){i.preventDefault(),i.stopImmediatePropagation(),e.off("click",r),s.off("click",".acf-confirm-y",r),s.off("click",".acf-confirm-n",l),$("body").off("click",l),s.remove(),t.apply(null,[a])},r=function(e){o(e,!0)},l=function(e){o(e,!1)};s.on("click",".acf-confirm-y",r),s.on("click",".acf-confirm-n",l),e.on("click",r),$("body").on("click",l)},confirm_remove:function(e,t){text=!1,button_y=''+acf._e("remove")+" ",button_n=''+acf._e("cancel")+" ",this.confirm(e,t,!1,button_y,button_n)},_on:function(e){var t=e.$el.attr("title");if(t){var i=this.tooltip(t,e.$el);e.$el.data("acf-tooltip",{title:t,$el:i}),e.$el.attr("title","")}},_off:function(e){var t=e.$el.data("acf-tooltip");t&&(t.$el.remove(),e.$el.attr("title",t.title))}}),acf.postbox=acf.model.extend({events:{"mouseenter .acf-postbox .handlediv":"on","mouseleave .acf-postbox .handlediv":"off"},on:function(e){e.$el.siblings(".hndle").addClass("hover")},off:function(e){e.$el.siblings(".hndle").removeClass("hover")},render:function(e){e=$.extend({},{id:"",key:"",style:"default",label:"top",edit_url:"",edit_title:"",visibility:!0},e);var t=$("#"+e.id),i=$("#"+e.id+"-hide"),a=i.parent();t.addClass("acf-postbox"),a.addClass("acf-postbox-toggle"),t.removeClass("hide-if-js"),a.removeClass("hide-if-js"),"default"!==e.style&&t.addClass(e.style),t.children(".inside").addClass("acf-fields").addClass("-"+e.label),e.visibility?i.prop("checked",!0):(t.addClass("acf-hidden"),a.addClass("acf-hidden")),e.edit_url&&t.children(".hndle").append(' ')}});var e=acf.model.extend({events:{"click .acf-panel-title":"_click"},_click:function(e){e.preventDefault(),this.toggle(e.$el.parent())},is_open:function(e){return e.hasClass("-open")},toggle:function(e){this.is_open(e)?this.close(e):this.open(e)},open:function(e){e.addClass("-open"),e.find(".acf-panel-title i").attr("class","dashicons dashicons-arrow-down")},close:function(e){e.removeClass("-open"),e.find(".acf-panel-title i").attr("class","dashicons dashicons-arrow-right")}});acf.notice=acf.model.extend({actions:{prepare:"prepare"},prepare:function(){var e=$(".acf-notice");e.length&&$("h1:first").after(e)},html:function(e,t){},success:function(e){},error:function(e){},warning:function(e){},information:function(e){}});var t=localStorage.getItem("acf");t=t?JSON.parse(t):{};var a=function(e){return"this."===e.substr(0,5)&&(e=e.substr(5)+"-"+acf.get("post_id")),e};acf.getPreference=function(e){return e=a(e),t[e]||null},acf.setPreference=function(e,i){e=a(e),null===i?delete t[e]:t[e]=i,localStorage.setItem("acf",JSON.stringify(t))},acf.removePreference=function(e){acf.setPreference(e,null)},$(document).on("sortstart",function(e,t){acf.do_action("sortstart",t.item,t.placeholder)}),$(document).on("sortstop",function(e,t){acf.do_action("sortstop",t.item,t.placeholder)}),acf.add_action("sortstart",function(e,t){e.is("tr")&&(e.css("position","relative"),e.children().each(function(){$(this).width($(this).width())}),e.css("position","absolute"),t.html(' '))}),acf.add_action("before_duplicate",function(e){e.find("select option:selected").addClass("selected")}),acf.add_action("after_duplicate",function(e,t){t.find("select").each(function(){var e=$(this),t=[];e.find("option.selected").each(function(){t.push($(this).val())}),e.val(t)}),e.find("select option.selected").removeClass("selected"),t.find("select option.selected").removeClass("selected")}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){return $.inArray(e,this)})}(jQuery),function($){acf.ajax=acf.model.extend({active:!1,actions:{ready:"ready"},events:{"change #page_template":"_change_template","change #parent_id":"_change_parent","change #post-formats-select input":"_change_format","change .categorychecklist input":"_change_term","change .categorychecklist select":"_change_term",'change .acf-taxonomy-field[data-save="1"] input':"_change_term",'change .acf-taxonomy-field[data-save="1"] select':"_change_term"},o:{},xhr:null,update:function(e,t){return this.o[e]=t,this},get:function(e){return this.o[e]||null},ready:function(){this.update("post_id",acf.get("post_id")),this.active=!0},fetch:function(){if(this.active&&acf.get("ajax")){this.xhr&&this.xhr.abort();var e=this,t=this.o;t.action="acf/post/get_field_groups",t.exists=[],$(".acf-postbox").not(".acf-hidden").each(function(){t.exists.push($(this).attr("id").substr(4))}),this.xhr=$.ajax({url:acf.get("ajaxurl"),data:acf.prepare_for_ajax(t),type:"post",dataType:"json",success:function(t){acf.is_ajax_success(t)&&e.render(t.data)}})}},render:function(e){$(".acf-postbox").addClass("acf-hidden"),$(".acf-postbox-toggle").addClass("acf-hidden"),$("#acf-style").html(""),$.each(e,function(e,t){var i=$("#acf-"+t.key),a=$("#acf-"+t.key+"-hide"),n=a.parent();i.removeClass("acf-hidden hide-if-js").show(),n.removeClass("acf-hidden hide-if-js").show(),a.prop("checked",!0);var s=i.find(".acf-replace-with-fields");s.exists()&&(s.replaceWith(t.html),acf.do_action("append",i)),0===e&&$("#acf-style").html(t.style),i.find(".acf-hidden-by-postbox").prop("disabled",!1)}),$(".acf-postbox.acf-hidden").find("select, textarea, input").not(":disabled").each(function(){$(this).addClass("acf-hidden-by-postbox").prop("disabled",!0)})},sync_taxonomy_terms:function(){var e=[""];$(".categorychecklist, .acf-taxonomy-field").each(function(){var t=$(this),i=t.find('input[type="checkbox"]').not(":disabled"),a=t.find('input[type="radio"]').not(":disabled"),n=t.find("select").not(":disabled"),s=t.find('input[type="hidden"]').not(":disabled");t.is(".acf-taxonomy-field")&&"1"!=t.attr("data-save")||t.closest(".media-frame").exists()||(i.exists()?i.filter(":checked").each(function(){e.push($(this).val())}):a.exists()?a.filter(":checked").each(function(){e.push($(this).val())}):n.exists()?n.find("option:selected").each(function(){e.push($(this).val())}):s.exists()&&s.each(function(){$(this).val()&&e.push($(this).val())}))}),e=e.filter(function(e,t,i){return i.indexOf(e)==t}),this.update("post_taxonomy",e).fetch()},_change_template:function(e){var t=e.$el.val();this.update("page_template",t).fetch()},_change_parent:function(e){var t="parent",i=0;""!=e.$el.val()&&(t="child",i=e.$el.val()),this.update("page_type",t).update("page_parent",i).fetch()},_change_format:function(e){var t=e.$el.val();"0"==t&&(t="standard"),this.update("post_format",t).fetch()},_change_term:function(e){var t=this;e.$el.closest(".media-frame").exists()||setTimeout(function(){t.sync_taxonomy_terms()},1)}})}(jQuery),function($){acf.fields.button_group=acf.field.extend({type:"button_group",$div:null,events:{'click input[type="radio"]':"click"},focus:function(){this.$div=this.$field.find(".acf-button-group"),this.o=acf.get_data(this.$div,{allow_null:0})},click:function(e){var t=e.$el,i=t.parent("label"),a=i.hasClass("selected");this.$div.find(".selected").removeClass("selected"),i.addClass("selected"),this.o.allow_null&&a&&(e.$el.prop("checked",!1),i.removeClass("selected"),e.$el.trigger("change"))}})}(jQuery),function($){acf.fields.checkbox=acf.field.extend({type:"checkbox",events:{"change input":"_change","click .acf-add-checkbox":"_add"},focus:function(){this.$ul=this.$field.find("ul"),this.$input=this.$field.find('input[type="hidden"]')},add:function(){var e=this.$input.attr("name")+"[]",t=' ';this.$ul.find(".acf-add-checkbox").parent("li").before(t)},_change:function(e){var t=this.$ul,i=t.find('input[type="checkbox"]').not(".acf-checkbox-toggle"),a=e.$el.is(":checked");if(e.$el.hasClass("acf-checkbox-toggle"))return void i.prop("checked",a).trigger("change");if(e.$el.hasClass("acf-checkbox-custom")){var n=e.$el.next('input[type="text"]');e.$el.next('input[type="text"]').prop("disabled",!a),a||""!=n.val()||e.$el.parent("li").remove()}if(t.find(".acf-checkbox-toggle").exists()){var a=0==i.not(":checked").length;t.find(".acf-checkbox-toggle").prop("checked",a)}},_add:function(e){this.add()}})}(jQuery),function($){acf.fields.color_picker=acf.field.extend({type:"color_picker",$input:null,$hidden:null,actions:{ready:"initialize",append:"initialize"},focus:function(){this.$input=this.$field.find('input[type="text"]'),this.$hidden=this.$field.find('input[type="hidden"]')},initialize:function(){var e=this.$input,t=this.$hidden,i=function(){setTimeout(function(){acf.val(t,e.val())},1)},a={defaultColor:!1,palettes:!0,hide:!0,change:i,clear:i},a=acf.apply_filters("color_picker_args",a,this.$field);this.$input.wpColorPicker(a)}})}(jQuery),function($,e){var t="hidden-by-conditional-logic",i=acf.conditional_logic=acf.model.extend({conditions:{},triggers:{},$parent:!1,actions:{"prepare 20":"render","append 20":"render",change:"change"},add:function(e,t){for(var i in t){var a=t[i];for(var n in a){var s=a[n];this.addTrigger(s.field,e)}}this.setCondition(e,t)},getTrigger:function(e){return this.triggers[e]||null},setTrigger:function(e,t){this.triggers[e]=t},addTrigger:function(e,t){var i=this.getTrigger(e)||{};i[t]=1,this.setTrigger(e,i)},getConditions:function(){return this.conditions},getCondition:function(e){return this.conditions[e]||null},setCondition:function(e,t){this.conditions[e]=t},render:function(e){e=e||!1;var t=acf.get_fields("",e,!0);this.renderFields(t),acf.do_action("refresh",e)},findTarget:function(e,t){var i=this;this.$parent=!1;var a=acf.get_fields(t,!1,!0);return!!a.length&&(a.length>1&&e.parents(".acf-row, .acf-table, .acf-fields").each(function(){var e=$(this),t=e.find(a);if(t.length)return a=t,i.$parent=e,!1}),a)},change:function(e){var t=acf.get_field_wrap(e),i=t.data("key"),a=this.getTrigger(i);if(!a)return!1;for(var n in a){var s=this.findTarget(t,n);this.renderFields(s)}acf.do_action("refresh",this.$parent)},renderFields:function(e){var t=this;e.each(function(){t.renderField($(this))})},renderField:function(e){var t=!1,i=e.data("key"),a=this.getCondition(i);if(!a)return!1;for(var n=0;n-1,match}});i.show_field=i.showField,i.hide_field=i.hideField}(jQuery),function($){acf.datepicker=acf.model.extend({actions:{"ready 1":"ready"},ready:function(){var e=acf.get("locale"),t=acf.get("rtl");l10n=acf._e("date_picker"),l10n&&void 0!==$.datepicker&&(l10n.isRTL=t,$.datepicker.regional[e]=l10n,$.datepicker.setDefaults(l10n))},init:function(e,t){void 0!==$.datepicker&&(t=t||{},e.datepicker(t),$("body > #ui-datepicker-div").exists()&&$("body > #ui-datepicker-div").wrap('
'))},destroy:function(e){}}),
+acf.fields.date_picker=acf.field.extend({type:"date_picker",$el:null,$input:null,$hidden:null,o:{},actions:{ready:"initialize",append:"initialize"},events:{'blur input[type="text"]':"blur"},focus:function(){this.$el=this.$field.find(".acf-date-picker"),this.$input=this.$el.find('input[type="text"]'),this.$hidden=this.$el.find('input[type="hidden"]'),this.o=acf.get_data(this.$el)},initialize:function(){if(this.o.save_format)return this.initialize2();var e={dateFormat:this.o.date_format,altField:this.$hidden,altFormat:"yymmdd",changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.o.first_day};e=acf.apply_filters("date_picker_args",e,this.$field),acf.datepicker.init(this.$input,e),acf.do_action("date_picker_init",this.$input,e,this.$field)},initialize2:function(){this.$input.val(this.$hidden.val());var e={dateFormat:this.o.date_format,altField:this.$hidden,altFormat:this.o.save_format,changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.o.first_day};e=acf.apply_filters("date_picker_args",e,this.$field);var t=e.dateFormat;e.dateFormat=this.o.save_format,acf.datepicker.init(this.$input,e),this.$input.datepicker("option","dateFormat",t),acf.do_action("date_picker_init",this.$input,e,this.$field)},blur:function(){this.$input.val()||this.$hidden.val("")}})}(jQuery),function($){acf.datetimepicker=acf.model.extend({actions:{"ready 1":"ready"},ready:function(){var e=acf.get("locale"),t=acf.get("rtl");l10n=acf._e("date_time_picker"),l10n&&void 0!==$.timepicker&&(l10n.isRTL=t,$.timepicker.regional[e]=l10n,$.timepicker.setDefaults(l10n))},init:function(e,t){void 0!==$.timepicker&&(t=t||{},e.datetimepicker(t),$("body > #ui-datepicker-div").exists()&&$("body > #ui-datepicker-div").wrap('
'))},destroy:function(e){}}),acf.fields.date_time_picker=acf.field.extend({type:"date_time_picker",$el:null,$input:null,$hidden:null,o:{},actions:{ready:"initialize",append:"initialize"},events:{'blur input[type="text"]':"blur"},focus:function(){this.$el=this.$field.find(".acf-date-time-picker"),this.$input=this.$el.find('input[type="text"]'),this.$hidden=this.$el.find('input[type="hidden"]'),this.o=acf.get_data(this.$el)},initialize:function(){var e={dateFormat:this.o.date_format,timeFormat:this.o.time_format,altField:this.$hidden,altFieldTimeOnly:!1,altFormat:"yy-mm-dd",altTimeFormat:"HH:mm:ss",changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.o.first_day,controlType:"select",oneLine:!0};e=acf.apply_filters("date_time_picker_args",e,this.$field),acf.datetimepicker.init(this.$input,e),acf.do_action("date_time_picker_init",this.$input,e,this.$field)},blur:function(){this.$input.val()||this.$hidden.val("")}})}(jQuery),function($){acf.fields.file=acf.field.extend({type:"file",$el:null,$input:null,actions:{ready:"initialize",append:"initialize"},events:{'click a[data-name="add"]':"add",'click a[data-name="edit"]':"edit",'click a[data-name="remove"]':"remove",'change input[type="file"]':"change"},focus:function(){this.$el=this.$field.find(".acf-file-uploader"),this.$input=this.$el.find('input[type="hidden"]'),this.o=acf.get_data(this.$el)},initialize:function(){"basic"==this.o.uploader&&this.$el.closest("form").attr("enctype","multipart/form-data")},prepare:function(e){if(e=e||{},e._valid)return e;var t={url:"",alt:"",title:"",filename:"",filesizeHumanReadable:"",icon:"/wp-includes/images/media/default.png"};return e.id&&(t=e.attributes),t._valid=!0,t},render:function(e){e=this.prepare(e),this.$el.find("img").attr({src:e.icon,alt:e.alt,title:e.title}),this.$el.find('[data-name="title"]').text(e.title),this.$el.find('[data-name="filename"]').text(e.filename).attr("href",e.url),this.$el.find('[data-name="filesize"]').text(e.filesizeHumanReadable);var t="";e.id&&(t=e.id),acf.val(this.$input,t),t?this.$el.addClass("has-value"):this.$el.removeClass("has-value")},add:function(){var e=this,t=this.$field,i=acf.get_closest_field(t,"repeater"),a=acf.media.popup({title:acf._e("file","select"),mode:"select",type:"",field:t.data("key"),multiple:i.exists(),library:this.o.library,mime_types:this.o.mime_types,select:function(a,n){if(n>0){var s=t.data("key"),o=t.closest(".acf-row");if(t=!1,o.nextAll(".acf-row:visible").each(function(){if(t=acf.get_field(s,$(this)))return!!t.find(".acf-file-uploader.has-value").exists()&&void(t=!1)}),!t){if(!(o=acf.fields.repeater.doFocus(i).add()))return!1;t=acf.get_field(s,o)}}e.set("$field",t).render(a)}})},edit:function(){var e=this,t=this.$field,i=this.$input.val();if(i)var a=acf.media.popup({title:acf._e("file","edit"),button:acf._e("file","update"),mode:"edit",attachment:i,select:function(i,a){e.set("$field",t).render(i)}})},remove:function(){var e={};this.render(e)},get_file_info:function(e,t){var i=e.val(),a={};if(!i)return void t.val("");a.url=i;var n=e[0].files;if(n.length){var s=n[0];if(a.size=s.size,a.type=s.type,s.type.indexOf("image")>-1){var o=window.URL||window.webkitURL,r=new Image;r.onload=function(){a.width=this.width,a.height=this.height,t.val(jQuery.param(a))},r.src=o.createObjectURL(s)}}t.val(jQuery.param(a))},change:function(e){this.get_file_info(e.$el,this.$input)}})}(jQuery),function($){acf.fields.google_map=acf.field.extend({type:"google_map",url:"",$el:null,$search:null,timeout:null,status:"",geocoder:!1,map:!1,maps:{},$pending:$(),actions:{ready:"initialize",append:"initialize",show:"show"},events:{'click a[data-name="clear"]':"_clear",'click a[data-name="locate"]':"_locate",'click a[data-name="search"]':"_search","keydown .search":"_keydown","keyup .search":"_keyup","focus .search":"_focus","blur .search":"_blur","mousedown .acf-google-map":"_mousedown"},focus:function(){this.$el=this.$field.find(".acf-google-map"),this.$search=this.$el.find(".search"),this.o=acf.get_data(this.$el),this.o.id=this.$el.attr("id"),this.maps[this.o.id]&&(this.map=this.maps[this.o.id])},is_ready:function(){var e=this;return"ready"==this.status||"loading"!=this.status&&(acf.isset(window,"google","maps","places")?(this.status="ready",!0):(acf.isset(window,"google","maps")&&(this.status="ready"),this.url&&(this.status="loading",acf.enqueue_script(this.url,function(){e.status="ready",e.initialize_pending()})),"ready"==this.status))},initialize_pending:function(){var e=this;this.$pending.each(function(){e.set("$field",$(this)).initialize()}),this.$pending=$()},initialize:function(){if(!this.is_ready())return this.$pending=this.$pending.add(this.$field),!1;this.geocoder||(this.geocoder=new google.maps.Geocoder);var e=this,t=this.$field,i=this.$el;this.$search.val(this.$el.find(".input-address").val());var a=acf.apply_filters("google_map_args",{scrollwheel:!1,zoom:parseInt(this.o.zoom),center:new google.maps.LatLng(this.o.lat,this.o.lng),mapTypeId:google.maps.MapTypeId.ROADMAP},this.$field);if(this.map=new google.maps.Map(this.$el.find(".canvas")[0],a),acf.isset(window,"google","maps","places","Autocomplete")){var n=new google.maps.places.Autocomplete(this.$search[0]);n.bindTo("bounds",this.map),google.maps.event.addListener(n,"place_changed",function(t){var i=this.getPlace();e.search(i)}),this.map.autocomplete=n}var s=acf.apply_filters("google_map_marker_args",{draggable:!0,raiseOnDrag:!0,map:this.map},this.$field);this.map.marker=new google.maps.Marker(s),this.map.$el=i,this.map.$field=t;var o=i.find(".input-lat").val(),r=i.find(".input-lng").val();o&&r&&this.update(o,r).center(),google.maps.event.addListener(this.map.marker,"dragend",function(){var t=this.map.marker.getPosition(),i=t.lat(),a=t.lng();e.update(i,a).sync()}),google.maps.event.addListener(this.map,"click",function(t){var i=t.latLng.lat(),a=t.latLng.lng();e.update(i,a).sync()}),acf.do_action("google_map_init",this.map,this.map.marker,this.$field),this.maps[this.o.id]=this.map},search:function(e){var t=this,i=this.$search.val();if(!i)return!1;this.$el.find(".input-address").val(i);var a=i.split(",");if(2==a.length){var n=a[0],s=a[1];if($.isNumeric(n)&&$.isNumeric(s))return n=parseFloat(n),s=parseFloat(s),void t.update(n,s).center()}if(e&&e.geometry){var n=e.geometry.location.lat(),s=e.geometry.location.lng();return void t.update(n,s).center()}this.$el.addClass("-loading"),t.geocoder.geocode({address:i},function(i,a){if(t.$el.removeClass("-loading"),a!=google.maps.GeocoderStatus.OK)return void console.log("Geocoder failed due to: "+a);if(!i[0])return void console.log("No results found");e=i[0];var n=e.geometry.location.lat(),s=e.geometry.location.lng();t.update(n,s).center()})},update:function(e,t){var i=new google.maps.LatLng(e,t);return acf.val(this.$el.find(".input-lat"),e),acf.val(this.$el.find(".input-lng"),t),this.map.marker.setPosition(i),this.map.marker.setVisible(!0),this.$el.addClass("-value"),this.$field.removeClass("error"),acf.do_action("google_map_change",i,this.map,this.$field),this.$search.blur(),this},center:function(){var e=this.map.marker.getPosition(),t=this.o.lat,i=this.o.lng;e&&(t=e.lat(),i=e.lng());var a=new google.maps.LatLng(t,i);this.map.setCenter(a)},sync:function(){var e=this,t=this.map.marker.getPosition(),i=new google.maps.LatLng(t.lat(),t.lng());return this.$el.addClass("-loading"),this.geocoder.geocode({latLng:i},function(t,i){if(e.$el.removeClass("-loading"),i!=google.maps.GeocoderStatus.OK)return void console.log("Geocoder failed due to: "+i);if(!t[0])return void console.log("No results found");var a=t[0];e.$search.val(a.formatted_address),acf.val(e.$el.find(".input-address"),a.formatted_address)}),this},refresh:function(){if(!this.is_ready())return!1;google.maps.event.trigger(this.map,"resize"),this.center()},show:function(){var e=this,t=this.$field;setTimeout(function(){e.set("$field",t).refresh()},10)},_clear:function(e){this.$el.removeClass("-value -loading -search"),this.$search.val(""),acf.val(this.$el.find(".input-address"),""),acf.val(this.$el.find(".input-lat"),""),acf.val(this.$el.find(".input-lng"),""),this.map.marker.setVisible(!1)},_locate:function(e){var t=this;if(!navigator.geolocation)return alert(acf._e("google_map","browser_support")),this;this.$el.addClass("-loading"),navigator.geolocation.getCurrentPosition(function(e){t.$el.removeClass("-loading");var i=e.coords.latitude,a=e.coords.longitude;t.update(i,a).sync().center()})},_search:function(e){this.search()},_focus:function(e){this.$el.removeClass("-value"),this._keyup()},_blur:function(e){var t=this,i=this.$el.find(".input-address").val();i&&(this.timeout=setTimeout(function(){t.$el.addClass("-value"),t.$search.val(i)},100))},_keydown:function(e){13==e.which&&e.preventDefault()},_keyup:function(e){this.$search.val()?this.$el.addClass("-search"):this.$el.removeClass("-search")},_mousedown:function(e){var t=this;setTimeout(function(){clearTimeout(t.timeout)},1)}})}(jQuery),function($){acf.fields.image=acf.field.extend({type:"image",$el:null,$input:null,$img:null,actions:{ready:"initialize",append:"initialize"},events:{'click a[data-name="add"]':"add",'click a[data-name="edit"]':"edit",'click a[data-name="remove"]':"remove",'change input[type="file"]':"change"},focus:function(){this.$el=this.$field.find(".acf-image-uploader"),this.$input=this.$el.find('input[type="hidden"]'),this.$img=this.$el.find("img"),this.o=acf.get_data(this.$el)},initialize:function(){"basic"==this.o.uploader&&this.$el.closest("form").attr("enctype","multipart/form-data")},prepare:function(e){if(e=e||{},e._valid)return e;var t={url:"",alt:"",title:"",caption:"",description:"",width:0,height:0};return e.id&&(t=e.attributes,t.url=acf.maybe_get(t,"sizes."+this.o.preview_size+".url",t.url)),t._valid=!0,t},render:function(e){e=this.prepare(e),this.$img.attr({src:e.url,alt:e.alt,title:e.title});var t="";e.id&&(t=e.id),acf.val(this.$input,t),t?this.$el.addClass("has-value"):this.$el.removeClass("has-value")},add:function(){var e=this,t=this.$field,i=acf.get_closest_field(this.$field,"repeater"),a=acf.media.popup({title:acf._e("image","select"),mode:"select",type:"image",field:t.data("key"),multiple:i.exists(),library:this.o.library,mime_types:this.o.mime_types,select:function(a,n){if(n>0){var s=t.data("key"),o=t.closest(".acf-row");if(t=!1,o.nextAll(".acf-row:visible").each(function(){if(t=acf.get_field(s,$(this)))return!!t.find(".acf-image-uploader.has-value").exists()&&void(t=!1)}),!t){if(!(o=acf.fields.repeater.doFocus(i).add()))return!1;t=acf.get_field(s,o)}}e.set("$field",t).render(a)}})},edit:function(){var e=this,t=this.$field,i=this.$input.val();if(i)var a=acf.media.popup({title:acf._e("image","edit"),button:acf._e("image","update"),mode:"edit",attachment:i,select:function(i,a){e.set("$field",t).render(i)}})},remove:function(){var e={};this.render(e)},change:function(e){acf.fields.file.get_file_info(e.$el,this.$input)}})}(jQuery),function($){acf.fields.link=acf.field.extend({type:"link",active:!1,$el:null,$node:null,events:{'click a[data-name="add"]':"add",'click a[data-name="edit"]':"edit",'click a[data-name="remove"]':"remove","change .link-node":"change"},focus:function(){this.$el=this.$field.find(".acf-link"),this.$node=this.$el.find(".link-node")},add:function(e){acf.link.open(this.$node)},edit:function(e){this.add()},remove:function(e){this.val("")},change:function(e,t){var i={title:this.$node.html(),url:this.$node.attr("href"),target:this.$node.attr("target")};this.val(i)},val:function(e){e=acf.parse_args(e,{title:"",url:"",target:""}),this.$el.removeClass("-value -external"),e.url&&this.$el.addClass("-value"),"_blank"===e.target&&this.$el.addClass("-external"),this.$el.find(".link-title").html(e.title),this.$el.find(".link-url").attr("href",e.url).html(e.url),this.$el.find(".input-title").val(e.title),this.$el.find(".input-target").val(e.target),this.$el.find(".input-url").val(e.url).trigger("change"),this.$node.html(e.title),this.$node.attr("href",e.url),this.$node.attr("target",e.target)}}),acf.link=acf.model.extend({active:!1,$textarea:null,$node:null,events:{"click #wp-link-submit":"_update","wplink-open":"_open","wplink-close":"_close"},atts:function(e){return void 0!==e?(this.$node.html(e.title),this.$node.attr("href",e.url),this.$node.attr("target",e.target),this.$node.trigger("change",[e]),!0):{title:this.$node.html(),url:this.$node.attr("href"),target:this.$node.attr("target")}},inputs:function(e){return void 0!==e?($("#wp-link-text").val(e.title),$("#wp-link-url").val(e.url),$("#wp-link-target").prop("checked","_blank"===e.target),!0):{title:$("#wp-link-text").val(),url:$("#wp-link-url").val(),target:$("#wp-link-target").prop("checked")?"_blank":""}},open:function(e){var t=$('');e.before(t),this.active=!0,this.$node=e,this.$textarea=t;var i=this.atts();wpLink.open("acf-link-textarea",i.url,i.title,null),$("#wp-link-wrap").addClass("has-text-field")},reset:function(){this.active=!1,this.$textarea.remove(),this.$textarea=null,this.$node=null},_select:function(e,t){var i=this.inputs();i.title||(i.title=t.find(".item-title").text(),this.inputs(i),console.log(i))},_open:function(e){if(this.active){var t=this.atts();this.inputs(t)}},_close:function(e){this.active&&setTimeout(function(){acf.link.reset()},100)},_update:function(e){if(this.active){var t=this.inputs();this.atts(t)}}})}(jQuery),function($){acf.media=acf.model.extend({frames:[],mime_types:{},actions:{ready:"ready"},frame:function(){var e=this.frames.length-1;return!(e<0)&&this.frames[e]},destroy:function(e){e.detach(),e.dispose(),e=null,this.frames.pop()},popup:function(e){var t=acf.get("post_id"),i=!1;$.isNumeric(t)||(t=0);var a=acf.parse_args(e,{mode:"select",title:"",button:"",type:"",field:"",mime_types:"",library:"all",multiple:!1,attachment:0,post_id:t,select:function(){}});a.id&&(a.attachment=a.id);var i=this.new_media_frame(a);return this.frames.push(i),setTimeout(function(){i.open()},1),i},_get_media_frame_settings:function(e,t){return"select"===t.mode?e=this._get_select_frame_settings(e,t):"edit"===t.mode&&(e=this._get_edit_frame_settings(e,t)),e},_get_select_frame_settings:function(e,t){return t.type&&(e.library.type=t.type),"uploadedTo"===t.library&&(e.library.uploadedTo=t.post_id),e._button=acf._e("media","select"),e},_get_edit_frame_settings:function(e,t){return e.library.post__in=[t.attachment],e._button=acf._e("media","update"),e},_add_media_frame_events:function(e,t){return e.on("open",function(){this.$el.closest(".media-modal").addClass("acf-media-modal -"+t.mode)},e),e.on("content:render:edit-image",function(){var e=this.state().get("image"),t=new wp.media.view.EditImage({model:e,controller:this}).render();this.content.set(t),t.loadEditor()},e),e.on("toolbar:create:select",function(t){t.view=new wp.media.view.Toolbar.Select({text:e.options._button,controller:this})},e),e.on("select",function(){var i=e.state(),a=i.get("image"),n=i.get("selection");if(a)return void t.select.apply(e,[a,0]);if(n){var s=0;return void n.each(function(i){t.select.apply(e,[i,s]),s++})}}),e.on("close",function(){setTimeout(function(){acf.media.destroy(e)},500)}),"select"===t.mode?e=this._add_select_frame_events(e,t):"edit"===t.mode&&(e=this._add_edit_frame_events(e,t)),e},_add_select_frame_events:function(e,t){var i=this;return acf.isset(_wpPluploadSettings,"defaults","multipart_params")&&(_wpPluploadSettings.defaults.multipart_params._acfuploader=t.field,e.on("open",function(){delete _wpPluploadSettings.defaults.multipart_params._acfuploader})),e.on("content:activate:browse",function(){try{var a=e.content.get().toolbar,n=a.get("filters"),s=a.get("search")}catch(e){return}if("image"==t.type&&(n.filters.all.text=acf._e("image","all"),delete n.filters.audio,delete n.filters.video,$.each(n.filters,function(e,t){null===t.props.type&&(t.props.type="image")})),t.mime_types){var o=t.mime_types.split(" ").join("").split(".").join("").split(",");$.each(o,function(e,t){$.each(i.mime_types,function(e,i){if(-1!==e.indexOf(t)){var a={text:t,props:{status:null,type:i,uploadedTo:null,orderby:"date",order:"DESC"},priority:20};n.filters[i]=a}})})}"uploadedTo"==t.library&&(delete n.filters.unattached,delete n.filters.uploaded,n.$el.parent().append(''+acf._e("image","uploadedTo")+" "),$.each(n.filters,function(e,i){i.props.uploadedTo=t.post_id})),$.each(n.filters,function(e,i){i.props._acfuploader=t.field}),s.model.attributes._acfuploader=t.field,"function"==typeof n.refresh&&n.refresh()}),e},_add_edit_frame_events:function(e,t){return e.on("open",function(){this.$el.closest(".media-modal").addClass("acf-expanded"),"browse"!=this.content.mode()&&this.content.mode("browse");var e=this.state(),i=e.get("selection"),a=wp.media.attachment(t.attachment);i.add(a)},e),e},new_media_frame:function(e){var t={title:e.title,multiple:e.multiple,library:{},states:[]};t=this._get_media_frame_settings(t,e);var i=wp.media.query(t.library);acf.isset(i,"mirroring","args")&&(i.mirroring.args._acfuploader=e.field),t.states=[new wp.media.controller.Library({library:i,multiple:t.multiple,title:t.title,priority:20,filterable:"all",editable:!0,allowLocalEdits:!0})],acf.isset(wp,"media","controller","EditImage")&&t.states.push(new wp.media.controller.EditImage);var a=wp.media(t);return a.acf=e,a=this._add_media_frame_events(a,e)},ready:function(){var e=acf.get("wp_version"),t=acf.get("browser"),i=acf.get("post_id");acf.isset(window,"wp","media","view","settings","post")&&$.isNumeric(i)&&(wp.media.view.settings.post.id=i),t&&$("body").addClass("browser-"+t),e&&(e+="",major=e.substr(0,1),$("body").addClass("major-"+major)),acf.isset(window,"wp","media","view")&&(this.customize_Attachment(),this.customize_AttachmentFiltersAll(),this.customize_AttachmentCompat())},customize_Attachment:function(){var e=wp.media.view.Attachment.Library;wp.media.view.Attachment.Library=e.extend({render:function(){var t=acf.media.frame(),i=acf.maybe_get(this,"model.attributes.acf_errors");return t&&i&&this.$el.addClass("acf-disabled"),e.prototype.render.apply(this,arguments)},toggleSelection:function(t){var i=this.collection,a=this.options.selection,n=this.model,s=a.single(),o=acf.media.frame(),r=acf.maybe_get(this,"model.attributes.acf_errors"),l=this.controller.$el.find(".media-frame-content .media-sidebar");if(l.children(".acf-selection-error").remove(),l.children().removeClass("acf-hidden"),o&&r){var c=acf.maybe_get(this,"model.attributes.filename","");return l.children().addClass("acf-hidden"),l.prepend(['',''+acf._e("restricted")+" ",''+c+" ",''+r+" ","
"].join("")),a.reset(),void a.single(n)}e.prototype.toggleSelection.apply(this,arguments)}})},customize_AttachmentFiltersAll:function(){wp.media.view.AttachmentFilters.All.prototype.refresh=function(){this.$el.html(_.chain(this.filters).map(function(e,t){return{el:$(" ").val(t).html(e.text)[0],priority:e.priority||50}},this).sortBy("priority").pluck("el").value())}},customize_AttachmentCompat:function(){var e=wp.media.view.AttachmentCompat;wp.media.view.AttachmentCompat=e.extend({add_acf_expand_button:function(){var e=this.$el.closest(".media-modal");if(!e.find(".media-frame-router .acf-expand-details").exists()){var t=$(['',' '+acf._e("expand_details")+" ",' '+acf._e("collapse_details")+" "," "].join(""));t.on("click",function(t){t.preventDefault(),e.hasClass("acf-expanded")?e.removeClass("acf-expanded"):e.addClass("acf-expanded")}),e.find(".media-frame-router").append(t)}},render:function(){if(this.ignore_render)return this;var t=this;return setTimeout(function(){t.add_acf_expand_button()},0),clearTimeout(acf.media.render_timout),acf.media.render_timout=setTimeout(function(){acf.do_action("append",t.$el)},50),e.prototype.render.apply(this,arguments)},dispose:function(){return acf.do_action("remove",this.$el),e.prototype.dispose.apply(this,arguments)},save:function(e){e&&e.preventDefault();var t=acf.serialize(this.$el);this.ignore_render=!0,this.model.saveCompat(t)}})}})}(jQuery),function($){acf.fields.oembed=acf.field.extend({type:"oembed",$el:null,events:{'click [data-name="search-button"]':"_search",'click [data-name="clear-button"]':"_clear",'click [data-name="value-title"]':"_edit",'keypress [data-name="search-input"]':"_keypress",'keyup [data-name="search-input"]':"_keyup",'blur [data-name="search-input"]':"_blur"},focus:function(){this.$el=this.$field.find(".acf-oembed"),this.$search=this.$el.find('[data-name="search-input"]'),this.$input=this.$el.find('[data-name="value-input"]'),this.$title=this.$el.find('[data-name="value-title"]'),this.$embed=this.$el.find('[data-name="value-embed"]'),this.o=acf.get_data(this.$el)},maybe_search:function(){var e=this.$input.val(),t=this.$search.val();if(!t)return void this.clear();t!=e&&this.search()},search:function(){var e=this.$search.val();"http"!=e.substr(0,4)&&(e="http://"+e,this.$search.val(e)),this.$el.addClass("is-loading");var t=acf.prepare_for_ajax({action:"acf/fields/oembed/search",s:e,field_key:this.$field.data("key")});this.$el.data("xhr")&&this.$el.data("xhr").abort();var i=$.ajax({url:acf.get("ajaxurl"),data:t,type:"post",dataType:"json",context:this,success:this.search_success});this.$el.data("xhr",i)},search_success:function(e){var t=this.$search.val();if(this.$el.removeClass("is-loading"),!e||!e.html)return void this.$el.removeClass("has-value").addClass("has-error");this.$el.removeClass("has-error").addClass("has-value"),this.$input.val(t),this.$title.html(t),this.$embed.html(e.html)},clear:function(){this.$el.removeClass("has-error has-value"),this.$el.find('[data-name="search-input"]').val(""),this.$input.val(""),this.$title.html(""),this.$embed.html("")},edit:function(){this.$el.addClass("is-editing"),this.$search.val(this.$title.text()).focus()},blur:function(e){this.$el.removeClass("is-editing"),this.maybe_search()},_search:function(e){this.search()},_clear:function(e){this.clear()},_edit:function(e){this.edit()},_keypress:function(e){13==e.which&&e.preventDefault()},_keyup:function(e){this.$search.val()&&this.maybe_search()},_blur:function(e){this.blur()}})}(jQuery),function($){acf.fields.radio=acf.field.extend({type:"radio",$ul:null,actions:{ready:"initialize",append:"initialize"},events:{'click input[type="radio"]':"click"},focus:function(){this.$ul=this.$field.find(".acf-radio-list"),this.o=acf.get_data(this.$ul)},initialize:function(){this.$ul.find(".selected input").prop("checked",!0)},click:function(e){var t=e.$el,i=t.parent("label"),a=i.hasClass("selected"),n=t.val();if(this.$ul.find(".selected").removeClass("selected"),i.addClass("selected"),this.o.allow_null&&a&&(e.$el.prop("checked",!1),i.removeClass("selected"),n=!1,e.$el.trigger("change")),this.o.other_choice){var s=this.$ul.find('input[type="text"]');"other"===n?s.prop("disabled",!1).attr("name",t.attr("name")):s.prop("disabled",!0).attr("name","")}}})}(jQuery),function($){acf.fields.range=acf.field.extend({type:"range",$el:null,$range:null,$input:null,events:{"input input":"_change","change input":"_change"},focus:function(){this.$el=this.$field.find(".acf-range-wrap"),this.$range=this.$el.children('input[type="range"]'),this.$input=this.$el.children('input[type="number"]')},_change:function(e){var t=e.$el.val(),i=e.$el.attr("type");t=t||0,"range"===i?this.$input.val(t):this.$range.val(t)}})}(jQuery),function($){acf.fields.relationship=acf.field.extend({type:"relationship",$el:null,$input:null,$filters:null,$choices:null,$values:null,actions:{ready:"initialize",append:"initialize"},events:{"keypress [data-filter]":"submit_filter","change [data-filter]":"change_filter","keyup [data-filter]":"change_filter","click .choices .acf-rel-item":"add_item",'click [data-name="remove_item"]':"remove_item"},focus:function(){this.$el=this.$field.find(".acf-relationship"),this.$input=this.$el.children('input[type="hidden"]'),this.$choices=this.$el.find(".choices"),this.$values=this.$el.find(".values"),this.o=acf.get_data(this.$el)},initialize:function(){var e=this,t=this.$field,i=this.$el,a=this.$input;this.$values.children(".list").sortable({items:"li",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,update:function(){a.trigger("change")}}),this.$choices.children(".list").scrollTop(0).on("scroll",function(a){if(!i.hasClass("is-loading")&&!i.hasClass("is-empty")&&Math.ceil($(this).scrollTop())+$(this).innerHeight()>=$(this).get(0).scrollHeight){var n=i.data("paged")||1;i.data("paged",n+1),e.set("$field",t).fetch()}}),this.fetch()},maybe_fetch:function(){var e=this,t=this.$field;this.o.timeout&&clearTimeout(this.o.timeout);var i=setTimeout(function(){e.doFocus(t),e.fetch()},300);this.$el.data("timeout",i)},fetch:function(){var e=this,t=this.$field;this.$el.addClass("is-loading"),this.o.xhr&&(this.o.xhr.abort(),this.o.xhr=!1),this.o.action="acf/fields/relationship/query",this.o.field_key=t.data("key"),this.o.post_id=acf.get("post_id");var i=acf.prepare_for_ajax(this.o);1==i.paged&&this.$choices.children(".list").html(""),this.$choices.find("ul:last").append(' '+acf._e("relationship","loading")+"
");var a=$.ajax({url:acf.get("ajaxurl"),dataType:"json",type:"post",data:i,success:function(i){e.set("$field",t).render(i)}});this.$el.data("xhr",a)},render:function(e){if(this.$el.removeClass("is-loading is-empty"),this.$choices.find("p").remove(),!e||!e.results||!e.results.length)return this.$el.addClass("is-empty"),void(1==this.o.paged&&this.$choices.children(".list").append(""+acf._e("relationship","empty")+"
"));var t=$(this.walker(e.results));this.$values.find(".acf-rel-item").each(function(){t.find('.acf-rel-item[data-id="'+$(this).data("id")+'"]').addClass("disabled")}),this.$choices.children(".list").append(t);var i="",a=null;this.$choices.find(".acf-rel-label").each(function(){if($(this).text()==i)return a.append($(this).siblings("ul").html()),void $(this).parent().remove();i=$(this).text(),a=$(this).siblings("ul")})},walker:function(e){var t="";if($.isArray(e))for(var i in e)t+=this.walker(e[i]);else $.isPlainObject(e)&&(void 0!==e.children?(t+=''+e.text+' ',t+=this.walker(e.children),t+=" "):t+=''+e.text+" ");return t},submit_filter:function(e){13==e.which&&e.preventDefault()},change_filter:function(e){var t=e.$el.val(),i=e.$el.data("filter");this.$el.data(i)!=t&&(this.$el.data(i,t),this.$el.data("paged",1),e.$el.is("select")?this.fetch():this.maybe_fetch())},add_item:function(e){if(this.o.max>0&&this.$values.find(".acf-rel-item").length>=this.o.max)return void alert(acf._e("relationship","max").replace("{max}",this.o.max));if(e.$el.hasClass("disabled"))return!1;e.$el.addClass("disabled");var t=["",' ',''+e.$el.html(),' '," "," "].join("");this.$values.children(".list").append(t),this.$input.trigger("change"),acf.validation.remove_error(this.$field)},remove_item:function(e){var t=e.$el.parent(),i=t.data("id");t.parent("li").remove(),this.$choices.find('.acf-rel-item[data-id="'+i+'"]').removeClass("disabled"),this.$input.trigger("change")}})}(jQuery),function($){var e,t,i;e=acf.select2=acf.model.extend({version:0,version3:null,version4:null,actions:{"ready 1":"ready"},ready:function(){this.version=this.get_version(),this.do_function("ready")},get_version:function(){return acf.maybe_get(window,"Select2")?3:acf.maybe_get(window,"jQuery.fn.select2.amd")?4:0},do_function:function(e,t){t=t||[];var i="version"+this.version;return void 0!==this[i]&&void 0!==this[i][e]&&this[i][e].apply(this,t)},get_data:function(e,t){var i=this;return t=t||[],e.children().each(function(){var e=$(this);e.is("optgroup")?t.push({text:e.attr("label"),children:i.get_data(e)}):t.push({id:e.attr("value"),text:e.text()})}),t},decode_data:function(t){return t?($.each(t,function(i,a){t[i].text=acf.decode(a.text),void 0!==a.children&&(t[i].children=e.decode_data(a.children))}),t):[]},count_data:function(e){var t=0;return e?($.each(e,function(e,i){t++,void 0!==i.children&&(t+=i.children.length)}),t):t},get_ajax_data:function(e,t,i,a){var n=acf.prepare_for_ajax({action:e.ajax_action,field_key:e.key,s:t.term||"",paged:t.page||1});return n=acf.apply_filters("select2_ajax_data",n,e,i,a)},get_ajax_results:function(e,t){var i={results:[]};return e||(e=i),void 0===e.results&&(i.results=e,e=i),e.results=this.decode_data(e.results),e=acf.apply_filters("select2_ajax_results",e,t)},get_value:function(e){var t=[],i=e.find("option:selected");return i.exists()?(i=i.sort(function(e,t){return+e.getAttribute("data-i")-+t.getAttribute("data-i")}),i.each(function(){var e=$(this);t.push({id:e.attr("value"),text:e.text(),$el:e})}),t):t},get_input_value:function(e){return e.val().split("||")},sync_input_value:function(e,t){e.val(t.val().join("||"))},add_option:function(e,t,i){e.find('option[value="'+t+'"]').length||e.append(''+i+" ")},select_option:function(e,t){e.find('option[value="'+t+'"]').prop("selected",!0),e.trigger("change")},unselect_option:function(e,t){e.find('option[value="'+t+'"]').prop("selected",!1),e.trigger("change")},init:function(e,t,i){this.do_function("init",arguments)},destroy:function(e){this.do_function("destroy",arguments)},add_value:function(e,t,i){this.do_function("add_value",arguments)},remove_value:function(e,t){this.do_function("remove_value",arguments)}}),t=e.version3={ready:function(){var e=acf.get("locale"),t=acf.get("rtl");if(l10n=acf._e("select"),l10n){var i={formatMatches:function(e){return 1===e?l10n.matches_1:l10n.matches_n.replace("%d",e)},formatNoMatches:function(){return l10n.matches_0},
+formatAjaxError:function(){return l10n.load_fail},formatInputTooShort:function(e,t){var i=t-e.length;return 1===i?l10n.input_too_short_1:l10n.input_too_short_n.replace("%d",i)},formatInputTooLong:function(e,t){var i=e.length-t;return 1===i?l10n.input_too_long_1:l10n.input_too_long_n.replace("%d",i)},formatSelectionTooBig:function(e){return 1===e?l10n.selection_too_long_1:l10n.selection_too_long_n.replace("%d",e)},formatLoadMore:function(){return l10n.load_more},formatSearching:function(){return l10n.searching}};$.fn.select2.locales=acf.maybe_get(window,"jQuery.fn.select2.locales",{}),$.fn.select2.locales[e]=i,$.extend($.fn.select2.defaults,i)}},set_data:function(e,t){3==this.version&&(e=e.siblings("input")),e.select2("data",t)},append_data:function(e,t){3==this.version&&(e=e.siblings("input"));var i=e.select2("data")||[];i.push(t),e.select2("data",i)},init:function(i,a,n){a=a||{},n=n||null,a=$.extend({allow_null:!1,placeholder:"",multiple:!1,ajax:!1,ajax_action:""},a);var s=i.siblings("input");if(s.exists()){var o={width:"100%",containerCssClass:"-acf",allowClear:a.allow_null,placeholder:a.placeholder,multiple:a.multiple,separator:"||",data:[],escapeMarkup:function(e){return e},formatResult:function(e,t,i,a){var n=$.fn.select2.defaults.formatResult(e,t,i,a);return e.description&&(n+=' '+e.description+" "),n}},r=this.get_value(i);if(a.multiple){var l=i.attr("name");o.formatSelection=function(e,t){var i=' ";return t.parent().append(i),e.text}}else r=acf.maybe_get(r,0,!1),!a.allow_null&&r&&s.val(r.id);a.allow_null&&i.find('option[value=""]').remove(),o.data=this.get_data(i),o.initSelection=function(e,t){t(r)},a.ajax&&(o.ajax={url:acf.get("ajaxurl"),dataType:"json",type:"post",cache:!1,quietMillis:250,data:function(t,i){var o={term:t,page:i};return e.get_ajax_data(a,o,s,n)},results:function(i,a){var n={page:a};return setTimeout(function(){t.merge_results()},1),e.get_ajax_results(i,n)}}),o.dropdownCss={"z-index":"999999999"},o.acf=a,o=acf.apply_filters("select2_args",o,i,a,n),s.select2(o);var c=s.select2("container");c.before(i),c.before(s),a.multiple&&c.find("ul.select2-choices").sortable({start:function(){s.select2("onSortStart")},stop:function(){s.select2("onSortEnd")}}),i.prop("disabled",!0).addClass("acf-disabled acf-hidden"),s.on("change",function(t){t.added&&e.add_option(i,t.added.id,t.added.text),e.select_option(i,t.val)}),acf.do_action("select2_init",s,o,a,n)}},merge_results:function(){var e="",t=null;$("#select2-drop .select2-result-with-children").each(function(){var i=$(this).children(".select2-result-label"),a=$(this).children(".select2-result-sub");if(i.text()==e)return t.append(a.children()),void $(this).remove();e=i.text(),t=a})},destroy:function(e){var t=e.siblings("input");t.data("select2")&&t.select2("destroy"),e.siblings(".select2-container").remove(),e.prop("disabled",!1).removeClass("acf-disabled acf-hidden"),t.attr("style","")},add_value:function(t,i,a){e.add_option(t,i,a),e.select_option(t,i);var n=t.siblings("input"),s={id:i,text:a};if(!t.data("multiple"))return n.select2("data",s);var o=n.select2("data")||[];return o.push(s),n.select2("data",o)},remove_value:function(t,i){e.unselect_option(t,i);var a=t.siblings("input"),n=a.select2("data");t.data("multiple")?(n=$.grep(n,function(e){return e.id!=i}),a.select2("data",n)):n&&n.id==i&&a.select2("data",null)}},i=e.version4={init:function(t,a,n){a=a||{},n=n||null,a=$.extend({allow_null:!1,placeholder:"",multiple:!1,ajax:!1,ajax_action:""},a);var s=t.siblings("input");if(s.exists()){var o={width:"100%",allowClear:a.allow_null,placeholder:a.placeholder,multiple:a.multiple,separator:"||",data:[],escapeMarkup:function(e){return e}},r=this.get_value(t);a.multiple?$.each(r,function(e,i){i.$el.detach().appendTo(t)}):r=acf.maybe_get(r,0,""),a.ajax?o.ajax={url:acf.get("ajaxurl"),delay:250,dataType:"json",type:"post",cache:!1,data:function(i){return e.get_ajax_data(a,i,t,n)},processResults:function(t,a){var n=e.get_ajax_results(t,a);return n.more&&(n.pagination={more:!0}),setTimeout(function(){i.merge_results()},1),n}}:(t.removeData("ajax"),t.removeAttr("data-ajax")),o=acf.apply_filters("select2_args",o,t,a,n),t.select2(o);var l=t.next(".select2-container");if(a.multiple){var c=l.find("ul");c.sortable({stop:function(e){c.find(".select2-selection__choice").each(function(){$($(this).data("data").element).detach().appendTo(t),s.trigger("change")})}}),t.on("select2:select",function(e){$(e.params.data.element).detach().appendTo(t)})}s.val(""),l.addClass("-acf"),acf.do_action("select2_init",t,o,a,n)}},merge_results:function(){var e=null,t=null;$('.select2-results__option[role="group"]').each(function(){var i=$(this).children("ul"),a=$(this).children("strong");if(null!==t&&a.text()==t.text())return e.append(i.children()),void $(this).remove();e=i,t=a})},add_value:function(t,i,a){e.add_option(t,i,a),e.select_option(t,i)},remove_value:function(t,i){e.unselect_option(t,i)},destroy:function(e){e.data("select2")&&e.select2("destroy"),e.siblings(".select2-container").remove()}},acf.add_select2=function(t,i){e.init(t,i)},acf.remove_select2=function(t){e.destroy(t)}}(jQuery),function($){acf.fields.select=acf.field.extend({type:"select",$select:null,actions:{ready:"render",append:"render",remove:"remove"},focus:function(){this.$select=this.$field.find("select"),this.$select.exists()&&(this.o=acf.get_data(this.$select),this.o=acf.parse_args(this.o,{ajax_action:"acf/fields/"+this.type+"/query",key:this.$field.data("key")}))},render:function(){if(!this.$select.exists()||!this.o.ui)return!1;acf.select2.init(this.$select,this.o,this.$field)},remove:function(){if(!this.$select.exists()||!this.o.ui)return!1;acf.select2.destroy(this.$select)}}),acf.fields.user=acf.fields.select.extend({type:"user"}),acf.fields.post_object=acf.fields.select.extend({type:"post_object"}),acf.fields.page_link=acf.fields.select.extend({type:"page_link"})}(jQuery),function($,e){var t=0;acf.fields.accordion=acf.field.extend({type:"accordion",$el:null,$wrap:null,actions:{prepare:"initialize",append:"initialize"},focus:function(){},initialize:function(){var e=this.$field,i=e.children(".acf-label"),a=e.children(".acf-input"),n=a.children(".acf-fields"),s=n.data();if(!e.is("td")){if(s.endpoint)return void e.remove();var o=a.children(".description");if(o.length&&i.append(o),e.is("tr")){var r=e.closest("table"),l=$('
'),c=$('
'),d=$(''),f=$(" ");l.append(i.html()),d.append(f),c.append(d),a.append(l),a.append(c),i.remove(),n.remove(),a.attr("colspan",2),i=l,a=c,n=f}e.addClass("acf-accordion"),i.addClass("acf-accordion-title"),a.addClass("acf-accordion-content"),t++,s.multi_expand&&e.data("multi-expand",1);var u=acf.getPreference("this.accordions")||[];void 0!==u[t-1]&&(s.open=u[t-1]),s.open&&(e.addClass("-open"),a.css("display","block")),i.prepend(' ');var h=e.parent();n.addClass(h.hasClass("-left")?"-left":""),n.addClass(h.hasClass("-clear")?"-clear":""),n.append(e.nextUntil(".acf-field-accordion",".acf-field")),n.removeAttr("data-open data-multi_expand data-endpoint")}}});var i=acf.model.extend({events:{"click .acf-accordion-title":"_click"},_click:function(e){e.preventDefault(),this.toggle(e.$el.closest(".acf-accordion"))},isOpen:function(e){return e.hasClass("-open")},toggle:function(e){this.isOpen(e)?this.close(e):this.open(e)},open:function(e){e.find(".acf-accordion-content:first").slideDown().css("display","block"),e.find(".acf-accordion-icon:first").removeClass("dashicons-arrow-right").addClass("dashicons-arrow-down"),e.addClass("-open"),acf.do_action("show",e),e.data("multi-expand")||e.siblings(".acf-accordion.-open").each(function(){i.close($(this))}),acf.do_action("refresh",e)},close:function(e){e.find(".acf-accordion-content:first").slideUp(),e.find(".acf-accordion-icon:first").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-right"),e.removeClass("-open"),acf.do_action("hide",e)}});$(window).on("unload",function(){var e=[];$(".acf-accordion").each(function(){var t=$(this).hasClass("-open")?1:0;e.push(t)}),e.length&&acf.setPreference("this.accordions",e)});var a=acf.model.extend({active:1,events:{"invalidField .acf-accordion":"invalidField"},invalidField:function(e){this.active&&(this.block(),i.open(e.$el))},block:function(){var e=this;this.active=0,setTimeout(function(){e.active=1},1e3)}})}(jQuery),function($){var e="hidden-by-conditional-logic",t=0,i=0,a=acf.model.extend({$fields:[],actions:{"prepare 15":"initialize","append 15":"initialize","refresh 15":"refresh"},events:{"click .acf-tab-button":"_click"},_click:function(e){e.preventDefault(),this.toggle(e.$el)},isOpen:function(e){return e.hasClass("-open")},toggle:function(e){var t=e.data("key"),i=e.parent(),a=e.closest(".acf-tab-wrap"),n=a.find(".active a"),s=a.siblings('.acf-field[data-key="'+t+'"]');if(!this.isOpen(s)){if(n.length){var o=n.data("key"),r=n.parent(),l=a.siblings('.acf-field[data-key="'+o+'"]');r.removeClass("active"),this.close(l)}i.addClass("active"),this.open(s),acf.do_action("refresh",a.parent())}},getFields:function(e){return e.nextUntil(".acf-field-tab",".acf-field")},getWrap:function(e){return e.prevAll(".acf-tab-wrap:first")},getTab:function(e,t){return e.find('a[data-key="'+t+'"]')},open:function(e){this.getFields(e).each(function(){$(this).removeClass("hidden-by-tab"),acf.do_action("show_field",$(this),"tab")})},close:function(e){this.getFields(e).each(function(){$(this).addClass("hidden-by-tab"),acf.do_action("hide_field",$(this),"tab")})},addTab:function(e){this.$fields.push(e)},initialize:function(){if(this.$fields.length){for(var e=0;e").append(o);return l?(c.addClass("active"),this.open(e)):this.close(e),""==o.html()&&c.hide(),s.find("ul").append(c),i++,((acf.getPreference("this.tabs")||[])[t-1]||0)!=i-1||l||this.toggle(o),c},createTabWrap:function(e,a){var n=e.parent(),s=!1;return n.hasClass("acf-fields")&&"left"==a.placement&&n.addClass("-sidebar"),s=$(e.is("tr")?' ':''),e.before(s),t++,i=0,s},refresh:function(e){$(".acf-tab-wrap",e).each(function(){var e=$(this);if(e.hasClass("-left")){var t=e.parent(),i=t.is("td")?"height":"min-height",a=e.position().top+e.children("ul").outerHeight(!0)-1;t.css(i,a)}})}});acf.fields.tab=acf.field.extend({type:"tab",$el:null,$wrap:null,actions:{prepare:"initialize",append:"initialize",hide:"hide",show:"show"},focus:function(){},initialize:function(){a.addTab(this.$field)},hide:function(t,i){if("conditional_logic"==i){var n=t.data("key"),s=a.getWrap(t),o=a.getTab(s,n),r=o.parent();s.exists()&&(r.addClass(e),a.getFields(t).each(function(){acf.conditional_logic.hide_field($(this))}),r.hasClass("active")&&s.find("li:not(."+e+"):first a").trigger("click"))}},show:function(t,i){if("conditional_logic"==i){var n=t.data("key"),s=a.getWrap(t),o=a.getTab(s,n),r=o.parent();if(s.exists()){r.removeClass(e),a.getFields(t).each(function(){acf.conditional_logic.show_field($(this))});var l=r.siblings(".active");l.exists()&&!l.hasClass(e)||a.toggle(o)}}}}),$(window).on("unload",function(){var e=[];$(".acf-tab-wrap").each(function(){var t=$(this).find(".active").index()||0;e.push(t)}),e.length&&acf.setPreference("this.tabs",e)});var n=acf.model.extend({active:1,actions:{invalid_field:"invalid_field"},invalid_field:function(e){if(this.active&&e.hasClass("hidden-by-tab")){var t=this,i=e.prevAll(".acf-field-tab:first");e.prevAll(".acf-tab-wrap:first").find('a[data-key="'+i.data("key")+'"]').trigger("click"),this.active=0,setTimeout(function(){t.active=1},1e3)}}})}(jQuery),function($){acf.fields.time_picker=acf.field.extend({type:"time_picker",$el:null,$input:null,$hidden:null,o:{},actions:{ready:"initialize",append:"initialize"},events:{'blur input[type="text"]':"blur"},focus:function(){this.$el=this.$field.find(".acf-time-picker"),this.$input=this.$el.find('input[type="text"]'),this.$hidden=this.$el.find('input[type="hidden"]'),this.o=acf.get_data(this.$el)},initialize:function(){if(void 0!==$.timepicker){var e={timeFormat:this.o.time_format,altField:this.$hidden,altFieldTimeOnly:!1,altTimeFormat:"HH:mm:ss",showButtonPanel:!0,controlType:"select",oneLine:!0,closeText:acf._e("date_time_picker","selectText")};e.onClose=function(e,t){var i=t.dpDiv,a=i.find(".ui-datepicker-close");if(!e&&a.is(":hover")){if(!(e=acf.maybe_get(t,"settings.timepicker.formattedTime")))return;$.datepicker._setTime(t)}},e=acf.apply_filters("time_picker_args",e,this.$field),this.$input.timepicker(e),$("body > #ui-datepicker-div").exists()&&$("body > #ui-datepicker-div").wrap('
'),acf.do_action("time_picker_init",this.$input,e,this.$field)}},blur:function(){this.$input.val()||this.$hidden.val("")}})}(jQuery),function($){acf.fields.true_false=acf.field.extend({type:"true_false",$switch:null,$input:null,actions:{prepare:"render",append:"render",show:"render"},events:{"change .acf-switch-input":"_change","focus .acf-switch-input":"_focus","blur .acf-switch-input":"_blur","keypress .acf-switch-input":"_keypress"},focus:function(){this.$input=this.$field.find(".acf-switch-input"),this.$switch=this.$field.find(".acf-switch")},render:function(){if(this.$switch.exists()){var e=this.$switch.children(".acf-switch-on"),t=this.$switch.children(".acf-switch-off");width=Math.max(e.width(),t.width()),width&&(e.css("min-width",width),t.css("min-width",width))}},on:function(){this.$input.prop("checked",!0),this.$switch.addClass("-on")},off:function(){this.$input.prop("checked",!1),this.$switch.removeClass("-on")},_change:function(e){e.$el.prop("checked")?this.on():this.off()},_focus:function(e){this.$switch.addClass("-focus")},_blur:function(e){this.$switch.removeClass("-focus")},_keypress:function(e){return 37===e.keyCode?this.off():39===e.keyCode?this.on():void 0}})}(jQuery),function($){acf.fields.taxonomy=acf.field.extend({type:"taxonomy",$el:null,actions:{ready:"render",append:"render",remove:"remove"},events:{'click a[data-name="add"]':"add_term"},focus:function(){this.$el=this.$field.find(".acf-taxonomy-field"),this.o=acf.get_data(this.$el,{save:"",type:"",taxonomy:""}),this.o.key=this.$field.data("key")},render:function(){var e=this.$field.find("select");if(e.exists()){var t=acf.get_data(e);t=acf.parse_args(t,{pagination:!0,ajax_action:"acf/fields/taxonomy/query",key:this.o.key}),acf.select2.init(e,t)}},remove:function(){var e=this.$field.find("select");if(!e.exists())return!1;acf.select2.destroy(e)},add_term:function(e){var t=this;acf.open_popup({title:e.$el.attr("title")||e.$el.data("title"),loading:!0,height:220});var i=acf.prepare_for_ajax({action:"acf/fields/taxonomy/add_term",field_key:this.o.key});$.ajax({url:acf.get("ajaxurl"),data:i,type:"post",dataType:"html",success:function(e){t.add_term_confirm(e)}})},add_term_confirm:function(e){var t=this;acf.update_popup({content:e}),$('#acf-popup input[name="term_name"]').focus(),$("#acf-popup form").on("submit",function(e){e.preventDefault(),t.add_term_submit($(this))})},add_term_submit:function(e){var t=this,i=e.find(".acf-submit"),a=e.find('input[name="term_name"]'),n=e.find('select[name="term_parent"]');if(""===a.val())return a.focus(),!1;i.find("button").attr("disabled","disabled"),i.find(".acf-spinner").addClass("is-active");var s=acf.prepare_for_ajax({action:"acf/fields/taxonomy/add_term",field_key:this.o.key,term_name:a.val(),term_parent:n.exists()?n.val():0});$.ajax({url:acf.get("ajaxurl"),data:s,type:"post",dataType:"json",success:function(e){var n=acf.get_ajax_message(e);acf.is_ajax_success(e)&&(a.val(""),t.append_new_term(e.data)),n.text&&i.find("span").html(n.text)},complete:function(){i.find("button").removeAttr("disabled"),i.find(".acf-spinner").removeClass("is-active"),i.find("span").delay(1500).fadeOut(250,function(){$(this).html(""),$(this).show()}),a.focus()}})},append_new_term:function(e){var t={id:e.term_id,text:e.term_label};switch($('.acf-taxonomy-field[data-taxonomy="'+this.o.taxonomy+'"]').each(function(){var t=$(this).data("type");if("radio"==t||"checkbox"==t){var i=$(this).children('input[type="hidden"]'),a=$(this).find("ul:first"),n=i.attr("name");"checkbox"==t&&(n+="[]");var s=$(['',"",' ',""+e.term_label+" "," "," "].join(""));if(e.term_parent){var o=a.find('li[data-id="'+e.term_parent+'"]');a=o.children("ul"),a.exists()||(a=$(''),o.append(a))}a.append(s)}}),$("#acf-popup #term_parent").each(function(){var t=$(''+e.term_label+" ");e.term_parent?$(this).children('option[value="'+e.term_parent+'"]').after(t):$(this).append(t)}),this.o.type){case"select":var i=this.$el.children("select");acf.select2.add_value(i,e.term_id,e.term_label);break;case"multi_select":var i=this.$el.children("select");acf.select2.add_value(i,e.term_id,e.term_label);break;case"checkbox":case"radio":var a=this.$el.find(".categorychecklist-holder"),n=a.find('li[data-id="'+e.term_id+'"]'),s=a.get(0).scrollTop+(n.offset().top-a.offset().top);n.find("input").prop("checked",!0),a.animate({scrollTop:s},"250");break}}})}(jQuery),function($){acf.fields.url=acf.field.extend({type:"url",$input:null,actions:{ready:"render",append:"render"},events:{'keyup input[type="url"]':"render"},focus:function(){this.$input=this.$field.find('input[type="url"]')},is_valid:function(){var e=this.$input.val();if(-1!==e.indexOf("://"));else if(0!==e.indexOf("//"))return!1;return!0},render:function(){this.is_valid()?this.$input.parent().addClass("-valid"):this.$input.parent().removeClass("-valid")}})}(jQuery),function($){acf.validation=acf.model.extend({actions:{ready:"ready",append:"ready"},filters:{validation_complete:"validation_complete"},events:{"click #save-post":"click_ignore",'click [type="submit"]':"click_publish","submit form":"submit_form","click .acf-error-message a":"click_message"},active:1,ignore:0,busy:0,valid:!0,errors:[],error_class:"acf-error",message_class:"acf-error-message",$trigger:null,ready:function(e){var t=$(".acf-field input, .acf-field textarea, .acf-field select");if(t.length){var i=this;t.on("invalid",function(e){var t=$(this),i=acf.get_field_wrap(t);i.trigger("invalidField"),acf.do_action("invalid",t),acf.do_action("invalid_field",i),acf.validation.ignore||(e.preventDefault(),acf.validation.errors.push({input:t.attr("name"),message:e.target.validationMessage}),acf.validation.fetch(t.closest("form")))})}},validation_complete:function(e,t){if(!this.errors.length)return e;e.valid=0,e.errors=e.errors||[];var a=[];if(e.errors.length)for(i in e.errors)a.push(e.errors[i].input);if(this.errors.length)for(i in this.errors){var n=this.errors[i];-1===$.inArray(n.input,a)&&e.errors.push(n)}return this.errors=[],e},click_message:function(e){e.preventDefault(),acf.remove_el(e.$el.parent())},click_ignore:function(e){var t=this;this.ignore=1,this.$trigger=e.$el,this.$form=e.$el.closest("form"),$("."+this.message_class).each(function(){acf.remove_el($(this))}),this.ignore_required_inputs(),setTimeout(function(){t.ignore=0},100)},ignore_required_inputs:function(){var e=$(".acf-field input[required], .acf-field textarea[required], .acf-field select[required]");e.length&&(e.prop("required",!1),setTimeout(function(){e.prop("required",!0)},100))},click_publish:function(e){this.$trigger=e.$el},submit_form:function(e){if(!this.active)return!0;if(this.ignore)return this.ignore=0,!0;if(!e.$el.find("#acf-form-data").exists())return!0;var t=e.$el.find("#wp-preview");if(t.exists()&&t.val())return this.toggle(e.$el,"unlock"),!0;e.preventDefault(),this.fetch(e.$el)},toggle:function(e,t){t=t||"unlock";var i=null,a=null,n=$("#submitdiv");n.exists()||(n=$("#submitpost")),n.exists()||(n=e.find("p.submit").last()),n.exists()||(n=e.find(".acf-form-submit")),n.exists()||(n=e),i=n.find('input[type="submit"], .button'),a=n.find(".spinner, .acf-spinner"),this.hide_spinner(a),"unlock"==t?this.enable_submit(i):"lock"==t&&(this.disable_submit(i),this.show_spinner(a.last()))},fetch:function(e){if(this.busy)return!1;var t=this;acf.do_action("validation_begin");var i=acf.serialize(e);i.action="acf/validate_save_post",i=acf.prepare_for_ajax(i),this.busy=1,this.toggle(e,"lock"),$.ajax({url:acf.get("ajaxurl"),data:i,type:"post",dataType:"json",success:function(i){acf.is_ajax_success(i)&&t.fetch_success(e,i.data)},complete:function(){t.fetch_complete(e)}})},fetch_complete:function(e){if(this.busy=0,this.toggle(e,"unlock"),this.valid){this.ignore=1;var t=e.children(".acf-error-message");t.exists()&&(t.addClass("-success"),t.children("p").html(acf._e("validation_successful")),setTimeout(function(){acf.remove_el(t)},2e3)),e.find(".acf-postbox.acf-hidden").remove(),acf.do_action("submit",e),this.$trigger?this.$trigger.click():e.submit(),this.toggle(e,"lock")}},fetch_success:function(e,t){if(!(t=acf.apply_filters("validation_complete",t,e))||t.valid||!t.errors)return this.valid=!0,void acf.do_action("validation_success");acf.do_action("validation_failure"),this.valid=!1,this.$trigger=null,this.display_errors(t.errors,e)},display_errors:function(e,t){if(e&&e.length){var a=t.children(".acf-error-message"),n=acf._e("validation_failed"),s=0,o=null;for(i=0;i1&&(n+=". "+acf._e("validation_failed_2").replace("%d",s)),a.exists()||(a=$(''),t.prepend(a)),a.children("p").html(n),null===o&&(o=a),setTimeout(function(){$("html, body").animate({scrollTop:o.offset().top-$(window).height()/2},500)},10)}},add_error:function(e,t){var i=this;e.addClass(this.error_class),void 0!==t&&(e.children(".acf-input").children("."+this.message_class).remove(),e.children(".acf-input").prepend('"));var a=function(){i.remove_error(e),e.off("focus change","input, textarea, select",a)};e.on("focus change","input, textarea, select",a),e.trigger("invalidField"),acf.do_action("add_field_error",e),acf.do_action("invalid_field",e)},remove_error:function(e){var t=e.children(".acf-input").children("."+this.message_class);e.removeClass(this.error_class),setTimeout(function(){acf.remove_el(t)},250),acf.do_action("remove_field_error",e),acf.do_action("valid_field",e)},add_warning:function(e,t){this.add_error(e,t),setTimeout(function(){acf.validation.remove_error(e)},1e3)},show_spinner:function(e){if(e.exists()){var t=acf.get("wp_version");parseFloat(t)>=4.2?e.addClass("is-active"):e.css("display","inline-block")}},hide_spinner:function(e){if(e.exists()){var t=acf.get("wp_version");parseFloat(t)>=4.2?e.removeClass("is-active"):e.css("display","none")}},disable_submit:function(e){e.exists()&&e.addClass("disabled button-disabled button-primary-disabled")},enable_submit:function(e){e.exists()&&e.removeClass("disabled button-disabled button-primary-disabled")}})}(jQuery),function($){acf.fields.wysiwyg=acf.field.extend({type:"wysiwyg",$el:null,$textarea:null,toolbars:{},events:{"mousedown .acf-editor-wrap.delay":"mousedown"},actions:{load:"initialize",append:"initialize",remove:"disable",sortstart:"disable",sortstop:"enable"},focus:function(){this.$el=this.$field.find(".wp-editor-wrap").last(),this.$textarea=this.$el.find("textarea"),this.o=acf.get_data(this.$el,{toolbar:"",active:this.$el.hasClass("tmce-active"),id:this.$textarea.attr("id")})},mousedown:function(e){e.preventDefault(),this.$el.removeClass("delay"),this.$el.find(".acf-editor-toolbar").remove(),this.initialize()},initialize:function(){if(!this.$el.hasClass("delay")){var e={tinymce:!0,quicktags:!0,toolbar:this.o.toolbar,mode:this.o.active?"visual":"text"},t=this.o.id,i=acf.get_uniqid("acf-editor-"),a=this.$el.outerHTML();a=acf.str_replace(t,i,a),this.$el.replaceWith(a),this.o.id=i,acf.tinymce.initialize(this.o.id,e,this.$field)}},disable:function(){acf.tinymce.destroy(this.o.id)},enable:function(){this.o.active&&acf.tinymce.enable(this.o.id)}}),acf.tinymce=acf.model.extend({toolbars:{},actions:{ready:"ready"},ready:function(){var e=$("#acf-hidden-wp-editor");e.exists()&&(e.appendTo("body"),acf.isset(window,"tinymce","on")&&tinymce.on("AddEditor",function(e){var t=e.editor;"acf"===t.id.substr(0,3)&&(t=tinymce.editors.content||t,tinymce.activeEditor=t,wpActiveEditor=t.id)}))},defaults:function(){return"undefined"!=typeof tinyMCEPreInit&&{tinymce:tinyMCEPreInit.mceInit.acf_content,quicktags:tinyMCEPreInit.qtInit.acf_content}},initialize:function(e,t,i){t=t||{},i=i||null,t=acf.parse_args(t,{tinymce:!0,quicktags:!0,toolbar:"full",mode:"visual"}),t.tinymce&&this.initialize_tinymce(e,t,i),t.quicktags&&this.initialize_quicktags(e,t,i)},initialize_tinymce:function(e,t,i){var a=$("#"+e),n=this.defaults(),s=this.toolbars;if("undefined"==typeof tinymce)return!1;if(!n)return!1;if(tinymce.get(e))return this.enable(e);init=$.extend({},n.tinymce,t.tinymce),init.id=e,init.selector="#"+e;var o=t.toolbar;if(o&&void 0!==s[o])for(var r=1;r<=4;r++)init["toolbar"+r]=s[o][r]||"";if(init.setup=function(t){t.on("focus",function(e){acf.validation.remove_error(i)}),t.on("change",function(e){t.save(),a.trigger("change")}),$(t.getWin()).on("unload",function(){acf.tinymce.remove(e)})},init.wp_autoresize_on=!1,init=acf.apply_filters("wysiwyg_tinymce_settings",init,e,i),tinyMCEPreInit.mceInit[e]=init,"visual"==t.mode){tinymce.init(init);var l=tinymce.get(e);acf.do_action("wysiwyg_tinymce_init",l,l.id,init,i)}},initialize_quicktags:function(e,t,i){var a=this.defaults();if("undefined"==typeof quicktags)return!1;if(!a)return!1;init=$.extend({},a.quicktags,t.quicktags),init.id=e,init=acf.apply_filters("wysiwyg_quicktags_settings",init,init.id,i),tinyMCEPreInit.qtInit[e]=init;var n=quicktags(init);this.build_quicktags(n),acf.do_action("wysiwyg_quicktags_init",n,n.id,init,i)},build_quicktags:function(e){var t,i,a,n,s,e,o,r,l,c,d=",strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,";t=e.canvas,i=e.name,a=e.settings,s="",n={},l="",c=e.id,a.buttons&&(l=","+a.buttons+",");for(r in edButtons)edButtons[r]&&(o=edButtons[r].id,l&&-1!==d.indexOf(","+o+",")&&-1===l.indexOf(","+o+",")||edButtons[r].instance&&edButtons[r].instance!==c||(n[o]=edButtons[r],edButtons[r].html&&(s+=edButtons[r].html(i+"_"))));l&&-1!==l.indexOf(",dfw,")&&(n.dfw=new QTags.DFWButton,s+=n.dfw.html(i+"_")),"rtl"===document.getElementsByTagName("html")[0].dir&&(n.textdirection=new QTags.TextDirectionButton,s+=n.textdirection.html(i+"_")),e.toolbar.innerHTML=s,e.theButtons=n,"undefined"!=typeof jQuery&&jQuery(document).triggerHandler("quicktags-init",[e])},disable:function(e){this.destroy(e)},destroy:function(e){this.destroy_tinymce(e)},destroy_tinymce:function(e){if("undefined"==typeof tinymce)return!1;var t=tinymce.get(e);return!!t&&(t.save(),t.destroy(),!0)},enable:function(e){this.enable_tinymce(e)},enable_tinymce:function(e){return"undefined"!=typeof switchEditors&&(void 0!==tinyMCEPreInit.mceInit[e]&&(switchEditors.go(e,"tmce"),!0))}})}(jQuery);
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-field-group.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-field-group.php
new file mode 100644
index 0000000..6eab6c2
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-field-group.php
@@ -0,0 +1,868 @@
+ '', // 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'));
+ add_action('acf/input/admin_footer_js', array($this, 'admin_footer_js'));
+
+
+ // 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');
+
+
+ // 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 );
+
+
+ // 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(
+ 'post_id' => $post->ID,
+ 'nonce' => 'field_group',
+ 'ajax' => 0,
+ 'delete_fields' => 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 ) {
+
+ // merge in new strings
+ $l10n = array_merge($l10n, array(
+ 'move_to_trash' => __("Move to trash. Are you sure?",'acf'),
+ 'checked' => __("checked",'acf'),
+ 'no_fields' => __("No toggle fields available",'acf'),
+ 'title_is_required' => __("Field group title is required",'acf'),
+ 'copy' => __("copy",'acf'),
+ 'or' => __("or",'acf'),
+ 'fields' => __("Fields",'acf'),
+ 'parent_fields' => __("Parent fields",'acf'),
+ 'sibling_fields' => __("Sibling fields",'acf'),
+ 'move_field' => __("Move Custom Field",'acf'),
+ 'move_field_warning' => __("This field cannot be moved until its changes have been saved",'acf'),
+ 'null' => __("Null",'acf'),
+ 'unload' => __('The changes you made will be lost if you navigate away from this page','acf'),
+ 'field_name_start' => __('The string "field_" may not be used at the start of a field name','acf'),
+ ));
+
+
+ // 3rd party hook
+ $l10n = apply_filters('acf/field_group/admin_l10n', $l10n);
+
+
+ // return
+ return $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');
+
+ }
+
+
+ /*
+ * admin_footer_js
+ *
+ * description
+ *
+ * @type function
+ * @date 31/05/2016
+ * @since 5.3.8
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function admin_footer_js() {
+
+ // 3rd party hook
+ do_action('acf/field_group/admin_footer_js');
+
+ }
+
+
+ /*
+ * 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 .= '';
+ $html .= ' ' . __('Field Keys','acf') . ' ';
+ $html .= '
';
+
+
+ // 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
+ global $field_group;
+
+
+ // vars
+ $status = $field_group['active'] ? __("Active",'acf') : __("Inactive",'acf');
+
+?>
+
+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;
+
+ }
+
+
+ // disable filters to ensure ACF loads raw data from DB
+ acf_disable_filters();
+
+
+ // save fields
+ if( !empty($_POST['acf_fields']) ) {
+
+ 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 field parent
+ if( empty($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_by_id( $field_group['ID'] ),
+ '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();
+
+
+ // valid rule
+ $rule = acf_get_valid_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() {
+
+ // vars
+ $options = array(
+ 'nonce' => '',
+ 'parent' => 0,
+ 'field_group' => 0,
+ 'prefix' => '',
+ 'type' => '',
+ );
+
+
+ // load post options
+ $options = wp_parse_args($_POST, $options);
+
+
+ // verify nonce
+ if( !wp_verify_nonce($options['nonce'], 'acf_nonce') ) {
+
+ die(0);
+
+ }
+
+
+ // required
+ if( !$options['type'] ) {
+
+ die(0);
+
+ }
+
+
+ // render options
+ $field = acf_get_valid_field(array(
+ 'type' => $options['type'],
+ 'name' => 'temp',
+ 'prefix' => $options['prefix'],
+ 'parent' => $options['parent'],
+ 'field_group' => $options['field_group'],
+ ));
+
+
+ // render
+ do_action("acf/render_field_settings/type={$field['type']}", $field);
+
+
+ // die
+ 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();
+
+
+ // 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);
+
+
+ // message
+ $a = '' . $field_group['title'] . ' ';
+ echo '' . __('Move Complete.', 'acf') . '
';
+ echo '' . sprintf( __('The %s field can now be found in the %s field group', 'acf'), $field['label'], $a ). '
';
+ echo '';
+ 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 '' . __('Please select the destination for this field', 'acf') . '
';
+
+ echo '';
+
+
+ // die
+ die();
+
+ }
+
+}
+
+// initialize
+new acf_admin_field_group();
+
+endif;
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-field-groups.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-field-groups.php
new file mode 100644
index 0000000..82e5950
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-field-groups.php
@@ -0,0 +1,811 @@
+label_count = _n_noop( 'Active (%s) ', 'Active (%s) ', 'acf' );
+
+
+ // reorder trash to end
+ $wp_post_statuses['trash'] = acf_extract_var( $wp_post_statuses, 'trash' );
+
+
+ // check stuff
+ $this->check_duplicate();
+ $this->check_sync();
+
+
+ // actions
+ add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
+ add_action('admin_footer', array($this, 'admin_footer'));
+
+
+ // columns
+ add_filter('manage_edit-acf-field-group_columns', array($this, 'field_group_columns'), 10, 1);
+ add_action('manage_acf-field-group_posts_custom_column', array($this, 'field_group_columns_html'), 10, 2);
+
+ }
+
+
+ /*
+ * admin_enqueue_scripts
+ *
+ * This function will add the already registered css
+ *
+ * @type function
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_enqueue_scripts() {
+
+ wp_enqueue_script('acf-input');
+
+ }
+
+
+ /*
+ * check_duplicate
+ *
+ * This function will check for any $_GET data to duplicate
+ *
+ * @type function
+ * @date 17/10/13
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function check_duplicate() {
+
+ // message
+ if( $ids = acf_maybe_get_GET('acfduplicatecomplete') ) {
+
+ // explode
+ $ids = explode(',', $ids);
+ $total = count($ids);
+
+ if( $total == 1 ) {
+
+ acf_add_admin_notice( sprintf(__('Field group duplicated. %s', 'acf'), '' . get_the_title($ids[0]) . ' ') );
+
+ } else {
+
+ acf_add_admin_notice( sprintf(_n( '%s field group duplicated.', '%s field groups duplicated.', $total, 'acf' ), $total) );
+
+ }
+
+ }
+
+
+ // vars
+ $ids = array();
+
+
+ // check single
+ if( $id = acf_maybe_get_GET('acfduplicate') ) {
+
+ $ids[] = $id;
+
+ // check multiple
+ } elseif( acf_maybe_get_GET('action2') === 'acfduplicate' ) {
+
+ $ids = acf_maybe_get_GET('post');
+
+ }
+
+
+ // sync
+ if( !empty($ids) ) {
+
+ // validate
+ check_admin_referer('bulk-posts');
+
+
+ // vars
+ $new_ids = array();
+
+
+ // loop
+ foreach( $ids as $id ) {
+
+ // duplicate
+ $field_group = acf_duplicate_field_group( $id );
+
+
+ // increase counter
+ $new_ids[] = $field_group['ID'];
+
+ }
+
+
+ // redirect
+ wp_redirect( admin_url( $this->url . '&acfduplicatecomplete=' . implode(',', $new_ids)) );
+ exit;
+
+ }
+
+ }
+
+
+ /*
+ * check_sync
+ *
+ * This function will check for any $_GET data to sync
+ *
+ * @type function
+ * @date 9/12/2014
+ * @since 5.1.5
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function check_sync() {
+
+ // message
+ if( $ids = acf_maybe_get_GET('acfsynccomplete') ) {
+
+ // explode
+ $ids = explode(',', $ids);
+ $total = count($ids);
+
+ if( $total == 1 ) {
+
+ acf_add_admin_notice( sprintf(__('Field group synchronised. %s', 'acf'), '' . get_the_title($ids[0]) . ' ') );
+
+ } else {
+
+ acf_add_admin_notice( sprintf(_n( '%s field group synchronised.', '%s field groups synchronised.', $total, 'acf' ), $total) );
+
+ }
+
+ }
+
+
+ // vars
+ $groups = acf_get_field_groups();
+
+
+ // bail early if no field groups
+ if( empty($groups) ) return;
+
+
+ // find JSON field groups which have not yet been imported
+ foreach( $groups as $group ) {
+
+ // vars
+ $local = acf_maybe_get($group, 'local', false);
+ $modified = acf_maybe_get($group, 'modified', 0);
+ $private = acf_maybe_get($group, 'private', false);
+
+
+ // ignore DB / PHP / private field groups
+ if( $local !== 'json' || $private ) {
+
+ // do nothing
+
+ } elseif( !$group['ID'] ) {
+
+ $this->sync[ $group['key'] ] = $group;
+
+ } elseif( $modified && $modified > get_post_modified_time('U', true, $group['ID'], true) ) {
+
+ $this->sync[ $group['key'] ] = $group;
+
+ }
+
+ }
+
+
+ // bail if no sync needed
+ if( empty($this->sync) ) return;
+
+
+ // maybe sync
+ $sync_keys = array();
+
+
+ // check single
+ if( $key = acf_maybe_get_GET('acfsync') ) {
+
+ $sync_keys[] = $key;
+
+ // check multiple
+ } elseif( acf_maybe_get_GET('action2') === 'acfsync' ) {
+
+ $sync_keys = acf_maybe_get_GET('post');
+
+ }
+
+
+ // sync
+ if( !empty($sync_keys) ) {
+
+ // validate
+ check_admin_referer('bulk-posts');
+
+
+ // disable filters to ensure ACF loads raw data from DB
+ acf_disable_filters();
+ acf_enable_filter('local');
+
+
+ // disable JSON
+ // - this prevents a new JSON file being created and causing a 'change' to theme files - solves git anoyance
+ acf_update_setting('json', false);
+
+
+ // vars
+ $new_ids = array();
+
+
+ // loop
+ foreach( $sync_keys as $key ) {
+
+ // append fields
+ if( acf_have_local_fields($key) ) {
+
+ $this->sync[ $key ]['fields'] = acf_get_local_fields( $key );
+
+ }
+
+
+ // import
+ $field_group = acf_import_field_group( $this->sync[ $key ] );
+
+
+ // append
+ $new_ids[] = $field_group['ID'];
+
+ }
+
+
+ // redirect
+ wp_redirect( admin_url( $this->url . '&acfsynccomplete=' . implode(',', $new_ids)) );
+ exit;
+
+ }
+
+
+ // filters
+ add_filter('views_edit-acf-field-group', array($this, 'list_table_views'));
+
+ }
+
+
+ /*
+ * list_table_views
+ *
+ * This function will add an extra link for JSON in the field group list table
+ *
+ * @type function
+ * @date 3/12/2014
+ * @since 5.1.5
+ *
+ * @param $views (array)
+ * @return $views
+ */
+
+ function list_table_views( $views ) {
+
+ // vars
+ $class = '';
+ $total = count($this->sync);
+
+ // active
+ if( acf_maybe_get_GET('post_status') === 'sync' ) {
+
+ // actions
+ add_action('admin_footer', array($this, 'sync_admin_footer'), 5);
+
+
+ // set active class
+ $class = ' class="current"';
+
+
+ // global
+ global $wp_list_table;
+
+
+ // update pagination
+ $wp_list_table->set_pagination_args( array(
+ 'total_items' => $total,
+ 'total_pages' => 1,
+ 'per_page' => $total
+ ));
+
+ }
+
+
+ // add view
+ $views['json'] = '' . __('Sync available', 'acf') . ' (' . $total . ') ';
+
+
+ // return
+ return $views;
+
+ }
+
+
+ /*
+ * trashed_post
+ *
+ * This function is run when a post object is sent to the trash
+ *
+ * @type action (trashed_post)
+ * @date 8/01/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return n/a
+ */
+
+ function trashed_post( $post_id ) {
+
+ // validate post type
+ if( get_post_type($post_id) != 'acf-field-group' ) {
+
+ return;
+
+ }
+
+
+ // trash field group
+ acf_trash_field_group( $post_id );
+
+ }
+
+
+ /*
+ * untrashed_post
+ *
+ * This function is run when a post object is restored from the trash
+ *
+ * @type action (untrashed_post)
+ * @date 8/01/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return n/a
+ */
+
+ function untrashed_post( $post_id ) {
+
+ // validate post type
+ if( get_post_type($post_id) != 'acf-field-group' ) {
+
+ return;
+
+ }
+
+
+ // trash field group
+ acf_untrash_field_group( $post_id );
+
+ }
+
+
+ /*
+ * deleted_post
+ *
+ * This function is run when a post object is deleted from the trash
+ *
+ * @type action (deleted_post)
+ * @date 8/01/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return n/a
+ */
+
+ function deleted_post( $post_id ) {
+
+ // validate post type
+ if( get_post_type($post_id) != 'acf-field-group' ) {
+
+ return;
+
+ }
+
+
+ // trash field group
+ acf_delete_field_group( $post_id );
+
+ }
+
+
+ /*
+ * field_group_columns
+ *
+ * This function will customize the columns for the field group table
+ *
+ * @type filter (manage_edit-acf-field-group_columns)
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param $columns (array)
+ * @return $columns (array)
+ */
+
+ function field_group_columns( $columns ) {
+
+ return array(
+ 'cb' => ' ',
+ 'title' => __('Title', 'acf'),
+ 'acf-fg-description' => __('Description', 'acf'),
+ 'acf-fg-status' => ' ',
+ 'acf-fg-count' => __('Fields', 'acf'),
+ );
+
+ }
+
+
+ /*
+ * field_group_columns_html
+ *
+ * This function will render the HTML for each table cell
+ *
+ * @type action (manage_acf-field-group_posts_custom_column)
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param $column (string)
+ * @param $post_id (int)
+ * @return n/a
+ */
+
+ function field_group_columns_html( $column, $post_id ) {
+
+ // vars
+ $field_group = acf_get_field_group( $post_id );
+
+
+ // render
+ $this->render_column( $column, $field_group );
+
+ }
+
+ function render_column( $column, $field_group ) {
+
+ // description
+ if( $column == 'acf-fg-description' ) {
+
+ if( $field_group['description'] ) {
+
+ echo '' . acf_esc_html($field_group['description']) . ' ';
+
+ }
+
+ // status
+ } elseif( $column == 'acf-fg-status' ) {
+
+ if( isset($this->sync[ $field_group['key'] ]) ) {
+
+ echo ' ';
+
+ }
+
+ if( $field_group['active'] ) {
+
+ //echo ' ';
+
+ } else {
+
+ echo ' ';
+
+ }
+
+ // fields
+ } elseif( $column == 'acf-fg-count' ) {
+
+ echo esc_html( acf_get_field_count( $field_group ) );
+
+ }
+
+ }
+
+
+ /*
+ * admin_footer
+ *
+ * This function will render extra HTML onto the page
+ *
+ * @type action (admin_footer)
+ * @date 23/06/12
+ * @since 3.1.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_footer() {
+
+ // vars
+ $url_home = 'https://www.advancedcustomfields.com';
+ $url_support = 'https://support.advancedcustomfields.com';
+ $icon = ' ';
+
+?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-tools.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-tools.php
new file mode 100644
index 0000000..c081fb0
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-tools.php
@@ -0,0 +1,354 @@
+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, $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']);
+
+
+ ?>
+
+ 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;
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin.php
new file mode 100644
index 0000000..b432e23
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin.php
@@ -0,0 +1,235 @@
+notices[] = array(
+ 'text' => $text,
+ 'class' => 'updated ' . $class,
+ 'wrap' => $wrap
+ );
+
+ }
+
+
+ /*
+ * get_notices
+ *
+ * This function will return an array of admin notices
+ *
+ * @type function
+ * @date 17/10/13
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function get_notices() {
+
+ // bail early if no notices
+ if( empty($this->notices) ) return false;
+
+
+ // return
+ return $this->notices;
+
+ }
+
+
+ /*
+ * 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;
+
+
+ // vars
+ $slug = 'edit.php?post_type=acf-field-group';
+ $cap = acf_get_setting('capability');
+
+
+ // add parent
+ add_menu_page(__("Custom Fields",'acf'), __("Custom Fields",'acf'), $cap, $slug, false, 'dashicons-welcome-widgets-menus', '80.025');
+
+
+ // add children
+ 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' );
+
+ }
+
+
+ /*
+ * admin_enqueue_scripts
+ *
+ * This function will add the already registered css
+ *
+ * @type function
+ * @date 28/09/13
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_enqueue_scripts() {
+
+ wp_enqueue_style( 'acf-global' );
+
+ }
+
+
+ /*
+ * admin_notices
+ *
+ * This function will render any admin notices
+ *
+ * @type function
+ * @date 17/10/13
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_notices() {
+
+ // vars
+ $notices = $this->get_notices();
+
+
+ // bail early if no notices
+ if( !$notices ) return;
+
+
+ // loop
+ foreach( $notices as $notice ) {
+
+ $open = '';
+ $close = '';
+
+ if( $notice['wrap'] ) {
+
+ $open = "<{$notice['wrap']}>";
+ $close = "{$notice['wrap']}>";
+
+ }
+
+ ?>
+
+ admin = new acf_admin();
+
+endif; // class_exists check
+
+
+/*
+* acf_add_admin_notice
+*
+* This function will add the notice data to a setting in the acf object for the admin_notices action to use
+*
+* @type function
+* @date 17/10/13
+* @since 5.0.0
+*
+* @param $text (string)
+* @param $class (string)
+* @return (int) message ID (array position)
+*/
+
+function acf_add_admin_notice( $text, $class = '', $wrap = 'p' ) {
+
+ return acf()->admin->add_notice($text, $class, $wrap);
+
+}
+
+
+/*
+* acf_get_admin_notices
+*
+* This function will return an array containing any admin notices
+*
+* @type function
+* @date 17/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return (array)
+*/
+
+function acf_get_admin_notices() {
+
+ return acf()->admin->get_notices();
+
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/install-network.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/install-network.php
new file mode 100644
index 0000000..46ff544
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/install-network.php
@@ -0,0 +1,283 @@
+ __("Review sites & upgrade", 'acf'),
+ 'button_url' => network_admin_url('index.php?page=acf-upgrade-network'),
+ 'confirm' => false
+ );
+
+
+ // load view
+ acf_get_view('install-notice', $view);
+
+ }
+
+
+ /*
+ * network_html
+ *
+ * This function will render the HTML for the network upgrade page
+ *
+ * @type function
+ * @date 19/02/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function network_html() {
+
+ // vars
+ $plugin_version = acf_get_setting('version');
+
+
+ // loop through sites and find updates
+ $sites = acf_get_sites();
+
+ if( $sites ) {
+
+ foreach( $sites as $i => $site ) {
+
+ // switch blog
+ switch_to_blog( $site['blog_id'] );
+
+
+ // extra info
+ $site['name'] = get_bloginfo('name');
+ $site['url'] = home_url();
+
+
+ // get site updates
+ $site['updates'] = acf_get_db_updates();
+
+
+ // get site version
+ $site['acf_version'] = get_option('acf_version');
+
+
+ // no value equals new instal
+ if( !$site['acf_version'] ) {
+
+ $site['acf_version'] = $plugin_version;
+
+ }
+
+
+ // update
+ $sites[ $i ] = $site;
+
+
+ // restore
+ restore_current_blog();
+
+ }
+
+ }
+
+
+ // view
+ $view = array(
+ 'sites' => $sites,
+ 'plugin_version' => $plugin_version
+ );
+
+
+ // load view
+ acf_get_view('install-network', $view);
+
+ }
+
+}
+
+// initialize
+new acf_admin_install_network();
+
+endif; // class_exists check
+
+
+/*
+* acf_get_sites
+*
+* This function will return an array of site data
+*
+* @type function
+* @date 29/08/2016
+* @since 5.4.0
+*
+* @param n/a
+* @return (array)
+*/
+
+function acf_get_sites() {
+
+ // vars
+ $sites = array();
+
+
+ // WP >= 4.6
+ if( function_exists('get_sites') ) {
+
+ $_sites = get_sites(array(
+ 'number' => 0
+ ));
+
+ foreach( $_sites as $_site ) {
+
+ $_site = get_site( $_site );
+ $sites[] = $_site->to_array();
+
+ }
+
+ // WP < 4.6
+ } else {
+
+ $sites = wp_get_sites(array(
+ 'limit' => 0
+ ));
+
+ }
+
+
+ // return
+ return $sites;
+
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/install-updates.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/install-updates.php
new file mode 100644
index 0000000..7070eb9
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/install-updates.php
@@ -0,0 +1,499 @@
+ -1,
+ 'post_type' => 'acf',
+ 'orderby' => 'menu_order title',
+ 'order' => 'asc',
+ 'suppress_filters' => true,
+ ));
+
+
+ // check
+ if( !$ofgs ) return;
+
+
+ // loop
+ foreach( $ofgs as $ofg ){
+
+ acf_update_500_field_group( $ofg );
+
+ }
+
+}
+
+function acf_update_500_field_group( $ofg ) {
+
+ // global
+ global $wpdb;
+
+
+ // create new field group
+ $nfg = array(
+ 'ID' => 0,
+ 'title' => $ofg->post_title,
+ 'menu_order' => $ofg->menu_order,
+ );
+
+
+ // location rules
+ $groups = array();
+
+
+ // get all rules
+ $rules = get_post_meta($ofg->ID, 'rule', false);
+
+ if( is_array($rules) ) {
+
+ $group_no = 0;
+
+ foreach( $rules as $rule ) {
+
+ // if field group was duplicated, it may now be a serialized string!
+ $rule = maybe_unserialize($rule);
+
+
+ // does this rule have a group?
+ // + groups were added in 4.0.4
+ if( !isset($rule['group_no']) ) {
+
+ $rule['group_no'] = $group_no;
+
+ // sperate groups?
+ if( get_post_meta($ofg->ID, 'allorany', true) == 'any' ) {
+
+ $group_no++;
+
+ }
+
+ }
+
+
+ // extract vars
+ $group = acf_extract_var( $rule, 'group_no' );
+ $order = acf_extract_var( $rule, 'order_no' );
+
+
+ // add to group
+ $groups[ $group ][ $order ] = $rule;
+
+
+ // sort rules
+ ksort( $groups[ $group ] );
+
+ }
+
+ // sort groups
+ ksort( $groups );
+ }
+
+ $nfg['location'] = $groups;
+
+
+ // settings
+ if( $position = get_post_meta($ofg->ID, 'position', true) ) {
+
+ $nfg['position'] = $position;
+
+ }
+
+ if( $layout = get_post_meta($ofg->ID, 'layout', true) ) {
+
+ $nfg['layout'] = $layout;
+
+ }
+
+ if( $hide_on_screen = get_post_meta($ofg->ID, 'hide_on_screen', true) ) {
+
+ $nfg['hide_on_screen'] = maybe_unserialize($hide_on_screen);
+
+ }
+
+
+ // Note: acf_update_field_group will call the acf_get_valid_field_group function and apply 'compatibility' changes
+
+
+ // save field group
+ $nfg = acf_update_field_group( $nfg );
+
+
+ // action for 3rd party
+ do_action('acf/update_500_field_group', $nfg, $ofg);
+
+
+ // trash?
+ if( $ofg->post_status == 'trash' ) {
+
+ acf_trash_field_group( $nfg['ID'] );
+
+ }
+
+
+ // get field from postmeta
+ $rows = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d AND meta_key LIKE %s", $ofg->ID, 'field_%'), ARRAY_A);
+
+
+ // check
+ if( $rows ) {
+
+ // loop
+ foreach( $rows as $row ) {
+
+ // bail early if key already migrated (potential duplicates in DB)
+ if( acf_has_done('update_500_field_group_' . $ofg->ID . '_' . $row['meta_key']) ) continue;
+
+
+ // vars
+ $field = $row['meta_value'];
+ $field = maybe_unserialize( $field );
+ $field = maybe_unserialize( $field ); // run again for WPML
+
+
+ // add parent
+ $field['parent'] = $nfg['ID'];
+
+
+ // migrate field
+ $field = acf_update_500_field( $field );
+
+ }
+
+ }
+
+
+ // return
+ return $nfg;
+
+}
+
+
+function acf_update_500_field( $field ) {
+
+ // orig
+ $orig = $field;
+
+
+ // order_no is now menu_order
+ $field['menu_order'] = acf_extract_var( $field, 'order_no' );
+
+
+ // correct very old field keys
+ if( substr($field['key'], 0, 6) !== 'field_' ) {
+
+ $field['key'] = 'field_' . str_replace('field', '', $field['key']);
+
+ }
+
+
+ // get valid field
+ $field = acf_get_valid_field( $field );
+
+
+ // save field
+ $field = acf_update_field( $field );
+
+
+ // sub fields
+ if( $field['type'] == 'repeater' ) {
+
+ // get sub fields
+ $sub_fields = acf_extract_var( $orig, 'sub_fields' );
+
+
+ // save sub fields
+ if( !empty($sub_fields) ) {
+
+ $keys = array_keys($sub_fields);
+
+ foreach( $keys as $key ) {
+
+ $sub_field = acf_extract_var($sub_fields, $key);
+ $sub_field['parent'] = $field['ID'];
+
+ acf_update_500_field( $sub_field );
+
+ }
+
+ }
+
+
+ } elseif( $field['type'] == 'flexible_content' ) {
+
+ // get layouts
+ $layouts = acf_extract_var( $orig, 'layouts' );
+
+
+ // update layouts
+ $field['layouts'] = array();
+
+
+ // save sub fields
+ if( !empty($layouts) ) {
+
+ foreach( $layouts as $layout ) {
+
+ // vars
+ $layout_key = uniqid();
+
+
+ // append layotu key
+ $layout['key'] = $layout_key;
+
+
+ // extract sub fields
+ $sub_fields = acf_extract_var($layout, 'sub_fields');
+
+
+ // save sub fields
+ if( !empty($sub_fields) ) {
+
+ $keys = array_keys($sub_fields);
+
+ foreach( $keys as $key ) {
+
+ $sub_field = acf_extract_var($sub_fields, $key);
+ $sub_field['parent'] = $field['ID'];
+ $sub_field['parent_layout'] = $layout_key;
+
+ acf_update_500_field( $sub_field );
+
+ }
+ // foreach
+
+ }
+ // if
+
+
+ // append layout
+ $field['layouts'][] = $layout;
+
+ }
+ // foreach
+
+ }
+ // if
+
+
+ // save field again with less sub field data
+ $field = acf_update_field( $field );
+
+ }
+
+
+ // action for 3rd party
+ do_action('acf/update_500_field', $field);
+
+
+ // return
+ return $field;
+
+}
+
+
+/*
+* acf_update_550
+*
+* These functions will update the DB for ACF v5.5.0
+*
+* @type function
+* @date 10/09/2016
+* @since 5.4.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_update_550() { //acf_log('acf_update_550');
+
+ // action for 3rd party
+ do_action('acf/update_550');
+
+
+ // termmeta
+ acf_update_550_termmeta();
+
+
+ // version
+ acf_update_db_version('5.5.0');
+
+}
+
+
+/*
+* acf_update_550_termmeta
+*
+* This function will migrate all term meta
+*
+* @type function
+* @date 3/09/2016
+* @since 5.4.0
+*
+* @param n/a
+* @return n/a
+*/
+
+
+function acf_update_550_termmeta() { //acf_log('acf_update_550_termmeta');
+
+ // bail early if no table
+ if( !acf_isset_termmeta() ) {
+
+ update_option('acf_update_550_termmeta', 1); // no longer used
+ //echo __('Term meta upgrade not possible (termmeta table does not exist)', 'acf');
+ return;
+
+ }
+
+
+ // vars
+ $taxonomies = get_taxonomies(false, 'objects');
+
+
+ // bail early if no taxonomies
+ if( !$taxonomies ) return;
+
+
+ // loop
+ foreach( $taxonomies as $taxonomy ) {
+
+ acf_update_550_taxonomy( $taxonomy->name );
+
+ }
+
+
+ // delete trigger
+ delete_option('acf_update_550_termmeta');
+
+
+ // action for 3rd party
+ do_action('acf/update_550_termmeta');
+
+}
+
+
+/*
+* acf_update_550_taxonomy
+*
+* This function will migrate term meta for a specific taxonomy
+*
+* @type function
+* @date 3/09/2016
+* @since 5.4.0
+*
+* @param $taxonomy (string)
+* @return n/a
+*/
+
+function acf_update_550_taxonomy( $taxonomy ) { //acf_log('acf_update_550_taxonomy', $taxonomy);
+
+ // global
+ global $wpdb;
+
+
+ // vars
+ $search = $taxonomy . '_%';
+ $_search = '_' . $search;
+
+
+ // escape '_'
+ // http://stackoverflow.com/questions/2300285/how-do-i-escape-in-sql-server
+ $search = str_replace('_', '\_', $search);
+ $_search = str_replace('_', '\_', $_search);
+
+
+ // search
+ // results show faster query times using 2 LIKE vs 2 wildcards
+ $rows = $wpdb->get_results($wpdb->prepare(
+ "SELECT *
+ FROM $wpdb->options
+ WHERE option_name LIKE %s
+ OR option_name LIKE %s",
+ $search,
+ $_search
+ ), ARRAY_A);
+
+
+ // bail early if no rows
+ if( empty($rows) ) return;
+
+
+ // vars
+ $search = $taxonomy . '_';
+ $_search = '_' . $search;
+
+
+ // loop
+ foreach( $rows as $row ) {
+
+ // use regex to find (_)taxonomy_(term_id)_(field_name)
+ $matches = null;
+ $regexp = '/^(_?)' . $taxonomy . '_(\d+)_(.+)/';
+
+
+ // bail early if no match
+ if( !preg_match($regexp, $row['option_name'], $matches) ) continue;
+
+
+ /*
+ Array
+ (
+ [0] => category_3_color
+ [1] =>
+ [2] => 3
+ [3] => color
+ )
+ */
+
+
+ // vars
+ $term_id = $matches[2];
+ $name = $matches[1] . $matches[3];
+ $value = $row['option_value'];
+
+
+ // update
+ update_metadata( 'term', $term_id, $name, $value );
+
+ }
+
+
+ // action for 3rd party
+ do_action('acf/update_550_taxonomy', $taxonomy);
+
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/install.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/install.php
new file mode 100644
index 0000000..18ce756
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/install.php
@@ -0,0 +1,431 @@
+ 'acf_update_500',
+ '5.5.0' => 'acf_update_550'
+ );
+
+
+ /*
+ * __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('admin_menu', array($this,'admin_menu'), 20);
+ add_action('wp_upgrade', array($this,'wp_upgrade'), 10, 2);
+
+
+ // ajax
+ add_action('wp_ajax_acf/admin/db_update', array($this, 'ajax_db_update'));
+
+ }
+
+
+ /*
+ * admin_menu
+ *
+ * This function will chck for available updates and add actions if needed
+ *
+ * @type function
+ * @date 19/02/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_menu() {
+
+ // vars
+ $updates = acf_get_db_updates();
+
+
+ // bail early if no updates available
+ if( !$updates ) return;
+
+
+ // actions
+ add_action('admin_notices', array($this, 'admin_notices'), 1);
+
+
+ // add page
+ $page = add_submenu_page('index.php', __('Upgrade Database','acf'), __('Upgrade Database','acf'), acf_get_setting('capability'), 'acf-upgrade', array($this,'html') );
+
+
+ // actions
+ add_action('load-' . $page, array($this,'load'));
+
+ }
+
+
+ /*
+ * load
+ *
+ * This function will look at the $_POST data and run any functions if needed
+ *
+ * @type function
+ * @date 7/01/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function load() {
+
+ // hide upgrade
+ remove_action('admin_notices', array($this, 'admin_notices'), 1);
+
+
+ // load acf scripts
+ acf_enqueue_scripts();
+
+ }
+
+
+ /*
+ * admin_notices
+ *
+ * This function will render the DB Upgrade notice
+ *
+ * @type function
+ * @date 17/10/13
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_notices() {
+
+ // view
+ $view = array(
+ 'button_text' => __("Upgrade Database", 'acf'),
+ 'button_url' => admin_url('index.php?page=acf-upgrade'),
+ 'confirm' => true
+ );
+
+
+ // load view
+ acf_get_view('install-notice', $view);
+
+ }
+
+
+ /*
+ * html
+ *
+ * description
+ *
+ * @type function
+ * @date 19/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function html() {
+
+ // view
+ $view = array(
+ 'updates' => acf_get_db_updates(),
+ 'plugin_version' => acf_get_setting('version')
+ );
+
+
+ // load view
+ acf_get_view('install', $view);
+
+ }
+
+
+ /*
+ * ajax_db_update
+ *
+ * description
+ *
+ * @type function
+ * @date 24/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function ajax_db_update() {
+
+ // options
+ $options = wp_parse_args( $_POST, array(
+ 'nonce' => '',
+ 'blog_id' => '',
+ ));
+
+
+ // validate
+ if( !wp_verify_nonce($options['nonce'], 'acf_db_update') ) {
+
+ wp_send_json_error(array(
+ 'message' => __('Error validating request', 'acf')
+ ));
+
+ }
+
+
+ // switch blog
+ if( $options['blog_id'] ) {
+
+ switch_to_blog( $options['blog_id'] );
+
+ }
+
+
+ // vars
+ $updates = acf_get_db_updates();
+ $message = '';
+
+
+ // bail early if no updates
+ if( empty($updates) ) {
+
+ wp_send_json_error(array(
+ 'message' => __('No updates available.', 'acf')
+ ));
+
+ }
+
+
+ // install updates
+ foreach( $updates as $version => $callback ) {
+
+ $message .= $this->run_update( $callback );
+
+ }
+
+
+ // updates complete
+ acf_update_db_version();
+
+
+ // return
+ wp_send_json_success(array(
+ 'message' => $message
+ ));
+
+ }
+
+
+ /*
+ * run_db_update
+ *
+ * This function will perform a db upgrade
+ *
+ * @type function
+ * @date 10/09/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function run_update( $callback = '' ) {
+
+ // include update functions
+ acf_include('includes/admin/install-updates.php');
+
+
+ // bail early if not found
+ if( !function_exists($callback) ) return false;
+
+
+ // load any errors / feedback from update
+ ob_start();
+
+
+ // include
+ call_user_func($callback);
+
+
+ // get feedback
+ $message = ob_get_clean();
+
+
+ // return
+ return $message;
+
+ }
+
+
+ /*
+ * wp_upgrade
+ *
+ * This function will run when the WP database is updated
+ *
+ * @type function
+ * @date 10/09/2016
+ * @since 5.4.0
+ *
+ * @param $wp_db_version (string) The new $wp_db_version
+ * @return $wp_current_db_version (string) The old (current) $wp_db_version
+ */
+
+ function wp_upgrade( $wp_db_version, $wp_current_db_version ) {
+
+ // vars
+ $acf_db_version = acf_get_db_version();
+
+
+ // termmeta was added in WP 4.4 (34370)
+ // if website has already updated to ACF 5.5.0, termmeta will not have yet been migrated
+ if( $wp_db_version >= 34370 && $wp_current_db_version < 34370 && acf_version_compare($acf_db_version, '>=', '5.5.0') ) {
+
+ $this->run_update('acf_update_550_termmeta');
+
+ }
+
+ }
+
+}
+
+
+// initialize
+acf()->admin->install = new acf_admin_install();
+
+endif; // class_exists check
+
+
+/*
+* acf_get_db_version
+*
+* This function will return the current ACF DB version
+*
+* @type function
+* @date 10/09/2016
+* @since 5.4.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_get_db_version() {
+
+ return get_option('acf_version');
+
+}
+
+
+/*
+* acf_update_db_version
+*
+* This function will update the current ACF DB version
+*
+* @type function
+* @date 10/09/2016
+* @since 5.4.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_update_db_version( $version = '' ) {
+
+ // default to latest
+ if( !$version ) {
+
+ $version = acf_get_setting('version');
+
+ }
+
+
+ // update
+ update_option('acf_version', $version );
+
+}
+
+
+/*
+* acf_get_db_updates
+*
+* This function will return available db updates
+*
+* @type function
+* @date 12/05/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_get_db_updates() {
+
+ // vars
+ $available = array();
+ $db_updates = acf()->admin->install->db_updates;
+ $acf_version = acf_get_setting('version');
+ $db_version = acf_get_db_version();
+
+
+ // bail early if is fresh install
+ if( !$db_version ) {
+
+ acf_update_db_version($acf_version);
+ return false;
+
+ }
+
+
+ // bail early if is up to date
+ if( acf_version_compare($db_version, '>=', $acf_version)) return false;
+
+
+ // loop
+ foreach( $db_updates as $version => $callback ) {
+
+ // ignore if update is for a future version (may exist for testing)
+ if( acf_version_compare( $version, '>', $acf_version ) ) continue;
+
+
+ // ignore if update has already been run
+ if( acf_version_compare( $version, '<=', $db_version ) ) continue;
+
+
+ // append
+ $available[ $version ] = $callback;
+
+ }
+
+
+ // bail early if no updates available
+ // - also update DB to current version
+ if( empty($available) ) {
+
+ acf_update_db_version($acf_version);
+ return false;
+
+ }
+
+
+ // return
+ return $available;
+
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/settings-addons.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/settings-addons.php
new file mode 100644
index 0000000..0f84740
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/settings-addons.php
@@ -0,0 +1,123 @@
+view = array(
+ 'json' => array(),
+ );
+
+
+ // load json
+ $request = wp_remote_post( 'https://assets.advancedcustomfields.com/add-ons/add-ons.json' );
+
+ // validate
+ if( is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200)
+ {
+ acf_add_admin_notice(__('Error . Could not load add-ons list', 'acf'), 'error');
+ }
+ else
+ {
+ $this->view['json'] = json_decode( $request['body'], true );
+ }
+
+ }
+
+
+ /*
+ * html
+ *
+ * description
+ *
+ * @type function
+ * @date 7/01/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function html() {
+
+ // load view
+ acf_get_view('settings-addons', $this->view);
+
+ }
+
+}
+
+
+// initialize
+new acf_settings_addons();
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/settings-info.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/settings-info.php
new file mode 100644
index 0000000..563a2d4
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/settings-info.php
@@ -0,0 +1,102 @@
+ acf_get_setting('version'),
+ 'have_pro' => acf_get_setting('pro'),
+ 'tabs' => array(
+ 'new' => __("What's New", 'acf'),
+ 'changelog' => __("Changelog", 'acf')
+ ),
+ 'active' => 'new'
+ );
+
+
+ // set active tab
+ $tab = acf_maybe_get_GET('tab');
+ if( $tab && isset($view['tabs'][ $tab ]) ) {
+
+ $view['active'] = $tab;
+
+ }
+
+
+ // load view
+ acf_get_view('settings-info', $view);
+
+ }
+
+}
+
+
+// initialize
+new acf_settings_info();
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool-export.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool-export.php
new file mode 100644
index 0000000..c864284
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool-export.php
@@ -0,0 +1,592 @@
+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') , 'error');
+ }
+
+
+ // 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') , 'error');
+ }
+
+
+ // 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);
+ $message = sprintf( _n( 'Exported 1 field group.', 'Exported %s field groups.', $count, 'acf' ), $count );
+ acf_add_admin_notice( $message );
+ }
+ }
+
+ }
+
+
+ /**
+ * 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() {
+
+ ?>
+
+
+
+ html_field_selection(); ?>
+
+
+
+
+
+
+ __('Empty settings', 'acf'),
+ 'type' => 'select',
+ 'name' => 'minimal',
+ 'prefix' => false,
+ 'value' => '',
+ 'choices' => array(
+ 'all' => 'Include all settings',
+ 'minimal' => 'Ignore empty settings'
+ )
+ ));
+*/
+
+ ?>
+
+
+
+
+
+ html_field_selection(); ?>
+
+
+
+
+
+
+
+
+ html_generate(); ?>
+
+
+ html_panel_selection(); ?>
+
+
+
+
+
+ get_selected();
+ $str_replace = array(
+ " " => "\t",
+ "'!!__(!!\'" => "__('",
+ "!!\', !!\'" => "', '",
+ "!!\')!!'" => "')",
+ "array (" => "array("
+ );
+ $preg_replace = array(
+ '/([\t\r\n]+?)array/' => 'array',
+ '/[0-9]+ => array/' => 'array'
+ );
+
+
+ ?>
+
+
+
+
+
+
+ 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
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool-import.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool-import.php
new file mode 100644
index 0000000..0f209f1
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool-import.php
@@ -0,0 +1,277 @@
+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() {
+
+ // vars
+ $choices = array();
+ $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'] );
+ }
+ }
+
+
+ // html
+ ?>
+
+
+ __('Select File', 'acf'),
+ 'type' => 'file',
+ 'name' => 'acf_import_file',
+ 'value' => false,
+ 'uploader' => 'basic',
+ ));
+
+ ?>
+
+
+
+
+ $field_group['ID'],
+ 'title' => $field_group['title'],
+ 'updated' => $id ? 1 : 0
+ );
+
+ }
+
+
+ // messages
+ if( !empty($imported) ) {
+
+ // vars
+ $links = array();
+ $count = count($imported);
+ $message = sprintf(_n( 'Imported 1 field group', 'Imported %s field groups', $count, 'acf' ), $count) . '.';
+
+
+ // populate links
+ foreach( $imported as $import ) {
+
+ $links[] = '' . $import['title'] . ' ';
+
+ }
+
+
+ // append links
+ $message .= ' ' . implode(', ', $links);
+
+
+ // add notice
+ acf_add_admin_notice( $message );
+
+ }
+
+ }
+
+
+}
+
+// initialize
+acf_register_admin_tool( 'acf_admin_tool_import' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool.php
new file mode 100644
index 0000000..9f4c683
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool.php
@@ -0,0 +1,195 @@
+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
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field-conditional-logic.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field-conditional-logic.php
new file mode 100644
index 0000000..90ca027
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field-conditional-logic.php
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+ 'true_false',
+ 'name' => 'conditional_logic',
+ 'prefix' => $field['prefix'],
+ 'value' => $disabled ? 0 : 1,
+ 'ui' => 1,
+ 'class' => 'conditional-toggle',
+ ));
+
+ ?>
+ style="display:none;">
+
+ $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');
+
+ ?>
+
+
+
+
+
+
+ $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}]";
+
+ ?>
+
+
+ 'select',
+ 'prefix' => $prefix,
+ 'name' => 'field',
+ 'value' => $rule['field'],
+ 'choices' => $choices,
+ 'class' => 'conditional-rule-param',
+ 'disabled' => $disabled,
+ ));
+
+ ?>
+
+
+ __("is equal to",'acf'),
+ '!=' => __("is not equal to",'acf'),
+ );
+
+
+ // create field
+ acf_render_field(array(
+ 'type' => 'select',
+ 'prefix' => $prefix,
+ 'name' => 'operator',
+ 'value' => $rule['operator'],
+ 'choices' => $choices,
+ 'class' => 'conditional-rule-operator',
+ 'disabled' => $disabled,
+ ));
+
+ ?>
+
+
+ 'select',
+ 'prefix' => $prefix,
+ 'name' => 'value',
+ 'value' => $rule['value'],
+ 'choices' => $choices,
+ 'class' => 'conditional-rule-value',
+ 'disabled' => $disabled,
+ ));
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field.php
new file mode 100644
index 0000000..4da8f07
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field.php
@@ -0,0 +1,186 @@
+ "acf-field-object acf-field-object-{$field['type']}",
+ 'data-id' => $field['ID'],
+ 'data-key' => $field['key'],
+ 'data-type' => $field['type'],
+);
+
+$meta = array(
+ 'ID' => $field['ID'],
+ 'key' => $field['key'],
+ 'parent' => $field['parent'],
+ 'menu_order' => $field['menu_order'],
+ 'save' => '',
+);
+
+
+// class
+$atts['class'] = str_replace('_', '-', $atts['class']);
+
+?>
+>
+
+
+ $v ):
+
+ acf_hidden_input(array( 'class' => "input-{$k}", 'name' => "{$field['prefix']}[{$k}]", 'value' => $v ));
+
+ endforeach; ?>
+
+
+
+
+
+
+
+ __('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_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');
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-fields.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-fields.php
new file mode 100644
index 0000000..4a227cc
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-fields.php
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
>
+ + Add Field button to create your first field.",'acf'); ?>
+
+
+ $field ):
+
+ acf_get_view('field-group-field', array( 'field' => $field, 'i' => $i ));
+
+ endforeach;
+
+ endif; ?>
+
+
+
+
+
+ 'acfcloneindex',
+ 'key' => 'acfcloneindex',
+ 'label' => __('New Field','acf'),
+ 'name' => 'new_field',
+ 'type' => 'text'
+ ));
+
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-locations.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-locations.php
new file mode 100644
index 0000000..9995003
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-locations.php
@@ -0,0 +1,45 @@
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-options.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-options.php
new file mode 100644
index 0000000..4d9ab17
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-options.php
@@ -0,0 +1,150 @@
+ __('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
+acf_render_field_wrap(array(
+ 'label' => __('Hide on screen','acf'),
+ 'instructions' => __('Select items to hide them from the edit screen.','acf') . ' ' . __("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' => 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'),
+ )
+));
+
+
+// 3rd party settings
+do_action('acf/render_field_group_settings', $field_group);
+
+?>
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-admin-tools.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-admin-tools.php
new file mode 100644
index 0000000..e1b0f23
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-admin-tools.php
@@ -0,0 +1,27 @@
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-location-group.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-location-group.php
new file mode 100644
index 0000000..378f39f
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-location-group.php
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+ $rule ):
+
+ // append id
+ $rule['id'] = "rule_{$i}";
+ $rule['group'] = $group_id;
+
+
+ // valid rule
+ $rule = acf_get_valid_location_rule($rule);
+
+
+ // view
+ acf_get_view('html-location-rule', array(
+ 'rule' => $rule
+ ));
+
+ endforeach; ?>
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-location-rule.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-location-rule.php
new file mode 100644
index 0000000..1f29fa0
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-location-rule.php
@@ -0,0 +1,85 @@
+
+
+ 'select',
+ 'name' => 'param',
+ 'prefix' => $rule['prefix'],
+ 'value' => $rule['param'],
+ 'choices' => $choices,
+ 'class' => 'refresh-location-rule'
+ ));
+
+ }
+
+ ?>
+
+
+ 'select',
+ 'name' => 'operator',
+ 'prefix' => $rule['prefix'],
+ 'value' => $rule['operator'],
+ 'choices' => $choices
+ ));
+
+ // custom
+ } else {
+
+ echo $choices;
+
+ }
+
+ ?>
+
+
+ 'select',
+ 'name' => 'value',
+ 'prefix' => $rule['prefix'],
+ 'value' => $rule['value'],
+ 'choices' => $choices
+ ));
+
+ // custom
+ } else {
+
+ echo $choices;
+
+ }
+
+ ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/install-network.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/install-network.php
new file mode 100644
index 0000000..8d8d206
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/install-network.php
@@ -0,0 +1,235 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Return to network dashboard', 'acf'), network_admin_url() ); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/install-notice.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/install-notice.php
new file mode 100644
index 0000000..f45e1dc
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/install-notice.php
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/install.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/install.php
new file mode 100644
index 0000000..b4ccaf9
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/install.php
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
See what\'s new', 'acf' ), admin_url('edit.php?post_type=acf-field-group&page=acf-settings-info') ); ?>
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/settings-addons.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/settings-addons.php
new file mode 100644
index 0000000..73df28f
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/settings-addons.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+ "",
+ "slug" => "",
+ "description" => "",
+ "thumbnail" => "",
+ "url" => "",
+ "btn" => __("Download & Install",'acf'),
+ "btn_color" => ""
+ ));
+
+ ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/settings-info.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/settings-info.php
new file mode 100644
index 0000000..e7a3620
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/settings-info.php
@@ -0,0 +1,183 @@
+
+
+
+
+
+
+
+
+
+ $tab_title ): ?>
+ ">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Pro version of ACF. With both personal and developer licenses available, premium functionality is more affordable and accessible than ever before!', 'acf'), esc_url('https://www.advancedcustomfields.com/pro')); ?>
+
+
+
+
+
+
ACF PRO features.', 'acf'), esc_url('https://www.advancedcustomfields.com/pro')); ?>
+
+
+
+
+
login to your store account and claim a free copy of ACF PRO!', 'acf'), esc_url('https://www.advancedcustomfields.com/my-account/')); ?>
+
upgrade guide to answer any questions, but if you do have one, please contact our support team via the help desk ', 'acf'), esc_url('https://www.advancedcustomfields.com/resources/updates/upgrading-v4-v5/'), esc_url('https://support.advancedcustomfields.com')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/ajax.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/ajax.php
new file mode 100644
index 0000000..21dad7b
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/ajax.php
@@ -0,0 +1,86 @@
+ '',
+ 'value' => '',
+ 'nonce' => '',
+ ));
+
+
+ // validate
+ if( ! wp_verify_nonce($options['nonce'], 'acf_nonce') || empty($options['name']) ) {
+
+ die('0');
+
+ }
+
+
+ // upadte setting
+ acf_update_user_setting( $options['name'], $options['value'] );
+
+
+ // return
+ die('1');
+
+ }
+
+}
+
+new acf_ajax();
+
+endif;
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-field-group.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-field-group.php
new file mode 100644
index 0000000..1432cdb
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-field-group.php
@@ -0,0 +1,1273 @@
+ 0,
+ 'key' => '',
+ 'title' => '',
+ 'fields' => array(),
+ 'location' => array(),
+ 'menu_order' => 0,
+ 'position' => 'normal',
+ 'style' => 'default',
+ 'label_placement' => 'top',
+ 'instruction_placement' => 'label',
+ 'hide_on_screen' => array(),
+ 'active' => 1, // Added in 5.2.9
+ 'description' => '', // Added in 5.2.9
+ '_valid' => 0, // Added in 5.6.2
+ ));
+
+
+ // field is now valid
+ $field_group['_valid'] = 1;
+
+
+ // filter
+ $field_group = apply_filters('acf/validate_field_group', $field_group);
+
+
+ // translate
+ $field_group = acf_translate_field_group( $field_group );
+
+
+ // return
+ return $field_group;
+
+}
+
+
+/*
+* acf_translate_field_group
+*
+* This function will translate field group's settings
+*
+* @type function
+* @date 8/03/2016
+* @since 5.3.2
+*
+* @param $field_group (array)
+* @return $field_group
+*/
+
+function acf_translate_field_group( $field_group ) {
+
+ // vars
+ $l10n = acf_get_setting('l10n');
+ $l10n_textdomain = acf_get_setting('l10n_textdomain');
+
+
+ // if
+ if( $l10n && $l10n_textdomain ) {
+
+ // translate
+ $field_group['title'] = acf_translate( $field_group['title'] );
+
+
+ // filters
+ $field_group = apply_filters( "acf/translate_field_group", $field_group );
+
+ }
+
+
+ // return
+ return $field_group;
+
+}
+
+
+/*
+* acf_get_field_groups
+*
+* This function will return an array of field groupss for the given args. Similar to the WP get_posts function
+*
+* @type function
+* @date 30/09/13
+* @since 5.0.0
+*
+* @param $args (array)
+* @return $field_groups (array)
+*/
+
+function acf_get_field_groups( $args = false ) {
+
+ // vars
+ $field_groups = array();
+ $post_ids = array();
+ $cache_key = "get_field_groups";
+
+
+ // check cache for ids
+ if( acf_isset_cache($cache_key) ) {
+
+ $post_ids = acf_get_cache($cache_key);
+
+ // query DB for child ids
+ } else {
+
+ // query
+ $posts = get_posts(array(
+ 'post_type' => 'acf-field-group',
+ 'posts_per_page' => -1,
+ 'orderby' => 'menu_order title',
+ 'order' => 'asc',
+ 'suppress_filters' => false, // allow WPML to modify the query
+ 'post_status' => array('publish', 'acf-disabled'),
+ 'update_post_meta_cache' => false
+ ));
+
+
+ // loop
+ if( $posts ) {
+
+ foreach( $posts as $post ) {
+
+ $post_ids[] = $post->ID;
+
+ }
+
+ }
+
+
+ // update cache
+ acf_set_cache($cache_key, $post_ids);
+
+ }
+
+
+ // load field groups
+ foreach( $post_ids as $post_id ) {
+
+ $field_groups[] = acf_get_field_group( $post_id );
+
+ }
+
+
+ // filter
+ // - allows local field groups to be appended
+ $field_groups = apply_filters('acf/get_field_groups', $field_groups);
+
+
+ // filter via args
+ if( $args ) {
+
+ $field_groups = acf_filter_field_groups( $field_groups, $args );
+
+ }
+
+
+ // return
+ return $field_groups;
+
+}
+
+
+/*
+* acf_filter_field_groups
+*
+* This function is used by acf_get_field_groups to filter out fields groups based on location rules
+*
+* @type function
+* @date 29/11/2013
+* @since 5.0.0
+*
+* @param $field_groups (array)
+* @param $args (array)
+* @return $field_groups (array)
+*/
+
+function acf_filter_field_groups( $field_groups, $args = false ) {
+
+ // bail early if empty sargs
+ if( empty($args) || empty($field_groups) ) {
+
+ return $field_groups;
+
+ }
+
+
+ // vars
+ $keys = array_keys( $field_groups );
+
+
+ // loop through keys
+ foreach( $keys as $key ) {
+
+ // get visibility
+ $visibility = acf_get_field_group_visibility( $field_groups[ $key ], $args );
+
+
+ // unset
+ if( !$visibility ) {
+
+ unset($field_groups[ $key ]);
+
+ }
+
+ }
+
+
+ // re assign index
+ $field_groups = array_values( $field_groups );
+
+
+ // return
+ return $field_groups;
+
+}
+
+
+/*
+* acf_get_field_group_visibility
+*
+* This function will look at the given field group's location rules and compare them against
+* the args given to see if this field group is to be shown or not.
+*
+* @type function
+* @date 7/10/13
+* @since 5.0.0
+*
+* @param $field group (array)
+* @param $args (array)
+* @return (boolean)
+*/
+
+function acf_get_field_group_visibility( $field_group, $args = array() ) {
+
+ // bail early if not active
+ if( !$field_group['active'] ) return false;
+
+
+ // bail early if no location rules
+ if( empty($field_group['location']) ) return false;
+
+
+ // get screen
+ $screen = acf_get_location_screen( $args, $field_group );
+
+
+ // loop through location rules
+ foreach( $field_group['location'] as $group_id => $group ) {
+
+ // continue if no rules
+ if( empty($group) ) continue;
+
+
+ // vars
+ $match_group = true;
+
+
+ // loop
+ foreach( $group as $rule_id => $rule ) {
+
+ // bail ealry if no match
+ if( !acf_match_location_rule( $rule, $screen ) ) {
+
+ $match_group = false;
+ break;
+
+ }
+
+ }
+
+
+ // this group matches screen. Ignore remaining groups and retunr true
+ if( $match_group ) return true;
+
+ }
+
+
+ // return
+ return false;
+}
+
+
+/*
+* acf_get_field_group
+*
+* This function will take either a post object, post ID or even null (for global $post), and
+* will then return a valid field group array
+*
+* @type function
+* @date 30/09/13
+* @since 5.0.0
+*
+* @param $selector (mixed)
+* @return $field_group (array)
+*/
+
+function acf_get_field_group( $selector = null ) {
+
+ // vars
+ $field_group = false;
+ $type = 'ID';
+
+
+ // ID
+ if( is_numeric($selector) ) {
+
+ // do nothing
+
+ // object
+ } elseif( is_object($selector) ) {
+
+ $selector = $selector->ID;
+
+ // string
+ } elseif( is_string($selector) ) {
+
+ $type = 'key';
+
+ // other
+ } else {
+
+ return false;
+
+ }
+
+
+ // return early if cache is found
+ $cache_key = "get_field_group/{$type}={$selector}";
+
+ if( acf_isset_cache($cache_key) ) {
+
+ return acf_get_cache($cache_key);
+
+ }
+
+
+ // ID
+ if( $type == 'ID' ) {
+
+ $field_group = _acf_get_field_group_by_id( $selector );
+
+ // key
+ } else {
+
+ $field_group = _acf_get_field_group_by_key( $selector );
+
+ }
+
+
+ // bail early if no field
+ if( !$field_group ) return false;
+
+
+ // validate
+ $field_group = acf_get_valid_field_group( $field_group );
+
+
+ // filter for 3rd party customization
+ $field_group = apply_filters('acf/get_field_group', $field_group);
+
+
+ // update cache
+ // - Use key instead of ID for best compatibility (not all field groups exist in the DB)
+ $cache_key = acf_set_cache("get_field_group/key={$field_group['key']}", $field_group);
+
+
+ // update cache reference
+ // - allow cache to return if using an ID selector
+ acf_set_cache_reference("get_field_group/ID={$field_group['ID']}", $cache_key);
+
+
+ // return
+ return $field_group;
+
+}
+
+
+/*
+* _acf_get_field_group_by_id
+*
+* This function will get a field group by its ID
+*
+* @type function
+* @date 27/02/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $field_group (array)
+*/
+
+function _acf_get_field_group_by_id( $post_id = 0 ) {
+
+ // get post
+ $post = get_post( $post_id );
+
+
+ // bail early if no post, or is not a field group
+ if( empty($post) || $post->post_type != 'acf-field-group' ) return false;
+
+
+ // modify post_status (new field-group starts as auto-draft)
+ if( $post->post_status == 'auto-draft' ) {
+
+ $post->post_status = 'publish';
+
+ }
+
+
+ // unserialize data
+ $field_group = maybe_unserialize( $post->post_content );
+
+
+ // new field group does not contain any post_content
+ if( empty($field_group) ) $field_group = array();
+
+
+ // update attributes
+ $field_group['ID'] = $post->ID;
+ $field_group['title'] = $post->post_title;
+ $field_group['key'] = $post->post_name;
+ $field_group['menu_order'] = $post->menu_order;
+ $field_group['active'] = ($post->post_status === 'publish') ? 1 : 0;
+
+
+ // override with JSON
+ if( acf_is_local_field_group( $field_group['key'] ) ) {
+
+ // load JSON field
+ $local = acf_get_local_field_group( $field_group['key'] );
+
+
+ // restore ID
+ $local['ID'] = $post->ID;
+
+
+ // return
+ return $local;
+
+ }
+
+
+ // return
+ return $field_group;
+
+}
+
+
+/*
+* _acf_get_field_group_by_key
+*
+* This function will get a field group by its key
+*
+* @type function
+* @date 27/02/2014
+* @since 5.0.0
+*
+* @param $key (string)
+* @return $field_group (array)
+*/
+
+function _acf_get_field_group_by_key( $key = '' ) {
+
+ // try JSON before DB to save query time
+ if( acf_is_local_field_group( $key ) ) {
+
+ return acf_get_local_field_group( $key );
+
+ }
+
+
+ // vars
+ $post_id = acf_get_field_group_id( $key );
+
+
+ // bail early if no post_id
+ if( !$post_id ) return false;
+
+
+ // return
+ return _acf_get_field_group_by_id( $post_id );
+
+}
+
+
+/*
+* acf_get_field_group_id
+*
+* This function will lookup a field group's ID from the DB
+* Useful for local fields to find DB sibling
+*
+* @type function
+* @date 25/06/2015
+* @since 5.5.8
+*
+* @param $key (string)
+* @return $post_id (int)
+*/
+
+function acf_get_field_group_id( $key = '' ) {
+
+ // vars
+ $args = array(
+ 'posts_per_page' => 1,
+ 'post_type' => 'acf-field-group',
+ 'orderby' => 'menu_order title',
+ 'order' => 'ASC',
+ 'suppress_filters' => false,
+ 'post_status' => array('publish', 'acf-disabled', 'trash'),
+ 'acf_group_key' => $key
+ );
+
+
+ // load posts
+ $posts = get_posts( $args );
+
+
+ // validate
+ if( empty($posts) ) return 0;
+
+
+ // return
+ return $posts[0]->ID;
+
+}
+
+
+/*
+* acf_update_field_group
+*
+* This function will update a field group into the database.
+* The returned field group will always contain an ID
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $field_group (array)
+* @return $field_group (array)
+*/
+
+function acf_update_field_group( $field_group = array() ) {
+
+ // validate
+ $field_group = acf_get_valid_field_group( $field_group );
+
+
+ // may have been posted. Remove slashes
+ $field_group = wp_unslash( $field_group );
+
+
+ // parse types (converts string '0' to int 0)
+ $field_group = acf_parse_types( $field_group );
+
+
+ // locations may contain 'uniquid' array keys
+ $field_group['location'] = array_values( $field_group['location'] );
+
+ foreach( $field_group['location'] as $k => $v ) {
+
+ $field_group['location'][ $k ] = array_values( $v );
+
+ }
+
+
+ // store origional field group for return
+ $data = $field_group;
+
+
+ // extract some args
+ $extract = acf_extract_vars($data, array(
+ 'ID',
+ 'key',
+ 'title',
+ 'menu_order',
+ 'fields',
+ 'active',
+ '_valid'
+ ));
+
+
+ // vars
+ $data = maybe_serialize( $data );
+ $post_status = $extract['active'] ? 'publish' : 'acf-disabled';
+
+
+ // save
+ $save = array(
+ 'ID' => $extract['ID'],
+ 'post_status' => $post_status,
+ 'post_type' => 'acf-field-group',
+ 'post_title' => $extract['title'],
+ 'post_name' => $extract['key'],
+ 'post_excerpt' => sanitize_title($extract['title']),
+ 'post_content' => $data,
+ 'menu_order' => $extract['menu_order'],
+ );
+
+
+ // allow field groups to contain the same name
+ add_filter( 'wp_unique_post_slug', 'acf_update_field_group_wp_unique_post_slug', 100, 6 );
+
+
+ // slash data
+ // - WP expects all data to be slashed and will unslash it (fixes '\' character issues)
+ $save = wp_slash( $save );
+
+
+ // update the field group and update the ID
+ if( $field_group['ID'] ) {
+
+ wp_update_post( $save );
+
+ } else {
+
+ $field_group['ID'] = wp_insert_post( $save );
+
+ }
+
+
+ // action for 3rd party customization
+ do_action('acf/update_field_group', $field_group);
+
+
+ // clear cache
+ acf_delete_cache("get_field_group/key={$field_group['key']}");
+
+
+ // return
+ return $field_group;
+
+}
+
+function acf_update_field_group_wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
+
+ if( $post_type == 'acf-field-group' ) {
+
+ $slug = $original_slug;
+
+ }
+
+ return $slug;
+}
+
+
+/*
+* acf_duplicate_field_group
+*
+* This function will duplicate a field group into the database
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $selector (mixed)
+* @param $new_post_id (int) allow specific ID to override (good for WPML translations)
+* @return $field_group (array)
+*/
+
+function acf_duplicate_field_group( $selector = 0, $new_post_id = 0 ) {
+
+ // disable filters to ensure ACF loads raw data from DB
+ acf_disable_filters();
+
+
+ // load the origional field gorup
+ $field_group = acf_get_field_group( $selector );
+
+
+ // bail early if field group did not load correctly
+ if( empty($field_group) ) {
+
+ return false;
+
+ }
+
+
+ // keep backup of field group
+ $orig_field_group = $field_group;
+
+
+ // update ID
+ $field_group['ID'] = $new_post_id;
+ $field_group['key'] = uniqid('group_');
+
+
+ // add (copy)
+ if( !$new_post_id ) {
+
+ $field_group['title'] .= ' (' . __("copy", 'acf') . ')';
+
+ }
+
+
+ // save
+ $field_group = acf_update_field_group( $field_group );
+
+
+ // get fields
+ $fields = acf_get_fields( $orig_field_group );
+
+
+ // duplicate fields
+ acf_duplicate_fields( $fields, $field_group['ID'] );
+
+
+ // action for 3rd party customization
+ do_action('acf/duplicate_field_group', $field_group);
+
+
+ // return
+ return $field_group;
+
+}
+
+
+/*
+* acf_get_field_count
+*
+* This function will return the number of fields for the given field group
+*
+* @type function
+* @date 17/10/13
+* @since 5.0.0
+*
+* @param $field_group_id (int)
+* @return (int)
+*/
+
+function acf_get_field_count( $field_group ) {
+
+ // vars
+ $count = 0;
+
+
+ // local
+ if( !$field_group['ID'] ) {
+
+ $count = acf_count_local_fields( $field_group['key'] );
+
+ // DB
+ } else {
+
+ // load fields
+ $posts = get_posts(array(
+ 'posts_per_page' => -1,
+ 'post_type' => 'acf-field',
+ 'orderby' => 'menu_order',
+ 'order' => 'ASC',
+ 'suppress_filters' => true, // DO NOT allow WPML to modify the query
+ 'post_parent' => $field_group['ID'],
+ 'fields' => 'ids',
+ 'post_status' => 'publish, trash' // 'any' won't get trashed fields
+ ));
+
+ $count = count($posts);
+
+ }
+
+
+ // filter for 3rd party customization
+ $count = apply_filters('acf/get_field_count', $count, $field_group);
+
+
+ // return
+ return $count;
+
+}
+
+
+/*
+* acf_delete_field_group
+*
+* This function will delete the field group and its fields from the DB
+*
+* @type function
+* @date 5/12/2013
+* @since 5.0.0
+*
+* @param $selector (mixed)
+* @return (boolean)
+*/
+
+function acf_delete_field_group( $selector = 0 ) {
+
+ // disable filters to ensure ACF loads raw data from DB
+ acf_disable_filters();
+
+
+ // load the origional field gorup
+ $field_group = acf_get_field_group( $selector );
+
+
+ // bail early if field group did not load correctly
+ if( empty($field_group) ) return false;
+
+
+ // get fields
+ $fields = acf_get_fields($field_group);
+
+
+ if( !empty($fields) ) {
+
+ foreach( $fields as $field ) {
+
+ acf_delete_field( $field['ID'] );
+
+ }
+
+ }
+
+
+ // delete
+ wp_delete_post( $field_group['ID'] );
+
+
+ // action for 3rd party customization
+ do_action('acf/delete_field_group', $field_group);
+
+
+ // return
+ return true;
+}
+
+
+/*
+* acf_trash_field_group
+*
+* This function will trash the field group and its fields
+*
+* @type function
+* @date 5/12/2013
+* @since 5.0.0
+*
+* @param $selector (mixed)
+* @return (boolean)
+*/
+
+function acf_trash_field_group( $selector = 0 ) {
+
+ // disable filters to ensure ACF loads raw data from DB
+ acf_disable_filters();
+
+
+ // load the origional field gorup
+ $field_group = acf_get_field_group( $selector );
+
+
+ // bail early if field group did not load correctly
+ if( empty($field_group) ) return false;
+
+
+ // get fields
+ $fields = acf_get_fields($field_group);
+
+
+ if( !empty($fields) ) {
+
+ foreach( $fields as $field ) {
+
+ acf_trash_field( $field['ID'] );
+
+ }
+
+ }
+
+
+ // delete
+ wp_trash_post( $field_group['ID'] );
+
+
+ // action for 3rd party customization
+ do_action('acf/trash_field_group', $field_group);
+
+
+ // return
+ return true;
+}
+
+
+/*
+* acf_untrash_field_group
+*
+* This function will restore from trash the field group and its fields
+*
+* @type function
+* @date 5/12/2013
+* @since 5.0.0
+*
+* @param $selector (mixed)
+* @return (boolean)
+*/
+
+function acf_untrash_field_group( $selector = 0 ) {
+
+ // disable filters to ensure ACF loads raw data from DB
+ acf_disable_filters();
+
+
+ // load the origional field gorup
+ $field_group = acf_get_field_group( $selector );
+
+
+ // bail early if field group did not load correctly
+ if( empty($field_group) ) return false;
+
+
+ // get fields
+ $fields = acf_get_fields($field_group);
+
+
+ if( !empty($fields) ) {
+
+ foreach( $fields as $field ) {
+
+ acf_untrash_field( $field['ID'] );
+
+ }
+
+ }
+
+
+ // delete
+ wp_untrash_post( $field_group['ID'] );
+
+
+ // action for 3rd party customization
+ do_action('acf/untrash_field_group', $field_group);
+
+
+ // return
+ return true;
+}
+
+
+
+/*
+* acf_get_field_group_style
+*
+* This function will render the CSS for a given field group
+*
+* @type function
+* @date 20/10/13
+* @since 5.0.0
+*
+* @param $field_group (array)
+* @return n/a
+*/
+
+function acf_get_field_group_style( $field_group ) {
+
+ // vars
+ $e = '';
+
+
+ // bail early if no array or is empty
+ if( !acf_is_array($field_group['hide_on_screen']) ) return $e;
+
+
+ // add style to html
+ if( in_array('permalink',$field_group['hide_on_screen']) )
+ {
+ $e .= '#edit-slug-box {display: none;} ';
+ }
+
+ if( in_array('the_content',$field_group['hide_on_screen']) )
+ {
+ $e .= '#postdivrich {display: none;} ';
+ }
+
+ if( in_array('excerpt',$field_group['hide_on_screen']) )
+ {
+ $e .= '#postexcerpt, #screen-meta label[for=postexcerpt-hide] {display: none;} ';
+ }
+
+ if( in_array('custom_fields',$field_group['hide_on_screen']) )
+ {
+ $e .= '#postcustom, #screen-meta label[for=postcustom-hide] { display: none; } ';
+ }
+
+ if( in_array('discussion',$field_group['hide_on_screen']) )
+ {
+ $e .= '#commentstatusdiv, #screen-meta label[for=commentstatusdiv-hide] {display: none;} ';
+ }
+
+ if( in_array('comments',$field_group['hide_on_screen']) )
+ {
+ $e .= '#commentsdiv, #screen-meta label[for=commentsdiv-hide] {display: none;} ';
+ }
+
+ if( in_array('slug',$field_group['hide_on_screen']) )
+ {
+ $e .= '#slugdiv, #screen-meta label[for=slugdiv-hide] {display: none;} ';
+ }
+
+ if( in_array('author',$field_group['hide_on_screen']) )
+ {
+ $e .= '#authordiv, #screen-meta label[for=authordiv-hide] {display: none;} ';
+ }
+
+ if( in_array('format',$field_group['hide_on_screen']) )
+ {
+ $e .= '#formatdiv, #screen-meta label[for=formatdiv-hide] {display: none;} ';
+ }
+
+ if( in_array('page_attributes',$field_group['hide_on_screen']) )
+ {
+ $e .= '#pageparentdiv {display: none;} ';
+ }
+
+ if( in_array('featured_image',$field_group['hide_on_screen']) )
+ {
+ $e .= '#postimagediv, #screen-meta label[for=postimagediv-hide] {display: none;} ';
+ }
+
+ if( in_array('revisions',$field_group['hide_on_screen']) )
+ {
+ $e .= '#revisionsdiv, #screen-meta label[for=revisionsdiv-hide] {display: none;} ';
+ }
+
+ if( in_array('categories',$field_group['hide_on_screen']) )
+ {
+ $e .= '#categorydiv, #screen-meta label[for=categorydiv-hide] {display: none;} ';
+ }
+
+ if( in_array('tags',$field_group['hide_on_screen']) )
+ {
+ $e .= '#tagsdiv-post_tag, #screen-meta label[for=tagsdiv-post_tag-hide] {display: none;} ';
+ }
+
+ if( in_array('send-trackbacks',$field_group['hide_on_screen']) )
+ {
+ $e .= '#trackbacksdiv, #screen-meta label[for=trackbacksdiv-hide] {display: none;} ';
+ }
+
+
+ // return
+ return apply_filters('acf/get_field_group_style', $e, $field_group);
+
+}
+
+
+/*
+* acf_import_field_group
+*
+* This function will import a field group from JSON into the DB
+*
+* @type function
+* @date 10/12/2014
+* @since 5.1.5
+*
+* @param $field_group (array)
+* @return $id (int)
+*/
+
+function acf_import_field_group( $field_group ) {
+
+ // disable filters to ensure ACF loads raw data from DB
+ acf_disable_filters();
+
+
+ // vars
+ $ref = array();
+ $order = array();
+
+
+ // extract fields
+ $fields = acf_extract_var($field_group, 'fields');
+
+
+ // format fields
+ $fields = acf_prepare_fields_for_import( $fields );
+
+
+ // remove old fields
+ if( $field_group['ID'] ) {
+
+ // load fields
+ $db_fields = acf_get_fields_by_id( $field_group['ID'] );
+ $db_fields = acf_prepare_fields_for_import( $db_fields );
+
+
+ // get field keys
+ $keys = array();
+ foreach( $fields as $field ) {
+
+ $keys[] = $field['key'];
+
+ }
+
+
+ // loop over db fields
+ foreach( $db_fields as $field ) {
+
+ // add to ref
+ $ref[ $field['key'] ] = $field['ID'];
+
+
+ if( !in_array($field['key'], $keys) ) {
+
+ acf_delete_field( $field['ID'] );
+
+ }
+
+ }
+
+ }
+
+
+ // enable local filter for JSON to be created
+ acf_enable_filter('local');
+
+
+ // save field group
+ $field_group = acf_update_field_group( $field_group );
+
+
+ // add to ref
+ $ref[ $field_group['key'] ] = $field_group['ID'];
+
+
+ // add to order
+ $order[ $field_group['ID'] ] = 0;
+
+
+ // add fields
+ foreach( $fields as $field ) {
+
+ // add ID
+ if( !$field['ID'] && isset($ref[ $field['key'] ]) ) {
+
+ $field['ID'] = $ref[ $field['key'] ];
+
+ }
+
+
+ // add parent
+ if( empty($field['parent']) ) {
+
+ $field['parent'] = $field_group['ID'];
+
+ } elseif( isset($ref[ $field['parent'] ]) ) {
+
+ $field['parent'] = $ref[ $field['parent'] ];
+
+ }
+
+
+ // add field menu_order
+ if( !isset($order[ $field['parent'] ]) ) {
+
+ $order[ $field['parent'] ] = 0;
+
+ }
+
+ $field['menu_order'] = $order[ $field['parent'] ];
+ $order[ $field['parent'] ]++;
+
+
+ // save field
+ $field = acf_update_field( $field );
+
+
+ // add to ref
+ $ref[ $field['key'] ] = $field['ID'];
+
+ }
+
+
+ // return new field group
+ return $field_group;
+
+}
+
+
+/*
+* acf_prepare_field_group_for_export
+*
+* description
+*
+* @type function
+* @date 4/12/2015
+* @since 5.3.2
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_prepare_field_group_for_export( $field_group ) {
+
+ // extract some args
+ $extract = acf_extract_vars($field_group, array(
+ 'ID',
+ 'local', // local may have added 'php' or 'json'
+ '_valid',
+ ));
+
+
+ // prepare fields
+ $field_group['fields'] = acf_prepare_fields_for_export( $field_group['fields'] );
+
+
+ // filter for 3rd party customization
+ $field_group = apply_filters('acf/prepare_field_group_for_export', $field_group);
+
+
+ // return
+ return $field_group;
+}
+
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-field.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-field.php
new file mode 100644
index 0000000..abf5075
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-field.php
@@ -0,0 +1,2024 @@
+ 0,
+ 'key' => '',
+ 'label' => '',
+ 'name' => '',
+ 'prefix' => '',
+ 'type' => 'text',
+ 'value' => null,
+ 'menu_order' => 0,
+ 'instructions' => '',
+ 'required' => 0,
+ 'id' => '',
+ 'class' => '',
+ 'conditional_logic' => 0,
+ 'parent' => 0,
+ 'wrapper' => array(),
+ '_name' => '',
+ '_prepare' => 0,
+ '_valid' => 0,
+ ));
+
+ $field['wrapper'] = wp_parse_args($field['wrapper'], array(
+ 'width' => '',
+ 'class' => '',
+ 'id' => ''
+ ));
+
+
+ // _name
+ $field['_name'] = $field['name'];
+
+
+ // field is now valid
+ $field['_valid'] = 1;
+
+
+ // field specific defaults
+ $field = apply_filters( "acf/validate_field", $field );
+ $field = apply_filters( "acf/validate_field/type={$field['type']}", $field );
+
+
+ // translate
+ $field = acf_translate_field( $field );
+
+
+ // return
+ return $field;
+
+}
+
+
+/*
+* acf_translate_field
+*
+* This function will translate field's settings
+*
+* @type function
+* @date 8/03/2016
+* @since 5.3.2
+*
+* @param $field (array)
+* @return $field
+*/
+
+function acf_translate_field( $field ) {
+
+ // vars
+ $l10n = acf_get_setting('l10n');
+ $l10n_textdomain = acf_get_setting('l10n_textdomain');
+
+
+ // if
+ if( $l10n && $l10n_textdomain ) {
+
+ // translate
+ $field['label'] = acf_translate( $field['label'] );
+ $field['instructions'] = acf_translate( $field['instructions'] );
+
+
+ // filters
+ $field = apply_filters( "acf/translate_field", $field );
+ $field = apply_filters( "acf/translate_field/type={$field['type']}", $field );
+
+ }
+
+
+ // return
+ return $field;
+
+}
+
+
+/*
+* acf_clone_field
+*
+* This function will allow customization to a field when it is cloned
+* Cloning a field is the act of mimicing another. Some settings may need to be altered
+*
+* @type function
+* @date 8/03/2016
+* @since 5.3.2
+*
+* @param $field (array)
+* @return $field
+*/
+
+function acf_clone_field( $field, $clone_field ) {
+
+ // add reference
+ $field['_clone'] = $clone_field['key'];
+
+
+ // filters
+ $field = apply_filters( "acf/clone_field", $field, $clone_field );
+ $field = apply_filters( "acf/clone_field/type={$field['type']}", $field, $clone_field );
+
+
+ // return
+ return $field;
+
+}
+
+
+/*
+* acf_prepare_field
+*
+* This function will prepare the field for input
+*
+* @type function
+* @date 12/02/2014
+* @since 5.0.0
+*
+* @param $field (array)
+* @return $field (array)
+*/
+
+function acf_prepare_field( $field ) {
+
+ // bail early if already prepared
+ if( $field['_prepare'] ) return $field;
+
+
+ // key overrides name
+ if( $field['key'] ) $field['name'] = $field['key'];
+
+
+ // prefix
+ if( $field['prefix'] ) $field['name'] = $field['prefix'] . '[' . $field['name'] . ']';
+
+
+ // field is now prepared
+ $field['_prepare'] = 1;
+
+
+ // filter to 3rd party customization
+ $field = apply_filters( "acf/prepare_field", $field );
+ $field = apply_filters( "acf/prepare_field/type={$field['type']}", $field );
+ $field = apply_filters( "acf/prepare_field/name={$field['_name']}", $field );
+ $field = apply_filters( "acf/prepare_field/key={$field['key']}", $field );
+
+
+ // bail ealry if no field
+ if( !$field ) return false;
+
+
+ // id attr is generated from name
+ $field['id'] = str_replace(array('][', '[', ']'), array('-', '-', ''), $field['name']);
+
+
+ // return
+ return $field;
+
+}
+
+
+/*
+* acf_is_sub_field
+*
+* This function will return true if the field is a sub field
+*
+* @type function
+* @date 17/05/2014
+* @since 5.0.0
+*
+* @param $field (array)
+* @return (boolean)
+*/
+
+function acf_is_sub_field( $field ) {
+
+ // local field uses a field instead of ID
+ if( acf_is_field_key($field['parent']) ) return true;
+
+
+ // attempt to load parent field
+ if( acf_get_field($field['parent']) ) return true;
+
+
+ // return
+ return false;
+
+}
+
+
+/*
+* acf_get_field_label
+*
+* This function will return the field label with appropriate required label
+*
+* @type function
+* @date 4/11/2013
+* @since 5.0.0
+*
+* @param $field (array)
+* @return $label (string)
+*/
+
+function acf_get_field_label( $field ) {
+
+ // vars
+ $label = $field['label'];
+
+
+ // required
+ if( $field['required'] ) {
+ $label .= ' * ';
+ }
+
+
+ // filter for 3rd party customization
+ $label = apply_filters("acf/get_field_label", $label, $field);
+
+
+ // return
+ return $label;
+
+}
+
+function acf_the_field_label( $field ) {
+
+ echo acf_get_field_label( $field );
+
+}
+
+
+/*
+* acf_render_fields
+*
+* This function will render an array of fields for a given form.
+* Becasue the $field's values have not been loaded yet, this function will also load values
+*
+* @type function
+* @date 8/10/13
+* @since 5.0.0
+*
+* @param $post_id (int) the post to load values from
+* @param $fields (array) the fields to render
+* @param $el (string) the wrapping element type
+* @param $instruction (int) the instructions position
+* @return n/a
+*/
+
+function acf_render_fields( $post_id = 0, $fields, $el = 'div', $instruction = 'label' ) {
+
+ // bail early if no fields
+ if( empty($fields) ) return false;
+
+
+ // remove corrupt fields
+ $fields = array_filter($fields);
+
+
+ // loop through fields
+ foreach( $fields as $field ) {
+
+ // load value
+ if( $field['value'] === null ) {
+
+ $field['value'] = acf_get_value( $post_id, $field );
+
+ }
+
+
+ // render
+ acf_render_field_wrap( $field, $el, $instruction );
+
+ }
+
+}
+
+
+/*
+* acf_render_field
+*
+* This function will render a field input
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $field (array)
+* @return n/a
+*/
+
+function acf_render_field( $field = false ) {
+
+ // get valid field
+ $field = acf_get_valid_field( $field );
+
+
+ // prepare field for input
+ $field = acf_prepare_field( $field );
+
+
+ // bail ealry if no field
+ if( !$field ) return;
+
+
+ // create field specific html
+ do_action( "acf/render_field", $field );
+ do_action( "acf/render_field/type={$field['type']}", $field );
+
+}
+
+
+/*
+* acf_render_field_wrap
+*
+* This function will render the complete HTML wrap with label & field
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $field (array) must be a valid ACF field array
+* @param $el (string) modifys the rendered wrapping elements. Default to 'div', but can be 'tr', 'ul', 'ol', 'dt' or custom
+* @param $instruction (string) specifys the placement of the instructions. Default to 'label', but can be 'field'
+* @param $atts (array) an array of custom attributes to render on the $el
+* @return N/A
+*/
+
+function acf_render_field_wrap( $field, $el = 'div', $instruction = 'label' ) {
+
+ // get valid field
+ $field = acf_get_valid_field( $field );
+
+
+ // prepare field for input
+ $field = acf_prepare_field( $field );
+
+
+ // bail ealry if no field
+ if( !$field ) return;
+
+
+ // elements
+ $elements = array(
+ 'div' => 'div',
+ 'tr' => 'td',
+ 'ul' => 'li',
+ 'ol' => 'li',
+ 'dl' => 'dt',
+ 'td' => 'div' // special case for sub field!
+ );
+
+
+ // vars
+ $el = isset($elements[ $el ]) ? $el : 'div';
+ $el2 = $elements[ $el ];
+ $show_label = ($el !== 'td') ? true : false;
+
+
+ // wrapper
+ $wrapper = array(
+ 'id' => '',
+ 'class' => 'acf-field',
+ 'width' => '',
+ 'style' => '',
+ 'data-name' => $field['_name'],
+ 'data-type' => $field['type'],
+ 'data-key' => '',
+ );
+
+
+ // add required
+ if( $field['required'] ) {
+ $wrapper['data-required'] = 1;
+ }
+
+
+ // add type
+ $wrapper['class'] .= " acf-field-{$field['type']}";
+
+
+ // add key
+ if( $field['key'] ) {
+
+ $wrapper['class'] .= " acf-field-{$field['key']}";
+ $wrapper['data-key'] = $field['key'];
+
+ }
+
+
+ // replace
+ $wrapper['class'] = str_replace('_', '-', $wrapper['class']);
+ $wrapper['class'] = str_replace('field-field-', 'field-', $wrapper['class']);
+
+
+ // wrap classes have changed (5.2.7)
+ if( acf_get_compatibility('field_wrapper_class') ) {
+
+ $wrapper['class'] .= " field_type-{$field['type']}";
+
+ if( $field['key'] ) {
+
+ $wrapper['class'] .= " field_key-{$field['key']}";
+
+ }
+
+ }
+
+
+ // merge in atts
+ $wrapper = acf_merge_atts( $wrapper, $field['wrapper'] );
+
+
+ // add width
+ $width = (int) acf_extract_var( $wrapper, 'width' );
+
+ if( $el == 'tr' || $el == 'td' ) {
+
+ // do nothing
+
+ } elseif( $width > 0 && $width < 100 ) {
+
+ $wrapper['data-width'] = $width;
+ $wrapper['style'] .= " width:{$width}%;";
+
+ }
+
+
+ // remove empty attributes
+ $wrapper = array_filter($wrapper);
+
+
+ // html
+ ?>
+< >
+
+ < class="acf-label">>
+
+ < class="acf-input">
+
+
+
+
+
+ >
+>
+' . acf_esc_html($label) . '';
+ }
+
+}
+
+
+/* depreciated since 5.6.5 */
+function acf_render_field_wrap_label( $field ) {
+ acf_render_field_label( $field );
+}
+
+
+/**
+* acf_render_field_instructions
+*
+* This function will maybe output the field's instructions
+*
+* @date 19/9/17
+* @since 5.6.3
+*
+* @param array $field
+* @return n/a
+*/
+
+function acf_render_field_instructions( $field ) {
+
+ // vars
+ $instructions = $field['instructions'];
+
+
+ // check
+ if( $instructions ) {
+ echo '' . acf_esc_html($instructions) . '
';
+ }
+
+}
+
+
+/* depreciated since 5.6.5 */
+function acf_render_field_wrap_description( $field ) {
+ acf_render_field_instructions( $field );
+}
+
+
+/*
+* acf_render_field_setting
+*
+* This function will render a tr element containing a label and field cell, but also setting the tr data attribute for AJAX
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $field (array) the origional field being edited
+* @param $setting (array) the settings field to create
+* @return n/a
+*/
+
+function acf_render_field_setting( $field, $setting, $global = false ) {
+
+ // validate
+ $setting = acf_get_valid_field( $setting );
+
+
+ // specific
+ if( !$global ) {
+
+ $setting['wrapper']['data-setting'] = $field['type'];
+
+ }
+
+
+ // class
+ $setting['wrapper']['class'] .= ' acf-field-setting-' . $setting['name'];
+
+
+ // copy across prefix
+ $setting['prefix'] = $field['prefix'];
+
+
+ // attempt find value
+ if( $setting['value'] === null ) {
+
+ // name
+ if( isset($field[ $setting['name'] ]) ) {
+
+ $setting['value'] = $field[ $setting['name'] ];
+
+ // default
+ } elseif( isset($setting['default_value']) ) {
+
+ $setting['value'] = $setting['default_value'];
+
+ }
+
+ }
+
+
+ // append (used by JS to join settings)
+ if( isset($setting['_append']) ) {
+
+ $setting['wrapper']['data-append'] = $setting['_append'];
+
+ }
+
+
+ // render
+ acf_render_field_wrap( $setting, 'tr', 'label' );
+
+}
+
+
+/*
+* acf_get_fields
+*
+* This function will return an array of fields for the given $parent
+*
+* @type function
+* @date 30/09/13
+* @since 5.0.0
+*
+* @param $parent (array) a field or field group
+* @return (array)
+*/
+
+function acf_get_fields( $parent = false ) {
+
+ // allow $parent to be a field group ID
+ if( !is_array($parent) ) {
+
+ $parent = acf_get_field_group( $parent );
+
+ }
+
+
+ // bail early if no parent
+ if( !$parent ) return false;
+
+
+ // vars
+ $fields = array();
+
+
+ // try JSON before DB to save query time
+ if( acf_have_local_fields( $parent['key'] ) ) {
+
+ $fields = acf_get_local_fields( $parent['key'] );
+
+ } else {
+
+ $fields = acf_get_fields_by_id( $parent['ID'] );
+
+ }
+
+
+ // filter
+ $fields = apply_filters('acf/get_fields', $fields, $parent);
+
+
+ // return
+ return $fields;
+
+}
+
+
+/*
+* acf_get_fields_by_id
+*
+* This function will get all fields for the given parent
+*
+* @type function
+* @date 27/02/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $fields (array)
+*/
+
+function acf_get_fields_by_id( $parent_id = 0 ) {
+
+ // bail early if no ID
+ if( !$parent_id ) return false;
+
+
+ // vars
+ $fields = array();
+ $post_ids = array();
+ $cache_key = "get_fields/ID={$parent_id}";
+
+
+ // check cache for child ids
+ if( acf_isset_cache($cache_key) ) {
+
+ $post_ids = acf_get_cache($cache_key);
+
+ // query DB for child ids
+ } else {
+
+ // query
+ $posts = get_posts(array(
+ 'posts_per_page' => -1,
+ 'post_type' => 'acf-field',
+ 'orderby' => 'menu_order',
+ 'order' => 'ASC',
+ 'suppress_filters' => true, // DO NOT allow WPML to modify the query
+ 'post_parent' => $parent_id,
+ 'post_status' => 'publish, trash', // 'any' won't get trashed fields
+ 'update_post_meta_cache' => false
+ ));
+
+
+ // loop
+ if( $posts ) {
+
+ foreach( $posts as $post ) {
+
+ $post_ids[] = $post->ID;
+
+ }
+
+ }
+
+
+ // update cache
+ acf_set_cache($cache_key, $post_ids);
+
+ }
+
+
+ // bail early if no children
+ if( empty($post_ids) ) return false;
+
+
+ // load fields
+ foreach( $post_ids as $post_id ) {
+
+ $fields[] = acf_get_field( $post_id );
+
+ }
+
+
+ // return
+ return $fields;
+
+}
+
+
+/*
+* acf_get_field
+*
+* This function will return a field for the given selector.
+*
+* @type function
+* @date 30/09/13
+* @since 5.0.0
+*
+* @param $selector (mixed) identifyer of field. Can be an ID, key, name or post object
+* @param $db_only (boolean) return $field in it's raw form without filters or cache
+* @return $field (array)
+*/
+
+function acf_get_field( $selector = null, $db_only = false ) {
+
+ // vars
+ $field = false;
+ $type = 'ID';
+
+
+ // ID
+ if( is_numeric($selector) ) {
+
+ // do nothing
+
+ // object
+ } elseif( is_object($selector) ) {
+
+ $selector = $selector->ID;
+
+ // string
+ } elseif( is_string($selector) ) {
+
+ $type = acf_is_field_key($selector) ? 'key' : 'name';
+
+ // other
+ } else {
+
+ return false;
+
+ }
+
+
+ // return early if cache is found
+ $cache_key = "get_field/{$type}={$selector}";
+
+ if( !$db_only && acf_isset_cache($cache_key) ) {
+
+ return acf_get_cache($cache_key);
+
+ }
+
+
+ // ID
+ if( $type == 'ID' ) {
+
+ $field = _acf_get_field_by_id( $selector, $db_only );
+
+ // key
+ } elseif( $type == 'key' ) {
+
+ $field = _acf_get_field_by_key( $selector, $db_only );
+
+ // name (rare case)
+ } else {
+
+ $field = _acf_get_field_by_name( $selector, $db_only );
+
+ }
+
+
+ // bail early if no field
+ if( !$field ) return false;
+
+
+ // validate
+ $field = acf_get_valid_field( $field );
+
+
+ // set prefix (acf fields save with prefix 'acf')
+ $field['prefix'] = 'acf';
+
+
+ // bail early if db only value (no need to update cache)
+ if( $db_only ) return $field;
+
+
+ // filter for 3rd party customization
+ $field = apply_filters( "acf/load_field", $field);
+ $field = apply_filters( "acf/load_field/type={$field['type']}", $field );
+ $field = apply_filters( "acf/load_field/name={$field['name']}", $field );
+ $field = apply_filters( "acf/load_field/key={$field['key']}", $field );
+
+
+ // update cache
+ // - Use key instead of ID for best compatibility (not all fields exist in the DB)
+ $cache_key = acf_set_cache("get_field/key={$field['key']}", $field);
+
+
+ // update cache reference
+ // - allow cache to return if using an ID selector
+ acf_set_cache_reference("get_field/ID={$field['ID']}", $cache_key);
+
+
+ // return
+ return $field;
+
+}
+
+
+/*
+* _acf_get_field_by_id
+*
+* This function will get a field via its ID
+*
+* @type function
+* @date 27/02/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $field (array)
+*/
+
+function _acf_get_field_by_id( $post_id = 0, $db_only = false ) {
+
+ // get post
+ $post = get_post( $post_id );
+
+
+ // bail early if no post, or is not a field
+ if( empty($post) || $post->post_type != 'acf-field' ) return false;
+
+
+ // unserialize
+ $field = maybe_unserialize( $post->post_content );
+
+
+ // update attributes
+ $field['ID'] = $post->ID;
+ $field['key'] = $post->post_name;
+ $field['label'] = $post->post_title;
+ $field['name'] = $post->post_excerpt;
+ $field['menu_order'] = $post->menu_order;
+ $field['parent'] = $post->post_parent;
+
+
+ // override with JSON
+ if( !$db_only && acf_is_local_field($field['key']) ) {
+
+ // load JSON field
+ $local = acf_get_local_field( $field['key'] );
+
+
+ // override IDs
+ $local['ID'] = $field['ID'];
+ $local['parent'] = $field['parent'];
+
+
+ // return
+ return $local;
+
+ }
+
+
+ // return
+ return $field;
+
+}
+
+
+/*
+* _acf_get_field_by_key
+*
+* This function will get a field via its key
+*
+* @type function
+* @date 27/02/2014
+* @since 5.0.0
+*
+* @param $key (string)
+* @return $field (array)
+*/
+
+function _acf_get_field_by_key( $key = '', $db_only = false ) {
+
+ // try JSON before DB to save query time
+ if( !$db_only && acf_is_local_field( $key ) ) {
+
+ return acf_get_local_field( $key );
+
+ }
+
+
+ // vars
+ $post_id = acf_get_field_id( $key );
+
+
+ // bail early if no post_id
+ if( !$post_id ) return false;
+
+
+ // return
+ return _acf_get_field_by_id( $post_id, $db_only );
+
+}
+
+
+/*
+* _acf_get_field_by_name
+*
+* This function will get a field via its name
+*
+* @type function
+* @date 27/02/2014
+* @since 5.0.0
+*
+* @param $key (string)
+* @return $field (array)
+*/
+
+function _acf_get_field_by_name( $name = '', $db_only = false ) {
+
+ // try JSON before DB to save query time
+ if( !$db_only && acf_is_local_field( $name ) ) {
+
+ return acf_get_local_field( $name );
+
+ }
+
+
+ // vars
+ $args = array(
+ 'posts_per_page' => 1,
+ 'post_type' => 'acf-field',
+ 'orderby' => 'menu_order title',
+ 'order' => 'ASC',
+ 'suppress_filters' => false,
+ 'acf_field_name' => $name
+ );
+
+
+ // load posts
+ $posts = get_posts( $args );
+
+
+ // bail early if no posts
+ if( empty($posts) ) return false;
+
+
+ // return
+ return _acf_get_field_by_id( $posts[0]->ID, $db_only );
+
+}
+
+
+/*
+* acf_maybe_get_field
+*
+* This function will return a field for the given selector.
+* It will also review the field_reference to ensure the correct field is returned which makes it useful for the template API
+*
+* @type function
+* @date 4/08/2015
+* @since 5.2.3
+*
+* @param $selector (mixed) identifyer of field. Can be an ID, key, name or post object
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @param $strict (boolean) if true, return a field only when a field key is found.
+* @return $field (array)
+*/
+
+function acf_maybe_get_field( $selector, $post_id = false, $strict = true ) {
+
+ // init
+ acf_init();
+
+
+ // bail early if is field key
+ if( acf_is_field_key($selector) ) {
+
+ return acf_get_field( $selector );
+
+ }
+
+
+ // save selector as field_name (could be sub field name 'images_0_image')
+ $field_name = $selector;
+
+
+ // get valid post_id
+ $post_id = acf_get_valid_post_id( $post_id );
+
+
+ // get reference
+ $field_key = acf_get_field_reference( $selector, $post_id );
+
+
+ // update selector
+ if( $field_key ) {
+
+ $selector = $field_key;
+
+ // bail early if no reference
+ } elseif( $strict ) {
+
+ return false;
+
+ }
+
+
+ // get field
+ $field = acf_get_field( $selector );
+
+
+ // update name
+ if( $field ) $field['name'] = $field_name;
+
+
+ // return
+ return $field;
+
+}
+
+
+/*
+* acf_get_field_id
+*
+* This function will lookup a field's ID from the DB
+* Useful for local fields to find DB sibling
+*
+* @type function
+* @date 25/06/2015
+* @since 5.2.3
+*
+* @param $key (string)
+* @return $post_id (int)
+*/
+
+function acf_get_field_id( $key = '' ) {
+
+ // vars
+ $args = array(
+ 'posts_per_page' => 1,
+ 'post_type' => 'acf-field',
+ 'orderby' => 'menu_order title',
+ 'order' => 'ASC',
+ 'suppress_filters' => false,
+ 'acf_field_key' => $key
+ );
+
+
+ // load posts
+ $posts = get_posts( $args );
+
+
+ // validate
+ if( empty($posts) ) return 0;
+
+
+ // return
+ return $posts[0]->ID;
+
+}
+
+
+/*
+* acf_update_field
+*
+* This function will update a field into the DB.
+* The returned field will always contain an ID
+*
+* @type function
+* @date 1/10/13
+* @since 5.0.0
+*
+* @param $field (array)
+* @return $field (array)
+*/
+
+function acf_update_field( $field = false, $specific = false ) {
+
+ // $field must be an array
+ if( !is_array($field) ) return false;
+
+
+ // validate
+ $field = acf_get_valid_field( $field );
+
+
+ // may have been posted. Remove slashes
+ $field = wp_unslash( $field );
+
+
+ // parse types (converts string '0' to int 0)
+ $field = acf_parse_types( $field );
+
+
+ // clean up conditional logic keys
+ if( !empty($field['conditional_logic']) ) {
+
+ // extract groups
+ $groups = acf_extract_var( $field, 'conditional_logic' );
+
+
+ // clean array
+ $groups = array_filter($groups);
+ $groups = array_values($groups);
+
+
+ // clean rules
+ foreach( array_keys($groups) as $i ) {
+
+ $groups[ $i ] = array_filter($groups[ $i ]);
+ $groups[ $i ] = array_values($groups[ $i ]);
+
+ }
+
+
+ // reset conditional logic
+ $field['conditional_logic'] = $groups;
+
+ }
+
+
+ // parent may be a field key
+ // - lookup parent ID
+ if( acf_is_field_key($field['parent']) ) {
+
+ $field['parent'] = acf_get_field_id( $field['parent'] );
+
+ }
+
+
+ // filter for 3rd party customization
+ $field = apply_filters( "acf/update_field", $field);
+ $field = apply_filters( "acf/update_field/type={$field['type']}", $field );
+ $field = apply_filters( "acf/update_field/name={$field['name']}", $field );
+ $field = apply_filters( "acf/update_field/key={$field['key']}", $field );
+
+
+ // store origional field for return
+ $data = $field;
+
+
+ // extract some args
+ $extract = acf_extract_vars($data, array(
+ 'ID',
+ 'key',
+ 'label',
+ 'name',
+ 'prefix',
+ 'value',
+ 'menu_order',
+ 'id',
+ 'class',
+ 'parent',
+ '_name',
+ '_prepare',
+ '_valid',
+ ));
+
+
+ // serialize for DB
+ $data = maybe_serialize( $data );
+
+
+ // save
+ $save = array(
+ 'ID' => $extract['ID'],
+ 'post_status' => 'publish',
+ 'post_type' => 'acf-field',
+ 'post_title' => $extract['label'],
+ 'post_name' => $extract['key'],
+ 'post_excerpt' => $extract['name'],
+ 'post_content' => $data,
+ 'post_parent' => $extract['parent'],
+ 'menu_order' => $extract['menu_order'],
+ );
+
+
+ // specific
+ if( acf_is_array($specific) ) {
+
+ // append ID
+ $specific[] = 'ID';
+
+
+ // get sub array
+ $save = acf_get_sub_array( $save, $specific );
+
+ }
+
+
+ // allow fields to contain the same name
+ add_filter( 'wp_unique_post_slug', 'acf_update_field_wp_unique_post_slug', 999, 6 );
+
+
+ // slash data
+ // - WP expects all data to be slashed and will unslash it (fixes '\' character issues)
+ $save = wp_slash( $save );
+
+
+ // update the field and update the ID
+ if( $field['ID'] ) {
+
+ wp_update_post( $save );
+
+ } else {
+
+ $field['ID'] = wp_insert_post( $save );
+
+ }
+
+
+ // clear cache
+ acf_delete_cache("get_field/key={$field['key']}");
+
+
+ // return
+ return $field;
+
+}
+
+function acf_update_field_wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
+
+ if( $post_type == 'acf-field' ) {
+
+ $slug = $original_slug;
+
+ }
+
+ // return
+ return $slug;
+
+}
+
+
+/*
+* acf_duplicate_fields
+*
+* This function will duplicate an array of fields and update conditional logic references
+*
+* @type function
+* @date 16/06/2014
+* @since 5.0.0
+*
+* @param $fields (array)
+* @param $new_parent (int)
+* @return n/a
+*/
+
+function acf_duplicate_fields( $fields, $new_parent = 0 ) {
+
+ // bail early if no fields
+ if( empty($fields) ) return;
+
+
+ // create new field keys (for conditional logic fixes)
+ foreach( $fields as $field ) {
+
+ // ensure a delay for unique ID
+ usleep(1);
+
+ acf_update_setting( 'duplicate_key_' . $field['key'] , uniqid('field_') );
+
+ }
+
+
+ // duplicate fields
+ foreach( $fields as $field ) {
+
+ // duplicate
+ acf_duplicate_field( $field['ID'], $new_parent );
+
+ }
+
+}
+
+
+/*
+* acf_duplicate_field
+*
+* This function will duplicate a field and attach it to the given field group ID
+*
+* @type function
+* @date 17/10/13
+* @since 5.0.0
+*
+* @param $selector (int)
+* @param $new_parent (int)
+* @return $field (array) the new field
+*/
+
+function acf_duplicate_field( $selector = 0, $new_parent = 0 ){
+
+ // disable filters to ensure ACF loads raw data from DB
+ acf_disable_filters();
+
+
+ // load the origional field
+ $field = acf_get_field( $selector );
+
+
+ // bail early if field did not load correctly
+ if( empty($field) ) {
+
+ return false;
+
+ }
+
+
+ // update ID
+ $field['ID'] = false;
+
+
+ // try duplicate keys
+ $field['key'] = acf_get_setting( 'duplicate_key_' . $field['key'] );
+
+
+ // default key
+ if( empty($field['key']) ) {
+
+ $field['key'] = uniqid('field_');
+
+ }
+
+
+ // update parent
+ if( $new_parent ) {
+
+ $field['parent'] = $new_parent;
+
+ }
+
+
+ // update conditional logic references (because field keys have changed)
+ if( !empty($field['conditional_logic']) ) {
+
+ // extract groups
+ $groups = acf_extract_var( $field, 'conditional_logic' );
+
+
+ // loop over groups
+ foreach( array_keys($groups) as $g ) {
+
+ // extract group
+ $group = acf_extract_var( $groups, $g );
+
+
+ // bail early if empty
+ if( empty($group) ) {
+
+ continue;
+
+ }
+
+
+ // loop over rules
+ foreach( array_keys($group) as $r ) {
+
+ // extract rule
+ $rule = acf_extract_var( $group, $r );
+
+
+ // vars
+ $new_key = acf_get_setting( 'duplicate_key_' . $rule['field'] );
+
+
+ // update rule with new key
+ if( $new_key ) {
+
+ $rule['field'] = $new_key;
+
+ }
+
+
+ // append to group
+ $group[ $r ] = $rule;
+
+ }
+
+
+ // append to groups
+ $groups[ $g ] = $group;
+
+ }
+
+
+ // update conditional logic
+ $field['conditional_logic'] = $groups;
+
+
+ }
+
+
+ // filter for 3rd party customization
+ $field = apply_filters( "acf/duplicate_field", $field);
+ $field = apply_filters( "acf/duplicate_field/type={$field['type']}", $field );
+
+
+ // save
+ return acf_update_field( $field );
+
+}
+
+
+/*
+* acf_delete_field
+*
+* This function will delete a field from the databse
+*
+* @type function
+* @date 2/10/13
+* @since 5.0.0
+*
+* @param $id (int)
+* @return (boolean)
+*/
+
+function acf_delete_field( $selector = 0 ) {
+
+ // disable filters to ensure ACF loads raw data from DB
+ acf_disable_filters();
+
+
+ // load the origional field gorup
+ $field = acf_get_field( $selector );
+
+
+ // bail early if field did not load correctly
+ if( empty($field) ) return false;
+
+
+ // delete field
+ wp_delete_post( $field['ID'], true );
+
+
+ // action for 3rd party customisation
+ do_action( "acf/delete_field", $field);
+ do_action( "acf/delete_field/type={$field['type']}", $field );
+
+
+ // clear cache
+ acf_delete_cache("get_field/key={$field['key']}");
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* acf_trash_field
+*
+* This function will trash a field from the databse
+*
+* @type function
+* @date 2/10/13
+* @since 5.0.0
+*
+* @param $id (int)
+* @return (boolean)
+*/
+
+function acf_trash_field( $selector = 0 ) {
+
+ // disable filters to ensure ACF loads raw data from DB
+ acf_disable_filters();
+
+
+ // load the origional field gorup
+ $field = acf_get_field( $selector );
+
+
+ // bail early if field did not load correctly
+ if( empty($field) ) return false;
+
+
+ // delete field
+ wp_trash_post( $field['ID'] );
+
+
+ // action for 3rd party customisation
+ do_action( 'acf/trash_field', $field );
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* acf_untrash_field
+*
+* This function will restore a field from the trash
+*
+* @type function
+* @date 2/10/13
+* @since 5.0.0
+*
+* @param $id (int)
+* @return (boolean)
+*/
+
+function acf_untrash_field( $selector = 0 ) {
+
+ // disable filters to ensure ACF loads raw data from DB
+ acf_disable_filters();
+
+
+ // load the origional field gorup
+ $field = acf_get_field( $selector );
+
+
+ // bail early if field did not load correctly
+ if( empty($field) ) return false;
+
+
+ // delete field
+ wp_untrash_post( $field['ID'] );
+
+
+ // action for 3rd party customisation
+ do_action( 'acf/untrash_field', $field );
+
+
+ // return
+ return true;
+}
+
+
+/*
+* acf_prepare_fields_for_export
+*
+* description
+*
+* @type function
+* @date 11/03/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_prepare_fields_for_export( $fields = false ) {
+
+ // validate
+ if( empty($fields) ) return $fields;
+
+
+ // format
+ foreach( array_keys($fields) as $i ) {
+
+ // prepare
+ $fields[ $i ] = acf_prepare_field_for_export( $fields[ $i ] );
+
+ }
+
+
+ // return
+ return $fields;
+
+}
+
+
+/*
+* acf_prepare_field_for_export
+*
+* description
+*
+* @type function
+* @date 11/03/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_prepare_field_for_export( $field ) {
+
+ // extract some args
+ $extract = acf_extract_vars($field, array(
+ 'ID',
+ 'prefix',
+ 'value',
+ 'menu_order',
+ 'id',
+ 'class',
+ 'parent',
+ '_name',
+ '_prepare',
+ '_valid',
+ ));
+
+
+ // filter for 3rd party customization
+ $field = apply_filters( "acf/prepare_field_for_export", $field );
+ $field = apply_filters( "acf/prepare_field_for_export/type={$field['type']}", $field );
+
+
+ // return
+ return $field;
+}
+
+
+/*
+* acf_prepare_fields_for_import
+*
+* description
+*
+* @type function
+* @date 11/03/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_prepare_fields_for_import( $fields = false ) {
+
+ // validate
+ if( empty($fields) ) return array();
+
+
+ // re-index array
+ $fields = array_values($fields);
+
+
+ // vars
+ $i = 0;
+
+
+ // format
+ while( $i < count($fields) ) {
+
+ // prepare field
+ $field = acf_prepare_field_for_import( $fields[ $i ] );
+
+
+ // allow multiple fields to be returned ($field + $sub_fields)
+ if( !isset($field['key']) && isset($field[0]) ) {
+
+ // merge in $field (1 or more fields)
+ array_splice($fields, $i, 1, $field);
+
+ }
+
+
+ // $i
+ $i++;
+
+ }
+
+
+ // filter for 3rd party customization
+ $fields = apply_filters('acf/prepare_fields_for_import', $fields);
+
+
+ // return
+ return $fields;
+
+}
+
+
+/*
+* acf_prepare_field_for_import
+*
+* description
+*
+* @type function
+* @date 11/03/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_prepare_field_for_import( $field ) {
+
+ // extract some args
+ $extract = acf_extract_vars($field, array(
+ 'value',
+ 'id',
+ 'class',
+ '_name',
+ '_prepare',
+ '_valid',
+ ));
+
+
+ // filter for 3rd party customization
+ $field = apply_filters( "acf/prepare_field_for_import", $field );
+ $field = apply_filters( "acf/prepare_field_for_import/type={$field['type']}", $field );
+
+
+ // return
+ return $field;
+}
+
+
+/*
+* acf_get_sub_field
+*
+* This function will return a field for the given selector, and $field (parent).
+*
+* @type function
+* @date 30/09/13
+* @since 5.0.0
+*
+* @param $selector (string)
+* @param $field (mixed)
+* @return $field (array)
+*/
+
+function acf_get_sub_field( $selector, $field ) {
+
+ // vars
+ $sub_field = false;
+
+
+ // check sub_fields
+ if( isset($field['sub_fields']) ) {
+
+ // loop
+ foreach( $field['sub_fields'] as $_sub_field ) {
+
+ // check name and key
+ if( acf_is_field($_sub_field, $selector) ) {
+
+ $sub_field = $_sub_field;
+ break;
+
+ }
+
+ }
+
+ }
+
+
+ // filter for 3rd party customization
+ $sub_field = apply_filters( "acf/get_sub_field", $sub_field, $selector, $field );
+ $sub_field = apply_filters( "acf/get_sub_field/type={$field['type']}", $sub_field, $selector, $field );
+
+
+ // return
+ return $sub_field;
+
+}
+
+
+/*
+* acf_is_field
+*
+* This function will compare a $selector against a $field array
+*
+* @type function
+* @date 1/7/17
+* @since 5.6.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_is_field( $field, $selector = '' ) {
+
+ // vars
+ $keys = array(
+ 'ID',
+ 'name',
+ 'key',
+ '_name',
+ '__name',
+ );
+
+
+ // loop
+ foreach( $keys as $k ) {
+
+ if( isset($field[ $k ]) && $field[ $k ] === $selector ) return true;
+
+ }
+
+
+ // return
+ return false;
+
+}
+
+
+/*
+* acf_get_field_ancestors
+*
+* This function will return an array of all ancestor fields
+*
+* @type function
+* @date 22/06/2016
+* @since 5.3.8
+*
+* @param $field (array)
+* @return (array)
+*/
+
+function acf_get_field_ancestors( $field ) {
+
+ // get field
+ $ancestors = array();
+
+
+ // loop
+ while( $field && acf_is_field_key($field['parent']) ) {
+
+ $ancestors[] = $field['parent'];
+ $field = acf_get_field($field['parent']);
+
+ }
+
+
+ // return
+ return $ancestors;
+
+}
+
+
+/*
+* acf_maybe_get_sub_field
+*
+* This function will attempt to find a sub field
+*
+* @type function
+* @date 3/10/2016
+* @since 5.4.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_maybe_get_sub_field( $selectors, $post_id = false, $strict = true ) {
+
+ // bail ealry if not enough selectors
+ if( !is_array($selectors) || count($selectors) < 3 ) return false;
+
+
+ // vars
+ $offset = acf_get_setting('row_index_offset');
+ $selector = acf_extract_var( $selectors, 0 );
+ $selectors = array_values( $selectors ); // reset keys
+
+
+ // attempt get field
+ $field = acf_maybe_get_field( $selector, $post_id, $strict );
+
+
+ // bail early if no field
+ if( !$field ) return false;
+
+
+ // loop
+ for( $j = 0; $j < count($selectors); $j+=2 ) {
+
+ // vars
+ $sub_i = $selectors[ $j ];
+ $sub_s = $selectors[ $j+1 ];
+ $field_name = $field['name'];
+
+
+ // find sub field
+ $field = acf_get_sub_field( $sub_s, $field );
+
+
+ // bail early if no sub field
+ if( !$field ) return false;
+
+
+ // add to name
+ $field['name'] = $field_name . '_' . ($sub_i-$offset) . '_' . $field['name'];
+
+ }
+
+
+ // return
+ return $field;
+
+
+}
+
+
+/*
+* acf_prefix_fields
+*
+* This funtion will safely change the prefix for an array of fields
+* Needed to allow clone field to continue working on nave menu item and widget forms
+*
+* @type function
+* @date 5/9/17
+* @since 5.6.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_prefix_fields( &$fields, $prefix = 'acf' ) {
+
+ // loop
+ foreach( $fields as &$field ) {
+
+ // replace 'acf' with $prefix
+ $field['prefix'] = substr_replace($field['prefix'], $prefix, 0, 3);
+
+ }
+
+
+ // return
+ return $fields;
+
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php
new file mode 100644
index 0000000..3f83cb0
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php
@@ -0,0 +1,5124 @@
+get_setting()
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_get_setting( $name, $value = null ) {
+
+ return acf()->get_setting( $name, $value );
+
+}
+
+
+/*
+* acf_update_setting
+*
+* alias of acf()->update_setting()
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $name (string)
+* @param $value (mixed)
+* @return n/a
+*/
+
+function acf_update_setting( $name, $value ) {
+
+ return acf()->update_setting( $name, $value );
+
+}
+
+
+/*
+* acf_init
+*
+* alias of acf()->init()
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_init() {
+
+ acf()->init();
+
+}
+
+
+/*
+* acf_append_setting
+*
+* This function will add a value into the settings array found in the acf object
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $name (string)
+* @param $value (mixed)
+* @return n/a
+*/
+
+function acf_append_setting( $name, $value ) {
+
+ // vars
+ $setting = acf_get_setting( $name, array() );
+
+
+ // bail ealry if not array
+ if( !is_array($setting) ) return false;
+
+
+ // append
+ $setting[] = $value;
+
+
+ // update
+ acf_update_setting( $name, $setting );
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* acf_get_compatibility
+*
+* This function will return true or false for a given compatibility setting
+*
+* @type function
+* @date 20/01/2015
+* @since 5.1.5
+*
+* @param $name (string)
+* @return (boolean)
+*/
+
+function acf_get_compatibility( $name ) {
+
+ return apply_filters( "acf/compatibility/{$name}", false );
+
+}
+
+
+/*
+* acf_has_done
+*
+* This function will return true if this action has already been done
+*
+* @type function
+* @date 16/12/2015
+* @since 5.3.2
+*
+* @param $name (string)
+* @return (boolean)
+*/
+
+function acf_has_done( $name ) {
+
+ // vars
+ $setting = "_has_done_{$name}";
+
+
+ // return true if already done
+ if( acf_get_setting($setting) ) return true;
+
+
+ // update setting
+ acf_update_setting($setting, true);
+
+
+ // return
+ return false;
+
+}
+
+
+/*
+* acf_get_path
+*
+* This function will return the path to a file within the ACF plugin folder
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $path (string) the relative path from the root of the ACF plugin folder
+* @return (string)
+*/
+
+function acf_get_path( $path ) {
+
+ return ACF_PATH . $path;
+
+}
+
+
+/*
+* acf_get_dir
+*
+* This function will return the url to a file within the ACF plugin folder
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $path (string) the relative path from the root of the ACF plugin folder
+* @return (string)
+*/
+
+function acf_get_dir( $path ) {
+
+ return acf_get_setting('dir') . $path;
+
+}
+
+
+/*
+* acf_include
+*
+* This function will include a file
+*
+* @type function
+* @date 10/03/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_include( $file ) {
+
+ $path = acf_get_path( $file );
+
+ if( file_exists($path) ) {
+
+ include_once( $path );
+
+ }
+
+}
+
+
+/*
+* acf_get_external_path
+*
+* This function will return the path to a file within an external folder
+*
+* @type function
+* @date 22/2/17
+* @since 5.5.8
+*
+* @param $file (string)
+* @param $path (string)
+* @return (string)
+*/
+
+function acf_get_external_path( $file, $path = '' ) {
+
+ return trailingslashit( dirname( $file ) ) . $path;
+
+}
+
+
+/*
+* acf_get_external_dir
+*
+* This function will return the url to a file within an external folder
+*
+* @type function
+* @date 22/2/17
+* @since 5.5.8
+*
+* @param $file (string)
+* @param $path (string)
+* @return (string)
+*/
+
+function acf_get_external_dir( $file, $path = '' ) {
+
+ // vars
+ $external_url = '';
+ $external_path = acf_get_external_path( $file, $path );
+ $wp_plugin_path = wp_normalize_path(WP_PLUGIN_DIR);
+ $wp_content_path = wp_normalize_path(WP_CONTENT_DIR);
+ $wp_path = wp_normalize_path(ABSPATH);
+
+
+ // wp-content/plugins
+ if( strpos($external_path, $wp_plugin_path) === 0 ) {
+
+ return str_replace($wp_plugin_path, plugins_url(), $external_path);
+
+ }
+
+
+ // wp-content
+ if( strpos($external_path, $wp_content_path) === 0 ) {
+
+ return str_replace($wp_content_path, content_url(), $external_path);
+
+ }
+
+
+ // return
+ return str_replace($wp_path, home_url(), $external_path);
+
+}
+
+
+/*
+* acf_parse_args
+*
+* This function will merge together 2 arrays and also convert any numeric values to ints
+*
+* @type function
+* @date 18/10/13
+* @since 5.0.0
+*
+* @param $args (array)
+* @param $defaults (array)
+* @return $args (array)
+*/
+
+function acf_parse_args( $args, $defaults = array() ) {
+
+ // parse args
+ $args = wp_parse_args( $args, $defaults );
+
+
+ // parse types
+ $args = acf_parse_types( $args );
+
+
+ // return
+ return $args;
+
+}
+
+
+/*
+* acf_parse_types
+*
+* This function will convert any numeric values to int and trim strings
+*
+* @type function
+* @date 18/10/13
+* @since 5.0.0
+*
+* @param $var (mixed)
+* @return $var (mixed)
+*/
+
+function acf_parse_types( $array ) {
+
+ // return
+ return array_map( 'acf_parse_type', $array );
+
+}
+
+
+/*
+* acf_parse_type
+*
+* description
+*
+* @type function
+* @date 11/11/2014
+* @since 5.0.9
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_parse_type( $v ) {
+
+ // bail early if not string
+ if( !is_string($v) ) return $v;
+
+
+ // trim
+ $v = trim($v);
+
+
+ // convert int (string) to int
+ if( is_numeric($v) && strval((int)$v) === $v ) {
+
+ $v = intval( $v );
+
+ }
+
+
+ // return
+ return $v;
+
+}
+
+
+/*
+* acf_get_view
+*
+* This function will load in a file from the 'admin/views' folder and allow variables to be passed through
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $view_name (string)
+* @param $args (array)
+* @return n/a
+*/
+
+function acf_get_view( $path = '', $args = array() ) {
+
+ // allow view file name shortcut
+ if( substr($path, -4) !== '.php' ) {
+
+ $path = acf_get_path("includes/admin/views/{$path}.php");
+
+ }
+
+
+ // include
+ if( file_exists($path) ) {
+
+ extract( $args );
+ include( $path );
+
+ }
+
+}
+
+
+/*
+* acf_merge_atts
+*
+* description
+*
+* @type function
+* @date 2/11/2014
+* @since 5.0.9
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_merge_atts( $atts, $extra = array() ) {
+
+ // bail ealry if no $extra
+ if( empty($extra) ) return $atts;
+
+
+ // trim
+ $extra = array_map('trim', $extra);
+ $extra = array_filter($extra);
+
+
+ // merge in new atts
+ foreach( $extra as $k => $v ) {
+
+ // append
+ if( $k == 'class' || $k == 'style' ) {
+
+ $atts[ $k ] .= ' ' . $v;
+
+ // merge
+ } else {
+
+ $atts[ $k ] = $v;
+
+ }
+
+ }
+
+
+ // return
+ return $atts;
+
+}
+
+
+
+
+
+
+
+/*
+* acf_nonce_input
+*
+* This function will create a basic nonce input
+*
+* @type function
+* @date 24/5/17
+* @since 5.6.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_nonce_input( $nonce = '' ) {
+
+ echo ' ';
+
+}
+
+
+/*
+* acf_extract_var
+*
+* This function will remove the var from the array, and return the var
+*
+* @type function
+* @date 2/10/13
+* @since 5.0.0
+*
+* @param $array (array)
+* @param $key (string)
+* @return (mixed)
+*/
+
+function acf_extract_var( &$array, $key, $default = null ) {
+
+ // check if exists
+ // - uses array_key_exists to extract NULL values (isset will fail)
+ if( is_array($array) && array_key_exists($key, $array) ) {
+
+ // store value
+ $v = $array[ $key ];
+
+
+ // unset
+ unset( $array[ $key ] );
+
+
+ // return
+ return $v;
+
+ }
+
+
+ // return
+ return $default;
+}
+
+
+/*
+* acf_extract_vars
+*
+* This function will remove the vars from the array, and return the vars
+*
+* @type function
+* @date 8/10/13
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_extract_vars( &$array, $keys ) {
+
+ $r = array();
+
+ foreach( $keys as $key ) {
+
+ $r[ $key ] = acf_extract_var( $array, $key );
+
+ }
+
+ return $r;
+}
+
+
+/*
+* acf_get_sub_array
+*
+* This function will return a sub array of data
+*
+* @type function
+* @date 15/03/2016
+* @since 5.3.2
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_get_sub_array( $array, $keys ) {
+
+ $r = array();
+
+ foreach( $keys as $key ) {
+
+ $r[ $key ] = $array[ $key ];
+
+ }
+
+ return $r;
+
+}
+
+
+/*
+* acf_get_post_types
+*
+* This function will return an array of available post types
+*
+* @type function
+* @date 7/10/13
+* @since 5.0.0
+*
+* @param $exclude (array)
+* @param $include (array)
+* @return (array)
+*/
+
+function acf_get_post_types( $args = array() ) {
+
+ // vars
+ $exclude = acf_extract_var( $args, 'exclude', array() );
+ $return = array();
+
+
+ // get post types
+ $post_types = get_post_types( $args, 'objects' );
+
+
+ // remove ACF post types
+ $exclude[] = 'acf-field';
+ $exclude[] = 'acf-field-group';
+
+
+ // loop
+ foreach( $post_types as $i => $post_type ) {
+
+ // bail early if is exclude
+ if( in_array($i, $exclude) ) continue;
+
+
+ // bail early if is builtin (WP) private post type
+ // - nav_menu_item, revision, customize_changeset, etc
+ if( $post_type->_builtin && !$post_type->public ) continue;
+
+
+ // append
+ $return[] = $i;
+
+ }
+
+
+ // return
+ return $return;
+
+}
+
+
+function acf_get_pretty_post_types( $post_types = array() ) {
+
+ // get post types
+ if( empty($post_types) ) {
+
+ // get all custom post types
+ $post_types = acf_get_post_types();
+
+ }
+
+
+ // get labels
+ $ref = array();
+ $r = array();
+
+ foreach( $post_types as $post_type ) {
+
+ // vars
+ $label = acf_get_post_type_label($post_type);
+
+
+ // append to r
+ $r[ $post_type ] = $label;
+
+
+ // increase counter
+ if( !isset($ref[ $label ]) ) {
+
+ $ref[ $label ] = 0;
+
+ }
+
+ $ref[ $label ]++;
+ }
+
+
+ // get slugs
+ foreach( array_keys($r) as $i ) {
+
+ // vars
+ $post_type = $r[ $i ];
+
+ if( $ref[ $post_type ] > 1 ) {
+
+ $r[ $i ] .= ' (' . $i . ')';
+
+ }
+
+ }
+
+
+ // return
+ return $r;
+
+}
+
+
+
+/*
+* acf_get_post_type_label
+*
+* This function will return a pretty label for a specific post_type
+*
+* @type function
+* @date 5/07/2016
+* @since 5.4.0
+*
+* @param $post_type (string)
+* @return (string)
+*/
+
+function acf_get_post_type_label( $post_type ) {
+
+ // vars
+ $label = $post_type;
+
+
+ // check that object exists
+ // - case exists when importing field group from another install and post type does not exist
+ if( post_type_exists($post_type) ) {
+
+ $obj = get_post_type_object($post_type);
+ $label = $obj->labels->singular_name;
+
+ }
+
+
+ // return
+ return $label;
+
+}
+
+
+/*
+* acf_verify_nonce
+*
+* This function will look at the $_POST['_acf_nonce'] value and return true or false
+*
+* @type function
+* @date 15/10/13
+* @since 5.0.0
+*
+* @param $nonce (string)
+* @return (boolean)
+*/
+
+function acf_verify_nonce( $value) {
+
+ // vars
+ $nonce = acf_maybe_get_POST('_acf_nonce');
+
+
+ // bail early nonce does not match (post|user|comment|term)
+ if( !$nonce || !wp_verify_nonce($nonce, $value) ) return false;
+
+
+ // reset nonce (only allow 1 save)
+ $_POST['_acf_nonce'] = false;
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* acf_verify_ajax
+*
+* This function will return true if the current AJAX request is valid
+* It's action will also allow WPML to set the lang and avoid AJAX get_posts issues
+*
+* @type function
+* @date 7/08/2015
+* @since 5.2.3
+*
+* @param n/a
+* @return (boolean)
+*/
+
+function acf_verify_ajax() {
+
+ // vars
+ $action = acf_maybe_get_POST('action');
+ $nonce = acf_maybe_get_POST('nonce');
+
+
+ // bail early if not acf action
+ if( !$action || substr($action, 0, 3) !== 'acf' ) {
+ return false;
+ }
+
+
+ // bail early if not acf nonce
+ if( !$nonce || !wp_verify_nonce($nonce, 'acf_nonce') ) {
+ return false;
+ }
+
+
+ // action for 3rd party customization
+ do_action('acf/verify_ajax');
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* acf_get_image_sizes
+*
+* This function will return an array of available image sizes
+*
+* @type function
+* @date 23/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return (array)
+*/
+
+function acf_get_image_sizes() {
+
+ // vars
+ $sizes = array(
+ 'thumbnail' => __("Thumbnail",'acf'),
+ 'medium' => __("Medium",'acf'),
+ 'large' => __("Large",'acf')
+ );
+
+
+ // find all sizes
+ $all_sizes = get_intermediate_image_sizes();
+
+
+ // add extra registered sizes
+ if( !empty($all_sizes) ) {
+
+ foreach( $all_sizes as $size ) {
+
+ // bail early if already in array
+ if( isset($sizes[ $size ]) ) {
+
+ continue;
+
+ }
+
+
+ // append to array
+ $label = str_replace('-', ' ', $size);
+ $label = ucwords( $label );
+ $sizes[ $size ] = $label;
+
+ }
+
+ }
+
+
+ // add sizes
+ foreach( array_keys($sizes) as $s ) {
+
+ // vars
+ $data = acf_get_image_size($s);
+
+
+ // append
+ if( $data['width'] && $data['height'] ) {
+
+ $sizes[ $s ] .= ' (' . $data['width'] . ' x ' . $data['height'] . ')';
+
+ }
+
+ }
+
+
+ // add full end
+ $sizes['full'] = __("Full Size",'acf');
+
+
+ // filter for 3rd party customization
+ $sizes = apply_filters( 'acf/get_image_sizes', $sizes );
+
+
+ // return
+ return $sizes;
+
+}
+
+function acf_get_image_size( $s = '' ) {
+
+ // global
+ global $_wp_additional_image_sizes;
+
+
+ // rename for nicer code
+ $_sizes = $_wp_additional_image_sizes;
+
+
+ // vars
+ $data = array(
+ 'width' => isset($_sizes[$s]['width']) ? $_sizes[$s]['width'] : get_option("{$s}_size_w"),
+ 'height' => isset($_sizes[$s]['height']) ? $_sizes[$s]['height'] : get_option("{$s}_size_h")
+ );
+
+
+ // return
+ return $data;
+
+}
+
+
+/*
+* acf_version_compare
+*
+* This function will compare version left v right
+*
+* @type function
+* @date 21/11/16
+* @since 5.5.0
+*
+* @param $compare (string)
+* @param $version (string)
+* @return (boolean)
+*/
+
+function acf_version_compare( $left = 'wp', $compare = '>', $right = '1' ) {
+
+ // global
+ global $wp_version;
+
+
+ // wp
+ if( $left === 'wp' ) $left = $wp_version;
+
+
+ // remove '-beta1' or '-RC1'
+ $left = acf_get_full_version($left);
+ $right = acf_get_full_version($right);
+
+
+ // return
+ return version_compare( $left, $right, $compare );
+
+}
+
+
+/*
+* acf_get_full_version
+*
+* This function will remove any '-beta1' or '-RC1' strings from a version
+*
+* @type function
+* @date 24/11/16
+* @since 5.5.0
+*
+* @param $version (string)
+* @return (string)
+*/
+
+function acf_get_full_version( $version = '1' ) {
+
+ // remove '-beta1' or '-RC1'
+ if( $pos = strpos($version, '-') ) {
+
+ $version = substr($version, 0, $pos);
+
+ }
+
+
+ // return
+ return $version;
+
+}
+
+
+/*
+* acf_get_locale
+*
+* This function is a wrapper for the get_locale() function
+*
+* @type function
+* @date 16/12/16
+* @since 5.5.0
+*
+* @param n/a
+* @return (string)
+*/
+
+function acf_get_locale() {
+
+ return is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
+
+}
+
+
+/*
+* acf_get_terms
+*
+* This function is a wrapper for the get_terms() function
+*
+* @type function
+* @date 28/09/2016
+* @since 5.4.0
+*
+* @param $args (array)
+* @return (array)
+*/
+
+function acf_get_terms( $args ) {
+
+ // global
+ global $wp_version;
+
+
+ // vars
+ $terms = array();
+
+
+ // WP 4.5+
+ if( version_compare($wp_version, '4.5', '>=' ) ) {
+
+ $terms = get_terms( $args );
+
+ // WP < 4.5
+ } else {
+
+ $terms = get_terms( $args['taxonomy'], $args );
+
+ }
+
+
+ // return
+ return $terms;
+
+}
+
+
+/*
+* acf_get_taxonomies
+*
+* This function will return an array of available taxonomies
+*
+* @type function
+* @date 7/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return (array)
+*/
+
+function acf_get_taxonomies() {
+
+ // get all taxonomies
+ $taxonomies = get_taxonomies( false, 'objects' );
+ $ignore = array( 'nav_menu', 'link_category' );
+ $r = array();
+
+
+ // populate $r
+ foreach( $taxonomies as $taxonomy )
+ {
+ if( in_array($taxonomy->name, $ignore) )
+ {
+ continue;
+
+ }
+
+ $r[ $taxonomy->name ] = $taxonomy->name; //"{$taxonomy->labels->singular_name}"; // ({$taxonomy->name})
+ }
+
+
+ // return
+ return $r;
+
+}
+
+
+function acf_get_pretty_taxonomies( $taxonomies = array() ) {
+
+ // get post types
+ if( empty($taxonomies) ) {
+
+ // get all custom post types
+ $taxonomies = acf_get_taxonomies();
+
+ }
+
+
+ // get labels
+ $ref = array();
+ $r = array();
+
+ foreach( array_keys($taxonomies) as $i ) {
+
+ // vars
+ $taxonomy = acf_extract_var( $taxonomies, $i);
+ $obj = get_taxonomy( $taxonomy );
+ $name = $obj->labels->singular_name;
+
+
+ // append to r
+ $r[ $taxonomy ] = $name;
+
+
+ // increase counter
+ if( !isset($ref[ $name ]) ) {
+
+ $ref[ $name ] = 0;
+
+ }
+
+ $ref[ $name ]++;
+ }
+
+
+ // get slugs
+ foreach( array_keys($r) as $i ) {
+
+ // vars
+ $taxonomy = $r[ $i ];
+
+ if( $ref[ $taxonomy ] > 1 ) {
+
+ $r[ $i ] .= ' (' . $i . ')';
+
+ }
+
+ }
+
+
+ // return
+ return $r;
+
+}
+
+
+/*
+* acf_get_taxonomy_terms
+*
+* This function will return an array of available taxonomy terms
+*
+* @type function
+* @date 7/10/13
+* @since 5.0.0
+*
+* @param $taxonomies (array)
+* @return (array)
+*/
+
+function acf_get_taxonomy_terms( $taxonomies = array() ) {
+
+ // force array
+ $taxonomies = acf_get_array( $taxonomies );
+
+
+ // get pretty taxonomy names
+ $taxonomies = acf_get_pretty_taxonomies( $taxonomies );
+
+
+ // vars
+ $r = array();
+
+
+ // populate $r
+ foreach( array_keys($taxonomies) as $taxonomy ) {
+
+ // vars
+ $label = $taxonomies[ $taxonomy ];
+ $is_hierarchical = is_taxonomy_hierarchical( $taxonomy );
+ $terms = acf_get_terms(array(
+ 'taxonomy' => $taxonomy,
+ 'hide_empty' => false
+ ));
+
+
+ // bail early i no terms
+ if( empty($terms) ) continue;
+
+
+ // sort into hierachial order!
+ if( $is_hierarchical ) {
+
+ $terms = _get_term_children( 0, $terms, $taxonomy );
+
+ }
+
+
+ // add placeholder
+ $r[ $label ] = array();
+
+
+ // add choices
+ foreach( $terms as $term ) {
+
+ $k = "{$taxonomy}:{$term->slug}";
+ $r[ $label ][ $k ] = acf_get_term_title( $term );
+
+ }
+
+ }
+
+
+ // return
+ return $r;
+
+}
+
+
+function acf_get_term_title( $term ) {
+
+ // title
+ $title = $term->name;
+
+
+ // empty
+ if( $title === '' ) {
+
+ $title = __('(no title)', 'acf');
+
+ }
+
+
+ // ancestors
+ if( is_taxonomy_hierarchical($term->taxonomy) ) {
+
+ $ancestors = get_ancestors( $term->term_id, $term->taxonomy );
+
+ $title = str_repeat('- ', count($ancestors)) . $title;
+
+ }
+
+
+ // return
+ return $title;
+
+}
+
+
+/*
+* acf_decode_taxonomy_terms
+*
+* This function decodes the $taxonomy:$term strings into a nested array
+*
+* @type function
+* @date 27/02/2014
+* @since 5.0.0
+*
+* @param $terms (array)
+* @return (array)
+*/
+
+function acf_decode_taxonomy_terms( $strings = false ) {
+
+ // bail early if no terms
+ if( empty($strings) ) return false;
+
+
+ // vars
+ $terms = array();
+
+
+ // loop
+ foreach( $strings as $string ) {
+
+ // vars
+ $data = acf_decode_taxonomy_term( $string );
+ $taxonomy = $data['taxonomy'];
+ $term = $data['term'];
+
+
+ // create empty array
+ if( !isset($terms[ $taxonomy ]) ) {
+
+ $terms[ $taxonomy ] = array();
+
+ }
+
+
+ // append
+ $terms[ $taxonomy ][] = $term;
+
+ }
+
+
+ // return
+ return $terms;
+
+}
+
+
+/*
+* acf_decode_taxonomy_term
+*
+* This function will return the taxonomy and term slug for a given value
+*
+* @type function
+* @date 31/03/2014
+* @since 5.0.0
+*
+* @param $string (string)
+* @return (array)
+*/
+
+function acf_decode_taxonomy_term( $value ) {
+
+ // vars
+ $data = array(
+ 'taxonomy' => '',
+ 'term' => ''
+ );
+
+
+ // int
+ if( is_numeric($value) ) {
+
+ $data['term'] = $value;
+
+ // string
+ } elseif( is_string($value) ) {
+
+ $value = explode(':', $value);
+ $data['taxonomy'] = isset($value[0]) ? $value[0] : '';
+ $data['term'] = isset($value[1]) ? $value[1] : '';
+
+ // error
+ } else {
+
+ return false;
+
+ }
+
+
+ // allow for term_id (Used by ACF v4)
+ if( is_numeric($data['term']) ) {
+
+ // global
+ global $wpdb;
+
+
+ // find taxonomy
+ if( !$data['taxonomy'] ) {
+
+ $data['taxonomy'] = $wpdb->get_var( $wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $data['term']) );
+
+ }
+
+
+ // find term (may have numeric slug '123')
+ $term = get_term_by( 'slug', $data['term'], $data['taxonomy'] );
+
+
+ // attempt get term via ID (ACF4 uses ID)
+ if( !$term ) $term = get_term( $data['term'], $data['taxonomy'] );
+
+
+ // bail early if no term
+ if( !$term ) return false;
+
+
+ // update
+ $data['taxonomy'] = $term->taxonomy;
+ $data['term'] = $term->slug;
+
+ }
+
+
+ // return
+ return $data;
+
+}
+
+
+/*
+* acf_get_array
+*
+* This function will force a variable to become an array
+*
+* @type function
+* @date 4/02/2014
+* @since 5.0.0
+*
+* @param $var (mixed)
+* @return (array)
+*/
+
+function acf_get_array( $var = false, $delimiter = '' ) {
+
+ // array
+ if( is_array($var) ) {
+ return $var;
+ }
+
+
+ // bail early if empty
+ if( acf_is_empty($var) ) {
+ return array();
+ }
+
+
+ // string
+ if( is_string($var) && $delimiter ) {
+ return explode($delimiter, $var);
+ }
+
+
+ // place in array
+ return (array) $var;
+
+}
+
+
+/*
+* acf_get_numeric
+*
+* This function will return numeric values
+*
+* @type function
+* @date 15/07/2016
+* @since 5.4.0
+*
+* @param $value (mixed)
+* @return (mixed)
+*/
+
+function acf_get_numeric( $value = '' ) {
+
+ // vars
+ $numbers = array();
+ $is_array = is_array($value);
+
+
+ // loop
+ foreach( (array) $value as $v ) {
+
+ if( is_numeric($v) ) $numbers[] = (int) $v;
+
+ }
+
+
+ // bail early if is empty
+ if( empty($numbers) ) return false;
+
+
+ // convert array
+ if( !$is_array ) $numbers = $numbers[0];
+
+
+ // return
+ return $numbers;
+
+}
+
+
+/*
+* acf_get_posts
+*
+* This function will return an array of posts making sure the order is correct
+*
+* @type function
+* @date 3/03/2015
+* @since 5.1.5
+*
+* @param $args (array)
+* @return (array)
+*/
+
+function acf_get_posts( $args = array() ) {
+
+ // vars
+ $posts = array();
+
+
+ // defaults
+ // leave suppress_filters as true becuase we don't want any plugins to modify the query as we know exactly what
+ $args = wp_parse_args( $args, array(
+ 'posts_per_page' => -1,
+ 'post_type' => '',
+ 'post_status' => 'any',
+ 'update_post_meta_cache' => false,
+ 'update_post_term_cache' => false
+ ));
+
+
+ // post type
+ if( empty($args['post_type']) ) {
+
+ $args['post_type'] = acf_get_post_types();
+
+ }
+
+
+ // validate post__in
+ if( $args['post__in'] ) {
+
+ // force value to array
+ $args['post__in'] = acf_get_array( $args['post__in'] );
+
+
+ // convert to int
+ $args['post__in'] = array_map('intval', $args['post__in']);
+
+
+ // add filter to remove post_type
+ // use 'query' filter so that 'suppress_filters' can remain true
+ //add_filter('query', '_acf_query_remove_post_type');
+
+
+ // order by post__in
+ $args['orderby'] = 'post__in';
+
+ }
+
+
+ // load posts in 1 query to save multiple DB calls from following code
+ $posts = get_posts($args);
+
+
+ // remove this filter (only once)
+ //remove_filter('query', '_acf_query_remove_post_type');
+
+
+ // validate order
+ if( $posts && $args['post__in'] ) {
+
+ // vars
+ $order = array();
+
+
+ // generate sort order
+ foreach( $posts as $i => $post ) {
+
+ $order[ $i ] = array_search($post->ID, $args['post__in']);
+
+ }
+
+
+ // sort
+ array_multisort($order, $posts);
+
+ }
+
+
+ // return
+ return $posts;
+
+}
+
+
+/*
+* _acf_query_remove_post_type
+*
+* This function will remove the 'wp_posts.post_type' WHERE clause completely
+* When using 'post__in', this clause is unneccessary and slow.
+*
+* @type function
+* @date 4/03/2015
+* @since 5.1.5
+*
+* @param $sql (string)
+* @return $sql
+*/
+
+function _acf_query_remove_post_type( $sql ) {
+
+ // global
+ global $wpdb;
+
+
+ // bail ealry if no 'wp_posts.ID IN'
+ if( strpos($sql, "$wpdb->posts.ID IN") === false ) {
+
+ return $sql;
+
+ }
+
+
+ // get bits
+ $glue = 'AND';
+ $bits = explode($glue, $sql);
+
+
+ // loop through $where and remove any post_type queries
+ foreach( $bits as $i => $bit ) {
+
+ if( strpos($bit, "$wpdb->posts.post_type") !== false ) {
+
+ unset( $bits[ $i ] );
+
+ }
+
+ }
+
+
+ // join $where back together
+ $sql = implode($glue, $bits);
+
+
+ // return
+ return $sql;
+
+}
+
+
+/*
+* acf_get_grouped_posts
+*
+* This function will return all posts grouped by post_type
+* This is handy for select settings
+*
+* @type function
+* @date 27/02/2014
+* @since 5.0.0
+*
+* @param $args (array)
+* @return (array)
+*/
+
+function acf_get_grouped_posts( $args ) {
+
+ // vars
+ $data = array();
+
+
+ // defaults
+ $args = wp_parse_args( $args, array(
+ 'posts_per_page' => -1,
+ 'paged' => 0,
+ 'post_type' => 'post',
+ 'orderby' => 'menu_order title',
+ 'order' => 'ASC',
+ 'post_status' => 'any',
+ 'suppress_filters' => false,
+ 'update_post_meta_cache' => false,
+ ));
+
+
+ // find array of post_type
+ $post_types = acf_get_array( $args['post_type'] );
+ $post_types_labels = acf_get_pretty_post_types($post_types);
+ $is_single_post_type = ( count($post_types) == 1 );
+
+
+ // attachment doesn't work if it is the only item in an array
+ if( $is_single_post_type) {
+ $args['post_type'] = current($post_types);
+ }
+
+
+ // add filter to orderby post type
+ if( !$is_single_post_type ) {
+ add_filter('posts_orderby', '_acf_orderby_post_type', 10, 2);
+ }
+
+
+ // get posts
+ $posts = get_posts( $args );
+
+
+ // remove this filter (only once)
+ if( !$is_single_post_type ) {
+ remove_filter('posts_orderby', '_acf_orderby_post_type', 10, 2);
+ }
+
+
+ // loop
+ foreach( $post_types as $post_type ) {
+
+ // vars
+ $this_posts = array();
+ $this_group = array();
+
+
+ // populate $this_posts
+ foreach( $posts as $post ) {
+ if( $post->post_type == $post_type ) {
+ $this_posts[] = $post;
+ }
+ }
+
+
+ // bail early if no posts for this post type
+ if( empty($this_posts) ) continue;
+
+
+ // sort into hierachial order!
+ // this will fail if a search has taken place because parents wont exist
+ if( is_post_type_hierarchical($post_type) && empty($args['s'])) {
+
+ // vars
+ $post_id = $this_posts[0]->ID;
+ $parent_id = acf_maybe_get($args, 'post_parent', 0);
+ $offset = 0;
+ $length = count($this_posts);
+
+
+ // get all posts from this post type
+ $all_posts = get_posts(array_merge($args, array(
+ 'posts_per_page' => -1,
+ 'paged' => 0,
+ 'post_type' => $post_type
+ )));
+
+
+ // find starting point (offset)
+ foreach( $all_posts as $i => $post ) {
+ if( $post->ID == $post_id ) {
+ $offset = $i;
+ break;
+ }
+ }
+
+
+ // order posts
+ $ordered_posts = get_page_children($parent_id, $all_posts);
+
+
+ // 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_posts) == count($all_posts) ) {
+ $this_posts = array_slice($ordered_posts, $offset, $length);
+ }
+
+ }
+
+
+ // populate $this_posts
+ foreach( $this_posts as $post ) {
+ $this_group[ $post->ID ] = $post;
+ }
+
+
+ // group by post type
+ $label = $post_types_labels[ $post_type ];
+ $data[ $label ] = $this_group;
+
+ }
+
+
+ // return
+ return $data;
+
+}
+
+
+function _acf_orderby_post_type( $ordeby, $wp_query ) {
+
+ // global
+ global $wpdb;
+
+
+ // get post types
+ $post_types = $wp_query->get('post_type');
+
+
+ // prepend SQL
+ if( is_array($post_types) ) {
+
+ $post_types = implode("','", $post_types);
+ $ordeby = "FIELD({$wpdb->posts}.post_type,'$post_types')," . $ordeby;
+
+ }
+
+
+ // return
+ return $ordeby;
+
+}
+
+
+function acf_get_post_title( $post = 0, $is_search = false ) {
+
+ // vars
+ $post = get_post($post);
+ $title = '';
+ $prepend = '';
+ $append = '';
+
+
+ // bail early if no post
+ if( !$post ) return '';
+
+
+ // title
+ $title = get_the_title( $post->ID );
+
+
+ // empty
+ if( $title === '' ) {
+
+ $title = __('(no title)', 'acf');
+
+ }
+
+
+ // status
+ if( get_post_status( $post->ID ) != "publish" ) {
+
+ $append .= ' (' . get_post_status( $post->ID ) . ')';
+
+ }
+
+
+ // ancestors
+ if( $post->post_type !== 'attachment' ) {
+
+ // get ancestors
+ $ancestors = get_ancestors( $post->ID, $post->post_type );
+ $prepend .= str_repeat('- ', count($ancestors));
+
+
+ // add parent
+/*
+ removed in 5.6.5 as not used by the UI
+ if( $is_search && !empty($ancestors) ) {
+
+ // reverse
+ $ancestors = array_reverse($ancestors);
+
+
+ // convert id's into titles
+ foreach( $ancestors as $i => $id ) {
+
+ $ancestors[ $i ] = get_the_title( $id );
+
+ }
+
+
+ // append
+ $append .= ' | ' . __('Parent', 'acf') . ': ' . implode(' / ', $ancestors);
+
+ }
+*/
+
+ }
+
+
+ // merge
+ $title = $prepend . $title . $append;
+
+
+ // return
+ return $title;
+
+}
+
+
+function acf_order_by_search( $array, $search ) {
+
+ // vars
+ $weights = array();
+ $needle = strtolower( $search );
+
+
+ // add key prefix
+ foreach( array_keys($array) as $k ) {
+
+ $array[ '_' . $k ] = acf_extract_var( $array, $k );
+
+ }
+
+
+ // add search weight
+ foreach( $array as $k => $v ) {
+
+ // vars
+ $weight = 0;
+ $haystack = strtolower( $v );
+ $strpos = strpos( $haystack, $needle );
+
+
+ // detect search match
+ if( $strpos !== false ) {
+
+ // set eright to length of match
+ $weight = strlen( $search );
+
+
+ // increase weight if match starts at begining of string
+ if( $strpos == 0 ) {
+
+ $weight++;
+
+ }
+
+ }
+
+
+ // append to wights
+ $weights[ $k ] = $weight;
+
+ }
+
+
+ // sort the array with menu_order ascending
+ array_multisort( $weights, SORT_DESC, $array );
+
+
+ // remove key prefix
+ foreach( array_keys($array) as $k ) {
+
+ $array[ substr($k,1) ] = acf_extract_var( $array, $k );
+
+ }
+
+
+ // return
+ return $array;
+}
+
+
+/*
+* acf_get_pretty_user_roles
+*
+* description
+*
+* @type function
+* @date 23/02/2016
+* @since 5.3.2
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_get_pretty_user_roles( $allowed = false ) {
+
+ // vars
+ $editable_roles = get_editable_roles();
+ $allowed = acf_get_array($allowed);
+ $roles = array();
+
+
+ // loop
+ foreach( $editable_roles as $role_name => $role_details ) {
+
+ // bail early if not allowed
+ if( !empty($allowed) && !in_array($role_name, $allowed) ) continue;
+
+
+ // append
+ $roles[ $role_name ] = translate_user_role( $role_details['name'] );
+
+ }
+
+
+ // return
+ return $roles;
+
+}
+
+
+/*
+* acf_get_grouped_users
+*
+* This function will return all users grouped by role
+* This is handy for select settings
+*
+* @type function
+* @date 27/02/2014
+* @since 5.0.0
+*
+* @param $args (array)
+* @return (array)
+*/
+
+function acf_get_grouped_users( $args = array() ) {
+
+ // vars
+ $r = array();
+
+
+ // defaults
+ $args = wp_parse_args( $args, array(
+ 'users_per_page' => -1,
+ 'paged' => 0,
+ 'role' => '',
+ 'orderby' => 'login',
+ 'order' => 'ASC',
+ ));
+
+
+ // offset
+ $i = 0;
+ $min = 0;
+ $max = 0;
+ $users_per_page = acf_extract_var($args, 'users_per_page');
+ $paged = acf_extract_var($args, 'paged');
+
+ if( $users_per_page > 0 ) {
+
+ // prevent paged from being -1
+ $paged = max(0, $paged);
+
+
+ // set min / max
+ $min = (($paged-1) * $users_per_page) + 1; // 1, 11
+ $max = ($paged * $users_per_page); // 10, 20
+
+ }
+
+
+ // find array of post_type
+ $user_roles = acf_get_pretty_user_roles($args['role']);
+
+
+ // fix role
+ if( is_array($args['role']) ) {
+
+ // global
+ global $wp_version, $wpdb;
+
+
+ // vars
+ $roles = acf_extract_var($args, 'role');
+
+
+ // new WP has role__in
+ if( version_compare($wp_version, '4.4', '>=' ) ) {
+
+ $args['role__in'] = $roles;
+
+ // old WP doesn't have role__in
+ } else {
+
+ // vars
+ $blog_id = get_current_blog_id();
+ $meta_query = array( 'relation' => 'OR' );
+
+
+ // loop
+ foreach( $roles as $role ) {
+
+ $meta_query[] = array(
+ 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
+ 'value' => '"' . $role . '"',
+ 'compare' => 'LIKE',
+ );
+
+ }
+
+
+ // append
+ $args['meta_query'] = $meta_query;
+
+ }
+
+ }
+
+
+ // get posts
+ $users = get_users( $args );
+
+
+ // loop
+ foreach( $user_roles as $user_role_name => $user_role_label ) {
+
+ // vars
+ $this_users = array();
+ $this_group = array();
+
+
+ // populate $this_posts
+ foreach( array_keys($users) as $key ) {
+
+ // bail ealry if not correct role
+ if( !in_array($user_role_name, $users[ $key ]->roles) ) continue;
+
+
+ // extract user
+ $user = acf_extract_var( $users, $key );
+
+
+ // increase
+ $i++;
+
+
+ // bail ealry if too low
+ if( $min && $i < $min ) continue;
+
+
+ // bail early if too high (don't bother looking at any more users)
+ if( $max && $i > $max ) break;
+
+
+ // group by post type
+ $this_users[ $user->ID ] = $user;
+
+
+ }
+
+
+ // bail early if no posts for this post type
+ if( empty($this_users) ) continue;
+
+
+ // append
+ $r[ $user_role_label ] = $this_users;
+
+ }
+
+
+ // return
+ return $r;
+
+}
+
+
+/*
+* acf_json_encode
+*
+* This function will return pretty JSON for all PHP versions
+*
+* @type function
+* @date 6/03/2014
+* @since 5.0.0
+*
+* @param $json (array)
+* @return (string)
+*/
+
+function acf_json_encode( $json ) {
+
+ // PHP at least 5.4
+ if( version_compare(PHP_VERSION, '5.4.0', '>=') ) {
+
+ return json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
+
+ }
+
+
+
+ // PHP less than 5.4
+ $json = json_encode($json);
+
+
+ // http://snipplr.com/view.php?codeview&id=60559
+ $result = '';
+ $pos = 0;
+ $strLen = strlen($json);
+ $indentStr = " ";
+ $newLine = "\n";
+ $prevChar = '';
+ $outOfQuotes = true;
+
+ for ($i=0; $i<=$strLen; $i++) {
+
+ // Grab the next character in the string.
+ $char = substr($json, $i, 1);
+
+ // Are we inside a quoted string?
+ if ($char == '"' && $prevChar != '\\') {
+ $outOfQuotes = !$outOfQuotes;
+
+ // If this character is the end of an element,
+ // output a new line and indent the next line.
+ } else if(($char == '}' || $char == ']') && $outOfQuotes) {
+ $result .= $newLine;
+ $pos --;
+ for ($j=0; $j<$pos; $j++) {
+ $result .= $indentStr;
+ }
+ }
+
+ // Add the character to the result string.
+ $result .= $char;
+
+ // If this character is ':' adda space after it
+ if($char == ':' && $outOfQuotes) {
+ $result .= ' ';
+ }
+
+ // If the last character was the beginning of an element,
+ // output a new line and indent the next line.
+ if (($char == ',' || $char == '{' || $char == '[') && $outOfQuotes) {
+ $result .= $newLine;
+ if ($char == '{' || $char == '[') {
+ $pos ++;
+ }
+
+ for ($j = 0; $j < $pos; $j++) {
+ $result .= $indentStr;
+ }
+ }
+
+ $prevChar = $char;
+ }
+
+
+ // return
+ return $result;
+
+}
+
+
+/*
+* acf_str_exists
+*
+* This function will return true if a sub string is found
+*
+* @type function
+* @date 1/05/2014
+* @since 5.0.0
+*
+* @param $needle (string)
+* @param $haystack (string)
+* @return (boolean)
+*/
+
+function acf_str_exists( $needle, $haystack ) {
+
+ // return true if $haystack contains the $needle
+ if( is_string($haystack) && strpos($haystack, $needle) !== false ) {
+
+ return true;
+
+ }
+
+
+ // return
+ return false;
+}
+
+
+/*
+* acf_debug
+*
+* description
+*
+* @type function
+* @date 2/05/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_debug() {
+
+ // vars
+ $args = func_get_args();
+ $s = array_shift($args);
+ $o = '';
+ $nl = "\r\n";
+
+
+ // start script
+ $o .= '' . $nl;
+
+
+ // echo
+ echo $o;
+}
+
+function acf_debug_start() {
+
+ acf_update_setting( 'debug_start', memory_get_usage());
+
+}
+
+function acf_debug_end() {
+
+ $start = acf_get_setting( 'debug_start' );
+ $end = memory_get_usage();
+
+ return $end - $start;
+
+}
+
+
+/*
+* acf_encode_choices
+*
+* description
+*
+* @type function
+* @date 4/06/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_encode_choices( $array = array(), $show_keys = true ) {
+
+ // bail early if not array (maybe a single string)
+ if( !is_array($array) ) return $array;
+
+
+ // bail early if empty array
+ if( empty($array) ) return '';
+
+
+ // vars
+ $string = '';
+
+
+ // if allowed to show keys (good for choices, not for default values)
+ if( $show_keys ) {
+
+ // loop
+ foreach( $array as $k => $v ) {
+
+ // ignore if key and value are the same
+ if( strval($k) == strval($v) ) continue;
+
+
+ // show key in the value
+ $array[ $k ] = $k . ' : ' . $v;
+
+ }
+
+ }
+
+
+ // implode
+ $string = implode("\n", $array);
+
+
+ // return
+ return $string;
+
+}
+
+function acf_decode_choices( $string = '', $array_keys = false ) {
+
+ // bail early if already array
+ if( is_array($string) ) {
+
+ return $string;
+
+ // allow numeric values (same as string)
+ } elseif( is_numeric($string) ) {
+
+ // do nothing
+
+ // bail early if not a string
+ } elseif( !is_string($string) ) {
+
+ return array();
+
+ // bail early if is empty string
+ } elseif( $string === '' ) {
+
+ return array();
+
+ }
+
+
+ // vars
+ $array = array();
+
+
+ // explode
+ $lines = explode("\n", $string);
+
+
+ // key => value
+ foreach( $lines as $line ) {
+
+ // vars
+ $k = trim($line);
+ $v = trim($line);
+
+
+ // look for ' : '
+ if( acf_str_exists(' : ', $line) ) {
+
+ $line = explode(' : ', $line);
+
+ $k = trim($line[0]);
+ $v = trim($line[1]);
+
+ }
+
+
+ // append
+ $array[ $k ] = $v;
+
+ }
+
+
+ // return only array keys? (good for checkbox default_value)
+ if( $array_keys ) {
+
+ return array_keys($array);
+
+ }
+
+
+ // return
+ return $array;
+
+}
+
+
+/*
+* acf_str_replace
+*
+* This function will replace an array of strings much like str_replace
+* The difference is the extra logic to avoid replacing a string that has alread been replaced
+* This is very useful for replacing date characters as they overlap with eachother
+*
+* @type function
+* @date 21/06/2016
+* @since 5.3.8
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_str_replace( $string = '', $search_replace = array() ) {
+
+ // vars
+ $ignore = array();
+
+
+ // remove potential empty search to avoid PHP error
+ unset($search_replace['']);
+
+
+ // loop over conversions
+ foreach( $search_replace as $search => $replace ) {
+
+ // ignore this search, it was a previous replace
+ if( in_array($search, $ignore) ) continue;
+
+
+ // bail early if subsctring not found
+ if( strpos($string, $search) === false ) continue;
+
+
+ // replace
+ $string = str_replace($search, $replace, $string);
+
+
+ // append to ignore
+ $ignore[] = $replace;
+
+ }
+
+
+ // return
+ return $string;
+
+}
+
+
+/*
+* date & time formats
+*
+* These settings contain an association of format strings from PHP => JS
+*
+* @type function
+* @date 21/06/2016
+* @since 5.3.8
+*
+* @param n/a
+* @return n/a
+*/
+
+acf_update_setting('php_to_js_date_formats', array(
+
+ // Year
+ 'Y' => 'yy', // Numeric, 4 digits 1999, 2003
+ 'y' => 'y', // Numeric, 2 digits 99, 03
+
+
+ // Month
+ 'm' => 'mm', // Numeric, with leading zeros 01–12
+ 'n' => 'm', // Numeric, without leading zeros 1–12
+ 'F' => 'MM', // Textual full January – December
+ 'M' => 'M', // Textual three letters Jan - Dec
+
+
+ // Weekday
+ 'l' => 'DD', // Full name (lowercase 'L') Sunday – Saturday
+ 'D' => 'D', // Three letter name Mon – Sun
+
+
+ // Day of Month
+ 'd' => 'dd', // Numeric, with leading zeros 01–31
+ 'j' => 'd', // Numeric, without leading zeros 1–31
+ 'S' => '', // The English suffix for the day of the month st, nd or th in the 1st, 2nd or 15th.
+
+));
+
+acf_update_setting('php_to_js_time_formats', array(
+
+ 'a' => 'tt', // Lowercase Ante meridiem and Post meridiem am or pm
+ 'A' => 'TT', // Uppercase Ante meridiem and Post meridiem AM or PM
+ 'h' => 'hh', // 12-hour format of an hour with leading zeros 01 through 12
+ 'g' => 'h', // 12-hour format of an hour without leading zeros 1 through 12
+ 'H' => 'HH', // 24-hour format of an hour with leading zeros 00 through 23
+ 'G' => 'H', // 24-hour format of an hour without leading zeros 0 through 23
+ 'i' => 'mm', // Minutes with leading zeros 00 to 59
+ 's' => 'ss', // Seconds, with leading zeros 00 through 59
+
+));
+
+
+/*
+* acf_split_date_time
+*
+* This function will split a format string into seperate date and time
+*
+* @type function
+* @date 26/05/2016
+* @since 5.3.8
+*
+* @param $date_time (string)
+* @return $formats (array)
+*/
+
+function acf_split_date_time( $date_time = '' ) {
+
+ // vars
+ $php_date = acf_get_setting('php_to_js_date_formats');
+ $php_time = acf_get_setting('php_to_js_time_formats');
+ $chars = str_split($date_time);
+ $type = 'date';
+
+
+ // default
+ $data = array(
+ 'date' => '',
+ 'time' => ''
+ );
+
+
+ // loop
+ foreach( $chars as $i => $c ) {
+
+ // find type
+ // - allow misc characters to append to previous type
+ if( isset($php_date[ $c ]) ) {
+
+ $type = 'date';
+
+ } elseif( isset($php_time[ $c ]) ) {
+
+ $type = 'time';
+
+ }
+
+
+ // append char
+ $data[ $type ] .= $c;
+
+ }
+
+
+ // trim
+ $data['date'] = trim($data['date']);
+ $data['time'] = trim($data['time']);
+
+
+ // return
+ return $data;
+
+}
+
+
+/*
+* acf_convert_date_to_php
+*
+* This fucntion converts a date format string from JS to PHP
+*
+* @type function
+* @date 20/06/2014
+* @since 5.0.0
+*
+* @param $date (string)
+* @return (string)
+*/
+
+function acf_convert_date_to_php( $date = '' ) {
+
+ // vars
+ $php_to_js = acf_get_setting('php_to_js_date_formats');
+ $js_to_php = array_flip($php_to_js);
+
+
+ // return
+ return acf_str_replace( $date, $js_to_php );
+
+}
+
+/*
+* acf_convert_date_to_js
+*
+* This fucntion converts a date format string from PHP to JS
+*
+* @type function
+* @date 20/06/2014
+* @since 5.0.0
+*
+* @param $date (string)
+* @return (string)
+*/
+
+function acf_convert_date_to_js( $date = '' ) {
+
+ // vars
+ $php_to_js = acf_get_setting('php_to_js_date_formats');
+
+
+ // return
+ return acf_str_replace( $date, $php_to_js );
+
+}
+
+
+/*
+* acf_convert_time_to_php
+*
+* This fucntion converts a time format string from JS to PHP
+*
+* @type function
+* @date 20/06/2014
+* @since 5.0.0
+*
+* @param $time (string)
+* @return (string)
+*/
+
+function acf_convert_time_to_php( $time = '' ) {
+
+ // vars
+ $php_to_js = acf_get_setting('php_to_js_time_formats');
+ $js_to_php = array_flip($php_to_js);
+
+
+ // return
+ return acf_str_replace( $time, $js_to_php );
+
+}
+
+
+/*
+* acf_convert_time_to_js
+*
+* This fucntion converts a date format string from PHP to JS
+*
+* @type function
+* @date 20/06/2014
+* @since 5.0.0
+*
+* @param $time (string)
+* @return (string)
+*/
+
+function acf_convert_time_to_js( $time = '' ) {
+
+ // vars
+ $php_to_js = acf_get_setting('php_to_js_time_formats');
+
+
+ // return
+ return acf_str_replace( $time, $php_to_js );
+
+}
+
+
+/*
+* acf_update_user_setting
+*
+* description
+*
+* @type function
+* @date 15/07/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_update_user_setting( $name, $value ) {
+
+ // get current user id
+ $user_id = get_current_user_id();
+
+
+ // get user settings
+ $settings = get_user_meta( $user_id, 'acf_user_settings', true );
+
+
+ // ensure array
+ $settings = acf_get_array($settings);
+
+
+ // delete setting (allow 0 to save)
+ if( acf_is_empty($value) ) {
+
+ unset($settings[ $name ]);
+
+ // append setting
+ } else {
+
+ $settings[ $name ] = $value;
+
+ }
+
+
+ // update user data
+ return update_metadata('user', $user_id, 'acf_user_settings', $settings);
+
+}
+
+
+/*
+* acf_get_user_setting
+*
+* description
+*
+* @type function
+* @date 15/07/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_get_user_setting( $name = '', $default = false ) {
+
+ // get current user id
+ $user_id = get_current_user_id();
+
+
+ // get user settings
+ $settings = get_user_meta( $user_id, 'acf_user_settings', true );
+
+
+ // ensure array
+ $settings = acf_get_array($settings);
+
+
+ // bail arly if no settings
+ if( !isset($settings[$name]) ) return $default;
+
+
+ // return
+ return $settings[$name];
+
+}
+
+
+/*
+* acf_in_array
+*
+* description
+*
+* @type function
+* @date 22/07/2014
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_in_array( $value = '', $array = false ) {
+
+ // bail early if not array
+ if( !is_array($array) ) return false;
+
+
+ // find value in array
+ return in_array($value, $array);
+
+}
+
+
+/*
+* acf_get_valid_post_id
+*
+* This function will return a valid post_id based on the current screen / parameter
+*
+* @type function
+* @date 8/12/2013
+* @since 5.0.0
+*
+* @param $post_id (mixed)
+* @return $post_id (mixed)
+*/
+
+function acf_get_valid_post_id( $post_id = 0 ) {
+
+ // vars
+ $_post_id = $post_id;
+
+
+ // if not $post_id, load queried object
+ if( !$post_id ) {
+
+ // try for global post (needed for setup_postdata)
+ $post_id = (int) get_the_ID();
+
+
+ // try for current screen
+ if( !$post_id ) {
+
+ $post_id = get_queried_object();
+
+ }
+
+ }
+
+
+ // $post_id may be an object
+ if( is_object($post_id) ) {
+
+ // post
+ if( isset($post_id->post_type, $post_id->ID) ) {
+
+ $post_id = $post_id->ID;
+
+ // user
+ } elseif( isset($post_id->roles, $post_id->ID) ) {
+
+ $post_id = 'user_' . $post_id->ID;
+
+ // term
+ } elseif( isset($post_id->taxonomy, $post_id->term_id) ) {
+
+ $post_id = acf_get_term_post_id( $post_id->taxonomy, $post_id->term_id );
+
+ // comment
+ } elseif( isset($post_id->comment_ID) ) {
+
+ $post_id = 'comment_' . $post_id->comment_ID;
+
+ // default
+ } else {
+
+ $post_id = 0;
+
+ }
+
+ }
+
+
+ // allow for option == options
+ if( $post_id === 'option' ) {
+
+ $post_id = 'options';
+
+ }
+
+
+ // append language code
+ if( $post_id == 'options' ) {
+
+ $dl = acf_get_setting('default_language');
+ $cl = acf_get_setting('current_language');
+
+ if( $cl && $cl !== $dl ) {
+
+ $post_id .= '_' . $cl;
+
+ }
+
+ }
+
+
+
+ // filter for 3rd party
+ $post_id = apply_filters('acf/validate_post_id', $post_id, $_post_id);
+
+
+ // return
+ return $post_id;
+
+}
+
+
+
+/*
+* acf_get_post_id_info
+*
+* This function will return the type and id for a given $post_id string
+*
+* @type function
+* @date 2/07/2016
+* @since 5.4.0
+*
+* @param $post_id (mixed)
+* @return $info (array)
+*/
+
+function acf_get_post_id_info( $post_id = 0 ) {
+
+ // vars
+ $info = array(
+ 'type' => 'post',
+ 'id' => 0
+ );
+
+ // bail early if no $post_id
+ if( !$post_id ) return $info;
+
+
+ // check cache
+ // - this function will most likely be called multiple times (saving loading fields from post)
+ //$cache_key = "get_post_id_info/post_id={$post_id}";
+
+ //if( acf_isset_cache($cache_key) ) return acf_get_cache($cache_key);
+
+
+ // numeric
+ if( is_numeric($post_id) ) {
+
+ $info['id'] = (int) $post_id;
+
+ // string
+ } elseif( is_string($post_id) ) {
+
+ // vars
+ $glue = '_';
+ $type = explode($glue, $post_id);
+ $id = array_pop($type);
+ $type = implode($glue, $type);
+ $meta = array('post', 'user', 'comment', 'term');
+
+
+ // check if is taxonomy (ACF < 5.5)
+ // - avoid scenario where taxonomy exists with name of meta type
+ if( !in_array($type, $meta) && acf_isset_termmeta($type) ) $type = 'term';
+
+
+ // meta
+ if( is_numeric($id) && in_array($type, $meta) ) {
+
+ $info['type'] = $type;
+ $info['id'] = (int) $id;
+
+ // option
+ } else {
+
+ $info['type'] = 'option';
+ $info['id'] = $post_id;
+
+ }
+
+ }
+
+
+ // update cache
+ //acf_set_cache($cache_key, $info);
+
+
+ // return
+ return $info;
+
+}
+
+
+/*
+
+acf_log( acf_get_post_id_info(4) );
+
+acf_log( acf_get_post_id_info('post_4') );
+
+acf_log( acf_get_post_id_info('user_123') );
+
+acf_log( acf_get_post_id_info('term_567') );
+
+acf_log( acf_get_post_id_info('category_204') );
+
+acf_log( acf_get_post_id_info('comment_6') );
+
+acf_log( acf_get_post_id_info('options_lol!') );
+
+acf_log( acf_get_post_id_info('option') );
+
+acf_log( acf_get_post_id_info('options') );
+
+*/
+
+
+/*
+* acf_isset_termmeta
+*
+* This function will return true if the termmeta table exists
+* https://developer.wordpress.org/reference/functions/get_term_meta/
+*
+* @type function
+* @date 3/09/2016
+* @since 5.4.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_isset_termmeta( $taxonomy = '' ) {
+
+ // bail ealry if no table
+ if( get_option('db_version') < 34370 ) return false;
+
+
+ // check taxonomy
+ if( $taxonomy && !taxonomy_exists($taxonomy) ) return false;
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* acf_get_term_post_id
+*
+* This function will return a valid post_id string for a given term and taxonomy
+*
+* @type function
+* @date 6/2/17
+* @since 5.5.6
+*
+* @param $taxonomy (string)
+* @param $term_id (int)
+* @return (string)
+*/
+
+function acf_get_term_post_id( $taxonomy, $term_id ) {
+
+ // WP < 4.4
+ if( !acf_isset_termmeta() ) {
+
+ return $taxonomy . '_' . $term_id;
+
+ }
+
+
+ // return
+ return 'term_' . $term_id;
+
+}
+
+
+/*
+* acf_upload_files
+*
+* This function will walk througfh the $_FILES data and upload each found
+*
+* @type function
+* @date 25/10/2014
+* @since 5.0.9
+*
+* @param $ancestors (array) an internal parameter, not required
+* @return n/a
+*/
+
+function acf_upload_files( $ancestors = array() ) {
+
+ // vars
+ $file = array(
+ 'name' => '',
+ 'type' => '',
+ 'tmp_name' => '',
+ 'error' => '',
+ 'size' => ''
+ );
+
+
+ // populate with $_FILES data
+ foreach( array_keys($file) as $k ) {
+
+ $file[ $k ] = $_FILES['acf'][ $k ];
+
+ }
+
+
+ // walk through ancestors
+ if( !empty($ancestors) ) {
+
+ foreach( $ancestors as $a ) {
+
+ foreach( array_keys($file) as $k ) {
+
+ $file[ $k ] = $file[ $k ][ $a ];
+
+ }
+
+ }
+
+ }
+
+
+ // is array?
+ if( is_array($file['name']) ) {
+
+ foreach( array_keys($file['name']) as $k ) {
+
+ $_ancestors = array_merge($ancestors, array($k));
+
+ acf_upload_files( $_ancestors );
+
+ }
+
+ return;
+
+ }
+
+
+ // bail ealry if file has error (no file uploaded)
+ if( $file['error'] ) {
+
+ return;
+
+ }
+
+
+ // assign global _acfuploader for media validation
+ $_POST['_acfuploader'] = end($ancestors);
+
+
+ // file found!
+ $attachment_id = acf_upload_file( $file );
+
+
+ // update $_POST
+ array_unshift($ancestors, 'acf');
+ acf_update_nested_array( $_POST, $ancestors, $attachment_id );
+
+}
+
+
+/*
+* acf_upload_file
+*
+* This function will uploade a $_FILE
+*
+* @type function
+* @date 27/10/2014
+* @since 5.0.9
+*
+* @param $uploaded_file (array) array found from $_FILE data
+* @return $id (int) new attachment ID
+*/
+
+function acf_upload_file( $uploaded_file ) {
+
+ // required
+ //require_once( ABSPATH . "/wp-load.php" ); // WP should already be loaded
+ require_once( ABSPATH . "/wp-admin/includes/media.php" ); // video functions
+ require_once( ABSPATH . "/wp-admin/includes/file.php" );
+ require_once( ABSPATH . "/wp-admin/includes/image.php" );
+
+
+ // required for wp_handle_upload() to upload the file
+ $upload_overrides = array( 'test_form' => false );
+
+
+ // upload
+ $file = wp_handle_upload( $uploaded_file, $upload_overrides );
+
+
+ // bail ealry if upload failed
+ if( isset($file['error']) ) {
+
+ return $file['error'];
+
+ }
+
+
+ // vars
+ $url = $file['url'];
+ $type = $file['type'];
+ $file = $file['file'];
+ $filename = basename($file);
+
+
+ // Construct the object array
+ $object = array(
+ 'post_title' => $filename,
+ 'post_mime_type' => $type,
+ 'guid' => $url,
+ 'context' => 'acf-upload'
+ );
+
+ // Save the data
+ $id = wp_insert_attachment($object, $file);
+
+ // Add the meta-data
+ wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
+
+ /** This action is documented in wp-admin/custom-header.php */
+ do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication
+
+ // return new ID
+ return $id;
+
+}
+
+
+/*
+* acf_update_nested_array
+*
+* This function will update a nested array value. Useful for modifying the $_POST array
+*
+* @type function
+* @date 27/10/2014
+* @since 5.0.9
+*
+* @param $array (array) target array to be updated
+* @param $ancestors (array) array of keys to navigate through to find the child
+* @param $value (mixed) The new value
+* @return (boolean)
+*/
+
+function acf_update_nested_array( &$array, $ancestors, $value ) {
+
+ // if no more ancestors, update the current var
+ if( empty($ancestors) ) {
+
+ $array = $value;
+
+ // return
+ return true;
+
+ }
+
+
+ // shift the next ancestor from the array
+ $k = array_shift( $ancestors );
+
+
+ // if exists
+ if( isset($array[ $k ]) ) {
+
+ return acf_update_nested_array( $array[ $k ], $ancestors, $value );
+
+ }
+
+
+ // return
+ return false;
+}
+
+
+/*
+* acf_is_screen
+*
+* This function will return true if all args are matched for the current screen
+*
+* @type function
+* @date 9/12/2014
+* @since 5.1.5
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_is_screen( $id = '' ) {
+
+ // bail early if not defined
+ if( !function_exists('get_current_screen') ) return false;
+
+
+ // vars
+ $current_screen = get_current_screen();
+
+
+ // bail early if no screen
+ if( !$current_screen ) return false;
+
+
+ // return
+ return ($id === $current_screen->id);
+
+}
+
+
+/*
+* acf_maybe_get
+*
+* This function will return a var if it exists in an array
+*
+* @type function
+* @date 9/12/2014
+* @since 5.1.5
+*
+* @param $array (array) the array to look within
+* @param $key (key) the array key to look for. Nested values may be found using '/'
+* @param $default (mixed) the value returned if not found
+* @return $post_id (int)
+*/
+
+function acf_maybe_get( $array = array(), $key = 0, $default = null ) {
+
+ return isset( $array[$key] ) ? $array[$key] : $default;
+
+}
+
+function acf_maybe_get_POST( $key = '', $default = null ) {
+
+ return isset( $_POST[$key] ) ? $_POST[$key] : $default;
+
+}
+
+function acf_maybe_get_GET( $key = '', $default = null ) {
+
+ return isset( $_GET[$key] ) ? $_GET[$key] : $default;
+
+}
+
+
+/*
+* acf_get_attachment
+*
+* This function will return an array of attachment data
+*
+* @type function
+* @date 5/01/2015
+* @since 5.1.5
+*
+* @param $post (mixed) either post ID or post object
+* @return (array)
+*/
+
+function acf_get_attachment( $post ) {
+
+ // post
+ $post = get_post($post);
+
+
+ // bail early if no post
+ if( !$post ) return false;
+
+
+ // vars
+ $thumb_id = 0;
+ $id = $post->ID;
+ $a = array(
+ 'ID' => $id,
+ 'id' => $id,
+ 'title' => $post->post_title,
+ 'filename' => wp_basename( $post->guid ),
+ 'url' => wp_get_attachment_url( $id ),
+ 'alt' => get_post_meta($id, '_wp_attachment_image_alt', true),
+ 'author' => $post->post_author,
+ 'description' => $post->post_content,
+ 'caption' => $post->post_excerpt,
+ 'name' => $post->post_name,
+ 'date' => $post->post_date_gmt,
+ 'modified' => $post->post_modified_gmt,
+ 'mime_type' => $post->post_mime_type,
+ 'type' => acf_maybe_get( explode('/', $post->post_mime_type), 0, '' ),
+ 'icon' => wp_mime_type_icon( $id )
+ );
+
+
+ // video may use featured image
+ if( $a['type'] === 'image' ) {
+
+ $thumb_id = $id;
+ $src = wp_get_attachment_image_src( $id, 'full' );
+
+ $a['url'] = $src[0];
+ $a['width'] = $src[1];
+ $a['height'] = $src[2];
+
+
+ } elseif( $a['type'] === 'audio' || $a['type'] === 'video' ) {
+
+ // video dimentions
+ if( $a['type'] == 'video' ) {
+
+ $meta = wp_get_attachment_metadata( $id );
+ $a['width'] = acf_maybe_get($meta, 'width', 0);
+ $a['height'] = acf_maybe_get($meta, 'height', 0);
+
+ }
+
+
+ // feature image
+ if( $featured_id = get_post_thumbnail_id($id) ) {
+
+ $thumb_id = $featured_id;
+
+ }
+
+ }
+
+
+ // sizes
+ if( $thumb_id ) {
+
+ // find all image sizes
+ if( $sizes = get_intermediate_image_sizes() ) {
+
+ $a['sizes'] = array();
+
+ foreach( $sizes as $size ) {
+
+ // url
+ $src = wp_get_attachment_image_src( $thumb_id, $size );
+
+ // add src
+ $a['sizes'][ $size ] = $src[0];
+ $a['sizes'][ $size . '-width' ] = $src[1];
+ $a['sizes'][ $size . '-height' ] = $src[2];
+
+ }
+
+ }
+
+ }
+
+
+ // return
+ return $a;
+
+}
+
+
+/*
+* acf_get_truncated
+*
+* This function will truncate and return a string
+*
+* @type function
+* @date 8/08/2014
+* @since 5.0.0
+*
+* @param $text (string)
+* @param $length (int)
+* @return (string)
+*/
+
+function acf_get_truncated( $text, $length = 64 ) {
+
+ // vars
+ $text = trim($text);
+ $the_length = strlen( $text );
+
+
+ // cut
+ $return = substr( $text, 0, ($length - 3) );
+
+
+ // ...
+ if( $the_length > ($length - 3) ) {
+
+ $return .= '...';
+
+ }
+
+
+ // return
+ return $return;
+
+}
+
+
+/*
+* acf_get_current_url
+*
+* This function will return the current URL
+*
+* @type function
+* @date 23/01/2015
+* @since 5.1.5
+*
+* @param n/a
+* @return (string)
+*/
+
+function acf_get_current_url() {
+
+ // vars
+ $home = home_url();
+ $url = home_url($_SERVER['REQUEST_URI']);
+
+
+ // test
+ //$home = 'http://acf5/dev/wp-admin';
+ //$url = $home . '/dev/wp-admin/api-template/acf_form';
+
+
+ // explode url (4th bit is the sub folder)
+ $bits = explode('/', $home, 4);
+
+
+ /*
+ Array (
+ [0] => http:
+ [1] =>
+ [2] => acf5
+ [3] => dev
+ )
+ */
+
+
+ // handle sub folder
+ if( !empty($bits[3]) ) {
+
+ $find = '/' . $bits[3];
+ $pos = strpos($url, $find);
+ $length = strlen($find);
+
+ if( $pos !== false ) {
+
+ $url = substr_replace($url, '', $pos, $length);
+
+ }
+
+ }
+
+
+ // return
+ return $url;
+
+}
+
+
+/*
+* acf_current_user_can_admin
+*
+* This function will return true if the current user can administrate the ACF field groups
+*
+* @type function
+* @date 9/02/2015
+* @since 5.1.5
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_current_user_can_admin() {
+
+ if( acf_get_setting('show_admin') && current_user_can(acf_get_setting('capability')) ) {
+
+ return true;
+
+ }
+
+
+ // return
+ return false;
+
+}
+
+
+/*
+* acf_get_filesize
+*
+* This function will return a numeric value of bytes for a given filesize string
+*
+* @type function
+* @date 18/02/2015
+* @since 5.1.5
+*
+* @param $size (mixed)
+* @return (int)
+*/
+
+function acf_get_filesize( $size = 1 ) {
+
+ // vars
+ $unit = 'MB';
+ $units = array(
+ 'TB' => 4,
+ 'GB' => 3,
+ 'MB' => 2,
+ 'KB' => 1,
+ );
+
+
+ // look for $unit within the $size parameter (123 KB)
+ if( is_string($size) ) {
+
+ // vars
+ $custom = strtoupper( substr($size, -2) );
+
+ foreach( $units as $k => $v ) {
+
+ if( $custom === $k ) {
+
+ $unit = $k;
+ $size = substr($size, 0, -2);
+
+ }
+
+ }
+
+ }
+
+
+ // calc bytes
+ $bytes = floatval($size) * pow(1024, $units[$unit]);
+
+
+ // return
+ return $bytes;
+
+}
+
+
+/*
+* acf_format_filesize
+*
+* This function will return a formatted string containing the filesize and unit
+*
+* @type function
+* @date 18/02/2015
+* @since 5.1.5
+*
+* @param $size (mixed)
+* @return (int)
+*/
+
+function acf_format_filesize( $size = 1 ) {
+
+ // convert
+ $bytes = acf_get_filesize( $size );
+
+
+ // vars
+ $units = array(
+ 'TB' => 4,
+ 'GB' => 3,
+ 'MB' => 2,
+ 'KB' => 1,
+ );
+
+
+ // loop through units
+ foreach( $units as $k => $v ) {
+
+ $result = $bytes / pow(1024, $v);
+
+ if( $result >= 1 ) {
+
+ return $result . ' ' . $k;
+
+ }
+
+ }
+
+
+ // return
+ return $bytes . ' B';
+
+}
+
+
+/*
+* acf_get_valid_terms
+*
+* This function will replace old terms with new split term ids
+*
+* @type function
+* @date 27/02/2015
+* @since 5.1.5
+*
+* @param $terms (int|array)
+* @param $taxonomy (string)
+* @return $terms
+*/
+
+function acf_get_valid_terms( $terms = false, $taxonomy = 'category' ) {
+
+ // force into array
+ $terms = acf_get_array($terms);
+
+
+ // force ints
+ $terms = array_map('intval', $terms);
+
+
+ // bail early if function does not yet exist or
+ if( !function_exists('wp_get_split_term') || empty($terms) ) {
+
+ return $terms;
+
+ }
+
+
+ // attempt to find new terms
+ foreach( $terms as $i => $term_id ) {
+
+ $new_term_id = wp_get_split_term($term_id, $taxonomy);
+
+ if( $new_term_id ) {
+
+ $terms[ $i ] = $new_term_id;
+
+ }
+
+ }
+
+
+ // return
+ return $terms;
+
+}
+
+
+/*
+* acf_esc_html_deep
+*
+* Navigates through an array and escapes html from the values.
+*
+* @type function
+* @date 10/06/2015
+* @since 5.2.7
+*
+* @param $value (mixed)
+* @return $value
+*/
+
+/*
+function acf_esc_html_deep( $value ) {
+
+ // array
+ if( is_array($value) ) {
+
+ $value = array_map('acf_esc_html_deep', $value);
+
+ // object
+ } elseif( is_object($value) ) {
+
+ $vars = get_object_vars( $value );
+
+ foreach( $vars as $k => $v ) {
+
+ $value->{$k} = acf_esc_html_deep( $v );
+
+ }
+
+ // string
+ } elseif( is_string($value) ) {
+
+ $value = esc_html($value);
+
+ }
+
+
+ // return
+ return $value;
+
+}
+*/
+
+
+/*
+* acf_validate_attachment
+*
+* This function will validate an attachment based on a field's resrictions and return an array of errors
+*
+* @type function
+* @date 3/07/2015
+* @since 5.2.3
+*
+* @param $attachment (array) attachment data. Cahnges based on context
+* @param $field (array) field settings containing restrictions
+* @param $context (string) $file is different when uploading / preparing
+* @return $errors (array)
+*/
+
+function acf_validate_attachment( $attachment, $field, $context = 'prepare' ) {
+
+ // vars
+ $errors = array();
+ $file = array(
+ 'type' => '',
+ 'width' => 0,
+ 'height' => 0,
+ 'size' => 0
+ );
+
+
+ // upload
+ if( $context == 'upload' ) {
+
+ // vars
+ $file['type'] = pathinfo($attachment['name'], PATHINFO_EXTENSION);
+ $file['size'] = filesize($attachment['tmp_name']);
+
+ if( strpos($attachment['type'], 'image') !== false ) {
+
+ $size = getimagesize($attachment['tmp_name']);
+ $file['width'] = acf_maybe_get($size, 0);
+ $file['height'] = acf_maybe_get($size, 1);
+
+ }
+
+ // prepare
+ } elseif( $context == 'prepare' ) {
+
+ $file['type'] = pathinfo($attachment['url'], PATHINFO_EXTENSION);
+ $file['size'] = acf_maybe_get($attachment, 'filesizeInBytes', 0);
+ $file['width'] = acf_maybe_get($attachment, 'width', 0);
+ $file['height'] = acf_maybe_get($attachment, 'height', 0);
+
+ // custom
+ } else {
+
+ $file = array_merge($file, $attachment);
+ $file['type'] = pathinfo($attachment['url'], PATHINFO_EXTENSION);
+
+ }
+
+
+ // image
+ if( $file['width'] || $file['height'] ) {
+
+ // width
+ $min_width = (int) acf_maybe_get($field, 'min_width', 0);
+ $max_width = (int) acf_maybe_get($field, 'max_width', 0);
+
+ if( $file['width'] ) {
+
+ if( $min_width && $file['width'] < $min_width ) {
+
+ // min width
+ $errors['min_width'] = sprintf(__('Image width must be at least %dpx.', 'acf'), $min_width );
+
+ } elseif( $max_width && $file['width'] > $max_width ) {
+
+ // min width
+ $errors['max_width'] = sprintf(__('Image width must not exceed %dpx.', 'acf'), $max_width );
+
+ }
+
+ }
+
+
+ // height
+ $min_height = (int) acf_maybe_get($field, 'min_height', 0);
+ $max_height = (int) acf_maybe_get($field, 'max_height', 0);
+
+ if( $file['height'] ) {
+
+ if( $min_height && $file['height'] < $min_height ) {
+
+ // min height
+ $errors['min_height'] = sprintf(__('Image height must be at least %dpx.', 'acf'), $min_height );
+
+ } elseif( $max_height && $file['height'] > $max_height ) {
+
+ // min height
+ $errors['max_height'] = sprintf(__('Image height must not exceed %dpx.', 'acf'), $max_height );
+
+ }
+
+ }
+
+ }
+
+
+ // file size
+ if( $file['size'] ) {
+
+ $min_size = acf_maybe_get($field, 'min_size', 0);
+ $max_size = acf_maybe_get($field, 'max_size', 0);
+
+ if( $min_size && $file['size'] < acf_get_filesize($min_size) ) {
+
+ // min width
+ $errors['min_size'] = sprintf(__('File size must be at least %s.', 'acf'), acf_format_filesize($min_size) );
+
+ } elseif( $max_size && $file['size'] > acf_get_filesize($max_size) ) {
+
+ // min width
+ $errors['max_size'] = sprintf(__('File size must must not exceed %s.', 'acf'), acf_format_filesize($max_size) );
+
+ }
+
+ }
+
+
+ // file type
+ if( $file['type'] ) {
+
+ $mime_types = acf_maybe_get($field, 'mime_types', '');
+
+ // lower case
+ $file['type'] = strtolower($file['type']);
+ $mime_types = strtolower($mime_types);
+
+
+ // explode
+ $mime_types = str_replace(array(' ', '.'), '', $mime_types);
+ $mime_types = explode(',', $mime_types); // split pieces
+ $mime_types = array_filter($mime_types); // remove empty pieces
+
+ if( !empty($mime_types) && !in_array($file['type'], $mime_types) ) {
+
+ // glue together last 2 types
+ if( count($mime_types) > 1 ) {
+
+ $last1 = array_pop($mime_types);
+ $last2 = array_pop($mime_types);
+
+ $mime_types[] = $last2 . ' ' . __('or', 'acf') . ' ' . $last1;
+
+ }
+
+ $errors['mime_types'] = sprintf(__('File type must be %s.', 'acf'), implode(', ', $mime_types) );
+
+ }
+
+ }
+
+
+ // filter for 3rd party customization
+ $errors = apply_filters("acf/validate_attachment", $errors, $file, $attachment, $field, $context);
+ $errors = apply_filters("acf/validate_attachment/type={$field['type']}", $errors, $file, $attachment, $field, $context );
+ $errors = apply_filters("acf/validate_attachment/name={$field['name']}", $errors, $file, $attachment, $field, $context );
+ $errors = apply_filters("acf/validate_attachment/key={$field['key']}", $errors, $file, $attachment, $field, $context );
+
+
+ // return
+ return $errors;
+
+}
+
+
+/*
+* _acf_settings_uploader
+*
+* Dynamic logic for uploader setting
+*
+* @type function
+* @date 7/05/2015
+* @since 5.2.3
+*
+* @param $uploader (string)
+* @return $uploader
+*/
+
+add_filter('acf/settings/uploader', '_acf_settings_uploader');
+
+function _acf_settings_uploader( $uploader ) {
+
+ // if can't upload files
+ if( !current_user_can('upload_files') ) {
+
+ $uploader = 'basic';
+
+ }
+
+
+ // return
+ return $uploader;
+}
+
+
+/*
+* acf_translate_keys
+*
+* description
+*
+* @type function
+* @date 7/12/2015
+* @since 5.3.2
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+/*
+function acf_translate_keys( $array, $keys ) {
+
+ // bail early if no keys
+ if( empty($keys) ) return $array;
+
+
+ // translate
+ foreach( $keys as $k ) {
+
+ // bail ealry if not exists
+ if( !isset($array[ $k ]) ) continue;
+
+
+ // translate
+ $array[ $k ] = acf_translate( $array[ $k ] );
+
+ }
+
+
+ // return
+ return $array;
+
+}
+*/
+
+
+/*
+* acf_translate
+*
+* This function will translate a string using the new 'l10n_textdomain' setting
+* Also works for arrays which is great for fields - select -> choices
+*
+* @type function
+* @date 4/12/2015
+* @since 5.3.2
+*
+* @param $string (mixed) string or array containins strings to be translated
+* @return $string
+*/
+
+function acf_translate( $string ) {
+
+ // vars
+ $l10n = acf_get_setting('l10n');
+ $textdomain = acf_get_setting('l10n_textdomain');
+
+
+ // bail early if not enabled
+ if( !$l10n ) return $string;
+
+
+ // bail early if no textdomain
+ if( !$textdomain ) return $string;
+
+
+ // is array
+ if( is_array($string) ) {
+
+ return array_map('acf_translate', $string);
+
+ }
+
+
+ // bail early if not string
+ if( !is_string($string) ) return $string;
+
+
+ // bail early if empty
+ if( $string === '' ) return $string;
+
+
+ // allow for var_export export
+ if( acf_get_setting('l10n_var_export') ){
+
+ // bail early if already translated
+ if( substr($string, 0, 7) === '!!__(!!' ) return $string;
+
+
+ // return
+ return "!!__(!!'" . $string . "!!', !!'" . $textdomain . "!!')!!";
+
+ }
+
+
+ // vars
+ return __( $string, $textdomain );
+
+}
+
+
+/*
+* acf_maybe_add_action
+*
+* This function will determine if the action has already run before adding / calling the function
+*
+* @type function
+* @date 13/01/2016
+* @since 5.3.2
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_maybe_add_action( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
+
+ // if action has already run, execute it
+ // - if currently doing action, allow $tag to be added as per usual to allow $priority ordering needed for 3rd party asset compatibility
+ if( did_action($tag) && !doing_action($tag) ) {
+
+ call_user_func( $function_to_add );
+
+ // if action has not yet run, add it
+ } else {
+
+ add_action( $tag, $function_to_add, $priority, $accepted_args );
+
+ }
+
+}
+
+
+/*
+* acf_is_row_collapsed
+*
+* This function will return true if the field's row is collapsed
+*
+* @type function
+* @date 2/03/2016
+* @since 5.3.2
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_is_row_collapsed( $field_key = '', $row_index = 0 ) {
+
+ // collapsed
+ $collapsed = acf_get_user_setting('collapsed_' . $field_key, '');
+
+
+ // cookie fallback ( version < 5.3.2 )
+ if( $collapsed === '' ) {
+
+ $collapsed = acf_extract_var($_COOKIE, "acf_collapsed_{$field_key}", '');
+ $collapsed = str_replace('|', ',', $collapsed);
+
+
+ // update
+ acf_update_user_setting( 'collapsed_' . $field_key, $collapsed );
+
+ }
+
+
+ // explode
+ $collapsed = explode(',', $collapsed);
+ $collapsed = array_filter($collapsed, 'is_numeric');
+
+
+ // collapsed class
+ return in_array($row_index, $collapsed);
+
+}
+
+
+/*
+* acf_get_attachment_image
+*
+* description
+*
+* @type function
+* @date 24/10/16
+* @since 5.5.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_get_attachment_image( $attachment_id = 0, $size = 'thumbnail' ) {
+
+ // vars
+ $url = wp_get_attachment_image_src($attachment_id, 'thumbnail');
+ $alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
+
+
+ // bail early if no url
+ if( !$url ) return '';
+
+
+ // return
+ $value = ' ';
+
+}
+
+
+/*
+* acf_get_post_thumbnail
+*
+* This function will return a thumbail image url for a given post
+*
+* @type function
+* @date 3/05/2016
+* @since 5.3.8
+*
+* @param $post (obj)
+* @param $size (mixed)
+* @return (string)
+*/
+
+function acf_get_post_thumbnail( $post = null, $size = 'thumbnail' ) {
+
+ // vars
+ $data = array(
+ 'url' => '',
+ 'type' => '',
+ 'html' => ''
+ );
+
+
+ // post
+ $post = get_post($post);
+
+
+ // bail early if no post
+ if( !$post ) return $data;
+
+
+ // vars
+ $thumb_id = $post->ID;
+ $mime_type = acf_maybe_get(explode('/', $post->post_mime_type), 0);
+
+
+ // attachment
+ if( $post->post_type === 'attachment' ) {
+
+ // change $thumb_id
+ if( $mime_type === 'audio' || $mime_type === 'video' ) {
+
+ $thumb_id = get_post_thumbnail_id($post->ID);
+
+ }
+
+ // post
+ } else {
+
+ $thumb_id = get_post_thumbnail_id($post->ID);
+
+ }
+
+
+ // try url
+ $data['url'] = wp_get_attachment_image_src($thumb_id, $size);
+ $data['url'] = acf_maybe_get($data['url'], 0);
+
+
+ // default icon
+ if( !$data['url'] && $post->post_type === 'attachment' ) {
+
+ $data['url'] = wp_mime_type_icon($post->ID);
+ $data['type'] = 'icon';
+
+ }
+
+
+ // html
+ $data['html'] = ' ';
+
+
+ // return
+ return $data;
+
+}
+
+
+/*
+* acf_get_browser
+*
+* This functino will return the browser string for major browsers
+*
+* @type function
+* @date 17/01/2014
+* @since 5.0.0
+*
+* @param n/a
+* @return (string)
+*/
+
+function acf_get_browser() {
+
+ // vars
+ $agent = $_SERVER['HTTP_USER_AGENT'];
+
+
+ // browsers
+ $browsers = array(
+ 'Firefox' => 'firefox',
+ 'Trident' => 'msie',
+ 'MSIE' => 'msie',
+ 'Edge' => 'edge',
+ 'Chrome' => 'chrome',
+ 'Safari' => 'safari',
+ );
+
+
+ // loop
+ foreach( $browsers as $k => $v ) {
+
+ if( strpos($agent, $k) !== false ) return $v;
+
+ }
+
+
+ // return
+ return '';
+
+}
+
+
+/*
+* acf_is_ajax
+*
+* This function will reutrn true if performing a wp ajax call
+*
+* @type function
+* @date 7/06/2016
+* @since 5.3.8
+*
+* @param n/a
+* @return (boolean)
+*/
+
+function acf_is_ajax( $action = '' ) {
+
+ // vars
+ $is_ajax = false;
+
+
+ // check if is doing ajax
+ if( defined('DOING_AJAX') && DOING_AJAX ) {
+
+ $is_ajax = true;
+
+ }
+
+
+ // check $action
+ if( $action && acf_maybe_get($_POST, 'action') !== $action ) {
+
+ $is_ajax = false;
+
+ }
+
+
+ // return
+ return $is_ajax;
+
+}
+
+
+
+
+/*
+* acf_format_date
+*
+* This function will accept a date value and return it in a formatted string
+*
+* @type function
+* @date 16/06/2016
+* @since 5.3.8
+*
+* @param $value (string)
+* @return $format (string)
+*/
+
+function acf_format_date( $value, $format ) {
+
+ // bail early if no value
+ if( !$value ) return $value;
+
+
+ // vars
+ $unixtimestamp = 0;
+
+
+ // numeric (either unix or YYYYMMDD)
+ if( is_numeric($value) && strlen($value) !== 8 ) {
+
+ $unixtimestamp = $value;
+
+ } else {
+
+ $unixtimestamp = strtotime($value);
+
+ }
+
+
+ // return
+ return date_i18n($format, $unixtimestamp);
+
+}
+
+
+/*
+* acf_log
+*
+* description
+*
+* @type function
+* @date 24/06/2016
+* @since 5.3.8
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_log() {
+
+ // vars
+ $log = '';
+ $args = func_get_args();
+
+
+ // loop
+ foreach( $args as $i => $arg ) {
+
+ if( is_array($arg) || is_object($arg) ) {
+
+ $arg = print_r($arg, true);
+
+ } elseif( is_bool($arg) ) {
+
+ $arg = ( $arg ? 'true' : 'false' ) . ' (bool)';
+
+ }
+
+
+ // update
+ $args[ $i ] = $arg;
+
+ }
+
+
+ // log
+ error_log( implode(' ', $args) );
+
+}
+
+
+/*
+* acf_doing
+*
+* This function will tell ACF what task it is doing
+*
+* @type function
+* @date 28/06/2016
+* @since 5.3.8
+*
+* @param $event (string)
+* @param context (string)
+* @return n/a
+*/
+
+function acf_doing( $event = '', $context = '' ) {
+
+ acf_update_setting( 'doing', $event );
+ acf_update_setting( 'doing_context', $context );
+
+}
+
+
+/*
+* acf_is_doing
+*
+* This function can be used to state what ACF is doing, or to check
+*
+* @type function
+* @date 28/06/2016
+* @since 5.3.8
+*
+* @param $event (string)
+* @param context (string)
+* @return (boolean)
+*/
+
+function acf_is_doing( $event = '', $context = '' ) {
+
+ // vars
+ $doing = false;
+
+
+ // task
+ if( acf_get_setting('doing') === $event ) {
+
+ $doing = true;
+
+ }
+
+
+ // context
+ if( $context && acf_get_setting('doing_context') !== $context ) {
+
+ $doing = false;
+
+ }
+
+
+ // return
+ return $doing;
+
+}
+
+
+/*
+* acf_is_plugin_active
+*
+* This function will return true if the ACF plugin is active
+* - May be included within a theme or other plugin
+*
+* @type function
+* @date 13/07/2016
+* @since 5.4.0
+*
+* @param $basename (int)
+* @return $post_id (int)
+*/
+
+
+function acf_is_plugin_active() {
+
+ // vars
+ $basename = acf_get_setting('basename');
+
+
+ // ensure is_plugin_active() exists (not on frontend)
+ if( !function_exists('is_plugin_active') ) {
+
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
+
+ }
+
+
+ // return
+ return is_plugin_active($basename);
+
+}
+
+
+/*
+* acf_enable_filter
+*
+* This function will enable a filter
+*
+* @type function
+* @date 15/07/2016
+* @since 5.4.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_enable_filter( $filter = '' ) {
+
+ // get filters
+ $filters = acf_get_setting('_filters', array());
+
+
+ // append
+ $filters[ $filter ] = true;
+
+
+ // update
+ acf_update_setting('_filters', $filters);
+
+}
+
+
+/*
+* acf_disable_filter
+*
+* This function will disable a filter
+*
+* @type function
+* @date 15/07/2016
+* @since 5.4.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_disable_filter( $filter = '' ) {
+
+ // get filters
+ $filters = acf_get_setting('_filters', array());
+
+
+ // append
+ $filters[ $filter ] = false;
+
+
+ // update
+ acf_update_setting('_filters', $filters);
+
+}
+
+
+/*
+* acf_enable_filters
+*
+* ACF uses filters to modify field group and field data
+* This function will enable them allowing ACF to interact with all data
+*
+* @type function
+* @date 14/07/2016
+* @since 5.4.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_enable_filters() {
+
+ // get filters
+ $filters = acf_get_setting('_filters', array());
+
+
+ // loop
+ foreach( array_keys($filters) as $k ) {
+
+ $filters[ $k ] = true;
+
+ }
+
+
+ // update
+ acf_update_setting('_filters', $filters);
+
+}
+
+
+/*
+* acf_disable_filters
+*
+* ACF uses filters to modify field group and field data
+* This function will disable them allowing ACF to interact only with raw DB data
+*
+* @type function
+* @date 14/07/2016
+* @since 5.4.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_disable_filters() {
+
+ // get filters
+ $filters = acf_get_setting('_filters', array());
+
+
+ // loop
+ foreach( array_keys($filters) as $k ) {
+
+ $filters[ $k ] = false;
+
+ }
+
+
+ // update
+ acf_update_setting('_filters', $filters);
+
+}
+
+
+/*
+* acf_is_filter_enabled
+*
+* ACF uses filters to modify field group and field data
+* This function will return true if they are enabled
+*
+* @type function
+* @date 14/07/2016
+* @since 5.4.0
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_is_filter_enabled( $filter = '' ) {
+
+ // get filters
+ $filters = acf_get_setting('_filters', array());
+
+
+ // bail early if not set
+ return empty( $filters[ $filter ] ) ? false : true;
+
+}
+
+
+/*
+* acf_send_ajax_results
+*
+* This function will print JSON data for a Select2 AJAX query
+*
+* @type function
+* @date 19/07/2016
+* @since 5.4.0
+*
+* @param $response (array)
+* @return n/a
+*/
+
+function acf_send_ajax_results( $response ) {
+
+ // validate
+ $response = wp_parse_args($response, array(
+ 'results' => false,
+ 'more' => false,
+ 'limit' => 0
+ ));
+
+
+ // limit
+ if( $response['limit'] && $response['results']) {
+
+ // vars
+ $total = 0;
+
+ foreach( $response['results'] as $result ) {
+
+ // parent
+ $total++;
+
+
+ // children
+ if( !empty($result['children']) ) {
+
+ $total += count( $result['children'] );
+
+ }
+
+ }
+
+
+ // calc
+ if( $total >= $response['limit'] ) {
+
+ $response['more'] = true;
+
+ }
+
+ }
+
+
+ // return
+ wp_send_json( $response );
+
+}
+
+
+/*
+* acf_is_sequential_array
+*
+* This function will return true if the array contains only numeric keys
+*
+* @source http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential
+* @type function
+* @date 9/09/2016
+* @since 5.4.0
+*
+* @param $array (array)
+* @return (boolean)
+*/
+
+function acf_is_sequential_array( $array ) {
+
+ // bail ealry if not array
+ if( !is_array($array) ) return false;
+
+
+ // loop
+ foreach( $array as $key => $value ) {
+
+ // bail ealry if is string
+ if( is_string($key) ) return false;
+
+ }
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* acf_is_associative_array
+*
+* This function will return true if the array contains one or more string keys
+*
+* @source http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential
+* @type function
+* @date 9/09/2016
+* @since 5.4.0
+*
+* @param $array (array)
+* @return (boolean)
+*/
+
+function acf_is_associative_array( $array ) {
+
+ // bail ealry if not array
+ if( !is_array($array) ) return false;
+
+
+ // loop
+ foreach( $array as $key => $value ) {
+
+ // bail ealry if is string
+ if( is_string($key) ) return true;
+
+ }
+
+
+ // return
+ return false;
+
+}
+
+
+/*
+* acf_add_array_key_prefix
+*
+* This function will add a prefix to all array keys
+* Useful to preserve numeric keys when performing array_multisort
+*
+* @type function
+* @date 15/09/2016
+* @since 5.4.0
+*
+* @param $array (array)
+* @param $prefix (string)
+* @return (array)
+*/
+
+function acf_add_array_key_prefix( $array, $prefix ) {
+
+ // vars
+ $array2 = array();
+
+
+ // loop
+ foreach( $array as $k => $v ) {
+
+ $k2 = $prefix . $k;
+ $array2[ $k2 ] = $v;
+
+ }
+
+
+ // return
+ return $array2;
+
+}
+
+
+/*
+* acf_remove_array_key_prefix
+*
+* This function will remove a prefix to all array keys
+* Useful to preserve numeric keys when performing array_multisort
+*
+* @type function
+* @date 15/09/2016
+* @since 5.4.0
+*
+* @param $array (array)
+* @param $prefix (string)
+* @return (array)
+*/
+
+function acf_remove_array_key_prefix( $array, $prefix ) {
+
+ // vars
+ $array2 = array();
+ $l = strlen($prefix);
+
+
+ // loop
+ foreach( $array as $k => $v ) {
+
+ $k2 = (substr($k, 0, $l) === $prefix) ? substr($k, $l) : $k;
+ $array2[ $k2 ] = $v;
+
+ }
+
+
+ // return
+ return $array2;
+
+}
+
+
+
+
+add_filter("acf/settings/slug", '_acf_settings_slug');
+
+function _acf_settings_slug( $v ) {
+
+ $basename = acf_get_setting('basename');
+ $slug = explode('/', $basename);
+ $slug = current($slug);
+
+ return $slug;
+}
+
+
+
+
+/*
+* acf_strip_protocol
+*
+* This function will remove the proticol from a url
+* Used to allow licences to remain active if a site is switched to https
+*
+* @type function
+* @date 10/01/2017
+* @since 5.5.4
+* @author Aaron
+*
+* @param $url (string)
+* @return (string)
+*/
+
+function acf_strip_protocol( $url ) {
+
+ // strip the protical
+ return str_replace(array('http://','https://'), '', $url);
+
+}
+
+
+/*
+* acf_connect_attachment_to_post
+*
+* This function will connect an attacment (image etc) to the post
+* Used to connect attachements uploaded directly to media that have not been attaced to a post
+*
+* @type function
+* @date 11/01/2017
+* @since 5.5.4
+*
+* @param $attachment_id (int)
+* @param $post_id (int)
+* @return (boolean)
+*/
+
+function acf_connect_attachment_to_post( $attachment_id = 0, $post_id = 0 ) {
+
+ // bail ealry if $attachment_id is not valid
+ if( !$attachment_id || !is_numeric($attachment_id) ) return false;
+
+
+ // bail ealry if $post_id is not valid
+ if( !$post_id || !is_numeric($post_id) ) return false;
+
+
+ // vars
+ $post = get_post( $attachment_id );
+
+
+ // check if valid post
+ if( $post && $post->post_type == 'attachment' && $post->post_parent == 0 ) {
+
+ // update
+ wp_update_post( array('ID' => $post->ID, 'post_parent' => $post_id) );
+
+
+ // return
+ return true;
+
+ }
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* acf_encrypt
+*
+* This function will encrypt a string using PHP
+* https://bhoover.com/using-php-openssl_encrypt-openssl_decrypt-encrypt-decrypt-data/
+*
+* @type function
+* @date 27/2/17
+* @since 5.5.8
+*
+* @param $data (string)
+* @return (string)
+*/
+
+
+function acf_encrypt( $data = '' ) {
+
+ // bail ealry if no encrypt function
+ if( !function_exists('openssl_encrypt') ) return base64_encode($data);
+
+
+ // generate a key
+ $key = wp_hash('acf_encrypt');
+
+
+ // Generate an initialization vector
+ $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
+
+
+ // Encrypt the data using AES 256 encryption in CBC mode using our encryption key and initialization vector.
+ $encrypted_data = openssl_encrypt($data, 'aes-256-cbc', $key, 0, $iv);
+
+
+ // The $iv is just as important as the key for decrypting, so save it with our encrypted data using a unique separator (::)
+ return base64_encode($encrypted_data . '::' . $iv);
+
+}
+
+
+/*
+* acf_decrypt
+*
+* This function will decrypt an encrypted string using PHP
+* https://bhoover.com/using-php-openssl_encrypt-openssl_decrypt-encrypt-decrypt-data/
+*
+* @type function
+* @date 27/2/17
+* @since 5.5.8
+*
+* @param $data (string)
+* @return (string)
+*/
+
+function acf_decrypt( $data = '' ) {
+
+ // bail ealry if no decrypt function
+ if( !function_exists('openssl_decrypt') ) return base64_decode($data);
+
+
+ // generate a key
+ $key = wp_hash('acf_encrypt');
+
+
+ // To decrypt, split the encrypted data from our IV - our unique separator used was "::"
+ list($encrypted_data, $iv) = explode('::', base64_decode($data), 2);
+
+
+ // decrypt
+ return openssl_decrypt($encrypted_data, 'aes-256-cbc', $key, 0, $iv);
+
+}
+
+
+/*
+* acf_get_post_templates
+*
+* This function will return an array of all post templates (including parent theme templates)
+*
+* @type function
+* @date 29/8/17
+* @since 5.6.2
+*
+* @param n/a
+* @return (array)
+*/
+
+function acf_get_post_templates() {
+
+ // vars
+ $post_types = acf_get_post_types();
+ $post_templates = array();
+
+
+ // loop
+ foreach( $post_types as $post_type ) {
+ $post_templates[ $post_type ] = wp_get_theme()->get_page_templates(null, $post_type);
+ }
+
+
+ // remove empty templates
+ $post_templates = array_filter( $post_templates );
+
+
+ // return
+ return $post_templates;
+
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-input.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-input.php
new file mode 100644
index 0000000..9258d02
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-input.php
@@ -0,0 +1,615 @@
+ tags for safe output
+*
+* @type function
+* @date 25/6/17
+* @since 5.6.0
+*
+* @param string (string)
+* @return (string)
+*/
+
+function acf_esc_html( $string = '' ) {
+
+ // cast
+ $string = (string) $string;
+
+
+ // replace
+ $string = str_replace('
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php
new file mode 100644
index 0000000..8ec0a8d
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php
@@ -0,0 +1,1542 @@
+ $selector,
+ 'key' => '',
+ 'type' => '',
+ ));
+
+
+ // prevent formatting
+ $format_value = false;
+
+ }
+
+
+ // get value for field
+ $value = acf_get_value( $post_id, $field );
+
+
+ // format value
+ if( $format_value ) {
+
+ // get value for field
+ $value = acf_format_value( $value, $post_id, $field );
+
+ }
+
+
+ // return
+ return $value;
+
+}
+
+
+/*
+* the_field()
+*
+* This function is the same as echo get_field().
+*
+* @type function
+* @since 1.0.3
+* @date 29/01/13
+*
+* @param $selector (string) the field name or key
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @return n/a
+*/
+
+function the_field( $selector, $post_id = false, $format_value = true ) {
+
+ $value = get_field($selector, $post_id, $format_value);
+
+ if( is_array($value) ) {
+
+ $value = @implode( ', ', $value );
+
+ }
+
+ echo $value;
+
+}
+
+
+/*
+* get_field_object()
+*
+* This function will return an array containing all the field data for a given field_name
+*
+* @type function
+* @since 3.6
+* @date 3/02/13
+*
+* @param $selector (string) the field name or key
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @param $format_value (boolean) whether or not to format the field value
+* @param $load_value (boolean) whether or not to load the field value
+* @return $field (array)
+*/
+
+function get_field_object( $selector, $post_id = false, $format_value = true, $load_value = true ) {
+
+ // compatibilty
+ if( is_array($format_value) ) extract( $format_value );
+
+
+ // get valid post_id
+ $post_id = acf_get_valid_post_id( $post_id );
+
+
+ // get field key
+ $field = acf_maybe_get_field( $selector, $post_id );
+
+
+ // bail early if no field found
+ if( !$field ) return false;
+
+
+ // load value
+ if( $load_value ) {
+
+ $field['value'] = acf_get_value( $post_id, $field );
+
+ }
+
+
+ // format value
+ if( $format_value ) {
+
+ // get value for field
+ $field['value'] = acf_format_value( $field['value'], $post_id, $field );
+
+ }
+
+
+ // return
+ return $field;
+
+}
+
+
+/*
+* get_fields()
+*
+* This function will return an array containing all the custom field values for a specific post_id.
+* The function is not very elegant and wastes a lot of PHP memory / SQL queries if you are not using all the values.
+*
+* @type function
+* @since 3.6
+* @date 29/01/13
+*
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @param $format_value (boolean) whether or not to format the field value
+* @return (array) associative array where field name => field value
+*/
+
+function get_fields( $post_id = false, $format_value = true ) {
+
+ // vars
+ $fields = get_field_objects( $post_id, $format_value );
+ $meta = array();
+
+
+ // bail early
+ if( !$fields ) return false;
+
+
+ // populate
+ foreach( $fields as $k => $field ) {
+
+ $meta[ $k ] = $field['value'];
+
+ }
+
+
+ // return
+ return $meta;
+
+}
+
+
+/*
+* get_field_objects()
+*
+* This function will return an array containing all the custom field objects for a specific post_id.
+* The function is not very elegant and wastes a lot of PHP memory / SQL queries if you are not using all the fields / values.
+*
+* @type function
+* @since 3.6
+* @date 29/01/13
+*
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @param $format_value (boolean) whether or not to format the field value
+* @param $load_value (boolean) whether or not to load the field value
+* @return (array) associative array where field name => field
+*/
+
+function get_field_objects( $post_id = false, $format_value = true, $load_value = true ) {
+
+ // global
+ global $wpdb;
+
+
+ // filter post_id
+ $post_id = acf_get_valid_post_id( $post_id );
+ $info = acf_get_post_id_info( $post_id );
+
+
+ // vars
+ $meta = array();
+ $fields = array();
+
+
+ // get field_names
+ if( $info['type'] == 'post' ) {
+
+ $meta = get_post_meta( $info['id'] );
+
+ } elseif( $info['type'] == 'user' ) {
+
+ $meta = get_user_meta( $info['id'] );
+
+ } elseif( $info['type'] == 'comment' ) {
+
+ $meta = get_comment_meta( $info['id'] );
+
+ } elseif( $info['type'] == 'term' ) {
+
+ $meta = get_term_meta( $info['id'] );
+
+ } else {
+
+ $rows = $wpdb->get_results($wpdb->prepare(
+ "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s",
+ $post_id . '_%' ,
+ '_' . $post_id . '_%'
+ ), ARRAY_A);
+
+ if( !empty($rows) ) {
+
+ foreach( $rows as $row ) {
+
+ // vars
+ $name = $row['option_name'];
+ $prefix = $post_id . '_';
+ $_prefix = '_' . $prefix;
+
+
+ // remove prefix from name
+ if( strpos($name, $prefix) === 0 ) {
+
+ $name = substr($name, strlen($prefix));
+
+ } elseif( strpos($name, $_prefix) === 0 ) {
+
+ $name = '_' . substr($name, strlen($_prefix));
+
+ }
+
+ $meta[ $name ][] = $row['option_value'];
+
+ }
+
+ }
+
+ }
+
+
+ // bail early if no meta
+ if( empty($meta) ) return false;
+
+
+ // populate vars
+ foreach( $meta as $k => $v ) {
+
+ // does a field key exist for this value?
+ if( !isset($meta["_{$k}"]) ) continue;
+
+
+ // get field
+ $field_key = $meta["_{$k}"][0];
+ $field = acf_maybe_get_field( $field_key );
+
+
+ // bail early if no field, or if the field's name is different to $k
+ // - solves problem where sub fields (and clone fields) are incorrectly allowed
+ if( !$field || $field['name'] !== $k ) continue;
+
+
+ // load value
+ if( $load_value ) {
+
+ $field['value'] = acf_get_value( $post_id, $field );
+
+ }
+
+
+ // format value
+ if( $format_value ) {
+
+ // get value for field
+ $field['value'] = acf_format_value( $field['value'], $post_id, $field );
+
+ }
+
+
+ // append to $value
+ $fields[ $field['name'] ] = $field;
+
+ }
+
+
+ // no value
+ if( empty($fields) ) return false;
+
+
+ // return
+ return $fields;
+}
+
+
+/*
+* have_rows
+*
+* This function will instantiate a global variable containing the rows of a repeater or flexible content field,
+* after which, it will determine if another row exists to loop through
+*
+* @type function
+* @date 2/09/13
+* @since 4.3.0
+*
+* @param $field_name (string) the field name
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @return (boolean)
+*/
+
+function have_rows( $selector, $post_id = false ) {
+
+ // reference
+ $_post_id = $post_id;
+
+
+ // filter post_id
+ $post_id = acf_get_valid_post_id( $post_id );
+
+
+ // vars
+ $key = "selector={$selector}/post_id={$post_id}";
+ $active_loop = acf_get_loop('active');
+ $previous_loop = acf_get_loop('previous');
+ $new_parent_loop = false;
+ $new_child_loop = false;
+ $sub_field = false;
+ $sub_exists = false;
+ $change = false;
+
+
+ // no active loops
+ if( !$active_loop ) {
+
+ // create a new loop
+ $new_parent_loop = true;
+
+ // loop has changed
+ } elseif( $active_loop['key'] != $key ) {
+
+ // detect change
+ if( $post_id != $active_loop['post_id'] ) {
+
+ $change = 'post_id';
+
+ } elseif( $selector != $active_loop['selector'] ) {
+
+ $change = 'selector';
+
+ } else {
+
+ // key has changed due to a technicallity, however, the post_id and selector are the same
+
+ }
+
+
+ // attempt to find sub field
+ $sub_field = acf_get_sub_field($selector, $active_loop['field']);
+
+ if( $sub_field ) {
+
+ $sub_exists = isset( $active_loop['value'][ $active_loop['i'] ][ $sub_field['key'] ] );
+
+ }
+
+
+ // If post_id has changed, this is most likely an archive loop
+ if( $change == 'post_id' ) {
+
+ if( empty($_post_id) && $sub_exists ) {
+
+ // case: Change in $post_id was due to this being a nested loop and not specifying the $post_id
+ // action: move down one level into a new loop
+ $new_child_loop = true;
+
+ } elseif( $previous_loop && $previous_loop['post_id'] == $post_id ) {
+
+ // case: Change in $post_id was due to a nested loop ending
+ // action: move up one level through the loops
+ acf_remove_loop('active');
+
+ } else {
+
+ // case: Chang in $post_id is the most obvious, used in an WP_Query loop with multiple $post objects
+ // action: leave this current loop alone and create a new parent loop
+ $new_parent_loop = true;
+
+ }
+
+ } elseif( $change == 'selector' ) {
+
+ if( $sub_exists ) {
+
+ // case: Change in $field_name was due to this being a nested loop
+ // action: move down one level into a new loop
+ $new_child_loop = true;
+
+ } elseif( $previous_loop && $previous_loop['selector'] == $selector && $previous_loop['post_id'] == $post_id ) {
+
+ // case: Change in $field_name was due to a nested loop ending
+ // action: move up one level through the loops
+ acf_remove_loop('active');
+
+ } else {
+
+ // case: Chang in $field_name is the most obvious, this is a new loop for a different field within the $post
+ // action: leave this current loop alone and create a new parent loop
+ $new_parent_loop = true;
+
+ }
+
+ }
+
+ // loop is the same
+ } else {
+
+ // do nothing
+
+ }
+
+
+ // add loop
+ if( $new_parent_loop || $new_child_loop ) {
+
+ // vars
+ $field = null;
+ $value = null;
+ $name = '';
+
+
+ // parent loop
+ if( $new_parent_loop ) {
+
+ $field = get_field_object( $selector, $post_id, false );
+ $value = acf_extract_var( $field, 'value' );
+ $name = $field['name'];
+
+ // child loop
+ } else {
+
+ $field = $sub_field;
+ $value = $active_loop['value'][ $active_loop['i'] ][ $sub_field['key'] ];
+ $name = $active_loop['name'] . '_' . $active_loop['i'] . '_' . $sub_field['name'];
+ $post_id = $active_loop['post_id'];
+
+ }
+
+
+ // bail early if value is either empty or a non array
+ if( !acf_is_array($value) ) return false;
+
+
+ // allow for non repeatable data (group)
+ if( acf_get_field_type_prop($field['type'], 'have_rows') === 'single' ) {
+ $value = array( $value );
+ }
+
+
+ // add loop
+ $active_loop = acf_add_loop(array(
+ 'selector' => $selector,
+ 'name' => $name, // used by update_sub_field
+ 'value' => $value,
+ 'field' => $field,
+ 'i' => -1,
+ 'post_id' => $post_id,
+ 'key' => $key
+ ));
+
+ }
+
+
+ // return true if next row exists
+ if( $active_loop && isset($active_loop['value'][ $active_loop['i']+1 ]) ) {
+
+ return true;
+
+ }
+
+
+ // no next row!
+ acf_remove_loop('active');
+
+
+ // return
+ return false;
+
+}
+
+
+/*
+* the_row
+*
+* This function will progress the global repeater or flexible content value 1 row
+*
+* @type function
+* @date 2/09/13
+* @since 4.3.0
+*
+* @param N/A
+* @return (array) the current row data
+*/
+
+function the_row( $format = false ) {
+
+ // vars
+ $i = acf_get_loop('active', 'i');
+
+
+ // increase
+ $i++;
+
+
+ // update
+ acf_update_loop('active', 'i', $i);
+
+
+ // return
+ return get_row( $format );
+
+}
+
+function get_row( $format = false ) {
+
+ // vars
+ $loop = acf_get_loop('active');
+
+
+ // bail early if no loop
+ if( !$loop ) return false;
+
+
+ // get value
+ $value = acf_maybe_get( $loop['value'], $loop['i'] );
+
+
+ // bail early if no current value
+ // possible if get_row_layout() is called before the_row()
+ if( !$value ) return false;
+
+
+ // format
+ if( $format ) {
+
+ // vars
+ $field = $loop['field'];
+
+
+ // single row
+ if( acf_get_field_type_prop($field['type'], 'have_rows') === 'single' ) {
+
+ // format value
+ $value = acf_format_value( $value, $loop['post_id'], $field );
+
+ // multiple rows
+ } else {
+
+ // format entire value
+ // - solves problem where cached value is incomplete
+ // - no performance issues here thanks to cache
+ $value = acf_format_value( $loop['value'], $loop['post_id'], $field );
+ $value = acf_maybe_get( $value, $loop['i'] );
+
+ }
+
+ }
+
+
+ // return
+ return $value;
+
+}
+
+function get_row_index() {
+
+ // vars
+ $i = acf_get_loop('active', 'i');
+ $offset = acf_get_setting('row_index_offset');
+
+
+ // return
+ return $offset + $i;
+
+}
+
+function the_row_index() {
+
+ echo get_row_index();
+
+}
+
+
+/*
+* get_row_sub_field
+*
+* This function is used inside a 'has_sub_field' while loop to return a sub field object
+*
+* @type function
+* @date 16/05/2016
+* @since 5.3.8
+*
+* @param $selector (string)
+* @return (array)
+*/
+
+function get_row_sub_field( $selector ) {
+
+ // vars
+ $row = acf_get_loop('active');
+
+
+ // bail early if no row
+ if( !$row ) return false;
+
+
+ // attempt to find sub field
+ $sub_field = acf_get_sub_field($selector, $row['field']);
+
+
+ // bail early if no field
+ if( !$sub_field ) return false;
+
+
+ // update field's name based on row data
+ $sub_field['name'] = "{$row['name']}_{$row['i']}_{$sub_field['name']}";
+
+
+ // return
+ return $sub_field;
+
+}
+
+
+/*
+* get_row_sub_value
+*
+* This function is used inside a 'has_sub_field' while loop to return a sub field value
+*
+* @type function
+* @date 16/05/2016
+* @since 5.3.8
+*
+* @param $selector (string)
+* @return (mixed)
+*/
+
+function get_row_sub_value( $selector ) {
+
+ // vars
+ $row = acf_get_loop('active');
+
+
+ // bail early if no row
+ if( !$row ) return null;
+
+
+ // return value
+ if( isset($row['value'][ $row['i'] ][ $selector ]) ) {
+
+ return $row['value'][ $row['i'] ][ $selector ];
+
+ }
+
+
+ // return
+ return null;
+
+}
+
+
+/*
+* reset_rows
+*
+* This function will find the current loop and unset it from the global array.
+* To bo used when loop finishes or a break is used
+*
+* @type function
+* @date 26/10/13
+* @since 5.0.0
+*
+* @param $hard_reset (boolean) completely wipe the global variable, or just unset the active row
+* @return (boolean)
+*/
+
+function reset_rows() {
+
+ // remove last loop
+ acf_remove_loop('active');
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* has_sub_field()
+*
+* This function is used inside a while loop to return either true or false (loop again or stop).
+* When using a repeater or flexible content field, it will loop through the rows until
+* there are none left or a break is detected
+*
+* @type function
+* @since 1.0.3
+* @date 29/01/13
+*
+* @param $field_name (string) the field name
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @return (boolean)
+*/
+
+function has_sub_field( $field_name, $post_id = false ) {
+
+ // vars
+ $r = have_rows( $field_name, $post_id );
+
+
+ // if has rows, progress through 1 row for the while loop to work
+ if( $r ) {
+
+ the_row();
+
+ }
+
+
+ // return
+ return $r;
+
+}
+
+function has_sub_fields( $field_name, $post_id = false ) {
+
+ return has_sub_field( $field_name, $post_id );
+
+}
+
+
+/*
+* get_sub_field()
+*
+* This function is used inside a 'has_sub_field' while loop to return a sub field value
+*
+* @type function
+* @since 1.0.3
+* @date 29/01/13
+*
+* @param $field_name (string) the field name
+* @return (mixed)
+*/
+
+function get_sub_field( $selector = '', $format_value = true ) {
+
+ // get sub field
+ $sub_field = get_sub_field_object( $selector, $format_value );
+
+
+ // bail early if no sub field
+ if( !$sub_field ) return false;
+
+
+ // return
+ return $sub_field['value'];
+
+}
+
+
+/*
+* the_sub_field()
+*
+* This function is the same as echo get_sub_field
+*
+* @type function
+* @since 1.0.3
+* @date 29/01/13
+*
+* @param $field_name (string) the field name
+* @return n/a
+*/
+
+function the_sub_field( $field_name, $format_value = true ) {
+
+ $value = get_sub_field( $field_name, $format_value );
+
+ if( is_array($value) ) {
+
+ $value = implode(', ',$value);
+
+ }
+
+ echo $value;
+}
+
+
+/*
+* get_sub_field_object()
+*
+* This function is used inside a 'has_sub_field' while loop to return a sub field object
+*
+* @type function
+* @since 3.5.8.1
+* @date 29/01/13
+*
+* @param $child_name (string) the field name
+* @return (array)
+*/
+
+function get_sub_field_object( $selector, $format_value = true, $load_value = true ) {
+
+ // vars
+ $row = acf_get_loop('active');
+
+
+ // bail early if no row
+ if( !$row ) return false;
+
+
+ // attempt to find sub field
+ $sub_field = get_row_sub_field($selector);
+
+
+ // bail early if no sub field
+ if( !$sub_field ) return false;
+
+
+ // load value
+ if( $load_value ) {
+
+ $sub_field['value'] = get_row_sub_value( $sub_field['key'] );
+
+ }
+
+
+ // format value
+ if( $format_value ) {
+
+ // get value for field
+ $sub_field['value'] = acf_format_value( $sub_field['value'], $row['post_id'], $sub_field );
+
+ }
+
+
+ // return
+ return $sub_field;
+
+}
+
+
+/*
+* get_row_layout()
+*
+* This function will return a string representation of the current row layout within a 'have_rows' loop
+*
+* @type function
+* @since 3.0.6
+* @date 29/01/13
+*
+* @param n/a
+* @return (string)
+*/
+
+function get_row_layout() {
+
+ // vars
+ $row = get_row();
+
+
+ // return
+ if( isset($row['acf_fc_layout']) ) {
+
+ return $row['acf_fc_layout'];
+
+ }
+
+
+ // return
+ return false;
+
+}
+
+
+/*
+* acf_shortcode()
+*
+* This function is used to add basic shortcode support for the ACF plugin
+* eg. [acf field="heading" post_id="123" format_value="1"]
+*
+* @type function
+* @since 1.1.1
+* @date 29/01/13
+*
+* @param $field (string) the field name or key
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @param $format_value (boolean) whether or not to format the field value
+* @return (string)
+*/
+
+function acf_shortcode( $atts ) {
+
+ // extract attributs
+ extract( shortcode_atts( array(
+ 'field' => '',
+ 'post_id' => false,
+ 'format_value' => true
+ ), $atts ) );
+
+
+ // get value and return it
+ $value = get_field( $field, $post_id, $format_value );
+
+
+ // array
+ if( is_array($value) ) {
+
+ $value = @implode( ', ', $value );
+
+ }
+
+
+ // return
+ return $value;
+
+}
+
+add_shortcode('acf', 'acf_shortcode');
+
+
+/*
+* update_field()
+*
+* This function will update a value in the database
+*
+* @type function
+* @since 3.1.9
+* @date 29/01/13
+*
+* @param $selector (string) the field name or key
+* @param $value (mixed) the value to save in the database
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @return (boolean)
+*/
+
+function update_field( $selector, $value, $post_id = false ) {
+
+ // filter post_id
+ $post_id = acf_get_valid_post_id( $post_id );
+
+
+ // get field
+ $field = acf_maybe_get_field( $selector, $post_id, false );
+
+
+ // create dummy field
+ if( !$field ) {
+
+ $field = acf_get_valid_field(array(
+ 'name' => $selector,
+ 'key' => '',
+ 'type' => '',
+ ));
+
+ }
+
+
+ // save
+ return acf_update_value( $value, $post_id, $field );
+
+}
+
+
+/*
+* update_sub_field
+*
+* This function will update a value of a sub field in the database
+*
+* @type function
+* @date 2/04/2014
+* @since 5.0.0
+*
+* @param $selector (mixed) the sub field name or key, or an array of ancestors
+* @param $value (mixed) the value to save in the database
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @return (boolean)
+*/
+
+function update_sub_field( $selector, $value, $post_id = false ) {
+
+ // vars
+ $sub_field = false;
+
+
+ // get sub field
+ if( is_array($selector) ) {
+
+ $post_id = acf_get_valid_post_id( $post_id );
+ $sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
+
+ } else {
+
+ $post_id = acf_get_loop('active', 'post_id');
+ $sub_field = get_row_sub_field( $selector );
+
+ }
+
+
+ // bail early if no sub field
+ if( !$sub_field ) return false;
+
+
+ // update
+ return acf_update_value( $value, $post_id, $sub_field );
+
+}
+
+
+/*
+* delete_field()
+*
+* This function will remove a value from the database
+*
+* @type function
+* @since 3.1.9
+* @date 29/01/13
+*
+* @param $selector (string) the field name or key
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @return (boolean)
+*/
+
+function delete_field( $selector, $post_id = false ) {
+
+ // filter post_id
+ $post_id = acf_get_valid_post_id( $post_id );
+
+
+ // get field
+ $field = acf_maybe_get_field( $selector, $post_id );
+
+
+ // delete
+ return acf_delete_value( $post_id, $field );
+
+}
+
+
+/*
+* delete_sub_field
+*
+* This function will delete a value of a sub field in the database
+*
+* @type function
+* @date 2/04/2014
+* @since 5.0.0
+*
+* @param $selector (mixed) the sub field name or key, or an array of ancestors
+* @param $value (mixed) the value to save in the database
+* @param $post_id (mixed) the post_id of which the value is saved against
+* @return (boolean)
+*/
+
+function delete_sub_field( $selector, $post_id = false ) {
+
+ return update_sub_field( $selector, null, $post_id );
+
+}
+
+
+/*
+* add_row
+*
+* This function will add a row of data to a field
+*
+* @type function
+* @date 16/10/2015
+* @since 5.2.3
+*
+* @param $selector (string)
+* @param $row (array)
+* @param $post_id (mixed)
+* @return (boolean)
+*/
+
+function add_row( $selector, $row = false, $post_id = false ) {
+
+ // filter post_id
+ $post_id = acf_get_valid_post_id( $post_id );
+
+
+ // get field
+ $field = acf_maybe_get_field( $selector, $post_id, false );
+
+
+ // bail early if no field
+ if( !$field ) return false;
+
+
+ // get raw value
+ $value = acf_get_value( $post_id, $field );
+
+
+ // ensure array
+ $value = acf_get_array($value);
+
+
+ // append
+ $value[] = $row;
+
+
+ // update value
+ acf_update_value( $value, $post_id, $field );
+
+
+ // return
+ return count($value);
+
+}
+
+
+/*
+* add_sub_row
+*
+* This function will add a row of data to a field
+*
+* @type function
+* @date 16/10/2015
+* @since 5.2.3
+*
+* @param $selector (string)
+* @param $row (array)
+* @param $post_id (mixed)
+* @return (boolean)
+*/
+
+function add_sub_row( $selector, $row = false, $post_id = false ) {
+
+ // vars
+ $sub_field = false;
+
+
+ // get sub field
+ if( is_array($selector) ) {
+
+ $post_id = acf_get_valid_post_id( $post_id );
+ $sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
+
+ } else {
+
+ $post_id = acf_get_loop('active', 'post_id');
+ $sub_field = get_row_sub_field( $selector );
+
+ }
+
+
+ // bail early if no sub field
+ if( !$sub_field ) return false;
+
+
+ // get raw value
+ $value = acf_get_value( $post_id, $sub_field );
+
+
+ // ensure array
+ $value = acf_get_array( $value );
+
+
+ // append
+ $value[] = $row;
+
+
+ // update
+ acf_update_value( $value, $post_id, $sub_field );
+
+
+ // return
+ return count($value);
+
+}
+
+
+/*
+* update_row
+*
+* This function will update a row of data to a field
+*
+* @type function
+* @date 19/10/2015
+* @since 5.2.3
+*
+* @param $selector (string)
+* @param $i (int)
+* @param $row (array)
+* @param $post_id (mixed)
+* @return (boolean)
+*/
+
+function update_row( $selector, $i = 1, $row = false, $post_id = false ) {
+
+ // vars
+ $offset = acf_get_setting('row_index_offset');
+ $i = $i - $offset;
+
+
+ // filter post_id
+ $post_id = acf_get_valid_post_id( $post_id );
+
+
+ // get field
+ $field = acf_maybe_get_field( $selector, $post_id, false );
+
+
+ // bail early if no field
+ if( !$field ) return false;
+
+
+ // get raw value
+ $value = acf_get_value( $post_id, $field );
+
+
+ // ensure array
+ $value = acf_get_array($value);
+
+
+ // update
+ $value[ $i ] = $row;
+
+
+ // update value
+ acf_update_value( $value, $post_id, $field );
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* update_sub_row
+*
+* This function will add a row of data to a field
+*
+* @type function
+* @date 16/10/2015
+* @since 5.2.3
+*
+* @param $selector (string)
+* @param $row (array)
+* @param $post_id (mixed)
+* @return (boolean)
+*/
+
+function update_sub_row( $selector, $i = 1, $row = false, $post_id = false ) {
+
+ // vars
+ $sub_field = false;
+ $offset = acf_get_setting('row_index_offset');
+ $i = $i - $offset;
+
+
+ // get sub field
+ if( is_array($selector) ) {
+
+ $post_id = acf_get_valid_post_id( $post_id );
+ $sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
+
+ } else {
+
+ $post_id = acf_get_loop('active', 'post_id');
+ $sub_field = get_row_sub_field( $selector );
+
+ }
+
+
+ // bail early if no sub field
+ if( !$sub_field ) return false;
+
+
+ // get raw value
+ $value = acf_get_value( $post_id, $sub_field );
+
+
+ // ensure array
+ $value = acf_get_array( $value );
+
+
+ // append
+ $value[ $i ] = $row;
+
+
+ // update
+ acf_update_value( $value, $post_id, $sub_field );
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* delete_row
+*
+* This function will delete a row of data from a field
+*
+* @type function
+* @date 19/10/2015
+* @since 5.2.3
+*
+* @param $selector (string)
+* @param $i (int)
+* @param $post_id (mixed)
+* @return (boolean)
+*/
+
+function delete_row( $selector, $i = 1, $post_id = false ) {
+
+ // vars
+ $offset = acf_get_setting('row_index_offset');
+ $i = $i - $offset;
+
+
+ // filter post_id
+ $post_id = acf_get_valid_post_id( $post_id );
+
+
+ // get field
+ $field = acf_maybe_get_field( $selector, $post_id );
+
+
+ // bail early if no field
+ if( !$field ) return false;
+
+
+ // get value
+ $value = acf_get_value( $post_id, $field );
+
+
+ // ensure array
+ $value = acf_get_array($value);
+
+
+ // bail early if index doesn't exist
+ if( !isset($value[ $i ]) ) return false;
+
+
+ // unset
+ unset( $value[ $i ] );
+
+
+ // update
+ acf_update_value( $value, $post_id, $field );
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* delete_sub_row
+*
+* This function will add a row of data to a field
+*
+* @type function
+* @date 16/10/2015
+* @since 5.2.3
+*
+* @param $selector (string)
+* @param $row (array)
+* @param $post_id (mixed)
+* @return (boolean)
+*/
+
+function delete_sub_row( $selector, $i = 1, $post_id = false ) {
+
+ // vars
+ $sub_field = false;
+ $offset = acf_get_setting('row_index_offset');
+ $i = $i - $offset;
+
+
+ // get sub field
+ if( is_array($selector) ) {
+
+ $post_id = acf_get_valid_post_id( $post_id );
+ $sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
+
+ } else {
+
+ $post_id = acf_get_loop('active', 'post_id');
+ $sub_field = get_row_sub_field( $selector );
+
+ }
+
+
+ // bail early if no sub field
+ if( !$sub_field ) return false;
+
+
+ // get raw value
+ $value = acf_get_value( $post_id, $sub_field );
+
+
+ // ensure array
+ $value = acf_get_array( $value );
+
+
+ // bail early if index doesn't exist
+ if( !isset($value[ $i ]) ) return false;
+
+
+ // append
+ unset( $value[ $i ] );
+
+
+ // update
+ acf_update_value( $value, $post_id, $sub_field );
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* Depreceated Functions
+*
+* These functions are outdated
+*
+* @type function
+* @date 4/03/2014
+* @since 1.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function create_field( $field ) {
+
+ acf_render_field( $field );
+
+}
+
+function render_field( $field ) {
+
+ acf_render_field( $field );
+
+}
+
+function reset_the_repeater_field() {
+
+ return reset_rows();
+
+}
+
+function the_repeater_field( $field_name, $post_id = false ) {
+
+ return has_sub_field( $field_name, $post_id );
+
+}
+
+function the_flexible_field( $field_name, $post_id = false ) {
+
+ return has_sub_field( $field_name, $post_id );
+
+}
+
+function acf_filter_post_id( $post_id ) {
+
+ return acf_get_valid_post_id( $post_id );
+
+}
+
+?>
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-value.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-value.php
new file mode 100644
index 0000000..9841380
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-value.php
@@ -0,0 +1,524 @@
+ https://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/meta.php#L82: line 101 (does use stripslashes_deep)
+ // update_option -> https://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/option.php#L0: line 215 (does not use stripslashes_deep)
+ $value = stripslashes_deep($value);
+
+
+ // add or update
+ if( get_option($option) !== false ) {
+
+ $return = update_option( $option, $value );
+
+ } else {
+
+ $return = add_option( $option, $value, $deprecated, $autoload );
+
+ }
+
+
+ // return
+ return $return;
+
+}
+
+
+/*
+* acf_get_value
+*
+* This function will load in a field's value
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $post_id (int)
+* @param $field (array)
+* @return (mixed)
+*/
+
+function acf_get_value( $post_id = 0, $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;
+ //}
+
+
+ // vars
+ $cache_key = "get_value/post_id={$post_id}/name={$field['name']}";
+
+
+ // return early if cache is found
+ if( acf_isset_cache($cache_key) ) {
+ return acf_get_cache($cache_key);
+ }
+
+
+ // load value
+ $value = acf_get_metadata( $post_id, $field['name'] );
+
+
+ // if value was duplicated, it may now be a serialized string!
+ $value = maybe_unserialize( $value );
+
+
+ // no value? try default_value
+ if( $value === null && isset($field['default_value']) ) {
+ $value = $field['default_value'];
+ }
+
+
+ // filter for 3rd party customization
+ $value = apply_filters( "acf/load_value", $value, $post_id, $field );
+ $value = apply_filters( "acf/load_value/type={$field['type']}", $value, $post_id, $field );
+ $value = apply_filters( "acf/load_value/name={$field['_name']}", $value, $post_id, $field );
+ $value = apply_filters( "acf/load_value/key={$field['key']}", $value, $post_id, $field );
+
+
+ // update cache
+ acf_set_cache($cache_key, $value);
+
+
+ // return
+ return $value;
+
+}
+
+
+/*
+* acf_format_value
+*
+* This function will format the value for front end use
+*
+* @type function
+* @date 3/07/2014
+* @since 5.0.0
+*
+* @param $value (mixed)
+* @param $post_id (mixed)
+* @param $field (array)
+* @return $value
+*/
+
+function acf_format_value( $value, $post_id, $field ) {
+
+ // vars
+ $cache_key = "format_value/post_id={$post_id}/name={$field['name']}";
+
+
+ // return early if cache is found
+ if( acf_isset_cache($cache_key) ) {
+
+ return acf_get_cache($cache_key);
+
+ }
+
+
+ // apply filters
+ $value = apply_filters( "acf/format_value", $value, $post_id, $field );
+ $value = apply_filters( "acf/format_value/type={$field['type']}", $value, $post_id, $field );
+ $value = apply_filters( "acf/format_value/name={$field['_name']}", $value, $post_id, $field );
+ $value = apply_filters( "acf/format_value/key={$field['key']}", $value, $post_id, $field );
+
+
+ // update cache
+ acf_set_cache($cache_key, $value);
+
+
+ // return
+ return $value;
+
+}
+
+
+/*
+* acf_update_value
+*
+* updates a value into the db
+*
+* @type action
+* @date 23/01/13
+*
+* @param $value (mixed)
+* @param $post_id (mixed)
+* @param $field (array)
+* @return (boolean)
+*/
+
+function acf_update_value( $value = null, $post_id = 0, $field ) {
+
+ // strip slashes
+ if( acf_get_setting('stripslashes') ) {
+
+ $value = stripslashes_deep($value);
+
+ }
+
+
+ // filter for 3rd party customization
+ $value = apply_filters( "acf/update_value", $value, $post_id, $field );
+ $value = apply_filters( "acf/update_value/type={$field['type']}", $value, $post_id, $field );
+ $value = apply_filters( "acf/update_value/name={$field['_name']}", $value, $post_id, $field );
+ $value = apply_filters( "acf/update_value/key={$field['key']}", $value, $post_id, $field );
+
+
+ // allow null to delete
+ if( $value === null ) {
+
+ return acf_delete_value( $post_id, $field );
+
+ }
+
+
+ // update value
+ $return = acf_update_metadata( $post_id, $field['name'], $value );
+
+
+ // update reference
+ acf_update_metadata( $post_id, $field['name'], $field['key'], true );
+
+
+ // clear cache
+ acf_delete_cache("get_value/post_id={$post_id}/name={$field['name']}");
+ acf_delete_cache("format_value/post_id={$post_id}/name={$field['name']}");
+
+
+ // return
+ return $return;
+
+}
+
+
+/*
+* acf_delete_value
+*
+* This function will delete a value from the database
+*
+* @type function
+* @date 28/09/13
+* @since 5.0.0
+*
+* @param $post_id (mixed)
+* @param $field (array)
+* @return (boolean)
+*/
+
+function acf_delete_value( $post_id = 0, $field ) {
+
+ // action for 3rd party customization
+ do_action("acf/delete_value", $post_id, $field['name'], $field);
+ do_action("acf/delete_value/type={$field['type']}", $post_id, $field['name'], $field);
+ do_action("acf/delete_value/name={$field['_name']}", $post_id, $field['name'], $field);
+ do_action("acf/delete_value/key={$field['key']}", $post_id, $field['name'], $field);
+
+
+ // delete value
+ $return = acf_delete_metadata( $post_id, $field['name'] );
+
+
+ // delete reference
+ acf_delete_metadata( $post_id, $field['name'], true );
+
+
+ // clear cache
+ acf_delete_cache("get_value/post_id={$post_id}/name={$field['name']}");
+ acf_delete_cache("format_value/post_id={$post_id}/name={$field['name']}");
+
+
+ // return
+ return $return;
+
+}
+
+
+/*
+* acf_copy_postmeta
+*
+* This function will copy postmeta from one post to another.
+* Very useful for saving and restoring revisions
+*
+* @type function
+* @date 25/06/2016
+* @since 5.3.8
+*
+* @param $from_post_id (int)
+* @param $to_post_id (int)
+* @return n/a
+*/
+
+function acf_copy_postmeta( $from_post_id, $to_post_id ) {
+
+ // get all postmeta
+ $meta = get_post_meta( $from_post_id );
+
+
+ // bail early if no meta
+ if( !$meta ) return;
+
+
+ // loop
+ foreach( $meta as $name => $value ) {
+
+ // attempt to find key value
+ $key = acf_maybe_get( $meta, '_'.$name );
+
+
+ // bail ealry if no key
+ if( !$key ) continue;
+
+
+ // update vars
+ $value = $value[0];
+ $key = $key[0];
+
+
+ // bail early if $key is a not a field_key
+ if( !acf_is_field_key($key) ) continue;
+
+
+ // get_post_meta will return array before running maybe_unserialize
+ $value = maybe_unserialize( $value );
+
+
+ // add in slashes
+ // - update_post_meta will unslash the value, so we must first slash it to avoid losing backslashes
+ // - https://codex.wordpress.org/Function_Reference/update_post_meta#Character_Escaping
+ if( is_string($value) ) {
+
+ $value = wp_slash($value);
+
+ }
+
+
+ // update value
+ acf_update_metadata( $to_post_id, $name, $value );
+ acf_update_metadata( $to_post_id, $name, $key, true );
+
+ }
+
+}
+
+
+/*
+* acf_preview_value
+*
+* This function will return a human freindly 'preview' for a given field value
+*
+* @type function
+* @date 24/10/16
+* @since 5.5.0
+*
+* @param $value (mixed)
+* @param $post_id (mixed)
+* @param $field (array)
+* @return (string)
+*/
+
+function acf_preview_value( $value, $post_id, $field ) {
+
+ // apply filters
+ $value = apply_filters( "acf/preview_value", $value, $post_id, $field );
+ $value = apply_filters( "acf/preview_value/type={$field['type']}", $value, $post_id, $field );
+ $value = apply_filters( "acf/preview_value/name={$field['_name']}", $value, $post_id, $field );
+ $value = apply_filters( "acf/preview_value/key={$field['key']}", $value, $post_id, $field );
+
+
+ // return
+ return $value;
+
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/cache.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/cache.php
new file mode 100644
index 0000000..f74a203
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/cache.php
@@ -0,0 +1,445 @@
+active;
+
+ }
+
+
+ /*
+ * enable
+ *
+ * This function will enable ACF caching
+ *
+ * @type function
+ * @date 26/6/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function enable() {
+
+ $this->active = true;
+
+ }
+
+
+ /*
+ * disable
+ *
+ * This function will disable ACF caching
+ *
+ * @type function
+ * @date 26/6/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function disable() {
+
+ $this->active = false;
+
+ }
+
+
+ /*
+ * get_key
+ *
+ * This function will check for references and modify the key
+ *
+ * @type function
+ * @date 30/06/2016
+ * @since 5.4.0
+ *
+ * @param $key (string)
+ * @return $key
+ */
+
+ function get_key( $key = '' ) {
+
+ // check for reference
+ if( isset($this->reference[ $key ]) ) {
+
+ $key = $this->reference[ $key ];
+
+ }
+
+
+ // return
+ return $key;
+
+ }
+
+
+
+ /*
+ * isset_cache
+ *
+ * This function will return true if a cached data exists for the given key
+ *
+ * @type function
+ * @date 30/06/2016
+ * @since 5.4.0
+ *
+ * @param $key (string)
+ * @return (boolean)
+ */
+
+ function isset_cache( $key = '' ) {
+
+ // bail early if not active
+ if( !$this->is_active() ) return false;
+
+
+ // vars
+ $key = $this->get_key($key);
+ $found = false;
+
+
+ // get cache
+ $cache = wp_cache_get($key, 'acf', false, $found);
+
+
+ // return
+ return $found;
+
+ }
+
+
+ /*
+ * get_cache
+ *
+ * This function will return cached data for a given key
+ *
+ * @type function
+ * @date 30/06/2016
+ * @since 5.4.0
+ *
+ * @param $key (string)
+ * @return (mixed)
+ */
+
+ function get_cache( $key = '' ) {
+
+ // bail early if not active
+ if( !$this->is_active() ) return false;
+
+
+ // vars
+ $key = $this->get_key($key);
+ $found = false;
+
+
+ // get cache
+ $cache = wp_cache_get($key, 'acf', false, $found);
+
+
+ // return
+ return $cache;
+
+ }
+
+
+ /*
+ * set_cache
+ *
+ * This function will set cached data for a given key
+ *
+ * @type function
+ * @date 30/06/2016
+ * @since 5.4.0
+ *
+ * @param $key (string)
+ * @param $data (mixed)
+ * @return n/a
+ */
+
+ function set_cache( $key = '', $data = '' ) {
+
+ // bail early if not active
+ if( !$this->is_active() ) return false;
+
+
+ // set
+ wp_cache_set($key, $data, 'acf');
+
+
+ // return
+ return $key;
+
+ }
+
+
+ /*
+ * set_cache_reference
+ *
+ * This function will set a reference to cached data for a given key
+ *
+ * @type function
+ * @date 30/06/2016
+ * @since 5.4.0
+ *
+ * @param $key (string)
+ * @param $reference (string)
+ * @return n/a
+ */
+
+ function set_cache_reference( $key = '', $reference = '' ) {
+
+ // bail early if not active
+ if( !$this->is_active() ) return false;
+
+
+ // add
+ $this->reference[ $key ] = $reference;
+
+
+ // resturn
+ return $key;
+
+ }
+
+
+ /*
+ * delete_cache
+ *
+ * This function will delete cached data for a given key
+ *
+ * @type function
+ * @date 30/06/2016
+ * @since 5.4.0
+ *
+ * @param $key (string)
+ * @return n/a
+ */
+
+ function delete_cache( $key = '' ) {
+
+ // bail early if not active
+ if( !$this->is_active() ) return false;
+
+
+ // delete
+ return wp_cache_delete( $key, 'acf' );
+
+ }
+
+}
+
+
+// initialize
+acf()->cache = new acf_cache();
+
+endif; // class_exists check
+
+
+/*
+* acf_is_cache_active
+*
+* alias of acf()->cache->is_active()
+*
+* @type function
+* @date 26/6/17
+* @since 5.6.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_is_cache_active() {
+
+ return acf()->cache->is_active();
+
+}
+
+
+/*
+* acf_disable_cache
+*
+* alias of acf()->cache->disable()
+*
+* @type function
+* @date 26/6/17
+* @since 5.6.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_disable_cache() {
+
+ return acf()->cache->disable();
+
+}
+
+
+/*
+* acf_enable_cache
+*
+* alias of acf()->cache->enable()
+*
+* @type function
+* @date 26/6/17
+* @since 5.6.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_enable_cache() {
+
+ return acf()->cache->enable();
+
+}
+
+
+/*
+* acf_isset_cache
+*
+* alias of acf()->cache->isset_cache()
+*
+* @type function
+* @date 30/06/2016
+* @since 5.4.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_isset_cache( $key = '' ) {
+
+ return acf()->cache->isset_cache( $key );
+
+}
+
+
+/*
+* acf_get_cache
+*
+* alias of acf()->cache->get_cache()
+*
+* @type function
+* @date 30/06/2016
+* @since 5.4.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_get_cache( $key = '' ) {
+
+ return acf()->cache->get_cache( $key );
+
+}
+
+
+/*
+* acf_set_cache
+*
+* alias of acf()->cache->set_cache()
+*
+* @type function
+* @date 30/06/2016
+* @since 5.4.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_set_cache( $key = '', $data ) {
+
+ return acf()->cache->set_cache( $key, $data );
+
+}
+
+
+/*
+* acf_set_cache_reference
+*
+* alias of acf()->cache->set_cache_reference()
+*
+* @type function
+* @date 30/06/2016
+* @since 5.4.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_set_cache_reference( $key = '', $reference = '' ) {
+
+ return acf()->cache->set_cache_reference( $key, $reference );
+
+}
+
+
+/*
+* acf_delete_cache
+*
+* alias of acf()->cache->delete_cache()
+*
+* @type function
+* @date 30/06/2016
+* @since 5.4.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_delete_cache( $key = '' ) {
+
+ return acf()->cache->delete_cache( $key );
+
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/compatibility.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/compatibility.php
new file mode 100644
index 0000000..4acef59
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/compatibility.php
@@ -0,0 +1,591 @@
+ 'post_taxonomy',
+ 'ef_media' => 'attachment',
+ 'ef_taxonomy' => 'taxonomy',
+ 'ef_user' => 'user_role',
+ 'user_type' => 'current_user_role' // 5.2.0
+ );
+
+
+ // remove conflicting param
+ if( $version == 5 ) {
+
+ unset($replace['taxonomy']);
+
+ }
+
+
+ // loop over location groups
+ foreach( $field_group['location'] as $i => $group ) {
+
+ // bail early if group is empty
+ if( empty($group) ) continue;
+
+
+ // loop over group rules
+ foreach( $group as $ii => $rule ) {
+
+ // migrate param
+ if( isset($replace[ $rule['param'] ]) ) {
+
+ $rule['param'] = $replace[ $rule['param'] ];
+
+ }
+
+
+ // update
+ $group[ $ii ] = $rule;
+
+ }
+
+
+ // update
+ $field_group['location'][ $i ] = $group;
+
+ }
+
+ }
+
+
+ // change layout to style (v5.0.0)
+ if( !empty($field_group['layout']) ) {
+
+ $field_group['style'] = acf_extract_var($field_group, 'layout');
+
+ }
+
+
+ // change no_box to seamless (v5.0.0)
+ if( $field_group['style'] === 'no_box' ) {
+
+ $field_group['style'] = 'seamless';
+
+ }
+
+
+ //return
+ return $field_group;
+
+ }
+
+}
+
+new acf_compatibility();
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/deprecated.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/deprecated.php
new file mode 100644
index 0000000..8705e67
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/deprecated.php
@@ -0,0 +1,185 @@
+deprecated = new acf_deprecated();
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields.php
new file mode 100644
index 0000000..189cf2a
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields.php
@@ -0,0 +1,366 @@
+types[ $class->name ] = $class;
+
+ } else {
+
+ $instance = new $class();
+ $this->types[ $instance->name ] = $instance;
+
+ }
+
+ }
+
+
+ /*
+ * get_field_type
+ *
+ * This function will return a field type class
+ *
+ * @type function
+ * @date 6/07/2016
+ * @since 5.4.0
+ *
+ * @param $name (string)
+ * @return (mixed)
+ */
+
+ function get_field_type( $name ) {
+
+ return isset( $this->types[$name] ) ? $this->types[$name] : null;
+
+ }
+
+
+ /*
+ * is_field_type
+ *
+ * This function will return true if a field type exists
+ *
+ * @type function
+ * @date 6/07/2016
+ * @since 5.4.0
+ *
+ * @param $name (string)
+ * @return (mixed)
+ */
+
+ function is_field_type( $name ) {
+
+ return isset( $this->types[$name] );
+
+ }
+
+
+ /*
+ * register_field_type_info
+ *
+ * This function will store a basic array of info about the field type
+ * to later be overriden by the avbove register_field_type function
+ *
+ * @type function
+ * @date 29/5/17
+ * @since 5.6.0
+ *
+ * @param $info (array)
+ * @return n/a
+ */
+
+ function register_field_type_info( $info ) {
+
+ // convert to object
+ $instance = (object) $info;
+ $this->types[ $instance->name ] = $instance;
+
+ }
+
+
+ /*
+ * get_field_types
+ *
+ * This function will return an array of all field type infos
+ *
+ * @type function
+ * @date 6/07/2016
+ * @since 5.4.0
+ *
+ * @param $name (string)
+ * @return (mixed)
+ */
+
+ function get_field_types() {
+
+ // vars
+ $groups = array();
+ $l10n = array(
+ 'basic' => __('Basic', 'acf'),
+ 'content' => __('Content', 'acf'),
+ 'choice' => __('Choice', 'acf'),
+ 'relational' => __('Relational', 'acf'),
+ 'jquery' => __('jQuery', 'acf'),
+ 'layout' => __('Layout', 'acf'),
+ );
+
+
+ // loop
+ foreach( $this->types as $type ) {
+
+ // bail ealry if not public
+ if( !$type->public ) continue;
+
+
+ // translate
+ $cat = $type->category;
+ $cat = isset( $l10n[$cat] ) ? $l10n[$cat] : $cat;
+
+
+ // append
+ $groups[ $cat ][ $type->name ] = $type->label;
+
+ }
+
+
+ // filter
+ $groups = apply_filters('acf/get_field_types', $groups);
+
+
+ // return
+ return $groups;
+
+ }
+
+}
+
+
+// initialize
+acf()->fields = new acf_fields();
+
+endif; // class_exists check
+
+
+/*
+* acf_register_field_type
+*
+* alias of acf()->fields->register_field_type()
+*
+* @type function
+* @date 31/5/17
+* @since 5.6.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_register_field_type( $class ) {
+
+ return acf()->fields->register_field_type( $class );
+
+}
+
+
+/*
+* acf_get_field_type
+*
+* alias of acf()->fields->get_field_type()
+*
+* @type function
+* @date 31/5/17
+* @since 5.6.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_get_field_type( $name ) {
+
+ return acf()->fields->get_field_type( $name );
+
+}
+
+
+/*
+* acf_register_field_type_info
+*
+* alias of acf()->fields->register_field_type_info()
+*
+* @type function
+* @date 31/5/17
+* @since 5.6.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_register_field_type_info( $info ) {
+
+ return acf()->fields->register_field_type_info( $info );
+
+}
+
+
+/*
+* acf_get_field_types
+*
+* alias of acf()->fields->get_field_types()
+*
+* @type function
+* @date 31/5/17
+* @since 5.6.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_get_field_types() {
+
+ return acf()->fields->get_field_types();
+
+}
+
+
+/*
+* acf_is_field_type
+*
+* alias of acf()->fields->is_field_type()
+*
+* @type function
+* @date 31/5/17
+* @since 5.6.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_is_field_type( $name = '' ) {
+
+ return acf()->fields->is_field_type( $name );
+
+}
+
+
+/*
+* acf_get_field_type_prop
+*
+* This function will return a field type's property
+*
+* @type function
+* @date 1/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return (array)
+*/
+
+function acf_get_field_type_prop( $name = '', $prop = '' ) {
+
+ $type = acf_get_field_type( $name );
+ return ($type && isset($type->$prop)) ? $type->$prop : null;
+
+}
+
+
+/*
+* acf_get_field_type_label
+*
+* This function will return the label of a field type
+*
+* @type function
+* @date 1/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return (array)
+*/
+
+function acf_get_field_type_label( $name = '' ) {
+
+ $type = acf_get_field_type( $name );
+ return $type ? $type->label : ''.__('Unknown', 'acf').' ';
+
+}
+
+
+/*
+* acf_field_type_exists (deprecated)
+*
+* deprecated in favour of acf_is_field_type()
+*
+* @type function
+* @date 1/10/13
+* @since 5.0.0
+*
+* @param $type (string)
+* @return (boolean)
+*/
+
+function acf_field_type_exists( $type = '' ) {
+ return acf_is_field_type( $type );
+}
+
+
+/*
+* acf_get_grouped_field_types (deprecated)
+*
+* deprecated in favour of acf_get_field_types()
+*
+* @type function
+* @date 1/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return (array)
+*/
+
+function acf_get_grouped_field_types() {
+ return acf_get_field_types();
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-accordion.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-accordion.php
new file mode 100644
index 0000000..e149e04
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-accordion.php
@@ -0,0 +1,167 @@
+name = 'accordion';
+ $this->label = __("Accordion",'acf');
+ $this->category = 'layout';
+ $this->defaults = array(
+ 'open' => 0,
+ 'multi_expand' => 0,
+ 'endpoint' => 0
+ );
+
+ }
+
+
+ /**
+ * render_field
+ *
+ * Create the HTML interface for your field
+ *
+ * @date 30/10/17
+ * @since 5.6.3
+ *
+ * @param array $field
+ * @return n/a
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $atts = array(
+ 'class' => 'acf-fields',
+ 'data-open' => $field['open'],
+ 'data-multi_expand' => $field['multi_expand'],
+ 'data-endpoint' => $field['endpoint']
+ );
+
+ ?>
+ >
+ ' . __( 'Accordions help you organize fields into panels that open and close.', 'acf') . '
';
+ $message .= '' . __( 'All fields following this accordion (or until another accordion is defined) will be grouped together.','acf') . '
';
+
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Instructions','acf'),
+ 'instructions' => '',
+ 'name' => 'notes',
+ 'type' => 'message',
+ 'message' => $message,
+ ));
+*/
+
+ // active
+ acf_render_field_setting( $field, array(
+ 'label' => __('Open','acf'),
+ 'instructions' => __('Display this accordion as open on page load.','acf'),
+ 'name' => 'open',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // multi_expand
+ acf_render_field_setting( $field, array(
+ 'label' => __('Multi-expand','acf'),
+ 'instructions' => __('Allow this accordion to open without closing others.','acf'),
+ 'name' => 'multi_expand',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // endpoint
+ acf_render_field_setting( $field, array(
+ 'label' => __('Endpoint','acf'),
+ 'instructions' => __('Define an endpoint for the previous accordion to stop. This accordion will not be visible.','acf'),
+ 'name' => 'endpoint',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+ }
+
+
+ /*
+ * load_field()
+ *
+ * This filter is appied to the $field after it is loaded from the database
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - the field array holding all the field options
+ *
+ * @return $field - the field array holding all the field options
+ */
+
+ function load_field( $field ) {
+
+ // remove name to avoid caching issue
+ $field['name'] = '';
+
+ // remove required to avoid JS issues
+ $field['required'] = 0;
+
+ // set value other than 'null' to avoid ACF loading / caching issue
+ $field['value'] = false;
+
+ // return
+ return $field;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field__accordion' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-button-group.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-button-group.php
new file mode 100644
index 0000000..db1dd95
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-button-group.php
@@ -0,0 +1,292 @@
+name = 'button_group';
+ $this->label = __("Button Group",'acf');
+ $this->category = 'choice';
+ $this->defaults = array(
+ 'choices' => array(),
+ 'default_value' => '',
+ 'allow_null' => 0,
+ 'return_format' => 'value',
+ 'layout' => 'horizontal',
+ );
+
+ }
+
+
+ /**
+ * render_field()
+ *
+ * Creates the field's input HTML
+ *
+ * @date 18/9/17
+ * @since 5.6.3
+ *
+ * @param array $field The field settings array
+ * @return n/a
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $html = '';
+ $selected = null;
+ $buttons = array();
+ $value = esc_attr( $field['value'] );
+
+
+ // bail ealrly if no choices
+ if( empty($field['choices']) ) return;
+
+
+ // buttons
+ foreach( $field['choices'] as $_value => $_label ) {
+
+ // checked
+ $checked = ( $value === esc_attr($_value) );
+ if( $checked ) $selected = true;
+
+
+ // append
+ $buttons[] = array(
+ 'name' => $field['name'],
+ 'value' => $_value,
+ 'label' => $_label,
+ 'checked' => $checked
+ );
+
+ }
+
+
+ // maybe select initial value
+ if( !$field['allow_null'] && $selected === null ) {
+ $buttons[0]['checked'] = true;
+ }
+
+
+ // div
+ $div = array( 'class' => 'acf-button-group' );
+
+ if( $field['layout'] == 'vertical' ) { $div['class'] .= ' -vertical'; }
+ if( $field['class'] ) { $div['class'] .= ' ' . $field['class']; }
+ if( $field['allow_null'] ) { $div['data-allow_null'] = 1; }
+
+
+ // hdden input
+ $html .= acf_get_hidden_input( array('name' => $field['name']) );
+
+
+ // open
+ $html .= '';
+
+ // loop
+ foreach( $buttons as $button ) {
+
+ // checked
+ if( $button['checked'] ) {
+ $button['checked'] = 'checked';
+ } else {
+ unset($button['checked']);
+ }
+
+
+ // append
+ $html .= acf_get_radio_input( $button );
+
+ }
+
+
+ // close
+ $html .= '
';
+
+
+ // return
+ echo $html;
+
+ }
+
+
+ /**
+ * render_field_settings()
+ *
+ * Creates the field's settings HTML
+ *
+ * @date 18/9/17
+ * @since 5.6.3
+ *
+ * @param array $field The field settings array
+ * @return n/a
+ */
+
+ function render_field_settings( $field ) {
+
+ // encode choices (convert from array)
+ $field['choices'] = acf_encode_choices($field['choices']);
+
+
+ // choices
+ acf_render_field_setting( $field, array(
+ 'label' => __('Choices','acf'),
+ 'instructions' => __('Enter each choice on a new line.','acf') . ' ' . __('For more control, you may specify both a value and label like this:','acf'). ' ' . __('red : Red','acf'),
+ 'type' => 'textarea',
+ 'name' => 'choices',
+ ));
+
+
+ // allow_null
+ acf_render_field_setting( $field, array(
+ 'label' => __('Allow Null?','acf'),
+ 'instructions' => '',
+ 'name' => 'allow_null',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => __('Appears when creating a new post','acf'),
+ 'type' => 'text',
+ 'name' => 'default_value',
+ ));
+
+
+ // layout
+ acf_render_field_setting( $field, array(
+ 'label' => __('Layout','acf'),
+ 'instructions' => '',
+ 'type' => 'radio',
+ 'name' => 'layout',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'horizontal' => __("Horizontal",'acf'),
+ 'vertical' => __("Vertical",'acf'),
+ )
+ ));
+
+
+ // return_format
+ acf_render_field_setting( $field, array(
+ 'label' => __('Return Value','acf'),
+ 'instructions' => __('Specify the returned value on front end','acf'),
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'value' => __('Value','acf'),
+ 'label' => __('Label','acf'),
+ 'array' => __('Both (Array)','acf')
+ )
+ ));
+
+ }
+
+
+ /*
+ * update_field()
+ *
+ * This filter is appied to the $field before it is saved to the database
+ *
+ * @date 18/9/17
+ * @since 5.6.3
+ *
+ * @param array $field The field array holding all the field options
+ * @return $field
+ */
+
+ function update_field( $field ) {
+
+ return acf_get_field_type('radio')->update_field( $field );
+ }
+
+
+ /*
+ * load_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db
+ *
+ * @date 18/9/17
+ * @since 5.6.3
+ *
+ * @param mixed $value The value found in the database
+ * @param mixed $post_id The post ID from which the value was loaded from
+ * @param array $field The field array holding all the field options
+ * @return $value
+ */
+
+ function load_value( $value, $post_id, $field ) {
+
+ return acf_get_field_type('radio')->load_value( $value, $post_id, $field );
+
+ }
+
+
+ /*
+ * translate_field
+ *
+ * This function will translate field settings
+ *
+ * @date 18/9/17
+ * @since 5.6.3
+ *
+ * @param array $field The field array holding all the field options
+ * @return $field
+ */
+
+ function translate_field( $field ) {
+
+ return acf_get_field_type('radio')->translate_field( $field );
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @date 18/9/17
+ * @since 5.6.3
+ *
+ * @param mixed $value The value found in the database
+ * @param mixed $post_id The post ID from which the value was loaded from
+ * @param array $field The field array holding all the field options
+ * @return $value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ return acf_get_field_type('radio')->format_value( $value, $post_id, $field );
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_button_group' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-checkbox.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-checkbox.php
new file mode 100644
index 0000000..3f070a9
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-checkbox.php
@@ -0,0 +1,567 @@
+name = 'checkbox';
+ $this->label = __("Checkbox",'acf');
+ $this->category = 'choice';
+ $this->defaults = array(
+ 'layout' => 'vertical',
+ 'choices' => array(),
+ 'default_value' => '',
+ 'allow_custom' => 0,
+ 'save_custom' => 0,
+ 'toggle' => 0,
+ 'return_format' => 'value'
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field (array) the $field being rendered
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field (array) the $field being edited
+ * @return n/a
+ */
+
+ function render_field( $field ) {
+
+ // reset vars
+ $this->_values = array();
+ $this->_all_checked = true;
+
+
+ // ensure array
+ $field['value'] = acf_get_array($field['value']);
+ $field['choices'] = acf_get_array($field['choices']);
+
+
+ // hiden input
+ acf_hidden_input( array('name' => $field['name']) );
+
+
+ // vars
+ $li = '';
+ $ul = array(
+ 'class' => 'acf-checkbox-list',
+ );
+
+
+ // append to class
+ $ul['class'] .= ' ' . ($field['layout'] == 'horizontal' ? 'acf-hl' : 'acf-bl');
+ $ul['class'] .= ' ' . $field['class'];
+
+
+ // checkbox saves an array
+ $field['name'] .= '[]';
+
+
+ // choices
+ if( !empty($field['choices']) ) {
+
+ // choices
+ $li .= $this->render_field_choices( $field );
+
+
+ // toggle
+ if( $field['toggle'] ) {
+ $li = $this->render_field_toggle( $field ) . $li;
+ }
+
+ }
+
+
+ // custom
+ if( $field['allow_custom'] ) {
+ $li .= $this->render_field_custom( $field );
+ }
+
+
+ // return
+ echo '' . "\n";
+
+ }
+
+
+ /*
+ * render_field_choices
+ *
+ * description
+ *
+ * @type function
+ * @date 15/7/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function render_field_choices( $field ) {
+
+ // walk
+ return $this->walk( $field['choices'], $field );
+
+ }
+
+
+ /*
+ * render_field_toggle
+ *
+ * description
+ *
+ * @type function
+ * @date 15/7/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function render_field_toggle( $field ) {
+
+ // vars
+ $atts = array(
+ 'type' => 'checkbox',
+ 'class' => 'acf-checkbox-toggle',
+ 'label' => __("Toggle All", 'acf')
+ );
+
+
+ // custom label
+ if( is_string($field['toggle']) ) {
+ $atts['label'] = $field['toggle'];
+ }
+
+
+ // checked
+ if( $this->_all_checked ) {
+ $atts['checked'] = 'checked';
+ }
+
+
+ // return
+ return '' . acf_get_checkbox_input($atts) . ' ' . "\n";
+
+ }
+
+
+ /*
+ * render_field_custom
+ *
+ * description
+ *
+ * @type function
+ * @date 15/7/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function render_field_custom( $field ) {
+
+ // vars
+ $html = '';
+
+
+ // loop
+ foreach( $field['value'] as $value ) {
+
+ // ignore if already eixsts
+ if( isset($field['choices'][ $value ]) ) continue;
+
+
+ // vars
+ $esc_value = esc_attr($value);
+ $text_input = array(
+ 'name' => $field['name'],
+ 'value' => $value,
+ );
+
+
+ // bail ealry if choice already exists
+ if( in_array( $esc_value, $this->_values ) ) continue;
+
+
+ // append
+ $html .= ' ' . acf_get_text_input($text_input) . ' ' . "\n";
+
+ }
+
+
+ // append button
+ $html .= '' . esc_attr__('Add new choice', 'acf') . ' ' . "\n";
+
+
+ // return
+ return $html;
+
+ }
+
+
+ function walk( $choices = array(), $args = array(), $depth = 0 ) {
+
+ // bail ealry if no choices
+ if( empty($choices) ) return '';
+
+
+ // defaults
+ $args = wp_parse_args($args, array(
+ 'id' => '',
+ 'type' => 'checkbox',
+ 'name' => '',
+ 'value' => array(),
+ 'disabled' => array(),
+ ));
+
+
+ // vars
+ $html = '';
+
+
+ // sanitize values for 'selected' matching
+ if( $depth == 0 ) {
+ $args['value'] = array_map('esc_attr', $args['value']);
+ $args['disabled'] = array_map('esc_attr', $args['disabled']);
+ }
+
+
+ // loop
+ foreach( $choices as $value => $label ) {
+
+ // open
+ $html .= '';
+
+
+ // optgroup
+ if( is_array($label) ){
+
+ $html .= '' . "\n";
+ $html .= $this->walk( $label, $args, $depth+1 );
+ $html .= ' ';
+
+ // option
+ } else {
+
+ // vars
+ $esc_value = esc_attr($value);
+ $atts = array(
+ 'id' => $args['id'] . '-' . str_replace(' ', '-', $value),
+ 'type' => $args['type'],
+ 'name' => $args['name'],
+ 'value' => $value,
+ 'label' => $label,
+ );
+
+
+ // selected
+ if( in_array( $esc_value, $args['value'] ) ) {
+ $atts['checked'] = 'checked';
+ } else {
+ $this->_all_checked = false;
+ }
+
+
+ // disabled
+ if( in_array( $esc_value, $args['disabled'] ) ) {
+ $atts['disabled'] = 'disabled';
+ }
+
+
+ // store value added
+ $this->_values[] = $esc_value;
+
+
+ // append
+ $html .= acf_get_checkbox_input($atts);
+
+ }
+
+
+ // close
+ $html .= ' ' . "\n";
+
+ }
+
+
+ // return
+ return $html;
+
+ }
+
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_settings( $field ) {
+
+ // encode choices (convert from array)
+ $field['choices'] = acf_encode_choices($field['choices']);
+ $field['default_value'] = acf_encode_choices($field['default_value'], false);
+
+
+ // choices
+ acf_render_field_setting( $field, array(
+ 'label' => __('Choices','acf'),
+ 'instructions' => __('Enter each choice on a new line.','acf') . ' ' . __('For more control, you may specify both a value and label like this:','acf'). ' ' . __('red : Red','acf'),
+ 'type' => 'textarea',
+ 'name' => 'choices',
+ ));
+
+
+ // other_choice
+ acf_render_field_setting( $field, array(
+ 'label' => __('Allow Custom','acf'),
+ 'instructions' => '',
+ 'name' => 'allow_custom',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ 'message' => __("Allow 'custom' values to be added", 'acf'),
+ ));
+
+
+ // save_other_choice
+ acf_render_field_setting( $field, array(
+ 'label' => __('Save Custom','acf'),
+ 'instructions' => '',
+ 'name' => 'save_custom',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ 'message' => __("Save 'custom' values to the field's choices", 'acf')
+ ));
+
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => __('Enter each default value on a new line','acf'),
+ 'type' => 'textarea',
+ 'name' => 'default_value',
+ ));
+
+
+ // layout
+ acf_render_field_setting( $field, array(
+ 'label' => __('Layout','acf'),
+ 'instructions' => '',
+ 'type' => 'radio',
+ 'name' => 'layout',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'vertical' => __("Vertical",'acf'),
+ 'horizontal' => __("Horizontal",'acf')
+ )
+ ));
+
+
+ // layout
+ acf_render_field_setting( $field, array(
+ 'label' => __('Toggle','acf'),
+ 'instructions' => __('Prepend an extra checkbox to toggle all choices','acf'),
+ 'name' => 'toggle',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // return_format
+ acf_render_field_setting( $field, array(
+ 'label' => __('Return Value','acf'),
+ 'instructions' => __('Specify the returned value on front end','acf'),
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'value' => __('Value','acf'),
+ 'label' => __('Label','acf'),
+ 'array' => __('Both (Array)','acf')
+ )
+ ));
+
+ }
+
+
+ /*
+ * update_field()
+ *
+ * This filter is appied to the $field before it is saved to the database
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - the field array holding all the field options
+ * @param $post_id - the field group ID (post_type = acf)
+ *
+ * @return $field - the modified field
+ */
+
+ function update_field( $field ) {
+
+ return acf_get_field_type('select')->update_field( $field );
+
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $post_id - the $post_id of which the value will be saved
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // bail early if is empty
+ if( empty($value) ) return $value;
+
+
+ // select -> update_value()
+ $value = acf_get_field_type('select')->update_value( $value, $post_id, $field );
+
+
+ // save_other_choice
+ if( $field['save_custom'] ) {
+
+ // get raw $field (may have been changed via repeater field)
+ // if field is local, it won't have an ID
+ $selector = $field['ID'] ? $field['ID'] : $field['key'];
+ $field = acf_get_field( $selector, true );
+
+
+ // bail early if no ID (JSON only)
+ if( !$field['ID'] ) return $value;
+
+
+ // loop
+ foreach( $value as $v ) {
+
+ // ignore if already eixsts
+ if( isset($field['choices'][ $v ]) ) continue;
+
+
+ // unslash (fixes serialize single quote issue)
+ $v = wp_unslash($v);
+
+
+ // sanitize (remove tags)
+ $v = sanitize_text_field($v);
+
+
+ // append
+ $field['choices'][ $v ] = $v;
+
+ }
+
+
+ // save
+ acf_update_field( $field );
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * translate_field
+ *
+ * This function will translate field settings
+ *
+ * @type function
+ * @date 8/03/2016
+ * @since 5.3.2
+ *
+ * @param $field (array)
+ * @return $field
+ */
+
+ function translate_field( $field ) {
+
+ return acf_get_field_type('select')->translate_field( $field );
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ return acf_get_field_type('select')->format_value( $value, $post_id, $field );
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_checkbox' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-color_picker.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-color_picker.php
new file mode 100644
index 0000000..6b6657f
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-color_picker.php
@@ -0,0 +1,148 @@
+name = 'color_picker';
+ $this->label = __("Color Picker",'acf');
+ $this->category = 'jquery';
+ $this->defaults = array(
+ 'default_value' => '',
+ );
+
+ }
+
+
+ /*
+ * input_admin_enqueue_scripts
+ *
+ * description
+ *
+ * @type function
+ * @date 16/12/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function input_admin_enqueue_scripts() {
+
+ // globals
+ global $wp_scripts;
+
+
+ // register if not already (on front end)
+ // http://wordpress.stackexchange.com/questions/82718/how-do-i-implement-the-wordpress-iris-picker-into-my-plugin-on-the-front-end
+ if( !isset($wp_scripts->registered['iris']) ) {
+
+ // styles
+ wp_register_style('wp-color-picker', admin_url('css/color-picker.css'), array(), '', true);
+
+
+ // scripts
+ wp_register_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), '1.0.7', true);
+ wp_register_script('wp-color-picker', admin_url('js/color-picker.min.js'), array('iris'), '', true);
+
+
+ // localize
+ wp_localize_script('wp-color-picker', 'wpColorPickerL10n', array(
+ 'clear' => __('Clear', 'acf' ),
+ 'defaultString' => __('Default', 'acf' ),
+ 'pick' => __('Select Color', 'acf' ),
+ 'current' => __('Current Color', 'acf' )
+ ));
+
+ }
+
+
+ // enqueue
+ wp_enqueue_style('wp-color-picker');
+ wp_enqueue_script('wp-color-picker');
+
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $text_input = acf_get_sub_array( $field, array('id', 'class', 'name', 'value') );
+ $hidden_input = acf_get_sub_array( $field, array('name', 'value') );
+
+
+ // html
+ ?>
+
+
+
+
+ __('Default Value','acf'),
+ 'instructions' => '',
+ 'type' => 'text',
+ 'name' => 'default_value',
+ 'placeholder' => '#FFFFFF'
+ ));
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_color_picker' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-date_picker.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-date_picker.php
new file mode 100644
index 0000000..79170f6
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-date_picker.php
@@ -0,0 +1,305 @@
+name = 'date_picker';
+ $this->label = __("Date Picker",'acf');
+ $this->category = 'jquery';
+ $this->defaults = array(
+ 'display_format' => 'd/m/Y',
+ 'return_format' => 'd/m/Y',
+ 'first_day' => 1
+ );
+ $this->l10n = array(
+ 'closeText' => _x('Done', 'Date Picker JS closeText', 'acf'),
+ 'currentText' => _x('Today', 'Date Picker JS currentText', 'acf'),
+ 'nextText' => _x('Next', 'Date Picker JS nextText', 'acf'),
+ 'prevText' => _x('Prev', 'Date Picker JS prevText', 'acf'),
+ 'weekHeader' => _x('Wk', 'Date Picker JS weekHeader', 'acf'),
+ );
+
+
+ // actions
+ add_action('init', array($this, 'init'));
+
+ }
+
+
+ /*
+ * init
+ *
+ * This function is run on the 'init' action to set the field's $l10n data. Before the init action,
+ * access to the $wp_locale variable is not possible.
+ *
+ * @type action (init)
+ * @date 3/09/13
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function init() {
+
+ // globals
+ global $wp_locale;
+
+
+ // append
+ $this->l10n = array_merge($this->l10n, array(
+ 'monthNames' => array_values( $wp_locale->month ),
+ 'monthNamesShort' => array_values( $wp_locale->month_abbrev ),
+ 'dayNames' => array_values( $wp_locale->weekday ),
+ 'dayNamesMin' => array_values( $wp_locale->weekday_initial ),
+ 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev )
+ ));
+
+ }
+
+
+ /*
+ * input_admin_enqueue_scripts
+ *
+ * description
+ *
+ * @type function
+ * @date 16/12/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function input_admin_enqueue_scripts() {
+
+ // bail ealry if no enqueue
+ if( !acf_get_setting('enqueue_datepicker') ) return;
+
+
+ // script
+ wp_enqueue_script('jquery-ui-datepicker');
+
+
+ // style
+ wp_enqueue_style('acf-datepicker', acf_get_dir('assets/inc/datepicker/jquery-ui.min.css'), '', '1.11.4' );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // format value
+ $hidden_value = '';
+ $display_value = '';
+
+ if( $field['value'] ) {
+
+ $hidden_value = acf_format_date( $field['value'], 'Ymd' );
+ $display_value = acf_format_date( $field['value'], $field['display_format'] );
+
+ }
+
+
+ // vars
+ $div = array(
+ 'class' => 'acf-date-picker acf-input-wrap',
+ 'data-date_format' => acf_convert_date_to_js($field['display_format']),
+ 'data-first_day' => $field['first_day'],
+ );
+
+ $hidden_input = array(
+ 'id' => $field['id'],
+ 'class' => 'input-alt',
+ 'name' => $field['name'],
+ 'value' => $hidden_value,
+ );
+
+ $text_input = array(
+ 'class' => 'input',
+ 'value' => $display_value,
+ );
+
+
+ // save_format - compatibility with ACF < 5.0.0
+ if( !empty($field['save_format']) ) {
+
+ // add custom JS save format
+ $div['data-save_format'] = $field['save_format'];
+
+ // revert hidden input value to raw DB value
+ $hidden_input['value'] = $field['value'];
+
+ // remove formatted value (will do this via JS)
+ $text_input['value'] = '';
+
+ }
+
+
+ // html
+ ?>
+ >
+
+
+
+ __('Display Format','acf'),
+ 'instructions' => __('The format displayed when editing a post','acf'),
+ 'type' => 'radio',
+ 'name' => 'display_format',
+ 'other_choice' => 1,
+ 'choices' => array(
+ 'd/m/Y' => '' . $d_m_Y . ' d/m/Y',
+ 'm/d/Y' => '' . $m_d_Y . ' m/d/Y',
+ 'F j, Y' => '' . $F_j_Y . ' F j, Y',
+ 'other' => '' . __('Custom:','acf') . ' '
+ )
+ ));
+
+
+ // save_format - compatibility with ACF < 5.0.0
+ if( !empty($field['save_format']) ) {
+
+ // save_format
+ acf_render_field_setting( $field, array(
+ 'label' => __('Save Format','acf'),
+ 'instructions' => __('The format used when saving a value','acf'),
+ 'type' => 'text',
+ 'name' => 'save_format',
+ //'readonly' => 1 // this setting was not readonly in v4
+ ));
+
+ } else {
+
+ // return_format
+ acf_render_field_setting( $field, array(
+ 'label' => __('Return Format','acf'),
+ 'instructions' => __('The format returned via template functions','acf'),
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'other_choice' => 1,
+ 'choices' => array(
+ 'd/m/Y' => '' . $d_m_Y . ' d/m/Y',
+ 'm/d/Y' => '' . $m_d_Y . ' m/d/Y',
+ 'F j, Y' => '' . $F_j_Y . ' F j, Y',
+ 'Ymd' => '' . $Ymd . ' Ymd',
+ 'other' => '' . __('Custom:','acf') . ' '
+ )
+ ));
+
+ }
+
+
+ // first_day
+ acf_render_field_setting( $field, array(
+ 'label' => __('Week Starts On','acf'),
+ 'instructions' => '',
+ 'type' => 'select',
+ 'name' => 'first_day',
+ 'choices' => array_values( $wp_locale->weekday )
+ ));
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // save_format - compatibility with ACF < 5.0.0
+ if( !empty($field['save_format']) ) {
+
+ return $value;
+
+ }
+
+
+ // return
+ return acf_format_date( $value, $field['return_format'] );
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_date_picker' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-date_time_picker.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-date_time_picker.php
new file mode 100644
index 0000000..c1ded2b
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-date_time_picker.php
@@ -0,0 +1,255 @@
+name = 'date_time_picker';
+ $this->label = __("Date Time Picker",'acf');
+ $this->category = 'jquery';
+ $this->defaults = array(
+ 'display_format' => 'd/m/Y g:i a',
+ 'return_format' => 'd/m/Y g:i a',
+ 'first_day' => 1
+ );
+ $this->l10n = array(
+ 'timeOnlyTitle' => _x('Choose Time', 'Date Time Picker JS timeOnlyTitle', 'acf'),
+ 'timeText' => _x('Time', 'Date Time Picker JS timeText', 'acf'),
+ 'hourText' => _x('Hour', 'Date Time Picker JS hourText', 'acf'),
+ 'minuteText' => _x('Minute', 'Date Time Picker JS minuteText', 'acf'),
+ 'secondText' => _x('Second', 'Date Time Picker JS secondText', 'acf'),
+ 'millisecText' => _x('Millisecond', 'Date Time Picker JS millisecText', 'acf'),
+ 'microsecText' => _x('Microsecond', 'Date Time Picker JS microsecText', 'acf'),
+ 'timezoneText' => _x('Time Zone', 'Date Time Picker JS timezoneText', 'acf'),
+ 'currentText' => _x('Now', 'Date Time Picker JS currentText', 'acf'),
+ 'closeText' => _x('Done', 'Date Time Picker JS closeText', 'acf'),
+ 'selectText' => _x('Select', 'Date Time Picker JS selectText', 'acf'),
+ 'amNames' => array(
+ _x('AM', 'Date Time Picker JS amText', 'acf'),
+ _x('A', 'Date Time Picker JS amTextShort', 'acf'),
+ ),
+ 'pmNames' => array(
+ _x('PM', 'Date Time Picker JS pmText', 'acf'),
+ _x('P', 'Date Time Picker JS pmTextShort', 'acf'),
+ )
+ );
+
+ }
+
+
+ /*
+ * input_admin_enqueue_scripts
+ *
+ * description
+ *
+ * @type function
+ * @date 16/12/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function input_admin_enqueue_scripts() {
+
+ // bail ealry if no enqueue
+ if( !acf_get_setting('enqueue_datetimepicker') ) return;
+
+
+ // vars
+ $version = '1.6.1';
+
+
+ // script
+ wp_enqueue_script('acf-timepicker', acf_get_dir('assets/inc/timepicker/jquery-ui-timepicker-addon.min.js'), array('jquery-ui-datepicker'), $version);
+
+
+ // style
+ wp_enqueue_style('acf-timepicker', acf_get_dir('assets/inc/timepicker/jquery-ui-timepicker-addon.min.css'), '', $version);
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // format value
+ $hidden_value = '';
+ $display_value = '';
+
+ if( $field['value'] ) {
+
+ $hidden_value = acf_format_date( $field['value'], 'Y-m-d H:i:s' );
+ $display_value = acf_format_date( $field['value'], $field['display_format'] );
+
+ }
+
+
+ // convert display_format to date and time
+ // the letter 'm' is used for date and minute in JS, so this must be done here in PHP
+ $formats = acf_split_date_time($field['display_format']);
+
+
+ // vars
+ $div = array(
+ 'class' => 'acf-date-time-picker acf-input-wrap',
+ 'data-date_format' => acf_convert_date_to_js($formats['date']),
+ 'data-time_format' => acf_convert_time_to_js($formats['time']),
+ 'data-first_day' => $field['first_day'],
+ );
+
+ $hidden_input = array(
+ 'id' => $field['id'],
+ 'class' => 'input-alt',
+ 'name' => $field['name'],
+ 'value' => $hidden_value,
+ );
+
+ $text_input = array(
+ 'class' => 'input',
+ 'value' => $display_value,
+ );
+
+
+ // html
+ ?>
+ >
+
+
+
+ __('Display Format','acf'),
+ 'instructions' => __('The format displayed when editing a post','acf'),
+ 'type' => 'radio',
+ 'name' => 'display_format',
+ 'other_choice' => 1,
+ 'choices' => array(
+ 'd/m/Y g:i a' => '' . $d_m_Y . ' d/m/Y g:i a',
+ 'm/d/Y g:i a' => '' . $m_d_Y . ' m/d/Y g:i a',
+ 'F j, Y g:i a' => '' . $F_j_Y . ' F j, Y g:i a',
+ 'Y-m-d H:i:s' => '' . $Ymd . ' Y-m-d H:i:s',
+ 'other' => '' . __('Custom:','acf') . ' '
+ )
+ ));
+
+
+ // return_format
+ acf_render_field_setting( $field, array(
+ 'label' => __('Return Format','acf'),
+ 'instructions' => __('The format returned via template functions','acf'),
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'other_choice' => 1,
+ 'choices' => array(
+ 'd/m/Y g:i a' => '' . $d_m_Y . ' d/m/Y g:i a',
+ 'm/d/Y g:i a' => '' . $m_d_Y . ' m/d/Y g:i a',
+ 'F j, Y g:i a' => '' . $F_j_Y . ' F j, Y g:i a',
+ 'Y-m-d H:i:s' => '' . $Ymd . ' Y-m-d H:i:s',
+ 'other' => '' . __('Custom:','acf') . ' '
+ )
+ ));
+
+
+ // first_day
+ acf_render_field_setting( $field, array(
+ 'label' => __('Week Starts On','acf'),
+ 'instructions' => '',
+ 'type' => 'select',
+ 'name' => 'first_day',
+ 'choices' => array_values( $wp_locale->weekday )
+ ));
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ return acf_format_date( $value, $field['return_format'] );
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_date_and_time_picker' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-email.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-email.php
new file mode 100644
index 0000000..38101f3
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-email.php
@@ -0,0 +1,161 @@
+name = 'email';
+ $this->label = __("Email",'acf');
+ $this->defaults = array(
+ 'default_value' => '',
+ 'placeholder' => '',
+ 'prepend' => '',
+ 'append' => ''
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $atts = array();
+ $keys = array( 'type', 'id', 'class', 'name', 'value', 'placeholder', 'pattern' );
+ $keys2 = array( 'readonly', 'disabled', 'required' );
+ $html = '';
+
+
+ // prepend
+ if( $field['prepend'] !== '' ) {
+
+ $field['class'] .= ' acf-is-prepended';
+ $html .= '' . acf_esc_html($field['prepend']) . '
';
+
+ }
+
+
+ // append
+ if( $field['append'] !== '' ) {
+
+ $field['class'] .= ' acf-is-appended';
+ $html .= '' . acf_esc_html($field['append']) . '
';
+
+ }
+
+
+ // atts (value="123")
+ foreach( $keys as $k ) {
+ if( isset($field[ $k ]) ) $atts[ $k ] = $field[ $k ];
+ }
+
+
+ // atts2 (disabled="disabled")
+ foreach( $keys2 as $k ) {
+ if( !empty($field[ $k ]) ) $atts[ $k ] = $k;
+ }
+
+
+ // remove empty atts
+ $atts = acf_clean_atts( $atts );
+
+
+ // render
+ $html .= '' . acf_get_text_input( $atts ) . '
';
+
+
+ // return
+ echo $html;
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_settings( $field ) {
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => __('Appears when creating a new post','acf'),
+ 'type' => 'text',
+ 'name' => 'default_value',
+ ));
+
+
+ // placeholder
+ acf_render_field_setting( $field, array(
+ 'label' => __('Placeholder Text','acf'),
+ 'instructions' => __('Appears within the input','acf'),
+ 'type' => 'text',
+ 'name' => 'placeholder',
+ ));
+
+
+ // prepend
+ acf_render_field_setting( $field, array(
+ 'label' => __('Prepend','acf'),
+ 'instructions' => __('Appears before the input','acf'),
+ 'type' => 'text',
+ 'name' => 'prepend',
+ ));
+
+
+ // append
+ acf_render_field_setting( $field, array(
+ 'label' => __('Append','acf'),
+ 'instructions' => __('Appears after the input','acf'),
+ 'type' => 'text',
+ 'name' => 'append',
+ ));
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_email' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-file.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-file.php
new file mode 100644
index 0000000..1f395c1
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-file.php
@@ -0,0 +1,445 @@
+name = 'file';
+ $this->label = __("File",'acf');
+ $this->category = 'content';
+ $this->defaults = array(
+ 'return_format' => 'array',
+ 'library' => 'all',
+ 'min_size' => 0,
+ 'max_size' => 0,
+ 'mime_types' => ''
+ );
+ $this->l10n = array(
+ 'select' => __("Select File",'acf'),
+ 'edit' => __("Edit File",'acf'),
+ 'update' => __("Update File",'acf'),
+ 'uploadedTo' => __("Uploaded to this post",'acf'),
+ );
+
+
+ // filters
+ add_filter('get_media_item_args', array($this, 'get_media_item_args'));
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $uploader = acf_get_setting('uploader');
+
+
+ // allow custom uploader
+ $uploader = acf_maybe_get($field, 'uploader', $uploader);
+
+
+ // enqueue
+ if( $uploader == 'wp' ) {
+ acf_enqueue_uploader();
+ }
+
+
+ // vars
+ $o = array(
+ 'icon' => '',
+ 'title' => '',
+ 'url' => '',
+ 'filesize' => '',
+ 'filename' => '',
+ );
+
+ $div = array(
+ 'class' => 'acf-file-uploader',
+ 'data-library' => $field['library'],
+ 'data-mime_types' => $field['mime_types'],
+ 'data-uploader' => $uploader
+ );
+
+
+ // has value?
+ if( $field['value'] ) {
+
+ $file = get_post( $field['value'] );
+
+ if( $file ) {
+
+ $o['icon'] = wp_mime_type_icon( $file->ID );
+ $o['title'] = $file->post_title;
+ $o['filesize'] = @size_format(filesize( get_attached_file( $file->ID ) ));
+ $o['url'] = wp_get_attachment_url( $file->ID );
+
+ $explode = explode('/', $o['url']);
+ $o['filename'] = end( $explode );
+
+ }
+
+
+ // url exists
+ if( $o['url'] ) {
+ $div['class'] .= ' has-value';
+ }
+
+ }
+
+?>
+>
+ $field['name'], 'value' => $field['value'], 'data-name' => 'id' )); ?>
+
+
+
+
+
+
+
+
+
+ :
+
+
+
+ :
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $field['name'], 'id' => $field['id'] )); ?>
+
+
+
+
+
+
+
+
+
+
+ __('Return Value','acf'),
+ 'instructions' => __('Specify the returned value on front end','acf'),
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'array' => __("File Array",'acf'),
+ 'url' => __("File URL",'acf'),
+ 'id' => __("File ID",'acf')
+ )
+ ));
+
+
+ // library
+ acf_render_field_setting( $field, array(
+ 'label' => __('Library','acf'),
+ 'instructions' => __('Limit the media library choice','acf'),
+ 'type' => 'radio',
+ 'name' => 'library',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'all' => __('All', 'acf'),
+ 'uploadedTo' => __('Uploaded to post', 'acf')
+ )
+ ));
+
+
+ // min
+ acf_render_field_setting( $field, array(
+ 'label' => __('Minimum','acf'),
+ 'instructions' => __('Restrict which files can be uploaded','acf'),
+ 'type' => 'text',
+ 'name' => 'min_size',
+ 'prepend' => __('File size', 'acf'),
+ 'append' => 'MB',
+ ));
+
+
+ // max
+ acf_render_field_setting( $field, array(
+ 'label' => __('Maximum','acf'),
+ 'instructions' => __('Restrict which files can be uploaded','acf'),
+ 'type' => 'text',
+ 'name' => 'max_size',
+ 'prepend' => __('File size', 'acf'),
+ 'append' => 'MB',
+ ));
+
+
+ // allowed type
+ acf_render_field_setting( $field, array(
+ 'label' => __('Allowed file types','acf'),
+ 'instructions' => __('Comma separated list. Leave blank for all types','acf'),
+ 'type' => 'text',
+ 'name' => 'mime_types',
+ ));
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // bail early if no value
+ if( empty($value) ) return false;
+
+
+ // bail early if not numeric (error message)
+ if( !is_numeric($value) ) return false;
+
+
+ // convert to int
+ $value = intval($value);
+
+
+ // format
+ if( $field['return_format'] == 'url' ) {
+
+ return wp_get_attachment_url($value);
+
+ } elseif( $field['return_format'] == 'array' ) {
+
+ return acf_get_attachment( $value );
+ }
+
+
+ // return
+ return $value;
+ }
+
+
+ /*
+ * get_media_item_args
+ *
+ * description
+ *
+ * @type function
+ * @date 27/01/13
+ * @since 3.6.0
+ *
+ * @param $vars (array)
+ * @return $vars
+ */
+
+ function get_media_item_args( $vars ) {
+
+ $vars['send'] = true;
+ return($vars);
+
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $post_id - the $post_id of which the value will be saved
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // bail early if is empty
+ if( empty($value) ) return false;
+
+
+ // validate
+ if( is_array($value) && isset($value['ID']) ) {
+
+ $value = $value['ID'];
+
+ } elseif( is_object($value) && isset($value->ID) ) {
+
+ $value = $value->ID;
+
+ }
+
+
+ // bail early if not attachment ID
+ if( !$value || !is_numeric($value) ) return false;
+
+
+ // confirm type
+ $value = (int) $value;
+
+
+ // maybe connect attacment to post
+ acf_connect_attachment_to_post( $value, $post_id );
+
+
+ // return
+ return $value;
+
+ }
+
+
+
+ /*
+ * validate_value
+ *
+ * This function will validate a basic file input
+ *
+ * @type function
+ * @date 11/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function validate_value( $valid, $value, $field, $input ){
+
+ // bail early if empty
+ if( empty($value) ) return $valid;
+
+
+ // bail ealry if is numeric
+ if( is_numeric($value) ) return $valid;
+
+
+ // bail ealry if not basic string
+ if( !is_string($value) ) return $valid;
+
+
+ // decode value
+ $file = null;
+ parse_str($value, $file);
+
+
+ // bail early if no attachment
+ if( empty($file) ) return $valid;
+
+
+ // get errors
+ $errors = acf_validate_attachment( $file, $field, 'basic_upload' );
+
+
+ // append error
+ if( !empty($errors) ) {
+
+ $valid = implode("\n", $errors);
+
+ }
+
+
+ // return
+ return $valid;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_file' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-google-map.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-google-map.php
new file mode 100644
index 0000000..6fbcc48
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-google-map.php
@@ -0,0 +1,314 @@
+name = 'google_map';
+ $this->label = __("Google Map",'acf');
+ $this->category = 'jquery';
+ $this->defaults = array(
+ 'height' => '',
+ 'center_lat' => '',
+ 'center_lng' => '',
+ 'zoom' => ''
+ );
+ $this->default_values = array(
+ 'height' => '400',
+ 'center_lat' => '-37.81411',
+ 'center_lng' => '144.96328',
+ 'zoom' => '14'
+ );
+ $this->l10n = array(
+ 'locating' => __("Locating",'acf'),
+ 'browser_support' => __("Sorry, this browser does not support geolocation",'acf'),
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // validate value
+ if( empty($field['value']) ) {
+ $field['value'] = array();
+ }
+
+
+ // value
+ $field['value'] = wp_parse_args($field['value'], array(
+ 'address' => '',
+ 'lat' => '',
+ 'lng' => ''
+ ));
+
+
+ // default options
+ foreach( $this->default_values as $k => $v ) {
+
+ if( empty($field[ $k ]) ) {
+ $field[ $k ] = $v;
+ }
+
+ }
+
+
+ // vars
+ $atts = array(
+ 'id' => $field['id'],
+ 'class' => "acf-google-map {$field['class']}",
+ 'data-lat' => $field['center_lat'],
+ 'data-lng' => $field['center_lng'],
+ 'data-zoom' => $field['zoom'],
+ );
+
+
+ // has value
+ if( $field['value']['address'] ) {
+ $atts['class'] .= ' -value';
+ }
+
+?>
+>
+
+
+ $v ):
+ acf_hidden_input(array( 'name' => $field['name'].'['.$k.']', 'value' => $v, 'class' => 'input-'.$k ));
+ endforeach; ?>
+
+
+
+
+
+
+
" value="" />
+
+
+
+
+
+
+
+ __('Center','acf'),
+ 'instructions' => __('Center the initial map','acf'),
+ 'type' => 'text',
+ 'name' => 'center_lat',
+ 'prepend' => 'lat',
+ 'placeholder' => $this->default_values['center_lat']
+ ));
+
+
+ // center_lng
+ acf_render_field_setting( $field, array(
+ 'label' => __('Center','acf'),
+ 'instructions' => __('Center the initial map','acf'),
+ 'type' => 'text',
+ 'name' => 'center_lng',
+ 'prepend' => 'lng',
+ 'placeholder' => $this->default_values['center_lng'],
+ '_append' => 'center_lat'
+ ));
+
+
+ // zoom
+ acf_render_field_setting( $field, array(
+ 'label' => __('Zoom','acf'),
+ 'instructions' => __('Set the initial zoom level','acf'),
+ 'type' => 'text',
+ 'name' => 'zoom',
+ 'placeholder' => $this->default_values['zoom']
+ ));
+
+
+ // allow_null
+ acf_render_field_setting( $field, array(
+ 'label' => __('Height','acf'),
+ 'instructions' => __('Customise the map height','acf'),
+ 'type' => 'text',
+ 'name' => 'height',
+ 'append' => 'px',
+ 'placeholder' => $this->default_values['height']
+ ));
+
+ }
+
+
+ /*
+ * validate_value
+ *
+ * description
+ *
+ * @type function
+ * @date 11/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function validate_value( $valid, $value, $field, $input ){
+
+ // bail early if not required
+ if( ! $field['required'] ) {
+
+ return $valid;
+
+ }
+
+
+ if( empty($value) || empty($value['lat']) || empty($value['lng']) ) {
+
+ return false;
+
+ }
+
+
+ // return
+ return $valid;
+
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $post_id - the $post_id of which the value will be saved
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ if( empty($value) || empty($value['lat']) || empty($value['lng']) ) {
+
+ return false;
+
+ }
+
+
+ // return
+ return $value;
+ }
+
+
+ /*
+ * input_admin_footer
+ *
+ * description
+ *
+ * @type function
+ * @date 6/03/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function input_admin_footer() {
+
+ // bail ealry if no qneueu
+ if( !acf_get_setting('enqueue_google_maps') ) return;
+
+
+ // vars
+ $api = array(
+ 'key' => acf_get_setting('google_api_key'),
+ 'client' => acf_get_setting('google_api_client'),
+ 'libraries' => 'places',
+ 'ver' => 3,
+ 'callback' => ''
+ );
+
+
+ // filter
+ $api = apply_filters('acf/fields/google_map/api', $api);
+
+
+ // remove empty
+ if( empty($api['key']) ) unset($api['key']);
+ if( empty($api['client']) ) unset($api['client']);
+
+
+ // construct url
+ $url = add_query_arg($api, 'https://maps.googleapis.com/maps/api/js');
+
+?>
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-group.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-group.php
new file mode 100644
index 0000000..96bbabf
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-group.php
@@ -0,0 +1,656 @@
+name = 'group';
+ $this->label = __("Group",'acf');
+ $this->category = 'layout';
+ $this->defaults = array(
+ 'sub_fields' => array(),
+ 'layout' => 'block'
+ );
+ $this->have_rows = 'single';
+
+
+ // field filters
+ $this->add_field_filter('acf/prepare_field_for_export', array($this, 'prepare_field_for_export'));
+ $this->add_field_filter('acf/prepare_field_for_import', array($this, 'prepare_field_for_import'));
+
+ }
+
+
+ /*
+ * load_field()
+ *
+ * This filter is appied to the $field after it is loaded from the database
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - the field array holding all the field options
+ *
+ * @return $field - the field array holding all the field options
+ */
+
+ function load_field( $field ) {
+
+ // vars
+ $sub_fields = acf_get_fields( $field );
+
+
+ // append
+ if( $sub_fields ) {
+
+ $field['sub_fields'] = $sub_fields;
+
+ }
+
+
+ // return
+ return $field;
+
+ }
+
+
+ /*
+ * load_value()
+ *
+ * This filter is applied to the $value after it is loaded from the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value found in the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ * @return $value
+ */
+
+ function load_value( $value, $post_id, $field ) {
+
+ // bail early if no sub fields
+ if( empty($field['sub_fields']) ) return $value;
+
+
+ // modify names
+ $field = $this->prepare_field_for_db( $field );
+
+
+ // load sub fields
+ $value = array();
+
+
+ // loop
+ foreach( $field['sub_fields'] as $sub_field ) {
+
+ // load
+ $value[ $sub_field['key'] ] = acf_get_value( $post_id, $sub_field );
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // bail early if no value
+ if( empty($value) ) return false;
+
+
+ // modify names
+ $field = $this->prepare_field_for_db( $field );
+
+
+ // loop
+ foreach( $field['sub_fields'] as $sub_field ) {
+
+ // extract value
+ $sub_value = acf_extract_var( $value, $sub_field['key'] );
+
+
+ // format value
+ $sub_value = acf_format_value( $sub_value, $post_id, $sub_field );
+
+
+ // append to $row
+ $value[ $sub_field['_name'] ] = $sub_value;
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $field - the field array holding all the field options
+ * @param $post_id - the $post_id of which the value will be saved
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // bail early if no value
+ if( !acf_is_array($value) ) return null;
+
+
+ // bail ealry if no sub fields
+ if( empty($field['sub_fields']) ) return null;
+
+
+ // modify names
+ $field = $this->prepare_field_for_db( $field );
+
+
+ // loop
+ foreach( $field['sub_fields'] as $sub_field ) {
+
+ // vars
+ $v = false;
+
+
+ // key (backend)
+ if( isset($value[ $sub_field['key'] ]) ) {
+
+ $v = $value[ $sub_field['key'] ];
+
+ // name (frontend)
+ } elseif( isset($value[ $sub_field['_name'] ]) ) {
+
+ $v = $value[ $sub_field['_name'] ];
+
+ // empty
+ } else {
+
+ // input is not set (hidden by conditioanl logic)
+ continue;
+
+ }
+
+
+ // update value
+ acf_update_value( $v, $post_id, $sub_field );
+
+ }
+
+
+ // return
+ return '';
+
+ }
+
+
+ /*
+ * prepare_field_for_db
+ *
+ * This function will modify sub fields ready for update / load
+ *
+ * @type function
+ * @date 4/11/16
+ * @since 5.5.0
+ *
+ * @param $field (array)
+ * @return $field
+ */
+
+ function prepare_field_for_db( $field ) {
+
+ // bail early if no sub fields
+ if( empty($field['sub_fields']) ) return $field;
+
+
+ // loop
+ foreach( $field['sub_fields'] as &$sub_field ) {
+
+ // prefix name
+ $sub_field['name'] = $field['name'] . '_' . $sub_field['_name'];
+
+ }
+
+
+ // return
+ return $field;
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // bail early if no sub fields
+ if( empty($field['sub_fields']) ) return;
+
+
+ // load values
+ foreach( $field['sub_fields'] as &$sub_field ) {
+
+ // add value
+ if( isset($field['value'][ $sub_field['key'] ]) ) {
+
+ // this is a normal value
+ $sub_field['value'] = $field['value'][ $sub_field['key'] ];
+
+ } elseif( isset($sub_field['default_value']) ) {
+
+ // no value, but this sub field has a default value
+ $sub_field['value'] = $sub_field['default_value'];
+
+ }
+
+
+ // update prefix to allow for nested values
+ $sub_field['prefix'] = $field['name'];
+
+
+ // restore required
+ if( $field['required'] ) $sub_field['required'] = 0;
+
+ }
+
+
+ // render
+ if( $field['layout'] == 'table' ) {
+
+ $this->render_field_table( $field );
+
+ } else {
+
+ $this->render_field_block( $field );
+
+ }
+
+ }
+
+
+ /*
+ * render_field_block
+ *
+ * description
+ *
+ * @type function
+ * @date 12/07/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function render_field_block( $field ) {
+
+ // vars
+ $label_placement = ($field['layout'] == 'block') ? 'top' : 'left';
+
+
+ // html
+ echo '';
+
+ foreach( $field['sub_fields'] as $sub_field ) {
+
+ acf_render_field_wrap( $sub_field );
+
+ }
+
+ echo '
';
+
+ }
+
+
+ /*
+ * render_field_table
+ *
+ * description
+ *
+ * @type function
+ * @date 12/07/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function render_field_table( $field ) {
+
+?>
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+ $field['sub_fields'],
+ 'parent' => $field['ID']
+ );
+
+
+ ?>
+
+
+
+
+
+
+
+ __('Layout','acf'),
+ 'instructions' => __('Specify the style used to render the selected fields', 'acf'),
+ 'type' => 'radio',
+ 'name' => 'layout',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'block' => __('Block','acf'),
+ 'table' => __('Table','acf'),
+ 'row' => __('Row','acf')
+ )
+ ));
+
+ }
+
+
+ /*
+ * validate_value
+ *
+ * description
+ *
+ * @type function
+ * @date 11/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function validate_value( $valid, $value, $field, $input ){
+
+ // bail early if no $value
+ if( empty($value) ) return $valid;
+
+
+ // bail early if no sub fields
+ if( empty($field['sub_fields']) ) return $valid;
+
+
+ // loop
+ foreach( $field['sub_fields'] as $sub_field ) {
+
+ // get sub field
+ $k = $sub_field['key'];
+
+
+ // bail early if value not set (conditional logic?)
+ if( !isset($value[ $k ]) ) continue;
+
+
+ // required
+ if( $field['required'] ) {
+ $sub_field['required'] = 1;
+ }
+
+
+ // validate
+ acf_validate_value( $value[ $k ], $sub_field, "{$input}[{$k}]" );
+
+ }
+
+
+ // return
+ return $valid;
+
+ }
+
+
+ /*
+ * duplicate_field()
+ *
+ * This filter is appied to the $field before it is duplicated and saved to the database
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - the field array holding all the field options
+ *
+ * @return $field - the modified field
+ */
+
+ function duplicate_field( $field ) {
+
+ // get sub fields
+ $sub_fields = acf_extract_var( $field, 'sub_fields' );
+
+
+ // save field to get ID
+ $field = acf_update_field( $field );
+
+
+ // duplicate sub fields
+ acf_duplicate_fields( $sub_fields, $field['ID'] );
+
+
+ // return
+ return $field;
+
+ }
+
+
+ /*
+ * prepare_field_for_export
+ *
+ * description
+ *
+ * @type function
+ * @date 11/03/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function prepare_field_for_export( $field ) {
+
+ // bail early if no sub fields
+ if( empty($field['sub_fields']) ) return $field;
+
+
+ // prepare
+ $field['sub_fields'] = acf_prepare_fields_for_export( $field['sub_fields'] );
+
+
+ // return
+ return $field;
+
+ }
+
+
+ /*
+ * prepare_field_for_import
+ *
+ * description
+ *
+ * @type function
+ * @date 11/03/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function prepare_field_for_import( $field ) {
+
+ // bail early if no sub fields
+ if( empty($field['sub_fields']) ) return $field;
+
+
+ // vars
+ $sub_fields = $field['sub_fields'];
+
+
+ // reset field setting
+ $field['sub_fields'] = array();
+
+
+ // loop
+ foreach( $sub_fields as &$sub_field ) {
+
+ $sub_field['parent'] = $field['key'];
+
+ }
+
+
+ // merge
+ array_unshift($sub_fields, $field);
+
+
+ // return
+ return $sub_fields;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field__group' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-image.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-image.php
new file mode 100644
index 0000000..0f0a898
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-image.php
@@ -0,0 +1,472 @@
+name = 'image';
+ $this->label = __("Image",'acf');
+ $this->category = 'content';
+ $this->defaults = array(
+ 'return_format' => 'array',
+ 'preview_size' => 'thumbnail',
+ 'library' => 'all',
+ 'min_width' => 0,
+ 'min_height' => 0,
+ 'min_size' => 0,
+ 'max_width' => 0,
+ 'max_height' => 0,
+ 'max_size' => 0,
+ 'mime_types' => ''
+ );
+ $this->l10n = array(
+ 'select' => __("Select Image",'acf'),
+ 'edit' => __("Edit Image",'acf'),
+ 'update' => __("Update Image",'acf'),
+ 'uploadedTo' => __("Uploaded to this post",'acf'),
+ 'all' => __("All images",'acf'),
+ );
+
+
+ // filters
+ add_filter('get_media_item_args', array($this, 'get_media_item_args'));
+ add_filter('wp_prepare_attachment_for_js', array($this, 'wp_prepare_attachment_for_js'), 10, 3);
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $uploader = acf_get_setting('uploader');
+
+
+ // enqueue
+ if( $uploader == 'wp' ) {
+ acf_enqueue_uploader();
+ }
+
+
+ // vars
+ $url = '';
+ $alt = '';
+ $div = array(
+ 'class' => 'acf-image-uploader',
+ 'data-preview_size' => $field['preview_size'],
+ 'data-library' => $field['library'],
+ 'data-mime_types' => $field['mime_types'],
+ 'data-uploader' => $uploader
+ );
+
+
+ // has value?
+ if( $field['value'] ) {
+
+ // update vars
+ $url = wp_get_attachment_image_src($field['value'], $field['preview_size']);
+ $alt = get_post_meta($field['value'], '_wp_attachment_image_alt', true);
+
+
+ // url exists
+ if( $url ) $url = $url[0];
+
+
+ // url exists
+ if( $url ) {
+ $div['class'] .= ' has-value';
+ }
+
+ }
+
+
+ // get size of preview value
+ $size = acf_get_image_size($field['preview_size']);
+
+?>
+>
+ $field['name'], 'value' => $field['value'] )); ?>
+
style="">
+
+
+
+
+
+
+
+
+
+
+
+ $field['name'], 'id' => $field['id'] )); ?>
+
+
+
+
+
+
+
+
+
+ __('Return Value','acf'),
+ 'instructions' => __('Specify the returned value on front end','acf'),
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'array' => __("Image Array",'acf'),
+ 'url' => __("Image URL",'acf'),
+ 'id' => __("Image ID",'acf')
+ )
+ ));
+
+
+ // preview_size
+ acf_render_field_setting( $field, array(
+ 'label' => __('Preview Size','acf'),
+ 'instructions' => __('Shown when entering data','acf'),
+ 'type' => 'select',
+ 'name' => 'preview_size',
+ 'choices' => acf_get_image_sizes()
+ ));
+
+
+ // library
+ acf_render_field_setting( $field, array(
+ 'label' => __('Library','acf'),
+ 'instructions' => __('Limit the media library choice','acf'),
+ 'type' => 'radio',
+ 'name' => 'library',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'all' => __('All', 'acf'),
+ 'uploadedTo' => __('Uploaded to post', 'acf')
+ )
+ ));
+
+
+ // min
+ acf_render_field_setting( $field, array(
+ 'label' => __('Minimum','acf'),
+ 'instructions' => __('Restrict which images can be uploaded','acf'),
+ 'type' => 'text',
+ 'name' => 'min_width',
+ 'prepend' => __('Width', 'acf'),
+ 'append' => 'px',
+ ));
+
+ acf_render_field_setting( $field, array(
+ 'label' => '',
+ 'type' => 'text',
+ 'name' => 'min_height',
+ 'prepend' => __('Height', 'acf'),
+ 'append' => 'px',
+ '_append' => 'min_width'
+ ));
+
+ acf_render_field_setting( $field, array(
+ 'label' => '',
+ 'type' => 'text',
+ 'name' => 'min_size',
+ 'prepend' => __('File size', 'acf'),
+ 'append' => 'MB',
+ '_append' => 'min_width'
+ ));
+
+
+ // max
+ acf_render_field_setting( $field, array(
+ 'label' => __('Maximum','acf'),
+ 'instructions' => __('Restrict which images can be uploaded','acf'),
+ 'type' => 'text',
+ 'name' => 'max_width',
+ 'prepend' => __('Width', 'acf'),
+ 'append' => 'px',
+ ));
+
+ acf_render_field_setting( $field, array(
+ 'label' => '',
+ 'type' => 'text',
+ 'name' => 'max_height',
+ 'prepend' => __('Height', 'acf'),
+ 'append' => 'px',
+ '_append' => 'max_width'
+ ));
+
+ acf_render_field_setting( $field, array(
+ 'label' => '',
+ 'type' => 'text',
+ 'name' => 'max_size',
+ 'prepend' => __('File size', 'acf'),
+ 'append' => 'MB',
+ '_append' => 'max_width'
+ ));
+
+
+ // allowed type
+ acf_render_field_setting( $field, array(
+ 'label' => __('Allowed file types','acf'),
+ 'instructions' => __('Comma separated list. Leave blank for all types','acf'),
+ 'type' => 'text',
+ 'name' => 'mime_types',
+ ));
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // bail early if no value
+ if( empty($value) ) return false;
+
+
+ // bail early if not numeric (error message)
+ if( !is_numeric($value) ) return false;
+
+
+ // convert to int
+ $value = intval($value);
+
+
+ // format
+ if( $field['return_format'] == 'url' ) {
+
+ return wp_get_attachment_url( $value );
+
+ } elseif( $field['return_format'] == 'array' ) {
+
+ return acf_get_attachment( $value );
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * get_media_item_args
+ *
+ * description
+ *
+ * @type function
+ * @date 27/01/13
+ * @since 3.6.0
+ *
+ * @param $vars (array)
+ * @return $vars
+ */
+
+ function get_media_item_args( $vars ) {
+
+ $vars['send'] = true;
+ return($vars);
+
+ }
+
+
+ /*
+ * wp_prepare_attachment_for_js
+ *
+ * this filter allows ACF to add in extra data to an attachment JS object
+ * This sneaky hook adds the missing sizes to each attachment in the 3.5 uploader.
+ * It would be a lot easier to add all the sizes to the 'image_size_names_choose' filter but
+ * then it will show up on the normal the_content editor
+ *
+ * @type function
+ * @since: 3.5.7
+ * @date 13/01/13
+ *
+ * @param {int} $post_id
+ * @return {int} $post_id
+ */
+
+ function wp_prepare_attachment_for_js( $response, $attachment, $meta ) {
+
+ // only for image
+ if( $response['type'] != 'image' ) {
+
+ return $response;
+
+ }
+
+
+ // make sure sizes exist. Perhaps they dont?
+ if( !isset($meta['sizes']) ) {
+
+ return $response;
+
+ }
+
+
+ $attachment_url = $response['url'];
+ $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
+
+ if( isset($meta['sizes']) && is_array($meta['sizes']) ) {
+
+ foreach( $meta['sizes'] as $k => $v ) {
+
+ if( !isset($response['sizes'][ $k ]) ) {
+
+ $response['sizes'][ $k ] = array(
+ 'height' => $v['height'],
+ 'width' => $v['width'],
+ 'url' => $base_url . $v['file'],
+ 'orientation' => $v['height'] > $v['width'] ? 'portrait' : 'landscape',
+ );
+ }
+
+ }
+
+ }
+
+ return $response;
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $post_id - the $post_id of which the value will be saved
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ return acf_get_field_type('file')->update_value( $value, $post_id, $field );
+
+ }
+
+
+ /*
+ * validate_value
+ *
+ * This function will validate a basic file input
+ *
+ * @type function
+ * @date 11/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function validate_value( $valid, $value, $field, $input ){
+
+ return acf_get_field_type('file')->validate_value( $valid, $value, $field, $input );
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_image' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-link.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-link.php
new file mode 100644
index 0000000..5df5818
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-link.php
@@ -0,0 +1,292 @@
+name = 'link';
+ $this->label = __("Link",'acf');
+ $this->category = 'relational';
+ $this->defaults = array(
+ 'return_format' => 'array',
+ );
+
+ }
+
+
+ /*
+ * get_link
+ *
+ * description
+ *
+ * @type function
+ * @date 16/5/17
+ * @since 5.5.13
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function get_link( $value = '' ) {
+
+ // vars
+ $link = array(
+ 'title' => '',
+ 'url' => '',
+ 'target' => ''
+ );
+
+
+ // array (ACF 5.6.0)
+ if( is_array($value) ) {
+
+ $link = array_merge($link, $value);
+
+ // post id (ACF < 5.6.0)
+ } elseif( is_numeric($value) ) {
+
+ $link['title'] = get_the_title( $value );
+ $link['url'] = get_permalink( $value );
+
+ // string (ACF < 5.6.0)
+ } elseif( is_string($value) ) {
+
+ $link['url'] = $value;
+
+ }
+
+
+ // return
+ return $link;
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ){
+
+ // vars
+ $div = array(
+ 'id' => $field['id'],
+ 'class' => $field['class'] . ' acf-link',
+ );
+
+
+ // render scripts/styles
+ acf_enqueue_uploader();
+
+
+ // get link
+ $link = $this->get_link( $field['value'] );
+
+
+ // classes
+ if( $link['url'] ) {
+ $div['class'] .= ' -value';
+ }
+
+ if( $link['target'] === '_blank' ) {
+ $div['class'] .= ' -external';
+ }
+
+ /**/
+?>
+>
+
+
+
+ $v ): ?>
+ "input-$k", 'name' => $field['name'] . "[$k]", 'value' => $v )); ?>
+
+
+
+
+
+
+
+
+ __('Return Value','acf'),
+ 'instructions' => __('Specify the returned value on front end','acf'),
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'array' => __("Link Array",'acf'),
+ 'url' => __("Link URL",'acf'),
+ )
+ ));
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // bail early if no value
+ if( empty($value) ) return $value;
+
+
+ // get link
+ $link = $this->get_link( $value );
+
+
+ // format value
+ if( $field['return_format'] == 'url' ) {
+
+ return $link['url'];
+
+ }
+
+
+ // return link
+ return $link;
+
+ }
+
+
+ /*
+ * validate_value
+ *
+ * description
+ *
+ * @type function
+ * @date 11/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function validate_value( $valid, $value, $field, $input ){
+
+ // bail early if not required
+ if( !$field['required'] ) return $valid;
+
+
+ // URL is required
+ if( empty($value) || empty($value['url']) ) {
+
+ return false;
+
+ }
+
+
+ // return
+ return $valid;
+
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $post_id - the $post_id of which the value will be saved
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // URL is required
+ if( empty($value) || empty($value['url']) ) {
+
+ return false;
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_link' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-message.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-message.php
new file mode 100644
index 0000000..0180ff0
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-message.php
@@ -0,0 +1,200 @@
+name = 'message';
+ $this->label = __("Message",'acf');
+ $this->category = 'layout';
+ $this->defaults = array(
+ 'message' => '',
+ 'esc_html' => 0,
+ 'new_lines' => 'wpautop',
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $m = $field['message'];
+
+
+ // wptexturize (improves "quotes")
+ $m = wptexturize( $m );
+
+
+ // esc_html
+ if( $field['esc_html'] ) {
+
+ $m = esc_html( $m );
+
+ }
+
+
+ // new lines
+ if( $field['new_lines'] == 'wpautop' ) {
+
+ $m = wpautop($m);
+
+ } elseif( $field['new_lines'] == 'br' ) {
+
+ $m = nl2br($m);
+
+ }
+
+
+ // return
+ echo acf_esc_html( $m );
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field_settings( $field ) {
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Message','acf'),
+ 'instructions' => '',
+ 'type' => 'textarea',
+ 'name' => 'message',
+ ));
+
+
+ // formatting
+ acf_render_field_setting( $field, array(
+ 'label' => __('New Lines','acf'),
+ 'instructions' => __('Controls how new lines are rendered','acf'),
+ 'type' => 'select',
+ 'name' => 'new_lines',
+ 'choices' => array(
+ 'wpautop' => __("Automatically add paragraphs",'acf'),
+ 'br' => __("Automatically add <br>",'acf'),
+ '' => __("No Formatting",'acf')
+ )
+ ));
+
+
+ // HTML
+ acf_render_field_setting( $field, array(
+ 'label' => __('Escape HTML','acf'),
+ 'instructions' => __('Allow HTML markup to display as visible text instead of rendering','acf'),
+ 'name' => 'esc_html',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+ }
+
+
+ /*
+ * translate_field
+ *
+ * This function will translate field settings
+ *
+ * @type function
+ * @date 8/03/2016
+ * @since 5.3.2
+ *
+ * @param $field (array)
+ * @return $field
+ */
+
+ function translate_field( $field ) {
+
+ // translate
+ $field['message'] = acf_translate( $field['message'] );
+
+
+ // return
+ return $field;
+
+ }
+
+
+ /*
+ * load_field()
+ *
+ * This filter is appied to the $field after it is loaded from the database
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - the field array holding all the field options
+ *
+ * @return $field - the field array holding all the field options
+ */
+
+ function load_field( $field ) {
+
+ // remove name to avoid caching issue
+ $field['name'] = '';
+
+
+ // remove required to avoid JS issues
+ $field['required'] = 0;
+
+
+ // set value other than 'null' to avoid ACF loading / caching issue
+ $field['value'] = false;
+
+
+ // return
+ return $field;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_message' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-number.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-number.php
new file mode 100644
index 0000000..0395471
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-number.php
@@ -0,0 +1,304 @@
+name = 'number';
+ $this->label = __("Number",'acf');
+ $this->defaults = array(
+ 'default_value' => '',
+ 'min' => '',
+ 'max' => '',
+ 'step' => '',
+ 'placeholder' => '',
+ 'prepend' => '',
+ 'append' => ''
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $atts = array();
+ $keys = array( 'type', 'id', 'class', 'name', 'value', 'min', 'max', 'step', 'placeholder', 'pattern' );
+ $keys2 = array( 'readonly', 'disabled', 'required' );
+ $html = '';
+
+
+ // step
+ if( !$field['step'] ) {
+ $field['step'] = 'any';
+ }
+
+
+ // prepend
+ if( $field['prepend'] !== '' ) {
+
+ $field['class'] .= ' acf-is-prepended';
+ $html .= '' . acf_esc_html($field['prepend']) . '
';
+
+ }
+
+
+ // append
+ if( $field['append'] !== '' ) {
+
+ $field['class'] .= ' acf-is-appended';
+ $html .= '' . acf_esc_html($field['append']) . '
';
+
+ }
+
+
+ // atts (value="123")
+ foreach( $keys as $k ) {
+ if( isset($field[ $k ]) ) $atts[ $k ] = $field[ $k ];
+ }
+
+
+ // atts2 (disabled="disabled")
+ foreach( $keys2 as $k ) {
+ if( !empty($field[ $k ]) ) $atts[ $k ] = $k;
+ }
+
+
+ // remove empty atts
+ $atts = acf_clean_atts( $atts );
+
+
+ // render
+ $html .= '' . acf_get_text_input( $atts ) . '
';
+
+
+ // return
+ echo $html;
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_settings( $field ) {
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => __('Appears when creating a new post','acf'),
+ 'type' => 'text',
+ 'name' => 'default_value',
+ ));
+
+
+ // placeholder
+ acf_render_field_setting( $field, array(
+ 'label' => __('Placeholder Text','acf'),
+ 'instructions' => __('Appears within the input','acf'),
+ 'type' => 'text',
+ 'name' => 'placeholder',
+ ));
+
+
+ // prepend
+ acf_render_field_setting( $field, array(
+ 'label' => __('Prepend','acf'),
+ 'instructions' => __('Appears before the input','acf'),
+ 'type' => 'text',
+ 'name' => 'prepend',
+ ));
+
+
+ // append
+ acf_render_field_setting( $field, array(
+ 'label' => __('Append','acf'),
+ 'instructions' => __('Appears after the input','acf'),
+ 'type' => 'text',
+ 'name' => 'append',
+ ));
+
+
+ // min
+ acf_render_field_setting( $field, array(
+ 'label' => __('Minimum Value','acf'),
+ 'instructions' => '',
+ 'type' => 'number',
+ 'name' => 'min',
+ ));
+
+
+ // max
+ acf_render_field_setting( $field, array(
+ 'label' => __('Maximum Value','acf'),
+ 'instructions' => '',
+ 'type' => 'number',
+ 'name' => 'max',
+ ));
+
+
+ // max
+ acf_render_field_setting( $field, array(
+ 'label' => __('Step Size','acf'),
+ 'instructions' => '',
+ 'type' => 'number',
+ 'name' => 'step',
+ ));
+
+ }
+
+
+ /*
+ * validate_value
+ *
+ * description
+ *
+ * @type function
+ * @date 11/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function validate_value( $valid, $value, $field, $input ){
+
+ // remove ','
+ if( acf_str_exists(',', $value) ) {
+
+ $value = str_replace(',', '', $value);
+
+ }
+
+
+ // if value is not numeric...
+ if( !is_numeric($value) ) {
+
+ // allow blank to be saved
+ if( !empty($value) ) {
+
+ $valid = __('Value must be a number', 'acf');
+
+ }
+
+
+ // return early
+ return $valid;
+
+ }
+
+
+ // convert
+ $value = floatval($value);
+
+
+ // min
+ if( is_numeric($field['min']) && $value < floatval($field['min'])) {
+
+ $valid = sprintf(__('Value must be equal to or higher than %d', 'acf'), $field['min'] );
+
+ }
+
+
+ // max
+ if( is_numeric($field['max']) && $value > floatval($field['max']) ) {
+
+ $valid = sprintf(__('Value must be equal to or lower than %d', 'acf'), $field['max'] );
+
+ }
+
+
+ // return
+ return $valid;
+
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $field - the field array holding all the field options
+ * @param $post_id - the $post_id of which the value will be saved
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // no formatting needed for empty value
+ if( empty($value) ) {
+
+ return $value;
+
+ }
+
+
+ // remove ','
+ if( acf_str_exists(',', $value) ) {
+
+ $value = str_replace(',', '', $value);
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_number' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php
new file mode 100644
index 0000000..1452c08
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php
@@ -0,0 +1,333 @@
+name = 'oembed';
+ $this->label = __("oEmbed",'acf');
+ $this->category = 'content';
+ $this->defaults = array(
+ 'width' => '',
+ 'height' => '',
+ );
+ $this->width = 640;
+ $this->height = 390;
+
+
+ // extra
+ add_action('wp_ajax_acf/fields/oembed/search', array($this, 'ajax_query'));
+ add_action('wp_ajax_nopriv_acf/fields/oembed/search', array($this, 'ajax_query'));
+
+ }
+
+
+ /*
+ * prepare_field
+ *
+ * This function will prepare the field for input
+ *
+ * @type function
+ * @date 14/2/17
+ * @since 5.5.8
+ *
+ * @param $field (array)
+ * @return (int)
+ */
+
+ function prepare_field( $field ) {
+
+ // defaults
+ if( !$field['width'] ) $field['width'] = $this->width;
+ if( !$field['height'] ) $field['height'] = $this->height;
+
+
+ // return
+ return $field;
+
+ }
+
+
+ /*
+ * wp_oembed_get
+ *
+ * description
+ *
+ * @type function
+ * @date 24/01/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function wp_oembed_get( $url = '', $width = 0, $height = 0 ) {
+
+ // vars
+ $embed = '';
+ $res = array(
+ 'width' => $width,
+ 'height' => $height
+ );
+
+
+ // get emebed
+ $embed = @wp_oembed_get( $url, $res );
+
+
+ // try shortcode
+ if( !$embed ) {
+
+ // global
+ global $wp_embed;
+
+
+ // get emebed
+ $embed = $wp_embed->shortcode($res, $url);
+
+ }
+
+
+ // return
+ return $embed;
+ }
+
+
+ /*
+ * ajax_query
+ *
+ * description
+ *
+ * @type function
+ * @date 24/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function ajax_query() {
+
+ // validate
+ if( !acf_verify_ajax() ) die();
+
+
+ // get choices
+ $response = $this->get_ajax_query( $_POST );
+
+
+ // return
+ wp_send_json($response);
+
+ }
+
+
+ /*
+ * get_ajax_query
+ *
+ * This function will return an array of data formatted for use in a select2 AJAX response
+ *
+ * @type function
+ * @date 15/10/2014
+ * @since 5.0.9
+ *
+ * @param $options (array)
+ * @return (array)
+ */
+
+ function get_ajax_query( $args = array() ) {
+
+ // defaults
+ $args = acf_parse_args($args, array(
+ 's' => '',
+ 'field_key' => '',
+ ));
+
+
+ // load field
+ $field = acf_get_field( $args['field_key'] );
+ if( !$field ) return false;
+
+
+ // prepare field to correct width and height
+ $field = $this->prepare_field($field);
+
+
+ // vars
+ $response = array(
+ 'url' => $args['s'],
+ 'html' => $this->wp_oembed_get($args['s'], $field['width'], $field['height'])
+ );
+
+
+ // return
+ return $response;
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // atts
+ $atts = array(
+ 'class' => 'acf-oembed',
+ );
+
+
+ // value
+ if( $field['value'] ) $atts['class'] .= ' has-value';
+
+?>
+>
+ $field['name'], 'value' => $field['value'], 'data-name' => 'value-input' )); ?>
+
+
+
+
+
+
+
+ " autocomplete="off" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ wp_oembed_get($field['value'], $field['width'], $field['height']); ?>
+
+
+
+
+
+
+ __('Embed Size','acf'),
+ 'type' => 'text',
+ 'name' => 'width',
+ 'prepend' => __('Width', 'acf'),
+ 'append' => 'px',
+ 'placeholder' => $this->width
+ ));
+
+
+ // height
+ acf_render_field_setting( $field, array(
+ 'label' => __('Embed Size','acf'),
+ 'type' => 'text',
+ 'name' => 'height',
+ 'prepend' => __('Height', 'acf'),
+ 'append' => 'px',
+ 'placeholder' => $this->height,
+ '_append' => 'width'
+ ));
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // bail early if no value
+ if( empty($value) ) return $value;
+
+
+ // prepare field to correct width and height
+ $field = $this->prepare_field($field);
+
+
+ // get oembed
+ $value = $this->wp_oembed_get($value, $field['width'], $field['height']);
+
+
+ // return
+ return $value;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_oembed' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-output.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-output.php
new file mode 100644
index 0000000..25ff37c
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-output.php
@@ -0,0 +1,77 @@
+name = 'output';
+ $this->label = 'output';
+ $this->public = false;
+ $this->defaults = array(
+ 'html' => false
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field (array) the $field being rendered
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field (array) the $field being edited
+ * @return n/a
+ */
+
+ function render_field( $field ) {
+
+ // bail early if no html
+ if( !$field['html'] ) return;
+
+
+ // html
+ if( is_string($field['html']) && !function_exists($field['html']) ) {
+
+ echo $field['html'];
+
+ // function
+ } else {
+
+ call_user_func_array($field['html'], array($field));
+
+ }
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_output' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-page_link.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-page_link.php
new file mode 100644
index 0000000..8d6c0be
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-page_link.php
@@ -0,0 +1,680 @@
+name = 'page_link';
+ $this->label = __("Page Link",'acf');
+ $this->category = 'relational';
+ $this->defaults = array(
+ 'post_type' => array(),
+ 'taxonomy' => array(),
+ 'allow_null' => 0,
+ 'multiple' => 0,
+ 'allow_archives' => 1
+ );
+
+
+ // extra
+ add_action('wp_ajax_acf/fields/page_link/query', array($this, 'ajax_query'));
+ add_action('wp_ajax_nopriv_acf/fields/page_link/query', array($this, 'ajax_query'));
+
+ }
+
+
+ /*
+ * ajax_query
+ *
+ * description
+ *
+ * @type function
+ * @date 24/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function ajax_query() {
+
+ // validate
+ if( !acf_verify_ajax() ) die();
+
+
+ // defaults
+ $options = acf_parse_args($_POST, array(
+ 'post_id' => 0,
+ 's' => '',
+ 'field_key' => '',
+ 'paged' => 1
+ ));
+
+
+ // vars
+ $results = array();
+ $args = array();
+ $s = false;
+ $is_search = false;
+
+
+ // paged
+ $args['posts_per_page'] = 20;
+ $args['paged'] = $options['paged'];
+
+
+ // search
+ if( $options['s'] !== '' ) {
+
+ // strip slashes (search may be integer)
+ $s = wp_unslash( strval($options['s']) );
+
+
+ // update vars
+ $args['s'] = $s;
+ $is_search = true;
+
+ }
+
+
+ // load field
+ $field = acf_get_field( $options['field_key'] );
+ if( !$field ) die();
+
+
+ // update $args
+ if( !empty($field['post_type']) ) {
+
+ $args['post_type'] = acf_get_array( $field['post_type'] );
+
+ } else {
+
+ $args['post_type'] = acf_get_post_types();
+
+ }
+
+ // create tax queries
+ if( !empty($field['taxonomy']) ) {
+
+ // append to $args
+ $args['tax_query'] = array();
+
+
+ // decode terms
+ $taxonomies = acf_decode_taxonomy_terms( $field['taxonomy'] );
+
+
+ // now create the tax queries
+ foreach( $taxonomies as $taxonomy => $terms ) {
+
+ $args['tax_query'][] = array(
+ 'taxonomy' => $taxonomy,
+ 'field' => 'slug',
+ 'terms' => $terms,
+ );
+
+ }
+ }
+
+
+ // filters
+ $args = apply_filters('acf/fields/page_link/query', $args, $field, $options['post_id']);
+ $args = apply_filters('acf/fields/page_link/query/name=' . $field['name'], $args, $field, $options['post_id'] );
+ $args = apply_filters('acf/fields/page_link/query/key=' . $field['key'], $args, $field, $options['post_id'] );
+
+
+ // add archives to $results
+ if( $field['allow_archives'] && $args['paged'] == 1 ) {
+
+ $archives = array();
+ $archives[] = array(
+ 'id' => home_url(),
+ 'text' => home_url()
+ );
+
+ foreach( $args['post_type'] as $post_type ) {
+
+ // vars
+ $archive_link = get_post_type_archive_link( $post_type );
+
+
+ // bail ealry if no link
+ if( !$archive_link ) continue;
+
+
+ // bail early if no search match
+ if( $is_search && stripos($archive_link, $s) === false ) continue;
+
+
+ // append
+ $archives[] = array(
+ 'id' => $archive_link,
+ 'text' => $archive_link
+ );
+
+ }
+
+
+ // append
+ $results[] = array(
+ 'text' => __('Archives', 'acf'),
+ 'children' => $archives
+ );
+
+ }
+
+
+ // get posts grouped by post type
+ $groups = acf_get_grouped_posts( $args );
+
+
+ // loop
+ if( !empty($groups) ) {
+
+ foreach( array_keys($groups) as $group_title ) {
+
+ // vars
+ $posts = acf_extract_var( $groups, $group_title );
+
+
+ // data
+ $data = array(
+ 'text' => $group_title,
+ 'children' => array()
+ );
+
+
+ // convert post objects to post titles
+ foreach( array_keys($posts) as $post_id ) {
+
+ $posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'], $is_search );
+
+ }
+
+
+ // order posts by search
+ if( $is_search && empty($args['orderby']) ) {
+
+ $posts = acf_order_by_search( $posts, $args['s'] );
+
+ }
+
+
+ // append to $data
+ foreach( array_keys($posts) as $post_id ) {
+
+ $data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ]);
+
+ }
+
+
+ // append to $results
+ $results[] = $data;
+
+ }
+
+ }
+
+
+ // return
+ acf_send_ajax_results(array(
+ 'results' => $results,
+ 'limit' => $args['posts_per_page']
+ ));
+
+ }
+
+
+ /*
+ * get_post_result
+ *
+ * This function will return an array containing id, text and maybe description data
+ *
+ * @type function
+ * @date 7/07/2016
+ * @since 5.4.0
+ *
+ * @param $id (mixed)
+ * @param $text (string)
+ * @return (array)
+ */
+
+ function get_post_result( $id, $text ) {
+
+ // vars
+ $result = array(
+ 'id' => $id,
+ 'text' => $text
+ );
+
+
+ // look for parent
+ $search = '| ' . __('Parent', 'acf') . ':';
+ $pos = strpos($text, $search);
+
+ if( $pos !== false ) {
+
+ $result['description'] = substr($text, $pos+2);
+ $result['text'] = substr($text, 0, $pos);
+
+ }
+
+
+ // return
+ return $result;
+
+ }
+
+
+ /*
+ * get_post_title
+ *
+ * This function returns the HTML for a result
+ *
+ * @type function
+ * @date 1/11/2013
+ * @since 5.0.0
+ *
+ * @param $post (object)
+ * @param $field (array)
+ * @param $post_id (int) the post_id to which this value is saved to
+ * @return (string)
+ */
+
+ function get_post_title( $post, $field, $post_id = 0, $is_search = 0 ) {
+
+ // get post_id
+ if( !$post_id ) $post_id = acf_get_form_data('post_id');
+
+
+ // vars
+ $title = acf_get_post_title( $post, $is_search );
+
+
+ // filters
+ $title = apply_filters('acf/fields/page_link/result', $title, $post, $field, $post_id);
+ $title = apply_filters('acf/fields/page_link/result/name=' . $field['_name'], $title, $post, $field, $post_id);
+ $title = apply_filters('acf/fields/page_link/result/key=' . $field['key'], $title, $post, $field, $post_id);
+
+
+ // return
+ return $title;
+
+ }
+
+
+ /*
+ * get_posts
+ *
+ * This function will return an array of posts for a given field value
+ *
+ * @type function
+ * @date 13/06/2014
+ * @since 5.0.0
+ *
+ * @param $value (array)
+ * @return $value
+ */
+
+ function get_posts( $value, $field ) {
+
+ // force value to array
+ $value = acf_get_array( $value );
+
+
+ // get selected post ID's
+ $post__in = array();
+
+ foreach( $value as $k => $v ) {
+
+ if( is_numeric($v) ) {
+
+ // append to $post__in
+ $post__in[] = (int) $v;
+
+ }
+
+ }
+
+
+ // bail early if no posts
+ if( empty($post__in) ) {
+
+ return $value;
+
+ }
+
+
+ // get posts
+ $posts = acf_get_posts(array(
+ 'post__in' => $post__in,
+ 'post_type' => $field['post_type']
+ ));
+
+
+ // override value with post
+ $return = array();
+
+
+ // append to $return
+ foreach( $value as $k => $v ) {
+
+ if( is_numeric($v) ) {
+
+ // extract first post
+ $post = array_shift( $posts );
+
+
+ // append
+ if( $post ) {
+
+ $return[] = $post;
+
+ }
+
+ } else {
+
+ $return[] = $v;
+
+ }
+
+ }
+
+
+ // return
+ return $return;
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ){
+
+ // Change Field into a select
+ $field['type'] = 'select';
+ $field['ui'] = 1;
+ $field['ajax'] = 1;
+ $field['choices'] = array();
+
+
+ // populate choices if value exists
+ if( !empty($field['value']) ) {
+
+ // get posts
+ $posts = $this->get_posts( $field['value'], $field );
+
+
+ // set choices
+ if( !empty($posts) ) {
+
+ foreach( array_keys($posts) as $i ) {
+
+ // vars
+ $post = acf_extract_var( $posts, $i );
+
+
+ if( is_object($post) ) {
+
+ // append to choices
+ $field['choices'][ $post->ID ] = $this->get_post_title( $post, $field );
+
+ } else {
+
+ // append to choices
+ $field['choices'][ $post ] = $post;
+
+ }
+
+ }
+
+ }
+
+ }
+
+
+ // render
+ acf_render_field( $field );
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_settings( $field ) {
+
+ // post_type
+ acf_render_field_setting( $field, array(
+ 'label' => __('Filter by Post Type','acf'),
+ 'instructions' => '',
+ 'type' => 'select',
+ 'name' => 'post_type',
+ 'choices' => acf_get_pretty_post_types(),
+ 'multiple' => 1,
+ 'ui' => 1,
+ 'allow_null' => 1,
+ 'placeholder' => __("All post types",'acf'),
+ ));
+
+
+ // taxonomy
+ acf_render_field_setting( $field, array(
+ 'label' => __('Filter by Taxonomy','acf'),
+ 'instructions' => '',
+ 'type' => 'select',
+ 'name' => 'taxonomy',
+ 'choices' => acf_get_taxonomy_terms(),
+ 'multiple' => 1,
+ 'ui' => 1,
+ 'allow_null' => 1,
+ 'placeholder' => __("All taxonomies",'acf'),
+ ));
+
+
+ // allow_null
+ acf_render_field_setting( $field, array(
+ 'label' => __('Allow Null?','acf'),
+ 'instructions' => '',
+ 'name' => 'allow_null',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // allow_archives
+ acf_render_field_setting( $field, array(
+ 'label' => __('Allow Archives URLs','acf'),
+ 'instructions' => '',
+ 'name' => 'allow_archives',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // multiple
+ acf_render_field_setting( $field, array(
+ 'label' => __('Select multiple values?','acf'),
+ 'instructions' => '',
+ 'name' => 'multiple',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // ACF4 null
+ if( $value === 'null' ) {
+
+ return false;
+
+ }
+
+
+ // bail early if no value
+ if( empty($value) ) {
+
+ return $value;
+
+ }
+
+
+ // get posts
+ $value = $this->get_posts( $value, $field );
+
+
+ // set choices
+ foreach( array_keys($value) as $i ) {
+
+ // vars
+ $post = acf_extract_var( $value, $i );
+
+
+ // convert $post to permalink
+ if( is_object($post) ) {
+
+ $post = get_permalink( $post );
+
+ }
+
+
+ // append back to $value
+ $value[ $i ] = $post;
+
+ }
+
+
+ // convert back from array if neccessary
+ if( !$field['multiple'] ) {
+
+ $value = array_shift($value);
+
+ }
+
+
+ // return value
+ return $value;
+
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $post_id - the $post_id of which the value will be saved
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // validate
+ if( empty($value) ) {
+
+ return $value;
+
+ }
+
+
+ // format
+ if( is_array($value) ) {
+
+ // array
+ foreach( $value as $k => $v ){
+
+ // object?
+ if( is_object($v) && isset($v->ID) )
+ {
+ $value[ $k ] = $v->ID;
+ }
+ }
+
+
+ // save value as strings, so we can clearly search for them in SQL LIKE statements
+ $value = array_map('strval', $value);
+
+ } elseif( is_object($value) && isset($value->ID) ) {
+
+ // object
+ $value = $value->ID;
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_page_link' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-password.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-password.php
new file mode 100644
index 0000000..cb0efe2
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-password.php
@@ -0,0 +1,104 @@
+name = 'password';
+ $this->label = __("Password",'acf');
+ $this->defaults = array(
+ 'placeholder' => '',
+ 'prepend' => '',
+ 'append' => '',
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ acf_get_field_type('text')->render_field( $field );
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_settings( $field ) {
+
+ // placeholder
+ acf_render_field_setting( $field, array(
+ 'label' => __('Placeholder Text','acf'),
+ 'instructions' => __('Appears within the input','acf'),
+ 'type' => 'text',
+ 'name' => 'placeholder',
+ ));
+
+
+ // prepend
+ acf_render_field_setting( $field, array(
+ 'label' => __('Prepend','acf'),
+ 'instructions' => __('Appears before the input','acf'),
+ 'type' => 'text',
+ 'name' => 'prepend',
+ ));
+
+
+ // append
+ acf_render_field_setting( $field, array(
+ 'label' => __('Append','acf'),
+ 'instructions' => __('Appears after the input','acf'),
+ 'type' => 'text',
+ 'name' => 'append',
+ ));
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_password' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-post_object.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-post_object.php
new file mode 100644
index 0000000..e6ae01c
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-post_object.php
@@ -0,0 +1,623 @@
+name = 'post_object';
+ $this->label = __("Post Object",'acf');
+ $this->category = 'relational';
+ $this->defaults = array(
+ 'post_type' => array(),
+ 'taxonomy' => array(),
+ 'allow_null' => 0,
+ 'multiple' => 0,
+ 'return_format' => 'object',
+ 'ui' => 1,
+ );
+
+
+ // extra
+ add_action('wp_ajax_acf/fields/post_object/query', array($this, 'ajax_query'));
+ add_action('wp_ajax_nopriv_acf/fields/post_object/query', array($this, 'ajax_query'));
+
+ }
+
+
+ /*
+ * ajax_query
+ *
+ * description
+ *
+ * @type function
+ * @date 24/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function ajax_query() {
+
+ // validate
+ if( !acf_verify_ajax() ) die();
+
+
+ // get choices
+ $response = $this->get_ajax_query( $_POST );
+
+
+ // return
+ acf_send_ajax_results($response);
+
+ }
+
+
+ /*
+ * get_ajax_query
+ *
+ * This function will return an array of data formatted for use in a select2 AJAX response
+ *
+ * @type function
+ * @date 15/10/2014
+ * @since 5.0.9
+ *
+ * @param $options (array)
+ * @return (array)
+ */
+
+ function get_ajax_query( $options = array() ) {
+
+ // defaults
+ $options = acf_parse_args($options, array(
+ 'post_id' => 0,
+ 's' => '',
+ 'field_key' => '',
+ 'paged' => 1
+ ));
+
+
+ // load field
+ $field = acf_get_field( $options['field_key'] );
+ if( !$field ) return false;
+
+
+ // vars
+ $results = array();
+ $args = array();
+ $s = false;
+ $is_search = false;
+
+
+ // paged
+ $args['posts_per_page'] = 20;
+ $args['paged'] = $options['paged'];
+
+
+ // search
+ if( $options['s'] !== '' ) {
+
+ // strip slashes (search may be integer)
+ $s = wp_unslash( strval($options['s']) );
+
+
+ // update vars
+ $args['s'] = $s;
+ $is_search = true;
+
+ }
+
+
+ // post_type
+ if( !empty($field['post_type']) ) {
+
+ $args['post_type'] = acf_get_array( $field['post_type'] );
+
+ } else {
+
+ $args['post_type'] = acf_get_post_types();
+
+ }
+
+
+ // taxonomy
+ if( !empty($field['taxonomy']) ) {
+
+ // vars
+ $terms = acf_decode_taxonomy_terms( $field['taxonomy'] );
+
+
+ // append to $args
+ $args['tax_query'] = array();
+
+
+ // now create the tax queries
+ foreach( $terms as $k => $v ) {
+
+ $args['tax_query'][] = array(
+ 'taxonomy' => $k,
+ 'field' => 'slug',
+ 'terms' => $v,
+ );
+
+ }
+
+ }
+
+
+ // filters
+ $args = apply_filters('acf/fields/post_object/query', $args, $field, $options['post_id']);
+ $args = apply_filters('acf/fields/post_object/query/name=' . $field['name'], $args, $field, $options['post_id'] );
+ $args = apply_filters('acf/fields/post_object/query/key=' . $field['key'], $args, $field, $options['post_id'] );
+
+
+ // get posts grouped by post type
+ $groups = acf_get_grouped_posts( $args );
+
+
+ // bail early if no posts
+ if( empty($groups) ) return false;
+
+
+ // loop
+ foreach( array_keys($groups) as $group_title ) {
+
+ // vars
+ $posts = acf_extract_var( $groups, $group_title );
+
+
+ // data
+ $data = array(
+ 'text' => $group_title,
+ 'children' => array()
+ );
+
+
+ // convert post objects to post titles
+ foreach( array_keys($posts) as $post_id ) {
+
+ $posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'], $is_search );
+
+ }
+
+
+ // order posts by search
+ if( $is_search && empty($args['orderby']) ) {
+
+ $posts = acf_order_by_search( $posts, $args['s'] );
+
+ }
+
+
+ // append to $data
+ foreach( array_keys($posts) as $post_id ) {
+
+ $data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ]);
+
+ }
+
+
+ // append to $results
+ $results[] = $data;
+
+ }
+
+
+ // optgroup or single
+ if( count($args['post_type']) == 1 ) {
+
+ $results = $results[0]['children'];
+
+ }
+
+
+ // vars
+ $response = array(
+ 'results' => $results,
+ 'limit' => $args['posts_per_page']
+ );
+
+
+ // return
+ return $response;
+
+ }
+
+
+ /*
+ * get_post_result
+ *
+ * This function will return an array containing id, text and maybe description data
+ *
+ * @type function
+ * @date 7/07/2016
+ * @since 5.4.0
+ *
+ * @param $id (mixed)
+ * @param $text (string)
+ * @return (array)
+ */
+
+ function get_post_result( $id, $text ) {
+
+ // vars
+ $result = array(
+ 'id' => $id,
+ 'text' => $text
+ );
+
+
+ // look for parent
+ $search = '| ' . __('Parent', 'acf') . ':';
+ $pos = strpos($text, $search);
+
+ if( $pos !== false ) {
+
+ $result['description'] = substr($text, $pos+2);
+ $result['text'] = substr($text, 0, $pos);
+
+ }
+
+
+ // return
+ return $result;
+
+ }
+
+
+ /*
+ * get_post_title
+ *
+ * This function returns the HTML for a result
+ *
+ * @type function
+ * @date 1/11/2013
+ * @since 5.0.0
+ *
+ * @param $post (object)
+ * @param $field (array)
+ * @param $post_id (int) the post_id to which this value is saved to
+ * @return (string)
+ */
+
+ function get_post_title( $post, $field, $post_id = 0, $is_search = 0 ) {
+
+ // get post_id
+ if( !$post_id ) $post_id = acf_get_form_data('post_id');
+
+
+ // vars
+ $title = acf_get_post_title( $post, $is_search );
+
+
+ // filters
+ $title = apply_filters('acf/fields/post_object/result', $title, $post, $field, $post_id);
+ $title = apply_filters('acf/fields/post_object/result/name=' . $field['_name'], $title, $post, $field, $post_id);
+ $title = apply_filters('acf/fields/post_object/result/key=' . $field['key'], $title, $post, $field, $post_id);
+
+
+ // return
+ return $title;
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // Change Field into a select
+ $field['type'] = 'select';
+ $field['ui'] = 1;
+ $field['ajax'] = 1;
+ $field['choices'] = array();
+
+
+ // load posts
+ $posts = $this->get_posts( $field['value'], $field );
+
+ if( $posts ) {
+
+ foreach( array_keys($posts) as $i ) {
+
+ // vars
+ $post = acf_extract_var( $posts, $i );
+
+
+ // append to choices
+ $field['choices'][ $post->ID ] = $this->get_post_title( $post, $field );
+
+ }
+
+ }
+
+
+ // render
+ acf_render_field( $field );
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_settings( $field ) {
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Filter by Post Type','acf'),
+ 'instructions' => '',
+ 'type' => 'select',
+ 'name' => 'post_type',
+ 'choices' => acf_get_pretty_post_types(),
+ 'multiple' => 1,
+ 'ui' => 1,
+ 'allow_null' => 1,
+ 'placeholder' => __("All post types",'acf'),
+ ));
+
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Filter by Taxonomy','acf'),
+ 'instructions' => '',
+ 'type' => 'select',
+ 'name' => 'taxonomy',
+ 'choices' => acf_get_taxonomy_terms(),
+ 'multiple' => 1,
+ 'ui' => 1,
+ 'allow_null' => 1,
+ 'placeholder' => __("All taxonomies",'acf'),
+ ));
+
+
+ // allow_null
+ acf_render_field_setting( $field, array(
+ 'label' => __('Allow Null?','acf'),
+ 'instructions' => '',
+ 'name' => 'allow_null',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // multiple
+ acf_render_field_setting( $field, array(
+ 'label' => __('Select multiple values?','acf'),
+ 'instructions' => '',
+ 'name' => 'multiple',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // return_format
+ acf_render_field_setting( $field, array(
+ 'label' => __('Return Format','acf'),
+ 'instructions' => '',
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'choices' => array(
+ 'object' => __("Post Object",'acf'),
+ 'id' => __("Post ID",'acf'),
+ ),
+ 'layout' => 'horizontal',
+ ));
+
+ }
+
+
+ /*
+ * load_value()
+ *
+ * This filter is applied to the $value after it is loaded from the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value found in the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ * @return $value
+ */
+
+ function load_value( $value, $post_id, $field ) {
+
+ // ACF4 null
+ if( $value === 'null' ) return false;
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // numeric
+ $value = acf_get_numeric($value);
+
+
+ // bail early if no value
+ if( empty($value) ) return false;
+
+
+ // load posts if needed
+ if( $field['return_format'] == 'object' ) {
+
+ $value = $this->get_posts( $value, $field );
+
+ }
+
+
+ // convert back from array if neccessary
+ if( !$field['multiple'] && acf_is_array($value) ) {
+
+ $value = current($value);
+
+ }
+
+
+ // return value
+ return $value;
+
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $post_id - the $post_id of which the value will be saved
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // validate
+ if( empty($value) ) {
+
+ return $value;
+
+ }
+
+
+ // format
+ if( is_array($value) ) {
+
+ // array
+ foreach( $value as $k => $v ){
+
+ // object?
+ if( is_object($v) && isset($v->ID) ) {
+
+ $value[ $k ] = $v->ID;
+
+ }
+
+ }
+
+
+ // save value as strings, so we can clearly search for them in SQL LIKE statements
+ $value = array_map('strval', $value);
+
+ } elseif( is_object($value) && isset($value->ID) ) {
+
+ // object
+ $value = $value->ID;
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * get_posts
+ *
+ * This function will return an array of posts for a given field value
+ *
+ * @type function
+ * @date 13/06/2014
+ * @since 5.0.0
+ *
+ * @param $value (array)
+ * @return $value
+ */
+
+ function get_posts( $value, $field ) {
+
+ // numeric
+ $value = acf_get_numeric($value);
+
+
+ // bail early if no value
+ if( empty($value) ) return false;
+
+
+ // get posts
+ $posts = acf_get_posts(array(
+ 'post__in' => $value,
+ 'post_type' => $field['post_type']
+ ));
+
+
+ // return
+ return $posts;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_post_object' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-radio.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-radio.php
new file mode 100644
index 0000000..0723a09
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-radio.php
@@ -0,0 +1,486 @@
+name = 'radio';
+ $this->label = __("Radio Button",'acf');
+ $this->category = 'choice';
+ $this->defaults = array(
+ 'layout' => 'vertical',
+ 'choices' => array(),
+ 'default_value' => '',
+ 'other_choice' => 0,
+ 'save_other_choice' => 0,
+ 'allow_null' => 0,
+ 'return_format' => 'value'
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field (array) the $field being rendered
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field (array) the $field being edited
+ * @return n/a
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $i = 0;
+ $e = '';
+ $ul = array(
+ 'class' => 'acf-radio-list',
+ 'data-allow_null' => $field['allow_null'],
+ 'data-other_choice' => $field['other_choice']
+ );
+
+
+ // append to class
+ $ul['class'] .= ' ' . ($field['layout'] == 'horizontal' ? 'acf-hl' : 'acf-bl');
+ $ul['class'] .= ' ' . $field['class'];
+
+
+ // select value
+ $checked = '';
+ $value = strval($field['value']);
+
+
+ // selected choice
+ if( isset($field['choices'][ $value ]) ) {
+
+ $checked = $value;
+
+ // custom choice
+ } elseif( $field['other_choice'] && $value !== '' ) {
+
+ $checked = 'other';
+
+ // allow null
+ } elseif( $field['allow_null'] ) {
+
+ // do nothing
+
+ // select first input by default
+ } else {
+
+ $checked = key($field['choices']);
+
+ }
+
+
+ // ensure $checked is a string (could be an int)
+ $checked = strval($checked);
+
+
+ // other choice
+ if( $field['other_choice'] ) {
+
+ // vars
+ $input = array(
+ 'type' => 'text',
+ 'name' => $field['name'],
+ 'value' => '',
+ 'disabled' => 'disabled',
+ 'class' => 'acf-disabled'
+ );
+
+
+ // select other choice if value is not a valid choice
+ if( $checked === 'other' ) {
+
+ unset($input['disabled']);
+ $input['value'] = $field['value'];
+
+ }
+
+
+ // allow custom 'other' choice to be defined
+ if( !isset($field['choices']['other']) ) {
+
+ $field['choices']['other'] = '';
+
+ }
+
+
+ // append other choice
+ $field['choices']['other'] .= '';
+
+ }
+
+
+ // bail early if no choices
+ if( empty($field['choices']) ) return;
+
+
+ // hiden input
+ $e .= acf_get_hidden_input( array('name' => $field['name']) );
+
+
+ // open
+ $e .= '';
+
+
+ // return
+ echo $e;
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_settings( $field ) {
+
+ // encode choices (convert from array)
+ $field['choices'] = acf_encode_choices($field['choices']);
+
+
+ // choices
+ acf_render_field_setting( $field, array(
+ 'label' => __('Choices','acf'),
+ 'instructions' => __('Enter each choice on a new line.','acf') . ' ' . __('For more control, you may specify both a value and label like this:','acf'). ' ' . __('red : Red','acf'),
+ 'type' => 'textarea',
+ 'name' => 'choices',
+ ));
+
+
+ // allow_null
+ acf_render_field_setting( $field, array(
+ 'label' => __('Allow Null?','acf'),
+ 'instructions' => '',
+ 'name' => 'allow_null',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // other_choice
+ acf_render_field_setting( $field, array(
+ 'label' => __('Other','acf'),
+ 'instructions' => '',
+ 'name' => 'other_choice',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ 'message' => __("Add 'other' choice to allow for custom values", 'acf'),
+ ));
+
+
+ // save_other_choice
+ acf_render_field_setting( $field, array(
+ 'label' => __('Save Other','acf'),
+ 'instructions' => '',
+ 'name' => 'save_other_choice',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ 'message' => __("Save 'other' values to the field's choices", 'acf')
+ ));
+
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => __('Appears when creating a new post','acf'),
+ 'type' => 'text',
+ 'name' => 'default_value',
+ ));
+
+
+ // layout
+ acf_render_field_setting( $field, array(
+ 'label' => __('Layout','acf'),
+ 'instructions' => '',
+ 'type' => 'radio',
+ 'name' => 'layout',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'vertical' => __("Vertical",'acf'),
+ 'horizontal' => __("Horizontal",'acf')
+ )
+ ));
+
+
+ // return_format
+ acf_render_field_setting( $field, array(
+ 'label' => __('Return Value','acf'),
+ 'instructions' => __('Specify the returned value on front end','acf'),
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'value' => __('Value','acf'),
+ 'label' => __('Label','acf'),
+ 'array' => __('Both (Array)','acf')
+ )
+ ));
+
+ }
+
+
+ /*
+ * update_field()
+ *
+ * This filter is appied to the $field before it is saved to the database
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - the field array holding all the field options
+ * @param $post_id - the field group ID (post_type = acf)
+ *
+ * @return $field - the modified field
+ */
+
+ function update_field( $field ) {
+
+ // decode choices (convert to array)
+ $field['choices'] = acf_decode_choices($field['choices']);
+
+
+ // return
+ return $field;
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ * @todo Fix bug where $field was found via json and has no ID
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $post_id - the $post_id of which the value will be saved
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // bail early if no value (allow 0 to be saved)
+ if( !$value && !is_numeric($value) ) return $value;
+
+
+ // save_other_choice
+ if( $field['save_other_choice'] ) {
+
+ // value isn't in choices yet
+ if( !isset($field['choices'][ $value ]) ) {
+
+ // get raw $field (may have been changed via repeater field)
+ // if field is local, it won't have an ID
+ $selector = $field['ID'] ? $field['ID'] : $field['key'];
+ $field = acf_get_field( $selector, true );
+
+
+ // bail early if no ID (JSON only)
+ if( !$field['ID'] ) return $value;
+
+
+ // unslash (fixes serialize single quote issue)
+ $value = wp_unslash($value);
+
+
+ // sanitize (remove tags)
+ $value = sanitize_text_field($value);
+
+
+ // update $field
+ $field['choices'][ $value ] = $value;
+
+
+ // save
+ acf_update_field( $field );
+
+ }
+
+ }
+
+
+ // return
+ return $value;
+ }
+
+
+ /*
+ * load_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db
+ *
+ * @type filter
+ * @since 5.2.9
+ * @date 23/01/13
+ *
+ * @param $value - the value found in the database
+ * @param $post_id - the $post_id from which the value was loaded from
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the value to be saved in te database
+ */
+
+ function load_value( $value, $post_id, $field ) {
+
+ // must be single value
+ if( is_array($value) ) {
+
+ $value = array_pop($value);
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * translate_field
+ *
+ * This function will translate field settings
+ *
+ * @type function
+ * @date 8/03/2016
+ * @since 5.3.2
+ *
+ * @param $field (array)
+ * @return $field
+ */
+
+ function translate_field( $field ) {
+
+ return acf_get_field_type('select')->translate_field( $field );
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ return acf_get_field_type('select')->format_value( $value, $post_id, $field );
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_radio' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-range.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-range.php
new file mode 100644
index 0000000..7e4ebfd
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-range.php
@@ -0,0 +1,213 @@
+name = 'range';
+ $this->label = __("Range",'acf');
+ $this->defaults = array(
+ 'default_value' => '',
+ 'min' => '',
+ 'max' => '',
+ 'step' => '',
+ 'prepend' => '',
+ 'append' => ''
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $atts = array();
+ $keys = array( 'type', 'id', 'class', 'name', 'value', 'min', 'max', 'step' );
+ $keys2 = array( 'readonly', 'disabled', 'required' );
+ $html = '';
+
+
+ // step
+ if( !$field['step'] ) $field['step'] = 1;
+
+
+ // min / max
+ if( !$field['min'] ) $field['min'] = 0;
+ if( !$field['max'] ) $field['max'] = 100;
+
+
+ // value
+ if( !is_numeric($field['value']) ) {
+ $field['value'] = 0;
+ }
+
+
+ // atts (value="123")
+ foreach( $keys as $k ) {
+ if( isset($field[ $k ]) ) $atts[ $k ] = $field[ $k ];
+ }
+
+
+ // atts2 (disabled="disabled")
+ foreach( $keys2 as $k ) {
+ if( !empty($field[ $k ]) ) $atts[ $k ] = $k;
+ }
+
+
+ // remove empty atts
+ $atts = acf_clean_atts( $atts );
+
+
+ // open
+ $html .= '';
+
+
+ // prepend
+ if( $field['prepend'] !== '' ) {
+ $html .= '
' . acf_esc_html($field['prepend']) . '
';
+ }
+
+
+ // range
+ $html .= acf_get_text_input( $atts );
+
+
+ // input
+ $len = strlen( (string) $field['max'] );
+ $html .= acf_get_text_input(array(
+ 'type' => 'number',
+ 'id' => $atts['id'] . '-alt',
+ 'value' => $atts['value'],
+ 'step' => $atts['step'],
+ 'style' => 'width: ' . (1.8 + $len*0.7) . 'em;'
+ ));
+
+
+ // append
+ if( $field['append'] !== '' ) {
+ $html .= '
' . acf_esc_html($field['append']) . '
';
+ }
+
+
+ // close
+ $html .= '
';
+
+
+ // return
+ echo $html;
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_settings( $field ) {
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => __('Appears when creating a new post','acf'),
+ 'type' => 'number',
+ 'name' => 'default_value',
+ ));
+
+
+ // min
+ acf_render_field_setting( $field, array(
+ 'label' => __('Minimum Value','acf'),
+ 'instructions' => '',
+ 'type' => 'number',
+ 'name' => 'min',
+ 'placeholder' => '0'
+ ));
+
+
+ // max
+ acf_render_field_setting( $field, array(
+ 'label' => __('Maximum Value','acf'),
+ 'instructions' => '',
+ 'type' => 'number',
+ 'name' => 'max',
+ 'placeholder' => '100'
+ ));
+
+
+ // step
+ acf_render_field_setting( $field, array(
+ 'label' => __('Step Size','acf'),
+ 'instructions' => '',
+ 'type' => 'number',
+ 'name' => 'step',
+ 'placeholder' => '1'
+ ));
+
+
+ // prepend
+ acf_render_field_setting( $field, array(
+ 'label' => __('Prepend','acf'),
+ 'instructions' => __('Appears before the input','acf'),
+ 'type' => 'text',
+ 'name' => 'prepend',
+ ));
+
+
+ // append
+ acf_render_field_setting( $field, array(
+ 'label' => __('Append','acf'),
+ 'instructions' => __('Appears after the input','acf'),
+ 'type' => 'text',
+ 'name' => 'append',
+ ));
+
+ }
+
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_range' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-relationship.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-relationship.php
new file mode 100644
index 0000000..b29e5ed
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-relationship.php
@@ -0,0 +1,862 @@
+name = 'relationship';
+ $this->label = __("Relationship",'acf');
+ $this->category = 'relational';
+ $this->defaults = array(
+ 'post_type' => array(),
+ 'taxonomy' => array(),
+ 'min' => 0,
+ 'max' => 0,
+ 'filters' => array('search', 'post_type', 'taxonomy'),
+ 'elements' => array(),
+ 'return_format' => 'object'
+ );
+ $this->l10n = array(
+ 'min' => __("Minimum values reached ( {min} values )",'acf'),
+ 'max' => __("Maximum values reached ( {max} values )",'acf'),
+ 'loading' => __('Loading','acf'),
+ 'empty' => __('No matches found','acf'),
+ );
+
+
+ // extra
+ add_action('wp_ajax_acf/fields/relationship/query', array($this, 'ajax_query'));
+ add_action('wp_ajax_nopriv_acf/fields/relationship/query', array($this, 'ajax_query'));
+
+ }
+
+
+ /*
+ * ajax_query
+ *
+ * description
+ *
+ * @type function
+ * @date 24/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function ajax_query() {
+
+ // validate
+ if( !acf_verify_ajax() ) die();
+
+
+ // get choices
+ $response = $this->get_ajax_query( $_POST );
+
+
+ // return
+ acf_send_ajax_results($response);
+
+ }
+
+
+ /*
+ * get_ajax_query
+ *
+ * This function will return an array of data formatted for use in a select2 AJAX response
+ *
+ * @type function
+ * @date 15/10/2014
+ * @since 5.0.9
+ *
+ * @param $options (array)
+ * @return (array)
+ */
+
+ function get_ajax_query( $options = array() ) {
+
+ // defaults
+ $options = acf_parse_args($options, array(
+ 'post_id' => 0,
+ 's' => '',
+ 'field_key' => '',
+ 'paged' => 1,
+ 'post_type' => '',
+ 'taxonomy' => ''
+ ));
+
+
+ // load field
+ $field = acf_get_field( $options['field_key'] );
+ if( !$field ) return false;
+
+
+ // vars
+ $results = array();
+ $args = array();
+ $s = false;
+ $is_search = false;
+
+
+ // paged
+ $args['posts_per_page'] = 20;
+ $args['paged'] = $options['paged'];
+
+
+ // search
+ if( $options['s'] !== '' ) {
+
+ // strip slashes (search may be integer)
+ $s = wp_unslash( strval($options['s']) );
+
+
+ // update vars
+ $args['s'] = $s;
+ $is_search = true;
+
+ }
+
+
+ // post_type
+ if( !empty($options['post_type']) ) {
+
+ $args['post_type'] = acf_get_array( $options['post_type'] );
+
+ } elseif( !empty($field['post_type']) ) {
+
+ $args['post_type'] = acf_get_array( $field['post_type'] );
+
+ } else {
+
+ $args['post_type'] = acf_get_post_types();
+
+ }
+
+
+ // taxonomy
+ if( !empty($options['taxonomy']) ) {
+
+ // vars
+ $term = acf_decode_taxonomy_term($options['taxonomy']);
+
+
+ // tax query
+ $args['tax_query'] = array();
+
+
+ // append
+ $args['tax_query'][] = array(
+ 'taxonomy' => $term['taxonomy'],
+ 'field' => 'slug',
+ 'terms' => $term['term'],
+ );
+
+
+ } elseif( !empty($field['taxonomy']) ) {
+
+ // vars
+ $terms = acf_decode_taxonomy_terms( $field['taxonomy'] );
+
+
+ // append to $args
+ $args['tax_query'] = array();
+
+
+ // now create the tax queries
+ foreach( $terms as $k => $v ) {
+
+ $args['tax_query'][] = array(
+ 'taxonomy' => $k,
+ 'field' => 'slug',
+ 'terms' => $v,
+ );
+
+ }
+
+ }
+
+
+ // filters
+ $args = apply_filters('acf/fields/relationship/query', $args, $field, $options['post_id']);
+ $args = apply_filters('acf/fields/relationship/query/name=' . $field['name'], $args, $field, $options['post_id'] );
+ $args = apply_filters('acf/fields/relationship/query/key=' . $field['key'], $args, $field, $options['post_id'] );
+
+
+ // get posts grouped by post type
+ $groups = acf_get_grouped_posts( $args );
+
+
+ // bail early if no posts
+ if( empty($groups) ) return false;
+
+
+ // loop
+ foreach( array_keys($groups) as $group_title ) {
+
+ // vars
+ $posts = acf_extract_var( $groups, $group_title );
+
+
+ // data
+ $data = array(
+ 'text' => $group_title,
+ 'children' => array()
+ );
+
+
+ // convert post objects to post titles
+ foreach( array_keys($posts) as $post_id ) {
+
+ $posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'] );
+
+ }
+
+
+ // order posts by search
+ if( $is_search && empty($args['orderby']) ) {
+
+ $posts = acf_order_by_search( $posts, $args['s'] );
+
+ }
+
+
+ // append to $data
+ foreach( array_keys($posts) as $post_id ) {
+
+ $data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ]);
+
+ }
+
+
+ // append to $results
+ $results[] = $data;
+
+ }
+
+
+ // add as optgroup or results
+ if( count($args['post_type']) == 1 ) {
+
+ $results = $results[0]['children'];
+
+ }
+
+
+ // vars
+ $response = array(
+ 'results' => $results,
+ 'limit' => $args['posts_per_page']
+ );
+
+
+ // return
+ return $response;
+
+ }
+
+
+ /*
+ * get_post_result
+ *
+ * This function will return an array containing id, text and maybe description data
+ *
+ * @type function
+ * @date 7/07/2016
+ * @since 5.4.0
+ *
+ * @param $id (mixed)
+ * @param $text (string)
+ * @return (array)
+ */
+
+ function get_post_result( $id, $text ) {
+
+ // vars
+ $result = array(
+ 'id' => $id,
+ 'text' => $text
+ );
+
+
+ // return
+ return $result;
+
+ }
+
+
+ /*
+ * get_post_title
+ *
+ * This function returns the HTML for a result
+ *
+ * @type function
+ * @date 1/11/2013
+ * @since 5.0.0
+ *
+ * @param $post (object)
+ * @param $field (array)
+ * @param $post_id (int) the post_id to which this value is saved to
+ * @return (string)
+ */
+
+ function get_post_title( $post, $field, $post_id = 0, $is_search = 0 ) {
+
+ // get post_id
+ if( !$post_id ) $post_id = acf_get_form_data('post_id');
+
+
+ // vars
+ $title = acf_get_post_title( $post, $is_search );
+
+
+ // featured_image
+ if( acf_in_array('featured_image', $field['elements']) ) {
+
+ // vars
+ $class = 'thumbnail';
+ $thumbnail = acf_get_post_thumbnail($post->ID, array(17, 17));
+
+
+ // icon
+ if( $thumbnail['type'] == 'icon' ) {
+
+ $class .= ' -' . $thumbnail['type'];
+
+ }
+
+
+ // append
+ $title = '' . $thumbnail['html'] . '
' . $title;
+
+ }
+
+
+ // filters
+ $title = apply_filters('acf/fields/relationship/result', $title, $post, $field, $post_id);
+ $title = apply_filters('acf/fields/relationship/result/name=' . $field['_name'], $title, $post, $field, $post_id);
+ $title = apply_filters('acf/fields/relationship/result/key=' . $field['key'], $title, $post, $field, $post_id);
+
+
+ // return
+ return $title;
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $values = array();
+ $atts = array(
+ 'id' => $field['id'],
+ 'class' => "acf-relationship {$field['class']}",
+ 'data-min' => $field['min'],
+ 'data-max' => $field['max'],
+ 'data-s' => '',
+ 'data-post_type' => '',
+ 'data-taxonomy' => '',
+ 'data-paged' => 1,
+ );
+
+
+ // Lang
+ if( defined('ICL_LANGUAGE_CODE') ) {
+
+ $atts['data-lang'] = ICL_LANGUAGE_CODE;
+
+ }
+
+
+ // data types
+ $field['post_type'] = acf_get_array( $field['post_type'] );
+ $field['taxonomy'] = acf_get_array( $field['taxonomy'] );
+ $field['filters'] = acf_get_array( $field['filters'] );
+
+
+ // filters
+ $filters = array(
+ 'count' => count($field['filters']),
+ 'search' => false,
+ 'post_type' => false,
+ 'taxonomy' => false
+ );
+
+ foreach( $field['filters'] as $filter ) {
+ $filters[ $filter ] = true;
+ }
+
+
+ // filter - post_type
+ if( $filters['post_type'] ) {
+
+ // choices
+ $choices = array(
+ '' => __('Select post type', 'acf')
+ );
+
+
+ // get post types
+ $post_types = acf_get_pretty_post_types($field['post_type']);
+
+
+ // append
+ $choices = $choices + $post_types;
+
+
+ // set filter
+ $filters['post_type'] = $choices;
+
+ }
+
+
+
+ // taxonomy filter
+ if( $filters['taxonomy'] ) {
+
+ // vars
+ $groups = array();
+ $taxonomies = array();
+ $choices = array(
+ '' => __('Select taxonomy', 'acf')
+ );
+
+
+ // get taxonomies from setting
+ if( !empty($field['taxonomy']) ) {
+
+ $term_groups = acf_decode_taxonomy_terms( $field['taxonomy'] );
+ $taxonomies = array_keys($term_groups);
+
+ // check empty
+ $taxonomies = empty($taxonomies) ? false : $taxonomies;
+
+ } elseif( !empty($field['post_type']) ) {
+
+ // loop
+ foreach( $field['post_type'] as $post_type ) {
+
+ // get connected taxonomies
+ $post_taxonomies = get_object_taxonomies( $post_type );
+
+
+ // loop
+ foreach( $post_taxonomies as $name ) {
+ $taxonomies[ $name ] = 1;
+ }
+
+ }
+
+
+ // convert back to array
+ $taxonomies = array_keys($taxonomies);
+
+ // check empty
+ $taxonomies = empty($taxonomies) ? false : $taxonomies;
+
+ }
+
+
+ // terms
+ if( $taxonomies !== false ) {
+ $groups = acf_get_taxonomy_terms( $taxonomies );
+ }
+
+
+ // update $term_groups with specific terms
+ if( !empty($field['taxonomy']) ) {
+
+ foreach( $groups as $taxonomy => $terms ) {
+
+ foreach( $terms as $slug => $name ) {
+
+ if( !in_array($slug, $field['taxonomy']) ) {
+
+ unset($groups[ $taxonomy ][ $slug ]);
+
+ }
+
+ }
+
+ }
+
+ }
+
+
+ // append
+ $choices = $choices + $groups;
+
+
+ // set filter
+ $filters['taxonomy'] = $choices;
+
+ }
+
+ ?>
+>
+
+ $field['name'], 'value' => '') ); ?>
+
+
+
+
+
+
+ __("Search...",'acf'), 'data-filter' => 's') ); ?>
+
+
+
+
+
+ $filters['post_type'], 'data-filter' => 'post_type') ); ?>
+
+
+
+
+
+ $filters['taxonomy'], 'data-filter' => 'taxonomy') ); ?>
+
+
+
+
+
+
+
+
+
+
+ $field['value'],
+ 'post_type' => $field['post_type']
+ ));
+
+
+ // loop
+ foreach( $posts as $post ): ?>
+
+ $field['name'].'[]', 'value' => $post->ID) ); ?>
+
+ get_post_title( $post, $field ); ?>
+
+
+
+
+
+
+
+
+
+ __('Filter by Post Type','acf'),
+ 'instructions' => '',
+ 'type' => 'select',
+ 'name' => 'post_type',
+ 'choices' => acf_get_pretty_post_types(),
+ 'multiple' => 1,
+ 'ui' => 1,
+ 'allow_null' => 1,
+ 'placeholder' => __("All post types",'acf'),
+ ));
+
+
+ // taxonomy
+ acf_render_field_setting( $field, array(
+ 'label' => __('Filter by Taxonomy','acf'),
+ 'instructions' => '',
+ 'type' => 'select',
+ 'name' => 'taxonomy',
+ 'choices' => acf_get_taxonomy_terms(),
+ 'multiple' => 1,
+ 'ui' => 1,
+ 'allow_null' => 1,
+ 'placeholder' => __("All taxonomies",'acf'),
+ ));
+
+
+ // filters
+ acf_render_field_setting( $field, array(
+ 'label' => __('Filters','acf'),
+ 'instructions' => '',
+ 'type' => 'checkbox',
+ 'name' => 'filters',
+ 'choices' => array(
+ 'search' => __("Search",'acf'),
+ 'post_type' => __("Post Type",'acf'),
+ 'taxonomy' => __("Taxonomy",'acf'),
+ ),
+ ));
+
+
+ // filters
+ acf_render_field_setting( $field, array(
+ 'label' => __('Elements','acf'),
+ 'instructions' => __('Selected elements will be displayed in each result','acf'),
+ 'type' => 'checkbox',
+ 'name' => 'elements',
+ 'choices' => array(
+ 'featured_image' => __("Featured Image",'acf'),
+ ),
+ ));
+
+
+ // min
+ acf_render_field_setting( $field, array(
+ 'label' => __('Minimum posts','acf'),
+ 'instructions' => '',
+ 'type' => 'number',
+ 'name' => 'min',
+ ));
+
+
+ // max
+ acf_render_field_setting( $field, array(
+ 'label' => __('Maximum posts','acf'),
+ 'instructions' => '',
+ 'type' => 'number',
+ 'name' => 'max',
+ ));
+
+
+
+
+ // return_format
+ acf_render_field_setting( $field, array(
+ 'label' => __('Return Format','acf'),
+ 'instructions' => '',
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'choices' => array(
+ 'object' => __("Post Object",'acf'),
+ 'id' => __("Post ID",'acf'),
+ ),
+ 'layout' => 'horizontal',
+ ));
+
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // bail early if no value
+ if( empty($value) ) {
+
+ return $value;
+
+ }
+
+
+ // force value to array
+ $value = acf_get_array( $value );
+
+
+ // convert to int
+ $value = array_map('intval', $value);
+
+
+ // load posts if needed
+ if( $field['return_format'] == 'object' ) {
+
+ // get posts
+ $value = acf_get_posts(array(
+ 'post__in' => $value,
+ 'post_type' => $field['post_type']
+ ));
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * validate_value
+ *
+ * description
+ *
+ * @type function
+ * @date 11/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function validate_value( $valid, $value, $field, $input ){
+
+ // default
+ if( empty($value) || !is_array($value) ) {
+
+ $value = array();
+
+ }
+
+
+ // min
+ if( count($value) < $field['min'] ) {
+
+ $valid = _n( '%s requires at least %s selection', '%s requires at least %s selections', $field['min'], 'acf' );
+ $valid = sprintf( $valid, $field['label'], $field['min'] );
+
+ }
+
+
+ // return
+ return $valid;
+
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $post_id - the $post_id of which the value will be saved
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // validate
+ if( empty($value) ) {
+
+ return $value;
+
+ }
+
+
+ // force value to array
+ $value = acf_get_array( $value );
+
+
+ // array
+ foreach( $value as $k => $v ){
+
+ // object?
+ if( is_object($v) && isset($v->ID) ) {
+
+ $value[ $k ] = $v->ID;
+
+ }
+
+ }
+
+
+ // save value as strings, so we can clearly search for them in SQL LIKE statements
+ $value = array_map('strval', $value);
+
+
+ // return
+ return $value;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_relationship' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-select.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-select.php
new file mode 100644
index 0000000..1e83bd0
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-select.php
@@ -0,0 +1,642 @@
+name = 'select';
+ $this->label = _x('Select', 'noun', 'acf');
+ $this->category = 'choice';
+ $this->defaults = array(
+ 'multiple' => 0,
+ 'allow_null' => 0,
+ 'choices' => array(),
+ 'default_value' => '',
+ 'ui' => 0,
+ 'ajax' => 0,
+ 'placeholder' => '',
+ 'return_format' => 'value'
+ );
+ $this->l10n = array(
+ 'matches_1' => _x('One result is available, press enter to select it.', 'Select2 JS matches_1', 'acf'),
+ 'matches_n' => _x('%d results are available, use up and down arrow keys to navigate.', 'Select2 JS matches_n', 'acf'),
+ 'matches_0' => _x('No matches found', 'Select2 JS matches_0', 'acf'),
+ 'input_too_short_1' => _x('Please enter 1 or more characters', 'Select2 JS input_too_short_1', 'acf' ),
+ 'input_too_short_n' => _x('Please enter %d or more characters', 'Select2 JS input_too_short_n', 'acf' ),
+ 'input_too_long_1' => _x('Please delete 1 character', 'Select2 JS input_too_long_1', 'acf' ),
+ 'input_too_long_n' => _x('Please delete %d characters', 'Select2 JS input_too_long_n', 'acf' ),
+ 'selection_too_long_1' => _x('You can only select 1 item', 'Select2 JS selection_too_long_1', 'acf' ),
+ 'selection_too_long_n' => _x('You can only select %d items', 'Select2 JS selection_too_long_n', 'acf' ),
+ 'load_more' => _x('Loading more results…', 'Select2 JS load_more', 'acf' ),
+ 'searching' => _x('Searching…', 'Select2 JS searching', 'acf' ),
+ 'load_fail' => _x('Loading failed', 'Select2 JS load_fail', 'acf' ),
+ );
+
+
+ // ajax
+ add_action('wp_ajax_acf/fields/select/query', array($this, 'ajax_query'));
+ add_action('wp_ajax_nopriv_acf/fields/select/query', array($this, 'ajax_query'));
+
+ }
+
+
+ /*
+ * input_admin_enqueue_scripts
+ *
+ * description
+ *
+ * @type function
+ * @date 16/12/2015
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function input_admin_enqueue_scripts() {
+
+ // bail ealry if no enqueue
+ if( !acf_get_setting('enqueue_select2') ) return;
+
+
+ // globals
+ global $wp_scripts, $wp_styles;
+
+
+ // vars
+ $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
+ $major = acf_get_setting('select2_version');
+ $version = '';
+ $script = '';
+ $style = '';
+
+
+ // attempt to find 3rd party Select2 version
+ // - avoid including v3 CSS when v4 JS is already enququed
+ if( isset($wp_scripts->registered['select2']) ) {
+
+ $major = (int) $wp_scripts->registered['select2']->ver;
+
+ }
+
+
+ // v4
+ if( $major == 4 ) {
+
+ $version = '4.0';
+ $script = acf_get_dir("assets/inc/select2/4/select2.full{$min}.js");
+ $style = acf_get_dir("assets/inc/select2/4/select2{$min}.css");
+
+ // v3
+ } else {
+
+ $version = '3.5.2';
+ $script = acf_get_dir("assets/inc/select2/3/select2{$min}.js");
+ $style = acf_get_dir("assets/inc/select2/3/select2.css");
+
+ }
+
+
+ // enqueue
+ wp_enqueue_script('select2', $script, array('jquery'), $version );
+ wp_enqueue_style('select2', $style, '', $version );
+
+ }
+
+
+ /*
+ * ajax_query
+ *
+ * description
+ *
+ * @type function
+ * @date 24/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function ajax_query() {
+
+ // validate
+ if( !acf_verify_ajax() ) die();
+
+
+ // get choices
+ $response = $this->get_ajax_query( $_POST );
+
+
+ // return
+ acf_send_ajax_results($response);
+
+ }
+
+
+ /*
+ * get_ajax_query
+ *
+ * This function will return an array of data formatted for use in a select2 AJAX response
+ *
+ * @type function
+ * @date 15/10/2014
+ * @since 5.0.9
+ *
+ * @param $options (array)
+ * @return (array)
+ */
+
+ function get_ajax_query( $options = array() ) {
+
+ // defaults
+ $options = acf_parse_args($options, array(
+ 'post_id' => 0,
+ 's' => '',
+ 'field_key' => '',
+ 'paged' => 1
+ ));
+
+
+ // load field
+ $field = acf_get_field( $options['field_key'] );
+ if( !$field ) return false;
+
+
+ // get choices
+ $choices = acf_get_array($field['choices']);
+ if( empty($field['choices']) ) return false;
+
+
+ // vars
+ $results = array();
+ $s = null;
+
+
+ // search
+ if( $options['s'] !== '' ) {
+
+ // strip slashes (search may be integer)
+ $s = strval( $options['s'] );
+ $s = wp_unslash( $s );
+
+ }
+
+
+ // loop
+ foreach( $field['choices'] as $k => $v ) {
+
+ // ensure $v is a string
+ $v = strval( $v );
+
+
+ // if searching, but doesn't exist
+ if( is_string($s) && stripos($v, $s) === false ) continue;
+
+
+ // append
+ $results[] = array(
+ 'id' => $k,
+ 'text' => $v
+ );
+
+ }
+
+
+ // vars
+ $response = array(
+ 'results' => $results
+ );
+
+
+ // return
+ return $response;
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // convert
+ $value = acf_get_array($field['value']);
+ $choices = acf_get_array($field['choices']);
+
+
+ // placeholder
+ if( empty($field['placeholder']) ) {
+ $field['placeholder'] = _x('Select', 'verb', 'acf');
+ }
+
+
+ // add empty value (allows '' to be selected)
+ if( empty($value) ) {
+ $value = array('');
+ }
+
+
+ // allow null
+ // - have tried array_merge but this causes keys to re-index if is numeric (post ID's)
+ if( $field['allow_null'] && !$field['multiple'] ) {
+
+ $prepend = array('' => '- ' . $field['placeholder'] . ' -');
+ $choices = $prepend + $choices;
+
+ }
+
+
+ // vars
+ $select = array(
+ 'id' => $field['id'],
+ 'class' => $field['class'],
+ 'name' => $field['name'],
+ 'data-ui' => $field['ui'],
+ 'data-ajax' => $field['ajax'],
+ 'data-multiple' => $field['multiple'],
+ 'data-placeholder' => $field['placeholder'],
+ 'data-allow_null' => $field['allow_null']
+ );
+
+
+ // multiple
+ if( $field['multiple'] ) {
+
+ $select['multiple'] = 'multiple';
+ $select['size'] = 5;
+ $select['name'] .= '[]';
+
+ }
+
+
+ // special atts
+ if( !empty($field['readonly']) ) $select['readonly'] = 'readonly';
+ if( !empty($field['disabled']) ) $select['disabled'] = 'disabled';
+ if( !empty($field['ajax_action']) ) $select['data-ajax_action'] = $field['ajax_action'];
+
+
+ // hidden input
+ if( $field['ui'] ) {
+
+ $v = $value;
+
+ if( $field['multiple'] ) {
+
+ $v = implode('||', $v);
+
+ } else {
+
+ $v = acf_maybe_get($v, 0, '');
+
+ }
+
+ acf_hidden_input(array(
+ 'id' => $field['id'] . '-input',
+ 'name' => $field['name'],
+ 'value' => $v
+ ));
+
+ } elseif( $field['multiple'] ) {
+
+ acf_hidden_input(array(
+ 'id' => $field['id'] . '-input',
+ 'name' => $field['name']
+ ));
+
+ }
+
+
+ // append
+ $select['value'] = $value;
+ $select['choices'] = $choices;
+
+
+ // render
+ acf_select_input( $select );
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_settings( $field ) {
+
+ // encode choices (convert from array)
+ $field['choices'] = acf_encode_choices($field['choices']);
+ $field['default_value'] = acf_encode_choices($field['default_value'], false);
+
+
+ // choices
+ acf_render_field_setting( $field, array(
+ 'label' => __('Choices','acf'),
+ 'instructions' => __('Enter each choice on a new line.','acf') . ' ' . __('For more control, you may specify both a value and label like this:','acf'). ' ' . __('red : Red','acf'),
+ 'name' => 'choices',
+ 'type' => 'textarea',
+ ));
+
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => __('Enter each default value on a new line','acf'),
+ 'name' => 'default_value',
+ 'type' => 'textarea',
+ ));
+
+
+ // allow_null
+ acf_render_field_setting( $field, array(
+ 'label' => __('Allow Null?','acf'),
+ 'instructions' => '',
+ 'name' => 'allow_null',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // multiple
+ acf_render_field_setting( $field, array(
+ 'label' => __('Select multiple values?','acf'),
+ 'instructions' => '',
+ 'name' => 'multiple',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // ui
+ acf_render_field_setting( $field, array(
+ 'label' => __('Stylised UI','acf'),
+ 'instructions' => '',
+ 'name' => 'ui',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // ajax
+ acf_render_field_setting( $field, array(
+ 'label' => __('Use AJAX to lazy load choices?','acf'),
+ 'instructions' => '',
+ 'name' => 'ajax',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // return_format
+ acf_render_field_setting( $field, array(
+ 'label' => __('Return Format','acf'),
+ 'instructions' => __('Specify the value returned','acf'),
+ 'type' => 'select',
+ 'name' => 'return_format',
+ 'choices' => array(
+ 'value' => __('Value','acf'),
+ 'label' => __('Label','acf'),
+ 'array' => __('Both (Array)','acf')
+ )
+ ));
+
+ }
+
+
+ /*
+ * load_value()
+ *
+ * This filter is applied to the $value after it is loaded from the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value found in the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ * @return $value
+ */
+
+ function load_value( $value, $post_id, $field ) {
+
+ // ACF4 null
+ if( $value === 'null' ) return false;
+
+
+ // return
+ return $value;
+ }
+
+
+ /*
+ * update_field()
+ *
+ * This filter is appied to the $field before it is saved to the database
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - the field array holding all the field options
+ * @param $post_id - the field group ID (post_type = acf)
+ *
+ * @return $field - the modified field
+ */
+
+ function update_field( $field ) {
+
+ // decode choices (convert to array)
+ $field['choices'] = acf_decode_choices($field['choices']);
+ $field['default_value'] = acf_decode_choices($field['default_value'], true);
+
+
+ // return
+ return $field;
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $post_id - the $post_id of which the value will be saved
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // validate
+ if( empty($value) ) {
+
+ return $value;
+
+ }
+
+
+ // array
+ if( is_array($value) ) {
+
+ // save value as strings, so we can clearly search for them in SQL LIKE statements
+ $value = array_map('strval', $value);
+
+ }
+
+
+ // return
+ return $value;
+ }
+
+
+ /*
+ * translate_field
+ *
+ * This function will translate field settings
+ *
+ * @type function
+ * @date 8/03/2016
+ * @since 5.3.2
+ *
+ * @param $field (array)
+ * @return $field
+ */
+
+ function translate_field( $field ) {
+
+ // translate
+ $field['choices'] = acf_translate( $field['choices'] );
+
+
+ // return
+ return $field;
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // array
+ if( acf_is_array($value) ) {
+
+ foreach( $value as $i => $v ) {
+
+ $value[ $i ] = $this->format_value_single( $v, $post_id, $field );
+
+ }
+
+ } else {
+
+ $value = $this->format_value_single( $value, $post_id, $field );
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ function format_value_single( $value, $post_id, $field ) {
+
+ // bail ealry if is empty
+ if( acf_is_empty($value) ) return $value;
+
+
+ // vars
+ $label = acf_maybe_get($field['choices'], $value, $value);
+
+
+ // value
+ if( $field['return_format'] == 'value' ) {
+
+ // do nothing
+
+ // label
+ } elseif( $field['return_format'] == 'label' ) {
+
+ $value = $label;
+
+ // array
+ } elseif( $field['return_format'] == 'array' ) {
+
+ $value = array(
+ 'value' => $value,
+ 'label' => $label
+ );
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_select' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-separator.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-separator.php
new file mode 100644
index 0000000..e2cee33
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-separator.php
@@ -0,0 +1,91 @@
+name = 'separator';
+ $this->label = __("Separator",'acf');
+ $this->category = 'layout';
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ /* do nothing */
+
+ }
+
+
+ /*
+ * load_field()
+ *
+ * This filter is appied to the $field after it is loaded from the database
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - the field array holding all the field options
+ *
+ * @return $field - the field array holding all the field options
+ */
+
+ function load_field( $field ) {
+
+ // remove name to avoid caching issue
+ $field['name'] = '';
+
+
+ // remove required to avoid JS issues
+ $field['required'] = 0;
+
+
+ // set value other than 'null' to avoid ACF loading / caching issue
+ $field['value'] = false;
+
+
+ // return
+ return $field;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_separator' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-tab.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-tab.php
new file mode 100644
index 0000000..e6d32d0
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-tab.php
@@ -0,0 +1,162 @@
+name = 'tab';
+ $this->label = __("Tab",'acf');
+ $this->category = 'layout';
+ $this->defaults = array(
+ 'placement' => 'top',
+ 'endpoint' => 0 // added in 5.2.8
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $atts = array(
+ 'href' => '',
+ 'class' => 'acf-tab-button',
+ 'data-placement' => $field['placement'],
+ 'data-endpoint' => $field['endpoint'],
+ 'data-key' => $field['key']
+ );
+
+ ?>
+ >
+ ' . __( 'Use "Tab Fields" to better organize your edit screen by grouping fields together.', 'acf') . '';
+ $message .= '' . __( 'All fields following this "tab field" (or until another "tab field" is defined) will be grouped together using this field\'s label as the tab heading.','acf') . '
';
+
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Instructions','acf'),
+ 'instructions' => '',
+ 'name' => 'notes',
+ 'type' => 'message',
+ 'message' => $message,
+ ));
+*/
+
+
+ // preview_size
+ acf_render_field_setting( $field, array(
+ 'label' => __('Placement','acf'),
+ 'type' => 'select',
+ 'name' => 'placement',
+ 'choices' => array(
+ 'top' => __("Top aligned", 'acf'),
+ 'left' => __("Left Aligned", 'acf'),
+ )
+ ));
+
+
+ // endpoint
+ acf_render_field_setting( $field, array(
+ 'label' => __('Endpoint','acf'),
+ 'instructions' => __('Define an endpoint for the previous tabs to stop. This will start a new group of tabs.', 'acf'),
+ 'name' => 'endpoint',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+ }
+
+
+ /*
+ * load_field()
+ *
+ * This filter is appied to the $field after it is loaded from the database
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - the field array holding all the field options
+ *
+ * @return $field - the field array holding all the field options
+ */
+
+ function load_field( $field ) {
+
+ // remove name to avoid caching issue
+ $field['name'] = '';
+
+ // remove required to avoid JS issues
+ $field['required'] = 0;
+
+ // set value other than 'null' to avoid ACF loading / caching issue
+ $field['value'] = false;
+
+ // return
+ return $field;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_tab' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-taxonomy.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-taxonomy.php
new file mode 100644
index 0000000..2a8fd48
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-taxonomy.php
@@ -0,0 +1,1014 @@
+name = 'taxonomy';
+ $this->label = __("Taxonomy",'acf');
+ $this->category = 'relational';
+ $this->defaults = array(
+ 'taxonomy' => 'category',
+ 'field_type' => 'checkbox',
+ 'multiple' => 0,
+ 'allow_null' => 0,
+ //'load_save_terms' => 0, // removed in 5.2.7
+ 'return_format' => 'id',
+ 'add_term' => 1, // 5.2.3
+ 'load_terms' => 0, // 5.2.7
+ 'save_terms' => 0 // 5.2.7
+ );
+
+
+ // ajax
+ add_action('wp_ajax_acf/fields/taxonomy/query', array($this, 'ajax_query'));
+ add_action('wp_ajax_nopriv_acf/fields/taxonomy/query', array($this, 'ajax_query'));
+ add_action('wp_ajax_acf/fields/taxonomy/add_term', array($this, 'ajax_add_term'));
+
+
+ // actions
+ add_action('acf/save_post', array($this, 'save_post'), 15, 1);
+
+ }
+
+
+ /*
+ * ajax_query
+ *
+ * description
+ *
+ * @type function
+ * @date 24/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function ajax_query() {
+
+ // validate
+ if( !acf_verify_ajax() ) die();
+
+
+ // get choices
+ $response = $this->get_ajax_query( $_POST );
+
+
+ // return
+ acf_send_ajax_results($response);
+
+ }
+
+
+ /*
+ * get_ajax_query
+ *
+ * This function will return an array of data formatted for use in a select2 AJAX response
+ *
+ * @type function
+ * @date 15/10/2014
+ * @since 5.0.9
+ *
+ * @param $options (array)
+ * @return (array)
+ */
+
+ function get_ajax_query( $options = array() ) {
+
+ // defaults
+ $options = acf_parse_args($options, array(
+ 'post_id' => 0,
+ 's' => '',
+ 'field_key' => '',
+ 'paged' => 0
+ ));
+
+
+ // load field
+ $field = acf_get_field( $options['field_key'] );
+ if( !$field ) return false;
+
+
+ // bail early if taxonomy does not exist
+ if( !taxonomy_exists($field['taxonomy']) ) return false;
+
+
+ // vars
+ $results = array();
+ $is_hierarchical = is_taxonomy_hierarchical( $field['taxonomy'] );
+ $is_pagination = ($options['paged'] > 0);
+ $is_search = false;
+ $limit = 20;
+ $offset = 20 * ($options['paged'] - 1);
+
+
+ // args
+ $args = array(
+ 'taxonomy' => $field['taxonomy'],
+ 'hide_empty' => false
+ );
+
+
+ // pagination
+ // - don't bother for hierarchial terms, we will need to load all terms anyway
+ if( $is_pagination && !$is_hierarchical ) {
+
+ $args['number'] = $limit;
+ $args['offset'] = $offset;
+
+ }
+
+
+ // search
+ if( $options['s'] !== '' ) {
+
+ // strip slashes (search may be integer)
+ $s = wp_unslash( strval($options['s']) );
+
+
+ // update vars
+ $args['search'] = $s;
+ $is_search = true;
+
+ }
+
+
+ // filters
+ $args = apply_filters('acf/fields/taxonomy/query', $args, $field, $options['post_id']);
+ $args = apply_filters('acf/fields/taxonomy/query/name=' . $field['name'], $args, $field, $options['post_id'] );
+ $args = apply_filters('acf/fields/taxonomy/query/key=' . $field['key'], $args, $field, $options['post_id'] );
+
+
+ // get terms
+ $terms = acf_get_terms( $args );
+
+
+ // sort into hierachial order!
+ if( $is_hierarchical ) {
+
+ // update vars
+ $limit = acf_maybe_get( $args, 'number', $limit );
+ $offset = acf_maybe_get( $args, 'offset', $offset );
+
+
+ // get parent
+ $parent = acf_maybe_get( $args, 'parent', 0 );
+ $parent = acf_maybe_get( $args, 'child_of', $parent );
+
+
+ // this will fail if a search has taken place because parents wont exist
+ if( !$is_search ) {
+
+ // order terms
+ $ordered_terms = _get_term_children( $parent, $terms, $field['taxonomy'] );
+
+
+ // check for empty array (possible if parent did not exist within original data)
+ if( !empty($ordered_terms) ) {
+
+ $terms = $ordered_terms;
+
+ }
+ }
+
+
+ // fake pagination
+ if( $is_pagination ) {
+
+ $terms = array_slice($terms, $offset, $limit);
+
+ }
+
+ }
+
+
+ /// append to r
+ foreach( $terms as $term ) {
+
+ // add to json
+ $results[] = array(
+ 'id' => $term->term_id,
+ 'text' => $this->get_term_title( $term, $field, $options['post_id'] )
+ );
+
+ }
+
+
+ // vars
+ $response = array(
+ 'results' => $results,
+ 'limit' => $limit
+ );
+
+
+ // return
+ return $response;
+
+ }
+
+
+ /*
+ * get_term_title
+ *
+ * This function returns the HTML for a result
+ *
+ * @type function
+ * @date 1/11/2013
+ * @since 5.0.0
+ *
+ * @param $post (object)
+ * @param $field (array)
+ * @param $post_id (int) the post_id to which this value is saved to
+ * @return (string)
+ */
+
+ function get_term_title( $term, $field, $post_id = 0 ) {
+
+ // get post_id
+ if( !$post_id ) $post_id = acf_get_form_data('post_id');
+
+
+ // vars
+ $title = '';
+
+
+ // ancestors
+ $ancestors = get_ancestors( $term->term_id, $field['taxonomy'] );
+
+ if( !empty($ancestors) ) {
+
+ $title .= str_repeat('- ', count($ancestors));
+
+ }
+
+
+ // title
+ $title .= $term->name;
+
+
+ // filters
+ $title = apply_filters('acf/fields/taxonomy/result', $title, $term, $field, $post_id);
+ $title = apply_filters('acf/fields/taxonomy/result/name=' . $field['_name'] , $title, $term, $field, $post_id);
+ $title = apply_filters('acf/fields/taxonomy/result/key=' . $field['key'], $title, $term, $field, $post_id);
+
+
+ // return
+ return $title;
+ }
+
+
+ /*
+ * get_terms
+ *
+ * This function will return an array of terms for a given field value
+ *
+ * @type function
+ * @date 13/06/2014
+ * @since 5.0.0
+ *
+ * @param $value (array)
+ * @return $value
+ */
+
+ function get_terms( $value, $taxonomy = 'category' ) {
+
+ // load terms in 1 query to save multiple DB calls from following code
+ if( count($value) > 1 ) {
+
+ $terms = acf_get_terms(array(
+ 'taxonomy' => $taxonomy,
+ 'include' => $value,
+ 'hide_empty' => false
+ ));
+
+ }
+
+
+ // update value to include $post
+ foreach( array_keys($value) as $i ) {
+
+ $value[ $i ] = get_term( $value[ $i ], $taxonomy );
+
+ }
+
+
+ // filter out null values
+ $value = array_filter($value);
+
+
+ // return
+ return $value;
+ }
+
+
+ /*
+ * load_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value found in the database
+ * @param $post_id - the $post_id from which the value was loaded from
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the value to be saved in te database
+ */
+
+ function load_value( $value, $post_id, $field ) {
+
+ // get valid terms
+ $value = acf_get_valid_terms($value, $field['taxonomy']);
+
+
+ // load_terms
+ if( $field['load_terms'] ) {
+
+ // get terms
+ $info = acf_get_post_id_info($post_id);
+ $term_ids = wp_get_object_terms($info['id'], $field['taxonomy'], array('fields' => 'ids', 'orderby' => 'none'));
+
+
+ // bail early if no terms
+ if( empty($term_ids) || is_wp_error($term_ids) ) return false;
+
+
+ // sort
+ if( !empty($value) ) {
+
+ $order = array();
+
+ foreach( $term_ids as $i => $v ) {
+
+ $order[ $i ] = array_search($v, $value);
+
+ }
+
+ array_multisort($order, $term_ids);
+
+ }
+
+
+ // update value
+ $value = $term_ids;
+
+ }
+
+
+ // convert back from array if neccessary
+ if( $field['field_type'] == 'select' || $field['field_type'] == 'radio' ) {
+
+ $value = array_shift($value);
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $field - the field array holding all the field options
+ * @param $post_id - the $post_id of which the value will be saved
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // vars
+ if( is_array($value) ) {
+
+ $value = array_filter($value);
+
+ }
+
+
+ // save_terms
+ if( $field['save_terms'] ) {
+
+ // vars
+ $taxonomy = $field['taxonomy'];
+
+
+ // force value to array
+ $term_ids = acf_get_array( $value );
+
+
+ // convert to int
+ $term_ids = array_map('intval', $term_ids);
+
+
+ // get existing term id's (from a previously saved field)
+ $old_term_ids = isset($this->save_post_terms[ $taxonomy ]) ? $this->save_post_terms[ $taxonomy ] : array();
+
+
+ // append
+ $this->save_post_terms[ $taxonomy ] = array_merge($old_term_ids, $term_ids);
+
+
+ // if called directly from frontend update_field()
+ if( !did_action('acf/save_post') ) {
+
+ $this->save_post( $post_id );
+
+ return $value;
+
+ }
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * save_post
+ *
+ * This function will save any terms in the save_post_terms array
+ *
+ * @type function
+ * @date 26/11/2014
+ * @since 5.0.9
+ *
+ * @param $post_id (int)
+ * @return n/a
+ */
+
+ function save_post( $post_id ) {
+
+ // bail ealry if no terms
+ if( empty($this->save_post_terms) ) return;
+
+
+ // vars
+ $info = acf_get_post_id_info($post_id);
+
+
+ // loop
+ foreach( $this->save_post_terms as $taxonomy => $term_ids ){
+
+ // save
+ wp_set_object_terms( $info['id'], $term_ids, $taxonomy, false );
+
+ }
+
+
+ // reset array ( WP saves twice )
+ $this->save_post_terms = array();
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // bail early if no value
+ if( empty($value) ) return false;
+
+
+ // force value to array
+ $value = acf_get_array( $value );
+
+
+ // load posts if needed
+ if( $field['return_format'] == 'object' ) {
+
+ // get posts
+ $value = $this->get_terms( $value, $field["taxonomy"] );
+
+ }
+
+
+ // convert back from array if neccessary
+ if( $field['field_type'] == 'select' || $field['field_type'] == 'radio' ) {
+
+ $value = array_shift($value);
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field( $field ) {
+
+ // force value to array
+ $field['value'] = acf_get_array( $field['value'] );
+
+
+ // vars
+ $div = array(
+ 'class' => 'acf-taxonomy-field',
+ 'data-save' => $field['save_terms'],
+ 'data-type' => $field['field_type'],
+ 'data-taxonomy' => $field['taxonomy']
+ );
+
+
+ // get taxonomy
+ $taxonomy = get_taxonomy( $field['taxonomy'] );
+
+
+ // bail early if taxonomy does not exist
+ if( !$taxonomy ) return;
+
+
+ ?>
+>
+ cap->manage_terms) ): ?>
+
+ render_field_select( $field );
+
+ } elseif( $field['field_type'] == 'multi_select' ) {
+
+ $field['multiple'] = 1;
+
+ $this->render_field_select( $field );
+
+ } elseif( $field['field_type'] == 'radio' ) {
+
+ $this->render_field_checkbox( $field );
+
+ } elseif( $field['field_type'] == 'checkbox' ) {
+
+ $this->render_field_checkbox( $field );
+
+ }
+
+ ?>
+
get_terms( $field['value'], $field['taxonomy'] );
+
+
+ // set choices
+ if( !empty($terms) ) {
+
+ foreach( array_keys($terms) as $i ) {
+
+ // vars
+ $term = acf_extract_var( $terms, $i );
+
+
+ // append to choices
+ $field['choices'][ $term->term_id ] = $this->get_term_title( $term, $field );
+
+ }
+
+ }
+
+ }
+
+
+ // render select
+ acf_render_field( $field );
+
+ }
+
+
+ /*
+ * render_field_checkbox()
+ *
+ * Create the HTML interface for your field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_checkbox( $field ) {
+
+ // hidden input
+ acf_hidden_input(array(
+ 'type' => 'hidden',
+ 'name' => $field['name'],
+ ));
+
+
+ // checkbox saves an array
+ if( $field['field_type'] == 'checkbox' ) {
+
+ $field['name'] .= '[]';
+
+ }
+
+
+ // taxonomy
+ $taxonomy_obj = get_taxonomy($field['taxonomy']);
+
+
+ // include walker
+ acf_include('includes/walkers/class-acf-walker-taxonomy-field.php');
+
+
+ // vars
+ $args = array(
+ 'taxonomy' => $field['taxonomy'],
+ 'show_option_none' => sprintf( _x('No %s', 'No terms', 'acf'), strtolower($taxonomy_obj->labels->name) ),
+ 'hide_empty' => false,
+ 'style' => 'none',
+ 'walker' => new ACF_Taxonomy_Field_Walker( $field ),
+ );
+
+
+ // filter for 3rd party customization
+ $args = apply_filters('acf/fields/taxonomy/wp_list_categories', $args, $field);
+ $args = apply_filters('acf/fields/taxonomy/wp_list_categories/name=' . $field['_name'], $args, $field);
+ $args = apply_filters('acf/fields/taxonomy/wp_list_categories/key=' . $field['key'], $args, $field);
+
+ ?> __('Taxonomy','acf'),
+ 'instructions' => __('Select the taxonomy to be displayed','acf'),
+ 'type' => 'select',
+ 'name' => 'taxonomy',
+ 'choices' => acf_get_taxonomies(),
+ ));
+
+
+ // field_type
+ acf_render_field_setting( $field, array(
+ 'label' => __('Appearance','acf'),
+ 'instructions' => __('Select the appearance of this field','acf'),
+ 'type' => 'select',
+ 'name' => 'field_type',
+ 'optgroup' => true,
+ 'choices' => array(
+ __("Multiple Values",'acf') => array(
+ 'checkbox' => __('Checkbox', 'acf'),
+ 'multi_select' => __('Multi Select', 'acf')
+ ),
+ __("Single Value",'acf') => array(
+ 'radio' => __('Radio Buttons', 'acf'),
+ 'select' => _x('Select', 'noun', 'acf')
+ )
+ )
+ ));
+
+
+ // allow_null
+ acf_render_field_setting( $field, array(
+ 'label' => __('Allow Null?','acf'),
+ 'instructions' => '',
+ 'name' => 'allow_null',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // add_term
+ acf_render_field_setting( $field, array(
+ 'label' => __('Create Terms','acf'),
+ 'instructions' => __('Allow new terms to be created whilst editing','acf'),
+ 'name' => 'add_term',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // save_terms
+ acf_render_field_setting( $field, array(
+ 'label' => __('Save Terms','acf'),
+ 'instructions' => __('Connect selected terms to the post','acf'),
+ 'name' => 'save_terms',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // load_terms
+ acf_render_field_setting( $field, array(
+ 'label' => __('Load Terms','acf'),
+ 'instructions' => __('Load value from posts terms','acf'),
+ 'name' => 'load_terms',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // return_format
+ acf_render_field_setting( $field, array(
+ 'label' => __('Return Value','acf'),
+ 'instructions' => '',
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'choices' => array(
+ 'object' => __("Term Object",'acf'),
+ 'id' => __("Term ID",'acf')
+ ),
+ 'layout' => 'horizontal',
+ ));
+
+ }
+
+
+ /*
+ * ajax_add_term
+ *
+ * description
+ *
+ * @type function
+ * @date 17/04/2015
+ * @since 5.2.3
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function ajax_add_term() {
+
+ // vars
+ $args = acf_parse_args($_POST, array(
+ 'nonce' => '',
+ 'field_key' => '',
+ 'term_name' => '',
+ 'term_parent' => ''
+ ));
+
+
+ // verify nonce
+ if( ! wp_verify_nonce($args['nonce'], 'acf_nonce') ) {
+
+ die();
+
+ }
+
+
+ // load field
+ $field = acf_get_field( $args['field_key'] );
+
+ if( !$field ) {
+
+ die();
+
+ }
+
+
+ // vars
+ $taxonomy_obj = get_taxonomy($field['taxonomy']);
+ $taxonomy_label = $taxonomy_obj->labels->singular_name;
+
+
+ // validate cap
+ // note: this situation should never occur due to condition of the add new button
+ if( !current_user_can( $taxonomy_obj->cap->manage_terms) ) {
+
+ echo '' . __("Error.", 'acf') . ' ' . sprintf( __('User unable to add new %s', 'acf'), $taxonomy_label ) . '
';
+ die;
+
+ }
+
+
+ // save?
+ if( $args['term_name'] ) {
+
+ // exists
+ if( term_exists($args['term_name'], $field['taxonomy']) ) {
+
+ wp_send_json_error(array(
+ 'error' => sprintf( __('%s already exists', 'acf'), $taxonomy_label )
+ ));
+
+ }
+
+
+ // insert
+ $extra = array();
+
+ if( $args['term_parent'] ) {
+
+ $extra['parent'] = $args['term_parent'];
+
+ }
+
+ $data = wp_insert_term( $args['term_name'], $field['taxonomy'], $extra );
+
+
+ // error?
+ if( is_wp_error($data) ) {
+
+ wp_send_json_error(array(
+ 'error' => $data->get_error_message()
+ ));
+
+ }
+
+
+ // ancestors
+ $prefix = '';
+ $ancestors = get_ancestors( $data['term_id'], $field['taxonomy'] );
+
+ if( !empty($ancestors) ) {
+
+ $prefix = str_repeat('- ', count($ancestors));
+
+ }
+
+
+ // success
+ wp_send_json_success(array(
+ 'message' => sprintf( __('%s added', 'acf'), $taxonomy_label ),
+ 'term_id' => $data['term_id'],
+ 'term_name' => $args['term_name'],
+ 'term_label' => $prefix . $args['term_name'],
+ 'term_parent' => $args['term_parent']
+ ));
+
+ }
+
+ ?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-text.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-text.php
new file mode 100644
index 0000000..e9a9feb
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-text.php
@@ -0,0 +1,171 @@
+name = 'text';
+ $this->label = __("Text",'acf');
+ $this->defaults = array(
+ 'default_value' => '',
+ 'maxlength' => '',
+ 'placeholder' => '',
+ 'prepend' => '',
+ 'append' => ''
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $atts = array();
+ $keys = array( 'type', 'id', 'class', 'name', 'value', 'placeholder', 'maxlength', 'pattern' );
+ $keys2 = array( 'readonly', 'disabled', 'required' );
+ $html = '';
+
+
+ // prepend
+ if( $field['prepend'] !== '' ) {
+
+ $field['class'] .= ' acf-is-prepended';
+ $html .= '' . acf_esc_html($field['prepend']) . '
';
+
+ }
+
+
+ // append
+ if( $field['append'] !== '' ) {
+
+ $field['class'] .= ' acf-is-appended';
+ $html .= '' . acf_esc_html($field['append']) . '
';
+
+ }
+
+
+ // atts (value="123")
+ foreach( $keys as $k ) {
+ if( isset($field[ $k ]) ) $atts[ $k ] = $field[ $k ];
+ }
+
+
+ // atts2 (disabled="disabled")
+ foreach( $keys2 as $k ) {
+ if( !empty($field[ $k ]) ) $atts[ $k ] = $k;
+ }
+
+
+ // remove empty atts
+ $atts = acf_clean_atts( $atts );
+
+
+ // render
+ $html .= '' . acf_get_text_input( $atts ) . '
';
+
+
+ // return
+ echo $html;
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field_settings( $field ) {
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => __('Appears when creating a new post','acf'),
+ 'type' => 'text',
+ 'name' => 'default_value',
+ ));
+
+
+ // placeholder
+ acf_render_field_setting( $field, array(
+ 'label' => __('Placeholder Text','acf'),
+ 'instructions' => __('Appears within the input','acf'),
+ 'type' => 'text',
+ 'name' => 'placeholder',
+ ));
+
+
+ // prepend
+ acf_render_field_setting( $field, array(
+ 'label' => __('Prepend','acf'),
+ 'instructions' => __('Appears before the input','acf'),
+ 'type' => 'text',
+ 'name' => 'prepend',
+ ));
+
+
+ // append
+ acf_render_field_setting( $field, array(
+ 'label' => __('Append','acf'),
+ 'instructions' => __('Appears after the input','acf'),
+ 'type' => 'text',
+ 'name' => 'append',
+ ));
+
+
+ // maxlength
+ acf_render_field_setting( $field, array(
+ 'label' => __('Character Limit','acf'),
+ 'instructions' => __('Leave blank for no limit','acf'),
+ 'type' => 'number',
+ 'name' => 'maxlength',
+ ));
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_text' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-textarea.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-textarea.php
new file mode 100644
index 0000000..8c41ee8
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-textarea.php
@@ -0,0 +1,203 @@
+name = 'textarea';
+ $this->label = __("Text Area",'acf');
+ $this->defaults = array(
+ 'default_value' => '',
+ 'new_lines' => '',
+ 'maxlength' => '',
+ 'placeholder' => '',
+ 'rows' => ''
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $atts = array();
+ $keys = array( 'id', 'class', 'name', 'value', 'placeholder', 'rows', 'maxlength' );
+ $keys2 = array( 'readonly', 'disabled', 'required' );
+
+
+ // rows
+ if( !$field['rows'] ) {
+ $field['rows'] = 8;
+ }
+
+
+ // atts (value="123")
+ foreach( $keys as $k ) {
+ if( isset($field[ $k ]) ) $atts[ $k ] = $field[ $k ];
+ }
+
+
+ // atts2 (disabled="disabled")
+ foreach( $keys2 as $k ) {
+ if( !empty($field[ $k ]) ) $atts[ $k ] = $k;
+ }
+
+
+ // remove empty atts
+ $atts = acf_clean_atts( $atts );
+
+
+ // return
+ acf_textarea_input( $atts );
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field_settings( $field ) {
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => __('Appears when creating a new post','acf'),
+ 'type' => 'textarea',
+ 'name' => 'default_value',
+ ));
+
+
+ // placeholder
+ acf_render_field_setting( $field, array(
+ 'label' => __('Placeholder Text','acf'),
+ 'instructions' => __('Appears within the input','acf'),
+ 'type' => 'text',
+ 'name' => 'placeholder',
+ ));
+
+
+ // maxlength
+ acf_render_field_setting( $field, array(
+ 'label' => __('Character Limit','acf'),
+ 'instructions' => __('Leave blank for no limit','acf'),
+ 'type' => 'number',
+ 'name' => 'maxlength',
+ ));
+
+
+ // rows
+ acf_render_field_setting( $field, array(
+ 'label' => __('Rows','acf'),
+ 'instructions' => __('Sets the textarea height','acf'),
+ 'type' => 'number',
+ 'name' => 'rows',
+ 'placeholder' => 8
+ ));
+
+
+ // formatting
+ acf_render_field_setting( $field, array(
+ 'label' => __('New Lines','acf'),
+ 'instructions' => __('Controls how new lines are rendered','acf'),
+ 'type' => 'select',
+ 'name' => 'new_lines',
+ 'choices' => array(
+ 'wpautop' => __("Automatically add paragraphs",'acf'),
+ 'br' => __("Automatically add <br>",'acf'),
+ '' => __("No Formatting",'acf')
+ )
+ ));
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is applied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // bail early if no value or not for template
+ if( empty($value) || !is_string($value) ) {
+
+ return $value;
+
+ }
+
+
+ // new lines
+ if( $field['new_lines'] == 'wpautop' ) {
+
+ $value = wpautop($value);
+
+ } elseif( $field['new_lines'] == 'br' ) {
+
+ $value = nl2br($value);
+
+ }
+
+
+ // return
+ return $value;
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_textarea' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-time_picker.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-time_picker.php
new file mode 100644
index 0000000..efdaf27
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-time_picker.php
@@ -0,0 +1,169 @@
+name = 'time_picker';
+ $this->label = __("Time Picker",'acf');
+ $this->category = 'jquery';
+ $this->defaults = array(
+ 'display_format' => 'g:i a',
+ 'return_format' => 'g:i a'
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // format value
+ $display_value = '';
+
+ if( $field['value'] ) {
+ $display_value = acf_format_date( $field['value'], $field['display_format'] );
+ }
+
+
+ // vars
+ $div = array(
+ 'class' => 'acf-time-picker acf-input-wrap',
+ 'data-time_format' => acf_convert_time_to_js($field['display_format'])
+ );
+ $hidden_input = array(
+ 'id' => $field['id'],
+ 'class' => 'input-alt',
+ 'type' => 'hidden',
+ 'name' => $field['name'],
+ 'value' => $field['value'],
+ );
+ $text_input = array(
+ 'class' => 'input',
+ 'type' => 'text',
+ 'value' => $display_value,
+ );
+
+
+ // html
+ ?>
+ >
+
+
+
+ __('Display Format','acf'),
+ 'instructions' => __('The format displayed when editing a post','acf'),
+ 'type' => 'radio',
+ 'name' => 'display_format',
+ 'other_choice' => 1,
+ 'choices' => array(
+ 'g:i a' => '' . $g_i_a . ' g:i a',
+ 'H:i:s' => '' . $H_i_s . ' H:i:s',
+ 'other' => '' . __('Custom:','acf') . ' '
+ )
+ ));
+
+
+ // return_format
+ acf_render_field_setting( $field, array(
+ 'label' => __('Return Format','acf'),
+ 'instructions' => __('The format returned via template functions','acf'),
+ 'type' => 'radio',
+ 'name' => 'return_format',
+ 'other_choice' => 1,
+ 'choices' => array(
+ 'g:i a' => '' . $g_i_a . ' g:i a',
+ 'H:i:s' => '' . $H_i_s . ' H:i:s',
+ 'other' => '' . __('Custom:','acf') . ' '
+ )
+ ));
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ return acf_format_date( $value, $field['return_format'] );
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_time_picker' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-true_false.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-true_false.php
new file mode 100644
index 0000000..d3a9e84
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-true_false.php
@@ -0,0 +1,269 @@
+name = 'true_false';
+ $this->label = __('True / False','acf');
+ $this->category = 'choice';
+ $this->defaults = array(
+ 'default_value' => 0,
+ 'message' => '',
+ 'ui' => 0,
+ 'ui_on_text' => '',
+ 'ui_off_text' => '',
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $input = array(
+ 'type' => 'checkbox',
+ 'id' => $field['id'],
+ 'name' => $field['name'],
+ 'value' => '1',
+ 'class' => $field['class'],
+ 'autocomplete' => 'off'
+ );
+
+ $hidden = array(
+ 'name' => $field['name'],
+ 'value' => 0
+ );
+
+ $active = $field['value'] ? true : false;
+ $switch = '';
+
+
+ // checked
+ if( $active ) $input['checked'] = 'checked';
+
+
+ // ui
+ if( $field['ui'] ) {
+
+ // vars
+ if( $field['ui_on_text'] === '' ) $field['ui_on_text'] = __('Yes', 'acf');
+ if( $field['ui_off_text'] === '' ) $field['ui_off_text'] = __('No', 'acf');
+
+
+ // update input
+ $input['class'] .= ' acf-switch-input';
+ //$input['style'] = 'display:none;';
+
+ $switch .= '';
+ $switch .= '
'.$field['ui_on_text'].' ';
+ $switch .= '
'.$field['ui_off_text'].' ';
+ $switch .= '
';
+ $switch .= '
';
+
+ }
+
+?>
+
+
+
+ />
+
+
+
+
+ __('Message','acf'),
+ 'instructions' => __('Displays text alongside the checkbox','acf'),
+ 'type' => 'text',
+ 'name' => 'message',
+ ));
+
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => '',
+ 'type' => 'true_false',
+ 'name' => 'default_value',
+ ));
+
+
+ // ui
+ acf_render_field_setting( $field, array(
+ 'label' => __('Stylised UI','acf'),
+ 'instructions' => '',
+ 'type' => 'true_false',
+ 'name' => 'ui',
+ 'ui' => 1,
+ 'class' => 'acf-field-object-true-false-ui'
+ ));
+
+
+ // on_text
+ acf_render_field_setting( $field, array(
+ 'label' => __('On Text','acf'),
+ 'instructions' => __('Text shown when active','acf'),
+ 'type' => 'text',
+ 'name' => 'ui_on_text',
+ 'placeholder' => __('Yes', 'acf')
+ ));
+
+
+ // on_text
+ acf_render_field_setting( $field, array(
+ 'label' => __('Off Text','acf'),
+ 'instructions' => __('Text shown when inactive','acf'),
+ 'type' => 'text',
+ 'name' => 'ui_off_text',
+ 'placeholder' => __('No', 'acf')
+ ));
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ return empty($value) ? false : true;
+
+ }
+
+
+ /*
+ * validate_value
+ *
+ * description
+ *
+ * @type function
+ * @date 11/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function validate_value( $valid, $value, $field, $input ){
+
+ // bail early if not required
+ if( ! $field['required'] ) {
+
+ return $valid;
+
+ }
+
+
+ // value may be '0'
+ if( !$value ) {
+
+ return false;
+
+ }
+
+
+ // return
+ return $valid;
+
+ }
+
+
+ /*
+ * translate_field
+ *
+ * This function will translate field settings
+ *
+ * @type function
+ * @date 8/03/2016
+ * @since 5.3.2
+ *
+ * @param $field (array)
+ * @return $field
+ */
+
+ function translate_field( $field ) {
+
+ // translate
+ $field['message'] = acf_translate( $field['message'] );
+ $field['ui_on_text'] = acf_translate( $field['ui_on_text'] );
+ $field['ui_off_text'] = acf_translate( $field['ui_off_text'] );
+
+
+ // return
+ return $field;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_true_false' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-url.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-url.php
new file mode 100644
index 0000000..aac378e
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-url.php
@@ -0,0 +1,169 @@
+name = 'url';
+ $this->label = __("Url",'acf');
+ $this->defaults = array(
+ 'default_value' => '',
+ 'placeholder' => '',
+ );
+
+ }
+
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @param $field - an array holding all the field's data
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ */
+
+ function render_field( $field ) {
+
+ // vars
+ $atts = array();
+ $keys = array( 'type', 'id', 'class', 'name', 'value', 'placeholder', 'pattern' );
+ $keys2 = array( 'readonly', 'disabled', 'required' );
+ $html = '';
+
+
+ // atts (value="123")
+ foreach( $keys as $k ) {
+ if( isset($field[ $k ]) ) $atts[ $k ] = $field[ $k ];
+ }
+
+
+ // atts2 (disabled="disabled")
+ foreach( $keys2 as $k ) {
+ if( !empty($field[ $k ]) ) $atts[ $k ] = $k;
+ }
+
+
+ // remove empty atts
+ $atts = acf_clean_atts( $atts );
+
+
+ // render
+ $html .= '';
+ $html .= ' ' . acf_get_text_input( $atts ) ;
+ $html .= '
';
+
+
+ // return
+ echo $html;
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_settings( $field ) {
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => __('Appears when creating a new post','acf'),
+ 'type' => 'text',
+ 'name' => 'default_value',
+ ));
+
+
+ // placeholder
+ acf_render_field_setting( $field, array(
+ 'label' => __('Placeholder Text','acf'),
+ 'instructions' => __('Appears within the input','acf'),
+ 'type' => 'text',
+ 'name' => 'placeholder',
+ ));
+
+ }
+
+
+ /*
+ * validate_value
+ *
+ * description
+ *
+ * @type function
+ * @date 11/02/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function validate_value( $valid, $value, $field, $input ){
+
+ // bail early if empty
+ if( empty($value) ) {
+
+ return $valid;
+
+ }
+
+
+ if( strpos($value, '://') !== false ) {
+
+ // url
+
+ } elseif( strpos($value, '//') === 0 ) {
+
+ // protocol relative url
+
+ } else {
+
+ $valid = __('Value must be a valid URL', 'acf');
+
+ }
+
+
+ // return
+ return $valid;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_url' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-user.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-user.php
new file mode 100644
index 0000000..d45ea02
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-user.php
@@ -0,0 +1,586 @@
+name = 'user';
+ $this->label = __("User",'acf');
+ $this->category = 'relational';
+ $this->defaults = array(
+ 'role' => '',
+ 'multiple' => 0,
+ 'allow_null' => 0,
+ );
+
+
+ // extra
+ add_action('wp_ajax_acf/fields/user/query', array($this, 'ajax_query'));
+ add_action('wp_ajax_nopriv_acf/fields/user/query', array($this, 'ajax_query'));
+
+ }
+
+
+ /*
+ * ajax_query
+ *
+ * description
+ *
+ * @type function
+ * @date 24/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function ajax_query() {
+
+ // validate
+ if( !acf_verify_ajax() ) die();
+
+
+ // get choices
+ $response = $this->get_ajax_query( $_POST );
+
+
+ // return
+ acf_send_ajax_results($response);
+
+ }
+
+
+ /*
+ * get_ajax_query
+ *
+ * This function will return an array of data formatted for use in a select2 AJAX response
+ *
+ * @type function
+ * @date 15/10/2014
+ * @since 5.0.9
+ *
+ * @param $options (array)
+ * @return (array)
+ */
+
+ function get_ajax_query( $options = array() ) {
+
+ // defaults
+ $options = acf_parse_args($options, array(
+ 'post_id' => 0,
+ 's' => '',
+ 'field_key' => '',
+ 'paged' => 1
+ ));
+
+
+ // load field
+ $field = acf_get_field( $options['field_key'] );
+ if( !$field ) return false;
+
+
+ // vars
+ $results = array();
+ $args = array();
+ $s = false;
+ $is_search = false;
+
+
+ // paged
+ $args['users_per_page'] = 20;
+ $args['paged'] = $options['paged'];
+
+
+ // search
+ if( $options['s'] !== '' ) {
+
+ // strip slashes (search may be integer)
+ $s = wp_unslash( strval($options['s']) );
+
+
+ // update vars
+ $args['s'] = $s;
+ $is_search = true;
+
+ }
+
+
+ // role
+ if( !empty($field['role']) ) {
+
+ $args['role'] = acf_get_array( $field['role'] );
+
+ }
+
+
+ // search
+ if( $is_search ) {
+
+ // append to $args
+ $args['search'] = '*' . $options['s'] . '*';
+
+
+ // add reference
+ $this->field = $field;
+
+
+ // add filter to modify search colums
+ add_filter('user_search_columns', array($this, 'user_search_columns'), 10, 3);
+
+ }
+
+
+ // filters
+ $args = apply_filters("acf/fields/user/query", $args, $field, $options['post_id']);
+ $args = apply_filters("acf/fields/user/query/name={$field['_name']}", $args, $field, $options['post_id']);
+ $args = apply_filters("acf/fields/user/query/key={$field['key']}", $args, $field, $options['post_id']);
+
+
+ // get users
+ $groups = acf_get_grouped_users( $args );
+
+
+ // loop
+ if( !empty($groups) ) {
+
+ foreach( array_keys($groups) as $group_title ) {
+
+ // vars
+ $users = acf_extract_var( $groups, $group_title );
+ $data = array(
+ 'text' => $group_title,
+ 'children' => array()
+ );
+
+
+ // append users
+ foreach( array_keys($users) as $user_id ) {
+
+ $users[ $user_id ] = $this->get_result( $users[ $user_id ], $field, $options['post_id'] );
+
+ };
+
+
+ // order by search
+ if( $is_search && empty($args['orderby']) ) {
+
+ $users = acf_order_by_search( $users, $args['s'] );
+
+ }
+
+
+ // append to $data
+ foreach( $users as $id => $title ) {
+
+ $data['children'][] = array(
+ 'id' => $id,
+ 'text' => $title
+ );
+
+ }
+
+
+ // append to $r
+ $results[] = $data;
+
+ }
+
+
+ }
+
+ // optgroup or single
+ if( !empty($args['role']) && count($args['role']) == 1 ) {
+
+ $results = $results[0]['children'];
+
+ }
+
+
+ // vars
+ $response = array(
+ 'results' => $results,
+ 'limit' => $args['users_per_page']
+ );
+
+
+ // return
+ return $response;
+
+ }
+
+
+
+ /*
+ * get_result
+ *
+ * This function returns the HTML for a result
+ *
+ * @type function
+ * @date 1/11/2013
+ * @since 5.0.0
+ *
+ * @param $post (object)
+ * @param $field (array)
+ * @param $post_id (int) the post_id to which this value is saved to
+ * @return (string)
+ */
+
+ function get_result( $user, $field, $post_id = 0 ) {
+
+ // get post_id
+ if( !$post_id ) $post_id = acf_get_form_data('post_id');
+
+
+ // vars
+ $result = $user->user_login;
+
+
+ // append name
+ if( $user->first_name ) {
+
+ $result .= ' (' . $user->first_name;
+
+ if( $user->last_name ) {
+
+ $result .= ' ' . $user->last_name;
+
+ }
+
+ $result .= ')';
+
+ }
+
+
+ // filters
+ $result = apply_filters("acf/fields/user/result", $result, $user, $field, $post_id);
+ $result = apply_filters("acf/fields/user/result/name={$field['_name']}", $result, $user, $field, $post_id);
+ $result = apply_filters("acf/fields/user/result/key={$field['key']}", $result, $user, $field, $post_id);
+
+
+ // return
+ return $result;
+
+ }
+
+
+ /*
+ * user_search_columns
+ *
+ * This function will modify the columns which the user AJAX search looks in
+ *
+ * @type function
+ * @date 17/06/2014
+ * @since 5.0.0
+ *
+ * @param $columns (array)
+ * @return $columns
+ */
+
+ function user_search_columns( $columns, $search, $WP_User_Query ) {
+
+ // bail early if no field
+ if( empty($this->field) ) {
+
+ return $columns;
+
+ }
+
+
+ // vars
+ $field = $this->field;
+
+
+ // filter for 3rd party customization
+ $columns = apply_filters("acf/fields/user/search_columns", $columns, $search, $WP_User_Query, $field);
+ $columns = apply_filters("acf/fields/user/search_columns/name={$field['_name']}", $columns, $search, $WP_User_Query, $field);
+ $columns = apply_filters("acf/fields/user/search_columns/key={$field['key']}", $columns, $search, $WP_User_Query, $field);
+
+
+ // return
+ return $columns;
+
+ }
+
+ /*
+ * render_field()
+ *
+ * Create the HTML interface for your field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field( $field ) {
+
+ // Change Field into a select
+ $field['type'] = 'select';
+ $field['ui'] = 1;
+ $field['ajax'] = 1;
+ $field['choices'] = array();
+
+
+ // populate choices
+ if( !empty($field['value']) ) {
+
+ // force value to array
+ $field['value'] = acf_get_array( $field['value'] );
+
+
+ // convert values to int
+ $field['value'] = array_map('intval', $field['value']);
+
+
+ $users = get_users(array(
+ 'include' => $field['value']
+ ));
+
+
+ if( !empty($users) ) {
+
+ foreach( $users as $user ) {
+
+ $field['choices'][ $user->ID ] = $this->get_result( $user, $field );
+
+ }
+
+ }
+
+ }
+
+
+ // render
+ acf_render_field( $field );
+
+ }
+
+
+ /*
+ * render_field_settings()
+ *
+ * Create extra options for your field. This is rendered when editing a field.
+ * The value of $field['name'] can be used (like bellow) to save extra data to the $field
+ *
+ * @type action
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field - an array holding all the field's data
+ */
+
+ function render_field_settings( $field ) {
+
+ acf_render_field_setting( $field, array(
+ 'label' => __('Filter by role','acf'),
+ 'instructions' => '',
+ 'type' => 'select',
+ 'name' => 'role',
+ 'choices' => acf_get_pretty_user_roles(),
+ 'multiple' => 1,
+ 'ui' => 1,
+ 'allow_null' => 1,
+ 'placeholder' => __("All user roles",'acf'),
+ ));
+
+
+
+ // allow_null
+ acf_render_field_setting( $field, array(
+ 'label' => __('Allow Null?','acf'),
+ 'instructions' => '',
+ 'name' => 'allow_null',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // multiple
+ acf_render_field_setting( $field, array(
+ 'label' => __('Select multiple values?','acf'),
+ 'instructions' => '',
+ 'name' => 'multiple',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ }
+
+
+ /*
+ * update_value()
+ *
+ * This filter is appied to the $value before it is updated in the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value - the value which will be saved in the database
+ * @param $post_id - the $post_id of which the value will be saved
+ * @param $field - the field array holding all the field options
+ *
+ * @return $value - the modified value
+ */
+
+ function update_value( $value, $post_id, $field ) {
+
+ // array?
+ if( is_array($value) && isset($value['ID']) ) {
+
+ $value = $value['ID'];
+
+ }
+
+ // object?
+ if( is_object($value) && isset($value->ID) ) {
+
+ $value = $value->ID;
+
+ }
+
+
+ // return
+ return $value;
+ }
+
+
+ /*
+ * load_value()
+ *
+ * This filter is applied to the $value after it is loaded from the db
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value found in the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ * @return $value
+ */
+
+ function load_value( $value, $post_id, $field ) {
+
+ // ACF4 null
+ if( $value === 'null' ) {
+
+ return false;
+
+ }
+
+
+ // return
+ return $value;
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // bail early if no value
+ if( empty($value) ) {
+
+ return $value;
+
+ }
+
+
+ // force value to array
+ $value = acf_get_array( $value );
+
+
+ // convert values to int
+ $value = array_map('intval', $value);
+
+
+ // load users
+ foreach( array_keys($value) as $i ) {
+
+ // vars
+ $user_id = $value[ $i ];
+ $user_data = get_userdata( $user_id );
+
+
+ //cope with deleted users by @adampope
+ if( !is_object($user_data) ) {
+
+ unset( $value[ $i ] );
+ continue;
+
+ }
+
+
+ // append to array
+ $value[ $i ] = array();
+ $value[ $i ]['ID'] = $user_id;
+ $value[ $i ]['user_firstname'] = $user_data->user_firstname;
+ $value[ $i ]['user_lastname'] = $user_data->user_lastname;
+ $value[ $i ]['nickname'] = $user_data->nickname;
+ $value[ $i ]['user_nicename'] = $user_data->user_nicename;
+ $value[ $i ]['display_name'] = $user_data->display_name;
+ $value[ $i ]['user_email'] = $user_data->user_email;
+ $value[ $i ]['user_url'] = $user_data->user_url;
+ $value[ $i ]['user_registered'] = $user_data->user_registered;
+ $value[ $i ]['user_description'] = $user_data->user_description;
+ $value[ $i ]['user_avatar'] = get_avatar( $user_id );
+
+ }
+
+
+ // convert back from array if neccessary
+ if( !$field['multiple'] ) {
+
+ $value = array_shift($value);
+
+ }
+
+
+ // return value
+ return $value;
+
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_user' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-wysiwyg.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-wysiwyg.php
new file mode 100644
index 0000000..2756d5e
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-wysiwyg.php
@@ -0,0 +1,508 @@
+name = 'wysiwyg';
+ $this->label = __("Wysiwyg Editor",'acf');
+ $this->category = 'content';
+ $this->defaults = array(
+ 'tabs' => 'all',
+ 'toolbar' => 'full',
+ 'media_upload' => 1,
+ 'default_value' => '',
+ 'delay' => 0
+ );
+
+
+ // add acf_the_content filters
+ $this->add_filters();
+
+ }
+
+
+ /*
+ * add_filters
+ *
+ * This function will add filters to 'acf_the_content'
+ *
+ * @type function
+ * @date 20/09/2016
+ * @since 5.4.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function add_filters() {
+
+ // wp-includes/class-wp-embed.php
+ if( !empty($GLOBALS['wp_embed']) ) {
+
+ add_filter( 'acf_the_content', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 );
+ add_filter( 'acf_the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
+
+ }
+
+
+ // wp-includes/default-filters.php
+ add_filter( 'acf_the_content', 'capital_P_dangit', 11 );
+ add_filter( 'acf_the_content', 'wptexturize' );
+ add_filter( 'acf_the_content', 'convert_smilies', 20 );
+
+ // Removed in 4.4
+ if( acf_version_compare('wp', '<', '4.4') ) {
+ add_filter( 'acf_the_content', 'convert_chars' );
+ }
+
+ add_filter( 'acf_the_content', 'wpautop' );
+ add_filter( 'acf_the_content', 'shortcode_unautop' );
+
+
+ // should only be for the_content (causes double image on attachment page)
+ //add_filter( 'acf_the_content', 'prepend_attachment' );
+
+
+ // Added in 4.4
+ if( function_exists('wp_make_content_images_responsive') ) {
+ add_filter( 'acf_the_content', 'wp_make_content_images_responsive' );
+ }
+
+ add_filter( 'acf_the_content', 'do_shortcode', 11);
+
+ }
+
+
+ /*
+ * get_toolbars
+ *
+ * This function will return an array of toolbars for the WYSIWYG field
+ *
+ * @type function
+ * @date 18/04/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function get_toolbars() {
+
+ // vars
+ $editor_id = 'acf_content';
+
+
+ // toolbars
+ $toolbars = array();
+ $mce_buttons = 'formatselect, bold, italic, bullist, numlist, blockquote, alignleft, aligncenter, alignright, link, unlink, wp_more, spellchecker, fullscreen, wp_adv';
+ $mce_buttons_2 = 'strikethrough, hr, forecolor, pastetext, removeformat, charmap, outdent, indent, undo, redo, wp_help';
+ $teeny_mce_buttons = 'bold, italic, underline, blockquote, strikethrough, bullist, numlist, alignleft, aligncenter, alignright, undo, redo, link, unlink, fullscreen';
+
+
+ // WP < 3.9
+ if( acf_version_compare('wp', '<', '3.9') ) {
+
+ $mce_buttons = 'bold, italic, strikethrough, bullist, numlist, blockquote, justifyleft, justifycenter, justifyright, link, unlink, wp_more, spellchecker, fullscreen, wp_adv';
+ $mce_buttons_2 = 'formatselect, underline, justifyfull, forecolor, pastetext, pasteword, removeformat, charmap, outdent, indent, undo, redo, wp_help';
+ $teeny_mce_buttons = 'bold, italic, underline, blockquote, strikethrough, bullist, numlist, justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen';
+
+ // WP < 4.7
+ } elseif( acf_version_compare('wp', '<', '4.7') ) {
+
+ $mce_buttons = 'bold, italic, strikethrough, bullist, numlist, blockquote, hr, alignleft, aligncenter, alignright, link, unlink, wp_more, spellchecker, fullscreen, wp_adv';
+ $mce_buttons_2 = 'formatselect, underline, alignjustify, forecolor, pastetext, removeformat, charmap, outdent, indent, undo, redo, wp_help';
+ //$teeny_mce_buttons = 'bold, italic, underline, blockquote, strikethrough, bullist, numlist, alignleft, aligncenter, alignright, undo, redo, link, unlink, fullscreen';
+
+ }
+
+
+ // explode
+ $mce_buttons = explode(', ', $mce_buttons);
+ $mce_buttons_2 = explode(', ', $mce_buttons_2);
+ $teeny_mce_buttons = explode(', ', $teeny_mce_buttons);
+
+
+ // Full
+ $toolbars['Full'] = array(
+ 1 => apply_filters('mce_buttons', $mce_buttons, $editor_id),
+ 2 => apply_filters('mce_buttons_2', $mce_buttons_2, $editor_id),
+ 3 => apply_filters('mce_buttons_3', array(), $editor_id),
+ 4 => apply_filters('mce_buttons_4', array(), $editor_id)
+ );
+
+
+ // Basic
+ $toolbars['Basic'] = array(
+ 1 => apply_filters('teeny_mce_buttons', $teeny_mce_buttons, $editor_id)
+ );
+
+
+ // Filter for 3rd party
+ $toolbars = apply_filters( 'acf/fields/wysiwyg/toolbars', $toolbars );
+
+
+ // return
+ return $toolbars;
+
+ }
+
+
+ /*
+ * input_admin_footer
+ *
+ * description
+ *
+ * @type function
+ * @date 6/03/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function input_admin_footer() {
+
+ // vars
+ $json = array();
+ $toolbars = $this->get_toolbars();
+
+
+ // bail ealry if no toolbars
+ if( empty($toolbars) ) {
+
+ return;
+
+ }
+
+
+ // loop through toolbars
+ foreach( $toolbars as $label => $rows ) {
+
+ // vars
+ $label = sanitize_title( $label );
+ $label = str_replace('-', '_', $label);
+
+
+ // append to $json
+ $json[ $label ] = array();
+
+
+ // convert to strings
+ if( !empty($rows) ) {
+
+ foreach( $rows as $i => $row ) {
+
+ $json[ $label ][ $i ] = implode(',', $row);
+
+ }
+
+ }
+
+ }
+
+
+?>
+
+=', '4.3') ) {
+
+ add_filter( 'acf_the_editor_content', 'format_for_editor', 10, 2 );
+
+ $button = 'data-wp-editor-id="' . $id . '"';
+
+ // WP < 4.3
+ } else {
+
+ $function = ($default_editor === 'html') ? 'wp_htmledit_pre' : 'wp_richedit_pre';
+
+ add_filter('acf_the_editor_content', $function, 10, 1);
+
+ $button = 'onclick="switchEditors.switchto(this);"';
+
+ }
+
+
+ // filter
+ $field['value'] = apply_filters( 'acf_the_editor_content', $field['value'], $default_editor );
+
+
+ // attr
+ $wrap = array(
+ 'id' => 'wp-' . $id . '-wrap',
+ 'class' => 'acf-editor-wrap wp-core-ui wp-editor-wrap ' . $switch_class,
+ 'data-toolbar' => $field['toolbar']
+ );
+
+
+ // delay
+ if( $field['delay'] ) {
+ $wrap['class'] .= ' delay';
+ }
+
+
+ // vars
+ $textarea = acf_get_textarea_input(array(
+ 'id' => $id,
+ 'class' => 'wp-editor-area',
+ 'name' => $field['name'],
+ 'style' => $height ? "height:{$height}px;" : '',
+ 'value' => '%s'
+ ));
+
+ ?>
+
+ get_toolbars();
+ $choices = array();
+
+ if( !empty($toolbars) ) {
+
+ foreach( $toolbars as $k => $v ) {
+
+ $label = $k;
+ $name = sanitize_title( $label );
+ $name = str_replace('-', '_', $name);
+
+ $choices[ $name ] = $label;
+ }
+ }
+
+
+ // default_value
+ acf_render_field_setting( $field, array(
+ 'label' => __('Default Value','acf'),
+ 'instructions' => __('Appears when creating a new post','acf'),
+ 'type' => 'textarea',
+ 'name' => 'default_value',
+ ));
+
+
+ // tabs
+ acf_render_field_setting( $field, array(
+ 'label' => __('Tabs','acf'),
+ 'instructions' => '',
+ 'type' => 'select',
+ 'name' => 'tabs',
+ 'choices' => array(
+ 'all' => __("Visual & Text",'acf'),
+ 'visual' => __("Visual Only",'acf'),
+ 'text' => __("Text Only",'acf'),
+ )
+ ));
+
+
+ // toolbar
+ acf_render_field_setting( $field, array(
+ 'label' => __('Toolbar','acf'),
+ 'instructions' => '',
+ 'type' => 'select',
+ 'name' => 'toolbar',
+ 'choices' => $choices
+ ));
+
+
+ // media_upload
+ acf_render_field_setting( $field, array(
+ 'label' => __('Show Media Upload Buttons?','acf'),
+ 'instructions' => '',
+ 'name' => 'media_upload',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+
+ // delay
+ acf_render_field_setting( $field, array(
+ 'label' => __('Delay initialization?','acf'),
+ 'instructions' => __('TinyMCE will not be initalized until field is clicked','acf'),
+ 'name' => 'delay',
+ 'type' => 'true_false',
+ 'ui' => 1,
+ ));
+
+ }
+
+
+ /*
+ * format_value()
+ *
+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
+ *
+ * @type filter
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $value (mixed) the value which was loaded from the database
+ * @param $post_id (mixed) the $post_id from which the value was loaded
+ * @param $field (array) the field array holding all the field options
+ *
+ * @return $value (mixed) the modified value
+ */
+
+ function format_value( $value, $post_id, $field ) {
+
+ // bail early if no value
+ if( empty($value) ) {
+
+ return $value;
+
+ }
+
+
+ // apply filters
+ $value = apply_filters( 'acf_the_content', $value );
+
+
+ // follow the_content function in /wp-includes/post-template.php
+ $value = str_replace(']]>', ']]>', $value);
+
+
+ return $value;
+ }
+
+}
+
+
+// initialize
+acf_register_field_type( 'acf_field_wysiwyg' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field.php
new file mode 100644
index 0000000..117f019
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field.php
@@ -0,0 +1,277 @@
+initialize();
+
+
+ // register info
+ acf_register_field_type_info(array(
+ 'label' => $this->label,
+ 'name' => $this->name,
+ 'category' => $this->category,
+ 'public' => $this->public
+ ));
+
+
+ // value
+ $this->add_field_filter('acf/load_value', array($this, 'load_value'), 10, 3);
+ $this->add_field_filter('acf/update_value', array($this, 'update_value'), 10, 3);
+ $this->add_field_filter('acf/format_value', array($this, 'format_value'), 10, 3);
+ $this->add_field_filter('acf/validate_value', array($this, 'validate_value'), 10, 4);
+ $this->add_field_action('acf/delete_value', array($this, 'delete_value'), 10, 3);
+
+
+ // field
+ $this->add_field_filter('acf/validate_field', array($this, 'validate_field'), 10, 1);
+ $this->add_field_filter('acf/load_field', array($this, 'load_field'), 10, 1);
+ $this->add_field_filter('acf/update_field', array($this, 'update_field'), 10, 1);
+ $this->add_field_filter('acf/duplicate_field', array($this, 'duplicate_field'), 10, 1);
+ $this->add_field_action('acf/delete_field', array($this, 'delete_field'), 10, 1);
+ $this->add_field_action('acf/render_field', array($this, 'render_field'), 9, 1);
+ $this->add_field_action('acf/render_field_settings', array($this, 'render_field_settings'), 9, 1);
+ $this->add_field_filter('acf/prepare_field', array($this, 'prepare_field'), 10, 1);
+ $this->add_field_filter('acf/translate_field', array($this, 'translate_field'), 10, 1);
+
+
+ // input actions
+ $this->add_action("acf/input/admin_enqueue_scripts", array($this, 'input_admin_enqueue_scripts'), 10, 0);
+ $this->add_action("acf/input/admin_head", array($this, 'input_admin_head'), 10, 0);
+ $this->add_action("acf/input/form_data", array($this, 'input_form_data'), 10, 1);
+ $this->add_filter("acf/input/admin_l10n", array($this, 'input_admin_l10n'), 10, 1);
+ $this->add_action("acf/input/admin_footer", array($this, 'input_admin_footer'), 10, 1);
+
+
+ // field group actions
+ $this->add_action("acf/field_group/admin_enqueue_scripts", array($this, 'field_group_admin_enqueue_scripts'), 10, 0);
+ $this->add_action("acf/field_group/admin_head", array($this, 'field_group_admin_head'), 10, 0);
+ $this->add_action("acf/field_group/admin_footer", array($this, 'field_group_admin_footer'), 10, 0);
+
+ }
+
+
+ /*
+ * initialize
+ *
+ * This function will initialize the field type
+ *
+ * @type function
+ * @date 27/6/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function initialize() {
+
+ /* do nothing */
+
+ }
+
+
+ /*
+ * add_filter
+ *
+ * This function checks if the function is_callable before adding the filter
+ *
+ * @type function
+ * @date 5/03/2014
+ * @since 5.0.0
+ *
+ * @param $tag (string)
+ * @param $function_to_add (string)
+ * @param $priority (int)
+ * @param $accepted_args (int)
+ * @return n/a
+ */
+
+ function add_filter( $tag = '', $function_to_add = '', $priority = 10, $accepted_args = 1 ) {
+
+ // bail early if no callable
+ if( !is_callable($function_to_add) ) return;
+
+
+ // add
+ add_filter( $tag, $function_to_add, $priority, $accepted_args );
+
+ }
+
+
+ /*
+ * add_field_filter
+ *
+ * This function will add a field type specific filter
+ *
+ * @type function
+ * @date 29/09/2016
+ * @since 5.4.0
+ *
+ * @param $tag (string)
+ * @param $function_to_add (string)
+ * @param $priority (int)
+ * @param $accepted_args (int)
+ * @return n/a
+ */
+
+ function add_field_filter( $tag = '', $function_to_add = '', $priority = 10, $accepted_args = 1 ) {
+
+ // append
+ $tag .= '/type=' . $this->name;
+
+
+ // add
+ $this->add_filter( $tag, $function_to_add, $priority, $accepted_args );
+
+ }
+
+
+ /*
+ * add_action
+ *
+ * This function checks if the function is_callable before adding the action
+ *
+ * @type function
+ * @date 5/03/2014
+ * @since 5.0.0
+ *
+ * @param $tag (string)
+ * @param $function_to_add (string)
+ * @param $priority (int)
+ * @param $accepted_args (int)
+ * @return n/a
+ */
+
+ function add_action( $tag = '', $function_to_add = '', $priority = 10, $accepted_args = 1 ) {
+
+ // bail early if no callable
+ if( !is_callable($function_to_add) ) return;
+
+
+ // add
+ add_action( $tag, $function_to_add, $priority, $accepted_args );
+
+ }
+
+
+ /*
+ * add_field_action
+ *
+ * This function will add a field type specific filter
+ *
+ * @type function
+ * @date 29/09/2016
+ * @since 5.4.0
+ *
+ * @param $tag (string)
+ * @param $function_to_add (string)
+ * @param $priority (int)
+ * @param $accepted_args (int)
+ * @return n/a
+ */
+
+ function add_field_action( $tag = '', $function_to_add = '', $priority = 10, $accepted_args = 1 ) {
+
+ // append
+ $tag .= '/type=' . $this->name;
+
+
+ // add
+ $this->add_action( $tag, $function_to_add, $priority, $accepted_args );
+
+ }
+
+
+ /*
+ * validate_field
+ *
+ * This function will append default settings to a field
+ *
+ * @type filter ("acf/validate_field/type={$this->name}")
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $field (array)
+ * @return $field (array)
+ */
+
+ function validate_field( $field ) {
+
+ // bail early if no defaults
+ if( !is_array($this->defaults) ) return $field;
+
+
+ // merge in defaults but keep order of $field keys
+ foreach( $this->defaults as $k => $v ) {
+
+ if( !isset($field[ $k ]) ) $field[ $k ] = $v;
+
+ }
+
+
+ // return
+ return $field;
+
+ }
+
+
+ /*
+ * admin_l10n
+ *
+ * This function will append l10n text translations to an array which is later passed to JS
+ *
+ * @type filter ("acf/input/admin_l10n")
+ * @since 3.6
+ * @date 23/01/13
+ *
+ * @param $l10n (array)
+ * @return $l10n (array)
+ */
+
+ function input_admin_l10n( $l10n ) {
+
+ // bail early if no defaults
+ if( empty($this->l10n) ) return $l10n;
+
+
+ // append
+ $l10n[ $this->name ] = $this->l10n;
+
+
+ // return
+ return $l10n;
+
+ }
+
+}
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-attachment.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-attachment.php
new file mode 100644
index 0000000..6de16e2
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-attachment.php
@@ -0,0 +1,288 @@
+=') ) {
+
+ add_action('admin_footer', array($this, 'admin_footer'), 0);
+
+ return true;
+
+ }
+
+
+ // return
+ return false;
+ }
+
+
+ /*
+ * 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 26/01/13
+ * @since 3.6.0
+ *
+ * @param N/A
+ * @return N/A
+ */
+
+ function admin_enqueue_scripts() {
+
+ // bail early if not valid page
+ if( !$this->validate_page() ) {
+
+ return;
+
+ }
+
+
+ // load acf scripts
+ acf_enqueue_scripts();
+
+ }
+
+
+ /*
+ * admin_footer
+ *
+ * This function will add acf_form_data to the WP 4.0 attachment grid
+ *
+ * @type action (admin_footer)
+ * @date 11/09/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_footer() {
+
+ // render post data
+ acf_form_data(array(
+ 'post_id' => 0,
+ 'nonce' => 'attachment',
+ 'ajax' => 1
+ ));
+
+
+?>
+
+validate_page();
+ $post_id = $post->ID;
+ $el = 'tr';
+ $args = array(
+ 'attachment' => $post_id
+ );
+
+
+ // get field groups
+ $field_groups = acf_get_field_groups( $args );
+
+
+ // render
+ if( !empty($field_groups) ) {
+
+ // get acf_form_data
+ ob_start();
+
+
+ acf_form_data(array(
+ 'post_id' => $post_id,
+ 'nonce' => 'attachment',
+ ));
+
+
+ // open
+ echo '';
+
+
+ // loop
+ foreach( $field_groups as $field_group ) {
+
+ // load fields
+ $fields = acf_get_fields( $field_group );
+
+
+ // override instruction placement for modal
+ if( !$is_page ) {
+
+ $field_group['instruction_placement'] = 'field';
+ }
+
+
+ // render
+ acf_render_fields( $post_id, $fields, $el, $field_group['instruction_placement'] );
+
+ }
+
+
+ // close
+ echo '';
+
+
+
+ $html = ob_get_contents();
+
+
+ ob_end_clean();
+
+
+ $form_fields[ 'acf-form-data' ] = array(
+ 'label' => '',
+ 'input' => 'html',
+ 'html' => $html
+ );
+
+ }
+
+
+ // return
+ return $form_fields;
+
+ }
+
+
+ /*
+ * save_attachment
+ *
+ * description
+ *
+ * @type function
+ * @date 8/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function save_attachment( $post, $attachment ) {
+
+ // bail early if not valid nonce
+ if( ! acf_verify_nonce('attachment') ) {
+
+ return $post;
+
+ }
+
+
+ // validate and save
+ if( acf_validate_save_post(true) ) {
+
+ acf_save_post( $post['ID'] );
+
+ }
+
+
+ // return
+ return $post;
+
+ }
+
+
+}
+
+new acf_form_attachment();
+
+endif;
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-comment.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-comment.php
new file mode 100644
index 0000000..41ac134
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-comment.php
@@ -0,0 +1,349 @@
+validate_page() ) {
+
+ return;
+
+ }
+
+
+ // load acf scripts
+ acf_enqueue_scripts();
+
+
+ // actions
+ add_action('admin_footer', array($this, 'admin_footer'), 10, 1);
+ add_action('add_meta_boxes_comment', array($this, 'edit_comment'), 10, 1);
+
+ }
+
+
+ /*
+ * edit_comment
+ *
+ * This function is run on the admin comment.php page and will render the ACF fields within custom metaboxes to look native
+ *
+ * @type function
+ * @date 19/10/13
+ * @since 5.0.0
+ *
+ * @param $comment (object)
+ * @return n/a
+ */
+
+ function edit_comment( $comment ) {
+
+ // vars
+ $post_id = "comment_{$comment->comment_ID}";
+
+
+ // get field groups
+ $field_groups = acf_get_field_groups(array(
+ 'comment' => get_post_type( $comment->comment_post_ID )
+ ));
+
+
+ // render
+ if( !empty($field_groups) ) {
+
+ // render post data
+ acf_form_data(array(
+ 'post_id' => $post_id,
+ 'nonce' => 'comment'
+ ));
+
+
+ foreach( $field_groups as $field_group ) {
+
+ // load fields
+ $fields = acf_get_fields( $field_group );
+
+
+ // vars
+ $o = array(
+ 'id' => 'acf-'.$field_group['ID'],
+ 'key' => $field_group['key'],
+ //'style' => $field_group['style'],
+ 'label' => $field_group['label_placement'],
+ 'edit_url' => '',
+ 'edit_title' => __('Edit field group', 'acf'),
+ //'visibility' => $visibility
+ );
+
+
+ // edit_url
+ if( $field_group['ID'] && acf_current_user_can_admin() ) {
+
+ $o['edit_url'] = admin_url('post.php?post=' . $field_group['ID'] . '&action=edit');
+
+ }
+
+ ?>
+
+ $post->post_type
+ ));
+
+
+ // bail early if no field groups
+ if( !$field_groups ) return $html;
+
+
+ // ob
+ ob_start();
+
+ // render post data
+ acf_form_data(array(
+ 'post_id' => $post_id,
+ 'nonce' => 'comment'
+ ));
+
+ echo '';
+
+
+ // append
+ $html .= ob_get_contents();
+ ob_end_clean();
+
+
+ // return
+ return $html;
+
+ }
+
+
+ /*
+ * save_comment
+ *
+ * This function will save the comment data
+ *
+ * @type function
+ * @date 19/10/13
+ * @since 5.0.0
+ *
+ * @param comment_id (int)
+ * @return n/a
+ */
+
+ function save_comment( $comment_id ) {
+
+ // bail early if not valid nonce
+ if( !acf_verify_nonce('comment') ) {
+ return $comment_id;
+ }
+
+
+ // kses
+ if( isset($_POST['acf']) ) {
+ $_POST['acf'] = wp_kses_post_deep( $_POST['acf'] );
+ }
+
+
+ // validate and save
+ if( acf_validate_save_post(true) ) {
+ acf_save_post( "comment_{$comment_id}" );
+ }
+
+ }
+
+
+ /*
+ * admin_footer
+ *
+ * description
+ *
+ * @type function
+ * @date 27/03/2015
+ * @since 5.1.5
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function admin_footer() {
+
+?>
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php
new file mode 100644
index 0000000..b8c43dc
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php
@@ -0,0 +1,471 @@
+preview_values = array();
+ $this->preview_fields = array();
+ $this->preview_errors = array();
+
+
+ // actions
+ add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
+ add_action('customize_preview_init', array($this, 'customize_preview_init'), 1, 1);
+ add_action('customize_save', array($this, 'customize_save'), 1, 1);
+
+
+ // save
+ add_filter('widget_update_callback', array($this, 'save_widget'), 10, 4);
+
+ }
+
+
+ /*
+ * 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 26/01/13
+ * @since 3.6.0
+ *
+ * @param N/A
+ * @return N/A
+ */
+
+ function admin_enqueue_scripts() {
+
+ // validate screen
+ if( !acf_is_screen('customize') ) return;
+
+
+ // load acf scripts
+ acf_enqueue_scripts();
+
+
+ // actions
+ add_action('acf/input/admin_footer', array($this, 'admin_footer'), 1);
+
+ }
+
+
+ /*
+ * save_widget
+ *
+ * This function will hook into the widget update filter and save ACF data
+ *
+ * @type function
+ * @date 27/05/2015
+ * @since 5.2.3
+ *
+ * @param $instance (array) widget settings
+ * @param $new_instance (array) widget settings
+ * @param $old_instance (array) widget settings
+ * @param $widget (object) widget info
+ * @return $instance
+ */
+
+ function save_widget( $instance, $new_instance, $old_instance, $widget ) {
+
+ // bail ealry if not valid (customize + acf values + nonce)
+ if( !isset($_POST['wp_customize']) || !isset($new_instance['acf']) || !acf_verify_nonce('widget') ) return $instance;
+
+
+ // vars
+ $data = array(
+ 'post_id' => "widget_{$widget->id}",
+ 'values' => array(),
+ 'fields' => array()
+ );
+
+
+ // append values
+ $data['values'] = $new_instance['acf'];
+
+
+ // append fields (name => key relationship) - used later in 'acf/get_field_reference' for customizer previews
+ foreach( $data['values'] as $k => $v ) {
+
+ // get field
+ $field = acf_get_field( $k );
+
+
+ // continue if no field
+ if( !$field ) continue;
+
+
+ // update
+ $data['fields'][ $field['name'] ] = $field['key'];
+
+ }
+
+
+ // append data to instance
+ $instance['acf'] = $data;
+
+
+
+ // return
+ return $instance;
+
+ }
+
+
+ /*
+ * settings
+ *
+ * This function will return an array of cutomizer settings that include ACF data
+ * similar to `$customizer->settings();`
+ *
+ * @type function
+ * @date 22/03/2016
+ * @since 5.3.2
+ *
+ * @param $customizer (object)
+ * @return $value (mixed)
+ */
+
+ function settings( $customizer ) {
+
+ // vars
+ $data = array();
+ $settings = $customizer->settings();
+
+
+ // bail ealry if no settings
+ if( empty($settings) ) return false;
+
+
+ // loop over settings
+ foreach( $settings as $setting ) {
+
+ // vars
+ $id = $setting->id;
+
+
+ // verify settings type
+ if( substr($id, 0, 6) == 'widget' || substr($id, 0, 7) == 'nav_menu' ) {
+ // allow
+ } else {
+ continue;
+ }
+
+
+ // get value
+ $value = $setting->post_value();
+
+
+ // bail early if no acf
+ if( !is_array($value) || !isset($value['acf']) ) continue;
+
+
+ // set data
+ $setting->acf = $value['acf'];
+
+
+ // append
+ $data[] = $setting;
+
+ }
+
+
+ // bail ealry if no settings
+ if( empty($data) ) return false;
+
+
+ // return
+ return $data;
+
+ }
+
+
+ /*
+ * customize_preview_init
+ *
+ * This function is called when customizer preview is initialized
+ *
+ * @type function
+ * @date 22/03/2016
+ * @since 5.3.2
+ *
+ * @param $customizer (object)
+ * @return n/a
+ */
+
+ function customize_preview_init( $customizer ) {
+
+ // get customizer settings (widgets)
+ $settings = $this->settings( $customizer );
+
+
+ // bail ealry if no settings
+ if( empty($settings) ) return;
+
+
+ // append values
+ foreach( $settings as $setting ) {
+
+ // get acf data
+ $data = $setting->acf;
+
+
+ // append acf_value to preview_values
+ $this->preview_values[ $data['post_id'] ] = $data['values'];
+ $this->preview_fields[ $data['post_id'] ] = $data['fields'];
+
+ }
+
+
+ // bail ealry if no preview_values
+ if( empty($this->preview_values) ) return;
+
+
+ // add filter
+ add_filter('acf/get_field_reference', array($this, 'get_field_reference'), 10, 3);
+
+ }
+
+
+ /*
+ * get_field_reference
+ *
+ * This function will return a field_key for a given field name + post_id
+ * Normally, ACF would lookup the DB fro this connection, but a new preview widget has not yet saved anything to the DB
+ *
+ * @type function
+ * @date 12/05/2016
+ * @since 5.3.8
+ *
+ * @param $field_key (string)
+ * @param $field_name (string)
+ * @param $post_id (mixed)
+ * @return $field_key
+ */
+
+ function get_field_reference( $field_key, $field_name, $post_id ) {
+
+ // look for reference
+ if( isset($this->preview_fields[ $post_id ][ $field_name ]) ) {
+
+ // update key
+ $field_key = $this->preview_fields[ $post_id ][ $field_name ];
+ $field_value = $this->preview_values[ $post_id ][ $field_key ];
+
+
+ // cache value
+ acf_set_cache("get_value/post_id={$post_id}/name={$field_name}", $field_value);
+
+ }
+
+
+ // return
+ return $field_key;
+
+ }
+
+
+ /*
+ * customize_save
+ *
+ * This function is called when customizer saves a widget.
+ * Normally, the widget_update_callback filter would be used, but the customizer disables this and runs a custom action
+ * class-customizer-settings.php will save the widget data via the function set_root_value which uses update_option
+ *
+ * @type function
+ * @date 22/03/2016
+ * @since 5.3.2
+ *
+ * @param $customizer (object)
+ * @return n/a
+ */
+
+ function customize_save( $customizer ) {
+
+ // get customizer settings (widgets)
+ $settings = $this->settings( $customizer );
+
+
+ // bail ealry if no settings
+ if( empty($settings) ) return;
+
+
+ // append values
+ foreach( $settings as $setting ) {
+
+ // get acf data
+ $data = $setting->acf;
+
+
+ // save acf data
+ acf_save_post( $data['post_id'], $data['values'] );
+
+
+ // remove [acf] data from saved widget array
+ $id_data = $setting->id_data();
+ add_filter('pre_update_option_' . $id_data['base'], array($this, 'pre_update_option'), 10, 3);
+
+ }
+
+ }
+
+
+ /*
+ * pre_update_option
+ *
+ * this function will remove the [acf] data from widget insance
+ *
+ * @type function
+ * @date 22/03/2016
+ * @since 5.3.2
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function pre_update_option( $value, $option, $old_value ) {
+
+ // bail ealry if no value
+ if( empty($value) ) return $value;
+
+
+ // loop over widgets
+ // WP saves all widgets (of the same type) as an array of widgets
+ foreach( $value as $i => $widget ) {
+
+ // bail ealry if no acf
+ if( !isset($widget['acf']) ) continue;
+
+
+ // remove widget
+ unset($value[ $i ]['acf']);
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * admin_footer
+ *
+ * This function will add some custom HTML to the footer of the edit page
+ *
+ * @type function
+ * @date 11/06/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_footer() {
+
+?>
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php
new file mode 100644
index 0000000..3ff9f12
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php
@@ -0,0 +1,707 @@
+fields = array(
+
+ '_post_title' => array(
+ 'prefix' => 'acf',
+ 'name' => '_post_title',
+ 'key' => '_post_title',
+ 'label' => __('Title', 'acf'),
+ 'type' => 'text',
+ 'required' => true,
+ ),
+
+ '_post_content' => array(
+ 'prefix' => 'acf',
+ 'name' => '_post_content',
+ 'key' => '_post_content',
+ 'label' => __('Content', 'acf'),
+ 'type' => 'wysiwyg',
+ ),
+
+ '_validate_email' => array(
+ 'prefix' => 'acf',
+ 'name' => '_validate_email',
+ 'key' => '_validate_email',
+ 'label' => __('Validate Email', 'acf'),
+ 'type' => 'text',
+ 'value' => '',
+ 'wrapper' => array('style' => 'display:none !important;')
+ )
+
+ );
+
+
+ // actions
+ add_action('acf/validate_save_post', array($this, 'validate_save_post'), 1);
+
+
+ // filters
+ add_filter('acf/pre_save_post', array($this, 'pre_save_post'), 5, 2);
+
+ }
+
+
+ /*
+ * validate_form
+ *
+ * description
+ *
+ * @type function
+ * @date 28/2/17
+ * @since 5.5.8
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function validate_form( $args ) {
+
+ // defaults
+ $args = wp_parse_args( $args, array(
+ 'id' => 'acf-form',
+ 'post_id' => false,
+ 'new_post' => false,
+ 'field_groups' => false,
+ 'fields' => false,
+ 'post_title' => false,
+ 'post_content' => false,
+ 'form' => true,
+ 'form_attributes' => array(),
+ 'return' => add_query_arg( 'updated', 'true', acf_get_current_url() ),
+ 'html_before_fields' => '',
+ 'html_after_fields' => '',
+ 'submit_value' => __("Update", 'acf'),
+ 'updated_message' => __("Post updated", 'acf'),
+ 'label_placement' => 'top',
+ 'instruction_placement' => 'label',
+ 'field_el' => 'div',
+ 'uploader' => 'wp',
+ 'honeypot' => true,
+ 'html_updated_message' => '', // 5.5.10
+ 'html_submit_button' => ' ', // 5.5.10
+ 'html_submit_spinner' => ' ', // 5.5.10
+ 'kses' => true // 5.6.5
+ ));
+
+ $args['form_attributes'] = wp_parse_args( $args['form_attributes'], array(
+ 'id' => $args['id'],
+ 'class' => 'acf-form',
+ 'action' => '',
+ 'method' => 'post',
+ ));
+
+
+ // filter post_id
+ $args['post_id'] = acf_get_valid_post_id( $args['post_id'] );
+
+
+ // new post?
+ if( $args['post_id'] === 'new_post' ) {
+
+ $args['new_post'] = wp_parse_args( $args['new_post'], array(
+ 'post_type' => 'post',
+ 'post_status' => 'draft',
+ ));
+
+ }
+
+
+ // filter
+ $args = apply_filters('acf/validate_form', $args);
+
+
+ // return
+ return $args;
+
+ }
+
+
+ /*
+ * add_form
+ *
+ * description
+ *
+ * @type function
+ * @date 28/2/17
+ * @since 5.5.8
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function add_form( $args = array() ) {
+
+ // validate
+ $args = $this->validate_form( $args );
+
+
+ // append
+ $this->forms[ $args['id'] ] = $args;
+
+ }
+
+
+ /*
+ * get_form
+ *
+ * description
+ *
+ * @type function
+ * @date 28/2/17
+ * @since 5.5.8
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function get_form( $id = '' ) {
+
+ // bail early if not set
+ if( !isset($this->forms[ $id ]) ) return false;
+
+
+ // return
+ return $this->forms[ $id ];
+
+ }
+
+
+ /*
+ * validate_save_post
+ *
+ * This function will validate fields from the above array
+ *
+ * @type function
+ * @date 7/09/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function validate_save_post() {
+
+ // register field if isset in $_POST
+ foreach( $this->fields as $k => $field ) {
+
+ // bail early if no in $_POST
+ if( !isset($_POST['acf'][ $k ]) ) continue;
+
+
+ // register
+ acf_add_local_field($field);
+
+ }
+
+
+ // honeypot
+ if( !empty($_POST['acf']['_validate_email']) ) {
+
+ acf_add_validation_error( '', __('Spam Detected', 'acf') );
+
+ }
+
+ }
+
+
+ /*
+ * pre_save_post
+ *
+ * description
+ *
+ * @type function
+ * @date 7/09/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function pre_save_post( $post_id, $form ) {
+
+ // vars
+ $save = array(
+ 'ID' => 0
+ );
+
+
+ // determine save data
+ if( is_numeric($post_id) ) {
+
+ // update post
+ $save['ID'] = $post_id;
+
+ } elseif( $post_id == 'new_post' ) {
+
+ // merge in new post data
+ $save = array_merge($save, $form['new_post']);
+
+ } else {
+
+ // not post
+ return $post_id;
+
+ }
+
+
+ // save post_title
+ if( isset($_POST['acf']['_post_title']) ) {
+
+ $save['post_title'] = acf_extract_var($_POST['acf'], '_post_title');
+
+ }
+
+
+ // save post_content
+ if( isset($_POST['acf']['_post_content']) ) {
+
+ $save['post_content'] = acf_extract_var($_POST['acf'], '_post_content');
+
+ }
+
+
+ // honeypot
+ if( !empty($_POST['acf']['_validate_email']) ) return false;
+
+
+ // validate
+ if( count($save) == 1 ) {
+
+ return $post_id;
+
+ }
+
+
+ // save
+ if( $save['ID'] ) {
+
+ wp_update_post( $save );
+
+ } else {
+
+ $post_id = wp_insert_post( $save );
+
+ }
+
+
+ // return
+ return $post_id;
+
+ }
+
+
+ /*
+ * enqueue
+ *
+ * This function will enqueue a form
+ *
+ * @type function
+ * @date 7/09/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function enqueue_form() {
+
+ // check
+ $this->check_submit_form();
+
+
+ // load acf scripts
+ acf_enqueue_scripts();
+
+ }
+
+
+ /*
+ * check_submit_form
+ *
+ * This function will maybe submit form data
+ *
+ * @type function
+ * @date 3/3/17
+ * @since 5.5.10
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function check_submit_form() {
+
+ // verify nonce
+ if( !acf_verify_nonce('acf_form') ) return;
+
+
+ // bail ealry if form not submit
+ if( empty($_POST['_acf_form']) ) return;
+
+
+ // load form
+ $form = json_decode( acf_decrypt($_POST['_acf_form']), true );
+
+
+ // bail ealry if form is corrupt
+ if( empty($form) ) return;
+
+
+ // kses
+ if( $form['kses'] && isset($_POST['acf']) ) {
+ $_POST['acf'] = wp_kses_post_deep( $_POST['acf'] );
+ }
+
+
+ // validate data
+ acf_validate_save_post(true);
+
+
+ // submit
+ $this->submit_form( $form );
+
+ }
+
+
+ /*
+ * submit_form
+ *
+ * This function will submit form data
+ *
+ * @type function
+ * @date 3/3/17
+ * @since 5.5.10
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function submit_form( $form ) {
+
+ // filter
+ $form = apply_filters('acf/pre_submit_form', $form);
+
+
+ // vars
+ $post_id = acf_maybe_get($form, 'post_id', 0);
+
+
+ // add global for backwards compatibility
+ $GLOBALS['acf_form'] = $form;
+
+
+ // allow for custom save
+ $post_id = apply_filters('acf/pre_save_post', $post_id, $form);
+
+
+ // save
+ acf_save_post( $post_id );
+
+
+ // restore form (potentially modified)
+ $form = $GLOBALS['acf_form'];
+
+
+ // action
+ do_action('acf/submit_form', $form, $post_id);
+
+
+ // vars
+ $return = acf_maybe_get($form, 'return', '');
+
+
+ // redirect
+ if( $return ) {
+
+ // update %placeholders%
+ $return = str_replace('%post_id%', $post_id, $return);
+ $return = str_replace('%post_url%', get_permalink($post_id), $return);
+
+
+ // redirect
+ wp_redirect( $return );
+ exit;
+
+ }
+
+ }
+
+
+ /*
+ * render
+ *
+ * description
+ *
+ * @type function
+ * @date 7/09/2016
+ * @since 5.4.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function render_form( $args = array() ) {
+
+ // array
+ if( is_array($args) ) {
+
+ $args = $this->validate_form( $args );
+
+ // id
+ } else {
+
+ $args = $this->get_form( $args );
+
+ }
+
+
+ // bail early if no args
+ if( !$args ) return false;
+
+
+ // load values from this post
+ $post_id = $args['post_id'];
+
+
+ // dont load values for 'new_post'
+ if( $post_id === 'new_post' ) $post_id = false;
+
+
+ // register local fields
+ foreach( $this->fields as $k => $field ) {
+
+ acf_add_local_field($field);
+
+ }
+
+
+ // vars
+ $field_groups = array();
+ $fields = array();
+
+
+ // post_title
+ if( $args['post_title'] ) {
+
+ // load local field
+ $_post_title = acf_get_field('_post_title');
+ $_post_title['value'] = $post_id ? get_post_field('post_title', $post_id) : '';
+
+
+ // append
+ $fields[] = $_post_title;
+
+ }
+
+
+ // post_content
+ if( $args['post_content'] ) {
+
+ // load local field
+ $_post_content = acf_get_field('_post_content');
+ $_post_content['value'] = $post_id ? get_post_field('post_content', $post_id) : '';
+
+
+ // append
+ $fields[] = $_post_content;
+
+ }
+
+
+ // specific fields
+ if( $args['fields'] ) {
+
+ foreach( $args['fields'] as $selector ) {
+
+ // append field ($strict = false to allow for better compatibility with field names)
+ $fields[] = acf_maybe_get_field( $selector, $post_id, false );
+
+ }
+
+ } elseif( $args['field_groups'] ) {
+
+ foreach( $args['field_groups'] as $selector ) {
+
+ $field_groups[] = acf_get_field_group( $selector );
+
+ }
+
+ } elseif( $args['post_id'] == 'new_post' ) {
+
+ $field_groups = acf_get_field_groups( $args['new_post'] );
+
+ } else {
+
+ $field_groups = acf_get_field_groups(array(
+ 'post_id' => $args['post_id']
+ ));
+
+ }
+
+
+ //load fields based on field groups
+ if( !empty($field_groups) ) {
+
+ foreach( $field_groups as $field_group ) {
+
+ $field_group_fields = acf_get_fields( $field_group );
+
+ if( !empty($field_group_fields) ) {
+
+ foreach( array_keys($field_group_fields) as $i ) {
+
+ $fields[] = acf_extract_var($field_group_fields, $i);
+ }
+
+ }
+
+ }
+
+ }
+
+
+ // honeypot
+ if( $args['honeypot'] ) {
+
+ $fields[] = acf_get_field('_validate_email');
+
+ }
+
+
+ // updated message
+ if( !empty($_GET['updated']) && $args['updated_message'] ) {
+
+ printf( $args['html_updated_message'], $args['updated_message'] );
+
+ }
+
+
+ // uploader (always set incase of multiple forms on the page)
+ acf_update_setting('uploader', $args['uploader']);
+
+
+ // display form
+ if( $args['form'] ): ?>
+
+
+ form_front = new acf_form_front();
+
+endif; // class_exists check
+
+
+/*
+* Functions
+*
+* alias of acf()->form->functions
+*
+* @type function
+* @date 11/06/2014
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+
+function acf_form_head() {
+
+ acf()->form_front->enqueue_form();
+
+}
+
+function acf_form( $args = array() ) {
+
+ acf()->form_front->render_form( $args );
+
+}
+
+function acf_get_form( $id = '' ) {
+
+ acf()->form_front->get_form( $id );
+
+}
+
+function acf_register_form( $args ) {
+
+ acf()->form_front->add_form( $args );
+
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-nav-menu.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-nav-menu.php
new file mode 100644
index 0000000..aa680a8
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-nav-menu.php
@@ -0,0 +1,323 @@
+update_nav_menu_items( $menu_id );
+
+ }
+
+
+ /*
+ * update_nav_menu_items
+ *
+ * description
+ *
+ * @type function
+ * @date 26/5/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function update_nav_menu_items( $menu_id ) {
+
+ // bail ealry if not set
+ if( empty($_POST['menu-item-acf']) ) return;
+
+
+ // loop
+ foreach( $_POST['menu-item-acf'] as $post_id => $values ) {
+
+ acf_save_post( $post_id, $values );
+
+ }
+
+ }
+
+
+ /*
+ * wp_edit_nav_menu_walker
+ *
+ * description
+ *
+ * @type function
+ * @date 26/5/17
+ * @since 5.6.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function wp_edit_nav_menu_walker( $class, $menu_id = 0 ) {
+
+ // global
+ global $acf_menu;
+
+
+ // set var
+ $acf_menu = (int) $menu_id;
+
+
+ // include walker
+ if( class_exists('Walker_Nav_Menu_Edit') ) {
+ acf_include('includes/walkers/class-acf-walker-nav-menu-edit.php');
+ }
+
+
+ // return
+ return 'ACF_Walker_Nav_Menu_Edit';
+
+ }
+
+
+ /*
+ * acf_validate_save_post
+ *
+ * This function will loop over $_POST data and validate
+ *
+ * @type action 'acf/validate_save_post' 5
+ * @date 7/09/2016
+ * @since 5.4.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function acf_validate_save_post() {
+
+ // bail ealry if not set
+ if( empty($_POST['menu-item-acf']) ) return;
+
+
+ // loop
+ foreach( $_POST['menu-item-acf'] as $post_id => $values ) {
+
+ // vars
+ $prefix = 'menu-item-acf['.$post_id.']';
+
+
+ // validate
+ acf_validate_values( $values, $prefix );
+
+ }
+
+ }
+
+
+ /*
+ * admin_footer
+ *
+ * This function will add some custom HTML to the footer of the edit page
+ *
+ * @type function
+ * @date 11/06/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_footer() {
+
+ // global
+ global $acf_menu;
+
+
+ // vars
+ $post_id = acf_get_term_post_id( 'nav_menu', $acf_menu );
+
+
+ // get field groups
+ $field_groups = acf_get_field_groups(array(
+ 'nav_menu' => $acf_menu
+ ));
+
+
+?>
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-post.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-post.php
new file mode 100644
index 0000000..febefa9
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-post.php
@@ -0,0 +1,632 @@
+post_id = $post->ID;
+ $this->typenow = $typenow;
+
+ }
+
+
+ // validate post type
+ if( in_array($typenow, array('acf-field-group', 'attachment')) ) {
+
+ return false;
+
+ }
+
+
+ // validate page (Shopp)
+ if( $pagenow == "admin.php" && isset( $_GET['page'] ) && $_GET['page'] == "shopp-products" && isset( $_GET['id'] ) ) {
+
+ $return = true;
+
+ $this->post_id = absint( $_GET['id'] );
+ $this->typenow = 'shopp_product';
+
+ }
+
+
+ // return
+ return $return;
+ }
+
+
+ /*
+ * 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 26/01/13
+ * @since 3.6.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_enqueue_scripts() {
+
+ // validate page
+ if( !$this->validate_page() ) return;
+
+
+ // load acf scripts
+ acf_enqueue_scripts();
+
+
+ // actions
+ add_action('acf/input/admin_head', array($this,'admin_head'));
+ add_action('acf/input/admin_footer', array($this,'admin_footer'));
+ }
+
+
+ /*
+ * admin_head
+ *
+ * This action will find and add field groups to the current edit page
+ *
+ * @type action (admin_head)
+ * @date 23/06/12
+ * @since 3.1.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_head() {
+
+ // vars
+ $style_found = false;
+
+
+ // get field groups
+ $field_groups = acf_get_field_groups();
+
+
+ // add meta boxes
+ if( !empty($field_groups) ) {
+
+ foreach( $field_groups as $i => $field_group ) {
+
+ // vars
+ $id = "acf-{$field_group['key']}";
+ $title = $field_group['title'];
+ $context = $field_group['position'];
+ $priority = 'high';
+ $args = array(
+ 'field_group' => $field_group,
+ 'visibility' => false
+ );
+
+
+ // tweaks to vars
+ if( $context == 'side' ) {
+
+ $priority = 'core';
+
+ }
+
+
+ // filter for 3rd party customization
+ $priority = apply_filters('acf/input/meta_box_priority', $priority, $field_group);
+
+
+ // visibility
+ $args['visibility'] = acf_get_field_group_visibility( $field_group, array(
+ 'post_id' => $this->post_id,
+ 'post_type' => $this->typenow
+ ));
+
+
+ // add meta box
+ add_meta_box( $id, $title, array($this, 'render_meta_box'), $this->typenow, $context, $priority, $args );
+
+
+ // update style
+ if( !$style_found && $args['visibility'] ) {
+
+ $style_found = true;
+
+ $this->style = acf_get_field_group_style( $field_group );
+
+ }
+
+ }
+
+ }
+
+
+ // Allow 'acf_after_title' metabox position
+ add_action('edit_form_after_title', array($this, 'edit_form_after_title'));
+
+
+ // remove postcustom metabox (removes expensive SQL query)
+ if( acf_get_setting('remove_wp_meta_box') ) {
+
+ remove_meta_box( 'postcustom', false, 'normal' );
+
+ }
+
+
+ // remove ACF values from meta postbox ()
+ add_filter('is_protected_meta', array($this, 'is_protected_meta'), 10, 3);
+
+ }
+
+
+ /*
+ * 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, $wp_meta_boxes;
+
+
+ // render post data
+ acf_form_data(array(
+ 'post_id' => $this->post_id,
+ 'nonce' => 'post',
+ 'ajax' => 1
+ ));
+
+
+ // render
+ do_meta_boxes( get_current_screen(), 'acf_after_title', $post);
+
+
+ // clean up
+ unset( $wp_meta_boxes['post']['acf_after_title'] );
+
+ }
+
+
+ /*
+ * render_meta_box
+ *
+ * description
+ *
+ * @type function
+ * @date 20/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function render_meta_box( $post, $args ) {
+
+ // extract args
+ extract( $args ); // all variables from the add_meta_box function
+ extract( $args ); // all variables from the args argument
+
+
+ // vars
+ $o = array(
+ 'id' => $id,
+ 'key' => $field_group['key'],
+ 'style' => $field_group['style'],
+ 'label' => $field_group['label_placement'],
+ 'edit_url' => '',
+ 'edit_title' => __('Edit field group', 'acf'),
+ 'visibility' => $visibility
+ );
+
+
+ // edit_url
+ if( $field_group['ID'] && acf_current_user_can_admin() ) {
+
+ $o['edit_url'] = admin_url('post.php?post=' . $field_group['ID'] . '&action=edit');
+
+ }
+
+
+ // load and render fields
+ if( $visibility ) {
+
+ // load fields
+ $fields = acf_get_fields( $field_group );
+
+
+ // render
+ acf_render_fields( $this->post_id, $fields, 'div', $field_group['instruction_placement'] );
+
+ // render replace-me div
+ } else {
+
+ echo '';
+
+ }
+
+ ?>
+
+' . $this->style . '';
+
+ }
+
+
+ /*
+ * get_field_groups
+ *
+ * This function will return all the JSON data needed to render new metaboxes
+ *
+ * @type function
+ * @date 21/10/13
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function get_field_groups() {
+
+ // options
+ $options = acf_parse_args($_POST, array(
+ 'nonce' => '',
+ 'post_id' => 0,
+ 'ajax' => 1,
+ 'exists' => array()
+ ));
+
+
+ // vars
+ $json = array();
+ $exists = acf_extract_var( $options, 'exists' );
+
+
+ // verify nonce
+ if( !acf_verify_ajax() ) die();
+
+
+ // get field groups
+ $field_groups = acf_get_field_groups( $options );
+
+
+ // bail early if no field groups
+ if( empty($field_groups) ) {
+
+ wp_send_json_success( $json );
+
+ }
+
+
+ // loop through field groups
+ foreach( $field_groups as $i => $field_group ) {
+
+ // vars
+ $item = array(
+ //'ID' => $field_group['ID'], - JSON does not have ID (not used by JS anyway)
+ 'key' => $field_group['key'],
+ 'title' => $field_group['title'],
+ 'html' => '',
+ 'style' => ''
+ );
+
+
+ // style
+ if( $i == 0 ) {
+
+ $item['style'] = acf_get_field_group_style( $field_group );
+
+ }
+
+
+ // html
+ if( !in_array($field_group['key'], $exists) ) {
+
+ // load fields
+ $fields = acf_get_fields( $field_group );
+
+
+ // get field HTML
+ ob_start();
+
+
+ // render
+ acf_render_fields( $options['post_id'], $fields, 'div', $field_group['instruction_placement'] );
+
+
+ $item['html'] = ob_get_clean();
+
+
+ }
+
+
+ // append
+ $json[] = $item;
+
+ }
+
+
+ // return
+ wp_send_json_success( $json );
+
+ }
+
+
+ /*
+ * wp_insert_post_empty_content
+ *
+ * This function will allow WP to insert a new post without title / content if ACF data exists
+ *
+ * @type function
+ * @date 16/07/2014
+ * @since 5.0.1
+ *
+ * @param $maybe_empty (bool) whether the post should be considered "empty"
+ * @param $postarr (array) Array of post data
+ * @return $maybe_empty
+ */
+
+ function wp_insert_post_empty_content( $maybe_empty, $postarr ) {
+
+ if( $maybe_empty && acf_maybe_get_POST('_acf_changed') ) {
+
+ $maybe_empty = false;
+
+ }
+
+
+ // return
+ return $maybe_empty;
+ }
+
+
+ /*
+ * allow_save_post
+ *
+ * This function will return true if the post is allowed to be saved
+ *
+ * @type function
+ * @date 26/06/2016
+ * @since 5.3.8
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function allow_save_post( $post ) {
+
+ // vars
+ $allow = true;
+
+
+ // disallow if is post type
+ $post_types = array( 'auto-draft', 'revision', 'acf-field', 'acf-field-group' );
+ if( in_array($post->post_type, $post_types) ) $allow = false;
+
+
+ // disallow if not the form post
+ $form_post_id = (int) acf_maybe_get_POST('post_ID');
+ if( $form_post_id && $form_post_id !== $post->ID ) $allow = false;
+
+
+ // revision (preview)
+ if( $post->post_type == 'revision' ) {
+
+ // allow if doing preview
+ if( acf_maybe_get_POST('wp-preview') == 'dopreview' ) $allow = true;
+
+
+ // disallow if not a revision of the form post
+ if( $form_post_id && $form_post_id !== $post->post_parent ) $allow = false;
+
+ }
+
+
+ // return
+ return $allow;
+
+ }
+
+
+ /*
+ * save_post
+ *
+ * This function will validate and save the $_POST 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 ) {
+
+ // bail ealry if no allowed to save this post type
+ if( !$this->allow_save_post($post) ) return $post_id;
+
+
+ // verify nonce
+ if( !acf_verify_nonce('post') ) return $post_id;
+
+
+ // validate for published post (allow draft to save without validation)
+ if( $post->post_status == 'publish' ) {
+
+ // show errors
+ acf_validate_save_post( true );
+
+ }
+
+
+ // save
+ acf_save_post( $post_id );
+
+
+ // save revision
+ if( post_type_supports($post->post_type, 'revisions') ) {
+
+ acf_save_post_revision( $post_id );
+
+ }
+
+
+ // return
+ return $post_id;
+
+ }
+
+
+ /*
+ * is_protected_meta
+ *
+ * This function will remove any ACF meta from showing in the meta postbox
+ *
+ * @type function
+ * @date 12/04/2014
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function is_protected_meta( $protected, $meta_key, $meta_type ) {
+
+ // if acf_get_field_reference returns a valid key, this is an acf value, so protect it!
+ if( !$protected ) {
+
+ $reference = acf_get_field_reference( $meta_key, $this->post_id );
+
+ if( acf_is_field_key($reference) ) {
+
+ $protected = true;
+
+ }
+
+ }
+
+
+ // return
+ return $protected;
+
+ }
+
+}
+
+new acf_form_post();
+
+endif;
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-taxonomy.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-taxonomy.php
new file mode 100644
index 0000000..8732acd
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-taxonomy.php
@@ -0,0 +1,462 @@
+validate_page() ) {
+
+ return;
+
+ }
+
+
+ // vars
+ $screen = get_current_screen();
+ $taxonomy = $screen->taxonomy;
+
+
+ // load acf scripts
+ acf_enqueue_scripts();
+
+
+ // actions
+ add_action('admin_footer', array($this, 'admin_footer'), 10, 1);
+ add_action("{$taxonomy}_add_form_fields", array($this, 'add_term'), 10, 1);
+ add_action("{$taxonomy}_edit_form", array($this, 'edit_term'), 10, 2);
+
+ }
+
+
+ /*
+ * add_term
+ *
+ * description
+ *
+ * @type function
+ * @date 8/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function add_term( $taxonomy ) {
+
+ // vars
+ $post_id = acf_get_term_post_id( $taxonomy, 0 );
+
+
+ // update vars
+ $this->form = '#addtag';
+
+
+ // get field groups
+ $field_groups = acf_get_field_groups(array(
+ 'taxonomy' => $taxonomy
+ ));
+
+
+ // render
+ if( !empty($field_groups) ) {
+
+ // data
+ acf_form_data(array(
+ 'post_id' => $post_id,
+ 'nonce' => 'taxonomy',
+ ));
+
+ // wrap
+ echo '';
+
+ // loop
+ foreach( $field_groups as $field_group ) {
+ $fields = acf_get_fields( $field_group );
+ acf_render_fields( $post_id, $fields, 'div', 'field' );
+ }
+
+ // wrap
+ echo '
';
+
+ }
+
+ }
+
+
+ /*
+ * edit_term
+ *
+ * description
+ *
+ * @type function
+ * @date 8/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function edit_term( $term, $taxonomy ) {
+
+ // vars
+ $post_id = acf_get_term_post_id( $term->taxonomy, $term->term_id );
+
+
+ // update vars
+ $this->form = '#edittag';
+
+
+ // get field groups
+ $field_groups = acf_get_field_groups(array(
+ 'taxonomy' => $taxonomy
+ ));
+
+
+ // render
+ if( !empty($field_groups) ) {
+
+ acf_form_data(array(
+ 'post_id' => $post_id,
+ 'nonce' => 'taxonomy'
+ ));
+
+ foreach( $field_groups as $field_group ) {
+
+ // title
+ if( $field_group['style'] == 'default' ) {
+ echo '' . $field_group['title'] . ' ';
+ }
+
+ // fields
+ echo '';
+
+ }
+
+ }
+
+ }
+
+
+ /*
+ * admin_footer
+ *
+ * description
+ *
+ * @type function
+ * @date 27/03/2015
+ * @since 5.1.5
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function admin_footer() {
+
+?>
+
+query($wpdb->prepare(
+ "DELETE FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s",
+ $search,
+ $_search
+ ));
+
+ }
+
+}
+
+new acf_form_taxonomy();
+
+endif;
+
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-user.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-user.php
new file mode 100644
index 0000000..c887ddc
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-user.php
@@ -0,0 +1,413 @@
+validate_page() ) {
+
+ return;
+
+ }
+
+
+ // load acf scripts
+ acf_enqueue_scripts();
+
+
+ // actions
+ add_action('acf/input/admin_footer', array($this, 'admin_footer'), 10, 1);
+
+ }
+
+
+ /*
+ * register_user
+ *
+ * description
+ *
+ * @type function
+ * @date 8/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function register_user() {
+
+ // update vars
+ $this->form = '#registerform';
+
+
+ // render
+ $this->render( 0, 'register', 'div' );
+
+ }
+
+
+ /*
+ * edit_user
+ *
+ * description
+ *
+ * @type function
+ * @date 8/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function edit_user( $user ) {
+
+ // update vars
+ $this->form = '#your-profile';
+
+
+ // render
+ $this->render( $user->ID, 'edit', 'tr' );
+
+ }
+
+
+ /*
+ * user_new_form
+ *
+ * description
+ *
+ * @type function
+ * @date 8/10/13
+ * @since 5.0.0
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function user_new_form() {
+
+ // update vars
+ $this->form = '#createuser';
+
+
+ // render
+ $this->render( 0, 'add', 'tr' );
+
+ }
+
+
+ /*
+ * render
+ *
+ * This function will render ACF fields for a given $post_id parameter
+ *
+ * @type function
+ * @date 7/10/13
+ * @since 5.0.0
+ *
+ * @param $user_id (int) this can be set to 0 for a new user
+ * @param $user_form (string) used for location rule matching. edit | add | register
+ * @param $el (string)
+ * @return n/a
+ */
+
+ function render( $user_id, $user_form, $el = 'tr' ) {
+
+ // vars
+ $post_id = "user_{$user_id}";
+ $show_title = true;
+
+
+ // args
+ $args = array(
+ 'user_id' => 'new',
+ 'user_form' => $user_form
+ );
+
+ if( $user_id ) $args['user_id'] = $user_id;
+
+
+ // get field groups
+ $field_groups = acf_get_field_groups( $args );
+
+
+ // bail early if no field groups
+ if( empty($field_groups) ) return;
+
+
+ // form data
+ acf_form_data(array(
+ 'post_id' => $post_id,
+ 'nonce' => 'user'
+ ));
+
+
+ // loop
+ foreach( $field_groups as $field_group ) {
+
+ // vars
+ $fields = acf_get_fields( $field_group );
+
+
+ // title
+ if( $show_title && $field_group['style'] === 'default' ) {
+ echo '' . $field_group['title'] . ' ';
+ }
+
+
+ // table start
+ if( $el == 'tr' ) {
+ echo '';
+ } else {
+ echo '';
+ }
+
+ }
+
+
+ }
+
+
+ /*
+ * admin_footer
+ *
+ * description
+ *
+ * @type function
+ * @date 27/03/2015
+ * @since 5.1.5
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function admin_footer() {
+
+?>
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php
new file mode 100644
index 0000000..18d4013
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php
@@ -0,0 +1,384 @@
+preview_values = array();
+ $this->preview_reference = array();
+ $this->preview_errors = array();
+
+
+ // actions
+ add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
+ add_action('in_widget_form', array($this, 'edit_widget'), 10, 3);
+ add_action('acf/validate_save_post', array($this, 'acf_validate_save_post'), 5);
+
+
+ // filters
+ add_filter('widget_update_callback', array($this, 'save_widget'), 10, 4);
+
+ }
+
+
+ /*
+ * 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 26/01/13
+ * @since 3.6.0
+ *
+ * @param N/A
+ * @return N/A
+ */
+
+ function admin_enqueue_scripts() {
+
+ // validate screen
+ if( acf_is_screen('widgets') || acf_is_screen('customize') ) {
+
+ // valid
+
+ } else {
+
+ return;
+
+ }
+
+
+ // load acf scripts
+ acf_enqueue_scripts();
+
+
+ // actions
+ add_action('acf/input/admin_footer', array($this, 'admin_footer'), 1);
+
+ }
+
+
+ /*
+ * acf_validate_save_post
+ *
+ * This function will loop over $_POST data and validate
+ *
+ * @type action 'acf/validate_save_post' 5
+ * @date 7/09/2016
+ * @since 5.4.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function acf_validate_save_post() {
+
+ // bail ealry if not widget
+ if( !isset($_POST['_acf_widget_id']) ) return;
+
+
+ // vars
+ $id = $_POST['_acf_widget_id'];
+ $number = $_POST['_acf_widget_number'];
+ $prefix = $_POST['_acf_widget_prefix'];
+
+
+ // validate
+ acf_validate_values( $_POST[ $id ][ $number ]['acf'], $prefix );
+
+ }
+
+
+ /*
+ * edit_widget
+ *
+ * This function will render the fields for a widget form
+ *
+ * @type function
+ * @date 11/06/2014
+ * @since 5.0.0
+ *
+ * @param $widget (object)
+ * @param $return (null)
+ * @param $instance (object)
+ * @return $post_id (int)
+ */
+
+ function edit_widget( $widget, $return, $instance ) {
+
+ // vars
+ $post_id = 0;
+ $prefix = 'widget-' . $widget->id_base . '[' . $widget->number . '][acf]';
+
+
+ // get id
+ if( $widget->number !== '__i__' ) {
+
+ $post_id = "widget_{$widget->id}";
+
+ }
+
+
+ // get field groups
+ $field_groups = acf_get_field_groups(array(
+ 'widget' => $widget->id_base
+ ));
+
+
+ // render
+ if( !empty($field_groups) ) {
+
+ // render post data
+ acf_form_data(array(
+ 'post_id' => $post_id,
+ 'nonce' => 'widget',
+ 'widget_id' => 'widget-' . $widget->id_base,
+ 'widget_number' => $widget->number,
+ 'widget_prefix' => $prefix
+ ));
+
+
+ // wrap
+ echo '';
+
+ // loop
+ foreach( $field_groups as $field_group ) {
+
+ // load fields
+ $fields = acf_get_fields( $field_group );
+
+
+ // bail if not fields
+ if( empty($fields) ) continue;
+
+
+ // change prefix
+ acf_prefix_fields( $fields, $prefix );
+
+
+ // render
+ acf_render_fields( $post_id, $fields, 'div', $field_group['instruction_placement'] );
+
+ }
+
+ //wrap
+ echo '
';
+
+
+ // jQuery selector looks odd, but is necessary due to WP adding an incremental number into the ID
+ // - not possible to find number via PHP parameters
+ if( $widget->updated ): ?>
+
+ id}", $new_instance['acf'] );
+
+
+ // return
+ return $instance;
+
+ }
+
+
+ /*
+ * admin_footer
+ *
+ * This function will add some custom HTML to the footer of the edit page
+ *
+ * @type function
+ * @date 11/06/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_footer() {
+
+?>
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/input.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/input.php
new file mode 100644
index 0000000..336b99f
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/input.php
@@ -0,0 +1,520 @@
+admin_enqueue_scripts = 'admin_enqueue_scripts';
+ $this->admin_head = 'admin_head';
+ $this->admin_footer = 'admin_footer';
+ $this->enqueued = false;
+ $this->data = array();
+
+
+ // actions
+ add_action('acf/save_post', array($this, 'save_post'), 10, 1);
+
+ }
+
+
+ /*
+ * get_data
+ *
+ * This function will return form data
+ *
+ * @type function
+ * @date 4/03/2016
+ * @since 5.3.2
+ *
+ * @param $key (mixed)
+ * @return (mixed)
+ */
+
+ function get_data( $key = false ) {
+
+ // vars
+ $data = $this->data;
+
+
+ // key
+ if( $key && isset($data[ $key ]) ) {
+
+ $data = $data[ $key ];
+
+ }
+
+
+ // return
+ return $data;
+
+ }
+
+
+ /*
+ * set_data
+ *
+ * This function will se the form data
+ *
+ * @type function
+ * @date 4/03/2016
+ * @since 5.3.2
+ *
+ * @param $data (array)
+ * @return (array)
+ */
+
+ function set_data( $data ) {
+
+ // defaults
+ $data = acf_parse_args($data, array(
+ 'post_id' => 0, // ID of current post
+ 'nonce' => 'post', // nonce used for $_POST validation
+ 'validation' => 1, // runs AJAX validation
+ 'ajax' => 0, // fetches new field groups via AJAX
+ 'changed' => 0,
+ ));
+
+
+ // update
+ $this->data = $data;
+
+
+ // enqueue uploader if page allows AJAX fields to appear
+ if( $data['ajax'] ) {
+
+ add_action($this->admin_footer, 'acf_enqueue_uploader', 1);
+
+ }
+
+
+ // return
+ return $data;
+
+ }
+
+
+ /*
+ * enqueue
+ *
+ * This function will determin the actions to use for different pages
+ *
+ * @type function
+ * @date 13/01/2016
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function enqueue() {
+
+ // bail ealry if already enqueued
+ if( $this->enqueued ) return;
+
+
+ // update setting
+ $this->enqueued = true;
+
+
+ // global
+ global $pagenow;
+
+
+ // determine action hooks
+ if( $pagenow == 'customize.php' ) {
+
+ $this->admin_head = 'customize_controls_print_scripts';
+ $this->admin_footer = 'customize_controls_print_footer_scripts';
+
+ } elseif( $pagenow == 'wp-login.php' ) {
+
+ $this->admin_enqueue_scripts = 'login_enqueue_scripts';
+ $this->admin_head = 'login_head';
+ $this->admin_footer = 'login_footer';
+
+ } elseif( !is_admin() ) {
+
+ $this->admin_enqueue_scripts = 'wp_enqueue_scripts';
+ $this->admin_head = 'wp_head';
+ $this->admin_footer = 'wp_footer';
+
+ }
+
+
+ // actions
+ acf_maybe_add_action($this->admin_enqueue_scripts, array($this, 'admin_enqueue_scripts'), 20 );
+ acf_maybe_add_action($this->admin_head, array($this, 'admin_head'), 20 );
+ acf_maybe_add_action($this->admin_footer, array($this, 'admin_footer'), 20 );
+
+ }
+
+
+ /*
+ * admin_enqueue_scripts
+ *
+ * The acf input screen admin_enqueue_scripts
+ *
+ * @type function
+ * @date 4/03/2016
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_enqueue_scripts() {
+
+ // scripts
+ wp_enqueue_script('acf-input');
+
+
+ // styles
+ wp_enqueue_style('acf-input');
+
+
+ // do action
+ do_action('acf/input/admin_enqueue_scripts');
+
+ }
+
+
+ /*
+ * admin_head
+ *
+ * The acf input screen admin_head
+ *
+ * @type function
+ * @date 4/03/2016
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_head() {
+
+ // do action
+ do_action('acf/input/admin_head');
+
+ }
+
+
+ /*
+ * admin_footer
+ *
+ * The acf input screen admin_footer
+ *
+ * @type function
+ * @date 4/03/2016
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function admin_footer() {
+
+ // global
+ global $wp_version;
+
+
+ // options
+ $o = array(
+ 'post_id' => acf_get_form_data('post_id'),
+ 'nonce' => wp_create_nonce( 'acf_nonce' ),
+ 'admin_url' => admin_url(),
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
+ 'ajax' => acf_get_form_data('ajax'),
+ 'validation' => acf_get_form_data('validation'),
+ 'wp_version' => $wp_version,
+ 'acf_version' => acf_get_setting('version'),
+ 'browser' => acf_get_browser(),
+ 'locale' => get_locale(),
+ 'rtl' => is_rtl()
+ );
+
+
+ // l10n
+ $l10n = apply_filters( 'acf/input/admin_l10n', array(
+ 'unload' => __('The changes you made will be lost if you navigate away from this page','acf'),
+ 'expand_details' => __('Expand Details','acf'),
+ 'collapse_details' => __('Collapse Details','acf'),
+ 'validation_successful' => __('Validation successful', 'acf'),
+ 'validation_failed' => __('Validation failed', 'acf'),
+ 'validation_failed_1' => __('1 field requires attention', 'acf'),
+ 'validation_failed_2' => __('%d fields require attention', 'acf'),
+ 'restricted' => __('Restricted','acf'),
+ 'are_you_sure' => __('Are you sure?','acf'),
+ 'yes' => __('Yes','acf'),
+ 'no' => __('No','acf'),
+ 'remove' => __('Remove','acf'),
+ 'cancel' => __('Cancel','acf')
+ ));
+
+
+?>
+
+
+
+ $v ) {
+
+ // get field
+ $field = acf_get_field( $k );
+
+
+ // continue if no field
+ if( !$field ) continue;
+
+
+ // update
+ acf_update_value( $v, $post_id, $field );
+
+ }
+
+ }
+
+}
+
+// initialize
+acf()->input = new acf_input();
+
+endif; // class_exists check
+
+
+
+/*
+* acf_enqueue_scripts
+*
+* alias of acf()->form->enqueue()
+*
+* @type function
+* @date 6/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_enqueue_scripts() {
+
+ return acf()->input->enqueue();
+
+}
+
+
+/*
+* acf_get_form_data
+*
+* alias of acf()->form->get_data()
+*
+* @type function
+* @date 6/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_get_form_data( $key = false ) {
+
+ return acf()->input->get_data( $key );
+
+}
+
+
+/*
+* acf_set_form_data
+*
+* alias of acf()->form->set_data()
+*
+* @type function
+* @date 6/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_set_form_data( $data = array() ) {
+
+ return acf()->input->set_data( $data );
+
+}
+
+
+/*
+* acf_enqueue_uploader
+*
+* This function will render a WP WYSIWYG and enqueue media
+*
+* @type function
+* @date 27/10/2014
+* @since 5.0.9
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_enqueue_uploader() {
+
+ // bail early if doing ajax
+ if( acf_is_ajax() ) return;
+
+
+ // bail ealry if already run
+ if( acf_has_done('enqueue_uploader') ) return;
+
+
+ // enqueue media if user can upload
+ if( current_user_can('upload_files') ) {
+
+ wp_enqueue_media();
+
+ }
+
+
+ // create dummy editor
+ ?>
+
+ $v ): ?>
+
+
+
+
+ $post_id
+ ));
+
+
+ // hook for 3rd party customization
+ do_action('acf/save_post', $post_id);
+
+
+ // return
+ return true;
+
+}
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/json.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/json.php
new file mode 100644
index 0000000..2e865ac
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/json.php
@@ -0,0 +1,279 @@
+include_json_folder( $path );
+
+ }
+
+ }
+
+
+ /*
+ * include_json_folder
+ *
+ * This function will include all .json files within a folder
+ *
+ * @type function
+ * @date 1/5/17
+ * @since 5.5.13
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function include_json_folder( $path = '' ) {
+
+ // remove trailing slash
+ $path = untrailingslashit( $path );
+
+
+ // bail early if path does not exist
+ if( !is_dir($path) ) return false;
+
+
+ // open
+ $dir = opendir( $path );
+
+
+ // loop over files
+ while(false !== ( $file = readdir($dir)) ) {
+
+ // validate type
+ if( pathinfo($file, PATHINFO_EXTENSION) !== 'json' ) continue;
+
+
+ // read json
+ $json = file_get_contents("{$path}/{$file}");
+
+
+ // validate json
+ if( empty($json) ) continue;
+
+
+ // decode
+ $json = json_decode($json, true);
+
+
+ // add local
+ $json['local'] = 'json';
+
+
+ // add field group
+ acf_add_local_field_group( $json );
+
+ }
+
+
+ // return
+ return true;
+
+ }
+
+}
+
+
+// initialize
+acf()->json = new acf_json();
+
+endif; // class_exists check
+
+
+/*
+* acf_write_json_field_group
+*
+* This function will save a field group to a json file within the current theme
+*
+* @type function
+* @date 5/12/2014
+* @since 5.1.5
+*
+* @param $field_group (array)
+* @return (boolean)
+*/
+
+function acf_write_json_field_group( $field_group ) {
+
+ // vars
+ $path = acf_get_setting('save_json');
+ $file = $field_group['key'] . '.json';
+
+
+ // remove trailing slash
+ $path = untrailingslashit( $path );
+
+
+ // bail early if dir does not exist
+ if( !is_writable($path) ) return false;
+
+
+ // prepare for export
+ $id = acf_extract_var( $field_group, 'ID' );
+ $field_group = acf_prepare_field_group_for_export( $field_group );
+
+
+ // add modified time
+ $field_group['modified'] = get_post_modified_time('U', true, $id, true);
+
+
+ // write file
+ $f = fopen("{$path}/{$file}", 'w');
+ fwrite($f, acf_json_encode( $field_group ));
+ fclose($f);
+
+
+ // return
+ return true;
+
+}
+
+
+/*
+* acf_delete_json_field_group
+*
+* This function will delete a json field group file
+*
+* @type function
+* @date 5/12/2014
+* @since 5.1.5
+*
+* @param $key (string)
+* @return (boolean)
+*/
+
+function acf_delete_json_field_group( $key ) {
+
+ // vars
+ $path = acf_get_setting('save_json');
+ $file = $key . '.json';
+
+
+ // remove trailing slash
+ $path = untrailingslashit( $path );
+
+
+ // bail early if file does not exist
+ if( !is_readable("{$path}/{$file}") ) {
+
+ return false;
+
+ }
+
+
+ // remove file
+ unlink("{$path}/{$file}");
+
+
+ // return
+ return true;
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/local.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/local.php
new file mode 100644
index 0000000..af7c6c2
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/local.php
@@ -0,0 +1,1045 @@
+reference[ $key ]) ) {
+
+ $key = $this->reference[ $key ];
+
+ }
+
+
+ // return
+ return $key;
+
+ }
+
+
+ /*
+ * reset
+ *
+ * This function will remove (reset) all field group and fields
+ *
+ * @type function
+ * @date 2/06/2016
+ * @since 5.3.8
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function reset() {
+
+ // vars
+ $this->temp_groups = array();
+ $this->temp_fields = array();
+ $this->groups = array();
+ $this->fields = array();
+ $this->reference = array();
+ $this->parents = array();
+
+ }
+
+
+ /*
+ * is_enabled
+ *
+ * This function will return true if acf_local functionality is enabled
+ *
+ * @type function
+ * @date 14/07/2016
+ * @since 5.4.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function is_enabled() {
+
+ // bail early if no local allowed
+ if( !acf_get_setting('local') ) return false;
+
+
+ // return
+ return acf_is_filter_enabled('local');
+
+ }
+
+
+ /*
+ * is_ready
+ *
+ * This function will return true when ACF has included all field types and is ready to import
+ * Importing fields too early will cause issues where sub fields have not been extracted correctly
+ *
+ * @type function
+ * @date 13/3/17
+ * @since 5.5.10
+ *
+ * @param n/a
+ * @return (boolean)
+ */
+
+ function is_ready() {
+
+ return did_action('acf/include_fields');
+
+ }
+
+
+ /*
+ * acf_include_fields
+ *
+ * This function include any $temp data
+ *
+ * @type function
+ * @date 8/2/17
+ * @since 5.5.6
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function acf_include_fields() {
+
+ // field groups
+ if( !empty($this->temp_groups) ) {
+
+ // loop
+ foreach( $this->temp_groups as $i => $temp ) {
+
+ // add
+ $this->add_field_group($temp);
+
+
+ // unset
+ unset($this->temp_groups[ $i ]);
+
+ }
+
+ }
+
+
+ // fields
+ if( !empty($this->temp_fields) ) {
+
+ // prepare
+ $this->temp_fields = acf_prepare_fields_for_import( $this->temp_fields );
+
+
+ // loop
+ foreach( $this->temp_fields as $i => $temp ) {
+
+ // add
+ $this->add_field($temp);
+
+
+ // unset
+ unset($this->temp_fields[ $i ]);
+
+ }
+
+ }
+
+ }
+
+
+ /*
+ * add_parent_reference
+ *
+ * This function will add a child reference for a given parent
+ *
+ * @type function
+ * @date 14/07/2016
+ * @since 5.4.0
+ *
+ * @param $parent_key (string)
+ * @param $field_key (string)
+ * @return (mixed)
+ */
+
+ function add_parent_reference( $parent_key = '', $field_key = '' ) {
+
+ // create array if doesn't exist
+ if( empty($this->parents[ $parent_key ]) ) {
+
+ $this->parents[ $parent_key ] = array();
+
+ }
+
+
+ // append
+ $this->parents[ $parent_key ][ $field_key ] = $field_key;
+
+ }
+
+
+ /*
+ * remove_parent_reference
+ *
+ * This function will remove a child reference for a given parent
+ *
+ * @type function
+ * @date 14/07/2016
+ * @since 5.4.0
+ *
+ * @param $parent_key (string)
+ * @param $field_key (string)
+ * @return (mixed)
+ */
+
+ function remove_parent_reference( $parent_key = '', $field_key = '' ) {
+
+ // bail early if no parent
+ if( empty($this->parents[ $parent_key ]) ) return false;
+
+
+ // remove
+ unset( $this->parents[ $parent_key ][ $field_key ] );
+
+ }
+
+
+ /*
+ * maybe_add_field
+ *
+ * This function will either import or add to temp
+ *
+ * @type function
+ * @date 9/2/17
+ * @since 5.5.6
+ *
+ * @param $field (array)
+ * @return n/a
+ */
+
+ function maybe_add_field( $field ) {
+
+ // add
+ if( $this->is_ready() ) {
+
+ $this->add_field( $field );
+
+ // add to temp
+ } else {
+
+ $this->temp_fields[] = $field;
+
+ }
+
+ }
+
+
+ /*
+ * add_field
+ *
+ * This function will add a $field
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $field (array)
+ * @return n/a
+ */
+
+ function add_field( $field ) {
+
+ // defaults
+ $field = wp_parse_args($field, array(
+ 'key' => '',
+ 'name' => '',
+ 'parent' => 0
+ ));
+
+
+ // add parent reference
+ $this->add_parent_reference( $field['parent'], $field['key'] );
+
+
+ // add in menu order
+ $field['menu_order'] = $this->count_fields( $field['parent'] ) - 1;
+
+
+ // add field
+ $this->fields[ $field['key'] ] = $field;
+
+
+ // add reference for field name
+ $this->reference[ $field['name'] ] = $field['key'];
+
+ }
+
+
+ /*
+ * is_field
+ *
+ * This function will return true if a field exists for a given key
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $key (string)
+ * @return (bolean)
+ */
+
+ function is_field( $key = '' ) {
+
+ // vars
+ $key = $this->get_key($key);
+
+
+ // bail early if not enabled
+ if( !$this->is_enabled() ) return false;
+
+
+ // return
+ return isset( $this->fields[ $key ] );
+
+ }
+
+ function is_field_key( $key ) {
+
+ // bail early if not enabled
+ if( !$this->is_enabled() ) return false;
+
+
+ // return
+ return isset( $this->fields[ $key ] );
+
+ }
+
+ function is_field_name( $name ) {
+
+ // bail early if not enabled
+ if( !$this->is_enabled() ) return false;
+
+
+ // return
+ return isset( $this->reference[ $name ] );
+
+ }
+
+
+ /*
+ * get_field
+ *
+ * This function will return a local field for a given key
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $key (string)
+ * @return (bolean)
+ */
+
+ function get_field( $key = '' ) {
+
+ // vars
+ $key = $this->get_key($key);
+
+
+ // bail early if no group
+ if( !$this->is_field($key) ) return false;
+
+
+ // return
+ return $this->fields[ $key ];
+
+ }
+
+
+ /*
+ * remove_field
+ *
+ * This function will remove a $field
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $key (string)
+ * @return n/a
+ */
+
+ function remove_field( $key = '' ) {
+
+ // get field
+ $field = $this->get_field( $key );
+
+
+ // bail early if no field
+ if( !$field ) return false;
+
+
+ // remove parent reference
+ $this->remove_parent_reference( $field['parent'], $field['key'] );
+
+
+ // remove field
+ unset( $this->fields[ $field['key'] ] );
+
+
+ // remove reference for field name
+ unset( $this->reference[ $field['name'] ] );
+
+
+ // remove children
+ if( $this->have_fields($key) ) {
+
+ $this->remove_fields( $key );
+
+ }
+
+ }
+
+
+ /*
+ * maybe_add_field_group
+ *
+ * This function will either import or add to temp
+ *
+ * @type function
+ * @date 9/2/17
+ * @since 5.5.6
+ *
+ * @param $field_group (array)
+ * @return n/a
+ */
+
+ function maybe_add_field_group( $field_group ) {
+
+ // add
+ if( $this->is_ready() ) {
+
+ $this->add_field_group( $field_group );
+
+ // add to temp
+ } else {
+
+ $this->temp_groups[] = $field_group;
+
+ }
+
+ }
+
+
+ /*
+ * add_field_group
+ *
+ * This function will add a $field group to the local placeholder
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $field_group (array)
+ * @return n/a
+ */
+
+ function add_field_group( $field_group ) {
+
+ // vars
+ $fields = acf_extract_var($field_group, 'fields');
+
+
+ // validate
+ $field_group = acf_get_valid_field_group($field_group);
+
+
+ // don't allow overrides
+ if( $this->is_field_group($field_group['key']) ) return;
+
+
+ // add local (may be set to json)
+ if( empty($field_group['local']) ) $field_group['local'] = 'php';
+
+
+ // add field group
+ $this->groups[ $field_group['key'] ] = $field_group;
+
+
+ // bail ealry if no fields
+ if( !$fields ) return;
+
+
+ // format fields
+ $fields = acf_prepare_fields_for_import( $fields );
+
+
+ // add fields
+ foreach( $fields as $field ) {
+
+ // add parent
+ if( empty($field['parent']) ) $field['parent'] = $field_group['key'];
+
+
+ // add field
+ $this->add_field( $field );
+
+ }
+
+ }
+
+
+ /*
+ * is_field_group
+ *
+ * This function will return true if a field group exists for a given key
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $key (string)
+ * @return (bolean)
+ */
+
+ function is_field_group( $key = '' ) {
+
+ // bail early if not enabled
+ if( !$this->is_enabled() ) return false;
+
+
+ // return
+ return isset( $this->groups[ $key ] );
+
+ }
+
+
+ /*
+ * get_field_group
+ *
+ * This function will return a local field group for a given key
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $key (string)
+ * @return (bolean)
+ */
+
+ function get_field_group( $key = '' ) {
+
+ // bail early if no group
+ if( !$this->is_field_group($key) ) return false;
+
+
+ // return
+ return $this->groups[ $key ];
+
+ }
+
+
+ /*
+ * count_field_groups
+ *
+ * This function will return the number of field groups
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $key (string)
+ * @return (bolean)
+ */
+
+
+ function count_field_groups() {
+
+ // return
+ return count( $this->groups );
+
+ }
+
+
+ /*
+ * have_field_groups
+ *
+ * This function will true if local field groups exist
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return (int)
+ */
+
+ function have_field_groups() {
+
+ // bail early if not enabled
+ if( !$this->is_enabled() ) return 0;
+
+
+ // return
+ return $this->count_field_groups();
+
+ }
+
+
+ /*
+ * get_field_groups
+ *
+ * This function will return an array of field groups
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $key (string)
+ * @return (bolean)
+ */
+
+ function get_field_groups() {
+
+ // bail early if no parent
+ if( !$this->have_field_groups() ) return false;
+
+
+ // vars
+ $field_groups = array();
+
+
+ // append
+ foreach( array_keys($this->groups) as $field_group_key ) {
+
+ $field_groups[] = acf_get_field_group( $field_group_key );
+
+ }
+
+
+ // return
+ return $field_groups;
+
+ }
+
+
+
+ /*
+ * count_fields
+ *
+ * This function will return the number of fields for a given parent
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $key (string)
+ * @return (bolean)
+ */
+
+
+ function count_fields( $parent_key = '' ) {
+
+ // check
+ if( isset($this->parents[ $parent_key ]) ) {
+
+ return count($this->parents[ $parent_key ]);
+
+ }
+
+
+ // return
+ return 0;
+
+ }
+
+
+ /*
+ * have_fields
+ *
+ * This function will true if local fields exist
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return (int)
+ */
+
+ function have_fields( $parent_key = '' ) {
+
+ // bail early if not enabled
+ if( !$this->is_enabled() ) return 0;
+
+
+ // return
+ return $this->count_fields( $parent_key );
+
+ }
+
+
+ /*
+ * get_fields
+ *
+ * This function will return an array of fields for a given 'parent' key (field group key or field key)
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $key (string)
+ * @return (bolean)
+ */
+
+ function get_fields( $parent_key = '' ) {
+
+ // bail early if no parent
+ if( !$this->have_fields($parent_key) ) return false;
+
+
+ // vars
+ $fields = array();
+
+
+ // append
+ foreach( $this->parents[ $parent_key ] as $field_key ) {
+
+ $fields[] = acf_get_field( $field_key );
+
+ }
+
+
+ // return
+ return $fields;
+
+ }
+
+
+ /*
+ * remove_fields
+ *
+ * This function will remove the field reference for a field group
+ *
+ * @type function
+ * @date 10/03/2014
+ * @since 5.0.0
+ *
+ * @param $key (string)
+ * @return (bolean)
+ */
+
+ function remove_fields( $parent_key = '' ) {
+
+ // bail early if no parent
+ if( !$this->have_fields($parent_key) ) return false;
+
+
+ // loop
+ foreach( $this->parents[ $parent_key ] as $field_key ) {
+
+ $this->remove_field( $field_key );
+
+ }
+
+
+ // return
+ return true;
+ }
+
+
+ /*
+ * acf_get_field_groups
+ *
+ * This function will override and add field groups to the `acf_get_field_groups()` results
+ *
+ * @type filter (acf/get_field_groups)
+ * @date 5/12/2013
+ * @since 5.0.0
+ *
+ * @param $field_groups (array)
+ * @return $field_groups
+ */
+
+ function acf_get_field_groups( $field_groups ) {
+
+ // bail early if no local field groups
+ if( !$this->have_field_groups() ) return $field_groups;
+
+
+ // vars
+ $ignore = array();
+ $added = false;
+
+
+ // populate ignore list
+ if( !empty($field_groups) ) {
+
+ foreach( $field_groups as $k => $group ) {
+
+ $ignore[] = $group['key'];
+
+ }
+
+ }
+
+
+ // append field groups
+ $groups = $this->get_field_groups();
+
+ foreach( $groups as $group ) {
+
+ // is ignore
+ if( in_array($group['key'], $ignore) ) continue;
+
+
+ // append
+ $field_groups[] = $group;
+ $added = true;
+
+ }
+
+
+ // order field groups based on menu_order, title
+ if( $added ) {
+
+ $menu_order = array();
+ $title = array();
+
+ foreach( $field_groups as $key => $row ) {
+
+ $menu_order[ $key ] = $row['menu_order'];
+ $title[ $key ] = $row['title'];
+ }
+
+
+ // sort the array with menu_order ascending
+ array_multisort( $menu_order, SORT_ASC, $title, SORT_ASC, $field_groups );
+
+ }
+
+
+ // return
+ return $field_groups;
+
+ }
+
+}
+
+
+// initialize
+acf()->local = new acf_local();
+
+endif; // class_exists check
+
+
+/*
+* Helpers
+*
+* alias of acf()->local->functions
+*
+* @type function
+* @date 11/06/2014
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_local() {
+
+ return acf()->local;
+
+}
+
+function acf_disable_local() {
+
+ acf_disable_filter('local');
+
+}
+
+function acf_enable_local() {
+
+ acf_enable_filter('local');
+
+}
+
+function acf_reset_local() {
+
+ return acf_local()->reset();
+
+}
+
+
+// field group
+function acf_add_local_field_group( $field_group ) {
+
+ return acf_local()->maybe_add_field_group( $field_group );
+
+}
+
+function acf_remove_local_field_group( $key = '' ) {
+
+ return false;
+
+}
+
+function acf_is_local_field_group( $key = '' ) {
+
+ return acf_local()->is_field_group( $key );
+
+}
+
+function acf_get_local_field_group( $key = '' ) {
+
+ return acf_local()->get_field_group( $key );
+
+}
+
+
+// field groups
+function acf_count_local_field_groups() {
+
+ return acf_local()->count_field_groups();
+
+}
+
+function acf_have_local_field_groups() {
+
+ return acf_local()->have_field_groups();
+
+}
+
+function acf_get_local_field_groups() {
+
+ return acf_local()->get_field_groups();
+
+}
+
+
+// field
+function acf_add_local_field( $field ) {
+
+ return acf_local()->maybe_add_field( $field );
+
+}
+
+function acf_remove_local_field( $key = '' ) {
+
+ return acf_local()->remove_field( $key );
+
+}
+
+function acf_is_local_field( $key = '' ) {
+
+ return acf_local()->is_field( $key );
+
+}
+
+function acf_is_local_field_key( $key = '' ) {
+
+ return acf_local()->is_field_key( $key );
+
+}
+
+function acf_is_local_field_name( $name = '' ) {
+
+ return acf_local()->is_field_name( $name );
+
+}
+
+function acf_get_local_field( $key = '' ) {
+
+ return acf_local()->get_field( $key );
+
+}
+
+
+// fields
+function acf_count_local_fields( $key = '' ) {
+
+ return acf_local()->count_fields( $key );
+
+}
+
+function acf_have_local_fields( $key = '' ) {
+
+ return acf_local()->have_fields( $key );
+
+}
+
+function acf_get_local_fields( $key = '' ) {
+
+ return acf_local()->get_fields( $key );
+
+}
+
+function acf_remove_local_fields( $key = '' ) {
+
+ return acf_local()->remove_fields( $key );
+
+}
+
+
+// deprecated
+function register_field_group( $field_group ) {
+
+ acf_add_local_field_group( $field_group );
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations.php
new file mode 100644
index 0000000..3998709
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations.php
@@ -0,0 +1,356 @@
+locations[ $instance->name ] = $instance;
+
+ }
+
+
+ /*
+ * get_rule
+ *
+ * This function will return a location rule class
+ *
+ * @type function
+ * @date 6/07/2016
+ * @since 5.4.0
+ *
+ * @param $name (string)
+ * @return (mixed)
+ */
+
+ function get_location( $name ) {
+
+ return isset( $this->locations[$name] ) ? $this->locations[$name] : null;
+
+ }
+
+
+ /*
+ * get_rules
+ *
+ * This function will return a grouped array of location rules (category => name => label)
+ *
+ * @type function
+ * @date 6/07/2016
+ * @since 5.4.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function get_locations() {
+
+ // vars
+ $groups = array();
+ $l10n = array(
+ 'post' => __('Post', 'acf'),
+ 'page' => __('Page', 'acf'),
+ 'user' => __('User', 'acf'),
+ 'forms' => __('Forms', 'acf'),
+ );
+
+
+ // loop
+ foreach( $this->locations as $location ) {
+
+ // bail ealry if not public
+ if( !$location->public ) continue;
+
+
+ // translate
+ $cat = $location->category;
+ $cat = isset( $l10n[$cat] ) ? $l10n[$cat] : $cat;
+
+
+ // append
+ $groups[ $cat ][ $location->name ] = $location->label;
+
+ }
+
+
+ // filter
+ $groups = apply_filters('acf/location/rule_types', $groups);
+
+
+ // return
+ return $groups;
+
+ }
+
+}
+
+// initialize
+acf()->locations = new acf_locations();
+
+endif; // class_exists check
+
+
+/*
+* acf_register_location_rule
+*
+* alias of acf()->locations->register_location()
+*
+* @type function
+* @date 31/5/17
+* @since 5.6.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_register_location_rule( $class ) {
+
+ return acf()->locations->register_location( $class );
+
+}
+
+
+/*
+* acf_get_location_rule
+*
+* alias of acf()->locations->get_location()
+*
+* @type function
+* @date 31/5/17
+* @since 5.6.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_get_location_rule( $name ) {
+
+ return acf()->locations->get_location( $name );
+
+}
+
+
+/*
+* acf_get_location_rule_types
+*
+* alias of acf()->locations->get_locations()
+*
+* @type function
+* @date 31/5/17
+* @since 5.6.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_get_location_rule_types() {
+
+ return acf()->locations->get_locations();
+
+}
+
+
+/*
+* acf_get_valid_location_rule
+*
+* This function will return a valid location rule array
+*
+* @type function
+* @date 30/5/17
+* @since 5.6.0
+*
+* @param $rule (array)
+* @return (array)
+*/
+
+function acf_get_valid_location_rule( $rule ) {
+
+ // defaults
+ $rule = wp_parse_args( $rule, array(
+ 'id' => '',
+ 'group' => '',
+ 'param' => '',
+ 'operator' => '==',
+ 'value' => '',
+ ));
+
+
+ // prefix for inputs
+ $rule['prefix'] = 'acf_field_group[location]['.$rule['group'].']['.$rule['id'].']';
+
+
+ // return
+ return $rule;
+
+}
+
+
+/*
+* acf_get_location_rule_operators
+*
+* This function will return the operators for a given rule
+*
+* @type function
+* @date 30/5/17
+* @since 5.6.0
+*
+* @param $rule (array)
+* @return (array)
+*/
+
+function acf_get_location_rule_operators( $rule ) {
+
+ // vars
+ $operators = array(
+ '==' => __("is equal to",'acf'),
+ '!=' => __("is not equal to",'acf'),
+ );
+
+
+ // filter
+ $operators = apply_filters( "acf/location/rule_operators/{$rule['param']}", $operators, $rule );
+ $operators = apply_filters( "acf/location/rule_operators", $operators, $rule );
+
+
+ // return
+ return $operators;
+
+}
+
+
+/*
+* acf_get_location_rule_values
+*
+* This function will return the values for a given rule
+*
+* @type function
+* @date 30/5/17
+* @since 5.6.0
+*
+* @param $rule (array)
+* @return (array)
+*/
+
+function acf_get_location_rule_values( $rule ) {
+
+ // vars
+ $values = array();
+
+
+ // filter
+ $values = apply_filters( "acf/location/rule_values/{$rule['param']}", $values, $rule );
+ $values = apply_filters( "acf/location/rule_values", $values, $rule );
+
+
+ // return
+ return $values;
+
+}
+
+
+/*
+* acf_match_location_rule
+*
+* This function will match a given rule to the $screen
+*
+* @type function
+* @date 30/5/17
+* @since 5.6.0
+*
+* @param $rule (array)
+* @param $screen (array)
+* @return (boolean)
+*/
+
+function acf_match_location_rule( $rule, $screen ) {
+
+ // vars
+ $result = false;
+
+
+ // filter
+ $result = apply_filters( "acf/location/rule_match/{$rule['param']}", $result, $rule, $screen );
+ $result = apply_filters( "acf/location/rule_match", $result, $rule, $screen );
+
+
+ // return
+ return $result;
+
+}
+
+
+/*
+* acf_get_location_screen
+*
+* This function will return a valid location screen array
+*
+* @type function
+* @date 30/5/17
+* @since 5.6.0
+*
+* @param $screen (array)
+* @param $field_group (array)
+* @return (array)
+*/
+
+function acf_get_location_screen( $screen, $field_group ) {
+
+ // vars
+ $screen = wp_parse_args($screen, array(
+ 'lang' => acf_get_setting('current_language'),
+ 'ajax' => false
+ ));
+
+
+ // filter for 3rd party customization
+ $screen = apply_filters('acf/location/screen', $screen, $field_group);
+
+
+ // return
+ return $screen;
+
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-attachment.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-attachment.php
new file mode 100644
index 0000000..9abb20d
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-attachment.php
@@ -0,0 +1,127 @@
+name = 'attachment';
+ $this->label = __("Attachment",'acf');
+ $this->category = 'forms';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $attachment = acf_maybe_get( $screen, 'attachment' );
+
+
+ // validate
+ if( !$attachment ) return false;
+
+
+ // get attachment mime type
+ $mime_type = get_post_mime_type( $attachment );
+
+
+ // no specific mime
+ if( !strpos($rule['value'], '/') ) {
+
+ // explode into [0] => type, [1] => mime
+ $bits = explode('/', $mime_type);
+
+
+ // if type matches, fake the $mime_type to match
+ if( $rule['value'] === $bits[0] ) {
+
+ $mime_type = $rule['value'];
+
+ }
+ }
+
+
+ // match
+ return $this->compare( $mime_type, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // vars
+ $mimes = get_allowed_mime_types();
+ $choices = array(
+ 'all' => __('All', 'acf')
+ );
+
+
+ // loop
+ foreach( $mimes as $type => $mime ) {
+
+ $group = current( explode('/', $mime) );
+ $choices[ $group ][ $group ] = sprintf( __('All %s formats', 'acf'), $group);
+ $choices[ $group ][ $mime ] = "$type ($mime)";
+
+ }
+
+
+ // return
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_attachment' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-comment.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-comment.php
new file mode 100644
index 0000000..b4a353e
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-comment.php
@@ -0,0 +1,95 @@
+name = 'comment';
+ $this->label = __("Comment",'acf');
+ $this->category = 'forms';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $comment = acf_maybe_get( $screen, 'comment' );
+
+
+ // bail early if not comment
+ if( !$comment ) return false;
+
+
+ // return
+ return $this->compare( $comment, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // vars
+ $choices = array( 'all' => __('All', 'acf') );
+ $choices = array_merge( $choices, acf_get_pretty_post_types() );
+ // change this to post types that support comments
+
+ // return
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_comment' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-current-user-role.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-current-user-role.php
new file mode 100644
index 0000000..8cc38d5
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-current-user-role.php
@@ -0,0 +1,128 @@
+name = 'current_user_role';
+ $this->label = __("Current User Role",'acf');
+ $this->category = 'user';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // bail early if not logged in
+ if( !is_user_logged_in() ) return false;
+
+
+ // vars
+ $user = wp_get_current_user();
+
+
+ // super_admin
+ if( $rule['value'] == 'super_admin' ) {
+
+ $result = is_super_admin( $user->ID );
+
+ // role
+ } else {
+
+ $result = in_array( $rule['value'], $user->roles );
+
+ }
+
+
+ // reverse if 'not equal to'
+ if( $rule['operator'] == '!=' ) {
+
+ $result = !$result;
+
+ }
+
+
+ // return
+ return $result;
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // global
+ global $wp_roles;
+
+
+ // specific roles
+ $choices = $wp_roles->get_names();
+
+
+ // multi-site
+ if( is_multisite() ) {
+
+ $prepend = array( 'super_admin' => __('Super Admin', 'acf') );
+ $choices = array_merge( $prepend, $choices );
+
+ }
+
+
+ // return
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_current_user_role' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-current-user.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-current-user.php
new file mode 100644
index 0000000..c6753c3
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-current-user.php
@@ -0,0 +1,111 @@
+name = 'current_user';
+ $this->label = __("Current User",'acf');
+ $this->category = 'user';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // logged in
+ if( $rule['value'] == 'logged_in' ) {
+
+ $result = is_user_logged_in();
+
+ // viewing_front
+ } elseif( $rule['value'] == 'viewing_front' ) {
+
+ $result = !is_admin();
+
+ // viewing_back
+ } elseif( $rule['value'] == 'viewing_back' ) {
+
+ $result = is_admin();
+
+ }
+
+
+ // reverse if 'not equal to'
+ if( $rule['operator'] == '!=' ) {
+
+ $result = !$result;
+
+ }
+
+
+ // return
+ return $result;
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ return array(
+ 'logged_in' => __('Logged in', 'acf'),
+ 'viewing_front' => __('Viewing front end', 'acf'),
+ 'viewing_back' => __('Viewing back end', 'acf')
+ );
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_current_user' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-nav-menu-item.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-nav-menu-item.php
new file mode 100644
index 0000000..302db63
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-nav-menu-item.php
@@ -0,0 +1,106 @@
+name = 'nav_menu_item';
+ $this->label = __("Menu Item",'acf');
+ $this->category = 'forms';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $nav_menu_item = acf_maybe_get( $screen, 'nav_menu_item' );
+
+
+ // bail early if not nav_menu_item
+ if( !$nav_menu_item ) return false;
+
+
+ // global
+ global $acf_menu;
+
+
+ // append nav_menu data
+ $screen['nav_menu'] = $acf_menu;
+
+
+ // return
+ return acf_get_location_rule('nav_menu')->rule_match( $result, $rule, $screen );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // get menu choices
+ $choices = acf_get_location_rule('nav_menu')->rule_values( $choices, $rule );
+
+
+ // append item types?
+ // dificult to get these details
+
+
+ // return
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_nav_menu_item' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-nav-menu.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-nav-menu.php
new file mode 100644
index 0000000..1e873f9
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-nav-menu.php
@@ -0,0 +1,138 @@
+name = 'nav_menu';
+ $this->label = __("Menu",'acf');
+ $this->category = 'forms';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $nav_menu = acf_maybe_get( $screen, 'nav_menu' );
+
+
+ // bail early if not nav_menu
+ if( !$nav_menu ) return false;
+
+
+ // location
+ if( substr($rule['value'], 0, 9) === 'location/' ) {
+
+ // vars
+ $location = substr($rule['value'], 9);
+ $menu_locations = get_nav_menu_locations();
+
+
+ // bail ealry if no location
+ if( !isset($menu_locations[$location]) ) return false;
+
+
+ // if location matches, update value
+ if( $menu_locations[$location] == $nav_menu ) {
+
+ $nav_menu = $rule['value'];
+
+ }
+
+ }
+
+
+ // return
+ return $this->compare( $nav_menu, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // all
+ $choices = array(
+ 'all' => __('All', 'acf'),
+ );
+
+
+ // locations
+ $nav_locations = get_registered_nav_menus();
+ if( !empty($nav_locations) ) {
+ $cat = __('Menu Locations', 'acf');
+ foreach( $nav_locations as $slug => $title ) {
+ $choices[ $cat ][ 'location/'.$slug ] = $title;
+ }
+ }
+
+
+ // specific menus
+ $nav_menus = wp_get_nav_menus();
+ if( !empty($nav_menus) ) {
+ $cat = __('Menus', 'acf');
+ foreach( $nav_menus as $nav_menu ) {
+ $choices[ $cat ][ $nav_menu->term_id ] = $nav_menu->name;
+ }
+ }
+
+
+ // return
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_nav_menu' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page-parent.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page-parent.php
new file mode 100644
index 0000000..8420dfa
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page-parent.php
@@ -0,0 +1,100 @@
+name = 'page_parent';
+ $this->label = __("Page Parent",'acf');
+ $this->category = 'page';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+ $page_parent = acf_maybe_get( $screen, 'page_parent' );
+
+
+ // no page parent
+ if( $page_parent === null ) {
+
+ // bail early if no post id
+ if( !$post_id ) return false;
+
+
+ // get post parent
+ $post = get_post( $post_id );
+ $page_parent = $post->post_parent;
+
+ }
+
+
+ // compare
+ return $this->compare( $page_parent, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ return acf_get_location_rule('page')->rule_values( $choices, $rule );
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_page_parent' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page-template.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page-template.php
new file mode 100644
index 0000000..6b384f7
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page-template.php
@@ -0,0 +1,119 @@
+name = 'page_template';
+ $this->label = __("Page Template",'acf');
+ $this->category = 'page';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $post_type = acf_maybe_get( $screen, 'post_type' );
+
+
+ // lookup post_type
+ if( !$post_type ) {
+
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+
+ if( !$post_id ) return false;
+
+ $post_type = get_post_type( $post_id );
+
+ }
+
+
+ // page template 'default' rule is only for 'page' post type
+ // prevents 'Default Template' field groups appearing on all post types that allow for post templates (WP 4.7)
+ if( $rule['value'] === 'default' ) {
+
+ // bail ealry if not page
+ if( $post_type !== 'page' ) return false;
+
+ }
+
+
+ // return
+ return acf_get_location_rule('post_template')->rule_match( $result, $rule, $screen );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // vars
+ $choices = array(
+ 'default' => apply_filters( 'default_page_template_title', __('Default Template', 'acf') )
+ );
+
+
+ // get templates and merge them in
+ $templates = wp_get_theme()->get_page_templates();
+ $choices = array_merge($choices, $templates);
+
+
+ // return choices
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_page_template' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page-type.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page-type.php
new file mode 100644
index 0000000..e056467
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page-type.php
@@ -0,0 +1,161 @@
+name = 'page_type';
+ $this->label = __("Page Type",'acf');
+ $this->category = 'page';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+
+
+ // bail early if no post id
+ if( !$post_id ) return false;
+
+
+ // get post
+ $post = get_post( $post_id );
+
+
+ // compare
+ if( $rule['value'] == 'front_page') {
+
+ // vars
+ $front_page = (int) get_option('page_on_front');
+
+
+ // compare
+ $result = ( $front_page === $post->ID );
+
+ } elseif( $rule['value'] == 'posts_page') {
+
+ // vars
+ $posts_page = (int) get_option('page_for_posts');
+
+
+ // compare
+ $result = ( $posts_page === $post->ID );
+
+ } elseif( $rule['value'] == 'top_level') {
+
+ // vars
+ $page_parent = acf_maybe_get( $screen, 'page_parent', $post->post_parent );
+
+
+ // compare
+ $result = ( $page_parent == 0 );
+
+ } elseif( $rule['value'] == 'parent' ) {
+
+ // get children
+ $children = get_posts(array(
+ 'post_type' => $post->post_type,
+ 'post_parent' => $post->ID,
+ 'posts_per_page' => 1,
+ 'fields' => 'ids',
+ ));
+
+
+ // compare
+ $result = !empty( $children );
+
+ } elseif( $rule['value'] == 'child') {
+
+ // vars
+ $page_parent = acf_maybe_get( $screen, 'page_parent', $post->post_parent );
+
+
+ // compare
+ $result = ( $page_parent > 0 );
+
+ }
+
+
+ // reverse if 'not equal to'
+ if( $rule['operator'] == '!=' ) {
+
+ $result = !$result;
+
+ }
+
+
+ // return
+ return $result;
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ return array(
+ 'front_page' => __("Front Page",'acf'),
+ 'posts_page' => __("Posts Page",'acf'),
+ 'top_level' => __("Top Level Page (no parent)",'acf'),
+ 'parent' => __("Parent Page (has children)",'acf'),
+ 'child' => __("Child Page (has parent)",'acf'),
+ );
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_page_type' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page.php
new file mode 100644
index 0000000..732fee9
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page.php
@@ -0,0 +1,99 @@
+name = 'page';
+ $this->label = __("Page",'acf');
+ $this->category = 'page';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ return acf_get_location_rule('post')->rule_match( $result, $rule, $screen );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // get posts grouped by post type
+ $groups = acf_get_grouped_posts(array(
+ 'post_type' => 'page'
+ ));
+
+
+ // pop
+ $choices = array_pop( $groups );
+
+
+ // convert posts to titles
+ foreach( $choices as &$item ) {
+
+ $item = acf_get_post_title( $item );
+
+ }
+
+
+ // return
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_page' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-category.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-category.php
new file mode 100644
index 0000000..a88146a
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-category.php
@@ -0,0 +1,88 @@
+name = 'post_category';
+ $this->label = __("Post Category",'acf');
+ $this->category = 'post';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ return acf_get_location_rule('post_taxonomy')->rule_match( $result, $rule, $screen );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ $terms = acf_get_taxonomy_terms( 'category' );
+
+ if( !empty($terms) ) {
+
+ $choices = array_pop($terms);
+
+ }
+
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_post_category' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-format.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-format.php
new file mode 100644
index 0000000..0508533
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-format.php
@@ -0,0 +1,143 @@
+name = 'post_format';
+ $this->label = __("Post Format",'acf');
+ $this->category = 'post';
+
+ }
+
+
+ /*
+ * get_post_type
+ *
+ * This function will return the current post_type
+ *
+ * @type function
+ * @date 25/11/16
+ * @since 5.5.0
+ *
+ * @param $options (int)
+ * @return (mixed)
+ */
+
+ function get_post_type( $screen ) {
+
+ // vars
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+ $post_type = acf_maybe_get( $screen, 'post_type' );
+
+
+ // post_type
+ if( $post_type ) return $post_type;
+
+
+ // $post_id
+ if( $post_id ) return get_post_type( $post_id );
+
+
+ // return
+ return false;
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $post_format = acf_maybe_get( $screen, 'post_format' );
+
+
+ // find post format
+ if( !$post_format ) {
+
+ // get post id
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+ $post_type = $this->get_post_type( $screen );
+
+
+ // bail early if not a post
+ if( !$post_id || !$post_type ) return false;
+
+
+ // does post_type support 'post-format'
+ if( post_type_supports($post_type, 'post-formats') ) {
+
+ // update
+ $post_format = get_post_format($post_id);
+ $post_format = $post_format ? $post_format : 'standard';
+
+ }
+
+ }
+
+
+ // compare
+ return $this->compare( $post_format, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ return get_post_format_strings();
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_post_format' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-status.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-status.php
new file mode 100644
index 0000000..52a998a
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-status.php
@@ -0,0 +1,161 @@
+name = 'post_status';
+ $this->label = __("Post Status",'acf');
+ $this->category = 'post';
+
+ }
+
+
+ /*
+ * get_post_type
+ *
+ * This function will return the current post_type
+ *
+ * @type function
+ * @date 25/11/16
+ * @since 5.5.0
+ *
+ * @param $options (int)
+ * @return (mixed)
+ */
+
+ function get_post_type( $screen ) {
+
+ // vars
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+ $post_type = acf_maybe_get( $screen, 'post_type' );
+
+
+ // post_type
+ if( $post_type ) return $post_type;
+
+
+ // $post_id
+ if( $post_id ) return get_post_type( $post_id );
+
+
+ // return
+ return false;
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $post_status = acf_maybe_get( $screen, 'post_status' );
+
+
+ // find post format
+ if( !$post_status ) {
+
+ // get post id
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+
+
+ // bail early if not a post
+ if( !$post_id ) return false;
+
+
+ // update
+ $post_status = get_post_status( $post_id );
+
+ }
+
+
+ // auto-draft = draft
+ if( $post_status == 'auto-draft' ) {
+
+ $post_status = 'draft';
+
+ }
+
+
+ // match
+ return $this->compare( $post_status, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // globals
+ global $wp_post_statuses;
+
+
+ // append
+ if( !empty($wp_post_statuses) ) {
+
+ foreach( $wp_post_statuses as $status ) {
+
+ $choices[ $status->name ] = $status->label;
+
+ }
+
+ }
+
+
+ // return choices
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_post_status' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-taxonomy.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-taxonomy.php
new file mode 100644
index 0000000..6317b4b
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-taxonomy.php
@@ -0,0 +1,161 @@
+name = 'post_taxonomy';
+ $this->label = __("Post Taxonomy",'acf');
+ $this->category = 'post';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+ $terms = acf_maybe_get( $screen, 'post_taxonomy' );
+
+
+ // bail early if not a post
+ if( !$post_id ) return false;
+
+
+ // get term data
+ $data = acf_decode_taxonomy_term( $rule['value'] );
+ $term = get_term_by( 'slug', $data['term'], $data['taxonomy'] );
+
+
+ // attempt get term via ID (ACF4 uses ID)
+ if( !$term && is_numeric($data['term']) ) {
+
+ $term = get_term_by( 'id', $data['term'], $data['taxonomy'] );
+
+ }
+
+
+ // bail early if no term
+ if( !$term ) return false;
+
+
+ // not ajax, load real post's terms
+ if( $terms === null ) {
+
+ $terms = wp_get_post_terms( $post_id, $term->taxonomy, array('fields' => 'ids') );
+
+ }
+
+
+ // If no terms, this is a new post and should be treated as if it has the "Uncategorized" (1) category ticked
+ if( empty($terms) ) {
+
+ // get post type
+ $post_type = get_post_type( $post_id );
+
+
+ // if is category
+ if( is_object_in_taxonomy($post_type, 'category') ) {
+
+ $terms = array( 1 );
+
+ }
+
+ }
+
+
+ // match
+ if( !empty($terms) ) {
+
+ $result = in_array( $term->term_id, $terms );
+
+ }
+
+
+ // reverse if 'not equal to'
+ if( $rule['operator'] === '!=' ) {
+
+ $result = !$result;
+
+ }
+
+
+ // return
+ return $result;
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // get
+ $choices = acf_get_taxonomy_terms();
+
+
+ // unset post_format
+ if( isset($choices['post_format']) ) {
+
+ unset( $choices['post_format']) ;
+
+ }
+
+
+ // return
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_post_taxonomy' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-template.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-template.php
new file mode 100644
index 0000000..53c4ab1
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-template.php
@@ -0,0 +1,176 @@
+name = 'post_template';
+ $this->label = __("Post Template",'acf');
+ $this->category = 'post';
+ $this->public = acf_version_compare('wp', '>=', '4.7');
+
+ }
+
+
+ /*
+ * get_post_type
+ *
+ * This function will return the current post_type
+ *
+ * @type function
+ * @date 25/11/16
+ * @since 5.5.0
+ *
+ * @param $options (int)
+ * @return (mixed)
+ */
+
+ function get_post_type( $screen ) {
+
+ // vars
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+ $post_type = acf_maybe_get( $screen, 'post_type' );
+
+
+ // post_type
+ if( $post_type ) return $post_type;
+
+
+ // $post_id
+ if( $post_id ) return get_post_type( $post_id );
+
+
+ // return
+ return false;
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $templates = array();
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+ $page_template = acf_maybe_get( $screen, 'page_template' );
+ $post_type = $this->get_post_type( $screen );
+
+
+ // bail early if no post_type found (not a post)
+ if( !$post_type ) return false;
+
+
+ // get templates (WP 4.7)
+ if( acf_version_compare('wp', '>=', '4.7') ) {
+
+ $templates = acf_get_post_templates();
+
+ }
+
+
+ // 'page' is always a valid pt even if no templates exist in the theme
+ // allows scenario where page_template = 'default' and no templates exist
+ if( !isset($templates['page']) ) {
+
+ $templates['page'] = array();
+
+ }
+
+
+ // bail early if this post type does not allow for templates
+ if( !isset($templates[ $post_type ]) ) return false;
+
+
+ // get page template
+ if( !$page_template ) {
+
+ $page_template = get_post_meta( $post_id, '_wp_page_template', true );
+
+ }
+
+
+ // new post - no page template
+ if( !$page_template ) $page_template = "default";
+
+
+ // match
+ return $this->compare( $page_template, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // vars
+ $choices = array(
+ 'default' => apply_filters( 'default_page_template_title', __('Default Template', 'acf') )
+ );
+
+
+ // get templates (WP 4.7)
+ if( acf_version_compare('wp', '>=', '4.7') ) {
+
+ $templates = acf_get_post_templates();
+ $choices = array_merge($choices, $templates);
+
+ }
+
+
+ // return choices
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_post_template' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-type.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-type.php
new file mode 100644
index 0000000..8c9f9a4
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-type.php
@@ -0,0 +1,132 @@
+name = 'post_type';
+ $this->label = __("Post Type",'acf');
+ $this->category = 'post';
+
+ }
+
+
+ /*
+ * get_post_type
+ *
+ * This function will return the current post_type
+ *
+ * @type function
+ * @date 25/11/16
+ * @since 5.5.0
+ *
+ * @param $options (int)
+ * @return (mixed)
+ */
+
+ function get_post_type( $screen ) {
+
+ // vars
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+ $post_type = acf_maybe_get( $screen, 'post_type' );
+
+
+ // post_type
+ if( $post_type ) return $post_type;
+
+
+ // $post_id
+ if( $post_id ) return get_post_type( $post_id );
+
+
+ // return
+ return false;
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $post_type = $this->get_post_type( $screen );
+
+
+ // bail early if no post_type found (not a post)
+ if( !$post_type ) return false;
+
+
+ // match
+ return $this->compare( $post_type, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // get post types
+ // - removed show_ui to allow 3rd party code to register a post type using a custom admin edit page
+ $post_types = acf_get_post_types(array(
+ //'show_ui' => 1,
+ 'exclude' => array('attachment')
+ ));
+
+
+ // return choices
+ return acf_get_pretty_post_types( $post_types );
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_post_type' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post.php
new file mode 100644
index 0000000..d7698b8
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post.php
@@ -0,0 +1,127 @@
+name = 'post';
+ $this->label = __("Post",'acf');
+ $this->category = 'post';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $post_id = acf_maybe_get( $screen, 'post_id' );
+
+
+ // bail early if not post
+ if( !$post_id ) return false;
+
+
+ // compare
+ return $this->compare( $post_id, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // get post types
+ $post_types = acf_get_post_types(array(
+ 'exclude' => array('page', 'attachment')
+ ));
+
+
+ // get posts grouped by post type
+ $groups = acf_get_grouped_posts(array(
+ 'post_type' => $post_types
+ ));
+
+
+ if( !empty($groups) ) {
+
+ foreach( array_keys($groups) as $group_title ) {
+
+ // vars
+ $posts = acf_extract_var( $groups, $group_title );
+
+
+ // override post data
+ foreach( array_keys($posts) as $post_id ) {
+
+ // update
+ $posts[ $post_id ] = acf_get_post_title( $posts[ $post_id ] );
+
+ };
+
+
+ // append to $choices
+ $choices[ $group_title ] = $posts;
+
+ }
+
+ }
+
+
+ // return
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_post' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-taxonomy.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-taxonomy.php
new file mode 100644
index 0000000..8bec37f
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-taxonomy.php
@@ -0,0 +1,95 @@
+name = 'taxonomy';
+ $this->label = __("Taxonomy Term",'acf');
+ $this->category = 'forms';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $taxonomy = acf_maybe_get( $screen, 'taxonomy' );
+
+
+ // bail early if not taxonomy
+ if( !$taxonomy ) return false;
+
+
+ // return
+ return $this->compare( $taxonomy, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // vars
+ $choices = array( 'all' => __('All', 'acf') );
+ $choices = array_merge( $choices, acf_get_taxonomies() );
+
+
+ // return
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_taxonomy' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-user-form.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-user-form.php
new file mode 100644
index 0000000..cf24a44
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-user-form.php
@@ -0,0 +1,116 @@
+name = 'user_form';
+ $this->label = __("User Form",'acf');
+ $this->category = 'user';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $user_form = acf_maybe_get( $screen, 'user_form' );
+
+
+ // bail early if no user form
+ if( !$user_form ) return false;
+
+
+ // add is treated the same as edit
+ if( $user_form === 'add' ) {
+
+ $user_form = 'edit';
+
+ }
+
+
+ // match
+ return $this->compare( $user_form, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ return array(
+ 'all' => __('All', 'acf'),
+ 'edit' => __('Add / Edit', 'acf'),
+ 'register' => __('Register', 'acf')
+ );
+
+/*
+
+ // global
+ global $wp_roles;
+
+
+ // vars
+ $choices = array( 'all' => __('All', 'acf') );
+ $choices = array_merge( $choices, $wp_roles->get_names() );
+
+
+ // return
+ return $choices;
+*/
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_user_form' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-user-role.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-user-role.php
new file mode 100644
index 0000000..72b0ab0
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-user-role.php
@@ -0,0 +1,127 @@
+name = 'user_role';
+ $this->label = __("User Role",'acf');
+ $this->category = 'user';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $user_id = acf_maybe_get( $screen, 'user_id' );
+ $user_role = acf_maybe_get( $screen, 'user_role' );
+
+
+ // if user_role is supplied (3rd party compatibility)
+ if( $user_role ) {
+
+ // do nothing
+
+ // user_id (expected)
+ } elseif( $user_id ) {
+
+ // new user
+ if( $user_id == 'new' ) {
+
+ // set to default role
+ $user_role = get_option('default_role');
+
+ // existing user
+ } elseif( user_can($user_id, $rule['value']) ) {
+
+ // set to value and allow match
+ $user_role = $rule['value'];
+
+ }
+
+ // else
+ } else {
+
+ // not a user
+ return false;
+
+ }
+
+
+ // match
+ return $this->compare( $user_role, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // global
+ global $wp_roles;
+
+
+ // vars
+ $choices = array( 'all' => __('All', 'acf') );
+ $choices = array_merge( $choices, $wp_roles->get_names() );
+
+
+ // return
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_user_role' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-widget.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-widget.php
new file mode 100644
index 0000000..4b02040
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-widget.php
@@ -0,0 +1,110 @@
+name = 'widget';
+ $this->label = __("Widget",'acf');
+ $this->category = 'forms';
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+ function rule_match( $result, $rule, $screen ) {
+
+ // vars
+ $widget = acf_maybe_get( $screen, 'widget' );
+
+
+ // bail early if not widget
+ if( !$widget ) return false;
+
+
+ // return
+ return $this->compare( $widget, $rule );
+
+ }
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+ function rule_values( $choices, $rule ) {
+
+ // global
+ global $wp_widget_factory;
+
+
+ // vars
+ $choices = array( 'all' => __('All', 'acf') );
+
+
+ // loop
+ if( !empty( $wp_widget_factory->widgets ) ) {
+
+ foreach( $wp_widget_factory->widgets as $widget ) {
+
+ $choices[ $widget->id_base ] = $widget->name;
+
+ }
+
+ }
+
+
+ // return
+ return $choices;
+
+ }
+
+}
+
+// initialize
+acf_register_location_rule( 'acf_location_widget' );
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location.php
new file mode 100644
index 0000000..0e853e8
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location.php
@@ -0,0 +1,263 @@
+initialize();
+
+
+ // filters
+ $this->add_filter('acf/location/rule_match', true, array($this, 'rule_match'), 5, 3);
+ $this->add_filter('acf/location/rule_operators', true, array($this, 'rule_operators'), 5, 2);
+ $this->add_filter('acf/location/rule_values', true, array($this, 'rule_values'), 5, 2);
+
+ }
+
+
+ /*
+ * initialize
+ *
+ * This function will initialize the location rule
+ *
+ * @type function
+ * @date 27/6/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function initialize() {
+
+ /* do nothing */
+
+ }
+
+
+ /*
+ * add_filter
+ *
+ * This function checks if the function is_callable before adding the filter
+ *
+ * @type function
+ * @date 5/03/2014
+ * @since 5.0.0
+ *
+ * @param $tag (string)
+ * @param $function_to_add (string)
+ * @param $priority (int)
+ * @param $accepted_args (int)
+ * @return n/a
+ */
+
+ function add_filter( $tag = '', $specific = false, $function_to_add = '', $priority = 10, $accepted_args = 1 ) {
+
+ // specific
+ if( $specific ) {
+
+ $tag .= '/' . $this->name;
+
+ }
+
+
+ // add
+ if( is_callable($function_to_add) ) {
+
+ add_filter( $tag, $function_to_add, $priority, $accepted_args );
+
+ }
+
+ }
+
+
+ /*
+ * add_action
+ *
+ * This function checks if the function is_callable before adding the action
+ *
+ * @type function
+ * @date 5/03/2014
+ * @since 5.0.0
+ *
+ * @param $tag (string)
+ * @param $function_to_add (string)
+ * @param $priority (int)
+ * @param $accepted_args (int)
+ * @return n/a
+ */
+
+ function add_action( $tag = '', $specific = false, $function_to_add = '', $priority = 10, $accepted_args = 1 ) {
+
+ // specific
+ if( $specific ) {
+
+ $tag .= '/' . $this->name;
+
+ }
+
+
+ // add
+ if( is_callable($function_to_add) ) {
+
+ add_action( $tag, $function_to_add, $priority, $accepted_args );
+
+ }
+
+ }
+
+
+ /*
+ * compare
+ *
+ * This function will compare a value to a location rule and return a boolean result
+ *
+ * @type function
+ * @date 25/11/16
+ * @since 5.5.0
+ *
+ * @param $value (mixed)
+ * @param rule (array)
+ * @return (boolean)
+ */
+
+ function compare( $value, $rule ) {
+
+ // match
+ $match = ( $value == $rule['value'] );
+
+
+ // override for "all"
+ if( $rule['value'] == 'all' ) $match = true;
+
+
+ // reverse if 'not equal to'
+ if( $rule['operator'] == '!=' ) {
+
+ $match = !$match;
+
+ }
+
+
+ // return
+ return $match;
+
+ }
+
+
+ /*
+ * rule_match
+ *
+ * This function is used to match this location $rule to the current $screen
+ *
+ * @type function
+ * @date 3/01/13
+ * @since 3.5.7
+ *
+ * @param $match (boolean)
+ * @param $rule (array)
+ * @return $options (array)
+ */
+
+/*
+ function rule_match( $result, $rule, $screen ) {
+
+ return $result;
+
+ }
+*/
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available operators for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+/*
+ function rule_operators( $operators, $rule ) {
+
+ return $operators;
+
+ }
+*/
+
+
+ /*
+ * rule_operators
+ *
+ * This function returns the available values for this rule type
+ *
+ * @type function
+ * @date 30/5/17
+ * @since 5.6.0
+ *
+ * @param n/a
+ * @return (array)
+ */
+
+/*
+ function rule_values( $values, $rule ) {
+
+ return $values;
+
+ }
+*/
+
+
+/*
+ function rule_listeners() {
+
+ // js
+
+ }
+*/
+
+
+}
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/loop.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/loop.php
new file mode 100644
index 0000000..655ac36
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/loop.php
@@ -0,0 +1,351 @@
+loops = array();
+
+ }
+
+
+ /*
+ * is_empty
+ *
+ * This function will return true if no loops exist
+ *
+ * @type function
+ * @date 3/03/2016
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return (boolean)
+ */
+
+ function is_empty() {
+
+ return empty( $this->loops );
+
+ }
+
+
+ /*
+ * is_loop
+ *
+ * This function will return true if a loop exists for the given array index
+ *
+ * @type function
+ * @date 3/03/2016
+ * @since 5.3.2
+ *
+ * @param $i (int)
+ * @return (boolean)
+ */
+
+ function is_loop( $i = 0 ) {
+
+ return isset( $this->loops[ $i ] );
+
+ }
+
+
+ /*
+ * get_i
+ *
+ * This function will return a valid array index for the given $i
+ *
+ * @type function
+ * @date 3/03/2016
+ * @since 5.3.2
+ *
+ * @param $i (mixed)
+ * @return (int)
+ */
+
+ function get_i( $i = 0 ) {
+
+ // 'active'
+ if( $i === 'active' ) $i = -1;
+
+
+ // 'previous'
+ if( $i === 'previous' ) $i = -2;
+
+
+ // allow negative to look at end of loops
+ if( $i < 0 ) {
+
+ $i = count($this->loops) + $i;
+
+ }
+
+
+ // return
+ return $i;
+
+ }
+
+
+ /*
+ * add_loop
+ *
+ * This function will add a new loop
+ *
+ * @type function
+ * @date 3/03/2016
+ * @since 5.3.2
+ *
+ * @param $loop (array)
+ * @return n/a
+ */
+
+ function add_loop( $loop = array() ) {
+
+ // defaults
+ $loop = wp_parse_args( $loop, array(
+ 'selector' => '',
+ 'name' => '',
+ 'value' => false,
+ 'field' => false,
+ 'i' => -1,
+ 'post_id' => 0,
+ 'key' => ''
+ ));
+
+
+ // ensure array
+ $loop['value'] = acf_get_array( $loop['value'] );
+
+
+ // Re-index values if this loop starts from index 0.
+ // This allows ajax previews to work ($_POST data contains random unique array keys)
+ if( $loop['i'] == -1 ) {
+
+ $loop['value'] = array_values($loop['value']);
+
+ }
+
+
+ // append
+ $this->loops[] = $loop;
+
+
+ // return
+ return $loop;
+
+ }
+
+
+ /*
+ * update_loop
+ *
+ * This function will update a loop's setting
+ *
+ * @type function
+ * @date 3/03/2016
+ * @since 5.3.2
+ *
+ * @param $i (mixed)
+ * @param $key (string) the loop setting name
+ * @param $value (mixed) the loop setting value
+ * @return (boolean) true on success
+ */
+
+ function update_loop( $i = 'active', $key = null, $value = null ) {
+
+ // i
+ $i = $this->get_i( $i );
+
+
+ // bail early if no set
+ if( !$this->is_loop($i) ) return false;
+
+
+ // set
+ $this->loops[ $i ][ $key ] = $value;
+
+
+ // return
+ return true;
+
+ }
+
+
+ /*
+ * get_loop
+ *
+ * This function will return a loop, or loop's setting for a given index & key
+ *
+ * @type function
+ * @date 3/03/2016
+ * @since 5.3.2
+ *
+ * @param $i (mixed)
+ * @param $key (string) the loop setting name
+ * @return (mixed) false on failure
+ */
+
+ function get_loop( $i = 'active', $key = null ) {
+
+ // i
+ $i = $this->get_i( $i );
+
+
+ // bail early if no set
+ if( !$this->is_loop($i) ) return false;
+
+
+ // check for key
+ if( $key !== null ) {
+
+ return $this->loops[ $i ][ $key ];
+
+ }
+
+
+ // return
+ return $this->loops[ $i ];
+
+ }
+
+
+ /*
+ * remove_loop
+ *
+ * This function will remove a loop
+ *
+ * @type function
+ * @date 3/03/2016
+ * @since 5.3.2
+ *
+ * @param $i (mixed)
+ * @return (boolean) true on success
+ */
+
+ function remove_loop( $i = 'active' ) {
+
+ // i
+ $i = $this->get_i( $i );
+
+
+ // bail early if no set
+ if( !$this->is_loop($i) ) return false;
+
+
+ // remove
+ unset($this->loops[ $i ]);
+
+
+ // reset keys
+ $this->loops = array_values( $this->loops );
+
+ }
+
+}
+
+// initialize
+acf()->loop = new acf_loop();
+
+endif; // class_exists check
+
+
+
+/*
+* acf_add_loop
+*
+* alias of acf()->loop->add_loop()
+*
+* @type function
+* @date 6/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_add_loop( $loop = array() ) {
+
+ return acf()->loop->add_loop( $loop );
+
+}
+
+
+/*
+* acf_update_loop
+*
+* alias of acf()->loop->update_loop()
+*
+* @type function
+* @date 6/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_update_loop( $i = 'active', $key = null, $value = null ) {
+
+ return acf()->loop->update_loop( $i, $key, $value );
+
+}
+
+
+/*
+* acf_get_loop
+*
+* alias of acf()->loop->get_loop()
+*
+* @type function
+* @date 6/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_get_loop( $i = 'active', $key = null ) {
+
+ return acf()->loop->get_loop( $i, $key );
+
+}
+
+
+/*
+* acf_remove_loop
+*
+* alias of acf()->loop->remove_loop()
+*
+* @type function
+* @date 6/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_remove_loop( $i = 'active' ) {
+
+ return acf()->loop->remove_loop( $i );
+
+}
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/media.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/media.php
new file mode 100644
index 0000000..1b7ff28
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/media.php
@@ -0,0 +1,245 @@
+ _x('Select', 'verb', 'acf'),
+ 'edit' => _x('Edit', 'verb', 'acf'),
+ 'update' => _x('Update', 'verb', 'acf'),
+ 'uploadedTo' => __("Uploaded to this post",'acf'),
+ 'default_icon' => wp_mime_type_icon()
+ );
+
+
+ // return
+ return $l10n;
+
+ }
+
+
+ /*
+ * handle_upload_prefilter
+ *
+ * description
+ *
+ * @type function
+ * @date 16/02/2015
+ * @since 5.1.5
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function handle_upload_prefilter( $file ) {
+
+ // bail early if no acf field
+ if( empty($_POST['_acfuploader']) ) {
+
+ return $file;
+
+ }
+
+
+ // load field
+ $field = acf_get_field( $_POST['_acfuploader'] );
+
+ if( !$field ) {
+
+ return $file;
+
+ }
+
+
+ // get errors
+ $errors = acf_validate_attachment( $file, $field, 'upload' );
+
+
+ // filter for 3rd party customization
+ $errors = apply_filters("acf/upload_prefilter", $errors, $file, $field);
+ $errors = apply_filters("acf/upload_prefilter/type={$field['type']}", $errors, $file, $field );
+ $errors = apply_filters("acf/upload_prefilter/name={$field['name']}", $errors, $file, $field );
+ $errors = apply_filters("acf/upload_prefilter/key={$field['key']}", $errors, $file, $field );
+
+
+ // append error
+ if( !empty($errors) ) {
+
+ $file['error'] = implode("\n", $errors);
+
+ }
+
+
+ // return
+ return $file;
+
+ }
+
+
+ /*
+ * save_files
+ *
+ * This function will save the $_FILES data
+ *
+ * @type function
+ * @date 24/10/2014
+ * @since 5.0.9
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function save_files( $post_id = 0 ) {
+
+ // bail early if no $_FILES data
+ if( empty($_FILES['acf']['name']) ) {
+
+ return;
+
+ }
+
+
+ // upload files
+ acf_upload_files();
+
+ }
+
+
+ /*
+ * admin_footer
+ *
+ * description
+ *
+ * @type function
+ * @date 19/02/2015
+ * @since 5.1.5
+ *
+ * @param $post_id (int)
+ * @return $post_id (int)
+ */
+
+ function admin_footer() {
+
+?>
+
+', $errors);
+
+ }
+
+
+ // return
+ return $response;
+
+ }
+
+}
+
+
+// initialize
+new acf_media();
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/revisions.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/revisions.php
new file mode 100644
index 0000000..4dcb8e7
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/revisions.php
@@ -0,0 +1,476 @@
+ID;
+
+ }
+
+
+ // get all postmeta
+ $meta = get_post_meta( $post_id );
+
+
+ // bail early if no meta
+ if( !$meta ) return $fields;
+
+
+ // loop
+ foreach( $meta as $name => $value ) {
+
+ // attempt to find key value
+ $key = acf_maybe_get( $meta, '_'.$name );
+
+
+ // bail ealry if no key
+ if( !$key ) continue;
+
+
+ // update vars
+ $value = $value[0];
+ $key = $key[0];
+
+
+ // bail early if $key is a not a field_key
+ if( !acf_is_field_key($key) ) continue;
+
+
+ // get field
+ $field = acf_get_field( $key );
+ $field_title = $field['label'] . ' (' . $name . ')';
+ $field_order = $field['menu_order'];
+ $ancestors = acf_get_field_ancestors( $field );
+
+
+ // ancestors
+ if( !empty($ancestors) ) {
+
+ // vars
+ $count = count($ancestors);
+ $oldest = acf_get_field( $ancestors[$count-1] );
+
+
+ // update vars
+ $field_title = str_repeat('- ', $count) . $field_title;
+ $field_order = $oldest['menu_order'] . '.1';
+
+ }
+
+
+ // append
+ $append[ $name ] = $field_title;
+ $order[ $name ] = $field_order;
+
+
+ // hook into specific revision field filter and return local value
+ add_filter("_wp_post_revision_field_{$name}", array($this, 'wp_post_revision_field'), 10, 4);
+
+ }
+
+
+ // append
+ if( !empty($append) ) {
+
+ // vars
+ $prefix = '_';
+
+
+ // add prefix
+ $append = acf_add_array_key_prefix($append, $prefix);
+ $order = acf_add_array_key_prefix($order, $prefix);
+
+
+ // sort by name (orders sub field values correctly)
+ array_multisort($order, $append);
+
+
+ // remove prefix
+ $append = acf_remove_array_key_prefix($append, $prefix);
+
+
+ // append
+ $fields = $fields + $append;
+
+ }
+
+
+ // return
+ return $fields;
+
+ }
+
+
+ /*
+ * wp_post_revision_field
+ *
+ * This filter will load the value for the given field and return it for rendering
+ *
+ * @type filter
+ * @date 11/08/13
+ *
+ * @param $value (mixed) should be false as it has not yet been loaded
+ * @param $field_name (string) The name of the field
+ * @param $post (mixed) Holds the $post object to load from - in WP 3.5, this is not passed!
+ * @param $direction (string) to / from - not used
+ * @return $value (string)
+ */
+
+ function wp_post_revision_field( $value, $field_name, $post = null, $direction = false) {
+
+ // bail ealry if is empty
+ if( empty($value) ) return $value;
+
+
+ // value has not yet been 'maybe_unserialize'
+ $value = maybe_unserialize( $value );
+
+
+ // vars
+ $post_id = $post->ID;
+
+
+ // load field
+ $field = acf_maybe_get_field( $field_name, $post_id );
+
+
+ // default formatting
+ if( is_array($value) ) {
+
+ $value = implode(', ', $value);
+
+ } elseif( is_object($value) ) {
+
+ $value = serialize($value);
+
+ }
+
+
+ // image
+ if( $field['type'] == 'image' || $field['type'] == 'file' ) {
+
+ $url = wp_get_attachment_url($value);
+ $value = $value . ' (' . $url . ')';
+
+ }
+
+
+ // return
+ return $value;
+
+ }
+
+
+ /*
+ * wp_restore_post_revision
+ *
+ * This action will copy and paste the metadata from a revision to the post
+ *
+ * @type action
+ * @date 11/08/13
+ *
+ * @param $parent_id (int) the destination post
+ * @return $revision_id (int) the source post
+ */
+
+ function wp_restore_post_revision( $post_id, $revision_id ) {
+
+ // copy postmeta from revision to post (restore from revision)
+ acf_copy_postmeta( $revision_id, $post_id );
+
+
+ // Make sure the latest revision is also updated to match the new $post data
+ // get latest revision
+ $revision = acf_get_post_latest_revision( $post_id );
+
+
+ // save
+ if( $revision ) {
+
+ // copy postmeta from revision to latest revision (potentialy may be the same, but most likely are different)
+ acf_copy_postmeta( $revision_id, $revision->ID );
+
+ }
+
+ }
+
+
+ /*
+ * acf_validate_post_id
+ *
+ * This function will modify the $post_id and allow loading values from a revision
+ *
+ * @type function
+ * @date 6/3/17
+ * @since 5.5.10
+ *
+ * @param $post_id (int)
+ * @param $_post_id (int)
+ * @return $post_id (int)
+ */
+
+ function acf_validate_post_id( $post_id, $_post_id ) {
+
+ // bail early if no preview in URL
+ if( !isset($_GET['preview']) ) return $post_id;
+
+
+ // bail early if $post_id is not numeric
+ if( !is_numeric($post_id) ) return $post_id;
+
+
+ // vars
+ $k = $post_id;
+ $preview_id = 0;
+
+
+ // check cache
+ if( isset($this->cache[$k]) ) return $this->cache[$k];
+
+
+ // validate
+ if( isset($_GET['preview_id']) ) {
+
+ $preview_id = (int) $_GET['preview_id'];
+
+ } elseif( isset($_GET['p']) ) {
+
+ $preview_id = (int) $_GET['p'];
+
+ } elseif( isset($_GET['page_id']) ) {
+
+ $preview_id = (int) $_GET['page_id'];
+
+ }
+
+
+ // bail early id $preview_id does not match $post_id
+ if( $preview_id != $post_id ) return $post_id;
+
+
+ // attempt find revision
+ $revision = acf_get_post_latest_revision( $post_id );
+
+
+ // save
+ if( $revision && $revision->post_parent == $post_id) {
+
+ $post_id = (int) $revision->ID;
+
+ }
+
+
+ // set cache
+ $this->cache[$k] = $post_id;
+
+
+ // return
+ return $post_id;
+
+ }
+
+}
+
+// initialize
+acf()->revisions = new acf_revisions();
+
+endif; // class_exists check
+
+
+/*
+* acf_save_post_revision
+*
+* This function will copy meta from a post to it's latest revision
+*
+* @type function
+* @date 26/09/2016
+* @since 5.4.0
+*
+* @param $post_id (int)
+* @return n/a
+*/
+
+function acf_save_post_revision( $post_id = 0 ) {
+
+ // get latest revision
+ $revision = acf_get_post_latest_revision( $post_id );
+
+
+ // save
+ if( $revision ) {
+
+ acf_copy_postmeta( $post_id, $revision->ID );
+
+ }
+
+}
+
+
+/*
+* acf_get_post_latest_revision
+*
+* This function will return the latest revision for a given post
+*
+* @type function
+* @date 25/06/2016
+* @since 5.3.8
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_get_post_latest_revision( $post_id ) {
+
+ // vars
+ $revisions = wp_get_post_revisions( $post_id );
+
+
+ // shift off and return first revision (will return null if no revisions)
+ $revision = array_shift($revisions);
+
+
+ // return
+ return $revision;
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/third_party.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/third_party.php
new file mode 100644
index 0000000..6fee7cb
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/third_party.php
@@ -0,0 +1,182 @@
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/updates.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/updates.php
new file mode 100644
index 0000000..1b610cd
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/updates.php
@@ -0,0 +1,464 @@
+ '',
+ 'key' => '',
+ 'slug' => '',
+ 'basename' => '',
+ 'version' => '',
+ ));
+
+
+ // Check if is_plugin_active() function exists. This is required on the front end of the
+ // site, since it is in a file that is normally only loaded in the admin.
+ if( !function_exists( 'is_plugin_active' ) ) {
+
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
+
+ }
+
+
+ // bail early if not active plugin (included in theme)
+ if( !is_plugin_active($plugin['basename']) ) return;
+
+
+ // add custom message in plugin update row
+ // removed: decided this message will have a negative impact on user
+ // if( is_admin() ) {
+ //
+ // add_action('in_plugin_update_message-' . $plugin['basename'], array($this, 'modify_plugin_update_message'), 10, 2 );
+ //
+ // }
+
+
+ // append
+ $this->plugins[ $plugin['basename'] ] = $plugin;
+
+ }
+
+
+ /*
+ * request
+ *
+ * This function will make a request to the ACF update server
+ *
+ * @type function
+ * @date 8/4/17
+ * @since 5.5.10
+ *
+ * @param $query (string)
+ * @param $body (array)
+ * @return (mixed)
+ */
+
+ function request( $query = 'index.php', $body = null ) {
+
+ // vars
+ $url = 'https://connect.advancedcustomfields.com/' . $query;
+
+
+ // test
+ if( $this->dev ) $url = 'http://connect/' . $query;
+
+
+ // log
+ //acf_log('acf connect: '. $url, $body);
+
+
+ // post
+ $raw_response = wp_remote_post( $url, array(
+ 'timeout' => 10,
+ 'body' => $body
+ ));
+
+
+ // wp error
+ if( is_wp_error($raw_response) ) {
+
+ return $raw_response;
+
+ // http error
+ } elseif( wp_remote_retrieve_response_code($raw_response) != 200 ) {
+
+ return new WP_Error( 'server_error', wp_remote_retrieve_response_message($raw_response) );
+
+ }
+
+
+ // decode response
+ $json = json_decode( wp_remote_retrieve_body($raw_response), true );
+
+
+ // allow non json value
+ if( $json === null ) {
+
+ return wp_remote_retrieve_body($raw_response);
+
+ }
+
+
+ // return
+ return $json;
+
+ }
+
+
+ /*
+ * get_plugin_info
+ *
+ * This function will get plugin info and save as transient
+ *
+ * @type function
+ * @date 9/4/17
+ * @since 5.5.10
+ *
+ * @param $id (string)
+ * @return (mixed)
+ */
+
+ function get_plugin_info( $id = '' ) {
+
+ // var
+ $transient_name = 'acf_plugin_info_'.$id;
+
+
+ // delete transient (force-check is used to refresh)
+ if( !empty($_GET['force-check']) ) {
+
+ delete_transient($transient_name);
+
+ }
+
+
+ // try transient
+ $transient = get_transient($transient_name);
+ if( $transient !== false ) return $transient;
+
+
+ // connect
+ $response = $this->request('v2/plugins/get-info?p='.$id);
+
+
+ // ensure response is expected JSON array (not string)
+ if( is_string($response) ) {
+ $response = new WP_Error( 'server_error', esc_html($response) );
+ }
+
+
+ // update transient
+ set_transient($transient_name, $response, HOUR_IN_SECONDS );
+
+
+ // return
+ return $response;
+
+ }
+
+
+ /*
+ * refresh_plugins_transient
+ *
+ * This function will refresh plugin update info to the transient
+ *
+ * @type function
+ * @date 11/4/17
+ * @since 5.5.10
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function refresh_plugins_transient() {
+
+ // vars
+ $transient = get_site_transient('update_plugins');
+
+
+ // bail early if no transient
+ if( empty($transient) ) return;
+
+
+ // update (will trigger modify function)
+ set_site_transient( 'update_plugins', $transient );
+
+ }
+
+
+ /*
+ * modify_plugins_transient
+ *
+ * This function will connect to the ACF website and find update information
+ *
+ * @type function
+ * @date 16/01/2014
+ * @since 5.0.0
+ *
+ * @param $transient (object)
+ * @return $transient
+ */
+
+ function modify_plugins_transient( $transient ) {
+
+ // bail early if no response (error)
+ if( !isset($transient->response) ) return $transient;
+
+
+ // fetch updates once (this filter is called multiple times during a single page load)
+ if( !$this->updates ) {
+
+ // vars
+ $post = array(
+ 'plugins' => wp_json_encode($this->plugins),
+ 'wp' => wp_json_encode(array(
+ 'wp_name' => get_bloginfo('name'),
+ 'wp_url' => home_url(),
+ 'wp_version' => get_bloginfo('version'),
+ 'wp_language' => get_bloginfo('language'),
+ 'wp_timezone' => get_option('timezone_string'),
+ )),
+ 'acf' => wp_json_encode(array(
+ 'acf_version' => get_option('acf_version'),
+ 'acf_pro' => (defined('ACF_PRO') && ACF_PRO),
+ )),
+ );
+
+
+ // connect
+ $this->updates = $this->request('v2/plugins/update-check', $post);
+
+ }
+
+
+ // append
+ if( is_array($this->updates) ) {
+
+ foreach( $this->updates['plugins'] as $basename => $update ) {
+
+ $transient->response[ $basename ] = (object) $update;
+
+ }
+
+ }
+
+
+ // return
+ return $transient;
+
+ }
+
+
+ /*
+ * modify_plugin_details
+ *
+ * This function will populate the plugin data visible in the 'View details' popup
+ *
+ * @type function
+ * @date 17/01/2014
+ * @since 5.0.0
+ *
+ * @param $result (bool|object)
+ * @param $action (string)
+ * @param $args (object)
+ * @return $result
+ */
+
+ function modify_plugin_details( $result, $action = null, $args = null ) {
+
+ // vars
+ $plugin = false;
+
+
+ // only for 'plugin_information' action
+ if( $action !== 'plugin_information' ) return $result;
+
+
+ // find plugin via slug
+ foreach( $this->plugins as $p ) {
+
+ if( $args->slug == $p['slug'] ) $plugin = $p;
+
+ }
+
+
+ // bail early if plugin not found
+ if( !$plugin ) return $result;
+
+
+ // connect
+ $response = $this->get_plugin_info($plugin['id']);
+
+
+ // bail early if no response
+ if( !is_array($response) ) return $result;
+
+
+ // remove tags (different context)
+ unset($response['tags']);
+
+
+ // convert to object
+ $response = (object) $response;
+
+
+ // sections
+ $sections = array(
+ 'description' => '',
+ 'installation' => '',
+ 'changelog' => '',
+ 'upgrade_notice' => ''
+ );
+
+ foreach( $sections as $k => $v ) {
+
+ $sections[ $k ] = $response->$k;
+
+ }
+
+ $response->sections = $sections;
+
+
+ // return
+ return $response;
+
+ }
+
+
+ /*
+ * modify_plugin_update_message
+ *
+ * Displays an update message for plugin list screens.
+ * Shows only the version updates from the current until the newest version
+ *
+ * @type function
+ * @date 14/06/2016
+ * @since 5.3.8
+ *
+ * @param $plugin_data (array)
+ * @param $r (object)
+ * @return n/a
+ */
+
+/*
+ function modify_plugin_update_message( $plugin_data, $response ) {
+
+ // show notice if exists in transient data
+ if( isset($response->notice) ) {
+
+ echo '' . $response->notice . '
';
+
+ }
+
+ }
+*/
+
+}
+
+
+/*
+* acf_updates
+*
+* The main function responsible for returning the one true acf_updates instance to functions everywhere.
+* Use this function like you would a global variable, except without needing to declare the global.
+*
+* Example:
+*
+* @type function
+* @date 9/4/17
+* @since 5.5.12
+*
+* @param n/a
+* @return (object)
+*/
+
+function acf_updates() {
+
+ global $acf_updates;
+
+ if( !isset($acf_updates) ) {
+
+ $acf_updates = new acf_updates();
+
+ }
+
+ return $acf_updates;
+
+}
+
+
+/*
+* acf_register_plugin_update
+*
+* alias of acf_updates()->add_plugin()
+*
+* @type function
+* @date 12/4/17
+* @since 5.5.10
+*
+* @param $post_id (int)
+* @return $post_id (int)
+*/
+
+function acf_register_plugin_update( $plugin ) {
+
+ acf_updates()->add_plugin( $plugin );
+
+}
+
+
+endif; // class_exists check
+
+?>
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php
new file mode 100644
index 0000000..99e01da
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php
@@ -0,0 +1,407 @@
+errors = array();
+
+
+ // ajax
+ add_action('wp_ajax_acf/validate_save_post', array($this, 'ajax_validate_save_post'));
+ add_action('wp_ajax_nopriv_acf/validate_save_post', array($this, 'ajax_validate_save_post'));
+ add_action('acf/validate_save_post', array($this, 'acf_validate_save_post'), 5);
+
+ }
+
+
+ /*
+ * add_error
+ *
+ * This function will add an error message for a field
+ *
+ * @type function
+ * @date 25/11/2013
+ * @since 5.0.0
+ *
+ * @param $input (string) name attribute of DOM elmenet
+ * @param $message (string) error message
+ * @return $post_id (int)
+ */
+
+ function add_error( $input, $message ) {
+
+ // add to array
+ $this->errors[] = array(
+ 'input' => $input,
+ 'message' => $message
+ );
+
+ }
+
+
+ /*
+ * get_error
+ *
+ * This function will return an error for a given input
+ *
+ * @type function
+ * @date 5/03/2016
+ * @since 5.3.2
+ *
+ * @param $input (string) name attribute of DOM elmenet
+ * @return (mixed)
+ */
+
+ function get_error( $input ) {
+
+ // bail early if no errors
+ if( empty($this->errors) ) return false;
+
+
+ // loop
+ foreach( $this->errors as $error ) {
+
+ if( $error['input'] === $input ) return $error;
+
+ }
+
+
+ // return
+ return false;
+
+ }
+
+
+ /*
+ * get_errors
+ *
+ * This function will return validation errors
+ *
+ * @type function
+ * @date 25/11/2013
+ * @since 5.0.0
+ *
+ * @param n/a
+ * @return (array|boolean)
+ */
+
+ function get_errors() {
+
+ // bail early if no errors
+ if( empty($this->errors) ) return false;
+
+
+ // return
+ return $this->errors;
+
+ }
+
+
+ /*
+ * reset_errors
+ *
+ * This function will remove all errors
+ *
+ * @type function
+ * @date 4/03/2016
+ * @since 5.3.2
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function reset_errors() {
+
+ $this->errors = array();
+
+ }
+
+
+ /*
+ * ajax_validate_save_post
+ *
+ * This function will validate the $_POST data via AJAX
+ *
+ * @type function
+ * @date 27/10/2014
+ * @since 5.0.9
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function ajax_validate_save_post() {
+
+ // validate
+ if( !acf_verify_ajax() ) die();
+
+
+ // vars
+ $json = array(
+ 'valid' => 1,
+ 'errors' => 0
+ );
+
+
+ // success
+ if( acf_validate_save_post() ) {
+
+ wp_send_json_success($json);
+
+ }
+
+
+ // update vars
+ $json['valid'] = 0;
+ $json['errors'] = acf_get_validation_errors();
+
+
+ // return
+ wp_send_json_success($json);
+
+ }
+
+
+ /*
+ * acf_validate_save_post
+ *
+ * This function will loop over $_POST data and validate
+ *
+ * @type function
+ * @date 7/09/2016
+ * @since 5.4.0
+ *
+ * @param n/a
+ * @return n/a
+ */
+
+ function acf_validate_save_post() {
+
+ // bail early if no $_POST
+ if( empty($_POST['acf']) ) return;
+
+
+ // validate
+ acf_validate_values( $_POST['acf'], 'acf' );
+
+ }
+
+}
+
+// initialize
+acf()->validation = new acf_validation();
+
+endif; // class_exists check
+
+
+/*
+* Public functions
+*
+* alias of acf()->validation->function()
+*
+* @type function
+* @date 6/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_add_validation_error( $input, $message = '' ) {
+
+ return acf()->validation->add_error( $input, $message );
+
+}
+
+function acf_get_validation_errors() {
+
+ return acf()->validation->get_errors();
+
+}
+
+function acf_get_validation_error() {
+
+ return acf()->validation->get_error( $input );
+
+}
+
+function acf_reset_validation_errors() {
+
+ return acf()->validation->reset_errors();
+
+}
+
+
+/*
+* acf_validate_save_post
+*
+* This function will validate $_POST data and add errors
+*
+* @type function
+* @date 25/11/2013
+* @since 5.0.0
+*
+* @param $show_errors (boolean) if true, errors will be shown via a wp_die screen
+* @return (boolean)
+*/
+
+function acf_validate_save_post( $show_errors = false ) {
+
+ // action
+ do_action('acf/validate_save_post');
+
+
+ // vars
+ $errors = acf_get_validation_errors();
+
+
+ // bail ealry if no errors
+ if( !$errors ) return true;
+
+
+ // show errors
+ if( $show_errors ) {
+
+ $message = '' . __('Validation failed', 'acf') . ' ';
+ $message .= '';
+ foreach( $errors as $error ) {
+
+ $message .= '' . $error['message'] . ' ';
+
+ }
+ $message .= ' ';
+
+
+ // die
+ wp_die( $message, __('Validation failed', 'acf') );
+
+ }
+
+
+ // return
+ return false;
+
+}
+
+
+/*
+* acf_validate_values
+*
+* This function will validate an array of field values
+*
+* @type function
+* @date 6/10/13
+* @since 5.0.0
+*
+* @param values (array)
+* @param $input_prefix (string)
+* @return n/a
+*/
+
+function acf_validate_values( $values, $input_prefix = '' ) {
+
+ // bail early if empty
+ if( empty($values) ) return;
+
+
+ // loop
+ foreach( $values as $key => $value ) {
+
+ // vars
+ $field = acf_get_field( $key );
+ $input = $input_prefix . '[' . $key . ']';
+
+
+ // bail early if not found
+ if( !$field ) continue;
+
+
+ // validate
+ acf_validate_value( $value, $field, $input );
+
+ }
+
+}
+
+
+/*
+* acf_validate_value
+*
+* This function will validate a field's value
+*
+* @type function
+* @date 6/10/13
+* @since 5.0.0
+*
+* @param n/a
+* @return n/a
+*/
+
+function acf_validate_value( $value, $field, $input ) {
+
+ // vars
+ $valid = true;
+ $message = sprintf( __( '%s value is required', 'acf' ), $field['label'] );
+
+
+ // valid
+ if( $field['required'] ) {
+
+ // valid is set to false if the value is empty, but allow 0 as a valid value
+ if( empty($value) && !is_numeric($value) ) {
+
+ $valid = false;
+
+ }
+
+ }
+
+
+ // filter for 3rd party customization
+ $valid = apply_filters( "acf/validate_value", $valid, $value, $field, $input );
+ $valid = apply_filters( "acf/validate_value/type={$field['type']}", $valid, $value, $field, $input );
+ $valid = apply_filters( "acf/validate_value/name={$field['name']}", $valid, $value, $field, $input );
+ $valid = apply_filters( "acf/validate_value/key={$field['key']}", $valid, $value, $field, $input );
+
+
+ // allow $valid to be a custom error message
+ if( !empty($valid) && is_string($valid) ) {
+
+ $message = $valid;
+ $valid = false;
+
+ }
+
+
+ if( !$valid ) {
+
+ acf_add_validation_error( $input, $message );
+ return false;
+
+ }
+
+
+ // return
+ return true;
+
+}
diff --git a/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/walkers/class-acf-walker-nav-menu-edit.php b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/walkers/class-acf-walker-nav-menu-edit.php
new file mode 100644
index 0000000..15bc867
--- /dev/null
+++ b/wordpress/wp-content/plugins/advanced-custom-fields-pro/includes/walkers/class-acf-walker-nav-menu-edit.php
@@ -0,0 +1,146 @@
+
+ $search = ' ` tag.
+ */
+ public function get_tr_end() {
+ return '';
+ }
+
+ /**
+ * Return an opening `` tag.
+ *
+ * @since 1.0.0
+ *
+ * @return string $value Opening ` ` tag with attributes.
+ */
+ public function get_th_start() {
+ return ' ';
+ }
+
+ /**
+ * Return a closing ` ` tag.
+ *
+ * @since 1.0.0
+ *
+ * @return string $value Closing `` tag.
+ */
+ public function get_th_end() {
+ return '';
+ }
+
+ /**
+ * Return an opening `` tag.
+ *
+ * @since 1.0.0
+ *
+ * @return string $value Opening ` ` tag.
+ */
+ public function get_td_start() {
+ return ' ';
+ }
+
+ /**
+ * Return a closing ` ` tag.
+ *
+ * @since 1.0.0
+ *
+ * @return string $value Closing `` tag.
+ */
+ public function get_td_end() {
+ return '';
+ }
+
+ /**
+ * Return an opening `` tag.
+ *
+ * @since 1.2.0
+ * @since 1.3.0 Added $args parameter.
+ *
+ * @param array $args Array of arguments.
+ * @return string $value Opening `` tag.
+ */
+ public function get_fieldset_start( $args = array() ) {
+ $fieldset = '` tag.
+ *
+ * @since 1.2.0
+ *
+ * @return string $value Closing `` tag.
+ */
+ public function get_fieldset_end() {
+ return ' ';
+ }
+
+ /**
+ * Return an opening `` tag.
+ *
+ * @since 1.3.0
+ *
+ * @return string
+ */
+ public function get_legend_start() {
+ return '';
+ }
+
+ /**
+ * Return a closing ` ` tag.
+ *
+ * @since 1.3.0
+ *
+ * @return string
+ */
+ public function get_legend_end() {
+ return ' ';
+ }
+
+ /**
+ * Return string wrapped in a `` tag.
+ *
+ * @since 1.0.0
+ *
+ * @param string $text Content to wrap in a `
` tag.
+ * @return string $value Content wrapped in a `
` tag.
+ */
+ public function get_p( $text = '' ) {
+ return '
' . $text . '
';
+ }
+
+ /**
+ * Return a form with for attribute.
+ *
+ * @since 1.0.0
+ *
+ * @param string $label_for Form input to associate `` with.
+ * @param string $label_text Text to display in the `` tag.
+ * @return string $value `` tag with filled out parts.
+ */
+ public function get_label( $label_for = '', $label_text = '' ) {
+ return '' . strip_tags( $label_text ) . ' ';
+ }
+
+ /**
+ * Return an html attribute denoting a required field.
+ *
+ * @since 1.3.0
+ *
+ * @param bool $required Whether or not the field is required.
+ * @return string `Required` attribute.
+ */
+ public function get_required_attribute( $required = false ) {
+ $attr = '';
+ if ( $required ) {
+ $attr .= 'required="true"';
+ }
+ return $attr;
+ }
+
+ /**
+ * Return a `` to indicate required status, with class attribute.
+ *
+ * @since 1.0.0
+ *
+ * @return string Span tag.
+ */
+ public function get_required_span() {
+ return ' * ';
+ }
+
+ /**
+ * Return an aria-required attribute set to true.
+ *
+ * @since 1.3.0
+ *
+ * @param bool $required Whether or not the field is required.
+ * @return string Aria required attribute
+ */
+ public function get_aria_required( $required = false ) {
+ $attr = ( $required ) ? 'true' : 'false';
+ return 'aria-required="' . $attr . '"';
+ }
+
+ /**
+ * Return an `` tag with title attribute holding help text.
+ *
+ * @since 1.0.0
+ *
+ * @param string $help_text Text to use in the title attribute.
+ * @return string tag with filled out parts.
+ */
+ public function get_help( $help_text = '' ) {
+ return ' ';
+ }
+
+ /**
+ * Return a `` tag with the help text.
+ *
+ * @since 1.3.0
+ *
+ * @param string $help_text Text to display after the input.
+ * @return string
+ */
+ public function get_description( $help_text = '' ) {
+ return '' . $help_text . ' ';
+ }
+
+ /**
+ * Return a maxlength HTML attribute with a specified length.
+ *
+ * @since 1.0.0
+ *
+ * @param string $length How many characters the max length should be set to.
+ * @return string $value Maxlength HTML attribute.
+ */
+ public function get_maxlength( $length = '' ) {
+ return 'maxlength="' . esc_attr( $length ) . '"';
+ }
+
+ /**
+ * Return a onblur HTML attribute for a specified value.
+ *
+ * @since 1.0.0
+ *
+ * @param string $text Text to place in the onblur attribute.
+ * @return string $value Onblur HTML attribute.
+ */
+ public function get_onblur( $text = '' ) {
+ return 'onblur="' . esc_attr( $text ) . '"';
+ }
+
+ /**
+ * Return a placeholder HTML attribtue for a specified value.
+ *
+ * @since 1.3.0
+ *
+ * @param string $text Text to place in the placeholder attribute.
+ * @return string $value Placeholder HTML attribute.
+ */
+ public function get_placeholder( $text = '' ) {
+ return 'placeholder="' . esc_attr( $text ) . '"';
+ }
+
+ /**
+ * Return a span that will only be visible for screenreaders.
+ *
+ * @since 1.3.0
+ *
+ * @param string $text Text to visually hide.
+ * @return string $value Visually hidden text meant for screen readers.
+ */
+ public function get_hidden_text( $text = '' ) {
+ return '' . $text . ' ';
+ }
+
+ /**
+ * Return a populated `` input.
+ *
+ * @since 1.0.0
+ *
+ * @param array $args Arguments to use with the `` input.
+ * @return string $value Complete input with options and selected attribute.
+ */
+ public function get_select_input( $args = array() ) {
+ $defaults = $this->get_default_input_parameters(
+ array( 'selections' => array() )
+ );
+
+ $args = wp_parse_args( $args, $defaults );
+
+ $value = '';
+ if ( $args['wrap'] ) {
+ $value = $this->get_tr_start();
+ $value .= $this->get_th_start();
+ $value .= $this->get_label( $args['name'], $args['labeltext'] );
+ if ( $args['required'] ) { $value .= $this->get_required_span(); }
+ if ( ! empty( $args['helptext'] ) ) { $value .= $this->get_help( $args['helptext'] ); }
+ $value .= $this->get_th_end();
+ $value .= $this->get_td_start();
+ }
+
+ $value .= '';
+ if ( ! empty( $args['selections']['options'] ) && is_array( $args['selections']['options'] ) ) {
+ foreach ( $args['selections']['options'] as $val ) {
+ $result = '';
+ $bool = disp_boolean( $val['attr'] );
+
+ if ( is_numeric( $args['selections']['selected'] ) ) {
+ $selected = disp_boolean( $args['selections']['selected'] );
+ } elseif ( in_array( $args['selections']['selected'], array( 'true', 'false' ) ) ) {
+ $selected = $args['selections']['selected'];
+ }
+
+ if ( ( ! empty( $selected ) ) && $selected === $bool ) {
+ $result = ' selected="selected"';
+ } else {
+ if ( array_key_exists( 'default', $val ) && ! empty( $val['default'] ) ) {
+ if ( empty( $selected ) ) {
+ $result = ' selected="selected"';
+ }
+ }
+ }
+
+ if ( ! is_numeric( $args['selections']['selected'] ) && ( ! empty( $args['selections']['selected'] ) && $args['selections']['selected'] === $val['attr'] ) ) {
+ $result = ' selected="selected"';
+ }
+
+ $value .= '' . $val['text'] . ' ';
+ }
+ }
+ $value .= ' ';
+
+ if ( ! empty( $args['aftertext'] ) ) {
+ $value .= ' ' . $this->get_description( $args['aftertext'] );
+ }
+
+ if ( $args['wrap'] ) {
+ $value .= $this->get_td_end();
+ $value .= $this->get_tr_end();
+ }
+
+ return $value;
+ }
+
+ /**
+ * Return a text input.
+ *
+ * @since 1.0.0
+ *
+ * @param array $args Arguments to use with the text input.
+ * @return string Complete text ` ` with proper attributes.
+ */
+ public function get_text_input( $args = array() ) {
+ $defaults = $this->get_default_input_parameters(
+ array(
+ 'maxlength' => '',
+ 'onblur' => '',
+ )
+ );
+ $args = wp_parse_args( $args, $defaults );
+
+ $value = '';
+ if ( $args['wrap'] ) {
+ $value .= $this->get_tr_start();
+ $value .= $this->get_th_start();
+ $value .= $this->get_label( $args['name'], $args['labeltext'] );
+ if ( $args['required'] ) { $value .= $this->get_required_span(); }
+ $value .= $this->get_th_end();
+ $value .= $this->get_td_start();
+ }
+
+ $value .= ' get_maxlength( $args['maxlength'] );
+ }
+
+ if ( $args['onblur'] ) {
+ $value .= ' ' . $this->get_onblur( $args['onblur'] );
+ }
+
+ $value .= ' ' . $this->get_aria_required( $args['required'] );
+
+ $value .= ' ' . $this->get_required_attribute( $args['required'] );
+
+ if ( ! empty( $args['aftertext'] ) ) {
+ if ( $args['placeholder'] ) {
+ $value .= ' ' . $this->get_placeholder( $args['aftertext'] );
+ }
+ }
+
+ $value .= ' />';
+
+ if ( ! empty( $args['aftertext'] ) ) {
+ $value .= $this->get_hidden_text( $args['aftertext'] );
+ }
+
+ if ( $args['helptext'] ) {
+ $value .= ' ' . $this->get_description( $args['helptext'] );
+ }
+
+ if ( $args['wrap'] ) {
+ $value .= $this->get_td_end();
+ $value .= $this->get_tr_end();
+ }
+
+ return $value;
+ }
+
+ /**
+ * Return a ` "):a.replace(/\%s(\S*)\s?/,""+d+"$1 ")}function k(a,b,c){var d="",e="";switch(b){case"push":d=wpmdb_strings.push_migration_label_migrating,e=wpmdb_strings.push_migration_label_completed;break;case"pull":d=wpmdb_strings.pull_migration_label_migrating,e=wpmdb_strings.pull_migration_label_completed;break;case"find_replace":d=wpmdb_strings.find_replace_label_migrating,e=wpmdb_strings.find_replace_label_completed;break;case"savefile":d=wpmdb_strings.exporting_please_wait,e=wpmdb_strings.exporting_complete}var f=d;return"completed"===c&&(f=e),"push"!==b&&"pull"!==b||(f=j(f,a,c)),f}function l(a){return a.replace(/^https?:/i,"")}function m(){b(".option-group").each(function(a){b("input",this).attr("disabled","disabled"),b("label",this).css("cursor","default")})}function n(){b(".option-group").each(function(a){b("input",this).removeAttr("disabled"),b("label",this).css("cursor","pointer")})}function o(a,c,d,e){var f=c;void 0!==e&&(f=e),b(".slider",a).slider("value",parseInt(c)),b(".amount",a).html(wpmdb_add_commas(f)+" "+d)}function p(a){!0===U?(U=!1,F=!0,c.current_migration.setState(V,W,"active"),b(".pause-resume").html(wpmdb_strings.pause),c.current_migration.resumeTimer(),c.functions.execute_next_step()):(U=!0,F=!1,Z=wpmdb_strings.migration_paused,V=b(".progress-title").html(),W=b(".progress-text",".progress-wrapper-primary").html(),X=b(".progress-text",".progress-wrapper-secondary ").html(),"find_replace"===x&&(Z=wpmdb_strings.find_replace_paused),c.current_migration.setState(Z,wpmdb_strings.completing_current_request,null),b("body").off("click",".pause-resume"),b("body").off("click",".cancel"))}function q(a,c,d){var e=document.createElement("select");return b(e).attr({multiple:"multiple",name:"select_tables[]",id:"select-tables",class:"multiselect"}),0'+f+" ("+c[f]+")")}}),e}function r(a,b){var d=wpmdb_data.this_temp_prefix;return"pull"===wpmdb_migration_type()&&"undefined"!=typeof c.common.connection_data&&"undefined"!=typeof c.common.connection_data.temp_prefix&&(d=c.common.connection_data.temp_prefix),d===b.substring(0,d.length)||a}function s(a,d){var e="",f=wpmdb_migration_type(),g=b("input[name=table_migrate_option]:checked").val();return"migrate_select"===g?e=b("#select-tables").val():("pull"!==f&&"undefined"!=typeof wpmdb_data.this_prefixed_tables&&(e=wpmdb_data.this_prefixed_tables),"pull"===f&&"undefined"!=typeof c.common.connection_data&&"undefined"!=typeof c.common.connection_data.prefixed_tables&&(e=c.common.connection_data.prefixed_tables)),e}function t(a,c){return b(".table-select-wrap .table-prefix").text()}function u(a){!0===a?(b('.replace-row.pin .replace-right-col input[type="text"]').attr("readonly","readonly"),b(".replace-row.pin .arrow-col").addClass("disabled")):(b('.replace-row.pin .replace-right-col input[type="text"]').removeAttr("readonly"),b(".replace-row.pin .arrow-col").removeClass("disabled"))}function v(a){c.common.previous_connection_data=c.common.connection_data,c.common.connection_data=a,b.wpmdb.do_action("wpmdb_connection_data_updated",a)}function w(a){var b={};return b.unit="MB",b.amount=(a/1024).toFixed(2),b}var x,y,z,A,B,C,D=!1,E="",F=!1,G=!1,H=!1,I=!1,J=!1,K=!1,L=!1,M=!1,N=!1,O=!1,P=!1,Q=!1,R="",S="",T="",U=!1,V="",W="",X="",Y="",Z="",$=!1,_=!1,aa=0,ba=400,ca=!1,da=!1;c.migration_progress_controller=a("MigrationProgress-controller"),c.current_migration=null,c.migration_selection=wpmdb_migration_type();var ea=ajaxurl.replace("/admin-ajax.php",""),fa=ea+"/images/spinner";2 ';window.onbeforeunload=function(a){if(Q)return a=a||window.event,a&&(a.returnValue=wpmdb_strings.sure),wpmdb_strings.sure},b.wpmdb.add_filter("wpmdb_exclude_table",r),b(document).ready(function(){function a(a){var c=!G;L=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_check_licence",licence:a,context:"all",nonce:wpmdb_data.nonces.check_licence},error:function(a,b,c){alert(wpmdb_strings.license_check_problem)},success:function(a){var d,e,f,g=b(".support-content"),h=b(".addons-content"),i=b(".licence-status:not(.notification-message)");if("undefined"!=typeof a.dbrains_api_down)e=a.dbrains_api_down+a.message,f=a.dbrains_api_down;else if("undefined"!=typeof a.errors){if("undefined"!=typeof a.errors.subscription_expired)d=a.errors.subscription_expired.licence,e=a.errors.subscription_expired.support,f=a.errors.subscription_expired.addons;else{var j="";for(var k in a.errors)j+=a.errors[k];e=j,f=j}"undefined"!=typeof a.addon_content&&(f+="\n"+a.addon_content)}else e=a.message,f=a.addon_content;c&&i.stop().fadeOut(ba,function(){"undefined"==typeof d&&(b(this).css({visibility:"hidden",display:"block"}).slideUp(),d=""),b(this).empty().html(d).stop().fadeIn(ba)}),g.stop().fadeOut(ba,function(){b(this).empty().html(e).stop().fadeIn(ba)}),h.stop().fadeOut(ba,function(){b(this).empty().html(f).stop().fadeIn(ba)})}})}function j(){void 0!==wpmdb_data&&void 0!==wpmdb_data.this_tables&&void 0!==wpmdb_data.this_table_sizes_hr&&(Aa=q(wpmdb_data.this_tables,wpmdb_data.this_table_sizes_hr,b(Aa).val())),void 0!==c.common.connection_data&&void 0!==c.common.connection_data.tables&&void 0!==c.common.connection_data.table_sizes_hr&&(Ba=q(c.common.connection_data.tables,c.common.connection_data.table_sizes_hr,b(Ba).val()))}function r(){b("#select-tables").remove(),b(".select-tables-wrap").prepend(Aa),b("#select-tables").change()}function V(){b("#select-tables").remove(),b(".select-tables-wrap").prepend(Ba),b("#select-tables").change()}function W(){b("#migrate-selected").parents(".option-section").children(".header-expand-collapse").children(".expand-collapse-arrow").removeClass("collapsed"),b(".table-select-wrap").show(),b("#migrate-only-with-prefix").prop("checked",!1),b("#migrate-selected").prop("checked",!0),b(".table-migrate-options").hide(),b(".select-tables-wrap").show()}function X(){b(".table-migrate-options").show()}function Z(){b("#select-tables").children("option").prop("selected",!0),b("#select-tables").change()}function ea(a,b){return l(wpmdb_data.this_url)}function ha(){var a=wpmdb_migration_type(),d=b.trim(b(".pull-push-connection-info").val()).split("\n");if("undefined"!=typeof wpmdb_default_profile&&!0!==wpmdb_default_profile&&"savefile"!==a&&"find_replace"!==a&&!F&&wpmdb_data.is_pro){F=!0,m(),b(".connection-status").html(wpmdb_strings.establishing_remote_connection),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ga);var e=wpmdb_migration_type();b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_verify_connection_to_remote_site",url:d[0],key:d[1],intent:e,nonce:wpmdb_data.nonces.verify_connection_to_remote_site,convert_post_type_selection:wpmdb_convert_post_type_selection,profile:wpmdb_data.profile},error:function(a,c,d){b(".connection-status").html(pa(a.responseText,"(#102)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),F=!1,n()},success:function(a){if(b(".ajax-spinner").remove(),F=!1,n(),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),void(a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show());f(d[0],d[1],a.scheme),g(a.prefix),b(".pull-push-connection-info").addClass("temp-disabled"),b(".pull-push-connection-info").attr("readonly","readonly"),b(".connect-button").hide(),b(".connection-status").hide(),b(".step-two").show(),D=!0,v(a),na(),h();var e="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables&&(e=wpmdb_loaded_tables),Ba=q(c.common.connection_data.tables,c.common.connection_data.table_sizes_hr,e);var i="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_post_types&&("undefined"!=typeof a.select_post_types?(b("#exclude-post-types").attr("checked","checked"),b(".post-type-select-wrap").show(),i=a.select_post_types):i=wpmdb_loaded_post_types);var j=document.createElement("select");b(j).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types",class:"multiselect"}),b.each(c.common.connection_data.post_types,function(a,c){var d=b.inArray(c,i);d=-1!==d||!0===wpmdb_convert_exclude_revisions&&"revision"!==c?' selected="selected" ':" ",b(j).append("'+c+" ")}),Da=j;var k="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables_backup&&(k=wpmdb_loaded_tables_backup);var l=document.createElement("select");b(l).attr({multiple:"multiple",name:"select_backup[]",id:"select-backup",class:"multiselect"}),b.each(c.common.connection_data.tables,function(a,d){var e=b.inArray(d,k);e=-1!==e?' selected="selected" ':" ",b(l).append("'+d+" ("+c.common.connection_data.table_sizes_hr[d]+") ")}),Ea=l,"pull"===wpmdb_migration_type()?(b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Da),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Fa),b(".table-prefix").html(a.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Ea)),b.wpmdb.do_action("verify_connection_to_remote_site",c.common.connection_data)}})}}function ia(c,d){b(".licence-input, .register-licence").remove(),b(".licence-not-entered").prepend(c.masked_licence),b(".support-content").empty().html(""+wpmdb_strings.fetching_license+'
'),a(d),b(".migrate-selection label").removeClass("disabled"),b(".migrate-selection input").removeAttr("disabled")}function ja(){b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_get_log",nonce:wpmdb_data.nonces.get_log},error:function(a,b,c){alert(wpmdb_strings.update_log_problem)},success:function(a){b(".debug-log-textarea").val(a)}})}function ka(){var a=b("#select-post-types").val(),c="",d=b(".exclude-post-types-warning"),e=d.find(".migrate-msg"),f=d.find(".find-replace-msg");"find_replace"===wpmdb_migration_type()?(e.hide(),f.show()):(f.hide(),e.show()),a?(c=""+a.join(", ")+"",b(".excluded-post-types").html(c),"0"===d.css("opacity")&&d.css({opacity:0}).slideDown(200).animate({opacity:1})):d.css({opacity:0}).slideUp(200).animate({opacity:0})}function la(){b("#overlay").removeClass("show").addClass("hide"),b("#overlay > div").removeClass("show").addClass("hide"),c.current_migration.$proVersion.find("iframe").remove(),setTimeout(function(){b("#overlay").remove()},500),P=!1}function ma(){var a;if(b(".save-settings-button").blur(),!I){if(b("#migrate-selected").is(":checked")&&null===b("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if("savefile"!==wpmdb_migration_type()&&b("#backup-manual-select").is(":checked")&&null===b("#select-backup").val())return void alert(wpmdb_strings.please_select_one_table_backup);
+var c=!1;b("#create_new").is(":checked")&&(c=!0);var d=b(".create-new-profile").val();I=!0,a=b(b("#migrate-form")[0].elements).not(".auth-credentials").serialize(),b(".save-settings-button").attr("disabled","disabled").after(' '),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_profile",profile:a,nonce:wpmdb_data.nonces.save_profile},error:function(a,c,d){F=!1,alert(wpmdb_strings.save_profile_problem),b(".save-settings-button").removeAttr("disabled"),b(".save-profile-ajax-spinner").remove(),b(".save-settings-button").after(''+wpmdb_strings.saved+" "),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()}),I=!1},success:function(a){var e=parseInt(b("#migrate-form input[name=save_migration_profile_option]:checked").val(),10)+1;if(F=!1,b(".save-settings-button").removeAttr("disabled"),b(".save-profile-ajax-spinner").remove(),b(".save-settings-button").after(''+wpmdb_strings.saved+" "),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()}),I=!1,b(".create-new-profile").val(""),c){var f=parseInt(a,10),g=f+1,h=b(' ');h.find("label").append(document.createTextNode(" "+d)),e=g,b("#create_new").parents("li").before(h),b("#profile-"+g).attr("checked","checked")}var i=window.location.href.replace("#migrate","").replace(/&wpmdb-profile=-?\d+/,"")+"&wpmdb-profile="+e,j=b("#migrate-form input[name=save_migration_profile_option]:checked").parent().text().trim();if("function"==typeof window.history.pushState){if(b("#migrate-form .crumbs").length)b("#migrate-form .crumbs .crumb:last").text(j);else{var k=b('
').append(' Saved Profiles ').append(''+j+" ");b("#migrate-form").prepend(k)}window.history.pushState({updated_profile_id:e},null,i)}}})}}function na(){b(".connection-status").hide(),b(".prefix-notice").hide(),b(".ssl-notice").hide(),b(".different-plugin-version-notice").hide(),b(".step-two").show(),b(".backup-options").show(),b(".keep-active-plugins").show(),b(".directory-permission-notice").hide(),b("#create-backup").removeAttr("disabled"),b("#create-backup-label").removeClass("disabled"),b(".backup-option-disabled").hide(),b(".compatibility-older-mysql").hide();var a,d=b.trim(b(".pull-push-connection-info").val()).split("\n");if(wpmdb_toggle_migration_action_text(),b.wpmdb.do_action("move_connection_info_box",{migration_type:wpmdb_migration_type(),last_migration_type:E}),"pull"===wpmdb_migration_type()){if(b(".pull-list li").append(Ga),Ga.show(function(){var a=b(this).find(".pull-push-connection-info");a.val()||a.focus()}),("push"===c.migration_selection||"savefile"===c.migration_selection)&&2===d.length)return c.force_reconnect=!0,b(".pull-list li").append(Ga),b(".pull-push-connection-info").removeClass("temp-disabled").attr("readonly","readonly"),b(".connect-button").hide(),void ta();D?(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(c.common.connection_data.prefix),b(".backup-table-prefix").html(wpmdb_data.site_details.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir),!1===K&&(a=i(c.common.connection_data.url),b(".create-new-profile").val(a)),!0===M&&b(".prefix-notice.pull").show(),!0===N&&b(".ssl-notice").show(),!0===O&&(b(".different-plugin-version-notice").show(),b(".step-two").hide()),wpmdb_toggle_migration_action_text(),!1===wpmdb_data.write_permission&&(b("#create-backup").prop("checked",!1),b("#create-backup").attr("disabled","disabled"),b("#create-backup-label").addClass("disabled"),b(".backup-option-disabled").show(),b(".upload-directory-location").html(wpmdb_data.this_upload_dir_long))):(b(".connection-status").show(),b(".step-two").hide())}else if("push"===wpmdb_migration_type()){if(b(".push-list li").append(Ga),Ga.show(function(){var a=b(this).find(".pull-push-connection-info");a.val()||a.focus()}),("pull"===c.migration_selection||"savefile"===c.migration_selection)&&2===d.length)return c.force_reconnect=!0,b(".push-list li").append(Ga),b(".pull-push-connection-info").removeClass("temp-disabled").attr("readonly","readonly"),b(".connect-button").hide(),void ta();D?(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(wpmdb_data.this_prefix),b(".backup-table-prefix").html(c.common.connection_data.prefix),b(".uploads-dir").html(c.common.connection_data.uploads_dir),!1===K&&(a=i(c.common.connection_data.url),b(".create-new-profile").val(a)),!0===M&&b(".prefix-notice.push").show(),!0===N&&b(".ssl-notice").show(),!0===O&&(b(".different-plugin-version-notice").show(),b(".step-two").hide()),wpmdb_toggle_migration_action_text(),"0"===c.common.connection_data.write_permissions&&(b("#create-backup").prop("checked",!1),b("#create-backup").attr("disabled","disabled"),b("#create-backup-label").addClass("disabled"),b(".backup-option-disabled").show(),b(".upload-directory-location").html(c.common.connection_data.upload_dir_long))):(b(".connection-status").show(),b(".step-two").hide())}else if(("savefile"===wpmdb_migration_type()||"find_replace"===wpmdb_migration_type())&&(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(wpmdb_data.this_prefix),!1===K&&b(".create-new-profile").val(""),"savefile"===wpmdb_migration_type()&&(b(".backup-options").hide(),b(".compatibility-older-mysql").show()),b(".keep-active-plugins").hide(),!1===wpmdb_data.write_permission&&(b(".directory-permission-notice").show(),b(".step-two").hide()),"find_replace"===wpmdb_migration_type()&&"true"===wpmdb_data.is_multisite)){var e=b(".old-replace-col").eq(1);e.parent().removeClass("pin").find(".replace-remove-row").show(),e.find("input").removeAttr("readonly")}h()}function oa(){var a=null,d=null;null!==c.common.previous_connection_data&&"object"==typeof c.common.previous_connection_data&&c.common.previous_connection_data.url!==c.common.connection_data.url&&(a=l(c.common.previous_connection_data.url),d=c.common.previous_connection_data.path),"push"===wpmdb_migration_type()||"savefile"===wpmdb_migration_type()?("pull"===E?b(".replace-row").each(function(){var a=b(".old-replace-col input",this).val();b(".old-replace-col input",this).val(b(".replace-right-col input",this).val()),b(".replace-right-col input",this).val(a)}):"push"===E&&"push"===wpmdb_migration_type()&&null!==a&&null!==d&&b(".replace-row").each(function(){var e=b(".replace-right-col input",this).val();e===d&&b(".replace-right-col input",this).val(c.common.connection_data.path),e===a&&b(".replace-right-col input",this).val(l(c.common.connection_data.url))}),b.wpmdb.do_action("wpmdb_update_push_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Ca),ka(),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Ea)):"pull"===wpmdb_migration_type()&&(""===E||"push"===E||"savefile"===E?b(".replace-row").each(function(){var a=b(".old-replace-col input",this).val();b(".old-replace-col input",this).val(b(".replace-right-col input",this).val()),b(".replace-right-col input",this).val(a)}):"pull"===E&&"pull"===wpmdb_migration_type()&&null!==a&&null!==d&&b(".replace-row").each(function(){var e=b(".old-replace-col input",this).val();e===d&&b(".old-replace-col input",this).val(c.common.connection_data.path),e===a&&b(".old-replace-col input",this).val(l(c.common.connection_data.url))}),b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Da),ka(),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Fa)),E=wpmdb_migration_type()}function pa(a,b,c){return wpmdbGetAjaxErrors(wpmdb_strings.connection_local_server_problem,b,a,c)}function qa(a){return/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,}\.(([a-z]|\d|-|\.|_|~)|[!\$&'\(\)\*\+,;=]|:)+))\])|((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=])*)(:\d*)?)(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*|(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)){0})(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)}function ra(c,d){b(".nav-tab").removeClass("nav-tab-active"),b(".nav-tab."+c).addClass("nav-tab-active"),b(".content-tab").hide(),b("."+c+"-tab").show(),"settings"===c&&!0===sa()&&(b("p.licence-status").append("Checking License... ").append(ga),a()),"help"===c&&(ja(),!0===sa()&&(b(".support-content p").append(ga),a())),"addons"===c&&!0!==d&&!0===sa()&&(b(".addons-content p").append(ga),a())}function sa(){return!1===L&&"1"===wpmdb_data.has_licence&&"true"===wpmdb_data.is_pro}function ta(){var a=b(".pull-push-connection-info");if(!F&&!b(a).hasClass("temp-disabled")||!1!==c.force_reconnect){c.force_reconnect=!1;var d=b(".pull-push-connection-info").val(),e=b.trim(d).split("\n"),k=!1,o="";if(""===e&&(k=!0,o=wpmdb_strings.connection_info_missing),1===e.length&&!k){var p=b.trim(d).split(" ");2===p.length&&(e=p)}2===e.length||k||(k=!0,o=wpmdb_strings.connection_info_incorrect),k||qa(e[0])||(k=!0,o=wpmdb_strings.connection_info_url_invalid);var q=0;if("undefined"!=typeof e[1]&&(q=e[1].length),k||32===q||40===q||(k=!0,o=wpmdb_strings.connection_info_key_invalid),k||e[0]!==wpmdb_data.connection_info[0]||(k=!0,o=wpmdb_strings.connection_info_local_url),k||e[1]!==wpmdb_data.connection_info[1]||(k=!0,o=wpmdb_strings.connection_info_local_key),k)return b(".connection-status").html(o),void b(".connection-status").addClass("notification-message error-notice migration-error");var r=e[0]+"\n"+e[1];1===b.trim(d).split("\n").length&&b(".pull-push-connection-info").val(r),!1===wpmdb_data.openssl_available&&(e[0]=e[0].replace("https://","http://"),r=e[0]+"\n"+e[1],b(".pull-push-connection-info").val(r)),M=!1,F=!0,m(),b(".basic-access-auth-wrapper").is(":visible")&&(e[0]=e[0].replace(/\/\/(.*)@/,"//"),e[0]=e[0].replace("//","//"+encodeURIComponent(b.trim(b(".auth-username").val()))+":"+encodeURIComponent(b.trim(b(".auth-password").val()))+"@"),r=e[0]+"\n"+e[1],b(".pull-push-connection-info").val(r),b(".basic-access-auth-wrapper").hide()),b(".step-two").hide(),b(".ssl-notice").hide(),b(".prefix-notice").hide(),b(".connection-status").show(),b(".connection-status").html(wpmdb_strings.establishing_remote_connection),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ga);var s=wpmdb_migration_type();K=!1,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_verify_connection_to_remote_site",url:e[0],key:e[1],intent:s,nonce:wpmdb_data.nonces.verify_connection_to_remote_site},error:function(a,c,d){b(".connection-status").html(pa(a.responseText,"(#100)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),F=!1,n()},success:function(a){if(b(".ajax-spinner").remove(),F=!1,n(),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show(),void(b(".pull-push-connection-info").hasClass("temp-disabled")||b(".connect-button").is(":visible")||(b(".pull-push-connection-info").removeAttr("readonly"),b(".connect-button").show()));f(e[0],e[1],a.scheme);var d=i(a.url);b(".create-new-profile").val(d),b(".pull-push-connection-info").addClass("temp-disabled"),b(".pull-push-connection-info").attr("readonly","readonly"),b(".connect-button").hide(),b(".connection-status").hide(),b(".step-two").show(),g(a.prefix),D=!0,v(a),na(),oa(),h(),j(),Ea=b(Ba).clone(),b(Ea).attr({name:"select_backup[]",id:"select-backup"});var k=document.createElement("select");b(k).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types",class:"multiselect"}),b.each(c.common.connection_data.post_types,function(a,c){b(k).append(''+c+" ")}),Da=k,b("#new-path-missing-warning, #new-url-missing-warning").hide(),"pull"===wpmdb_migration_type()?(b("#new-url").val(l(wpmdb_data.this_url)),b("#new-path").val(wpmdb_data.this_path),"true"===wpmdb_data.is_multisite&&(b("#new-domain").val(wpmdb_data.this_domain),b('.replace-row.pin .old-replace-col input[type="text"]').val(l(a.url))),b("#old-url").val(l(a.url)),b("#old-path").val(a.path),b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Da),ka(),b(".table-prefix").html(a.prefix),b(".backup-table-prefix").html(wpmdb_data.site_details.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(b("#new-url").val(l(a.url)),b("#new-path").val(a.path),"true"===wpmdb_data.is_multisite&&b('.replace-row.pin .old-replace-col input[type="text"]').val(l(wpmdb_data.this_url)),b.wpmdb.do_action("wpmdb_update_push_table_select"),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Ea)),c.common.next_step_in_migration={fn:b.wpmdb.do_action,args:["verify_connection_to_remote_site",c.common.connection_data]},c.functions.execute_next_step()}})}}function ua(a){$=!0,Y=wpmdb_strings.cancelling_migration,b(".migration-controls").css({visibility:"hidden"}),"find_replace"===x&&(Y=wpmdb_strings.cancelling_find_replace),c.current_migration.setState(Y,wpmdb_strings.completing_current_request,"cancelling"),!0===U&&(U=!1,c.functions.execute_next_step())}function va(a){var c=b("#"+a),d=c.find("input[type=checkbox]");c.toggleClass("on").find("span").toggleClass("checked");var e=c.find("span.on").hasClass("checked");d.attr("checked",e).trigger("change")}c.migration_state_id="",b("#plugin-compatibility").change(function(a){var c="1",d=b(this).closest("td").next("td").find(".setting-status");if(b(this).is(":checked")){var e=confirm(wpmdb_strings.mu_plugin_confirmation);if(!e)return void b(this).prop("checked",!1)}else c="0";b(".plugin-compatibility-wrap").toggle(),d.find(".ajax-success-msg").remove(),d.append(ga),b("#plugin-compatibility").attr("disabled","disabled"),b(".plugin-compatibility").addClass("disabled"),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_plugin_compatibility",install:c,nonce:wpmdb_data.nonces.plugin_compatibility},error:function(a,c,d){alert(wpmdb_strings.plugin_compatibility_settings_problem+"\r\n\r\n"+wpmdb_strings.status+" "+a.status+" "+a.statusText+"\r\n\r\n"+wpmdb_strings.response+"\r\n"+a.responseText),b(".ajax-spinner").remove(),b("#plugin-compatibility").removeAttr("disabled"),b(".plugin-compatibility").removeClass("disabled")},success:function(a){""!==b.trim(a)?alert(a):(d.append(''+wpmdb_strings.saved+" "),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()})),b(".ajax-spinner").remove(),b("#plugin-compatibility").removeAttr("disabled"),b(".plugin-compatibility").removeClass("disabled")}})}),b("#plugin-compatibility").is(":checked")&&b(".plugin-compatibility-wrap").show(),(0<=navigator.userAgent.indexOf("MSIE")||0<=navigator.userAgent.indexOf("Trident"))&&b(".ie-warning").show(),0===wpmdb_data.valid_licence&&b("#savefile").prop("checked",!0);var wa=b(".max-request-size"),xa=b(".slider",wa);xa.slider({range:"min",value:parseInt(wpmdb_data.max_request/1024),min:512,max:parseInt(wpmdb_data.bottleneck/1024),step:256,create:function(a,b){var c=w(wpmdb_data.max_request/1024);o(wa,wpmdb_data.max_request/1024,c.unit,c.amount)},slide:function(a,b){var c=w(b.value);o(wa,b.value,c.unit,c.amount)},stop:function(a,c){b(".slider-success-msg").remove(),b(".amount",wa).after(' '),xa.slider("disable"),b.ajax({url:ajaxurl,type:"POST",cache:!1,data:{action:"wpmdb_update_max_request_size",max_request_size:parseInt(c.value),nonce:wpmdb_data.nonces.update_max_request_size},error:function(a,c,d){xa.slider("enable"),b(".slider-spinner",wa).remove(),alert(wpmdb_strings.max_request_size_problem);var e=w(wpmdb_data.max_request/1024);o(wa,wpmdb_data.max_request/1024,e.unit,e.amount),xa.slider("enable")},success:function(){xa.slider("enable"),b(".slider-label-wrapper",wa).append(''+wpmdb_strings.saved+" "),b(".slider-success-msg",wa).fadeOut(2e3,function(){b(this).remove()}),b(".slider-spinner",wa).remove()}})}});var ya=b(".delay-between-requests"),za=b(".slider",ya);za.slider({range:"min",value:parseInt(wpmdb_data.delay_between_requests/1e3),min:0,max:10,step:1,create:function(a,b){o(ya,wpmdb_data.delay_between_requests/1e3,"s")},slide:function(a,b){o(ya,b.value,"s")},stop:function(a,c){b(".slider-success-msg").remove(),b(".amount",ya).after(' '),za.slider("disable"),b.ajax({url:ajaxurl,type:"POST",cache:!1,data:{action:"wpmdb_update_delay_between_requests",delay_between_requests:parseInt(1e3*c.value),nonce:wpmdb_data.nonces.update_delay_between_requests},error:function(a,c,d){za.slider("enable"),b(".slider-spinner",ya).remove(),alert(wpmdb_strings.delay_between_requests_problem),o(ya,wpmdb_data.delay_between_requests/1e3,"s"),za.slider("enable")},success:function(){wpmdb_data.delay_between_requests=parseInt(1e3*c.value),za.slider("enable"),b(".slider-label-wrapper",ya).append(''+wpmdb_strings.saved+" "),b(".slider-success-msg",ya).fadeOut(2e3,function(){b(this).remove()}),b(".slider-spinner",ya).remove()}})}});var Aa=b("#select-tables").clone(),Ba=b("#select-tables").clone(),Ca=b("#select-post-types").clone(),Da=b("#select-post-types").clone(),Ea=b("#select-backup").clone(),Fa=b("#select-backup").clone();b(".help-tab .video").each(function(){var a=b(this),c=b(".video-viewer");b("a",this).click(function(d){d.preventDefault(),c.attr("src","//www.youtube.com/embed/"+a.data("video-id")+"?autoplay=1"),c.show();var e=c.offset();b(window).scrollTop(e.top-50)})}),b(".backup-options").show(),b(".keep-active-plugins").show(),"savefile"===wpmdb_migration_type()&&(b(".backup-options").hide(),b(".keep-active-plugins").hide()),E=wpmdb_migration_type(),b(".content-tab").on("click",".check-my-licence-again",function(c){c.preventDefault(),L=!1,b(c.target).replaceWith("Checking... "+ga),a(null,"all")}),b.wpmdb.add_action("wpmdb_refresh_table_selects",j),b.wpmdb.add_action("wpmdb_update_push_table_select",r),b.wpmdb.add_action("wpmdb_update_pull_table_select",V),b.wpmdb.add_action("wpmdb_disable_table_migration_options",W),b.wpmdb.add_action("wpmdb_enable_table_migration_options",X),b.wpmdb.add_action("wpmdb_select_all_tables",Z),b.wpmdb.add_filter("wpmdb_base_old_url",ea),ha(),b("body").on("click",".js-action-link",function(a){a.preventDefault(),b(this).blur()}),b(".licence-input").keypress(function(a){13===a.which&&(a.preventDefault(),b(".register-licence").click())}),b("body").on("click",".register-licence",function(a){if(a.preventDefault(),!G){var c=b.trim(b(".licence-input").val()),d=b(".licence-status");if(d.removeClass("notification-message error-notice success-notice"),""===c)return void d.html(''+wpmdb_strings.enter_license_key+"
");d.empty().removeClass("success"),G=!0,b(".button.register-licence").after(' '),b.ajax({url:ajaxurl,type:"POST",dataType:"JSON",cache:!1,data:{action:"wpmdb_activate_licence",licence_key:c,nonce:wpmdb_data.nonces.activate_licence,context:"licence"},error:function(a,c,e){G=!1,b(".register-licence-ajax-spinner").remove(),d.html(wpmdb_strings.register_license_problem)},success:function(a){if(b(".register-licence-ajax-spinner").remove(),"undefined"!=typeof a.errors){var e="";for(var f in a.errors)e+=a.errors[f];d.html(e),"undefined"!=typeof a.masked_licence&&(ia(a,c),b(".migrate-tab .invalid-licence").hide())}else"undefined"!=typeof a.wpmdb_error&&"undefined"!=typeof a.body?d.html(a.body):(1===Number(a.is_first_activation)&&(wpmdb_strings.welcome_text=wpmdb_strings.welcome_text.replace("%1$s","https://deliciousbrains.com/wp-migrate-db-pro/doc/quick-start-guide/"),wpmdb_strings.welcome_text=wpmdb_strings.welcome_text.replace("%2$s","https://deliciousbrains.com/wp-migrate-db-pro/videos/"),d.after(''+wpmdb_strings.welcome_title+" "+wpmdb_strings.welcome_text+"
")),d.html(wpmdb_strings.license_registered).delay(5e3).fadeOut(1e3,function(){b(this).css({visibility:"hidden",display:"block"}).slideUp()}),d.addClass("success notification-message success-notice"),ia(a,c),b(".invalid-licence").hide());G=!1}})}}),b(".clear-log").click(function(){b(".ajax-spinner, .ajax-success-msg").remove(),b(this).after(ga),b(".debug-log-textarea").val(""),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_clear_log",nonce:wpmdb_data.nonces.clear_log},error:function(a,c,d){b(".ajax-spinner").remove(),alert(wpmdb_strings.clear_log_problem)},success:function(a){b(".ajax-spinner, .ajax-success-msg").remove(),ja(),b(".clear-log").after(''+wpmdb_strings.clear_error_log+" "),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()})}})}),b(".multiselect-select-all").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).prop("selected",1),b(a).focus().trigger("change")}),b(".multiselect-deselect-all").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).removeAttr("selected"),b(a).focus().trigger("change")}),b(".multiselect-invert-selection").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).each(function(){b(this).attr("selected",!b(this).attr("selected"))}),b(a).focus().trigger("change")}),b(".option-group input[type=radio]").change(function(){var a=b(this).closest(".option-group");b("ul",a).hide();var c=b(this).closest("li");b("ul",c).show()}),b(".option-group").each(function(){b(".option-group input[type=radio]").each(function(){if(b(this).is(":checked")){var a=b(this).closest("li");b("ul",a).show()}})}),b(".header-expand-collapse").click(function(){b(".expand-collapse-arrow",this).hasClass("collapsed")?(b(".expand-collapse-arrow",this).removeClass("collapsed"),b(this).next().show()):(b(".expand-collapse-arrow",this).addClass("collapsed"),b(this).next().hide())}),b(".checkbox-label input[type=checkbox]").change(function(){b(this).is(":checked")?b(this).parent().next().show():b(this).parent().next().hide()}),b(".select-post-types-wrap").on("change","#select-post-types",function(){ka()}),b("#exclude-post-types").is(":checked")&&b("#select-post-types").val()&&b(".exclude-post-types-warning").css({display:"block",opacity:1}),b("#save-migration-profile").change(function(){c.functions.update_migrate_button_text(),b(this).is(":checked")?b(".save-settings-button").show():b(".save-settings-button").hide()}),b("#save-migration-profile").is(":checked")&&b(".save-settings-button").show(),b(".create-new-profile").focus(function(){b("#create_new").prop("checked",!0)}),b(".checkbox-label input[type=checkbox]").each(function(){b(this).is(":checked")&&b(this).parent().next().show()}),b(".migrate-db-button").click(function(a){if(b(this).blur(),a.preventDefault(),c.migration_state_id="",!1!==b.wpmdb.apply_filters("wpmdb_migration_profile_ready",!0)){if(b("#migrate-selected").is(":checked")&&null===b("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if("savefile"!==wpmdb_migration_type()&&b("#backup-manual-select").is(":checked")&&null===b("#select-backup").val())return void alert(wpmdb_strings.please_select_one_table_backup);var e=!1,f=!1;if(b("#new-url").length&&!b("#new-url").val()&&(b("#new-url-missing-warning").show(),b("#new-url").focus(),b("html,body").scrollTop(0),e=!0),b("#new-path").length&&!b("#new-path").val()&&(b("#new-path-missing-warning").show(),!1===e&&(b("#new-path").focus(),b("html,body").scrollTop(0)),f=!0),!0!==e&&!0!==f){b("#save-migration-profile").is(":checked")&&ma(),A=b(b("#migrate-form")[0].elements).not(".auth-credentials").serialize(),x=wpmdb_migration_type(),B="backup","savefile"===x&&(B="migrate"),!1===b("#create-backup").is(":checked")&&(B="migrate"),c.current_migration=c.migration_progress_controller.newMigration({localTableSizes:wpmdb_data.this_table_sizes,localTableRows:wpmdb_data.this_table_rows,remoteTableSizes:"undefined"!=typeof c.common.connection_data?c.common.connection_data.table_sizes:null,remoteTableRows:"undefined"!=typeof c.common.connection_data?c.common.connection_data.table_rows:null,migrationIntent:wpmdb_migration_type()});var g=b("input[name=backup_option]:checked").val(),h=b("input[name=table_migrate_option]:checked").val(),i="",j="";"backup"===B&&("migrate_only_with_prefix"===h&&"backup_selected"===g&&(g="backup_only_with_prefix"),"push"===x?(j="remote","backup_only_with_prefix"===g?T=c.common.connection_data.prefixed_tables:"backup_selected"===g?(i=b("#select-tables").val(),i=b.wpmdb.apply_filters("wpmdb_backup_selected_tables",i),T=d(i,c.common.connection_data.tables)):"backup_manual_select"===g&&(T=b("#select-backup").val())):(j="local","backup_only_with_prefix"===g?T=wpmdb_data.this_prefixed_tables:"backup_selected"===g?(i=b("#select-tables").val(),i=b.wpmdb.apply_filters("wpmdb_backup_selected_tables",i),T=d(i,wpmdb_data.this_tables)):"backup_manual_select"===g&&(T=b("#select-backup").val())),c.current_migration.model.addStage("backup",T,j,{strings:{migrated:wpmdb_strings.backed_up}})),j=-1!==b.inArray(x,["push","savefile","find_replace"])?"local":"remote","find_replace"===x?("backup"!==B&&(B="find_replace"),c.current_migration.model.addStage("find_replace",s(null,null),j,{strings:{migrated:wpmdb_strings.searched,stage_title:wpmdb_strings.migrate_button_find_replace}})):c.current_migration.model.addStage("migrate",s(null,null),j),b.wpmdb.do_action("wpmdb_add_migration_stages",{data_type:j,tables_to_migrate:s(null,null)});var l=(b("input[name=table_migrate_option]:checked").val(),b.trim(b(".pull-push-connection-info").val()).split("\n"));y=l[0],z=l[1];var m=k(y,x,"migrating");C=k(y,x,"completed"),T="find_replace"===B?c.current_migration.model.getStageItems("find_replace","name"):"backup"===B?c.current_migration.model.getStageItems("backup","name"):c.current_migration.model.getStageItems("migrate","name"),c.current_migration.model.setActiveStage(B),c.current_migration.setTitle(m),c.current_migration.startTimer(),Q=!0,c.current_migration.setStatus("active");var n={action:"wpmdb_initiate_migration",intent:x,url:y,key:z,form_data:A,stage:B,nonce:wpmdb_data.nonces.initiate_migration};n.site_details={local:wpmdb_data.site_details},-1===b.inArray(x,["savefile","find_replace"])&&(n.temp_prefix=c.common.connection_data.temp_prefix,n.site_details.remote=c.common.connection_data.site_details),n.site_details=JSON.stringify(n.site_details),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:n,error:function(a,b,d){c.current_migration.setState(wpmdb_strings.migration_failed,pa(a.responseText,"(#112)",a),"error"),console.log(a),console.log(b),console.log(d),F=!1,c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){if(F=!1,"undefined"!=typeof a&&"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return c.common.migration_error=!0,c.functions.migration_complete_events(),void c.current_migration.setState(wpmdb_strings.migration_failed,a.body,"error");c.migration_state_id=a.migration_state_id;var d=0;aa=0,"savefile"!==x&&"undefined"!=typeof c.common.connection_data&&"undefined"!=typeof c.common.connection_data.delay_between_requests&&(aa=Math.max(parseInt(wpmdb_data.delay_between_requests),parseInt(c.common.connection_data.delay_between_requests))),c.functions.migrate_table_recursive=function(a,e){if(d>=T.length){if("backup"!==B)return b(".progress-label").removeClass("label-visible"),c.common.hooks=b.wpmdb.apply_filters("wpmdb_before_migration_complete_hooks",c.common.hooks),c.common.hooks.push(c.functions.migration_complete),c.common.hooks.push(c.functions.wpmdb_flush),c.common.hooks=b.wpmdb.apply_filters("wpmdb_after_migration_complete_hooks",c.common.hooks),c.common.hooks.push(c.functions.migration_complete_events),c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step();B="migrate","find_replace"===x&&(B="find_replace"),c.current_migration.model.setActiveStage(B),d=0,T=s(null,null)}var f=0;d===T.length-1&&(f=1);var g=0;"savefile"!==x&&"find_replace"!==x&&1===parseInt(c.common.connection_data.gzip)&&(g=1);var h={action:"wpmdb_migrate_table",migration_state_id:c.migration_state_id,table:T[d],stage:B,current_row:a,last_table:f,primary_keys:e,gzip:g,nonce:wpmdb_data.nonces.migrate_table};"savefile"!==x&&"find_replace"!==x&&(h.bottleneck=c.common.connection_data.bottleneck,h.prefix=c.common.connection_data.prefix),c.common.connection_data&&c.common.connection_data.path_current_site&&c.common.connection_data.domain&&(h.path_current_site=c.common.connection_data.path_current_site,h.domain_current_site=c.common.connection_data.domain),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,timeout:0,data:h,error:function(a,b,e){var f=wpmdb_strings.table_process_problem+" "+T[d]+" "+wpmdb_strings.status+": "+a.status+" "+a.statusText+" "+wpmdb_strings.response+": "+a.responseText;c.current_migration.setState(wpmdb_strings.migration_failed,f,"error"),F=!1,console.log(a),console.log(b),console.log(e),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){F=!1,a=b.trim(a);var e=wpmdb_parse_json(a),g="";return!1===e||null===e?(g=""===a||null===a?wpmdb_strings.table_process_problem_empty_response+" "+T[d]:pa(a,null,null),c.current_migration.setState(wpmdb_strings.migration_failed,g,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):"undefined"!=typeof e.wpmdb_error&&1===e.wpmdb_error?(c.current_migration.setState(wpmdb_strings.migration_failed,e.body,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.current_migration.setText(),c.current_migration.model.getStageModel(B).setItemRowsTransferred(T[d],e.current_row),1===f&&"savefile"===x&&("undefined"!=typeof e.dump_filename&&(R=e.dump_filename),"undefined"!=typeof e.dump_path&&(S=e.dump_path)),-1===parseInt(e.current_row)&&(d++,e.current_row="",e.primary_keys=""),c.common.next_step_in_migration={fn:c.functions.migrate_table_recursive,args:[e.current_row,e.primary_keys]},void c.functions.execute_next_step())}})},c.common.next_step_in_migration={fn:c.functions.migrate_table_recursive,args:["-1",""]},c.functions.execute_next_step()}})}}}),c.functions.migration_complete_events=function(){
+if(!1===c.common.migration_error)if(""===c.common.non_fatal_errors)if("savefile"!==x&&!0===b("#save_computer").is(":checked")&&c.current_migration.setText(),C+='
',!0===$){var a=wpmdb_strings.migration_cancelled_success;"find_replace"===x&&(a=wpmdb_strings.find_replace_cancelled_success),c.current_migration.setState(C,a,"cancelled")}else c.current_migration.setState(C,"","complete");else c.current_migration.setState(wpmdb_strings.completed_with_some_errors,c.common.non_fatal_errors,"error");b(".migration-controls").addClass("hidden"),c.common.hooks=[],c.common.call_stack=[],c.common.migration_error=!1,Q=!1,P=!0,U=!1,$=!1,F=!1,c.common.non_fatal_errors="",b(".progress-label").remove(),b(".migration-progress-ajax-spinner").remove(),b(".close-progress-content").show(),b("#overlay").css("cursor","pointer"),c.current_migration.model.setMigrationComplete()},c.functions.migration_complete=function(){if(b(".migration-controls").addClass("hidden"),"savefile"===x){Q=!1;var a=wpmdb_strings.migration_complete;if(b("#save_computer").is(":checked")){var d=wpmdb_data.this_download_url+encodeURIComponent(R);b("#gzip_file").is(":checked")&&(d+="&gzip=1"),window.location=d}else a=wpmdb_strings.completed_dump_located_at+" "+S;!1===c.common.migration_error&&(c.functions.migration_complete_events(),c.current_migration.setState(C,a,"complete"))}else{c.current_migration.setState(null,wpmdb_strings.finalizing_migration,"finalizing");var e={action:"wpmdb_finalize_migration",migration_state_id:c.migration_state_id,tables:T.join(","),nonce:wpmdb_data.nonces.finalize_migration};"find_replace"!==x&&(e.prefix=c.common.connection_data.prefix),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:e,error:function(a,b,d){F=!1,c.current_migration.setState(wpmdb_strings.migration_failed,wpmdb_strings.finalize_tables_problem,"error"),alert(a+" : "+b+" : "+d),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return F=!1,"1"!==b.trim(a)?(c.current_migration.setState(wpmdb_strings.migration_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step())}})}},c.functions.wpmdb_flush=function(){"savefile"!==x&&(c.current_migration.setText(wpmdb_strings.flushing),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_flush",migration_state_id:c.migration_state_id,nonce:wpmdb_data.nonces.flush},error:function(a,b,d){F=!1,c.current_migration.setState(wpmdb_strings.migration_failed,wpmdb_strings.flush_problem,"error"),alert(a+" : "+b+" : "+d),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return F=!1,"1"!==b.trim(a)?(c.current_migration.setState(wpmdb_strings.migration_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step())}}))},c.functions.update_migrate_button_text=function(){var a=wpmdb_migration_type(),c=b("#save-migration-profile").is(":checked")?"_save":"",d="migrate_button_"+("savefile"===a?"export":a)+c;b(".migrate-db .button-primary").val(wpmdb_strings[d])},c.functions.update_migrate_button_text(),b("body").on("click",".close-progress-content-button",function(a){la(),c.current_migration.restoreTitleElem()}),b("body").on("click","#overlay",function(a){!0===P&&a.target===this&&(la(),c.current_migration.restoreTitleElem())}),b(".save-settings-button").click(function(a){return a.preventDefault(),""===b.trim(b(".create-new-profile").val())&&b("#create_new").is(":checked")?(alert(wpmdb_strings.enter_name_for_profile),void b(".create-new-profile").focus()):void ma()});var Ga=b(".connection-info-wrapper");na(),b(".migrate-selection.option-group input[type=radio]").change(function(){na(),c.migration_selection=wpmdb_migration_type(),D&&oa(),c.functions.update_migrate_button_text()}),"pull"!==wpmdb_migration_type()&&"push"!==wpmdb_migration_type()||D||(b(".step-two").hide(),b(".connection-status").show()),b(".general-helper").click(function(a){a.preventDefault();var c=b(this),d=b(this).next();b(".helper-message").not(d).hide();var e=c.position();if(d.hasClass("bottom")){var f=1;b(this).is(":first-child")&&(f=3),d.css({left:e.left-d.width()/2-f+"px",top:e.top+c.height()+9+"px"})}else d.css({left:e.left+c.width()+9+"px",top:e.top+c.height()/2-18+"px"});d.toggle(),a.stopPropagation()}),b("body").click(function(){b(".helper-message").hide()}),b(".helper-message").click(function(a){a.stopPropagation()}),b("body").on("click",".show-errors-toggle",function(a){a.preventDefault(),b(this).next(".migration-php-errors").toggle()}),b(".nav-tab").click(function(){var a=b(this).attr("data-div-name");a=a.replace("-tab",""),window.location.hash=a,ra(a,!1)}),b("body").on("click",'a[href^="#"]',function(a){var c=b(a.target).attr("href"),d=c.substr(1);if(d){var e=b("."+d);1===e.length&&(e.trigger("click"),a.preventDefault())}}),b("body").on("click",".add-row",function(){var a=b(this).parents("tr");a.before(b(".original-repeatable-field").clone().removeClass("original-repeatable-field")),a.prev().find(".old-replace-col input").focus()}),b("body").on("click",".replace-remove-row",function(){b(this).parents("tr").remove(),2>=b(".replace-row").length&&b(".no-replaces-message").show();var a=b(this).prev().attr("id");"new-url"!==a&&"new-path"!==a||b("#"+a+"-missing-warning").hide()}),b("body").on("change","#new-url",function(){b("#new-url-missing-warning").hide()}).on("change","#new-path",function(){b("#new-path-missing-warning").hide()}),b("body").on("click",".arrow-col",function(){var a=this;if(!b(a).hasClass("disabled")){var c=b(a).prev("td").find("input").val(),d=b(a).next("td").find("input");d.val(c),"new-url"===d.prop("id")?b("#new-url-missing-warning").hide():"new-path"===d.prop("id")&&b("#new-path-missing-warning").hide()}}),b(".add-replace").click(function(){b(".replace-fields").prepend(b(".original-repeatable-field").clone().removeClass("original-repeatable-field")),b(".no-replaces-message").hide()}),b("#find-and-replace-sort tbody").sortable({items:"> tr:not(.pin)",handle:"td:first",start:function(){b(".sort-handle").css("cursor","-webkit-grabbing"),b(".sort-handle").css("cursor","-moz-grabbing")},stop:function(){b(".sort-handle").css("cursor","-webkit-grab"),b(".sort-handle").css("cursor","-moz-grab")}});var Ha="";window.location.hash&&(Ha=window.location.hash.substring(1),ra(Ha,!1)),""!==e("install-plugin")&&(Ha="addons",L=!0,ra(Ha,!0)),b(".notice-link").click(function(a){a.preventDefault(),b(this).closest(".inline-message").hide(),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_process_notice_link",nonce:wpmdb_data.nonces.process_notice_link,notice:b(this).data("notice"),type:b(this).data("type"),reminder:b(this).data("reminder")}})}),b("#connection_info").on("copy",function(a){var c=b(this),d=c.val().split("\n");if(2===d.length)try{a.originalEvent.clipboardData.setData("text/plain",d.join(" ")),a.preventDefault()}catch(a){}}),b(".reset-api-key").click(function(){var a=confirm(wpmdb_strings.reset_api_key);a&&!H&&(H=!0,b(".reset-api-key").after(' '),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_reset_api_key",nonce:wpmdb_data.nonces.reset_api_key},error:function(a,c,d){alert(wpmdb_strings.reset_api_key_problem),b(".reset-api-key-ajax-spinner").remove(),H=!1},success:function(a){b(".reset-api-key-ajax-spinner").remove(),H=!1,b(".connection-info").html(a),wpmdb_data.connection_info=b.trim(a).split("\n")}}))}),b(".copy-api-key").click(function(){var a=b(this),c=b("#connection_info"),d=c.val(),e=d.replace("\n"," ");c.val(e),c.select();try{document.execCommand("copy"),c.blur(),a.css("color","transparent");var f=b(".copy-api-key-confirmation").show();setTimeout(function(){f.fadeOut("fast"),setTimeout(function(){a.css("color","")},200)},1e3)}catch(a){alert("please press Ctrl/Cmd+C to copy")}c.val(d)}),b("input.multiselect-toggle").change(function(){b(this).parents(".expandable-content").children(".select-wrap").toggle()}),b(".show-multiselect").each(function(){b(this).is(":checked")&&(b(this).parents(".option-section").children(".header-expand-collapse").children(".expand-collapse-arrow").removeClass("collapsed"),b(this).parents(".expandable-content").show(),b(this).parents(".expandable-content").children(".select-wrap").toggle())}),b("input[name=backup_option]").change(function(){b(".backup-tables-wrap").hide(),"backup_manual_select"===b(this).val()&&b(".backup-tables-wrap").show()}),b("#backup-manual-select").is(":checked")&&b(".backup-tables-wrap").show(),b(".plugin-compatibility-save").click(function(){if(!J){b(this).addClass("disabled");var a=b("#selected-plugins");b(a).attr("disabled","disabled"),b(".plugin-compatibility-success-msg").remove(),J=!0,b(this).after(' '),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_blacklist_plugins",blacklist_plugins:b(a).val(),nonce:wpmdb_data.nonces.blacklist_plugins},error:function(c,d,e){alert(wpmdb_strings.blacklist_problem+"\r\n\r\n"+wpmdb_strings.status+" "+c.status+" "+c.statusText+"\r\n\r\n"+wpmdb_strings.response+"\r\n"+c.responseText),b(a).removeAttr("disabled"),b(".plugin-compatibility-save").removeClass("disabled"),J=!1,b(".plugin-compatibility-spinner").remove()},success:function(c){""!==b.trim(c)&&alert(c),b(a).removeAttr("disabled"),b(".plugin-compatibility-save").removeClass("disabled"),J=!1,b(".plugin-compatibility-spinner").remove(),b(".plugin-compatibility-save").after(''+wpmdb_strings.saved+" "),b(".plugin-compatibility-success-msg").fadeOut(2e3)}})}}),b("body").on("click",".delete-profile",function(){var a=b(this).next().clone();b("input",a).remove(),a=b.trim(b(a).html());var c=confirm(wpmdb_strings.remove_profile.replace("{{profile}}",a));if(c){var d=b(this).parent();if(d.find("input:checked").length){var e=d.siblings().last();if(e.find("input[type=radio]").prop("checked","checked"),e.find("input[type=text]").focus(),b("#migrate-form .crumbs .crumb:last").text("New Profile"),"function"==typeof window.history.pushState){var f=window.location.href.replace("#migrate","").replace(/&wpmdb-profile=-?\d+/,"")+"&wpmdb-profile=-1";window.history.pushState({updated_profile_id:-1},null,f)}}d.fadeOut(500),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_delete_migration_profile",profile_id:b(this).attr("data-profile-id"),nonce:wpmdb_data.nonces.delete_migration_profile},error:function(a,b,c){alert(wpmdb_strings.remove_profile_problem)},success:function(a){"-1"===a&&alert(wpmdb_strings.remove_profile_not_found)}})}}),b(".main-list-delete-profile-link").click(function(){var a=b(this).prev().html(),c=confirm(wpmdb_strings.remove_profile.replace("{{profile}}",a));c&&(b(this).parent().fadeOut(500),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_delete_migration_profile",profile_id:b(this).attr("data-profile-id"),nonce:wpmdb_data.nonces.delete_migration_profile},error:function(a,b,c){alert(wpmdb_strings.remove_profile_problem)}}))}),b("body").on("click",".temp-disabled",function(){var a=confirm(wpmdb_strings.change_connection_info);a&&(b(".ssl-notice").hide(),b(".different-plugin-version-notice").hide(),b(".migrate-db-button").show(),b(".temp-disabled").removeAttr("readonly"),b(".temp-disabled").removeClass("temp-disabled"),b(".connect-button").show(),b(".step-two").hide(),b(".connection-status").show().html(wpmdb_strings.enter_connection_info),D=!1)}),b(".settings-tab input[type=checkbox]").change(function(){if("plugin-compatibility"!==b(this).attr("id")){var a=b(this).is(":checked"),c=b(this).attr("id"),d=b(this).closest("td").next("td").find(".setting-status");b(".ajax-success-msg").remove(),d.after(ga),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_setting",checked:a,setting:c,nonce:wpmdb_data.nonces.save_setting},error:function(a,c,d){alert(wpmdb_strings.save_settings_problem),b(".ajax-spinner").remove()},success:function(a){b(".ajax-spinner").remove(),d.append(''+wpmdb_strings.saved+" "),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()})}})}}),b(".migrate-form").submit(function(a){a.preventDefault()}),b(".connect-button").click(function(a){a.preventDefault(),b(this).blur(),ta()}),b(".pull-push-connection-info").bind("paste",function(a){setTimeout(function(){ta()},0)}),b("body").on("click",".try-again",function(){b(".pull-push-connection-info").removeClass("temp-disabled"),ta()}),b("body").on("click",".try-http",function(){var a=b.trim(b(".pull-push-connection-info").val()).split("\n"),c=a[0].replace("https","http"),d=c+"\n"+a[1];b(".pull-push-connection-info").val(d),ta()}),b(".create-new-profile").change(function(){K=!0}),b("body").on("click",".temporarily-disable-ssl",function(){var a="";window.location.hash&&(a=window.location.hash.substring(1)),b(this).attr("href",b(this).attr("href")+"&hash="+a)}),b("body").on("click",".pause-resume",function(a){p(a)}),b("body").on("click",".cancel",function(a){ua(a)}),b(".enter-licence").click(function(){b(".settings").click(),b(".licence-input").focus()}),c.functions.execute_next_step=function(){if(0 "+wpmdb_strings.status+": "+a.status+" "+a.statusText+" "+wpmdb_strings.response+": "+a.responseText,"error"),console.log(a),console.log(b),console.log(d),F=!1,c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return F=!1,a=b.trim(a),"push"===x&&"1"!==a||"push"!==x&&""!==a?(c.current_migration.setState(wpmdb_strings.migration_cancellation_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(C=wpmdb_strings.migration_cancelled,"find_replace"===x&&(C=wpmdb_strings.find_replace_cancelled),c.functions.migration_complete_events(),void c.current_migration.setStatus("cancelled"))}})}else c.common.next_step_in_migration.fn.apply(null,c.common.next_step_in_migration.args)},b("body").on("click",".copy-licence-to-remote-site",function(){b(".connection-status").html(wpmdb_strings.copying_license),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ga);var a=b.trim(b(".pull-push-connection-info").val()).split("\n");F=!0,m(),b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_copy_licence_to_remote_site",url:a[0],key:a[1],nonce:wpmdb_data.nonces.copy_licence_to_remote_site},error:function(a,c,d){b(".connection-status").html(pa(a.responseText,"(#143)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),F=!1,n()},success:function(a){return b(".ajax-spinner").remove(),F=!1,n(),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error?(b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),void(a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show())):void ta()}})}),b("body").on("click",".reactivate-licence",function(a){F=!0,b(".invalid-licence").empty().html(wpmdb_strings.attempting_to_activate_licence),b(".invalid-licence").append(ga),b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_reactivate_licence",nonce:wpmdb_data.nonces.reactivate_licence},error:function(a,c,d){b(".invalid-licence").html(wpmdb_strings.activate_licence_problem),b(".invalid-licence").append(" "+wpmdb_strings.status+": "+a.status+" "+a.statusText+" "+wpmdb_strings.response+" "+a.responseText),b(".ajax-spinner").remove(),F=!1},success:function(a){return b(".ajax-spinner").remove(),F=!1,"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error?void b(".invalid-licence").html(a.body):"undefined"!=typeof a.wpmdb_dbrains_api_down&&1===a.wpmdb_dbrains_api_down?(b(".invalid-licence").html(wpmdb_strings.temporarily_activated_licence),void b(".invalid-licence").append(a.body)):(b(".invalid-licence").empty().html(wpmdb_strings.licence_reactivated),void location.reload())}})}),b("input[name=table_migrate_option]").change(function(){h(),b.wpmdb.do_action("wpmdb_tables_to_migrate_changed")}),b("body").on("change","#select-tables",function(){h(),b.wpmdb.do_action("wpmdb_tables_to_migrate_changed")}),b.wpmdb.add_filter("wpmdb_get_table_prefix",t),b.wpmdb.add_filter("wpmdb_get_tables_to_migrate",s),b.wpmdb.add_action("wpmdb_lock_replace_url",u),b.wpmdb.add_action("move_connection_info_box",ka),b.wpmdb.add_filter("wpmdb_before_migration_complete_hooks",function(a){return ca=!!b("input[name=pause_before_finalize]:checked").length,!0===ca&&"savefile"!==x&&(p(null),da=!0),a}),b(".wpmdb-switch").on("click",function(a){b(this).hasClass("disabled")||va(b(this).attr("id"))})})}(jQuery,wpmdb)},{"MigrationProgress-controller":1}]},{},[1,2,3,4,5,6,7]);
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-base.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-base.php
new file mode 100644
index 0000000..12abf4c
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-base.php
@@ -0,0 +1,2061 @@
+load_settings();
+ $this->maybe_schema_update();
+
+ $this->plugin_file_path = $plugin_file_path;
+ $this->plugin_dir_path = plugin_dir_path( $plugin_file_path );
+ $this->plugin_folder_name = basename( $this->plugin_dir_path );
+ $this->plugin_basename = plugin_basename( $plugin_file_path );
+ $this->template_dir = $this->plugin_dir_path . 'template' . DIRECTORY_SEPARATOR;
+ $this->plugin_title = ucwords( str_ireplace( '-', ' ', basename( $plugin_file_path ) ) );
+ $this->plugin_title = str_ireplace( array( 'db', 'wp', '.php' ), array( 'DB', 'WP', '' ), $this->plugin_title );
+
+ // We need to set $this->plugin_slug here because it was set here
+ // in Media Files prior to version 1.1.2. If we remove it the customer
+ // cannot upgrade, view release notes, etc
+ // used almost exclusively as a identifier for plugin version checking (both core and addons)
+ $this->plugin_slug = basename( $plugin_file_path, '.php' );
+
+ // used to add admin menus and to identify the core version in the $GLOBALS['wpmdb_meta'] variable for delicious brains api calls, version checking etc
+ $this->core_slug = ( $this->is_pro || $this->is_addon ) ? 'wp-migrate-db-pro' : 'wp-migrate-db';
+
+ if ( is_multisite() ) {
+ $this->plugin_base = 'settings.php?page=' . $this->core_slug;
+ } else {
+ $this->plugin_base = 'tools.php?page=' . $this->core_slug;
+ }
+
+ if ( $this->is_addon || $this->is_pro ) {
+ $this->pro_addon_construct();
+ }
+
+ add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
+
+ // in case admin_init isn't run (tests/cli), we'll just instantiate the fs class without wpfs and allow it to be overwritten when/if admin_init is run
+ if ( class_exists( 'WPMDB_Filesystem' ) ) {
+ $this->filesystem = new WPMDB_Filesystem( true );
+ add_action( 'admin_init', array( $this, 'init_wpmdb_filesystem' ) );
+ }
+
+ }
+
+ /**
+ * Get the URL to wp-admin/admin-ajax.php for the intended WordPress site.
+ *
+ * The intended WordPress site URL is sent via Ajax, so to get a properly
+ * formatted URL to wp-admin/admin-ajax.php we can't count on the site
+ * URL being sent with a trailing slash.
+ *
+ * @return string URL to wp-admin/admin-ajax.php, e.g. http://example.com/wp-admin/admin-ajax.php
+ */
+ function ajax_url() {
+ static $ajax_url;
+
+ if ( ! empty( $ajax_url ) ) {
+ return $ajax_url;
+ }
+
+ $ajax_url = trailingslashit( $this->state_data['url'] ) . 'wp-admin/admin-ajax.php';
+
+ return $ajax_url;
+ }
+
+ /**
+ * Sets $this->state_data from $_POST, potentially un-slashed and sanitized.
+ *
+ * @param array $key_rules An optional associative array of expected keys and their sanitization rule(s).
+ * @param string $state_key The key in $_POST that contains the migration state id (defaults to 'migration_state_id').
+ * @param string $context The method that is specifying the sanitization rules. Defaults to calling method.
+ *
+ * @return array
+ */
+ function set_post_data( $key_rules = array(), $state_key = 'migration_state_id', $context = '' ) {
+ if ( defined( 'DOING_WPMDB_TESTS' ) || $this->doing_cli_migration ) {
+ $this->state_data = $_POST;
+ } elseif ( is_null( $this->state_data ) ) {
+ $this->state_data = WPMDB_Utils::safe_wp_unslash( $_POST );
+ } else {
+ return $this->state_data;
+ }
+
+ // From this point on we're handling data originating from $_POST, so original $key_rules apply.
+ global $wpmdb_key_rules;
+
+ if ( empty( $key_rules ) && ! empty( $wpmdb_key_rules ) ) {
+ $key_rules = $wpmdb_key_rules;
+ }
+
+ // Sanitize the new state data.
+ if ( ! empty( $key_rules ) ) {
+ $wpmdb_key_rules = $key_rules;
+
+ $context = empty( $context ) ? $this->get_caller_function() : trim( $context );
+ $this->state_data = WPMDB_Sanitize::sanitize_data( $this->state_data, $key_rules, $context );
+
+ if ( false === $this->state_data ) {
+ exit;
+ }
+ }
+
+ $migration_state_id = null;
+ if ( ! empty( $this->state_data[ $state_key ] ) ) {
+ $migration_state_id = $this->state_data[ $state_key ];
+ }
+
+ if ( true !== $this->get_migration_state( $migration_state_id ) ) {
+ exit;
+ }
+
+ return $this->state_data;
+ }
+
+ function load_plugin_textdomain() {
+ load_plugin_textdomain( 'wp-migrate-db', false, dirname( plugin_basename( $this->plugin_file_path ) ) . '/languages/' );
+ }
+
+ function init_wpmdb_filesystem() {
+ if ( ! is_a( $this->filesystem, 'WPMDB_Filesystem' ) || ( is_a( $this->filesystem, 'WPMDB_Filesystem' ) && ! $this->filesystem->using_wp_filesystem() ) ) {
+ $this->filesystem = new WPMDB_Filesystem();
+ }
+ }
+
+ function pro_addon_construct() {
+ $this->addons = array(
+ 'wp-migrate-db-pro-media-files/wp-migrate-db-pro-media-files.php' => array(
+ 'name' => 'Media Files',
+ 'required_version' => '1.4.7',
+ ),
+ 'wp-migrate-db-pro-cli/wp-migrate-db-pro-cli.php' => array(
+ 'name' => 'CLI',
+ 'required_version' => '1.3',
+ ),
+ 'wp-migrate-db-pro-multisite-tools/wp-migrate-db-pro-multisite-tools.php' => array(
+ 'name' => 'Multisite Tools',
+ 'required_version' => '1.1.5',
+ ),
+ );
+
+ $this->invalid_content_verification_error = __( 'Invalid content verification signature, please verify the connection information on the remote site and try again.', 'wp-migrate-db' );
+
+ $this->transient_timeout = 60 * 60 * 12;
+ $this->transient_retry_timeout = 60 * 60 * 2;
+
+ if ( defined( 'DBRAINS_API_BASE' ) ) {
+ $this->dbrains_api_base = DBRAINS_API_BASE;
+ }
+
+ if ( $this->open_ssl_enabled() == false ) {
+ $this->dbrains_api_base = str_replace( 'https://', 'http://', $this->dbrains_api_base );
+ }
+
+ $this->dbrains_api_url = $this->dbrains_api_base . '/?wc-api=delicious-brains';
+
+ // allow developers to change the temporary prefix applied to the tables
+ $this->temp_prefix = apply_filters( 'wpmdb_temporary_prefix', $this->temp_prefix );
+
+ // Adds a custom error message to the plugin install page if required (licence expired / invalid)
+ add_filter( 'http_response', array( $this, 'verify_download' ), 10, 3 );
+
+ add_action( 'wpmdb_notices', array( $this, 'version_update_notice' ) );
+ }
+
+ /**
+ * Loads the settings into the settings class property, sets some defaults if no existing settings are found.
+ */
+ function load_settings() {
+ if ( ! is_null( $this->settings ) ) {
+ return;
+ }
+
+ $update_settings = false;
+ $this->settings = get_site_option( 'wpmdb_settings' );
+
+ /*
+ * Settings were previously stored and retrieved using get_option and update_option respectively.
+ * Here we update the subsite option to a network wide option if applicable.
+ */
+ if ( false === $this->settings && is_multisite() && is_network_admin() ) {
+ $this->settings = get_option( 'wpmdb_settings' );
+ if ( false !== $this->settings ) {
+ $update_settings = true;
+ delete_option( 'wpmdb_settings' );
+ }
+ }
+
+ $default_settings = array(
+ 'key' => $this->generate_key(),
+ 'allow_pull' => false,
+ 'allow_push' => false,
+ 'profiles' => array(),
+ 'licence' => '',
+ 'verify_ssl' => false,
+ 'blacklist_plugins' => array(),
+ 'max_request' => min( 1024 * 1024, $this->get_bottleneck( 'max' ) ),
+ 'delay_between_requests' => 0,
+ 'prog_tables_hidden' => true,
+ 'pause_before_finalize' => false,
+ );
+
+ // if we still don't have settings exist this must be a fresh install, set up some default settings
+ if ( false === $this->settings ) {
+ $this->settings = $default_settings;
+ $update_settings = true;
+ } else {
+ /*
+ * When new settings are added an existing customer's db won't have the new settings.
+ * They're added here to circumvent array index errors in debug mode.
+ */
+ foreach ( $default_settings as $key => $value ) {
+ if ( ! isset( $this->settings[ $key ] ) ) {
+ $this->settings[ $key ] = $value;
+ $update_settings = true;
+ }
+ }
+ }
+
+ if ( $update_settings ) {
+ update_site_option( 'wpmdb_settings', $this->settings );
+ }
+ }
+
+ /**
+ * Loads the error log into the error log class property.
+ */
+ function load_error_log() {
+ if ( ! is_null( $this->error_log ) ) {
+ return;
+ }
+
+ $this->error_log = get_site_option( 'wpmdb_error_log' );
+
+ /*
+ * The error log was previously stored and retrieved using get_option and update_option respectively.
+ * Here we update the subsite option to a network wide option if applicable.
+ */
+ if ( false === $this->error_log && is_multisite() && is_network_admin() ) {
+ $this->error_log = get_option( 'wpmdb_error_log' );
+ if ( false !== $this->error_log ) {
+ update_site_option( 'wpmdb_error_log', $this->error_log );
+ delete_option( 'wpmdb_error_log' );
+ }
+ }
+ }
+
+ function template( $template, $dir = '', $args = array() ) {
+ global $wpdb;
+ // TODO: Refactor to remove extract().
+ extract( $args, EXTR_OVERWRITE );
+ $dir = ( ! empty( $dir ) ) ? trailingslashit( $dir ) : $dir;
+ include $this->template_dir . $dir . $template . '.php';
+ }
+
+ function open_ssl_enabled() {
+ if ( defined( 'OPENSSL_VERSION_TEXT' ) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function set_time_limit() {
+ if ( ! function_exists( 'ini_get' ) || ! ini_get( 'safe_mode' ) ) {
+ @set_time_limit( 0 );
+ }
+ }
+
+ /**
+ * Post data to a remote site with WP Migrate DB Pro and check the response.
+ *
+ * @param string $url The URL to post to.
+ * @param array $data The associative array of data to be posted to the remote.
+ * @param string $scope A string to be used in error messages defining the function that initiated the remote post.
+ * @param array $args An optional array of args to alter the timeout, blocking and sslverify options.
+ * @param bool $expecting_serial Verify that the response is a serialized string (defaults to false).
+ *
+ * @return bool|string
+ */
+ function remote_post( $url, $data, $scope, $args = array(), $expecting_serial = false ) {
+ $this->set_time_limit();
+ $this->set_post_data();
+
+ if ( function_exists( 'fsockopen' ) && 0 === strpos( $url, 'https://' ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
+ $url_parts = $this->parse_url( $url );
+ $host = $url_parts['host'];
+ if ( $pf = @fsockopen( $host, 443, $err, $err_string, 1 ) ) {
+ // worked
+ fclose( $pf );
+ } else {
+ // failed
+ $url = substr_replace( $url, 'http', 0, 5 );
+ }
+ }
+
+ $sslverify = ( 1 == $this->settings['verify_ssl'] ? true : false );
+
+ $default_remote_post_timeout = apply_filters( 'wpmdb_default_remote_post_timeout', 60 * 20 );
+
+ $args = wp_parse_args( $args,
+ array(
+ 'timeout' => $default_remote_post_timeout,
+ 'blocking' => true,
+ 'sslverify' => $sslverify,
+ ) );
+
+ $args['method'] = 'POST';
+
+ if ( ! isset( $args['body'] ) ) {
+ $args['body'] = $this->array_to_multipart( $data );
+ }
+
+ $args['headers']['Content-Type'] = 'multipart/form-data; boundary=' . $this->multipart_boundary;
+ $args['headers']['Referer'] = $this->referer_from_url( $url );
+
+ $this->attempting_to_connect_to = $url;
+
+ do_action( 'wpmdb_before_remote_post' );
+
+ $response = wp_remote_post( $url, $args );
+
+ if ( ! is_wp_error( $response ) ) {
+ // Every response should be scrambled, but other processes may have been applied too so we use a filter.
+ add_filter( 'wpmdb_after_response', array( $this, 'unscramble' ) );
+ $response['body'] = apply_filters( 'wpmdb_after_response', trim( $response['body'], "\xef\xbb\xbf" ) );
+ remove_filter( 'wpmdb_after_response', array( $this, 'unscramble' ) );
+ }
+
+ if ( is_wp_error( $response ) ) {
+ if ( 0 === strpos( $url, 'https://' ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
+ return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
+ } elseif ( isset( $response->errors['http_request_failed'][0] ) && strstr( $response->errors['http_request_failed'][0], 'timed out' ) ) {
+ $this->error = sprintf( __( 'The connection to the remote server has timed out, no changes have been committed. (#134 - scope: %s)', 'wp-migrate-db' ), $scope );
+ } elseif ( isset( $response->errors['http_request_failed'][0] ) && ( strstr( $response->errors['http_request_failed'][0], 'Could not resolve host' ) || strstr( $response->errors['http_request_failed'][0], "Couldn't resolve host" ) || strstr( $response->errors['http_request_failed'][0], "couldn't connect to host" ) ) ) {
+ $this->error = sprintf( __( 'We could not find: %s. Are you sure this is the correct URL?', 'wp-migrate-db' ), $this->state_data['url'] );
+ $url_bits = $this->parse_url( $this->state_data['url'] );
+ if ( strstr( $this->state_data['url'], 'dev.' ) || strstr( $this->state_data['url'], '.dev' ) || ! strstr( $url_bits['host'], '.' ) ) {
+ $this->error .= ' ';
+ if ( 'pull' == $this->state_data['intent'] ) {
+ $this->error .= __( 'It appears that you might be trying to pull from a local environment. This will not work if this website happens to be located on a remote server, it would be impossible for this server to contact your local environment.', 'wp-migrate-db' );
+ } else {
+ $this->error .= __( 'It appears that you might be trying to push to a local environment. This will not work if this website happens to be located on a remote server, it would be impossible for this server to contact your local environment.', 'wp-migrate-db' );
+ }
+ }
+ } else {
+ if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
+ $url_parts = $this->parse_url( $url );
+ $host = $url_parts['host'];
+ if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) || ( defined( 'WP_ACCESSIBLE_HOSTS' ) && ! in_array( $host, explode( ',', WP_ACCESSIBLE_HOSTS ) ) ) ) {
+ $this->error = sprintf( __( 'We\'ve detected that WP_HTTP_BLOCK_EXTERNAL is enabled and the host %1$s has not been added to WP_ACCESSIBLE_HOSTS. Please disable WP_HTTP_BLOCK_EXTERNAL or add %1$s to WP_ACCESSIBLE_HOSTS to continue. More information . (#147 - scope: %3$s)', 'wp-migrate-db' ), esc_attr( $host ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/wp_http_block_external/', $scope );
+ }
+ } elseif ( isset( $response->errors['http_request_failed'][0] ) && strstr( $response->errors['http_request_failed'][0], 'port 443: Connection refused' ) ) {
+ $this->error = sprintf( __( 'Couldn\'t connect over HTTPS. You might want to try regular HTTP instead. (#121 - scope: %s)', 'wp-migrate-db' ), $scope );
+ } elseif ( isset( $response->errors['http_request_failed'][0] ) && strstr( $response->errors['http_request_failed'][0], 'SSL' ) ) { // OpenSSL/cURL/MAMP Error
+ $this->error = sprintf( __( 'SSL Connection error: (#121 - scope: %s) This typically means that the version of SSL that your local site is using to connect to the remote is incompatible or, more likely, being rejected by the remote server because it\'s insecure. See our documentation for possible solutions.', 'wp-migrate-db' ), $scope, 'https://deliciousbrains.com/wp-migrate-db-pro/doc/ssl-errors/' );
+ } else {
+ $this->error = sprintf( __( 'The connection failed, an unexpected error occurred, please contact support. (#121 - scope: %s)', 'wp-migrate-db' ), $scope );
+ }
+ }
+ $this->log_error( $this->error, $response );
+
+ return false;
+ } elseif ( 200 > (int) $response['response']['code'] || 399 < (int) $response['response']['code'] ) {
+ if ( 401 === (int) $response['response']['code'] ) {
+ $this->error = __( 'The remote site is protected with Basic Authentication. Please enter the username and password above to continue. (401 Unauthorized)', 'wp-migrate-db' );
+ $this->log_error( $this->error, $response );
+
+ return false;
+ } elseif ( 0 === strpos( $url, 'https://' ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
+ return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
+ } else {
+ $this->error = sprintf( __( 'Unable to connect to the remote server, please check the connection details - %1$s %2$s (#129 - scope: %3$s)', 'wp-migrate-db' ), $response['response']['code'], $response['response']['message'], $scope );
+ $this->log_error( $this->error, $response );
+
+ return false;
+ }
+ } elseif ( empty( $response['body'] ) ) {
+ if ( '0' === $response['body'] && 'ajax_verify_connection_to_remote_site' == $scope ) {
+ if ( 0 === strpos( $url, 'https://' ) ) {
+ return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
+ } else {
+ $this->error = sprintf( __( 'WP Migrate DB Pro does not seem to be installed or active on the remote site. (#131 - scope: %s)', 'wp-migrate-db' ), $scope );
+ }
+ } else {
+ $this->error = sprintf( __( 'A response was expected from the remote, instead we got nothing. (#146 - scope: %1$s) Please review %2$s for possible solutions.', 'wp-migrate-db' ), $scope, sprintf( '%1$s ', __( 'our documentation', 'wp-migrate-db' ) ) );
+ }
+ $this->log_error( $this->error, $response );
+
+ return false;
+ } elseif ( $expecting_serial && false == is_serialized( $response['body'] ) ) {
+ if ( 0 === strpos( $url, 'https://' ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
+ return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
+ }
+ $this->error = __( 'There was a problem with the AJAX request, we were expecting a serialized response, instead we received: ', 'wp-migrate-db' ) . esc_html( $response['body'] );
+ $this->log_error( $this->error, $response );
+
+ return false;
+ } elseif ( $expecting_serial && 'ajax_verify_connection_to_remote_site' == $scope ) {
+ $unserialized_response = WPMDB_Utils::unserialize( $response['body'], __METHOD__ );
+ if ( false !== $unserialized_response && isset( $unserialized_response['error'] ) && '1' == $unserialized_response['error'] && 0 === strpos( $url, 'https://' ) ) {
+ if ( false === strpos( $unserialized_response['message'], '(#122)' ) ) {
+ return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
+ }
+ }
+ }
+
+ return trim( $response['body'] );
+ }
+
+ function retry_remote_post( $url, $data, $scope, $args = array(), $expecting_serial = false ) {
+ $url = substr_replace( $url, 'http', 0, 5 );
+ if ( $response = $this->remote_post( $url, $data, $scope, $args, $expecting_serial ) ) {
+ return $response;
+ }
+
+ return false;
+ }
+
+ function array_to_multipart( $data ) {
+ if ( ! $data || ! is_array( $data ) ) {
+ return $data;
+ }
+
+ $result = '';
+
+ foreach ( $data as $key => $value ) {
+ $result .= '--' . $this->multipart_boundary . "\r\n" . sprintf( 'Content-Disposition: form-data; name="%s"', $key );
+
+ if ( 'chunk' == $key ) {
+ if ( $data['chunk_gzipped'] ) {
+ $result .= "; filename=\"chunk.txt.gz\"\r\nContent-Type: application/x-gzip";
+ } else {
+ $result .= "; filename=\"chunk.txt\"\r\nContent-Type: text/plain;";
+ }
+ } else {
+ $result .= "\r\nContent-Type: text/plain; charset=" . get_option( 'blog_charset' );
+ }
+
+ $result .= "\r\n\r\n" . $value . "\r\n";
+ }
+
+ $result .= '--' . $this->multipart_boundary . "--\r\n";
+
+ return $result;
+ }
+
+ function file_to_multipart( $file ) {
+ $result = '';
+
+ if ( false == file_exists( $file ) ) {
+ return false;
+ }
+
+ $filetype = wp_check_filetype( $file );
+ $contents = file_get_contents( $file );
+
+ $result .= '--' . $this->multipart_boundary . "\r\n" . sprintf( 'Content-Disposition: form-data; name="media[]"; filename="%s"', basename( $file ) );
+ $result .= sprintf( "\r\nContent-Type: %s", $filetype['type'] );
+ $result .= "\r\n\r\n" . $contents . "\r\n";
+ $result .= '--' . $this->multipart_boundary . "--\r\n";
+
+ return $result;
+ }
+
+ function log_error( $wpmdb_error, $additional_error_var = false ) {
+ $error_header = "********************************************\n****** Log date: " . date( 'Y/m/d H:i:s' ) . " ******\n********************************************\n\n";
+ $error = $error_header . 'WPMDB Error: ' . $wpmdb_error . "\n\n";
+
+ if ( ! empty( $this->attempting_to_connect_to ) ) {
+ $error .= 'Attempted to connect to: ' . $this->attempting_to_connect_to . "\n\n";
+ }
+
+ if ( $additional_error_var !== false ) {
+ $error .= print_r( $additional_error_var, true ) . "\n\n";
+ }
+
+ $this->load_error_log();
+
+ // Error log length in bytes (default 1Mb)
+ $max_log_length = apply_filters( 'wpmdb_max_error_log_length', 1000000 );
+ $max_individual_log_length = apply_filters( 'wpmdb_max_individual_error_log_length', $max_log_length / 2.2 );
+
+ // If error is longer than max individual log length, trim and add notice of doing so
+ if ( strlen( $error ) > $max_individual_log_length ) {
+ $length_trimmed = strlen( $error ) - $max_individual_log_length;
+ $error = substr( $error, 0, $max_individual_log_length );
+ $error .= "\n[$length_trimmed bytes were truncated from this error]\n\n";
+ }
+
+ // Trim existing log to accommodate new error if needed
+ $existing_log_max_length = $max_log_length - strlen( $error );
+ if ( strlen( $this->error_log ) > $existing_log_max_length ) {
+ $this->error_log = substr( $this->error_log, -( $existing_log_max_length ) );
+
+ // Crop at first log header
+ $first_header_pos = strpos( $this->error_log, substr( $error_header, 0, strpos( $error_header, ' ' ) ) );
+ if ( $first_header_pos ) {
+ $this->error_log = substr( $this->error_log, $first_header_pos );
+ }
+ }
+
+ if ( isset( $this->error_log ) ) {
+ $this->error_log .= $error;
+ } else {
+ $this->error_log = $error;
+ }
+
+ update_site_option( 'wpmdb_error_log', $this->error_log );
+ }
+
+ function display_errors() {
+ if ( ! empty( $this->error ) ) {
+ echo $this->error;
+ $this->error = '';
+
+ return true;
+ }
+
+ return false;
+ }
+
+ function filter_post_elements( $post_array, $accepted_elements ) {
+ $accepted_elements[] = 'sig';
+
+ return array_intersect_key( $post_array, array_flip( $accepted_elements ) );
+ }
+
+ function sanitize_signature_data( $value ) {
+ if ( is_bool( $value ) ) {
+ $value = $value ? 'true' : 'false';
+ }
+
+ return $value;
+ }
+
+ /**
+ * Generate a signature string for the supplied data given a key.
+ *
+ * @param array $data
+ * @param string $key
+ *
+ * @return string
+ */
+ function create_signature( $data, $key ) {
+ if ( isset( $data['sig'] ) ) {
+ unset( $data['sig'] );
+ }
+ $data = array_map( array( $this, 'sanitize_signature_data' ), $data );
+ ksort( $data );
+ $flat_data = implode( '', $data );
+
+ return base64_encode( hash_hmac( 'sha1', $flat_data, $key, true ) );
+ }
+
+ function verify_signature( $data, $key ) {
+ if ( empty( $data['sig'] ) ) {
+ return false;
+ }
+
+ if ( isset( $data['nonce'] ) ) {
+ unset( $data['nonce'] );
+ }
+
+ $temp = $data;
+ $computed_signature = $this->create_signature( $temp, $key );
+
+ return $computed_signature === $data['sig'];
+ }
+
+ function get_dbrains_api_url( $request, $args = array() ) {
+ $url = $this->dbrains_api_url;
+ $args['request'] = $request;
+ $args['version'] = $GLOBALS['wpmdb_meta'][ $this->core_slug ]['version'];
+
+ if ( 'check_support_access' == $request || 'activate_licence' == $request ) {
+ $args['last_used'] = urlencode( $this->get_last_usage_time() );
+ }
+
+ $url = add_query_arg( $args, $url );
+ if ( false !== get_site_transient( 'wpmdb_temporarily_disable_ssl' ) && 0 === strpos( $this->dbrains_api_url, 'https://' ) ) {
+ $url = substr_replace( $url, 'http', 0, 5 );
+ }
+
+ $url .= '&locale=' . urlencode( get_locale() );
+
+ return $url;
+ }
+
+ /**
+ * Determines, sets up, and returns folder information for storing files.
+ *
+ * By default, the folder created will be `wp-migrate-db` and will be stored
+ * inside of the `uploads` folder in WordPress' current `WP_CONTENT_DIR`,
+ * usually `wp-content/uploads`
+ *
+ * To change the folder name of `wp-migrate-db` to something else, you can use
+ * the `wpmdb_upload_dir_name` filter to change it. e.g.:
+ *
+ * function upload_dir_name() {
+ * return 'database-dumps';
+ * }
+ *
+ * add_filter( 'wpmdb_upload_dir_name', 'upload_dir_name' );
+ *
+ * If `WP_CONTENT_DIR` was set to `wp-content` in this example,
+ * this would change the folder to `wp-content/uploads/database-dumps`.
+ *
+ * To change the entire path, for example to store these files outside of
+ * WordPress' `WP_CONTENT_DIR`, use the `wpmdb_upload_info` filter to do so. e.g.:
+ *
+ * function upload_info() {
+ * // The returned data needs to be in a very specific format, see below for example
+ * return array(
+ * 'path' => '/path/to/custom/uploads/directory', // note missing end trailing slash
+ * 'url' => 'http://yourwebsite.com/custom/uploads/directory' // note missing end trailing slash
+ * );
+ * }
+ *
+ * add_filter( 'wpmdb_upload_info', 'upload_info' );
+ *
+ * This would store files in `/path/to/custom/uploads/directory` with a
+ * URL to access files via `http://yourwebsite.com/custom/uploads/directory`
+ *
+ * @link https://github.com/deliciousbrains/wp-migrate-db-pro-tweaks
+ *
+ * @param string $type Either `path` or `url`.
+ *
+ * @return string The Path or the URL to the folder being used.
+ */
+ function get_upload_info( $type = 'path' ) {
+ $upload_info = apply_filters( 'wpmdb_upload_info', array() );
+
+ // No need to create the directory structure since it should already exist.
+ if ( ! empty( $upload_info ) ) {
+ return $upload_info[ $type ];
+ }
+
+ $upload_dir = wp_upload_dir();
+
+ $upload_info['path'] = $upload_dir['basedir'];
+ $upload_info['url'] = $upload_dir['baseurl'];
+
+ $upload_dir_name = apply_filters( 'wpmdb_upload_dir_name', 'wp-migrate-db' );
+
+ if ( ! file_exists( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name ) ) {
+ $url = wp_nonce_url( $this->plugin_base, 'wp-migrate-db-pro-nonce' );
+
+ // Create the directory.
+ // TODO: Do not silence errors, use wp_mkdir_p?
+ if ( false === @mkdir( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name, 0755 ) ) {
+ return $upload_info[ $type ];
+ }
+
+ // Protect from directory listings by making sure an index file exists.
+ $filename = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name . DIRECTORY_SEPARATOR . 'index.php';
+ // TODO: Do not silence errors, use WP_Filesystem API?
+ if ( false === @file_put_contents( $filename, "" ) ) {
+ return $upload_info[ $type ];
+ }
+ }
+
+ // Protect from directory listings by ensuring this folder does not allow Indexes if using Apache.
+ $htaccess = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name . DIRECTORY_SEPARATOR . '.htaccess';
+ if ( ! file_exists( $htaccess ) ) {
+ // TODO: Do not silence errors, use WP_Filesystem API?
+ if ( false === @file_put_contents( $htaccess, "Options -Indexes\r\nDeny from all" ) ) {
+ return $upload_info[ $type ];
+ }
+ }
+
+ $upload_info['path'] .= DIRECTORY_SEPARATOR . $upload_dir_name;
+ $upload_info['url'] .= '/' . $upload_dir_name;
+
+ return $upload_info[ $type ];
+ }
+
+ /**
+ * Adds/updates the `wpmdb_usage` option with most recent 'qualified' plugin use,
+ * stores time as well as the action (push/pull/export/find-replace)
+ *
+ * @param string $action
+ */
+ function log_usage( $action = '' ) {
+ update_site_option( 'wpmdb_usage', array( 'action' => $action, 'time' => time() ) );
+ }
+
+ /**
+ * Gets just the timestamp of the latest usage to send with the API requests
+ *
+ * @return int
+ */
+ function get_last_usage_time() {
+ $option = get_site_option( 'wpmdb_usage' );
+ return ( $option && $option['time'] ) ? $option['time'] : 0;
+ }
+
+ /**
+ * Main function for communicating with the Delicious Brains API.
+ *
+ * @param string $request
+ * @param array $args
+ *
+ * @return mixed
+ */
+ function dbrains_api_request( $request, $args = array() ) {
+ $trans = get_site_transient( 'wpmdb_dbrains_api_down' );
+
+ if ( false !== $trans ) {
+ $api_down_message = sprintf( '%s
', $trans );
+
+ return json_encode( array( 'dbrains_api_down' => $api_down_message ) );
+ }
+
+ $sslverify = ( $this->settings['verify_ssl'] == 1 ? true : false );
+
+ $url = $this->get_dbrains_api_url( $request, $args );
+ $response = wp_remote_get(
+ $url,
+ array(
+ 'timeout' => 30,
+ 'blocking' => true,
+ 'sslverify' => $sslverify,
+ )
+ );
+
+ if ( is_wp_error( $response ) || (int) $response['response']['code'] < 200 || (int) $response['response']['code'] > 399 ) {
+ $this->log_error( print_r( $response, true ) );
+
+ if ( true === $this->dbrains_api_down() ) {
+ $trans = get_site_transient( 'wpmdb_dbrains_api_down' );
+
+ if ( false !== $trans ) {
+ $api_down_message = sprintf( '%s
', $trans );
+
+ return json_encode( array( 'dbrains_api_down' => $api_down_message ) );
+ }
+ }
+
+ $disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
+ $connection_failed_message = '';
+ $connection_failed_message .= sprintf( __( '
Could not connect to api.deliciousbrains.com — You will not receive update notifications or be able to activate your license until this is fixed. This issue is often caused by an improperly configured SSL server (https). We recommend
fixing the SSL configuration on your server , but if you need a quick fix you can:%2$s', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/could-not-connect-deliciousbrains-com/', sprintf( '
%2$s
', $disable_ssl_url, __( 'Temporarily disable SSL for connections to api.deliciousbrains.com', 'wp-migrate-db' ) ) );
+ $connection_failed_message .= '
';
+
+ if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
+ $url_parts = $this->parse_url( $url );
+ $host = $url_parts['host'];
+ if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) || strpos( WP_ACCESSIBLE_HOSTS, $host ) === false ) {
+ $connection_failed_message = '';
+ $connection_failed_message .= sprintf( __( 'We\'ve detected that
WP_HTTP_BLOCK_EXTERNAL is enabled and the host
%1$s has not been added to
WP_ACCESSIBLE_HOSTS. Please disable
WP_HTTP_BLOCK_EXTERNAL or add
%1$s to
WP_ACCESSIBLE_HOSTS to continue.
More information .', 'wp-migrate-db' ), esc_attr( $host ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/wp_http_block_external/' );
+ $connection_failed_message .= '
';
+ }
+ }
+
+ // Don't cache the license response so we can try again
+ delete_site_transient( 'wpmdb_licence_response' );
+
+ return json_encode( array( 'errors' => array( 'connection_failed' => $connection_failed_message ) ) );
+ }
+
+ return $response['body'];
+ }
+
+ /**
+ * Is the Delicious Brains API down?
+ *
+ * If not available then a 'wpmdb_dbrains_api_down' transient will be set with an appropriate message.
+ *
+ * @return bool
+ */
+ function dbrains_api_down() {
+ if ( false !== get_site_transient( 'wpmdb_dbrains_api_down' ) ) {
+ return true;
+ }
+
+ $response = wp_remote_get( $this->dbrains_api_status_url, array( 'timeout' => 30 ) );
+
+ // Can't get to api status url so fall back to normal failure handling.
+ if ( is_wp_error( $response ) || 200 != (int) $response['response']['code'] || empty( $response['body'] ) ) {
+ return false;
+ }
+
+ $json = json_decode( $response['body'], true );
+
+ // Can't decode json so fall back to normal failure handling.
+ if ( ! $json ) {
+ return false;
+ }
+
+ // JSON doesn't seem to have the format we expect or is not down, so fall back to normal failure handling.
+ if ( ! isset( $json['api']['status'] ) || 'down' != $json['api']['status'] ) {
+ return false;
+ }
+
+ $message = __( "Delicious Brains API is Down — Unfortunately we're experiencing some problems with our server.", 'wp-migrate-db' );
+
+ if ( ! empty( $json['api']['updated'] ) ) {
+ $updated = $json['api']['updated'];
+ $updated_ago = sprintf( _x( '%s ago', 'ex. 2 hours ago', 'wp-migrate-db' ), human_time_diff( strtotime( $updated ) ) );
+ }
+
+ if ( ! empty( $json['api']['message'] ) ) {
+ $message .= ' ';
+ $message .= __( "Here's the most recent update on its status", 'wp-migrate-db' );
+ if ( ! empty( $updated_ago ) ) {
+ $message .= ' (' . $updated_ago . ')';
+ }
+ $message .= ': ' . $json['api']['message'] . ' ';
+ }
+
+ set_site_transient( 'wpmdb_dbrains_api_down', $message, $this->transient_retry_timeout );
+
+ return true;
+ }
+
+ function verify_download( $response, $args, $url ) {
+ if ( is_wp_error( $response ) ) {
+ return $response;
+ }
+
+ $download_url = $this->get_plugin_update_download_url( $this->plugin_slug );
+
+ if ( false === strpos( $url, $download_url ) || 402 != $response['response']['code'] ) {
+ return $response;
+ }
+
+ // The $response['body'] is blank but output is actually saved to a file in this case
+ $data = @file_get_contents( $response['filename'] );
+
+ if ( ! $data ) {
+ return new WP_Error( 'wpmdbpro_download_error_empty', sprintf( __( 'Error retrieving download from deliciousbrain.com. Please try again or download manually from %2$s .', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/', _x( 'My Account', 'Delicious Brains account', 'wp-migrate-db' ) ) );
+ }
+
+ $decoded_data = json_decode( $data, true );
+
+ // Can't decode the JSON errors, so just barf it all out
+ if ( ! isset( $decoded_data['errors'] ) || ! $decoded_data['errors'] ) {
+ return new WP_Error( 'wpmdbpro_download_error_raw', $data );
+ }
+
+ foreach ( $decoded_data['errors'] as $key => $msg ) {
+ return new WP_Error( 'wpmdbpro_' . $key, $msg );
+ }
+ }
+
+ function is_licence_constant() {
+ return defined( 'WPMDB_LICENCE' );
+ }
+
+ function get_licence_key() {
+ return $this->is_licence_constant() ? WPMDB_LICENCE : $this->settings['licence'];
+ }
+
+ /**
+ * Sets the licence index in the $settings array class property and updates the wpmdb_settings option.
+ *
+ * @param string $key
+ */
+ function set_licence_key( $key ) {
+ $this->settings['licence'] = $key;
+ update_site_option( 'wpmdb_settings', $this->settings );
+ }
+
+ /**
+ * Checks whether the saved licence has expired or not.
+ *
+ * @param bool $skip_transient_check
+ *
+ * @return bool
+ */
+ function is_valid_licence( $skip_transient_check = false ) {
+ $response = $this->is_licence_expired( $skip_transient_check );
+
+ if ( isset( $response['dbrains_api_down'] ) ) {
+ return true;
+ }
+
+ // Don't cripple the plugin's functionality if the user's licence is expired
+ if ( isset( $response['errors']['subscription_expired'] ) && 1 === count( $response['errors'] ) ) {
+ return true;
+ }
+
+ return ( isset( $response['errors'] ) ) ? false : true;
+ }
+
+ function is_licence_expired( $skip_transient_check = false ) {
+ $licence = $this->get_licence_key();
+
+ if ( empty( $licence ) ) {
+ $settings_link = sprintf( '%s ', network_admin_url( $this->plugin_base ) . '#settings', _x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) );
+ $message = sprintf( __( 'To finish activating WP Migrate DB Pro, please go to %1$s and enter your license key. If you don\'t have a license key, you may purchase one .', 'wp-migrate-db' ), $settings_link, 'http://deliciousbrains.com/wp-migrate-db-pro/pricing/' );
+
+ return array( 'errors' => array( 'no_licence' => $message ) );
+ }
+
+ if ( ! $skip_transient_check ) {
+ $trans = get_site_transient( 'wpmdb_licence_response' );
+ if ( false !== $trans ) {
+ return json_decode( $trans, true );
+ }
+ }
+
+ return json_decode( $this->check_licence( $licence ), true );
+ }
+
+ function check_licence( $licence_key ) {
+ if ( empty( $licence_key ) ) {
+ return false;
+ }
+
+ $args = array(
+ 'licence_key' => urlencode( $licence_key ),
+ 'site_url' => urlencode( untrailingslashit( network_home_url( '', 'http' ) ) ),
+ );
+
+ $response = $this->dbrains_api_request( 'check_support_access', $args );
+
+ set_site_transient( 'wpmdb_licence_response', $response, $this->transient_timeout );
+
+ return $response;
+ }
+
+ function is_beta_version( $ver ) {
+ if ( preg_match( '@b[0-9]+$@', $ver ) ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ function get_required_version( $slug ) {
+ $plugin_file = sprintf( '%1$s/%1$s.php', $slug );
+
+ if ( isset( $this->addons[ $plugin_file ]['required_version'] ) ) {
+ return $this->addons[ $plugin_file ]['required_version'];
+ } else {
+ return 0;
+ }
+ }
+
+ function get_latest_version( $slug ) {
+ $data = $this->get_upgrade_data();
+
+ if ( ! isset( $data[ $slug ] ) ) {
+ return false;
+ }
+
+ // If pre-1.1.2 version of Media Files addon
+ if ( ! isset( $GLOBALS['wpmdb_meta'][ $slug ]['version'] ) ) {
+ $installed_version = false;
+ } else {
+ $installed_version = $GLOBALS['wpmdb_meta'][ $slug ]['version'];
+ }
+
+ $required_version = $this->get_required_version( $slug );
+
+ // Return the latest beta version if the installed version is beta
+ // and the API returned a beta version and it's newer than the latest stable version
+ if ( $installed_version
+ && ( $this->is_beta_version( $installed_version ) || $this->is_beta_version( $required_version ) )
+ && isset( $data[ $slug ]['beta_version'] )
+ && version_compare( $data[ $slug ]['version'], $data[ $slug ]['beta_version'], '<' )
+ ) {
+ return $data[ $slug ]['beta_version'];
+ }
+
+ return $data[ $slug ]['version'];
+ }
+
+ function get_upgrade_data() {
+ $info = get_site_transient( 'wpmdb_upgrade_data' );
+
+ if ( isset( $info['version'] ) ) {
+ delete_site_transient( 'wpmdb_licence_response' );
+ delete_site_transient( 'wpmdb_upgrade_data' );
+ $info = false;
+ }
+
+ if ( $info ) {
+ return $info;
+ }
+
+ $data = $this->dbrains_api_request( 'upgrade_data' );
+
+ $data = json_decode( $data, true );
+
+ /*
+ We need to set the transient even when there's an error,
+ otherwise we'll end up making API requests over and over again
+ and slowing things down big time.
+ */
+ $default_upgrade_data = array( 'wp-migrate-db-pro' => array( 'version' => $GLOBALS['wpmdb_meta'][ $this->core_slug ]['version'] ) );
+
+ if ( ! $data ) {
+ set_site_transient( 'wpmdb_upgrade_data', $default_upgrade_data, $this->transient_retry_timeout );
+ $this->log_error( 'Error trying to decode JSON upgrade data.' );
+
+ return false;
+ }
+
+ if ( isset( $data['errors'] ) ) {
+ set_site_transient( 'wpmdb_upgrade_data', $default_upgrade_data, $this->transient_retry_timeout );
+ $this->log_error( 'Error trying to get upgrade data.', $data['errors'] );
+
+ return false;
+ }
+
+ set_site_transient( 'wpmdb_upgrade_data', $data, $this->transient_timeout );
+
+ return $data;
+ }
+
+ function get_plugin_update_download_url( $plugin_slug, $is_beta = false ) {
+ $licence = $this->get_licence_key();
+ $query_args = array(
+ 'request' => 'download',
+ 'licence_key' => $licence,
+ 'slug' => $plugin_slug,
+ 'site_url' => home_url( '', 'http' ),
+ );
+
+ if ( $is_beta ) {
+ $query_args['beta'] = '1';
+ }
+
+ return add_query_arg( $query_args, $this->dbrains_api_url );
+ }
+
+ function diverse_array( $vector ) {
+ $result = array();
+
+ foreach ( $vector as $key1 => $value1 ) {
+ foreach ( $value1 as $key2 => $value2 ) {
+ $result[ $key2 ][ $key1 ] = $value2;
+ }
+ }
+
+ return $result;
+ }
+
+ function set_time_limit_available() {
+ if ( ! function_exists( 'set_time_limit' ) || ! function_exists( 'ini_get' ) ) {
+ return false;
+ }
+
+ $current_max_execution_time = ini_get( 'max_execution_time' );
+ $proposed_max_execution_time = ( $current_max_execution_time == 30 ) ? 31 : 30;
+ @set_time_limit( $proposed_max_execution_time );
+ $current_max_execution_time = ini_get( 'max_execution_time' );
+
+ return $proposed_max_execution_time == $current_max_execution_time;
+ }
+
+ function get_plugin_name( $plugin = false ) {
+ if ( ! is_admin() ) {
+ return false;
+ }
+
+ $plugin_basename = ( false !== $plugin ? $plugin : $this->plugin_basename );
+
+ $plugins = get_plugins();
+
+ if ( ! isset( $plugins[ $plugin_basename ]['Name'] ) ) {
+ return false;
+ }
+
+ return $plugins[ $plugin_basename ]['Name'];
+ }
+
+ function get_class_props() {
+ return get_object_vars( $this );
+ }
+
+ /**
+ * Get only the tables beginning with our DB prefix or temporary prefix, also skip views and legacy wpmdb_alter_statements table.
+ *
+ * @param string $scope
+ *
+ * @return array
+ */
+ function get_tables( $scope = 'regular' ) {
+ global $wpdb;
+ $prefix = ( $scope == 'temp' ? $this->temp_prefix : $wpdb->base_prefix );
+ $tables = $wpdb->get_results( 'SHOW FULL TABLES', ARRAY_N );
+ $clean_tables = array();
+
+ foreach ( $tables as $table ) {
+ if ( ( ( $scope == 'temp' || $scope == 'prefix' ) && 0 !== strpos( $table[0], $prefix ) ) || $table[1] == 'VIEW' ) {
+ continue;
+ }
+ if ( $this->get_legacy_alter_table_name() == $table[0] ) {
+ continue;
+ }
+ $clean_tables[] = $table[0];
+ }
+
+ return apply_filters( 'wpmdb_tables', $clean_tables, $scope );
+ }
+
+ function version_update_notice() {
+ // We don't want to show both the "Update Required" and "Update Available" messages at the same time
+ if ( isset( $this->addons[ $this->plugin_basename ] ) && true == $this->is_addon_outdated( $this->plugin_basename ) ) {
+ return;
+ }
+
+ // To reduce UI clutter we hide addon update notices if the core plugin has updates available
+ if ( isset( $this->addons[ $this->plugin_basename ] ) ) {
+ $core_installed_version = $GLOBALS['wpmdb_meta'][ $this->core_slug ]['version'];
+ $core_latest_version = $this->get_latest_version( $this->core_slug );
+ // Core update is available, don't show update notices for addons until core is updated
+ if ( version_compare( $core_installed_version, $core_latest_version, '<' ) ) {
+ return;
+ }
+ }
+
+ $update_url = wp_nonce_url( network_admin_url( 'update.php?action=upgrade-plugin&plugin=' . urlencode( $this->plugin_basename ) ), 'upgrade-plugin_' . $this->plugin_basename );
+
+ // If pre-1.1.2 version of Media Files addon, don't bother getting the versions
+ if ( ! isset( $GLOBALS['wpmdb_meta'][ $this->plugin_slug ]['version'] ) ) {
+ ?>
+
+
—
+ plugin_title, sprintf( '
%s ', $update_url, _x( 'Update Now', 'Download and install a new version of the plugin', 'wp-migrate-db' ) ) ); ?>
+
+ plugin_slug ]['version'];
+ $latest_version = $this->get_latest_version( $this->plugin_slug );
+
+ if ( version_compare( $installed_version, $latest_version, '<' ) ) { ?>
+
+ —
+ %5$s', 'wp-migrate-db' ), $this->plugin_title, $latest_version, $installed_version, $update_url, _x( 'Update Now', 'Download and install a new version of the plugin', 'wp-migrate-db' ) ); ?>
+
+ plugin_dir_path );
+
+ return substr( $path, 0, strrpos( $path, DIRECTORY_SEPARATOR ) ) . DIRECTORY_SEPARATOR;
+ }
+
+ function is_addon_outdated( $addon_basename ) {
+ $addon_slug = current( explode( '/', $addon_basename ) );
+
+ // If pre-1.1.2 version of Media Files addon, then it is outdated
+ if ( ! isset( $GLOBALS['wpmdb_meta'][ $addon_slug ]['version'] ) ) {
+ return true;
+ }
+
+ $installed_version = $GLOBALS['wpmdb_meta'][ $addon_slug ]['version'];
+ $required_version = $this->addons[ $addon_basename ]['required_version'];
+
+ return version_compare( $installed_version, $required_version, '<' );
+ }
+
+ function get_plugin_file_path() {
+ return $this->plugin_file_path;
+ }
+
+ /**
+ * Returns a formatted message dependant on the status of the licence.
+ *
+ * @param bool $trans
+ * @param string $context
+ *
+ * @return array|string|void
+ */
+ function get_licence_status_message( $trans = false, $context = null ) {
+ $licence = $this->get_licence_key();
+ $api_response_provided = true;
+
+ if ( empty( $licence ) && ! $trans ) {
+ $message = sprintf( __( 'Activate Your License — Please enter your license key to enable push and pull functionality, priority support and plugin updates.', 'wp-migrate-db' ), network_admin_url( $this->plugin_base . '#settings' ), 'js-action-link enter-licence' );
+
+ return $message;
+ }
+
+ if ( ! $trans ) {
+ $trans = get_site_transient( 'wpmdb_licence_response' );
+
+ if ( false === $trans ) {
+ $trans = $this->check_licence( $licence );
+ }
+
+ $trans = json_decode( $trans, true );
+ $api_response_provided = false;
+ }
+
+ if ( isset( $trans['dbrains_api_down'] ) ) {
+ return __( "We've temporarily activated your license and will complete the activation once the Delicious Brains API is available again. ", 'wp-migrate-db' );
+ }
+
+ $errors = $trans['errors'];
+
+ $check_licence_again_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-check-licence' ) . '&wpmdb-check-licence=1' );
+
+ if ( isset( $errors['connection_failed'] ) ) {
+ $disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
+ $message = sprintf( __( 'Could not connect to api.deliciousbrains.com — You will not receive update notifications or be able to activate your license until this is fixed. This issue is often caused by an improperly configured SSL server (https). We recommend fixing the SSL configuration on your server , but if you need a quick fix you can:%2$s', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/could-not-connect-deliciousbrains-com/', sprintf( '%2$s
', $disable_ssl_url, __( 'Temporarily disable SSL for connections to api.deliciousbrains.com', 'wp-migrate-db' ) ) );
+
+ if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
+ $url_parts = $this->parse_url( $this->dbrains_api_base );
+ $host = $url_parts['host'];
+ if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) || strpos( WP_ACCESSIBLE_HOSTS, $host ) === false ) {
+ $message = sprintf( __( 'We\'ve detected that WP_HTTP_BLOCK_EXTERNAL is enabled and the host %1$s has not been added to WP_ACCESSIBLE_HOSTS. Please disable WP_HTTP_BLOCK_EXTERNAL or add %1$s to WP_ACCESSIBLE_HOSTS to continue. More information .', 'wp-migrate-db' ), esc_attr( $host ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/wp_http_block_external/' );
+ }
+ }
+
+ // Don't cache the license response so we can try again
+ delete_site_transient( 'wpmdb_licence_response' );
+ } elseif ( isset( $errors['subscription_cancelled'] ) ) {
+ $message = sprintf( __( 'Your License Was Cancelled — Please visit My Account to renew or upgrade your license and enable push and pull.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
+ $message .= sprintf( '%s ', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
+ } elseif ( isset( $errors['subscription_expired'] ) ) {
+
+ $message_base = sprintf( '%s — ', __( 'Your License Has Expired', 'wp-migrate-db' ) );
+ $message_end = sprintf( __( 'Login to My Account to renew. ', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
+ $message_end .= sprintf( ' %s ', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
+
+ $contextual_messages = array(
+ 'default' => $message_base . $message_end,
+ 'update' => $message_base . __( 'Updates are only available to those with an active license. ', 'wp-migrate-db' ) . $message_end,
+ 'addons' => $message_base . __( 'Only active licenses can download and install addons. ', 'wp-migrate-db' ) . $message_end,
+ 'support' => $message_base . __( 'Only active licenses can submit support requests. ', 'wp-migrate-db' ) . $message_end,
+ 'licence' => $message_base . __( "All features will continue to work, but you won't be able to receive updates or email support. ", 'wp-migrate-db' ) . $message_end,
+ );
+
+ if ( empty( $context ) ) {
+ $context = 'default';
+ }
+ if ( ! empty( $contextual_messages[ $context ] ) ) {
+ $message = $contextual_messages[ $context ];
+ } elseif ( 'all' === $context ) {
+ $message = $contextual_messages;
+ }
+
+ } elseif ( isset( $errors['no_activations_left'] ) ) {
+ $message = sprintf( __( 'No Activations Left — Please visit My Account to upgrade your license or deactivate a previous activation and enable push and pull.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
+ $message .= sprintf( ' %s ', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
+ } elseif ( isset( $errors['licence_not_found'] ) ) {
+ if ( ! $api_response_provided ) {
+ $message = sprintf( __( 'Your License Was Not Found — Perhaps you made a typo when defining your WPMDB_LICENCE constant in your wp-config.php? Please visit My Account to double check your license key.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
+ $message .= sprintf( ' %s ', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
+ } else {
+ $error = reset( $errors );
+ $message = __( 'Your License Was Not Found — ', 'wp-migrate-db' );
+ $message .= $error;
+ }
+ } elseif ( isset( $errors['activation_deactivated'] ) ) {
+ $message = sprintf( '%s — ', __( 'Your License Is Inactive', 'wp-migrate-db' ) );
+ $message .= sprintf( '%s %s ', __( 'Your license has been deactivated for this install.', 'wp-migrate-db' ), __( 'Reactivate License', 'wp-migrate-db' ) );
+ } else {
+ $error = reset( $errors );
+ $message = sprintf( __( 'An Unexpected Error Occurred — Please contact us at %2$s and quote the following:', 'wp-migrate-db' ), 'mailto:nom@deliciousbrains.com', 'nom@deliciousbrains.com' );
+ $message .= sprintf( '%s
', $error );
+ }
+
+ return $message;
+ }
+
+ function set_cli_migration() {
+ $this->doing_cli_migration = true;
+ }
+
+ /**
+ * @param mixed $return Value to be returned as response.
+ *
+ * @return null
+ */
+ function end_ajax( $return = false ) {
+ $return = apply_filters( 'wpmdb_before_response', $return );
+
+ if ( defined( 'DOING_WPMDB_TESTS' ) || $this->doing_cli_migration ) {
+ // This function should signal the end of the PHP process, but for CLI it carries on so we need to reset our own usage
+ // of the wpmdb_before_response filter before another respond_to_* function adds it again.
+ remove_filter( 'wpmdb_before_response', array( $this, 'scramble' ) );
+
+ return ( false === $return ) ? null : $return;
+ }
+
+ echo ( false === $return ) ? '' : $return;
+ exit;
+ }
+
+ function check_ajax_referer( $action ) {
+ if ( defined( 'DOING_WPMDB_TESTS' ) || $this->doing_cli_migration ) {
+ return;
+ }
+
+ $result = check_ajax_referer( $action, 'nonce', false );
+
+ if ( false === $result ) {
+ $return = array( 'wpmdb_error' => 1, 'body' => sprintf( __( 'Invalid nonce for: %s', 'wp-migrate-db' ), $action ) );
+ $this->end_ajax( json_encode( $return ) );
+ }
+
+ $cap = ( is_multisite() ) ? 'manage_network_options' : 'export';
+ $cap = apply_filters( 'wpmdb_ajax_cap', $cap );
+
+ if ( ! current_user_can( $cap ) ) {
+ $return = array( 'wpmdb_error' => 1, 'body' => sprintf( __( 'Access denied for: %s', 'wp-migrate-db' ), $action ) );
+ $this->end_ajax( json_encode( $return ) );
+ }
+ }
+
+ // Generates our secret key
+ function generate_key( $length = 40 ) {
+ $keyset = 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/';
+ $key = '';
+
+ for ( $i = 0; $i < $length; $i ++ ) {
+ $key .= substr( $keyset, wp_rand( 0, strlen( $keyset ) - 1 ), 1 );
+ }
+
+ return $key;
+ }
+
+ /**
+ * Returns the wpmdb_bottleneck value in bytes
+ *
+ * @param string $type
+ *
+ * @return int
+ */
+ function get_bottleneck( $type = 'regular' ) {
+ $suhosin_limit = false;
+ $suhosin_request_limit = false;
+ $suhosin_post_limit = false;
+
+ if ( function_exists( 'ini_get' ) ) {
+ $suhosin_request_limit = $this->return_bytes( ini_get( 'suhosin.request.max_value_length' ) );
+ $suhosin_post_limit = $this->return_bytes( ini_get( 'suhosin.post.max_value_length' ) );
+ }
+
+ if ( $suhosin_request_limit && $suhosin_post_limit ) {
+ $suhosin_limit = min( $suhosin_request_limit, $suhosin_post_limit );
+ }
+
+ // we have to account for HTTP headers and other bloating, here we minus 1kb for bloat
+ $post_max_upper_size = apply_filters( 'wpmdb_post_max_upper_size', 26214400 );
+
+ $calculated_bottleneck = min( ( $this->get_post_max_size() - 1024 ), $post_max_upper_size );
+
+ if( 0 >= $calculated_bottleneck ) {
+ $calculated_bottleneck = $post_max_upper_size;
+ }
+
+ if ( $suhosin_limit ) {
+ $calculated_bottleneck = min( $calculated_bottleneck, $suhosin_limit - 1024 );
+ }
+
+ if ( $type != 'max' ) {
+ $calculated_bottleneck = min( $calculated_bottleneck, $this->settings['max_request'] );
+ }
+
+ return apply_filters( 'wpmdb_bottleneck', $calculated_bottleneck );
+ }
+
+ function return_bytes( $val ) {
+ if ( is_numeric( $val ) ) {
+ return $val;
+ }
+
+ if ( empty( $val ) ) {
+ return false;
+ }
+
+ $val = trim( $val );
+ $last = strtolower( $val[ strlen( $val ) - 1 ] );
+
+ switch ( $last ) {
+ // The 'G' modifier is available since PHP 5.1.0
+ case 'g':
+ $val *= 1024;
+ case 'm':
+ $val *= 1024;
+ case 'k':
+ $val *= 1024;
+ break;
+ default :
+ $val = false;
+ break;
+ }
+
+ return $val;
+ }
+
+ /**
+ * Returns the php ini value for post_max_size in bytes
+ *
+ * @return int
+ */
+ function get_post_max_size() {
+ $bytes = max( wp_convert_hr_to_bytes( trim( ini_get( 'post_max_size' ) ) ), wp_convert_hr_to_bytes( trim( ini_get( 'hhvm.server.max_post_size' ) ) ) );
+
+ return $bytes;
+ }
+
+ /**
+ * Returns a url string given an associative array as per the output of parse_url.
+ *
+ * @param $parsed_url
+ *
+ * @return string
+ */
+ function unparse_url( $parsed_url ) {
+ $scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] . '://' : '';
+ $host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : '';
+ $port = isset( $parsed_url['port'] ) ? ':' . $parsed_url['port'] : '';
+ $user = isset( $parsed_url['user'] ) ? $parsed_url['user'] : '';
+ $pass = isset( $parsed_url['pass'] ) ? ':' . $parsed_url['pass'] : '';
+ $pass = ( $user || $pass ) ? "$pass@" : '';
+ $path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : '';
+ $query = isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '';
+ $fragment = isset( $parsed_url['fragment'] ) ? '#' . $parsed_url['fragment'] : '';
+
+ return "$scheme$user$pass$host$port$path$query$fragment";
+ }
+
+ /**
+ * Get a simplified url for use as the referrer.
+ *
+ * @param $referer_url
+ *
+ * @return string
+ *
+ * NOTE: mis-spelling intentional to match usage.
+ */
+ function referer_from_url( $referer_url ) {
+ $url_parts = $this->parse_url( $referer_url );
+
+ if ( false !== $url_parts ) {
+ $reduced_url_parts = array_intersect_key( $url_parts, array_flip( array( 'scheme', 'host', 'port', 'path' ) ) );
+ if ( ! empty( $reduced_url_parts ) ) {
+ $referer_url = $this->unparse_url( $reduced_url_parts );
+ }
+ }
+
+ return $referer_url;
+ }
+
+ /**
+ * Get a simplified base url without scheme.
+ *
+ * @param string $url
+ *
+ * @return string
+ */
+ function scheme_less_url( $url ) {
+ $url_parts = $this->parse_url( $url );
+
+ if ( false !== $url_parts ) {
+ $reduced_url_parts = array_intersect_key( $url_parts, array_flip( array( 'host', 'port', 'path', 'user', 'pass' ) ) );
+ if ( ! empty( $reduced_url_parts ) ) {
+ $url = $this->unparse_url( $reduced_url_parts );
+ }
+ }
+
+ return $url;
+ }
+
+ /**
+ * Parses a url into its components. Compatible with PHP < 5.4.7.
+ *
+ * @param $url string The url to parse.
+ *
+ * @return array|false The parsed components or false on error.
+ */
+ function parse_url( $url ) {
+ $url = trim( $url );
+ if ( 0 === strpos( $url, '//' ) ) {
+ $url = 'http:' . $url;
+ $no_scheme = true;
+ } else {
+ $no_scheme = false;
+ }
+
+ $parts = parse_url( $url );
+ if ( $no_scheme ) {
+ unset( $parts['scheme'] );
+ }
+
+ return $parts;
+ }
+
+ /**
+ * Standard notice display check
+ * Returns dismiss and reminder links html for templates where necessary
+ *
+ * @param string $notice The name of the notice e.g. license-key-warning
+ * @param bool $dismiss If the notice has a dismiss link
+ * @param bool|int $reminder If the notice has a reminder link, this will be the number of seconds
+ *
+ * @return array|bool
+ */
+ function check_notice( $notice, $dismiss = false, $reminder = false ) {
+ if ( true === apply_filters( 'wpmdb_hide_' . $notice, false ) ) {
+ return false;
+ }
+ global $current_user;
+ $notice_links = array();
+
+ if ( $dismiss ) {
+ if ( get_user_meta( $current_user->ID, 'wpmdb_dismiss_' . $notice ) ) {
+ return false;
+ }
+ $notice_links['dismiss'] = '' . _x( 'Dismiss', 'dismiss notice permanently', 'wp-migrate-db' ) . ' ';
+ }
+
+ if ( $reminder ) {
+ if ( ( $reminder_set = get_user_meta( $current_user->ID, 'wpmdb_reminder_' . $notice, true ) ) ) {
+ if ( strtotime( 'now' ) < $reminder_set ) {
+ return false;
+ }
+ }
+ $notice_links['reminder'] = '' . __( 'Remind Me Later', 'wp-migrate-db' ) . ' ';
+ }
+
+ return ( count( $notice_links ) > 0 ) ? $notice_links : true;
+ }
+
+ /**
+ * Performs a schema update if required.
+ */
+ function maybe_schema_update() {
+ $schema_version = get_site_option( 'wpmdb_schema_version' );
+ $update_schema = false;
+
+ /*
+ * Upgrade this option to a network wide option if the site has been upgraded
+ * from a regular WordPress installation to a multisite installation.
+ */
+ if ( false === $schema_version && is_multisite() && is_network_admin() ) {
+ $schema_version = get_option( 'wpmdb_schema_version' );
+ if ( false !== $schema_version ) {
+ update_site_option( 'wpmdb_schema_version', $schema_version );
+ delete_option( 'wpmdb_schema_version' );
+ }
+ }
+
+ if ( false === $schema_version ) {
+ $schema_version = 0;
+ }
+
+ if ( $schema_version < 1 ) {
+ $error_log = get_option( 'wpmdb_error_log' );
+ // skip multisite installations as we can't use add_site_option because it doesn't include an 'autoload' argument
+ if ( false !== $error_log && false === is_multisite() ) {
+ delete_option( 'wpmdb_error_log' );
+ add_option( 'wpmdb_error_log', $error_log, '', 'no' );
+ }
+
+ $update_schema = true;
+ $schema_version = 1;
+ }
+
+ if ( true === $update_schema ) {
+ update_site_option( 'wpmdb_schema_version', $schema_version );
+ }
+ }
+
+ /**
+ * Converts file paths that include mixed slashes to use the correct type of slash for the current operating system.
+ *
+ * @param $path string
+ *
+ * @return string
+ */
+ function slash_one_direction( $path ) {
+ return str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $path );
+ }
+
+ /**
+ * Returns the table name where the alter statements are held during the migration.
+ *
+ * @return string
+ */
+ function get_alter_table_name() {
+ static $alter_table_name;
+
+ if ( ! empty( $alter_table_name ) ) {
+ return $alter_table_name;
+ }
+
+ $alter_table_name = apply_filters( 'wpmdb_alter_table_name', $this->temp_prefix . 'wpmdb_alter_statements' );
+
+ return $alter_table_name;
+ }
+
+ /**
+ * Returns the table name where the alter statements are held during the migration (old "wp_" prefixed style).
+ *
+ * @return string
+ */
+ function get_legacy_alter_table_name() {
+ static $alter_table_name;
+
+ if ( ! empty( $alter_table_name ) ) {
+ return $alter_table_name;
+ }
+
+ global $wpdb;
+ $alter_table_name = apply_filters( 'wpmdb_alter_table_name', $wpdb->base_prefix . 'wpmdb_alter_statements' );
+
+ return $alter_table_name;
+ }
+
+ /**
+ * Save the migration state, and replace the current item to be returned if there is an error.
+ *
+ * @param $state mixed
+ * @param $default mixed The default value to return on success, optional defaults to null.
+ *
+ * @return mixed
+ */
+ function save_migration_state( $state, $default = null ) {
+ if ( ! $this->migration_state->set( $state ) ) {
+ $error_msg = __( 'Failed to save migration state. Please contact support.', 'wp-migrate-db' );
+ $default = array( 'wpmdb_error' => 1, 'body' => $error_msg );
+ $this->log_error( $error_msg );
+ }
+
+ return $default;
+ }
+
+ /**
+ * Restore previous migration state and merge in new information or initialize new migration state.
+ *
+ * @param null $id
+ *
+ * @return array|bool|mixed|void
+ */
+ function get_migration_state( $id = null ) {
+ $return = true;
+
+ if ( ! empty( $id ) ) {
+ $this->migration_state = new WPMDB_Migration_State( $id );
+ $state = $this->migration_state->get();
+
+ if ( empty( $state ) || $this->migration_state->id() !== $id ) {
+ $error_msg = __( 'Failed to retrieve migration state. Please contact support.', 'wp-migrate-db' );
+ $return = array( 'wpmdb_error' => 1, 'body' => $error_msg );
+ $this->log_error( $error_msg );
+ $return = $this->end_ajax( json_encode( $return ) );
+ } else {
+ $this->state_data = array_merge( $state, $this->state_data );
+
+ $return = $this->save_migration_state( $this->state_data, $return );
+
+ if ( ! empty( $return['wpmdb_error'] ) ) {
+ $return = $this->end_ajax( json_encode( $return ) );
+ }
+ }
+ } else {
+ $this->migration_state = new WPMDB_Migration_State();
+ }
+
+ return $return;
+ }
+
+ /**
+ * Returns the absolute path to the root of the website.
+ *
+ * @return string
+ */
+ function get_absolute_root_file_path() {
+ static $absolute_path;
+
+ if ( ! empty( $absolute_path ) ) {
+ return $absolute_path;
+ }
+
+ $absolute_path = rtrim( ABSPATH, '\\/' );
+ $site_url = rtrim( site_url( '', 'http' ), '\\/' );
+ $home_url = rtrim( home_url( '', 'http' ), '\\/' );
+
+ if ( $site_url != $home_url ) {
+ $difference = str_replace( $home_url, '', $site_url );
+ if ( strpos( $absolute_path, $difference ) !== false ) {
+ $absolute_path = rtrim( substr( $absolute_path, 0, - strlen( $difference ) ), '\\/' );
+ }
+ }
+
+ return $absolute_path;
+ }
+
+ /**
+ * Returns the function name that called the function using this function.
+ *
+ * @return string
+ */
+ function get_caller_function() {
+ list( , , $caller ) = debug_backtrace( false );
+
+ if ( ! empty( $caller['function'] ) ) {
+ $caller = $caller['function'];
+ } else {
+ $caller = '';
+ }
+
+ return $caller;
+ }
+
+ /**
+ * Scramble string.
+ *
+ * @param mixed $input String to be scrambled.
+ *
+ * @return mixed
+ */
+ function scramble( $input ) {
+ if ( ! empty( $input ) ) {
+ $input = 'WPMDB-SCRAMBLED' . str_rot13( $input );
+ }
+
+ return $input;
+ }
+
+ /**
+ * Unscramble string.
+ *
+ * @param mixed $input String to be unscrambled.
+ *
+ * @return mixed
+ */
+ function unscramble( $input ) {
+ if ( ! empty( $input ) && is_string( $input ) ) {
+ if ( 0 === strpos( $input, 'WPMDB-SCRAMBLED' ) ) {
+ // If the string begins with WPMDB-SCRAMBED we can unscramble.
+ // As the scrambled string could be multiple segments of scrambling (from stow) we remove indicators in one go.
+ $input = str_replace( 'WPMDB-SCRAMBLED', '', $input );
+ $input = str_rot13( $input );
+ } elseif ( false !== strpos( $input, 'WPMDB-SCRAMBLED' ) ) {
+ // Starts with non-scrambled data (error), but with scrambled string following.
+ $pos = strpos( $input, 'WPMDB-SCRAMBLED' );
+ $input = substr( $input, 0, $pos ) . $this->unscramble( substr( $input, $pos ) );
+ }
+ }
+
+ return $input;
+ }
+
+ /**
+ * Returns HTML for setting a checkbox as checked depending on supplied option value.
+ *
+ * @param string|array $option Options value or array containing $option_name as key.
+ * @param string $option_name If $option is an array, the key that contains the value to be checked.
+ */
+ public function maybe_checked( $option, $option_name = '' ) {
+ if ( is_array( $option ) && ! empty( $option_name ) && ! empty( $option[ $option_name ] ) ) {
+ $option = $option[ $option_name ];
+ }
+ echo esc_html( ( ! empty( $option ) && '1' == $option ) ? ' checked="checked"' : '' );
+ }
+
+ /**
+ * Get array of subsite simple urls keyed by their ID.
+ *
+ * @return array
+ */
+ public function subsites_list() {
+ $subsites = array();
+
+ if ( ! is_multisite() ) {
+ return $subsites;
+ }
+
+
+ if ( version_compare( $GLOBALS['wp_version'], '4.6', '>=' ) ) {
+ $sites = get_sites( array( 'number' => false ) );
+ } else {
+ $sites = wp_get_sites( array( 'limit' => 0 ) );
+ }
+
+ if ( ! empty( $sites ) ) {
+ foreach ( (array) $sites as $subsite ) {
+ $subsite = (array) $subsite;
+ $subsites[ $subsite['blog_id'] ] = $this->simple_site_url( get_blogaddress_by_id( $subsite['blog_id'] ) );
+ }
+ }
+
+ return $subsites;
+ }
+
+ /**
+ * Returns uploads info for given subsite or primary site.
+ *
+ * @param int $blog_id Optional, defaults to primary.
+ *
+ * @return array
+ *
+ * NOTE: Must be run from primary site.
+ */
+ public function uploads_info( $blog_id = 0 ) {
+ static $primary_uploads = array();
+
+ if ( ! empty( $blog_id ) && is_multisite() ) {
+ switch_to_blog( $blog_id );
+ }
+
+ $uploads = wp_upload_dir();
+
+ if ( ! empty( $blog_id ) && is_multisite() ) {
+ restore_current_blog();
+
+ if ( empty( $primary_uploads ) ) {
+ $primary_uploads = $this->uploads_info();
+ }
+ $uploads['short_basedir'] = str_replace( trailingslashit( $primary_uploads['basedir'] ), '', trailingslashit( $uploads['basedir'] ) );
+ }
+
+ return $uploads;
+ }
+
+ /**
+ * Get array of subsite info keyed by their ID.
+ *
+ * @return array
+ */
+ public function subsites_info() {
+ $subsites = array();
+
+ if ( ! is_multisite() ) {
+ return $subsites;
+ }
+
+ if ( version_compare( $GLOBALS['wp_version'], '4.6', '>=' ) ) {
+ $sites = get_sites( array( 'number' => false ) );
+ } else {
+ $sites = wp_get_sites( array( 'limit' => 0 ) );
+ }
+
+ if ( ! empty( $sites ) ) {
+ // We to fix up the urls in uploads as they all use primary site's base!
+ $primary_url = site_url();
+
+ foreach ( $sites as $subsite ) {
+ $subsite = (array) $subsite;
+ $subsites[ $subsite['blog_id'] ]['site_url'] = get_site_url( $subsite['blog_id'] );
+ $subsites[ $subsite['blog_id'] ]['home_url'] = get_home_url( $subsite['blog_id'] );
+ $subsites[ $subsite['blog_id'] ]['uploads'] = $this->uploads_info( $subsite['blog_id'] );
+
+ $subsites[ $subsite['blog_id'] ]['uploads']['url'] = substr_replace( $subsites[ $subsite['blog_id'] ]['uploads']['url'], $subsites[ $subsite['blog_id'] ]['site_url'], 0, strlen( $primary_url ) );
+ $subsites[ $subsite['blog_id'] ]['uploads']['baseurl'] = substr_replace( $subsites[ $subsite['blog_id'] ]['uploads']['baseurl'], $subsites[ $subsite['blog_id'] ]['site_url'], 0, strlen( $primary_url ) );
+ }
+ }
+
+ return $subsites;
+ }
+
+ /**
+ * Returns validated and sanitized form data.
+ *
+ * @param array|string $data
+ *
+ * @return array|string
+ *
+ * This is a base implementation that should be overridden and included with a call to parent before validating form_data contents.
+ */
+ function parse_migration_form_data( $data ) {
+ parse_str( $data, $form_data );
+ // As the magic_quotes_gpc setting affects the output of parse_str() we may need to remove any quote escaping.
+ // (it uses the same mechanism that PHP > uses to populate the $_GET, $_POST, etc. variables)
+ if ( get_magic_quotes_gpc() ) {
+ $form_data = WPMDB_Utils::safe_wp_unslash( $form_data );
+ }
+
+ return $form_data;
+ }
+
+ /**
+ * Returns the profile value for a given key.
+ *
+ * @param string $key
+ *
+ * @return mixed
+ */
+ function profile_value( $key ) {
+ if ( ! empty( $key ) && ! empty( $this->form_data ) && isset( $this->form_data[ $key ] ) ) {
+ return $this->form_data[ $key ];
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns a simplified site url (good for identifying subsites).
+ *
+ * @param string $site_url
+ *
+ * @return string
+ */
+ public function simple_site_url( $site_url ) {
+ $site_url = untrailingslashit( $this->scheme_less_url( $site_url ) );
+
+ return $site_url;
+ }
+
+ /**
+ * Checks given subsite id or url to see if it exists and returns its blog id.
+ *
+ * @param int|string $subsite Blog ID or URL
+ * @param array $subsites_list Optional array of blog_id => simple urls to use, defaults to result of subsites_list().
+ *
+ * @return bool|string
+ */
+ public function get_subsite_id( $subsite, $subsites_list = array() ) {
+ if ( ! is_numeric( $subsite ) ) {
+ $subsite = $this->simple_site_url( $subsite );
+ }
+
+ if ( empty( $subsites_list ) ) {
+ $subsites_list = $this->subsites_list();
+ }
+
+ foreach ( $subsites_list as $blog_id => $subsite_path ) {
+ if ( is_numeric( $subsite ) ) {
+ if ( $blog_id == $subsite ) {
+ return $blog_id;
+ }
+ } elseif ( $subsite == $subsite_path ) {
+ return $blog_id;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks given array of subsite ids or urls to see if they exist and returns array of blog ids.
+ *
+ * @param array $subsites
+ * @param array $subsites_list Optional array of blog_id => simple urls to use, defaults to result of subsites_list().
+ *
+ * @return array
+ *
+ * Returned array element values will be false if the given value does not correspond to a subsite.
+ */
+ public function get_subsite_ids( $subsites, $subsites_list = array() ) {
+ if ( empty( $subsites ) ) {
+ return array();
+ }
+
+ if ( ! is_array( $subsites ) ) {
+ $subsites = array( $subsites );
+ }
+
+ foreach ( $subsites as $index => $subsite ) {
+ $subsites[ $index ] = $this->get_subsite_id( $subsite, $subsites_list );
+ }
+
+ return $subsites;
+ }
+
+ /**
+ * Returns an associative array of html escaped useful information about the site.
+ *
+ * @return array
+ */
+ public function site_details() {
+ global $wpdb;
+ $table_prefix = $wpdb->base_prefix;
+ $uploads = wp_upload_dir();
+
+ $site_details = array(
+ 'is_multisite' => esc_html( is_multisite() ? 'true' : 'false' ),
+ 'site_url' => esc_html( addslashes( site_url() ) ),
+ 'home_url' => esc_html( addslashes( home_url() ) ),
+ 'prefix' => esc_html( $table_prefix ),
+ 'uploads_baseurl' => esc_html( addslashes( trailingslashit( $uploads['baseurl'] ) ) ),
+ 'uploads' => $this->uploads_info(),
+ 'uploads_dir' => esc_html( addslashes( $this->get_short_uploads_dir() ) ),
+ 'subsites' => $this->subsites_list(),
+ 'subsites_info' => $this->subsites_info(),
+ );
+
+ return $site_details;
+ }
+
+ /**
+ * Returns an uploads dir without leading path to site.
+ *
+ * @return string
+ */
+ public function get_short_uploads_dir() {
+ $short_path = str_replace( $this->get_absolute_root_file_path(), '', $this->get_upload_info( 'path' ) );
+
+ return trailingslashit( substr( str_replace( '\\', '/', $short_path ), 1 ) );
+ }
+
+ /**
+ * Returns max upload size in bytes, defaults to 25M if no limits set.
+ *
+ * @return int
+ */
+ public function get_max_upload_size() {
+ $bytes = wp_max_upload_size();
+
+ if ( 1 > (int) $bytes ) {
+ $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
+ $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
+
+ // If HHVM bug not returning either value, try its own settings.
+ // If HHVM not involved, will drop through to default value.
+ if ( empty( $p_bytes ) && empty( $u_bytes ) ) {
+ $p_bytes = wp_convert_hr_to_bytes( ini_get( 'hhvm.server.max_post_size' ) );
+ $u_bytes = wp_convert_hr_to_bytes( ini_get( 'hhvm.server.upload.upload_max_file_size' ) );
+
+ $bytes = min( $p_bytes, $u_bytes );
+
+ if ( 0 < (int) $bytes ) {
+ return $bytes;
+ }
+ }
+
+ if ( 0 < (int) $p_bytes ) {
+ $bytes = $p_bytes;
+ } elseif ( 0 < (int) $u_bytes ) {
+ $bytes = $u_bytes;
+ } else {
+ $bytes = wp_convert_hr_to_bytes( '25M' );
+ }
+ }
+
+ return $bytes;
+ }
+}
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-cli.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-cli.php
new file mode 100644
index 0000000..34107b6
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-cli.php
@@ -0,0 +1,702 @@
+php_version_required, '>=' ) ) {
+ return;
+ }
+
+ global $wpmdb;
+ $this->wpmdb = $wpmdb;
+
+ add_filter( 'wpmdb_cli_finalize_migration_response', array( $this, 'finalize_ajax' ), 10, 1 );
+ }
+
+ /**
+ * Checks profile data before CLI migration.
+ *
+ * @param int|array $profile Profile key or array.
+ *
+ * @return mixed|WP_Error
+ */
+ public function pre_cli_migration_check( $profile ) {
+ if ( ! version_compare( PHP_VERSION, $this->php_version_required, '>=' ) ) {
+ return $this->cli_error( sprintf( __( 'CLI addon requires PHP %1$s+', 'wp-migrate-db-cli' ), $this->php_version_required ) );
+ }
+
+ if ( is_array( $profile ) ) {
+ $query_str = http_build_query( $profile );
+ $profile = $this->wpmdb->parse_migration_form_data( $query_str );
+ $profile = wp_parse_args( $profile, array(
+ 'save_computer' => '0',
+ 'gzip_file' => '0',
+ 'replace_guids' => '0',
+ 'exclude_transients' => '0',
+ 'exclude_spam' => '0',
+ 'keep_active_plugins' => '0',
+ 'compatibility_older_mysql' => '0',
+ ) );
+ }
+
+ $this->profile = $profile = apply_filters( 'wpmdb_cli_profile_before_migration', $profile );
+
+ if ( is_wp_error( $profile ) ) {
+ return $profile;
+ }
+
+ return true;
+ }
+
+ /**
+ * Performs CLI migration given a profile data.
+ *
+ * @param int|array $profile Profile key or array.
+ *
+ * @return bool|WP_Error Returns true if succeed or WP_Error if failed.
+ */
+ public function cli_migration( $profile ) {
+ $pre_check = $this->pre_cli_migration_check( $profile );
+ if ( is_wp_error( $pre_check ) ) {
+ return $pre_check;
+ }
+
+ // At this point, $profile has been checked a retrieved into $this->profile, so should not be used in this function any further.
+ if ( empty( $this->profile ) ) {
+ return $this->cli_error( __( 'Profile not found or unable to be generated from params.', 'wp-migrate-db-cli' ) );
+ }
+ unset( $profile );
+
+ $this->set_time_limit();
+ $this->wpmdb->set_cli_migration();
+
+ if ( 'savefile' === $this->profile['action'] ) {
+ $this->post_data['intent'] = 'savefile';
+ if ( ! empty( $this->profile['export_dest'] ) ) {
+ $this->post_data['export_dest'] = $this->profile['export_dest'];
+ } else {
+ $this->post_data['export_dest'] = 'ORIGIN';
+ }
+ }
+
+ if ( 'find_replace' === $this->profile['action'] ) {
+ $this->post_data['intent'] = 'find_replace';
+ }
+
+ // Ensure local site_details available.
+ $this->post_data['site_details']['local'] = $this->site_details();
+
+ // Check for tables specified in migration profile that do not exist in the source database
+ if ( ! empty( $this->profile['select_tables'] ) ) {
+ $source_tables = apply_filters( 'wpmdb_cli_filter_source_tables', $this->get_tables() );
+
+ if ( ! empty( $source_tables ) ) {
+ // Return error if selected tables do not exist in source database
+ $nonexistent_tables = array();
+ foreach ( $this->profile['select_tables'] as $table ) {
+ if ( ! in_array( $table, $source_tables ) ) {
+ $nonexistent_tables[] = $table;
+ }
+ }
+
+ if ( ! empty( $nonexistent_tables ) ) {
+ $local_or_remote = ( 'pull' === $this->profile['action'] ) ? 'remote' : 'local';
+
+ return $this->cli_error( sprintf( __( 'The following table(s) do not exist in the %1$s database: %2$s', 'wp-migrate-db-cli' ), $local_or_remote, implode( ', ', $nonexistent_tables ) ) );
+ }
+ }
+ }
+
+ $this->profile = apply_filters( 'wpmdb_cli_filter_before_cli_initiate_migration', $this->profile );
+ if ( is_wp_error( $this->profile ) ) {
+ return $this->profile;
+ }
+
+ do_action( 'wpmdb_cli_before_migration', $this->post_data, $this->profile );
+ $this->migration = $this->cli_initiate_migration();
+
+ if ( is_wp_error( $this->migration ) ) {
+ return $this->migration;
+ }
+
+ $this->post_data['migration_state_id'] = $this->migration['migration_state_id'];
+
+ $tables_to_process = $this->migrate_tables();
+ if ( is_wp_error( $tables_to_process ) ) {
+ return $tables_to_process;
+ }
+
+ $this->post_data['tables'] = implode( ',', $tables_to_process );
+
+ $finalize = $this->finalize_migration();
+ if ( is_wp_error( $finalize ) || 'savefile' === $this->profile['action'] ) {
+ return $finalize;
+ }
+
+ return true;
+ }
+
+ /**
+ * Verify CLI response from endpoint.
+ *
+ * @param string $response Response from endpoint.
+ * @param string $function_name Name of called function.
+ *
+ * @return WP_Error|string
+ */
+ function verify_cli_response( $response, $function_name ) {
+ $response = trim( $response );
+ if ( false === $response ) {
+ return $this->cli_error( $this->error );
+ }
+
+ if ( false === $this->wpmdb->is_json( $response ) ) {
+ return $this->cli_error( sprintf( __( 'We were expecting a JSON response, instead we received: %2$s (function name: %1$s)', 'wp-migrate-db-cli' ), $function_name, $response ) );
+ }
+
+ $response = json_decode( $response, true );
+ if ( isset( $response['wpmdb_error'] ) ) {
+ return $this->cli_error( $response['body'] );
+ }
+
+ // Display warnings and non fatal error messages as CLI warnings without aborting.
+ if ( isset( $response['wpmdb_warning'] ) || isset( $response['wpmdb_non_fatal_error'] ) ) {
+ $body = ( isset ( $response['cli_body'] ) ) ? $response['cli_body'] : $response['body'];
+ $messages = maybe_unserialize( $body );
+ foreach ( ( array ) $messages as $message ) {
+ if ( $message ) {
+ WP_CLI::warning( self::cleanup_message( $message ) );
+ }
+ }
+ }
+
+ return $response;
+ }
+
+ /**
+ * Return instance of WP_Error.
+ *
+ * @param string $message Error message.
+ *
+ * @return WP_Error.
+ */
+ function cli_error( $message ) {
+ return new WP_Error( 'wpmdb_cli_error', self::cleanup_message( $message ) );
+ }
+
+ /**
+ * Cleanup message, replacing with \n and removing HTML.
+ *
+ * @param string $message Error message.
+ *
+ * @return string $message.
+ */
+ static function cleanup_message( $message ) {
+ $message = html_entity_decode( $message, ENT_QUOTES );
+ $message = preg_replace( '# #', "\n", $message );
+ $message = trim( strip_tags( $message ) );
+
+ return $message;
+ }
+
+ /**
+ * Initiates migration and verifies result
+ *
+ * @return array|WP_Error
+ */
+ function cli_initiate_migration() {
+ do_action( 'wpmdb_cli_before_initiate_migration', $this->profile );
+
+ WP_CLI::log( __( 'Initiating migration...', 'wp-migrate-db-cli' ) );
+
+ $migration_args = $this->post_data;
+ $migration_args['form_data'] = http_build_query( $this->profile );
+ $migration_args['stage'] = 'migrate';
+ $migration_args['site_details']['local'] = $this->site_details();
+
+ if ( 'find_replace' === $this->profile['action'] ) {
+ $migration_args['stage'] = 'find_replace';
+
+ }
+
+ $this->post_data = apply_filters( 'wpmdb_cli_initiate_migration_args', $migration_args, $this->profile );
+
+ $this->post_data['site_details'] = json_encode( $this->post_data['site_details'] );
+
+ $response = $this->initiate_migration( $this->post_data );
+
+ $initiate_migration_response = $this->verify_cli_response( $response, 'initiate_migration()' );
+ if ( ! is_wp_error( $initiate_migration_response ) ) {
+ $initiate_migration_response = apply_filters( 'wpmdb_cli_initiate_migration_response', $initiate_migration_response );
+ }
+
+ return $initiate_migration_response;
+ }
+
+ /**
+ * Determine which tables to migrate
+ *
+ * @return array|WP_Error
+ */
+ function get_tables_to_migrate() {
+ $tables_to_migrate = $this->get_tables( 'prefix' );
+
+ return apply_filters( 'wpmdb_cli_tables_to_migrate', $tables_to_migrate, $this->profile, $this->migration );
+ }
+
+ /**
+ * Returns a WP-CLI progress bar instance
+ *
+ * @param array $tables
+ * @param int $stage
+ *
+ * @return \cli\progress\Bar
+ */
+ function get_progress_bar( $tables, $stage ) {
+
+ $progress_label = __( 'Exporting tables', 'wp-migrate-db-cli' );
+
+ if ( 'find_replace' === $this->profile['action'] ) {
+ $progress_label = __( 'Running find & replace', 'wp-migrate-db-cli' );
+ }
+
+ $progress_label = apply_filters( 'wpmdb_cli_progress_label', $progress_label, $stage, $tables );
+
+ $progress_label = str_pad( $progress_label, 20, ' ' );
+
+ $count = $this->get_total_rows_from_table_list( $tables, $stage );
+
+ return new \cli\progress\Bar( $progress_label, $count );
+ }
+
+ /**
+ * Returns total rows from list of tables
+ *
+ * @param array $tables
+ * @param int $stage
+ *
+ * @return Int
+ */
+ function get_total_rows_from_table_list( $tables, $stage ) {
+ static $cached_results = array();
+
+ if ( isset( $cached_results[ $stage ] ) ) {
+ return $cached_results[ $stage ];
+ }
+
+ $table_rows = $this->get_row_counts_from_table_list( $tables, $stage );
+ $cached_results[ $stage ] = array_sum( array_intersect_key( $table_rows, array_flip( $tables ) ) );
+
+ return $cached_results[ $stage ];
+ }
+
+ /**
+ * Returns row counts from list of tables
+ *
+ * @param array $tables
+ * @param int $stage
+ *
+ * @return mixed
+ */
+ function get_row_counts_from_table_list( $tables, $stage ) {
+ static $cached_results = array();
+
+ if ( isset( $cached_results[ $stage ] ) ) {
+ return $cached_results[ $stage ];
+ }
+
+ $local_table_rows = $this->wpmdb->get_table_row_count();
+ $cached_results[ $stage ] = apply_filters( 'wpmdb_cli_get_row_counts_from_table_list', $local_table_rows, $stage );
+
+ return $cached_results[ $stage ];
+ }
+
+ /**
+ * @return array|mixed|string|void|WP_Error
+ */
+ function migrate_tables() {
+ $tables_to_migrate = $this->get_tables_to_migrate();
+
+ $tables = $tables_to_migrate;
+ $stage_iterator = 2;
+
+ $filtered_vars = apply_filters( 'wpmdb_cli_filter_before_migrate_tables', array(
+ 'tables' => $tables,
+ 'stage_iterator' => $stage_iterator,
+ ) );
+ if ( ! is_array( $filtered_vars ) ) {
+ return $filtered_vars;
+ } else {
+ extract( $filtered_vars, EXTR_OVERWRITE );
+ }
+
+ if ( empty( $tables ) ) {
+ return $this->cli_error( __( 'No tables selected for migration.', 'wp-migrate-db' ) );
+ }
+
+ $table_rows = $this->get_row_counts_from_table_list( $tables, $stage_iterator );
+
+ do_action( 'wpmdb_cli_before_migrate_tables', $this->profile, $this->migration );
+
+ $notify = $this->get_progress_bar( $tables, $stage_iterator );
+ $args = $this->post_data;
+
+ do {
+ $migration_progress = 0;
+
+ foreach ( $tables as $key => $table ) {
+ $current_row = -1;
+ $primary_keys = '';
+ $table_progress = 0;
+ $table_progress_last = 0;
+
+ $args['table'] = $table;
+ $args['last_table'] = ( $key == count( $tables ) - 1 ) ? '1' : '0';
+
+ do {
+ // reset the current chunk
+ $this->wpmdb->empty_current_chunk();
+
+ $args['current_row'] = $current_row;
+ $args['primary_keys'] = $primary_keys;
+ $args = apply_filters( 'wpmdb_cli_migrate_table_args', $args, $this->profile, $this->migration );
+
+ $response = $this->migrate_table( $args );
+
+ $migrate_table_response = $this->verify_cli_response( $response, 'migrate_table()' );
+
+ if ( is_wp_error( $migrate_table_response ) ) {
+ return $migrate_table_response;
+ }
+
+ $migrate_table_response = apply_filters( 'wpmdb_cli_migrate_table_response', $migrate_table_response, $_POST, $this->profile, $this->migration );
+
+ $current_row = $migrate_table_response['current_row'];
+ $primary_keys = $migrate_table_response['primary_keys'];
+
+ $last_migration_progress = $migration_progress;
+
+ if ( -1 == $current_row ) {
+ $migration_progress -= $table_progress;
+ $migration_progress += $table_rows[ $table ];
+ } else {
+ if ( 0 === $table_progress_last ) {
+ $table_progress_last = $current_row;
+ $table_progress = $table_progress_last;
+ $migration_progress += $table_progress_last;
+ } else {
+ $iteration_progress = $current_row - $table_progress_last;
+ $table_progress_last = $current_row;
+ $table_progress += $iteration_progress;
+ $migration_progress += $iteration_progress;
+ }
+ }
+
+ $increment = $migration_progress - $last_migration_progress;
+
+ $notify->tick( $increment );
+
+ } while ( -1 != $current_row );
+ }
+
+ $notify->finish();
+
+ ++$stage_iterator;
+ $args['stage'] = 'migrate';
+ $tables = $tables_to_migrate;
+ $table_rows = $this->get_row_counts_from_table_list( $tables, $stage_iterator );
+
+ if ( $stage_iterator < 3 ) {
+ $notify = $this->get_progress_bar( $tables, $stage_iterator );
+ }
+ } while ( $stage_iterator < 3 );
+
+ $this->post_data = $args;
+
+ return $tables;
+ }
+
+ /**
+ * Finalize migration
+ *
+ * @return bool|WP_Error
+ */
+ function finalize_migration() {
+ do_action( 'wpmdb_cli_before_finalize_migration', $this->profile, $this->migration );
+
+ WP_CLI::log( __( 'Cleaning up...', 'wp-migrate-db-cli' ) );
+
+ $finalize = apply_filters( 'wpmdb_cli_finalize_migration', true, $this->profile, $this->migration );
+ if ( is_wp_error( $finalize ) ) {
+ return $finalize;
+ }
+
+ $this->post_data = apply_filters( 'wpmdb_cli_finalize_migration_args', $this->post_data, $this->profile, $this->migration );
+
+ if ( 'savefile' === $this->post_data['intent'] ) {
+ return $this->finalize_export();
+ }
+
+ $response = null;
+ $response = apply_filters( 'wpmdb_cli_finalize_migration_response', $response );
+ if ( ! empty( $response ) && '1' !== $response ) {
+ return $this->cli_error( $response );
+ }
+
+ do_action( 'wpmdb_cli_after_finalize_migration', $this->profile, $this->migration );
+
+ return true;
+ }
+
+ /**
+ * Stub for ajax_initiate_migration()
+ *
+ * @param array|bool $args
+ *
+ * @return string
+ */
+ function initiate_migration( $args = false ) {
+ $_POST = $args;
+ $response = $this->wpmdb->ajax_initiate_migration();
+
+ return $response;
+ }
+
+ /**
+ * stub for ajax_migrate_table()
+ *
+ * @param array|bool $args
+ *
+ * @return string
+ */
+ function migrate_table( $args = false ) {
+ $_POST = $args;
+ $response = $this->wpmdb->ajax_migrate_table();
+
+ return $response;
+ }
+
+ /**
+ * Stub for ajax_finalize_migration()
+ * hooks on: wpmdb_cli_finalize_migration_response
+ *
+ * @param string $response
+ *
+ * @return string
+ */
+ function finalize_ajax( $response ) {
+ // don't send redundant POST variables
+ $args = $this->filter_post_elements( $this->post_data, array( 'action', 'migration_state_id', 'prefix', 'tables' ) );
+ $_POST = $args;
+ $response = $this->wpmdb->ajax_finalize_migration();
+
+ return trim( $response );
+ }
+
+ /**
+ * Finalize Export by moving file to specified destination
+ *
+ * @return string|error
+ */
+ function finalize_export() {
+ $state_data = $this->wpmdb->state_data;
+ $temp_file = $state_data['dump_path'];
+ if ( 'ORIGIN' === $state_data['export_dest'] ) {
+ $response = $temp_file;
+ } else {
+ $dest_file = $state_data['export_dest'];
+ if ( file_exists( $temp_file ) && rename( $temp_file, $dest_file ) ) {
+ $response = $dest_file;
+ } else {
+ $response = $this->cli_error( __( 'Unable to move exported file.', 'wp-migrate-db' ) );
+ }
+ }
+
+ return $response;
+ }
+ /**
+ * Returns array of CLI options that are unknown to plugin and addons.
+ *
+ * @param array $assoc_args
+ *
+ * @return array
+ */
+ public function get_unknown_args( $assoc_args = array() ) {
+ $unknown_args = array();
+
+ if ( empty( $assoc_args ) ) {
+ return $unknown_args;
+ }
+
+ $known_args = array(
+ 'action',
+ 'export_dest',
+ 'find',
+ 'replace',
+ 'exclude-spam',
+ 'gzip-file',
+ 'exclude-post-revisions',
+ 'skip-replace-guids',
+ 'include-transients',
+ );
+
+ $known_args = apply_filters( 'wpmdb_cli_filter_get_extra_args', $known_args );
+ $unknown_args = array_diff( array_keys( $assoc_args ), $known_args );
+
+ return $unknown_args;
+ }
+
+ /**
+ * Get profile data from CLI args.
+ *
+ * @param array $args
+ * @param array $assoc_args
+ *
+ * @return array|WP_Error
+ */
+ public function get_profile_data_from_args( $args, $assoc_args ) {
+
+ //load correct cli class
+ if ( function_exists( 'wp_migrate_db_pro_cli_addon' ) ) {
+ $wpmdb_cli = wp_migrate_db_pro_cli_addon();
+ } elseif ( function_exists( 'wpmdb_pro_cli' ) ) {
+ $wpmdb_cli = wpmdb_pro_cli();
+ } else {
+ $wpmdb_cli = wpmdb_cli();
+ }
+
+ $unknown_args = $this->get_unknown_args( $assoc_args );
+
+ if ( ! empty( $unknown_args ) ) {
+ $message = __( 'Parameter errors: ', 'wp-migrate-db-cli' );
+ foreach ( $unknown_args as $unknown_arg ) {
+ $message .= "\n " . sprintf( __( 'unknown %s parameter', 'wp-migrate-db-cli' ), '--' . $unknown_arg );
+ }
+
+ if ( is_a( $wpmdb_cli, 'WPMDBPro_CLI' ) ) {
+ $message .= "\n" . __( 'Please make sure that you have activated the appropriate addons for WP Migrate DB Pro.', 'wp-migrate-db-cli' );
+ }
+
+ return $wpmdb_cli->cli_error( $message );
+ }
+
+ if ( empty( $assoc_args['action'] ) ) {
+ return $wpmdb_cli->cli_error( __( 'Missing action parameter', 'wp-migrate-db-cli' ) );
+ }
+
+ if ( 'savefile' === $assoc_args['action'] && ! empty( $assoc_args['export_dest'] ) ) {
+ $export_dest = $assoc_args['export_dest'];
+ }
+
+ $action = $assoc_args['action'];
+
+ // --find= and --replace=
+ $replace_old = array();
+ $replace_new = array();
+ if ( ! empty( $assoc_args['find'] ) ) {
+ $replace_old = str_getcsv( $assoc_args['find'] );
+ } else {
+ if ( 'find_replace' === $assoc_args['action'] ) {
+ return $wpmdb_cli->cli_error( __( 'Missing find and replace values.', 'wp-migrate-db-cli' ) );
+ }
+ }
+ if ( ! empty( $assoc_args['replace'] ) ) {
+ $replace_new = str_getcsv( $assoc_args['replace'] );
+ }
+ if ( count( $replace_old ) !== count( $replace_new ) ) {
+ return $wpmdb_cli->cli_error( sprintf( __( '%1$s and %2$s must contain the same number of values', 'wp-migrate-db-cli' ), '--find', '--replace' ) );
+ }
+ array_unshift( $replace_old, '' );
+ array_unshift( $replace_new, '' );
+
+ // --exclude-spam
+ $exclude_spam = intval( isset( $assoc_args['exclude-spam'] ) );
+
+ // --gzip-file
+ $gzip_file = intval( isset( $assoc_args['gzip-file'] ) );
+
+ $select_post_types = array();
+
+ // --exclude-post-revisions
+ if ( ! empty( $assoc_args['exclude-post-revisions'] ) ) {
+ $select_post_types[] = 'revision';
+ }
+
+ $exclude_post_types = count( $select_post_types ) > 0 ? 1 : 0;
+
+ // --skip-replace-guids
+ $replace_guids = 1;
+ if ( isset( $assoc_args['skip-replace-guids'] ) ) {
+ $replace_guids = 0;
+ }
+
+ $select_tables = array();
+ $table_migrate_option = 'migrate_only_with_prefix';
+
+ // --include-transients.
+ $exclude_transients = intval( ! isset( $assoc_args['include-transients'] ) );
+
+ //cleanup filename for exports
+ if ( ! empty( $export_dest ) ) {
+ if ( $gzip_file ) {
+ if ( 'gz' !== pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
+ if ( 'sql' === pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
+ $export_dest .= '.gz';
+ } else {
+ $export_dest .= '.sql.gz';
+ }
+ }
+ } elseif ( 'sql' !== pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
+ $export_dest = preg_replace( '/(\.sql)?(\.gz)?$/i', '', $export_dest ) . '.sql';
+ }
+
+ // ensure export destination is writable
+ if ( ! @touch( $export_dest ) ) {
+ return $wpmdb_cli->cli_error( sprintf( __( 'Cannot write to file "%1$s". Please ensure that the specified directory exists and is writable.', 'wp-migrate-db-cli' ), $export_dest ) );
+ }
+ }
+
+ $profile = compact( 'action', 'replace_old', 'table_migrate_option', 'replace_new', 'select_tables', 'exclude_post_types', 'select_post_types', 'replace_guids', 'exclude_spam', 'gzip_file', 'exclude_transients', 'export_dest' );
+
+ $profile = apply_filters( 'wpmdb_cli_filter_get_profile_data_from_args', $profile, $args, $assoc_args );
+
+ return $profile;
+ }
+}
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-command.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-command.php
new file mode 100644
index 0000000..ed5cfb9
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-command.php
@@ -0,0 +1,201 @@
+
+ * : A file path to export to. Filename will be modified to end in .sql or
+ * .sql.gz if necessary.
+ *
+ * [--find=]
+ * : A comma separated list of strings to find when performing a string find
+ * and replace across the database.
+ *
+ * Table names should be quoted as needed, i.e. when using a comma in the
+ * find/replace string.
+ *
+ * The --replace= argument should be used in conjunction to specify
+ * the replace values for the strings found using this argument. The number
+ * of strings specified in this argument should match the number passed into
+ * --replace= argument.
+ *
+ * [--replace=]
+ * : A comma separated list of replace value strings to implement when
+ * performing a string find & replace across the database.
+ *
+ * Should be used in conjunction with the --find= argument, see it's
+ * documentation for further explanation of the find & replace functionality.
+ *
+ * [--exclude-post-revisions]
+ * : Exclude post revisions from export.
+ *
+ * [--skip-replace-guids]
+ * : Do not perform a find & replace on the guid column in the wp_posts table.
+ *
+ * [--exclude-spam]
+ * : Exclude spam comments.
+ *
+ * [--gzip-file]
+ * : GZip compress export file.
+ *
+ * [--include-transients]
+ * : Include transients (temporary cached data).
+ *
+ * ## EXAMPLES
+ *
+ * wp migratedb export ./migratedb.sql \
+ * --find=http://dev.bradt.ca,/Users/bradt/home/bradt.ca
+ * --replace=http://bradt.ca,/home/bradt.ca
+ *
+ * @param array $args
+ * @param array $assoc_args
+ */
+ public function export( $args, $assoc_args ) {
+
+ $assoc_args['action'] = 'savefile';
+ $assoc_args['export_dest'] = trim( $args[0] );
+
+ if ( empty( $assoc_args['export_dest'] ) ) {
+ WP_CLI::error( WPMDB_CLI::cleanup_message( __( 'You must provide a destination filename.', 'wp-migrate-db-cli' ) ) );
+ }
+
+ $profile = $this->_get_profile_data_from_args( $args, $assoc_args );
+
+ if ( is_wp_error( $profile ) ) {
+ WP_CLI::error( $profile );
+ }
+
+ $this->_perform_cli_migration( $profile );
+ }
+
+ /**
+ * Run a find/replace on the database.
+ *
+ * ## OPTIONS
+ *
+ * [--find=]
+ * : A comma separated list of strings to find when performing a string find
+ * and replace across the database.
+ *
+ * Table names should be quoted as needed, i.e. when using a comma in the
+ * find/replace string.
+ *
+ * The --replace= argument should be used in conjunction to specify
+ * the replace values for the strings found using this argument. The number
+ * of strings specified in this argument should match the number passed into
+ * --replace= argument.
+ *
+ * [--replace=]
+ * : A comma separated list of replace value strings to implement when
+ * performing a string find & replace across the database.
+ *
+ * Should be used in conjunction with the --find= argument, see it's
+ * documentation for further explanation of the find & replace functionality.
+ *
+ * [--exclude-post-revisions]
+ * : Exclude post revisions from the find & replace.
+ *
+ * [--skip-replace-guids]
+ * : Do not perform a find & replace on the guid column in the wp_posts table.
+ *
+ * [--exclude-spam]
+ * : Exclude spam comments.
+ *
+ * [--include-transients]
+ * : Include transients (temporary cached data).
+ *
+ * ## EXAMPLES
+ *
+ * wp migratedb find-replace
+ * --find=http://dev.bradt.ca,/Users/bradt/home/bradt.ca
+ * --replace=http://bradt.ca,/home/bradt.ca
+ *
+ * @param array $args
+ * @param array $assoc_args
+ *
+ * @subcommand find-replace
+ */
+ public function find_replace( $args, $assoc_args ) {
+
+ $assoc_args['action'] = 'find_replace';
+
+ $profile = $this->_get_profile_data_from_args( $args, $assoc_args );
+
+ if ( is_wp_error( $profile ) ) {
+ WP_CLI::error( $profile );
+ }
+
+ $this->_perform_cli_migration( $profile );
+ }
+
+ /**
+ * Get profile data from CLI args.
+ *
+ * @param array $args
+ * @param array $assoc_args
+ *
+ * @return array|WP_Error
+ */
+ protected function _get_profile_data_from_args( $args, $assoc_args ) {
+ // Load the correct CLI class
+ if ( function_exists( 'wpmdb_pro_cli' ) ) {
+ if ( function_exists( 'wp_migrate_db_pro_cli_addon' ) ) {
+ $wpmdb_cli = wp_migrate_db_pro_cli_addon();
+ } else {
+ $wpmdb_cli = wpmdb_pro_cli();
+ }
+ } else {
+ $wpmdb_cli = wpmdb_cli();
+ }
+
+ return $wpmdb_cli->get_profile_data_from_args( $args, $assoc_args );
+ }
+
+ /**
+ * Perform CLI migration.
+ *
+ * @param mixed $profile Profile key or array
+ *
+ * @return void
+ */
+ protected function _perform_cli_migration( $profile ) {
+ $wpmdb_cli = null;
+
+ //load correct cli class
+ if ( function_exists( 'wpmdb_pro_cli' ) ) {
+ $wpmdb_cli = wpmdb_pro_cli();
+ } else {
+ $wpmdb_cli = wpmdb_cli();
+ }
+
+ if ( empty( $wpmdb_cli ) ) {
+ WP_CLI::error( __( 'WP Migrate DB CLI class not available.', 'wp-migrate-db-cli' ) );
+
+ return;
+ }
+
+ $result = $wpmdb_cli->cli_migration( $profile );
+
+ if ( ! is_wp_error( $result ) ) {
+ $success_msg = sprintf( __( 'Export saved to: %s', 'wp-migrate-db-cli' ), $result );
+
+ if ( 'find_replace' === $profile['action'] ) {
+ $success_msg = __( 'Find & Replace complete', 'wp-migrate-db-cli' );
+ }
+
+ WP_CLI::success( $success_msg );
+ } elseif ( is_wp_error( $result ) ) {
+ WP_CLI::error( WPMDB_CLI::cleanup_message( $result->get_error_message() ) );
+ }
+ }
+
+}
+
+WP_CLI::add_command( 'migratedb', 'WPMDB_Command' );
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-filesystem.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-filesystem.php
new file mode 100644
index 0000000..f570267
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-filesystem.php
@@ -0,0 +1,561 @@
+maybe_init_wp_filesystem();
+ }
+ }
+
+ // Set default permissions
+ if ( defined( 'FS_CHMOD_DIR' ) ) {
+ $this->chmod_dir = FS_CHMOD_DIR;
+ } else {
+ $this->chmod_dir = ( fileperms( ABSPATH ) & 0777 | 0755 );
+ }
+
+ if ( defined( 'FS_CHMOD_FILE' ) ) {
+ $this->chmod_file = FS_CHMOD_FILE;
+ } else {
+ $this->chmod_file = ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 );
+ }
+ }
+
+ /**
+ * Getter for the instantiated WP_Filesystem
+ *
+ * @return WP_Filesystem|false
+ *
+ * This should be used carefully since $wp_filesystem won't always have a value.
+ */
+ public function get_wp_filesystem() {
+ if ( $this->use_filesystem ) {
+ return $this->wp_filesystem;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Is WP_Filesystem being used?
+ *
+ * @return bool
+ */
+ public function using_wp_filesystem() {
+ return $this->use_filesystem;
+ }
+
+ /**
+ * Attempts to use the correct path for the FS method being used
+ *
+ * @param string $abs_path
+ *
+ * @return string
+ */
+ public function get_sanitized_path( $abs_path ) {
+ if ( $this->using_wp_filesystem() ) {
+ return str_replace( ABSPATH, $this->wp_filesystem->abspath(), $abs_path );
+ }
+
+ return $abs_path;
+ }
+
+ /**
+ * Attempt to initiate WP_Filesystem
+ *
+ * If this fails, $use_filesystem is set to false and all methods in this class should use native php fallbacks
+ * Thwarts `request_filesystem_credentials()` attempt to display a form for obtaining creds from users
+ *
+ * TODO: provide notice and input in wp-admin for users when this fails
+ */
+ public function maybe_init_wp_filesystem() {
+ ob_start();
+ $this->credentials = request_filesystem_credentials( '', '', false, false, null );
+ $ob_contents = ob_get_contents();
+ ob_end_clean();
+
+ if ( wp_filesystem( $this->credentials ) ) {
+ global $wp_filesystem;
+ $this->wp_filesystem = $wp_filesystem;
+ $this->use_filesystem = true;
+ }
+ }
+
+ /**
+ * Create file if not exists then set mtime and atime on file
+ *
+ * @param string $abs_path
+ * @param int $time
+ * @param int $atime
+ *
+ * @return bool
+ */
+ public function touch( $abs_path, $time = 0, $atime = 0 ) {
+ if ( 0 == $time ) {
+ $time = time();
+ }
+ if ( 0 == $atime ) {
+ $atime = time();
+ }
+
+ $return = @touch( $abs_path, $time, $atime );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+ $return = $this->wp_filesystem->touch( $abs_path, $time, $atime );
+ }
+
+ return $return;
+ }
+
+ /**
+ * file_put_contents with chmod
+ *
+ * @param string $abs_path
+ * @param string $contents
+ *
+ * @return bool
+ */
+ public function put_contents( $abs_path, $contents ) {
+ $return = @file_put_contents( $abs_path, $contents );
+ $this->chmod( $abs_path );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+ $return = $this->wp_filesystem->put_contents( $abs_path, $contents, $this->chmod_file );
+ }
+
+ return (bool) $return;
+ }
+
+ /**
+ * Does the specified file or dir exist
+ *
+ * @param string $abs_path
+ *
+ * @return bool
+ */
+ public function file_exists( $abs_path ) {
+ $return = file_exists( $abs_path );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+ $return = $this->wp_filesystem->exists( $abs_path );
+ }
+
+ return (bool) $return;
+ }
+
+ /**
+ * Get a file's size
+ *
+ * @param string $abs_path
+ *
+ * @return int
+ */
+ public function filesize( $abs_path ) {
+ $return = filesize( $abs_path );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+ $return = $this->wp_filesystem->size( $abs_path );
+ }
+
+ return $return;
+ }
+
+ /**
+ * Get the contents of a file as a string
+ *
+ * @param string $abs_path
+ *
+ * @return string
+ */
+ public function get_contents( $abs_path ) {
+ $return = @file_get_contents( $abs_path );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+ $return = $this->wp_filesystem->get_contents( $abs_path );
+ }
+
+ return $return;
+ }
+
+ /**
+ * Delete a file
+ *
+ * @param string $abs_path
+ *
+ * @return bool
+ */
+ public function unlink( $abs_path ) {
+ $return = @unlink( $abs_path );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+ $return = $this->wp_filesystem->delete( $abs_path, false, false );
+ }
+
+ return $return;
+ }
+
+ /**
+ * chmod a file
+ *
+ * @param string $abs_path
+ * @param int $perms
+ *
+ * @return bool
+ *
+ * Leave $perms blank to use $this->chmod_file/DIR or pass value like 0777
+ */
+ public function chmod( $abs_path, $perms = null ) {
+ if ( is_null( $perms ) ) {
+ $perms = $this->is_file( $abs_path ) ? $this->chmod_file : $this->chmod_dir;
+ }
+
+ $return = @chmod( $abs_path, $perms );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+ $return = $this->wp_filesystem->chmod( $abs_path, $perms, false );
+ }
+
+ return $return;
+ }
+
+ /**
+ * Is the specified pat a directory?
+ *
+ * @param string $abs_path
+ *
+ * @return bool
+ */
+ public function is_dir( $abs_path ) {
+ $return = is_dir( $abs_path );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+ $return = $this->wp_filesystem->is_dir( $abs_path );
+ }
+
+ return $return;
+ }
+
+ /**
+ * Is the specified path a file?
+ *
+ * @param string $abs_path
+ *
+ * @return bool
+ */
+ public function is_file( $abs_path ) {
+ $return = is_file( $abs_path );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+ $return = $this->wp_filesystem->is_file( $abs_path );
+ }
+
+ return $return;
+ }
+
+ /**
+ * Is the specified path readable
+ *
+ * @param string $abs_path
+ *
+ * @return bool
+ */
+ public function is_readable( $abs_path ) {
+ $return = is_readable( $abs_path );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+ $return = $this->wp_filesystem->is_readable( $abs_path );
+ }
+
+ return $return;
+ }
+
+ /**
+ * Is the specified path writable
+ *
+ * @param string $abs_path
+ *
+ * @return bool
+ */
+ public function is_writable( $abs_path ) {
+ $return = is_writable( $abs_path );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+ $return = $this->wp_filesystem->is_writable( $abs_path );
+ }
+
+ return $return;
+ }
+
+ /**
+ * Recursive mkdir
+ *
+ * @param string $abs_path
+ * @param int $perms
+ *
+ * @return bool
+ */
+ public function mkdir( $abs_path, $perms = null ) {
+ if ( is_null( $perms ) ) {
+ $perms = $this->chmod_dir;
+ }
+
+ if ( $this->is_dir( $abs_path ) ) {
+ $this->chmod( $perms );
+
+ return true;
+ }
+
+ try {
+ $mkdirp = wp_mkdir_p( $abs_path );
+ } catch ( Exception $e ) {
+ $mkdirp = false;
+ }
+
+ if ( $mkdirp ) {
+ $this->chmod( $perms );
+
+ return true;
+ }
+
+ $return = @mkdir( $abs_path, $perms, true );
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+
+ if ( $this->is_dir( $abs_path ) ) {
+ return true;
+ }
+
+ // WP_Filesystem doesn't offer a recursive mkdir()
+ $abs_path = str_replace( '//', '/', $abs_path );
+ $abs_path = rtrim( $abs_path, '/' );
+ if ( empty( $abs_path ) ) {
+ $abs_path = '/';
+ }
+
+ $dirs = explode( '/', ltrim( $abs_path, '/' ) );
+ $current_dir = '';
+
+ foreach ( $dirs as $dir ) {
+ $current_dir .= '/' . $dir;
+ if ( ! $this->is_dir( $current_dir ) ) {
+ $this->wp_filesystem->mkdir( $current_dir, $perms );
+ }
+ }
+
+ $return = $this->is_dir( $abs_path );
+ }
+
+ return $return;
+ }
+
+ /**
+ * Delete a directory
+ *
+ * @param string $abs_path
+ * @param bool $recursive
+ *
+ * @return bool
+ */
+ public function rmdir( $abs_path, $recursive = false ) {
+ if ( ! $this->is_dir( $abs_path ) ) {
+ return false;
+ }
+
+ // taken from WP_Filesystem_Direct
+ if ( ! $recursive ) {
+ $return = @rmdir( $abs_path );
+ } else {
+
+ // At this point it's a folder, and we're in recursive mode
+ $abs_path = trailingslashit( $abs_path );
+ $filelist = $this->scandir( $abs_path );
+
+ $return = true;
+ if ( is_array( $filelist ) ) {
+ foreach ( $filelist as $filename => $fileinfo ) {
+
+ if ( 'd' === $fileinfo['type'] ) {
+ $return = $this->rmdir( $abs_path . $filename, $recursive );
+ } else {
+ $return = $this->unlink( $abs_path . $filename );
+ }
+ }
+ }
+
+ if ( file_exists( $abs_path ) && ! @rmdir( $abs_path ) ) {
+ $return = false;
+ }
+ }
+
+ if ( ! $return && $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+
+ return $this->wp_filesystem->rmdir( $abs_path, $recursive );
+ }
+
+ return $return;
+
+ }
+
+ /**
+ * Get a list of files/folders under specified directory
+ *
+ * @param $abs_path
+ *
+ * @return array|bool
+ */
+ public function scandir( $abs_path ) {
+
+ $dirlist = @scandir( $abs_path );
+ if ( false === $dirlist ) {
+ if ( $this->use_filesystem ) {
+ $abs_path = $this->get_sanitized_path( $abs_path );
+
+ return $this->wp_filesystem->dirlist( $abs_path, true, false );
+ }
+
+ return false;
+ }
+
+ $return = array();
+
+ // normalize return to look somewhat like the return value for WP_Filesystem::dirlist
+ foreach ( $dirlist as $entry ) {
+ if ( '.' === $entry || '..' === $entry ) {
+ continue;
+ }
+ $return[ $entry ] = array(
+ 'name' => $entry,
+ 'type' => $this->is_dir( $abs_path . '/' . $entry ) ? 'd' : 'f',
+ );
+ }
+
+ return $return;
+
+ }
+
+ /**
+ * Light wrapper for move_uploaded_file with chmod
+ *
+ * @param string $file
+ * @param string $destination
+ * @param int $perms
+ *
+ * @return bool
+ *
+ * TODO: look into replicating more functionality from wp_handle_upload()
+ */
+ public function move_uploaded_file( $file, $destination, $perms = null ) {
+ $return = @move_uploaded_file( $file, $destination );
+
+ if ( $return ) {
+ $this->chmod( $destination, $perms );
+ }
+
+ return $return;
+ }
+
+ /**
+ * Copy a file
+ *
+ * @param string $source_abs_path
+ * @param string $destination_abs_path
+ * @param bool $overwrite
+ * @param int $perms
+ *
+ * @return bool
+ *
+ * Taken from WP_Filesystem_Direct
+ */
+ public function copy( $source_abs_path, $destination_abs_path, $overwrite = true, $perms = false ) {
+
+ // error if source file doesn't exist
+ if ( ! $this->file_exists( $source_abs_path ) ) {
+ return false;
+ }
+
+ if ( ! $overwrite && $this->file_exists( $destination_abs_path ) ) {
+ return false;
+ }
+
+ $return = copy( $source_abs_path, $destination_abs_path );
+ if ( $perms && $return ) {
+ $this->chmod( $destination_abs_path, $perms );
+ }
+
+ if ( ! $return && $this->use_filesystem ) {
+ $source_abs_path = $this->get_sanitized_path( $source_abs_path );
+ $destination_abs_path = $this->get_sanitized_path( $destination_abs_path );
+ $return = $this->wp_filesystem->copy( $source_abs_path, $destination_abs_path, $overwrite, $perms );
+ }
+
+ return $return;
+ }
+
+ /**
+ * Move a file
+ *
+ * @param string $source_abs_path
+ * @param string $destination_abs_path
+ * @param bool $overwrite
+ *
+ * @return bool
+ */
+ public function move( $source_abs_path, $destination_abs_path, $overwrite = true ) {
+
+ // error if source file doesn't exist
+ if ( ! $this->file_exists( $source_abs_path ) ) {
+ return false;
+ }
+
+ // Try using rename first. if that fails (for example, source is read only) try copy.
+ // Taken in part from WP_Filesystem_Direct
+ if ( ! $overwrite && $this->file_exists( $destination_abs_path ) ) {
+ return false;
+ } elseif ( @rename( $source_abs_path, $destination_abs_path ) ) {
+ return true;
+ } else {
+ if ( $this->copy( $source_abs_path, $destination_abs_path, $overwrite ) && $this->file_exists( $destination_abs_path ) ) {
+ $this->unlink( $source_abs_path );
+
+ return true;
+ } else {
+ $return = false;
+ }
+ }
+
+ if ( ! $return && $this->use_filesystem ) {
+ $source_abs_path = $this->get_sanitized_path( $source_abs_path );
+ $destination_abs_path = $this->get_sanitized_path( $destination_abs_path );
+
+ $return = $this->wp_filesystem->move( $source_abs_path, $destination_abs_path, $overwrite );
+ }
+
+ return $return;
+ }
+}
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-migration-state.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-migration-state.php
new file mode 100644
index 0000000..68dccc8
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-migration-state.php
@@ -0,0 +1,299 @@
+_option( $id ), false, false );
+
+ if ( false !== $value ) {
+ $this->_id = $id;
+ $this->_value = $value;
+ }
+ }
+ }
+
+ /**
+ * Returns the unique id of the instance.
+ *
+ * @return string
+ */
+ function id() {
+ if ( empty( $this->_id ) ) {
+ $this->_id = uniqid();
+ }
+
+ return $this->_id;
+ }
+
+ /**
+ * Returns the site option string used to save the migration state.
+ *
+ * @param string $id
+ *
+ * @return string
+ */
+ private function _option( $id = null ) {
+ if ( empty( $id ) ) {
+ $id = $this->id();
+ }
+
+ return self::OPTION_PREFIX . $id;
+ }
+
+ /**
+ * Returns the site option string used to save the migration state timeout.
+ *
+ * @param string $id
+ *
+ * @return string
+ */
+ private function _timeout_option( $id = null ) {
+ if ( empty( $id ) ) {
+ $id = $this->id();
+ }
+
+ return self::TIMEOUT_PREFIX . $id;
+ }
+
+ /**
+ * Set the migration state.
+ *
+ * @param $value
+ *
+ * @return bool
+ */
+ function set( $value ) {
+ if ( $this->_update_timeout() && update_site_option( $this->_option(), $value ) ) {
+ return true;
+ }
+
+ // If nothing changed it's still OK.
+ if ( $this->get() === $value ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Updates the companion timeout setting to the current migration state option.
+ *
+ * @return bool
+ */
+ private function _update_timeout() {
+ $value = time() + self::EXPIRATION;
+
+ if ( update_site_option( $this->_timeout_option(), $value ) ) {
+ return true;
+ }
+
+ // If nothing changed it's still OK.
+ if ( get_site_option( $this->_timeout_option(), false, false ) == $value ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the current saved migration state.
+ *
+ * @return mixed
+ */
+ function get() {
+ return get_site_option( $this->_option(), false, false );
+ }
+
+ /**
+ * Deletes the site options for migration state and its companion timeout record.
+ *
+ * @param $id
+ *
+ * @return bool
+ */
+ private static function _delete_id( $id ) {
+ if ( false === get_site_option( self::OPTION_PREFIX . $id, false, false ) || delete_site_option( self::OPTION_PREFIX . $id ) ) {
+ delete_site_option( self::TIMEOUT_PREFIX . $id );
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Delete the current migration state.
+ *
+ * @return bool
+ */
+ function delete() {
+ return $this->_delete_id( $this->id() );
+ }
+
+ /**
+ * Get all migration state ids that have timed out.
+ *
+ * @param int $timeout Optional UNIX timestamp for timeout, default of 0 uses current timestamp.
+ *
+ * @return array
+ */
+ private static function _timed_out_ids( $timeout = 0 ) {
+ global $wpdb;
+
+ $ids = array();
+
+ if ( empty( $timeout ) ) {
+ $timeout = time();
+ }
+
+ if ( is_multisite() ) {
+ $timeout_keys = $wpdb->get_col(
+ $wpdb->prepare(
+ "SELECT meta_key FROM {$wpdb->sitemeta} WHERE site_id = %d AND meta_key like %s AND meta_value < %d",
+ $wpdb->siteid,
+ addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%',
+ $timeout
+ )
+ );
+ } else {
+ $timeout_keys = $wpdb->get_col(
+ $wpdb->prepare(
+ "SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s and option_value < %d",
+ addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%',
+ $timeout
+ )
+ );
+ }
+
+ if ( ! empty( $timeout_keys ) ) {
+ $id_start = strlen( self::TIMEOUT_PREFIX );
+
+ foreach ( $timeout_keys as $timeout_key ) {
+ $ids[] = substr( $timeout_key, $id_start );
+ }
+ }
+
+ return $ids;
+ }
+
+ /**
+ * Get all migration state ids that have no time out companion.
+ *
+ * @return array
+ */
+ private static function _orphaned_ids() {
+ global $wpdb;
+
+ $ids = array();
+
+ if ( is_multisite() ) {
+ $keys = $wpdb->get_col(
+ $wpdb->prepare( "
+ SELECT meta_key
+ FROM {$wpdb->sitemeta}
+ WHERE site_id = %d
+ AND meta_key LIKE %s
+ AND meta_key NOT LIKE %s
+ AND meta_key NOT IN (
+ SELECT CONCAT(%s, SUBSTR(meta_key, %d))
+ FROM {$wpdb->sitemeta}
+ WHERE site_id = %d
+ AND meta_key LIKE %s
+ )
+ ",
+ $wpdb->siteid,
+ addcslashes( self::OPTION_PREFIX, '_' ) . '%',
+ addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%',
+ self::OPTION_PREFIX,
+ strlen( self::TIMEOUT_PREFIX ) + 1,
+ $wpdb->siteid,
+ addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%'
+ )
+ );
+ } else {
+ $keys = $wpdb->get_col(
+ $wpdb->prepare( "
+ SELECT option_name
+ FROM $wpdb->options
+ WHERE option_name LIKE %s
+ AND option_name NOT LIKE %s
+ AND option_name NOT IN (
+ SELECT CONCAT(%s, SUBSTR(option_name, %d))
+ FROM $wpdb->options
+ WHERE option_name LIKE %s
+ )
+ ",
+ addcslashes( self::OPTION_PREFIX, '_' ) . '%',
+ addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%',
+ self::OPTION_PREFIX,
+ strlen( self::TIMEOUT_PREFIX ) + 1,
+ addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%'
+ )
+ );
+ }
+
+ if ( ! empty( $keys ) ) {
+ $id_start = strlen( self::OPTION_PREFIX );
+
+ foreach ( $keys as $key ) {
+ $ids[] = substr( $key, $id_start );
+ }
+ }
+
+ return $ids;
+ }
+
+ /**
+ * returns count of all migration state records that have timed out.
+ *
+ * @param int $timeout Optional UNIX timestamp for timeout, default of 0 uses current timestamp.
+ *
+ * @return int
+ */
+ static function cleanup_count( $timeout = 0 ) {
+ return count( self::_timed_out_ids( $timeout ) ) + count( self::_orphaned_ids() );
+ }
+
+ /**
+ * Remove all migration state records that have timed out or are orphaned from their timeout companion.
+ *
+ * @param int $timeout Optional UNIX timestamp for timeout, default of 0 uses current timestamp.
+ *
+ * @return int Count of successfully cleaned up options.
+ */
+ static function cleanup( $timeout = 0 ) {
+ $count = 0;
+
+ $timed_out_ids = self::_timed_out_ids( $timeout );
+
+ if ( ! empty( $timed_out_ids ) ) {
+ foreach ( $timed_out_ids as $id ) {
+ if ( self::_delete_id( $id ) ) {
+ $count ++;
+ }
+ }
+ }
+
+ $orphaned_ids = self::_orphaned_ids();
+
+ if ( ! empty( $orphaned_ids ) ) {
+ foreach ( $orphaned_ids as $id ) {
+ if ( self::_delete_id( $id ) ) {
+ $count ++;
+ }
+ }
+ }
+
+ return $count;
+ }
+}
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-replace.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-replace.php
new file mode 100644
index 0000000..9eff3cf
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-replace.php
@@ -0,0 +1,365 @@
+table = $args['table'];
+ $this->search = $args['search'];
+ $this->replace = $args['replace'];
+ $this->intent = $args['intent'];
+ $this->base_domain = $args['base_domain'];
+ $this->site_domain = $args['site_domain'];
+ $this->wpmdb = $args['wpmdb'];
+ $this->site_details = $args['site_details'];
+
+ // Detect a protocol mismatch between the remote and local sites involved in the migration
+ $this->detect_protocol_mismatch();
+ }
+
+ /**
+ * Determine whether to apply a subdomain replace over each value in the database.
+ *
+ * @return bool
+ */
+ function is_subdomain_replaces_on() {
+ if ( ! isset( $this->subdomain_replaces_on ) ) {
+ $this->subdomain_replaces_on = ( is_multisite() && is_subdomain_install() && ! $this->has_same_base_domain() && apply_filters( 'wpmdb_subdomain_replace', true ) );
+ }
+
+ return $this->subdomain_replaces_on;
+ }
+
+
+ /**
+ * Determine if the replacement has the same base domain as the search. Produces doubled replacement strings
+ * otherwise.
+ *
+ * @return bool
+ */
+ function has_same_base_domain() {
+ $destination_url = isset( $this->destination_url ) ? $this->destination_url : $this->site_details['local']['site_url'];
+ if ( stripos( $destination_url, $this->site_domain ) ) {
+ return true;
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Automatically replace URLs for subdomain based multisite installations
+ * e.g. //site1.example.com -> //site1.example.local for site with domain example.com
+ * NB: only handles the current network site, does not work for additional networks / mapped domains
+ *
+ * @param $new
+ *
+ * @return mixed
+ */
+ function subdomain_replaces( $new ) {
+ if ( empty( $this->base_domain ) ) {
+ return $new;
+ }
+
+ $pattern = '|//(.*?)\\.' . preg_quote( $this->site_domain, '|' ) . '|';
+ $replacement = '//$1.' . trim( $this->base_domain );
+ $new = preg_replace( $pattern, $replacement, $new );
+
+ return $new;
+ }
+
+ /**
+ * Detect a protocol mismatch between the remote and local sites involved in the migration
+ *
+ * @return bool
+ */
+ function detect_protocol_mismatch() {
+ if ( ! isset( $this->site_details['remote'] ) ) {
+ return false;
+ }
+
+ /**
+ * Filters the site_urls used to check if there is a protocol mismatch.
+ *
+ * @param array
+ */
+ $wpmdb_home_urls = apply_filters( 'wpmdb_replace_site_urls', array(
+ // TODO: rewrite unit tests that only pass site_url so that we can rely on home_url's existence
+ 'local' => isset( $this->site_details['local']['home_url'] ) ? $this->site_details['local']['home_url'] : $this->site_details['local']['site_url'],
+ 'remote' => isset( $this->site_details['remote']['home_url'] ) ? $this->site_details['remote']['home_url'] : $this->site_details['remote']['site_url'],
+ )
+ );
+
+ $local_url_is_https = false === stripos( $wpmdb_home_urls['local'], 'https' ) ? false : true;
+ $remote_url_is_https = false === stripos( $wpmdb_home_urls['remote'], 'https' ) ? false : true;
+ $local_protocol = $local_url_is_https ? 'https' : 'http';
+ $remote_protocol = $remote_url_is_https ? 'https' : 'http';
+
+ if ( ( $local_url_is_https && ! $remote_url_is_https ) || ( ! $local_url_is_https && $remote_url_is_https ) ) {
+ $this->is_protocol_mismatch = true;
+ }
+
+ if ( 'push' === $this->intent ) {
+ $this->destination_protocol = $remote_protocol;
+ $this->source_protocol = $local_protocol;
+ $this->destination_url = $wpmdb_home_urls['remote'];
+ } else {
+ $this->destination_protocol = $local_protocol;
+ $this->source_protocol = $remote_protocol;
+ $this->destination_url = $wpmdb_home_urls['local'];
+ }
+
+ return $this->is_protocol_mismatch;
+ }
+
+ /**
+ *
+ * Handles replacing the protocol if the local and destination don't have matching protocols (http > https and
+ * vice-versa).
+ *
+ * Can be filtered to disable entirely.
+ *
+ * @param $new
+ *
+ * @return mixed
+ */
+ function do_protocol_replace( $new ) {
+ /**
+ * Filters $do_protocol_replace, return false to prevent protocol replacement.
+ *
+ * @param bool true If the replace should be skipped.
+ * @param string $this->destination_url The URL of the target site.
+ */
+ $do_protocol_replace = apply_filters( 'wpmdb_replace_destination_protocol', true, $this->destination_url );
+
+ if ( true !== $do_protocol_replace ) {
+ return $new;
+ }
+
+ $parsed_destination = wp_parse_url( $this->destination_url );
+ unset( $parsed_destination['scheme'] );
+
+ $protocol_search = $this->source_protocol . '://' . implode( '', $parsed_destination );
+ $protocol_replace = $this->destination_url;
+ $new = str_ireplace( $protocol_search, $protocol_replace, $new, $count );
+
+ return $new;
+ }
+
+ /**
+ * Applies find/replace pairs to a given string.
+ *
+ * @param string $subject
+ *
+ * @return string
+ */
+ function apply_replaces( $subject ) {
+ $new = str_ireplace( $this->search, $this->replace, $subject, $count );
+ if ( $this->is_subdomain_replaces_on() ) {
+ $new = $this->subdomain_replaces( $new );
+ }
+
+ if ( true === $this->is_protocol_mismatch ) {
+ $new = $this->do_protocol_replace( $new );
+ }
+
+ return $new;
+ }
+
+ /**
+ * Take a serialized array and unserialize it replacing elements as needed and
+ * unserialising any subordinate arrays and performing the replace on those too.
+ *
+ * Mostly from https://github.com/interconnectit/Search-Replace-DB
+ *
+ * @param mixed $data Used to pass any subordinate arrays back to in.
+ * @param bool $serialized Does the array passed via $data need serialising.
+ * @param bool $parent_serialized Passes whether the original data passed in was serialized
+ * @param bool $filtered Should we apply before and after filters successively
+ *
+ * @return mixed The original array with all elements replaced as needed.
+ */
+ function recursive_unserialize_replace( $data, $serialized = false, $parent_serialized = false, $filtered = true ) {
+ $pre = apply_filters( 'wpmdb_pre_recursive_unserialize_replace', false, $data, $this );
+ if ( false !== $pre ) {
+ return $pre;
+ }
+
+ $is_json = false;
+ $before_fired = false;
+ $successive_filter = $filtered;
+
+ if ( true === $filtered ) {
+ list( $data, $before_fired, $successive_filter ) = apply_filters( 'wpmdb_before_replace_custom_data', array( $data, $before_fired, $successive_filter ), $this );
+ }
+
+ // some unserialized data cannot be re-serialized eg. SimpleXMLElements
+ try {
+ if ( is_string( $data ) && ( $unserialized = WPMDB_Utils::unserialize( $data, __METHOD__ ) ) !== false ) {
+ // PHP currently has a bug that doesn't allow you to clone the DateInterval / DatePeriod classes.
+ // We skip them here as they probably won't need data to be replaced anyway
+ if ( is_object( $unserialized ) ) {
+ if ( $unserialized instanceof DateInterval || $unserialized instanceof DatePeriod ) {
+ return $data;
+ }
+ }
+ $data = $this->recursive_unserialize_replace( $unserialized, true, true, $successive_filter );
+ } elseif ( is_array( $data ) ) {
+ $_tmp = array();
+ foreach ( $data as $key => $value ) {
+ $_tmp[ $key ] = $this->recursive_unserialize_replace( $value, false, $parent_serialized, $successive_filter );
+ }
+
+ $data = $_tmp;
+ unset( $_tmp );
+ } elseif ( is_object( $data ) ) { // Submitted by Tina Matter
+ $_tmp = clone $data;
+ foreach ( $data as $key => $value ) {
+ // Integer properties are crazy and the best thing we can do is to just ignore them.
+ // see http://stackoverflow.com/a/10333200 and https://github.com/deliciousbrains/wp-migrate-db-pro/issues/853
+ if ( is_int( $key ) ) {
+ continue;
+ }
+ $_tmp->$key = $this->recursive_unserialize_replace( $value, false, $parent_serialized, $successive_filter );
+ }
+
+ $data = $_tmp;
+ unset( $_tmp );
+ } elseif ( $this->wpmdb->is_json( $data, true ) ) {
+ $_tmp = array();
+ $data = json_decode( $data, true );
+
+ foreach ( $data as $key => $value ) {
+ $_tmp[ $key ] = $this->recursive_unserialize_replace( $value, false, $parent_serialized, $successive_filter );
+ }
+
+ $data = $_tmp;
+ unset( $_tmp );
+ $is_json = true;
+ } elseif ( is_string( $data ) ) {
+ list( $data, $do_replace ) = apply_filters( 'wpmdb_replace_custom_data', array( $data, true ), $this );
+
+ if ( $do_replace ) {
+ $data = $this->apply_replaces( $data );
+ }
+ }
+
+ if ( $is_json ) {
+ $data = json_encode( $data );
+ }
+
+ if ( $serialized ) {
+ $data = serialize( $data );
+ }
+ } catch ( Exception $error ) {
+ $error_msg = __( 'Failed attempting to do the recursive unserialize replace. Please contact support.', 'wp-migrate-db' );
+ $error_details = $error->getMessage() . "\n\n";
+ $error_details .= var_export( $data, true );
+ $this->wpmdb->log_error( $error_msg, $error_details );
+ }
+
+ if ( true === $filtered ) {
+ $data = apply_filters( 'wpmdb_after_replace_custom_data', $data, $before_fired, $this );
+ }
+
+ return $data;
+ }
+
+ /**
+ * Getter for the $table class property.
+ *
+ * @return string Name of the table currently being processed in the migration.
+ */
+ public function get_table() {
+ return $this->table;
+ }
+
+ /**
+ * Getter for the $column class property.
+ *
+ * @return string Name of the column currently being processed in the migration.
+ */
+ public function get_column() {
+ return $this->column;
+ }
+
+ /**
+ * Getter for the $row class property.
+ *
+ * @return string Name of the row currently being processed in the migration.
+ */
+ public function get_row() {
+ return $this->row;
+ }
+
+ /**
+ * Setter for the $column class property.
+ *
+ * @param string $column Name of the column currently being processed in the migration.
+ */
+ public function set_column( $column ) {
+ $this->column = $column;
+ }
+
+ /**
+ * Setter for the $row class property.
+ *
+ * @param string $row Name of the row currently being processed in the migration.
+ */
+ public function set_row( $row ) {
+ $this->row = $row;
+ }
+
+ /**
+ * Multsite safe way of comparing the table currently being processed in the migration against a desired table.
+ *
+ * The table prefix should be omitted, example:
+ *
+ * $is_posts = $this->table_is( 'posts' );
+ *
+ * @param string $desired_table Name of the desired table, table prefix omitted.
+ *
+ * @return boolean Whether or not the desired table is the table currently being processed.
+ */
+ public function table_is( $desired_table ) {
+ return $this->wpmdb->table_is( $desired_table, $this->table );
+ }
+
+ /**
+ * Intent of the current replace migration.
+ *
+ * Helpful for hookers who need to know what intent they are working on.
+ *
+ * @return string Intent of the current migration
+ */
+ public function get_intent() {
+ return $this->intent;
+ }
+}
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-sanitize.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-sanitize.php
new file mode 100644
index 0000000..d5fe289
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-sanitize.php
@@ -0,0 +1,171 @@
+ $value ) {
+ // If a key does not have a rule it's not ours and can be removed.
+ // We should not fail if there is extra data as plugins like Polylang add their own data to each ajax request.
+ if ( ! array_key_exists( $key, $key_rules ) ) {
+ unset( $data[ $key ] );
+ continue;
+ }
+ $data[ $key ] = WPMDB_Sanitize::_sanitize_data( $value, $key_rules[ $key ], $context, ( $recursion_level + 1 ) );
+ }
+ } elseif ( is_array( $key_rules ) ) {
+ foreach ( $key_rules as $rule ) {
+ $data = WPMDB_Sanitize::_sanitize_data( $data, $rule, $context, ( $recursion_level + 1 ) );
+ }
+ } else {
+ // Neither $data or $key_rules are a first level array so can be analysed.
+ if ( 'array' == $key_rules ) {
+ if ( ! is_array( $data ) ) {
+ wp_die( sprintf( __( '%1$s was expecting an array but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ } elseif ( 'string' == $key_rules ) {
+ if ( ! is_string( $data ) ) {
+ wp_die( sprintf( __( '%1$s was expecting a string but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ } elseif ( 'key' == $key_rules ) {
+ $key_name = sanitize_key( $data );
+ if ( $key_name !== $data ) {
+ wp_die( sprintf( __( '%1$s was expecting a valid key but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ $data = $key_name;
+ } elseif ( 'text' == $key_rules ) {
+ $text = sanitize_text_field( $data );
+ if ( $text !== $data ) {
+ wp_die( sprintf( __( '%1$s was expecting text but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ $data = $text;
+ } elseif ( 'serialized' == $key_rules ) {
+ if ( ! is_string( $data ) || ! is_serialized( $data ) ) {
+ wp_die( sprintf( __( '%1$s was expecting serialized data but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ } elseif ( 'json_array' == $key_rules ) {
+ if ( ! is_string( $data ) || ! WPMDB::is_json( $data ) ) {
+ wp_die( sprintf( __( '%1$s was expecting JSON data but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ $data = json_decode( $data, true );
+ } elseif ( 'json' == $key_rules ) {
+ if ( ! is_string( $data ) || ! WPMDB::is_json( $data ) ) {
+ wp_die( sprintf( __( '%1$s was expecting JSON data but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ } elseif ( 'numeric' == $key_rules ) {
+ if ( ! is_numeric( $data ) ) {
+ wp_die( sprintf( __( '%1$s was expecting a valid numeric but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ } elseif ( 'int' == $key_rules ) {
+ // As we are sanitizing form data, even integers are within a string.
+ if ( ! is_numeric( $data ) || (int) $data != $data ) {
+ wp_die( sprintf( __( '%1$s was expecting an integer but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ $data = (int) $data;
+ } elseif ( 'positive_int' == $key_rules ) {
+ if ( ! is_numeric( $data ) || (int) $data != $data || 0 > $data ) {
+ wp_die( sprintf( __( '%1$s was expecting a positive number (int) but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ $data = floor( $data );
+ } elseif ( 'negative_int' == $key_rules ) {
+ if ( ! is_numeric( $data ) || (int) $data != $data || 0 < $data ) {
+ wp_die( sprintf( __( '%1$s was expecting a negative number (int) but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ $data = ceil( $data );
+ } elseif ( 'zero_int' == $key_rules ) {
+ if ( ! is_numeric( $data ) || (int) $data != $data || 0 !== $data ) {
+ wp_die( sprintf( __( '%1$s was expecting 0 (int) but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ $data = 0;
+ } elseif ( 'empty' == $key_rules ) {
+ if ( ! empty( $data ) ) {
+ wp_die( sprintf( __( '%1$s was expecting an empty value but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ } elseif ( 'url' == $key_rules ) {
+ $url = esc_url_raw( $data );
+ if ( empty( $url ) ) {
+ wp_die( sprintf( __( '%1$s was expecting a URL but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ $data = $url;
+ } elseif ( 'bool' == $key_rules ) {
+ $bool = sanitize_key( $data );
+ if ( empty( $bool ) || ! in_array( $bool, array( 'true', 'false' ) ) ) {
+ wp_die( sprintf( __( '%1$s was expecting a bool but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
+
+ return false;
+ }
+ $data = $bool;
+ } else {
+ wp_die( sprintf( __( 'Unknown sanitization rule "%1$s" supplied by %2$s', 'wp-db-migrate-pro' ), $key_rules, $context ) );
+
+ return false;
+ }
+ }
+
+ return $data;
+ }
+}
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-utils.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-utils.php
new file mode 100644
index 0000000..ed0fc1a
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb-utils.php
@@ -0,0 +1,105 @@
+id ) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Checks if another version of WPMDB(Pro) is active and deactivates it.
+ * To be hooked on `activated_plugin` so other plugin is deactivated when current plugin is activated.
+ *
+ * @param string $plugin
+ *
+ */
+ public static function deactivate_other_instances( $plugin ) {
+ if ( ! in_array( basename( $plugin ), array( 'wp-migrate-db-pro.php', 'wp-migrate-db.php' ) ) ) {
+ return;
+ }
+
+ $plugin_to_deactivate = 'wp-migrate-db.php';
+ $deactivated_notice_id = '1';
+ if ( basename( $plugin ) == $plugin_to_deactivate ) {
+ $plugin_to_deactivate = 'wp-migrate-db-pro.php';
+ $deactivated_notice_id = '2';
+ }
+
+ if ( is_multisite() ) {
+ $active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
+ $active_plugins = array_keys( $active_plugins );
+ } else {
+ $active_plugins = (array) get_option( 'active_plugins', array() );
+ }
+
+ foreach ( $active_plugins as $basename ) {
+ if ( false !== strpos( $basename, $plugin_to_deactivate ) ) {
+ set_transient( 'wp_migrate_db_deactivated_notice_id', $deactivated_notice_id, 1 * HOUR_IN_SECONDS );
+ deactivate_plugins( $basename );
+
+ return;
+ }
+ }
+ }
+
+ /**
+ * Return unserialized object or array
+ *
+ * @param string $serialized_string Serialized string.
+ * @param string $method The name of the caller method.
+ *
+ * @return mixed, false on failure
+ */
+ public static function unserialize( $serialized_string, $method = '' ) {
+ if ( ! is_serialized( $serialized_string ) ) {
+ return false;
+ }
+
+ $serialized_string = trim( $serialized_string );
+ $unserialized_string = @unserialize( $serialized_string );
+
+ if ( false === $unserialized_string && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
+ $scope = $method ? sprintf( __( 'Scope: %s().', 'wp-migrate-db' ), $method ) : false;
+ $error = sprintf( __( 'WPMDB Error: Data cannot be unserialized. %s', 'wp-migrate-db' ), $scope );
+ error_log( $error );
+ }
+
+ return $unserialized_string;
+ }
+
+ /**
+ * Use wp_unslash if available, otherwise fall back to stripslashes_deep
+ *
+ * @param string|array $arg
+ *
+ * @return string|array
+ */
+ public static function safe_wp_unslash( $arg ){
+ if ( function_exists( 'wp_unslash' ) ) {
+ return wp_unslash( $arg );
+ } else {
+ return stripslashes_deep( $arg );
+ }
+ }
+
+}
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb.php
new file mode 100644
index 0000000..e6d7fd6
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdb.php
@@ -0,0 +1,3692 @@
+plugin_version = $GLOBALS['wpmdb_meta'][ $this->core_slug ]['version'];
+
+ $this->max_insert_string_len = 50000; // 50000 is the default as defined by PhpMyAdmin
+
+ add_filter( 'plugin_action_links_' . $this->plugin_basename, array( $this, 'plugin_action_links' ) );
+ add_filter( 'network_admin_plugin_action_links_' . $this->plugin_basename, array( $this, 'plugin_action_links' ) );
+
+ // internal AJAX handlers
+ add_action( 'wp_ajax_wpmdb_delete_migration_profile', array( $this, 'ajax_delete_migration_profile' ) );
+ add_action( 'wp_ajax_wpmdb_save_profile', array( $this, 'ajax_save_profile' ) );
+ add_action( 'wp_ajax_wpmdb_save_setting', array( $this, 'ajax_save_setting' ) );
+ add_action( 'wp_ajax_wpmdb_initiate_migration', array( $this, 'ajax_initiate_migration' ) );
+ add_action( 'wp_ajax_wpmdb_migrate_table', array( $this, 'ajax_migrate_table' ) );
+ add_action( 'wp_ajax_wpmdb_clear_log', array( $this, 'ajax_clear_log' ) );
+ add_action( 'wp_ajax_wpmdb_get_log', array( $this, 'ajax_get_log' ) );
+ add_action( 'wp_ajax_wpmdb_plugin_compatibility', array( $this, 'ajax_plugin_compatibility' ) );
+ add_action( 'wp_ajax_wpmdb_blacklist_plugins', array( $this, 'ajax_blacklist_plugins' ) );
+ add_action( 'wp_ajax_wpmdb_update_max_request_size', array( $this, 'ajax_update_max_request_size' ) );
+ add_action( 'wp_ajax_wpmdb_update_delay_between_requests', array( $this, 'ajax_update_delay_between_requests' ) );
+ add_action( 'wp_ajax_wpmdb_cancel_migration', array( $this, 'ajax_cancel_migration' ) );
+ add_action( 'wp_ajax_wpmdb_finalize_migration', array( $this, 'ajax_finalize_migration' ) );
+ add_action( 'wp_ajax_wpmdb_flush', array( $this, 'ajax_flush' ) );
+ add_action( 'wp_ajax_nopriv_wpmdb_flush', array( $this, 'ajax_nopriv_flush', ) );
+
+ $this->accepted_fields = array(
+ 'action',
+ 'save_computer',
+ 'gzip_file',
+ 'connection_info',
+ 'replace_old',
+ 'replace_new',
+ 'table_migrate_option',
+ 'select_tables',
+ 'replace_guids',
+ 'exclude_spam',
+ 'save_migration_profile',
+ 'save_migration_profile_option',
+ 'create_new_profile',
+ 'create_backup',
+ 'remove_backup',
+ 'keep_active_plugins',
+ 'select_post_types',
+ 'backup_option',
+ 'select_backup',
+ 'exclude_transients',
+ 'exclude_post_types',
+ 'exclude_post_revisions',
+ 'compatibility_older_mysql',
+ 'export_dest',
+ );
+
+ $this->default_profile = array(
+ 'action' => 'savefile',
+ 'save_computer' => '1',
+ 'gzip_file' => '1',
+ 'table_migrate_option' => 'migrate_only_with_prefix',
+ 'replace_guids' => '1',
+ 'default_profile' => true,
+ 'name' => '',
+ 'select_tables' => array(),
+ 'select_post_types' => array(),
+ 'backup_option' => 'backup_only_with_prefix',
+ 'exclude_transients' => '1',
+ 'compatibility_older_mysql' => '1',
+ );
+
+ $this->checkbox_options = array(
+ 'save_computer' => '0',
+ 'gzip_file' => '0',
+ 'replace_guids' => '0',
+ 'exclude_spam' => '0',
+ 'keep_active_plugins' => '0',
+ 'create_backup' => '0',
+ 'exclude_post_types' => '0',
+ 'exclude_transients' => '0',
+ 'compatibility_older_mysql' => '0',
+ );
+
+ $this->plugin_tabs = array(
+ '' . esc_html( _x( 'Migrate', 'Configure a migration or export', 'wp-migrate-db' ) ) . ' ',
+ '' . esc_html( _x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) ) . ' ',
+ '' . esc_html( _x( 'Addons', 'Plugin extensions', 'wp-migrate-db' ) ) . ' ',
+ '' . esc_html( _x( 'Help', 'Get help or contact support', 'wp-migrate-db' ) ) . ' ',
+ );
+
+ // display a notice when either WP Migrate DB or WP Migrate DB Pro is automatically deactivated
+ add_action( 'pre_current_active_plugins', array( $this, 'plugin_deactivated_notice' ) );
+
+ // check if WP Engine is filtering the buffer and prevent it
+ add_action( 'plugins_loaded', array( $this, 'maybe_disable_wp_engine_filtering' ) );
+
+ // this is how many DB rows are processed at a time, allow devs to change this value
+ $this->rows_per_segment = apply_filters( 'wpmdb_rows_per_segment', $this->rows_per_segment );
+
+ if ( is_multisite() ) {
+ add_action( 'network_admin_menu', array( $this, 'network_admin_menu' ) );
+ add_action( 'admin_menu', array( $this, 'network_tools_admin_menu' ) );
+ /*
+ * The URL find & replace is locked down (delete & reorder disabled) on multisite installations as we require the URL
+ * of the remote site for export migrations. This URL is parsed into its various components and
+ * used to change values in the 'domain' & 'path' columns in the wp_blogs and wp_site tables.
+ */
+ $this->lock_url_find_replace_row = true;
+ } else {
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
+ }
+ }
+
+ /**
+ * Returns a fragment of SQL for creating the table where the alter statements are held during the migration.
+ *
+ * @return string
+ */
+ function get_create_alter_table_query() {
+ if ( ! is_null( $this->create_alter_table_query ) ) {
+ return $this->create_alter_table_query;
+ }
+
+ $legacy_alter_table_name = $this->get_legacy_alter_table_name();
+ $this->create_alter_table_query = sprintf( "DROP TABLE IF EXISTS `%s`;\n", $legacy_alter_table_name );
+
+ $alter_table_name = $this->get_alter_table_name();
+ $this->create_alter_table_query .= sprintf( "DROP TABLE IF EXISTS `%s`;\n", $alter_table_name );
+ $this->create_alter_table_query .= sprintf( "CREATE TABLE `%s` ( `query` LONGTEXT NOT NULL );\n", $alter_table_name );
+ $this->create_alter_table_query = apply_filters( 'wpmdb_create_alter_table_query', $this->create_alter_table_query );
+
+ return $this->create_alter_table_query;
+ }
+
+ /**
+ * Handler for ajax request to turn on or off Compatibility Mode.
+ */
+ function ajax_plugin_compatibility() {
+ $this->check_ajax_referer( 'plugin_compatibility' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'install' => 'numeric',
+ );
+ $this->set_post_data( $key_rules );
+
+ $mu_dir = ( defined( 'WPMU_PLUGIN_DIR' ) && defined( 'WPMU_PLUGIN_URL' ) ) ? WPMU_PLUGIN_DIR : trailingslashit( WP_CONTENT_DIR ) . 'mu-plugins';
+ $source = trailingslashit( $this->plugin_dir_path ) . 'compatibility/wp-migrate-db-pro-compatibility.php';
+ $dest = trailingslashit( $mu_dir ) . 'wp-migrate-db-pro-compatibility.php';
+ if ( '1' === trim( $this->state_data['install'] ) ) { // install MU plugin
+ if ( ! wp_mkdir_p( $mu_dir ) ) {
+ printf( esc_html__( 'The following directory could not be created: %s', 'wp-migrate-db' ), $mu_dir );
+ exit;
+ }
+
+ if ( ! @copy( $source, $dest ) ) {
+ printf( esc_html__( 'Could not copy the compatibility plugin from %1$s to %2$s', 'wp-migrate-db' ), $source, $dest );
+ exit;
+ }
+ } else { // uninstall MU plugin
+ // TODO: Use WP_Filesystem API.
+ if ( file_exists( $dest ) && ! @unlink( $dest ) ) {
+ printf( esc_html__( 'Could not remove the compatibility plugin from %s', 'wp-migrate-db' ), $dest );
+ exit;
+ }
+ }
+ exit;
+ }
+
+ /**
+ * Handler for updating the plugins that are not to be loaded during a request (Compatibility Mode).
+ */
+ function ajax_blacklist_plugins() {
+ $this->check_ajax_referer( 'blacklist_plugins' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'blacklist_plugins' => 'array',
+ );
+ $this->set_post_data( $key_rules );
+
+ $this->settings['blacklist_plugins'] = (array) $this->state_data['blacklist_plugins'];
+ update_site_option( 'wpmdb_settings', $this->settings );
+ exit;
+ }
+
+ /**
+ * Updates the Maximum Request Size setting.
+ *
+ * @return void
+ */
+ function ajax_update_max_request_size() {
+ $this->check_ajax_referer( 'update-max-request-size' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'max_request_size' => 'positive_int',
+ 'nonce' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+ $this->settings['max_request'] = (int) $this->state_data['max_request_size'] * 1024;
+ $result = update_site_option( 'wpmdb_settings', $this->settings );
+ $this->end_ajax( $result );
+ }
+
+ /**
+ * Updates the Delay Between Requests setting.
+ *
+ * @return void
+ */
+ function ajax_update_delay_between_requests() {
+ $this->check_ajax_referer( 'update-delay-between-requests' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'delay_between_requests' => 'positive_int',
+ 'nonce' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+ $this->settings['delay_between_requests'] = (int) $this->state_data['delay_between_requests'];
+ $result = update_site_option( 'wpmdb_settings', $this->settings );
+ $this->end_ajax( $result );
+ }
+
+ static function is_json( $string, $strict = false ) {
+ $json = @json_decode( $string, true );
+ if ( $strict == true && ! is_array( $json ) ) {
+ return false;
+ }
+
+ return ! ( $json == null || $json == false );
+ }
+
+ function get_sql_dump_info( $migration_type, $info_type ) {
+ if ( empty( $this->session_salt ) ) {
+ $this->session_salt = strtolower( wp_generate_password( 5, false, false ) );
+ }
+ $datetime = date( 'YmdHis' );
+ $ds = ( $info_type == 'path' ? DIRECTORY_SEPARATOR : '/' );
+ $dump_info = sprintf( '%s%s%s-%s-%s-%s.sql', $this->get_upload_info( $info_type ), $ds, sanitize_title_with_dashes( DB_NAME ), $migration_type, $datetime, $this->session_salt );
+
+ return ( $info_type == 'path' ? $this->slash_one_direction( $dump_info ) : $dump_info );
+ }
+
+ /**
+ * Returns validated and sanitized form data.
+ *
+ * @param array|string $data
+ *
+ * @return array|string
+ */
+ function parse_migration_form_data( $data ) {
+ $form_data = parent::parse_migration_form_data( $data );
+
+ $this->accepted_fields = apply_filters( 'wpmdb_accepted_profile_fields', $this->accepted_fields );
+ $form_data = array_intersect_key( $form_data, array_flip( $this->accepted_fields ) );
+ unset( $form_data['replace_old'][0] );
+ unset( $form_data['replace_new'][0] );
+
+ if ( ! isset( $form_data['replace_old'] ) ) {
+ $form_data['replace_old'] = array();
+ }
+ if ( ! isset( $form_data['replace_new'] ) ) {
+ $form_data['replace_new'] = array();
+ }
+
+ if ( isset( $form_data['exclude_post_revisions'] ) ) {
+ $form_data['exclude_post_types'] = '1';
+ $form_data['select_post_types'][] = 'revision';
+ $form_data['select_post_types'] = array_unique( $form_data['select_post_types'] );
+ unset( $form_data['exclude_post_revisions'] );
+ }
+
+ return $form_data;
+ }
+
+ /**
+ * Adds settings link to plugin page
+ *
+ * @param array $links
+ *
+ * @return array $links
+ */
+ function plugin_action_links( $links ) {
+ $link = sprintf( '%s ', network_admin_url( $this->plugin_base ) . '#settings', _x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) );
+ array_unshift( $links, $link );
+
+ return $links;
+ }
+
+ function ajax_clear_log() {
+ $this->check_ajax_referer( 'clear-log' );
+ delete_site_option( 'wpmdb_error_log' );
+ $result = $this->end_ajax();
+
+ return $result;
+ }
+
+ function ajax_get_log() {
+ $this->check_ajax_referer( 'get-log' );
+ ob_start();
+ $this->output_diagnostic_info();
+ $this->output_log_file();
+ $return = ob_get_clean();
+ $result = $this->end_ajax( $return );
+
+ return $result;
+ }
+
+ function output_log_file() {
+ $this->load_error_log();
+ if ( isset( $this->error_log ) ) {
+ echo $this->error_log;
+ }
+ }
+
+ /**
+ * Outputs diagnostic info for debugging.
+ *
+ * Outputs useful diagnostic info text at the Diagnostic Info & Error Log
+ * section under the Help tab so the information can be viewed or
+ * downloaded and shared for debugging.
+ *
+ * If you would like to add additional diagnostic information use the
+ * `wpmdb_diagnostic_info` action hook (see {@link https://developer.wordpress.org/reference/functions/add_action/}).
+ *
+ *
+ * add_action( 'wpmdb_diagnostic_info', 'my_diagnostic_info' ) {
+ * echo "Additional Diagnostic Info: \r\n";
+ * echo "...\r\n";
+ * }
+ *
+ *
+ * @return void
+ */
+ function output_diagnostic_info() {
+ global $wpdb;
+ $table_prefix = $wpdb->base_prefix;
+
+ echo 'site_url(): ';
+ echo esc_html( site_url() );
+ echo "\r\n";
+
+ echo 'home_url(): ';
+ echo esc_html( home_url() );
+ echo "\r\n";
+
+ echo 'Database Name: ';
+ echo esc_html( $wpdb->dbname );
+ echo "\r\n";
+
+ echo 'Table Prefix: ';
+ echo esc_html( $table_prefix );
+ echo "\r\n";
+
+ echo 'WordPress: ';
+ echo bloginfo( 'version' );
+ if ( is_multisite() ) {
+ $multisite_type = defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ? 'Sub-domain' : 'Sub-directory';
+ echo ' Multisite (' . $multisite_type . ')';
+ echo "\r\n";
+
+ if ( defined( 'DOMAIN_CURRENT_SITE' ) ) {
+ echo 'Domain Current Site: ';
+ echo DOMAIN_CURRENT_SITE;
+ echo "\r\n";
+ }
+
+ if ( defined( 'PATH_CURRENT_SITE' ) ) {
+ echo 'Path Current Site: ';
+ echo PATH_CURRENT_SITE;
+ echo "\r\n";
+ }
+
+ if ( defined( 'SITE_ID_CURRENT_SITE' ) ) {
+ echo 'Site ID Current Site: ';
+ echo SITE_ID_CURRENT_SITE;
+ echo "\r\n";
+ }
+
+ if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) {
+ echo 'Blog ID Current Site: ';
+ echo BLOG_ID_CURRENT_SITE;
+ }
+ }
+ echo "\r\n";
+
+ echo 'Web Server: ';
+ echo esc_html( ! empty( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '' );
+ echo "\r\n";
+
+ echo 'PHP: ';
+ if ( function_exists( 'phpversion' ) ) {
+ echo esc_html( phpversion() );
+ }
+ echo "\r\n";
+
+ echo 'MySQL: ';
+ echo esc_html( empty( $wpdb->use_mysqli ) ? mysql_get_server_info() : mysqli_get_server_info( $wpdb->dbh ) );
+ echo "\r\n";
+
+ echo 'ext/mysqli: ';
+ echo empty( $wpdb->use_mysqli ) ? 'no' : 'yes';
+ echo "\r\n";
+
+ echo 'WP Memory Limit: ';
+ echo esc_html( WP_MEMORY_LIMIT );
+ echo "\r\n";
+
+ echo 'Blocked External HTTP Requests: ';
+ if ( ! defined( 'WP_HTTP_BLOCK_EXTERNAL' ) || ! WP_HTTP_BLOCK_EXTERNAL ) {
+ echo 'None';
+ } else {
+ $accessible_hosts = ( defined( 'WP_ACCESSIBLE_HOSTS' ) ) ? WP_ACCESSIBLE_HOSTS : '';
+
+ if ( empty( $accessible_hosts ) ) {
+ echo 'ALL';
+ } else {
+ echo 'Partially (Accessible Hosts: ' . esc_html( $accessible_hosts ) . ')';
+ }
+ }
+ echo "\r\n";
+
+ echo 'WPMDB Bottleneck: ';
+ echo esc_html( size_format( $this->get_bottleneck() ) );
+ echo "\r\n";
+
+ echo 'WP Locale: ';
+ echo esc_html( get_locale() );
+ echo "\r\n";
+
+ echo 'DB Charset: ';
+ echo esc_html( DB_CHARSET );
+ echo "\r\n";
+
+ if ( function_exists( 'ini_get' ) && $suhosin_limit = ini_get( 'suhosin.post.max_value_length' ) ) {
+ echo 'Suhosin Post Max Value Length: ';
+ echo esc_html( is_numeric( $suhosin_limit ) ? size_format( $suhosin_limit ) : $suhosin_limit );
+ echo "\r\n";
+ }
+
+ if ( function_exists( 'ini_get' ) && $suhosin_limit = ini_get( 'suhosin.request.max_value_length' ) ) {
+ echo 'Suhosin Request Max Value Length: ';
+ echo esc_html( is_numeric( $suhosin_limit ) ? size_format( $suhosin_limit ) : $suhosin_limit );
+ echo "\r\n";
+ }
+
+ echo 'Debug Mode: ';
+ echo esc_html( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? 'Yes' : 'No' );
+ echo "\r\n";
+
+ echo 'WP Max Upload Size: ';
+ echo esc_html( size_format( wp_max_upload_size() ) );
+ echo "\r\n";
+
+ echo 'PHP Post Max Size: ';
+ echo esc_html( size_format( $this->get_post_max_size() ) );
+ echo "\r\n";
+
+ echo 'PHP Time Limit: ';
+ if ( function_exists( 'ini_get' ) ) {
+ echo esc_html( ini_get( 'max_execution_time' ) );
+ }
+ echo "\r\n";
+
+ echo 'PHP Error Log: ';
+ if ( function_exists( 'ini_get' ) ) {
+ echo esc_html( ini_get( 'error_log' ) );
+ }
+ echo "\r\n";
+
+ echo 'fsockopen: ';
+ if ( function_exists( 'fsockopen' ) ) {
+ echo 'Enabled';
+ } else {
+ echo 'Disabled';
+ }
+ echo "\r\n";
+
+ echo 'OpenSSL: ';
+ if ( $this->open_ssl_enabled() ) {
+ echo esc_html( OPENSSL_VERSION_TEXT );
+ } else {
+ echo 'Disabled';
+ }
+ echo "\r\n";
+
+ echo 'cURL: ';
+ if ( function_exists( 'curl_init' ) ) {
+ echo 'Enabled';
+ } else {
+ echo 'Disabled';
+ }
+ echo "\r\n";
+
+ echo 'Enable SSL verification setting: ';
+ if ( 1 == $this->settings['verify_ssl'] ) {
+ echo 'Yes';
+ } else {
+ echo 'No';
+ }
+ echo "\r\n";
+
+ echo 'Compatibility Mode: ';
+ if ( isset( $GLOBALS['wpmdb_compatibility'] ) ) {
+ echo 'Yes';
+ } else {
+ echo 'No';
+ }
+ echo "\r\n";
+
+ echo 'Delay Between Requests: ';
+ $delay_between_requests = $this->settings['delay_between_requests'];
+ $delay_between_requests = $delay_between_requests > 0 ? $delay_between_requests / 1000 : $delay_between_requests;
+ echo esc_html( $delay_between_requests ) . ' s';
+ echo "\r\n\r\n";
+
+ do_action( 'wpmdb_diagnostic_info' );
+ if ( has_action( 'wpmdb_diagnostic_info' ) ) {
+ echo "\r\n";
+ }
+
+ $theme_info = wp_get_theme();
+ echo "Active Theme Name: " . esc_html( $theme_info->Name ) . "\r\n";
+ echo "Active Theme Folder: " . esc_html( basename( $theme_info->get_stylesheet_directory() ) ) . "\r\n";
+ if ( $theme_info->get( 'Template' ) ) {
+ echo "Parent Theme Folder: " . esc_html( $theme_info->get( 'Template' ) ) . "\r\n";
+ }
+ if ( ! file_exists( $theme_info->get_stylesheet_directory() ) ) {
+ echo "WARNING: Active Theme Folder Not Found\r\n";
+ }
+
+ echo "\r\n";
+
+ echo "Active Plugins:\r\n";
+
+ if ( isset( $GLOBALS['wpmdb_compatibility'] ) ) {
+ remove_filter( 'option_active_plugins', 'wpmdbc_exclude_plugins' );
+ remove_filter( 'site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins' );
+ $blacklist = array_flip( (array) $this->settings['blacklist_plugins'] );
+ } else {
+ $blacklist = array();
+ }
+
+ $active_plugins = (array) get_option( 'active_plugins', array() );
+
+ if ( is_multisite() ) {
+ $network_active_plugins = wp_get_active_network_plugins();
+ $active_plugins = array_map( array( $this, 'remove_wp_plugin_dir' ), $network_active_plugins );
+ }
+
+ foreach ( $active_plugins as $plugin ) {
+ $suffix = ( isset( $blacklist[ $plugin ] ) ) ? '*' : '';
+ $this->print_plugin_details( WP_PLUGIN_DIR . '/' . $plugin, $suffix );
+ }
+
+ if ( isset( $GLOBALS['wpmdb_compatibility'] ) ) {
+ add_filter( 'option_active_plugins', 'wpmdbc_exclude_plugins' );
+ add_filter( 'site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins' );
+ }
+
+ $mu_plugins = wp_get_mu_plugins();
+ if ( $mu_plugins ) {
+ echo "\r\n";
+
+ echo "Must-use Plugins:\r\n";
+
+ foreach ( $mu_plugins as $mu_plugin ) {
+ $this->print_plugin_details( $mu_plugin );
+ }
+
+ echo "\r\n";
+ }
+ }
+
+ function print_plugin_details( $plugin_path, $suffix = '' ) {
+ $plugin_data = get_plugin_data( $plugin_path );
+ if ( empty( $plugin_data['Name'] ) ) {
+ return;
+ }
+
+ printf( "%s%s (v%s) by %s\r\n", $plugin_data['Name'], $suffix, $plugin_data['Version'], $plugin_data['AuthorName'] );
+ }
+
+ function remove_wp_plugin_dir( $name ) {
+ $plugin = str_replace( WP_PLUGIN_DIR, '', $name );
+
+ return substr( $plugin, 1 );
+ }
+
+ function get_alter_queries() {
+ global $wpdb;
+
+ $alter_table_name = $this->get_alter_table_name();
+ $alter_queries = array();
+ $sql = '';
+
+ if ( $alter_table_name === $wpdb->get_var( "SHOW TABLES LIKE '$alter_table_name'" ) ) {
+ $alter_queries = $wpdb->get_results( "SELECT * FROM `{$alter_table_name}`", ARRAY_A );
+ $alter_queries = apply_filters( 'wpmdb_get_alter_queries', $alter_queries );
+ }
+
+ if ( ! empty( $alter_queries ) ) {
+ foreach ( $alter_queries as $alter_query ) {
+ $sql .= $alter_query['query'] . "\n";
+ }
+ }
+
+ return $sql;
+ }
+
+ function process_chunk( $chunk ) {
+ // prepare db
+ global $wpdb;
+ $this->set_time_limit();
+
+ $queries = array_filter( explode( ";\n", $chunk ) );
+ array_unshift( $queries, "SET sql_mode='NO_AUTO_VALUE_ON_ZERO';" );
+
+ ob_start();
+ $wpdb->show_errors();
+
+ if ( empty( $wpdb->charset ) ) {
+ $charset = ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'utf8' );
+ $wpdb->charset = $charset;
+ $wpdb->set_charset( $wpdb->dbh, $wpdb->charset );
+ }
+
+ foreach ( $queries as $query ) {
+ if ( false === $wpdb->query( $query ) ) {
+ $return = ob_get_clean();
+ $return = array( 'wpmdb_error' => 1, 'body' => $return );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Called for each database table to be migrated.
+ *
+ * @return string
+ */
+ function ajax_migrate_table() {
+ $this->check_ajax_referer( 'migrate-table' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'migration_state_id' => 'key',
+ 'table' => 'string',
+ 'stage' => 'key',
+ 'current_row' => 'numeric',
+ 'last_table' => 'string',
+ 'primary_keys' => 'string',
+ 'gzip' => 'int',
+ 'nonce' => 'key',
+ 'bottleneck' => 'positive_int',
+ 'prefix' => 'string',
+ 'path_current_site' => 'string',
+ 'domain_current_site' => 'text',
+ );
+ $this->set_post_data( $key_rules );
+
+ global $wpdb;
+
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
+
+ $result = '';
+
+ // checks if we're performing a backup, if so, continue with the backup and exit immediately after
+ if ( $this->state_data['stage'] == 'backup' && $this->state_data['intent'] != 'savefile' ) {
+ // if performing a push we need to backup the REMOTE machine's DB
+ if ( $this->state_data['intent'] == 'push' ) {
+ $data = $this->filter_post_elements(
+ $this->state_data,
+ array(
+ 'action',
+ 'remote_state_id',
+ 'url',
+ 'table',
+ 'form_data',
+ 'stage',
+ 'bottleneck',
+ 'prefix',
+ 'current_row',
+ 'last_table',
+ 'gzip',
+ 'primary_keys',
+ 'path_current_site',
+ 'domain_current_site',
+ )
+ );
+
+ $data['action'] = 'wpmdb_backup_remote_table';
+ $data['intent'] = 'pull';
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
+ $data['primary_keys'] = addslashes( $data['primary_keys'] );
+ $ajax_url = $this->ajax_url();
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
+ ob_start();
+ $this->display_errors();
+ $maybe_errors = ob_get_clean();
+
+ if ( false === empty( $maybe_errors ) ) {
+ $maybe_errors = array( 'wpmdb_error' => 1, 'body' => $maybe_errors );
+ $return = json_encode( $maybe_errors );
+ } else {
+ $return = $response;
+ }
+ } else {
+ $return = $this->handle_table_backup();
+ }
+
+ $result = $this->end_ajax( $return );
+
+ return $result;
+ }
+
+ // Pull and push need to be handled differently for obvious reasons,
+ // and trigger different code depending on the migration intent (push or pull).
+ if ( in_array( $this->state_data['intent'], array( 'push', 'savefile', 'find_replace' ) ) ) {
+ $this->maximum_chunk_size = $this->get_bottleneck();
+
+ if ( isset( $this->state_data['bottleneck'] ) ) {
+ $this->maximum_chunk_size = (int) $this->state_data['bottleneck'];
+ }
+
+ if ( 'savefile' === $this->state_data['intent'] ) {
+ $sql_dump_file_name = $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR;
+ $sql_dump_file_name .= $this->format_dump_name( $this->state_data['dump_filename'] );
+ $this->fp = $this->open( $sql_dump_file_name );
+ }
+
+ if ( ! empty( $this->state_data['db_version'] ) ) {
+ $this->target_db_version = $this->state_data['db_version'];
+ if ( 'push' == $this->state_data['intent'] ) {
+ // $this->target_db_version has been set to remote database's version.
+ add_filter( 'wpmdb_create_table_query', array( $this, 'mysql_compat_filter' ), 10, 5 );
+ } elseif ( 'savefile' == $this->state_data['intent'] && ! empty( $this->form_data['compatibility_older_mysql'] ) ) {
+ // compatibility_older_mysql is currently a checkbox meaning pre-5.5 compatibility (we play safe and target 5.1),
+ // this may change in the future to be a dropdown or radiobox returning the version to be compatible with.
+ $this->target_db_version = '5.1';
+ add_filter( 'wpmdb_create_table_query', array( $this, 'mysql_compat_filter' ), 10, 5 );
+ }
+ }
+
+ if ( ! empty( $this->state_data['find_replace_pairs'] ) ) {
+ $this->find_replace_pairs = $this->state_data['find_replace_pairs'];
+ }
+
+ ob_start();
+ $result = $this->process_table( $this->state_data['table'] );
+
+ if ( $this->state_data['intent'] == 'savefile' && isset( $this->fp ) ) {
+ $this->close( $this->fp );
+ }
+
+ $this->display_errors();
+ $maybe_errors = trim( ob_get_clean() );
+ if ( false === empty( $maybe_errors ) ) {
+ $return = array( 'wpmdb_error' => 1, 'body' => $maybe_errors );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ return $result;
+ } else {
+ $data = $this->filter_post_elements(
+ $this->state_data,
+ array(
+ 'remote_state_id',
+ 'intent',
+ 'url',
+ 'table',
+ 'form_data',
+ 'stage',
+ 'bottleneck',
+ 'current_row',
+ 'last_table',
+ 'gzip',
+ 'primary_keys',
+ 'site_url',
+ 'find_replace_pairs',
+ )
+ );
+
+ $data['action'] = 'wpmdb_process_pull_request';
+ $data['pull_limit'] = $this->get_sensible_pull_limit();
+ $data['db_version'] = $wpdb->db_version();
+
+ if ( is_multisite() ) {
+ $data['path_current_site'] = $this->get_path_current_site();
+ $data['domain_current_site'] = $this->get_domain_current_site();
+ }
+
+ $data['prefix'] = $wpdb->base_prefix;
+
+ if ( isset( $data['find_replace_pairs'] ) ) {
+ $data['find_replace_pairs'] = serialize( $data['find_replace_pairs'] );
+ }
+
+ if ( isset( $data['sig'] ) ) {
+ unset( $data['sig'] );
+ }
+
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
+ $data['primary_keys'] = addslashes( $data['primary_keys'] );
+ $data['find_replace_pairs'] = addslashes( $data['find_replace_pairs'] );
+ $ajax_url = $this->ajax_url();
+
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
+ ob_start();
+ $this->display_errors();
+ $maybe_errors = trim( ob_get_clean() );
+
+ if ( false === empty( $maybe_errors ) ) {
+ $return = array( 'wpmdb_error' => 1, 'body' => $maybe_errors );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ if ( strpos( $response, ';' ) === false ) {
+ $result = $this->end_ajax( $response );
+
+ return $result;
+ }
+
+ // returned data is just a big string like this query;query;query;33
+ // need to split this up into a chunk and row_tracker
+ $row_information = trim( substr( strrchr( $response, "\n" ), 1 ) );
+ $row_information = explode( ',', $row_information );
+ $chunk = substr( $response, 0, strrpos( $response, ";\n" ) + 1 );
+
+ if ( ! empty( $chunk ) ) {
+ $process_chunk_result = $this->process_chunk( $chunk );
+ if ( true !== $process_chunk_result ) {
+ $result = $this->end_ajax( $process_chunk_result );
+
+ return $result;
+ }
+ }
+
+ $result = array(
+ 'current_row' => $row_information[0],
+ 'primary_keys' => $row_information[1],
+ );
+
+ $result = $this->end_ajax( json_encode( $result ) );
+ }
+
+ return $result;
+ }
+
+ /**
+ * Occurs right before the first table is migrated / backed up during the migration process.
+ *
+ * @return string
+ *
+ * Does a quick check to make sure the verification string is valid and also opens / creates files for writing to (if required).
+ */
+ function ajax_initiate_migration() {
+ global $wpdb;
+
+ $this->check_ajax_referer( 'initiate-migration' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'intent' => 'key',
+ 'url' => 'url',
+ 'key' => 'string',
+ 'form_data' => 'string',
+ 'stage' => 'key',
+ 'nonce' => 'key',
+ 'temp_prefix' => 'string',
+ 'site_details' => 'json_array',
+ 'export_dest' => 'string',
+ );
+ $this->set_post_data( $key_rules );
+
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
+
+ $this->log_usage( $this->state_data['intent'] );
+
+ // A little bit of house keeping.
+ WPMDB_Migration_State::cleanup();
+
+ if ( in_array( $this->state_data['intent'], array( 'find_replace', 'savefile' ) ) ) {
+ $return = array(
+ 'code' => 200,
+ 'message' => 'OK',
+ 'body' => json_encode( array( 'error' => 0 ) ),
+ );
+
+ if ( in_array( $this->state_data['stage'], array( 'backup', 'migrate' ) ) ) {
+ $return['dump_path'] = $this->get_sql_dump_info( $this->state_data['stage'], 'path' );
+ $return['dump_filename'] = basename( $return['dump_path'] );
+ $return['dump_url'] = $this->get_sql_dump_info( $this->state_data['stage'], 'url' );
+ $dump_filename_no_extension = substr( $return['dump_filename'], 0, -4 );
+
+ // sets up our table to store 'ALTER' queries
+ $create_alter_table_query = $this->get_create_alter_table_query();
+ $process_chunk_result = $this->process_chunk( $create_alter_table_query );
+
+ if ( true !== $process_chunk_result ) {
+ $result = $this->end_ajax( $process_chunk_result );
+
+ return $result;
+ }
+
+ if ( 'savefile' === $this->state_data['intent'] ) {
+ if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
+ $return['dump_path'] .= '.gz';
+ $return['dump_filename'] .= '.gz';
+ $return['dump_url'] .= '.gz';
+ }
+
+ $upload_path = $this->get_upload_info( 'path' );
+
+ $this->fp = $this->open( $upload_path . DIRECTORY_SEPARATOR . $return['dump_filename'] );
+ $this->db_backup_header();
+ $this->close( $this->fp );
+ }
+
+ $return['dump_filename'] = $dump_filename_no_extension;
+ }
+
+ } else { // does one last check that our verification string is valid
+ $data = array(
+ 'action' => 'wpmdb_remote_initiate_migration',
+ 'intent' => $this->state_data['intent'],
+ 'form_data' => $this->state_data['form_data'],
+ 'site_details' => $this->state_data['site_details'],
+ );
+
+ $data['site_details'] = serialize( $data['site_details'] );
+
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
+ $data['site_details'] = addslashes( $data['site_details'] );
+ $ajax_url = $this->ajax_url();
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
+
+ if ( false === $response ) {
+ $return = array( 'wpmdb_error' => 1, 'body' => $this->error );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ $return = WPMDB_Utils::unserialize( $response, __METHOD__ );
+
+ if ( false === $return ) {
+ $error_msg = __( 'Failed attempting to unserialize the response from the remote server. Please contact support.', 'wp-migrate-db' );
+ $return = array( 'wpmdb_error' => 1, 'body' => $error_msg );
+ $this->log_error( $error_msg, $response );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ if ( isset( $return['error'] ) && $return['error'] == 1 ) {
+ $return = array( 'wpmdb_error' => 1, 'body' => $return['message'] );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ if ( $this->state_data['intent'] == 'pull' ) {
+ // sets up our table to store 'ALTER' queries
+ $create_alter_table_query = $this->get_create_alter_table_query();
+ $process_chunk_result = $this->process_chunk( $create_alter_table_query );
+ if ( true !== $process_chunk_result ) {
+ $result = $this->end_ajax( $process_chunk_result );
+
+ return $result;
+ }
+ }
+
+ if ( ! empty( $this->form_data['create_backup'] ) && $this->state_data['intent'] == 'pull' ) {
+ $return['dump_filename'] = basename( $this->get_sql_dump_info( 'backup', 'path' ) );
+ $return['dump_filename'] = substr( $return['dump_filename'], 0, -4 );
+ $return['dump_url'] = $this->get_sql_dump_info( 'backup', 'url' );
+ }
+ }
+
+ $return['dump_filename'] = ( empty( $return['dump_filename'] ) ) ? '' : $return['dump_filename'];
+ $return['dump_url'] = ( empty( $return['dump_url'] ) ) ? '' : $return['dump_url'];
+
+ // A successful call to wpmdb_remote_initiate_migration for a Push migration will have set db_version.
+ // Otherwise ensure it is set with own db_version so that we always return one.
+ $return['db_version'] = ( empty( $return['db_version'] ) ) ? $wpdb->db_version() : $return['db_version'];
+
+ // A successful call to wpmdb_remote_initiate_migration for a Push migration will have set site_url.
+ // Otherwise ensure it is set with own site_url so that we always return one.
+ $return['site_url'] = ( empty( $return['site_url'] ) ) ? site_url() : $return['site_url'];
+
+ $return['find_replace_pairs'] = $this->parse_find_replace_pairs( $this->state_data['intent'], $return['site_url'] );
+
+ // Store current migration state and return its id.
+ $state = array_merge( $this->state_data, $return );
+ unset( $return );
+ $return['migration_state_id'] = $this->migration_state->id();
+ $return = $this->save_migration_state( $state, $return );
+
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ /**
+ * After table migration, delete old tables and rename new tables removing the temporarily prefix.
+ *
+ * @return mixed
+ */
+ function ajax_finalize_migration() {
+ $this->check_ajax_referer( 'finalize-migration' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'migration_state_id' => 'key',
+ 'prefix' => 'string',
+ 'tables' => 'string',
+ 'nonce' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+ if ( 'savefile' === $this->state_data['intent'] ) {
+ return true;
+ }
+
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
+
+ global $wpdb;
+
+ if ( 'push' === $this->state_data['intent'] ) {
+ do_action( 'wpmdb_migration_complete', 'push', $this->state_data['url'] );
+ $data = $this->filter_post_elements(
+ $this->state_data,
+ array(
+ 'remote_state_id',
+ 'url',
+ 'form_data',
+ 'tables',
+ 'temp_prefix',
+ )
+ );
+
+ $data['action'] = 'wpmdb_remote_finalize_migration';
+ $data['intent'] = 'pull';
+ $data['prefix'] = $wpdb->base_prefix;
+ $data['type'] = 'push';
+ $data['location'] = home_url();
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
+ $ajax_url = $this->ajax_url();
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
+ ob_start();
+ echo esc_html( $response );
+ $this->display_errors();
+ $return = ob_get_clean();
+ } else {
+ $return = $this->finalize_migration();
+ }
+
+ $result = $this->end_ajax( $return );
+
+ return $result;
+ }
+
+ /**
+ * Internal function for finalizing a migration.
+ *
+ * @return bool|null
+ */
+ function finalize_migration() {
+ $this->set_post_data();
+ $tables = explode( ',', $this->state_data['tables'] );
+ $temp_prefix = ( isset( $this->state_data['temp_prefix'] ) ) ? $this->state_data['temp_prefix'] : $this->temp_prefix;
+ $temp_tables = array();
+ $type = $this->state_data['intent'];
+
+ if ( isset( $this->state_data['type'] ) && 'push' === $this->state_data['type'] ) {
+ $type = 'push';
+ }
+
+ if ( 'find_replace' === $this->state_data['intent'] ) {
+ $location = home_url();
+ } else {
+ $location = ( isset( $this->state_data['location'] ) ) ? $this->state_data['location'] : $this->state_data['url'];
+ }
+
+ foreach ( $tables as $table ) {
+ $temp_tables[] = $temp_prefix . apply_filters(
+ 'wpmdb_finalize_target_table_name',
+ $table,
+ $type,
+ $this->state_data['site_details']
+ );
+ }
+
+ $sql = "SET FOREIGN_KEY_CHECKS=0;\n";
+
+ $sql .= $this->get_preserved_options_queries( $temp_tables, $type );
+
+ foreach ( $temp_tables as $table ) {
+ $sql .= 'DROP TABLE IF EXISTS ' . $this->backquote( substr( $table, strlen( $temp_prefix ) ) ) . ';';
+ $sql .= "\n";
+ $sql .= 'RENAME TABLE ' . $this->backquote( $table ) . ' TO ' . $this->backquote( substr( $table, strlen( $temp_prefix ) ) ) . ';';
+ $sql .= "\n";
+ }
+
+ $alter_table_name = $this->get_alter_table_name();
+ $sql .= $this->get_alter_queries();
+ $sql .= 'DROP TABLE IF EXISTS ' . $this->backquote( $alter_table_name ) . ";\n";
+
+ $process_chunk_result = $this->process_chunk( $sql );
+ if ( true !== $process_chunk_result ) {
+ $result = $this->end_ajax( $process_chunk_result );
+
+ return $result;
+ }
+
+ if ( ! isset( $this->state_data['location'] ) && 'find_replace' !== $this->state_data['intent'] ) {
+ $data = array();
+ $data['action'] = 'wpmdb_fire_migration_complete';
+ $data['url'] = home_url();
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
+ $ajax_url = $this->ajax_url();
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
+ ob_start();
+ echo esc_html( $response );
+ $this->display_errors();
+ $maybe_errors = trim( ob_get_clean() );
+ if ( false === empty( $maybe_errors ) && '1' !== $maybe_errors ) {
+ $maybe_errors = array( 'wpmdb_error' => 1, 'body' => $maybe_errors );
+ $result = $this->end_ajax( json_encode( $maybe_errors ) );
+
+ return $result;
+ }
+ }
+
+ do_action( 'wpmdb_migration_complete', $type, $location );
+
+ return true;
+ }
+
+ /**
+ * Returns SQL queries used to preserve options in the
+ * wp_options or wp_sitemeta tables during a migration.
+ *
+ * @param array $temp_tables
+ * @param string $intent
+ *
+ * @return string DELETE and INSERT SQL queries separated by a newline character (\n).
+ */
+ function get_preserved_options_queries( $temp_tables, $intent = '' ) {
+ $this->set_post_data();
+ global $wpdb;
+
+ $sql = '';
+ $sitemeta_table_name = '';
+ $options_table_names = array();
+
+ $temp_prefix = isset( $this->state_data['temp_prefix'] ) ? $this->state_data['temp_prefix'] : $this->temp_prefix;
+ $table_prefix = isset( $this->state_data['prefix'] ) ? $this->state_data['prefix'] : $wpdb->base_prefix;
+ $prefix = esc_sql( $temp_prefix . $table_prefix );
+
+ foreach ( $temp_tables as $temp_table ) {
+ $table = $wpdb->base_prefix . str_replace( $prefix, '', $temp_table );
+
+ // Get sitemeta table
+ if ( is_multisite() && $this->table_is( 'sitemeta', $table ) ) {
+ $sitemeta_table_name = $temp_table;
+ }
+
+ // Get array of options tables
+ if ( $this->table_is( 'options', $table ) ) {
+ $options_table_names[] = $temp_table;
+ }
+ }
+
+ // Return if multisite but sitemeta and option tables not in migration scope
+ if ( is_multisite() && true === empty( $sitemeta_table_name ) && true === empty( $options_table_names ) ) {
+ return $sql;
+ }
+
+ // Return if options tables not in migration scope for non-multisite.
+ if ( ! is_multisite() && true === empty( $options_table_names ) ) {
+ return $sql;
+ }
+
+ $preserved_options = array(
+ 'wpmdb_settings',
+ 'wpmdb_error_log',
+ 'wpmdb_schema_version',
+ 'upload_path',
+ 'upload_url_path',
+ );
+
+ $preserved_sitemeta_options = $preserved_options;
+
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
+
+ if ( false === empty( $this->form_data['keep_active_plugins'] ) ) {
+ $preserved_options[] = 'active_plugins';
+ $preserved_sitemeta_options[] = 'active_sitewide_plugins';
+ }
+
+ if ( is_multisite() ) {
+ // Get preserved data in site meta table if being replaced.
+ if ( ! empty( $sitemeta_table_name ) ) {
+ $table = $wpdb->base_prefix . str_replace( $prefix, '', $sitemeta_table_name );
+
+ $preserved_migration_state_options = $wpdb->get_results(
+ "SELECT `meta_key` FROM `{$table}` WHERE `meta_key` LIKE '" . WPMDB_Migration_State::OPTION_PREFIX . "%'",
+ OBJECT_K
+ );
+
+ if ( ! empty( $preserved_migration_state_options ) ) {
+ $preserved_sitemeta_options = array_merge( $preserved_sitemeta_options, array_keys( $preserved_migration_state_options ) );
+ }
+
+ $preserved_sitemeta_options = apply_filters( 'wpmdb_preserved_sitemeta_options', $preserved_sitemeta_options, $intent );
+ $preserved_sitemeta_options_escaped = esc_sql( $preserved_sitemeta_options );
+
+ $preserved_sitemeta_options_data = $wpdb->get_results(
+ sprintf(
+ "SELECT * FROM `{$table}` WHERE `meta_key` IN ('%s')",
+ implode( "','", $preserved_sitemeta_options_escaped )
+ ),
+ ARRAY_A
+ );
+
+ $preserved_sitemeta_options_data = apply_filters( 'wpmdb_preserved_sitemeta_options_data', $preserved_sitemeta_options_data, $intent );
+
+ // Create preserved data queries for site meta table
+ foreach ( $preserved_sitemeta_options_data as $option ) {
+ $sql .= $wpdb->prepare( "DELETE FROM `{$sitemeta_table_name}` WHERE `meta_key` = %s;\n", $option['meta_key'] );
+ $sql .= $wpdb->prepare(
+ "INSERT INTO `{$sitemeta_table_name}` ( `meta_id`, `site_id`, `meta_key`, `meta_value` ) VALUES ( NULL , %s, %s, %s );\n",
+ $option['site_id'],
+ $option['meta_key'],
+ $option['meta_value']
+ );
+ }
+ }
+ } else {
+ $preserved_migration_state_options = $wpdb->get_results(
+ "SELECT `option_name` FROM `{$wpdb->options}` WHERE `option_name` LIKE '" . WPMDB_Migration_State::OPTION_PREFIX . "%'",
+ OBJECT_K
+ );
+
+ if ( ! empty( $preserved_migration_state_options ) ) {
+ $preserved_options = array_merge( $preserved_options, array_keys( $preserved_migration_state_options ) );
+ }
+ }
+
+ // Get preserved data in options tables if being replaced.
+ if ( ! empty( $options_table_names ) ) {
+ $preserved_options = apply_filters( 'wpmdb_preserved_options', $preserved_options, $intent );
+ $preserved_options_escaped = esc_sql( $preserved_options );
+
+ $preserved_options_data = array();
+
+ // Get preserved data in options tables
+ foreach ( $options_table_names as $option_table ) {
+ $table = $wpdb->base_prefix . str_replace( $prefix, '', $option_table );
+
+ $preserved_options_data[ $option_table ] = $wpdb->get_results(
+ sprintf(
+ "SELECT * FROM `{$table}` WHERE `option_name` IN ('%s')",
+ implode( "','", $preserved_options_escaped )
+ ),
+ ARRAY_A
+ );
+ }
+
+ $preserved_options_data = apply_filters( 'wpmdb_preserved_options_data', $preserved_options_data, $intent );
+
+ // Create preserved data queries for options tables
+ foreach ( $preserved_options_data as $key => $value ) {
+ if ( false === empty( $value ) ) {
+ foreach ( $value as $option ) {
+ $sql .= $wpdb->prepare(
+ "DELETE FROM `{$key}` WHERE `option_name` = %s;\n",
+ $option['option_name']
+ );
+
+ $sql .= $wpdb->prepare(
+ "INSERT INTO `{$key}` ( `option_id`, `option_name`, `option_value`, `autoload` ) VALUES ( NULL , %s, %s, %s );\n",
+ $option['option_name'],
+ $option['option_value'],
+ $option['autoload']
+ );
+ }
+ }
+ }
+ }
+
+ return $sql;
+ }
+
+ /**
+ * Handles the request to flush caches and cleanup migration when pushing or not migrating user tables.
+ *
+ * @return bool|null
+ */
+ function ajax_flush() {
+ $this->check_ajax_referer( 'flush' );
+
+ return $this->ajax_nopriv_flush();
+ }
+
+ /**
+ * Handles the request to flush caches and cleanup migration when pulling with user tables being migrated.
+ *
+ * @return bool|null
+ */
+ function ajax_nopriv_flush() {
+ $key_rules = array(
+ 'action' => 'key',
+ 'migration_state_id' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+
+ if ( 'push' === $this->state_data['intent'] ) {
+ $data = array();
+ $data['action'] = 'wpmdb_remote_flush';
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
+ $ajax_url = $this->ajax_url();
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
+ ob_start();
+ echo esc_html( $response );
+ $this->display_errors();
+ $return = ob_get_clean();
+ } else {
+ $return = $this->flush();
+ }
+
+ if ( ! $this->migration_state->delete() ) {
+ $this->log_error( 'Could not delete migration state.' );
+ }
+
+ $result = $this->end_ajax( $return );
+
+ return $result;
+ }
+
+ /**
+ * Flushes the cache and rewrite rules.
+ *
+ * @return bool
+ */
+ function flush() {
+ // flush rewrite rules to prevent 404s and other oddities
+ wp_cache_flush();
+ global $wp_rewrite;
+ $wp_rewrite->init();
+ flush_rewrite_rules( true ); // true = hard refresh, recreates the .htaccess file
+
+ return true;
+ }
+
+ /**
+ * Handler for the ajax request to save a migration profile.
+ *
+ * @return bool|null
+ */
+ function ajax_save_profile() {
+ $this->check_ajax_referer( 'save-profile' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'profile' => 'string',
+ 'nonce' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+ $profile = $this->parse_migration_form_data( $this->state_data['profile'] );
+ $profile = wp_parse_args( $profile, $this->checkbox_options );
+
+ if ( isset( $profile['save_migration_profile_option'] ) && $profile['save_migration_profile_option'] == 'new' ) {
+ $profile['name'] = $profile['create_new_profile'];
+ $this->settings['profiles'][] = $profile;
+ } else {
+ $key = $profile['save_migration_profile_option'];
+ $name = $this->settings['profiles'][ $key ]['name'];
+ $this->settings['profiles'][ $key ] = $profile;
+ $this->settings['profiles'][ $key ]['name'] = $name;
+ }
+
+ update_site_option( 'wpmdb_settings', $this->settings );
+ end( $this->settings['profiles'] );
+ $key = key( $this->settings['profiles'] );
+ $result = $this->end_ajax( $key );
+
+ return $result;
+ }
+
+ /**
+ * Handler for deleting a migration profile.
+ *
+ * @return bool|null
+ */
+ function ajax_delete_migration_profile() {
+ $this->check_ajax_referer( 'delete-migration-profile' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'profile_id' => 'positive_int',
+ 'nonce' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+ $key = absint( $this->state_data['profile_id'] );
+ --$key;
+ $return = '';
+
+ if ( isset( $this->settings['profiles'][ $key ] ) ) {
+ unset( $this->settings['profiles'][ $key ] );
+ update_site_option( 'wpmdb_settings', $this->settings );
+ } else {
+ $return = '-1';
+ }
+
+ $result = $this->end_ajax( $return );
+
+ return $result;
+ }
+
+ /**
+ * Handler for ajax request to save a setting, e.g. accept pull/push requests setting.
+ *
+ * @return bool|null
+ */
+ function ajax_save_setting() {
+ $this->check_ajax_referer( 'save-setting' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'checked' => 'bool',
+ 'setting' => 'key',
+ 'nonce' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+ $this->settings[ $this->state_data['setting'] ] = ( $this->state_data['checked'] == 'false' ) ? false : true;
+ update_site_option( 'wpmdb_settings', $this->settings );
+ $result = $this->end_ajax();
+
+ return $result;
+ }
+
+ function format_table_sizes( $size ) {
+ $size *= 1024;
+
+ return size_format( $size );
+ }
+
+ /**
+ * Return array of post type slugs stored within DB.
+ *
+ * @return array List of post types
+ */
+ function get_post_types() {
+ global $wpdb;
+
+ if ( is_multisite() ) {
+ $tables = $this->get_tables( 'prefix' );
+ $sql = "SELECT `post_type` FROM `{$wpdb->base_prefix}posts` ";
+ $prefix_escaped = preg_quote( $wpdb->base_prefix, '/' );
+
+ foreach ( $tables as $table ) {
+ if ( 0 == preg_match( '/' . $prefix_escaped . '[0-9]+_posts/', $table ) ) {
+ continue;
+ }
+ $blog_id = str_replace( array( $wpdb->base_prefix, '_posts' ), array( '', '' ), $table );
+ $sql .= "UNION SELECT `post_type` FROM `{$wpdb->base_prefix}" . $blog_id . '_posts` ';
+ }
+ $sql .= ';';
+ $post_types = $wpdb->get_results( $sql, ARRAY_A );
+ } else {
+ $post_types = $wpdb->get_results(
+ "SELECT DISTINCT `post_type`
+ FROM `{$wpdb->base_prefix}posts`
+ WHERE 1;",
+ ARRAY_A
+ );
+ }
+
+ $return = array( 'revision' );
+
+ foreach ( $post_types as $post_type ) {
+ $return[] = $post_type['post_type'];
+ }
+
+ return apply_filters( 'wpmdb_post_types', array_unique( $return ) );
+ }
+
+ // Retrieves the specified profile, if -1, returns the default profile
+ function get_profile( $profile_id ) {
+ --$profile_id;
+
+ if ( $profile_id == '-1' || ! isset( $this->settings['profiles'][ $profile_id ] ) ) {
+ return $this->default_profile;
+ }
+
+ return $this->settings['profiles'][ $profile_id ];
+ }
+
+ /**
+ * Returns an array of table names with their associated row counts.
+ *
+ * @return array
+ */
+ function get_table_row_count() {
+ global $wpdb;
+
+ $sql = $wpdb->prepare( 'SELECT table_name, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = %s ORDER BY table_name', DB_NAME );
+ $results = $wpdb->get_results( $sql, ARRAY_A );
+
+ $return = array();
+
+ foreach ( $results as $result ) {
+ if ( $this->get_legacy_alter_table_name() == $result['table_name'] ) {
+ continue;
+ }
+ $return[ $result['table_name'] ] = ( $result['TABLE_ROWS'] == 0 ? 1 : $result['TABLE_ROWS'] );
+ }
+
+ return $return;
+ }
+
+ /**
+ * Returns an array of table names with associated size in kilobytes.
+ *
+ * @return mixed
+ *
+ * NOTE: Returned array may have been altered by wpmdb_table_sizes filter.
+ */
+ function get_table_sizes() {
+ global $wpdb;
+
+ static $return;
+
+ if ( ! empty( $return ) ) {
+ return $return;
+ }
+
+ $return = array();
+
+ $sql = $wpdb->prepare(
+ "SELECT TABLE_NAME AS 'table',
+ ROUND( ( data_length + index_length ) / 1024, 0 ) AS 'size'
+ FROM INFORMATION_SCHEMA.TABLES
+ WHERE INFORMATION_SCHEMA.TABLES.table_schema = %s
+ AND INFORMATION_SCHEMA.TABLES.table_type = %s
+ ORDER BY TABLE_NAME",
+ DB_NAME,
+ 'BASE TABLE'
+ );
+
+ $results = $wpdb->get_results( $sql, ARRAY_A );
+
+ if ( ! empty( $results ) ) {
+ foreach ( $results as $result ) {
+ if ( $this->get_legacy_alter_table_name() == $result['table'] ) {
+ continue;
+ }
+ $return[ $result['table'] ] = $result['size'];
+ }
+ }
+
+ // "regular" is passed to the filter as the scope for backwards compatibility (a possible but never used scope was "temp").
+ return apply_filters( 'wpmdb_table_sizes', $return, 'regular' );
+ }
+
+ function format_dump_name( $dump_name ) {
+ $extension = '.sql';
+ $dump_name = sanitize_file_name( $dump_name );
+
+ if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
+ $extension .= '.gz';
+ }
+
+ return $dump_name . $extension;
+ }
+
+ function options_page() {
+ $this->template( 'options' );
+ }
+
+ /**
+ * Load Tools HTML template for tools menu on sites in a Network to help users find WPMDB in Multisite
+ *
+ */
+ function subsite_tools_options_page() {
+ $this->template( 'options-tools-subsite' );
+ }
+
+ /**
+ * Get the remote site's base domain for subdomain multisite search/replace.
+ *
+ * @return string|bool The remote site's domain or false on error.
+ */
+ function get_domain_replace() {
+ $this->set_post_data();
+
+ if ( ! isset( $this->domain_replace ) ) {
+ if ( is_multisite() && ! empty( $this->state_data['domain_current_site'] ) ) {
+ $this->domain_replace = $this->state_data['domain_current_site'];
+ } elseif ( is_multisite() && ! empty( $this->form_data['replace_new'][1] ) ) {
+ $url = $this->form_data['replace_new'][1];
+ $url = $this->parse_url( $url );
+
+ if ( isset( $url['host'] ) ) {
+ $this->domain_replace = $url['host'];
+ } else {
+ $this->domain_replace = false;
+ }
+ } else {
+ $this->domain_replace = false;
+ }
+ }
+
+ return $this->domain_replace;
+ }
+
+ function process_sql_constraint( $create_query, $table, &$alter_table_query ) {
+ if ( preg_match( '@CONSTRAINT|FOREIGN[\s]+KEY@', $create_query ) ) {
+ $sql_constraints_query = '';
+
+ $nl_nix = "\n";
+ $nl_win = "\r\n";
+ $nl_mac = "\r";
+
+ if ( strpos( $create_query, $nl_win ) !== false ) {
+ $crlf = $nl_win;
+ } elseif ( strpos( $create_query, $nl_mac ) !== false ) {
+ $crlf = $nl_mac;
+ } else {
+ $crlf = $nl_nix;
+ }
+
+ // Split the query into lines, so we can easily handle it.
+ // We know lines are separated by $crlf (done few lines above).
+ $sql_lines = explode( $crlf, $create_query );
+ $sql_count = count( $sql_lines );
+
+ // lets find first line with constraints
+ for ( $i = 0; $i < $sql_count; $i++ ) {
+ if ( preg_match(
+ '@^[\s]*(CONSTRAINT|FOREIGN[\s]+KEY)@',
+ $sql_lines[ $i ]
+ ) ) {
+ break;
+ }
+ }
+
+ // If we really found a constraint
+ if ( $i != $sql_count ) {
+ // remove, from the end of create statement
+ $sql_lines[ $i - 1 ] = preg_replace(
+ '@,$@',
+ '',
+ $sql_lines[ $i - 1 ]
+ );
+
+ // let's do the work
+ $sql_constraints_query .= 'ALTER TABLE ' . $this->backquote( $table ) . $crlf;
+
+ $first = true;
+ for ( $j = $i; $j < $sql_count; $j++ ) {
+ if ( preg_match(
+ '@CONSTRAINT|FOREIGN[\s]+KEY@',
+ $sql_lines[ $j ]
+ ) ) {
+ if ( strpos( $sql_lines[ $j ], 'CONSTRAINT' ) === false ) {
+ $tmp_str = preg_replace(
+ '/(FOREIGN[\s]+KEY)/',
+ 'ADD \1',
+ $sql_lines[ $j ]
+ );
+ $sql_constraints_query .= $tmp_str;
+ } else {
+ $tmp_str = preg_replace(
+ '/(CONSTRAINT)/',
+ 'ADD \1',
+ $sql_lines[ $j ]
+ );
+ $sql_constraints_query .= $tmp_str;
+ preg_match(
+ '/(CONSTRAINT)([\s])([\S]*)([\s])/',
+ $sql_lines[ $j ],
+ $matches
+ );
+ }
+ $first = false;
+ } else {
+ break;
+ }
+ }
+
+ $sql_constraints_query .= ";\n";
+
+ $create_query = implode(
+ $crlf,
+ array_slice( $sql_lines, 0, $i )
+ )
+ . $crlf
+ . implode(
+ $crlf,
+ array_slice( $sql_lines, $j, $sql_count - 1 )
+ );
+ unset( $sql_lines );
+
+ $alter_table_query = $sql_constraints_query;
+
+ return $create_query;
+ }
+ }
+
+ return $create_query;
+ }
+
+ /**
+ * Loops over data in the provided table to perform a migration.
+ *
+ * @param string $table
+ *
+ * @return mixed
+ */
+ function process_table( $table ) {
+ global $wpdb;
+
+ // Setup form data
+ $this->setup_form_data();
+
+ $temp_prefix = ( isset( $this->state_data['temp_prefix'] ) ? $this->state_data['temp_prefix'] : $this->temp_prefix );
+ $site_details = empty( $this->state_data['site_details'] ) ? array() : $this->state_data['site_details'];
+ $target_table_name = apply_filters( 'wpmdb_target_table_name', $table, $this->form_data['action'], $this->state_data['stage'], $site_details );
+ $temp_table_name = $temp_prefix . $target_table_name;
+ $structure_info = $this->get_structure_info( $table );
+ $row_start = $this->get_current_row();
+ $this->row_tracker = $row_start;
+
+ if ( ! is_array ( $structure_info ) ) {
+ return $structure_info;
+ }
+
+ $this->pre_process_data( $table, $target_table_name, $temp_table_name );
+
+ do {
+ // Build and run the query
+ $select_sql = $this->build_select_query( $table, $row_start, $structure_info );
+ $table_data = $wpdb->get_results( $select_sql );
+
+ if ( ! is_array( $table_data ) ) continue;
+
+ $to_search = isset( $this->find_replace_pairs['replace_old'] ) ? $this->find_replace_pairs['replace_old'] : '';
+ $to_replace = isset( $this->find_replace_pairs['replace_new'] ) ? $this->find_replace_pairs['replace_new'] : '';
+ $replacer = new WPMDB_Replace( array(
+ 'table' => ( 'find_replace' === $this->state_data['stage'] ) ? $temp_table_name : $table,
+ 'search' => $to_search,
+ 'replace' => $to_replace,
+ 'intent' => $this->state_data['intent'],
+ 'base_domain' => $this->get_domain_replace(),
+ 'site_domain' => $this->get_domain_current_site(),
+ 'wpmdb' => $this,
+ 'site_details' => $site_details,
+ ) );
+
+ $this->start_query_buffer( $target_table_name, $temp_table_name, $structure_info );
+
+ // Loop over the results
+ foreach ( $table_data as $row ) {
+ $result = $this->process_row( $table, $replacer, $row, $structure_info );
+ if ( ! is_bool( $result ) ) {
+ return $result;
+ }
+ }
+
+ $this->stow_query_buffer();
+ $row_start += $this->rows_per_segment;
+
+ } while ( count( $table_data ) > 0 );
+
+ // Finalize and return.
+ $this->post_process_data( $table, $target_table_name );
+ return $this->transfer_chunk();
+ }
+
+ /**
+ * Initializes the query buffer and template.
+ *
+ * @param $target_table_name
+ * @param $temp_table_name
+ * @param $structure_info
+ *
+ * @return null
+ */
+ function start_query_buffer( $target_table_name, $temp_table_name, $structure_info ) {
+ if ( 'find_replace' !== $this->state_data['stage'] ) {
+ $fields = implode( ', ', $structure_info['field_set'] );
+ $table_to_insert = $temp_table_name;
+
+ if ( 'savefile' === $this->form_data['action'] || 'backup' === $this->state_data['stage'] ) {
+ $table_to_insert = $target_table_name;
+ }
+
+ $this->query_template = 'INSERT INTO ' . $this->backquote( $table_to_insert ) . ' ( ' . $fields . ") VALUES\n";
+ }
+
+ $this->query_buffer = $this->query_template;
+ }
+
+ /**
+ * Responsible for stowing a chunk of processed data.
+ */
+ function stow_query_buffer() {
+ if ( $this->query_buffer !== $this->query_template ) {
+ $this->query_buffer = rtrim( $this->query_buffer, "\n," );
+ $this->query_buffer .= " ;\n";
+ $this->stow( $this->query_buffer );
+ $this->query_buffer = $this->query_template;
+ $this->query_size = 0;
+ }
+ }
+
+ /**
+ * Sets up the form data for the migration.
+ */
+ function setup_form_data() {
+ $this->set_time_limit();
+ $this->set_post_data();
+
+ if ( empty( $this->form_data ) ) {
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
+ }
+ }
+
+ /**
+ * Returns the current row, checking the state data.
+ *
+ * @return int
+ */
+ function get_current_row() {
+ $current_row = 0;
+
+ if ( ! empty( $this->state_data['current_row'] ) ) {
+ $temp_current_row = trim( $this->state_data['current_row'] );
+ if ( ! empty( $temp_current_row ) ) {
+ $current_row = (int) $temp_current_row;
+ }
+ }
+
+ $current_row = ( 0 > $current_row ) ? 0 : $current_row;
+
+ return $current_row;
+ }
+
+ /**
+ * Returns the table structure for the provided table.
+ *
+ * @param string $table
+ *
+ * @return array|bool
+ */
+ function get_table_structure( $table ) {
+ global $wpdb;
+
+ $table_structure = false;
+
+ if ( $this->table_exists( $table ) ) {
+ $table_structure = $wpdb->get_results( 'DESCRIBE ' . $this->backquote( $table ) );
+ }
+
+ if ( ! $table_structure ) {
+ $this->error = __( 'Failed to retrieve table structure, please ensure your database is online. (#125)', 'wp-migrate-db' );
+ }
+
+ return $table_structure;
+ }
+
+ /**
+ * Parses the provided table structure.
+ *
+ * @param array $table_structure
+ *
+ * @return array
+ */
+ function get_structure_info( $table, $table_structure = array() ) {
+ if ( empty( $table_structure ) ) {
+ $table_structure = $this->get_table_structure( $table );
+ }
+
+ if ( ! is_array( $table_structure ) ) {
+ $return = array( 'wpmdb_error' => 1, 'body' => __( 'Failed to get table structure.', 'wpmdb' ) );
+ $result = $this->end_ajax( json_encode( $return ) );
+ return $result;
+ }
+
+ // $defs = mysql defaults, looks up the default for that particular column, used later on to prevent empty inserts values for that column
+ // $ints = holds a list of the possible integer types so as to not wrap them in quotation marks later in the insert statements
+ $defs = array();
+ $ints = array();
+ $bins = array();
+ $bits = array();
+ $field_set = array();
+ $this->primary_keys = array();
+ $use_primary_keys = true;
+
+ foreach ( $table_structure as $struct ) {
+ if ( ( 0 === strpos( $struct->Type, 'tinyint' ) ) ||
+ ( 0 === strpos( strtolower( $struct->Type ), 'smallint' ) ) ||
+ ( 0 === strpos( strtolower( $struct->Type ), 'mediumint' ) ) ||
+ ( 0 === strpos( strtolower( $struct->Type ), 'int' ) ) ||
+ ( 0 === strpos( strtolower( $struct->Type ), 'bigint' ) )
+ ) {
+ $defs[ strtolower( $struct->Field ) ] = ( null === $struct->Default ) ? 'NULL' : $struct->Default;
+ $ints[ strtolower( $struct->Field ) ] = '1';
+ } elseif ( 0 === strpos( $struct->Type, 'binary' ) ) {
+ $bins[ strtolower( $struct->Field ) ] = '1';
+ } elseif ( 0 === strpos( $struct->Type, 'bit' ) ) {
+ $bits[ strtolower( $struct->Field ) ] = '1';
+ }
+
+ $field_set[] = $this->backquote( $struct->Field );
+
+ if ( 'PRI' === $struct->Key && true === $use_primary_keys ) {
+ if ( false === strpos( $struct->Type, 'int' ) ) {
+ $use_primary_keys = false;
+ $this->primary_keys = array();
+ continue;
+ }
+ $this->primary_keys[ $struct->Field ] = 0;
+ }
+ }
+
+ if ( ! empty( $this->state_data['primary_keys'] ) ) {
+ $this->state_data['primary_keys'] = trim( $this->state_data['primary_keys'] );
+ $this->primary_keys = WPMDB_Utils::unserialize( stripslashes( $this->state_data['primary_keys'] ), __METHOD__ );
+ if ( false !== $this->primary_keys && ! empty( $this->state_data['primary_keys'] ) ) {
+ $this->first_select = false;
+ }
+ }
+
+ $return = array(
+ 'defs' => $defs,
+ 'ints' => $ints,
+ 'bins' => $bins,
+ 'bits' => $bits,
+ 'field_set' => $field_set,
+ );
+
+ return $return;
+ }
+
+ /**
+ * Runs before processing the data in a table.
+ *
+ * @param string $table
+ * @param string $target_table_name
+ * @param string $temp_table_name
+ */
+ function pre_process_data( $table, $target_table_name, $temp_table_name ) {
+ if ( 0 !== $this->row_tracker ) return;
+
+ if ( 'find_replace' === $this->form_data['action'] ) {
+ if ( 'backup' === $this->state_data['stage'] ) {
+ $this->build_table_header( $table, $target_table_name, $temp_table_name );
+ } else {
+ $create = $this->create_temp_table( $table );
+
+ if ( true !== $create ) {
+ $message = sprintf( __( 'Error creating temporary table. Table "%s" does not exist.', 'wp-migrate-db' ), esc_html( $table ) );
+ return $this->end_ajax( json_encode( array( 'wpmdb_error', 1, 'body' => $message ) ) );
+ }
+ }
+ } else {
+ $this->build_table_header( $table, $target_table_name, $temp_table_name );
+ }
+
+ /**
+ * Fires just before processing the data for a table.
+ *
+ * @param string $table
+ * @param string $target_table_name
+ * @param string $temp_table_name
+ */
+ do_action( 'wpmdb_pre_process_table_data', $table, $target_table_name, $temp_table_name );
+ }
+
+ /**
+ * Creates a temporary table with a copy of the existing table's data.
+ *
+ * @param $table
+ *
+ * @return bool|mixed
+ */
+ function create_temp_table( $table ) {
+ if ( $this->table_exists( $table ) ) {
+ $src_table = $this->backquote( $table );
+ $temp_table = $this->backquote( $this->temp_prefix . $table );
+ $query = "DROP TABLE IF EXISTS {$temp_table};\n";
+ $query .= "CREATE TABLE {$temp_table} LIKE {$src_table};\n";
+ $query .= "INSERT INTO {$temp_table} SELECT * FROM {$src_table};";
+
+ return $this->process_chunk( $query );
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if a given table exists.
+ *
+ * @param $table
+ *
+ * @return bool
+ */
+ function table_exists( $table ) {
+ global $wpdb;
+
+ $table = esc_sql( $table );
+
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Runs after processing data in a table.
+ *
+ * @param string $table
+ * @param string $target_table_name
+ */
+ function post_process_data( $table, $target_table_name ) {
+ if ( 'savefile' == $this->form_data['action'] || 'backup' == $this->state_data['stage'] ) {
+ $this->build_table_footer( $table, $target_table_name );
+ }
+
+ /**
+ * Fires just after processing the data for a table.
+ *
+ * @param string $table
+ * @param string $target_table_name
+ */
+ do_action( 'wpmdb_post_process_table_data', $table, $target_table_name );
+
+ $this->row_tracker = -1;
+ }
+
+ /**
+ * Creates the header for a table in a SQL file.
+ *
+ * @param string $table
+ * @param string $target_table_name
+ * @param string $temp_table_name
+ *
+ * @return null|bool
+ */
+ function build_table_header( $table, $target_table_name, $temp_table_name ) {
+ global $wpdb;
+
+ // Don't stow data until after `wpmdb_create_table_query` filter is applied as mysql_compat_filter() can return an error
+ $stow = '';
+ $is_backup = false;
+ $table_to_stow = $temp_table_name;
+
+ if ( 'savefile' === $this->form_data['action'] || 'backup' === $this->state_data['stage'] ) {
+ $is_backup = true;
+ $table_to_stow = $target_table_name;
+ }
+
+ // Add SQL statement to drop existing table
+ if ( $is_backup ) {
+ $stow .= ( "\n\n" );
+ $stow .= ( "#\n" );
+ $stow .= ( '# ' . sprintf( __( 'Delete any existing table %s', 'wp-migrate-db' ), $this->backquote( $table_to_stow ) ) . "\n" );
+ $stow .= ( "#\n" );
+ $stow .= ( "\n" );
+ }
+ $stow .= ( 'DROP TABLE IF EXISTS ' . $this->backquote( $table_to_stow ) . ";\n" );
+
+ // Table structure
+ // Comment in SQL-file
+ if ( $is_backup ) {
+ $stow .= ( "\n\n" );
+ $stow .= ( "#\n" );
+ $stow .= ( '# ' . sprintf( __( 'Table structure of table %s', 'wp-migrate-db' ), $this->backquote( $table_to_stow ) ) . "\n" );
+ $stow .= ( "#\n" );
+ $stow .= ( "\n" );
+ }
+
+ $create_table = $wpdb->get_results( 'SHOW CREATE TABLE ' . $this->backquote( $table ), ARRAY_N );
+
+ if ( false === $create_table ) {
+ $this->error = __( 'Failed to generate the create table query, please ensure your database is online. (#126)', 'wp-migrate-db' );
+
+ return false;
+ }
+ $create_table[0][1] = str_replace( 'CREATE TABLE `' . $table . '`', 'CREATE TABLE `' . $table_to_stow . '`', $create_table[0][1] );
+ $create_table[0][1] = str_replace( 'TYPE=', 'ENGINE=', $create_table[0][1] );
+
+ $alter_table_query = '';
+ $create_table[0][1] = $this->process_sql_constraint( $create_table[0][1], $target_table_name, $alter_table_query );
+
+ $create_table[0][1] = apply_filters( 'wpmdb_create_table_query', $create_table[0][1], $table_to_stow, $this->target_db_version, $this->form_data['action'], $this->state_data['stage'] );
+ $stow .= ( $create_table[0][1] . ";\n" );
+
+ $this->stow( $stow );
+
+ if ( ! empty( $alter_table_query ) ) {
+ $alter_table_name = $this->get_alter_table_name();
+ $insert = sprintf( "INSERT INTO %s ( `query` ) VALUES ( '%s' );\n", $this->backquote( $alter_table_name ), esc_sql( $alter_table_query ) );
+
+ if ( $is_backup ) {
+ $process_chunk_result = $this->process_chunk( $insert );
+ if ( true !== $process_chunk_result ) {
+ $result = $this->end_ajax( $process_chunk_result );
+
+ return $result;
+ }
+ } else {
+ $this->stow( $insert );
+ }
+ }
+
+ $alter_data_queries = array();
+ $alter_data_queries = apply_filters( 'wpmdb_alter_data_queries', $alter_data_queries, $table_to_stow, $this->form_data['action'], $this->state_data['stage'] );
+
+ if ( ! empty( $alter_data_queries ) ) {
+ $alter_table_name = $this->get_alter_table_name();
+ $insert = '';
+ foreach ( $alter_data_queries as $alter_data_query ) {
+ $insert .= sprintf( "INSERT INTO %s ( `query` ) VALUES ( '%s' );\n", $this->backquote( $alter_table_name ), esc_sql( $alter_data_query ) );
+ }
+ if ( $is_backup ) {
+ $process_chunk_result = $this->process_chunk( $insert );
+ if ( true !== $process_chunk_result ) {
+ $result = $this->end_ajax( $process_chunk_result );
+
+ return $result;
+ }
+ } else {
+ $this->stow( $insert );
+ }
+ }
+
+ // Comment in SQL-file
+ if ( $is_backup ) {
+ $this->stow( "\n\n" );
+ $this->stow( "#\n" );
+ $this->stow( '# ' . sprintf( __( 'Data contents of table %s', 'wp-migrate-db' ), $this->backquote( $table_to_stow ) ) . "\n" );
+ $this->stow( "#\n" );
+ }
+ }
+
+ /**
+ * Creates the footer for a table in a SQL file.
+ *
+ * @param $table
+ * @param $target_table_name
+ *
+ * @return null
+ */
+ function build_table_footer( $table, $target_table_name ) {
+ global $wpdb;
+
+ $this->stow( "\n" );
+ $this->stow( "#\n" );
+ $this->stow( '# ' . sprintf( __( 'End of data contents of table %s', 'wp-migrate-db' ), $this->backquote( $target_table_name ) ) . "\n" );
+ $this->stow( "# --------------------------------------------------------\n" );
+ $this->stow( "\n" );
+
+ if ( $this->state_data['last_table'] == '1' ) {
+ $this->stow( "#\n" );
+ $this->stow( "# Add constraints back in and apply any alter data queries.\n" );
+ $this->stow( "#\n\n" );
+ $this->stow( $this->get_alter_queries() );
+ $alter_table_name = $this->get_alter_table_name();
+
+ $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->backquote( $alter_table_name ) . ';' );
+
+ if ( 'backup' == $this->state_data['stage'] ) {
+ // Re-create our table to store 'ALTER' queries so we don't get duplicates.
+ $create_alter_table_query = $this->get_create_alter_table_query();
+ $process_chunk_result = $this->process_chunk( $create_alter_table_query );
+ if ( true !== $process_chunk_result ) {
+ $result = $this->end_ajax( $process_chunk_result );
+
+ return $result;
+ }
+ }
+ }
+ }
+
+ /**
+ * Builds the SELECT query to get data to migrate.
+ *
+ * @param string $table
+ * @param int $row_start
+ * @param array $structure_info
+ *
+ * @return string
+ */
+ function build_select_query( $table, $row_start, $structure_info ) {
+ global $wpdb;
+
+ $join = array();
+ $where = 'WHERE 1=1';
+ $order_by = '';
+
+ // We need ORDER BY here because with LIMIT, sometimes it will return
+ // the same results from the previous query and we'll have duplicate insert statements
+ if ( 'backup' != $this->state_data['stage'] && false === empty( $this->form_data['exclude_spam'] ) ) {
+ if ( $this->table_is( 'comments', $table ) ) {
+ $where .= ' AND comment_approved != "spam"';
+ } elseif ( $this->table_is( 'commentmeta', $table ) ) {
+ $tables = $this->get_ms_compat_table_names( array( 'commentmeta', 'comments' ), $table );
+ $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.comment_ID = %2$s.comment_id', $this->backquote( $tables['comments_table'] ), $this->backquote( $tables['commentmeta_table'] ) );
+ $where .= sprintf( ' AND %1$s.comment_approved != \'spam\'', $this->backquote( $tables['comments_table'] ) );
+ }
+ }
+
+ if ( 'backup' != $this->state_data['stage'] && isset( $this->form_data['exclude_post_types'] ) && ! empty( $this->form_data['select_post_types'] ) ) {
+ $post_types = '\'' . implode( '\', \'', $this->form_data['select_post_types'] ) . '\'';
+ if ( $this->table_is( 'posts', $table ) ) {
+ $where .= ' AND `post_type` NOT IN ( ' . $post_types . ' )';
+ } elseif ( $this->table_is( 'postmeta', $table ) ) {
+ $tables = $this->get_ms_compat_table_names( array( 'postmeta', 'posts' ), $table );
+ $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.ID = %2$s.post_id', $this->backquote( $tables['posts_table'] ), $this->backquote( $tables['postmeta_table'] ) );
+ $where .= sprintf( ' AND %1$s.post_type NOT IN ( ' . $post_types . ' )', $this->backquote( $tables['posts_table'] ) );
+ } elseif ( $this->table_is( 'comments', $table ) ) {
+ $tables = $this->get_ms_compat_table_names( array( 'comments', 'posts' ), $table );
+ $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.ID = %2$s.comment_post_ID', $this->backquote( $tables['posts_table'] ), $this->backquote( $tables['comments_table'] ) );
+ $where .= sprintf( ' AND %1$s.post_type NOT IN ( ' . $post_types . ' )', $this->backquote( $tables['posts_table'] ) );
+ } elseif ( $this->table_is( 'commentmeta', $table ) ) {
+ $tables = $this->get_ms_compat_table_names( array( 'commentmeta', 'posts', 'comments' ), $table );
+ $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.comment_ID = %2$s.comment_id', $this->backquote( $tables['comments_table'] ), $this->backquote( $tables['commentmeta_table'] ) );
+ $join[] = sprintf( 'INNER JOIN %2$s ON %2$s.ID = %1$s.comment_post_ID', $this->backquote( $tables['comments_table'] ), $this->backquote( $tables['posts_table'] ) );
+ $where .= sprintf( ' AND %1$s.post_type NOT IN ( ' . $post_types . ' )', $this->backquote( $tables['posts_table'] ) );
+ }
+ }
+
+ if ( 'backup' != $this->state_data['stage'] && true === apply_filters( 'wpmdb_exclude_transients', true ) && isset( $this->form_data['exclude_transients'] ) && '1' === $this->form_data['exclude_transients'] && ( $this->table_is( 'options', $table ) || ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) ) ) {
+ $col_name = 'option_name';
+
+ if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
+ $col_name = 'meta_key';
+ }
+
+ $where .= " AND `{$col_name}` NOT LIKE '\_transient\_%' AND `{$col_name}` NOT LIKE '\_site\_transient\_%'";
+ }
+
+ // don't export/migrate wpmdb specific option rows unless we're performing a backup
+ if ( 'backup' != $this->state_data['stage'] && ( $this->table_is( 'options', $table ) || ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) ) ) {
+ $col_name = 'option_name';
+
+ if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
+ $col_name = 'meta_key';
+ }
+
+ $where .= " AND `{$col_name}` != 'wpmdb_settings'";
+ $where .= " AND `{$col_name}` != 'wpmdb_error_log'";
+ $where .= " AND `{$col_name}` != 'wpmdb_schema_version'";
+ $where .= " AND `{$col_name}` NOT LIKE 'wpmdb_state_%'";
+ }
+
+ $limit = "LIMIT {$row_start}, {$this->rows_per_segment}";
+
+ if ( ! empty( $this->primary_keys ) ) {
+ $primary_keys_keys = array_keys( $this->primary_keys );
+ $primary_keys_keys = array_map( array( $this, 'backquote' ), $primary_keys_keys );
+
+ $order_by = 'ORDER BY ' . implode( ',', $primary_keys_keys );
+ $limit = "LIMIT {$this->rows_per_segment}";
+
+ if ( false === $this->first_select ) {
+ $where .= ' AND ';
+
+ $temp_primary_keys = $this->primary_keys;
+ $primary_key_count = count( $temp_primary_keys );
+
+ // build a list of clauses, iteratively reducing the number of fields compared in the compound key
+ // e.g. (a = 1 AND b = 2 AND c > 3) OR (a = 1 AND b > 2) OR (a > 1)
+ $clauses = array();
+ for ( $j = 0; $j < $primary_key_count; $j++ ) {
+ // build a subclause for each field in the compound index
+ $subclauses = array();
+ $i = 0;
+ foreach ( $temp_primary_keys as $primary_key => $value ) {
+ // only the last field in the key should be different in this subclause
+ $operator = ( count( $temp_primary_keys ) - 1 == $i ? '>' : '=' );
+ $subclauses[] = sprintf( '%s %s %s', $this->backquote( $primary_key ), $operator, $wpdb->prepare( '%s', $value ) );
+ ++$i;
+ }
+
+ // remove last field from array to reduce fields in next clause
+ array_pop( $temp_primary_keys );
+
+ // join subclauses into a single clause
+ // NB: AND needs to be wrapped in () as it has higher precedence than OR
+ $clauses[] = '( ' . implode( ' AND ', $subclauses ) . ' )';
+ }
+ // join clauses into a single clause
+ // NB: OR needs to be wrapped in () as it has lower precedence than AND
+ $where .= '( ' . implode( ' OR ', $clauses ) . ' )';
+ }
+
+ $this->first_select = false;
+ }
+
+ $sel = $this->backquote( $table ) . '.*';
+ if ( ! empty( $structure_info['bins'] ) ) {
+ foreach ( $structure_info['bins'] as $key => $bin ) {
+ $hex_key = strtolower( $key ) . '__hex';
+ $sel .= ', HEX(' . $this->backquote( $key ) . ') as ' . $this->backquote( $hex_key );
+ }
+ }
+ if ( ! empty( $structure_info['bits'] ) ) {
+ foreach ( $structure_info['bits'] as $key => $bit ) {
+ $bit_key = strtolower( $key ) . '__bit';
+ $sel .= ', ' . $this->backquote( $key ) . '+0 as ' . $this->backquote( $bit_key );
+ }
+ }
+ $join = implode( ' ', array_unique( $join ) );
+ $join = apply_filters( 'wpmdb_rows_join', $join, $table );
+ $where = apply_filters( 'wpmdb_rows_where', $where, $table );
+ $order_by = apply_filters( 'wpmdb_rows_order_by', $order_by, $table );
+ $limit = apply_filters( 'wpmdb_rows_limit', $limit, $table );
+
+ $sql = 'SELECT ' . $sel . ' FROM ' . $this->backquote( $table ) . " $join $where $order_by $limit";
+ $sql = apply_filters( 'wpmdb_rows_sql', $sql, $table );
+
+ return $sql;
+ }
+
+ /**
+ * Processes the data in a given row.
+ *
+ * @param string $table
+ * @param object $replacer
+ * @param array $row
+ * @param array $structure_info
+ *
+ * @return array|void
+ */
+ function process_row( $table, $replacer, $row, $structure_info ) {
+ global $wpdb;
+
+ $skip_row = false;
+ $updates_pending = false;
+ $update_sql = array();
+ $where_sql = array();
+ $values = array();
+ $query = '';
+
+ if ( ! apply_filters( 'wpmdb_table_row', $row, $table, $this->form_data['action'], $this->state_data['stage'] ) ) {
+ $skip_row = true;
+ }
+
+ if ( ! $skip_row ) {
+
+ foreach ( $row as $key => $value ) {
+ $data_to_fix = $value;
+
+ if ( 'find_replace' === $this->state_data['stage'] && in_array( $key, array_keys( $this->primary_keys ) ) ) {
+ $where_sql[] = $this->backquote( $key ) . ' = "' . $this->mysql_escape_mimic( $data_to_fix ) . '"';
+ continue;
+ }
+
+ $replacer->set_column( $key );
+
+ if ( isset( $structure_info['ints'][ strtolower( $key ) ] ) && $structure_info['ints'][ strtolower( $key ) ] ) {
+ // make sure there are no blank spots in the insert syntax,
+ // yet try to avoid quotation marks around integers
+ $value = ( null === $value || '' === $value ) ? $structure_info['defs'][ strtolower( $key ) ] : $value;
+ $values[] = ( '' === $value ) ? "''" : $value;
+ continue;
+ }
+
+ if ( null === $value ) {
+ $values[] = 'NULL';
+ continue;
+ }
+
+ // If we have binary data, substitute in hex encoded version and remove hex encoded version from row.
+ $hex_key = strtolower( $key ) . '__hex';
+ if ( isset( $structure_info['bins'][ strtolower( $key ) ] ) && $structure_info['bins'][ strtolower( $key ) ] && isset( $row->$hex_key ) ) {
+ $value = "UNHEX('" . $row->$hex_key . "')";
+ $values[] = $value;
+ unset( $row->$hex_key );
+ continue;
+ }
+
+ // If we have bit data, substitute in properly bit encoded version.
+ $bit_key = strtolower( $key ) . '__bit';
+ if ( isset( $structure_info['bits'][ strtolower( $key ) ] ) && $structure_info['bits'][ strtolower( $key ) ] && isset( $row->$bit_key ) ) {
+ $value = "b'" . $row->$bit_key . "'";
+ $values[] = $value;
+ unset( $row->$bit_key );
+ continue;
+ }
+
+ if ( is_multisite() && ( $wpdb->site == $table || $wpdb->blogs == $table ) ) {
+
+ if ( ! in_array( $this->state_data['stage'], array( 'backup', 'find_replace' ) ) ) {
+
+ if ( 'path' == $key ) {
+ $old_path_current_site = $this->get_path_current_site();
+ $new_path_current_site = '';
+
+ if ( ! empty( $this->state_data['path_current_site'] ) ) {
+ $new_path_current_site = $this->state_data['path_current_site'];
+ } elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
+ $new_path_current_site = $this->get_path_from_url( $this->form_data['replace_new'][1] );
+ }
+
+ $new_path_current_site = apply_filters( 'wpmdb_new_path_current_site', $new_path_current_site );
+
+ if ( ! empty( $new_path_current_site ) && $old_path_current_site != $new_path_current_site ) {
+ $pos = strpos( $value, $old_path_current_site );
+ $value = substr_replace( $value, $new_path_current_site, $pos, strlen( $old_path_current_site ) );
+ }
+ }
+
+ if ( 'domain' == $key ) {
+ if ( ! empty( $this->state_data['domain_current_site'] ) ) {
+ $main_domain_replace = $this->state_data['domain_current_site'];
+ } elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
+ $url = $this->parse_url( $this->form_data['replace_new'][1] );
+ $main_domain_replace = $url['host'];
+ }
+
+ $domain_replaces = array();
+ $main_domain_find = sprintf( '/%s/', preg_quote( $this->get_domain_current_site(), '/' ) );
+ if ( isset( $main_domain_replace ) ) {
+ $domain_replaces[ $main_domain_find ] = $main_domain_replace;
+ }
+
+ $domain_replaces = apply_filters( 'wpmdb_domain_replaces', $domain_replaces );
+
+ $value = preg_replace( array_keys( $domain_replaces ), array_values( $domain_replaces ), $value );
+ }
+ }
+ }
+
+ if ( 'guid' != $key || ( false === empty( $this->form_data['replace_guids'] ) && $this->table_is( 'posts', $table ) ) ) {
+ if ( $this->state_data['stage'] != 'backup' ) {
+ $value = $replacer->recursive_unserialize_replace( $value );
+ }
+ }
+
+ if ( 'find_replace' === $this->state_data['stage'] ) {
+ $value = $this->mysql_escape_mimic( $value );
+ $data_to_fix = $this->mysql_escape_mimic( $data_to_fix );
+
+ if ( $value !== $data_to_fix ) {
+ $update_sql[] = $this->backquote( $key ) . ' = "' . $value . '"';
+ $updates_pending = true;
+ }
+ } else {
+ // \x08\\x09, not required
+ $multibyte_search = array( "\x00", "\x0a", "\x0d", "\x1a" );
+ $multibyte_replace = array( '\0', '\n', '\r', '\Z' );
+
+ $value = $this->sql_addslashes( $value );
+ $value = str_replace( $multibyte_search, $multibyte_replace, $value );
+ }
+
+ $values[] = "'" . $value . "'";
+ }
+
+ // Determine what to do with updates.
+ if ( 'find_replace' === $this->state_data['stage'] ) {
+ if ( $updates_pending && ! empty( $where_sql ) ) {
+ $table_to_update = $this->backquote( $this->temp_prefix . $table );
+ $query .= 'UPDATE ' . $table_to_update . ' SET ' . implode( ', ', $update_sql ) . ' WHERE ' . implode( ' AND ', array_filter( $where_sql ) ) . ";\n";
+ }
+ } else {
+ $query .= '(' . implode( ', ', $values ) . '),' . "\n";
+ }
+ }
+
+ if ( ( strlen( $this->current_chunk ) + strlen( $query ) + strlen( $this->query_buffer ) + 30 ) > $this->maximum_chunk_size ) {
+ if ( $this->query_buffer == $this->query_template ) {
+ $this->query_buffer .= $query;
+
+ ++$this->row_tracker;
+
+ if ( ! empty( $this->primary_keys ) ) {
+ foreach ( $this->primary_keys as $primary_key => $value ) {
+ $this->primary_keys[ $primary_key ] = $row->$primary_key;
+ }
+ }
+ }
+
+ $this->stow_query_buffer();
+ return $this->transfer_chunk();
+ }
+
+ if ( ( $this->query_size + strlen( $query ) ) > $this->max_insert_string_len ) {
+ $this->stow_query_buffer();
+ }
+
+ $this->query_buffer .= $query;
+ $this->query_size += strlen( $query );
+
+ ++$this->row_tracker;
+
+ if ( ! empty( $this->primary_keys ) ) {
+ foreach ( $this->primary_keys as $primary_key => $value ) {
+ $this->primary_keys[ $primary_key ] = $row->$primary_key;
+ }
+ }
+
+ return true;
+ }
+
+ function delete_temporary_tables( $prefix ) {
+ $tables = $this->get_tables();
+ $delete_queries = '';
+
+ foreach ( $tables as $table ) {
+ if ( 0 !== strpos( $table, $prefix ) ) {
+ continue;
+ }
+ $delete_queries .= sprintf( "DROP TABLE %s;\n", $this->backquote( $table ) );
+ }
+
+ $this->process_chunk( $delete_queries );
+ }
+
+ /**
+ * Mimics the mysql_real_escape_string function. Adapted from a post by 'feedr' on php.net.
+ *
+ * @link http://php.net/manual/en/function.mysql-real-escape-string.php#101248
+ * @param string $input The string to escape.
+ *
+ * @return string
+ */
+ function mysql_escape_mimic( $input ) {
+ if ( is_array( $input ) ) {
+ return array_map( __METHOD__, $input );
+ }
+ if ( ! empty( $input ) && is_string( $input ) ) {
+ return str_replace( array( '\\', "\0", "\n", "\r", "'", '"', "\x1a" ), array( '\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z' ), $input );
+ }
+
+ return $input;
+ }
+
+ /**
+ * Check that the given table is of the desired type,
+ * including single and multisite installs.
+ * eg: wp_posts, wp_2_posts
+ *
+ * The scope argument can take one of the following:
+ *
+ * 'table' - Match on the un-prefixed table name, this is the default.
+ * 'all' - Match on 'blog' and 'global' tables. No old tables are returned.
+ * 'blog' - Match the blog-level tables for the queried blog.
+ * 'global' - Match the global tables for the installation, matching multisite tables only if running multisite.
+ * 'ms_global' - Match the multisite global tables, regardless if current installation is multisite.
+ * 'non_ms_global' - Match the non multisite global tables, regardless if current installation is multisite.
+ * 'old' - Matches tables which are deprecated.
+ *
+ * @param string $desired_table Can be empty to match on tables from scopes other than 'table'.
+ * @param string $given_table
+ * @param string $scope Optional type of table to match against, default is 'table'.
+ * @param string $new_prefix Optional new prefix already added to $given_table.
+ * @param int $blog_id Optional Only used with 'blog' scope to test against a specific subsite's tables other than current for $wpdb.
+ *
+ * @return boolean
+ */
+ function table_is( $desired_table, $given_table, $scope = 'table', $new_prefix = '', $blog_id = 0 ) {
+ global $wpdb;
+
+ $scopes = array( 'all', 'blog', 'global', 'ms_global', 'non_ms_global', 'old' );
+
+ if ( ! in_array( $scope, $scopes ) ) {
+ $scope = 'table';
+ }
+
+ if ( empty( $desired_table ) && 'table' === $scope ) {
+ return false;
+ }
+
+ if ( ! empty( $new_prefix ) && 0 === stripos( $given_table, $new_prefix ) ) {
+ $given_table = substr_replace( $given_table, $wpdb->base_prefix, 0, strlen( $new_prefix ) );
+ }
+
+ $match = false;
+ $prefix_escaped = preg_quote( $wpdb->base_prefix, '/' );
+ $desired_table_escaped = preg_quote( $desired_table, '/' );
+
+ if ( 'table' === $scope ) {
+ if ( $wpdb->{$desired_table} == $given_table ||
+ preg_match( '/' . $prefix_escaped . '[0-9]+_' . $desired_table_escaped . '/', $given_table )
+ ) {
+ $match = true;
+ }
+ } else {
+ if ( 'non_ms_global' === $scope ) {
+ $tables = array_diff_key( $wpdb->tables( 'global', true, $blog_id ), $wpdb->tables( 'ms_global', true, $blog_id ) );
+ } else {
+ $tables = $wpdb->tables( $scope, true, $blog_id );
+ }
+
+ if ( ! empty( $desired_table ) ) {
+ $tables = array_intersect_key( $tables, array( $desired_table => '' ) );
+ }
+
+ if ( ! empty( $tables ) ) {
+ foreach ( $tables as $table_name ) {
+ if ( ! empty( $table_name ) && strtolower( $table_name ) === strtolower( $given_table ) ) {
+ $match = true;
+ break;
+ }
+ }
+ }
+ }
+
+ return $match;
+ }
+
+ /**
+ * Return multisite-compatible names for requested
+ * tables, based on queried table name
+ *
+ * @param array $tables List of table names required
+ * @param string $queried_table Name of table from which to derive the blog ID
+ *
+ * @return array List of table names altered for multisite compatibility
+ */
+ function get_ms_compat_table_names( $tables, $queried_table ) {
+ global $wpdb;
+
+ // default table prefix
+ $prefix = $wpdb->base_prefix;
+ $prefix_escaped = preg_quote( $prefix, '/' );
+
+ // if multisite, extract blog ID from queried table name and add to prefix
+ // won't match for primary blog because it uses standard table names, i.e. blog_id will never be 1
+ if ( is_multisite() && preg_match( '/^' . $prefix_escaped . '([0-9]+)_/', $queried_table, $matches ) ) {
+ $blog_id = $matches[1];
+ $prefix .= $blog_id . '_';
+ }
+
+ // build table names
+ $ms_compat_table_names = array();
+
+ foreach ( $tables as $table ) {
+ $ms_compat_table_names[ $table . '_table' ] = $prefix . $table;
+ }
+
+ return $ms_compat_table_names;
+ }
+
+ function db_backup_header() {
+ $charset = ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'utf8' );
+ $this->stow( '# ' . __( 'WordPress MySQL database migration', 'wp-migrate-db' ) . "\n", false );
+ $this->stow( "#\n", false );
+ $this->stow( '# ' . sprintf( __( 'Generated: %s', 'wp-migrate-db' ), date( 'l j. F Y H:i T' ) ) . "\n", false );
+ $this->stow( '# ' . sprintf( __( 'Hostname: %s', 'wp-migrate-db' ), DB_HOST ) . "\n", false );
+ $this->stow( '# ' . sprintf( __( 'Database: %s', 'wp-migrate-db' ), $this->backquote( DB_NAME ) ) . "\n", false );
+ $this->stow( "# --------------------------------------------------------\n\n", false );
+ $this->stow( "/*!40101 SET NAMES $charset */;\n\n", false );
+ $this->stow( "SET sql_mode='NO_AUTO_VALUE_ON_ZERO';\n\n", false );
+ }
+
+ function gzip() {
+ return function_exists( 'gzopen' );
+ }
+
+ function open( $filename = '', $mode = 'a' ) {
+ if ( '' == $filename ) {
+ return false;
+ }
+
+ if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
+ $fp = gzopen( $filename, $mode );
+ } else {
+ $fp = fopen( $filename, $mode );
+ }
+
+ return $fp;
+ }
+
+ function close( $fp ) {
+ if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
+ gzclose( $fp );
+ } else {
+ fclose( $fp );
+ }
+
+ unset( $this->fp );
+ }
+
+ /**
+ * Write query line to chunk, file pointer, or buffer depending on migration stage/action.
+ *
+ * @param string $query_line
+ * @param bool $replace
+ *
+ * @return bool
+ */
+ function stow( $query_line, $replace = true ) {
+ $this->set_post_data();
+ $this->current_chunk .= $query_line;
+
+ if ( 0 === strlen( $query_line ) ) {
+ return true;
+ }
+
+ if ( $this->form_data['action'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
+ if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
+ if ( ! @gzwrite( $this->fp, $query_line ) ) {
+ $this->error = __( 'Failed to write the gzipped SQL data to the file. (#127)', 'wp-migrate-db' );
+
+ return false;
+ }
+ } else {
+ // TODO: Use WP_Filesystem API.
+ if ( false === @fwrite( $this->fp, $query_line ) ) {
+ $this->error = __( 'Failed to write the SQL data to the file. (#128)', 'wp-migrate-db' );
+
+ return false;
+ }
+ }
+ } elseif ( $this->state_data['intent'] == 'pull' ) {
+ echo apply_filters( 'wpmdb_before_response', $query_line );
+ } elseif ( 'find_replace' === $this->state_data['stage'] ) {
+ return $this->process_chunk( $query_line );
+ }
+ }
+
+ /**
+ * Called once our chunk buffer is full, will transfer the SQL to the remote server for importing
+ *
+ * @return array|void
+ */
+ function transfer_chunk() {
+ $this->set_post_data();
+
+ if ( 'savefile' === $this->state_data['intent'] || 'find_replace' === $this->state_data['intent'] || 'backup' === $this->state_data['stage'] ) {
+
+ if ( 'find_replace' === $this->state_data['stage'] ) {
+ $this->process_chunk( $this->query_buffer );
+ } else {
+ $this->close( $this->fp );
+ }
+
+ $result = array(
+ 'current_row' => $this->row_tracker,
+ 'primary_keys' => serialize( $this->primary_keys ),
+ );
+
+ if ( $this->state_data['intent'] == 'savefile' && $this->state_data['last_table'] == '1' ) {
+ $result['dump_filename'] = $this->state_data['dump_filename'];
+ $result['dump_path'] = $this->state_data['dump_path'];
+ }
+
+ $result = $this->end_ajax( json_encode( $result ) );
+
+ return $result;
+ }
+
+ if ( $this->state_data['intent'] == 'pull' ) {
+ $result = $this->end_ajax( $this->row_tracker . ',' . serialize( $this->primary_keys ) );
+
+ return $result;
+ }
+
+ $chunk_gzipped = '0';
+ if ( isset( $this->state_data['gzip'] ) && $this->state_data['gzip'] == '1' && $this->gzip() ) {
+ $this->current_chunk = gzcompress( $this->current_chunk );
+ $chunk_gzipped = '1';
+ }
+
+ $data = array(
+ 'action' => 'wpmdb_process_chunk',
+ 'remote_state_id' => $this->state_data['remote_state_id'],
+ 'table' => $this->state_data['table'],
+ 'chunk_gzipped' => $chunk_gzipped,
+ 'chunk' => $this->current_chunk,
+ // NEEDS TO BE the last element in this array because of adding it back into the array in ajax_process_chunk()
+ );
+
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
+
+ $ajax_url = $this->ajax_url();
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
+
+ ob_start();
+ $this->display_errors();
+ $maybe_errors = trim( ob_get_clean() );
+
+ if ( false === empty( $maybe_errors ) ) {
+ $maybe_errors = array( 'wpmdb_error' => 1, 'body' => $maybe_errors );
+ $result = $this->end_ajax( json_encode( $maybe_errors ) );
+
+ return $result;
+ }
+
+ if ( '1' !== $response ) {
+ $return = array( 'wpmdb_error' => 1, 'body' => $response );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ $result = $this->end_ajax( json_encode(
+ array(
+ 'current_row' => $this->row_tracker,
+ 'primary_keys' => serialize( $this->primary_keys ),
+ )
+ ) );
+
+ return $result;
+ }
+
+ /**
+ * Add backquotes to tables and db-names in
+ * SQL queries. Taken from phpMyAdmin.
+ *
+ * @param $a_name
+ *
+ * @return array|string
+ */
+ function backquote( $a_name ) {
+ if ( ! empty( $a_name ) && $a_name != '*' ) {
+ if ( is_array( $a_name ) ) {
+ $result = array();
+ reset( $a_name );
+ while ( list( $key, $val ) = each( $a_name ) ) {
+ $result[ $key ] = '`' . $val . '`';
+ }
+
+ return $result;
+ } else {
+ return '`' . $a_name . '`';
+ }
+ } else {
+ return $a_name;
+ }
+ }
+
+ /**
+ * Better addslashes for SQL queries.
+ * Taken from phpMyAdmin.
+ *
+ * @param string $a_string
+ * @param bool $is_like
+ *
+ * @return mixed
+ */
+ function sql_addslashes( $a_string = '', $is_like = false ) {
+ if ( $is_like ) {
+ $a_string = str_replace( '\\', '\\\\\\\\', $a_string );
+ } else {
+ $a_string = str_replace( '\\', '\\\\', $a_string );
+ }
+
+ return str_replace( '\'', '\\\'', $a_string );
+ }
+
+ function network_admin_menu() {
+ $title = ( $this->is_pro ) ? __( 'Migrate DB Pro', 'wp-migrate-db' ) : __( 'Migrate DB', 'wp-migrate-db' );
+ $hook_suffix = add_submenu_page( 'settings.php',
+ $title,
+ $title,
+ 'manage_network_options',
+ $this->core_slug,
+ array( $this, 'options_page' ) );
+ $this->after_admin_menu( $hook_suffix );
+ }
+
+ /**
+ * Add a tools menu item to sites on a Multisite network
+ *
+ */
+ function network_tools_admin_menu() {
+ add_management_page(
+ $this->get_plugin_title(),
+ $this->get_plugin_title(),
+ 'manage_network_options',
+ $this->core_slug,
+ array( $this, 'subsite_tools_options_page' )
+ );
+ }
+
+ function admin_menu() {
+ $title = ( $this->is_pro ) ? __( 'Migrate DB Pro', 'wp-migrate-db' ) : __( 'Migrate DB', 'wp-migrate-db' );
+ $hook_suffix = add_management_page( $title,
+ $title,
+ 'export',
+ $this->core_slug,
+ array( $this, 'options_page' ) );
+ $this->after_admin_menu( $hook_suffix );
+ }
+
+ function after_admin_menu( $hook_suffix ) {
+ add_action( 'admin_head-' . $hook_suffix, array( $this, 'admin_head_connection_info' ) );
+ add_action( 'load-' . $hook_suffix, array( $this, 'load_assets' ) );
+
+ // Remove licence from the database if constant is set
+ if ( $this->is_licence_constant() && ! empty( $this->settings['licence'] ) ) {
+ $this->settings['licence'] = '';
+ update_site_option( 'wpmdb_settings', $this->settings );
+ }
+ }
+
+ function admin_body_class( $classes ) {
+ if ( ! $classes ) {
+ $classes = array();
+ } else {
+ $classes = explode( ' ', $classes );
+ }
+
+ $version_class = 'wpmdb-not-pro';
+ if ( true == $this->is_pro ) {
+ $version_class = 'wpmdb-pro';
+ }
+
+ $classes[] = $version_class;
+
+ // Recommended way to target WP 3.8+
+ // http://make.wordpress.org/ui/2013/11/19/targeting-the-new-dashboard-design-in-a-post-mp6-world/
+ if ( version_compare( $GLOBALS['wp_version'], '3.8-alpha', '>' ) ) {
+ if ( ! in_array( 'mp6', $classes ) ) {
+ $classes[] = 'mp6';
+ }
+ }
+
+ return implode( ' ', $classes );
+ }
+
+ /**
+ * Check for download
+ * if found prepare file for download
+ *
+ * @return void
+ */
+ function http_verify_download() {
+ if ( ! empty( $_GET['download'] ) ) {
+ $this->download_file();
+ }
+ }
+
+ /**
+ * Check for wpmdb-download-log and related nonce
+ * if found begin diagnostic logging
+ *
+ * @return void
+ */
+ function http_prepare_download_log() {
+ if ( isset( $_GET['wpmdb-download-log'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-download-log' ) ) {
+ ob_start();
+ $this->output_diagnostic_info();
+ $this->output_log_file();
+ $log = ob_get_clean();
+ $url = $this->parse_url( home_url() );
+ $host = sanitize_file_name( $url['host'] );
+ $filename = sprintf( '%s-diagnostic-log-%s.txt', $host, date( 'YmdHis' ) );
+ header( 'Content-Description: File Transfer' );
+ header( 'Content-Type: application/octet-stream' );
+ header( 'Content-Length: ' . strlen( $log ) );
+ header( 'Content-Disposition: attachment; filename=' . $filename );
+ echo $log;
+ exit;
+ }
+ }
+
+ /**
+ * Check for wpmdb-remove-licence and related nonce
+ * if found cleanup routines related to licenced product
+ *
+ * @return void
+ */
+ function http_remove_license() {
+ if ( isset( $_GET['wpmdb-remove-licence'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-remove-licence' ) ) {
+ $this->settings['licence'] = '';
+ update_site_option( 'wpmdb_settings', $this->settings );
+ // delete these transients as they contain information only valid for authenticated licence holders
+ delete_site_transient( 'update_plugins' );
+ delete_site_transient( 'wpmdb_upgrade_data' );
+ delete_site_transient( 'wpmdb_licence_response' );
+ // redirecting here because we don't want to keep the query string in the web browsers address bar
+ wp_redirect( network_admin_url( $this->plugin_base . '#settings' ) );
+ exit;
+ }
+ }
+
+ /**
+ * Check for wpmdb-disable-ssl and related nonce
+ * if found temporaily disable ssl via transient
+ *
+ * @return void
+ */
+ function http_disable_ssl() {
+ if ( isset( $_GET['wpmdb-disable-ssl'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-disable-ssl' ) ) {
+ set_site_transient( 'wpmdb_temporarily_disable_ssl', '1', 60 * 60 * 24 * 30 ); // 30 days
+ $hash = ( isset( $_GET['hash'] ) ) ? '#' . sanitize_title( $_GET['hash'] ) : '';
+ // delete the licence transient as we want to attempt to fetch the licence details again
+ delete_site_transient( 'wpmdb_licence_response' );
+ // redirecting here because we don't want to keep the query string in the web browsers address bar
+ wp_redirect( network_admin_url( $this->plugin_base . $hash ) );
+ exit;
+ }
+ }
+
+ /**
+ * Check for wpmdb-check-licence and related nonce
+ * if found refresh licence details
+ *
+ * @return void
+ */
+ function http_refresh_licence() {
+ if ( isset( $_GET['wpmdb-check-licence'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-check-licence' ) ) {
+ $hash = ( isset( $_GET['hash'] ) ) ? '#' . sanitize_title( $_GET['hash'] ) : '';
+ // delete the licence transient as we want to attempt to fetch the licence details again
+ delete_site_transient( 'wpmdb_licence_response' );
+ // redirecting here because we don't want to keep the query string in the web browsers address bar
+ wp_redirect( network_admin_url( $this->plugin_base . $hash ) );
+ exit;
+ }
+ }
+
+ /**
+ * Checks and sets up plugin assets.
+ * Filter actions, enqueue scripts, define configuration, and constants.
+ *
+ * @return void
+ */
+ function load_assets() {
+ $this->http_verify_download();
+ $this->http_prepare_download_log();
+ $this->http_remove_license();
+ $this->http_disable_ssl();
+ $this->http_refresh_licence();
+
+ // add our custom CSS classes to
+ add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
+
+ $plugins_url = trailingslashit( plugins_url( $this->plugin_folder_name ) );
+ $version = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? time() : $this->plugin_version;
+ $ver_string = '-' . str_replace( '.', '', $this->plugin_version );
+ $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
+
+ $src = $plugins_url . 'asset/dist/css/styles.css';
+ wp_enqueue_style( 'wp-migrate-db-pro-styles', $src, array(), $version );
+
+ $src = $plugins_url . "asset/dist/js/common{$ver_string}{$min}.js";
+ wp_enqueue_script( 'wp-migrate-db-pro-common', $src, null, $version, true );
+
+ $src = $plugins_url . "asset/dist/js/hook{$ver_string}{$min}.js";
+ wp_enqueue_script( 'wp-migrate-db-pro-hook', $src, null, $version, true );
+
+ $src = $plugins_url . "asset/dist/js/multisite{$ver_string}{$min}.js";
+ wp_enqueue_script( 'wp-migrate-db-pro-multisite', $src, array( 'jquery' ), $version, true );
+
+ do_action( 'wpmdb_load_assets' );
+
+ $src = $plugins_url . "asset/dist/js/script{$ver_string}{$min}.js";
+ wp_enqueue_script( 'wp-migrate-db-pro-script', $src, array( 'jquery', 'backbone' ), $version, true );
+
+ wp_localize_script( 'wp-migrate-db-pro-script',
+ 'wpmdb_strings',
+ array(
+ 'max_request_size_problem' => __( 'A problem occurred when trying to change the maximum request size, please try again.', 'wp-migrate-db' ),
+ 'license_check_problem' => __( 'A problem occurred when trying to check the license, please try again.', 'wp-migrate-db' ),
+ 'establishing_remote_connection' => __( 'Establishing connection to remote server, please wait', 'wp-migrate-db' ),
+ 'connection_local_server_problem' => __( 'A problem occurred when attempting to connect to the local server, please check the details and try again.', 'wp-migrate-db' ),
+ 'enter_license_key' => __( 'Please enter your license key.', 'wp-migrate-db' ),
+ 'register_license_problem' => __( 'A problem occurred when trying to register the license, please try again.', 'wp-migrate-db' ),
+ 'license_registered' => __( 'Your license has been activated. You will now receive automatic updates and access to email support.', 'wp-migrate-db' ),
+ 'fetching_license' => __( 'Fetching license details, please wait…', 'wp-migrate-db' ),
+ 'clear_log_problem' => __( 'An error occurred when trying to clear the debug log. Please contact support. (#132)', 'wp-migrate-db' ),
+ 'update_log_problem' => __( 'An error occurred when trying to update the debug log. Please contact support. (#133)', 'wp-migrate-db' ),
+ 'please_select_one_table' => __( 'Please select at least one table to migrate.', 'wp-migrate-db' ),
+ 'please_select_one_table_backup' => __( 'Please select at least one table for backup.', 'wp-migrate-db' ),
+ 'enter_name_for_profile' => __( 'Please enter a name for your migration profile.', 'wp-migrate-db' ),
+ 'save_profile_problem' => __( 'An error occurred when attempting to save the migration profile. Please see the Help tab for details on how to request support. (#118)', 'wp-migrate-db' ),
+ 'exporting_complete' => _x( 'Export complete', 'Data has been successfully exported', 'wp-migrate-db' ),
+ 'exporting_please_wait' => __( 'Exporting, please wait…', 'wp-migrate-db' ),
+ 'please_wait' => __( 'please wait…', 'wp-migrate-db' ),
+ 'complete' => _x( 'complete', 'Finished successfully', 'wp-migrate-db' ),
+ 'migration_failed' => _x( 'Migration failed', 'Copy of data between servers did not complete', 'wp-migrate-db' ),
+ 'backing_up' => _x( 'Backing up', 'Saving a copy of the data before import', 'wp-migrate-db' ),
+ 'queued' => _x( 'Queued', 'In line to be processed', 'wp-migrate-db' ),
+ 'migrating' => _x( 'Migrating', 'Copying data between servers', 'wp-migrate-db' ),
+ 'running' => _x( 'Running', 'Process is active', 'wp-migrate-db'),
+ 'status' => _x( 'Status', 'Current request status', 'wp-migrate-db' ),
+ 'response' => _x( 'Response', 'The message the server responded with', 'wp-migrate-db' ),
+ 'table_process_problem' => __( 'A problem occurred when attempting to process the following table (#113)', 'wp-migrate-db' ),
+ 'table_process_problem_empty_response' => __( 'A problem occurred when processing the following table. We were expecting a response in JSON format but instead received an empty response.', 'wp-migrate-db' ),
+ 'completed_with_some_errors' => __( 'Migration completed with some errors', 'wp-migrate-db' ),
+ 'completed_dump_located_at' => __( 'Migration complete, your backup is located at:', 'wp-migrate-db' ),
+ 'finalize_tables_problem' => __( 'A problem occurred when finalizing the backup. (#140)', 'wp-migrate-db' ),
+ 'saved' => _x( 'Saved', 'The settings were saved successfully', 'wp-migrate-db' ),
+ 'reset_api_key' => __( 'Any sites setup to use the current secret key will no longer be able to connect. You will need to update those sites with the newly generated secret key. Do you wish to continue?', 'wp-migrate-db' ),
+ 'reset_api_key_problem' => __( 'An error occurred when trying to generate the secret key. Please see the Help tab for details on how to request support. (#105)', 'wp-migrate-db' ),
+ 'remove_profile' => __( 'You are about to remove the migration profile "{{profile}}". This cannot be undone. Do you wish to continue?', 'wp-migrate-db' ),
+ 'remove_profile_problem' => __( 'An error occurred when trying to delete the profile. Please see the Help tab for details on how to request support. (#106)', 'wp-migrate-db' ),
+ 'remove_profile_not_found' => __( "The selected migration profile could not be deleted because it was not found.\nPlease refresh this page to see an accurate list of the currently available migration profiles.", 'wp-migrate-db' ),
+ 'change_connection_info' => __( 'If you change the connection details, you will lose any replaces and table selections you have made below. Do you wish to continue?', 'wp-migrate-db' ),
+ 'enter_connection_info' => __( 'Please enter the connection information above to continue.', 'wp-migrate-db' ),
+ 'save_settings_problem' => __( 'An error occurred when trying to save the settings. Please try again. If the problem persists, please see the Help tab for details on how to request support. (#108)', 'wp-migrate-db' ),
+ 'connection_info_missing' => __( 'The connection information appears to be missing, please enter it to continue.', 'wp-migrate-db' ),
+ 'connection_info_incorrect' => __( "The connection information appears to be incorrect, it should consist of two lines. The first being the remote server's URL and the second being the secret key.", 'wp-migrate-db' ),
+ 'connection_info_url_invalid' => __( 'The URL on the first line appears to be invalid, please check it and try again.', 'wp-migrate-db' ),
+ 'connection_info_key_invalid' => __( 'The secret key on the second line appears to be invalid. It should be a 40 character string that consists of letters, numbers and special characters only.', 'wp-migrate-db' ),
+ 'connection_info_local_url' => __( "It appears you've entered the URL for this website, you need to provide the URL of the remote website instead.", 'wp-migrate-db' ),
+ 'connection_info_local_key' => __( 'Looks like your remote secret key is the same as the secret key for this site. To fix this, go to the Settings tab and click "Reset Secret Key"', 'wp-migrate-db' ),
+ 'time_elapsed' => __( 'Time Elapsed:', 'wp-migrate-db' ),
+ 'pause' => _x( 'Pause', 'Temporarily stop migrating', 'wp-migrate-db' ),
+ 'migration_paused' => _x( 'Migration Paused', 'The migration has been temporarily stopped', 'wp-migrate-db' ),
+ 'find_replace_paused' => _x( 'Find & Replace Paused', 'The find & replace has been temporarily stopped', 'wp-migrate-db' ),
+ 'resume' => _x( 'Resume', 'Restart migrating after it was paused', 'wp-migrate-db' ),
+ 'completing_current_request' => __( 'Completing current request', 'wp-migrate-db' ),
+ 'cancelling_migration' => _x( 'Cancelling migration', 'The migration is being cancelled', 'wp-migrate-db' ),
+ 'cancelling_find_replace' => _x( 'Cancelling find & replace', 'The find & replace is being cancelled', 'wp-migrate-db' ),
+ 'paused' => _x( 'Paused', 'The migration has been temporarily stopped', 'wp-migrate-db' ),
+ 'pause_before_finalize_find_replace' => __( 'Pause before finalizing the updates', 'wp-migrate-db' ),
+ 'paused_before_finalize' => __( 'Automatically paused before migrated tables are replaced. Click "Resume" or "Cancel" when ready.', 'wp-migrate-db' ),
+ 'find_replace_paused_before_finalize' => __( 'Automatically paused before the find & replace was finalized. Click "Resume" or "Cancel" when ready.', 'wp-migrate-db-pro' ),
+ 'removing_local_sql' => __( 'Removing the local MySQL export file', 'wp-migrate-db' ),
+ 'removing_local_backup' => __( 'Removing the local backup MySQL export file', 'wp-migrate-db' ),
+ 'removing_local_temp_tables' => __( 'Removing the local temporary tables', 'wp-migrate-db' ),
+ 'removing_remote_sql' => __( 'Removing the remote backup MySQL export file', 'wp-migrate-db' ),
+ 'removing_remote_temp_tables' => __( 'Removing the remote temporary tables', 'wp-migrate-db' ),
+ 'migration_cancellation_failed' => __( 'Migration cancellation failed', 'wp-migrate-db' ),
+ 'manually_remove_temp_files' => __( 'A problem occurred while cancelling the migration, you may have to manually delete some temporary files / tables.', 'wp-migrate-db' ),
+ 'migration_cancelled' => _x( 'Migration cancelled', 'The migration has been cancelled', 'wp-migrate-db' ),
+ 'migration_cancelled_success' => __( 'The migration has been stopped and all temporary files and data have been cleaned up.', 'wp-migrate-db' ),
+ 'find_replace_cancelled' => _x( 'Find & replace cancelled', 'The migration has been cancelled', 'wp-migrate-db' ),
+ 'find_replace_cancelled_success' => __( 'The find & replace has been cancelled and all temporary data has been cleaned up.', 'wp-migrate-db' ),
+ 'migration_complete' => _x( 'Migration complete', 'The migration completed successfully', 'wp-migrate-db' ),
+ 'finalizing_migration' => _x( 'Finalizing migration', 'The migration is in the last stages', 'wp-migrate-db' ),
+ 'flushing' => _x( 'Flushing caches and rewrite rules', 'The caches and rewrite rules for the target are being flushed', 'wp-migrate-db' ),
+ 'blacklist_problem' => __( 'A problem occurred when trying to add plugins to backlist.', 'wp-migrate-db' ),
+ 'mu_plugin_confirmation' => __( "If confirmed we will install an additional WordPress 'Must Use' plugin. This plugin will allow us to control which plugins are loaded during WP Migrate DB Pro specific operations. Do you wish to continue?", 'wp-migrate-db' ),
+ 'plugin_compatibility_settings_problem' => __( 'A problem occurred when trying to change the plugin compatibility setting.', 'wp-migrate-db' ),
+ 'sure' => _x( 'Sure?', 'Confirmation required', 'wp-migrate-db' ),
+ 'pull_migration_label_migrating' => __( 'Pulling from %s…', 'wp-migrate-db' ),
+ 'pull_migration_label_completed' => __( 'Pull from %s complete', 'wp-migrate-db' ),
+ 'push_migration_label_migrating' => __( 'Pushing to %s…', 'wp-migrate-db' ),
+ 'push_migration_label_completed' => __( 'Push to %s complete', 'wp-migrate-db' ),
+ 'find_replace_label_migrating' => __( 'Running Find & Replace…', 'wp-migrate-db' ),
+ 'find_replace_label_completed' => __( 'Find & Replace complete', 'wp-migrate-db' ),
+ 'copying_license' => __( 'Copying license to the remote site, please wait', 'wp-migrate-db' ),
+ 'attempting_to_activate_licence' => __( 'Attempting to activate your license, please wait…', 'wp-migrate-db' ),
+ 'licence_reactivated' => __( 'License successfully activated, please wait…', 'wp-migrate-db' ),
+ 'activate_licence_problem' => __( 'An error occurred when trying to reactivate your license. Please provide the following information when requesting support:', 'wp-migrate-db' ),
+ 'temporarily_activated_licence' => __( "We've temporarily activated your licence and will complete the activation once the Delicious Brains API is available again. Please refresh this page to continue.", 'wp-migrate-db' ),
+ 'ajax_json_message' => __( 'JSON Decoding Failure', 'wp-migrate-db' ),
+ 'ajax_json_errors' => __( 'Our AJAX request was expecting JSON but we received something else. Often this is caused by your theme and/or plugins spitting out PHP errors. If you can edit the theme or plugins causing the errors, you should be able to fix them up, but if not, you can set WP_DEBUG to false in wp-config.php to disable errors from showing up.', 'wp-migrate-db' ),
+ 'view_error_messages' => __( 'View error messages', 'wp-migrate-db' ),
+ 'delaying_next_request' => __( 'Waiting %s seconds before executing next step', 'wp-migrate-db' ),
+ 'delay_between_requests_problem' => __( 'A problem occurred when trying to change the delay between requests, please try again.', 'wp-migrate-db' ),
+ 'flush_problem' => __( 'A problem occurred when flushing caches and rewrite rules. (#145)', 'wp-migrate-db' ),
+ 'migrate_button_push' => _x( 'Push', 'Transfer this database to the remote site', 'wp-migrate-db' ),
+ 'migrate_button_push_save' => _x( 'Push & Save', 'Transfer this database to the remote site and save migration profile', 'wp-migrate-db' ),
+ 'migrate_button_pull' => _x( 'Pull', 'Transfer the remote database to this site', 'wp-migrate-db' ),
+ 'migrate_button_pull_save' => _x( 'Pull & Save', 'Transfer the remote database to this site and save migration profile', 'wp-migrate-db' ),
+ 'migrate_button_export' => _x( 'Export', 'Download a copy of the database', 'wp-migrate-db' ),
+ 'migrate_button_export_save' => _x( 'Export & Save', 'Download a copy of the database and save migration profile', 'wp-migrate-db' ),
+ 'migrate_button_find_replace' => _x( 'Find & Replace', 'Run a find and replace on the database', 'wp-migrate-db' ),
+ 'migrate_button_find_replace_save' => _x( 'Find & Replace & Save', 'Run a find and replace and save migration profile', 'wp-migrate-db' ),
+ 'tables' => _x( 'Tables', 'database tables', 'wp-migrate-db'),
+ 'files' => __( 'Files', 'wp-migrate-db'),
+ 'migrated' => _x( 'Migrated', 'Transferred', 'wp-migrate-db' ),
+ 'backed_up' => __( 'Backed Up', 'wp-migrate-db' ),
+ 'searched' => __( 'Searched', 'wp-migrate-db' ),
+ 'hide' => _x( 'Hide', 'Obscure from view', 'wp-migrate-db' ),
+ 'show' => _x( 'Show', 'Reveal', 'wp-migrate-db' ),
+ 'welcome_title' => __( 'Welcome to WP Migrate DB Pro! 🎉', 'wp-migrate-db' ),
+ 'welcome_text' => __( 'Hey, this is the first time activating your license, nice! Your migrations are about to get awesome! If you haven’t already, you should check out our Quick Start Guide and Videos . If you run into any trouble at all, use the Help tab above to submit a support request.', 'wp-migrate-db' ),
+ 'title_progress' => __( '%1$s Stage %2$s of %3$s', 'wp-migrate-db' ),
+ 'title_paused' => __( 'Paused', 'wp-migrate-db' ),
+ 'title_cancelling' => __( 'Cancelling', 'wp-migrate-db' ),
+ 'title_cancelled' => __( 'Cancelled', 'wp-migrate-db' ),
+ 'title_finalizing' => __( 'Finalizing', 'wp-migrate-db' ),
+ 'title_complete' => __( 'Complete', 'wp-migrate-db' ),
+ 'title_error' => __( 'Failed', 'wp-migrate-db' ),
+ 'progress_items_truncated_msg' => __( '%1$s items are not shown to maintain browser performance', 'wp-migrate-db' ),
+ 'clear_error_log' => _x( 'Cleared', 'Error log emptied', 'wp-migrate-db' ),
+ )
+ );
+
+ wp_enqueue_script( 'jquery' );
+ wp_enqueue_script( 'jquery-ui-core' );
+ wp_enqueue_script( 'jquery-ui-slider' );
+ wp_enqueue_script( 'jquery-ui-sortable' );
+ }
+
+ function download_file() {
+ // don't need to check for user permissions as our 'add_management_page' already takes care of this
+ $this->set_time_limit();
+
+ $dump_name = $this->format_dump_name( $_GET['download'] );
+
+ if ( isset( $_GET['gzip'] ) ) {
+ $dump_name .= '.gz';
+ }
+
+ $diskfile = $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR . $dump_name;
+ $filename = basename( $diskfile );
+ $last_dash = strrpos( $filename, '-' );
+ $salt = substr( $filename, $last_dash, 6 );
+ $filename_no_salt = str_replace( $salt, '', $filename );
+
+ if ( file_exists( $diskfile ) ) {
+ header( 'Content-Description: File Transfer' );
+ header( 'Content-Type: application/octet-stream' );
+ header( 'Content-Length: ' . filesize( $diskfile ) );
+ header( 'Content-Disposition: attachment; filename=' . $filename_no_salt );
+ $success = readfile( $diskfile );
+ // TODO: Use WP_Filesystem API.
+ unlink( $diskfile );
+ exit;
+ } else {
+ wp_die( __( 'Could not find the file to download:', 'wp-migrate-db' ) . ' ' . esc_html( $diskfile ) );
+ }
+ }
+
+ /**
+ * Supply inline JS data and nonces for enqueued scripts.
+ *
+ * @return void
+ */
+ function admin_head_connection_info() {
+ $site_details = $this->site_details();
+
+ $nonces = apply_filters( 'wpmdb_nonces', array(
+ 'update_max_request_size' => wp_create_nonce( 'update-max-request-size' ),
+ 'update_delay_between_requests' => wp_create_nonce( 'update-delay-between-requests' ),
+ 'check_licence' => wp_create_nonce( 'check-licence' ),
+ 'verify_connection_to_remote_site' => wp_create_nonce( 'verify-connection-to-remote-site' ),
+ 'activate_licence' => wp_create_nonce( 'activate-licence' ),
+ 'clear_log' => wp_create_nonce( 'clear-log' ),
+ 'get_log' => wp_create_nonce( 'get-log' ),
+ 'save_profile' => wp_create_nonce( 'save-profile' ),
+ 'initiate_migration' => wp_create_nonce( 'initiate-migration' ),
+ 'migrate_table' => wp_create_nonce( 'migrate-table' ),
+ 'finalize_migration' => wp_create_nonce( 'finalize-migration' ),
+ 'reset_api_key' => wp_create_nonce( 'reset-api-key' ),
+ 'delete_migration_profile' => wp_create_nonce( 'delete-migration-profile' ),
+ 'save_setting' => wp_create_nonce( 'save-setting' ),
+ 'copy_licence_to_remote_site' => wp_create_nonce( 'copy-licence-to-remote-site' ),
+ 'reactivate_licence' => wp_create_nonce( 'reactivate-licence' ),
+ 'process_notice_link' => wp_create_nonce( 'process-notice-link' ),
+ 'flush' => wp_create_nonce( 'flush' ),
+ 'plugin_compatibility' => wp_create_nonce( 'plugin_compatibility' ),
+ 'blacklist_plugins' => wp_create_nonce( 'blacklist_plugins' ),
+ 'cancel_migration' => wp_create_nonce( 'cancel_migration' )
+ ) );
+
+ $data = apply_filters( 'wpmdb_data', array(
+ 'connection_info' => array( site_url( '', 'https' ), $this->settings['key'] ),
+ 'this_url' => esc_html( addslashes( home_url() ) ),
+ 'this_path' => esc_html( addslashes( $this->get_absolute_root_file_path() ) ),
+ 'this_domain' => esc_html( $this->get_domain_current_site() ),
+ 'this_tables' => $this->get_tables(),
+ 'this_prefixed_tables' => $this->get_tables( 'prefix' ),
+ 'this_table_sizes' => $this->get_table_sizes(),
+ 'this_table_sizes_hr' => array_map( array( $this, 'format_table_sizes' ), $this->get_table_sizes() ),
+ 'this_table_rows' => $this->get_table_row_count(),
+ 'this_upload_url' => esc_html( addslashes( trailingslashit( $this->get_upload_info( 'url' ) ) ) ),
+ 'this_upload_dir_long' => esc_html( addslashes( trailingslashit( $this->get_upload_info( 'path' ) ) ) ),
+ 'this_uploads_dir' => $site_details['uploads_dir'], // TODO: Remove backwards compatibility.
+ 'this_plugin_url' => trailingslashit( plugins_url( $this->plugin_folder_name ) ),
+ 'this_website_name' => sanitize_title_with_dashes( DB_NAME ),
+ 'this_download_url' => network_admin_url( $this->plugin_base . '&download=' ),
+ 'this_prefix' => $site_details['prefix'], // TODO: Remove backwards compatibility.
+ 'this_temp_prefix' => $this->temp_prefix,
+ 'this_plugin_base' => esc_html( $this->plugin_base ),
+ 'is_multisite' => $site_details['is_multisite'], // TODO: Remove backwards compatibility.
+ 'openssl_available' => esc_html( $this->open_ssl_enabled() ? 'true' : 'false' ),
+ 'max_request' => esc_html( $this->settings['max_request'] ),
+ 'delay_between_requests' => esc_html( $this->settings['delay_between_requests'] ),
+ 'prog_tables_hidden' => ( bool ) $this->settings['prog_tables_hidden'],
+ 'pause_before_finalize' => ( bool ) $this->settings['pause_before_finalize'],
+ 'bottleneck' => esc_html( $this->get_bottleneck( 'max' ) ),
+ 'has_licence' => esc_html( $this->get_licence_key() == '' ? '0' : '1' ),
+ // TODO: Use WP_Filesystem API.
+ 'write_permission' => esc_html( is_writeable( $this->get_upload_info( 'path' ) ) ? 'true' : 'false' ),
+ 'nonces' => $nonces,
+ 'valid_licence' => ( $this->is_valid_licence() ) ? '1' : '0',
+ 'profile' => isset( $_GET['wpmdb-profile'] ) ? $_GET['wpmdb-profile'] : '-1',
+ 'is_pro' => esc_html( ( $this->is_pro ) ? 'true' : 'false' ),
+ 'lower_case_table_names' => esc_html( $this->get_lower_case_table_names_setting() ),
+ 'subsites' => $site_details['subsites'], // TODO: Remove backwards compatibility.
+ 'site_details' => $this->site_details(),
+ ) );
+
+ wp_localize_script( 'wp-migrate-db-pro-script', 'wpmdb_data', $data );
+ }
+
+ function maybe_update_profile( $profile, $profile_id ) {
+ $profile_changed = false;
+
+ if ( isset( $profile['exclude_revisions'] ) ) {
+ unset( $profile['exclude_revisions'] );
+ $profile['select_post_types'] = array( 'revision' );
+ $profile_changed = true;
+ }
+
+ if ( isset( $profile['post_type_migrate_option'] ) && 'migrate_select_post_types' == $profile['post_type_migrate_option'] && 'pull' != $profile['action'] ) {
+ unset( $profile['post_type_migrate_option'] );
+ $profile['exclude_post_types'] = '1';
+ $all_post_types = $this->get_post_types();
+ $profile['select_post_types'] = array_diff( $all_post_types, $profile['select_post_types'] );
+ $profile_changed = true;
+ }
+
+ if ( $profile_changed ) {
+ $this->settings['profiles'][ $profile_id ] = $profile;
+ update_site_option( 'wpmdb_settings', $this->settings );
+ }
+
+ return $profile;
+ }
+
+ function get_path_from_url( $url ) {
+ $parts = $this->parse_url( $url );
+
+ return ( ! empty( $parts['path'] ) ) ? trailingslashit( $parts['path'] ) : '/';
+ }
+
+ function get_path_current_site() {
+ if ( ! is_multisite() ) {
+ return '';
+ }
+
+ $current_site = get_current_site();
+
+ return $current_site->path;
+ }
+
+ /**
+ * Get the domain for the current site.
+ *
+ * @return string
+ */
+ function get_domain_current_site() {
+ if ( ! is_multisite() ) {
+ return '';
+ }
+
+ $current_site = get_current_site();
+
+ return $current_site->domain;
+ }
+
+ /**
+ * Called to cancel an in-progress migration.
+ */
+ function ajax_cancel_migration() {
+ $this->check_ajax_referer( 'cancel_migration' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'migration_state_id' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
+
+ switch ( $this->state_data['intent'] ) {
+ case 'savefile' :
+ $this->delete_export_file( $this->state_data['dump_filename'], false );
+ break;
+ case 'push' :
+ $data = $this->filter_post_elements(
+ $this->state_data,
+ array(
+ 'remote_state_id',
+ 'intent',
+ 'url',
+ 'form_data',
+ 'temp_prefix',
+ 'stage',
+ 'dump_filename',
+ )
+ );
+
+ $data['action'] = 'wpmdb_process_push_migration_cancellation';
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
+ $ajax_url = $this->ajax_url();
+
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
+ $this->display_errors();
+
+ echo esc_html( trim( $response ) );
+ break;
+ case 'pull' :
+ if ( $this->state_data['stage'] == 'backup' ) {
+ if ( ! empty( $this->state_data['dumpfile_created'] ) ) {
+ $this->delete_export_file( $this->state_data['dump_filename'], true );
+ }
+ } else {
+ $this->delete_temporary_tables( $this->state_data['temp_prefix'] );
+ }
+ break;
+ case 'find_replace' :
+ $this->delete_temporary_tables( $this->temp_prefix );
+ break;
+ default:
+ break;
+ }
+
+ if ( ! $this->migration_state->delete() ) {
+ $this->log_error( 'Could not delete migration state.' );
+ }
+
+ exit;
+ }
+
+ function delete_export_file( $filename, $is_backup ) {
+ $dump_file = $this->format_dump_name( $filename );
+
+ if ( true == $is_backup ) {
+ $dump_file = preg_replace( '/.gz$/', '', $dump_file );
+ }
+
+ $dump_file = $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR . $dump_file;
+
+ if ( empty( $dump_file ) || false == file_exists( $dump_file ) ) {
+ _e( 'MySQL export file not found.', 'wp-migrate-db' );
+ exit;
+ }
+
+ // TODO: Use WP_Filesystem API.
+ if ( false === @unlink( $dump_file ) ) {
+ _e( 'Could not delete the MySQL export file.', 'wp-migrate-db' );
+ exit;
+ }
+ }
+
+ function empty_current_chunk() {
+ $this->current_chunk = '';
+ }
+
+ function template_compatibility() {
+ $args = array(
+ 'plugin_compatibility_checked' => ( isset( $GLOBALS['wpmdb_compatibility'] ) ? true : false ),
+ );
+ $this->template( 'compatibility', 'common', $args );
+ }
+
+ function template_max_request_size() {
+ $this->template( 'max-request-size', 'common' );
+ }
+
+ function template_debug_info() {
+ $this->template( 'debug-info', 'common' );
+ }
+
+ function template_exclude_post_revisions( $loaded_profile ) {
+ $args = array(
+ 'loaded_profile' => $loaded_profile,
+ );
+ $this->template( 'exclude-post-revisions', 'wpmdb', $args );
+ }
+
+ function template_wordpress_org_support() {
+ $this->template( 'wordpress-org-support', 'wpmdb' );
+ }
+
+ function template_progress_upgrade() {
+ $this->template( 'progress-upgrade', 'wpmdb' );
+ }
+
+ function template_sidebar() {
+ $this->template( 'sidebar', 'wpmdb' );
+ }
+
+ function template_part( $methods, $args = false ) {
+ $methods = array_diff( $methods, $this->unhook_templates );
+
+ foreach ( $methods as $method ) {
+ $method_name = 'template_' . $method;
+
+ if ( method_exists( $this, $method_name ) ) {
+ call_user_func( array( $this, $method_name ), $args );
+ }
+ }
+ }
+
+ function plugin_tabs() {
+ echo implode( '', $this->plugin_tabs );
+ }
+
+ function get_plugin_title() {
+ return __( 'Migrate DB', 'wp-migrate-db' );
+ }
+
+ function plugin_deactivated_notice() {
+ if ( false !== ( $deactivated_notice_id = get_transient( 'wp_migrate_db_deactivated_notice_id' ) ) ) {
+ if ( '1' === $deactivated_notice_id ) {
+ $message = __( "WP Migrate DB and WP Migrate DB Pro cannot both be active. We've automatically deactivated WP Migrate DB.", 'wp-migrate-db' );
+ } else {
+ $message = __( "WP Migrate DB and WP Migrate DB Pro cannot both be active. We've automatically deactivated WP Migrate DB Pro.", 'wp-migrate-db' );
+ } ?>
+
+ %1$s', __( 'our documentation', 'wp-migrate-db-pro' ) ) );
+ $return = array( 'wpmdb_error' => 1, 'body' => $return );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+ }
+
+ return $create_table;
+ }
+
+ /**
+ * Provides find/replace pairs with wpmdb_find_and_replace filter applied.
+ *
+ * @param string $intent
+ * @param string $site_url
+ *
+ * @return array
+ */
+ function parse_find_replace_pairs( $intent = '', $site_url = '' ) {
+ $find_replace_pairs = array();
+ $tmp_find_replace_pairs = array();
+ if ( ! empty( $this->form_data['replace_old'] ) && ! empty( $this->form_data['replace_new'] ) ) {
+ $tmp_find_replace_pairs = array_combine( $this->form_data['replace_old'], $this->form_data['replace_new'] );
+ }
+
+ $tmp_find_replace_pairs = apply_filters( 'wpmdb_find_and_replace', $tmp_find_replace_pairs, $intent, $site_url );
+
+ if ( ! empty( $tmp_find_replace_pairs ) ) {
+ $i = 1;
+ foreach ( $tmp_find_replace_pairs as $replace_old => $replace_new ) {
+ $find_replace_pairs['replace_old'][ $i ] = $replace_old;
+ $find_replace_pairs['replace_new'][ $i ] = $replace_new;
+ $i++;
+ }
+ }
+
+ return $find_replace_pairs;
+ }
+
+ function get_lower_case_table_names_setting() {
+ global $wpdb;
+
+ $setting = $wpdb->get_var( "SHOW VARIABLES LIKE 'lower_case_table_names'", 1 );
+
+ return empty( $setting ) ? '-1' : $setting;
+ }
+
+ function mixed_case_table_name_warning( $migration_type ) {
+ ob_start();
+ ?>
+
+
+
+ local site has the MySQL setting lower_case_table_names set to 1.", 'wp-migrate-db' ); ?>
+
+ remote site has the MySQL setting lower_case_table_names set to 1.", 'wp-migrate-db' ); ?>
+
+
+
+
+ our documentation, proceed with caution.', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/mixed-case-table-names/' ); ?>
+ is_addon = true;
+ parent::__construct( $plugin_file_path );
+ }
+
+ function meets_version_requirements( $version_required ) {
+ $wpmdb_pro_version = $GLOBALS['wpmdb_meta']['wp-migrate-db-pro']['version'];
+ $result = version_compare( $wpmdb_pro_version, $version_required, '>=' );
+ $this->version_required = $version_required;
+
+ if ( false == $result ) {
+ $this->hook_version_requirement_actions();
+ }
+
+ if ( $result ) {
+ // If pre-1.1.2 version of Media Files addon,
+ // then it's not supported by this version of core
+ if ( empty( $this->plugin_version ) ) {
+ $result = false;
+ } else { // Check that this version of core supports the addon version
+ $plugin_basename = sprintf( '%1$s/%1$s.php', $this->plugin_slug );
+ $required_addon_version = $this->addons[ $plugin_basename ]['required_version'];
+ $result = version_compare( $this->plugin_version, $required_addon_version, '>=' );
+ }
+ }
+
+ return $result;
+ }
+
+ function hook_version_requirement_actions() {
+ add_action( 'wpmdb_notices', array( $this, 'version_requirement_actions' ) );
+ }
+
+ function version_requirement_actions() {
+ $addon_requirement_check = get_site_option( 'wpmdb_addon_requirement_check', array() );
+
+ // we only want to delete the transients once, here we keep track of which versions we've checked
+ if ( ! isset( $addon_requirement_check[ $this->plugin_slug ] ) || $addon_requirement_check[ $this->plugin_slug ] != $GLOBALS['wpmdb_meta'][ $this->plugin_slug ]['version'] ) {
+ delete_site_transient( 'wpmdb_upgrade_data' );
+ delete_site_transient( 'update_plugins' );
+ $addon_requirement_check[ $this->plugin_slug ] = $GLOBALS['wpmdb_meta'][ $this->plugin_slug ]['version'];
+ update_site_option( 'wpmdb_addon_requirement_check', $addon_requirement_check );
+ }
+
+ $this->version_requirement_warning();
+ }
+
+ function version_requirement_warning() { ?>
+
+
Update Required — get_plugin_name();
+ $required = $this->version_required;
+ $installed = $GLOBALS['wpmdb_meta']['wp-migrate-db-pro']['version'];
+ $wpmdb_basename = sprintf( '%s/%s.php', $GLOBALS['wpmdb_meta']['wp-migrate-db-pro']['folder'], 'wp-migrate-db' );
+ $update = wp_nonce_url( network_admin_url( 'update.php?action=upgrade-plugin&plugin=' . urlencode( $wpmdb_basename ) ), 'upgrade-plugin_' . $wpmdb_basename );
+ printf( __( 'The version of %1$s you have installed, requires version %2$s of WP Migrate DB Pro. You currently have %3$s installed.
Update Now ', 'wp-migrate-db' ), $addon_name, $required, $installed, $update ); ?>
+
wpmdb = &$this->wpmdbpro;
+ $this->wpmdbpro = $wpmdbpro;
+
+ // add support for extra args
+ add_filter( 'wpmdb_cli_filter_get_extra_args', array( $this, 'filter_extra_args_cli_export' ), 10, 1 );
+ add_filter( 'wpmdb_cli_filter_get_profile_data_from_args', array( $this, 'add_extra_args_for_pro_export' ), 10, 3 );
+
+ // extend get_tables_to_migrate with migrate_select
+ add_filter( 'wpmdb_cli_tables_to_migrate', array( $this, 'tables_to_migrate_include_select' ), 10, 1 );
+ }
+
+ /**
+ * Add extra CLI args used by this plugin.
+ *
+ * @param array $args
+ *
+ * @return array
+ */
+ public function filter_extra_args_cli_export( $args = array() ) {
+ $args[] = 'include-tables';
+ $args[] = 'exclude-post-types';
+
+ return $args;
+ }
+
+ /**
+ * Add support for extra args in export
+ *
+ * @param array $profile
+ * @param array $args
+ * @param array $assoc_args
+ *
+ * @return array
+ */
+ function add_extra_args_for_pro_export( $profile, $args, $assoc_args ) {
+ if ( ! is_array( $profile ) ) {
+ return $profile;
+ }
+
+ // --include-tables=
+ if ( ! empty( $assoc_args['include-tables'] ) ) {
+ $table_migrate_option = 'migrate_select';
+ $select_tables = explode( ',', $assoc_args['include-tables'] );
+ } else {
+ $select_tables = array();
+ $table_migrate_option = 'migrate_only_with_prefix';
+ }
+
+ // --exclude-post-types=
+ $select_post_types = array();
+ if ( ! empty( $assoc_args['exclude-post-types'] ) ) {
+ $select_post_types = explode( ',', $assoc_args['exclude-post-types'] );
+ }
+
+ $filtered_profile = compact(
+ 'table_migrate_option',
+ 'select_post_types',
+ 'select_tables'
+ );
+
+ return array_merge( $profile, $filtered_profile );
+ }
+
+ /**
+ * Use tables from --include-tables assoc arg if available
+ *
+ * @param array $tables_to_migrate
+ *
+ * @return array
+ */
+ function tables_to_migrate_include_select( $tables_to_migrate ) {
+ if ( in_array( $this->profile['action'], array( 'find_replace', 'savefile' ) ) ) {
+ if ( 'migrate_select' === $this->profile['table_migrate_option'] && ! empty( $this->profile['select_tables'] ) ) {
+ $tables_to_migrate = array_intersect( $this->profile['select_tables'], $this->get_tables() );
+ }
+ }
+
+ return $tables_to_migrate;
+ }
+}
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdbpro-command.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdbpro-command.php
new file mode 100644
index 0000000..0c51980
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdbpro-command.php
@@ -0,0 +1,141 @@
+
+ * : A file path to export to. Filename will be modified to end in .sql or
+ * .sql.gz if necessary.
+ *
+ * [--find=]
+ * : A comma separated list of strings to find when performing a string find
+ * and replace across the database.
+ *
+ * Table names should be quoted as needed, i.e. when using a comma in the
+ * find/replace string.
+ *
+ * The --replace= argument should be used in conjunction to specify
+ * the replace values for the strings found using this argument. The number
+ * of strings specified in this argument should match the number passed into
+ * --replace= argument.
+ *
+ * [--replace=]
+ * : A comma separated list of replace value strings to implement when
+ * performing a string find & replace across the database.
+ *
+ * Should be used in conjunction with the --find= argument, see it's
+ * documentation for further explanation of the find & replace functionality.
+ *
+ * [--include-tables=]
+ * : The comma separated list of tables to migrate. Excluding this parameter
+ * will migrate all tables in your database that begin with your
+ * installation's table prefix, e.g. wp_.
+ *
+ * [--exclude-post-types=]
+ * : A comma separated list of post types to exclude. Excluding this parameter
+ * will migrate all post types.
+ *
+ * [--skip-replace-guids]
+ * : Do not perform a find & replace on the guid column in the wp_posts table.
+ *
+ * [--exclude-spam]
+ * : Exclude spam comments.
+ *
+ * [--gzip-file]
+ * : GZip compress export file.
+ *
+ * [--include-transients]
+ * : Include transients (temporary cached data).
+ *
+ * [--subsite=]
+ * : Export the given subsite as a single site install. Requires the Multisite Tools addon.
+ *
+ * [--prefix=]
+ * : A new table prefix to be used for a subsite export.
+ *
+ * ## EXAMPLES
+ *
+ * wp migratedb export ./migratedb.sql \
+ * --find=http://dev.bradt.ca,/Users/bradt/home/bradt.ca
+ * --replace=http://bradt.ca,/home/bradt.ca
+ * --include-tables=wp_posts,wp_postmeta
+ *
+ * @param array $args
+ * @param array $assoc_args
+ */
+ public function export( $args, $assoc_args ) {
+ parent::export( $args, $assoc_args );
+ }
+
+ /**
+ * Run a find/replace on the database.
+ *
+ * ## OPTIONS
+ *
+ * [--find=]
+ * : A comma separated list of strings to find when performing a string find
+ * and replace across the database.
+ *
+ * Table names should be quoted as needed, i.e. when using a comma in the
+ * find/replace string.
+ *
+ * The --replace= argument should be used in conjunction to specify
+ * the replace values for the strings found using this argument. The number
+ * of strings specified in this argument should match the number passed into
+ * --replace= argument.
+ *
+ * [--replace=]
+ * : A comma separated list of replace value strings to implement when
+ * performing a string find & replace across the database.
+ *
+ * Should be used in conjunction with the --find= argument, see it's
+ * documentation for further explanation of the find & replace functionality.
+ *
+ * [--include-tables=]
+ * : The comma separated list of tables to search. Excluding this parameter
+ * will run a find & replace on all tables in your database that begin with your
+ * installation's table prefix, e.g. wp_.
+ *
+ * [--exclude-post-types=]
+ * : A comma separated list of post types to exclude from the find & replace.
+ * Excluding this parameter will run a find & replace on all post types.
+ *
+ * [--skip-replace-guids]
+ * : Do not perform a find & replace on the guid column in the wp_posts table.
+ *
+ * [--exclude-spam]
+ * : Exclude spam comments.
+ *
+ * [--include-transients]
+ * : Include transients (temporary cached data).
+ *
+ * [--subsite=]
+ * : Run a find & replace on the given subsite. Requires the Multisite Tools addon.
+ *
+ * ## EXAMPLES
+ *
+ * wp migratedb find-replace
+ * --find=http://dev.bradt.ca,/Users/bradt/home/bradt.ca
+ * --replace=http://bradt.ca,/home/bradt.ca
+ * --include-tables=wp_posts,wp_postmeta
+ *
+ * @param array $args
+ * @param array $assoc_args
+ *
+ * @subcommand find-replace
+ */
+ public function find_replace( $args, $assoc_args ) {
+ parent::find_replace( $args, $assoc_args );
+ }
+}
+
+WP_CLI::add_command( 'migratedb', 'WPMDBPro_Command' );
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdbpro.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdbpro.php
new file mode 100644
index 0000000..1bda52f
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/class/wpmdbpro.php
@@ -0,0 +1,1660 @@
+is_pro = true;
+ $this->unhook_templates = array( 'exclude_post_revisions', 'wordpress_org_support', 'progress_upgrade', 'sidebar' );
+ parent::__construct( $plugin_file_path );
+
+ // templating actions
+ add_action( 'wpmdb_notices', array( $this, 'template_outdated_addons_warning' ) );
+ add_action( 'wpmdb_notices', array( $this, 'template_secret_key_warning' ) );
+ add_action( 'wpmdb_notices', array( $this, 'template_block_external_warning' ) );
+
+ // Internal AJAX handlers
+ add_action( 'wp_ajax_wpmdb_verify_connection_to_remote_site', array( $this, 'ajax_verify_connection_to_remote_site' ) );
+ add_action( 'wp_ajax_wpmdb_fire_migration_complete', array( $this, 'fire_migration_complete' ) );
+
+ // Required for Pull if user tables being updated.
+ add_action( 'wp_ajax_wpmdb_reset_api_key', array( $this, 'ajax_reset_api_key' ) );
+ add_action( 'wp_ajax_wpmdb_activate_licence', array( $this, 'ajax_activate_licence' ) );
+ add_action( 'wp_ajax_wpmdb_check_licence', array( $this, 'ajax_check_licence' ) );
+ add_action( 'wp_ajax_wpmdb_copy_licence_to_remote_site', array( $this, 'ajax_copy_licence_to_remote_site' ) );
+ add_action( 'wp_ajax_wpmdb_reactivate_licence', array( $this, 'ajax_reactivate_licence' ) );
+ add_action( 'wp_ajax_wpmdb_process_notice_link', array( $this, 'ajax_process_notice_link' ) );
+
+ // external AJAX handlers
+ add_action( 'wp_ajax_nopriv_wpmdb_verify_connection_to_remote_site', array( $this, 'respond_to_verify_connection_to_remote_site' ) );
+ add_action( 'wp_ajax_nopriv_wpmdb_remote_initiate_migration', array( $this, 'respond_to_remote_initiate_migration' ) );
+ add_action( 'wp_ajax_nopriv_wpmdb_process_chunk', array( $this, 'respond_to_process_chunk' ) );
+ add_action( 'wp_ajax_nopriv_wpmdb_process_pull_request', array( $this, 'respond_to_process_pull_request' ) );
+ add_action( 'wp_ajax_nopriv_wpmdb_fire_migration_complete', array( $this, 'fire_migration_complete' ) );
+ add_action( 'wp_ajax_nopriv_wpmdb_backup_remote_table', array( $this, 'respond_to_backup_remote_table' ) );
+ add_action( 'wp_ajax_nopriv_wpmdb_remote_finalize_migration', array( $this, 'respond_to_remote_finalize_migration' ) );
+ add_action( 'wp_ajax_nopriv_wpmdb_remote_flush', array( $this, 'respond_to_remote_flush' ) );
+ add_action( 'wp_ajax_nopriv_wpmdb_process_push_migration_cancellation', array( $this, 'respond_to_process_push_migration_cancellation' ) );
+ add_action( 'wp_ajax_nopriv_wpmdb_copy_licence_to_remote_site', array( $this, 'respond_to_copy_licence_to_remote_site' ) );
+
+ // Take over the update check
+ add_filter( 'site_transient_update_plugins', array( $this, 'site_transient_update_plugins' ) );
+
+ // Add some custom JS into the WP admin pages
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_plugin_update_script' ) );
+
+ // Add some custom CSS into the WP admin pages
+ add_action( 'admin_head-plugins.php', array( $this, 'add_plugin_update_styles' ) );
+
+ // Hook into the plugin install process, inject addon download url
+ add_filter( 'plugins_api', array( $this, 'inject_addon_install_resource' ), 10, 3 );
+
+ // Short circuit the HTTP request to WordPress.org for plugin information
+ add_filter( 'plugins_api', array( $this, 'short_circuit_wordpress_org_plugin_info_request' ), 10, 3 );
+
+ // Clear update transients when the user clicks the "Check Again" button from the update screen
+ add_action( 'current_screen', array( $this, 'check_again_clear_transients' ) );
+
+ // Add after_plugin_row... action for pro plugin and all addons
+ add_action( 'after_plugin_row_wp-migrate-db-pro/wp-migrate-db-pro.php', array( $this, 'plugin_row' ), 11, 2 );
+ add_action( 'after_plugin_row_wp-migrate-db-pro-cli/wp-migrate-db-pro-cli.php', array( $this, 'plugin_row' ), 11, 2 );
+ add_action( 'after_plugin_row_wp-migrate-db-pro-media-files/wp-migrate-db-pro-media-files.php', array( $this, 'plugin_row' ), 11, 2 );
+ add_action( 'after_plugin_row_wp-migrate-db-pro-multisite-tools/wp-migrate-db-pro-multisite-tools.php', array( $this, 'plugin_row' ), 11, 2 );
+
+ // Seen when the user clicks "view details" on the plugin listing page
+ add_action( 'install_plugins_pre_plugin-information', array( $this, 'plugin_update_popup' ) );
+
+ // Removes the exclude post revision functionality (as seen in the free version of the plugin)
+ $this->remove_exclude_post_revision_functionality();
+
+ // Check if WP Engine is filtering the buffer and prevent it. Added here for ajax pull requests
+ $this->maybe_disable_wp_engine_filtering();
+ }
+
+ /**
+ * Short circuits the HTTP request to WordPress.org servers to retrieve plugin information.
+ * Will only fire on the update-core.php admin page.
+ *
+ * @param object|bool $res Plugin resource object or boolean false.
+ * @param string $action The API call being performed.
+ * @param object $args Arguments for the API call being performed.
+ *
+ * @return object|bool Plugin resource object or boolean false.
+ */
+ function short_circuit_wordpress_org_plugin_info_request( $res, $action, $args ) {
+ if ( 'plugin_information' != $action || empty( $args->slug ) || 'wp-migrate-db-pro' != $args->slug ) {
+ return $res;
+ }
+
+ $screen = get_current_screen();
+
+ // Only fire on the update-core.php admin page
+ if ( empty( $screen->id ) || ( 'update-core' !== $screen->id && 'update-core-network' !== $screen->id ) ) {
+ return $res;
+ }
+
+ $res = new stdClass();
+ $plugin_info = $this->get_upgrade_data();
+
+ if ( isset( $plugin_info['wp-migrate-db-pro']['tested'] ) ) {
+ $res->tested = $plugin_info['wp-migrate-db-pro']['tested'];
+ } else {
+ $res->tested = false;
+ }
+
+ return $res;
+ }
+
+ function template_pull_push_radio_buttons( $loaded_profile ) {
+ $args = array(
+ 'loaded_profile' => $loaded_profile,
+ );
+ $this->template( 'pull-push-radio-buttons', 'pro', $args );
+ }
+
+ function template_select_tables( $loaded_profile ) {
+ $args = array(
+ 'loaded_profile' => $loaded_profile,
+ );
+ $this->template( 'select-tables', 'pro', $args );
+ }
+
+ function template_exclude_post_types( $loaded_profile ) {
+ $args = array(
+ 'loaded_profile' => $loaded_profile,
+ );
+ $this->template( 'exclude-post-types', 'pro', $args );
+ }
+
+ function template_toggle_remote_requests() {
+ $this->template( 'toggle-remote-requests', 'pro' );
+ }
+
+ function template_request_settings() {
+ $this->template( 'request-settings', 'pro' );
+ }
+
+ function template_connection_info() {
+ $args = array(
+ 'connection_info' => sprintf( "%s\r%s", site_url( '', 'https' ), $this->settings['key'] ),
+ );
+ $this->template( 'connection-info', 'pro', $args );
+ }
+
+ function template_delay_between_requests() {
+ $this->template( 'delay-between-requests', 'pro' );
+ }
+
+ function template_licence() {
+ $args = array(
+ 'licence' => $this->get_licence_key(),
+ );
+ $this->template( 'licence', 'pro', $args );
+ }
+
+ function template_addon_tab() {
+ $this->template( 'addon-tab', 'pro' );
+ }
+
+ function template_licence_info() {
+ $args = array(
+ 'licence' => $this->get_licence_key(),
+ );
+ $this->template( 'licence-info', 'pro', $args );
+ }
+
+ /**
+ * Shows all the videos on the Help tab.
+ *
+ * @return void
+ */
+ function template_videos() {
+ $args = array(
+ 'videos' => array(
+ 'u7jFkwwfeJc' => array(
+ 'title' => __( 'UI Walkthrough', 'wp-migrate-db' ),
+ 'desc' => __( 'A brief walkthrough of the WP Migrate DB plugin showing all of the different options and explaining them.', 'wp-migrate-db' ),
+ ),
+ 'fHFcH4bCzmU' => array(
+ 'title' => __( 'Pulling Live Data Into Your Local Development Environment', 'wp-migrate-db' ),
+ 'desc' => __( 'This screencast demonstrates how you can pull data from a remote, live WordPress install and update the data in your local development environment.', 'wp-migrate-db' ),
+ ),
+ 'sImZW_sB47g' => array(
+ 'title' => __( 'Pushing Local Development Data to a Staging Environment', 'wp-migrate-db' ),
+ 'desc' => __( 'This screencast demonstrates how you can push a local WordPress database you\'ve been using for development to a staging environment.', 'wp-migrate-db' ),
+ ),
+ 'jjqc5dBX9DY' => array(
+ 'title' => __( 'WP Migrate DB Pro Media Files Addon 1.3 and CLI Addon 1.1', 'wp-migrate-db' ),
+ 'desc' => __( 'A demonstration of what\'s new in WP Migrate DB Pro Media Files Addon 1.3 and CLI Addon 1.1.', 'wp-migrate-db' ),
+ ),
+ ),
+ );
+ $this->template( 'videos', 'pro', $args );
+ }
+
+ function template_outdated_addons_warning() {
+ if ( ! $this->check_notice( 'outdated_addons_warning' ) ) {
+ return;
+ };
+ $this->template( 'outdated-addons-warning', 'pro' );
+ }
+
+ function template_secret_key_warning() {
+ if ( ! ( $notice_links = $this->check_notice( 'secret_key_warning', true, 604800 ) ) ) {
+ return;
+ };
+ // Only show the warning if the key is 32 characters in length
+ if ( strlen( $this->settings['key'] ) > 32 ) {
+ return;
+ }
+
+ $this->template( 'secret-key-warning', 'pro', $notice_links );
+ }
+
+ function template_block_external_warning() {
+ if ( ! defined( 'WP_HTTP_BLOCK_EXTERNAL' ) || ! WP_HTTP_BLOCK_EXTERNAL ) {
+ return;
+ }
+ if ( ! ( $notice_links = $this->check_notice( 'block_external_warning', true, 604800 ) ) ) {
+ return;
+ }
+
+ $this->template( 'block-external-warning', 'pro', $notice_links );
+ }
+
+ function template_invalid_licence_warning() {
+ if ( ! $this->is_valid_licence() ) {
+ $this->template( 'invalid-licence-warning', 'pro' );
+ }
+ }
+
+ function template_backup( $loaded_profile ) {
+ $args = array(
+ 'loaded_profile' => $loaded_profile,
+ );
+ $this->template( 'backup', 'pro', $args );
+ }
+
+ /**
+ * Handler for ajax request to process a link click in a notice, e.g. licence deactivated ... re-check.
+ *
+ * @return bool|null
+ */
+ function ajax_process_notice_link() {
+ $this->check_ajax_referer( 'process-notice-link' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'nonce' => 'key',
+ 'notice' => 'key',
+ 'type' => 'key',
+ 'reminder' => 'int',
+ );
+
+ $_POST = WPMDB_Sanitize::sanitize_data( $_POST, $key_rules, __METHOD__ );
+
+ if ( false === $_POST ) {
+ exit;
+ }
+
+ global $current_user;
+ $key = 'wpmdb_' . $_POST['type'] . '_' . $_POST['notice'];
+ $value = true;
+ if ( 'reminder' == $_POST['type'] && isset( $_POST['reminder'] ) ) {
+ $value = strtotime( 'now' ) + ( is_numeric( $_POST['reminder'] ) ? $_POST['reminder'] : 604800 );
+ }
+ update_user_meta( $current_user->ID, $key, $value );
+
+ $result = $this->end_ajax();
+
+ return $result;
+ }
+
+ /**
+ * AJAX endpoint for the wpmdb_verify_connection_to_remote_site action.
+ * Verifies that the local site has a valid licence.
+ * Sends a request to the remote site to collect additional information required to complete the migration.
+ *
+ * @return mixed
+ */
+ function ajax_verify_connection_to_remote_site() {
+ $this->check_ajax_referer( 'verify-connection-to-remote-site' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'url' => 'url',
+ 'key' => 'string',
+ 'intent' => 'key',
+ 'nonce' => 'key',
+ 'convert_post_type_selection' => 'numeric',
+ 'profile' => 'numeric',
+ );
+ $this->set_post_data( $key_rules );
+
+ if ( ! $this->is_valid_licence() ) {
+ $message = __( 'Please activate your license before attempting a pull or push migration.', 'wp-migrate-db' );
+ $return = array( 'wpmdb_error' => 1, 'body' => $message );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ $data = array(
+ 'action' => 'wpmdb_verify_connection_to_remote_site',
+ 'intent' => $this->state_data['intent'],
+ 'referer' => $this->get_short_home_address_from_url( home_url() ),
+ 'version' => $this->plugin_version,
+ );
+
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
+ $ajax_url = $this->ajax_url();
+ $timeout = apply_filters( 'wpmdb_prepare_remote_connection_timeout', 30 );
+ $serialized_response = $this->remote_post( $ajax_url, $data, __FUNCTION__, compact( 'timeout' ), true );
+ $url_bits = $this->parse_url( $this->attempting_to_connect_to );
+
+ if ( false === $serialized_response ) {
+ $return = array(
+ 'wpmdb_error' => 1,
+ 'body' => $this->error,
+ 'scheme' => $url_bits['scheme'],
+ );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ $response = WPMDB_Utils::unserialize( $serialized_response, __METHOD__ );
+
+ if ( false === $response ) {
+ $error_msg = __( 'Failed attempting to unserialize the response from the remote server. Please contact support.', 'wp-migrate-db' );
+ $return = array(
+ 'wpmdb_error' => 1,
+ 'body' => $error_msg,
+ 'scheme' => $url_bits['scheme'],
+ );
+ $this->log_error( $error_msg, $serialized_response );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ if ( isset( $response['error'] ) && $response['error'] == 1 ) {
+ $return = array(
+ 'wpmdb_error' => 1,
+ 'body' => $response['message'],
+ 'scheme' => $url_bits['scheme'],
+ );
+
+ if ( isset( $response['error_id'] ) ) {
+ if ( 'version_mismatch' === $response['error_id'] ) {
+ $return['body'] = str_replace( '%%plugins_url%%', network_admin_url( 'plugins.php' ), $return['body'] );
+ }
+ }
+
+ $this->log_error( $return['body'], $response );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ if ( isset( $this->state_data['convert_post_type_selection'] ) && '1' == $this->state_data['convert_post_type_selection'] ) {
+ $profile = (int) $this->state_data['profile'];
+ unset( $this->settings['profiles'][ $profile ]['post_type_migrate_option'] );
+ $this->settings['profiles'][ $profile ]['exclude_post_types'] = '1';
+ $this->settings['profiles'][ $profile ]['select_post_types'] = array_values( array_diff( $response['post_types'], $this->settings['profiles'][ $profile ]['select_post_types'] ) );
+ $response['select_post_types'] = $this->settings['profiles'][ $profile ]['select_post_types'];
+ update_site_option( 'wpmdb_settings', $this->settings );
+ }
+
+ $response['scheme'] = $url_bits['scheme'];
+ $return = json_encode( $response );
+
+ $result = $this->end_ajax( $return );
+
+ return $result;
+ }
+
+ /**
+ * The remote's handler for a request to finalize a migration.
+ *
+ * @return bool|null
+ */
+ function respond_to_remote_finalize_migration() {
+ add_filter( 'wpmdb_before_response', array( $this, 'scramble' ) );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'remote_state_id' => 'key',
+ 'intent' => 'key',
+ 'url' => 'url',
+ 'form_data' => 'string',
+ 'tables' => 'string',
+ 'temp_prefix' => 'string',
+ 'prefix' => 'string',
+ 'type' => 'key',
+ 'location' => 'url',
+ 'sig' => 'string',
+ );
+ $this->set_post_data( $key_rules, 'remote_state_id' );
+
+ $filtered_post = $this->filter_post_elements(
+ $this->state_data,
+ array(
+ 'action',
+ 'remote_state_id',
+ 'intent',
+ 'url',
+ 'form_data',
+ 'tables',
+ 'temp_prefix',
+ 'prefix',
+ 'type',
+ 'location',
+ )
+ );
+
+ if ( ! $this->verify_signature( $filtered_post, $this->settings['key'] ) ) {
+ $error_msg = $this->invalid_content_verification_error . ' (#123)';
+ $this->log_error( $error_msg, $filtered_post );
+ $result = $this->end_ajax( $error_msg );
+
+ return $result;
+ }
+
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
+
+ $return = $this->finalize_migration();
+ $result = $this->end_ajax( $return );
+
+ return $result;
+ }
+
+ /**
+ * Perform flushes on remote.
+ *
+ * @return bool|null
+ */
+ function respond_to_remote_flush() {
+ add_filter( 'wpmdb_before_response', array( $this, 'scramble' ) );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'sig' => 'string',
+ );
+ $this->set_post_data( $key_rules );
+ $filtered_post = $this->filter_post_elements( $this->state_data, array( 'action' ) );
+
+ if ( ! $this->verify_signature( $filtered_post, $this->settings['key'] ) ) {
+ $error_msg = $this->invalid_content_verification_error . ' (#123)';
+ $this->log_error( $error_msg, $filtered_post );
+ $result = $this->end_ajax( $error_msg );
+
+ return $result;
+ }
+
+ $return = $this->flush();
+ $result = $this->end_ajax( $return );
+
+ return $result;
+ }
+
+ /**
+ * The remote's handler for requests to backup a table.
+ *
+ * @return bool|mixed|null
+ */
+ function respond_to_backup_remote_table() {
+ add_filter( 'wpmdb_before_response', array( $this, 'scramble' ) );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'remote_state_id' => 'key',
+ 'intent' => 'key',
+ 'url' => 'url',
+ 'table' => 'string',
+ 'form_data' => 'string',
+ 'stage' => 'key',
+ 'bottleneck' => 'positive_int',
+ 'prefix' => 'string',
+ 'current_row' => 'int',
+ 'last_table' => 'positive_int',
+ 'gzip' => 'positive_int',
+ 'primary_keys' => 'serialized',
+ 'path_current_site' => 'string',
+ 'domain_current_site' => 'text',
+ 'sig' => 'string',
+ );
+ $this->set_post_data( $key_rules, 'remote_state_id' );
+
+ $filtered_post = $this->filter_post_elements(
+ $this->state_data,
+ array(
+ 'action',
+ 'remote_state_id',
+ 'intent',
+ 'url',
+ 'table',
+ 'form_data',
+ 'stage',
+ 'bottleneck',
+ 'prefix',
+ 'current_row',
+ 'last_table',
+ 'gzip',
+ 'primary_keys',
+ 'path_current_site',
+ 'domain_current_site',
+ )
+ );
+
+ $filtered_post['primary_keys'] = stripslashes( $filtered_post['primary_keys'] );
+
+ if ( ! $this->verify_signature( $filtered_post, $this->settings['key'] ) ) {
+ $error_msg = $this->invalid_content_verification_error . ' (#137)';
+ $this->log_error( $error_msg, $filtered_post );
+ $result = $this->end_ajax( $error_msg );
+
+ return $result;
+ }
+
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
+ $result = $this->handle_table_backup();
+
+ return $result;
+ }
+
+ /**
+ * Exports table data from remote site during a Pull migration.
+ *
+ * @return string
+ */
+ function respond_to_process_pull_request() {
+ add_filter( 'wpmdb_before_response', array( $this, 'scramble' ) );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'remote_state_id' => 'key',
+ 'intent' => 'key',
+ 'url' => 'url',
+ 'table' => 'string',
+ 'form_data' => 'string',
+ 'stage' => 'key',
+ 'bottleneck' => 'positive_int',
+ 'current_row' => 'int',
+ 'last_table' => 'positive_int',
+ 'gzip' => 'positive_int',
+ 'primary_keys' => 'serialized',
+ 'site_url' => 'url',
+ 'find_replace_pairs' => 'serialized',
+ 'pull_limit' => 'positive_int',
+ 'db_version' => 'string',
+ 'path_current_site' => 'string',
+ 'domain_current_site' => 'text',
+ 'prefix' => 'string',
+ 'sig' => 'string',
+ );
+ $this->set_post_data( $key_rules, 'remote_state_id' );
+
+ $filtered_post = $this->filter_post_elements(
+ $this->state_data,
+ array(
+ 'action',
+ 'remote_state_id',
+ 'intent',
+ 'url',
+ 'table',
+ 'form_data',
+ 'stage',
+ 'bottleneck',
+ 'current_row',
+ 'last_table',
+ 'gzip',
+ 'primary_keys',
+ 'site_url',
+ 'find_replace_pairs',
+ 'pull_limit',
+ 'db_version',
+ 'path_current_site',
+ 'domain_current_site',
+ 'prefix',
+ )
+ );
+
+ $filtered_post['primary_keys'] = stripslashes( $filtered_post['primary_keys'] );
+ $filtered_post['find_replace_pairs'] = stripslashes( $filtered_post['find_replace_pairs'] );
+
+ if ( ! $this->verify_signature( $filtered_post, $this->settings['key'] ) ) {
+ $error_msg = $this->invalid_content_verification_error . ' (#124)';
+ $this->log_error( $error_msg, $filtered_post );
+ $result = $this->end_ajax( $error_msg );
+
+ return $result;
+ }
+
+ if ( $this->settings['allow_pull'] != true ) {
+ $return = __( 'The connection succeeded but the remote site is configured to reject pull connections. You can change this in the "settings" tab on the remote site. (#141)', 'wp-migrate-db' );
+ $return = array( 'wpmdb_error' => 1, 'body' => $return );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ if ( ! empty( $filtered_post['db_version'] ) ) {
+ $this->target_db_version = $filtered_post['db_version'];
+ add_filter( 'wpmdb_create_table_query', array( $this, 'mysql_compat_filter' ), 10, 5 );
+ }
+
+ $this->find_replace_pairs = WPMDB_Utils::unserialize( $filtered_post['find_replace_pairs'], __METHOD__ );
+
+ $this->maximum_chunk_size = $this->state_data['pull_limit'];
+ $this->process_table( $this->state_data['table'] );
+ ob_start();
+ $this->display_errors();
+ $return = ob_get_clean();
+ $result = $this->end_ajax( $return );
+
+ return $result;
+ }
+
+ /**
+ * Validates migration request as the remote site and sets up anything that may be needed before the migration starts.
+ *
+ * @return array
+ */
+ function respond_to_remote_initiate_migration() {
+ add_filter( 'wpmdb_before_response', array( $this, 'scramble' ) );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'intent' => 'key',
+ 'form_data' => 'string',
+ 'sig' => 'string',
+ 'site_details' => 'serialized',
+ );
+ $this->set_post_data( $key_rules );
+
+ global $wpdb;
+
+ $return = array();
+ $filtered_post = $this->filter_post_elements(
+ $this->state_data,
+ array(
+ 'action',
+ 'intent',
+ 'form_data',
+ 'site_details',
+ )
+ );
+
+ $filtered_post['site_details'] = stripslashes( $filtered_post['site_details'] );
+
+ if ( $this->verify_signature( $filtered_post, $this->settings['key'] ) ) {
+ if ( isset( $this->settings[ 'allow_' . $this->state_data['intent'] ] ) && ( true === $this->settings[ 'allow_' . $this->state_data['intent'] ] || 1 === $this->settings[ 'allow_' . $this->state_data['intent'] ] ) ) {
+ $return['error'] = 0;
+ } else {
+ $return['error'] = 1;
+ if ( $this->state_data['intent'] == 'pull' ) {
+ $return['message'] = __( 'The connection succeeded but the remote site is configured to reject pull connections. You can change this in the "settings" tab on the remote site. (#110)', 'wp-migrate-db' );
+ } else {
+ $return['message'] = __( 'The connection succeeded but the remote site is configured to reject push connections. You can change this in the "settings" tab on the remote site. (#110)', 'wp-migrate-db' );
+ }
+ }
+ } else {
+ $return['error'] = 1;
+ $error_msg = $this->invalid_content_verification_error . ' (#111)';
+ $this->log_error( $error_msg, $filtered_post );
+ $return['message'] = $error_msg;
+ }
+
+ // If there is an error, no need to parse args or create migration state.
+ if ( ! empty( $return['error'] ) ) {
+ $result = $this->end_ajax( serialize( $return ) );
+
+ return $result;
+ }
+
+ $this->log_usage( $this->state_data['intent'] . '-remote' );
+
+ $this->state_data['site_details'] = WPMDB_Utils::unserialize( $filtered_post['site_details'], __METHOD__ );
+
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
+
+ if ( ! empty( $this->form_data['create_backup'] ) && $this->state_data['intent'] == 'push' ) {
+ $return['dump_filename'] = basename( $this->get_sql_dump_info( 'backup', 'path' ) );
+ $return['dump_filename'] = substr( $return['dump_filename'], 0, -4 );
+ $return['dump_url'] = $this->get_sql_dump_info( 'backup', 'url' );
+ }
+
+ if ( $this->state_data['intent'] == 'push' ) {
+ // sets up our table to store 'ALTER' queries
+ $create_alter_table_query = $this->get_create_alter_table_query();
+ $process_chunk_result = $this->process_chunk( $create_alter_table_query );
+ if ( true !== $process_chunk_result ) {
+ $result = $this->end_ajax( $process_chunk_result );
+
+ return $result;
+ }
+ $return['db_version'] = $wpdb->db_version();
+ $return['site_url'] = site_url();
+ }
+
+ // Store current migration state and return its id.
+ $state = array_merge( $this->state_data, $return );
+ $return['remote_state_id'] = $this->migration_state->id();
+ $return = $this->save_migration_state( $state, $return );
+
+ $result = $this->end_ajax( serialize( $return ) );
+
+ return $result;
+ }
+
+ /**
+ * No privileges AJAX endpoint for the wpmdb_verify_connection_to_remote_site action.
+ * Verifies that the connecting site is using the same version of WP Migrate DB as the local site.
+ * Verifies that the request is originating from a trusted source by verifying the request signature.
+ * Verifies that the local site has a valid licence.
+ * Verifies that the local site is allowed to perform a pull / push migration.
+ * If all is successful, returns an array of local site information used to complete the migration.
+ *
+ * @return mixed
+ */
+ function respond_to_verify_connection_to_remote_site() {
+ $key_rules = array(
+ 'action' => 'key',
+ 'intent' => 'key',
+ 'referer' => 'string',
+ 'version' => 'string',
+ 'sig' => 'string',
+ );
+ $this->set_post_data( $key_rules );
+
+ $return = array();
+
+ $filtered_post = $this->filter_post_elements( $this->state_data, array( 'action', 'intent', 'referer', 'version' ) );
+
+ if ( ! isset( $filtered_post['version'] ) || version_compare( $filtered_post['version'], $this->plugin_version, '!=' ) ) {
+ $return['error'] = 1;
+ $return['error_id'] = 'version_mismatch';
+
+ if ( ! isset( $filtered_post['version'] ) ) {
+ $return['message'] = sprintf( __( 'Version Mismatch — We\'ve detected you have version %1$s of WP Migrate DB Pro at %2$s but are using an outdated version here. Please go to the Plugins page on both installs and check for updates.', 'wp-migrate-db' ), $GLOBALS['wpmdb_meta'][ $this->plugin_slug ]['version'], $this->get_short_home_address_from_url( home_url() ) );
+ } else {
+ $return['message'] = sprintf( __( 'Version Mismatch — We\'ve detected you have version %1$s of WP Migrate DB Pro at %2$s but are using %3$s here. Please go to the Plugins page on both installs and check for updates.', 'wp-migrate-db' ), $GLOBALS['wpmdb_meta'][ $this->plugin_slug ]['version'], $this->get_short_home_address_from_url( home_url() ), $filtered_post['version'], '%%plugins_url%%' );
+ }
+
+ $this->log_error( $return['message'], $filtered_post );
+ $result = $this->end_ajax( serialize( $return ) );
+
+ return $result;
+ }
+
+ // Only scramble response once we know it can be handled.
+ add_filter( 'wpmdb_before_response', array( $this, 'scramble' ) );
+
+ if ( ! $this->verify_signature( $filtered_post, $this->settings['key'] ) ) {
+ $return['error'] = 1;
+ $return['message'] = $this->invalid_content_verification_error . ' (#120) ' . _x( 'Try again?', 'Asking to try and connect to remote server after verification error', 'wp-migrate-db' ) . ' ';
+ $this->log_error( $this->invalid_content_verification_error . ' (#120)', $filtered_post );
+ $result = $this->end_ajax( serialize( $return ) );
+
+ return $result;
+ }
+
+ if ( ! $this->is_valid_licence() ) {
+ $local_host = $this->get_short_home_address_from_url( home_url() );
+ $remote_host = $this->state_data['referer'];
+
+ $return['error'] = 1;
+
+ $return['message'] = sprintf( __( "Activate remote license — Looks like you don't have a WP Migrate DB Pro license active at %s.", 'wp-migrate-db' ), $local_host );
+ $return['message'] .= ' ';
+ $return['message'] .= sprintf( __( 'Copy %1$s license key to %2$s and activate it', 'wp-migrate-db' ), $remote_host, $local_host );
+ $return['message'] .= ' ';
+ $result = $this->end_ajax( serialize( $return ) );
+
+ return $result;
+ }
+
+ if ( ! isset( $this->settings[ 'allow_' . $this->state_data['intent'] ] ) || $this->settings[ 'allow_' . $this->state_data['intent'] ] != true ) {
+ $return['error'] = 1;
+
+ if ( $this->state_data['intent'] == 'pull' ) {
+ $message = __( 'The connection succeeded but the remote site is configured to reject pull connections. You can change this in the "settings" tab on the remote site. (#122)', 'wp-migrate-db' );
+ } else {
+ $message = __( 'The connection succeeded but the remote site is configured to reject push connections. You can change this in the "settings" tab on the remote site. (#122)', 'wp-migrate-db' );
+ }
+ $return['message'] = $message . sprintf( ' %s ', _x( 'Try again?', 'Attempt to connect to the remote server again', 'wp-migrate-db' ) );
+ $result = $this->end_ajax( serialize( $return ) );
+
+ return $result;
+ }
+
+ $site_details = $this->site_details();
+
+ $return['tables'] = $this->get_tables();
+ $return['prefixed_tables'] = $this->get_tables( 'prefix' );
+ $return['table_sizes'] = $this->get_table_sizes();
+ $return['table_rows'] = $this->get_table_row_count();
+ $return['table_sizes_hr'] = array_map( array( $this, 'format_table_sizes' ), $this->get_table_sizes() );
+ $return['path'] = $this->get_absolute_root_file_path();
+ $return['url'] = home_url();
+ $return['prefix'] = $site_details['prefix']; // TODO: Remove backwards compatibility.
+ $return['bottleneck'] = $this->get_bottleneck();
+ $return['delay_between_requests'] = $this->settings['delay_between_requests'];
+ $return['error'] = 0;
+ $return['plugin_version'] = $this->plugin_version;
+ $return['domain'] = $this->get_domain_current_site();
+ $return['path_current_site'] = $this->get_path_current_site();
+ $return['uploads_dir'] = $site_details['uploads_dir']; // TODO: Remove backwards compatibility.
+ $return['gzip'] = ( $this->gzip() ? '1' : '0' );
+ $return['post_types'] = $this->get_post_types();
+ // TODO: Use WP_Filesystem API.
+ $return['write_permissions'] = ( is_writeable( $this->get_upload_info( 'path' ) ) ? '1' : '0' );
+ $return['upload_dir_long'] = $this->get_upload_info( 'path' );
+ $return['temp_prefix'] = $this->temp_prefix;
+ $return['lower_case_table_names'] = $this->get_lower_case_table_names_setting();
+ $return['subsites'] = $site_details['subsites']; // TODO: Remove backwards compatibility.
+ $return['site_details'] = $this->site_details();
+ $return = apply_filters( 'wpmdb_establish_remote_connection_data', $return );
+ $result = $this->end_ajax( serialize( $return ) );
+
+ return $result;
+ }
+
+ function get_short_home_address_from_url( $url ) {
+ return untrailingslashit( str_replace( array( 'https://', 'http://', '//' ), '', $url ) );
+ }
+
+ /**
+ * Handler for a request to the remote to cancel a migration.
+ *
+ * @return bool|string
+ */
+ function respond_to_process_push_migration_cancellation() {
+ add_filter( 'wpmdb_before_response', array( $this, 'scramble' ) );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'remote_state_id' => 'key',
+ 'intent' => 'key',
+ 'url' => 'url',
+ 'form_data' => 'string',
+ 'temp_prefix' => 'string',
+ 'stage' => 'key',
+ 'dump_filename' => 'string',
+ 'sig' => 'string',
+ );
+ $this->set_post_data( $key_rules, 'remote_state_id' );
+
+ $filtered_post = $this->filter_post_elements(
+ $this->state_data,
+ array(
+ 'action',
+ 'remote_state_id',
+ 'intent',
+ 'url',
+ 'form_data',
+ 'temp_prefix',
+ 'stage',
+ 'dump_filename',
+ )
+ );
+
+ if ( ! $this->verify_signature( $filtered_post, $this->settings['key'] ) ) {
+ $result = $this->end_ajax( esc_html( $this->invalid_content_verification_error ) );
+
+ return $result;
+ }
+
+ $this->form_data = $this->parse_migration_form_data( $filtered_post['form_data'] );
+
+ if ( $filtered_post['stage'] == 'backup' && ! empty( $this->state_data['dumpfile_created'] ) ) {
+ $this->delete_export_file( $filtered_post['dump_filename'], true );
+ } else {
+ $this->delete_temporary_tables( $filtered_post['temp_prefix'] );
+ }
+
+ $result = $this->end_ajax( true );
+
+ return $result;
+ }
+
+ /**
+ * Triggers the wpmdb_migration_complete action once the migration is complete.
+ *
+ * @return bool|null
+ */
+ function fire_migration_complete() {
+ $this->set_post_data();
+ $filtered_post = $this->filter_post_elements( $this->state_data, array( 'action', 'url' ) );
+
+ if ( ! $this->verify_signature( $filtered_post, $this->settings['key'] ) ) {
+ $error_msg = $this->invalid_content_verification_error . ' (#138)';
+ $this->log_error( $error_msg, $filtered_post );
+ $result = $this->end_ajax( $error_msg );
+
+ return $result;
+ }
+
+ do_action( 'wpmdb_migration_complete', 'pull', $this->state_data['url'] );
+ $result = $this->end_ajax( true );
+
+ return $result;
+ }
+
+ function remove_exclude_post_revision_functionality() {
+ $this->accepted_fields = array_diff( $this->accepted_fields, array( 'exclude_post_revisions' ) );
+ remove_action( 'wpmdb_advanced_options', array( $this, 'template_exclude_post_revisions' ) );
+ }
+
+ function mask_licence( $licence ) {
+ $licence_parts = explode( '-', $licence );
+ $i = count( $licence_parts ) - 1;
+ $masked_licence = '';
+
+ foreach ( $licence_parts as $licence_part ) {
+ if ( $i == 0 ) {
+ $masked_licence .= $licence_part;
+ continue;
+ }
+
+ $masked_licence .= '';
+ $masked_licence .= str_repeat( '•', strlen( $licence_part ) ) . ' –';
+ --$i;
+ }
+
+ return $masked_licence;
+ }
+
+ function get_formatted_masked_licence() {
+ return sprintf(
+ '%s %s
',
+ $this->mask_licence( $this->settings['licence'] ),
+ network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-remove-licence' ) . '&wpmdb-remove-licence=1#settings' ),
+ _x( 'Remove', 'Delete license', 'wp-migrate-db' )
+ );
+ }
+
+ function inject_addon_install_resource( $res, $action, $args ) {
+ if ( 'plugin_information' != $action || empty( $args->slug ) ) {
+ return $res;
+ }
+
+ $addons = get_site_transient( 'wpmdb_addons' );
+
+ if ( ! isset( $addons[ $args->slug ] ) ) {
+ return $res;
+ }
+
+ $addon = $addons[ $args->slug ];
+ $required_version = $this->get_required_version( $args->slug );
+ $is_beta = $this->is_beta_version( $required_version ) && ! empty( $addon['beta_version'] );
+
+ $res = new stdClass();
+ $res->name = 'WP Migrate DB Pro ' . $addon['name'];
+ $res->version = $is_beta ? $addon['beta_version'] : $addon['version'];
+ $res->download_link = $this->get_plugin_update_download_url( $args->slug, $is_beta );
+ $res->tested = isset( $addon['tested'] ) ? $addon['tested'] : false;
+
+ return $res;
+ }
+
+ function site_transient_update_plugins( $trans ) {
+ $plugin_upgrade_data = $this->get_upgrade_data();
+
+ if ( false === $plugin_upgrade_data || ! isset( $plugin_upgrade_data['wp-migrate-db-pro'] ) ) {
+ return $trans;
+ }
+
+ foreach ( $plugin_upgrade_data as $plugin_slug => $upgrade_data ) {
+ // If pre-1.1.2 version of Media Files addon, use the slug as folder name
+ if ( ! isset( $GLOBALS['wpmdb_meta'][ $plugin_slug ]['folder'] ) ) {
+ $plugin_folder = $plugin_slug;
+ } else {
+ $plugin_folder = $GLOBALS['wpmdb_meta'][ $plugin_slug ]['folder'];
+ }
+
+ $plugin_basename = sprintf( '%s/%s.php', $plugin_folder, $plugin_slug );
+ $latest_version = $this->get_latest_version( $plugin_slug );
+
+ if ( ! isset( $GLOBALS['wpmdb_meta'][ $plugin_slug ]['version'] ) ) {
+ $version_file = sprintf( '%s%s/version.php', $this->plugins_dir(), $plugin_folder );
+
+ if ( file_exists( $version_file ) ) {
+ include_once( $version_file );
+ $installed_version = $GLOBALS['wpmdb_meta'][ $plugin_slug ]['version'];
+ } else {
+ $addon_file = sprintf( '%s%s/%s.php', $this->plugins_dir(), $plugin_folder, $plugin_slug );
+ // No addon plugin file or version.php file, bail and move on to the next addon
+ if ( ! file_exists( $addon_file ) ) {
+ continue;
+ }
+ /*
+ * The addon's plugin file exists but a version.php file doesn't
+ * We're now assuming that the addon is outdated and provide an arbitrary out-of-date version number
+ * This will trigger a update notice
+ */
+ $installed_version = $GLOBALS['wpmdb_meta'][ $plugin_slug ]['version'] = '0.1';
+ }
+ } else {
+ $installed_version = $GLOBALS['wpmdb_meta'][ $plugin_slug ]['version'];
+ }
+
+ if ( isset( $installed_version ) && version_compare( $installed_version, $latest_version, '<' ) ) {
+ $is_beta = $this->is_beta_version( $latest_version );
+
+ $trans->response[ $plugin_basename ] = new stdClass();
+ $trans->response[ $plugin_basename ]->url = $this->dbrains_api_base;
+ $trans->response[ $plugin_basename ]->slug = $plugin_slug;
+ $trans->response[ $plugin_basename ]->package = $this->get_plugin_update_download_url( $plugin_slug, $is_beta );
+ $trans->response[ $plugin_basename ]->new_version = $latest_version;
+ $trans->response[ $plugin_basename ]->id = '0';
+ $trans->response[ $plugin_basename ]->plugin = $plugin_basename;
+ }
+ }
+
+ return $trans;
+ }
+
+ function enqueue_plugin_update_script( $hook ) {
+ if ( 'plugins.php' != $hook ) {
+ return;
+ }
+ $ver_string = '-' . str_replace( '.', '', $this->plugin_version );
+ $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
+ $src = plugins_url( "asset/dist/js/plugin-update{$ver_string}{$min}.js", dirname( __FILE__ ) );
+
+ wp_enqueue_script( 'wp-migrate-db-pro-plugin-update-script', $src, array( 'jquery' ), false, true );
+
+ wp_localize_script( 'wp-migrate-db-pro-plugin-update-script', 'wpmdb_nonces', array( 'check_licence' => wp_create_nonce( 'check-licence' ), ) );
+
+ wp_localize_script( 'wp-migrate-db-pro-plugin-update-script', 'wpmdb_update_strings', array( 'check_license_again' => __( 'Check my license again', 'wp-migrate-db' ), 'license_check_problem' => __( 'A problem occurred when trying to check the license, please try again.', 'wp-migrate-db' ), ) );
+ }
+
+ function add_plugin_update_styles() {
+ $version = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? time() : $this->plugin_version;
+ $plugins_url = trailingslashit( plugins_url() ) . trailingslashit( $this->plugin_folder_name );
+ $src = $plugins_url . 'asset/dist/css/plugin-update-styles.css';
+ wp_enqueue_style( 'plugin-update-styles', $src, array(), $version );
+ }
+
+ /**
+ * Appends an export of a table to a backup file as per params defined in $this->state_data.
+ *
+ * @return mixed|null
+ */
+ function handle_table_backup() {
+ $this->set_post_data();
+
+ if ( empty( $this->state_data['dumpfile_created'] ) ) {
+ $this->state_data['dumpfile_created'] = true;
+ $this->save_migration_state( $this->state_data );
+ }
+
+ if ( isset( $this->form_data['gzip_file'] ) ) {
+ unset( $this->form_data['gzip_file'] );
+ }
+
+ $this->maximum_chunk_size = $this->get_bottleneck();
+ $sql_dump_file_name = $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR;
+ $sql_dump_file_name .= $this->format_dump_name( $this->state_data['dump_filename'] );
+ $file_created = file_exists( $sql_dump_file_name );
+ $this->fp = $this->open( $sql_dump_file_name );
+
+ if ( $file_created == false ) {
+ $this->db_backup_header();
+ }
+
+ $result = $this->process_table( $this->state_data['table'] );
+
+ if ( isset( $this->fp ) ) {
+ $this->close( $this->fp );
+ }
+
+ ob_start();
+ $this->display_errors();
+ $maybe_errors = trim( ob_get_clean() );
+
+ if ( false === empty( $maybe_errors ) ) {
+ $maybe_errors = array( 'wpmdb_error' => 1, 'body' => $maybe_errors );
+ $result = $this->end_ajax( json_encode( $maybe_errors ) );
+
+ return $result;
+ }
+
+ return $result;
+ }
+
+ /**
+ * AJAX handler for checking a licence.
+ *
+ * @return string (JSON)
+ */
+ function ajax_check_licence() {
+ $this->check_ajax_referer( 'check-licence' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'licence' => 'string',
+ 'context' => 'key',
+ 'nonce' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+ $licence = ( empty( $this->state_data['licence'] ) ? $this->get_licence_key() : $this->state_data['licence'] );
+ $response = $this->check_licence( $licence );
+ $decoded_response = json_decode( $response, ARRAY_A );
+ $context = ( empty( $this->state_data['context'] ) ? null : $this->state_data['context'] );
+
+ if ( false == $licence ) {
+ $decoded_response = array( 'errors' => array() );
+ $decoded_response['errors'] = array( sprintf( '%s
', $this->get_licence_status_message() ) );
+ } else if ( ! empty( $decoded_response['dbrains_api_down'] ) ) {
+ $help_message = get_site_transient( 'wpmdb_help_message' );
+
+ if ( ! $help_message ) {
+ ob_start();
+ ?>
+ active license, you may send an email to the following address.', 'wp-migrate-db' ); ?>
+
+
+
+ wpmdb@deliciousbrains.com
+ get_licence_status_message( null, $context );
+ foreach ( $licence_status_messages as $frontend_context => $status_message ) {
+ $decoded_response['errors']['subscription_expired'][ $frontend_context ] = sprintf( '%s
', $status_message );
+ }
+ } else {
+ $decoded_response['errors'] = array( sprintf( '%s
', $this->get_licence_status_message( null, $context ) ) );
+ }
+ } elseif ( ! empty( $decoded_response['message'] ) && ! get_site_transient( 'wpmdb_help_message' ) ) {
+ set_site_transient( 'wpmdb_help_message', $decoded_response['message'], $this->transient_timeout );
+ }
+
+ if ( isset( $decoded_response['addon_list'] ) ) {
+ ob_start();
+
+ if ( empty( $decoded_response['errors'] ) ) {
+ $addons_available = ( $decoded_response['addons_available'] == '1' );
+
+ if ( ! $addons_available ) {
+ ?>
+
+ – My Account to upgrade in just a few clicks.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' ); ?>
+
+ $addon ) {
+ $plugin_file = sprintf( '%1$s/%1$s.php', $key );
+ $plugin_ids = array_keys( get_plugins() );
+
+ if ( in_array( $plugin_file, $plugin_ids ) ) {
+ $actions = '' . _x( 'Installed', 'Installed on website but not activated', 'wp-migrate-db' );
+ if ( is_plugin_active( $plugin_file ) ) {
+ $actions .= ' & ' . _x( 'Activated', 'Installed and activated on website', 'wp-migrate-db' ) . ' ';
+ } else {
+ $activate_url = wp_nonce_url( network_admin_url( 'plugins.php?action=activate&plugin=' . $plugin_file ), 'activate-plugin_' . $plugin_file );
+ $actions .= sprintf( ' %s ', $activate_url, _x( 'Activate', 'Enable addon so it may be used', 'wp-migrate-db' ) );
+ }
+ } else {
+ $install_url = wp_nonce_url( network_admin_url( 'update.php?action=install-plugin&plugin=' . $key ), 'install-plugin_' . $key );
+ $actions = sprintf( '%s ', $install_url, _x( 'Install', 'Download and activate addon', 'wp-migrate-db' ) );
+ }
+
+ $required_version = $this->get_required_version( $key );
+
+ $download_url = $this->get_plugin_update_download_url( $key, $this->is_beta_version( $required_version ) );
+ $actions .= sprintf( '%s ', $download_url, _x( 'Download', 'Download to your computer', 'wp-migrate-db' ) ); ?>
+
+
+
+ end_ajax( $response );
+
+ return $result;
+ }
+
+ /**
+ * AJAX handler for activating a licence.
+ *
+ * @return string (JSON)
+ */
+ function ajax_activate_licence() {
+ $this->check_ajax_referer( 'activate-licence' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'licence_key' => 'string',
+ 'context' => 'key',
+ 'nonce' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+ $args = array(
+ 'licence_key' => urlencode( $this->state_data['licence_key'] ),
+ 'site_url' => urlencode( untrailingslashit( network_home_url( '', 'http' ) ) ),
+ );
+
+ $response = $this->dbrains_api_request( 'activate_licence', $args );
+ $decoded_response = json_decode( $response, true );
+
+ if ( empty( $decoded_response['errors'] ) && empty( $decoded_response['dbrains_api_down'] ) ) {
+ $this->set_licence_key( $this->state_data['licence_key'] );
+ $decoded_response['masked_licence'] = $this->get_formatted_masked_licence();
+ } else {
+ if ( isset( $decoded_response['errors']['activation_deactivated'] ) ) {
+ $this->set_licence_key( $this->state_data['licence_key'] );
+ } elseif ( isset( $decoded_response['errors']['subscription_expired'] ) || isset( $decoded_response['dbrains_api_down'] ) ) {
+ $this->set_licence_key( $this->state_data['licence_key'] );
+ $decoded_response['masked_licence'] = $this->get_formatted_masked_licence();
+ }
+
+ set_site_transient( 'wpmdb_licence_response', $response, $this->transient_timeout );
+ $decoded_response['errors'] = array(
+ sprintf( '%s
', $this->get_licence_status_message( $decoded_response, $this->state_data['context'] ) ),
+ );
+ if ( isset( $decoded_response['dbrains_api_down'] ) ) {
+ $decoded_response['errors'][] = $decoded_response['dbrains_api_down'];
+ }
+ }
+
+ $result = $this->end_ajax( json_encode( $decoded_response ) );
+
+ return $result;
+ }
+
+ /**
+ * Clear update transients when the user clicks the "Check Again" button from the update screen.
+ *
+ * @param object $current_screen
+ */
+ function check_again_clear_transients( $current_screen ) {
+ if ( ! isset( $current_screen->id ) || strpos( $current_screen->id, 'update-core' ) === false || ! isset( $_GET['force-check'] ) ) {
+ return;
+ }
+
+ delete_site_transient( 'wpmdb_upgrade_data' );
+ delete_site_transient( 'update_plugins' );
+ delete_site_transient( 'wpmdb_licence_response' );
+ delete_site_transient( 'wpmdb_dbrains_api_down' );
+ }
+
+ /**
+ * Handler for the ajax request to process a chunk of data (e.g. SQL inserts).
+ *
+ * @return bool|null
+ */
+ function respond_to_process_chunk() {
+ add_filter( 'wpmdb_before_response', array( $this, 'scramble' ) );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'remote_state_id' => 'key',
+ 'table' => 'string',
+ 'chunk_gzipped' => 'positive_int',
+ 'sig' => 'string',
+ );
+ $this->set_post_data( $key_rules, 'remote_state_id' );
+
+ $filtered_post = $this->filter_post_elements( $this->state_data, array(
+ 'action',
+ 'remote_state_id',
+ 'table',
+ 'chunk_gzipped',
+ )
+ );
+
+ $gzip = ( isset( $this->state_data['chunk_gzipped'] ) && $this->state_data['chunk_gzipped'] );
+
+ $tmp_file_name = 'chunk.txt';
+
+ if ( $gzip ) {
+ $tmp_file_name .= '.gz';
+ }
+
+ $tmp_file_path = wp_tempnam( $tmp_file_name );
+
+ if ( ! isset( $_FILES['chunk']['tmp_name'] ) || ! move_uploaded_file( $_FILES['chunk']['tmp_name'], $tmp_file_path ) ) {
+ $result = $this->end_ajax( __( 'Could not upload the SQL to the server. (#135)', 'wp-migrate-db' ) );
+
+ return $result;
+ }
+
+ if ( false === ( $chunk = file_get_contents( $tmp_file_path ) ) ) {
+ $result = $this->end_ajax( __( 'Could not read the SQL file we uploaded to the server. (#136)', 'wp-migrate-db' ) );
+
+ return $result;
+ }
+
+ // TODO: Use WP_Filesystem API.
+ @unlink( $tmp_file_path );
+
+ $filtered_post['chunk'] = $chunk;
+
+ if ( ! $this->verify_signature( $filtered_post, $this->settings['key'] ) ) {
+ $error_msg = $this->invalid_content_verification_error . ' (#130)';
+ $this->log_error( $error_msg, $filtered_post );
+ $result = $this->end_ajax( $error_msg );
+
+ return $result;
+ }
+
+ if ( $this->settings['allow_push'] != true ) {
+ $result = $this->end_ajax( __( 'The connection succeeded but the remote site is configured to reject push connections. You can change this in the "settings" tab on the remote site. (#139)', 'wp-migrate-db' ) );
+
+ return $result;
+ }
+
+ if ( $gzip ) {
+ $filtered_post['chunk'] = gzuncompress( $filtered_post['chunk'] );
+ }
+
+ $process_chunk_result = $this->process_chunk( $filtered_post['chunk'] );
+ $result = $this->end_ajax( $process_chunk_result );
+
+ return $result;
+ }
+
+ function get_sensible_pull_limit() {
+ return apply_filters( 'wpmdb_sensible_pull_limit', min( 26214400, $this->settings['max_request'] ) );
+ }
+
+ /**
+ * Handler for ajax request to reset the secret key.
+ *
+ * @return bool|null
+ */
+ function ajax_reset_api_key() {
+ $this->check_ajax_referer( 'reset-api-key' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'nonce' => 'key',
+ );
+
+ $_POST = WPMDB_Sanitize::sanitize_data( $_POST, $key_rules, __METHOD__ );
+
+ if ( false === $_POST ) {
+ exit;
+ }
+
+ $this->settings['key'] = $this->generate_key();
+ update_site_option( 'wpmdb_settings', $this->settings );
+ $result = $this->end_ajax( sprintf( "%s\n%s", site_url( '', 'https' ), $this->settings['key'] ) );
+
+ return $result;
+ }
+
+ function get_plugin_title() {
+ return __( 'Migrate DB Pro', 'wp-migrate-db' );
+ }
+
+ /**
+ * Sends the local WP Migrate DB Pro licence to the remote machine and activates it, returns errors if applicable.
+ *
+ * @return array Empty array or an array containing an error message.
+ */
+ function ajax_copy_licence_to_remote_site() {
+ $this->check_ajax_referer( 'copy-licence-to-remote-site' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'url' => 'url',
+ 'key' => 'string',
+ 'nonce' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+ $return = array();
+
+ $data = array(
+ 'action' => 'wpmdb_copy_licence_to_remote_site',
+ 'licence' => $this->get_licence_key(),
+ );
+
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
+ $ajax_url = $this->ajax_url();
+ $serialized_response = $this->remote_post( $ajax_url, $data, __FUNCTION__, array(), true );
+
+ if ( false === $serialized_response ) {
+ $return = array( 'wpmdb_error' => 1, 'body' => $this->error );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ $response = WPMDB_Utils::unserialize( $serialized_response, __METHOD__ );
+
+ if ( false === $response ) {
+ $error_msg = __( 'Failed attempting to unserialize the response from the remote server. Please contact support.', 'wp-migrate-db' );
+ $return = array( 'wpmdb_error' => 1, 'body' => $error_msg );
+ $this->log_error( $error_msg, $serialized_response );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ if ( isset( $response['error'] ) && $response['error'] == 1 ) {
+ $return = array( 'wpmdb_error' => 1, 'body' => $response['message'] );
+ $this->log_error( $response['message'], $response );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ /**
+ * Stores and attempts to activate the licence key received via a remote machine, returns errors if applicable.
+ *
+ * @return array Empty array or an array containing an error message.
+ */
+ function respond_to_copy_licence_to_remote_site() {
+ add_filter( 'wpmdb_before_response', array( $this, 'scramble' ) );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'licence' => 'string',
+ 'sig' => 'string',
+ );
+ $this->set_post_data( $key_rules );
+
+ $filtered_post = $this->filter_post_elements( $this->state_data, array( 'action', 'licence' ) );
+
+ $return = array();
+
+ if ( ! $this->verify_signature( $filtered_post, $this->settings['key'] ) ) {
+ $return['error'] = 1;
+ $return['message'] = $this->invalid_content_verification_error . ' (#142)';
+ $this->log_error( $return['message'], $filtered_post );
+ $result = $this->end_ajax( serialize( $return ) );
+
+ return $result;
+ }
+
+ $this->set_licence_key( trim( $this->state_data['licence'] ) );
+ $licence = $this->get_licence_key();
+ $licence_status = json_decode( $this->check_licence( $licence ), true );
+
+ if ( isset( $licence_status['errors'] ) && ! isset( $licence_status['errors']['subscription_expired'] ) ) {
+ $return['error'] = 1;
+ $return['message'] = reset( $licence_status['errors'] );
+ $this->log_error( $return['message'], $licence_status );
+ $result = $this->end_ajax( serialize( $return ) );
+
+ return $result;
+ }
+
+ $result = $this->end_ajax( serialize( $return ) );
+
+ return $result;
+ }
+
+ /**
+ * Attempts to reactivate this instance via the Delicious Brains API.
+ *
+ * @return array Empty array or an array containing an error message.
+ */
+ function ajax_reactivate_licence() {
+ $this->check_ajax_referer( 'reactivate-licence' );
+
+ $key_rules = array(
+ 'action' => 'key',
+ 'nonce' => 'key',
+ );
+ $this->set_post_data( $key_rules );
+
+ $filtered_post = $this->filter_post_elements( $this->state_data, array( 'action', 'nonce' ) );
+ $return = array();
+
+ $args = array(
+ 'licence_key' => urlencode( $this->get_licence_key() ),
+ 'site_url' => urlencode( untrailingslashit( network_home_url( '', 'http' ) ) ),
+ );
+
+ $response = $this->dbrains_api_request( 'reactivate_licence', $args );
+ $decoded_response = json_decode( $response, true );
+
+ if ( isset( $decoded_response['dbrains_api_down'] ) ) {
+ $return['wpmdb_dbrains_api_down'] = 1;
+ $return['body'] = $decoded_response['dbrains_api_down'];
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ if ( isset( $decoded_response['errors'] ) ) {
+ $return['wpmdb_error'] = 1;
+ $return['body'] = reset( $decoded_response['errors'] );
+ $this->log_error( $return['body'], $decoded_response );
+ $result = $this->end_ajax( json_encode( $return ) );
+
+ return $result;
+ }
+
+ delete_site_transient( 'wpmdb_upgrade_data' );
+ delete_site_transient( 'wpmdb_licence_response' );
+
+ $result = $this->end_ajax( json_encode( array() ) );
+
+ return $result;
+ }
+
+ /**
+ * Shows a message below the plugin on the plugins page when:
+ * 1. the license hasn't been activated
+ * 2. when there's an update available but the license is expired
+ *
+ * @param string $plugin_path Path of current plugin listing relative to plugins directory
+ *
+ * @return void
+ */
+ function plugin_row( $plugin_path, $plugin_data ) {
+ $plugin_title = $plugin_data['Name'];
+ $plugin_slug = sanitize_title( $plugin_title );
+ $licence = $this->get_licence_key();
+ $licence_response = $this->is_licence_expired();
+ $licence_problem = isset( $licence_response['errors'] );
+ $active = is_plugin_active( $plugin_path ) ? 'active' : '';
+ $shiny_updates = version_compare( get_bloginfo( 'version' ), '4.6-beta1-37926', '>=' );
+ $update_msg_classes = $shiny_updates ? 'notice inline notice-warning notice-alt post-shiny-updates' : 'pre-shiny-updates';
+
+ if ( ! isset( $GLOBALS['wpmdb_meta'][ $plugin_slug ]['version'] ) ) {
+ $installed_version = '0';
+ } else {
+ $installed_version = $GLOBALS['wpmdb_meta'][ $plugin_slug ]['version'];
+ }
+
+ $latest_version = $this->get_latest_version( $plugin_slug );
+
+ $new_version = '';
+ if ( version_compare( $installed_version, $latest_version, '<' ) ) {
+ $new_version = sprintf( __( 'There is a new version of %s available.', 'wp-migrate-db' ), $plugin_title );
+ $new_version .= ' ';
+ $new_version .= sprintf( __( 'View version %s details', 'wp-migrate-db' ), $latest_version ) . ' .';
+ }
+
+ if ( ! $new_version && ! empty( $licence ) ) {
+ return;
+ }
+
+ if ( empty( $licence ) ) {
+ $settings_link = sprintf( '%s ', network_admin_url( $this->plugin_base ) . '#settings', _x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) );
+ if ( $new_version ) {
+ $message = sprintf( __( 'To update, go to %1$s and enter your license key. If you don\'t have a license key, you may purchase one .', 'wp-migrate-db' ), $settings_link, 'http://deliciousbrains.com/wp-migrate-db-pro/pricing/' );
+ } else {
+ $message = sprintf( __( 'To finish activating %1$s, please go to %2$s and enter your license key. If you don\'t have a license key, you may purchase one .', 'wp-migrate-db' ), $this->plugin_title, $settings_link, 'http://deliciousbrains.com/wp-migrate-db-pro/pricing/' );
+ }
+ } elseif ( $licence_problem ) {
+ $message = array_shift( $licence_response['errors'] ) . sprintf( ' %s ', __( 'Check my license again', 'wp-migrate-db' ) );
+ } else {
+ return;
+ } ?>
+
+
+
+
+
+
+ get_licence_status_message( null, 'update' ); ?>
+
+
+
+
+
+
+
+ get_latest_version( $plugin_slug );
+
+ if ( $this->is_beta_version( $latest_version ) ) {
+ $filename .= '-beta';
+ }
+
+ $url = $this->dbrains_api_base . '/content/themes/delicious-brains/update-popup/' . $filename . '.html';
+ $data = wp_remote_get( $url, array( 'timeout' => 30 ) );
+
+ if ( is_wp_error( $data ) || 200 != $data['response']['code'] ) {
+ echo '' . __( 'Could not retrieve version details. Please try again.', 'wp-migrate-db' ) . '
';
+ } else {
+ echo $data['body'];
+ }
+
+ exit;
+ }
+}
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/compatibility/wp-migrate-db-pro-compatibility.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/compatibility/wp-migrate-db-pro-compatibility.php
new file mode 100644
index 0000000..8bdbc17
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/compatibility/wp-migrate-db-pro-compatibility.php
@@ -0,0 +1,145 @@
+ $functions ) {
+ foreach ( $functions as $key => $function ) {
+ // searching for function this way as can't rely on the calling class being named TGM_Plugin_Activation
+ if ( false !== strpos( $key, 'force_activation' ) ) {
+ unset( $wp_filter['admin_init'][ $priority ][ $key ] );
+
+ return;
+ }
+ }
+ }
+ }
+}
+
+add_action( 'admin_init', 'wpmdbc_tgmpa_compatibility', 1 );
+
+/**
+ * remove blog-active plugins
+ *
+ * @param array $plugins numerically keyed array of plugin names
+ *
+ * @return array
+ */
+function wpmdbc_exclude_plugins( $plugins ) {
+ if ( ! is_array( $plugins ) || empty( $plugins ) ) {
+ return $plugins;
+ }
+
+ if ( ! wpmdbc_is_compatibility_mode_request() ) {
+ return $plugins;
+ }
+
+ $blacklist_plugins = wpmdbc_get_blacklist_plugins();
+
+ if ( ! empty( $blacklist_plugins ) ) {
+ foreach ( $plugins as $key => $plugin ) {
+ if ( false !== strpos( $plugin, 'wp-migrate-db-pro' ) || ! isset( $blacklist_plugins[ $plugin ] ) ) {
+ continue;
+ }
+ unset( $plugins[ $key ] );
+ }
+ }
+
+ return $plugins;
+}
+
+add_filter( 'option_active_plugins', 'wpmdbc_exclude_plugins' );
+
+/**
+ * remove network-active plugins
+ *
+ * @param array $plugins array of plugins keyed by name (name=>timestamp pairs)
+ *
+ * @return array
+ */
+function wpmdbc_exclude_site_plugins( $plugins ) {
+ if ( ! is_array( $plugins ) || empty( $plugins ) ) {
+ return $plugins;
+ }
+
+ if ( ! wpmdbc_is_compatibility_mode_request() ) {
+ return $plugins;
+ }
+
+ $blacklist_plugins = wpmdbc_get_blacklist_plugins();
+
+ if ( ! empty( $blacklist_plugins ) ) {
+ foreach ( array_keys( $plugins ) as $plugin ) {
+ if ( false !== strpos( $plugin, 'wp-migrate-db-pro' ) || ! isset( $blacklist_plugins[ $plugin ] ) ) {
+ continue;
+ }
+ unset( $plugins[ $plugin ] );
+ }
+ }
+
+ return $plugins;
+}
+
+add_filter( 'site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins' );
+
+/**
+ * Should the current request be processed by Compatibility Mode?
+ *
+ * @return bool
+ */
+function wpmdbc_is_compatibility_mode_request() {
+ if ( ! defined( 'DOING_AJAX' ) ||
+ ! DOING_AJAX ||
+ ! isset( $_POST['action'] ) ||
+ false === strpos( $_POST['action'], 'wpmdb' ) ||
+ in_array( $_POST['action'], array( 'wpmdb_flush', 'wpmdb_remote_flush' ) )
+ ) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Returns an array of plugin slugs to be blacklisted.
+ *
+ * @return array
+ */
+function wpmdbc_get_blacklist_plugins() {
+ $blacklist_plugins = array();
+
+ $wpmdb_settings = get_site_option( 'wpmdb_settings' );
+
+ if ( ! empty( $wpmdb_settings['blacklist_plugins'] ) ) {
+ $blacklist_plugins = array_flip( $wpmdb_settings['blacklist_plugins'] );
+ }
+
+ return $blacklist_plugins;
+}
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/languages/wp-migrate-db-en.pot b/wordpress/wp-content/plugins/wp-migrate-db-pro/languages/wp-migrate-db-en.pot
new file mode 100644
index 0000000..ff5b002
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/languages/wp-migrate-db-en.pot
@@ -0,0 +1,2289 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the wp-migrate-db package.
+# FIRST AUTHOR , YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: wp-migrate-db\n"
+"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
+"POT-Creation-Date: 2017-06-13 17:42-0700\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: class/wpmdb-base.php:172
+msgid ""
+"Invalid content verification signature, please verify the connection "
+"information on the remote site and try again."
+msgstr ""
+
+#: class/wpmdb-base.php:364
+#, php-format
+msgid ""
+"The connection to the remote server has timed out, no changes have been "
+"committed. (#134 - scope: %s)"
+msgstr ""
+
+#: class/wpmdb-base.php:366
+#, php-format
+msgid "We could not find: %s. Are you sure this is the correct URL?"
+msgstr ""
+
+#: class/wpmdb-base.php:371
+msgid ""
+"It appears that you might be trying to pull from a local environment. This "
+"will not work if this website happens to be located on a remote "
+"server, it would be impossible for this server to contact your local "
+"environment."
+msgstr ""
+
+#: class/wpmdb-base.php:373
+msgid ""
+"It appears that you might be trying to push to a local environment. This "
+"will not work if this website happens to be located on a remote "
+"server, it would be impossible for this server to contact your local "
+"environment."
+msgstr ""
+
+#: class/wpmdb-base.php:381
+#, php-format
+msgid ""
+"We've detected that WP_HTTP_BLOCK_EXTERNAL is enabled and the "
+"host %1$s has not been added to WP_ACCESSIBLE_HOSTS"
+"code>. Please disable WP_HTTP_BLOCK_EXTERNAL or add "
+"%1$s to WP_ACCESSIBLE_HOSTS to continue. More information . (#147 - scope: %3$s)"
+msgstr ""
+
+#: class/wpmdb-base.php:384
+#, php-format
+msgid ""
+"Couldn't connect over HTTPS. You might want to try regular HTTP instead. "
+"(#121 - scope: %s)"
+msgstr ""
+
+#: class/wpmdb-base.php:386
+#, php-format
+msgid ""
+"SSL Connection error: (#121 - scope: %s) This typically "
+"means that the version of SSL that your local site is using to connect to "
+"the remote is incompatible or, more likely, being rejected by the remote "
+"server because it's insecure. See our "
+"documentation for possible solutions."
+msgstr ""
+
+#: class/wpmdb-base.php:388
+#, php-format
+msgid ""
+"The connection failed, an unexpected error occurred, please contact support. "
+"(#121 - scope: %s)"
+msgstr ""
+
+#: class/wpmdb-base.php:396
+msgid ""
+"The remote site is protected with Basic Authentication. Please enter the "
+"username and password above to continue. (401 Unauthorized)"
+msgstr ""
+
+#: class/wpmdb-base.php:403
+#, php-format
+msgid ""
+"Unable to connect to the remote server, please check the connection details "
+"- %1$s %2$s (#129 - scope: %3$s)"
+msgstr ""
+
+#: class/wpmdb-base.php:413
+#, php-format
+msgid ""
+"WP Migrate DB Pro does not seem to be installed or active on the remote "
+"site. (#131 - scope: %s)"
+msgstr ""
+
+#: class/wpmdb-base.php:416
+#, php-format
+msgid ""
+"A response was expected from the remote, instead we got nothing. (#146 - "
+"scope: %1$s) Please review %2$s for possible solutions."
+msgstr ""
+
+#: class/wpmdb-base.php:416
+#: class/wpmdb.php:3627
+msgid "our documentation"
+msgstr ""
+
+#: class/wpmdb-base.php:425
+msgid ""
+"There was a problem with the AJAX request, we were expecting a serialized "
+"response, instead we received: "
+msgstr ""
+
+#: class/wpmdb-base.php:772
+#: class/wpmdb-base.php:1233
+#, php-format
+msgid ""
+"Could not connect to api.deliciousbrains.com — You "
+"will not receive update notifications or be able to activate your license "
+"until this is fixed. This issue is often caused by an improperly configured "
+"SSL server (https). We recommend fixing "
+"the SSL configuration on your server , but if you need a quick fix you "
+"can:%2$s"
+msgstr ""
+
+#: class/wpmdb-base.php:772
+#: class/wpmdb-base.php:1233
+msgid "Temporarily disable SSL for connections to api.deliciousbrains.com"
+msgstr ""
+
+#: class/wpmdb-base.php:780
+#: class/wpmdb-base.php:1239
+#, php-format
+msgid ""
+"We've detected that WP_HTTP_BLOCK_EXTERNAL is enabled and the "
+"host %1$s has not been added to WP_ACCESSIBLE_HOSTS"
+"code>. Please disable WP_HTTP_BLOCK_EXTERNAL or add "
+"%1$s to WP_ACCESSIBLE_HOSTS to continue. More information ."
+msgstr ""
+
+#: class/wpmdb-base.php:825
+msgid ""
+"Delicious Brains API is Down — Unfortunately we're "
+"experiencing some problems with our server."
+msgstr ""
+
+#: class/wpmdb-base.php:829
+#, php-format
+msgctxt "ex. 2 hours ago"
+msgid "%s ago"
+msgstr ""
+
+#: class/wpmdb-base.php:834
+msgid "Here's the most recent update on its status"
+msgstr ""
+
+#: class/wpmdb-base.php:861
+#, php-format
+msgid ""
+"Error retrieving download from deliciousbrain.com. Please try again or "
+"download manually from %2$s ."
+msgstr ""
+
+#: class/wpmdb-base.php:861
+msgctxt "Delicious Brains account"
+msgid "My Account"
+msgstr ""
+
+#: class/wpmdb-base.php:920
+#: class/wpmdb.php:113
+#: class/wpmdb.php:314
+#: class/wpmdbpro.php:1573
+msgctxt "Plugin configuration and preferences"
+msgid "Settings"
+msgstr ""
+
+#: class/wpmdb-base.php:921
+#, php-format
+msgid ""
+"To finish activating WP Migrate DB Pro, please go to %1$s and enter your "
+"license key. If you don't have a license key, you may purchase one ."
+msgstr ""
+
+#: class/wpmdb-base.php:1152
+#: class/wpmdb-base.php:1162
+msgctxt "A new version of the plugin is available"
+msgid "Update Available"
+msgstr ""
+
+#: class/wpmdb-base.php:1153
+#, php-format
+msgid "A new version of %1$s is now available. %2$s"
+msgstr ""
+
+#: class/wpmdb-base.php:1153
+#: class/wpmdb-base.php:1163
+msgctxt "Download and install a new version of the plugin"
+msgid "Update Now"
+msgstr ""
+
+#: class/wpmdb-base.php:1163
+#, php-format
+msgid ""
+"%1$s %2$s is now available. You currently have %3$s installed. %5$s "
+msgstr ""
+
+#: class/wpmdb-base.php:1207
+#, php-format
+msgid ""
+"Activate Your License — Please enter your license key to enable push and pull functionality, "
+"priority support and plugin updates."
+msgstr ""
+
+#: class/wpmdb-base.php:1224
+msgid ""
+"We've temporarily activated your license and will complete the "
+"activation once the Delicious Brains API is available again. "
+msgstr ""
+
+#: class/wpmdb-base.php:1246
+#, php-format
+msgid ""
+"Your License Was Cancelled — Please visit My Account to renew or upgrade your license and "
+"enable push and pull."
+msgstr ""
+
+#: class/wpmdb-base.php:1247
+#: class/wpmdb-base.php:1252
+#: class/wpmdb-base.php:1273
+#: class/wpmdb-base.php:1277
+#: class/wpmdbpro.php:1030
+#: class/wpmdbpro.php:1580
+msgid "Check my license again"
+msgstr ""
+
+#: class/wpmdb-base.php:1250
+msgid "Your License Has Expired"
+msgstr ""
+
+#: class/wpmdb-base.php:1251
+#, php-format
+msgid "Login to My Account to renew. "
+msgstr ""
+
+#: class/wpmdb-base.php:1256
+msgid "Updates are only available to those with an active license. "
+msgstr ""
+
+#: class/wpmdb-base.php:1257
+msgid "Only active licenses can download and install addons. "
+msgstr ""
+
+#: class/wpmdb-base.php:1258
+msgid "Only active licenses can submit support requests. "
+msgstr ""
+
+#: class/wpmdb-base.php:1259
+msgid ""
+"All features will continue to work, but you won't be able to receive updates "
+"or email support. "
+msgstr ""
+
+#: class/wpmdb-base.php:1272
+#, php-format
+msgid ""
+"No Activations Left — Please visit My Account to upgrade your license or deactivate a "
+"previous activation and enable push and pull."
+msgstr ""
+
+#: class/wpmdb-base.php:1276
+#, php-format
+msgid ""
+"Your License Was Not Found — Perhaps you made a typo "
+"when defining your WPMDB_LICENCE constant in your wp-config.php? Please "
+"visit My Account to double check your "
+"license key."
+msgstr ""
+
+#: class/wpmdb-base.php:1280
+msgid "Your License Was Not Found — "
+msgstr ""
+
+#: class/wpmdb-base.php:1284
+msgid "Your License Is Inactive"
+msgstr ""
+
+#: class/wpmdb-base.php:1285
+msgid "Your license has been deactivated for this install."
+msgstr ""
+
+#: class/wpmdb-base.php:1285
+msgid "Reactivate License"
+msgstr ""
+
+#: class/wpmdb-base.php:1288
+#, php-format
+msgid ""
+"An Unexpected Error Occurred — Please contact us at "
+"%2$s and quote the following:"
+msgstr ""
+
+#: class/wpmdb-base.php:1327
+#, php-format
+msgid "Invalid nonce for: %s"
+msgstr ""
+
+#: class/wpmdb-base.php:1335
+#, php-format
+msgid "Access denied for: %s"
+msgstr ""
+
+#: class/wpmdb-base.php:1541
+msgctxt "dismiss notice permanently"
+msgid "Dismiss"
+msgstr ""
+
+#: class/wpmdb-base.php:1550
+msgid "Remind Me Later"
+msgstr ""
+
+#: class/wpmdb-base.php:1652
+msgid "Failed to save migration state. Please contact support."
+msgstr ""
+
+#: class/wpmdb-base.php:1675
+msgid "Failed to retrieve migration state. Please contact support."
+msgstr ""
+
+#: class/wpmdb-cli.php:62
+#, php-format
+msgid "CLI addon requires PHP %1$s+"
+msgstr ""
+
+#: class/wpmdb-cli.php:103
+msgid "Profile not found or unable to be generated from params."
+msgstr ""
+
+#: class/wpmdb-cli.php:142
+#, php-format
+msgid "The following table(s) do not exist in the %1$s database: %2$s"
+msgstr ""
+
+#: class/wpmdb-cli.php:191
+#, php-format
+msgid ""
+"We were expecting a JSON response, instead we received: %2$s (function name: "
+"%1$s)"
+msgstr ""
+
+#: class/wpmdb-cli.php:247
+msgid "Initiating migration..."
+msgstr ""
+
+#: class/wpmdb-cli.php:294
+msgid "Exporting tables"
+msgstr ""
+
+#: class/wpmdb-cli.php:297
+msgid "Running find & replace"
+msgstr ""
+
+#: class/wpmdb-cli.php:371
+msgid "No tables selected for migration."
+msgstr ""
+
+#: class/wpmdb-cli.php:464
+msgid "Cleaning up..."
+msgstr ""
+
+#: class/wpmdb-cli.php:548
+msgid "Unable to move exported file."
+msgstr ""
+
+#: class/wpmdb-cli.php:608
+msgid "Parameter errors: "
+msgstr ""
+
+#: class/wpmdb-cli.php:610
+#, php-format
+msgid "unknown %s parameter"
+msgstr ""
+
+#: class/wpmdb-cli.php:614
+msgid ""
+"Please make sure that you have activated the appropriate addons for WP "
+"Migrate DB Pro."
+msgstr ""
+
+#: class/wpmdb-cli.php:621
+msgid "Missing action parameter"
+msgstr ""
+
+#: class/wpmdb-cli.php:637
+msgid "Missing find and replace values."
+msgstr ""
+
+#: class/wpmdb-cli.php:644
+#, php-format
+msgid "%1$s and %2$s must contain the same number of values"
+msgstr ""
+
+#: class/wpmdb-cli.php:692
+#, php-format
+msgid ""
+"Cannot write to file \"%1$s\". Please ensure that the specified directory "
+"exists and is writable."
+msgstr ""
+
+#: class/wpmdb-command.php:66
+msgid "You must provide a destination filename."
+msgstr ""
+
+#: class/wpmdb-command.php:179
+msgid "WP Migrate DB CLI class not available."
+msgstr ""
+
+#: class/wpmdb-command.php:187
+#, php-format
+msgid "Export saved to: %s"
+msgstr ""
+
+#: class/wpmdb-command.php:190
+#: class/wpmdb.php:3188
+msgid "Find & Replace complete"
+msgstr ""
+
+#: class/wpmdb-replace.php:282
+msgid ""
+"Failed attempting to do the recursive unserialize replace. Please contact "
+"support."
+msgstr ""
+
+#: class/wpmdb-sanitize.php:39
+#, php-format
+msgid "%1$s was not expecting data to be an array."
+msgstr ""
+
+#: class/wpmdb-sanitize.php:60
+#, php-format
+msgid "%1$s was expecting an array but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:66
+#, php-format
+msgid "%1$s was expecting a string but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:73
+#, php-format
+msgid "%1$s was expecting a valid key but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:81
+#, php-format
+msgid "%1$s was expecting text but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:88
+#, php-format
+msgid "%1$s was expecting serialized data but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:94
+#: class/wpmdb-sanitize.php:101
+#, php-format
+msgid "%1$s was expecting JSON data but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:107
+#, php-format
+msgid "%1$s was expecting a valid numeric but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:114
+#, php-format
+msgid "%1$s was expecting an integer but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:121
+#, php-format
+msgid ""
+"%1$s was expecting a positive number (int) but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:128
+#, php-format
+msgid ""
+"%1$s was expecting a negative number (int) but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:135
+#, php-format
+msgid "%1$s was expecting 0 (int) but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:142
+#, php-format
+msgid "%1$s was expecting an empty value but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:149
+#, php-format
+msgid "%1$s was expecting a URL but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:157
+#, php-format
+msgid "%1$s was expecting a bool but got something else: \"%2$s\""
+msgstr ""
+
+#: class/wpmdb-sanitize.php:163
+#, php-format
+msgid "Unknown sanitization rule \"%1$s\" supplied by %2$s"
+msgstr ""
+
+#: class/wpmdb-utils.php:82
+#, php-format
+msgid "Scope: %s()."
+msgstr ""
+
+#: class/wpmdb-utils.php:83
+#, php-format
+msgid "WPMDB Error: Data cannot be unserialized. %s"
+msgstr ""
+
+#: class/wpmdb.php:112
+msgctxt "Configure a migration or export"
+msgid "Migrate"
+msgstr ""
+
+#: class/wpmdb.php:114
+msgctxt "Plugin extensions"
+msgid "Addons"
+msgstr ""
+
+#: class/wpmdb.php:115
+msgctxt "Get help or contact support"
+msgid "Help"
+msgstr ""
+
+#: class/wpmdb.php:179
+#, php-format
+msgid "The following directory could not be created: %s"
+msgstr ""
+
+#: class/wpmdb.php:184
+#, php-format
+msgid "Could not copy the compatibility plugin from %1$s to %2$s"
+msgstr ""
+
+#: class/wpmdb.php:190
+#, php-format
+msgid "Could not remove the compatibility plugin from %s"
+msgstr ""
+
+#: class/wpmdb.php:986
+#: class/wpmdbpro.php:328
+#: class/wpmdbpro.php:1417
+msgid ""
+"Failed attempting to unserialize the response from the remote server. Please "
+"contact support."
+msgstr ""
+
+#: class/wpmdb.php:1912
+msgid ""
+"Failed to retrieve table structure, please ensure your database is online. "
+"(#125)"
+msgstr ""
+
+#: class/wpmdb.php:1931
+msgid "Failed to get table structure."
+msgstr ""
+
+#: class/wpmdb.php:2009
+#, php-format
+msgid "Error creating temporary table. Table \"%s\" does not exist."
+msgstr ""
+
+#: class/wpmdb.php:2115
+#, php-format
+msgid "Delete any existing table %s"
+msgstr ""
+
+#: class/wpmdb.php:2126
+#, php-format
+msgid "Table structure of table %s"
+msgstr ""
+
+#: class/wpmdb.php:2134
+msgid ""
+"Failed to generate the create table query, please ensure your database is "
+"online. (#126)"
+msgstr ""
+
+#: class/wpmdb.php:2190
+#, php-format
+msgid "Data contents of table %s"
+msgstr ""
+
+#: class/wpmdb.php:2208
+#, php-format
+msgid "End of data contents of table %s"
+msgstr ""
+
+#: class/wpmdb.php:2699
+msgid "WordPress MySQL database migration"
+msgstr ""
+
+#: class/wpmdb.php:2701
+#, php-format
+msgid "Generated: %s"
+msgstr ""
+
+#: class/wpmdb.php:2702
+#, php-format
+msgid "Hostname: %s"
+msgstr ""
+
+#: class/wpmdb.php:2703
+#, php-format
+msgid "Database: %s"
+msgstr ""
+
+#: class/wpmdb.php:2756
+msgid "Failed to write the gzipped SQL data to the file. (#127)"
+msgstr ""
+
+#: class/wpmdb.php:2763
+msgid "Failed to write the SQL data to the file. (#128)"
+msgstr ""
+
+#: class/wpmdb.php:2906
+#: class/wpmdb.php:2931
+#: class/wpmdbpro.php:1377
+msgid "Migrate DB Pro"
+msgstr ""
+
+#: class/wpmdb.php:2906
+#: class/wpmdb.php:2931
+#: class/wpmdb.php:3534
+msgid "Migrate DB"
+msgstr ""
+
+#: class/wpmdb.php:3108
+msgid ""
+"A problem occurred when trying to change the maximum request size, please "
+"try again."
+msgstr ""
+
+#: class/wpmdb.php:3109
+#: class/wpmdbpro.php:1030
+msgid "A problem occurred when trying to check the license, please try again."
+msgstr ""
+
+#: class/wpmdb.php:3110
+msgid "Establishing connection to remote server, please wait"
+msgstr ""
+
+#: class/wpmdb.php:3111
+msgid ""
+"A problem occurred when attempting to connect to the local server, please "
+"check the details and try again."
+msgstr ""
+
+#: class/wpmdb.php:3112
+msgid "Please enter your license key."
+msgstr ""
+
+#: class/wpmdb.php:3113
+msgid ""
+"A problem occurred when trying to register the license, please try again."
+msgstr ""
+
+#: class/wpmdb.php:3114
+msgid ""
+"Your license has been activated. You will now receive automatic updates and "
+"access to email support."
+msgstr ""
+
+#: class/wpmdb.php:3115
+msgid "Fetching license details, please wait…"
+msgstr ""
+
+#: class/wpmdb.php:3116
+msgid ""
+"An error occurred when trying to clear the debug log. Please contact "
+"support. (#132)"
+msgstr ""
+
+#: class/wpmdb.php:3117
+msgid ""
+"An error occurred when trying to update the debug log. Please contact "
+"support. (#133)"
+msgstr ""
+
+#: class/wpmdb.php:3118
+msgid "Please select at least one table to migrate."
+msgstr ""
+
+#: class/wpmdb.php:3119
+msgid "Please select at least one table for backup."
+msgstr ""
+
+#: class/wpmdb.php:3120
+msgid "Please enter a name for your migration profile."
+msgstr ""
+
+#: class/wpmdb.php:3121
+msgid ""
+"An error occurred when attempting to save the migration profile. Please see "
+"the Help tab for details on how to request support. (#118)"
+msgstr ""
+
+#: class/wpmdb.php:3122
+msgctxt "Data has been successfully exported"
+msgid "Export complete"
+msgstr ""
+
+#: class/wpmdb.php:3123
+msgid "Exporting, please wait…"
+msgstr ""
+
+#: class/wpmdb.php:3124
+msgid "please wait…"
+msgstr ""
+
+#: class/wpmdb.php:3125
+msgctxt "Finished successfully"
+msgid "complete"
+msgstr ""
+
+#: class/wpmdb.php:3126
+msgctxt "Copy of data between servers did not complete"
+msgid "Migration failed"
+msgstr ""
+
+#: class/wpmdb.php:3127
+msgctxt "Saving a copy of the data before import"
+msgid "Backing up"
+msgstr ""
+
+#: class/wpmdb.php:3128
+msgctxt "In line to be processed"
+msgid "Queued"
+msgstr ""
+
+#: class/wpmdb.php:3129
+msgctxt "Copying data between servers"
+msgid "Migrating"
+msgstr ""
+
+#: class/wpmdb.php:3130
+msgctxt "Process is active"
+msgid "Running"
+msgstr ""
+
+#: class/wpmdb.php:3131
+msgctxt "Current request status"
+msgid "Status"
+msgstr ""
+
+#: class/wpmdb.php:3132
+msgctxt "The message the server responded with"
+msgid "Response"
+msgstr ""
+
+#: class/wpmdb.php:3133
+msgid ""
+"A problem occurred when attempting to process the following table (#113)"
+msgstr ""
+
+#: class/wpmdb.php:3134
+msgid ""
+"A problem occurred when processing the following table. We were expecting a "
+"response in JSON format but instead received an empty response."
+msgstr ""
+
+#: class/wpmdb.php:3135
+msgid "Migration completed with some errors"
+msgstr ""
+
+#: class/wpmdb.php:3136
+msgid "Migration complete, your backup is located at:"
+msgstr ""
+
+#: class/wpmdb.php:3137
+msgid "A problem occurred when finalizing the backup. (#140)"
+msgstr ""
+
+#: class/wpmdb.php:3138
+msgctxt "The settings were saved successfully"
+msgid "Saved"
+msgstr ""
+
+#: class/wpmdb.php:3139
+msgid ""
+"Any sites setup to use the current secret key will no longer be able to "
+"connect. You will need to update those sites with the newly generated secret "
+"key. Do you wish to continue?"
+msgstr ""
+
+#: class/wpmdb.php:3140
+msgid ""
+"An error occurred when trying to generate the secret key. Please see the "
+"Help tab for details on how to request support. (#105)"
+msgstr ""
+
+#: class/wpmdb.php:3141
+msgid ""
+"You are about to remove the migration profile \"{{profile}}\". This cannot "
+"be undone. Do you wish to continue?"
+msgstr ""
+
+#: class/wpmdb.php:3142
+msgid ""
+"An error occurred when trying to delete the profile. Please see the Help tab "
+"for details on how to request support. (#106)"
+msgstr ""
+
+#: class/wpmdb.php:3143
+msgid ""
+"The selected migration profile could not be deleted because it was not "
+"found.\n"
+"Please refresh this page to see an accurate list of the currently available "
+"migration profiles."
+msgstr ""
+
+#: class/wpmdb.php:3144
+msgid ""
+"If you change the connection details, you will lose any replaces and table "
+"selections you have made below. Do you wish to continue?"
+msgstr ""
+
+#: class/wpmdb.php:3145
+#: template/migrate.php:118
+msgid "Please enter the connection information above to continue."
+msgstr ""
+
+#: class/wpmdb.php:3146
+msgid ""
+"An error occurred when trying to save the settings. Please try again. If the "
+"problem persists, please see the Help tab for details on how to request "
+"support. (#108)"
+msgstr ""
+
+#: class/wpmdb.php:3147
+msgid ""
+"The connection information appears to be missing, please enter it to "
+"continue."
+msgstr ""
+
+#: class/wpmdb.php:3148
+msgid ""
+"The connection information appears to be incorrect, it should consist of two "
+"lines. The first being the remote server's URL and the second being the "
+"secret key."
+msgstr ""
+
+#: class/wpmdb.php:3149
+msgid ""
+"The URL on the first line appears to be invalid, please check it and try "
+"again."
+msgstr ""
+
+#: class/wpmdb.php:3150
+msgid ""
+"The secret key on the second line appears to be invalid. It should be a 40 "
+"character string that consists of letters, numbers and special characters "
+"only."
+msgstr ""
+
+#: class/wpmdb.php:3151
+msgid ""
+"It appears you've entered the URL for this website, you need to provide the "
+"URL of the remote website instead."
+msgstr ""
+
+#: class/wpmdb.php:3152
+msgid ""
+"Looks like your remote secret key is the same as the secret key for this "
+"site. To fix this, go to the Settings tab and "
+"click \"Reset Secret Key\""
+msgstr ""
+
+#: class/wpmdb.php:3153
+msgid "Time Elapsed:"
+msgstr ""
+
+#: class/wpmdb.php:3154
+#: template/migrate-progress.php:17
+msgctxt "Temporarily stop migrating"
+msgid "Pause"
+msgstr ""
+
+#: class/wpmdb.php:3155
+msgctxt "The migration has been temporarily stopped"
+msgid "Migration Paused"
+msgstr ""
+
+#: class/wpmdb.php:3156
+msgctxt "The find & replace has been temporarily stopped"
+msgid "Find & Replace Paused"
+msgstr ""
+
+#: class/wpmdb.php:3157
+msgctxt "Restart migrating after it was paused"
+msgid "Resume"
+msgstr ""
+
+#: class/wpmdb.php:3158
+msgid "Completing current request"
+msgstr ""
+
+#: class/wpmdb.php:3159
+msgctxt "The migration is being cancelled"
+msgid "Cancelling migration"
+msgstr ""
+
+#: class/wpmdb.php:3160
+msgctxt "The find & replace is being cancelled"
+msgid "Cancelling find & replace"
+msgstr ""
+
+#: class/wpmdb.php:3161
+msgctxt "The migration has been temporarily stopped"
+msgid "Paused"
+msgstr ""
+
+#: class/wpmdb.php:3162
+msgid "Pause before finalizing the updates"
+msgstr ""
+
+#: class/wpmdb.php:3163
+msgid ""
+"Automatically paused before migrated tables are replaced. Click \"Resume\" "
+"or \"Cancel\" when ready."
+msgstr ""
+
+#: class/wpmdb.php:3164
+msgid ""
+"Automatically paused before the find & replace was finalized. Click "
+"\"Resume\" or \"Cancel\" when ready."
+msgstr ""
+
+#: class/wpmdb.php:3165
+msgid "Removing the local MySQL export file"
+msgstr ""
+
+#: class/wpmdb.php:3166
+msgid "Removing the local backup MySQL export file"
+msgstr ""
+
+#: class/wpmdb.php:3167
+msgid "Removing the local temporary tables"
+msgstr ""
+
+#: class/wpmdb.php:3168
+msgid "Removing the remote backup MySQL export file"
+msgstr ""
+
+#: class/wpmdb.php:3169
+msgid "Removing the remote temporary tables"
+msgstr ""
+
+#: class/wpmdb.php:3170
+msgid "Migration cancellation failed"
+msgstr ""
+
+#: class/wpmdb.php:3171
+msgid ""
+"A problem occurred while cancelling the migration, you may have to manually "
+"delete some temporary files / tables."
+msgstr ""
+
+#: class/wpmdb.php:3172
+msgctxt "The migration has been cancelled"
+msgid "Migration cancelled"
+msgstr ""
+
+#: class/wpmdb.php:3173
+msgid ""
+"The migration has been stopped and all temporary files and data have been "
+"cleaned up."
+msgstr ""
+
+#: class/wpmdb.php:3174
+msgctxt "The migration has been cancelled"
+msgid "Find & replace cancelled"
+msgstr ""
+
+#: class/wpmdb.php:3175
+msgid ""
+"The find & replace has been cancelled and all temporary data has been "
+"cleaned up."
+msgstr ""
+
+#: class/wpmdb.php:3176
+msgctxt "The migration completed successfully"
+msgid "Migration complete"
+msgstr ""
+
+#: class/wpmdb.php:3177
+msgctxt "The migration is in the last stages"
+msgid "Finalizing migration"
+msgstr ""
+
+#: class/wpmdb.php:3178
+msgctxt "The caches and rewrite rules for the target are being flushed"
+msgid "Flushing caches and rewrite rules"
+msgstr ""
+
+#: class/wpmdb.php:3179
+msgid "A problem occurred when trying to add plugins to backlist."
+msgstr ""
+
+#: class/wpmdb.php:3180
+msgid ""
+"If confirmed we will install an additional WordPress 'Must Use' plugin. This "
+"plugin will allow us to control which plugins are loaded during WP Migrate "
+"DB Pro specific operations. Do you wish to continue?"
+msgstr ""
+
+#: class/wpmdb.php:3181
+msgid ""
+"A problem occurred when trying to change the plugin compatibility setting."
+msgstr ""
+
+#: class/wpmdb.php:3182
+msgctxt "Confirmation required"
+msgid "Sure?"
+msgstr ""
+
+#: class/wpmdb.php:3183
+#, php-format
+msgid "Pulling from %s…"
+msgstr ""
+
+#: class/wpmdb.php:3184
+#, php-format
+msgid "Pull from %s complete"
+msgstr ""
+
+#: class/wpmdb.php:3185
+#, php-format
+msgid "Pushing to %s…"
+msgstr ""
+
+#: class/wpmdb.php:3186
+#, php-format
+msgid "Push to %s complete"
+msgstr ""
+
+#: class/wpmdb.php:3187
+msgid "Running Find & Replace…"
+msgstr ""
+
+#: class/wpmdb.php:3189
+msgid "Copying license to the remote site, please wait"
+msgstr ""
+
+#: class/wpmdb.php:3190
+msgid "Attempting to activate your license, please wait…"
+msgstr ""
+
+#: class/wpmdb.php:3191
+msgid "License successfully activated, please wait…"
+msgstr ""
+
+#: class/wpmdb.php:3192
+msgid ""
+"An error occurred when trying to reactivate your license. Please provide the "
+"following information when requesting support:"
+msgstr ""
+
+#: class/wpmdb.php:3193
+msgid ""
+"We've temporarily activated your licence and will complete the "
+"activation once the Delicious Brains API is available again. Please refresh this page to continue."
+msgstr ""
+
+#: class/wpmdb.php:3194
+msgid "JSON Decoding Failure"
+msgstr ""
+
+#: class/wpmdb.php:3195
+msgid ""
+"Our AJAX request was expecting JSON but we received something else. Often "
+"this is caused by your theme and/or plugins spitting out PHP errors. If you "
+"can edit the theme or plugins causing the errors, you should be able to fix "
+"them up, but if not, you can set WP_DEBUG to false in wp-config.php to "
+"disable errors from showing up."
+msgstr ""
+
+#: class/wpmdb.php:3196
+msgid "View error messages"
+msgstr ""
+
+#: class/wpmdb.php:3197
+#, php-format
+msgid "Waiting %s seconds before executing next step"
+msgstr ""
+
+#: class/wpmdb.php:3198
+msgid ""
+"A problem occurred when trying to change the delay between requests, please "
+"try again."
+msgstr ""
+
+#: class/wpmdb.php:3199
+msgid "A problem occurred when flushing caches and rewrite rules. (#145)"
+msgstr ""
+
+#: class/wpmdb.php:3200
+msgctxt "Transfer this database to the remote site"
+msgid "Push"
+msgstr ""
+
+#: class/wpmdb.php:3201
+msgctxt "Transfer this database to the remote site and save migration profile"
+msgid "Push & Save"
+msgstr ""
+
+#: class/wpmdb.php:3202
+msgctxt "Transfer the remote database to this site"
+msgid "Pull"
+msgstr ""
+
+#: class/wpmdb.php:3203
+msgctxt "Transfer the remote database to this site and save migration profile"
+msgid "Pull & Save"
+msgstr ""
+
+#: class/wpmdb.php:3204
+#: template/migrate.php:368
+msgctxt "Download a copy of the database"
+msgid "Export"
+msgstr ""
+
+#: class/wpmdb.php:3205
+msgctxt "Download a copy of the database and save migration profile"
+msgid "Export & Save"
+msgstr ""
+
+#: class/wpmdb.php:3206
+msgctxt "Run a find and replace on the database"
+msgid "Find & Replace"
+msgstr ""
+
+#: class/wpmdb.php:3207
+msgctxt "Run a find and replace and save migration profile"
+msgid "Find & Replace & Save"
+msgstr ""
+
+#: class/wpmdb.php:3208
+msgctxt "database tables"
+msgid "Tables"
+msgstr ""
+
+#: class/wpmdb.php:3209
+msgid "Files"
+msgstr ""
+
+#: class/wpmdb.php:3210
+msgctxt "Transferred"
+msgid "Migrated"
+msgstr ""
+
+#: class/wpmdb.php:3211
+msgid "Backed Up"
+msgstr ""
+
+#: class/wpmdb.php:3212
+msgid "Searched"
+msgstr ""
+
+#: class/wpmdb.php:3213
+msgctxt "Obscure from view"
+msgid "Hide"
+msgstr ""
+
+#: class/wpmdb.php:3214
+msgctxt "Reveal"
+msgid "Show"
+msgstr ""
+
+#: class/wpmdb.php:3215
+msgid "Welcome to WP Migrate DB Pro! 🎉"
+msgstr ""
+
+#: class/wpmdb.php:3216
+#, php-format
+msgid ""
+"Hey, this is the first time activating your license, nice! Your migrations "
+"are about to get awesome! If you haven’t already, you should check out our "
+"Quick Start Guide and Videos . If "
+"you run into any trouble at all, use the Help tab above to "
+"submit a support request."
+msgstr ""
+
+#: class/wpmdb.php:3217
+#, php-format
+msgid "%1$s Stage %2$s of %3$s"
+msgstr ""
+
+#: class/wpmdb.php:3218
+msgid "Paused"
+msgstr ""
+
+#: class/wpmdb.php:3219
+msgid "Cancelling"
+msgstr ""
+
+#: class/wpmdb.php:3220
+msgid "Cancelled"
+msgstr ""
+
+#: class/wpmdb.php:3221
+msgid "Finalizing"
+msgstr ""
+
+#: class/wpmdb.php:3222
+msgid "Complete"
+msgstr ""
+
+#: class/wpmdb.php:3223
+msgid "Failed"
+msgstr ""
+
+#: class/wpmdb.php:3224
+#, php-format
+msgid "%1$s items are not shown to maintain browser performance"
+msgstr ""
+
+#: class/wpmdb.php:3225
+msgctxt "Error log emptied"
+msgid "Cleared"
+msgstr ""
+
+#: class/wpmdb.php:3261
+msgid "Could not find the file to download:"
+msgstr ""
+
+#: class/wpmdb.php:3468
+msgid "MySQL export file not found."
+msgstr ""
+
+#: class/wpmdb.php:3474
+msgid "Could not delete the MySQL export file."
+msgstr ""
+
+#: class/wpmdb.php:3540
+msgid ""
+"WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
+"automatically deactivated WP Migrate DB."
+msgstr ""
+
+#: class/wpmdb.php:3542
+msgid ""
+"WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
+"automatically deactivated WP Migrate DB Pro."
+msgstr ""
+
+#: class/wpmdb.php:3627
+#, php-format
+msgid ""
+"The source site supports utf8mb4 data but the target does not, aborting "
+"migration to avoid possible data corruption. Please see %1$s for more "
+"information. (#148)"
+msgstr ""
+
+#: class/wpmdb.php:3678
+msgid "Warning: Mixed Case Table Names"
+msgstr ""
+
+#: class/wpmdb.php:3681
+msgid ""
+"Whoa! We've detected that your local site has the MySQL setting "
+"lower_case_table_names set to 1."
+msgstr ""
+
+#: class/wpmdb.php:3683
+msgid ""
+"Whoa! We've detected that your remote site has the MySQL setting "
+"lower_case_table_names set to 1."
+msgstr ""
+
+#: class/wpmdb.php:3686
+msgid ""
+"As a result, uppercase characters in table names will be converted to "
+"lowercase during the migration."
+msgstr ""
+
+#: class/wpmdb.php:3688
+#, php-format
+msgid ""
+"You can read more about this in our documentation , "
+"proceed with caution."
+msgstr ""
+
+#: class/wpmdbpro-addon.php:61
+#, php-format
+msgid ""
+"The version of %1$s you have installed, requires version %2$s of WP Migrate "
+"DB Pro. You currently have %3$s installed. Update "
+"Now "
+msgstr ""
+
+#: class/wpmdbpro.php:174
+msgid "UI Walkthrough"
+msgstr ""
+
+#: class/wpmdbpro.php:175
+msgid ""
+"A brief walkthrough of the WP Migrate DB plugin showing all of the different "
+"options and explaining them."
+msgstr ""
+
+#: class/wpmdbpro.php:178
+msgid "Pulling Live Data Into Your Local Development Environment"
+msgstr ""
+
+#: class/wpmdbpro.php:179
+msgid ""
+"This screencast demonstrates how you can pull data from a remote, live "
+"WordPress install and update the data in your local development environment."
+msgstr ""
+
+#: class/wpmdbpro.php:182
+msgid "Pushing Local Development Data to a Staging Environment"
+msgstr ""
+
+#: class/wpmdbpro.php:183
+msgid ""
+"This screencast demonstrates how you can push a local WordPress database "
+"you've been using for development to a staging environment."
+msgstr ""
+
+#: class/wpmdbpro.php:186
+msgid "WP Migrate DB Pro Media Files Addon 1.3 and CLI Addon 1.1"
+msgstr ""
+
+#: class/wpmdbpro.php:187
+msgid ""
+"A demonstration of what's new in WP Migrate DB Pro Media Files Addon 1.3 and "
+"CLI Addon 1.1."
+msgstr ""
+
+#: class/wpmdbpro.php:294
+msgid ""
+"Please activate your license before attempting a pull or push migration."
+msgstr ""
+
+#: class/wpmdbpro.php:594
+msgid ""
+"The connection succeeded but the remote site is configured to reject pull "
+"connections. You can change this in the \"settings\" tab on the remote site. "
+"(#141)"
+msgstr ""
+
+#: class/wpmdbpro.php:656
+msgid ""
+"The connection succeeded but the remote site is configured to reject pull "
+"connections. You can change this in the \"settings\" tab on the remote site. "
+"(#110)"
+msgstr ""
+
+#: class/wpmdbpro.php:658
+msgid ""
+"The connection succeeded but the remote site is configured to reject push "
+"connections. You can change this in the \"settings\" tab on the remote site. "
+"(#110)"
+msgstr ""
+
+#: class/wpmdbpro.php:739
+#, php-format
+msgid ""
+"Version Mismatch — We've detected you have version %1$s of WP "
+"Migrate DB Pro at %2$s but are using an outdated version here. Please go to "
+"the Plugins page on both installs and check for updates."
+msgstr ""
+
+#: class/wpmdbpro.php:741
+#, php-format
+msgid ""
+"Version Mismatch — We've detected you have version %1$s of WP "
+"Migrate DB Pro at %2$s but are using %3$s here. Please go to the Plugins page on both installs and check for updates."
+msgstr ""
+
+#: class/wpmdbpro.php:755
+msgctxt "Asking to try and connect to remote server after verification error"
+msgid "Try again?"
+msgstr ""
+
+#: class/wpmdbpro.php:768
+#, php-format
+msgid ""
+"Activate remote license — Looks like you don't have a WP Migrate DB "
+"Pro license active at %s."
+msgstr ""
+
+#: class/wpmdbpro.php:770
+#, php-format
+msgid "Copy %1$s license key to %2$s and activate it"
+msgstr ""
+
+#: class/wpmdbpro.php:781
+msgid ""
+"The connection succeeded but the remote site is configured to reject pull "
+"connections. You can change this in the \"settings\" tab on the remote site. "
+"(#122)"
+msgstr ""
+
+#: class/wpmdbpro.php:783
+msgid ""
+"The connection succeeded but the remote site is configured to reject push "
+"connections. You can change this in the \"settings\" tab on the remote site. "
+"(#122)"
+msgstr ""
+
+#: class/wpmdbpro.php:785
+msgctxt "Attempt to connect to the remote server again"
+msgid "Try again?"
+msgstr ""
+
+#: class/wpmdbpro.php:933
+msgctxt "Delete license"
+msgid "Remove"
+msgstr ""
+
+#: class/wpmdbpro.php:1117
+msgid ""
+"If you have an active license , you may send an email to the "
+"following address."
+msgstr ""
+
+#: class/wpmdbpro.php:1119
+msgid ""
+"Please copy the Diagnostic Info & Error Log info below into a text file "
+"and attach it to your email. Do the same for any other site involved in your "
+"email."
+msgstr ""
+
+#: class/wpmdbpro.php:1150
+msgctxt "License does not allow use of addons"
+msgid "Addons Unavailable"
+msgstr ""
+
+#: class/wpmdbpro.php:1150
+#, php-format
+msgid ""
+"Addons are not included with the Personal license. Visit My Account to upgrade in just a few clicks."
+msgstr ""
+
+#: class/wpmdbpro.php:1165
+msgctxt "Installed on website but not activated"
+msgid "Installed"
+msgstr ""
+
+#: class/wpmdbpro.php:1167
+msgctxt "Installed and activated on website"
+msgid "Activated"
+msgstr ""
+
+#: class/wpmdbpro.php:1170
+msgctxt "Enable addon so it may be used"
+msgid "Activate"
+msgstr ""
+
+#: class/wpmdbpro.php:1174
+msgctxt "Download and activate addon"
+msgid "Install"
+msgstr ""
+
+#: class/wpmdbpro.php:1180
+#: template/common/debug-info.php:4
+msgctxt "Download to your computer"
+msgid "Download"
+msgstr ""
+
+#: class/wpmdbpro.php:1306
+msgid "Could not upload the SQL to the server. (#135)"
+msgstr ""
+
+#: class/wpmdbpro.php:1312
+msgid "Could not read the SQL file we uploaded to the server. (#136)"
+msgstr ""
+
+#: class/wpmdbpro.php:1331
+msgid ""
+"The connection succeeded but the remote site is configured to reject push "
+"connections. You can change this in the \"settings\" tab on the remote site. "
+"(#139)"
+msgstr ""
+
+#: class/wpmdbpro.php:1563
+#, php-format
+msgid "There is a new version of %s available."
+msgstr ""
+
+#: class/wpmdbpro.php:1565
+#, php-format
+msgid "View version %s details"
+msgstr ""
+
+#: class/wpmdbpro.php:1575
+#, php-format
+msgid ""
+"To update, go to %1$s and enter your license key. If you don't have a "
+"license key, you may purchase one ."
+msgstr ""
+
+#: class/wpmdbpro.php:1577
+#, php-format
+msgid ""
+"To finish activating %1$s, please go to %2$s and enter your license key. If "
+"you don't have a license key, you may purchase one ."
+msgstr ""
+
+#: class/wpmdbpro.php:1653
+msgid "Could not retrieve version details. Please try again."
+msgstr ""
+
+#: template/addons.php:7
+msgid "Fetching addon details, please wait..."
+msgstr ""
+
+#: template/addons.php:12
+msgctxt "License must be activated to use addons"
+msgid "Activate Your License"
+msgstr ""
+
+#: template/addons.php:12
+msgid ""
+"Please switch to the Settings tab and activate your license. If your license "
+"includes the addons below, you will be able to install them from here with "
+"one-click."
+msgstr ""
+
+#: template/addons.php:16
+msgctxt "Addons are available with a developer license and better"
+msgid "Get Addons"
+msgstr ""
+
+#: template/addons.php:16
+#, php-format
+msgid ""
+"The following addons are available with the WP Migrate DB Pro Developer "
+"license and better. Visit deliciousbrains."
+"com to purchase in just a few clicks."
+msgstr ""
+
+#: template/addons.php:22
+msgid "Media Files"
+msgstr ""
+
+#: template/addons.php:23
+#, php-format
+msgid ""
+"Allows you to push and pull your files in the Media Library between two "
+"WordPress installs. It can compare both libraries and only migrate those "
+"missing or updated, or it can do a complete copy of one site's library to "
+"another. More Details → "
+msgstr ""
+
+#: template/addons.php:29
+msgid "CLI"
+msgstr ""
+
+#: template/addons.php:30
+#, php-format
+msgid ""
+"Integrates WP Migrate DB Pro with WP-CLI allowing you to run migrations from "
+"the command line: %s More Details → "
+msgstr ""
+
+#: template/addons.php:36
+msgid "Multisite Tools"
+msgstr ""
+
+#: template/addons.php:37
+#, php-format
+msgid ""
+"Export a subsite as an SQL file that can then be imported as a single site "
+"install. More Details → "
+msgstr ""
+
+#: template/common/breadcrumbs.php:3
+msgctxt "Default profile loaded"
+msgid "New Profile"
+msgstr ""
+
+#: template/common/breadcrumbs.php:9
+msgid "Saved Profiles"
+msgstr ""
+
+#: template/common/compatibility.php:2
+msgid "Compatibility"
+msgstr ""
+
+#: template/common/compatibility.php:9
+msgid "Plugin Compatibility Mode"
+msgstr ""
+
+#: template/common/compatibility.php:11
+msgid ""
+"Some plugins add a lot of overhead to each request, requiring extra memory "
+"and CPU. And some plugins even interfere with migrations and cause them to "
+"fail. We recommend only loading plugins that affect migration requests, for "
+"example a plugin that hooks into WP Migrate DB."
+msgstr ""
+
+#: template/common/compatibility.php:15
+msgid ""
+"Avoid plugin conflicts and improve performance by not loading plugins for "
+"migration requests."
+msgstr ""
+
+#: template/common/compatibility.php:35
+#: template/pro/backup.php:45
+#: template/pro/exclude-post-types.php:33
+#: template/pro/select-tables.php:43
+msgid "Select All"
+msgstr ""
+
+#: template/common/compatibility.php:37
+#: template/pro/backup.php:47
+#: template/pro/exclude-post-types.php:35
+#: template/pro/select-tables.php:45
+msgid "Deselect All"
+msgstr ""
+
+#: template/common/compatibility.php:39
+#: template/pro/backup.php:49
+#: template/pro/exclude-post-types.php:37
+#: template/pro/select-tables.php:47
+msgid "Invert Selection"
+msgstr ""
+
+#: template/common/compatibility.php:42
+msgid "Save Changes"
+msgstr ""
+
+#: template/common/debug-info.php:2
+msgid "Diagnostic Info & Error Log"
+msgstr ""
+
+#: template/common/debug-info.php:5
+msgid "Clear Error Log"
+msgstr ""
+
+#: template/common/max-request-size.php:6
+#: template/pro/request-settings.php:24
+msgid "Maximum Request Size"
+msgstr ""
+
+#: template/common/max-request-size.php:10
+#: template/pro/request-settings.php:28
+#, php-format
+msgid ""
+"We've detected that your server supports requests up to %s, but it's "
+"possible that your server has limitations that we could not detect. To be on "
+"the safe side, we set the default to 1 MB, but you can try throttling it up "
+"to get better performance. If you're getting a 413 error or having trouble "
+"with time outs, try throttling this setting down."
+msgstr ""
+
+#: template/migrate-progress.php:6
+msgid "Please wait while migration is running…"
+msgstr ""
+
+#: template/migrate-progress.php:7
+msgid "Establishing Connection"
+msgstr ""
+
+#: template/migrate-progress.php:18
+msgctxt "Stop the migration"
+msgid "Cancel"
+msgstr ""
+
+#: template/migrate-progress.php:22
+msgid "Pause before replacing migrated tables"
+msgstr ""
+
+#: template/migrate.php:71
+msgid "Export File"
+msgstr ""
+
+#: template/migrate.php:77
+msgid "Save as file to your computer"
+msgstr ""
+
+#: template/migrate.php:84
+msgid "Compress file with gzip"
+msgstr ""
+
+#: template/migrate.php:94
+msgid "Find & Replace"
+msgstr ""
+
+#: template/migrate.php:94
+msgid "Run a find & replace on this site's db"
+msgstr ""
+
+#: template/migrate.php:100
+msgid "Connection Info - Site URL & Secret Key"
+msgstr ""
+
+#: template/migrate.php:111
+msgid "SSL Disabled"
+msgstr ""
+
+#: template/migrate.php:111
+msgid ""
+"We couldn't connect over SSL but regular http (no SSL) appears to be working "
+"so we've switched to that. If you run a push or pull, your data will be "
+"transmitted unencrypted. Most people are fine with this, but just a heads up."
+msgstr ""
+
+#: template/migrate.php:121
+msgid "Cannot Access Uploads Directory"
+msgstr ""
+
+#: template/migrate.php:123
+msgid ""
+"We require write permissions to the standard WordPress uploads directory. "
+"Without this permission exports are unavailable. Please grant 755 "
+"permissions on the following directory:"
+msgstr ""
+
+#: template/migrate.php:134
+msgctxt "Source text to be replaced"
+msgid "Find"
+msgstr ""
+
+#: template/migrate.php:135
+msgctxt "Text to replace in source"
+msgid "Replace"
+msgstr ""
+
+#: template/migrate.php:177
+#, php-format
+msgid ""
+"This find & replace will find the domain name of your remote site and "
+"replace it with the domain name of this site. We've left out the protocol so "
+"that both http:// and https:// will be found and replaced. Find & Replace Documentation "
+msgstr ""
+
+#: template/migrate.php:198
+#, php-format
+msgid ""
+"This find and replace is mostly for 3rd party plugins that store the "
+"website’s root file path in the database. This set of fields will ensure "
+"that these values are updated to the correct root file path during the "
+"migration. Find & Replace Documentation "
+msgstr ""
+
+#: template/migrate.php:238
+#, php-format
+msgid ""
+"New URL Missing — Please enter the protocol-relative "
+"URL of the remote website in the \"New URL\" field or remove the whole row "
+"entirely. If you are unsure of what this URL should be, please consult our documentation on find and replace "
+"fields."
+msgstr ""
+
+#: template/migrate.php:240
+#, php-format
+msgid ""
+"New URL Missing — Please enter the protocol-relative "
+"URL of the remote website in the \"New URL\" field. If you are unsure of "
+"what this URL should be, please consult our "
+"documentation on find and replace fields."
+msgstr ""
+
+#: template/migrate.php:244
+#, php-format
+msgid ""
+"New File Path Missing — Please enter the root file "
+"path of the remote website in the \"New file path\" field or remove the "
+"whole row entirely. If you are unsure of what the file path should be, "
+"please consult our documentation on "
+"find and replace fields."
+msgstr ""
+
+#: template/migrate.php:253
+msgid "Advanced Options"
+msgstr ""
+
+#: template/migrate.php:262
+msgid "Replace GUIDs"
+msgstr ""
+
+#: template/migrate.php:268
+#, php-format
+msgid ""
+"Although the WordPress Codex emphasizes "
+"that GUIDs should not be changed, this is limited to sites that are already "
+"live. If the site has never been live, we recommend replacing the GUIDs. For "
+"example, you may be developing a new site locally at dev.somedomain.com and "
+"want to migrate the site live to somedomain.com."
+msgstr ""
+
+#: template/migrate.php:274
+msgid "Exclude spam comments"
+msgstr ""
+
+#: template/migrate.php:280
+msgid ""
+"Do not migrate the 'active_plugins' setting (i.e. which plugins are "
+"activated/deactivated)"
+msgstr ""
+
+#: template/migrate.php:292
+msgid "Compatible with older versions of MySQL (pre-5.5)"
+msgstr ""
+
+#: template/migrate.php:308
+msgid "Save Migration Profile"
+msgstr ""
+
+#: template/migrate.php:308
+msgid "Save the above settings for the next time you do a similiar migration"
+msgstr ""
+
+#: template/migrate.php:330
+msgid "Create new profile"
+msgstr ""
+
+#: template/migrate.php:339
+#: template/migrate.php:349
+msgid "Warning: Different Table Prefixes"
+msgstr ""
+
+#: template/migrate.php:341
+msgid ""
+"Whoa! We've detected that the database table prefix differs between "
+"installations. Clicking the Migrate button below will create new database "
+"tables in your local database with prefix \""
+"span>\"."
+msgstr ""
+
+#: template/migrate.php:343
+#, php-format
+msgid ""
+"However, your local install is configured to use table prefix \"%1$s\" and "
+"will ignore the migrated tables. So, AFTER migration is complete, you "
+"will need to edit your local install's wp-config.php and change the \"%1$s\" "
+"variable to \" \"."
+msgstr ""
+
+#: template/migrate.php:345
+msgid ""
+"This will allow your local install the use the migrated tables. Once you do "
+"this, you shouldn't have to do it again."
+msgstr ""
+
+#: template/migrate.php:351
+#, php-format
+msgid ""
+"Whoa! We've detected that the database table prefix differs between "
+"installations. Clicking the Migrate button below will create new database "
+"tables in the remote database with prefix \"%s\"."
+msgstr ""
+
+#: template/migrate.php:353
+#, php-format
+msgid ""
+"However, your remote install is configured to use table prefix \" \" and will ignore the migrated tables. So, "
+"AFTER migration is complete, you will need to edit your remote "
+"install's wp-config.php and change the \""
+"span>\" variable to \"%s\"."
+msgstr ""
+
+#: template/migrate.php:355
+msgid ""
+"This will allow your remote install the use the migrated tables. Once you do "
+"this, you shouldn't have to do it again."
+msgstr ""
+
+#: template/migrate.php:369
+msgctxt "Save current migration settings"
+msgid "Save Profile"
+msgstr ""
+
+#: template/options-tools-subsite.php:8
+#, php-format
+msgid ""
+"%1$s only runs at the Network Admin level. As there is no Tools menu in the "
+"Network Admin, the %2$s menu item is located under Settings."
+msgstr ""
+
+#: template/options.php:22
+msgid ""
+"PHP Safe Mode Enabled — We do not officially support "
+"running this plugin in safe mode because set_time_limit() has "
+"no effect. Therefore we can't extend the run time of the script and ensure "
+"it doesn't time out before the migration completes. We haven't disabled the "
+"plugin however, so you're free to cross your fingers and hope for the best. "
+"However, if you have trouble, we can't help you until you turn off safe mode."
+msgstr ""
+
+#: template/options.php:24
+#: template/options.php:43
+#, php-format
+msgid "Your current PHP run time limit is set to %s seconds."
+msgstr ""
+
+#: template/options.php:32
+#, php-format
+msgid ""
+"Internet Explorer Not Supported — Less than 2% of our "
+"customers use IE, so we've decided not to spend time supporting it. We ask "
+"that you use Firefox or a Webkit-based browser like Chrome or Safari "
+"instead. If this is a problem for you, please let us know."
+msgstr ""
+
+#: template/options.php:41
+msgid ""
+"PHP Function Disabled — The set_time_limit()"
+"code> function is currently disabled on your server. We use this function to "
+"ensure that the migration doesn't time out. We haven't disabled the plugin "
+"however, so you're free to cross your fingers and hope for the best. You may "
+"want to contact your web host to enable this function."
+msgstr ""
+
+#: template/pro/backup.php:4
+msgid "Backup the local database before replacing it"
+msgstr ""
+
+#: template/pro/backup.php:5
+msgid "Backup the remote database before replacing it"
+msgstr ""
+
+#: template/pro/backup.php:6
+msgid "Backup the database before running the find & replace"
+msgstr ""
+
+#: template/pro/backup.php:8
+msgid "An SQL file will be saved to"
+msgstr ""
+
+#: template/pro/backup.php:16
+msgid "Backup all tables with prefix"
+msgstr ""
+
+#: template/pro/backup.php:22
+msgid "Backup only tables selected for migration"
+msgstr ""
+
+#: template/pro/backup.php:28
+msgid "Backup only selected tables below"
+msgstr ""
+
+#: template/pro/backup.php:52
+#, php-format
+msgid ""
+"The backup option has been disabled as your local uploads directory is "
+"currently not writeable. The following directory should have 755 "
+"permissions: %s "
+msgstr ""
+
+#: template/pro/block-external-warning.php:4
+#, php-format
+msgid ""
+"We've detected that WP_HTTP_BLOCK_EXTERNAL is enabled which "
+"will prevent WP Migrate DB Pro from functioning properly. You should either "
+"disable WP_HTTP_BLOCK_EXTERNAL or add any sites that you'd like "
+"to migrate to or from with WP Migrate DB Pro to WP_ACCESSIBLE_HOSTS"
+"code> (api.deliciousbrains.com must be added to WP_ACCESSIBLE_HOSTS"
+"code> for the API to work). More information on this can be found here ."
+msgstr ""
+
+#. translators: 1: Remind Me Later, 2: Dismiss
+#: template/pro/block-external-warning.php:10
+#, php-format
+msgctxt "Block External actions"
+msgid "%1$s | %2$s"
+msgstr ""
+
+#: template/pro/connection-info.php:2
+msgid "Connection Info"
+msgstr ""
+
+#: template/pro/connection-info.php:10
+msgid "Copy to Clipboard"
+msgstr ""
+
+#: template/pro/connection-info.php:11
+msgid "Copied"
+msgstr ""
+
+#: template/pro/connection-info.php:13
+msgid "Reset Secret Key"
+msgstr ""
+
+#: template/pro/exclude-post-types.php:4
+msgid "Exclude Post Types"
+msgstr ""
+
+#: template/pro/exclude-post-types.php:11
+msgid ""
+"WARNING: All of the following post types will be absent in the destination "
+"posts table after migration:"
+msgstr ""
+
+#: template/pro/exclude-post-types.php:12
+msgid ""
+"WARNING: The following post types will not be included in the find & "
+"replace:"
+msgstr ""
+
+#: template/pro/licence-info.php:2
+msgid "Email Support"
+msgstr ""
+
+#: template/pro/licence-info.php:6
+msgid "Fetching license details, please wait..."
+msgstr ""
+
+#: template/pro/licence-info.php:8
+msgid ""
+"We couldn't find your license information. Please switch to the settings tab "
+"and enter your license."
+msgstr ""
+
+#: template/pro/licence-info.php:9
+msgid "Once completed, you may visit this tab to view your support details."
+msgstr ""
+
+#: template/pro/licence.php:2
+msgid "Your License"
+msgstr ""
+
+#: template/pro/licence.php:8
+msgid "The license key is currently defined in wp-config.php."
+msgstr ""
+
+#: template/pro/licence.php:18
+msgid "Activate License"
+msgstr ""
+
+#: template/pro/outdated-addons-warning.php:16
+#, php-format
+msgid ""
+"The version of the %1$s addon you have installed%2$s is out-of-date and will "
+"not work with this version WP Migrate DB Pro. Update Now "
+msgstr ""
+
+#: template/pro/pull-push-radio-buttons.php:4
+msgctxt "Import data from remote database"
+msgid "Pull"
+msgstr ""
+
+#: template/pro/pull-push-radio-buttons.php:4
+msgid "Replace this site's db with remote db"
+msgstr ""
+
+#: template/pro/pull-push-radio-buttons.php:13
+msgctxt "Export data to remote database"
+msgid "Push"
+msgstr ""
+
+#: template/pro/pull-push-radio-buttons.php:13
+msgid "Replace remote db with this site's db"
+msgstr ""
+
+#: template/pro/request-settings.php:2
+msgid "Request Settings"
+msgstr ""
+
+#: template/pro/request-settings.php:10
+msgid "Certificate Verification"
+msgstr ""
+
+#: template/pro/request-settings.php:12
+msgid ""
+"We disable SSL verification by default because a lot of people's "
+"environments are not setup for it to work. For example, with XAMPP, you have "
+"to manually enable OpenSSL by editing the php.ini. Without SSL verification, "
+"an HTTPS connection is vulnerable to a man-in-the-middle attack, so we do "
+"recommend you configure your environment and enable this."
+msgstr ""
+
+#: template/pro/request-settings.php:16
+msgid "Verify the authenticity of the remote server’s TLS certificate. "
+msgstr ""
+
+#: template/pro/request-settings.php:42
+msgid "Delay Between Requests"
+msgstr ""
+
+#: template/pro/request-settings.php:46
+msgid ""
+"Some servers have rate limits which the plugin can hit when performing "
+"migrations. If you're experiencing migration failures due to server rate "
+"limits, you should set this to one or more seconds to alleviate the problem."
+msgstr ""
+
+#: template/pro/secret-key-warning.php:2
+msgid "Improve Security"
+msgstr ""
+
+#: template/pro/secret-key-warning.php:3
+#, php-format
+msgid ""
+"We have implemented a more secure method of secret key generation since your "
+"key was generated. We recommend you visit the Settings tab"
+"a> and reset your secret key."
+msgstr ""
+
+#. translators: 1: Remind Me Later, 2: Dismiss
+#: template/pro/secret-key-warning.php:7
+#, php-format
+msgctxt "Improve Security actions"
+msgid "%1$s | %2$s"
+msgstr ""
+
+#: template/pro/select-tables.php:4
+msgctxt "Database tables"
+msgid "Tables"
+msgstr ""
+
+#: template/pro/select-tables.php:13
+msgid "Migrate all tables with prefix"
+msgstr ""
+
+#: template/pro/select-tables.php:19
+msgid "Migrate only selected tables below"
+msgstr ""
+
+#: template/pro/toggle-remote-requests.php:2
+msgid "Permissions"
+msgstr ""
+
+#: template/pro/toggle-remote-requests.php:8
+msgid "Pull"
+msgstr ""
+
+#: template/pro/toggle-remote-requests.php:9
+msgid "Process requests to pull data from this install, copying it elsewhere."
+msgstr ""
+
+#: template/pro/toggle-remote-requests.php:16
+msgid "Push"
+msgstr ""
+
+#: template/pro/toggle-remote-requests.php:17
+msgid "Process requests to push data to this install, overwriting its data."
+msgstr ""
+
+#: template/pro/videos.php:2
+msgctxt "Tutorial videos"
+msgid "Videos"
+msgstr ""
+
+#: template/profile.php:2
+msgid "Would you like to use a saved migration profile?"
+msgstr ""
+
+#: template/profile.php:14
+msgid "Nope, let's start fresh..."
+msgstr ""
+
+#: template/wpmdb/exclude-post-revisions.php:4
+msgid "Exclude post revisions"
+msgstr ""
+
+#: template/wpmdb/progress-upgrade.php:3
+msgid "Seen the PRO version yet?"
+msgstr ""
+
+#: template/wpmdb/progress-upgrade.php:5
+msgid ""
+"One-click in your WordPress dashboard to push your database up to staging/"
+"production or pull it down to dev"
+msgstr ""
+
+#: template/wpmdb/progress-upgrade.php:6
+msgid "Sync the Media Libraries of two sites"
+msgstr ""
+
+#: template/wpmdb/progress-upgrade.php:7
+msgid "Run migrations from the command line"
+msgstr ""
+
+#: template/wpmdb/progress-upgrade.php:15
+msgid ""
+"Even though I've been using it for a long time the push/pull functionality "
+"in @dliciousbrains WP Migrate DB Pro continues to impress me."
+msgstr ""
+
+#: template/wpmdb/progress-upgrade.php:24
+msgid "More About The Pro Version"
+msgstr ""
+
+#: template/wpmdb/sidebar.php:3
+msgid ""
+"WP Migrate DB Pro — Push and pull your database from one WordPress "
+"install to another in 1-click."
+msgstr ""
+
+#: template/wpmdb/sidebar.php:6
+msgid "Get 20% Off!"
+msgstr ""
+
+#: template/wpmdb/sidebar.php:11
+#, php-format
+msgid ""
+"Submit your name and email and we'll send you a coupon for 20% off your "
+"upgrade to the pro version."
+msgstr ""
+
+#: template/wpmdb/sidebar.php:15
+msgid "Your Email"
+msgstr ""
+
+#: template/wpmdb/sidebar.php:19
+msgid "First Name"
+msgstr ""
+
+#: template/wpmdb/sidebar.php:23
+msgid "Last Name"
+msgstr ""
+
+#: template/wpmdb/sidebar.php:30
+msgid "Send me the coupon"
+msgstr ""
+
+#: template/wpmdb/sidebar.php:34
+msgid ""
+"We promise we will not use your email for anything else and you can "
+"unsubscribe with 1-click anytime."
+msgstr ""
+
+#: template/wpmdb/wordpress-org-support.php:2
+msgctxt "Get help from the community"
+msgid "Support"
+msgstr ""
+
+#: template/wpmdb/wordpress-org-support.php:4
+msgid "As this is a free plugin, we do not provide support."
+msgstr ""
+
+#: template/wpmdb/wordpress-org-support.php:6
+#, php-format
+msgid ""
+"You may ask the WordPress community for help by posting to the WordPress.org support forum . Response time can range from a few days "
+"to a few weeks and will likely be from a non-developer."
+msgstr ""
+
+#: template/wpmdb/wordpress-org-support.php:8
+#, php-format
+msgid ""
+"If you want a timely response via email from a developer "
+"who works on this plugin, upgrade to WP Migrate DB Pro "
+"and send us an email."
+msgstr ""
+
+#: template/wpmdb/wordpress-org-support.php:10
+#, php-format
+msgid ""
+"If you've found a bug, please submit an issue at Github ."
+msgstr ""
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/languages/wp-migrate-db-pt_BR.mo b/wordpress/wp-content/plugins/wp-migrate-db-pro/languages/wp-migrate-db-pt_BR.mo
new file mode 100644
index 0000000..e421b2d
Binary files /dev/null and b/wordpress/wp-content/plugins/wp-migrate-db-pro/languages/wp-migrate-db-pt_BR.mo differ
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/addons.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/addons.php
new file mode 100644
index 0000000..ee5408a
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/addons.php
@@ -0,0 +1,43 @@
+get_licence_key();
+?>
+
+
+ is_pro ) : ?>
+
+
+
+ is_pro ) : ?>
+
+ –
+
+
+
+ – deliciousbrains.com to purchase in just a few clicks.', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/?utm_source=insideplugin&utm_medium=web&utm_content=addons-tab&utm_campaign=freeplugin' ); ?>
+
+
+
+
+
+
+
More Details →', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/media-files-addon/' ); ?>
+
+
+
+
+
+
+
More Details →', 'wp-migrate-db' ), 'wp migratedb <push|pull> <url> <secret-key> [--find=<strings>] [--replace=<strings>] ...', 'https://deliciousbrains.com/wp-migrate-db-pro/doc/cli-addon/' ); ?>
+
+
+
+
+
+
+
More Details →', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/multisite-tools-addon/' ); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/breadcrumbs.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/breadcrumbs.php
new file mode 100644
index 0000000..34117f1
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/breadcrumbs.php
@@ -0,0 +1,17 @@
+settings['profiles'] ) > 0 ) :
+ $profile_name = $is_default_profile ? _x( 'New Profile', 'Default profile loaded', 'wp-migrate-db' ) : $loaded_profile['name'];
+ ?>
+
+
+
+ settings[$key];
+$class = ( isset( $class ) ) ? 'class="' . $class . '"' : '';
+$disabled = ( isset( $disabled ) && $disabled ) ? ' disabled' : '';
+?>
+
+ ON
+ OFF
+
+ />
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/compatibility.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/compatibility.php
new file mode 100644
index 0000000..ca7bb43
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/compatibility.php
@@ -0,0 +1,46 @@
+
+
+
+
+
+ template( 'checkbox', 'common', array( 'key' => 'plugin-compatibility', 'value' => $plugin_compatibility_checked ) ); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ settings['blacklist_plugins'] );
+ foreach ( get_plugins() as $key => $plugin ) {
+ if ( 0 === strpos( $key, 'wp-migrate-db' ) ) {
+ continue;
+ }
+ $selected = ( isset( $blacklist[ $key ] ) ) ? ' selected' : '';
+ printf( '%s ', $key, $selected, $plugin['Name'] );
+ }
+ ?>
+
+
+
+
/
+
+
/
+
+
+
+
+
+
+
+
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/debug-info.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/debug-info.php
new file mode 100644
index 0000000..185f3b2
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/debug-info.php
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/max-request-size.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/max-request-size.php
new file mode 100644
index 0000000..eb7813b
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/common/max-request-size.php
@@ -0,0 +1,17 @@
+is_pro ) return; ?>
+
+
+
+
+
+
+
+
+ get_bottleneck( 'max' ) ) ); ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/help.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/help.php
new file mode 100644
index 0000000..f2ea64e
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/help.php
@@ -0,0 +1,3 @@
+
+ template_part( array( 'wordpress_org_support', 'licence_info', 'debug_info', 'videos' ) ); ?>
+
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/migrate-progress.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/migrate-progress.php
new file mode 100644
index 0000000..9857632
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/migrate-progress.php
@@ -0,0 +1,26 @@
+
+
×
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/migrate.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/migrate.php
new file mode 100644
index 0000000..73c1187
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/migrate.php
@@ -0,0 +1,379 @@
+get_profile( $_GET['wpmdb-profile'] );
+} else {
+ $loaded_profile = $this->default_profile;
+}
+
+$is_default_profile = isset( $loaded_profile['default_profile'] );
+
+$convert_exclude_revisions = false;
+$convert_post_type_selection = false;
+if ( ! $is_default_profile ) {
+ if ( isset( $loaded_profile['exclude_revisions'] ) ) {
+ $convert_exclude_revisions = true;
+ }
+ /* We used to provide users the option of selecting which post types they'd like to migrate.
+ * We found that our wording for this functionality was a little confusing so we switched it to instead read "Exclude Post Types"
+ * Once we made the switch we needed a way of inverting their saved post type selection to instead exclude the select post types.
+ * This was required to make their select compatible with the new "exclude" wording.
+ * This is easy enough for "push" and "export" saved profile as we know which post types exist on the local system and
+ * can easily invert the selection. Pull saved profiles is a little trickier.
+ * $this->maybe_update_profile() is used to update deprecated profile options to their new values.
+ * At the time of page request $this->maybe_update_profile() cannot be used to update a pull profile as we don't know which
+ * post types exist on the remote machine. As such we invert this selection later using the $convert_post_type_selection flag below.
+ */
+ if ( isset( $loaded_profile['post_type_migrate_option'] ) && 'migrate_select_post_types' == $loaded_profile['post_type_migrate_option'] && 'pull' == $loaded_profile['action'] ) {
+ $convert_post_type_selection = true;
+ }
+ $loaded_profile = $this->maybe_update_profile( $loaded_profile, $_GET['wpmdb-profile'] );
+}
+
+if ( false == $is_default_profile ) {
+ $loaded_profile = wp_parse_args( $loaded_profile, $this->default_profile );
+}
+$loaded_profile = wp_parse_args( $loaded_profile, $this->checkbox_options );
+$breadcrumbs_params = array(
+ 'loaded_profile' => $loaded_profile,
+ 'is_default_profile' => $is_default_profile,
+);
+?>
+
+
+
+
+
+
+ template( 'breadcrumbs', 'common', $breadcrumbs_params ); ?>
+
+
+
+
+
+
+
+
+ —
+
+
+ template_part( array( 'invalid_licence_warning' ) ); ?>
+
+
+
+
+
+
+ —
+ get_upload_info( 'path' ) );
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+ New URL Missing — Please enter the protocol-relative URL of the remote website in the "New URL" field or remove the whole row entirely. If you are unsure of what this URL should be, please consult
our documentation on find and replace fields.', 'wp-migrate-db' );
+ if ( $is_default_profile && $this->lock_url_find_replace_row ) {
+ $new_url_missing_warning = __( '
New URL Missing — Please enter the protocol-relative URL of the remote website in the "New URL" field. If you are unsure of what this URL should be, please consult
our documentation on find and replace fields.', 'wp-migrate-db' );
+ }
+ ?>
+
+
New File Path Missing — Please enter the root file path of the remote website in the "New file path" field or remove the whole row entirely. If you are unsure of what the file path should be, please consult
our documentation on find and replace fields.', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/find-and-replace/' ); ?>
+
+
+
+ template_part( array( 'select_tables', 'exclude_post_types' ), $loaded_profile ); ?>
+
+
+
+ template_part( array( 'backup' ), $loaded_profile ); ?>
+
+
+
+
+
+
+
+
+
".', 'wp-migrate-db' ); ?>
+
+
AFTER migration is complete, you will need to edit your local install\'s wp-config.php and change the "%1$s" variable to " ".', 'wp-migrate-db' ), $wpdb->base_prefix, $wpdb->base_prefix ); ?>
+
+
+
+
+
+
+
+
base_prefix ); ?>
+
+
" and will ignore the migrated tables. So, AFTER migration is complete, you will need to edit your remote install\'s wp-config.php and change the " " variable to "%s".', 'wp-migrate-db' ), $wpdb->base_prefix ); ?>
+
+
+
+
+
+ mixed_case_table_name_warning( 'pull' ); ?>
+
+
+
+ mixed_case_table_name_warning( 'push' ); ?>
+
+
+
+
+
+
+
+
+
+
+
+ template( 'migrate-progress' ); ?>
+
+ template_part( array( 'progress_upgrade' ) ); ?>
+
+
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/options-tools-subsite.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/options-tools-subsite.php
new file mode 100644
index 0000000..0042c35
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/options-tools-subsite.php
@@ -0,0 +1,9 @@
+
+
+
+
+
+
get_plugin_title() ); ?>
+
+
get_plugin_title() ), sprintf( '"%s "', esc_url( network_admin_url( 'settings.php?page=' . $this->core_slug ) ), esc_html( $this->get_plugin_title() ) ) ); ?>
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/options.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/options.php
new file mode 100644
index 0000000..0a3c48a
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/options.php
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
get_plugin_title(); ?>
+
+
+ plugin_tabs(); ?>
+
+
+
+
+
+
+ PHP Safe Mode Enabled — We do not officially support running this plugin in safe mode because set_time_limit() has no effect. Therefore we can't extend the run time of the script and ensure it doesn't time out before the migration completes. We haven't disabled the plugin however, so you're free to cross your fingers and hope for the best. However, if you have trouble, we can't help you until you turn off safe mode.", 'wp-migrate-db' );
+ if ( function_exists( 'ini_get' ) ) {
+ printf( __( 'Your current PHP run time limit is set to %s seconds.', 'wp-migrate-db' ), ini_get( 'max_execution_time' ) );
+ } ?>
+
+
+
+
+ Internet Explorer Not Supported — Less than 2% of our customers use IE, so we've decided not to spend time supporting it. We ask that you use Firefox or a Webkit-based browser like Chrome or Safari instead. If this is a problem for you, please let us know.", 'wp-migrate-db' ); ?>
+
+
+ set_time_limit_available() && ! $hide_warning && ! $safe_mode ) {
+ ?>
+
+ PHP Function Disabled — The set_time_limit() function is currently disabled on your server. We use this function to ensure that the migration doesn't time out. We haven't disabled the plugin however, so you're free to cross your fingers and hope for the best. You may want to contact your web host to enable this function.", 'wp-migrate-db' );
+ if ( function_exists( 'ini_get' ) ) {
+ printf( __( 'Your current PHP run time limit is set to %s seconds.', 'wp-migrate-db' ), ini_get( 'max_execution_time' ) );
+ } ?>
+
+
+
+
+
+ 1 profile saved
+ if ( ! empty( $this->settings['profiles'] ) && ! isset( $_GET['wpmdb-profile'] ) ) {
+ $this->template( 'profile' );
+ } else {
+ $this->template( 'migrate' );
+ }
+ $this->template( 'settings' );
+ $this->template( 'addons' );
+ $this->template( 'help' );
+
+ $this->template_part( array( 'sidebar' ) );
+ ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/backup.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/backup.php
new file mode 100644
index 0000000..d771f77
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/backup.php
@@ -0,0 +1,53 @@
+
+
+ maybe_checked( $loaded_profile['create_backup'] ); ?> />
+
+
+
+
+ get_short_uploads_dir(); ?>
+
+
+
+
+
+
+
+ get_table_sizes( 'backup' ) as $table => $size ) :
+ $size = (int) $size * 1024;
+ if ( ! empty( $loaded_profile['select_backup'] ) && in_array( $table, $loaded_profile['select_backup'] ) ) {
+ printf( '%1$s (%2$s) ', $table, size_format( $size ) );
+ } else {
+ printf( '%1$s (%2$s) ', $table, size_format( $size ) );
+ }
+ endforeach; ?>
+
+
+
+
/
+
+
/
+
+
+
+
%s
', 'wp-migrate-db' ), $this->get_upload_info( 'path' ) ); ?>
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/block-external-warning.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/block-external-warning.php
new file mode 100644
index 0000000..09cbe3f
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/block-external-warning.php
@@ -0,0 +1,12 @@
+
+
+ WP_HTTP_BLOCK_EXTERNAL is enabled which will prevent WP Migrate DB Pro from functioning properly. You should either disable WP_HTTP_BLOCK_EXTERNAL or add any sites that you\'d like to migrate to or from with WP Migrate DB Pro to WP_ACCESSIBLE_HOSTS (api.deliciousbrains.com must be added to WP_ACCESSIBLE_HOSTS for the API to work). More information on this can be found here .', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/wp_http_block_external/' );
+ ?>
+
+
+
+
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/connection-info.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/connection-info.php
new file mode 100644
index 0000000..83d7003
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/connection-info.php
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/exclude-post-types.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/exclude-post-types.php
new file mode 100644
index 0000000..0f8d9e3
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/exclude-post-types.php
@@ -0,0 +1,40 @@
+
+
+ maybe_checked( $loaded_profile['exclude_post_types'] ); ?> />
+
+
+
+
+
+
+
+
+
+
+
+ ' . implode( ', ', array_map( 'esc_html', $loaded_profile['select_post_types'] ) ) . '';
+ }
+ ?>
+
+
+
+
+ get_post_types() as $post_type ) :
+ if ( ! empty( $loaded_profile['select_post_types'] ) && in_array( $post_type, $loaded_profile['select_post_types'] ) ) {
+ printf( '%1$s ', $post_type );
+ } else {
+ printf( '%1$s ', $post_type );
+ }
+ endforeach; ?>
+
+
+
+
/
+
+
/
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/invalid-licence-warning.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/invalid-licence-warning.php
new file mode 100644
index 0000000..cfb48cf
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/invalid-licence-warning.php
@@ -0,0 +1,3 @@
+
+ get_licence_status_message(); ?>
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/licence-info.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/licence-info.php
new file mode 100644
index 0000000..64b5134
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/licence-info.php
@@ -0,0 +1,12 @@
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/licence.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/licence.php
new file mode 100644
index 0000000..93b343b
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/licence.php
@@ -0,0 +1,24 @@
+
+
+
+
+
+ is_licence_constant() ) : ?>
+
+
+
+
+ get_formatted_masked_licence();
+ ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/outdated-addons-warning.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/outdated-addons-warning.php
new file mode 100644
index 0000000..996af78
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/outdated-addons-warning.php
@@ -0,0 +1,19 @@
+addons as $addon_basename => $addon ) :
+ if ( false == $this->is_addon_outdated( $addon_basename ) || false == is_plugin_active( $addon_basename ) ) {
+ continue;
+ }
+ $update_url = wp_nonce_url( network_admin_url( 'update.php?action=upgrade-plugin&plugin=' . urlencode( $addon_basename ) ), 'upgrade-plugin_' . $addon_basename );
+ $addon_slug = current( explode( '/', $addon_basename ) );
+ if ( isset( $GLOBALS['wpmdb_meta'][ $addon_slug ]['version'] ) ) {
+ $version = ' (' . $GLOBALS['wpmdb_meta'][ $addon_slug ]['version'] . ')';
+ } else {
+ $version = '';
+ }
+ ?>
+
+ Update Required —
+ Update Now', 'wp-migrate-db' ), $addon['name'], $version, $update_url ); ?>
+
+
+ is_valid_licence() ) ? '' : ' class="disabled"'; ?>>
+ is_pro ) ? ' checked="checked"' : ''; ?>is_valid_licence() ) ? '' : ' disabled="disabled"'; ?> />
+
+
+
+
+
+ is_valid_licence() ) ? '' : ' class="disabled"'; ?>>
+ is_pro ) ? ' checked="checked"' : ''; ?>is_valid_licence() ) ? '' : ' disabled="disabled"'; ?> />
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/request-settings.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/request-settings.php
new file mode 100644
index 0000000..722fb1c
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/request-settings.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+ template( 'checkbox', 'common', array( 'key' => 'verify_ssl' ) ); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ get_bottleneck( 'max' ) ) ); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/secret-key-warning.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/secret-key-warning.php
new file mode 100644
index 0000000..464a4ed
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/secret-key-warning.php
@@ -0,0 +1,9 @@
+
+ —
+ visit the Settings tab and reset your secret key.', 'wp-migrate-db' ), '#settings' ); ?>
+
+
+
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/select-tables.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/select-tables.php
new file mode 100644
index 0000000..f36303a
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/select-tables.php
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+ get_table_sizes();
+ $temp_prefix_length = strlen( $this->temp_prefix );
+ foreach ( $this->get_tables() as $table ) :
+ if( ! isset( $table_sizes[ $table ] ) || $this->temp_prefix === substr( $table, 0, $temp_prefix_length ) ) {
+ continue;
+ }
+ $size = (int) $table_sizes[ $table ] * 1024;
+ if ( ! empty( $loaded_profile['select_tables'] ) && in_array( $table, $loaded_profile['select_tables'] ) ) {
+ printf( '%1$s (%2$s) ', esc_html( $table ), size_format( $size ) );
+ } else {
+ printf( '%1$s (%2$s) ', esc_html( $table ), size_format( $size ) );
+ }
+ endforeach;
+ ?>
+
+
+
+
/
+
+
/
+
+
+
+
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/toggle-remote-requests.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/toggle-remote-requests.php
new file mode 100644
index 0000000..788cf9b
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/toggle-remote-requests.php
@@ -0,0 +1,19 @@
+
+
+
+
+
+ template( 'checkbox', 'common', array( 'key' => 'allow_pull' ) ); ?>
+
+
+
+
+
+
+
+ template( 'checkbox', 'common', array( 'key' => 'allow_push' ) ); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/videos.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/videos.php
new file mode 100644
index 0000000..156da25
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/pro/videos.php
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ $video ) : ?>
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/profile.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/profile.php
new file mode 100644
index 0000000..986aa9a
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/profile.php
@@ -0,0 +1,17 @@
+
+
+
+ settings['profiles'] as $key => $profile ) {
+ ++ $key
+ ?>
+
+
+ ×
+
+
+
+
+
+
+
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/template/settings.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/settings.php
new file mode 100644
index 0000000..8419cee
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/template/settings.php
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/wordpress/wp-content/plugins/wp-migrate-db-pro/wp-migrate-db-pro.php b/wordpress/wp-content/plugins/wp-migrate-db-pro/wp-migrate-db-pro.php
new file mode 100644
index 0000000..043cdd1
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-migrate-db-pro/wp-migrate-db-pro.php
@@ -0,0 +1,117 @@
+` data for a specific menu.
+
+== Installation ==
+
+1. Upload the plugin files to the `/wp-content/plugins/wp-rest-api-v2-menus` directory, or install the plugin through the WordPress plugins screen directly.
+2. Activate the plugin through the 'Plugins' screen in WordPress
+
+
+== Frequently Asked Questions ==
+
+= Is this an official extension of WP API? =
+
+There's no such thing.
+
+= Can I contribute to the project? =
+
+Of course! This is the GitHub Repository https://github.com/thebatclaudio/wp-rest-api-v2-menus
+
+== Screenshots ==
+
+Nothing to show. This plugin has no settings or frontend, it just extends WP API with new routes.
+
+== Changelog ==
+
+0.3 - Bug fix
+
+0.2 - Updated compatibility
+
+0.1.1 - Bug fix
diff --git a/wordpress/wp-content/plugins/wp-rest-api-v2-menus/wp-rest-api-v2-menus.php b/wordpress/wp-content/plugins/wp-rest-api-v2-menus/wp-rest-api-v2-menus.php
new file mode 100644
index 0000000..6089b4c
--- /dev/null
+++ b/wordpress/wp-content/plugins/wp-rest-api-v2-menus/wp-rest-api-v2-menus.php
@@ -0,0 +1,51 @@
+ $description) {
+ $obj = new stdClass;
+ $obj->slug = $slug;
+ $obj->description = $description;
+ $menus[] = $obj;
+ }
+
+ return $menus;
+}
+
+/**
+ * Get menu's data from his id
+ * @param array $data WP REST API data variable
+ * @return object Menu's data with his items
+ */
+function wp_api_v2_menus_get_menu_data ( $data ) {
+ $menu = new stdClass;
+ $menu->items = [];
+ if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $data['id'] ] ) ) {
+ $menu = get_term( $locations[ $data['id'] ] );
+ $menu->items = wp_get_nav_menu_items($menu->term_id);
+ }
+ return $menu;
+}
+
+add_action( 'rest_api_init', function () {
+ register_rest_route( 'menus/v1', '/menus', array(
+ 'methods' => 'GET',
+ 'callback' => 'wp_api_v2_menus_get_all_menus',
+ ) );
+
+ register_rest_route( 'menus/v1', '/menus/(?P[a-zA-Z(-]+)', array(
+ 'methods' => 'GET',
+ 'callback' => 'wp_api_v2_menus_get_menu_data',
+ ) );
+} );