: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$addon_installed = array_key_exists( $this->config['forms_addon'], $this->output_data['all_plugins'] );
$step['button_text'] = $addon_installed ? esc_html__( 'Activate Now', 'wpforms-lite' ) : esc_html__( 'Install Now', 'wpforms-lite' );
$step['button_url'] = admin_url( $this->config['mi_addons'] );
$step['button_class'] = $this->output_data['plugin_setup'] ? 'button-primary' : 'grey';
* Ajax endpoint. Check plugin setup status.
* Used to properly init step 2 section after completing step 1.
* @noinspection PhpUndefinedFunctionInspection
public function ajax_check_plugin_status() {
! check_ajax_referer( 'wpforms-admin', 'nonce', false ) ||
! wpforms_current_user_can()
'error' => esc_html__( 'You do not have permission.', 'wpforms-lite' ),
if ( ! function_exists( 'MonsterInsights' ) || ! function_exists( 'monsterinsights_get_ua' ) ) {
'error' => esc_html__( 'Plugin unavailable.', 'wpforms-lite' ),
$result['setup_status'] = (int) ( '' !== (string) monsterinsights_get_ua() );
$result['license_level'] = 'lite';
$result['step3_button_url'] = $this->config['mi_forms_addon_page'];
if ( is_object( $mi->license ) && method_exists( $mi->license, 'license_can' ) ) {
$result['license_level'] = $mi->license->license_can( 'pro' ) || $mi->license->license_can( 'agency' ) ? 'pro' : $result['license_level'];
$result['step3_button_url'] = admin_url( $this->config['mi_addons'] );
$result['addon_installed'] = (int) array_key_exists( $this->config['forms_addon'], get_plugins() );
wp_send_json_success( $result );
* Redirect to MI forms reporting page.
* We need this function because `is_plugin_active()` available only after `admin_init` action.
public function redirect_to_mi_forms() {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
// Redirect to MI Forms addon if it is activated.
if ( is_plugin_active( $this->config['forms_addon'] ) ) {
wp_safe_redirect( admin_url( $this->config['mi_forms'] ) );