Post Duplicator - Version 2.24

Version Description

  • Settings sanitization updates
Download this release

Release Info

Developer metaphorcreations
Plugin Icon 128x128 Post Duplicator
Version 2.24
Comparing to
See all releases

Code changes from version 2.23 to 2.24

Files changed (3) hide show
  1. includes/settings.php +26 -1
  2. m4c-postduplicator.php +2 -2
  3. readme.txt +5 -2
includes/settings.php CHANGED
@@ -163,7 +163,32 @@ function mtphr_post_duplicator_initialize_settings() {
163
  }
164
 
165
  // Register the fields with WordPress
166
- register_setting( 'mtphr_post_duplicator_settings', 'mtphr_post_duplicator_settings' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
168
 
169
 
163
  }
164
 
165
  // Register the fields with WordPress
166
+ register_setting( 'mtphr_post_duplicator_settings', 'mtphr_post_duplicator_settings', 'mtphr_post_duplicator_settings_sanitize' );
167
+ }
168
+
169
+
170
+ /**
171
+ * Sanitize the settings
172
+ *
173
+ * @since 2.0
174
+ */
175
+ function mtphr_post_duplicator_settings_sanitize( $fields ) {
176
+ $sanitized_fields = array(
177
+ 'post_duplication' => isset( $fields['post_duplication'] ) ? esc_attr( $fields['post_duplication'] ) : 'all_users',
178
+ 'post_author' => isset( $fields['post_author'] ) ? esc_attr( $fields['post_author'] ) : 'current_user',
179
+ 'status' => isset( $fields['status'] ) ? esc_attr( $fields['status'] ) : 'draft',
180
+ 'type' => isset( $fields['type'] ) ? esc_attr( $fields['type'] ) : 'same',
181
+ 'timestamp' => isset( $fields['timestamp'] ) ? esc_attr( $fields['timestamp'] ) : 'current',
182
+ 'title' => isset( $fields['title'] ) ? sanitize_text_field( $fields['title'] ) : '',
183
+ 'slug' => isset( $fields['slug'] ) ? sanitize_text_field( $fields['slug'] ) : '',
184
+ 'time_offset' => isset( $fields['time_offset'] ) ? esc_attr( $fields['time_offset'] ) : false,
185
+ 'time_offset_days' => isset( $fields['time_offset_days'] ) ? intval( $fields['time_offset_days'] ) : 0,
186
+ 'time_offset_hours' => isset( $fields['time_offset_hours'] ) ? intval( $fields['time_offset_hours'] ) : 0,
187
+ 'time_offset_minutes' => isset( $fields['time_offset_minutes'] ) ? intval( $fields['time_offset_minutes'] ) : 0,
188
+ 'time_offset_seconds' => isset( $fields['time_otime_offset_secondsffset'] ) ? intval( $fields['time_offset_seconds'] ) : 0,
189
+ 'time_offset_direction' => isset( $fields['time_offset_direction'] ) ? esc_attr( $fields['time_offset_direction'] ) : 'newer',
190
+ );
191
+ return $sanitized_fields;
192
  }
193
 
194
 
m4c-postduplicator.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Post Duplicator
4
  Description: Creates functionality to duplicate any and all post types, including taxonomies & custom fields
5
- Version: 2.23
6
  Author: Metaphor Creations
7
  Author URI: http://www.metaphorcreations.com
8
  Text Domain: post-duplicator
@@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30
 
31
 
32
  /**Define Widget Constants */
33
- define ( 'MTPHR_POST_DUPLICATOR_VERSION', '2.23' );
34
  define ( 'MTPHR_POST_DUPLICATOR_DIR', plugin_dir_path(__FILE__) );
35
 
36
 
2
  /*
3
  Plugin Name: Post Duplicator
4
  Description: Creates functionality to duplicate any and all post types, including taxonomies & custom fields
5
+ Version: 2.24
6
  Author: Metaphor Creations
7
  Author URI: http://www.metaphorcreations.com
8
  Text Domain: post-duplicator
30
 
31
 
32
  /**Define Widget Constants */
33
+ define ( 'MTPHR_POST_DUPLICATOR_VERSION', '2.24' );
34
  define ( 'MTPHR_POST_DUPLICATOR_DIR', plugin_dir_path(__FILE__) );
35
 
36
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: metaphorcreations
3
  Tags: posts, post, duplicate, duplication
4
  Requires at least: 4.0
5
- Tested up to: 5.7.2
6
  Stable tag: /trunk/
7
  License: GPL2
8
 
@@ -41,6 +41,9 @@ Check out the 'Installation' tab.
41
 
42
  == Changelog ==
43
 
 
 
 
44
  = 2.23 =
45
  * Added setting to limit post duplication to current user
46
  * Added setting to setup duplicated post author to current user
@@ -135,4 +138,4 @@ Must upgrade in order for the plugin to work. The file paths where initially wro
135
 
136
  == Upgrade Notice ==
137
 
138
- Set the default setting of duplicated post author to current user and added additional settings
2
  Contributors: metaphorcreations
3
  Tags: posts, post, duplicate, duplication
4
  Requires at least: 4.0
5
+ Tested up to: 5.8.2
6
  Stable tag: /trunk/
7
  License: GPL2
8
 
41
 
42
  == Changelog ==
43
 
44
+ = 2.24 =
45
+ * Settings sanitization updates
46
+
47
  = 2.23 =
48
  * Added setting to limit post duplication to current user
49
  * Added setting to setup duplicated post author to current user
138
 
139
  == Upgrade Notice ==
140
 
141
+ Settings sanitization updates