forked from rtCamp/rtsocial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
source.php
1371 lines (1237 loc) · 84.9 KB
/
source.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: rtSocial
Plugin URI: https://rtcamp.com/rtsocial/
Author: rtCamp
Author URI: https://rtcamp.com/
Version: 2.1.19
Description: It is the lightest social sharing plugin, uses non-blocking Javascript and a single sprite to get rid of all the clutter that comes along with the sharing buttons.
Tags: rtcamp, social, sharing, share, social links, twitter, facebook, pin it, pinterest, linkedin, linked in, linked in share, google plus, google plus share, gplus share, g+ button, g+ share, plus one button, social share, social sharing
*/
/*
* Initial Actions
*/
add_action( 'admin_menu', 'rtsocial_admin' );
add_action( 'admin_notices', 'rts_gplus_notice' );
add_action( 'wp_ajax_rts_hide_g_plus_notice', 'rts_hide_g_plus_notice' );
register_activation_hook( __FILE__, 'rtsocial_set_defaults' );
register_deactivation_hook( __FILE__, 'rtsocial_reset_defaults' );
/*
* Settings Page
*/
function rtsocial_admin() {
//Add settings page
$hook = add_options_page( 'rtSocial Options Page', 'rtSocial Options', 'manage_options', 'rtsocial-options', 'rtsocial_admin_fn' );
//Enqueue CSS and JS for the options page
add_action( 'admin_print_scripts-' . $hook, 'rtsocial_assets' );
}
/*
* Admin notice for Goggle API key
*/
function rts_gplus_notice() {
if ( !current_user_can( 'manage_options' ) || ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'rtsocial-options' ) ) {
return;
}
if ( is_multisite() ) {
$site_option = get_option( "rts_g_plus_notice" );
} else {
$site_option = get_site_option( "rts_g_plus_notice" );
}
if ( ( !$site_option || $site_option != "hide" ) ) {
if ( is_multisite() ) {
update_option( "rts_g_plus_notice", "show" );
} else {
update_site_option( "rts_g_plus_notice", "show" );
}
?>
<div class="error rts_g_plus_notice">
<p>
<b>rtSocial:</b> You need to add Google API key under <a href="<?php echo admin_url( 'options-general.php?page=rtsocial-options' ); ?>">rtSocial admin settings</a> to display google+ count.
<a href="#" onclick="rts_g_plus_override_notice();" style="float:right">Dismiss</a>
</p>
</div>
<script type="text/javascript">
function rts_g_plus_override_notice() {
var data = {action: 'rts_hide_g_plus_notice'};
jQuery.post(ajaxurl, data, function ( response ) {
response = response.trim();
if (response === "1")
jQuery('.rts_g_plus_notice').remove();
} );
}
</script>
<?php
}
}
/*
* Hide Admin notice for Goggle API key
*/
function rts_hide_g_plus_notice() {
if ( is_multisite() ) {
$update_site_option = update_option( "rts_g_plus_notice", "hide" );
} else {
$update_site_option = update_site_option( "rts_g_plus_notice", "hide" );
}
if ( $update_site_option ) {
echo "1";
} else {
echo "0";
}
die();
}
function rtsocial_admin_fn() {
?>
<div class="wrap">
<h2><?php _e( 'rtSocial Options' ); ?></h2>
<p class="rt_clear"></p>
<div id="content_block" class="align_left">
<form action="options.php" method="post">
<?php
settings_fields( 'rtsocial_plugin_options' );
do_settings_sections( __FILE__ );
$options = get_option( 'rtsocial_plugin_options' );
$labels = array( 'tw' => 'Twitter', 'fb' => 'Facebook', 'lin' => 'LinkedIn', 'pin' => 'Pinterest', 'gplus' => 'Google+' );
?>
<div class="metabox-holder align_left rtsocial" id="rtsocial">
<div class="postbox-container">
<div class="meta-box-sortables ui-sortable">
<div class="postbox">
<div title="Click to toggle" class="handlediv"><br/></div>
<h3 class="hndle">rtSocial Settings</h3>
<div class="inside">
<table class="form-table">
<tr id="rtsocial-placement-settings-row">
<th scope="row">Placement Settings:</th>
<td>
<fieldset>
<label>
<input value="top" name='rtsocial_plugin_options[placement_options_set]' id="rtsocial-top-display" type="radio" <?php echo ( $options[ 'placement_options_set' ] == 'top' ) ? ' checked="checked" ' : ''; ?> style="margin: 7px 0 0 0;" />
<span>Top</span>
<br/>
<span class="description">Social-media sharing buttons will appear below post-title and above post-content</span>
</label>
<br/>
<label>
<input value="bottom" name='rtsocial_plugin_options[placement_options_set]' id="rtsocial-bottom-display" type="radio" <?php echo ( $options[ 'placement_options_set' ] == 'bottom' ) ? ' checked="checked" ' : ''; ?> style="margin: 7px 0 0 0;" />
<span>Bottom</span>
<br/>
<span class="description">Social-media sharing buttons will appear after (below) post-content</span>
</label>
<br/>
<label>
<input value="manual" name='rtsocial_plugin_options[placement_options_set]' id="rtsocial-manual-display" type="radio" <?php echo ( $options[ 'placement_options_set' ] == 'manual' ) ? ' checked="checked" ' : ''; ?> style="margin: 7px 0 0 0;" />
<span>Manual</span>
<br/>
<span class="description">For manual placement, please use this function call in your template: <br/><strong><?php if ( function_exists( 'rtsocial' ) ) { echo rtsocial(); } ?></strong></span>
</label>
</fieldset>
</td>
</tr>
<tr>
<th scope="row">Button Style:</th>
<td>
<table id="rtsocial-button-style-inner">
<tr>
<td>
<input value="vertical" id="display_vertical_input" name='rtsocial_plugin_options[display_options_set]' type="radio" <?php echo ( $options[ 'display_options_set' ] == "vertical" ) ? ' checked="checked" ' : ''; ?> />
</td>
<td>
<div id="rtsocial-display-vertical-sample" class="rtsocial-vertical rtsocial-container-align-none">
<div class="rtsocial-twitter-vertical">
<div class="rtsocial-vertical-count">
<span class="rtsocial-twitter-count"></span>
<div class="rtsocial-vertical-notch"></div>
</div>
<div class="rtsocial-twitter-vertical-button">
<a class="rtsocial-twitter-button" href='https://twitter.com/share?via=<?php echo $options[ 'tw_handle' ] . "&related=" . $options[ 'tw_related_handle' ] . "&text=" . esc_attr( "rtSocial... Share Fast!" ) . "&url=https://rtpanel.com/support/forum/plugin/"; ?>' rel="nofollow" target="_blank"></a>
</div>
</div>
<div class="rtsocial-fb-vertical">
<div class="rtsocial-vertical-count">
<span class="rtsocial-fb-count"></span>
<div class="rtsocial-vertical-notch"></div>
</div>
<div class="rtsocial-fb-vertical-button">
<a class="rtsocial-fb-button rtsocial-fb-like-light" href="https://www.facebook.com/sharer.php?u=https://rtpanel.com/support/forum/plugin/" rel="nofollow" target="_blank">Like</a>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<input value="horizontal" id="display_horizontal_input" name='rtsocial_plugin_options[display_options_set]' type="radio" <?php echo ( $options[ 'display_options_set' ] == "horizontal" ) ? ' checked="checked" ' : ''; ?> />
</td>
<td>
<div id="rtsocial-display-horizontal-sample">
<div class="rtsocial-fb-horizontal">
<div class="rtsocial-fb-horizontal-button">
<a class="rtsocial-fb-button rtsocial-fb-like-light" href="https://www.facebook.com/sharer.php?u=https://rtpanel.com/support/forum/plugin/" rel="nofollow" target="_blank">Like</a>
</div>
<div class="rtsocial-horizontal-count">
<div class="rtsocial-horizontal-notch"></div>
<span class="rtsocial-fb-count"></span>
</div>
</div>
<div class="rtsocial-twitter-horizontal">
<div class="rtsocial-twitter-horizontal-button">
<a class="rtsocial-twitter-button" href="https://twitter.com/share?via=<?php echo $options[ 'tw_handle' ] . "&related=" . $options[ 'tw_related_handle' ] . "&text=" . esc_attr( "rtSocial... Share Fast!" ) . "&url=https://rtpanel.com/support/forum/plugin/"; ?>" rel="nofollow" target="_blank"></a>
</div>
<div class="rtsocial-horizontal-count">
<div class="rtsocial-horizontal-notch"></div>
<span class="rtsocial-twitter-count"></span>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<input value="icon" id="display_icon_input" name='rtsocial_plugin_options[display_options_set]' type="radio" <?php echo ( $options[ 'display_options_set' ] == "icon" ) ? ' checked="checked" ' : ''; ?> />
</td>
<td>
<div id="rtsocial-display-icon-sample">
<div class="rtsocial-fb-icon">
<div class="rtsocial-fb-icon-button">
<a class="rtsocial-fb-icon-link" href="https://www.facebook.com/sharer.php?u=https://rtpanel.com/support/forum/plugin/" rel="nofollow" target="_blank">Like</a>
</div>
</div>
<div class="rtsocial-twitter-icon">
<div class="rtsocial-twitter-icon-button"><a class="rtsocial-twitter-icon-link" href="https://twitter.com/share?via=<?php echo $options[ 'tw_handle' ] . "&related=" . $options[ 'tw_related_handle' ] . "&text=" . esc_attr( "rtSocial... Share Fast!" ) . "&url=https://rtpanel.com/support/forum/plugin/"; ?>" rel="nofollow" target="_blank">Tweet</a>
</div>
</div>
</div>
</td>
</tr>
<!--Icons with count-->
<tr>
<td>
<input value="icon-count" id="display_icon_count_input" name='rtsocial_plugin_options[display_options_set]' type="radio" <?php echo ( $options[ 'display_options_set' ] == "icon-count" ) ? ' checked="checked" ' : ''; ?> />
</td>
<td>
<div id="rtsocial-display-icon-count-sample">
<div class="rtsocial-fb-icon">
<div class="rtsocial-fb-icon-button">
<a class="rtsocial-fb-icon-link" href="https://www.facebook.com/sharer.php?u=https://rtpanel.com/support/forum/plugin/" rel="nofollow" target="_blank">Like</a>
</div>
<div class="rtsocial-horizontal-count">
<div class="rtsocial-horizontal-notch"></div>
<span class="rtsocial-fb-count"></span>
</div>
</div>
<div class="rtsocial-twitter-icon">
<div class="rtsocial-twitter-icon-button"><a class="rtsocial-twitter-icon-link" href="https://twitter.com/share?via=<?php echo $options[ 'tw_handle' ] . "&related=" . $options[ 'tw_related_handle' ] . "&text=" . esc_attr( "rtSocial... Share Fast!" ) . "&url=https://rtpanel.com/support/forum/plugin/"; ?>" rel="nofollow" target="_blank">Tweet</a>
</div>
<div class="rtsocial-horizontal-count">
<div class="rtsocial-horizontal-notch"></div>
<span class="rtsocial-twitter-count"></span>
</div>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<th scope="row">Alignment Settings:</th>
<td>
<fieldset>
<label>
<input value="left" name='rtsocial_plugin_options[alignment_options_set]' id="align_left_check" type="radio" <?php echo ( $options[ 'alignment_options_set' ] == 'left' ) ? ' checked="checked" ' : ''; ?> />
<span>Left</span>
</label>
<br/>
<label>
<input value="center" name='rtsocial_plugin_options[alignment_options_set]' id="align_center_check" type="radio" <?php echo ( $options[ 'alignment_options_set' ] == 'center' ) ? ' checked="checked" ' : ''; ?> />
<span>Center</span>
</label>
<br/>
<label>
<input value="right" name='rtsocial_plugin_options[alignment_options_set]' id="align_right_check" type="radio" <?php echo ( $options[ 'alignment_options_set' ] == 'right' ) ? ' checked="checked" ' : ''; ?> />
<span>Right</span>
</label>
<br/>
<label>
<input value="none" name='rtsocial_plugin_options[alignment_options_set]' id="align_none_check" type="radio" <?php echo ( $options[ 'alignment_options_set' ] == 'none' ) ? ' checked="checked" ' : ''; ?> />
<span>None</span>
</label>
</fieldset>
</td>
</tr>
<tr>
<th>Your google API key:</th>
<td>
<input type="text" value="<?php if ( isset( $options[ 'google_api_key' ] ) && !empty( $options[ 'google_api_key' ] ) ) { echo $options[ 'google_api_key' ]; } ?>" id="google_api_key" name="rtsocial_plugin_options[google_api_key]" />
<a href="https://developers.google.com/+/api/oauth" target="blank">How to create API key?</a>
</td>
</tr>
<tr>
<th scope="row">Active Buttons <sup>#</sup>:</th>
<td>
<ul id="rtsocial-sorter-active" class="connectedSortable">
<?php
if ( isset( $options[ 'active' ] ) && !empty( $options[ 'active' ] ) ) {
foreach ( $options[ 'active' ] as $active ) {
echo '<li id="rtsocial-ord-' . $active . '" style="cursor: pointer;"><input id="rtsocial-act-' . $active . '" style="display: none;" type="checkbox" name="rtsocial_plugin_options[active][]" value="' . $active . '" checked="checked" /><label for="rtsocial-act-' . $active . '">' . $labels[ $active ] . '</label></li>';
}
}
?>
</ul>
</td>
</tr>
<tr>
<td colspan="2"><span class="description"># Drag buttons around to reorder them OR drop them into 'Inactive' list to disable them. <strong>All buttons cannot be disabled!</strong></span></td>
</tr>
<tr>
<th scope="row">Inactive Buttons <sup>*</sup>:</th>
<td>
<ul id="rtsocial-sorter-inactive" class="connectedSortable">
<?php
if ( isset( $options[ 'inactive' ] ) && !empty( $options[ 'inactive' ] ) ) {
foreach ( $options[ 'inactive' ] as $inactive ) {
echo '<li id="rtsocial-ord-' . $inactive . '" style="cursor: pointer;"><input id="rtsocial-act-' . $inactive . '" style="display: none;" type="checkbox" name="rtsocial_plugin_options[inactive][]" value="' . $inactive . '" checked="checked" /><label for="rtsocial-act-' . $inactive . '">' . $labels[ $inactive ] . '</label></li>';
}
}
?>
</ul>
</td>
</tr>
<tr>
<td colspan="2">
<span class="description">* Drop buttons back to 'Active' list to re-enable them.</span>
</td>
</tr>
<tr>
<th scope="row">Hide counts:</th>
<td>
<fieldset>
<label>
<input value="1" name='rtsocial_plugin_options[hide_count]' id="hide_count_check" type="checkbox" <?php echo ( isset( $options[ 'hide_count' ] ) && ( $options[ 'hide_count' ] == 1 ) ) ? ' checked="checked" ' : ''; ?> />
<span>Yes</span>
</label>
</fieldset>
</td>
</tr>
</table>
</div>
</div>
<!--Twitter-->
<div class="postbox" id="tw_box">
<div title="Click to toggle" class="handlediv"><br/></div>
<h3 class="hndle">Twitter Button Settings</h3>
<div class="inside">
<table class="form-table">
<tr>
<th>
<span id="rtsocial-twitter"></span>
</th>
</tr>
<tr class="tw_row">
<th>Twitter Handle:</th>
<td>
<input type="text" value="<?php echo $options[ 'tw_handle' ] ?>" id="tw_handle" name="rtsocial_plugin_options[tw_handle]" />
</td>
<td> </td>
</tr>
<tr class="tw_row">
<th>Related Twitter Handle:</th>
<td>
<input type="text" value="<?php echo $options[ 'tw_related_handle' ] ?>" id="tw_related_handle" name="rtsocial_plugin_options[tw_related_handle]" />
</td>
<td> </td>
</tr>
</table>
</div>
</div>
<!--Facebook-->
<div class="postbox">
<div title="Click to toggle" class="handlediv"><br/></div>
<h3 class="hndle"> Facebook Button Settings </h3>
<div class="inside">
<table class="form-table">
<tr class="fb_title">
<th>
<span id="rtsocial-facebook"></span>
</th>
</tr>
<tr class="fb_row">
<th>Facebook Button Style:</th>
<td>
<input type="radio" name='rtsocial_plugin_options[fb_style]' value="like_light" id="rtsocial-like-light-input" <?php echo ( $options[ 'fb_style' ] == "like_light" ) ? ' checked="checked" ' : '' ?> />
<label for="rtsocial-like-light-input">
<a id="rtsocial-like-light"></a>
</label>
</td>
<td>
<input type="radio" name='rtsocial_plugin_options[fb_style]' value="recommend_light" id="rtsocial-recommend-light-input" <?php echo ( $options[ 'fb_style' ] == "recommend_light" ) ? ' checked="checked" ' : '' ?> />
<label for="rtsocial-recommend-light-input">
<a id="rtsocial-recommend-light"></a>
</label>
</td>
</tr>
<tr class="fb_row">
<th> </th>
<td>
<input type="radio" name='rtsocial_plugin_options[fb_style]' value="like_dark" id="rtsocial-like-dark-input" <?php echo ( $options[ 'fb_style' ] == "like_dark" ) ? ' checked="checked" ' : '' ?> />
<label for="rtsocial-like-dark-input">
<a id="rtsocial-like-dark"></a>
</label>
</td>
<td>
<input type="radio" name='rtsocial_plugin_options[fb_style]' value="recommend_dark" id="rtsocial-recommend-dark-input" <?php echo ( $options[ 'fb_style' ] == "recommend_dark" ) ? ' checked="checked" ' : '' ?> />
<label for="rtsocial-recommend-dark-input">
<a id="rtsocial-recommend-dark"></a>
</label>
</td>
</tr>
<tr class="fb_row">
<th> </th>
<td>
<input type="radio" name='rtsocial_plugin_options[fb_style]' value="share" id="rtsocial-share-input" <?php echo ( $options[ 'fb_style' ] == "share" ) ? ' checked="checked" ' : '' ?> />
<label for="rtsocial-share-input">
<a id="rtsocial-share-plain"></a>
</label>
</td>
<td> </td>
</tr>
</table>
</div>
</div>
<p class="submit">
<input type="submit" name="save" class="button-primary" value="<?php esc_attr_e( 'Save Changes' ); ?>" />
</p>
</div>
</div>
</div>
</form>
</div>
<div id="rtsocial_ads_block" class="metabox-holder align_left">
<div class="postbox-container">
<div class="meta-box-sortables ui-sortable">
<div class="postbox" id="social">
<div title="Click to toggle" class="handlediv"><br/></div>
<h3 class="hndle">
<span>
<strong>Getting Social is Good</strong>
</span>
</h3>
<div class="inside rt-social-connect">
<a href="https://www.facebook.com/rtCamp.solutions" rel="nofollow" target="_blank" title="Become a fan on Facebook" class="rt-sidebar-facebook">Facebook</a>
<a href="https://twitter.com/rtcamp" rel="nofollow" target="_blank" title="Follow us on Twitter" class="rt-sidebar-twitter">Twitter</a>
<a href="https://feeds.feedburner.com/rtcamp" rel="nofollow" target="_blank" title="Subscribe to our Feeds" class="rt-sidebar-rss">RSS</a>
</div>
</div>
<div class="postbox" id="donations">
<div title="Click to toggle" class="handlediv"><br/></div>
<h3 class="hndle">
<span>
<strong>Promote, Donate, Share...</strong>
</span>
</h3>
<div class="inside">
Buy coffee/beer for team behind <a href="https://rtcamp.com/rtsocial/" title="rtSocial Plugin">rtSocial</a>.
<br/><br/>
<div class="rt-paypal" style="text-align:center">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations" />
<input type="hidden" name="business" value="[email protected]" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="item_name" value="rtSocial" />
<input type="hidden" name="no_note" value="0" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" />
<img border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" alt="pixel" />
</form>
</div>
<div class="rtsocial-share" style="text-align:center; width: 127px; margin: 2px auto">
<div class="rt-facebook" style="float:left; margin-right:5px;">
<a style=" text-align:center;" name="fb_share" type="box_count" title="rtSocial: Simple, Smarter & Swifter Social Sharing WordPress Plugin" share_url="https://rtcamp.com/rtsocial/"></a>
</div>
<div class="rt-twitter" style="">
<a href="https://twitter.com/share" title="rtSocial: Simple, Smarter & Swifter Social Sharing WordPress Plugin" class="twitter-share-button" data-text="rtSocial: Simple, Smarter & Swifter Social Sharing #WordPress #Plugin" data-url="https://rtcamp.com/rtsocial/" data-count="vertical" data-via="rtCamp">Tweet</a>
<script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
</div>
<div class="rt_clear"></div>
</div>
</div>
<!-- end of .inside -->
</div>
<div class="postbox" id="support">
<div title="Click to toggle" class="handlediv"><br/></div>
<h3 class="hndle">
<span>
<strong>Free Support</strong>
</span>
</h3>
<div class="inside">If you have any problems with this plugin or good ideas for improvements, please talk about them in the <a href="https://rtcamp.com/support/forum/rtsocial/" rel="nofollow" target="_blank" title="free support forums">free support forums</a>.</div>
</div>
<div class="postbox" id="latest_news">
<div title="Click to toggle" class="handlediv"><br/></div>
<h3 class="hndle">
<span>
<strong>Latest News</strong>
</span>
</h3>
<div class="inside"><?php rtsocial_get_feeds(); ?></div>
</div>
</div>
</div>
</div>
</div>
<?php
}
/*
* Add the options variable
*/
add_action( 'admin_init', 'rtsocial_options_init_fn' );
function rtsocial_options_init_fn() {
register_setting( 'rtsocial_plugin_options', 'rtsocial_plugin_options', 'rtsocial_check' );
}
/*
* Settings sanitisation
*/
function rtsocial_check( $args ) {
//Just in case the JavaScript for avoiding deactivation of all services fails, this will fix it! ;)
if ( !isset( $args[ 'active' ] ) || empty( $args[ 'active' ] ) ) {
add_settings_error( 'rtsocial_plugin_options', 'all_inactive', 'All options inactive! Resetting all as active.', $type = 'error' );
$args[ 'active' ] = array( 'tw', 'fb', 'lin', 'pin', 'gplus' );
$args[ 'inactive' ] = array();
}
if ( isset( $args[ 'active' ] ) && in_array( 'gplus', $args[ 'active' ] ) && $args[ 'google_api_key' ] == '' ) {
if ( is_multisite() ) {
update_option( "rts_g_plus_notice", "show" );
} else {
update_site_option( "rts_g_plus_notice", "show" );
}
} else {
if ( is_multisite() ) {
update_option( "rts_g_plus_notice", "hide" );
} else {
update_site_option( "rts_g_plus_notice", "hide" );
}
}
// put g-plus in inactive state if google api key is not provided
if ( !isset( $args[ 'google_api_key' ] ) || empty( $args[ 'google_api_key' ] ) ) {
// google api key is not set and if gplus is in active state put it in inactive state
if ( ( $key = array_search( 'gplus', $args[ 'active' ] ) ) !== false ) {
unset( $args[ 'active' ][ $key ] );
if ( !isset( $args[ 'inactive' ] ) ) {
$args[ 'inactive' ] = array();
}
$args[ 'inactive' ][] = 'gplus';
}
if ( is_multisite() ) {
update_option( "rts_g_plus_notice", "show" );
} else {
update_site_option( "rts_g_plus_notice", "show" );
}
}
return $args;
}
/*
* Print the sanitisation errors
*/
function rtsocial_get_errors() {
$errors = get_settings_errors();
echo $errors;
}
/*
* Inject the widget in the posts
*/
add_filter( 'the_content', 'rtsocial_counter' );
add_filter( 'the_excerpt', 'rtsocial_counter' );
function rtsocial_dyna( $content ) {
if ( is_single() ) {
return rtsocial_counter( $content );
} else {
return $content;
}
}
function rtsocial_counter( $content = '' ) {
//Working issue on attachment page
if ( is_attachment() ) {
return;
}
$options = get_option( 'rtsocial_plugin_options' );
global $post;
$rtslink = urlencode( apply_filters( "rtsocial_permalink", get_permalink( $post->ID ), $post->ID, $post ) );
$rtstitle = rt_url_encode( get_the_title( $post->ID ) );
$rtatitle = get_the_title( $post->ID );
//Ordered buttons array
$active_services = array();
//Twitter
if ( isset( $options ) && !empty( $options ) && isset( $options[ 'active' ] ) && !empty( $options[ 'active' ] ) && in_array( 'tw', $options[ 'active' ] ) ) {
$tw = array_search( 'tw', $options[ 'active' ] );
$tw_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-' . $options[ 'display_options_set' ] . '-count"><div class="rtsocial-' . $options[ 'display_options_set' ] . '-notch"></div><span class="rtsocial-twitter-count"></span></div>' : '';
$handle_string = '';
$handle_string .= ( isset( $options[ 'tw_handle' ] ) && $options[ 'tw_handle' ] != '' ) ? '&via=' . $options[ 'tw_handle' ] : '';
$handle_string .= ( isset( $options[ 'tw_related_handle' ] ) && $options[ 'tw_related_handle' ] != '' ) ? '&related=' . $options[ 'tw_related_handle' ] : '';
$tw_layout = '<div class="rtsocial-twitter-' . $options[ 'display_options_set' ] . '">';
if ( $options[ 'display_options_set' ] == 'horizontal' ) {
$tw_layout .= '<div class="rtsocial-twitter-' . $options[ 'display_options_set' ] . '-button"><a title= "Tweet: ' . $rtatitle . '" class="rtsocial-twitter-button" href= "https://twitter.com/share?text=' . $rtstitle . $handle_string . '&url=' . $rtslink . '" rel="nofollow" target="_blank"></a></div>' . $tw_count;
} else {
if ( $options[ 'display_options_set' ] == 'vertical' ) {
$tw_layout .= $tw_count . '<div class="rtsocial-twitter-' . $options[ 'display_options_set' ] . '-button"><a title="Tweet: ' . $rtatitle . '" class="rtsocial-twitter-button" href= "https://twitter.com/share?text=' . $rtstitle . $handle_string . '&url=' . $rtslink . '" target= "_blank"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon' ) {
$tw_layout .= ' <div class="rtsocial-twitter-' . $options[ 'display_options_set' ] . '-button"><a title="Tweet: ' . $rtatitle . '" class="rtsocial-twitter-icon-link" href= "https://twitter.com/share?text=' . $rtstitle . $handle_string . '&url=' . $rtslink . '" target= "_blank"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon-count' ) {
$tw_layout = '<div class="rtsocial-twitter-icon">';
$tw_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-horizontal-count"><div class="rtsocial-horizontal-notch"></div><span class="rtsocial-twitter-count"></span></div>' : '';
$tw_layout .= ' <div class="rtsocial-twitter-icon-button"><a title="Tweet: ' . $rtatitle . '" class="rtsocial-twitter-icon-link" href= "https://twitter.com/share?text=' . $rtstitle . $handle_string . '&url=' . $rtslink . '" target= "_blank"></a></div>' . $tw_count;
}
}
}
}
$tw_layout .= '</div>';
$active_services[ $tw ] = $tw_layout;
}
//Twitter End
//Facebook
if ( isset( $options ) && !empty( $options ) && isset( $options[ 'active' ] ) && !empty( $options[ 'active' ] ) && in_array( 'fb', $options[ 'active' ] ) ) {
$fb = array_search( 'fb', $options[ 'active' ] );
$fb_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-' . $options[ 'display_options_set' ] . '-count"><div class="rtsocial-' . $options[ 'display_options_set' ] . '-notch"></div><span class="rtsocial-fb-count"></span></div>' : '';
$path = '';
$class = '';
$rt_fb_style = '';
$path = plugins_url( 'images/', __FILE__ );
if ( $options[ 'fb_style' ] == 'like_dark' ) {
$class = 'rtsocial-fb-like-dark';
$rt_fb_style = 'fb-dark';
} else {
if ( $options[ 'fb_style' ] == 'recommend_dark' ) {
$class = 'rtsocial-fb-recommend-dark';
$rt_fb_style = 'fb-dark';
} else {
if ( $options[ 'fb_style' ] == 'recommend_light' ) {
$class = 'rtsocial-fb-recommend-light';
$rt_fb_style = 'fb-light';
} else {
if ( $options[ 'fb_style' ] == 'share' ) {
$class = 'rtsocial-fb-share';
} else {
$class = 'rtsocial-fb-like-light';
$rt_fb_style = 'fb-light';
}
}
}
}
$fb_layout = '<div class="rtsocial-fb-' . $options[ 'display_options_set' ] . ' ' . $rt_fb_style . '">';
$rt_social_text = '';
if ( $options[ 'fb_style' ] == 'like_light' || $options[ 'fb_style' ] == 'like_dark' ) {
$rt_social_text = 'Like';
} else {
if ( $options[ 'fb_style' ] == 'recommend_light' || $options[ 'fb_style' ] == 'recommend_dark' ) {
$rt_social_text = 'Recommend';
} else {
$rt_social_text = 'Share';
}
}
if ( $options[ 'display_options_set' ] == 'horizontal' ) {
$fb_layout .= '<div class="rtsocial-fb-' . $options[ 'display_options_set' ] . '-button"><a title="' . $rt_social_text . ': ' . $rtatitle . '" class="rtsocial-fb-button ' . $class . '" href="https://www.facebook.com/sharer.php?u=' . ( urlencode( get_permalink( $post->ID ) ) ) . '" rel="nofollow" target="_blank"></a></div>' . $fb_count;
} else {
if ( $options[ 'display_options_set' ] == 'vertical' ) {
$fb_layout .= $fb_count . '<div class="rtsocial-fb-' . $options[ 'display_options_set' ] . '-button"><a title="' . $rt_social_text . ': ' . $rtatitle . '" class="rtsocial-fb-button ' . $class . '" href="https://www.facebook.com/sharer.php?u=' . ( urlencode( get_permalink( $post->ID ) ) ) . '" rel="nofollow" target="_blank"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon' ) {
$fb_layout .= ' <div class="rtsocial-fb-' . $options[ 'display_options_set' ] . '-button"><a title="' . $rt_social_text . ': ' . $rtatitle . '" class="rtsocial-fb-icon-link" href="https://www.facebook.com/sharer.php?u=' . ( urlencode( get_permalink( $post->ID ) ) ) . '" target= "_blank"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon-count' ) {
$fb_layout = '<div class="rtsocial-fb-icon" class="' . $rt_fb_style . '">';
$fb_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-horizontal-count"><div class="rtsocial-horizontal-notch"></div><span class="rtsocial-fb-count"></span></div>' : '';
$fb_layout .= ' <div class="rtsocial-fb-icon-button"><a title="' . $rt_social_text . ': ' . $rtatitle . '" class="rtsocial-fb-icon-link" href="https://www.facebook.com/sharer.php?u=' . ( urlencode( get_permalink( $post->ID ) ) ) . '" target= "_blank"></a></div>' . $fb_count;
}
}
}
}
$fb_layout .= '</div>';
$active_services[ $fb ] = $fb_layout;
}
//Facebook End
//Pinterest
if ( isset( $options ) && !empty( $options ) && isset( $options[ 'active' ] ) && !empty( $options[ 'active' ] ) && in_array( 'pin', $options[ 'active' ] ) ) {
$pin = array_search( 'pin', $options[ 'active' ] );
$pin_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-' . $options[ 'display_options_set' ] . '-count"><div class="rtsocial-' . $options[ 'display_options_set' ] . '-notch"></div><span class="rtsocial-pinterest-count"></span></div>' : '';
//Set Pinterest media image
if ( has_post_thumbnail( $post->ID ) ) {
//Use post thumbnail if set
$thumb_details = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail' );
$thumb_src = $thumb_details[ 0 ];
} else {
//Else use a default image
$thumb_src = plugins_url( 'images/default-pinterest.png', __FILE__ );
}
//Set Pinterest description
$title = $post->post_title;
$pin_layout = '<div class="rtsocial-pinterest-' . $options[ 'display_options_set' ] . '">';
if ( $options[ 'display_options_set' ] == 'horizontal' ) {
$pin_layout .= '<div class="rtsocial-pinterest-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-pinterest-button" href= "https://pinterest.com/pin/create/button/?url=' . get_permalink( $post->ID ) . '&media=' . $thumb_src . '&description=' . $title . '" rel="nofollow" target="_blank" title="Pin: ' . $rtatitle . '"></a></div>' . $pin_count;
} else {
if ( $options[ 'display_options_set' ] == 'vertical' ) {
$pin_layout .= $pin_count . '<div class="rtsocial-pinterest-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-pinterest-button" href= "https://pinterest.com/pin/create/button/?url=' . get_permalink( $post->ID ) . '&media=' . $thumb_src . '&description=' . $title . '" rel="nofollow" target="_blank" title="Pin: ' . $rtatitle . '"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon' ) {
$pin_layout .= ' <div class="rtsocial-pinterest-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-pinterest-icon-link" href= "https://pinterest.com/pin/create/button/?url=' . get_permalink( $post->ID ) . '&media=' . $thumb_src . '&description=' . $title . '" target= "_blank" title="Pin: ' . $rtatitle . '"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon-count' ) {
$pin_layout = '<div class="rtsocial-pinterest-icon">';
$pin_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-horizontal-count"><div class="rtsocial-horizontal-notch"></div><span class="rtsocial-pinterest-count"></span></div>' : '';
$pin_layout .= ' <div class="rtsocial-pinterest-icon-button"><a class="rtsocial-pinterest-icon-link" href= "https://pinterest.com/pin/create/button/?url=' . get_permalink( $post->ID ) . '&media=' . $thumb_src . '&description=' . $title . '" target= "_blank" title="Pin: ' . $rtatitle . '"></a></div>' . $pin_count;
}
}
}
}
$pin_layout .= '</div>';
$active_services[ $pin ] = $pin_layout;
}
//Pinterest End
//LinkedIn
if ( isset( $options ) && !empty( $options ) && isset( $options[ 'active' ] ) && !empty( $options[ 'active' ] ) && in_array( 'lin', $options[ 'active' ] ) ) {
$lin = array_search( 'lin', $options[ 'active' ] );
$lin_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-' . $options[ 'display_options_set' ] . '-count"><div class="rtsocial-' . $options[ 'display_options_set' ] . '-notch"></div><span class="rtsocial-linkedin-count"></span></div>' : '';
$lin_layout = '<div class="rtsocial-linkedin-' . $options[ 'display_options_set' ] . '">';
if ( $options[ 'display_options_set' ] == 'horizontal' ) {
$lin_layout .= '<div class="rtsocial-linkedin-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-linkedin-button" href= "https://www.linkedin.com/shareArticle?mini=true&url=' . urlencode( get_permalink( $post->ID ) ) . '&title=' . urlencode( get_the_title( $post->ID ) ) . '" rel="nofollow" target="_blank" title="Share: ' . $rtatitle . '"></a></div>' . $lin_count;
} else {
if ( $options[ 'display_options_set' ] == 'vertical' ) {
$lin_layout .= $lin_count . ' <div class="rtsocial-linkedin-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-linkedin-button" href= "https://www.linkedin.com/shareArticle?mini=true&url=' . urlencode( get_permalink( $post->ID ) ) . '&title=' . urlencode( get_the_title( $post->ID ) ) . '" rel="nofollow" target="_blank" title="Share: ' . $rtatitle . '"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon' ) {
$lin_layout .= ' <div class="rtsocial-linkedin-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-linkedin-icon-link" href= "https://www.linkedin.com/shareArticle?mini=true&url=' . urlencode( get_permalink( $post->ID ) ) . '&title=' . urlencode( get_the_title( $post->ID ) ) . '" target= "_blank" title="Share: ' . $rtatitle . '"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon-count' ) {
$lin_layout = '<div class="rtsocial-linkedin-icon">';
$lin_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-horizontal-count"><div class="rtsocial-horizontal-notch"></div><span class="rtsocial-linkedin-count"></span></div>' : '';
$lin_layout .= ' <div class="rtsocial-linkedin-icon-button"><a class="rtsocial-linkedin-icon-link" href= "https://www.linkedin.com/shareArticle?mini=true&url=' . urlencode( get_permalink( $post->ID ) ) . '&title=' . urlencode( get_the_title( $post->ID ) ) . '" target= "_blank" title="Share: ' . $rtatitle . '"></a></div>' . $lin_count;
}
}
}
}
$lin_layout .= '</div>';
$active_services[ $lin ] = $lin_layout;
}
//Linked In End
//G+ Share Button
if ( isset( $options ) && !empty( $options ) && isset( $options[ 'active' ] ) && !empty( $options[ 'active' ] ) && in_array( 'gplus', $options[ 'active' ] ) && isset( $options[ 'google_api_key' ] ) && $options[ 'google_api_key' ] != '' ) {
$gplus = array_search( 'gplus', $options[ 'active' ] );
$gplus_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-' . $options[ 'display_options_set' ] . '-count"><div class="rtsocial-' . $options[ 'display_options_set' ] . '-notch"></div><span class="rtsocial-gplus-count"></span></div>' : '';
$gplus_layout = '<div class="rtsocial-gplus-' . $options[ 'display_options_set' ] . '">';
if ( $options[ 'display_options_set' ] == 'horizontal' ) {
$gplus_layout .= '<div class="rtsocial-gplus-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-gplus-button" href= "https://plus.google.com/share?url=' . urlencode( get_permalink( $post->ID ) ) . '" rel="nofollow" target="_blank" title="+1: ' . $rtatitle . '"></a></div>' . $gplus_count;
} else {
if ( $options[ 'display_options_set' ] == 'vertical' ) {
$gplus_layout .= $gplus_count . '<div class="rtsocial-gplus-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-gplus-button" href= "https://plus.google.com/share?url=' . urlencode( get_permalink( $post->ID ) ) . '" rel="nofollow" target="_blank" title="+1: ' . $rtatitle . '"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon' ) {
$gplus_layout .= ' <div class="rtsocial-gplus-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-gplus-icon-link" href= "https://plus.google.com/share?url=' . urlencode( get_permalink( $post->ID ) ) . '" target= "_blank" title="+1: ' . $rtatitle . '"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon-count' ) {
$gplus_layout = '<div class="rtsocial-gplus-icon">';
$gplus_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-horizontal-count"><div class="rtsocial-horizontal-notch"></div><span class="rtsocial-gplus-count"></span></div>' : '';
$gplus_layout .= ' <div class="rtsocial-gplus-icon-button"><a class="rtsocial-gplus-icon-link" href= "https://plus.google.com/share?url=' . urlencode( get_permalink( $post->ID ) ) . '" target= "_blank" title="+1: ' . $rtatitle . '"></a></div>' . $gplus_count;
}
}
}
}
$gplus_layout .= '</div>';
$active_services[ $gplus ] = $gplus_layout;
}
//G+ Share Button End
//Sort by indexes
ksort( $active_services );
//Form the ordered buttons markup
$active_services = implode( '', $active_services );
//Rest of the stuff
$layout = '<div class="rtsocial-container rtsocial-container-align-' . $options[ 'alignment_options_set' ] . ' rtsocial-' . $options[ 'display_options_set' ] . '">';
//Append the ordered buttons
$layout .= $active_services;
//Hidden permalink
$layout .= '<a rel="nofollow" class="perma-link" href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( get_the_title( $post->ID ) ) . '"></a><input type="hidden" name="rts_id" class="rts_id" value="' . $post->ID . '" />' . wp_nonce_field( 'rts_media_' . $post->ID, 'rts_media_nonce', true, false ) . '</div>';
if ( $options[ 'placement_options_set' ] == 'top' ) {
return $layout . $content;
} else {
if ( $options[ 'placement_options_set' ] == 'bottom' ) {
return $content . $layout;
} else {
return $content;
}
}
}
/*
* Function for manual layout
*
* Possible options
* 'active' = array('tw', 'fb', 'lin', 'pin', 'gplus');
* 'display_options_set' = 'horizontal', 'vertical', 'icon', 'icon-count'
* 'alignment_options_set' = 'left', 'right', 'center', 'none'
* 'tw_handle' = 'whateveryouwant'
* 'tw_related_handle' = 'whateveryouwant'
* 'fb_style' = 'like_light', 'like_dark', 'recommend_light', 'recommend_dark', 'share'
*/
function rtsocial( $args = array() ) {
//Working issue on attachment page
if ( is_attachment() ) {
return;
}
$options = get_option( 'rtsocial_plugin_options' );
$options = wp_parse_args( $args, $options );
//If manual mode is selected then avoid this code
if ( isset( $options ) && !empty( $options ) && $options[ 'placement_options_set' ] != 'manual' ) {
return;
}
global $post;
$post_obj = apply_filters( "rtsocial_post_object", $post );
$rts_permalink = apply_filters( "rtsocial_permalink", get_permalink( $post_obj->ID ), $post_obj->ID, $post_obj );
$rtslink = urlencode( $rts_permalink );
$rtatitle = apply_filters( "rtsocial_title", get_the_title( $post_obj->ID ) );
$rtstitle = rt_url_encode( $rtatitle );
//Ordered buttons
$active_services = array();
//Twitter
if ( isset( $options ) && !empty( $options ) && isset( $options[ 'active' ] ) && !empty( $options[ 'active' ] ) && in_array( 'tw', $options[ 'active' ] ) ) {
$tw = array_search( 'tw', $options[ 'active' ] );
$tw_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-' . $options[ 'display_options_set' ] . '-count"><div class="rtsocial-' . $options[ 'display_options_set' ] . '-notch"></div><span class="rtsocial-twitter-count"></span></div>' : '';
$handle_string = '';
$handle_string .= ( isset( $options[ 'tw_handle' ] ) && $options[ 'tw_handle' ] != '' ) ? '&via=' . $options[ 'tw_handle' ] : '';
$handle_string .= ( isset( $options[ 'tw_related_handle' ] ) && $options[ 'tw_related_handle' ] != '' ) ? '&related=' . $options[ 'tw_related_handle' ] : '';
$tw_layout = '<div class="rtsocial-twitter-' . $options[ 'display_options_set' ] . '">';
if ( $options[ 'display_options_set' ] == 'horizontal' ) {
$tw_layout .= '<div class="rtsocial-twitter-' . $options[ 'display_options_set' ] . '-button"><a title="Tweet: ' . $rtatitle . '" class="rtsocial-twitter-button" href= "https://twitter.com/share?text=' . $rtstitle . $handle_string . '&url=' . $rtslink . '" rel="nofollow" target="_blank"></a></div>' . $tw_count;
} else {
if ( $options[ 'display_options_set' ] == 'vertical' ) {
$tw_layout .= $tw_count . '<div class="rtsocial-twitter-' . $options[ 'display_options_set' ] . '-button"><a title="Tweet: ' . $rtatitle . '" class="rtsocial-twitter-button" href= "https://twitter.com/share?text=' . $rtstitle . $handle_string . '&url=' . $rtslink . '" target= "_blank"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon' ) {
$tw_layout .= ' <div class="rtsocial-twitter-' . $options[ 'display_options_set' ] . '-button"><a title="Tweet: ' . $rtatitle . '" class="rtsocial-twitter-icon-link" href= "https://twitter.com/share?text=' . $rtstitle . $handle_string . '&url=' . $rtslink . '" target= "_blank"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon-count' ) {
$tw_layout = '<div class="rtsocial-twitter-icon">';
$tw_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-horizontal-count"><div class="rtsocial-horizontal-notch"></div><span class="rtsocial-twitter-count"></span></div>' : '';
$tw_layout .= ' <div class="rtsocial-twitter-icon-button"><a title="Tweet: ' . $rtatitle . '" class="rtsocial-twitter-icon-link" href= "https://twitter.com/share?text=' . $rtstitle . $handle_string . '&url=' . $rtslink . '" target= "_blank"></a></div>' . $tw_count;
}
}
}
}
$tw_layout .= '</div>';
$active_services[ $tw ] = $tw_layout;
}
//Twitter End
//Facebook
if ( isset( $options ) && !empty( $options ) && isset( $options[ 'active' ] ) && !empty( $options[ 'active' ] ) && in_array( 'fb', $options[ 'active' ] ) ) {
$fb = array_search( 'fb', $options[ 'active' ] );
$fb_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-' . $options[ 'display_options_set' ] . '-count"><div class="rtsocial-' . $options[ 'display_options_set' ] . '-notch"></div><span class="rtsocial-fb-count"></span></div>' : '';
$path = '';
$class = '';
$rt_fb_style = '';
$path = plugins_url( 'images/', __FILE__ );
if ( $options[ 'fb_style' ] == 'like_dark' ) {
$class = 'rtsocial-fb-like-dark';
$rt_fb_style = 'fb-dark';
} else {
if ( $options[ 'fb_style' ] == 'recommend_dark' ) {
$class = 'rtsocial-fb-recommend-dark';
$rt_fb_style = 'fb-dark';
} else {
if ( $options[ 'fb_style' ] == 'recommend_light' ) {
$class = 'rtsocial-fb-recommend-light';
$rt_fb_style = 'fb-light';
} else {
if ( $options[ 'fb_style' ] == 'share' ) {
$class = 'rtsocial-fb-share';
} else {
$class = 'rtsocial-fb-like-light';
$rt_fb_style = 'fb-light';
}
}
}
}
$fb_layout = '<div class="rtsocial-fb-' . $options[ 'display_options_set' ] . ' ' . $rt_fb_style . '">';
$rt_social_text = '';
if ( $options[ 'fb_style' ] == 'like_light' || $options[ 'fb_style' ] == 'like_dark' ) {
$rt_social_text = 'Like';
} else {
if ( $options[ 'fb_style' ] == 'recommend_light' || $options[ 'fb_style' ] == 'recommend_dark' ) {
$rt_social_text = 'Recommend';
} else {
$rt_social_text = 'Share';
}
}
if ( $options[ 'display_options_set' ] == 'horizontal' ) {
$fb_layout .= '<div class="rtsocial-fb-' . $options[ 'display_options_set' ] . '-button"><a title="' . $rt_social_text . ': ' . $rtatitle . '" class="rtsocial-fb-button ' . $class . '" href="https://www.facebook.com/sharer.php?u=' . $rtslink . '" rel="nofollow" target="_blank"></a></div>' . $fb_count;
} else {
if ( $options[ 'display_options_set' ] == 'vertical' ) {
$fb_layout .= $fb_count . '<div class="rtsocial-fb-' . $options[ 'display_options_set' ] . '-button"><a title="' . $rt_social_text . ': ' . $rtatitle . '" class="rtsocial-fb-button ' . $class . '" href="https://www.facebook.com/sharer.php?u=' . $rtslink . '" rel="nofollow" target="_blank"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon' ) {
$fb_layout .= ' <div class="rtsocial-fb-' . $options[ 'display_options_set' ] . '-button"><a title="' . $rt_social_text . ': ' . $rtatitle . '" class="rtsocial-fb-icon-link" href="https://www.facebook.com/sharer.php?u=' . $rtslink . '" target= "_blank"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon-count' ) {
$fb_layout = '<div class="rtsocial-fb-icon" class="' . $rt_fb_style . '">';
$fb_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-horizontal-count"><div class="rtsocial-horizontal-notch"></div><span class="rtsocial-fb-count"></span></div>' : '';
$fb_layout .= ' <div class="rtsocial-fb-icon-button"><a title="' . $rt_social_text . ': ' . $rtatitle . '" class="rtsocial-fb-icon-link" href="https://www.facebook.com/sharer.php?u=' . $rtslink . '" target= "_blank"></a></div>' . $fb_count;
}
}
}
}
$fb_layout .= '</div>';
$active_services[ $fb ] = $fb_layout;
}
//Facebook End
//Pinterest
if ( isset( $options ) && !empty( $options ) && isset( $options[ 'active' ] ) && !empty( $options[ 'active' ] ) && in_array( 'pin', $options[ 'active' ] ) ) {
$pin = array_search( 'pin', $options[ 'active' ] );
$pin_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-' . $options[ 'display_options_set' ] . '-count"><div class="rtsocial-' . $options[ 'display_options_set' ] . '-notch"></div><span class="rtsocial-pinterest-count"></span></div>' : '';
//Set Pinterest media image
if ( has_post_thumbnail( $post_obj->ID ) ) {
//Use post thumbnail if set
$thumb_details = wp_get_attachment_image_src( get_post_thumbnail_id( $post_obj->ID ), 'thumbnail' );
$thumb_src = $thumb_details[ 0 ];
} else {
//Else use a default image
$thumb_src = plugins_url( 'images/default-pinterest.png', __FILE__ );
}
$thumb_src = apply_filters( 'rtsocial_pinterest_thumb', $thumb_src, $post_obj->ID );
//Set Pinterest description
$title = $post_obj->post_title;
$pin_layout = '<div class="rtsocial-pinterest-' . $options[ 'display_options_set' ] . '">';
if ( $options[ 'display_options_set' ] == 'horizontal' ) {
$pin_layout .= '<div class="rtsocial-pinterest-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-pinterest-button" href= "https://pinterest.com/pin/create/button/?url=' . $rtslink . '&media=' . $thumb_src . '&description=' . $title . '" rel="nofollow" target="_blank" title="Pin: ' . $rtatitle . '"></a></div>' . $pin_count;
} else {
if ( $options[ 'display_options_set' ] == 'vertical' ) {
$pin_layout .= $pin_count . '<div class="rtsocial-pinterest-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-pinterest-button" href= "https://pinterest.com/pin/create/button/?url=' . $rtslink . '&media=' . $thumb_src . '&description=' . $title . '" rel="nofollow" target="_blank" title="Pin: ' . $rtatitle . '"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon' ) {
$pin_layout .= ' <div class="rtsocial-pinterest-' . $options[ 'display_options_set' ] . '-button"><a class="rtsocial-pinterest-icon-link" href= "https://pinterest.com/pin/create/button/?url=' . $rtslink . '&media=' . $thumb_src . '&description=' . $title . '" target= "_blank" title="Pin: ' . $rtatitle . '"></a></div>';
} else {
if ( $options[ 'display_options_set' ] == 'icon-count' ) {
$pin_layout = '<div class="rtsocial-pinterest-icon">';
$pin_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-horizontal-count"><div class="rtsocial-horizontal-notch"></div><span class="rtsocial-pinterest-count"></span></div>' : '';
$pin_layout .= ' <div class="rtsocial-pinterest-icon-button"><a class="rtsocial-pinterest-icon-link" href= "https://pinterest.com/pin/create/button/?url=' . $rtslink . '&media=' . $thumb_src . '&description=' . $title . '" target= "_blank" title="Pin ' . $rtatitle . '"></a></div>' . $pin_count;
}
}
}
}
$pin_layout .= '</div>';
$active_services[ $pin ] = $pin_layout;
}
//Pinterest End
//LinkedIn
if ( isset( $options ) && !empty( $options ) && isset( $options[ 'active' ] ) && !empty( $options[ 'active' ] ) && in_array( 'lin', $options[ 'active' ] ) ) {
$lin = array_search( 'lin', $options[ 'active' ] );
$lin_count = (!isset( $options[ 'hide_count' ] ) || $options[ 'hide_count' ] != 1 ) ? '<div class="rtsocial-' . $options[ 'display_options_set' ] . '-count"><div class="rtsocial-' . $options[ 'display_options_set' ] . '-notch"></div><span class="rtsocial-linkedin-count"></span></div>' : '';
$lin_layout = '<div class="rtsocial-linkedin-' . $options[ 'display_options_set' ] . '">';