1 | <?php
|
---|
2 | /*
|
---|
3 | Plugin Name: Sociable
|
---|
4 | Plugin URI: http://yoast.com/wordpress/sociable/
|
---|
5 | Description: Automatically add links on your posts, pages and RSS feed to your favorite social bookmarking sites.
|
---|
6 | Version: 3.4.4
|
---|
7 | Author: Joost de Valk
|
---|
8 | Author URI: http://yoast.com/
|
---|
9 |
|
---|
10 | Copyright 2006 Peter Harkins (ph@malaprop.org)
|
---|
11 | Copyright 2008-2009 Joost de Valk (joost@yoast.com)
|
---|
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 as published by
|
---|
15 | the Free Software Foundation; either version 2 of the License, or
|
---|
16 | (at your option) any later version.
|
---|
17 |
|
---|
18 | This program is distributed in the hope that it will be useful,
|
---|
19 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
21 | GNU General Public License for more details.
|
---|
22 |
|
---|
23 | You should have received a copy of the GNU General Public License
|
---|
24 | along with this program; if not, write to the Free Software
|
---|
25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
26 | */
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Determine the location
|
---|
30 | */
|
---|
31 | $sociablepluginpath = WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__)).'/';
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * For backwards compatibility, esc_attr was added in 2.8
|
---|
35 | */
|
---|
36 | if (! function_exists('esc_attr')) {
|
---|
37 | function esc_attr( $text ) {
|
---|
38 | return attribute_escape( $text );
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * This function makes sure Sociable is able to load the different language files from
|
---|
44 | * the i18n subfolder of the Sociable directory
|
---|
45 | **/
|
---|
46 | function sociable_init_locale(){
|
---|
47 | global $sociablepluginpath;
|
---|
48 | load_plugin_textdomain('sociable', false, 'i18n');
|
---|
49 | }
|
---|
50 | add_filter('init', 'sociable_init_locale');
|
---|
51 |
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * @global array Contains all sites that Sociable supports, array items have 4 keys:
|
---|
55 | * required favicon - the favicon for the site, a 16x16px PNG, to be found in the images subdirectory
|
---|
56 | * required url - submit URL of the site, containing at least PERMALINK
|
---|
57 | * description - description, used in several spots, but most notably as alt and title text for the link
|
---|
58 | * awesm_channel - the channel awe.sm files the traffic under
|
---|
59 | */
|
---|
60 | $sociable_known_sites = Array(
|
---|
61 |
|
---|
62 | 'BarraPunto' => Array(
|
---|
63 | 'favicon' => 'barrapunto.png',
|
---|
64 | 'url' => 'http://barrapunto.com/submit.pl?subj=TITLE&story=PERMALINK',
|
---|
65 | ),
|
---|
66 |
|
---|
67 | 'Bitacoras.com' => Array(
|
---|
68 | 'favicon' => 'bitacoras.png',
|
---|
69 | 'url' => 'http://bitacoras.com/anotaciones/PERMALINK',
|
---|
70 | ),
|
---|
71 |
|
---|
72 | 'BlinkList' => Array(
|
---|
73 | 'favicon' => 'blinklist.png',
|
---|
74 | 'url' => 'http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url=PERMALINK&Title=TITLE',
|
---|
75 | ),
|
---|
76 |
|
---|
77 | 'BlogMemes Fr' => Array(
|
---|
78 | 'favicon' => 'blogmemes.png',
|
---|
79 | 'url' => 'http://www.blogmemes.fr/post.php?url=PERMALINK&title=TITLE',
|
---|
80 | ),
|
---|
81 |
|
---|
82 | 'BlogMemes Sp' => Array(
|
---|
83 | 'favicon' => 'blogmemes.png',
|
---|
84 | 'url' => 'http://www.blogmemes.com/post.php?url=PERMALINK&title=TITLE',
|
---|
85 | ),
|
---|
86 |
|
---|
87 | 'blogmarks' => Array(
|
---|
88 | 'favicon' => 'blogmarks.png',
|
---|
89 | 'url' => 'http://blogmarks.net/my/new.php?mini=1&simple=1&url=PERMALINK&title=TITLE',
|
---|
90 | ),
|
---|
91 |
|
---|
92 | 'Blogosphere News' => Array(
|
---|
93 | 'favicon' => 'blogospherenews.png',
|
---|
94 | 'url' => 'http://www.blogospherenews.com/submit.php?url=PERMALINK&title=TITLE',
|
---|
95 | ),
|
---|
96 |
|
---|
97 | 'blogtercimlap' => Array(
|
---|
98 | 'favicon' => 'blogter.png',
|
---|
99 | 'url' => 'http://cimlap.blogter.hu/index.php?action=suggest_link&title=TITLE&url=PERMALINK',
|
---|
100 | ),
|
---|
101 |
|
---|
102 | 'Faves' => Array(
|
---|
103 | 'favicon' => 'bluedot.png',
|
---|
104 | 'url' => 'http://faves.com/Authoring.aspx?u=PERMALINK&title=TITLE',
|
---|
105 | ),
|
---|
106 |
|
---|
107 | 'co.mments' => Array(
|
---|
108 | 'favicon' => 'co.mments.png',
|
---|
109 | 'url' => 'http://co.mments.com/track?url=PERMALINK&title=TITLE',
|
---|
110 | ),
|
---|
111 |
|
---|
112 | 'connotea' => Array(
|
---|
113 | 'favicon' => 'connotea.png',
|
---|
114 | 'url' => 'http://www.connotea.org/addpopup?continue=confirm&uri=PERMALINK&title=TITLE&description=EXCERPT',
|
---|
115 | ),
|
---|
116 |
|
---|
117 | 'Current' => Array(
|
---|
118 | 'favicon' => 'current.png',
|
---|
119 | 'url' => 'http://current.com/clipper.htm?url=PERMALINK&title=TITLE'
|
---|
120 | ),
|
---|
121 |
|
---|
122 | 'del.icio.us' => Array(
|
---|
123 | 'favicon' => 'delicious.png',
|
---|
124 | 'url' => 'http://delicious.com/post?url=PERMALINK&title=TITLE&notes=EXCERPT',
|
---|
125 | ),
|
---|
126 |
|
---|
127 | 'Design Float' => Array(
|
---|
128 | 'favicon' => 'designfloat.png',
|
---|
129 | 'url' => 'http://www.designfloat.com/submit.php?url=PERMALINK&title=TITLE',
|
---|
130 | ),
|
---|
131 |
|
---|
132 | 'Digg' => Array(
|
---|
133 | 'favicon' => 'digg.png',
|
---|
134 | 'url' => 'http://digg.com/submit?phase=2&url=PERMALINK&title=TITLE&bodytext=EXCERPT',
|
---|
135 | 'description' => 'Digg',
|
---|
136 | ),
|
---|
137 |
|
---|
138 | 'Diigo' => Array(
|
---|
139 | 'favicon' => 'diigo.png',
|
---|
140 | 'url' => 'http://www.diigo.com/post?url=PERMALINK&title=TITLE',
|
---|
141 | ),
|
---|
142 |
|
---|
143 | 'DotNetKicks' => Array(
|
---|
144 | 'favicon' => 'dotnetkicks.png',
|
---|
145 | 'url' => 'http://www.dotnetkicks.com/kick/?url=PERMALINK&title=TITLE',
|
---|
146 | ),
|
---|
147 |
|
---|
148 | 'DZone' => Array(
|
---|
149 | 'favicon' => 'dzone.png',
|
---|
150 | 'url' => 'http://www.dzone.com/links/add.html?url=PERMALINK&title=TITLE',
|
---|
151 | ),
|
---|
152 |
|
---|
153 | 'eKudos' => Array(
|
---|
154 | 'favicon' => 'ekudos.png',
|
---|
155 | 'url' => 'http://www.ekudos.nl/artikel/nieuw?url=PERMALINK&title=TITLE&desc=EXCERPT',
|
---|
156 | ),
|
---|
157 |
|
---|
158 | 'email' => Array(
|
---|
159 | 'favicon' => 'email_link.png',
|
---|
160 | 'url' => 'mailto:?subject=TITLE&body=PERMALINK',
|
---|
161 | 'awesm_channel' => 'mailto',
|
---|
162 | 'description' => __('E-mail this story to a friend!','sociable'),
|
---|
163 | ),
|
---|
164 |
|
---|
165 | 'Facebook' => Array(
|
---|
166 | 'favicon' => 'facebook.png',
|
---|
167 | 'awesm_channel' => 'facebook-post',
|
---|
168 | 'url' => 'http://www.facebook.com/share.php?u=PERMALINK&t=TITLE',
|
---|
169 | ),
|
---|
170 |
|
---|
171 | 'Fark' => Array(
|
---|
172 | 'favicon' => 'fark.png',
|
---|
173 | 'url' => 'http://cgi.fark.com/cgi/fark/farkit.pl?h=TITLE&u=PERMALINK',
|
---|
174 | ),
|
---|
175 |
|
---|
176 | 'Fleck' => Array(
|
---|
177 | 'favicon' => 'fleck.png',
|
---|
178 | 'url' => 'http://beta3.fleck.com/bookmarklet.php?url=PERMALINK&title=TITLE',
|
---|
179 | ),
|
---|
180 |
|
---|
181 | 'FriendFeed' => Array(
|
---|
182 | 'favicon' => 'friendfeed.png',
|
---|
183 | 'url' => 'http://www.friendfeed.com/share?title=TITLE&link=PERMALINK',
|
---|
184 | ),
|
---|
185 |
|
---|
186 | 'FSDaily' => Array(
|
---|
187 | 'favicon' => 'fsdaily.png',
|
---|
188 | 'url' => 'http://www.fsdaily.com/submit?url=PERMALINK&title=TITLE',
|
---|
189 | ),
|
---|
190 |
|
---|
191 | 'Global Grind' => Array (
|
---|
192 | 'favicon' => 'globalgrind.png',
|
---|
193 | 'url' => 'http://globalgrind.com/submission/submit.aspx?url=PERMALINK&type=Article&title=TITLE'
|
---|
194 | ),
|
---|
195 |
|
---|
196 | 'Google' => Array (
|
---|
197 | 'favicon' => 'googlebookmark.png',
|
---|
198 | 'url' => 'http://www.google.com/bookmarks/mark?op=edit&bkmk=PERMALINK&title=TITLE&annotation=EXCERPT',
|
---|
199 | 'description' => 'Google Bookmarks'
|
---|
200 | ),
|
---|
201 |
|
---|
202 | 'Gwar' => Array(
|
---|
203 | 'favicon' => 'gwar.png',
|
---|
204 | 'url' => 'http://www.gwar.pl/DodajGwar.html?u=PERMALINK',
|
---|
205 | ),
|
---|
206 |
|
---|
207 | 'HackerNews' => Array(
|
---|
208 | 'favicon' => 'hackernews.png',
|
---|
209 | 'url' => 'http://news.ycombinator.com/submitlink?u=PERMALINK&t=TITLE',
|
---|
210 | ),
|
---|
211 |
|
---|
212 | 'Haohao' => Array(
|
---|
213 | 'favicon' => 'haohao.png',
|
---|
214 | 'url' => 'http://www.haohaoreport.com/submit.php?url=PERMALINK&title=TITLE',
|
---|
215 | ),
|
---|
216 |
|
---|
217 | 'HealthRanker' => Array(
|
---|
218 | 'favicon' => 'healthranker.png',
|
---|
219 | 'url' => 'http://healthranker.com/submit.php?url=PERMALINK&title=TITLE',
|
---|
220 | ),
|
---|
221 |
|
---|
222 | 'HelloTxt' => Array(
|
---|
223 | 'favicon' => 'hellotxt.png',
|
---|
224 | 'url' => 'http://hellotxt.com/?status=TITLE+PERMALINK',
|
---|
225 | ),
|
---|
226 |
|
---|
227 | 'Hemidemi' => Array(
|
---|
228 | 'favicon' => 'hemidemi.png',
|
---|
229 | 'url' => 'http://www.hemidemi.com/user_bookmark/new?title=TITLE&url=PERMALINK',
|
---|
230 | ),
|
---|
231 |
|
---|
232 | 'Hyves' => Array(
|
---|
233 | 'favicon' => 'hyves.png',
|
---|
234 | 'url' => 'http://www.hyves.nl/profilemanage/add/tips/?name=TITLE&text=EXCERPT+PERMALINK&rating=5',
|
---|
235 | ),
|
---|
236 |
|
---|
237 | 'Identi.ca' => Array(
|
---|
238 | 'favicon' => 'identica.png',
|
---|
239 | 'url' => 'http://identi.ca/notice/new?status_textarea=PERMALINK',
|
---|
240 | ),
|
---|
241 |
|
---|
242 | 'IndianPad' => Array(
|
---|
243 | 'favicon' => 'indianpad.png',
|
---|
244 | 'url' => 'http://www.indianpad.com/submit.php?url=PERMALINK',
|
---|
245 | ),
|
---|
246 |
|
---|
247 | 'Internetmedia' => Array(
|
---|
248 | 'favicon' => 'im.png',
|
---|
249 | 'url' => 'http://internetmedia.hu/submit.php?url=PERMALINK'
|
---|
250 | ),
|
---|
251 |
|
---|
252 | 'Kirtsy' => Array(
|
---|
253 | 'favicon' => 'kirtsy.png',
|
---|
254 | 'url' => 'http://www.kirtsy.com/submit.php?url=PERMALINK&title=TITLE',
|
---|
255 | ),
|
---|
256 |
|
---|
257 | 'laaik.it' => Array(
|
---|
258 | 'favicon' => 'laaikit.png',
|
---|
259 | 'url' => 'http://laaik.it/NewStoryCompact.aspx?uri=PERMALINK&headline=TITLE&cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12',
|
---|
260 | ),
|
---|
261 |
|
---|
262 | 'LinkArena' => Array(
|
---|
263 | 'favicon' => 'linkarena.png',
|
---|
264 | 'url' => 'http://linkarena.com/bookmarks/addlink/?url=PERMALINK&title=TITLE',
|
---|
265 | ),
|
---|
266 |
|
---|
267 | 'LinkaGoGo' => Array(
|
---|
268 | 'favicon' => 'linkagogo.png',
|
---|
269 | 'url' => 'http://www.linkagogo.com/go/AddNoPopup?url=PERMALINK&title=TITLE',
|
---|
270 | ),
|
---|
271 |
|
---|
272 | 'LinkedIn' => Array(
|
---|
273 | 'favicon' => 'linkedin.png',
|
---|
274 | 'url' => 'http://www.linkedin.com/shareArticle?mini=true&url=PERMALINK&title=TITLE&source=BLOGNAME&summary=EXCERPT',
|
---|
275 | ),
|
---|
276 |
|
---|
277 | 'Linkter' => Array(
|
---|
278 | 'favicon' => 'linkter.png',
|
---|
279 | 'url' => 'http://www.linkter.hu/index.php?action=suggest_link&url=PERMALINK&title=TITLE',
|
---|
280 | ),
|
---|
281 |
|
---|
282 | 'Live' => Array(
|
---|
283 | 'favicon' => 'live.png',
|
---|
284 | 'url' => 'https://favorites.live.com/quickadd.aspx?marklet=1&url=PERMALINK&title=TITLE',
|
---|
285 | ),
|
---|
286 |
|
---|
287 | 'Meneame' => Array(
|
---|
288 | 'favicon' => 'meneame.png',
|
---|
289 | 'url' => 'http://meneame.net/submit.php?url=PERMALINK',
|
---|
290 | ),
|
---|
291 |
|
---|
292 | 'MisterWong' => Array(
|
---|
293 | 'favicon' => 'misterwong.png',
|
---|
294 | 'url' => 'http://www.mister-wong.com/addurl/?bm_url=PERMALINK&bm_description=TITLE&plugin=soc',
|
---|
295 | ),
|
---|
296 |
|
---|
297 | 'MisterWong.DE' => Array(
|
---|
298 | 'favicon' => 'misterwong.png',
|
---|
299 | 'url' => 'http://www.mister-wong.de/addurl/?bm_url=PERMALINK&bm_description=TITLE&plugin=soc',
|
---|
300 | ),
|
---|
301 |
|
---|
302 | 'Mixx' => Array(
|
---|
303 | 'favicon' => 'mixx.png',
|
---|
304 | 'url' => 'http://www.mixx.com/submit?page_url=PERMALINK&title=TITLE',
|
---|
305 | ),
|
---|
306 |
|
---|
307 | 'muti' => Array(
|
---|
308 | 'favicon' => 'muti.png',
|
---|
309 | 'url' => 'http://www.muti.co.za/submit?url=PERMALINK&title=TITLE',
|
---|
310 | ),
|
---|
311 |
|
---|
312 | 'MyShare' => Array(
|
---|
313 | 'favicon' => 'myshare.png',
|
---|
314 | 'url' => 'http://myshare.url.com.tw/index.php?func=newurl&url=PERMALINK&desc=TITLE',
|
---|
315 | ),
|
---|
316 |
|
---|
317 | 'MySpace' => Array(
|
---|
318 | 'favicon' => 'myspace.png',
|
---|
319 | 'awesm_channel' => 'myspace',
|
---|
320 | 'url' => 'http://www.myspace.com/Modules/PostTo/Pages/?u=PERMALINK&t=TITLE',
|
---|
321 | ),
|
---|
322 |
|
---|
323 | 'MSNReporter' => Array(
|
---|
324 | 'favicon' => 'msnreporter.png',
|
---|
325 | 'url' => 'http://reporter.nl.msn.com/?fn=contribute&Title=TITLE&URL=PERMALINK&cat_id=6&tag_id=31&Remark=EXCERPT',
|
---|
326 | 'description' => 'MSN Reporter'
|
---|
327 | ),
|
---|
328 |
|
---|
329 | 'N4G' => Array(
|
---|
330 | 'favicon' => 'n4g.png',
|
---|
331 | 'url' => 'http://www.n4g.com/tips.aspx?url=PERMALINK&title=TITLE',
|
---|
332 | ),
|
---|
333 |
|
---|
334 | 'Netvibes' => Array(
|
---|
335 | 'favicon' => 'netvibes.png',
|
---|
336 | 'url' => 'http://www.netvibes.com/share?title=TITLE&url=PERMALINK',
|
---|
337 | ),
|
---|
338 |
|
---|
339 | 'NewsVine' => Array(
|
---|
340 | 'favicon' => 'newsvine.png',
|
---|
341 | 'url' => 'http://www.newsvine.com/_tools/seed&save?u=PERMALINK&h=TITLE',
|
---|
342 | ),
|
---|
343 |
|
---|
344 | 'Netvouz' => Array(
|
---|
345 | 'favicon' => 'netvouz.png',
|
---|
346 | 'url' => 'http://www.netvouz.com/action/submitBookmark?url=PERMALINK&title=TITLE&popup=no',
|
---|
347 | ),
|
---|
348 |
|
---|
349 | 'NuJIJ' => Array(
|
---|
350 | 'favicon' => 'nujij.png',
|
---|
351 | 'url' => 'http://nujij.nl/jij.lynkx?t=TITLE&u=PERMALINK&b=EXCERPT',
|
---|
352 | ),
|
---|
353 |
|
---|
354 | 'Ping.fm' => Array(
|
---|
355 | 'favicon' => 'ping.png',
|
---|
356 | 'awesm_channel' => 'pingfm',
|
---|
357 | 'url' => 'http://ping.fm/ref/?link=PERMALINK&title=TITLE&body=EXCERPT',
|
---|
358 | ),
|
---|
359 |
|
---|
360 | 'Posterous' => Array(
|
---|
361 | 'favicon' => 'posterous.png',
|
---|
362 | 'url' => 'http://posterous.com/share?linkto=PERMALINK&title=TITLE&selection=EXCERPT',
|
---|
363 | ),
|
---|
364 |
|
---|
365 | 'ppnow' => Array(
|
---|
366 | 'favicon' => 'ppnow.png',
|
---|
367 | 'url' => 'http://www.ppnow.net/submit.php?url=PERMALINK',
|
---|
368 | ),
|
---|
369 |
|
---|
370 | 'PDF' => Array(
|
---|
371 | 'favicon' => 'pdf.png',
|
---|
372 | 'url' => 'http://www.printfriendly.com/print?url=PERMALINK&partner=sociable',
|
---|
373 | 'description' => __('Turn this article into a PDF!', 'sociable'),
|
---|
374 | ),
|
---|
375 |
|
---|
376 | 'Print' => Array(
|
---|
377 | 'favicon' => 'printfriendly.png',
|
---|
378 | 'url' => 'http://www.printfriendly.com/print?url=PERMALINK&partner=sociable',
|
---|
379 | 'description' => __('Print this article!', 'sociable'),
|
---|
380 | ),
|
---|
381 |
|
---|
382 | 'Propeller' => Array(
|
---|
383 | 'favicon' => 'propeller.png',
|
---|
384 | 'url' => 'http://www.propeller.com/submit/?url=PERMALINK',
|
---|
385 | ),
|
---|
386 |
|
---|
387 | 'Ratimarks' => Array(
|
---|
388 | 'favicon' => 'ratimarks.png',
|
---|
389 | 'url' => 'http://ratimarks.org/bookmarks.php/?action=add&address=PERMALINK&title=TITLE',
|
---|
390 | ),
|
---|
391 |
|
---|
392 | 'Rec6' => Array(
|
---|
393 | 'favicon' => 'rec6.png',
|
---|
394 | 'url' => 'http://rec6.via6.com/link.php?url=PERMALINK&=TITLE',
|
---|
395 | ),
|
---|
396 |
|
---|
397 | 'Reddit' => Array(
|
---|
398 | 'favicon' => 'reddit.png',
|
---|
399 | 'url' => 'http://reddit.com/submit?url=PERMALINK&title=TITLE',
|
---|
400 | ),
|
---|
401 |
|
---|
402 | 'RSS' => Array(
|
---|
403 | 'favicon' => 'rss.png',
|
---|
404 | 'url' => 'FEEDLINK',
|
---|
405 | ),
|
---|
406 |
|
---|
407 | 'Scoopeo' => Array(
|
---|
408 | 'favicon' => 'scoopeo.png',
|
---|
409 | 'url' => 'http://www.scoopeo.com/scoop/new?newurl=PERMALINK&title=TITLE',
|
---|
410 | ),
|
---|
411 |
|
---|
412 | 'Segnalo' => Array(
|
---|
413 | 'favicon' => 'segnalo.png',
|
---|
414 | 'url' => 'http://segnalo.alice.it/post.html.php?url=PERMALINK&title=TITLE',
|
---|
415 | ),
|
---|
416 |
|
---|
417 | 'Simpy' => Array(
|
---|
418 | 'favicon' => 'simpy.png',
|
---|
419 | 'url' => 'http://www.simpy.com/simpy/LinkAdd.do?href=PERMALINK&title=TITLE',
|
---|
420 | ),
|
---|
421 |
|
---|
422 | 'Slashdot' => Array(
|
---|
423 | 'favicon' => 'slashdot.png',
|
---|
424 | 'url' => 'http://slashdot.org/bookmark.pl?title=TITLE&url=PERMALINK',
|
---|
425 | ),
|
---|
426 |
|
---|
427 | 'Socialogs' => Array(
|
---|
428 | 'favicon' => 'socialogs.png',
|
---|
429 | 'url' => 'http://socialogs.com/add_story.php?story_url=PERMALINK&story_title=TITLE',
|
---|
430 | ),
|
---|
431 |
|
---|
432 | 'SphereIt' => Array(
|
---|
433 | 'favicon' => 'sphere.png',
|
---|
434 | 'url' => 'http://www.sphere.com/search?q=sphereit:PERMALINK&title=TITLE',
|
---|
435 | ),
|
---|
436 |
|
---|
437 | 'Sphinn' => Array(
|
---|
438 | 'favicon' => 'sphinn.png',
|
---|
439 | 'url' => 'http://sphinn.com/index.php?c=post&m=submit&link=PERMALINK',
|
---|
440 | ),
|
---|
441 |
|
---|
442 | 'StumbleUpon' => Array(
|
---|
443 | 'favicon' => 'stumbleupon.png',
|
---|
444 | 'url' => 'http://www.stumbleupon.com/submit?url=PERMALINK&title=TITLE',
|
---|
445 | ),
|
---|
446 |
|
---|
447 | 'Symbaloo' => Array(
|
---|
448 | 'favicon' => 'symbaloo.png',
|
---|
449 | 'url' => 'http://www.symbaloo.com/nl/add/url=PERMALINK&title=TITLE&icon=http%3A//static01.symbaloo.com/_img/favicon.png',
|
---|
450 | ),
|
---|
451 |
|
---|
452 | 'Techmeme' => Array(
|
---|
453 | 'favicon' => 'techmeme.png',
|
---|
454 | 'awesm_channel' => 'twitter-techmeme',
|
---|
455 | 'url' => 'http://twitter.com/home/?status=tip%20@Techmeme%20PERMALINK%20TITLE',
|
---|
456 | 'description' => 'Suggest to Techmeme via Twitter'
|
---|
457 | ),
|
---|
458 |
|
---|
459 | 'Technorati' => Array(
|
---|
460 | 'favicon' => 'technorati.png',
|
---|
461 | 'url' => 'http://technorati.com/faves?add=PERMALINK',
|
---|
462 | ),
|
---|
463 |
|
---|
464 | 'ThisNext' => Array(
|
---|
465 | 'favicon' => 'thisnext.png',
|
---|
466 | 'url' => 'http://www.thisnext.com/pick/new/submit/sociable/?url=PERMALINK&name=TITLE',
|
---|
467 | ),
|
---|
468 |
|
---|
469 | 'Tipd' => Array(
|
---|
470 | 'favicon' => 'tipd.png',
|
---|
471 | 'url' => 'http://tipd.com/submit.php?url=PERMALINK',
|
---|
472 | ),
|
---|
473 |
|
---|
474 | 'Tumblr' => Array(
|
---|
475 | 'favicon' => 'tumblr.png',
|
---|
476 | 'url' => 'http://www.tumblr.com/share?v=3&u=PERMALINK&t=TITLE&s=EXCERPT',
|
---|
477 | ),
|
---|
478 |
|
---|
479 | 'Twitthis' => Array(
|
---|
480 | 'favicon' => 'twitter.png',
|
---|
481 | 'awesm_channel' => 'twitter',
|
---|
482 | 'url' => 'http://twitter.com/home?status=TITLE%20-%20PERMALINK',
|
---|
483 | ),
|
---|
484 |
|
---|
485 | 'Twitter' => Array(
|
---|
486 | 'favicon' => 'twitter.png',
|
---|
487 | 'awesm_channel' => 'twitter',
|
---|
488 | 'url' => 'http://twitter.com/home?status=TITLE%20-%20PERMALINK',
|
---|
489 | ),
|
---|
490 |
|
---|
491 | 'Upnews' => Array(
|
---|
492 | 'favicon' => 'upnews.png',
|
---|
493 | 'url' => 'http://www.upnews.it/submit?url=PERMALINK&title=TITLE',
|
---|
494 | ),
|
---|
495 |
|
---|
496 | 'Webnews.de' => Array(
|
---|
497 | 'favicon' => 'webnews.png',
|
---|
498 | 'url' => 'http://www.webnews.de/einstellen?url=PERMALINK&title=TITLE',
|
---|
499 | ),
|
---|
500 |
|
---|
501 | 'Webride' => Array(
|
---|
502 | 'favicon' => 'webride.png',
|
---|
503 | 'url' => 'http://webride.org/discuss/split.php?uri=PERMALINK&title=TITLE',
|
---|
504 | ),
|
---|
505 |
|
---|
506 | 'Wikio' => Array(
|
---|
507 | 'favicon' => 'wikio.png',
|
---|
508 | 'url' => 'http://www.wikio.com/vote?url=PERMALINK',
|
---|
509 | ),
|
---|
510 |
|
---|
511 | 'Wikio FR' => Array(
|
---|
512 | 'favicon' => 'wikio.png',
|
---|
513 | 'url' => 'http://www.wikio.fr/vote?url=PERMALINK',
|
---|
514 | ),
|
---|
515 |
|
---|
516 | 'Wikio IT' => Array(
|
---|
517 | 'favicon' => 'wikio.png',
|
---|
518 | 'url' => 'http://www.wikio.it/vote?url=PERMALINK',
|
---|
519 | ),
|
---|
520 |
|
---|
521 | 'Wists' => Array(
|
---|
522 | 'favicon' => 'wists.png',
|
---|
523 | 'url' => 'http://wists.com/s.php?c=&r=PERMALINK&title=TITLE',
|
---|
524 | 'class' => 'wists',
|
---|
525 | ),
|
---|
526 |
|
---|
527 | 'Wykop' => Array(
|
---|
528 | 'favicon' => 'wykop.png',
|
---|
529 | 'url' => 'http://www.wykop.pl/dodaj?url=PERMALINK',
|
---|
530 | ),
|
---|
531 |
|
---|
532 | 'Xerpi' => Array(
|
---|
533 | 'favicon' => 'xerpi.png',
|
---|
534 | 'url' => 'http://www.xerpi.com/block/add_link_from_extension?url=PERMALINK&title=TITLE',
|
---|
535 | ),
|
---|
536 |
|
---|
537 | 'YahooBuzz' => Array(
|
---|
538 | 'favicon' => 'yahoobuzz.png',
|
---|
539 | 'url' => 'http://buzz.yahoo.com/submit/?submitUrl=PERMALINK&submitHeadline=TITLE&submitSummary=EXCERPT&submitCategory=science&submitAssetType=text',
|
---|
540 | 'description' => 'Yahoo! Buzz',
|
---|
541 | ),
|
---|
542 |
|
---|
543 | 'Yahoo! Bookmarks' => Array(
|
---|
544 | 'favicon' => 'yahoomyweb.png',
|
---|
545 | 'url' => 'http://bookmarks.yahoo.com/toolbar/savebm?u=PERMALINK&t=TITLE&opener=bm&ei=UTF-8&d=EXCERPT',
|
---|
546 | ),
|
---|
547 |
|
---|
548 | 'Yigg' => Array(
|
---|
549 | 'favicon' => 'yiggit.png',
|
---|
550 | 'url' => 'http://yigg.de/neu?exturl=PERMALINK&exttitle=TITLE',
|
---|
551 | ),
|
---|
552 | );
|
---|
553 |
|
---|
554 | /**
|
---|
555 | * Returns the Sociable links list.
|
---|
556 | *
|
---|
557 | * @param array $display optional list of links to return in HTML
|
---|
558 | * @global $sociable_known_sites array the list of sites that Sociable uses
|
---|
559 | * @global $sociablepluginpath string the path to the plugin
|
---|
560 | * @global $wp_query object the WordPress query object
|
---|
561 | * @return string $html HTML for links list.
|
---|
562 | */
|
---|
563 | function sociable_html($display=array()) {
|
---|
564 | global $sociable_known_sites, $sociablepluginpath, $wp_query, $post;
|
---|
565 |
|
---|
566 | if (get_post_meta($post->ID,'_sociableoff',true)) {
|
---|
567 | return "";
|
---|
568 | }
|
---|
569 |
|
---|
570 | /**
|
---|
571 | * Make it possible for other plugins or themes to add buttons to Sociable
|
---|
572 | */
|
---|
573 | $sociable_known_sites = apply_filters('sociable_known_sites',$sociable_known_sites);
|
---|
574 |
|
---|
575 | $active_sites = get_option('sociable_active_sites');
|
---|
576 |
|
---|
577 | // If a path is specified where Sociable should find its images, use that, otherwise,
|
---|
578 | // set the image path to the images subdirectory of the Sociable plugin.
|
---|
579 | // Image files need to be png's.
|
---|
580 | $imagepath = get_option('sociable_imagedir');
|
---|
581 | if ($imagepath == "")
|
---|
582 | $imagepath = $sociablepluginpath.'images/';
|
---|
583 |
|
---|
584 | // if no sites are specified, display all active
|
---|
585 | // have to check $active_sites has content because WP
|
---|
586 | // won't save an empty array as an option
|
---|
587 | if (empty($display) and $active_sites)
|
---|
588 | $display = $active_sites;
|
---|
589 | // if no sites are active, display nothing
|
---|
590 | if (empty($display))
|
---|
591 | return "";
|
---|
592 |
|
---|
593 | // Load the post's and blog's data
|
---|
594 | $blogname = urlencode(get_bloginfo('name')." ".get_bloginfo('description'));
|
---|
595 | $blogrss = get_bloginfo('rss2_url');
|
---|
596 | $post = $wp_query->post;
|
---|
597 |
|
---|
598 | // Grab the excerpt, if there is no excerpt, create one
|
---|
599 | $excerpt = urlencode(strip_tags(strip_shortcodes($post->post_excerpt)));
|
---|
600 | if ($excerpt == "") {
|
---|
601 | $excerpt = urlencode(substr(strip_tags(strip_shortcodes($post->post_content)),0,250));
|
---|
602 | }
|
---|
603 | // Clean the excerpt for use with links
|
---|
604 | $excerpt = str_replace('+','%20',$excerpt);
|
---|
605 | $permalink = urlencode(get_permalink($post->ID));
|
---|
606 | $title = str_replace('+','%20',urlencode($post->post_title));
|
---|
607 |
|
---|
608 | $rss = urlencode(get_bloginfo('ref_url'));
|
---|
609 |
|
---|
610 | // Start preparing the output
|
---|
611 | $html = "\n<div class=\"sociable\">\n";
|
---|
612 |
|
---|
613 | // If a tagline is set, display it above the links list
|
---|
614 | $tagline = get_option("sociable_tagline");
|
---|
615 | if ($tagline != "") {
|
---|
616 | $html .= "<div class=\"sociable_tagline\">\n";
|
---|
617 | $html .= stripslashes($tagline);
|
---|
618 | $html .= "\n</div>";
|
---|
619 | }
|
---|
620 |
|
---|
621 | /**
|
---|
622 | * Start the list of links
|
---|
623 | */
|
---|
624 | $html .= "\n<ul>\n";
|
---|
625 |
|
---|
626 | $i = 0;
|
---|
627 | $totalsites = count($display);
|
---|
628 | foreach($display as $sitename) {
|
---|
629 | /**
|
---|
630 | * If they specify an unknown or inactive site, ignore it.
|
---|
631 | */
|
---|
632 | if (!in_array($sitename, $active_sites))
|
---|
633 | continue;
|
---|
634 |
|
---|
635 | $site = $sociable_known_sites[$sitename];
|
---|
636 |
|
---|
637 | $url = $site['url'];
|
---|
638 | $url = str_replace('TITLE', $title, $url);
|
---|
639 | $url = str_replace('RSS', $rss, $url);
|
---|
640 | $url = str_replace('BLOGNAME', $blogname, $url);
|
---|
641 | $url = str_replace('EXCERPT', $excerpt, $url);
|
---|
642 | $url = str_replace('FEEDLINK', $blogrss, $url);
|
---|
643 |
|
---|
644 | if (isset($site['description']) && $site['description'] != "") {
|
---|
645 | $description = $site['description'];
|
---|
646 | } else {
|
---|
647 | $description = $sitename;
|
---|
648 | }
|
---|
649 |
|
---|
650 | if (get_option('sociable_awesmenable') == true &! empty($site['awesm_channel']) ) {
|
---|
651 | /**
|
---|
652 | * if awe.sm is enabled and it is an awe.sm supported site, use awe.sm
|
---|
653 | */
|
---|
654 | $permalink = str_replace('&', '%2526', $permalink);
|
---|
655 | $destination = str_replace('PERMALINK', 'TARGET', $url);
|
---|
656 | $destination = str_replace('&', '%26', $destination);
|
---|
657 | $channel = urlencode($site['awesm_channel']);
|
---|
658 |
|
---|
659 | $parentargument = '';
|
---|
660 | if ($_GET['awesm']) {
|
---|
661 | /**
|
---|
662 | * if the page was arrived at through an awe.sm URL, make that the parent
|
---|
663 | */
|
---|
664 | $parent = $_GET['awesm'];
|
---|
665 | $parentargument = '&p=' . $parent;
|
---|
666 | }
|
---|
667 |
|
---|
668 | if (strpos($channel, 'direct') != false) {
|
---|
669 | $url = $sociablepluginpath.'awesmate.php?c='.$channel.'&t='.$permalink.'&d='.$destination.'&dir=true'.$parentargument;
|
---|
670 | } else {
|
---|
671 | $url = $sociablepluginpath.'awesmate.php?c='.$channel.'&t='.$permalink.'&d='.$destination.$parentargument;
|
---|
672 | }
|
---|
673 | } else {
|
---|
674 | /**
|
---|
675 | * if awe.sm is not used, simply replace PERMALINK with $permalink
|
---|
676 | */
|
---|
677 | $url = str_replace('PERMALINK', $permalink, $url);
|
---|
678 | }
|
---|
679 |
|
---|
680 | /**
|
---|
681 | * Start building each list item. They're build up separately to allow filtering by other
|
---|
682 | * plugins.
|
---|
683 | * Give the first and last list item in the list an extra class to allow for cool CSS tricks
|
---|
684 | */
|
---|
685 | if ($i == 0) {
|
---|
686 | $link = '<li class="sociablefirst">';
|
---|
687 | } else if ($totalsites == ($i+1)) {
|
---|
688 | $link = '<li class="sociablelast">';
|
---|
689 | } else {
|
---|
690 | $link = '<li>';
|
---|
691 | }
|
---|
692 |
|
---|
693 | /**
|
---|
694 | * Start building the link, nofollow it to make sure Search engines don't follow it,
|
---|
695 | * and optionally add target=_blank to open in a new window if that option is set in the
|
---|
696 | * backend.
|
---|
697 | */
|
---|
698 | $link .= '<a rel="nofollow"';
|
---|
699 | $link .= ' id="'.esc_attr(strtolower($sitename)).'"';
|
---|
700 | if (get_option('sociable_usetargetblank')) {
|
---|
701 | $link .= " target=\"_blank\"";
|
---|
702 | }
|
---|
703 | $link .= " href=\"javascript:window.location='".urlencode($url)."';\" title=\"$description\">";
|
---|
704 |
|
---|
705 | /**
|
---|
706 | * If the option to use text links is enabled in the backend, display a text link, otherwise,
|
---|
707 | * display an image.
|
---|
708 | */
|
---|
709 | if (get_option('sociable_usetextlinks')) {
|
---|
710 | $link .= $description;
|
---|
711 | } else {
|
---|
712 | if (strpos($site['favicon'], 'http') === 0) {
|
---|
713 | $imgsrc = $site['favicon'];
|
---|
714 | } else {
|
---|
715 | $imgsrc = $imagepath.$site['favicon'];
|
---|
716 | }
|
---|
717 | $link .= "<img src=\"".$imgsrc."\" title=\"$description\" alt=\"$description\" class=\"sociable-hovers";
|
---|
718 | if (isset($site['class']) && $site['class'])
|
---|
719 | $link .= " sociable_{$site['class']}";
|
---|
720 | $link .= "\" />";
|
---|
721 | }
|
---|
722 | $link .= "</a></li>";
|
---|
723 |
|
---|
724 | /**
|
---|
725 | * Add the list item to the output HTML, but allow other plugins to filter the content first.
|
---|
726 | * This is used for instance in the Google Analytics for WordPress plugin to track clicks
|
---|
727 | * on Sociable links.
|
---|
728 | */
|
---|
729 | $html .= "\t".apply_filters('sociable_link',$link)."\n";
|
---|
730 | $i++;
|
---|
731 | }
|
---|
732 |
|
---|
733 | $html .= "</ul>\n</div>\n";
|
---|
734 |
|
---|
735 | return $html;
|
---|
736 | }
|
---|
737 |
|
---|
738 | /**
|
---|
739 | * Hook the_content to output html if we should display on any page
|
---|
740 | */
|
---|
741 | $sociable_contitionals = get_option('sociable_conditionals');
|
---|
742 | if (is_array($sociable_contitionals) and in_array(true, $sociable_contitionals)) {
|
---|
743 | add_filter('the_content', 'sociable_display_hook');
|
---|
744 | add_filter('the_excerpt', 'sociable_display_hook');
|
---|
745 |
|
---|
746 | /**
|
---|
747 | * Loop through the settings and check whether Sociable should be outputted.
|
---|
748 | */
|
---|
749 | function sociable_display_hook($content='') {
|
---|
750 | $conditionals = get_option('sociable_conditionals');
|
---|
751 | if ((is_home() and $conditionals['is_home']) or
|
---|
752 | (is_single() and $conditionals['is_single']) or
|
---|
753 | (is_page() and $conditionals['is_page']) or
|
---|
754 | (is_category() and $conditionals['is_category']) or
|
---|
755 | (is_tag() and $conditionals['is_tag']) or
|
---|
756 | (is_date() and $conditionals['is_date']) or
|
---|
757 | (is_author() and $conditionals['is_author']) or
|
---|
758 | (is_search() and $conditionals['is_search'])) {
|
---|
759 | $content .= sociable_html();
|
---|
760 | } elseif ((is_feed() and $conditionals['is_feed'])) {
|
---|
761 | $sociable_html = sociable_html();
|
---|
762 | $sociable_html = strip_tags($sociable_html,"<a><img>");
|
---|
763 | $content .= $sociable_html . "<br/><br/>";
|
---|
764 | }
|
---|
765 | return $content;
|
---|
766 | }
|
---|
767 | }
|
---|
768 |
|
---|
769 | /**
|
---|
770 | * Set the default settings on activation on the plugin.
|
---|
771 | */
|
---|
772 | function sociable_activation_hook() {
|
---|
773 | global $wpdb;
|
---|
774 | $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = 'sociableoff'");
|
---|
775 | return sociable_restore_config(false);
|
---|
776 | }
|
---|
777 | register_activation_hook(__FILE__, 'sociable_activation_hook');
|
---|
778 |
|
---|
779 | /**
|
---|
780 | * Add the Sociable menu to the Settings menu
|
---|
781 | * @param boolean $force if set to true, force updates the settings.
|
---|
782 | */
|
---|
783 | function sociable_restore_config($force=false) {
|
---|
784 | global $sociable_known_sites;
|
---|
785 |
|
---|
786 | if ($force or !is_array(get_option('sociable_active_sites')))
|
---|
787 | update_option('sociable_active_sites', array(
|
---|
788 | 'Print',
|
---|
789 | 'Digg',
|
---|
790 | 'Sphinn',
|
---|
791 | 'del.icio.us',
|
---|
792 | 'Facebook',
|
---|
793 | 'Mixx',
|
---|
794 | 'Google',
|
---|
795 | ));
|
---|
796 |
|
---|
797 | if ($force or !is_string(get_option('sociable_tagline')))
|
---|
798 | update_option('sociable_tagline', "<strong>" . __("Share and Enjoy:", 'sociable') . "</strong>");
|
---|
799 |
|
---|
800 | if ($force or !is_array(get_option('sociable_conditionals')))
|
---|
801 | update_option('sociable_conditionals', array(
|
---|
802 | 'is_home' => False,
|
---|
803 | 'is_single' => True,
|
---|
804 | 'is_page' => True,
|
---|
805 | 'is_category' => False,
|
---|
806 | 'is_tag' => False,
|
---|
807 | 'is_date' => False,
|
---|
808 | 'is_search' => False,
|
---|
809 | 'is_author' => False,
|
---|
810 | 'is_feed' => False,
|
---|
811 | ));
|
---|
812 |
|
---|
813 | if ( $force OR !( get_option('sociable_usecss') ) )
|
---|
814 | update_option('sociable_usecss', true);
|
---|
815 | }
|
---|
816 |
|
---|
817 | /**
|
---|
818 | * Add the Sociable menu to the Settings menu
|
---|
819 | */
|
---|
820 | function sociable_admin_menu() {
|
---|
821 | add_options_page('Sociable', 'Sociable', 8, 'Sociable', 'sociable_submenu');
|
---|
822 | }
|
---|
823 | add_action('admin_menu', 'sociable_admin_menu');
|
---|
824 |
|
---|
825 | /**
|
---|
826 | * Make sure the required javascript files are loaded in the Sociable backend, and that they are only
|
---|
827 | * loaded in the Sociable settings page, and nowhere else.
|
---|
828 | */
|
---|
829 | function sociable_admin_js() {
|
---|
830 | if (isset($_GET['page']) && $_GET['page'] == 'Sociable') {
|
---|
831 | global $sociablepluginpath;
|
---|
832 |
|
---|
833 | wp_enqueue_script('jquery');
|
---|
834 | wp_enqueue_script('jquery-ui-core',false,array('jquery'));
|
---|
835 | wp_enqueue_script('jquery-ui-sortable',false,array('jquery','jquery-ui-core'));
|
---|
836 | wp_enqueue_script('sociable-js',$sociablepluginpath.'sociable-admin.js', array('jquery','jquery-ui-core','jquery-ui-sortable'));
|
---|
837 | }
|
---|
838 | }
|
---|
839 | add_action('admin_print_scripts', 'sociable_admin_js');
|
---|
840 |
|
---|
841 | /**
|
---|
842 | * Make sure the required stylesheet is loaded in the Sociable backend, and that it is only
|
---|
843 | * loaded in the Sociable settings page, and nowhere else.
|
---|
844 | */
|
---|
845 | function sociable_admin_css() {
|
---|
846 | global $sociablepluginpath;
|
---|
847 | if (isset($_GET['page']) && $_GET['page'] == 'Sociable')
|
---|
848 | wp_enqueue_style('sociable-css',$sociablepluginpath.'sociable-admin.css');
|
---|
849 | }
|
---|
850 | add_action('admin_print_styles', 'sociable_admin_css');
|
---|
851 |
|
---|
852 | /**
|
---|
853 | * If Wists is active, load it's js file. This is the only site that historically has had a JS file
|
---|
854 | * in Sociable. For all other sites this has so far been refused.
|
---|
855 | */
|
---|
856 | function sociable_js() {
|
---|
857 | if (in_array('Wists', get_option('sociable_active_sites'))) {
|
---|
858 | global $sociablepluginpath;
|
---|
859 | wp_enqueue_script('sociable-wists',$sociablepluginpath.'wists.js');
|
---|
860 | }
|
---|
861 | }
|
---|
862 | add_action('wp_print_scripts', 'sociable_js');
|
---|
863 |
|
---|
864 | /**
|
---|
865 | * If the user has the (default) setting of using the Sociable CSS, load it.
|
---|
866 | */
|
---|
867 | function sociable_css() {
|
---|
868 | if (get_option('sociable_usecss') == true) {
|
---|
869 | global $sociablepluginpath;
|
---|
870 | wp_enqueue_style('sociable-front-css',$sociablepluginpath.'sociable.css');
|
---|
871 | }
|
---|
872 | }
|
---|
873 | add_action('wp_print_styles', 'sociable_css');
|
---|
874 |
|
---|
875 | /**
|
---|
876 | * Update message, used in the admin panel to show messages to users.
|
---|
877 | */
|
---|
878 | function sociable_message($message) {
|
---|
879 | echo "<div id=\"message\" class=\"updated fade\"><p>$message</p></div>\n";
|
---|
880 | }
|
---|
881 |
|
---|
882 | /**
|
---|
883 | * Displays a checkbox that allows users to disable Sociable on a
|
---|
884 | * per post or page basis.
|
---|
885 | */
|
---|
886 | function sociable_meta() {
|
---|
887 | global $post;
|
---|
888 | $sociableoff = false;
|
---|
889 | if (get_post_meta($post->ID,'_sociableoff',true)) {
|
---|
890 | $sociableoff = true;
|
---|
891 | }
|
---|
892 | ?>
|
---|
893 | <input type="checkbox" id="sociableoff" name="sociableoff" <?php checked($sociableoff); ?>/> <label for="sociableoff"><?php _e('Sociable disabled?','sociable') ?></label>
|
---|
894 | <?php
|
---|
895 | }
|
---|
896 |
|
---|
897 | /**
|
---|
898 | * Add the checkbox defined above to post and page edit screens.
|
---|
899 | */
|
---|
900 | function sociable_meta_box() {
|
---|
901 | add_meta_box('sociable','Sociable','sociable_meta','post','side');
|
---|
902 | add_meta_box('sociable','Sociable','sociable_meta','page','side');
|
---|
903 | }
|
---|
904 | add_action('admin_menu', 'sociable_meta_box');
|
---|
905 |
|
---|
906 | /**
|
---|
907 | * If the post is inserted, set the appropriate state for the sociable off setting.
|
---|
908 | */
|
---|
909 | function sociable_insert_post($pID) {
|
---|
910 | if (isset($_POST['sociableoff'])) {
|
---|
911 | if (!get_post_meta($post->ID,'_sociableoff',true))
|
---|
912 | add_post_meta($pID, '_sociableoff', true, true);
|
---|
913 | } else {
|
---|
914 | if (get_post_meta($post->ID,'_sociableoff',true))
|
---|
915 | delete_post_meta($pID, '_sociableoff');
|
---|
916 | }
|
---|
917 | }
|
---|
918 | add_action('wp_insert_post', 'sociable_insert_post');
|
---|
919 |
|
---|
920 | /**
|
---|
921 | * Displays the Sociable admin menu, first section (re)stores the settings.
|
---|
922 | */
|
---|
923 | function sociable_submenu() {
|
---|
924 | global $sociable_known_sites, $sociable_date, $sociablepluginpath;
|
---|
925 |
|
---|
926 | $sociable_known_sites = apply_filters('sociable_known_sites',$sociable_known_sites);
|
---|
927 |
|
---|
928 | if (isset($_REQUEST['restore']) && $_REQUEST['restore']) {
|
---|
929 | check_admin_referer('sociable-config');
|
---|
930 | sociable_restore_config(true);
|
---|
931 | sociable_message(__("Restored all settings to defaults.", 'sociable'));
|
---|
932 | } else if (isset($_REQUEST['save']) && $_REQUEST['save']) {
|
---|
933 | check_admin_referer('sociable-config');
|
---|
934 | $active_sites = Array();
|
---|
935 | if (!$_REQUEST['active_sites'])
|
---|
936 | $_REQUEST['active_sites'] = Array();
|
---|
937 | foreach($_REQUEST['active_sites'] as $sitename=>$dummy)
|
---|
938 | $active_sites[] = $sitename;
|
---|
939 | update_option('sociable_active_sites', $active_sites);
|
---|
940 | /**
|
---|
941 | * Have to delete and re-add because update doesn't hit the db for identical arrays
|
---|
942 | * (sorting does not influence associated array equality in PHP)
|
---|
943 | */
|
---|
944 | delete_option('sociable_active_sites', $active_sites);
|
---|
945 | add_option('sociable_active_sites', $active_sites);
|
---|
946 |
|
---|
947 | foreach ( array('usetargetblank', 'awesmenable', 'usecss', 'usetextlinks') as $val ) {
|
---|
948 | if ( isset($_POST[$val]) && $_POST[$val] )
|
---|
949 | update_option('sociable_'.$val,true);
|
---|
950 | else
|
---|
951 | update_option('sociable_'.$val,false);
|
---|
952 | }
|
---|
953 |
|
---|
954 | foreach ( array('awesmapikey', 'tagline', 'imagedir') as $val ) {
|
---|
955 | if ( !$_POST[$val] )
|
---|
956 | update_option( 'sociable_'.$val, '');
|
---|
957 | else
|
---|
958 | update_option( 'sociable_'.$val, $_POST[$val] );
|
---|
959 | }
|
---|
960 |
|
---|
961 | /**
|
---|
962 | * Update conditional displays
|
---|
963 | */
|
---|
964 | $conditionals = Array();
|
---|
965 | if (!$_POST['conditionals'])
|
---|
966 | $_POST['conditionals'] = Array();
|
---|
967 |
|
---|
968 | $curconditionals = get_option('sociable_conditionals');
|
---|
969 | if (!array_key_exists('is_feed',$curconditionals)) {
|
---|
970 | $curconditionals['is_feed'] = false;
|
---|
971 | }
|
---|
972 | foreach($curconditionals as $condition=>$toggled)
|
---|
973 | $conditionals[$condition] = array_key_exists($condition, $_POST['conditionals']);
|
---|
974 |
|
---|
975 | update_option('sociable_conditionals', $conditionals);
|
---|
976 |
|
---|
977 | sociable_message(__("Saved changes.", 'sociable'));
|
---|
978 | }
|
---|
979 |
|
---|
980 | /**
|
---|
981 | * Show active sites first and in the right order.
|
---|
982 | */
|
---|
983 | $active_sites = get_option('sociable_active_sites');
|
---|
984 | $active = Array();
|
---|
985 | $disabled = $sociable_known_sites;
|
---|
986 | foreach( $active_sites as $sitename ) {
|
---|
987 | $active[$sitename] = $disabled[$sitename];
|
---|
988 | unset($disabled[$sitename]);
|
---|
989 | }
|
---|
990 | uksort($disabled, "strnatcasecmp");
|
---|
991 |
|
---|
992 | /**
|
---|
993 | * Display options.
|
---|
994 | */
|
---|
995 | ?>
|
---|
996 | <form action="<?php echo attribute_escape( $_SERVER['REQUEST_URI'] ); ?>" method="post">
|
---|
997 | <?php
|
---|
998 | if ( function_exists('wp_nonce_field') )
|
---|
999 | wp_nonce_field('sociable-config');
|
---|
1000 | ?>
|
---|
1001 |
|
---|
1002 | <div class="wrap">
|
---|
1003 | <?php screen_icon(); ?>
|
---|
1004 | <h2><?php _e("Sociable Options", 'sociable'); ?></h2>
|
---|
1005 | <table class="form-table">
|
---|
1006 | <tr>
|
---|
1007 | <th>
|
---|
1008 | <?php _e("Sites", "sociable"); ?>:<br/>
|
---|
1009 | <small><?php _e("Check the sites you want to appear on your site. Drag and drop sites to reorder them.", 'sociable'); ?></small>
|
---|
1010 | </th>
|
---|
1011 | <td>
|
---|
1012 | <div style="width: 100%; height: 100%">
|
---|
1013 | <ul id="sociable_site_list">
|
---|
1014 | <?php foreach (array_merge($active, $disabled) as $sitename=>$site) { ?>
|
---|
1015 | <li id="<?php echo $sitename; ?>"
|
---|
1016 | class="sociable_site <?php echo (in_array($sitename, $active_sites)) ? "active" : "inactive"; ?>">
|
---|
1017 | <input
|
---|
1018 | type="checkbox"
|
---|
1019 | id="cb_<?php echo $sitename; ?>"
|
---|
1020 | name="active_sites[<?php echo $sitename; ?>]"
|
---|
1021 | <?php echo (in_array($sitename, $active_sites)) ? ' checked="checked"' : ''; ?>
|
---|
1022 | />
|
---|
1023 | <?php
|
---|
1024 | $imagepath = get_option('sociable_imagedir');
|
---|
1025 | if ($imagepath == "")
|
---|
1026 | $imagepath = $sociablepluginpath.'images/';
|
---|
1027 |
|
---|
1028 | if (strpos($site['favicon'], 'http') === 0) {
|
---|
1029 | $imgsrc = $site['favicon'];
|
---|
1030 | } else {
|
---|
1031 | $imgsrc = $imagepath.$site['favicon'];
|
---|
1032 | }
|
---|
1033 | ?>
|
---|
1034 | <img src="<?php echo $imgsrc; ?>" width="16" height="16" alt="<?php echo $site['description'] ?>" />
|
---|
1035 | <?php echo $sitename; ?>
|
---|
1036 | </li>
|
---|
1037 | <?php } ?>
|
---|
1038 | </ul>
|
---|
1039 | </div>
|
---|
1040 | <input type="hidden" id="site_order" name="site_order" value="<?php echo join('|', array_keys($sociable_known_sites)) ?>" />
|
---|
1041 | </td>
|
---|
1042 | </tr>
|
---|
1043 | <tr>
|
---|
1044 | <th scope="row" valign="top">
|
---|
1045 | <?php _e("Tagline", "sociable"); ?>
|
---|
1046 | </th>
|
---|
1047 | <td>
|
---|
1048 | <?php _e("Change the text displayed in front of the icons below. For complete customization, copy the contents of <em>sociable.css</em> in the Sociable plugin directory to your theme's <em>style.css</em> and disable the use of the sociable stylesheet below.", 'sociable'); ?><br/>
|
---|
1049 | <input size="80" type="text" name="tagline" value="<?php echo attribute_escape(stripslashes(get_option('sociable_tagline'))); ?>" />
|
---|
1050 | </td>
|
---|
1051 | </tr>
|
---|
1052 | <tr>
|
---|
1053 | <th scope="row" valign="top">
|
---|
1054 | <?php _e("Position:", "sociable"); ?>
|
---|
1055 | </th>
|
---|
1056 | <td>
|
---|
1057 | <?php _e("The icons appear at the end of each blog post, and posts may show on many different types of pages. Depending on your theme and audience, it may be tacky to display icons on all types of pages.", 'sociable'); ?><br/>
|
---|
1058 | <br/>
|
---|
1059 | <?php
|
---|
1060 | /**
|
---|
1061 | * Load conditions under which Sociable displays
|
---|
1062 | */
|
---|
1063 | $conditionals = get_option('sociable_conditionals');
|
---|
1064 | ?>
|
---|
1065 | <input type="checkbox" name="conditionals[is_home]"<?php checked($conditionals['is_home']); ?> /> <?php _e("Front page of the blog", 'sociable'); ?><br/>
|
---|
1066 | <input type="checkbox" name="conditionals[is_single]"<?php checked($conditionals['is_single']); ?> /> <?php _e("Individual blog posts", 'sociable'); ?><br/>
|
---|
1067 | <input type="checkbox" name="conditionals[is_page]"<?php checked($conditionals['is_page']); ?> /> <?php _e('Individual WordPress "Pages"', 'sociable'); ?><br/>
|
---|
1068 | <input type="checkbox" name="conditionals[is_category]"<?php checked($conditionals['is_category']); ?> /> <?php _e("Category archives", 'sociable'); ?><br/>
|
---|
1069 | <input type="checkbox" name="conditionals[is_tag]"<?php checked($conditionals['is_tag']); ?> /> <?php _e("Tag listings", 'sociable'); ?><br/>
|
---|
1070 | <input type="checkbox" name="conditionals[is_date]"<?php checked($conditionals['is_date']); ?> /> <?php _e("Date-based archives", 'sociable'); ?><br/>
|
---|
1071 | <input type="checkbox" name="conditionals[is_author]"<?php checked($conditionals['is_author']); ?> /> <?php _e("Author archives", 'sociable'); ?><br/>
|
---|
1072 | <input type="checkbox" name="conditionals[is_search]"<?php checked($conditionals['is_search']); ?> /> <?php _e("Search results", 'sociable'); ?><br/>
|
---|
1073 | <input type="checkbox" name="conditionals[is_feed]"<?php checked($conditionals['is_feed']); ?> /> <?php _e("RSS feed items", 'sociable'); ?><br/>
|
---|
1074 | </td>
|
---|
1075 | </tr>
|
---|
1076 | <tr>
|
---|
1077 | <th scope="row" valign="top">
|
---|
1078 | <?php _e("Use CSS:", "sociable"); ?>
|
---|
1079 | </th>
|
---|
1080 | <td>
|
---|
1081 | <input type="checkbox" name="usecss" <?php checked( get_option('sociable_usecss'), true ); ?> /> <?php _e("Use the sociable stylesheet?", "sociable"); ?>
|
---|
1082 | </td>
|
---|
1083 | </tr>
|
---|
1084 | <tr>
|
---|
1085 | <th scope="row" valign="top">
|
---|
1086 | <?php _e("Use Text Links:", "sociable"); ?>
|
---|
1087 | </th>
|
---|
1088 | <td>
|
---|
1089 | <input type="checkbox" name="usetextlinks" <?php checked( get_option('sociable_usetextlinks'), true ); ?> /> <?php _e("Use text links without images?", "sociable"); ?>
|
---|
1090 | </td>
|
---|
1091 | </tr>
|
---|
1092 | <tr>
|
---|
1093 | <th scope="row" valign="top">
|
---|
1094 | <?php _e("Image directory", "sociable"); ?>
|
---|
1095 | </th>
|
---|
1096 | <td>
|
---|
1097 | <?php _e("Sociable comes with a nice set of images, if you want to replace those with your own, enter the URL where you've put them in here, and make sure they have the same name as the ones that come with Sociable.", 'sociable'); ?><br/>
|
---|
1098 | <input size="80" type="text" name="imagedir" value="<?php echo attribute_escape(stripslashes(get_option('sociable_imagedir'))); ?>" />
|
---|
1099 | </td>
|
---|
1100 | </tr>
|
---|
1101 | <tr>
|
---|
1102 | <th scope="row" valign="top">
|
---|
1103 | <?php _e("Open in new window:", "sociable"); ?>
|
---|
1104 | </th>
|
---|
1105 | <td>
|
---|
1106 | <input type="checkbox" name="usetargetblank" <?php checked( get_option('sociable_usetargetblank'), true ); ?> /> <?php _e("Use <code>target=_blank</code> on links? (Forces links to open a new window)", "sociable"); ?>
|
---|
1107 | </td>
|
---|
1108 | </tr>
|
---|
1109 | <tr>
|
---|
1110 | <th scope="row" valign="top">
|
---|
1111 | <?php _e("awe.sm:", "sociable"); ?>
|
---|
1112 | </th>
|
---|
1113 | <td>
|
---|
1114 | <?php _e("You can choose to automatically have the links posted to certain sites shortened via awe.sm and encoded with the channel info and your API Key.", 'sociable'); ?><br/>
|
---|
1115 | <input type="checkbox" name="awesmenable" <?php checked( get_option('sociable_awesmenable'), true ); ?> /> <?php _e("Enable awe.sm URLs?", "sociable"); ?><br/>
|
---|
1116 | <?php _e("awe.sm API Key:", 'sociable'); ?> <input size="65" type="text" name="awesmapikey" value="<?php echo get_option('sociable_awesmapikey'); ?>" />
|
---|
1117 | </td>
|
---|
1118 | </tr>
|
---|
1119 | <tr>
|
---|
1120 | <td> </td>
|
---|
1121 | <td>
|
---|
1122 | <span class="submit"><input name="save" value="<?php _e("Save Changes", 'sociable'); ?>" type="submit" /></span>
|
---|
1123 | <span class="submit"><input name="restore" value="<?php _e("Restore Built-in Defaults", 'sociable'); ?>" type="submit"/></span>
|
---|
1124 | </td>
|
---|
1125 | </tr>
|
---|
1126 | </table>
|
---|
1127 |
|
---|
1128 | <h2><?php _e('Like this plugin?','sociable'); ?></h2>
|
---|
1129 | <p><?php _e('Why not do any of the following:','sociable'); ?></p>
|
---|
1130 | <ul class="sociablemenu">
|
---|
1131 | <li><?php _e('Link to it so other folks can find out about it.','sociable'); ?></li>
|
---|
1132 | <li><?php _e('<a href="http://wordpress.org/extend/plugins/sociable/">Give it a good rating</a> on WordPress.org.','sociable'); ?></li>
|
---|
1133 | <li><?php _e('<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2017947">Donate a token of your appreciation</a>.','sociable'); ?></li>
|
---|
1134 | </ul>
|
---|
1135 | <h2><?php _e('Need support?','sociable'); ?></h2>
|
---|
1136 | <p><?php _e('If you have any problems or good ideas, please talk about them in the <a href="http://wordpress.org/tags/sociable">Support forums</a>.', 'sociable'); ?></p>
|
---|
1137 |
|
---|
1138 | <h2><?php _e('Credits','sociable'); ?></h2>
|
---|
1139 | <p><?php _e('<a href="http://yoast.com/wordpress/sociable/">Sociable</a> was originally developed by <a href="http://push.cx/">Peter Harkins</a> and has been maintained by <a href="http://yoast.com/">Joost de Valk</a> since the beginning of 2008. It\'s released under the GNU GPL version 2.','Sociable'); ?></p>
|
---|
1140 |
|
---|
1141 |
|
---|
1142 | </div>
|
---|
1143 | </form>
|
---|
1144 | <?php
|
---|
1145 | }
|
---|
1146 |
|
---|
1147 | /**
|
---|
1148 | * Add an icon for the Sociable plugin's settings page to the dropdown for Ozh's admin dropdown menu
|
---|
1149 | */
|
---|
1150 | function sociable_add_ozh_adminmenu_icon( $hook ) {
|
---|
1151 | static $sociableicon;
|
---|
1152 | if (!$sociableicon) {
|
---|
1153 | $sociableicon = WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)). '/book_add.png';
|
---|
1154 | }
|
---|
1155 | if ($hook == 'Sociable') return $sociableicon;
|
---|
1156 | return $hook;
|
---|
1157 | }
|
---|
1158 | add_filter( 'ozh_adminmenu_icon', 'sociable_add_ozh_adminmenu_icon' );
|
---|
1159 |
|
---|
1160 | /**
|
---|
1161 | * Add a settings link to the Plugins page, so people can go straight from the plugin page to the
|
---|
1162 | * settings page.
|
---|
1163 | */
|
---|
1164 | function sociable_filter_plugin_actions( $links, $file ){
|
---|
1165 | // Static so we don't call plugin_basename on every plugin row.
|
---|
1166 | static $this_plugin;
|
---|
1167 | if ( ! $this_plugin ) $this_plugin = plugin_basename(__FILE__);
|
---|
1168 |
|
---|
1169 | if ( $file == $this_plugin ){
|
---|
1170 | $settings_link = '<a href="options-general.php?page=Sociable">' . __('Settings') . '</a>';
|
---|
1171 | array_unshift( $links, $settings_link ); // before other links
|
---|
1172 | }
|
---|
1173 | return $links;
|
---|
1174 | }
|
---|
1175 | add_filter( 'plugin_action_links', 'sociable_filter_plugin_actions', 10, 2 );
|
---|
1176 |
|
---|
1177 | /**
|
---|
1178 | * Add the Yoast.com RSS feed to the WordPress dashboard
|
---|
1179 | */
|
---|
1180 | if (!function_exists('yst_db_widget')) {
|
---|
1181 | function yst_text_limit( $text, $limit, $finish = ' […]') {
|
---|
1182 | if( strlen( $text ) > $limit ) {
|
---|
1183 | $text = substr( $text, 0, $limit );
|
---|
1184 | $text = substr( $text, 0, - ( strlen( strrchr( $text,' ') ) ) );
|
---|
1185 | $text .= $finish;
|
---|
1186 | }
|
---|
1187 | return $text;
|
---|
1188 | }
|
---|
1189 |
|
---|
1190 | function yst_db_widget($image = 'normal', $num = 3, $excerptsize = 250, $showdate = true) {
|
---|
1191 | require_once(ABSPATH.WPINC.'/rss.php');
|
---|
1192 | if ( $rss = fetch_rss( 'http://feeds2.feedburner.com/joostdevalk' ) ) {
|
---|
1193 | echo '<div class="rss-widget">';
|
---|
1194 | if ($image == 'normal') {
|
---|
1195 | echo '<a href="http://yoast.com/" title="Go to Yoast.com"><img src="http://cdn.yoast.com/yoast-logo-rss.png" class="alignright" alt="Yoast"/></a>';
|
---|
1196 | } else {
|
---|
1197 | echo '<a href="http://yoast.com/" title="Go to Yoast.com"><img width="80" src="http://cdn.yoast.com/yoast-logo-rss.png" class="alignright" alt="Yoast"/></a>';
|
---|
1198 | }
|
---|
1199 | echo '<ul>';
|
---|
1200 | $rss->items = array_slice( $rss->items, 0, $num );
|
---|
1201 | foreach ( (array) $rss->items as $item ) {
|
---|
1202 | echo '<li>';
|
---|
1203 | echo '<a class="rsswidget" href="'.clean_url( $item['link'], $protocolls=null, 'display' ).'">'. htmlentities($item['title']) .'</a> ';
|
---|
1204 | if ($showdate)
|
---|
1205 | echo '<span class="rss-date">'. date('F j, Y', strtotime($item['pubdate'])) .'</span>';
|
---|
1206 | echo '<div class="rssSummary">'. yst_text_limit($item['summary'],$excerptsize) .'</div>';
|
---|
1207 | echo '</li>';
|
---|
1208 | }
|
---|
1209 | echo '</ul>';
|
---|
1210 | echo '<div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
|
---|
1211 | echo '<a href="http://feeds2.feedburner.com/joostdevalk"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/rss.png" alt=""/> Subscribe with RSS</a>';
|
---|
1212 | if ($image == 'normal') {
|
---|
1213 | echo ' ';
|
---|
1214 | } else {
|
---|
1215 | echo '<br/>';
|
---|
1216 | }
|
---|
1217 | echo '<a href="http://yoast.com/email-blog-updates/"><img src="http://cdn.yoast.com/email_sub.png" alt=""/> Subscribe by email</a>';
|
---|
1218 | echo '</div>';
|
---|
1219 | echo '</div>';
|
---|
1220 | }
|
---|
1221 | }
|
---|
1222 |
|
---|
1223 | function yst_widget_setup() {
|
---|
1224 | wp_add_dashboard_widget( 'yst_db_widget' , 'The Latest news from Yoast' , 'yst_db_widget');
|
---|
1225 | }
|
---|
1226 |
|
---|
1227 | add_action('wp_dashboard_setup', 'yst_widget_setup');
|
---|
1228 | }
|
---|
1229 | ?>
|
---|