Social Login - Version 7.3.1

Version Description

  • Instagram instructions updated with new API'S.
  • Updated save and test configuration button.
  • Added Clear button to reset app id and secret.
Download this release

Release Info

Developer cyberlord92
Plugin Icon 128x128 Social Login
Version 7.3.1
Comparing to
See all releases

Code changes from version 7.3.0 to 7.3.1

includes/css/mo_openid_style.css CHANGED
@@ -685,14 +685,14 @@ input:checked + .mo-openid-slider-app .off
685
  height: 82%;
686
  }
687
  .mo_openid_close-button {
688
- width: 25px;
689
  height: 25px;
690
  position: absolute;
691
  top: 10px;
692
  right: 10px;
693
  border-radius: 20px;
694
  /*background: rgba(0,0,0,0.8);*/
695
- font-size: 20px;
696
  text-align: center;
697
  color: #6e6666;
698
  text-decoration:none;
685
  height: 82%;
686
  }
687
  .mo_openid_close-button {
688
+ /*width: 25px;*/
689
  height: 25px;
690
  position: absolute;
691
  top: 10px;
692
  right: 10px;
693
  border-radius: 20px;
694
  /*background: rgba(0,0,0,0.8);*/
695
+ font-size: 17px;
696
  text-align: center;
697
  color: #6e6666;
698
  text-decoration:none;
miniorange_openid_sso_settings.php CHANGED
@@ -4,12 +4,12 @@
4
  * Plugin Name: Social Login, Social Sharing by miniOrange
5
  * Plugin URI: https://www.miniorange.com
6
  * Description: Allow your users to login, comment and share with Facebook, Google, Apple, Twitter, LinkedIn etc using customizable buttons.
7
- * Version: 7.3.0
8
  * Author: miniOrange
9
  * License URI: http://miniorange.com/usecases/miniOrange_User_Agreement.pdf
10
  */
11
 
12
- define('MO_OPENID_SOCIAL_LOGIN_VERSION', '7.3.0');
13
  define('plugin_url', plugin_dir_url(__FILE__) . "includes/images/icons/");
14
  define('MOSL_PLUGIN_DIR',str_replace('/','\\',plugin_dir_path(__FILE__)));
15
  require('miniorange_openid_sso_settings_page.php');
@@ -47,6 +47,7 @@ class miniorange_openid_sso_settings
47
  add_action('wp_ajax_mo_openid_app_enable', 'mo_openid_sso_enable_app');
48
  add_action('wp_ajax_mo_openid_app_instructions', 'mo_openid_app_instructions_action');
49
  add_action('wp_ajax_mo_openid_capp_details', 'mo_openid_capp_details_action');
 
50
  add_action('wp_ajax_mo_openid_test_configuration_update', 'mo_openid_test_configuration_update_action');
51
  add_action('wp_ajax_mo_openid_social_linking', 'mo_openid_social_linking_action');
52
  add_action('wp_ajax_mo_openid_profile_comp', 'mo_openid_profile_comp_action');
@@ -56,9 +57,9 @@ class miniorange_openid_sso_settings
56
  add_action('wp_ajax_mo_register_new_user', 'mo_openid_register_user');
57
  add_action('wp_ajax_mo_register_old_user', 'mo_register_old_user');
58
  add_action('wp_ajax_mo_sharing_app_value', 'mo_sharing_app_value');
59
- add_action('wp_ajax_mo_delay_registration_check', [$this,'mo_delay_registration_check']);
60
  add_action('wp_ajax_mo_openid_rating_given', 'mo_openid_rating_given');
61
  add_action('wp_ajax_mo_check_restrict_user', 'mo_openid_restrict_user');
 
62
  add_action( 'admin_footer', array( $this,'mo_openid_feedback_request' ));
63
  add_action( 'wp_enqueue_scripts', array( $this, 'mo_openid_plugin_script' ) ,5);
64
 
@@ -833,16 +834,6 @@ Thank you.';
833
 
834
  }
835
 
