Current path: home/webdevt/www/demo2/wp-content/plugins/divi-contact-form-helper/d5/server/Admin/Setup/
?? Go up: /home/webdevt/www/demo2/wp-content/plugins/divi-contact-form-helper/d5/server/Admin
<?php
namespace KS_PAC_DCFH\Admin\Setup;
if (!defined('ABSPATH')) {
exit;
}
class PluginAdminScripts
{
private string $plugin_url;
private string $plugin_version;
private string $min_suffix = '';
public function load(): void
{
$this->plugin_url = KS_PAC_DCFH_PLUGIN_URL;
$this->plugin_version = KS_PAC_DCFH_PLUGIN_VERSION;
$this->min_suffix = KS_PAC_DCFH_PLUGIN_DEV_MOD ? '' : '.min';
add_action('admin_enqueue_scripts', [$this, 'maybe_enqueue_scripts']);
}
public function maybe_enqueue_scripts($hook): void
{
$localizations = [
'ajaxNonce' => wp_create_nonce('dcfh_ad_ajax_req'),
'i10n' => [
'please_wait_text' => 'Please wait...',
'select_term' => 'Please Select Term',
'not_applicable' => 'Not Applicable',
'custom_field_name' => 'Enter custom field name.',
'choose_custom_field_name' => 'Choose Custom Field',
'tmd_email_address_required' => 'Email Address is required.',
],
'dataPicker' => ['status' => false]
];
$localizations = apply_filters('dcfh_admin_localization_data', $localizations);
wp_localize_script('divi-contact-form-helper', 'dcfhAdminSettings', $localizations);
/*---------------- Core ----------------*/
wp_enqueue_style('divi-contact-form-helper', $this->plugin_url."/assets/admin/admin$this->min_suffix.css", [], $this->plugin_version);
wp_enqueue_script('divi-contact-form-helper', $this->plugin_url."/assets/admin/admin$this->min_suffix.js", ['jquery', 'wp-i18n'], $this->plugin_version, true);
wp_localize_script('divi-contact-form-helper', 'dcfhAdminSettings', $localizations);
/*---------------- WP Media ----------------*/
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 ((isset($localizations['dataPicker']['status']) && $localizations['dataPicker']['status']) && !did_action('jquery-ui-datepicker')) {
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');
}
}
}