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੐)|#o0aڱ$I>}k&1`U#V?YsV x>{t1[I~D&(I$I/{H0fw"q"y%4 IXyE~M3 8XψL}qE$I[> nD?~sf ]o΁ cT6"?'_Ἣ $I>~.f|'!N?⟩0G KkXZE]ޡ;/&?k OۘH$IRۀwXӨ<7@PnS04aӶp.:@\IWQJ6sS%I$e5ڑv`3:x';wq_vpgHyXZ 3gЂ7{{EuԹn±}$I$8t;b|591nءQ"P6O5i }iR̈́%Q̄p!I䮢]O{H$IRϻ9s֧ a=`- aB\X0"+5"C1Hb?߮3x3&gşggl_hZ^,`5?ߎvĸ%̀M!OZC2#0x LJ0 Gw$I$I}<{Eb+y;iI,`ܚF:5ܛA8-O-|8K7s|#Z8a&><a&/VtbtLʌI$I$I$I$I$I$IRjDD%tEXtdate:create2022-05-31T04:40:26+00:00!Î%tEXtdate:modify2022-05-31T04:40:26+00:00|{2IENDB`Mini Shell

HOME


Mini Shell 1.0
DIR:/home/republicofchicken.in/www/wp-content/plugins/sms-alert/helper/
Upload File :
Current File : //home/republicofchicken.in/www/wp-content/plugins/sms-alert/helper/signup-with-otp.php
<?php
/**
 * Signup with otp helper.
 *
 * @package Helper
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
	return;
}
/**
 * WCSignupWithOTp class
 */
class WCSignupWithOTp {

	/**
	 * Construct function
	 */
	public function __construct() {
		$user_authorize = new smsalert_Setting_Options();
		$islogged       = $user_authorize->is_user_authorised();
		if ( ! $islogged ) {
			return;
		}
		$this->plugin_name = SMSALERT_PLUGIN_NAME_SLUG;
		add_action( 'sa_addTabs', array( $this, 'add_tabs' ), 100 );

		$signup_with_mobile     = smsalert_get_option( 'signup_with_mobile', 'smsalert_general', 'off' );
		$enable_otp_user_update = get_option( 'smsalert_otp_user_update', 'on' );

		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 100 );
		add_action( 'woocommerce_register_form_end', array( $this, 'smsalert_display_signup_btn' ), 100 );
		add_action( 'woocommerce_login_form_end', array( $this, 'smsalert_display_login_back_btn' ), 100 );
		if ( 'on' === $signup_with_mobile ) {
			add_shortcode( 'sa-modal', array( $this, 'smsalert_modal_login' ), 100 );
		}

