Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2023-4916: login-with-phonenumber.php in login-with-phone-number/trunk – WordPress Plugin Repository

The Login with phone number plugin for WordPress is vulnerable to Cross-Site Request Forgery in versions up to, and including, 1.4.8. This is due to missing nonce validation on the ‘lwp_update_password_action’ function. This makes it possible for unauthenticated attackers to change user password via a forged request granted they can trick a site administrator into performing an action such as clicking on a link.

CVE
#web#mac#google#js#git#java#wordpress#php#auth#mongo#sap

1<?php2/*3Plugin Name: Login with phone number4Plugin URI: http://idehweb.com/login-with-phone-number5Description: Login with phone number - sending sms - activate user by phone number - limit pages to login - register and login with ajax - modal6Version: 1.5.67Author: Hamid Alinia - idehweb8Author URI: http://idehweb.com9Text Domain: login-with-phone-number10Domain Path: /languages11*/12require 'gateways/class-lwp-custom-api.php’;1314if (!defined(“ABSPATH”))15 exit;1617class idehwebLwp18{19// global $LWP_PRO;20 function __construct()21 {22// global $LWP_PRO;23// if (class_exists(LWP_PRO::class)) {24// $LWP_PRO = new LWP_PRO;25// }26 add_action('init’, array(&$this, ‘idehweb_lwp_textdomain’));27 add_action('admin_init’, array(&$this, ‘admin_init’));28 add_action('admin_menu’, array(&$this, ‘admin_menu’));29 add_action('wp_enqueue_scripts’, array(&$this, ‘enqueue_scripts’));30 add_action('wp_ajax_idehweb_lwp_auth_customer’, array(&$this, ‘idehweb_lwp_auth_customer’));31 add_action('wp_ajax_idehweb_lwp_auth_customer_with_website’, array(&$this, ‘idehweb_lwp_auth_customer_with_website’));32 add_action('wp_ajax_idehweb_lwp_activate_customer’, array(&$this, ‘idehweb_lwp_activate_customer’));33 add_action('wp_ajax_idehweb_lwp_update_billing_phones’, array(&$this, ‘idehweb_lwp_update_billing_phones’));34 add_action('wp_ajax_idehweb_lwp_check_credit’, array(&$this, ‘idehweb_lwp_check_credit’));35 add_action('wp_ajax_idehweb_lwp_get_shop’, array(&$this, ‘idehweb_lwp_get_shop’));36 add_action('wp_ajax_lwp_ajax_login’, array(&$this, ‘lwp_ajax_login’));37 add_action('wp_ajax_lwp_update_password_action’, array(&$this, ‘lwp_update_password_action’));38 add_action('wp_ajax_lwp_enter_password_action’, array(&$this, ‘lwp_enter_password_action’));39 add_action('wp_ajax_lwp_ajax_login_with_email’, array(&$this, ‘lwp_ajax_login_with_email’));40 add_action('wp_ajax_lwp_ajax_register’, array(&$this, ‘lwp_ajax_register’));41 add_action('wp_ajax_lwp_forgot_password’, array(&$this, ‘lwp_forgot_password’));42 add_action('wp_ajax_lwp_verify_domain’, array(&$this, ‘lwp_verify_domain’));43 add_action('wp_ajax_nopriv_lwp_verify_domain’, array(&$this, ‘lwp_verify_domain’));44 add_action('wp_ajax_nopriv_lwp_ajax_login’, array(&$this, ‘lwp_ajax_login’));45 add_action('wp_ajax_nopriv_lwp_ajax_login_with_email’, array(&$this, ‘lwp_ajax_login_with_email’));46 add_action('wp_ajax_nopriv_lwp_ajax_register’, array(&$this, ‘lwp_ajax_register’));47 add_action('wp_ajax_nopriv_lwp_update_password_action’, array(&$this, ‘lwp_update_password_action’));48 add_action('wp_ajax_nopriv_lwp_enter_password_action’, array(&$this, ‘lwp_enter_password_action’));49 add_action('wp_ajax_nopriv_lwp_forgot_password’, array(&$this, ‘lwp_forgot_password’));50 add_action('activated_plugin’, array(&$this, ‘lwp_activation_redirect’));5152 add_action('admin_enqueue_scripts’, array(&$this, ‘lwp_load_wp_media_files’));53 add_action('wp_ajax_lwp_media_get_image’, array(&$this, ‘lwp_media_get_image’));5455 add_action('show_user_profile’, array(&$this, ‘lwp_add_phonenumber_field’));56 add_action('edit_user_profile’, array(&$this, ‘lwp_add_phonenumber_field’));5758 add_action('personal_options_update’, array(&$this, ‘lwp_update_phonenumber_field’));59 add_action('edit_user_profile_update’, array(&$this, ‘lwp_update_phonenumber_field’));6061 add_action('wp_head’, array(&$this, ‘lwp_custom_css’));6263// add_action('admin_bar_menu’, array(&$this, ‘credit_adminbar’), 100);64// add_action('login_enqueue_scripts’, array(&$this, ‘admin_custom_css’));656667 add_action('rest_api_init’, array(&$this, ‘lwp_register_rest_route’));68 add_filter('manage_users_columns’, array(&$this, ‘lwp_modify_user_table’));69 add_filter('manage_users_custom_column’, array(&$this, ‘lwp_modify_user_table_row’), 10, 3);70 add_filter('manage_users_sortable_columns’, array(&$this, ‘lwp_make_registered_column_sortable’));71 add_filter('woocommerce_locate_template’, array(&$this, ‘lwp_addon_woocommerce_login’), 1, 3);727374 add_shortcode('idehweb_lwp’, array(&$this, ‘shortcode’));75 add_shortcode('idehweb_lwp_metas’, array(&$this, ‘idehweb_lwp_metas’));7677 }7879 function lwp_load_wp_media_files($page)80 {81// echo $page;82 if ($page == ‘login-setting_page_idehweb-lwp-styles’) {83 wp_enqueue_media();84 // Enqueue custom script that will interact with wp.media85 wp_enqueue_script('idehweb-lwp-admin-media-script’, plugins_url('/scripts/lwp-admin.js’, __FILE__), array(‘jquery’), true, true);8687 }88 }8990 function lwp_media_get_image($page)91 {92 if (isset($_GET[‘id’])) {93 $image = wp_get_attachment_image(filter_input(INPUT_GET, 'id’, FILTER_VALIDATE_INT), 'medium’, false, array(‘id’ => ‘myprefix-preview-image’));94 $data = array(95 ‘image’ => $image,96 );97 wp_send_json_success($data);98 } else {99 wp_send_json_error();100 }101 }102103 function lwp_add_phonenumber_field($user)104 {105 $phn = get_the_author_meta('phone_number’, $user->ID);106 ?>107 <h3><?php esc_html_e('Personal Information’, ‘login-with-phone-number’); ?></h3>108109 <table class="form-table">110 <tr>111 <th><label for="phone_number"><?php esc_html_e('phone_number’, ‘login-with-phone-number’); ?></label>112 </th>113 <td>114 <input type="text"115116 step="1"117 id="phone_number"118 name="phone_number"119 value="<?php echo esc_attr($phn); ?>"120 class="regular-text"121 />122123 </td>124 </tr>125 </table>126 <?php127 }128129 function lwp_update_phonenumber_field($user_id)130 {131 if (!current_user_can('edit_user’, $user_id)) {132 return false;133 }134 $phone_number = sanitize_text_field($_POST[‘phone_number’]);135 update_user_meta($user_id, 'phone_number’, $phone_number);136 }137138 function lwp_activation_redirect($plugin)139 {140 if ($plugin == plugin_basename(__FILE__)) {141 exit(wp_redirect(admin_url(‘admin.php?page=idehweb-lwp’)));142 }143 }144145 function idehweb_lwp_textdomain()146 {147 $idehweb_lwp_lang_dir = dirname(plugin_basename(__FILE__)) . '/languages/’;148 $idehweb_lwp_lang_dir = apply_filters('idehweb_lwp_languages_directory’, $idehweb_lwp_lang_dir);149150 load_plugin_textdomain('login-with-phone-number’, false, $idehweb_lwp_lang_dir);151152153 }154155 function admin_init()156 {157 $options = get_option(‘idehweb_lwp_settings’);158// print_r($options);159 $style_options = get_option(‘idehweb_lwp_settings_styles’);160// print_r($style_options);161162 if (!isset($options[‘idehweb_token’])) $options[‘idehweb_token’] = '’;163 if (!isset($style_options[‘idehweb_styles_status’])) $style_options[‘idehweb_styles_status’] = '0’;164165 register_setting('idehweb-lwp’, 'idehweb_lwp_settings’, array(&$this, ‘settings_validate’));166 register_setting('idehweb-lwp-styles’, 'idehweb_lwp_settings_styles’, array(&$this, ‘settings_validate’));167 register_setting('idehweb-lwp-localization’, 'idehweb_lwp_settings_localization’, array(&$this, ‘settings_validate’));168169 add_settings_section('idehweb-lwp-styles’, '’, array(&$this, ‘section_intro’), ‘idehweb-lwp-styles’);170 add_settings_section('idehweb-lwp-localization’, '’, array(&$this, ‘section_intro’), ‘idehweb-lwp-localization’);171 add_settings_field('idehweb_styles_status’, __('Enable custom styles’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_enable_custom_style’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);172173 if ($style_options[‘idehweb_styles_status’]) {174// add_settings_field('idehweb_styles_title1’, 'tyuiuy’, array(&$this, ‘section_title’), ‘idehweb-lwp-styles’);175 add_settings_field('idehweb_styles_logo’, __('Logo’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_logo’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);176 add_settings_field('idehweb_styles_title’, __('Primary button’, ‘login-with-phone-number’), array(&$this, ‘section_title’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);177 add_settings_field('idehweb_styles_button_background’, __('button background color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_button_background_color’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);178 add_settings_field('idehweb_styles_button_border_color’, __('button border color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_button_border_color’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);179 add_settings_field('idehweb_styles_button_border_radius’, __('button border radius’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_button_border_radius’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);180 add_settings_field('idehweb_styles_button_border_width’, __('button border width’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_button_border_width’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);181 add_settings_field('idehweb_styles_button_text_color’, __('button text color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_button_text_color’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);182183// add_settings_section('idehweb_styles_title2’, '’, array(&$this, ‘section_title’), ‘idehweb-lwp-styles’);184 add_settings_field('idehweb_styles_title2’, __('Secondary button’, ‘login-with-phone-number’), array(&$this, ‘section_title’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);185186 add_settings_field('idehweb_styles_button_background2’, __('secondary button background color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_button_background_color2’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);187 add_settings_field('idehweb_styles_button_border_color2’, __('secondary button border color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_button_border_color2’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);188 add_settings_field('idehweb_styles_button_border_radius2’, __('secondary button border radius’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_button_border_radius2’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);189 add_settings_field('idehweb_styles_button_border_width2’, __('secondary button border width’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_button_border_width2’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);190 add_settings_field('idehweb_styles_button_text_color2’, __('secondary button text color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_button_text_color2’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);191192193 add_settings_field('idehweb_styles_title3’, __('Inputs’, ‘login-with-phone-number’), array(&$this, ‘section_title’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);194195 add_settings_field('idehweb_styles_input_background’, __('input background color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_input_background_color’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);196 add_settings_field('idehweb_styles_input_border_color’, __('input border color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_input_border_color’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);197 add_settings_field('idehweb_styles_input_border_radius’, __('input border radius’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_input_border_radius’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);198 add_settings_field('idehweb_styles_input_border_width’, __('input border width’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_input_border_width’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);199 add_settings_field('idehweb_styles_input_text_color’, __('input text color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_input_text_color’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);200 add_settings_field('idehweb_styles_input_placeholder_color’, __('input placeholder color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_input_placeholder_color’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);201202 add_settings_field('idehweb_styles_title4’, __('Box’, ‘login-with-phone-number’), array(&$this, ‘section_title’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);203 add_settings_field('idehweb_styles_box_background_color’, __('box background color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_box_background_color’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);204 add_settings_field('idehweb_position_form’, __('Enable fix position’, ‘login-with-phone-number’), array(&$this, ‘idehweb_position_form’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);205206207 add_settings_field('idehweb_styles_title5’, __('Labels’, ‘login-with-phone-number’), array(&$this, ‘section_title’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);208 add_settings_field('idehweb_styles_labels_text_color’, __('label text color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_labels_text_color’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);209 add_settings_field('idehweb_styles_labels_font_size’, __('label font size’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_labels_font_size’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);210211212 add_settings_field('idehweb_styles_title6’, __('Titles’, ‘login-with-phone-number’), array(&$this, ‘section_title’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);213 add_settings_field('idehweb_styles_title_color’, __('title color’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_title_color’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);214 add_settings_field('idehweb_styles_title_font_size’, __('title font size’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_style_title_font_size’), 'idehweb-lwp-styles’, 'idehweb-lwp-styles’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);215216217 }218219 add_settings_section('idehweb-lwp’, '’, array(&$this, ‘section_intro’), ‘idehweb-lwp’);220221 add_settings_field('idehweb_sms_login’, __('Enable phone number login’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_sms_login’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);222223 $ghgfd = '’;224 if ($options[‘idehweb_token’]) {225 $ghgfd = ' none’;226 }227// add_settings_field('idehweb_phone_number_ccode’, __('Enter your Country Code’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_phone_number’), 'idehweb-lwp’, 'idehweb-lwp’, [‘class’ => ‘ilwplabel lwp_phone_number_label related_to_login’ . $ghgfd]);228// add_settings_field('idehweb_phone_number’, __('Enter your phone number’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_phone_number’), 'idehweb-lwp’, 'idehweb-lwp’, [‘class’ => ‘ilwplabel lwp_phone_number_label related_to_login’ . $ghgfd]);229 add_settings_field('idehweb_website_url’, __('Enter your website url’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_website_url’), 'idehweb-lwp’, 'idehweb-lwp’, [‘class’ => ‘ilwplabel lwp_website_label related_to_login’ . $ghgfd]);230// if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = '’;231 add_settings_field('idehweb_token’, __('Enter api key’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_token’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel alwaysDisplayNone’]);232 add_settings_field('idehweb_country_codes’, __('Country code accepted in front’, ‘login-with-phone-number’), array(&$this, ‘setting_country_code’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_login’]);233 add_settings_field('idehweb_country_codes_default’, __('Default Country’, ‘login-with-phone-number’), array(&$this, ‘setting_country_code_default’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_login’]);234 if ($options[‘idehweb_token’]) {235236 add_settings_field('idehweb_sms_shop’, __('Buy credit here’, ‘login-with-phone-number’), array(&$this, ‘setting_buy_credit’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_login rltll’]);237 }238 add_settings_field('idehweb_use_custom_gateway’, __('use custom sms gateway’, ‘login-with-phone-number’), array(&$this, ‘setting_use_custom_gateway’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_login’]);239 add_settings_field('idehweb_default_gateways’, __('sms default gateway’, ‘login-with-phone-number’), array(&$this, ‘setting_default_gateways’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_defaultgateway’]);240241 add_settings_field('idehweb_firebase_api’, __('Firebase api’, ‘login-with-phone-number’), array(&$this, ‘setting_firebase_api’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_firebase’]);242 add_settings_field('idehweb_firebase_config’, __('Firebase config’, ‘login-with-phone-number’), array(&$this, ‘setting_firebase_config’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_firebase’]);243244 add_settings_field('idehweb_custom_api_url’, __('Custom api url’, ‘login-with-phone-number’), array(&$this, ‘setting_custom_api_url’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_custom’]);245 add_settings_field('idehweb_custom_api_method’, __('Custom api method’, ‘login-with-phone-number’), array(&$this, ‘setting_custom_api_method’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_custom’]);246 add_settings_field('idehweb_custom_api_header’, __('Custom api header’, ‘login-with-phone-number’), array(&$this, ‘setting_custom_api_header’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_custom’]);247 add_settings_field('idehweb_custom_api_body’, __('Custom api body’, ‘login-with-phone-number’), array(&$this, ‘setting_custom_api_body’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_custom’]);248 add_settings_field('idehweb_custom_api_smstext’, __('Custom api sms text’, ‘login-with-phone-number’), array(&$this, ‘setting_custom_api_smstext’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_custom’]);249250 add_settings_field('idehweb_lwp_space’, __('’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_lwp_space’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel idehweb_lwp_mgt100’]);251 add_settings_field('idehweb_email_login’, __('Enable email login’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_email_login’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);252 add_settings_field('idehweb_lwp_space2’, __('’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_lwp_space’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel idehweb_lwp_mgt100’]);253254 add_settings_field('idehweb_user_registration’, __('Enable user registration’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_user_registration’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);255 add_settings_field('idehweb_password_login’, __('Enable password login’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_password_login’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);256 add_settings_field('idehweb_redirect_url’, __('Enter redirect url’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_url_redirect’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);257 add_settings_field('idehweb_login_message’, __('Enter login message’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_login_message’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);258 add_settings_field('idehweb_use_phone_number_for_username’, __('use phone number for username’, ‘login-with-phone-number’), array(&$this, ‘idehweb_use_phone_number_for_username’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);259 add_settings_field('idehweb_default_username’, __('Default username’, ‘login-with-phone-number’), array(&$this, ‘setting_default_username’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_upnfu’]);260 add_settings_field('idehweb_default_nickname’, __('Default nickname’, ‘login-with-phone-number’), array(&$this, ‘setting_default_nickname’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_upnfu’]);261 add_settings_field('idehweb_enable_timer_on_sending_sms’, __('Enable timer’, ‘login-with-phone-number’), array(&$this, ‘idehweb_enable_timer_on_sending_sms’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => 'ilwplabel ']);262 add_settings_field('idehweb_timer_count’, __('Timer count’, ‘login-with-phone-number’), array(&$this, ‘setting_timer_count’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel related_to_entimer’]);263 add_settings_field('idehweb_enable_accept_terms_and_condition’, __('Enable accept term & conditions’, ‘login-with-phone-number’), array(&$this, ‘idehweb_enable_accept_term_and_conditions’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => 'ilwplabel ']);264 add_settings_field('idehweb_term_and_conditions_text’, __('Text of term & conditions part’, ‘login-with-phone-number’), array(&$this, ‘setting_term_and_conditions_text’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => 'ilwplabel ']);265 add_settings_field('idehweb_term_and_conditions_link’, __('Link of term & conditions’, ‘login-with-phone-number’), array(&$this, ‘setting_term_and_conditions_link’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => 'ilwplabel ']);266 add_settings_field('idehweb_term_and_conditions_default_checked’, __('Check term & conditions by default?’, ‘login-with-phone-number’), array(&$this, ‘setting_term_and_conditions_default_checked’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => 'ilwplabel ']);267268 add_settings_field('idehweb_lwp_space3’, __('’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_lwp_space’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel idehweb_lwp_mgt100’]);269 add_settings_field('instructions’, __('Shortcode and Template Tag’, ‘login-with-phone-number’), array(&$this, ‘setting_instructions’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);270 add_settings_field('idehweb_online_support’, __('Enable online support’, ‘login-with-phone-number’), array(&$this, ‘idehweb_online_support’), 'idehweb-lwp’, 'idehweb-lwp’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);271272273 add_settings_field('idehweb_localization_status’, __('Enable localization’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_localization_enable_custom_localization’), 'idehweb-lwp-localization’, 'idehweb-lwp-localization’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);274 add_settings_field('idehweb_localization_title_of_login_form’, __('Title of login form (with phone number)', ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_localization_of_login_form’), 'idehweb-lwp-localization’, 'idehweb-lwp-localization’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);275 add_settings_field('idehweb_localization_title_of_login_form1’, __('Title of login form (with email)', ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_localization_of_login_form_email’), 'idehweb-lwp-localization’, 'idehweb-lwp-localization’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);276 add_settings_field('idehweb_localization_placeholder_of_phonenumber_field’, __('Placeholder of phone number field’, ‘login-with-phone-number’), array(&$this, ‘setting_idehweb_localization_placeholder_of_phonenumber_field’), 'idehweb-lwp-localization’, 'idehweb-lwp-localization’, [‘label_for’ => '’, ‘class’ => ‘ilwplabel’]);277278 }279280 function admin_menu()281 {282283 $icon_url = 'dashicons-smartphone’;284 $page_hook = add_menu_page(285 __('login setting’, ‘login-with-phone-number’),286 __('login setting’, ‘login-with-phone-number’),287 'manage_options’,288 'idehweb-lwp’,289 array(&$this, ‘settings_page’),290 $icon_url291 );292 $page_hook_styles = add_submenu_page('idehweb-lwp’, __('Style settings’, ‘login-with-phone-number’), __('Style Settings’, ‘login-with-phone-number’), 'manage_options’, 'idehweb-lwp-styles’, array(&$this, ‘style_settings_page’));293 add_submenu_page('idehweb-lwp’, __('Text & localization’, ‘login-with-phone-number’), __('Text & localization’, ‘login-with-phone-number’), 'manage_options’, 'idehweb-lwp-localization’, array(&$this, ‘localization_settings_page’));294 add_action('admin_print_styles-' . $page_hook, array(&$this, ‘admin_custom_css’));295 add_action('admin_print_styles-' . $page_hook_styles, array(&$this, ‘admin_custom_css’));296 wp_enqueue_script('idehweb-lwp-admin-select2-js’, plugins_url('/scripts/select2.full.min.js’, __FILE__), array(‘jquery’), true, true);297 wp_enqueue_script('idehweb-lwp-admin-chat-js’, plugins_url('/scripts/chat.js’, __FILE__), array(‘jquery’), true, true);298299 }300301 function admin_custom_css()302 {303 wp_enqueue_style('idehweb-lwp-admin’, plugins_url('/styles/lwp-admin.css’, __FILE__));304 wp_enqueue_style('idehweb-lwp-admin-select2-style’, plugins_url('/styles/select2.min.css’, __FILE__));305306307 }308309 function settings_page()310 {311 $options = get_option(‘idehweb_lwp_settings’);312 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = '’;313 if (!isset($options[‘idehweb_token’])) $options[‘idehweb_token’] = '’;314 if (!isset($options[‘idehweb_online_support’])) $options[‘idehweb_online_support’] = '1’;315316317 ?>318 <div class="wrap">319 <div class="lwp-wrap-left">320321322 <div id="icon-themes" class="icon32"></div>323 <h2><?php _e('idehwebLwp Settings’, ‘login-with-phone-number’); ?></h2>324 <?php if (isset($_GET[‘settings-updated’]) && $_GET[‘settings-updated’]) {325326 ?>327 <div id="setting-error-settings_updated" class="updated settings-error">328 <p><strong><?php _e('Settings saved.’, ‘login-with-phone-number’); ?></strong></p>329 </div>330 <?php } ?>331 <form action="options.php" method="post" id="iuytfrdghj" class="lwp-setting-page-main">332 <?php settings_fields(‘idehweb-lwp’); ?>333 <?php do_settings_sections(‘idehweb-lwp’); ?>334335 <p class="submit">336 <span id="wkdugchgwfchevg3r4r"></span>337 </p>338 <p class="submit">339 <span id="oihdfvygehv"></span>340 </p>341 <p class="submit">342343 <input type="submit" class="button-primary"344 value="<?php _e('Save Changes’, ‘login-with-phone-number’); ?>"/></p>345346 <?php347 if (empty($options[‘idehweb_token’])) {348 ?>349350 <?php } ?>351 </form>352 </div>353 <?php354 if (!class_exists(LWP_PRO::class)) {355356 ?>357 <div class="lwp-wrap-right">358 <a href="https://idehweb.com/product/login-with-phone-number-in-wordpress/" target="_blank">359 <img style="width: 100%;max-width: 100%"360 src="<?php echo plugins_url('/images/login-with-phone-number-wordpress-buy-pro-version.png’, __FILE__) ?>"/>361 </a>362363 <a style="margin-top: 10px;display:block"364 href="https://idehweb.com/product/whatsap-gateway-for-login-with-phone-number/" target="_blank">365 <img style="width: 100%;max-width: 100%"366 src="<?php echo plugins_url('/images/whatsapp-gateway-banner.webp’, __FILE__) ?>"/>367 </a>368369 <a style="margin-top: 10px;display:block"370 href="https://idehweb.com/product/nodeeweb-wordpress-theme/" target="_blank">371 <img style="width: 100%;max-width: 100%"372 src="<?php echo plugins_url('/images/nodeeweb-wordpress-theme.png’, __FILE__) ?>"/>373 </a>374 </div>375 <?php } ?>376 <?php377 if ($options[‘idehweb_online_support’] == ‘1’) {378 ?>379 <script type="text/javascript">window.makecrispactivate = 1;</script>380 <?php } ?>381382 <script>383 <?php384385 ?>386 jQuery(function ($) {387 var idehweb_country_codes = $(“#idehweb_country_codes”);388 var idehweb_phone_number_ccodeG = '1’;389 $(window).load(function () {390391 $(‘.loiuyt’).click();392 $(‘.refreshShop’).click();393 $(“#idehweb_phone_number_ccode”).select2();394 idehweb_country_codes.select2();395 $(“#idehweb_default_gateways”).select2();396397398 <?php399 if (empty($options[‘idehweb_token’])) {400 ?>401 $(‘.authwithwebsite’).click();402 <?php } ?>403404 });405406 var edf = $(‘#idehweb_lwp_settings_idehweb_sms_login’);407 var edf2 = $(‘#idehweb_lwp_settings_use_phone_number_for_username’);408 var edf3 = $(‘#idehweb_lwp_settings_use_custom_gateway’);409 var edf4 = $(‘#idehweb_default_gateways’);410 var edf5 = $(‘#idehweb_lwp_settings_enable_timer_on_sending_sms’);411 var idehweb_body = $(‘body’);412 var related_to_login = $(‘.related_to_login’);413 var related_to_upnfu = $(‘.related_to_upnfu’);414 var related_to_entimer = $(‘.related_to_entimer’);415 var related_to_defaultgateway = $(‘.related_to_defaultgateway’);416 var related_to_customgateway = $(‘.related_to_customgateway’);417418 var related_to_firebase = $(‘.related_to_firebase’);419 var related_to_custom = $(‘.related_to_custom’);420421422 var default_gateways = edf4.val();423 if (!(default_gateways instanceof Array)) {424 default_gateways = [];425 }426427 if (edf.is(‘:checked’)) {428 related_to_login.css('display’, ‘table-row’);429 // $(“#idehweb_phone_number_ccode”).chosen();430431432 } else {433434 related_to_login.css('display’, ‘none’);435 }436437438 if (edf2.is(‘:checked’)) {439 // console.log(‘is checked!’);440 // $(“#idehweb_phone_number_ccode”).chosen();441 related_to_upnfu.css('display’, ‘none’);442443444 } else {445 // console.log(‘is not checked!’);446 related_to_upnfu.css('display’, ‘table-row’);447448 }449 if (edf5.is(‘:checked’)) {450 // console.log(‘is checked!’);451 // $(“#idehweb_phone_number_ccode”).chosen();452453 related_to_entimer.css('display’, ‘table-row’);454455 } else {456 // console.log(‘is not checked!’);457 related_to_entimer.css('display’, ‘none’);458459 }460461 if (edf3.is(‘:checked’)) {462 // console.log(‘is checked!’);463 // $(“#idehweb_phone_number_ccode”).chosen();464 related_to_defaultgateway.css('display’, ‘table-row’);465 $(‘.rltll’).css('display’, ‘none’);466467468 } else {469 // console.log(‘is not checked!’);470 related_to_defaultgateway.css('display’, ‘none’);471472473 }474475 if (default_gateways.includes(‘custom’) && edf3.is(‘:checked’)) {476 // console.log(‘is checked!’);477 // $(“#idehweb_phone_number_ccode”).chosen();478 related_to_customgateway.css('display’, ‘table-row’);479480481 } else {482 // console.log(‘is not checked!’);483 related_to_customgateway.css('display’, ‘none’);484485486 }487488 if (default_gateways.includes(‘firebase’) && edf3.is(‘:checked’)) {489 // console.log(‘is checked!’);490 // $(“#idehweb_phone_number_ccode”).chosen();491 related_to_firebase.css('display’, ‘table-row’);492493494 } else {495 // console.log(‘is not checked!’);496 related_to_firebase.css('display’, ‘none’);497498499 }500501502 if (default_gateways.includes(‘custom’) && edf3.is(‘:checked’)) {503 // console.log(‘is checked!’);504 // $(“#idehweb_phone_number_ccode”).chosen();505 related_to_custom.css('display’, ‘table-row’);506507508 } else {509 // console.log(‘is not checked!’);510 related_to_custom.css('display’, ‘none’);511512513 }514 $(‘#idehweb_lwp_settings_idehweb_sms_login’).change(515 function () {516 if (this.checked && this.value == ‘1’) {517 // console.log(‘change is checked!’);518519 related_to_login.css('display’, ‘table-row’);520 // $(“#idehweb_phone_number_ccode”).chosen();521522 } else {523 // console.log(‘change is not checked!’);524525 related_to_login.css('display’, ‘none’);526 }527 });528 $(‘#idehweb_lwp_settings_use_phone_number_for_username’).change(529 function () {530 if (this.checked && this.value == ‘1’) {531 // console.log(‘change is checked!’);532533 // $(“#idehweb_phone_number_ccode”).chosen();534 related_to_upnfu.css('display’, ‘none’);535536 } else {537 // console.log(‘change is not checked!’);538 related_to_upnfu.css('display’, ‘table-row’);539540 }541 });542 $(‘#idehweb_lwp_settings_use_custom_gateway’).change(543 function () {544 $(‘#idehweb_default_gateways’).trigger(‘change’);545 if (this.checked && this.value == ‘1’) {546 // console.log(‘change is checked!’);547548 // $(“#idehweb_phone_number_ccode”).chosen();549 related_to_defaultgateway.css('display’, ‘table-row’);550 $(‘.rltll’).css('display’, ‘none’);551552 } else {553 // console.log(‘change is not checked!’);554 $(‘.rltll’).css('display’, ‘table-row’);555556 related_to_defaultgateway.css('display’, ‘none’);557558 }559 });560561 $(‘#idehweb_lwp_settings_enable_timer_on_sending_sms’).change(562 function () {563 if (this.checked && this.value == ‘1’) {564 // console.log(‘change is checked!’);565566 // $(“#idehweb_phone_number_ccode”).chosen();567 related_to_entimer.css('display’, ‘table-row’);568569 } else {570 // console.log(‘change is not checked!’);571 related_to_entimer.css('display’, ‘none’);572573 }574 });575 //576 $(‘#idehweb_default_gateways’).on('change’, function (e) {577 var data = $(“#idehweb_default_gateways”).select2(‘data’);578 data = data.map((item) => {579 return item.id580 })581 console.log('this.value’, data);582 if (!(data instanceof Array)) {583 data = [];584 }585 if (data.includes(“custom”) && edf3.is(‘:checked’)) {586587 related_to_customgateway.css('display’, ‘table-row’);588 related_to_firebase.css('display’, ‘none’);589 related_to_custom.css('display’, ‘table-row’);590591592 }593 else if (data.includes(“firebase”) && edf3.is(‘:checked’)) {594 related_to_customgateway.css('display’, ‘none’);595 related_to_firebase.css('display’, ‘table-row’);596 related_to_custom.css('display’, ‘none’);597598599 }600 else {601602 related_to_customgateway.css('display’, ‘none’);603 related_to_firebase.css('display’, ‘none’);604 related_to_custom.css('display’, ‘none’);605606607 }608 });609 idehweb_body.on('click’, '.loiuyt’,610 function () {611612 $.ajax({613 type: “GET",614 url: ajaxurl,615 data: {action: 'idehweb_lwp_check_credit’}616 }).done(function (msg) {617 var arr = JSON.parse(msg);618 // console.log(arr);619 $(‘.creditor .cp’).html('<?php _e(‘Your Credit:’, ‘login-with-phone-number’) ?>’ + ' ' + arr[‘credit’])620621622 });623624 });625 idehweb_body.on('click’, ‘.refreshShop’,626 function () {627 var lwp_token = $(‘#lwp_token’).val();628 if (lwp_token) {629 $.ajax({630 type: “GET",631 url: ajaxurl,632 data: {action: 'idehweb_lwp_get_shop’}633 }).done(function (msg) {634 if (msg) {635 var arr = JSON.parse(msg);636 if (arr && arr.products) {637 $(‘.chargeAccount’).empty();638 for (var j = 0; j < arr.products.length; j++) {639 $(‘.chargeAccount’).append(‘<div class="col-lg-2 col-md-4 col-sm-6">’ +640 ‘<div class="lwp-produ-wrap">’ +641 ‘<div class="lwp-shop-title">’ +642 arr.products[j].title + ' ' +643 ‘</div>’ +644 ‘<div class="lwp-shop-price">’ +645 arr.products[j].price +646 ‘</div>’ +647 ‘<div class="lwp-shop-buy">’ +648 '<a target="_blank” href="’ + arr.products[j].buy + lwp_token + ‘/’ + arr.products[j].ID + ‘">’ + ‘<?php _e("Buy", ‘login-with-phone-number’); ?>’ + ‘</a>’ +649 ‘</div>’ +650 ‘</div>’ +651 '</div>’652 )653654 }655 }656 }657658 });659 }660661 });662 idehweb_body.on('click’, '.auth’,663 function () {664 var lwp_phone_number = $(‘#lwp_phone_number’).val();665 var idehweb_phone_number_ccode = $(‘#idehweb_phone_number_ccode’).val();666 idehweb_phone_number_ccodeG = idehweb_phone_number_ccode;667 // alert(idehweb_phone_number_ccode);668 // return;669 if (lwp_phone_number) {670 lwp_phone_number = lwp_phone_number.replace(/^0+/, ‘’);671 $(‘.lwp_phone_number_label th’).html(‘enter code messaged to you!’);672 $(‘#lwp_phone_number’).css('display’, ‘none’);673 $(‘#lwp_secod’).css('display’, ‘inherit’);674 $(‘.i34’).css('display’, ‘inline-block’);675 $(‘.i35’).css('display’, ‘none’);676 $(‘.idehweb_phone_number_ccode_wrap’).css('display’, ‘none’);677 // $(‘#lwp_secod’).html(‘enter code messaged to you!’);678 lwp_phone_number = idehweb_phone_number_ccode + lwp_phone_number;679 $.ajax({680 type: “GET",681 url: ajaxurl,682 data: {683 action: 'idehweb_lwp_auth_customer’,684 phone_number: lwp_phone_number,685 country_code: idehweb_phone_number_ccode686 }687 }).done(function (msg) {688 if (msg) {689 var arr = JSON.parse(msg);690 // console.log(arr);691 }692 // $(‘form#iuytfrdghj’).submit();693694 });695696 }697 });698699 idehweb_body.on('click’, '.authwithwebsite’,700 function () {701 var lwp_token = $(‘#lwp_token’).val();702 // if(!lwp_token) {703 var lwp_website_url = $(‘#lwp_website_url’).val();704 if (lwp_website_url) {705 // lwp_phone_number = lwp_phone_number.replace(/^0+/, ‘’);706 // $(‘.lwp_phone_number_label th’).html(‘enter code messaged to you!’);707 // $(‘#lwp_phone_number’).css('display’, ‘none’);708 // $(‘#lwp_secod’).css('display’, ‘inherit’);709 // $(‘.i34’).css('display’, ‘inline-block’);710 // $(‘.i35’).css('display’, ‘none’);711 // $(‘.idehweb_phone_number_ccode_wrap’).css('display’, ‘none’);712 // $(‘#lwp_secod’).html(‘enter code messaged to you!’);713 // lwp_phone_number = idehweb_phone_number_ccode + lwp_phone_number;714 $(‘.lwp_website_label’).fadeOut();715716 setTimeout(function () {717 $(‘.lwploadr’).fadeOut();718719 }, 2000)720 $.ajax({721 type: “GET",722 url: ajaxurl,723 data: {724 action: 'idehweb_lwp_auth_customer_with_website’,725 url: lwp_website_url726 }727 }).done(function (msg) {728 if (msg) {729 var arr = JSON.parse(msg);730 // console.log(arr);731 if (arr && arr[‘success’]) {732 if (arr[‘token’]) {733 $(‘#lwp_token’).val(arr[‘token’]);734 setTimeout(function () {735 $(‘form#iuytfrdghj’).submit();736737 }, 500)738 }739 } else {740 if (arr[‘err’] && arr[‘err’][‘response’] && arr[‘err’][‘response’][‘request’] && arr[‘err’][‘response’][‘request’][‘uri’] && arr[‘err’][‘response’][‘request’][‘uri’][‘host’] === ‘localhost’) {741 $(‘.lwpmaintextloader’).html(‘authentication on localhost not accepted. please use with your domain!’);742743 }744745 }746 }747748 // $(‘form#iuytfrdghj’).submit();749750 });751 // .((e)=>{752 // console.log('e’,e);753 // });754755 }756 // }757 });758 idehweb_body.on('click’, '.lwpchangePhoneNumber’,759 function (e) {760 e.preventDefault();761 $(‘.lwp_phone_number_label’).removeClass(‘none’);762 $(‘#lwp_phone_number’).focus();763 // $(“#idehweb_phone_number_ccode”).chosen();764765 });766 idehweb_body.on('click’, '.lwp_more_help’, function () {767 createTutorial();768 });769 idehweb_body.on('click’, '.lwp_close , .lwp_button’, function (e) {770 e.preventDefault();771 $(‘.lwp_modal’).remove();772 $(‘.lwp_modal_overlay’).remove();773 localStorage.setItem('ldwtutshow’, 1);774 });775 idehweb_body.on('click’, '.activate’,776 function (e) {777 e.preventDefaults();778 var lwp_phone_number = $(‘#lwp_phone_number’).val();779 var lwp_secod = $(‘#lwp_secod’).val();780 var idehweb_phone_number_ccode = $(‘#idehweb_phone_number_ccode’).val();781782 if (lwp_phone_number && lwp_secod && idehweb_phone_number_ccode) {783 lwp_phone_number = lwp_phone_number.replace(/^0+/, ‘’);784 lwp_phone_number = idehweb_phone_number_ccode + lwp_phone_number;785 $.ajax({786 type: “GET",787 url: ajaxurl,788 data: {789 action: 'idehweb_lwp_activate_customer’, phone_number: lwp_phone_number,790 secod: lwp_secod791 }792 }).done(function (msg) {793 if (msg) {794 var arr = JSON.parse(msg);795 // console.log(arr);796 if (arr[‘token’]) {797 $(‘#lwp_token’).val(arr[‘token’]);798 //799 // idehweb_country_codes.val([idehweb_phone_number_ccodeG]); // Select the option with a value of '1’800 // idehweb_country_codes.trigger(‘change’);801802 // $(‘#idehweb_country_codes’).val(arr[‘token’]);803 setTimeout(function () {804 $(‘form#iuytfrdghj’).submit();805806 }, 500)807 }808 }809 });810811 }812 });813 idehweb_body.on('click’, ‘.idehweb_lwp_update_billing_phones’,814 function () {815816 $.ajax({817 type: “GET",818 url: ajaxurl,819 data: {820 action: 'idehweb_lwp_update_billing_phones’821822 }823 }).done(function (msg) {824 if (msg) {825 console.log('msg’, msg)826 var arr = JSON.parse(msg);827828829 }830 });831 });832 var ldwtutshow = localStorage.getItem(‘ldwtutshow’);833 if (ldwtutshow === null) {834 // localStorage.setItem('ldwtutshow’, 1);835 // Show popup here836 // $(‘#myModal’).modal(‘show’);837 // console.log(‘set here’);838 createTutorial();839 }840841 function createTutorial() {842 var wrap = $(‘.wrap’);843 wrap.prepend(‘<div class="lwp_modal_overlay"></div>’)844 .prepend(‘<div class="lwp_modal">’ +845 ‘<div class="lwp_modal_header">’ +846 ‘<div class="lwp_l"></div>’ +847 ‘<div class="lwp_r"><button class="lwp_close">x</button></div>’ +848 ‘</div>’ +849 ‘<div class="lwp_modal_body">’ +850 ‘<ul>’ +851 ‘<li>’ + ‘<?php _e("1. create a page and name it login or register or what ever", ‘login-with-phone-number’) ?>’ + ‘</li>’ +852 ‘<li>’ + ‘<?php _e("2. copy this shortcode <code>[idehweb_lwp]</code> and paste in the page you created at step 1", ‘login-with-phone-number’) ?>’ + ‘</li>’ +853 ‘<li>’ + ‘<?php _e("3. now, that is your login page. check your login page with other device or browser that you are not logged in!", ‘login-with-phone-number’) ?>’ +854 ‘</li>’ +855 ‘<li>’ +856 ‘<?php _e("for more information visit: ", ‘login-with-phone-number’) ?>’ + '<a target="_blank” href="https://idehweb.com/product/login-with-phone-number-in-wordpress/?lang=en">Idehweb</a>’ +857 ‘</li>’ +858 ‘</ul>’ +859 ‘</div>’ +860 ‘<div class="lwp_modal_footer">’ +861 ‘<button class="lwp_button"><?php _e("got it ", ‘login-with-phone-number’) ?></button>’ +862 ‘</div>’ +863 ‘</div>’);864865 }866 });867 </script>868 </div>869 <?php870 }871872 function lwp_custom_css()873 {874 if (class_exists(LWP_PRO::class)) {875// $LWP_PRO = new LWP_PRO;876 global $LWP_PRO;877 $LWP_PRO->lwp_style();878 }879 }880881 function style_settings_page()882 {883 $options = get_option(‘idehweb_lwp_settings’);884 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = '’;885 if (!isset($options[‘idehweb_token’])) $options[‘idehweb_token’] = '’;886 if (!isset($options[‘idehweb_online_support’])) $options[‘idehweb_online_support’] = '1’;887888889 ?>890 <div class="wrap">891 <div id="icon-themes” class="icon32"></div>892 <h2><?php _e('Style settings’, ‘login-with-phone-number’); ?></h2>893 <?php if (isset($_GET[‘settings-updated’]) && $_GET[‘settings-updated’]) {894895 ?>896 <div id="setting-error-settings_updated” class="updated settings-error">897 <p><strong><?php _e('Settings saved.’, ‘login-with-phone-number’); ?></strong></p>898 </div>899 <?php } ?>900 <form action="options.php” method="post” id="iuytfrdghj">901 <?php settings_fields(‘idehweb-lwp-styles’); ?>902 <?php do_settings_sections(‘idehweb-lwp-styles’); ?>903904 <p class="submit">905 <span id="wkdugchgwfchevg3r4r"></span>906 </p>907 <p class="submit">908 <span id="oihdfvygehv"></span>909 </p>910 <p class="submit">911912 <input type="submit" class="button-primary"913 value="<?php _e('Save Changes’, ‘login-with-phone-number’); ?>"/></p>914915 </form>916917918 </div>919 <?php920 }921922 function localization_settings_page()923 {924 $options = get_option(‘idehweb_lwp_settings’);925 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = '’;926 if (!isset($options[‘idehweb_token’])) $options[‘idehweb_token’] = '’;927 if (!isset($options[‘idehweb_online_support’])) $options[‘idehweb_online_support’] = '1’;928929930 ?>931 <div class="wrap">932 <div id="icon-themes" class="icon32"></div>933 <h2><?php _e('Localization settings’, ‘login-with-phone-number’); ?></h2>934 <?php if (isset($_GET[‘settings-updated’]) && $_GET[‘settings-updated’]) {935936 ?>937 <div id="setting-error-settings_updated" class="updated settings-error">938 <p><strong><?php _e('Settings saved.’, ‘login-with-phone-number’); ?></strong></p>939 </div>940 <?php } ?>941 <form action="options.php" method="post" id="iuytfrdghj">942 <?php settings_fields(‘idehweb-lwp-localization’); ?>943 <?php do_settings_sections(‘idehweb-lwp-localization’); ?>944945 <p class="submit">946 <span id="wkdugchgwfchevg3r4r"></span>947 </p>948 <p class="submit">949 <span id="oihdfvygehv"></span>950 </p>951 <p class="submit">952953 <input type="submit" class="button-primary"954 value="<?php _e('Save Changes’, ‘login-with-phone-number’); ?>"/></p>955956 </form>957958959 </div>960 <?php961 }962963 function section_intro()964 {965 ?>966967 <?php968969 }970971 function section_title()972 {973 ?>974 <!-- jhgjk–>975976 <?php977978 }979980 function setting_idehweb_lwp_space()981 {982 echo '<div class="idehweb_lwp_mgt50"></div>’;983 }984985 function setting_idehweb_email_login()986 {987 $options = get_option(‘idehweb_lwp_settings’);988 if (!isset($options[‘idehweb_email_login’])) $options[‘idehweb_email_login’] = '1’;989 $display = 'inherit’;990 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = ‘’;991 if (!$options[‘idehweb_phone_number’]) {992 $display = ‘none’;993 }994 echo ‘<input type="hidden" name="idehweb_lwp_settings[idehweb_email_login]" value="0" />995 <label><input type="checkbox" name="idehweb_lwp_settings[idehweb_email_login]" value="1"’ . (($options[‘idehweb_email_login’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('I want user login with email’, ‘login-with-phone-number’) . '</label>’;996997 }998999 function setting_idehweb_pro_label()1000 {1001 if (!class_exists(LWP_PRO::class)) {1002 return ‘<span class="pro-not-exist">PRO</span>’;1003 }1004 }10051006 function setting_idehweb_style_enable_custom_style()1007 {1008 $options = get_option(‘idehweb_lwp_settings_styles’);1009 if (!isset($options[‘idehweb_styles_status’])) $options[‘idehweb_styles_status’] = ‘0’;1010 else $options[‘idehweb_styles_status’] = sanitize_text_field($options[‘idehweb_styles_status’]);10111012 echo ‘<input type="hidden" name="idehweb_lwp_settings_styles[idehweb_styles_status]" value="0" />1013 <label><input type="checkbox" id="idehweb_lwp_settings_idehweb_styles_status" name="idehweb_lwp_settings_styles[idehweb_styles_status]" value="1"’ . (($options[‘idehweb_styles_status’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('enable custom styles’, ‘login-with-phone-number’) . '</label>’;1014 echo $this->setting_idehweb_pro_label();1015 }101610171018 function setting_idehweb_style_button_background_color()1019 {1020 $options = get_option(‘idehweb_lwp_settings_styles’);1021 if (!isset($options[‘idehweb_styles_button_background’])) $options[‘idehweb_styles_button_background’] = '#009b9a’;1022 else $options[‘idehweb_styles_button_background’] = sanitize_text_field($options[‘idehweb_styles_button_background’]);102310241025 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_button_background]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_button_background’]) . ‘" />1026 <p class="description">’ . __('button background color’, ‘login-with-phone-number’) . '</p>’;1027 }10281029 function setting_idehweb_style_button_border_color()1030 {1031 $options = get_option(‘idehweb_lwp_settings_styles’);1032 if (!isset($options[‘idehweb_styles_button_border_color’])) $options[‘idehweb_styles_button_border_color’] = '#009b9a’;1033 else $options[‘idehweb_styles_button_border_color’] = sanitize_text_field($options[‘idehweb_styles_button_border_color’]);10341035 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_button_border_color]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_button_border_color’]) . ‘" />1036 <p class="description">’ . __('button border color’, ‘login-with-phone-number’) . '</p>’;1037 }10381039 function setting_idehweb_style_button_border_radius()1040 {1041 $options = get_option(‘idehweb_lwp_settings_styles’);1042 if (!isset($options[‘idehweb_styles_button_border_radius’])) $options[‘idehweb_styles_button_border_radius’] = 'inherit’;1043 else $options[‘idehweb_styles_button_border_radius’] = sanitize_text_field($options[‘idehweb_styles_button_border_radius’]);10441045 echo ‘<input type="text" name="idehweb_lwp_settings_styles[idehweb_styles_button_border_radius]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_button_border_radius’]) . ‘" />1046 <p class="description">’ . __('0px 0px 0px 0px’, ‘login-with-phone-number’) . '</p>’;1047 }10481049 function setting_idehweb_style_button_border_width()1050 {1051 $options = get_option(‘idehweb_lwp_settings_styles’);1052 if (!isset($options[‘idehweb_styles_button_border_width’])) $options[‘idehweb_styles_button_border_width’] = 'inherit’;1053 else $options[‘idehweb_styles_button_border_width’] = sanitize_text_field($options[‘idehweb_styles_button_border_width’]);10541055 echo ‘<input type="text" name="idehweb_lwp_settings_styles[idehweb_styles_button_border_width]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_button_border_width’]) . ‘" />1056 <p class="description">’ . __('0px 0px 0px 0px’, ‘login-with-phone-number’) . '</p>’;1057 }10581059 function setting_idehweb_style_button_text_color()1060 {1061 $options = get_option(‘idehweb_lwp_settings_styles’);1062 if (!isset($options[‘idehweb_styles_button_text_color’])) $options[‘idehweb_styles_button_text_color’] = '#ffffff’;1063 else $options[‘idehweb_styles_button_text_color’] = sanitize_text_field($options[‘idehweb_styles_button_text_color’]);10641065 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_button_text_color]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_button_text_color’]) . ‘" />1066 <p class="description">’ . __('button text color’, ‘login-with-phone-number’) . '</p>’;1067 }106810691070 function setting_idehweb_style_button_background_color2()1071 {1072 $options = get_option(‘idehweb_lwp_settings_styles’);1073 if (!isset($options[‘idehweb_styles_button_background2’])) $options[‘idehweb_styles_button_background2’] = '#009b9a’;1074 else $options[‘idehweb_styles_button_background2’] = sanitize_text_field($options[‘idehweb_styles_button_background2’]);10751076 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_button_background2]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_button_background2’]) . ‘" />1077 <p class="description">’ . __('secondary button background color’, ‘login-with-phone-number’) . '</p>’;1078 }10791080 function setting_idehweb_style_button_border_color2()1081 {1082 $options = get_option(‘idehweb_lwp_settings_styles’);1083 if (!isset($options[‘idehweb_styles_button_border_color2’])) $options[‘idehweb_styles_button_border_color2’] = '#009b9a’;1084 else $options[‘idehweb_styles_button_border_color2’] = sanitize_text_field($options[‘idehweb_styles_button_border_color2’]);10851086 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_button_border_color2]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_button_border_color2’]) . ‘" />1087 <p class="description">’ . __('secondary button border color’, ‘login-with-phone-number’) . '</p>’;1088 }10891090 function setting_idehweb_style_button_border_radius2()1091 {1092 $options = get_option(‘idehweb_lwp_settings_styles’);1093 if (!isset($options[‘idehweb_styles_button_border_radius2’])) $options[‘idehweb_styles_button_border_radius2’] = 'inherit’;1094 else $options[‘idehweb_styles_button_border_radius2’] = sanitize_text_field($options[‘idehweb_styles_button_border_radius2’]);10951096 echo ‘<input type="text" name="idehweb_lwp_settings_styles[idehweb_styles_button_border_radius2]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_button_border_radius2’]) . ‘" />1097 <p class="description">’ . __('0px 0px 0px 0px’, ‘login-with-phone-number’) . '</p>’;1098 }10991100 function setting_idehweb_style_button_border_width2()1101 {1102 $options = get_option(‘idehweb_lwp_settings_styles’);1103 if (!isset($options[‘idehweb_styles_button_border_width2’])) $options[‘idehweb_styles_button_border_width2’] = 'inherit’;1104 else $options[‘idehweb_styles_button_border_width2’] = sanitize_text_field($options[‘idehweb_styles_button_border_width2’]);1105 echo ‘<input type="text" name="idehweb_lwp_settings_styles[idehweb_styles_button_border_width2]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_button_border_width2’]) . ‘" />1106 <p class="description">’ . __('0px 0px 0px 0px’, ‘login-with-phone-number’) . '</p>’;1107 }11081109 function setting_idehweb_style_button_text_color2()1110 {1111 $options = get_option(‘idehweb_lwp_settings_styles’);1112 if (!isset($options[‘idehweb_styles_button_text_color2’])) $options[‘idehweb_styles_button_text_color2’] = '#ffffff’;1113 else $options[‘idehweb_styles_button_text_color2’] = sanitize_text_field($options[‘idehweb_styles_button_text_color2’]);1114 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_button_text_color2]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_button_text_color2’]) . ‘" />1115 <p class="description">’ . __('secondary button text color’, ‘login-with-phone-number’) . '</p>’;1116 }111711181119 function setting_idehweb_style_input_background_color()1120 {1121 $options = get_option(‘idehweb_lwp_settings_styles’);1122 if (!isset($options[‘idehweb_styles_input_background’])) $options[‘idehweb_styles_input_background’] = '#009b9a’;1123 else $options[‘idehweb_styles_input_background’] = sanitize_text_field($options[‘idehweb_styles_input_background’]);1124 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_input_background]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_input_background’]) . ‘" />1125 <p class="description">’ . __('input background color’, ‘login-with-phone-number’) . '</p>’;1126 }11271128 function setting_idehweb_style_input_border_color()1129 {1130 $options = get_option(‘idehweb_lwp_settings_styles’);1131 if (!isset($options[‘idehweb_styles_input_border_color’])) $options[‘idehweb_styles_input_border_color’] = '#009b9a’;1132 else $options[‘idehweb_styles_input_border_color’] = sanitize_text_field($options[‘idehweb_styles_input_border_color’]);11331134 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_input_border_color]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_input_border_color’]) . ‘" />1135 <p class="description">’ . __('input border color’, ‘login-with-phone-number’) . '</p>’;1136 }11371138 function setting_idehweb_style_input_border_radius()1139 {1140 $options = get_option(‘idehweb_lwp_settings_styles’);1141 if (!isset($options[‘idehweb_styles_input_border_radius’])) $options[‘idehweb_styles_input_border_radius’] = 'inherit’;1142 else $options[‘idehweb_styles_input_border_radius’] = sanitize_text_field($options[‘idehweb_styles_input_border_radius’]);1143 echo ‘<input type="text" name="idehweb_lwp_settings_styles[idehweb_styles_input_border_radius]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_input_border_radius’]) . ‘" />1144 <p class="description">’ . __('0px 0px 0px 0px’, ‘login-with-phone-number’) . '</p>’;1145 }11461147 function setting_idehweb_style_input_border_width()1148 {1149 $options = get_option(‘idehweb_lwp_settings_styles’);1150 if (!isset($options[‘idehweb_styles_input_border_width’])) $options[‘idehweb_styles_input_border_width’] = '1px’;1151 else $options[‘idehweb_styles_input_border_width’] = sanitize_text_field($options[‘idehweb_styles_input_border_width’]);11521153 echo ‘<input type="text" name="idehweb_lwp_settings_styles[idehweb_styles_input_border_width]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_input_border_width’]) . ‘" />1154 <p class="description">’ . __('0px 0px 0px 0px’, ‘login-with-phone-number’) . '</p>’;1155 }11561157 function setting_idehweb_style_input_text_color()1158 {1159 $options = get_option(‘idehweb_lwp_settings_styles’);1160 if (!isset($options[‘idehweb_styles_input_text_color’])) $options[‘idehweb_styles_input_text_color’] = '#000000’;1161 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_input_text_color]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_input_text_color’]) . ‘" />1162 <p class="description">’ . __('input text color’, ‘login-with-phone-number’) . '</p>’;1163 }11641165 function setting_idehweb_style_input_placeholder_color()1166 {1167 $options = get_option(‘idehweb_lwp_settings_styles’);1168 if (!isset($options[‘idehweb_styles_input_placeholder_color’])) $options[‘idehweb_styles_input_placeholder_color’] = '#000000’;1169 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_input_placeholder_color]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_input_placeholder_color’]) . ‘" />1170 <p class="description">’ . __('input placeholder color’, ‘login-with-phone-number’) . '</p>’;1171 }11721173 function setting_idehweb_style_box_background_color()1174 {1175 $options = get_option(‘idehweb_lwp_settings_styles’);1176 if (!isset($options[‘idehweb_styles_box_background_color’])) $options[‘idehweb_styles_box_background_color’] = '#ffffff’;1177 else $options[‘idehweb_styles_box_background_color’] = sanitize_text_field($options[‘idehweb_styles_box_background_color’]);1178 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_box_background_color]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_box_background_color’]) . ‘" />1179 <p class="description">’ . __('box background color’, ‘login-with-phone-number’) . '</p>’;1180 }11811182 function setting_idehweb_style_labels_font_size()1183 {1184 $options = get_option(‘idehweb_lwp_settings_styles’);1185 if (!isset($options[‘idehweb_styles_labels_font_size’])) $options[‘idehweb_styles_labels_font_size’] = 'inherit’;1186 else $options[‘idehweb_styles_labels_font_size’] = sanitize_text_field($options[‘idehweb_styles_labels_font_size’]);11871188 echo ‘<input type="text" name="idehweb_lwp_settings_styles[idehweb_styles_labels_font_size]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_labels_font_size’]) . ‘" />1189 <p class="description">’ . __('13px’, ‘login-with-phone-number’) . '</p>’;1190 }11911192 function setting_idehweb_style_labels_text_color()1193 {1194 $options = get_option(‘idehweb_lwp_settings_styles’);1195 if (!isset($options[‘idehweb_styles_labels_text_color’])) $options[‘idehweb_styles_labels_text_color’] = '#000000’;1196 else $options[‘idehweb_styles_labels_text_color’] = sanitize_text_field($options[‘idehweb_styles_labels_text_color’]);11971198 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_labels_text_color]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_labels_text_color’]) . ‘" />1199 <p class="description">’ . __('label text color’, ‘login-with-phone-number’) . '</p>’;1200 }12011202 function setting_idehweb_style_logo()1203 {1204 $options = get_option(‘idehweb_lwp_settings_styles’);1205 if (!isset($options[‘idehweb_styles_logo’])) $options[‘idehweb_styles_logo’] = '’;1206 else $options[‘idehweb_styles_logo’] = sanitize_text_field($options[‘idehweb_styles_logo’]);1207 $image_id = $options[‘idehweb_styles_logo’];1208 if (intval($image_id) > 0) {1209 // Change with the image size you want to use1210 $image = wp_get_attachment_image($image_id, 'medium’, false, array(‘id’ => ‘lwp_media-preview-image’));1211 } else {1212 // Some default image1213 $image = ‘<img id="lwp_media-preview-image" src="’ . plugins_url('/images/default-logo.png’, __FILE__) . ‘" />’;1214 }1215 echo $image; ?>1216 <input type="hidden" name="idehweb_lwp_settings_styles[idehweb_styles_logo]" id="lwp_media_image_id"1217 value="<?php echo esc_attr($image_id); ?>" class="regular-text"/>1218 <input type=’button’ class="button-primary"1219 value="<?php esc_attr_e('Select an image’, ‘login-with-phone-number’); ?>"1220 id="lwp_media_media_manager"/> <?php1221// echo ‘<input type="text" name="idehweb_lwp_settings_styles[idehweb_styles_logo]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_logo’]) . ‘" />1222// <p class="description">’ . __('logo’, ‘login-with-phone-number’) . '</p>’;1223 }12241225 function setting_idehweb_style_title_color()1226 {1227 $options = get_option(‘idehweb_lwp_settings_styles’);1228 if (!isset($options[‘idehweb_styles_title_color’])) $options[‘idehweb_styles_title_color’] = '#000000’;1229 else $options[‘idehweb_styles_title_color’] = sanitize_text_field($options[‘idehweb_styles_title_color’]);1230 echo ‘<input type="color" name="idehweb_lwp_settings_styles[idehweb_styles_title_color]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_title_color’]) . ‘" />1231 <p class="description">’ . __('label text color’, ‘login-with-phone-number’) . '</p>’;1232 }12331234 function setting_idehweb_style_title_font_size()1235 {1236 $options = get_option(‘idehweb_lwp_settings_styles’);1237 if (!isset($options[‘idehweb_styles_title_font_size’])) $options[‘idehweb_styles_title_font_size’] = 'inherit’;1238 else $options[‘idehweb_styles_title_font_size’] = sanitize_text_field($options[‘idehweb_styles_title_font_size’]);1239 echo ‘<input type="text" name="idehweb_lwp_settings_styles[idehweb_styles_title_font_size]" class="regular-text" value="’ . esc_attr($options[‘idehweb_styles_title_font_size’]) . ‘" />1240 <p class="description">’ . __('20px’, ‘login-with-phone-number’) . ‘</p>’;1241 }12421243 function setting_idehweb_localization_enable_custom_localization()1244 {1245 $options = get_option(‘idehweb_lwp_settings_localization’);1246 if (!isset($options[‘idehweb_localization_status’])) $options[‘idehweb_localization_status’] = ‘0’;1247 echo ‘<input type="hidden" name="idehweb_lwp_settings_localization[idehweb_localization_status]" value="0" />1248 <label><input type="checkbox" id="idehweb_lwp_settings_localization_status" name="idehweb_lwp_settings_localization[idehweb_localization_status]" value="1"’ . (($options[‘idehweb_localization_status’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('enable localization’, ‘login-with-phone-number’) . '</label>’;12491250 }12511252 function setting_idehweb_localization_of_login_form()1253 {1254 $options = get_option(‘idehweb_lwp_settings_localization’);1255 if (!isset($options[‘idehweb_localization_title_of_login_form’])) $options[‘idehweb_localization_title_of_login_form’] = 'Login / register’;1256 else $options[‘idehweb_localization_title_of_login_form’] = sanitize_text_field($options[‘idehweb_localization_title_of_login_form’]);125712581259 echo ‘<input type="text" name="idehweb_lwp_settings_localization[idehweb_localization_title_of_login_form]" class="regular-text" value="’ . esc_attr($options[‘idehweb_localization_title_of_login_form’]) . ‘" />1260 <p class="description">’ . __('Login / register’, ‘login-with-phone-number’) . '</p>’;1261 }12621263 function setting_idehweb_localization_of_login_form_email()1264 {1265 $options = get_option(‘idehweb_lwp_settings_localization’);1266 if (!isset($options[‘idehweb_localization_title_of_login_form_email’])) $options[‘idehweb_localization_title_of_login_form_email’] = 'Login / register’;1267 else $options[‘idehweb_localization_title_of_login_form_email’] = sanitize_text_field($options[‘idehweb_localization_title_of_login_form_email’]);126812691270 echo ‘<input type="text" name="idehweb_lwp_settings_localization[idehweb_localization_title_of_login_form_email]" class="regular-text" value="’ . esc_attr($options[‘idehweb_localization_title_of_login_form_email’]) . ‘" />1271 <p class="description">’ . __('Login / register’, ‘login-with-phone-number’) . '</p>’;1272 }12731274 function setting_idehweb_localization_placeholder_of_phonenumber_field()1275 {1276 $options = get_option(‘idehweb_lwp_settings_localization’);1277 if (!isset($options[‘idehweb_localization_placeholder_of_phonenumber_field’])) $options[‘idehweb_localization_placeholder_of_phonenumber_field’] = '’;1278 else $options[‘idehweb_localization_placeholder_of_phonenumber_field’] = sanitize_text_field($options[‘idehweb_localization_placeholder_of_phonenumber_field’]);12791280 echo ‘<input type="text" name="idehweb_lwp_settings_localization[idehweb_localization_placeholder_of_phonenumber_field]" class="regular-text" value="’ . esc_attr($options[‘idehweb_localization_placeholder_of_phonenumber_field’]) . ‘" />1281 <p class="description">’ . __('If empty, a valid example number for the selected country will be shown’, ‘login-with-phone-number’) . '</p>’;1282 }12831284 function setting_idehweb_sms_login()1285 {1286 $options = get_option(‘idehweb_lwp_settings’);1287 if (!isset($options[‘idehweb_sms_login’])) $options[‘idehweb_sms_login’] = '1’;1288 $display = 'inherit’;1289 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = ‘’;1290 if (!$options[‘idehweb_phone_number’]) {1291 $display = ‘none’;1292 }1293 echo ‘<input type="hidden" name="idehweb_lwp_settings[idehweb_sms_login]" value="0" />1294 <label><input type="checkbox" id="idehweb_lwp_settings_idehweb_sms_login" name="idehweb_lwp_settings[idehweb_sms_login]" value="1"’ . (($options[‘idehweb_sms_login’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('I want user login with phone number’, ‘login-with-phone-number’) . ‘</label>’;12951296 }12971298 function setting_idehweb_user_registration()1299 {1300 $options = get_option(‘idehweb_lwp_settings’);1301 if (!isset($options[‘idehweb_user_registration’])) $options[‘idehweb_user_registration’] = ‘1’;13021303 echo ‘<input type="hidden" name="idehweb_lwp_settings[idehweb_user_registration]" value="0" />1304 <label><input type="checkbox" name="idehweb_lwp_settings[idehweb_user_registration]" value="1"’ . (($options[‘idehweb_user_registration’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('I want to enable registration’, ‘login-with-phone-number’) . '</label>’;13051306 }13071308 function setting_idehweb_password_login()1309 {1310 $options = get_option(‘idehweb_lwp_settings’);1311 if (!isset($options[‘idehweb_password_login’])) $options[‘idehweb_password_login’] = '1’;1312 $display = 'inherit’;1313 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = ‘’;1314 if (!$options[‘idehweb_phone_number’]) {1315 $display = ‘none’;1316 }1317 echo ‘<input type="hidden" name="idehweb_lwp_settings[idehweb_password_login]" value="0" />1318 <label><input type="checkbox" name="idehweb_lwp_settings[idehweb_password_login]" value="1"’ . (($options[‘idehweb_password_login’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('I want user login with password too’, ‘login-with-phone-number’) . ‘</label>’;13191320 }13211322 function idehweb_position_form()1323 {1324 $options = get_option(‘idehweb_lwp_settings’);1325 if (!isset($options[‘idehweb_position_form’])) $options[‘idehweb_position_form’] = ‘0’;13261327 echo ‘<input type="hidden" name="idehweb_lwp_settings[idehweb_position_form]" value="0" />1328 <label><input type="checkbox" name="idehweb_lwp_settings[idehweb_position_form]" value="1"’ . (($options[‘idehweb_position_form’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('I want form shows on page in fix position’, ‘login-with-phone-number’) . ‘</label>’;13291330 }13311332 function idehweb_online_support()1333 {1334 $options = get_option(‘idehweb_lwp_settings’);1335 if (!isset($options[‘idehweb_online_support’])) $options[‘idehweb_online_support’] = ‘1’;13361337 echo ‘<input type="hidden" name="idehweb_lwp_settings[idehweb_online_support]" value="0" />1338 <label><input type="checkbox" name="idehweb_lwp_settings[idehweb_online_support]" value="1"’ . (($options[‘idehweb_online_support’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('I want online support be active’, ‘login-with-phone-number’) . '</label>’;1339 echo '<div></div>’;1340 echo ‘<button style="margin-top: 20px" type="button" class="idehweb_lwp_update_billing_phones">’ . __('update users billing phone for woocommerce’, ‘login-with-phone-number’) . ‘</button>’;1341 }13421343 function setting_use_custom_gateway()1344 {1345 $options = get_option(‘idehweb_lwp_settings’);1346 if (!isset($options[‘idehweb_use_custom_gateway’])) $options[‘idehweb_use_custom_gateway’] = ‘1’;13471348 echo ‘<input type="hidden" name="idehweb_lwp_settings[idehweb_use_custom_gateway]" value="0" />1349 <label><input type="checkbox" id="idehweb_lwp_settings_use_custom_gateway" name="idehweb_lwp_settings[idehweb_use_custom_gateway]" value="1"’ . (($options[‘idehweb_use_custom_gateway’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('I want to use custom gateways’, ‘login-with-phone-number’) . '</label>’;13501351 }13521353 function setting_default_gateways()1354 {1355 $options = get_option(‘idehweb_lwp_settings’);1356 $affected_rows = [];1357 $affected_rows = apply_filters(‘lwp_add_to_default_gateways’, $affected_rows);1358 if (!isset($options[‘idehweb_default_gateways’])) $options[‘idehweb_default_gateways’] = [‘firebase’];1359 $gateways = [1360 [“value” => "firebase", “label” => __("Firebase (Google)", ‘login-with-phone-number’)],1361 [“value” => "custom", “label” => __(“Custom (Config Your Gateway)“, ‘login-with-phone-number’)],1362 ];1363 $gateways = array_merge($gateways, $affected_rows);1364 ?>1365 <div class="idehweb_default_gateways_wrapper">13661367 <select name="idehweb_lwp_settings[idehweb_default_gateways][]" id="idehweb_default_gateways” multiple>1368 <?php1369 foreach ($gateways as $gateway) {1370 $rr = false;1371 if(!is_array($options[‘idehweb_default_gateways’])){1372 $options[‘idehweb_default_gateways’]=[];1373 }1374 if (in_array($gateway[“value”], $options[‘idehweb_default_gateways’])) {1375// if (($gateway[“value”] == $options[‘idehweb_default_gateways’])) {1376 $rr = true;1377 }1378 echo ‘<option value="’ . $gateway[“value”] . '” ' . ($rr ? ' selected="selected"’ : ‘’) . ‘>’ . $gateway[‘label’] . '</option>’;1379 }1380 ?>1381 </select>1382 </div>1383 <?php13841385 }13861387 function setting_twilio_account_sid()1388 {13891390 $options = get_option(‘idehweb_lwp_settings’);1391 if (!isset($options[‘idehweb_twilio_account_sid’])) $options[‘idehweb_twilio_account_sid’] = '’;13921393 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_twilio_account_sid]" class="regular-text" value="’ . esc_attr($options[‘idehweb_twilio_account_sid’]) . ‘" />1394 <p class="description">’ . __('enter your Twilio account SID’, ‘login-with-phone-number’) . '</p>’;1395 }13961397 function setting_twilio_auth_token()1398 {13991400 $options = get_option(‘idehweb_lwp_settings’);1401 if (!isset($options[‘idehweb_twilio_auth_token’])) $options[‘idehweb_twilio_auth_token’] = '’;14021403 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_twilio_auth_token]" class="regular-text" value="’ . esc_attr($options[‘idehweb_twilio_auth_token’]) . ‘" />1404 <p class="description">’ . __('enter your Twilio auth token’, ‘login-with-phone-number’) . '</p>’;1405 }14061407 function setting_twilio_phone_number()1408 {14091410 $options = get_option(‘idehweb_lwp_settings’);1411 if (!isset($options[‘idehweb_twilio_phone_number’])) $options[‘idehweb_twilio_phone_number’] = '’;14121413 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_twilio_phone_number]" class="regular-text" value="’ . esc_attr($options[‘idehweb_twilio_phone_number’]) . ‘" />1414 <p class="description">’ . __('enter your Twilio phone number’, ‘login-with-phone-number’) . '</p>’;1415 }14161417 function setting_zenziva_user_key()1418 {14191420 $options = get_option(‘idehweb_lwp_settings’);1421 if (!isset($options[‘idehweb_zenziva_user_key’])) $options[‘idehweb_zenziva_user_key’] = '’;14221423 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_zenziva_user_key]" class="regular-text" value="’ . esc_attr($options[‘idehweb_zenziva_user_key’]) . ‘" />1424 <p class="description">’ . __('enter your Zenziva user key’, ‘login-with-phone-number’) . '</p>’;1425 }14261427 function setting_zenziva_pass_key()1428 {14291430 $options = get_option(‘idehweb_lwp_settings’);1431 if (!isset($options[‘idehweb_zenziva_pass_key’])) $options[‘idehweb_zenziva_pass_key’] = '’;14321433 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_zenziva_pass_key]" class="regular-text" value="’ . esc_attr($options[‘idehweb_zenziva_pass_key’]) . ‘" />1434 <p class="description">’ . __('enter your Zenziva pass key’, ‘login-with-phone-number’) . '</p>’;1435 }14361437 function setting_infobip_user()1438 {14391440 $options = get_option(‘idehweb_lwp_settings’);1441 if (!isset($options[‘idehweb_infobip_user’])) $options[‘idehweb_infobip_user’] = '’;14421443 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_infobip_user]" class="regular-text" value="’ . esc_attr($options[‘idehweb_infobip_user’]) . ‘" />1444 <p class="description">’ . __('enter your Infobip pass key’, ‘login-with-phone-number’) . '</p>’;1445 }144614471448 function setting_infobip_password()1449 {14501451 $options = get_option(‘idehweb_lwp_settings’);1452 if (!isset($options[‘idehweb_infobip_password’])) $options[‘idehweb_infobip_password’] = '’;14531454 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_infobip_password]" class="regular-text" value="’ . esc_attr($options[‘idehweb_infobip_password’]) . ‘" />1455 <p class="description">’ . __('enter your Infobip pass key’, ‘login-with-phone-number’) . '</p>’;1456 }14571458 function setting_infobip_sender()1459 {14601461 $options = get_option(‘idehweb_lwp_settings’);1462 if (!isset($options[‘idehweb_infobip_sender’])) $options[‘idehweb_infobip_sender’] = '’;14631464 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_infobip_sender]" class="regular-text" value="’ . esc_attr($options[‘idehweb_infobip_sender’]) . ‘" />1465 <p class="description">’ . __('enter your Infobip sender’, ‘login-with-phone-number’) . '</p>’;1466 }146714681469 function setting_firebase_api()1470 {14711472 $options = get_option(‘idehweb_lwp_settings’);1473 if (!isset($options[‘idehweb_firebase_api’])) $options[‘idehweb_firebase_api’] = '’;14741475 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_firebase_api]" class="regular-text" value="’ . esc_attr($options[‘idehweb_firebase_api’]) . ‘" />1476 <p class="description">’ . __(‘enter Firebase api’, ‘login-with-phone-number’) . ' - <a href="https://idehweb.com/support/login-with-phone-number-wordpress/send-10000-sms-free-with-firebase-in-plugin-login-with-phone-number-wordpress/" target="_blank">’ . __('Firebase config help - documentation’, ‘login-with-phone-number’) . '</a></p>’;1477 }14781479 function setting_firebase_config()1480 {14811482 $options = get_option(‘idehweb_lwp_settings’);1483 if (!isset($options[‘idehweb_firebase_config’])) $options[‘idehweb_firebase_config’] = '’;1484 else $options[‘idehweb_firebase_config’] = sanitize_textarea_field($options[‘idehweb_firebase_config’]);14851486 echo ‘<textarea name="idehweb_lwp_settings[idehweb_firebase_config]" class="regular-text">’ . esc_attr($options[‘idehweb_firebase_config’]) . ‘</textarea>1487 <p class="description">’ . __('enter Firebase config’, ‘login-with-phone-number’) . '</p>’;1488 }14891490 function setting_custom_api_url()1491 {14921493 $options = get_option(‘idehweb_lwp_settings’);1494 if (!isset($options[‘idehweb_custom_api_url’])) $options[‘idehweb_custom_api_url’] = '’;14951496 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_custom_api_url]" class="regular-text" value="’ . esc_attr($options[‘idehweb_custom_api_url’]) . ‘" />1497 <p class="description">’ . __(‘enter custom url’, ‘login-with-phone-number’) . ' - <a href="https://idehweb.com/blog/how-to-set-up-a-custom-gateway/" target="_blank">’ . __('Custom config help - documentation’, ‘login-with-phone-number’) . '</a></p>’;1498 }14991500 function setting_custom_api_method()1501 {15021503 $options = get_option(‘idehweb_lwp_settings’);1504 if (!isset($options[‘idehweb_custom_api_method’])) $options[‘idehweb_custom_api_method’] = '’;1505 else $options[‘idehweb_custom_api_method’] = sanitize_textarea_field($options[‘idehweb_custom_api_method’]);1506// print_r($options[‘idehweb_custom_api_method’]);1507 ?>1508 <select name="idehweb_lwp_settings[idehweb_custom_api_method]" id="idehweb_custom_api_method">1509 <?php1510 foreach (['GET’, ‘POST’] as $gateway) {1511 $rr = false;1512// if(is_array($options[‘idehweb_default_gateways’]))1513 if (($gateway == $options[‘idehweb_custom_api_method’])) {1514 $rr = true;1515 }1516 echo ‘<option value="’ . esc_attr($gateway) . ‘" ' . ($rr ? ' selected="selected"’ : ‘’) . ‘>’ . esc_html($gateway) . '</option>’;1517 }1518 ?>1519 </select>1520 <?php1521 echo ‘<p class="description">’ . __('enter request method’, ‘login-with-phone-number’) . '</p>’;1522 }15231524 function setting_custom_api_header()1525 {15261527 $options = get_option(‘idehweb_lwp_settings’);1528 if (!isset($options[‘idehweb_custom_api_header’])) $options[‘idehweb_custom_api_header’] = '’;1529 else $options[‘idehweb_custom_api_header’] = sanitize_textarea_field($options[‘idehweb_custom_api_header’]);15301531 echo ‘<textarea name="idehweb_lwp_settings[idehweb_custom_api_header]" class="regular-text">’ . esc_attr($options[‘idehweb_custom_api_header’]) . ‘</textarea>1532 <p class="description">’ . __('enter header of request in json’, ‘login-with-phone-number’) . '</p>’;1533 }153415351536 function setting_custom_api_body()1537 {15381539 $options = get_option(‘idehweb_lwp_settings’);1540 if (!isset($options[‘idehweb_custom_api_body’])) $options[‘idehweb_custom_api_body’] = '’;1541 else $options[‘idehweb_custom_api_body’] = sanitize_textarea_field($options[‘idehweb_custom_api_body’]);15421543 echo ‘<textarea name="idehweb_lwp_settings[idehweb_custom_api_body]" class="regular-text">’ . esc_attr($options[‘idehweb_custom_api_body’]) . ‘</textarea>1544 <p class="description">’ . __('enter body of request in json’, ‘login-with-phone-number’) . '</p>’;1545 }15461547 function setting_custom_api_smstext()1548 {15491550 $options = get_option(‘idehweb_lwp_settings’);1551 if (!isset($options[‘idehweb_custom_api_smstext’])) $options[‘idehweb_custom_api_smstext’] = '’;1552 else $options[‘idehweb_custom_api_smstext’] = sanitize_textarea_field($options[‘idehweb_custom_api_smstext’]);15531554 echo ‘<textarea name="idehweb_lwp_settings[idehweb_custom_api_smstext]" class="regular-text">’ . esc_attr($options[‘idehweb_custom_api_smstext’]) . ‘</textarea>1555 <p class="description">’ . __('enter smstext , you can use ${code}’, ‘login-with-phone-number’) . '</p>’;1556 }15571558 function setting_raygansms_username()1559 {15601561 $options = get_option(‘idehweb_lwp_settings’);1562 if (!isset($options[‘idehweb_raygansms_username’])) $options[‘idehweb_raygansms_username’] = '’;15631564 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_raygansms_username]" class="regular-text" value="’ . esc_attr($options[‘idehweb_raygansms_username’]) . ‘" />1565 <p class="description">’ . __('enter your Raygansms username’, ‘login-with-phone-number’) . '</p>’;1566 }15671568 function setting_raygansms_password()1569 {15701571 $options = get_option(‘idehweb_lwp_settings’);1572 if (!isset($options[‘idehweb_raygansms_password’])) $options[‘idehweb_raygansms_password’] = '’;15731574 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_raygansms_password]" class="regular-text" value="’ . esc_attr($options[‘idehweb_raygansms_password’]) . ‘" />1575 <p class="description">’ . __('enter your Raygansms password’, ‘login-with-phone-number’) . '</p>’;1576 }15771578 function setting_raygansms_phonenumber()1579 {15801581 $options = get_option(‘idehweb_lwp_settings’);1582 if (!isset($options[‘idehweb_raygansms_phonenumber’])) $options[‘idehweb_raygansms_phonenumber’] = '’;15831584 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_raygansms_phonenumber]" class="regular-text" value="’ . esc_attr($options[‘idehweb_raygansms_phonenumber’]) . ‘" />1585 <p class="description">’ . __('enter your Raygansms phone number’, ‘login-with-phone-number’) . '</p>’;1586 }158715881589 function setting_smsbharti_api_key()1590 {15911592 $options = get_option(‘idehweb_lwp_settings’);1593 if (!isset($options[‘idehweb_smsbharti_api_key’])) $options[‘idehweb_smsbharti_api_key’] = '’;15941595 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_smsbharti_api_key]" class="regular-text" value="’ . esc_attr($options[‘idehweb_smsbharti_api_key’]) . ‘" />1596 <p class="description">’ . __('enter your smsbharti api key’, ‘login-with-phone-number’) . '</p>’;1597 }15981599 function setting_smsbharti_from()1600 {16011602 $options = get_option(‘idehweb_lwp_settings’);1603 if (!isset($options[‘idehweb_smsbharti_from’])) $options[‘idehweb_smsbharti_from’] = '’;16041605 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_smsbharti_from]" class="regular-text" value="’ . esc_attr($options[‘idehweb_smsbharti_from’]) . ‘" />1606 <p class="description">’ . __('enter your smsbharti from’, ‘login-with-phone-number’) . '</p>’;1607 }16081609 function setting_smsbharti_template_id()1610 {16111612 $options = get_option(‘idehweb_lwp_settings’);1613 if (!isset($options[‘idehweb_smsbharti_template_id’])) $options[‘idehweb_smsbharti_template_id’] = '’;16141615 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_smsbharti_template_id]" class="regular-text" value="’ . esc_attr($options[‘idehweb_smsbharti_template_id’]) . ‘" />1616 <p class="description">’ . __('enter your smsbharti template id’, ‘login-with-phone-number’) . '</p>’;1617 }16181619 function setting_smsbharti_routeid()1620 {16211622 $options = get_option(‘idehweb_lwp_settings’);1623 if (!isset($options[‘idehweb_smsbharti_routeid’])) $options[‘idehweb_smsbharti_routeid’] = '’;16241625 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_smsbharti_routeid]" class="regular-text" value="’ . esc_attr($options[‘idehweb_smsbharti_routeid’]) . ‘" />1626 <p class="description">’ . __('enter your smsbharti route id’, ‘login-with-phone-number’) . '</p>’;1627 }162816291630 function setting_mshastra_user()1631 {16321633 $options = get_option(‘idehweb_lwp_settings’);1634 if (!isset($options[‘idehweb_mshastra_user’])) $options[‘idehweb_mshastra_user’] = '’;16351636 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_mshastra_user]" class="regular-text" value="’ . esc_attr($options[‘idehweb_mshastra_user’]) . ‘" />1637 <p class="description">’ . __('enter your mshastra username’, ‘login-with-phone-number’) . '</p>’;1638 }16391640 function setting_mshastra_pwd()1641 {16421643 $options = get_option(‘idehweb_lwp_settings’);1644 if (!isset($options[‘idehweb_mshastra_pwd’])) $options[‘idehweb_mshastra_pwd’] = '’;16451646 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_mshastra_pwd]" class="regular-text" value="’ . esc_attr($options[‘idehweb_mshastra_pwd’]) . ‘" />1647 <p class="description">’ . __('enter your mshastra password’, ‘login-with-phone-number’) . '</p>’;1648 }16491650 function setting_mshastra_senderid()1651 {16521653 $options = get_option(‘idehweb_lwp_settings’);1654 if (!isset($options[‘idehweb_mshastra_senderid’])) $options[‘idehweb_mshastra_senderid’] = '’;16551656 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_mshastra_senderid]" class="regular-text" value="’ . esc_attr($options[‘idehweb_mshastra_senderid’]) . ‘" />1657 <p class="description">’ . __('enter your mshastra sender ID’, ‘login-with-phone-number’) . '</p>’;1658 }1659// function setting_custom_gateway_url()1660// {1661//1662// $options = get_option(‘idehweb_lwp_settings’);1663// if (!isset($options[‘idehweb_custom_gateway_url’])) $options[‘idehweb_custom_gateway_url’] = '’;1664//1665// echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_custom_gateway_url]" class="regular-text" value="’ . esc_attr($options[‘idehweb_custom_gateway_url’]) . ‘" />1666// <p class="description">’ . __('enter your sms gateway url’, ‘login-with-phone-number’) . '</p>’;1667// }1668// function setting_custom_gateway_username()1669// {1670//1671// $options = get_option(‘idehweb_lwp_settings’);1672// if (!isset($options[‘idehweb_custom_gateway_username’])) $options[‘idehweb_custom_gateway_username’] = '’;1673//1674// echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_custom_gateway_username]" class="regular-text" value="’ . esc_attr($options[‘idehweb_custom_gateway_username’]) . ‘" />1675// <p class="description">’ . __('enter your sms gateway username’, ‘login-with-phone-number’) . '</p>’;1676// }1677//1678// function setting_custom_gateway_password()1679// {1680//1681// $options = get_option(‘idehweb_lwp_settings’);1682// if (!isset($options[‘idehweb_custom_gateway_password’])) $options[‘idehweb_custom_gateway_password’] = '’;1683//1684// echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_custom_gateway_password]" class="regular-text" value="’ . esc_attr($options[‘idehweb_custom_gateway_password’]) . ‘" />1685// <p class="description">’ . __('enter your sms gateway password’, ‘login-with-phone-number’) . '</p>’;1686// }168716881689 function setting_taqnyat_sender_number()1690 {16911692 $options = get_option(‘idehweb_lwp_settings’);1693 if (!isset($options[‘idehweb_taqnyat_sendernumber’])) $options[‘idehweb_taqnyat_sendernumber’] = '’;16941695 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_taqnyat_sendernumber]" class="regular-text" value="’ . esc_attr($options[‘idehweb_taqnyat_sendernumber’]) . ‘" />1696 <p class="description">’ . __('enter your taqnyat sender number’, ‘login-with-phone-number’) . '</p>’;1697 }16981699 function setting_taqnyat_api_key()1700 {17011702 $options = get_option(‘idehweb_lwp_settings’);1703 if (!isset($options[‘idehweb_taqnyat_api_key’])) $options[‘idehweb_taqnyat_api_key’] = '’;17041705 echo ‘<input type="text" name="idehweb_lwp_settings[idehweb_taqnyat_api_key]" class="regular-text" value="’ . esc_attr($options[‘idehweb_taqnyat_api_key’]) . ‘" />1706 <p class="description">’ . __('enter your taqnyat api key’, ‘login-with-phone-number’) . ‘</p>’;1707 }17081709 function idehweb_use_phone_number_for_username()1710 {1711 $options = get_option(‘idehweb_lwp_settings’);1712 if (!isset($options[‘idehweb_use_phone_number_for_username’])) $options[‘idehweb_use_phone_number_for_username’] = ‘0’;17131714 echo ‘<input type="hidden" name="idehweb_lwp_settings[idehweb_use_phone_number_for_username]" value="0" />1715 <label><input type="checkbox" id="idehweb_lwp_settings_use_phone_number_for_username" name="idehweb_lwp_settings[idehweb_use_phone_number_for_username]" value="1"’ . (($options[‘idehweb_use_phone_number_for_username’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('I want to set phone number as username and nickname’, ‘login-with-phone-number’) . ‘</label>’;17161717 }17181719 function idehweb_enable_timer_on_sending_sms()1720 {1721 $options = get_option(‘idehweb_lwp_settings’);1722 if (!isset($options[‘idehweb_enable_timer_on_sending_sms’])) $options[‘idehweb_enable_timer_on_sending_sms’] = ‘1’;17231724 echo ‘<input type="hidden" name="idehweb_lwp_settings[idehweb_enable_timer_on_sending_sms]" value="0" />1725 <label><input type="checkbox" id="idehweb_lwp_settings_enable_timer_on_sending_sms" name="idehweb_lwp_settings[idehweb_enable_timer_on_sending_sms]" value="1"’ . (($options[‘idehweb_enable_timer_on_sending_sms’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('I want to enable timer after user entered phone number and clicked on submit’, ‘login-with-phone-number’) . '</label>’;17261727 }172817291730 function setting_timer_count()1731 {1732 $options = get_option(‘idehweb_lwp_settings’);1733 if (!isset($options[‘idehweb_timer_count’])) $options[‘idehweb_timer_count’] = '60’;173417351736 echo ‘<input id="lwp_timer_count" type="text" name="idehweb_lwp_settings[idehweb_timer_count]" class="regular-text" value="’ . esc_attr($options[‘idehweb_timer_count’]) . ‘" />1737 <p class="description">’ . __('Timer count’, ‘login-with-phone-number’) . ‘</p>’;17381739 }17401741 function idehweb_enable_accept_term_and_conditions()1742 {1743 $options = get_option(‘idehweb_lwp_settings’);1744 if (!isset($options[‘idehweb_enable_accept_terms_and_condition’])) $options[‘idehweb_enable_accept_terms_and_condition’] = ‘1’;17451746 echo ‘<input type="hidden" name="idehweb_lwp_settings[idehweb_enable_accept_terms_and_condition]" value="0" />1747 <label><input type="checkbox" id="idehweb_enable_accept_terms_and_condition" name="idehweb_lwp_settings[idehweb_enable_accept_terms_and_condition]" value="1"’ . (($options[‘idehweb_enable_accept_terms_and_condition’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('I want to show some terms & conditions for user to accept it, when he/she wants to register ', ‘login-with-phone-number’) . '</label>’;17481749 }17501751 function setting_term_and_conditions_text()1752 {17531754 $options = get_option(‘idehweb_lwp_settings’);1755 if (!isset($options[‘idehweb_term_and_conditions_text’])) $options[‘idehweb_term_and_conditions_text’] = __('By submitting, you agree to the Terms and Privacy Policy’, ‘login-with-phone-number’);1756 else $options[‘idehweb_term_and_conditions_text’] = ($options[‘idehweb_term_and_conditions_text’]);1757 echo ‘<textarea name="idehweb_lwp_settings[idehweb_term_and_conditions_text]" class="regular-text">’ . esc_attr($options[‘idehweb_term_and_conditions_text’]) . ‘</textarea>1758 <p class="description">’ . __('enter term and condition accepting text’, ‘login-with-phone-number’) . '</p>’;1759 }17601761 function setting_term_and_conditions_link()1762 {17631764 $options = get_option(‘idehweb_lwp_settings’);1765 if (!isset($options[‘idehweb_term_and_conditions_link’])) $options[‘idehweb_term_and_conditions_link’] = __('#’, ‘login-with-phone-number’);1766 else $options[‘idehweb_term_and_conditions_link’] = ($options[‘idehweb_term_and_conditions_link’]);1767 echo ‘<textarea name="idehweb_lwp_settings[idehweb_term_and_conditions_link]" class="regular-text">’ . esc_attr($options[‘idehweb_term_and_conditions_link’]) . ‘</textarea>1768 <p class="description">’ . __('enter term and condition link’, ‘login-with-phone-number’) . ‘</p>’;1769 }17701771 function setting_term_and_conditions_default_checked()1772 {1773 $options = get_option(‘idehweb_lwp_settings’);1774 if (!isset($options[‘idehweb_term_and_conditions_default_checked’])) $options[‘idehweb_term_and_conditions_default_checked’] = ‘1’;17751776 echo ‘<input type="hidden" name="idehweb_lwp_settings[idehweb_term_and_conditions_default_checked]" value="0" />1777 <label><input type="checkbox" id="idehweb_term_and_conditions_default_checked" name="idehweb_lwp_settings[idehweb_term_and_conditions_default_checked]" value="1"’ . (esc_attr($options[‘idehweb_term_and_conditions_default_checked’]) ? ' checked="checked"’ : ‘’) . ' />’ . __('Accept/Check by default. ', ‘login-with-phone-number’) . '</label>’;1778 }17791780 function credit_adminbar()1781 {1782 global $wp_admin_bar, $melipayamak;1783 if (!is_super_admin() || !is_admin_bar_showing())1784 return;17851786 $credit = '0’;1787 ?>17881789 <?php1790 }17911792 function setting_idehweb_phone_number()1793 {1794 $options = get_option(‘idehweb_lwp_settings’);1795 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = '’;1796 if (!isset($options[‘idehweb_phone_number_ccode’])) $options[‘idehweb_phone_number_ccode’] = '’;1797 ?>1798 <div class="idehweb_phone_number_ccode_wrap">1799 <select name="idehweb_lwp_settings[idehweb_phone_number_ccode]" id="idehweb_phone_number_ccode"1800 data-placeholder="<?php _e(‘Choose a country…’, ‘login-with-phone-number’); ?>">1801 <?php1802 $country_codes = $this->get_country_code_options();18031804 foreach ($country_codes as $country) {1805 echo ‘<option value="’ . esc_attr($country[“code”]) . ‘" ' . (($options[‘idehweb_phone_number_ccode’] == $country[“code”]) ? ' selected="selected"’ : ‘’) . ' >+’ . esc_html($country[‘value’]) . ' - ' . esc_html($country[“code”]) . '</option>’;1806 }1807 ?>1808 </select>1809 <?php1810 echo ‘<input placeholder="Ex: 9120539945" type="text" name="idehweb_lwp_settings[idehweb_phone_number]" id="lwp_phone_number" class="regular-text" value="’ . esc_attr($options[‘idehweb_phone_number’]) . '" />’;1811 ?>1812 </div>1813 <?php1814 echo '<input type="text" name="idehweb_lwp_settings[idehweb_secod]" id="lwp_secod" class="regular-text" style="display:none" value="" placeholder="_ _ _ _ _ _" />’;1815 ?>1816 <button type="button" class="button-primary auth i35"1817 value="<?php _e('Authenticate’, ‘login-with-phone-number’); ?>"><?php _e('activate sms login’, ‘login-with-phone-number’); ?></button>1818 <button type="button" class="button-primary activate i34" style="display: none"1819 value="<?php _e('Activate’, ‘login-with-phone-number’); ?>"><?php _e('activate account’, ‘login-with-phone-number’); ?></button>18201821 <?php1822 }18231824 function setting_idehweb_website_url()1825 {1826 $options = get_option(‘idehweb_lwp_settings’);1827 if (!isset($options[‘idehweb_website_url’])) $options[‘idehweb_website_url’] = $this->settings_get_site_url();1828 ?>1829 <div class="idehweb_website_url_wrap">1830 <?php1831 echo ‘<input placeholder="Ex: example.com" type="text" name="idehweb_lwp_settings[idehweb_website_url]" id="lwp_website_url" class="regular-text" value="’ . esc_attr($options[‘idehweb_website_url’]) . '" />’;1832 ?>1833 </div>18341835 <button type="button" class="button-primary authwithwebsite i35"1836 value="<?php _e('Authenticate’, ‘login-with-phone-number’); ?>"><?php _e('activate sms login’, ‘login-with-phone-number’); ?></button>18371838 <?php1839 }18401841 function setting_idehweb_token()1842 {1843 $options = get_option(‘idehweb_lwp_settings’);1844 $display = 'inherit’;1845 if (!isset($options[‘idehweb_token’])) $options[‘idehweb_token’] = '’;1846 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = '’;1847 if (!$options[‘idehweb_phone_number’]) {1848 $display = 'none’;1849 }1850 echo ‘<input id="lwp_token" type="text" name="idehweb_lwp_settings[idehweb_token]" class="regular-text" value="’ . esc_attr($options[‘idehweb_token’]) . ‘" />1851 <p class="description">’ . __('enter api key’, ‘login-with-phone-number’) . '</p>’;18521853 }18541855 function settings_get_site_url()1856 {1857 $url = get_site_url();1858 $disallowed = array('http://’, 'https://’, 'https://www.’, 'http://www.’, ‘www.’);1859 foreach ($disallowed as $d) {1860 if (strpos($url, $d) === 0) {1861 return str_replace($d, '’, $url);1862 }1863 }1864 return $url;18651866 }18671868 function setting_idehweb_url_redirect()1869 {1870 $options = get_option(‘idehweb_lwp_settings’);1871 $display = 'inherit’;1872 if (!isset($options[‘idehweb_redirect_url’])) $options[‘idehweb_redirect_url’] = '’;1873 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = '’;1874 if (!$options[‘idehweb_phone_number’]) {1875 $display = 'none’;1876 }1877 echo ‘<input id="lwp_token" type="text" name="idehweb_lwp_settings[idehweb_redirect_url]" class="regular-text" value="’ . esc_attr($options[‘idehweb_redirect_url’]) . ‘" />1878 <p class="description">’ . __('enter redirect url’, ‘login-with-phone-number’) . '</p>’;18791880 }18811882 function setting_idehweb_login_message()1883 {1884 $options = get_option(‘idehweb_lwp_settings’);1885 if (!isset($options[‘idehweb_login_message’])) $options[‘idehweb_login_message’] = 'Welcome, You are logged in…’;1886 echo ‘<input id="lwp_token" type="text" name="idehweb_lwp_settings[idehweb_login_message]" class="regular-text" value="’ . esc_attr($options[‘idehweb_login_message’]) . ‘" />1887 <p class="description">’ . __('enter login message’, ‘login-with-phone-number’) . ‘</p>’;18881889 }18901891 function get_country_code_options()1892 {18931894// $json_countries = '[["Afghanistan (‫افغانستان‬‎)", "af", “93”], ["Albania (Shqipëri)", "al", “355”], ["Algeria (‫الجزائر‬‎)", "dz", “213”], ["American Samoa", "as", “1684”], ["Andorra", "ad", “376”], ["Angola", "ao", “244”], ["Anguilla", "ai", “1264”], ["Antigua and Barbuda", "ag", “1268”], ["Argentina", "ar", “54”], ["Armenia (Հայաստան)", "am", “374”], ["Aruba", "aw", “297”], ["Australia", "au", "61", 0], ["Austria (Österreich)", "at", “43”], ["Azerbaijan (Azərbaycan)", "az", “994”], ["Bahamas", "bs", “1242”], ["Bahrain (‫البحرين‬‎)", "bh", “973”], ["Bangladesh (বাংলাদেশ)", "bd", “880”], ["Barbados", "bb", “1246”], ["Belarus (Беларусь)", "by", “375”], ["Belgium (België)", "be", “32”], ["Belize", "bz", “501”], ["Benin (Bénin)", "bj", “229”], ["Bermuda", "bm", “1441”], ["Bhutan (འབྲུག)", "bt", “975”], ["Bolivia", "bo", “591”], ["Bosnia and Herzegovina (Босна и Херцеговина)", "ba", “387”], ["Botswana", "bw", “267”], ["Brazil (Brasil)", "br", “55”], ["British Indian Ocean Territory", "io", “246”], ["British Virgin Islands", "vg", “1284”], ["Brunei", "bn", “673”], ["Bulgaria (България)", "bg", “359”], ["Burkina Faso", "bf", “226”], ["Burundi (Uburundi)", "bi", “257”], ["Cambodia (កម្ពុជា)", "kh", “855”], ["Cameroon (Cameroun)", "cm", “237”], ["Canada", "ca", "1", 1, ["204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", “905”]], ["Cape Verde (Kabu Verdi)", "cv", “238”], ["Caribbean Netherlands", "bq", "599", 1], ["Cayman Islands", "ky", “1345”], ["Central African Republic (République centrafricaine)", "cf", “236”], ["Chad (Tchad)", "td", “235”], ["Chile", "cl", “56”], ["China (中国)", "cn", “86”], ["Christmas Island", "cx", "61", 2], ["Cocos (Keeling) Islands", "cc", "61", 1], ["Colombia", "co", “57”], ["Comoros (‫جزر القمر‬‎)", "km", “269”], ["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", “243”], ["Congo (Republic) (Congo-Brazzaville)", "cg", “242”], ["Cook Islands", "ck", “682”], ["Costa Rica", "cr", “506”], ["Côte d’Ivoire", "ci", “225”], ["Croatia (Hrvatska)", "hr", “385”], ["Cuba", "cu", “53”], ["Curaçao", "cw", "599", 0], ["Cyprus (Κύπρος)", "cy", “357”], ["Czech Republic (Česká republika)", "cz", “420”], ["Denmark (Danmark)", "dk", “45”], ["Djibouti", "dj", “253”], ["Dominica", "dm", “1767”], ["Dominican Republic (República Dominicana)", "do", "1", 2, ["809", "829", “849”]], ["Ecuador", "ec", “593”], ["Egypt (‫مصر‬‎)", "eg", “20”], ["El Salvador", "sv", “503”], ["Equatorial Guinea (Guinea Ecuatorial)", "gq", “240”], ["Eritrea", "er", “291”], ["Estonia (Eesti)", "ee", “372”], ["Ethiopia", "et", “251”], ["Falkland Islands (Islas Malvinas)", "fk", “500”], ["Faroe Islands (Føroyar)", "fo", “298”], ["Fiji", "fj", “679”], ["Finland (Suomi)", "fi", "358", 0], ["France", "fr", “33”], ["French Guiana (Guyane française)", "gf", “594”], ["French Polynesia (Polynésie française)", "pf", “689”], ["Gabon", "ga", “241”], ["Gambia", "gm", “220”], ["Georgia (საქართველო)", "ge", “995”], ["Germany (Deutschland)", "de", “49”], ["Ghana (Gaana)", "gh", “233”], ["Gibraltar", "gi", “350”], ["Greece (Ελλάδα)", "gr", “30”], ["Greenland (Kalaallit Nunaat)", "gl", “299”], ["Grenada", "gd", “1473”], ["Guadeloupe", "gp", "590", 0], ["Guam", "gu", “1671”], ["Guatemala", "gt", “502”], ["Guernsey", "gg", "44", 1], ["Guinea (Guinée)", "gn", “224”], ["Guinea-Bissau (Guiné Bissau)", "gw", “245”], ["Guyana", "gy", “592”], ["Haiti", "ht", “509”], ["Honduras", "hn", “504”], ["Hong Kong (香港)", "hk", “852”], ["Hungary (Magyarország)", "hu", “36”], ["Iceland (Ísland)", "is", “354”], ["India (भारत)", "in", “91”], ["Indonesia", "id", “62”], ["Iran (‫ایران‬‎)", "ir", “98”], ["Iraq (‫العراق‬‎)", "iq", “964”], ["Ireland", "ie", “353”], ["Isle of Man", "im", "44", 2], ["Israel (‫ישראל‬‎)", "il", “972”], ["Italy (Italia)", "it", "39", 0], ["Jamaica", "jm", "1", 4, ["876", “658”]], ["Japan (日本)", "jp", “81”], ["Jersey", "je", "44", 3], ["Jordan (‫الأردن‬‎)", "jo", “962”], ["Kazakhstan (Казахстан)", "kz", "7", 1], ["Kenya", "ke", “254”], ["Kiribati", "ki", “686”], ["Kosovo", "xk", “383”], ["Kuwait (‫الكويت‬‎)", "kw", “965”], ["Kyrgyzstan (Кыргызстан)", "kg", “996”], ["Laos (ລາວ)", "la", “856”], ["Latvia (Latvija)", "lv", “371”], ["Lebanon (‫لبنان‬‎)", "lb", “961”], ["Lesotho", "ls", “266”], ["Liberia", "lr", “231”], ["Libya (‫ليبيا‬‎)", "ly", “218”], ["Liechtenstein", "li", “423”], ["Lithuania (Lietuva)", "lt", “370”], ["Luxembourg", "lu", “352”], ["Macau (澳門)", "mo", “853”], ["Macedonia (FYROM) (Македонија)", "mk", “389”], ["Madagascar (Madagasikara)", "mg", “261”], ["Malawi", "mw", “265”], ["Malaysia", "my", “60”], ["Maldives", "mv", “960”], ["Mali", "ml", “223”], ["Malta", "mt", “356”], ["Marshall Islands", "mh", “692”], ["Martinique", "mq", “596”], ["Mauritania (‫موريتانيا‬‎)", "mr", “222”], ["Mauritius (Moris)", "mu", “230”], ["Mayotte", "yt", "262", 1], ["Mexico (México)", "mx", “52”], ["Micronesia", "fm", “691”], ["Moldova (Republica Moldova)", "md", “373”], ["Monaco", "mc", “377”], ["Mongolia (Монгол)", "mn", “976”], ["Montenegro (Crna Gora)", "me", “382”], ["Montserrat", "ms", “1664”], ["Morocco (‫المغرب‬‎)", "ma", "212", 0], ["Mozambique (Moçambique)", "mz", “258”], ["Myanmar (Burma) (မြန်မာ)", "mm", “95”], ["Namibia (Namibië)", "na", “264”], ["Nauru", "nr", “674”], ["Nepal (नेपाल)", "np", “977”], ["Netherlands (Nederland)", "nl", “31”], ["New Caledonia (Nouvelle-Calédonie)", "nc", “687”], ["New Zealand", "nz", “64”], ["Nicaragua", "ni", “505”], ["Niger (Nijar)", "ne", “227”], ["Nigeria", "ng", “234”], ["Niue", "nu", “683”], ["Norfolk Island", "nf", “672”], ["North Korea (조선 민주주의 인민 공화국)", "kp", “850”], ["Northern Mariana Islands", "mp", “1670”], ["Norway (Norge)", "no", "47", 0], ["Oman (‫عُمان‬‎)", "om", “968”], ["Pakistan (‫پاکستان‬‎)", "pk", “92”], ["Palau", "pw", “680”], ["Palestine (‫فلسطين‬‎)", "ps", “970”], ["Panama (Panamá)", "pa", “507”], ["Papua New Guinea", "pg", “675”], ["Paraguay", "py", “595”], ["Peru (Perú)", "pe", “51”], ["Philippines", "ph", “63”], ["Poland (Polska)", "pl", “48”], ["Portugal", "pt", “351”], ["Puerto Rico", "pr", "1", 3, ["787", “939”]], ["Qatar (‫قطر‬‎)", "qa", “974”], ["Réunion (La Réunion)", "re", "262", 0], ["Romania (România)", "ro", “40”], ["Russia (Россия)", "ru", "7", 0], ["Rwanda", "rw", “250”], ["Saint Barthélemy", "bl", "590", 1], ["Saint Helena", "sh", “290”], ["Saint Kitts and Nevis", "kn", “1869”], ["Saint Lucia", "lc", “1758”], ["Saint Martin (Saint-Martin (partie française))", "mf", "590", 2], ["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", “508”], ["Saint Vincent and the Grenadines", "vc", “1784”], ["Samoa", "ws", “685”], ["San Marino", "sm", “378”], ["São Tomé and Príncipe (São Tomé e Príncipe)", "st", “239”], ["Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", “966”], ["Senegal (Sénégal)", "sn", “221”], ["Serbia (Србија)", "rs", “381”], ["Seychelles", "sc", “248”], ["Sierra Leone", "sl", “232”], ["Singapore", "sg", “65”], ["Sint Maarten", "sx", “1721”], ["Slovakia (Slovensko)", "sk", “421”], ["Slovenia (Slovenija)", "si", “386”], ["Solomon Islands", "sb", “677”], ["Somalia (Soomaaliya)", "so", “252”], ["South Africa", "za", “27”], ["South Korea (대한민국)", "kr", “82”], ["South Sudan (‫جنوب السودان‬‎)", "ss", “211”], ["Spain (España)", "es", “34”], ["Sri Lanka (ශ්‍රී ලංකාව)", "lk", “94”], ["Sudan (‫السودان‬‎)", "sd", “249”], ["Suriname", "sr", “597”], ["Svalbard and Jan Mayen", "sj", "47", 1], ["Swaziland", "sz", “268”], ["Sweden (Sverige)", "se", “46”], ["Switzerland (Schweiz)", "ch", “41”], ["Syria (‫سوريا‬‎)", "sy", “963”], ["Taiwan (台灣)", "tw", “886”], ["Tajikistan", "tj", “992”], ["Tanzania", "tz", “255”], ["Thailand (ไทย)", "th", “66”], ["Timor-Leste", "tl", “670”], ["Togo", "tg", “228”], ["Tokelau", "tk", “690”], ["Tonga", "to", “676”], ["Trinidad and Tobago", "tt", “1868”], ["Tunisia (‫تونس‬‎)", "tn", “216”], ["Turkey (Türkiye)", "tr", “90”], ["Turkmenistan", "tm", “993”], ["Turks and Caicos Islands", "tc", “1649”], ["Tuvalu", "tv", “688”], ["U.S. Virgin Islands", "vi", “1340”], ["Uganda", "ug", “256”], ["Ukraine (Україна)", "ua", “380”], ["United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", “971”], ["United Kingdom", "gb", "44", 0], ["United States", "us", "1", 0], ["Uruguay", "uy", “598”], ["Uzbekistan (Oʻzbekiston)", "uz", “998”], ["Vanuatu", "vu", “678”], ["Vatican City (Città del Vaticano)", "va", "39", 1], ["Venezuela", "ve", “58”], ["Vietnam (Việt Nam)", "vn", “84”], ["Wallis and Futuna (Wallis-et-Futuna)", "wf", “681”], ["Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1], ["Yemen (‫اليمن‬‎)", "ye", “967”], ["Zambia", "zm", “260”], ["Zimbabwe", "zw", “263”], ["Åland Islands", "ax", “358", 1]]‘;1895// $countries = json_decode($json_countries);1896 $retrun_array = [[“label” => "Afghanistan (‫افغانستان‬‎) [+93]", “value” => "93", “code” => "af", “is_placeholder” => false],1897 [“label” => "Albania (Shqipëri) [+355]", “value” => "355", “code” => "al", “is_placeholder” => false],1898 [“label” => "Algeria (‫الجزائر‬‎) [+213]", “value” => "213", “code” => "dz", “is_placeholder” => false],1899 [“label” => "American Samoa [+1684]", “value” => "1684", “code” => "as", “is_placeholder” => false],1900 [“label” => "Andorra [+376]", “value” => "376", “code” => "ad", “is_placeholder” => false],1901 [“label” => "Angola [+244]", “value” => "244", “code” => "ao", “is_placeholder” => false],1902 [“label” => "Anguilla [+1264]", “value” => "1264", “code” => "ai", “is_placeholder” => false],1903 [“label” => "Antigua and Barbuda [+1268]", “value” => "1268", “code” => "ag", “is_placeholder” => false],1904 [“label” => "Argentina [+54]", “value” => "54", “code” => "ar", “is_placeholder” => false],1905 [“label” => "Armenia (Հայաստան) [+374]", “value” => "374", “code” => "am", “is_placeholder” => false],1906 [“label” => "Aruba [+297]", “value” => "297", “code” => "aw", “is_placeholder” => false],1907 [“label” => "Australia [+61]", “value” => "61", “code” => "au", “is_placeholder” => false],1908 [“label” => "Austria (Österreich) [+43]", “value” => "43", “code” => "at", “is_placeholder” => false],1909 [“label” => "Azerbaijan (Azərbaycan) [+994]", “value” => "994", “code” => "az", “is_placeholder” => false],1910 [“label” => "Bahamas [+1242]", “value” => "1242", “code” => "bs", “is_placeholder” => false],1911 [“label” => "Bahrain (‫البحرين‬‎) [+973]", “value” => "973", “code” => "bh", “is_placeholder” => false],1912 [“label” => "Bangladesh (বাংলাদেশ) [+880]", “value” => "880", “code” => "bd", “is_placeholder” => false],1913 [“label” => "Barbados [+1246]", “value” => "1246", “code” => "bb", “is_placeholder” => false],1914 [“label” => "Belarus (Беларусь) [+375]", “value” => "375", “code” => "by", “is_placeholder” => false],1915 [“label” => "Belgium (België) [+32]", “value” => "32", “code” => "be", “is_placeholder” => false],1916 [“label” => "Belize [+501]", “value” => "501", “code” => "bz", “is_placeholder” => false],1917 [“label” => "Benin (Bénin) [+229]", “value” => "229", “code” => "bj", “is_placeholder” => false],1918 [“label” => "Bermuda [+1441]", “value” => "1441", “code” => "bm", “is_placeholder” => false],1919 [“label” => "Bhutan (འབྲུག) [+975]", “value” => "975", “code” => "bt", “is_placeholder” => false],1920 [“label” => "Bolivia [+591]", “value” => "591", “code” => "bo", “is_placeholder” => false],1921 [“label” => "Bosnia and Herzegovina (Босна и Херцеговина) [+387]", “value” => "387", “code” => "ba", “is_placeholder” => false],1922 [“label” => "Botswana [+267]", “value” => "267", “code” => "bw", “is_placeholder” => false],1923 [“label” => "Brazil (Brasil) [+55]", “value” => "55", “code” => "br", “is_placeholder” => false],1924 [“label” => "British Indian Ocean Territory [+246]", “value” => "246", “code” => "io", “is_placeholder” => false],1925 [“label” => "British Virgin Islands [+1284]", “value” => "1284", “code” => "vg", “is_placeholder” => false],1926 [“label” => "Brunei [+673]", “value” => "673", “code” => "bn", “is_placeholder” => false],1927 [“label” => "Bulgaria (България) [+359]", “value” => "359", “code” => "bg", “is_placeholder” => false],1928 [“label” => "Burkina Faso [+226]", “value” => "226", “code” => "bf", “is_placeholder” => false],1929 [“label” => "Burundi (Uburundi) [+257]", “value” => "257", “code” => "bi", “is_placeholder” => false],1930 [“label” => "Cambodia (កម្ពុជា) [+855]", “value” => "855", “code” => "kh", “is_placeholder” => false],1931 [“label” => "Cameroon (Cameroun) [+237]", “value” => "237", “code” => "cm", “is_placeholder” => false],1932 [“label” => "Canada [+1]", “value” => "1", “code” => "ca", “is_placeholder” => false],1933 [“label” => "Cape Verde (Kabu Verdi) [+238]", “value” => "238", “code” => "cv", “is_placeholder” => false],1934 [“label” => "Caribbean Netherlands [+599]", “value” => "599", “code” => "bq", “is_placeholder” => false],1935 [“label” => "Cayman Islands [+1345]", “value” => "1345", “code” => "ky", “is_placeholder” => false],1936 [“label” => "Central African Republic (République centrafricaine) [+236]", “value” => "236", “code” => "cf", “is_placeholder” => false],1937 [“label” => "Chad (Tchad) [+235]", “value” => "235", “code” => "td", “is_placeholder” => false],1938 [“label” => "Chile [+56]", “value” => "56", “code” => "cl", “is_placeholder” => false],1939 [“label” => "China (中国) [+86]", “value” => "86", “code” => "cn", “is_placeholder” => false],1940 [“label” => "Christmas Island [+61]", “value” => "61", “code” => "cx", “is_placeholder” => false],1941 [“label” => "Cocos (Keeling) Islands [+61]", “value” => "61", “code” => "cc", “is_placeholder” => false],1942 [“label” => "Colombia [+57]", “value” => "57", “code” => "co", “is_placeholder” => false],1943 [“label” => "Comoros (‫جزر القمر‬‎) [+269]", “value” => "269", “code” => "km", “is_placeholder” => false],1944 [“label” => "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo) [+243]", “value” => "243", “code” => "cd", “is_placeholder” => false],1945 [“label” => "Congo (Republic) (Congo-Brazzaville) [+242]", “value” => "242", “code” => "cg", “is_placeholder” => false],1946 [“label” => "Cook Islands [+682]", “value” => "682", “code” => "ck", “is_placeholder” => false],1947 [“label” => "Costa Rica [+506]", “value” => "506", “code” => "cr", “is_placeholder” => false],1948 [“label” => "Côte d’Ivoire [+225]", “value” => "225", “code” => "ci", “is_placeholder” => false],1949 [“label” => "Croatia (Hrvatska) [+385]", “value” => "385", “code” => "hr", “is_placeholder” => false],1950 [“label” => "Cuba [+53]", “value” => "53", “code” => "cu", “is_placeholder” => false],1951 [“label” => "Curaçao [+599]", “value” => "599", “code” => "cw", “is_placeholder” => false],1952 [“label” => "Cyprus (Κύπρος) [+357]", “value” => "357", “code” => "cy", “is_placeholder” => false],1953 [“label” => "Czech Republic (Česká republika) [+420]", “value” => "420", “code” => "cz", “is_placeholder” => false],1954 [“label” => "Denmark (Danmark) [+45]", “value” => "45", “code” => "dk", “is_placeholder” => false],1955 [“label” => "Djibouti [+253]", “value” => "253", “code” => "dj", “is_placeholder” => false],1956 [“label” => "Dominica [+1767]", “value” => "1767", “code” => "dm", “is_placeholder” => false],1957 [“label” => "Dominican Republic (República Dominicana) [+1]", “value” => "1", “code” => "do", “is_placeholder” => false],1958 [“label” => "Ecuador [+593]", “value” => "593", “code” => "ec", “is_placeholder” => false],1959 [“label” => "Egypt (‫مصر‬‎) [+20]", “value” => "20", “code” => "eg", “is_placeholder” => false],1960 [“label” => "El Salvador [+503]", “value” => "503", “code” => "sv", “is_placeholder” => false],1961 [“label” => "Equatorial Guinea (Guinea Ecuatorial) [+240]", “value” => "240", “code” => "gq", “is_placeholder” => false],1962 [“label” => "Eritrea [+291]", “value” => "291", “code” => "er", “is_placeholder” => false],1963 [“label” => "Estonia (Eesti) [+372]", “value” => "372", “code” => "ee", “is_placeholder” => false],1964 [“label” => "Ethiopia [+251]", “value” => "251", “code” => "et", “is_placeholder” => false],1965 [“label” => "Falkland Islands (Islas Malvinas) [+500]", “value” => "500", “code” => "fk", “is_placeholder” => false],1966 [“label” => "Faroe Islands (Føroyar) [+298]", “value” => "298", “code” => "fo", “is_placeholder” => false],1967 [“label” => "Fiji [+679]", “value” => "679", “code” => "fj", “is_placeholder” => false],1968 [“label” => "Finland (Suomi) [+358]", “value” => "358", “code” => "fi", “is_placeholder” => false],1969 [“label” => "France [+33]", “value” => "33", “code” => "fr", “is_placeholder” => false],1970 [“label” => "French Guiana (Guyane française) [+594]", “value” => "594", “code” => "gf", “is_placeholder” => false],1971 [“label” => "French Polynesia (Polynésie française) [+689]", “value” => "689", “code” => "pf", “is_placeholder” => false],1972 [“label” => "Gabon [+241]", “value” => "241", “code” => "ga", “is_placeholder” => false],1973 [“label” => "Gambia [+220]", “value” => "220", “code” => "gm", “is_placeholder” => false],1974 [“label” => "Georgia (საქართველო) [+995]", “value” => "995", “code” => "ge", “is_placeholder” => false],1975 [“label” => "Germany (Deutschland) [+49]", “value” => "49", “code” => "de", “is_placeholder” => false],1976 [“label” => "Ghana (Gaana) [+233]", “value” => "233", “code” => "gh", “is_placeholder” => false],1977 [“label” => "Gibraltar [+350]", “value” => "350", “code” => "gi", “is_placeholder” => false],1978 [“label” => "Greece (Ελλάδα) [+30]", “value” => "30", “code” => "gr", “is_placeholder” => false],1979 [“label” => "Greenland (Kalaallit Nunaat) [+299]", “value” => "299", “code” => "gl", “is_placeholder” => false],1980 [“label” => "Grenada [+1473]", “value” => "1473", “code” => "gd", “is_placeholder” => false],1981 [“label” => "Guadeloupe [+590]", “value” => "590", “code” => "gp", “is_placeholder” => false],1982 [“label” => "Guam [+1671]", “value” => "1671", “code” => "gu", “is_placeholder” => false],1983 [“label” => "Guatemala [+502]", “value” => "502", “code” => "gt", “is_placeholder” => false],1984 [“label” => "Guernsey [+44]", “value” => "44", “code” => "gg", “is_placeholder” => false],1985 [“label” => "Guinea (Guinée) [+224]", “value” => "224", “code” => "gn", “is_placeholder” => false],1986 [“label” => "Guinea-Bissau (Guiné Bissau) [+245]", “value” => "245", “code” => "gw", “is_placeholder” => false],1987 [“label” => "Guyana [+592]", “value” => "592", “code” => "gy", “is_placeholder” => false],1988 [“label” => "Haiti [+509]", “value” => "509", “code” => "ht", “is_placeholder” => false],1989 [“label” => "Honduras [+504]", “value” => "504", “code” => "hn", “is_placeholder” => false],1990 [“label” => "Hong Kong (香港) [+852]", “value” => "852", “code” => "hk", “is_placeholder” => false],1991 [“label” => "Hungary (Magyarország) [+36]", “value” => "36", “code” => "hu", “is_placeholder” => false],1992 [“label” => "Iceland (Ísland) [+354]", “value” => "354", “code” => "is", “is_placeholder” => false],1993 [“label” => "India (भारत) [+91]", “value” => "91", “code” => "in", “is_placeholder” => false],1994 [“label” => "Indonesia [+62]", “value” => "62", “code” => "id", “is_placeholder” => false],1995 [“label” => "Iran (‫ایران‬‎) [+98]", “value” => "98", “code” => "ir", “is_placeholder” => false],1996 [“label” => "Iraq (‫العراق‬‎) [+964]", “value” => "964", “code” => "iq", “is_placeholder” => false],1997 [“label” => "Ireland [+353]", “value” => "353", “code” => "ie", “is_placeholder” => false],1998 [“label” => "Isle of Man [+44]", “value” => "44", “code” => "im", “is_placeholder” => false],1999 [“label” => "Israel (‫ישראל‬‎) [+972]", “value” => "972", “code” => "il", “is_placeholder” => false],2000 [“label” => "Italy (Italia) [+39]", “value” => "39", “code” => "it", “is_placeholder” => false],2001 [“label” => "Jamaica [+1]", “value” => "1", “code” => "jm", “is_placeholder” => false],2002 [“label” => "Japan (日本) [+81]", “value” => "81", “code” => "jp", “is_placeholder” => false],2003 [“label” => "Jersey [+44]", “value” => "44", “code” => "je", “is_placeholder” => false],2004 [“label” => "Jordan (‫الأردن‬‎) [+962]", “value” => "962", “code” => "jo", “is_placeholder” => false],2005 [“label” => "Kazakhstan (Казахстан) [+7]", “value” => "7", “code” => "kz", “is_placeholder” => false],2006 [“label” => "Kenya [+254]", “value” => "254", “code” => "ke", “is_placeholder” => false],2007 [“label” => "Kiribati [+686]", “value” => "686", “code” => "ki", “is_placeholder” => false],2008 [“label” => "Kosovo [+383]", “value” => "383", “code” => "xk", “is_placeholder” => false],2009 [“label” => "Kuwait (‫الكويت‬‎) [+965]", “value” => "965", “code” => "kw", “is_placeholder” => false],2010 [“label” => "Kyrgyzstan (Кыргызстан) [+996]", “value” => "996", “code” => "kg", “is_placeholder” => false],2011 [“label” => "Laos (ລາວ) [+856]", “value” => "856", “code” => "la", “is_placeholder” => false],2012 [“label” => "Latvia (Latvija) [+371]", “value” => "371", “code” => "lv", “is_placeholder” => false],2013 [“label” => "Lebanon (‫لبنان‬‎) [+961]", “value” => "961", “code” => "lb", “is_placeholder” => false],2014 [“label” => "Lesotho [+266]", “value” => "266", “code” => "ls", “is_placeholder” => false],2015 [“label” => "Liberia [+231]", “value” => "231", “code” => "lr", “is_placeholder” => false],2016 [“label” => "Libya (‫ليبيا‬‎) [+218]", “value” => "218", “code” => "ly", “is_placeholder” => false],2017 [“label” => "Liechtenstein [+423]", “value” => "423", “code” => "li", “is_placeholder” => false],2018 [“label” => "Lithuania (Lietuva) [+370]", “value” => "370", “code” => "lt", “is_placeholder” => false],2019 [“label” => "Luxembourg [+352]", “value” => "352", “code” => "lu", “is_placeholder” => false],2020 [“label” => "Macau (澳門) [+853]", “value” => "853", “code” => "mo", “is_placeholder” => false],2021 [“label” => "Macedonia (FYROM) (Македонија) [+389]", “value” => "389", “code” => "mk", “is_placeholder” => false],2022 [“label” => "Madagascar (Madagasikara) [+261]", “value” => "261", “code” => "mg", “is_placeholder” => false],2023 [“label” => "Malawi [+265]", “value” => "265", “code” => "mw", “is_placeholder” => false],2024 [“label” => "Malaysia [+60]", “value” => "60", “code” => "my", “is_placeholder” => false],2025 [“label” => "Maldives [+960]", “value” => "960", “code” => "mv", “is_placeholder” => false],2026 [“label” => "Mali [+223]", “value” => "223", “code” => "ml", “is_placeholder” => false],2027 [“label” => "Malta [+356]", “value” => "356", “code” => "mt", “is_placeholder” => false],2028 [“label” => "Marshall Islands [+692]", “value” => "692", “code” => "mh", “is_placeholder” => false],2029 [“label” => "Martinique [+596]", “value” => "596", “code” => "mq", “is_placeholder” => false],2030 [“label” => "Mauritania (‫موريتانيا‬‎) [+222]", “value” => "222", “code” => "mr", “is_placeholder” => false],2031 [“label” => "Mauritius (Moris) [+230]", “value” => "230", “code” => "mu", “is_placeholder” => false],2032 [“label” => "Mayotte [+262]", “value” => "262", “code” => "yt", “is_placeholder” => false],2033 [“label” => "Mexico (México) [+52]", “value” => "52", “code” => "mx", “is_placeholder” => false],2034 [“label” => "Micronesia [+691]", “value” => "691", “code” => "fm", “is_placeholder” => false],2035 [“label” => "Moldova (Republica Moldova) [+373]", “value” => "373", “code” => "md", “is_placeholder” => false],2036 [“label” => "Monaco [+377]", “value” => "377", “code” => "mc", “is_placeholder” => false],2037 [“label” => "Mongolia (Монгол) [+976]", “value” => "976", “code” => "mn", “is_placeholder” => false],2038 [“label” => "Montenegro (Crna Gora) [+382]", “value” => "382", “code” => "me", “is_placeholder” => false],2039 [“label” => "Montserrat [+1664]", “value” => "1664", “code” => "ms", “is_placeholder” => false],2040 [“label” => "Morocco (‫المغرب‬‎) [+212]", “value” => "212", “code” => "ma", “is_placeholder” => false],2041 [“label” => "Mozambique (Moçambique) [+258]", “value” => "258", “code” => "mz", “is_placeholder” => false],2042 [“label” => "Myanmar (Burma) (မြန်မာ) [+95]", “value” => "95", “code” => "mm", “is_placeholder” => false],2043 [“label” => "Namibia (Namibië) [+264]", “value” => "264", “code” => "na", “is_placeholder” => false],2044 [“label” => "Nauru [+674]", “value” => "674", “code” => "nr", “is_placeholder” => false],2045 [“label” => "Nepal (नेपाल) [+977]", “value” => "977", “code” => "np", “is_placeholder” => false],2046 [“label” => "Netherlands (Nederland) [+31]", “value” => "31", “code” => "nl", “is_placeholder” => false],2047 [“label” => "New Caledonia (Nouvelle-Calédonie) [+687]", “value” => "687", “code” => "nc", “is_placeholder” => false],2048 [“label” => "New Zealand [+64]", “value” => "64", “code” => "nz", “is_placeholder” => false],2049 [“label” => "Nicaragua [+505]", “value” => "505", “code” => "ni", “is_placeholder” => false],2050 [“label” => "Niger (Nijar) [+227]", “value” => "227", “code” => "ne", “is_placeholder” => false],2051 [“label” => "Nigeria [+234]", “value” => "234", “code” => "ng", “is_placeholder” => false],2052 [“label” => "Niue [+683]", “value” => "683", “code” => "nu", “is_placeholder” => false],2053 [“label” => "Norfolk Island [+672]", “value” => "672", “code” => "nf", “is_placeholder” => false],2054 [“label” => "North Korea (조선 민주주의 인민 공화국) [+850]", “value” => "850", “code” => "kp", “is_placeholder” => false],2055 [“label” => "Northern Mariana Islands [+1670]", “value” => "1670", “code” => "mp", “is_placeholder” => false],2056 [“label” => "Norway (Norge) [+47]", “value” => "47", “code” => "no", “is_placeholder” => false],2057 [“label” => "Oman (‫عُمان‬‎) [+968]", “value” => "968", “code” => "om", “is_placeholder” => false],2058 [“label” => "Pakistan (‫پاکستان‬‎) [+92]", “value” => "92", “code” => "pk", “is_placeholder” => false],2059 [“label” => "Palau [+680]", “value” => "680", “code” => "pw", “is_placeholder” => false],2060 [“label” => "Palestine (‫فلسطين‬‎) [+970]", “value” => "970", “code” => "ps", “is_placeholder” => false],2061 [“label” => "Panama (Panamá) [+507]", “value” => "507", “code” => "pa", “is_placeholder” => false],2062 [“label” => "Papua New Guinea [+675]", “value” => "675", “code” => "pg", “is_placeholder” => false],2063 [“label” => "Paraguay [+595]", “value” => "595", “code” => "py", “is_placeholder” => false],2064 [“label” => "Peru (Perú) [+51]", “value” => "51", “code” => "pe", “is_placeholder” => false],2065 [“label” => "Philippines [+63]", “value” => "63", “code” => "ph", “is_placeholder” => false],2066 [“label” => "Poland (Polska) [+48]", “value” => "48", “code” => "pl", “is_placeholder” => false],2067 [“label” => "Portugal [+351]", “value” => "351", “code” => "pt", “is_placeholder” => false],2068 [“label” => "Puerto Rico [+1]", “value” => "1", “code” => "pr", “is_placeholder” => false],2069 [“label” => "Qatar (‫قطر‬‎) [+974]", “value” => "974", “code” => "qa", “is_placeholder” => false],2070 [“label” => "Réunion (La Réunion) [+262]", “value” => "262", “code” => "re", “is_placeholder” => false],2071 [“label” => "Romania (România) [+40]", “value” => "40", “code” => "ro", “is_placeholder” => false],2072 [“label” => "Russia (Россия) [+7]", “value” => "7", “code” => "ru", “is_placeholder” => false],2073 [“label” => "Rwanda [+250]", “value” => "250", “code” => "rw", “is_placeholder” => false],2074 [“label” => "Saint Barthélemy [+590]", “value” => "590", “code” => "bl", “is_placeholder” => false],2075 [“label” => "Saint Helena [+290]", “value” => "290", “code” => "sh", “is_placeholder” => false],2076 [“label” => "Saint Kitts and Nevis [+1869]", “value” => "1869", “code” => "kn", “is_placeholder” => false],2077 [“label” => "Saint Lucia [+1758]", “value” => "1758", “code” => "lc", “is_placeholder” => false],2078 [“label” => "Saint Martin (Saint-Martin (partie française)) [+590]", “value” => "590", “code” => "mf", “is_placeholder” => false],2079 [“label” => "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon) [+508]", “value” => "508", “code” => "pm", “is_placeholder” => false],2080 [“label” => "Saint Vincent and the Grenadines [+1784]", “value” => "1784", “code” => "vc", “is_placeholder” => false],2081 [“label” => "Samoa [+685]", “value” => "685", “code” => "ws", “is_placeholder” => false],2082 [“label” => "San Marino [+378]", “value” => "378", “code” => "sm", “is_placeholder” => false],2083 [“label” => "São Tomé and Príncipe (São Tomé e Príncipe) [+239]", “value” => "239", “code” => "st", “is_placeholder” => false],2084 [“label” => "Saudi Arabia (‫المملكة العربية السعودية‬‎) [+966]", “value” => "966", “code” => "sa", “is_placeholder” => false],2085 [“label” => "Senegal (Sénégal) [+221]", “value” => "221", “code” => "sn", “is_placeholder” => false],2086 [“label” => "Serbia (Србија) [+381]", “value” => "381", “code” => "rs", “is_placeholder” => false],2087 [“label” => "Seychelles [+248]", “value” => "248", “code” => "sc", “is_placeholder” => false],2088 [“label” => "Sierra Leone [+232]", “value” => "232", “code” => "sl", “is_placeholder” => false],2089 [“label” => "Singapore [+65]", “value” => "65", “code” => "sg", “is_placeholder” => false],2090 [“label” => "Sint Maarten [+1721]", “value” => "1721", “code” => "sx", “is_placeholder” => false],2091 [“label” => "Slovakia (Slovensko) [+421]", “value” => "421", “code” => "sk", “is_placeholder” => false],2092 [“label” => "Slovenia (Slovenija) [+386]", “value” => "386", “code” => "si", “is_placeholder” => false],2093 [“label” => "Solomon Islands [+677]", “value” => "677", “code” => "sb", “is_placeholder” => false],2094 [“label” => "Somalia (Soomaaliya) [+252]", “value” => "252", “code” => "so", “is_placeholder” => false],2095 [“label” => "South Africa [+27]", “value” => "27", “code” => "za", “is_placeholder” => false],2096 [“label” => "South Korea (대한민국) [+82]", “value” => "82", “code” => "kr", “is_placeholder” => false],2097 [“label” => "South Sudan (‫جنوب السودان‬‎) [+211]", “value” => "211", “code” => "ss", “is_placeholder” => false],2098 [“label” => "Spain (España) [+34]", “value” => "34", “code” => "es", “is_placeholder” => false],2099 [“label” => "Sri Lanka (ශ්‍රී ලංකාව) [+94]", “value” => "94", “code” => "lk", “is_placeholder” => false],2100 [“label” => "Sudan (‫السودان‬‎) [+249]", “value” => "249", “code” => "sd", “is_placeholder” => false],2101 [“label” => "Suriname [+597]", “value” => "597", “code” => "sr", “is_placeholder” => false],2102 [“label” => "Svalbard and Jan Mayen [+47]", “value” => "47", “code” => "sj", “is_placeholder” => false],2103 [“label” => "Swaziland [+268]", “value” => "268", “code” => "sz", “is_placeholder” => false],2104 [“label” => "Sweden (Sverige) [+46]", “value” => "46", “code” => "se", “is_placeholder” => false],2105 [“label” => "Switzerland (Schweiz) [+41]", “value” => "41", “code” => "ch", “is_placeholder” => false],2106 [“label” => "Syria (‫سوريا‬‎) [+963]", “value” => "963", “code” => "sy", “is_placeholder” => false],2107 [“label” => "Taiwan (台灣) [+886]", “value” => "886", “code” => "tw", “is_placeholder” => false],2108 [“label” => "Tajikistan [+992]", “value” => "992", “code” => "tj", “is_placeholder” => false],2109 [“label” => "Tanzania [+255]", “value” => "255", “code” => "tz", “is_placeholder” => false],2110 [“label” => "Thailand (ไทย) [+66]", “value” => "66", “code” => "th", “is_placeholder” => false],2111 [“label” => "Timor-Leste [+670]", “value” => "670", “code” => "tl", “is_placeholder” => false],2112 [“label” => "Togo [+228]", “value” => "228", “code” => "tg", “is_placeholder” => false],2113 [“label” => "Tokelau [+690]", “value” => "690", “code” => "tk", “is_placeholder” => false],2114 [“label” => "Tonga [+676]", “value” => "676", “code” => "to", “is_placeholder” => false],2115 [“label” => "Trinidad and Tobago [+1868]", “value” => "1868", “code” => "tt", “is_placeholder” => false],2116 [“label” => "Tunisia (‫تونس‬‎) [+216]", “value” => "216", “code” => "tn", “is_placeholder” => false],2117 [“label” => "Turkey (Türkiye) [+90]", “value” => "90", “code” => "tr", “is_placeholder” => false],2118 [“label” => "Turkmenistan [+993]", “value” => "993", “code” => "tm", “is_placeholder” => false],2119 [“label” => "Turks and Caicos Islands [+1649]", “value” => "1649", “code” => "tc", “is_placeholder” => false],2120 [“label” => "Tuvalu [+688]", “value” => "688", “code” => "tv", “is_placeholder” => false],2121 [“label” => "U.S. Virgin Islands [+1340]", “value” => "1340", “code” => "vi", “is_placeholder” => false],2122 [“label” => "Uganda [+256]", “value” => "256", “code” => "ug", “is_placeholder” => false],2123 [“label” => "Ukraine (Україна) [+380]", “value” => "380", “code” => "ua", “is_placeholder” => false],2124 [“label” => "United Arab Emirates (‫الإمارات العربية المتحدة‬‎) [+971]", “value” => "971", “code” => "ae", “is_placeholder” => false],2125 [“label” => "United Kingdom [+44]", “value” => "44", “code” => "gb", “is_placeholder” => false],2126 [“label” => "United States [+1]", “value” => "1", “code” => "us", “is_placeholder” => false],2127 [“label” => "Uruguay [+598]", “value” => "598", “code” => "uy", “is_placeholder” => false],2128 [“label” => "Uzbekistan (Oʻzbekiston) [+998]", “value” => "998", “code” => "uz", “is_placeholder” => false],2129 [“label” => "Vanuatu [+678]", “value” => "678", “code” => "vu", “is_placeholder” => false],2130 [“label” => "Vatican City (Città del Vaticano) [+39]", “value” => "39", “code” => "va", “is_placeholder” => false],2131 [“label” => "Venezuela [+58]", “value” => "58", “code” => "ve", “is_placeholder” => false],2132 [“label” => "Vietnam (Việt Nam) [+84]", “value” => "84", “code” => "vn", “is_placeholder” => false],2133 [“label” => "Wallis and Futuna (Wallis-et-Futuna) [+681]", “value” => "681", “code” => "wf", “is_placeholder” => false],2134 [“label” => "Western Sahara (‫الصحراء الغربية‬‎) [+212]", “value” => "212", “code” => "eh", “is_placeholder” => false],2135 [“label” => "Yemen (‫اليمن‬‎) [+967]", “value” => "967", “code” => "ye", “is_placeholder” => false],2136 [“label” => "Zambia [+260]", “value” => "260", “code” => "zm", “is_placeholder” => false],2137 [“label” => "Zimbabwe [+263]", “value” => "263", “code” => "zw", “is_placeholder” => false],2138 [“label” => "Åland Islands [+358]", “value” => "358", “code” => "ax", “is_placeholder” => false]];2139// foreach ($countries as $country) {2140// print_r("[\"label\"=>\"".$country[0] . ' [+’ . $country[2] . ']'."\",”);2141// print_r(“\"value\"=>\"".$country[2] ."\",”);2142// print_r(“\"code\"=>\"".$country[1] ."\",”);2143// print_r("\"is_placeholder\"=>false]");2144//2145// $option = [2146// ‘label’ => $country[0] . ' [+’ . $country[2] . ']',2147// ‘value’ => $country[2],2148// ‘code’ => $country[1],2149// ‘is_placeholder’ => false,2150// ];2151//// print_r($option);2152// print_r(“,<br>”);2153//2154//// array_push($retrun_array, $option);2155// }2156// print_r($retrun_array);2157// print_r(“<br>”);2158// die();2159 return $retrun_array;2160 }21612162 function setting_instructions()2163 {2164 $options = get_option(‘idehweb_lwp_settings’);2165 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = '’;2166 $display = 'inherit’;2167 if (!$options[‘idehweb_phone_number’]) {2168 $display = 'none’;2169 }2170 echo ‘<div> <p>’ . __('make a page and name it login, put the shortcode inside it, now you have a login page!’, ‘login-with-phone-number’) . '</p>2171 <p><code>[idehweb_lwp]</code></p>’;2172 echo ‘<div> <p>’ . __('For showing metas of user for example in profile page, like: showing phone number, username, email, nicename’, ‘login-with-phone-number’) . ‘</p>2173 <p><code>[idehweb_lwp_metas nicename="false" username="false" phone_number="true" email="false"]</code></p>2174 <p><a href="https://idehweb.com/product/login-with-phone-number-in-wordpress/" target="_blank" class="lwp_more_help">’ . __('Need more help?’, ‘login-with-phone-number’) . '</a></p>2175 </div>’;2176 }21772178 function setting_country_code()2179 {2180 $options = get_option(‘idehweb_lwp_settings’);2181 if (!isset($options[‘idehweb_country_codes’])) $options[‘idehweb_country_codes’] = [“uk”];2182 $country_codes = $this->get_country_code_options();2183// print_r($options[‘idehweb_country_codes’]);2184 ?>2185 <select name="idehweb_lwp_settings[idehweb_country_codes][]" id="idehweb_country_codes" multiple>2186 <?php2187 foreach ($country_codes as $country) {2188 $rr = in_array($country[“code”], $options[‘idehweb_country_codes’]);2189 echo ‘<option value="’ . esc_attr($country[“code”]) . ‘" ' . ($rr ? ' selected="selected"’ : ‘’) . ‘>’ . esc_html($country[‘label’]) . '</option>’;2190 }2191 ?>2192 </select>2193 <?php21942195 }21962197 function setting_country_code_default()2198 {2199 $options = get_option(‘idehweb_lwp_settings’);2200 if (!isset($options[‘idehweb_country_codes_default’])) $options[‘idehweb_country_codes_default’] = “";2201 $country_codes = $this->get_country_code_options();2202// print_r($country_codes);22032204 ?>2205 <select name="idehweb_lwp_settings[idehweb_country_codes_default]" id="idehweb_country_codes_default">2206 <option selected="selected” value="">select default country</option>2207 <?php2208 if ($options[‘idehweb_country_codes’])2209 foreach ($country_codes as $country) {2210 if (in_array($country[“code”], $options[‘idehweb_country_codes’])) {2211 $rr = ($country[“code”] == $options[‘idehweb_country_codes_default’]);2212 echo ‘<option value="’ . esc_attr($country[“code”]) . ‘" ' . ($rr ? ' selected="selected"’ : ‘’) . ‘>’ . esc_html($country[‘label’]) . '</option>’;2213 } else {22142215 }2216 }2217 ?>2218 </select>2219 <!-- <p class="description">note: if you change accepted countries, you update this after save.</p>–>2220 <?php22212222 }22232224 function setting_default_username()2225 {2226 $options = get_option(‘idehweb_lwp_settings’);2227 if (!isset($options[‘idehweb_default_username’])) $options[‘idehweb_default_username’] = 'user’;22282229 echo ‘<input id="lwp_default_username" type="text" name="idehweb_lwp_settings[idehweb_default_username]" class="regular-text" value="’ . esc_attr($options[‘idehweb_default_username’]) . ‘" />2230 <p class="description">’ . __('Default username’, ‘login-with-phone-number’) . '</p>’;22312232 }22332234 function setting_default_nickname()2235 {2236 $options = get_option(‘idehweb_lwp_settings’);2237 if (!isset($options[‘idehweb_default_nickname’])) $options[‘idehweb_default_nickname’] = 'user’;223822392240 echo ‘<input id="lwp_default_nickname" type="text" name="idehweb_lwp_settings[idehweb_default_nickname]" class="regular-text" value="’ . esc_attr($options[‘idehweb_default_nickname’]) . ‘" />2241 <p class="description">’ . __('Default nickname’, ‘login-with-phone-number’) . '</p>’;22422243 }224422452246 function setting_buy_credit()2247 {2248 $options = get_option(‘idehweb_lwp_settings’);2249 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = '’;2250 if (!isset($options[‘idehweb_website_url’])) $options[‘idehweb_website_url’] = '’;2251 if (!isset($options[‘idehweb_phone_number_ccode’])) $options[‘idehweb_phone_number_ccode’] = '’;2252 $display = 'inherit’;2253 if (!$options[‘idehweb_phone_number’]) {2254 $display = 'none’;2255 }2256 ?>22572258 <div class="creditor">2259 <button type="button" class="button-primary loiuyt"2260 value="<?php _e('Check credit’, ‘login-with-phone-number’); ?>"><?php _e('Check credit’, ‘login-with-phone-number’); ?></button>2261 <span class="cp"></span>22622263 <button type="button" class="button-primary refreshShop"2264 value="<?php _e('Refresh’, ‘login-with-phone-number’); ?>"><?php _e('Refresh’, ‘login-with-phone-number’); ?></button>2265 <span class="df">2266 <?php echo esc_url($options[‘idehweb_website_url’]); ?>22672268 </span>2269 </div>227022712272 <div class="chargeAccount">22732274 </div>2275 <?php2276 }22772278 function settings_validate($input)2279 {22802281 return $input;2282 }22832284 function removePhpComments($str, $preserveWhiteSpace = true)2285 {2286 $commentTokens = [2287 \T_COMMENT,2288 \T_DOC_COMMENT,2289 ];2290 $tokens = token_get_all($str);229122922293 if (true === $preserveWhiteSpace) {2294 $lines = explode(PHP_EOL, $str);2295 }229622972298 $s = '’;2299 foreach ($tokens as $token) {2300 if (is_array($token)) {2301 if (in_array($token[0], $commentTokens)) {2302 if (true === $preserveWhiteSpace) {2303 $comment = $token[1];2304 $lineNb = $token[2];2305 $firstLine = $lines[$lineNb - 1];2306 $p = explode(PHP_EOL, $comment);2307 $nbLineComments = count($p);2308 if ($nbLineComments < 1) {2309 $nbLineComments = 1;2310 }2311 $firstCommentLine = array_shift($p);23122313 $isStandAlone = (trim($firstLine) === trim($firstCommentLine));23142315 if (false === $isStandAlone) {2316 if (2 === $nbLineComments) {2317 $s .= PHP_EOL;2318 }23192320 continue; // just remove inline comments2321 }23222323 // stand alone case2324 $s .= str_repeat(PHP_EOL, $nbLineComments - 1);2325 }2326 continue;2327 }2328 $token = $token[1];2329 }23302331 $s .= $token;2332 }2333 return $s;2334 }23352336 function enqueue_scripts()2337 {2338// print_r(“hoiihihihjihih”);2339 $options = get_option(‘idehweb_lwp_settings’);2340 if (!isset($options[‘idehweb_redirect_url’])) $options[‘idehweb_redirect_url’] = home_url();2341 if (!isset($options[‘idehweb_default_gateways’])) $options[‘idehweb_default_gateways’] = [‘firebase’];2342 if (!isset($options[‘idehweb_use_custom_gateway’])) $options[‘idehweb_use_custom_gateway’] = '1’;2343 if (!isset($options[‘idehweb_firebase_api’])) $options[‘idehweb_firebase_api’] = '’;2344 if (!isset($options[‘idehweb_firebase_config’])) $options[‘idehweb_firebase_config’] = '’;2345 if (!isset($options[‘idehweb_enable_timer_on_sending_sms’])) $options[‘idehweb_enable_timer_on_sending_sms’] = '1’;2346 if (!isset($options[‘idehweb_timer_count’])) $options[‘idehweb_timer_count’] = '60’;2347// if (!isset($options[‘idehweb_default_gateways’])) $options[‘idehweb_default_gateways’] = '’;2348 if (!is_array($options[‘idehweb_default_gateways’])) {2349 $options[‘idehweb_default_gateways’] = [];2350 }23512352 $localize = array(2353 ‘ajaxurl’ => admin_url(‘admin-ajax.php’),2354 ‘redirecturl’ => $options[‘idehweb_redirect_url’],2355 ‘UserId’ => 0,2356 ‘loadingmessage’ => __('please wait…’, ‘login-with-phone-number’),2357 ‘timer’ => $options[‘idehweb_enable_timer_on_sending_sms’],2358 ‘timer_count’ => $options[‘idehweb_timer_count’],2359 );23602361 wp_enqueue_style('idehweb-lwp’, plugins_url('/styles/login-with-phonenumber.css’, __FILE__));23622363 wp_enqueue_script('idehweb-lwp-validate-script’, plugins_url('/scripts/jquery.validate.js’, __FILE__), array(‘jquery’));236423652366 wp_enqueue_script('idehweb-lwp’, plugins_url('/scripts/login-with-phonenumber.js’, __FILE__), array(‘jquery’));236723682369 if ($options[‘idehweb_use_custom_gateway’] == ‘1’ && in_array('firebase’, $options[‘idehweb_default_gateways’])) {2370 wp_enqueue_script('lwp-firebase’, 'https://www.gstatic.com/firebasejs/7.21.0/firebase-app.js’, array(), false, true);2371 wp_enqueue_script('lwp-firebase-auth’, 'https://www.gstatic.com/firebasejs/7.21.0/firebase-auth.js’, array(), false, true);2372 wp_enqueue_script('lwp-firebase-sender’, plugins_url('/scripts/firebase-sender.js’, __FILE__), array(‘jquery’));23732374 $localize[‘firebase_api’] = $options[‘idehweb_firebase_api’];2375 }2376 wp_localize_script('idehweb-lwp’, 'idehweb_lwp’, $localize);2377 if ($options[‘idehweb_use_custom_gateway’] == ‘1’ && in_array('firebase’, $options[‘idehweb_default_gateways’])) {23782379 wp_add_inline_script('idehweb-lwp’, ‘’ . htmlspecialchars_decode($options[‘idehweb_firebase_config’]));2380 }238123822383 // integrate intl-tel-input2384 // get allowed countries2385 $onlyCountries = [];2386 $options = get_option(‘idehweb_lwp_settings’);2387 if (!isset($options[‘idehweb_country_codes’])) $options[‘idehweb_country_codes’] = [“uk”];2388 if (!isset($options[‘idehweb_country_codes_default’])) $options[‘idehweb_country_codes_default’] = “";2389 $country_codes = $this->get_country_code_options();2390 foreach ($country_codes as $country) {2391 $rr = in_array($country[“code”], $options[‘idehweb_country_codes’]);2392 if ($rr) $onlyCountries[] = $country[“code”];2393 }2394// get initial/default country, and make sure it exists in allowed counties2395 $initialCountry = $options[‘idehweb_country_codes_default’];2396 $initialCountry = in_array($initialCountry, $onlyCountries) ? $initialCountry : '’;239723982399 wp_enqueue_style('lwp-intltelinput-style’, plugins_url('/styles/intlTelInput.min.css’, __FILE__));2400 wp_add_inline_style('lwp-intltelinput-style’, ‘.iti { width: 100%; }#phone{font-size: 20px;}’);2401 wp_enqueue_script('lwp-intltelinput-script’, plugins_url('/scripts/intlTelInput.min.js’, __FILE__), array(), false, true);2402 wp_add_inline_script(‘lwp-intltelinput-script’, '(function(){2403 var input = document.querySelector(“#phone”);2404 if(input){2405 window.intlTelInput(input, {2406 utilsScript: "’ . esc_url(plugins_url('/scripts/utils.js’, __FILE__)) . '",2407 hiddenInput: “lwp_username",2408 onlyCountries: ' . (wp_json_encode($onlyCountries)) . ‘,2409 initialCountry: "’ . esc_html($initialCountry) . ‘",2410 });2411 }2412 })();’);241324142415 }24162417 function idehweb_lwp_metas($vals)2418 {24192420 $atts = shortcode_atts(array(2421 ‘email’ => false,2422 ‘phone_number’ => true,2423 ‘username’ => false,2424 ‘nicename’ => false24252426 ), $vals);2427 ob_start();2428 $user = wp_get_current_user();2429 if (!isset($atts[‘username’])) $atts[‘username’] = false;2430 if (!isset($atts[‘nicename’])) $atts[‘nicename’] = false;2431 if (!isset($atts[‘email’])) $atts[‘email’] = false;2432 if (!isset($atts[‘phone_number’])) $atts[‘phone_number’] = true;2433 if ($atts[‘username’] == ‘true’) {2434 echo ‘<div class="lwp user_login">’ . esc_html($user->user_login) . '</div>’;2435 }2436 if ($atts[‘nicename’] == ‘true’) {2437 echo ‘<div class="lwp user_nicename">’ . esc_html($user->user_nicename) . '</div>’;24382439 }2440 if ($atts[‘email’] == ‘true’) {2441 echo ‘<div class="lwp user_email">’ . esc_html($user->user_email) . '</div>’;24422443 }2444 if ($atts[‘phone_number’] == ‘true’) {2445 echo ‘<div class="lwp user_email">’ . esc_html(get_user_meta($user->ID, 'phone_number’, true)) . '</div>’;2446 }2447 return ob_get_clean();2448 }24492450 function shortcode($atts)2451 {24522453 extract(shortcode_atts(array(2454 ‘redirect_url’ => '’2455 ), $atts));2456 ob_start();2457 $options = get_option(‘idehweb_lwp_settings’);2458 $localizationoptions = get_option(‘idehweb_lwp_settings_localization’);24592460 if (class_exists(LWP_PRO::class)) {2461// $LWP_PRO = new LWP_PRO;2462 global $LWP_PRO;2463 $image_id = $LWP_PRO->lwp_logo();2464 }2465 if (!isset($image_id)) $image_id = 0;2466 if (!isset($options[‘idehweb_sms_login’])) $options[‘idehweb_sms_login’] = '1’;2467 if (!isset($options[‘idehweb_enable_accept_terms_and_condition’])) $options[‘idehweb_enable_accept_terms_and_condition’] = '1’;2468 if (!isset($options[‘idehweb_term_and_conditions_link’])) $options[‘idehweb_term_and_conditions_link’] = '#’;2469 if (!isset($options[‘idehweb_term_and_conditions_text’])) $options[‘idehweb_term_and_conditions_text’] = __('By submitting, you agree to the Terms and Privacy Policy’, ‘login-with-phone-number’);2470 else $options[‘idehweb_term_and_conditions_text’] = ($options[‘idehweb_term_and_conditions_text’]);2471 if (!isset($options[‘idehweb_term_and_conditions_default_checked’])) $options[‘idehweb_term_and_conditions_default_checked’] = '0’;2472 if (!isset($options[‘idehweb_email_login’])) $options[‘idehweb_email_login’] = '1’;2473 if (!isset($options[‘idehweb_password_login’])) $options[‘idehweb_password_login’] = '1’;2474 if (!isset($options[‘idehweb_redirect_url’])) $options[‘idehweb_redirect_url’] = '’;2475 if (!isset($options[‘idehweb_login_message’])) $options[‘idehweb_login_message’] = 'Welcome, You are logged in…’;2476 if (!isset($options[‘idehweb_country_codes’])) $options[‘idehweb_country_codes’] = [];2477 if (!isset($options[‘idehweb_position_form’])) $options[‘idehweb_position_form’] = '0’;24782479 if (!isset($options[‘idehweb_default_gateways’])) $options[‘idehweb_default_gateways’] = [‘firebase’];2480 if (!is_array($options[‘idehweb_default_gateways’])) {2481 $options[‘idehweb_default_gateways’] = [];2482 }24832484 if (!isset($localizationoptions[‘idehweb_localization_placeholder_of_phonenumber_field’])) $localizationoptions[‘idehweb_localization_placeholder_of_phonenumber_field’] = '’;2485 if (!isset($localizationoptions[‘idehweb_localization_title_of_login_form’])) $localizationoptions[‘idehweb_localization_title_of_login_form’] = '’;2486 if (!isset($localizationoptions[‘idehweb_localization_title_of_login_form_email’])) $localizationoptions[‘idehweb_localization_title_of_login_form_email’] = '’;24872488 $class = '’;2489 if ($options[‘idehweb_position_form’] == ‘1’) {2490 $class = 'lw-sticky’;2491 }2492 $theClasses=’’;2493 if ($options[‘idehweb_default_gateways’][0])2494 $theClasses=$options[‘idehweb_default_gateways’][0];24952496 $is_user_logged_in = is_user_logged_in();2497 if (!$is_user_logged_in) {2498 ?>2499 <a id="show_login” class="show_login"2500 style="display: none"2501 data-sticky="<?php echo esc_attr($options[‘idehweb_position_form’]); ?>"><?php echo __('login’, ‘login-with-phone-number’); ?></a>2502 <div class="lwp_forms_login <?php echo esc_attr($class); ?>">2503 <?php2504 if ($options[‘idehweb_sms_login’]) {2505 if ($options[‘idehweb_email_login’] && $options[‘idehweb_sms_login’]) {2506 $cclass = 'display:none’;2507 } else if (!$options[‘idehweb_email_login’] && $options[‘idehweb_sms_login’]) {2508 $cclass = 'display:block’;2509 }25102511 ?>2512 <form id="lwp_login” class="ajax-auth lwp-login-form-i <?php echo $theClasses; ?>" data-method="<?php echo $theClasses; ?>" action="login" style="<?php echo $cclass; ?>" method="post">2513 <?php2514 if (intval($image_id) > 0) {2515 $image = wp_get_attachment_image($image_id, 'full’, false, array(‘class’ => ‘lwp_media-logo-image’));2516 echo ‘<div class="lwp_logo_parent">’ . $image . '</div>’;2517 }2518 ?>2519 <div class="lh1"><?php echo isset($localizationoptions[‘idehweb_localization_status’]) ? esc_html($localizationoptions[‘idehweb_localization_title_of_login_form’]) : (__('Login / register’, ‘login-with-phone-number’)); ?></div>2520 <p class="status"></p>2521 <?php wp_nonce_field('ajax-login-nonce’, ‘security’); ?>2522 <div class="lwp-form-box">2523 <label class="lwp_labels"2524 for="lwp_username"><?php echo __('Phone number’, ‘login-with-phone-number’); ?></label>2525 <?php2526 // $country_codes = $this->get_country_code_options();2527 ?>2528 <div class="lwp-form-box-bottom">2529 <input type="hidden" id="lwp_country_codes">2530 <input type="tel" id="phone" class="required lwp_username the_lwp_input"2531 placeholder="<?php echo ($localizationoptions[‘idehweb_localization_placeholder_of_phonenumber_field’]) ? sanitize_text_field($localizationoptions[‘idehweb_localization_placeholder_of_phonenumber_field’]) : (__('’, ‘login-with-phone-number’)); ?>">2532 </div>2533 </div>2534 <?php if ($options[‘idehweb_enable_accept_terms_and_condition’] == ‘1’) { ?>2535 <div class="accept_terms_and_conditions">2536 <input class="required lwp_check_box" type="checkbox" name="lwp_accept_terms"2537 <?php echo(($options[‘idehweb_term_and_conditions_default_checked’] == ‘1’) ? ‘checked="checked"’ : ‘’); ?>>2538 <a href="<?php echo esc_url($options[‘idehweb_term_and_conditions_link’]); ?>">2539 <span class="accept_terms_and_conditions_text"><?php echo esc_html($options[‘idehweb_term_and_conditions_text’]); ?></span>2540 </a>2541 </div>2542 <?php } ?>2543 <div class="lwp_otp_gateways">2544 <?php2545 if (count($options[‘idehweb_default_gateways’]) > 1)2546 foreach ($options[‘idehweb_default_gateways’] as $key => $gateway) {2547// echo $key;2548 ?>2549 <span class="lwp-radio-otp"><input type="radio" name="otp-method"2550 value="<?php echo $gateway; ?>" <?php echo(($key == 0) ? “checked=\"checked\"” : “”) ?>/><label2551 for="<?php echo $gateway; ?>"><?php echo $gateway; ?></label></span>25522553 <?php2554 }2555 // print_r($options[‘idehweb_default_gateways’]);2556 ?>2557 </div>2558 <button class="submit_button auth_phoneNumber" type="submit">2559 <?php echo __('Submit’, ‘login-with-phone-number’); ?>2560 </button>2561 <?php2562 if ($options[‘idehweb_email_login’]) {2563 ?>2564 <button class="submit_button auth_with_email secondaryccolor" type="button">2565 <?php echo __('Login with email’, ‘login-with-phone-number’); ?>2566 </button>2567 <?php } ?>2568 <a class="close" href="">(x)</a>2569 </form>2570 <?php } ?>2571 <?php2572 if ($options[‘idehweb_email_login’]) {2573 $ecclass = 'display:block’;2574 ?>2575 <form id="lwp_login_email" class="ajax-auth" action="loginemail" style="<?php echo $ecclass; ?>"2576 method="post">2577 <?php2578 if (intval($image_id) > 0) {2579 $image = wp_get_attachment_image($image_id, 'full’, false, array(‘class’ => ‘lwp_media-logo-image’));2580 echo ‘<div class="lwp_logo_parent">’ . $image . '</div>’;2581 }2582 ?>2583 <div class="lh1"><?php echo isset($localizationoptions[‘idehweb_localization_status’]) ? esc_html($localizationoptions[‘idehweb_localization_title_of_login_form_email’]) : (__('Login / register’, ‘login-with-phone-number’)); ?></div>2584 <p class="status"></p>2585 <?php wp_nonce_field('ajax-login-nonce’, ‘security’); ?>2586 <label class="lwp_labels"2587 for="lwp_email"><?php echo __('Your email:’, ‘login-with-phone-number’); ?></label>2588 <input type="email" class="required lwp_email the_lwp_input" name="lwp_email"2589 placeholder="<?php echo __('Please enter your email’, ‘login-with-phone-number’); ?>">2590 <?php if ($options[‘idehweb_enable_accept_terms_and_condition’] == ‘1’) { ?>2591 <div class="accept_terms_and_conditions">25922593 <input class="required lwp_check_box lwp_accept_terms_email" type="checkbox"2594 name="lwp_accept_terms_email" <?php echo(($options[‘idehweb_term_and_conditions_default_checked’] == ‘1’) ? ‘checked="checked"’ : ‘’); ?> >2595 <a href="<?php echo esc_url($options[‘idehweb_term_and_conditions_link’]); ?>">2596 <span class="accept_terms_and_conditions_text"><?php echo esc_html($options[‘idehweb_term_and_conditions_text’]); ?></span>2597 </a>2598 </div>2599 <?php } ?>2600 <button class="submit_button auth_email" type="submit">2601 <?php echo __('Submit’, ‘login-with-phone-number’); ?>2602 </button>2603 <?php2604 if ($options[‘idehweb_sms_login’]) {2605 ?>2606 <button class="submit_button auth_with_phoneNumber secondaryccolor" type="button">2607 <?php echo __('Login with phone number’, ‘login-with-phone-number’); ?>2608 </button>2609 <?php } ?>2610 <a class="close" href="">(x)</a>2611 </form>2612 <?php } ?>26132614 <form id="lwp_activate" data-method="<?php echo $theClasses; ?>" class="ajax-auth lwp-register-form-i <?php echo $theClasses; ?>" action="activate" method="post">2615 <div class="lh1"><?php echo __('Activation’, ‘login-with-phone-number’); ?></div>2616 <p class="status"></p>2617 <?php wp_nonce_field('ajax-login-nonce’, ‘security’); ?>2618 <div class="lwp_top_activation">2619 <div class="lwp_timer"></div>262026212622 </div>2623 <label class="lwp_labels"2624 for="lwp_scode"><?php echo __('Security code’, ‘login-with-phone-number’); ?></label>2625 <input type="text" class="required lwp_scode" name="lwp_scode" placeholder="ـ ـ ـ ـ ـ ـ">26262627 <button class="submit_button auth_secCode">2628 <?php echo __('Activate’, ‘login-with-phone-number’); ?>2629 </button>2630 <button class="submit_button lwp_didnt_r_c lwp_disable <?php echo $theClasses; ?>" type="button">2631 <?php echo __('Send code again’, ‘login-with-phone-number’); ?>2632 </button>2633 <hr class="lwp_line"/>2634 <div class="lwp_bottom_activation">2635 <a class="lwp_change_pn" href="#">2636 <?php echo __('Change phone number?’, ‘login-with-phone-number’); ?>2637 </a>2638 <a class="lwp_change_el" href="#">2639 <?php echo __('Change email?’, ‘login-with-phone-number’); ?>2640 </a>2641 </div>2642 <a class="close" href="">(x)</a>2643 </form>26442645 <?php2646 if ($options[‘idehweb_password_login’]) {2647 ?>2648 <form id="lwp_update_password" class="ajax-auth" action="update_password" method="post">26492650 <div class="lh1"><?php echo __('Update password’, ‘login-with-phone-number’); ?></div>2651 <p class="status"></p>2652 <?php wp_nonce_field('ajax-login-nonce’, ‘security’); ?>2653 <label class="lwp_labels"2654 for="lwp_email"><?php echo __('Enter new password:’, ‘login-with-phone-number’); ?></label>2655 <input type="password" class="required lwp_up_password" name="lwp_up_password"2656 placeholder="<?php echo __('Please choose a password’, ‘login-with-phone-number’); ?>">26572658 <button class="submit_button auth_email" type="submit">2659 <?php echo __('Update’, ‘login-with-phone-number’); ?>2660 </button>2661 <a class="close" href="">(x)</a>2662 </form>2663 <form id="lwp_enter_password" class="ajax-auth" action="enter_password" method="post">26642665 <div class="lh1"><?php echo __('Enter password’, ‘login-with-phone-number’); ?></div>2666 <p class="status"></p>2667 <?php wp_nonce_field('ajax-login-nonce’, ‘security’); ?>2668 <label class="lwp_labels"2669 for="lwp_email"><?php echo __('Your password:’, ‘login-with-phone-number’); ?></label>2670 <input type="password" class="required lwp_auth_password" name="lwp_auth_password"2671 placeholder="<?php echo __('Please enter your password’, ‘login-with-phone-number’); ?>">26722673 <button class="submit_button login_with_pass" type="submit">2674 <?php echo __('Login’, ‘login-with-phone-number’); ?>2675 </button>2676 <button class="submit_button forgot_password <?php echo $theClasses; ?>" type="button">2677 <?php echo __('Forgot password’, ‘login-with-phone-number’); ?>2678 </button>2679 <hr class="lwp_line"/>2680 <div class="lwp_bottom_activation">26812682 <a class="lwp_change_pn" href="#">2683 <?php echo __('Change phone number?’, ‘login-with-phone-number’); ?>2684 </a>2685 <a class="lwp_change_el" href="#">2686 <?php echo __('Change email?’, ‘login-with-phone-number’); ?>2687 </a>2688 </div>26892690 <a class="close" href="">(x)</a>2691 </form>2692 <?php } ?>2693 </div>2694 <?php2695 } else {2696 if ($options[‘idehweb_redirect_url’])2697 wp_redirect(esc_url($options[‘idehweb_redirect_url’]));2698 else if ($options[‘idehweb_login_message’])2699 echo esc_html($options[‘idehweb_login_message’]);2700 }2701 return ob_get_clean();2702 }27032704 function phone_number_exist($phone_number)2705 {2706 $args = array(2707 ‘meta_query’ => array(2708 array(2709 ‘key’ => 'phone_number’,2710 ‘value’ => $phone_number,2711 ‘compare’ => '=’2712 )2713 )2714 );27152716 $member_arr = get_users($args);2717 if ($member_arr && $member_arr[0])2718 return $member_arr[0]->ID;2719 else2720 return 0;27212722 }27232724 function lwp_ajax_login()2725 {2726 $usesrname = sanitize_text_field($_GET[‘username’]);2727 $method = sanitize_text_field($_GET[‘method’]);2728 $options = get_option(‘idehweb_lwp_settings’);27292730 if (preg_replace('/^(\-){0,1}[0-9]+(\.[0-9]+){0,1}/’, '’, $usesrname) == “”) {2731 $phone_number = ltrim($usesrname, ‘0’);2732 $phone_number = substr($phone_number, 0, 15);2733//echo $phone_number;2734//die();2735 if (strlen($phone_number) < 10) {2736 echo json_encode([2737 ‘success’ => false,2738 ‘phone_number’ => $phone_number,2739 ‘message’ => __('phone number is wrong!’, ‘login-with-phone-number’)2740 ]);2741 die();2742 }2743 $username_exists = $this->phone_number_exist($phone_number);2744// $registration = get_site_option(‘registration’);2745 if (!isset($options[‘idehweb_user_registration’])) $options[‘idehweb_user_registration’] = '1’;2746 $registration = $options[‘idehweb_user_registration’];2747 $is_multisite = is_multisite();2748 if ($is_multisite) {2749 if ($registration == ‘0’ && !$username_exists) {2750 echo json_encode([2751 ‘success’ => false,2752 ‘phone_number’ => $usesrname,2753 ‘registeration’ => $registration,2754 ‘is_multisite’ => $is_multisite,2755 ‘username_exists’ => $username_exists,2756 ‘message’ => __('users can not register!’, ‘login-with-phone-number’)2757 ]);2758 die();2759 }2760 } else {2761 if (!$username_exists) {27622763 if ($registration == ‘0’) {2764 echo json_encode([2765 ‘success’ => false,2766 ‘phone_number’ => $usesrname,2767 ‘registeration’ => $registration,2768 ‘is_multisite’ => $is_multisite,2769 ‘username_exists’ => $username_exists,2770 ‘message’ => __('users can not register!’, ‘login-with-phone-number’)2771 ]);2772 die();2773 }2774 }2775 }2776 $userRegisteredNow = false;2777 if (!$username_exists) {2778 $info = array();2779 $info[‘user_login’] = $this->generate_username($phone_number);2780 $info[‘user_nicename’] = $info[‘nickname’] = $info[‘display_name’] = $this->generate_nickname();2781 $info[‘user_url’] = sanitize_text_field($_GET[‘website’]);2782 $user_register = wp_insert_user($info);2783 if (is_wp_error($user_register)) {2784 $error = $user_register->get_error_codes();27852786 if (in_array('empty_user_login’, $error)) {2787 echo json_encode([2788 ‘success’ => false,2789 ‘phone_number’ => $phone_number,2790 ‘message’ => __($user_register->get_error_message(‘empty_user_login’))2791 ]);2792 die();2793 } elseif (in_array('existing_user_login’, $error)) {2794 echo json_encode([2795 ‘success’ => false,2796 ‘phone_number’ => $phone_number,2797 ‘message’ => __('This username is already registered.’, ‘login-with-phone-number’)2798 ]);2799 die();2800 } elseif (in_array('existing_user_email’, $error)) {2801 echo json_encode([2802 ‘success’ => false,2803 ‘phone_number’ => $phone_number,2804 ‘message’ => __('This email address is already registered.’, ‘login-with-phone-number’)2805 ]);2806 die();2807 }2808 die();2809 } else {2810 add_user_meta($user_register, 'phone_number’, sanitize_user($phone_number));2811 update_user_meta($user_register, '_billing_phone’, sanitize_user($phone_number));2812 update_user_meta($user_register, 'billing_phone’, sanitize_user($phone_number));2813// update_user_meta($user_register, '_shipping_phone’, sanitize_user($phone_number));2814// update_user_meta($user_register, 'shipping_phone’, sanitize_user($phone_number));2815 $userRegisteredNow = true;2816 add_user_meta($user_register, 'updatedPass’, 0);2817 $username_exists = $user_register;28182819 }282028212822 }2823 $showPass = false;2824 $log = '’;282528262827// $options = get_option(‘idehweb_lwp_settings’);2828 if (!isset($options[‘idehweb_password_login’])) $options[‘idehweb_password_login’] = '1’;2829 $options[‘idehweb_password_login’] = (bool)(int)$options[‘idehweb_password_login’];2830 if (!$options[‘idehweb_password_login’]) {2831 $log = $this->lwp_generate_token($username_exists, $phone_number,false,$method);28322833 } else {2834 if (!$userRegisteredNow) {2835 $showPass = true;2836 } else {2837 $log = $this->lwp_generate_token($username_exists, $phone_number,false,$method);2838 }2839 }2840 echo json_encode([2841 ‘success’ => true,2842 ‘ID’ => $username_exists,2843 ‘phone_number’ => $phone_number,2844 ‘showPass’ => $showPass,2845// ‘$userRegisteredNow’ => $userRegisteredNow,2846// ‘$userRegisteredNow1’ => $options[‘idehweb_password_login’],2847 ‘authWithPass’ => (bool)(int)$options[‘idehweb_password_login’],2848 ‘message’ => __('Sms sent successfully!’, ‘login-with-phone-number’),2849 ‘log’ => $log2850 ]);2851 die();28522853 } else {2854 echo json_encode([2855 ‘success’ => false,2856 ‘phone_number’ => $usesrname,2857 ‘message’ => __('phone number is wrong!’, ‘login-with-phone-number’)2858 ]);2859 die();2860 }2861 }28622863 function lwp_verify_domain()2864 {28652866 echo json_encode([2867 ‘success’ => true2868 ]);2869 die();2870 }28712872 function lwp_forgot_password()2873 {2874 $log = '’;2875 if (!isset($_GET[‘ID’])) $_GET[‘ID’] = null;2876 $ID = sanitize_text_field($_GET[‘ID’]);28772878 if (!isset($_GET[‘email’])) $_GET[‘email’] = '’;2879 $email = sanitize_email($_GET[‘email’]);28802881 if (!isset($_GET[‘method’])) $_GET[‘method’] = '’;2882 $method = sanitize_text_field($_GET[‘method’]);28832884 if (!isset($_GET[‘phone_number’])) $_GET[‘phone_number’] = '’;2885 $phone_number = sanitize_text_field($_GET[‘phone_number’]);288628872888// $_GET[‘ID’] = (esc_html($_GET[‘ID’]));2889// $_GET[‘email’] = (esc_html($_GET[‘email’]));2890// $_GET[‘phone_number’] = (esc_html($_GET[‘phone_number’]));2891 if (!is_numeric($ID)) {2892 echo json_encode([2893 ‘success’ => false,2894 ‘message’ => __('Please enter correct user ID’, ‘login-with-phone-number’)2895 ]);2896 die();2897 }2898 if (isset($phone_number) && $phone_number != ‘’ && !is_numeric($phone_number)) {2899 echo json_encode([2900 ‘success’ => false,2901 ‘phone_number’ => $phone_number,2902 ‘message’ => __('Please enter correct phone number’, ‘login-with-phone-number’)2903 ]);2904 die();2905 }2906 if (isset($email) && $email != ‘’ && !filter_var($email, FILTER_VALIDATE_EMAIL)) {2907 echo json_encode([2908 ‘success’ => false,2909 ‘message’ => __('Email is wrong!’, ‘login-with-phone-number’)2910 ]);2911 die();2912 }2913 $user = get_user_by('ID’, $ID);29142915 if (is_wp_error($user)) {2916 echo json_encode([2917 ‘success’ => false,2918 ‘message’ => __('User not found!’, ‘login-with-phone-number’)2919 ]);2920 die();2921 }2922 if ($email != ‘’ && $ID) {2923 $log = $this->lwp_generate_token($ID, $email, true);29242925 }2926 if ($phone_number != ‘’ && $ID != ‘’) {2927 $log = $this->lwp_generate_token($ID, $phone_number,false,$method);29282929//2930 }2931 update_user_meta($ID, 'updatedPass’, ‘0’);29322933 echo json_encode([2934 ‘success’ => true,2935 ‘ID’ => $ID,2936 ‘log’ => $log,2937 ‘message’ => __('Update password’, ‘login-with-phone-number’)2938 ]);2939 die();2940 }29412942 function lwp_enter_password_action()2943 {29442945 $ID = sanitize_text_field($_GET[‘ID’]);2946 $email = sanitize_email($_GET[‘email’]);2947 $password = sanitize_text_field($_GET[‘password’]);2948 if ($email != ‘’) {2949 $user = get_user_by('email’, $email);29502951 }2952 if ($ID != ‘’) {2953 $user = get_user_by('ID’, $ID);29542955 }2956 $creds = array(2957 ‘user_login’ => $user->user_login,2958 ‘user_password’ => $password,2959 ‘remember’ => true2960 );29612962 $user = wp_signon($creds, false);29632964 if (is_wp_error($user)) {2965 echo json_encode([2966 ‘success’ => false,2967 ‘ID’ => $user->ID,2968 ‘err’ => $user->get_error_message(),2969 ‘message’ => __('Password is incorrect!’, ‘login-with-phone-number’)2970 ]);2971 die();2972 } else {29732974 echo json_encode([2975 ‘success’ => true,2976 ‘ID’ => $user->ID,2977 ‘message’ => __('Redirecting…’, ‘login-with-phone-number’)2978 ]);29792980 die();2981 }2982 }29832984 function lwp_update_password_action()2985 {2986 $user = wp_get_current_user();2987 $password = sanitize_text_field($_GET[‘password’]);2988 if ($user) {2989 wp_clear_auth_cookie();2990 wp_update_user([2991 ‘ID’ => $user->ID,2992 ‘user_pass’ => $password2993 ]);2994 update_user_meta($user->ID, 'updatedPass’, 1);2995 wp_set_current_user($user->ID); // Set the current user detail2996 wp_set_auth_cookie($user->ID); // Set auth details in cookie2997 echo json_encode([2998 ‘success’ => true,2999 ‘message’ => __('Password set successfully! redirecting…’, ‘login-with-phone-number’)3000 ]);30013002 die();3003 } else {30043005 echo json_encode([3006 ‘success’ => false,3007 ‘message’ => __('User not found’, ‘login-with-phone-number’)3008 ]);30093010 die();3011 }3012 }30133014 function lwp_ajax_login_with_email()30153016 {3017 $email = sanitize_email($_GET[‘email’]);3018 $userRegisteredNow = false;30193020 $options = get_option(‘idehweb_lwp_settings’);30213022 if (!isset($options[‘idehweb_user_registration’])) $options[‘idehweb_user_registration’] = '1’;3023 $registration = $options[‘idehweb_user_registration’];302430253026 if (filter_var($email, FILTER_VALIDATE_EMAIL)) {3027 $email_exists = email_exists($email);3028 if (!$email_exists) {3029 if ($registration == ‘0’) {3030 echo json_encode([3031 ‘success’ => false,3032 ‘email’ => $email,3033 ‘registeration’ => $registration,3034 ‘email_exists’ => $email_exists,3035 ‘message’ => __('users can not register!’, ‘login-with-phone-number’)3036 ]);3037 die();3038 }3039 $info = array();3040 $info[‘user_email’] = sanitize_user($email);3041 $info[‘user_nicename’] = $info[‘nickname’] = $info[‘display_name’] = $this->generate_nickname();3042 $info[‘user_url’] = sanitize_text_field($_GET[‘website’]);3043 $info[‘user_login’] = $this->generate_username($email);3044 $user_register = wp_insert_user($info);3045 if (is_wp_error($user_register)) {3046 $error = $user_register->get_error_codes();30473048 echo json_encode([3049 ‘success’ => false,3050 ‘email’ => $email,3051 ‘$email_exists’ => $email_exists,3052 ‘$error’ => $error,3053 ‘message’ => __('This email address is already registered.’, ‘login-with-phone-number’)3054 ]);30553056 die();3057 } else {3058 $userRegisteredNow = true;3059 add_user_meta($user_register, 'updatedPass’, 0);3060 $email_exists = $user_register;3061 }306230633064 }3065// $user = get_user_by('ID’, $email_exists);3066// $password = $user->data->user_pass;3067 $log = '’;3068 $showPass = false;3069 if (!$userRegisteredNow) {3070 $showPass = true;3071 } else {3072 $log = $this->lwp_generate_token($email_exists, $email, true);3073 }3074// $options = get_option(‘idehweb_lwp_settings’);3075 if (!isset($options[‘idehweb_password_login’])) $options[‘idehweb_password_login’] = '1’;3076 $options[‘idehweb_password_login’] = (bool)(int)$options[‘idehweb_password_login’];3077 if (!$options[‘idehweb_password_login’]) {3078 $log = $this->lwp_generate_token($email_exists, $email, true);307930803081 }3082 echo json_encode([3083 ‘success’ => true,3084 ‘ID’ => $email_exists,3085 ‘log’ => $log,3086// ‘$user’ => $user,3087 ‘showPass’ => $showPass,3088 ‘authWithPass’ => (bool)(int)$options[‘idehweb_password_login’],30893090 ‘email’ => $email,3091 ‘message’ => __('Email sent successfully!’, ‘login-with-phone-number’)3092 ]);3093 die();30943095 } else {3096 echo json_encode([3097 ‘success’ => false,3098 ‘email’ => $email,3099 ‘message’ => __('email is wrong!’, ‘login-with-phone-number’)3100 ]);3101 die();3102 }3103 }31043105 function lwp_rest_api_stn_auth_customer($data)3106 {31073108 if (preg_replace('/^(\-){0,1}[0-9]+(\.[0-9]+){0,1}/’, '’, $data[‘accode’]) == “”) {3109 $accode = ltrim($data[‘accode’], ‘0’);3110 $accode = substr($accode, 0, 15);3111 return [31123113 ‘success’ => true3114 ];3115 } else {3116 return [3117 ‘success’ => false3118 ];3119 }312031213122 }31233124 function lwp_register_rest_route()3125 {3126 $options = get_option(‘idehweb_lwp_settings’);3127 if (!isset($options[‘idehweb_token’])) $options[‘idehweb_token’] = '’;31283129// if (empty($options[‘idehweb_token’])) {31303131 register_rest_route('authorizelwp’, '/(?P<accode>[a-zA-Z0-9_-]+)', array(3132 ‘methods’ => 'GET’,3133 ‘callback’ => array(&$this, ‘lwp_rest_api_stn_auth_customer’),3134 ‘permission_callback’ => ‘__return_true’3135 ));31363137// }3138 }313931403141 function lwp_generate_token($user_id, $contact, $send_email = false,$method=’’)3142 {3143 $six_digit_random_number = mt_rand(100000, 999999);3144 update_user_meta($user_id, 'activation_code’, $six_digit_random_number);3145 if ($send_email) {3146 $wp_mail = wp_mail($contact, 'activation code’, __('your activation code: ', ‘login-with-phone-number’) . $six_digit_random_number);3147 return $wp_mail;3148 } else {3149 return $this->send_sms($contact, $six_digit_random_number,$method);3150 }3151 }31523153 function generate_username($defU = ‘’)3154 {3155 $options = get_option(‘idehweb_lwp_settings’);3156 if (!isset($options[‘idehweb_default_username’])) $options[‘idehweb_default_username’] = 'user’;3157 if (!isset($options[‘idehweb_use_phone_number_for_username’])) $options[‘idehweb_use_phone_number_for_username’] = '0’;3158 if ($options[‘idehweb_use_phone_number_for_username’] == ‘0’) {3159 $ulogin = $options[‘idehweb_default_username’];31603161 } else {3162 $ulogin = $defU;3163 }31643165 // make user_login unique so WP will not return error3166 $check = username_exists($ulogin);3167 if (!empty($check)) {3168 $suffix = 2;3169 while (!empty($check)) {3170 $alt_ulogin = $ulogin . '-' . $suffix;3171 $check = username_exists($alt_ulogin);3172 $suffix++;3173 }3174 $ulogin = $alt_ulogin;3175 }31763177 return $ulogin;3178 }31793180 function generate_nickname()3181 {3182 $options = get_option(‘idehweb_lwp_settings’);3183 if (!isset($options[‘idehweb_default_nickname’])) $options[‘idehweb_default_nickname’] = 'user’;318431853186 return $options[‘idehweb_default_nickname’];3187 }31883189 function send_sms($phone_number, $code,$method)3190 {3191 $options = get_option(‘idehweb_lwp_settings’);3192 if (!isset($options[‘idehweb_use_custom_gateway’])) $options[‘idehweb_use_custom_gateway’] = '1’;3193 if (!isset($options[‘idehweb_default_gateways’])) $options[‘idehweb_default_gateways’] = [‘firebase’];3194 if ($options[‘idehweb_use_custom_gateway’] == ‘1’) {3195 if(!in_array($method,$options[‘idehweb_default_gateways’])){3196 return false;3197 }3198 if ($method == ‘custom’) {3199 $custom = new LWP_CUSTOM_Api();3200 return $custom->lwp_send_sms($phone_number, $code);3201 } else {3202 do_action(‘lwp_send_sms_’ . $method, $phone_number, $code);3203// return true;3204 }3205 } else {3206// $smsUrl = “https://zoomiroom.idehweb.com/customer/sms/” . $options[‘idehweb_token’] . “/” . $phone_number . “/” . $code;3207 $response = wp_safe_remote_post("https://zoomiroom.idehweb.com/customer/sms/", [3208 ‘timeout’ => 60,3209 ‘redirection’ => 1,3210 ‘blocking’ => true,3211 ‘headers’ => array(‘Content-Type’ => 'application/json’,3212 ‘token’ => $options[‘idehweb_token’]),3213 ‘body’ => wp_json_encode([3214 ‘phoneNumber’ => $phone_number,3215 ‘message’ => $code3216 ])3217 ]);3218 $body = wp_remote_retrieve_body($response);3219 return $this->esc_from_server($body);3220 }3221// $response = wp_remote_get($smsUrl);3222// wp_remote_retrieve_body($response);32233224 }32253226 function lwp_ajax_register()3227 {3228 $options = get_option(‘idehweb_lwp_settings’);3229 if (!isset($options[‘idehweb_default_gateways’])) $options[‘idehweb_default_gateways’] = [‘firebase’];3230 if (!isset($options[‘idehweb_use_custom_gateway’])) $options[‘idehweb_use_custom_gateway’] = '1’;32313232 if (isset($_GET[‘phone_number’])) {3233 $phoneNumber = sanitize_text_field($_GET[‘phone_number’]);3234 if (preg_replace('/^(\-){0,1}[0-9]+(\.[0-9]+){0,1}/’, '’, $phoneNumber) == “”) {3235 $phone_number = ltrim($phoneNumber, ‘0’);3236 $phone_number = substr($phone_number, 0, 15);32373238 if ($phone_number < 10) {3239 echo json_encode([3240 ‘success’ => false,3241 ‘phone_number’ => $phone_number,3242 ‘message’ => __('phone number is wrong!’, ‘login-with-phone-number’)3243 ]);3244 die();3245 }3246 }3247 $username_exists = $this->phone_number_exist($phone_number);3248 } else if (isset($_GET[‘email’])) {3249 $email = sanitize_email($_GET[‘email’]);3250 $username_exists = email_exists($email);3251 } else {3252 echo json_encode([3253 ‘success’ => false,3254 ‘message’ => __('phone number is wrong!’, ‘login-with-phone-number’)3255 ]);3256 die();3257 }3258 if ($username_exists) {3259 $activation_code = get_user_meta($username_exists, 'activation_code’, true);3260 $secod = sanitize_text_field($_GET[‘secod’]);3261 $verificationId = sanitize_text_field($_GET[‘verificationId’]);3262 if ($options[‘idehweb_use_custom_gateway’] == ‘1’ && $options[‘idehweb_default_gateways’] == ‘firebase’ && isset($_GET[‘phone_number’])) {3263 $response = $this->idehweb_lwp_activate_through_firebase($verificationId, $secod);3264 if ($response->error && $response->error->code == 400) {3265 echo json_encode([3266 ‘success’ => false,3267 ‘phone_number’ => $phone_number,3268 ‘firebase’ => $response->error,3269 ‘message’ => __(‘entered code is wrong!’, ‘login-with-phone-number’)3270 ]);3271 die();3272 } else {3273// if($response==’true’) {3274 $user = get_user_by('ID’, $username_exists);3275 if (!is_wp_error($user)) {3276 wp_clear_auth_cookie();3277 wp_set_current_user($user->ID); // Set the current user detail3278 wp_set_auth_cookie($user->ID); // Set auth details in cookie3279 update_user_meta($username_exists, 'activation_code’, ‘’);3280 if (!isset($options[‘idehweb_password_login’])) $options[‘idehweb_password_login’] = '1’;3281 $options[‘idehweb_password_login’] = (bool)(int)$options[‘idehweb_password_login’];3282 $updatedPass = (bool)(int)get_user_meta($username_exists, 'updatedPass’, true);32833284 echo json_encode(array(‘success’ => true, ‘firebase’ => $response, ‘loggedin’ => true, ‘message’ => __('loading…’, ‘login-with-phone-number’), ‘updatedPass’ => $updatedPass, ‘authWithPass’ => $options[‘idehweb_password_login’]));32853286 } else {3287 echo json_encode(array(‘success’ => false, ‘loggedin’ => false, ‘message’ => __('wrong’, ‘login-with-phone-number’)));32883289 }32903291 die();3292 }3293 } else {3294 if ($activation_code == $secod) {3295 // First get the user details3296 $user = get_user_by('ID’, $username_exists);32973298 if (!is_wp_error($user)) {3299 wp_clear_auth_cookie();3300 wp_set_current_user($user->ID); // Set the current user detail3301 wp_set_auth_cookie($user->ID); // Set auth details in cookie3302 update_user_meta($username_exists, 'activation_code’, ‘’);3303 if (!isset($options[‘idehweb_password_login’])) $options[‘idehweb_password_login’] = '1’;3304 $options[‘idehweb_password_login’] = (bool)(int)$options[‘idehweb_password_login’];3305 $updatedPass = (bool)(int)get_user_meta($username_exists, 'updatedPass’, true);33063307 echo json_encode(array(‘success’ => true, ‘loggedin’ => true, ‘message’ => __('loading…’, ‘login-with-phone-number’), ‘updatedPass’ => $updatedPass, ‘authWithPass’ => $options[‘idehweb_password_login’]));33083309 } else {3310 echo json_encode(array(‘success’ => false, ‘loggedin’ => false, ‘message’ => __('wrong’, ‘login-with-phone-number’)));33113312 }33133314 die();33153316 } else {3317 echo json_encode([3318 ‘success’ => false,3319 ‘phone_number’ => $phone_number,3320 ‘message’ => __('entered code is wrong!’, ‘login-with-phone-number’)3321 ]);3322 die();33233324 }3325 }3326 } else {33273328 echo json_encode([3329 ‘success’ => false,3330 ‘phone_number’ => $phone_number,3331 ‘message’ => __('user does not exist!’, ‘login-with-phone-number’)3332 ]);3333 die();33343335 }3336 }33373338 function auth_user_login($user_login, $password, $login)3339 {3340 $info = array();3341 $info[‘user_login’] = $user_login;3342 $info[‘user_password’] = $password;3343 $info[‘remember’] = true;33443345 // From false to ‘’ since v 4.93346 $user_signon = wp_signon($info, ‘’);3347 if (is_wp_error($user_signon)) {3348 echo json_encode(array(‘loggedin’ => false, ‘message’ => __('Wrong username or password.’, ‘login-with-phone-number’)));3349 } else {3350 wp_set_current_user($user_signon->ID);3351 echo json_encode(array(‘loggedin’ => true, ‘message’ => __($login . ' successful, redirecting…’, ‘login-with-phone-number’)));3352 }33533354 die();3355 }33563357 function idehweb_lwp_auth_customer()3358 {3359 $options = get_option(‘idehweb_lwp_settings’);33603361 if (!isset($options[‘idehweb_phone_number’])) $options[‘idehweb_phone_number’] = '’;3362 $phone_number = sanitize_text_field($_GET[‘phone_number’]);3363 $country_code = sanitize_text_field($_GET[‘country_code’]);3364 $url = get_site_url();3365 $response = wp_safe_remote_post("https://zoomiroom.idehweb.com/customer/customer/authcustomerforsms", [3366 ‘timeout’ => 60,3367 ‘redirection’ => 1,3368 ‘blocking’ => true,3369 ‘headers’ => array(‘Content-Type’ => ‘application/json’),3370 ‘body’ => wp_json_encode([3371 ‘phoneNumber’ => $phone_number,3372 ‘countryCode’ => $country_code,3373 ‘websiteUrl’ => $url3374 ])3375 ]);3376 $body = wp_remote_retrieve_body($response);3377 echo $this->esc_from_server($body);3378 die();3379 }33803381 function idehweb_lwp_auth_customer_with_website()3382 {3383// $options = get_option(‘idehweb_lwp_settings’);33843385// if (!isset($options[‘idehweb_website_url’])) $options[‘idehweb_website_url’] = $this->settings_get_site_url();3386 $url = sanitize_text_field($_GET[‘url’]);33873388 $response = wp_safe_remote_post("https://zoomiroom.idehweb.com/customer/customer/authcustomerwithdomain", [3389 ‘timeout’ => 60,3390 ‘redirection’ => 1,3391 ‘blocking’ => true,3392 ‘headers’ => array(‘Content-Type’ => ‘application/json’),3393 ‘body’ => wp_json_encode([3394 ‘websiteUrl’ => $url,3395 ‘restUrl’ => get_rest_url(null, ‘authorizelwp’)3396 ])3397 ]);3398 $body = wp_remote_retrieve_body($response);3399 echo $this->esc_from_server($body);34003401 die();3402 }34033404 function idehweb_lwp_update_billing_phones()3405 {34063407 $url = sanitize_text_field($_GET[‘url’]);34083409 $users = get_users(array(‘fields’ => array(‘ID’)));3410 $arr = [];3411 foreach ($users as $user) {3412 $_billing_phone = get_user_meta($user->ID, ‘_billing_phone’);3413 if (empty($_billing_phone)) {3414 $_billing_phone = get_user_meta($user->ID, ‘billing_phone’);34153416 }3417 if ($_billing_phone) {3418 $_billing_phone = str_replace('+’, '’, $_billing_phone);3419 update_user_meta($user->ID, 'phone_number’, $_billing_phone);34203421 }3422// array_push($arr, get_user_meta($user->ID, ‘_billing_phone’));3423 }3424 //get all users billing phone, normalize3425 //update users phone number3426// print_r($arr);3427 echo json_encode([3428 ‘success’ => true3429 ], true);3430 die();3431 }34323433 function idehweb_lwp_activate_through_firebase($sessionInfo, $code)3434 {3435 $options = get_option(‘idehweb_lwp_settings’);34363437 if (!isset($options[‘idehweb_firebase_api’])) $options[‘idehweb_firebase_api’] = '’;34383439 $response = wp_safe_remote_post(“https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPhoneNumber?key=” . $options[‘idehweb_firebase_api’], [3440 ‘timeout’ => 60,3441 ‘redirection’ => 4,3442 ‘blocking’ => true,3443 ‘headers’ => array(‘Content-Type’ => ‘application/json’),3444 ‘body’ => wp_json_encode([3445 ‘code’ => $code,3446 ‘sessionInfo’ => $sessionInfo3447 ])3448 ]);3449 $body = wp_remote_retrieve_body($response);3450 return json_decode($body);3451 }34523453 function idehweb_lwp_check_credit()3454 {3455 $options = get_option(‘idehweb_lwp_settings’);34563457 if (!isset($options[‘idehweb_token’])) $options[‘idehweb_token’] = '’;3458 $idehweb_token = $options[‘idehweb_token’];3459// $url = "https://idehweb.com/wp-json/check-credit/$idehweb_token";3460// $response = wp_remote_get($url);34613462 $response = wp_safe_remote_post("https://zoomiroom.idehweb.com/customer/customer/checkCredit", [3463 ‘timeout’ => 60,3464 ‘redirection’ => 1,3465 ‘blocking’ => true,3466 ‘headers’ => array(‘Content-Type’ => 'application/json’,3467 ‘token’ => $idehweb_token)3468 ]);3469 $body = wp_remote_retrieve_body($response);34703471 echo $this->esc_from_server($body);347234733474 die();3475 }34763477 function idehweb_lwp_get_shop()3478 {3479// $url = "https://idehweb.com/wp-json/all-products/0";3480// $response = wp_remote_get($url);3481 $lan = get_bloginfo(“language”);3482 $response = wp_safe_remote_post("https://zoomiroom.idehweb.com/customer/post/smsproducts", [3483 ‘timeout’ => 60,3484 ‘redirection’ => 1,3485 ‘blocking’ => true,3486 ‘headers’ => array(‘Content-Type’ => 'application/json’,3487 ‘lan’ => $lan)3488 ]);3489 $body = wp_remote_retrieve_body($response);34903491// $body = wp_remote_retrieve_body($response);349234933494// echo $body;34953496 echo $this->esc_from_server($body);34973498 die();3499 }35003501 function esc_from_server($body)3502 {3503 return json_decode(json_encode($body));3504// return wp_send_json($body);35053506 }35073508 function idehweb_lwp_activate_customer()3509 {3510 $phone_number = sanitize_text_field($_GET[‘phone_number’]);3511 $secod = sanitize_text_field($_GET[‘secod’]);35123513 $response = wp_safe_remote_post("https://zoomiroom.idehweb.com/customer/customer/activateCustomer", [3514 ‘timeout’ => 60,3515 ‘redirection’ => 1,3516 ‘blocking’ => true,3517 ‘headers’ => array(‘Content-Type’ => ‘application/json’),3518 ‘body’ => wp_json_encode([3519 ‘phoneNumber’ => $phone_number,3520 ‘activationCode’ => $secod3521 ])3522 ]);3523 $body = wp_remote_retrieve_body($response);35243525// echo $body;3526 echo $this->esc_from_server($body);352735283529 die();3530 }35313532 function lwp_modify_user_table($column)3533 {3534 $column[‘phone_number’] = __('Phone number’, ‘login-with-phone-number’);3535 $column[‘activation_code’] = __('Activation code’, ‘login-with-phone-number’);3536 $column[‘registered_date’] = __('Registered date’, ‘login-with-phone-number’);35373538 return $column;3539 }354035413542 function lwp_modify_user_table_row($val, $column_name, $user_id)3543 {3544 $udata = get_userdata($user_id);3545 switch ($column_name) {3546 case ‘phone_number’ :3547 return get_the_author_meta('phone_number’, $user_id);3548 case ‘activation_code’ :3549 return get_the_author_meta('activation_code’, $user_id);3550 case ‘registered_date’ :3551 return $udata->user_registered;3552 default:3553 }3554 return $val;3555 }35563557 function lwp_addon_woocommerce_login($template, $template_name, $template_path)3558 {3559 global $woocommerce;3560 $_template = $template;3561 if (!$template_path) $template_path = $woocommerce->template_url;3562 $plugin_path = untrailingslashit(plugin_dir_path(__FILE__)) . '/template/woocommerce/’;3563 // Look within passed path within the theme - this is priority3564 $template = locate_template(array($template_path . $template_name, $template_name));3565 if (!$template && file_exists($plugin_path . $template_name)) $template = $plugin_path . $template_name;3566 if (!$template) $template = $_template;3567 return $template;3568 }356935703571 function lwp_make_registered_column_sortable($columns)3572 {3573 return wp_parse_args(array(‘registered_date’ => ‘registered’), $columns);3574 }357535763577}35783579global $idehweb_lwp;3580$idehweb_lwp = new idehwebLwp();35813582/**3583 * Template Tag3584 */3585function idehweb_lwp()3586{35873588}358935903591

Related news

CVE-2023-4916: Login with phone number <= 1.5.6 - Cross-Site Request Forgery to User Password Change — Wordfence Intelligence

The Login with phone number plugin for WordPress is vulnerable to Cross-Site Request Forgery in versions up to, and including, 1.5.6. This is due to missing nonce validation on the 'lwp_update_password_action' function. This makes it possible for unauthenticated attackers to change user password via a forged request granted they can trick a site administrator into performing an action such as clicking on a link.

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907