PluginProbe
Hello Plus / 1.4.0
Hello Plus v1.4.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / modules / admin / classes / ajax / setup-wizard.php

setup-wizard.php in Hello Plus 1.4.0, at modules/admin/classes/ajax/setup-wizard.php

48 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace HelloPlus\Modules\Admin\Classes\Ajax;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit; // Exit if accessed directly.
7 }
8
9 use HelloPlus\Modules\Admin\Classes\Onboarding\Install_Elementor;
10
11 class Setup_Wizard {
12
13 public function ajax_setup_wizard() {
14 check_ajax_referer( 'updates', 'nonce' );
15
16 $step = filter_input( INPUT_POST, 'step', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
17
18 $campaign_data = [
19 'source' => 'ecore-ehp-install',
20 'campaign' => 'ec-plg',
21 'medium' => 'wp-dash',
22 ];
23
24 set_transient(
25 'elementor_core_campaign',
26 $campaign_data,
27 30 * DAY_IN_SECONDS
28 );
29
30 switch ( $step ) {
31 case 'install-elementor':
32 $step = new Install_Elementor();
33 $step->install_and_activate();
34 break;
35 case 'activate-elementor':
36 $step = new Install_Elementor();
37 $step->activate();
38 break;
39 default:
40 wp_send_json_error( [ 'message' => __( 'Invalid step.', 'hello-plus' ) ] );
41 }
42 }
43
44 public function __construct() {
45 add_action( 'wp_ajax_helloplus_setup_wizard', [ $this, 'ajax_setup_wizard' ] );
46 }
47 }
48