__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php

namespace ElementsKit_Lite\Libs\Framework\Classes;

use ElementsKit_Lite\Traits\Singleton;

defined( 'ABSPATH' ) || exit;

class Onboard_Status {

	use Singleton;
	protected $optionKey   = 'elements_kit_onboard_status';
	protected $optionValue = 'onboarded';

	public function onboard() {

		add_action( 'elementskit/admin/after_save', array( $this, 'ajax_action' ) );
		
		if ( get_option( $this->optionKey ) ) {
			return true;
		}

		/**
		 * We are checking if the user current page is elementskit and if the user is not completing onboarding,
		 * We are redirecting to the onboarding page.
		 */
		// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Checking current page type. The page only can access admin. So nonce verification is not required.
		$param      = isset( $_GET['ekit-onboard-steps'] ) ? sanitize_text_field( wp_unslash( $_GET['ekit-onboard-steps'] ) ) : null;
		// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Checking current page post_type. The page only can access admin. So nonce verification is not required.
		$requestUri = ( isset( $_GET['post_type'] ) ? sanitize_text_field( wp_unslash( $_GET['post_type'] ) ) : '' ) . ( isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '' );

		if ( strpos( $requestUri, 'elementskit' ) !== false && is_admin() ) {
			if ( $param !== 'loaded' && ! get_option( $this->optionKey ) ) {
				wp_safe_redirect( $this->get_onboard_url() );
				exit;
			}
		}

		return true;
	}

	public function ajax_action() {

		if( empty( $_POST['nonce'] ) || !wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'ajax-nonce' ) ){
			return false;
		}

		// finish on-boarding
		$this->finish_onboard();

		if ( ! empty( $_POST['settings']['newsletter_email'] ) && is_email( $_POST['settings']['newsletter_email'] ) ) {
			$data = array(
				'email'           => sanitize_email( wp_unslash( $_POST['settings']['newsletter_email'] ) ),
				'slug'            => 'elementskit-lite',
			);

			$response = Plugin_Data_Sender::instance()->sendEmailSubscribeData( 'plugin-subscribe', $data );
		}
	}

	private function get_onboard_url() {
		return add_query_arg(
			array(
				'page'               => 'elementskit',
				'ekit-onboard-steps' => 'loaded',
			),
			admin_url( 'admin.php' )
		);
	}

	public function redirect_onboard() {
		if ( ! get_option( $this->optionKey ) ) {
			wp_safe_redirect( $this->get_onboard_url() );
			exit;
		}
	}

	public function exit_from_onboard() {
		if ( get_option( $this->optionKey ) ) {
			wp_safe_redirect( $this->get_plugin_url() );
			exit;
		}
	}

	private static function get_plugin_url() {
		return add_query_arg(
			array(
				'page' => 'elementskit',
			),
			admin_url( 'admin.php' )
		);
	}

	public function finish_onboard() {
		if ( ! get_option( $this->optionKey ) ) {
			add_option( $this->optionKey, $this->optionValue );
		}
	}
}

Filemanager

Name Type Size Permission Actions
ajax.php File 5.68 KB 0664
onboard-status.php File 2.85 KB 0664
plugin-data-sender.php File 634 B 0664
plugin-installer.php File 3.19 KB 0664
plugin-skin.php File 469 B 0664
plugin-status.php File 2.98 KB 0664
utils.php File 2.35 KB 0664
Filemanager