version = '1.0.0'; // 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'] ) ? esc_js( $options['specialist_chat_enable'] ) : '0'; $options_array = array( 'url' => $options['specialist_url'], 'chatEnable' => $enable_chat, ); if ( $options ) { wp_enqueue_style( 'atlas_specialist_style', plugin_dir_url( __FILE__ ) . 'public/css/atlas-specialist.css', false, $this->version ); wp_enqueue_script( 'atlas_specialist_js', plugin_dir_url( __FILE__ ) . 'public/js/atlas-specialist.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' ) ); } /** * Function to be runned on init event * * @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 '