version = '1.2.2'; // init admin page if the user is logged in and has rights to see it! $current_user = wp_get_current_user(); if ( ! empty( $current_user->ID ) ) { // check if can edit settings! if ( current_user_can( 'manage_options' ) ) { require_once plugin_dir_path( __FILE__ ) . 'admin/class-atlas-specialist-admin.php'; $admin_menu = new Atlas_Specialist_Admin; $admin_menu->init(); } } if ( ! is_admin() ) { $options = get_option( 'atlas_specialist_options' ); $enable_chat = isset( $options['specialist_chat_enable'] ) ? wp_strip_all_tags( $options['specialist_chat_enable'] ) : '0'; $chat_title = isset( $options['specialist_chat_title'] ) ? wp_strip_all_tags( $options['specialist_chat_title'] ) : 'Live Chat'; $options_array = array( 'url' => wp_strip_all_tags( $options['specialist_url'] ), 'chatEnable' => $enable_chat, 'chatTitle' => $chat_title, 'locale' => get_locale() ); if ( $options ) { wp_enqueue_script( 'zabuto_calendar', plugin_dir_url( __FILE__ ) . 'public/libs/zabuto_calendar.min.js', array( 'jquery' ), '1.2.1', true ); wp_enqueue_style( 'zabuto_calendar_style', plugin_dir_url( __FILE__ ) . 'public/libs/zabuto_calendar.min.css', false, '1.2.1' ); wp_enqueue_style( 'atlas_specialist_style', plugin_dir_url( __FILE__ ) . 'public/css/atlas-specialist.min.css', false, $this->version ); wp_enqueue_script( 'atlas_specialist_js', plugin_dir_url( __FILE__ ) . 'public/js/atlas-specialist.min.js', array( 'jquery' ), $this->version, true ); wp_localize_script( 'atlas_specialist_js', 'atlasSpecialistOptions', $options_array ); } } // add specialist profile shortcode. add_shortcode( 'atlas-specialist-profile', array( $this, 'embed_profile_shortcode' ) ); // add specialist calendar add_shortcode( 'atlas-specialist-calendar', array( $this, 'appointments_calendar_shortcode' ) ); } /** * Profile embed shortcode function * * @param array $atts - array of shortcode attributes. * @since 1.0.0 */ public function embed_profile_shortcode( $atts ) { $opts = shortcode_atts( array( 'width' => '100%', 'height' => '500', ), $atts ); $options = get_option( 'atlas_specialist_options' ); $profile = isset( $options['specialist_url'] ) ? esc_js( $options['specialist_url'] ) : 'atlas'; return '