public
Last active

  • Download Gist
Alessandro Staniscia revised this gist . 2 changed files with 28 additions and 13 deletions. View gist @ e9f6bb4
follow_me_tabs_133.php
36 
... 86 87 88 89     90 91 92 93 94 95     96 97 98 99 100 101     102 103 104 105 106 107     108 109 110 111 112 113     114 115 116 117 118 119     120 121 122 123 124 125     126 127 128 129 130 131     132 133 134 135 136 137     138 139 140 141 142 143     144 145 146 147 148 149     150 151 152 153 154 155     156 157 158   ... 86 87 88   89 90 91 92 93 94 95   96 97 98 99 100 101 102   103 104 105 106 107 108 109   110 111 112 113 114 115 116   117 118 119 120 121 122 123   124 125 126 127 128 129 130   131 132 133 134 135 136 137   138 139 140 141 142 143 144   145 146 147 148 149 150 151   152 153 154 155 156 157 158   159 160 161 162 163 164 165   166 167 168 169 170  
@@ -86,73 +86,85 @@ function followmetabs_admin()
'description'=>'Ex: http://facebook.com/<b>username</b> or <br />http://facebook.com/profile.php?id=<b>profileID</b>',
'icon'=>'facebook',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=> 'http://facebook.com/-ID-'
),
'Google_Plus'=>array(
'description'=>'Ex: https://plus.google.com/u/1/<b>userID</b>',
'icon'=>'plus',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=>'https://plus.google.com/u/1/-ID-'
),
'LinkedIn'=>array(
'description'=>'Ex: http://www.linkedin.com/in/<b>username</b>',
'icon'=>'linkedin',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=>'http://www.linkedin.com/in/-ID-'
),
'Twitter'=>array(
'description'=>'Ex: http://www.twitter.com/<b>username</b>',
'icon'=>'twitter',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=>'https://twitter.com/-ID-'
),
'Youtube'=>array(
'description'=>'Ex: http://www.youtube.com/<b>username</b>',
'icon'=>'youtube',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=>'http://www.youtube.com/-ID-'
),
'Blogger'=>array(
'description'=>'Ex: http://www.<b>username</b>.blogspot.com',
'icon'=>'blogger',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=>'http://www.-ID-.blogspot.com'
),
'Skype_Name'=>array(
'description'=>'Ex: skype:<b>SkypeName</b>?chat',
'icon'=>'skype',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=>'skype:-ID-?chat'
),
'MySpace'=>array(
'description'=>'Ex: http://www.myspace.com/<b>userID</b>',
'icon'=>'myspace',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=>'http://www.myspace.com/-ID-'
),
'Pinterest'=>array(
'description'=>'Ex: http://pinterest.com/<b>username</b>/',
'icon'=>'pinterest',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=>'http://pinterest.com/-ID-'
),
'RSS_Feed'=>array(
'description'=>'Ex: url from your rss feed',
'icon'=>'rssfeed',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=>'-ID-'
),
'Last_fm'=>array(
'description'=>'Ex: http://www.last.fm/user/<b>username</b>',
'icon'=>'lastfm',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=>'http://www.last.fm/user/-ID-'
),
'Deviant_Art'=>array(
'description'=>'Ex: http://<b>username</b>.deviantart.com/',
'icon'=>'deviantart',
'value'=>'',
- 'active'=>''
+ 'active'=>'',
+ 'link'=>'http://-ID-.deviantart.com/'
),
);
?>
\ No newline at end of file
followme_widget.php
5 
... 69 70 71       72 73   74 75 76 ... 69 70 71 72 73 74 75   76 77 78 79
@@ -69,8 +69,11 @@ function follow_me_icons_build($size, $style, $widget_text = '', $widget_list =
if($style == '3' || $style == '4')
$link_class = 'tabs_fm_s_a_'.$size.' i_'.$style.'_'.$size.'_'.$networks_array[$network]['icon'];
+ $link_follower=str_replace("-ID-", $network_params['value'], $networks_array[$network]['link']);
+
+
if($network_params['value'] != '' && isset($network_params['active']) && $network_params['active'] == "1")
- $content .= '<a href="'.$network_params['value'].'" class="'.$link_class.'" target="_blank" title="">'.$add_img.'</a>';
+ $content .= '<a href="'.$link_follower.'" class="'.$link_class.'" target="_blank" title="">'.$add_img.'</a>';
}
if($style == '2') $content .= '</div>';
$content .= '</div>';
Alessandro Staniscia revised this gist . 2 changed files with 4 additions and 4 deletions. View gist @ fb8667a
follow_me_tabs_133.php
6 
... 19 20 21 22 23     24 25 26 ... 19 20 21     22 23 24 25 26
@@ -19,8 +19,8 @@
//include css and javascript
function my_scripts_method()
{
- wp_enqueue_script('custom-script', WP_PLUGIN_URL . '/follow_me_tabs_133/js/inc.js', array('jquery'));
- wp_enqueue_style( 'prefix-style', WP_PLUGIN_URL . '/follow_me_tabs_133/css/style.css' );
+ wp_enqueue_script('custom-script', WP_PLUGIN_URL . '/follow-me-tabs/js/inc.js', array('jquery'));
+ wp_enqueue_style( 'prefix-style', WP_PLUGIN_URL . '/follow-me-tabs/css/style.css' );
}
//footer code
... 78 79 80 81   82 83 84 ... 78 79 80   81 82 83 84
@@ -78,7 +78,7 @@ function followmetabs_admin()
}
//path to plugin image folder
-$path_to_images = WP_PLUGIN_URL . '/follow_me_tabs_133/img/';
+$path_to_images = WP_PLUGIN_URL . '/follow-me-tabs/img/';
//networks array
$networks_array = array(
followme_widget.php
2 
... 35 36 37 38   39 40 41 ... 35 36 37   38 39 40 41
@@ -35,7 +35,7 @@ function follow_me_icons_build($size, $style, $widget_text = '', $widget_list =
$data = get_option('follow_me_tabs_133');
- if(count($data) > 0 && $data['in_position'] != 'hidden')
+ if(count($data) > 0 )
{
if($widget_text != '') $content .= $widget_text;
Alessandro Staniscia created this gist . View gist @ 3f77ebe
follow_me_tabs_133.php
158 
...                                                                                                                                                                                                                                                                                                                               ... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158  
@@ -0,0 +1,158 @@
+<?php
+/*
+Plugin Name: Follow me Tabs
+Plugin URI: http://follow.code4site.com
+Description: Plugin for displaying "Follow me Tabs" on different positions on the browser screen
+Author: Igor Ivanov
+Version: 1.0
+Author URI: http://follow.code4site.com
+*/
+
+
+add_action('wp_footer', 'mp_footer');
+add_action('admin_menu', 'followmetab_admin_actions');
+add_action('wp_enqueue_scripts', 'my_scripts_method');
+
+//include widget code
+include('followme_widget.php');
+
+//include css and javascript
+function my_scripts_method()
+{
+ wp_enqueue_script('custom-script', WP_PLUGIN_URL . '/follow_me_tabs_133/js/inc.js', array('jquery'));
+ wp_enqueue_style( 'prefix-style', WP_PLUGIN_URL . '/follow_me_tabs_133/css/style.css' );
+}
+
+//footer code
+function mp_footer()
+{
+ global $networks_array, $path_to_images;
+
+ $data = get_option('follow_me_tabs_133');
+
+ if(count($data) > 0 && $data['in_position'] != 'hidden')
+ {
+ //get style, position and size of the tabs from database
+ $style = $data['in_style'];
+ $position = $data['in_position'];
+ $size = $data['in_size'];
+
+ //make sure they are valid
+ if(!in_array($style, array('1','2','3','4'))) $style = '1';
+ if(!in_array($position, array('left','right'))) $position = 'left';
+ if(!in_array($size, array('40','50'))) $size = '40';
+
+ echo '<div class="tabs_fm_s_'.$style.'_'.$size.' tabs_'.$position.'_'.$style.'_'.$size.'">';
+ if($style == '2') echo '<div class="tabs_inner_fm_s_'.$style.'_'.$size.' tabs_'.$position.'_fm_s">';
+
+ foreach ($data['networks'] as $network=>$network_params)
+ {
+ if($style == '2')
+ $add_img = '<img src="'.$path_to_images.'s2/'.$networks_array[$network]['icon'].'.png" alt="" width="'.$size.'" />';
+ else
+ $add_img = '';
+
+ $link_class = $position.'_'.$style.'_'.$size.'_'.$networks_array[$network]['icon'];
+ if($style == '3' || $style == '4')
+ $link_class = 'tabs_fm_s_a_'.$size.' i_'.$style.'_'.$size.'_'.$networks_array[$network]['icon'];
+
+ if($network_params['value'] != '' && $network_params['active'] == 1)
+ echo '<a href="'.$network_params['value'].'" class="'.$link_class.'" target="_blank" title="">'.$add_img.'</a>';
+ }
+ if($style == '2') echo '</div>';
+ echo '</div>';
+ }
+}
+
+//menu link in Settings admin menu
+function followmetab_admin_actions()
+{
+ add_options_page("Follow Me Tabs", "Follow Me Tabs", 1, "follow_me_tabs_133", "followmetabs_admin");
+}
+
+//open admin page
+function followmetabs_admin()
+{
+ global $networks_array;
+ include('followmetab_admin.php');
+}
+
+//path to plugin image folder
+$path_to_images = WP_PLUGIN_URL . '/follow_me_tabs_133/img/';
+
+//networks array
+$networks_array = array(
+ 'Facebook'=>array(
+ 'description'=>'Ex: http://facebook.com/<b>username</b> or <br />http://facebook.com/profile.php?id=<b>profileID</b>',
+ 'icon'=>'facebook',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ 'Google_Plus'=>array(
+ 'description'=>'Ex: https://plus.google.com/u/1/<b>userID</b>',
+ 'icon'=>'plus',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ 'LinkedIn'=>array(
+ 'description'=>'Ex: http://www.linkedin.com/in/<b>username</b>',
+ 'icon'=>'linkedin',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ 'Twitter'=>array(
+ 'description'=>'Ex: http://www.twitter.com/<b>username</b>',
+ 'icon'=>'twitter',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ 'Youtube'=>array(
+ 'description'=>'Ex: http://www.youtube.com/<b>username</b>',
+ 'icon'=>'youtube',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ 'Blogger'=>array(
+ 'description'=>'Ex: http://www.<b>username</b>.blogspot.com',
+ 'icon'=>'blogger',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ 'Skype_Name'=>array(
+ 'description'=>'Ex: skype:<b>SkypeName</b>?chat',
+ 'icon'=>'skype',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ 'MySpace'=>array(
+ 'description'=>'Ex: http://www.myspace.com/<b>userID</b>',
+ 'icon'=>'myspace',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ 'Pinterest'=>array(
+ 'description'=>'Ex: http://pinterest.com/<b>username</b>/',
+ 'icon'=>'pinterest',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ 'RSS_Feed'=>array(
+ 'description'=>'Ex: url from your rss feed',
+ 'icon'=>'rssfeed',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ 'Last_fm'=>array(
+ 'description'=>'Ex: http://www.last.fm/user/<b>username</b>',
+ 'icon'=>'lastfm',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ 'Deviant_Art'=>array(
+ 'description'=>'Ex: http://<b>username</b>.deviantart.com/',
+ 'icon'=>'deviantart',
+ 'value'=>'',
+ 'active'=>''
+ ),
+ );
+?>
\ No newline at end of file
followme_widget.php
214 
...                                                                                                                                                                                                                                                                                                                                                                                                                                               ... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214  
@@ -0,0 +1,214 @@
+<?php
+
+add_action( 'widgets_init', 'follow_me_tabs_widget' );
+add_shortcode( 'follow_me_icons', 'follow_me_icons_content_processor' );
+
+
+function follow_me_tabs_widget()
+{
+ register_widget( 'FollowMeTabs_Widget' );
+}
+
+function follow_me_icons_content_processor($atts)
+{
+ extract( shortcode_atts( array(
+ 'size' => 'small',
+ 'type' => 'zoom'
+ ), $atts ) );
+
+ return follow_me_icons_build($size, $type);
+}
+
+function follow_me_icons_build($size, $style, $widget_text = '', $widget_list = array())
+{
+ global $networks_array, $path_to_images;
+ $content = '';
+ if($style == 'zoom') $style = 2;
+ if($style == 'color') $style = 3;
+ if($style == 'grey') $style = 4;
+
+ if($size == 'small') $size = 40;
+ if($size == 'large') $size = 50;
+
+ if(!in_array($style, array('2','3','4'))) $style = '2';
+ if(!in_array($size, array('40','50'))) $size = '40';
+
+ $data = get_option('follow_me_tabs_133');
+
+ if(count($data) > 0 && $data['in_position'] != 'hidden')
+ {
+ if($widget_text != '') $content .= $widget_text;
+
+ $main_class = ($style == '2') ? 'widget_fm_zoom' : 'widget_fm_color';
+ $content .= '<div class="widget_fm_'.$size.' '.$main_class.'">';
+ if($style == '2')
+ {
+ if(count($widget_list) > 0)
+ $min_width = count($widget_list) * ($size + 10);
+ else
+ {
+ $cnt = 0;
+ foreach ($data['networks'] as $network=>$network_params)
+ if($network_params['value'] != '' && isset($network_params['active']) && $network_params['active'] == "1")
+ $cnt++;
+ $min_width = $cnt * ($size + 10);
+ }
+ $content .= '<div class="widget_inner_fm_'.$size.'" style="min-width: '.$min_width.'px;">';
+ }
+
+ foreach ($data['networks'] as $network=>$network_params)
+ {
+ if(count($widget_list) > 0 && !in_array($network, $widget_list)) continue;
+
+ if($style == '2')
+ $add_img = '<img src="'.$path_to_images.'s2/'.$networks_array[$network]['icon'].'.png" alt="" width="'.$size.'" />';
+ else
+ $add_img = '';
+
+ $link_class = '';
+ if($style == '3' || $style == '4')
+ $link_class = 'tabs_fm_s_a_'.$size.' i_'.$style.'_'.$size.'_'.$networks_array[$network]['icon'];
+
+ if($network_params['value'] != '' && isset($network_params['active']) && $network_params['active'] == "1")
+ $content .= '<a href="'.$network_params['value'].'" class="'.$link_class.'" target="_blank" title="">'.$add_img.'</a>';
+ }
+ if($style == '2') $content .= '</div>';
+ $content .= '</div>';
+ }
+
+ return $content;
+}
+/**
+ * Widget class.
+ * This class handles everything that needs to be handled with the widget:
+ * the settings, form, display, and update.
+ */
+class FollowMeTabs_Widget extends WP_Widget
+{
+
+ /**
+ * Widget setup.
+ */
+ function FollowMeTabs_Widget()
+ {
+ /* Widget settings. */
+ $widget_ops = array(
+ 'classname' => 'FollowMe',
+ 'description' => __('"Fallow Me" buttons as Widget', 'FollowMe')
+ );
+
+ /* Widget control settings. */
+ $control_ops = array(
+ 'width' => 400,
+ 'height' => 400,
+ 'id_base' => 'follow_me_tabs_widget' );
+
+ /* Create the widget. */
+ $this->WP_Widget(
+ 'follow_me_tabs_widget',
+ __('Follow Me Widget', 'FollowMe'),
+ $widget_ops,
+ $control_ops
+ );
+ }
+
+ /**
+ * How to display the widget on the screen.
+ */
+ function widget( $args, $instance )
+ {
+ extract( $args );
+
+ $defaults = array('w_network' => array(), 'w_network_style'=>'2', 'w_network_size'=>40, 'w_network_text'=>'');
+ $instance = wp_parse_args( (array) $instance, $defaults );
+
+ $title = ($instance['w_network_text'] != '') ? $args['before_title'] . $instance['w_network_text'] . $args['after_title'] : '';
+ echo $args['before_widget'];
+ echo follow_me_icons_build($instance['w_network_size'], $instance['w_network_style'], $title, $instance['w_network']);
+ echo $args['after_widget'];
+ }
+
+ /**
+ * Update the widget settings.
+ */
+ function update( $new_instance, $old_instance )
+ {
+
+ $instance = $new_instance;
+
+ /* Strip tags for title and name to remove HTML (important for text inputs). */
+ $instance['w_network'] = isset($_POST['w_network']) ? $_POST['w_network'] : array();
+ $instance['w_network_style'] = isset($_POST['w_network_style']) ? $_POST['w_network_style'] : '2';
+ $instance['w_network_size'] = isset($_POST['w_network_size']) ? $_POST['w_network_size'] : '40';
+ $instance['w_network_text'] = isset($_POST['w_network_text']) ? $_POST['w_network_text'] : '';
+ return $instance;
+ }
+
+ /**
+ * Displays the widget settings controls on the widget panel.
+ */
+ function form( $instance )
+ {
+
+ global $networks_array,$path_to_images;
+
+ /* Set up some default widget settings. */
+ $defaults = array('w_network' => array(), 'w_network_style'=>'2', 'w_network_size'=>40, 'w_network_text'=>'');
+ $instance = wp_parse_args( (array) $instance, $defaults );
+
+ $data = get_option('follow_me_tabs_133');
+ $networks = isset($data['networks']) ? $data['networks'] : array();
+
+ if(count($networks) > 0)
+ {
+ echo '<p>Please check the network that you want to include in your widget (Here are listed only active networks with valid network URL set in Settings->Follow Me Tabs page)</p>';
+ echo '<div style="width:400px;display:block;">';
+
+ foreach ($data['networks'] as $network=>$network_params)
+ {
+ if($network_params['value'] != '' && isset($network_params['active']) && $network_params['active'] == "1")
+ {
+ $checked = in_array($network, $instance['w_network']) ? ' checked="checked" ' : '';
+ ?>
+ <div style="width:130px;float:left;">
+ <div style="display:inline;margin-bottom:10px;vertical-align: top;">
+ <input type="checkbox" name="w_network[]" value="<?php echo $network?>" <?php echo $checked?>/>
+ </div>
+ <div style="display:inline;">
+ <img src="<?php echo $path_to_images?>s2/<?php echo $networks_array[$network]['icon']?>.png" alt="" width="45" />
+ </div>
+ </div>
+
+ <?
+ }
+
+ }
+
+ ?>
+ <div style="clear:both;"></div>
+ <br />Widget Title (optional):<br />
+ <input type="text" name="w_network_text" value="<?php echo $instance['w_network_text']?>" style="width: 370px;" />
+ <br />Style:<br />
+ <select name="w_network_style">
+ <option value="2" <?php if($instance['w_network_style'] == '2') echo 'selected';?>>Zoom Icons</option>
+ <option value="3" <?php if($instance['w_network_style'] == '3') echo 'selected';?>>Color Up-Down Icons</option>
+ <option value="4" <?php if($instance['w_network_style'] == '4') echo 'selected';?>>Grey Up-Down Icons</option>
+ </select>
+
+ <br />Size:<br />
+ <select name="w_network_size">
+ <option value="40" <?php if($instance['w_network_size'] == '40') echo 'selected';?>>Small</option>
+ <option value="50" <?php if($instance['w_network_size'] == '50') echo 'selected';?>>Large</option>
+ </select>
+ <p>If you select zoom style, you need to have wider space in selected widget area!</p>
+ </div>
+ <?
+ }
+ else
+ {
+ echo 'Please go in Settings->Follow me Tabs and set up your networks first!';
+ }
+ }
+}
+
+?>
\ No newline at end of file
Something went wrong with that request. Please try again.