????JFIF??x?x????'
| Server IP : 172.67.174.47 / Your IP : 216.73.216.145 Web Server : LiteSpeed System : Linux premium151.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : tempvsty ( 647) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /././././proc/self/cwd/wp-content/plugins/wpforms-lite/src/Integrations/AI/Admin/ |
Upload File : |
<?php
namespace WPForms\Integrations\AI\Admin;
use WPForms\Integrations\AI\Helpers;
/**
* AI Settings class.
*
* @since 1.9.1
*/
class Settings {
/**
* Initialize.
*
* @since 1.9.1
*/
public function init() {
$this->hooks();
}
/**
* Register hooks.
*
* @since 1.9.1
*/
private function hooks() {
add_filter( 'wpforms_settings_defaults', [ $this, 'register_settings' ] );
}
/**
* Add toggle to the Settings > Misc admin page.
*
* @since 1.9.1
*
* @param array|mixed $settings WPForms settings.
*
* @return array
*/
public function register_settings( $settings ): array {
$settings = (array) $settings;
$ai_settings = [
'id' => Helpers::DISABLE_KEY,
'name' => esc_html__( 'Hide AI Features', 'wpforms-lite' ),
'desc' => esc_html__( 'Hide everything related to AI in WPForms.', 'wpforms-lite' ),
'type' => 'toggle',
'status' => true,
'value' => Helpers::is_disabled(),
'disabled' => Helpers::is_disabled_by_rule(),
];
if ( $ai_settings['disabled'] ) {
$ai_settings['disabled_desc'] = wp_kses(
__( '<strong>AI features were hidden by filter or constant.</strong>', 'wpforms-lite' ), // phpcs:ignore WordPress.WP.I18n.NoHtmlWrappedStrings
[
'strong' => [],
]
);
}
// Add after the "Hide Admin Bar Menu" toggle.
$settings['misc'] = wpforms_array_insert( $settings['misc'], [ Helpers::DISABLE_KEY => $ai_settings ], 'hide-admin-bar' );
return $settings;
}
}