plugin updates

This commit is contained in:
Tony Volpe
2024-09-05 11:04:01 -04:00
parent ed6b060261
commit 50cd64dd3d
925 changed files with 16918 additions and 13003 deletions

View File

@@ -42,67 +42,59 @@ if ( ! class_exists( 'acf_field_select' ) ) :
/**
* description
* Enqueues admin scripts for the Select field.
*
* @type function
* @date 16/12/2015
* @since 5.3.2
* @since 5.3.2
*
* @param $post_id (int)
* @return $post_id (int)
* @return void
*/
function input_admin_enqueue_scripts() {
// bail early if no enqueue
public function input_admin_enqueue_scripts() {
// Bail early if not enqueuing select2.
if ( ! acf_get_setting( 'enqueue_select2' ) ) {
return;
}
// globals
global $wp_scripts, $wp_styles;
global $wp_scripts;
// vars
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
$major = acf_get_setting( 'select2_version' );
$version = '';
$script = '';
$style = '';
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
$major = acf_get_setting( 'select2_version' );
// attempt to find 3rd party Select2 version
// - avoid including v3 CSS when v4 JS is already enququed
// - avoid including v3 CSS when v4 JS is already enqueued.
if ( isset( $wp_scripts->registered['select2'] ) ) {
$major = (int) $wp_scripts->registered['select2']->ver;
}
// v4
if ( $major == 4 ) {
$version = '4.0.13';
$script = acf_get_url( "assets/inc/select2/4/select2.full{$min}.js" );
$style = acf_get_url( "assets/inc/select2/4/select2{$min}.css" );
// v3
} else {
if ( $major === 3 ) {
// Use v3 if necessary.
$version = '3.5.2';
$script = acf_get_url( "assets/inc/select2/3/select2{$min}.js" );
$style = acf_get_url( 'assets/inc/select2/3/select2.css' );
} else {
// Default to v4.
$version = '4.0.13';
$script = acf_get_url( "assets/inc/select2/4/select2.full{$min}.js" );
$style = acf_get_url( "assets/inc/select2/4/select2{$min}.css" );
}
// enqueue
wp_enqueue_script( 'select2', $script, array( 'jquery' ), $version );
wp_enqueue_style( 'select2', $style, '', $version );
// localize
acf_localize_data(
array(
'select2L10n' => array(
'matches_1' => _x( 'One result is available, press enter to select it.', 'Select2 JS matches_1', 'acf' ),
/* translators: %d - number of results available in select field */
'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' ),
/* translators: %d - number of characters to enter into select field input */
'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' ),
/* translators: %d - number of characters that should be removed from select field */
'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' ),
/* translators: %d - maximum number of items that can be selected in the select field */
'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' ),