Simple Social Media Share Buttons – Social Sharing for Everyone - Version 1.3

Version Description

  • Converted plugin to class (requires PHP 5, because it is using the constructor auto-method)
  • Added sorting options
  • Added uninstall hook
  • Fixed plugin settings slot not being highlighted in the admin navigation / general settings
  • Added "disable regular CSS" option to let advanced users use their own CSS code
  • Lots of fine-tuning
Download this release

Release Info

Developer xradar
Plugin Icon 128x128 Simple Social Media Share Buttons – Social Sharing for Everyone
Version 1.3
Comparing to
See all releases

Code changes from version 1.2 to 1.3

lang/simplesocialbuttons-pl_PL.mo CHANGED
Binary file
lang/simplesocialbuttons-pl_PL.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: simplesocialbuttons\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2011-09-20 09:50+0100\n"
6
- "PO-Revision-Date: 2011-09-20 09:51+0100\n"
7
  "Last-Translator: Paweł Rabinek <pawel@rabinek.pl>\n"
8
  "Language-Team: Paweł Rabinek <pawel@rabinek.pl>\n"
9
  "MIME-Version: 1.0\n"
@@ -15,7 +15,7 @@ msgstr ""
15
  "X-Poedit-SourceCharset: utf-8\n"
16
  "X-Poedit-SearchPath-0: ..\n"
17
 
18
- #: ../simple-social-buttons.php:199
19
  #: ../ssb-admin.php:11
20
  msgid "Settings"
21
  msgstr "Ustawienia"
@@ -24,157 +24,167 @@ msgstr "Ustawienia"
24
  msgid "<strong>Simple Social Buttons</strong> by <strong>Paweł Rabinek</strong>. This plugin adds a social media buttons, such as: <strong>Google +1</strong>, <strong>Facebook Like it</strong> and <strong>Twitter share</strong>. The most flexible social buttons plugin ever."
25
  msgstr "<strong>Simple Social Buttons</strong>, autor <strong>Paweł Rabinek</strong>. Wtyczka dodaje do wpisów przyciski: <strong>Google +1</strong>, <strong>Facebook Lubię to</strong> oraz <strong>Twitter</strong>. Najlepsza wtyczka z przyciskami social media dla Wordpress."
26
 
27
- #: ../ssb-admin.php:90
28
  msgid "Select buttons"
29
  msgstr "Wybór przycisków"
30
 
31
- #: ../ssb-admin.php:92
32
  msgid "Select social media buttons:"
33
  msgstr "Wybierz przyciski do wyświetlenia:"
34
 
35
- #: ../ssb-admin.php:94
 
 
 
 
 
 
36
  msgid "Google plus one (+1)"
37
  msgstr "Google plus jeden (+1)"
38
 
39
- #: ../ssb-admin.php:95
40
  msgid "Facebook Like it"
41
  msgstr "Facebook Lubię to"
42
 
43
- #: ../ssb-admin.php:96
44
  msgid "Twitter share"
45
  msgstr "Wyślij na Twitter"
46
 
47
- #: ../ssb-admin.php:101
 
 
 
 
48
  msgid "Single posts - display settings"
49
  msgstr "Pojedyńcze wpisy - ustawienia"
50
 
51
- #: ../ssb-admin.php:103
52
  msgid "Place buttons on single post:"
53
  msgstr "Miejsce przycisków na podstronie wpisu:"
54
 
55
- #: ../ssb-admin.php:104
56
- #: ../ssb-admin.php:128
57
  msgid "Before the content"
58
  msgstr "Nad treścią wpisu"
59
 
60
- #: ../ssb-admin.php:105
61
- #: ../ssb-admin.php:129
62
  msgid "After the content"
63
  msgstr "Pod treścią wpisu"
64
 
65
- #: ../ssb-admin.php:110
66
  msgid "Single pages - display settings"
67
  msgstr "Pojedyńcze strony - ustawienia"
68
 
69
- #: ../ssb-admin.php:112
70
  msgid "Place buttons on single pages:"
71
  msgstr "Miejsce przycisków na stronach:"
72
 
73
- #: ../ssb-admin.php:113
74
  msgid "Before the page content"
75
  msgstr "Nad treścią strony"
76
 
77
- #: ../ssb-admin.php:114
78
  msgid "After the page content"
79
  msgstr "Pod treścią strony"
80
 
81
- #: ../ssb-admin.php:119
82
  msgid "Archives - display settings"
83
  msgstr "Archiwa - ustawienia"
84
 
85
- #: ../ssb-admin.php:121
86
  msgid "Select additional places to display buttons:"
87
  msgstr "Dodatkowe miejsca do wyświetlenia przycisków:"
88
 
89
- #: ../ssb-admin.php:122
90
  msgid "Show at frontpage"
91
  msgstr "Pokazuj na stronie głównej"
92
 
93
- #: ../ssb-admin.php:123
94
  msgid "Show at category pages"
95
  msgstr "Pokazuj na stroniach kategorii"
96
 
97
- #: ../ssb-admin.php:124
98
  msgid "Show at archive pages"
99
  msgstr "Pokazuje w archiwum dat"
100
 
101
- #: ../ssb-admin.php:125
102
  msgid "Show at tag pages"
103
  msgstr "Pokazuj na stronach tagów"
104
 
105
- #: ../ssb-admin.php:127
106
  msgid "Place buttons on archives:"
107
  msgstr "Miejsce przycisków na stronach archiwum:"
108
 
109
- #: ../ssb-admin.php:135
110
- msgid "Save settings"
111
  msgstr "Zapisz ustawienia"
112
 
113
- #: ../ssb-admin.php:145
114
  msgid "About this plugin:"
115
  msgstr "Informacje o wtyczce:"
116
 
117
- #: ../ssb-admin.php:147
118
  msgid "Talk to <a href=\"http://twitter.com/rabinek\" target=\"_blank\">@rabinek</a> on twitter for bugs or feature requests."
119
  msgstr "Napisz do mnie <a href=\"http://twitter.com/rabinek\" target=\"_blank\">@rabinek</a> na Twitterze, jeżeli znalazłeś błąd lub masz pomysł na ulepszenie wtyczki."
120
 
121
- #: ../ssb-admin.php:148
122
  msgid "Enjoy the plugin?"
123
  msgstr "Podoba Ci się wtyczka?"
124
 
125
- #: ../ssb-admin.php:149
126
  msgid "<a href=\"http://twitter.com/?status=I'm using @rabinek's WordPress Simple Social Buttons plugin - check it out! http://blog.rabinek.pl/\" target=\"_blank\">Tweet about it</a> and consider donating."
127
  msgstr "<a href=\"http://twitter.com/?status=Używam wtyczki do Wordpressa od @rabinek - WordPress Simple Social Buttons! http://blog.rabinek.pl/\" target=\"_blank\">Powiedz o niej na Twitterze</a> i rozważ wsparcie dla tej wtyczki (poniżej)."
128
 
129
- #: ../ssb-admin.php:150
130
  msgid "<strong>Donate:</strong> A lot of hard work goes into building plugins - support your open source developers. Thank you!"
131
  msgstr "<strong>Wsparcie:</strong> Wiele pracy trzeba włożyć w napisanie takiej wtyczki. Jeżeli korzystasz z niej i podoba Ci się, postaw mi piwo klikając Donate."
132
 
133
- #: ../ssb-admin.php:162
134
  msgid "About the author:"
135
  msgstr "Informacje o autorze:"
136
 
137
- #: ../ssb-admin.php:164
138
  msgid "Hi! My name is Paweł Rabinek (aka xradar). I'm interesed in SEO and social media, PHP and Wordpress developement."
139
  msgstr "Hej! Nazywam się Paweł Rabinek (nick xradar). Zawodowo zajmuje się SEO i mediami społecznościowymi. Programuję w PHP, często z wykorzystaniem Wordpressa."
140
 
141
- #: ../ssb-admin.php:166
142
  msgid "My blog about SEO"
143
  msgstr "Mój blog o SEO"
144
 
145
- #: ../ssb-admin.php:166
146
  msgid "[Polish]"
147
  msgstr " "
148
 
149
- #: ../ssb-admin.php:167
150
  msgid "Follow me on Twitter"
