| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.13 Free | |
| 4 | + * @version 2.0.12 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2026 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2023 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,19 +15,23 @@ | ||
| 15 | 15 | { |
| 16 | 16 | exit; // Exit if accessed directly. |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | +use FireBox\Core\Admin\Analytics\Overview\Overview; | |
| 20 | + | |
| 19 | 21 | class Dashboard extends BaseController |
| 20 | 22 | { |
| 21 | 23 | /** |
| 22 | - * Render view | |
| 24 | + * The Main Buttons of the Dashboard | |
| 23 | 25 | * |
| 24 | - * @return void | |
| 26 | + * @var array | |
| 25 | 27 | */ |
| 26 | - public function render() | |
| 28 | + protected $main_buttons; | |
| 29 | + | |
| 30 | + public function __construct() | |
| 27 | 31 | { |
| 28 | - firebox()->renderer->admin->render('pages/dashboard'); | |
| 29 | - } | |
| 32 | + $this->setMainButtons(); | |
| 33 | + } | |
| 30 | 34 | |
| 31 | 35 | /** |
| 32 | 36 | * Load required media files |
| 33 | 37 | * |
| @@ -34,23 +38,8 @@ | ||
| 34 | 38 | * @return void |
| 35 | 39 | */ |
| 36 | 40 | public function addMedia() |
| 37 | 41 | { |
| 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 | - | |
| 53 | 42 | // load geoip js |
| 54 | 43 | wp_register_script( |
| 55 | 44 | 'fpf-geoip', |
| 56 | 45 | FPF_MEDIA_URL . 'admin/js/fpf_geoip.js', |
| @@ -55,30 +44,71 @@ | ||
| 55 | 44 | 'fpf-geoip', |
| 56 | 45 | FPF_MEDIA_URL . 'admin/js/fpf_geoip.js', |
| 57 | 46 | [], |
| 58 | 47 | FPF_VERSION, |
| 59 | - true | |
| 48 | + false | |
| 60 | 49 | ); |
| 61 | - wp_enqueue_script('fpf-geoip'); | |
| 50 | + wp_enqueue_script( 'fpf-geoip' ); | |
| 51 | + } | |
| 62 | 52 | |
| 63 | - // Load appropriate revenue attribution bundle based on plan | |
| 64 | - $this->loadRevenueAttributionBundle(); | |
| 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 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | - * Load the appropriate revenue attribution bundle based on user's plan | |
| 68 | + * Sets the Main Buttons of the Dashboard | |
| 69 | + * | |
| 70 | + * @return void | |
| 69 | 71 | */ |
| 70 | - private function loadRevenueAttributionBundle() | |
| 72 | + protected function setMainButtons() | |
| 71 | 73 | { |
| 72 | - $is_ra_plan = in_array(FBOX_LICENSE_PLAN, ['pro', 'growth']); | |
| 73 | - $bundle_name = $is_ra_plan ? 'revenue_attribution_pro' : 'revenue_attribution_basic'; | |
| 74 | - | |
| 75 | - wp_register_script( | |
| 76 | - $bundle_name, | |
| 77 | - FBOX_MEDIA_ADMIN_URL . 'js/blocks/' . $bundle_name . '.js', | |
| 78 | - ['firebox-dashboard'], | |
| 79 | - FBOX_VERSION, | |
| 80 | - true | |
| 81 | - ); | |
| 82 | - wp_enqueue_script($bundle_name); | |
| 74 | + $this->main_buttons = [ | |
| 75 | + [ | |
| 76 | + 'label' => firebox()->_('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' => firebox()->_('FB_POPUPS'), | |
| 83 | + 'icon' => 'dashicons-menu-alt', | |
| 84 | + 'url' => admin_url('edit.php?post_type=firebox') | |
| 85 | + ], | |
| 86 | + [ | |
| 87 | + 'label' => fpframework()->_('FPF_ANALYTICS'), | |
| 88 | + 'icon' => 'dashicons-chart-bar', | |
| 89 | + 'url' => admin_url('admin.php?page=firebox-analytics') | |
| 90 | + ], | |
| 91 | + [ | |
| 92 | + 'label' => fpframework()->_('FPF_SUBMISSIONS'), | |
| 93 | + 'icon' => 'dashicons-list-view', | |
| 94 | + 'url' => admin_url('admin.php?page=firebox-submissions') | |
| 95 | + ], | |
| 96 | + [ | |
| 97 | + 'label' => fpframework()->_('FPF_IMPORT'), | |
| 98 | + 'icon' => 'dashicons-upload', | |
| 99 | + 'url' => admin_url('admin.php?page=firebox-import') | |
| 100 | + ], | |
| 101 | + [ | |
| 102 | + 'label' => fpframework()->_('FPF_SETTINGS'), | |
| 103 | + 'icon' => 'dashicons-admin-generic', | |
| 104 | + 'url' => admin_url('admin.php?page=firebox-settings') | |
| 105 | + ], | |
| 106 | + [ | |
| 107 | + 'label' => fpframework()->_('FPF_DOCUMENTATION'), | |
| 108 | + 'icon' => 'dashicons-editor-help', | |
| 109 | + 'url' => FBOX_DOC_URL, | |
| 110 | + 'target' => '_blank' | |
| 111 | + ] | |
| 112 | + ]; | |
| 83 | 113 | } |
| 84 | 114 | } |