Social Login - Version 6.0.0

Version Description

  • Added Account Linking feature (Links social account to existing WordPress account)
  • Revised Payment Plans
  • Compatibility with PHP 7.2.1
Download this release

Release Info

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

Code changes from version 5.5.2 to 6.0.0

class-mo-openid-login-widget.php CHANGED
@@ -1,1601 +1,2547 @@
1
  <?php
 
 
2
  if(mo_openid_is_customer_registered()) {
3
- /*
4
- * Login Widget
5
- *
6
- */
7
- class mo_openid_login_wid extends WP_Widget {
8
-
9
- public function __construct() {
10
- parent::__construct(
11
- 'mo_openid_login_wid',
12
- 'miniOrange Social Login Widget',
13
- array(
14
- 'description' => __( 'Login using Social Apps like Google, Facebook, LinkedIn, Microsoft, Instagram.', 'flw' ),
15
- 'customize_selective_refresh' => true,
16
- )
17
- );
18
- }
19
-
20
-
21
- public function widget( $args, $instance ) {
22
- extract( $args );
23
-
24
- echo $args['before_widget'];
25
- $this->openidloginForm();
26
-
27
- echo $args['after_widget'];
28
- }
29
 
30
- public function update( $new_instance, $old_instance ) {
31
- $instance = array();
32
- $instance['wid_title'] = strip_tags( $new_instance['wid_title'] );
33
- return $instance;
34
- }
35
 
36
-
37
- public function openidloginForm(){
38
- global $post;
39
- //$this->error_message();
40
- $selected_theme = get_option('mo_openid_login_theme');
41
- $appsConfigured = get_option('mo_openid_google_enable') | get_option('mo_openid_salesforce_enable') | get_option('mo_openid_facebook_enable') | get_option('mo_openid_linkedin_enable') | get_option('mo_openid_instagram_enable') | get_option('mo_openid_amazon_enable') | get_option('mo_openid_windowslive_enable') | get_option('mo_openid_twitter_enable') | get_option('mo_openid_vkontakte_enable');
42
- $spacebetweenicons = get_option('mo_login_icon_space');
43
- $customWidth = get_option('mo_login_icon_custom_width');
44
- $customHeight = get_option('mo_login_icon_custom_height');
45
- $customSize = get_option('mo_login_icon_custom_size');
46
- $customBackground = get_option('mo_login_icon_custom_color');
47
- $customTheme = get_option('mo_openid_login_custom_theme');
48
- $customTextofTitle = get_option('mo_openid_login_button_customize_text');
49
- $customBoundary = get_option('mo_login_icon_custom_boundary');
50
- $customLogoutName = get_option('mo_openid_login_widget_customize_logout_name_text');
51
- $customLogoutLink = get_option('mo_openid_login_widget_customize_logout_text');
52
- $customTextColor=get_option('mo_login_openid_login_widget_customize_textcolor');
53
- $customText=get_option('mo_openid_login_widget_customize_text');
54
-
55
- if( ! is_user_logged_in() ) {
 
 
 
 
 
 
 
 
 
56
 
57
- if( $appsConfigured ) {
58
- $this->mo_openid_load_login_script();
59
- ?>
60
- <div class="mo-openid-app-icons">
 
61
 
62
- <p style="color:#<?php echo $customTextColor ?>"><?php echo $customText ?>
63
- </p>
64
- <?php
65
- if($customTheme == 'default'){
66
- if( get_option('mo_openid_facebook_enable') ) {
67
- if($selected_theme == 'longbutton'){
68
- ?> <a rel='nofollow' onClick="moOpenIdLogin('facebook');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-facebook btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-facebook"></i><?php
69
- echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
70
- <?php }
71
- else{ ?>
72
- <a rel='nofollow' title="<?php echo $customTextofTitle ?> Facebook" onClick="moOpenIdLogin('facebook');"><img alt='Facebook' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/facebook.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button" ></a>
 
 
 
 
 
 
73
 
74
- <?php }
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
- }
77
- if( get_option('mo_openid_google_enable') ) {
78
- if($selected_theme == 'longbutton'){
79
- ?>
80
-
81
- <a rel='nofollow' onClick="moOpenIdLogin('google');" style='width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;' class='btn btn-block btn-social btn-google btn-custom-size login-button' > <i style='padding-top:<?php echo $customHeight-35 ?>px !important' class='fa fa-google-plus'></i><?php
82
- echo get_option('mo_openid_login_button_customize_text'); ?> Google</a>
83
- <?php }
84
- else{ ?>
85
- <a rel='nofollow' onClick="moOpenIdLogin('google');" title="<?php echo $customTextofTitle ?> Google" ><img alt='Google' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/google.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button" ></a>
86
- <?php
87
- }
88
- }
89
 
90
- if( get_option('mo_openid_vkontakte_enable') ) {
91
- if($selected_theme == 'longbutton'){
92
- ?>
93
 
94
- <a rel='nofollow' onClick="moOpenIdLogin('vkontakte');" style='width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;' class='btn btn-block btn-social btn-vk btn-custom-size login-button' > <i style='padding-top:<?php echo $customHeight-35 ?>px !important' class='fa fa-vk'></i><?php
95
- echo get_option('mo_openid_login_button_customize_text'); ?> Vkontakte</a>
96
- <?php }
97
- else{ ?>
98
- <a rel='nofollow' onClick="moOpenIdLogin('vkontakte');" title="<?php echo $customTextofTitle ?> Vkontakte" ><img alt='Vkontakte' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/vk.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button" ></a>
99
- <?php
100
- }
101
- }
102
 
103
-
104
- if( get_option('mo_openid_twitter_enable') ) {
105
- if($selected_theme == 'longbutton'){
106
- ?> <a rel='nofollow' onClick="moOpenIdLogin('twitter');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-twitter btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-twitter"></i><?php
107
- echo get_option('mo_openid_login_button_customize_text'); ?> Twitter</a>
108
- <?php }
109
- else{ ?>
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
- <a rel='nofollow' title="<?php echo $customTextofTitle ?> Twitter" onClick="moOpenIdLogin('twitter');"><img alt='Twitter' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/twitter.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button"></a>
113
- <?php }
114
- }
115
-
116
- if( get_option('mo_openid_linkedin_enable') ) {
117
- if($selected_theme == 'longbutton'){ ?>
118
- <a rel='nofollow' onClick="moOpenIdLogin('linkedin');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-linkedin btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-linkedin"></i><?php
119
- echo get_option('mo_openid_login_button_customize_text'); ?> LinkedIn</a>
120
- <?php }
121
- else{ ?>
122
- <a rel='nofollow' title="<?php echo $customTextofTitle ?> LinkedIn" onClick="moOpenIdLogin('linkedin');"><img alt='LinkedIn' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/linkedin.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button" ></a>
123
- <?php }
124
- }if( get_option('mo_openid_instagram_enable') ) {
125
- if($selected_theme == 'longbutton'){ ?>
126
- <a rel='nofollow' onClick="moOpenIdLogin('instagram');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-instagram btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-instagram"></i><?php
127
- echo get_option('mo_openid_login_button_customize_text'); ?> Instagram</a>
128
- <?php }
129
- else{ ?>
130
-
131
-
132
- <a rel='nofollow' title="<?php echo $customTextofTitle ?> Instagram" onClick="moOpenIdLogin('instagram');"><img alt='Instagram' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/instagram.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button"></a>
133
- <?php }
134
- }if( get_option('mo_openid_amazon_enable') ) {
135
- if($selected_theme == 'longbutton'){
136
- ?> <a rel='nofollow' onClick="moOpenIdLogin('amazon');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-soundcloud btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-amazon"></i><?php
137
- echo get_option('mo_openid_login_button_customize_text'); ?> Amazon</a>
138
- <?php }
139
- else{ ?>
140
-
141
- <a rel='nofollow' title="<?php echo $customTextofTitle ?> Amazon" onClick="moOpenIdLogin('amazon');"><img alt='Amazon' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/amazon.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button"></a>
142
- <?php }
143
- }if( get_option('mo_openid_salesforce_enable') ) {
144
  if($selected_theme == 'longbutton'){
145
- ?> <a rel='nofollow' onClick="moOpenIdLogin('salesforce');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-vimeo btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-cloud"></i> <?php
146
- echo get_option('mo_openid_login_button_customize_text'); ?> Salesforce</a>
147
- <?php }
148
- else{ ?>
149
 
 
150
 
151
- <a rel='nofollow' title="<?php echo $customTextofTitle ?> Salesforce" onClick="moOpenIdLogin('salesforce');"><img alt='Salesforce' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/salesforce.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button" ></a>
152
- <?php }
153
- }if( get_option('mo_openid_windowslive_enable') ) {
154
- if($selected_theme == 'longbutton'){
155
- ?> <a rel='nofollow' onClick="moOpenIdLogin('windowslive');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-microsoft btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-windows"></i><?php
156
- echo get_option('mo_openid_login_button_customize_text'); ?> Microsoft</a>
157
- <?php }
158
- else{ ?>
159
 
 
160
 
161
- <a rel='nofollow' title="<?php echo $customTextofTitle ?> Microsoft" onClick="moOpenIdLogin('windowslive');"><img alt='Windowslive' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/windowslive.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button"></a>
162
- <?php }
163
- }
164
-
165
- }
166
- ?>
167
-
168
-
169
-
170
- <?php
171
- if($customTheme == 'custom'){
172
- if( get_option('mo_openid_facebook_enable') ) {
173
- if($selected_theme == 'longbutton'){
174
- ?> <a rel='nofollow' onClick="moOpenIdLogin('facebook');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-facebook btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-facebook"></i><?php
175
- echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
176
- <?php }
177
- else{ ?>
178
 
179
- <a rel='nofollow' onClick="moOpenIdLogin('facebook');" title="<?php echo $customTextofTitle ?> Facebook"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-facebook custom-login-button <?php echo $selected_theme; ?>" ></i></a>
 
 
 
 
 
 
 
 
 
 
 
180
 
181
- <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
 
183
- }
184
 
185
- if( get_option('mo_openid_google_enable') ) {
186
- if($selected_theme == 'longbutton'){
187
- ?>
188
 
189
- <a rel='nofollow' onClick="moOpenIdLogin('google');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important; background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-customtheme btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-google-plus"></i><?php
190
- echo get_option('mo_openid_login_button_customize_text'); ?> Google</a>
191
- <?php }
192
- else{ ?>
193
- <a rel='nofollow' onClick="moOpenIdLogin('google');" title="<?php echo $customTextofTitle ?> Google"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-google-plus custom-login-button <?php echo $selected_theme; ?>" ></i></a>
194
- <?php
195
- }
196
- }
197
-
198
- if( get_option('mo_openid_vkontakte_enable') ) {
199
- if($selected_theme == 'longbutton'){
200
- ?>
201
 
202
- <a rel='nofollow' onClick="moOpenIdLogin('vkontakte');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important; background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-customtheme btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-vk"></i><?php
203
- echo get_option('mo_openid_login_button_customize_text'); ?> Vkontakte</a>
204
- <?php }
205
- else{ ?>
206
- <a rel='nofollow' onClick="moOpenIdLogin('vkontakte');" title="<?php echo $customTextofTitle ?> Vkontakte"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-vk custom-login-button <?php echo $selected_theme; ?>" ></i></a>
 
 
 
 
 
 
207
  <?php
208
  }
 
 
 
209
  }
210
-
211
- if( get_option('mo_openid_twitter_enable') ) {
212
- if($selected_theme == 'longbutton'){
213
  ?>
214
-
215
- <a rel='nofollow' onClick="moOpenIdLogin('twitter');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important; background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-customtheme btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-twitter"></i><?php
216
- echo get_option('mo_openid_login_button_customize_text'); ?> Twitter</a>
217
- <?php }
218
- else{ ?>
219
- <a rel='nofollow'onClick="moOpenIdLogin('twitter');" title="<?php echo $customTextofTitle ?> Twitter"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-twitter custom-login-button <?php echo $selected_theme; ?>" ></i></a>
 
 
 
 
 
 
220
  <?php
 
221
  }
222
- }
223
- if( get_option('mo_openid_linkedin_enable') ) {
224
- if($selected_theme == 'longbutton'){ ?>
225
- <a rel='nofollow' onClick="moOpenIdLogin('linkedin');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-linkedin btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-linkedin"></i><?php
226
- echo get_option('mo_openid_login_button_customize_text'); ?> LinkedIn</a>
227
- <?php }
228
- else{ ?>
229
- <a rel='nofollow' onClick="moOpenIdLogin('linkedin');" title="<?php echo $customTextofTitle ?> LinkedIn"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-linkedin custom-login-button <?php echo $selected_theme; ?>" ></i></a>
230
- <?php }
231
- }if( get_option('mo_openid_instagram_enable') ) {
232
- if($selected_theme == 'longbutton'){ ?>
233
- <a rel='nofollow' onClick="moOpenIdLogin('instagram');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-instagram btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-instagram"></i><?php
234
- echo get_option('mo_openid_login_button_customize_text'); ?> Instagram</a>
235
- <?php }
236
- else{ ?>
237
-
238
-
239
- <a rel='nofollow' onClick="moOpenIdLogin('instagram');" title="<?php echo $customTextofTitle ?> Instagram"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-instagram custom-login-button <?php echo $selected_theme; ?>"></i></a>
240
- <?php }
241
- }if( get_option('mo_openid_amazon_enable') ) {
242
- if($selected_theme == 'longbutton'){
243
- ?> <a rel='nofollow' onClick="moOpenIdLogin('amazon');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-linkedin btn-custom-size login-button" ><i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-amazon"></i><?php
244
- echo get_option('mo_openid_login_button_customize_text'); ?> Amazon</a>
245
- <?php }
246
- else{ ?>
247
-
248
- <a rel='nofollow' onClick="moOpenIdLogin('amazon');" title="<?php echo $customTextofTitle ?> Amazon"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-amazon custom-login-button <?php echo $selected_theme; ?>"></i></a>
249
- <?php }
250
- }if( get_option('mo_openid_salesforce_enable') ) {
251
- if($selected_theme == 'longbutton'){
252
- ?> <a rel='nofollow' onClick="moOpenIdLogin('salesforce');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-linkedin btn-custom-size login-button" ><i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-cloud"></i> <?php
253
- echo get_option('mo_openid_login_button_customize_text'); ?> Salesforce</a>
254
- <?php }
255
- else{ ?>
256
-
257
-
258
- <a rel='nofollow' onClick="moOpenIdLogin('salesforce');" title="<?php echo $customTextofTitle ?> Salesforce"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px " class="fa fa-cloud custom-login-button <?php echo $selected_theme; ?>" ></i></a>
259
- <?php }
260
- }if( get_option('mo_openid_windowslive_enable') ) {
261
- if($selected_theme == 'longbutton'){
262
- ?> <a rel='nofollow' onClick="moOpenIdLogin('windowslive');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-microsoft btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-windows"></i><?php
263
- echo get_option('mo_openid_login_button_customize_text'); ?> Microsoft</a>
264
- <?php }
265
- else{ ?>
266
-
267
-
268
- <a rel='nofollow' onClick="moOpenIdLogin('windowslive');" title="<?php echo $customTextofTitle ?> Microsoft"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class=" fa fa-windows custom-login-button <?php echo $selected_theme; ?>"></i></a>
269
- <?php }
270
- }
271
-
272
-
273
- }
274
  ?>
275
- <br>
276
- </div> <br>
 
277
  <?php
278
-
279
-
280
- } else {
281
- ?>
282
- <div>No apps configured. Please contact your administrator.</div>
283
- <?php
284
- }
285
- }else {
286
- global $current_user;
287
- $current_user = wp_get_current_user();
288
- $customLogoutName = str_replace('##username##', $current_user->display_name, $customLogoutName);
289
- $link_with_username = $customLogoutName;
290
- if (empty($customLogoutName) || empty($customLogoutLink)) {
291
- ?>
292
- <div id="logged_in_user" class="mo_openid_login_wid">
293
- <li><?php echo $link_with_username;?> <a href="<?php echo wp_logout_url( site_url() ); ?>" title="<?php _e('Logout','flw');?>"><?php _e($customLogoutLink,'flw');?></a></li>
294
- </div>
295
- <?php
296
-
297
  }
298
- else {
299
- ?>
300
- <div id="logged_in_user" class="mo_openid_login_wid">
301
- <li><?php echo $link_with_username;?> <a href="<?php echo wp_logout_url( site_url() ); ?>" title="<?php _e('Logout','flw');?>"><?php _e($customLogoutLink,'flw');?></a></li>
302
- </div>
303
- <?php
304
- }
305
  }
306
- }
307
-
308
-
309
- public function openidloginFormShortCode( $atts ){
310
- global $post;
311
- $html = '';
312
- //$this->error_message();
313
- $selected_theme = isset( $atts['shape'] )? $atts['shape'] : get_option('mo_openid_login_theme');
314
- $appsConfigured = get_option('mo_openid_google_enable') | get_option('mo_openid_salesforce_enable') | get_option('mo_openid_facebook_enable') | get_option('mo_openid_linkedin_enable') | get_option('mo_openid_instagram_enable') | get_option('mo_openid_amazon_enable') | get_option('mo_openid_windowslive_enable') |get_option('mo_openid_twitter_enable') | get_option('mo_openid_vkontakte_enable');
315
- $spacebetweenicons = isset( $atts['space'] )? $atts['space'] : get_option('mo_login_icon_space');
316
- $customWidth = isset( $atts['width'] )? $atts['width'] : get_option('mo_login_icon_custom_width');
317
- $customHeight = isset( $atts['height'] )? $atts['height'] : get_option('mo_login_icon_custom_height');
318
- $customSize = isset( $atts['size'] )? $atts['size'] : get_option('mo_login_icon_custom_size');
319
- $customBackground = isset( $atts['background'] )? $atts['background'] : get_option('mo_login_icon_custom_color');
320
- $customTheme = isset( $atts['theme'] )? $atts['theme'] : get_option('mo_openid_login_custom_theme');
321
- $customText = get_option('mo_openid_login_widget_customize_text');
322
- $buttonText = get_option('mo_openid_login_button_customize_text');
323
- $customTextofTitle = get_option('mo_openid_login_button_customize_text');
324
- $logoutUrl = wp_logout_url( site_url() );
325
- $customBoundary = isset( $atts['edge'] )? $atts['edge'] : get_option('mo_login_icon_custom_boundary');
326
- $customLogoutName = get_option('mo_openid_login_widget_customize_logout_name_text');
327
- $customLogoutLink = get_option('mo_openid_login_widget_customize_logout_text');
328
- $customTextColor= isset( $atts['color'] )? $atts['color'] : get_option('mo_login_openid_login_widget_customize_textcolor');
329
- $customText=isset( $atts['heading'] )? $atts['heading'] :get_option('mo_openid_login_widget_customize_text');
330
 
331
- if($selected_theme == 'longbuttonwithtext'){
332
- $selected_theme = 'longbutton';
333
- }
334
- if($customTheme == 'custombackground'){
335
- $customTheme = 'custom';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  }
337
 
338
- if( ! is_user_logged_in() ) {
339
-
340
- if( $appsConfigured ) {
341
- $this->mo_openid_load_login_script();
342
- $html .= "<div class='mo-openid-app-icons'>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
 
344
-
345
- <p style='color:#".$customTextColor."'> $customText</p>";
346
-
347
-
348
-
349
-
350
- if($customTheme == 'default'){
351
- if( get_option('mo_openid_facebook_enable') ) {
352
- if($selected_theme == 'longbutton'){
353
- $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-facebook btn-custom-dec login-button' onClick='moOpenIdLogin(" . '"facebook"' . ");'> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-facebook'></i>" . $buttonText . " Facebook</a>"; }
354
- else{
355
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Facebook' onClick='moOpenIdLogin(" . '"facebook"' . ");' ><img alt='Facebook' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons-4) ."px !important' src='" . plugins_url( 'includes/images/icons/facebook.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
356
- }
357
 
358
- }
 
359
 
360
- if( get_option('mo_openid_google_enable') ) {
361
- if($selected_theme == 'longbutton'){
362
- $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary ."px !important;' class='btn btn-block btn-social btn-google btn-custom-dec login-button' onClick='moOpenIdLogin(" . '"google"' . ");'> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-google-plus'></i>" . $buttonText . " Google</a>";
363
- }
364
- else{
365
-
366
- $html .= "<a rel='nofollow' onClick='moOpenIdLogin(" . '"google"' . ");' title= ' ".$customTextofTitle." Google'><img alt='Google' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons-4) ."px !important' src='" . plugins_url( 'includes/images/icons/google.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
367
-
368
- }
369
- }
370
 
371
- if( get_option('mo_openid_vkontakte_enable') ) {
372
- if($selected_theme == 'longbutton'){
373
- $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary ."px !important;' class='btn btn-block btn-social btn-vk btn-custom-dec login-button' onClick='moOpenIdLogin(" . '"vkontakte"' . ");'> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-vk'></i>" . $buttonText . " Vkontakte</a>";
374
- }
375
- else{
376
-
377
- $html .= "<a rel='nofollow' onClick='moOpenIdLogin(" . '"vkontakte"' . ");' title= ' ".$customTextofTitle." Vkontakte'><img alt='Vkontakte' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons-4) ."px !important' src='" . plugins_url( 'includes/images/icons/vk.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
378
-
379
- }
380
- }
381
 
382
- if( get_option('mo_openid_twitter_enable') ) {
383
- if($selected_theme == 'longbutton'){
384
- $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary ."px !important;' class='btn btn-block btn-social btn-twitter btn-custom-dec login-button' onClick='moOpenIdLogin(" . '"twitter"' . ");'> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-twitter'></i>" . $buttonText . " Twitter</a>"; }
385
- else{
386
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Twitter' onClick='moOpenIdLogin(" . '"twitter"' . ");' ><img alt='Twitter' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons-4) ."px !important' src='" . plugins_url( 'includes/images/icons/twitter.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
387
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
 
389
- }
390
- if( get_option('mo_openid_linkedin_enable') ) {
391
- if($selected_theme == 'longbutton'){
392
- $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-linkedin btn-custom-dec login-button' onClick='moOpenIdLogin(" . '"linkedin"' . ");'> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-linkedin'></i>" . $buttonText . " LinkedIn</a>";
393
- }
394
- else{
395
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." LinkedIn' onClick='moOpenIdLogin(" . '"linkedin"' . ");' ><img alt='LinkedIn' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons-4) ."px !important' src='" . plugins_url( 'includes/images/icons/linkedin.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
396
- }
397
- }if( get_option('mo_openid_instagram_enable') ) {
398
- if($selected_theme == 'longbutton'){
399
- $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-instagram btn-custom-dec login-button' onClick='moOpenIdLogin(" . '"instagram"' . ");'> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-instagram'></i>" . $buttonText . " Instagram</a>";
400
- }
401
- else{
402
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Instagram' onClick='moOpenIdLogin(" . '"instagram"' . ");' ><img alt='Instagram' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons-4) ."px !important' src='" . plugins_url( 'includes/images/icons/instagram.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
403
- }
404
- }if( get_option('mo_openid_amazon_enable') ) {
405
- if($selected_theme == 'longbutton'){
406
- $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-soundcloud btn-custom-dec login-button' onClick='moOpenIdLogin(" . '"amazon"' . ");'> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-amazon'></i>" . $buttonText . " Amazon</a>";
407
- }
408
- else{
409
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Amazon' onClick='moOpenIdLogin(" . '"amazon"' . ");' ><img alt='Amazon' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons-4) ."px !important' src='" . plugins_url( 'includes/images/icons/amazon.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
410
- }
411
- }if( get_option('mo_openid_salesforce_enable') ) {
412
  if($selected_theme == 'longbutton'){
413
- $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-vimeo btn-custom-dec login-button' onClick='moOpenIdLogin(" . '"salesforce"' . ");'> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-cloud'></i>" . $buttonText . " Salesforce</a>";
414
- }
415
- else{
416
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Salesforce' onClick='moOpenIdLogin(" . '"salesforce"' . ");' ><img alt='Salesforce' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons-4) ."px !important' src='" . plugins_url( 'includes/images/icons/salesforce.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
417
- }
418
- }if( get_option('mo_openid_windowslive_enable') ) {
419
- if($selected_theme == 'longbutton'){
420
- $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-microsoft btn-custom-dec login-button' onClick='moOpenIdLogin(" . '"windowslive"' . ");'> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-windows'></i>" . $buttonText . " Microsoft</a>";
421
  }
422
- else{
423
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Microsoft' onClick='moOpenIdLogin(" . '"windowslive"' . ");' ><img alt='Windowslive' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons-4) ."px !important' src='" . plugins_url( 'includes/images/icons/windowslive.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
424
- }
425
- }
426
- }
427
-
428
- if($customTheme == 'custom'){
429
- if( get_option('mo_openid_facebook_enable') ) {
430
- if($selected_theme == 'longbutton'){
431
- $html .= "<a rel='nofollow' onClick='moOpenIdLogin(" . '"facebook"' . ");' style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-facebook'></i> " . $buttonText . " Facebook</a>";
432
- }
433
- else{
434
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Facebook' onClick='moOpenIdLogin(" . '"facebook"' . ");' ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons-4) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-facebook custom-login-button " . $selected_theme . "' ></i></a>";
435
- }
436
 
437
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
 
439
- if( get_option('mo_openid_google_enable') ) {
440
- if($selected_theme == 'longbutton'){
441
- $html .= "<a rel='nofollow' onClick='moOpenIdLogin(" . '"google"' . ");' style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-google-plus'></i> " . $buttonText . " Google</a>";
442
  }
443
- else{
444
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Google' onClick='moOpenIdLogin(" . '"google"' . ");' title= ' ". $customTextofTitle." Google'><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons-4) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-google-plus custom-login-button " . $selected_theme . "' ></i></a>";
445
-
 
 
 
 
 
 
446
  }
447
- }
448
 
449
- if( get_option('mo_openid_vkontakte_enable') ) {
450
- if($selected_theme == 'longbutton'){
451
- $html .= "<a rel='nofollow' onClick='moOpenIdLogin(" . '"vkontakte"' . ");' style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-vk'></i> " . $buttonText . " Vkontakte</a>";
 
 
 
 
 
452
  }
453
- else{
454
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Vkontakte' onClick='moOpenIdLogin(" . '"vkontakte"' . ");' title= ' ". $customTextofTitle." Vkontakte'><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons-4) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-vk custom-login-button " . $selected_theme . "' ></i></a>";
455
-
 
 
 
 
456
  }
457
- }
458
 
459
- if( get_option('mo_openid_twitter_enable') ) {
460
- if($selected_theme == 'longbutton'){
461
- $html .= "<a rel='nofollow' onClick='moOpenIdLogin(" . '"twitter"' . ");' style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-twitter'></i> " . $buttonText . " Twitter</a>";
462
- }
463
- else{
464
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Twitter' onClick='moOpenIdLogin(" . '"twitter"' . ");' ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons-4) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-twitter custom-login-button " . $selected_theme . "' ></i></a>";
465
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
 
467
  }
468
- if( get_option('mo_openid_linkedin_enable') ) {
469
- if($selected_theme == 'longbutton'){
470
- $html .= "<a rel='nofollow' onClick='moOpenIdLogin(" . '"linkedin"' . ");' style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-linkedin'></i> " . $buttonText . " LinkedIn</a>";
471
- }
472
- else{
473
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." LinkedIn' onClick='moOpenIdLogin(" . '"linkedin"' . ");' ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons-4) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-linkedin custom-login-button " . $selected_theme . "' ></i></a>";
474
- }
475
- }if( get_option('mo_openid_instagram_enable') ) {
476
- if($selected_theme == 'longbutton'){
477
- $html .= "<a rel='nofollow' onClick='moOpenIdLogin(" . '"instagram"' . ");' style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-instagram'></i> " . $buttonText . " Instagram</a>";
478
- }
479
- else{
480
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Instagram' onClick='moOpenIdLogin(" . '"instagram"' . ");' ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons-4) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-instagram custom-login-button " . $selected_theme . "' ></i></a>";
481
- }
482
- }if( get_option('mo_openid_amazon_enable') ) {
483
- if($selected_theme == 'longbutton'){
484
- $html .= "<a rel='nofollow' onClick='moOpenIdLogin(" . '"amazon"' . ");' style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-amazon'></i> " . $buttonText . " Amazon</a>";
485
- }
486
- else{
487
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Amazon' onClick='moOpenIdLogin(" . '"amazon"' . ");' ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons-4) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-amazon custom-login-button " . $selected_theme . "' ></i></a>";
488
- }
489
- }if( get_option('mo_openid_salesforce_enable') ) {
490
- if($selected_theme == 'longbutton'){
491
- $html .= "<a rel='nofollow' onClick='moOpenIdLogin(" . '"salesforce"' . ");' style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-cloud'></i> " . $buttonText . " Salesforce</a>";
492
- }
493
- else{
494
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Salesforce' onClick='moOpenIdLogin(" . '"salesforce"' . ");' ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons-4) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-cloud custom-login-button " . $selected_theme . "' ></i></a>";
495
  }
496
- }if( get_option('mo_openid_windowslive_enable') ) {
497
- if($selected_theme == 'longbutton'){
498
- $html .= "<a rel='nofollow' onClick='moOpenIdLogin(" . '"windowslive"' . ");' style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-windows'></i> " . $buttonText . " Microsoft</a>";
499
- }
500
- else{
501
- $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Microsoft' onClick='moOpenIdLogin(" . '"windowslive"' . ");' ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons-4) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-windows custom-login-button " . $selected_theme . "' ></i></a>";
502
  }
 
 
 
 
 
 
 
 
 
 
503
  }
 
 
504
  }
505
- $html .= '</div> <br>';
506
-
507
-
508
- } else {
509
-
510
- $html .= '<div>No apps configured. Please contact your administrator.</div>';
511
-
512
- }
513
- }else {
514
- global $current_user;
515
- $current_user = wp_get_current_user();
516
- $customLogoutName = str_replace('##username##', $current_user->display_name, $customLogoutName);
517
- $flw = __($customLogoutLink,"flw");
518
- if (empty($customLogoutName) || empty($customLogoutLink)) {
519
- $html .= '<div id="logged_in_user" class="mo_openid_login_wid">' . $customLogoutName . ' <a href=' . $logoutUrl .' title=" ' . $flw . '"> ' . $flw . '</a></div>';
520
- }
521
- else {
522
- $html .= '<div id="logged_in_user" class="mo_openid_login_wid">' . $customLogoutName . ' <a href=' . $logoutUrl .' title=" ' . $flw . '"> ' . $flw . '</a></div>';
523
  }
 
524
  }
525
 
526
- return $html;
527
- }
528
-
529
- private function mo_openid_load_login_script() {
530
- ?>
531
- <script type="text/javascript">
532
- function moOpenIdLogin(app_name) {
533
- <?php
534
  if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
535
  $http = "https://";
536
  } else {
537
  $http = "http://";
538
  }
539
- if ( strpos($_SERVER['REQUEST_URI'],'wp-login.php') !== FALSE){
540
- $redirect_url = site_url() . '/?option=getmosociallogin&app_name=';
541
-
542
- }else{
543
- $redirect_url = $http . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
544
- if(strpos($redirect_url, '?') !== false) {
545
- $redirect_url .= '&option=getmosociallogin&app_name=';
546
- } else {
547
- $redirect_url .= '?option=getmosociallogin&app_name=';
 
 
 
 
 
 
 
 
 
 
548
  }
549
  }
550
- ?>
551
- window.location.href = '<?php echo $redirect_url; ?>' + app_name;
552
- }
553
- </script>
554
- <?php
555
- }
556
-
557
- /*public function error_message(){
558
- if(isset($_SESSION['msg']) and $_SESSION['msg']){
559
- echo '<div class="'.$_SESSION['msg_class'].'">'.$_SESSION['msg'].'</div>';
560
- unset($_SESSION['msg']);
561
- unset($_SESSION['msg_class']);
 
 
 
 
 
 
 
 
 
 
 
 
562
  }
563
- }*/
564
-
565
- }
566
-
567
-
568
- /**
569
- * Sharing Widget Horizontal
570
- *
571
- */
572
- class mo_openid_sharing_hor_wid extends WP_Widget {
573
-
574
- public function __construct() {
575
- parent::__construct(
576
- 'mo_openid_sharing_hor_wid',
577
- 'miniOrange Sharing - Horizontal',
578
- array(
579
- 'description' => __( 'Share using horizontal widget. Lets you share with Social Apps like Google, Facebook, LinkedIn, Pinterest, Reddit.', 'flw' ),
580
- 'customize_selective_refresh' => true,
581
- )
582
- );
583
- }
584
-
585
-
586
- public function widget( $args, $instance ) {
587
- extract( $args );
588
-
589
- echo $args['before_widget'];
590
- $this->show_sharing_buttons_horizontal();
591
-
592
- echo $args['after_widget'];
593
- }
594
-
595
- public function update( $new_instance, $old_instance ) {
596
- $instance = array();
597
- $instance['wid_title'] = strip_tags( $new_instance['wid_title'] );
598
- return $instance;
599
- }
600
 
 
 
 
 
 
 
 
601
 
602
- public function show_sharing_buttons_horizontal(){
603
- global $post;
604
- $title = str_replace('+', '%20', urlencode($post->post_title));
605
- $content=strip_shortcodes( strip_tags( get_the_content() ) );
606
- $post_content=$content;
607
- $excerpt = '';
608
- $landscape = 'horizontal';
609
- include( plugin_dir_path( __FILE__ ) . 'class-mo-openid-social-share.php');
610
  }
611
 
612
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
613
 
 
 
614
 
615
- /**
616
- * Sharing Vertical Widget
617
- *
618
- */
619
- class mo_openid_sharing_ver_wid extends WP_Widget {
620
-
621
- public function __construct() {
622
- parent::__construct(
623
- 'mo_openid_sharing_ver_wid',
624
- 'miniOrange Sharing - Vertical',
625
- array(
626
- 'description' => __( 'Share using a vertical floating widget. Lets you share with Social Apps like Google, Facebook, LinkedIn, Pinterest, Reddit.', 'flw' ),
627
- 'customize_selective_refresh' => true,
628
- )
629
- );
630
- }
631
-
632
-
633
- public function widget( $args, $instance ) {
634
- extract( $args );
635
- extract( $instance );
636
-
637
- $wid_title = apply_filters( 'widget_title', $instance['wid_title'] );
638
- $alignment = apply_filters( 'alignment', isset($instance['alignment'])? $instance['alignment'] : 'left');
639
- $left_offset = apply_filters( 'left_offset', isset($instance['left_offset'])? $instance['left_offset'] : '20');
640
- $right_offset = apply_filters( 'right_offset', isset($instance['right_offset'])? $instance['right_offset'] : '0');
641
- $top_offset = apply_filters( 'top_offset', isset($instance['top_offset'])? $instance['top_offset'] : '100');
642
- $space_icons = apply_filters( 'space_icons', isset($instance['space_icons'])? $instance['space_icons'] : '10');
643
-
644
- echo $args['before_widget'];
645
- if ( ! empty( $wid_title ) )
646
- echo $args['before_title'] . $wid_title . $args['after_title'];
647
-
648
- echo "<div class='mo_openid_vertical' style='" .(isset($alignment) && $alignment != '' && isset($instance[$alignment.'_offset']) ? $alignment .': '. ( $instance[$alignment.'_offset'] == '' ? 0 : $instance[$alignment.'_offset'] ) .'px;' : '').(isset($top_offset) ? 'top: '. ( $top_offset == '' ? 0 : $top_offset ) .'px;' : '') ."'>";
649
-
650
- $this->show_sharing_buttons_vertical($space_icons);
651
-
652
- echo '</div>';
653
-
654
- echo $args['after_widget'];
655
- }
656
 
657
- /*Called when user changes configuration in Widget Admin Panel*/
658
- public function update( $new_instance, $old_instance ) {
659
- $instance = $old_instance;
660
- $instance['wid_title'] = strip_tags( $new_instance['wid_title'] );
661
- $instance['alignment'] = $new_instance['alignment'];
662
- $instance['left_offset'] = $new_instance['left_offset'];
663
- $instance['right_offset'] = $new_instance['right_offset'];
664
- $instance['top_offset'] = $new_instance['top_offset'];
665
- $instance['space_icons'] = $new_instance['space_icons'];
666
- return $instance;
667
- }
668
 
 
 
 
 
 
669
 
670
- public function show_sharing_buttons_vertical($space_icons){
671
- global $post;
672
- if($post->post_title) {
673
  $title = str_replace('+', '%20', urlencode($post->post_title));
674
- } else {
675
- $title = get_bloginfo( 'name' );
676
- }
677
- $content=strip_shortcodes( strip_tags( get_the_content() ) );
678
- $post_content=$content;
679
- $excerpt = '';
680
- $landscape = 'vertical';
681
-
682
- include( plugin_dir_path( __FILE__ ) . 'class-mo-openid-social-share.php');
683
- }
684
-
685
- /** Widget edit form at admin panel */
686
- function form( $instance ) {
687
- /* Set up default widget settings. */
688
- $defaults = array('alignment' => 'left', 'left_offset' => '20', 'right_offset' => '0', 'top_offset' => '100' , 'space_icons' => '10');
689
-
690
- foreach( $instance as $key => $value ){
691
- $instance[ $key ] = esc_attr( $value );
692
  }
693
-
694
- $instance = wp_parse_args( (array)$instance, $defaults );
695
- ?>
696
- <p>
697
- <script>
698
- function moOpenIDVerticalSharingOffset(alignment){
699
- if(alignment == 'left'){
700
- jQuery('.moVerSharingLeftOffset').css('display', 'block');
701
- jQuery('.moVerSharingRightOffset').css('display', 'none');
702
- }else{
703
- jQuery('.moVerSharingLeftOffset').css('display', 'none');
704
- jQuery('.moVerSharingRightOffset').css('display', 'block');
705
- }
706
- }
707
- </script>
708
- <label for="<?php echo $this->get_field_id( 'alignment' ); ?>">Alignment</label>
709
- <select onchange="moOpenIDVerticalSharingOffset(this.value)" style="width: 95%" id="<?php echo $this->get_field_id( 'alignment' ); ?>" name="<?php echo $this->get_field_name( 'alignment' ); ?>">
710
- <option value="left" <?php echo $instance['alignment'] == 'left' ? 'selected' : ''; ?>>Left</option>
711
- <option value="right" <?php echo $instance['alignment'] == 'right' ? 'selected' : ''; ?>>Right</option>
712
- </select>
713
- <div class="moVerSharingLeftOffset" <?php echo $instance['alignment'] == 'right' ? 'style="display: none"' : ''; ?>>
714
- <label for="<?php echo $this->get_field_id( 'left_offset' ); ?>">Left Offset</label>
715
- <input style="width: 95%" id="<?php echo $this->get_field_id( 'left_offset' ); ?>" name="<?php echo $this->get_field_name( 'left_offset' ); ?>" type="text" value="<?php echo $instance['left_offset']; ?>" />px<br/>
716
- </div>
717
- <div class="moVerSharingRightOffset" <?php echo $instance['alignment'] == 'left' ? 'style="display: none"' : ''; ?>>
718
- <label for="<?php echo $this->get_field_id( 'right_offset' ); ?>">Right Offset</label>
719
- <input style="width: 95%" id="<?php echo $this->get_field_id( 'right_offset' ); ?>" name="<?php echo $this->get_field_name( 'right_offset' ); ?>" type="text" value="<?php echo $instance['right_offset']; ?>" />px<br/>
720
- </div>
721
- <label for="<?php echo $this->get_field_id( 'top_offset' ); ?>">Top Offset</label>
722
- <input style="width: 95%" id="<?php echo $this->get_field_id( 'top_offset' ); ?>" name="<?php echo $this->get_field_name( 'top_offset' ); ?>" type="text" value="<?php echo $instance['top_offset']; ?>" />px<br/>
723
- <label for="<?php echo $this->get_field_id( 'space_icons' ); ?>">Space between icons</label>
724
- <input style="width: 95%" id="<?php echo $this->get_field_id( 'space_icons' ); ?>" name="<?php echo $this->get_field_name( 'space_icons' ); ?>" type="text" value="<?php echo $instance['space_icons']; ?>" />px<br/>
725
- </p>
726
- <?php
727
- }
728
- }
729
-
730
- function mo_openid_start_session() {
731
- if( !session_id() ) {
732
- session_start();
733
- }
734
- }
735
 
736
- function mo_openid_end_session() {
737
- if( session_id() ) {
738
- session_destroy();
739
- }
740
  }
741
-
742
- function encrypt_data($data, $key) {
743
-
744
- return base64_encode(openssl_encrypt($data, 'aes-128-ecb', $key, OPENSSL_RAW_DATA));
745
-
746
- }
747
-
748
- function decrypt_data($data, $key) {
749
-
750
- return openssl_decrypt( base64_decode($data), 'aes-128-ecb', $key, OPENSSL_RAW_DATA);
751
-
752
- }
753
 
754
- function mo_openid_login_validate()
755
- {
756
- if( isset( $_REQUEST['option'] ) and strpos( $_REQUEST['option'], 'getmosociallogin' ) !== false ){
757
- $client_name = "wordpress";
758
- $timestamp = round( microtime(true) * 1000 );
759
- $api_key = get_option('mo_openid_admin_api_key');
760
- $token = $client_name . ':' . number_format($timestamp, 0, '', ''). ':' . $api_key;
761
 
762
- $customer_token = get_option('mo_openid_customer_token');
763
- $encrypted_token = encrypt_data($token,$customer_token);
764
- $encoded_token = urlencode( $encrypted_token );
765
- $userdata = get_option('moopenid_user_attributes')?'true':'false';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766
 
767
- $http = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? "https://" : "http://";
768
-
769
- $parts = parse_url($http . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
770
- parse_str($parts['query'], $query);
771
- $post = isset( $query['p'] ) ? '?p=' . $query['p'] : '';
772
 
773
- $base_return_url = $http . $_SERVER["HTTP_HOST"] . strtok($_SERVER["REQUEST_URI"],'?') . $post;
774
 
775
- $return_url = strpos($base_return_url, '?') !== false ? urlencode( $base_return_url . '&option=moopenid' ): urlencode( $base_return_url . '?option=moopenid' );
 
776
 
777
- $url = get_option('mo_openid_host_name') . '/moas/openid-connect/client-app/authenticate?token=' . $encoded_token . '&userdata=' . $userdata. '&id=' . get_option('mo_openid_admin_customer_key') . '&encrypted=true&app=' . $_REQUEST['app_name'] . '_oauth&returnurl=' . $return_url . '&encrypt_response=true';
778
- wp_redirect( $url );
779
- exit;
 
 
 
 
 
 
 
780
  }
781
-
782
- if( isset( $_POST['username_field']) and isset($_POST['email_field']) and $_POST['option'] == 'mo_openid_profile_form_submitted' ){
783
-
784
- $username = $_POST['username_field'];
785
- $user_email = $_POST['email_field'];
786
- $user_picture = $_POST["user_picture"];
787
- $user_url = $_POST["user_url"];
788
- $last_name = $_POST["last_name"];
789
- $user_full_name = $_POST["user_full_name"];
790
- $first_name = $_POST["first_name"];
791
- $decrypted_app_name = $_POST["decrypted_app_name"];
792
- $decrypted_user_id = $_POST["decrypted_user_id"];
793
-
794
- if(!isset($_POST['otp_field'])) {
795
- $user_email = sanitize_email($user_email);
796
- $username = preg_replace('/[\x00-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0\xAD]/', '', $username);
797
- $username = strtolower(str_replace(" ","",$username));
798
 
799
- $path = site_url();
800
- $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
801
-
802
- global $wpdb;
803
- $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = %s", $user_email));
804
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
805
-
806
- //if email exists, dont check if username is in db or not, send otp and get it over wordpress
807
- if( isset($email_user_id)){
808
-
809
- $send_content = send_otp_token($user_email);
810
- if($send_content['status']=='FAILURE'){
811
- $message = 'Either your SMTP is not configured or you have entered an unmailable email. Please go back and try again.';
812
- wp_die($message);
813
- }
814
-
815
- $transaction_id = $send_content['tId'];
816
- echo mo_openid_validate_otp_form($path, $username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id);
817
- exit;
818
-
819
- }
820
- //email doesnt exist, check if username is in db or not, acc show form and proceed further
821
- else {
822
-
823
- if( isset($username_user_id) ){
824
- echo mo_openid_username_already_exists($path, $last_name, $first_name, $user_full_name, $user_url, $user_picture, $username, $user_email, $decrypted_app_name, $decrypted_user_id);
825
- exit;
826
- }
827
- else {
828
-
829
- $send_content = send_otp_token($user_email);
830
- if($send_content['status']=='FAILURE'){
831
- $message = 'Either your SMTP is not configured or you have entered an unmailable email. Please go back and try again.';
832
- wp_die($message);
833
- }
834
-
835
- $transaction_id = $send_content['tId'];
836
- echo mo_openid_validate_otp_form($path, $username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id);
837
- exit;
838
- }
839
-
840
- }
841
- }
842
- }
843
-
844
- if( isset( $_POST['otp_field']) and $_POST['option'] == 'mo_openid_otp_validation' ){
845
-
846
- $username = $_POST["username_field"];
847
- $user_email = $_POST["email_field"];
848
- $transaction_id = $_POST["transaction_id"];
849
- $otp_token = $_POST['otp_field'];
850
-
851
- $user_picture = $_POST["user_picture"];
852
- $user_url = $_POST["user_url"];
853
- $last_name = $_POST["last_name"];
854
- $user_full_name = $_POST["user_full_name"];
855
- $first_name = $_POST["first_name"];
856
- $decrypted_app_name = $_POST["decrypted_app_name"];
857
- $decrypted_user_id = $_POST["decrypted_user_id"];
858
-
859
- $validate_content = validate_otp_token($transaction_id, $otp_token);
860
- $status = $validate_content['status'];
861
-
862
- $path = site_url();
863
- $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
864
-
865
- if($status == 'FAILURE'){
866
- echo mo_openid_invalid_otp_form($path, $first_name, $last_name, $user_full_name, $user_url, $user_picture, $decrypted_app_name, $decrypted_user_id, $username,$user_email, $transaction_id);exit;
867
- }
868
- else{
869
-
870
- global $wpdb;
871
- $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = %s", $user_email));
872
-
873
- // if user exists log him in
874
- if(isset($email_user_id))
875
- {
876
- $user = get_user_by('id', $email_user_id );
877
- if(get_option('moopenid_social_login_avatar') && isset($user_picture))
878
- update_user_meta($email_user_id, 'moopenid_user_avatar', $user_picture);
879
- $_SESSION['mo_login'] = true;
880
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
881
- do_action( 'wp_login', $user->user_login, $user );
882
- wp_set_auth_cookie( $email_user_id, true );
883
- }
884
- // else register him
885
- else{
886
-
887
- //check if auto-registration is enabled
888
- if(get_option('mo_openid_auto_register_enable')) {
889
-
890
- $random_password = wp_generate_password( 10, false );
891
- $userdata = array(
892
- 'user_login' => $username,
893
- 'user_email' => $user_email,
894
- 'user_pass' => $random_password,
895
- 'display_name' => $user_full_name,
896
- 'first_name' => $first_name,
897
- 'last_name' => $last_name,
898
- 'user_url' => $user_url,
899
- );
900
-
901
- $user_id = wp_insert_user( $userdata);
902
- if(is_wp_error( $user_id )) {
903
- wp_die('There was an error in registration. Please contact your administrator.');
904
- }
905
-
906
- // run the query to add provider and identifier for the user
907
- $table_name = $wpdb->prefix . 'users';
908
-
909
- $provider_column = 'provider';
910
- $identifier_column = 'identifier';
911
-
912
- $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = ".$table_name." AND column_name = ".$provider_column);
913
- if(empty($row)){
914
- $wpdb->query("ALTER TABLE ".$table_name." ADD ".$provider_column." VARCHAR(20) NOT NULL ");
915
- }
916
-
917
- $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = ".$table_name." AND column_name = ".$identifier_column);
918
- if(empty($row)){
919
- $wpdb->query("ALTER TABLE ".$table_name." ADD ".$identifier_column." VARCHAR(100) NOT NULL ");
920
- }
921
-
922
- $result = $wpdb->update(
923
- $table_name,
924
- array(
925
- 'provider' => $decrypted_app_name, // string
926
- 'identifier' => $decrypted_user_id // string
927
- ),
928
- array( 'ID' => $user_id ),
929
- array(
930
- '%s', // value1
931
- '%s' // value2
932
- ),
933
- array( '%d' )
934
- );
935
-
936
- if($result === false)
937
- {
938
- //$wpdb->show_errors();
939
- //$wpdb->print_error();
940
- //exit;
941
- wp_die('Error in update query');
942
- }
943
-
944
- $user = get_user_by('email', $user_email );
945
- if(get_option('mo_openid_login_role_mapping') && mo_openid_is_customer_valid()){
946
- $user->set_role( get_option('mo_openid_login_role_mapping') );
947
- }
948
- //Add meta if username in other language
949
- if(!empty($original_username)) {
950
- update_user_meta($user_id, 'moopenid_original_username', $original_username);
951
- }
952
- //Add meta if email in other language
953
- if(!empty($original_email)) {
954
- update_user_meta($user_id, 'moopenid_original_email', $original_email);
955
- }
956
- if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
957
- update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
958
- }
959
- $_SESSION['mo_login'] = true;
960
- do_action( 'mo_user_register', $user_id);
961
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
962
- do_action( 'wp_login', $user->user_login, $user );
963
- wp_set_auth_cookie( $user_id, true );
964
- }
965
- $redirect_url = mo_openid_get_redirect_url();
966
- wp_redirect($redirect_url);
967
- exit;
968
- }
969
- }
970
- }
971
 
972
- if( isset( $_REQUEST['option'] ) and strpos( $_REQUEST['option'], 'moopenid' ) !== false ){
973
- //Decrypt all entries
974
- $decrypted_email = isset($_POST['email']) ? mo_openid_decrypt_sanitize($_POST['email']): '';
975
- $decrypted_user_name = isset($_POST['username']) ? mo_openid_decrypt_sanitize($_POST['username']): '';
976
- $decrypted_user_picture = isset($_POST['profilePic']) ? mo_openid_decrypt_sanitize($_POST['profilePic']): '';
977
- $decrypted_user_url = isset($_POST['profileUrl']) ? mo_openid_decrypt_sanitize($_POST['profileUrl']): '';
978
- $decrypted_user_url = urldecode($decrypted_user_url);
979
- $decrypted_first_name = isset($_POST['firstName']) ? mo_openid_decrypt_sanitize($_POST['firstName']): '';
980
- $decrypted_last_name = isset($_POST['lastName']) ? mo_openid_decrypt_sanitize($_POST['lastName']): '';
981
- $decrypted_app_name = isset($_POST['appName']) ? mo_openid_decrypt_sanitize($_POST['appName']): '';
982
- $decrypted_user_id = isset($_POST['userid']) ? mo_openid_decrypt_sanitize($_POST['userid']): '';
983
-
984
- //echo('email: '.$decrypted_email.' user_name'.$decrypted_user_name);exit;
985
-
986
- //check to ensure login starts at the click of social login button
987
- if(empty($decrypted_app_name)){
988
- wp_die('There was an error during login. Please try to login/register manually.<a href='.site_url().'> Back</a>');
989
- }
990
-
991
- if(isset( $_POST['firstName'] ) && isset( $_POST['lastName'] )){
992
- if(strcmp($decrypted_first_name, $decrypted_last_name)!=0)
993
- $user_full_name = $decrypted_first_name.' '.$decrypted_last_name;
994
- else
995
- $user_full_name = $decrypted_first_name;
996
- $first_name = $decrypted_first_name;
997
- $last_name = $decrypted_last_name;
998
- }
999
- else{
1000
- $user_full_name = $decrypted_user_name;
1001
- $first_name = '';
1002
- $last_name = '';
1003
  }
1004
- //Set Display Picture
1005
- $user_picture = $decrypted_user_picture;
1006
-
1007
- //Set User URL
1008
- $user_url = $decrypted_user_url;
1009
 
1010
- //if email or username not returned from app
1011
- if ( empty($decrypted_email) || empty($decrypted_user_name) )
1012
- {
1013
-
1014
- if( empty($decrypted_app_name) || empty($decrypted_user_id)){
1015
- wp_die('There was an error during login. Please try to login manually.');
1016
- }
1017
- else
1018
- {
1019
- //check if provider + identifier group exists
1020
- global $wpdb;
1021
- $id_returning_user = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where provider = %s AND identifier = %s",$decrypted_app_name,$decrypted_user_id));
1022
-
1023
- mo_openid_start_session();
1024
-
1025
- // if returning user whose appname + identifier exists, log him in
1026
- if(isset($id_returning_user))
1027
- {
1028
- $user = get_user_by('id', $id_returning_user );
1029
- if(get_option('moopenid_social_login_avatar') && isset($user_picture))
1030
- update_user_meta($id_returning_user, 'moopenid_user_avatar', $user_picture);
1031
- $_SESSION['mo_login'] = true;
1032
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1033
- do_action( 'wp_login', $user->user_login, $user );
1034
- wp_set_auth_cookie( $id_returning_user, true );
1035
- }
1036
- // if new user and profile completion is enabled
1037
- elseif (get_option('mo_openid_enable_profile_completion')){
1038
-
1039
- $path = site_url();
1040
- $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
1041
- echo mo_openid_profile_completion_form($path, $last_name, $first_name, $user_full_name, $user_url, $user_picture, $decrypted_user_name, $decrypted_email, $decrypted_app_name, $decrypted_user_id);
1042
- exit;
1043
- }
1044
- // if new user and profile completion is disabled, auto create dummy data and register user
1045
- else
1046
- {
1047
- // auto registration is enabled
1048
- if(get_option('mo_openid_auto_register_enable')) {
1049
-
1050
- if(!empty($decrypted_email))
1051
- {
1052
- $split_email = array();
1053
- $split_email = explode('@',$decrypted_email);
1054
- $username = $split_email[0];
1055
- $user_email = $decrypted_email;
1056
- }
1057
- else if(!empty($decrypted_user_name))
1058
- {
1059
- $split_app_name = array();
1060
- $split_app_name = explode('_',$decrypted_app_name);
1061
- $username = $decrypted_user_name;
1062
- $user_email = $decrypted_user_name.'@'.$split_app_name[0].'.com';
1063
- }
1064
- else
1065
- {
1066
- $split_app_name = array();
1067
- $split_app_name = explode('_',$decrypted_app_name);
1068
- $username = 'user_'.get_option('mo_openid_user_count');
1069
- $user_email = 'user_'.get_option('mo_openid_user_count').'@'.$split_app_name[0].'.com';
1070
- //update_option('mo_openid_user_count',get_option('mo_openid_user_count')+1); update only if user is successfully created
1071
- }
1072
-
1073
-
1074
- $random_password = wp_generate_password( 10, false );
1075
-
1076
- $userdata = array(
1077
- 'user_login' => $username,
1078
- 'user_email' => $user_email,
1079
- 'user_pass' => $random_password,
1080
- 'display_name' => $user_full_name,
1081
- 'first_name' => $first_name,
1082
- 'last_name' => $last_name,
1083
- 'user_url' => $user_url,
1084
- );
1085
-
1086
-
1087
- $user_id = wp_insert_user( $userdata);
1088
-
1089
- if(is_wp_error( $user_id )) {
1090
- //print_r($user_id);
1091
- wp_die('There was an error in registration. Please contact your administrator.');
1092
- }
1093
-
1094
- update_option('mo_openid_user_count',get_option('mo_openid_user_count')+1);
1095
- // run the query to add provider and identifier for the user
1096
- $table_name = $wpdb->prefix . 'users';
1097
-
1098
- $provider_column = 'provider';
1099
- $identifier_column = 'identifier';
1100
-
1101
- $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = ".$table_name." AND column_name = ".$provider_column);
1102
- if(empty($row)){
1103
- $wpdb->query("ALTER TABLE ".$table_name." ADD ".$provider_column." VARCHAR(20) NOT NULL ");
1104
- }
1105
-
1106
- $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = ".$table_name." AND column_name = ".$identifier_column);
1107
- if(empty($row)){
1108
- $wpdb->query("ALTER TABLE ".$table_name." ADD ".$identifier_column." VARCHAR(100) NOT NULL ");
1109
- }
1110
-
1111
- $result = $wpdb->update(
1112
- $table_name,
1113
- array(
1114
- 'provider' => $decrypted_app_name, // string
1115
- 'identifier' => $decrypted_user_id // string
1116
- ),
1117
- array( 'ID' => $user_id ),
1118
- array(
1119
- '%s', // value1
1120
- '%s' // value2
1121
- ),
1122
- array( '%d' )
1123
- );
1124
-
1125
- if($result === false)
1126
- {
1127
- //$wpdb->show_errors();
1128
- //$wpdb->print_error();
1129
- //exit;
1130
- wp_die('Error in update query');
1131
- }
1132
-
1133
- $user = get_user_by('email', $user_email );
1134
- if(get_option('mo_openid_login_role_mapping') && mo_openid_is_customer_valid()){
1135
- $user->set_role( get_option('mo_openid_login_role_mapping') );
1136
- }
1137
- if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1138
- update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1139
- }
1140
- $_SESSION['mo_login'] = true;
1141
-
1142
- //registration hook
1143
- do_action( 'mo_user_register', $user_id);
1144
- //login hook
1145
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1146
- do_action( 'wp_login', $user->user_login, $user );
1147
- wp_set_auth_cookie( $user_id, true );
1148
- }
1149
-
1150
- $redirect_url = mo_openid_get_redirect_url();
1151
- wp_redirect($redirect_url);
1152
- exit;
1153
-
1154
- }
1155
-
1156
- }
1157
-
1158
-
1159
- }
1160
- //email and username are both returned..dont show profile completion
1161
- else{
1162
-
1163
- global $wpdb;
1164
- $user_email = sanitize_email($decrypted_email);
1165
- $username = strtolower(str_replace(" ","",$decrypted_user_name));
1166
-
1167
- //Checking if email or username already exist
1168
- $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = %s", $user_email));
1169
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
1170
-
1171
- mo_openid_start_session();
1172
- if( isset($email_user_id)) { // user is a member
1173
- $user = get_user_by('id', $email_user_id );
1174
- $user_id = $user->ID;
1175
- if(get_option('moopenid_social_login_avatar') && isset($user_picture))
1176
- update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1177
- $_SESSION['mo_login'] = true;
1178
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1179
- do_action( 'wp_login', $user->user_login, $user );
1180
- wp_set_auth_cookie( $user_id, true );
1181
-
1182
- }
1183
- else {
1184
- // this user is a guest
1185
-
1186
- // auto registration is enabled
1187
- if(get_option('mo_openid_auto_register_enable')) {
1188
- $random_password = wp_generate_password( 10, false );
1189
-
1190
- if( isset($username_user_id) ){
1191
- $email = array();
1192
- $email = explode('@', $user_email);
1193
- $username = $email[0];
1194
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
1195
- if( isset($username_user_id) ){
1196
- echo '<br/>This username already exists. Please ask the administrator to create your account with a unique username';
1197
- exit();
1198
- }
1199
- }
1200
-
1201
- $userdata = array(
1202
- 'user_login' => $username,
1203
- 'user_email' => $user_email,
1204
- 'user_pass' => $random_password,
1205
- 'display_name' => $user_full_name,
1206
- 'first_name' => $first_name,
1207
- 'last_name' => $last_name,
1208
- 'user_url' => $user_url,
1209
- );
1210
-
1211
-
1212
- $user_id = wp_insert_user( $userdata);
1213
-
1214
- if(is_wp_error( $user_id )) {
1215
- //print_r($user_id);
1216
- wp_die('There was an error in registration. Please contact your administrator.');
1217
- }
1218
-
1219
- // run the query to add provider and identifier for the user
1220
- $table_name = $wpdb->prefix . 'users';
1221
-
1222
- $provider_column = 'provider';
1223
- $identifier_column = 'identifier';
1224
-
1225
- $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = ".$table_name." AND column_name = ".$provider_column);
1226
- if(empty($row)){
1227
- $wpdb->query("ALTER TABLE ".$table_name." ADD ".$provider_column." VARCHAR(20) NOT NULL ");
1228
- }
1229
-
1230
- $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = ".$table_name." AND column_name = ".$identifier_column);
1231
- if(empty($row)){
1232
- $wpdb->query("ALTER TABLE ".$table_name." ADD ".$identifier_column." VARCHAR(100) NOT NULL ");
1233
- }
1234
-
1235
- $result = $wpdb->update(
1236
- $table_name,
1237
- array(
1238
- 'provider' => $decrypted_app_name, // string
1239
- 'identifier' => $decrypted_user_id // string
1240
- ),
1241
- array( 'ID' => $user_id ),
1242
- array(
1243
- '%s', // value1
1244
- '%s' // value2
1245
- ),
1246
- array( '%d' )
1247
- );
1248
-
1249
- if($result === false)
1250
- {
1251
- //$wpdb->show_errors();
1252
- //$wpdb->print_error();
1253
- //exit;
1254
- wp_die('Error in update query');
1255
- }
1256
-
1257
- $user = get_user_by('email', $user_email );
1258
- if(get_option('mo_openid_login_role_mapping') && mo_openid_is_customer_valid()){
1259
- $user->set_role( get_option('mo_openid_login_role_mapping') );
1260
- }
1261
- //Add meta if username in other language
1262
- if(!empty($original_username)) {
1263
- update_user_meta($user_id, 'moopenid_original_username', $original_username);
1264
- }
1265
- //Add meta if email in other language
1266
- if(!empty($original_email)) {
1267
- update_user_meta($user_id, 'moopenid_original_email', $original_email);
1268
- }
1269
- if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1270
- update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1271
- }
1272
- $_SESSION['mo_login'] = true;
1273
-
1274
- //registration hook
1275
- do_action( 'mo_user_register', $user_id);
1276
- //login hook
1277
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1278
- do_action( 'wp_login', $user->user_login, $user );
1279
- wp_set_auth_cookie( $user_id, true );
1280
- }
1281
- $redirect_url = mo_openid_get_redirect_url();
1282
- wp_redirect($redirect_url);
1283
- exit;
1284
- }
1285
- }
1286
  }
1287
 
1288
- if( isset( $_REQUEST['autoregister']) and strpos($_REQUEST['autoregister'],'false') !== false ) {
1289
- if(!is_user_logged_in()) {
1290
- mo_openid_disabled_register_message();
 
 
 
 
1291
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1292
  }
1293
- }
1294
-
1295
- function mo_openid_validate_otp_form($path, $username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name ,$first_name, $decrypted_app_name, $decrypted_user_id){
1296
- $html = '<head><link rel="stylesheet" href='.$path.' type="text/css" media="all" /></head>
1297
-
1298
- <body class="login login-action-login wp-core-ui locale-en-us">
1299
- <div style="position:fixed;background:#f1f1f1;"></div>
1300
- <div id="add_field" style="position:fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 1;padding-top:130px;">
1301
- <div style="width: 500px; margin: 30px auto;">
1302
- <form name="f" method="post" action="">
1303
- <div style="background: white;margin-top:-15px;padding: 15px;">
1304
-
1305
- <span style="margin:120px;font-size: 24px;font-family: Arial">Verify your email</span><br>
1306
- <div style="padding: 12px;"></div>
1307
- <div style=" padding: 16px;background-color:rgba(1, 145, 191, 0.117647);color: black;">
1308
- <span style=" margin-left: 15px;color: black;font-weight: bold;float: right;font-size: 22px;line-height: 20px;cursor: pointer;font-family: Arial;transition: 0.3s"></span>We have sent a verification code to given email. Please verify your account with it.</div> <br>
1309
- <p>
1310
- <label for="user_login">Enter your verification code<br/>
1311
- <input type="text" pattern="\d{4,5}" class="input" name="otp_field" value="" size="20" required/></label>
1312
- </p>
1313
- <input type="hidden" name="username_field" value='.$username.'>
1314
- <input type="hidden" name="email_field" value='.$user_email.'>
1315
- <input type="hidden" name="first_name" value='.$first_name.'>
1316
- <input type="hidden" name="last_name" value='.$last_name.'>
1317
- <input type="hidden" name="user_full_name" value='.$user_full_name.'>
1318
- <input type="hidden" name="user_url" value='.$user_url.'>
1319
- <input type="hidden" name="user_picture" value='.$user_picture.'>
1320
- <input type="hidden" name="transaction_id" value='.$transaction_id.'>
1321
- <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
1322
- <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
1323
- <input type="hidden" name="option" value="mo_openid_otp_validation">
1324
- </div>
1325
- <p class="submit">
1326
- <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Submit"/>
1327
- </p>
1328
- </form>
1329
- </div>
1330
- </div>
1331
- </body>';
1332
- return $html;
1333
- }
1334
-
1335
- function mo_openid_username_already_exists($path,$last_name,$first_name,$user_full_name,$user_url,$user_picture,$username,$user_email, $decrypted_app_name, $decrypted_user_id){
1336
- $html = '<style>.form-input-validation.is-error {color: #d94f4f;}</style><head><link rel="stylesheet" href='.$path.' type="text/css" media="all" /></head>
1337
-
1338
- <body class="login login-action-login wp-core-ui locale-en-us">
1339
- <div style="position:fixed;background:#f1f1f1;"></div>
1340
- <div id="add_field" style="position:fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 1;padding-top:130px;">
1341
- <div style="width: 500px; margin: 30px auto;">
1342
- <form name="f" method="post" action="">
1343
- <div style="background: white;margin-top:-15px;padding: 15px;">
1344
-
1345
- <span style="margin:120px;font-size: 24px;font-family: Arial">Profile Completion</span>
1346
- <p>
1347
- <label for="user_login">Username<br/>
1348
- <input type="text" class="input" name="username_field" value='.$username.' size="20" required>
1349
- <span align="center" class="form-input-validation is-error">Entered username already exists. Try some other username.</span>
1350
- </label>
1351
- </p>
1352
- <br>
1353
- <p>
1354
- <label for="user_pass">Email<br />
1355
- <input type="email" name="email_field" class="input" value='.$user_email.' size="20" required></label>
1356
- </p>
1357
- <input type="hidden" name="first_name" value='.$first_name.'>
1358
- <input type="hidden" name="last_name" value='.$last_name.'>
1359
- <input type="hidden" name="user_full_name" value='.$user_full_name.'>
1360
- <input type="hidden" name="user_url" value='.$user_url.'>
1361
- <input type="hidden" name="user_picture" value='.$user_picture.'>
1362
- <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
1363
- <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
1364
- <input type="hidden" name="option" value="mo_openid_profile_form_submitted">
1365
- </div>
1366
- <p class="submit">
1367
- <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Submit"/>
1368
- </p>
1369
- </form>
1370
- </div>
1371
- </div>
1372
- </body>';
1373
- return $html;
1374
-
1375
- }
1376
-
1377
- function mo_openid_profile_completion_form($path,$last_name,$first_name,$user_full_name,$user_url,$user_picture, $decrypted_user_name, $decrypted_email, $decrypted_app_name, $decrypted_user_id){
1378
- $html = ' <style>.form-input-validation.note {color: #d94f4f;}</style>
1379
- <head><link rel="stylesheet" href='.$path.' type="text/css" media="all" /></head>
1380
-
1381
- <body class="login login-action-login wp-core-ui locale-en-us">
1382
- <div style="position:fixed;background:#f1f1f1;"></div>
1383
- <div id="add_field" style="position:fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 1;padding-top:130px;">
1384
- <div style="width: 500px; margin: 30px auto;">
1385
- <form name="f" method="post" action="">
1386
- <div style="background: white;margin-top:-15px;padding: 15px;">
1387
-
1388
- <span style="margin:120px;font-size: 24px;font-family: Arial">Profile Completion</span><br>
1389
- <div style="padding: 12px;"></div>
1390
- <div style=" padding: 16px;background-color:rgba(1, 145, 191, 0.117647);color: black;">
1391
- <span style=" margin-left: 15px;color: black;font-weight: bold;float: right;font-size: 22px;line-height: 20px;cursor: pointer;font-family: Arial;transition: 0.3s"></span>If you are an existing user on this site, enter your registered email and username. If you are a new user, please edit/fill the details</div> <br>
1392
- <p>
1393
- <label for="user_login">Username<br/>
1394
- <input type="text" class="input" name="username_field" size="20" required value='.$decrypted_user_name.'></label>
1395
- </p>
1396
- <p>
1397
- <label for="user_pass">Email<br />
1398
- <input type="email" class="input" name="email_field" size="20" required value='.$decrypted_email.'></label>
1399
- <span align="center" class="form-input-validation note">We will be sending a verification code to this email to verify it. Please enter a valid email address.</span>
1400
- </p>
1401
- <input type="hidden" name="first_name" value='.$first_name.'>
1402
- <input type="hidden" name="last_name" value='.$last_name.'>
1403
- <input type="hidden" name="user_full_name" value='.$user_full_name.'>
1404
- <input type="hidden" name="user_url" value='.$user_url.'>
1405
- <input type="hidden" name="user_picture" value='.$user_picture.'>
1406
- <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
1407
- <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
1408
- <input type="hidden" name="option" value="mo_openid_profile_form_submitted">
1409
- </div>
1410
- <p class="submit">
1411
- <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Submit"/>
1412
- </p>
1413
- </form>
1414
- </div>
1415
- </div>
1416
- </body>';
1417
- return $html;
1418
- }
1419
 
1420
- function mo_openid_invalid_otp_form($path, $first_name, $last_name, $user_full_name, $user_url, $user_picture, $decrypted_app_name, $decrypted_user_id, $username,$user_email, $transaction_id){
1421
- $html = '<style>.form-input-validation.is-error {color: #d94f4f;}</style>
1422
- <head><link rel="stylesheet" href='.$path.' type="text/css" media="all" /></head>
1423
-
1424
- <body class="login login-action-login wp-core-ui locale-en-us">
1425
- <div style="position:fixed;background:#f1f1f1;"></div>
1426
- <div id="add_field" style="position:fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 1;padding-top:130px;">
1427
- <div style="width: 500px; margin: 30px auto;">
1428
- <form name="f" method="post" action="">
1429
- <div style="background: white;margin-top:-15px;padding: 15px;">
1430
-
1431
- <span style="margin:120px;font-size: 24px;font-family: Arial">Verify your email</span>
1432
-
1433
- <p>
1434
- <label for="user_login">Enter verification code<br/>
1435
- <input type="text" pattern="\d{4,5}" class="input" name="otp_field" value="" size="20" required></label>
1436
- <span align="center" class="form-input-validation is-error">You have entered an invalid verification code. Enter a valid code.</span>
1437
- </p>
1438
-
1439
- <input type="hidden" name="first_name" value='.$first_name.'>
1440
- <input type="hidden" name="last_name" value='.$last_name.'>
1441
- <input type="hidden" name="user_full_name" value='.$user_full_name.'>
1442
- <input type="hidden" name="user_url" value='.$user_url.'>
1443
- <input type="hidden" name="user_picture" value='.$user_picture.'>
1444
- <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
1445
- <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
1446
- <input type="hidden" name="username_field" value='.$username.'>
1447
- <input type="hidden" name="email_field" value='.$user_email.'>
1448
- <input type="hidden" name="transaction_id" value='.$transaction_id.'>
1449
- <input type="hidden" name="option" value="mo_openid_otp_validation">
1450
- </div>
1451
- <p class="submit">
1452
- <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Submit"/>
1453
- </p>
1454
- </form>
1455
- </div>
1456
- </div>
1457
- </body>';
1458
- return $html;
1459
- }
1460
-
1461
- function mo_openid_decrypt_sanitize($param) {
1462
- if(strcmp($param,'null')!=0 && strcmp($param,'')!=0){
1463
- $customer_token = get_option('mo_openid_customer_token');
1464
- $decrypted_token = decrypt_data($param,$customer_token);
1465
- // removes control characters and some blank characters
1466
- $decrypted_token_sanitise = preg_replace('/[\x00-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0\xAD]/', '', $decrypted_token);
1467
- //strips space,tab,newline,carriage return,NUL-byte,vertical tab.
1468
- return trim($decrypted_token_sanitise);
1469
- }else{
1470
- return '';
1471
- }
1472
  }
1473
-
1474
- function mo_openid_disabled_register_message() {
1475
- $message = get_option('mo_openid_register_disabled_message').' Go to <a href="' . site_url() .'">Home Page</a>';
1476
- wp_die($message);
1477
- }
1478
-
1479
- function mo_openid_get_redirect_url() {
1480
- $option = get_option( 'mo_openid_login_redirect' );
1481
- $redirect_url = site_url();
1482
- if( $option == 'same' ) {
1483
- if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
1484
- $http = "https://";
1485
- } else {
1486
- $http = "http://";
1487
- }
1488
- $redirect_url = urldecode(html_entity_decode(esc_url($http . $_SERVER["HTTP_HOST"] . str_replace('option=moopenid','',$_SERVER['REQUEST_URI']))));
1489
- if(html_entity_decode(esc_url(remove_query_arg('ss_message', $redirect_url))) == wp_login_url() || strpos($_SERVER['REQUEST_URI'],'wp-login.php') !== FALSE || strpos($_SERVER['REQUEST_URI'],'wp-admin') !== FALSE){
1490
- $redirect_url = site_url().'/';
1491
- }
1492
- } else if( $option == 'homepage' ) {
1493
- $redirect_url = site_url();
1494
- } else if( $option == 'dashboard' ) {
1495
- $redirect_url = admin_url();
1496
- } else if( $option == 'custom' ) {
1497
- $redirect_url = get_option('mo_openid_login_redirect_url');
1498
- }
1499
- if(strpos($redirect_url,'?') !== FALSE) {
1500
- $redirect_url .= get_option('mo_openid_auto_register_enable') ? '' : '&autoregister=false';
1501
- } else{
1502
- $redirect_url .= get_option('mo_openid_auto_register_enable') ? '' : '?autoregister=false';
1503
- }
1504
- return $redirect_url;
1505
- }
1506
-
1507
- function mo_openid_redirect_after_logout($logout_url) {
1508
- if(get_option('mo_openid_logout_redirection_enable')){
1509
- $option = get_option( 'mo_openid_logout_redirect' );
1510
- $redirect_url = site_url();
1511
- if( $option == 'homepage' ) {
1512
- $redirect_url = $logout_url . '&redirect_to=' .home_url() ;
1513
- }
1514
- else if($option == 'currentpage'){
1515
- if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
1516
- $http = "https://";
1517
- } else {
1518
- $http = "http://";
1519
- }
1520
- $redirect_url = $logout_url . '&redirect_to=' . $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
1521
- }
1522
- else if($option == 'login') {
1523
- $redirect_url = $logout_url . '&redirect_to=' . site_url() . '/wp-admin' ;
1524
- }
1525
- else if($option == 'custom') {
1526
- $redirect_url = $logout_url . '&redirect_to=' . site_url() . (null !== get_option('mo_openid_logout_redirect_url')?get_option('mo_openid_logout_redirect_url'):'');
1527
- }
1528
- return $redirect_url;
1529
- }else{
1530
- return $logout_url;
1531
- }
1532
-
1533
- }
1534
-
1535
- function mo_openid_login_redirect($username = '', $user = NULL){
1536
- mo_openid_start_session();
1537
- if(is_string($username) && $username && is_object($user) && !empty($user->ID) && ($user_id = $user->ID) && isset($_SESSION['mo_login']) && $_SESSION['mo_login']){
1538
- $_SESSION['mo_login'] = false;
1539
- wp_set_auth_cookie( $user_id, true );
1540
- $redirect_url = mo_openid_get_redirect_url();
1541
- wp_redirect($redirect_url);
1542
- exit;
1543
- }
1544
- }
1545
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1546
  function send_otp_token($email){
1547
- $otp = wp_rand(1000,99999);
1548
- $customerKey = get_option('mo_openid_admin_customer_key');
1549
- $stringToHash = $customerKey . $otp;
1550
- $transactionId = hash("sha512", $stringToHash);
1551
  //wp_email function will come here
1552
- $subject='Verification code validation link';
1553
- $message='Dear User,
1554
 
1555
  Your verification code for completing your profile is: '.$otp.'
1556
 
1557
  Please use this code to complete your profile. Do not share this code with anyone.
1558
 
1559
  Thank you.';
1560
-
1561
- $response = wp_mail($email, $subject, $message);
1562
- if($response){
1563
- mo_openid_start_session();
1564
- $_SESSION['mo_otptoken'] = true;
1565
- $_SESSION['sent_on'] = time();
1566
- $content = array('status' => 'SUCCESS','tId' => $transactionId);
1567
- }
1568
- else
1569
- $content = array('status' => 'FAILURE');
1570
- return $content;
1571
- }
1572
-
1573
  function validate_otp_token($transactionId,$otpToken){
1574
- mo_openid_start_session();
1575
- $customerKey = get_option('mo_openid_admin_customer_key');
1576
- if($_SESSION['mo_otptoken']){
1577
- $pass = checkTimeStamp($_SESSION['sent_on'],time());
1578
- $pass = checkTransactionId($customerKey, $otpToken, $transactionId, $pass);
1579
- if($pass)
1580
- $content = array('status' => 'SUCCESS');
 
 
 
 
1581
  else
1582
- $content = array('status' => 'FAILURE');
1583
- unset($_SESSION['$mo_otptoken']);
 
1584
  }
1585
- else
1586
- $content = array('status' =>'FAILURE');
1587
-
1588
- return $content;
1589
- }
1590
-
1591
- /*
1592
- * This function checks the time otp was sent to and the time
1593
- * user is validating the otp. The time difference shouldn't be
1594
- * more that 60 seconds.
1595
- *
1596
- * @param $sentTime - the time otp was sent to
1597
- * @param $validatedTime - the time otp was validated
1598
- */
1599
  function checkTimeStamp($sentTime,$validatedTime){
1600
  $from_time = strtotime($sentTime);
1601
  $to_time = strtotime($validatedTime);
@@ -1605,8 +2551,8 @@ Thank you.';
1605
  else
1606
  return true;
1607
  }
1608
-
1609
- /**
1610
  * This function checks and compares the transaction set in session
1611
  * and one generated during validation. Both need to match for the
1612
  * otp to be validated.
@@ -1616,103 +2562,152 @@ Thank you.';
1616
  * @param $transactionId - the transaction id in session
1617
  * @param $pass - the boolean value passed after the time check
1618
  */
1619
- function checkTransactionId($customerKey,$otpToken,$transactionId,$pass){
1620
- if(!$pass){
1621
- return false;
1622
- }
1623
- $stringToHash = $customerKey . $otpToken;
1624
- $txtID = hash("sha512", $stringToHash);
1625
- if($txtID == $transactionId)
1626
- return true;
1627
- }
1628
-
1629
- if(get_option('mo_openid_logout_redirection_enable') == 1){
1630
- add_filter( 'logout_url', 'mo_openid_redirect_after_logout',0,1);
1631
- }
1632
-
1633
- add_action( 'widgets_init', create_function( '', 'register_widget( "mo_openid_login_wid" );' ) );
1634
- add_action( 'widgets_init', create_function( '', 'return register_widget( "mo_openid_sharing_ver_wid" );' ) );
1635
- add_action( 'widgets_init', create_function( '', 'return register_widget( "mo_openid_sharing_hor_wid" );' ) );
1636
-
1637
- add_action( 'init', 'mo_openid_login_validate' );
1638
- //add_action( 'init', 'mo_openid_start_session' );
1639
- //add_action( 'wp_logout', 'mo_openid_end_session' );
1640
- add_action( 'wp_login', 'mo_openid_login_redirect', 9, 2);
1641
- add_filter('sanitize_user', 'mo_openid_sanitize_user', 10, 3);
1642
- remove_filter('sanitize_title','sanitize_title_with_dashes', 10);
1643
- add_filter( 'sanitize_title', 'mo_openid_sanitize_title_with_dashes', 10, 3 );
1644
-
1645
- function mo_openid_sanitize_user($username, $raw_username, $strict) {
1646
-
1647
- $username = wp_strip_all_tags( $raw_username );
1648
- $username = remove_accents( $username );
1649
- // Kill octets
1650
- $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
1651
- $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
1652
- // If strict, reduce to ASCII and Cyrillic characters for max portability.
1653
- if ( $strict )
1654
- $username = preg_replace( '|[^a-zあ-ん\p{Han}а-я0-9ㅂㅈㄷㄱ쇼ㅕㅑㅐㅔㅁㄴㅇㄹ호ㅓㅏㅣㅋㅌㅊ퓨ㅜㅡㅃㅉㄸㄲ썌ㅖ _.\-@]|iu', '', $username );
1655
- $username = trim( $username );
1656
- // Consolidate contiguous whitespace
1657
- $username = preg_replace( '|\s+|', ' ', $username );
1658
- return $username;
1659
- }
1660
 
1661
- function mo_openid_sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) {
1662
-
1663
- $title = strip_tags($raw_title);
1664
- // Preserve escaped octets.
1665
- $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
1666
- // Remove percent signs that are not part of an octet.
1667
- $title = str_replace('%', '', $title);
1668
- // Restore octets.
1669
- $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
1670
- if (seems_utf8($title)) {
1671
- if (function_exists('mb_strtolower')) {
1672
- $title = mb_strtolower($title, 'UTF-8');
1673
  }
 
 
 
 
1674
  }
1675
 
1676
- $title = strtolower($title);
1677
-
1678
- if ( 'save' == $context ) {
1679
- // Convert nbsp, ndash and mdash to hyphens
1680
- $title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );
1681
- // Convert nbsp, ndash and mdash HTML entities to hyphens
1682
- $title = str_replace( array( '&nbsp;', '&#160;', '&ndash;', '&#8211;', '&mdash;', '&#8212;' ), '-', $title );
1683
- // Convert forward slash to hyphen
1684
- $title = str_replace( '/', '-', $title );
1685
-
1686
- // Strip these characters entirely
1687
- $title = str_replace( array(
1688
- // iexcl and iquest
1689
- '%c2%a1', '%c2%bf',
1690
- // angle quotes
1691
- '%c2%ab', '%c2%bb', '%e2%80%b9', '%e2%80%ba',
1692
- // curly quotes
1693
- '%e2%80%98', '%e2%80%99', '%e2%80%9c', '%e2%80%9d',
1694
- '%e2%80%9a', '%e2%80%9b', '%e2%80%9e', '%e2%80%9f',
1695
- // copy, reg, deg, hellip and trade
1696
- '%c2%a9', '%c2%ae', '%c2%b0', '%e2%80%a6', '%e2%84%a2',
1697
- // acute accents
1698
- '%c2%b4', '%cb%8a', '%cc%81', '%cd%81',
1699
- // grave accent, macron, caron
1700
- '%cc%80', '%cc%84', '%cc%8c',
1701
- ), '', $title );
1702
- // Convert times to x
1703
- $title = str_replace( '%c3%97', 'x', $title );
1704
  }
 
 
1705
 
1706
- $title = preg_replace('/&.+?;/', '', $title); // kill entities
1707
- $title = str_replace('.', '-', $title);
1708
-
1709
- //$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
1710
- $title = preg_replace( '|[^a-zあ-ん\p{Han}а-я0-9ㅂㅈㄷㄱ쇼ㅕㅑㅐㅔㅁㄴㅇㄹ호ㅓㅏㅣㅋㅌㅊ퓨ㅜㅡㅃㅉㄸㄲ썌ㅖ _.\-@]|iu', '', $title );
1711
- $title = preg_replace('/\s+/', '-', $title);
1712
- $title = preg_replace('|-+|', '-', $title);
1713
- $title = trim($title, '-');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1714
 
1715
- return $title;
 
1716
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1717
  }
1718
  ?>
1
  <?php
2
+ include "twitter_oauth.php";
3
+
4
  if(mo_openid_is_customer_registered()) {
5
+ /*
6
+ * Login Widget
7
+ *
8
+ */
9
+ class mo_openid_login_wid extends WP_Widget {
10
+
11
+ public function __construct() {
12
+ parent::__construct(
13
+ 'mo_openid_login_wid',
14
+ 'miniOrange Social Login Widget',
15
+ array(
16
+ 'description' => __( 'Login using Social Apps like Google, Facebook, LinkedIn, Microsoft, Instagram.', 'flw' ),
17
+ 'customize_selective_refresh' => true,
18
+ )
19
+ );
20
+ }
21
+
22
+ public function widget( $args, $instance ) {
23
+ extract( $args );
24
+
25
+ echo $args['before_widget'];
26
+ $this->openidloginForm();
27
+
28
+ echo $args['after_widget'];
29
+ }
 
30
 
31
+ public function update( $new_instance, $old_instance ) {
32
+ $instance = array();
33
+ $instance['wid_title'] = strip_tags( $new_instance['wid_title'] );
34
+ return $instance;
35
+ }
36
 
37
+ public function openidloginForm(){
38
+
39
+ global $post;
40
+ $selected_theme = get_option('mo_openid_login_theme');
41
+ $appsConfigured = get_option('mo_openid_google_enable') | get_option('mo_openid_salesforce_enable') | get_option('mo_openid_facebook_enable') | get_option('mo_openid_linkedin_enable') | get_option('mo_openid_instagram_enable') | get_option('mo_openid_amazon_enable') | get_option('mo_openid_windowslive_enable') | get_option('mo_openid_twitter_enable') | get_option('mo_openid_vkontakte_enable');
42
+ $spacebetweenicons = get_option('mo_login_icon_space');
43
+ $customWidth = get_option('mo_login_icon_custom_width');
44
+ $customHeight = get_option('mo_login_icon_custom_height');
45
+ $customSize = get_option('mo_login_icon_custom_size');
46
+ $customBackground = get_option('mo_login_icon_custom_color');
47
+ $customTheme = get_option('mo_openid_login_custom_theme');
48
+ $customTextofTitle = get_option('mo_openid_login_button_customize_text');
49
+ $customBoundary = get_option('mo_login_icon_custom_boundary');
50
+ $customLogoutName = get_option('mo_openid_login_widget_customize_logout_name_text');
51
+ $customLogoutLink = get_option('mo_openid_login_widget_customize_logout_text');
52
+ $customTextColor=get_option('mo_login_openid_login_widget_customize_textcolor');
53
+ $customText=get_option('mo_openid_login_widget_customize_text');
54
+
55
+ $facebook_custom_app = $this->if_custom_app_exists('facebook');
56
+ $google_custom_app = $this->if_custom_app_exists('google');
57
+ $twitter_custom_app = $this->if_custom_app_exists('twitter');
58
+ $salesforce_custom_app = $this->if_custom_app_exists('salesforce');
59
+ $linkedin_custom_app = $this->if_custom_app_exists('linkedin');
60
+ $windowslive_custom_app = $this->if_custom_app_exists('windowslive');
61
+ $vkontakte_custom_app = $this->if_custom_app_exists('vkontakte');
62
+ $amazon_custom_app = $this->if_custom_app_exists('amazon');
63
+ $instagram_custom_app = $this->if_custom_app_exists('instagram');
64
+
65
+ if( ! is_user_logged_in() ) {
66
 
67
+ if( $appsConfigured ) {
68
+ $this->mo_openid_load_login_script();
69
+ ?>
70
+
71
+ <div class="mo-openid-app-icons">
72
 
73
+ <p style="color:#<?php echo $customTextColor ?>"><?php echo $customText ?>
74
+ </p>
75
+ <?php
76
+ if($customTheme == 'default'){
77
+ if( get_option('mo_openid_facebook_enable') ) {
78
+ if($selected_theme == 'longbutton'){
79
+ ?>
80
+
81
+ <a rel='nofollow' onClick="moOpenIdLogin('facebook','<?php echo $facebook_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-facebook btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-facebook"></i><?php
82
+ echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
83
+ <?php
84
+
85
+ }else{ ?>
86
+
87
+ <a rel='nofollow' title="<?php echo $customTextofTitle ?> Facebook" onClick="moOpenIdLogin('facebook','<?php echo $facebook_custom_app?>');"><img alt='Facebook' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/facebook.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button" ></a>
88
+
89
+ <?php }
90
 
91
+ }
92
+ if( get_option('mo_openid_google_enable') ) {
93
+ if($selected_theme == 'longbutton'){
94
+ ?>
95
+
96
+ <a rel='nofollow' onClick="moOpenIdLogin('google','<?php echo $google_custom_app?>');" style='width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;' class='btn btn-block btn-social btn-google btn-custom-size login-button' > <i style='padding-top:<?php echo $customHeight-35 ?>px !important' class='fa fa-google-plus'></i><?php
97
+ echo get_option('mo_openid_login_button_customize_text'); ?> Google</a>
98
+ <?php }
99
+ else{ ?>
100
+ <a rel='nofollow' onClick="moOpenIdLogin('google','<?php echo $google_custom_app?>');" title="<?php echo $customTextofTitle ?> Google" ><img alt='Google' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/google.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button" ></a>
101
+ <?php
102
+ }
103
+ }
104
 
105
+ if( get_option('mo_openid_vkontakte_enable') ) {
106
+ if($selected_theme == 'longbutton'){
107
+ ?>
108
+
109
+ <a rel='nofollow' onClick="moOpenIdLogin('vkontakte','<?php echo $vkontakte_custom_app?>');" style='width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;' class='btn btn-block btn-social btn-vk btn-custom-size login-button' > <i style='padding-top:<?php echo $customHeight-35 ?>px !important' class='fa fa-vk'></i><?php
110
+ echo get_option('mo_openid_login_button_customize_text'); ?> Vkontakte</a>
111
+ <?php }
112
+ else{ ?>
113
+ <a rel='nofollow' onClick="moOpenIdLogin('vkontakte','<?php echo $vkontakte_custom_app?>');" title="<?php echo $customTextofTitle ?> Vkontakte" ><img alt='Vkontakte' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/vk.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button" ></a>
114
+ <?php
115
+ }
116
+ }
 
117
 
 
 
 
118
 
119
+ if( get_option('mo_openid_twitter_enable') ) {
120
+ if($selected_theme == 'longbutton'){
121
+ ?> <a rel='nofollow' onClick="moOpenIdLogin('twitter','<?php echo $twitter_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-twitter btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-twitter"></i><?php
122
+ echo get_option('mo_openid_login_button_customize_text'); ?> Twitter</a>
123
+ <?php }
124
+ else{ ?>
 
 
125
 
 
 
 
 
 
 
 
126
 
127
+ <a rel='nofollow' title="<?php echo $customTextofTitle ?> Twitter" onClick="moOpenIdLogin('twitter','<?php echo $twitter_custom_app?>');"><img alt='Twitter' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/twitter.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button"></a>
128
+ <?php }
129
+ }
130
+
131
+ if( get_option('mo_openid_linkedin_enable') ) {
132
+ if($selected_theme == 'longbutton'){ ?>
133
+ <a rel='nofollow' onClick="moOpenIdLogin('linkedin','<?php echo $linkedin_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-linkedin btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-linkedin"></i><?php
134
+ echo get_option('mo_openid_login_button_customize_text'); ?> LinkedIn</a>
135
+ <?php }
136
+ else{ ?>
137
+ <a rel='nofollow' title="<?php echo $customTextofTitle ?> LinkedIn" onClick="moOpenIdLogin('linkedin','<?php echo $linkedin_custom_app?>');"><img alt='LinkedIn' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/linkedin.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button" ></a>
138
+ <?php }
139
+ }if( get_option('mo_openid_instagram_enable') ) {
140
+ if($selected_theme == 'longbutton'){ ?>
141
+ <a rel='nofollow' onClick="moOpenIdLogin('instagram','<?php echo $instagram_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-instagram btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-instagram"></i><?php
142
+ echo get_option('mo_openid_login_button_customize_text'); ?> Instagram</a>
143
+ <?php }
144
+ else{ ?>
145
+
146
+
147
+ <a rel='nofollow' title="<?php echo $customTextofTitle ?> Instagram" onClick="moOpenIdLogin('instagram','<?php echo $instagram_custom_app?>');"><img alt='Instagram' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/instagram.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button"></a>
148
+ <?php }
149
+ }if( get_option('mo_openid_amazon_enable') ) {
150
+ if($selected_theme == 'longbutton'){
151
+ ?> <a rel='nofollow' onClick="moOpenIdLogin('amazon','<?php echo $amazon_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-soundcloud btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-amazon"></i><?php
152
+ echo get_option('mo_openid_login_button_customize_text'); ?> Amazon</a>
153
+ <?php }
154
+ else{ ?>
155
+
156
+ <a rel='nofollow' title="<?php echo $customTextofTitle ?> Amazon" onClick="moOpenIdLogin('amazon','<?php echo $amazon_custom_app?>');"><img alt='Amazon' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/amazon.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button"></a>
157
+ <?php }
158
+ }if( get_option('mo_openid_salesforce_enable') ) {
159
+ if($selected_theme == 'longbutton'){
160
+ ?> <a rel='nofollow' onClick="moOpenIdLogin('salesforce','<?php echo $salesforce_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-vimeo btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-cloud"></i> <?php
161
+ echo get_option('mo_openid_login_button_customize_text'); ?> Salesforce</a>
162
+ <?php }
163
+ else{ ?>
164
+
165
+
166
+ <a rel='nofollow' title="<?php echo $customTextofTitle ?> Salesforce" onClick="moOpenIdLogin('salesforce','<?php echo $salesforce_custom_app?>');"><img alt='Salesforce' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/salesforce.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button" ></a>
167
+ <?php }
168
+ }if( get_option('mo_openid_windowslive_enable') ) {
169
+ if($selected_theme == 'longbutton'){
170
+ ?> <a rel='nofollow' onClick="moOpenIdLogin('windowslive','<?php echo $windowslive_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-microsoft btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-windows"></i><?php
171
+ echo get_option('mo_openid_login_button_customize_text'); ?> Microsoft</a>
172
+ <?php }
173
+ else{ ?>
174
 
175
+
176
+ <a rel='nofollow' title="<?php echo $customTextofTitle ?> Microsoft" onClick="moOpenIdLogin('windowslive','<?php echo $windowslive_custom_app?>');"><img alt='Windowslive' style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important" src="<?php echo plugins_url( 'includes/images/icons/windowslive.png', __FILE__ )?>" class="<?php echo $selected_theme; ?> login-button"></a>
177
+ <?php }
178
+ }
179
+
180
+ }
181
+ ?>
182
+
183
+
184
+
185
+ <?php
186
+ if($customTheme == 'custom'){
187
+ if( get_option('mo_openid_facebook_enable') ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  if($selected_theme == 'longbutton'){
189
+ ?> <a rel='nofollow' onClick="moOpenIdLogin('facebook','<?php echo $facebook_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-facebook btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-facebook"></i><?php
190
+ echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
191
+ <?php }
192
+ else{ ?>
193
 
194
+ <a rel='nofollow' onClick="moOpenIdLogin('facebook','<?php echo $facebook_custom_app?>');" title="<?php echo $customTextofTitle ?> Facebook"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-facebook custom-login-button <?php echo $selected_theme; ?>" ></i></a>
195
 
196
+ <?php }
 
 
 
 
 
 
 
197
 
198
+ }
199
 
200
+ if( get_option('mo_openid_google_enable') ) {
201
+ if($selected_theme == 'longbutton'){
202
+ ?>
203
+
204
+ <a rel='nofollow' onClick="moOpenIdLogin('google','<?php echo $google_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important; background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-customtheme btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-google-plus"></i><?php
205
+ echo get_option('mo_openid_login_button_customize_text'); ?> Google</a>
206
+ <?php }
207
+ else{ ?>
208
+ <a rel='nofollow' onClick="moOpenIdLogin('google','<?php echo $google_custom_app?>');" title="<?php echo $customTextofTitle ?> Google"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-google-plus custom-login-button <?php echo $selected_theme; ?>" ></i></a>
209
+ <?php
210
+ }
211
+ }
 
 
 
 
 
212
 
213
+ if( get_option('mo_openid_vkontakte_enable') ) {
214
+ if($selected_theme == 'longbutton'){
215
+ ?>
216
+
217
+ <a rel='nofollow' onClick="moOpenIdLogin('vkontakte','<?php echo $vkontakte_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important; background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-customtheme btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-vk"></i><?php
218
+ echo get_option('mo_openid_login_button_customize_text'); ?> Vkontakte</a>
219
+ <?php }
220
+ else{ ?>
221
+ <a rel='nofollow' onClick="moOpenIdLogin('vkontakte','<?php echo $vkontakte_custom_app?>');" title="<?php echo $customTextofTitle ?> Vkontakte"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-vk custom-login-button <?php echo $selected_theme; ?>" ></i></a>
222
+ <?php
223
+ }
224
+ }
225
 
226
+ if( get_option('mo_openid_twitter_enable') ) {
227
+ if($selected_theme == 'longbutton'){
228
+ ?>
229
+
230
+ <a rel='nofollow' onClick="moOpenIdLogin('twitter','<?php echo $twitter_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important; background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-customtheme btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-twitter"></i><?php
231
+ echo get_option('mo_openid_login_button_customize_text'); ?> Twitter</a>
232
+ <?php }
233
+ else{ ?>
234
+ <a rel='nofollow' onClick="moOpenIdLogin('twitter','<?php echo $twitter_custom_app?>');" title="<?php echo $customTextofTitle ?> Twitter"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-twitter custom-login-button <?php echo $selected_theme; ?>" ></i></a>
235
+ <?php
236
+ }
237
+ }
238
+ if( get_option('mo_openid_linkedin_enable') ) {
239
+ if($selected_theme == 'longbutton'){ ?>
240
+ <a rel='nofollow' onClick="moOpenIdLogin('linkedin','<?php echo $linkedin_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-linkedin btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-linkedin"></i><?php
241
+ echo get_option('mo_openid_login_button_customize_text'); ?> LinkedIn</a>
242
+ <?php }
243
+ else{ ?>
244
+ <a rel='nofollow' onClick="moOpenIdLogin('linkedin','<?php echo $linkedin_custom_app?>');" title="<?php echo $customTextofTitle ?> LinkedIn"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-linkedin custom-login-button <?php echo $selected_theme; ?>" ></i></a>
245
+ <?php }
246
+ }if( get_option('mo_openid_instagram_enable') ) {
247
+ if($selected_theme == 'longbutton'){ ?>
248
+ <a rel='nofollow' onClick="moOpenIdLogin('instagram','<?php echo $instagram_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-instagram btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-instagram"></i><?php
249
+ echo get_option('mo_openid_login_button_customize_text'); ?> Instagram</a>
250
+ <?php }
251
+ else{ ?>
252
+
253
+
254
+ <a rel='nofollow' onClick="moOpenIdLogin('instagram','<?php echo $instagram_custom_app?>');" title="<?php echo $customTextofTitle ?> Instagram"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-instagram custom-login-button <?php echo $selected_theme; ?>"></i></a>
255
+ <?php }
256
+ }if( get_option('mo_openid_amazon_enable') ) {
257
+ if($selected_theme == 'longbutton'){
258
+ ?> <a rel='nofollow' onClick="moOpenIdLogin('amazon','<?php echo $amazon_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-linkedin btn-custom-size login-button" ><i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-amazon"></i><?php
259
+ echo get_option('mo_openid_login_button_customize_text'); ?> Amazon</a>
260
+ <?php }
261
+ else{ ?>
262
+
263
+ <a rel='nofollow' onClick="moOpenIdLogin('amazon','<?php echo $amazon_custom_app?>');" title="<?php echo $customTextofTitle ?> Amazon"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class="fa fa-amazon custom-login-button <?php echo $selected_theme; ?>"></i></a>
264
+ <?php }
265
+ }if( get_option('mo_openid_salesforce_enable') ) {
266
+ if($selected_theme == 'longbutton'){
267
+ ?> <a rel='nofollow' onClick="moOpenIdLogin('salesforce','<?php echo $salesforce_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-linkedin btn-custom-size login-button" ><i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-cloud"></i> <?php
268
+ echo get_option('mo_openid_login_button_customize_text'); ?> Salesforce</a>
269
+ <?php }
270
+ else{ ?>
271
+
272
+
273
+ <a rel='nofollow' onClick="moOpenIdLogin('salesforce','<?php echo $salesforce_custom_app?>');" title="<?php echo $customTextofTitle ?> Salesforce"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px " class="fa fa-cloud custom-login-button <?php echo $selected_theme; ?>" ></i></a>
274
+ <?php }
275
+ }if( get_option('mo_openid_windowslive_enable') ) {
276
+ if($selected_theme == 'longbutton'){
277
+ ?> <a rel='nofollow' onClick="moOpenIdLogin('windowslive','<?php echo $windowslive_custom_app?>');" style="width:<?php echo $customWidth ?>px !important;padding-top:<?php echo $customHeight-29 ?>px !important;padding-bottom:<?php echo $customHeight-29 ?>px !important;margin-bottom:<?php echo $spacebetweenicons-5 ?>px !important;background:<?php echo "#".$customBackground?> !important;border-radius:<?php echo $customBoundary ?>px !important;" class="btn btn-block btn-social btn-microsoft btn-custom-size login-button" > <i style="padding-top:<?php echo $customHeight-35 ?>px !important" class="fa fa-windows"></i><?php
278
+ echo get_option('mo_openid_login_button_customize_text'); ?> Microsoft</a>
279
+ <?php }
280
+ else{ ?>
281
 
 
282
 
283
+ <a rel='nofollow' onClick="moOpenIdLogin('windowslive','<?php echo $windowslive_custom_app?>');" title="<?php echo $customTextofTitle ?> Microsoft"><i style="width:<?php echo $customSize?>px !important;height:<?php echo $customSize?>px !important;margin-left:<?php echo $spacebetweenicons-4?>px !important;background:<?php echo "#".$customBackground?> !important;font-size:<?php echo $customSize-16?>px !important;" class=" fa fa-windows custom-login-button <?php echo $selected_theme; ?>"></i></a>
284
+ <?php }
285
+ }
286
 
 
 
 
 
 
 
 
 
 
 
 
 
287
 
288
+ }
289
+ ?>
290
+ <br>
291
+ </div>
292
+ <?php
293
+
294
+
295
+ }
296
+ else {
297
+ ?>
298
+ <div>No apps configured. Please contact your administrator.</div>
299
  <?php
300
  }
301
+ if(get_option('mo_openid_oauth')=='1' && $appsConfigured && get_option('moopenid_logo_check') == 1){
302
+ $logo_html = $this->mo_openid_customize_logo();
303
+ echo $logo_html;
304
  }
 
 
 
305
  ?>
306
+ <br />
307
+ <?php
308
+ }else {
309
+ global $current_user;
310
+ $current_user = wp_get_current_user();
311
+ $customLogoutName = str_replace('##username##', $current_user->display_name, $customLogoutName);
312
+ $link_with_username = $customLogoutName;
313
+ if (empty($customLogoutName) || empty($customLogoutLink)) {
314
+ ?>
315
+ <div id="logged_in_user" class="mo_openid_login_wid">
316
+ <li><?php echo $link_with_username;?> <a href="<?php echo wp_logout_url( site_url() ); ?>" title="<?php _e('Logout','flw');?>"><?php _e($customLogoutLink,'flw');?></a></li>
317
+ </div>
318
  <?php
319
+
320
  }
321
+ else {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  ?>
323
+ <div id="logged_in_user" class="mo_openid_login_wid">
324
+ <li><?php echo $link_with_username;?> <a href="<?php echo wp_logout_url( site_url() ); ?>" title="<?php _e('Logout','flw');?>"><?php _e($customLogoutLink,'flw');?></a></li>
325
+ </div>
326
  <?php
327
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  }
 
 
 
 
 
 
 
329
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
 
331
+ public function mo_openid_customize_logo(){
332
+ $logo =" <div style='float:left;' class='mo_image_id'>
333
+ <a target='_blank' href='https://www.miniorange.com/'>
334
+ <img alt='logo' src='". plugins_url('/includes/images/miniOrange.png',__FILE__) ."' class='mo_openid_image'>
335
+ </a>
336
+ </div>
337
+ <br/>";
338
+ return $logo;
339
+ }
340
+
341
+ public function if_custom_app_exists($app_name){
342
+ if(get_option('mo_openid_apps_list'))
343
+ $appslist = get_option('mo_openid_apps_list');
344
+ else
345
+ $appslist = array();
346
+
347
+ foreach( $appslist as $key => $app){
348
+ if($app_name == $key)
349
+ return 'true';
350
+ }
351
+ return 'false';
352
  }
353
 
354
+ public function openidloginFormShortCode( $atts ){
355
+
356
+ global $post;
357
+ $html = '';
358
+ //$this->error_message();
359
+ $selected_theme = isset( $atts['shape'] )? $atts['shape'] : get_option('mo_openid_login_theme');
360
+ $appsConfigured = get_option('mo_openid_google_enable') | get_option('mo_openid_salesforce_enable') | get_option('mo_openid_facebook_enable') | get_option('mo_openid_linkedin_enable') | get_option('mo_openid_instagram_enable') | get_option('mo_openid_amazon_enable') | get_option('mo_openid_windowslive_enable') |get_option('mo_openid_twitter_enable') | get_option('mo_openid_vkontakte_enable');
361
+ $spacebetweenicons = isset( $atts['space'] )? $atts['space'] : get_option('mo_login_icon_space');
362
+ $customWidth = isset( $atts['width'] )? $atts['width'] : get_option('mo_login_icon_custom_width');
363
+ $customHeight = isset( $atts['height'] )? $atts['height'] : get_option('mo_login_icon_custom_height');
364
+ $customSize = isset( $atts['size'] )? $atts['size'] : get_option('mo_login_icon_custom_size');
365
+ $customBackground = isset( $atts['background'] )? $atts['background'] : get_option('mo_login_icon_custom_color');
366
+ $customTheme = isset( $atts['theme'] )? $atts['theme'] : get_option('mo_openid_login_custom_theme');
367
+ $customText = get_option('mo_openid_login_widget_customize_text');
368
+ $buttonText = get_option('mo_openid_login_button_customize_text');
369
+ $customTextofTitle = get_option('mo_openid_login_button_customize_text');
370
+ $logoutUrl = wp_logout_url( site_url() );
371
+ $customBoundary = isset( $atts['edge'] )? $atts['edge'] : get_option('mo_login_icon_custom_boundary');
372
+ $customLogoutName = get_option('mo_openid_login_widget_customize_logout_name_text');
373
+ $customLogoutLink = get_option('mo_openid_login_widget_customize_logout_text');
374
+ $customTextColor= isset( $atts['color'] )? $atts['color'] : get_option('mo_login_openid_login_widget_customize_textcolor');
375
+ $customText=isset( $atts['heading'] )? $atts['heading'] :get_option('mo_openid_login_widget_customize_text');
376
+
377
+ $facebook_custom_app = $this->if_custom_app_exists('facebook');
378
+ $google_custom_app = $this->if_custom_app_exists('google');
379
+ $twitter_custom_app = $this->if_custom_app_exists('twitter');
380
+ $salesforce_custom_app = $this->if_custom_app_exists('salesforce');
381
+ $linkedin_custom_app = $this->if_custom_app_exists('linkedin');
382
+ $windowslive_custom_app = $this->if_custom_app_exists('windowslive');
383
+ $vkontakte_custom_app = $this->if_custom_app_exists('vkontakte');
384
+ $amazon_custom_app = $this->if_custom_app_exists('amazon');
385
+ $instagram_custom_app = $this->if_custom_app_exists('instagram');
386
+
387
+ if($selected_theme == 'longbuttonwithtext'){
388
+ $selected_theme = 'longbutton';
389
+ }
390
+ if($customTheme == 'custombackground'){
391
+ $customTheme = 'custom';
392
+ }
393
+
394
+ if( ! is_user_logged_in() ) {
395
 
396
+ if( $appsConfigured ) {
397
+ $this->mo_openid_load_login_script();
398
+ $html .= "<div class='mo-openid-app-icons'>
 
 
 
 
 
 
 
 
 
 
399
 
400
+
401
+ <p style='color:#".$customTextColor."'> $customText</p>";
402
 
403
+ if($customTheme == 'default'){
404
+
405
+ if( get_option('mo_openid_facebook_enable') ) {
406
+ if($selected_theme == 'longbutton'){
407
+ $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-facebook btn-custom-dec login-button' onClick=\"moOpenIdLogin('facebook','" .$facebook_custom_app."');\"> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-facebook'></i>" . $buttonText . " Facebook</a>"; }
408
+ else{
409
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Facebook' onClick=\"moOpenIdLogin('facebook','" .$facebook_custom_app."');\" ><img alt='Facebook' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons) ."px !important' src='" . plugins_url( 'includes/images/icons/facebook.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
410
+ }
 
 
411
 
412
+ }
 
 
 
 
 
 
 
 
 
413
 
414
+ if( get_option('mo_openid_google_enable') ) {
415
+ if($selected_theme == 'longbutton'){
416
+ $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary ."px !important;' class='btn btn-block btn-social btn-google btn-custom-dec login-button' onClick=\"moOpenIdLogin('google','".$google_custom_app."');\"> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-google-plus'></i>" . $buttonText . " Google</a>";
417
+ }
418
+ else{
419
+
420
+ $html .= "<a rel='nofollow' onClick=\"moOpenIdLogin('google','".$google_custom_app."');\" title= ' ".$customTextofTitle." Google'><img alt='Google' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons) ."px !important' src='" . plugins_url( 'includes/images/icons/google.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
421
+
422
+ }
423
+ }
424
+
425
+ if( get_option('mo_openid_vkontakte_enable') ) {
426
+ if($selected_theme == 'longbutton'){
427
+ $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary ."px !important;' class='btn btn-block btn-social btn-vk btn-custom-dec login-button' onClick=\"moOpenIdLogin('vkontakte','" .
428
+ $vkontakte_custom_app.
429
+ "');\"> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-vk'></i>" . $buttonText . " Vkontakte</a>";
430
+ }
431
+ else{
432
+
433
+ $html .= "<a rel='nofollow' onClick=\"moOpenIdLogin('vkontakte','" .
434
+ $vkontakte_custom_app.
435
+ "');\" title= ' ".$customTextofTitle." Vkontakte'><img alt='Vkontakte' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons) ."px !important' src='" . plugins_url( 'includes/images/icons/vk.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
436
+
437
+ }
438
+ }
439
 
440
+ if( get_option('mo_openid_twitter_enable') ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
  if($selected_theme == 'longbutton'){
442
+ $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary ."px !important;' class='btn btn-block btn-social btn-twitter btn-custom-dec login-button' onClick=\"moOpenIdLogin('twitter','" .
443
+ $twitter_custom_app.
444
+ "');\"> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-twitter'></i>" . $buttonText . " Twitter</a>"; }
445
+ else{
446
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Twitter' onClick=\"moOpenIdLogin('twitter','" .
447
+ $twitter_custom_app. "');\" ><img alt='Twitter' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons) ."px !important' src='" . plugins_url( 'includes/images/icons/twitter.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
 
 
448
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
 
450
+ }
451
+ if( get_option('mo_openid_linkedin_enable') ) {
452
+ if($selected_theme == 'longbutton'){
453
+ $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-linkedin btn-custom-dec login-button' onClick=\"moOpenIdLogin('linkedin','" .$twitter_custom_app . "');\"> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-linkedin'></i>" . $buttonText . " LinkedIn</a>";
454
+ }
455
+ else{
456
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." LinkedIn' onClick=\"moOpenIdLogin('linkedin','" . $linkedin_custom_app . "');\" ><img alt='LinkedIn' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons) ."px !important' src='" . plugins_url( 'includes/images/icons/linkedin.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
457
+ }
458
+ }if( get_option('mo_openid_instagram_enable') ) {
459
+ if($selected_theme == 'longbutton'){
460
+ $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-instagram btn-custom-dec login-button' onClick=\"moOpenIdLogin('instagram','" . $instagram_custom_app . "');\"> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-instagram'></i>" . $buttonText . " Instagram</a>";
461
+ }
462
+ else{
463
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Instagram' onClick=\"moOpenIdLogin('instagram','" . $instagram_custom_app . "');\" ><img alt='Instagram' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons) ."px !important' src='" . plugins_url( 'includes/images/icons/instagram.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
464
+ }
465
+ }if( get_option('mo_openid_amazon_enable') ) {
466
+ if($selected_theme == 'longbutton'){
467
+ $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-soundcloud btn-custom-dec login-button' onClick=\"moOpenIdLogin('amazon','" . $amazon_custom_app . "');\"> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-amazon'></i>" . $buttonText . " Amazon</a>";
468
+ }
469
+ else{
470
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Amazon' onClick=\"moOpenIdLogin('amazon','" . $amazon_custom_app . "');\" ><img alt='Amazon' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons) ."px !important' src='" . plugins_url( 'includes/images/icons/amazon.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
471
+ }
472
+ }if( get_option('mo_openid_salesforce_enable') ) {
473
+ if($selected_theme == 'longbutton'){
474
+ $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-vimeo btn-custom-dec login-button' onClick=\"moOpenIdLogin('salesforce','" . $salesforce_custom_app . "');\"> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-cloud'></i>" . $buttonText . " Salesforce</a>";
475
+ }
476
+ else{
477
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Salesforce' onClick=\"moOpenIdLogin('salesforce','" . $salesforce_custom_app . "');\" ><img alt='Salesforce' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons) ."px !important' src='" . plugins_url( 'includes/images/icons/salesforce.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
478
+ }
479
+ }if( get_option('mo_openid_windowslive_enable') ) {
480
+ if($selected_theme == 'longbutton'){
481
+ $html .= "<a rel='nofollow' style='width: " . $customWidth . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom: " . ($spacebetweenicons-5) . "px !important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-microsoft btn-custom-dec login-button' onClick=\"moOpenIdLogin('windowslive','" . $windowslive_custom_app . "');\"> <i style='padding-top:" . ($customHeight-35) . "px !important' class='fa fa-windows'></i>" . $buttonText . " Microsoft</a>";
482
+ }
483
+ else{
484
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Microsoft' onClick=\"moOpenIdLogin('windowslive','" . $windowslive_custom_app . "');\" ><img alt='Windowslive' style='width:" . $customSize ."px !important;height: " . $customSize ."px !important;margin-left: " . ($spacebetweenicons) ."px !important' src='" . plugins_url( 'includes/images/icons/windowslive.png', __FILE__ ) . "' class='login-button " .$selected_theme . "' ></a>";
485
+ }
486
+ }
487
+ }
488
+
489
+
490
+
491
+ if($customTheme == 'custom'){
492
+ if( get_option('mo_openid_facebook_enable') ) {
493
+ if($selected_theme == 'longbutton'){
494
+ $html .= "<a rel='nofollow' onClick=\"moOpenIdLogin('facebook','" . $facebook_custom_app . "');\" style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-facebook'></i> " . $buttonText . " Facebook</a>";
495
+ }
496
+ else{
497
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Facebook' onClick=\"moOpenIdLogin('facebook','" . $facebook_custom_app . "');\" ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-facebook custom-login-button " . $selected_theme . "' ></i></a>";
498
+ }
499
 
 
 
 
500
  }
501
+
502
+ if( get_option('mo_openid_google_enable') ) {
503
+ if($selected_theme == 'longbutton'){
504
+ $html .= "<a rel='nofollow' onClick=\"moOpenIdLogin('google','" .$google_custom_app . "');\" style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-google-plus'></i> " . $buttonText . " Google</a>";
505
+ }
506
+ else{
507
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Google' onClick=\"moOpenIdLogin('google','" . $google_custom_app . "');\" title= ' ". $customTextofTitle." Google'><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-google-plus custom-login-button " . $selected_theme . "' ></i></a>";
508
+
509
+ }
510
  }
 
511
 
512
+ if( get_option('mo_openid_vkontakte_enable') ) {
513
+ if($selected_theme == 'longbutton'){
514
+ $html .= "<a rel='nofollow' onClick=\"moOpenIdLogin('vkontakte','" . $vkontakte_custom_app . "');\" style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-vk'></i> " . $buttonText . " Vkontakte</a>";
515
+ }
516
+ else{
517
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Vkontakte' onClick=\"moOpenIdLogin('vkontakte','" . $vkontakte_custom_app. "');\" title= ' ". $customTextofTitle." Vkontakte'><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-vk custom-login-button " . $selected_theme . "' ></i></a>";
518
+
519
+ }
520
  }
521
+
522
+ if( get_option('mo_openid_twitter_enable') ) {
523
+ if($selected_theme == 'longbutton'){
524
+ $html .= "<a rel='nofollow' onClick=\"moOpenIdLogin('twitter','" . $twitter_custom_app . "');\" style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-twitter'></i> " . $buttonText . " Twitter</a>";
525
+ }
526
+ else{
527
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Twitter' onClick=\"moOpenIdLogin('twitter','" . $twitter_custom_app . "');\" ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-twitter custom-login-button " . $selected_theme . "' ></i></a>";
528
  }
 
529
 
530
+ }
531
+ if( get_option('mo_openid_linkedin_enable') ) {
532
+ if($selected_theme == 'longbutton'){
533
+ $html .= "<a rel='nofollow' onClick=\"moOpenIdLogin('linkedin','" . $linkedin . "');\" style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-linkedin'></i> " . $buttonText . " LinkedIn</a>";
534
+ }
535
+ else{
536
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." LinkedIn' onClick=\"moOpenIdLogin('linkedin','" . $linkedin_custom_app . "');\" ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-linkedin custom-login-button " . $selected_theme . "' ></i></a>";
537
+ }
538
+ }if( get_option('mo_openid_instagram_enable') ) {
539
+ if($selected_theme == 'longbutton'){
540
+ $html .= "<a rel='nofollow' onClick=\"moOpenIdLogin('instagram','" . $instagram_custom_app . "');\" style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-instagram'></i> " . $buttonText . " Instagram</a>";
541
+ }
542
+ else{
543
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Instagram' onClick=\"moOpenIdLogin('instagram','" . $instagram_custom_app . "');\" ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-instagram custom-login-button " . $selected_theme . "' ></i></a>";
544
+ }
545
+ }if( get_option('mo_openid_amazon_enable') ) {
546
+ if($selected_theme == 'longbutton'){
547
+ $html .= "<a rel='nofollow' onClick=\"moOpenIdLogin('amazon','" . $amazon_custom_app . "');\" style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-amazon'></i> " . $buttonText . " Amazon</a>";
548
+ }
549
+ else{
550
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Amazon' onClick=\"moOpenIdLogin('amazon','" . $amazon_custom_app . "');\" ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-amazon custom-login-button " . $selected_theme . "' ></i></a>";
551
+ }
552
+ }if( get_option('mo_openid_salesforce_enable') ) {
553
+ if($selected_theme == 'longbutton'){
554
+ $html .= "<a rel='nofollow' onClick=\"moOpenIdLogin('salesforce','" . $salesforce_custom_app . "');\" style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-cloud'></i> " . $buttonText . " Salesforce</a>";
555
+ }
556
+ else{
557
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Salesforce' onClick=\"moOpenIdLogin('salesforce','" . $salesforce_custom_app . "');\" ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-cloud custom-login-button " . $selected_theme . "' ></i></a>";
558
+ }
559
+ }if( get_option('mo_openid_windowslive_enable') ) {
560
+ if($selected_theme == 'longbutton'){
561
+ $html .= "<a rel='nofollow' onClick=\"moOpenIdLogin('windowslive','" . $windowslive_custom_app . "');\" style='width:" . ($customWidth) . "px !important;padding-top:" . ($customHeight-29) . "px !important;padding-bottom:" . ($customHeight-29) . "px !important;margin-bottom:" . ($spacebetweenicons-5) . "px !important; background:#" . $customBackground . "!important;border-radius: " .$customBoundary. "px !important;' class='btn btn-block btn-social btn-customtheme btn-custom-dec login-button' > <i style='padding-top:" .($customHeight-35) . "px !important' class='fa fa-windows'></i> " . $buttonText . " Microsoft</a>";
562
+ }
563
+ else{
564
+ $html .= "<a rel='nofollow' title= ' ".$customTextofTitle." Microsoft' onClick=\"moOpenIdLogin('windowslive','" . $windowslive_custom_app . "');\" ><i style='width:" . $customSize . "px !important;height:" . $customSize . "px !important;margin-left:" . ($spacebetweenicons) . "px !important;background:#" . $customBackground . " !important;font-size: " . ($customSize-16) . "px !important;' class='fa fa-windows custom-login-button " . $selected_theme . "' ></i></a>";
565
+ }
566
+ }
567
+ }
568
+ $html .= '</div> <br>';
569
 
570
  }
571
+ else {
572
+
573
+ $html .= '<div>No apps configured. Please contact your administrator.</div>';
574
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
575
  }
576
+ if(get_option('mo_openid_oauth')=='1' && $appsConfigured && get_option('moopenid_logo_check') == 1 ){
577
+ $logo_html=$this->mo_openid_customize_logo();
578
+ $html .= $logo_html;
 
 
 
579
  }
580
+ ?>
581
+ <br/>
582
+ <?php
583
+ }else {
584
+ global $current_user;
585
+ $current_user = wp_get_current_user();
586
+ $customLogoutName = str_replace('##username##', $current_user->display_name, $customLogoutName);
587
+ $flw = __($customLogoutLink,"flw");
588
+ if (empty($customLogoutName) || empty($customLogoutLink)) {
589
+ $html .= '<div id="logged_in_user" class="mo_openid_login_wid">' . $customLogoutName . ' <a href=' . $logoutUrl .' title=" ' . $flw . '"> ' . $flw . '</a></div>';
590
  }
591
+ else {
592
+ $html .= '<div id="logged_in_user" class="mo_openid_login_wid">' . $customLogoutName . ' <a href=' . $logoutUrl .' title=" ' . $flw . '"> ' . $flw . '</a></div>';
593
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
  }
595
+ return $html;
596
  }
597
 
598
+ private function mo_openid_load_login_script() {?>
599
+ <script type="text/javascript">
600
+ function moOpenIdLogin(app_name,is_custom_app) {
601
+ <?php
602
+
 
 
 
603
  if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
604
  $http = "https://";
605
  } else {
606
  $http = "http://";
607
  }
608
+ ?>
609
+ var base_url = '<?php echo site_url();?>';
610
+ var request_uri = '<?php echo $_SERVER['REQUEST_URI'];?>';
611
+ var http = '<?php echo $http;?>';
612
+ var http_host = '<?php echo $_SERVER['HTTP_HOST'];?>'
613
+
614
+ if(is_custom_app == 'false'){
615
+ if ( request_uri.indexOf('wp-login.php') !=-1){
616
+ var redirect_url = base_url + '/?option=getmosociallogin&app_name=';
617
+
618
+ }else {
619
+ var redirect_url = http + http_host + request_uri;
620
+ if(redirect_url.indexOf('?') != -1){
621
+ redirect_url = redirect_url +'&option=getmosociallogin&app_name=';
622
+ }
623
+ else
624
+ {
625
+ redirect_url = redirect_url +'?option=getmosociallogin&app_name=';
626
+ }
627
  }
628
  }
629
+ else {
630
+ var current_url = window.location.href;
631
+ var cname = "redirect_current_url";
632
+ var d = new Date();
633
+ d.setTime(d.getTime() + (2 * 24 * 60 * 60 * 1000));
634
+ var expires = "expires="+d.toUTCString();
635
+ document.cookie = cname + "=" + current_url + ";" + expires + ";path=/"; //path = root path(/)
636
+
637
+ if ( request_uri.indexOf('wp-login.php') !=-1){
638
+ var redirect_url = base_url + '/?option=oauthredirect&app_name=';
639
+
640
+ }else {
641
+ var redirect_url = http + http_host + request_uri;
642
+ if(redirect_url.indexOf('?') != -1)
643
+ redirect_url = redirect_url +'&option=oauthredirect&app_name=';
644
+ else
645
+ redirect_url = redirect_url +'?option=oauthredirect&app_name=';
646
+ }
647
+
648
+ }
649
+ window.location.href = redirect_url + app_name;
650
+ }
651
+ </script>
652
+ <?php
653
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
654
 
655
+ /*public function error_message(){
656
+ if(isset($_SESSION['msg']) and $_SESSION['msg']){
657
+ echo '<div class="'.$_SESSION['msg_class'].'">'.$_SESSION['msg'].'</div>';
658
+ unset($_SESSION['msg']);
659
+ unset($_SESSION['msg_class']);
660
+ }
661
+ }*/
662
 
 
 
 
 
 
 
 
 
663
  }
664
 
665
+ /**
666
+ * Sharing Widget Horizontal
667
+ *
668
+ */
669
+ class mo_openid_sharing_hor_wid extends WP_Widget {
670
+
671
+ public function __construct() {
672
+ parent::__construct(
673
+ 'mo_openid_sharing_hor_wid',
674
+ 'miniOrange Sharing - Horizontal',
675
+ array(
676
+ 'description' => __( 'Share using horizontal widget. Lets you share with Social Apps like Google, Facebook, LinkedIn, Pinterest, Reddit.', 'flw' ),
677
+ 'customize_selective_refresh' => true,
678
+ )
679
+ );
680
+ }
681
 
682
+ public function widget( $args, $instance ) {
683
+ extract( $args );
684
 
685
+ echo $args['before_widget'];
686
+ $this->show_sharing_buttons_horizontal();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
687
 
688
+ echo $args['after_widget'];
689
+ }
 
 
 
 
 
 
 
 
 
690
 
691
+ public function update( $new_instance, $old_instance ) {
692
+ $instance = array();
693
+ $instance['wid_title'] = strip_tags( $new_instance['wid_title'] );
694
+ return $instance;
695
+ }
696
 
697
+ public function show_sharing_buttons_horizontal(){
698
+ global $post;
 
699
  $title = str_replace('+', '%20', urlencode($post->post_title));
700
+ $content=strip_shortcodes( strip_tags( get_the_content() ) );
701
+ $post_content=$content;
702
+ $excerpt = '';
703
+ $landscape = 'horizontal';
704
+ include( plugin_dir_path( __FILE__ ) . 'class-mo-openid-social-share.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
705
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
706
 
 
 
 
 
707
  }
 
 
 
 
 
 
 
 
 
 
 
 
708
 
 
 
 
 
 
 
 
709
 
710
+ /**
711
+ * Sharing Vertical Widget
712
+ *
713
+ */
714
+ class mo_openid_sharing_ver_wid extends WP_Widget {
715
+
716
+ public function __construct() {
717
+ parent::__construct(
718
+ 'mo_openid_sharing_ver_wid',
719
+ 'miniOrange Sharing - Vertical',
720
+ array(
721
+ 'description' => __( 'Share using a vertical floating widget. Lets you share with Social Apps like Google, Facebook, LinkedIn, Pinterest, Reddit.', 'flw' ),
722
+ 'customize_selective_refresh' => true,
723
+ )
724
+ );
725
+ }
726
+
727
+ public function widget( $args, $instance ) {
728
+ extract( $args );
729
+ extract( $instance );
730
+
731
+ $wid_title = apply_filters( 'widget_title', $instance['wid_title'] );
732
+ $alignment = apply_filters( 'alignment', isset($instance['alignment'])? $instance['alignment'] : 'left');
733
+ $left_offset = apply_filters( 'left_offset', isset($instance['left_offset'])? $instance['left_offset'] : '20');
734
+ $right_offset = apply_filters( 'right_offset', isset($instance['right_offset'])? $instance['right_offset'] : '0');
735
+ $top_offset = apply_filters( 'top_offset', isset($instance['top_offset'])? $instance['top_offset'] : '100');
736
+ $space_icons = apply_filters( 'space_icons', isset($instance['space_icons'])? $instance['space_icons'] : '10');
737
+
738
+ echo $args['before_widget'];
739
+ if ( ! empty( $wid_title ) )
740
+ echo $args['before_title'] . $wid_title . $args['after_title'];
741
 
742
+ echo "<div class='mo_openid_vertical' style='" .(isset($alignment) && $alignment != '' && isset($instance[$alignment.'_offset']) ? $alignment .': '. ( $instance[$alignment.'_offset'] == '' ? 0 : $instance[$alignment.'_offset'] ) .'px;' : '').(isset($top_offset) ? 'top: '. ( $top_offset == '' ? 0 : $top_offset ) .'px;' : '') ."'>";
743
+
744
+ $this->show_sharing_buttons_vertical($space_icons);
 
 
745
 
746
+ echo '</div>';
747
 
748
+ echo $args['after_widget'];
749
+ }
750
 
751
+ /*Called when user changes configuration in Widget Admin Panel*/
752
+ public function update( $new_instance, $old_instance ) {
753
+ $instance = $old_instance;
754
+ $instance['wid_title'] = strip_tags( $new_instance['wid_title'] );
755
+ $instance['alignment'] = $new_instance['alignment'];
756
+ $instance['left_offset'] = $new_instance['left_offset'];
757
+ $instance['right_offset'] = $new_instance['right_offset'];
758
+ $instance['top_offset'] = $new_instance['top_offset'];
759
+ $instance['space_icons'] = $new_instance['space_icons'];
760
+ return $instance;
761
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
762
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
763
 
764
+ public function show_sharing_buttons_vertical($space_icons){
765
+ global $post;
766
+ if($post->post_title) {
767
+ $title = str_replace('+', '%20', urlencode($post->post_title));
768
+ } else {
769
+ $title = get_bloginfo( 'name' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
770
  }
771
+ $content=strip_shortcodes( strip_tags( get_the_content() ) );
772
+ $post_content=$content;
773
+ $excerpt = '';
774
+ $landscape = 'vertical';
 
775
 
776
+ include( plugin_dir_path( __FILE__ ) . 'class-mo-openid-social-share.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
777
  }
778
 
779
+ /** Widget edit form at admin panel */
780
+ function form( $instance ) {
781
+ /* Set up default widget settings. */
782
+ $defaults = array('alignment' => 'left', 'left_offset' => '20', 'right_offset' => '0', 'top_offset' => '100' , 'space_icons' => '10');
783
+
784
+ foreach( $instance as $key => $value ){
785
+ $instance[ $key ] = esc_attr( $value );
786
  }
787
+
788
+ $instance = wp_parse_args( (array)$instance, $defaults );
789
+ ?>
790
+ <p>
791
+ <script>
792
+ function moOpenIDVerticalSharingOffset(alignment){
793
+ if(alignment == 'left'){
794
+ jQuery('.moVerSharingLeftOffset').css('display', 'block');
795
+ jQuery('.moVerSharingRightOffset').css('display', 'none');
796
+ }else{
797
+ jQuery('.moVerSharingLeftOffset').css('display', 'none');
798
+ jQuery('.moVerSharingRightOffset').css('display', 'block');
799
+ }
800
+ }
801
+ </script>
802
+ <label for="<?php echo $this->get_field_id( 'alignment' ); ?>">Alignment</label>
803
+ <select onchange="moOpenIDVerticalSharingOffset(this.value)" style="width: 95%" id="<?php echo $this->get_field_id( 'alignment' ); ?>" name="<?php echo $this->get_field_name( 'alignment' ); ?>">
804
+ <option value="left" <?php echo $instance['alignment'] == 'left' ? 'selected' : ''; ?>>Left</option>
805
+ <option value="right" <?php echo $instance['alignment'] == 'right' ? 'selected' : ''; ?>>Right</option>
806
+ </select>
807
+ <div class="moVerSharingLeftOffset" <?php echo $instance['alignment'] == 'right' ? 'style="display: none"' : ''; ?>>
808
+ <label for="<?php echo $this->get_field_id( 'left_offset' ); ?>">Left Offset</label>
809
+ <input style="width: 95%" id="<?php echo $this->get_field_id( 'left_offset' ); ?>" name="<?php echo $this->get_field_name( 'left_offset' ); ?>" type="text" value="<?php echo $instance['left_offset']; ?>" />px<br/>
810
+ </div>
811
+ <div class="moVerSharingRightOffset" <?php echo $instance['alignment'] == 'left' ? 'style="display: none"' : ''; ?>>
812
+ <label for="<?php echo $this->get_field_id( 'right_offset' ); ?>">Right Offset</label>
813
+ <input style="width: 95%" id="<?php echo $this->get_field_id( 'right_offset' ); ?>" name="<?php echo $this->get_field_name( 'right_offset' ); ?>" type="text" value="<?php echo $instance['right_offset']; ?>" />px<br/>
814
+ </div>
815
+ <label for="<?php echo $this->get_field_id( 'top_offset' ); ?>">Top Offset</label>
816
+ <input style="width: 95%" id="<?php echo $this->get_field_id( 'top_offset' ); ?>" name="<?php echo $this->get_field_name( 'top_offset' ); ?>" type="text" value="<?php echo $instance['top_offset']; ?>" />px<br/>
817
+ <label for="<?php echo $this->get_field_id( 'space_icons' ); ?>">Space between icons</label>
818
+ <input style="width: 95%" id="<?php echo $this->get_field_id( 'space_icons' ); ?>" name="<?php echo $this->get_field_name( 'space_icons' ); ?>" type="text" value="<?php echo $instance['space_icons']; ?>" />px<br/>
819
+ </p>
820
+ <?php
821
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
822
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
823
  }
824
+
825
+ function mo_openid_start_session() {
826
+ if( !session_id() ) {
827
+ session_start();
828
+ }
829
+ }
830
+
831
+ function mo_openid_end_session() {
832
+ if( session_id() ) {
833
+ session_destroy();
834
+ }
835
+ }
836
+
837
+ function encrypt_data($data, $key) {
838
+
839
+ return base64_encode(openssl_encrypt($data, 'aes-128-ecb', $key, OPENSSL_RAW_DATA));
840
+
841
+ }
842
+
843
+ function decrypt_data($data, $key) {
844
+
845
+ return openssl_decrypt( base64_decode($data), 'aes-128-ecb', $key, OPENSSL_RAW_DATA);
846
+
847
+ }
848
+
849
+ /**
850
+ *
851
+ */
852
+ function mo_openid_login_validate(){
853
+
854
+ if( isset( $_POST['option'] ) and strpos( $_POST['option'], 'mo_openid_show_profile_form' ) !== false ){
855
+ $path = site_url();
856
+ $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
857
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
858
+ echo mo_openid_profile_completion_form($logo, $path, $_POST["last_name"],$_POST["first_name"], $_POST["user_full_name"],$_POST["user_url"], $_POST["user_picture"], $_POST['username_field'], $_POST['email_field'],$_POST["decrypted_app_name"],$_POST["decrypted_user_id"]);
859
+ exit;
860
+ }
861
+
862
+ if( isset( $_POST['option'] ) and strpos( $_POST['option'], 'mo_openid_account_linking' ) !== false ){
863
+ mo_openid_start_session();
864
+ //link account
865
+ if(!isset($_POST['mo_openid_create_new_account'])){
866
+ $url = site_url().'/wp-login.php?option=disable-social-login';
867
+ header('Location:'. $url);
868
+ exit;
869
+ }
870
+ //create new account
871
+ else {
872
+ mo_openid_start_session();
873
+ if(get_option('mo_openid_auto_register_enable')) {
874
+ $random_password = wp_generate_password( 10, false );
875
+ global $wpdb;
876
+ $db_prefix = $wpdb->prefix;
877
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $_SESSION['username']));
878
+
879
+
880
+ if( !empty($username_user_id) ){
881
+ $email_explode = explode('@',$_SESSION['user_email'] );
882
+ $username = $email_explode[0];
883
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $username));
884
+ if( !empty($username_user_id) ){
885
+ wp_die('This username already exists. Please ask the administrator to create your account with a unique username');
886
+ }
887
+ $_SESSION['username'] = $username;
888
+ }
889
+ $userdata = array(
890
+ 'user_login' => $_SESSION['username'],
891
+ 'user_email' => $_SESSION['user_email'],
892
+ 'user_pass' => $random_password,
893
+ 'display_name' => $_SESSION['user_full_name'],
894
+ 'first_name' => $_SESSION['first_name'],
895
+ 'last_name' => $_SESSION['last_name'],
896
+ 'user_url' => $_SESSION['user_url'],
897
+ );
898
+
899
+ $user_id = wp_insert_user( $userdata);
900
+
901
+ if(is_wp_error( $user_id )) {
902
+ //print_r($user_id);
903
+ wp_die('There was an error in registration. Please contact your administrator.');
904
+ }
905
+
906
+ if( get_option('mo_openid_email_enable') == 1 && get_option('mo_openid_oauth') == 1) {
907
+ mo_openid_send_email($user_id);
908
+ }
909
+
910
+ $user = get_user_by('email', $_SESSION['user_email'] );
911
+ if(get_option('mo_openid_login_role_mapping')){
912
+ $user->set_role( get_option('mo_openid_login_role_mapping') );
913
+ }
914
+ if(get_option('moopenid_social_login_avatar') && isset($_SESSION['user_picture'])){
915
+ update_user_meta($user_id, 'moopenid_user_avatar',$_SESSION['user_picture']);
916
+ }
917
+
918
+ mo_openid_start_session();
919
+ $_SESSION['mo_login'] = true;
920
+ do_action( 'mo_user_register', $user_id);
921
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
922
+ do_action( 'wp_login', $user->user_login, $user );
923
+ wp_set_auth_cookie( $user_id, true );
924
+ }
925
+ //end of create account block
926
+
927
+ $redirect_url = mo_openid_get_redirect_url();
928
+ wp_redirect($redirect_url);
929
+ exit;
930
+ }
931
+ }
932
+
933
+ if( isset( $_REQUEST['option'] ) and strpos( $_REQUEST['option'], 'getmosociallogin' ) !== false ) {
934
+ $client_name = "wordpress";
935
+ $timestamp = round( microtime(true) * 1000 );
936
+ $api_key = get_option('mo_openid_admin_api_key');
937
+ $token = $client_name . ':' . number_format($timestamp, 0, '', ''). ':' . $api_key;
938
+
939
+ $customer_token = get_option('mo_openid_customer_token');
940
+ $encrypted_token = encrypt_data($token,$customer_token);
941
+ $encoded_token = urlencode( $encrypted_token );
942
+
943
+ $userdata = get_option('moopenid_user_attributes')?'true':'false';
944
+
945
+ $http = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? "https://" : "http://";
946
+
947
+ $parts = parse_url($http . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
948
+ parse_str($parts['query'], $query);
949
+ $post = isset( $query['p'] ) ? '?p=' . $query['p'] : '';
950
+
951
+ $base_return_url = $http . $_SERVER["HTTP_HOST"] . strtok($_SERVER["REQUEST_URI"],'?') . $post;
952
+
953
+ $return_url = strpos($base_return_url, '?') !== false ? urlencode( $base_return_url . '&option=moopenid' ): urlencode( $base_return_url . '?option=moopenid' );
954
+
955
+ $url = get_option('mo_openid_host_name') . '/moas/openid-connect/client-app/authenticate?token=' . $encoded_token . '&userdata=' . $userdata. '&id=' . get_option('mo_openid_admin_customer_key') . '&encrypted=true&app=' . $_REQUEST['app_name'] . '_oauth&returnurl=' . $return_url . '&encrypt_response=true';
956
+ wp_redirect( $url );
957
+ exit;
958
+ }
959
+
960
+ if( isset( $_POST['username_field']) and isset($_POST['email_field']) and $_POST['option'] == 'mo_openid_profile_form_submitted' ){
961
+
962
+ $username = $_POST['username_field'];
963
+ $user_email = $_POST['email_field'];
964
+ $user_picture = $_POST["user_picture"];
965
+ $user_url = $_POST["user_url"];
966
+ $last_name = $_POST["last_name"];
967
+ $user_full_name = $_POST["user_full_name"];
968
+ $first_name = $_POST["first_name"];
969
+ $decrypted_app_name = $_POST["decrypted_app_name"];
970
+ $decrypted_user_id = $_POST["decrypted_user_id"];
971
+
972
+ if(!isset($_POST['otp_field'])) {
973
+ $user_email = sanitize_email($user_email);
974
+ $username = preg_replace('/[\x00-\x1F][\x7F][\x81][\x8D][\x8F][\x90][\x9D][\xA0][\xAD]/', '', $username);
975
+ $username = strtolower(str_replace(" ","",$username));
976
+
977
+ $path = site_url();
978
+ $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
979
+
980
+ global $wpdb;
981
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = %s", $user_email));
982
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
983
+
984
+ //if email exists, dont check if username is in db or not, send otp and get it over wordpress
985
+ if( isset($email_user_id)){
986
+
987
+ $send_content = send_otp_token($user_email);
988
+ if($send_content['status']=='FAILURE'){
989
+ $message = 'Either your SMTP is not configured or you have entered an unmailable email. Please go back and try again.';
990
+ wp_die($message);
991
+ }
992
+
993
+ $transaction_id = $send_content['tId'];
994
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
995
+ echo mo_openid_validate_otp_form($logo, $path, $username, $user_email, $transaction_id, $user_picture, $user_url,$last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id);
996
+ exit;
997
+
998
+ }
999
+ //email doesnt exist, check if username is in db or not, acc show form and proceed further
1000
+ else {
1001
+
1002
+ if( isset($username_user_id) ){
1003
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
1004
+ echo mo_openid_username_already_exists($logo, $path, $last_name, $first_name, $user_full_name, $user_url, $user_picture, $username, $user_email, $decrypted_app_name, $decrypted_user_id);
1005
+ exit;
1006
+ }
1007
+ else {
1008
+
1009
+ $send_content = send_otp_token($user_email);
1010
+ if($send_content['status']=='FAILURE'){
1011
+ $message = 'Either your SMTP is not configured or you have entered an unmailable email. Please go back and try again.';
1012
+ wp_die($message);
1013
+ }
1014
+
1015
+ $transaction_id = $send_content['tId'];
1016
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
1017
+ echo mo_openid_validate_otp_form($logo,$path, $username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id);
1018
+ exit;
1019
+ }
1020
+
1021
+ }
1022
+ }
1023
+ }
1024
+
1025
+ if( isset( $_POST['otp_field']) and $_POST['option'] == 'mo_openid_otp_validation' ){
1026
+
1027
+ $username = $_POST["username_field"];
1028
+ $user_email = $_POST["email_field"];
1029
+ $transaction_id = $_POST["transaction_id"];
1030
+ $otp_token = $_POST['otp_field'];
1031
+ $user_picture = $_POST["user_picture"];
1032
+ $user_url = $_POST["user_url"];
1033
+ $last_name = $_POST["last_name"];
1034
+ $user_full_name = $_POST["user_full_name"];
1035
+ $first_name = $_POST["first_name"];
1036
+ $decrypted_app_name = $_POST["decrypted_app_name"];
1037
+ $decrypted_user_id = $_POST["decrypted_user_id"];
1038
+
1039
+ $validate_content = validate_otp_token($transaction_id, $otp_token);
1040
+ $status = $validate_content['status'];
1041
+
1042
+ $path = site_url();
1043
+ $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
1044
+
1045
+ //if invalid OTP
1046
+ if($status == 'FAILURE'){
1047
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
1048
+ echo mo_openid_invalid_otp_form($logo, $path, $first_name, $last_name, $user_full_name, $user_url, $user_picture, $decrypted_app_name, $decrypted_user_id, $username,$user_email, $transaction_id); exit;
1049
+ }
1050
+ //if OTP is Valid
1051
+ else{
1052
+ global $wpdb;
1053
+ $db_prefix = $wpdb->prefix;
1054
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = %s",$user_email));
1055
+ $existing_email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $user_email));
1056
+
1057
+ // if linked user exists log him in
1058
+ mo_openid_start_session();
1059
+ if(isset($email_user_id) || isset($existing_email_user_id) )
1060
+ {
1061
+ $email_user_id = isset($email_user_id)? $email_user_id:$existing_email_user_id;
1062
+
1063
+ mo_openid_start_session();
1064
+ $_SESSION['username'] = $username;
1065
+ $_SESSION['user_email'] = $user_email;
1066
+ $_SESSION['user_full_name'] = $user_full_name;
1067
+ $_SESSION['first_name'] = $first_name;
1068
+ $_SESSION['last_name'] = $last_name;
1069
+ $_SESSION['user_url'] = $user_url;
1070
+ $_SESSION['user_picture'] = $user_picture;
1071
+ $_SESSION['social_app_name'] = $decrypted_app_name;
1072
+ $_SESSION['social_user_id'] = $decrypted_user_id;
1073
+
1074
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture))
1075
+ update_user_meta($email_user_id, 'moopenid_user_avatar', $user_picture);
1076
+ $_SESSION['mo_login'] = true;
1077
+
1078
+ $user = get_user_by('id', $email_user_id );
1079
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1080
+ do_action( 'wp_login', $user->user_login, $user );
1081
+ wp_set_auth_cookie( $email_user_id, true );
1082
+ }
1083
+ // if account linking is enable and email is set
1084
+ else if ( get_option('mo_openid_account_linking_enable') ){
1085
+ mo_openid_start_session();
1086
+ $_SESSION['username'] = $username;
1087
+ $_SESSION['user_email'] = $user_email;
1088
+ $_SESSION['user_full_name'] = $user_full_name;
1089
+ $_SESSION['first_name'] = $first_name;
1090
+ $_SESSION['last_name'] = $last_name;
1091
+ $_SESSION['user_url'] = $user_url;
1092
+ $_SESSION['user_picture'] = $user_picture;
1093
+ $_SESSION['social_app_name'] = $decrypted_app_name;
1094
+ $_SESSION['social_user_id'] = $decrypted_user_id;
1095
+
1096
+ $path = site_url();
1097
+ $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
1098
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
1099
+ echo mo_openid_account_linking_form($logo,$path);
1100
+ exit;
1101
+ }
1102
+ // else register
1103
+ else{
1104
+ //check if auto-registration is enabled
1105
+ if(get_option('mo_openid_auto_register_enable')) {
1106
+
1107
+ $random_password = wp_generate_password( 10, false );
1108
+ $userdata = array(
1109
+ 'user_login' => $username,
1110
+ 'user_email' => $user_email,
1111
+ 'user_pass' => $random_password,
1112
+ 'display_name' => $user_full_name,
1113
+ 'first_name' => $first_name,
1114
+ 'last_name' => $last_name,
1115
+ 'user_url' => $user_url,
1116
+ );
1117
+
1118
+ $user_id = wp_insert_user( $userdata);
1119
+ if(is_wp_error( $user_id )) {
1120
+ //print_r($user_id);
1121
+ wp_die('There was an error in registration. Please contact your administrator.');
1122
+ }
1123
+
1124
+ if( get_option('mo_openid_email_enable') == 1 && get_option('mo_openid_oauth') == 1) {
1125
+ mo_openid_send_email($user_id);
1126
+ }
1127
+
1128
+ $_SESSION['social_app_name'] = $decrypted_app_name;
1129
+ $_SESSION['user_email'] = $user_email;
1130
+ $_SESSION['social_user_id'] = $decrypted_user_id;
1131
+
1132
+ $user = get_user_by('email', $user_email );
1133
+ if(get_option('mo_openid_login_role_mapping')){
1134
+ $user->set_role( get_option('mo_openid_login_role_mapping') );
1135
+ }
1136
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1137
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1138
+ }
1139
+ $_SESSION['mo_login'] = true;
1140
+ do_action( 'mo_user_register', $user_id);
1141
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1142
+ do_action( 'wp_login', $user->user_login, $user );
1143
+ wp_set_auth_cookie( $user_id, true );
1144
+ }
1145
+
1146
+ $redirect_url = mo_openid_get_redirect_url();
1147
+ wp_redirect($redirect_url);
1148
+ exit;
1149
+ }
1150
+ }
1151
+ }
1152
+
1153
+ if( isset( $_REQUEST['option'] ) and strpos( $_REQUEST['option'], 'moopenid' ) !== false ){
1154
+ //Decrypt all entries
1155
+ $decrypted_email = isset($_POST['email']) ? mo_openid_decrypt_sanitize($_POST['email']): '';
1156
+ $decrypted_user_name = isset($_POST['username']) ? mo_openid_decrypt_sanitize($_POST['username']): '';
1157
+ $decrypted_user_picture = isset($_POST['profilePic']) ? mo_openid_decrypt_sanitize($_POST['profilePic']): '';
1158
+ $decrypted_user_url = isset($_POST['profileUrl']) ? mo_openid_decrypt_sanitize($_POST['profileUrl']): '';
1159
+ $decrypted_first_name = isset($_POST['firstName']) ? mo_openid_decrypt_sanitize($_POST['firstName']): '';
1160
+ $decrypted_last_name = isset($_POST['lastName']) ? mo_openid_decrypt_sanitize($_POST['lastName']): '';
1161
+ $decrypted_app_name = isset($_POST['appName']) ? mo_openid_decrypt_sanitize($_POST['appName']): '';
1162
+ $decrypted_user_id = isset($_POST['userid']) ? mo_openid_decrypt_sanitize($_POST['userid']): '';
1163
+
1164
+ $decrypted_app_name = mo_openid_filter_app_name($decrypted_app_name);
1165
+
1166
+ if(isset( $_POST['firstName'] ) && isset( $_POST['lastName'] )){
1167
+ if(strcmp($decrypted_first_name, $decrypted_last_name)!=0)
1168
+ $user_full_name = $decrypted_first_name.' '.$decrypted_last_name;
1169
+ else
1170
+ $user_full_name = $decrypted_first_name;
1171
+ $first_name = $decrypted_first_name;
1172
+ $last_name = $decrypted_last_name;
1173
+ }
1174
+ else{
1175
+ $user_full_name = $decrypted_user_name;
1176
+ $first_name = '';
1177
+ $last_name = '';
1178
+ }
1179
+ //Set Display Picture
1180
+ $user_picture = $decrypted_user_picture;
1181
+
1182
+ //Set User URL
1183
+ $user_url = $decrypted_user_url;
1184
+
1185
+ //if email or username not returned from app
1186
+ if ( empty($decrypted_email) || empty($decrypted_user_name) ){
1187
+ //check if provider + identifier group exists
1188
+ global $wpdb;
1189
+ $db_prefix = $wpdb->prefix;
1190
+ $table_name = $wpdb->prefix."mo_openid_linked_user";
1191
+ $id_returning_user = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$decrypted_app_name,$decrypted_user_id));
1192
+
1193
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $decrypted_email));
1194
+
1195
+ mo_openid_start_session();
1196
+ // if returning user whose appname + identifier exists, log him in
1197
+ if((isset($id_returning_user)) || (isset($email_user_id)) ){
1198
+ if ((!isset($id_returning_user)) && (isset($email_user_id)) ){
1199
+ $id_returning_user = $email_user_id;
1200
+
1201
+ $result = $wpdb->insert(
1202
+ $table_name,
1203
+ array(
1204
+ 'linked_social_app' => $decrypted_app_name,
1205
+ 'linked_email' => $decrypted_email,
1206
+ 'user_id' => $id_returning_user,
1207
+ 'identifier' => $decrypted_user_id
1208
+ ),
1209
+ array(
1210
+ '%s',
1211
+ '%s',
1212
+ '%d',
1213
+ '%s'
1214
+ )
1215
+ );
1216
+ if($result === false){
1217
+ /*$wpdb->show_errors();
1218
+ $wpdb->print_error();
1219
+ exit;*/
1220
+ wp_die('Error in insert query');
1221
+ }
1222
+ }
1223
+ $user = get_user_by('id', $id_returning_user );
1224
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture))
1225
+ update_user_meta($id_returning_user, 'moopenid_user_avatar', $user_picture);
1226
+ $_SESSION['mo_login'] = true;
1227
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1228
+ do_action( 'wp_login', $user->user_login, $user );
1229
+ wp_set_auth_cookie( $id_returning_user, true );
1230
+ }
1231
+ // if new user and profile completion is enabled
1232
+ elseif (get_option('mo_openid_enable_profile_completion')){
1233
+ $path = site_url();
1234
+ $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
1235
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
1236
+ echo mo_openid_profile_completion_form($logo, $path, $last_name, $first_name, $user_full_name, $user_url, $user_picture, $decrypted_user_name, $decrypted_email, $decrypted_app_name, $decrypted_user_id);
1237
+ exit;
1238
+ }
1239
+ // if new user and profile completion and account linking is disabled, auto create dummy data and register user
1240
+ else{
1241
+ // auto registration is enabled
1242
+ if(get_option('mo_openid_auto_register_enable')) {
1243
+
1244
+ if(!empty($decrypted_email))
1245
+ {
1246
+ $split_email = explode('@',$decrypted_email);
1247
+ $username = $split_email[0];
1248
+ $user_email = $decrypted_email;
1249
+ }
1250
+ else if(!empty($decrypted_user_name))
1251
+ {
1252
+ $split_app_name = explode('_',$decrypted_app_name);
1253
+ $username = $decrypted_user_name;
1254
+ $user_email = $decrypted_user_name.'@'.$split_app_name[0].'.com';
1255
+ }
1256
+ else
1257
+ {
1258
+ $split_app_name = explode('_',$decrypted_app_name);
1259
+ $username = 'user_'.get_option('mo_openid_user_count');
1260
+ $user_email = 'user_'.get_option('mo_openid_user_count').'@'.$split_app_name[0].'.com';
1261
+ }
1262
+
1263
+ // remove white space from email
1264
+ $user_email = str_replace(' ', '', $user_email);
1265
+
1266
+
1267
+ //account linking
1268
+ if ( get_option('mo_openid_account_linking_enable')){
1269
+ mo_openid_start_session();
1270
+ $_SESSION['username'] = $decrypted_user_name;
1271
+ $_SESSION['user_email'] = $user_email;
1272
+ $_SESSION['user_full_name'] = $user_full_name;
1273
+ $_SESSION['first_name'] = $first_name;
1274
+ $_SESSION['last_name'] = $last_name;
1275
+ $_SESSION['user_url'] = $user_url;
1276
+ $_SESSION['user_picture'] = $user_picture;
1277
+ $_SESSION['social_app_name'] = $decrypted_app_name;
1278
+ $_SESSION['social_user_id'] = $decrypted_user_id;
1279
+
1280
+ $path = site_url();
1281
+ $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
1282
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
1283
+ echo mo_openid_account_linking_form($logo,$path);
1284
+ exit;
1285
+ }
1286
+
1287
+ $random_password = wp_generate_password( 10, false );
1288
+
1289
+ $userdata = array(
1290
+ 'user_login' => $username,
1291
+ 'user_email' => $user_email,
1292
+ 'user_pass' => $random_password,
1293
+ 'display_name' => $user_full_name,
1294
+ 'first_name' => $first_name,
1295
+ 'last_name' => $last_name,
1296
+ 'user_url' => $user_url,
1297
+ );
1298
+
1299
+
1300
+ $user_id = wp_insert_user( $userdata);
1301
+
1302
+ if(is_wp_error( $user_id )) {
1303
+ //print_r($user_id);
1304
+ wp_die('There was an error in registration. Please contact your administrator.');
1305
+ }
1306
+
1307
+ if( get_option('mo_openid_email_enable') == 1 && get_option('mo_openid_oauth') == 1) {
1308
+ mo_openid_send_email($user_id);
1309
+ }
1310
+
1311
+ update_option('mo_openid_user_count',get_option('mo_openid_user_count')+1);
1312
+
1313
+ $_SESSION['social_app_name'] = $decrypted_app_name;
1314
+ $_SESSION['user_email'] = $user_email;
1315
+ $_SESSION['social_user_id'] = $decrypted_user_id;
1316
+
1317
+ $user = get_user_by('id', $user_id );
1318
+ if(get_option('mo_openid_login_role_mapping')){
1319
+ $user->set_role( get_option('mo_openid_login_role_mapping') );
1320
+ }
1321
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1322
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1323
+ }
1324
+ $_SESSION['mo_login'] = true;
1325
+
1326
+ //registration hook
1327
+ do_action( 'mo_user_register', $user_id);
1328
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1329
+ //login hook
1330
+ do_action( 'wp_login', $user->user_login, $user );
1331
+ wp_set_auth_cookie( $user_id, true );
1332
+ }
1333
+
1334
+ $redirect_url = mo_openid_get_redirect_url();
1335
+ wp_redirect($redirect_url);
1336
+ exit;
1337
+
1338
+ }
1339
+
1340
+ }
1341
+ //email and username are both returned..dont show profile completion
1342
+ else{
1343
+
1344
+ global $wpdb;
1345
+ $table_name = $wpdb->prefix . 'mo_openid_linked_user';
1346
+ $user_email = sanitize_email($decrypted_email);
1347
+ $username = strtolower(str_replace(" ","",$decrypted_user_name));
1348
+
1349
+ //Checking if email or username already exist
1350
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
1351
+
1352
+ $db_prefix = $wpdb->prefix;
1353
+ $linked_email_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$decrypted_app_name,$decrypted_user_id));
1354
+
1355
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = \"%s\"",$decrypted_email));
1356
+
1357
+ $existing_email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $decrypted_email));
1358
+
1359
+ mo_openid_start_session();
1360
+ if((isset($linked_email_id)) || (isset($email_user_id)) || isset($existing_email_user_id)) { // user is a member
1361
+ if ((!isset($linked_email_id)) && (isset($email_user_id)) ){
1362
+ $linked_email_id = $email_user_id;
1363
+
1364
+ $result = $wpdb->insert(
1365
+ $table_name,
1366
+ array(
1367
+ 'linked_social_app' => $decrypted_app_name,
1368
+ 'linked_email' => $user_email,
1369
+ 'user_id' => $linked_email_id,
1370
+ 'identifier' => $decrypted_user_id
1371
+ ),
1372
+ array(
1373
+ '%s',
1374
+ '%s',
1375
+ '%d',
1376
+ '%s'
1377
+ )
1378
+ );
1379
+ if($result === false){
1380
+ /*$wpdb->show_errors();
1381
+ $wpdb->print_error();
1382
+ exit;*/
1383
+ wp_die('Error in insert query');
1384
+ }
1385
+ }
1386
+
1387
+ if(isset($linked_email_id)){
1388
+ $user = get_user_by('id', $linked_email_id );
1389
+ $user_id = $user->ID;
1390
+ }
1391
+ else if(isset($email_user_id)){
1392
+ $user = get_user_by('id', $email_user_id );
1393
+ $user_id = $user->ID;
1394
+ }
1395
+ else{
1396
+ $user = get_user_by('id', $existing_email_user_id );
1397
+ $user_id = $user->ID;
1398
+ }
1399
+
1400
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture))
1401
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1402
+ $_SESSION['mo_login'] = true;
1403
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1404
+ do_action( 'wp_login', $user->user_login, $user );
1405
+ wp_set_auth_cookie( $user_id, true );
1406
+ }
1407
+ else if ( get_option('mo_openid_account_linking_enable')){
1408
+ mo_openid_start_session();
1409
+ $_SESSION['username'] = $decrypted_user_name;
1410
+ $_SESSION['user_email'] = $user_email;
1411
+ $_SESSION['user_full_name'] = $user_full_name;
1412
+ $_SESSION['first_name'] = $first_name;
1413
+ $_SESSION['last_name'] = $last_name;
1414
+ $_SESSION['user_url'] = $user_url;
1415
+ $_SESSION['user_picture'] = $user_picture;
1416
+ $_SESSION['social_app_name'] = $decrypted_app_name;
1417
+ $_SESSION['social_user_id'] = $decrypted_user_id;
1418
+ $path = site_url();
1419
+ $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
1420
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
1421
+ echo mo_openid_account_linking_form($logo,$path);
1422
+ exit;
1423
+ }
1424
+ else {
1425
+ // this user is a guest
1426
+
1427
+ // auto registration is enabled
1428
+ if(get_option('mo_openid_auto_register_enable')) {
1429
+ $random_password = wp_generate_password( 10, false );
1430
+
1431
+ if( isset($username_user_id) ){
1432
+ $email = explode('@', $user_email);
1433
+ $username = $email[0];
1434
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
1435
+ if( isset($username_user_id) ){
1436
+ echo '<br/>This username already exists. Please ask the administrator to create your account with a unique username';
1437
+ exit();
1438
+ }
1439
+ }
1440
+
1441
+ $userdata = array(
1442
+ 'user_login' => $username,
1443
+ 'user_email' => $user_email,
1444
+ 'user_pass' => $random_password,
1445
+ 'display_name' => $user_full_name,
1446
+ 'first_name' => $first_name,
1447
+ 'last_name' => $last_name,
1448
+ 'user_url' => $user_url
1449
+ );
1450
+
1451
+
1452
+ $user_id = wp_insert_user( $userdata);
1453
+
1454
+ if(is_wp_error( $user_id )) {
1455
+ //print_r($user_id);
1456
+ wp_die('There was an error in registration. Please contact your administrator.');
1457
+ }
1458
+ if( get_option('mo_openid_email_enable') == 1 && get_option('mo_openid_oauth') == 1) {
1459
+ mo_openid_send_email($user_id);
1460
+ }
1461
+
1462
+ $_SESSION['social_app_name'] = $decrypted_app_name;
1463
+ $_SESSION['user_email'] = $user_email;
1464
+ $_SESSION['social_user_id'] = $decrypted_user_id;
1465
+
1466
+ $user = get_user_by('email', $user_email );
1467
+ if(get_option('mo_openid_login_role_mapping')){
1468
+ $user->set_role( get_option('mo_openid_login_role_mapping') );
1469
+ }
1470
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1471
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1472
+ }
1473
+ $_SESSION['mo_login'] = true;
1474
+
1475
+ //registration hook
1476
+ do_action( 'mo_user_register', $user_id);
1477
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1478
+ //login hook
1479
+ do_action( 'wp_login', $user->user_login, $user );
1480
+ wp_set_auth_cookie( $user_id, true );
1481
+ }
1482
+ $redirect_url = mo_openid_get_redirect_url();
1483
+ wp_redirect($redirect_url);
1484
+ exit;
1485
+ }
1486
+ }
1487
+ }
1488
+
1489
+ if( isset( $_REQUEST['autoregister'] ) and strpos( $_REQUEST['autoregister'],'false') !== false ) {
1490
+ if(!is_user_logged_in()) {
1491
+ mo_openid_disabled_register_message();
1492
+ }
1493
+ }
1494
+
1495
+ if( isset( $_REQUEST['option'] ) and strpos( $_REQUEST['option'], 'oauthredirect' ) !== false ) {
1496
+
1497
+ $appname = $_REQUEST['app_name'];
1498
+ if(get_option('mo_openid_apps_list'))
1499
+ $appslist = get_option('mo_openid_apps_list');
1500
+ else
1501
+ $appslist=array();
1502
+
1503
+ if(isset($_REQUEST['test']))
1504
+ setcookie("mo_oauth_test", true);
1505
+ else
1506
+ setcookie("mo_oauth_test", false);
1507
+
1508
+ // NEW
1509
+ if(get_option('mo_openid_apps_list')) {
1510
+ $appslist = get_option('mo_openid_apps_list');
1511
+ }
1512
+ else{
1513
+ $appslist = array();
1514
+ }
1515
+
1516
+ mo_openid_start_session();
1517
+
1518
+ foreach($appslist as $key=>$currentapp){
1519
+
1520
+ if($key == "facebook" && $appname == "facebook"){
1521
+ $_SESSION["appname"] = "facebook";
1522
+ $social_app_redirect_uri = site_url().'/openidcallback';
1523
+ $client_id = $currentapp['clientid'];
1524
+ $scope = $currentapp['scope'];
1525
+ $login_dialog_url = "https://www.facebook.com/v2.11/dialog/oauth?client_id=".$client_id. '&redirect_uri='. $social_app_redirect_uri .'&response_type=code&scope='.$scope;
1526
+ break;
1527
+ }
1528
+ else if($key == "google" && $appname == "google"){
1529
+ $_SESSION["appname"] = "google";
1530
+ $social_app_redirect_uri = site_url().'/openidcallback';
1531
+ $client_id = $currentapp['clientid'];
1532
+ $scope = $currentapp['scope'];
1533
+ $login_dialog_url = 'https://accounts.google.com/o/oauth2/auth?redirect_uri=' .$social_app_redirect_uri .'&response_type=code&client_id=' .$client_id .'&scope='.$scope.'&access_type=offline';
1534
+ break;
1535
+ }
1536
+ else if($key == "twitter" && $appname == "twitter")
1537
+ { $_SESSION['appname'] = "twitter";
1538
+ $client_id = $currentapp['clientid'];
1539
+ $client_secret = $currentapp['clientsecret'];
1540
+ $twiter_getrequest_object = new twitter_oauth($client_id,$client_secret); //creating the object of twitter_oauth class
1541
+ $oauth_token = $twiter_getrequest_object->getRequestToken(); //function call
1542
+ $login_dialog_url = "https://api.twitter.com/oauth/authenticate?oauth_token=" . $oauth_token;
1543
+ break;
1544
+ }
1545
+ }
1546
+
1547
+ header('Location:'. $login_dialog_url);
1548
+ exit;
1549
+ }
1550
+
1551
+ if( strpos( $_SERVER['REQUEST_URI'], "/openidcallback") !== false ) {
1552
+
1553
+ $code = $profile_url = $client_id = $current_url = $client_secret = $access_token_uri = $postData = $oauth_token = $user_url = $username = $email = '';
1554
+ $oauth_access_token = $redirect_url = $option = $oauth_token_secret = $screen_name = $profile_json_output = $oauth_verifier = $twitter_oauth_token = $access_token_json_output =[];
1555
+
1556
+ mo_openid_start_session();
1557
+ if(strpos( $_SERVER['REQUEST_URI'], "oauth_verifier") !== false) {
1558
+ $_SESSION['appname'] = "twitter";
1559
+ }
1560
+
1561
+ $appname = $_SESSION['appname'];
1562
+
1563
+ if($appname == "twitter"){
1564
+ $dirs = explode('&', $_SERVER['REQUEST_URI']);
1565
+ $oauth_verifier = explode('=', $dirs[1]);
1566
+ $twitter_oauth_token = explode('=', $dirs[0]);
1567
+ }
1568
+ else{
1569
+ if(isset($_REQUEST['code'] )){
1570
+ $code = $_REQUEST['code'];
1571
+ }
1572
+ else if(isset( $_REQUEST['error_reason'] )){
1573
+ echo 'Error: ' . $_REQUEST['error_reason'] . "<br>";
1574
+ echo $_REQUEST['error'] . "<br>";
1575
+ echo $_REQUEST['error_description'] . "<br>";
1576
+ }
1577
+ }
1578
+
1579
+ if(get_option('mo_openid_apps_list')){
1580
+ $appslist = get_option('mo_openid_apps_list');
1581
+ }
1582
+ else{
1583
+ $appslist = array();
1584
+ }
1585
+ $social_app_redirect_uri = site_url().'/openidcallback';
1586
+
1587
+ foreach($appslist as $key=>$currentapp){
1588
+ if($key == "facebook" && $appname == "facebook"){
1589
+ $client_id = $currentapp['clientid'];
1590
+ $client_secret = $currentapp['clientsecret'];
1591
+ $access_token_uri = 'https://graph.facebook.com/v2.11/oauth/access_token';
1592
+ $postData = 'client_id=' .$client_id .'&redirect_uri=' . $social_app_redirect_uri . '&client_secret=' . $client_secret . '&code=' .$code;
1593
+ break;
1594
+ }
1595
+ else if($key == "google" && $appname == "google"){
1596
+ $client_id = $currentapp['clientid'];
1597
+ $client_secret = $currentapp['clientsecret'];
1598
+ $access_token_uri = 'https://accounts.google.com/o/oauth2/token';
1599
+ $postData = 'code=' .$code .'&client_id=' .$client_id .'&client_secret=' . $client_secret . '&redirect_uri=' . $social_app_redirect_uri . '&grant_type=authorization_code';
1600
+ break;
1601
+ }
1602
+ else if($key == "twitter" && $appname == "twitter")
1603
+ {
1604
+ $client_id = $currentapp['clientid'];
1605
+ $client_secret = $currentapp['clientsecret'];
1606
+ $twitter_getaccesstoken_object = new twitter_oauth($client_id,$client_secret);
1607
+ $oauth_token = $twitter_getaccesstoken_object->getAccessToken($oauth_verifier[1],$twitter_oauth_token[1]);
1608
+ break;
1609
+ }
1610
+ }
1611
+
1612
+ if($appname != "twitter")
1613
+ {
1614
+ $ch = curl_init(); // Initiate cURL
1615
+ curl_setopt($ch, CURLOPT_URL,$access_token_uri);
1616
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
1617
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
1618
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
1619
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
1620
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
1621
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
1622
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
1623
+ curl_setopt($ch, CURLOPT_POST, 1); // Tell cURL you want to post something
1624
+ curl_setopt($ch, CURLOPT_HEADER, 0);
1625
+ if($appname == "google")
1626
+ {
1627
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
1628
+ }
1629
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); // Define what you want to post
1630
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the output in string format
1631
+
1632
+ $result = curl_exec($ch);
1633
+
1634
+ if( curl_errno( $ch ) ){
1635
+ echo 'Request Error:' . curl_error( $ch );
1636
+ exit();
1637
+ }
1638
+ $access_token_json_output = json_decode($result, true);
1639
+ }
1640
+ else
1641
+ {
1642
+ $oauth_token_array = explode('&', $oauth_token);
1643
+ $oauth_access_token = isset($oauth_token_array[0]) ? $oauth_token_array[0] : null;
1644
+ $oauth_access_token = explode('=', $oauth_access_token);
1645
+ $oauth_token_secret = isset($oauth_token_array[1]) ? $oauth_token_array[1] : null;
1646
+ $oauth_token_secret = explode('=', $oauth_token_secret);
1647
+ $screen_name = isset($oauth_token_array[3]) ? $oauth_token_array[3] : null;
1648
+ $screen_name = explode('=', $screen_name);
1649
+ }
1650
+
1651
+ mo_openid_start_session();
1652
+ foreach($appslist as $key=>$currentapp){
1653
+ if($key == "facebook" && $appname == "facebook"){
1654
+ $profile_url ='https://graph.facebook.com/me/?fields=id,name,email,picture,age_range,first_name,gender,last_name,link&access_token=' .$access_token_json_output['access_token'];
1655
+ break;
1656
+ }
1657
+ else if($key == "google" && $appname == "google"){
1658
+ $profile_url = 'https://www.googleapis.com/plus/v1/people/me?access_token=' .$access_token_json_output['access_token'];
1659
+ break;
1660
+ }
1661
+ else if($key == "twitter" && $appname == "twitter"){
1662
+ $twitter_getprofile_signature_object = new twitter_oauth($client_id,$client_secret);
1663
+ $oauth_access_token1 = isset($oauth_access_token[1]) ? $oauth_access_token[1] : '';
1664
+ $oauth_token_secret1 = isset($oauth_token_secret[1]) ? $oauth_token_secret[1] : '';
1665
+ $screen_name1 = isset($screen_name[1]) ? $screen_name[1] : '';
1666
+ $profile_json_output = $twitter_getprofile_signature_object->getprofile_signature($oauth_access_token1,$oauth_token_secret1,$screen_name1);
1667
+ break;
1668
+ }
1669
+ }
1670
+
1671
+ if($appname != "twitter")
1672
+ {
1673
+ $churl = curl_init($profile_url);
1674
+ curl_setopt( $churl, CURLOPT_FOLLOWLOCATION, true );
1675
+ curl_setopt( $churl, CURLOPT_ENCODING, "" );
1676
+ curl_setopt( $churl, CURLOPT_RETURNTRANSFER, true );
1677
+ curl_setopt( $churl, CURLOPT_AUTOREFERER, true );
1678
+ curl_setopt( $churl, CURLOPT_SSL_VERIFYPEER, false );
1679
+ curl_setopt( $churl, CURLOPT_SSL_VERIFYHOST, 0 );
1680
+ curl_setopt( $churl, CURLOPT_MAXREDIRS, 10 );
1681
+ curl_setopt( $churl, CURLOPT_POST, false);
1682
+ curl_setopt($churl, CURLOPT_HTTPHEADER, array(
1683
+ 'Authorization: Bearer '.$access_token_json_output['access_token']
1684
+ ));
1685
+
1686
+ $output = curl_exec($churl);
1687
+
1688
+ if( curl_errno( $churl ) ){
1689
+ echo 'Request Error:' . curl_error( $churl );
1690
+ exit();
1691
+ }
1692
+
1693
+ $profile_json_output = json_decode($output, true);
1694
+ }
1695
+
1696
+ $social_app_name = $appname;
1697
+ $first_name = $last_name = $email = $user_name = $user_url = $user_picture = $social_user_id = '';
1698
+
1699
+ if ($appname == "facebook"){
1700
+ if(isset($profile_json_output['first_name'])){
1701
+ $first_name = isset( $profile_json_output['first_name']) ? $profile_json_output['first_name'] : '';
1702
+ }
1703
+ if(isset($profile_json_output['last_name'])){
1704
+ $last_name = isset( $profile_json_output['last_name']) ? $profile_json_output['last_name'] : '';
1705
+ }
1706
+ if(isset($profile_json_output['email'])){
1707
+ $email = isset( $profile_json_output['email']) ? $profile_json_output['email'] : '';
1708
+ }
1709
+ if(isset($profile_json_output['name'])){
1710
+ $user_name = isset( $profile_json_output['name']) ? $profile_json_output['name'] : '';
1711
+ }
1712
+ if(isset($profile_json_output['link'])){
1713
+ $user_url = isset( $profile_json_output['link']) ? $profile_json_output['link'] : '';
1714
+ }
1715
+ if(isset($profile_json_output['picture']['data']['url'])){
1716
+ $user_picture = isset( $profile_json_output['picture']['data']['url']) ? $profile_json_output['picture']['data']['url'] : '';
1717
+ }
1718
+ if(isset($profile_json_output['id'])){
1719
+ $social_user_id = isset( $profile_json_output['id']) ? $profile_json_output['id'] : '';
1720
+ }
1721
+ }
1722
+ else if ($appname == "google"){
1723
+ if(isset($profile_json_output['name']['givenName'])){
1724
+ $first_name = isset( $profile_json_output['name']['givenName']) ? $profile_json_output['name']['givenName'] : '';
1725
+ }
1726
+ if(isset($profile_json_output['displayName'])){
1727
+ $user_name = isset( $profile_json_output['displayName']) ? $profile_json_output['displayName'] : '';
1728
+ }
1729
+ if(isset($profile_json_output['name']['familyName'])){
1730
+ $last_name = isset( $profile_json_output['name']['familyName']) ? $profile_json_output['name']['familyName'] : '';
1731
+ }
1732
+ if(isset($profile_json_output['emails'])){
1733
+ foreach($profile_json_output['emails'] as $entry){
1734
+ $email = isset( $entry['value']) ? $entry['value'] : '';
1735
+ }
1736
+ }
1737
+ if(isset($profile_json_output['url'])){
1738
+ $user_url = isset( $profile_json_output['url']) ? $profile_json_output['url'] : '';
1739
+ }
1740
+ if(isset($profile_json_output['image']['url'])){
1741
+ $user_picture = isset( $profile_json_output['image']['url']) ? $profile_json_output['image']['url'] : '';
1742
+ }
1743
+ if(isset($profile_json_output['id'])){
1744
+ $social_user_id = isset( $profile_json_output['id']) ? $profile_json_output['id'] : '';
1745
+ }
1746
+ }
1747
+ else if($appname == "twitter") {
1748
+ if (isset($profile_json_output['name'])) {
1749
+ $first_name = isset( $profile_json_output['name']) ? $profile_json_output['name'] : '';
1750
+ }
1751
+ if (isset($profile_json_output['screen_name'])) {
1752
+ $user_name = isset( $profile_json_output['screen_name']) ? $profile_json_output['screen_name'] : '';
1753
+ }
1754
+ if (isset($profile_json_output['emails'])) {
1755
+ $email = isset( $profile_json_output['emails']) ? $profile_json_output['emails'] : '';
1756
+ }
1757
+ if (isset($profile_json_output['url'])) {
1758
+ $user_url = isset( $profile_json_output['url']) ? $profile_json_output['url'] : '';
1759
+ }
1760
+ if (isset($profile_json_output['profile_image_url'])) {
1761
+ $user_picture = isset( $profile_json_output['profile_image_url']) ? $profile_json_output['profile_image_url'] : '';
1762
+ }
1763
+ if (isset($profile_json_output['id_str'])) {
1764
+ $social_user_id = isset( $profile_json_output['id_str']) ? $profile_json_output['id_str'] : '';
1765
+ }
1766
+ }
1767
+
1768
+ //Set User Full Name
1769
+ if(isset( $first_name ) && isset( $last_name )){
1770
+ if(strcmp($first_name, $last_name)!=0)
1771
+ $user_full_name = $first_name.' '.$last_name;
1772
+ else
1773
+ $user_full_name = $first_name;
1774
+ }
1775
+ else{
1776
+ $user_full_name = $user_name;
1777
+ $first_name = '';
1778
+ $last_name = '';
1779
+ }
1780
+
1781
+ // if email and user name is empty
1782
+ if ( empty($email) || empty($user_name) ){
1783
+ global $wpdb;
1784
+ $db_prefix = $wpdb->prefix;
1785
+ $table_name = $wpdb->prefix."mo_openid_linked_user";
1786
+ $id_returning_user = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$social_app_name,$social_user_id));
1787
+
1788
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $email));
1789
+
1790
+ mo_openid_start_session();
1791
+
1792
+ // if returning user whose appname + identifier exists, log him in
1793
+ if((isset($id_returning_user)) || (isset($email_user_id))){
1794
+ if ((!isset($id_returning_user)) && (isset($email_user_id)) ){
1795
+ $id_returning_user = $email_user_id;
1796
+
1797
+ $result = $wpdb->insert(
1798
+ $table_name,
1799
+ array(
1800
+ 'linked_social_app' => $social_app_name,
1801
+ 'linked_email' => $email,
1802
+ 'user_id' => $id_returning_user,
1803
+ 'identifier' => $social_user_id
1804
+ ),
1805
+ array(
1806
+ '%s',
1807
+ '%s',
1808
+ '%d',
1809
+ '%s'
1810
+ )
1811
+ );
1812
+ if($result === false){
1813
+ /*$wpdb->show_errors();
1814
+ $wpdb->print_error();
1815
+ exit;*/
1816
+ wp_die('Error in insert query');
1817
+ }
1818
+ }
1819
+ $user = get_user_by('id', $id_returning_user );
1820
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture))
1821
+ update_user_meta($id_returning_user, 'moopenid_user_avatar', $user_picture);
1822
+ $_SESSION['mo_login'] = true;
1823
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1824
+ do_action( 'wp_login', $user->user_login, $user );
1825
+ wp_set_auth_cookie( $id_returning_user, true );
1826
+ }
1827
+ // if new user and profile completion is enabled
1828
+ elseif (get_option('mo_openid_enable_profile_completion')){
1829
+ $path = site_url();
1830
+ $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
1831
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
1832
+ echo mo_openid_profile_completion_form($logo, $path, $last_name, $first_name, $user_full_name, $user_url, $user_picture, $user_name, $email, $social_app_name, $social_user_id);
1833
+ exit;
1834
+ }
1835
+ // if new user and profile completion is disabled, auto create dummy data and register user
1836
+ else{
1837
+ // auto registration is enabled
1838
+ if(get_option('mo_openid_auto_register_enable')) {
1839
+
1840
+ if(!empty($email))
1841
+ {
1842
+ $split_email = explode('@',$email);
1843
+ $username = $split_email[0];
1844
+ $user_email = $email;
1845
+ }
1846
+ else if(!empty($user_name))
1847
+ {
1848
+ $split_app_name = explode('_',$social_app_name);
1849
+ $username = $user_name;
1850
+ $user_email = $user_name.'@'.$split_app_name[0].'.com';
1851
+ }
1852
+ else
1853
+ {
1854
+ $split_app_name = explode('_',$social_app_name);
1855
+ $username = 'user_'.get_option('mo_openid_user_count');
1856
+ $user_email = 'user_'.get_option('mo_openid_user_count').'@'.$split_app_name[0].'.com';
1857
+ }
1858
+ $user_email = str_replace(' ', '', $user_email);
1859
+
1860
+ if ( get_option('mo_openid_account_linking_enable')){
1861
+ mo_openid_start_session();
1862
+ $_SESSION['username'] = $username;
1863
+ $_SESSION['user_email'] = $user_email;
1864
+ $_SESSION['user_full_name'] = $user_full_name;
1865
+ $_SESSION['first_name'] = $first_name;
1866
+ $_SESSION['last_name'] = $last_name;
1867
+ $_SESSION['user_url'] = $user_url;
1868
+ $_SESSION['user_picture'] = $user_picture;
1869
+ $_SESSION['social_app_name'] = $social_app_name;
1870
+ $_SESSION['social_user_id'] = $social_user_id;
1871
+ $path = site_url();
1872
+ $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
1873
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
1874
+ echo mo_openid_account_linking_form($logo,$path);
1875
+ exit;
1876
+ }
1877
+
1878
+ $random_password = wp_generate_password( 10, false );
1879
+
1880
+ $userdata = array(
1881
+ 'user_login' => $username,
1882
+ 'user_email' => $user_email,
1883
+ 'user_pass' => $random_password,
1884
+ 'display_name' => $user_full_name,
1885
+ 'first_name' => $first_name,
1886
+ 'last_name' => $last_name,
1887
+ 'user_url' => $user_url,
1888
+ );
1889
+
1890
+ $user_id = wp_insert_user( $userdata);
1891
+
1892
+ if(is_wp_error( $user_id )) {
1893
+ //print_r($user_id);
1894
+ wp_die('There was an error in registration. Please contact your administrator.');
1895
+ }
1896
+
1897
+ if( get_option('mo_openid_email_enable') == 1 && get_option('mo_openid_oauth') == 1) {
1898
+ mo_openid_send_email($user_id);
1899
+ }
1900
+
1901
+ update_option('mo_openid_user_count',get_option('mo_openid_user_count')+1);
1902
+
1903
+ $_SESSION['social_app_name'] = $social_app_name;
1904
+ $_SESSION['user_email'] = $user_email;
1905
+ $_SESSION['social_user_id'] = $social_user_id;
1906
+
1907
+ $user = get_user_by('email', $user_email );
1908
+ if(get_option('mo_openid_login_role_mapping')){
1909
+ $user->set_role( get_option('mo_openid_login_role_mapping') );
1910
+ }
1911
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1912
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1913
+ }
1914
+
1915
+ $_SESSION['mo_login'] = true;
1916
+
1917
+ //registration hook
1918
+ do_action( 'mo_user_register', $user_id);
1919
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1920
+ //login hook
1921
+ do_action( 'wp_login', $user->user_login, $user );
1922
+ wp_set_auth_cookie( $user_id, true );
1923
+ }
1924
+ $redirect_url = mo_openid_get_redirect_url();
1925
+ wp_redirect($redirect_url);
1926
+ exit;
1927
+ }
1928
+ }
1929
+ //email and username are both returned..dont show profile completion
1930
+ else{
1931
+ global $wpdb;
1932
+ $table_name = $wpdb->prefix . 'mo_openid_linked_user';
1933
+ $user_email = sanitize_email($email);
1934
+ $username = strtolower(str_replace(" ","",$user_name));
1935
+
1936
+ //Checking if username already exist
1937
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
1938
+
1939
+ $db_prefix = $wpdb->prefix;
1940
+ $linked_email_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$social_app_name,$social_user_id));
1941
+
1942
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = \"%s\"",$user_email));
1943
+
1944
+ $existing_email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $user_email));
1945
+
1946
+ mo_openid_start_session();
1947
+ if((isset($linked_email_id)) || (isset($email_user_id)) || (isset($existing_email_user_id)) ) { // user is a member
1948
+ if ((!isset($linked_email_id)) && (isset($email_user_id)) ){
1949
+ $linked_email_id = $email_user_id;
1950
+
1951
+ $result = $wpdb->insert(
1952
+ $table_name,
1953
+ array(
1954
+ 'linked_social_app' => $social_app_name,
1955
+ 'linked_email' => $user_email,
1956
+ 'user_id' => $linked_email_id,
1957
+ 'identifier' => $social_user_id
1958
+ ),
1959
+ array(
1960
+ '%s',
1961
+ '%s',
1962
+ '%d',
1963
+ '%s'
1964
+ )
1965
+ );
1966
+ if($result === false){
1967
+ /*$wpdb->show_errors();
1968
+ $wpdb->print_error();
1969
+ exit;*/
1970
+ wp_die('Error in insert query');
1971
+ }
1972
+ }
1973
+
1974
+ if(isset($linked_email_id)){
1975
+ $user = get_user_by('id', $linked_email_id );
1976
+ $user_id = $user->ID;
1977
+ }
1978
+ else if(isset($email_user_id)){
1979
+ $user = get_user_by('id', $email_user_id );
1980
+ $user_id = $user->ID;
1981
+ }
1982
+ else{
1983
+ $user = get_user_by('id', $existing_email_user_id );
1984
+ $user_id = $user->ID;
1985
+ }
1986
+
1987
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture))
1988
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1989
+ $_SESSION['mo_login'] = true;
1990
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1991
+ do_action( 'wp_login', $user->user_login, $user );
1992
+ wp_set_auth_cookie( $user_id, true );
1993
+
1994
+ }
1995
+ //if account linking is enable
1996
+ else if ( get_option('mo_openid_account_linking_enable')){
1997
+ mo_openid_start_session();
1998
+ $_SESSION['username'] = $user_name;
1999
+ $_SESSION['user_email'] = $user_email;
2000
+ $_SESSION['user_full_name'] = $user_full_name;
2001
+ $_SESSION['first_name'] = $first_name;
2002
+ $_SESSION['last_name'] = $last_name;
2003
+ $_SESSION['user_url'] = $user_url;
2004
+ $_SESSION['user_picture'] = $user_picture;
2005
+ $_SESSION['social_app_name'] = $social_app_name;
2006
+ $_SESSION['social_user_id'] = $social_user_id;
2007
+ $path = site_url();
2008
+ $path .= '/wp-admin/load-styles.php?c=1&amp;dir=ltr&amp;load%5B%5D=dashicons,buttons,forms,l10n,login&amp;ver=4.8.1';
2009
+ $logo = plugins_url('/includes/images/miniOrange.png',__FILE__);
2010
+ echo mo_openid_account_linking_form($logo,$path);
2011
+ exit;
2012
+ }
2013
+ else {
2014
+ // this user is a guest
2015
+ // auto registration is enabled
2016
+ if(get_option('mo_openid_auto_register_enable')) {
2017
+ $random_password = wp_generate_password( 10, false );
2018
+
2019
+ if( isset($username_user_id) ){
2020
+ $email_array = array();
2021
+ $email_array = explode('@', $user_email);
2022
+ $username = $email_array[0];
2023
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
2024
+ if( isset($username_user_id) ){
2025
+ echo '<br/>This username already exists. Please ask the administrator to create your account with a unique username';
2026
+ exit();
2027
+ }
2028
+ }
2029
+
2030
+ $userdata = array(
2031
+ 'user_login' => $username,
2032
+ 'user_email' => $user_email,
2033
+ 'user_pass' => $random_password,
2034
+ 'display_name' => $user_full_name,
2035
+ 'first_name' => $first_name,
2036
+ 'last_name' => $last_name,
2037
+ 'user_url' => $user_url,
2038
+ );
2039
+
2040
+ $user_id = wp_insert_user( $userdata);
2041
+
2042
+ if(is_wp_error( $user_id )) {
2043
+ //print_r($user_id);
2044
+ wp_die('There was an error in registration. Please contact your administrator.');
2045
+ }
2046
+
2047
+ if( get_option('mo_openid_email_enable') == 1 && get_option('mo_openid_oauth') == 1) {
2048
+ mo_openid_send_email($user_id);
2049
+ }
2050
+
2051
+ mo_openid_start_session();
2052
+ $_SESSION['username'] = $user_name;
2053
+ $_SESSION['user_email'] = $user_email;
2054
+ $_SESSION['user_full_name'] = $user_full_name;
2055
+ $_SESSION['first_name'] = $first_name;
2056
+ $_SESSION['last_name'] = $last_name;
2057
+ $_SESSION['user_url'] = $user_url;
2058
+ $_SESSION['user_picture'] = $user_picture;
2059
+ $_SESSION['social_app_name'] = $social_app_name;
2060
+ $_SESSION['social_user_id'] = $social_user_id;
2061
+
2062
+ $user = get_user_by('id', $user_id );
2063
+ if(get_option('mo_openid_login_role_mapping')){
2064
+ $user->set_role( get_option('mo_openid_login_role_mapping') );
2065
+ }
2066
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
2067
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
2068
+ }
2069
+ $_SESSION['mo_login'] = true;
2070
+
2071
+ //registration hook
2072
+ do_action( 'mo_user_register', $user_id);
2073
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
2074
+ //login hook
2075
+
2076
+ do_action( 'wp_login', $user->user_login, $user );
2077
+ wp_set_auth_cookie( $user_id, true );
2078
+ }
2079
+ $redirect_url = mo_openid_get_redirect_url();
2080
+ wp_redirect($redirect_url);
2081
+ exit;
2082
+ }
2083
+ }
2084
+ }
2085
+ }
2086
+
2087
+ function mo_openid_validate_otp_form($logo,$path, $username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name ,$first_name, $decrypted_app_name, $decrypted_user_id){
2088
+ $html = '<head><link rel="stylesheet" href='.$path.' type="text/css" media="all" /></head>
2089
+
2090
+ <body class="login login-action-login wp-core-ui locale-en-us">
2091
+ <div style="position:fixed;background:#f1f1f1;"></div>
2092
+ <div id="add_field" style="position:fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 1;padding-top:130px;">
2093
+ <div style="width: 500px; margin: 30px auto;">
2094
+ <form name="f" method="post" action="">
2095
+ <div style="background: white;margin-top:-15px;padding: 15px;">
2096
+
2097
+ <span style="margin:120px;font-size: 24px;font-family: Arial">Verify your email</span><br>
2098
+ <div style="padding: 12px;"></div>
2099
+ <div style=" padding: 16px;background-color:rgba(1, 145, 191, 0.117647);color: black;">
2100
+ <span style=" margin-left: 15px;color: black;font-weight: bold;float: right;font-size: 22px;line-height: 20px;cursor: pointer;font-family: Arial;transition: 0.3s"></span>We have sent a verification code to given email. Please verify your account with it.</div> <br>
2101
+ <p>
2102
+ <label for="user_login">Enter your verification code<br/>
2103
+ <input type="text" pattern="\d{4,5}" class="input" name="otp_field" value="" size="20" required/></label>
2104
+ </p>
2105
+ <input type="hidden" name="username_field" value='.$username.'>
2106
+ <input type="hidden" name="email_field" value='.$user_email.'>
2107
+ <input type="hidden" name="first_name" value='.$first_name.'>
2108
+ <input type="hidden" name="last_name" value='.$last_name.'>
2109
+ <input type="hidden" name="user_full_name" value='.$user_full_name.'>
2110
+ <input type="hidden" name="user_url" value='.$user_url.'>
2111
+ <input type="hidden" name="user_picture" value='.$user_picture.'>
2112
+ <input type="hidden" name="transaction_id" value='.$transaction_id.'>
2113
+ <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
2114
+ <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
2115
+ <input type="hidden" name="option" value="mo_openid_otp_validation">
2116
+ </div>
2117
+ <div style="float: right;margin-right: 11px;">
2118
+ <input type="button" onclick="show_profile_completion_form()" name="otp_back" id="back" class="button button-primary button-large" value="Back"/>&emsp;
2119
+ </div>
2120
+ <div style="float: right">
2121
+ <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Submit"/>
2122
+ </div>';
2123
+
2124
+ if(get_option('mo_openid_oauth')=='1' && get_option('moopenid_logo_check') == 1) {
2125
+ $html .= mo_openid_customize_logo();
2126
+ }
2127
+
2128
+ $html.= '</form>
2129
+ <form style="display:none;" name="go_back_form" id="go_back_form" method="post">
2130
+ <input hidden name="option" value="mo_openid_show_profile_form"/>
2131
+ <input type="hidden" name="username_field" value='.$username.'>
2132
+ <input type="hidden" name="email_field" value='.$user_email.'>
2133
+ <input type="hidden" name="first_name" value='.$first_name.'>
2134
+ <input type="hidden" name="last_name" value='.$last_name.'>
2135
+ <input type="hidden" name="user_full_name" value='.$user_full_name.'>
2136
+ <input type="hidden" name="user_url" value='.$user_url.'>
2137
+ <input type="hidden" name="user_picture" value='.$user_picture.'>
2138
+ <input type="hidden" name="transaction_id" value='.$transaction_id.'>
2139
+ <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
2140
+ <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
2141
+ </form>
2142
+ </div>
2143
+ </div>
2144
+ </body>
2145
+ <script>
2146
+ function show_profile_completion_form(){
2147
+ document.getElementById("go_back_form").submit();
2148
+ }
2149
+ </script>';
2150
+ return $html;
2151
+ }
2152
+
2153
+ function mo_openid_username_already_exists($logo,$path,$last_name,$first_name,$user_full_name,$user_url,$user_picture,$username,$user_email, $decrypted_app_name, $decrypted_user_id){
2154
+ $html = '<style>.form-input-validation.is-error {color: #d94f4f;}</style><head><link rel="stylesheet" href='.$path.' type="text/css" media="all" /></head>
2155
+
2156
+ <body class="login login-action-login wp-core-ui locale-en-us">
2157
+ <div style="position:fixed;background:#f1f1f1;"></div>
2158
+ <div id="add_field" style="position:fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 1;padding-top:130px;">
2159
+ <div style="width: 500px; margin: 30px auto;">
2160
+ <form name="f" method="post" action="">
2161
+ <div style="background: white;margin-top:-15px;padding: 15px;">
2162
+
2163
+ <span style="margin:120px;font-size: 24px;font-family: Arial">Profile Completion</span>
2164
+ <p>
2165
+ <label for="user_login">Username<br/>
2166
+ <input type="text" class="input" name="username_field" value='.$username.' size="20" required>
2167
+ <span align="center" class="form-input-validation is-error">Entered username already exists. Try some other username.</span>
2168
+ </label>
2169
+ </p>
2170
+ <br>
2171
+ <p>
2172
+ <label for="user_pass">Email<br />
2173
+ <input type="email" name="email_field" class="input" value='.$user_email.' size="20" required></label>
2174
+ </p>
2175
+ <input type="hidden" name="first_name" value='.$first_name.'>
2176
+ <input type="hidden" name="last_name" value='.$last_name.'>
2177
+ <input type="hidden" name="user_full_name" value='.$user_full_name.'>
2178
+ <input type="hidden" name="user_url" value='.$user_url.'>
2179
+ <input type="hidden" name="user_picture" value='.$user_picture.'>
2180
+ <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
2181
+ <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
2182
+ <input type="hidden" name="option" value="mo_openid_profile_form_submitted">
2183
+ </div>
2184
+ <p class="submit">
2185
+ <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Submit"/>
2186
+ </p> ';
2187
+
2188
+ if(get_option('mo_openid_oauth')=='1' && get_option('moopenid_logo_check') == 1) {
2189
+ $html .= mo_openid_customize_logo();
2190
+ }
2191
+
2192
+ $html.= '</form>
2193
+ </div>
2194
+ </div>
2195
+ </body>';
2196
+ return $html;
2197
+
2198
+ }
2199
+
2200
+ function mo_openid_profile_completion_form($logo,$path,$last_name,$first_name,$user_full_name,$user_url,$user_picture, $decrypted_user_name, $decrypted_email, $decrypted_app_name, $decrypted_user_id){
2201
+ $html = '<style>.form-input-validation.note {color: #d94f4f;}</style>
2202
+ <head><link rel="stylesheet" href='.$path.' type="text/css" media="all" /></head>
2203
+ <body class="login login-action-login wp-core-ui locale-en-us">
2204
+ <div style="position:fixed;background:#f1f1f1;"></div>
2205
+ <div id="add_field" style="position:fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 1;padding-top:70px;">
2206
+ <div style="width: 500px; margin: 30px auto;">
2207
+ <form name="f" method="post" action="">
2208
+ <div style="background: white;margin-top:-15px;padding: 15px;">
2209
+
2210
+ <span style="margin:100px;font-size: 24px;font-family: Arial">Profile Completion</span><br>
2211
+ <div style="padding: 12px;"></div>
2212
+ <div style=" padding: 16px;background-color:rgba(1, 145, 191, 0.117647);color: black;">
2213
+ <span style=" margin-left: 15px;color: black;font-weight: bold;float: right;font-size: 22px;line-height: 20px;cursor: pointer;font-family: Arial;transition: 0.3s"></span>If you are an existing user on this site, enter your registered email and username. If you are a new user, please edit/fill the details</div> <br>
2214
+ <p>
2215
+ <label for="user_login">Username<br/>
2216
+ <input type="text" class="input" name="username_field" size="20" required value='.$decrypted_user_name.'></label>
2217
+ </p>
2218
+ <p>
2219
+ <label for="user_pass">Email<br />
2220
+ <input type="email" class="input" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]+$" name="email_field" size="20" required value='.$decrypted_email.'></label>
2221
+ <span align="center" class="form-input-validation note">We will be sending a verification code to this email to verify it. Please enter a valid email address.</span>
2222
+ </p>
2223
+ <input type="hidden" name="first_name" value='.$first_name.'>
2224
+ <input type="hidden" name="last_name" value='.$last_name.'>
2225
+ <input type="hidden" name="user_full_name" value='.$user_full_name.'>
2226
+ <input type="hidden" name="user_url" value='.$user_url.'>
2227
+ <input type="hidden" name="user_picture" value='.$user_picture.'>
2228
+ <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
2229
+ <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
2230
+ <input type="hidden" name="option" value="mo_openid_profile_form_submitted">
2231
+ </div>
2232
+ <p class="submit">
2233
+ <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Submit"/>
2234
+ </p> ';
2235
+
2236
+ if(get_option('mo_openid_oauth')=='1' && get_option('moopenid_logo_check') == 1) {
2237
+ $html .= mo_openid_customize_logo();
2238
+ }
2239
+
2240
+ $html.= '</form>
2241
+ </div>
2242
+ </div>
2243
+ </body>';
2244
+ return $html;
2245
+ }
2246
+
2247
+ function mo_openid_invalid_otp_form($logo,$path, $first_name, $last_name, $user_full_name, $user_url, $user_picture, $decrypted_app_name, $decrypted_user_id, $username,$user_email, $transaction_id){
2248
+ $html = '<style>.form-input-validation.is-error {color: #d94f4f;}</style>
2249
+ <head><link rel="stylesheet" href='.$path.' type="text/css" media="all" /></head>
2250
+
2251
+ <body class="login login-action-login wp-core-ui locale-en-us">
2252
+ <div style="position:fixed;background:#f1f1f1;"></div>
2253
+ <div id="add_field" style="position:fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 1;padding-top:130px;">
2254
+ <div style="width: 500px; margin: 30px auto;">
2255
+ <form name="f" method="post" action="">
2256
+ <div style="background: white;margin-top:-15px;padding: 15px;">
2257
+
2258
+ <span style="margin:120px;font-size: 24px;font-family: Arial">Verify your email</span>
2259
+
2260
+ <p>
2261
+ <label for="user_login">Enter verification code<br/>
2262
+ <input type="text" pattern="\d{4,5}" class="input" name="otp_field" value="" size="20" required></label>
2263
+ <span align="center" class="form-input-validation is-error">You have entered an invalid verification code. Enter a valid code.</span>
2264
+ </p>
2265
+
2266
+ <input type="hidden" name="first_name" value='.$first_name.'>
2267
+ <input type="hidden" name="last_name" value='.$last_name.'>
2268
+ <input type="hidden" name="user_full_name" value='.$user_full_name.'>
2269
+ <input type="hidden" name="user_url" value='.$user_url.'>
2270
+ <input type="hidden" name="user_picture" value='.$user_picture.'>
2271
+ <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
2272
+ <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
2273
+ <input type="hidden" name="username_field" value='.$username.'>
2274
+ <input type="hidden" name="email_field" value='.$user_email.'>
2275
+ <input type="hidden" name="transaction_id" value='.$transaction_id.'>
2276
+ <input type="hidden" name="option" value="mo_openid_otp_validation">
2277
+ </div>
2278
+ <p class="submit">
2279
+ <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Submit"/>
2280
+ </p> ';
2281
+
2282
+ if(get_option('mo_openid_oauth')=='1' && get_option('moopenid_logo_check') == 1) {
2283
+ $html .= mo_openid_customize_logo();
2284
+ }
2285
+
2286
+ $html .= '</form>
2287
+ </div>
2288
+ </div>
2289
+ </body>';
2290
+ return $html;
2291
+ }
2292
+
2293
+ function mo_openid_account_linking_form($logo,$path){
2294
+ $html = "<head><link rel=\"stylesheet\" href=".$path. " type='text/css' media='all' /><head>
2295
+ <body class='login login-action-login wp-core-ui locale-en-us'>
2296
+ <div style=\"position:fixed;background:#f1f1f1;\"></div>
2297
+ <div id=\"add_field\" style=\"position:fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 1;padding-top:130px;\">
2298
+ <div style=\"width: 500px; margin: 30px auto;\">
2299
+ <form name = 'f' method = 'post' action=''>
2300
+ <input type = 'hidden' name = 'option' value = 'mo_openid_account_linking'/>
2301
+ <div style = 'background-color:white; padding:12px; position:fixed; top:100px; right: 350px; padding-bottom: 20px;left:350px; overflow:hidden; outline:1px black;border-radius: 5px;'>
2302
+
2303
+ <br>
2304
+ <span style='margin:230px;font-size: 24px;font-family: Arial'>Account Linking</span><br>
2305
+ <div style='padding: 12px;'></div>
2306
+ <div style=' padding: 16px;background-color:rgba(1, 145, 191, 0.117647);color: black;'>
2307
+ If you do not have an existing account with a different email address, click on <b>Create a new account</b>.
2308
+ <br><br>
2309
+ If you already have an existing account with a different email adddress and want to link this account with that, click on <b>Link to an existing account</b>. You will be redirected to login page to login to your existing account.
2310
+ </div>
2311
+ <br><br>
2312
+
2313
+ <input type = 'submit' value = 'Link to an existing account?' name = 'mo_openid_link_account' class='button button-primary button-large' style = 'margin-left: 13%;margin-right: 17%;'/>
2314
+
2315
+ <input type = 'submit' value = 'Create a new account?' name = 'mo_openid_create_new_account' class='button button-primary button-large'/>";
2316
+
2317
+ if(get_option('mo_openid_oauth')=='1' && get_option('moopenid_logo_check') == 1) {
2318
+ $html .= mo_openid_customize_logo();
2319
+ }
2320
+
2321
+ $html .= "</div>
2322
+ </form>
2323
+ </div>
2324
+ </div>
2325
+ </body>";
2326
+ return $html;
2327
+ }
2328
+
2329
+ function mo_openid_decrypt_sanitize($param) {
2330
+ if(strcmp($param,'null')!=0 && strcmp($param,'')!=0){
2331
+ $customer_token = get_option('mo_openid_customer_token');
2332
+ $decrypted_token = decrypt_data($param,$customer_token);
2333
+ // removes control characters and some blank characters
2334
+ $decrypted_token_sanitise = preg_replace('/[\x00-\x1F][\x7F][\x81][\x8D][\x8F][\x90][\x9D][\xA0][\xAD]/', '', $decrypted_token);
2335
+ //strips space,tab,newline,carriage return,NUL-byte,vertical tab.
2336
+ return trim($decrypted_token_sanitise);
2337
+ }else{
2338
+ return '';
2339
+ }
2340
+ }
2341
+
2342
+ function mo_openid_link_account( $username, $user ){
2343
+ $userid = '';
2344
+ if($user){
2345
+ $userid = $user->ID;
2346
+ }
2347
+ else{
2348
+ wp_die('No user is returned.');
2349
+ }
2350
+ mo_openid_start_session();
2351
+ $_SESSION['social_user_id'] = isset($_SESSION['social_user_id']) ? $_SESSION['social_user_id']:'';
2352
+ $_SESSION['social_app_name'] = isset($_SESSION['social_app_name']) ? $_SESSION['social_app_name']:'';
2353
+
2354
+ if(isset($userid) && is_null($_SESSION['social_user_id'] ) && is_null($_SESSION['social_app_name']))
2355
+ {
2356
+ return;
2357
+ }
2358
+
2359
+ $user_email = isset($_SESSION['user_email']) ? $_SESSION['user_email']:'';
2360
+ $social_app_identifier = isset($_SESSION['social_user_id']) ? $_SESSION['social_user_id']:'';
2361
+ $social_app_name = isset($_SESSION['social_app_name']) ? $_SESSION['social_app_name']:'';
2362
+ $social_app_name = strtolower($social_app_name);
2363
+
2364
+ global $wpdb;
2365
+ $table_name = $wpdb->prefix . 'mo_openid_linked_user';
2366
+ $db_prefix = $wpdb->prefix;
2367
+ $linked_email_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = \"%s\" AND linked_social_app =\"%s\"",$user_email,$social_app_name));
2368
+
2369
+ if(!isset($linked_email_id)){
2370
+
2371
+ $result = $wpdb->insert(
2372
+ $table_name,
2373
+ array(
2374
+ 'linked_social_app' => $social_app_name,
2375
+ 'linked_email' => $user_email,
2376
+ 'user_id' => $userid,
2377
+ 'identifier' => $social_app_identifier
2378
+ ),
2379
+ array(
2380
+ '%s',
2381
+ '%s',
2382
+ '%d',
2383
+ '%s'
2384
+ )
2385
+ );
2386
+ if($result === false){
2387
+ /*$wpdb->show_errors();
2388
+ $wpdb->print_error();
2389
+ exit;*/
2390
+ wp_die('Error in insert query');
2391
+ }
2392
+
2393
+ }
2394
+ }
2395
+
2396
+ function mo_openid_send_email($user_id=''){
2397
+ global $wpdb;
2398
+ $admin_mail = get_option('mo_openid_admin_email');
2399
+ $user_name = ($user_id=='')?"##UserName##":($wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->users} WHERE ID = %d",$user_id )) );
2400
+ $content = get_option('mo_openid_register_email_message');
2401
+ $from_mail = "no-reply@miniorange.com";
2402
+ $subject = "[".get_bloginfo('name')."] New User Registration - Social Login";
2403
+
2404
+ $content = str_replace('##User Name##',$user_name,$content);
2405
+ $headers = "From: no-reply@miniorange.com\r\n";
2406
+ $headers .= "Content-Type: text/html";
2407
+ wp_mail( $admin_mail, $subject, $content, $headers );
2408
+ }
2409
+
2410
+ function mo_openid_disabled_register_message() {
2411
+ $message = get_option('mo_openid_register_disabled_message').' Go to <a href="' . site_url() .'">Home Page</a>';
2412
+ wp_die($message);
2413
+ }
2414
+
2415
+ function mo_openid_get_redirect_url() {
2416
+
2417
+ $current_url = $_COOKIE["redirect_current_url"];
2418
+ $option = get_option( 'mo_openid_login_redirect' );
2419
+ $redirect_url = site_url();
2420
+
2421
+ if( $option == 'same' ) {
2422
+ if(!is_null($current_url)){
2423
+ $redirect_url = $current_url;
2424
+ }
2425
+ else{
2426
+ if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
2427
+ $http = "https://";
2428
+ } else {
2429
+ $http = "http://";
2430
+ }
2431
+ $redirect_url = urldecode(html_entity_decode(esc_url($http . $_SERVER["HTTP_HOST"] . str_replace('option=moopenid','',$_SERVER['REQUEST_URI']))));
2432
+ if(html_entity_decode(esc_url(remove_query_arg('ss_message', $redirect_url))) == wp_login_url() || strpos($_SERVER['REQUEST_URI'],'wp-login.php') !== FALSE || strpos($_SERVER['REQUEST_URI'],'wp-admin') !== FALSE){
2433
+ $redirect_url = site_url().'/';
2434
+ }
2435
+ }
2436
+ } else if( $option == 'homepage' ) {
2437
+ $redirect_url = site_url();
2438
+ } else if( $option == 'dashboard' ) {
2439
+ $redirect_url = admin_url();
2440
+ } else if( $option == 'custom' ) {
2441
+ $redirect_url = get_option('mo_openid_login_redirect_url');
2442
+ }
2443
+
2444
+ if(strpos($redirect_url,'?') !== FALSE) {
2445
+ $redirect_url .= get_option('mo_openid_auto_register_enable') ? '' : '&autoregister=false';
2446
+ } else{
2447
+ $redirect_url .= get_option('mo_openid_auto_register_enable') ? '' : '?autoregister=false';
2448
+ }
2449
+ return $redirect_url;
2450
+ }
2451
+
2452
+ function mo_openid_redirect_after_logout($logout_url) {
2453
+ if(get_option('mo_openid_logout_redirection_enable')){
2454
+ $option = get_option( 'mo_openid_logout_redirect' );
2455
+ $redirect_url = site_url();
2456
+ if( $option == 'homepage' ) {
2457
+ $redirect_url = $logout_url . '&redirect_to=' .home_url() ;
2458
+ }
2459
+ else if($option == 'currentpage'){
2460
+ if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
2461
+ $http = "https://";
2462
+ } else {
2463
+ $http = "http://";
2464
+ }
2465
+ $redirect_url = $logout_url . '&redirect_to=' . $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
2466
+ }
2467
+ else if($option == 'login') {
2468
+ $redirect_url = $logout_url . '&redirect_to=' . site_url() . '/wp-admin' ;
2469
+ }
2470
+ else if($option == 'custom') {
2471
+ $redirect_url = $logout_url . '&redirect_to=' . site_url() . (null !== get_option('mo_openid_logout_redirect_url')?get_option('mo_openid_logout_redirect_url'):'');
2472
+ }
2473
+ return $redirect_url;
2474
+ }else{
2475
+ return $logout_url;
2476
+ }
2477
+
2478
+ }
2479
+
2480
+ function mo_openid_login_redirect($username = '', $user = NULL){
2481
+ mo_openid_start_session();
2482
+ if(is_string($username) && $username && is_object($user) && !empty($user->ID) && ($user_id = $user->ID) && isset($_SESSION['mo_login']) && $_SESSION['mo_login']){
2483
+ $_SESSION['mo_login'] = false;
2484
+ wp_set_auth_cookie( $user_id, true );
2485
+ $redirect_url = mo_openid_get_redirect_url();
2486
+ wp_redirect($redirect_url);
2487
+ exit;
2488
+ }
2489
+ }
2490
+
2491
  function send_otp_token($email){
2492
+ $otp = wp_rand(1000,99999);
2493
+ $customerKey = get_option('mo_openid_admin_customer_key');
2494
+ $stringToHash = $customerKey . $otp;
2495
+ $transactionId = hash("sha512", $stringToHash);
2496
  //wp_email function will come here
2497
+ $subject= '['.get_bloginfo('name').'] Verification code validation link';
2498
+ $message='Dear User,
2499
 
2500
  Your verification code for completing your profile is: '.$otp.'
2501
 
2502
  Please use this code to complete your profile. Do not share this code with anyone.
2503
 
2504
  Thank you.';
2505
+
2506
+ $response = wp_mail($email, $subject, $message);
2507
+ if($response){
2508
+ mo_openid_start_session();
2509
+ $_SESSION['mo_otptoken'] = true;
2510
+ $_SESSION['sent_on'] = time();
2511
+ $content = array('status' => 'SUCCESS','tId' => $transactionId);
2512
+ }
2513
+ else
2514
+ $content = array('status' => 'FAILURE');
2515
+ return $content;
2516
+ }
2517
+
2518
  function validate_otp_token($transactionId,$otpToken){
2519
+ mo_openid_start_session();
2520
+ $customerKey = get_option('mo_openid_admin_customer_key');
2521
+ if($_SESSION['mo_otptoken']){
2522
+ $pass = checkTimeStamp($_SESSION['sent_on'],time());
2523
+ $pass = checkTransactionId($customerKey, $otpToken, $transactionId, $pass);
2524
+ if($pass)
2525
+ $content = array('status' => 'SUCCESS');
2526
+ else
2527
+ $content = array('status' => 'FAILURE');
2528
+ unset($_SESSION['$mo_otptoken']);
2529
+ }
2530
  else
2531
+ $content = array('status' =>'FAILURE');
2532
+
2533
+ return $content;
2534
  }
2535
+
2536
+ /*
2537
+ * This function checks the time otp was sent to and the time
2538
+ * user is validating the otp. The time difference shouldn't be
2539
+ * more that 60 seconds.
2540
+ *
2541
+ * @param $sentTime - the time otp was sent to
2542
+ * @param $validatedTime - the time otp was validated
2543
+ */
2544
+
 
 
 
 
2545
  function checkTimeStamp($sentTime,$validatedTime){
2546
  $from_time = strtotime($sentTime);
2547
  $to_time = strtotime($validatedTime);
2551
  else
2552
  return true;
2553
  }
2554
+
2555
+ /**
2556
  * This function checks and compares the transaction set in session
2557
  * and one generated during validation. Both need to match for the
2558
  * otp to be validated.
2562
  * @param $transactionId - the transaction id in session
2563
  * @param $pass - the boolean value passed after the time check
2564
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2565
 
2566
+ function checkTransactionId($customerKey,$otpToken,$transactionId,$pass){
2567
+ if(!$pass){
2568
+ return false;
 
 
 
 
 
 
 
 
 
2569
  }
2570
+ $stringToHash = $customerKey . $otpToken;
2571
+ $txtID = hash("sha512", $stringToHash);
2572
+ if($txtID == $transactionId)
2573
+ return true;
2574
  }
2575
 
2576
+ function mo_openid_filter_app_name($decrypted_app_name)
2577
+ {
2578
+ $decrypted_app_name = strtolower($decrypted_app_name);
2579
+ $split_app_name = explode('_', $decrypted_app_name);
2580
+ //check to ensure login starts at the click of social login button
2581
+ if(empty($split_app_name[0])){
2582
+ wp_die('There was an error during login. Please try to login/register manually. <a href='.site_url().'>Go back to site</a>');
2583
+ }
2584
+ else {
2585
+ return $split_app_name[0];
2586
+ }
2587
+ }
2588
+
2589
+ function mo_openid_account_linking($messages) {
2590
+ if(isset( $_GET['option']) && $_GET['option'] == 'disable-social-login' ){
2591
+ $messages = '<p class="message">Link your social account to existing WordPress account by entering username and password.</p>';
 
 
 
 
 
 
 
 
 
 
 
 
2592
  }
2593
+ return $messages;
2594
+ }
2595
 
2596
+ function mo_openid_customize_logo(){
2597
+ $logo =" <div style='float:left;' class='mo_image_id'>
2598
+ <a target='_blank' href='https://www.miniorange.com/'>
2599
+ <img alt='logo' src='". plugins_url('/includes/images/miniOrange.png',__FILE__) ."' class='mo_openid_image'>
2600
+ </a>
2601
+ </div>
2602
+ <br/>";
2603
+ return $logo;
2604
+ }
2605
+
2606
+ //delete rows from account linking table that correspond to deleted user
2607
+ function mo_openid_delete_account_linking_rows($user_id){
2608
+ global $wpdb;
2609
+ $db_prefix = $wpdb->prefix;
2610
+ $result = $wpdb->get_var($wpdb->prepare("DELETE from ".$db_prefix."mo_openid_linked_user where user_id = %s ",$user_id));
2611
+ if($result === false){
2612
+ /*$wpdb->show_errors();
2613
+ $wpdb->print_error();
2614
+ exit;*/
2615
+ wp_die('Error deleting user from account linking table');
2616
+ }
2617
+ }
2618
 
2619
+ if(get_option('mo_openid_logout_redirection_enable') == 1){
2620
+ add_filter( 'logout_url', 'mo_openid_redirect_after_logout',0,1);
2621
  }
2622
+
2623
+ add_action( 'widgets_init', function(){register_widget( "mo_openid_login_wid" );});
2624
+ add_action( 'widgets_init', function(){register_widget( "mo_openid_sharing_ver_wid" );});
2625
+ add_action( 'widgets_init', function(){register_widget( "mo_openid_sharing_hor_wid" );});
2626
+
2627
+ add_action( 'init', 'mo_openid_login_validate' );
2628
+ //add_action( 'init', 'mo_openid_start_session' );
2629
+ //add_action( 'wp_logout', 'mo_openid_end_session' );
2630
+ add_action( 'wp_login', 'mo_openid_login_redirect', 10, 2);
2631
+ add_action( 'wp_login', 'mo_openid_link_account', 9, 2);
2632
+ add_filter( 'login_message', 'mo_openid_account_linking');
2633
+ add_action( 'delete_user', 'mo_openid_delete_account_linking_rows' );
2634
+
2635
+ //compatibility with international characters
2636
+ add_filter('sanitize_user', 'mo_openid_sanitize_user', 10, 3);
2637
+ remove_filter('sanitize_title','sanitize_title_with_dashes', 10);
2638
+ add_filter( 'sanitize_title', 'mo_openid_sanitize_title_with_dashes', 10, 3 );
2639
+
2640
+ function mo_openid_sanitize_user($username, $raw_username, $strict) {
2641
+
2642
+ $username = wp_strip_all_tags( $raw_username );
2643
+ $username = remove_accents( $username );
2644
+ // Kill octets
2645
+ $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
2646
+ $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
2647
+ // If strict, reduce to ASCII and Cyrillic characters for max portability.
2648
+ if ( $strict )
2649
+ $username = preg_replace( '|[^a-zあ-ん\p{Han}а-я0-9ㅂㅈㄷㄱ쇼ㅕㅑㅐㅔㅁㄴㅇㄹ호ㅓㅏㅣㅋㅌㅊ퓨ㅜㅡㅃㅉㄸㄲ썌ㅖ _.\-@]|iu', '', $username );
2650
+ $username = trim( $username );
2651
+ // Consolidate contiguous whitespace
2652
+ $username = preg_replace( '|\s+|', ' ', $username );
2653
+ return $username;
2654
+ }
2655
+
2656
+ function mo_openid_sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) {
2657
+
2658
+ $title = strip_tags($raw_title);
2659
+ // Preserve escaped octets.
2660
+ $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
2661
+ // Remove percent signs that are not part of an octet.
2662
+ $title = str_replace('%', '', $title);
2663
+ // Restore octets.
2664
+ $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
2665
+ if (seems_utf8($title)) {
2666
+ if (function_exists('mb_strtolower')) {
2667
+ $title = mb_strtolower($title, 'UTF-8');
2668
+ }
2669
+ }
2670
+
2671
+ $title = strtolower($title);
2672
+
2673
+ if ( 'save' == $context ) {
2674
+ // Convert nbsp, ndash and mdash to hyphens
2675
+ $title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );
2676
+ // Convert nbsp, ndash and mdash HTML entities to hyphens
2677
+ $title = str_replace( array( '&nbsp;', '&#160;', '&ndash;', '&#8211;', '&mdash;', '&#8212;' ), '-', $title );
2678
+ // Convert forward slash to hyphen
2679
+ $title = str_replace( '/', '-', $title );
2680
+
2681
+ // Strip these characters entirely
2682
+ $title = str_replace( array(
2683
+ // iexcl and iquest
2684
+ '%c2%a1', '%c2%bf',
2685
+ // angle quotes
2686
+ '%c2%ab', '%c2%bb', '%e2%80%b9', '%e2%80%ba',
2687
+ // curly quotes
2688
+ '%e2%80%98', '%e2%80%99', '%e2%80%9c', '%e2%80%9d',
2689
+ '%e2%80%9a', '%e2%80%9b', '%e2%80%9e', '%e2%80%9f',
2690
+ // copy, reg, deg, hellip and trade
2691
+ '%c2%a9', '%c2%ae', '%c2%b0', '%e2%80%a6', '%e2%84%a2',
2692
+ // acute accents
2693
+ '%c2%b4', '%cb%8a', '%cc%81', '%cd%81',
2694
+ // grave accent, macron, caron
2695
+ '%cc%80', '%cc%84', '%cc%8c',
2696
+ ), '', $title );
2697
+ // Convert times to x
2698
+ $title = str_replace( '%c3%97', 'x', $title );
2699
+ }
2700
+
2701
+ $title = preg_replace('/&.+?;/', '', $title); // kill entities
2702
+ $title = str_replace('.', '-', $title);
2703
+
2704
+ //$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
2705
+ $title = preg_replace( '|[^a-zあ-ん\p{Han}а-я0-9ㅂㅈㄷㄱ쇼ㅕㅑㅐㅔㅁㄴㅇㄹ호ㅓㅏㅣㅋㅌㅊ퓨ㅜㅡㅃㅉㄸㄲ썌ㅖ _.\-@]|iu', '', $title );
2706
+ $title = preg_replace('/\s+/', '-', $title);
2707
+ $title = preg_replace('|-+|', '-', $title);
2708
+ $title = trim($title, '-');
2709
+
2710
+ return $title;
2711
+ }
2712
  }
2713
  ?>
class-mo-openid-social-share.php CHANGED
@@ -172,7 +172,7 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
172
  else if( get_option('mo_openid_whatsapp_share_enable') ) {
173
 
174
  ?>
175
- <a rel='nofollow' title="Whatsapp" href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important">
176
  <i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-whatsapp" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
177
  <?php
178
  }
@@ -289,7 +289,7 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
289
  else if( get_option('mo_openid_whatsapp_share_enable') ) {
290
 
291
  ?>
292
- <a rel='nofollow' title="Whatsapp" href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important">
293
  <i class=" <?php echo $selected_theme; ?> fa fa-whatsapp" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
294
  <?php
295
  }
@@ -406,7 +406,7 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
406
  else if( get_option('mo_openid_whatsapp_share_enable') ) {
407
 
408
  ?>
409
- <a rel='nofollow'title="Whatsapp" href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important">
410
  <img alt='Whatsapp' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/whatsapp.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" data-action="share/whatsapp/share"></a>
411
  <?php
412
  }
@@ -530,7 +530,7 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
530
  else if( get_option('mo_openid_whatsapp_share_enable') ) {
531
 
532
  ?>
533
- <a rel='nofollow' title="Whatsapp" href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link">
534
  <i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-whatsapp" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
535
  <?php
536
  }
@@ -647,7 +647,7 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
647
  else if( get_option('mo_openid_whatsapp_share_enable') ) {
648
 
649
  ?>
650
- <a rel='nofollow' title="Whatsapp" href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link">
651
  <i class=" <?php echo $selected_theme; ?> fa fa-whatsapp" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
652
  <?php
653
  }
@@ -764,7 +764,7 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
764
  }
765
  else if( get_option('mo_openid_whatsapp_share_enable')) {
766
  ?>
767
- <a rel='nofollow' title="Whatsapp" href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link">
768
  <img alt='Whatsapp' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/whatsapp.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>"></a>
769
  <?php
770
  }
172
  else if( get_option('mo_openid_whatsapp_share_enable') ) {
173
 
174
  ?>
175
+ <a rel='nofollow' title="Whatsapp" target ='_blank' href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important">
176
  <i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-whatsapp" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
177
  <?php
178
  }
289
  else if( get_option('mo_openid_whatsapp_share_enable') ) {
290
 
291
  ?>
292
+ <a rel='nofollow' title="Whatsapp" target ='_blank' href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important">
293
  <i class=" <?php echo $selected_theme; ?> fa fa-whatsapp" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
294
  <?php
295
  }
406
  else if( get_option('mo_openid_whatsapp_share_enable') ) {
407
 
408
  ?>
409
+ <a rel='nofollow'title="Whatsapp" target ='_blank' href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important">
410
  <img alt='Whatsapp' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/whatsapp.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" data-action="share/whatsapp/share"></a>
411
  <?php
412
  }
530
  else if( get_option('mo_openid_whatsapp_share_enable') ) {
531
 
532
  ?>
533
+ <a rel='nofollow' title="Whatsapp" target ='_blank' href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link">
534
  <i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-whatsapp" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
535
  <?php
536
  }
647
  else if( get_option('mo_openid_whatsapp_share_enable') ) {
648
 
649
  ?>
650
+ <a rel='nofollow' title="Whatsapp" target ='_blank' href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link">
651
  <i class=" <?php echo $selected_theme; ?> fa fa-whatsapp" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
652
  <?php
653
  }
764
  }
765
  else if( get_option('mo_openid_whatsapp_share_enable')) {
766
  ?>
767
+ <a rel='nofollow' title="Whatsapp" target ='_blank' href='https://web.whatsapp.com/send?text=<?php echo $url?>' class="mo-openid-share-link">
768
  <img alt='Whatsapp' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/whatsapp.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>"></a>
769
  <?php
770
  }
class-mo-openid-sso-customer.php CHANGED
@@ -29,7 +29,7 @@ class CustomerOpenID {
29
 
30
  private $defaultCustomerKey = "16555";
31
  private $defaultApiKey = "fFd2XcvTGDemZvbw1bcUesNJWEqKbbUq";
32
-
33
  function create_customer(){
34
 
35
  $url = get_option('mo_openid_host_name') . '/moas/rest/customer/add';
@@ -41,7 +41,7 @@ class CustomerOpenID {
41
  $company = get_option('mo_openid_admin_company_name');
42
  $first_name = get_option('mo_openid_admin_first_name');
43
  $last_name = get_option('mo_openid_admin_last_name');
44
- $password = get_option('mo_openid_admin_password');
45
 
46
  $fields = array(
47
  'companyName' => $company,
@@ -64,12 +64,6 @@ class CustomerOpenID {
64
  curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF - 8', 'Authorization: Basic' ) );
65
  curl_setopt( $ch, CURLOPT_POST, true );
66
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string );
67
- if(defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')){
68
- curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
69
- curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
70
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
71
- curl_setopt($ch, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME.':'.WP_PROXY_PASSWORD);
72
- }
73
  $content = curl_exec( $ch );
74
 
75
  if( curl_errno( $ch ) ){
@@ -104,12 +98,6 @@ class CustomerOpenID {
104
  curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF - 8', 'Authorization: Basic' ) );
105
  curl_setopt( $ch, CURLOPT_POST, true);
106
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
107
- if(defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')){
108
- curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
109
- curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
110
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
111
- curl_setopt($ch, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME.':'.WP_PROXY_PASSWORD);
112
- }
113
  $content = curl_exec( $ch );
114
  if( curl_errno( $ch ) ){
115
  echo 'Request Error:' . curl_error( $ch );
@@ -140,12 +128,6 @@ class CustomerOpenID {
140
  curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF - 8', 'Authorization: Basic' ) );
141
  curl_setopt( $ch, CURLOPT_POST, true);
142
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
143
- if(defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')){
144
- curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
145
- curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
146
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
147
- curl_setopt($ch, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME.':'.WP_PROXY_PASSWORD);
148
- }
149
  $content = curl_exec( $ch );
150
  if( curl_errno( $ch ) ){
151
  echo 'Request Error:' . curl_error( $ch );
@@ -172,7 +154,7 @@ class CustomerOpenID {
172
  $hashValue = hash("sha512", $stringToHash);
173
 
174
  $customerKeyHeader = "Customer-Key: " . $customerKey;
175
- $timestampHeader = "Timestamp: " .number_format($currentTimeInMillis, 0, '', '');
176
  $authorizationHeader = "Authorization: " . $hashValue;
177
  if($authType == 'EMAIL') {
178
  $fields = array(
@@ -202,12 +184,6 @@ class CustomerOpenID {
202
  $timestampHeader, $authorizationHeader));
203
  curl_setopt( $ch, CURLOPT_POST, true);
204
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
205
- if(defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')){
206
- curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
207
- curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
208
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
209
- curl_setopt($ch, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME.':'.WP_PROXY_PASSWORD);
210
- }
211
  $content = curl_exec($ch);
212
 
213
  if(curl_errno($ch)){
@@ -234,7 +210,7 @@ class CustomerOpenID {
234
  $hashValue = hash("sha512", $stringToHash);
235
 
236
  $customerKeyHeader = "Customer-Key: " . $customerKey;
237
- $timestampHeader = "Timestamp: " .number_format($currentTimeInMillis, 0, '', '');
238
  $authorizationHeader = "Authorization: " . $hashValue;
239
  $fields = array(
240
  'customerId' => $customerKey,
@@ -253,12 +229,6 @@ class CustomerOpenID {
253
  $timestampHeader, $authorizationHeader));
254
  curl_setopt( $ch, CURLOPT_POST, true);
255
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
256
- if(defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')){
257
- curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
258
- curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
259
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
260
- curl_setopt($ch, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME.':'.WP_PROXY_PASSWORD);
261
- }
262
  $content = curl_exec($ch);
263
 
264
  if(curl_errno($ch)){
@@ -286,7 +256,7 @@ class CustomerOpenID {
286
  $hashValue = hash("sha512", $stringToHash);
287
 
288
  $customerKeyHeader = "Customer-Key: " . $customerKey;
289
- $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
290
  $authorizationHeader = "Authorization: " . $hashValue;
291
 
292
  $fields = '';
@@ -310,12 +280,6 @@ class CustomerOpenID {
310
  $timestampHeader, $authorizationHeader));
311
  curl_setopt( $ch, CURLOPT_POST, true);
312
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
313
- if(defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')){
314
- curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
315
- curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
316
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
317
- curl_setopt($ch, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME.':'.WP_PROXY_PASSWORD);
318
- }
319
  $content = curl_exec($ch);
320
 
321
  if(curl_errno($ch)){
@@ -332,7 +296,7 @@ class CustomerOpenID {
332
  $company = get_option('mo_openid_admin_company_name') ? get_option('mo_openid_admin_company_name') : '';
333
  $first_name = get_option('mo_openid_admin_first_name') ? get_option('mo_openid_admin_first_name') : '';
334
  $last_name = get_option('mo_openid_admin_last_name') ? get_option('mo_openid_admin_last_name') : '';
335
- $query = '[WP OpenID Connect Login Plugin] ' . $query;
336
  $fields = array(
337
  'firstName' => $first_name,
338
  'lastName' => $last_name,
@@ -356,12 +320,6 @@ class CustomerOpenID {
356
  curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF-8', 'Authorization: Basic' ) );
357
  curl_setopt( $ch, CURLOPT_POST, true);
358
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
359
- if(defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')){
360
- curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
361
- curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
362
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
363
- curl_setopt($ch, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME.':'.WP_PROXY_PASSWORD);
364
- }
365
  $content = curl_exec( $ch );
366
 
367
  if( curl_errno( $ch ) ){
@@ -394,7 +352,7 @@ class CustomerOpenID {
394
  $hashValue = hash("sha512", $stringToHash);
395
 
396
  $customerKeyHeader = "Customer-Key: " . $customerKey;
397
- $timestampHeader = "Timestamp: " .number_format($currentTimeInMillis, 0, '', '');
398
  $authorizationHeader = "Authorization: " . $hashValue;
399
 
400
  $fields = '';
@@ -419,12 +377,6 @@ class CustomerOpenID {
419
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
420
  curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
421
  curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
422
- if(defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')){
423
- curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
424
- curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
425
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
426
- curl_setopt($ch, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME.':'.WP_PROXY_PASSWORD);
427
- }
428
  $content = curl_exec($ch);
429
 
430
  if(curl_errno($ch)){
@@ -433,5 +385,4 @@ class CustomerOpenID {
433
  curl_close($ch);
434
  return $content;
435
  }
436
-
437
  }?>
29
 
30
  private $defaultCustomerKey = "16555";
31
  private $defaultApiKey = "fFd2XcvTGDemZvbw1bcUesNJWEqKbbUq";
32
+
33
  function create_customer(){
34
 
35
  $url = get_option('mo_openid_host_name') . '/moas/rest/customer/add';
41
  $company = get_option('mo_openid_admin_company_name');
42
  $first_name = get_option('mo_openid_admin_first_name');
43
  $last_name = get_option('mo_openid_admin_last_name');
44
+ $password = get_option('mo_openid_admin_password');
45
 
46
  $fields = array(
47
  'companyName' => $company,
64
  curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF - 8', 'Authorization: Basic' ) );
65
  curl_setopt( $ch, CURLOPT_POST, true );
66
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string );
 
 
 
 
 
 
67
  $content = curl_exec( $ch );
68
 
69
  if( curl_errno( $ch ) ){
98
  curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF - 8', 'Authorization: Basic' ) );
99
  curl_setopt( $ch, CURLOPT_POST, true);
100
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
 
 
 
 
 
 
101
  $content = curl_exec( $ch );
102
  if( curl_errno( $ch ) ){
103
  echo 'Request Error:' . curl_error( $ch );
128
  curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF - 8', 'Authorization: Basic' ) );
129
  curl_setopt( $ch, CURLOPT_POST, true);
130
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
 
 
 
 
 
 
131
  $content = curl_exec( $ch );
132
  if( curl_errno( $ch ) ){
133
  echo 'Request Error:' . curl_error( $ch );
154
  $hashValue = hash("sha512", $stringToHash);
155
 
156
  $customerKeyHeader = "Customer-Key: " . $customerKey;
157
+ $timestampHeader = "Timestamp: " . $currentTimeInMillis;
158
  $authorizationHeader = "Authorization: " . $hashValue;
159
  if($authType == 'EMAIL') {
160
  $fields = array(
184
  $timestampHeader, $authorizationHeader));
185
  curl_setopt( $ch, CURLOPT_POST, true);
186
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
 
 
 
 
 
 
187
  $content = curl_exec($ch);
188
 
189
  if(curl_errno($ch)){
210
  $hashValue = hash("sha512", $stringToHash);
211
 
212
  $customerKeyHeader = "Customer-Key: " . $customerKey;
213
+ $timestampHeader = "Timestamp: " . $currentTimeInMillis;
214
  $authorizationHeader = "Authorization: " . $hashValue;
215
  $fields = array(
216
  'customerId' => $customerKey,
229
  $timestampHeader, $authorizationHeader));
230
  curl_setopt( $ch, CURLOPT_POST, true);
231
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
 
 
 
 
 
 
232
  $content = curl_exec($ch);
233
 
234
  if(curl_errno($ch)){
256
  $hashValue = hash("sha512", $stringToHash);
257
 
258
  $customerKeyHeader = "Customer-Key: " . $customerKey;
259
+ $timestampHeader = "Timestamp: " . $currentTimeInMillis;
260
  $authorizationHeader = "Authorization: " . $hashValue;
261
 
262
  $fields = '';
280
  $timestampHeader, $authorizationHeader));
281
  curl_setopt( $ch, CURLOPT_POST, true);
282
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
 
 
 
 
 
 
283
  $content = curl_exec($ch);
284
 
285
  if(curl_errno($ch)){
296
  $company = get_option('mo_openid_admin_company_name') ? get_option('mo_openid_admin_company_name') : '';
297
  $first_name = get_option('mo_openid_admin_first_name') ? get_option('mo_openid_admin_first_name') : '';
298
  $last_name = get_option('mo_openid_admin_last_name') ? get_option('mo_openid_admin_last_name') : '';
299
+ $query = '[WP OpenID Connect Login Free Plugin] ' . $query;
300
  $fields = array(
301
  'firstName' => $first_name,
302
  'lastName' => $last_name,
320
  curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF-8', 'Authorization: Basic' ) );
321
  curl_setopt( $ch, CURLOPT_POST, true);
322
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
 
 
 
 
 
 
323
  $content = curl_exec( $ch );
324
 
325
  if( curl_errno( $ch ) ){
352
  $hashValue = hash("sha512", $stringToHash);
353
 
354
  $customerKeyHeader = "Customer-Key: " . $customerKey;
355
+ $timestampHeader = "Timestamp: " . $currentTimeInMillis;
356
  $authorizationHeader = "Authorization: " . $hashValue;
357
 
358
  $fields = '';
377
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
378
  curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
379
  curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
 
 
 
 
 
 
380
  $content = curl_exec($ch);
381
 
382
  if(curl_errno($ch)){
385
  curl_close($ch);
386
  return $content;
387
  }
 
388
  }?>
class-mo-openid-sso-shortcode-buttons.php CHANGED
@@ -118,7 +118,7 @@ function mo_openid_share_shortcode( $atts = '', $title = '', $excerpt = '' ) {
118
  if( get_option('mo_openid_whatsapp_share_enable') ) {
119
 
120
  if(!wp_is_mobile()){
121
- $html .= '<a rel="nofollow" title="Whatsapp" href="https://web.whatsapp.com/send?text=' . $url .'" class="mo-openid-share-link" style="margin-left : '.($spaceBetweenIcons) . 'px !important;border-bottom:0px !important;"><i class="mo-custom-share-icon ' .$selected_theme. ' fa fa-whatsapp" style="padding-top:8px;text-align:center;color:#ffffff;font-size: '.($sharingSize-16). 'px !important;background-color:#' .$custom_color. ';height: '.$sharingSize. 'px !important;width:' .$sharingSize. 'px !important;"></i></a>';
122
  }
123
  else{
124
  $html .= '<a rel="nofollow" title="Whatsapp" href="whatsapp://send?text=' . $url .'" class="mo-openid-share-link" style="margin-left : '.($spaceBetweenIcons) . 'px !important;border-bottom:0px !important;"><i class="mo-custom-share-icon ' .$selected_theme. ' fa fa-whatsapp" style="padding-top:8px;text-align:center;color:#ffffff;font-size: '.($sharingSize-16). 'px !important;background-color:#' .$custom_color. ';height: '.$sharingSize. 'px !important;width:' .$sharingSize. 'px !important;"></i></a>';
@@ -199,7 +199,7 @@ function mo_openid_share_shortcode( $atts = '', $title = '', $excerpt = '' ) {
199
  $html .= '<a rel="nofollow" title="Whatsapp" href="whatsapp://send?text=' . $url . '" class="mo-openid-share-link" style="margin-left : '.($spaceBetweenIcons-6) . 'px !important;border-bottom:0px !important;"><i class=" '.$selected_theme. ' fa fa-whatsapp" style="padding-top:4px;text-align:center;color:'.$fontColor . ';font-size:' .$sharingSize. 'px !important;height:' .$sharingSize. 'px !important;width:' .$sharingSize. 'px !important;"></i></a>';
200
  }
201
  else{
202
- $html .= '<a rel="nofollow" title="Whatsapp" href="https://web.whatsapp.com/send?text=' . $url . '" class="mo-openid-share-link" style="margin-left : '.($spaceBetweenIcons-6) . 'px !important;border-bottom:0px !important;"><i class=" '.$selected_theme. ' fa fa-whatsapp" style="padding-top:4px;text-align:center;color:'.$fontColor . ';font-size:' .$sharingSize. 'px !important;height:' .$sharingSize. 'px !important;width:' .$sharingSize. 'px !important;"></i></a>';
203
  }
204
  }
205
 
@@ -278,7 +278,7 @@ function mo_openid_share_shortcode( $atts = '', $title = '', $excerpt = '' ) {
278
  <img alt="Whatsapp" style= "height: '. $sharingSize . 'px !important;width: '. $sharingSize . 'px !important;" src=" '. plugins_url( "includes/images/icons/whatsapp.png", __FILE__ ) . '" class="mo-openid-app-share-icons '. $selected_theme . '" ></a>';
279
  }
280
  else{
281
- $html .= '<a rel="nofollow" title="Whatsapp" href="https://web.whatsapp.com/send?text=' . $url . '" class="mo-openid-share-link" style="margin-left : '. ($spaceBetweenIcons) . 'px !important; border-bottom:0px !important;">
282
  <img alt="Whatsapp" style= "height: '. $sharingSize . 'px !important;width: '. $sharingSize . 'px !important;" src=" '. plugins_url( "includes/images/icons/whatsapp.png", __FILE__ ) . '" class="mo-openid-app-share-icons '. $selected_theme . '" ></a>';
283
  }
284
 
@@ -434,7 +434,7 @@ function mo_openid_vertical_share_shortcode( $atts = '', $title = '', $excerpt =
434
  $html .= '<a rel="nofollow" title="Whatsapp" href="whatsapp://send?text=' . $url ."\" class='mo-openid-share-link' ><i class='mo-custom-share-icon " .$selected_theme. " fa fa-whatsapp' style='margin-bottom : " . ($spaceBetweenIcons-4) . "px !important;padding-top:8px;text-align:center;color:#ffffff;font-size:" .($sharingSize-16). "px !important;background-color:#" .$custom_color. ";height:" .$sharingSize. "px !important;width:" .$sharingSize. "px !important;'></i></a>";
435
  }
436
  else{
437
- $html .= '<a rel="nofollow" title="Whatsapp" href="https://web.whatsapp.com/send?text=' . $url ."\" class='mo-openid-share-link' ><i class='mo-custom-share-icon " .$selected_theme. " fa fa-whatsapp' style='margin-bottom : " . ($spaceBetweenIcons-4) . "px !important;padding-top:8px;text-align:center;color:#ffffff;font-size:" .($sharingSize-16). "px !important;background-color:#" .$custom_color. ";height:" .$sharingSize. "px !important;width:" .$sharingSize. "px !important;'></i></a>";
438
  }
439
  }
440
 
@@ -510,7 +510,7 @@ function mo_openid_vertical_share_shortcode( $atts = '', $title = '', $excerpt =
510
  $html .= '<a rel="nofollow" title="Whatsapp" href="whatsapp://send?text=' . $url ."\" class='mo-openid-share-link' ><i class='fa fa-whatsapp' style='margin-bottom : " . ($spaceBetweenIcons-4) . "px !important;padding-top:4px;text-align:center;color:" .$fontColor . ";font-size:" .$sharingSize. "px !important;height:" .$sharingSize. "px !important;width:" .$sharingSize. "px !important;'></i></a>";
511
  }
512
  else{
513
- $html .= '<a rel="nofollow" title="Whatsapp" href="https://web.whatsapp.com/send?text=' . $url ."\" class='mo-openid-share-link' ><i class='fa fa-whatsapp' style='margin-bottom : " . ($spaceBetweenIcons-4) . "px !important;padding-top:4px;text-align:center;color:" .$fontColor . ";font-size:" .$sharingSize. "px !important;height:" .$sharingSize. "px !important;width:" .$sharingSize. "px !important;'></i></a>";
514
  }
515
  }
516
 
@@ -584,7 +584,7 @@ function mo_openid_vertical_share_shortcode( $atts = '', $title = '', $excerpt =
584
  $html .= '<a rel="nofollow" title="Whatsapp" href="whatsapp://send?text=' . $url ."\" class='mo-openid-share-link'><img alt='Whatsapp' style= 'margin-bottom : " . ($spaceBetweenIcons-6) . "px !important;height: " . $sharingSize . "px !important;width: " . $sharingSize . "px !important;' src='" . plugins_url( 'includes/images/icons/whatsapp.png', __FILE__ ) . "' class='mo-openid-app-share-icons " . $selected_theme . "' ></a>";
585
  }
586
  else{
587
- $html .= '<a rel="nofollow" title="Whatsapp" href="https://web.whatsapp.com/send?text=' . $url ."\" class='mo-openid-share-link'><img alt='Whatsapp' style= 'margin-bottom : " . ($spaceBetweenIcons-6) . "px !important;height: " . $sharingSize . "px !important;width: " . $sharingSize . "px !important;' src='" . plugins_url( 'includes/images/icons/whatsapp.png', __FILE__ ) . "' class='mo-openid-app-share-icons " . $selected_theme . "' ></a>";
588
  }
589
  }
590
 
118
  if( get_option('mo_openid_whatsapp_share_enable') ) {
119
 
120
  if(!wp_is_mobile()){
121
+ $html .= '<a rel="nofollow" title="Whatsapp" target ="_blank" href="https://web.whatsapp.com/send?text=' . $url .'" class="mo-openid-share-link" style="margin-left : '.($spaceBetweenIcons) . 'px !important;border-bottom:0px !important;"><i class="mo-custom-share-icon ' .$selected_theme. ' fa fa-whatsapp" style="padding-top:8px;text-align:center;color:#ffffff;font-size: '.($sharingSize-16). 'px !important;background-color:#' .$custom_color. ';height: '.$sharingSize. 'px !important;width:' .$sharingSize. 'px !important;"></i></a>';
122
  }
123
  else{
124
  $html .= '<a rel="nofollow" title="Whatsapp" href="whatsapp://send?text=' . $url .'" class="mo-openid-share-link" style="margin-left : '.($spaceBetweenIcons) . 'px !important;border-bottom:0px !important;"><i class="mo-custom-share-icon ' .$selected_theme. ' fa fa-whatsapp" style="padding-top:8px;text-align:center;color:#ffffff;font-size: '.($sharingSize-16). 'px !important;background-color:#' .$custom_color. ';height: '.$sharingSize. 'px !important;width:' .$sharingSize. 'px !important;"></i></a>';
199
  $html .= '<a rel="nofollow" title="Whatsapp" href="whatsapp://send?text=' . $url . '" class="mo-openid-share-link" style="margin-left : '.($spaceBetweenIcons-6) . 'px !important;border-bottom:0px !important;"><i class=" '.$selected_theme. ' fa fa-whatsapp" style="padding-top:4px;text-align:center;color:'.$fontColor . ';font-size:' .$sharingSize. 'px !important;height:' .$sharingSize. 'px !important;width:' .$sharingSize. 'px !important;"></i></a>';
200
  }
201
  else{
202
+ $html .= '<a rel="nofollow" title="Whatsapp" target ="_blank" href="https://web.whatsapp.com/send?text=' . $url . '" class="mo-openid-share-link" style="margin-left : '.($spaceBetweenIcons-6) . 'px !important;border-bottom:0px !important;"><i class=" '.$selected_theme. ' fa fa-whatsapp" style="padding-top:4px;text-align:center;color:'.$fontColor . ';font-size:' .$sharingSize. 'px !important;height:' .$sharingSize. 'px !important;width:' .$sharingSize. 'px !important;"></i></a>';
203
  }
204
  }
205
 
278
  <img alt="Whatsapp" style= "height: '. $sharingSize . 'px !important;width: '. $sharingSize . 'px !important;" src=" '. plugins_url( "includes/images/icons/whatsapp.png", __FILE__ ) . '" class="mo-openid-app-share-icons '. $selected_theme . '" ></a>';
279
  }
280
  else{
281
+ $html .= '<a rel="nofollow" title="Whatsapp" target ="_blank" href="https://web.whatsapp.com/send?text=' . $url . '" class="mo-openid-share-link" style="margin-left : '. ($spaceBetweenIcons) . 'px !important; border-bottom:0px !important;">
282
  <img alt="Whatsapp" style= "height: '. $sharingSize . 'px !important;width: '. $sharingSize . 'px !important;" src=" '. plugins_url( "includes/images/icons/whatsapp.png", __FILE__ ) . '" class="mo-openid-app-share-icons '. $selected_theme . '" ></a>';
283
  }
284
 
434
  $html .= '<a rel="nofollow" title="Whatsapp" href="whatsapp://send?text=' . $url ."\" class='mo-openid-share-link' ><i class='mo-custom-share-icon " .$selected_theme. " fa fa-whatsapp' style='margin-bottom : " . ($spaceBetweenIcons-4) . "px !important;padding-top:8px;text-align:center;color:#ffffff;font-size:" .($sharingSize-16). "px !important;background-color:#" .$custom_color. ";height:" .$sharingSize. "px !important;width:" .$sharingSize. "px !important;'></i></a>";
435
  }
436
  else{
437
+ $html .= '<a rel="nofollow" title="Whatsapp" target ="_blank" href="https://web.whatsapp.com/send?text=' . $url ."\" class='mo-openid-share-link' ><i class='mo-custom-share-icon " .$selected_theme. " fa fa-whatsapp' style='margin-bottom : " . ($spaceBetweenIcons-4) . "px !important;padding-top:8px;text-align:center;color:#ffffff;font-size:" .($sharingSize-16). "px !important;background-color:#" .$custom_color. ";height:" .$sharingSize. "px !important;width:" .$sharingSize. "px !important;'></i></a>";
438
  }
439
  }
440
 
510
  $html .= '<a rel="nofollow" title="Whatsapp" href="whatsapp://send?text=' . $url ."\" class='mo-openid-share-link' ><i class='fa fa-whatsapp' style='margin-bottom : " . ($spaceBetweenIcons-4) . "px !important;padding-top:4px;text-align:center;color:" .$fontColor . ";font-size:" .$sharingSize. "px !important;height:" .$sharingSize. "px !important;width:" .$sharingSize. "px !important;'></i></a>";
511
  }
512
  else{
513
+ $html .= '<a rel="nofollow" title="Whatsapp" target ="_blank" href="https://web.whatsapp.com/send?text=' . $url ."\" class='mo-openid-share-link' ><i class='fa fa-whatsapp' style='margin-bottom : " . ($spaceBetweenIcons-4) . "px !important;padding-top:4px;text-align:center;color:" .$fontColor . ";font-size:" .$sharingSize. "px !important;height:" .$sharingSize. "px !important;width:" .$sharingSize. "px !important;'></i></a>";
514
  }
515
  }
516
 
584
  $html .= '<a rel="nofollow" title="Whatsapp" href="whatsapp://send?text=' . $url ."\" class='mo-openid-share-link'><img alt='Whatsapp' style= 'margin-bottom : " . ($spaceBetweenIcons-6) . "px !important;height: " . $sharingSize . "px !important;width: " . $sharingSize . "px !important;' src='" . plugins_url( 'includes/images/icons/whatsapp.png', __FILE__ ) . "' class='mo-openid-app-share-icons " . $selected_theme . "' ></a>";
585
  }
586
  else{
587
+ $html .= '<a rel="nofollow" title="Whatsapp" target ="_blank" href="https://web.whatsapp.com/send?text=' . $url ."\" class='mo-openid-share-link'><img alt='Whatsapp' style= 'margin-bottom : " . ($spaceBetweenIcons-6) . "px !important;height: " . $sharingSize . "px !important;width: " . $sharingSize . "px !important;' src='" . plugins_url( 'includes/images/icons/whatsapp.png', __FILE__ ) . "' class='mo-openid-app-share-icons " . $selected_theme . "' ></a>";
588
  }
589
  }
590
 
includes/css/bootstrap.min.css CHANGED
@@ -457,3 +457,96 @@ input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-
457
  border-top-left-radius: 0;
458
  border-top-right-radius: 0
459
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457
  border-top-left-radius: 0;
458
  border-top-right-radius: 0
459
  }
460
+ .button,
461
+ .button-primary,
462
+ .button-secondary {
463
+ display: inline-block;
464
+ text-decoration: none;
465
+ font-size: 13px;
466
+ line-height: 26px;
467
+ height: 28px;
468
+ margin: 0;
469
+ padding: 0 10px 1px;
470
+ cursor: pointer;
471
+ border-width: 1px;
472
+ border-style: solid;
473
+ -webkit-appearance: none;
474
+ -webkit-border-radius: 3px;
475
+ border-radius: 3px;
476
+ white-space: nowrap;
477
+ -webkit-box-sizing: border-box;
478
+ -moz-box-sizing: border-box;
479
+ box-sizing: border-box;
480
+ }
481
+
482
+ .button,
483
+ .button-secondary {
484
+ color: #555;
485
+ border-color: #cccccc;
486
+ background: #f7f7f7;
487
+ -webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0,0,0,.08);
488
+ box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0,0,0,.08);
489
+ vertical-align: top;
490
+ }
491
+
492
+ p .button {
493
+ vertical-align: baseline;
494
+ }
495
+
496
+ .button:hover,
497
+ .button-secondary:hover,
498
+ .button:focus,
499
+ .button-secondary:focus {
500
+ background: #fafafa;
501
+ border-color: #999;
502
+ color: #222;
503
+ }
504
+
505
+ .button:focus,
506
+ .button-secondary:focus {
507
+ -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,.2);
508
+ box-shadow: 1px 1px 1px rgba(0,0,0,.2);
509
+ }
510
+
511
+ .button:active,
512
+ .button-secondary:active {
513
+ background: #eee;
514
+ border-color: #999;
515
+ color: #333;
516
+ -webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
517
+ box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
518
+ }
519
+
520
+ .button-primary {
521
+ background: #2ea2cc;
522
+ border-color: #0074a2;
523
+ -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.5), 0 1px 0 rgba(0,0,0,.15);
524
+ box-shadow: inset 0 1px 0 rgba(120,200,230,0.5), 0 1px 0 rgba(0,0,0,.15);
525
+ color: #fff;
526
+ text-decoration: none;
527
+ }
528
+
529
+ .button-primary:hover,
530
+ .button-primary:focus {
531
+ background: #1e8cbe;
532
+ border-color: #0074a2;
533
+ -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
534
+ box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
535
+ color: #fff;
536
+ }
537
+
538
+ .button-primary:focus {
539
+ border-color: #0e3950;
540
+ -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6), 1px 1px 2px rgba(0,0,0,0.4);
541
+ box-shadow: inset 0 1px 0 rgba(120,200,230,0.6), 1px 1px 2px rgba(0,0,0,0.4);
542
+ }
543
+
544
+ .button-primary:active {
545
+ background: #1b7aa6;
546
+ border-color: #005684;
547
+ color: rgba(255,255,255,0.95);
548
+ -webkit-box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
549
+ box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
550
+ vertical-align: top;
551
+ }
552
+
includes/css/mo_openid_style.css CHANGED
@@ -11,6 +11,42 @@
11
  margin-top:10px;
12
  padding-left:10px;
13
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  .mo_openid_support_layout{
15
  width: 93%;
16
  background-color:#FFFFFF;
@@ -68,14 +104,29 @@
68
  }
69
 
70
  .mo-openid-app-share-icons{
71
- width:35px !important;
72
- height:35px !important;
73
- display:inline !important;
74
  }
75
 
76
  .mo-openid-share-link{
77
- border-bottom: 0px !important;
78
- box-sizing:border-box !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
  .circle{
11
  margin-top:10px;
12
  padding-left:10px;
13
  }
14
+
15
+ .mo_table-bordered, .mo_table-bordered>tbody>tr>td{
16
+ border: 1px solid #ddd;
17
+ }
18
+
19
+ .mo_table-bordered>thead>tr>th{
20
+ vertical-align:top !important;
21
+ }
22
+
23
+ .mo-fa-icon>tr>td>i.fa{
24
+ color:#5b8a0f;
25
+
26
+ }
27
+
28
+ .mo_table-striped>tbody>tr:nth-of-type(odd) {
29
+ background-color: #f9f9f9;
30
+ }
31
+
32
+ .mo_align-center>tr>td{
33
+ text-align:center !important;
34
+ }
35
+
36
+
37
+ .mo_table_layout {
38
+ background-color:#FFFFFF;
39
+ border:1px solid #CCCCCC;
40
+ padding:0px 10px 10px 10px;
41
+ margin-bottom: 10px;
42
+ }
43
+
44
+ .mo_table_layout input['type=text'] {
45
+ width: 80%;
46
+ }
47
+ .mo_table_layout td strong {
48
+ margin-left: 10px;
49
+ }
50
  .mo_openid_support_layout{
51
  width: 93%;
52
  background-color:#FFFFFF;
104
  }
105
 
106
  .mo-openid-app-share-icons{
107
+ width:35px !important;
108
+ height:35px !important;
109
+ display:inline !important;
110
  }
111
 
112
  .mo-openid-share-link{
113
+ border-bottom: 0px !important;
114
+ box-sizing:border-box !important;
115
+ }
116
+ .mo_image_id {
117
+ width: 40%;
118
+ }
119
+
120
+ div.mo_image_id>a>img.mo_openid_image {
121
+ opacity: 0.6;
122
+ display: block;
123
+ transition: .5s ease;
124
+ backface-visibility: hidden;
125
+ }
126
+
127
+
128
+ .mo_image_id:hover .mo_openid_image {
129
+ opacity: 1;
130
  }
131
 
132
  .circle{
includes/images/miniOrange.png ADDED
Binary file
includes/js/settings.js CHANGED
@@ -10,6 +10,9 @@ jQuery(document).ready(function () {
10
  jQuery("#openid_sharing_shortcode_title").click(function () {
11
  jQuery("#openid_sharing_shortcode").slideToggle(400);
12
  });
 
 
 
13
  jQuery("#openid_shortcode_inphp_title").click(function () {
14
  jQuery("#openid_shortcode_inphp").slideToggle(400);
15
  });
@@ -73,6 +76,9 @@ jQuery(document).ready(function () {
73
  jQuery("#openid_question_curl").click(function () {
74
  jQuery("#openid_question_curl_desc").slideToggle(400);
75
  });
 
 
 
76
  jQuery("#openid_question_otp").click(function () {
77
  jQuery("#openid_question_otp_desc").slideToggle(400);
78
  });
10
  jQuery("#openid_sharing_shortcode_title").click(function () {
11
  jQuery("#openid_sharing_shortcode").slideToggle(400);
12
  });
13
+ jQuery("#openid_comments_shortcode_title").click(function () {
14
+ jQuery("#openid_comments_shortcode").slideToggle(400);
15
+ });
16
  jQuery("#openid_shortcode_inphp_title").click(function () {
17
  jQuery("#openid_shortcode_inphp").slideToggle(400);
18
  });
76
  jQuery("#openid_question_curl").click(function () {
77
  jQuery("#openid_question_curl_desc").slideToggle(400);
78
  });
79
+ jQuery("#openid_question_email").click(function () {
80
+ jQuery("#openid_question_email_desc").slideToggle(400);
81
+ });
82
  jQuery("#openid_question_otp").click(function () {
83
  jQuery("#openid_question_otp_desc").slideToggle(400);
84
  });
miniorange_openid_sso_settings.php CHANGED
@@ -2,11 +2,11 @@
2
 
3
  /**
4
  * Plugin Name: Social Login, Social Sharing by miniOrange
5
- * Plugin URI: http://miniorange.com
6
  * Description: Allow your users to login, comment and share with Facebook, Google, Twitter, LinkedIn etc using customizable buttons.
7
- * Version: 5.5.2
8
  * Author: miniOrange
9
- * Author URI: http://miniorange.com
10
  * License: GPL2
11
  */
12
 
@@ -16,7 +16,6 @@ require('class-mo-openid-sso-customer.php');
16
  require('class-mo-openid-sso-shortcode-buttons.php');
17
  require('class-mo-openid-social-comment.php');
18
 
19
-
20
  class Miniorange_OpenID_SSO {
21
 
22
  function __construct() {
@@ -30,10 +29,11 @@ class Miniorange_OpenID_SSO {
30
  add_action( 'admin_enqueue_scripts', array( $this, 'mo_openid_plugin_settings_script' ) );
31
  add_action( 'wp_enqueue_scripts', array( $this, 'mo_openid_plugin_settings_style' ) ,5);
32
  add_action( 'wp_enqueue_scripts', array( $this, 'mo_openid_plugin_script' ) ,5);
 
33
 
34
  register_deactivation_hook(__FILE__, array( $this, 'mo_openid_deactivate'));
35
  register_activation_hook( __FILE__, array( $this, 'mo_openid_activate' ) );
36
- register_activation_hook( __FILE__, array( $this, 'mo_openid_modify_user_table' ) ); // add column provider and identifier
37
 
38
  // add social login icons to default login form
39
  if(get_option('mo_openid_default_login_enable') == 1){
@@ -125,7 +125,8 @@ class Miniorange_OpenID_SSO {
125
  if(get_option('moopenid_social_login_avatar')) {
126
  add_filter( 'get_avatar', array( $this, 'mo_social_login_custom_avatar' ), 15, 5 );
127
  add_filter( 'get_avatar_url', array( $this, 'mo_social_login_custom_avatar_url' ), 15, 3);
128
- if(mo_openid_is_customer_valid()) add_filter( 'bp_core_fetch_avatar', array( $this, 'mo_social_login_buddypress_avatar' ), 10, 2);
 
129
  }
130
 
131
  remove_action( 'admin_notices', array( $this, 'mo_openid_success_message') );
@@ -134,6 +135,7 @@ class Miniorange_OpenID_SSO {
134
  //set default values
135
  add_option( 'mo_openid_login_redirect', 'same' );
136
  add_option( 'mo_openid_login_theme', 'longbutton' );
 
137
  add_option( 'mo_openid_share_theme', 'oval' );
138
  add_option( 'mo_share_options_enable_post_position', 'before');
139
  add_option( 'mo_share_options_home_page_position', 'before');
@@ -163,7 +165,10 @@ class Miniorange_OpenID_SSO {
163
  add_option( 'mo_openid_logout_redirection_enable', '0' );
164
  add_option( 'mo_openid_logout_redirect', 'currentpage' );
165
  add_option( 'mo_openid_auto_register_enable', '1');
 
 
166
  add_option( 'mo_openid_register_disabled_message', 'Registration is disabled for this website. Please contact the administrator for any queries.' );
 
167
  add_option( 'moopenid_social_login_avatar','1' );
168
  add_option( 'moopenid_user_attributes','0' );
169
  add_option( 'mo_share_vertical_hide_mobile', '1' );
@@ -173,13 +178,14 @@ class Miniorange_OpenID_SSO {
173
  add_option( 'mo_openid_social_comment_google_label', 'Google+ Comments' );
174
  add_option( 'mo_openid_social_comment_disqus_label', 'Disqus Comments' );
175
  add_option( 'mo_openid_social_comment_heading_label', 'Leave a Reply' );
176
- add_option( 'mo_openid_login_role_mapping','subscriber');
 
177
  add_option( 'mo_openid_login_widget_customize_logout_name_text', 'Howdy, ##username## |' );
178
  add_option( 'mo_openid_login_widget_customize_logout_text', 'Logout?' );
179
  add_option( 'mo_openid_share_email_subject','I wanted you to see this site' );
180
  add_option( 'mo_openid_share_email_body','Check out this site ##url##' );
181
  add_option( 'mo_openid_enable_profile_completion','1' );
182
- add_option('mo_openid_user_count','1');
183
  }
184
 
185
  function mo_openid_deactivate() {
@@ -200,30 +206,35 @@ class Miniorange_OpenID_SSO {
200
 
201
  function mo_openid_activate() {
202
  add_option('Activated_Plugin','Plugin-Slug');
203
- }
204
-
205
- // add columns provider and identifier to users table
206
- function mo_openid_modify_user_table(){
207
-
208
- global $wpdb;
209
- $table_name = $wpdb->prefix . 'users';
210
- $provider_column = 'provider';
211
- $identifier_column = 'identifier';
212
-
213
- $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = ".$table_name." AND column_name = ".$provider_column);
214
- if(empty($row)){
215
- $wpdb->query("ALTER TABLE ".$table_name." ADD ".$provider_column." VARCHAR(20) NOT NULL ");
216
- }
217
-
218
- $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = ".$table_name." AND column_name = ".$identifier_column);
219
- if(empty($row)){
220
- $wpdb->query("ALTER TABLE ".$table_name." ADD ".$identifier_column." VARCHAR(100) NOT NULL ");
221
- }
222
-
223
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
 
225
  function mo_openid_add_social_login(){
226
- if(!is_user_logged_in() && mo_openid_is_customer_registered()){
 
227
  $mo_login_widget = new mo_openid_login_wid();
228
  $mo_login_widget->openidloginForm();
229
  }
@@ -271,8 +282,6 @@ class Miniorange_OpenID_SSO {
271
  return $post_content;
272
 
273
  }
274
-
275
-
276
 
277
  function mo_openid_social_share(){
278
  global $post;
@@ -280,7 +289,6 @@ class Miniorange_OpenID_SSO {
280
  echo mo_openid_share_shortcode('', $title);
281
  }
282
 
283
-
284
  function mo_openid_add_comment(){
285
  global $post;
286
  if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
@@ -295,7 +303,6 @@ class Miniorange_OpenID_SSO {
295
  mo_openid_social_comment($post, $url);
296
  }
297
  }
298
-
299
 
300
  function mo_custom_login_stylesheet()
301
  {
@@ -329,8 +336,7 @@ class Miniorange_OpenID_SSO {
329
  }
330
 
331
  function mo_openid_success_message() {
332
- $message = get_option('mo_openid_message'); ?>
333
-
334
  <script>
335
 
336
  jQuery(document).ready(function() {
@@ -382,6 +388,86 @@ class Miniorange_OpenID_SSO {
382
  function mo_login_widget_text_domain(){
383
  load_plugin_textdomain('flw', FALSE, basename( dirname( __FILE__ ) ) .'/languages');
384
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
 
386
  function miniorange_openid_save_settings(){
387
  if ( current_user_can( 'manage_options' )){
@@ -431,6 +517,7 @@ class Miniorange_OpenID_SSO {
431
  update_option( 'mo_openid_admin_last_name', $last_name);
432
  update_option( 'mo_openid_admin_email', $email );
433
  update_option( 'mo_openid_admin_phone', $phone );
 
434
  if( strcmp( $password, $confirmPassword) == 0 ) {
435
  update_option( 'mo_openid_admin_password', $password );
436
 
@@ -448,7 +535,7 @@ class Miniorange_OpenID_SSO {
448
  }
449
  update_option('mo_openid_transactionId',$content['txId']);
450
  update_option('mo_openid_registration_status','MO_OTP_DELIVERED_SUCCESS');
451
-
452
  $this->mo_openid_show_success_message();
453
  }else{
454
  update_option('mo_openid_message','There was an error in sending email. Please click on Resend OTP to try again.');
@@ -465,7 +552,8 @@ class Miniorange_OpenID_SSO {
465
  $this->mo_openid_show_error_message();
466
  }
467
 
468
- }else if(isset($_POST['option']) and $_POST['option'] == "mo_openid_validate_otp"){
 
469
 
470
  //validation and sanitization
471
  $otp_token = '';
@@ -487,6 +575,7 @@ class Miniorange_OpenID_SSO {
487
  $content = json_decode($customer->validate_otp_token(get_option('mo_openid_transactionId'), $otp_token ),true);
488
  if(strcasecmp($content['status'], 'SUCCESS') == 0) {
489
  $this->create_customer();
 
490
  }else{
491
  update_option( 'mo_openid_message','Invalid one time passcode. Please enter a valid passcode.');
492
  update_option('mo_openid_registration_status','MO_OTP_VALIDATION_FAILURE');
@@ -596,9 +685,9 @@ class Miniorange_OpenID_SSO {
596
  $license = array();
597
  $license = explode(' -', $content['licensePlan']);
598
  $lp = $license[0];
599
- update_option( 'mo_openid_message','You are on ' . $lp . '.');
600
  } else
601
- update_option( 'mo_openid_message','You are on Free Plan.');
602
  $this->mo_openid_show_success_message();
603
  }else if(strcasecmp($content['status'], 'FAILED') == 0){
604
  update_option('mo_openid_message', 'You are on Free Plan.');
@@ -642,15 +731,24 @@ class Miniorange_OpenID_SSO {
642
  update_option( 'mo_openid_auto_register_enable', isset( $_POST['mo_openid_auto_register_enable']) ? $_POST['mo_openid_auto_register_enable'] : 0);
643
  update_option( 'mo_openid_register_disabled_message', $_POST['mo_openid_register_disabled_message']);
644
 
 
 
 
 
 
 
645
  //Customized text
646
  update_option('mo_openid_login_widget_customize_text',$_POST['mo_openid_login_widget_customize_text'] );
647
  update_option( 'mo_openid_login_button_customize_text',$_POST['mo_openid_login_button_customize_text'] );
648
 
649
- update_option('mo_openid_login_widget_customize_logout_name_text',sanitize_text_field($_POST['mo_openid_login_widget_customize_logout_name_text']));
650
- update_option( 'mo_openid_login_widget_customize_logout_text',sanitize_text_field($_POST['mo_openid_login_widget_customize_logout_text']));
651
-
652
- update_option('mo_login_openid_login_widget_customize_textcolor',$_POST['mo_login_openid_login_widget_customize_textcolor']);
 
 
653
 
 
654
  update_option('mo_openid_login_theme',$_POST['mo_openid_login_theme'] );
655
  update_option( 'mo_openid_message', 'Your settings are saved successfully.' );
656
 
@@ -665,11 +763,11 @@ class Miniorange_OpenID_SSO {
665
 
666
  // avatar
667
  update_option( 'moopenid_social_login_avatar', isset( $_POST['moopenid_social_login_avatar']) ? $_POST['moopenid_social_login_avatar'] : 0);
668
-
669
  //profile completion
670
  update_option('mo_openid_enable_profile_completion', isset( $_POST['mo_openid_enable_profile_completion']) ? $_POST['mo_openid_enable_profile_completion'] : 0);
671
 
672
- if(isset($_POST['mapping_value_default']) && mo_openid_is_customer_valid())
673
  update_option('mo_openid_login_role_mapping', isset( $_POST['mapping_value_default']) ? $_POST['mapping_value_default'] : 'subscriber');
674
 
675
  if(mo_openid_is_customer_valid() && !mo_openid_get_customer_plan('Do It Yourself')){
@@ -677,7 +775,6 @@ class Miniorange_OpenID_SSO {
677
  update_option( 'moopenid_user_attributes', isset( $_POST['moopenid_user_attributes']) ? $_POST['moopenid_user_attributes'] : 0);
678
  }
679
 
680
-
681
  $this->mo_openid_show_success_message();
682
 
683
  } else {
@@ -824,7 +921,85 @@ class Miniorange_OpenID_SSO {
824
  $this->mo_openid_show_error_message();
825
  }
826
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
827
  }
 
828
  }
829
 
830
  function create_customer(){
@@ -931,16 +1106,14 @@ class Miniorange_OpenID_SSO {
931
  }
932
  }
933
 
934
-
935
-
936
  function mo_social_login_custom_avatar( $avatar, $mixed, $size, $default, $alt = '' ) {
937
  $user = false;
938
 
939
- if ( is_numeric( $mixed ) AND $mixed > 0 ) { //Check if we have an user identifier
940
  $user_id = $mixed;
941
- } elseif ( is_string( $mixed ) AND ( $user = get_user_by( 'email', $mixed )) ) { //Check if we have an user email
942
  $user_id = $user->ID;
943
- } elseif ( is_object( $mixed ) AND property_exists( $mixed, 'user_id' ) AND is_numeric( $mixed->user_id ) ) { //Check if we have an user object
944
  $user_id = $mixed->user_id;
945
  } else { //None found
946
  $user_id = null;
2
 
3
  /**
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, Twitter, LinkedIn etc using customizable buttons.
7
+ * Version: 6.0.0
8
  * Author: miniOrange
9
+ * Author URI: https://www.miniorange.com
10
  * License: GPL2
11
  */
12
 
16
  require('class-mo-openid-sso-shortcode-buttons.php');
17
  require('class-mo-openid-social-comment.php');
18
 
 
19
  class Miniorange_OpenID_SSO {
20
 
21
  function __construct() {
29
  add_action( 'admin_enqueue_scripts', array( $this, 'mo_openid_plugin_settings_script' ) );
30
  add_action( 'wp_enqueue_scripts', array( $this, 'mo_openid_plugin_settings_style' ) ,5);
31
  add_action( 'wp_enqueue_scripts', array( $this, 'mo_openid_plugin_script' ) ,5);
32
+ add_action( 'upgrader_process_complete', 'mo_plugin_updates', 10, 0 );
33
 
34
  register_deactivation_hook(__FILE__, array( $this, 'mo_openid_deactivate'));
35
  register_activation_hook( __FILE__, array( $this, 'mo_openid_activate' ) );
36
+ register_activation_hook( __FILE__, array( $this, 'mo_openid_create_account_linking_table' ) );
37
 
38
  // add social login icons to default login form
39
  if(get_option('mo_openid_default_login_enable') == 1){
125
  if(get_option('moopenid_social_login_avatar')) {
126
  add_filter( 'get_avatar', array( $this, 'mo_social_login_custom_avatar' ), 15, 5 );
127
  add_filter( 'get_avatar_url', array( $this, 'mo_social_login_custom_avatar_url' ), 15, 3);
128
+ if(mo_openid_is_customer_valid()) // and if existing customer
129
+ add_filter( 'bp_core_fetch_avatar', array( $this, 'mo_social_login_buddypress_avatar' ), 10, 2);
130
  }
131
 
132
  remove_action( 'admin_notices', array( $this, 'mo_openid_success_message') );
135
  //set default values
136
  add_option( 'mo_openid_login_redirect', 'same' );
137
  add_option( 'mo_openid_login_theme', 'longbutton' );
138
+ add_option( 'mo_openid_oauth','0');
139
  add_option( 'mo_openid_share_theme', 'oval' );
140
  add_option( 'mo_share_options_enable_post_position', 'before');
141
  add_option( 'mo_share_options_home_page_position', 'before');
165
  add_option( 'mo_openid_logout_redirection_enable', '0' );
166
  add_option( 'mo_openid_logout_redirect', 'currentpage' );
167
  add_option( 'mo_openid_auto_register_enable', '1');
168
+ add_option( 'mo_openid_account_linking_enable', '0');
169
+ add_option( 'mo_openid_email_enable', '1');
170
  add_option( 'mo_openid_register_disabled_message', 'Registration is disabled for this website. Please contact the administrator for any queries.' );
171
+ add_option( 'mo_openid_register_email_message', 'Hello,<br><br>##User Name## has registered to your site successfully.<br><br>Thanks,<br>miniOrange' );
172
  add_option( 'moopenid_social_login_avatar','1' );
173
  add_option( 'moopenid_user_attributes','0' );
174
  add_option( 'mo_share_vertical_hide_mobile', '1' );
178
  add_option( 'mo_openid_social_comment_google_label', 'Google+ Comments' );
179
  add_option( 'mo_openid_social_comment_disqus_label', 'Disqus Comments' );
180
  add_option( 'mo_openid_social_comment_heading_label', 'Leave a Reply' );
181
+ add_option('mo_openid_login_role_mapping','subscriber');
182
+ add_option( 'mo_openid_user_number',0);
183
  add_option( 'mo_openid_login_widget_customize_logout_name_text', 'Howdy, ##username## |' );
184
  add_option( 'mo_openid_login_widget_customize_logout_text', 'Logout?' );
185
  add_option( 'mo_openid_share_email_subject','I wanted you to see this site' );
186
  add_option( 'mo_openid_share_email_body','Check out this site ##url##' );
187
  add_option( 'mo_openid_enable_profile_completion','1' );
188
+ add_option( 'moopenid_logo_check','1' );
189
  }
190
 
191
  function mo_openid_deactivate() {
206
 
207
  function mo_openid_activate() {
208
  add_option('Activated_Plugin','Plugin-Slug');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  }
210
+
211
+ // create a new table in wordpress database to handle account-linking
212
+ function mo_openid_create_account_linking_table()
213
+ {
214
+
215
+ global $wpdb;
216
+ $table_name = $wpdb->prefix . 'mo_openid_linked_user';
217
+ $charset_collate = $wpdb->get_charset_collate();
218
+
219
+ if($wpdb->get_var("show tables like '$table_name'") != $table_name)
220
+ {
221
+ $sql = "CREATE TABLE $table_name (
222
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
223
+ linked_social_app varchar(55) NOT NULL,
224
+ linked_email varchar(55) NOT NULL,
225
+ user_id mediumint(10) NOT NULL,
226
+ identifier VARCHAR(100) NOT NULL,
227
+ PRIMARY KEY (id)
228
+ ) $charset_collate;";
229
+
230
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
231
+ dbDelta($sql);
232
+ }
233
+ }
234
 
235
  function mo_openid_add_social_login(){
236
+
237
+ if(!is_user_logged_in() && mo_openid_is_customer_registered() && strpos( $_SERVER['QUERY_STRING'], 'disable-social-login' ) == false){
238
  $mo_login_widget = new mo_openid_login_wid();
239
  $mo_login_widget->openidloginForm();
240
  }
282
  return $post_content;
283
 
284
  }
 
 
285
 
286
  function mo_openid_social_share(){
287
  global $post;
289
  echo mo_openid_share_shortcode('', $title);
290
  }
291
 
 
292
  function mo_openid_add_comment(){
293
  global $post;
294
  if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
303
  mo_openid_social_comment($post, $url);
304
  }
305
  }
 
306
 
307
  function mo_custom_login_stylesheet()
308
  {
336
  }
337
 
338
  function mo_openid_success_message() {
339
+ $message = get_option('mo_openid_message'); ?>
 
340
  <script>
341
 
342
  jQuery(document).ready(function() {
388
  function mo_login_widget_text_domain(){
389
  load_plugin_textdomain('flw', FALSE, basename( dirname( __FILE__ ) ) .'/languages');
390
  }
391
+
392
+ // create mo_openid_linked_user if it doesn't exist
393
+ // + add entries in wp_mo_openid_linked_user table
394
+ // + remove columns app name and identifier from wp_users table
395
+ function mo_plugin_updates(){
396
+
397
+ global $wpdb;
398
+ $table_name = $wpdb->prefix . 'mo_openid_linked_user';
399
+ $charset_collate = $wpdb->get_charset_collate();
400
+
401
+ if($wpdb->get_var("show tables like '$table_name'") != $table_name)
402
+ {
403
+ $sql = "CREATE TABLE $table_name (
404
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
405
+ linked_social_app varchar(55) NOT NULL,
406
+ linked_email varchar(55) NOT NULL,
407
+ user_id mediumint(10) NOT NULL,
408
+ identifier VARCHAR(100) NOT NULL,
409
+ PRIMARY KEY (id)
410
+ ) $charset_collate;";
411
+
412
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
413
+ dbDelta($sql);
414
+ }
415
+
416
+ $identifier = $wpdb->get_var("SELECT COLUMN_NAME
417
+ FROM information_schema.COLUMNS
418
+ WHERE
419
+ TABLE_NAME = '$wpdb->users'
420
+ AND COLUMN_NAME = 'identifier'");
421
+
422
+ if(strcasecmp( $identifier, "identifier") == 0 ){
423
+
424
+ $count= $wpdb->get_var("SELECT count(ID) FROM $wpdb->users WHERE identifier not LIKE ''");
425
+ $result= $wpdb->get_results("SELECT * FROM $wpdb->users WHERE identifier not LIKE ''");
426
+
427
+ for($icnt = 0; $icnt < $count; $icnt = $icnt + 1){
428
+
429
+ $provider = $result[$icnt]->provider;
430
+ $split_app_name = explode('_', $provider);
431
+ $provider = strtolower($split_app_name[0]);
432
+ $user_email = $result[$icnt]->user_email;
433
+ $ID = $result[$icnt]->ID;
434
+ $identifier = $result[$icnt]->identifier;
435
+
436
+ $output = $wpdb->insert(
437
+ $table_name,
438
+ array(
439
+ 'linked_social_app' => $provider,
440
+ 'linked_email' => $user_email,
441
+ 'user_id' => $ID,
442
+ 'identifier' => $identifier
443
+ ),
444
+ array(
445
+ '%s',
446
+ '%s',
447
+ '%d',
448
+ '%s'
449
+ )
450
+ );
451
+ if($output === false){
452
+ /*$wpdb->show_errors();
453
+ $wpdb->print_error();
454
+ exit;*/
455
+ wp_die('Error in insert Query');
456
+ }
457
+
458
+ }
459
+ $wpdb->get_var("ALTER TABLE $wpdb->users DROP COLUMN provider");
460
+ $wpdb->get_var("ALTER TABLE $wpdb->users DROP COLUMN identifier");
461
+
462
+ }
463
+ }
464
+
465
+ public function mo_oauth_check_empty_or_null( $value ) {
466
+ if( ! isset( $value ) || empty( $value ) ) {
467
+ return true;
468
+ }
469
+ return false;
470
+ }
471
 
472
  function miniorange_openid_save_settings(){
473
  if ( current_user_can( 'manage_options' )){
517
  update_option( 'mo_openid_admin_last_name', $last_name);
518
  update_option( 'mo_openid_admin_email', $email );
519
  update_option( 'mo_openid_admin_phone', $phone );
520
+
521
  if( strcmp( $password, $confirmPassword) == 0 ) {
522
  update_option( 'mo_openid_admin_password', $password );
523
 
535
  }
536
  update_option('mo_openid_transactionId',$content['txId']);
537
  update_option('mo_openid_registration_status','MO_OTP_DELIVERED_SUCCESS');
538
+
539
  $this->mo_openid_show_success_message();
540
  }else{
541
  update_option('mo_openid_message','There was an error in sending email. Please click on Resend OTP to try again.');
552
  $this->mo_openid_show_error_message();
553
  }
554
 
555
+ }
556
+ else if(isset($_POST['option']) and $_POST['option'] == "mo_openid_validate_otp"){
557
 
558
  //validation and sanitization
559
  $otp_token = '';
575
  $content = json_decode($customer->validate_otp_token(get_option('mo_openid_transactionId'), $otp_token ),true);
576
  if(strcasecmp($content['status'], 'SUCCESS') == 0) {
577
  $this->create_customer();
578
+ update_option('mo_openid_oauth','1');
579
  }else{
580
  update_option( 'mo_openid_message','Invalid one time passcode. Please enter a valid passcode.');
581
  update_option('mo_openid_registration_status','MO_OTP_VALIDATION_FAILURE');
685
  $license = array();
686
  $license = explode(' -', $content['licensePlan']);
687
  $lp = $license[0];
688
+ update_option( 'mo_openid_message','You are on the old ' . $lp . '.');
689
  } else
690
+ update_option( 'mo_openid_message','You are on the Free Plan.');
691
  $this->mo_openid_show_success_message();
692
  }else if(strcasecmp($content['status'], 'FAILED') == 0){
693
  update_option('mo_openid_message', 'You are on Free Plan.');
731
  update_option( 'mo_openid_auto_register_enable', isset( $_POST['mo_openid_auto_register_enable']) ? $_POST['mo_openid_auto_register_enable'] : 0);
732
  update_option( 'mo_openid_register_disabled_message', $_POST['mo_openid_register_disabled_message']);
733
 
734
+ //account-linking
735
+ update_option( 'mo_openid_account_linking_enable', isset( $_POST['mo_openid_account_linking_enable']) ? $_POST['mo_openid_account_linking_enable'] : 0);
736
+
737
+ //email notification
738
+ update_option( 'mo_openid_email_enable', isset( $_POST['mo_openid_email_enable']) ? $_POST['mo_openid_email_enable'] : 0);
739
+
740
  //Customized text
741
  update_option('mo_openid_login_widget_customize_text',$_POST['mo_openid_login_widget_customize_text'] );
742
  update_option( 'mo_openid_login_button_customize_text',$_POST['mo_openid_login_button_customize_text'] );
743
 
744
+ if(!get_option('mo_openid_oauth')){
745
+ update_option('mo_openid_login_widget_customize_logout_name_text',sanitize_text_field($_POST['mo_openid_login_widget_customize_logout_name_text']));
746
+ update_option( 'mo_openid_login_widget_customize_logout_text',sanitize_text_field($_POST['mo_openid_login_widget_customize_logout_text']));
747
+ }else{
748
+ update_option('moopenid_logo_check', isset( $_POST['moopenid_logo_check']) ? $_POST['moopenid_logo_check'] : 0);
749
+ }
750
 
751
+ update_option('mo_login_openid_login_widget_customize_textcolor',$_POST['mo_login_openid_login_widget_customize_textcolor']);
752
  update_option('mo_openid_login_theme',$_POST['mo_openid_login_theme'] );
753
  update_option( 'mo_openid_message', 'Your settings are saved successfully.' );
754
 
763
 
764
  // avatar
765
  update_option( 'moopenid_social_login_avatar', isset( $_POST['moopenid_social_login_avatar']) ? $_POST['moopenid_social_login_avatar'] : 0);
766
+
767
  //profile completion
768
  update_option('mo_openid_enable_profile_completion', isset( $_POST['mo_openid_enable_profile_completion']) ? $_POST['mo_openid_enable_profile_completion'] : 0);
769
 
770
+ if(isset($_POST['mapping_value_default']))
771
  update_option('mo_openid_login_role_mapping', isset( $_POST['mapping_value_default']) ? $_POST['mapping_value_default'] : 'subscriber');
772
 
773
  if(mo_openid_is_customer_valid() && !mo_openid_get_customer_plan('Do It Yourself')){
775
  update_option( 'moopenid_user_attributes', isset( $_POST['moopenid_user_attributes']) ? $_POST['moopenid_user_attributes'] : 0);
776
  }
777
 
 
778
  $this->mo_openid_show_success_message();
779
 
780
  } else {
921
  $this->mo_openid_show_error_message();
922
  }
923
  }
924
+ else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_add_custom_app" ) {
925
+ if($this->mo_oauth_check_empty_or_null($_POST['mo_oauth_client_id']) || $this->mo_oauth_check_empty_or_null($_POST['mo_oauth_client_secret'])) {
926
+ update_option( 'message', 'Please enter valid Client ID and Client Secret.');
927
+ $this->mo_openid_show_error_message();
928
+ return;
929
+ } else{
930
+ $scope = stripslashes(sanitize_text_field( $_POST['mo_oauth_scope'] ));
931
+ $clientid = stripslashes(sanitize_text_field( $_POST['mo_oauth_client_id'] ));
932
+ $clientsecret = stripslashes(sanitize_text_field( $_POST['mo_oauth_client_secret'] ));
933
+ $appname = stripslashes(sanitize_text_field( $_POST['mo_oauth_app_name'] ));
934
+
935
+ if(get_option('mo_openid_apps_list'))
936
+ $appslist = get_option('mo_openid_apps_list');
937
+ else
938
+ $appslist = array();
939
+
940
+ $newapp = array();
941
+
942
+ foreach($appslist as $key => $currentapp){
943
+ if($appname == $key){
944
+ $newapp = $currentapp;
945
+ break;
946
+ }
947
+ }
948
+
949
+ $newapp['clientid'] = $clientid;
950
+ $newapp['clientsecret'] = $clientsecret;
951
+ $newapp['scope'] = $scope;
952
+ $newapp['redirecturi'] = site_url().'/openidcallback';
953
+ if($appname=="facebook"){
954
+ $authorizeurl = 'https://www.facebook.com/dialog/oauth';
955
+ $accesstokenurl = 'https://graph.facebook.com/v2.8/oauth/access_token';
956
+ $resourceownerdetailsurl = 'https://graph.facebook.com/me/?fields=id,name,email,age_range,first_name,gender,last_name,link&access_token=';
957
+ } else if($appname=="google"){
958
+ $authorizeurl = "https://accounts.google.com/o/oauth2/auth";
959
+ $accesstokenurl = "https://www.googleapis.com/oauth2/v3/token";
960
+ //private static final String VERIFY_TOKEN_ENDPOINT = "https://www.googleapis.com/oauth2/v1/tokeninfo?id_token=";
961
+ //private static final String GET_USER_INFO_ENDPOINT = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=";
962
+ $resourceownerdetailsurl = "https://www.googleapis.com/plus/v1/people/me";
963
+ } else if($appname=="twitter"){
964
+ $authorizeurl = "https://api.twitter.com/oauth/authorize";
965
+ $accesstokenurl = "https://api.twitter.com/oauth/access_token";
966
+ $resourceownerdetailsurl = "https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials?include_email=true";
967
+ }else {
968
+ $authorizeurl = stripslashes(sanitize_text_field($_POST['mo_oauth_authorizeurl']));
969
+ $accesstokenurl = stripslashes(sanitize_text_field($_POST['mo_oauth_accesstokenurl']));
970
+ $resourceownerdetailsurl = stripslashes(sanitize_text_field($_POST['mo_oauth_resourceownerdetailsurl']));
971
+ $appname = stripslashes(sanitize_text_field( $_POST['mo_oauth_custom_app_name'] ));
972
+ }
973
+
974
+ $newapp['authorizeurl'] = $authorizeurl;
975
+ $newapp['accesstokenurl'] = $accesstokenurl;
976
+ $newapp['resourceownerdetailsurl'] = $resourceownerdetailsurl;
977
+ $appslist[$appname] = $newapp;
978
+ update_option('mo_openid_apps_list', $appslist);
979
+ wp_redirect('admin.php?page=mo_openid_settings&tab=custom_app');
980
+ }
981
+ }
982
+ else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_custom_app_attribute_mapping" ) {
983
+ $appname = stripslashes(sanitize_text_field( $_POST['mo_oauth_app_name'] ));
984
+ $email_attr = stripslashes(sanitize_text_field( $_POST['mo_oauth_email_attr'] ));
985
+ $name_attr = stripslashes(sanitize_text_field( $_POST['mo_oauth_name_attr'] ));
986
+
987
+ $appslist = get_option('mo_openid_apps_list');
988
+ foreach($appslist as $key => $currentapp){
989
+ if($appname == $key){
990
+ $currentapp['email_attr'] = $email_attr;
991
+ $currentapp['name_attr'] = $name_attr;
992
+ $appslist[$key] = $currentapp;
993
+ break;
994
+ }
995
+ }
996
+ update_option('mo_openid_apps_list', $appslist);
997
+ update_option( 'message', 'Your settings are saved successfully.' );
998
+ $this->mo_openid_show_success_message();
999
+ wp_redirect('admin.php?page=mo_openid_settings&tab=custom_app&action=update&app='.urlencode($appname));
1000
+ }
1001
  }
1002
+
1003
  }
1004
 
1005
  function create_customer(){
1106
  }
1107
  }
1108
 
 
 
1109
  function mo_social_login_custom_avatar( $avatar, $mixed, $size, $default, $alt = '' ) {
1110
  $user = false;
1111
 
1112
+ if ( is_numeric( $mixed ) AND $mixed > 0 ) { //Check if we have a user identifier
1113
  $user_id = $mixed;
1114
+ } elseif ( is_string( $mixed ) AND ( $user = get_user_by( 'email', $mixed )) ) { //Check if we have a user email
1115
  $user_id = $user->ID;
1116
+ } elseif ( is_object( $mixed ) AND property_exists( $mixed, 'user_id' ) AND is_numeric( $mixed->user_id ) ) { //Check if we have a user object
1117
  $user_id = $mixed->user_id;
1118
  } else { //None found
1119
  $user_id = null;
miniorange_openid_sso_settings_page.php CHANGED
@@ -4,12 +4,9 @@ function mo_register_openid() {
4
  $active_tab = $_GET[ 'tab' ];
5
  } else if(mo_openid_is_customer_registered()) {
6
  $active_tab = 'login';
7
- } else if( isset( $_GET[ 'tab' ]) && $_GET[ 'tab' ] == 'register' ) {
8
  $active_tab = 'register';
9
  }
10
- else{
11
- $active_tab = 'login';
12
- }
13
 
14
  if(mo_openid_is_curl_installed()==0){ ?>
15
  <p style="color:red;">(Warning: <a href="http://php.net/manual/en/curl.installation.php" target="_blank">PHP CURL extension</a> is not installed or disabled) Please go to Troubleshooting for steps to enable curl.</p>
@@ -21,11 +18,14 @@ function mo_register_openid() {
21
  <a class="nav-tab <?php echo $active_tab == 'register' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'register'), $_SERVER['REQUEST_URI'] ); ?>">Account Setup</a>
22
  <?php } ?>
23
  <a class="nav-tab <?php echo $active_tab == 'login' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'login'), $_SERVER['REQUEST_URI'] ); ?>">Social Login</a>
 
 
 
24
  <a class="nav-tab <?php echo $active_tab == 'share' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'share'), $_SERVER['REQUEST_URI'] ); ?>">Social Sharing</a>
25
  <a class="nav-tab <?php echo $active_tab == 'comment' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'comment'), $_SERVER['REQUEST_URI'] ); ?>">Social Comments</a>
26
  <a class="nav-tab <?php echo $active_tab == 'shortcode' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'shortcode'), $_SERVER['REQUEST_URI'] ); ?>">Shortcode</a>
27
  <a class="nav-tab <?php echo $active_tab == 'pricing' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'pricing'), $_SERVER['REQUEST_URI'] ); ?>">Licensing Plans</a>
28
- <a class="nav-tab <?php echo $active_tab == 'help' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'help'), $_SERVER['REQUEST_URI'] ); ?>">Help & Troubleshooting</a>
29
  </h2>
30
  </div>
31
 
@@ -36,7 +36,6 @@ function mo_register_openid() {
36
  <table style="width:100%;">
37
  <tr>
38
  <!--td style="vertical-align:top;width:65%;"-->
39
-
40
  <?php
41
  if( $active_tab == 'share' ) {
42
  mo_openid_other_settings();
@@ -57,10 +56,20 @@ function mo_register_openid() {
57
  mo_openid_app_comment();
58
  } else if($active_tab == 'shortcode') {
59
  mo_openid_shortcode_info();
60
- }else if($active_tab == 'pricing') {
61
  mo_openid_pricing_info();
62
- }else if($active_tab == 'help') {
63
  mo_openid_troubleshoot_info();
 
 
 
 
 
 
 
 
 
 
64
  }
65
 
66
 
@@ -68,13 +77,14 @@ function mo_register_openid() {
68
  ?>
69
  <!--/td>
70
  <td style="vertical-align:top;padding-left:1%;">
71
- <?php echo miniorange_openid_support(); ?>
 
72
  </td-->
73
- </tr>
74
  </table>
75
  <?php
76
 
77
  }
 
78
  function mo_openid_show_new_registration_page() {
79
  update_option ( 'mo_openid_new_registration', 'true' );
80
  global $current_user;
@@ -151,7 +161,7 @@ function mo_openid_show_new_registration_page() {
151
  </td>
152
  </tr>
153
  </table>
154
- <br/>By clicking Next, you agree to our <a href="http://miniorange.com/usecases/miniOrange_Privacy_Policy.pdf" target="_blank">Privacy Policy</a> and <a href="http://miniorange.com/usecases/miniOrange_User_Agreement.pdf" target="_blank">User Agreement</a>.
155
  </div>
156
  </form>
157
  <form name="f" method="post" action="" id="openidgobackloginform">
@@ -200,7 +210,7 @@ function mo_openid_show_verify_password_page() {
200
  </tr>
201
  <tr>
202
  <td>&nbsp;</td>
203
- <td><input type="submit" name="submit"
204
  class="button button-primary button-large" />
205
  <input type="button" value="Registration Page" id="mo_openid_go_back"
206
  class="button button-primary button-large" />
@@ -242,11 +252,11 @@ function mo_openid_apps_config() {
242
 
243
  <div class="mo_openid_table_layout">
244
 
245
- <!--<?php if(!mo_openid_is_customer_registered()) { ?>
246
  <div style="display:block;margin-top:10px;color:red;background-color:rgba(251, 232, 0, 0.15);padding:5px;border:solid 1px rgba(255, 0, 9, 0.36);">
247
  Please <a href="<?php echo add_query_arg( array('tab' => 'register'), $_SERVER['REQUEST_URI'] ); ?>">Register or Login with miniOrange</a> to enable Social Login and Social Sharing. miniOrange takes care of creating applications for you so that you don't have to worry about creating applications in each social network.
248
  </div>
249
- <?php }?> -->
250
 
251
  <table>
252
  <tr>
@@ -269,16 +279,44 @@ function mo_openid_apps_config() {
269
  <p>Select applications to enable social login</p>
270
 
271
  <tr>
 
272
  <td>
273
  <table style="width:100%">
274
  <tr>
275
  <td><input type="checkbox" id="facebook_enable" class="app_enable" name="mo_openid_facebook_enable" value="1" onchange="previewLoginIcons();"
276
  <?php checked( get_option('mo_openid_facebook_enable') == 1 );?> /><strong>Facebook</strong>
277
  </td>
 
 
 
 
278
  <td>
279
  <input type="checkbox" id="google_enable" class="app_enable" name="mo_openid_google_enable" value="1" onchange="previewLoginIcons();"
280
  <?php checked( get_option('mo_openid_google_enable') == 1 );?> /><strong>Google</strong>
281
  </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  <td>
283
  <input type="checkbox" id="vkontakte_enable" class="app_enable" name="mo_openid_vkontakte_enable" value="1" onchange="previewLoginIcons();"
284
  <?php checked( get_option('mo_openid_vkontakte_enable') == 1 );?> /><strong>Vkontakte</strong>
@@ -288,8 +326,9 @@ function mo_openid_apps_config() {
288
  <?php checked( get_option('mo_openid_twitter_enable') == 1 );?> /><strong>Twitter</strong>
289
  </td>
290
  <td>
291
- <input type="checkbox" id="instagram_enable" class="app_enable" name="mo_openid_instagram_enable" value="1" onchange="previewLoginIcons();"
292
- <?php checked( get_option('mo_openid_instagram_enable') == 1 );?> /><strong>Instagram</strong>
 
293
  </td>
294
  </tr>
295
  <tr>
@@ -312,12 +351,11 @@ function mo_openid_apps_config() {
312
  </tr>
313
  </table>
314
  </td>
315
- </td>
 
 
316
  <tr>
317
-
318
-
319
-
320
- <td>
321
  <br>
322
  <hr>
323
  <h3>Customize Login Icons</h3>
@@ -336,7 +374,6 @@ function mo_openid_apps_config() {
336
 
337
  <td class="mo_openid_table_td_checkbox">
338
  <input type="radio" name="mo_openid_login_theme" value="circle" onclick="checkLoginButton();moLoginPreview(document.getElementById('mo_login_icon_size').value ,'circle',setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)"
339
-
340
  <?php checked( get_option('mo_openid_login_theme') == 'circle' );?> />Round
341
 
342
  <span style="margin-left:106px;">
@@ -346,24 +383,24 @@ function mo_openid_apps_config() {
346
  </span>
347
 
348
  <span style="margin-left:111px;">
349
- <input style="width:50px" onkeyup="moLoginSpaceValidate(this)" id="mo_login_icon_space" name="mo_login_icon_space" type="text" value="<?php echo get_option('mo_login_icon_space')?>"/>
350
- <input id="mo_login_space_plus" type="button" value="+" onmouseup="moLoginPreview(setSizeOfIcons() ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)"/>
351
- <input id="mo_login_space_minus" type="button" value="-" onmouseup="moLoginPreview(setSizeOfIcons() ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)"/>
352
  </span>
353
 
354
 
355
  <span id="commontheme" style="margin-left:115px">
356
- <input style="width:50px" id="mo_login_icon_size" onkeyup="moLoginSizeValidate(this)" name="mo_login_icon_custom_size" type="text" value="<?php echo get_option('mo_login_icon_custom_size')?>">
357
- <input id="mo_login_size_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_size').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)">
358
- <input id="mo_login_size_minus" type="button" value="-" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_size').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)">
359
 
360
  </span>
361
  <span style="margin-left:91px" class="longbuttontheme">Width:&nbsp;
362
- <input style="width:50px" id="mo_login_icon_width" onkeyup="moLoginWidthValidate(this)" name="mo_login_icon_custom_width" type="text" value="<?php echo get_option('mo_login_icon_custom_width')?>">
363
  <span style="margin-left:3px;">
364
 
365
- <input id="mo_login_width_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)">
366
- <input id="mo_login_width_minus" type="button" value="-" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)">
367
 
368
  </span>
369
  </span>
@@ -375,11 +412,10 @@ function mo_openid_apps_config() {
375
  <tr>
376
  <td class="mo_openid_table_td_checkbox">
377
  <input type="radio" name="mo_openid_login_theme" value="oval" onclick="checkLoginButton();moLoginPreview(document.getElementById('mo_login_icon_size').value,'oval',setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_size').value,document.getElementById('mo_login_icon_custom_boundary').value )"
378
-
379
  <?php checked( get_option('mo_openid_login_theme') == 'oval' );?> />Rounded Edges
380
 
381
  <span style="margin-left:50px;">
382
- <input type="radio" id="mo_openid_login_custom_radio" name="mo_openid_login_custom_theme" value="custom" onclick="checkLoginButton();moLoginPreview(setSizeOfIcons(), setLoginTheme(),'custom',document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)"
383
  <?php checked( get_option('mo_openid_login_custom_theme') == 'custom' );?> />Custom Background*
384
 
385
  </span>
@@ -387,11 +423,11 @@ function mo_openid_apps_config() {
387
 
388
 
389
  <span style="margin-left:235px" class="longbuttontheme" >Height:
390
- <input style="width:50px" id="mo_login_icon_height" onkeyup="moLoginHeightValidate(this)" name="mo_login_icon_custom_height" type="text" value="<?php echo get_option('mo_login_icon_custom_height')?>">
391
  <span style="margin-left:1px;">
392
 
393
- <input id="mo_login_height_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)">
394
- <input id="mo_login_height_minus" type="button" value="-" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)">
395
  </span>
396
  </span>
397
  </td>
@@ -400,21 +436,20 @@ function mo_openid_apps_config() {
400
  <tr>
401
  <td class="mo_openid_table_td_checkbox">
402
  <input type="radio" name="mo_openid_login_theme" value="square" onclick="checkLoginButton();moLoginPreview(document.getElementById('mo_login_icon_size').value ,'square',setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_size').value,document.getElementById('mo_login_icon_custom_boundary').value )"
403
-
404
  <?php checked( get_option('mo_openid_login_theme') == 'square' );?> />Square
405
 
406
  <span style="margin-left:113px;">
407
- <input id="mo_login_icon_custom_color" style="width:135px;" name="mo_login_icon_custom_color" class="color" value="<?php echo get_option('mo_login_icon_custom_color')?>" onchange="moLoginPreview(setSizeOfIcons(), setLoginTheme(),'custom',document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)">
408
  </span>
409
 
410
 
411
  <span style="margin-left:228px" class="longbuttontheme">Curve:
412
  <input style="width:50px" id="mo_login_icon_custom_boundary" onkeyup="moLoginBoundaryValidate(this)" name="mo_login_icon_custom_boundary" type="text" value=
413
- "<?php echo get_option('mo_login_icon_custom_boundary')?>"/>
414
  <span style="margin-left:6px;">
415
 
416
- <input id="mo_login_boundary_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)"/>
417
- <input id="mo_login_boundary_minus" type="button" value="-" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)"/>
418
  </span>
419
  </span>
420
  </td>
@@ -427,6 +462,13 @@ function mo_openid_apps_config() {
427
  <tr>
428
  <td> <br><b>Preview : </b><br/><span hidden id="no_apps_text">No apps selected</span>
429
  <div>
 
 
 
 
 
 
 
430
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_facebook" src="<?php echo plugins_url( 'includes/images/icons/facebook.png', __FILE__ )?>" />
431
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_google" src="<?php echo plugins_url( 'includes/images/icons/google.png', __FILE__ )?>" />
432
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_vkontakte" src="<?php echo plugins_url( 'includes/images/icons/vk.png', __FILE__ )?>" />
@@ -436,9 +478,21 @@ function mo_openid_apps_config() {
436
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_amazon" src="<?php echo plugins_url( 'includes/images/icons/amazon.png', __FILE__ )?>" />
437
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_salesforce" src="<?php echo plugins_url( 'includes/images/icons/salesforce.png', __FILE__ )?>" />
438
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_windowslive" src="<?php echo plugins_url( 'includes/images/icons/windowslive.png', __FILE__ )?>" />
 
439
  </div>
440
 
441
  <div>
 
 
 
 
 
 
 
 
 
 
 
442
  <a id="mo_login_button_preview_facebook" class="btn btn-block btn-defaulttheme btn-social btn-facebook btn-custom-size"> <i class="fa fa-facebook"></i><?php
443
  echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
444
  <a id="mo_login_button_preview_google" class="btn btn-block btn-defaulttheme btn-social btn-google btn-custom-size"> <i class="fa fa-google-plus"></i><?php
@@ -457,10 +511,17 @@ function mo_openid_apps_config() {
457
  echo get_option('mo_openid_login_button_customize_text'); ?> Salesforce</a>
458
  <a id="mo_login_button_preview_windowslive" class="btn btn-block btn-defaulttheme btn-social btn-microsoft btn-custom-size"> <i class="fa fa-windows"></i><?php
459
  echo get_option('mo_openid_login_button_customize_text'); ?> Windows</a>
460
-
461
  </div>
462
 
463
  <div>
 
 
 
 
 
 
 
464
  <i class="mo_custom_login_icon_preview fa fa-facebook" id="mo_custom_login_icon_preview_facebook" style="color:#ffffff;text-align:center;margin-top:5px;"></i>
465
  <i class="mo_custom_login_icon_preview fa fa-google-plus" id="mo_custom_login_icon_preview_google" style="color:#ffffff;text-align:center;margin-top:5px;"></i>
466
  <i class="mo_custom_login_icon_preview fa fa-vk" id="mo_custom_login_icon_preview_vkontakte" style="color:#ffffff;text-align:center;margin-top:5px;"></i>
@@ -470,10 +531,19 @@ function mo_openid_apps_config() {
470
  <i class="mo_custom_login_icon_preview fa fa-amazon" id="amazoncustom" style="color:#ffffff;text-align:center;margin-top:5px;"></i>
471
  <i class="mo_custom_login_icon_preview fa fa-cloud" id="salesforcecustom" style="margin-bottom:-10px;color:#ffffff;text-align:center;margin-top:5px;" ></i>
472
  <i class="mo_custom_login_icon_preview fa fa-windows" id="mo_custom_login_icon_preview_windows" style="color:#ffffff;text-align:center;margin-top:5px;" ></i>
473
-
474
  </div>
475
 
476
  <div>
 
 
 
 
 
 
 
 
 
477
  <a id="mo_custom_login_button_preview_facebook" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-facebook"></i><?php
478
  echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
479
  <a id="mo_custom_login_button_preview_google" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-google-plus"></i><?php
@@ -491,8 +561,8 @@ function mo_openid_apps_config() {
491
  <a id="mo_custom_login_button_preview_salesforce" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-cloud"></i><?php
492
  echo get_option('mo_openid_login_button_customize_text'); ?> Salesforce</a>
493
  <a id="mo_custom_login_button_preview_windows" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-windows"></i><?php
494
- echo get_option('mo_openid_login_button_customize_text'); ?> Windows</a>
495
-
496
  </div>
497
  </td>
498
  </tr>
@@ -515,22 +585,24 @@ function mo_openid_apps_config() {
515
  <td>
516
  <b>Select color for customize text:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
517
  <span style="margin-left:1px;">
518
- <input id="mo_openid_table_textbox" style="width:135px;" name="mo_login_openid_login_widget_customize_textcolor" class="color" value="<?php echo get_option('mo_login_openid_login_widget_customize_textcolor')?>"> </td>
519
  </span>
520
  </td>
521
  </tr>
522
 
523
  <tr>
524
- <td><b>Enter text to show above login widget :</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
525
 
526
  <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_widget_customize_text" value="<?php echo get_option('mo_openid_login_widget_customize_text'); ?>" /></td>
527
  </tr>
528
  <tr>
529
  <td><b>Enter text to show on your login buttons (If you have</b>
530
  <br/><b> selected shape 4 from 'Customize Login Icons' section):</b>&nbsp;&nbsp;&nbsp;&nbsp;
531
- <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_button_customize_text" value="<?php echo get_option('mo_openid_login_button_customize_text'); ?>" /></td>
 
532
  </tr>
533
 
 
534
  <tr>
535
  <td>
536
  <br>
@@ -541,13 +613,14 @@ function mo_openid_apps_config() {
541
  <tr>
542
  <td><b>Enter text to show before the logout link</b>
543
  <br/>Use ##username## to display current username:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
544
- <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_widget_customize_logout_name_text" value="<?php echo get_option('mo_openid_login_widget_customize_logout_name_text'); ?>" /></td>
545
  </tr>
546
  <tr>
547
  <td><b>Enter text to show as logout link:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
548
  <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_widget_customize_logout_text"
549
  value="<?php echo get_option('mo_openid_login_widget_customize_logout_text'); ?>" /></td>
550
  </tr>
 
551
  <td>
552
  <br>
553
  <hr>
@@ -561,7 +634,7 @@ function mo_openid_apps_config() {
561
  <tr>
562
  <td class="mo_openid_table_td_checkbox">
563
  <input type="checkbox" id="default_login_enable" name="mo_openid_default_login_enable" value="1"
564
- <?php checked( get_option('mo_openid_default_login_enable') == 1 );?> />Default Login Form</td>
565
  </tr>
566
  <tr>
567
  <td class="mo_openid_table_td_checkbox">
@@ -573,12 +646,15 @@ function mo_openid_apps_config() {
573
  <input type="checkbox" id="default_comment_enable" name="mo_openid_default_comment_enable" value="1"
574
  <?php checked( get_option('mo_openid_default_comment_enable') == 1 );?> />Comment Form</td>
575
  </tr>
 
576
  <tr>
577
  <td class="mo_openid_table_td_checkbox">
578
  <input type="checkbox" id="woocommerce_login_form" name="mo_openid_woocommerce_login_form" value="1"
579
  <?php checked( get_option('mo_openid_woocommerce_login_form') == 1 );?> />WooCommerce Login Form</td>
580
  </tr>
 
581
  <tr><td>&nbsp;</td></tr>
 
582
  <tr>
583
  <td>
584
  <b>Redirect URL after login:</b>
@@ -599,7 +675,7 @@ function mo_openid_apps_config() {
599
  <tr>
600
  <td>
601
  <input type="radio" id="login_redirect_dashboard" name="mo_openid_login_redirect" value="dashboard"
602
- <?php checked( get_option('mo_openid_login_redirect') == 'dashboard' );?> />Account dashboard
603
  </td>
604
  </tr>
605
  <tr>
@@ -633,16 +709,16 @@ function mo_openid_apps_config() {
633
  <tr>
634
  <td>
635
  <input type="radio" id="logout_redirect_login" name="mo_openid_logout_redirect" value="login"
636
- <?php checked( get_option('mo_openid_logout_redirect') == 'login' );?> />Login Page
637
  </td>
638
  </tr>
639
  <tr>
640
  <td>
641
  <input type="radio" id="logout_redirect_customurl" name="mo_openid_logout_redirect" value="custom"
642
- <?php checked( get_option('mo_openid_logout_redirect') == 'custom' );?> />Relative URL
643
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
644
  <?php echo site_url();?>
645
- <input type="text" id="logout_redirect_url" style="width:50%" name="mo_openid_logout_redirect_url" value="<?php echo get_option('mo_openid_logout_redirect_url')?>"/>
646
  </td>
647
  </tr>
648
  <tr>
@@ -657,12 +733,54 @@ function mo_openid_apps_config() {
657
  If Auto-register users is unchecked, users will not be able to register using Social Login. The users who already have an account will be able to login. This setting stands true only when users are registering using Social Login. This will not interfere with users registering through the regular WordPress.
658
  <br/><br/>
659
  <input type="checkbox" id="auto_register_enable" name="mo_openid_auto_register_enable" value="1"
660
- <?php checked( get_option('mo_openid_auto_register_enable') == 1 );?> /><b>Auto-register users</b>
661
  <br/><br/>
662
  <b>Registration disabled message: </b>
663
- <textarea id="auto_register_disabled_message" style="width:80%" name="mo_openid_register_disabled_message"><?php echo get_option('mo_openid_register_disabled_message')?></textarea>
664
  </td>
665
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
666
  <?php if(mo_openid_is_customer_registered() && mo_openid_is_customer_valid()) { ?>
667
  <tr>
668
  <td>
@@ -849,6 +967,7 @@ function mo_openid_apps_config() {
849
 
850
  function previewLoginIcons() {
851
  var flag = 0;
 
852
  if (document.getElementById('google_enable').checked) {
853
  flag = 1;
854
  if(document.getElementById('mo_openid_login_default_radio').checked && !document.getElementById('iconwithtext').checked)
@@ -990,6 +1109,12 @@ function mo_openid_apps_config() {
990
 
991
 
992
  if (document.getElementById('twitter_enable').checked) {
 
 
 
 
 
 
993
  flag = 1;
994
  if(document.getElementById('mo_openid_login_default_radio').checked && !document.getElementById('iconwithtext').checked)
995
  jQuery("#mo_login_icon_preview_twitter").show();
@@ -1006,11 +1131,65 @@ function mo_openid_apps_config() {
1006
  jQuery("#mo_custom_login_button_preview_twitter").hide();
1007
  }
1008
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1009
  if(flag) {
1010
  jQuery("#no_apps_text").hide();
1011
  } else {
1012
  jQuery("#no_apps_text").show();
1013
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1014
  }
1015
  checkLoginButton();
1016
  </script>
@@ -1018,26 +1197,51 @@ function mo_openid_apps_config() {
1018
  <td>
1019
  <br/>
1020
  <hr>
1021
- <h3>Login Settings</h3>
1022
  </td>
1023
  </tr>
1024
  <tr>
1025
- <td><input type="checkbox" id="moopenid_social_login_avatar" name="moopenid_social_login_avatar" value="1" <?php checked( get_option('moopenid_social_login_avatar') == 1 );?> /><b>Set Display Picture for User</b>
1026
  </td>
1027
  </tr>
1028
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1029
  <tr>
1030
  <td>
1031
  <br/>
1032
- <div style=" padding: 10px;padding-top: 5px;padding-left: 10px;background-color:rgba(1, 145, 191, 0.117647);color: black;">
1033
- <span style=" color: black;font-weight: bold;float: right;font-size: 22px;font-family: Arial;"></span><h3><input type="checkbox" name="mo_openid_enable_profile_completion" value="1" <?php checked( get_option('mo_openid_enable_profile_completion') == '1' );?>>Profile Completion <p style="color:#da7587;font-weight:bold;">(Disabling profile completion is not recommended. This feature requires SMTP to be setup.)</p></h3>In case of unavailability of username or email from the social media application, user is prompted to input the same.</div>
 
 
 
 
 
1034
  </td>
1035
  </tr>
1036
 
 
 
1037
  <?php if(mo_openid_is_customer_valid() && !mo_openid_get_customer_plan('Do It Yourself')) { ?>
1038
  <tr><td>&nbsp;</td></tr>
1039
  <tr>
1040
- <td><input type="checkbox" id="moopenid_user_attributes" name="moopenid_user_attributes" value="1" <?php checked( get_option('moopenid_user_attributes') == 1 );?> /><b>Extended User Attributes</b>
1041
  </td>
1042
  </tr>
1043
  <?php } else {
@@ -1046,7 +1250,7 @@ function mo_openid_apps_config() {
1046
  </table>
1047
  <table class="mo_openid_display_table">
1048
  <tr>
1049
- <td><br /><input type="submit" name="submit" value="Save" style="width:100px;" class="button button-primary button-large" />
1050
  </td>
1051
  </tr>
1052
  <tr>
@@ -1233,7 +1437,8 @@ function mo_openid_show_otp_verification(){
1233
  <form name="f" method="post">
1234
  <td style="width:18%">
1235
  <input type="hidden" name="option" value="mo_openid_go_back"/>
1236
- <input type="submit" name="submit" value="Back" class="button button-primary button-large" /></td>
 
1237
  </form>
1238
  <form name="f" id="resend_otp_form" method="post" action="">
1239
  <td>
@@ -1241,8 +1446,6 @@ function mo_openid_show_otp_verification(){
1241
  <input type="hidden" name="option" value="mo_openid_resend_otp"/>
1242
  </td>
1243
  </tr>
1244
-
1245
-
1246
  </form>
1247
  </table>
1248
  <br>
@@ -1284,6 +1487,7 @@ function mo_openid_show_otp_verification(){
1284
 
1285
  <?php
1286
  }
 
1287
  function mo_openid_other_settings(){
1288
 
1289
  ?>
@@ -2150,6 +2354,7 @@ jQuery(function() {
2150
  </td>
2151
  <?php
2152
  }
 
2153
  function mo_openid_shortcode_info(){
2154
  ?>
2155
  <td style="vertical-align:top;width:65%;">
@@ -2213,7 +2418,7 @@ function mo_openid_shortcode_info(){
2213
 
2214
  <h4>For Sharing Icons</h4>
2215
  You can use different attribute to customize social sharing icons. All attributes are optional.<br>
2216
- <b>Example:</b> <code> [miniorange_social_sharing shape="square" heading="Share with" color="#000000" fontcolor="blue" theme="nobackground" space="4" size="30" url="http://miniorange.com"]</code>
2217
  <br>
2218
 
2219
  <h4 style="margin-bottom:0 !important">Common attributes - Horizontal and Vertical</h4>
@@ -2236,8 +2441,21 @@ function mo_openid_shortcode_info(){
2236
  <hr>
2237
  </td>
2238
  </tr>
2239
-
2240
-
 
 
 
 
 
 
 
 
 
 
 
 
 
2241
  <tr>
2242
  <td>
2243
  <h3><a id="openid_shortcode_inphp_title">Shortcode in php file</a></h3>
@@ -2263,158 +2481,298 @@ function mo_openid_shortcode_info(){
2263
  <?php
2264
  }
2265
 
2266
- function mo_openid_pricing_info(){ ?>
2267
- <td style="vertical-align:top;width:100%;">
2268
- <div class="mo_openid_table_layout">
2269
- <table class="mo_openid_pricing_table">
2270
- <h2>Licensing Plans For Social Login
2271
- <span style="float:right">
2272
- <input type="button" name="check_plan" id="check_plan" <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?> class="button button-primary button-large" value="Check License" onclick="checkLicense();"/>
 
 
 
 
 
 
2273
  <input type="button" name="ok_btn" id="ok_btn" class="button button-primary button-large" value="OK, Got It" onclick="window.location.href='admin.php?page=mo_openid_settings&tab=login'" />
2274
- </span>
2275
- </h2><hr>
2276
- <tr>
2277
- <?php if(!mo_openid_is_customer_valid()) { ?>
2278
- <td><div class="mo_openid_thumbnail mo_openid_pricing_free_tab" >
2279
- <h3 class="mo_openid_pricing_header">Free</h3>
2280
- <h4 class="mo_openid_pricing_sub_header">(You are automatically on this plan)<br/><br/></h4>
2281
- <hr>
2282
- <p class="mo_openid_pricing_text">$0 - One Time Payment<br/></p>
2283
- <hr>
2284
- <p class="mo_openid_pricing_text">Social Sharing (Free Forever)<br/>
2285
- Social Comments (Free Forever)<br/>
2286
- Social Login
2287
- (Free for 30 days)<br/>
2288
- <span style="color:pink">Profile Completion</span>**<br/></p>
2289
- <p><br/><br/></p>
2290
- <p><br/></p><br/></p>
2291
- <hr/>
2292
- <p class="mo_openid_pricing_text"><br/><br/><br/></p>
2293
- <hr>
2294
- <p class="mo_openid_pricing_text">Basic Support by Email<br/><br/></p>
2295
- </div></td>
2296
- <?php } ?>
2297
- <td><div class="mo_openid_thumbnail mo_openid_pricing_free_tab" <?php if(mo_openid_is_customer_valid()) { ?> style="width:365px" <?php } ?>>
2298
- <h3 class="mo_openid_pricing_header">Do It Yourself</h3>
2299
- <?php if(!mo_openid_is_customer_valid()) { ?>
2300
- <h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
2301
- onclick="upgradeform('wp_social_login_basic_plan')" >Upgrade Now</a></h4>
2302
- <?php } else { ?>
2303
- <h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
2304
- onclick="upgradeform('social_login_recharge_plan')" >Recharge Now</a></h4>
2305
- <?php } ?>
2306
- <hr>
2307
- <p class="mo_openid_pricing_text">$9 - One Time Payment<br/>
2308
- </p>
2309
- <hr>
2310
- <p class="mo_openid_pricing_text">
2311
- Social Sharing<br/>
2312
- Social Comments<br/>
2313
- Social Login<br/>
2314
- <span style="color:pink">Profile Completion</span>**<br/>
2315
- <p><br/><br/><br/></p>
2316
- <p><br/><br/></p>
2317
- <hr/>
2318
- <p class="mo_openid_pricing_text">Get access to user data like Name, Email, Username, Display Picture<br/><br/></p>
2319
- <hr>
2320
- <p class="mo_openid_pricing_text">Basic Support by Email<br/><br/></p>
2321
- </div></td>
2322
- <td><div class="mo_openid_thumbnail mo_openid_pricing_paid_tab" <?php if(mo_openid_is_customer_valid()) { ?> style="width:365px" <?php } ?>>
2323
- <h3 class="mo_openid_pricing_header">Best Value</h3>
2324
- <?php if(!mo_openid_is_customer_valid() || (mo_openid_is_customer_valid() && mo_openid_get_customer_plan('Do It Yourself'))) { ?>
2325
- <h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
2326
- onclick="upgradeform('wp_social_login_best_value_basic_plan')" >Upgrade Now</a></h4>
2327
- <?php } else { ?>
2328
- <h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
2329
- onclick="upgradeform('social_login_recharge_plan')" >Recharge Now</a></h4>
2330
- <?php } ?>
2331
- <hr>
2332
- <p class="mo_openid_pricing_text">$19 - One Time Payment<br/>
2333
- <hr>
2334
- <p class="mo_openid_pricing_text">
2335
- Social Sharing<br/>
2336
- Social Comments<br/>
2337
- Social Login<br/>
2338
- <span style="color:pink">Profile Completion</span>**<br/>
2339
- Extended Profile Data<br/>
2340
- Social Analytics Dashboard Access<br/>
2341
- Custom Apps***<br/></p>
2342
- <p><br/><br/></p>
2343
- <hr/>
2344
- <p class="mo_openid_pricing_text">Get access to user data like Name, Email, Username, Display Picture and <a target="_blank" href="http://miniorange.com/social-data-from-social-sites" style="color:pink">Extended Profile Data</a>*</p>
2345
- <hr>
2346
- <p class="mo_openid_pricing_text">Basic Support by Email<br/><br/></p>
2347
- </div></td>
2348
- <td><div class="mo_openid_thumbnail mo_openid_pricing_free_tab" <?php if(mo_openid_is_customer_valid()) { ?> style="width:365px" <?php } ?>>
2349
- <h3 class="mo_openid_pricing_header">Premium</h3>
2350
- <?php if(!mo_openid_is_customer_valid() || (mo_openid_is_customer_valid() && !mo_openid_get_customer_plan('Premium'))) { ?>
2351
- <h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
2352
- onclick="upgradeform('wp_social_login_premium_plan')" >Upgrade Now</a></h4>
2353
- <?php } else { ?>
2354
- <h4 class="mo_openid_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
2355
- onclick="upgradeform('social_login_recharge_plan')" >Recharge Now</a></h4>
2356
- <?php } ?>
2357
- <hr>
2358
- <p class="mo_openid_pricing_text">$29 - One Time Payment<br/>
2359
- <hr>
2360
- <p class="mo_openid_pricing_text">
2361
- Social Sharing<br/>
2362
- Social Comments<br/>
2363
- Social Login<br/>
2364
- <span style="color:pink">Profile Completion</span>**<br/>
2365
- Extended Profile Data<br/>
2366
- Social Analytics Dashboard Access<br/>
2367
- Custom Apps***<br/>
2368
- Custom Integration<br/><br/>
2369
- </p>
2370
- <hr/>
2371
- <p class="mo_openid_pricing_text">Get access to user data like Name, Email, Username, Display Picture and <a target="_blank" href="http://miniorange.com/social-data-from-social-sites" style="color:pink">Extended Profile Data</a>*</p>
2372
- <hr>
2373
- <p class="mo_openid_pricing_text">Premium Support<br/><br/></p>
2374
- </div></td>
2375
- </td>
2376
- </tr>
2377
-
2378
- </table>
2379
- <form style="display:none;" id="loginform" action="<?php echo get_option( 'mo_openid_host_name').'/moas/login'; ?>"
2380
- target="_blank" method="post">
2381
- <input type="email" name="username" value="<?php echo get_option('mo_openid_admin_email'); ?>" />
2382
- <input type="text" name="redirectUrl" value="<?php echo get_option( 'mo_openid_host_name').'/moas/initializepayment'; ?>" />
2383
- <input type="text" name="requestOrigin" id="requestOrigin" />
2384
- </form>
2385
- <form method="post" id="checkLicenseForm">
2386
- <input type="hidden" name="option" value="mo_openid_check_license">
2387
- </form>
2388
- <script>
2389
- function upgradeform(planType){
2390
- jQuery('#requestOrigin').val(planType);
2391
- jQuery('#loginform').submit();
2392
- }
2393
- function checkLicense(){
2394
- jQuery("#checkLicenseForm").submit();
2395
- }
2396
- </script>
2397
- <p><span style="color:rgba(255, 0, 0, 0.76);font-weight:bold;">* Free for 30 days</span> - The plugin uses miniOrange service for Social Login. This keeps the plugin light and delegates login to miniOrange servers thereby reducing the load on your website.</p>
2398
- <p><span style="color:#da7587;font-weight:bold;">* Extended Profile Data</span> - Extended profile data feature requires additional configuration. You need to have your own social media app and permissions from social media providers to collect extended user data.</p>
2399
- <p><span style="color:#da7587;font-weight:bold;">** Profile Completion</span> - This is a new feature that requires SMTP to be setup. In case of unavailability of username or email from the social media application, user is prompted to input the same. Disabling this feature auto creates user data. Disabling this is not recommended.</p>
2400
- <p>*** Configuring applications for Social Media is cumbersome due to which miniOrange takes care of configuring these apps. If you still wish you use your own applications for Social Login apps, custom apps can be configured for each Social Media in Best Value and Premium plans.</p>
2401
-
2402
- <h3>Steps to upgrade to premium plugin -</h3>
2403
- <p>1. You will be redirected to miniOrange Login Console. Enter your password with which you created an account with us. After that you will be redirected to payment page.</p>
2404
- <p>2. Enter you card details and complete the payment. On successful payment completion, you will see your payment listed in the Payment History.</p>
2405
- <p>3. Coming back to the plugin, on License Plans page click on <i>Check License</i> on top-right of the listed payment plans.</p>
2406
- <h3>Refund Policy -</h3>
2407
- <p><b>At miniOrange, we want to ensure you are 100% happy with your purchase. If the premium plugin you purchased is not working as advertised and you've attempted to resolve any issues with our support team, which couldn't get resolved then we will refund the whole amount within 10 days of the purchase. Please email us at <a href="mailto:info@miniorange.com"><i>info@miniorange.com</i></a> for any queries regarding the return policy.</b></p>
2408
- <b>Not applicable for -</b>
2409
- <ol>
2410
- <li>Returns that are because of features that are not advertised.</li>
2411
- <li>Returns beyond 10 days.</li>
2412
- <li>Returns for Do It Yourself plan where you don't know how to do it yourself.</li>
2413
- </ol>
2414
- <br>
2415
- </div>
2416
- </td>
2417
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2418
  }
2419
 
2420
  function mo_openid_troubleshoot_info(){ ?>
@@ -2446,7 +2804,19 @@ function mo_openid_troubleshoot_info(){ ?>
2446
  For any further queries, please submit a query on right hand side in our <b>Support Section</b>.
2447
  </div>
2448
  <hr>
2449
- </td></tr>
 
 
 
 
 
 
 
 
 
 
 
 
2450
 
2451
  <tr><td>
2452
  <h3><a id="openid_question_curl" class="mo_openid_title_panel" >cURL</a></h3>
@@ -2502,14 +2872,13 @@ function mo_openid_troubleshoot_info(){ ?>
2502
  </td></tr>
2503
 
2504
 
2505
- <tr><td>
2506
  <h3><a id="openid_question_login" class="mo_openid_title_panel" >Social Login</a></h3>
2507
  <div class="mo_openid_help_desc" hidden="" id="openid_question_login_desc">
 
2508
  <h4><a id="openid_question2" >How to add login icons to frontend login page?</a></h4>
2509
  <div id="openid_question2_desc">
2510
  You can add social login icons to frontend login page using our shortcode [miniorange_social_login]. Refer to 'Shortcode' tab to add customizations to Shortcode.
2511
-
2512
-
2513
  </div>
2514
  <hr>
2515
 
@@ -2519,11 +2888,12 @@ function mo_openid_troubleshoot_info(){ ?>
2519
  </div>
2520
  <hr>
2521
 
2522
- <h4><a id="openid_question12" >Social Login icons are not added to login/registration form.</a></h3>
2523
  <div id="openid_question12_desc">
2524
  Your login/registration form may not be wordpress's default login/registration form. In this case you can add social login icons to custom login/registration form using 'social login shortcode' [miniorange_social_login]. Refer to 'Shortcode' tab to add customizations to Shortcode.
2525
  </div>
2526
  <hr>
 
2527
  <h4><a id="openid_question3" >How can I redirect to my blog page after login?</a></h4>
2528
  <div id="openid_question3_desc">
2529
  You can select one of the options from <b>Redirect URL after login</b> of <b>Display Option</b> section under <b>Social Login</b> tab. <br>
@@ -2532,23 +2902,75 @@ function mo_openid_troubleshoot_info(){ ?>
2532
  3. Account Dsahboard <br>
2533
  4. Custom URL - Example: https://www.example.com <br>
2534
  </div>
2535
-
2536
  <hr>
 
 
2537
  <h4><a id="openid_question14">Can I configure my own apps for Facebook, Google+, Twitter etc.?</a></h4>
2538
  <div id="openid_question14_desc">
2539
- Yes, it is possible to configure your own app. That is available in Best Value and Premium plans (Custom apps).<br><br>
2540
- If you have already purchased one of the above plans, please contact us using the Support form on the right and we will help you set it up.<br>
2541
  </div>
2542
-
2543
  <hr>
 
 
2544
  <h4><a id="openid_question11" >After logout I am redirected to blank page</a></h4>
2545
  <div id="openid_question11_desc">
2546
  Your theme and Social Login plugin may conflict during logout. To resolve it you need to uncheck <b>Enable Logout Redirection</b> checkbox under <b>Display Option</b> of <b>Social Login</b> tab.
2547
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2548
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2549
  </div>
2550
  <hr>
2551
- </td></tr>
 
2552
  <tr><td>
2553
  <h3><a id="openid_question_sharing" class="mo_openid_title_panel" >Social Sharing</a></h3>
2554
  <div class="mo_openid_help_desc" hidden="" id="openid_question_sharing_desc">
@@ -2575,12 +2997,20 @@ function mo_openid_troubleshoot_info(){ ?>
2575
  </div>
2576
  <hr>
2577
 
 
 
 
 
 
 
 
 
2578
  <h4><a id="openid_question18" >Email share is not working. Why?</a></h4>
2579
  <div id="openid_question18_desc">
2580
  Email share in the plugin is enabled through <b>mailto</b>. mailto is generally configured through desktop or browser so if it is not working, mailto is not setup or improperly configured.<br><br>
2581
  To set it up properly, search for "mailto settings " followed by your Operating System's name where you have your browser installed.
2582
  </div>
2583
- <hr>
2584
 
2585
  <h4><a id="openid_question19" >I cannot see some icons in preview or on blog even though I have selected them in the plugin settings.</a></h4>
2586
  <div id="openid_question19_desc">
@@ -2588,6 +3018,7 @@ function mo_openid_troubleshoot_info(){ ?>
2588
  <br/><br/>
2589
  If you don't have Adblock installed and still face this issue, please contact us using the Support form on the right or mail us at info@miniorange.com.
2590
  </div>
 
2591
  </div>
2592
  <hr>
2593
  </td></tr>
@@ -2603,6 +3034,226 @@ function mo_openid_troubleshoot_info(){ ?>
2603
  <?php
2604
  }
2605
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2606
  function mo_openid_is_customer_registered() {
2607
  $email = get_option('mo_openid_admin_email');
2608
  $customerKey = get_option('mo_openid_admin_customer_key');
@@ -2620,7 +3271,7 @@ function miniorange_openid_support(){
2620
  <div class="mo_openid_support_layout">
2621
 
2622
  <h3>Support</h3>
2623
- <p>Need any help? Use this support form to send us a genuine query. We will reach out to you.</p>
2624
  <form method="post" action="">
2625
  <input type="hidden" name="option" value="mo_openid_contact_us_query_option" />
2626
  <table class="mo_openid_settings_table">
4
  $active_tab = $_GET[ 'tab' ];
5
  } else if(mo_openid_is_customer_registered()) {
6
  $active_tab = 'login';
7
+ } else {
8
  $active_tab = 'register';
9
  }
 
 
 
10
 
11
  if(mo_openid_is_curl_installed()==0){ ?>
12
  <p style="color:red;">(Warning: <a href="http://php.net/manual/en/curl.installation.php" target="_blank">PHP CURL extension</a> is not installed or disabled) Please go to Troubleshooting for steps to enable curl.</p>
18
  <a class="nav-tab <?php echo $active_tab == 'register' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'register'), $_SERVER['REQUEST_URI'] ); ?>">Account Setup</a>
19
  <?php } ?>
20
  <a class="nav-tab <?php echo $active_tab == 'login' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'login'), $_SERVER['REQUEST_URI'] ); ?>">Social Login</a>
21
+ <?php if(get_option('mo_openid_oauth')=='1') { ?>
22
+ <a class="nav-tab <?php echo $active_tab == 'custom_app' ? 'nav-tab-active' : ''; ?>" href="admin.php?page=mo_openid_settings&tab=custom_app">Custom App</a>
23
+ <?php } ?>
24
  <a class="nav-tab <?php echo $active_tab == 'share' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'share'), $_SERVER['REQUEST_URI'] ); ?>">Social Sharing</a>
25
  <a class="nav-tab <?php echo $active_tab == 'comment' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'comment'), $_SERVER['REQUEST_URI'] ); ?>">Social Comments</a>
26
  <a class="nav-tab <?php echo $active_tab == 'shortcode' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'shortcode'), $_SERVER['REQUEST_URI'] ); ?>">Shortcode</a>
27
  <a class="nav-tab <?php echo $active_tab == 'pricing' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'pricing'), $_SERVER['REQUEST_URI'] ); ?>">Licensing Plans</a>
28
+ <a class="nav-tab <?php echo $active_tab == 'help' ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array('tab' => 'help'), $_SERVER['REQUEST_URI'] ); ?>">FAQ</a>
29
  </h2>
30
  </div>
31
 
36
  <table style="width:100%;">
37
  <tr>
38
  <!--td style="vertical-align:top;width:65%;"-->
 
39
  <?php
40
  if( $active_tab == 'share' ) {
41
  mo_openid_other_settings();
56
  mo_openid_app_comment();
57
  } else if($active_tab == 'shortcode') {
58
  mo_openid_shortcode_info();
59
+ } else if($active_tab == 'pricing') {
60
  mo_openid_pricing_info();
61
+ } else if($active_tab == 'help') {
62
  mo_openid_troubleshoot_info();
63
+ } else if($active_tab == 'custom_app') {
64
+ ?>
65
+ <td style="vertical-align:top;width:65%;">
66
+ <?php mo_openid_custom_app_config();?>
67
+ </td>
68
+
69
+ <td style="vertical-align:top;padding-left:1%;">
70
+ <?php echo miniorange_openid_support(); ?>
71
+ </td></tr></table></div></div>
72
+ <?php
73
  }
74
 
75
 
77
  ?>
78
  <!--/td>
79
  <td style="vertical-align:top;padding-left:1%;">
80
+ <?php if($active_tab!='custom_app')
81
+ echo miniorange_openid_support(); ?>
82
  </td-->
 
83
  </table>
84
  <?php
85
 
86
  }
87
+
88
  function mo_openid_show_new_registration_page() {
89
  update_option ( 'mo_openid_new_registration', 'true' );
90
  global $current_user;
161
  </td>
162
  </tr>
163
  </table>
164
+ <br/>By clicking Next, you agree to our <a href="https://www.miniorange.com/usecases/miniOrange_Privacy_Policy.pdf" target="_blank">Privacy Policy</a> and <a href="https://www.miniorange.com/usecases/miniOrange_User_Agreement.pdf" target="_blank">User Agreement</a>.
165
  </div>
166
  </form>
167
  <form name="f" method="post" action="" id="openidgobackloginform">
210
  </tr>
211
  <tr>
212
  <td>&nbsp;</td>
213
+ <td><input type="submit" name="submit" value="Login"
214
  class="button button-primary button-large" />
215
  <input type="button" value="Registration Page" id="mo_openid_go_back"
216
  class="button button-primary button-large" />
252
 
253
  <div class="mo_openid_table_layout">
254
 
255
+ <?php if(!mo_openid_is_customer_registered()) { ?>
256
  <div style="display:block;margin-top:10px;color:red;background-color:rgba(251, 232, 0, 0.15);padding:5px;border:solid 1px rgba(255, 0, 9, 0.36);">
257
  Please <a href="<?php echo add_query_arg( array('tab' => 'register'), $_SERVER['REQUEST_URI'] ); ?>">Register or Login with miniOrange</a> to enable Social Login and Social Sharing. miniOrange takes care of creating applications for you so that you don't have to worry about creating applications in each social network.
258
  </div>
259
+ <?php }?>
260
 
261
  <table>
262
  <tr>
279
  <p>Select applications to enable social login</p>
280
 
281
  <tr>
282
+ <?php if(get_option('mo_openid_oauth')=='1') {?>
283
  <td>
284
  <table style="width:100%">
285
  <tr>
286
  <td><input type="checkbox" id="facebook_enable" class="app_enable" name="mo_openid_facebook_enable" value="1" onchange="previewLoginIcons();"
287
  <?php checked( get_option('mo_openid_facebook_enable') == 1 );?> /><strong>Facebook</strong>
288
  </td>
289
+
290
+
291
+ </tr>
292
+ <tr>
293
  <td>
294
  <input type="checkbox" id="google_enable" class="app_enable" name="mo_openid_google_enable" value="1" onchange="previewLoginIcons();"
295
  <?php checked( get_option('mo_openid_google_enable') == 1 );?> /><strong>Google</strong>
296
  </td>
297
+
298
+ </tr>
299
+ <tr>
300
+ <td>
301
+ <input type="checkbox" id="twitter_enable" class="app_enable" name="mo_openid_twitter_enable" value="1" onchange="previewLoginIcons();"
302
+ <?php checked( get_option('mo_openid_twitter_enable') == 1 );?> /><strong>Twitter</strong>
303
+ </td>
304
+
305
+ </tr>
306
+ </table>
307
+ </td>
308
+ <?php }
309
+ else {?>
310
+ <td>
311
+ <table style="width:100%">
312
+ <tr>
313
+ <td><input type="checkbox" id="facebook_enable" class="app_enable" name="mo_openid_facebook_enable" value="1" onchange="previewLoginIcons();"
314
+ <?php checked( get_option('mo_openid_facebook_enable') == 1 );?> /><strong>Facebook</strong>
315
+ </td>
316
+ <td>
317
+ <input type="checkbox" id="google_enable" class="app_enable" name="mo_openid_google_enable" value="1" onchange="previewLoginIcons();"
318
+ <?php checked( get_option('mo_openid_google_enable') == 1 );?> /><strong>Google</strong>
319
+ </td>
320
  <td>
321
  <input type="checkbox" id="vkontakte_enable" class="app_enable" name="mo_openid_vkontakte_enable" value="1" onchange="previewLoginIcons();"
322
  <?php checked( get_option('mo_openid_vkontakte_enable') == 1 );?> /><strong>Vkontakte</strong>
326
  <?php checked( get_option('mo_openid_twitter_enable') == 1 );?> /><strong>Twitter</strong>
327
  </td>
328
  <td>
329
+ <input title="Instagram doesn't return email address. Scroll down and check 'Prompt users for email' in advanced settings. Also setup SMTP for sending verification emails." type="checkbox"
330
+ id="instagram_enable" class="app_enable" name="mo_openid_instagram_enable" value="1" onchange="previewLoginIcons();"
331
+ <?php checked( get_option('mo_openid_instagram_enable') == 1 );?> /><strong>*Instagram</strong>
332
  </td>
333
  </tr>
334
  <tr>
351
  </tr>
352
  </table>
353
  </td>
354
+ <?php }?>
355
+ </tr>
356
+
357
  <tr>
358
+ <td>
 
 
 
359
  <br>
360
  <hr>
361
  <h3>Customize Login Icons</h3>
374
 
375
  <td class="mo_openid_table_td_checkbox">
376
  <input type="radio" name="mo_openid_login_theme" value="circle" onclick="checkLoginButton();moLoginPreview(document.getElementById('mo_login_icon_size').value ,'circle',setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)"
 
377
  <?php checked( get_option('mo_openid_login_theme') == 'circle' );?> />Round
378
 
379
  <span style="margin-left:106px;">
383
  </span>
384
 
385
  <span style="margin-left:111px;">
386
+ <input style="width:50px" onkeyup="moLoginSpaceValidate(this)" id="mo_login_icon_space" name="mo_login_icon_space" type="text" value="<?php echo get_option('mo_login_icon_space')?>" />
387
+ <input id="mo_login_space_plus" type="button" value="+" onmouseup="moLoginPreview(setSizeOfIcons() ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" />
388
+ <input id="mo_login_space_minus" type="button" value="-" onmouseup="moLoginPreview(setSizeOfIcons() ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" />
389
  </span>
390
 
391
 
392
  <span id="commontheme" style="margin-left:115px">
393
+ <input style="width:50px" id="mo_login_icon_size" onkeyup="moLoginSizeValidate(this)" name="mo_login_icon_custom_size" type="text" value="<?php echo get_option('mo_login_icon_custom_size')?>" >
394
+ <input id="mo_login_size_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_size').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
395
+ <input id="mo_login_size_minus" type="button" value="-" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_size').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
396
 
397
  </span>
398
  <span style="margin-left:91px" class="longbuttontheme">Width:&nbsp;
399
+ <input style="width:50px" id="mo_login_icon_width" onkeyup="moLoginWidthValidate(this)" name="mo_login_icon_custom_width" type="text" value="<?php echo get_option('mo_login_icon_custom_width')?>" >
400
  <span style="margin-left:3px;">
401
 
402
+ <input id="mo_login_width_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
403
+ <input id="mo_login_width_minus" type="button" value="-" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
404
 
405
  </span>
406
  </span>
412
  <tr>
413
  <td class="mo_openid_table_td_checkbox">
414
  <input type="radio" name="mo_openid_login_theme" value="oval" onclick="checkLoginButton();moLoginPreview(document.getElementById('mo_login_icon_size').value,'oval',setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_size').value,document.getElementById('mo_login_icon_custom_boundary').value )"
 
415
  <?php checked( get_option('mo_openid_login_theme') == 'oval' );?> />Rounded Edges
416
 
417
  <span style="margin-left:50px;">
418
+ <input type="radio" id="mo_openid_login_custom_radio" name="mo_openid_login_custom_theme" value="custom" onclick="checkLoginButton();moLoginPreview(setSizeOfIcons(), setLoginTheme(),'custom',document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)"
419
  <?php checked( get_option('mo_openid_login_custom_theme') == 'custom' );?> />Custom Background*
420
 
421
  </span>
423
 
424
 
425
  <span style="margin-left:235px" class="longbuttontheme" >Height:
426
+ <input style="width:50px" id="mo_login_icon_height" onkeyup="moLoginHeightValidate(this)" name="mo_login_icon_custom_height" type="text" value="<?php echo get_option('mo_login_icon_custom_height')?>" >
427
  <span style="margin-left:1px;">
428
 
429
+ <input id="mo_login_height_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
430
+ <input id="mo_login_height_minus" type="button" value="-" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
431
  </span>
432
  </span>
433
  </td>
436
  <tr>
437
  <td class="mo_openid_table_td_checkbox">
438
  <input type="radio" name="mo_openid_login_theme" value="square" onclick="checkLoginButton();moLoginPreview(document.getElementById('mo_login_icon_size').value ,'square',setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_size').value,document.getElementById('mo_login_icon_custom_boundary').value )"
 
439
  <?php checked( get_option('mo_openid_login_theme') == 'square' );?> />Square
440
 
441
  <span style="margin-left:113px;">
442
+ <input id="mo_login_icon_custom_color" style="width:135px;" name="mo_login_icon_custom_color" class="color" value="<?php echo get_option('mo_login_icon_custom_color')?>" onchange="moLoginPreview(setSizeOfIcons(), setLoginTheme(),'custom',document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
443
  </span>
444
 
445
 
446
  <span style="margin-left:228px" class="longbuttontheme">Curve:
447
  <input style="width:50px" id="mo_login_icon_custom_boundary" onkeyup="moLoginBoundaryValidate(this)" name="mo_login_icon_custom_boundary" type="text" value=
448
+ "<?php echo get_option('mo_login_icon_custom_boundary')?>" />
449
  <span style="margin-left:6px;">
450
 
451
+ <input id="mo_login_boundary_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" />
452
+ <input id="mo_login_boundary_minus" type="button" value="-" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" />
453
  </span>
454
  </span>
455
  </td>
462
  <tr>
463
  <td> <br><b>Preview : </b><br/><span hidden id="no_apps_text">No apps selected</span>
464
  <div>
465
+ <?php if(get_option('mo_openid_oauth')=='1') {?>
466
+ <img class="mo_login_icon_preview" id="mo_login_icon_preview_facebook" src="<?php echo plugins_url( 'includes/images/icons/facebook.png', __FILE__ )?>" />
467
+ <img class="mo_login_icon_preview" id="mo_login_icon_preview_google" src="<?php echo plugins_url( 'includes/images/icons/google.png', __FILE__ )?>" />
468
+ <img class="mo_login_icon_preview" id="mo_login_icon_preview_twitter" src="<?php echo plugins_url( 'includes/images/icons/twitter.png', __FILE__ )?>" />
469
+
470
+ <?php }
471
+ else { ?>
472
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_facebook" src="<?php echo plugins_url( 'includes/images/icons/facebook.png', __FILE__ )?>" />
473
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_google" src="<?php echo plugins_url( 'includes/images/icons/google.png', __FILE__ )?>" />
474
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_vkontakte" src="<?php echo plugins_url( 'includes/images/icons/vk.png', __FILE__ )?>" />
478
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_amazon" src="<?php echo plugins_url( 'includes/images/icons/amazon.png', __FILE__ )?>" />
479
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_salesforce" src="<?php echo plugins_url( 'includes/images/icons/salesforce.png', __FILE__ )?>" />
480
  <img class="mo_login_icon_preview" id="mo_login_icon_preview_windowslive" src="<?php echo plugins_url( 'includes/images/icons/windowslive.png', __FILE__ )?>" />
481
+ <?php }?>
482
  </div>
483
 
484
  <div>
485
+ <?php if(get_option('mo_openid_oauth')=='1') {?>
486
+ <a id="mo_login_button_preview_facebook" class="btn btn-block btn-defaulttheme btn-social btn-facebook btn-custom-size"> <i class="fa fa-facebook"></i><?php
487
+ echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
488
+ <a id="mo_login_button_preview_google" class="btn btn-block btn-defaulttheme btn-social btn-google btn-custom-size"> <i class="fa fa-google-plus"></i><?php
489
+ echo get_option('mo_openid_login_button_customize_text'); ?> Google</a>
490
+ <a id="mo_login_button_preview_twitter" class="btn btn-block btn-defaulttheme btn-social btn-twitter btn-custom-size"> <i class="fa fa-twitter"></i><?php
491
+ echo get_option('mo_openid_login_button_customize_text'); ?> Twitter</a>
492
+
493
+
494
+ <?php }
495
+ else {?>
496
  <a id="mo_login_button_preview_facebook" class="btn btn-block btn-defaulttheme btn-social btn-facebook btn-custom-size"> <i class="fa fa-facebook"></i><?php
497
  echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
498
  <a id="mo_login_button_preview_google" class="btn btn-block btn-defaulttheme btn-social btn-google btn-custom-size"> <i class="fa fa-google-plus"></i><?php
511
  echo get_option('mo_openid_login_button_customize_text'); ?> Salesforce</a>
512
  <a id="mo_login_button_preview_windowslive" class="btn btn-block btn-defaulttheme btn-social btn-microsoft btn-custom-size"> <i class="fa fa-windows"></i><?php
513
  echo get_option('mo_openid_login_button_customize_text'); ?> Windows</a>
514
+ <?php }?>
515
  </div>
516
 
517
  <div>
518
+ <?php if(get_option('mo_openid_oauth')=='1') {?>
519
+ <i class="mo_custom_login_icon_preview fa fa-facebook" id="mo_custom_login_icon_preview_facebook" style="color:#ffffff;text-align:center;margin-top:5px;"></i>
520
+ <i class="mo_custom_login_icon_preview fa fa-google-plus" id="mo_custom_login_icon_preview_google" style="color:#ffffff;text-align:center;margin-top:5px;"></i>
521
+ <i class="mo_custom_login_icon_preview fa fa-twitter" id="mo_custom_login_icon_preview_twitter" style="color:#ffffff;text-align:center;margin-top:5px;" ></i>
522
+
523
+ <?php }
524
+ else {?>
525
  <i class="mo_custom_login_icon_preview fa fa-facebook" id="mo_custom_login_icon_preview_facebook" style="color:#ffffff;text-align:center;margin-top:5px;"></i>
526
  <i class="mo_custom_login_icon_preview fa fa-google-plus" id="mo_custom_login_icon_preview_google" style="color:#ffffff;text-align:center;margin-top:5px;"></i>
527
  <i class="mo_custom_login_icon_preview fa fa-vk" id="mo_custom_login_icon_preview_vkontakte" style="color:#ffffff;text-align:center;margin-top:5px;"></i>
531
  <i class="mo_custom_login_icon_preview fa fa-amazon" id="amazoncustom" style="color:#ffffff;text-align:center;margin-top:5px;"></i>
532
  <i class="mo_custom_login_icon_preview fa fa-cloud" id="salesforcecustom" style="margin-bottom:-10px;color:#ffffff;text-align:center;margin-top:5px;" ></i>
533
  <i class="mo_custom_login_icon_preview fa fa-windows" id="mo_custom_login_icon_preview_windows" style="color:#ffffff;text-align:center;margin-top:5px;" ></i>
534
+ <?php }?>
535
  </div>
536
 
537
  <div>
538
+ <?php if(get_option('mo_openid_oauth')=='1') {?>
539
+ <a id="mo_custom_login_button_preview_facebook" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-facebook"></i><?php
540
+ echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
541
+ <a id="mo_custom_login_button_preview_google" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-google-plus"></i><?php
542
+ echo get_option('mo_openid_login_button_customize_text'); ?> Google</a>
543
+ <a id="mo_custom_login_button_preview_twitter" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-twitter"></i><?php
544
+ echo get_option('mo_openid_login_button_customize_text'); ?> Twitter</a>
545
+ <?php }
546
+ else {?>
547
  <a id="mo_custom_login_button_preview_facebook" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-facebook"></i><?php
548
  echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
549
  <a id="mo_custom_login_button_preview_google" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-google-plus"></i><?php
561
  <a id="mo_custom_login_button_preview_salesforce" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-cloud"></i><?php
562
  echo get_option('mo_openid_login_button_customize_text'); ?> Salesforce</a>
563
  <a id="mo_custom_login_button_preview_windows" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-windows"></i><?php
564
+ echo get_option('mo_openid_login_button_customize_text'); ?> Windows</a>
565
+ <?php }?>
566
  </div>
567
  </td>
568
  </tr>
585
  <td>
586
  <b>Select color for customize text:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
587
  <span style="margin-left:1px;">
588
+ <input id="mo_openid_table_textbox" style="width:135px;" name="mo_login_openid_login_widget_customize_textcolor" class="color" value="<?php echo get_option('mo_login_openid_login_widget_customize_textcolor')?>" > </td>
589
  </span>
590
  </td>
591
  </tr>
592
 
593
  <tr>
594
+ <td><b>Enter text to show above login widget:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
595
 
596
  <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_widget_customize_text" value="<?php echo get_option('mo_openid_login_widget_customize_text'); ?>" /></td>
597
  </tr>
598
  <tr>
599
  <td><b>Enter text to show on your login buttons (If you have</b>
600
  <br/><b> selected shape 4 from 'Customize Login Icons' section):</b>&nbsp;&nbsp;&nbsp;&nbsp;
601
+ <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_button_customize_text"
602
+ value="<?php echo get_option('mo_openid_login_button_customize_text'); ?>" /></td>
603
  </tr>
604
 
605
+ <?php if(get_option('mo_openid_oauth')!='1') {?>
606
  <tr>
607
  <td>
608
  <br>
613
  <tr>
614
  <td><b>Enter text to show before the logout link</b>
615
  <br/>Use ##username## to display current username:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
616
+ <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_widget_customize_logout_name_text" value="<?php echo get_option('mo_openid_login_widget_customize_logout_name_text'); ?>" /></td>
617
  </tr>
618
  <tr>
619
  <td><b>Enter text to show as logout link:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
620
  <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_widget_customize_logout_text"
621
  value="<?php echo get_option('mo_openid_login_widget_customize_logout_text'); ?>" /></td>
622
  </tr>
623
+ <?php }?>
624
  <td>
625
  <br>
626
  <hr>
634
  <tr>
635
  <td class="mo_openid_table_td_checkbox">
636
  <input type="checkbox" id="default_login_enable" name="mo_openid_default_login_enable" value="1"
637
+ <?php checked( get_option('mo_openid_default_login_enable') == 1 );?> />Default Login Form</td>
638
  </tr>
639
  <tr>
640
  <td class="mo_openid_table_td_checkbox">
646
  <input type="checkbox" id="default_comment_enable" name="mo_openid_default_comment_enable" value="1"
647
  <?php checked( get_option('mo_openid_default_comment_enable') == 1 );?> />Comment Form</td>
648
  </tr>
649
+ <?php if(get_option('mo_openid_oauth')!='1') {?>
650
  <tr>
651
  <td class="mo_openid_table_td_checkbox">
652
  <input type="checkbox" id="woocommerce_login_form" name="mo_openid_woocommerce_login_form" value="1"
653
  <?php checked( get_option('mo_openid_woocommerce_login_form') == 1 );?> />WooCommerce Login Form</td>
654
  </tr>
655
+ <?php }?>
656
  <tr><td>&nbsp;</td></tr>
657
+
658
  <tr>
659
  <td>
660
  <b>Redirect URL after login:</b>
675
  <tr>
676
  <td>
677
  <input type="radio" id="login_redirect_dashboard" name="mo_openid_login_redirect" value="dashboard"
678
+ <?php checked( get_option('mo_openid_login_redirect') == 'dashboard' );?> />Account dashboard
679
  </td>
680
  </tr>
681
  <tr>
709
  <tr>
710
  <td>
711
  <input type="radio" id="logout_redirect_login" name="mo_openid_logout_redirect" value="login"
712
+ <?php checked( get_option('mo_openid_logout_redirect') == 'login' );?> />Login Page
713
  </td>
714
  </tr>
715
  <tr>
716
  <td>
717
  <input type="radio" id="logout_redirect_customurl" name="mo_openid_logout_redirect" value="custom"
718
+ <?php checked( get_option('mo_openid_logout_redirect') == 'custom' );?> />Relative URL
719
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
720
  <?php echo site_url();?>
721
+ <input type="text" id="logout_redirect_url" style="width:50%" name="mo_openid_logout_redirect_url" value="<?php echo get_option('mo_openid_logout_redirect_url')?>" />
722
  </td>
723
  </tr>
724
  <tr>
733
  If Auto-register users is unchecked, users will not be able to register using Social Login. The users who already have an account will be able to login. This setting stands true only when users are registering using Social Login. This will not interfere with users registering through the regular WordPress.
734
  <br/><br/>
735
  <input type="checkbox" id="auto_register_enable" name="mo_openid_auto_register_enable" value="1"
736
+ <?php checked( get_option('mo_openid_auto_register_enable') == 1 );?> /><b>Auto-register users</b>
737
  <br/><br/>
738
  <b>Registration disabled message: </b>
739
+ <textarea id="auto_register_disabled_message" style="width:80%" name="mo_openid_register_disabled_message" ><?php echo get_option('mo_openid_register_disabled_message')?></textarea>
740
  </td>
741
  </tr>
742
+ <tr>
743
+ <td>
744
+ <h3 style="font-size: 16px;">Role Mapping</h3>
745
+ </td>
746
+ </tr>
747
+ <tr>
748
+ <td>
749
+ Use Role Mapping to assign this universal role to the all users registering through Social Login.
750
+ </td>
751
+ </tr>
752
+ <tr>
753
+ <td>
754
+ <br/>
755
+ <b>Universal Role: </b>
756
+ <br>
757
+ <select name="mapping_value_default" style="width:30%" id="default_group_mapping">
758
+ <?php
759
+ if(get_option('mo_openid_login_role_mapping'))
760
+ $default_role = get_option('mo_openid_login_role_mapping');
761
+ else
762
+ $default_role = get_option('default_role');
763
+ wp_dropdown_roles($default_role); ?>
764
+ </select>
765
+ </td>
766
+ </tr>
767
+
768
+
769
+ <td>
770
+ <br>
771
+ <hr>
772
+ <h3>Account Linking</h3>
773
+ </td>
774
+ <tr>
775
+ <td>
776
+ Enable account linking to let your users link their Social accounts with existing WordPress account. Users will be prompted with the option to either link to any existing account using WordPress login page or register as a new user.<br><br>
777
+ <input type="checkbox" id="account_linking_enable" name="mo_openid_account_linking_enable" value="1"
778
+ <?php checked( get_option('mo_openid_account_linking_enable') == 1 );?> /><b>Enable Account-Linking</b>
779
+ </td>
780
+ </tr>
781
+
782
+
783
+
784
  <?php if(mo_openid_is_customer_registered() && mo_openid_is_customer_valid()) { ?>
785
  <tr>
786
  <td>
967
 
968
  function previewLoginIcons() {
969
  var flag = 0;
970
+ <?php if(get_option('mo_openid_oauth')!='1') {?>
971
  if (document.getElementById('google_enable').checked) {
972
  flag = 1;
973
  if(document.getElementById('mo_openid_login_default_radio').checked && !document.getElementById('iconwithtext').checked)
1109
 
1110
 
1111
  if (document.getElementById('twitter_enable').checked) {
1112
+ if(flag) {
1113
+ jQuery("#no_apps_text").hide();
1114
+ } else {
1115
+ jQuery("#no_apps_text").show();
1116
+ }
1117
+
1118
  flag = 1;
1119
  if(document.getElementById('mo_openid_login_default_radio').checked && !document.getElementById('iconwithtext').checked)
1120
  jQuery("#mo_login_icon_preview_twitter").show();
1131
  jQuery("#mo_custom_login_button_preview_twitter").hide();
1132
  }
1133
 
1134
+ <?php }else {?>
1135
+ if (document.getElementById('google_enable').checked) {
1136
+ flag = 1;
1137
+ if(document.getElementById('mo_openid_login_default_radio').checked && !document.getElementById('iconwithtext').checked)
1138
+ jQuery("#mo_login_icon_preview_google").show();
1139
+ if(document.getElementById('mo_openid_login_custom_radio').checked && !document.getElementById('iconwithtext').checked)
1140
+ jQuery("#mo_custom_login_icon_preview_google").show();
1141
+ if(document.getElementById('mo_openid_login_default_radio').checked && document.getElementById('iconwithtext').checked)
1142
+ jQuery("#mo_login_button_preview_google").show();
1143
+ if(document.getElementById('mo_openid_login_custom_radio').checked && document.getElementById('iconwithtext').checked)
1144
+ jQuery("#mo_custom_login_button_preview_google").show();
1145
+ } else if(!document.getElementById('google_enable').checked){
1146
+ jQuery("#mo_login_icon_preview_google").hide();
1147
+ jQuery("#mo_custom_login_icon_preview_google").hide();
1148
+ jQuery("#mo_login_button_preview_google").hide();
1149
+ jQuery("#mo_custom_login_button_preview_google").hide();
1150
+
1151
+ }
1152
+
1153
+ if (document.getElementById('facebook_enable').checked) {
1154
+ flag = 1;
1155
+ if(document.getElementById('mo_openid_login_default_radio').checked && !document.getElementById('iconwithtext').checked)
1156
+ jQuery("#mo_login_icon_preview_facebook").show();
1157
+ if(document.getElementById('mo_openid_login_custom_radio').checked && !document.getElementById('iconwithtext').checked)
1158
+ jQuery("#mo_custom_login_icon_preview_facebook").show();
1159
+ if(document.getElementById('mo_openid_login_default_radio').checked && document.getElementById('iconwithtext').checked)
1160
+ jQuery("#mo_login_button_preview_facebook").show();
1161
+ if(document.getElementById('mo_openid_login_custom_radio').checked && document.getElementById('iconwithtext').checked)
1162
+ jQuery("#mo_custom_login_button_preview_facebook").show();
1163
+ }else if(!document.getElementById('facebook_enable').checked){
1164
+ jQuery("#mo_login_icon_preview_facebook").hide();
1165
+ jQuery("#mo_custom_login_icon_preview_facebook").hide();
1166
+ jQuery("#mo_login_button_preview_facebook").hide();
1167
+ jQuery("#mo_custom_login_button_preview_facebook").hide();
1168
+ }
1169
+
1170
+ if (document.getElementById('twitter_enable').checked) {
1171
  if(flag) {
1172
  jQuery("#no_apps_text").hide();
1173
  } else {
1174
  jQuery("#no_apps_text").show();
1175
  }
1176
+
1177
+ flag = 1;
1178
+ if(document.getElementById('mo_openid_login_default_radio').checked && !document.getElementById('iconwithtext').checked)
1179
+ jQuery("#mo_login_icon_preview_twitter").show();
1180
+ if(document.getElementById('mo_openid_login_custom_radio').checked && !document.getElementById('iconwithtext').checked)
1181
+ jQuery("#mo_custom_login_icon_preview_twitter").show();
1182
+ if(document.getElementById('mo_openid_login_default_radio').checked && document.getElementById('iconwithtext').checked)
1183
+ jQuery("#mo_login_button_preview_twitter").show();
1184
+ if(document.getElementById('mo_openid_login_custom_radio').checked && document.getElementById('iconwithtext').checked)
1185
+ jQuery("#mo_custom_login_button_preview_twitter").show();
1186
+ }else if(!document.getElementById('twitter_enable').checked){
1187
+ jQuery("#mo_login_icon_preview_twitter").hide();
1188
+ jQuery("#mo_custom_login_icon_preview_twitter").hide();
1189
+ jQuery("#mo_login_button_preview_twitter").hide();
1190
+ jQuery("#mo_custom_login_button_preview_twitter").hide();
1191
+ }
1192
+ <?php }?>
1193
  }
1194
  checkLoginButton();
1195
  </script>
1197
  <td>
1198
  <br/>
1199
  <hr>
1200
+ <h3>Advanced Settings</h3>
1201
  </td>
1202
  </tr>
1203
  <tr>
1204
+ <td><input type="checkbox" id="moopenid_social_login_avatar" name="moopenid_social_login_avatar" value="1" <?php checked( get_option('moopenid_social_login_avatar') == 1 );?> /><b>Set Display Picture for User</b>
1205
  </td>
1206
  </tr>
1207
 
1208
+ <?php if(get_option('mo_openid_oauth')=='1'){?>
1209
+ <tr>
1210
+ <td>
1211
+ <br/>
1212
+ <input type="checkbox" id="auto_email_enable" name="mo_openid_email_enable" value="1"
1213
+ <?php checked( get_option('mo_openid_email_enable') == 1 );?> /><b>Enable Email Notification to Admin - <?php echo get_option("mo_openid_admin_email");?> on User Registration</b>
1214
+ <br/>
1215
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ <b>Notice:</b> SMTP should be configured. ]
1216
+ </td>
1217
+ </tr>
1218
+ <tr >
1219
+ <td>
1220
+ <div ><br>
1221
+ <input type="checkbox" id="moopenid_logo_check" name="moopenid_logo_check" value="1" <?php checked( get_option('moopenid_logo_check') == 1 );?> /><b>Display miniOrange logo with social login icons and on account linking & profile completion forms.</b>
1222
+ </div>
1223
+ </td>
1224
+ </tr>
1225
+ <?php }?>
1226
  <tr>
1227
  <td>
1228
  <br/>
1229
+
1230
+ <input type="checkbox" name="mo_openid_enable_profile_completion" value="1" <?php checked( get_option('mo_openid_enable_profile_completion') == '1' );?>><b>Prompt users for username &amp; email when unavailable (profile completion)</b>
1231
+ <br>In case of unavailability of username or email from the social media application, user is prompted to input the same.
1232
+ <p style="color:#000000;">
1233
+ <b>*NOTE:</b><br> Disabling profile completion is not recommended. Instagram and Twitter don't return email address. Please keep this enabled if you are using Instagram or Twitter. This feature requires SMTP to be setup.</p>
1234
+
1235
+
1236
  </td>
1237
  </tr>
1238
 
1239
+
1240
+
1241
  <?php if(mo_openid_is_customer_valid() && !mo_openid_get_customer_plan('Do It Yourself')) { ?>
1242
  <tr><td>&nbsp;</td></tr>
1243
  <tr>
1244
+ <td><input type="checkbox" id="moopenid_user_attributes" name="moopenid_user_attributes" value="1" <?php checked( get_option('moopenid_user_attributes') == 1 );?> /><b>Extended User Attributes</b>
1245
  </td>
1246
  </tr>
1247
  <?php } else {
1250
  </table>
1251
  <table class="mo_openid_display_table">
1252
  <tr>
1253
+ <td><br /><input type="submit" name="submit" value="Save" style="width:100px;" <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?> class="button button-primary button-large" />
1254
  </td>
1255
  </tr>
1256
  <tr>
1437
  <form name="f" method="post">
1438
  <td style="width:18%">
1439
  <input type="hidden" name="option" value="mo_openid_go_back"/>
1440
+ <input type="submit" name="submit" value="Back" class="button button-primary button-large" />
1441
+ </td>
1442
  </form>
1443
  <form name="f" id="resend_otp_form" method="post" action="">
1444
  <td>
1446
  <input type="hidden" name="option" value="mo_openid_resend_otp"/>
1447
  </td>
1448
  </tr>
 
 
1449
  </form>
1450
  </table>
1451
  <br>
1487
 
1488
  <?php
1489
  }
1490
+
1491
  function mo_openid_other_settings(){
1492
 
1493
  ?>
2354
  </td>
2355
  <?php
2356
  }
2357
+
2358
  function mo_openid_shortcode_info(){
2359
  ?>
2360
  <td style="vertical-align:top;width:65%;">
2418
 
2419
  <h4>For Sharing Icons</h4>
2420
  You can use different attribute to customize social sharing icons. All attributes are optional.<br>
2421
+ <b>Example:</b> <code> [miniorange_social_sharing shape="square" heading="Share with" color="#000000" fontcolor="blue" theme="nobackground" space="4" size="30" url="https://www.miniorange.com"]</code>
2422
  <br>
2423
 
2424
  <h4 style="margin-bottom:0 !important">Common attributes - Horizontal and Vertical</h4>
2441
  <hr>
2442
  </td>
2443
  </tr>
2444
+ <tr>
2445
+ <td>
2446
+ <h3><a id="openid_comments_shortcode_title" >Social Comments Shortcode</a></h3>
2447
+ <div hidden="" id="openid_comments_shortcode" style="font-size:13px !important">
2448
+ <code>[miniorange_social_comments]</code><br> <br>
2449
+ 1. Configure Social Comments in the Social Comments tab of the plugin.<br>
2450
+ 2. Keep both the display options checked and Save.<br>
2451
+ 3. Enable Comments for the post/page you want to add <br>
2452
+ 4. <b>Pages-> Quick Edit-> Allow Comments</b> (Skip this step if you already have Comments enabled.)<br>
2453
+ 5. Add the shortcode [miniorange_social_comments] to an individual page/post.<br>
2454
+
2455
+ </div>
2456
+ <hr>
2457
+ </td>
2458
+ </tr>
2459
  <tr>
2460
  <td>
2461
  <h3><a id="openid_shortcode_inphp_title">Shortcode in php file</a></h3>
2481
  <?php
2482
  }
2483
 
2484
+ function mo_openid_pricing_info(){
2485
+ ?>
2486
+ <td style="vertical-align:top;width:100%;">
2487
+ <div class="mo_openid_table_layout">
2488
+
2489
+ <?php if(get_option('mo_openid_oauth')!='1') { ?>
2490
+ <div style="display:block;margin-top:10px;color:black;background-color:#f7faff;padding:5px;border:solid 1px #b7d1ff;">
2491
+ We have recently revised the Social Login Plans. Some plugin integrations and popular features have been added. Take a look. :)</div>
2492
+ <?php } ?>
2493
+
2494
+ <h2>Licensing Plans For Social Login
2495
+ <?php if(get_option('mo_openid_oauth')!='1') {?>
2496
+ <span style="float:right">
2497
  <input type="button" name="ok_btn" id="ok_btn" class="button button-primary button-large" value="OK, Got It" onclick="window.location.href='admin.php?page=mo_openid_settings&tab=login'" />
2498
+ <input type="button" name="check_plan" id="check_plan" <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?> class="button button-primary button-large" value="Check License" onclick="checkLicense();"/>
2499
+ </span>
2500
+ <?php } ?>
2501
+ </h2>
2502
+
2503
+ <table class="table mo_table-bordered mo_table-striped">
2504
+
2505
+ <thead>
2506
+ <tr style="background-color:#0085ba;">
2507
+ <th width="25%"><br><br><h3><font color="#ffffff">Features / Plans</font></h3></th>
2508
+ <th class="text-center" style="" width="25%"><h3><font color="#ffffff">Free</h3><p class="mo_plan-desc"></p><h3>$0 - One Time Payment <br><br>(You are automatically on this plan)</font><br><br><span>
2509
+ </span></h3></th>
2510
+ <th class="text-center" width="25%"><h3><font color="#ffffff">Standard</h3><p class="mo_plan-desc"></p><h3>$19 - One Time Payment</font><br><br>
2511
+ <span>
2512
+
2513
+ <input type="button" id="myButton" name="upgrade_btn" class="button button-default button-large" value="Contact Us using Support Form" onclick="window.location.href='admin.php?page=mo_openid_settings&tab=login'" />
2514
+
2515
+
2516
+ </span></h3></th>
2517
+
2518
+ <th class="text-center" width="25%"><h3><font color="#ffffff">Premium</h3><p class="mo_plan-desc"></p><h3>$49 - One Time Payment</font><br><br><span>
2519
+ <input type="button" id="myButton" name="upgrade_btn" class="button button-default button-large" value="Contact Us using Support Form" onclick="window.location.href='admin.php?page=mo_openid_settings&tab=login'" /> </span></h3></th>
2520
+
2521
+
2522
+
2523
+
2524
+
2525
+ </tr>
2526
+ </thead>
2527
+
2528
+ <tbody class="mo_align-center mo-fa-icon">
2529
+ <tr>
2530
+ <td>Pre-configured Social Login Apps</td>
2531
+ <td>Facebook, Google, Twitter</td>
2532
+ <td>All Apps*</i></td>
2533
+ <td>All Apps*</td>
2534
+ </tr>
2535
+ <tr>
2536
+ <td>Custom Social Login Apps</td>
2537
+ <td>Facebook, Google, Twitter</td>
2538
+ <td>All Apps*</i></td>
2539
+ <td>All Apps*</td>
2540
+ </tr>
2541
+ <tr>
2542
+ <td>Social Sharing </td>
2543
+ <td><i class="fa fa-check"></i></td>
2544
+ <td><i class="fa fa-check"></i></td>
2545
+ <td><i class="fa fa-check"></i></td>
2546
+ </tr>
2547
+ <tr>
2548
+ <td>Social Comments</td>
2549
+ <td><i class="fa fa-check"></i></td>
2550
+ <td><i class="fa fa-check"></i></td>
2551
+ <td><i class="fa fa-check"></i></td>
2552
+ </tr>
2553
+ <tr>
2554
+ <td>Login Redirect URL</td>
2555
+ <td><i class="fa fa-check"></i></td>
2556
+ <td><i class="fa fa-check"></i></td>
2557
+ <td><i class="fa fa-check"></i></td>
2558
+ </tr>
2559
+ <tr>
2560
+ <td> Logout Redirect URL</td>
2561
+ <td><i class="fa fa-check"></i></td>
2562
+ <td><i class="fa fa-check"></i></td>
2563
+ <td><i class="fa fa-check"></i></td>
2564
+ </tr>
2565
+ <tr>
2566
+ <td>Account Linking</td>
2567
+ <td><i class="fa fa-check"></i></td>
2568
+ <td><i class="fa fa-check"></i></td>
2569
+ <td><i class="fa fa-check"></i></td>
2570
+ </tr>
2571
+ <tr>
2572
+ <td>Profile completion (username, email)</td>
2573
+ <td><i class="fa fa-check"></i></td>
2574
+ <td><i class="fa fa-check"></i></td>
2575
+ <td><i class="fa fa-check"></i></td>
2576
+ </tr>
2577
+ <tr>
2578
+ <td>Profile Picture</td>
2579
+ <td><i class="fa fa-check"></i></td>
2580
+ <td><i class="fa fa-check"></i></td>
2581
+ <td><i class="fa fa-check"></i></td>
2582
+ </tr>
2583
+ <tr>
2584
+ <td>Customizable Text For Login Icons</td>
2585
+ <td><i class="fa fa-check"></i></td>
2586
+ <td><i class="fa fa-check"></i></td>
2587
+ <td><i class="fa fa-check"></i></td>
2588
+ </tr>
2589
+ <tr>
2590
+ <td>Option to enable/disable user registration </td>
2591
+ <td><i class="fa fa-check"></i></td>
2592
+ <td><i class="fa fa-check"></i></td>
2593
+ <td><i class="fa fa-check"></i></td>
2594
+ </tr>
2595
+ <tr>
2596
+ <td>Basic Email Support</td>
2597
+ <td><i class="fa fa-check"></i></</td>
2598
+ <td><i class="fa fa-check"></i></</td>
2599
+ <td><i class="fa fa-check"></i></</td>
2600
+ </tr>
2601
+ <tr>
2602
+ <?php if(get_option('mo_openid_oauth') == 1){ ?>
2603
+ <td>Email notification to admin </td>
2604
+ <td><i class="fa fa-check"></i></td>
2605
+ <td><i class="fa fa-check"></i></td>
2606
+ <td><i class="fa fa-check"></i></td>
2607
+ </tr>
2608
+ <?php } ?>
2609
+ <tr>
2610
+ <td>Email Notification to multiple admins</td>
2611
+ <td></td>
2612
+ <td><i class="fa fa-check"></i></td>
2613
+ <td><i class="fa fa-check"></i></td>
2614
+ </tr>
2615
+ <tr>
2616
+ <td>Welcome email to end users </td>
2617
+ <td></td>
2618
+ <td><i class="fa fa-check"></i></td>
2619
+ <td><i class="fa fa-check"></i></td>
2620
+ </tr>
2621
+ <tr>
2622
+ <td>Customizable Email Notification template</td>
2623
+ <td></td>
2624
+ <td><i class="fa fa-check"></i></td>
2625
+ <td><i class="fa fa-check"></i></td>
2626
+ </tr>
2627
+ <tr>
2628
+ <td>Customizable welcome email template</td>
2629
+ <td></td>
2630
+ <td><i class="fa fa-check"></i></td>
2631
+ <td><i class="fa fa-check"></i></td>
2632
+ </tr>
2633
+ <tr>
2634
+ <td>Social Login Opens in a New Window</td>
2635
+ <td></td>
2636
+ <td><i class="fa fa-check"></i></td>
2637
+ <td><i class="fa fa-check"></i></td>
2638
+ </tr>
2639
+ <tr>
2640
+ <td>Optional Powered by miniOrange</td>
2641
+ <td></td>
2642
+ <td><i class="fa fa-check"></i></td>
2643
+ <td><i class="fa fa-check"></i></td>
2644
+ </tr>
2645
+ <tr>
2646
+ <td title="Restrict registration/login for users with a specific domain ">Domain restriction </td>
2647
+ <td></td>
2648
+ <td><i class="fa fa-check"></i></td>
2649
+ <td><i class="fa fa-check"></i></td>
2650
+ </tr>
2651
+ <tr>
2652
+ <td>BuddyPress Integration**</td>
2653
+ <td></td>
2654
+ <td></td>
2655
+ <td><i class="fa fa-check"></i></td>
2656
+ </tr>
2657
+ <tr>
2658
+ <td>Woocommerce Integration**</td>
2659
+ <td></td>
2660
+ <td></td>
2661
+ <td><i class="fa fa-check"></i></td>
2662
+ </tr>
2663
+ <tr>
2664
+ <td>MailChimp Integration**</td>
2665
+ <td></td>
2666
+ <td></td>
2667
+ <td><i class="fa fa-check"></i></td>
2668
+ </tr>
2669
+ <tr>
2670
+ <td>Extended Profile Data***</td>
2671
+ <td></td>
2672
+ <td></td>
2673
+ <td><i class="fa fa-check"></i></td>
2674
+ </tr>
2675
+ <tr>
2676
+ <td>Social Analytics Dashboard Access</td>
2677
+ <td></td>
2678
+ <td></td>
2679
+ <td><i class="fa fa-check"></i></td>
2680
+ </tr>
2681
+ <tr>
2682
+ <td>Custom Integration****</td>
2683
+ <td><a target="_blank" href="<?php echo get_site_url() . "/wp-admin/admin.php?page=mo_openid_settings&tab=login";?> ">Contact Us using Support Form</a></td>
2684
+ <td><a target="_blank" href="<?php echo get_site_url() . "/wp-admin/admin.php?page=mo_openid_settings&tab=login";?> ">Contact Us using Support Form</a></td>
2685
+ <td><a target="_blank" href="<?php echo get_site_url() . "/wp-admin/admin.php?page=mo_openid_settings&tab=login";?> ">Contact Us using Support Form</a></td>
2686
+ </tr>
2687
+
2688
+ </table>
2689
+
2690
+ <br>
2691
+ <hr>
2692
+ <form style="display:none;" id="loginform" action="<?php echo get_option( 'mo_openid_host_name').'/moas/login'; ?>"
2693
+ target="_blank" method="post">
2694
+ <input type="email" name="username" value="<?php echo get_option('mo_openid_admin_email'); ?>" />
2695
+ <input type="text" name="redirectUrl" value="<?php echo get_option( 'mo_openid_host_name').'/moas/initializepayment'; ?>" />
2696
+ <input type="text" name="requestOrigin" id="requestOrigin" />
2697
+ </form>
2698
+ <form method="post" id="checkLicenseForm">
2699
+ <input type="hidden" name="option" value="mo_openid_check_license">
2700
+ </form>
2701
+
2702
+ <script>
2703
+ function upgradeform(planType){
2704
+ jQuery('#requestOrigin').val(planType);
2705
+ jQuery('#loginform').submit();
2706
+ }
2707
+ function checkLicense(){
2708
+ jQuery("#checkLicenseForm").submit();
2709
+ }
2710
+ </script>
2711
+ <p><b><span style="color:#da7587;font-weight:bold;">*Apps</span></b></p>
2712
+ <ol>
2713
+ <table border-spacing: 5px;>
2714
+ <tr>
2715
+ <td width="17%"><b>All Apps :</b></td>
2716
+ <td>Facebook, Google, Twitter, Vkontakte, LinkedIn, Windows Live, Amazon, Instagram</td>
2717
+ </tr>
2718
+ <tr>
2719
+ <td width="17%"><b>Pre-configured Apps :</b></td>
2720
+ <td>Pre-configured apps are already configured by miniOrange. Login flow will go from plugin to miniOrange and then back to plugin.</td>
2721
+ </tr>
2722
+ <tr>
2723
+ <td><b>Custom Social Login Apps :</b></td>
2724
+ <td>Using the custom app tab, you can set up your own app id and secret in the plugin. Login flow will not involve miniOrange in between. Login flow will go from plugin to social media application and then back to plugin. </td>
2725
+ </tr>
2726
+ </table>
2727
+ </ol>
2728
+ <hr>
2729
+ <p><b><span style="color:#da7587;font-weight:bold;">** Integration with other plugins</span></b></p>
2730
+ <ol>
2731
+ <table border-spacing: 5px;>
2732
+ <tr>
2733
+ <td width="17%"><b>BuddyPress Integration :</b></td>
2734
+ <td>Extended attributes returned from social app are mapped to Custom BuddyPress fields. Profile picture from social media is mapped to Buddypress avatar.</td>
2735
+ </tr>
2736
+ <tr>
2737
+ <td><b>Woocommerce Integration :</b></td>
2738
+ <td>First name, last name and email are pre-filled in billing details of a user and on the Woocommerce checkout page. Social Login icons are displayed on the Woocommerce checkout page. </td>
2739
+ </tr>
2740
+ <tr>
2741
+ <td><b>MailChimp Integration :</b></td>
2742
+ <td>A user is added as a subscriber to a mailing list in MailChimp when that user registers using Social Login. First name, last name and email are also captured for that user in the Mailing List. Option is available to download csv file that has list of emails of all users in WordPress. </td>
2743
+ </tr>
2744
+ </table>
2745
+ </ol>
2746
+ <hr>
2747
+ <table>
2748
+ <tr>
2749
+ <td width="17%"><span style="color:#da7587;font-weight:bold;">*** Extended Profile Data</span><b>:</b></td>
2750
+ <td>Extended profile data feature requires additional configuration. You need to have your own social media app and permissions from social media providers to collect extended user data.</td>
2751
+ </tr>
2752
+
2753
+ </table>
2754
+ <hr>
2755
+ <table>
2756
+ <tr>
2757
+ <td width="17%"><span style="color:#da7587;font-weight:bold;">**** Custom Integration</span><b>:</b></td>
2758
+ <td>If you have a specific custom requirement in the Social Login Plugin, we can implement and integrate it in the Plugin fo you. This includes all those custom features that come under the scope of Social Login/ Sharing/ Comments. These features are chargeable. Please send us a query through the support forum to get in touch with us about your custom requirements.</td>
2759
+ </tr>
2760
+ </table>
2761
+ <h3>Refund Policy -</h3>
2762
+ <p><b>At miniOrange, we want to ensure you are 100% happy with your purchase. If the premium plugin you purchased is not working as advertised and you've attempted to resolve any issues with our support team, which couldn't get resolved then we will refund the whole amount within 10 days of the purchase. Please email us at <a href="mailto:info@miniorange.com"><i>info@miniorange.com</i></a> for any queries regarding the return policy.</b></p>
2763
+ <b>Not applicable for -</b>
2764
+ <ol>
2765
+ <li>Returns that are because of features that are not advertised.</li>
2766
+ <li>Returns beyond 10 days.</li>
2767
+ <li>Returns for Do It Yourself plan where you don't know how to do it yourself.</li>
2768
+ </ol>
2769
+
2770
+ </div>
2771
+
2772
+
2773
+ </td>
2774
+
2775
+ <?php
2776
  }
2777
 
2778
  function mo_openid_troubleshoot_info(){ ?>
2804
  For any further queries, please submit a query on right hand side in our <b>Support Section</b>.
2805
  </div>
2806
  <hr>
2807
+ </td></tr>
2808
+
2809
+ <tr><td>
2810
+ <h3><a id="openid_question_email" class="mo_openid_title_panel" >Change email</a></h3>
2811
+ <div class="mo_openid_help_desc" hidden="" id="openid_question_email_desc">
2812
+ <h4><a id="openid_question20">I want to change the email address with which I access my account. How can I do that?</a></h4>
2813
+ <div id="openid_question20_desc">
2814
+ You will have to register in miniOrange again with your new email id.
2815
+ Please deactivate and activate the plugin by going to <strong>Plugins -> Installed Plugins</strong> and then go to the Social Login Plugin to register again. This will enable you to access miniOrange dashboard with new email address.</div><br/>
2816
+ For any further queries, please submit a query on right hand side in our <b>Support Section</b>.
2817
+ </div>
2818
+ <hr>
2819
+ </td></tr>
2820
 
2821
  <tr><td>
2822
  <h3><a id="openid_question_curl" class="mo_openid_title_panel" >cURL</a></h3>
2872
  </td></tr>
2873
 
2874
 
2875
+ <tr><td>
2876
  <h3><a id="openid_question_login" class="mo_openid_title_panel" >Social Login</a></h3>
2877
  <div class="mo_openid_help_desc" hidden="" id="openid_question_login_desc">
2878
+
2879
  <h4><a id="openid_question2" >How to add login icons to frontend login page?</a></h4>
2880
  <div id="openid_question2_desc">
2881
  You can add social login icons to frontend login page using our shortcode [miniorange_social_login]. Refer to 'Shortcode' tab to add customizations to Shortcode.
 
 
2882
  </div>
2883
  <hr>
2884
 
2888
  </div>
2889
  <hr>
2890
 
2891
+ <h4><a id="openid_question12" >Social Login icons are not added to login/registration form.</a></h4>
2892
  <div id="openid_question12_desc">
2893
  Your login/registration form may not be wordpress's default login/registration form. In this case you can add social login icons to custom login/registration form using 'social login shortcode' [miniorange_social_login]. Refer to 'Shortcode' tab to add customizations to Shortcode.
2894
  </div>
2895
  <hr>
2896
+
2897
  <h4><a id="openid_question3" >How can I redirect to my blog page after login?</a></h4>
2898
  <div id="openid_question3_desc">
2899
  You can select one of the options from <b>Redirect URL after login</b> of <b>Display Option</b> section under <b>Social Login</b> tab. <br>
2902
  3. Account Dsahboard <br>
2903
  4. Custom URL - Example: https://www.example.com <br>
2904
  </div>
 
2905
  <hr>
2906
+
2907
+ <?php if(get_option('mo_openid_oauth')!='1'){?>
2908
  <h4><a id="openid_question14">Can I configure my own apps for Facebook, Google+, Twitter etc.?</a></h4>
2909
  <div id="openid_question14_desc">
2910
+ Yes, it is possible to configure your own app. That is available in the Standard and Premium plans.<br><br>
2911
+ Please contact us using the Support form on the right if you want to purchase these plans.<br>
2912
  </div>
 
2913
  <hr>
2914
+ <?php }?>
2915
+
2916
  <h4><a id="openid_question11" >After logout I am redirected to blank page</a></h4>
2917
  <div id="openid_question11_desc">
2918
  Your theme and Social Login plugin may conflict during logout. To resolve it you need to uncheck <b>Enable Logout Redirection</b> checkbox under <b>Display Option</b> of <b>Social Login</b> tab.
2919
  </div>
2920
+ <hr>
2921
+
2922
+ <?php if(get_option('mo_openid_oauth')!='1'){?>
2923
+ <h4><a id="openid_question7" >I am not able to fetch extended attributes. How do I access extended attributes? </a></h4>
2924
+ <div id="openid_question7_desc">Check the option of Extended Attributes in the Social Login tab. Then in the miniOrange dashboard, go to Social analytics-> Social Applications Usage Summary, click on Search and then click on View under Additional Information to see extended attributes of users who login using your app. You can also download it as a csv there.<br> <strong >Note:</strong> Your app needs to have permission from users to collect extended attributes.
2925
+ </div>
2926
+ <hr>
2927
+ <?php }?>
2928
+
2929
+ <h4><a id="openid_question5" >My users get the following message -"Registration has been disabled for this site. Please contact your administrator." What should I do?</a></h4>
2930
+ <div id="openid_question5_desc">
2931
+ This means you must have unchecked the check-box of auto-register in the Social Login tab. Please check it. This will allow new users to be able to register to your site.
2932
+ </div>
2933
+ <hr>
2934
+
2935
+ <h4><a id="openid_question7" >Why do my users get a message that it is not secure to proceed?</a></h4>
2936
+ <div id="openid_question7_desc">Your website must be starting with http://. Now generally that's not an issue but our service uses https://( s stands for secure). You get a warning from the browser that the information is being passed insecurely. This happens after you log in to social media application and are coming back to your website. The warning is triggered from the browser since the data passes from https:// to http://, i.e. from a secure site to non-secure site.<br><br>We make sure that the information(email, name, username) getting passed from social media application to your website is encrypted with a key which is unique to you. So, even if the there is a warning of sending information without security, that information is encrypted. <br><br>
2937
 
2938
+ <?php if(get_option('mo_openid_oauth')=='1') {?>
2939
+ <strong>To remove this warning, you can add an SSL certificate to your website to change it to https OR use your own <a href="admin.php?page=mo_openid_settings&tab=custom_app"></strong>Custom App</a>
2940
+
2941
+
2942
+ <?php } else {?>
2943
+ <strong>To remove this warning, you can add an SSL certificate to your website to change it to https OR use your own custom app</strong>
2944
+
2945
+ <?php }?>
2946
+ </div>
2947
+ <hr>
2948
+
2949
+ <h4><a id="openid_question1" >My users get the following message -"There was an error in registration. Please contact your administrator." What should I do?</a></h4>
2950
+ <div id="openid_question1_desc">
2951
+ This message is thrown by WordPress when there is an error in user-registration. <br><br>
2952
+ 1. To see the actual error thrown by WordPress, go to \wordpress\wp-content\plugins\miniorange-login-openid\class-mo-openid-login-widget.php file <br>
2953
+ 2. Search for the line :<br/><code> //print_r($user_id); </code> <br>
2954
+ 3. Change it to <br/> <code>print_r($user_id); </code><br>
2955
+ 4. Save the file and try logging again. Please send us the error you see while logging in through the support forum to your right.
2956
+ </div>
2957
+
2958
+ <h4><a id="openid_question6" >How do I centre the social login icons?</a></h4>
2959
+ <div id="openid_question6_desc">
2960
+ 1.If you are making changes to a PHP file.<br/><br/>
2961
+ Go to the PHP file which invokes your page/post and insert the following html snippet. Also, increase the margin-left value as per your requirement. Save the file. <br>
2962
+ <code>&ltdiv style="margin-left:100px;"&gt <br>&lt?php echo do_shortcode('[miniorange_social_login]')?&gt <br>
2963
+ &lt/div&gt </code><br/><br/>
2964
+ 2.If you are making changes to an HTML file.<br/><br/>
2965
+ Go to the HTML file which invokes your page/post and insert the following html snippet. Also, increase the margin-left value as per your requirement. Save the file. <br>
2966
+ <code>&ltdiv style="margin-left:100px;"&gt <br>[miniorange_social_login]')<br>
2967
+ &lt/div&gt </code>
2968
+ </div>
2969
+
2970
  </div>
2971
  <hr>
2972
+ </td></tr>
2973
+
2974
  <tr><td>
2975
  <h3><a id="openid_question_sharing" class="mo_openid_title_panel" >Social Sharing</a></h3>
2976
  <div class="mo_openid_help_desc" hidden="" id="openid_question_sharing_desc">
2997
  </div>
2998
  <hr>
2999
 
3000
+ <h4><a id="openid_question21" >There is no option of Instagram in Social Sharing. Why?</a></h4>
3001
+ <div id="openid_question21_desc">
3002
+ Instagram has made a conscious effort to not allow sharing from external sources to fight spam and low quality photos.
3003
+ At this point of time, uploading via Instagram's API from external sources is not possible.<br><br>
3004
+ <a href='https://help.instagram.com/158826297591430' target='_blank'>https://help.instagram.com/158826297591430</a>
3005
+ </div>
3006
+ <hr>
3007
+
3008
  <h4><a id="openid_question18" >Email share is not working. Why?</a></h4>
3009
  <div id="openid_question18_desc">
3010
  Email share in the plugin is enabled through <b>mailto</b>. mailto is generally configured through desktop or browser so if it is not working, mailto is not setup or improperly configured.<br><br>
3011
  To set it up properly, search for "mailto settings " followed by your Operating System's name where you have your browser installed.
3012
  </div>
3013
+ <hr>
3014
 
3015
  <h4><a id="openid_question19" >I cannot see some icons in preview or on blog even though I have selected them in the plugin settings.</a></h4>
3016
  <div id="openid_question19_desc">
3018
  <br/><br/>
3019
  If you don't have Adblock installed and still face this issue, please contact us using the Support form on the right or mail us at info@miniorange.com.
3020
  </div>
3021
+
3022
  </div>
3023
  <hr>
3024
  </td></tr>
3034
  <?php
3035
  }
3036
 
3037
+ function mo_openid_custom_app_config(){?>
3038
+ <style>
3039
+ .tableborder {
3040
+ border-collapse: collapse;
3041
+ width: 100%;
3042
+ border-color:#eee;
3043
+ }
3044
+
3045
+ .tableborder th, .tableborder td {
3046
+ text-align: left;
3047
+ padding: 8px;
3048
+ border-color:#eee;
3049
+ }
3050
+
3051
+ .tableborder tr:nth-child(even){background-color: #f2f2f2}
3052
+ </style>
3053
+ <div class="mo_table_layout" style="min-height: 400px;">
3054
+ <?php
3055
+
3056
+ if(isset($_GET['action']) && $_GET['action']=='delete'){
3057
+ if(isset($_GET['app']))
3058
+ delete_custom_app($_GET['app']);
3059
+ } else if(isset($_GET['action']) && $_GET['action']=='instructions'){
3060
+ if(isset($_GET['app']))
3061
+ mo_custom_app_instructions($_GET['app']);
3062
+ }
3063
+
3064
+ if(isset($_GET['action']) && $_GET['action']=='add'){
3065
+ add_custom_app();
3066
+ }
3067
+ else if(isset($_GET['action']) && $_GET['action']=='update'){
3068
+ if(isset($_GET['app'])) {
3069
+ update_custom_app($_GET['app']);
3070
+ mo_custom_app_instructions($_GET['app']);
3071
+ }
3072
+ }
3073
+ else if(get_option('mo_openid_apps_list')){
3074
+ $appslist = get_option('mo_openid_apps_list');
3075
+ echo "<br><a href='admin.php?page=mo_openid_settings&tab=custom_app&action=add'><input class='button button-primary button-large' style='float:right;text-align:center;' value='Add Application'></a>";
3076
+ echo "<h3>Applications List</h3>";
3077
+ echo "<table class='tableborder'>";
3078
+ echo "<tr><th><b>Name</b></th><th>Action</th></tr>";
3079
+ foreach($appslist as $key => $app){
3080
+ echo "<tr><td>".$key."</td><td><a href='admin.php?page=mo_openid_settings&tab=custom_app&action=update&app=".$key."'>Edit</a> | <a href='admin.php?page=mo_openid_settings&tab=custom_app&action=delete&app=".$key."'>Delete</a> </td></tr>";
3081
+ }
3082
+ echo "</table>";
3083
+ echo "<br><br><br><br><br><br><br><br>";
3084
+ echo "<div style='text-align: center'><p><u>Please Note :</u><br>Once an application is configured here, it will override the default app miniOrange uses.
3085
+ Please add an application here only if you don't want to use the default miniOrange application. <br>
3086
+ </p></div>";
3087
+
3088
+ }elseif (get_option('mo_openid_apps_list')==null){
3089
+ echo "<div style='text-align: center'><p>You have not configured any custom apps yet. Please click on <b>Add Application</b> to configure your own app.</p>";
3090
+ echo "<p><u>Please Note :</u><br>Once an application is configured here, it will override the default app miniOrange uses.
3091
+ Please add an application here only if you don't want to use the default miniOrange application. <br>
3092
+ </p></div>";
3093
+ echo "<br><a href='admin.php?page=mo_openid_settings&tab=custom_app&action=add'><input class='button button-primary button-large' style='margin-left:300px;text-align:center;' value='Add Application'></a>";
3094
+ echo "<br><br><br><br><br><br><br>";
3095
+
3096
+ }?>
3097
+ </div>
3098
+ </td>
3099
+ <?php
3100
+ }
3101
+
3102
+ function add_custom_app(){
3103
+ ?>
3104
+
3105
+ <script>
3106
+ function selectapp() {
3107
+ var appname = document.getElementById("mo_oauth_app").value;
3108
+ document.getElementById("instructions").innerHTML = "";
3109
+ if(appname=="google"){
3110
+ document.getElementById("instructions").innerHTML = '<br><strong>Instructions to configure Google :</strong><ol><li>Visit the Google website for developers <a href="https://console.developers.google.com/project"target="_blank">console.developers.google.com</a>.</li><li>Open the Google API Console Credentials page and go to API Manager -> Credentials</li><li>From the project drop-down, click on + to Create a new project, enter a name for the project, and optionally, edit the provided Project ID. Click Create.</li><li>On the Credentials menu, select Create credentials, then select OAuth client ID.</li><li>You may be prompted to set a product name on the Consent screen. If so, click Configure consent screen, supply the requested information, and click Save to return to the Credentials screen.</li><li>Select Web Application for the Application Type. Enter <b><?php echo site_url()."/openidcallback";?></b> in Authorized redirect URIs.</li><li>Click Create.</li><li>On the page that appears, copy the client ID and client secret to your clipboard, as you will need them to configure above.</li><li>Enable the Google+ API.<ul><li>In the Dashboard menu, click on ENABLE APIS AND SERVICES.</li><li>Type Google+ in search box, select Google+ API and click on Enable.</li></ul></li><li>Input scope as <b>https://www.googleapis.com/auth/plus.login+https://www.googleapis.com/auth/plus.profile.emails.read </b></li><li>Go to Social Login tab to configure the display as well as other login settings.</li></ol>';
3111
+ } else if(appname=="facebook"){
3112
+ document.getElementById("instructions").innerHTML = '<br><strong>Instructions to configure Facebook : </strong><ol><li>Go to Facebook developers console <a href="https://developers.facebook.com/apps/" target="_blank">https://developers.facebook.com/apps/</a>. Login with your facebook developer account</li><li>Enter <b>Display Name</b> and click on Create App ID</li><li>In Add Product select Facebook Login and click on Setup</li><li>Click on Web. Enter your Site URL. From the left pane, select <b>Facebook Login -> Settings</b>.</li><li>Under <b>Client OAuth Settings</b>, enter <b><?php echo site_url()."/openidcallback";?></b> in Valid OAuth redirect URIs and click <b>Save Changes</b>.</li><li>Go to Settings > Basic. Paste your App ID and App Secret provided by Facebook into the fields above.</li><li>Input <b> email,public_profile </b>as scope.</li><li>Click on the Save settings button.</li><li>Go to Social Login tab to configure the display as well as other login settings.</li></ol>';
3113
+ } else if(appname=="twitter"){
3114
+ document.getElementById("instructions").innerHTML = '<br><strong>Instructions to configure Twitter : </strong><ol><li>Go to <a href="https://apps.twitter.com/" target="_blank">https://apps.twitter.com/</a> and sign in with your twitter account.</li><li>Click on <b>Create New App</b>.</li> <li>Enter Name, description, website name and callback URL.</li><li><b>Callback URL</b> <br><u>Example of public website, </u><br>if your website URL is =><?php echo site_url();?><br> then your callback URL should be => <?php echo site_url();?>/openidcallback<br><u>Example of localhost,</u><br> Twitter may not accept local IPs so try using 127.0.0.1 instead of localhost.<br> Also make sure your Callback URL is prefixed with the website. <br> Go to Settings-> General and replace "localhost" with "127.0.0.1" in <b>WordPress Address (URL)</b> and <b>Site Address (URL)</b> <br>if your website URL is => http://127.0.0.1/wordpress <br> then your callback URL should be => http://127.0.0.1/wordpress/openidcallback</li><li>Check the developer agreement checkbox and click on <b>Create your Twitter Application</b>.Under <b>Keys and Access Token</b> Tab, you will find your <b>API Key/Secret</b>.Paste them into the fields above.</li><li>Leave the scope field blank.</li><li>Click on the Save settings button.</li><li>Go to Social Login tab to configure the display as well as other login settings.</li></ol>';
3115
+
3116
+
3117
+ }
3118
+
3119
+ }
3120
+
3121
+ </script>
3122
+ <div id="toggle2" class="panel_toggle">
3123
+ <h3>Add Application</h3>
3124
+ </div>
3125
+ <form id="form-common" name="form-common" method="post" action="admin.php?page=mo_openid_settings&tab=custom_app">
3126
+ <input type="hidden" name="option" value="mo_openid_add_custom_app" />
3127
+ <table class="mo_settings_table">
3128
+ <tr>
3129
+ <td><strong><font color="#FF0000">*</font>Select Application:</strong></td>
3130
+ <td>
3131
+ <select class="mo_table_textbox" style="width:500px;" required="true" name="mo_oauth_app_name" id="mo_oauth_app" onchange="selectapp()">
3132
+ <option value="">Select Application</option>
3133
+ <option value="google">Google</option>
3134
+ <option value="facebook">Facebook</option>
3135
+ <option value="twitter">Twitter</option>
3136
+ </select>
3137
+ </td>
3138
+ </tr>
3139
+ <tr>
3140
+ <td><strong><font color="#FF0000">*</font>Client ID:</strong></td>
3141
+ <td><input class="mo_table_textbox" required="" style="height: 27px; width:500px" type="text" name="mo_oauth_client_id" value=""></td>
3142
+ </tr>
3143
+ <tr>
3144
+ <td><strong><font color="#FF0000">*</font>Client Secret:</strong></td>
3145
+ <td><input class="mo_table_textbox" required="" style="height: 27px; width:500px" type="text" name="mo_oauth_client_secret" value=""></td>
3146
+ </tr>
3147
+ <tr>
3148
+ <td><strong>Scope:</strong></td>
3149
+ <td><input class="mo_table_textbox" style="height: 27px; width:500px" type="text" name="mo_oauth_scope" value=""></td>
3150
+ </tr>
3151
+ <tr>
3152
+ <td>&nbsp;</td>
3153
+ <td><input type="submit" name="submit" value="Save settings" class="button button-primary button-large" />
3154
+ <input type="button" name="back" onclick="goBack();" value="Back" class="button button-primary button-large" />
3155
+ </td>
3156
+ </tr>
3157
+ </table>
3158
+ </form>
3159
+
3160
+ <div id="instructions">
3161
+
3162
+ </div>
3163
+ <script>
3164
+ function goBack(){
3165
+
3166
+ var base_url = '<?php echo site_url();?>';
3167
+ base_url += '/wp-admin/admin.php?page=mo_openid_settings&tab=custom_app';
3168
+ window.location.href= base_url ;
3169
+ }
3170
+ </script>
3171
+
3172
+ <?php
3173
+ }
3174
+
3175
+ function update_custom_app($appname){
3176
+
3177
+ $appslist = get_option('mo_openid_apps_list');
3178
+ foreach($appslist as $key => $app){
3179
+ if($appname == $key){
3180
+ $currentappname = $appname;
3181
+ $currentapp = $app;
3182
+ break;
3183
+ }
3184
+ }
3185
+
3186
+ if(!$currentapp)
3187
+ return;
3188
+ ?>
3189
+
3190
+ <div id="toggle2" class="panel_toggle">
3191
+ <h3>Update Application</h3>
3192
+ </div>
3193
+ <form id="form-common" name="form-common" method="post" action="admin.php?page=mo_openid_settings&tab=custom_app">
3194
+ <input type="hidden" name="option" value="mo_openid_add_custom_app" />
3195
+ <table class="mo_settings_table">
3196
+ <tr>
3197
+ <td><strong><font color="#FF0000">*</font>Application:</strong></td>
3198
+ <td>
3199
+ <input class="mo_table_textbox" required="" type="hidden" name="mo_oauth_app_name" value="<?php echo $currentappname;?>">
3200
+ <input class="mo_table_textbox" required="" type="hidden" name="mo_oauth_custom_app_name" value="<?php echo $currentappname;?>">
3201
+ <?php echo $currentappname;?><br><br>
3202
+ </td>
3203
+ </tr>
3204
+ <tr>
3205
+ <td><strong><font color="#FF0000">*</font>Client ID:</strong></td>
3206
+ <td><input class="mo_table_textbox" required="" style="height: 27px; width:500px" type="text" name="mo_oauth_client_id" value="<?php echo $currentapp['clientid'];?>"></td>
3207
+ </tr>
3208
+ <tr>
3209
+ <td><strong><font color="#FF0000">*</font>Client Secret:</strong></td>
3210
+ <td><input class="mo_table_textbox" required="" style="height: 27px; width:500px" type="text" name="mo_oauth_client_secret" value="<?php echo $currentapp['clientsecret'];?>"></td>
3211
+ </tr>
3212
+ <tr>
3213
+ <td><strong>Scope:</strong></td>
3214
+ <td><input class="mo_table_textbox" style="height: 27px; width:500px" type="text" name="mo_oauth_scope" value="<?php echo $currentapp['scope'];?>"></td>
3215
+ </tr>
3216
+ <tr>
3217
+ <td>&nbsp;</td>
3218
+ <td>
3219
+ <input type="submit" name="submit" value="Save settings" class="button button-primary button-large" />
3220
+ <input type="button" name="back" onclick="goBack();" value="Back" class="button button-primary button-large" />
3221
+ </td>
3222
+ </tr>
3223
+ </table>
3224
+ </form>
3225
+ <script>
3226
+ function goBack(){
3227
+
3228
+ var base_url = '<?php echo site_url();?>';
3229
+ base_url += '/wp-admin/admin.php?page=mo_openid_settings&tab=custom_app';
3230
+ window.location.href= base_url ;
3231
+ }
3232
+ </script>
3233
+ <?php
3234
+ }
3235
+
3236
+ function delete_custom_app($appname){
3237
+ $appslist = get_option('mo_openid_apps_list');
3238
+ foreach($appslist as $key => $app){
3239
+ if($appname == $key){
3240
+ unset($appslist[$key]);
3241
+ }
3242
+ }
3243
+ update_option('mo_openid_apps_list', $appslist);
3244
+ }
3245
+
3246
+ function mo_custom_app_instructions($appname){
3247
+ if($appname=="google"){
3248
+ echo '<br><strong>Instructions to configure Google :</strong><ol><li>Visit the Google website for developers <a href="https://console.developers.google.com/project"target="_blank">console.developers.google.com</a>.</li><li>Open the Google API Console Credentials page and go to API Manager -> Credentials</li><li>From the project drop-down, choose Create a new project, enter a name for the project, and optionally, edit the provided Project ID. Click Create.</li><li>On the Credentials page, select Create credentials, then select OAuth client ID.</li><li>You may be prompted to set a product name on the Consent screen. If so, click Configure consent screen, supply the requested information, and click Save to return to the Credentials screen.</li><li>Select Web Application for the Application Type. Follow the instructions to enter JavaScript origins, redirect URIs, or both. provide <b>'.site_url().'/openidcallback</b> for the Redirect URI.</li><li>Click Create.</li><li>On the page that appears, copy the client ID and client secret to your clipboard, as you will need them to configure above.</li><li>Enable the Google+ API.</li><li>Input scope as <b>https://www.googleapis.com/auth/plus.login+https://www.googleapis.com/auth/plus.profile.emails.read </b></li><li>Go to Social Login tab and configure the icons.</li></ol>';
3249
+ } else if($appname=="facebook"){
3250
+ echo '<br><strong>Instructions to configure Facebook : </strong><ol><li>Go to Facebook developers console <a href="https://developers.facebook.com/apps/" target="_blank">https://developers.facebook.com/apps/</a>.</li><li>Click on Create a New App/Add new App button. You will need to register as a Facebook developer to create an App.</li><li>Enter <b>Display Name</b>. And choose category.</li><li>Click on <b>Create App ID</b>.</li><li>From the left pane, select <b>Settings</b>.</li><li>From the tabs above, select <b>Advanced</b>.</li><li>Under <b>Client OAuth Settings</b>, enter <b>'.site_url().'/openidcallback</b> in Valid OAuth redirect URIs and click <b>Save Changes</b>.</li><li>Paste your App ID/Secret provided by Facebook into the fields above.</li><li>Input <b> email,public_profile </b>as scope.</li><li>Click on the Save settings button.</li><li>Go to Social Login tab and configure the icons.</li></ol>';
3251
+ } else if($appname=="twitter"){
3252
+ echo '<br><strong>Instructions to configure Twitter : </strong><ol><li>Go to <a href="https://apps.twitter.com/" target="_blank">https://apps.twitter.com/</a> and sign in with your twitter account.</li><li>Click on <b>Create New App</b>.</li> <li>Enter Name, description, website name and callback URL.</li><li><b>Callback URL</b> <br><u>Example of public website, </u><br>if your website URL is =>'.site_url().'<br> then your callback URL should be => '.site_url().'/openidcallback'.'<br><u>Example of localhost,</u><br> Twitter may not accept local IPs so try using 127.0.0.1 instead of localhost.<br> Also make sure your Callback URL is prefixed with the website. <br> Go to Settings-> General and replace "localhost" with "127.0.0.1" in <b>WordPress Address (URL)</b> and <b>Site Address (URL)</b> <br>if your website URL is => http://127.0.0.1/wordpress <br> then your callback URL should be => http://127.0.0.1/wordpress/openidcallback </li><li>Check the developer agreement checkbox and click on <b>Create your Twitter Application</b>.Under <b>Keys and Access Token</b> Tab, you will find your <b>API Key/Secret</b>.Paste them into the fields above.</li><li>Leave the scope field blank.</li><li>Click on the Save settings button.</li><li>Go to Social Login tab to configure the display as well as other login settings.</li></ol>';
3253
+ }
3254
+
3255
+ }
3256
+
3257
  function mo_openid_is_customer_registered() {
3258
  $email = get_option('mo_openid_admin_email');
3259
  $customerKey = get_option('mo_openid_admin_customer_key');
3271
  <div class="mo_openid_support_layout">
3272
 
3273
  <h3>Support</h3>
3274
+ <p>Need any help? Couldn't find an answer in <a href="<?php echo add_query_arg( array('tab' => 'help'), $_SERVER['REQUEST_URI'] ); ?>">FAQ</a>?<br>Just send us a query so we can help you.</p>
3275
  <form method="post" action="">
3276
  <input type="hidden" name="option" value="mo_openid_contact_us_query_option" />
3277
  <table class="mo_openid_settings_table">
readme.txt CHANGED
@@ -1,28 +1,28 @@
1
  === Social Login ===
2
  Contributors: miniOrange
3
- Donate link: http://miniorange.com
4
  Tags: social login, social, facebook, twitter, login
5
  Requires at least: 2.0.2
6
- Tested up to: 4.9
7
- Stable tag: 5.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Social Login implements social login, sharing, comment using any social media like Twitter, Google, Facebook. EASIEST to configure.
12
 
13
  == Description ==
14
- Social Login is the easiest to configure and conviniently allows you to setup and start using the plugin very quickly.
15
 
16
- Social Login includes Facebook, Twitter, Vkontakte, Google, LinkedIn, WindowsLive, Instagram, Salesforce and Amazon.
17
 
18
  Social Login allows your visitors to comment, share, login and register with many Social Media applications.
19
 
20
  Social Login provides different display options with beautiful customizations (CSS knowledge not needed!).
21
 
22
- = Social Login (30 days Free Trial) =
23
  Social Login allows your visitors to choose from their favourite social login apps to login, comment, share and optionally auto-register with your website or blog.
24
 
25
- One-click login to your WordPress site using social login applications like Google, Twitter, Facebook, Vkontakte, LinkedIn, Instagram, Amazon, Salesforce, Windows Live. This means, if your user is logged in to Google, user can comment on any blog or site by simply clicking the `google icon` - no username or password is explicitly required! Simply enable Social Login, **no setup of social media application** is required and you are done. Since the setup is managed by us, Social Login is a premium feature with 30 days free trial.
26
 
27
  = Social Sharing =
28
  Allow anyone to easily share your website content using their favorite social sharing applications. Social Sharing applications include Facebook, Twitter, Google+, Pinterest, Reddit, Vkontakte, Tumblr, StumbleUpon, LinkedIn, Pocket, Digg, Delicious, Odnoklassniki, Email, Print, Whatsapp. Customize your social sharing buttons to suit to your website's theme. Social sharing on homepage includes sharing with content or excerpt.
@@ -32,11 +32,17 @@ See the <a href="https://wordpress.org/plugins/miniorange-login-openid/screensho
32
  = Social Comments =
33
  Allow users to comment on your website using supported social media commenting apps such as Facebook and Google. Social Comments does not require the users to be registered or logged in on your site for adding comments.
34
 
35
- = Features - =
36
-
37
- * <b>Profile Completion</b> - If username or email is not returned from a social app, user is prompted to input the same.
38
- * Clean and easy to use WordPress admin UI
39
- * **NO SETUP required for any social login or social sharing application**
 
 
 
 
 
 
40
  * Support for SHORTCODE for both social login and social sharing(horizontal & vertical)
41
  * Choose where to add the Social Login Icons: login page, registration page, comment form or anywhere on your site using our Social Login widget/ shortcode.
42
  * Option to add Social Comment using Facebook and Google.
@@ -47,17 +53,26 @@ Allow users to comment on your website using supported social media commenting a
47
  * Preview customization of selected social login and social sharing applications in WordPress admin panel.
48
  * Horizontal Social Sharing widget for share icons
49
  * Floating Vertical Social Sharing widget for share icons
50
- * Customize social login and social sharing buttons to match your website's theme.
51
- * Select your favourite theme for social sharing and social login icons.
52
- * One-click login to your website using any social login app. [Premium with 30 days Free trial]
53
- * Login to social media applications - Facebook, Google, Vkontakte, Twitter, LinkedIn, Instagram, Amazon, Salesforce, Windows Live. [Premium with 30 days Free trial]
54
- * Set custom redirect option for social login to point your users to your desired page [Premium with 30 days Free trial]
55
- * Optionally select from a range of logout URL options for social login [Premium with 30 days Free trial]
56
- * Optional automatic user registration after social login if the user is not already registered with your site. [Premium with 30 days Free trial]
57
- * Assign universal role to users registering through Social Login [Premium]
58
- * Variety of troubleshooting topics in plugin.
59
  * **Support** using email and in-plugin support form
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  = Easy Integration =
62
  Easy integration with your website with options to add Social login on login page, registration page and comments section. Add `miniOrange - Social Login` widget to add social login in widget area. Add shortcode [miniorange_social_login] to add social login in other places. Add social sharing applications to home page, posts, content pages, WooCommerce product page, bbPress forums, bbPress topics, bbPress replies and anywhere on your site using widgets. For Social Sharing, use `miniOrange Sharing - Vertical` for floating vertical widget and `miniOrange Sharing - Horizontal` for horizontal widget to add social sharing in widget area. Add shortcode [miniorange_social_sharing] for horizontal sharing icons and [miniorange_social_sharing_vertical] for vertical sharing icons.
63
 
@@ -77,11 +92,11 @@ Our very simple and easy registration lets you register with miniOrange. miniOra
77
  = Website - =
78
  These additional features are available upon request. Send an email to info@miniorange.com if you need any of these features.
79
 
80
- User Profile Data, integration with external softwares like salesforce, box, office 365, mailchimp etc, and Social Analytics.
81
  This can also captures users’ profile data, with their permission, and automatically creates a profile in miniOrange database and you can download it using a CSV file or a PDF file.
82
 
83
- Check out our website for other plugins <a href="http://miniorange.com/plugins" >http://miniorange.com/plugins</a> or <a href="https://wordpress.org/plugins/search.php?q=miniorange" >click here</a> to see all our listed WordPress plugins.
84
- For more support or info email us at info@miniorange.com or <a href="http://miniorange.com/contact" >Contact us</a>. You can also submit your query from the plugin's configuration page.
85
 
86
 
87
  == Installation ==
@@ -123,8 +138,8 @@ To add Social Login or Social Sharing icons to a custom location, use a Shortcod
123
  = I have added miniOrange Sharing - Vertical widget to my page. How can I change its position in the page? =
124
  The vertical sharing widget for Social Sharing gives a couple of options to change its position in the page and also the space between icons. You can align the social sharing widget on the left or right side of the page. You can view these options from Appearance->Widgets or editing the widget options in Customizer.
125
 
126
- = I want to upgrade to the premium plan but I don't find the option. How can I upgrade? =
127
- Premium version of the plugin can be activated from the plugin itself. To activate the premium version, go to Licensing Plans tab and click on Upgrade Now to upgrade to the premium plan of your choice.
128
 
129
  = For any other query/problem/request =
130
  Please email us at info@miniorange.com. You can also submit your query from the Social plugin's configuration page.
@@ -144,6 +159,14 @@ Please email us at info@miniorange.com. You can also submit your query from the
144
 
145
 
146
  == Changelog ==
 
 
 
 
 
 
 
 
147
  = 5.5.2 =
148
  * Compatibility with International characters.
149
 
@@ -413,6 +436,14 @@ Please email us at info@miniorange.com. You can also submit your query from the
413
  * First version of Social Login, Social Sharing plugin.
414
 
415
  == Upgrade Notice ==
 
 
 
 
 
 
 
 
416
  = 5.5.2 =
417
  * Compatibility with International characters.
418
 
1
  === Social Login ===
2
  Contributors: miniOrange
3
+ Donate link: https://www.miniorange.com
4
  Tags: social login, social, facebook, twitter, login
5
  Requires at least: 2.0.2
6
+ Tested up to: 4.9.4
7
+ Stable tag: 6.0.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Social Login implements social login, sharing, comment using social media like Google, Facebook, Twitter. EASIEST to configure.
12
 
13
  == Description ==
14
+ Social Login is the easiest to configure and conveniently allows you to setup and start using the plugin very quickly.
15
 
16
+ Social Login includes Facebook, Twitter, Google.
17
 
18
  Social Login allows your visitors to comment, share, login and register with many Social Media applications.
19
 
20
  Social Login provides different display options with beautiful customizations (CSS knowledge not needed!).
21
 
22
+ = Social Login =
23
  Social Login allows your visitors to choose from their favourite social login apps to login, comment, share and optionally auto-register with your website or blog.
24
 
25
+ One-click login to your WordPress site using social login applications like Google, Twitter, Facebook. Paid plans support Vkontakte, LinkedIn, Instagram, Amazon, Windows Live. This means, if your user is logged in to Google, user can comment on any blog or site by simply clicking the `google icon` - no username or password is explicitly required! Simply enable Social Login, **no setup of social media application** is required and you are done.
26
 
27
  = Social Sharing =
28
  Allow anyone to easily share your website content using their favorite social sharing applications. Social Sharing applications include Facebook, Twitter, Google+, Pinterest, Reddit, Vkontakte, Tumblr, StumbleUpon, LinkedIn, Pocket, Digg, Delicious, Odnoklassniki, Email, Print, Whatsapp. Customize your social sharing buttons to suit to your website's theme. Social sharing on homepage includes sharing with content or excerpt.
32
  = Social Comments =
33
  Allow users to comment on your website using supported social media commenting apps such as Facebook and Google. Social Comments does not require the users to be registered or logged in on your site for adding comments.
34
 
35
+ = Free Version Features =
36
+
37
+ * **NO SETUP required for Facebook, Google, Twitter or social sharing application**
38
+ * Option to Setup your own application with APP ID and APP Secret for Facebook, Google, Twitter.
39
+ * Option to enable/disable user registration.
40
+ * Account Linking
41
+ * Profile completion (username, email)
42
+ * Profile Picture
43
+ * Login Redirect URL
44
+ * Logout Redirect URL
45
+ * Customizable Text For Login Icons
46
  * Support for SHORTCODE for both social login and social sharing(horizontal & vertical)
47
  * Choose where to add the Social Login Icons: login page, registration page, comment form or anywhere on your site using our Social Login widget/ shortcode.
48
  * Option to add Social Comment using Facebook and Google.
53
  * Preview customization of selected social login and social sharing applications in WordPress admin panel.
54
  * Horizontal Social Sharing widget for share icons
55
  * Floating Vertical Social Sharing widget for share icons
 
 
 
 
 
 
 
 
 
56
  * **Support** using email and in-plugin support form
57
 
58
+ = Premium Version Features =
59
+
60
+ * All free version features
61
+ * **NO SETUP required for Facebook, Google, Twitter, Vkontakte, LinkedIn, Instagram, Amazon, Windows Live [Premium]**
62
+ * **New Option to Setup your own application with APP ID and APP Secret for Facebook, Google, Twitter, Vkontakte, LinkedIn, Instagram, Amazon, Windows Live [Premium]**
63
+ * **Email Notification to multiple admins [Premium]** - Option to send email notification to admin when user registers.
64
+ * **Welcome email to end users [Premium]** - Option to send email notification to user when he registers.
65
+ * **Customizable Email Notification template [Premium]** - Customize content of email sent to admin when user registers.
66
+ * **Customizable welcome email template [Premium]** - Customize content of welcome email sent to registering users.
67
+ * **Social Login Opens in a New Window [Premium]** - Social Login opens in a new window instead of the same window.
68
+ * **Domain restriction [Premium]** - Option to restrict login/registration for users with a domain specified in the admin dashboard.
69
+ * **BuddyPress Integration [Premium]** - Extended attributes returned from social app are mapped to Custom BuddyPress fields. Profile picture from social media is mapped to Buddypress avatar.
70
+ * **Woocommerce Integration [Premium]** - First name, last name and email are pre-filled in billing details of a user and on the Woocommerce checkout page. Social Login icons are displayed on the Woocommerce checkout page.
71
+ * **MailChimp Integration [Premium]** - A user is added as a subscriber to a mailing list in MailChimp when that user registers using Social Login. First name, last name and email are also captured for that user in the Mailing List. Option is available to download csv file that has list of emails of all users in WordPress.
72
+ * **Extended Profile Data [Premium]** - Extended profile data feature requires additional configuration. You need to have your own social media app and permissions from social media providers to collect extended user data.
73
+ * **Social Analytics Dashboard Access [Premium]** -
74
+ * **Custom Integration [Premium]** - If you have a specific custom requirement in the Social Login Plugin, we can implement and integrate it in the Plugin fo you. This includes all those custom features that come under the scope of Social Login/ Sharing/ Comments. These features are chargeable. Please send us a query through the support forum to get in touch with us about your custom requirements.
75
+
76
  = Easy Integration =
77
  Easy integration with your website with options to add Social login on login page, registration page and comments section. Add `miniOrange - Social Login` widget to add social login in widget area. Add shortcode [miniorange_social_login] to add social login in other places. Add social sharing applications to home page, posts, content pages, WooCommerce product page, bbPress forums, bbPress topics, bbPress replies and anywhere on your site using widgets. For Social Sharing, use `miniOrange Sharing - Vertical` for floating vertical widget and `miniOrange Sharing - Horizontal` for horizontal widget to add social sharing in widget area. Add shortcode [miniorange_social_sharing] for horizontal sharing icons and [miniorange_social_sharing_vertical] for vertical sharing icons.
78
 
92
  = Website - =
93
  These additional features are available upon request. Send an email to info@miniorange.com if you need any of these features.
94
 
95
+ User Profile Data, integration with external softwares like salesforce, box, office 365 etc, and Social Analytics.
96
  This can also captures users’ profile data, with their permission, and automatically creates a profile in miniOrange database and you can download it using a CSV file or a PDF file.
97
 
98
+ Check out our website for other plugins <a href="https://www.miniorange.com/plugins" >https://www.miniorange.com/plugins</a> or <a href="https://wordpress.org/plugins/search.php?q=miniorange" >click here</a> to see all our listed WordPress plugins.
99
+ For more support or info email us at info@miniorange.com or <a href="https://www.miniorange.com/contact" >Contact us</a>. You can also submit your query from the plugin's configuration page.
100
 
101
 
102
  == Installation ==
138
  = I have added miniOrange Sharing - Vertical widget to my page. How can I change its position in the page? =
139
  The vertical sharing widget for Social Sharing gives a couple of options to change its position in the page and also the space between icons. You can align the social sharing widget on the left or right side of the page. You can view these options from Appearance->Widgets or editing the widget options in Customizer.
140
 
141
+ = I want to upgrade to the standard/premium plan. How can I upgrade? =
142
+ Please contact us through the support form for the standard and premium plugin.
143
 
144
  = For any other query/problem/request =
145
  Please email us at info@miniorange.com. You can also submit your query from the Social plugin's configuration page.
159
 
160
 
161
  == Changelog ==
162
+ = 6.0.1 =
163
+ * Minor Changes in Readme
164
+
165
+ = 6.0.0 =
166
+ * Added Account Linking feature (Links social account to existing WordPress account)
167
+ * Revised Payment Plans
168
+ * Compatibility with PHP 7.2.1
169
+
170
  = 5.5.2 =
171
  * Compatibility with International characters.
172
 
436
  * First version of Social Login, Social Sharing plugin.
437
 
438
  == Upgrade Notice ==
439
+ = 6.0.1 =
440
+ * Minor Changes in Readme
441
+
442
+ = 6.0.0 =
443
+ * Added Account Linking feature (Links social account to existing WordPress account)
444
+ * Revised Payment Plans
445
+ * Compatibility with PHP 7.2.1
446
+
447
  = 5.5.2 =
448
  * Compatibility with International characters.
449
 
twitter_oauth.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class twitter_oauth
4
+ {
5
+ var $key = '';
6
+ var $secret = '';
7
+
8
+ var $request_token = "https://twitter.com/oauth/request_token";
9
+ var $access_token = "https://twitter.com/oauth/access_token";
10
+ var $profile = "https://api.twitter.com/1.1/account/verify_credentials.json";
11
+
12
+ function __construct($client_key,$client_secret)
13
+ {
14
+ $this->key = $client_key; // consumer key from twitter
15
+ $this->secret = $client_secret; // secret from twitter
16
+ }
17
+
18
+ function getRequestToken()
19
+ {
20
+ // Default params
21
+ $params = array(
22
+ "oauth_version" => "1.0",
23
+ "oauth_nonce" => time(),
24
+ "oauth_timestamp" => time(),
25
+ "oauth_consumer_key" => $this->key,
26
+ "oauth_signature_method" => "HMAC-SHA1"
27
+ );
28
+
29
+ // BUILD SIGNATURE
30
+ // encode params keys, values, join and then sort.
31
+ $keys = $this->_urlencode_rfc3986(array_keys($params));
32
+ $values = $this->_urlencode_rfc3986(array_values($params));
33
+ $params = array_combine($keys, $values);
34
+ uksort($params, 'strcmp');
35
+
36
+ // convert params to string
37
+ foreach ($params as $k => $v) {
38
+ $pairs[] = $this->_urlencode_rfc3986($k).'='.$this->_urlencode_rfc3986($v);
39
+ }
40
+ $concatenatedParams = implode('&', $pairs);
41
+
42
+ // form base string (first key)
43
+ $baseString= "GET&".$this->_urlencode_rfc3986($this->request_token)."&".$this->_urlencode_rfc3986($concatenatedParams);
44
+ // form secret (second key)
45
+ $secret = $this->_urlencode_rfc3986($this->secret)."&";
46
+ // make signature and append to params
47
+ $params['oauth_signature'] = $this->_urlencode_rfc3986(base64_encode(hash_hmac('sha1', $baseString, $secret, TRUE)));
48
+
49
+ // BUILD URL
50
+ // Resort
51
+ uksort($params, 'strcmp');
52
+ // convert params to string
53
+ foreach ($params as $k => $v) {$urlPairs[] = $k."=".$v;}
54
+ $concatenatedUrlParams = implode('&', $urlPairs);
55
+ // form url
56
+ $url = $this->request_token."?".$concatenatedUrlParams;
57
+
58
+ // Send to cURL
59
+ return $this->_http($url);
60
+ }
61
+
62
+ function getAccessToken($oauth_verifier,$twitter_oauth_token)
63
+ {
64
+ $params = array(
65
+ "oauth_version" => "1.0",
66
+ "oauth_nonce" => time(),
67
+ "oauth_timestamp" => time(),
68
+ "oauth_consumer_key" => $this->key,
69
+ "oauth_token" => $twitter_oauth_token,
70
+ "oauth_signature_method" => "HMAC-SHA1"
71
+ );
72
+
73
+ $keys = $this->_urlencode_rfc3986(array_keys($params));
74
+ $values = $this->_urlencode_rfc3986(array_values($params));
75
+ $params = array_combine($keys, $values);
76
+ uksort($params, 'strcmp');
77
+
78
+ foreach ($params as $k => $v) {
79
+ $pairs[] = $this->_urlencode_rfc3986($k).'='.$this->_urlencode_rfc3986($v);
80
+ }
81
+ $concatenatedParams = implode('&', $pairs);
82
+
83
+ $baseString= "GET&".$this->_urlencode_rfc3986($this->access_token)."&".$this->_urlencode_rfc3986($concatenatedParams);
84
+ $secret = $this->_urlencode_rfc3986($this->secret)."&";
85
+ $params['oauth_signature'] = $this->_urlencode_rfc3986(base64_encode(hash_hmac('sha1', $baseString, $secret, TRUE)));
86
+
87
+ uksort($params, 'strcmp');
88
+ foreach ($params as $k => $v) {$urlPairs[] = $k."=".$v;}
89
+ $concatenatedUrlParams = implode('&', $urlPairs);
90
+ $url = $this->access_token."?".$concatenatedUrlParams;
91
+ $postData = 'oauth_verifier=' .$oauth_verifier;
92
+
93
+ return $this->_http($url,$postData);
94
+ }
95
+
96
+ function getprofile_signature($oauth_token,$oauth_token_secret,$screen_name)
97
+ {
98
+ $params = array(
99
+ "oauth_version" => "1.0",
100
+ "oauth_nonce" => time(),
101
+ "oauth_timestamp" => time(),
102
+ "oauth_consumer_key" => $this->key,
103
+ "oauth_token" => $oauth_token,
104
+ "oauth_signature_method" => "HMAC-SHA1",
105
+ "screen_name" => $screen_name
106
+ );
107
+
108
+ $keys = $this->_urlencode_rfc3986(array_keys($params));
109
+ $values = $this->_urlencode_rfc3986(array_values($params));
110
+ $params = array_combine($keys, $values);
111
+ uksort($params, 'strcmp');
112
+
113
+ foreach ($params as $k => $v) {
114
+ $pairs[] = $this->_urlencode_rfc3986($k).'='.$this->_urlencode_rfc3986($v);
115
+ }
116
+ $concatenatedParams = implode('&', $pairs);
117
+
118
+ $baseString= "GET&".$this->_urlencode_rfc3986($this->profile)."&".$this->_urlencode_rfc3986($concatenatedParams);
119
+
120
+ $secret = $this->_urlencode_rfc3986($this->secret)."&". $this->_urlencode_rfc3986($oauth_token_secret);
121
+ $params['oauth_signature'] = $this->_urlencode_rfc3986(base64_encode(hash_hmac('sha1', $baseString, $secret, TRUE)));
122
+
123
+ uksort($params, 'strcmp');
124
+ foreach ($params as $k => $v) {$urlPairs[] = $k."=".$v;}
125
+ $concatenatedUrlParams = implode('&', $urlPairs);
126
+ $url = $this->profile."?".$concatenatedUrlParams;
127
+ return $this->get_profile($url);
128
+ }
129
+
130
+ function _http($url, $post_data = null)
131
+ {
132
+ $ch = curl_init();
133
+ //echo $url; exit;
134
+
135
+ curl_setopt($ch, CURLOPT_URL, $url);
136
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
137
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
138
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
139
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
140
+
141
+ if(isset($post_data))
142
+ {
143
+ curl_setopt($ch, CURLOPT_POST, 1);
144
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
145
+ }
146
+
147
+ $response = curl_exec($ch);
148
+ mo_openid_start_session();
149
+
150
+ $this->http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
151
+ $this->last_api_call = $url;
152
+ curl_close($ch);
153
+
154
+ if($post_data != null)
155
+ {
156
+ return $response;
157
+ }
158
+ else
159
+ {
160
+ $dirs = explode('&', $response);
161
+ $dirs1 = explode('=', $dirs[0]);
162
+ return $dirs1[1];
163
+ }
164
+
165
+ }
166
+
167
+ function get_profile($url, $post_data = null)
168
+ {
169
+ $ch = curl_init();
170
+ curl_setopt($ch, CURLOPT_URL, $url);
171
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
172
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
173
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
174
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
175
+
176
+ if(isset($post_data))
177
+ {
178
+ curl_setopt($ch, CURLOPT_POST, 1);
179
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
180
+ }
181
+
182
+ $response = curl_exec($ch);
183
+ $profile_json_output = json_decode($response, true);
184
+
185
+
186
+ return $profile_json_output;
187
+ curl_close($ch);
188
+ }
189
+
190
+ function _urlencode_rfc3986($input)
191
+ {
192
+ if (is_array($input)) {
193
+ return array_map(array('twitter_oauth', '_urlencode_rfc3986'), $input);
194
+ }
195
+ else if (is_scalar($input)) {
196
+ return str_replace('+',' ',str_replace('%7E', '~', rawurlencode($input)));
197
+ }
198
+ else{
199
+ return '';
200
+ }
201
+ }
202
+ }
203
+ ?>
uninstall.php CHANGED
@@ -36,7 +36,9 @@
36
  delete_option('moopenid_social_login_avatar');
37
  delete_option('moopenid_user_attributes');
38
  delete_option('mo_openid_auto_register_enable');
39
-
 
 
40
  delete_option( 'mo_openid_social_comment_fb');
41
  delete_option( 'mo_openid_social_comment_google' );
42
  delete_option( 'mo_openid_social_comment_default' );
@@ -104,19 +106,19 @@
104
  delete_option('mo_openid_share_custom_theme');
105
  delete_option('mo_sharing_icon_custom_font');
106
  delete_option('mo_sharing_icon_space');
107
- delete_option( 'mo_openid_message');
108
  delete_option('mo_openid_logout_redirect');
109
  delete_option('mo_openid_logout_redirection_enable');
110
  delete_option('mo_openid_logout_redirect_url');
111
  delete_option('mo_openid_sms_otp_count');
112
  delete_option('mo_openid_email_otp_count');
113
  delete_option('mo_openid_login_role_mapping');
 
114
 
115
  delete_option( 'mo_openid_login_widget_customize_logout_name_text');
116
  delete_option( 'mo_openid_login_widget_customize_logout_text');
117
  delete_option( 'mo_login_openid_login_widget_customize_textcolor');
118
-
119
- delete_option('mo_openid_user_count');
120
  delete_option('mo_openid_enable_profile_completion');
121
-
122
  ?>
36
  delete_option('moopenid_social_login_avatar');
37
  delete_option('moopenid_user_attributes');
38
  delete_option('mo_openid_auto_register_enable');
39
+ delete_option('mo_openid_account_linking_enable');
40
+ delete_option('mo_openid_email_enable');
41
+ delete_option( 'mo_openid_user_number');
42
  delete_option( 'mo_openid_social_comment_fb');
43
  delete_option( 'mo_openid_social_comment_google' );
44
  delete_option( 'mo_openid_social_comment_default' );
106
  delete_option('mo_openid_share_custom_theme');
107
  delete_option('mo_sharing_icon_custom_font');
108
  delete_option('mo_sharing_icon_space');
109
+ delete_option('mo_openid_message');
110
  delete_option('mo_openid_logout_redirect');
111
  delete_option('mo_openid_logout_redirection_enable');
112
  delete_option('mo_openid_logout_redirect_url');
113
  delete_option('mo_openid_sms_otp_count');
114
  delete_option('mo_openid_email_otp_count');
115
  delete_option('mo_openid_login_role_mapping');
116
+ delete_option('moopenid_logo_check');
117
 
118
  delete_option( 'mo_openid_login_widget_customize_logout_name_text');
119
  delete_option( 'mo_openid_login_widget_customize_logout_text');
120
  delete_option( 'mo_login_openid_login_widget_customize_textcolor');
121
+ delete_option('mo_openid_oauth');
122
+ delete_option('mo_openid_apps_list');
123
  delete_option('mo_openid_enable_profile_completion');
 
124
  ?>