-
Notifications
You must be signed in to change notification settings - Fork 4
/
addtoany.admin.php
1573 lines (1369 loc) · 81.2 KB
/
addtoany.admin.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
/**
* Post options
*/
function A2A_SHARE_SAVE_add_meta_box() {
$post_types = get_post_types( array( 'public' => true ) );
$post_types_not_builtin = get_post_types( array( 'public' => true, '_builtin' => false ) );
$options = get_option( 'addtoany_options', array() );
$title = apply_filters( 'A2A_SHARE_SAVE_meta_box_title', __( 'AddToAny', 'add-to-any' ) );
foreach( $post_types as $post_type ) {
$is_cpt = in_array( $post_type, $post_types_not_builtin );
if (
// If automatic placement is enabled
// for either floating bar
isset( $options['floating_vertical'] ) && 'none' != $options['floating_vertical'] ||
isset( $options['floating_horizontal'] ) && 'none' != $options['floating_horizontal'] ||
// for standard buttons in posts
'post' == $post_type && ( ! isset( $options['display_in_posts'] ) || $options['display_in_posts'] != '-1' ) ||
// for standard buttons in pages
'page' == $post_type && ( ! isset( $options['display_in_pages'] ) || $options['display_in_pages'] != '-1' ) ||
// for standard buttons in a custom post type
$is_cpt && ( ! isset( $options['display_in_cpt_' . $post_type] ) || $options['display_in_cpt_' . $post_type] != '-1' )
) {
// Add meta box
add_meta_box( 'A2A_SHARE_SAVE_meta', $title, 'A2A_SHARE_SAVE_meta_box_content', $post_type, 'side', 'default' );
}
}
}
function A2A_SHARE_SAVE_meta_box_content( $post ) {
do_action( 'start_A2A_SHARE_SAVE_meta_box_content', $post );
$disabled = get_post_meta( $post->ID, 'sharing_disabled', true ); ?>
<p>
<label for="enable_post_addtoany_sharing">
<input type="checkbox" name="enable_post_addtoany_sharing" id="enable_post_addtoany_sharing" value="1"
<?php checked( empty( $disabled ) );
/* Have other known sharing checkboxes with the same option name
* inherit the AddToAny checkbox value on change
*/ ?>
onchange="if (jQuery) jQuery('input[name="enable_post_sharing"]').attr('checked', jQuery(this).is(':checked'))">
<?php _e( 'Show sharing buttons.' , 'add-to-any'); ?>
</label>
<input type="hidden" name="addtoany_sharing_status_hidden" value="1" />
</p>
<?php
do_action( 'end_A2A_SHARE_SAVE_meta_box_content', $post );
}
function A2A_SHARE_SAVE_meta_box_save( $post_id ) {
// If this is an autosave, this form has not been submitted, so we don't want to do anything.
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return $post_id;
// Save sharing_disabled if "Show sharing buttons" checkbox is unchecked
if ( isset( $_POST['post_type'] ) ) {
if ( current_user_can( 'edit_post', $post_id ) ) {
if ( isset( $_POST['addtoany_sharing_status_hidden'] ) ) {
if ( ! isset( $_POST['enable_post_addtoany_sharing'] ) ) {
update_post_meta( $post_id, 'sharing_disabled', 1 );
} else {
delete_post_meta( $post_id, 'sharing_disabled' );
}
}
}
}
return $post_id;
}
add_action( 'admin_init', 'A2A_SHARE_SAVE_add_meta_box' );
add_action( 'save_post', 'A2A_SHARE_SAVE_meta_box_save' );
add_action( 'edit_attachment', 'A2A_SHARE_SAVE_meta_box_save' );
/**
* Adds feature pointers
*/
function A2A_SHARE_SAVE_enqueue_pointer_script_style( $hook_suffix ) {
// Variable required for PHP < 5.5 because empty() only supports variables
$options = get_option( 'addtoany_options', array() );
// Return if AddToAny options have been set
if ( ! empty( $options ) ) {
return;
}
// Get array list of dismissed pointers for current user and convert it to array
$dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
// If any one of our pointers is not among dismissed pointers
if (
! in_array( 'addtoany_settings_pointer', $dismissed_pointers )
) {
// Enqueue pointer CSS and JS files, if needed
wp_enqueue_style( 'wp-pointer' );
wp_enqueue_script( 'wp-pointer' );
// Add footer scripts using callback function
add_action( 'admin_print_footer_scripts', 'A2A_SHARE_SAVE_pointer_print_scripts' );
}
}
add_action( 'admin_enqueue_scripts', 'A2A_SHARE_SAVE_enqueue_pointer_script_style' );
function A2A_SHARE_SAVE_pointer_print_scripts() {
// Get array list of dismissed pointers for current user and convert it to array
$dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
?>
<script>
<?php if ( ! in_array( 'addtoany_settings_pointer', $dismissed_pointers ) ) : ?>
jQuery(document).ready( function($) {
$('#menu-settings').pointer({
content: '<h3><?php esc_html_e( 'AddToAny Settings', 'add-to-any' ); ?></h3><p><?php esc_html_e( 'To customize AddToAny, click "AddToAny" in the Settings menu.', 'add-to-any' ); ?></p>',
position: {
edge: 'left', // arrow direction
align: 'center' // vertical alignment
},
pointerWidth: 350,
close: function() {
$.post( ajaxurl, {
pointer: 'addtoany_settings_pointer', // pointer ID
action: 'dismiss-wp-pointer'
});
}
}).pointer('open');
});
<?php endif; ?>
</script>
<?php
}
function _a2a_position_in_content( $options, $option_box = false ) {
if ( ! isset( $options['position'] ) ) {
$options['position'] = 'bottom';
}
$positions = array(
'bottom' => array(
'selected' => ( 'bottom' == $options['position'] ) ? ' selected="selected"' : '',
'string' => __( 'bottom', 'add-to-any' )
),
'top' => array(
'selected' => ( 'top' == $options['position'] ) ? ' selected="selected"' : '',
'string' => __( 'top', 'add-to-any' )
),
'both' => array(
'selected' => ( 'both' == $options['position'] ) ? ' selected="selected"' : '',
'string' => __( 'top & bottom', 'add-to-any' )
)
);
if ( $option_box ) {
$html = '</label>';
$html .= '<label>'; // Label needed to prevent checkmark toggle on SELECT click
$html .= '<select name="A2A_SHARE_SAVE_position">';
$html .= '<option value="bottom"' . $positions['bottom']['selected'] . '>' . $positions['bottom']['string'] . '</option>';
$html .= '<option value="top"' . $positions['top']['selected'] . '>' . $positions['top']['string'] . '</option>';
$html .= '<option value="both"' . $positions['both']['selected'] . '>' . $positions['both']['string'] . '</option>';
$html .= '</select>';
return $html;
} else {
$html = '<span class="A2A_SHARE_SAVE_position">';
$html .= $positions[$options['position']]['string'];
$html .= '</span>';
return $html;
}
}
function _a2a_selected_attr( $value, $option_name, $options ) {
if ( ! empty( $options[ $option_name ] ) && $value === $options[ $option_name ] ) {
echo ' selected';
}
}
function _a2a_disabled_attr() {
if ( ! current_user_can( 'unfiltered_html' ) ) {
echo ' disabled';
}
}
function _a2a_valid_hex_color( $value, $default ) {
if ( preg_match( '/^#[a-f0-9]{6}$/i', $value ) ) {
return $value;
}
return $default;
}
function _a2a_valid_content_position_selection( $value, $default ) {
return in_array( $value, array('top', 'bottom', 'both') ) ? $value : $default;
}
function _a2a_valid_floating_bg_color_selection( $value, $default ) {
return in_array( $value, array( 'transparent', 'custom' ) ) ? $value : $default;
}
function _a2a_valid_icon_color_selection( $bg_or_fg, $value, $default ) {
if ( 'bg' === $bg_or_fg ) {
$valid_selections = array('original', 'custom', 'transparent');
} elseif ( 'fg' === $bg_or_fg ) {
$valid_selections = array('original', 'custom');
}
return in_array( $value, $valid_selections ) ? $value : $default;
}
function A2A_SHARE_SAVE_options_page() {
global $A2A_SHARE_SAVE_plugin_url,
$A2A_SHARE_SAVE_services;
// Require admin privs
if ( ! current_user_can( 'manage_options' ) )
return false;
$new_options = array();
$namespace = 'A2A_SHARE_SAVE_';
// Make available services extensible via plugins, themes (functions.php), etc.
$A2A_SHARE_SAVE_services = apply_filters( 'A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services );
// Which tab is selected?
$possible_screens = array( 'default', 'floating' );
$current_screen = ( isset( $_GET['action'] ) && in_array( $_GET['action'], $possible_screens ) ) ? $_GET['action'] : 'default';
if ( isset( $_POST['Submit'] ) ) {
// Nonce verification
check_admin_referer( 'add-to-any-update-options' );
if ( 'floating' == $current_screen ) {
// Floating options screen
$possible_floating_values = array( 'left_docked', 'right_docked', 'center_docked', 'left_attached', 'right_attached', 'none' );
$new_options['floating_vertical'] = ( in_array( $_POST['A2A_SHARE_SAVE_floating_vertical'], $possible_floating_values ) ) ? $_POST['A2A_SHARE_SAVE_floating_vertical'] : 'none';
$new_options['floating_horizontal'] = ( in_array( $_POST['A2A_SHARE_SAVE_floating_horizontal'], $possible_floating_values ) ) ? $_POST['A2A_SHARE_SAVE_floating_horizontal'] : 'none';
$new_options['floating_horizontal_position'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_position'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_position'] )
) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_position'] : '0';
$new_options['floating_horizontal_offset'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_offset'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_offset'] )
) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_offset'] : '0';
$new_options['floating_horizontal_responsive'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_responsive'] ) &&
'1' == $_POST['A2A_SHARE_SAVE_floating_horizontal_responsive']
) ? '1' : '-1';
$new_options['floating_horizontal_responsive_min_width'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_responsive_min_width'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_responsive_min_width'] )
) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_responsive_min_width'] : '981';
$new_options['floating_horizontal_scroll_top'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_scroll_top'] ) &&
'1' == $_POST['A2A_SHARE_SAVE_floating_horizontal_scroll_top']
) ? '1' : '-1';
$new_options['floating_horizontal_scroll_top_pixels'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_scroll_top_pixels'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_scroll_top_pixels'] )
) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_scroll_top_pixels'] : '100';
$new_options['floating_horizontal_scroll_bottom'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_scroll_bottom'] ) &&
'1' == $_POST['A2A_SHARE_SAVE_floating_horizontal_scroll_bottom']
) ? '1' : '-1';
$new_options['floating_horizontal_scroll_bottom_pixels'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_scroll_bottom_pixels'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_scroll_bottom_pixels'] )
) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_scroll_bottom_pixels'] : '100';
$new_options['floating_horizontal_icon_size'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_horizontal_icon_size'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_horizontal_icon_size'] )
) ? $_POST['A2A_SHARE_SAVE_floating_horizontal_icon_size'] : '32';
$new_options['floating_horizontal_bg'] = _a2a_valid_floating_bg_color_selection( $_POST['A2A_SHARE_SAVE_floating_horizontal_bg'], 'transparent' );
$new_options['floating_horizontal_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_floating_horizontal_bg_color'], '#ffffff' );
$new_options['floating_vertical_position'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_vertical_position'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_position'] )
) ? $_POST['A2A_SHARE_SAVE_floating_vertical_position'] : '100';
$new_options['floating_vertical_attached_to'] = (
! empty( $_POST['A2A_SHARE_SAVE_floating_vertical_attached_to'] )
) ? sanitize_text_field( $_POST['A2A_SHARE_SAVE_floating_vertical_attached_to'] ) : 'main, [role="main"], article, .status-publish';
$new_options['floating_vertical_offset'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] )
) ? $_POST['A2A_SHARE_SAVE_floating_vertical_offset'] : '0';
$new_options['floating_vertical_responsive'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_vertical_responsive'] ) &&
'1' == $_POST['A2A_SHARE_SAVE_floating_vertical_responsive']
) ? '1' : '-1';
$new_options['floating_vertical_responsive_max_width'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_vertical_responsive_max_width'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_responsive_max_width'] )
) ? $_POST['A2A_SHARE_SAVE_floating_vertical_responsive_max_width'] : '980';
$new_options['floating_vertical_scroll_top'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_vertical_scroll_top'] ) &&
'1' == $_POST['A2A_SHARE_SAVE_floating_vertical_scroll_top']
) ? '1' : '-1';
$new_options['floating_vertical_scroll_top_pixels'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_vertical_scroll_top_pixels'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_scroll_top_pixels'] )
) ? $_POST['A2A_SHARE_SAVE_floating_vertical_scroll_top_pixels'] : '100';
$new_options['floating_vertical_scroll_bottom'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_vertical_scroll_bottom'] ) &&
'1' == $_POST['A2A_SHARE_SAVE_floating_vertical_scroll_bottom']
) ? '1' : '-1';
$new_options['floating_vertical_scroll_bottom_pixels'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_vertical_scroll_bottom_pixels'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_scroll_bottom_pixels'] )
) ? $_POST['A2A_SHARE_SAVE_floating_vertical_scroll_bottom_pixels'] : '100';
$new_options['floating_vertical_icon_size'] = (
isset( $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] ) &&
is_numeric( $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] )
) ? $_POST['A2A_SHARE_SAVE_floating_vertical_icon_size'] : '32';
$new_options['floating_vertical_bg'] = _a2a_valid_floating_bg_color_selection( $_POST['A2A_SHARE_SAVE_floating_vertical_bg'], 'transparent' );
$new_options['floating_vertical_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_floating_vertical_bg_color'], '#ffffff' );
} else {
// Standard options screen
$new_options['position'] = _a2a_valid_content_position_selection( $_POST['A2A_SHARE_SAVE_position'], 'bottom' );
$new_options['display_in_posts_on_front_page'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_posts_on_front_page'] ) && $_POST['A2A_SHARE_SAVE_display_in_posts_on_front_page'] == '1' ) ? '1' : '-1';
$new_options['display_in_posts_on_archive_pages'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_posts_on_archive_pages'] ) && $_POST['A2A_SHARE_SAVE_display_in_posts_on_archive_pages'] == '1' ) ? '1' : '-1';
$new_options['display_in_excerpts'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_excerpts'] ) && $_POST['A2A_SHARE_SAVE_display_in_excerpts'] == '1' ) ? '1' : '-1';
$new_options['display_in_posts'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_posts'] ) && $_POST['A2A_SHARE_SAVE_display_in_posts'] == '1' ) ? '1' : '-1';
$new_options['display_in_pages'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_pages'] ) && $_POST['A2A_SHARE_SAVE_display_in_pages'] == '1' ) ? '1' : '-1';
$new_options['display_in_attachments'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_attachments'] ) && $_POST['A2A_SHARE_SAVE_display_in_attachments'] == '1' ) ? '1' : '-1';
$new_options['display_in_feed'] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_feed'] ) && $_POST['A2A_SHARE_SAVE_display_in_feed'] == '1' ) ? '1' : '-1';
$new_options['icon_size'] = ( ! empty( $_POST['A2A_SHARE_SAVE_icon_size'] ) && is_numeric( $_POST['A2A_SHARE_SAVE_icon_size'] ) ) ? $_POST['A2A_SHARE_SAVE_icon_size'] : '32';
$new_options['icon_bg'] = _a2a_valid_icon_color_selection( 'bg', $_POST['A2A_SHARE_SAVE_icon_bg'], 'original' );
$new_options['icon_bg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_icon_bg_color'], '#2a2a2a' );
$new_options['icon_fg'] = _a2a_valid_icon_color_selection( 'fg', $_POST['A2A_SHARE_SAVE_icon_fg'], 'original' );
$new_options['icon_fg_color'] = _a2a_valid_hex_color( $_POST['A2A_SHARE_SAVE_icon_fg_color'], '#ffffff' );
$new_options['button'] = ( isset( $_POST['A2A_SHARE_SAVE_button'] ) ) ? sanitize_text_field( $_POST['A2A_SHARE_SAVE_button'] ) : '';
$new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? sanitize_text_field( $_POST['A2A_SHARE_SAVE_button_custom'] ) : '';
$new_options['button_show_count'] = ( isset( $_POST['A2A_SHARE_SAVE_button_show_count'] ) && $_POST['A2A_SHARE_SAVE_button_show_count'] == '1' ) ? '1' : '-1';
$new_options['header'] = ( isset( $_POST['A2A_SHARE_SAVE_header'] ) && current_user_can( 'unfiltered_html' ) ) ? wp_kses_post( $_POST['A2A_SHARE_SAVE_header'] ) : '';
$new_options['additional_js_variables'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) && current_user_can( 'unfiltered_html' ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) : '';
$new_options['additional_css'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_css'] ) && current_user_can( 'unfiltered_html' ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_css'] ) : '';
$new_options['custom_icons'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons'] ) && $_POST['A2A_SHARE_SAVE_custom_icons'] == 'url' ) ? 'url' : '-1';
$new_options['custom_icons_url'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) ) ? trailingslashit( sanitize_text_field( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) ) : '';
$new_options['custom_icons_type'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_type'] ) ) ? sanitize_text_field( $_POST['A2A_SHARE_SAVE_custom_icons_type'] ) : 'png';
$new_options['custom_icons_width'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_width'] ) && is_numeric( $_POST['A2A_SHARE_SAVE_custom_icons_width'] ) ) ? $_POST['A2A_SHARE_SAVE_custom_icons_width'] : '';
$new_options['custom_icons_height'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_height'] ) && is_numeric( $_POST['A2A_SHARE_SAVE_custom_icons_height'] ) ) ? $_POST['A2A_SHARE_SAVE_custom_icons_height'] : '';
$new_options['cache'] = ( isset( $_POST['A2A_SHARE_SAVE_cache'] ) && $_POST['A2A_SHARE_SAVE_cache'] == '1' ) ? '1' : '-1';
$custom_post_types = array_values( get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' ) );
foreach ( $custom_post_types as $custom_post_type_obj ) {
$placement_name = $custom_post_type_obj->name;
$new_options['display_in_cpt_' . $placement_name] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_cpt_' . $placement_name] )
&& $_POST['A2A_SHARE_SAVE_display_in_cpt_' . $placement_name] == '1' ) ? '1' : '-1';
}
// Schedule cache refresh?
if ( isset( $_POST['A2A_SHARE_SAVE_cache'] ) && $_POST['A2A_SHARE_SAVE_cache'] == '1' ) {
A2A_SHARE_SAVE_schedule_cache();
} else {
A2A_SHARE_SAVE_unschedule_cache();
}
// Store desired text for text-only:
$new_options['button_text'] = ( trim( $_POST['A2A_SHARE_SAVE_button_text'] ) != '' ) ? sanitize_text_field( $_POST['A2A_SHARE_SAVE_button_text'] ) : __('Share','add-to-any');
// Store chosen individual services to make active
$active_services = array();
if ( ! isset( $_POST['A2A_SHARE_SAVE_active_services'] ) )
$_POST['A2A_SHARE_SAVE_active_services'] = array();
foreach ( $_POST['A2A_SHARE_SAVE_active_services'] as $dummy=>$sitename ) {
$service = substr( $sitename, 7 );
$active_services[] = $service;
// AddToAny counter enabled?
if ( in_array( $service, array( 'pinterest', 'reddit', 'tumblr' ) ) ) {
$new_options['special_' . $service . '_options'] = array(
'show_count' => ( ( isset( $_POST['addtoany_' . $service . '_show_count'] ) && $_POST['addtoany_' . $service . '_show_count'] == '1') ? '1' : '-1' )
);
}
}
$new_options['active_services'] = $active_services;
// Store special service options
$new_options['special_facebook_like_options'] = array(
'show_count' => ( ( isset( $_POST['addtoany_facebook_like_show_count'] ) && $_POST['addtoany_facebook_like_show_count'] == '1' ) ? '1' : '-1' ),
'verb' => ( ( isset( $_POST['addtoany_facebook_like_verb'] ) && $_POST['addtoany_facebook_like_verb'] == 'recommend') ? 'recommend' : 'like' ),
);
$new_options['special_twitter_tweet_options'] = array(
'show_count' => '-1' // Twitter doesn't provide counts anymore
);
$new_options['special_pinterest_pin_options'] = array(
'show_count' => ( ( isset( $_POST['addtoany_pinterest_pin_show_count'] ) && $_POST['addtoany_pinterest_pin_show_count'] == '1' ) ? '1' : '-1' )
);
}
// Get all existing AddToAny options
$existing_options = get_option( 'addtoany_options', array() );
// Merge $new_options into $existing_options to retain AddToAny options from all other screens/tabs
if ( $existing_options ) {
$new_options = array_merge( $existing_options, $new_options );
}
update_option( 'addtoany_options', $new_options );
?>
<div class="updated"><p><?php _e( 'Settings saved.', 'add-to-any' ); ?></p></div>
<?php
} else if ( isset( $_POST['Reset'] ) ) {
// Nonce verification
check_admin_referer( 'add-to-any-update-options' );
delete_option( 'addtoany_options' );
}
$options = stripslashes_deep( get_option( 'addtoany_options', array() ) );
// XTEC ************ AFEGIT - Define default values. The xtecblocs users default other options
// 2016.03.16 @sarjona
// 2016.06.02 @xavinieto
if( is_xtec_super_admin() ){
if (!isset($options['display_in_posts_on_front_page'])) {
$options['display_in_posts_on_front_page'] = -1;
}
if (!isset($options['display_in_posts_on_archive_pages'])) {
$options['display_in_posts_on_archive_pages'] = -1;
}
}
if (!isset($options['display_in_feed'])) {
$options['display_in_feed'] = -1;
}
if (!isset($options['display_in_excerpts'])) {
$options['display_in_excerpts'] = -1;
}
if (!isset($options['display_in_pages'])) {
$options['display_in_pages'] = -1;
}
//************ FI
?>
<div class="wrap">
<h1><?php _e( 'AddToAny Share Settings', 'add-to-any' ); ?></h1>
<h2 class="nav-tab-wrapper">
<!--
// XTEC ************ AFEGIT - Hide Floating Tab
// 2015.09.22 @nacho
-->
<?php if ( is_xtec_super_admin() ) { ?>
<!--
//************ FI
-->
<a href="<?php echo admin_url( 'options-general.php?page=addtoany' ); ?>" class="nav-tab<?php if ( 'default' == $current_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Standard', 'add-to-any' ); ?></a>
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'floating' ), admin_url( 'options-general.php?page=addtoany' ) ) ); ?>" class="nav-tab<?php if ( 'floating' == $current_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Floating', 'add-to-any' ); ?></a>
<!--
// XTEC ************ AFEGIT - Hide Floating Tab
// 2015.09.22 @nacho
-->
<?php }?>
<!--
//************ FI
-->
</h2>
<form id="addtoany_admin_form" method="post" action="">
<?php wp_nonce_field('add-to-any-update-options'); ?>
<table class="form-table">
<?php if ( 'default' == $current_screen ) : ?>
<tr valign="top">
<th scope="row"><?php _e("Icon Style", 'add-to-any'); ?></th>
<td><fieldset>
<label><input class="small-text" name="A2A_SHARE_SAVE_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php echo ! empty( $options['icon_size'] ) ? esc_attr( $options['icon_size'] ) : '32'; ?>"><?php esc_html_e( ' pixels', 'add-to-any' ); ?></label>
<br>
<label>
<select class="addtoany_icon_color" name="A2A_SHARE_SAVE_icon_bg">
<option value="original"<?php _a2a_selected_attr('original', 'icon_bg', $options); ?>><?php esc_html_e( 'Original', 'add-to-any' ); ?></option>
<option value="transparent"<?php _a2a_selected_attr('transparent', 'icon_bg', $options); ?>><?php esc_html_e( 'Transparent', 'add-to-any' ); ?></option>
<option value="custom"<?php _a2a_selected_attr('custom', 'icon_bg', $options); ?>><?php esc_html_e( 'Custom…', 'add-to-any' ); ?></option>
</select>
<?php esc_html_e( 'background', 'add-to-any' ); ?>
</label>
<div class="color-field-container"><input name="A2A_SHARE_SAVE_icon_bg_color" class="color-field" type="text" value="<?php echo ! empty( $options['icon_bg_color'] ) ? esc_attr( $options['icon_bg_color'] ) : '#2a2a2a'; ?>" data-default-color="#2a2a2a"></div>
<br>
<label>
<select class="addtoany_icon_color" name="A2A_SHARE_SAVE_icon_fg">
<option value="original"<?php _a2a_selected_attr('original', 'icon_fg', $options); ?>><?php esc_html_e( 'Original', 'add-to-any' ); ?></option>
<option value="transparent" disabled="disabled"><?php esc_html_e( 'Transparent', 'add-to-any' ); ?></option>
<option value="custom"<?php _a2a_selected_attr('custom', 'icon_fg', $options); ?>><?php esc_html_e( 'Custom…', 'add-to-any' ); ?></option>
</select>
<?php esc_html_e( 'foreground', 'add-to-any' ); ?>
</label>
<div class="color-field-container"><input name="A2A_SHARE_SAVE_icon_fg_color" class="color-field" type="text" value="<?php echo ! empty( $options['icon_fg_color'] ) ? esc_attr( $options['icon_fg_color'] ) : '#ffffff'; ?>" data-default-color="#ffffff"></div>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e("Share Buttons", 'add-to-any'); ?></th>
<td><fieldset>
<ul id="addtoany_services_sortable" class="addtoany_admin_list addtoany_override">
<li class="dummy"><img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ); ?>/icons/transparent.gif" width="32" height="32" alt="" /></li>
</ul>
<p id="addtoany_services_info"><?php _e("Choose the services you want below. Click a chosen service again to remove. Reorder services by dragging and dropping as they appear above.", 'add-to-any'); ?></p>
<ul id="addtoany_services_selectable" class="addtoany_admin_list">
<?php
// Show all services
foreach ($A2A_SHARE_SAVE_services as $service_safe_name=>$site) {
if ( isset( $site['href'] ) )
$custom_service = true;
else
$custom_service = false;
if ( ! isset( $site['icon'] ) )
$site['icon'] = 'default';
$is_special_service = in_array( $service_safe_name, array( 'pinterest', 'reddit', 'tumblr', ) );
?>
<li data-addtoany-icon-name="<?php echo esc_attr( $site['icon'] ); ?>"<?php if ( $is_special_service ) echo ' class="addtoany_special_service"'; ?> id="a2a_wp_<?php echo esc_attr( $service_safe_name ); ?>" title="<?php echo esc_attr( $site['name'] ); ?>">
<img src="<?php echo esc_attr( isset( $site['icon_url'] ) ? $site['icon_url'] : $A2A_SHARE_SAVE_plugin_url.'/icons/'.$site['icon'].'.svg' ); ?>" width="<?php echo isset( $site['icon_width'] ) ? esc_attr( $site['icon_width'] ) : '24'; ?>" height="<?php echo isset( $site['icon_height'] ) ? esc_attr( $site['icon_height'] ) : '24'; ?>"<?php if ( isset( $site['color'] ) ) : ?> style="background-color:#<?php echo esc_attr( $site['color'] ); endif; ?>"><?php echo esc_html( $site['name'] ); ?>
</li>
<?php
} ?>
<li style="clear:left" id="a2a_wp_facebook_like" class="addtoany_special_service addtoany_3p_button" title="Facebook Like button">
<img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ).'/icons/facebook_like_2x.png'; ?>" width="101" height="40" alt="Facebook Like" />
</li>
<li id="a2a_wp_twitter_tweet" class="addtoany_special_service addtoany_3p_button" title="Twitter Tweet button">
<img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ).'/icons/twitter_tweet_2x.png'; ?>" width="122" height="40" alt="Twitter Tweet" />
</li>
<li id="a2a_wp_pinterest_pin" class="addtoany_special_service addtoany_3p_button" title="Pinterest Save button">
<img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ).'/icons/pinterest_pin_2x.png'; ?>" width="80" height="40" alt="Pinterest Save" />
</li>
</ul>
<div id="addtoany_services_tip">
<p style="line-height:0">
<img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ); ?>/icons/instagram.svg" width="24" height="24" style="margin-right:8px">
<img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ); ?>/icons/threads.svg" width="24" height="24" style="margin-right:8px">
<img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ); ?>/icons/tiktok.svg" width="24" height="24" style="margin-right:8px">
<img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ); ?>/icons/youtube.svg" width="24" height="24" style="margin-right:8px">
<img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ); ?>/icons/discord.svg" width="24" height="24" style="margin-right:8px">
<img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ); ?>/icons/snapchat.svg" width="24" height="24">
</p>
<p>You can setup Instagram, YouTube, Snapchat, and other buttons in an AddToAny Follow widget.</p><p>Add the "AddToAny Follow" widget in <a href="customize.php?autofocus[panel]=widgets&return=options-general.php%3Fpage%3Daddtoany">Customize</a> or <a href="widgets.php">Widgets</a>.</p>
</div>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e("Universal Button", 'add-to-any'); ?></th>
<td><fieldset id="addtoany_extra_section_universal_button" class="addtoany_extra_section">
<div class="addtoany_extra_element addtoany_icon_size_large">
<label class="addtoany_override a2a_kit_size_32">
<input name="A2A_SHARE_SAVE_button" value="A2A_SVG_32" type="radio"<?php if ( ! isset( $options['button'] ) || 'A2A_SVG_32' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
<img src="<?php echo esc_url( $A2A_SHARE_SAVE_plugin_url ).'/icons/a2a.svg'; ?>" width="32" height="32" alt="AddToAny" onclick="this.parentNode.firstChild.checked=true" />
</label>
<br>
</div>
<div class="addtoany_extra_element">
<label>
<input name="A2A_SHARE_SAVE_button" value="CUSTOM" id="A2A_SHARE_SAVE_button_is_custom" type="radio"<?php if ( isset( $options['button'] ) && 'CUSTOM' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
<span style="margin:0 9px;vertical-align:middle"><?php _e('Image URL', 'add-to-any'); ?>:</span>
</label>
<input name="A2A_SHARE_SAVE_button_custom" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_custom').checked=true" style="vertical-align:middle" value="<?php if ( isset( $options['button_custom'] ) ) echo esc_attr( $options['button_custom'] ); ?>" />
</div>
<div class="addtoany_extra_element">
<label>
<input name="A2A_SHARE_SAVE_button" value="TEXT" id="A2A_SHARE_SAVE_button_is_text" type="radio"<?php if ( isset( $options['button'] ) && 'TEXT' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
<span style="margin:0 9px;vertical-align:middle"><?php _e('Text only', 'add-to-any'); ?>:</span>
</label>
<input name="A2A_SHARE_SAVE_button_text" type="text" class="code" size="50" onclick="document.getElementById('A2A_SHARE_SAVE_button_is_text').checked=true" style="vertical-align:middle;width:150px" value="<?php echo ( isset( $options['button_text'] ) && trim( '' != $options['button_text'] ) ) ? esc_attr( $options['button_text'] ) : __('Share','add-to-any'); ?>" />
</div>
<div class="addtoany_extra_element">
<label>
<input name="A2A_SHARE_SAVE_button" value="NONE" type="radio"<?php if ( isset( $options['button'] ) && 'NONE' == $options['button'] ) echo ' checked="checked"'; ?> onclick="return confirm('<?php _e('This option will disable universal sharing. Are you sure you want to disable universal sharing?', 'add-to-any' ) ?>')" style="margin:9px 0;vertical-align:middle">
<span style="margin:0 9px;vertical-align:middle"><?php _e('None', 'add-to-any'); ?></span>
</label>
</div>
<div class="addtoany_extra_element">
<label>
<input id="A2A_SHARE_SAVE_button_show_count" name="A2A_SHARE_SAVE_button_show_count" type="checkbox"<?php
if ( isset( $options['button_show_count'] ) && $options['button_show_count'] == '1' ) echo ' checked="checked"'; ?> value="1">
<!--
// XTEC ************ MODIFICAT - Added language translation
// 2015.09.23 @nacho
-->
<span style="margin-left:5px"><?php _e('Show count', 'add-to-any'); ?></span>
<!--
//************ ORIGINAL
<span style="margin-left:5px"><?php esc_html_e( 'Show count', 'add-to-any' ); ?></span>
//************ FI
-->
</label>
</div>
</fieldset></td>
</tr>
<!--
// XTEC ************ AFEGIT - Only show options for xtecadmin
// 2016.06.02 @xavinieto
-->
<?php if ( is_xtec_super_admin() ) { ?>
<!--
//************ FI
-->
<tr valign="top">
<th scope="row"><?php _e('Sharing Header', 'add-to-any'); ?></th>
<td><fieldset id="addtoany_extra_section_sharing_header" class="addtoany_extra_section<?php if ( ! empty( $options['header'] ) ) echo ' addtoany_show_extra'; ?>" role="region">
<label>
<!--
// XTEC ************ MODIFICAT - Added language translation
// 2015.09.23 @nacho
-->
<input name="A2A_SHARE_SAVE_header" type="text" class="code" placeholder="<?php esc_attr_e( __('Share this:', 'add-to-any' ) ); ?>" size="50" value="<?php if ( isset( $options['header'] ) ) echo esc_attr( stripslashes( $options['header'] ) ); ?>" />
<!--
//************ ORIGINAL
<input name="A2A_SHARE_SAVE_header" type="text" class="code" placeholder="<?php esc_attr_e( 'Share this:', 'add-to-any' ); ?>" size="50" value="<?php if ( isset( $options['header'] ) ) echo esc_attr( $options['header'] ); ?>"<?php _a2a_disabled_attr(); ?>>
//************ FI
-->
</label>
</fieldset></td>
</tr>
<!--
// XTEC ************ AFEGIT - Only show options for xtecadmin
// 2016.06.02 @xavinieto
-->
<?php } ?>
<!--
//************ FI
-->
<tr valign="top">
<th scope="row"><?php _e('Placement', 'add-to-any'); ?></th>
<td><fieldset>
<label>
<input id="A2A_SHARE_SAVE_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts" type="checkbox"<?php
if ( ! isset( $options['display_in_posts'] ) || $options['display_in_posts'] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
<?php printf( __( 'Display at the %s of posts', 'add-to-any' ), _a2a_position_in_content( $options, true ) ); ?>
</label>
<br/>
<label>
<input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts_on_front_page" type="checkbox"<?php
if ( ! isset( $options['display_in_posts_on_front_page'] ) || $options['display_in_posts_on_front_page'] != '-1' ) echo ' checked="checked"';
if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
?> value="1"/>
<?php printf( __( 'Display at the %s of posts on the front page', 'add-to-any' ), _a2a_position_in_content( $options ) ); ?>
</label>
<br/>
<label>
<input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts_on_archive_pages" type="checkbox"<?php
if ( ! isset( $options['display_in_posts_on_archive_pages'] ) || $options['display_in_posts_on_archive_pages'] != '-1' ) echo ' checked="checked"';
if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
?> value="1"/>
<?php printf( __( 'Display at the %s of posts on archive pages', 'add-to-any' ), _a2a_position_in_content( $options ) ); ?>
</label>
<!--
// XTEC ************ AFEGIT - Only show options for xtecadmin
// 2016.06.02 @xavinieto
-->
<?php if ( is_xtec_super_admin() ) { ?>
<!--
//************ FI
-->
<br/>
<label>
<input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_feed" type="checkbox"<?php
if ( ! isset( $options['display_in_feed'] ) || $options['display_in_feed'] != '-1' ) echo ' checked="checked"';
if ( isset( $options['display_in_posts'] ) && $options['display_in_posts'] == '-1' ) echo ' disabled="disabled"';
?> value="1"/>
<?php printf( __( 'Display at the %s of posts in the feed', 'add-to-any' ), _a2a_position_in_content( $options ) ); ?>
</label>
<br/>
<label>
<input name="A2A_SHARE_SAVE_display_in_excerpts" type="checkbox"<?php
if ( ! isset( $options['display_in_excerpts'] ) || $options['display_in_excerpts'] != '-1' ) echo ' checked="checked"';
?> value="1"/>
<?php printf( __( 'Display at the %s of excerpts' , 'add-to-any'), _a2a_position_in_content( $options, false ) ); ?>
</label>
<!--
// XTEC ************ AFEGIT - Only show options for xtecadmin
// 2016.06.02 @xavinieto
-->
<?php } ?>
<!--
//************ FI
-->
<br/>
<label>
<input name="A2A_SHARE_SAVE_display_in_pages" type="checkbox"<?php if ( ! isset( $options['display_in_pages'] ) || $options['display_in_pages'] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
<?php printf( __( 'Display at the %s of pages', 'add-to-any' ), _a2a_position_in_content( $options, false ) ); ?>
</label>
<br/>
<!--
// XTEC ************ AFEGIT - Only show options for xtecadmin
// 2016.06.02 @xavinieto
-->
<?php if ( is_xtec_super_admin() ) { ?>
<!--
//************ FI
-->
<label>
<input name="A2A_SHARE_SAVE_display_in_attachments" type="checkbox"<?php
if ( ! isset( $options['display_in_attachments'] ) || $options['display_in_attachments'] != '-1' ) echo ' checked="checked"';
?> value="1"/>
<?php printf( __( 'Display at the %s of media pages', 'add-to-any' ), _a2a_position_in_content( $options, false ) ); ?>
</label>
<?php
$custom_post_types = array_values( get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' ) );
foreach ( $custom_post_types as $custom_post_type_obj ) :
$placement_label = $custom_post_type_obj->labels->name;
$placement_name = $custom_post_type_obj->name;
?>
<br/>
<!--
// XTEC ************ MODIFICAT - Unmark by default options "Display at the XXX of Forums/Themes/Answers/Documents/Google Calendars"
// 2015.09.23 @nacho
-->
<label>
<input name="A2A_SHARE_SAVE_display_in_cpt_<?php echo $placement_name; ?>" type="checkbox" value="1" />
<?php printf(
/* translators: 1: Position in content 2: Name of the custom post type */
__( 'Display at the %1$s of %2$s', 'add-to-any' ),
_a2a_position_in_content( $options, false ),
esc_html( $placement_label )
); ?>
</label>
<!--
//************ ORIGINAL (Added extra comment in PHP)
<label>
<input name="A2A_SHARE_SAVE_display_in_cpt_<?php echo esc_attr( $placement_name ); ?>" type="checkbox"<?php if ( ! isset( $options['display_in_cpt_' . $placement_name] ) || $options['display_in_cpt_' . $placement_name] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
<?php // printf(
/* translators: 1: Position in content 2: Name of the custom post type */
/* __( 'Display at the %1$s of %2$s', 'add-to-any' ),
_a2a_position_in_content( $options, false ),
esc_html( $placement_label )
); */ ?>
</label>
//************ FI
-->
<?php endforeach; ?>
<br/><br/>
<div class="setting-description">
<?php _e("See <a href=\"widgets.php\" title=\"Theme Widgets\">Widgets</a> and <a href=\"options-general.php?page=addtoany&action=floating\" title=\"AddToAny Floating Share Buttons\">Floating</a> for additional placement options. For advanced placement, see <a href=\"https://wordpress.org/plugins/add-to-any/faq/\">the FAQs</a>.", 'add-to-any'); ?>
</div>
<!--
// XTEC ************ AFEGIT - Only show options for xtecadmin
// 2016.06.02 @xavinieto
-->
<?php } ?>
<!--
//************ FI
-->
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Additional JavaScript', 'add-to-any'); ?></th>
<td><fieldset id="addtoany_extra_section_additional_javascript" class="addtoany_extra_section" role="region">
<label for="A2A_SHARE_SAVE_additional_js_variables">
<p><?php _e('Below you can add special JavaScript code for AddToAny.', 'add-to-any'); ?>
<?php _e("Advanced users should explore AddToAny's <a href=\"https://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", 'add-to-any'); ?></p>
</label>
<p>
<textarea name="A2A_SHARE_SAVE_additional_js_variables" id="A2A_SHARE_SAVE_additional_js_variables" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"<?php _a2a_disabled_attr(); ?>><?php if ( isset( $options['additional_js_variables'] ) ) echo esc_textarea( $options['additional_js_variables'] ); ?></textarea>
</p>
</fieldset></td>
</tr>
<!--
// XTEC ************ MODIFICAT - Only show options for xtecadmin
// 2016.06.02 @xavinieto
// 2020.05.07 @aginard
-->
<?php if ( !is_xtec_super_admin() ) { ?>
<tr valign="top" style="display: none" >
<?php } else { ?>
<tr valign="top">
<?php } ?>
<!--
//************ ORIGINAL (Added extra comment in PHP)
<tr valign="top">
//************ FI
-->
<th scope="row"><?php _e('Additional CSS', 'add-to-any'); ?></th>
<td><fieldset id="addtoany_extra_section_additional_css" class="addtoany_extra_section" role="region">
<label for="A2A_SHARE_SAVE_additional_css">
<p><?php _e('Below you can add special CSS code for AddToAny.', 'add-to-any'); ?>
<?php _e("Advanced users should explore AddToAny's <a href=\"https://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", 'add-to-any'); ?></p>
</label>
<p>
<textarea name="A2A_SHARE_SAVE_additional_css" id="A2A_SHARE_SAVE_additional_css" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"<?php _a2a_disabled_attr(); ?>><?php if ( isset( $options['additional_css'] ) ) echo esc_textarea( $options['additional_css'] ); ?></textarea>
</p>
</fieldset></td>
</tr>
<!--
// XTEC ************ AFEGIT - Only show options for xtecadmin
// 2016.06.02 @xavinieto
-->
<?php if ( is_xtec_super_admin() ) { ?>
<!--
//************ FI
-->
<tr valign="top">
<th scope="row"><?php _e('Advanced Options', 'add-to-any'); ?></th>
<td><fieldset id="addtoany_extra_section_advanced_options" class="addtoany_extra_section" role="region">
<div class="addtoany_extra_element">
<label for="A2A_SHARE_SAVE_custom_icons">
<input name="A2A_SHARE_SAVE_custom_icons" id="A2A_SHARE_SAVE_custom_icons" type="checkbox"<?php if ( isset( $options['custom_icons'] ) && $options['custom_icons'] == 'url' ) echo ' checked="checked"'; ?> value="url"/>
<?php _e('Use custom icons. URL:', 'add-to-any'); ?>
</label>
<input name="A2A_SHARE_SAVE_custom_icons_url" type="text" class="code" size="50" style="vertical-align:middle" placeholder="//example.com/blog/uploads/addtoany/icons/custom/" value="<?php if ( isset( $options['custom_icons_url'] ) ) echo esc_attr( $options['custom_icons_url'] ); ?>" />
<br/>
<label for="A2A_SHARE_SAVE_custom_icons_type"><?php _e('Filename extension', 'add-to-any'); ?></label>
<input name="A2A_SHARE_SAVE_custom_icons_type" type="text" class="code" size="5" maxlength="4" placeholder="png" value="<?php if ( isset( $options['custom_icons_type'] ) ) echo esc_attr( $options['custom_icons_type'] ); else echo 'png'; ?>" />
<label for="A2A_SHARE_SAVE_custom_icons_width"><?php _e('Width', 'add-to-any'); ?></label>
<input name="A2A_SHARE_SAVE_custom_icons_width" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" id="A2A_SHARE_SAVE_custom_icons_width" value="<?php if ( isset( $options['custom_icons_width'] ) ) echo esc_attr( $options['custom_icons_width'] ); ?>" class="small-text" />
<label for="A2A_SHARE_SAVE_custom_icons_height"><?php _e('Height', 'add-to-any'); ?></label>
<input name="A2A_SHARE_SAVE_custom_icons_height" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" id="A2A_SHARE_SAVE_custom_icons_height" value="<?php if ( isset( $options['custom_icons_height'] ) ) echo esc_attr( $options['custom_icons_height'] ); ?>" class="small-text" />
<p class="description">
<?php _e("Specify the URL of the directory containing your custom icons. For example, a URL of <code>//example.com/blog/uploads/addtoany/icons/custom/</code> containing <code>facebook.png</code> and <code>twitter.png</code>. Be sure that custom icon filenames match the icon filenames in <code>plugins/add-to-any/icons</code>. For AddToAny's Universal Button, select Image URL and specify the URL of your AddToAny universal share icon (<a href=\"#\" onclick=\"document.getElementsByName('A2A_SHARE_SAVE_button_custom')[0].focus();return false\">above</a>).", 'add-to-any'); ?>
</p>
<br>
</div>
<div class="addtoany_extra_element">
<label for="A2A_SHARE_SAVE_cache">
<input name="A2A_SHARE_SAVE_cache" id="A2A_SHARE_SAVE_cache" type="checkbox"<?php if ( isset( $options['cache'] ) && $options['cache'] == '1' ) echo ' checked="checked"'; ?> value="1"/>
<?php _e('Cache AddToAny locally with daily cache updates', 'add-to-any'); ?>
</label>
<p class="description">
<?php _e("Most sites should not use this option. By default, AddToAny loads asynchronously and most efficiently. Since many visitors will have AddToAny cached in their browser already, serving AddToAny locally from your site will be slower for those visitors. If local caching is enabled, be sure to set far future cache/expires headers for image files in your <code>uploads/addtoany</code> directory.", 'add-to-any'); ?>
</p>
<br>
</div>
</fieldset></td>
</tr>
<!--
// XTEC ************ AFEGIT - Only show options for xtecadmin
// 2016.06.02 @xavinieto
-->
<?php } else { ?>
<?php } ?>
<!--
//************ FI
-->
<?php endif; ?>
</table>
<?php if ( 'floating' == $current_screen ) : ?>
<p><?php _e('AddToAny "floating" share buttons stay in a fixed position even when the user scrolls.', 'add-to-any'); ?></p>
<h3><?php _e('Vertical Buttons', 'add-to-any'); ?></h3>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e("Placement", 'add-to-any'); ?></th>
<td><fieldset>
<label><input type="radio" name="A2A_SHARE_SAVE_floating_vertical" value="left_docked"<?php if ( isset( $options['floating_vertical'] ) && 'left_docked' == $options['floating_vertical'] ) echo ' checked="checked"'; ?>> <?php _e('Left docked', 'add-to-any'); ?></label>
<br>
<label><input type="radio" name="A2A_SHARE_SAVE_floating_vertical" value="right_docked"<?php if ( isset( $options['floating_vertical'] ) && 'right_docked' == $options['floating_vertical'] ) echo ' checked="checked"'; ?>> <?php _e('Right docked', 'add-to-any'); ?></label>
<br>
<label><input type="radio" name="A2A_SHARE_SAVE_floating_vertical" value="left_attached"<?php if ( isset( $options['floating_vertical'] ) && 'left_attached' == $options['floating_vertical'] ) echo ' checked="checked"'; ?>> <?php _e('Attach to content', 'add-to-any'); ?></label>
<br>
<label><input type="radio" name="A2A_SHARE_SAVE_floating_vertical" value="none"<?php if ( ! isset( $options['floating_vertical'] ) || 'none' == $options['floating_vertical'] ) echo ' checked="checked"'; ?>> <?php _e('None', 'add-to-any'); ?></label>
<div class="addtoany_floating_vertical_attached_to">
<br>
<label>
<?php esc_html_e( 'Attach to ', 'add-to-any' ); ?><input name="A2A_SHARE_SAVE_floating_vertical_attached_to" type="text" class="regular-text code" placeholder=".content-area" value="<?php if ( isset( $options['floating_vertical_attached_to'] ) ) echo esc_attr( $options['floating_vertical_attached_to'] ); else echo esc_attr( 'main, [role="main"], article, .status-publish' ); ?>" />
<p class="description"><?php printf(esc_html__( 'Enter a %1$sCSS selector%2$s, or group of selectors, that match the HTML element you want to attach to.', 'add-to-any' ),'<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors" class="description" rel="noopener" target="_blank">','</a>'); ?></p>
</label>
</div>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e("Responsiveness", 'add-to-any'); ?></th>
<td><fieldset>
<label>
<input id="A2A_SHARE_SAVE_floating_vertical_responsive" name="A2A_SHARE_SAVE_floating_vertical_responsive" type="checkbox"<?php
if ( ! isset( $options['floating_vertical_responsive'] ) || $options['floating_vertical_responsive'] != '-1' ) echo ' checked="checked"'; ?> value="1" />
<?php esc_html_e( 'Hide on mobile screens ', 'add-to-any' ); ?><input name="A2A_SHARE_SAVE_floating_vertical_responsive_max_width" type="number" value="<?php if ( isset( $options['floating_vertical_responsive_max_width'] ) ) echo esc_attr( $options['floating_vertical_responsive_max_width'] ); else echo '980'; ?>" class="small-text" /><?php esc_html_e( ' pixels or narrower', 'add-to-any' ); ?>
</label>
<br>
<label>
<input id="A2A_SHARE_SAVE_floating_vertical_scroll_top" name="A2A_SHARE_SAVE_floating_vertical_scroll_top" type="checkbox"<?php
if ( ! empty( $options['floating_vertical_scroll_top'] ) && $options['floating_vertical_scroll_top'] == '1' ) echo ' checked="checked"'; ?> value="1" />
<?php esc_html_e( 'Hide until page is scrolled ', 'add-to-any' ); ?><input name="A2A_SHARE_SAVE_floating_vertical_scroll_top_pixels" type="number" value="<?php if ( isset( $options['floating_vertical_scroll_top_pixels'] ) ) echo esc_attr( $options['floating_vertical_scroll_top_pixels'] ); else echo '100'; ?>" class="small-text" /><?php esc_html_e( ' pixels or more from the top', 'add-to-any' ); ?>
</label>
<br>
<label>
<input id="A2A_SHARE_SAVE_floating_vertical_scroll_bottom" name="A2A_SHARE_SAVE_floating_vertical_scroll_bottom" type="checkbox"<?php
if ( ! empty( $options['floating_vertical_scroll_bottom'] ) && $options['floating_vertical_scroll_bottom'] == '1' ) echo ' checked="checked"'; ?> value="1" />
<?php esc_html_e( 'Hide when page is scrolled ', 'add-to-any' ); ?><input name="A2A_SHARE_SAVE_floating_vertical_scroll_bottom_pixels" type="number" value="<?php if ( isset( $options['floating_vertical_scroll_bottom_pixels'] ) ) echo esc_attr( $options['floating_vertical_scroll_bottom_pixels'] ); else echo '100'; ?>" class="small-text" /><?php esc_html_e( ' pixels or less from the bottom', 'add-to-any' ); ?>
</label>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e("Position", 'add-to-any'); ?></th>
<td><fieldset>
<label><input name="A2A_SHARE_SAVE_floating_vertical_position" type="number" value="<?php if ( isset( $options['floating_vertical_position'] ) ) echo esc_attr( $options['floating_vertical_position'] ); else echo '100'; ?>" class="small-text" /><?php esc_html_e( ' pixels from top', 'add-to-any' ); ?></label>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e("Offset", 'add-to-any'); ?></th>
<td><fieldset>
<label><input name="A2A_SHARE_SAVE_floating_vertical_offset" type="number" value="<?php if ( isset( $options['floating_vertical_offset'] ) ) echo esc_attr( $options['floating_vertical_offset'] ); else echo '0'; ?>" class="small-text" /><span id="addtoany_vertical_offset_text"><?php esc_html_e( ' pixels from left or right', 'add-to-any' ); ?></span></label>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e("Icon Size", 'add-to-any'); ?></th>
<td><fieldset>
<label><input name="A2A_SHARE_SAVE_floating_vertical_icon_size" type="number" max="300" min="10" maxlength="3" step="2" oninput="if(this.value.length > 3) this.value=this.value.slice(0, 3)" placeholder="32" value="<?php if ( isset( $options['floating_vertical_icon_size'] ) ) echo esc_attr( $options['floating_vertical_icon_size'] ); else echo '32'; ?>" class="small-text"><?php esc_html_e( ' pixels', 'add-to-any' ); ?></label>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Background', 'add-to-any'); ?></th>
<td><fieldset>
<label>
<select class="addtoany_icon_color" name="A2A_SHARE_SAVE_floating_vertical_bg">
<option value="transparent"<?php _a2a_selected_attr('transparent', 'floating_vertical_bg', $options); ?>><?php esc_html_e( 'Transparent', 'add-to-any' ); ?></option>
<option value="custom"<?php _a2a_selected_attr('custom', 'floating_vertical_bg', $options); ?>><?php esc_html_e( 'Custom…', 'add-to-any' ); ?></option>
</select>
</label>
<div class="color-field-container"><input name="A2A_SHARE_SAVE_floating_vertical_bg_color" class="color-field" type="text" value="<?php echo ! empty( $options['floating_vertical_bg_color'] ) ? esc_attr( $options['floating_vertical_bg_color'] ) : '#ffffff'; ?>" data-default-color="#ffffff"></div>
</fieldset></td>
</tr>
</table>
<h3><?php _e('Horizontal Buttons', 'add-to-any'); ?></h3>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e("Placement", 'add-to-any'); ?></th>
<td><fieldset>
<label><input type="radio" name="A2A_SHARE_SAVE_floating_horizontal" value="left_docked"<?php if ( isset( $options['floating_horizontal'] ) && 'left_docked' == $options['floating_horizontal'] ) echo ' checked="checked"'; ?>> <?php _e('Left docked', 'add-to-any'); ?></label>
<br>
<label><input type="radio" name="A2A_SHARE_SAVE_floating_horizontal" value="right_docked"<?php if ( isset( $options['floating_horizontal'] ) && 'right_docked' == $options['floating_horizontal'] ) echo ' checked="checked"'; ?>> <?php _e('Right docked', 'add-to-any'); ?></label>
<br>
<label><input type="radio" name="A2A_SHARE_SAVE_floating_horizontal" value="center_docked"<?php if ( isset( $options['floating_horizontal'] ) && 'center_docked' == $options['floating_horizontal'] ) echo ' checked="checked"'; ?>> <?php _e('Center docked', 'add-to-any'); ?></label>
<br>
<label><input type="radio" name="A2A_SHARE_SAVE_floating_horizontal" value="none"<?php if ( ! isset( $options['floating_horizontal'] ) || 'none' == $options['floating_horizontal'] ) echo ' checked="checked"'; ?>> <?php _e('None', 'add-to-any'); ?></label>
</fieldset></td>
</tr>