| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.0 Free | |
| 4 | + * @version 2.1.14 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2021 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2024 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; |
| @@ -24,21 +24,26 @@ | ||
| 24 | 24 | * @return void |
| 25 | 25 | */ |
| 26 | 26 | public function renderPage() |
| 27 | 27 | { |
| 28 | - // load media for current page | |
| 29 | - if (method_exists($this, 'addMedia')) | |
| 30 | - { | |
| 31 | - add_action('admin_enqueue_scripts', [$this, 'addMedia']); | |
| 32 | - } | |
| 28 | + add_action('admin_enqueue_scripts', [$this, 'admin_enqueue_scripts']); | |
| 33 | 29 | |
| 34 | 30 | // render base view of controller |
| 35 | 31 | add_action('fpframework_' . fpframework()->getPluginPage() . '/admin_page', [$this, 'renderBaseView']); |
| 36 | 32 | |
| 37 | 33 | // render each controller view from the child controllers |
| 38 | - add_action('firebox/admin_page_content', [$this, 'render']); | |
| 34 | + add_action('firebox/admin/content', [$this, 'render']); | |
| 39 | 35 | } |
| 40 | 36 | |
| 37 | + public function admin_enqueue_scripts() | |
| 38 | + { | |
| 39 | + // load media for current page | |
| 40 | + if (method_exists($this, 'addMedia')) | |
| 41 | + { | |
| 42 | + $this->addMedia(); | |
| 43 | + } | |
| 44 | + } | |
| 45 | + | |
| 41 | 46 | /** |
| 42 | 47 | * Renders the Basic View of a Controller |
| 43 | 48 | * |
| 44 | 49 | * @return void |
| @@ -44,8 +49,56 @@ | ||
| 44 | 49 | * @return void |
| 45 | 50 | */ |
| 46 | 51 | public function renderBaseView() |
| 47 | 52 | { |
| 48 | - firebox()->renderer->admin->render('static/template', ['settings' => get_option('firebox_settings')]); | |
| 53 | + firebox()->renderer->admin->render('static/template', [ | |
| 54 | + 'settings' => get_option('firebox_settings'), | |
| 55 | + 'current_page' => $this->getCurrentPage(), | |
| 56 | + 'navigation' => $this->getNavigation(), | |
| 57 | + 'call_to_action_label' => firebox()->_('FB_NEW_CAMPAIGN'), | |
| 58 | + 'plugin_version' => FBOX_VERSION, | |
| 59 | + 'plugin_slug' => 'firebox', | |
| 60 | + 'plugin_name' => 'FireBox', | |
| 61 | + ]); | |
| 49 | 62 | } |
| 50 | 63 | |
| 64 | + private function getCurrentPage() | |
| 65 | + { | |
| 66 | + return isset($_GET['page']) ? $_GET['page'] : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 67 | + } | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * Returns the sidebar navigation. | |
| 71 | + * | |
| 72 | + * @return void | |
| 73 | + */ | |
| 74 | + private function getNavigation() | |
| 75 | + { | |
| 76 | + return [ | |
| 77 | + [ | |
| 78 | + 'label' => fpframework()->_('FPF_OVERVIEW'), | |
| 79 | + 'url' => admin_url('admin.php?page=firebox'), | |
| 80 | + 'slug' => 'firebox' | |
| 81 | + ], | |
| 82 | + [ | |
| 83 | + 'label' => firebox()->_('FB_CAMPAIGNS'), | |
| 84 | + 'url' => admin_url('admin.php?page=firebox-campaigns'), | |
| 85 | + 'slug' => 'firebox-campaigns' | |
| 86 | + ], | |
| 87 | + [ | |
| 88 | + 'label' => fpframework()->_('FPF_ANALYTICS'), | |
| 89 | + 'url' => admin_url('admin.php?page=firebox-analytics'), | |
| 90 | + 'slug' => 'firebox-analytics' | |
| 91 | + ], | |
| 92 | + [ | |
| 93 | + 'label' => fpframework()->_('FPF_SUBMISSIONS'), | |
| 94 | + 'url' => admin_url('admin.php?page=firebox-submissions'), | |
| 95 | + 'slug' => 'firebox-submissions' | |
| 96 | + ], | |
| 97 | + [ | |
| 98 | + 'label' => fpframework()->_('FPF_SETTINGS'), | |
| 99 | + 'url' => admin_url('admin.php?page=firebox-settings'), | |
| 100 | + 'slug' => 'firebox-settings' | |
| 101 | + ] | |
| 102 | + ]; | |
| 103 | + } | |
| 51 | 104 | } |