| 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\Forms; |
| 13 |
|
| 14 |
if (!defined('ABSPATH')) |
| 15 |
{ |
| 16 |
exit; // Exit if accessed directly. |
| 17 |
} |
| 18 |
|
| 19 |
class Settings |
| 20 |
{ |
| 21 |
/** |
| 22 |
* All Settings for the FireBox Global Settings Page |
| 23 |
* |
| 24 |
* @return array |
| 25 |
*/ |
| 26 |
public static function getSettings() |
| 27 |
{ |
| 28 |
$settings = [ |
| 29 |
'id' => 'FireBoxSettings', |
| 30 |
'tabs_menu_sticky' => true, |
| 31 |
'mobile_menu' => true, |
| 32 |
'data' => [ |
| 33 |
'general' => self::getGeneralSettings(), |
| 34 |
'advanced' => self::getAdvancedSettings(), |
| 35 |
'geolocation' => self::getGeolocationSettings(), |
| 36 |
'data' => self::getDataSettings(), |
| 37 |
'license_key' => self::getLicenseKeySettings(), |
| 38 |
] |
| 39 |
]; |
| 40 |
|
| 41 |
return apply_filters('firebox/forms/settings/edit', $settings); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Holds the General Settings |
| 46 |
* |
| 47 |
* @retun array |
| 48 |
*/ |
| 49 |
private static function getGeneralSettings() |
| 50 |
{ |
| 51 |
return [ |
| 52 |
'title' => 'FPF_GENERAL', |
| 53 |
'content' => [ |
| 54 |
// Media |
| 55 |
'media' => [ |
| 56 |
'title' => [ |
| 57 |
'title' => 'FPF_MEDIA', |
| 58 |
'description' => firebox()->_('FB_SETTINGS_MEDIA_DESC') |
| 59 |
], |
| 60 |
'fields' => [ |
| 61 |
[ |
| 62 |
'name' => 'loadCSS', |
| 63 |
'type' => 'FPToggle', |
| 64 |
'label' => firebox()->_('FB_SETTINGS_LOAD_CSS'), |
| 65 |
'description' => firebox()->_('FB_SETTINGS_LOAD_CSS_DESC'), |
| 66 |
'checked' => true |
| 67 |
], |
| 68 |
[ |
| 69 |
'name' => 'loadVelocity', |
| 70 |
'type' => 'FPToggle', |
| 71 |
'label' => firebox()->_('FB_SETTINGS_LOAD_VELOCITY'), |
| 72 |
'description' => firebox()->_('FB_SETTINGS_LOAD_VELOCITY_DESC'), |
| 73 |
'checked' => true |
| 74 |
] |
| 75 |
] |
| 76 |
], |
| 77 |
// Other |
| 78 |
'other' => [ |
| 79 |
'title' => [ |
| 80 |
'title' => 'FPF_OTHER', |
| 81 |
'description' => firebox()->_('FB_SETTINGS_OTHER_DESC') |
| 82 |
], |
| 83 |
'fields' => [ |
| 84 |
[ |
| 85 |
'name' => 'show_admin_bar_menu_item', |
| 86 |
'type' => 'FPToggle', |
| 87 |
'label' => firebox()->_('FB_SETTINGS_SHOW_ADMIN_BAR_MENU_ITEM'), |
| 88 |
'description' => firebox()->_('FB_SETTINGS_SHOW_ADMIN_BAR_MENU_ITEM_DESC'), |
| 89 |
'checked' => true |
| 90 |
], |
| 91 |
[ |
| 92 |
'name' => 'showcopyright', |
| 93 |
'type' => 'FPToggle', |
| 94 |
'label' => firebox()->_('FB_SETTINGS_SHOW_COPYRIGHT'), |
| 95 |
'description' => firebox()->_('FB_SETTINGS_SHOW_COPYRIGHT_DESC'), |
| 96 |
'checked' => true |
| 97 |
], |
| 98 |
[ |
| 99 |
'name' => 'debug', |
| 100 |
'type' => 'FPToggle', |
| 101 |
'label' => firebox()->_('FB_SETTINGS_DEBUG'), |
| 102 |
'description' => firebox()->_('FB_SETTINGS_DEBUG_DESC'), |
| 103 |
] |
| 104 |
] |
| 105 |
] |
| 106 |
] |
| 107 |
]; |
| 108 |
} |
| 109 |
|
| 110 |
/** |
| 111 |
* Holds the Advanced settings |
| 112 |
* |
| 113 |
* @return array |
| 114 |
*/ |
| 115 |
private static function getAdvancedSettings() |
| 116 |
{ |
| 117 |
return [ |
| 118 |
'title' => 'FPF_ADVANCED', |
| 119 |
'content' => [ |
| 120 |
// Analytics |
| 121 |
'analytics' => [ |
| 122 |
'title' => [ |
| 123 |
'title' => firebox()->_('FB_SETTINGS_ANALYTICS'), |
| 124 |
'description' => firebox()->_('FB_SETTINGS_ANALYTICS_DESC') |
| 125 |
], |
| 126 |
'fields' => [ |
| 127 |
[ |
| 128 |
'name' => 'statsdays', |
| 129 |
'type' => 'Dropdown', |
| 130 |
'label' => firebox()->_('FB_SETTINGS_STATS_PERIOD'), |
| 131 |
'description' => firebox()->_('FB_SETTINGS_STATS_PERIOD_DESC'), |
| 132 |
'showon' => '[stats]:1', |
| 133 |
'input_class' => ['small'], |
| 134 |
'default' => 730, |
| 135 |
'choices' => [ |
| 136 |
365 => fpframework()->_('FPF_1_YEAR'), |
| 137 |
365 * 2 => fpframework()->_('FPF_2_YEARS'), |
| 138 |
365 * 5 => fpframework()->_('FPF_5_YEARS'), |
| 139 |
365 * 99 => fpframework()->_('FPF_KEEP_FOREVER'), |
| 140 |
] |
| 141 |
] |
| 142 |
] |
| 143 |
], |
| 144 |
// PHP Scripts |
| 145 |
'phpscripts' => [ |
| 146 |
'title' => [ |
| 147 |
'title' => firebox()->_('FB_PHPSCRIPTS'), |
| 148 |
'description' => firebox()->_('FB_PHPSCRIPTS_SETTINGS_DESC') |
| 149 |
], |
| 150 |
'fields' => [ |
| 151 |
|
| 152 |
|
| 153 |
[ |
| 154 |
'type' => 'Pro', |
| 155 |
'plugin' => 'FireBox', |
| 156 |
'feature_label' => firebox()->_('FB_ENABLE_PHPSCRIPTS'), |
| 157 |
] |
| 158 |
|
| 159 |
] |
| 160 |
], |
| 161 |
// Google Analytics |
| 162 |
'google_analytics' => [ |
| 163 |
'title' => [ |
| 164 |
'title' => firebox()->_('FB_SETTINGS_GAT'), |
| 165 |
'description' => firebox()->_('FB_SETTINGS_GAT_DESC') |
| 166 |
], |
| 167 |
'fields' => [ |
| 168 |
|
| 169 |
|
| 170 |
[ |
| 171 |
'type' => 'Pro', |
| 172 |
'plugin' => 'FireBox', |
| 173 |
'feature_label' => firebox()->_('FB_SETTINGS_GAT') |
| 174 |
] |
| 175 |
|
| 176 |
] |
| 177 |
], |
| 178 |
// API Key |
| 179 |
'api' => [ |
| 180 |
'title' => [ |
| 181 |
'title' => firebox()->_('FB_JSON_API'), |
| 182 |
'description' => firebox()->_('FB_JSON_API_DESC') |
| 183 |
], |
| 184 |
'fields' => [ |
| 185 |
|
| 186 |
|
| 187 |
[ |
| 188 |
'type' => 'Pro', |
| 189 |
'plugin' => 'FireBox', |
| 190 |
'feature_label' => firebox()->_('FB_JSON_API') |
| 191 |
] |
| 192 |
|
| 193 |
] |
| 194 |
] |
| 195 |
] |
| 196 |
]; |
| 197 |
} |
| 198 |
|
| 199 |
/** |
| 200 |
* Holds the Geolocation settings |
| 201 |
* |
| 202 |
* @return array |
| 203 |
*/ |
| 204 |
private static function getGeolocationSettings() |
| 205 |
{ |
| 206 |
return [ |
| 207 |
'title' => 'FPF_GEOLOCATION', |
| 208 |
'content' => [ |
| 209 |
// Database |
| 210 |
'database' => [ |
| 211 |
'title' => [ |
| 212 |
'title' => 'FPF_GEOLOCATION_SERVICES', |
| 213 |
'description' => 'FPF_GEOIP_GEOLOCATION_SERVICES_HEADING_DESC' |
| 214 |
], |
| 215 |
'fields' => [ |
| 216 |
|
| 217 |
|
| 218 |
[ |
| 219 |
'type' => 'Pro', |
| 220 |
'plugin' => 'FireBox', |
| 221 |
'feature_label' => 'FPF_GEOLOCATION_SERVICES' |
| 222 |
] |
| 223 |
|
| 224 |
] |
| 225 |
], |
| 226 |
// Lookup IP Address |
| 227 |
'geo_lookup' => [ |
| 228 |
'title' => [ |
| 229 |
'title' => 'FPF_GEOIP_LOOKUP', |
| 230 |
'description' => 'FPF_GEOIP_LOOKUP_DESC' |
| 231 |
], |
| 232 |
'fields' => [ |
| 233 |
|
| 234 |
|
| 235 |
[ |
| 236 |
'type' => 'Pro', |
| 237 |
'plugin' => 'FireBox', |
| 238 |
'feature_label' => 'FPF_GEOIP_LOOKUP' |
| 239 |
] |
| 240 |
|
| 241 |
] |
| 242 |
] |
| 243 |
] |
| 244 |
]; |
| 245 |
} |
| 246 |
|
| 247 |
/** |
| 248 |
* Holds the Data settings |
| 249 |
* |
| 250 |
* @return array |
| 251 |
*/ |
| 252 |
private static function getDataSettings() |
| 253 |
{ |
| 254 |
return [ |
| 255 |
'title' => 'FPF_DATA', |
| 256 |
'content' => [ |
| 257 |
// Uninstall |
| 258 |
'keep_data_on_uninstall' => [ |
| 259 |
'title' => [ |
| 260 |
'title' => 'FPF_UNINSTALL', |
| 261 |
'description' => 'FPF_SETTINGS_UNINSTALL_DESC' |
| 262 |
], |
| 263 |
'fields' => [ |
| 264 |
[ |
| 265 |
'name' => 'keep_data_on_uninstall', |
| 266 |
'type' => 'FPToggle', |
| 267 |
'label' => 'FPF_KEEP_DATA_ON_UNINSTALL', |
| 268 |
'description' => 'FPF_KEEP_DATA_ON_UNINSTALL_DESC', |
| 269 |
'checked' => true |
| 270 |
], |
| 271 |
] |
| 272 |
] |
| 273 |
] |
| 274 |
]; |
| 275 |
} |
| 276 |
|
| 277 |
/** |
| 278 |
* Holds the License Key settings |
| 279 |
* |
| 280 |
* @return array |
| 281 |
*/ |
| 282 |
private static function getLicenseKeySettings() |
| 283 |
{ |
| 284 |
$plugin_name = firebox()->_(firebox()->_('FB_PLUGIN_NAME')); |
| 285 |
|
| 286 |
$status = ''; |
| 287 |
$status_prefix = 'You\'re using ' . $plugin_name . ' ' . ucfirst(FBOX_LICENSE_TYPE) . ' - '; |
| 288 |
$enjoy = fpframework()->_('FPF_ENJOY') . '! <img role="img" class="emoji" alt="🙂" src="https://s.w.org/images/core/emoji/13.0.0/svg/1f642.svg" />'; |
| 289 |
|
| 290 |
|
| 291 |
$status = $status_prefix . fpframework()->_('FPF_NO_LICENSE_NEEDED') . ' ' . $enjoy; |
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
return [ |
| 297 |
'title' => 'FPF_LICENSE_KEY', |
| 298 |
'content' => [ |
| 299 |
// License |
| 300 |
'license_key' => [ |
| 301 |
'title' => [ |
| 302 |
'title' => 'FPF_LICENSE', |
| 303 |
'description' => 'FPF_SETTINGS_LICENSE_DESC' |
| 304 |
], |
| 305 |
'fields' => [ |
| 306 |
|
| 307 |
|
| 308 |
[ |
| 309 |
'type' => 'Pro', |
| 310 |
'plugin' => 'FireBox', |
| 311 |
'feature_label' => 'FPF_ACTIVATE_LICENSE' |
| 312 |
] |
| 313 |
|
| 314 |
] |
| 315 |
] |
| 316 |
] |
| 317 |
]; |
| 318 |
} |
| 319 |
} |