nextend-facebook-connect
Last commit date
NSL
3 years ago
admin
3 years ago
includes
3 years ago
js
3 years ago
languages
3 years ago
providers
3 years ago
template-parts
3 years ago
class-settings.php
6 years ago
compat.php
6 years ago
index.html
13 years ago
licence.txt
6 years ago
nextend-facebook-connect.php
3 years ago
nextend-social-login.php
3 years ago
readme.txt
3 years ago
widget.php
6 years ago
widget.php
125 lines
| 1 | <?php |
| 2 | |
| 3 | class Nextend_Social_Login_Widget extends WP_Widget { |
| 4 | |
| 5 | public static function register() { |
| 6 | register_widget('Nextend_Social_Login_Widget'); |
| 7 | } |
| 8 | |
| 9 | public function __construct() { |
| 10 | parent::__construct('nextend_social_login', sprintf(__('%s Buttons', 'nextend-facebook-connect'), 'Nextend Social Login')); |
| 11 | } |
| 12 | |
| 13 | public function form($instance) { |
| 14 | $instance = wp_parse_args((array)$instance, array('title' => '')); |
| 15 | $title = $instance['title']; |
| 16 | |
| 17 | $style = isset($instance['style']) ? $instance['style'] : 'default'; |
| 18 | |
| 19 | $align = isset($instance['align']) ? $instance['align'] : 'left'; |
| 20 | |
| 21 | $loginButtons = isset($instance['login-buttons']) ? !!intval($instance['login-buttons']) : true; |
| 22 | |
| 23 | $linkButtons = isset($instance['link-buttons']) ? !!intval($instance['link-buttons']) : false; |
| 24 | |
| 25 | $unlinkButtons = isset($instance['unlink-buttons']) ? !!intval($instance['unlink-buttons']) : false; |
| 26 | |
| 27 | $isPRO = apply_filters('nsl-pro', false); |
| 28 | |
| 29 | ?> |
| 30 | <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> |
| 31 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
| 32 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
| 33 | value="<?php echo esc_attr($title); ?>"/></label></p> |
| 34 | |
| 35 | <?php if ($isPRO): ?> |
| 36 | |
| 37 | <p> |
| 38 | <label for="<?php echo $this->get_field_id('style'); ?>"><?php _e('Button style:', 'nextend-facebook-connect'); ?></label><br> |
| 39 | <input class="widefat" id="<?php echo $this->get_field_id('style_default'); ?>" |
| 40 | name="<?php echo $this->get_field_name('style'); ?>" type="radio" value="default" |
| 41 | <?php if ($style == 'default'): ?>checked<?php endif; ?>/> |
| 42 | <label for="<?php echo $this->get_field_id('style_default'); ?>"><?php _e('Default', 'nextend-facebook-connect'); ?></label> |
| 43 | <br> |
| 44 | <input class="widefat" id="<?php echo $this->get_field_id('style_icon'); ?>" |
| 45 | name="<?php echo $this->get_field_name('style'); ?>" type="radio" value="icon" |
| 46 | <?php if ($style == 'icon'): ?>checked<?php endif; ?>/> |
| 47 | <label for="<?php echo $this->get_field_id('style_icon'); ?>"><?php _e('Icon', 'nextend-facebook-connect'); ?></label> |
| 48 | <br> |
| 49 | </p> |
| 50 | <?php endif; ?> |
| 51 | |
| 52 | <p> |
| 53 | <label for="<?php echo $this->get_field_id('align'); ?>"><?php _e('Button align:', 'nextend-facebook-connect'); ?></label><br> |
| 54 | <input class="widefat" id="<?php echo $this->get_field_id('align_left'); ?>" |
| 55 | name="<?php echo $this->get_field_name('align'); ?>" type="radio" value="left" |
| 56 | <?php if ($align == 'left'): ?>checked<?php endif; ?>/> |
| 57 | <label for="<?php echo $this->get_field_id('align_left'); ?>"><?php _e('Left', 'nextend-facebook-connect'); ?></label> |
| 58 | <br> |
| 59 | <input class="widefat" id="<?php echo $this->get_field_id('align_center'); ?>" |
| 60 | name="<?php echo $this->get_field_name('align'); ?>" type="radio" value="center" |
| 61 | <?php if ($align == 'center'): ?>checked<?php endif; ?>/> |
| 62 | <label for="<?php echo $this->get_field_id('align_center'); ?>"><?php _e('Center', 'nextend-facebook-connect'); ?></label> |
| 63 | <br> |
| 64 | <input class="widefat" id="<?php echo $this->get_field_id('align_right'); ?>" |
| 65 | name="<?php echo $this->get_field_name('align'); ?>" type="radio" value="right" |
| 66 | <?php if ($align == 'right'): ?>checked<?php endif; ?>/> |
| 67 | <label for="<?php echo $this->get_field_id('align_right'); ?>"><?php _e('Right', 'nextend-facebook-connect'); ?></label> |
| 68 | <br> |
| 69 | </p> |
| 70 | |
| 71 | <p> |
| 72 | <input name="<?php echo $this->get_field_name('login-buttons'); ?>" type="hidden" value="0"/> |
| 73 | <input id="<?php echo $this->get_field_id('login-buttons'); ?>" |
| 74 | name="<?php echo $this->get_field_name('login-buttons'); ?>" type="checkbox" value="1" |
| 75 | <?php if ($loginButtons): ?>checked<?php endif; ?>/> |
| 76 | <label for="<?php echo $this->get_field_id('login-buttons'); ?>"><?php _e('Show login buttons', 'nextend-facebook-connect'); ?></label> |
| 77 | |
| 78 | </p> |
| 79 | |
| 80 | <p> |
| 81 | <input name="<?php echo $this->get_field_name('link-buttons'); ?>" type="hidden" value="0"/> |
| 82 | <input id="<?php echo $this->get_field_id('link-buttons'); ?>" |
| 83 | name="<?php echo $this->get_field_name('link-buttons'); ?>" type="checkbox" value="1" |
| 84 | <?php if ($linkButtons): ?>checked<?php endif; ?>/> |
| 85 | <label for="<?php echo $this->get_field_id('link-buttons'); ?>"><?php _e('Show link buttons', 'nextend-facebook-connect'); ?></label> |
| 86 | |
| 87 | </p> |
| 88 | |
| 89 | <p> |
| 90 | <input name="<?php echo $this->get_field_name('unlink-buttons'); ?>" type="hidden" value="0"/> |
| 91 | <input id="<?php echo $this->get_field_id('unlink-buttons'); ?>" |
| 92 | name="<?php echo $this->get_field_name('unlink-buttons'); ?>" type="checkbox" value="1" |
| 93 | <?php if ($unlinkButtons): ?>checked<?php endif; ?>/> |
| 94 | <label for="<?php echo $this->get_field_id('unlink-buttons'); ?>"><?php _e('Show unlink buttons', 'nextend-facebook-connect'); ?></label> |
| 95 | |
| 96 | </p> |
| 97 | <?php |
| 98 | } |
| 99 | |
| 100 | public function widget($args, $instance) { |
| 101 | $title = !empty($instance['title']) ? $instance['title'] : ''; |
| 102 | |
| 103 | $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
| 104 | |
| 105 | $style = !empty($instance['style']) ? $instance['style'] : 'default'; |
| 106 | |
| 107 | $align = !empty($instance['align']) ? $instance['align'] : 'left'; |
| 108 | |
| 109 | $loginButtons = isset($instance['login-buttons']) ? intval($instance['login-buttons']) : 1; |
| 110 | $linkButtons = isset($instance['link-buttons']) ? intval($instance['link-buttons']) : 0; |
| 111 | $unlinkButtons = isset($instance['unlink-buttons']) ? intval($instance['unlink-buttons']) : 0; |
| 112 | |
| 113 | echo $args['before_widget']; |
| 114 | if ($title) { |
| 115 | echo $args['before_title'] . $title . $args['after_title']; |
| 116 | } |
| 117 | |
| 118 | echo do_shortcode('[nextend_social_login style="' . $style . '" login="' . $loginButtons . '" link="' . $linkButtons . '" unlink="' . $unlinkButtons . '" align="' . $align . '"]'); |
| 119 | |
| 120 | echo $args['after_widget']; |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | add_action('widgets_init', 'Nextend_Social_Login_Widget::register'); |
| 125 |