| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.4 Free | |
| 4 | + * @version 3.1.14 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <[email protected]> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2021 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2026 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; |
| @@ -15,18 +15,30 @@ | ||
| 15 | 15 | { |
| 16 | 16 | exit; // Exit if accessed directly. |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | +use FPFramework\Libs\Registry; | |
| 20 | +use FireBox\Core\Helpers\BoxHelper; | |
| 21 | + | |
| 19 | 22 | class AdminBarMenu |
| 20 | 23 | { |
| 21 | 24 | public function __construct() |
| 22 | 25 | { |
| 26 | + $cParam = BoxHelper::getParams(); | |
| 27 | + $cParam = new Registry($cParam); | |
| 28 | + | |
| 29 | + // Ensure we have enabled the showing of the admin bar menu item | |
| 30 | + if ($cParam->get('show_admin_bar_menu_item', '1') !== '1') | |
| 31 | + { | |
| 32 | + return; | |
| 33 | + } | |
| 34 | + | |
| 23 | 35 | // add media to both front and back end |
| 24 | - add_action( 'wp_enqueue_scripts', [ $this, 'addMedia' ] ); | |
| 25 | - add_action( 'admin_enqueue_scripts', [ $this, 'addMedia' ] ); | |
| 36 | + add_action('wp_enqueue_scripts', [ $this, 'addMedia' ]); | |
| 37 | + add_action('admin_enqueue_scripts', [ $this, 'addMedia' ]); | |
| 26 | 38 | |
| 27 | 39 | // add FireBox menu item on top admin bar |
| 28 | - add_action( 'admin_bar_menu', [ $this, 'register' ], 999 ); | |
| 40 | + add_action('admin_bar_menu', [ $this, 'register' ], 999); | |
| 29 | 41 | } |
| 30 | 42 | |
| 31 | 43 | /** |
| 32 | 44 | * Enqueue styles. |
| @@ -54,11 +66,9 @@ | ||
| 54 | 66 | * @return boolean |
| 55 | 67 | */ |
| 56 | 68 | public function canRun() |
| 57 | 69 | { |
| 58 | - if (is_user_logged_in() && | |
| 59 | - current_user_can('manage_options') && | |
| 60 | - !get_option('hide-admin-bar', false)) | |
| 70 | + if (is_user_logged_in() && current_user_can('read_fireboxes') && !get_option('hide-admin-bar', false)) | |
| 61 | 71 | { |
| 62 | 72 | return true; |
| 63 | 73 | } |
| 64 | 74 | |
| @@ -83,8 +93,9 @@ | ||
| 83 | 93 | 'main_menu', |
| 84 | 94 | 'add_new_menu', |
| 85 | 95 | 'all_popups_menu', |
| 86 | 96 | 'analytics_menu', |
| 97 | + 'submissions_menu', | |
| 87 | 98 | 'support_menu', |
| 88 | 99 | |
| 89 | 100 | 'upgrade_menu', |
| 90 | 101 | |
| @@ -104,15 +115,15 @@ | ||
| 104 | 115 | * @return void |
| 105 | 116 | */ |
| 106 | 117 | public function main_menu($wp_admin_bar) |
| 107 | 118 | { |
| 108 | - $logo = '<img src="' . FBOX_MEDIA_ADMIN_URL . 'images/logo_white.svg' . '" alt="firebox logo" />'; | |
| 119 | + $logo = '<img src="' . FBOX_MEDIA_ADMIN_URL . 'images/logo_white.svg' . '" width="22" height="22" alt="firebox logo" />'; | |
| 109 | 120 | |
| 110 | 121 | $wp_admin_bar->add_menu( |
| 111 | 122 | [ |
| 112 | 123 | 'id' => 'firebox-menu', |
| 113 | 124 | 'title' => $logo . firebox()->_('FB_PLUGIN_NAME'), |
| 114 | - 'href' => admin_url( 'admin.php?page=firebox' ), | |
| 125 | + 'href' => admin_url('admin.php?page=firebox') | |
| 115 | 126 | ] |
| 116 | 127 | ); |
| 117 | 128 | } |
| 118 | 129 | |
| @@ -128,10 +139,10 @@ | ||
| 128 | 139 | $wp_admin_bar->add_menu( |
| 129 | 140 | [ |
| 130 | 141 | 'parent' => 'firebox-menu', |
| 131 | 142 | 'id' => 'firebox-menu-all-boxes', |
| 132 | - 'title' => firebox()->_('FB_POPUPS'), | |
| 133 | - 'href' => admin_url( 'edit.php?post_type=firebox' ), | |
| 143 | + 'title' => firebox()->_('FB_CAMPAIGNS'), | |
| 144 | + 'href' => admin_url('admin.php?page=firebox-campaigns') | |
| 134 | 145 | ] |
| 135 | 146 | ); |
| 136 | 147 | } |
| 137 | 148 | |
| @@ -147,10 +158,10 @@ | ||
| 147 | 158 | $wp_admin_bar->add_menu( |
| 148 | 159 | [ |
| 149 | 160 | 'parent' => 'firebox-menu', |
| 150 | 161 | 'id' => 'firebox-menu-new-box', |
| 151 | - 'title' => firebox()->_('FB_NEW_POPUP'), | |
| 152 | - 'href' => admin_url( 'post-new.php?post_type=firebox' ), | |
| 162 | + 'title' => firebox()->_('FB_NEW_CAMPAIGN'), | |
| 163 | + 'href' => admin_url('post-new.php?post_type=firebox') | |
| 153 | 164 | ] |
| 154 | 165 | ); |
| 155 | 166 | } |
| 156 | 167 | |
| @@ -167,9 +178,9 @@ | ||
| 167 | 178 | [ |
| 168 | 179 | 'parent' => 'firebox-menu', |
| 169 | 180 | 'id' => 'firebox-menu-support', |
| 170 | 181 | 'title' => fpframework()->_('FPF_SUPPORT'), |
| 171 | - 'href' => FPF_SUPPORT_URL | |
| 182 | + 'href' => \FPFramework\Base\Functions::getUTMURL(FPF_SUPPORT_URL . '?topic=Pre-sale Question', null, 'misc', 'contact') | |
| 172 | 183 | ] |
| 173 | 184 | ); |
| 174 | 185 | } |
| 175 | 186 | |
| @@ -191,8 +202,27 @@ | ||
| 191 | 202 | ] |
| 192 | 203 | ); |
| 193 | 204 | } |
| 194 | 205 | |
| 206 | + /** | |
| 207 | + * Render FireBox Submissions Page | |
| 208 | + * | |
| 209 | + * @param object $wp_admin_bar WordPress Admin Bar object. | |
| 210 | + * | |
| 211 | + * @return void | |
| 212 | + */ | |
| 213 | + public function submissions_menu($wp_admin_bar) | |
| 214 | + { | |
| 215 | + $wp_admin_bar->add_menu( | |
| 216 | + [ | |
| 217 | + 'parent' => 'firebox-menu', | |
| 218 | + 'id' => 'firebox-menu-submissions', | |
| 219 | + 'title' => fpframework()->_('FPF_SUBMISSIONS'), | |
| 220 | + 'href' => admin_url('admin.php?page=firebox-submissions') | |
| 221 | + ] | |
| 222 | + ); | |
| 223 | + } | |
| 224 | + | |
| 195 | 225 | |
| 196 | 226 | /** |
| 197 | 227 | * Render FireBox Upgrade Page |
| 198 | 228 | * |
| @@ -205,12 +235,12 @@ | ||
| 205 | 235 | $wp_admin_bar->add_menu( |
| 206 | 236 | [ |
| 207 | 237 | 'parent' => 'firebox-menu', |
| 208 | 238 | 'id' => 'firebox-menu-upgrade', |
| 209 | - 'title' => fpframework()->_('FPF_UPGRADE'), | |
| 210 | - 'href' => FBOX_GO_PRO_URL, | |
| 239 | + 'title' => fpframework()->_('FPF_UPGRADE_TO_PRO'), | |
| 240 | + 'href' => sprintf(FBOX_GO_PRO_URL, 'pro'), | |
| 211 | 241 | 'meta' => [ |
| 212 | - 'class' => 'fb-yellow-link' | |
| 242 | + 'class' => 'firebox-go-pro-yellow-link' | |
| 213 | 243 | ] |
| 214 | 244 | ] |
| 215 | 245 | ); |
| 216 | 246 | } |