Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/facebook...
File: fb_class.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Facebook Widget Class
[2] Fix | Delete
*/
[3] Fix | Delete
class facebook_widget extends WP_Widget {
[4] Fix | Delete
/** constructor */
[5] Fix | Delete
function __construct() {
[6] Fix | Delete
[7] Fix | Delete
parent::__construct(
[8] Fix | Delete
'fbw_id', // Base ID
[9] Fix | Delete
'Facebook Page Like Widget', // Name
[10] Fix | Delete
array( 'description' => __( 'Facebook Page Like Widget' , 'facebook-pagelike-widget' ) )
[11] Fix | Delete
);
[12] Fix | Delete
[13] Fix | Delete
add_action( 'admin_enqueue_scripts', [ $this, 'load_custom_js' ] );
[14] Fix | Delete
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
function load_custom_js(){
[18] Fix | Delete
wp_enqueue_script( 'load-custom-js', plugin_dir_url(__FILE__) . 'admin/assets/js/custom.js' );
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
/** @see WP_Widget::widget */
[22] Fix | Delete
function widget( $args , $instance ) {
[23] Fix | Delete
[24] Fix | Delete
global $select_lng;
[25] Fix | Delete
extract( $args );
[26] Fix | Delete
[27] Fix | Delete
$title = apply_filters( 'widget_title' , $instance['title'] );
[28] Fix | Delete
$fb_url = $instance['fb_url'];
[29] Fix | Delete
$width = $instance['width'];
[30] Fix | Delete
$height = $instance['height'];
[31] Fix | Delete
$data_small_header = isset( $instance['data_small_header'] ) && $instance['data_small_header'] != '' ? 'true' : 'false';
[32] Fix | Delete
$data_adapt_container_width = isset( $instance['data_adapt_container_width'] ) && $instance['data_adapt_container_width'] != '' ? 'true' : 'false';
[33] Fix | Delete
$data_hide_cover = isset( $instance['data_hide_cover']) && $instance['data_hide_cover'] != '' ? 'true' : 'false';
[34] Fix | Delete
$data_show_facepile = isset( $instance['data_show_facepile']) && $instance['data_show_facepile'] != '' ? 'true' : 'false';
[35] Fix | Delete
$select_lng = $instance['select_lng'];
[36] Fix | Delete
$data_tabs = 'timeline';
[37] Fix | Delete
$data_lazy = isset( $instance['data_lazy'] ) && $instance['data_lazy'] != '' ? 'true' : 'false';
[38] Fix | Delete
[39] Fix | Delete
if (array_key_exists('data_tabs', $instance) && $instance['data_tabs'] !== '') {
[40] Fix | Delete
$data_tabs = implode(",", $instance['data_tabs']);
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
echo $before_widget;
[44] Fix | Delete
if ( $title ) echo $before_title . $title . $after_title;
[45] Fix | Delete
[46] Fix | Delete
wp_register_script( 'scfbwidgetscript' , FB_WIDGET_PLUGIN_URL . 'fb.js', array( 'jquery' ), '1.0' );
[47] Fix | Delete
wp_enqueue_script( 'scfbwidgetscript' );
[48] Fix | Delete
[49] Fix | Delete
wp_register_script( 'scfbexternalscript', 'https://connect.facebook.net/'.$select_lng.'/sdk.js#xfbml=1&version=v18.0', "", '2.0', true );
[50] Fix | Delete
wp_enqueue_script( 'scfbexternalscript' );
[51] Fix | Delete
[52] Fix | Delete
echo '<div class="fb_loader" style="text-align: center !important;"><img src="' . plugins_url() . '/facebook-pagelike-widget/loader.gif" alt="Facebook Pagelike Widget" /></div>';
[53] Fix | Delete
echo '<div id="fb-root"></div>
[54] Fix | Delete
<div class="fb-page" data-href="' . $fb_url . '" data-width="' . $width . '" data-height="' . $height . '" data-small-header="' . $data_small_header . '" data-adapt-container-width="' . $data_adapt_container_width . '" data-hide-cover="' . $data_hide_cover . '" data-show-facepile="' . $data_show_facepile . '" hide_cta="false" data-tabs="'. $data_tabs .'" data-lazy="'.$data_lazy.'"></div>';
[55] Fix | Delete
echo $after_widget; ?>
[56] Fix | Delete
<!-- A WordPress plugin developed by Milap Patel -->
[57] Fix | Delete
<?php }
[58] Fix | Delete
[59] Fix | Delete
/** @see WP_Widget::update */
[60] Fix | Delete
function update( $new_instance, $old_instance ) {
[61] Fix | Delete
[62] Fix | Delete
$instance = $old_instance;
[63] Fix | Delete
$instance = array( 'data_small_header' => 'false', 'data_adapt_container_width' => 'true', 'data_hide_cover' => 'false', 'data_show_facepile' => 'false', 'data_tabs' => 'timeline' );
[64] Fix | Delete
[65] Fix | Delete
foreach ( $instance as $field => $val ) {
[66] Fix | Delete
if ( isset( $new_instance[$field] ) )
[67] Fix | Delete
$instance[$field] = 'true';
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
$instance['title'] = strip_tags( $new_instance['title'] );
[71] Fix | Delete
$instance['fb_url'] = strip_tags( $new_instance['fb_url'] );
[72] Fix | Delete
$instance['width'] = strip_tags( $new_instance['width'] );
[73] Fix | Delete
$instance['height'] = strip_tags( $new_instance['height'] );
[74] Fix | Delete
$instance['data_small_header'] = strip_tags( $new_instance['data_small_header'] );
[75] Fix | Delete
$instance['data_adapt_container_width'] = strip_tags( $new_instance['data_adapt_container_width'] );
[76] Fix | Delete
$instance['data_hide_cover'] = strip_tags( $new_instance['data_hide_cover'] );
[77] Fix | Delete
$instance['data_show_facepile'] = strip_tags( $new_instance['data_show_facepile'] );
[78] Fix | Delete
$instance['select_lng'] = strip_tags( $new_instance['select_lng'] );
[79] Fix | Delete
$instance['data_tabs'] = esc_sql( $new_instance['data_tabs'] );
[80] Fix | Delete
$instance['data_lazy'] = strip_tags( $new_instance['data_lazy'] );
[81] Fix | Delete
[82] Fix | Delete
return $instance;
[83] Fix | Delete
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
/** @see WP_Widget::form */
[87] Fix | Delete
function form( $instance ) {
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* Set Default Value for widget form
[91] Fix | Delete
*/
[92] Fix | Delete
$defaults = array( 'title' => 'Like Us On Facebook', 'fb_url' => 'https://www.facebook.com/WordPress', 'width' => '300', 'height' => '500', 'data_small_header' => 'false', 'select_lng' => 'en_US', 'data_adapt_container_width' => 'on', 'data_hide_cover' => 'false', 'data_show_facepile' => 'on', 'data_tabs' => 'timeline', 'data_lazy'=> 'false');
[93] Fix | Delete
[94] Fix | Delete
$instance = wp_parse_args( ( array ) $instance, $defaults );
[95] Fix | Delete
$title = esc_attr( $instance['title'] );
[96] Fix | Delete
$fb_url = isset( $instance['fb_url'] ) ? esc_attr( $instance['fb_url'] ) : "http://www.facebook.com/WordPress";
[97] Fix | Delete
$width = esc_attr( $instance['width'] );
[98] Fix | Delete
$height = esc_attr( $instance['height'] );
[99] Fix | Delete
$data_tabs = isset( $instance['data_tabs'] ) ? ( $instance['data_tabs'] ) : "timeline";
[100] Fix | Delete
?>
[101] Fix | Delete
[102] Fix | Delete
<p>
[103] Fix | Delete
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'facebook-pagelike-widget' ); ?></label>
[104] Fix | Delete
<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; ?>" />
[105] Fix | Delete
</p>
[106] Fix | Delete
<p>
[107] Fix | Delete
<label for="<?php echo $this->get_field_id( 'fb_url' ); ?>"><?php _e( 'Facebook Page Url:', 'facebook-pagelike-widget' ); ?></label>
[108] Fix | Delete
<input class="widefat" id="<?php echo $this->get_field_id( 'fb_url' ); ?>" name="<?php echo $this->get_field_name( 'fb_url' ); ?>" type="text" value="<?php echo $fb_url; ?>" />
[109] Fix | Delete
<small style="font-size: 0.6em;">
[110] Fix | Delete
<?php _e( 'Works with only' ); ?>
[111] Fix | Delete
<a href="http://www.facebook.com/help/?faq=174987089221178" target="_blank">
[112] Fix | Delete
<?php _e( 'Valid Facebook Pages!' ); ?>
[113] Fix | Delete
</a>
[114] Fix | Delete
</small>
[115] Fix | Delete
</p>
[116] Fix | Delete
<p>
[117] Fix | Delete
<?php
[118] Fix | Delete
if( $instance ) {
[119] Fix | Delete
$select = $instance['data_tabs'];
[120] Fix | Delete
}
[121] Fix | Delete
else {
[122] Fix | Delete
$select = "timeline";
[123] Fix | Delete
}
[124] Fix | Delete
if(is_string($select)) {
[125] Fix | Delete
$select = array($select);
[126] Fix | Delete
}
[127] Fix | Delete
?>
[128] Fix | Delete
<label for="<?php echo $this->get_field_id( 'data_tabs' ); ?>"><?php _e( 'Tabs:', 'facebook-pagelike-widget' ); ?></label>
[129] Fix | Delete
<?php
[130] Fix | Delete
[131] Fix | Delete
printf(
[132] Fix | Delete
'<select multiple="multiple" name="%s[]" id="%s">',
[133] Fix | Delete
$this->get_field_name('data_tabs'),
[134] Fix | Delete
$this->get_field_id('data_tabs')
[135] Fix | Delete
);
[136] Fix | Delete
$tabs = array( 'timeline','events','messages' );
[137] Fix | Delete
[138] Fix | Delete
foreach( $tabs as $tab )
[139] Fix | Delete
{
[140] Fix | Delete
printf(
[141] Fix | Delete
'<option value="%s" class="hot-topic" %s style="margin-bottom:3px;">%s</option>',
[142] Fix | Delete
$tab,
[143] Fix | Delete
in_array( $tab, $select) ? 'selected="selected"' : '',
[144] Fix | Delete
$tab
[145] Fix | Delete
);
[146] Fix | Delete
}
[147] Fix | Delete
echo '</select>';
[148] Fix | Delete
?>
[149] Fix | Delete
</p>
[150] Fix | Delete
<p>
[151] Fix | Delete
<input class="checkbox" type="checkbox" <?php checked( $instance['data_hide_cover'], "on" ) ?> id="<?php echo $this->get_field_id( 'data_hide_cover' ); ?>" name="<?php echo $this->get_field_name( 'data_hide_cover' ); ?>" />
[152] Fix | Delete
<label for="<?php echo $this->get_field_id( 'data_hide_cover' ); ?>" title="Hide the cover photo in the header"><?php _e( 'Hide Cover Photo', 'facebook-pagelike-widget' ); ?></label>
[153] Fix | Delete
</p>
[154] Fix | Delete
<p>
[155] Fix | Delete
<input class="checkbox" type="checkbox" <?php checked( $instance['data_show_facepile'], "on" ) ?> id="<?php echo $this->get_field_id( 'data_show_facepile' ); ?>" name="<?php echo $this->get_field_name( 'data_show_facepile' ); ?>" />
[156] Fix | Delete
<label for="<?php echo $this->get_field_id( 'data_show_facepile' ); ?>" title="Show profile photos when friends like this"><?php _e( "Show Friend's Faces", 'facebook-pagelike-widget' ); ?></label>
[157] Fix | Delete
</p>
[158] Fix | Delete
<p>
[159] Fix | Delete
<input class="checkbox" type="checkbox" <?php checked( $instance['data_small_header'], "on" ) ?> id="<?php echo $this->get_field_id( 'data_small_header' ); ?>" name="<?php echo $this->get_field_name( 'data_small_header' ); ?>" />
[160] Fix | Delete
<label for="<?php echo $this->get_field_id( 'data_small_header' ); ?>" title="Uses a smaller version of the page header"><?php _e( 'Show Small Header', 'facebook-pagelike-widget' ); ?></label>
[161] Fix | Delete
</p>
[162] Fix | Delete
<p>
[163] Fix | Delete
<input onclick="showWidth();" class="checkbox" type="checkbox" <?php checked( $instance['data_adapt_container_width'], "on" ) ?> id="<?php echo $this->get_field_id( 'data_adapt_container_width' ); ?>" name="<?php echo $this->get_field_name( 'data_adapt_container_width' ); ?>" />
[164] Fix | Delete
<label for="<?php echo $this->get_field_id( 'data_adapt_container_width' ); ?>" title="Plugin will try to fit inside the container"><?php _e( 'Adapt To Plugin Container Width', 'facebook-pagelike-widget' ); ?></label>
[165] Fix | Delete
</p>
[166] Fix | Delete
<p class="width_option <?php echo $instance['data_adapt_container_width'] == 'on' ? 'hideme' : ''; ?>">
[167] Fix | Delete
<label for="<?php echo $this->get_field_id( 'width' ); ?>"><?php _e( 'Set Width:', 'facebook-pagelike-widget' ); ?></label>
[168] Fix | Delete
<input size="19" id="<?php echo $this->get_field_id( 'width' ); ?>" name="<?php echo $this->get_field_name( 'width' ); ?>" type="text" value="<?php echo $width; ?>" placeholder="Min. 180 to Max. 500" />
[169] Fix | Delete
</p>
[170] Fix | Delete
<p>
[171] Fix | Delete
<input class="checkbox" type="checkbox" <?php checked( $instance['data_lazy'], "on" ) ?> id="<?php echo $this->get_field_id( 'data_lazy' ); ?>" name="<?php echo $this->get_field_name( 'data_lazy' ); ?>" />
[172] Fix | Delete
<label for="<?php echo $this->get_field_id( 'data_lazy' ); ?>" title="true means use the browser's lazy-loading mechanism by setting the loading=lazy iframe attribute. The effect is that the browser does not render the plugin if it's not close to the viewport and might never be seen."><?php _e( 'Enable Lazy Loading', 'facebook-pagelike-widget' ); ?></label>
[173] Fix | Delete
</p>
[174] Fix | Delete
<p>
[175] Fix | Delete
<label for="<?php echo $this->get_field_id( 'height' ); ?>"><?php _e( 'Set Height:', 'facebook-pagelike-widget' ); ?></label>
[176] Fix | Delete
<input size="19" id="<?php echo $this->get_field_id( 'height' ); ?>" name="<?php echo $this->get_field_name( 'height' ); ?>" type="text" value="<?php echo $height; ?>" placeholder="Min. 70" />
[177] Fix | Delete
</p>
[178] Fix | Delete
[179] Fix | Delete
<?php
[180] Fix | Delete
$filename = __DIR__.'/FacebookLocales.json';
[181] Fix | Delete
if (ini_get( 'allow_url_fopen') ) {
[182] Fix | Delete
if(file_exists( $filename) ) {
[183] Fix | Delete
$langs = file_get_contents( $filename );
[184] Fix | Delete
$jsoncont = json_decode( $langs );
[185] Fix | Delete
?>
[186] Fix | Delete
<p>
[187] Fix | Delete
<label for="<?php echo $this->get_field_id( 'select_lng' ); ?>"><?php _e( 'Language:', 'facebook-pagelike-widget' ); ?></label>
[188] Fix | Delete
<select name="<?php echo $this->get_field_name( 'select_lng' ); ?>" id="<?php echo $this->get_field_id( 'select_lng' ); ?>">
[189] Fix | Delete
<?php
[190] Fix | Delete
if ( !empty( $jsoncont ) ) {
[191] Fix | Delete
foreach ( $jsoncont as $languages => $short_name ) { ?>
[192] Fix | Delete
<option value="<?php echo $short_name; ?>"<?php selected( $instance['select_lng'], $short_name ); ?>><?php _e( $languages ); ?></option>
[193] Fix | Delete
<?php
[194] Fix | Delete
}
[195] Fix | Delete
}
[196] Fix | Delete
?>
[197] Fix | Delete
</select>
[198] Fix | Delete
</p>
[199] Fix | Delete
<?php
[200] Fix | Delete
}
[201] Fix | Delete
} else {
[202] Fix | Delete
?>
[203] Fix | Delete
<p>Your PHP configuration does not allow to read <a href="<?php echo plugin_dir_url( __FILE__ ).'FacebookLocales.json';?>" target="_blank">this</a> file.
[204] Fix | Delete
To unable language option, enable <a href="http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen" target="_blank"><b>allow_url_fopen</b></a> in your server configuration.
[205] Fix | Delete
</p>
[206] Fix | Delete
<?php
[207] Fix | Delete
}
[208] Fix | Delete
?>
[209] Fix | Delete
<script type="text/javascript">
[210] Fix | Delete
function showWidth() {
[211] Fix | Delete
if (jQuery( ".width_option" ).hasClass( 'hideme' ) )
[212] Fix | Delete
jQuery( ".width_option" ).removeClass( 'hideme' );
[213] Fix | Delete
else
[214] Fix | Delete
jQuery( ".width_option" ).addClass( 'hideme' );
[215] Fix | Delete
}
[216] Fix | Delete
</script>
[217] Fix | Delete
[218] Fix | Delete
<style type="text/css">.hideme {display: none;}</style>
[219] Fix | Delete
<?php
[220] Fix | Delete
}
[221] Fix | Delete
}
[222] Fix | Delete
[223] Fix | Delete
add_action( 'widgets_init', function() {
[224] Fix | Delete
return register_widget( "facebook_widget" );
[225] Fix | Delete
});
[226] Fix | Delete
[227] Fix | Delete
?>
[228] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function