Login With Ajax - Version 3.0

Version Description

  • Option to choose from various widget templates.
Download this release

Release Info

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

Code changes from version 3.0b3 to 3.0

login-with-ajax-admin.php CHANGED
@@ -133,7 +133,7 @@ class LoginWithAjaxAdmin{
133
  <h3><?php _e("General Settings", 'login-with-ajax'); ?></h3>
134
  </td>
135
  </tr>
136
- <!-- Still undergoing some thought for 3.0 release.... uncomment if you need it already, but be warned things may change
137
  <tr valign="top">
138
  <td scope="row">
139
  <label><?php _e("Default Template", 'login-with-ajax'); ?></label>
@@ -149,7 +149,7 @@ class LoginWithAjaxAdmin{
149
  <i><?php _e("Further documentation for this feature coming soon...", 'login-with-ajax'); ?></i>
150
  </td>
151
  </tr>
152
- -->
153
  <tr valign="top">
154
  <td scope="row">
155
  <label><?php _e("Disable refresh upon login?", 'login-with-ajax'); ?></label>
133
  <h3><?php _e("General Settings", 'login-with-ajax'); ?></h3>
134
  </td>
135
  </tr>
136
+ <?php if( count($LoginWithAjax->templates) > 1 ) : ?>
137
  <tr valign="top">
138
  <td scope="row">
139
  <label><?php _e("Default Template", 'login-with-ajax'); ?></label>
149
  <i><?php _e("Further documentation for this feature coming soon...", 'login-with-ajax'); ?></i>
150
  </td>
151
  </tr>
152
+ <?php endif; ?>
153
  <tr valign="top">
154
  <td scope="row">
155
  <label><?php _e("Disable refresh upon login?", 'login-with-ajax'); ?></label>
login-with-ajax-widget.php CHANGED
@@ -30,10 +30,10 @@ class LoginWithAjaxWidget extends WP_Widget {
30
  </p>
31
  <p>
32
  <label for="<?php echo $this->get_field_id('registration'); ?>"><?php _e('AJAX Registration?', 'login-with-ajax'); ?> </label>
33
- <input id="<?php echo $this->get_field_id('profile_link'); ?>" name="<?php echo $this->get_field_name('registration'); ?>" type="checkbox" value="1" <?php echo ($instance['registration']) ? 'checked="checked"':""; ?> />
34
  </p>
35
- <!-- Still undergoing some thought for 3.0 release.... uncomment if you need it already, but be warned things may change
36
- <p>
37
  <label for="<?php echo $this->get_field_id('template'); ?>"><?php _e('Template', 'login-with-ajax'); ?> </label>
38
  <select id="<?php echo $this->get_field_id('template'); ?>" name="<?php echo $this->get_field_name('template'); ?>" >
39
  <?php foreach( array_keys($LoginWithAjax->templates) as $template ): ?>
@@ -41,7 +41,7 @@ class LoginWithAjaxWidget extends WP_Widget {
41
  <?php endforeach; ?>
42
  </select>
43
  </p>
44
- -->
45
  <?php
46
  }
47
 
30
  </p>
31
  <p>
32
  <label for="<?php echo $this->get_field_id('registration'); ?>"><?php _e('AJAX Registration?', 'login-with-ajax'); ?> </label>
33
+ <input id="<?php echo $this->get_field_id('registration'); ?>" name="<?php echo $this->get_field_name('registration'); ?>" type="checkbox" value="1" <?php echo ($instance['registration']) ? 'checked="checked"':""; ?> />
34
  </p>
35
+ <?php if( count($LoginWithAjax->templates) > 1 ): ?>
36
+ <p>
37
  <label for="<?php echo $this->get_field_id('template'); ?>"><?php _e('Template', 'login-with-ajax'); ?> </label>
38
  <select id="<?php echo $this->get_field_id('template'); ?>" name="<?php echo $this->get_field_name('template'); ?>" >
39
  <?php foreach( array_keys($LoginWithAjax->templates) as $template ): ?>
41
  <?php endforeach; ?>
42
  </select>
43
  </p>
44
+ <?php endif; ?>
45
  <?php
46
  }
47
 
login-with-ajax.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Login With Ajax
4
  Plugin URI: http://netweblogic.com/wordpress/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: NetWebLogic
7
- Version: 3.0b3
8
  Author URI: http://netweblogic.com/
9
  Tags: Login, Ajax, Redirect, BuddyPress, MU, WPMU, sidebar, admin, widget
10
 
@@ -94,8 +94,8 @@ class LoginWithAjax {
94
 
95
  //Generate URLs for login, remember, and register
96
  $this->url_login = $this->template_link(site_url('wp-login.php', 'login_post'));
97
- $this->url_register = $this->template_link(site_url('wp-login.php?action=lostpassword', 'login_post'));
98
- $this->url_remember = $this->template_link(site_url('wp-login.php?action=register', 'login_post'));
99
 
100
  //Make decision on what to display
101
  if ( isset($_REQUEST["login-with-ajax"]) ) { //AJAX Request
@@ -117,9 +117,9 @@ class LoginWithAjax {
117
  }else{ //Default file in plugin folder
118
  wp_enqueue_script( "login-with-ajax", $plugin_url."/widget/login-with-ajax.js", array( 'jquery' ) );
119
  }
120
- wp_enqueue_script( "login-with-ajax-jquerytools", "http://cdn.jquerytools.org/1.2.2/all/jquery.tools.min.js", array( 'jquery' ) );
121
 
122
  //Enqueue stylesheets - Only one style enqueued here.... theme CSS takes priority, then default CSS
 
123
  if( file_exists(get_stylesheet_directory().'/plugins/login-with-ajax/widget.css') ){ //Child Theme (or just theme)
124
  wp_enqueue_style( "login-with-ajax", get_stylesheet_directory_uri().'/plugins/login-with-ajax/widget.css' );
125
  }else if( file_exists(get_template_directory().'/plugins/login-with-ajax/widget.css') ){ //Parent Theme (if parent exists)
@@ -318,7 +318,6 @@ class LoginWithAjax {
318
 
319
  function widget($args, $instance = array() ){
320
  //Extract widget arguments
321
- global $lwa_data;
322
  extract($args);
323
  //Merge instance options with global default options
324
  $lwa_data = $this->data;
@@ -335,39 +334,12 @@ class LoginWithAjax {
335
  //Then check for custom templates or theme template default
336
  $template_loc = ($template_loc == '' && $this->template) ? $this->templates[$this->template].'/widget_in.php':$template_loc;
337
  include ( $template_loc != '' ) ? $template_loc : 'widget/default/widget_in.php';
338
- //Footer
339
- $footer_loc = locate_template( array('plugins/login-with-ajax/footer_in.php') ); //Legacy Template Override
340
- $footer_loc = ($footer_loc == '' && $this->template) ? $this->templates[$this->template].'/footer_in.php' : $footer_loc;
341
- $footer_loc = ( $footer_loc != '' ) ? $footer_loc : 'widget/default/footer_in.php';
342
- if( file_exists($footer_loc) ){
343
- add_action('wp_footer', array(&$this, 'footer'));
344
- }
345
  }else{
346
  //Firstly check for template in theme with no template folder (legacy)
347
  $template_loc = locate_template( array('plugins/login-with-ajax/widget_out.php') );
348
  //First check for custom templates or theme template default
349
  $template_loc = ($template_loc == '' && $this->template) ? $this->templates[$this->template].'/widget_out.php' : $template_loc;
350
  include ( $template_loc != '' ) ? $template_loc : 'widget/default/widget_out.php';
351
- //Footer
352
- $footer_loc = locate_template( array('plugins/login-with-ajax/footer_out.php'));
353
- $footer_loc = ( $footer_loc == '' && $this->template) ? $this->templates[$this->template].'/footer_out.php' : $footer_loc;
354
- $footer_loc = ( $footer_loc != '' ) ? $footer_loc : 'widget/default/footer_out.php';
355
- }
356
- //Footer
357
- add_action('wp_footer', array(&$this, 'footer'));
358
- }
359
-
360
- function footer( $footer_loc ){
361
- //Choose the widget content to display.
362
- if(is_user_logged_in()){
363
- $footer_loc = ($this->template) ? $this->templates[$this->template].'/footer_in.php' : locate_template( array('plugins/login-with-ajax/footer_in.php'));
364
- $footer_loc = ( $footer_loc != '' ) ? $footer_loc : 'widget/default/footer_in.php';
365
- }else{
366
- $footer_loc = ($this->template) ? $this->templates[$this->template].'/footer_out.php' : locate_template( array('plugins/login-with-ajax/footer_out.php'));
367
- $footer_loc = ( $footer_loc != '' ) ? $footer_loc : 'widget/default/footer_out.php';
368
- }
369
- if( file_exists($footer_loc) ){
370
- include($footer_loc);
371
  }
372
  }
373
 
@@ -403,7 +375,7 @@ class LoginWithAjax {
403
  if (is_dir($dir)) {
404
  if ($dh = opendir($dir)) {
405
  while (($file = readdir($dh)) !== false) {
406
- if(is_dir($dir . $file) && $file != '.' && $file != '..'){
407
  //Template dir found, add it to the template array
408
  $this->templates[$file] = path_join($dir, $file);
409
  }
@@ -454,7 +426,7 @@ class LoginWithAjax {
454
  $key = "'".addslashes($key)."'";
455
  // Format the value:
456
  if( is_array( $value )){
457
- $value = array_to_json( $value );
458
  }else if( is_bool($value) ) {
459
  $value = ($value) ? "true" : "false";
460
  }else if( !is_numeric( $value ) || is_string( $value ) ){
@@ -470,7 +442,7 @@ class LoginWithAjax {
470
  foreach( $array as $value ){
471
  // Format the value:
472
  if( is_array( $value )){
473
- $value = array_to_json( $value );
474
  } else if( !is_numeric( $value ) || is_string( $value ) ){
475
  $value = "'".addslashes($value)."'";
476
  }
4
  Plugin URI: http://netweblogic.com/wordpress/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: NetWebLogic
7
+ Version: 3.0
8
  Author URI: http://netweblogic.com/
9
  Tags: Login, Ajax, Redirect, BuddyPress, MU, WPMU, sidebar, admin, widget
10
 
94
 
95
  //Generate URLs for login, remember, and register
96
  $this->url_login = $this->template_link(site_url('wp-login.php', 'login_post'));
97
+ $this->url_register = $this->template_link(site_url('wp-login.php?action=register', 'login_post'));
98
+ $this->url_remember = $this->template_link(site_url('wp-login.php?action=lostpassword', 'login_post'));
99
 
100
  //Make decision on what to display
101
  if ( isset($_REQUEST["login-with-ajax"]) ) { //AJAX Request
117
  }else{ //Default file in plugin folder
118
  wp_enqueue_script( "login-with-ajax", $plugin_url."/widget/login-with-ajax.js", array( 'jquery' ) );
119
  }
 
120
 
121
  //Enqueue stylesheets - Only one style enqueued here.... theme CSS takes priority, then default CSS
122
+ //The concept here is one stylesheet is loaded which will work for multiple templates.
123
  if( file_exists(get_stylesheet_directory().'/plugins/login-with-ajax/widget.css') ){ //Child Theme (or just theme)
124
  wp_enqueue_style( "login-with-ajax", get_stylesheet_directory_uri().'/plugins/login-with-ajax/widget.css' );
125
  }else if( file_exists(get_template_directory().'/plugins/login-with-ajax/widget.css') ){ //Parent Theme (if parent exists)
318
 
319
  function widget($args, $instance = array() ){
320
  //Extract widget arguments
 
321
  extract($args);
322
  //Merge instance options with global default options
323
  $lwa_data = $this->data;
334
  //Then check for custom templates or theme template default
335
  $template_loc = ($template_loc == '' && $this->template) ? $this->templates[$this->template].'/widget_in.php':$template_loc;
336
  include ( $template_loc != '' ) ? $template_loc : 'widget/default/widget_in.php';
 
 
 
 
 
 
 
337
  }else{
338
  //Firstly check for template in theme with no template folder (legacy)
339
  $template_loc = locate_template( array('plugins/login-with-ajax/widget_out.php') );
340
  //First check for custom templates or theme template default
341
  $template_loc = ($template_loc == '' && $this->template) ? $this->templates[$this->template].'/widget_out.php' : $template_loc;
342
  include ( $template_loc != '' ) ? $template_loc : 'widget/default/widget_out.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  }
344
  }
345
 
375
  if (is_dir($dir)) {
376
  if ($dh = opendir($dir)) {
377
  while (($file = readdir($dh)) !== false) {
378
+ if(is_dir($dir . $file) && $file != '.' && $file != '..' && $file != '.svn'){
379
  //Template dir found, add it to the template array
380
  $this->templates[$file] = path_join($dir, $file);
381
  }
426
  $key = "'".addslashes($key)."'";
427
  // Format the value:
428
  if( is_array( $value )){
429
+ $value = $this->array_to_json( $value );
430
  }else if( is_bool($value) ) {
431
  $value = ($value) ? "true" : "false";
432
  }else if( !is_numeric( $value ) || is_string( $value ) ){
442
  foreach( $array as $value ){
443
  // Format the value:
444
  if( is_array( $value )){
445
+ $value = $this->array_to_json( $value );
446
  } else if( !is_numeric( $value ) || is_string( $value ) ){
447
  $value = "'".addslashes($value)."'";
448
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://netweblogic.com/wordpress/plugins/login-with-ajax/
4
  Tags: Login, Ajax, Redirect, BuddyPress, MU, WPMU, sidebar, admin, widget
5
  Requires at least: 2.8
6
  Tested up to: 3.0.1
7
- Stable tag: 3.0b3
8
 
9
  Add smooth ajax login and registration effects to your blog and choose where users get redirected upon login/logout. Supports SSL, MU, and BuddyPress.
10
 
@@ -63,25 +63,38 @@ Here's a list of currently translated languages. Translations that have been sub
63
 
64
  == Notes ==
65
 
66
- =Note that registrations will not work on wordpress due to the customizations they make on the registration process, we will try to come up with a solution for this asap=
67
 
68
  You can use the shortcode [login-with-ajax] or [lwa] and template tag login_with_ajax() with these options :
69
 
70
  * is_widget='true'|'false' - By default it's set to false, if true it uses the $before_widget/$after_widget variables.
71
  * profile_link='true'|'false' - By default it's set to false, if true, a profile link to wp-admin appears.
72
 
73
- When creating customized themes for your widget, there are a few points to consider:
74
 
75
- * Start by copying the contents /yourpluginpath/login-with-ajax/widget/ to /yourthemepath/plugins/login-with-ajax/
76
- * If you have a child theme, you can place the customizations in the child or parent folder (you should probably want to put it in the child folder).
77
- * If you want to customize the login-with-ajax.js javascript, you can also copy that into the same folder above (/yourthemepath/plugins/login-with-ajax/).
78
- * Unless you change the javascript, make sure you wrap your widget with an element with id="login-with-ajax" or "LoginWithAjax". If you use the $before_widget ... variables, this should be done automatically depending on your theme. I recommend you just wrap a div with id="LoginWithAjax" for fuller compatability across themes.
79
- * To force SSL, see [http://codex.wordpress.org/Administration_Over_SSL]("this page"). The plugin will automatically detect the wordpress settings.
80
 
81
- = Important information if upgrading from 1.2 and you have a customized ajax login widget =
 
82
 
83
- If you customized the widget, two small changes were made to the default login and logout templates which you should copy over if you'd like the remember password feature to work. The change requires that you add the ID attribute "LoginWithAjax_Links_Remember" to the remember password link. Also, you need to copy the new element and contents of the <form> below the first one with the ID "LoginWithAjax_Remember" and ensure you don't have another element with that ID in your template. Sorry, first and last time that will happen :)
 
 
 
 
 
 
 
84
 
 
 
 
 
 
 
 
 
 
85
 
86
  == Screenshots ==
87
 
@@ -159,5 +172,5 @@ For further questions and answers (or to submit one yourself) go to our [http://
159
  * Added fix to stop wp_new_user_notification conflicts
160
  * Empty logins now have an error message too.
161
 
162
- = 3.0 (coming soon) =
163
  * Option to choose from various widget templates.
4
  Tags: Login, Ajax, Redirect, BuddyPress, MU, WPMU, sidebar, admin, widget
5
  Requires at least: 2.8
6
  Tested up to: 3.0.1
7
+ Stable tag: 3.0
8
 
9
  Add smooth ajax login and registration effects to your blog and choose where users get redirected upon login/logout. Supports SSL, MU, and BuddyPress.
10
 
63
 
64
  == Notes ==
65
 
66
+ = Shortcodes & Template Tags =
67
 
68
  You can use the shortcode [login-with-ajax] or [lwa] and template tag login_with_ajax() with these options :
69
 
70
  * is_widget='true'|'false' - By default it's set to false, if true it uses the $before_widget/$after_widget variables.
71
  * profile_link='true'|'false' - By default it's set to false, if true, a profile link to wp-admin appears.
72
 
73
+ = SSL Logins =
74
 
75
+ To force SSL, see [http://codex.wordpress.org/Administration_Over_SSL]("this page"). The plugin will automatically detect the wordpress settings.
 
 
 
 
76
 
77
+ = Customizing the Widget =
78
+ You can customize the html widgets in an upgrade-safe manner. Firstly, you need to understand how Login With Ajax loads templates:
79
 
80
+ * When looking for files/templates there is an order of precedence - active child theme (if applicable), active parent themes, and finally the plugin folder
81
+ * Login With Ajax loads only one CSS and JS file. The plugin checks the locations above and loads the one it finds first.
82
+ ** login-with-ajax.js and login-with-ajax.css must be located in either wp-content/themes/yourtheme/plugins/login-with-ajax/ or wp-content/plugins/login-with-ajax/widget/
83
+ ** This was done to minimize the number of resources loaded, but means that if you have more than one template, you should add any extra CSS and JS to those single files.
84
+ * Login With Ajax then checks for template folders, if two folders match names (e.g. you move default template to your theme) the order of precedence explained above applies.
85
+ ** These theme folders are located within wp-content/themes/yourtheme/plugins/login-with-ajax/ or wp-content/plugins/login-with-ajax/widget/
86
+ * There is a zip file inside the widget folder with a few extra theme folders, they are not fully maintained each release, but should work.
87
+ * When a user is logged out, the widget_out.php will be shown, otherwise widget_in.php. These are located in the template folder.
88
 
89
+ For example, 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 then just edit the files as needed.
90
+
91
+ If you need to change the JS or CSS, copy the javascript file over to wp-content/themes/yourtheme/plugins/login-with-ajax/ (not within the template file) and edit accordingly.
92
+
93
+ The Javascript ajax magic relies on the id names within the template files, if you want to modify the templates, make sure you keep these id names.
94
+
95
+ = Registration Incompatibilities =
96
+
97
+ *Note that registrations will not work on buddypress due to the customizations they make on the registration process, we will try to come up with a solution for this asap*
98
 
99
  == Screenshots ==
100
 
172
  * Added fix to stop wp_new_user_notification conflicts
173
  * Empty logins now have an error message too.
174
 
175
+ = 3.0 =
176
  * Option to choose from various widget templates.
widget/{default/close.png → close.png} RENAMED
File without changes
widget/default/footer_out.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- /*
3
- * Taken from wp-login.php
4
- * If you place a register.php file in your lwa template folder, you'll have it inserted automatically at the footer
5
- * of your theme, providing it calls the wp_footer action.
6
- */
7
- ?>
8
- <div id="LoginWithAjax_Register" style="display:none;" class="default">
9
- <h4 class="message register"><?php _e('Register For This Site') ?></h4>
10
- <form name="registerform" id="registerform" action="<?php echo $this->url_remember ?>" method="post">
11
- <p>
12
- <label><?php _e('Username') ?><br />
13
- <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
14
- </p>
15
- <p>
16
- <label><?php _e('E-mail') ?><br />
17
- <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label>
18
- </p>
19
- <?php do_action('register_form'); ?>
20
- <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
21
- <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Register'); ?>" tabindex="100" /></p>
22
- <input type="hidden" name="lwa" value="1" />
23
- </form>
24
- </div>
25
- <script type="text/javascript">
26
- jQuery(document).ready(function($) {
27
- var triggers = $("#LoginWithAjax_Links_Register").overlay({
28
- mask: {
29
- color: '#ebecff',
30
- loadSpeed: 200,
31
- opacity: 0.9
32
- },
33
- closeOnClick: true
34
- });
35
- });
36
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
widget/default/register.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- /*
3
- * Taken from wp-login.php
4
- * If you place a register.php file in your lwa template folder, you'll have it inserted automatically at the footer
5
- * of your theme, providing it calls the wp_footer action.
6
- */
7
- ?>
8
- <div id="LoginWithAjax_Register" style="display:none;" class="default">
9
- <h4 class="message register"><?php _e('Register For This Site') ?></h4>
10
- <form name="registerform" id="registerform" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post">
11
- <p>
12
- <label><?php _e('Username') ?><br />
13
- <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
14
- </p>
15
- <p>
16
- <label><?php _e('E-mail') ?><br />
17
- <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label>
18
- </p>
19
- <?php do_action('register_form'); ?>
20
- <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
21
- <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Register'); ?>" tabindex="100" /></p>
22
- <input type="hidden" name="lwa" value="1" />
23
- </form>
24
- </div>
25
- <script type="text/javascript">
26
- jQuery(document).ready(function($) {
27
- var triggers = $("#LoginWithAjax_Links_Register").overlay({
28
- mask: {
29
- color: '#ebecff',
30
- loadSpeed: 200,
31
- opacity: 0.9
32
- },
33
- closeOnClick: true
34
- });
35
- });
36
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
widget/default/widget_out.php CHANGED
@@ -43,7 +43,7 @@
43
  <a id="LoginWithAjax_Links_Remember" href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
44
  <?php
45
  //Signup Links
46
- if ( get_option('users_can_register') ) {
47
  echo "<br />";
48
  if ( function_exists('bp_get_signup_page') ) { //Buddypress
49
  $register_link = bp_get_signup_page();
@@ -84,6 +84,43 @@
84
  </table>
85
  </form>
86
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  <?php
88
  if( $is_widget ){
89
  echo $after_widget;
43
  <a id="LoginWithAjax_Links_Remember" href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
44
  <?php
45
  //Signup Links
46
+ if ( get_option('users_can_register') && $lwa_data['registration'] == '1' ) {
47
  echo "<br />";
48
  if ( function_exists('bp_get_signup_page') ) { //Buddypress
49
  $register_link = bp_get_signup_page();
84
  </table>
85
  </form>
86
  </div>
87
+ <?php
88
+ //FOOTER - once the page loads, this will be moved automatically to the bottom of the document.
89
+ ?>
90
+ <?php if( get_option('users_can_register') && $lwa_data['registration'] == '1' ): ?>
91
+ <div id="LoginWithAjax_Footer">
92
+ <div id="LoginWithAjax_Register" style="display:none;" class="default">
93
+ <h4 class="message register"><?php _e('Register For This Site') ?></h4>
94
+ <form name="registerform" id="registerform" action="<?php echo $this->url_register ?>" method="post">
95
+ <p>
96
+ <label><?php _e('Username') ?><br />
97
+ <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
98
+ </p>
99
+ <p>
100
+ <label><?php _e('E-mail') ?><br />
101
+ <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label>
102
+ </p>
103
+ <?php do_action('register_form'); ?>
104
+ <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
105
+ <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Register'); ?>" tabindex="100" /></p>
106
+ <input type="hidden" name="lwa" value="1" />
107
+ </form>
108
+ </div>
109
+ </div>
110
+ <script type="text/javascript">
111
+ jQuery(document).ready(function($) {
112
+ $('body').append('#LoginWithAjax_Footer');
113
+ var triggers = $("#LoginWithAjax_Links_Register").overlay({
114
+ mask: {
115
+ color: '#ebecff',
116
+ loadSpeed: 200,
117
+ opacity: 0.9
118
+ },
119
+ closeOnClick: true
120
+ });
121
+ });
122
+ </script>
123
+ <?php endif; ?>
124
  <?php
125
  if( $is_widget ){
126
  echo $after_widget;
widget/extra-widgets.zip ADDED
Binary file
widget/login-with-ajax.js CHANGED
@@ -1,3 +1,16 @@
1
  jQuery(document).ready(function($){$('#LoginWithAjax_Form').submit(function(event){event.preventDefault();$('<div class="LoginWithAjax_Loading" id="LoginWithAjax_Loading"></div>').prependTo('#LoginWithAjax');var url=$('#LoginWithAjax_Form').attr('action');var postData=getPostData('#LoginWithAjax_Form *[name]');postData['login-with-ajax']='login';$.post(url,postData,function(data){lwaAjax(data,'LoginWithAjax_Status','#login-with-ajax');if(data.result===true){if(data.widget!=null){$.get(data.widget,function(widget_result){$('#LoginWithAjax').replaceWith(widget_result);$('#LoginWithAjax_Title').replaceWith($('#LoginWithAjax_Title_Substitute').text());});}else{if(data.redirect==null){window.location.reload();}else{window.location=data.redirect;}}}},"json");});$('#LoginWithAjax_Remember').submit(function(event){event.preventDefault();$('<div class="LoginWithAjax_Loading" id="LoginWithAjax_Loading"></div>').prependTo('#LoginWithAjax');var url=$('#LoginWithAjax_Remember').attr('action');var postData=getPostData('#LoginWithAjax_Remember *[name]');$.post(url,postData,function(data){lwaAjax(data,'LoginWithAjax_Status','#login-with-ajax');},"json");});$('#LoginWithAjax_Register form').submit(function(event){event.preventDefault();$('<div class="LoginWithAjax_Loading" id="LoginWithAjax_Loading"></div>').prependTo('#LoginWithAjax_Register');var url=$('#LoginWithAjax_Register form').attr('action');var postData=getPostData('#LoginWithAjax_Register form *[name]');$.post(url,postData,function(data){lwaAjax(data,'LoginWithAjax_Register_Status','#LoginWithAjax_Register');},"json");});$('#LoginWithAjax_Remember').hide();$('#LoginWithAjax_Links_Remember').click(function(event){event.preventDefault();$('#LoginWithAjax_Remember').show('slow');});$('#LoginWithAjax_Links_Remember_Cancel').click(function(event){event.preventDefault();$('#LoginWithAjax_Remember').hide('slow');});function lwaAjax(data,statusElement,prependTo){$('#LoginWithAjax_Loading').remove();if(data.result===true||data.result===false){if(data.result===true){if($('#'+statusElement).length>0){$('#'+statusElement).attr('class','confirm').html(data.message);}else{$('<span id="'+statusElement+'" class="confirm">'+data.message+'</span>').prependTo(prependTo);}}else{if($('#'+statusElement).length>0){$('#'+statusElement).attr('class','invalid').html(data.error);}else{$('<span id="'+statusElement+'" class="invalid">'+data.error+'</span>').prependTo(prependTo);}
2
  $('#'+statusElement).click(function(event){event.preventDefault();$('#LoginWithAjax_Remember').show('slow');});}}else{if($('#'+statusElement).length>0){$('#'+statusElement).attr('class','invalid').html('An error has occured. Please try again.');}else{$('<span id="'+statusElement+'" class="invalid">An error has occured. Please try again.</span>').prependTo(prependTo);}}}
3
- function getPostData(selector){var postData={};$.each($(selector),function(index,el){el=$(el);postData[el.attr('name')]=el.attr('value');});return postData}});
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  jQuery(document).ready(function($){$('#LoginWithAjax_Form').submit(function(event){event.preventDefault();$('<div class="LoginWithAjax_Loading" id="LoginWithAjax_Loading"></div>').prependTo('#LoginWithAjax');var url=$('#LoginWithAjax_Form').attr('action');var postData=getPostData('#LoginWithAjax_Form *[name]');postData['login-with-ajax']='login';$.post(url,postData,function(data){lwaAjax(data,'LoginWithAjax_Status','#login-with-ajax');if(data.result===true){if(data.widget!=null){$.get(data.widget,function(widget_result){$('#LoginWithAjax').replaceWith(widget_result);$('#LoginWithAjax_Title').replaceWith($('#LoginWithAjax_Title_Substitute').text());});}else{if(data.redirect==null){window.location.reload();}else{window.location=data.redirect;}}}},"json");});$('#LoginWithAjax_Remember').submit(function(event){event.preventDefault();$('<div class="LoginWithAjax_Loading" id="LoginWithAjax_Loading"></div>').prependTo('#LoginWithAjax');var url=$('#LoginWithAjax_Remember').attr('action');var postData=getPostData('#LoginWithAjax_Remember *[name]');$.post(url,postData,function(data){lwaAjax(data,'LoginWithAjax_Status','#login-with-ajax');},"json");});$('#LoginWithAjax_Register form').submit(function(event){event.preventDefault();$('<div class="LoginWithAjax_Loading" id="LoginWithAjax_Loading"></div>').prependTo('#LoginWithAjax_Register');var url=$('#LoginWithAjax_Register form').attr('action');var postData=getPostData('#LoginWithAjax_Register form *[name]');$.post(url,postData,function(data){lwaAjax(data,'LoginWithAjax_Register_Status','#LoginWithAjax_Register');},"json");});$('#LoginWithAjax_Remember').hide();$('#LoginWithAjax_Links_Remember').click(function(event){event.preventDefault();$('#LoginWithAjax_Remember').show('slow');});$('#LoginWithAjax_Links_Remember_Cancel').click(function(event){event.preventDefault();$('#LoginWithAjax_Remember').hide('slow');});function lwaAjax(data,statusElement,prependTo){$('#LoginWithAjax_Loading').remove();if(data.result===true||data.result===false){if(data.result===true){if($('#'+statusElement).length>0){$('#'+statusElement).attr('class','confirm').html(data.message);}else{$('<span id="'+statusElement+'" class="confirm">'+data.message+'</span>').prependTo(prependTo);}}else{if($('#'+statusElement).length>0){$('#'+statusElement).attr('class','invalid').html(data.error);}else{$('<span id="'+statusElement+'" class="invalid">'+data.error+'</span>').prependTo(prependTo);}
2
  $('#'+statusElement).click(function(event){event.preventDefault();$('#LoginWithAjax_Remember').show('slow');});}}else{if($('#'+statusElement).length>0){$('#'+statusElement).attr('class','invalid').html('An error has occured. Please try again.');}else{$('<span id="'+statusElement+'" class="invalid">An error has occured. Please try again.</span>').prependTo(prependTo);}}}
3
+ function getPostData(selector){var postData={};$.each($(selector),function(index,el){el=$(el);postData[el.attr('name')]=el.attr('value');});return postData}});
4
+
5
+ /* Do not edit after here*/
6
+ /* jQuery Tools 1.2.5 Overlay & Expose */
7
+ (function(a){function t(d,b){var c=this,j=d.add(c),o=a(window),k,f,m,g=a.tools.expose&&(b.mask||b.expose),n=Math.random().toString().slice(10);if(g){if(typeof g=="string")g={color:g};g.closeOnClick=g.closeOnEsc=false}var p=b.target||d.attr("rel");f=p?a(p):d;if(!f.length)throw"Could not find Overlay: "+p;d&&d.index(f)==-1&&d.click(function(e){c.load(e);return e.preventDefault()});a.extend(c,{load:function(e){if(c.isOpened())return c;var h=q[b.effect];if(!h)throw'Overlay: cannot find effect : "'+b.effect+
8
+ '"';b.oneInstance&&a.each(s,function(){this.close(e)});e=e||a.Event();e.type="onBeforeLoad";j.trigger(e);if(e.isDefaultPrevented())return c;m=true;g&&a(f).expose(g);var i=b.top,r=b.left,u=f.outerWidth({margin:true}),v=f.outerHeight({margin:true});if(typeof i=="string")i=i=="center"?Math.max((o.height()-v)/2,0):parseInt(i,10)/100*o.height();if(r=="center")r=Math.max((o.width()-u)/2,0);h[0].call(c,{top:i,left:r},function(){if(m){e.type="onLoad";j.trigger(e)}});g&&b.closeOnClick&&a.mask.getMask().one("click",
9
+ c.close);b.closeOnClick&&a(document).bind("click."+n,function(l){a(l.target).parents(f).length||c.close(l)});b.closeOnEsc&&a(document).bind("keydown."+n,function(l){l.keyCode==27&&c.close(l)});return c},close:function(e){if(!c.isOpened())return c;e=e||a.Event();e.type="onBeforeClose";j.trigger(e);if(!e.isDefaultPrevented()){m=false;q[b.effect][1].call(c,function(){e.type="onClose";j.trigger(e)});a(document).unbind("click."+n).unbind("keydown."+n);g&&a.mask.close();return c}},getOverlay:function(){return f},
10
+ getTrigger:function(){return d},getClosers:function(){return k},isOpened:function(){return m},getConf:function(){return b}});a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(e,h){a.isFunction(b[h])&&a(c).bind(h,b[h]);c[h]=function(i){i&&a(c).bind(h,i);return c}});k=f.find(b.close||".close");if(!k.length&&!b.close){k=a('<a class="close"></a>');f.prepend(k)}k.click(function(e){c.close(e)});b.load&&c.load()}a.tools=a.tools||{version:"1.2.5"};a.tools.overlay={addEffect:function(d,
11
+ b,c){q[d]=[b,c]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var s=[],q={};a.tools.overlay.addEffect("default",function(d,b){var c=this.getConf(),j=a(window);if(!c.fixed){d.top+=j.scrollTop();d.left+=j.scrollLeft()}d.position=c.fixed?"fixed":"absolute";this.getOverlay().css(d).fadeIn(c.speed,b)},function(d){this.getOverlay().fadeOut(this.getConf().closeSpeed,
12
+ d)});a.fn.overlay=function(d){var b=this.data("overlay");if(b)return b;if(a.isFunction(d))d={onBeforeLoad:d};d=a.extend(true,{},a.tools.overlay.conf,d);this.each(function(){b=new t(a(this),d);s.push(b);a(this).data("overlay",b)});return d.api?b:this}})(jQuery);
13
+ (function(b){function k(){if(b.browser.msie){var a=b(document).height(),d=b(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a-d<20?d:a]}return[b(document).width(),b(document).height()]}function h(a){if(a)return a.call(b.mask)}b.tools=b.tools||{version:"1.2.5"};var l;l=b.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.8,startOpacity:0,color:"#fff",onLoad:null,
14
+ onClose:null}};var c,i,e,g,j;b.mask={load:function(a,d){if(e)return this;if(typeof a=="string")a={color:a};a=a||g;g=a=b.extend(b.extend({},l.conf),a);c=b("#"+a.maskId);if(!c.length){c=b("<div/>").attr("id",a.maskId);b("body").append(c)}var m=k();c.css({position:"absolute",top:0,left:0,width:m[0],height:m[1],display:"none",opacity:a.startOpacity,zIndex:a.zIndex});a.color&&c.css("backgroundColor",a.color);if(h(a.onBeforeLoad)===false)return this;a.closeOnEsc&&b(document).bind("keydown.mask",function(f){f.keyCode==
15
+ 27&&b.mask.close(f)});a.closeOnClick&&c.bind("click.mask",function(f){b.mask.close(f)});b(window).bind("resize.mask",function(){b.mask.fit()});if(d&&d.length){j=d.eq(0).css("zIndex");b.each(d,function(){var f=b(this);/relative|absolute|fixed/i.test(f.css("position"))||f.css("position","relative")});i=d.css({zIndex:Math.max(a.zIndex+1,j=="auto"?0:j)})}c.css({display:"block"}).fadeTo(a.loadSpeed,a.opacity,function(){b.mask.fit();h(a.onLoad);e="full"});e=true;return this},close:function(){if(e){if(h(g.onBeforeClose)===
16
+ false)return this;c.fadeOut(g.closeSpeed,function(){h(g.onClose);i&&i.css({zIndex:j});e=false});b(document).unbind("keydown.mask");c.unbind("click.mask");b(window).unbind("resize.mask")}return this},fit:function(){if(e){var a=k();c.css({width:a[0],height:a[1]})}},getMask:function(){return c},isLoaded:function(a){return a?e=="full":e},getConf:function(){return g},getExposed:function(){return i}};b.fn.mask=function(a){b.mask.load(a);return this};b.fn.expose=function(a){b.mask.load(a,this);return this}})(jQuery);
widget/login-with-ajax.source.js CHANGED
@@ -1,3 +1,4 @@
 
1
  jQuery(document).ready( function($) {
2
  //Oh well... I guess we have to use jQuery ... if you are a javascript developer, consider MooTools if you have a choice, it's great!
3
  $('#LoginWithAjax_Form').submit(function(event){
@@ -124,4 +125,17 @@ jQuery(document).ready( function($) {
124
  });
125
  return postData
126
  }
127
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Customize from here downwards */
2
  jQuery(document).ready( function($) {
3
  //Oh well... I guess we have to use jQuery ... if you are a javascript developer, consider MooTools if you have a choice, it's great!
4
  $('#LoginWithAjax_Form').submit(function(event){
125
  });
126
  return postData
127
  }
128
+ });
129
+
130
+ /* Do not edit after here*/
131
+ /* jQuery Tools 1.2.5 Overlay & Expose */
132
+ (function(a){function t(d,b){var c=this,j=d.add(c),o=a(window),k,f,m,g=a.tools.expose&&(b.mask||b.expose),n=Math.random().toString().slice(10);if(g){if(typeof g=="string")g={color:g};g.closeOnClick=g.closeOnEsc=false}var p=b.target||d.attr("rel");f=p?a(p):d;if(!f.length)throw"Could not find Overlay: "+p;d&&d.index(f)==-1&&d.click(function(e){c.load(e);return e.preventDefault()});a.extend(c,{load:function(e){if(c.isOpened())return c;var h=q[b.effect];if(!h)throw'Overlay: cannot find effect : "'+b.effect+
133
+ '"';b.oneInstance&&a.each(s,function(){this.close(e)});e=e||a.Event();e.type="onBeforeLoad";j.trigger(e);if(e.isDefaultPrevented())return c;m=true;g&&a(f).expose(g);var i=b.top,r=b.left,u=f.outerWidth({margin:true}),v=f.outerHeight({margin:true});if(typeof i=="string")i=i=="center"?Math.max((o.height()-v)/2,0):parseInt(i,10)/100*o.height();if(r=="center")r=Math.max((o.width()-u)/2,0);h[0].call(c,{top:i,left:r},function(){if(m){e.type="onLoad";j.trigger(e)}});g&&b.closeOnClick&&a.mask.getMask().one("click",
134
+ c.close);b.closeOnClick&&a(document).bind("click."+n,function(l){a(l.target).parents(f).length||c.close(l)});b.closeOnEsc&&a(document).bind("keydown."+n,function(l){l.keyCode==27&&c.close(l)});return c},close:function(e){if(!c.isOpened())return c;e=e||a.Event();e.type="onBeforeClose";j.trigger(e);if(!e.isDefaultPrevented()){m=false;q[b.effect][1].call(c,function(){e.type="onClose";j.trigger(e)});a(document).unbind("click."+n).unbind("keydown."+n);g&&a.mask.close();return c}},getOverlay:function(){return f},
135
+ getTrigger:function(){return d},getClosers:function(){return k},isOpened:function(){return m},getConf:function(){return b}});a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(e,h){a.isFunction(b[h])&&a(c).bind(h,b[h]);c[h]=function(i){i&&a(c).bind(h,i);return c}});k=f.find(b.close||".close");if(!k.length&&!b.close){k=a('<a class="close"></a>');f.prepend(k)}k.click(function(e){c.close(e)});b.load&&c.load()}a.tools=a.tools||{version:"1.2.5"};a.tools.overlay={addEffect:function(d,
136
+ b,c){q[d]=[b,c]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var s=[],q={};a.tools.overlay.addEffect("default",function(d,b){var c=this.getConf(),j=a(window);if(!c.fixed){d.top+=j.scrollTop();d.left+=j.scrollLeft()}d.position=c.fixed?"fixed":"absolute";this.getOverlay().css(d).fadeIn(c.speed,b)},function(d){this.getOverlay().fadeOut(this.getConf().closeSpeed,
137
+ d)});a.fn.overlay=function(d){var b=this.data("overlay");if(b)return b;if(a.isFunction(d))d={onBeforeLoad:d};d=a.extend(true,{},a.tools.overlay.conf,d);this.each(function(){b=new t(a(this),d);s.push(b);a(this).data("overlay",b)});return d.api?b:this}})(jQuery);
138
+ (function(b){function k(){if(b.browser.msie){var a=b(document).height(),d=b(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a-d<20?d:a]}return[b(document).width(),b(document).height()]}function h(a){if(a)return a.call(b.mask)}b.tools=b.tools||{version:"1.2.5"};var l;l=b.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.8,startOpacity:0,color:"#fff",onLoad:null,
139
+ onClose:null}};var c,i,e,g,j;b.mask={load:function(a,d){if(e)return this;if(typeof a=="string")a={color:a};a=a||g;g=a=b.extend(b.extend({},l.conf),a);c=b("#"+a.maskId);if(!c.length){c=b("<div/>").attr("id",a.maskId);b("body").append(c)}var m=k();c.css({position:"absolute",top:0,left:0,width:m[0],height:m[1],display:"none",opacity:a.startOpacity,zIndex:a.zIndex});a.color&&c.css("backgroundColor",a.color);if(h(a.onBeforeLoad)===false)return this;a.closeOnEsc&&b(document).bind("keydown.mask",function(f){f.keyCode==
140
+ 27&&b.mask.close(f)});a.closeOnClick&&c.bind("click.mask",function(f){b.mask.close(f)});b(window).bind("resize.mask",function(){b.mask.fit()});if(d&&d.length){j=d.eq(0).css("zIndex");b.each(d,function(){var f=b(this);/relative|absolute|fixed/i.test(f.css("position"))||f.css("position","relative")});i=d.css({zIndex:Math.max(a.zIndex+1,j=="auto"?0:j)})}c.css({display:"block"}).fadeTo(a.loadSpeed,a.opacity,function(){b.mask.fit();h(a.onLoad);e="full"});e=true;return this},close:function(){if(e){if(h(g.onBeforeClose)===
141
+ false)return this;c.fadeOut(g.closeSpeed,function(){h(g.onClose);i&&i.css({zIndex:j});e=false});b(document).unbind("keydown.mask");c.unbind("click.mask");b(window).unbind("resize.mask")}return this},fit:function(){if(e){var a=k();c.css({width:a[0],height:a[1]})}},getMask:function(){return c},isLoaded:function(a){return a?e=="full":e},getConf:function(){return g},getExposed:function(){return i}};b.fn.mask=function(a){b.mask.load(a);return this};b.fn.expose=function(a){b.mask.load(a,this);return this}})(jQuery);
widget/widget.css CHANGED
@@ -30,7 +30,7 @@
30
  /*Default Template*/
31
  #LoginWithAjax_Register.default { background-color:#fff; color:#333; display:none; 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; }
32
  #LoginWithAjax_Register.default h4 { font-size:16px; margin:0px; padding:0px; }
33
- #LoginWithAjax_Register.default .close { background:url(default/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; }
34
  #LoginWithAjax_Register.default #wp-submit { display:block; clear:both; }
35
 
36
  /*ie7-friendly*/
30
  /*Default Template*/
31
  #LoginWithAjax_Register.default { background-color:#fff; color:#333; display:none; 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; }
32
  #LoginWithAjax_Register.default h4 { font-size:16px; margin:0px; padding:0px; }
33
+ #LoginWithAjax_Register.default .close { background:url(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; }
34
  #LoginWithAjax_Register.default #wp-submit { display:block; clear:both; }
35
 
36
  /*ie7-friendly*/
widget/widgets.zip DELETED
Binary file