| | |
| | | if (!$this->isRegistered()) { |
| | | add_action('init', [$this, 'buildDashboard']); |
| | | } |
| | | $this->cache->flush(); |
| | | $this->user = wp_get_current_user(); |
| | | $this->role = jvbUserRole($this->user->ID); |
| | | $this->userLink = (int)get_user_meta($this->user->ID, BASE.'link', true); |
| | |
| | | if (!is_singular(BASE.'dash') && !is_post_type_archive(BASE.'dash')) { |
| | | return; |
| | | } |
| | | wp_enqueue_style('jvb-icons-dash'); |
| | | wp_enqueue_style('jvb-icons-forms'); |
| | | IconsManager::for('forms')->enqueueIconStyles(); |
| | | IconsManager::for('dash')->enqueueIconStyles(); |
| | | |
| | | wp_enqueue_script('jvb-form'); |
| | | wp_enqueue_script('jvb-selector'); |
| | |
| | | break; |
| | | case 'admin': |
| | | case 'dash': |
| | | if (current_user_can('manage_options') && apply_filters('jvbAdminDashboard', '') === '') { |
| | | wp_enqueue_script( |
| | | 'jvb-admin', |
| | | JVB_URL . 'assets/js/min/admin.min.js', |
| | | [ |
| | | 'jvb-queue', |
| | | 'jvb-loading' |
| | | ], |
| | | [ |
| | | 'strategy' => 'defer', |
| | | 'in_footer' => true |
| | | ] |
| | | ); |
| | | // if (current_user_can('manage_options') && apply_filters('jvbAdminDashboard', '') === '') { |
| | | // wp_enqueue_script( |
| | | // 'jvb-admin', |
| | | // JVB_URL . 'assets/js/min/admin.min.js', |
| | | // [ |
| | | // 'jvb-queue', |
| | | //// 'jvb-loading' |
| | | // ], |
| | | // [ |
| | | // 'strategy' => 'defer', |
| | | // 'in_footer' => true |
| | | // ] |
| | | // ); |
| | | |
| | | wp_localize_script( |
| | | 'jvb-admin', |
| | | 'jvbAdmin', |
| | | [ |
| | | 'nonce' => wp_create_nonce('itsme') |
| | | ] |
| | | ); |
| | | } |
| | | // wp_localize_script( |
| | | // 'jvb-admin', |
| | | // 'jvbAdmin', |
| | | // [ |
| | | // 'nonce' => wp_create_nonce('itsme') |
| | | // ] |
| | | // ); |
| | | // } |
| | | break; |
| | | case 'seo': |
| | | wp_enqueue_script('jvb-schema'); |