836
- function mo_delay_registration_check(){
837
- // if(get_option('')){
838
- // wp_send_json(["status" => 'true']);
839
- // }
840
- // else
841
- // wp_send_json(["status" => 'false']);
842
- wp_send_json(["status" => 'true']);
843
- }
844
-
845
-
846
  function mo_social_login_custom_avatar( $avatar, $mixed, $size, $default, $alt = '' ) {
847
 
848
  if ( is_numeric( $mixed ) AND $mixed > 0 ) { //Check if we have a user identifier
4
  * Plugin Name: Social Login, Social Sharing by miniOrange
5
  * Plugin URI: https://www.miniorange.com
6
  * Description: Allow your users to login, comment and share with Facebook, Google, Apple, Twitter, LinkedIn etc using customizable buttons.
7
+ * Version: 7.3.1
8
  * Author: miniOrange
9
  * License URI: http://miniorange.com/usecases/miniOrange_User_Agreement.pdf
10
  */
11
 
12
+ define('MO_OPENID_SOCIAL_LOGIN_VERSION', '7.3.1');
13
  define('plugin_url', plugin_dir_url(__FILE__) . "includes/images/icons/");
14
  define('MOSL_PLUGIN_DIR',str_replace('/','\\',plugin_dir_path(__FILE__)));
15
  require('miniorange_openid_sso_settings_page.php');
47
  add_action('wp_ajax_mo_openid_app_enable', 'mo_openid_sso_enable_app');
48
  add_action('wp_ajax_mo_openid_app_instructions', 'mo_openid_app_instructions_action');
49
  add_action('wp_ajax_mo_openid_capp_details', 'mo_openid_capp_details_action');
50
+ add_action('wp_ajax_mo_openid_capp_delete', 'mo_openid_capp_delete');
51
  add_action('wp_ajax_mo_openid_test_configuration_update', 'mo_openid_test_configuration_update_action');
52
  add_action('wp_ajax_mo_openid_social_linking', 'mo_openid_social_linking_action');
53
  add_action('wp_ajax_mo_openid_profile_comp', 'mo_openid_profile_comp_action');
57
  add_action('wp_ajax_mo_register_new_user', 'mo_openid_register_user');
58
  add_action('wp_ajax_mo_register_old_user', 'mo_register_old_user');
59
  add_action('wp_ajax_mo_sharing_app_value', 'mo_sharing_app_value');
 
60
  add_action('wp_ajax_mo_openid_rating_given', 'mo_openid_rating_given');
61
  add_action('wp_ajax_mo_check_restrict_user', 'mo_openid_restrict_user');
62
+ add_action('wp_ajax_mo_disable_app', 'mo_disable_app');
63
  add_action( 'admin_footer', array( $this,'mo_openid_feedback_request' ));
64
  add_action( 'wp_enqueue_scripts', array( $this, 'mo_openid_plugin_script' ) ,5);
65
 
834
 
835
  }
836
 
 
 
 
 
 
 
 
 
 
 
837
  function mo_social_login_custom_avatar( $avatar, $mixed, $size, $default, $alt = '' ) {
838
 
839
  if ( is_numeric( $mixed ) AND $mixed > 0 ) { //Check if we have a user identifier
miniorange_openid_sso_settings_page.php CHANGED
@@ -462,7 +462,9 @@ function mo_register_openid() {
462
  var temp = "<?php echo get_option('mo_openid_tour_new'); ?>";
463
  if(temp=="0"&&new_tour1.ended()) {
464
  new_tour2.init();
465
- mo_openid_support_form('');
 
 
466
  new_tour2.start();
467
  }
468
 
462
  var temp = "<?php echo get_option('mo_openid_tour_new'); ?>";
463
  if(temp=="0"&&new_tour1.ended()) {
464
  new_tour2.init();
465
+ if(!new_tour2.ended()) {
466
+ mo_openid_support_form('');
467
+ }
468
  new_tour2.start();
469
  }
470
 
mo-openid-social-login-functions.php CHANGED
@@ -1351,7 +1351,7 @@ function mo_openid_activation_message() {
1351
  }
1352
 
1353
  function mo_openid_rating_given(){
1354
- update_option("mo_openid_rating_given",$_POST['mo-openid-rating']);
1355
  }
1356
 
1357
  function mo_openid_add_custom_column1($columns){
1351
  }
1352
 
1353
  function mo_openid_rating_given(){
1354
+ update_option("mo_openid_rating_given",$_POST['rating']);
1355
  }
1356
 
1357
  function mo_openid_add_custom_column1($columns){
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.miniorange.com
4
  Tags: social login, facebook login, google login, twitter login, Vkontakte login, social, facebook, twitter, google, login, google, social connect, social network login, social plugin, Vkontakte, LinkedIn
5
  Requires at least: 2.0.2
6
  Tested up to: 5.3
7
- Stable tag: 7.3.0
8
  License URI: http://miniorange.com/usecases/miniOrange_User_Agreement.pdf
9
 
10
  Social Login with Google, Facebook, Apple, Twitter, Vkontakte, LinkedIn and more. GDPR compliant. Social sharing and social comments. 24x7 Support.
@@ -177,6 +177,11 @@ Please email us at info@miniorange.com. You can also submit your query from the
177
 
178
 
179
  == Changelog ==
 
 
 
 
 
180
  = 7.3.0 =
181
  * Linkedin username return issue solved.
182
  * On load class creation issue resolved.
@@ -676,6 +681,11 @@ SECURITY FIXES
676
  * First version of Social Login, Social Sharing plugin.
677
 
678
  == Upgrade Notice ==
 
 
 
 
 
679
  = 7.3.0 =
680
  * Linkedin username return issue solved.
681
  * On load class creation issue resolved.
4
  Tags: social login, facebook login, google login, twitter login, Vkontakte login, social, facebook, twitter, google, login, google, social connect, social network login, social plugin, Vkontakte, LinkedIn
5
  Requires at least: 2.0.2
6
  Tested up to: 5.3
7
+ Stable tag: 7.3.1
8
  License URI: http://miniorange.com/usecases/miniOrange_User_Agreement.pdf
9
 
10
  Social Login with Google, Facebook, Apple, Twitter, Vkontakte, LinkedIn and more. GDPR compliant. Social sharing and social comments. 24x7 Support.
177
 
178
 
179
  == Changelog ==
180
+ = 7.3.1 =
181
+ * Instagram instructions updated with new API'S.
182
+ * Updated save and test configuration button.
183
+ * Added Clear button to reset app id and secret.
184
+
185
  = 7.3.0 =
186
  * Linkedin username return issue solved.
187
  * On load class creation issue resolved.
681
  * First version of Social Login, Social Sharing plugin.
682
 
683
  == Upgrade Notice ==
684
+ = 7.3.1 =
685
+ * Instagram instructions updated with new API'S.
686
+ * Updated save and test configuration button.
687
+ * Added Clear button to reset app id and secret.
688
+
689
  = 7.3.0 =
690
  * Linkedin username return issue solved.
691
  * On load class creation issue resolved.
social_apps/instagram.php CHANGED
@@ -4,11 +4,20 @@
4
  class instagram
5
  {
6
  public $color="#517FA6";
7
- public $scope="basic+public_content+follower_list";
8
  public $instructions;
9
- public function __construct() {
10
- $this->site_url = get_option( 'siteurl' );
11
- $this->instructions="Go to <a href=\"http://instagram.com/developer\" target=\"_blank\">http://instagram.com/developer</a> and sign in with your instagram account.##Go to Manage Clients and click on <strong>Register A New Client</strong>##Enter Application Name, Description, Company Name, Privacy Policy URL, Contact Email.##Enter the <b><code id='9'>" . get_option('siteurl') . "</code><i style= \"width: 11px;height: 9px;padding-left:2px;padding-top:3px\" class=\"mofa mofa-fw mofa-lg mofa-copy mo_copy mo_copytooltip\" onclick=\"copyToClipboard(this, '#9', '#shortcode_url_copy')\"><span id=\"shortcode_url_copy\" class=\"mo_copytooltiptext\">Copy to Clipboard</span></i></b> As <strong>Website URL.</strong> And <b><code id='10'>".mo_get_permalink('instagram')."</code><i style= \"width: 11px;height: 9px;padding-left:2px;padding-top:3px\" class=\"mofa mofa-fw mofa-lg mofa-copy mo_copy mo_copytooltip\" onclick=\"copyToClipboard(this, '#10', '#shortcode_url1_copy')\"><span id=\"shortcode_url1_copy\" class=\"mo_copytooltiptext\">Copy to Clipboard</span></i></b> as <strong>Valid redirect URI.</strong>##Click on <strong>Register</strong>.##Once your app is registered, you will be navigated to the <strong>Manage Clients</strong> page. Click on the <strong>Manage</strong> button for your new client.##This will bring you to the page that contains your <strong>Client ID</strong> and <strong>Client Secret</strong>. Copy these and Paste them into the fields above. ##Go to <b>Permissions</b> tab and click on <b>Start a Submission</b> ##Click on the Save settings button.##Go to Social Login tab to configure the display as well as other login settings";
 
 
 
 
 
 
 
 
 
12
  }
13
 
14
  function mo_openid_get_app_code()
@@ -18,7 +27,8 @@ class instagram
18
  mo_openid_start_session();
19
  $_SESSION["appname"] = 'instagram';
20
  $client_id = $appslist['instagram']['clientid'];
21
- $login_dialog_url = 'https://api.instagram.com/oauth/authorize/?client_id=' . $client_id . '&redirect_uri=' . $social_app_redirect_uri . '&response_type=code';
 
22
  header('Location:'. $login_dialog_url);
23
  exit;
24
  }
@@ -32,30 +42,27 @@ class instagram
32
  $client_id = $appslist['instagram']['clientid'];
33
  $client_secret = $appslist['instagram']['clientsecret'];
34
  $access_token_uri = 'https://api.instagram.com/oauth/access_token';
35
- $postData = 'grant_type=authorization_code&client_id='. $client_id .'&client_secret=' . $client_secret . '&code=' . $code . '&redirect_uri=' . $social_app_redirect_uri;
36
-
37
  $access_token_json_output = mo_openid_get_access_token($postData, $access_token_uri,'instagram');
 
 
 
 
 
 
38
  mo_openid_start_session();
39
 
40
  //Test Configuration
41
  if (is_user_logged_in() && get_option('mo_openid_test_configuration') == 1) {
42
- mo_openid_app_test_config($access_token_json_output);
43
  }
44
  //set all profile details
45
  //Set User current app
46
  $first_name = $last_name = $email = $user_name = $user_url = $user_picture = $social_user_id = '';
47
  $location_city = $location_country = $about_me = $company_name = $age = $gender = $friend_nos = '';
48
 
49
- if(isset($access_token_json_output['user']['full_name'])){
50
- $full_name = explode(" ", $access_token_json_output['user']['full_name']);
51
- $first_name = isset( $full_name[0]) ? $full_name[0] : '';
52
- $last_name = isset( $full_name[1]) ? $full_name[1] : '';
53
- }
54
- $user_name = isset( $access_token_json_output['user']['username']) ? $access_token_json_output['user']['username'] : '';
55
- $user_picture = isset( $access_token_json_output['user']['profile_picture']) ? $access_token_json_output['user']['profile_picture'] : '';
56
- $social_user_id = isset( $access_token_json_output['user']['id']) ? $access_token_json_output['user']['id'] : '';
57
- $about_me = isset( $access_token_json_output['user']['bio']) ? $access_token_json_output['user']['bio'] : '';
58
- $website= isset( $access_token_json_output['user']['website']) ? $access_token_json_output['user']['website'] : '';
59
 
60
  $appuserdetails = array(
61
  'first_name' => $first_name,
4
  class instagram
5
  {
6
  public $color="#517FA6";
7
+ public $scope="user_profile,user_media";
8
  public $instructions;
9
+ public function __construct()
10
+ {
11
+ if (get_option('permalink_structure') !== "") {
12
+ $this->site_url = get_option('siteurl');
13
+ $this->instructions = "Go to <a href=\"https://developers.facebook.com/products/instagram/\" target=\"_blank\">https://developers.facebook.com/products/instagram/</a> , click My Apps, and create a new app. ##Once you have created the app and are in the App Dashboard, navigate to<b> Settings > Basic</b>, scroll the bottom of page, and click <b>Add Platform</b>.##Choose Website, add your website’s URL, enter the <b><code id='9'>" . get_option('siteurl') . "</code><i style= \"width: 11px;height: 9px;padding-left:2px;padding-top:3px\" class=\"mofa mofa-fw mofa-lg mofa-copy mo_copy mo_copytooltip\" onclick=\"copyToClipboard(this, '#9', '#shortcode_url_copy')\"><span id=\"shortcode_url_copy\" class=\"mo_copytooltiptext\">Copy to Clipboard</span></i></b> as <strong>website URL and save your changes.</strong>##Enter your privacy policy URL in Privacy Policy URL and select Category of your website and then click on Save Changes.##Click on <b>Products</b>, locate the Instagram product, and click Set Up to add it to your app.##Click <b>Basic Display</b>, scroll to the bottom of the page, then click <b>Create New App</b>.
14
+
15
+ ##And fill the details of the app properly.##Enter the redirect URL <b><code id='10'>" . mo_get_permalink('instagram') . "</code><i style= \"width: 11px;height: 9px;padding-left:2px;padding-top:3px\" class=\"mofa mofa-fw mofa-lg mofa-copy mo_copy mo_copytooltip\" onclick=\"copyToClipboard(this, '#10', '#shortcode_url1_copy')\"><span id=\"shortcode_url1_copy\" class=\"mo_copytooltiptext\">Copy to Clipboard</span></i></b> as <strong>valid redirect URI.</strong>##Navigate to <b>Roles</b> > Roles and scroll down to the <b>Instagram Testers</b> section. Click <b>Add Instagram Testers</b> and enter your Instagram account’s username and send the invitation.
16
+
17
+ ##Change your app status from In Development to Live by clicking on OFF (sliding button) beside Status option of the top right corner.##Open a new web browser and go to www.instagram.com and sign into your Instagram account that you just invited. Navigate to <b>(Profile Icon) > Edit Profile > Apps and Websites > Tester Invites </b>and accept the invitation.##Click on Instagram from the left menu and then click on 'Basic Display' option, copy the <b>instagram app ID </b> and <b>instagram app secret</b> from there.";
18
+ } else{
19
+ $this->instructions= "<strong style='color: red;font-weight: bold'><br>You have selected plain permalink and instagram doesnot support it.</strong><br><br> Please change the permalink to continue further.Follow the steps given below:<br>1. Go to settings from the left panel and select the permalinks option.<br>2. Plain permalink is selected ,so please select any other permalink and click on save button.<br> <strong class='mo_openid_note_style' style='color: red;font-weight: bold'> When you will change the permalink ,then you have to re-configure the already set up custom apps because that will change the redirect URL.</strong>";
20
+ }
21
  }
22
 
23
  function mo_openid_get_app_code()
27
  mo_openid_start_session();
28
  $_SESSION["appname"] = 'instagram';
29
  $client_id = $appslist['instagram']['clientid'];
30
+ $scope = $appslist['instagram']['scope'];
31
+ $login_dialog_url = 'https://api.instagram.com/oauth/authorize/?client_id=' . $client_id . '&redirect_uri=' . $social_app_redirect_uri . '&scope='.$scope.'&response_type=code';
32
  header('Location:'. $login_dialog_url);
33
  exit;
34
  }
42
  $client_id = $appslist['instagram']['clientid'];
43
  $client_secret = $appslist['instagram']['clientsecret'];
44
  $access_token_uri = 'https://api.instagram.com/oauth/access_token';
45
+ $postData = 'client_id='. $client_id .'&client_secret=' . $client_secret . '&grant_type=authorization_code&redirect_uri=' . $social_app_redirect_uri.'&code=' . $code;
 
46
  $access_token_json_output = mo_openid_get_access_token($postData, $access_token_uri,'instagram');
47
+ $access_token = isset($access_token_json_output['access_token']) ? $access_token_json_output['access_token'] : '';
48
+ mo_openid_start_session();
49
+
50
+ $profile_url = 'https://graph.instagram.com/me?fields=id,username&access_token='.$access_token;
51
+
52
+ $profile_json_output = mo_openid_get_social_app_data($access_token, $profile_url,'amazon');
53
  mo_openid_start_session();
54
 
55
  //Test Configuration
56
  if (is_user_logged_in() && get_option('mo_openid_test_configuration') == 1) {
57
+ mo_openid_app_test_config($profile_json_output);
58
  }
59
  //set all profile details
60
  //Set User current app
61
  $first_name = $last_name = $email = $user_name = $user_url = $user_picture = $social_user_id = '';
62
  $location_city = $location_country = $about_me = $company_name = $age = $gender = $friend_nos = '';
63
 
64
+ $user_name = isset( $profile_json_output['username']) ? $profile_json_output['username'] : '';
65
+ $social_user_id = isset( $profile_json_output['id']) ? $profile_json_output['id'] : '';
 
 
 
 
 
 
 
 
66
 
67
  $appuserdetails = array(
68
  'first_name' => $first_name,
view/config_apps/mo_openid_config_apps.php CHANGED
@@ -6,9 +6,7 @@ function mo_openid_show_apps()
6
  if (isset($_POST['update_tour_status'])){
7
  update_option('mo_openid_tour_new','1');
8
  }
9
-
10
  ?>
11
-
12
  <table>
13
  <tr id="mo_openid_free_avail_apps">
14
  <td>
@@ -99,10 +97,14 @@ function mo_openid_show_apps()
99
  //to set heading name
100
  jQuery('#mo_openid_page_heading').text('<?php echo mo_sl('Configure Applications'); ?>');
101
 
102
- //to enable apps
103
  function enable_default_app(app_name) {
104
- var fcheck=1;
105
  var a = document.getElementById('mo_apps_'.concat(app_name));
 
 
 
 
 
106
  var enable_app = 'mo_openid'.concat(app_name).concat('_enable');
107
  var active_button = document.getElementById('mo_openid_'.concat(app_name).concat('_active_div'));
108
  jQuery.ajax({
@@ -127,6 +129,8 @@ function mo_openid_show_apps()
127
  if (result.status) {
128
  document.getElementById(app_name).setAttribute("style", "opacity:1");
129
  active_button.style.display = "block";
 
 
130
  mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+' is activated sucessfully');
131
  var mo_openid_sso_enable_app_nonce = '<?php echo wp_create_nonce("mo-openid-sso-enable-app"); ?>';
132
  jQuery.ajax({
@@ -146,7 +150,6 @@ function mo_openid_show_apps()
146
  } else {
147
  jQuery("#mo_apps_".concat(app_name)).prop('checked', false);
148
  mo_show_success_error_msg('success','Please set custom app for facebook');
149
- fcheck=0;
150
  jQuery ("#mo_facebook_notice").show();
151
  jQuery( "#mo_register_customer_toggle").hide();
152
  getappsInLine(app_name);
@@ -158,12 +161,20 @@ function mo_openid_show_apps()
158
  else {
159
  document.getElementById(app_name).setAttribute("style", "opacity:1");
160
  active_button.style.display = "block";
 
 
 
 
161
  mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+' is activated sucessfully');
162
  enable_default_app_db(app_name,a.checked);
163
  }
164
  } else {
165
  document.getElementById(app_name).setAttribute("style", "opacity:0.6");
166
  active_button.style.display = "none";
 
 
 
 
167
  mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+' is deactivated sucessfully');
168
  enable_default_app_db(app_name,a.checked);
169
  }
@@ -186,6 +197,8 @@ function mo_openid_show_apps()
186
  if (result.status) {
187
  document.getElementById(app_name).setAttribute("style", "opacity:1");
188
  active_button.style.display = "block";
 
 
189
  mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+' is activated sucessfully');
190
  var mo_openid_sso_enable_app_nonce = '<?php echo wp_create_nonce("mo-openid-sso-enable-app"); ?>';
191
  jQuery.ajax({
@@ -241,6 +254,8 @@ function mo_openid_show_apps()
241
  document.getElementById(app_name).setAttribute("style", "opacity:0.6");
242
  active_button.style.display = "none";
243
  var mo_openid_sso_enable_app_nonce = '<?php echo wp_create_nonce("mo-openid-sso-enable-app"); ?>';
 
 
244
  mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+' is deactivated sucessfully');
245
  jQuery.ajax({
246
  type: 'POST',
@@ -308,11 +323,20 @@ function mo_openid_show_apps()
308
  '<div style="width: 65%; float: left; display: inline"><i class="mofa mofa-info-circle mo_copytooltip" title="miniOrange take care of creating applications for you so that you don’t have to worry about creating applications in each social network."></i><label style="display: contents;"><b> Pre configured miniOrange App</b></label></div>' +
309
  '<div style="width: 35%; float: right; display: inline">' +
310
  '<label class="mo-openid-switch-app">' +
311
- '<input type="checkbox" id="mo_openid_enable_custom_app" value="1" id="app_name"/>' +
312
  '<div class="mo-openid-slider-app round" id="switch_checkbox" ></div>' +
313
  '</label>' +
314
  '</div>' +
315
  '</div>'+
 
 
 
 
 
 
 
 
 
316
  '<div id="mo_facebook_notice" style="overflow: auto; margin-left:25%; margin-right:3%; padding-top:2%"><label style="cursor:auto"><b>Please set custom app for Facebook</b></label></div><hr>'+
317
  '<div><center><h3 style="margin-bottom: 2%">App Settings</h3></center></div>'+
318
  '<div class="mo-openid-app-name" id="custom_app_name_rename" style="width: 100%">'+
@@ -332,11 +356,10 @@ function mo_openid_show_apps()
332
  '<div style="float: left; width: 20%"><b>Scope</b></div>'+
333
  '<div style="float: right; width: 80%"><input id="app_scope_value" type="text" style="width: 98%"> </div>'+
334
  '</div>'+
335
- '<div style="margin-top: 10px;">'+
336
  '<center>' +
337
- '<input type="button" value="Save" class="button button-primary button-large mo_openid_save_capp_settings">' +
338
- '&nbsp;&nbsp;<input type="button" value="Test Configuration" class="button button-primary button-large mo_openid_test_configuration_settings">'+
339
- '&nbsp;&nbsp;<input type="button" value="Close" class="button button-primary button-large mo_openid_close_capp_settings">'+
340
  '</center>'+
341
  '</div>'+
342
  '<div style="margin-top: 10px;">'+
@@ -410,7 +433,7 @@ function mo_openid_show_apps()
410
  '</table> '+
411
  '<br/>&nbsp;<a style="font-size: medium;" class="mo_do_not_register">Don\'t want to register and set up my own custom app.</a>'+
412
  '</div>'+
413
- '<a class="mo_openid_close-button" popup-close="popup-1" href="javascript:void(0)">x</a>'+
414
  '</div>'+
415
  '</div>';
416
  jQuery(popup).insertAfter("#mo-main-content-div");
@@ -488,6 +511,7 @@ function mo_openid_show_apps()
488
  jQuery('#mo_openid_register_new_user').hide();
489
  jQuery('#mo_openid_cust_app_instructions').show();
490
  jQuery("#mo_openid_enable_custom_app").prop('checked', true);
 
491
  jQuery("#mo_register_customer_toggle").hide();
492
  mo_show_success_error_msg('success','Registration completed & Pre configured app activated');
493
  let app_name = jQuery(".mo-openid-app-name").attr("id");
@@ -502,8 +526,12 @@ function mo_openid_show_apps()
502
  }
503
  });
504
 
505
-
506
-
 
 
 
 
507
 
508
  function mo_openid_ajax_wait_openModal() {
509
  document.getElementById('mo_openid_ajax_wait_img').style.display = 'block';
@@ -557,6 +585,7 @@ function mo_openid_show_apps()
557
  jQuery('#mo_openid_register_old_user').hide();
558
  jQuery('#mo_openid_cust_app_instructions').show();
559
  jQuery("#mo_openid_enable_custom_app").prop('checked', true);
 
560
  jQuery("#mo_register_customer_toggle").hide();
561
  mo_show_success_error_msg('success','Your account has been retrieved successfully & Pre configured app activated');
562
  let app_name = jQuery(".mo-openid-app-name").attr("id");
@@ -595,7 +624,8 @@ function mo_openid_show_apps()
595
  mo_openid_ajax_wait_closeModal();
596
  if(result.status=='true'){
597
  jQuery("#mo_openid_enable_custom_app").prop('checked', true);
598
- mo_show_success_error_msg('success','Pre configured app activated');
 
599
  var active_button=document.getElementById('mo_openid_'.concat(app_name).concat('_active_div'));
600
  active_button.style.display = "block";
601
  document.getElementById(app_name).setAttribute("style","opacity:1");
@@ -613,11 +643,13 @@ function mo_openid_show_apps()
613
  jQuery("#mo_openid_register_new_user").effect("shake");
614
  }
615
  else if(result.status=="No_cust_app"){
616
- mo_show_success_error_msg('error','Please enter and save App Id and App secret');
617
- jQuery( "#mo_openid_enable_custom_app").prop('checked', true);
 
 
618
  }
619
  else if(result.status=="Turned_Off"){
620
- mo_show_success_error_msg('success','Custom App activated');
621
  jQuery( "#mo_openid_enable_custom_app").prop('checked', false);
622
  }
623
  }
@@ -626,44 +658,52 @@ function mo_openid_show_apps()
626
 
627
  // save app id and secret
628
  jQuery('.mo_openid_save_capp_settings').click(function () {
629
- let app_name = jQuery(".mo-openid-app-name").attr("id");
630
- let app_id = jQuery(".mo-openid-app-name").find("#app_id_value").val();
631
- let app_secret = jQuery(".mo-openid-app-name").find("#app_secret_value").val();
632
- let app_scope = jQuery(".mo-openid-app-name").find("#app_scope_value").val();
633
- if(app_id=="" || app_secret=="") {
634
- mo_show_success_error_msg('error','Please enter and save App Id and App secret');
635
- }
636
- else {
637
- var mo_openid_capp_details_nonce = '<?php echo wp_create_nonce("mo-openid-capp-details"); ?>';
638
- var a=document.getElementById('mo_apps_'.concat(app_name));
639
- var enable_app='mo_openid'.concat(app_name).concat('_enable');
640
- var active_button=document.getElementById('mo_openid_'.concat(app_name).concat('_active_div'));
641
- document.getElementById(app_name).setAttribute("style","opacity:1");
642
- active_button.style.display = "block";
643
- jQuery( "#mo_apps_"+app_name).prop('checked', true);
644
- jQuery.ajax({
645
- type: 'POST',
646
- url: '<?php echo admin_url("admin-ajax.php"); ?>',
647
- data: {
648
- 'mo_openid_capp_details_nonce': mo_openid_capp_details_nonce,
649
- action: 'mo_openid_capp_details',
650
- app_name: app_name,
651
- app_id: app_id,
652
- app_secret: app_secret,
653
- app_scope: app_scope,
654
- },
655
- success: function (data) {
656
- mo_show_success_error_msg('success','App credentials has been saved sucessfully');
657
- },
658
- error: function (data) {
659
- }
660
- });
661
- }
662
  });
663
- //cancel button
664
- jQuery('.mo_openid_close_capp_settings').on('click', function() {
665
- jQuery('[popup-name="popup-1"]').fadeOut(300);
666
- jQuery( "#custom_app_video").attr('src', "");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
667
  });
668
 
669
  //show instructions form
@@ -672,25 +712,80 @@ function mo_openid_show_apps()
672
  jQuery('#mo_openid_register_old_user').hide();
673
  jQuery('#mo_openid_cust_app_instructions').show();
674
  });
 
675
 
676
- //test_configuration
677
- jQuery('.mo_openid_test_configuration_settings').on('click', function() {
678
- let app_name = jQuery(".mo-openid-app-name").attr("id");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
679
  jQuery.ajax({
680
- url:"<?php echo admin_url("admin-ajax.php");?>", //the page containing php script
681
- method: "POST", //request type,
682
- dataType: 'text',
683
  data: {
684
- appname: app_name,
685
- test_configuration : true,
686
- action: 'mo_openid_test_configuration_update',
 
 
 
687
  },
688
- success:function(result){
689
- var myWindow = window.open('<?php echo attribute_url(); ?>' + '/?option=oauthredirect&app_name='+app_name+'&wp_nonce='+'<?php echo wp_create_nonce( 'mo-openid-oauth-app-nonce' ); ?>', "", "width=950, height=600");
 
 
 
 
690
  }
691
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
692
  });
693
- });
694
 
695
  jQuery(".mo-openid-sort-apps-open-settings-div").click(function () {
696
  let app_name = jQuery(this).parents(".mo-openid-sort-apps-div").attr("id");
@@ -770,15 +865,19 @@ function mo_openid_show_apps()
770
  jQuery( "#mo_openid_enable_custom_app").prop('checked', true);
771
  else
772
  jQuery( "#mo_openid_enable_custom_app").prop('checked', false);
773
- jQuery( "#app_scope_value").val(ins[4]);
774
- jQuery( "#custom_app_video").attr('src', ins[5]);
 
 
 
 
775
  if(ins.length==7) {
776
  jQuery("#custom_app_perma_inst").show();
777
  jQuery("#mo_perma_error_app_name").text(application_name.charAt(0).toUpperCase()+application_name.substr(1));;
778
  }
779
  else {
780
  jQuery("#custom_app_perma_inst").hide();
781
- for (i = 6; i < ins.length; i++)
782
  jQuery("#custom_app_inst_steps").append('<li>' + ins[i] + '</li>');
783
  }
784
  document.getElementById('mo_openid_ajax_wait_img').style.display = 'none';
@@ -1020,27 +1119,6 @@ function mo_openid_show_apps()
1020
  }
1021
  }
1022
 
1023
- jQuery('.mo_openid_close_capp_settings').on('click', function() {
1024
- jQuery('[popup-name="popup-2"]').fadeOut(300);
1025
- });
1026
-
1027
- function show_delay_registration() {
1028
- //jQuery( "#mo_openid_delay_registration" ).show();
1029
- jQuery.ajax({
1030
- url: "<?php echo admin_url("admin-ajax.php");?>", //the page containing php script
1031
- method: "POST", //request type,
1032
- dataType: 'json',
1033
- data: {
1034
- action: 'mo_delay_registration_check',
1035
- },
1036
- success: function (result) {
1037
- if (result.status) {
1038
- jQuery("#mo_openid_delay_registration").show();
1039
- }
1040
- }
1041
- });
1042
- }
1043
- //window.onload=show_delay_registration();
1044
  window.onload=jQuery("#mo_openid_delay_registration").show();
1045
  });
1046
  </script>
6
  if (isset($_POST['update_tour_status'])){
7
  update_option('mo_openid_tour_new','1');
8
  }
 
9
  ?>
 
10
  <table>
11
  <tr id="mo_openid_free_avail_apps">
12
  <td>
97
  //to set heading name
98
  jQuery('#mo_openid_page_heading').text('<?php echo mo_sl('Configure Applications'); ?>');
99
 
100
+ //to enable apps from outside toggle
101
  function enable_default_app(app_name) {
 
102
  var a = document.getElementById('mo_apps_'.concat(app_name));
103
+ enable_app(a,app_name,'0');
104
+ }
105
+
106
+ //defination to enable app
107
+ function enable_app(a,app_name,toggle) {
108
  var enable_app = 'mo_openid'.concat(app_name).concat('_enable');
109
  var active_button = document.getElementById('mo_openid_'.concat(app_name).concat('_active_div'));
110
  jQuery.ajax({
129
  if (result.status) {
130
  document.getElementById(app_name).setAttribute("style", "opacity:1");
131
  active_button.style.display = "block";
132
+ if(toggle=='1')
133
+ jQuery("#mo_apps_".concat(app_name)).prop('checked', true);
134
  mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+' is activated sucessfully');
135
  var mo_openid_sso_enable_app_nonce = '<?php echo wp_create_nonce("mo-openid-sso-enable-app"); ?>';
136
  jQuery.ajax({
150
  } else {
151
  jQuery("#mo_apps_".concat(app_name)).prop('checked', false);
152
  mo_show_success_error_msg('success','Please set custom app for facebook');
 
153
  jQuery ("#mo_facebook_notice").show();
154
  jQuery( "#mo_register_customer_toggle").hide();
155
  getappsInLine(app_name);
161
  else {
162
  document.getElementById(app_name).setAttribute("style", "opacity:1");
163
  active_button.style.display = "block";
164
+ if(toggle=='1') {
165
+ jQuery("#mo_openid_enable_custom_app").prop('checked', true);
166
+ jQuery("#mo_apps_".concat(app_name)).prop('checked', true);
167
+ }
168
  mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+' is activated sucessfully');
169
  enable_default_app_db(app_name,a.checked);
170
  }
171
  } else {
172
  document.getElementById(app_name).setAttribute("style", "opacity:0.6");
173
  active_button.style.display = "none";
174
+ if(toggle=='1') {
175
+ jQuery("#mo_openid_enable_custom_app").prop('checked', false);
176
+ jQuery("#mo_apps_".concat(app_name)).prop('checked', false);
177
+ }
178
  mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+' is deactivated sucessfully');
179
  enable_default_app_db(app_name,a.checked);
180
  }
197
  if (result.status) {
198
  document.getElementById(app_name).setAttribute("style", "opacity:1");
199
  active_button.style.display = "block";
200
+ if(toggle=='1')
201
+ jQuery("#mo_apps_".concat(app_name)).prop('checked', true);
202
  mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+' is activated sucessfully');
203
  var mo_openid_sso_enable_app_nonce = '<?php echo wp_create_nonce("mo-openid-sso-enable-app"); ?>';
204
  jQuery.ajax({
254
  document.getElementById(app_name).setAttribute("style", "opacity:0.6");
255
  active_button.style.display = "none";
256
  var mo_openid_sso_enable_app_nonce = '<?php echo wp_create_nonce("mo-openid-sso-enable-app"); ?>';
257
+ if(toggle=='1')
258
+ jQuery("#mo_apps_".concat(app_name)).prop('checked', true);
259
  mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+' is deactivated sucessfully');
260
  jQuery.ajax({
261
  type: 'POST',
323
  '<div style="width: 65%; float: left; display: inline"><i class="mofa mofa-info-circle mo_copytooltip" title="miniOrange take care of creating applications for you so that you don’t have to worry about creating applications in each social network."></i><label style="display: contents;"><b> Pre configured miniOrange App</b></label></div>' +
324
  '<div style="width: 35%; float: right; display: inline">' +
325
  '<label class="mo-openid-switch-app">' +
326
+ '<input type="checkbox" id="mo_openid_enable_custom_app" value="1"/>' +
327
  '<div class="mo-openid-slider-app round" id="switch_checkbox" ></div>' +
328
  '</label>' +
329
  '</div>' +
330
  '</div>'+
331
+ // '<div id="mo_set_pre_config_app" style="overflow: auto; margin-left:33%; padding-top:2%">' +
332
+ // '<div style="width: 25%; float: left; display: inline"><label style="display: contents;"><b> Enable App</b></label></div>' +
333
+ // '<div style="width: 71%; float: right; display: inline">' +
334
+ // '<label class="mo-openid-switch-app">' +
335
+ // '<input type="checkbox" id="mo_openid_enable_app" value="1" />' +
336
+ // '<div class="mo-openid-slider-app round" id="switch_checkbox" ></div>' +
337
+ // '</label>' +
338
+ // '</div>' +
339
+ // '</div>'+
340
  '<div id="mo_facebook_notice" style="overflow: auto; margin-left:25%; margin-right:3%; padding-top:2%"><label style="cursor:auto"><b>Please set custom app for Facebook</b></label></div><hr>'+
341
  '<div><center><h3 style="margin-bottom: 2%">App Settings</h3></center></div>'+
342
  '<div class="mo-openid-app-name" id="custom_app_name_rename" style="width: 100%">'+
356
  '<div style="float: left; width: 20%"><b>Scope</b></div>'+
357
  '<div style="float: right; width: 80%"><input id="app_scope_value" type="text" style="width: 98%"> </div>'+
358
  '</div>'+
359
+ '<div style="margin-top: 10px;margin-left: 13%;">'+
360
  '<center>' +
361
+ '<input type="button" value="Save & Test Configuration" class="button button-primary button-large mo_openid_save_capp_settings">' +
362
+ '&nbsp;&nbsp;<input type="button" value="Clear Values" class="button button-primary button-large mo_openid_clear_capp_settings">'+
 
363
  '</center>'+
364
  '</div>'+
365
  '<div style="margin-top: 10px;">'+
433
  '</table> '+
434
  '<br/>&nbsp;<a style="font-size: medium;" class="mo_do_not_register">Don\'t want to register and set up my own custom app.</a>'+
435
  '</div>'+
436
+ '<a class="mo_openid_close-button" popup-close="popup-1" href="javascript:void(0)">Close</a>'+
437
  '</div>'+
438
  '</div>';
439
  jQuery(popup).insertAfter("#mo-main-content-div");
511
  jQuery('#mo_openid_register_new_user').hide();
512
  jQuery('#mo_openid_cust_app_instructions').show();
513
  jQuery("#mo_openid_enable_custom_app").prop('checked', true);
514
+ // jQuery( "#mo_openid_enable_app").prop('checked', true);
515
  jQuery("#mo_register_customer_toggle").hide();
516
  mo_show_success_error_msg('success','Registration completed & Pre configured app activated');
517
  let app_name = jQuery(".mo-openid-app-name").attr("id");
526
  }
527
  });
528
 
529
+ //enable app inside toggle
530
+ // jQuery("#mo_openid_enable_app").click(function () {
531
+ // var a = document.getElementById('mo_openid_enable_app');
532
+ // let app_name = jQuery(".mo-openid-app-name").attr("id");
533
+ // enable_app(a,app_name,'1');
534
+ // });
535
 
536
  function mo_openid_ajax_wait_openModal() {
537
  document.getElementById('mo_openid_ajax_wait_img').style.display = 'block';
585
  jQuery('#mo_openid_register_old_user').hide();
586
  jQuery('#mo_openid_cust_app_instructions').show();
587
  jQuery("#mo_openid_enable_custom_app").prop('checked', true);
588
+ // jQuery( "#mo_openid_enable_app").prop('checked', true);
589
  jQuery("#mo_register_customer_toggle").hide();
590
  mo_show_success_error_msg('success','Your account has been retrieved successfully & Pre configured app activated');
591
  let app_name = jQuery(".mo-openid-app-name").attr("id");
624
  mo_openid_ajax_wait_closeModal();
625
  if(result.status=='true'){
626
  jQuery("#mo_openid_enable_custom_app").prop('checked', true);
627
+ // jQuery( "#mo_openid_enable_app").prop('checked', true);
628
+ mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+(' pre configured app activated'));
629
  var active_button=document.getElementById('mo_openid_'.concat(app_name).concat('_active_div'));
630
  active_button.style.display = "block";
631
  document.getElementById(app_name).setAttribute("style","opacity:1");
643
  jQuery("#mo_openid_register_new_user").effect("shake");
644
  }
645
  else if(result.status=="No_cust_app"){
646
+ //app_name.charAt(0).toUpperCase()+app_name.substr(1)+' is activated sucessfully'
647
+ mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+(' deactivated sucessfully'));
648
+ deactivate_app(app_name);
649
+ jQuery( "#mo_openid_enable_custom_app").prop('checked', false);
650
  }
651
  else if(result.status=="Turned_Off"){
652
+ mo_show_success_error_msg('success',app_name.charAt(0).toUpperCase()+app_name.substr(1)+(' custom app activated'));
653
  jQuery( "#mo_openid_enable_custom_app").prop('checked', false);
654
  }
655
  }
658
 
659
  // save app id and secret
660
  jQuery('.mo_openid_save_capp_settings').click(function () {
661
+ save_and_test();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
662
  });
663
+
664
+ //clear values
665
+ jQuery('.mo_openid_clear_capp_settings').on('click',function () {
666
+ let app_name = jQuery(".mo-openid-app-name").attr("id");
667
+ var mo_openid_capp_delete_nonce = '<?php echo wp_create_nonce("mo-openid-capp-delete"); ?>';
668
+ jQuery.ajax({
669
+ type: 'POST',
670
+ url: '<?php echo admin_url("admin-ajax.php"); ?>',
671
+ data: {
672
+ 'mo_openid_capp_delete_nonce': mo_openid_capp_delete_nonce,
673
+ action: 'mo_openid_capp_delete',
674
+ app_name: app_name,
675
+ },
676
+ success: function (data) {
677
+ jQuery("#app_id_value").val('');
678
+ jQuery("#app_secret_value").val('');
679
+ jQuery("#app_scope_value").val('');
680
+ jQuery.ajax({
681
+ url:"<?php echo admin_url("admin-ajax.php");?>", //the page containing php script
682
+ method: "POST", //request type,
683
+ dataType: 'json',
684
+ data: {
685
+ action: 'mo_register_customer_toggle_update',
686
+ app_name: app_name,
687
+ },
688
+ success: function(result){
689
+ if(result.status){
690
+ if (data.status=='1') {
691
+ deactivate_app(app_name);
692
+ mo_show_success_error_msg('success', 'App credentials has been removed and app is deactivated sucessfully.');
693
+ }
694
+ else
695
+ mo_show_success_error_msg('success', 'App credentials has been removed sucessfully.');
696
+ }
697
+ else {
698
+ deactivate_app(app_name);
699
+ mo_show_success_error_msg('success', 'App credentials has been removed and app is deactivated sucessfully.');
700
+ }
701
+ }
702
+ });
703
+ },
704
+ error: function (data) {
705
+ }
706
+ });
707
  });
708
 
709
  //show instructions form
712
  jQuery('#mo_openid_register_old_user').hide();
713
  jQuery('#mo_openid_cust_app_instructions').show();
714
  });
715
+ });
716
 
717
+ function deactivate_app(app_name) {
718
+ jQuery.ajax({
719
+ url:"<?php echo admin_url("admin-ajax.php");?>", //the page containing php script
720
+ method: "POST", //request type,
721
+ dataType: 'json',
722
+ data: {
723
+ app_name: app_name,
724
+ action: 'mo_disable_app',
725
+ },
726
+ success: function(result){
727
+ var active_button = document.getElementById('mo_openid_'.concat(app_name).concat('_active_div'));
728
+ document.getElementById(app_name).setAttribute("style", "opacity:0.6");
729
+ active_button.style.display = "none";
730
+ jQuery( "#mo_apps_".concat(app_name)).prop('checked', false);
731
+ // jQuery( "#mo_openid_enable_app").prop('checked', false);
732
+ }
733
+ });
734
+ }
735
+
736
+ function save_and_test() {
737
+ let app_name = jQuery(".mo-openid-app-name").attr("id");
738
+ let app_id = jQuery(".mo-openid-app-name").find("#app_id_value").val();
739
+ let app_secret = jQuery(".mo-openid-app-name").find("#app_secret_value").val();
740
+ let app_scope = jQuery(".mo-openid-app-name").find("#app_scope_value").val();
741
+ if(app_id=="" || app_secret=="") {
742
+ mo_show_success_error_msg('error','Please enter and save App Id and App secret');
743
+ }
744
+ else {
745
+ var mo_openid_capp_details_nonce = '<?php echo wp_create_nonce("mo-openid-capp-details"); ?>';
746
+ var a=document.getElementById('mo_apps_'.concat(app_name));
747
+ var enable_app='mo_openid'.concat(app_name).concat('_enable');
748
+ var active_button=document.getElementById('mo_openid_'.concat(app_name).concat('_active_div'));
749
+ document.getElementById(app_name).setAttribute("style","opacity:1");
750
+ active_button.style.display = "block";
751
+ jQuery( "#mo_apps_"+app_name).prop('checked', true);
752
  jQuery.ajax({
753
+ type: 'POST',
754
+ url: '<?php echo admin_url("admin-ajax.php"); ?>',
 
755
  data: {
756
+ 'mo_openid_capp_details_nonce': mo_openid_capp_details_nonce,
757
+ action: 'mo_openid_capp_details',
758
+ app_name: app_name,
759
+ app_id: app_id,
760
+ app_secret: app_secret,
761
+ app_scope: app_scope,
762
  },
763
+ success: function (data) {
764
+ // jQuery( "#mo_openid_enable_app").prop('checked', true);
765
+ mo_show_success_error_msg('success','App credentials has been saved sucessfully.');
766
+ mo_test_config();
767
+ },
768
+ error: function (data) {
769
  }
770
  });
771
+ }
772
+ }
773
+ function mo_test_config(){
774
+ let app_name = jQuery(".mo-openid-app-name").attr("id");
775
+ jQuery.ajax({
776
+ url:"<?php echo admin_url("admin-ajax.php");?>", //the page containing php script
777
+ method: "POST", //request type,
778
+ dataType: 'text',
779
+ data: {
780
+ appname: app_name,
781
+ test_configuration : true,
782
+ action: 'mo_openid_test_configuration_update',
783
+ },
784
+ success:function(result){
785
+ var myWindow = window.open('<?php echo attribute_url(); ?>' + '/?option=oauthredirect&app_name='+app_name+'&wp_nonce='+'<?php echo wp_create_nonce( 'mo-openid-oauth-app-nonce' ); ?>', "", "width=950, height=600");
786
+ }
787
  });
788
+ }
789
 
790
  jQuery(".mo-openid-sort-apps-open-settings-div").click(function () {
791
  let app_name = jQuery(this).parents(".mo-openid-sort-apps-div").attr("id");
865
  jQuery( "#mo_openid_enable_custom_app").prop('checked', true);
866
  else
867
  jQuery( "#mo_openid_enable_custom_app").prop('checked', false);
868
+ // if(ins[4]=="1")
869
+ // jQuery( "#mo_openid_enable_app").prop('checked', true);
870
+ // else
871
+ // jQuery( "#mo_openid_enable_app").prop('checked', false);
872
+ jQuery( "#app_scope_value").val(ins[5]);
873
+ jQuery( "#custom_app_video").attr('src', ins[6]);
874
  if(ins.length==7) {
875
  jQuery("#custom_app_perma_inst").show();
876
  jQuery("#mo_perma_error_app_name").text(application_name.charAt(0).toUpperCase()+application_name.substr(1));;
877
  }
878
  else {
879
  jQuery("#custom_app_perma_inst").hide();
880
+ for (i = 7; i < ins.length; i++)
881
  jQuery("#custom_app_inst_steps").append('<li>' + ins[i] + '</li>');
882
  }
883
  document.getElementById('mo_openid_ajax_wait_img').style.display = 'none';
1119
  }
1120
  }
1121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1122
  window.onload=jQuery("#mo_openid_delay_registration").show();
1123
  });
