| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.13 Free | |
| 4 | + * @version 2.0.6 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; |
| @@ -24,26 +24,21 @@ | ||
| 24 | 24 | * @return void |
| 25 | 25 | */ |
| 26 | 26 | public function renderPage() |
| 27 | 27 | { |
| 28 | - add_action('admin_enqueue_scripts', [$this, 'admin_enqueue_scripts']); | |
| 28 | + // load media for current page | |
| 29 | + if (method_exists($this, 'addMedia')) | |
| 30 | + { | |
| 31 | + add_action('admin_enqueue_scripts', [$this, 'addMedia']); | |
| 32 | + } | |
| 29 | 33 | |
| 30 | 34 | // render base view of controller |
| 31 | 35 | add_action('fpframework_' . fpframework()->getPluginPage() . '/admin_page', [$this, 'renderBaseView']); |
| 32 | 36 | |
| 33 | 37 | // render each controller view from the child controllers |
| 34 | - add_action('firebox/admin/content', [$this, 'render']); | |
| 38 | + add_action('firebox/admin_page_content', [$this, 'render']); | |
| 35 | 39 | } |
| 36 | 40 | |
| 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 | - | |
| 46 | 41 | /** |
| 47 | 42 | * Renders the Basic View of a Controller |
| 48 | 43 | * |
| 49 | 44 | * @return void |
| @@ -49,70 +44,8 @@ | ||
| 49 | 44 | * @return void |
| 50 | 45 | */ |
| 51 | 46 | public function renderBaseView() |
| 52 | 47 | { |
| 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 | - ]); | |
| 48 | + firebox()->renderer->admin->render('static/template', ['settings' => get_option('firebox_settings')]); | |
| 62 | 49 | } |
| 63 | 50 | |
| 64 | - private function getCurrentPage() | |
| 65 | - { | |
| 66 | - return isset($_GET['page']) ? sanitize_text_field(wp_unslash($_GET['page'])) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 67 | - } | |
| 68 | - | |
| 69 | - /** | |
| 70 | - * Returns the sidebar navigation. | |
| 71 | - * | |
| 72 | - * @return array | |
| 73 | - */ | |
| 74 | - private function getNavigation() | |
| 75 | - { | |
| 76 | - $campaigns = false; | |
| 77 | - | |
| 78 | - if (current_user_can('read_fireboxes')) | |
| 79 | - { | |
| 80 | - $campaigns = [ | |
| 81 | - 'label' => firebox()->_('FB_CAMPAIGNS'), | |
| 82 | - 'url' => admin_url('admin.php?page=firebox-campaigns'), | |
| 83 | - 'slug' => 'firebox-campaigns' | |
| 84 | - ]; | |
| 85 | - } | |
| 86 | - | |
| 87 | - $items = [ | |
| 88 | - [ | |
| 89 | - 'label' => fpframework()->_('FPF_OVERVIEW'), | |
| 90 | - 'url' => admin_url('admin.php?page=firebox'), | |
| 91 | - 'slug' => 'firebox' | |
| 92 | - ], | |
| 93 | - $campaigns, | |
| 94 | - [ | |
| 95 | - 'label' => fpframework()->_('FPF_ANALYTICS'), | |
| 96 | - 'url' => admin_url('admin.php?page=firebox-analytics'), | |
| 97 | - 'slug' => 'firebox-analytics' | |
| 98 | - ], | |
| 99 | - [ | |
| 100 | - 'label' => fpframework()->_('FPF_SUBMISSIONS'), | |
| 101 | - 'url' => admin_url('admin.php?page=firebox-submissions'), | |
| 102 | - 'slug' => 'firebox-submissions' | |
| 103 | - ], | |
| 104 | - [ | |
| 105 | - 'label' => fpframework()->_('FPF_SETTINGS'), | |
| 106 | - 'url' => admin_url('admin.php?page=firebox-settings'), | |
| 107 | - 'slug' => 'firebox-settings' | |
| 108 | - ] | |
| 109 | - ]; | |
| 110 | - | |
| 111 | - $items = array_filter($items, function($item) { | |
| 112 | - return $item !== false; | |
| 113 | - }); | |
| 114 | - $items = array_values($items); | |
| 115 | - | |
| 116 | - return $items; | |
| 117 | - } | |
| 118 | 51 | } |