Team Members - Version 5.2.1

Version Description

  • Fixed minor vulnerability issue
Download this release

Release Info

Developer spwebguy
Plugin Icon 128x128 Team Members
Version 5.2.1
Comparing to
See all releases

Code changes from version 5.1.1 to 5.2.1

inc/tmm-metaboxes-settings.php CHANGED
@@ -3,118 +3,144 @@
3
  /* Defines force font select options. */
4
  function dmb_tmm_force_fonts_options()
5
  {
6
- $options = array(
7
- __('Use plugin defaults', TMM_TXTDM) => 'yes',
8
- __('Use fonts from my theme', TMM_TXTDM) => 'no'
9
- );
10
- return $options;
 
11
  }
12
 
13
  /* Defines picture link behavior options. */
14
  function dmb_tmm_piclink_beh_options()
15
  {
16
- $options = array(
17
- __('New window', TMM_TXTDM) => 'new',
18
- __('Same window', TMM_TXTDM) => 'same'
19
- );
20
- return $options;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
22
 
23
  /* Defines bio alignment options. */
24
  function dmb_tmm_bio_align_options()
25
  {
26
- $options = array(
27
- __('Center', TMM_TXTDM) => 'center',
28
- __('Left', TMM_TXTDM) => 'left',
29
- __('Right', TMM_TXTDM) => 'right',
30
- __('Justify', TMM_TXTDM) => 'justify'
31
- );
32
- return $options;
 
33
  }
34
 
35
  /* Defines team columns options. */
36
  function dmb_tmm_columns_options()
37
  {
38
- $options = array(
39
- __('1 per line', TMM_TXTDM) => '1',
40
- __('2 per line', TMM_TXTDM) => '2',
41
- __('3 per line', TMM_TXTDM) => '3',
42
- __('4 per line', TMM_TXTDM) => '4',
43
- __('5 per line', TMM_TXTDM) => '5'
44
- );
45
- return $options;
 
46
  }
47
 
48
  /* Hooks the metabox. */
49
  add_action('admin_init', 'dmb_tmm_add_settings', 1);
50
  function dmb_tmm_add_settings()
51
  {
52
- add_meta_box(
53
- 'tmm_settings',
54
- 'Settings',
55
- 'dmb_tmm_settings_display',
56
- 'tmm',
57
- 'side',
58
- 'high'
59
- );
60
  }
61
 
62
-
63
  /* Displays the metabox. */
64
  function dmb_tmm_settings_display()
65
  {
66
-
67
- global $post;
68
-
69
- /* Retrieves select options. */
70
- $team_columns = dmb_tmm_columns_options();
71
- $team_bio_align = dmb_tmm_bio_align_options();
72
- $team_piclink_beh = dmb_tmm_piclink_beh_options();
73
- $team_force_font = dmb_tmm_force_fonts_options();
74
-
75
- /* Processes retrieved fields. */
76
- $settings = array();
77
-
78
- $settings['_tmm_columns'] = get_post_meta($post->ID, '_tmm_columns', true);
79
- if (!$settings['_tmm_columns']) {
80
- $settings['_tmm_columns'] = '3';
81
- }
82
-
83
- $settings['_tmm_color'] = get_post_meta($post->ID, '_tmm_color', true);
84
- if (!$settings['_tmm_color']) {
85
- $settings['_tmm_color'] = '#333333';
86
- }
87
-
88
- $settings['_tmm_bio_alignment'] = get_post_meta($post->ID, '_tmm_bio_alignment', true);
89
-
90
- /* Checks if member links open in new window. */
91
- $settings['_tmm_piclink_beh'] = get_post_meta($post->ID, '_tmm_piclink_beh', true);
92
- ($settings['_tmm_piclink_beh'] == 'new' ? $tmm_plb = 'target="_blank"' : $tmm_plb = '');
93
-
94
- /* Checks if forcing original fonts. */
95
- $settings['_tmm_original_font'] = get_post_meta($post->ID, '_tmm_original_font', true);
96
- if (!$settings['_tmm_original_font']) {
97
- $settings['_tmm_original_font'] = 'yes';
98
- }
 
 
 
 
 
 
99
 
100
  ?>
101
 
102
  <div class="dmb_settings_box dmb_sidebar">
103
 
104
  <div class="dmb_section_title">
105
- <?php /* translators: General settings */ esc_html_e('General', TMM_TXTDM) ?>
106
  </div>
107
 
108
  <!-- Team layout -->
109
  <div class="dmb_grid dmb_grid_50 dmb_grid_first">
110
  <div class="dmb_field_title">
111
- <?php esc_html_e('Members per line', TMM_TXTDM) ?>
112
  </div>
113
  <select class="dmb_side_select" name="team_columns">
114
  <?php foreach ($team_columns as $label => $value) { ?>
115
- <option value="<?php echo wp_kses_post($value); ?>"
116
- <?php selected((isset($settings['_tmm_columns'])) ? $settings['_tmm_columns'] : '3', $value); ?>>
117
- <?php echo esc_attr($label); ?></option>
118
  <?php } ?>
119
  </select>
120
  </div>
@@ -122,27 +148,45 @@ function dmb_tmm_settings_display()
122
  <!-- Photo link behavior -->
123
  <div class="dmb_grid dmb_grid_50 dmb_grid_last">
124
  <div class="dmb_field_title">
125
- <?php esc_html_e('Photo link behavior', TMM_TXTDM) ?>
126
  </div>
127
  <select class="dmb_side_select" name="team_piclink_beh">
128
  <?php foreach ($team_piclink_beh as $label => $value) { ?>
129
- <option value="<?php echo wp_kses_post($value); ?>"
130
- <?php selected((isset($settings['_tmm_piclink_beh'])) ? $settings['_tmm_piclink_beh'] : 'new', $value); ?>>
131
- <?php echo esc_attr($label); ?></option>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  <?php } ?>
133
  </select>
134
  </div>
135
 
136
  <!-- Font option -->
137
- <div class="dmb_grid dmb_grid_100 dmb_grid_first dmb_grid_last">
138
  <div class="dmb_field_title">
139
- <?php esc_html_e('Fonts to use', TMM_TXTDM) ?>
140
  </div>
141
  <select class="dmb_side_select" name="team_force_font">
142
  <?php foreach ($team_force_font as $label => $value) { ?>
143
- <option value="<?php echo wp_kses_post($value); ?>"
144
- <?php selected((isset($settings['_tmm_original_font'])) ? $settings['_tmm_original_font'] : 'yes', $value); ?>>
145
- <?php echo esc_attr($label); ?></option>
146
  <?php } ?>
147
  </select>
148
  </div>
@@ -150,10 +194,10 @@ function dmb_tmm_settings_display()
150
  <!-- Main color -->
151
  <div class="dmb_color_of_team dmb_grid dmb_grid_100 dmb_grid_first dmb_grid_last">
152
  <div class="dmb_field_title">
153
- <?php esc_html_e('Main color', TMM_TXTDM) ?>
154
  </div>
155
  <input class="dmb_color_picker dmb_field dmb_color_of_team" name="team_color" type="text"
156
- value="<?php echo (isset($settings['_tmm_color'])) ? wp_kses_post($settings['_tmm_color']) : '#333333'; ?>" />
157
  </div>
158
 
159
  <div class="dmb_clearfix"></div>
3
  /* Defines force font select options. */
4
  function dmb_tmm_force_fonts_options()
5
  {
6
+ $options = [
7
+ __('Plugin', TMM_TXTDM) => 'yes',
8
+ __('Theme', TMM_TXTDM) => 'no',
9
+ ];
10
+
11
+ return $options;
12
  }
13
 
14
  /* Defines picture link behavior options. */
15
  function dmb_tmm_piclink_beh_options()
16
  {
17
+ $options = [
18
+ __('New window', TMM_TXTDM) => 'new',
19
+ __('Same window', TMM_TXTDM) => 'same',
20
+ ];
21
+
22
+ return $options;
23
+ }
24
+
25
+ /**
26
+ * Defines display order options.
27
+ *
28
+ * @since 5.1.1
29
+ *
30
+ * @return array options
31
+ */
32
+ function dmb_tmm_display_order_options()
33
+ {
34
+ $options = [
35
+ __('Default', TMM_TXTDM) => 'default',
36
+ __('Random', TMM_TXTDM) => 'random',
37
+ ];
38
+
39
+ return $options;
40
  }
41
 
42
  /* Defines bio alignment options. */
43
  function dmb_tmm_bio_align_options()
44
  {
45
+ $options = [
46
+ __('Center', TMM_TXTDM) => 'center',
47
+ __('Left', TMM_TXTDM) => 'left',
48
+ __('Right', TMM_TXTDM) => 'right',
49
+ __('Justify', TMM_TXTDM) => 'justify',
50
+ ];
51
+
52
+ return $options;
53
  }
54
 
55
  /* Defines team columns options. */
56
  function dmb_tmm_columns_options()
57
  {
58
+ $options = [
59
+ __('1 per line', TMM_TXTDM) => '1',
60
+ __('2 per line', TMM_TXTDM) => '2',
61
+ __('3 per line', TMM_TXTDM) => '3',
62
+ __('4 per line', TMM_TXTDM) => '4',
63
+ __('5 per line', TMM_TXTDM) => '5',
64
+ ];
65
+
66
+ return $options;
67
  }
68
 
69
  /* Hooks the metabox. */
70
  add_action('admin_init', 'dmb_tmm_add_settings', 1);
71
  function dmb_tmm_add_settings()
72
  {
73
+ add_meta_box(
74
+ 'tmm_settings',
75
+ 'Settings',
76
+ 'dmb_tmm_settings_display',
77
+ 'tmm',
78
+ 'side',
79
+ 'high'
80
+ );
81
  }
82
 
 
83
  /* Displays the metabox. */
84
  function dmb_tmm_settings_display()
85
  {
86
+ global $post;
87
+
88
+ /* Retrieves select options. */
89
+ $team_columns = dmb_tmm_columns_options();
90
+ $team_bio_align = dmb_tmm_bio_align_options();
91
+ $team_piclink_beh = dmb_tmm_piclink_beh_options();
92
+ $team_display_order = dmb_tmm_display_order_options();
93
+ $team_force_font = dmb_tmm_force_fonts_options();
94
+
95
+ /* Processes retrieved fields. */
96
+ $settings = [];
97
+
98
+ $settings['_tmm_columns'] = get_post_meta($post->ID, '_tmm_columns', true);
99
+ if (!$settings['_tmm_columns']) {
100
+ $settings['_tmm_columns'] = '3';
101
+ }
102
+
103
+ $settings['_tmm_color'] = get_post_meta($post->ID, '_tmm_color', true);
104
+ if (!$settings['_tmm_color']) {
105
+ $settings['_tmm_color'] = '#333333';
106
+ }
107
+
108
+ $settings['_tmm_bio_alignment'] = get_post_meta($post->ID, '_tmm_bio_alignment', true);
109
+
110
+ /* Checks if member links open in new window. */
111
+ $settings['_tmm_piclink_beh'] = get_post_meta($post->ID, '_tmm_piclink_beh', true);
112
+ 'new' == $settings['_tmm_piclink_beh'] ? $tmm_plb = 'target="_blank"' : $tmm_plb = '';
113
+
114
+ /* Checks if forcing original fonts. */
115
+ $settings['_tmm_original_font'] = get_post_meta($post->ID, '_tmm_original_font', true);
116
+ if (!$settings['_tmm_original_font']) {
117
+ $settings['_tmm_original_font'] = 'yes';
118
+ }
119
+
120
+ /* Checks display order settings. */
121
+ $settings['_tmm_display_order'] = get_post_meta($post->ID, '_tmm_display_order', true);
122
+ if (!$settings['_tmm_display_order']) {
123
+ $settings['_tmm_display_order'] = 'default';
124
+ }
125
 
126
  ?>
127
 
128
  <div class="dmb_settings_box dmb_sidebar">
129
 
130
  <div class="dmb_section_title">
131
+ <?php /* translators: General settings */ esc_html_e('General', TMM_TXTDM); ?>
132
  </div>
133
 
134
  <!-- Team layout -->
135
  <div class="dmb_grid dmb_grid_50 dmb_grid_first">
136
  <div class="dmb_field_title">
137
+ <?php esc_html_e('Members per line', TMM_TXTDM); ?>
138
  </div>
139
  <select class="dmb_side_select" name="team_columns">
140
  <?php foreach ($team_columns as $label => $value) { ?>
141
+ <option value="<?php echo wp_kses_post($value); ?>" <?php selected((isset($settings['_tmm_columns'])) ? $settings['_tmm_columns'] : '3', $value); ?>>
142
+ <?php echo esc_attr($label); ?>
143
+ </option>
144
  <?php } ?>
145
  </select>
146
  </div>
148
  <!-- Photo link behavior -->
149
  <div class="dmb_grid dmb_grid_50 dmb_grid_last">
150
  <div class="dmb_field_title">
151
+ <?php esc_html_e('Photo link behavior', TMM_TXTDM); ?>
152
  </div>
153
  <select class="dmb_side_select" name="team_piclink_beh">
154
  <?php foreach ($team_piclink_beh as $label => $value) { ?>
155
+ <option value="<?php echo wp_kses_post($value); ?>" <?php selected((isset($settings['_tmm_piclink_beh'])) ? $settings['_tmm_piclink_beh'] : 'new', $value); ?>>
156
+ <?php echo esc_attr($label); ?>
157
+ </option>
158
+ <?php } ?>
159
+ </select>
160
+ </div>
161
+
162
+ <!-- Display order -->
163
+ <div class="dmb_grid dmb_grid_50 dmb_grid_first">
164
+ <div class="dmb_field_title">
165
+ <?php esc_html_e('Display order', TMM_TXTDM); ?>
166
+ <a class="dmb_inline_tip dmb_tooltip_small"
167
+ data-tooltip="<?php esc_attr_e('Order in which your team members will be sorted when displayed.', TMM_TXTDM); ?>">
168
+ [?]
169
+ </a>
170
+ </div>
171
+ <select class="dmb_side_select" name="team_display_order">
172
+ <?php foreach ($team_display_order as $label => $value) { ?>
173
+ <option value="<?php echo wp_kses_post($value); ?>" <?php selected((isset($settings['_tmm_display_order'])) ? $settings['_tmm_display_order'] : 'default', $value); ?>>
174
+ <?php esc_attr_e($label); ?>
175
+ </option>
176
  <?php } ?>
177
  </select>
178
  </div>
179
 
180
  <!-- Font option -->
181
+ <div class="dmb_grid dmb_grid_50 dmb_grid_last">
182
  <div class="dmb_field_title">
183
+ <?php esc_html_e('Fonts to use', TMM_TXTDM); ?>
184
  </div>
185
  <select class="dmb_side_select" name="team_force_font">
186
  <?php foreach ($team_force_font as $label => $value) { ?>
187
+ <option value="<?php echo wp_kses_post($value); ?>" <?php selected((isset($settings['_tmm_original_font'])) ? $settings['_tmm_original_font'] : 'yes', $value); ?>>
188
+ <?php echo esc_attr($label); ?>
189
+ </option>
190
  <?php } ?>
191
  </select>
192
  </div>
194
  <!-- Main color -->
195
  <div class="dmb_color_of_team dmb_grid dmb_grid_100 dmb_grid_first dmb_grid_last">
196
  <div class="dmb_field_title">
197
+ <?php esc_html_e('Main color', TMM_TXTDM); ?>
198
  </div>
199
  <input class="dmb_color_picker dmb_field dmb_color_of_team" name="team_color" type="text"
200
+ value="<?php echo (isset($settings['_tmm_color'])) ? wp_kses_post(esc_attr($settings['_tmm_color'])) : '#333333'; ?>" />
201
  </div>
202
 
203
  <div class="dmb_clearfix"></div>
inc/tmm-save-metaboxes.php CHANGED
@@ -4,126 +4,139 @@
4
  add_action('save_post', 'dmb_tmm_plan_meta_box_save');
5
  function dmb_tmm_plan_meta_box_save($post_id)
6
  {
7
-
8
- if (
9
- !isset($_POST['dmb_tmm_meta_box_nonce']) ||
10
- !wp_verify_nonce(sanitize_key($_POST['dmb_tmm_meta_box_nonce']), 'dmb_tmm_meta_box_nonce')
11
- )
12
- return;
13
-
14
- if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
15
- return;
16
-
17
- if (!current_user_can('edit_post', $post_id))
18
- return;
19
-
20
- if (!isset($_POST['tmm_data_dumps'])) {
21
- return;
22
- }
23
-
24
- /* Gets members. */
25
- $old_team = get_post_meta($post_id, '_tmm_head', true);
26
-
27
- /* Inits new team. */
28
- $new_team = array();
29
-
30
- /* Settings. */
31
- $old_team_settings = array();
32
-
33
- $old_team_settings['_tmm_columns'] = get_post_meta($post_id, '_tmm_columns', true);
34
- $old_team_settings['_tmm_color'] = get_post_meta($post_id, '_tmm_color', true);
35
- $old_team_settings['_tmm_bio_alignment'] = get_post_meta($post_id, '_tmm_bio_alignment', true);
36
- $old_team_settings['_tmm_piclink_beh'] = get_post_meta($post_id, '_tmm_piclink_beh', true);
37
- $old_team_settings['_tmm_original_font'] = get_post_meta($post_id, '_tmm_original_font', true);
38
-
39
- $tmm_data_dumps = array_map('wp_kses_post', wp_unslash($_POST['tmm_data_dumps'])); // sanitize array
40
-
41
- $count = count($tmm_data_dumps) - 1;
42
-
43
- for ($i = 0; $i < $count; $i++) {
44
-
45
- if ($tmm_data_dumps[$i]) {
46
-
47
- /* Data travels using a single field to avoid max_input_vars issue. */
48
- $member_data = explode(']--[', $tmm_data_dumps[$i]);
49
-
50
- $member_firstname = $member_data[0];
51
- $member_lastname = $member_data[1];
52
- $member_job = $member_data[2];
53
- $member_bio = $member_data[3];
54
-
55
- $member_scl_type1 = $member_data[4];
56
- $member_scl_title1 = $member_data[5];
57
- $member_scl_url1 = $member_data[6];
58
-
59
- $member_scl_type2 = $member_data[7];
60
- $member_scl_title2 = $member_data[8];
61
- $member_scl_url2 = $member_data[9];
62
-
63
- $member_scl_type3 = $member_data[10];
64
- $member_scl_title3 = $member_data[11];
65
- $member_scl_url3 = $member_data[12];
66
-
67
- $member_photo = $member_data[13];
68
- $member_photo_url = $member_data[14];
69
-
70
- /* Saves the member if at least one of these fields are not empty. */
71
- if (
72
- $member_firstname != ''
73
- || $member_lastname != ''
74
- || $member_job != ''
75
- || $member_bio != ''
76
- || $member_photo != ''
77
- ) {
78
-
79
- /* Head. */
80
- (isset($member_firstname) && $member_firstname) ? $new_team[$i]['_tmm_firstname'] = stripslashes(wp_kses_post($member_firstname)) : $new_team[$i]['_tmm_firstname'] = __('Untitled', TMM_TXTDM);
81
- (isset($member_lastname) && $member_lastname) ? $new_team[$i]['_tmm_lastname'] = stripslashes(wp_kses_post($member_lastname)) : $new_team[$i]['_tmm_lastname'] = '';
82
- (isset($member_job) && $member_job) ? $new_team[$i]['_tmm_job'] = stripslashes(wp_kses_post($member_job)) : $new_team[$i]['_tmm_job'] = '';
83
- (isset($member_bio) && $member_bio) ? $new_team[$i]['_tmm_desc'] = wp_kses_post(balanceTags($member_bio)) : $new_team[$i]['_tmm_desc'] = '';
84
- (isset($member_photo) && $member_photo) ? $new_team[$i]['_tmm_photo'] = stripslashes(strip_tags(sanitize_text_field($member_photo))) : $new_team[$i]['_tmm_photo'] = '';
85
- (isset($member_photo_url) && $member_photo_url) ? $new_team[$i]['_tmm_photo_url'] = stripslashes(strip_tags(sanitize_text_field($member_photo_url))) : $new_team[$i]['_tmm_photo_url'] = '';
86
-
87
- (isset($member_scl_type1) && $member_scl_type1) ? $new_team[$i]['_tmm_sc_type1'] = stripslashes(strip_tags(sanitize_text_field($member_scl_type1))) : $new_team[$i]['_tmm_sc_type1'] = '';
88
- (isset($member_scl_title1) && $member_scl_title1) ? $new_team[$i]['_tmm_sc_title1'] = stripslashes(strip_tags(sanitize_text_field($member_scl_title1))) : $new_team[$i]['_tmm_sc_title1'] = '';
89
- (isset($member_scl_url1) && $member_scl_url1) ? $new_team[$i]['_tmm_sc_url1'] = stripslashes(strip_tags(sanitize_text_field($member_scl_url1))) : $new_team[$i]['_tmm_sc_url1'] = '';
90
-
91
- (isset($member_scl_type2) && $member_scl_type2) ? $new_team[$i]['_tmm_sc_type2'] = stripslashes(strip_tags(sanitize_text_field($member_scl_type2))) : $new_team[$i]['_tmm_sc_type2'] = '';
92
- (isset($member_scl_title2) && $member_scl_title2) ? $new_team[$i]['_tmm_sc_title2'] = stripslashes(strip_tags(sanitize_text_field($member_scl_title2))) : $new_team[$i]['_tmm_sc_title2'] = '';
93
- (isset($member_scl_url2) && $member_scl_url2) ? $new_team[$i]['_tmm_sc_url2'] = stripslashes(strip_tags(sanitize_text_field($member_scl_url2))) : $new_team[$i]['_tmm_sc_url2'] = '';
94
-
95
- (isset($member_scl_type3) && $member_scl_type3) ? $new_team[$i]['_tmm_sc_type3'] = stripslashes(strip_tags(sanitize_text_field($member_scl_type3))) : $new_team[$i]['_tmm_sc_type3'] = '';
96
- (isset($member_scl_title3) && $member_scl_title3) ? $new_team[$i]['_tmm_sc_title3'] = stripslashes(strip_tags(sanitize_text_field($member_scl_title3))) : $new_team[$i]['_tmm_sc_title3'] = '';
97
- (isset($member_scl_url3) && $member_scl_url3) ? $new_team[$i]['_tmm_sc_url3'] = stripslashes(strip_tags(sanitize_text_field($member_scl_url3))) : $new_team[$i]['_tmm_sc_url3'] = '';
98
- }
99
- }
100
- }
101
-
102
- /* Settings. */
103
- (isset($_POST['team_color']) && sanitize_text_field(wp_unslash($_POST['team_color']))) ? $new_team_settings['_tmm_color'] = stripslashes(strip_tags(sanitize_text_field(wp_unslash($_POST['team_color'])))) : $new_team_settings['_tmm_color'] = '';
104
- (isset($_POST['team_columns']) && sanitize_text_field(wp_unslash($_POST['team_columns']))) ? $new_team_settings['_tmm_columns'] = stripslashes(strip_tags(sanitize_text_field(wp_unslash($_POST['team_columns'])))) : $new_team_settings['_tmm_columns'] = '';
105
- (isset($_POST['team_bio_align']) && sanitize_text_field(wp_unslash($_POST['team_bio_align']))) ? $new_team_settings['_tmm_bio_alignment'] = stripslashes(strip_tags(sanitize_text_field(wp_unslash($_POST['team_bio_align'])))) : $new_team_settings['_tmm_bio_alignment'] = '';
106
- (isset($_POST['team_force_font']) && sanitize_text_field(wp_unslash($_POST['team_force_font']))) ? $new_team_settings['_tmm_original_font'] = stripslashes(strip_tags(sanitize_text_field(wp_unslash($_POST['team_force_font'])))) : $new_team_settings['_tmm_original_font'] = '';
107
- (isset($_POST['team_piclink_beh']) && sanitize_text_field(wp_unslash($_POST['team_piclink_beh']))) ? $new_team_settings['_tmm_piclink_beh'] = stripslashes(strip_tags(sanitize_text_field(wp_unslash($_POST['team_piclink_beh'])))) : $new_team_settings['_tmm_piclink_beh'] = '';
108
-
109
- /* Updates plans. */
110
- if (!empty($new_team) && $new_team != $old_team)
111
- update_post_meta($post_id, '_tmm_head', $new_team);
112
- elseif (empty($new_team) && $old_team)
113
- delete_post_meta($post_id, '_tmm_head', $old_team);
114
-
115
- if (!empty($new_team_settings['_tmm_color']) && $new_team_settings['_tmm_color'] != $old_team_settings['_tmm_color'])
116
- update_post_meta($post_id, '_tmm_color', $new_team_settings['_tmm_color']);
117
-
118
- if (!empty($new_team_settings['_tmm_columns']) && $new_team_settings['_tmm_columns'] != $old_team_settings['_tmm_columns'])
119
- update_post_meta($post_id, '_tmm_columns', $new_team_settings['_tmm_columns']);
120
-
121
- if (!empty($new_team_settings['_tmm_bio_alignment']) && $new_team_settings['_tmm_bio_alignment'] != $old_team_settings['_tmm_bio_alignment'])
122
- update_post_meta($post_id, '_tmm_bio_alignment', $new_team_settings['_tmm_bio_alignment']);
123
-
124
- if (!empty($new_team_settings['_tmm_original_font']) && $new_team_settings['_tmm_original_font'] != $old_team_settings['_tmm_original_font'])
125
- update_post_meta($post_id, '_tmm_original_font', $new_team_settings['_tmm_original_font']);
126
-
127
- if (!empty($new_team_settings['_tmm_piclink_beh']) && $new_team_settings['_tmm_piclink_beh'] != $old_team_settings['_tmm_piclink_beh'])
128
- update_post_meta($post_id, '_tmm_piclink_beh', $new_team_settings['_tmm_piclink_beh']);
129
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  add_action('save_post', 'dmb_tmm_plan_meta_box_save');
5
  function dmb_tmm_plan_meta_box_save($post_id)
6
  {
7
+ if (
8
+ !isset($_POST['dmb_tmm_meta_box_nonce']) ||
9
+ !wp_verify_nonce(sanitize_key($_POST['dmb_tmm_meta_box_nonce']), 'dmb_tmm_meta_box_nonce')
10
+ )
11
+ return;
12
+
13
+ if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
14
+ return;
15
+
16
+ if (!current_user_can('edit_post', $post_id))
17
+ return;
18
+
19
+ if (!isset($_POST['tmm_data_dumps'])) {
20
+ return;
21
+ }
22
+
23
+ /* Gets members. */
24
+ $old_team = get_post_meta($post_id, '_tmm_head', true);
25
+
26
+ /* Inits new team. */
27
+ $new_team = [];
28
+
29
+ /* Settings. */
30
+ $old_team_settings = [];
31
+
32
+ $old_team_settings['_tmm_columns'] = get_post_meta($post_id, '_tmm_columns', true);
33
+ $old_team_settings['_tmm_color'] = get_post_meta($post_id, '_tmm_color', true);
34
+ $old_team_settings['_tmm_bio_alignment'] = get_post_meta($post_id, '_tmm_bio_alignment', true);
35
+ $old_team_settings['_tmm_piclink_beh'] = get_post_meta($post_id, '_tmm_piclink_beh', true);
36
+ $old_team_settings['_tmm_original_font'] = get_post_meta($post_id, '_tmm_original_font', true);
37
+ $old_team_settings['_tmm_display_order'] = get_post_meta($post_id, '_tmm_display_order', true);
38
+
39
+ $tmm_data_dumps = array_map('wp_kses_post', wp_unslash($_POST['tmm_data_dumps'])); // sanitize array
40
+
41
+ $count = count($tmm_data_dumps) - 1;
42
+
43
+ for ($i = 0; $i < $count; ++$i) {
44
+ if ($tmm_data_dumps[$i]) {
45
+ /* Data travels using a single field to avoid max_input_vars issue. */
46
+ $member_data = explode(']--[', $tmm_data_dumps[$i]);
47
+
48
+ $member_firstname = $member_data[0];
49
+ $member_lastname = $member_data[1];
50
+ $member_job = $member_data[2];
51
+ $member_bio = $member_data[3];
52
+
53
+ $member_scl_type1 = $member_data[4];
54
+ $member_scl_title1 = $member_data[5];
55
+ $member_scl_url1 = $member_data[6];
56
+
57
+ $member_scl_type2 = $member_data[7];
58
+ $member_scl_title2 = $member_data[8];
59
+ $member_scl_url2 = $member_data[9];
60
+
61
+ $member_scl_type3 = $member_data[10];
62
+ $member_scl_title3 = $member_data[11];
63
+ $member_scl_url3 = $member_data[12];
64
+
65
+ $member_photo = $member_data[13];
66
+ $member_photo_url = $member_data[14];
67
+
68
+ /* Saves the member if at least one of these fields are not empty. */
69
+ if (
70
+ '' != $member_firstname
71
+ || '' != $member_lastname
72
+ || '' != $member_job
73
+ || '' != $member_bio
74
+ || '' != $member_photo
75
+ ) {
76
+ /* Head. */
77
+ (isset($member_firstname) && $member_firstname) ? $new_team[$i]['_tmm_firstname'] = stripslashes(wp_kses_post($member_firstname)) : $new_team[$i]['_tmm_firstname'] = __('Untitled', TMM_TXTDM);
78
+ (isset($member_lastname) && $member_lastname) ? $new_team[$i]['_tmm_lastname'] = stripslashes(wp_kses_post($member_lastname)) : $new_team[$i]['_tmm_lastname'] = '';
79
+ (isset($member_job) && $member_job) ? $new_team[$i]['_tmm_job'] = stripslashes(wp_kses_post($member_job)) : $new_team[$i]['_tmm_job'] = '';
80
+ (isset($member_bio) && $member_bio) ? $new_team[$i]['_tmm_desc'] = wp_kses_post(balanceTags($member_bio)) : $new_team[$i]['_tmm_desc'] = '';
81
+ (isset($member_photo) && $member_photo) ? $new_team[$i]['_tmm_photo'] = stripslashes(strip_tags(sanitize_text_field($member_photo))) : $new_team[$i]['_tmm_photo'] = '';
82
+ (isset($member_photo_url) && $member_photo_url) ? $new_team[$i]['_tmm_photo_url'] = stripslashes(strip_tags(sanitize_url($member_photo_url))) : $new_team[$i]['_tmm_photo_url'] = '';
83
+
84
+ (isset($member_scl_type1) && $member_scl_type1) ? $new_team[$i]['_tmm_sc_type1'] = stripslashes(strip_tags(sanitize_text_field($member_scl_type1))) : $new_team[$i]['_tmm_sc_type1'] = '';
85
+ (isset($member_scl_title1) && $member_scl_title1) ? $new_team[$i]['_tmm_sc_title1'] = stripslashes(strip_tags(sanitize_text_field($member_scl_title1))) : $new_team[$i]['_tmm_sc_title1'] = '';
86
+ (isset($member_scl_url1) && $member_scl_url1) ? $new_team[$i]['_tmm_sc_url1'] = stripslashes(strip_tags(sanitize_url($member_scl_url1))) : $new_team[$i]['_tmm_sc_url1'] = '';
87
+
88
+ (isset($member_scl_type2) && $member_scl_type2) ? $new_team[$i]['_tmm_sc_type2'] = stripslashes(strip_tags(sanitize_text_field($member_scl_type2))) : $new_team[$i]['_tmm_sc_type2'] = '';
89
+ (isset($member_scl_title2) && $member_scl_title2) ? $new_team[$i]['_tmm_sc_title2'] = stripslashes(strip_tags(sanitize_text_field($member_scl_title2))) : $new_team[$i]['_tmm_sc_title2'] = '';
90
+ (isset($member_scl_url2) && $member_scl_url2) ? $new_team[$i]['_tmm_sc_url2'] = stripslashes(strip_tags(sanitize_url($member_scl_url2))) : $new_team[$i]['_tmm_sc_url2'] = '';
91
+
92
+ (isset($member_scl_type3) && $member_scl_type3) ? $new_team[$i]['_tmm_sc_type3'] = stripslashes(strip_tags(sanitize_text_field($member_scl_type3))) : $new_team[$i]['_tmm_sc_type3'] = '';
93
+ (isset($member_scl_title3) && $member_scl_title3) ? $new_team[$i]['_tmm_sc_title3'] = stripslashes(strip_tags(sanitize_text_field($member_scl_title3))) : $new_team[$i]['_tmm_sc_title3'] = '';
94
+ (isset($member_scl_url3) && $member_scl_url3) ? $new_team[$i]['_tmm_sc_url3'] = stripslashes(strip_tags(sanitize_url($member_scl_url3))) : $new_team[$i]['_tmm_sc_url3'] = '';
95
+ }
96
+ }
97
+ }
98
+
99
+ /* Settings. */
100
+ (isset($_POST['team_color']) && $_POST['team_color'])
101
+ ? $new_team_settings['_tmm_color'] = stripslashes(strip_tags(sanitize_hex_color(wp_unslash($_POST['team_color']))))
102
+ : $new_team_settings['_tmm_color'] = '';
103
+ (isset($_POST['team_columns']) && $_POST['team_columns'])
104
+ ? $new_team_settings['_tmm_columns'] = stripslashes(strip_tags(sanitize_text_field(wp_unslash($_POST['team_columns']))))
105
+ : $new_team_settings['_tmm_columns'] = '';
106
+ (isset($_POST['team_bio_align']) && $_POST['team_bio_align'])
107
+ ? $new_team_settings['_tmm_bio_alignment'] = stripslashes(strip_tags(sanitize_text_field(wp_unslash($_POST['team_bio_align']))))
108
+ : $new_team_settings['_tmm_bio_alignment'] = '';
109
+ (isset($_POST['team_force_font']) && $_POST['team_force_font'])
110
+ ? $new_team_settings['_tmm_original_font'] = stripslashes(strip_tags(sanitize_text_field(wp_unslash($_POST['team_force_font']))))
111
+ : $new_team_settings['_tmm_original_font'] = '';
112
+ (isset($_POST['team_display_order']) && $_POST['team_display_order'])
113
+ ? $new_team_settings['_tmm_display_order'] = stripslashes(strip_tags(sanitize_text_field(wp_unslash($_POST['team_display_order']))))
114
+ : $new_team_settings['_tmm_display_order '] = '';
115
+ (isset($_POST['team_piclink_beh']) && $_POST['team_piclink_beh'])
116
+ ? $new_team_settings['_tmm_piclink_beh'] = stripslashes(strip_tags(sanitize_text_field(wp_unslash($_POST['team_piclink_beh']))))
117
+ : $new_team_settings['_tmm_piclink_beh'] = '';
118
+
119
+ /* Updates plans. */
120
+ if (!empty($new_team) && $new_team != $old_team)
121
+ update_post_meta($post_id, '_tmm_head', $new_team);
122
+ elseif (empty($new_team) && $old_team)
123
+ delete_post_meta($post_id, '_tmm_head', $old_team);
124
+
125
+ if (!empty($new_team_settings['_tmm_color']) && $new_team_settings['_tmm_color'] != $old_team_settings['_tmm_color'])
126
+ update_post_meta($post_id, '_tmm_color', $new_team_settings['_tmm_color']);
127
+
128
+ if (!empty($new_team_settings['_tmm_columns']) && $new_team_settings['_tmm_columns'] != $old_team_settings['_tmm_columns'])
129
+ update_post_meta($post_id, '_tmm_columns', $new_team_settings['_tmm_columns']);
130
+
131
+ if (!empty($new_team_settings['_tmm_bio_alignment']) && $new_team_settings['_tmm_bio_alignment'] != $old_team_settings['_tmm_bio_alignment'])
132
+ update_post_meta($post_id, '_tmm_bio_alignment', $new_team_settings['_tmm_bio_alignment']);
133
+
134
+ if (!empty($new_team_settings['_tmm_original_font']) && $new_team_settings['_tmm_original_font'] != $old_team_settings['_tmm_original_font'])
135
+ update_post_meta($post_id, '_tmm_original_font', $new_team_settings['_tmm_original_font']);
136
+
137
+ if (!empty($new_team_settings['_tmm_display_order']) && $new_team_settings['_tmm_display_order'] != $old_team_settings['_tmm_display_order'])
138
+ update_post_meta($post_id, '_tmm_display_order', $new_team_settings['_tmm_display_order']);
139
+
140
+ if (!empty($new_team_settings['_tmm_piclink_beh']) && $new_team_settings['_tmm_piclink_beh'] != $old_team_settings['_tmm_piclink_beh'])
141
+ update_post_meta($post_id, '_tmm_piclink_beh', $new_team_settings['_tmm_piclink_beh']);
142
+ }
inc/tmm-shortcode.php CHANGED
@@ -15,12 +15,18 @@ function tmm_sc($atts)
15
  $args = array('post_type' => 'tmm', 'name' => $name);
16
  $custom_posts = get_posts($args);
17
 
 
18
  foreach ($custom_posts as $post) : setup_postdata($post);
19
 
20
- $members = get_post_meta(get_the_id(), '_tmm_head', true);
21
- $tmm_columns = get_post_meta($post->ID, '_tmm_columns', true);
22
- $tmm_color = get_post_meta($post->ID, '_tmm_color', true);
23
  $tmm_bio_alignment = get_post_meta($post->ID, '_tmm_bio_alignment', true);
 
 
 
 
 
24
 
25
  /* Checks if member links open in new window. */
26
  $tmm_piclink_beh = get_post_meta($post->ID, '_tmm_piclink_beh', true);
@@ -38,7 +44,6 @@ function tmm_sc($atts)
38
  $ori_f = 'tmm_plugin_f';
39
  }
40
 
41
- $team_view = '';
42
  $team_view .= '<div class="tmm tmm_' . $name . '">';
43
  $team_view .= '<div class="tmm_' . $tmm_columns . '_columns tmm_wrap ' . $ori_f . '">';
44
 
15
  $args = array('post_type' => 'tmm', 'name' => $name);
16
  $custom_posts = get_posts($args);
17
 
18
+ $team_view = '';
19
  foreach ($custom_posts as $post) : setup_postdata($post);
20
 
21
+ $members = get_post_meta(get_the_id(), '_tmm_head', true);
22
+ $tmm_columns = get_post_meta($post->ID, '_tmm_columns', true);
23
+ $tmm_color = get_post_meta($post->ID, '_tmm_color', true);
24
  $tmm_bio_alignment = get_post_meta($post->ID, '_tmm_bio_alignment', true);
25
+ $tmm_display_order = get_post_meta($post->ID, '_tmm_display_order', true);
26
+
27
+ /* Shuffle the memebers array if option is set to random, */
28
+ if ($tmm_display_order === 'random')
29
+ shuffle($members);
30
 
31
  /* Checks if member links open in new window. */
32
  $tmm_piclink_beh = get_post_meta($post->ID, '_tmm_piclink_beh', true);
44
  $ori_f = 'tmm_plugin_f';
45
  }
46
 
 
47
  $team_view .= '<div class="tmm tmm_' . $name . '">';
48
  $team_view .= '<div class="tmm_' . $tmm_columns . '_columns tmm_wrap ' . $ori_f . '">';
49
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: spwebguy
3
  Tags: team, teams, meet the team, shortcode, responsive, members, staff, people
4
  Requires at least: 3.6
5
- Tested up to: 6.0
6
- Stable tag: 5.1.1
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
@@ -26,6 +26,7 @@ The free version of the Team Members plugin is **not limited**.
26
 
27
  = Available settings =
28
  * Number of members to show per line (1 to 5)
 
29
  * Color
30
 
31
  = PRO features =
@@ -93,6 +94,12 @@ Find help on [our support platform](https://wpdarko.com/support) for this plugin
93
  6. Finding the shortcode (admin view)
94
 
95
  == Changelog ==
 
 
 
 
 
 
96
  = 5.1.1 =
97
  * Security update
98
 
2
  Contributors: spwebguy
3
  Tags: team, teams, meet the team, shortcode, responsive, members, staff, people
4
  Requires at least: 3.6
5
+ Tested up to: 6.1
6
+ Stable tag: 5.2.1
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
26
 
27
  = Available settings =
28
  * Number of members to show per line (1 to 5)
29
+ * Display order (default/random)
30
  * Color
31
 
32
  = PRO features =
94
  6. Finding the shortcode (admin view)
95
 
96
  == Changelog ==
97
+ = 5.2.1 =
98
+ * Fixed minor vulnerability issue
99
+
100
+ = 5.2.0 =
101
+ * Added Display order feature
102
+
103
  = 5.1.1 =
104
  * Security update
105
 
tmm.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Team Members
5
  * Plugin URI: https://wpdarko.com/team-members
6
  * Description: A responsive, simple and clean way to display your team. Create new members, add their positions, bios, social links and copy-paste the shortcode into any post/page. Find help and information on our <a href="https://wpdarko.com/support">support site</a>. This free version is NOT limited and does not contain any ad. Check out the <a href='https://wpdarko.com/team-members'>PRO version</a> for more great features.
7
- * Version: 5.1.1
8
  * Author: WP Darko
9
  * Author URI: https://wpdarko.com
10
  * Text Domain: team-members
4
  * Plugin Name: Team Members
5
  * Plugin URI: https://wpdarko.com/team-members
6
  * Description: A responsive, simple and clean way to display your team. Create new members, add their positions, bios, social links and copy-paste the shortcode into any post/page. Find help and information on our <a href="https://wpdarko.com/support">support site</a>. This free version is NOT limited and does not contain any ad. Check out the <a href='https://wpdarko.com/team-members'>PRO version</a> for more great features.
7
+ * Version: 5.2.1
8
  * Author: WP Darko
9
  * Author URI: https://wpdarko.com
10
  * Text Domain: team-members