1124
  </script>
view/config_apps/mo_openid_config_apps_funct.php CHANGED
@@ -64,10 +64,13 @@ function mo_openid_app_instructions_action()
64
  $instructions .= "default##";
65
  else
66
  $instructions .= "0##";
 
 
 
 
67
  $name=plugin_dir_path(dirname(__DIR__));
68
  $name=substr($name,0,strlen($name)-1).'//social_apps//'.$social_app.'.php';
69
  require($name);
70
-
71
  $social_app = new $social_app();
72
  if(!isset($appslist[$_POST['app_name']]['scope']))
73
  $instructions .= $social_app->scope . "##";
@@ -125,6 +128,29 @@ function mo_openid_capp_details_action()
125
  }
126
  }
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  function mo_openid_test_configuration_update_action(){
129
  update_option('mo_openid_test_configuration',1);
130
  }
@@ -163,6 +189,9 @@ function custom_app_enable_change_update()
163
 
164
  function mo_register_customer_toggle_update(){
165
  if(mo_openid_is_customer_registered()){
 
 
 
166
  wp_send_json(["status"=>true]);
167
  }
168
  else
64
  $instructions .= "default##";
65
  else
66
  $instructions .= "0##";
67
+ if(get_option("mo_openid_".$social_app."_enable"))
68
+ $instructions .= "1##";
69
+ else
70
+ $instructions .= "0##";
71
  $name=plugin_dir_path(dirname(__DIR__));
72
  $name=substr($name,0,strlen($name)-1).'//social_apps//'.$social_app.'.php';
73
  require($name);
 
74
  $social_app = new $social_app();
75
  if(!isset($appslist[$_POST['app_name']]['scope']))
76
  $instructions .= $social_app->scope . "##";
128
  }
