Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../public_h.../wp-conte.../plugins/wpforms-.../src/Admin/Pages
File: Analytics.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace WPForms\Admin\Pages;
[2] Fix | Delete
[3] Fix | Delete
/**
[4] Fix | Delete
* Analytics Sub-page.
[5] Fix | Delete
*
[6] Fix | Delete
* @since 1.5.7
[7] Fix | Delete
*/
[8] Fix | Delete
class Analytics {
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Admin menu page slug.
[12] Fix | Delete
*
[13] Fix | Delete
* @since 1.5.7
[14] Fix | Delete
*
[15] Fix | Delete
* @var string
[16] Fix | Delete
*/
[17] Fix | Delete
const SLUG = 'wpforms-analytics';
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* Configuration.
[21] Fix | Delete
*
[22] Fix | Delete
* @since 1.5.7
[23] Fix | Delete
*
[24] Fix | Delete
* @var array
[25] Fix | Delete
*/
[26] Fix | Delete
private $config = [
[27] Fix | Delete
'lite_plugin' => 'google-analytics-for-wordpress/googleanalytics.php',
[28] Fix | Delete
'lite_wporg_url' => 'https://wordpress.org/plugins/google-analytics-for-wordpress/',
[29] Fix | Delete
'lite_download_url' => 'https://downloads.wordpress.org/plugin/google-analytics-for-wordpress.zip',
[30] Fix | Delete
'pro_plugin' => 'google-analytics-premium/googleanalytics-premium.php',
[31] Fix | Delete
'forms_addon' => 'monsterinsights-forms/monsterinsights-forms.php',
[32] Fix | Delete
'mi_forms_addon_page' => 'https://www.monsterinsights.com/addon/forms/?utm_source=wpformsplugin&utm_medium=link&utm_campaign=analytics-page',
[33] Fix | Delete
'mi_onboarding' => 'admin.php?page=monsterinsights-onboarding',
[34] Fix | Delete
'mi_addons' => 'admin.php?page=monsterinsights_settings#/addons',
[35] Fix | Delete
'mi_forms' => 'admin.php?page=monsterinsights_reports#/forms',
[36] Fix | Delete
];
[37] Fix | Delete
[38] Fix | Delete
/**
[39] Fix | Delete
* Runtime data used for generating page HTML.
[40] Fix | Delete
*
[41] Fix | Delete
* @since 1.5.7
[42] Fix | Delete
*
[43] Fix | Delete
* @var array
[44] Fix | Delete
*/
[45] Fix | Delete
private $output_data = [];
[46] Fix | Delete
[47] Fix | Delete
/**
[48] Fix | Delete
* Constructor.
[49] Fix | Delete
*
[50] Fix | Delete
* @since 1.5.7
[51] Fix | Delete
*/
[52] Fix | Delete
public function __construct() {
[53] Fix | Delete
[54] Fix | Delete
if ( ! wpforms_current_user_can() ) {
[55] Fix | Delete
return;
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
$this->hooks();
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
/**
[62] Fix | Delete
* Hooks.
[63] Fix | Delete
*
[64] Fix | Delete
* @since 1.5.7
[65] Fix | Delete
*/
[66] Fix | Delete
public function hooks() {
[67] Fix | Delete
[68] Fix | Delete
if ( wp_doing_ajax() ) {
[69] Fix | Delete
add_action( 'wp_ajax_wpforms_analytics_page_check_plugin_status', [ $this, 'ajax_check_plugin_status' ] );
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
// Check what page we are on.
[73] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
[74] Fix | Delete
$page = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : '';
[75] Fix | Delete
[76] Fix | Delete
// Only load if we are actually on the Analytics page.
[77] Fix | Delete
if ( $page !== self::SLUG ) {
[78] Fix | Delete
return;
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
add_action( 'admin_init', [ $this, 'redirect_to_mi_forms' ] );
[82] Fix | Delete
add_filter( 'wpforms_admin_header', '__return_false' );
[83] Fix | Delete
add_action( 'wpforms_admin_page', [ $this, 'output' ] );
[84] Fix | Delete
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
[85] Fix | Delete
[86] Fix | Delete
// Hook for addons.
[87] Fix | Delete
do_action( 'wpforms_admin_pages_analytics_hooks' );
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
/**
[91] Fix | Delete
* Enqueue JS and CSS files.
[92] Fix | Delete
*
[93] Fix | Delete
* @since 1.5.7
[94] Fix | Delete
*/
[95] Fix | Delete
public function enqueue_assets() {
[96] Fix | Delete
[97] Fix | Delete
$min = wpforms_get_min_suffix();
[98] Fix | Delete
[99] Fix | Delete
// Lity.
[100] Fix | Delete
wp_enqueue_style(
[101] Fix | Delete
'wpforms-lity',
[102] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/lib/lity/lity.min.css',
[103] Fix | Delete
null,
[104] Fix | Delete
'3.0.0'
[105] Fix | Delete
);
[106] Fix | Delete
[107] Fix | Delete
wp_enqueue_script(
[108] Fix | Delete
'wpforms-lity',
[109] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/lib/lity/lity.min.js',
[110] Fix | Delete
[ 'jquery' ],
[111] Fix | Delete
'3.0.0',
[112] Fix | Delete
true
[113] Fix | Delete
);
[114] Fix | Delete
[115] Fix | Delete
wp_enqueue_script(
[116] Fix | Delete
'wpforms-admin-page-analytics',
[117] Fix | Delete
WPFORMS_PLUGIN_URL . "assets/js/admin/pages/mi-analytics{$min}.js",
[118] Fix | Delete
[ 'jquery' ],
[119] Fix | Delete
WPFORMS_VERSION,
[120] Fix | Delete
true
[121] Fix | Delete
);
[122] Fix | Delete
[123] Fix | Delete
wp_localize_script(
[124] Fix | Delete
'wpforms-admin-page-analytics',
[125] Fix | Delete
'wpforms_pluginlanding',
[126] Fix | Delete
$this->get_js_strings()
[127] Fix | Delete
);
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
/**
[131] Fix | Delete
* JS Strings.
[132] Fix | Delete
*
[133] Fix | Delete
* @since 1.5.7
[134] Fix | Delete
*
[135] Fix | Delete
* @return array Array of strings.
[136] Fix | Delete
*/
[137] Fix | Delete
protected function get_js_strings() {
[138] Fix | Delete
[139] Fix | Delete
$error_could_not_install = sprintf(
[140] Fix | Delete
wp_kses( /* translators: %s - Lite plugin download URL. */
[141] Fix | Delete
__( 'Could not install the plugin automatically. Please <a href="%s">download</a> it and install it manually.', 'wpforms-lite' ),
[142] Fix | Delete
[
[143] Fix | Delete
'a' => [
[144] Fix | Delete
'href' => true,
[145] Fix | Delete
],
[146] Fix | Delete
]
[147] Fix | Delete
),
[148] Fix | Delete
esc_url( $this->config['lite_download_url'] )
[149] Fix | Delete
);
[150] Fix | Delete
[151] Fix | Delete
$error_could_not_activate = sprintf(
[152] Fix | Delete
wp_kses( /* translators: %s - Lite plugin download URL. */
[153] Fix | Delete
__( 'Could not activate the plugin. Please activate it on the <a href="%s">Plugins page</a>.', 'wpforms-lite' ),
[154] Fix | Delete
[
[155] Fix | Delete
'a' => [
[156] Fix | Delete
'href' => true,
[157] Fix | Delete
],
[158] Fix | Delete
]
[159] Fix | Delete
),
[160] Fix | Delete
esc_url( admin_url( 'plugins.php' ) )
[161] Fix | Delete
);
[162] Fix | Delete
[163] Fix | Delete
return [
[164] Fix | Delete
'installing' => esc_html__( 'Installing...', 'wpforms-lite' ),
[165] Fix | Delete
'activating' => esc_html__( 'Activating...', 'wpforms-lite' ),
[166] Fix | Delete
'activated' => esc_html__( 'MonsterInsights Installed & Activated', 'wpforms-lite' ),
[167] Fix | Delete
'install_now' => esc_html__( 'Install Now', 'wpforms-lite' ),
[168] Fix | Delete
'activate_now' => esc_html__( 'Activate Now', 'wpforms-lite' ),
[169] Fix | Delete
'download_now' => esc_html__( 'Download Now', 'wpforms-lite' ),
[170] Fix | Delete
'plugins_page' => esc_html__( 'Go to Plugins page', 'wpforms-lite' ),
[171] Fix | Delete
'error_could_not_install' => $error_could_not_install,
[172] Fix | Delete
'error_could_not_activate' => $error_could_not_activate,
[173] Fix | Delete
'mi_manual_install_url' => $this->config['lite_download_url'],
[174] Fix | Delete
'mi_manual_activate_url' => admin_url( 'plugins.php' ),
[175] Fix | Delete
];
[176] Fix | Delete
}
[177] Fix | Delete
[178] Fix | Delete
/**
[179] Fix | Delete
* Generate and output page HTML.
[180] Fix | Delete
*
[181] Fix | Delete
* @since 1.5.7
[182] Fix | Delete
*/
[183] Fix | Delete
public function output() {
[184] Fix | Delete
[185] Fix | Delete
echo '<div id="wpforms-admin-analytics" class="wrap wpforms-admin-wrap wpforms-admin-plugin-landing">';
[186] Fix | Delete
[187] Fix | Delete
$this->output_section_heading();
[188] Fix | Delete
$this->output_section_screenshot();
[189] Fix | Delete
$this->output_section_step_install();
[190] Fix | Delete
$this->output_section_step_setup();
[191] Fix | Delete
$this->output_section_step_addon();
[192] Fix | Delete
[193] Fix | Delete
echo '</div>';
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
/**
[197] Fix | Delete
* Generate and output heading section HTML.
[198] Fix | Delete
*
[199] Fix | Delete
* @since 1.5.7
[200] Fix | Delete
*/
[201] Fix | Delete
public function output_section_heading() {
[202] Fix | Delete
[203] Fix | Delete
// Heading section.
[204] Fix | Delete
printf(
[205] Fix | Delete
'<section class="top">
[206] Fix | Delete
<img class="img-top" src="%1$s" srcset="%2$s 2x" alt="%3$s"/>
[207] Fix | Delete
<h1>%4$s</h1>
[208] Fix | Delete
<p>%5$s</p>
[209] Fix | Delete
</section>',
[210] Fix | Delete
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/analytics/wpforms-monsterinsights.png' ),
[211] Fix | Delete
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/analytics/wpforms-monsterinsights@2x.png' ),
[212] Fix | Delete
esc_attr__( 'WPForms ♥ MonsterInsights', 'wpforms-lite' ),
[213] Fix | Delete
esc_html__( 'The Best Google Analytics Plugin for WordPress', 'wpforms-lite' ),
[214] Fix | Delete
esc_html__( 'MonsterInsights connects WPForms to Google Analytics, providing a powerful integration with their Forms addon. MonsterInsights is a sister company of WPForms.', 'wpforms-lite' )
[215] Fix | Delete
);
[216] Fix | Delete
}
[217] Fix | Delete
[218] Fix | Delete
/**
[219] Fix | Delete
* Generate and output heading section HTML.
[220] Fix | Delete
*
[221] Fix | Delete
* @since 1.5.7
[222] Fix | Delete
*/
[223] Fix | Delete
protected function output_section_screenshot() {
[224] Fix | Delete
[225] Fix | Delete
// Screenshot section.
[226] Fix | Delete
printf(
[227] Fix | Delete
'<section class="screenshot">
[228] Fix | Delete
<div class="cont">
[229] Fix | Delete
<img src="%1$s" alt="%2$s"/>
[230] Fix | Delete
<a href="%3$s" class="hover" data-lity></a>
[231] Fix | Delete
</div>
[232] Fix | Delete
<ul>
[233] Fix | Delete
<li>%4$s</li>
[234] Fix | Delete
<li>%5$s</li>
[235] Fix | Delete
<li>%6$s</li>
[236] Fix | Delete
<li>%7$s</li>
[237] Fix | Delete
</ul>
[238] Fix | Delete
</section>',
[239] Fix | Delete
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/analytics/screenshot-tnail.jpg' ),
[240] Fix | Delete
esc_attr__( 'Analytics screenshot', 'wpforms-lite' ),
[241] Fix | Delete
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/analytics/screenshot-full.jpg' ),
[242] Fix | Delete
esc_html__( 'Track form impressions and conversions.', 'wpforms-lite' ),
[243] Fix | Delete
esc_html__( 'View form conversion rates from WordPress.', 'wpforms-lite' ),
[244] Fix | Delete
esc_html__( 'Complete UTM tracking with form entries.', 'wpforms-lite' ),
[245] Fix | Delete
esc_html__( 'Automatic integration with WPForms.', 'wpforms-lite' )
[246] Fix | Delete
);
[247] Fix | Delete
}
[248] Fix | Delete
[249] Fix | Delete
/**
[250] Fix | Delete
* Generate and output step 'Install' section HTML.
[251] Fix | Delete
*
[252] Fix | Delete
* @since 1.5.7
[253] Fix | Delete
*/
[254] Fix | Delete
protected function output_section_step_install() {
[255] Fix | Delete
[256] Fix | Delete
$step = $this->get_data_step_install();
[257] Fix | Delete
[258] Fix | Delete
if ( empty( $step ) ) {
[259] Fix | Delete
return;
[260] Fix | Delete
}
[261] Fix | Delete
[262] Fix | Delete
$button_format = '<button class="button %3$s" data-plugin="%1$s" data-action="%4$s">%2$s</button>';
[263] Fix | Delete
$button_allowed_html = [
[264] Fix | Delete
'button' => [
[265] Fix | Delete
'class' => true,
[266] Fix | Delete
'data-plugin' => true,
[267] Fix | Delete
'data-action' => true,
[268] Fix | Delete
],
[269] Fix | Delete
];
[270] Fix | Delete
[271] Fix | Delete
if (
[272] Fix | Delete
! $this->output_data['plugin_installed'] &&
[273] Fix | Delete
! $this->output_data['pro_plugin_installed'] &&
[274] Fix | Delete
! wpforms_can_install( 'plugin' )
[275] Fix | Delete
) {
[276] Fix | Delete
$button_format = '<a class="link" href="%1$s" target="_blank" rel="nofollow noopener">%2$s <span aria-hidden="true" class="dashicons dashicons-external"></span></a>';
[277] Fix | Delete
$button_allowed_html = [
[278] Fix | Delete
'a' => [
[279] Fix | Delete
'class' => true,
[280] Fix | Delete
'href' => true,
[281] Fix | Delete
'target' => true,
[282] Fix | Delete
'rel' => true,
[283] Fix | Delete
],
[284] Fix | Delete
'span' => [
[285] Fix | Delete
'class' => true,
[286] Fix | Delete
'aria-hidden' => true,
[287] Fix | Delete
],
[288] Fix | Delete
];
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
$button = sprintf( $button_format, esc_attr( $step['plugin'] ), esc_html( $step['button_text'] ), esc_attr( $step['button_class'] ), esc_attr( $step['button_action'] ) );
[292] Fix | Delete
[293] Fix | Delete
printf(
[294] Fix | Delete
'<section class="step step-install">
[295] Fix | Delete
<aside class="num">
[296] Fix | Delete
<img src="%1$s" alt="%2$s" />
[297] Fix | Delete
<i class="loader hidden"></i>
[298] Fix | Delete
</aside>
[299] Fix | Delete
<div>
[300] Fix | Delete
<h2>%3$s</h2>
[301] Fix | Delete
<p>%4$s</p>
[302] Fix | Delete
%5$s
[303] Fix | Delete
</div>
[304] Fix | Delete
</section>',
[305] Fix | Delete
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/' . $step['icon'] ),
[306] Fix | Delete
esc_attr__( 'Step 1', 'wpforms-lite' ),
[307] Fix | Delete
esc_html( $step['heading'] ),
[308] Fix | Delete
esc_html( $step['description'] ),
[309] Fix | Delete
wp_kses( $button, $button_allowed_html )
[310] Fix | Delete
);
[311] Fix | Delete
}
[312] Fix | Delete
[313] Fix | Delete
/**
[314] Fix | Delete
* Generate and output step 'Setup' section HTML.
[315] Fix | Delete
*
[316] Fix | Delete
* @since 1.5.7
[317] Fix | Delete
*/
[318] Fix | Delete
protected function output_section_step_setup() {
[319] Fix | Delete
[320] Fix | Delete
$step = $this->get_data_step_setup();
[321] Fix | Delete
[322] Fix | Delete
if ( empty( $step ) ) {
[323] Fix | Delete
return;
[324] Fix | Delete
}
[325] Fix | Delete
[326] Fix | Delete
printf(
[327] Fix | Delete
'<section class="step step-setup %1$s">
[328] Fix | Delete
<aside class="num">
[329] Fix | Delete
<img src="%2$s" alt="%3$s" />
[330] Fix | Delete
<i class="loader hidden"></i>
[331] Fix | Delete
</aside>
[332] Fix | Delete
<div>
[333] Fix | Delete
<h2>%4$s</h2>
[334] Fix | Delete
<p>%5$s</p>
[335] Fix | Delete
<button class="button %6$s" data-url="%7$s">%8$s</button>
[336] Fix | Delete
</div>
[337] Fix | Delete
</section>',
[338] Fix | Delete
esc_attr( $step['section_class'] ),
[339] Fix | Delete
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/' . $step['icon'] ),
[340] Fix | Delete
esc_attr__( 'Step 2', 'wpforms-lite' ),
[341] Fix | Delete
esc_html__( 'Setup MonsterInsights', 'wpforms-lite' ),
[342] Fix | Delete
esc_html__( 'MonsterInsights has an intuitive setup wizard to guide you through the setup process.', 'wpforms-lite' ),
[343] Fix | Delete
esc_attr( $step['button_class'] ),
[344] Fix | Delete
esc_url( admin_url( $this->config['mi_onboarding'] ) ),
[345] Fix | Delete
esc_html( $step['button_text'] )
[346] Fix | Delete
);
[347] Fix | Delete
}
[348] Fix | Delete
[349] Fix | Delete
/**
[350] Fix | Delete
* Generate and output step 'Addon' section HTML.
[351] Fix | Delete
*
[352] Fix | Delete
* @since 1.5.7
[353] Fix | Delete
*/
[354] Fix | Delete
protected function output_section_step_addon() {
[355] Fix | Delete
[356] Fix | Delete
$step = $this->get_data_step_addon();
[357] Fix | Delete
[358] Fix | Delete
if ( empty( $step ) ) {
[359] Fix | Delete
return;
[360] Fix | Delete
}
[361] Fix | Delete
[362] Fix | Delete
printf(
[363] Fix | Delete
'<section class="step step-addon %1$s">
[364] Fix | Delete
<aside class="num">
[365] Fix | Delete
<img src="%2$s" alt="%3$s" />
[366] Fix | Delete
<i class="loader hidden"></i>
[367] Fix | Delete
</aside>
[368] Fix | Delete
<div>
[369] Fix | Delete
<h2>%4$s</h2>
[370] Fix | Delete
<p>%5$s</p>
[371] Fix | Delete
<button class="button %6$s" data-url="%7$s">%8$s</button>
[372] Fix | Delete
</div>
[373] Fix | Delete
</section>',
[374] Fix | Delete
esc_attr( $step['section_class'] ),
[375] Fix | Delete
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/step-3.svg' ),
[376] Fix | Delete
esc_attr__( 'Step 3', 'wpforms-lite' ),
[377] Fix | Delete
esc_html__( 'Get Form Conversion Tracking', 'wpforms-lite' ),
[378] Fix | Delete
esc_html__( 'With the MonsterInsights Form addon you can easily track your form views, entries, conversion rates, and more.', 'wpforms-lite' ),
[379] Fix | Delete
esc_attr( $step['button_class'] ),
[380] Fix | Delete
esc_url( $step['button_url'] ),
[381] Fix | Delete
esc_html( $step['button_text'] )
[382] Fix | Delete
);
[383] Fix | Delete
}
[384] Fix | Delete
[385] Fix | Delete
/**
[386] Fix | Delete
* Step 'Install' data.
[387] Fix | Delete
*
[388] Fix | Delete
* @since 1.5.7
[389] Fix | Delete
*
[390] Fix | Delete
* @return array Step data.
[391] Fix | Delete
*/
[392] Fix | Delete
protected function get_data_step_install() {
[393] Fix | Delete
[394] Fix | Delete
$step = [];
[395] Fix | Delete
$step['heading'] = esc_html__( 'Install & Activate MonsterInsights', 'wpforms-lite' );
[396] Fix | Delete
$step['description'] = esc_html__( 'Track form impressions and conversions.', 'wpforms-lite' );
[397] Fix | Delete
[398] Fix | Delete
$this->output_data['all_plugins'] = get_plugins();
[399] Fix | Delete
$this->output_data['plugin_installed'] = array_key_exists( $this->config['lite_plugin'], $this->output_data['all_plugins'] );
[400] Fix | Delete
$this->output_data['plugin_activated'] = false;
[401] Fix | Delete
$this->output_data['pro_plugin_installed'] = array_key_exists( $this->config['pro_plugin'], $this->output_data['all_plugins'] );
[402] Fix | Delete
$this->output_data['pro_plugin_activated'] = false;
[403] Fix | Delete
[404] Fix | Delete
if ( ! $this->output_data['plugin_installed'] && ! $this->output_data['pro_plugin_installed'] ) {
[405] Fix | Delete
$step['icon'] = 'step-1.svg';
[406] Fix | Delete
$step['button_text'] = esc_html__( 'Install MonsterInsights', 'wpforms-lite' );
[407] Fix | Delete
$step['button_class'] = 'button-primary';
[408] Fix | Delete
$step['button_action'] = 'install';
[409] Fix | Delete
$step['plugin'] = $this->config['lite_download_url'];
[410] Fix | Delete
[411] Fix | Delete
if ( ! wpforms_can_install( 'plugin' ) ) {
[412] Fix | Delete
$step['heading'] = esc_html__( 'MonsterInsights', 'wpforms-lite' );
[413] Fix | Delete
$step['description'] = '';
[414] Fix | Delete
$step['button_text'] = esc_html__( 'MonsterInsights on WordPress.org', 'wpforms-lite' );
[415] Fix | Delete
$step['plugin'] = $this->config['lite_wporg_url'];
[416] Fix | Delete
}
[417] Fix | Delete
} else {
[418] Fix | Delete
$this->output_data['plugin_activated'] = is_plugin_active( $this->config['lite_plugin'] ) || is_plugin_active( $this->config['pro_plugin'] );
[419] Fix | Delete
$step['icon'] = $this->output_data['plugin_activated'] ? 'step-complete.svg' : 'step-1.svg';
[420] Fix | Delete
$step['button_text'] = $this->output_data['plugin_activated'] ? esc_html__( 'MonsterInsights Installed & Activated', 'wpforms-lite' ) : esc_html__( 'Activate MonsterInsights', 'wpforms-lite' );
[421] Fix | Delete
$step['button_class'] = $this->output_data['plugin_activated'] ? 'grey disabled' : 'button-primary';
[422] Fix | Delete
$step['button_action'] = $this->output_data['plugin_activated'] ? '' : 'activate';
[423] Fix | Delete
$step['plugin'] = $this->output_data['pro_plugin_installed'] ? $this->config['pro_plugin'] : $this->config['lite_plugin'];
[424] Fix | Delete
}
[425] Fix | Delete
[426] Fix | Delete
return $step;
[427] Fix | Delete
}
[428] Fix | Delete
[429] Fix | Delete
/**
[430] Fix | Delete
* Step 'Setup' data.
[431] Fix | Delete
*
[432] Fix | Delete
* @since 1.5.7
[433] Fix | Delete
*
[434] Fix | Delete
* @return array Step data.
[435] Fix | Delete
* @noinspection PhpUndefinedFunctionInspection
[436] Fix | Delete
*/
[437] Fix | Delete
protected function get_data_step_setup() {
[438] Fix | Delete
[439] Fix | Delete
$step = [];
[440] Fix | Delete
[441] Fix | Delete
$this->output_data['plugin_setup'] = false;
[442] Fix | Delete
[443] Fix | Delete
if ( $this->output_data['plugin_activated'] ) {
[444] Fix | Delete
$this->output_data['plugin_setup'] = function_exists( 'monsterinsights_get_ua' ) && '' !== (string) monsterinsights_get_ua();
[445] Fix | Delete
}
[446] Fix | Delete
[447] Fix | Delete
$step['icon'] = 'step-2.svg';
[448] Fix | Delete
$step['section_class'] = $this->output_data['plugin_activated'] ? '' : 'grey';
[449] Fix | Delete
$step['button_text'] = esc_html__( 'Run Setup Wizard', 'wpforms-lite' );
[450] Fix | Delete
$step['button_class'] = 'grey disabled';
[451] Fix | Delete
[452] Fix | Delete
if ( $this->output_data['plugin_setup'] ) {
[453] Fix | Delete
$step['icon'] = 'step-complete.svg';
[454] Fix | Delete
$step['section_class'] = '';
[455] Fix | Delete
$step['button_text'] = esc_html__( 'Setup Complete', 'wpforms-lite' );
[456] Fix | Delete
} else {
[457] Fix | Delete
$step['button_class'] = $this->output_data['plugin_activated'] ? 'button-primary' : 'grey disabled';
[458] Fix | Delete
}
[459] Fix | Delete
[460] Fix | Delete
return $step;
[461] Fix | Delete
}
[462] Fix | Delete
[463] Fix | Delete
/**
[464] Fix | Delete
* Step 'Addon' data.
[465] Fix | Delete
*
[466] Fix | Delete
* @since 1.5.7
[467] Fix | Delete
*
[468] Fix | Delete
* @return array Step data.
[469] Fix | Delete
* @noinspection PhpUndefinedFunctionInspection
[470] Fix | Delete
*/
[471] Fix | Delete
protected function get_data_step_addon() {
[472] Fix | Delete
[473] Fix | Delete
$step = [];
[474] Fix | Delete
[475] Fix | Delete
$step['icon'] = 'step-3.svg';
[476] Fix | Delete
$step['section_class'] = $this->output_data['plugin_setup'] ? '' : 'grey';
[477] Fix | Delete
$step['button_text'] = esc_html__( 'Learn More', 'wpforms-lite' );
[478] Fix | Delete
$step['button_class'] = 'grey disabled';
[479] Fix | Delete
$step['button_url'] = '';
[480] Fix | Delete
[481] Fix | Delete
$plugin_license_level = false;
[482] Fix | Delete
[483] Fix | Delete
if ( $this->output_data['plugin_activated'] ) {
[484] Fix | Delete
$mi = MonsterInsights();
[485] Fix | Delete
[486] Fix | Delete
$plugin_license_level = 'lite';
[487] Fix | Delete
[488] Fix | Delete
if ( is_object( $mi->license ) && method_exists( $mi->license, 'license_can' ) ) {
[489] Fix | Delete
$plugin_license_level = $mi->license->license_can( 'plus' ) ? 'lite' : $plugin_license_level;
[490] Fix | Delete
$plugin_license_level = $mi->license->license_can( 'pro' ) || $mi->license->license_can( 'agency' ) ? 'pro' : $plugin_license_level;
[491] Fix | Delete
}
[492] Fix | Delete
}
[493] Fix | Delete
[494] Fix | Delete
switch ( $plugin_license_level ) {
[495] Fix | Delete
case 'lite':
[496] Fix | Delete
$step['button_url'] = $this->config['mi_forms_addon_page'];
[497] Fix | Delete
$step['button_class'] = $this->output_data['plugin_setup'] ? 'button-primary' : 'grey';
[498] Fix | Delete
break;
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function