Rebrand fork as socialiconeco; PHP 8 fix; rename identifiers and fix folder paths
This commit is contained in:
12
lib/form.php
12
lib/form.php
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
global $siw_social_accounts;
|
||||
global $sie_social_accounts;
|
||||
|
||||
foreach ($siw_social_accounts as $site => $id) {
|
||||
foreach ($sie_social_accounts as $site => $id) {
|
||||
if(!isset($instance[$id])) { $instance[$id] = ''; }
|
||||
elseif($instance[$id] == 'http://') { $instance[$id] = ''; }
|
||||
}
|
||||
@@ -12,13 +12,13 @@ if(!isset($instance['labels'])) { $instance['labels'] = ''; }
|
||||
if(!isset($instance['show_title'])) { $instance['show_title'] = ''; }
|
||||
?>
|
||||
|
||||
<div class="social_icons_widget">
|
||||
<div class="socialiconeco_widget">
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('title'); ?>">Title:</label>
|
||||
<input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" /></p>
|
||||
|
||||
<?php
|
||||
$siw_sizes = array(
|
||||
$sie_sizes = array(
|
||||
'None' => 'none',
|
||||
'Small (16px)' => 'small',
|
||||
'Medium (32px)' => 'medium',
|
||||
@@ -32,7 +32,7 @@ $siw_sizes = array(
|
||||
<p class="icon_options"><label for="<?php echo $this->get_field_id('icons'); ?>">Icon Type:</label>
|
||||
<select id="<?php echo $this->get_field_id('icons'); ?>" name="<?php echo $this->get_field_name('icons'); ?>">
|
||||
<?php
|
||||
foreach($siw_sizes as $option => $value) :
|
||||
foreach($sie_sizes as $option => $value) :
|
||||
|
||||
if(esc_attr($instance['icons'] == $value)) { $selected = ' selected="selected"'; }
|
||||
else { $selected = ''; }
|
||||
@@ -51,7 +51,7 @@ $siw_sizes = array(
|
||||
<p class="label_options"><input type="checkbox" id="<?php echo $this->get_field_id('show_title'); ?>" name="<?php echo $this->get_field_name('show_title'); ?>" value="show"<?php echo $checked; ?> /> <label for="<?php echo $this->get_field_id('show_title'); ?>">Hide Title</label></p>
|
||||
|
||||
<ul class="social_accounts">
|
||||
<?php foreach ($siw_social_accounts as $site => $id) : ?>
|
||||
<?php foreach ($sie_social_accounts as $site => $id) : ?>
|
||||
<li><label for="<?php echo $this->get_field_id($id); ?>" class="<?php echo $id; ?>"><?php echo $site; ?>:</label>
|
||||
<input class="widefat" type="text" id="<?php echo $this->get_field_id($id); ?>" name="<?php echo $this->get_field_name($id); ?>" value="<?php echo esc_attr($instance[$id]); ?>" placeholder="http://" /></li>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
/*
|
||||
Declare supported social media websites
|
||||
|
||||
By default, the Social Icons Widget provides a variety of popular social media websites. Developers can easily add more social media websites by creating a filter in the active theme's functions.php file like such:
|
||||
By default, Social Icone Co provides a variety of popular social media websites. Developers can easily add more social media websites by creating a filter in the active theme's functions.php file like such:
|
||||
|
||||
`function add_new_icons($icon_list) {
|
||||
$icon_list['Full Website Name'] = 'full-website-id';
|
||||
|
||||
|
||||
return $icon_list;
|
||||
}
|
||||
add_filter('social_icon_accounts', 'add_new_icons');`
|
||||
add_filter('socialiconeco_accounts', 'add_new_icons');`
|
||||
|
||||
The full-website-id should reflect the name of the image you create in each of the icon folder sizes, or in your custom icon directory. It is also used to populate the class field of the icon when the widget displays. The Social Icon Widget looks for .gif, .jpg, .jpeg, and .png in order and returns the first extention it finds.
|
||||
The full-website-id should reflect the name of the image you create in each of the icon folder sizes, or in your custom icon directory. It is also used to populate the class field of the icon when the widget displays. Social Icone Co looks for .gif, .jpg, .jpeg, and .png in order and returns the first extention it finds.
|
||||
*/
|
||||
|
||||
global $siw_social_accounts;
|
||||
$siw_social_accounts = array(
|
||||
global $sie_social_accounts;
|
||||
$sie_social_accounts = array(
|
||||
'500px' => 'fivehundredpx',
|
||||
'About.me' => 'aboutme',
|
||||
'Behance' => 'behance',
|
||||
@@ -51,7 +51,7 @@
|
||||
'Zerply' => 'zerply'
|
||||
);
|
||||
|
||||
if( has_filter('social_icon_accounts') ) {
|
||||
$siw_social_accounts = apply_filters('social_icon_accounts', $siw_social_accounts);
|
||||
if( has_filter('socialiconeco_accounts') ) {
|
||||
$sie_social_accounts = apply_filters('socialiconeco_accounts', $sie_social_accounts);
|
||||
}
|
||||
?>
|
||||
@@ -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