129
  }
130
 
131
+ function mo_openid_capp_delete(){
132
+ $appname = stripslashes(sanitize_text_field($_POST['app_name']));
133
+ $appslist = maybe_unserialize(get_option('mo_openid_apps_list'));
134
+ $status= get_option('mo_openid_enable_custom_app_'.$appname);
135
+ foreach($appslist as $key => $app){
136
+ if($appname == $key){
137
+ unset($appslist[$key]);
138
+ }
139
+ }
140
+ if(!empty($appslist))
141
+ update_option('mo_openid_apps_list', maybe_serialize($appslist));
142
+ else
143
+ delete_option('mo_openid_apps_list');
144
+ update_option('mo_openid_enable_custom_app_'.$appname,'0');
145
+ wp_send_json(["status" => $status]);
146
+ }
147
+
148
+ function mo_disable_app(){
149
+ $appname = $_POST['app_name'];
150
+ update_option('mo_openid_enable_custom_app_'.$appname,0);
151
+ update_option('mo_openid_'.$appname.'_enable',0);
152
+ }
153
+
154
  function mo_openid_test_configuration_update_action(){
155
  update_option('mo_openid_test_configuration',1);
156
  }
189
 
190
  function mo_register_customer_toggle_update(){
191
  if(mo_openid_is_customer_registered()){
192
+ $appname = stripslashes(sanitize_text_field($_POST['appname']));
193
+ if(isset($appname))
194
+ update_option('mo_openid_enable_custom_app_' . $appname, 0);
195
  wp_send_json(["status"=>true]);
196
  }
197
  else