| Server IP : 213.186.33.4 / Your IP : 216.73.216.146 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/plugins/glaza-core/widgets/ |
Upload File : |
<?php
if ( ! class_exists( 'glaza_widget_facebook' ) ) :
class glaza_widget_facebook extends WP_Widget {
function __construct() {
$widget_ops = array(
'classname' => 'widget-facebook',
'description' => esc_html__( '[Sidebar Widget] Display Facebook Like box in the sidebar.', 'glaza-core' )
);
parent::__construct( 'glaza_widget_facebook', esc_html__( '[Sidebar] Facebook Like Box', 'glaza-core' ), $widget_ops );
}
function widget( $args, $instance ) {
echo $args['before_widget'];
$instance = wp_parse_args( $instance, array(
'title' => '',
'fanpage_name' => '',
) );
$instance['title'] = apply_filters( 'widget_title', $instance['title'] );
if ( ! empty( $instance['title'] ) ) {
echo $args['before_title'] . esc_html( $instance['title'] ) . $args['after_title'];
}
if ( $instance['fanpage_name'] ) : ?>
<div class="fb-container">
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3&appId=1385724821660962";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-page" data-href="https://facebook.com/<?php echo esc_attr( trim( $instance['fanpage_name'] ) ) ?>" data-hide-cover="false" data-show-facepile="true" data-show-posts="false"></div>
</div>
<?php endif;
echo $args['after_widget'];
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['fanpage_name'] = strip_tags( $new_instance['fanpage_name'] );
return $instance;
}
function form( $instance ) {
$defaults = array( 'title' => esc_html__( 'Find Us on Facebook', 'glaza-core' ), 'fanpage_name' => '' );
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><strong><?php esc_html_e('Title:', 'glaza-core'); ?></strong></label>
<input class="widefat" type="text" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($instance['title']); ?>"/>
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('fanpage_name')); ?>"><strong><?php esc_html_e('Fanpage Name (without https):', 'glaza-core') ?></strong></label>
<input class="widefat" type="text" id="<?php echo esc_attr($this->get_field_id('fanpage_name')); ?>" name="<?php echo esc_attr($this->get_field_name('fanpage_name')); ?>" value="<?php echo esc_html($instance['fanpage_name']); ?>"/>
</p>
<?php
}
}
endif;