| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.10 Free | |
| 4 | + * @version 2.1.39 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2022 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2025 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | namespace FireBox\Core\Controllers; |
| @@ -15,23 +15,19 @@ | ||
| 15 | 15 | { |
| 16 | 16 | exit; // Exit if accessed directly. |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -use FireBox\Core\Admin\Analytics\Overview\Overview; | |
| 20 | - | |
| 21 | 19 | class Dashboard extends BaseController |
| 22 | 20 | { |
| 23 | 21 | /** |
| 24 | - * The Main Buttons of the Dashboard | |
| 22 | + * Render view | |
| 25 | 23 | * |
| 26 | - * @var array | |
| 24 | + * @return void | |
| 27 | 25 | */ |
| 28 | - protected $main_buttons; | |
| 29 | - | |
| 30 | - public function __construct() | |
| 26 | + public function render() | |
| 31 | 27 | { |
| 32 | - $this->setMainButtons(); | |
| 33 | - } | |
| 28 | + firebox()->renderer->admin->render('pages/dashboard'); | |
| 29 | + } | |
| 34 | 30 | |
| 35 | 31 | /** |
| 36 | 32 | * Load required media files |
| 37 | 33 | * |
| @@ -38,8 +34,23 @@ | ||
| 38 | 34 | * @return void |
| 39 | 35 | */ |
| 40 | 36 | public function addMedia() |
| 41 | 37 | { |
| 38 | + wp_register_script('firebox-react', FBOX_MEDIA_ADMIN_URL . 'js/vendor/react.production.min.js', [], FBOX_VERSION, true); | |
| 39 | + wp_enqueue_script('firebox-react'); | |
| 40 | + wp_register_script('firebox-react-dom', FBOX_MEDIA_ADMIN_URL . 'js/vendor/react-dom.production.min.js', [], FBOX_VERSION, true); | |
| 41 | + wp_enqueue_script('firebox-react-dom'); | |
| 42 | + | |
| 43 | + // load dashboard | |
| 44 | + wp_register_script( | |
| 45 | + 'firebox-dashboard', | |
| 46 | + FBOX_MEDIA_ADMIN_URL . 'js/dashboard.js', | |
| 47 | + ['wp-api-fetch'], | |
| 48 | + FBOX_VERSION, | |
| 49 | + true | |
| 50 | + ); | |
| 51 | + wp_enqueue_script('firebox-dashboard'); | |
| 52 | + | |
| 42 | 53 | // load geoip js |
| 43 | 54 | wp_register_script( |
| 44 | 55 | 'fpf-geoip', |
| 45 | 56 | FPF_MEDIA_URL . 'admin/js/fpf_geoip.js', |
| @@ -44,66 +55,9 @@ | ||
| 44 | 55 | 'fpf-geoip', |
| 45 | 56 | FPF_MEDIA_URL . 'admin/js/fpf_geoip.js', |
| 46 | 57 | [], |
| 47 | 58 | FPF_VERSION, |
| 48 | - false | |
| 59 | + true | |
| 49 | 60 | ); |
| 50 | - wp_enqueue_script( 'fpf-geoip' ); | |
| 51 | - } | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * Render view | |
| 55 | - * | |
| 56 | - * @return void | |
| 57 | - */ | |
| 58 | - public function render() | |
| 59 | - { | |
| 60 | - $payload = [ | |
| 61 | - 'main_buttons' => $this->main_buttons | |
| 62 | - ]; | |
| 63 | - | |
| 64 | - firebox()->renderer->admin->render('pages/dashboard', $payload); | |
| 65 | - } | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * Sets the Main Buttons of the Dashboard | |
| 69 | - * | |
| 70 | - * @return void | |
| 71 | - */ | |
| 72 | - protected function setMainButtons() | |
| 73 | - { | |
| 74 | - $this->main_buttons = [ | |
| 75 | - [ | |
| 76 | - 'label' => 'FB_NEW_POPUP', | |
| 77 | - 'icon' => 'dashicons-plus-alt', | |
| 78 | - 'url' => admin_url('post-new.php?post_type=firebox'), | |
| 79 | - 'li_class' => 'fpf-open-library-modal' | |
| 80 | - ], | |
| 81 | - [ | |
| 82 | - 'label' => 'FB_POPUPS', | |
| 83 | - 'icon' => 'dashicons-menu-alt', | |
| 84 | - 'url' => admin_url('edit.php?post_type=firebox') | |
| 85 | - ], | |
| 86 | - [ | |
| 87 | - 'label' => 'FPF_ANALYTICS', | |
| 88 | - 'icon' => 'dashicons-chart-bar', | |
| 89 | - 'url' => admin_url('admin.php?page=firebox-analytics') | |
| 90 | - ], | |
| 91 | - [ | |
| 92 | - 'label' => 'FPF_IMPORT', | |
| 93 | - 'icon' => 'dashicons-upload', | |
| 94 | - 'url' => admin_url('admin.php?page=firebox-import') | |
| 95 | - ], | |
| 96 | - [ | |
| 97 | - 'label' => 'FPF_SETTINGS', | |
| 98 | - 'icon' => 'dashicons-admin-generic', | |
| 99 | - 'url' => admin_url('admin.php?page=firebox-settings') | |
| 100 | - ], | |
| 101 | - [ | |
| 102 | - 'label' => 'FPF_DOCUMENTATION', | |
| 103 | - 'icon' => 'dashicons-editor-help', | |
| 104 | - 'url' => FBOX_DOC_URL, | |
| 105 | - 'target' => '_blank' | |
| 106 | - ] | |
| 107 | - ]; | |
| 61 | + wp_enqueue_script('fpf-geoip'); | |
| 108 | 62 | } |
| 109 | 63 | } |