$options_key) { $args = []; if ($configured === 'debug-mode') { $args['sanitize_callback'] = function ($value): int { return (int) filter_var($value, FILTER_VALIDATE_BOOLEAN); }; $args['default'] = 0; } register_setting(config('mahak.settings-group'), $options_key, $args); } add_settings_section( config('mahak.section-id'), config('mahak.translations.section-id'), null, config('mahak.settings-page') ); add_settings_field( config('mahak.options.user-identifier'), config('mahak.translations.user-identifier'), fn () => $this->user_identifier(), config('mahak.settings-page'), config('mahak.section-id') ); add_settings_field( config('mahak.options.jwt-secret'), config('mahak.translations.jwt-secret'), fn () => $this->jwt_secret(), config('mahak.settings-page'), config('mahak.section-id') ); add_settings_field( config('mahak.options.login-route'), config('mahak.translations.login-route'), fn () => $this->login_route(), config('mahak.settings-page'), config('mahak.section-id') ); add_settings_field( config('mahak.options.after-login-route'), config('mahak.translations.after-login-route'), fn () => $this->after_login_route(), config('mahak.settings-page'), config('mahak.section-id') ); add_settings_field( config('mahak.options.debug-mode'), config('mahak.translations.debug-mode'), fn () => $this->debug_mode(), config('mahak.settings-page'), config('mahak.section-id') ); $loginRouteOptionName = config('mahak.options.login-route'); add_filter("pre_update_option_{$loginRouteOptionName}", function ($value) { return trim($value, '/'); }); $afterLoginRouteOptionName = config('mahak.options.after-login-route'); add_filter("pre_update_option_{$afterLoginRouteOptionName}", function ($value) { return trim($value, '/'); }); } public function user_identifier(): void { $name = config('mahak.options.user-identifier'); $value = get_option($name, 'mobile'); $html = ""; echo $html; } public function jwt_secret(): void { $name = config('mahak.options.jwt-secret'); $value = esc_attr(get_option($name, '')); echo ""; } public function login_route(): void { $name = config('mahak.options.login-route'); $value = esc_attr(get_option($name, config('mahak.login_route_default'))); echo '
'; echo ''.home_url('/').''; echo ""; echo '
'; } public function after_login_route(): void { $name = config('mahak.options.after-login-route'); $value = esc_attr(get_option($name, config('mahak.after_login_route_default'))); echo '
'; echo ''.home_url('/').''; echo ""; echo '
'; } public function debug_mode(): void { $name = config('mahak.options.debug-mode'); $enabled = (bool) get_option($name, false); echo ""; echo "'; } }