151
  msgstr "Napisz do mnie na Twitter"
152
 
153
- #: ../ssb-admin.php:168
154
  msgid "Paweł Rabinek on Facebook"
155
  msgstr "Paweł Rabinek na Facebook"
156
 
157
- #: ../ssb-admin.php:169
158
  msgid "Paweł Rabinek on Google Plus"
159
  msgstr "Paweł Rabinek na Google Plus"
160
 
161
- #: ../ssb-admin.php:170
162
  msgid "LinkedIn profile"
163
  msgstr "Profil na LinkedIn"
164
 
165
- #: ../ssb-admin.php:176
166
  msgid "Usefull links:"
167
  msgstr "Przydatne linki:"
168
 
169
- #: ../ssb-admin.php:179
170
  msgid "Unlimited web hosting"
171
  msgstr "Nielimitowany hosting stron"
172
 
173
- #: ../ssb-admin.php:180
174
  msgid "Best SEO software"
175
  msgstr "Najlepsze oprogramowanie SEO"
176
 
177
- #: ../ssb-admin.php:181
178
  msgid "Wordpress templates"
179
  msgstr "Szablony do Wordpress"
180
 
2
  msgstr ""
3
  "Project-Id-Version: simplesocialbuttons\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-09-26 15:07+0100\n"
6
+ "PO-Revision-Date: 2011-09-26 15:08+0100\n"
7
  "Last-Translator: Paweł Rabinek <pawel@rabinek.pl>\n"
8
  "Language-Team: Paweł Rabinek <pawel@rabinek.pl>\n"
9
  "MIME-Version: 1.0\n"
15
  "X-Poedit-SourceCharset: utf-8\n"
16
  "X-Poedit-SearchPath-0: ..\n"
17
 
18
+ #: ../simple-social-buttons.php:397
19
  #: ../ssb-admin.php:11
20
  msgid "Settings"
21
  msgstr "Ustawienia"
24
  msgid "<strong>Simple Social Buttons</strong> by <strong>Paweł Rabinek</strong>. This plugin adds a social media buttons, such as: <strong>Google +1</strong>, <strong>Facebook Like it</strong> and <strong>Twitter share</strong>. The most flexible social buttons plugin ever."
25
  msgstr "<strong>Simple Social Buttons</strong>, autor <strong>Paweł Rabinek</strong>. Wtyczka dodaje do wpisów przyciski: <strong>Google +1</strong>, <strong>Facebook Lubię to</strong> oraz <strong>Twitter</strong>. Najlepsza wtyczka z przyciskami social media dla Wordpress."
26
 
27
+ #: ../ssb-admin.php:68
28
  msgid "Select buttons"
29
  msgstr "Wybór przycisków"
30
 
31
+ #: ../ssb-admin.php:70
32
  msgid "Select social media buttons:"
33
  msgstr "Wybierz przyciski do wyświetlenia:"
34
 
35
+ #: ../ssb-admin.php:76
36
+ #: ../ssb-admin.php:90
37
+ #: ../ssb-admin.php:105
38
+ msgid "inactive"
39
+ msgstr "nieaktywny"
40
+
41
+ #: ../ssb-admin.php:84
42
  msgid "Google plus one (+1)"
43
  msgstr "Google plus jeden (+1)"
44
 
45
+ #: ../ssb-admin.php:98
46
  msgid "Facebook Like it"
47
  msgstr "Facebook Lubię to"
48
 
49
+ #: ../ssb-admin.php:113
50
  msgid "Twitter share"
51
  msgstr "Wyślij na Twitter"
52
 
53
+ #: ../ssb-admin.php:116
54
+ msgid "Disable plugin CSS (only advanced users)"
55
+ msgstr "Wyłącz style CSS wtyczki (tylko dla zaawansowanych użytkowników)"
56
+
57
+ #: ../ssb-admin.php:121
58
  msgid "Single posts - display settings"
59
  msgstr "Pojedyńcze wpisy - ustawienia"
60
 
61
+ #: ../ssb-admin.php:123
62
  msgid "Place buttons on single post:"
63
  msgstr "Miejsce przycisków na podstronie wpisu:"
64
 
65
+ #: ../ssb-admin.php:124
66
+ #: ../ssb-admin.php:148
67
  msgid "Before the content"
68
  msgstr "Nad treścią wpisu"
69
 
70
+ #: ../ssb-admin.php:125
71
+ #: ../ssb-admin.php:149
72
  msgid "After the content"
73
  msgstr "Pod treścią wpisu"
74
 
75
+ #: ../ssb-admin.php:130
76
  msgid "Single pages - display settings"
77
  msgstr "Pojedyńcze strony - ustawienia"
78
 
79
+ #: ../ssb-admin.php:132
80
  msgid "Place buttons on single pages:"
81
  msgstr "Miejsce przycisków na stronach:"
82
 
83
+ #: ../ssb-admin.php:133
84
  msgid "Before the page content"
85
  msgstr "Nad treścią strony"
86
 
87
+ #: ../ssb-admin.php:134
88
  msgid "After the page content"
89
  msgstr "Pod treścią strony"
90
 
91
+ #: ../ssb-admin.php:139
92
  msgid "Archives - display settings"
93
  msgstr "Archiwa - ustawienia"
94
 
95
+ #: ../ssb-admin.php:141
96
  msgid "Select additional places to display buttons:"
97
  msgstr "Dodatkowe miejsca do wyświetlenia przycisków:"
98
 
99
+ #: ../ssb-admin.php:142
100
  msgid "Show at frontpage"
101
  msgstr "Pokazuj na stronie głównej"
102
 
103
+ #: ../ssb-admin.php:143
104
  msgid "Show at category pages"
105
  msgstr "Pokazuj na stroniach kategorii"
106
 
107
+ #: ../ssb-admin.php:144
108
  msgid "Show at archive pages"
109
  msgstr "Pokazuje w archiwum dat"
110
 
111
+ #: ../ssb-admin.php:145
112
  msgid "Show at tag pages"
113
  msgstr "Pokazuj na stronach tagów"
114
 
115
+ #: ../ssb-admin.php:147
116
  msgid "Place buttons on archives:"
117
  msgstr "Miejsce przycisków na stronach archiwum:"
118
 
119
+ #: ../ssb-admin.php:155
120
+ msgid "Save Changes"
121
  msgstr "Zapisz ustawienia"
122
 
123
+ #: ../ssb-admin.php:165
124
  msgid "About this plugin:"
125
  msgstr "Informacje o wtyczce:"
126
 
127
+ #: ../ssb-admin.php:167
128
  msgid "Talk to <a href=\"http://twitter.com/rabinek\" target=\"_blank\">@rabinek</a> on twitter for bugs or feature requests."
129
  msgstr "Napisz do mnie <a href=\"http://twitter.com/rabinek\" target=\"_blank\">@rabinek</a> na Twitterze, jeżeli znalazłeś błąd lub masz pomysł na ulepszenie wtyczki."
130
 
131
+ #: ../ssb-admin.php:168
132
  msgid "Enjoy the plugin?"
133
  msgstr "Podoba Ci się wtyczka?"
134
 
135
+ #: ../ssb-admin.php:169
136
  msgid "<a href=\"http://twitter.com/?status=I'm using @rabinek's WordPress Simple Social Buttons plugin - check it out! http://blog.rabinek.pl/\" target=\"_blank\">Tweet about it</a> and consider donating."
137
  msgstr "<a href=\"http://twitter.com/?status=Używam wtyczki do Wordpressa od @rabinek - WordPress Simple Social Buttons! http://blog.rabinek.pl/\" target=\"_blank\">Powiedz o niej na Twitterze</a> i rozważ wsparcie dla tej wtyczki (poniżej)."
138
 
139
+ #: ../ssb-admin.php:170
140
  msgid "<strong>Donate:</strong> A lot of hard work goes into building plugins - support your open source developers. Thank you!"
141
  msgstr "<strong>Wsparcie:</strong> Wiele pracy trzeba włożyć w napisanie takiej wtyczki. Jeżeli korzystasz z niej i podoba Ci się, postaw mi piwo klikając Donate."
142
 
143
+ #: ../ssb-admin.php:182
144
  msgid "About the author:"
145
  msgstr "Informacje o autorze:"
146
 
147
+ #: ../ssb-admin.php:184
148
  msgid "Hi! My name is Paweł Rabinek (aka xradar). I'm interesed in SEO and social media, PHP and Wordpress developement."
149
  msgstr "Hej! Nazywam się Paweł Rabinek (nick xradar). Zawodowo zajmuje się SEO i mediami społecznościowymi. Programuję w PHP, często z wykorzystaniem Wordpressa."
150
 
151
+ #: ../ssb-admin.php:186
152
  msgid "My blog about SEO"
153
  msgstr "Mój blog o SEO"
154
 
155
+ #: ../ssb-admin.php:186
156
  msgid "[Polish]"
157
  msgstr " "
158
 
159
+ #: ../ssb-admin.php:187
160
  msgid "Follow me on Twitter"
161
  msgstr "Napisz do mnie na Twitter"
162
 
163
+ #: ../ssb-admin.php:188
164
  msgid "Paweł Rabinek on Facebook"
165
  msgstr "Paweł Rabinek na Facebook"
166
 
167
+ #: ../ssb-admin.php:189
168
  msgid "Paweł Rabinek on Google Plus"
169
  msgstr "Paweł Rabinek na Google Plus"
170
 
171
+ #: ../ssb-admin.php:190
172
  msgid "LinkedIn profile"
173
  msgstr "Profil na LinkedIn"
174
 
175
+ #: ../ssb-admin.php:196
176
  msgid "Usefull links:"
177
  msgstr "Przydatne linki:"
178
 
179
+ #: ../ssb-admin.php:199
180
  msgid "Unlimited web hosting"
181
  msgstr "Nielimitowany hosting stron"
182
 
183
+ #: ../ssb-admin.php:200
184
  msgid "Best SEO software"
185
  msgstr "Najlepsze oprogramowanie SEO"
186
 
187
+ #: ../ssb-admin.php:201
188
  msgid "Wordpress templates"
189
  msgstr "Szablony do Wordpress"
190
 
readme.txt CHANGED
@@ -4,13 +4,13 @@ Donate link: http://blog.rabinek.pl/
4
  Tags: facebook, google, twitter, plus one, like it, like, share
5
  Requires at least: 2.8
6
  Tested up to: 3.2.1
7
- Stable tag: 1.1
8
 
9
- Insert and customize social buttons: Facebook Like it, Google plus +1 and Twitter share. Share your content with friends.
10
 
11
  == Description ==
12
 
13
- Simple Social Buttons adds to your posts social network buttons, such as: Facebook "Like it!", Google plus on "+1" and Twitter share. Plugin is fully customizable. You can decide where to put those buttons:
14
 
15
  - Buttons above the post content
16
  - Buttons under the post content
@@ -24,18 +24,26 @@ That's not all. Simple Social Buttons can also add social media buttons to:
24
  - Date Archives
25
  - Tags Archives
26
 
27
- Let your visitors share your content with friends and let them promote your blog. Facebook, Google plus and Twitter are the most popular social networks nowadays. Don't miss the opportunity, and help publish your content and links to those social media networks.
 
 
28
 
29
  Simple Social Buttons is currently in the following languages:
30
 
31
  - English
