function mo_openid_pricing_info()
{
    ?>
	<td style="vertical-align:top;width:100%;">
		<div class="mo_openid_table_layout">
			<table class="mo_openid_pricing_table">
		<h2>Licensing Plans For Social Login
		<span style="float:right">
			<input type="button" name="check_plan" id="check_plan" class="button button-primary button-large" value="Check Plan" onclick="checkLicense();"/>
			<input type="button" name="ok_btn" id="ok_btn" class="button button-primary button-large" value="OK, Got It" onclick="window.location.href='admin.php?page=mo_openid_settings&tab=login'" />
		</span>
		</h2><hr>
		<tr>
			<?php 
    if (!mo_openid_is_customer_valid()) {
        ?>
			<td><div class="mo_openid_thumbnail mo_openid_pricing_free_tab" >
				<h3 class="mo_openid_pricing_header">Free</h3>
				<h4 class="mo_openid_pricing_sub_header">(You are automatically on this plan)<br/><br/></h4>
				<hr>
				<p class="mo_openid_pricing_text">$0 - One Time Payment<br/><br/><br/><br/></p>
				<hr>
				<p class="mo_openid_pricing_text">Social Sharing (Free Forever)<br/>
					Social Comments (Free Forever)<br/>
					Social Login
					(Free for 30 days)<br/></p>
					<p><br/><br/></p>
					<p><br/></p><br/></p>
				<hr/>
				<p class="mo_openid_pricing_text"><br/><br/><br/></p>
				<hr>
				<p class="mo_openid_pricing_text">Basic Support by Email<br/><br/></p>
			</div></td>
			<?php 
    }
    ?>
			<td><div class="mo_openid_thumbnail mo_openid_pricing_free_tab" <?php 
    if (mo_openid_is_customer_valid()) {
        ?>
 style="width:365px" <?php 
    }
    ?>
>
				<h3 class="mo_openid_pricing_header">Do It Yourself</h3>
				<?php 
    if (!mo_openid_is_customer_valid()) {
        ?>
				<h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
				 onclick="upgradeform('wp_social_login_basic_plan')" >Upgrade Now</a></h4>
				<?php 
    } else {
        ?>
				<h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
				 onclick="upgradeform('social_login_recharge_plan')" >Recharge Now</a></h4>
				<?php 
    }
    ?>
				<hr>
				<p class="mo_openid_pricing_text">$9 - One Time Payment<br/>+<br/>$0 - For First 10,000 Logins**<br/><br/>
					<?php 
    if (mo_openid_is_customer_valid()) {
        ?>
						Recharge Plans<br/>
						<select class="mo_openid_license_select_option" <?php 
        if (mo_openid_is_customer_valid()) {
            ?>
 style="padding-left:24% !important" <?php 
        }
        ?>
>
						    <option>&nbsp;&nbsp;&nbsp;&nbsp;$9 for 10k logins</option>
						    <option>&nbsp;&nbsp;&nbsp;$29 for 50k logins</option>
						    <option>&nbsp;&nbsp;$69 for 100k logins</option>
						    <option>&nbsp;$149 for 500k logins</option>
						    <option>$249 for 1million logins</option>
						</select>
					<?php 
    }
    ?>
				</p>
				<hr>
				<p class="mo_openid_pricing_text">
					Social Sharing<br/>
					Social Comments<br/>
					Social Login</p>
					<p><br/><br/><br/></p>
					<p><br/><br/></p>
				<hr/>
				<p class="mo_openid_pricing_text">Get access to user data like Name, Email, Username, Display Picture<br/><br/></p>
				<hr>
				<p class="mo_openid_pricing_text">Basic Support by Email<br/><br/></p>
			</div></td>
			<td><div class="mo_openid_thumbnail mo_openid_pricing_paid_tab" <?php 
    if (mo_openid_is_customer_valid()) {
        ?>
 style="width:365px" <?php 
    }
    ?>
>
				<h3 class="mo_openid_pricing_header">Best Value</h3>		
				<?php 
    if (!mo_openid_is_customer_valid() || mo_openid_is_customer_valid() && mo_openid_get_customer_plan('Do It Yourself')) {
        ?>
				<h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
				onclick="upgradeform('wp_social_login_best_value_basic_plan')" >Upgrade Now</a></h4>
				<?php 
    } else {
        ?>
				<h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
				onclick="upgradeform('social_login_recharge_plan')" >Recharge Now</a></h4>
				<?php 
    }
    ?>
				<hr>
				<p class="mo_openid_pricing_text">$19 - One Time Payment<br/>+<br/>$0 - For First 10,000 Logins**<br/><br/>
					<?php 
    if (mo_openid_is_customer_valid()) {
        ?>
						Recharge Plans<br/>
						<select class="mo_openid_license_select_option" <?php 
        if (mo_openid_is_customer_valid()) {
            ?>
 style="padding-left:24% !important" <?php 
        }
        ?>
>
						    <option>&nbsp;&nbsp;&nbsp;&nbsp;$9 for 10k logins</option>
						    <option>&nbsp;&nbsp;&nbsp;$29 for 50k logins</option>
						    <option>&nbsp;&nbsp;$69 for 100k logins</option>
						    <option>&nbsp;$149 for 500k logins</option>
						    <option>$249 for 1million logins</option>
						</select>
					<?php 
    }
    ?>
				<hr>
				<p class="mo_openid_pricing_text">
					Social Sharing<br/>
					Social Comments<br/>
					Social Login<br/>
					Extended Profile Data<br/>
					Social Analytics Dashboard Access<br/>
					Custom Apps***<br/></p>
					<p><br/><br/></p>
				<hr/>
				<p class="mo_openid_pricing_text">Get access to user data like Name, Email, Username, Display Picture and <a target="_blank" href="http://miniorange.com/social-data-from-social-sites" style="color:pink">Extended Profile Data</a></p>
				<hr>
				<p class="mo_openid_pricing_text">Premium Support<br/><br/></p>
			</div></td>
			<td><div class="mo_openid_thumbnail mo_openid_pricing_free_tab" <?php 
    if (mo_openid_is_customer_valid()) {
        ?>
 style="width:365px" <?php 
    }
    ?>
>
				<h3 class="mo_openid_pricing_header">Premium</h3>
				<?php 
    if (!mo_openid_is_customer_valid() || mo_openid_is_customer_valid() && !mo_openid_get_customer_plan('Premium')) {
        ?>
				<h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
				onclick="upgradeform('wp_social_login_premium_plan')" >Upgrade Now</a></h4>
				<?php 
    } else {
        ?>
				<h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
				onclick="upgradeform('social_login_recharge_plan')" >Recharge Now</a></h4>
				<?php 
    }
    ?>
				<hr>
				<p class="mo_openid_pricing_text">$29 - One Time Payment<br/>+<br/>$0 - For First 10,000 Logins**<br/><br/>
					<?php 
    if (mo_openid_is_customer_valid()) {
        ?>
						Recharge Plans<br/>
						<select class="mo_openid_license_select_option" <?php 
        if (mo_openid_is_customer_valid()) {
            ?>
 style="padding-left:24% !important" <?php 
        }
        ?>
>
						    <option>&nbsp;&nbsp;&nbsp;&nbsp;$9 for 10k logins</option>
						    <option>&nbsp;&nbsp;&nbsp;$29 for 50k logins</option>
						    <option>&nbsp;&nbsp;$69 for 100k logins</option>
						    <option>&nbsp;$149 for 500k logins</option>
						    <option>$249 for 1million logins</option>
						</select>
					<?php 
    }
    ?>
				<hr>
				<p class="mo_openid_pricing_text">
					Social Sharing<br/>
					Social Comments<br/>
					Social Login<br/>
					Extended Profile Data<br/>
					Social Analytics Dashboard Access<br/>
					Custom Apps***<br/>
					Custom Integration<br/><br/>
				</p>
				<hr/>
				<p class="mo_openid_pricing_text">Get access to user data like Name, Email, Username, Display Picture  and <a target="_blank" href="http://miniorange.com/social-data-from-social-sites" style="color:pink">Extended Profile Data</a></p>
				<hr>
				<p class="mo_openid_pricing_text">Premium Support<br/><br/></p>
			</div></td>
		</td>
		</tr>
		
		</table>
		<form style="display:none;" id="loginform" action="<?php 
    echo get_option('mo_openid_host_name') . '/moas/login';
    ?>
" 
		target="_blank" method="post">
		<input type="email" name="username" value="<?php 
    echo get_option('mo_openid_admin_email');
    ?>
" />
		<input type="text" name="redirectUrl" value="<?php 
    echo get_option('mo_openid_host_name') . '/moas/initializepayment';
    ?>
" />
		<input type="text" name="requestOrigin" id="requestOrigin"  />
		</form>
		<form method="post" id="checkLicenseForm">
			<input type="hidden" name="option" value="mo_openid_check_license">
		</form>
		<script>
			function upgradeform(planType){
				jQuery('#requestOrigin').val(planType);
				jQuery('#loginform').submit();
			}
			function checkLicense(){
				jQuery("#checkLicenseForm").submit();
			}
		</script>
		<p><span style="color:rgba(255, 0, 0, 0.76);font-weight:bold;">* Free for 30 days</span> - The plugin uses miniOrange service for Social Login. This keeps the plugin light and delegates login to miniOrange servers thereby reducing the load on your website.</p>
		<p>** Recharge Plans for logins available in all paid plans.</p>
		<p>*** Configuring applications for Social Media is cumbersome due to which miniOrange takes care of configuring these apps. If you still wish you use your own applications for Social Login apps, custom apps can be configured for each Social Media in Best Value and Premium plans.</p>

		<h3>Steps to upgrade to premium plugin -</h3>
		<p>1. You will be redirected to miniOrange Login Console. Enter your password with which you created an account with us. After that you will be redirected to payment page.</p>
		<p>2. Enter you card details and complete the payment. On successful payment completion, you will see your payment listed in the Payment History.</p>
		<p>3. Coming back to the plugin, on License Plans page click on <i>Check Plan</i> on top-right of the listed payment plans.</p>
		<br>
		</div>
	</td>
<?php 
}
 function miniorange_openid_save_settings()
 {
     if (is_admin() && get_option('Activated_Plugin') == 'Plugin-Slug') {
         delete_option('Activated_Plugin');
         update_option('mo_openid_message', 'Go to plugin <b><a href="admin.php?page=mo_openid_settings">settings</a></b> to enable Social Login, Social Sharing by miniOrange.');
         add_action('admin_notices', array($this, 'mo_openid_activation_message'));
     }
     if (isset($_POST['option']) and $_POST['option'] == "mo_openid_connect_register_customer") {
         //register the admin to miniOrange
         //validation and sanitization
         $email = '';
         $phone = '';
         $password = '';
         $confirmPassword = '';
         $illegal = "#\$%^*()+=[]';,/{}|:<>?~";
         $illegal = $illegal . '"';
         if ($this->mo_openid_check_empty_or_null($_POST['email']) || $this->mo_openid_check_empty_or_null($_POST['password']) || $this->mo_openid_check_empty_or_null($_POST['confirmPassword'])) {
             update_option('mo_openid_message', 'All the fields are required. Please enter valid entries.');
             $this->mo_openid_show_error_message();
             return;
         } else {
             if (strlen($_POST['password']) < 6 || strlen($_POST['confirmPassword']) < 6) {
                 //check password is of minimum length 6
                 update_option('mo_openid_message', 'Choose a password with minimum length 6.');
                 $this->mo_openid_show_error_message();
                 return;
             } else {
                 if (strpbrk($_POST['email'], $illegal)) {
                     update_option('mo_openid_message', 'Please match the format of Email. No special characters are allowed.');
                     $this->mo_openid_show_error_message();
                     return;
                 } else {
                     $email = sanitize_email($_POST['email']);
                     $phone = sanitize_text_field($_POST['phone']);
                     $password = sanitize_text_field($_POST['password']);
                     $confirmPassword = sanitize_text_field($_POST['confirmPassword']);
                 }
             }
         }
         update_option('mo_openid_admin_email', $email);
         update_option('mo_openid_admin_phone', $phone);
         if (strcmp($password, $confirmPassword) == 0) {
             update_option('mo_openid_admin_password', $password);
             $customer = new CustomerOpenID();
             $content = json_decode($customer->check_customer(), true);
             if (strcasecmp($content['status'], 'CUSTOMER_NOT_FOUND') == 0) {
                 $content = json_decode($customer->send_otp_token('EMAIL'), true);
                 if (strcasecmp($content['status'], 'SUCCESS') == 0) {
                     if (get_option('mo_openid_email_otp_count')) {
                         update_option('mo_openid_email_otp_count', get_option('mo_openid_email_otp_count') + 1);
                         update_option('mo_openid_message', 'Another One Time Passcode has been sent <b>( ' . get_option('mo_openid_email_otp_count') . ' )</b> for verification to ' . get_option('mo_openid_admin_email'));
                     } else {
                         update_option('mo_openid_message', ' A passcode is sent to ' . get_option('mo_openid_admin_email') . '. Please enter the otp here to verify your email.');
                         update_option('mo_openid_email_otp_count', 1);
                     }
                     update_option('mo_openid_transactionId', $content['txId']);
                     update_option('mo_openid_registration_status', 'MO_OTP_DELIVERED_SUCCESS');
                     $this->mo_openid_show_success_message();
                 } else {
                     update_option('mo_openid_message', 'There was an error in sending email. Please click on Resend OTP to try again.');
                     update_option('mo_openid_registration_status', 'MO_OTP_DELIVERED_FAILURE');
                     $this->mo_openid_show_error_message();
                 }
             } else {
                 $this->get_current_customer();
             }
         } else {
             update_option('mo_openid_message', 'Passwords do not match.');
             delete_option('mo_openid_verify_customer');
             $this->mo_openid_show_error_message();
         }
     } else {
         if (isset($_POST['option']) and $_POST['option'] == "mo_openid_validate_otp") {
             //validation and sanitization
             $otp_token = '';
             if ($this->mo_openid_check_empty_or_null($_POST['otp_token'])) {
                 update_option('mo_openid_message', 'Please enter a value in OTP field.');
                 update_option('mo_openid_registration_status', 'MO_OTP_VALIDATION_FAILURE');
                 $this->mo_openid_show_error_message();
                 return;
             } else {
                 if (!preg_match('/^[0-9]*$/', $_POST['otp_token'])) {
                     update_option('mo_openid_message', 'Please enter a valid value in OTP field.');
                     update_option('mo_openid_registration_status', 'MO_OTP_VALIDATION_FAILURE');
                     $this->mo_openid_show_error_message();
                     return;
                 } else {
                     $otp_token = sanitize_text_field($_POST['otp_token']);
                 }
             }
             $customer = new CustomerOpenID();
             $content = json_decode($customer->validate_otp_token(get_option('mo_openid_transactionId'), $otp_token), true);
             if (strcasecmp($content['status'], 'SUCCESS') == 0) {
                 $this->create_customer();
             } else {
                 update_option('mo_openid_message', 'Invalid one time passcode. Please enter a valid passcode.');
                 update_option('mo_openid_registration_status', 'MO_OTP_VALIDATION_FAILURE');
                 $this->mo_openid_show_error_message();
             }
         } else {
             if (isset($_POST['option']) and $_POST['option'] == 'mo_openid_phone_verification') {
                 //at registration time
                 $phone = sanitize_text_field($_POST['phone_number']);
                 $phone = str_replace(' ', '', $phone);
                 update_option('mo_openid_admin_phone', $phone);
                 $auth_type = 'SMS';
                 $customer = new CustomerOpenID();
                 $send_otp_response = json_decode($customer->send_otp_token($auth_type), true);
                 if (strcasecmp($send_otp_response['status'], 'SUCCESS') == 0) {
                     //Save txId
                     update_option('mo_openid_transactionId', $send_otp_response['txId']);
                     update_option('mo_openid_registration_status', 'MO_OTP_DELIVERED_SUCCESS');
                     if (get_option('mo_openid_sms_otp_count')) {
                         update_option('mo_openid_sms_otp_count', get_option('mo_openid_sms_otp_count') + 1);
                         update_option('mo_openid_message', 'Another One Time Passcode has been sent <b>( ' . get_option('mo_openid_sms_otp_count') . ' )</b> for verification to ' . $phone);
                     } else {
                         update_option('mo_openid_message', 'One Time Passcode has been sent for verification to ' . $phone);
                         update_option('mo_openid_sms_otp_count', 1);
                     }
                     $this->mo_openid_show_success_message();
                 } else {
                     update_option('mo_openid_message', 'There was an error in sending sms. Please click on Resend OTP link next to phone number textbox.');
                     update_option('mo_openid_registration_status', 'MO_OTP_DELIVERED_FAILURE');
                     $this->mo_openid_show_error_message();
                 }
             } else {
                 if (isset($_POST['option']) and $_POST['option'] == "mo_openid_connect_verify_customer") {
                     //register the admin to miniOrange
                     //validation and sanitization
                     $email = '';
                     $password = '';
                     $illegal = "#\$%^*()+=[]';,/{}|:<>?~";
                     $illegal = $illegal . '"';
                     if ($this->mo_openid_check_empty_or_null($_POST['email']) || $this->mo_openid_check_empty_or_null($_POST['password'])) {
                         update_option('mo_openid_message', 'All the fields are required. Please enter valid entries.');
                         $this->mo_openid_show_error_message();
                         return;
                     } else {
                         if (strpbrk($_POST['email'], $illegal)) {
                             update_option('mo_openid_message', 'Please match the format of Email. No special characters are allowed.');
                             $this->mo_openid_show_error_message();
                             return;
                         } else {
                             $email = sanitize_email($_POST['email']);
                             $password = sanitize_text_field($_POST['password']);
                         }
                     }
                     update_option('mo_openid_admin_email', $email);
                     update_option('mo_openid_admin_password', $password);
                     $customer = new CustomerOpenID();
                     $content = $customer->get_customer_key();
                     $customerKey = json_decode($content, true);
                     if (json_last_error() == JSON_ERROR_NONE) {
                         update_option('mo_openid_admin_customer_key', $customerKey['id']);
                         update_option('mo_openid_admin_api_key', $customerKey['apiKey']);
                         update_option('mo_openid_customer_token', $customerKey['token']);
                         update_option('mo_openid_admin_phone', $customerKey['phone']);
                         update_option('mo_openid_admin_password', '');
                         update_option('mo_openid_message', 'Your account has been retrieved successfully.');
                         delete_option('mo_openid_verify_customer');
                         $this->mo_openid_show_success_message();
                     } else {
                         update_option('mo_openid_message', 'Invalid username or password. Please try again.');
                         $this->mo_openid_show_error_message();
                     }
                     update_option('mo_openid_admin_password', '');
                 } else {
                     if (isset($_POST['option']) and $_POST['option'] == 'mo_openid_forgot_password') {
                         $email = get_option('mo_openid_admin_email');
                         $customer = new CustomerOpenID();
                         $content = json_decode($customer->forgot_password($email), true);
                         if (strcasecmp($content['status'], 'SUCCESS') == 0) {
                             update_option('mo_openid_message', 'You password has been reset successfully. Please enter the new password sent to your registered mail here.');
                             $this->mo_openid_show_success_message();
                         } else {
                             update_option('mo_openid_message', 'An error occured while processing your request. Please try again.');
                             $this->mo_openid_show_error_message();
                         }
                     } else {
                         if (isset($_POST['option']) and $_POST['option'] == 'mo_openid_check_license') {
                             $customer = new CustomerOpenID();
                             $content = json_decode($customer->check_customer_valid(), true);
                             if (strcasecmp($content['status'], 'SUCCESS') == 0) {
                                 update_option('mo_openid_admin_customer_valid', strcasecmp($content['licenseType'], 'Premium') !== FALSE ? 1 : 0);
                                 update_option('mo_openid_admin_customer_plan', isset($content['licensePlan']) ? base64_encode($content['licensePlan']) : 0);
                                 if (get_option('mo_openid_admin_customer_valid') && isset($content['licensePlan'])) {
                                     $license = array();
                                     $license = explode(' -', $content['licensePlan']);
                                     $lp = $license[0];
                                     update_option('mo_openid_message', 'You are on ' . $lp . '.');
                                 } else {
                                     update_option('mo_openid_message', 'You are on Free Plan.');
                                 }
                                 $this->mo_openid_show_success_message();
                             } else {
                                 update_option('mo_openid_message', 'An error occured while processing your request. Please try again.');
                                 $this->mo_openid_show_error_message();
                             }
                         } else {
                             if (isset($_POST['option']) and $_POST['option'] == "mo_openid_enable_apps") {
                                 if (mo_openid_is_customer_registered()) {
                                     update_option('mo_openid_google_enable', isset($_POST['mo_openid_google_enable']) ? $_POST['mo_openid_google_enable'] : 0);
                                     update_option('mo_openid_salesforce_enable', isset($_POST['mo_openid_salesforce_enable']) ? $_POST['mo_openid_salesforce_enable'] : 0);
                                     update_option('mo_openid_facebook_enable', isset($_POST['mo_openid_facebook_enable']) ? $_POST['mo_openid_facebook_enable'] : 0);
                                     update_option('mo_openid_linkedin_enable', isset($_POST['mo_openid_linkedin_enable']) ? $_POST['mo_openid_linkedin_enable'] : 0);
                                     update_option('mo_openid_windowslive_enable', isset($_POST['mo_openid_windowslive_enable']) ? $_POST['mo_openid_windowslive_enable'] : 0);
                                     update_option('mo_openid_amazon_enable', isset($_POST['mo_openid_amazon_enable']) ? $_POST['mo_openid_amazon_enable'] : 0);
                                     update_option('mo_openid_instagram_enable', isset($_POST['mo_openid_instagram_enable']) ? $_POST['mo_openid_instagram_enable'] : 0);
                                     update_option('mo_openid_twitter_enable', isset($_POST['mo_openid_twitter_enable']) ? $_POST['mo_openid_twitter_enable'] : 0);
                                     update_option('mo_openid_vkontakte_enable', isset($_POST['mo_openid_vkontakte_enable']) ? $_POST['mo_openid_vkontakte_enable'] : 0);
                                     update_option('mo_openid_default_login_enable', isset($_POST['mo_openid_default_login_enable']) ? $_POST['mo_openid_default_login_enable'] : 0);
                                     update_option('mo_openid_default_register_enable', isset($_POST['mo_openid_default_register_enable']) ? $_POST['mo_openid_default_register_enable'] : 0);
                                     update_option('mo_openid_default_comment_enable', isset($_POST['mo_openid_default_comment_enable']) ? $_POST['mo_openid_default_comment_enable'] : 0);
                                     update_option('mo_openid_woocommerce_login_form', isset($_POST['mo_openid_woocommerce_login_form']) ? $_POST['mo_openid_woocommerce_login_form'] : 0);
                                     //Redirect URL
                                     update_option('mo_openid_login_redirect', $_POST['mo_openid_login_redirect']);
                                     update_option('mo_openid_login_redirect_url', $_POST['mo_openid_login_redirect_url']);
                                     //Logout Url
                                     update_option('mo_openid_logout_redirection_enable', isset($_POST['mo_openid_logout_redirection_enable']) ? $_POST['mo_openid_logout_redirection_enable'] : 0);
                                     update_option('mo_openid_logout_redirect', $_POST['mo_openid_logout_redirect']);
                                     update_option('mo_openid_logout_redirect_url', $_POST['mo_openid_logout_redirect_url']);
                                     //auto register
                                     update_option('mo_openid_auto_register_enable', isset($_POST['mo_openid_auto_register_enable']) ? $_POST['mo_openid_auto_register_enable'] : 0);
                                     update_option('mo_openid_register_disabled_message', $_POST['mo_openid_register_disabled_message']);
                                     //Customized text
                                     update_option('mo_openid_login_widget_customize_text', $_POST['mo_openid_login_widget_customize_text']);
                                     update_option('mo_openid_login_button_customize_text', $_POST['mo_openid_login_button_customize_text']);
                                     update_option('mo_openid_login_theme', $_POST['mo_openid_login_theme']);
                                     update_option('mo_openid_message', 'Your settings are saved successfully.');
                                     //customization of icons
                                     update_option('mo_login_icon_custom_size', $_POST['mo_login_icon_custom_size']);
                                     update_option('mo_login_icon_space', $_POST['mo_login_icon_space']);
                                     update_option('mo_login_icon_custom_width', $_POST['mo_login_icon_custom_width']);
                                     update_option('mo_login_icon_custom_height', $_POST['mo_login_icon_custom_height']);
                                     update_option('mo_openid_login_custom_theme', $_POST['mo_openid_login_custom_theme']);
                                     update_option('mo_login_icon_custom_color', $_POST['mo_login_icon_custom_color']);
                                     update_option('mo_login_icon_custom_boundary', $_POST['mo_login_icon_custom_boundary']);
                                     // avatar
                                     update_option('moopenid_social_login_avatar', isset($_POST['moopenid_social_login_avatar']) ? $_POST['moopenid_social_login_avatar'] : 0);
                                     if (mo_openid_is_customer_valid() && !mo_openid_get_customer_plan('Do It Yourself')) {
                                         //Attribute collection
                                         update_option('moopenid_user_attributes', isset($_POST['moopenid_user_attributes']) ? $_POST['moopenid_user_attributes'] : 0);
                                     }
                                     $this->mo_openid_show_success_message();
                                 } else {
                                     update_option('mo_openid_message', 'Please register an account before trying to enable any app');
                                     $this->mo_openid_show_error_message();
                                 }
                             } else {
                                 if (isset($_POST['option']) and $_POST['option'] == "mo_openid_save_comment_settings") {
                                     if (mo_openid_is_customer_registered()) {
                                         //commenting
                                         update_option('mo_openid_social_comment_fb', isset($_POST['mo_openid_social_comment_fb']) ? $_POST['mo_openid_social_comment_fb'] : 0);
                                         update_option('mo_openid_social_comment_google', isset($_POST['mo_openid_social_comment_google']) ? $_POST['mo_openid_social_comment_google'] : 0);
                                         update_option('mo_openid_social_comment_default', isset($_POST['mo_openid_social_comment_default']) ? $_POST['mo_openid_social_comment_default'] : 0);
                                         //comment position
                                         update_option('mo_openid_social_comment_blogpost', isset($_POST['mo_openid_social_comment_blogpost']) ? $_POST['mo_openid_social_comment_blogpost'] : 0);
                                         update_option('mo_openid_social_comment_static', isset($_POST['mo_openid_social_comment_static']) ? $_POST['mo_openid_social_comment_static'] : 0);
                                         //comment labels
                                         update_option('mo_openid_social_comment_default_label', $_POST['mo_openid_social_comment_default_label']);
                                         update_option('mo_openid_social_comment_fb_label', $_POST['mo_openid_social_comment_fb_label']);
                                         update_option('mo_openid_social_comment_google_label', $_POST['mo_openid_social_comment_google_label']);
                                         update_option('mo_openid_social_comment_heading_label', $_POST['mo_openid_social_comment_heading_label']);
                                         update_option('mo_openid_message', 'Your settings are saved successfully.');
                                         $this->mo_openid_show_success_message();
                                     } else {
                                         update_option('mo_openid_message', 'Please register an account before trying to enable any app');
                                         $this->mo_openid_show_error_message();
                                     }
                                 } else {
                                     if (isset($_POST['option']) and $_POST['option'] == "mo_openid_contact_us_query_option") {
                                         // Contact Us query
                                         $email = $_POST['mo_openid_contact_us_email'];
                                         $phone = $_POST['mo_openid_contact_us_phone'];
                                         $query = $_POST['mo_openid_contact_us_query'];
                                         $customer = new CustomerOpenID();
                                         if ($this->mo_openid_check_empty_or_null($email) || $this->mo_openid_check_empty_or_null($query)) {
                                             update_option('mo_openid_message', 'Please fill up Email and Query fields to submit your query.');
                                             $this->mo_openid_show_error_message();
                                         } else {
                                             $submited = $customer->submit_contact_us($email, $phone, $query);
                                             if ($submited == false) {
                                                 update_option('mo_openid_message', 'Your query could not be submitted. Please try again.');
                                                 $this->mo_openid_show_error_message();
                                             } else {
                                                 update_option('mo_openid_message', 'Thanks for getting in touch! We shall get back to you shortly.');
                                                 $this->mo_openid_show_success_message();
                                             }
                                         }
                                     } else {
                                         if (isset($_POST['option']) and $_POST['option'] == "mo_openid_resend_otp") {
                                             $customer = new CustomerOpenID();
                                             $content = json_decode($customer->send_otp_token('EMAIL'), true);
                                             if (strcasecmp($content['status'], 'SUCCESS') == 0) {
                                                 if (get_option('mo_openid_email_otp_count')) {
                                                     update_option('mo_openid_email_otp_count', get_option('mo_openid_email_otp_count') + 1);
                                                     update_option('mo_openid_message', 'Another One Time Passcode has been sent <b>( ' . get_option('mo_openid_email_otp_count') . ' )</b> for verification to ' . get_option('mo_openid_admin_email'));
                                                 } else {
                                                     update_option('mo_openid_message', ' A passcode is sent to ' . get_option('mo_openid_admin_email') . '. Please enter the otp here to verify your email.');
                                                     update_option('mo_openid_email_otp_count', 1);
                                                 }
                                                 update_option('mo_openid_transactionId', $content['txId']);
                                                 update_option('mo_openid_registration_status', 'MO_OTP_DELIVERED_SUCCESS');
                                                 $this->mo_openid_show_success_message();
                                             } else {
                                                 update_option('mo_openid_message', 'There was an error in sending email. Please click on Resend OTP to try again.');
                                                 update_option('mo_openid_registration_status', 'MO_OTP_DELIVERED_FAILURE');
                                                 $this->mo_openid_show_error_message();
                                             }
                                         } else {
                                             if (isset($_POST['option']) and $_POST['option'] == "mo_openid_go_back") {
                                                 update_option('mo_openid_registration_status', '');
                                                 delete_option('mo_openid_new_registration');
                                                 delete_option('mo_openid_admin_email');
                                                 delete_option('mo_openid_sms_otp_count');
                                                 delete_option('mo_openid_email_otp_count');
                                             } else {
                                                 if (isset($_POST['option']) and $_POST['option'] == "mo_openid_go_back_login") {
                                                     update_option('mo_openid_registration_status', '');
                                                     delete_option('mo_openid_admin_email');
                                                     delete_option('mo_openid_admin_phone');
                                                     delete_option('mo_openid_admin_password');
                                                     delete_option('mo_openid_admin_customer_key');
                                                     delete_option('mo_openid_verify_customer');
                                                 } else {
                                                     if (isset($_POST['option']) and $_POST['option'] == "mo_openid_go_back_registration") {
                                                         update_option('mo_openid_verify_customer', 'true');
                                                     } else {
                                                         if (isset($_POST['option']) and $_POST['option'] == "mo_openid_save_other_settings") {
                                                             if (mo_openid_is_customer_registered()) {
                                                                 update_option('mo_openid_google_share_enable', isset($_POST['mo_openid_google_share_enable']) ? $_POST['mo_openid_google_share_enable'] : 0);
                                                                 update_option('mo_openid_facebook_share_enable', isset($_POST['mo_openid_facebook_share_enable']) ? $_POST['mo_openid_facebook_share_enable'] : 0);
                                                                 update_option('mo_openid_linkedin_share_enable', isset($_POST['mo_openid_linkedin_share_enable']) ? $_POST['mo_openid_linkedin_share_enable'] : 0);
                                                                 update_option('mo_openid_reddit_share_enable', isset($_POST['mo_openid_reddit_share_enable']) ? $_POST['mo_openid_reddit_share_enable'] : 0);
                                                                 update_option('mo_openid_pinterest_share_enable', isset($_POST['mo_openid_pinterest_share_enable']) ? $_POST['mo_openid_pinterest_share_enable'] : 0);
                                                                 update_option('mo_openid_twitter_share_enable', isset($_POST['mo_openid_twitter_share_enable']) ? $_POST['mo_openid_twitter_share_enable'] : 0);
                                                                 update_option('mo_openid_tumblr_share_enable', isset($_POST['mo_openid_tumblr_share_enable']) ? $_POST['mo_openid_tumblr_share_enable'] : 0);
                                                                 update_option('mo_openid_delicious_share_enable', isset($_POST['mo_openid_delicious_share_enable']) ? $_POST['mo_openid_delicious_share_enable'] : 0);
                                                                 update_option('mo_openid_vkontakte_share_enable', isset($_POST['mo_openid_vkontakte_share_enable']) ? $_POST['mo_openid_vkontakte_share_enable'] : 0);
                                                                 update_option('mo_openid_stumble_share_enable', isset($_POST['mo_openid_stumble_share_enable']) ? $_POST['mo_openid_stumble_share_enable'] : 0);
                                                                 update_option('mo_openid_odnoklassniki_share_enable', isset($_POST['mo_openid_odnoklassniki_share_enable']) ? $_POST['mo_openid_odnoklassniki_share_enable'] : 0);
                                                                 update_option('mo_openid_digg_share_enable', isset($_POST['mo_openid_digg_share_enable']) ? $_POST['mo_openid_digg_share_enable'] : 0);
                                                                 update_option('mo_openid_pocket_share_enable', isset($_POST['mo_openid_pocket_share_enable']) ? $_POST['mo_openid_pocket_share_enable'] : 0);
                                                                 update_option('mo_share_options_enable_home_page', isset($_POST['mo_share_options_home_page']) ? $_POST['mo_share_options_home_page'] : 0);
                                                                 update_option('mo_share_options_enable_post', isset($_POST['mo_share_options_post']) ? $_POST['mo_share_options_post'] : 0);
                                                                 update_option('mo_share_options_enable_static_pages', isset($_POST['mo_share_options_static_pages']) ? $_POST['mo_share_options_static_pages'] : 0);
                                                                 update_option('mo_share_options_wc_sp_summary', isset($_POST['mo_share_options_wc_sp_summary']) ? $_POST['mo_share_options_wc_sp_summary'] : 0);
                                                                 update_option('mo_share_options_wc_sp_summary_top', isset($_POST['mo_share_options_wc_sp_summary_top']) ? $_POST['mo_share_options_wc_sp_summary_top'] : 0);
                                                                 update_option('mo_share_options_enable_post_position', $_POST['mo_share_options_enable_post_position']);
                                                                 update_option('mo_share_options_home_page_position', $_POST['mo_share_options_home_page_position']);
                                                                 update_option('mo_share_options_static_pages_position', $_POST['mo_share_options_static_pages_position']);
                                                                 update_option('mo_openid_share_theme', $_POST['mo_openid_share_theme']);
                                                                 update_option('mo_share_vertical_hide_mobile', isset($_POST['mo_share_vertical_hide_mobile']) ? $_POST['mo_share_vertical_hide_mobile'] : 0);
                                                                 update_option('mo_openid_share_widget_customize_text', $_POST['mo_openid_share_widget_customize_text']);
                                                                 update_option('mo_openid_share_twitter_username', sanitize_text_field($_POST['mo_openid_share_twitter_username']));
                                                                 update_option('mo_openid_share_widget_customize_direction_horizontal', isset($_POST['mo_openid_share_widget_customize_direction_horizontal']) ? $_POST['mo_openid_share_widget_customize_direction_horizontal'] : 0);
                                                                 update_option('mo_openid_share_widget_customize_direction_vertical', isset($_POST['mo_openid_share_widget_customize_direction_vertical']) ? $_POST['mo_openid_share_widget_customize_direction_vertical'] : 0);
                                                                 update_option('mo_sharing_icon_custom_size', isset($_POST['mo_sharing_icon_custom_size']) ? $_POST['mo_sharing_icon_custom_size'] : 35);
                                                                 update_option('mo_sharing_icon_custom_color', $_POST['mo_sharing_icon_custom_color']);
                                                                 update_option('mo_openid_share_custom_theme', $_POST['mo_openid_share_custom_theme']);
                                                                 update_option('mo_sharing_icon_custom_font', $_POST['mo_sharing_icon_custom_font']);
                                                                 update_option('mo_sharing_icon_space', $_POST['mo_sharing_icon_space']);
                                                                 update_option('mo_openid_message', 'Your settings are saved successfully.');
                                                                 $this->mo_openid_show_success_message();
                                                             } else {
                                                                 update_option('mo_openid_message', 'Please register an account before trying to enable any app');
                                                                 $this->mo_openid_show_error_message();
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }