Clone Posts - Version 2.0.2

Version Description

  • Handle Warning about options not being an array
  • Resolve Notice about Undefined property
Download this release

Release Info

Developer pattihis
Plugin Icon 128x128 Clone Posts
Version 2.0.2
Comparing to
See all releases

Code changes from version 2.0.0 to 2.0.2

README.txt CHANGED
@@ -2,10 +2,10 @@
2
  Contributors: lukaszwebmaster, pattihis
3
  Donate link: https://profiles.wordpress.org/pattihis/
4
  Tags: clone posts, clone pages, clone post, clone page, clone, page cloning, post cloning, posts cloning, pages cloning, page copy, page copy paste, post copy, posts copy paste, copy pages, copy posts, copy and paste posts, copy and paste pages, clone, cloning, copy and paste
5
- Requires at least: 3.0.1
6
- Tested up to: 5.7
7
  Requires PHP: 5.6
8
- Stable tag: 2.0.0
9
  License: GPL2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -60,6 +60,13 @@ Of course! "Clone Posts" is compatible with any theme and plugin that follows Wo
60
 
61
  == Changelog ==
62
 
 
 
 
 
 
 
 
63
  = 2.0.0 =
64
  * Major update - compatible with WP 5.7.x
65
  * Feature: Compatible with Custom Post Types
2
  Contributors: lukaszwebmaster, pattihis
3
  Donate link: https://profiles.wordpress.org/pattihis/
4
  Tags: clone posts, clone pages, clone post, clone page, clone, page cloning, post cloning, posts cloning, pages cloning, page copy, page copy paste, post copy, posts copy paste, copy pages, copy posts, copy and paste posts, copy and paste pages, clone, cloning, copy and paste
5
+ Requires at least: 5.0
6
+ Tested up to: 5.9
7
  Requires PHP: 5.6
8
+ Stable tag: 2.0.2
9
  License: GPL2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
60
 
61
  == Changelog ==
62
 
63
+ = 2.0.2 =
64
+ * Handle Warning about options not being an array
65
+ * Resolve Notice about Undefined property
66
+
67
+ = 2.0.1 =
68
+ * Trailing comma bug - support earlier PHP versions
69
+
70
  = 2.0.0 =
71
  * Major update - compatible with WP 5.7.x
72
  * Feature: Compatible with Custom Post Types
admin/class-clone-posts-admin.php CHANGED
@@ -156,7 +156,7 @@ class Clone_Posts_Admin {
156
  register_setting(
157
  'clone_post_settings',
158
  'clone_posts_post_type',
159
- [$this,'clonePosts_sanitize_array'],
160
  );
161
 
162
  add_settings_field(
@@ -214,6 +214,9 @@ class Clone_Posts_Admin {
214
  */
215
  public function clonePosts_option_post_type() {
216
  $options = maybe_unserialize( get_option('clone_posts_post_type') );
 
 
 
217
  $exclude_cpt = ['attachment'];
218
  $post_types = get_post_types( array( 'public' => true, ), 'objects', 'and' );
219
  echo '<fieldset>';
@@ -255,6 +258,10 @@ class Clone_Posts_Admin {
255
  public function clonePosts_admin_footer() {
256
  $options = maybe_unserialize( get_option('clone_posts_post_type') );
257
 
 
 
 
 
258
  if ( !in_array( $GLOBALS['post_type'], $options ) ) {
259
  return;
260
  }
@@ -315,11 +322,11 @@ class Clone_Posts_Admin {
315
  foreach ( $post_ids as $post_id ) {
316
 
317
  if ( !current_user_can('edit_post', $post_id) ) {
318
- wp_die( __('You are not allowed to clone this post.', $plugin->get_plugin_name) );
319
  }
320
 
321
  if ( ! $this->clonePosts_clone_single( $post_id )) {
322
- wp_die( __('Error cloning post.', $plugin->get_plugin_name) );
323
  }
324
 
325
  $cloned++;
@@ -372,6 +379,10 @@ class Clone_Posts_Admin {
372
 
373
  $options = maybe_unserialize( get_option('clone_posts_post_type') );
374
 
 
 
 
 
375
  if ( !in_array( $post_type, $options ) ) {
376
  return $actions;
377
  }
@@ -384,7 +395,7 @@ class Clone_Posts_Admin {
384
  'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $url );
385
  $url = add_query_arg( array( 'action' => 'clone-single', 'post' => $post->ID, 'redirect' => $_SERVER['REQUEST_URI'] ), $url );
386
 
387
- $actions['clone'] = '<a href=\''.$url.'\'>'.__('Clone', $plugin->get_plugin_name).'</a>';
388
  return $actions;
389
  }
390
 
@@ -404,11 +415,11 @@ class Clone_Posts_Admin {
404
  $post_id = (int) $_GET['post'];
405
 
406
  if ( !current_user_can('edit_post', $post_id )) {
407
- wp_die( __('You are not allowed to clone this post.', $plugin->get_plugin_name) );
408
  }
409
 
410
  if ( !$this->clonePosts_clone_single( $post_id )) {
411
- wp_die( __('Error cloning post.', $plugin->get_plugin_name) );
412
  }
413
 
414
  $sendback = remove_query_arg( array( 'cloned', 'untrashed', 'deleted', 'ids' ), $_GET['redirect'] );
@@ -441,7 +452,7 @@ class Clone_Posts_Admin {
441
  'post_password' => $p->post_password,
442
  'post_excerpt' => $p->post_excerpt,
443
  'comment_status' => $p->comment_status,
444
- 'post_title' => $p->post_title . __('- clone', $plugin->get_plugin_name),
445
  'post_content' => $p->post_content,
446
  'post_author' => $p->post_author,
447
  'to_ping' => $p->to_ping,
156
  register_setting(
157
  'clone_post_settings',
158
  'clone_posts_post_type',
159
+ [$this,'clonePosts_sanitize_array']
160
  );
161
 
162
  add_settings_field(
214
  */
215
  public function clonePosts_option_post_type() {
216
  $options = maybe_unserialize( get_option('clone_posts_post_type') );
217
+ if ( !is_array($options) ) {
218
+ $options = ['post', 'page'];
219
+ }
220
  $exclude_cpt = ['attachment'];
221
  $post_types = get_post_types( array( 'public' => true, ), 'objects', 'and' );
222
  echo '<fieldset>';
258
  public function clonePosts_admin_footer() {
259
  $options = maybe_unserialize( get_option('clone_posts_post_type') );
260
 
261
+ if ( !is_array($options) ) {
262
+ $options = ['post', 'page'];
263
+ }
264
+
265
  if ( !in_array( $GLOBALS['post_type'], $options ) ) {
266
  return;
267
  }
322
  foreach ( $post_ids as $post_id ) {
323
 
324
  if ( !current_user_can('edit_post', $post_id) ) {
325
+ wp_die( __('You are not allowed to clone this post.', $plugin->get_plugin_name()) );
326
  }
327
 
328
  if ( ! $this->clonePosts_clone_single( $post_id )) {
329
+ wp_die( __('Error cloning post.', $plugin->get_plugin_name()) );
330
  }
331
 
332
  $cloned++;
379
 
380
  $options = maybe_unserialize( get_option('clone_posts_post_type') );
381
 
382
+ if ( !is_array($options) ) {
383
+ $options = ['post', 'page'];
384
+ }
385
+
386
  if ( !in_array( $post_type, $options ) ) {
387
  return $actions;
388
  }
395
  'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $url );
396
  $url = add_query_arg( array( 'action' => 'clone-single', 'post' => $post->ID, 'redirect' => $_SERVER['REQUEST_URI'] ), $url );
397
 
398
+ $actions['clone'] = '<a href=\''.$url.'\'>'.__('Clone', $plugin->get_plugin_name()).'</a>';
399
  return $actions;
400
  }
401
 
415
  $post_id = (int) $_GET['post'];
416
 
417
  if ( !current_user_can('edit_post', $post_id )) {
418
+ wp_die( __('You are not allowed to clone this post.', $plugin->get_plugin_name()) );
419
  }
420
 
421
  if ( !$this->clonePosts_clone_single( $post_id )) {
422
+ wp_die( __('Error cloning post.', $plugin->get_plugin_name()) );
423
  }
424
 
425
  $sendback = remove_query_arg( array( 'cloned', 'untrashed', 'deleted', 'ids' ), $_GET['redirect'] );
452
  'post_password' => $p->post_password,
453
  'post_excerpt' => $p->post_excerpt,
454
  'comment_status' => $p->comment_status,
455
+ 'post_title' => $p->post_title . __('- clone', $plugin->get_plugin_name()),
456
  'post_content' => $p->post_content,
457
  'post_author' => $p->post_author,
458
  'to_ping' => $p->to_ping,
clone-posts.php CHANGED
@@ -13,9 +13,9 @@
13
  * Plugin Name: Clone Posts
14
  * Plugin URI: http://wordpress.org/extend/plugins/clone-posts/
15
  * Description: Easily clone (duplicate) Posts, Pages and Custom Post Types, including their custom fields (post_meta).
16
- * Version: 2.0.0
17
- * Requires at least: 5.2
18
- * Requires PHP: 7.2
19
  * Author: George Pattihis
20
  * Author URI: https://profiles.wordpress.org/pattihis/
21
  * License: GPL-2.0+
@@ -65,7 +65,7 @@ if ( ! defined( 'WPINC' ) ) {
65
  /**
66
  * Current plugin version.
67
  */
68
- define( 'CLONE_POSTS_VERSION', '2.0.0' );
69
 
70
  /**
71
  * The code that runs during plugin activation.
13
  * Plugin Name: Clone Posts
14
  * Plugin URI: http://wordpress.org/extend/plugins/clone-posts/
15
  * Description: Easily clone (duplicate) Posts, Pages and Custom Post Types, including their custom fields (post_meta).
16
+ * Version: 2.0.2
17
+ * Requires at least: 5.0
18
+ * Requires PHP: 5.6
19
  * Author: George Pattihis
20
  * Author URI: https://profiles.wordpress.org/pattihis/
21
  * License: GPL-2.0+
65
  /**
66
  * Current plugin version.
67
  */
68
+ define( 'CLONE_POSTS_VERSION', '2.0.1' );
69
 
70
  /**
71
  * The code that runs during plugin activation.
includes/class-clone-posts.php CHANGED
@@ -70,7 +70,7 @@ class Clone_Posts {
70
  if ( defined( 'CLONE_POSTS_VERSION' ) ) {
71
  $this->version = CLONE_POSTS_VERSION;
72
  } else {
73
- $this->version = '2.0.0';
74
  }
75
  $this->plugin_name = 'clone-posts';
76
 
70
  if ( defined( 'CLONE_POSTS_VERSION' ) ) {
71
  $this->version = CLONE_POSTS_VERSION;
72
  } else {
73
+ $this->version = '2.0.1';
74
  }
75
  $this->plugin_name = 'clone-posts';
76