/** * Add styles and scripts for options panel and chat console * * @since 1.0.0 * @return void * @author Alberto Ruggiero */ public function admin_scripts() { switch (ylc_get_current_page()) { case $this->_panel_page: wp_register_style('ylc-styles', YLC_ASSETS_URL . '/css/ylc-styles.css'); wp_enqueue_style('ylc-styles'); break; case $this->_console_page: $this->admin_frontend_scripts(); //YLC Console Engine wp_register_script('ylc-engine-console', YLC_ASSETS_URL . '/js/ylc-engine-console' . $this->is_script_debug_active() . '.js', array('jquery', 'ylc-firebase')); wp_enqueue_script('ylc-engine-console'); $js_vars = array('ajax_url' => str_replace(array('https:', 'http:'), '', admin_url('admin-ajax.php')), 'plugin_url' => YLC_ASSETS_URL, 'is_premium' => defined('YLC_PREMIUM') ? true : false, 'company_avatar' => apply_filters('ylc_company_avatar', ''), 'default_user_avatar' => apply_filters('ylc_default_avatar', '', 'user'), 'default_admin_avatar' => apply_filters('ylc_default_avatar', '', 'admin'), 'yith_wpv_active' => defined('YLC_PREMIUM') && defined('YITH_WPV_PREMIUM') ? true : false, 'active_vendor' => apply_filters('ylc_vendor', array('vendor_id' => 0, 'vendor_name' => '')), 'vendor_only_chat' => apply_filters('ylc_vendor_only', false), 'templates' => array('console_chat_line' => file_get_contents(YLC_DIR . 'templates/chat-backend/console-chat-line.php'), 'console_user_item' => file_get_contents(YLC_DIR . 'templates/chat-backend/console-user-item.php'), 'console_conversation' => file_get_contents(YLC_DIR . 'templates/chat-backend/console-conversation.php'), 'console_user_info' => file_get_contents(YLC_DIR . 'templates/chat-backend/console-user-info.php'), 'console_user_tools' => file_get_contents(YLC_DIR . 'templates/chat-backend/console-user-tools.php'), 'premium' => apply_filters('ylc_templates_premium', array(), 'console')), 'strings' => $this->get_strings()); wp_localize_script('ylc-engine-console', 'ylc', $js_vars); // Console stylesheet wp_register_style('ylc-console', YLC_ASSETS_URL . '/css/ylc-console.css'); wp_enqueue_style('ylc-console'); break; } }
/** * Add styles and scripts for Chat Console * * @since 1.0.0 * @return void * @author Alberto Ruggiero */ public function chat_console_scripts() { // Load in chat console if (ylc_get_current_page() == $this->_console_page) { ylc_set_firebase_security(); // Get currently logged user info get_currentuserinfo(); //Load FontAwesome $this->load_fontawesome(); // AutoSize Plug-in wp_register_script('jquery-autosize', YLC_ASSETS_URL . '/js/jquery.autosize.min.js', array('jquery'), '1.17.1'); wp_enqueue_script('jquery-autosize'); // Application JS $this->load_livechat_js(); wp_register_style('ylc-google-fonts', '//fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,700italic,400,700,600', array(), null); wp_enqueue_style('ylc-google-fonts'); // Console stylesheet wp_register_style('ylc-console', YLC_ASSETS_URL . '/css/ylc-console.css'); wp_enqueue_style('ylc-console'); } }