| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package FireBox |
| 4 |
* @version 2.1.14 Free |
| 5 |
* |
| 6 |
* @author FirePlugins <info@fireplugins.com> |
| 7 |
* @link https://www.fireplugins.com |
| 8 |
* @copyright Copyright © 2024 FirePlugins All Rights Reserved |
| 9 |
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace FireBox\Core\Admin; |
| 13 |
|
| 14 |
if (!defined('ABSPATH')) |
| 15 |
{ |
| 16 |
exit; // Exit if accessed directly. |
| 17 |
} |
| 18 |
|
| 19 |
class Admin |
| 20 |
{ |
| 21 |
/** |
| 22 |
* Admin Page Settings |
| 23 |
* |
| 24 |
* @var AdminPageSettings |
| 25 |
*/ |
| 26 |
private $pageSettings; |
| 27 |
|
| 28 |
/** |
| 29 |
* Library |
| 30 |
* |
| 31 |
* @var Library |
| 32 |
*/ |
| 33 |
public $library; |
| 34 |
|
| 35 |
/** |
| 36 |
* Admin constructor |
| 37 |
*/ |
| 38 |
public function __construct() |
| 39 |
{ |
| 40 |
new \FireBox\Core\Notices\Ajax(); |
| 41 |
|
| 42 |
|
| 43 |
add_action('admin_enqueue_scripts', [$this, 'global_backend_assets'], 20); |
| 44 |
|
| 45 |
|
| 46 |
add_action('enqueue_block_editor_assets', [$this, 'block_editor_assets'], -100); |
| 47 |
|
| 48 |
add_action('current_screen', [$this, 'current_screen']); |
| 49 |
|
| 50 |
add_action('firebox/admin/content', [$this, 'showNotices'], -5); |
| 51 |
|
| 52 |
// init dependencies |
| 53 |
$this->initDependencies(); |
| 54 |
|
| 55 |
// Admin Page Settings |
| 56 |
$this->pageSettings = new AdminPageSettings(); |
| 57 |
|
| 58 |
// run actions |
| 59 |
$this->handleActions(); |
| 60 |
|
| 61 |
// run filters |
| 62 |
$this->handleFilters(); |
| 63 |
} |
| 64 |
|
| 65 |
public function showNotices() |
| 66 |
{ |
| 67 |
\FireBox\Core\Notices\Notices::getInstance()->show(); |
| 68 |
} |
| 69 |
|
| 70 |
public function block_editor_assets() |
| 71 |
{ |
| 72 |
wp_register_script( |
| 73 |
'firebox-store', |
| 74 |
FBOX_MEDIA_ADMIN_URL . 'js/helpers/store.js', |
| 75 |
[], |
| 76 |
FBOX_VERSION, |
| 77 |
false |
| 78 |
); |
| 79 |
} |
| 80 |
|
| 81 |
|
| 82 |
public function global_backend_assets() |
| 83 |
{ |
| 84 |
wp_register_style( |
| 85 |
'firebox-admin-lite', |
| 86 |
FBOX_MEDIA_ADMIN_URL . 'css/lite.css', |
| 87 |
[], |
| 88 |
FBOX_VERSION, |
| 89 |
false |
| 90 |
); |
| 91 |
wp_enqueue_style('firebox-admin-lite'); |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
public function current_screen($screen) |
| 96 |
{ |
| 97 |
add_action('admin_enqueue_scripts', [$this, 'registerEditorMedia'], 11); |
| 98 |
|
| 99 |
$allowed_pages = [ |
| 100 |
'toplevel_page_firebox', |
| 101 |
'firebox_page_firebox-campaigns', |
| 102 |
'firebox_page_firebox-analytics', |
| 103 |
'firebox_page_firebox-submissions', |
| 104 |
'firebox_page_firebox-settings', |
| 105 |
'firebox_page_firebox-import' |
| 106 |
]; |
| 107 |
|
| 108 |
if (isset($screen->id) && in_array($screen->id, $allowed_pages)) |
| 109 |
{ |
| 110 |
add_action('admin_enqueue_scripts', [$this, 'registerMediaAdminPages'], 20); |
| 111 |
|
| 112 |
add_filter('admin_footer_text', [$this, 'admin_footer_text']); |
| 113 |
} |
| 114 |
} |
| 115 |
|
| 116 |
public function registerEditorMedia() |
| 117 |
{ |
| 118 |
wp_register_script('firebox-admin-editor', false); |
| 119 |
wp_enqueue_script('firebox-admin-editor'); |
| 120 |
|
| 121 |
$data = [ |
| 122 |
'media_url' => FBOX_MEDIA_URL, |
| 123 |
'timezone' => $this->getTimezone() |
| 124 |
]; |
| 125 |
|
| 126 |
wp_localize_script('firebox-admin-editor', 'fbox_admin_editor_js_object', $data); |
| 127 |
|
| 128 |
} |
| 129 |
|
| 130 |
public function admin_footer_text() |
| 131 |
{ |
| 132 |
return; |
| 133 |
} |
| 134 |
|
| 135 |
/** |
| 136 |
* Load admin dependencies. |
| 137 |
* |
| 138 |
* @return void |
| 139 |
*/ |
| 140 |
private function initDependencies() |
| 141 |
{ |
| 142 |
new Media(); |
| 143 |
|
| 144 |
$this->library = firebox()->library; |
| 145 |
} |
| 146 |
|
| 147 |
/** |
| 148 |
* Runs all Admin Actions |
| 149 |
* |
| 150 |
* @return void |
| 151 |
*/ |
| 152 |
private function handleActions() |
| 153 |
{ |
| 154 |
add_action('admin_enqueue_scripts', [$this, 'registerGlobalMedia'], 20); |
| 155 |
|
| 156 |
|
| 157 |
add_action('plugin_action_links_' . plugin_basename(FBOX_PLUGIN_BASE_FILE), [$this, 'plugin_action_links']); |
| 158 |
|
| 159 |
} |
| 160 |
|
| 161 |
public function registerGlobalMedia() |
| 162 |
{ |
| 163 |
wp_register_style('firebox-global-admin', false); |
| 164 |
wp_enqueue_style('firebox-global-admin'); |
| 165 |
$css = ' |
| 166 |
#adminmenu li.toplevel_page_firebox img { |
| 167 |
max-height: 22px; |
| 168 |
padding-top: 6px; |
| 169 |
} |
| 170 |
'; |
| 171 |
wp_add_inline_style('firebox-global-admin', $css); |
| 172 |
} |
| 173 |
|
| 174 |
|
| 175 |
/** |
| 176 |
* Adds extra links to the Plugins page in the free version. |
| 177 |
* - Upgrade to Pro button |
| 178 |
* |
| 179 |
* @param array $links |
| 180 |
* |
| 181 |
* @return array |
| 182 |
*/ |
| 183 |
public function plugin_action_links($links) |
| 184 |
{ |
| 185 |
$links = array_merge( $links, array( |
| 186 |
'<a href="' . FBOX_GO_PRO_URL . '" class="firebox-go-pro-link" title="' . fpframework()->_('FPF_UNLOCK_MORE_FEATURES_WITH_PRO_READ_MORE') . '">' . firebox()->_('FB_UPGRADE_20_OFF') . '</a>' |
| 187 |
) ); |
| 188 |
|
| 189 |
return $links; |
| 190 |
} |
| 191 |
|
| 192 |
|
| 193 |
/** |
| 194 |
* Runs all Admin Filters |
| 195 |
* |
| 196 |
* @return void |
| 197 |
*/ |
| 198 |
private function handleFilters() |
| 199 |
{ |
| 200 |
add_filter('admin_body_class', [$this, 'setPluginPageBodyClass']); |
| 201 |
add_filter('plugin_row_meta' , [$this, 'addPluginMetaLinks'], 10, 4); |
| 202 |
} |
| 203 |
|
| 204 |
/** |
| 205 |
* Adds extra links to the plugins page. |
| 206 |
* |
| 207 |
* @param array $links |
| 208 |
* @param string $file |
| 209 |
* @param array $plugin_data |
| 210 |
* @param string $status |
| 211 |
* |
| 212 |
* @return array |
| 213 |
*/ |
| 214 |
public function addPluginMetaLinks($links, $file, $plugin_data, $status) |
| 215 |
{ |
| 216 |
if ($file === FBOX_PLUGIN_BASENAME) |
| 217 |
{ |
| 218 |
$links['rate'] = '<a href="https://wordpress.org/support/plugin/firebox/reviews/?filter=5#new-post" aria-label="' . esc_attr__(firebox()->_('FB_RATE_FIREBOX')) . '" target="_blank">' . esc_html__(firebox()->_('FB_RATE_FIREBOX')) . '</a>'; |
| 219 |
$links['support'] = '<a href="https://www.fireplugins.com/contact/" aria-label="' . esc_attr__(fpframework()->_('FPF_SUPPORT')) . '" target="_blank">' . esc_html__(fpframework()->_('FPF_SUPPORT')) . '</a>'; |
| 220 |
} |
| 221 |
|
| 222 |
return $links; |
| 223 |
} |
| 224 |
|
| 225 |
/** |
| 226 |
* Sets a class to the body of the FireBox Admin Pages |
| 227 |
* |
| 228 |
* @return string |
| 229 |
*/ |
| 230 |
public function setPluginPageBodyClass($classes) |
| 231 |
{ |
| 232 |
if (!$this->isPluginPage()) |
| 233 |
{ |
| 234 |
return $classes; |
| 235 |
} |
| 236 |
|
| 237 |
$classes .= ' fpf-admin-page fpf-firebox-page'; |
| 238 |
|
| 239 |
if ($this->isControllerPage()) |
| 240 |
{ |
| 241 |
$classes .= ' fpf-controller-page'; |
| 242 |
} |
| 243 |
|
| 244 |
// Set admin template theme class |
| 245 |
$fireplugins_theme = isset($_COOKIE['fireplugins_theme']) ? sanitize_key($_COOKIE['fireplugins_theme']) : 'light'; |
| 246 |
$classes .= ' ' . $fireplugins_theme; |
| 247 |
|
| 248 |
// Set admin template sidebar toggle class |
| 249 |
$sidebar_state = isset($_COOKIE['fireplugins_sidebar_state']) ? $_COOKIE['fireplugins_sidebar_state'] : 'expand'; |
| 250 |
$classes .= ' ' . ($sidebar_state === 'expand' ? 'fpf-admin-sidebar-expand' : 'fpf-admin-sidebar-shrink'); |
| 251 |
|
| 252 |
return $classes; |
| 253 |
} |
| 254 |
|
| 255 |
/** |
| 256 |
* Checks if we are in a plugin page |
| 257 |
* |
| 258 |
* @return boolean |
| 259 |
*/ |
| 260 |
private function isPluginPage() |
| 261 |
{ |
| 262 |
if (in_array($this->getPageNow(), ['edit.php', 'post-new.php']) && isset($_GET['post_type']) && $_GET['post_type'] == 'firebox') //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 263 |
{ |
| 264 |
return true; |
| 265 |
} |
| 266 |
|
| 267 |
if ($this->getPageNow() == 'post.php') |
| 268 |
{ |
| 269 |
return true; |
| 270 |
} |
| 271 |
|
| 272 |
if ($this->isControllerPage()) |
| 273 |
{ |
| 274 |
return true; |
| 275 |
} |
| 276 |
|
| 277 |
return false; |
| 278 |
} |
| 279 |
|
| 280 |
/** |
| 281 |
* Whether we are browsing a plugin page from the plugin's menu |
| 282 |
* |
| 283 |
* @return boolean |
| 284 |
*/ |
| 285 |
private function isControllerPage() |
| 286 |
{ |
| 287 |
if (!firebox()->menu) |
| 288 |
{ |
| 289 |
return false; |
| 290 |
} |
| 291 |
|
| 292 |
$current_plugin_page = fpframework()->getPluginPage(); |
| 293 |
$plugin_menu_items = firebox()->menu->getPluginMenuItems(); |
| 294 |
|
| 295 |
// Only set the class to the plugin pages |
| 296 |
return $this->getPageNow() == 'admin.php' && in_array($current_plugin_page, $plugin_menu_items); |
| 297 |
} |
| 298 |
|
| 299 |
/** |
| 300 |
* Returns page now |
| 301 |
* |
| 302 |
* @return string |
| 303 |
*/ |
| 304 |
protected function getPageNow() |
| 305 |
{ |
| 306 |
global $pagenow; |
| 307 |
return $pagenow; |
| 308 |
} |
| 309 |
|
| 310 |
/** |
| 311 |
* Registers CSS and JS files |
| 312 |
* |
| 313 |
* @return void |
| 314 |
*/ |
| 315 |
public function registerMediaAdminPages() |
| 316 |
{ |
| 317 |
$this->registerStyles(); |
| 318 |
$this->registerScripts(); |
| 319 |
} |
| 320 |
|
| 321 |
/** |
| 322 |
* Register admin styles. |
| 323 |
* |
| 324 |
* @return void |
| 325 |
*/ |
| 326 |
public function registerStyles() |
| 327 |
{ |
| 328 |
// load dashicons |
| 329 |
wp_enqueue_style('dashicons'); |
| 330 |
|
| 331 |
// firebox main admin css |
| 332 |
wp_register_style( |
| 333 |
'firebox-admin', |
| 334 |
FBOX_MEDIA_ADMIN_URL . 'css/firebox.css', |
| 335 |
[], |
| 336 |
FBOX_VERSION, |
| 337 |
false |
| 338 |
); |
| 339 |
wp_enqueue_style('firebox-admin'); |
| 340 |
|
| 341 |
// firebox admin design |
| 342 |
wp_register_style( |
| 343 |
'firebox-design-admin', |
| 344 |
FBOX_MEDIA_ADMIN_URL . 'css/firebox_design.css', |
| 345 |
[], |
| 346 |
FBOX_VERSION, |
| 347 |
false |
| 348 |
); |
| 349 |
wp_enqueue_style('firebox-design-admin'); |
| 350 |
|
| 351 |
$css = ' |
| 352 |
:root { |
| 353 |
--fpf-templates-library-header-logo: url(' . FBOX_MEDIA_ADMIN_URL . 'images/logo.svg); |
| 354 |
} |
| 355 |
'; |
| 356 |
wp_add_inline_style('firebox-admin', $css); |
| 357 |
} |
| 358 |
|
| 359 |
/** |
| 360 |
* Registers admin scripts. |
| 361 |
* |
| 362 |
* @return void |
| 363 |
*/ |
| 364 |
public function registerScripts() |
| 365 |
{ |
| 366 |
wp_register_script('firebox-admin', false); |
| 367 |
wp_enqueue_script('firebox-admin'); |
| 368 |
|
| 369 |
$data = array( |
| 370 |
'campaigns_item_new_url' => admin_url('post-new.php?post_type=firebox'), |
| 371 |
'campaigns_list_url' => admin_url('admin.php?page=firebox-campaigns'), |
| 372 |
'campaigns_item_edit_url' => admin_url('post.php?post={{ID}}&action=edit'), |
| 373 |
'campaigns_item_analytics_url' => admin_url('admin.php?page=firebox-analytics&campaign={{ID}}'), |
| 374 |
'campaigns_analytics_url' => admin_url('admin.php?page=firebox-analytics'), |
| 375 |
'submissions_page' => admin_url('admin.php?page=firebox-submissions'), |
| 376 |
'flags_url' => FBOX_PLUGIN_URL . 'Inc/Framework/media/admin/images/flags/{{FLAG}}.png', |
| 377 |
'langs' => [ |
| 378 |
'CAMPAIGN_INFO' => firebox()->_('FB_CAMPAIGN_INFO'), |
| 379 |
'EDIT_CAMPAIGN' => firebox()->_('FB_EDIT_CAMPAIGN'), |
| 380 |
'STATUS' => fpframework()->_('FPF_STATUS'), |
| 381 |
'CREATED' => fpframework()->_('FPF_CREATED'), |
| 382 |
'LAST_VIEWED' => firebox()->_('FB_LAST_VIEWED'), |
| 383 |
'ACTIVE' => firebox()->_('FB_ACTIVE'), |
| 384 |
'DISABLED' => fpframework()->_('FPF_DISABLED'), |
| 385 |
'ID' => fpframework()->_('FPF_ID'), |
| 386 |
'CAMPAIGN' => firebox()->_('FB_CAMPAIGN'), |
| 387 |
'VIEWS' => firebox()->_('FB_VIEWS'), |
| 388 |
'ACTIONS' => firebox()->_('FB_ACTIONS'), |
| 389 |
'CONVERSIONS' => firebox()->_('FB_CONVERSIONS'), |
| 390 |
'CONVERSION_RATE' => firebox()->_('FB_CONVERSION_RATE'), |
| 391 |
'NO_DATA_AVAILABLE' => firebox()->_('FB_NO_DATA_AVAILABLE'), |
| 392 |
'COUNTRIES' => fpframework()->_('FPF_COUNTRIES'), |
| 393 |
'FLAG' => fpframework()->_('FPF_FLAG'), |
| 394 |
'DEVICES' => fpframework()->_('FPF_DEVICES'), |
| 395 |
'EVENTS' => fpframework()->_('FPF_EVENTS'), |
| 396 |
'PERCENTAGE_DIFFERENCE_AGAINST_PREVIOUS_PERIOD' => firebox()->_('FB_PERCENTAGE_DIFFERENCE_AGAINST_PREVIOUS_PERIOD'), |
| 397 |
'NO_CAMPAIGN_DATA_FOUND' => firebox()->_('FB_NO_CAMPAIGN_DATA_FOUND'), |
| 398 |
'MOST_POPULAR_CAMPAIGNS' => firebox()->_('FB_MOST_POPULAR_CAMPAIGNS'), |
| 399 |
'TOP_CAMPAIGNS' => firebox()->_('FB_TOP_CAMPAIGNS'), |
| 400 |
'N/A' => fpframework()->_('FPF_N/A'), |
| 401 |
'ALL_DAYS' => firebox()->_('FB_ALL_DAYS'), |
| 402 |
'MONDAY' => firebox()->_('FB_MONDAY'), |
| 403 |
'TUESDAY' => firebox()->_('FB_TUESDAY'), |
| 404 |
'WEDNESDAY' => firebox()->_('FB_WEDNESDAY'), |
| 405 |
'THURSDAY' => firebox()->_('FB_THURSDAY'), |
| 406 |
'FRIDAY' => firebox()->_('FB_FRIDAY'), |
| 407 |
'SATURDAY' => firebox()->_('FB_SATURDAY'), |
| 408 |
'SUNDAY' => firebox()->_('FB_SUNDAY'), |
| 409 |
'VIEW_HOURS' => firebox()->_('FB_VIEW_HOURS'), |
| 410 |
'PATHS' => fpframework()->_('FPF_PATHS'), |
| 411 |
'REFERRERS' => fpframework()->_('FPF_REFERRERS'), |
| 412 |
'S' => fpframework()->_('FPF_S'), |
| 413 |
'VIEW_CAMPAIGN_ANALYTICS' => firebox()->_('FB_VIEW_CAMPAIGN_ANALYTICS'), |
| 414 |
'ACTIVATE' => fpframework()->_('FPF_ACTIVATE'), |
| 415 |
'DEACTIVATE' => fpframework()->_('FPF_DEACTIVATE'), |
| 416 |
'EDIT' => fpframework()->_('FPF_EDIT'), |
| 417 |
'DELETE' => fpframework()->_('FPF_DELETE'), |
| 418 |
'DUPLICATE' => fpframework()->_('FPF_DUPLICATE'), |
| 419 |
'ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_CAMPAIGN' => firebox()->_('FB_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_CAMPAIGN'), |
| 420 |
'RECENT_CAMPAIGNS' => firebox()->_('FB_RECENT_CAMPAIGNS'), |
| 421 |
'VIEW_ALL' => firebox()->_('FB_VIEW_ALL'), |
| 422 |
'YOU_HAVENT_CREATED_ANY_CAMPAIGNS_YET' => firebox()->_('FB_YOU_HAVENT_CREATED_ANY_CAMPAIGNS_YET'), |
| 423 |
'NEW_CAMPAIGN' => firebox()->_('FB_NEW_CAMPAIGN'), |
| 424 |
'NUMBER_OF_VIEWS_IN_THE_LAST_30_DAYS' => firebox()->_('FB_NUMBER_OF_VIEWS_IN_THE_LAST_30_DAYS'), |
| 425 |
'NUMBER_OF_CONVERSIONS_IN_THE_LAST_30_DAYS' => firebox()->_('FB_NUMBER_OF_CONVERSIONS_IN_THE_LAST_30_DAYS'), |
| 426 |
'CONVERSION_RATE_IN_THE_LAST_30_DAYS' => firebox()->_('FB_CONVERSION_RATE_IN_THE_LAST_30_DAYS'), |
| 427 |
'LOADING_CAMPAIGNS' => firebox()->_('FB_LOADING_CAMPAIGNS'), |
| 428 |
'NO_CAMPAIGNS_FOUND' => firebox()->_('FB_NO_CAMPAIGNS_FOUND'), |
| 429 |
'SEARCH_DOTS' => firebox()->_('FB_SEARCH_DOTS'), |
| 430 |
'TODAY' => firebox()->_('FB_TODAY'), |
| 431 |
'YESTERDAY' => firebox()->_('FB_YESTERDAY'), |
| 432 |
'LAST_7_DAYS' => firebox()->_('FB_LAST_7_DAYS'), |
| 433 |
'LAST_30_DAYS' => firebox()->_('FB_LAST_30_DAYS'), |
| 434 |
'LAST_WEEK' => firebox()->_('FB_LAST_WEEK'), |
| 435 |
'LAST_MONTH' => firebox()->_('FB_LAST_MONTH'), |
| 436 |
'CUSTOM' => firebox()->_('FB_CUSTOM'), |
| 437 |
'AVG_TIME_OPEN_TOOLTIP_DESC' => firebox()->_('FB_AVG_TIME_OPEN_TOOLTIP_DESC'), |
| 438 |
'READ_MORE' => firebox()->_('FB_READ_MORE'), |
| 439 |
'AVG_TIME_OPEN' => firebox()->_('FB_AVG_TIME_OPEN'), |
| 440 |
'CONVERSION_RATE_TOOLTIP_DESC' => firebox()->_('FB_CONVERSION_RATE_TOOLTIP_DESC'), |
| 441 |
'CONVERSIONS_TOOLTIP_DESC' => firebox()->_('FB_CONVERSIONS_TOOLTIP_DESC'), |
| 442 |
'VS_PREVIOUS_PERIOD' => firebox()->_('FB_VS_PREVIOUS_PERIOD'), |
| 443 |
'VIEWS_TOOLTIP_DESC' => firebox()->_('FB_VIEWS_TOOLTIP_DESC'), |
| 444 |
'NO' => firebox()->_('FB_NO'), |
| 445 |
'DATA_AVAILABLE' => firebox()->_('FB_DATA_AVAILABLE'), |
| 446 |
'PERFORMANCE' => firebox()->_('FB_PERFORMANCE'), |
| 447 |
'TRENDING_TEMPLATES' => firebox()->_('FB_TRENDING_TEMPLATES'), |
| 448 |
'THERE_ARE_NO_TRENDING_TEMPLATES_TO_SHOW' => firebox()->_('FB_THERE_ARE_NO_TRENDING_TEMPLATES_TO_SHOW'), |
| 449 |
'INSERT_TEMPLATE' => firebox()->_('FB_INSERT_TEMPLATE'), |
| 450 |
'INSERT' => firebox()->_('FB_INSERT'), |
| 451 |
'VIEW_ALL_ANALYTICS' => firebox()->_('FB_VIEW_ALL_ANALYTICS'), |
| 452 |
'DAILY' => firebox()->_('FB_DAILY'), |
| 453 |
'WEEKLY' => firebox()->_('FB_WEEKLY'), |
| 454 |
'MONTHLY' => firebox()->_('FB_MONTHLY'), |
| 455 |
'UPGRADE_TO_PRO' => fpframework()->_('FPF_UPGRADE_TO_PRO'), |
| 456 |
'ALL_CAMPAIGNS' => firebox()->_('FB_ALL_CAMPAIGNS'), |
| 457 |
'OVERVIEW' => fpframework()->_('FPF_OVERVIEW'), |
| 458 |
'TO' => fpframework()->_('FPF_TO'), |
| 459 |
'SHOWING_TOP_30_RESULTS' => firebox()->_('FB_SHOWING_TOP_30_RESULTS'), |
| 460 |
'DAY_OF_THE_WEEK' => firebox()->_('FB_DAY_OF_THE_WEEK'), |
| 461 |
'ANALYTICS' => fpframework()->_('FPF_ANALYTICS') |
| 462 |
] |
| 463 |
); |
| 464 |
|
| 465 |
wp_localize_script('firebox-admin', 'fbox_admin_js_object', $data); |
| 466 |
} |
| 467 |
|
| 468 |
/** |
| 469 |
* Returns the timezone in format: +-XX:XX |
| 470 |
* |
| 471 |
* @return string |
| 472 |
*/ |
| 473 |
private function getTimezone() |
| 474 |
{ |
| 475 |
$offset = get_option('gmt_offset'); |
| 476 |
$hours = (int) $offset; |
| 477 |
$minutes = abs(($offset - (int) $offset) * 60); |
| 478 |
return sprintf('%+03d:%02d', $hours, $minutes); |
| 479 |
} |
| 480 |
} |