| Server IP : 159.253.20.91 / Your IP : 216.73.216.111 Web Server : nginx/1.20.2 System : Linux se38c9e53.fastvps-server.com 5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17) x86_64 User : pr11_ru_usr ( 1041) PHP Version : 8.1.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/pr11_ru_usr/data/www/pr11.ru/wp-content/plugins/cyr2lat/src/php/ |
Upload File : |
<?php
/**
* ACF Support.
*
* @package cyr-to-lat
*/
namespace CyrToLat;
use CyrToLat\Settings\Settings;
/**
* Class ACF
*/
class ACF {
/**
* Plugin settings.
*
* @var Settings
*/
private $settings;
/**
* ACF constructor.
*
* @param Settings $settings Plugin settings.
*/
public function __construct( Settings $settings ) {
$this->settings = $settings;
$this->init_hooks();
}
/**
* Init class hooks.
*/
public function init_hooks() {
add_action( 'acf/field_group/admin_enqueue_scripts', [ $this, 'enqueue_script' ] );
}
/**
* Enqueue script in ACF field group page.
*
* @return void
*/
public function enqueue_script() {
global $cyr_to_lat_plugin;
$min = $cyr_to_lat_plugin->min_suffix();
$table = $this->settings->get_table();
wp_enqueue_script(
'cyr-to-lat-acf-field-group',
constant( 'CYR_TO_LAT_URL' ) . "/assets/js/acf-field-group$min.js",
[],
constant( 'CYR_TO_LAT_VERSION' ),
true
);
$object = [ 'table' => $table ];
wp_localize_script( 'cyr-to-lat-acf-field-group', 'CyrToLatAcfFieldGroup', $object );
}
}