Commit realizado el 12:13:52 08-04-2024

This commit is contained in:
Pagina Web Monito
2024-04-08 12:13:55 -04:00
commit 0c33094de9
7815 changed files with 1365694 additions and 0 deletions

View File

@@ -0,0 +1,257 @@
<?php
namespace WPForms\Admin\Settings;
use WPForms\Admin\Notice;
use WPForms\Admin\Settings\Captcha\Page;
/**
* CAPTCHA setting page.
*
* @since 1.6.4
* @deprecated 1.8.0
*/
class Captcha {
/**
* Slug identifier for admin page view.
*
* @since 1.6.4
* @deprecated 1.8.0
*
* @var string
*/
const VIEW = 'captcha';
/**
* The hCaptcha javascript URL-resource.
*
* @since 1.6.4
* @deprecated 1.8.0
*/
const HCAPTCHA_API_URL = 'https://hcaptcha.com/1/api.js';
/**
* The reCAPTCHA javascript URL-resource.
*
* @since 1.6.4
* @deprecated 1.8.0
*/
const RECAPTCHA_API_URL = 'https://www.google.com/recaptcha/api.js';
/**
* Saved CAPTCHA settings.
*
* @since 1.6.4
* @deprecated 1.8.0
*
* @var array
*/
private $settings;
/**
* Initialize class.
*
* @since 1.6.4
* @deprecated 1.8.0
*/
public function init() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin', 'WPForms\Admin\Settings\Captcha\Page::init()' );
( new Page() )->init();
}
/**
* Init CAPTCHA settings.
*
* @since 1.6.4
* @deprecated 1.8.0
*/
public function init_settings() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin', 'WPForms\Admin\Settings\Captcha\Page::init_settings()' );
( new Page() )->init_settings();
}
/**
* Hooks.
*
* @since 1.6.4
* @deprecated 1.8.0
*/
public function hooks() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin', 'WPForms\Admin\Settings\Captcha\Page::hooks()' );
( new Page() )->hooks();
}
/**
* Register CAPTCHA settings tab.
*
* @since 1.6.4
* @deprecated 1.8.0
*
* @param array $tabs Admin area tabs list.
*
* @return array
*/
public function register_settings_tabs( $tabs ) {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin', 'WPForms\Admin\Settings\Captcha\Page::register_settings_tabs()' );
return ( new Page() )->register_settings_tabs( $tabs );
}
/**
* Register CAPTCHA settings fields.
*
* @since 1.6.4
* @deprecated 1.8.0
*
* @param array $settings Admin area settings list.
*
* @return array
*/
public function register_settings_fields( $settings ) {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin', 'WPForms\Admin\Settings\Captcha\Page::register_settings_fields()' );
return ( new Page() )->register_settings_fields( $settings );
}
/**
* Re-init CAPTCHA settings when plugin settings were updated.
*
* @since 1.6.4
* @deprecated 1.8.0
*/
public function updated() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin', 'WPForms\Admin\Settings\Captcha\Page::updated()' );
( new Page() )->updated();
}
/**
* Display notice about the CAPTCHA preview.
*
* @since 1.6.4
* @deprecated 1.8.0
*/
protected function notice() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin' );
if (
! wpforms_is_admin_page( 'settings', self::VIEW ) ||
! $this->is_captcha_preview_ready()
) {
return;
}
Notice::info( esc_html__( 'A preview of your CAPTCHA is displayed below. Please view to verify the CAPTCHA settings are correct.', 'wpforms-lite' ) );
}
/**
* Enqueue assets for the CAPTCHA settings page.
*
* @since 1.6.4
* @deprecated 1.8.0
*/
public function enqueues() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin', 'WPForms\Admin\Settings\Captcha\Page::enqueues()' );
( new Page() )->enqueues();
}
/**
* Use the CAPTCHA no-conflict mode.
*
* When enabled in the WPForms settings, forcefully remove all other
* CAPTCHA enqueues to prevent conflicts. Filter can be used to target
* specific pages, etc.
*
* @since 1.6.4
* @deprecated 1.8.0
*/
public function apply_noconflict() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin', 'WPForms\Admin\Settings\Captcha\Page::apply_noconflict()' );
( new Page() )->apply_noconflict();
}
/**
* Check if CAPTCHA config is ready to display a preview.
*
* @since 1.6.4
* @deprecated 1.8.0
*
* @return bool
*/
protected function is_captcha_preview_ready() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin' );
return (
( 'hcaptcha' === $this->settings['provider'] || ( 'recaptcha' === $this->settings['provider'] && 'v2' === $this->settings['recaptcha_type'] ) ) &&
! empty( $this->settings['site_key'] ) &&
! empty( $this->settings['secret_key'] )
);
}
/**
* Retrieve the CAPTCHA provider API URL.
*
* @since 1.6.4
* @deprecated 1.8.0
*
* @return string
*/
protected function get_api_url() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin' );
$api_url = '';
if ( $this->settings['provider'] === 'hcaptcha' ) {
$api_url = self::HCAPTCHA_API_URL;
}
if ( $this->settings['provider'] === 'recaptcha' ) {
$api_url = self::RECAPTCHA_API_URL;
}
if ( ! empty( $api_url ) ) {
$api_url = add_query_arg( $this->get_api_url_query_arg(), $api_url );
}
return apply_filters( 'wpforms_admin_settings_captcha_get_api_url', $api_url, $this->settings );
}
/**
* Retrieve query arguments for the CAPTCHA API URL.
*
* @since 1.6.4
* @deprecated 1.8.0
*
* @return array
*/
protected function get_api_url_query_arg() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin' );
return (array) apply_filters(
'wpforms_admin_settings_captcha_get_api_url_query_arg', // phpcs:ignore WPForms.Comments.PHPDocHooks.RequiredHookDocumentation, WPForms.PHP.ValidateHooks.InvalidHookName
[
'onload' => 'wpformsSettingsCaptchaLoad',
'render' => 'explicit',
],
$this->settings
);
}
}

View File

