Rebrand fork as socialiconeco; PHP 8 fix; rename identifiers and fix folder paths
This commit is contained in:
@@ -1,92 +1,92 @@
|
||||
<?php
|
||||
global $siw_social_accounts;
|
||||
global $sie_social_accounts;
|
||||
extract($args);
|
||||
|
||||
$siw_title = empty($instance['title']) ? 'Follow Us' : apply_filters('widget_title', $instance['title']);
|
||||
$siw_icons = $instance['icons'];
|
||||
$siw_labels = $instance['labels'];
|
||||
$siw_show_title = $instance['show_title'];
|
||||
$sie_title = empty($instance['title']) ? 'Follow Us' : apply_filters('widget_title', $instance['title']);
|
||||
$sie_icons = $instance['icons'];
|
||||
$sie_labels = $instance['labels'];
|
||||
$sie_show_title = $instance['show_title'];
|
||||
|
||||
echo $before_widget;
|
||||
|
||||
if($siw_show_title == '') {
|
||||
if($sie_show_title == '') {
|
||||
echo $before_title;
|
||||
echo $siw_title;
|
||||
echo $sie_title;
|
||||
echo $after_title;
|
||||
}
|
||||
|
||||
if($siw_labels == 'show') { $ul_class = 'show-labels '; }
|
||||
if($sie_labels == 'show') { $ul_class = 'show-labels '; }
|
||||
else { $ul_class = ''; }
|
||||
$ul_class .= 'icons-'.$siw_icons;
|
||||
$ul_class .= 'icons-'.$sie_icons;
|
||||
?>
|
||||
|
||||
<?php echo apply_filters('social_icon_opening_tag', '<ul class="'.$ul_class.'">'); ?>
|
||||
<?php echo apply_filters('socialiconeco_opening_tag', '<ul class="'.$ul_class.'">'); ?>
|
||||
|
||||
<?php foreach($siw_social_accounts as $siw_title => $id) : ?>
|
||||
<?php foreach($sie_social_accounts as $sie_title => $id) : ?>
|
||||
<?php if($instance[$id] != '' && $instance[$id] != 'http://') :
|
||||
|
||||
global $siw_data;
|
||||
global $siw_icon_output;
|
||||
global $sie_data;
|
||||
global $sie_icon_output;
|
||||
|
||||
$imgsize = '';
|
||||
|
||||
$siw_data['id'] = $id;
|
||||
$siw_data['url'] = $instance[$id];
|
||||
$siw_custom_sizes = array('custom_small','custom_medium','custom_large');
|
||||
$sie_data['id'] = $id;
|
||||
$sie_data['url'] = $instance[$id];
|
||||
$sie_custom_sizes = array('custom_small','custom_medium','custom_large');
|
||||
|
||||
if (in_array($siw_icons, $siw_custom_sizes)) {
|
||||
$size = str_replace("custom_","",$siw_icons);
|
||||
$siw_icon_path = get_stylesheet_directory() .'/social_icons/'.$size.'/'.$id.'.{gif,jpg,jpeg,png}';
|
||||
if (in_array($sie_icons, $sie_custom_sizes)) {
|
||||
$size = str_replace("custom_","",$sie_icons);
|
||||
$sie_icon_path = get_stylesheet_directory() .'/social_icons/'.$size.'/'.$id.'.{gif,jpg,jpeg,png}';
|
||||
}
|
||||
else {
|
||||
$siw_abs_path = str_replace('lib/', '', plugin_dir_path( __FILE__ ));
|
||||
$sie_abs_path = str_replace('lib/', '', plugin_dir_path( __FILE__ ));
|
||||
|
||||
/* Fix for Windows/XAMPP where the slash goes the wrong way.
|
||||
Thanks to VictoriousK */
|
||||
$siw_abs_path = str_replace('\\', '/', $siw_abs_path);
|
||||
$sie_abs_path = str_replace('\\', '/', $sie_abs_path);
|
||||
|
||||
$siw_icon_path = $siw_abs_path . 'icons/'.$siw_icons.'/'.$id.'.{gif,jpg,jpeg,png}';
|
||||
$sie_icon_path = $sie_abs_path . 'icons/'.$sie_icons.'/'.$id.'.{gif,jpg,jpeg,png}';
|
||||
|
||||
if($siw_icons == 'large') { $imgsize = 'height="64" width="64"'; }
|
||||
elseif($siw_icons == 'medium') { $imgsize = 'height="32" width="32"'; }
|
||||
elseif($siw_icons == 'small') { $imgsize = 'height="16" width="16"'; }
|
||||
if($sie_icons == 'large') { $imgsize = 'height="64" width="64"'; }
|
||||
elseif($sie_icons == 'medium') { $imgsize = 'height="32" width="32"'; }
|
||||
elseif($sie_icons == 'small') { $imgsize = 'height="16" width="16"'; }
|
||||
}
|
||||
|
||||
$result = glob( $siw_icon_path, GLOB_BRACE );
|
||||
$result = glob( $sie_icon_path, GLOB_BRACE );
|
||||
|
||||
if($result) {
|
||||
if (in_array($siw_icons, $siw_custom_sizes)) {
|
||||
$siw_path = explode('themes', $result[0]);
|
||||
$siw_icon = site_url().'/wp-content/themes'.$siw_path[1];
|
||||
if (in_array($sie_icons, $sie_custom_sizes)) {
|
||||
$sie_path = explode('themes', $result[0]);
|
||||
$sie_icon = site_url().'/wp-content/themes'.$sie_path[1];
|
||||
}
|
||||
else {
|
||||
$siw_path = explode('plugins', $result[0]);
|
||||
$siw_icon = plugins_url().''.$siw_path[1];
|
||||
$sie_path = explode('plugins', $result[0]);
|
||||
$sie_icon = plugins_url().''.$sie_path[1];
|
||||
}
|
||||
}
|
||||
elseif( $siw_labels != 'show' && $siw_icons != 'small' ) {
|
||||
$siw_icon = plugins_url().'/social-media-icons-widget/icons/'.$siw_icons.'/_unknown.jpg';
|
||||
elseif( $sie_labels != 'show' && $sie_icons != 'small' ) {
|
||||
$sie_icon = SIEC_URL.'icons/'.$sie_icons.'/_unknown.jpg';
|
||||
}
|
||||
else {
|
||||
$siw_icon = '';
|
||||
$sie_icon = '';
|
||||
}
|
||||
|
||||
if ( $siw_icon ) { $siw_data['image'] = '<img class="site-icon" src="'.$siw_icon.'" alt="'.$siw_title.'" title="'.$siw_title.'" '.$imgsize.' />'; }
|
||||
else { $siw_data['image'] = ''; }
|
||||
if ( $sie_icon ) { $sie_data['image'] = '<img class="site-icon" src="'.$sie_icon.'" alt="'.$sie_title.'" title="'.$sie_title.'" '.$imgsize.' />'; }
|
||||
else { $sie_data['image'] = ''; }
|
||||
|
||||
if($siw_labels != 'show') { $siw_data['title'] = ''; }
|
||||
else { $siw_data['title'] = '<span class="site-label">'.$siw_title.'</span>'; }
|
||||
if($sie_labels != 'show') { $sie_data['title'] = ''; }
|
||||
else { $sie_data['title'] = '<span class="site-label">'.$sie_title.'</span>'; }
|
||||
|
||||
$format = '<li class="%1$s"><a href="%2$s" target="_blank">%3$s%4$s</a></li>';
|
||||
$siw_icon_output = apply_filters('social_icon_output', $format);
|
||||
echo vsprintf($siw_icon_output, $siw_data);
|
||||
$sie_icon_output = apply_filters('socialiconeco_output', $format);
|
||||
echo vsprintf($sie_icon_output, $sie_data);
|
||||
|
||||
?>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php echo apply_filters('social_icon_closing_tag', '</ul>'); ?>
|
||||
<?php echo apply_filters('socialiconeco_closing_tag', '</ul>'); ?>
|
||||
|
||||
<?php
|
||||
echo $after_widget;
|
||||
|
||||
Reference in New Issue
Block a user