PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 3.2.1
Wp Social Login and Register Social Counter v3.2.1
3.2.1 trunk 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.2 1.3.3 1.3.4 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.4 1.4.5 1.4.6 1.4.8 1.4.9 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.8 2.2.9 3.0.0 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0
wp-social / helper / social-share-style.php
wp-social / helper Last commit date
helper.php 1 week ago share-style-settings.php 3 years ago social-share-style.php 1 week ago user-helper.php 3 years ago view-helper.php 1 week ago
social-share-style.php
88 lines
1 <?php
2 defined('ABSPATH') || exit;
3 function wp_social_share_style_settings( $post_type, $post ){
4 add_meta_box( 'wp-social-plugin', esc_html__('WP Social Share Style Settings', 'wp-social'), 'social_share_style_markup', 'post', 'normal', 'high' );
5
6 function social_share_style_markup(){
7 // $post is already set, and contains an object: the WordPress post
8 global $post;
9 $values = get_post_custom( $post->ID );
10 $check = isset( $values['social_share_style'] ) ? esc_attr( $values['social_share_style'][0] ) : 'global';
11 // We'll use this nonce field later on when saving.
12 wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );
13
14 ?>
15 <ul>
16 <li>
17 <strong><?php esc_html_e('Choose where to show share buttons.', 'wp-social'); ?></strong>
18 </li>
19 <li>
20 <input type="radio" id="social_share_global" name="social_share_style" value="global"
21 <?php checked( $check, 'global') ?>
22 />
23 <label for="social_share_global"><?php esc_html_e('Global Setting', 'wp-social'); ?></label>
24 </li>
25
26 <li>
27 <input type="radio" id="social_share_after_content" name="social_share_style" value="after_content"
28 <?php checked( $check, 'after_content') ?>
29
30 />
31 <label for="social_share_after_content"><?php esc_html_e('After Content', 'wp-social'); ?></label>
32 </li>
33
34 <li>
35 <input type="radio" id="social_share_before_content" name="social_share_style" value="before_content"
36 <?php checked( $check, 'before_content') ?>
37 />
38 <label for="social_share_before_content"><?php esc_html_e('Before Content', 'wp-social'); ?></label>
39 </li>
40
41 <li>
42 <input type="radio" id="social_share_both" name="social_share_style" value="both_content"
43 <?php checked( $check, 'both_content') ?>
44 />
45 <label for="social_share_both"><?php esc_html_e('Both', 'wp-social'); ?></label>
46 </li>
47
48 <li>
49 <input type="radio" id="social_share_disable" name="social_share_style" value="no_content"
50 <?php checked( $check, 'no_content') ?>
51 />
52 <label for="social_share_disable"><?php esc_html_e('Disable', 'wp-social'); ?></label>
53 </li>
54 </ul>
55
56 <?php
57 }
58
59
60 }
61
62 add_action( 'add_meta_boxes', 'wp_social_share_style_settings', 10, 2 );
63 /*
64 -------------------------
65 Save data
66 -------------------------
67 */
68
69 function wp_social_share_save( $post_id ){
70
71 // Bail if we're doing an auto save
72 if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
73
74 // if our nonce isn't there, or we can't verify it, bail
75 if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;
76
77 // if our current user can't edit this post, bail
78 if( !current_user_can( 'edit_post' ) ) return;
79
80 if( isset( $_POST['social_share_style'] ) ){
81 update_post_meta( $post_id, 'social_share_style', sanitize_text_field( $_POST['social_share_style'] ) );
82 }else{
83 update_post_meta( $post_id, 'social_share_style', esc_attr( 'global' ) );
84 }
85 }
86 add_action( 'save_post', 'wp_social_share_save');
87
88