'; $svg_close = ''; $svg_close_md = ''; $svg_close_xs = ''; $svg_chevron = ''; $svg_more = ''; $svg_phone = ''; $svg_zalo = ''; $svg_messenger = ''; $svg_sms = ''; $svg_email = ''; $svg_facebook = ''; $svg_maps = ''; // Collect channels in high-converting priority order: Phone -> Zalo -> Messenger -> SMS -> Email -> Fanpage -> Maps $channels = array(); $phone_list = aio_get_option( 'opt-phone-list' ); if ( empty( $phone_list ) && '' !== trim( (string) aio_get_option( 'txtPhone', '' ) ) ) { $phone_list = array( array( 'name' => '', 'phone' => trim( (string) aio_get_option( 'txtPhone', '' ) ), ), ); } if ( ! empty( $phone_list ) && is_array( $phone_list ) ) { foreach ( $phone_list as $item ) { $phone_raw = isset( $item['phone'] ) ? trim( (string) $item['phone'] ) : ''; if ( '' === $phone_raw ) { continue; } $tel_clean = preg_replace( '/[^0-9+]/', '', $phone_raw ); if ( '' === $tel_clean ) { continue; } $name_raw = isset( $item['name'] ) ? trim( (string) $item['name'] ) : ''; $channels[] = array( 'type' => 'phone', 'class' => 'btn-phone', 'href' => 'tel:' . $tel_clean, 'external' => false, 'icon' => $svg_phone, 'title' => '' !== $name_raw ? $name_raw : __( 'Call Hotline', 'aio-tools' ), 'sub' => $phone_raw, 'short' => '' !== $name_raw ? $name_raw : __( 'Call Now', 'aio-tools' ), ); } } $zalo_list = aio_get_option( 'opt-zalo-list' ); if ( empty( $zalo_list ) && '' !== trim( (string) aio_get_option( 'txtZalo', '' ) ) ) { $zalo_list = array( array( 'name' => '', 'phone' => trim( (string) aio_get_option( 'txtZalo', '' ) ), ), ); } if ( ! empty( $zalo_list ) && is_array( $zalo_list ) ) { foreach ( $zalo_list as $item ) { $zalo_raw = isset( $item['phone'] ) ? trim( (string) $item['phone'] ) : ''; if ( '' === $zalo_raw ) { continue; } $zalo_name = isset( $item['name'] ) ? trim( (string) $item['name'] ) : ''; $zalo_slug = preg_replace( '#^https?://(?:www\.)?zalo\.me/#i', '', $zalo_raw ); $zalo_slug = trim( (string) $zalo_slug, '/' ); if ( '' === $zalo_slug ) { continue; } $channels[] = array( 'type' => 'zalo', 'class' => 'btn-zalo', 'href' => 'https://zalo.me/' . $zalo_slug, 'external' => true, 'icon' => $svg_zalo, 'title' => '' !== $zalo_name ? $zalo_name : __( 'Chat Zalo', 'aio-tools' ), 'sub' => $zalo_slug, 'short' => '' !== $zalo_name ? $zalo_name : 'Zalo', ); } } $aio_options_db = get_option( 'aio_options', array() ); if ( is_array( $aio_options_db ) && array_key_exists( 'txtMessenger', $aio_options_db ) ) { $messenger_raw = trim( (string) $aio_options_db['txtMessenger'] ); } else { $messenger_raw = trim( (string) aio_get_option( 'txtFBMessenger', '' ) ); } if ( '' !== $messenger_raw ) { $messenger_slug = preg_replace( '#^https?://(?:www\.)?(?:m\.me/|messenger\.com/t/|facebook\.com/messages/t/|facebook\.com/)#i', '', $messenger_raw ); $messenger_slug = trim( (string) $messenger_slug, '/' ); if ( '' !== $messenger_slug ) { $messenger_url = preg_match( '#^https?://#i', $messenger_slug ) ? $messenger_slug : 'https://m.me/' . $messenger_slug; $channels[] = array( 'type' => 'messenger', 'class' => 'btn-facebook', 'href' => $messenger_url, 'external' => true, 'icon' => $svg_messenger, 'title' => 'Messenger', 'sub' => __( 'Instant message', 'aio-tools' ), 'short' => 'Messenger', ); } } $sms_val = trim( (string) aio_get_option( 'txtSMS', '' ) ); if ( '' !== $sms_val ) { $clean_sms = preg_replace( '/[^0-9+]/', '', $sms_val ); if ( '' !== $clean_sms ) { $channels[] = array( 'type' => 'sms', 'class' => 'btn-sms', 'href' => 'sms:' . $clean_sms, 'external' => false, 'icon' => $svg_sms, 'title' => __( 'Send SMS', 'aio-tools' ), 'sub' => $sms_val, 'short' => 'SMS', ); } } $email_val = trim( (string) aio_get_option( 'txtEmail', '' ) ); if ( '' !== $email_val ) { $channels[] = array( 'type' => 'email', 'class' => 'btn-email', 'href' => 'mailto:' . $email_val, 'external' => false, 'icon' => $svg_email, 'title' => __( 'Send Email', 'aio-tools' ), 'sub' => $email_val, 'short' => 'Email', ); } $fanpage_url = trim( (string) aio_get_option( 'txtFanpage', '' ) ); if ( '' !== $fanpage_url ) { $channels[] = array( 'type' => 'fanpage', 'class' => 'btn-fanpage', 'href' => $fanpage_url, 'external' => true, 'icon' => $svg_facebook, 'title' => 'Facebook Fanpage', 'sub' => __( 'Official page', 'aio-tools' ), 'short' => 'Fanpage', ); } $maps_url = trim( (string) aio_get_option( 'txtMaps', '' ) ); if ( '' !== $maps_url ) { $channels[] = array( 'type' => 'maps', 'class' => 'btn-maps', 'href' => $maps_url, 'external' => true, 'icon' => $svg_maps, 'title' => __( 'Directions', 'aio-tools' ), 'sub' => 'Google Maps', 'short' => __( 'Maps', 'aio-tools' ), ); } if ( empty( $channels ) ) { return; } $wrapper_classes = array( 'aio-contact-modern', 'aio-pos-fixed', 'pos-' . $position, 'style-' . $style, ); if ( $mobile_bar ) { $wrapper_classes[] = 'has-mobile-bar'; } $bubble_message = trim( (string) aio_get_option( 'txtBubbleMessage', '' ) ); $bubble_timeout = max( 1, (int) aio_get_option( 'numBubbleTimeout', 15 ) ); $html = '
'; // 1. Flyout Panel / Pills Stack / Desktop Quick-Dock $html .= ''; // 2. Floating Action Trigger Row (Greeting Pill + Main Gradient FAB) $html .= '
'; if ( '' !== $bubble_message ) { $html .= '
'; $html .= ''; $html .= '' . esc_html( $bubble_message ) . ''; $html .= ''; $html .= '
'; } $html .= ''; $html .= '
'; // 3. Optional 1-Tap Mobile Bottom Thumb-Zone Pill Bar (< 768px) if ( $mobile_bar ) { $primary_mobile = array_slice( $channels, 0, 3 ); $has_overflow = count( $channels ) > 3; $html .= ''; } $html .= '
'; echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped }