Duplicate Post - Version 1.1.1

Version Description

  • Fixed some warnings and notices in PHP 7
  • Added new variable CDP_SHOW_SITE_URLS (for wp-config)
Download this release

Release Info

Developer copydelete
Plugin Icon wp plugin Duplicate Post
Version 1.1.1
Comparing to
See all releases

Code changes from version 1.1.0 to 1.1.1

assets/imgs/intro_3.jpg ADDED
Binary file
copy-delete-posts.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Copy & Delete Posts
4
  * Plugin URI: https://copy-delete-posts.com
5
  * Description: The best solution to easily make duplicates of your posts & pages, and delete them in one go.
6
- * Version: 1.1.0
7
  * Author: Copy Delete Posts
8
  * Author URI: https://copy-delete-posts.com/
9
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,7 +17,7 @@ if (!defined('ABSPATH')) exit;
17
  */
18
 
19
  // Plugin constants
20
- define('CDP_VERSION', '1.1.0');
21
  define('CDP_WP_VERSION', get_bloginfo('version'));
22
  define('CDP_SCRIPT_DEBUG', false);
23
  $cdp_plug_url = plugins_url('', __FILE__);
@@ -170,8 +170,8 @@ if (!defined('ABSPATH')) exit;
170
  $allowed = ['post', 'edit-post', 'toplevel_page_copy-delete-posts', 'edit-page', 'page'];
171
  $at = ($screen->id != 'attachment');
172
 
173
- $g = get_option('_cdp_globals');
174
- if ($g['others']) $g = $g['others'];
175
  else $g = cdp_default_global_options();
176
 
177
  if (is_object($post)) $type = $post->post_type;
@@ -186,7 +186,7 @@ if (!defined('ABSPATH')) exit;
186
  wp_enqueue_script('cdp-tooltips', "{$cdp_plug_url}/assets/js/cdp.tooltip{$min}.js", '', $ver, true);
