: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace WPForms\Admin\Settings;
use WPForms\Admin\Notice;
use WPForms\Admin\Settings\Captcha\Page;
* Slug identifier for admin page view.
* The hCaptcha javascript URL-resource.
const HCAPTCHA_API_URL = 'https://hcaptcha.com/1/api.js';
* The reCAPTCHA javascript URL-resource.
const RECAPTCHA_API_URL = 'https://www.google.com/recaptcha/api.js';
* Saved CAPTCHA settings.
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin', 'WPForms\Admin\Settings\Captcha\Page::init()' );
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();
public function hooks() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin', 'WPForms\Admin\Settings\Captcha\Page::hooks()' );
* Register CAPTCHA settings tab.
* @param array $tabs Admin area tabs list.
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.
* @param array $settings Admin area settings list.
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.
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.
protected function notice() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin' );
! wpforms_is_admin_page( 'settings', self::VIEW ) ||
! $this->is_captcha_preview_ready()
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.
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
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.
protected function is_captcha_preview_ready() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin' );
( '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.
protected function get_api_url() {
_deprecated_function( __METHOD__, '1.8.0 of the WPForms plugin' );
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.
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',