elementor
3 years ago
admin-create-shortcode.php
7 years ago
admin-create-user.php
3 years ago
admin-custom-function.php
3 years ago
admin-rest-api.php
4 years ago
admin-settings.php
3 years ago
admin-social-button.php
3 years ago
admin-social-enque-script.php
5 years ago
counter-widget.php
3 years ago
counter.php
3 years ago
custom-function.php
4 years ago
login-widget.php
3 years ago
login.php
5 years ago
share-widget.php
3 years ago
share.php
3 years ago
login-widget.php
94 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WP_Social\Inc; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | /** |
| 8 | * Class Name : xs_social_widget; |
| 9 | * Class Details : Create Widget for XS Social Login Plugin |
| 10 | * |
| 11 | * @params : void |
| 12 | * @return : void |
| 13 | * |
| 14 | * @since : 1.0 |
| 15 | */ |
| 16 | class Login_widget extends \WP_Widget { |
| 17 | |
| 18 | public function __construct() { |
| 19 | parent::__construct( |
| 20 | |
| 21 | 'Login_widget', |
| 22 | |
| 23 | __('WSLU Social Login', 'wp-social'), |
| 24 | |
| 25 | array( 'description' => __( 'Wp Social Login System for Facebook, Twitter, Linkedin, Dribble, Pinterest, Wordpress, Instagram, GitHub, Vkontakte and Reddit login from WordPress site.', 'wp-social' ), ) |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | public static function register(){ |
| 30 | register_widget('WP_Social\Inc\Login_widget'); |
| 31 | } |
| 32 | |
| 33 | public function widget( $args, $instance ) { |
| 34 | extract( $args ); |
| 35 | |
| 36 | $title = isset($instance['title']) ? $instance['title'] : ''; |
| 37 | $customclass = isset($instance['customclass']) ? $instance['customclass'] : ''; |
| 38 | $box_only = isset($instance['box_only']) ? $instance['box_only'] : false; |
| 39 | |
| 40 | /** |
| 41 | * this function get from xs_custom_function.php page |
| 42 | */ |
| 43 | |
| 44 | $config = []; |
| 45 | $config['class'] = $customclass; |
| 46 | |
| 47 | if( !$box_only ){ |
| 48 | echo wp_kses($before_widget . $before_title . $title . $after_title, \WP_Social\Helper\Helper::get_kses_array()); |
| 49 | } |
| 50 | |
| 51 | echo xs_social_login_shortcode_widget( array('all'), $config); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- It's already has been escaped from the /template/login/login-btn-html.php |
| 52 | |
| 53 | if( !$box_only ){ |
| 54 | echo esc_html($after_widget); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | public function form( $instance ) { |
| 59 | if ( isset( $instance[ 'title' ] ) ) { |
| 60 | $title = $instance[ 'title' ]; |
| 61 | } |
| 62 | else { |
| 63 | $title = __( 'Social Login', 'wp-social' ); |
| 64 | } |
| 65 | |
| 66 | $customclass = isset( $instance[ 'customclass' ] ) ? $instance[ 'customclass' ] : ''; |
| 67 | $box_only = isset( $instance[ 'box_only' ] ) ? $instance[ 'box_only' ] : ''; |
| 68 | ?> |
| 69 | <p> |
| 70 | <label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_html_e( 'Title:', 'wp-social' ); ?></label> |
| 71 | <input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'title')); ?>" name="<?php echo esc_attr($this->get_field_name( 'title')); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> |
| 72 | </p> |
| 73 | <p> |
| 74 | <label for="<?php echo esc_attr($this->get_field_id( 'box_only')); ?>"><?php esc_html_e( 'Show the Social Box only :' , 'wp-social' ) ?></label> |
| 75 | <input id="<?php echo esc_attr($this->get_field_id( 'box_only')); ?>" name="<?php echo esc_attr($this->get_field_name( 'box_only')); ?>" value="true" <?php if( $box_only ) echo esc_attr('checked="checked"'); ?> type="checkbox" /> |
| 76 | <br /><small><?php esc_html_e( 'Will show only counter block without title.' , 'wp-social' ) ?></small> |
| 77 | </p> |
| 78 | <p> |
| 79 | <label for="<?php echo esc_attr($this->get_field_id( 'customclass' )); ?>"><?php esc_html_e( 'Custom Class:', 'wp-social' ); ?></label> |
| 80 | <input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'customclass')); ?>" name="<?php echo esc_attr($this->get_field_name( 'customclass')); ?>" type="text" value="<?php echo esc_attr( $customclass ); ?>" /> |
| 81 | </p> |
| 82 | <?php |
| 83 | } |
| 84 | |
| 85 | public function update( $new_instance, $old_instance ) { |
| 86 | $instance = $old_instance; |
| 87 | $instance['title'] = $new_instance['title'] ; |
| 88 | $instance['box_only'] = isset($new_instance['box_only']) ? $new_instance['box_only'] : '' ; |
| 89 | $instance['customclass'] = $new_instance['customclass'] ; |
| 90 | return $instance; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 |