		if ( 'on' === $enable_otp_user_update ) {
			add_action( 'woocommerce_after_edit_address_form_billing', array( $this, 'update_billing_phone' ), 100 );
		}
		add_action( 'start_process_signwithmob', array( $this, 'process_registration' ), 10, 1 );
		$this->route_data();
		add_action( 'smsalert_user_created', array( $this, 'smsalert_wc_update_new_details' ), 100, 2 );
		add_filter( 'sAlertDefaultSettings', array( $this, 'add_default_setting' ), 1 );

	}

	/**
	 * Handle post data via ajax submit
	 *
	 * @return void
	 */
	public function route_data() {
		if ( ! array_key_exists( 'action', $_REQUEST ) ) {
			return;
		}
		/*
		 switch ( trim( sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) ) ) {
			case 'signwthmob':
				//$this->process_registration();
				//do_action('start_process_signwithmob',$_POST);
				do_action('test_smsalert');
				break;
		} */
	}

	/**
	 * Smsalert display login back button function.
	 */
	public function smsalert_display_login_back_btn() {
		wp_enqueue_script( $this->plugin_name . 'signup_with_otp' );
		$users_can_register = get_option( 'woocommerce_enable_myaccount_registration', 'yes' );
		if ( 'yes' === $users_can_register ) {
			?>
			<div class="signdesc">Don't have an account? <a href="javascript:void(0)" class="signupbutton">Signup</a></div>
			<?php
		}
	}

	/**
	 * Display signup button function.
	 */
	public function smsalert_display_signup_btn() {
		wp_enqueue_script( $this->plugin_name . 'signup_with_otp' );
		?>
		<div class="backtoLoginContainer"><a href="javascript:void(0)" class="backtoLogin">Back to login</a></div>
		<?php
	}

	/**
	 * Add tabs to smsalert settings at backend.
	 *
	 * @param array $tabs tabs.
	 *
	 * @return array
	 */
	public static function add_tabs( $tabs = array() ) {
		$tabs['signupwithotp']['nav'] = 'Shortcodes';
		$tabs['signupwithotp']['icon'] = 'dashicons-admin-users';
		$tabs['signupwithotp']['inner_nav']['signup']['title']       = 'Shortcodes';
		$tabs['signupwithotp']['inner_nav']['signup']['tab_section'] = 'signup_with_phone';
		$tabs['signupwithotp']['inner_nav']['signup']['first_active'] = true;
		$tabs['signupwithotp']['inner_nav']['signup']['tabContent']  = array();
		$tabs['signupwithotp']['inner_nav']['signup']['filePath']    = 'views/signup-with-otp-template.php'; 
		$tabs['signupwithotp']['help_links']                        = array(
			'youtube_link' => array(
				'href'   => 'https://youtu.be/mJ6IEFmmXhI',
				'target' => '_blank',
				'alt'    => 'Watch steps on Youtube',
				'class'  => 'btn-outline',
				'label'  => 'Youtube',
				'icon'   => '<span class="dashicons dashicons-video-alt3" style="font-size: 21px;"></span> ',

			),
			'kb_link'      => array(
				'href'   => 'https://kb.smsalert.co.in/knowledgebase/sms-alert-shortcodes/',
				'target' => '_blank',
				'alt'    => 'Read how to use smsalert shortcodes',
				'class'  => 'btn-outline',
				'label'  => 'Documentation',
				'icon'   => '<span class="dashicons dashicons-format-aside"></span>',
			),
		);
		return $tabs;
	}

	/**
	 * Add default settings to savesetting in setting-options.
	 *
	 * @param array $defaults defaults.
	 *
	 * @return array
	 */
	public function add_default_setting( $defaults = array() ) {
		$defaults['smsalert_otp_user_update'] = 'off';
		$defaults['smsalert_defaultuserrole'] = 'customer';
		return $defaults;
	}

	/**
	 * Enqueue scripts function.
	 */
	public function enqueue_scripts() {
		$register_otp = smsalert_get_option( 'buyer_signup_otp', 'smsalert_general', 'on' );
		$enable_otp   = get_option( 'smsalert_otp_user_update', 'on' );

		//if ( 'on' === $register_otp || 'on' === $enable_otp ) {
			$js_data = array(
				'signupwithotp'     => esc_html__( 'SIGN UP WITH OTP', 'sms-alert' ),
				'update_otp_enable' => $enable_otp,
			);
			wp_register_script( $this->plugin_name . 'signup_with_otp', SA_MOV_URL . 'js/signup.js', array( 'jquery' ), SmsAlertConstants::SA_VERSION, false );
			wp_localize_script( $this->plugin_name . 'signup_with_otp', 'smsalert_mdet', $js_data );
		//}
	}

	/**
	 * Update new details function.
	 *
	 * @param int $user_id user_id.
	 */
	public function smsalert_wc_update_new_details( $user_id, $data ) {
		$user = get_user_by( 'ID', $user_id );
		if ( ! $user ) {
			return false;
		}
		$billing_first_name = get_user_meta( $user->ID, 'billing_first_name', true );
		if ( ! empty( $billing_first_name ) ) {
			return false;
		}
		if ( ! empty( $user->first_name ) ) {
			update_user_meta( $user_id, 'billing_first_name', $user->first_name );
		}

		if ( ! empty( $user->user_email ) ) {
			update_user_meta( $user_id, 'billing_email', $user->user_email );
		}

		if ( empty( $user->billing_phone ) ) {
			update_user_meta( $user_id, 'billing_phone', $data['billing_phone'] );
			do_action( 'sa_send_sms', $data['billing_phone'], 'terer' );
		}

	}
	/**
	 * Update billing phone function.
	 */
	public function update_billing_phone() {
		wp_enqueue_script( $this->plugin_name . 'signup_with_otp' );
		$enable_otp = get_option( 'smsalert_otp_user_update', 'on' );
		if ( 'on' === $enable_otp ) {
			echo '<div style="clear:both">';
			echo '<input type="hidden" id="old_billing_phone" value="' . esc_attr( SmsAlertUtility::formatNumberForCountryCode( get_user_meta( get_current_user_id(), 'billing_phone', true ) ) ) . '">';

			echo do_shortcode( '[sa_verify id="form1" phone_selector="#billing_phone" submit_selector="save_address"]' );
			echo '</div>';
			echo "<script>setTimeout(function(){ jQuery('[name=billing_phone]').trigger('change'); }, 1000);</script>";
		}
	}

	/**
	 * Smsalert forms function.
	 * @return void
	 */
	public function smsalert_forms( $values = '' ) {
		$users_can_register = get_option( 'woocommerce_enable_myaccount_registration', 'yes' );
		$default            = '';
		$showonly           = '';

		if ( isset( $values['default'] ) && '' !== $values['default'] ) {
			$default = $values['default'];
		}
		if ( isset( $values['showonly'] ) && '' !== $values['showonly'] ) {
			$showonly = strtolower( $values['showonly'] );
		}

		echo do_shortcode( '[woocommerce_my_account]' );

		if ( ( 'register' === $default && empty( $showonly ) ) || 'register' === $showonly ) {
			echo '<style>.signdesc,.u-column1{display:none;}.u-column2{display:block;}</style>';
		} elseif ( ( 'login' === $default && empty( $showonly ) ) || 'login' === $showonly ) {
			echo '<style>.u-column1{display:block;}.u-column2,.signdesc{display:none;}</style>';
		} elseif ( 'login,register' === $showonly || 'register,login' === $showonly ) {
			if ( 'login' === $default ) {
				echo '<style>.signdesc,.u-column1{display:block;}.u-column2{display:none;}</style>';
			} else {
				echo '<style>.signdesc,.u-column1{display:none;}.backtoLoginContainer,.u-column2{display:block;}</style>';
			}
		}

	}

	/**
	 * Modal login function
	 *
	 * @param array $attrs attrs.
	 */
	public function smsalert_modal_login( $attrs = array() ) {
		wp_enqueue_script( $this->plugin_name . 'signup_with_otp' );
		$default       = isset( $attrs['default'] ) ? $attrs['default'] : 'register';
		$showonly      = isset( $attrs['showonly'] ) ? $attrs['showonly'] : '';
		$display_style = isset( $attrs['display'] ) ? $attrs['display'] : 'center';
		$modal_id      = isset( $attrs['modal_id'] ) ? $attrs['modal_id'] : uniqid();

		$users_can_register = get_option( 'woocommerce_enable_myaccount_registration', 'yes' );
		if ( 'yes' !== $users_can_register && ( strpos( $default, 'register' ) !== false || strpos( $showonly, 'register' ) !== false ) ) {
			return; // if register disabled on myaccount page then return.
		}

		$element = 'attr-disclick="1" class="smsalert-login-modal"';

		if ( ! is_user_logged_in() ) {
			$text = ( '' !== $default ) ? ucfirst( $default ) : 'Register';
			$url  = '?default=' . esc_attr( $default ) . '&showonly=' . esc_attr( $showonly ) . '&modal_id=' . esc_attr( $modal_id );

			if ( '' !== $showonly ) {
				$text = $showonly;
			}
			$text = isset( $attrs['label'] ) ? $attrs['label'] : $text;
			?>
			
			<div  class="modal smsalert-modal smsalertModal" style="display:none;" id="<?php echo esc_attr( $modal_id ); ?>">
				<div class="modal-content">
					<div class="close"><span></span></div>
					<div class="modal-body">
						<div class="smsalert_validate_field">
							<div id="slide_form">
								<?php echo $this->smsalert_forms(); ?>
							</div>
						</div>
					</div>
				</div>
			</div>
			<?php
			return '<span href="' . esc_url( $url ) . '" ' . $element . ' data-display="' . esc_attr( $display_style ) . '" data-modal-id="' . esc_attr( $modal_id ) . '"><a href="javascript:void(0)">' . esc_attr( $text ) . '</a></span>';
		} else {
			return '';
		}
	}

	/**
	  * Function wc_user_created
	  *
	  * @param int $user_id user id.
	  * @param int $data data.
	  */
	public static function wc_user_created( $user_id, $data ) {
		$billing_phone = ( ! empty( $data['billing_phone'] ) ) ? sanitize_text_field( wp_unslash( $data['billing_phone'] ) ) : null;
		// $billing_phone = apply_filters("sa_get_user_phone_no",$user_id,$billing_phone);
		$billing_phone = SmsAlertcURLOTP::checkPhoneNos( $billing_phone );

		update_user_meta( $user_id, 'billing_phone', $billing_phone );
		do_action( 'smsalert_after_update_new_user_phone', $user_id, $billing_phone );

		self::smsalert_after_user_register( $user_id, $billing_phone );
	}

	/**
	 * This function gets role display name from system name.
	 *
	 * @param bool $system_name System name of the role.
	 */
	public static function get_user_roles( $system_name = null ) {
		global $wp_roles;
		$roles = $wp_roles->roles;

		if ( ! empty( $system_name ) && array_key_exists( $system_name, $roles ) ) {
			return $roles[ $system_name ]['name'];
		} else {
			return $roles;
		}
	}

	/**
	 * This function is executed after a user has been registered.
	 *
	 * @param int    $user_id Userid of the user.
	 * @param string $billing_phone Phone number of the user.
	 */
	public static function smsalert_after_user_register( $user_id, $billing_phone ) {
		$user                = get_userdata( $user_id );
		$role                = ( ! empty( $user->roles[0] ) ) ? $user->roles[0] : '';
		$role_display_name   = ( ! empty( $role ) ) ? self::get_user_roles( $role ) : '';
		$smsalert_reg_notify = smsalert_get_option( 'wc_user_roles_' . $role, 'smsalert_signup_general', 'off' );
		$sms_body_new_user   = smsalert_get_option( 'signup_sms_body_' . $role, 'smsalert_signup_message', SmsAlertMessages::showMessage( 'DEFAULT_NEW_USER_REGISTER' ) );

		$smsalert_reg_admin_notify = smsalert_get_option( 'admin_registration_msg', 'smsalert_general', 'off' );
		$sms_admin_body_new_user   = smsalert_get_option( 'sms_body_registration_admin_msg', 'smsalert_message', SmsAlertMessages::showMessage( 'DEFAULT_ADMIN_NEW_USER_REGISTER' ) );
		$admin_phone_number        = smsalert_get_option( 'sms_admin_phone', 'smsalert_message', '' );

		$store_name = trim( get_bloginfo() );

		if ( 'on' === $smsalert_reg_notify && ! empty( $billing_phone ) ) {
			$search = array(
				'[username]',
				'[email]',
				'[billing_phone]',
			);

			$replace           = array(
				$user->user_login,
				$user->user_email,
				$billing_phone,
			);
			$sms_body_new_user = str_replace( $search, $replace, $sms_body_new_user );
			do_action( 'sa_send_sms', $billing_phone, $sms_body_new_user );
		}

		if ( 'on' === $smsalert_reg_admin_notify && ! empty( $admin_phone_number ) ) {
			$search = array(
				'[username]',
				'[store_name]',
				'[email]',
				'[billing_phone]',
				'[role]',
			);

			$replace = array(
				$user->user_login,
				$store_name,
				$user->user_email,
				$billing_phone,
				$role_display_name,
			);

			$sms_admin_body_new_user = str_replace( $search, $replace, $sms_admin_body_new_user );
			$nos                     = explode( ',', $admin_phone_number );
			$admin_phone_number      = array_diff( $nos, array( 'postauthor', 'post_author' ) );
			$admin_phone_number      = implode( ',', $admin_phone_number );
			do_action( 'sa_send_sms', $admin_phone_number, $sms_admin_body_new_user );
		}
	}

	/**
	 * Process registration function.
	 *
	 * @param data posted data.
	 */
	public function process_registration( $data = array() ) {
		$tname = '';
		$phone = '';
		$_POST = $data;
		if ( isset( $_POST['smsalert_name'] ) ) {

			// $smsalert_reg_details = self::smsalert_get_reg_fields();
			// $mobileaccp           = $smsalert_reg_details['smsalert_reg_mobilenumber'];

			// $validation_error = new WP_Error();

			/*
			 if (isset($_POST['billing_first_name']) ) {
				$name = sanitize_text_field(wp_unslash($_POST['billing_first_name']));
			} else {
				$name = '';
			} */

			$mail = isset( $_POST['email'] ) ? sanitize_email( wp_unslash( $_POST['email'] ) ) : '';

			/*
			 $generate_pwd = get_option('woocommerce_registration_generate_password');
			if ('yes' === $generate_pwd ) {
				$password = wp_generate_password();
			} elseif (isset($_POST['password']) ) {
				$password = sanitize_text_field(wp_unslash($_POST['password']));
				if (empty($password) ) {
					$validation_error->add('Password', __('Please enter a valid Password!', 'sms-alert'));
				}
			} */

			$error = '';
			$page  = 2;

			$m  = isset( $_REQUEST['billing_phone'] ) ? sanitize_email( wp_unslash( $_REQUEST['billing_phone'] ) ) : '';
			$m2 = isset( $_REQUEST['email'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['email'] ) ) : '';

			/*
			 if (2 === $emailaccep ) {
				if (empty($mail) || ! is_email($mail) ) {
					$validation_error->add('Mail', __('Please enter a valid Email!', 'sms-alert'));
				}
			} elseif (1 === $emailaccep && ! empty($mail) ) {
				if (! is_email($mail) ) {
					$validation_error->add('Mail', __('Please enter a valid Email!', 'sms-alert'));
				}
			} */

			/*
			 if (! empty($mail) && email_exists($mail) ) {
				$validation_error->add('MailinUse', __('Email already in use!', 'sms-alert'));
			} */

			$useMobAsUname = '';
			/*
			 if (isset($_POST['username']) ) {
				$username = sanitize_text_field(wp_unslash($_POST['username']));
				if (empty($username) ) {
					$validation_error->add('Mail', __('Please enter a valid Username!', 'sms-alert'));
				}
			} */

			// important
			$mobileaccp = 1;
			if ( $mobileaccp > 0 ) {

				$m = isset( $_REQUEST['billing_phone'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['billing_phone'] ) ) : '';
				if ( is_numeric( $m ) ) {
					$m     = sanitize_text_field( $m );
					$phone = $m;

				}

				/*
				 if (empty($ulogin) ) {
					$check = username_exists($phone);
					if (! empty($check) ) {
						$validation_error->add('MobinUse', __('Mobile number already in use!', 'sms-alert'));
					} else {
						$ulogin = $phone;
					}
				} */
				$ulogin = $phone;

				// $validation_error = apply_filters('woocommerce_registration_errors', $validation_error, $ulogin, $mail);

				// if (! $validation_error->get_error_code() ) {
					$password = '';
				if ( empty( $password ) ) {
					$password = wp_generate_password();
				}
					// $ulogin       = sanitize_user($ulogin, true);
					$mail         = $ulogin . '@nomail.com';
					$new_customer = wp_create_user( $ulogin, $password, $mail );

				// }
			}
			/*
			 else {
				if (empty($password) && $password === 2 ) {
					$validation_error->add('invalidpassword', __('Invalid password', 'sms-alert'));
				} elseif (empty($password) ) {
					$password = wp_generate_password();
				}
				if (empty($ulogin) ) {
					$ulogin = strstr($mail, '@', true);
					if (username_exists($ulogin) ) {
						$validation_error->add('MailinUse', __('Email is already in use!', 'sms-alert'));
					}
				}

				if (! $validation_error->get_error_code() ) {
					$ulogin        = sanitize_user($ulogin, true);
					$new_customer  = wp_create_user($ulogin, $password, $mail);
					$login_message = "<span class='msggreen'>User registered successfully.</span>";

					$page = 1;
				} else {

				}
			}
			*/         // important

			/*
			 if ($validation_error->get_error_code() )
			{
				$e = implode('<br />', $validation_error->get_error_messages());

				wc_add_notice('<strong>' . __('Error:', 'woocommerce') . '</strong> ' . $e, 'error');

			} else
			{ */

				ini_set( 'display_errors', 1 );
				ini_set( 'display_startup_errors', 1 );
				error_reporting( E_ALL );

			if ( ! is_wp_error( $new_customer ) ) {

				$smsalert_defaultuserrole = get_option( 'smsalert_defaultuserrole', 'customer' );

				$userdata = array(
					'ID'         => $new_customer,
					'user_login' => $ulogin,
					'user_email' => $mail,
					'role'       => $smsalert_defaultuserrole,
				);

				/*
					 if (! empty($name) ) {
					$userdata['first_name']   = $name;
					$userdata['display_name'] = $name;
				} */

				$role = array(
					'ID'   => $new_customer,
					'role' => $smsalert_defaultuserrole,
				);
				/*
					 if (! empty($name) ) {
					$role['first_name']   = $name;
					$role['display_name'] = $name;

				} */

				wp_update_user( $role );

				$new_customer_data = apply_filters( 'woocommerce_new_customer_data', $userdata );
				wp_update_user( $new_customer_data );

				apply_filters( 'woocommerce_registration_auth_new_customer', true, $new_customer );
				$new_customer_data['user_pass']     = $password;
				$new_customer_data['billing_phone'] = $phone;

				do_action( 'woocommerce_created_customer', $new_customer, $new_customer_data, $password );

				// WooCommerceRegistrationForm::wc_user_created();

				// self::wc_user_created($new_customer,$new_customer_data);
				do_action( 'smsalert_user_created', $new_customer, $new_customer_data );

				wp_set_auth_cookie( $new_customer );

				/*
					 if ( ! empty( $_POST['redirect'] ) ) {
					$redirect = sanitize_text_field( wp_unslash( $_POST['redirect'] ) );
				} elseif ( wc_get_raw_referer() ) {
					$redirect = wc_get_raw_referer();
				}

				$msg             = SmsAlertUtility::_create_json_response( 'Register successful', 'success' );
				$redirect        = apply_filters( 'sa_woocommerce_regwithmob_redirect', $redirect, $new_customer );
				$msg['redirect'] = $redirect;
				wp_send_json( $msg ); */
				exit();
			} else {
				// $validation_error->add('Error', __('Please try again', 'sms-alert'));
				wp_send_json( SmsAlertUtility::_create_json_response( 'Please try again', 'success' ) );
				exit();
			}
			// }
			// unset($_POST);
		}
	}

	/**
	 * Generate random number function.
	 *
	 * @return string
	 */
	public static function generate_random_number() {
		$length       = 12;
		$return_string = wp_rand( 1, 9 );
		$srtlength    = strlen( $return_string );
		while ( $srtlength < $length ) {
			$return_string .= wp_rand( 0, 9 );
		}
		return $return_string;
	}
}
new WCSignupWithOTp();
?>