| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package FireBox |
| 4 |
* @version 1.0.0 Free |
| 5 |
* |
| 6 |
* @author FirePlugins <info@fireplugins.com> |
| 7 |
* @link https://www.fireplugins.com |
| 8 |
* @copyright Copyright © 2021 FirePlugins All Rights Reserved |
| 9 |
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace FireBox\Core\Controllers; |
| 13 |
|
| 14 |
if (!defined('ABSPATH')) |
| 15 |
{ |
| 16 |
exit; // Exit if accessed directly. |
| 17 |
} |
| 18 |
|
| 19 |
use FireBox\Core\Admin\Analytics\Overview\Overview; |
| 20 |
|
| 21 |
class Dashboard extends BaseController |
| 22 |
{ |
| 23 |
/** |
| 24 |
* The Main Buttons of the Dashboard |
| 25 |
* |
| 26 |
* @var array |
| 27 |
*/ |
| 28 |
protected $main_buttons; |
| 29 |
|
| 30 |
public function __construct() |
| 31 |
{ |
| 32 |
$this->setMainButtons(); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Load required media files |
| 37 |
* |
| 38 |
* @return void |
| 39 |
*/ |
| 40 |
public function addMedia() |
| 41 |
{ |
| 42 |
// load geoip js |
| 43 |
wp_register_script( |
| 44 |
'fpf-geoip', |
| 45 |
FPF_MEDIA_URL . 'admin/js/fpf_geoip.js', |
| 46 |
[], |
| 47 |
FPF_VERSION, |
| 48 |
false |
| 49 |
); |
| 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 |
]; |
| 108 |
} |
| 109 |
} |