banner
2 weeks ago
bodies
2 weeks ago
check
2 weeks ago
cli
2 weeks ago
cron
2 weeks ago
dashboard
2 weeks ago
database
2 weeks ago
external
2 weeks ago
extracter
2 weeks ago
htaccess
2 weeks ago
notices
2 weeks ago
progress
2 weeks ago
scanner
2 weeks ago
services
2 weeks ago
staging
2 weeks ago
traits
2 weeks ago
uploader
2 weeks ago
vendor
2 weeks ago
zipper
2 weeks ago
.htaccess
2 weeks ago
activation.php
2 weeks ago
ajax.php
2 weeks ago
ajax_offline.php
2 weeks ago
analyst.php
2 weeks ago
backup-process.php
2 weeks ago
class-backup-method-mananger.php
2 weeks ago
cli-handler.php
2 weeks ago
compatibility.php
2 weeks ago
config.php
2 weeks ago
config_v2.php
2 weeks ago
constants.php
2 weeks ago
file-explorer.php
2 weeks ago
initializer.php
2 weeks ago
logger.php
2 weeks ago
offline.php
2 weeks ago
config.php
65 lines
| 1 | <?php |
| 2 | |
| 3 | // Namespace |
| 4 | namespace BMI\Plugin\Dashboard; |
| 5 | |
| 6 | // Exit on direct access |
| 7 | if (!defined('ABSPATH')) exit; |
| 8 | |
| 9 | if (!function_exists('bmi_config_random_string')) { |
| 10 | function bmi_config_random_string($max = 16) { |
| 11 | $bank = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
| 12 | $bank .= 'abcdefghijklmnopqrstuvwxyz'; |
| 13 | $bank .= '0123456789'; |
| 14 | |
| 15 | $str = str_shuffle($bank); |
| 16 | |
| 17 | while (is_numeric($str[0])) { |
| 18 | $str = str_shuffle($bank); |
| 19 | } |
| 20 | |
| 21 | $str = substr($str, 0, $max); |
| 22 | |
| 23 | return $str; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | require_once __DIR__ . '/config_v2.php'; |
| 28 | |
| 29 | if (!function_exists('bmi_get_config')) { |
| 30 | function bmi_get_config($setting, $configpath = false) { |
| 31 | return BMI_Config_V2::get_instance()->get($setting); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | if (!function_exists('bmi_set_config')) { |
| 36 | function bmi_set_config($setting, $value) { |
| 37 | return BMI_Config_V2::get_instance()->set($setting, $value); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | if (!function_exists('bmi_try_checked')) { |
| 42 | function bmi_try_checked($setting, $reversed = false) { |
| 43 | if (!$reversed) { |
| 44 | if (bmi_get_config($setting) == 'true' || bmi_get_config($setting) === true) { |
| 45 | echo ' checked'; |
| 46 | } else return ''; |
| 47 | } else { |
| 48 | if (bmi_get_config($setting) == 'true' || bmi_get_config($setting) === true) { |
| 49 | return ''; |
| 50 | } else { |
| 51 | echo ' checked'; |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | if (!function_exists('bmi_try_value')) { |
| 58 | function bmi_try_value($setting) { |
| 59 | $res = bmi_get_config($setting); |
| 60 | if ($res !== false) { |
| 61 | echo ' value="' . esc_attr( sanitize_text_field($res) ) . '"'; |
| 62 | } else echo ''; |
| 63 | } |
| 64 | } |
| 65 |