PATH:
home
/
centosnipponia
/
public_html
/
nipponiacom
/
wp-content
/
themes
/
sydney-pro-ii
/
inc
/
modules
/
live-chat
<?php /** * Functions for the live chat module * * @package Sydney */ if ( !Sydney_Modules::is_module_active( 'live-chat' ) ) { return; } /** * Load Customizer options */ function sydney_live_chat_customizer_options( $wp_customize ) { require get_template_directory() . '/inc/customizer/options/modules/live-chat.php'; } add_action( 'customize_register', 'sydney_live_chat_customizer_options' ); /** * Enqueue live chat related styles */ function sydney_enqueue_live_chat_styles() { $live_chat_enable = get_theme_mod( 'live_chat_enable', 0 ); if( !$live_chat_enable ) { return; } $live_chat_enabled = sydney_get_display_conditions( 'live_chat_conditions', '[{"type":"include","condition":"all","id":null}]' ); if ( !$live_chat_enabled ) { return; } wp_enqueue_style( 'sydney-live-chat-styles', get_template_directory_uri() . '/css/modules/live-chat.min.css' ); wp_enqueue_script( 'sydney-live-chat-script', get_template_directory_uri() . '/js/modules/live-chat.min.js', '','20221222', true ); } add_action( 'wp_enqueue_scripts', 'sydney_enqueue_live_chat_styles' ); //render the whatsapp live chat function sydney_live_chat() { $live_chat_enable = get_theme_mod( 'live_chat_enable', 0 ); if( !$live_chat_enable ) { return; } $live_chat_enabled = sydney_get_display_conditions( 'live_chat_conditions', '[{"type":"include","condition":"all","id":null}]' ); if ( !$live_chat_enabled ) { return; } $position = get_theme_mod( 'live_chat_position', 'right' ); $phone_number = get_theme_mod( 'live_chat_whatsapp', '' ); $initial_text = get_theme_mod( 'live_chat_whatsapp_initial_text', '' ); $mode = get_theme_mod( 'live_chat_mode', 'popup' ); $popup_header_title = get_theme_mod( 'live_chat_popup_header_title', esc_html__( 'Welcome!', 'sydney' ) ); $popup_cta = get_theme_mod( 'live_chat_whatsapp_cta', esc_html__( 'Hello, how can we help?', 'sydney' ) ); $popup_button = get_theme_mod( 'live_chat_popup_button_text', esc_html__( 'Start chat', 'sydney' ) ); $terms = get_theme_mod( 'live_chat_terms', sprintf( __( 'Please accept our %s before starting this chat.', 'sydney' ), '<a href="#">' . __( 'Terms and Conditions', 'sydney' ) . '</a>' ) ); $require_terms = get_theme_mod( 'live_chat_require_accept_terms', 0 ); $mobile = get_theme_mod( 'live_chat_only_mobile', 0 ); $mobile = $mobile ? 'live-chat-mobile' : ''; $has_terms = $require_terms ? 'live-chat-has-terms' : ''; //render the html ?> <div class="sydney-whatsapp-live-chat <?php echo esc_attr( $has_terms ); ?> <?php echo esc_attr( $mobile ); ?> live-chat-<?php echo esc_attr( $position ); ?> live-chat-<?php echo esc_attr( $mode ); ?>"> <div class="live-chat-inner"> <?php if ( $mode == 'popup' ) : ?> <div class="live-chat-popup"> <div class="live-chat-popup-header"> <h5><?php echo esc_html( $popup_header_title ); ?></h5> <span class="live-chat-close"><i class="sydney-svg-icon"><?php sydney_get_svg_icon( 'icon-cancel', true ); ?></i></span> </div> <div class="live-chat-popup-body"> <?php echo esc_html( $popup_cta ); ?> </div> <?php if ( $require_terms ) : ?> <div class="live-chat-terms"> <input type="checkbox" id="live-chat-terms" name="live-chat-terms" value="1"> <label for="live-chat-terms"><?php echo wp_kses_post( $terms ); ?></label> </div> <?php endif; ?> <div class="live-chat-popup-footer"> <div class="live-chat-button-wrapper"> <a href="https://wa.me/<?php echo esc_attr( $phone_number ); ?>/?text=<?php echo esc_attr( $initial_text ); ?>" target="_blank" class="live-chat-popup-button button"><?php echo esc_html( $popup_button ); ?></a> </div> </div> </div> <div class="live-chat-button"> <i class="sydney-svg-icon"><?php sydney_get_svg_icon( 'icon-whatsapp', true ); ?></i> </div> <?php else : ?> <div class="live-chat-button"> <a href="https://wa.me/<?php echo esc_attr( $phone_number ); ?>/?text=<?php echo esc_attr( $initial_text ); ?>" target="_blank" class="live-chat-popup-button"> <i class="sydney-svg-icon"><?php sydney_get_svg_icon( 'icon-whatsapp', true ); ?></i> </a> </div> <?php endif; ?> </div> </div> <?php } add_action( 'wp_footer', 'sydney_live_chat' ); /** * Dynamic styles for the live chat module */ function sydney_live_chat_dynamic_styles( $custom ) { // Modal Popup $live_chat_enable = get_theme_mod( 'live_chat_enable', 0 ); if( $live_chat_enable ) { $custom .= 'div.sydney-whatsapp-live-chat { bottom: '. esc_attr( get_theme_mod( 'livechat_bottom_offset' ) ) .'px; }'; $custom .= 'div.sydney-whatsapp-live-chat.live-chat-right { right: '. esc_attr( get_theme_mod( 'livechat_side_offset' ) ) .'px; }'; $custom .= 'div.sydney-whatsapp-live-chat.live-chat-left { left: '. esc_attr( get_theme_mod( 'livechat_side_offset' ) ) .'px; }'; } return $custom; } add_filter( 'sydney_custom_css', 'sydney_live_chat_dynamic_styles', 11 );
[+]
..
[-] live-chat.php
[edit]
[-] .htaccess.disabled
[edit]