/
social_sharing_toolkit.php
1754 lines (1659 loc) · 93.6 KB
/
social_sharing_toolkit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/*
Plugin Name: Social Sharing Toolkit
Plugin URI: http://www.active-bits.nl/support/social-sharing-toolkit/
Description: This plugin enables sharing of your content via popular social networks and can also convert Twitter names and hashtags to links. Easy & configurable.
Version: 2.0.8
Author: Marijn Rongen
Author URI: http://www.active-bits.nl
for Japanese
http://nob-log.info/2012/03/21/wpsocial-sharing-toolkit-for-japanese/
Author: Nobuhiko
Author: http://nob-log.info
*/
class MR_Social_Sharing_Toolkit {
var $count;
var $options;
var $types;
var $share_buttons;
var $follow_buttons;
function MR_Social_Sharing_Toolkit() {
$this->count = 0;
load_plugin_textdomain( 'mr_social_sharing_toolkit', false, dirname(plugin_basename(__FILE__)).'/languages/');
/* Declare button types */
$this->types['none'] = __('Button','mr_social_sharing_toolkit');
$this->types['none_text'] = __('Button + text','mr_social_sharing_toolkit');
$this->types['horizontal'] = __('Button + side counter','mr_social_sharing_toolkit');
$this->types['vertical'] = __('Button + top counter','mr_social_sharing_toolkit');
$this->types['icon_small'] = __('Small icon','mr_social_sharing_toolkit');
$this->types['icon_small_text'] = __('Small icon + text','mr_social_sharing_toolkit');
$this->types['icon_medium'] = __('Medium icon','mr_social_sharing_toolkit');
$this->types['icon_medium_text'] = __('Medium icon + text','mr_social_sharing_toolkit');
$this->types['icon_large'] = __('Large icon','mr_social_sharing_toolkit');
/* Declare bookmark buttons with options */
$this->share_buttons['fb_like'] = array('icon' => 'facebook', 'title' => 'Facebook Like', 'types' => array('none', 'none_text', 'horizontal', 'vertical'));
$this->share_buttons['fb_send'] = array('icon' => 'facebook', 'title' => 'Facebook Send', 'types' => array('none'));
$this->share_buttons['fb_share'] = array('icon' => 'facebook', 'title' => 'Facebook Share', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['tw_tweet'] = array('icon' => 'twitter', 'title' => 'Twitter', 'id' => '@', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['bf_buffer'] = array('icon' => 'buffer', 'title' => 'Buffer', 'id' => '@', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['gl_plus'] = array('icon' => 'googleplus', 'title' => 'Google+', 'types' => array('none', 'horizontal', 'vertical'));
$this->share_buttons['pn_pinterest'] = array('icon' => 'pinterest', 'title' => 'Pinterest Pin It', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['li_share'] = array('icon' => 'linkedin', 'title' => 'LinkedIn', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['xi_xing'] = array('icon' => 'xing', 'title' => 'Xing', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['tu_tumblr'] = array('icon' => 'tumblr', 'title' => 'Tumblr', 'types' => array('none', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['su_stumble'] = array('icon' => 'stumbleupon', 'title' => 'StumbleUpon', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['dl_delicious'] = array('icon' => 'delicious', 'title' => 'Delicious', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['dg_digg'] = array('icon' => 'digg', 'title' => 'Digg', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['rd_reddit'] = array('icon' => 'reddit', 'title' => 'Reddit', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['ms_myspace'] = array('icon' => 'myspace', 'title' => 'Myspace', 'types' => array('none', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['hv_respect'] = array('icon' => 'hyves', 'title' => 'Hyves Respect', 'types' => array('horizontal'));
$this->share_buttons['ml_send'] = array('icon' => 'email', 'title' => __('Send email','mr_social_sharing_toolkit'), 'types' => array('none', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->share_buttons['ln_break_1'] = array('icon' => 'divider', 'title' => __('Divider','mr_social_sharing_toolkit').' 1', 'types' => array(''));
$this->share_buttons['ln_break_2'] = array('icon' => 'divider', 'title' => __('Divider','mr_social_sharing_toolkit').' 2', 'types' => array(''));
$this->share_buttons['ln_break_3'] = array('icon' => 'divider', 'title' => __('Divider','mr_social_sharing_toolkit').' 3', 'types' => array(''));
/* for japanese */
$this->share_buttons['ha_hatebu'] = array('icon' => 'divider', 'title' => 'Hatebu', 'types' => array('none', 'horizontal', 'vertical'));
$this->share_buttons['gr_grow'] = array('icon' => 'divider', 'title' => 'Grow!', 'id' => 'apikey', 'types' => array('horizontal', 'vertical'));
/* Declare follow buttons with options */
$this->follow_buttons['follow_facebook'] = array('icon' => 'facebook', 'title' => 'Facebook', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_twitter'] = array('icon' => 'twitter', 'title' => 'Twitter', 'id' => '@', 'types' => array('none', 'horizontal', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_plus'] = array('icon' => 'googleplus', 'title' => 'Google+', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_pinterest'] = array('icon' => 'pinterest', 'title' => 'Pinterest', 'id' => 'id:', 'types' => array('none', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_linked'] = array('icon' => 'linkedin', 'title' => 'LinkedIn Person', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_linked_co'] = array('icon' => 'linkedin', 'title' => 'LinkedIn Company', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_linked_group'] = array('icon' => 'linkedin', 'title' => 'LinkedIn Group', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_xing'] = array('icon' => 'xing', 'title' => 'Xing', 'id' => 'id:', 'types' => array('none', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_tumblr'] = array('icon' => 'tumblr', 'title' => 'Tumblr', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_myspace'] = array('icon' => 'myspace', 'title' => 'Myspace', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_hyves'] = array('icon' => 'hyves', 'title' => 'Hyves', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_youtube'] = array('icon' => 'youtube', 'title' => 'YouTube', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_flickr'] = array('icon' => 'flickr', 'title' => 'Flickr', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_500px'] = array('icon' => '500px', 'title' => '500px', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_picasa'] = array('icon' => 'picasa', 'title' => 'Picasa', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_deviant'] = array('icon' => 'deviantart', 'title' => 'deviantArt', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_lastfm'] = array('icon' => 'lastfm', 'title' => 'Last.fm', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_spotify'] = array('icon' => 'spotify', 'title' => 'Spotify', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['follow_rss'] = array('icon' => 'rss', 'title' => __('RSS Feed','mr_social_sharing_toolkit'), 'id' => 'url:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
$this->follow_buttons['ln_break_1'] = array('icon' => 'divider', 'title' => __('Divider','mr_social_sharing_toolkit').' 1', 'types' => array(''));
$this->follow_buttons['ln_break_2'] = array('icon' => 'divider', 'title' => __('Divider','mr_social_sharing_toolkit').' 2', 'types' => array(''));
$this->follow_buttons['ln_break_3'] = array('icon' => 'divider', 'title' => __('Divider','mr_social_sharing_toolkit').' 3', 'types' => array(''));
/* Set defaults and load user options */
$this->get_options();
}
function get_options() {
foreach ($this->share_buttons as $key => $val) {
$buttons[$key] = array('enable' => 0, 'type' => $val['types'][0]);
$shortcodes[$key] = array('enable' => 0, 'type' => $val['types'][0]);
$widgets[$key] = array('enable' => 0, 'type' => $val['types'][0]);
$button_order[] = $key;
$shortcode_order[] = $key;
$widget_order[] = $key;
}
foreach ($this->follow_buttons as $key => $val) {
$followers[$key] = array('enable' => 0, 'type' => $val['types'][0], 'id' => '');
$follow_order[] = $key;
}
$pinterest_options = array('default_image' => '', 'fixed_image' => 0);
$bitly_options = array('enable' => 0, 'username' => '', 'key' => '', 'cache' => array());
$opengraph_options = array('enable' => 0, 'default_image' => '', 'fixed_image' => 0);
$this->options = array('mr_social_sharing_buttons' => $buttons, 'mr_social_sharing_shortcode_buttons' => $shortcodes, 'mr_social_sharing_widget_buttons' => $widgets, 'mr_social_sharing_follow_buttons' => $followers, 'mr_social_sharing_display' => 'span', 'mr_social_sharing_shortcode_display' => 'span', 'mr_social_sharing_widget_display' => 'span', 'mr_social_sharing_follow_display' => 'span', 'mr_social_sharing_align' => '', 'mr_social_sharing_shortcode_align' => '', 'mr_social_sharing_widget_align' => '', 'mr_social_sharing_follow_align' => '', 'mr_social_sharing_position' => 'none', 'mr_social_sharing_types' => array('post', 'page'), 'mr_social_sharing_enable_shortcode' => 1, 'mr_social_sharing_include_excerpts' => 1, 'mr_social_sharing_button_order' => $button_order, 'mr_social_sharing_shortcode_button_order' => $shortcode_order, 'mr_social_sharing_widget_button_order' => $widget_order, 'mr_social_sharing_follow_button_order' => $follow_order, 'mr_social_sharing_linkify_content' => 0, 'mr_social_sharing_linkify_comments' => 0, 'mr_social_sharing_linkify_new' => 1, 'mr_social_sharing_twitter_handles' => 0, 'mr_social_sharing_twitter_hashtags' => 0, 'mr_social_sharing_js_footer' => 1, 'mr_social_sharing_no_follow' => 0, 'mr_social_sharing_pinterest' => $pinterest_options, 'mr_social_sharing_bitly' => $bitly_options, 'mr_social_sharing_opengraph' => $opengraph_options);
foreach ($this->options as $key => $val) {
$this->options[$key] = get_option( $key, $val );
}
if (!is_array($this->options['mr_social_sharing_types'])) {
$types = array();
switch ($this->options['mr_social_sharing_types']) {
case 'both':
$types[] = 'page';
$types[] = 'post';
break;
case 'pages':
$types[] = 'page';
break;
case 'posts':
$types[] = 'post';
break;
}
$this->options['mr_social_sharing_types'] = $types;
}
if ($this->options['mr_social_sharing_position'] == 'shortcode') {
$this->options['mr_social_sharing_position'] = 'none';
$this->options['mr_social_sharing_enable_shortcode'] = 1;
}
foreach ($this->share_buttons as $key => $val) {
if (!array_key_exists($key, $this->options['mr_social_sharing_buttons'])) {
$this->options['mr_social_sharing_buttons'][$key] = array('enable' => 0, 'type' => $val['types'][0]);
}
if (!array_key_exists($key, $this->options['mr_social_sharing_shortcode_buttons'])) {
$this->options['mr_social_sharing_shortcode_buttons'][$key] = array('enable' => 0, 'type' => $val['types'][0]);
}
if (!array_key_exists($key, $this->options['mr_social_sharing_widget_buttons'])) {
$this->options['mr_social_sharing_widget_buttons'][$key] = array('enable' => 0, 'type' => $val['types'][0]);
}
if (!in_array($key, $this->options['mr_social_sharing_button_order'])) {
$this->options['mr_social_sharing_button_order'][] = $key;
}
if (!in_array($key, $this->options['mr_social_sharing_shortcode_button_order'])) {
$this->options['mr_social_sharing_shortcode_button_order'][] = $key;
}
if (!in_array($key, $this->options['mr_social_sharing_widget_button_order'])) {
$this->options['mr_social_sharing_widget_button_order'][] = $key;
}
}
foreach ($this->follow_buttons as $key => $val) {
if (!array_key_exists($key, $this->options['mr_social_sharing_follow_buttons'])) {
$this->options['mr_social_sharing_follow_buttons'][$key] = array('enable' => 0, 'type' => $val['types'][0], 'id' => '');
}
if (!in_array($key, $this->options['mr_social_sharing_follow_button_order'])) {
$this->options['mr_social_sharing_follow_button_order'][] = $key;
}
}
return $this->options;
}
/* Admin functions */
function save_options($new_options) {
foreach ($this->options as $key => $val) {
if (array_key_exists($key, $new_options)) {
update_option( $key, $new_options[$key] );
$this->options[$key] = $new_options[$key] ;
} else {
update_option( $key, 0 );
$this->options[$key] = 0;
}
}
}
function plugin_menu() {
add_options_page('Social Sharing', 'Social Sharing Toolkit', 'manage_options', 'mr_social_sharing', array($this, 'plugin_admin_page'));
add_filter('plugin_row_meta', array('MR_Social_Sharing_Toolkit', 'plugin_links'),10,2);
wp_enqueue_style('mr_social_sharing-admin', plugins_url('/admin.css', __FILE__));
wp_enqueue_script('mr_social_sharing-admin', plugins_url('/admin.js', __FILE__));
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('jquery-ui-sortable');
}
function plugin_links($links, $file) {
if ($file == plugin_basename(__FILE__)) {
$links[] = '<a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=P8ZVNC57E58FE&lc=NL&item_name=WordPress%20plugins%20by%20Marijn%20Rongen&item_number=Social%20Sharing%20Toolkit¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted">'.__('Donate','mr_social_sharing_toolkit').'</a>';
}
return $links;
}
function plugin_admin_page() {
if (!current_user_can('manage_options')) {
wp_die( __('You do not have sufficient permissions to access this page.') );
}
if( isset($_POST['mr_social_sharing_save_options']) && $_POST['mr_social_sharing_save_options'] == 'Y' ) {
$this->save_options($_POST);
echo '
<div class="updated"><p><strong>'.__('Settings saved.','mr_social_sharing_toolkit').'</strong></p></div>';
}
echo '
<div class="wrap">
<form method="post" action="">
<input type="hidden" name="mr_social_sharing_save_options" value="Y"/>
<h2>Social Sharing Toolkit</h2>
<div id="mr_social_sharing_tabs">
<ul class="tabs">
<li><a href="#tab_0">'.__('General settings','mr_social_sharing_toolkit').'</a><li>
<li><a href="#tab_1">'.__('Content','mr_social_sharing_toolkit').'</a><li>
<li><a href="#tab_2">'.__('Shortcode','mr_social_sharing_toolkit').'</a><li>
<li><a href="#tab_3">'.__('Share Widget','mr_social_sharing_toolkit').'</a><li>
<li><a href="#tab_4">'.__('Follow Widget','mr_social_sharing_toolkit').'</a><li>
<li><a href="#tab_5">'.__('Advanced settings','mr_social_sharing_toolkit').'</a><li>
</ul>
<div id="tab_0" class="mr_social_sharing_networks">
<h3>'.__('General settings','mr_social_sharing_toolkit').':</h3>
<label for="mr_social_sharing_js_footer" class="check"><input type="checkbox" name="mr_social_sharing_js_footer" id="mr_social_sharing_js_footer"';
if ($this->options['mr_social_sharing_js_footer'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__('Load JavaScript in footer','mr_social_sharing_toolkit').'</label>
<p>
<span class="description"> '.__('Improves performance but may not work on some themes','mr_social_sharing_toolkit').'</span>
</p>
<p>
'.__('Choose where the buttons must be displayed and if the buttons should be displayed on posts, pages or both.','mr_social_sharing_toolkit').'
</p>
<label for="mr_social_sharing_position">'.__('Button location','mr_social_sharing_toolkit').'</label>
<select name="mr_social_sharing_position" id="mr_social_sharing_position">
<option value="none"';
if ($this->options['mr_social_sharing_position'] == 'none') { echo ' selected="selected"';}
echo '>'.__('Do not display','mr_social_sharing_toolkit').'</option>
<option value="top"';
if ($this->options['mr_social_sharing_position'] == 'top') { echo ' selected="selected"';}
echo '>'.__('Display before content','mr_social_sharing_toolkit').'</option>
<option value="bottom"';
if ($this->options['mr_social_sharing_position'] == 'bottom') { echo ' selected="selected"';}
echo '>'.__('Display after content','mr_social_sharing_toolkit').'</option>
<option value="both"';
if ($this->options['mr_social_sharing_position'] == 'both') { echo ' selected="selected"';}
echo '>'.__('Display before and after content','mr_social_sharing_toolkit').'</option>
</select><br/><br/>
<label for="mr_social_sharing_types">'.__('Place buttons on','mr_social_sharing_toolkit').'</label><br/>';
$types = get_post_types();
if (is_array($types) && count($types) > 0) {
foreach ($types as $type) {
if (!in_array($type, array('attachment','revision','nav_menu_item'))) {
echo '<label for="share_type_'.$type.'"><input type="checkbox" id="share_type_'.$type.'" name="mr_social_sharing_types[]" value="'.$type.'"';
if (is_array($this->options['mr_social_sharing_types']) && in_array($type, $this->options['mr_social_sharing_types'])) {
echo ' checked="checked"';
}
echo '/>'.ucfirst(__($type)).'</label><br/>';
}
}
}
echo '
<br/>
<label for="mr_social_sharing_enable_shortcode" class="check"><input type="checkbox" name="mr_social_sharing_enable_shortcode" id="mr_social_sharing_enable_shortcode"';
if ($this->options['mr_social_sharing_enable_shortcode'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__('Enable shortcode').'</label><br/>
<p><span class="description"> '.__('Use the shortcode [social_share/] where you want the buttons to appear', 'mr_social_sharing_toolkit').'</span></p>
<label for="mr_social_sharing_include_excerpts" class="check"><input type="checkbox" name="mr_social_sharing_include_excerpts" id="mr_social_sharing_include_excerpts"';
if ($this->options['mr_social_sharing_include_excerpts'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__('Include buttons in excerpts','mr_social_sharing_toolkit').'</label>
<p><span class="description">'.__('Uncheck this box if you are having issues displaying the buttons with excerpts (some themes have custom excerpt functions which do not play nice with the plugin).','mr_social_sharing_toolkit').'</p>
<label for="mr_social_sharing_no_follow" class="check"><input type="checkbox" name="mr_social_sharing_no_follow" id="mr_social_sharing_no_follow"';
if ($this->options['mr_social_sharing_no_follow'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__('Use rel="nofollow" on links to social networks','mr_social_sharing_toolkit').'</label>
</div>
<div id="tab_1" class="mr_social_sharing_networks">
<h3>'.__('Content','mr_social_sharing_toolkit').'</h3>
<p>
'.__('Check the boxes to display the button on your website. For each button you can select a separate style from the dropdown box. You can change the order of the buttons by dragging them to the desired location in the list. For the tweet button you can also fill in your Twitter username which will then be appended to the tweet (like via @WordPress).','mr_social_sharing_toolkit').'
</p>';
$this->showListAdmin($this->share_buttons);
echo '
</div>
<div id="tab_2" class="mr_social_sharing_networks">
<h3>'.__('Shortcode','mr_social_sharing_toolkit').'</h3>
<p>
'.__('Check the boxes to display the button on your website. For each button you can select a separate style from the dropdown box. You can change the order of the buttons by dragging them to the desired location in the list. For the tweet button you can also fill in your Twitter username which will then be appended to the tweet (like via @WordPress).','mr_social_sharing_toolkit').'
</p>';
$this->showListAdmin($this->share_buttons, 'shortcode_');
echo '
</div>
<div id="tab_3" class="mr_social_sharing_networks">
<h3>'.__('Share Widget','mr_social_sharing_toolkit').'</h3>
<p>
'.__('Check the boxes to display the button on Social Sharing Toolkit Share widget. For each button you can select a separate style from the dropdown box. You can change the order of the buttons by dragging them to the desired location in the list. For the tweet button you can also fill in your Twitter username which will then be appended to the tweet (like via @WordPress).','mr_social_sharing_toolkit').'
<br/><br/>
'.__('For each widget you can enter a fixed url and title for the buttons, to do this','mr_social_sharing_toolkit').' <a href="widgets.php">'.__('go to the widget configuration page','mr_social_sharing_toolkit').'</a>.
</p>';
$this->showListAdmin($this->share_buttons, 'widget_');
echo '
</div>
<div id="tab_4" class="mr_social_sharing_networks">
<h3>'.__('Follow Widget','mr_social_sharing_toolkit').'</h3>
<p>
'.__('Check the boxes to display the button on Social Sharing Toolkit Follow widget. For each button you can select a separate style from the dropdown box. You can change the order of the buttons by dragging them to the desired location in the list.','mr_social_sharing_toolkit').'
<br/><br/>
'.__('For each button you only have to enter your id or username of the network as it appears in the url of your profile page. You will need to enter the complete url for the RSS Feed (including the http:// part) if you wish to display this button.','mr_social_sharing_toolkit').'
<br/>
<br/>
'.__('To add the widget to your website','mr_social_sharing_toolkit').' <a href="widgets.php">'.__('go to the widget configuration page','mr_social_sharing_toolkit').'</a>.
</p>';
$this->showListAdmin($this->follow_buttons, 'follow_');
echo '
</div>
<div id="tab_5" class="mr_social_sharing_networks">
<h3>'.__('Advanced settings','mr_social_sharing_toolkit').'</h3>
<h4>'.__('Automatic Twitter links','mr_social_sharing_toolkit').'</h4>
<p>'.__('Select what you want to convert:','mr_social_sharing_toolkit').'</p>
<label for="mr_social_sharing_twitter_handles" class="check"><input type="checkbox" name="mr_social_sharing_twitter_handles" id="mr_social_sharing_twitter_handles"';
if ($this->options['mr_social_sharing_twitter_handles'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__("Convert Twitter usernames", 'mr_social_sharing_toolkit').'</label><br/>
<label for="mr_social_sharing_twitter_hashtags" class="check"><input type="checkbox" name="mr_social_sharing_twitter_hashtags" id="mr_social_sharing_twitter_hashtags"';
if ($this->options['mr_social_sharing_twitter_hashtags'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__("Convert hashtags", 'mr_social_sharing_toolkit').'</label>
<p>'.__('And where it should be converted:','mr_social_sharing_toolkit').'</p>
<label for="mr_social_sharing_linkify_content" class="check"><input type="checkbox" name="mr_social_sharing_linkify_content" id="mr_social_sharing_linkify_content"';
if ($this->options['mr_social_sharing_linkify_content'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__("Convert in posts and pages", 'mr_social_sharing_toolkit').'</label><br/>
<label for="mr_social_sharing_linkify_comments" class="check"><input type="checkbox" name="mr_social_sharing_linkify_comments" id="mr_social_sharing_linkify_comments"';
if ($this->options['mr_social_sharing_linkify_comments'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__("Convert in comments", 'mr_social_sharing_toolkit').'</label><br/>
<label for="mr_social_sharing_linkify_new" class="check"><input type="checkbox" name="mr_social_sharing_linkify_new" id="mr_social_sharing_linkify_new"';
if ($this->options['mr_social_sharing_linkify_new'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__("Open links in new window or tab", 'mr_social_sharing_toolkit').'</label>
<h4>'.__('Bitly','mr_social_sharing_toolkit').'</h4>
<p>'.__('Use Bitly url shortening for the tweet button','mr_social_sharing_toolkit').'</p>
<label for="mr_social_sharing_bitly_enable" class="check"><input type="checkbox" name="mr_social_sharing_bitly[enable]" id="mr_social_sharing_bitly_enable"';
if ($this->options['mr_social_sharing_bitly']['enable'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__("Enable Bitly URL shortening", 'mr_social_sharing_toolkit').'</label></br/>
<label for="mr_social_sharing_bitly_username">'.__('Your bitly Username','mr_social_sharing_toolkit').'</label>
<input type="text" name="mr_social_sharing_bitly[username]" id="mr_social_sharing_bitly_username" value="'.$this->options['mr_social_sharing_bitly']['username'].'"/></br/>
<label for="mr_social_sharing_bitly_key">'.__('Your bitly API Key','mr_social_sharing_toolkit').'</label>
<input type="text" name="mr_social_sharing_bitly[key]" id="mr_social_sharing_bitly_key" value="'.$this->options['mr_social_sharing_bitly']['key'].'"/>
<h4>'.__('Pinterest','mr_social_sharing_toolkit').'</h4>
<label for="mr_social_sharing_pinterest_default_image">'.__('Default image URL','mr_social_sharing_toolkit').'</label>
<input type="text" name="mr_social_sharing_pinterest[default_image]" id="mr_social_sharing_pinterest_default_image" value="'.$this->options['mr_social_sharing_pinterest']['default_image'].'"/></br/>
<p><span class="description">'.__('You can specify a link to an image you would like to use for Pinterest pins when no image is available','mr_social_sharing_toolkit').'</span></p>
<label for="mr_social_sharing_pinterest_fixed_image" class="check"><input type="checkbox" name="mr_social_sharing_pinterest[fixed_image]" id="mr_social_sharing_pinterest_fixed_image"';
if ($this->options['mr_social_sharing_pinterest']['fixed_image'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__("Always use the default image", 'mr_social_sharing_toolkit').'</label><br/>
<p><span class="description">'.__("Check this box to always display the default image with your Pins", 'mr_social_sharing_toolkit').'</span></p>
<h4>'.__('OpenGraph','mr_social_sharing_toolkit').'</h4>
<p>'.__('Include Open Graph tags','mr_social_sharing_toolkit').'</p>
<label for="mr_social_sharing_opengraph_enable" class="check"><input type="checkbox" name="mr_social_sharing_opengraph[enable]" id="mr_social_sharing_opengraph_enable"';
if ($this->options['mr_social_sharing_opengraph']['enable'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__("Enable Open Graph", 'mr_social_sharing_toolkit').'</label><br/>
<label for="mr_social_sharing_opengraph_default_image">'.__('Default image URL','mr_social_sharing_toolkit').'</label>
<input type="text" name="mr_social_sharing_opengraph[default_image]" id="mr_social_sharing_opengraph_default_image" value="'.$this->options['mr_social_sharing_opengraph']['default_image'].'"/></br/>
<p><span class="description">'.__('You can specify a link to an image you would like to include in your likes and shares','mr_social_sharing_toolkit').'</span></p>
<label for="mr_social_sharing_opengraph_fixed_image" class="check"><input type="checkbox" name="mr_social_sharing_opengraph[fixed_image]" id="mr_social_sharing_opengraph_fixed_image"';
if ($this->options['mr_social_sharing_opengraph']['fixed_image'] == 1) { echo ' checked="checked"';}
echo ' value="1" /> '.__("Always use the default image", 'mr_social_sharing_toolkit').'</label><br/>
<p><span class="description">'.__("Check this box to always display the default image with your shared content", 'mr_social_sharing_toolkit').'</span></p>
</div>
</div>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="'.esc_attr__('Save Changes').'" />
</p>
<div class="mr_social_sharing_networks">
<h3>'.__('Thank you for using the Social Sharing Toolkit!','mr_social_sharing_toolkit').'</h3>
<p>
'.__('For questions or requests about this plugin please use the','mr_social_sharing_toolkit').' <a href="http://www.active-bits.nl/support/social-sharing-toolkit/" target="_blank">'.__('official plugin page','mr_social_sharing_toolkit').'</a>.
'.__('If you like the plugin I would appreciate it if you provide a rating of the','mr_social_sharing_toolkit').' <a href="http://wordpress.org/extend/plugins/social-sharing-toolkit/" target="_blank">'.__('plugin on WordPress.org','mr_social_sharing_toolkit').'</a>. '.__('If you really like the plugin you can also','mr_social_sharing_toolkit').' <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=P8ZVNC57E58FE&lc=NL&item_name=WordPress%20plugins%20by%20Marijn%20Rongen&item_number=Social%20Sharing%20Toolkit¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted" target="_blank">'.__('donate here','mr_social_sharing_toolkit').'</a>.
</p>
</div>
<div class="mr_social_sharing_networks banners">
'.$this->getBanner().'
</div>
</form>
</div>';
}
function showListAdmin($buttons, $button_type = '') {
echo '
<ul id="mr_social_sharing_'.$button_type.'networks">';
foreach ($this->options['mr_social_sharing_'.$button_type.'button_order'] as $button) {
echo '
<li>
<img src="'.plugins_url('/images/icons_small/'.$buttons[$button]['icon'].'.png', __FILE__).'" title="'.$buttons[$button]['title'].'" alt="'.$buttons[$button]['title'].'"/>
<label for="mr_social_sharing_'.$button_type.$button.'"><input type="checkbox" name="mr_social_sharing_'.$button_type.'buttons['.$button.'][enable]" id="mr_social_sharing_'.$button_type.$button.'"';
if ($this->options['mr_social_sharing_'.$button_type.'buttons'][$button]['enable'] == 1) { echo ' checked="checked"';}
echo ' value="1" />'.$buttons[$button]['title'].'</label>
<img class="right" src="'.plugins_url('/images/move.png', __FILE__).'" title="'.__('Change button order','mr_social_sharing_toolkit').'" alt="'.__('Change button order','mr_social_sharing_toolkit').'"/>';
if (is_array($buttons[$button]['types']) && $buttons[$button]['types'][0] != '') {
if (count($buttons[$button]['types']) == 1) {
echo '
<input type="hidden" name="mr_social_sharing_'.$button_type.'buttons['.$button.'][type]" value="'.$buttons[$button]['types'][0].'"/>';
} else {
echo '
<select name="mr_social_sharing_'.$button_type.'buttons['.$button.'][type]" id="mr_social_sharing_'.$button_type.$button.'_type">';
foreach ($buttons[$button]['types'] as $type) {
echo '<option value="'.$type.'"';
if ($this->options['mr_social_sharing_'.$button_type.'buttons'][$button]['type'] == $type) { echo ' selected="selected"';}
echo '>'.$this->types[$type].'</option>';
}
echo '</select>';
}
} else {
echo '
<input type="hidden" name="mr_social_sharing_'.$button_type.'buttons['.$button.'][type]" value=""/>';
}
if (array_key_exists('id', $buttons[$button])) {
if (is_array($buttons[$button]['id']) && array_key_exists('label', $buttons[$button]['id']) && array_key_exists('options', $buttons[$button]['id']) && is_array($buttons[$button]['id']['options'])) {
echo '
<select name="mr_social_sharing_'.$button_type.'buttons['.$button.'][id]" id="mr_social_sharing_'.$button_type.$button.'_id">';
foreach ($buttons[$button]['id']['options'] as $option) {
if (array_key_exists('label', $option) && array_key_exists('value', $option)) {
echo '<option value="'.$option['value'].'"';
if ($option['value'] == $this->options['mr_social_sharing_'.$button_type.'buttons'][$button]['id']) {
echo ' selected="selected"';
}
echo '>'.$option['label'].'</option>';
}
}
echo '</select>';
// <label for="mr_social_sharing_'.$button_type.$button.'_id" class="text">'.$buttons[$button]['id']['label'].'</label>';
} else {
echo '
<input type="text" class="text" name="mr_social_sharing_'.$button_type.'buttons['.$button.'][id]" id="mr_social_sharing_'.$button_type.$button.'_id" value="'.$this->options['mr_social_sharing_'.$button_type.'buttons'][$button]['id'].'"/>
<label for="mr_social_sharing_'.$button_type.$button.'_id" class="text">'.$buttons[$button]['id'].'</label>';
}
}
echo '
<input type="hidden" name="mr_social_sharing_'.$button_type.'button_order[]" value="'.$button.'"/>
</li>';
}
echo '
</ul>
<p>
'.__('Choose button orientation horizontal to display the buttons side by side, vertical will place them below each other. You can also select an alignment to better suit your theme.','mr_social_sharing_toolkit').'
</p>
<label for="mr_social_sharing_'.$button_type.'display">'.__('Button orientation','mr_social_sharing_toolkit').'</label>
<select name="mr_social_sharing_'.$button_type.'display" id="mr_social_sharing_'.$button_type.'display">
<option value="span"';
if ($this->options['mr_social_sharing_'.$button_type.'display'] == 'span') { echo ' selected="selected"';}
echo '>'.__('Horizontal','mr_social_sharing_toolkit').'</option>
<option value="div"';
if ($this->options['mr_social_sharing_'.$button_type.'display'] == 'div') { echo ' selected="selected"';}
echo '>'.__('Vertical','mr_social_sharing_toolkit').'</option>
</select><br/>
<label for="mr_social_sharing_'.$button_type.'align">'.__('Button alignment','mr_social_sharing_toolkit').'</label>
<select name="mr_social_sharing_'.$button_type.'align" id="mr_social_sharing_'.$button_type.'align">
<option value=""';
if ($this->options['mr_social_sharing_'.$button_type.'align'] == '') { echo ' selected="selected"';}
echo '>'.__('Align to bottom','mr_social_sharing_toolkit').'</option>
<option value="_top"';
if ($this->options['mr_social_sharing_'.$button_type.'align'] == '_top') { echo ' selected="selected"';}
echo '>'.__('Align to top','mr_social_sharing_toolkit').'</option>
</select>';
}
/* Affiliates */
function getBanner() {
$banners = array();
// ElegantThemes:
$banners[] = '<a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=14757_0_1_7" target="_blank"><img border="0" src="http://www.elegantthemes.com/affiliates/banners/468x60.gif" width="468" height="60"></a>';
$banners[] = '<a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=14757_0_1_7" target="_blank"><img border="0" src="http://www.elegantthemes.com/affiliates/banners/468x60.gif" width="468" height="60"></a>';
$banners[] = '<a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=14757_0_1_7" target="_blank"><img border="0" src="http://www.elegantthemes.com/affiliates/banners/468x60.gif" width="468" height="60"></a>';
$banners[] = '<a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=14757_0_1_7" target="_blank"><img border="0" src="http://www.elegantthemes.com/affiliates/banners/468x60.gif" width="468" height="60"></a>';
// WooThemes:
$banners[] = '<a href="http://www.woothemes.com/woomember/go?r=188860&i=l104" target="_blank"><img src="http://www.woothemes.com/ads/wc_468x60_grey.png" /></a>';
$banners[] = '<a href="http://www.woothemes.com/woomember/go?r=188860&i=l102" target="_blank"><img src="http://www.woothemes.com/ads/wc_468x60_3_grey.png" /></a>';
$banners[] = '<a href="http://www.woothemes.com/woomember/go?r=188860&i=l44" target="_blank"><img src="http://woothemes.com/ads/468x60c.jpg" /></a>';
$banners[] = '<a href="http://www.woothemes.com/woomember/go?r=188860&i=l43" target="_blank"><img src="http://woothemes.com/ads/468x60b.jpg" /></a>';
// Mojo Themes:
$banners[] = '<a href="http://www.mojo-themes.com/categories/wordpress/?r=mrongen" target="_blank"><img src="'.plugins_url('/banners/mojo_1.jpg', __FILE__).'" /></a>';
$banners[] = '<a href="http://www.mojo-themes.com/?r=mrongen" target="_blank"><img src="'.plugins_url('/banners/mojo_1.jpg', __FILE__).'" /></a>';
$banners[] = '<a href="http://www.mojo-themes.com/categories/wordpress/?r=mrongen" target="_blank"><img src="'.plugins_url('/banners/mojo_2.jpg', __FILE__).'" /></a>';
$banners[] = '<a href="http://www.mojo-themes.com/?r=mrongen" target="_blank"><img src="'.plugins_url('/banners/mojo_2.jpg', __FILE__).'" /></a>';
// ThemeForest:
$banners[] = '<a href="http://themeforest.net/category/wordpress?ref=MRongen" target="_blank"><img src="'.plugins_url('/banners/themeforest.gif', __FILE__).'" /></a>';
$banners[] = '<a href="http://activeden.net/?ref=MRongen" target="_blank"><img src="'.plugins_url('/banners/activeden.gif', __FILE__).'" /></a>';
$banners[] = '<a href="http://audiojungle.net/?ref=MRongen" target="_blank"><img src="'.plugins_url('/banners/audiojungle.gif', __FILE__).'" /></a>';
$banners[] = '<a href="http://videohive.net/?ref=MRongen" target="_blank"><img src="'.plugins_url('/banners/videohive.gif', __FILE__).'" /></a>';
$banners[] = '<a href="http://graphicriver.net/?ref=MRongen" target="_blank"><img src="'.plugins_url('/banners/graphicriver.gif', __FILE__).'" /></a>';
$banners[] = '<a href="http://3docean.net/?ref=MRongen" target="_blank"><img src="'.plugins_url('/banners/3docean.gif', __FILE__).'" /></a>';
$banners[] = '<a href="http://codecanyon.net/?ref=MRongen" target="_blank"><img src="'.plugins_url('/banners/codecanyon.gif', __FILE__).'" /></a>';
$banners[] = '<a href="http://marketplace.tutsplus.com/?ref=MRongen" target="_blank"><img src="'.plugins_url('/banners/tutsplus.gif', __FILE__).'" /></a>';
$banners[] = '<a href="http://photodune.net/?ref=MRongen" target="_blank"><img src="'.plugins_url('/banners/photodune.gif', __FILE__).'" /></a>';
shuffle($banners);
return $banners[0];
}
/* Output functions */
function print_opengraph() {
echo '<!-- Open Graph tags provided by Social Sharing Toolkit v2.0.8 -->
<meta property="og:locale" content="'.str_replace('-', '_', get_bloginfo('language')).'"/>';
if (is_single() || is_page()) {
$excerpt = get_the_excerpt();
echo '
<meta property="og:title" content="'.trim(wp_title('', 0)).'"/>';
if ($excerpt != '') {
echo '
<meta property="og:description" content="'.$excerpt.'"/>';
} else {
echo '
<meta property="og:description" content="'.get_bloginfo('description').'"/>';
}
echo '
<meta property="og:url" content="'.get_permalink().'"/>
<meta property="og:type" content="article"/>';
} else {
echo '
<meta property="og:title" content="'.get_bloginfo('name').'"/>
<meta property="og:description" content="'.get_bloginfo('description').'"/>
<meta property="og:url" content="'.get_home_url().'"/>
<meta property="og:type" content="website"/>';
}
echo '
<meta property="og:site_name" content="'.get_bloginfo('name').'"/>';
if ($this->options['mr_social_sharing_opengraph']['fixed_image']) {
if ($this->options['mr_social_sharing_opengraph']['default_image'] != '') {
echo '
<meta property="og:image" content="'.$this->options['mr_social_sharing_opengraph']['default_image'].'"/>';
}
} else {
$media = '';
if (current_theme_supports('post-thumbnails')) {
if ($media = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), array(300,300))) {
if (is_array($media)) {
$media = $media[0];
} else {
$media = '';
}
}
}
if ($media == '') {
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', get_the_content(), $matches);
$img = $matches[1][0];
if($img != '') {
$media = $img;
}
}
if ($media != '') {
echo '
<meta property="og:image" content="'.$media.'"/>';
} elseif ($this->options['mr_social_sharing_opengraph']['default_image'] != '') {
echo '
<meta property="og:image" content="'.$this->options['mr_social_sharing_opengraph']['default_image'].'"/>';
}
}
}
function prepare_styles() {
wp_enqueue_style('mr_social_sharing', plugins_url('/style.css', __FILE__));
}
function prepare_scripts() {
$lang = __('en_US','mr_social_sharing_toolkit');
if ($this->options['mr_social_sharing_no_follow'] == 1) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('mr_social_sharing', plugins_url('/script_no_follow.js', __FILE__), array('jquery'), false, true);
} else {
wp_enqueue_script('mr_social_sharing', plugins_url('/script_no_follow.js', __FILE__), array('jquery'));
}
} else {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('mr_social_sharing', plugins_url('/script.js', __FILE__), array('jquery'), false, true);
} else {
wp_enqueue_script('mr_social_sharing', plugins_url('/script.js', __FILE__), array('jquery'));
}
}
// ###
if (($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['fb_send']['enable'] == 1) || $this->options['mr_social_sharing_widget_buttons']['fb_send']['enable'] == 1 || ($this->options['mr_social_sharing_enable_shortcode'] == 1 && $this->options['mr_social_sharing_shortcode_buttons']['fb_send']['enable'] == 1)) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('FacebookSend', 'http://connect.facebook.net/'.$lang.'/all.js#xfbml=1', array(), false, true);
} else {
wp_enqueue_script('FacebookSend', 'http://connect.facebook.net/'.$lang.'/all.js#xfbml=1');
}
}
if (($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['fb_share']['enable'] == 1) || $this->options['mr_social_sharing_widget_buttons']['fb_share']['enable'] == 1 || ($this->options['mr_social_sharing_enable_shortcode'] == 1 && $this->options['mr_social_sharing_shortcode_buttons']['fb_share']['enable'] == 1)) {
if (in_array($this->options['mr_social_sharing_buttons']['fb_share']['type'], array('horizontal','vertical','none')) || in_array($this->options['mr_social_sharing_widget_buttons']['fb_share']['type'], array('horizontal','vertical','none'))) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('FacebookShare', 'http://static.ak.fbcdn.net/connect.php/js/FB.Share', array(), false, true);
} else {
wp_enqueue_script('FacebookShare', 'http://static.ak.fbcdn.net/connect.php/js/FB.Share');
}
}
}
// ###
$google_script = false;
$digg_script = false;
$linked_script = false;
$tweet_script = false;
$buffer_script = false;
$stumble_script = false;
$delicious_script = false;
$pinit_script = false;
$xing_script = false;
if ($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['gl_plus']['enable'] == 1) {
$google_script = true;
}
if ($this->options['mr_social_sharing_widget_buttons']['gl_plus']['enable'] == 1) {
$google_script = true;
}
if ($this->options['mr_social_sharing_enable_shortcode'] == 1 && $this->options['mr_social_sharing_shortcode_buttons']['gl_plus']['enable'] == 1) {
$google_script = true;
}
if ($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['gr_grow']['enable'] == 1 && in_array($this->options['mr_social_sharing_buttons']['gr_grow']['type'], array('horizontal','vertical'))) {
$grow_script = true;
}
if ($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['dg_digg']['enable'] == 1 && in_array($this->options['mr_social_sharing_buttons']['dg_digg']['type'], array('horizontal','vertical'))) {
$digg_script = true;
}
if ($this->options['mr_social_sharing_widget_buttons']['dg_digg']['enable'] == 1 && in_array($this->options['mr_social_sharing_widget_buttons']['dg_digg']['type'], array('horizontal','vertical'))) {
$digg_script = true;
}
if ($this->options['mr_social_sharing_enable_shortcode'] == 1 && $this->options['mr_social_sharing_shortcode_buttons']['dg_digg']['enable'] == 1 && in_array($this->options['mr_social_sharing_shortcode_buttons']['dg_digg']['type'], array('horizontal','vertical'))) {
$digg_script = true;
}
if ($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['li_share']['enable'] == 1 && in_array($this->options['mr_social_sharing_buttons']['li_share']['type'], array('horizontal','vertical','none'))) {
$linked_script = true;
}
if ($this->options['mr_social_sharing_widget_buttons']['li_share']['enable'] == 1 && in_array($this->options['mr_social_sharing_widget_buttons']['li_share']['type'], array('horizontal','vertical','none'))) {
$linked_script = true;
}
if ($this->options['mr_social_sharing_enable_shortcode'] == 1 && $this->options['mr_social_sharing_shortcode_buttons']['li_share']['enable'] == 1 && in_array($this->options['mr_social_sharing_shortcode_buttons']['li_share']['type'], array('horizontal','vertical','none'))) {
$linked_script = true;
}
if ($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['tw_tweet']['enable'] == 1 && in_array($this->options['mr_social_sharing_buttons']['tw_tweet']['type'], array('horizontal','vertical'))) {
$tweet_script = true;
}
if ($this->options['mr_social_sharing_widget_buttons']['tw_tweet']['enable'] == 1 && in_array($this->options['mr_social_sharing_widget_buttons']['tw_tweet']['type'], array('horizontal','vertical'))) {
$tweet_script = true;
}
if ($this->options['mr_social_sharing_enable_shortcode'] == 1 && $this->options['mr_social_sharing_shortcode_buttons']['tw_tweet']['enable'] == 1 && in_array($this->options['mr_social_sharing_shortcode_buttons']['tw_tweet']['type'], array('horizontal','vertical'))) {
$tweet_script = true;
}
if ($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['bf_buffer']['enable'] == 1 && in_array($this->options['mr_social_sharing_buttons']['bf_buffer']['type'], array('none','horizontal','vertical'))) {
$buffer_script = true;
}
if ($this->options['mr_social_sharing_widget_buttons']['bf_buffer']['enable'] == 1 && in_array($this->options['mr_social_sharing_widget_buttons']['bf_buffer']['type'], array('none','horizontal','vertical'))) {
$buffer_script = true;
}
if ($this->options['mr_social_sharing_enable_shortcode'] == 1 && $this->options['mr_social_sharing_shortcode_buttons']['bf_buffer']['enable'] == 1 && in_array($this->options['mr_social_sharing_shortcode_buttons']['bf_buffer']['type'], array('none','horizontal','vertical'))) {
$buffer_script = true;
}
if ($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['su_stumble']['enable'] == 1 && in_array($this->options['mr_social_sharing_buttons']['su_stumble']['type'], array('horizontal', 'vertical'))) {
$stumble_script = true;
}
if ($this->options['mr_social_sharing_widget_buttons']['su_stumble']['enable'] == 1 && in_array($this->options['mr_social_sharing_widget_buttons']['su_stumble']['type'], array('horizontal', 'vertical'))) {
$stumble_script = true;
}
if ($this->options['mr_social_sharing_enable_shortcode'] == 1 && $this->options['mr_social_sharing_shortcode_buttons']['su_stumble']['enable'] == 1 && in_array($this->options['mr_social_sharing_shortcode_buttons']['su_stumble']['type'], array('horizontal', 'vertical'))) {
$stumble_script = true;
}
if ($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['dl_delicious']['enable'] == 1 && in_array($this->options['mr_social_sharing_buttons']['dl_delicious']['type'], array('horizontal', 'vertical'))) {
$delicious_script = true;
}
if ($this->options['mr_social_sharing_widget_buttons']['dl_delicious']['enable'] == 1 && in_array($this->options['mr_social_sharing_widget_buttons']['dl_delicious']['type'], array('horizontal', 'vertical'))) {
$delicious_script = true;
}
if ($this->options['mr_social_sharing_enable_shortcode'] == 1 && $this->options['mr_social_sharing_shortcode_buttons']['dl_delicious']['enable'] == 1 && in_array($this->options['mr_social_sharing_shortcode_buttons']['dl_delicious']['type'], array('horizontal', 'vertical'))) {
$delicious_script = true;
}
if ($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['pn_pinterest']['enable'] == 1 && in_array($this->options['mr_social_sharing_buttons']['pn_pinterest']['type'], array('none', 'horizontal', 'vertical'))) {
$pinit_script = true;
}
if ($this->options['mr_social_sharing_widget_buttons']['pn_pinterest']['enable'] == 1 && in_array($this->options['mr_social_sharing_widget_buttons']['pn_pinterest']['type'], array('none', 'horizontal', 'vertical'))) {
$pinit_script = true;
}
if ($this->options['mr_social_sharing_enable_shortcode'] == 1 && $this->options['mr_social_sharing_shortcode_buttons']['pn_pinterest']['enable'] == 1 && in_array($this->options['mr_social_sharing_shortcode_buttons']['pn_pinterest']['type'], array('none', 'horizontal', 'vertical'))) {
$pinit_script = true;
}
if ($this->options['mr_social_sharing_position'] != 'none' && $this->options['mr_social_sharing_buttons']['xi_xing']['enable'] == 1 && in_array($this->options['mr_social_sharing_buttons']['xi_xing']['type'], array('none','horizontal','vertical'))) {
$xing_script = true;
}
if ($this->options['mr_social_sharing_widget_buttons']['xi_xing']['enable'] == 1 && in_array($this->options['mr_social_sharing_widget_buttons']['xi_xing']['type'], array('none','horizontal','vertical'))) {
$xing_script = true;
}
if ($this->options['mr_social_sharing_enable_shortcode'] == 1 && $this->options['mr_social_sharing_shortcode_buttons']['xi_xing']['enable'] == 1 && in_array($this->options['mr_social_sharing_shortcode_buttons']['xi_xing']['type'], array('none','horizontal','vertical'))) {
$xing_script = true;
}
if ($this->options['mr_social_sharing_follow_buttons']['xi_xing']['enable'] == 1 && in_array($this->options['mr_social_sharing_follow_buttons']['xi_xing']['type'], array('none','horizontal'))) {
$xing_script = true;
}
if (is_active_sidebar(is_active_widget( false, false, 'mr-social-sharing-toolkit-follow-widget', true))) {
if ($this->options['mr_social_sharing_follow_buttons']['follow_twitter']['enable'] == 1 && in_array($this->options['mr_social_sharing_follow_buttons']['follow_twitter']['type'], array('none','horizontal'))) {
$tweet_script = true;
}
}
if ($digg_script) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('Digg', plugins_url('/digg.js', __FILE__), array(), false, true);
} else {
wp_enqueue_script('Digg', plugins_url('/digg.js', __FILE__));
}
}
if ($grow_script) {
wp_enqueue_script('Grow', 'http://growbutton.com/javascripts/button.js?apikey='.$this->options['mr_social_sharing_widget_buttons']['gr_grow']['id'].'&insert=false', array(), false, true);
}
if ($linked_script) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('LinkedIn', 'http://platform.linkedin.com/in.js', array(), false, true);
} else {
wp_enqueue_script('LinkedIn', 'http://platform.linkedin.com/in.js');
}
}
if ($google_script) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('GooglePlusLang', plugins_url('/googleplus.js.php?lang='.$lang, __FILE__), array(), false, true);
wp_enqueue_script('GooglePlus', 'http://apis.google.com/js/plusone.js', array(), false, true);
} else {
wp_enqueue_script('GooglePlusLang', plugins_url('/googleplus.js.php?lang='.$lang, __FILE__));
wp_enqueue_script('GooglePlus', 'http://apis.google.com/js/plusone.js');
}
}
if ($tweet_script) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('Twitter', 'http://platform.twitter.com/widgets.js', array(), false, true);
} else {
wp_enqueue_script('Twitter', 'http://platform.twitter.com/widgets.js');
}
}
if ($buffer_script) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('Buffer', 'http://static.bufferapp.com/js/button.js', array(), false, true);
} else {
wp_enqueue_script('Buffer', 'http://static.bufferapp.com/js/button.js');
}
}
if ($stumble_script) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('StumbleUpon', plugins_url('/stumbleupon.js', __FILE__), array(), false, true);
} else {
wp_enqueue_script('StumbleUpon', plugins_url('/stumbleupon.js', __FILE__));
}
}
if ($delicious_script) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('Delicious', plugins_url('/delicious.js', __FILE__), array(), false, true);
} else {
wp_enqueue_script('Delicious', plugins_url('/delicious.js', __FILE__));
}
}
if ($pinit_script) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('Pinterest', 'http://assets.pinterest.com/js/pinit.js', array(), false, true);
} else {
wp_enqueue_script('Pinterest', 'http://assets.pinterest.com/js/pinit.js');
}
}
if ($xing_script) {
if ($this->options['mr_social_sharing_js_footer'] == 1) {
wp_enqueue_script('Xing', 'https://www.xing-share.com/js/external/share.js', array(), false, true);
} else {
wp_enqueue_script('Xing', 'https://www.xing-share.com/js/external/share.js');
}
}
}
function create_bookmarks($url = '', $title = '', $type = '', $media = '') {
$url = trim($url);
$title = trim($title);
$title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
if ($url == '') {
$url = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
$bookmarks = '
<div class="mr_social_sharing_wrapper">
<!-- Social Sharing Toolkit v2.0.8 | http://www.active-bits.nl/support/social-sharing-toolkit/ -->';
foreach ($this->options['mr_social_sharing_'.$type.'button_order'] as $button) {
if ($this->options['mr_social_sharing_'.$type.'buttons'][$button]['enable'] == 1) {
$id = array_key_exists('id', $this->options['mr_social_sharing_'.$type.'buttons'][$button]) ? $this->options['mr_social_sharing_'.$type.'buttons'][$button]['id'] : '';
$bookmarks .= $this->get_bookmark_button($button, $url, $title, $this->options['mr_social_sharing_'.$type.'buttons'][$button]['type'], $this->options['mr_social_sharing_'.$type.'display'], $this->options['mr_social_sharing_'.$type.'align'], $id, $media);
}
}
$bookmarks .= '</div>';
$bookmarks = str_replace('<div class="mr_social_sharing_wrapper"></div>', '', $bookmarks);
$this->count++;
return $bookmarks;
}
function create_followers() {
$followers = '
<div class="mr_social_sharing_wrapper">
<!-- Social Sharing Toolkit v2.0.8 | http://www.active-bits.nl/support/social-sharing-toolkit/ -->';
foreach ($this->options['mr_social_sharing_follow_button_order'] as $button) {
if ($this->options['mr_social_sharing_follow_buttons'][$button]['enable'] == 1) {
$id = array_key_exists('id', $this->options['mr_social_sharing_follow_buttons'][$button]) ? $this->options['mr_social_sharing_follow_buttons'][$button]['id'] : '';
$followers .= $this->get_follow_button($button, $this->options['mr_social_sharing_follow_buttons'][$button]['type'], $this->options['mr_social_sharing_follow_display'], $this->options['mr_social_sharing_follow_align'], $id);
}
}
$followers .= '</div>';
$followers = str_replace('<div class="mr_social_sharing_wrapper"></div>', '', $followers);
return $followers;
}
function get_bookmark_button($button, $url, $title, $type, $display = 'span', $align = '', $id = '', $media = '') {
if ($button == 'ln_break_1' || $button == 'ln_break_2' || $button == 'ln_break_3') {
$retval = '</div><div class="mr_social_sharing_wrapper">';
} else {
if ($button == 'pn_pinterest') {
if ($media == '') {
return '';
} else {
$id = $media;
}
}
$button = 'get_'.$button;
$retval = '<'.$display.' class="mr_social_sharing'.$align.'">'.$this->$button($url, $title, $type, $id).'</'.$display.'>';
}
return $retval;
}
function get_follow_button($button, $type, $display = 'span', $align = '', $id = '') {
if ($button == 'ln_break_1' || $button == 'ln_break_2' || $button == 'ln_break_3') {
$retval = '</div><div class="mr_social_sharing_wrapper">';
} else {
$button = 'get_'.$button;
$retval = '<'.$display.' class="mr_social_sharing'.$align.'">'.$this->$button($type, $id).'</'.$display.'>';
}
return $retval;
}
function get_fb_like($url, $title, $type, $id) {
$retval = '<iframe src="https://www.facebook.com/plugins/like.php?locale='.__('en_US','mr_social_sharing_toolkit').'&href='.urlencode($url).'&layout=';
switch ($type) {
case 'horizontal':
$retval .= 'button_count';
if ($id == 'recommend') {
$width = __('fb_horizontal_recommend_width','mr_social_sharing_toolkit');
$width = ($width == 'fb_horizontal_recommend_width') ? '120' : $width;
} else {
$width = __('fb_horizontal_width','mr_social_sharing_toolkit');
$width = ($width == 'fb_horizontal_width') ? '90' : $width;
}
$height = '21';
break;
case 'vertical':
$retval .= 'box_count';
if ($id == 'recommend') {
$width = __('fb_vertical_recommend_width','mr_social_sharing_toolkit');
$width = ($width == 'fb_vertical_recommend_width') ? '92' : $width;
} else {
$width = __('fb_vertical_width','mr_social_sharing_toolkit');
$width = ($width == 'fb_vertical_width') ? '55' : $width;
}
$height = '62';
break;
case 'none_text':
$retval .= 'standard';
if ($id == 'recommend') {
$width = 'auto';
} else {
$width = 'auto';
}
$height = '25';
break;
default:
$retval .= 'standard';
if ($id == 'recommend') {
$width = __('fb_standard_recommend_width','mr_social_sharing_toolkit');
$width = ($width == 'fb_standard_standard_recommend_width') ? '91' : $width;
} else {
$width = __('fb_standard_width','mr_social_sharing_toolkit');
$width = ($width == 'fb_standard_width') ? '51' : $width;
}
$height = '24';
break;
}
$retval .= '&show_faces=false&width='.$width.'&height='.$height.'" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:'.$width.'px; height:'.$height.'px;" allowTransparency="true"></iframe>';
return $retval;
}
function get_fb_share($url, $title, $type, $id) {
switch ($type) {
case 'vertical':
$retval = '<a name="fb_share" type="box_count" share_url="'.$url.'" href="http://www.facebook.com/sharer.php">Share</a>';
break;
case 'horizontal':
$retval = '<a name="fb_share" type="button_count" share_url="'.$url.'" href="http://www.facebook.com/sharer.php">Share</a>';
break;
case 'none':
$retval = '<a name="fb_share" type="button" share_url="'.$url.'" href="http://www.facebook.com/sharer.php">Share</a>';
break;
default:
$url = 'https://www.facebook.com/sharer/sharer.php?u='.urlencode($url).'&t='.urlencode($title);
$title = __('Share on','mr_social_sharing_toolkit').' Facebook';
$text = __('Share on','mr_social_sharing_toolkit').' Facebook';
$icon = 'facebook';
$retval = $this->get_icon($type, $url, $title, $text, $icon, true);
break;
}
return $retval;
}
function get_fb_send($url, $title, $type, $id) {
$retval = '<div id="fb-root"></div><fb:send href="'.$url.'" font=""></fb:send>';
return $retval;
}
function get_tw_tweet($url, $title, $type, $id) {
$count_url = '';
if ($this->options['mr_social_sharing_bitly']['enable'] == 1 && $this->options['mr_social_sharing_bitly']['username'] != '' && $this->options['mr_social_sharing_bitly']['key'] != '') {
if (is_array($this->options['mr_social_sharing_bitly']['cache']) && array_key_exists($url, $this->options['mr_social_sharing_bitly']['cache'])) {
$count_url = $url;
$url = $this->options['mr_social_sharing_bitly']['cache'][$url];
} else {
$ch = curl_init('https://api-ssl.bitly.com/v3/shorten?login='.$this->options['mr_social_sharing_bitly']['username'].'&apiKey='.$this->options['mr_social_sharing_bitly']['key'].'&longUrl='.urlencode($url).'&format=txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($short_url = curl_exec($ch)) {
$count_url = $url;
$url = trim($short_url);
$this->options['mr_social_sharing_bitly']['cache'][$count_url] = $url;
update_option( 'mr_social_sharing_bitly', $this->options['mr_social_sharing_bitly']);
}
}
}
switch ($type) {
case 'horizontal':
$retval = '<a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-url="'.$url.'"';
if ($id != '') {
$retval .= ' data-via="'.$id.'"';
}
if ($count_url != '') {
$retval .= ' data-counturl="'.$count_url.'"';
}
$retval .= ' data-text="'.$title.'">Tweet</a>';
break;
case 'vertical':
$retval = '<a href="https://twitter.com/share" class="twitter-share-button" data-count="vertical" data-url="'.$url.'"';
if ($id != '') {
$retval .= ' data-via="'.$id.'"';
}
if ($count_url != '') {
$retval .= ' data-counturl="'.$count_url.'"';
}
$retval .= ' data-text="'.$title.'">Tweet</a>';
break;
default:
$url = 'https://twitter.com/share?url='.urlencode($url).'&text='.urlencode($title);
if ($id != '') {
$url .= '&via='.$id;
}
if ($count_url != '') {
$url .= '&counturl='.urlencode($count_url);
}
$title = __('Share on','mr_social_sharing_toolkit').' Twitter';
$text = __('Share on','mr_social_sharing_toolkit').' Twitter';
$icon = 'twitter';
$retval = $this->get_icon($type, $url, $title, $text, $icon, true);
break;
}
return $retval;
}
function get_bf_buffer($url, $title, $type, $id) {
switch ($type) {
case 'horizontal':
$retval = '<a href="http://bufferapp.com/add" class="buffer-add-button" data-url="'.$url.'" data-count="horizontal"';
if ($id != '') {
$retval .= ' data-via="'.$id.'"';
}
$retval .= ' data-text="'.$title.'">Buffer</a>';
break;
case 'vertical':
$retval = '<a href="http://bufferapp.com/add" class="buffer-add-button" data-url="'.$url.'" data-count="vertical"';
if ($id != '') {
$retval .= ' data-via="'.$id.'"';
}
$retval .= ' data-text="'.$title.'">Buffer</a>';
break;
case 'none':
$retval = '<a href="http://bufferapp.com/add" class="buffer-add-button" data-url="'.$url.'" data-count="none"';
if ($id != '') {
$retval .= ' data-via="'.$id.'"';
}
$retval .= ' data-text="'.$title.'">Buffer</a>';
break;
default:
$url = 'http://bufferapp.com/add?url='.urlencode($url).'&text='.urlencode($title);
if ($id != '') {
$url .= '&via='.urlencode($id);
}
$title = __('Add to','mr_social_sharing_toolkit').' Buffer';
$text = __('Add to','mr_social_sharing_toolkit').' Buffer';
$icon = 'buffer';
$retval = $this->get_icon($type, $url, $title, $text, $icon, true);
break;
}
return $retval;
}
function get_pn_pinterest($url, $title, $type, $media) {
$pin_url = 'http://pinterest.com/pin/create/button/?url='.urlencode($url).'&media='.urlencode($media).'&description='.urlencode($title);
switch ($type) {