version, '5.9.0', '>=' ) ) { // say something about incompatibility add_action( 'admin_notices', [ $this, 'print_deprecation_notice' ] ); } else if ( class_exists( 'acf_pro' ) && version_compare( acf()->version, '5.7.0', '>=' ) ) { // enqueue assets add_action( 'acf/input/admin_enqueue_scripts', [ $this, 'enqueue_assets' ] ); add_action( 'init', [ $this, 'register_assets' ] ); } else if ( current_user_can( 'activate_plugins' ) ) { // say something about incompatibility add_action( 'admin_notices', [ $this, 'print_acf_notice' ] ); } } /** * @action admin_notices */ function print_acf_notice() { $message = sprintf( /* Translators: ACF-Pro URL */ __( 'The ACF Duplicate Repeater plugin only provides support for ACF Pro 5.7 and up.', 'acf-duplicate-repeater' ), 'https://www.advancedcustomfields.com/pro' ); if ( class_exists( 'acf_pro' ) && version_compare( acf()->version, '5.7.0', '<' ) ) { $message .= ' ' . sprintf( /* Translators: Plugins page URL */ __( 'Please upgrade ACF Pro to the latest Version on the plugins page.', 'acf-duplicate-repeater' ), admin_url('plugins.php' ) ); } else { $message .= ' ' . sprintf( /* Translators: Plugins page URL */ __( 'You can disable and uninstall the plugin on the plugins page.', 'acf-duplicate-repeater' ), admin_url('plugins.php' ) ); } ?>

[ 'rel' => [], 'href' => [], 'target' => [] ] ] ); ?>

plugins page.', 'acf-duplicate-repeater' ), admin_url( 'plugins.php' ) ); } ?>

[ 'rel' => [], 'href' => [], 'target' => [] ] ] ); ?>

style_asset = Asset\Asset::get('css/acf/duplicate-repeater.css') ->deps( ['acf-pro-input'] ); $this->script_asset = Asset\Asset::get( 'js/acf/duplicate-repeater.js' ) ->footer( false ) ->deps( ['acf-pro-input'] ) ->localize( [ 'options' => [ 'duplicate_repeater_btn' => sprintf( '', __('Duplicate Entry', 'acf-duplicate-repeater' ) ), 'duplicate_flexible_btn' => sprintf( '', __('Duplicate Layout', 'acf-duplicate-repeater' ) ), ], 'l10n' => [], ], 'acf_duplicate_repeater' ); } /** * Load frontend styles and scripts * * @action wp_enqueue_scripts */ public function enqueue_assets() { if ( is_null( $this->style_asset ) ) { $this->register_assets(); } $this->style_asset->enqueue(); $this->script_asset->enqueue(); } }