32
- - French, thanks to [@RhooManu](https://twitter.com/RhooManu "RhooManu on Twitter")
33
  - Polish (język polski)
34
 
35
  Feel free if you want to create a translation of this plugin. Contact me via e-mail or Twitter [@rabinek](https://twitter.com/rabinek "Paweł Rabinek on Twitter"), and I'll add your's translation to Simple Social Buttons.
36
 
37
  For more information about Wordpress and SEO, visit my [SEO Blog](http://blog.rabinek.pl "Paweł Rabinek - Blog SEO") (in polish).
38
 
 
 
 
 
 
 
39
  == Installation ==
40
 
41
  1. Download the latest version of Simple Social Buttons
@@ -48,21 +56,21 @@ That's it. Buttons will show on your blog posts.
48
 
49
  == Frequently Asked Questions ==
50
 
51
- = Is the plugin free? =
52
 
53
- Yes, it's free. I hope you like it :) If so you can buy me a coffee by doing paypal donate.
54
 
55
- = Is the plug will be developed? =
56
 
57
- Yes. I've some plans about developing Simple Social Buttons. There will be more buttons, more customization, and more powerfull! Follow me on Twitter [@rabinek](http://twitter.com/rabinek "Paweł Rabinek na Twitter") and stay tuned.
58
 
59
  = Why use this plugin? =
60
 
61
- This plugin automatically adds the Facebook Like button, Google plus one +1 and Twitter share button for each post on your blog. This is the simples and effective way to promote your blog in social media networks.
62
 
63
- = How about support? =
64
 
65
- Follow me at Twitter [@rabinek](http://twitter.com/rabinek "Paweł Rabinek na Twitter") or send me a mention. I'll reply as soon as I get it.
66
 
67
  == Screenshots ==
68
 
@@ -76,6 +84,17 @@ Follow me at Twitter [@rabinek](http://twitter.com/rabinek "Paweł Rabinek na Tw
76
  = 1.0 =
77
  * First stable release.
78
 
79
- = 1.1 =
80
  * Added french translation
81
  * Added language support in Facebook and Google+ JavaScript
 
 
 
 
 
 
 
 
 
 
 
4
  Tags: facebook, google, twitter, plus one, like it, like, share
5
  Requires at least: 2.8
6
  Tested up to: 3.2.1
7
+ Stable tag: 1.3
8
 
9
+ Insert and customize social buttons: Facebook Like it, Google plus +1 and Twitter share. Share your content with friends.
10
 
11
  == Description ==
12
 
13
+ Simple Social Buttons adds to your posts social network buttons, such as: **Facebook "Like it!"**, **Google plus on "+1"** and **Twitter share**. Plugin is fully customizable. You can decide where to put those buttons:
14
 
15
  - Buttons above the post content
16
  - Buttons under the post content
24
  - Date Archives
25
  - Tags Archives
26
 
27
+ Want's more? Now you can change the **order of buttons** on your post!
28
+
29
+ Let your visitors share your content with friends and let them **promote your blog**. Facebook, Google Plus and Twitter are the most popular social networks nowadays. Don't miss the opportunity, and help publish your content and links to those social media networks.
30
 
31
  Simple Social Buttons is currently in the following languages:
32
 
33
  - English
34
+ - French
35
  - Polish (język polski)
36
 
37
  Feel free if you want to create a translation of this plugin. Contact me via e-mail or Twitter [@rabinek](https://twitter.com/rabinek "Paweł Rabinek on Twitter"), and I'll add your's translation to Simple Social Buttons.
38
 
39
  For more information about Wordpress and SEO, visit my [SEO Blog](http://blog.rabinek.pl "Paweł Rabinek - Blog SEO") (in polish).
40
 
41
+ **Big thanks to:**
42
+
43
+ - [@RhooManu](http://twitter.com/RhooManu "RhooManu on Twitter") for french translation
44
+ - [Usability Idealist](http://usability-idealist.de/ "Fabian Wolf - Usability Idealist") for converting code to object-oriented, adding buttons order and many fixes
45
+
46
+
47
  == Installation ==
48
 
49
  1. Download the latest version of Simple Social Buttons
56
 
57
  == Frequently Asked Questions ==
58
 
59
+ = Is the plugin free? =
60
 
61
+ Yes, it's free. I hope you like it :) If so you can buy me a coffee by doing paypal donate.
62
 
63
+ = Is the plug will be developed? =
64
 
65
+ Yes. I've some plans about developing Simple Social Buttons. There will be more buttons, more customization, and more powerfull! Follow me on Twitter [@rabinek](http://twitter.com/rabinek "Paweł Rabinek na Twitter") and stay tuned.
66
 
67
  = Why use this plugin? =
68
 
69
+ This plugin automatically adds the Facebook Like button, Google plus one +1 and Twitter share button for each post on your blog. This is the simples and effective way to promote your blog in social media networks.
70
 
71
+ = How about support? =
72
 
73
+ Follow me at Twitter [@rabinek](http://twitter.com/rabinek "Paweł Rabinek na Twitter") or send me a mention. I'll reply as soon as I get it. You can also visit my [SEO Blog](http://blog.rabinek.pl "Paweł Rabinek - Blog SEO") (in polish).
74
 
75
  == Screenshots ==
76
 
84
  = 1.0 =
85
  * First stable release.
86
 
87
+ = 1.1 =
88
  * Added french translation
89
  * Added language support in Facebook and Google+ JavaScript
90
+
91
+ = 1.2.1 =
92
+ * Optimized settings storage
93
+
94
+ = 1.3 =
95
+ * Converted plugin to class (requires PHP 5, because it is using the constructor auto-method)
96
+ * Added sorting options
97
+ * Added uninstall hook
98
+ * Fixed plugin settings slot not being highlighted in the admin navigation / general settings
99
+ * Added "disable regular CSS" option to let advanced users use their own CSS code
100
+ * Lots of fine-tuning
simple-social-buttons.php CHANGED
@@ -1,17 +1,17 @@
1
  <?php
2
- /*
3
- Plugin Name: Simple Social Buttons
4
- Plugin URI: http://blog.rabinek.pl/
5
- Description: Insert social buttons into posts and archives: Facebook "Like it", Google Plus One "+1" and Twitter share.
6
- Author: Paweł Rabinek
7
- Version: 1.0
8
  Author URI: http://blog.rabinek.pl/
9
  */
10
 
11
  /* Copyright 2011, Paweł Rabinek (xradar) (email : pawel@rabinek.pl)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
- it under the terms of the GNU General Public License, version 2, as
15
  published by the Free Software Foundation.
16
 
17
  This program is distributed in the hope that it will be useful,
@@ -24,207 +24,388 @@
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
 
27
- function ssb_include_social_js() {
28
- $lang = get_bloginfo("language");
29
- $lang_g = strtolower(substr($lang, 0, 2));
30
- $lang_fb = str_replace("-", "_", $lang);
31
- ?>
 
 
32
 
33
- <!-- Simple Social Buttons plugin -->
34
- <script type="text/javascript" src="https://apis.google.com/js/plusone.js">
35
- //<![CDATA[
36
- {lang: '<?php echo $lang_g; ?>'}
37
- //]]>
38
- </script>
39
- <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
40
- <script type="text/javascript" src="http://connect.facebook.net/<?php echo $lang_fb; ?>/all.js#xfbml=1"></script>
41
- <!-- End of Simple Social Buttons -->
42
 
43
- <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
 
46
- add_action('wp_footer', 'ssb_include_social_js');
 
 
47
 
48
- function ssb_include_css() { ?>
 
 
49
 
50
- <!-- Simple Social Buttons style sheet -->
51
- <style type="text/css">
52
- div.simplesocialbuttons { height: 20px; margin: 10px auto 10px 0; text-align: center; clear: left; }
53
- div.simplesocialbutton { float: left; text-align: center; }
54
- </style>
55
- <!-- End of Simple Social Buttons -->
56
 
57
- <?php }
 
 
 
58
 
59
- add_action('wp_head', 'ssb_include_css');
 
60
 
 
 
 
 
 
61
 
62
- //insert the buttons after post contents
63
- function ssb_insert_buttons($content) {
64
 
65
- if(!ssb_where_to_insert()) {
66
- return $content;
67
- }
68
-
69
- // get post permalink
70
- $permalink = get_permalink();
71
- $title = get_the_title();
72
-
73
- // get settings from database
74
- $ssb_googleplus = get_option('ssb_googleplus');
75
- $ssb_fblike = get_option('ssb_fblike');
76
- $ssb_twitter = get_option('ssb_twitter');
77
-
78
- $ssb_beforepost = get_option('ssb_beforepost');
79
- $ssb_afterpost = get_option('ssb_afterpost');
80
-
81
- $ssb_beforepage = get_option('ssb_beforepage');
82
- $ssb_afterpage = get_option('ssb_afterpage');
83
-
84
- $ssb_beforearchive = get_option('ssb_beforearchive');
85
- $ssb_afterarchive = get_option('ssb_afterarchive');
86
-
87
-
88
- $ssb_buttonscode = '<div class="simplesocialbuttons">'."\n";
89
- if($ssb_googleplus) {
90
- $ssb_buttonscode .= '<div class="simplesocialbutton"><!-- Google Plus One--><g:plusone size="medium" count="true" href="'.$permalink.'"></g:plusone></div>'."\n";
91
- }
92
- if($ssb_fblike) {
93
- $ssb_buttonscode .= '<div class="simplesocialbutton"><!-- Facebook like--><div id="fb-root"></div><fb:like href="'.$permalink.'" send="false" layout="button_count" width="100" show_faces="false" action="like" font=""></fb:like></div>'."\n";
94
- }
95
- if($ssb_twitter) {
96
- $ssb_buttonscode .= '<div class="simplesocialbutton"><!-- Twitter--><a name="twitter_share" data-count="horizontal" href="http://twitter.com/share" data-text="'.$title.'" data-url="'.$permalink.'" class="twitter-share-button" rel="nofollow"></a></div>'."\n";
97
- }
98
- $ssb_buttonscode .= '</div>'."\n";
99
-
100
-
101
- if(is_single()) {
102
- if($ssb_beforepost) {
103
- $content = $ssb_buttonscode.$content;
104
- }
105
- if($ssb_afterpost) {
106
- $content = $content.$ssb_buttonscode;
107
- }
108
- }else if(is_page()) {
109
- if($ssb_beforepage) {
110
- $content = $ssb_buttonscode.$content;
111
- }
112
- if($ssb_afterpage) {
113
- $content = $content.$ssb_buttonscode;
114
- }
115
- }else{
116
- if($ssb_beforearchive) {
117
- $content = $ssb_buttonscode.$content;
118
- }
119
- if($ssb_afterarchive) {
120
- $content = $content.$ssb_buttonscode;
121
- }
122
- }
123
-
124
- return $content;
125
 
126
-
127
- }
 
128
 
129
- function ssb_where_to_insert()
130
- {
131
-
132
- // display on single post?
133
- $ssb_beforepost = get_option('ssb_beforepost');
134
- $ssb_afterpost = get_option('ssb_afterpost');
135
- if(is_single() && ($ssb_beforepost || $ssb_afterpost))
136
- {
137
- return true;
138
- }
139
-
140
- // display on single page?
141
- $ssb_beforepage = get_option('ssb_beforepage');
142
- $ssb_afterpage = get_option('ssb_afterpage');
143
- if(is_page() && ($ssb_beforepage || $ssb_afterpage))
144
- {
145
- return true;
146
- }
147
-
148
- // display on frontpage, categories, archives, tags?
149
- $ssb_showfront = get_option('ssb_showfront');
150
- $ssb_showcategory = get_option('ssb_showcategory');
151
- $ssb_showarchive = get_option('ssb_showarchive');
152
- $ssb_showtag = get_option('ssb_showtag');
153
-
154
- if(is_front_page() && $ssb_showfront)
155
- {
156
- return true;
157
- }
158
-
159
- if(is_category() && $ssb_showcategory)
160
- {
161
- return true;
162
- }
163
-
164
- if(is_date() && $ssb_showarchive)
165
- {
166
- return true;
167
- }
168
-
169
- if(is_tag() && $ssb_showtag)
170
- {
171
- return true;
172
- }
173
- return false;
174
- }
175
 
176
- add_filter ('the_content', 'ssb_insert_buttons');
177
- add_filter ('the_excerpt', 'ssb_insert_buttons');
 
178
 
179
- function ssb_menu()
180
- {
181
- global $wpdb;
182
- include 'ssb-admin.php';
183
- }
184
 
185
- function ssb_admin_actions()
186
- {
187
- add_options_page("Simple Social Buttons ", "Simple Social Buttons ", 1, "simple-social-buttons", "ssb_menu");
188
- }
189
-
190
- add_action('admin_menu', 'ssb_admin_actions');
191
-
192
-
193
-
194
- add_filter('plugin_action_links', 'ssb_plugin_action_links', 10, 2);
195
-
196
- function ssb_plugin_action_links($links, $file) {
197
- static $this_plugin;
198
-
199
- if (!$this_plugin) {
200
- $this_plugin = plugin_basename(__FILE__);
201
- }
202
-
203
- if ($file == $this_plugin) {
204
- // The "page" query string value must be equal to the slug
205
- // of the Settings admin page we defined earlier, which in
206
- // this case equals "myplugin-settings".
207
- $settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=simple-social-buttons">'.__("Settings", "simplesocialbuttons").'</a>';
208
- array_unshift($links, $settings_link);
209
- }
210
-
211
- return $links;
212
- }
213
 
214
- // install and default settings
215
- function ssb_set_defaults()
216
- {
217
- add_option( "ssb_googleplus", "1", "", "yes" );
218
- add_option( "ssb_fblike", "1", "", "yes" );
219
- add_option( "ssb_twitter", "1", "", "yes" );
220
- add_option( "ssb_beforepost", "1", "", "yes" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
222
- register_activation_hook( __FILE__, 'ssb_set_defaults' );
223
 
224
- function ssb_init()
225
- {
226
- load_plugin_textdomain( 'simplesocialbuttons', '', dirname(plugin_basename( __FILE__ ))."/lang" );
 
227
  }
228
- add_action( 'init', 'ssb_init' );
229
 
230
  ?>
1
  <?php
2
+ /*
3
+ Plugin Name: Simple Social Buttons
4
+ Plugin URI: http://blog.rabinek.pl/simple-social-buttons-wordpress/
5
+ Description: Insert social buttons into posts and archives: Facebook "Like it", Google Plus One "+1" and Twitter share.
6
+ Author: Paweł Rabinek
7
+ Version: 1.3
8
  Author URI: http://blog.rabinek.pl/
9
  */
10
 
11
  /* Copyright 2011, Paweł Rabinek (xradar) (email : pawel@rabinek.pl)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
+ it under the terms of the GNU General Public License, version 2, as
15
  published by the Free Software Foundation.
16
 
17
  This program is distributed in the hope that it will be useful,
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
 
27
+ /**
28
+ * HACK: Converted to class, added buttons ordering, improve saving settings
29
+ * @author Fabian Wolf
30
+ * @link http://usability-idealist.de/
31
+ * @since 1.3
32
+ * @requires PHP 5
33
+ */
34
 
 
 
 
 
 
 
 
 
 
35
 
36
+ class SimpleSocialButtonsPR {
37
+ var $pluginName = 'Simple Social Buttons';
38
+ var $pluginVersion = '1.3';
39
+ var $pluginPrefix = 'ssb_pr_';
40
+
41
+ // plugin default settings
42
+ var $pluginDefaultSettings = array(
43
+ 'googleplus' => '1',
44
+ 'fblike' => '2',
45
+ 'twitter' => '3',
46
+ 'beforepost' => '1',
47
+ 'afterpost' => '0',
48
+ 'beforepage' => '1',
49
+ 'afterpage' => '0',
50
+ 'beforearchive' => '0',
51
+ 'afterarchive' => '0'
52
+ );
53
+
54
+ // defined buttons
55
+ var $arrKnownButtons = array('fblike', 'googleplus', 'twitter');
56
 
57
 
58
+ /**
59
+ * Constructor
60
+ */
61
 
62
+ function __construct() {
63
+ register_activation_hook( __FILE__, array(&$this, 'plugin_install') );
64
+ register_deactivation_hook( __FILE__, array(&$this, 'plugin_uninstall') );
65
 
66
+ /**
67
+ * Action hooks
68
+ */
 
 
 
69
 
70
+ /**
71
+ * basic init
72
+ */
73
+ add_action( 'init', array(&$this, 'plugin_init') );
74
 
75
+ // get settings
76
+ $currentSettings = $this->get_settings();
77
 
78
+ // social JS + CSS data
79
+ add_action( 'wp_footer', array(&$this, 'include_social_js') );
80
+ if(!isset($currentSettings['override_css'])) {
81
+ add_action( 'wp_head', array(&$this, 'include_css') );
82
+ }
83
 
 
 
84
 
85
+ /**
86
+ * Filter hooks
87
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
+ add_filter( 'the_content', array(&$this, 'insert_buttons') );
90
+ add_filter( 'the_excerpt', array(&$this, 'insert_buttons') );
91
+ }
92
 
93
+ function plugin_init() {
94
+ load_plugin_textdomain( 'simplesocialbuttons', '', dirname( plugin_basename( __FILE__ ) ).'/lang' );
95
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
+ /**
98
+ * Both avoids time-wasting https calls AND provides better SSL-protection if the current server is accessed using HTTPS
99
+ */
100
 
101
+ public function get_current_http( $echo = true ) {
102
+ $return = 'http' . (strtolower($_SERVER['HTTPS']) == 'on' ? 's' : '') . '://';
 
 
 
103
 
104
+ if($echo != false) {
105
+ echo $return;
106
+ return;
107
+ }
108
+
109
+ return $return;
110
+ }
111
+
112
+ function include_social_js() {
113
+ $lang = get_bloginfo('language');
114
+ $lang_g = strtolower(substr($lang, 0, 2));
115
+ $lang_fb = str_replace('-', '_', $lang);
116
+ ?>
117
+
118
+ <!-- Simple Social Buttons plugin -->
119
+ <script type="text/javascript" src="<?php $this->get_current_http(); ?>apis.google.com/js/plusone.js">
120
+ //<![CDATA[
121
+ {lang: '<?php echo $lang_g; ?>'}
122
+ //]]>
123
+ </script>
124
+ <script type="text/javascript" src="<?php $this->get_current_http(); ?>platform.twitter.com/widgets.js"></script>
125
+ <script type="text/javascript" src="<?php $this->get_current_http(); ?>connect.facebook.net/<?php echo $lang_fb; ?>/all.js#xfbml=1"></script>
126
+ <!-- /End of Simple Social Buttons -->
 
 
 
 
 
127
 
128
+ <?php
129
+ }
130
+
131
+
132
+ function include_css() {
133
+ ?>
134
+
135
+ <!-- Simple Social Buttons style sheet -->
136
+ <style type="text/css">
137
+ div.simplesocialbuttons { height: 20px; margin: 10px auto 10px 0; text-align: center; clear: left; }
138
+ div.simplesocialbutton { float: left; text-align: center; }
139
+ </style>
140
+ <!-- End of Simple Social Buttons -->
141
+
142
+ <?php
143
+ }
144
+
145
+ /**
146
+ * Called when installing = activating the plugin
147
+ */
148
+
149
+ function plugin_install() {
150
+ $defaultSettings = $this->check_old_settings();
151
+
152
+ /**
153
+ * @see http://codex.wordpress.org/Function_Reference/add_option
154
+ * @param string $name Name of the option to be added. Use underscores to separate words, and do not use uppercase - this is going to be placed into the database.
155
+ * @param mixed $value Value for this option name. Limited to 2^32 bytes of data.
156
+ * @param string $deprecated Deprecated in WordPress Version 2.3.
157
+ * @param string $autoload Should this option be automatically loaded by the function wp_load_alloptions() (puts options into object cache on each page load)? Valid values: yes or no. Default: yes
158
+ */
159
+ add_option( $this->pluginPrefix . 'settings', $defaultSettings, '', 'yes' );
160
+ add_option( $this->pluginPrefix . 'version', $this->pluginVersion, '', 'yes' ); // for backward-compatiblity checks
161
+
162
+ }
163
+
164
+ /**
165
+ * Backward compatiblity for newer versions
166
+ */
167
+
168
+ function check_old_settings() {
169
+ $return = $this->pluginDefaultSettings;
170
+
171
+ $oldSettings = get_option( $this->pluginPrefix . 'settings', array() );
172
+
173
+ if( !empty($oldSettings) && is_array($oldSettings) != false) {
174
+ $return = wp_parse_args( $oldSettings, $this->pluginDefaultSettings );
175
+ }
176
+
177
+ return $return;
178
+ }
179
+
180
+ /**
181
+ * Plugin unistall and database clean up
182
+ */
183
+
184
+ function plugin_uninstall() {
185
+ if( !defined( 'ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') ) {
186
+ exit();
187
+ }
188
+
189
+ delete_option( $this->pluginPrefix . 'settings' );
190
+ delete_option( $this->pluginPrefix . 'version' );
191
+
192
+ }
193
+
194
+
195
+ /**
196
+ * Get settings from database
197
+ */
198
+
199
+ public function get_settings() {
200
+ $return = get_option($this->pluginPrefix . 'settings' );
201
+ if(empty($return) != false) {
202
+ $return = $this->pluginDefaultSettings;
203
+ }
204
+
205
+ return $return;
206
+ }
207
+
208
+ /**
209
+ * Update settings
210
+ */
211
+ function update_settings( $newSettings = array() ) {
212
+ $return = false;
213
+
214
+ // compile settings
215
+ $currentSettings = $this->get_settings();
216
+
217
+ /**
218
+ * Compile settings array
219
+ * @see http://codex.wordpress.org/Function_Reference/wp_parse_args
220
+ * @param mixed $args
221
+ * @param mixed $defaults
222
+ */
223
+
224
+ $updatedSettings = wp_parse_args( $newSettings, $currentSettings );
225
+
226
+ if($currentSettings != $updatedSettings ) {
227
+ $return = update_option( $this->pluginPrefix . 'settings', $newSettings );
228
+ }
229
+
230
+ return $return;
231
+ }
232
+
233
+ /**
234
+ * Returns true on pages where buttons should be shown
235
+ */
236
+
237
+ function where_to_insert() {
238
+ $return = false;
239
+ // get settings from database
240
+ $settings = $this->get_settings();
241
+
242
+ extract( $settings, EXTR_PREFIX_ALL, 'ssb' );
243
+
244
+ // display on single post?
245
+ if(is_single() && ($ssb_beforepost || $ssb_afterpost)) {
246
+ $return = true;
247
+ }
248
+
249
+ // display on single page?
250
+ if(is_page() && ($ssb_beforepage || $ssb_afterpage)) {
251
+ $return = true;
252
+ }
253
+
254
+ // display on frontpage?
255
+ if(is_front_page() && $ssb_showfront) {
256
+ $return = true;
257
+ }
258
+
259
+ // display on category archive?
260
+ if(is_category() && $ssb_showcategory) {
261
+ $return = true;
262
+ }
263
+
264
+ // display on date archive?
265
+ if(is_date() && $ssb_showarchive)
266
+ {
267
+ $return = true;
268
+ }
269
+
270
+ // display on tag archive?
271
+ if(is_tag() && $ssb_showtag) {
272
+ $return = true;
273
+ }
274
+ return $return;
275
+ }
276
+
277
+ /**
278
+ * Insert the buttons to the content
279
+ */
280
+ function insert_buttons($content) {
281
+
282
+ // Insert or not?
283
+ if(!$this->where_to_insert() ) {
284
+ return $content;
285
+ }
286
+
287
+ // define empty buttons code to use
288
+ $ssb_buttonscode = '';
289
+
290
+ // get post permalink and title
291
+ $permalink = get_permalink();
292
+ $title = get_the_title();
293
+
294
+ // get settings from database
295
+ $settings = $this->get_settings();
296
+
297
+ extract( $settings, EXTR_PREFIX_ALL, 'ssb' );
298
+
299
+ /**
300
+ * Sorting the buttons
301
+ */
302
+
303
+ foreach($this->arrKnownButtons as $button_name) {
304
+ if(!empty($settings[$button_name]) ) {
305
+ $arrButtons[$button_name] = $settings[$button_name];
306
+ }
307
+ }
308
+ asort($arrButtons);
309
+
310
+ foreach($arrButtons as $button_name => $button_sort) {
311
+ switch($button_name) {
312
+ case 'googleplus':
313
+ $arrButtonsCode[] = '<div class="simplesocialbutton ssb-button-googleplus"><!-- Google Plus One--><g:plusone size="medium" count="true" href="'.$permalink.'"></g:plusone></div>';
314
+ break;
315
+ case 'fblike':
316
+ $arrButtonsCode[] = '<div class="simplesocialbutton ssb-button-fblike"><!-- Facebook like--><div id="fb-root"></div><fb:like href="'.$permalink.'" send="false" layout="button_count" width="100" show_faces="false" action="like" font=""></fb:like></div>';
317
+ break;
318
+ case 'twitter':
319
+ $arrButtonsCode[] = '<div class="simplesocialbutton ssb-buttom-twitter"><!-- Twitter--><a name="twitter_share" data-count="horizontal" href="http://twitter.com/share" data-text="'.$title.'" data-url="'.$permalink.'" class="twitter-share-button" rel="nofollow"></a></div>';
320
+ break;
321
+ }
322
+ }
323
+
324
+
325
+ if(isset($arrButtonsCode) != false) {
326
+ $ssb_buttonscode = '<div class="simplesocialbuttons">'."\n";
327
+ $ssb_buttonscode .= implode("\n", $arrButtonsCode) . "\n";
328
+ $ssb_buttonscode .= '</div>'."\n";
329
+ }
330
+
331
+ if(is_single()) {
332
+ if($ssb_beforepost) {
333
+ $content = $ssb_buttonscode.$content;
334
+ }
335
+ if($ssb_afterpost) {
336
+ $content = $content.$ssb_buttonscode;
337
+ }
338
+ } else if(is_page()) {
339
+ if($ssb_beforepage) {
340
+ $content = $ssb_buttonscode.$content;
341
+ }
342
+ if($ssb_afterpage) {
343
+ $content = $content.$ssb_buttonscode;
344
+ }
345
+ } else {
346
+ if($ssb_beforearchive) {
347
+ $content = $ssb_buttonscode.$content;
348
+ }
349
+ if($ssb_afterarchive) {
350
+ $content = $content.$ssb_buttonscode;
351
+ }
352
+ }
353
+
354
+ return $content;
355
+
356
+ }
357
+
358
+
359
+ } // end class
360
+
361
+
362
+ /**
363
+ * Admin class
364
+ *
365
+ * Gets only initiated if this plugin is called inside the admin section ;)
366
+ */
367
+
368
+ class SimpleSocialButtonsPR_Admin extends SimpleSocialButtonsPR {
369
+
370
+ function __construct() {
371
+ parent::__construct();
372
+
373
+ add_action('admin_menu', array(&$this, 'admin_actions') );
374
+ add_filter('plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2 );
375
+ }
376
+
377
+ public function admin_actions() {
378
+ add_options_page('Simple Social Buttons ', 'Simple Social Buttons ', 1, 'simple-social-buttons', array(&$this, 'admin_page') );
379
+ }
380
+
381
+ public function admin_page() {
382
+ global $wpdb;
383
+
384
+ include dirname( __FILE__ ).'/ssb-admin.php';
385
+ }
386
+
387
+
388
+
389
+ public function plugin_action_links($links, $file) {
390
+ static $this_plugin;
391
+
392
+ if (!$this_plugin) {
393
+ $this_plugin = plugin_basename(__FILE__);
394
+ }
395
+
396
+ if ($file == $this_plugin) {
397
+ $settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=simple-social-buttons">'.__('Settings').'</a>';
398
+ array_unshift($links, $settings_link);
399
+ }
400
+
401
+ return $links;
402
+ }
403
  }
 
404
 
405
+ if(is_admin() ) {
406
+ $_ssb_pr = new SimpleSocialButtonsPR_Admin();
407
+ } else {
408
+ $_ssb_pr = new SimpleSocialButtonsPR();
409
  }
 
410
 
411
  ?>
ssb-admin.php CHANGED
@@ -1,99 +1,119 @@
1
  <div class="wrap">
2
 
3
  <style type="text/css">
4
- div.inside ul li {
5
  line-height: 16px;
6
  list-style-type: square;
7
  margin-left: 15px;
8
  }
9
  </style>
10
 
11
- <h2>Simple Social Buttons - <?php _e('Settings', 'simplesocialbuttons'); ?></h2>
12
 
13
  <p><?php _e('<strong>Simple Social Buttons</strong> by <strong>Paweł Rabinek</strong>. This plugin adds a social media buttons, such as: <strong>Google +1</strong>, <strong>Facebook Like it</strong> and <strong>Twitter share</strong>. The most flexible social buttons plugin ever.', 'simplesocialbuttons'); ?></p>
14
 
15
- <?php
16
-
17
- if($_POST['hiddenconfirm'] == 'Y') {
18
-
19
- // save settings
20
-
21
- $ssb_googleplus = $_POST['ssb_googleplus'];
22
- update_option('ssb_googleplus', $ssb_googleplus);
23
-
24
- $ssb_fblike = $_POST['ssb_fblike'];
25
- update_option('ssb_fblike', $ssb_fblike);
26
-
27
- $ssb_twitter = $_POST['ssb_twitter'];
28
- update_option('ssb_twitter', $ssb_twitter);
29
-
30
- $ssb_beforepost = $_POST['ssb_beforepost'];
31
- update_option('ssb_beforepost', $ssb_beforepost);
32
-
33
- $ssb_afterpost = $_POST['ssb_afterpost'];
34
- update_option('ssb_afterpost', $ssb_afterpost);
35
-
36
- $ssb_beforepage = $_POST['ssb_beforepage'];
37
- update_option('ssb_beforepage', $ssb_beforepage);
38
-
39
- $ssb_afterpage = $_POST['ssb_afterpage'];
40
- update_option('ssb_afterpage', $ssb_afterpage);
41
-
42
- $ssb_showfront = $_POST['ssb_showfront'];
43
- update_option('ssb_showfront', $ssb_showfront);
44
-
45
- $ssb_showcategory = $_POST['ssb_showcategory'];
46
- update_option('ssb_showcategory', $ssb_showcategory);
47
-
48
- $ssb_showarchive = $_POST['ssb_showarchive'];
49
- update_option('ssb_showarchive', $ssb_showarchive);
50
-
51
- $ssb_showtag = $_POST['ssb_showtag'];
52
- update_option('ssb_showtag', $ssb_showtag);
53
-
54
- $ssb_beforearchive = $_POST['ssb_beforearchive'];
55
- update_option('ssb_beforearchive', $ssb_beforearchive);
56
-
57
- $ssb_afterarchive = $_POST['ssb_afterarchive'];
58
- update_option('ssb_afterarchive', $ssb_afterarchive);
59
-
60
- }else{
61
-
62
- // get settings from database
63
- $ssb_googleplus = get_option('ssb_googleplus');
64
- $ssb_fblike = get_option('ssb_fblike');
65
- $ssb_twitter = get_option('ssb_twitter');
66
-
67
- $ssb_beforepost = get_option('ssb_beforepost');
68
- $ssb_afterpost = get_option('ssb_afterpost');
69
-
70
- $ssb_beforepage = get_option('ssb_beforepage');
71
- $ssb_afterpage = get_option('ssb_afterpage');
72
-
73
- $ssb_showfront = get_option('ssb_showfront');
74
- $ssb_showcategory = get_option('ssb_showcategory');
75
- $ssb_showarchive = get_option('ssb_showarchive');
76
- $ssb_showtag = get_option('ssb_showtag');
77
-
78
- $ssb_beforearchive = get_option('ssb_beforearchive');
79
- $ssb_afterarchive = get_option('ssb_afterarchive');
80
  }
81
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  ?>
83
 
84
 
85
  <div class="postbox-container" style="width:69%">
86
  <div id="poststuff">
87
- <form name="ssb_form" method="post" action="">
88
-
89
  <div class="postbox">
90
  <h3><?php _e('Select buttons', 'simplesocialbuttons'); ?></h3>
91
  <div class="inside">
92
  <h4><?php _e('Select social media buttons:', 'simplesocialbuttons'); ?></h4>
93
-
94
- <p><input type="checkbox" name="ssb_googleplus" id="ssb_googleplus" value="1" <?php if(!empty($ssb_googleplus)) { ?>checked="checked"<?php } ?> /> <label for="ssb_googleplus"><?php _e('Google plus one (+1)', 'simplesocialbuttons'); ?></label></p>
95
- <p><input type="checkbox" name="ssb_fblike" id="ssb_fblike" value="1" <?php if(!empty($ssb_fblike)) { ?>checked="checked"<?php } ?> /> <label for="ssb_fblike"><?php _e('Facebook Like it', 'simplesocialbuttons'); ?></label></p>
96
- <p><input type="checkbox" name="ssb_twitter" id="ssb_twitter" value="1" <?php if(!empty($ssb_twitter)) { ?>checked="checked"<?php } ?> /> <label for="ssb_twitter"><?php _e('Twitter share', 'simplesocialbuttons'); ?></label></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  </div>
98
  </div>
99
 
@@ -114,26 +134,26 @@ if($_POST['hiddenconfirm'] == 'Y') {
114
  <p><input type="checkbox" name="ssb_afterpage" id="ssb_afterpage" value="1" <?php if(!empty($ssb_afterpage)) { ?>checked="checked"<?php } ?> /> <label for="ssb_afterpage"><?php _e('After the page content', 'simplesocialbuttons'); ?></label></p>
115
  </div>
116
  </div>
117
-
118
  <div class="postbox">
119
  <h3><?php _e('Archives - display settings', 'simplesocialbuttons'); ?></h3>
120
  <div class="inside">
121
  <h4><?php _e('Select additional places to display buttons:', 'simplesocialbuttons'); ?></h4>
122
  <p><input type="checkbox" name="ssb_showfront" id="ssb_showfront" value="1" <?php if(!empty($ssb_showfront)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showfront"><?php _e('Show at frontpage', 'simplesocialbuttons'); ?></label></p>
123
  <p><input type="checkbox" name="ssb_showcategory" id="ssb_showcategory" value="1" <?php if(!empty($ssb_showcategory)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showcategory"><?php _e('Show at category pages', 'simplesocialbuttons'); ?></label></p>
124
- <p><input type="checkbox" name="ssb_showarchive" id="ssb_showarchive" value="1" <?php if(!empty($ssb_showarchive)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showarchive"><?php _e('Show at archive pages', 'simplesocialbuttons'); ?></label></p>
125
- <p><input type="checkbox" name="ssb_showtag" id="ssb_showtag" value="1" <?php if(!empty($ssb_showtag)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showtag"><?php _e('Show at tag pages', 'simplesocialbuttons'); ?></label></p>
126
-
127
  <h4><?php _e('Place buttons on archives:', 'simplesocialbuttons'); ?></h4>
128
  <p><input type="checkbox" name="ssb_beforearchive" id="ssb_beforearchive" value="1" <?php if(!empty($ssb_beforearchive)) { ?>checked="checked"<?php } ?> /> <label for="ssb_beforearchive"><?php _e('Before the content', 'simplesocialbuttons'); ?></label></p>
129
  <p><input type="checkbox" name="ssb_afterarchive" id="ssb_afterarchive" value="1" <?php if(!empty($ssb_afterarchive)) { ?>checked="checked"<?php } ?> /> <label for="ssb_afterarchive"><?php _e('After the content', 'simplesocialbuttons'); ?></label></p>
130
  </div>
131
  </div>
132
-
133
  <div class="submit">
134
  <input type="hidden" name="hiddenconfirm" value="Y" />
135
- <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save settings', 'simplesocialbuttons'); ?>" />
136
- </div>
137
 
138
  </form>
139
  </div>
@@ -171,7 +191,7 @@ if($_POST['hiddenconfirm'] == 'Y') {
171
  </ul>
172
  </div>
173
  </div>
174
-
175
  <div class="postbox">
176
  <h3><?php _e('Usefull links:', 'simplesocialbuttons'); ?></h3>
177
  <div class="inside">
@@ -182,7 +202,7 @@ if($_POST['hiddenconfirm'] == 'Y') {
182
  </ul>
183
  </div>
184
  </div>
185
-
186
  </div>
187
  </div>
188
  </div>
1
  <div class="wrap">
2
 
3
  <style type="text/css">
4
+ div.inside ul li {
5
  line-height: 16px;
6
  list-style-type: square;
7
  margin-left: 15px;
8
  }
9
  </style>
10
 
11
+ <h2>Simple Social Buttons - <?php _e('Settings'); ?>:</h2>
12
 
13
  <p><?php _e('<strong>Simple Social Buttons</strong> by <strong>Paweł Rabinek</strong>. This plugin adds a social media buttons, such as: <strong>Google +1</strong>, <strong>Facebook Like it</strong> and <strong>Twitter share</strong>. The most flexible social buttons plugin ever.', 'simplesocialbuttons'); ?></p>
14
 
15
+ <?php
16
+
17
+ if(strtolower($_POST['hiddenconfirm']) == 'y') {
18
+
19
+ /**
20
+ * Compile settings array
21
+ * @see http://codex.wordpress.org/Function_Reference/wp_parse_args
22
+ */
23
+
24
+ $updateSettings = array(
25
+ 'googleplus' => $_POST['ssb_googleplus'],
26
+ 'fblike' => $_POST['ssb_fblike'],
27
+ 'twitter' => $_POST['ssb_twitter'],
28
+
29
+ 'beforepost' => $_POST['ssb_beforepost'],
30
+ 'afterpost' => $_POST['ssb_afterpost'],
31
+ 'beforepage' => $_POST['ssb_beforepage'],
32
+ 'afterpage' => $_POST['ssb_afterpage'],
33
+ 'beforearchive' => $_POST['ssb_beforearchive'],
34
+ 'afterarchive' => $_POST['ssb_afterarchive'],
35
+
36
+ 'showfront' => $_POST['ssb_showfront'],
37
+ 'showcategory' => $_POST['ssb_showcategory'],
38
+ 'showarchive' => $_POST['ssb_showarchive'],
39
+ 'showtag' => $_POST['ssb_showtag'],
40
+
41
+ 'override_css' => $_POST['ssb_override_css'],
42
+ );
43
+
44
+ $this->update_settings( $updateSettings );
45
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
 
48
+ /**
49
+ * HACK: Use one big array instead of a bunchload of single options
50
+ * @author Fabian Wolf
51
+ * @link http://usability-idealist.de/
52
+ * @since 1.2.1
53
+ */
54
+
55
+ // get settings from database
56
+ $settings = $this->get_settings();
57
+
58
+ extract( $settings, EXTR_PREFIX_ALL, 'ssb' );
59
+
60
  ?>
61
 
62
 
63
  <div class="postbox-container" style="width:69%">
64
  <div id="poststuff">
65
+ <form name="ssb_form" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
66
+
67
  <div class="postbox">
68
  <h3><?php _e('Select buttons', 'simplesocialbuttons'); ?></h3>
69
  <div class="inside">
70
  <h4><?php _e('Select social media buttons:', 'simplesocialbuttons'); ?></h4>
71
+
72
+
73
+ <p><select name="ssb_googleplus" id="ssb_googleplus">
74
+ <option value=""<?php if(empty($ssb_googleplus) != false) {
75
+ ?>selected="selected"<?php
76
+ } ?>><?php _e('inactive', 'simplesocialbuttons'); ?></option>
77
+
78
+ <?php for($pos = 1; $pos < 4; $pos++) { ?>
79
+ <option value="<?php echo $pos; ?>"<?php if($ssb_googleplus == $pos) {
80
+ ?>selected="selected"<?php
81
+ } ?>> # <?php echo $pos; ?> </option>
82
+ <?php } ?>
83
+ </select> &nbsp;
84
+ <label for="ssb_googleplus"><?php _e('Google plus one (+1)', 'simplesocialbuttons'); ?></label></p>
85
+
86
+ <!-- fblike -->
87
+ <p><select name="ssb_fblike" id="ssb_fblike">
88
+ <option value=""<?php if(empty($ssb_fblike) != false) {
89
+ ?>selected="selected"<?php
90
+ } ?>><?php _e('inactive', 'simplesocialbuttons'); ?></option>
91
+
92
+ <?php for($pos = 1; $pos < 4; $pos++) { ?>
93
+ <option value="<?php echo $pos; ?>"<?php if($ssb_fblike == $pos) {
94
+ ?>selected="selected"<?php
95
+ } ?>> # <?php echo $pos; ?> </option>
96
+ <?php } ?>
97
+ </select> &nbsp;
98
+ <label for="ssb_fblike"><?php _e('Facebook Like it', 'simplesocialbuttons'); ?></label></p>
99
+ <!-- /fblike -->
100
+
101
+ <!-- twitter -->
102
+ <p><select name="ssb_twitter" id="ssb_twitter">
103
+ <option value=""<?php if(empty($ssb_twitter) != false) {
104
+ ?>selected="selected"<?php
105
+ } ?>><?php _e('inactive', 'simplesocialbuttons'); ?></option>
106
+
107
+ <?php for($pos = 1; $pos < 4; $pos++) { ?>
108
+ <option value="<?php echo $pos; ?>"<?php if($ssb_twitter == $pos) {
109
+ ?>selected="selected"<?php
110
+ } ?>> # <?php echo $pos; ?> </option>
111
+ <?php } ?>
112
+ </select> &nbsp;
113
+ <label for="ssb_twitter"><?php _e('Twitter share', 'simplesocialbuttons'); ?></label></p>
114
+ <!-- /twitter -->
115
+
116
+ <p><label for="ssb_override_css"><input type="checkbox" name="ssb_override_css" id="ssb_override_css" value="1" <?php if($ssb_override_css) { echo 'checked="checked"'; } ?>/> <?php _e('Disable plugin CSS (only advanced users)'); ?></label></p>
117
  </div>
118
  </div>
119
 
134
  <p><input type="checkbox" name="ssb_afterpage" id="ssb_afterpage" value="1" <?php if(!empty($ssb_afterpage)) { ?>checked="checked"<?php } ?> /> <label for="ssb_afterpage"><?php _e('After the page content', 'simplesocialbuttons'); ?></label></p>
135
  </div>
136
  </div>
137
+
138
  <div class="postbox">
139
  <h3><?php _e('Archives - display settings', 'simplesocialbuttons'); ?></h3>
140
  <div class="inside">
141
  <h4><?php _e('Select additional places to display buttons:', 'simplesocialbuttons'); ?></h4>
142
  <p><input type="checkbox" name="ssb_showfront" id="ssb_showfront" value="1" <?php if(!empty($ssb_showfront)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showfront"><?php _e('Show at frontpage', 'simplesocialbuttons'); ?></label></p>
143
  <p><input type="checkbox" name="ssb_showcategory" id="ssb_showcategory" value="1" <?php if(!empty($ssb_showcategory)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showcategory"><?php _e('Show at category pages', 'simplesocialbuttons'); ?></label></p>
144
+ <p><input type="checkbox" name="ssb_showarchive" id="ssb_showarchive" value="1" <?php if(!empty($ssb_showarchive)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showarchive"><?php _e('Show at archive pages', 'simplesocialbuttons'); ?></label></p>
145
+ <p><input type="checkbox" name="ssb_showtag" id="ssb_showtag" value="1" <?php if(!empty($ssb_showtag)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showtag"><?php _e('Show at tag pages', 'simplesocialbuttons'); ?></label></p>
146
+
147
  <h4><?php _e('Place buttons on archives:', 'simplesocialbuttons'); ?></h4>
148
  <p><input type="checkbox" name="ssb_beforearchive" id="ssb_beforearchive" value="1" <?php if(!empty($ssb_beforearchive)) { ?>checked="checked"<?php } ?> /> <label for="ssb_beforearchive"><?php _e('Before the content', 'simplesocialbuttons'); ?></label></p>
149
  <p><input type="checkbox" name="ssb_afterarchive" id="ssb_afterarchive" value="1" <?php if(!empty($ssb_afterarchive)) { ?>checked="checked"<?php } ?> /> <label for="ssb_afterarchive"><?php _e('After the content', 'simplesocialbuttons'); ?></label></p>
150
  </div>
151
  </div>
152
+
153
  <div class="submit">
154
  <input type="hidden" name="hiddenconfirm" value="Y" />
155
+ <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes'); ?>" />
156
+ </div>
157
 
158
  </form>
159
  </div>
191
  </ul>
192
  </div>
193
  </div>
194
+
195
  <div class="postbox">
196
  <h3><?php _e('Usefull links:', 'simplesocialbuttons'); ?></h3>
197
  <div class="inside">
202
  </ul>
203
  </div>
204
  </div>
205
+
206
  </div>
207
  </div>
208
  </div>