get(); $display = Models_Display::instance()->get(); $box = Models_Box::instance()->get(); $scheme = Models_Scheme::instance()->get(); $is_visible = Entity_Visibility::instance()->is_show_view( $display ); if ( ! $is_visible ) { return; } wp_enqueue_script( 'qlwapp-frontend' ); wp_enqueue_style( 'qlwapp-frontend' ); // Filter the contacts based on the display settings. $contacts = array_values( array_filter( Models_Contacts::instance()->get_all(), function ( $contact ) { if ( ! isset( $contact['display'] ) ) { return true; } $is_visible = Entity_Visibility::instance()->is_show_view( $contact['display'] ); return $is_visible; } ) ); $style = self::get_scheme_css_properties( $scheme ); $style .= self::get_button_css_properties( $button ); $contacts_json = wp_json_encode( $contacts ); $display_json = wp_json_encode( $display ); $button_json = wp_json_encode( $button ); $box_json = wp_json_encode( $box ); $scheme_json = wp_json_encode( $scheme ); ?>
$value ) { if ( '' !== $value ) { if ( ! str_contains( $key, 'animation' ) ) { continue; } if ( str_contains( $key, 'animation_delay' ) ) { $value = "{$value}s"; } $style .= sprintf( '--%s-button-%s:%s;', QLWAPP_DOMAIN, esc_attr( str_replace( '_', '-', $key ) ), esc_attr( $value ) ); } } return $style; } public static function get_scheme_css_properties( $scheme ) { $style = ''; foreach ( $scheme as $key => $value ) { if ( is_numeric( $value ) ) { $value = "{$value}px"; } if ( '' !== $value ) { $style .= sprintf( '--%s-scheme-%s:%s;', QLWAPP_DOMAIN, esc_attr( str_replace( '_', '-', $key ) ), esc_attr( $value ) ); } } return $style; } public static function do_shortcode( $atts, $content = null ) { wp_enqueue_script( 'qlwapp-frontend' ); wp_enqueue_style( 'qlwapp-frontend' ); $button = Models_Button::instance()->get(); $button['text'] = $content; $button['position'] = ''; $button['box'] = 'no'; $button = htmlentities( wp_json_encode( wp_parse_args( $atts, $button ) ), ENT_QUOTES, 'UTF-8' ); $scheme = Models_Scheme::instance()->get(); $style = self::get_scheme_css_properties( $scheme ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped return '
'; } public static function instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } }