Login With Ajax - Version 3.1.10

Version Description

  • fixed bug where login via wp-admin is not possible when %LASTURL% is the default redirect action
Download this release

Release Info

Developer netweblogic
Plugin Icon 128x128 Login With Ajax
Version 3.1.10
Comparing to
See all releases

Code changes from version 3.1.9 to 3.1.10

login-with-ajax.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Login With Ajax
4
  Plugin URI: http://wordpress.org/extend/plugins/login-with-ajax/
5
  Description: Ajax driven login widget. Customisable from within your template folder, and advanced settings from the admin area.
6
  Author: Marcus Sykes
7
- Version: 3.1.9
8
  Author URI: http://msyk.es/?utm_source=login-with-ajax&utm_medium=plugin-header&utm_campaign=plugins
9
  Tags: Login, Ajax, Redirect, BuddyPress, MU, WPMU, sidebar, admin, widget
10
  Text Domain: login-with-ajax
@@ -24,7 +24,7 @@ GNU General Public License for more details.
24
  You should have received a copy of the GNU General Public License
25
  along with this program. If not, see <http://www.gnu.org/licenses/>.
26
  */
27
- define('LOGIN_WITH_AJAX_VERSION', '3.1.9');
28
  class LoginWithAjax {
29
 
30
  /**
@@ -367,7 +367,9 @@ class LoginWithAjax {
367
  $redirect = str_replace('%USERNICENAME%', $user->user_nicename, $redirect);
368
  }
369
  //Do string replacements
370
- $redirect = str_replace("%LASTURL%", wp_get_referer(), $redirect);
 
 
371
  if( !empty($lang) ){
372
  $redirect = str_replace("%LANG%", $lang.'/', $redirect);
373
  }
4
  Plugin URI: http://wordpress.org/extend/plugins/login-with-ajax/
5
  Description: Ajax driven login widget. Customisable from within your template folder, and advanced settings from the admin area.
6
  Author: Marcus Sykes
7
+ Version: 3.1.10
8
  Author URI: http://msyk.es/?utm_source=login-with-ajax&utm_medium=plugin-header&utm_campaign=plugins
9
  Tags: Login, Ajax, Redirect, BuddyPress, MU, WPMU, sidebar, admin, widget
10
  Text Domain: login-with-ajax
24
  You should have received a copy of the GNU General Public License
25
  along with this program. If not, see <http://www.gnu.org/licenses/>.
26
  */
27
+ define('LOGIN_WITH_AJAX_VERSION', '3.1.10');
28
  class LoginWithAjax {
29
 
30
  /**
367
  $redirect = str_replace('%USERNICENAME%', $user->user_nicename, $redirect);
368
  }
369
  //Do string replacements
370
+ if( !strstr( wp_get_referer(), wp_login_url()) ){
371
+ $redirect = str_replace("%LASTURL%", wp_get_referer(), $redirect);
372
+ }
373
  if( !empty($lang) ){
374
  $redirect = str_replace("%LANG%", $lang.'/', $redirect);
375
  }
readme.txt CHANGED
@@ -1,17 +1,16 @@
1
- === Login With Ajax ===
2
  Contributors: netweblogic
3
  Tags: login, ajax, ajax login, registration, redirect redirect, buddypress, multi site, sidebar, admin, widget
4
  Text Domain: login-with-ajax
5
  Requires at least: 4.8
6
- Tested up to: 5.3
7
- Stable tag: 3.1.9
8
  Requires PHP: 5.2
9
  License: GPLv2 or later
10
 
11
  Add smooth ajax login/registration effects and choose where users get redirected upon log in/out. Supports SSL, MultiSite, and BuddyPress.
12
 
13
- == Description ==
14
- [](http://coderisk.com/wp/plugin/login-with-ajax/RIPS-mI-qmnCald)
15
 
16
  Login With Ajax is for sites that need user logins or registrations and would like to avoid the normal wordpress login pages, this plugin adds the capability of placing a login widget in the sidebar with smooth AJAX login effects.
17
 
@@ -164,6 +163,9 @@ For further questions and answers (or to submit one yourself) go to our [https:/
164
 
165
 
166
  == Changelog ==
 
 
 
167
  = 3.1.9 =
168
  * added precautionary security sanitization/escaping of input data on admin pages and settings,
169
  * added USERNICENAME for login redirects for url-friendly usernames
1
+ === Login With Ajax ===
2
  Contributors: netweblogic
3
  Tags: login, ajax, ajax login, registration, redirect redirect, buddypress, multi site, sidebar, admin, widget
4
  Text Domain: login-with-ajax
5
  Requires at least: 4.8
6
+ Tested up to: 5.4
7
+ Stable tag: 3.1.10
8
  Requires PHP: 5.2
9
  License: GPLv2 or later
10
 
11
  Add smooth ajax login/registration effects and choose where users get redirected upon log in/out. Supports SSL, MultiSite, and BuddyPress.
12
 
13
+ == Description ==
 
14
 
15
  Login With Ajax is for sites that need user logins or registrations and would like to avoid the normal wordpress login pages, this plugin adds the capability of placing a login widget in the sidebar with smooth AJAX login effects.
16
 
163
 
164
 
165
  == Changelog ==
166
+ = 3.1.10 =
167
+ * fixed bug where login via wp-admin is not possible when %LASTURL% is the default redirect action
168
+
169
  = 3.1.9 =
170
  * added precautionary security sanitization/escaping of input data on admin pages and settings,
171
  * added USERNICENAME for login redirects for url-friendly usernames
trunk/login-with-ajax-admin.php DELETED
@@ -1,450 +0,0 @@
1
- <?php
2
- /*
3
- Copyright (C) 2009 NetWebLogic LLC
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 3 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License
16
- along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- */
18
-
19
- // Class initialization
20
- class LoginWithAjaxAdmin{
21
- // action function for above hook
22
- function __construct() {
23
- global $user_level;
24
- $lwa = LoginWithAjax::$data;
25
- add_action ( 'admin_menu', array (&$this, 'menus') );
26
- if( !empty($_REQUEST['lwa_dismiss_notice']) && wp_verify_nonce($_REQUEST['_nonce'], 'lwa_notice_'.$_REQUEST['lwa_dismiss_notice']) && current_user_can('manage_options') ){
27
- if( key_exists($_REQUEST['lwa_dismiss_notice'], $lwa['notices']) ){
28
- unset($lwa['notices'][$_REQUEST['lwa_dismiss_notice']]);
29
- if( empty($lwa['notices']) ) unset($lwa['notices']);
30
- update_option('lwa_data', $lwa);
31
- }
32
- }elseif( !empty($lwa['notices']) && is_array($lwa['notices']) && count($lwa['notices']) > 0 && current_user_can('manage_options') ){
33
- add_action('admin_notices', array(&$this, 'admin_notices'));
34
- }
35
- }
36
-
37
- function menus(){
38
- $page = add_options_page('Login With Ajax', 'Login With Ajax', 'manage_options', 'login-with-ajax', array(&$this,'options'));
39
- add_action('admin_head-'.$page, array(&$this,'options_head'));
40
- }
41
-
42
- function admin_notices() {
43
- if( !empty(LoginWithAjax::$data['notices']['password_link']) ){
44
- ?>
45
- <div class="updated notice notice-success is-dismissible password_link">
46
- <p>
47
- <?php esc_html_e("Since WordPress 4.3 passwords are not emailed to users anymore, they're replaced with a link to create a new password.", 'login-with-ajax'); ?>
48
- <a href="<?php echo admin_url('options-general.php?page=login-with-ajax'); ?>"><?php esc_html_e("Check your registration email template.", 'login-with-ajax'); ?></a>
49
- </p>
50
- <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e('Dismiss','login-with-ajax') ?></span></button>
51
- </div>
52
- <script type="text/javascript">
53
- jQuery('document').ready(function($){
54
- $(document).on('click', '.updated.notice.password_link .notice-dismiss', function(event){
55
- jQuery.post('<?php echo esc_url(admin_url('admin-ajax.php')); ?>', {
56
- 'lwa_dismiss_notice':'password_link',
57
- '_nonce':'<?php echo wp_create_nonce('lwa_notice_password_link'); ?>'
58
- });
59
- });
60
- });
61
- </script>
62
- <?php
63
- }
64
- }
65
-
66
-
67
- function options_head(){
68
- ?>
69
- <style type="text/css">
70
- .nwl-plugin table { width:100%; }
71
- .nwl-plugin table .col { width:100px; }
72
- .nwl-plugin table input.wide { width:100%; padding:2px; }
73
-
74
- </style>
75
- <?php
76
- }
77
-
78
- function options() {
79
- global $LoginWithAjax, $wp_version;
80
- add_option('lwa_data');
81
- $lwa_data = array();
82
-
83
- if( !empty($_POST['lwasubmitted']) && current_user_can('list_users') && wp_verify_nonce($_POST['_nonce'], 'login-with-ajax-admin'.get_current_user_id()) ){
84
- //Build the array of options here
85
- foreach ($_POST as $postKey => $postValue){
86
- if( $postValue != '' && preg_match('/lwa_role_log(in|out)_/', $postKey) ){
87
- //Custom role-based redirects
88
- if( preg_match('/lwa_role_login/', $postKey) ){
89
- //Login
90
- $lwa_data['role_login'][str_replace('lwa_role_login_', '', $postKey)] = esc_url_raw($postValue);
91
- }else{
92
- //Logout
93
- $lwa_data['role_logout'][str_replace('lwa_role_logout_', '', $postKey)] = esc_url_raw($postValue);
94
- }
95
- }elseif( $postKey === 'lwa_notification_message' ){
96
- if($postValue != ''){
97
- $lwa_data[substr($postKey, 4)] = sanitize_textarea_field($postValue);
98
- }
99
- }elseif( substr($postKey, 0, 4) == 'lwa_' ){
100
- //For now, no validation, since this is in admin area.
101
- if($postValue != ''){
102
- $lwa_data[substr($postKey, 4)] = sanitize_text_field($postValue);
103
- }
104
- }
105
- }
106
- update_option('lwa_data', $lwa_data);
107
- if( !empty($_POST['lwa_notification_override']) ){
108
- $override_notification = $_POST['lwa_notification_override'] ? true:false;
109
- update_option('lwa_notification_override', $override_notification);
110
- }
111
- ?>
112
- <div class="updated"><p><strong><?php esc_html_e('Changes saved.'); ?></strong></p></div>
113
- <?php
114
- }else{
115
- $lwa_data = get_option('lwa_data');
116
- }
117
- ?>
118
- <div class="wrap nwl-plugin">
119
- <h2>Login With Ajax</h2>
120
- <div id="poststuff" class="metabox-holder has-right-sidebar">
121
- <div id="side-info-column" class="inner-sidebar">
122
- <div id="categorydiv" class="postbox ">
123
- <div class="handlediv" title="Click to toggle"></div>
124
- <h3 class="hndle" style="color:green;">** Support this plugin! **</h3>
125
- <div class="inside">
126
- <p>This plugin was developed by <a href="http://msyk.es/" target="_blank">Marcus Sykes</a>, sponsored by proceeds from <a href="http://eventsmanagerpro.com" target="_blank">Events Manager Pro</a></p>
127
- <p>We're not asking for donations, but we'd appreciate a 5* rating and/or a link to our plugin page!</p>
128
- <ul>
129
- <li><a href="http://wordpress.org/support/view/plugin-reviews/login-with-ajax" target="_blank" >Give us 5 Stars on WordPress.org</a></li>
130
- <li><a href="http://wordpress.org/extend/plugins/login-with-ajax/" target="_blank" >Link to our plugin page.</a></li>
131
- </ul>
132
- </div>
133
- </div>
134
- <div id="categorydiv" class="postbox ">
135
- <div class="handlediv" title="Click to toggle"></div>
136
- <h3 class="hndle">Getting Help</h3>
137
- <div class="inside">
138
- <p>Before asking for help, check the readme files or the plugin pages for answers to common issues.</p>
139
- <p>If you're still stuck, try the <a href="http://wordpress.org/support/plugin/login-with-ajax/">community forums</a>.</p>
140
- <p>If you have any suggestions, come over to the forums and leave a comment. It may just happen!</p>
141
- </div>
142
- </div>
143
- <div id="categorydiv" class="postbox ">
144
- <div class="handlediv" title="Click to toggle"></div>
145
- <h3 class="hndle">Translating</h3>
146
- <div class="inside">
147
- <p>Translations are done by volunteers, see the <a href="https://translate.wordpress.org/projects/wp-plugins/login-with-ajax/">wordpress.org translation site</a> to join in or to add a new langauge! We've also created <a href="http://translate.netweblogic.com/start/">some helpful documentation</a> to get started.</p>
148
- </div>
149
- </div>
150
- </div>
151
- <div id="post-body">
152
- <div id="post-body-content">
153
- <form method="post" action="">
154
- <h3><?php esc_html_e("General Settings", 'login-with-ajax'); ?></h3>
155
- <table class="form-table">
156
- <?php if( count(LoginWithAjax::$templates) > 1 ) : ?>
157
- <tr valign="top">
158
- <th scope="row">
159
- <label><?php esc_html_e("Default Template", 'login-with-ajax'); ?></label>
160
- </th>
161
- <td>
162
- <select name="lwa_template" >
163
- <?php foreach( array_keys(LoginWithAjax::$templates) as $template ): ?>
164
- <option <?php echo (!empty($lwa_data['template']) && $lwa_data['template'] == $template) ? 'selected="selected"':""; ?>><?php echo esc_html($template); ?></option>
165
- <?php endforeach; ?>
166
- </select>
167
- <br />
168
- <em><?php esc_html_e("Choose the default theme you'd like to use. This can be overriden in the widget, shortcode and template tags.", 'login-with-ajax'); ?></em>
169
- <em><?php esc_html_e("Further documentation for this feature coming soon...", 'login-with-ajax'); ?></em>
170
- </td>
171
- </tr>
172
- <?php endif; ?>
173
- <tr valign="top">
174
- <th scope="row">
175
- <label><?php esc_html_e("Disable refresh upon login?", 'login-with-ajax'); ?></label>
176
- </th>
177
- <td>
178
- <input style="margin:0px; padding:0px; width:auto;" type="checkbox" name="lwa_no_login_refresh" value='1' class='wide' <?php echo ( !empty($lwa_data['no_login_refresh']) && $lwa_data['no_login_refresh'] == '1' ) ? 'checked="checked"':''; ?> />
179
- <br />
180
- <em><?php esc_html_e("If the user logs in and you check the button above, only the login widget will update itself without refreshing the page. Not a good idea if your site shows different content to users once logged in, as a refresh would be needed.", 'login-with-ajax'); ?></em>
181
- </td>
182
- </tr>
183
- </table>
184
-
185
-
186
- <h3><?php esc_html_e("Login Redirection Settings", 'login-with-ajax'); ?></h3>
187
- <p><em><?php echo esc_html(sprintf(__("If you'd like to send the user to a specific URL after %s, enter a full URL (e.g. http://wordpress.org/) in the fields below. The following placeholders can be used in all %s redirect links", 'login-with-ajax'), __('login','login-with-ajax'), __('login','login-with-ajax'))); ?></em></p>
188
- <p>
189
- <ul>
190
- <li><em><?php esc_html_e("Enter %LASTURL% to send the user back to the page they were previously on.", 'login-with-ajax'); ?></em></li>
191
- <li><em><?php esc_html_e("Use %USERNAME% and it will be replaced with the username of person logging in.", 'login-with-ajax'); ?></em></li>
192
- <li><em><?php esc_html_e("Use %USERNICENAME% and it will be replaced with a url-friendly username of person logging in.", 'login-with-ajax'); ?></em></li>
193
- <?php if( class_exists('SitePress') ): ?>
194
- <li><em><?php self::ph_esc(esc_html__("Use %LANG% and it will be replaced with the current language used in multilingual URLs, for example, English may be <code>en</code>", 'login-with-ajax')); ?></em></li>
195
- <?php endif; ?>
196
- </ul>
197
- </p>
198
- <table class="form-table">
199
- <tr valign="top">
200
- <th scope="row">
201
- <label><?php esc_html_e("Global Login Redirect", 'login-with-ajax'); ?></label>
202
- </th>
203
- <td>
204
- <input type="text" name="lwa_login_redirect" value='<?php echo (!empty($lwa_data['login_redirect'])) ? esc_attr($lwa_data['login_redirect']):''; ?>' class='wide' />
205
- <em><?php esc_html_e("If you'd like to send the user to a specific URL after login, enter it here (e.g. http://wordpress.org/)", 'login-with-ajax'); ?></em>
206
- <?php
207
- //WMPL itegrations
208
- function lwa_icl_inputs( $name, $lwa_data ){
209
- if( function_exists('icl_get_languages') ){
210
- $langs = icl_get_languages();
211
- if( count($langs) > 1 ){
212
- ?>
213
- <table id="lwa_<?php echo esc_attr($name); ?>_langs">
214
- <?php
215
- foreach($langs as $lang){
216
- if( substr(get_locale(),0,2) != $lang['language_code'] ){
217
- ?>
218
- <tr>
219
- <th style="width:100px;"><?php echo esc_html($lang['translated_name']); ?>: </th>
220
- <td><input type="text" name="lwa_<?php echo esc_attr($name); ?>_<?php echo esc_attr($lang['language_code']); ?>" value='<?php echo ( !empty($lwa_data[$name.'_'.$lang['language_code']]) ) ? esc_attr($lwa_data[$name.'_'.$lang['language_code']]):''; ?>' class="wide" /></td>
221
- </tr>
222
- <?php
223
- }
224
- }
225
- ?>
226
- </table>
227
- <em><?php esc_html_e('With WPML enabled you can provide different redirection destinations based on language too.','login-with-ajax'); ?></em>
228
- <?php
229
- }
230
- }
231
- }
232
- lwa_icl_inputs('login_redirect', $lwa_data);
233
- ?>
234
- </td>
235
- </tr>
236
- <tr valign="top">
237
- <th scope="row">
238
- <label><?php esc_html_e("Role-Based Custom Login Redirects", 'login-with-ajax'); ?></label>
239
- </th>
240
- <td>
241
- <em><?php esc_html_e("If you would like a specific user role to be redirected to a custom URL upon login, place it here (blank value will default to the global redirect)", 'login-with-ajax'); ?></em>
242
- <table>
243
- <?php
244
- //Taken from /wp-admin/includes/template.php Line 2715
245
- $editable_roles = get_editable_roles();
246
- //WMPL integration
247
- function lwa_icl_inputs_roles( $name, $lwa_data, $role ){
248
- if( function_exists('icl_get_languages') ){
249
- $langs = icl_get_languages();
250
- if( count($langs) > 1 ){
251
- ?>
252
- <table id="lwa_<?php echo esc_attr($name); ?>_langs">
253
- <?php
254
- foreach($langs as $lang){
255
- if( substr(get_locale(),0,2) != $lang['language_code'] ){
256
- ?>
257
- <tr>
258
- <th style="width:100px;"><?php echo esc_html($lang['translated_name']); ?>: </th>
259
- <td><input type="text" name="lwa_<?php echo esc_attr($name); ?>_<?php echo esc_attr($role); ?>_<?php echo esc_attr($lang['language_code']); ?>" value='<?php echo ( !empty($lwa_data[$name][$role.'_'.$lang['language_code']]) ) ? esc_attr($lwa_data[$name][$role.'_'.$lang['language_code']]):''; ?>' class="wide" /></td>
260
- </tr>
261
- <?php
262
- }
263
- }
264
- ?>
265
- </table>
266
- <em><?php esc_html_e('With WPML enabled you can provide different redirection destinations based on language too.','login-with-ajax'); ?></em>
267
- <?php
268
- }
269
- }
270
- }
271
- foreach( $editable_roles as $role => $details ) {
272
- $role_login = ( !empty($lwa_data['role_login']) && is_array($lwa_data['role_login']) && array_key_exists($role, $lwa_data['role_login']) ) ? $lwa_data['role_login'][$role]:''
273
- ?>
274
- <tr>
275
- <th class="col"><?php echo translate_user_role($details['name']) ?></th>
276
- <td>
277
- <input type='text' class='wide' name='lwa_role_login_<?php echo esc_attr($role) ?>' value="<?php echo esc_attr($role_login); ?>" />
278
- <?php
279
- lwa_icl_inputs_roles('role_login', $lwa_data, esc_attr($role));
280
- ?>
281
- </td>
282
- </tr>
283
- <?php
284
- }
285
- ?>
286
- </table>
287
- </td>
288
- </tr>
289
- </table>
290
-
291
-
292
- <h3><?php esc_html_e("Logout Redirection Settings", 'login-with-ajax'); ?></h3>
293
- <p><em><?php echo esc_html(sprintf(__("If you'd like to send the user to a specific URL after %s, enter a full URL (e.g. http://wordpress.org/) in the fields below. The following placeholders can be used in all %s redirect links", 'login-with-ajax'), __('logout','login-with-ajax'), __('logout','login-with-ajax'))); ?></em></p>
294
- <ul>
295
- <li><em><?php esc_html_e("Enter %LASTURL% to send the user back to the page they were previously on.", 'login-with-ajax'); ?></em></li>
296
- <?php if( class_exists('SitePress') ): ?>
297
- <li><em><?php self::ph_esc(esc_html__("Use %LANG% and it will be replaced with the current language used in multilingual URLs, for example, English may be <code>en</code>", 'login-with-ajax')); ?></em></li>
298
- <?php endif; ?>
299
- </ul>
300
- <table class="form-table">
301
- <tr valign="top">
302
- <th scope="row">
303
- <label><?php esc_html_e("Global Logout Redirect", 'login-with-ajax'); ?></label>
304
- </th>
305
- <td>
306
- <input type="text" name="lwa_logout_redirect" value='<?php echo (!empty($lwa_data['logout_redirect'])) ? esc_attr($lwa_data['logout_redirect']):''; ?>' class='wide' />
307
- <?php
308
- lwa_icl_inputs('logout_redirect', $lwa_data);
309
- ?>
310
- </td>
311
- </tr>
312
- <tr valign="top">
313
- <th scope="row">
314
- <label><?php esc_html_e("Role-Based Custom Logout Redirects", 'login-with-ajax'); ?></label>
315
- </th>
316
- <td>
317
- <em><?php esc_html_e("If you would like a specific user role to be redirected to a custom URL upon logout, place it here (blank value will default to the global redirect)", 'login-with-ajax'); ?></em>
318
- <table>
319
- <?php
320
- //Taken from /wp-admin/includes/template.php Line 2715
321
- $editable_roles = get_editable_roles();
322
- foreach( $editable_roles as $role => $details ) {
323
- $role_logout = ( !empty($lwa_data['role_logout']) && is_array($lwa_data['role_logout']) && array_key_exists($role, $lwa_data['role_logout']) ) ? $lwa_data['role_logout'][$role]:''
324
- ?>
325
- <tr>
326
- <th class='col'><?php echo translate_user_role($details['name']) ?></th>
327
- <td>
328
- <input type='text' class='wide' name='lwa_role_logout_<?php echo esc_attr($role) ?>' value="<?php echo esc_attr($role_logout); ?>" />
329
- <?php lwa_icl_inputs_roles('role_logout', $lwa_data, $role); ?>
330
- </td>
331
- </tr>
332
- <?php
333
- }
334
- ?>
335
- </table>
336
- </td>
337
- </tr>
338
- </table>
339
-
340
- <h3><?php esc_html_e("Notification Settings", 'login-with-ajax'); ?></h3>
341
- <p>
342
- <em><?php esc_html_e("If you'd like to override the default Wordpress email users receive once registered, make sure you check the box below and enter a new email subject and message.", 'login-with-ajax'); ?></em><br />
343
- <em><?php esc_html_e("If this feature doesn't work, please make sure that you don't have another plugin installed which also manages user registrations (e.g. BuddyPress and MU).", 'login-with-ajax'); ?></em>
344
- </p>
345
- <table class="form-table">
346
- <tr valign="top">
347
- <th>
348
- <label><?php esc_html_e("Override Default Email?", 'login-with-ajax'); ?></label>
349
- </th>
350
- <td>
351
- <input style="margin:0px; padding:0px; width:auto;" type="checkbox" name="lwa_notification_override" value='1' class='wide' <?php echo ( !empty($lwa_data['notification_override']) && $lwa_data['notification_override'] == '1' ) ? 'checked="checked"':''; ?> />
352
- </td>
353
- </tr>
354
- <tr valign="top">
355
- <th>
356
- <label><?php esc_html_e("Subject", 'login-with-ajax'); ?></label>
357
- </th>
358
- <td>
359
- <?php
360
- if(empty($lwa_data['notification_subject'])){
361
- $lwa_data['notification_subject'] = esc_html__('Your registration at %BLOGNAME%', 'login-with-ajax');
362
- }
363
- ?>
364
- <input type="text" name="lwa_notification_subject" value='<?php echo (!empty($lwa_data['notification_subject'])) ? esc_attr($lwa_data['notification_subject']) : ''; ?>' class='wide' />
365
- <em><?php self::ph_esc(esc_html__("<code>%USERNAME%</code> will be replaced with a username.", 'login-with-ajax')); ?></em><br />
366
- <?php if( version_compare($wp_version, '4.3', '>=') ): ?>
367
- <em><strong><?php echo sprintf(esc_html__("%s will be replaced with a link to set the user password.", 'login-with-ajax'), '<code>%PASSWORD%</code>'); ?></strong></em><br />
368
- <?php else: ?>
369
- <em><?php self::ph_esc(esc_html__("<code>%PASSWORD%</code> will be replaced with the user's password.", 'login-with-ajax')); ?></em><br />
370
- <?php endif; ?>
371
- <em><?php self::ph_esc(esc_html__("<code>%BLOGNAME%</code> will be replaced with the name of your blog.", 'login-with-ajax')); ?></em>
372
- <em><?php self::ph_esc(esc_html__("<code>%BLOGURL%</code> will be replaced with the url of your blog.", 'login-with-ajax')); ?></em>
373
- </td>
374
- </tr>
375
- <tr valign="top">
376
- <th>
377
- <label><?php _e("Message", 'login-with-ajax'); ?></label>
378
- </th>
379
- <td>
380
- <?php
381
- if( empty($lwa_data['notification_message']) ){
382
- if( version_compare($wp_version, '4.3', '>=') ){
383
- $lwa_data['notification_message'] = esc_html__('Thanks for signing up to our blog.
384
-
385
- You can login with the following credentials by visiting %BLOGURL%
386
-
387
- Username: %USERNAME%
388
- To set your password, visit the following address: %PASSWORD%
389
-
390
- We look forward to your next visit!
391
-
392
- The team at %BLOGNAME%', 'login-with-ajax');
393
- }else{
394
- $lwa_data['notification_message'] = esc_html__('Thanks for signing up to our blog.
395
-
396
- You can login with the following credentials by visiting %BLOGURL%
397
-
398
- Username : %USERNAME%
399
- Password : %PASSWORD%
400
-
401
- We look forward to your next visit!
402
-
403
- The team at %BLOGNAME%', 'login-with-ajax');
404
- }
405
- }
406
- ?>
407
- <textarea name="lwa_notification_message" class='wide' style="width:100%; height:250px;"><?php echo esc_html($lwa_data['notification_message']); ?></textarea>
408
- <em><?php self::ph_esc(esc_html__("<code>%USERNAME%</code> will be replaced with a username.", 'login-with-ajax')); ?></em><br />
409
- <?php if( version_compare($wp_version, '4.3', '>=') ): ?>
410
- <em><strong><?php echo sprintf(esc_html__("%s will be replaced with a link to set the user password.", 'login-with-ajax'), '<code>%PASSWORD%</code>'); ?></strong></em><br />
411
- <?php else: ?>
412
- <em><?php self::ph_esc(esc_html__("<code>%PASSWORD%</code> will be replaced with the user's password.", 'login-with-ajax')); ?></em><br />
413
- <?php endif; ?>
414
- <em><?php self::ph_esc(esc_html__("<code>%BLOGNAME%</code> will be replaced with the name of your blog.", 'login-with-ajax')); ?></em>
415
- <em><?php self::ph_esc(esc_html__("<code>%BLOGURL%</code> will be replaced with the url of your blog.", 'login-with-ajax')); ?></em>
416
- </td>
417
- </tr>
418
- </table>
419
- <div>
420
- <input type="hidden" name="lwasubmitted" value="1" />
421
- <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('login-with-ajax-admin'.get_current_user_id()); ?>" />
422
- <p class="submit">
423
- <input type="submit" class="button-primary" value="<?php esc_html_e('Save Changes') ?>" />
424
- </p>
425
- </div>
426
- </form>
427
- </div>
428
- </div>
429
- </div>
430
- </div>
431
- <?php
432
- }
433
-
434
- /**
435
- * Quick function to avoid having to change translatable strings that use <code> yet we need to run it through esc_html
436
- * @param string $string
437
- */
438
- public static function ph_esc( $string ){
439
- echo str_replace(array('&lt;code&gt;','&lt;/code&gt;'), array('<code>','</code>'), $string);
440
- }
441
- }
442
-
443
- function LoginWithAjaxAdminInit(){
444
- global $LoginWithAjaxAdmin;
445
- $LoginWithAjaxAdmin = new LoginWithAjaxAdmin();
446
- }
447
-
448
- // Start this plugin once all other plugins are fully loaded
449
- add_action( 'init', 'LoginWithAjaxAdminInit' );
450
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/login-with-ajax-widget.php DELETED
@@ -1,98 +0,0 @@
1
- <?php
2
- class LoginWithAjaxWidget extends WP_Widget {
3
- public $defaults;
4
-
5
- /** constructor */
6
- function __construct() {
7
- $this->defaults = array(
8
- 'title' => __('Log In','login-with-ajax'),
9
- 'title_loggedin' => __( 'Hi', 'login-with-ajax' ).' %username%',
10
- 'template' => 'default',
11
- 'profile_link' => 1,
12
- 'registration' => 1,
13
- 'remember' => 1
14
- );
15
- $widget_ops = array('description' => __( "Login widget with AJAX capabilities.", 'login-with-ajax') );
16
- parent::__construct(false, $name = 'Login With Ajax', $widget_ops);
17
- }
18
-
19
- /** @see WP_Widget::widget */
20
- function widget($args, $instance) {
21
- $instance = array_merge($this->defaults, $instance);
22
- echo $args['before_widget'];
23
- if( !is_user_logged_in() && !empty($instance['title']) ){
24
- echo $args['before_title'];
25
- echo '<span class="lwa-title">';
26
- echo apply_filters('widget_title',$instance['title'], $instance, $this->id_base);
27
- echo '</span>';
28
- echo $args['after_title'];
29
- }elseif( is_user_logged_in() && !empty($instance['title_loggedin']) ) {
30
- echo $args['before_title'];
31
- echo '<span class="lwa-title">';
32
- echo str_replace('%username%', LoginWithAjax::$current_user->display_name, $instance['title_loggedin']);
33
- echo '</span>';
34
- echo $args['after_title'];
35
- }
36
- LoginWithAjax::widget($instance);
37
- echo $args['after_widget'];
38
- }
39
-
40
- /** @see WP_Widget::update */
41
- function update($new_instance, $old_instance) {
42
- foreach($this->defaults as $key => $value){
43
- if( !isset($new_instance[$key]) ){
44
- $new_instance[$key] = false;
45
- }
46
- }
47
- return $new_instance;
48
- }
49
-
50
- /** @see WP_Widget::form */
51
- function form($instance) {
52
- $instance = array_merge($this->defaults, $instance);
53
- ?>
54
- <?php if( count(LoginWithAjax::$templates) > 1 ): ?>
55
- <p>
56
- <label for="<?php echo $this->get_field_id('template'); ?>"><?php esc_html_e('Template', 'login-with-ajax'); ?>:</label>
57
- <select class="widefat" id="<?php echo $this->get_field_id('template'); ?>" name="<?php echo $this->get_field_name('template'); ?>" >
58
- <?php foreach( array_keys(LoginWithAjax::$templates) as $template ): ?>
59
- <option <?php echo ($instance['template'] == $template) ? 'selected="selected"':""; ?>><?php echo esc_html($template); ?></option>
60
- <?php endforeach; ?>
61
- </select>
62
- </p>
63
- <?php endif; ?>
64
- <p><strong><?php esc_html_e('Logged Out','login-with-ajax'); ?></strong></p>
65
- <p>
66
- <label for="<?php echo $this->get_field_id('title'); ?>"><?php echo sprintf(esc_html__('Title (%s)', 'login-with-ajax'),esc_html__('Logged In','login-with-ajax')); ?>: </label>
67
- <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" />
68
- </p>
69
- <p>
70
- <label for="<?php echo $this->get_field_id('remember'); ?>"><?php esc_html_e('Show Recover Password?', 'login-with-ajax'); ?> </label>
71
- <select class="widefat" id="<?php echo $this->get_field_id('remember'); ?>" name="<?php echo $this->get_field_name('remember'); ?>" >
72
- <option value="0" <?php echo ($instance['remember'] == 0) ? 'selected="selected"':""; ?>><?php esc_html_e('No Link','login-with-ajax'); ?></option>
73
- <option value="1" <?php echo ($instance['remember'] == 1) ? 'selected="selected"':""; ?>><?php esc_html_e('Show link with AJAX form','login-with-ajax'); ?></option>
74
- <option value="2" <?php echo ($instance['remember'] == 2) ? 'selected="selected"':""; ?>><?php esc_html_e('Show direct link','login-with-ajax'); ?></option>
75
- </select>
76
- </p>
77
- <p>
78
- <label for="<?php echo $this->get_field_id('registration'); ?>"><?php esc_html_e('AJAX Registration?', 'login-with-ajax'); ?> </label>
79
- <select class="widefat" id="<?php echo $this->get_field_id('registration'); ?>" name="<?php echo $this->get_field_name('registration'); ?>" >
80
- <option value="0" <?php echo ($instance['registration'] == 0) ? 'selected="selected"':""; ?>><?php esc_html_e('No Link','login-with-ajax'); ?></option>
81
- <option value="1" <?php echo ($instance['registration'] == 1) ? 'selected="selected"':""; ?>><?php esc_html_e('Show link with AJAX form','login-with-ajax'); ?></option>
82
- <option value="2" <?php echo ($instance['registration'] == 2) ? 'selected="selected"':""; ?>><?php esc_html_e('Show direct link','login-with-ajax'); ?></option>
83
- </select>
84
- </p>
85
- <p><strong><?php esc_html_e('Logged In','login-with-ajax'); ?></strong></p>
86
- <p>
87
- <label for="<?php echo $this->get_field_id('title_loggedin'); ?>"><?php echo sprintf(esc_html__('Title (%s)', 'login-with-ajax'),esc_html__('Logged Out','login-with-ajax')); ?>: </label>
88
- <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title_loggedin'); ?>" value="<?php echo esc_attr($instance['title_loggedin']); ?>" />
89
- </p>
90
- <p>
91
- <input id="<?php echo $this->get_field_id('profile_link'); ?>" name="<?php echo $this->get_field_name('profile_link'); ?>" type="checkbox" value="1" <?php echo !empty($instance['profile_link']) ? 'checked="checked"':""; ?> />
92
- <label for="<?php echo $this->get_field_id('profile_link'); ?>"><?php esc_html_e('Show profile link?', 'login-with-ajax'); ?> </label>
93
- </p>
94
- <?php
95
- }
96
-
97
- }
98
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/login-with-ajax.php DELETED
@@ -1,533 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: Login With Ajax
4
- Plugin URI: http://wordpress.org/extend/plugins/login-with-ajax/
5
- Description: Ajax driven login widget. Customisable from within your template folder, and advanced settings from the admin area.
6
- Author: Marcus Sykes
7
- Version: 3.1.9
8
- Author URI: http://msyk.es/?utm_source=login-with-ajax&utm_medium=plugin-header&utm_campaign=plugins
9
- Tags: Login, Ajax, Redirect, BuddyPress, MU, WPMU, sidebar, admin, widget
10
- Text Domain: login-with-ajax
11
-
12
- Copyright (C) 2020 Pixelite SL
13
-
14
- This program is free software; you can redistribute it and/or modify
15
- it under the terms of the GNU General Public License as published by
16
- the Free Software Foundation; either version 3 of the License, or
17
- (at your option) any later version.
18
-
19
- This program is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- GNU General Public License for more details.
23
-
24
- You should have received a copy of the GNU General Public License
25
- along with this program. If not, see <http://www.gnu.org/licenses/>.
26
- */
27
- define('LOGIN_WITH_AJAX_VERSION', '3.1.9');
28
- class LoginWithAjax {
29
-
30
- /**
31
- * If logged in upon instantiation, it is a user object.
32
- * @var WP_User
33
- */
34
- public static $current_user;
35
- /**
36
- * List of templates available in the plugin dir and theme (populated in init())
37
- * @var array
38
- */
39
- public static $templates = array();
40
- /**
41
- * Name of selected template (if selected)
42
- * @var string
43
- */
44
- public static $template;
45
- /**
46
- * lwa_data option
47
- * @var array
48
- */
49
- public static $data;
50
- /**
51
- * Location of footer file if one is found when generating a widget, for use in loading template footers.
52
- * @var string
53
- */
54
- public static $footer_loc;
55
- /**
56
- * URL for the AJAX Login procedure in templates (including callback and template parameters)
57
- * @var string
58
- */
59
- public static $url_login;
60
- /**
61
- * URL for the AJAX Remember Password procedure in templates (including callback and template parameters)
62
- * @var string
63
- */
64
- public static $url_remember;
65
- /**
66
- * URL for the AJAX Registration procedure in templates (including callback and template parameters)
67
- * @var string
68
- */
69
- public static $url_register;
70
-
71
- // Actions to take upon initial action hook
72
- public static function init(){
73
- //Load LWA options
74
- self::$data = get_option('lwa_data');
75
- //Remember the current user, in case there is a logout
76
- self::$current_user = wp_get_current_user();
77
-
78
- //Get Templates from theme and default by checking for folders - we assume a template works if a folder exists!
79
- //Note that duplicate template names are overwritten in this order of precedence (highest to lowest) - Child Theme > Parent Theme > Plugin Defaults
80
- //First are the defaults in the plugin directory
81
- self::find_templates( path_join( WP_PLUGIN_DIR , basename( dirname( __FILE__ ) ). "/widget/") );
82
- //Now, the parent theme (if exists)
83
- if( get_stylesheet_directory() != get_template_directory() ){
84
- self::find_templates( get_template_directory().'/plugins/login-with-ajax/' );
85
- }
86
- //Finally, the child theme
87
- self::find_templates( get_stylesheet_directory().'/plugins/login-with-ajax/' );
88
-
89
- //Generate URLs for login, remember, and register
90
- self::$url_login = self::template_link(wp_login_url());
91
- self::$url_register = self::template_link(self::getRegisterLink());
92
- self::$url_remember = self::template_link(add_query_arg('action', 'lostpassword', wp_login_url()));
93
-
94
- //Make decision on what to display
95
- if ( !empty($_REQUEST["lwa"]) ) { //AJAX Request
96
- self::ajax();
97
- }elseif ( isset($_REQUEST["login-with-ajax-widget"]) ) { //Widget Request via AJAX
98
- $instance = ( !empty($_REQUEST["template"]) ) ? array('template' => $_REQUEST["template"]) : array();
99
- $instance['profile_link'] = ( !empty($_REQUEST["lwa_profile_link"]) ) ? $_REQUEST['lwa_profile_link']:0;
100
- self::widget( $instance );
101
- exit();
102
- }else{
103
- //Enqueue scripts - Only one script enqueued here.... theme JS takes priority, then default JS
104
- if( !is_admin() ) {
105
- $js_url = defined('WP_DEBUG') && WP_DEBUG ? 'login-with-ajax.source.js':'login-with-ajax.js';
106
- wp_enqueue_script( "login-with-ajax", self::locate_template_url($js_url), array( 'jquery' ), LOGIN_WITH_AJAX_VERSION );
107
- wp_enqueue_style( "login-with-ajax", self::locate_template_url('widget.css'), array(), LOGIN_WITH_AJAX_VERSION );
108
- $schema = is_ssl() ? 'https':'http';
109
- $js_vars = array('ajaxurl' => admin_url('admin-ajax.php', $schema));
110
- //calendar translations
111
- wp_localize_script('login-with-ajax', 'LWA', apply_filters('lwa_js_vars', $js_vars));
112
- }
113
-
114
- //Add logout/in redirection
115
- add_action('wp_logout', 'LoginWithAjax::logoutRedirect');
116
- add_filter('logout_url', 'LoginWithAjax::logoutUrl');
117
- add_filter('login_redirect', 'LoginWithAjax::loginRedirect', 1, 3);
118
- add_shortcode('login-with-ajax', 'LoginWithAjax::shortcode');
119
- add_shortcode('lwa', 'LoginWithAjax::shortcode');
120
- }
121
- }
122
-
123
- public static function widgets_init(){
124
- //Include and register widget
125
- include_once('login-with-ajax-widget.php');
126
- register_widget("LoginWithAjaxWidget");
127
- }
128
-
129
- /*
130
- * LOGIN OPERATIONS
131
- */
132
-
133
- // Decides what action to take from the ajax request
134
- public static function ajax(){
135
- $return = array('result'=>false, 'error'=>'Unknown command requested');
136
- switch ( $_REQUEST["login-with-ajax"] ) {
137
- case 'login': //A login has been requested
138
- //remove known interferences
139
- add_filter('ws_plugin__s2member_login_redirect', '__return_false');
140
- $return = self::login();
141
- break;
142
- case 'remember': //Remember the password
143
- $return = self::remember();
144
- break;
145
- case 'register': //Remember the password
146
- default: // backwards-compatible with templates where lwa = registration
147
- $return = self::register();
148
- break;
149
- }
150
- @header( 'Content-Type: application/javascript; charset=UTF-8', true ); //add this for HTTP -> HTTPS requests which assume it's a cross-site request
151
- echo self::json_encode(apply_filters('lwa_ajax_'.$_REQUEST["login-with-ajax"], $return));
152
- exit();
153
- }
154
-
155
- // Reads ajax login creds via POSt, calls the login script and interprets the result
156
- public static function login(){
157
- $return = array(); //What we send back
158
- if( !empty($_REQUEST['log']) && !empty($_REQUEST['pwd']) && trim($_REQUEST['log']) != '' && trim($_REQUEST['pwd'] != '') ){
159
- $loginResult = wp_signon();
160
- if ( strtolower(get_class($loginResult)) == 'wp_user' ) {
161
- //User login successful
162
- self::$current_user = $loginResult;
163
- /* @var $loginResult WP_User */
164
- $return['result'] = true;
165
- $return['message'] = __("Login Successful, redirecting...",'login-with-ajax');
166
- //Do a redirect if necessary
167
- $redirect = self::getLoginRedirect(self::$current_user);
168
- if( !empty($_REQUEST['redirect_to']) ) $redirect= wp_sanitize_redirect($_REQUEST['redirect_to']);
169
- if( $redirect != '' ){
170
- $return['redirect'] = $redirect;
171
- }
172
- //If the widget should just update with ajax, then supply the URL here.
173
- if( !empty(self::$data['no_login_refresh']) && self::$data['no_login_refresh'] == 1 ){
174
- //Is this coming from a template?
175
- $query_vars = ( !empty($_REQUEST['template']) ) ? "&template=".esc_attr($_REQUEST['template']) : '';
176
- $query_vars .= ( !empty($_REQUEST['lwa_profile_link']) ) ? "&lwa_profile_link=1" : '';
177
- $return['widget'] = get_bloginfo('wpurl')."?login-with-ajax-widget=1$query_vars";
178
- $return['message'] = __("Login successful, updating...",'login-with-ajax');
179
- }
180
- } elseif ( strtolower(get_class($loginResult)) == 'wp_error' ) {
181
- //User login failed
182
- /* @var WP_Error $loginResult */
183
- $return['result'] = false;
184
- $return['error'] = $loginResult->get_error_message();
185
- } else {
186
- //Undefined Error
187
- $return['result'] = false;
188
- $return['error'] = __('An undefined error has ocurred', 'login-with-ajax');
189
- }
190
- }else{
191
- $return['result'] = false;
192
- $return['error'] = __('Please supply your username and password.', 'login-with-ajax');
193
- }
194
- $return['action'] = 'login';
195
- //Return the result array with errors etc.
196
- return $return;
197
- }
198
-
199
- /**
200
- * Checks post data and registers user, then exits
201
- * @return string
202
- */
203
- public static function register(){
204
- $return = array();
205
- if( get_option('users_can_register') ){
206
- $errors = register_new_user($_REQUEST['user_login'], $_REQUEST['user_email']);
207
- if ( !is_wp_error($errors) ) {
208
- //Success
209
- $return['result'] = true;
210
- $return['message'] = __('Registration complete. Please check your e-mail.','login-with-ajax');
211
- //add user to blog if multisite
212
- if( is_multisite() ){
213
- add_user_to_blog(get_current_blog_id(), $errors, get_option('default_role'));
214
- }
215
- }else{
216
- //Something's wrong
217
- $return['result'] = false;
218
- $return['error'] = $errors->get_error_message();
219
- }
220
- $return['action'] = 'register';
221
- }else{
222
- $return['result'] = false;
223
- $return['error'] = __('Registration has been disabled.','login-with-ajax');
224
- }
225
- return $return;
226
- }
227
-
228
- // Reads ajax login creds via POST, calls the login script and interprets the result
229
- public static function remember(){
230
- $return = array(); //What we send back
231
- //if we're not on wp-login.php, we need to load it since retrieve_password() is located there
232
- if( !function_exists('retrieve_password') ){
233
- ob_start();
234
- include_once(ABSPATH.'wp-login.php');
235
- ob_clean();
236
- }
237
- $result = retrieve_password();
238
- if ( $result === true ) {
239
- //Password correctly remembered
240
- $return['result'] = true;
241
- $return['message'] = __("We have sent you an email", 'login-with-ajax');
242
- } elseif ( strtolower(get_class($result)) == 'wp_error' ) {
243
- //Something went wrong
244
- /* @var $result WP_Error */
245
- $return['result'] = false;
246
- $return['error'] = $result->get_error_message();
247
- } else {
248
- //Undefined Error
249
- $return['result'] = false;
250
- $return['error'] = __('An undefined error has ocurred', 'login-with-ajax');
251
- }
252
- $return['action'] = 'remember';
253
- //Return the result array with errors etc.
254
- return $return;
255
- }
256
-
257
- //Added fix for WPML
258
- public static function logoutUrl( $logout_url ){
259
- //Add ICL if necessary
260
- if( defined('ICL_LANGUAGE_CODE') ){
261
- $logout_url .= ( strstr($logout_url,'?') !== false ) ? '&amp;':'?';
262
- $logout_url .= 'lang='.ICL_LANGUAGE_CODE;
263
- }
264
- return $logout_url;
265
- }
266
-
267
- public static function getRegisterLink(){
268
- $register_link = false;
269
- if ( function_exists('bp_get_signup_page') && (empty($_REQUEST['action']) || ($_REQUEST['action'] != 'deactivate' && $_REQUEST['action'] != 'deactivate-selected')) ) { //Buddypress
270
- $register_link = bp_get_signup_page();
271
- }elseif ( is_multisite() ) { //MS
272
- $register_link = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
273
- } else {
274
- $register_link = wp_registration_url();
275
- }
276
- return $register_link;
277
- }
278
-
279
- /*
280
- * Redirect Functions
281
- */
282
-
283
- public static function logoutRedirect(){
284
- $redirect = self::getLogoutRedirect();
285
- if($redirect != ''){
286
- wp_safe_redirect($redirect);
287
- exit();
288
- }
289
- }
290
-
291
- public static function getLogoutRedirect(){
292
- $data = self::$data;
293
- //Global redirect
294
- $redirect = '';
295
- if( !empty($data['logout_redirect']) ){
296
- $redirect = $data['logout_redirect'];
297
- }
298
- //WPML global redirect
299
- $lang = !empty($_REQUEST['lang']) ? sanitize_text_field($_REQUEST['lang']):'';
300
- $lang = apply_filters('lwa_lang', $lang);
301
- if( !empty($lang) ){
302
- if( isset($data["logout_redirect_".$lang]) ){
303
- $redirect = $data["logout_redirect_".$lang];
304
- }
305
- }
306
- //Role based redirect
307
- if( strtolower(get_class(self::$current_user)) == "wp_user" ){
308
- //Do a redirect if necessary
309
- $data = self::$data;
310
- $user_role = array_shift(self::$current_user->roles); //Checking for role-based redirects
311
- if( !empty($data["role_logout"]) && is_array($data["role_logout"]) && isset($data["role_logout"][$user_role]) ){
312
- $redirect = $data["role_logout"][$user_role];
313
- }
314
- //Check for language redirects based on roles
315
- if( !empty($lang) ){
316
- if( isset($data["role_logout"][$user_role."_".$lang]) ){
317
- $redirect = $data["role_logout"][$user_role."_".$lang];
318
- }
319
- }
320
- }
321
- //final replaces
322
- if( !empty($redirect) ){
323
- $redirect = str_replace("%LASTURL%", $_SERVER['HTTP_REFERER'], $redirect);
324
- if( !empty($lang) ){
325
- $redirect = str_replace("%LANG%", $lang.'/', $redirect);
326
- }
327
- }
328
- return esc_url_raw($redirect);
329
- }
330
-
331
- public static function loginRedirect( $redirect, $redirect_notsurewhatthisis, $user ){
332
- $data = self::$data;
333
- if( is_object($user) ){
334
- $lwa_redirect = self::getLoginRedirect($user);
335
- if( $lwa_redirect != '' ){
336
- $redirect = $lwa_redirect;
337
- }
338
- }
339
- return $redirect;
340
- }
341
-
342
- public static function getLoginRedirect($user){
343
- $data = self::$data;
344
- //Global redirect
345
- $redirect = false;
346
- if( !empty($data['login_redirect']) ){
347
- $redirect = $data["login_redirect"];
348
- }
349
- //WPML global redirect
350
- $lang = !empty($_REQUEST['lang']) ? sanitize_text_field($_REQUEST['lang']):'';
351
- $lang = apply_filters('lwa_lang', $lang);
352
- if( !empty($lang) && isset($data["login_redirect_".$lang]) ){
353
- $redirect = $data["login_redirect_".$lang];
354
- }
355
- //Role based redirects
356
- if( strtolower(get_class($user)) == "wp_user" ){
357
- $user_role = array_shift($user->roles); //Checking for role-based redirects
358
- if( isset($data["role_login"][$user_role]) ){
359
- $redirect = $data["role_login"][$user_role];
360
- }
361
- //Check for language redirects based on roles
362
- if( !empty($lang) && isset($data["role_login"][$user_role."_".$lang]) ){
363
- $redirect = $data["role_login"][$user_role."_".$lang];
364
- }
365
- //Do user string replacements
366
- $redirect = str_replace('%USERNAME%', $user->user_login, $redirect);
367
- $redirect = str_replace('%USERNICENAME%', $user->user_nicename, $redirect);
368
- }
369
- //Do string replacements
370
- $redirect = str_replace("%LASTURL%", wp_get_referer(), $redirect);
371
- if( !empty($lang) ){
372
- $redirect = str_replace("%LANG%", $lang.'/', $redirect);
373
- }
374
- return esc_url_raw($redirect);
375
- }
376
-
377
- /*
378
- * WIDGET OPERATIONS
379
- */
380
-
381
- public static function widget($instance = array() ){
382
- //Extract widget arguments
383
- //Merge instance options with global default options
384
- $lwa_data = wp_parse_args($instance, self::$data);
385
- //Deal with specific variables
386
- $is_widget = false; //backwards-comatibility for overriden themes, this is now done within the WP_Widget class
387
- $lwa_data['profile_link'] = ( !empty($lwa_data['profile_link']) && $lwa_data['profile_link'] != "false" );
388
- //Add template logic
389
- self::$template = ( !empty($lwa_data['template']) && array_key_exists($lwa_data['template'], self::$templates) ) ? $lwa_data['template']:'default';
390
- //Choose the widget content to display.
391
- if(is_user_logged_in()){
392
- //Firstly check for template in theme with no template folder (legacy)
393
- $template_loc = locate_template( array('plugins/login-with-ajax/widget_in.php') );
394
- //Then check for custom templates or theme template default
395
- $template_loc = ($template_loc == '' && self::$template) ? self::$templates[self::$template].'/widget_in.php':$template_loc;
396
- include ( $template_loc != '' && file_exists($template_loc) ) ? $template_loc : 'widget/default/widget_in.php';
397
- }else{
398
- //quick/easy WPML fix, should eventually go into a seperate file
399
- if( defined('ICL_LANGUAGE_CODE') ){
400
- if( !function_exists('lwa_wpml_input_var') ){
401
- function lwa_wpml_input_var(){ echo '<input type="hidden" name="lang" id="lang" value="'.esc_attr(ICL_LANGUAGE_CODE).'" />'; }
402
- }
403
- foreach( array('login_form','lwa_register_form', 'lostpassword_form') as $action ) add_action($action, 'lwa_wpml_input_var');
404
- }
405
- //Firstly check for template in theme with no template folder (legacy)
406
- $template_loc = locate_template( array('plugins/login-with-ajax/widget_out.php') );
407
- //First check for custom templates or theme template default
408
- $template_loc = ($template_loc == '' && self::$template) ? self::$templates[self::$template].'/widget_out.php' : $template_loc;
409
- include ( $template_loc != '' && file_exists($template_loc) ) ? $template_loc : 'widget/default/widget_out.php';
410
- //quick/easy WPML fix, should eventually go into a seperate file
411
- if( defined('ICL_LANGUAGE_CODE') ){
412
- foreach( array('login_form','lwa_register_form', 'lostpassword_form') as $action ) remove_action($action, 'lwa_wpml_input_var');
413
- }
414
- }
415
- }
416
-
417
- public static function shortcode($atts){
418
- ob_start();
419
- $defaults = array(
420
- 'profile_link' => true,
421
- 'template' => 'default',
422
- 'registration' => true,
423
- 'redirect' => false,
424
- 'remember' => true
425
- );
426
- self::widget(shortcode_atts($defaults, $atts));
427
- return ob_get_clean();
428
- }
429
-
430
- public static function new_user_notification($user_login, $login_link, $user_email, $blogname){
431
- //Copied out of /wp-includes/pluggable.php
432
- $message = self::$data['notification_message'];
433
- $message = str_replace('%USERNAME%', $user_login, $message);
434
- $message = str_replace('%PASSWORD%', $login_link, $message);
435
- $message = str_replace('%BLOGNAME%', $blogname, $message);
436
- $message = str_replace('%BLOGURL%', get_bloginfo('wpurl'), $message);
437
-
438
- $subject = self::$data['notification_subject'];
439
- $subject = str_replace('%BLOGNAME%', $blogname, $subject);
440
- $subject = str_replace('%BLOGURL%', get_bloginfo('wpurl'), $subject);
441
-
442
- wp_mail($user_email, $subject, $message);
443
- }
444
-
445
- /*
446
- * Auxillary Functions
447
- */
448
-
449
- /**
450
- * Returns the URL for a relative filepath which would be located in either a child, parent or plugin folder in order of priority.
451
- *
452
- * This would search for $template_path within:
453
- * /wp-content/themes/your-child-theme/plugins/login-with-ajax/...
454
- * /wp-content/themes/your-parent-theme/plugins/login-with-ajax/...
455
- * /wp-content/plugins/login-with-ajax/widget/...
456
- *
457
- * It is assumed that the file always exists within the core plugin folder if the others aren't found.
458
- *
459
- * @param string $template_path
460
- * @return string
461
- */
462
- public static function locate_template_url($template_path){
463
- if( file_exists(get_stylesheet_directory().'/plugins/login-with-ajax/'.$template_path) ){ //Child Theme (or just theme)
464
- return trailingslashit(get_stylesheet_directory_uri())."plugins/login-with-ajax/$template_path";
465
- }else if( file_exists(get_template_directory().'/plugins/login-with-ajax/'.$template_path) ){ //Parent Theme (if parent exists)
466
- return trailingslashit(get_template_directory_uri())."plugins/login-with-ajax/$template_path";
467
- }
468
- //Default file in plugin folder
469
- return trailingslashit(plugin_dir_url(__FILE__))."widget/$template_path";
470
- }
471
-
472
- //Checks a directory for folders and populates the template file
473
- public static function find_templates($dir){
474
- if (is_dir($dir)) {
475
- if ($dh = opendir($dir)) {
476
- while (($file = readdir($dh)) !== false) {
477
- if(is_dir($dir . $file) && $file != '.' && $file != '..' && $file != '.svn'){
478
- //Template dir found, add it to the template array
479
- self::$templates[$file] = path_join($dir, $file);
480
- }
481
- }
482
- closedir($dh);
483
- }
484
- }
485
- }
486
-
487
- /**
488
- * Add template link and JSON callback var to the URL
489
- * @param string $content
490
- * @return string
491
- */
492
- public static function template_link( $content ){
493
- return add_query_arg(array('template'=>self::$template), $content);
494
- }
495
-
496
- /**
497
- * Returns a sanitized JSONP response from an array
498
- * @param array $array
499
- * @return string
500
- */
501
- public static function json_encode($array){
502
- $return = json_encode($array);
503
- if( isset($_REQUEST['callback']) && preg_match("/^jQuery[_a-zA-Z0-9]+$/", $_REQUEST['callback']) ){
504
- $return = $_REQUEST['callback']."($return)";
505
- }
506
- return $return;
507
- }
508
- }
509
- //Set when to init this class
510
- add_action( 'init', 'LoginWithAjax::init' );
511
- add_action( 'widgets_init', 'LoginWithAjax::widgets_init' );
512
-
513
- //Installation and Updates
514
- $lwa_data = get_option('lwa_data');
515
- if( version_compare( get_option('lwa_version',0), LOGIN_WITH_AJAX_VERSION, '<' ) ){
516
- include_once('lwa-install.php');
517
- }
518
-
519
- //Include admin file if needed
520
- if(is_admin()){
521
- include_once('login-with-ajax-admin.php');
522
- }
523
-
524
- //Include pluggable functions file if user specifies in settings
525
- if( !empty($lwa_data['notification_override']) ){
526
- include_once('pluggable.php');
527
- }
528
-
529
- //Template Tag
530
- function login_with_ajax($atts = ''){
531
- if( !array($atts) ) $atts = shortcode_parse_atts($atts);
532
- echo LoginWithAjax::shortcode($atts);
533
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/lwa-install.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
- global $wp_version;
3
- $lwa_data = get_option('lwa_data');
4
- if( !is_array($lwa_data) ) $lwa_data = array();
5
- //no DB changes necessary
6
- //add notices
7
- if( version_compare($wp_version, '4.3', '>=') && get_option('lwa_notice') ){
8
- //upgrading from old version, first time we have lwa_version too, so must check for lwa_notice presence
9
- if( empty($lwa_data['notices']) ) $lwa_data['notices'] = array();
10
- $lwa_data['notices']['password_link'] = 1;
11
- update_option('lwa_data', $lwa_data);
12
- delete_option('lwa_notice');
13
- delete_option('lwa_notification_override');
14
- }
15
- update_option('lwa_version', LOGIN_WITH_AJAX_VERSION);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/pluggable.php DELETED
@@ -1,77 +0,0 @@
1
- <?php
2
- //Replaces the user registration welcome email, this is an exact copy of the wp_new_user_notification function with one if statement added us to circumvent the default email.
3
- //see comments starting //LWA for changes
4
- if ( !function_exists('wp_new_user_notification') ) :
5
- /**
6
- * Email login credentials to a newly-registered user.
7
- *
8
- * A new user registration notification is also sent to admin email.
9
- *
10
- * @since 2.0.0
11
- * @since 4.3.0 The `$plaintext_pass` parameter was changed to `$notify`.
12
- * @since 4.3.1 The `$plaintext_pass` parameter was deprecated. `$notify` added as a third parameter.
13
- *
14
- * @global wpdb $wpdb WordPress database object for queries.
15
- * @global PasswordHash $wp_hasher Portable PHP password hashing framework instance.
16
- *
17
- * @param int $user_id User ID.
18
- * @param null $deprecated Not used (argument deprecated).
19
- * @param string $notify Optional. Type of notification that should happen. Accepts 'admin' or an empty
20
- * string (admin only), or 'both' (admin and user). The empty string value was kept
21
- * for backward-compatibility purposes with the renamed parameter. Default empty.
22
- */
23
- function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
24
- if ( $deprecated !== null ) {
25
- //_deprecated_argument( __FUNCTION__, '4.3.1' ); //LWA - <4.3 backwards compat, not executing this deprecated function
26
- }
27
-
28
- global $wpdb, $wp_hasher;
29
- $user = get_userdata( $user_id );
30
-
31
- // The blogname option is escaped with esc_html on the way into the database in sanitize_option
32
- // we want to reverse this for the plain text arena of emails.
33
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
34
-
35
- $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
36
- $message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
37
- $message .= sprintf(__('E-mail: %s'), $user->user_email) . "\r\n";
38
-
39
- @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
40
-
41
- if ( 'admin' === $notify || (empty( $notify ) && empty($deprecated)) ) { //LWA - let this pass if there's a password to notify user with, <4.3 backwards compat
42
- return;
43
- }
44
-
45
- // Generate something random for a password reset key.
46
- $key = wp_generate_password( 20, false );
47
-
48
- /** This action is documented in wp-login.php */
49
- do_action( 'retrieve_password_key', $user->user_login, $key );
50
-
51
- // Now insert the key, hashed, into the DB.
52
- if ( empty( $wp_hasher ) ) {
53
- require_once ABSPATH . WPINC . '/class-phpass.php';
54
- $wp_hasher = new PasswordHash( 8, true );
55
- }
56
- $hashed = time() . ':' . $wp_hasher->HashPassword( $key );
57
- $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
58
-
59
- //LWA Customizations START
60
- //generate password link like it's done further down
61
- $password_link = network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login');
62
- if( !empty($deprecated) ) $password_link = $deprecated; // for <4.3 compatability
63
- LoginWithAjax::new_user_notification($user->user_login, $password_link, $user->user_email, $blogname, $deprecated);
64
- return;
65
- //LWA Customizations END
66
-
67
- $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
68
- $message .= __('To set your password, visit the following address:') . "\r\n\r\n";
69
- $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";
70
-
71
- $message .= wp_login_url() . "\r\n";
72
-
73
- wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
74
- }
75
- endif;
76
-
77
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/readme.txt DELETED
@@ -1,333 +0,0 @@
1
- === Login With Ajax ===
2
- Contributors: netweblogic
3
- Tags: login, ajax, ajax login, registration, redirect redirect, buddypress, multi site, sidebar, admin, widget
4
- Text Domain: login-with-ajax
5
- Requires at least: 4.8
6
- Tested up to: 5.3
7
- Stable tag: 3.1.9
8
- Requires PHP: 5.2
9
- License: GPLv2 or later
10
-
11
- Add smooth ajax login/registration effects and choose where users get redirected upon log in/out. Supports SSL, MultiSite, and BuddyPress.
12
-
13
- == Description ==
14
- [](http://coderisk.com/wp/plugin/login-with-ajax/RIPS-mI-qmnCald)
15
-
16
- Login With Ajax is for sites that need user logins or registrations and would like to avoid the normal wordpress login pages, this plugin adds the capability of placing a login widget in the sidebar with smooth AJAX login effects.
17
-
18
- Some of the features:
19
-
20
- * AJAX-powered, no screen refreshes!
21
- * Login
22
- * Registration
23
- * Remember/Reset Password
24
- * Custom Login/Logout redirections
25
- * Redirect users to custom URLs on Login and Logout
26
- * Redirect users with different roles to custom URLs
27
- * WPML - Language-specific redirects
28
- * SSL-compatible
29
- * Fallback mechanism, will still work on javascript-disabled browsers
30
- * Compatible with Wordpress, MultiSite, BuddyPress and many other plugins that alter the login/registration form (e.g. captcha plugins)
31
- * Customizable, upgrade-safe widgets
32
- * shortcode and template tags available
33
- * Widget specific option to show link to profile page
34
-
35
- If you have any problems with the plugin after reading the FAQ, Other Notes, etc. please visit the [support forums](http://wordpress.org/support/plugin/login-with-ajax).
36
-
37
- = Translated Languages Available =
38
-
39
- To view translated languages avaialble or to contribute translations in your language, visit the [WordPress translation portal](https://translate.wordpress.org/projects/wp-plugins/login-with-ajax/). Any translated languages over 90% will be automatically installed with the plugin, for other languages not fully translated, please see our FAQ.
40
-
41
- == Installation ==
42
-
43
- 1. Upload this plugin to the `/wp-content/plugins/` directory and unzip it, or simply upload the zip file within your wordpress installation.
44
-
45
- 2. Activate the plugin through the 'Plugins' menu in WordPress
46
-
47
- 3. If you want login/logout redirections, go to Settings > Login With Ajax in the admin area and fill out the form.
48
-
49
- 4. Add the login with ajax widget to your sidebar, [lwa] on your pages, or use login_with_ajax() in your template.
50
-
51
- 5. Happy logging in!
52
-
53
- == Upgrade Notice ==
54
-
55
- = Upgrading from v3 to v3.1 =
56
- Due to the improvmenets necessary (specifically allowing multiple LWA widgets on one page), it was important to modify the template files to use classnames instead of ids.
57
-
58
- If you have customized your widgets as per the instructions below, you will need make some modifications to your templates, and probably re-evaluate whether you still need custom JS if you went that far.
59
-
60
- We've tried to minimize potential conflicts arising from this, but you should consider revising your template regarding these two points:
61
-
62
- * LoginWithAjax is now a static class, so things like $this->function() and $this->variable should become LoginWithAjax::function() and LoginWithAjax::$variable
63
- * Element IDs are now classnames, and are converted like so (we do have backwards compatibility to account for this, but still recommended):
64
- * LoginWithAjax becomes lwa
65
- * classname is all lowercase
66
- * underscores become hyphens
67
- * Example : LoginWithAjax_Form > lwa-form
68
-
69
- == Notes ==
70
-
71
- = Shortcodes & Template Tags =
72
-
73
- You can use the [shortcode](http://codex.wordpress.org/Shortcode) [login-with-ajax] or [lwa] and [template tag](http://codex.wordpress.org/Template_Tags) `login_with_ajax()` with these options :
74
-
75
- * profile_link - (1 or 0)
76
- * If value is 1 (default), a profile link to wp-admin appears.
77
- * registration - (1 or 0)
78
- * If value is 1 (default), a registration link appears, providing you have registration enabled in your WP settings.
79
- * template - (template name/directory)
80
- * If this template directory exists, this template will be used. Default is 'default' template.
81
- * remember - (1 or 0)
82
- * If value is 1 (default), a remember password link appears for password recovery
83
- * redirect
84
- * Successful logins are redirected to this URL
85
-
86
- = Multilingual Support =
87
-
88
- We have WPML compatiblity with regards to login/logout redirects. Aside from custom redirect links for each language, you can also use the %LANG% placeholder to dynamically insert the language fragment used to build URLs, such as *en* for English or *es* for Spanish.
89
-
90
- = SSL Logins =
91
-
92
- To force SSL, see [http://codex.wordpress.org/Administration_Over_SSL]("this page"). The plugin will automatically detect the wordpress settings.
93
-
94
- = Customizing the Widget =
95
- You can customize the html widgets in an upgrade-safe manner by copying files and editing them within your theme. Firstly, you need to understand how Login With Ajax loads templates:
96
-
97
- * When looking for files/templates there is an order of precedence - active child theme (if applicable), active parent themes, and finally the plugin folder:
98
- * `wp-content/themes/your-theme/plugins/login-with-ajax/`
99
- * `wp-content/themes/parent-theme/plugins/login-with-ajax/`
100
- * `wp-content/plugins/login-with-ajax/widget/`
101
-
102
- * Login With Ajax loads only one CSS and JS file which contains code for all templates. The plugin checks the locations above and loads the one it finds first. The default files are:
103
- * `wp-content/plugins/login-with-ajax/widget/login-with-ajax.js`
104
- * `wp-content/plugins/login-with-ajax/widget/widget.css`
105
-
106
- * One caveat for JavaScript files, if you've enabled WP_DEBUG, then LWA will look for a file called `login-with-ajax.source.js`, a non-minified version of the normal JS file.
107
-
108
- * Login With Ajax then checks for template folders which are loaded according to the preference highlighted above.
109
- * When a user is logged out, the `widget_out.php` will be used.
110
- * If logged out, then `widget_in.php` will be used
111
- * If either of these files don't exist in your template, the one located in the default folder will be used (which you can also override in your theme).
112
-
113
- **Examples**
114
-
115
- If you wanted to change some text on the default theme, you could simply copy `wp-content/plugins/login-with-ajax/widget/default` to `wp-content/themes/yourtheme/plugins/login-with-ajax/default` and edit the files as needed.
116
-
117
- If you need to change the CSS file, copy the file `wp-content/plugins/login-with-ajax/widget/widget.css` over to `wp-content/themes/yourtheme/plugins/login-with-ajax/widget.css` and edit accordingly.
118
-
119
- The JavaScript ajax magic relies on the class names and hierarchical structure within the template files, if you want to modify the templates without adding your own JS, make sure you keep these class names and structure intact.
120
-
121
- == Screenshots ==
122
-
123
- 1. Add a fully customizable login widget to your sidebars.
124
-
125
- 2. Smoothen the process via ajax login, avoid screen refreshes on failures.
126
-
127
- 3. If your login is unsuccessful, user gets notified without loading a new page!
128
-
129
- 4. Customizable login/logout redirection settings.
130
-
131
- 5. Choose what your users see once logged in.
132
-
133
- == Frequently Asked Questions ==
134
-
135
- = Language Support =
136
- If your language has been translated 90% or more on the [translate.wordpress.org project page](https://translate.wordpress.org/projects/wp-plugins/login-with-ajax/), then your language translation of Login With Ajax should be automatically installed and maintained by WordPress.
137
-
138
- If not, you can also manually install this, we'll use Russian as an example:
139
-
140
- 1. Find your language on the [translate.wordpress.org project page](https://translate.wordpress.org/projects/wp-plugins/login-with-ajax/), and click on either the stable or development column percentage.
141
- 2. Click the 'Export' link at the bottom of the page, but select 'All Current' and the (.mo) file format, save the downloaded file.
142
- 3. Rename that file in the format of login-with-ajax-LANG.mo, where LANG = your language locale, for example russian is ru_RU so you'd get `login-with-ajax-ru_RU.mo`
143
- 4. Upload that file to the `wp-content/languages/plugins` folder on your WordPress installation.
144
- 5. Your Login With Ajax plugin should now be translated partially into your language.
145
-
146
- We suggest you contribute to the WordPress translation project page, anyone with a registered wordpress.org account can suggest new translations!
147
-
148
- = The registration link doesn't show! What's wrong? =
149
- Before you start troubleshooting, make sure your blog has registrations enabled via the admin area (Settings > General) and that your widget has the registration link box checked.
150
-
151
- = AJAX Registrations don't work! What's wrong? =
152
- Firstly, you should make sure that you can register via the normal wp-admin login, if something goes wrong there the problem is not login with ajax. Please note that currently there is no AJAX registration with BuddyPress due to it rewriting the login area (this will be resolved soon).
153
-
154
- = How can I customize the login widget? =
155
- See the notes section about customizing a widget.
156
-
157
- = How do I use SSL with this plugin? =
158
- Yes, see the notes section.
159
-
160
- = Do you have a shortcode or template tag? =
161
- Yes, see the notes section.
162
-
163
- For further questions and answers (or to submit one yourself) go to our [https://wordpress.org/support/plugin/login-with-ajax/](support forums).
164
-
165
-
166
- == Changelog ==
167
- = 3.1.9 =
168
- * added precautionary security sanitization/escaping of input data on admin pages and settings,
169
- * added USERNICENAME for login redirects for url-friendly usernames
170
- * fixed styling of template dropdown in admin page
171
- * fixed invalid/confirmed status boxes getting class/style names confused on login failures/success attempts
172
- * changed wp_redirect usage to wp_safe_redirect for extra security precaution
173
- * changed use of site_url with wp_login_url where appropriate allowing for better plugin compatibility
174
-
175
- = 3.1.8.1 =
176
- * fixed translations from translate.wordpress.org not loading properly (languages must be translated %95 or more),
177
- * fixed settings pages save button not working in 3.1.8 release
178
-
179
- = 3,1,8 =
180
- * removed langs file, as WP translate services now handle translation and updates automatically
181
- * updated admin area to include %LANG% hints in redirect templates and split login/logout for clearler explanations of other placeholders that can be used
182
- * fixed s2member redirection compatibility issues
183
-
184
- = 3.1.7 =
185
- * fixed XSS security vulnerability on LWA settings page allowing code injection if an authorized user follows a properly structured url to that page, this does not affect the security of the login forms, only the settings page. Kudos Neven Biruski from DefenceCode for responsible disclosure.
186
- * changed our hooks logout_url and login_redirect added as actions to filters which prevented functionality in some situations
187
-
188
- = 3.1.6 =
189
- * added Persian translation, thanks to Mohammad Akbari
190
- * fixed PHP 7 deprecated construct error
191
- * fixed deprecated get_currentuserinfo function PHP warning
192
- * added option to show direct links (no AJAX forms) to password recovery and registration forms
193
- * fixed missing text domain in widget/modal/widget_out.php
194
- * fixed server errors when deactivating BuddyPress whilst LWA is active
195
-
196
- = 3.1.5 =
197
- * fixed 4.3 password update which now sends a link for user to set password instead
198
- * fixed login redirect issues when using shortcode and template tags
199
- * added script localization via LWA JS parameter,
200
- * changed JS destination url to admin-ajax.php which fixes some incompatibilities with WPML
201
- * fixed WPML status messages not being translated upon login/registration/password-recovery
202
- * added and updated loads of languages, see here for full list - http://translate.netweblogic.com/projects/login-with-ajax/
203
- * added some minor label layout improvements for admin area labels/forms
204
- * added minor widget admin settings layout improvements
205
-
206
- = 3.1.4 =
207
- * fixed MIME type errors between HTTP <> HTTPS ajax requests,
208
- * added redirect shortcode attribute
209
-
210
- = 3.1.3 =
211
- * fixed JS/CSS file overriding problems
212
- * fixed class html error in widget/default/widget_in.php
213
- * fixed redirection issues when not using JS
214
- * fixed MultiSite registrations not adding user to blog with default role only 'subscriber' (props to Renato Baccaro)
215
- * fixed vulnerability where registration is still possible even if registration is disabled in settings (props to Kevin Niehage @weizenspreu)
216
- * fixed problems when trying to log in from an http page when admin ssl is enforced
217
- * fixed CSS to hide table borders of default widget for the twenty fourteen theme
218
- * added Hebrew, thanks to Menachem Shapiro
219
- * fixed HTML validation issues in widgets
220
- * added error fallback during ajax request
221
- * added new icons and headers for wordpress.org plugin pages
222
- * added redirect shortcode attribute for custom redirect
223
-
224
- = 3.1.2 =
225
- * updated Russian, Swedish and POT language files
226
- * added Afrikaans translation
227
- * added login_form action to divs-only and modal templates,
228
- * fixed php warning in login-with-ajax.php
229
- * fixed custom registration email not working since 3.1
230
- * fixed logged in 'hi' title not showing up and is now configurable in widget settings
231
-
232
- = 3.1.1 =
233
- * fixed graceful fallback for themes with broken JS
234
- * added loading of source JS if WP_DEBUG is enabled
235
- * moved reveal.js source code into source js file
236
- * fixed shortcode php warning
237
- * added template shortcode/template attribute
238
- * profile_link and registration arguments are now considered true/1 by default, to avoid confusion with missing links
239
- * added 'remember' argument which controls whether to show/hide password recovery link
240
- * fixed widget settings not remembering unchecked checkboxes
241
- * added Slovak
242
- * removed strtolower and using CSS now in widget_in.php
243
- * moved register_widget into own function called by widgets_init
244
- * changed some lwa-... ids to classes in widget_in.php
245
- * added Slovak, updated Russian languages
246
- * updated the POT file
247
-
248
- = 3.1 =
249
- * fixed json_encode issue
250
- * overhaul of JS, now leaner and meaner
251
- * modified template structure to allow multiple login forms
252
- * added template selection to each widget
253
- * added title choice to widget
254
- * removed inclusion of wp-includes/registration.php during regsitration (not needed since WP 3.1)
255
- * added two new templates to choose in widgets
256
- * new light-weight modal using tweaked Reveal library - http://zurb.com/playground/reveal-modal-plugin
257
- * improved css
258
- * improved html structures in widget templates
259
- * added sainitization in widget templates
260
- * fixed CSRF vulnerability in admin settings page - thanks to Charlie Eriksen via Secunia SVCRP
261
- * moved WP Widget before/after and open/close tags out of templates and into the WP_Widget class
262
- * LoginWithAjax class is now completely static
263
- * added some MS fixes for registration, now works with BuddyPress
264
-
265
- = 3.0.4.1 =
266
- * fixed xss vulnerability for re-enlistment on wordpress repo, more on the way
267
-
268
- = 3.0.4 =
269
- * updated russian translation
270
- * added japanese
271
- * updated iranian
272
- * added registration attribute to template tags/shortcode
273
-
274
- = 3.0.3 =
275
- * scrollbar issue in default widget
276
- * added hungarian
277
-
278
- = 3.0.2 =
279
- * got rid of (hopefully all) php warnings
280
-
281
- = 3.0.1 =
282
- * Fixed unexpected #LoginWithAjax_Footer showing up at bottom
283
- * Fixed link problems for sub-directory blogs (using bloginfo('wpurl') now)
284
- * Added Albanian
285
- * Replace Spanish with revised version
286
-
287
- = 3.0 =
288
- * Option to choose from various widget templates.
289
-
290
- = 3.0b3 =
291
- * %LASTURL% now works for logins as well
292
- * Profile link plays nice with buddypress
293
- * Added fix to stop wp_new_user_notification conflicts
294
- * Empty logins now have an error message too.
295
-
296
- = 3.0b =
297
- * Various bug fixes
298
- * Improved JavaScript code
299
- * Ajax Registration Option
300
-
301
- = 2.21 =
302
- * Redirect bug fix
303
- * Hopefully fixed encoding issue
304
-
305
- = 2.2 =
306
- * Added Polish, Turkish and Brazilian Translation
307
- * Fixed buddypress avatar not showing when logged in
308
- * Removed capitalization of username in logged in widget
309
- * Fixed all other known bugs
310
- * Added placeholders for redirects (e.g. %USERNAME% for username when logged in)
311
- * Added seamless login, screen doesn't refresh upon successful login.
312
-
313
- = 2.1.5 =
314
- * Changed logged in widget to fix avatar display issue for both BuddyPress and WP. (Using ID instead of email for get_avatar and changed depreciated BP function).
315
- * Added Danish Translation
316
-
317
- = 2.1.4 =
318
- * Added Chinese Translations
319
- * CSS compatability with themes improvement.
320
-
321
- = 2.1.3 =
322
- * Added Italian Translations
323
- * Added space in widget after "Hi" when logged in.
324
- * CSS compatability with themes improvement.
325
-
326
- = 2.1.2 =
327
- * Added German Translations
328
- * Fixed JS url encoding issue
329
-
330
- = 2.1.1 =
331
- * Added Finnish, Russian and French Translations
332
- * Made JS success message translatable
333
- * Fixed encoding issue (e.g. # fails in passwords) in the JS
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/widget/default/widget_in.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
- /*
3
- * This is the page users will see logged in.
4
- * You can edit this, but for upgrade safety you should copy and modify this file into your template folder.
5
- * The location from within your template folder is plugins/login-with-ajax/ (create these directories if they don't exist)
6
- */
7
- ?>
8
- <div class="lwa">
9
- <?php
10
- $user = wp_get_current_user();
11
- ?>
12
- <span class="lwa-title-sub" style="display:none"><?php echo __( 'Hi', 'login-with-ajax' ) . " " . $user->display_name ?></span>
13
- <table>
14
- <tr>
15
- <td class="avatar lwa-avatar">
16
- <?php echo get_avatar( $user->ID, $size = '50' ); ?>
17
- </td>
18
- <td class="lwa-info">
19
- <?php
20
- //Admin URL
21
- if ( $lwa_data['profile_link'] == '1' ) {
22
- if( function_exists('bp_loggedin_user_link') ){
23
- ?>
24
- <a href="<?php bp_loggedin_user_link(); ?>"><?php esc_html_e('Profile','login-with-ajax') ?></a><br/>
25
- <?php
26
- }else{
27
- ?>
28
- <a href="<?php echo trailingslashit(get_admin_url()); ?>profile.php"><?php esc_html_e('Profile','login-with-ajax') ?></a><br/>
29
- <?php
30
- }
31
- }
32
- //Logout URL
33
- ?>
34
- <a id="wp-logout" href="<?php echo wp_logout_url() ?>"><?php esc_html_e( 'Log Out' ,'login-with-ajax') ?></a><br />
35
- <?php
36
- //Blog Admin
37
- if( current_user_can('list_users') ) {
38
- ?>
39
- <a href="<?php echo get_admin_url(); ?>"><?php esc_html_e("blog admin", 'login-with-ajax'); ?></a>
40
- <?php
41
- }
42
- ?>
43
- </td>
44
- </tr>
45
- </table>
46
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/widget/default/widget_out.php DELETED
@@ -1,107 +0,0 @@
1
- <?php
2
- /*
3
- * This is the page users will see logged out.
4
- * You can edit this, but for upgrade safety you should copy and modify this file into your template folder.
5
- * The location from within your template folder is plugins/login-with-ajax/ (create these directories if they don't exist)
6
- */
7
- ?>
8
- <div class="lwa lwa-default"><?php //class must be here, and if this is a template, class name should be that of template directory ?>
9
- <form class="lwa-form" action="<?php echo esc_url(LoginWithAjax::$url_login); ?>" method="post">
10
- <div>
11
- <span class="lwa-status"></span>
12
- <table>
13
- <tr class="lwa-username">
14
- <td class="lwa-username-label">
15
- <label><?php esc_html_e( 'Username','login-with-ajax' ) ?></label>
16
- </td>
17
- <td class="lwa-username-input">
18
- <input type="text" name="log" />
19
- </td>
20
- </tr>
21
- <tr class="lwa-password">
22
- <td class="lwa-password-label">
23
- <label><?php esc_html_e( 'Password','login-with-ajax' ) ?></label>
24
- </td>
25
- <td class="lwa-password-input">
26
- <input type="password" name="pwd" />
27
- </td>
28
- </tr>
29
- <tr><td colspan="2"><?php do_action('login_form'); ?></td></tr>
30
- <tr class="lwa-submit">
31
- <td class="lwa-submit-button">
32
- <input type="submit" name="wp-submit" id="lwa_wp-submit" value="<?php esc_attr_e('Log In', 'login-with-ajax'); ?>" tabindex="100" />
33
- <input type="hidden" name="lwa_profile_link" value="<?php echo esc_attr($lwa_data['profile_link']); ?>" />
34
- <input type="hidden" name="login-with-ajax" value="login" />
35
- <?php if( !empty($lwa_data['redirect']) ): ?>
36
- <input type="hidden" name="redirect_to" value="<?php echo esc_url($lwa_data['redirect']); ?>" />
37
- <?php endif; ?>
38
- </td>
39
- <td class="lwa-submit-links">
40
- <input name="rememberme" type="checkbox" class="lwa-rememberme" value="forever" /> <label><?php esc_html_e( 'Remember Me','login-with-ajax' ) ?></label>
41
- <br />
42
- <?php if( !empty($lwa_data['remember']) ): ?>
43
- <a class="lwa-links-remember" href="<?php echo esc_attr(LoginWithAjax::$url_remember); ?>" title="<?php esc_attr_e('Password Lost and Found','login-with-ajax') ?>"><?php esc_attr_e('Lost your password?','login-with-ajax') ?></a>
44
- <?php endif; ?>
45
- <?php if ( get_option('users_can_register') && !empty($lwa_data['registration']) ) : ?>
46
- <br />
47
- <a href="<?php echo esc_attr(LoginWithAjax::$url_register); ?>" class="lwa-links-register lwa-links-modal"><?php esc_html_e('Register','login-with-ajax') ?></a>
48
- <?php endif; ?>
49
- </td>
50
- </tr>
51
- </table>
52
- </div>
53
- </form>
54
- <?php if( !empty($lwa_data['remember']) && $lwa_data['remember'] == 1 ): ?>
55
- <form class="lwa-remember" action="<?php echo esc_attr(LoginWithAjax::$url_remember) ?>" method="post" style="display:none;">
56
- <div>
57
- <span class="lwa-status"></span>
58
- <table>
59
- <tr>
60
- <td>
61
- <strong><?php esc_html_e("Forgotten Password", 'login-with-ajax'); ?></strong>
62
- </td>
63
- </tr>
64
- <tr>
65
- <td class="lwa-remember-email">
66
- <?php $msg = __("Enter username or email", 'login-with-ajax'); ?>
67
- <input type="text" name="user_login" class="lwa-user-remember" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}" />
68
- <?php do_action('lostpassword_form'); ?>
69
- </td>
70
- </tr>
71
- <tr>
72
- <td class="lwa-remember-buttons">
73
- <input type="submit" value="<?php esc_attr_e("Get New Password", 'login-with-ajax'); ?>" class="lwa-button-remember" />
74
- <a href="#" class="lwa-links-remember-cancel"><?php esc_html_e("Cancel", 'login-with-ajax'); ?></a>
75
- <input type="hidden" name="login-with-ajax" value="remember" />
76
- </td>
77
- </tr>
78
- </table>
79
- </div>
80
- </form>
81
- <?php endif; ?>
82
- <?php if( get_option('users_can_register') && !empty($lwa_data['registration']) && $lwa_data['registration'] == 1 ): ?>
83
- <div class="lwa-register lwa-register-default lwa-modal" style="display:none;">
84
- <h4><?php esc_html_e('Register For This Site','login-with-ajax') ?></h4>
85
- <p><em class="lwa-register-tip"><?php esc_html_e('A password will be e-mailed to you.','login-with-ajax') ?></em></p>
86
- <form class="lwa-register-form" action="<?php echo esc_attr(LoginWithAjax::$url_register); ?>" method="post">
87
- <div>
88
- <span class="lwa-status"></span>
89
- <p class="lwa-username">
90
- <label><?php esc_html_e('Username','login-with-ajax') ?><br />
91
- <input type="text" name="user_login" id="user_login" class="input" size="20" tabindex="10" /></label>
92
- </p>
93
- <p class="lwa-email">
94
- <label><?php esc_html_e('E-mail','login-with-ajax') ?><br />
95
- <input type="text" name="user_email" id="user_email" class="input" size="25" tabindex="20" /></label>
96
- </p>
97
- <?php do_action('register_form'); ?>
98
- <?php do_action('lwa_register_form'); ?>
99
- <p class="submit">
100
- <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Register', 'login-with-ajax'); ?>" tabindex="100" />
101
- </p>
102
- <input type="hidden" name="login-with-ajax" value="register" />
103
- </div>
104
- </form>
105
- </div>
106
- <?php endif; ?>
107
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/widget/divs-only/widget_out.php DELETED
@@ -1,86 +0,0 @@
1
- <?php
2
- /*
3
- * This is the page users will see logged out.
4
- * You can edit this, but for upgrade safety you should copy and modify this file into your template folder.
5
- * The location from within your template folder is plugins/login-with-ajax/ (create these directories if they don't exist)
6
- */
7
- ?>
8
- <div class="lwa lwa-divs-only">
9
- <span class="lwa-status"></span>
10
- <form class="lwa-form" action="<?php echo esc_url(LoginWithAjax::$url_login); ?>" method="post">
11
- <div class="lwa-username">
12
- <label><?php esc_html_e( 'Username','login-with-ajax' ) ?></label>
13
- <input type="text" name="log" id="lwa_user_login" class="input" />
14
- </div>
15
-
16
- <div class="lwa-password">
17
- <label><?php esc_html_e( 'Password','login-with-ajax' ) ?></label>
18
- <input type="password" name="pwd" id="lwa_user_pass" class="input" />
19
- </div>
20
-
21
- <div class="lwa-login_form">
22
- <?php do_action('login_form'); ?>
23
- </div>
24
-
25
- <div class="lwa-submit-button">
26
- <input type="submit" name="wp-submit" id="lwa_wp-submit" value="<?php esc_attr_e('Log In','login-with-ajax'); ?>" tabindex="100" />
27
- <input type="hidden" name="lwa_profile_link" value="<?php echo esc_attr($lwa_data['profile_link']); ?>" />
28
- <input type="hidden" name="login-with-ajax" value="login" />
29
- <?php if( !empty($lwa_data['redirect']) ): ?>
30
- <input type="hidden" name="redirect_to" value="<?php echo esc_url($lwa_data['redirect']); ?>" />
31
- <?php endif; ?>
32
- </div>
33
-
34
- <div class="lwa-links">
35
- <input name="rememberme" type="checkbox" class="lwa-rememberme" value="forever" /> <label><?php esc_html_e( 'Remember Me','login-with-ajax' ) ?></label>
36
- <br />
37
- <?php if( !empty($lwa_data['remember']) ): ?>
38
- <a class="lwa-links-remember" href="<?php echo esc_attr(LoginWithAjax::$url_remember); ?>" title="<?php esc_attr_e('Password Lost and Found','login-with-ajax') ?>"><?php esc_attr_e('Lost your password?','login-with-ajax') ?></a>
39
- <?php endif; ?>
40
- <?php if ( get_option('users_can_register') && !empty($lwa_data['registration']) ) : ?>
41
- <br />
42
- <a href="<?php echo esc_attr(LoginWithAjax::$url_register); ?>" class="lwa-links-register-inline"><?php esc_html_e('Register','login-with-ajax'); ?></a>
43
- <?php endif; ?>
44
- </div>
45
- </form>
46
- <?php if( !empty($lwa_data['remember']) && $lwa_data['remember'] == 1 ): ?>
47
- <form class="lwa-remember" action="<?php echo esc_attr(LoginWithAjax::$url_remember); ?>" method="post" style="display:none;">
48
- <p><strong><?php esc_html_e("Forgotten Password",'login-with-ajax'); ?></strong></p>
49
- <div class="lwa-remember-email">
50
- <?php $msg = __("Enter username or email",'login-with-ajax'); ?>
51
- <input type="text" name="user_login" id="lwa_user_remember" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}" />
52
- <?php do_action('lostpassword_form'); ?>
53
- </div>
54
- <div class="lwa-submit-button">
55
- <input type="submit" value="<?php esc_attr_e("Get New Password", 'login-with-ajax'); ?>" />
56
- <a href="#" class="lwa-links-remember-cancel"><?php esc_attr_e("Cancel", 'login-with-ajax'); ?></a>
57
- <input type="hidden" name="login-with-ajax" value="remember" />
58
- </div>
59
- </form>
60
- <?php endif; ?>
61
- <?php if ( get_option('users_can_register') && !empty($lwa_data['registration']) && $lwa_data['registration'] == 1 ) : ?>
62
- <div class="lwa-register" style="display:none;" >
63
- <form class="registerform" action="<?php echo esc_attr(LoginWithAjax::$url_register); ?>" method="post">
64
- <p><strong><?php esc_html_e('Register For This Site','login-with-ajax'); ?></strong></p>
65
- <div class="lwa-username">
66
- <?php $msg = __('Username','login-with-ajax'); ?>
67
- <input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}" />
68
- </div>
69
- <div class="lwa-email">
70
- <?php $msg = __('E-mail','login-with-ajax'); ?>
71
- <input type="text" name="user_email" id="user_email" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}"/>
72
- </div>
73
- <?php
74
- //If you want other plugins to play nice, you need this:
75
- do_action('register_form');
76
- ?>
77
- <p class="lwa-submit-button">
78
- <?php esc_html_e('A password will be e-mailed to you.','login-with-ajax') ?>
79
- <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Register', 'login-with-ajax'); ?>" tabindex="100" />
80
- <a href="#" class="lwa-links-register-inline-cancel"><?php esc_html_e("Cancel", 'login-with-ajax'); ?></a>
81
- <input type="hidden" name="login-with-ajax" value="register" />
82
- </p>
83
- </form>
84
- </div>
85
- <?php endif; ?>
86
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/widget/loading.gif DELETED
Binary file
trunk/widget/login-with-ajax.js DELETED
@@ -1 +0,0 @@
1
- jQuery(document).ready(function(a){function e(e,i){a(".lwa-loading").remove(),i=a(i),e.result===!0?i.attr("class","lwa-status lwa-status-confirm").html(e.message):e.result===!1?(i.attr("class","lwa-status lwa-status-invalid").html(e.error),i.find("a").click(function(e){var i=a(this).parents(".lwa").find("form.lwa-remember");i.length>0&&(e.preventDefault(),i.show("slow"))})):i.attr("class","lwa-status lwa-status-invalid").html("An error has occured. Please try again.")}a("#LoginWithAjax").length>0&&(a("#LoginWithAjax").addClass("lwa"),a("#LoginWithAjax_Status").addClass("lwa-status"),a("#LoginWithAjax_Register").addClass("lwa-register"),a("#LoginWithAjax_Remember").addClass("lwa-remember"),a("#LoginWithAjax_Links_Remember").addClass("lwa-links-remember"),a("#LoginWithAjax_Links_Remember_Cancel").addClass("lwa-links-remember-cancel"),a("#LoginWithAjax_Form").addClass("lwa-form")),a("form.lwa-form, form.lwa-remember, div.lwa-register form").submit(function(i){i.preventDefault();var n=a(this),t=n.find(".lwa-status");0==t.length&&(t=a('<span class="lwa-status"></span>'),n.prepend(t));var l=n.find(".lwa-ajax");0==l.length&&(l=a('<input class="lwa-ajax" name="lwa" type="hidden" value="1" />'),n.prepend(l)),a('<div class="lwa-loading"></div>').prependTo(n);var s=n.attr("action");"undefined"!=typeof LWA&&(s=LWA.ajaxurl),a.ajax({type:"POST",url:s,data:n.serialize(),success:function(i){e(i,t),a(document).trigger("lwa_"+i.action,[i,n])},error:function(){e({},t)},dataType:"jsonp"})}),a(document).on("lwa_login",function(e,i,n){i.result===!0&&(null!=i.widget?a.get(i.widget,function(e){var i=a(e);n.parent(".lwa").replaceWith(i);var t=i.find(".").show(),l=i.parent().find(".lwa-title");l.replaceWith(t)}):null==i.redirect?window.location.reload():window.location=i.redirect)}),a(".lwa-modal").each(function(e,i){var n=a(i);n.parents(".lwa").data("modal",n),a("body").append(a('<div class="lwa"></div>').append(n))}),a(document).on("click",".lwa-links-modal",function(e){var i=a(this).parents(".lwa").data("modal");"undefined"!=typeof i&&i.length>0&&(e.preventDefault(),i.reveal({modalbgclass:"lwa-modal-bg",dismissmodalclass:"lwa-modal-close"}))}),a(".lwa-links-register-inline").click(function(e){var i=a(this).parents(".lwa").find(".lwa-register");i.length>0&&(e.preventDefault(),i.show("slow"),a(this).parents(".lwa").find(".lwa-remember").hide("slow"))}),a(".lwa-links-register-inline-cancel").click(function(e){e.preventDefault(),a(this).parents(".lwa-register").hide("slow")}),a(document).on("click",".lwa-links-remember",function(e){var i=a(this).parents(".lwa").find(".lwa-remember");i.length>0&&(e.preventDefault(),i.show("slow"),a(this).parents(".lwa").find(".lwa-register").hide("slow"))}),a(document).on("click",".lwa-links-remember-cancel",function(e){e.preventDefault(),a(this).parents(".lwa-remember").hide("slow")})}),function(a){a("a[data-reveal-id]").on("click",function(e){e.preventDefault();var i=a(this).attr("data-reveal-id");a("#"+i).reveal(a(this).data())}),a.fn.reveal=function(e){var i={animation:"fadeAndPop",animationspeed:300,closeonbackgroundclick:!0,dismissmodalclass:"close-reveal-modal",modalbgclass:"reveal-modal-bg"},e=a.extend({},i,e);return this.each(function(){function i(){o=!1}function n(){o=!0}var t=a(this),l=parseInt(t.css("top")),s=t.height()+l,o=!1,d=a("."+e.modalbgclass);0==d.length&&(d=a('<div class="'+e.modalbgclass+'" />').insertAfter(t)),0==t.find("."+e.dismissmodalclass).length&&t.append('<a class="'+e.dismissmodalclass+'">&#215;</a>'),t.bind("reveal:open",function(){d.unbind("click.modalEvent"),a("."+e.dismissmodalclass).unbind("click.modalEvent"),o||(n(),"fadeAndPop"==e.animation&&(t.css({top:a(document).scrollTop()-s,opacity:0,visibility:"visible",display:"block"}),d.fadeIn(e.animationspeed/2),t.delay(e.animationspeed/2).animate({top:a(document).scrollTop()+l+"px",opacity:1},e.animationspeed,i())),"fade"==e.animation&&(t.css({opacity:0,visibility:"visible",top:a(document).scrollTop()+l,display:"block"}),d.fadeIn(e.animationspeed/2),t.delay(e.animationspeed/2).animate({opacity:1},e.animationspeed,i())),"none"==e.animation&&(t.css({visibility:"visible",top:a(document).scrollTop()+l,display:"block"}),d.css({display:"block"}),i())),t.unbind("reveal:open")}),t.bind("reveal:close",function(){o||(n(),"fadeAndPop"==e.animation&&(d.delay(e.animationspeed).fadeOut(e.animationspeed),t.animate({top:a(document).scrollTop()-s+"px",opacity:0},e.animationspeed/2,function(){t.css({top:l,opacity:1,visibility:"hidden"}),i()})),"fade"==e.animation&&(d.delay(e.animationspeed).fadeOut(e.animationspeed),t.animate({opacity:0},e.animationspeed,function(){t.css({opacity:1,visibility:"hidden",top:l}),i()})),"none"==e.animation&&(t.css({visibility:"hidden",top:l}),d.css({display:"none"}))),t.unbind("reveal:close")}),t.trigger("reveal:open");a("."+e.dismissmodalclass).bind("click.modalEvent",function(){t.trigger("reveal:close")});e.closeonbackgroundclick&&(d.css({cursor:"pointer"}),d.bind("click.modalEvent",function(){t.trigger("reveal:close")})),a("body").keyup(function(a){27===a.which&&t.trigger("reveal:close")})})}}(jQuery);
 
trunk/widget/login-with-ajax.source.js DELETED
@@ -1,305 +0,0 @@
1
- /* Customize from here downwards */
2
- jQuery(document).ready( function($) {
3
- //TODO some backwards compatability here -
4
- if( $('#LoginWithAjax').length > 0 ){
5
- $('#LoginWithAjax').addClass('lwa');
6
- $('#LoginWithAjax_Status').addClass('lwa-status');
7
- $('#LoginWithAjax_Register').addClass('lwa-register');
8
- $('#LoginWithAjax_Remember').addClass('lwa-remember');
9
- $('#LoginWithAjax_Links_Remember').addClass('lwa-links-remember');
10
- $('#LoginWithAjax_Links_Remember_Cancel').addClass('lwa-links-remember-cancel');
11
- $('#LoginWithAjax_Form').addClass('lwa-form');
12
- }
13
- /*
14
- * links
15
- * add action input htmls
16
- */
17
- //Remember and register form AJAX
18
- $('form.lwa-form, form.lwa-remember, div.lwa-register form').submit(function(event){
19
- //Stop event, add loading pic...
20
- event.preventDefault();
21
- var form = $(this);
22
- var statusElement = form.find('.lwa-status');
23
- if( statusElement.length == 0 ){
24
- statusElement = $('<span class="lwa-status"></span>');
25
- form.prepend(statusElement);
26
- }
27
- var ajaxFlag = form.find('.lwa-ajax');
28
- if( ajaxFlag.length == 0 ){
29
- ajaxFlag = $('<input class="lwa-ajax" name="lwa" type="hidden" value="1" />');
30
- form.prepend(ajaxFlag);
31
- }
32
- $('<div class="lwa-loading"></div>').prependTo(form);
33
- //Make Ajax Call
34
- var form_action = form.attr('action');
35
- if( typeof LWA !== 'undefined' ) form_action = LWA.ajaxurl;
36
- $.ajax({
37
- type : 'POST',
38
- url : form_action,
39
- data : form.serialize(),
40
- success : function(data){
41
- lwaAjax( data, statusElement );
42
- $(document).trigger('lwa_' + data.action, [data, form]);
43
- },
44
- error : function(){ lwaAjax({}, statusElement); },
45
- dataType : 'jsonp'
46
- });
47
- //trigger event
48
- });
49
-
50
- //Catch login actions
51
- $(document).on('lwa_login', function(event, data, form){
52
- if(data.result === true){
53
- //Login Successful - Extra stuff to do
54
- if( data.widget != null ){
55
- $.get( data.widget, function(widget_result) {
56
- var newWidget = $(widget_result);
57
- form.parent('.lwa').replaceWith(newWidget);
58
- var lwaSub = newWidget.find('.').show();
59
- var lwaOrg = newWidget.parent().find('.lwa-title');
60
- lwaOrg.replaceWith(lwaSub);
61
- });
62
- }else{
63
- if(data.redirect == null){
64
- window.location.reload();
65
- }else{
66
- window.location = data.redirect;
67
- }
68
- }
69
- }
70
- });
71
-
72
- //Registration overlay
73
- $('.lwa-modal').each( function(i,e){
74
- var modal = $(e);
75
- modal.parents('.lwa').data('modal', modal);
76
- $('body').append($('<div class="lwa"></div>').append(modal));
77
- });
78
- $(document).on('click', ".lwa-links-modal", function(e){
79
- var target = $(this).parents('.lwa').data('modal');
80
- if( typeof target != 'undefined' && target.length > 0 ){
81
- e.preventDefault();
82
- target.reveal({
83
- modalbgclass: 'lwa-modal-bg',
84
- dismissmodalclass: 'lwa-modal-close' //the class of a button or element that will close an open modal
85
- });
86
- }
87
- });
88
- //Register
89
- $('.lwa-links-register-inline').click(function(event){
90
- var register_form = $(this).parents('.lwa').find('.lwa-register');
91
- if( register_form.length > 0 ){
92
- event.preventDefault();
93
- register_form.show('slow');
94
- $(this).parents('.lwa').find('.lwa-remember').hide('slow');
95
- }
96
- });
97
- $('.lwa-links-register-inline-cancel').click(function(event){
98
- event.preventDefault();
99
- $(this).parents('.lwa-register').hide('slow');
100
- });
101
-
102
- //Visual Effects for hidden items
103
- //Remember
104
- $(document).on('click', '.lwa-links-remember', function(event){
105
- var remember_form = $(this).parents('.lwa').find('.lwa-remember');
106
- if( remember_form.length > 0 ){
107
- event.preventDefault();
108
- remember_form.show('slow');
109
- $(this).parents('.lwa').find('.lwa-register').hide('slow');
110
- }
111
- });
112
- $(document).on('click', '.lwa-links-remember-cancel', function(event){
113
- event.preventDefault();
114
- $(this).parents('.lwa-remember').hide('slow');
115
- });
116
-
117
- //Handle a AJAX call for Login, RememberMe or Registration
118
- function lwaAjax( data, statusElement ){
119
- $('.lwa-loading').remove();
120
- statusElement = $(statusElement);
121
- if(data.result === true){
122
- //Login Successful
123
- statusElement.removeClass('lwa-status-invalid').addClass('lwa-status-confirm').html(data.message); //modify status content
124
- }else if( data.result === false ){
125
- //Login Failed
126
- statusElement.removeClass('lwa-status-confirm').addClass('lwa-status-invalid').html(data.error); //modify status content
127
- //We assume a link in the status message is for a forgotten password
128
- statusElement.find('a').click( function(event){
129
- var remember_form = $(this).parents('.lwa').find('form.lwa-remember');
130
- if( remember_form.length > 0 ){
131
- event.preventDefault();
132
- remember_form.show('slow');
133
- }
134
- });
135
- }else{
136
- //If there already is an error element, replace text contents, otherwise create a new one and insert it
137
- statusElement.removeClass('lwa-status-confirm').addClass('lwa-status-invalid').html('An error has occured. Please try again.'); //modify status content
138
- }
139
- }
140
-
141
- });
142
-
143
- /* http://zurb.com/playground/reveal-modal-plugin */
144
- /*
145
- * jQuery Reveal Plugin 1.0
146
- * www.ZURB.com
147
- * Copyright 2010, ZURB
148
- * Free to use under the MIT license.
149
- * http://www.opensource.org/licenses/mit-license.php
150
- */
151
-
152
- (function($) {
153
-
154
- /*---------------------------
155
- Defaults for Reveal
156
- ----------------------------*/
157
-
158
- /*---------------------------
159
- Listener for data-reveal-id attributes
160
- ----------------------------*/
161
-
162
- $('a[data-reveal-id]').on('click', function(e) {
163
- e.preventDefault();
164
- var modalLocation = $(this).attr('data-reveal-id');
165
- $('#'+modalLocation).reveal($(this).data());
166
- });
167
-
168
- /*---------------------------
169
- Extend and Execute
170
- ----------------------------*/
171
-
172
- $.fn.reveal = function(options) {
173
-
174
-
175
- var defaults = {
176
- animation: 'fadeAndPop', //fade, fadeAndPop, none
177
- animationspeed: 300, //how fast animtions are
178
- closeonbackgroundclick: true, //if you click background will modal close?
179
- dismissmodalclass: 'close-reveal-modal', //the class of a button or element that will close an open modal
180
- modalbgclass : 'reveal-modal-bg'
181
- };
182
-
183
- //Extend dem' options
184
- var options = $.extend({}, defaults, options);
185
-
186
- return this.each(function() {
187
-
188
- /*---------------------------
189
- Global Variables
190
- ----------------------------*/
191
- var modal = $(this),
192
- topMeasure = parseInt(modal.css('top')),
193
- topOffset = modal.height() + topMeasure,
194
- locked = false,
195
- modalBG = $('.'+options.modalbgclass);
196
-
197
- /*---------------------------
198
- Create Modal BG
199
- ----------------------------*/
200
- if(modalBG.length == 0) {
201
- modalBG = $('<div class="'+options.modalbgclass+'" />').insertAfter(modal);
202
- }
203
- if( modal.find('.'+options.dismissmodalclass).length == 0 ){
204
- modal.append('<a class="'+options.dismissmodalclass+'">&#215;</a>');
205
- }
206
-
207
- /*---------------------------
208
- Open & Close Animations
209
- ----------------------------*/
210
- //Entrance Animations
211
- modal.bind('reveal:open', function () {
212
- modalBG.unbind('click.modalEvent');
213
- $('.' + options.dismissmodalclass).unbind('click.modalEvent');
214
- if(!locked) {
215
- lockModal();
216
- if(options.animation == "fadeAndPop") {
217
- modal.css({'top': $(document).scrollTop()-topOffset, 'opacity' : 0, 'visibility' : 'visible', 'display':'block'});
218
- modalBG.fadeIn(options.animationspeed/2);
219
- modal.delay(options.animationspeed/2).animate({
220
- "top": $(document).scrollTop()+topMeasure + 'px',
221
- "opacity" : 1
222
- }, options.animationspeed,unlockModal());
223
- }
224
- if(options.animation == "fade") {
225
- modal.css({'opacity' : 0, 'visibility' : 'visible', 'top': $(document).scrollTop()+topMeasure, 'display':'block'});
226
- modalBG.fadeIn(options.animationspeed/2);
227
- modal.delay(options.animationspeed/2).animate({
228
- "opacity" : 1
229
- }, options.animationspeed,unlockModal());
230
- }
231
- if(options.animation == "none") {
232
- modal.css({'visibility' : 'visible', 'top':$(document).scrollTop()+topMeasure, 'display':'block'});
233
- modalBG.css({"display":"block"});
234
- unlockModal()
235
- }
236
- }
237
- modal.unbind('reveal:open');
238
- });
239
-
240
- //Closing Animation
241
- modal.bind('reveal:close', function () {
242
- if(!locked) {
243
- lockModal();
244
- if(options.animation == "fadeAndPop") {
245
- modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
246
- modal.animate({
247
- "top": $(document).scrollTop()-topOffset + 'px',
248
- "opacity" : 0
249
- }, options.animationspeed/2, function() {
250
- modal.css({'top':topMeasure, 'opacity' : 1, 'visibility' : 'hidden'});
251
- unlockModal();
252
- });
253
- }
254
- if(options.animation == "fade") {
255
- modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
256
- modal.animate({
257
- "opacity" : 0
258
- }, options.animationspeed, function() {
259
- modal.css({'opacity' : 1, 'visibility' : 'hidden', 'top' : topMeasure});
260
- unlockModal();
261
- });
262
- }
263
- if(options.animation == "none") {
264
- modal.css({'visibility' : 'hidden', 'top' : topMeasure});
265
- modalBG.css({'display' : 'none'});
266
- }
267
- }
268
- modal.unbind('reveal:close');
269
- });
270
-
271
- /*---------------------------
272
- Open and add Closing Listeners
273
- ----------------------------*/
274
- //Open Modal Immediately
275
- modal.trigger('reveal:open')
276
-
277
- //Close Modal Listeners
278
- var closeButton = $('.' + options.dismissmodalclass).bind('click.modalEvent', function () {
279
- modal.trigger('reveal:close')
280
- });
281
-
282
- if(options.closeonbackgroundclick) {
283
- modalBG.css({"cursor":"pointer"})
284
- modalBG.bind('click.modalEvent', function () {
285
- modal.trigger('reveal:close')
286
- });
287
- }
288
- $('body').keyup(function(e) {
289
- if(e.which===27){ modal.trigger('reveal:close'); } // 27 is the keycode for the Escape key
290
- });
291
-
292
-
293
- /*---------------------------
294
- Animations Locks
295
- ----------------------------*/
296
- function unlockModal() {
297
- locked = false;
298
- }
299
- function lockModal() {
300
- locked = true;
301
- }
302
-
303
- });//each call
304
- }//orbit plugin call
305
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/widget/modal/widget_out.php DELETED
@@ -1,132 +0,0 @@
1
- <?php
2
- /*
3
- * This is the page users will see logged out.
4
- * You can edit this, but for upgrade safety you should copy and modify this file into your template folder.
5
- * The location from within your template folder is plugins/login-with-ajax/ (create these directories if they don't exist)
6
- */
7
- ?>
8
- <div class="lwa lwa-template-modal"><?php //class must be here, and if this is a template, class name should be that of template directory ?>
9
- <a href="<?php echo esc_attr(LoginWithAjax::$url_login); ?>" class="lwa-links-modal"><?php esc_html_e('Log In','login-with-ajax') ?></a>
10
- <?php
11
- //FOOTER - once the page loads, this will be moved automatically to the bottom of the document.
12
- ?>
13
- <div class="lwa-modal" style="display:none;">
14
- <form name="lwa-form" class="lwa-form" action="<?php echo esc_url(LoginWithAjax::$url_login); ?>" method="post">
15
- <span class="lwa-status"></span>
16
- <table>
17
- <tr class="lwa-username">
18
- <td class="username_label">
19
- <label><?php esc_html_e( 'Username','login-with-ajax' ) ?></label>
20
- </td>
21
- <td class="username_input">
22
- <input type="text" name="log" id="lwa_user_login" class="input" />
23
- </td>
24
- </tr>
25
- <tr class="lwa-password">
26
- <td class="password_label">
27
- <label><?php esc_html_e( 'Password','login-with-ajax' ) ?></label>
28
- </td>
29
- <td class="password_input">
30
- <input type="password" name="pwd" id="lwa_user_pass" class="input" value="" />
31
- </td>
32
- </tr>
33
- <tr><td colspan="2"><?php do_action('login_form'); ?></td></tr>
34
- <tr class="lwa-submit">
35
- <td class="lwa-submit-button">
36
- <input type="submit" name="wp-submit" class="lwa-wp-submit" value="<?php esc_attr_e('Log In','login-with-ajax'); ?>" tabindex="100" />
37
- <input type="hidden" name="lwa_profile_link" value="<?php echo !empty($lwa_data['profile_link']) ? 1:0 ?>" />
38
- <input type="hidden" name="login-with-ajax" value="login" />
39
- <?php if( !empty($lwa_data['redirect']) ): ?>
40
- <input type="hidden" name="redirect_to" value="<?php echo esc_url($lwa_data['redirect']); ?>" />
41
- <?php endif; ?>
42
- </td>
43
- <td class="lwa-links">
44
- <input name="rememberme" type="checkbox" id="lwa_rememberme" value="forever" /> <label><?php esc_html_e( 'Remember Me','login-with-ajax' ) ?></label>
45
- <br />
46
- <?php if( !empty($lwa_data['remember']) ): ?>
47
- <a class="lwa-links-remember" href="<?php echo esc_attr(LoginWithAjax::$url_remember); ?>" title="<?php esc_attr_e('Password Lost and Found','login-with-ajax') ?>"><?php esc_attr_e('Lost your password?','login-with-ajax') ?></a>
48
- <?php endif; ?>
49
- <?php if ( get_option('users_can_register') && !empty($lwa_data['registration']) ) : ?>
50
- <br />
51
- <a href="<?php echo esc_attr(LoginWithAjax::$url_register); ?>" class="lwa-links-register-inline"><?php esc_html_e('Register','login-with-ajax'); ?></a>
52
- <?php endif; ?>
53
- </td>
54
- </tr>
55
- </table>
56
- </form>
57
- <?php if( !empty($lwa_data['remember']) && $lwa_data['remember'] == 1 ): ?>
58
- <form name="lwa-remember" class="lwa-remember" action="<?php echo esc_attr(LoginWithAjax::$url_remember); ?>" method="post" style="display:none;">
59
- <span class="lwa-status"></span>
60
- <table>
61
- <tr>
62
- <td>
63
- <strong><?php esc_html_e("Forgotten Password", 'login-with-ajax'); ?></strong>
64
- </td>
65
- </tr>
66
- <tr class="lwa-remember-email">
67
- <td>
68
- <label>
69
- <?php $msg = __("Enter username or email", 'login-with-ajax'); ?>
70
- <input type="text" name="user_login" id="lwa_user_remember" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}" />
71
- </label>
72
- <?php do_action('lostpassword_form'); ?>
73
- </td>
74
- </tr>
75
- <tr>
76
- <td>
77
- <input type="submit" value="<?php esc_attr_e("Get New Password", 'login-with-ajax'); ?>" />
78
- <a href="#" class="lwa-links-remember-cancel"><?php esc_html_e("Cancel",'login-with-ajax'); ?></a>
79
- <input type="hidden" name="login-with-ajax" value="remember" />
80
- </td>
81
- </tr>
82
- </table>
83
- </form>
84
- <?php endif; ?>
85
- <?php if ( get_option('users_can_register') && !empty($lwa_data['registration']) && $lwa_data['registration'] == 1 ) : //Taken from wp-login.php ?>
86
- <div class="lwa-register" style="display:none;">
87
- <form name="lwa-register" action="<?php echo esc_attr(LoginWithAjax::$url_register); ?>" method="post">
88
- <span class="lwa-status"></span>
89
- <table>
90
- <tr>
91
- <td>
92
- <strong><?php esc_html_e('Register For This Site','login-with-ajax') ?></strong>
93
- </td>
94
- </tr>
95
- <tr class="lwa-username">
96
- <td>
97
- <label>
98
- <?php $msg = __('Username','login-with-ajax') ?>
99
- <input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}" />
100
- </label>
101
- </td>
102
- </tr>
103
- <tr class="lwa-email">
104
- <td>
105
- <label>
106
- <?php $msg = __('E-mail','login-with-ajax') ?>
107
- <input type="text" name="user_email" id="user_email" value="<?php echo esc_attr($msg); ?>" onfocus="if(this.value == '<?php echo esc_attr($msg); ?>'){this.value = '';}" onblur="if(this.value == ''){this.value = '<?php echo esc_attr($msg); ?>'}"/>
108
- </label>
109
- </td>
110
- </tr>
111
- <tr>
112
- <td>
113
- <?php
114
- //If you want other plugins to play nice, you need this:
115
- do_action('register_form');
116
- ?>
117
- </td>
118
- </tr>
119
- <tr>
120
- <td>
121
- <?php esc_html_e('A password will be e-mailed to you.', 'login-with-ajax'); ?><br />
122
- <input type="submit" value="<?php esc_attr_e('Register','login-with-ajax'); ?>" tabindex="100" />
123
- <a href="#" class="lwa-links-register-inline-cancel"><?php esc_html_e("Cancel",'login-with-ajax'); ?></a>
124
- <input type="hidden" name="login-with-ajax" value="register" />
125
- </td>
126
- </tr>
127
- </table>
128
- </form>
129
- </div>
130
- <?php endif; ?>
131
- </div>
132
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/widget/widget.css DELETED
@@ -1,53 +0,0 @@
1
- @charset "utf-8";
2
- #branding { z-index:9996; } /* a little naughty, twentyeleven fix */
3
- .lwa { margin-bottom:10px; }
4
- form.lwa-form, form.lwa-remember, div.lwa-register form { position:relative; }
5
- .lwa table { width:100% !important; margin:0px !important; border:none !important; border-spacing:0; border-collapse:collapse; }
6
- .lwa td,.lwa th { padding:0; border-spacing:0; border:none !important; }
7
- .lwa td { padding-top:7px; vertical-align:top; background-color:none; }
8
-
9
- /*Logged out CSS*/
10
- .lwa .lwa-username-label, .lwa .lwa-password-label { padding-right:10px; vertical-align:middle; }
11
- .lwa-password input, .lwa-username input, .lwa-email input, .lwa-remember-email input { margin:0px; width:96%; padding-left:2%; padding-right:2%; }
12
-
13
- .lwa-loading { position:absolute; width:100%; height:100%; background:#FFFFFF url(loading.gif) 50% 50% no-repeat; left:0px; top:0px; opacity:0.8; filter:alpha(opacity=80)}
14
-
15
- .lwa-status { margin:0px 0px 5px; padding:10px 10px; color:#333; border-radius:3px; display:none; }
16
- .lwa-status-invalid, .lwa-status-confirm { display:block !important; }
17
- .lwa-status-invalid { background-color:#FFEBE8; border:1px solid #C00; }
18
- .lwa-status-confirm { background-color:#f1fff0; border:1px solid #a8d144; }
19
-
20
- /*Logged In CSS*/
21
- .lwa-avatar { width:60px; padding-right:10px; }
22
- .lwa-info { text-transform:lowercase; }
23
-
24
- /*Forgotten password*/
25
- .lwa-remember { margin-top:10px; display:none; }
26
-
27
- /*Registration*/
28
- .lwa .lwa-register { margin-top:10px; display:none; }
29
-
30
- /*OpenID specific*/
31
- .lwa-register hr { display:block; }
32
- .lwa-register #openid_identifier { width:auto; }
33
-
34
- /* Modals CSS */
35
- .lwa-modal-bg { position: fixed; height: 100%; width: 100%; background: #000; background: rgba(0,0,0,.8); z-index: 100; display: none; top: 0; left: 0; }
36
- .lwa-modal { visibility: hidden; top: 100px; left: 50%; margin-left: -240px; width: 400px; background: #fefefe; position: absolute; z-index: 101; padding: 30px 40px 34px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; -moz-box-shadow: 0 0 10px rgba(0,0,0,.4); -webkit-box-shadow: 0 0 10px rgba(0,0,0,.4); -box-shadow: 0 0 10px rgba(0,0,0,.4); }
37
- .lwa-modal h4, .lwa-modal p { margin-bottom:10px; }
38
- .lwa-modal .lwa-modal-close { font-size: 30px; line-height: .5; position: absolute; top: 8px; right: 11px; color: #aaa; text-shadow: 0 -1px 1px rbga(0,0,0,.6); font-weight: bold; cursor: pointer; }
39
-
40
- /* divs-only */
41
- .lwa-divs-only p { margin:8px 0px 5px !important; }
42
- .lwa-divs-only input[type="text"] { margin:5px 0px 10px; }
43
- .lwa-divs-only .lwa-submit-button, .lwa-divs-only .lwa-links { margin-top:5px; }
44
- .lwa-divs-only .lwa-form .lwa-submit-button { float:right; }
45
- .lwa-divs-only .lwa-remember, .lwa-divs-only .lwa-register { clear:both; }
46
-
47
- /*Modal Template*/
48
- /*
49
- .lwa-template--modal .lwa-modal-box { background-color:#fff; color:#333; width:350px; padding:15px; text-align:left; border:2px solid #333; opacity:0.8; -moz-border-radius:6px; -webkit-border-radius:6px; -moz-box-shadow: 0 0 50px #ccc; -webkit-box-shadow: 0 0 50px #ccc; }
50
- .lwa-template--modal .lwa-modal-box h4 { font-size:16px; margin:0px; padding:0px; }
51
- .lwa-template--modal .lwa-modal-box .close { background:url(modal/close.png) 0px 0px no-repeat !important; position:absolute; right:-15px; top:-15px; cursor:pointer; height:35px; width:35px; border:none; padding:0px; margin:0px; }
52
- .lwa-template--modal .lwa-modal-box #wp-submit { display:block; clear:both; }
53
- */