| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Welcart_login Class |
| 5 |
*/ |
| 6 |
class Welcart_login extends WP_Widget { |
| 7 |
/** constructor */ |
| 8 |
function Welcart_login() { |
| 9 |
parent::WP_Widget(false, $name = 'Welcart '.__('Log-in', 'usces')); |
| 10 |
} |
| 11 |
|
| 12 |
/** @see WP_Widget::widget */ |
| 13 |
function widget($args, $instance) { |
| 14 |
extract( $args ); |
| 15 |
$title = ( !isset($instance['title']) || WCUtils::is_blank($instance['title'])) ? 'Welcart '.__('Log-in', 'usces') : $instance['title']; |
| 16 |
$icon = ( !isset($instance['icon']) || WCUtils::is_blank($instance['icon'])) ? 1 : (int)$instance['icon']; |
| 17 |
//if($icon == 1) $before_title = '<div class="widget_title"><img src="' . USCES_PLUGIN_URL . '/images/find.png" alt="' . $title . '" width="24" height="24" />'; |
| 18 |
$img_path = file_exists(get_stylesheet_directory().'/images/login.png') ? get_stylesheet_directory_uri().'/images/login.png' : USCES_FRONT_PLUGIN_URL . '/images/login.png'; |
| 19 |
if($icon == 1) $before_title .= '<img src="' . $img_path . '" alt="' . $title . '" />'; |
| 20 |
?> |
| 21 |
<?php echo $before_widget; ?> |
| 22 |
<?php echo $before_title |
| 23 |
. esc_html($title) |
| 24 |
. $after_title; ?> |
| 25 |
|
| 26 |
<ul class="ucart_login_body ucart_widget_body"><li> |
| 27 |
|
| 28 |
<?php ob_start(); ?> |
| 29 |
|
| 30 |
<div class="loginbox"> |
| 31 |
<?php if ( ! usces_is_login() ) { ?> |
| 32 |
<form name="loginwidget" id="loginformw" action="<?php echo USCES_MEMBER_URL; ?>" method="post"> |
| 33 |
<p> |
| 34 |
<label><?php _e('e-mail adress', 'usces'); ?><br /> |
| 35 |
<input type="text" name="loginmail" id="loginmailw" class="loginmail" value="<?php usces_remembername(); ?>" size="20" /></label><br /> |
| 36 |
<label><?php _e('password', 'usces'); ?><br /> |
| 37 |
<input type="password" name="loginpass" id="loginpassw" class="loginpass" size="20" /></label><br /> |
| 38 |
<label><input name="rememberme" type="checkbox" id="remembermew" value="forever" /> <?php _e('Remember Me', 'usces'); ?></label></p> |
| 39 |
<p class="submit"> |
| 40 |
<input type="submit" name="member_login" id="member_loginw" value="<?php _e('Log-in', 'usces'); ?>" /> |
| 41 |
</p> |
| 42 |
<?php echo apply_filters('usces_filter_login_inform', NULL); ?> |
| 43 |
</form> |
| 44 |
<a href="<?php echo USCES_LOSTMEMBERPASSWORD_URL; ?>" title="<?php _e('Pssword Lost and Found', 'usces'); ?>"><?php _e('Lost your password?', 'usces'); ?></a><br /> |
| 45 |
<a href="<?php echo USCES_NEWMEMBER_URL; ?>" title="<?php _e('New enrollment for membership.', 'usces'); ?>"><?php _e('New enrollment for membership.', 'usces'); ?></a> |
| 46 |
<?php }else{ ?> |
| 47 |
<div><?php echo sprintf(__('Mr/Mrs %s', 'usces'), usces_the_member_name('return')); ?></div> |
| 48 |
<?php echo usces_loginout(); ?><br /> |
| 49 |
<a href="<?php echo USCES_MEMBER_URL; ?>" class="login_widget_mem_info_a"><?php _e('Membership information','usces') ?></a> |
| 50 |
<?php } ?> |
| 51 |
</div> |
| 52 |
|
| 53 |
<?php |
| 54 |
$loginbox = ob_get_contents(); |
| 55 |
ob_end_clean(); |
| 56 |
echo apply_filters('usces_filter_login_widget', $loginbox, $args, $instance); |
| 57 |
?> |
| 58 |
|
| 59 |
</li></ul> |
| 60 |
|
| 61 |
<?php echo $after_widget; ?> |
| 62 |
<?php |
| 63 |
} |
| 64 |
|
| 65 |
/** @see WP_Widget::update */ |
| 66 |
function update($new_instance, $old_instance) { |
| 67 |
return $new_instance; |
| 68 |
} |
| 69 |
|
| 70 |
/** @see WP_Widget::form */ |
| 71 |
function form($instance) { |
| 72 |
$title = (!isset($instance['title']) || WCUtils::is_blank($instance['title']) ) ? 'Welcart '.__('Log-in', 'usces') : esc_attr($instance['title']); |
| 73 |
$icon = (!isset($instance['icon']) || WCUtils::is_blank($instance['icon']) ) ? 1 : (int)$instance['icon']; |
| 74 |
?> |
| 75 |
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p> |
| 76 |
<p><label for="<?php echo $this->get_field_id('icon'); ?>"><?php _e('display of icon', 'usces'); ?>: <select class="widefat" id="<?php echo $this->get_field_id('icon'); ?>" name="<?php echo $this->get_field_name('icon'); ?>"><option value="1"<?php if($icon == 1){echo ' selected="selected"';} ?>><?php _e('Indication', 'usces'); ?></option><option value="2"<?php if($icon == 2){echo ' selected="selected"';} ?>><?php _e('Non-indication', 'usces'); ?></option></select></label></p> |
| 77 |
<?php |
| 78 |
} |
| 79 |
|
| 80 |
} |
| 81 |
?> |