Simple Author Box - Version 2.1.3

Version Description

  • Fixed error on footer.
  • Fixed profile image in dashboard ( https://github.com/MachoThemes/simple-author-box/issues/97 )
  • Fixed profile image in comments ( https://github.com/MachoThemes/simple-author-box/issues/96 )
Download this release

Release Info

Developer machothemes
Plugin Icon 128x128 Simple Author Box
Version 2.1.3
Comparing to
See all releases

Code changes from version 2.1.1 to 2.1.3

assets/css/sabox.css CHANGED
@@ -6,6 +6,5 @@
6
  opacity: 1;
7
  }
8
  img.sab-custom-avatar {
9
- max-width: 96px;
10
- max-height: 96px;
11
  }
6
  opacity: 1;
7
  }
8
  img.sab-custom-avatar {
9
+ height: auto;
 
10
  }
assets/css/sabox.min.css CHANGED
@@ -1 +1 @@
1
- #adminmenu #toplevel_page_simple-author-box-options .wp-menu-image img{height:18px;padding-top:8px}#adminmenu #toplevel_page_simple-author-box-options.current .wp-menu-image img{opacity:1}img.sab-custom-avatar{max-width:96px;max-height:96px}
1
+ #adminmenu #toplevel_page_simple-author-box-options .wp-menu-image img{height:18px;padding-top:8px}#adminmenu #toplevel_page_simple-author-box-options.current .wp-menu-image img{opacity:1}img.sab-custom-avatar{height: auto;}
assets/js/sabox-admin.js CHANGED
@@ -1,134 +1,134 @@
1
- ( function( $ ) {
2
-
3
- 'use strict';
4
- var context = $( '#sabox-container' );
5
- context.find( '.saboxfield' ).on( 'change', function() {
6
- var value = getElementValue( $( this ) );
7
- var elements = context.find( '.show_if_' + $( this ).attr( 'id' ) );
8
-
9
- if ( value && '0' != value ) {
10
- elements.show( 300 );
11
- } else {
12
- elements.hide( 250 );
13
- }
14
- });
15
-
16
- function getElementValue( $element ) {
17
- var type = $element.attr( 'type' );
18
- var name = $element.attr( 'name' );
19
-
20
- if ( 'checkbox' === type ) {
21
- if ( $element.is( ':checked' ) ) {
22
- return 1;
23
- } else {
24
- return 0;
25
- }
26
- } else {
27
- return $element.val();
28
- }
29
- }
30
-
31
- /**
32
- * Handle UI tab switching via jQuery instead of relying on CSS only
33
- */
34
- function adminTabSwitching() {
35
-
36
- var navTabSelector = '.nav-tab-wrapper .epfw-tab:not( .epfw-tab-link )',
37
- initialTabHref,
38
- initialTabID,
39
- url;
40
-
41
- // Get the current tab
42
- if ( '' !== window.location.hash && $( window.location.hash + '-tab.epfw-turn-into-tab' ).length > 0 ) {
43
- initialTabHref = window.location.hash;
44
- } else {
45
- initialTabHref = $( navTabSelector + ':first' ).attr( 'href' );
46
- }
47
-
48
- initialTabID = initialTabHref + '-tab';
49
-
50
- /**
51
- * Default tab handling
52
- */
53
-
54
- // Make the first tab active by default
55
- $( navTabSelector + '[href="' + initialTabHref + '"]' ).addClass( 'nav-tab-active' );
56
-
57
- // Make all the tabs, except the first one hidden
58
- $( '.epfw-turn-into-tab' ).each( function( index, value ) {
59
- if ( '#' + $( this ).attr( 'id' ) !== initialTabID ) {
60
- $( this ).hide();
61
- }
62
- });
63
-
64
- /**
65
- * Listen for click events on nav-tab links
66
- */
67
- $( navTabSelector ).click( function( event ) {
68
-
69
- var clickedTab = $( this ).attr( 'href' ) + '-tab';
70
- $( navTabSelector ).removeClass( 'nav-tab-active' ); // Remove class from previous selector
71
- $( this ).addClass( 'nav-tab-active' ).blur(); // Add class to currently clicked selector
72
-
73
- $( '.epfw-turn-into-tab' ).each( function( index, value ) {
74
- if ( '#' + $( this ).attr( 'id' ) !== clickedTab ) {
75
- $( this ).hide();
76
- }
77
-
78
- $( clickedTab ).fadeIn();
79
-
80
- });
81
-
82
- });
83
- }
84
-
85
- $( document ).ready( function() {
86
- var elements = context.find( '.saboxfield' ),
87
- sliders = context.find( '.sabox-slider' ),
88
- colorpickers = context.find( '.sabox-color' );
89
-
90
- elements.each( function( $index, $element ) {
91
- var element = $( $element ),
92
- value = getElementValue( element ),
93
- elements = context.find( '.show_if_' + element.attr( 'id' ) );
94
- if ( value && '0' !== value ) {
95
- elements.removeClass( 'hide' );
96
- } else {
97
- elements.addClass( 'hide' );
98
- }
99
- });
100
- if ( sliders.length > 0 ) {
101
- sliders.each( function( $index, $slider ) {
102
- var input = $( $slider ).parent().find( '.saboxfield' ),
103
- max = input.data( 'max' ),
104
- min = input.data( 'min' ),
105
- step = input.data( 'step' ),
106
- value = parseInt( input.val(), 10 );
107
-
108
- $( $slider ).slider({
109
- value: value,
110
- min: min,
111
- max: max,
112
- step: step,
113
- slide: function( event, ui ) {
114
- input.val( ui.value + 'px' ).trigger( 'change' );
115
- }
116
- });
117
- });
118
- }
119
- if ( colorpickers.length > 0 ) {
120
- colorpickers.each( function( $index, $colorpicker ) {
121
- $( $colorpicker ).wpColorPicker({
122
- change : function( event, ui ){
123
- jQuery( event.target ).val( ui.color.toString() ).trigger( 'change' );
124
- }
125
- });
126
- });
127
- }
128
-
129
- adminTabSwitching();
130
-
131
- });
132
-
133
- })( jQuery );
134
-
1
+ ( function( $ ) {
2
+
3
+ 'use strict';
4
+ var context = $( '#sabox-container' );
5
+ context.find( '.saboxfield' ).on( 'change', function() {
6
+ var value = getElementValue( $( this ) );
7
+ var elements = context.find( '.show_if_' + $( this ).attr( 'id' ) );
8
+
9
+ if ( value && '0' != value ) {
10
+ elements.show( 300 );
11
+ } else {
12
+ elements.hide( 250 );
13
+ }
14
+ });
15
+
16
+ function getElementValue( $element ) {
17
+ var type = $element.attr( 'type' );
18
+ var name = $element.attr( 'name' );
19
+
20
+ if ( 'checkbox' === type ) {
21
+ if ( $element.is( ':checked' ) ) {
22
+ return 1;
23
+ } else {
24
+ return 0;
25
+ }
26
+ } else {
27
+ return $element.val();
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Handle UI tab switching via jQuery instead of relying on CSS only
33
+ */
34
+ function adminTabSwitching() {
35
+
36
+ var navTabSelector = '.nav-tab-wrapper .epfw-tab:not( .epfw-tab-link )',
37
+ initialTabHref,
38
+ initialTabID,
39
+ url;
40
+
41
+ // Get the current tab
42
+ if ( '' !== window.location.hash && $( window.location.hash + '-tab.epfw-turn-into-tab' ).length > 0 ) {
43
+ initialTabHref = window.location.hash;
44
+ } else {
45
+ initialTabHref = $( navTabSelector + ':first' ).attr( 'href' );
46
+ }
47
+
48
+ initialTabID = initialTabHref + '-tab';
49
+
50
+ /**
51
+ * Default tab handling
52
+ */
53
+
54
+ // Make the first tab active by default
55
+ $( navTabSelector + '[href="' + initialTabHref + '"]' ).addClass( 'nav-tab-active' );
56
+
57
+ // Make all the tabs, except the first one hidden
58
+ $( '.epfw-turn-into-tab' ).each( function( index, value ) {
59
+ if ( '#' + $( this ).attr( 'id' ) !== initialTabID ) {
60
+ $( this ).hide();
61
+ }
62
+ });
63
+
64
+ /**
65
+ * Listen for click events on nav-tab links
66
+ */
67
+ $( navTabSelector ).click( function( event ) {
68
+
69
+ var clickedTab = $( this ).attr( 'href' ) + '-tab';
70
+ $( navTabSelector ).removeClass( 'nav-tab-active' ); // Remove class from previous selector
71
+ $( this ).addClass( 'nav-tab-active' ).blur(); // Add class to currently clicked selector
72
+
73
+ $( '.epfw-turn-into-tab' ).each( function( index, value ) {
74
+ if ( '#' + $( this ).attr( 'id' ) !== clickedTab ) {
75
+ $( this ).hide();
76
+ }
77
+
78
+ $( clickedTab ).fadeIn();
79
+
80
+ });
81
+
82
+ });
83
+ }
84
+
85
+ $( document ).ready( function() {
86
+ var elements = context.find( '.saboxfield' ),
87
+ sliders = context.find( '.sabox-slider' ),
88
+ colorpickers = context.find( '.sabox-color' );
89
+
90
+ elements.each( function( $index, $element ) {
91
+ var element = $( $element ),
92
+ value = getElementValue( element ),
93
+ elements = context.find( '.show_if_' + element.attr( 'id' ) );
94
+ if ( value && '0' !== value ) {
95
+ elements.removeClass( 'hide' );
96
+ } else {
97
+ elements.addClass( 'hide' );
98
+ }
99
+ });
100
+ if ( sliders.length > 0 ) {
101
+ sliders.each( function( $index, $slider ) {
102
+ var input = $( $slider ).parent().find( '.saboxfield' ),
103
+ max = input.data( 'max' ),
104
+ min = input.data( 'min' ),
105
+ step = input.data( 'step' ),
106
+ value = parseInt( input.val(), 10 );
107
+
108
+ $( $slider ).slider({
109
+ value: value,
110
+ min: min,
111
+ max: max,
112
+ step: step,
113
+ slide: function( event, ui ) {
114
+ input.val( ui.value + 'px' ).trigger( 'change' );
115
+ }
116
+ });
117
+ });
118
+ }
119
+ if ( colorpickers.length > 0 ) {
120
+ colorpickers.each( function( $index, $colorpicker ) {
121
+ $( $colorpicker ).wpColorPicker({
122
+ change : function( event, ui ){
123
+ jQuery( event.target ).val( ui.color.toString() ).trigger( 'change' );
124
+ }
125
+ });
126
+ });
127
+ }
128
+
129
+ adminTabSwitching();
130
+
131
+ });
132
+
133
+ })( jQuery );
134
+
inc/class-simple-author-box-helper.php CHANGED
@@ -890,7 +890,7 @@ class Simple_Author_Box_Helper {
890
  ) );
891
 
892
  if ( 'saboxplugin_options' == $key ) {
893
-
894
  if ( ! isset( self::$options['saboxplugin_options'] ) ) {
895
  self::$options['saboxplugin_options'] = get_option( 'saboxplugin_options', array() );
896
  }
@@ -898,9 +898,9 @@ class Simple_Author_Box_Helper {
898
  return wp_parse_args( self::$options['saboxplugin_options'], $defaults['saboxplugin_options'] );
899
 
900
  } else {
901
-
902
  if ( isset( self::$options[ $key ] ) ) {
903
-
904
  return self::$options[ $key ];
905
 
906
  }else{
@@ -1022,7 +1022,7 @@ class Simple_Author_Box_Helper {
1022
  }
1023
 
1024
  // Author description font style
1025
- if ( '1' == $sabox_options['sab_desc_style'] ) {
1026
  $style .= '.saboxplugin-wrap .saboxplugin-desc {font-style:italic;}';
1027
  }
1028
  // Margin top & bottom, Padding
890
  ) );
891
 
892
  if ( 'saboxplugin_options' == $key ) {
893
+
894
  if ( ! isset( self::$options['saboxplugin_options'] ) ) {
895
  self::$options['saboxplugin_options'] = get_option( 'saboxplugin_options', array() );
896
  }
898
  return wp_parse_args( self::$options['saboxplugin_options'], $defaults['saboxplugin_options'] );
899
 
900
  } else {
901
+
902
  if ( isset( self::$options[ $key ] ) ) {
903
+
904
  return self::$options[ $key ];
905
 
906
  }else{
1022
  }
1023
 
1024
  // Author description font style
1025
+ if ( isset( $sabox_options['sab_desc_style'] ) && '1' == $sabox_options['sab_desc_style'] ) {
1026
  $style .= '.saboxplugin-wrap .saboxplugin-desc {font-style:italic;}';
1027
  }
1028
  // Margin top & bottom, Padding
inc/class-simple-author-box-user-profile.php CHANGED
@@ -1,162 +1,162 @@
1
- <?php
2
-
3
- class Simple_Author_Box_User_Profile {
4
-
5
- function __construct() {
6
-
7
- // Social Links
8
- add_action( 'show_user_profile', array( $this, 'add_social_area' ) );
9
- add_action( 'edit_user_profile', array( $this, 'add_social_area' ) );
10
-
11
- // Custom Profile Image
12
- add_action( 'show_user_profile', array( $this, 'add_profile_image' ), 9, 1 );
13
- add_action( 'edit_user_profile', array( $this, 'add_profile_image' ), 9, 1 );
14
-
15
- add_action( 'personal_options_update', array( $this, 'save_user_profile' ) );
16
- add_action( 'edit_user_profile_update', array( $this, 'save_user_profile' ) );
17
-
18
- // Allow HTML in user description.
19
- remove_filter( 'pre_user_description', 'wp_filter_kses' );
20
- add_filter( 'pre_user_description', 'wp_kses_post' );
21
-
22
- }
23
-
24
- public function add_social_area( $profileuser ) {
25
- $user_id = $profileuser->data->ID;
26
-
27
- $social_links = Simple_Author_Box_Helper::get_user_social_links( $user_id );
28
- $social_icons = apply_filters( 'sabox_social_icons', Simple_Author_Box_Helper::$social_icons );
29
- unset( $social_icons['user_email'] );
30
-
31
- ?>
32
- <div class="sab-user-profile-wrapper">
33
- <h2><?php _e( 'Social Media Links (Simple Author Box)', 'saboxplugin' ); ?></h2>
34
- <table class="form-table" id="sabox-social-table">
35
- <?php
36
-
37
- if ( ! empty( $social_links ) ) {
38
- foreach ( $social_links as $social_platform => $social_link ) {
39
- ?>
40
- <tr>
41
- <th>
42
- <span class="sabox-drag"></span>
43
- <select name="sabox-social-icons[]">
44
- <?php foreach ( $social_icons as $sabox_social_id => $sabox_social_name ) { ?>
45
- <option value="<?php echo $sabox_social_id; ?>" <?php selected( $sabox_social_id, $social_platform ); ?>><?php echo $sabox_social_name; ?></option>
46
- <?php } ?>
47
- </select>
48
- </th>
49
- <td>
50
- <input name="sabox-social-links[]" type="text" class="regular-text" value="<?php echo esc_url( $social_link ); ?>">
51
- <span class="dashicons dashicons-trash"></span>
52
- <td>
53
- </tr>
54
- <?php
55
- }
56
- } else {
57
- ?>
58
- <tr>
59
- <th>
60
- <span class="sabox-drag"></span>
61
- <select name="sabox-social-icons[]">
62
- <?php foreach ( $social_icons as $sabox_social_id => $sabox_social_name ) { ?>
63
- <option value="<?php echo $sabox_social_id; ?>"><?php echo $sabox_social_name; ?></option>
64
- <?php } ?>
65
- </select>
66
- </th>
67
- <td>
68
- <input name="sabox-social-links[]" type="text" class="regular-text" value="">
69
- <span class="dashicons dashicons-trash"></span>
70
- <td>
71
- </tr>
72
- <?php
73
- }
74
-
75
- ?>
76
-
77
- </table>
78
-
79
- <div class="sabox-add-social-link">
80
- <a href="#" class="button button-primary button-hero"></span><?php esc_html_e( '+ Add new social platform', 'saboxplugin' ); ?></a>
81
- </div>
82
- </div>
83
-
84
- <?php
85
- }
86
-
87
- public function add_profile_image( $user ) {
88
-
89
- if ( ! current_user_can( 'upload_files' ) ) {
90
- return;
91
- }
92
-
93
- $default_url = SIMPLE_AUTHOR_BOX_ASSETS . 'img/default.png';
94
- $image = get_user_meta( $user->ID, 'sabox-profile-image', true );
95
-
96
- ?>
97
-
98
- <div id="sabox-custom-profile-image">
99
- <h3><?php _e( 'Custom User Profile Image (Simple Author Box)', 'saboxplugin' ); ?></h3>
100
- <table class="form-table">
101
- <tr>
102
- <th><label for="cupp_meta"><?php _e( 'Profile Image', 'saboxplugin' ); ?></label></th>
103
- <td>
104
- <div id="sab-current-image">
105
- <?php wp_nonce_field( 'sabox-profile-image', 'sabox-profile-nonce' ); ?>
106
- <img data-default="<?php echo esc_url_raw( $default_url ); ?>" src="<?php echo '' != $image ? esc_url_raw( $image ) : esc_url_raw( $default_url ); ?>"><br>
107
- <input type="text" name="sabox-custom-image" id="sabox-custom-image" class="regular-text" value="<?php echo esc_attr( $image ); ?>">
108
- </div>
109
- <div class="actions">
110
- <a href="#" class="button-secondary" id="sabox-remove-image"><?php _e( 'Remove Image', 'saboxplugin' ); ?></a>
111
- <a href="#" class="button-primary" id="sabox-add-image"><?php _e( 'Upload Image', 'saboxplugin' ); ?></a>
112
- </div>
113
- </td>
114
- </tr>
115
- </table>
116
- </div>
117
-
118
- <?php
119
- }
120
-
121
- public function save_user_profile( $user_id ) {
122
-
123
- if ( isset( $_POST['sabox-social-icons'] ) && isset( $_POST['sabox-social-links'] ) ) {
124
-
125
- $social_platforms = apply_filters( 'sabox_social_icons', Simple_Author_Box_Helper::$social_icons );
126
- $social_links = array();
127
- foreach ( $_POST['sabox-social-links'] as $index => $social_link ) {
128
- if ( $social_link ) {
129
- $social_platform = isset( $_POST['sabox-social-icons'][ $index ] ) ? $_POST['sabox-social-icons'][ $index ] : false;
130
- if ( $social_platform && isset( $social_platforms[ $social_platform ] ) ) {
131
- $social_links[ $social_platform ] = esc_url_raw( $social_link );
132
- }
133
- }
134
- }
135
-
136
- update_user_meta( $user_id, 'sabox_social_links', $social_links );
137
-
138
- } else {
139
- delete_user_meta( $user_id, 'sabox_social_links' );
140
- }
141
-
142
- if ( ! isset( $_POST['sabox-profile-nonce'] ) || ! wp_verify_nonce( $_POST['sabox-profile-nonce'], 'sabox-profile-image' ) ) {
143
- return;
144
- }
145
-
146
- if ( ! current_user_can( 'upload_files', $user_id ) ) {
147
- return;
148
- }
149
-
150
- if ( isset( $_POST['sabox-custom-image'] ) && '' != $_POST['sabox-custom-image'] ) {
151
- update_user_meta( $user_id, 'sabox-profile-image', esc_url_raw( $_POST['sabox-custom-image'] ) );
152
- } else {
153
- delete_user_meta( $user_id, 'sabox-profile-image' );
154
- }
155
-
156
-
157
-
158
- }
159
-
160
- }
161
-
162
- new Simple_Author_Box_User_Profile();
1
+ <?php
2
+
3
+ class Simple_Author_Box_User_Profile {
4
+
5
+ function __construct() {
6
+
7
+ // Social Links
8
+ add_action( 'show_user_profile', array( $this, 'add_social_area' ) );
9
+ add_action( 'edit_user_profile', array( $this, 'add_social_area' ) );
10
+
11
+ // Custom Profile Image
12
+ add_action( 'show_user_profile', array( $this, 'add_profile_image' ), 9, 1 );
13
+ add_action( 'edit_user_profile', array( $this, 'add_profile_image' ), 9, 1 );
14
+
15
+ add_action( 'personal_options_update', array( $this, 'save_user_profile' ) );
16
+ add_action( 'edit_user_profile_update', array( $this, 'save_user_profile' ) );
17
+
18
+ // Allow HTML in user description.
19
+ remove_filter( 'pre_user_description', 'wp_filter_kses' );
20
+ add_filter( 'pre_user_description', 'wp_kses_post' );
21
+
22
+ }
23
+
24
+ public function add_social_area( $profileuser ) {
25
+ $user_id = $profileuser->data->ID;
26
+
27
+ $social_links = Simple_Author_Box_Helper::get_user_social_links( $user_id );
28
+ $social_icons = apply_filters( 'sabox_social_icons', Simple_Author_Box_Helper::$social_icons );
29
+ unset( $social_icons['user_email'] );
30
+
31
+ ?>
32
+ <div class="sab-user-profile-wrapper">
33
+ <h2><?php _e( 'Social Media Links (Simple Author Box)', 'saboxplugin' ); ?></h2>
34
+ <table class="form-table" id="sabox-social-table">
35
+ <?php
36
+
37
+ if ( ! empty( $social_links ) ) {
38
+ foreach ( $social_links as $social_platform => $social_link ) {
39
+ ?>
40
+ <tr>
41
+ <th>
42
+ <span class="sabox-drag"></span>
43
+ <select name="sabox-social-icons[]">
44
+ <?php foreach ( $social_icons as $sabox_social_id => $sabox_social_name ) { ?>
45
+ <option value="<?php echo $sabox_social_id; ?>" <?php selected( $sabox_social_id, $social_platform ); ?>><?php echo $sabox_social_name; ?></option>
46
+ <?php } ?>
47
+ </select>
48
+ </th>
49
+ <td>
50
+ <input name="sabox-social-links[]" type="text" class="regular-text" value="<?php echo esc_url( $social_link ); ?>">
51
+ <span class="dashicons dashicons-trash"></span>
52
+ <td>
53
+ </tr>
54
+ <?php
55
+ }
56
+ } else {
57
+ ?>
58
+ <tr>
59
+ <th>
60
+ <span class="sabox-drag"></span>
61
+ <select name="sabox-social-icons[]">
62
+ <?php foreach ( $social_icons as $sabox_social_id => $sabox_social_name ) { ?>
63
+ <option value="<?php echo $sabox_social_id; ?>"><?php echo $sabox_social_name; ?></option>
64
+ <?php } ?>
65
+ </select>
66
+ </th>
67
+ <td>
68
+ <input name="sabox-social-links[]" type="text" class="regular-text" value="">
69
+ <span class="dashicons dashicons-trash"></span>
70
+ <td>
71
+ </tr>
72
+ <?php
73
+ }
74
+
75
+ ?>
76
+
77
+ </table>
78
+
79
+ <div class="sabox-add-social-link">
80
+ <a href="#" class="button button-primary button-hero"></span><?php esc_html_e( '+ Add new social platform', 'saboxplugin' ); ?></a>
81
+ </div>
82
+ </div>
83
+
84
+ <?php
85
+ }
86
+
87
+ public function add_profile_image( $user ) {
88
+
89
+ if ( ! current_user_can( 'upload_files' ) ) {
90
+ return;
91
+ }
92
+
93
+ $default_url = SIMPLE_AUTHOR_BOX_ASSETS . 'img/default.png';
94
+ $image = get_user_meta( $user->ID, 'sabox-profile-image', true );
95
+
96
+ ?>
97
+
98
+ <div id="sabox-custom-profile-image">
99
+ <h3><?php _e( 'Custom User Profile Image (Simple Author Box)', 'saboxplugin' ); ?></h3>
100
+ <table class="form-table">
101
+ <tr>
102
+ <th><label for="cupp_meta"><?php _e( 'Profile Image', 'saboxplugin' ); ?></label></th>
103
+ <td>
104
+ <div id="sab-current-image">
105
+ <?php wp_nonce_field( 'sabox-profile-image', 'sabox-profile-nonce' ); ?>
106
+ <img data-default="<?php echo esc_url_raw( $default_url ); ?>" src="<?php echo '' != $image ? esc_url_raw( $image ) : esc_url_raw( $default_url ); ?>"><br>
107
+ <input type="text" name="sabox-custom-image" id="sabox-custom-image" class="regular-text" value="<?php echo esc_attr( $image ); ?>">
108
+ </div>
109
+ <div class="actions">
110
+ <a href="#" class="button-secondary" id="sabox-remove-image"><?php _e( 'Remove Image', 'saboxplugin' ); ?></a>
111
+ <a href="#" class="button-primary" id="sabox-add-image"><?php _e( 'Upload Image', 'saboxplugin' ); ?></a>
112
+ </div>
113
+ </td>
114
+ </tr>
115
+ </table>
116
+ </div>
117
+
118
+ <?php
119
+ }
120
+
121
+ public function save_user_profile( $user_id ) {
122
+
123
+ if ( isset( $_POST['sabox-social-icons'] ) && isset( $_POST['sabox-social-links'] ) ) {
124
+
125
+ $social_platforms = apply_filters( 'sabox_social_icons', Simple_Author_Box_Helper::$social_icons );
126
+ $social_links = array();
127
+ foreach ( $_POST['sabox-social-links'] as $index => $social_link ) {
128
+ if ( $social_link ) {
129
+ $social_platform = isset( $_POST['sabox-social-icons'][ $index ] ) ? $_POST['sabox-social-icons'][ $index ] : false;
130
+ if ( $social_platform && isset( $social_platforms[ $social_platform ] ) ) {
131
+ $social_links[ $social_platform ] = esc_url_raw( $social_link );
132
+ }
133
+ }
134
+ }
135
+
136
+ update_user_meta( $user_id, 'sabox_social_links', $social_links );
137
+
138
+ } else {
139
+ delete_user_meta( $user_id, 'sabox_social_links' );
140
+ }
141
+
142
+ if ( ! isset( $_POST['sabox-profile-nonce'] ) || ! wp_verify_nonce( $_POST['sabox-profile-nonce'], 'sabox-profile-image' ) ) {
143
+ return;
144
+ }
145
+
146
+ if ( ! current_user_can( 'upload_files', $user_id ) ) {
147
+ return;
148
+ }
149
+
150
+ if ( isset( $_POST['sabox-custom-image'] ) && '' != $_POST['sabox-custom-image'] ) {
151
+ update_user_meta( $user_id, 'sabox-profile-image', esc_url_raw( $_POST['sabox-custom-image'] ) );
152
+ } else {
153
+ delete_user_meta( $user_id, 'sabox-profile-image' );
154
+ }
155
+
156
+
157
+
158
+ }
159
+
160
+ }
161
+
162
+ new Simple_Author_Box_User_Profile();
inc/class-simple-author-box.php CHANGED
@@ -140,11 +140,13 @@ class Simple_Author_Box {
140
  if ( '' !== $custom_profile_image && true !== $args['force_default'] ) {
141
 
142
  $avatar = sprintf(
143
- "<img alt='%s' src='%s' srcset='%s' class='%s' %s/>",
144
  esc_attr( $args['alt'] ),
145
  esc_url( $custom_profile_image ),
146
  esc_url( $custom_profile_image ) . ' 2x',
147
  esc_attr( join( ' ', $class ) ),
 
 
148
  $args['extra_attr']
149
  );
150
  }
140
  if ( '' !== $custom_profile_image && true !== $args['force_default'] ) {
141
 
142
  $avatar = sprintf(
143
+ "<img alt='%s' src='%s' srcset='%s' class='%s' height='%d' width='%d' %s/>",
144
  esc_attr( $args['alt'] ),
145
  esc_url( $custom_profile_image ),
146
  esc_url( $custom_profile_image ) . ' 2x',
147
  esc_attr( join( ' ', $class ) ),
148
+ (int) $args['height'],
149
+ (int) $args['width'],
150
  $args['extra_attr']
151
  );
152
  }
inc/feedback/class-epsilon-plugin-request-sab.php CHANGED
@@ -1,227 +1,227 @@
1
- <?php
2
-
3
- class Epsilon_Plugin_Request_SAB {
4
-
5
- /**
6
- * Url for the request
7
- *
8
- * @var string
9
- */
10
- private $url = 'https://tamewp.com/';
11
- /**
12
- * Api endpoint
13
- *
14
- * @var string
15
- */
16
- private $endpoint = 'wp-json/epsilon/v1/add-tracking-data';
17
- /**
18
- * Private data
19
- *
20
- * @var array
21
- */
22
- private $data = array(
23
- 'server' => array(),
24
- 'user' => array(),
25
- 'wordpress' => array(
26
- 'deactivated_plugin' => array(),
27
- ),
28
- );
29
- /**
30
- * Plugin file
31
- *
32
- * @var string
33
- */
34
- private $plugin_file = '';
35
-
36
- private $allow_tracking = 0;
37
-
38
- public $request_successful = false;
39
-
40
- function __construct( $_plugin_file, $args ) {
41
-
42
- // Set variables
43
- $this->allow_tracking = $args['tracking'];
44
- $this->plugin_file = $_plugin_file;
45
- $this->data['unique'] = md5( home_url() . get_bloginfo( 'admin_email' ) );
46
- $this->data['wordpress']['deactivated_plugin']['uninstall_reason'] = $args['reason'];
47
- $this->data['wordpress']['deactivated_plugin']['uninstall_details'] = $args['details'];
48
-
49
- // Start collecting data
50
- $this->_collect_data();
51
- $this->_generate_url();
52
- $this->request_successful = $this->_send_request();
53
- }
54
-
55
- /**
56
- * Collect all data for the request.
57
- *
58
- */
59
- private function _collect_data() {
60
-
61
- $current_plugin = get_plugin_data( $this->plugin_file );
62
-
63
- // Plugin data
64
- $this->data['wordpress']['deactivated_plugin']['slug'] = $current_plugin['TextDomain'];
65
- $this->data['wordpress']['deactivated_plugin']['name'] = $current_plugin['Name'];
66
- $this->data['wordpress']['deactivated_plugin']['version'] = $current_plugin['Version'];
67
- $this->data['wordpress']['deactivated_plugin']['author'] = $current_plugin['AuthorName'];
68
-
69
- if ( $this->allow_tracking ) {
70
- $this->_collect_wordpress_data();
71
- $this->_collect_server_data();
72
- $this->_collect_user_data();
73
- }
74
-
75
- }
76
-
77
- /**
78
- * Collect WordPress data.
79
- *
80
- */
81
- private function _collect_wordpress_data() {
82
- $this->data['wordpress']['locale'] = ( get_bloginfo( 'version' ) >= 4.7 ) ? get_user_locale() : get_locale();
83
- $this->data['wordpress']['wp_version'] = get_bloginfo( 'version' );
84
- $this->data['wordpress']['multisite'] = is_multisite();
85
-
86
- $this->data['wordpress']['themes'] = $this->get_themes();
87
- $this->data['wordpress']['plugins'] = $this->get_plugins();
88
- }
89
-
90
- /**
91
- * Collect server data.
92
- *
93
- */
94
- private function _collect_server_data() {
95
- $this->data['server']['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
96
- $this->data['server']['php_version'] = phpversion();
97
- $this->data['server']['url'] = home_url();
98
- }
99
-
100
- /**
101
- * Collect user data.
102
- *
103
- */
104
- private function _collect_user_data() {
105
- $admin = get_user_by( 'email', get_bloginfo( 'admin_email' ) );
106
- if ( ! $admin ) {
107
- $this->data['user']['email'] = '';
108
- $this->data['user']['first_name'] = '';
109
- $this->data['user']['last_name'] = '';
110
- } else {
111
- $this->data['user']['email'] = get_bloginfo( 'admin_email' );
112
- $this->data['user']['first_name'] = $admin->first_name;
113
- $this->data['user']['last_name'] = $admin->last_name;
114
- }
115
- }
116
-
117
- /**
118
- * Get current themes
119
- *
120
- * @return array
121
- */
122
- private function get_themes() {
123
- $theme = wp_get_theme();
124
-
125
- return array(
126
- 'installed' => $this->_get_installed_themes(),
127
- 'active' => array(
128
- 'slug' => get_stylesheet(),
129
- 'name' => $theme->get( 'Name' ),
130
- 'version' => $theme->get( 'Version' ),
131
- 'author' => $theme->get( 'Author' ),
132
- ),
133
- );
134
- }
135
-
136
- /**
137
- * Get an array of installed themes
138
- */
139
- private function _get_installed_themes() {
140
- $installed = wp_get_themes();
141
- $theme = get_stylesheet();
142
- $arr = array();
143
-
144
- foreach ( $installed as $slug => $info ) {
145
- if ( $slug === $theme ) {
146
- continue;
147
- }
148
- $arr[ $slug ] = array(
149
- 'slug' => $slug,
150
- 'name' => $info->get( 'Name' ),
151
- 'version' => $info->get( 'Version' ),
152
- 'author' => $info->get( 'Author' ),
153
- );
154
- };
155
-
156
- return $arr;
157
- }
158
-
159
- /**
160
- * Get a list of installed plugins
161
- */
162
- private function get_plugins() {
163
- if ( ! function_exists( 'get_plugins' ) ) {
164
- include ABSPATH . '/wp-admin/includes/plugin.php';
165
- }
166
-
167
- $plugins = get_plugins();
168
- $option = get_option( 'active_plugins', array() );
169
- $active = array();
170
- $installed = array();
171
- foreach ( $plugins as $id => $info ) {
172
- if ( in_array( $id, $active ) ) {
173
- continue;
174
- }
175
-
176
- $id = explode( '/', $id );
177
- $id = ucwords( str_replace( '-', ' ', $id[0] ) );
178
-
179
- $installed[] = $id;
180
- }
181
-
182
- foreach ( $option as $id ) {
183
- $id = explode( '/', $id );
184
- $id = ucwords( str_replace( '-', ' ', $id[0] ) );
185
-
186
- $active[] = $id;
187
- }
188
-
189
- return array(
190
- 'installed' => $installed,
191
- 'active' => $active,
192
- );
193
- }
194
-
195
- /**
196
- * Generate the url
197
- */
198
- protected function _generate_url() {
199
- $this->url = $this->url . $this->endpoint;
200
- }
201
-
202
- /**
203
- * Send dat to server.
204
- *
205
- */
206
- private function _send_request() {
207
-
208
- $request = wp_remote_post(
209
- $this->url, array(
210
- 'method' => 'POST',
211
- 'timeout' => 20,
212
- 'redirection' => 5,
213
- 'httpversion' => '1.1',
214
- 'blocking' => true,
215
- 'body' => $this->data,
216
- 'user-agent' => 'MT/EPSILON-CUSTOMER-TRACKING/' . esc_url( home_url() ),
217
- )
218
- );
219
-
220
- if ( is_wp_error( $request ) ) {
221
- return false;
222
- }
223
-
224
- return true;
225
-
226
- }
227
- }
1
+ <?php
2
+
3
+ class Epsilon_Plugin_Request_SAB {
4
+
5
+ /**
6
+ * Url for the request
7
+ *
8
+ * @var string
9
+ */
10
+ private $url = 'https://tamewp.com/';
11
+ /**
12
+ * Api endpoint
13
+ *
14
+ * @var string
15
+ */
16
+ private $endpoint = 'wp-json/epsilon/v1/add-tracking-data';
17
+ /**
18
+ * Private data
19
+ *
20
+ * @var array
21
+ */
22
+ private $data = array(
23
+ 'server' => array(),
24
+ 'user' => array(),
25
+ 'wordpress' => array(
26
+ 'deactivated_plugin' => array(),
27
+ ),
28
+ );
29
+ /**
30
+ * Plugin file
31
+ *
32
+ * @var string
33
+ */
34
+ private $plugin_file = '';
35
+
36
+ private $allow_tracking = 0;
37
+
38
+ public $request_successful = false;
39
+
40
+ function __construct( $_plugin_file, $args ) {
41
+
42
+ // Set variables
43
+ $this->allow_tracking = $args['tracking'];
44
+ $this->plugin_file = $_plugin_file;
45
+ $this->data['unique'] = md5( home_url() . get_bloginfo( 'admin_email' ) );
46
+ $this->data['wordpress']['deactivated_plugin']['uninstall_reason'] = $args['reason'];
47
+ $this->data['wordpress']['deactivated_plugin']['uninstall_details'] = $args['details'];
48
+
49
+ // Start collecting data
50
+ $this->_collect_data();
51
+ $this->_generate_url();
52
+ $this->request_successful = $this->_send_request();
53
+ }
54
+
55
+ /**
56
+ * Collect all data for the request.
57
+ *
58
+ */
59
+ private function _collect_data() {
60
+
61
+ $current_plugin = get_plugin_data( $this->plugin_file );
62
+
63
+ // Plugin data
64
+ $this->data['wordpress']['deactivated_plugin']['slug'] = $current_plugin['TextDomain'];
65
+ $this->data['wordpress']['deactivated_plugin']['name'] = $current_plugin['Name'];
66
+ $this->data['wordpress']['deactivated_plugin']['version'] = $current_plugin['Version'];
67
+ $this->data['wordpress']['deactivated_plugin']['author'] = $current_plugin['AuthorName'];
68
+
69
+ if ( $this->allow_tracking ) {
70
+ $this->_collect_wordpress_data();
71
+ $this->_collect_server_data();
72
+ $this->_collect_user_data();
73
+ }
74
+
75
+ }
76
+
77
+ /**
78
+ * Collect WordPress data.
79
+ *
80
+ */
81
+ private function _collect_wordpress_data() {
82
+ $this->data['wordpress']['locale'] = ( get_bloginfo( 'version' ) >= 4.7 ) ? get_user_locale() : get_locale();
83
+ $this->data['wordpress']['wp_version'] = get_bloginfo( 'version' );
84
+ $this->data['wordpress']['multisite'] = is_multisite();
85
+
86
+ $this->data['wordpress']['themes'] = $this->get_themes();
87
+ $this->data['wordpress']['plugins'] = $this->get_plugins();
88
+ }
89
+
90
+ /**
91
+ * Collect server data.
92
+ *
93
+ */
94
+ private function _collect_server_data() {
95
+ $this->data['server']['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
96
+ $this->data['server']['php_version'] = phpversion();
97
+ $this->data['server']['url'] = home_url();
98
+ }
99
+
100
+ /**
101
+ * Collect user data.
102
+ *
103
+ */
104
+ private function _collect_user_data() {
105
+ $admin = get_user_by( 'email', get_bloginfo( 'admin_email' ) );
106
+ if ( ! $admin ) {
107
+ $this->data['user']['email'] = '';
108
+ $this->data['user']['first_name'] = '';
109
+ $this->data['user']['last_name'] = '';
110
+ } else {
111
+ $this->data['user']['email'] = get_bloginfo( 'admin_email' );
112
+ $this->data['user']['first_name'] = $admin->first_name;
113
+ $this->data['user']['last_name'] = $admin->last_name;
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Get current themes
119
+ *
120
+ * @return array
121
+ */
122
+ private function get_themes() {
123
+ $theme = wp_get_theme();
124
+
125
+ return array(
126
+ 'installed' => $this->_get_installed_themes(),
127
+ 'active' => array(
128
+ 'slug' => get_stylesheet(),
129
+ 'name' => $theme->get( 'Name' ),
130
+ 'version' => $theme->get( 'Version' ),
131
+ 'author' => $theme->get( 'Author' ),
132
+ ),
133
+ );
134
+ }
135
+
136
+ /**
137
+ * Get an array of installed themes
138
+ */
139
+ private function _get_installed_themes() {
140
+ $installed = wp_get_themes();
141
+ $theme = get_stylesheet();
142
+ $arr = array();
143
+
144
+ foreach ( $installed as $slug => $info ) {
145
+ if ( $slug === $theme ) {
146
+ continue;
147
+ }
148
+ $arr[ $slug ] = array(
149
+ 'slug' => $slug,
150
+ 'name' => $info->get( 'Name' ),
151
+ 'version' => $info->get( 'Version' ),
152
+ 'author' => $info->get( 'Author' ),
153
+ );
154
+ };
155
+
156
+ return $arr;
157
+ }
158
+
159
+ /**
160
+ * Get a list of installed plugins
161
+ */
162
+ private function get_plugins() {
163
+ if ( ! function_exists( 'get_plugins' ) ) {
164
+ include ABSPATH . '/wp-admin/includes/plugin.php';
165
+ }
166
+
167
+ $plugins = get_plugins();
168
+ $option = get_option( 'active_plugins', array() );
169
+ $active = array();
170
+ $installed = array();
171
+ foreach ( $plugins as $id => $info ) {
172
+ if ( in_array( $id, $active ) ) {
173
+ continue;
174
+ }
175
+
176
+ $id = explode( '/', $id );
177
+ $id = ucwords( str_replace( '-', ' ', $id[0] ) );
178
+
179
+ $installed[] = $id;
180
+ }
181
+
182
+ foreach ( $option as $id ) {
183
+ $id = explode( '/', $id );
184
+ $id = ucwords( str_replace( '-', ' ', $id[0] ) );
185
+
186
+ $active[] = $id;
187
+ }
188
+
189
+ return array(
190
+ 'installed' => $installed,
191
+ 'active' => $active,
192
+ );
193
+ }
194
+
195
+ /**
196
+ * Generate the url
197
+ */
198
+ protected function _generate_url() {
199
+ $this->url = $this->url . $this->endpoint;
200
+ }
201
+
202
+ /**
203
+ * Send dat to server.
204
+ *
205
+ */
206
+ private function _send_request() {
207
+
208
+ $request = wp_remote_post(
209
+ $this->url, array(
210
+ 'method' => 'POST',
211
+ 'timeout' => 20,
212
+ 'redirection' => 5,
213
+ 'httpversion' => '1.1',
214
+ 'blocking' => true,
215
+ 'body' => $this->data,
216
+ 'user-agent' => 'MT/EPSILON-CUSTOMER-TRACKING/' . esc_url( home_url() ),
217
+ )
218
+ );
219
+
220
+ if ( is_wp_error( $request ) ) {
221
+ return false;
222
+ }
223
+
224
+ return true;
225
+
226
+ }
227
+ }
inc/functions.php CHANGED
@@ -1,46 +1,46 @@
1
- <?php
2
-
3
- // If this file is called directly, busted!
4
- if ( ! defined( 'ABSPATH' ) ) {
5
- exit;
6
- }
7
-
8
- /*----------------------------------------------------------------------------------------------------------
9
- Adding the author box to the end of your single post
10
- -----------------------------------------------------------------------------------------------------------*/
11
- if ( ! function_exists( 'wpsabox_author_box' ) ) {
12
-
13
-
14
- function wpsabox_author_box( $saboxmeta = null ) {
15
-
16
- $show = ( is_single() || is_author() || is_archive() );
17
- $show = apply_filters( 'sabox_check_if_show', $show );
18
-
19
- if ( $show ) {
20
-
21
- global $post;
22
- $template = Simple_Author_Box_Helper::get_template();
23
-
24
- ob_start();
25
- $sabox_options = Simple_Author_Box_Helper::get_option( 'saboxplugin_options' );
26
- $sabox_author_id = $post->post_author;
27
- $show_post_author_box = apply_filters( 'sabox_check_if_show_post_author_box', true, $sabox_options );
28
-
29
- do_action( 'sabox_before_author_box', $sabox_options );
30
-
31
- if ( $show_post_author_box ) {
32
- include( $template );
33
- }
34
-
35
- do_action( 'sabox_after_author_box', $sabox_options );
36
-
37
- $sabox = ob_get_clean();
38
- $return = $saboxmeta . $sabox;
39
-
40
- // Filter returning HTML of the Author Box
41
- $saboxmeta = apply_filters( 'sabox_return_html', $return, $sabox, $saboxmeta );
42
-
43
- }
44
- return $saboxmeta;
45
- }
46
- }
1
+ <?php
2
+
3
+ // If this file is called directly, busted!
4
+ if ( ! defined( 'ABSPATH' ) ) {
5
+ exit;
6
+ }
7
+
8
+ /*----------------------------------------------------------------------------------------------------------
9
+ Adding the author box to the end of your single post
10
+ -----------------------------------------------------------------------------------------------------------*/
11
+ if ( ! function_exists( 'wpsabox_author_box' ) ) {
12
+
13
+
14
+ function wpsabox_author_box( $saboxmeta = null ) {
15
+
16
+ $show = ( is_single() || is_author() || is_archive() );
17
+ $show = apply_filters( 'sabox_check_if_show', $show );
18
+
19
+ if ( $show ) {
20
+
21
+ global $post;
22
+ $template = Simple_Author_Box_Helper::get_template();
23
+
24
+ ob_start();
25
+ $sabox_options = Simple_Author_Box_Helper::get_option( 'saboxplugin_options' );
26
+ $sabox_author_id = $post->post_author;
27
+ $show_post_author_box = apply_filters( 'sabox_check_if_show_post_author_box', true, $sabox_options );
28
+
29
+ do_action( 'sabox_before_author_box', $sabox_options );
30
+
31
+ if ( $show_post_author_box ) {
32
+ include( $template );
33
+ }
34
+
35
+ do_action( 'sabox_after_author_box', $sabox_options );
36
+
37
+ $sabox = ob_get_clean();
38
+ $return = $saboxmeta . $sabox;
39
+
40
+ // Filter returning HTML of the Author Box
41
+ $saboxmeta = apply_filters( 'sabox_return_html', $return, $sabox, $saboxmeta );
42
+
43
+ }
44
+ return $saboxmeta;
45
+ }
46
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: author box, responsive author box, author profile fields, author social ic
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
  Tested up to: 4.9
7
- Stable tag: trunk
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -79,6 +79,14 @@ Or you can give back by recommending this amazing plugin to your friends!
79
 
80
  == Changelog ==
81
 
 
 
 
 
 
 
 
 
82
  = 2.1.1 =
83
  * Minor fixes & version bump
84
 
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
  Tested up to: 4.9
7
+ Stable tag: 2.1.3
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
79
 
80
  == Changelog ==
81
 
82
+ = 2.1.3 =
83
+ * Fixed error on footer.
84
+ * Fixed profile image in dashboard ( https://github.com/MachoThemes/simple-author-box/issues/97 )
85
+ * Fixed profile image in comments ( https://github.com/MachoThemes/simple-author-box/issues/96 )
86
+
87
+ = 2.1.2 =
88
+ * Added alt tag for custom profile image.
89
+
90
  = 2.1.1 =
91
  * Minor fixes & version bump
92
 
simple-author-box.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Simple Author Box
4
  * Plugin URI: http://wordpress.org/plugins/simple-author-box/
5
  * Description: Adds a responsive author box with social icons on your posts.
6
- * Version: 2.1.1
7
  * Author: Macho Themes
8
  * Author URI: https://www.machothemes.com/
9
  * License: GPLv3
@@ -30,7 +30,7 @@
30
  define( 'SIMPLE_AUTHOR_BOX_PATH', plugin_dir_path( __FILE__ ) );
31
  define( 'SIMPLE_AUTHOR_BOX_ASSETS', plugins_url( '/assets/', __FILE__ ) );
32
  define( 'SIMPLE_AUTHOR_BOX_SLUG', plugin_basename( __FILE__ ) );
33
- define( 'SIMPLE_AUTHOR_BOX_VERSION', '2.1.1' );
34
  define( 'SIMPLE_AUTHOR_SCRIPT_DEBUG', false );
35
 
36
 
3
  * Plugin Name: Simple Author Box
4
  * Plugin URI: http://wordpress.org/plugins/simple-author-box/
5
  * Description: Adds a responsive author box with social icons on your posts.
6
+ * Version: 2.1.3
7
  * Author: Macho Themes
8
  * Author URI: https://www.machothemes.com/
9
  * License: GPLv3
30
  define( 'SIMPLE_AUTHOR_BOX_PATH', plugin_dir_path( __FILE__ ) );
31
  define( 'SIMPLE_AUTHOR_BOX_ASSETS', plugins_url( '/assets/', __FILE__ ) );
32
  define( 'SIMPLE_AUTHOR_BOX_SLUG', plugin_basename( __FILE__ ) );
33
+ define( 'SIMPLE_AUTHOR_BOX_VERSION', '2.1.3' );
34
  define( 'SIMPLE_AUTHOR_SCRIPT_DEBUG', false );
35
 
36
 
template/template-sab.php CHANGED
@@ -1,116 +1,118 @@
1
- <?php
2
- if ( '1' == $sabox_options['sab_colored'] ) {
3
- $sabox_color = 'sabox-colored';
4
- } else {
5
- $sabox_color = '';
6
- }
7
-
8
- if ( '0' != $sabox_options['sab_web_position'] ) {
9
- $sab_web_align = 'sab-web-position';
10
- } else {
11
- $sab_web_align = '';
12
- }
13
-
14
- if ( '1' == $sabox_options['sab_web_target'] ) {
15
- $sab_web_target = '_blank';
16
- } else {
17
- $sab_web_target = '_self';
18
- }
19
-
20
- if ( '1' == $sabox_options['sab_web_rel'] ) {
21
- $sab_web_rel = 'rel="nofollow"';
22
- } else {
23
- $sab_web_rel = '';
24
- }
25
-
26
- $sab_author_link = sprintf( '<a href="%s" class="vcard author"><span class="fn">%s</span></a>', esc_url( get_author_posts_url( $sabox_author_id ) ), esc_html( get_the_author_meta( 'display_name', $sabox_author_id ) ) );
27
-
28
- if ( get_the_author_meta( 'description' ) != '' || '0' == $sabox_options['sab_no_description'] ) { // hide the author box if no description is provided
29
-
30
-
31
- echo '<div class="saboxplugin-wrap">'; // start saboxplugin-wrap div
32
-
33
- // author box gravatar
34
- echo '<div class="saboxplugin-gravatar">';
35
- $custom_profile_image = get_the_author_meta( 'sabox-profile-image', $sabox_author_id );
36
- if ( '' != $custom_profile_image ) {
37
- echo '<img src="' . esc_url( $custom_profile_image ) . '">';
38
- } else {
39
- echo get_avatar( get_the_author_meta( 'user_email', $sabox_author_id ), '100' );
40
- }
41
-
42
- echo '</div>';
43
-
44
- // author box name
45
- echo '<div class="saboxplugin-authorname">';
46
- echo apply_filters( 'sabox_author_html', $sab_author_link, $sabox_options, $sabox_author_id );
47
- if ( is_user_logged_in() && get_current_user_id() == $sabox_author_id ) {
48
- echo '<a class="sab-profile-edit" target="_blank" href="' . get_edit_user_link() . '"> ' . __( 'Edit profile', 'saboxplugin' ) . '</a>';
49
- }
50
- echo '</div>';
51
-
52
-
53
- // author box description
54
- echo '<div class="saboxplugin-desc">';
55
- echo '<div>';
56
- $description = get_the_author_meta( 'description', $sabox_author_id );
57
- $description = wptexturize( $description );
58
- $description = wpautop( $description );
59
- echo wp_kses_post( $description );
60
- echo '</div>';
61
- echo '</div>';
62
-
63
- if ( is_single() ) {
64
- if ( get_the_author_meta( 'user_url' ) != '' && '1' == $sabox_options['sab_web'] ) { // author website on single
65
- echo '<div class="saboxplugin-web ' . esc_attr( $sab_web_align ) . '">';
66
- echo '<a href="' . esc_url( get_the_author_meta( 'user_url', $sabox_author_id ) ) . '" target="' . esc_attr( $sab_web_target ) . '" ' . $sab_web_rel . '>' . esc_html( get_the_author_meta( 'user_url', $sabox_author_id ) ) . '</a>';
67
- echo '</div>';
68
- }
69
- }
70
-
71
-
72
- if ( is_author() or is_archive() ) {
73
- if ( get_the_author_meta( 'user_url' ) != '' ) { // force show author website on author.php or archive.php
74
- echo '<div class="saboxplugin-web ' . esc_attr( $sab_web_align ) . '">';
75
- echo '<a href="' . esc_url( get_the_author_meta( 'user_url', $sabox_author_id ) ) . '" target="' . esc_attr( $sab_web_target ) . '" ' . $sab_web_rel . '>' . esc_html( get_the_author_meta( 'user_url', $sabox_author_id ) ) . '</a>';
76
- echo '</div>';
77
- }
78
- }
79
-
80
- // author box clearfix
81
- echo '<div class="clearfix"></div>';
82
-
83
- // author box social icons
84
- $author = get_userdata( $sabox_author_id );
85
- $show_social_icons = apply_filters( 'sabox_hide_social_icons', true, $author );
86
-
87
-
88
-
89
- if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
90
- echo '<div class="sab-edit-settings">';
91
- echo '<a target="_blank" href="' . admin_url() . 'admin.php?page=simple-author-box-options">' . __( 'Settings', 'saboxplugin' ) . '<i class="dashicons dashicons-admin-settings"></i></a>';
92
- echo '</div>';
93
- }
94
-
95
- $show_email = '0' == $sabox_options['sab_email'] ? false : true;
96
- $social_links = Simple_Author_Box_Helper::get_user_social_links( $sabox_author_id, $show_email );
97
-
98
- if ( '0' == $sabox_options['sab_hide_socials'] && $show_social_icons && ! empty( $social_links ) ) { // hide social icons div option
99
- echo '<div class="saboxplugin-socials ' . esc_attr( $sabox_color ) . '">';
100
-
101
- foreach ( $social_links as $social_platform => $social_link ) {
102
-
103
- if ( 'user_email' == $social_platform ) {
104
- $social_link = 'mailto:' . antispambot( $social_link );
105
- }
106
-
107
- if ( ! empty( $social_link ) ) {
108
- echo Simple_Author_Box_Helper::get_sabox_social_icon( $social_link, $social_platform );
109
- }
110
- }
111
-
112
-
113
- echo '</div>';
114
- } // end of social icons
115
- echo '</div>'; // end of saboxplugin-wrap div
116
- }
 
 
1
+ <?php
2
+ if ( '1' == $sabox_options['sab_colored'] ) {
3
+ $sabox_color = 'sabox-colored';
4
+ } else {
5
+ $sabox_color = '';
6
+ }
7
+
8
+ if ( '0' != $sabox_options['sab_web_position'] ) {
9
+ $sab_web_align = 'sab-web-position';
10
+ } else {
11
+ $sab_web_align = '';
12
+ }
13
+
14
+ if ( '1' == $sabox_options['sab_web_target'] ) {
15
+ $sab_web_target = '_blank';
16
+ } else {
17
+ $sab_web_target = '_self';
18
+ }
19
+
20
+ if ( '1' == $sabox_options['sab_web_rel'] ) {
21
+ $sab_web_rel = 'rel="nofollow"';
22
+ } else {
23
+ $sab_web_rel = '';
24
+ }
25
+
26
+ $sab_author_link = sprintf( '<a href="%s" class="vcard author"><span class="fn">%s</span></a>', esc_url( get_author_posts_url( $sabox_author_id ) ), esc_html( get_the_author_meta( 'display_name', $sabox_author_id ) ) );
27
+
28
+ if ( get_the_author_meta( 'description' ) != '' || '0' == $sabox_options['sab_no_description'] ) { // hide the author box if no description is provided
29
+
30
+
31
+ echo '<div class="saboxplugin-wrap">'; // start saboxplugin-wrap div
32
+
33
+ // author box gravatar
34
+ echo '<div class="saboxplugin-gravatar">';
35
+ $custom_profile_image = get_the_author_meta( 'sabox-profile-image', $sabox_author_id );
36
+ if ( '' != $custom_profile_image ) {
37
+ $mediaid = attachment_url_to_postid( $custom_profile_image );
38
+ $alt = $mediaid ? get_post_meta( $mediaid, '_wp_attachment_image_alt', true) : '';
39
+ echo '<img src="' . esc_url( $custom_profile_image ) . '" alt="' . esc_attr( $alt ) . '">';
40
+ } else {
41
+ echo get_avatar( get_the_author_meta( 'user_email', $sabox_author_id ), '100' );
42
+ }
43
+
44
+ echo '</div>';
45
+
46
+ // author box name
47
+ echo '<div class="saboxplugin-authorname">';
48
+ echo apply_filters( 'sabox_author_html', $sab_author_link, $sabox_options, $sabox_author_id );
49
+ if ( is_user_logged_in() && get_current_user_id() == $sabox_author_id ) {
50
+ echo '<a class="sab-profile-edit" target="_blank" href="' . get_edit_user_link() . '"> ' . __( 'Edit profile', 'saboxplugin' ) . '</a>';
51
+ }
52
+ echo '</div>';
53
+
54
+
55
+ // author box description
56
+ echo '<div class="saboxplugin-desc">';
57
+ echo '<div>';
58
+ $description = get_the_author_meta( 'description', $sabox_author_id );
59
+ $description = wptexturize( $description );
60
+ $description = wpautop( $description );
61
+ echo wp_kses_post( $description );
62
+ echo '</div>';
63
+ echo '</div>';
64
+
65
+ if ( is_single() ) {
66
+ if ( get_the_author_meta( 'user_url' ) != '' && '1' == $sabox_options['sab_web'] ) { // author website on single
67
+ echo '<div class="saboxplugin-web ' . esc_attr( $sab_web_align ) . '">';
68
+ echo '<a href="' . esc_url( get_the_author_meta( 'user_url', $sabox_author_id ) ) . '" target="' . esc_attr( $sab_web_target ) . '" ' . $sab_web_rel . '>' . esc_html( get_the_author_meta( 'user_url', $sabox_author_id ) ) . '</a>';
69
+ echo '</div>';
70
+ }
71
+ }
72
+
73
+
74
+ if ( is_author() or is_archive() ) {
75
+ if ( get_the_author_meta( 'user_url' ) != '' ) { // force show author website on author.php or archive.php
76
+ echo '<div class="saboxplugin-web ' . esc_attr( $sab_web_align ) . '">';
77
+ echo '<a href="' . esc_url( get_the_author_meta( 'user_url', $sabox_author_id ) ) . '" target="' . esc_attr( $sab_web_target ) . '" ' . $sab_web_rel . '>' . esc_html( get_the_author_meta( 'user_url', $sabox_author_id ) ) . '</a>';
78
+ echo '</div>';
79
+ }
80
+ }
81
+
82
+ // author box clearfix
83
+ echo '<div class="clearfix"></div>';
84
+
85
+ // author box social icons
86
+ $author = get_userdata( $sabox_author_id );
87
+ $show_social_icons = apply_filters( 'sabox_hide_social_icons', true, $author );
88
+
89
+
90
+
91
+ if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
92
+ echo '<div class="sab-edit-settings">';
93
+ echo '<a target="_blank" href="' . admin_url() . 'admin.php?page=simple-author-box-options">' . __( 'Settings', 'saboxplugin' ) . '<i class="dashicons dashicons-admin-settings"></i></a>';
94
+ echo '</div>';
95
+ }
96
+
97
+ $show_email = '0' == $sabox_options['sab_email'] ? false : true;
98
+ $social_links = Simple_Author_Box_Helper::get_user_social_links( $sabox_author_id, $show_email );
99
+
100
+ if ( '0' == $sabox_options['sab_hide_socials'] && $show_social_icons && ! empty( $social_links ) ) { // hide social icons div option
101
+ echo '<div class="saboxplugin-socials ' . esc_attr( $sabox_color ) . '">';
102
+
103
+ foreach ( $social_links as $social_platform => $social_link ) {
104
+
105
+ if ( 'user_email' == $social_platform ) {
106
+ $social_link = 'mailto:' . antispambot( $social_link );
107
+ }
108
+
109
+ if ( ! empty( $social_link ) ) {
110
+ echo Simple_Author_Box_Helper::get_sabox_social_icon( $social_link, $social_platform );
111
+ }
112
+ }
113
+
114
+
115
+ echo '</div>';
116
+ } // end of social icons
117
+ echo '</div>'; // end of saboxplugin-wrap div
118
+ }
uninstall.php CHANGED
@@ -1,26 +1,26 @@
1
- <?php
2
-
3
- /*----------------------------------------------------------------------------------------------------------
4
- Uninstall Simple Author Box plugin - deletes plugin data in database
5
- -----------------------------------------------------------------------------------------------------------*/
6
-
7
- // Exit if accessed directly
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
- exit();
14
- }
15
-
16
- delete_option( 'saboxplugin_options' );
17
- delete_option( 'sab_box_margin_top' );
18
- delete_option( 'sab_box_margin_bottom' );
19
- delete_option( 'sab_box_icon_size' );
20
- delete_option( 'sab_box_name_size' );
21
- delete_option( 'sab_box_name_font' );
22
- delete_option( 'sab_box_subset' );
23
- delete_option( 'sab_box_desc_font' );
24
- delete_option( 'sab_box_desc_size' );
25
- delete_option( 'sab_box_desc_font' );
26
- delete_option( 'sab_box_web_size' );
1
+ <?php
2
+
3
+ /*----------------------------------------------------------------------------------------------------------
4
+ Uninstall Simple Author Box plugin - deletes plugin data in database
5
+ -----------------------------------------------------------------------------------------------------------*/
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+ exit();
14
+ }
15
+
16
+ delete_option( 'saboxplugin_options' );
17
+ delete_option( 'sab_box_margin_top' );
18
+ delete_option( 'sab_box_margin_bottom' );
19
+ delete_option( 'sab_box_icon_size' );
20
+ delete_option( 'sab_box_name_size' );
21
+ delete_option( 'sab_box_name_font' );
22
+ delete_option( 'sab_box_subset' );
23
+ delete_option( 'sab_box_desc_font' );
24
+ delete_option( 'sab_box_desc_size' );
25
+ delete_option( 'sab_box_desc_font' );
26
+ delete_option( 'sab_box_web_size' );