187
  if (method_exists($screen, 'is_block_editor')) {
188
  if (!$screen->is_block_editor() && $pagenow == 'post.php' && $at) {
189
- if ($g['cdp-display-edit'] == 'true') {
190
  $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
191
  $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
192
  $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
@@ -244,14 +244,16 @@ if (!defined('ABSPATH')) exit;
244
  global $cdp_plug_url;
245
  $min = defined('CDP_SCRIPT_DEBUG') && CDP_SCRIPT_DEBUG ? '' : '.min';
246
 
247
- $g = get_option('_cdp_globals')['others'];
 
 
248
 
249
  $ver = preg_replace('#[^\pL\pN/-]+#', '', CDP_VERSION);
250
  if (is_object($post)) $type = $post->post_type; else $type = false;
251
  $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
252
  $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
253
  $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
254
- if ($g['cdp-display-gutenberg'] == 'true' && ($a || $b || $c)) {
255
  wp_enqueue_style('cdp-gutenberg', "{$cdp_plug_url}/assets/css/cdp-gutenberg{$min}.css", '', $ver);
256
  wp_enqueue_script('cdp-js-gutenberg', "{$cdp_plug_url}/assets/js/cdp-gutenberg{$min}.js", ['jquery'], $ver, true);
257
  }
@@ -287,11 +289,13 @@ if (!defined('ABSPATH')) exit;
287
  if (cdp_check_permissions(wp_get_current_user()) == false) return $actions;
288
 
289
  // Get global options and post type
290
- $g = get_option('_cdp_globals')['others'];
 
 
291
  $type = $post->post_type;
292
 
293
  // If user want to see the copy buton here pass
294
- if ($g['cdp-display-posts'] == 'true')
295
  if (($type == 'post' && $g['cdp-content-posts'] == 'true') || ($type != 'post' && $g['cdp-content-custom'] == 'true'))
296
  $actions['cdp_copy'] = "<a href='#'><span class='cdp-copy-button cdp-tooltip-copy' x='".$type."' title='test' data-cdp-id='{$post->ID}'>Copy</span></a>";
297
 
@@ -307,11 +311,13 @@ if (!defined('ABSPATH')) exit;
307
  if (cdp_check_permissions(wp_get_current_user()) == false) return;
308
 
309
  // Get global options and post type
310
- $g = get_option('_cdp_globals')['others'];
 
 
311
  $type = $page->post_type;
312
 
313
  // If user want to see the copy buton here pass
314
- if ($g['cdp-display-posts'] == 'true')
315
  if (($type == 'page' && $g['cdp-content-pages'] == 'true') || ($type != 'page' && $g['cdp-content-custom'] == 'true'))
316
  $actions['cdp_copy'] = "<a href='#'><span class='cdp-copy-button cdp-tooltip-copy' title='test' data-cdp-id='{$page->ID}'>Copy</span></a>";
317
 
@@ -326,8 +332,11 @@ if (!defined('ABSPATH')) exit;
326
  add_filter('bulk_actions-edit-post', function ($bulk_actions) {
327
  if (cdp_check_permissions(wp_get_current_user()) == false) return;
328
 
329
- $g = get_option('_cdp_globals')['others'];
330
- if ($g['cdp-display-bulk'] == 'true') $bulk_actions['cdp_bulk_copy'] = 'Copy';
 
 
 
331
 
332
  return $bulk_actions;
333
  });
@@ -340,8 +349,11 @@ if (!defined('ABSPATH')) exit;
340
  add_filter('bulk_actions-edit-page', function ($bulk_actions) {
341
  if (cdp_check_permissions(wp_get_current_user()) == false) return;
342
 
343
- $g = get_option('_cdp_globals')['others'];
344
- if ($g['cdp-display-bulk'] == 'true') $bulk_actions['cdp_bulk_copy'] = 'Copy';
 
 
 
345
 
346
  return $bulk_actions;
347
  });
@@ -358,7 +370,9 @@ if (!defined('ABSPATH')) exit;
358
 
359
  if (!(is_single() || is_page() || (isset($screen) && ($screen != false && in_array($screen->id, $screens))))) return;
360
 
361
- $g = get_option('_cdp_globals')['others'];
 
 
362
 
363
  global $post;
364
  if (is_object($post)) $type = $post->post_type; else $type = false;
@@ -366,7 +380,7 @@ if (!defined('ABSPATH')) exit;
366
  $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
367
  $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
368
 
369
- if ($g['cdp-display-admin'] == 'false') return;
370
  global $cdp_plug_url;
371
 
372
  if ($a || $b || $c) {
@@ -427,8 +441,11 @@ if (!defined('ABSPATH')) exit;
427
  add_action('wp_footer', function () {
428
  if (cdp_check_permissions(wp_get_current_user()) == false) return;
429
 
430
- $g = get_option('_cdp_globals')['others'];
431
- if ($g['cdp-display-admin'] == 'false') return;
 
 
 
432
 
433
  global $cdp_plug_url, $post;
434
 
@@ -500,8 +517,10 @@ if (!defined('ABSPATH')) exit;
500
  */
501
  add_action('post_submitbox_start', function () {
502
  if (cdp_check_permissions(wp_get_current_user()) == false) return;
503
- $g = get_option('_cdp_globals')['others'];
504
- if ($g['cdp-display-edit'] == 'false') return;
 
 
505
 
506
  global $post, $pagenow;
507
  if (is_object($post)) $type = $post->post_type; else $type = false;
3
  * Plugin Name: Copy & Delete Posts
4
  * Plugin URI: https://copy-delete-posts.com
5
  * Description: The best solution to easily make duplicates of your posts & pages, and delete them in one go.
6
+ * Version: 1.1.1
7
  * Author: Copy Delete Posts
8
  * Author URI: https://copy-delete-posts.com/
9
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
17
  */
18
 
19
  // Plugin constants
20
+ define('CDP_VERSION', '1.1.1');
21
  define('CDP_WP_VERSION', get_bloginfo('version'));
22
  define('CDP_SCRIPT_DEBUG', false);
23
  $cdp_plug_url = plugins_url('', __FILE__);
170
  $allowed = ['post', 'edit-post', 'toplevel_page_copy-delete-posts', 'edit-page', 'page'];
171
  $at = ($screen->id != 'attachment');
172
 
173
+ $g = get_option('_cdp_globals', array());
174
+ if (array_key_exists('others', $g)) $g = $g['others'];
175
  else $g = cdp_default_global_options();
176
 
177
  if (is_object($post)) $type = $post->post_type;
186
  wp_enqueue_script('cdp-tooltips', "{$cdp_plug_url}/assets/js/cdp.tooltip{$min}.js", '', $ver, true);
187
  if (method_exists($screen, 'is_block_editor')) {
188
  if (!$screen->is_block_editor() && $pagenow == 'post.php' && $at) {
189
+ if (isset($g['cdp-display-edit']) && $g['cdp-display-edit'] == 'true') {
190
  $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
191
  $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
192
  $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
244
  global $cdp_plug_url;
245
  $min = defined('CDP_SCRIPT_DEBUG') && CDP_SCRIPT_DEBUG ? '' : '.min';
246
 
247
+ $g = get_option('_cdp_globals', array());
248
+ if (array_key_exists('others', $g)) $g = $g['others'];
249
+ else $g = cdp_default_global_options();
250
 
251
  $ver = preg_replace('#[^\pL\pN/-]+#', '', CDP_VERSION);
252
  if (is_object($post)) $type = $post->post_type; else $type = false;
253
  $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
254
  $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
255
  $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
256
+ if ((isset($g['cdp-display-gutenberg']) && $g['cdp-display-gutenberg'] == 'true') && ($a || $b || $c)) {
257
  wp_enqueue_style('cdp-gutenberg', "{$cdp_plug_url}/assets/css/cdp-gutenberg{$min}.css", '', $ver);
258
  wp_enqueue_script('cdp-js-gutenberg', "{$cdp_plug_url}/assets/js/cdp-gutenberg{$min}.js", ['jquery'], $ver, true);
259
  }
289
  if (cdp_check_permissions(wp_get_current_user()) == false) return $actions;
290
 
291
  // Get global options and post type
292
+ $g = get_option('_cdp_globals', array());
293
+ if (array_key_exists('others', $g)) $g = $g['others'];
294
+ else $g = cdp_default_global_options();
295
  $type = $post->post_type;
296
 
297
  // If user want to see the copy buton here pass
298
+ if (isset($g['cdp-display-posts']) && $g['cdp-display-posts'] == 'true')
299
  if (($type == 'post' && $g['cdp-content-posts'] == 'true') || ($type != 'post' && $g['cdp-content-custom'] == 'true'))
300
  $actions['cdp_copy'] = "<a href='#'><span class='cdp-copy-button cdp-tooltip-copy' x='".$type."' title='test' data-cdp-id='{$post->ID}'>Copy</span></a>";
301
 
311
  if (cdp_check_permissions(wp_get_current_user()) == false) return;
312
 
313
  // Get global options and post type
314
+ $g = get_option('_cdp_globals', array());
315
+ if (array_key_exists('others', $g)) $g = $g['others'];
316
+ else $g = cdp_default_global_options();
317
  $type = $page->post_type;
318
 
319
  // If user want to see the copy buton here pass
320
+ if (isset($g['cdp-display-posts']) && $g['cdp-display-posts'] == 'true')
321
  if (($type == 'page' && $g['cdp-content-pages'] == 'true') || ($type != 'page' && $g['cdp-content-custom'] == 'true'))
322
  $actions['cdp_copy'] = "<a href='#'><span class='cdp-copy-button cdp-tooltip-copy' title='test' data-cdp-id='{$page->ID}'>Copy</span></a>";
323
 
332
  add_filter('bulk_actions-edit-post', function ($bulk_actions) {
333
  if (cdp_check_permissions(wp_get_current_user()) == false) return;
334
 
335
+ $g = get_option('_cdp_globals', array());
336
+ if (array_key_exists('others', $g)) $g = $g['others'];
337
+ else $g = cdp_default_global_options();
338
+
339
+ if (isset($g['cdp-display-bulk']) && $g['cdp-display-bulk'] == 'true') $bulk_actions['cdp_bulk_copy'] = 'Copy';
340
 
341
  return $bulk_actions;
342
  });
349
  add_filter('bulk_actions-edit-page', function ($bulk_actions) {
350
  if (cdp_check_permissions(wp_get_current_user()) == false) return;
351
 
352
+ $g = get_option('_cdp_globals', array());
353
+ if (array_key_exists('others', $g)) $g = $g['others'];
354
+ else $g = cdp_default_global_options();
355
+
356
+ if (isset($g['cdp-display-bulk']) && $g['cdp-display-bulk'] == 'true') $bulk_actions['cdp_bulk_copy'] = 'Copy';
357
 
358
  return $bulk_actions;
359
  });
370
 
371
  if (!(is_single() || is_page() || (isset($screen) && ($screen != false && in_array($screen->id, $screens))))) return;
372
 
373
+ $g = get_option('_cdp_globals', array());
374
+ if (array_key_exists('others', $g)) $g = $g['others'];
375
+ else $g = cdp_default_global_options();
376
 
377
  global $post;
378
  if (is_object($post)) $type = $post->post_type; else $type = false;
380
  $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
381
  $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
382
 
383
+ if (isset($g['cdp-display-admin']) && $g['cdp-display-admin'] == 'false') return;
384
  global $cdp_plug_url;
385
 
386
  if ($a || $b || $c) {
441
  add_action('wp_footer', function () {
442
  if (cdp_check_permissions(wp_get_current_user()) == false) return;
443
 
444
+ $g = get_option('_cdp_globals', array());
445
+ if (array_key_exists('others', $g)) $g = $g['others'];
446
+ else $g = cdp_default_global_options();
447
+
448
+ if (isset($g['cdp-display-admin']) && $g['cdp-display-admin'] == 'false') return;
449
 
450
  global $cdp_plug_url, $post;
451
 
517
  */
518
  add_action('post_submitbox_start', function () {
519
  if (cdp_check_permissions(wp_get_current_user()) == false) return;
520
+ $g = get_option('_cdp_globals', array());
521
+ if (array_key_exists('others', $g)) $g = $g['others'];
522
+ else $g = cdp_default_global_options();
523
+ if (isset($g['cdp-display-edit']) && $g['cdp-display-edit'] == 'false') return;
524
 
525
  global $post, $pagenow;
526
  if (is_object($post)) $type = $post->post_type; else $type = false;
menu/configuration.php CHANGED
@@ -43,7 +43,11 @@ function cdp_configuration() {
43
  $no_intro = (get_option('_cdp_no_intro')) ? get_option('_cdp_no_intro') : array();
44
  $has_intro = !in_array($user_id, $no_intro) || false;
45
  $profiles = get_option('_cdp_profiles');
46
- $defaults = get_option('_cdp_profiles')['default'];
 
 
 
 
47
  $globals = get_option('_cdp_globals');
48
  $roles = get_editable_roles();
49
 
@@ -56,7 +60,7 @@ function cdp_configuration() {
56
  $names_format = false;
57
  $after_copy = false;
58
  $post_converter = false;
59
- $gos = false;
60
  if (isset($defaults['names']))
61
  if (isset($defaults['names']['format'])) $names_format = intval($defaults['names']['format']);
62
 
@@ -66,6 +70,8 @@ function cdp_configuration() {
66
  if (isset($globals['others'])) $gos = $globals['others'];
67
  }
68
 
 
 
69
  // Ask for pro features
70
  $areWePro = areWePro();
71
 
@@ -156,7 +162,7 @@ function cdp_configuration() {
156
  </div>
157
  <select class="cdp-left cdp-profile-selected cdp-select-styled cdp-select cdp-select-padding cdp-ow-border cdp-f-s-19 cdp-color-p-i<?php echo ((!$areWePro)?' cdp-premium-in-select':''); ?>">
158
  <?php
159
- $preSelProf = get_option('_cdp_preselections')[get_current_user_id()];
160
  if ($profiles != false && $areWePro) {
161
  foreach ($profiles as $profile => $vals):
162
  $isSel = ($preSelProf == $profile);
43
  $no_intro = (get_option('_cdp_no_intro')) ? get_option('_cdp_no_intro') : array();
44
  $has_intro = !in_array($user_id, $no_intro) || false;
45
  $profiles = get_option('_cdp_profiles');
46
+
47
+ $defaults = get_option('_cdp_profiles');
48
+ if ($defaults && array_key_exists('default', $defaults)) $defaults = $defaults['default'];
49
+ else $defaults = cdp_default_options();
50
+
51
  $globals = get_option('_cdp_globals');
52
  $roles = get_editable_roles();
53
 
60
  $names_format = false;
61
  $after_copy = false;
62
  $post_converter = false;
63
+ $gos = cdp_default_global_options();
64
  if (isset($defaults['names']))
65
  if (isset($defaults['names']['format'])) $names_format = intval($defaults['names']['format']);
66
 
70
  if (isset($globals['others'])) $gos = $globals['others'];
71
  }
72
 
73
+ if (!array_key_exists('cdp-display-bulk', $gos)) $gos = cdp_default_global_options();
74
+
75
  // Ask for pro features
76
  $areWePro = areWePro();
77
 
162
  </div>
163
  <select class="cdp-left cdp-profile-selected cdp-select-styled cdp-select cdp-select-padding cdp-ow-border cdp-f-s-19 cdp-color-p-i<?php echo ((!$areWePro)?' cdp-premium-in-select':''); ?>">
164
  <?php
165
+ $preSelProf = get_option('_cdp_preselections')[intval(get_current_user_id())];
166
  if ($profiles != false && $areWePro) {
167
  foreach ($profiles as $profile => $vals):
168
  $isSel = ($preSelProf == $profile);
menu/modal.php CHANGED
@@ -47,7 +47,7 @@ function cdp_modal($screen = '', $profiles = array()) {
47
  <div class="cdp-right" style="width: calc(100% - 200px) !important; text-align: right !important;">
48
  <div class="cdp-cf cdp-inline" style="line-height: 40px">
49
  <div class="cdp-left cdp-f-s-16">Use as basis settings</div>
50
- <?php $gepres = get_option('_cdp_preselections'); if (array_key_exists(get_current_user_id(), $gepres)) $preSelProf = $gepres[get_current_user_id()]; else $preSelProf = 0; ?>
51
  <select class="cdp-left cdp-modal-select cdp-ow-border cdp-input-dynamic cdp-modal-input-profiles-r cdp-select cdp-m-l-9-d" name="tooltip-which-profile-second">
52
  <option value="custom"<?php echo (array_key_exists($preSelProf, $profiles) && !$profiles[$preSelProf])?' selected':''?> disabled>–– Select ––</option>
53
  <option value="clear">Clean slate</option>
47
  <div class="cdp-right" style="width: calc(100% - 200px) !important; text-align: right !important;">
48
  <div class="cdp-cf cdp-inline" style="line-height: 40px">
49
  <div class="cdp-left cdp-f-s-16">Use as basis settings</div>
50
+ <?php $gepres = get_option('_cdp_preselections', array()); if (array_key_exists(get_current_user_id(), $gepres)) $preSelProf = $gepres[get_current_user_id()]; else $preSelProf = 0; ?>
51
  <select class="cdp-left cdp-modal-select cdp-ow-border cdp-input-dynamic cdp-modal-input-profiles-r cdp-select cdp-m-l-9-d" name="tooltip-which-profile-second">
52
  <option value="custom"<?php echo (array_key_exists($preSelProf, $profiles) && !$profiles[$preSelProf])?' selected':''?> disabled>–– Select ––</option>
53
  <option value="clear">Clean slate</option>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: CopyDeletePosts, copydelete
3
  Tags: Copy page, Copy post, Duplicate pages, Duplicate posts, Clone pages, Clone posts, Delete pages, Delete posts, Duplicate post, Duplicator, Copy pages, Copy posts
4
  Requires at least: 4.6
5
  Tested up to: 5.5.1
6
- Stable tag: 1.1.0
7
  License: GPLv3
8
  Requires PHP: 5.6
9
 
@@ -147,6 +147,10 @@ Copy Delete Posts WordPress plugin doesn’t store any site visitor information
147
 
148
  == Changelog ==
149
 
 
 
 
 
150
  = 1.1.0 =
151
  * Tested stability up to WordPress 5.5.1
152
  * Adjusted icon display / position
3
  Tags: Copy page, Copy post, Duplicate pages, Duplicate posts, Clone pages, Clone posts, Delete pages, Delete posts, Duplicate post, Duplicator, Copy pages, Copy posts
4
  Requires at least: 4.6
5
  Tested up to: 5.5.1
6
+ Stable tag: 1.1.1
7
  License: GPLv3
8
  Requires PHP: 5.6
9
 
147
 
148
  == Changelog ==
149
 
150
+ = 1.1.1 =
151
+ * Fixed some warnings and notices in PHP 7
152
+ * Added new variable CDP_SHOW_SITE_URLS (for wp-config)
153
+
154
  = 1.1.0 =
155
  * Tested stability up to WordPress 5.5.1
156
  * Adjusted icon display / position