'abds_ln_bot_token', 'nt_chat_id' => 'abds_ln_chat_id', 'nt_enabled' => 'abds_ln_enabled', ) as $old => $new ) { $v = get_option( $old, null ); if ( null !== $v && '' === (string) get_option( $new, '' ) ) { update_option( $new, $v ); } } /** Lets the Pro add-on run its own migrations (e.g. ensure its chat tables). */ do_action( 'abds_connect_migrate' ); } add_action( 'admin_init', 'abds_connect_migrate' ); /* ------------------------- Налаштування ------------------------- */ /** * Registers the free plugin's own setting: the shared licence key (read by * both this plugin and, once installed, the Pro add-on). */ function abds_connect_register_core() { register_setting( 'abds_connect', 'abds_license_key', array( 'sanitize_callback' => 'sanitize_text_field', 'default' => '', ) ); } add_action( 'admin_init', 'abds_connect_register_core' ); /** * Registers the top-level ABDS Connect admin menu page. */ function abds_connect_menu() { $hook = add_menu_page( 'ABDS Connect', 'ABDS Connect', 'manage_options', 'abds-connect', 'abds_connect_page', 'dashicons-format-chat', 58 ); add_action( 'admin_enqueue_scripts', function ( $current_hook ) use ( $hook ) { abds_connect_enqueue_settings_assets( $current_hook, $hook ); } ); } add_action( 'admin_menu', 'abds_connect_menu' ); /** * Loads the settings screen's JS/CSS, only on that one screen. * * @param string $current_hook The hook suffix of the screen being rendered. * @param string $our_hook The ABDS Connect settings screen's own hook suffix. */ function abds_connect_enqueue_settings_assets( $current_hook, $our_hook ) { if ( $current_hook !== $our_hook ) { return; } wp_enqueue_style( 'abds-connect-admin', ABDS_CONNECT_URL . 'assets/css/admin-settings.css', array(), ABDS_CONNECT_VER ); wp_enqueue_script( 'abds-connect-admin', ABDS_CONNECT_URL . 'assets/js/admin-settings.js', array(), ABDS_CONNECT_VER, true ); wp_localize_script( 'abds-connect-admin', 'abdsConnectSettings', array( 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'abds_connect_test_message' ), 'i18n' => array( 'sending' => 'Надсилаємо…', 'button' => 'Надіслати тестове повідомлення', ), ) ); } /** * Adds a "Налаштування" (Settings) link to the plugin's row on the Plugins * screen. * * @param string[] $links Existing action links. * @return string[] */ function abds_connect_action_links( $links ) { $links[] = '' . esc_html__( 'Налаштування', 'abds-connect' ) . ''; return $links; } add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'abds_connect_action_links' ); /** * Renders the ABDS Connect settings page: the leads → Telegram module, the * detected form sources, the licence field, and (via action hooks) the Pro * add-on's own sections when it's installed. Native wp-admin `.card` groups, * in onboarding order — Telegram first, since it's the only thing a fresh * install needs before it does anything useful. */ function abds_connect_page() { if ( ! current_user_can( 'manage_options' ) ) { return; } $pro = abds_is_pro(); $has_token = '' !== trim( (string) get_option( 'abds_ln_bot_token', '' ) ); $tg = abds_ln_telegram_status(); ?>
Заявки з форм у Telegram — безкоштовно. Живий чат і AI-асистент — у доповненні ABDS Connect Pro.
%s