Current path: home/webdevt/www/cryptoimpot.fr/wp-content/plugins/divi-contact-form-helper/app/Base/
?? Go up: /home/webdevt/www/cryptoimpot.fr/wp-content/plugins/divi-contact-form-helper/app
<?php
namespace KS_PAC_DCFH\Base;
use KS_PAC_DCFH\Admin\Controllers\Strings;
if (!defined('ABSPATH')) {
exit;
}
class Admin_Enqueue
{
private $version;
private $min = '';
public function init(): void
{
$this->version = KS_PAC_DCFH_PLUGIN_VERSION;
$this->min = KS_PAC_DCFH_PLUGIN_DEV_MOD ? '' : '.min';
add_action('admin_enqueue_scripts', [$this, 'enqueue_scripts'], 999);
}
public function enqueue_scripts($hook): void
{
// Localizations
$localizations = [
'ajaxURL' => esc_js(admin_url('admin-ajax.php')),
'ajaxNonce' => wp_create_nonce('admin-ajax-nonce'),
'pluginURL' => esc_js($this->get_plugin_url()),
'blogURL' => get_bloginfo('url'),
'i10n' => Strings::instance()->strings('admin_i10'),
'dataPicker' => ['status' => false]
];
$localizations = apply_filters('dcfh_f_admin_localizations', $localizations);
/*---------------- Admin App ----------------*/
wp_enqueue_style('divi-contact-form-helper-app', $this->get_plugin_url("/assets/admin/app$this->min.css"), [], $this->version);
wp_enqueue_script('divi-contact-form-helper-app', $this->get_plugin_url("/assets/admin/app$this->min.js"), ['jquery', 'wp-i18n'], $this->version, true);
wp_localize_script('divi-contact-form-helper-app', 'DiviContactFormHelperAdminData', $localizations);
if (!did_action('wp_enqueue_media')) {
wp_enqueue_media();
}
/*---------------- Jquery UI ----------------*/
if (!did_action('wp-jquery-ui-dialog')) {
wp_enqueue_script('jquery-ui-dialog');
wp_enqueue_style('wp-jquery-ui-dialog');
wp_enqueue_script('jquery-ui-autocomplete', '', ['jquery-ui-widget', 'jquery-ui-position'], '1.8.6');
}
/*---------------- Jquery Datepicker ----------------*/
if (!did_action('jquery-ui-datepicker')
&& (isset($localizations['dataPicker']['status'])
&& $localizations['dataPicker']['status'])) {
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_style('jquery-ui-datepicker', 'https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css');
}
}
private function get_plugin_url($path = ''): string
{
return KS_PAC_DCFH_PLUGIN_URL.$path;
}
}