@@ -0,0 +1,196 @@
<?php
namespace WPForms\Admin\Settings\Captcha;
/**
* Base captcha settings class.
*
* @since 1.8.0
*/
abstract class Captcha {
/**
* Saved CAPTCHA settings.
*
* @since 1.8.0
*
* @var array
*/
protected $settings;
/**
* List of required static properties.
*
* @since 1.8.0
*
* @var array
*/
private $required_static_properties = [
'api_var',
'slug',
'url',
];
/**
* Initialize class.
*
* @since 1.8.0
*/
public function init() {
$this->settings = wp_parse_args( wpforms_get_captcha_settings(), [ 'provider' => 'none' ] );
foreach ( $this->required_static_properties as $property ) {
if ( empty( static::${$property} ) ) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
trigger_error(
sprintf(
'The $%s static property is required for a %s class',
esc_html( $property ),
__CLASS__
),
E_USER_ERROR
);
}
}
}
/**
* Array of captcha settings fields.
*
* @since 1.8.0
*
* @return array[]
*/
abstract public function get_settings_fields();
/**
* Get API request url for the captcha preview.
*
* @since 1.8.0
*
* @return string
*/
public function get_api_url() {
$url = static::$url;
if ( ! empty( $url ) ) {
$url = add_query_arg( $this->get_api_url_query_arg(), $url );
}
/**
* Filter API URL.
*
* @since 1.6.4
*
* @param string $url API URL.
* @param array $settings Captcha settings array.
*/
return apply_filters( 'wpforms_admin_settings_captcha_get_api_url', $url, $this->settings );
}
/**
* Enqueue assets for the CAPTCHA settings page.
*
* @since 1.8.0
*/
public function enqueues() {
/**
* Allow/disallow to enquire captcha settings.
*
* @since 1.6.4
*
* @param boolean $allow True/false. Default: false.
*/
$disable_enqueues = apply_filters( 'wpforms_admin_settings_captcha_enqueues_disable', false );
if ( $disable_enqueues || ! $this->is_captcha_preview_ready() ) {
return;
}
$api_url = $this->get_api_url();
$provider_name = $this->settings['provider'];
$handle = "wpforms-settings-{$provider_name}";
wp_enqueue_script( $handle, $api_url, [ 'jquery' ], null, true );
wp_add_inline_script( $handle, $this->get_inline_script() );
}
/**
* Inline script for initialize captcha JS code.
*
* @since 1.8.0
*
* @return string
*/
protected function get_inline_script() {
return /** @lang JavaScript */
'var wpformsSettingsCaptchaLoad = function() {
jQuery( ".wpforms-captcha" ).each( function( index, el ) {
var widgetID = ' . static::$api_var . '.render( el );
jQuery( el ).attr( "data-captcha-id", widgetID );
} );
jQuery( document ).trigger( "wpformsSettingsCaptchaLoaded" );
};';
}
/**
* Check if CAPTCHA config is ready to display a preview.
*
* @since 1.8.0
*
* @return bool
*/
public function is_captcha_preview_ready() {
return (
( $this->settings['provider'] === static::$slug || ( $this->settings['provider'] === 'recaptcha' && $this->settings['recaptcha_type'] === 'v2' ) ) &&
! empty( $this->settings['site_key'] ) &&
! empty( $this->settings['secret_key'] )
);
}
/**
* Retrieve query arguments for the CAPTCHA API URL.
*
* @since 1.8.0
*
* @return array
*/
protected function get_api_url_query_arg() {
/**
* Modify captcha api url parameters.
*
* @since 1.8.0
*
* @param array $params Array of parameters.
* @param array $params Saved CAPTCHA settings.
*/
return (array) apply_filters(
'wpforms_admin_settings_captcha_get_api_url_query_arg',
[
'onload' => 'wpformsSettingsCaptchaLoad',
'render' => 'explicit',
],
$this->settings
);
}
/**
* Heading description.
*
* @since 1.8.0
*
* @return string
*/
public function get_field_desc() {
$content = wpforms_render( 'admin/settings/' . static::$slug . '-description' );
return wpforms_render( 'admin/settings/specific-note', [ 'content' => $content ], true );
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace WPForms\Admin\Settings\Captcha;
/**
* HCaptcha settings class.
*
* @since 1.8.0
*/
class HCaptcha extends Captcha {
/**
* Captcha variable used for JS invoking.
*
* @since 1.8.0
*
* @var string
*/
protected static $api_var = 'hcaptcha';
/**
* Get captcha key name.
*
* @since 1.8.0
*
* @var string
*/
protected static $slug = 'hcaptcha';
/**
* The hCaptcha Javascript URL-resource.
*
* @since 1.8.0
*
* @var string
*/
protected static $url = 'https://hcaptcha.com/1/api.js';
/**
* Array of captcha settings fields.
*
* @since 1.8.0
*
* @return array[]
*/
public function get_settings_fields() {
return [
'hcaptcha-heading' => [
'id' => 'hcaptcha-heading',
'content' => $this->get_field_desc(),
'type' => 'content',
'no_label' => true,
'class' => [ 'section-heading', 'specific-note' ],
],
'hcaptcha-site-key' => [
'id' => 'hcaptcha-site-key',
'name' => esc_html__( 'Site Key', 'wpforms-lite' ),
'type' => 'text',
],
'hcaptcha-secret-key' => [
'id' => 'hcaptcha-secret-key',
'name' => esc_html__( 'Secret Key', 'wpforms-lite' ),
'type' => 'text',
],
'hcaptcha-fail-msg' => [
'id' => 'hcaptcha-fail-msg',
'name' => esc_html__( 'Fail Message', 'wpforms-lite' ),
'desc' => esc_html__( 'Displays to users who fail the verification process.', 'wpforms-lite' ),
'type' => 'text',
'default' => esc_html__( 'hCaptcha verification failed, please try again later.', 'wpforms-lite' ),
],
];
}
}

View File

@@ -0,0 +1,372 @@
<?php
namespace WPForms\Admin\Settings\Captcha;
use WPForms\Admin\Notice;
/**
* CAPTCHA setting page.
*
* @since 1.8.0
*/
class Page {
/**
* Slug identifier for admin page view.
*
* @since 1.8.0
*
* @var string
*/
const VIEW = 'captcha';
/**
* Saved CAPTCHA settings.
*
* @since 1.8.0
*
* @var array
*/
private $settings;
/**
* All available captcha types.
*
* @since 1.8.0
*
* @var array
*/
private $captchas;
/**
* Initialize class.
*
* @since 1.8.0
*/
public function init() {
// Only load if we are actually on the settings page.
if ( ! wpforms_is_admin_page( 'settings' ) ) {
return;
}
// Listen the previous reCAPTCHA page and safely redirect from it.
if ( wpforms_is_admin_page( 'settings', 'recaptcha' ) ) {
wp_safe_redirect( add_query_arg( 'view', self::VIEW, admin_url( 'admin.php?page=wpforms-settings' ) ) );
exit;
}
$this->init_settings();
$this->hooks();
}
/**
* Init CAPTCHA settings.
*
* @since 1.8.0
*/
public function init_settings() {
$this->settings = wp_parse_args( wpforms_get_captcha_settings(), [ 'provider' => 'none' ] );
/**
* Filter available captcha for the settings page.
*
* @since 1.8.0
*
* @param array $captcha Array where key is captcha name and value is captcha class instance.
* @param array $settings Array of settings.
*/
$this->captchas = apply_filters(
'wpforms_admin_settings_captcha_page_init_settings_available_captcha',
[
'hcaptcha' => new HCaptcha(),
'recaptcha' => new ReCaptcha(),
'turnstile' => new Turnstile(),
],
$this->settings
);
foreach ( $this->captchas as $captcha ) {
$captcha->init();
}
}
/**
* Hooks.
*
* @since 1.8.0
*/
public function hooks() {
add_filter( 'wpforms_settings_tabs', [ $this, 'register_settings_tabs' ], 5, 1 );
add_filter( 'wpforms_settings_defaults', [ $this, 'register_settings_fields' ], 5, 1 );
add_action( 'wpforms_settings_updated', [ $this, 'updated' ] );
add_action( 'wpforms_settings_enqueue', [ $this, 'enqueues' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'apply_noconflict' ], 9999 );
}
/**
* Register CAPTCHA settings tab.
*
* @since 1.8.0
*
* @param array $tabs Admin area tabs list.
*
* @return array
*/
public function register_settings_tabs( $tabs ) {
$captcha = [
self::VIEW => [
'name' => esc_html__( 'CAPTCHA', 'wpforms-lite' ),
'form' => true,
'submit' => esc_html__( 'Save Settings', 'wpforms-lite' ),
],
];
return wpforms_array_insert( $tabs, $captcha, 'email' );
}
/**
* Register CAPTCHA settings fields.
*
* @since 1.8.0
*
* @param array $settings Admin area settings list.
*
* @return array
*/
public function register_settings_fields( $settings ) {
$settings[ self::VIEW ] = [
self::VIEW . '-heading' => [
'id' => self::VIEW . '-heading',
'content' => '<h4>' . esc_html__( 'CAPTCHA', 'wpforms-lite' ) . '</h4><p>' . esc_html__( 'A CAPTCHA is an anti-spam technique which helps to protect your website from spam and abuse while letting real people pass through with ease.', 'wpforms-lite' ) . '</p>',
'type' => 'content',
'no_label' => true,
'class' => [ 'wpforms-setting-captcha-heading', 'section-heading' ],
],
self::VIEW . '-provider' => [
'id' => self::VIEW . '-provider',
'type' => 'radio',
'default' => 'none',
'options' => [
'hcaptcha' => 'hCaptcha',
'recaptcha' => 'reCAPTCHA',
'turnstile' => 'Turnstile',
'none' => esc_html__( 'None', 'wpforms-lite' ),
],
'desc' => sprintf(
wp_kses( /* translators: %s - WPForms.com CAPTCHA comparison page URL. */
__( 'Not sure which service is right for you? <a href="%s" target="_blank" rel="noopener noreferrer">Check out our comparison</a> for more details.', 'wpforms-lite' ),
[
'a' => [
'href' => [],
'target' => [],
'rel' => [],
],
]
),
esc_url( wpforms_utm_link( 'https://wpforms.com/docs/setup-captcha-wpforms/', 'Settings - Captcha', 'Captcha Comparison Documentation' ) )
),
],
];
// Add settings fields for each of available captcha types.
foreach ( $this->captchas as $captcha ) {
$settings[ self::VIEW ] = array_merge( $settings[ self::VIEW ], $captcha->get_settings_fields() );
}
$settings[ self::VIEW ] = array_merge(
$settings[ self::VIEW ],
[
'recaptcha-noconflict' => [
'id' => 'recaptcha-noconflict',
'name' => esc_html__( 'No-Conflict Mode', 'wpforms-lite' ),
'desc' => esc_html__( 'Forcefully remove other CAPTCHA occurrences in order to prevent conflicts. Only enable this option if your site is having compatibility issues or instructed by support.', 'wpforms-lite' ),
'type' => 'toggle',
'status' => true,
],
self::VIEW . '-preview' =>
[
'id' => self::VIEW . '-preview',
'name' => esc_html__( 'Preview', 'wpforms-lite' ),
'content' => '<p class="desc wpforms-captcha-preview-desc">' . esc_html__( 'Please save settings to generate a preview of your CAPTCHA here.', 'wpforms-lite' ) . '</p>',
'type' => 'content',
'class' => [ 'wpforms-hidden' ],
],
]
);
if (
$this->settings['provider'] === 'hcaptcha' ||
$this->settings['provider'] === 'turnstile' ||
( $this->settings['provider'] === 'recaptcha' && $this->settings['recaptcha_type'] === 'v2' )
) {
// phpcs:disable WPForms.PHP.ValidateHooks.InvalidHookName
/**
* Modify captcha settings data.
*
* @since 1.6.4
*
* @param array $data Array of settings.
*/
$data = apply_filters(
'wpforms_admin_pages_settings_captcha_data',
[
'sitekey' => $this->settings['site_key'],
'theme' => $this->settings['theme'],
]
);
// phpcs:enable WPForms.PHP.ValidateHooks.InvalidHookName
// Prepare HTML for CAPTCHA preview.
$placeholder_description = $settings[ self::VIEW ][ self::VIEW . '-preview' ]['content'];
$captcha_description = esc_html__( 'This CAPTCHA is generated using your site and secret keys. If an error is displayed, please double-check your keys.', 'wpforms-lite' );
$captcha_preview = sprintf(
'<div class="wpforms-captcha-container" style="pointer-events:none!important;cursor:default!important;">
<div %s></div>
<input type="text" name="wpforms-captcha-hidden" class="wpforms-recaptcha-hidden" style="position:absolute!important;clip:rect(0,0,0,0)!important;height:1px!important;width:1px!important;border:0!important;overflow:hidden!important;padding:0!important;margin:0!important;">
</div>',
wpforms_html_attributes( '', [ 'wpforms-captcha', 'wpforms-captcha-' . $this->settings['provider'] ], $data )
);
$settings[ self::VIEW ][ self::VIEW . '-preview' ]['content'] = sprintf(
'<div class="wpforms-captcha-preview">
%1$s <p class="desc">%2$s</p>
</div>
<div class="wpforms-captcha-placeholder wpforms-hidden">%3$s</div>',
$captcha_preview,
$captcha_description,
$placeholder_description
);
$settings[ self::VIEW ][ self::VIEW . '-preview' ]['class'] = [];
}
return $settings;
}
/**
* Re-init CAPTCHA settings when plugin settings were updated.
*
* @since 1.8.0
*/
public function updated() {
$this->init_settings();
$this->notice();
}
/**
* Display notice about the CAPTCHA preview.
*
* @since 1.8.0
*/
private function notice() {
if ( ! wpforms_is_admin_page( 'settings', self::VIEW ) || ! $this->is_captcha_preview_ready() ) {
return;
}
Notice::info( esc_html__( 'A preview of your CAPTCHA is displayed below. Please view to verify the CAPTCHA settings are correct.', 'wpforms-lite' ) );
}
/**
* Check if CAPTCHA config is ready to display a preview.
*
* @since 1.8.0
*
* @return bool
*/
private function is_captcha_preview_ready() {
$current_captcha = $this->get_current_captcha();
if ( ! $current_captcha ) {
return false;
}
return $current_captcha->is_captcha_preview_ready();
}
/**
* Enqueue assets for the CAPTCHA settings page.
*
* @since 1.8.0
*/
public function enqueues() {
$current_captcha = $this->get_current_captcha();
if ( ! $current_captcha ) {
return;
}
$current_captcha->enqueues();
}
/**
* Get current active captcha object.
*
* @since 1.8.0
*
* @return object|string
*/
private function get_current_captcha() {
return ! empty( $this->captchas[ $this->settings['provider'] ] ) ? $this->captchas[ $this->settings['provider'] ] : '';
}
/**
* Use the CAPTCHA no-conflict mode.
*
* When enabled in the WPForms settings, forcefully remove all other
* CAPTCHA enqueues to prevent conflicts. Filter can be used to target
* specific pages, etc.
*
* @since 1.6.4
*/
public function apply_noconflict() {
if (
! wpforms_is_admin_page( 'settings', self::VIEW ) ||
empty( wpforms_setting( 'recaptcha-noconflict' ) ) ||
/**
* Allow/disallow applying non-conflict mode for captcha scripts.
*
* @since 1.6.4
*
* @param boolean $allow True/false. Default: true.
*/
! apply_filters( 'wpforms_admin_settings_captcha_apply_noconflict', true ) // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
) {
return;
}
$scripts = wp_scripts();
$urls = [ 'google.com/recaptcha', 'gstatic.com/recaptcha', 'hcaptcha.com/1', 'challenges.cloudflare.com/turnstile' ];
foreach ( $scripts->queue as $handle ) {
// Skip the WPForms JavaScript assets.
if (
! isset( $scripts->registered[ $handle ] ) ||
false !== strpos( $scripts->registered[ $handle ]->handle, 'wpforms' )
) {
return;
}
foreach ( $urls as $url ) {
if ( false !== strpos( $scripts->registered[ $handle ]->src, $url ) ) {
wp_dequeue_script( $handle );
wp_deregister_script( $handle );
break;
}
}
}
}
}

View File

@@ -0,0 +1,100 @@
<?php
namespace WPForms\Admin\Settings\Captcha;
/**
* ReCaptcha settings class.
*
* @since 1.8.0
*/
class ReCaptcha extends Captcha {
/**
* Captcha variable used for JS invoking.
*
* @since 1.8.0
*
* @var string
*/
protected static $api_var = 'grecaptcha';
/**
* Get captcha key name.
*
* @since 1.8.0
*
* @var string
*/
protected static $slug = 'recaptcha';
/**
* The ReCAPTCHA Javascript URL-resource.
*
* @since 1.8.0
*
* @var string
*/
protected static $url = 'https://www.google.com/recaptcha/api.js';
/**
* Array of captcha settings fields.
*
* @since 1.8.0
*
* @return array[]
*/
public function get_settings_fields() {
return [
'recaptcha-heading' => [
'id' => 'recaptcha-heading',
'content' => $this->get_field_desc(),
'type' => 'content',
'no_label' => true,
'class' => [ 'wpforms-setting-recaptcha', 'section-heading', 'specific-note' ],
],
'recaptcha-type' => [
'id' => 'recaptcha-type',
'name' => esc_html__( 'Type', 'wpforms-lite' ),
'type' => 'radio',
'default' => 'v2',
'options' => [
'v2' => esc_html__( 'Checkbox reCAPTCHA v2', 'wpforms-lite' ),
'invisible' => esc_html__( 'Invisible reCAPTCHA v2', 'wpforms-lite' ),
'v3' => esc_html__( 'reCAPTCHA v3', 'wpforms-lite' ),
],
'class' => [ 'wpforms-setting-recaptcha' ],
],
'recaptcha-site-key' => [
'id' => 'recaptcha-site-key',
'name' => esc_html__( 'Site Key', 'wpforms-lite' ),
'type' => 'text',
],
'recaptcha-secret-key' => [
'id' => 'recaptcha-secret-key',
'name' => esc_html__( 'Secret Key', 'wpforms-lite' ),
'type' => 'text',
],
'recaptcha-fail-msg' => [
'id' => 'recaptcha-fail-msg',
'name' => esc_html__( 'Fail Message', 'wpforms-lite' ),
'desc' => esc_html__( 'Displays to users who fail the verification process.', 'wpforms-lite' ),
'type' => 'text',
'default' => esc_html__( 'Google reCAPTCHA verification failed, please try again later.', 'wpforms-lite' ),
],
'recaptcha-v3-threshold' => [
'id' => 'recaptcha-v3-threshold',
'name' => esc_html__( 'Score Threshold', 'wpforms-lite' ),
'desc' => esc_html__( 'reCAPTCHA v3 returns a score (1.0 is very likely a good interaction, 0.0 is very likely a bot). If the score less than or equal to this threshold, the form submission will be blocked and the message above will be displayed.', 'wpforms-lite' ),
'type' => 'number',
'attr' => [
'step' => '0.1',
'min' => '0.0',
'max' => '1.0',
],
'default' => esc_html__( '0.4', 'wpforms-lite' ),
'class' => $this->settings['provider'] === 'recaptcha' && $this->settings['recaptcha_type'] === 'v3' ? [ 'wpforms-setting-recaptcha' ] : [ 'wpforms-setting-recaptcha', 'wpforms-hidden' ],
],
];
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace WPForms\Admin\Settings\Captcha;
/**
* Cloudflare Turnstile settings class.
*
* @since 1.8.0
*/
class Turnstile extends Captcha {
/**
* Captcha variable used for JS invoking.
*
* @since 1.8.0
*
* @var string
*/
protected static $api_var = 'turnstile';
/**
* Captcha key name.
*
* @since 1.8.0
*
* @var string
*/
protected static $slug = 'turnstile';
/**
* The Turnstile Javascript URL-resource.
*
* @since 1.8.0
*
* @var string
*/
protected static $url = 'https://challenges.cloudflare.com/turnstile/v0/api.js';
/**
* Inline script for captcha initialization JS code.
*
* @since 1.8.0
*
* @return string
*/
protected function get_inline_script() {
return /** @lang JavaScript */
'const wpformsCaptcha = jQuery( ".wpforms-captcha" );
if ( wpformsCaptcha.length > 0 ) {
var widgetID = ' . static::$api_var . '.render( ".wpforms-captcha", {
"refresh-expired": "auto"
} );
wpformsCaptcha.attr( "data-captcha-id", widgetID);
jQuery( document ).trigger( "wpformsSettingsCaptchaLoaded" );
}';
}
/**
* Array of captcha settings fields.
*
* @since 1.8.0
*
* @return array[]
*/
public function get_settings_fields() {
return [
'turnstile-heading' => [
'id' => 'turnstile-heading',
'content' => $this->get_field_desc(),
'type' => 'content',
'no_label' => true,
'class' => [ 'section-heading', 'specific-note' ],
],
'turnstile-site-key' => [
'id' => 'turnstile-site-key',
'name' => esc_html__( 'Site Key', 'wpforms-lite' ),
'type' => 'text',
],
'turnstile-secret-key' => [
'id' => 'turnstile-secret-key',
'name' => esc_html__( 'Secret Key', 'wpforms-lite' ),
'type' => 'text',
],
'turnstile-fail-msg' => [
'id' => 'turnstile-fail-msg',
'name' => esc_html__( 'Fail Message', 'wpforms-lite' ),
'desc' => esc_html__( 'Displays to users who fail the verification process.', 'wpforms-lite' ),
'type' => 'text',
'default' => esc_html__( 'Cloudflare Turnstile verification failed, please try again later.', 'wpforms-lite' ),
],
'turnstile-theme' => [
'id' => 'turnstile-theme',
'name' => esc_html__( 'Type', 'wpforms-lite' ),
'type' => 'select',
'default' => 'auto',
'options' => [
'auto' => esc_html__( 'Auto', 'wpforms-lite' ),
'light' => esc_html__( 'Light', 'wpforms-lite' ),
'dark' => esc_html__( 'Dark', 'wpforms-lite' ),
],
],
];
}
}

View File

@@ -0,0 +1,487 @@
<?php
namespace WPForms\Admin\Settings;
use WPForms\Emails\Helpers;
use WPForms\Emails\Notifications;
use WPForms\Admin\Education\Helpers as EducationHelpers;
/**
* Email setting page.
* Settings will be accessible via “WPForms” → “Settings” → “Email”.
*
* @since 1.8.5
*/
class Email {
/**
* Content is plain text type.
*
* @since 1.8.5
*
* @var bool
*/
private $plain_text;
/**
* Initialize class.
*
* @since 1.8.5
*/
public function init() {
$this->hooks();
}
/**
* Hooks.
*
* @since 1.8.5
*/
private function hooks() {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
add_filter( 'wpforms_update_settings', [ $this, 'maybe_update_settings' ] );
add_filter( 'wpforms_settings_tabs', [ $this, 'register_settings_tabs' ], 5 );
add_filter( 'wpforms_settings_defaults', [ $this, 'register_settings_fields' ], 5 );
}
/**
* Enqueue scripts and styles.
* Static resources are enqueued only on the "Email" settings page.
*
* @since 1.8.5
*/
public function enqueue_assets() {
// Leave if the current page is not the "Email" settings page.
if ( ! $this->is_settings_page() ) {
return;
}
$min = wpforms_get_min_suffix();
wp_enqueue_script(
'wpforms-admin-email-settings',
WPFORMS_PLUGIN_URL . "assets/js/components/admin/email/settings{$min}.js",
[ 'jquery', 'wpforms-admin', 'choicesjs' ],
WPFORMS_VERSION,
true
);
}
/**
* Maybe update settings.
*
* @since 1.8.5
*
* @param array $settings Admin area settings list.
*
* @return array
*/
public function maybe_update_settings( $settings ) {
// Leave if the current page is not the "Email" settings page.
if ( ! $this->is_settings_page() ) {
return $settings;
}
// Backup the Pro version background color setting to the free version.
// This is needed to keep the background color when the Pro version is deactivated.
if ( wpforms()->is_pro() && ! Helpers::is_legacy_html_template() ) {
$settings['email-background-color'] = sanitize_hex_color( $settings['email-color-scheme']['email_background_color'] );
return $settings;
}
// Backup the free version background color setting to the Pro version.
// This is needed to keep the background color when the Pro version is activated.
$settings['email-color-scheme']['email_background_color'] = sanitize_hex_color( $settings['email-background-color'] );
return $settings;
}
/**
* Register "Email" settings tab.
*
* @since 1.8.5
*
* @param array $tabs Admin area tabs list.
*
* @return array
*/
public function register_settings_tabs( $tabs ) {
$payments = [
'email' => [
'form' => true,
'name' => esc_html__( 'Email', 'wpforms-lite' ),
'submit' => esc_html__( 'Save Settings', 'wpforms-lite' ),
],
];
return wpforms_array_insert( $tabs, $payments, 'general' );
}
/**
* Register "Email" settings fields.
*
* @since 1.8.5
*
* @param array $settings Admin area settings list.
*
* @return array
*/
public function register_settings_fields( $settings ) {
$education_args = [ 'action' => 'upgrade' ];
$has_eduction = ! wpforms()->is_pro() ? 'education-modal' : '';
$style_overrides = Helpers::get_current_template_style_overrides();
$preview_link = $this->get_current_template_preview_link();
$this->plain_text = Helpers::is_plain_text_template();
$has_legacy = Helpers::is_legacy_html_template() ? 'legacy-template' : '';
// After initializing the color picker, the helper icon from 1Password and LastPass appears inside the input field.
// These data attributes disable the extension form from appearing.
$color_scheme_data = [
'1p-ignore' => 'true', // 1Password ignore.
'lp-ignore' => 'true', // LastPass ignore.
];
// Add Email settings.
$settings['email'] = [
'email-heading' => [
'id' => 'email-heading',
'content' => $this->get_heading_content(),
'type' => 'content',
'no_label' => true,
'class' => [ 'section-heading', 'no-desc' ],
],
'email-template' => [
'id' => 'email-template',
'name' => esc_html__( 'Template', 'wpforms-lite' ),
'class' => [ 'wpforms-email-template', 'wpforms-card-image-group' ],
'type' => 'email_template',
'default' => Notifications::DEFAULT_TEMPLATE,
'options' => Helpers::get_email_template_choices(),
'value' => Helpers::get_current_template_name(),
],
'email-header-image' => [
'id' => 'email-header-image',
'name' => esc_html__( 'Header Image', 'wpforms-lite' ),
'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of email notifications.', 'wpforms-lite' ),
'class' => [ 'wpforms-email-header-image', 'hide-for-template-none', $this->get_external_header_image_class() ],
'type' => 'image',
'is_hidden' => $this->plain_text,
'show_remove' => true,
],
'email-header-image-size' => [
'id' => 'email-header-image-size',
'no_label' => true,
'type' => 'select',
'class' => 'wpforms-email-header-image-size',
'is_hidden' => true,
'choicesjs' => false,
'default' => 'medium',
'options' => [
'small' => esc_html__( 'Small', 'wpforms-lite' ),
'medium' => esc_html__( 'Medium', 'wpforms-lite' ),
'large' => esc_html__( 'Large', 'wpforms-lite' ),
],
],
'email-color-scheme' => [
'id' => 'email-color-scheme',
'name' => esc_html__( 'Color Scheme', 'wpforms-lite' ),
'class' => [ 'hide-for-template-none', $has_eduction, $has_legacy ],
'type' => 'color_scheme',
'is_hidden' => $this->plain_text,
'education_badge' => $has_eduction ? EducationHelpers::get_badge( 'Pro' ) : '',
'data_attributes' => $has_eduction ? array_merge( [ 'name' => esc_html__( 'Color Scheme', 'wpforms-lite' ) ], $education_args ) : [],
'colors' => [
'email_background_color' => [
'name' => esc_html__( 'Background', 'wpforms-lite' ),
'data' => array_merge(
[
'fallback-color' => $style_overrides['email_background_color'],
],
$color_scheme_data
),
],
'email_body_color' => [
'name' => esc_html__( 'Body', 'wpforms-lite' ),
'data' => array_merge(
[
'fallback-color' => $style_overrides['email_body_color'],
],
$color_scheme_data
),
],
'email_text_color' => [
'name' => esc_html__( 'Text', 'wpforms-lite' ),
'data' => array_merge(
[
'fallback-color' => $style_overrides['email_text_color'],
],
$color_scheme_data
),
],
'email_links_color' => [
'name' => esc_html__( 'Links', 'wpforms-lite' ),
'data' => array_merge(
[
'fallback-color' => $style_overrides['email_links_color'],
],
$color_scheme_data
),
],
],
],
'email-typography' => [
'id' => 'email-typography',
'name' => esc_html__( 'Typography', 'wpforms-lite' ),
'desc' => esc_html__( 'Choose the style thats applied to all text in email notifications.', 'wpforms-lite' ),
'class' => [ 'hide-for-template-none', $has_eduction, $has_legacy ],
'education_badge' => $has_eduction ? EducationHelpers::get_badge( 'Pro' ) : '',
'data_attributes' => $has_eduction ? array_merge( [ 'name' => esc_html__( 'Typography', 'wpforms-lite' ) ], $education_args ) : [],
'type' => 'select',
'is_hidden' => $this->plain_text,
'choicesjs' => true,
'default' => 'sans-serif',
'options' => [
'sans-serif' => esc_html__( 'Sans Serif', 'wpforms-lite' ),
'serif' => esc_html__( 'Serif', 'wpforms-lite' ),
],
],
'email-preview' => [
'id' => 'email-preview',
'type' => 'content',
'is_hidden' => empty( $preview_link ),
'content' => $preview_link,
],
'sending-heading' => [
'id' => 'sending-heading',
'content' => '<h4>' . esc_html__( 'Sending', 'wpforms-lite' ) . '</h4>',
'type' => 'content',
'no_label' => true,
'class' => [ 'section-heading', 'no-desc' ],
],
'email-async' => [
'id' => 'email-async',
'name' => esc_html__( 'Optimize Email Sending', 'wpforms-lite' ),
'desc' => sprintf(
wp_kses( /* translators: %1$s - WPForms.com Email settings documentation URL. */
__( 'Send emails asynchronously, which can make processing faster but may delay email delivery by a minute or two. <a href="%1$s" target="_blank" rel="noopener noreferrer" class="wpforms-learn-more">Learn More</a>', 'wpforms-lite' ),
[
'a' => [
'href' => [],
'target' => [],
'rel' => [],
'class' => [],
],
]
),
esc_url( wpforms_utm_link( 'https://wpforms.com/docs/a-complete-guide-to-wpforms-settings/#email', 'Settings - Email', 'Optimize Email Sending Documentation' ) )
),
'type' => 'toggle',
'status' => true,
],
'email-carbon-copy' => [
'id' => 'email-carbon-copy',
'name' => esc_html__( 'Carbon Copy', 'wpforms-lite' ),
'desc' => esc_html__( 'Enable the ability to CC: email addresses in the form notification settings.', 'wpforms-lite' ),
'type' => 'toggle',
'status' => true,
],
];
// Add background color control if the Pro version is not active or Legacy template is selected.
$settings['email'] = $this->maybe_add_background_color_control( $settings['email'], $style_overrides['email_background_color'] );
// Maybe add the Legacy template notice.
$settings['email'] = $this->maybe_add_legacy_notice( $settings['email'] );
return $settings;
}
/**
* Maybe add the legacy template notice.
*
* @since 1.8.5
*
* @param array $settings Email settings.
*
* @return array
*/
private function maybe_add_legacy_notice( $settings ) {
if ( ! $this->is_settings_page() || ! Helpers::is_legacy_html_template() ) {
return $settings;
}
$content = '<div class="notice-info"><p>';
$content .= sprintf(
wp_kses( /* translators: %1$s - WPForms.com Email settings legacy template documentation URL. */
__( 'Some style settings are not available when using the Legacy template. <a href="%1$s" target="_blank" rel="noopener noreferrer">Learn More</a>', 'wpforms-lite' ),
[
'a' => [
'href' => [],
'target' => [],
'rel' => [],
],
]
),
esc_url( wpforms_utm_link( 'https://wpforms.com/docs/customizing-form-notification-emails/#legacy-template', 'Settings - Email', 'Legacy Template' ) )
);
$content .= '</p></div>';
// Add the background color control after the header image.
return wpforms_array_insert(
$settings,
[
'email-legacy-notice' => [
'id' => 'email-legacy-notice',
'content' => $content,
'type' => 'content',
'class' => 'wpforms-email-legacy-notice',
],
],
'email-template'
);
}
/**
* Get Email settings heading content.
*
* @since 1.8.5
*
* @return string
*/
private function get_heading_content() {
return wpforms_render( 'admin/settings/email-heading' );
}
/**
* Get current email template hyperlink.
*
* @since 1.8.5
*
* @return string
*/
private function get_current_template_preview_link() {
// Leave if the user has the legacy template is set or the user doesn't have the capability.
if ( ! wpforms_current_user_can() || Helpers::is_legacy_html_template() ) {
return '';
}
$template_name = Helpers::get_current_template_name();
$current_template = Notifications::get_available_templates( $template_name );
// Return empty string if the current template is not found.
// Leave early if the preview link is empty.
if ( ! isset( $current_template['path'] ) || ! class_exists( $current_template['path'] ) || empty( $current_template['preview'] ) ) {
return '';
}
return sprintf(
wp_kses( /* translators: %1$s - Email template preview URL. */
__( '<a href="%1$s" target="_blank" rel="noopener">Preview Email Template</a>', 'wpforms-lite' ),
[
'a' => [
'href' => true,
'target' => true,
'rel' => true,
],
]
),
esc_url( $current_template['preview'] )
);
}
/**
* Maybe add the background color control to the email settings.
* This is only available in the free version.
*
* @since 1.8.5
*
* @param array $settings Email settings.
* @param string $fallback_color Fallback color.
*
* @return array
*/
private function maybe_add_background_color_control( $settings, $fallback_color = '#e9eaec' ) {
// Leave as is if the Pro version is active and no legacy template available.
if ( ! Helpers::is_legacy_html_template() && wpforms()->is_pro() ) {
return $settings;
}
// Add the background color control after the header image.
return wpforms_array_insert(
$settings,
[
'email-background-color' => [
'id' => 'email-background-color',
'name' => esc_html__( 'Background Color', 'wpforms-lite' ),
'desc' => esc_html__( 'Customize the background color of the email template.', 'wpforms-lite' ),
'class' => 'email-background-color',
'type' => 'color',
'is_hidden' => $this->plain_text,
'default' => '#e9eaec',
'data' => [
'fallback-color' => $fallback_color,
'1p-ignore' => 'true', // 1Password ignore.
'lp-ignore' => 'true', // LastPass ignore.
],
],
],
'email-header-image'
);
}
/**
* Gets the class for the header image control.
*
* This is used to determine if the header image is external.
* Legacy header image control was allowing external URLs.
*
* @since 1.8.5
*
* @return string
*/
private function get_external_header_image_class() {
$header_image_url = wpforms_setting( 'email-header-image', '' );
// If the header image URL is empty, return an empty string.
if ( empty( $header_image_url ) ) {
return '';
}
$site_url = home_url(); // Get the current site's URL.
// Get the hosts of the site URL and the header image URL.
$site_url_host = wp_parse_url( $site_url, PHP_URL_HOST );
$header_image_url_host = wp_parse_url( $header_image_url, PHP_URL_HOST );
// Check if the header image URL host is different from the site URL host.
if ( $header_image_url_host && $site_url_host && $header_image_url_host !== $site_url_host ) {
return 'has-external-image-url';
}
return ''; // If none of the conditions match, return an empty string.
}
/**
* Determine if the current page is the "Email" settings page.
*
* @since 1.8.5
*
* @return bool
*/
private function is_settings_page() {
return wpforms_is_admin_page( 'settings', 'email' );
}
}

View File

@@ -0,0 +1,165 @@
<?php
namespace WPForms\Admin\Settings;
use WPForms\Helpers\Transient;
/**
* Modern Markup setting element.
*
* @since 1.8.1
*/
class ModernMarkup {
/**
* Settings array.
*
* @since 1.8.1
*
* @var array
*/
private $settings;
/**
* Initialize class.
*
* @since 1.8.1
*/
public function init() {
$this->hooks();
}
/**
* Hooks.
*
* @since 1.8.1
*/
public function hooks() {
add_action( 'wpforms_create_form', [ $this, 'clear_transient' ] );
add_action( 'wpforms_save_form', [ $this, 'clear_transient' ] );
add_action( 'wpforms_delete_form', [ $this, 'clear_transient' ] );
add_action( 'wpforms_form_handler_update_status', [ $this, 'clear_transient' ] );
// Only continue if we are actually on the settings page.
if ( ! wpforms_is_admin_page( 'settings' ) ) {
return;
}
add_filter( 'wpforms_settings_defaults', [ $this, 'register_field' ] );
}
/**
* Register setting field.
*
* @since 1.8.1
*
* @param array $settings Settings data.
*
* @return array
*/
public function register_field( $settings ) {
/**
* Allows to show/hide the Modern Markup setting field on the Settings page.
*
* @since 1.8.1
*
* @param mixed $is_disabled Whether the setting must be hidden.
*/
$is_hidden = apply_filters(
'wpforms_admin_settings_modern_markup_register_field_is_hidden',
wpforms_setting( 'modern-markup-hide-setting' )
);
if ( ! empty( $is_hidden ) ) {
return $settings;
}
$modern_markup = [
'id' => 'modern-markup',
'name' => esc_html__( 'Use Modern Markup', 'wpforms-lite' ),
'desc' => sprintf(
wp_kses( /* translators: %s - WPForms.com form markup setting URL. */
__( 'Use modern markup, which has increased accessibility and allows you to easily customize your forms in the block editor. <a href="%s" target="_blank" rel="noopener noreferrer" class="wpforms-learn-more">Learn More</a>', 'wpforms-lite' ),
[
'a' => [
'href' => [],
'target' => [],
'rel' => [],
'class' => [],
],
]
),
wpforms_utm_link( 'https://wpforms.com/docs/styling-your-forms/', 'settings-license', 'Form Markup Documentation' )
),
'type' => 'toggle',
'status' => true,
];
$is_disabled_transient = Transient::get( 'modern_markup_setting_disabled' );
// Transient doesn't set or expired.
if ( $is_disabled_transient === false ) {
$forms = wpforms()->get( 'form' )->get( '', [ 'post_status' => 'publish' ] );
$is_disabled_transient = wpforms_has_field_type( 'credit-card', $forms, true ) ? '1' : '0';
// Re-check all the forms for the CC field once per day.
Transient::set( 'modern_markup_setting_disabled', $is_disabled_transient, DAY_IN_SECONDS );
}
/**
* Allows to enable/disable the Modern Markup setting field on the Settings page.
*
* @since 1.8.1
*
* @param mixed $is_disabled Whether the Modern Markup setting must be disabled.
*/
$is_disabled = (bool) apply_filters(
'wpforms_admin_settings_modern_markup_register_field_is_disabled',
! empty( $is_disabled_transient )
);
$current_value = wpforms_setting( 'modern-markup' );
// In the case it is disabled because of the legacy CC field, add corresponding description.
if ( $is_disabled && ! empty( $is_disabled_transient ) && empty( $current_value ) ) {
$modern_markup['disabled'] = true;
$modern_markup['disabled_desc'] = sprintf(
wp_kses( /* translators: %s - WPForms Stripe addon URL. */
__( '<strong>You cannot use modern markup because youre using the deprecated Credit Card field.</strong> If youd like to use modern markup, replace your credit card field with a payment gateway like <a href="%s" target="_blank" rel="noopener noreferrer">Stripe</a>.', 'wpforms-lite' ),
[
'a' => [
'href' => [],
'target' => [],
'rel' => [],
],
'strong' => [],
]
),
'https://wpforms.com/docs/how-to-install-and-use-the-stripe-addon-with-wpforms'
);
}
$modern_markup = [
'modern-markup' => $modern_markup,
];
$settings['general'] = wpforms_list_insert_after( $settings['general'], 'disable-css', $modern_markup );
return $settings;
}
/**
* Clear transient in the case when the form is created/saved/deleted.
* So, next time when the user will open the Settings page,
* the Modern Markup setting will check for the legacy Credit Card field in all the forms again.
*
* @since 1.8.1
*/
public function clear_transient() {
Transient::delete( 'modern_markup_setting_disabled' );
}
}

View File

@@ -0,0 +1,96 @@
<?php
namespace WPForms\Admin\Settings;
/**
* Payments setting page.
* Settings will be accessible via “WPForms” → “Settings” → “Payments”.
*
* @since 1.8.2
*/
class Payments {
/**
* Initialize class.
*
* @since 1.8.2
*/
public function init() {
$this->hooks();
}
/**
* Hooks.
*
* @since 1.8.2
*/
private function hooks() {
add_filter( 'wpforms_settings_tabs', [ $this, 'register_settings_tabs' ], 5 );
add_filter( 'wpforms_settings_defaults', [ $this, 'register_settings_fields' ], 5 );
}
/**
* Register "Payments" settings tab.
*
* @since 1.8.2
*
* @param array $tabs Admin area tabs list.
*
* @return array
*/
public function register_settings_tabs( $tabs ) {
$payments = [
'payments' => [
'name' => esc_html__( 'Payments', 'wpforms-lite' ),
'form' => true,
'submit' => esc_html__( 'Save Settings', 'wpforms-lite' ),
],
];
return wpforms_array_insert( $tabs, $payments, 'validation' );
}
/**
* Register "Payments" settings fields.
*
* @since 1.8.2
*
* @param array $settings Admin area settings list.
*
* @return array
*/
public function register_settings_fields( $settings ) {
$currency_option = [];
$currencies = wpforms_get_currencies();
// Format currencies for select element.
foreach ( $currencies as $code => $currency ) {
$currency_option[ $code ] = sprintf( '%s (%s %s)', $currency['name'], $code, $currency['symbol'] );
}
$settings['payments'] = [
'heading' => [
'id' => 'payments-heading',
'content' => '<h4>' . esc_html__( 'Payments', 'wpforms-lite' ) . '</h4>',
'type' => 'content',
'no_label' => true,
'class' => [ 'section-heading', 'no-desc' ],
],
'currency' => [
'id' => 'currency',
'name' => esc_html__( 'Currency', 'wpforms-lite' ),
'type' => 'select',
'choicesjs' => true,
'search' => true,
'default' => 'USD',
'options' => $currency_option,
],
];
return $settings;
}
}