Version Description
- New button type: share toolbar
- Real-time button preview in admin settings
Download this release
Release Info
Developer | kasal |
Plugin | Hupso Share Buttons for Twitter, Facebook & Google+ |
Version | 2.0 |
Comparing to | |
See all releases |
Code changes from version 1.4 to 2.0
- img/share_toolbar_big.png +0 -0
- img/share_toolbar_short.png +0 -0
- js/create_button.js +270 -0
- readme.txt +17 -13
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- share-buttons-hupso.php +185 -97
img/share_toolbar_big.png
ADDED
Binary file
|
img/share_toolbar_short.png
ADDED
Binary file
|
js/create_button.js
ADDED
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// detect hupso settings and show share button preview on first load
|
2 |
+
var hupso_settings_active = document.hupso_settings_form.button_type;
|
3 |
+
if (typeof hupso_settings_active == "object" ) {
|
4 |
+
hupso_create_code();
|
5 |
+
}
|
6 |
+
|
7 |
+
function hupso_create_code() {
|
8 |
+
|
9 |
+
jQuery(document).ready(function($) {
|
10 |
+
// $() will work as an alias for jQuery() inside of this function
|
11 |
+
|
12 |
+
var bsize = "button120x28";
|
13 |
+
var bwidth = "120";
|
14 |
+
var bheight = "28";
|
15 |
+
var hupso_services = "";
|
16 |
+
var icon_type = 'labels';
|
17 |
+
var hupso_url = "";
|
18 |
+
var hupso_title = "";
|
19 |
+
var button_type = "share_button";
|
20 |
+
var button_position = "left";
|
21 |
+
var hupso_class = 'hupso_pop';
|
22 |
+
var hupso_js = 'share.js';
|
23 |
+
var hupso_float_left_f = false;
|
24 |
+
var hupso_float_right_f = false;
|
25 |
+
var toolbar_size = 'big';
|
26 |
+
var toolbar_share = 'share';
|
27 |
+
|
28 |
+
dir = "";
|
29 |
+
cdn = "static";
|
30 |
+
|
31 |
+
hupso_float_left_f = false;
|
32 |
+
hupso_float_right_f = false;
|
33 |
+
|
34 |
+
button_type = $("input:radio[name=button_type]:checked").val();
|
35 |
+
switch ( button_type ) {
|
36 |
+
case 'share_button':
|
37 |
+
$( "#button_position" ).hide();
|
38 |
+
$( "#toolbar_size" ).hide();
|
39 |
+
$( "#button_style" ).show();
|
40 |
+
$( "#button_preview" ).show();
|
41 |
+
$( "#move_mouse" ).show();
|
42 |
+
$( "#show_icons" ).show();
|
43 |
+
$( "#show_title" ).show();
|
44 |
+
$( "#show_color" ).show();
|
45 |
+
break;
|
46 |
+
case 'share_toolbar':
|
47 |
+
$( "#button_position" ).hide();
|
48 |
+
$( "#button_style" ).hide();
|
49 |
+
$( "#toolbar_size" ).show();
|
50 |
+
$( "#button_preview" ).show();
|
51 |
+
$( "#move_mouse" ).hide();
|
52 |
+
$( "#show_icons" ).hide();
|
53 |
+
$( "#show_title" ).show();
|
54 |
+
$( "#show_color" ).hide();
|
55 |
+
break;
|
56 |
+
case 'floating_toolbar':
|
57 |
+
$( "#button_position" ).show();
|
58 |
+
$( "#toolbar_size" ).hide();
|
59 |
+
$( "#button_style" ).hide();
|
60 |
+
$( "#button_preview" ).hide();
|
61 |
+
$( "#move_mouse" ).hide();
|
62 |
+
$( "#show_icons" ).show();
|
63 |
+
$( "#show_title" ).show();
|
64 |
+
$( "#show_color" ).show();
|
65 |
+
break;
|
66 |
+
}
|
67 |
+
|
68 |
+
button_position = $("input:radio[name=button_position]:checked").val();
|
69 |
+
toolbar_size = $("input:radio[name=select_toolbar_size]:checked").val();
|
70 |
+
icon_type = $("input:radio[name=menu_type]:checked").val();
|
71 |
+
|
72 |
+
bsize = $("input:radio[name=size]:checked").val();
|
73 |
+
var values = bsize.split('x');
|
74 |
+
bheight = values[1];
|
75 |
+
var values2 = values[0].split('n');
|
76 |
+
bwidth = values2[1];
|
77 |
+
|
78 |
+
hupso_url = $.trim($("input:text[name=page_url]").val());
|
79 |
+
hupso_title = $.trim($("input:text[name=page_title]").val());
|
80 |
+
|
81 |
+
hupso_background_color = $.trim($("input:text[name=background_color]").val()).toUpperCase();
|
82 |
+
hupso_border_color = $.trim($("input:text[name=border_color]").val()).toUpperCase();
|
83 |
+
|
84 |
+
switch ( button_type ) {
|
85 |
+
case 'share_button':
|
86 |
+
hupso_services = '<script type="text/javascript">var hupso_services=new Array(';
|
87 |
+
break;
|
88 |
+
case 'floating_toolbar':
|
89 |
+
hupso_services = '<script type="text/javascript">var hupso_services_f=new Array(';
|
90 |
+
break;
|
91 |
+
case 'share_toolbar':
|
92 |
+
hupso_services = '<script type="text/javascript">var hupso_services_t=new Array(';
|
93 |
+
break;
|
94 |
+
}
|
95 |
+
|
96 |
+
if ( $( "input:checkbox[name=twitter]:checked" ).val() == 1 )
|
97 |
+
hupso_services += '"Twitter",';
|
98 |
+
if ( $( "input:checkbox[name=facebook]:checked" ).val() == 1 )
|
99 |
+
hupso_services += '"Facebook",';
|
100 |
+
if ( $( "input:checkbox[name=googleplus]:checked" ).val() == 1 )
|
101 |
+
hupso_services += '"Google Plus",';
|
102 |
+
if ( $( "input:checkbox[name=linkedin]:checked" ).val() == 1 )
|
103 |
+
hupso_services += '"Linkedin",';
|
104 |
+
if ( $( "input:checkbox[name=stumbleupon]:checked" ).val() == 1 )
|
105 |
+
hupso_services += '"StumbleUpon",';
|
106 |
+
if ( $( "input:checkbox[name=digg]:checked" ).val() == 1 )
|
107 |
+
hupso_services += '"Digg",';
|
108 |
+
if ( $( "input:checkbox[name=reddit]:checked" ).val() == 1 )
|
109 |
+
hupso_services += '"Reddit",';
|
110 |
+
if ( $( "input:checkbox[name=bebo]:checked" ).val() == 1 )
|
111 |
+
hupso_services += '"Bebo",';
|
112 |
+
if ( $( "input:checkbox[name=delicious]:checked" ).val() == 1 )
|
113 |
+
hupso_services += '"Delicious",';
|
114 |
+
|
115 |
+
var none = hupso_services.substring(hupso_services.length - 1, hupso_services.length);
|
116 |
+
hupso_services = hupso_services.substring(0, hupso_services.length - 1);
|
117 |
+
if ( none != ',' ) {
|
118 |
+
hupso_services += '();';
|
119 |
+
} else {
|
120 |
+
hupso_services += ');';
|
121 |
+
}
|
122 |
+
|
123 |
+
switch ( button_type ) {
|
124 |
+
case 'share_button':
|
125 |
+
hupso_services += 'var hupso_icon_type = "'+icon_type+'";';
|
126 |
+
break;
|
127 |
+
case 'floating_toolbar':
|
128 |
+
hupso_services += 'var hupso_icon_type_f = "'+icon_type+'";';
|
129 |
+
break;
|
130 |
+
}
|
131 |
+
|
132 |
+
if (hupso_url != "") {
|
133 |
+
if (hupso_url.toLowerCase().indexOf( "http://" ) == -1 )
|
134 |
+
hupso_url = "http://" + hupso_url;
|
135 |
+
|
136 |
+
switch ( button_type ) {
|
137 |
+
case 'share_button':
|
138 |
+
hupso_services += 'var hupso_url="'+encodeURI(hupso_url)+'";';
|
139 |
+
break;
|
140 |
+
case 'floating_toolbar':
|
141 |
+
hupso_services += 'var hupso_url_f="'+encodeURI(hupso_url)+'";';
|
142 |
+
break;
|
143 |
+
case 'share_toolbar':
|
144 |
+
hupso_services += 'var hupso_url_t="'+encodeURI(hupso_url)+'";';
|
145 |
+
break;
|
146 |
+
}
|
147 |
+
|
148 |
+
}
|
149 |
+
|
150 |
+
if (hupso_title != "") {
|
151 |
+
switch ( button_type ) {
|
152 |
+
case 'share_button':
|
153 |
+
hupso_services += 'var hupso_title="'+encodeURI(hupso_title)+'";';
|
154 |
+
break;
|
155 |
+
case 'floating_toolbar':
|
156 |
+
hupso_services += 'var hupso_title_f="'+encodeURI(hupso_title)+'";';
|
157 |
+
break;
|
158 |
+
case 'share_toolbar':
|
159 |
+
hupso_services += 'var hupso_title_t="'+encodeURI(hupso_title)+'";';
|
160 |
+
break;
|
161 |
+
}
|
162 |
+
|
163 |
+
}
|
164 |
+
|
165 |
+
if ( hupso_background_color != '' ) {
|
166 |
+
switch ( button_type ) {
|
167 |
+
case 'share_button':
|
168 |
+
hupso_services += 'var hupso_background="#'+encodeURI(hupso_background_color)+'";';
|
169 |
+
break;
|
170 |
+
case 'floating_toolbar':
|
171 |
+
hupso_services += 'var hupso_background_f="#'+encodeURI(hupso_background_color)+'";';
|
172 |
+
break;
|
173 |
+
case 'share_toolbar':
|
174 |
+
hupso_services += 'var hupso_background_t="#'+encodeURI(hupso_background_color)+'";';
|
175 |
+
break;
|
176 |
+
}
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
if ( hupso_border_color != '' ) {
|
181 |
+
switch ( button_type ) {
|
182 |
+
case 'share_button':
|
183 |
+
hupso_services += 'var hupso_border="#'+encodeURI(hupso_border_color)+'";';
|
184 |
+
break;
|
185 |
+
case 'floating_toolbar':
|
186 |
+
hupso_services += 'var hupso_border_f="#'+encodeURI(hupso_border_color)+'";';
|
187 |
+
break;
|
188 |
+
case 'share_toolbar':
|
189 |
+
hupso_services += 'var hupso_border_t="#'+encodeURI(hupso_border_color)+'";';
|
190 |
+
break;
|
191 |
+
}
|
192 |
+
|
193 |
+
}
|
194 |
+
|
195 |
+
///////////////////////////////////////////
|
196 |
+
if (button_type == 'share_button') {
|
197 |
+
hupso_class = 'hupso_pop';
|
198 |
+
hupso_js = 'share.js';
|
199 |
+
}
|
200 |
+
if (button_type == 'floating_toolbar') {
|
201 |
+
hupso_class = 'hupso_float';
|
202 |
+
hupso_js = 'float.js';
|
203 |
+
bwidth = 0;
|
204 |
+
bheight = 0;
|
205 |
+
if (button_position == 'left') {
|
206 |
+
hupso_services += 'var hupso_float_left_f=true;';
|
207 |
+
}
|
208 |
+
else {
|
209 |
+
hupso_services += 'var hupso_float_right_f=true;';
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
if (button_type == 'share_toolbar') {
|
214 |
+
hupso_class = 'hupso_toolbar';
|
215 |
+
hupso_js = 'share_toolbar.js';
|
216 |
+
|
217 |
+
switch ( toolbar_size ) {
|
218 |
+
case 'big':
|
219 |
+
hupso_services += "var hupso_toolbar_size_t='big';";
|
220 |
+
toolbar_share = 'share';
|
221 |
+
break;
|
222 |
+
case 'medium':
|
223 |
+
hupso_services += "var hupso_toolbar_size_t='medium';";
|
224 |
+
toolbar_share = 'share-medium';
|
225 |
+
break;
|
226 |
+
case 'small':
|
227 |
+
hupso_services += "var hupso_toolbar_size_t='small';";
|
228 |
+
toolbar_share = 'share-small';
|
229 |
+
break;
|
230 |
+
}
|
231 |
+
|
232 |
+
}
|
233 |
+
|
234 |
+
var code = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ -->';
|
235 |
+
code += '<a class="'+hupso_class+'" href="http://www.hupso.com/share/">'; // float: class="hupso_float"
|
236 |
+
|
237 |
+
switch ( button_type ) {
|
238 |
+
case 'share_button':
|
239 |
+
code += '<img src="http://static.hupso.com/share/buttons/'+bsize+'.png" width="'+bwidth+'" height="'+bheight+'" border="0" alt="Share Button"/>';
|
240 |
+
break;
|
241 |
+
case 'share_toolbar':
|
242 |
+
code += '<img src="http://static.hupso.com/share/buttons/'+toolbar_share+'.png" border="0" style="padding-top:5px; float:left;" alt="Social Share Toolbar"/>';
|
243 |
+
break;
|
244 |
+
}
|
245 |
+
|
246 |
+
|
247 |
+
code += '</a>';
|
248 |
+
code += hupso_services;
|
249 |
+
|
250 |
+
// save button code
|
251 |
+
$("input[name=code]").val(code);
|
252 |
+
|
253 |
+
code += '</script>';
|
254 |
+
code += '<script type="text/javascript" src="http://'+cdn+'.hupso.com/share/js/'+dir+hupso_js+'"></script>';
|
255 |
+
code += "<!-- Hupso Share Buttons -->";
|
256 |
+
|
257 |
+
// remove float code
|
258 |
+
for (var i = 0; i < 10; i++ ) {
|
259 |
+
var el = document.getElementById( 'float_hupso_buttons_' + i );
|
260 |
+
if ( el != null) {
|
261 |
+
el.parentNode.removeChild(el);
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
// update preview
|
266 |
+
$( "#button" ).html(code);
|
267 |
+
|
268 |
+
});
|
269 |
+
}
|
270 |
+
|
readme.txt
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
=== Hupso Share Buttons for Twitter, Facebook & Google+ ===
|
2 |
Contributors: kasal
|
|
|
3 |
Tags: twitter, facebook, google+, social, sharing, stumbleupon, addthis, sharethis, sexybookmarks, addtoany, lockerz, shareaholic
|
4 |
Requires at least: 2.8
|
5 |
Tested up to: 3.4
|
6 |
-
Stable tag:
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -11,18 +12,18 @@ Help visitors share your posts on the most popular social networks: Twitter, Fac
|
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
Add simple social sharing buttons to your articles. Your visitors will be able to easily share your content on the most popular social networks:
|
15 |
-
Twitter, Facebook, Google Plus, Linkedin, StumbleUpon, Digg, Reddit, Bebo and Delicous.
|
16 |
|
17 |
These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
|
18 |
|
19 |
Main features / advantages:
|
20 |
|
21 |
* Slick, minimalistic design.
|
22 |
-
* Very small and fast. The code for sharing button is very small (only a few KB), so share buttons will not slow down your website - even on devices with slow network connections.
|
23 |
* All major social networks are supported.
|
|
|
24 |
|
25 |
-
Share Buttons are very easy to configure. Just select button size,
|
26 |
Button will apear below your articles or on top of them as you choose.
|
27 |
|
28 |
[Share Buttons Demo](http://www.hupso.com/share/).
|
@@ -48,20 +49,22 @@ All major social networks are supported: Twitter, Facebook, Google+, Linkedin, S
|
|
48 |
= What settings are available? =
|
49 |
|
50 |
From Settings screen you are able to choose:
|
51 |
-
* button
|
|
|
52 |
* social sharing services
|
53 |
* menu type
|
54 |
* button position (above or below your posts)
|
|
|
55 |
|
56 |
Please look at *Screenshots* for more information.
|
57 |
|
58 |
= Are share buttons using Javascript? =
|
59 |
|
60 |
-
Yes. Javascript is required for sharing buttons to function properly and it must be enabled. Menu interface for share buttons is loaded at run-time from our servers so we can add minor enhancements and fix browser bugs the moment they are discovered without forcing you to upgrade the plugin all the time.
|
61 |
|
62 |
= Are share buttons free? =
|
63 |
|
64 |
-
Yes. Thay are free and will always be free. And you do not need to open
|
65 |
|
66 |
= When will floating toolbars be available? =
|
67 |
|
@@ -70,17 +73,18 @@ Yes. Thay are free and will always be free. And you do not need to open an accou
|
|
70 |
|
71 |
== Screenshots ==
|
72 |
|
73 |
-
1. Share
|
|
|
74 |
2. Share Buttons with drop down menu (icons and service names)
|
75 |
3. Share Buttons with drop down menu (icons only)
|
76 |
-
4. Settings in Wordpress Administration
|
77 |
-
|
78 |
|
79 |
|
80 |
== Changelog ==
|
81 |
|
82 |
-
=
|
83 |
-
|
|
|
84 |
|
85 |
= 1.3 =
|
86 |
* Added options to show/hide social buttons on frontpage and inside categories
|
1 |
=== Hupso Share Buttons for Twitter, Facebook & Google+ ===
|
2 |
Contributors: kasal
|
3 |
+
Donate link: http://www.hupso.com/
|
4 |
Tags: twitter, facebook, google+, social, sharing, stumbleupon, addthis, sharethis, sexybookmarks, addtoany, lockerz, shareaholic
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 3.4
|
7 |
+
Stable tag: 2.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
Add simple social sharing buttons to your articles. Your visitors will be able to easily share your content on the most popular social networks: Twitter, Facebook, Google Plus, Linkedin, StumbleUpon, Digg, Reddit, Bebo and Delicous.
|
|
|
16 |
|
17 |
These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
|
18 |
|
19 |
Main features / advantages:
|
20 |
|
21 |
* Slick, minimalistic design.
|
22 |
+
* Very small and fast. The code for sharing button is very small (only a few KB), so share buttons will not slow down your website - even on devices with slow network connections.
|
23 |
* All major social networks are supported.
|
24 |
+
* Real-time button preview in admin settings
|
25 |
|
26 |
+
Share Buttons are very easy to configure. Just select button type, size, position and which social networking services do you want to offer to your visitors.
|
27 |
Button will apear below your articles or on top of them as you choose.
|
28 |
|
29 |
[Share Buttons Demo](http://www.hupso.com/share/).
|
49 |
= What settings are available? =
|
50 |
|
51 |
From Settings screen you are able to choose:
|
52 |
+
* button type (share button, share toolbar)
|
53 |
+
* button size
|
54 |
* social sharing services
|
55 |
* menu type
|
56 |
* button position (above or below your posts)
|
57 |
+
* display options (options to hide buttons on frontpage and in categories)
|
58 |
|
59 |
Please look at *Screenshots* for more information.
|
60 |
|
61 |
= Are share buttons using Javascript? =
|
62 |
|
63 |
+
Yes. Javascript is required for sharing buttons to function properly and it must be enabled. Menu/toolbar interface for share buttons is loaded at run-time from our servers so we can add minor enhancements and fix browser bugs the moment they are discovered without forcing you to upgrade the plugin all the time. Button images are loaded from your local Wordpress installation.
|
64 |
|
65 |
= Are share buttons free? =
|
66 |
|
67 |
+
Yes. Thay are free and will always be free. And you do not need to open any account to use them.
|
68 |
|
69 |
= When will floating toolbars be available? =
|
70 |
|
73 |
|
74 |
== Screenshots ==
|
75 |
|
76 |
+
1. Share Toolbar and Share Button on the same page (demo)
|
77 |
+
2. Share Toolbar (big)
|
78 |
2. Share Buttons with drop down menu (icons and service names)
|
79 |
3. Share Buttons with drop down menu (icons only)
|
80 |
+
4. Settings in Wordpress Administration (with real-time button preview)
|
|
|
81 |
|
82 |
|
83 |
== Changelog ==
|
84 |
|
85 |
+
= 2.0 =
|
86 |
+
* New button type: share toolbar
|
87 |
+
* Real-time button preview in admin settings
|
88 |
|
89 |
= 1.3 =
|
90 |
* Added options to show/hide social buttons on frontpage and inside categories
|
screenshot-1.png
DELETED
Binary file
|
screenshot-2.png
DELETED
Binary file
|
screenshot-3.png
DELETED
Binary file
|
screenshot-4.png
DELETED
Binary file
|
share-buttons-hupso.php
CHANGED
@@ -3,21 +3,26 @@
|
|
3 |
Plugin Name: Hupso Share Buttons for Twitter, Facebook & Google+
|
4 |
Plugin URI: http://www.hupso.com/share
|
5 |
Description: Add simple social sharing buttons to your articles. Your visitors will be able to easily share your content on the most popular social networks: Twitter, Facebook, Google Plus, Linkedin, StumbleUpon, Digg, Reddit, Bebo and Delicous. These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
|
6 |
-
Version:
|
7 |
Author: kasal
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
*/
|
11 |
|
|
|
|
|
12 |
$hupso_plugin_url = plugins_url() . '/hupso-share-buttons-for-twitter-facebook-google';
|
13 |
add_filter( 'the_content', 'hupso_the_content', 100 );
|
14 |
-
load_plugin_textdomain('share_buttons_hupso', false, dirname( __FILE__ ) . '/languages' );
|
|
|
15 |
|
16 |
if ( is_admin() ) {
|
17 |
-
add_filter(
|
18 |
-
add_action(
|
19 |
}
|
20 |
|
|
|
|
|
21 |
$all_services = array(
|
22 |
'Twitter', 'Facebook', 'Google Plus', 'Linkedin', 'StumbleUpon', 'Digg', 'Reddit', 'Bebo', 'Delicious'
|
23 |
);
|
@@ -30,6 +35,15 @@ function hupso_admin_menu() {
|
|
30 |
add_options_page('', '', 'manage_options', __FILE__, 'hupso_admin_settings_show', '', 6);
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
function hupso_admin_settings_show() {
|
34 |
global $all_services, $default_services, $hupso_plugin_url;
|
35 |
|
@@ -37,52 +51,35 @@ function hupso_admin_settings_show() {
|
|
37 |
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
38 |
}
|
39 |
|
40 |
-
|
|
|
|
|
|
|
41 |
|
42 |
echo '<div class="wrap" style="padding-bottom:100px;"><div class="icon32" id="icon-users"></div>';
|
43 |
echo '<h2>'. __('Hupso Share Buttons for Twitter, Facebook & Google+ (Settings)').'</h2>';
|
44 |
-
echo '<form method="post" action="">';
|
45 |
-
echo '<div style="float:right; padding:
|
|
|
|
|
|
|
|
|
46 |
|
47 |
-
$start = '<!-- Hupso Share Buttons
|
48 |
$end = '<!-- Hupso Share Buttons -->';
|
49 |
$class_name = 'hupso_pop';
|
50 |
$alt = 'Social Sharing Buttons';
|
51 |
-
$class_url = ' href="http://www.hupso.com/share" ';
|
52 |
$style = 'padding-left:5px; padding-top:5px; padding-bottom:5px; margin:0';
|
53 |
|
54 |
-
$button_60_img = '<img style="'.$style.'" src="'.$hupso_plugin_url.'/buttons/button60x14.png" width="60" height="14" border="0" alt="'.$alt.'"/>';
|
55 |
-
$button_60 = $start;
|
56 |
-
$button_60 .= '<a class="'.$class_name.$class_url.'>'.$button_60_img.'</a>';
|
57 |
-
$button_60 .= $js_share;
|
58 |
-
$button_60 .= $end;
|
59 |
-
|
60 |
$button_80_img = '<img style="'.$style.'" src="'.$hupso_plugin_url.'/buttons/button80x19.png" width="80" height="19" border="0" alt="'.$alt.'"/>';
|
61 |
-
$button_80 = $start;
|
62 |
-
$button_80 .= '<a class="'.$class_name.$class_url.'>'.$button_80_img.'</a>';
|
63 |
-
$button_80 .= $js_share;
|
64 |
-
$button_80 .= $end;
|
65 |
-
|
66 |
$button_100_img = '<img style="'.$style.'" src="'.$hupso_plugin_url.'/buttons/button100x23.png" width="100" height="23" border="0" alt="'.$alt.'"/>';
|
67 |
-
$
|
68 |
-
$
|
69 |
-
$button_100 .= $js_share;
|
70 |
-
$button_100 .= $end;
|
71 |
-
|
72 |
-
$button_120_img = '<img style="'.$style.'" src="'.$hupso_plugin_url.'/buttons/button120x28.png" width="120" height="28" border="0" alt="'.$alt.'"/>';
|
73 |
-
$button_120 = $start;
|
74 |
-
$button_120 .= '<a class="'.$class_name.$class_url.'>'.$button_120_img.'</a>';
|
75 |
-
$button_120 .= $js_share;
|
76 |
-
$button_120 .= $end;
|
77 |
-
|
78 |
-
$button_160_img = '<img style="'.$style.'" src="'.$hupso_plugin_url.'/buttons/button160x37.png" width="160" height="37" border="0" alt="'.$alt.'"/>';
|
79 |
-
$button_160 = $start;
|
80 |
-
$button_160 .= '<a class="'.$class_name.$class_url.'>'.$button_160_img.'</a>';
|
81 |
-
$button_160 .= $js_share;
|
82 |
-
$button_160 .= $end;
|
83 |
|
84 |
$checked = 'checked="checked"';
|
85 |
-
$current_button_size = get_option( 'hupso_button_size' , '
|
86 |
switch ( $current_button_size ) {
|
87 |
case 'button60x14' : $button60_checked = $checked; break;
|
88 |
case 'button80x19' : $button80_checked = $checked; break;
|
@@ -90,29 +87,87 @@ function hupso_admin_settings_show() {
|
|
90 |
case 'button120x28' : $button120_checked = $checked; break;
|
91 |
case 'button160x37' : $button160_checked = $checked; break;
|
92 |
default:
|
93 |
-
$
|
94 |
}
|
95 |
|
96 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
<table border="0">
|
98 |
<tr>
|
99 |
-
<td style="width:
|
100 |
<td>
|
101 |
<table border="0">
|
102 |
-
<tr><td><input type="radio" name="
|
103 |
-
<tr><td><input type="radio" name="
|
104 |
-
<tr><td><input type="radio" name="
|
105 |
-
<tr><td><input type="radio" name="
|
106 |
-
<tr><td><input type="radio" name="
|
107 |
</table>
|
108 |
</td>
|
109 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
110 |
<tr>
|
111 |
-
<td style="width:
|
112 |
-
<td
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
</tr>
|
|
|
|
|
|
|
|
|
114 |
<tr>
|
115 |
-
<td><?php _e('Type of menu'); ?></td>
|
116 |
<?php
|
117 |
$menu_type = get_option( 'hupso_menu_type', 'labels' );
|
118 |
$checked = ' checked="checked" ';
|
@@ -123,11 +178,15 @@ function hupso_admin_settings_show() {
|
|
123 |
}
|
124 |
|
125 |
?>
|
126 |
-
<td><hr style="height:1px;"/><input type="radio" name="
|
127 |
-
<input type="radio" name="
|
128 |
</tr>
|
|
|
|
|
|
|
|
|
129 |
<tr>
|
130 |
-
<td><?php _e('Button position'); ?></td>
|
131 |
<?php
|
132 |
$button_position = get_option( 'hupso_button_position', 'below' );
|
133 |
$checked = ' checked="checked" ';
|
@@ -136,14 +195,14 @@ function hupso_admin_settings_show() {
|
|
136 |
case 'above' : $hupso_above_checked = $checked; break;
|
137 |
default: $hupso_below_checked = $checked;
|
138 |
}
|
139 |
-
|
140 |
?>
|
141 |
-
<td><hr style="height:1px;
|
142 |
-
<input type="radio" name="hupso_button_position" value="above" <?php echo $hupso_above_checked; ?> /> <?php _e('Above the post'); ?><br
|
|
|
143 |
</tr>
|
144 |
<tr>
|
145 |
-
<td style="width:
|
146 |
-
<td><hr style="height:1px;"/>
|
147 |
<?php
|
148 |
$checked = ' checked="checked" ';
|
149 |
|
@@ -160,40 +219,53 @@ function hupso_admin_settings_show() {
|
|
160 |
$hupso_show_category_checked = '';
|
161 |
?>
|
162 |
<input type="checkbox" name="hupso_show_frontpage" value="1" <?php echo $hupso_show_frontpage_checked; ?> /> <?php _e('Front page - show social buttons in posts on front page'); ?><br/>
|
163 |
-
<input type="checkbox" name="hupso_show_category" value="1" <?php echo $hupso_show_category_checked; ?> /> <?php _e('Categories - show social buttons in posts when viewing categories, tags
|
164 |
</td>
|
165 |
</tr>
|
166 |
</table>
|
167 |
-
<br/><br/><input class="button-primary" name="submit" type="submit" value="<?php _e('Save Settings'); ?>" />
|
168 |
</form>
|
169 |
</div>
|
|
|
170 |
<?php
|
171 |
}
|
172 |
|
173 |
function hupso_admin_settings_save() {
|
174 |
|
175 |
-
global $all_services, $default_services, $hupso_plugin_url;
|
176 |
-
|
177 |
update_option( 'hupso_custom', '1' );
|
178 |
-
|
179 |
-
|
180 |
-
if ( $_POST[ 'hupso_button_size' ] != '' )
|
181 |
$post = true;
|
182 |
else
|
183 |
$post = false;
|
184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
186 |
/* save button size */
|
187 |
if ( $post ) {
|
188 |
-
$hupso_button_size = $_POST[ '
|
189 |
update_option( 'hupso_button_size', $hupso_button_size );
|
190 |
} else {
|
191 |
-
$hupso_button_size = get_option ( 'hupso_button_size', '
|
192 |
}
|
193 |
-
|
194 |
$b_size = str_replace( 'button', '', $hupso_button_size);
|
195 |
list($width, $height) = split('x', $b_size);
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
/* save services */
|
198 |
$hupso_vars = 'var hupso_services=new Array(';
|
199 |
foreach ( $all_services as $service_text ) {
|
@@ -215,7 +287,7 @@ function hupso_admin_settings_save() {
|
|
215 |
|
216 |
/* save menu type */
|
217 |
if ( $post ) {
|
218 |
-
$hupso_menu_type = $_POST[ '
|
219 |
update_option( 'hupso_menu_type', $hupso_menu_type );
|
220 |
}
|
221 |
else {
|
@@ -223,18 +295,16 @@ function hupso_admin_settings_save() {
|
|
223 |
}
|
224 |
$hupso_vars .= 'var hupso_icon_type = "'.$hupso_menu_type.'";';
|
225 |
|
226 |
-
|
227 |
/* save button position */
|
228 |
if ( $post ) {
|
229 |
$hupso_button_position = $_POST[ 'hupso_button_position' ];
|
230 |
update_option( 'hupso_button_position', $hupso_button_position );
|
231 |
}
|
232 |
else {
|
233 |
-
$hupso_button_position = get_option
|
234 |
}
|
235 |
|
236 |
-
|
237 |
-
// save display options */
|
238 |
if ( $post ) {
|
239 |
$hupso_show_frontpage = $_POST[ 'hupso_show_frontpage' ];
|
240 |
update_option( 'hupso_show_frontpage', $hupso_show_frontpage );
|
@@ -243,26 +313,12 @@ function hupso_admin_settings_save() {
|
|
243 |
update_option( 'hupso_show_category', $hupso_show_category );
|
244 |
}
|
245 |
|
|
|
|
|
|
|
|
|
|
|
246 |
|
247 |
-
/* create and save code */
|
248 |
-
/* all images are server from local Wordpress installation */
|
249 |
-
/* minified button code is served by Hupso Static Server */
|
250 |
-
$static_server = 'http://static.hupso.com/share/js/share.js';
|
251 |
-
$code = '<!-- Hupso Share Buttons (http://www.hupso.com/share) --><a class="hupso_pop" href="http://www.hupso.com/share"><img style="border:0px;" src="'.$hupso_plugin_url.'/buttons/'.$hupso_button_size.'.png" width="'.$width.'" height="'.$height.'" border="0" alt="Share Button"/></a><script type="text/javascript">';
|
252 |
-
$code .= $hupso_vars;
|
253 |
-
update_option( 'hupso_share_buttons_code', $code );
|
254 |
-
|
255 |
-
/* create preview */
|
256 |
-
$msg .= '<h3>' . __('Button Preview'). '</h3><br/>';
|
257 |
-
$msg .= $code . '</script>';
|
258 |
-
$msg .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
|
259 |
-
|
260 |
-
$msg .= '<br/><br/>';
|
261 |
-
$msg .= __('Move your mouse over the button above to see the sharing menu.');
|
262 |
-
$msg .= '<br/><br/><br/>';
|
263 |
-
$msg .= '<input class="button-primary" name="submit" type="submit" value="' . __('Update Preview') . '" /> ';
|
264 |
-
|
265 |
-
return $msg;
|
266 |
}
|
267 |
|
268 |
|
@@ -276,7 +332,7 @@ function hupso_the_content( $content ) {
|
|
276 |
}
|
277 |
|
278 |
$post_url = get_permalink($GLOBALS['post']->ID);
|
279 |
-
|
280 |
$hupso_show_frontpage = get_option( 'hupso_show_frontpage' , '1' );
|
281 |
$hupso_show_category = get_option( 'hupso_show_category' , '1' );
|
282 |
|
@@ -289,10 +345,12 @@ function hupso_the_content( $content ) {
|
|
289 |
return $content;
|
290 |
}
|
291 |
|
|
|
292 |
/* default code */
|
293 |
-
$share_code = '<!-- Hupso Share Buttons
|
294 |
|
295 |
-
$code = get_option( 'hupso_share_buttons_code', $share_code );
|
|
|
296 |
|
297 |
/* Check for old saved button code, prior to version 1.3 */
|
298 |
if ( get_option( 'hupso_custom', '0' ) == 0 ) {
|
@@ -306,19 +364,49 @@ function hupso_the_content( $content ) {
|
|
306 |
}
|
307 |
}
|
308 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
if ( ( is_home() && $hupso_show_frontpage == 1 ) || ( is_archive() && $hupso_show_category == 1 ) ) {
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
}
|
312 |
|
313 |
$code .= '</script>';
|
314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
$code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
|
316 |
|
317 |
$position = get_option( 'hupso_button_position', 'below' );
|
318 |
if ($position == 'below')
|
319 |
$new_content = $content . $code;
|
320 |
else
|
321 |
-
$new_content = $code . $content;
|
322 |
|
323 |
return $new_content;
|
324 |
}
|
@@ -337,7 +425,7 @@ function hupso_settings_print_services() {
|
|
337 |
$checked = 'checked="checked"';
|
338 |
}
|
339 |
$text =' <img src="' . $hupso_plugin_url . '/img/services/' . $service_name . '.png"/> ' . $service_text;
|
340 |
-
echo '<input type="checkbox" name="' . $service_name . '" value="1" ' . $checked . ' /> ' . $text . '<br/>';
|
341 |
}
|
342 |
}
|
343 |
|
3 |
Plugin Name: Hupso Share Buttons for Twitter, Facebook & Google+
|
4 |
Plugin URI: http://www.hupso.com/share
|
5 |
Description: Add simple social sharing buttons to your articles. Your visitors will be able to easily share your content on the most popular social networks: Twitter, Facebook, Google Plus, Linkedin, StumbleUpon, Digg, Reddit, Bebo and Delicous. These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
|
6 |
+
Version: 2.0
|
7 |
Author: kasal
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
*/
|
11 |
|
12 |
+
|
13 |
+
|
14 |
$hupso_plugin_url = plugins_url() . '/hupso-share-buttons-for-twitter-facebook-google';
|
15 |
add_filter( 'the_content', 'hupso_the_content', 100 );
|
16 |
+
load_plugin_textdomain( 'share_buttons_hupso', false, dirname( __FILE__ ) . '/languages' );
|
17 |
+
|
18 |
|
19 |
if ( is_admin() ) {
|
20 |
+
add_filter('plugin_action_links', 'hupso_plugin_action_links', 10, 2);
|
21 |
+
add_action('admin_menu', 'hupso_admin_menu');
|
22 |
}
|
23 |
|
24 |
+
add_action( 'admin_head', 'hupso_admin_head' );
|
25 |
+
|
26 |
$all_services = array(
|
27 |
'Twitter', 'Facebook', 'Google Plus', 'Linkedin', 'StumbleUpon', 'Digg', 'Reddit', 'Bebo', 'Delicious'
|
28 |
);
|
35 |
add_options_page('', '', 'manage_options', __FILE__, 'hupso_admin_settings_show', '', 6);
|
36 |
}
|
37 |
|
38 |
+
function hupso_admin_head() {
|
39 |
+
if ( is_admin() ) {
|
40 |
+
wp_enqueue_script(
|
41 |
+
'hupso_create_button',
|
42 |
+
plugins_url('/js/create_button.js', __FILE__ )
|
43 |
+
);
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
function hupso_admin_settings_show() {
|
48 |
global $all_services, $default_services, $hupso_plugin_url;
|
49 |
|
51 |
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
52 |
}
|
53 |
|
54 |
+
/* save settings */
|
55 |
+
if ( $_POST[ 'size' ] != '' ) {
|
56 |
+
hupso_admin_settings_save();
|
57 |
+
}
|
58 |
|
59 |
echo '<div class="wrap" style="padding-bottom:100px;"><div class="icon32" id="icon-users"></div>';
|
60 |
echo '<h2>'. __('Hupso Share Buttons for Twitter, Facebook & Google+ (Settings)').'</h2>';
|
61 |
+
echo '<form name="hupso_settings_form" method="post" action="">';
|
62 |
+
echo '<div id="button_preview" style="float:right; width:405px; padding: 10px 10px 10px 10px; margin-right:10px; margin-left:20px; margin-top:20px; background: #F7FFBF;"><h3>Preview:</h3><br/>';
|
63 |
+
echo '<div id="button"></div>';
|
64 |
+
echo '<div id="move_mouse"><p style="font-size:13px; padding-top: 15px;"><b>Move your mouse over the button to see the sharing menu.</b></p></div><br/><br/>';
|
65 |
+
//echo '<input class="button-primary" name="submit-preview" type="submit" onclick="hupso_create_code()" value="' . __('Save Settings') . '" />';
|
66 |
+
echo '</div>';
|
67 |
|
68 |
+
$start = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ -->';
|
69 |
$end = '<!-- Hupso Share Buttons -->';
|
70 |
$class_name = 'hupso_pop';
|
71 |
$alt = 'Social Sharing Buttons';
|
72 |
+
$class_url = ' href="http://www.hupso.com/share/" ';
|
73 |
$style = 'padding-left:5px; padding-top:5px; padding-bottom:5px; margin:0';
|
74 |
|
75 |
+
$button_60_img = '<img style="'.$style.'" src="'.$hupso_plugin_url.'/buttons/button60x14.png" width="60" height="14" border="0" alt="'.$alt.'"/>';
|
|
|
|
|
|
|
|
|
|
|
76 |
$button_80_img = '<img style="'.$style.'" src="'.$hupso_plugin_url.'/buttons/button80x19.png" width="80" height="19" border="0" alt="'.$alt.'"/>';
|
|
|
|
|
|
|
|
|
|
|
77 |
$button_100_img = '<img style="'.$style.'" src="'.$hupso_plugin_url.'/buttons/button100x23.png" width="100" height="23" border="0" alt="'.$alt.'"/>';
|
78 |
+
$button_120_img = '<img style="'.$style.'" src="'.$hupso_plugin_url.'/buttons/button120x28.png" width="120" height="28" border="0" alt="'.$alt.'"/>';
|
79 |
+
$button_160_img = '<img style="'.$style.'" src="'.$hupso_plugin_url.'/buttons/button160x37.png" width="160" height="37" border="0" alt="'.$alt.'"/>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
$checked = 'checked="checked"';
|
82 |
+
$current_button_size = get_option( 'hupso_button_size' , 'button100x23' );
|
83 |
switch ( $current_button_size ) {
|
84 |
case 'button60x14' : $button60_checked = $checked; break;
|
85 |
case 'button80x19' : $button80_checked = $checked; break;
|
87 |
case 'button120x28' : $button120_checked = $checked; break;
|
88 |
case 'button160x37' : $button160_checked = $checked; break;
|
89 |
default:
|
90 |
+
$button100_checked = $checked; break;
|
91 |
}
|
92 |
|
93 |
?>
|
94 |
+
|
95 |
+
<input type="hidden" name="code" value="" />
|
96 |
+
<br/>
|
97 |
+
<div id="button_type">
|
98 |
+
<table border="0">
|
99 |
+
<tr>
|
100 |
+
<td style="width:100px;"><?php _e('Button type'); ?>
|
101 |
+
</td>
|
102 |
+
<?php
|
103 |
+
$hupso_button_type = get_option( 'hupso_button_type', 'share_toolbar' );
|
104 |
+
$checked = ' checked="checked" ';
|
105 |
+
switch ( $hupso_button_type ) {
|
106 |
+
case 'share_button': $hupso_share_button_checked = $checked; break;
|
107 |
+
case 'share_toolbar': $hupso_share_toolbar_checked = $checked; break;
|
108 |
+
default: $hupso_share_toolbar_checked = $checked;
|
109 |
+
}
|
110 |
+
?>
|
111 |
+
<td><input type="radio" name="button_type" onclick="hupso_create_code()" value="share_button" <?php echo $hupso_share_button_checked; ?> /> Share Button <br/><img src="<?php echo $hupso_plugin_url.'/buttons/button100x23.png';?>" /><br/><br/>
|
112 |
+
<input type="radio" name="button_type" onclick="hupso_create_code()" value="share_toolbar" <?php echo $hupso_share_toolbar_checked; ?> /> Share Toolbar<br/><img src="<?php echo $hupso_plugin_url.'/img/share_toolbar_short.png';?>" />
|
113 |
+
</td>
|
114 |
+
</tr>
|
115 |
+
<tr><td></td><td><hr style="height:1px; width:200px;"/></td></tr>
|
116 |
+
</table>
|
117 |
+
</div>
|
118 |
+
|
119 |
+
<div id="button_style">
|
120 |
<table border="0">
|
121 |
<tr>
|
122 |
+
<td style="width:100px;"><?php _e('Button size'); ?></td>
|
123 |
<td>
|
124 |
<table border="0">
|
125 |
+
<tr><td><input type="radio" name="size" value="button60x14" onclick="hupso_create_code()" <?php echo $button60_checked; ?> /></td><td style="padding-right:10px;"><?php echo $button_60_img ?></td></tr>
|
126 |
+
<tr><td><input type="radio" name="size" value="button80x19" onclick="hupso_create_code()" <?php echo $button80_checked; ?>/></td><td style="padding-right:10px;"><?php echo $button_80_img ?></td></tr>
|
127 |
+
<tr><td><input type="radio" name="size" value="button100x23" onclick="hupso_create_code()" <?php echo $button100_checked; ?>/></td><td style="padding-right:10px;"><?php echo $button_100_img ?></td></tr>
|
128 |
+
<tr><td><input type="radio" name="size" value="button120x28" onclick="hupso_create_code()" <?php echo $button120_checked; ?>/></td><td style="padding-right:10px;"><?php echo $button_120_img ?></td></tr>
|
129 |
+
<tr><td><input type="radio" name="size" value="button160x37" onclick="hupso_create_code()" <?php echo $button160_checked; ?>/></td><td style="padding-right:20px;"><?php echo $button_160_img ?></td></tr>
|
130 |
</table>
|
131 |
</td>
|
132 |
</tr>
|
133 |
+
</table>
|
134 |
+
</div>
|
135 |
+
|
136 |
+
<div id="toolbar_size" style="display:none;">
|
137 |
+
<table border="0">
|
138 |
<tr>
|
139 |
+
<td style="width:100px;"><?php _e('Toolbar size'); ?></td>
|
140 |
+
<td style="width:100px">
|
141 |
+
<?php
|
142 |
+
$hupso_toolbar_size = get_option( 'hupso_toolbar_size', 'medium' );
|
143 |
+
$checked = ' checked="checked" ';
|
144 |
+
switch ( $hupso_toolbar_size ) {
|
145 |
+
case 'big': $hupso_toolbar_size_big_checked = $checked; break;
|
146 |
+
case 'medium' : $hupso_toolbar_size_medium_checked = $checked; break;
|
147 |
+
case 'small' : $hupso_toolbar_size_small_checked = $checked; break;
|
148 |
+
default: $hupso_toolbar_size_medium_checked = $checked;
|
149 |
+
}
|
150 |
+
?>
|
151 |
+
<input type="radio" name="select_toolbar_size" value="big" onclick="hupso_create_code()" <?php echo $hupso_toolbar_size_big_checked; ?> /> Big<br/>
|
152 |
+
<input type="radio" name="select_toolbar_size" value="medium" onclick="hupso_create_code()" <?php echo $hupso_toolbar_size_medium_checked; ?> /> Medium<br/>
|
153 |
+
<input type="radio" name="select_toolbar_size" value="small" onclick="hupso_create_code()" <?php echo $hupso_toolbar_size_small_checked; ?> /> Small<br/>
|
154 |
+
</tr>
|
155 |
+
</table>
|
156 |
+
</div>
|
157 |
+
|
158 |
+
|
159 |
+
|
160 |
+
<table border="0">
|
161 |
+
<tr>
|
162 |
+
<td style="width:100px;"><?php _e('Social networks'); ?></td>
|
163 |
+
<td><hr style="height:1px; width:200px;"/><?php hupso_settings_print_services(); ?></td>
|
164 |
</tr>
|
165 |
+
</table>
|
166 |
+
|
167 |
+
<div id="show_icons">
|
168 |
+
<table border="0">
|
169 |
<tr>
|
170 |
+
<td style="width:100px;"><?php _e('Type of menu'); ?></td>
|
171 |
<?php
|
172 |
$menu_type = get_option( 'hupso_menu_type', 'labels' );
|
173 |
$checked = ' checked="checked" ';
|
178 |
}
|
179 |
|
180 |
?>
|
181 |
+
<td><hr style="height:1px; width:200px;"/><input type="radio" name="menu_type" value="labels" onclick="hupso_create_code()" <?php echo $hupso_labels_checked; ?> /> <?php _e('Show icons and service names'); ?><br/>
|
182 |
+
<input type="radio" name="menu_type" value="icons" onclick="hupso_create_code()" <?php echo $hupso_icons_checked; ?> /> <?php _e('Show icons only'); ?><br/></td>
|
183 |
</tr>
|
184 |
+
</table>
|
185 |
+
</div>
|
186 |
+
|
187 |
+
<table border="0">
|
188 |
<tr>
|
189 |
+
<td style="width:100px;"><?php _e('Button position'); ?></td>
|
190 |
<?php
|
191 |
$button_position = get_option( 'hupso_button_position', 'below' );
|
192 |
$checked = ' checked="checked" ';
|
195 |
case 'above' : $hupso_above_checked = $checked; break;
|
196 |
default: $hupso_below_checked = $checked;
|
197 |
}
|
|
|
198 |
?>
|
199 |
+
<td><hr style="height:1px; width:200px;" align="left"/>
|
200 |
+
<input type="radio" name="hupso_button_position" value="above" <?php echo $hupso_above_checked; ?> /> <?php _e('Above the post'); ?><br/>
|
201 |
+
<input type="radio" name="hupso_button_position" value="below" <?php echo $hupso_below_checked; ?> /> <?php _e('Below the post'); ?><br/></td>
|
202 |
</tr>
|
203 |
<tr>
|
204 |
+
<td style="width:100px;"><?php _e('Display options'); ?></td>
|
205 |
+
<td><hr style="height:1px; width:200px;" align="left"/>
|
206 |
<?php
|
207 |
$checked = ' checked="checked" ';
|
208 |
|
219 |
$hupso_show_category_checked = '';
|
220 |
?>
|
221 |
<input type="checkbox" name="hupso_show_frontpage" value="1" <?php echo $hupso_show_frontpage_checked; ?> /> <?php _e('Front page - show social buttons in posts on front page'); ?><br/>
|
222 |
+
<input type="checkbox" name="hupso_show_category" value="1" <?php echo $hupso_show_category_checked; ?> /> <?php _e('Categories - show social buttons in posts when viewing categories, tags or dates'); ?><br/>
|
223 |
</td>
|
224 |
</tr>
|
225 |
</table>
|
226 |
+
<br/><br/><input class="button-primary" name="submit" type="submit" onclick="hupso_create_code()" value="<?php _e('Save Settings'); ?>" />
|
227 |
</form>
|
228 |
</div>
|
229 |
+
|
230 |
<?php
|
231 |
}
|
232 |
|
233 |
function hupso_admin_settings_save() {
|
234 |
|
235 |
+
global $all_services, $default_services, $hupso_plugin_url;
|
|
|
236 |
update_option( 'hupso_custom', '1' );
|
237 |
+
|
238 |
+
if ( $_POST[ 'size' ] != '' )
|
|
|
239 |
$post = true;
|
240 |
else
|
241 |
$post = false;
|
242 |
|
243 |
+
/* save button type */
|
244 |
+
if ( $post ) {
|
245 |
+
$hupso_button_type = $_POST[ 'button_type' ];
|
246 |
+
update_option( 'hupso_button_type', $hupso_button_type );
|
247 |
+
} else {
|
248 |
+
$hupso_button_type = get_option ( 'hupso_button_type', 'share_toolbar');
|
249 |
+
}
|
250 |
|
251 |
/* save button size */
|
252 |
if ( $post ) {
|
253 |
+
$hupso_button_size = $_POST[ 'size' ];
|
254 |
update_option( 'hupso_button_size', $hupso_button_size );
|
255 |
} else {
|
256 |
+
$hupso_button_size = get_option ( 'hupso_button_size', 'button100x23');
|
257 |
}
|
|
|
258 |
$b_size = str_replace( 'button', '', $hupso_button_size);
|
259 |
list($width, $height) = split('x', $b_size);
|
260 |
+
|
261 |
+
/* save toolbar size */
|
262 |
+
if ( $post ) {
|
263 |
+
$hupso_toolbar_size = $_POST[ 'select_toolbar_size' ];
|
264 |
+
update_option( 'hupso_toolbar_size', $hupso_toolbar_size );
|
265 |
+
} else {
|
266 |
+
$hupso_button_size = get_option ( 'hupso_toolbar_size', 'medium');
|
267 |
+
}
|
268 |
+
|
269 |
/* save services */
|
270 |
$hupso_vars = 'var hupso_services=new Array(';
|
271 |
foreach ( $all_services as $service_text ) {
|
287 |
|
288 |
/* save menu type */
|
289 |
if ( $post ) {
|
290 |
+
$hupso_menu_type = $_POST[ 'menu_type' ];
|
291 |
update_option( 'hupso_menu_type', $hupso_menu_type );
|
292 |
}
|
293 |
else {
|
295 |
}
|
296 |
$hupso_vars .= 'var hupso_icon_type = "'.$hupso_menu_type.'";';
|
297 |
|
|
|
298 |
/* save button position */
|
299 |
if ( $post ) {
|
300 |
$hupso_button_position = $_POST[ 'hupso_button_position' ];
|
301 |
update_option( 'hupso_button_position', $hupso_button_position );
|
302 |
}
|
303 |
else {
|
304 |
+
$hupso_button_position = get_option( 'hupso_button_position', 'below' );
|
305 |
}
|
306 |
|
307 |
+
/* save display options */
|
|
|
308 |
if ( $post ) {
|
309 |
$hupso_show_frontpage = $_POST[ 'hupso_show_frontpage' ];
|
310 |
update_option( 'hupso_show_frontpage', $hupso_show_frontpage );
|
313 |
update_option( 'hupso_show_category', $hupso_show_category );
|
314 |
}
|
315 |
|
316 |
+
/* save button code */
|
317 |
+
if ( $post ) {
|
318 |
+
$code = stripslashes($_POST[ 'code' ]);
|
319 |
+
update_option( 'hupso_share_buttons_code', $code );
|
320 |
+
}
|
321 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
}
|
323 |
|
324 |
|
332 |
}
|
333 |
|
334 |
$post_url = get_permalink($GLOBALS['post']->ID);
|
335 |
+
|
336 |
$hupso_show_frontpage = get_option( 'hupso_show_frontpage' , '1' );
|
337 |
$hupso_show_category = get_option( 'hupso_show_category' , '1' );
|
338 |
|
345 |
return $content;
|
346 |
}
|
347 |
|
348 |
+
|
349 |
/* default code */
|
350 |
+
$share_code = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ --><a class="hupso_toolbar" href="http://www.hupso.com/share/"><img src="http://static.hupso.com/share/buttons/share-medium.png" border="0" style="padding-top:5px; float:left;" alt="Social Share Toolbar"/></a><script type="text/javascript">var hupso_services_t=new Array("Twitter","Facebook","Google Plus","Linkedin","StumbleUpon","Digg","Reddit","Bebo","Delicious"); var hupso_toolbar_size_t="medium";';
|
351 |
|
352 |
+
$code = get_option( 'hupso_share_buttons_code', $share_code );
|
353 |
+
$button_type = get_option( 'hupso_button_type', 'share_toolbar' );
|
354 |
|
355 |
/* Check for old saved button code, prior to version 1.3 */
|
356 |
if ( get_option( 'hupso_custom', '0' ) == 0 ) {
|
364 |
}
|
365 |
}
|
366 |
|
367 |
+
/* Check for old saved button code, prior to version 2.0 */
|
368 |
+
$old_check = strpos( $code, 'hupso_pop' );
|
369 |
+
if ( $old_check !== false ) {
|
370 |
+
$button_type = 'share_button';
|
371 |
+
}
|
372 |
+
$old_check = strpos( $code, 'hupso_toolbar' );
|
373 |
+
if ( $old_check !== false ) {
|
374 |
+
$button_type = 'share_toolbar';
|
375 |
+
}
|
376 |
+
|
377 |
+
|
378 |
if ( ( is_home() && $hupso_show_frontpage == 1 ) || ( is_archive() && $hupso_show_category == 1 ) ) {
|
379 |
+
|
380 |
+
switch ( $button_type ) {
|
381 |
+
case 'share_button':
|
382 |
+
$code .= 'var hupso_url="' . $post_url . '";';
|
383 |
+
break;
|
384 |
+
case 'share_toolbar':
|
385 |
+
$code .= 'var hupso_url_t="' . $post_url . '";';
|
386 |
+
break;
|
387 |
+
}
|
388 |
+
|
389 |
}
|
390 |
|
391 |
$code .= '</script>';
|
392 |
+
|
393 |
+
switch ( $button_type ) {
|
394 |
+
case 'share_button':
|
395 |
+
$js_file = 'share.js';
|
396 |
+
break;
|
397 |
+
case 'share_toolbar':
|
398 |
+
$js_file = 'share_toolbar.js';
|
399 |
+
break;
|
400 |
+
}
|
401 |
+
|
402 |
+
$static_server = 'http://static.hupso.com/share/js/' . $js_file;
|
403 |
$code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
|
404 |
|
405 |
$position = get_option( 'hupso_button_position', 'below' );
|
406 |
if ($position == 'below')
|
407 |
$new_content = $content . $code;
|
408 |
else
|
409 |
+
$new_content = $code . '<br/>' . $content;
|
410 |
|
411 |
return $new_content;
|
412 |
}
|
425 |
$checked = 'checked="checked"';
|
426 |
}
|
427 |
$text =' <img src="' . $hupso_plugin_url . '/img/services/' . $service_name . '.png"/> ' . $service_text;
|
428 |
+
echo '<input type="checkbox" name="' . $service_name . '" value="1" onclick="hupso_create_code()" ' . $checked . ' /> ' . $text . '<br/>';
|
429 |
}
|
430 |
}
|
431 |
|