Fix PHP 8.4 compatibility issues in Sensational theme
- Fixed deprecated WP_Widget constructors in all widget files - Changed $this->WP_Widget() to parent::__construct() in: * widget-social.php * widget-fblikebox.php * widget-googleplus.php * widget-tabs.php - Fixed old-style constructor methods to __construct() in: * widget-ad125.php (mts_Ad_Widget -> __construct) * widget-ad300.php (mts_ad_300_Widget -> __construct) - Fixed for loop syntax error in widget-tweets.php (for(i; -> for($i = 1;) - Enabled registration for ad125 and ad300 widgets - Added new 'After First Paragraph' widget area for in-content ads All widgets now compatible with PHP 8.4 and editable in WordPress admin. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
135
functions/widget-fblikebox.php
Normal file
135
functions/widget-fblikebox.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/*-----------------------------------------------------------------------------------
|
||||
|
||||
Plugin Name: MyThemeShop Facebook Like Box
|
||||
Description: A widget for displaying Facebook Like Box.
|
||||
Version: 1.0
|
||||
|
||||
-----------------------------------------------------------------------------------*/
|
||||
add_action('widgets_init', 'facebook_like_load_widgets');
|
||||
|
||||
function facebook_like_load_widgets()
|
||||
{
|
||||
register_widget('Facebook_Like_Widget');
|
||||
}
|
||||
/*
|
||||
class Facebook_Like_Widget extends WP_Widget {
|
||||
|
||||
function Facebook_Like_Widget()
|
||||
{
|
||||
$widget_ops = array('classname' => 'facebook_like', 'description' => __('Add Facebook Like Box.','mythemeshop'));
|
||||
|
||||
$control_ops = array('id_base' => 'facebook-like-widget');
|
||||
|
||||
parent::__construct('facebook-like-widget', __('MyThemeShop: FB Like Box','mythemeshop'), $widget_ops, $control_ops);
|
||||
}
|
||||
*/
|
||||
|
||||
class Facebook_Like_Widget extends WP_Widget {
|
||||
public function __construct() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'facebook_like_widget',
|
||||
'description' => __('Display a Facebook Like Box.', 'your-text-domain')
|
||||
);
|
||||
parent::__construct('facebook_like_widget', __('Facebook Like Widget', 'your-text-domain'), $widget_ops);
|
||||
}
|
||||
|
||||
function widget($args, $instance)
|
||||
{
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
$page_url = $instance['page_url'];
|
||||
$width = $instance['width'];
|
||||
$color_scheme = $instance['color_scheme'];
|
||||
$show_faces = isset($instance['show_faces']) ? 'true' : 'false';
|
||||
$show_stream = isset($instance['show_stream']) ? 'true' : 'false';
|
||||
$show_header = isset($instance['show_header']) ? 'true' : 'false';
|
||||
$height = '65';
|
||||
|
||||
if($show_faces == 'true') {
|
||||
$height = '238';
|
||||
}
|
||||
|
||||
if($show_stream == 'true') {
|
||||
$height = '600';
|
||||
}
|
||||
|
||||
if($show_header == 'true') {
|
||||
$height = '600';
|
||||
}
|
||||
|
||||
echo $before_widget;
|
||||
|
||||
if($title) {
|
||||
echo $before_title.$title.$after_title;
|
||||
}
|
||||
|
||||
if($page_url): ?>
|
||||
<iframe src="http://www.facebook.com/plugins/likebox.php?href=<?php echo urlencode($page_url); ?>&width=<?php echo $width; ?>&colorscheme=<?php echo $color_scheme; ?>&show_faces=<?php echo $show_faces; ?>&stream=<?php echo $show_stream; ?>&header=<?php echo $show_header; ?>&height=<?php echo $height; ?>" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:<?php echo $width; ?>px; height: <?php echo $height; ?>px;" allowTransparency="true"></iframe>
|
||||
<?php endif;
|
||||
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance)
|
||||
{
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['page_url'] = $new_instance['page_url'];
|
||||
$instance['width'] = $new_instance['width'];
|
||||
$instance['color_scheme'] = $new_instance['color_scheme'];
|
||||
$instance['show_faces'] = $new_instance['show_faces'];
|
||||
$instance['show_stream'] = $new_instance['show_stream'];
|
||||
$instance['show_header'] = $new_instance['show_header'];
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function form($instance)
|
||||
{
|
||||
$defaults = array('title' => __('Find us on Facebook','mythemeshop'), 'page_url' => '', 'width' => '292', 'color_scheme' => 'light', 'show_faces' => 'on', 'show_stream' => false, 'show_header' => false);
|
||||
$instance = wp_parse_args((array) $instance, $defaults); ?>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title','mythemeshop'); ?>:</label>
|
||||
<input type="text" class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('page_url'); ?>"><?php _e('Facebook Page URL','mythemeshop'); ?>:</label>
|
||||
<input type="text" class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('page_url'); ?>" name="<?php echo $this->get_field_name('page_url'); ?>" value="<?php echo $instance['page_url']; ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width','mythemeshop'); ?>:</label>
|
||||
<input type="text" class="widefat" style="width: 30px;" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" value="<?php echo $instance['width']; ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('color_scheme'); ?>"><?php _e('Color Scheme','mythemeshop'); ?>:</label>
|
||||
<select id="<?php echo $this->get_field_id('color_scheme'); ?>" name="<?php echo $this->get_field_name('color_scheme'); ?>" style="width:100%;">
|
||||
<option <?php if ('light' == $instance['color_scheme']) echo 'selected="selected"'; ?>><?php _e('light','mythemeshop'); ?></option>
|
||||
<option <?php if ('dark' == $instance['color_scheme']) echo 'selected="selected"'; ?>><?php _e('dark','mythemeshop'); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input class="checkbox" type="checkbox" <?php checked($instance['show_faces'], 'on'); ?> id="<?php echo $this->get_field_id('show_faces'); ?>" name="<?php echo $this->get_field_name('show_faces'); ?>" />
|
||||
<label for="<?php echo $this->get_field_id('show_faces'); ?>"><?php _e('Show faces','mythemeshop'); ?></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input class="checkbox" type="checkbox" <?php checked($instance['show_stream'], 'on'); ?> id="<?php echo $this->get_field_id('show_stream'); ?>" name="<?php echo $this->get_field_name('show_stream'); ?>" />
|
||||
<label for="<?php echo $this->get_field_id('show_stream'); ?>"><?php _e('Show stream','mythemeshop'); ?></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input class="checkbox" type="checkbox" <?php checked($instance['show_header'], 'on'); ?> id="<?php echo $this->get_field_id('show_header'); ?>" name="<?php echo $this->get_field_name('show_header'); ?>" />
|
||||
<label for="<?php echo $this->get_field_id('show_header'); ?>"><?php _e('Show facebook header','mythemeshop'); ?></label>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user