Duplicate Post - Version 3.2.5

Version Description

First release from Yoast + accessibility improvements + filter deprecated

Download this release

Release Info

Developer lopo
Plugin Icon 128x128 Duplicate Post
Version 3.2.5
Comparing to
See all releases

Code changes from version 3.2.4 to 3.2.5

compat/duplicate-post-jetpack.php CHANGED
@@ -3,20 +3,20 @@ add_action( 'admin_init', 'duplicate_post_jetpack_init' );
3
 
4
 
5
  function duplicate_post_jetpack_init() {
6
- add_filter('duplicate_post_blacklist_filter', 'duplicate_post_jetpack_add_to_blacklist', 10, 1 );
7
-
8
  if (class_exists('WPCom_Markdown')){
9
  add_action('duplicate_post_pre_copy', 'duplicate_post_jetpack_disable_markdown', 10);
10
  add_action('duplicate_post_post_copy', 'duplicate_post_jetpack_enable_markdown', 10);
11
- }
12
  }
13
 
14
- function duplicate_post_jetpack_add_to_blacklist($meta_blacklist) {
15
  $meta_blacklist[] = '_wpas*'; //Jetpack Publicize
16
  $meta_blacklist[] = '_publicize*'; //Jetpack Publicize
17
-
18
  $meta_blacklist[] = '_jetpack*'; //Jetpack Subscriptions etc.
19
-
20
  return $meta_blacklist;
21
  }
22
 
@@ -27,4 +27,4 @@ function duplicate_post_jetpack_disable_markdown(){
27
 
28
  function duplicate_post_jetpack_enable_markdown(){
29
  WPCom_Markdown::get_instance()->load_markdown_for_posts();
30
- }
3
 
4
 
5
  function duplicate_post_jetpack_init() {
6
+ add_filter('duplicate_post_excludelist_filter', 'duplicate_post_jetpack_add_to_excludelist', 10, 1 );
7
+
8
  if (class_exists('WPCom_Markdown')){
9
  add_action('duplicate_post_pre_copy', 'duplicate_post_jetpack_disable_markdown', 10);
10
  add_action('duplicate_post_post_copy', 'duplicate_post_jetpack_enable_markdown', 10);
11
+ }
12
  }
13
 
14
+ function duplicate_post_jetpack_add_to_excludelist($meta_blacklist) {
15
  $meta_blacklist[] = '_wpas*'; //Jetpack Publicize
16
  $meta_blacklist[] = '_publicize*'; //Jetpack Publicize
17
+
18
  $meta_blacklist[] = '_jetpack*'; //Jetpack Subscriptions etc.
19
+
20
  return $meta_blacklist;
21
  }
22
 
27
 
28
  function duplicate_post_jetpack_enable_markdown(){
29
  WPCom_Markdown::get_instance()->load_markdown_for_posts();
30
+ }
duplicate-post-admin.php CHANGED
@@ -27,12 +27,12 @@ add_action('admin_init','duplicate_post_admin_init');
27
 
28
  function duplicate_post_admin_init(){
29
  duplicate_post_plugin_upgrade();
30
-
31
  if (get_option('duplicate_post_show_row') == 1){
32
  add_filter('post_row_actions', 'duplicate_post_make_duplicate_link_row',10,2);
33
  add_filter('page_row_actions', 'duplicate_post_make_duplicate_link_row',10,2);
34
  }
35
-
36
  if (get_site_option('duplicate_post_show_notice') == 1){
37
  if(is_multisite()){
38
  add_action( 'network_admin_notices', 'duplicate_post_show_update_notice' );
@@ -41,7 +41,7 @@ function duplicate_post_admin_init(){
41
  }
42
  add_action( 'wp_ajax_duplicate_post_dismiss_notice', 'duplicate_post_dismiss_notice' );
43
  }
44
-
45
  if (get_option('duplicate_post_show_submitbox') == 1){
46
  add_action( 'post_submitbox_start', 'duplicate_post_add_duplicate_post_button' );
47
  }
@@ -64,34 +64,34 @@ function duplicate_post_admin_init(){
64
  */
65
  add_action('admin_action_duplicate_post_save_as_new_post', 'duplicate_post_save_as_new_post');
66
  add_action('admin_action_duplicate_post_save_as_new_post_draft', 'duplicate_post_save_as_new_post_draft');
67
-
68
  add_filter('removable_query_args', 'duplicate_post_add_removable_query_arg', 10, 1);
69
-
70
  // Using our action hooks
71
-
72
  add_action('dp_duplicate_post', 'duplicate_post_copy_post_meta_info', 10, 2);
73
  add_action('dp_duplicate_page', 'duplicate_post_copy_post_meta_info', 10, 2);
74
-
75
  if(get_option('duplicate_post_copychildren') == 1){
76
  add_action('dp_duplicate_post', 'duplicate_post_copy_children', 20, 3);
77
  add_action('dp_duplicate_page', 'duplicate_post_copy_children', 20, 3);
78
  }
79
-
80
  if(get_option('duplicate_post_copyattachments') == 1){
81
  add_action('dp_duplicate_post', 'duplicate_post_copy_attachments', 30, 2);
82
  add_action('dp_duplicate_page', 'duplicate_post_copy_attachments', 30, 2);
83
  }
84
-
85
  if(get_option('duplicate_post_copycomments') == 1){
86
  add_action('dp_duplicate_post', 'duplicate_post_copy_comments', 40, 2);
87
  add_action('dp_duplicate_page', 'duplicate_post_copy_comments', 40, 2);
88
  }
89
-
90
  add_action('dp_duplicate_post', 'duplicate_post_copy_post_taxonomies', 50, 2);
91
  add_action('dp_duplicate_page', 'duplicate_post_copy_post_taxonomies', 50, 2);
92
-
93
  add_filter('plugin_row_meta', 'duplicate_post_add_plugin_links', 10, 2);
94
-
95
  add_action( 'admin_notices', 'duplicate_post_action_admin_notice' );
96
  }
97
 
@@ -101,18 +101,18 @@ function duplicate_post_admin_init(){
101
  */
102
  function duplicate_post_plugin_upgrade() {
103
  $installed_version = duplicate_post_get_installed_version();
104
-
105
  if ( $installed_version == duplicate_post_get_current_version() )
106
  return;
107
 
108
-
109
  if (empty($installed_version)) {
110
  // Get default roles
111
  $default_roles = array(
112
  3 => 'editor',
113
  8 => 'administrator',
114
  );
115
-
116
  // Cycle all roles and assign capability if its level >= duplicate_post_copy_user_level
117
  foreach ($default_roles as $level => $name){
118
  $role = get_role($name);
@@ -120,7 +120,7 @@ function duplicate_post_plugin_upgrade() {
120
  }
121
  } else {
122
  $min_user_level = get_option('duplicate_post_copy_user_level');
123
-
124
  if (!empty($min_user_level)){
125
  // Get default roles
126
  $default_roles = array(
@@ -129,7 +129,7 @@ function duplicate_post_plugin_upgrade() {
129
  3 => 'editor',
130
  8 => 'administrator',
131
  );
132
-
133
  // Cycle all roles and assign capability if its level >= duplicate_post_copy_user_level
134
  foreach ($default_roles as $level => $name){
135
  $role = get_role($name);
@@ -139,8 +139,8 @@ function duplicate_post_plugin_upgrade() {
139
  delete_option('duplicate_post_copy_user_level');
140
  }
141
  }
142
-
143
-
144
  add_option('duplicate_post_copytitle','1');
145
  add_option('duplicate_post_copydate','0');
146
  add_option('duplicate_post_copystatus','0');
@@ -166,7 +166,7 @@ function duplicate_post_plugin_upgrade() {
166
  add_option('duplicate_post_show_original_column','0');
167
  add_option('duplicate_post_show_original_in_post_states','0');
168
  add_option('duplicate_post_show_original_meta_box','0');
169
-
170
  $taxonomies_blacklist = get_option('duplicate_post_taxonomies_blacklist');
171
  if ($taxonomies_blacklist == "") $taxonomies_blacklist = array();
172
  if(in_array('post_format',$taxonomies_blacklist)){
@@ -174,14 +174,14 @@ function duplicate_post_plugin_upgrade() {
174
  $taxonomies_blacklist = array_diff($taxonomies_blacklist, array('post_format'));
175
  update_option('duplicate_post_taxonomies_blacklist', $taxonomies_blacklist);
176
  }
177
-
178
  $meta_blacklist = explode(",",get_option('duplicate_post_blacklist'));
179
  if ($meta_blacklist == "") $meta_blacklist = array();
180
  $meta_blacklist = array_map('trim', $meta_blacklist);
181
  if(in_array('_wp_page_template', $meta_blacklist)){
182
  update_option('duplicate_post_copytemplate', 0);
183
- $meta_blacklist = array_diff($meta_blacklist, array('_wp_page_template'));
184
- }
185
  if(in_array('_thumbnail_id', $meta_blacklist)){
186
  update_option('duplicate_post_copythumbnail', 0);
187
  $meta_blacklist = array_diff($meta_blacklist, array('_thumbnail_id'));
@@ -192,13 +192,13 @@ function duplicate_post_plugin_upgrade() {
192
  delete_option('duplicate_post_create_user_level');
193
  delete_option('duplicate_post_view_user_level');
194
  delete_option('dp_notice');
195
-
196
  delete_site_option('duplicate_post_version');
197
  update_option( 'duplicate_post_version', duplicate_post_get_current_version() );
198
-
199
  delete_option('duplicate_post_show_notice', 0);
200
  update_site_option('duplicate_post_show_notice', 1);
201
-
202
  }
203
 
204
  /**
@@ -207,23 +207,35 @@ function duplicate_post_plugin_upgrade() {
207
  function duplicate_post_show_update_notice() {
208
  if(!current_user_can( 'manage_options')) return;
209
  $class = 'notice is-dismissible';
210
- $message = '<p style="margin: 0;"><strong>'.sprintf(__("What's new in Duplicate Post version %s:", 'duplicate-post'), DUPLICATE_POST_CURRENT_VERSION).'</strong></p>';
211
- $message .= '<ul style="margin: 0; list-style: inside disc;">';
212
- $message .= '<li style="margin: 0;">'.esc_html__('New options to show the original in the post list or in the edit screen!', 'duplicate-post').'</li>';
213
- $message .= '<li style="margin: 0;">'.esc_html__('Accessibility of the user interface has been improved', 'duplicate-post').'</li>';
214
- $message .= '</ul>';
215
- $message .= '<p style="margin: 0;"><em><a href="https://duplicate-post.lopo.it/">'.esc_html__('Check out the documentation', 'duplicate-post').'</a> '.sprintf(__('Please <a href="%s">review the settings</a> to make sure it works as you expect.', 'duplicate-post'), admin_url('options-general.php?page=duplicatepost')).'</em><br/>';
216
- $message .= esc_html__('Serving the WordPress community since November 2007.', 'duplicate-post').' <strong><a href="https://duplicate-post.lopo.it/donate/">'.esc_html__('Support the plugin by making a donation or becoming a patron!', 'duplicate-post').'</a></strong></p>';
217
  global $wp_version;
218
  if( version_compare($wp_version, '4.2') < 0 ){
219
  $message .= '<a id="duplicate-post-dismiss-notice" href="javascript:duplicate_post_dismiss_notice();">'.__('Dismiss this notice.', 'default').'</a>';
220
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  echo '<div id="duplicate-post-notice" class="'.$class.'" style="display: flex; align-items: center;">
222
- <svg xmlns="http://www.w3.org/2000/svg" style="padding: 0; margin: 10px 20px 10px 0;" width="80" height="80" viewBox="0 0 20 20">
223
- <path d="M18.9 4.3c0.6 0 1.1 0.5 1.1 1.1v13.6c0 0.6-0.5 1.1-1.1 1.1h-10.7c-0.6 0-1.1-0.5-1.1-1.1v-3.2h-6.1c-0.6 0-1.1-0.5-1.1-1.1v-7.5c0-0.6 0.3-1.4 0.8-1.8l4.6-4.6c0.4-0.4 1.2-0.8 1.8-0.8h4.6c0.6 0 1.1 0.5 1.1 1.1v3.7c0.4-0.3 1-0.4 1.4-0.4h4.6zM12.9 6.7l-3.3 3.3h3.3v-3.3zM5.7 2.4l-3.3 3.3h3.3v-3.3zM7.9 9.6l3.5-3.5v-4.6h-4.3v4.6c0 0.6-0.5 1.1-1.1 1.1h-4.6v7.1h5.7v-2.9c0-0.6 0.3-1.4 0.8-1.8zM18.6 18.6v-12.9h-4.3v4.6c0 0.6-0.5 1.1-1.1 1.1h-4.6v7.1h10z"
224
- fill="rgba(140,140,140,1)"/>
225
- </svg>
226
- <div style="margin: 0.5em 0">'.$message.'</div>
227
  </div>';
228
  echo "<script>
229
  function duplicate_post_dismiss_notice(){
@@ -235,7 +247,7 @@ function duplicate_post_show_update_notice() {
235
  jQuery('#duplicate-post-notice').hide();
236
  });
237
  }
238
-
239
  jQuery(document).ready(function(){
240
  jQuery('body').on('click', '.notice-dismiss', function(){
241
  duplicate_post_dismiss_notice();
@@ -244,6 +256,44 @@ function duplicate_post_show_update_notice() {
244
  </script>";
245
  }
246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  function duplicate_post_dismiss_notice() {
248
  $result = update_site_option('duplicate_post_show_notice', 0);
249
  return $result;
@@ -289,16 +339,25 @@ function duplicate_post_quick_edit_remove_original( $column_name, $post_type ) {
289
  }
290
 
291
  printf(
292
- '<fieldset class="inline-edit-col-right" id="duplicate_post_quick_edit_fieldset">
293
  <div class="inline-edit-col">
294
- <label class="alignleft">
295
- <input type="checkbox" name="duplicate_post_remove_original" value="duplicate_post_remove_original">
 
 
 
 
296
  <span class="checkbox-title">%s</span>
297
  </label>
 
298
  </div>
299
  </fieldset>',
300
  __(
301
- 'Delete reference to original item: <span class="duplicate_post_original_item_title_span"></span>',
 
 
 
 
302
  'duplicate-post'
303
  )
304
  );
@@ -351,10 +410,23 @@ function duplicate_post_custom_box_html( $post ) {
351
  $original_item = duplicate_post_get_original( $post->ID );
352
  if ( $original_item ) {
353
  ?>
354
- <label>
355
- <input type="checkbox" name="duplicate_post_remove_original" value="duplicate_post_remove_original">
356
- <?php printf( __( 'Delete reference to original item: <span class="duplicate_post_original_item_title_span">%s</span>', 'duplicate-post' ), duplicate_post_get_edit_or_view_link( $original_item ) ); ?>
357
- </label>
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  <?php
359
  } else { ?>
360
  <script>
@@ -369,14 +441,32 @@ function duplicate_post_custom_box_html( $post ) {
369
  * Add the link to action list for post_row_actions
370
  */
371
  function duplicate_post_make_duplicate_link_row($actions, $post) {
372
- if (duplicate_post_is_current_user_allowed_to_copy() && duplicate_post_is_post_type_enabled($post->post_type)) {
373
- $title = _draft_or_post_title( $post );
374
- $actions['clone'] = '<a href="'.duplicate_post_get_clone_post_link( $post->ID , 'display', false).'" aria-label="'
375
- . esc_attr( sprintf( __('Clone &#8220;%s&#8221;', 'duplicate-post'), $title ) )
376
- . '">' . esc_html__('Clone', 'duplicate-post') . '</a>';
377
- $actions['edit_as_new_draft'] = '<a href="'. duplicate_post_get_clone_post_link( $post->ID ) .'" aria-label="'
378
- . esc_attr( sprintf( __('Copy &#8220;%s&#8221; to a new draft', 'duplicate-post'), $title ) )
379
- . '">' . esc_html__('New Draft', 'duplicate-post') . '</a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  }
381
  return $actions;
382
  }
@@ -421,23 +511,23 @@ function duplicate_post_save_as_new_post($status = ''){
421
  if(!duplicate_post_is_current_user_allowed_to_copy()){
422
  wp_die(esc_html__('Current user is not allowed to copy posts.', 'duplicate-post'));
423
  }
424
-
425
  if (! ( isset( $_GET['post']) || isset( $_POST['post']) || ( isset($_REQUEST['action']) && 'duplicate_post_save_as_new_post' == $_REQUEST['action'] ) ) ) {
426
  wp_die(esc_html__('No post to duplicate has been supplied!', 'duplicate-post'));
427
  }
428
 
429
  // Get the original post
430
  $id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
431
-
432
  check_admin_referer('duplicate-post_' . $id);
433
-
434
- $post = get_post($id);
435
 
436
  // Copy the post and insert it
437
  if (isset($post) && $post!=null) {
438
  $post_type = $post->post_type;
439
  $new_id = duplicate_post_create_duplicate($post, $status);
440
-
441
  if ($status == ''){
442
  $sendback = wp_get_referer();
443
  if ( ! $sendback ||
@@ -481,7 +571,7 @@ function duplicate_post_copy_post_taxonomies($new_id, $post) {
481
  if(post_type_supports($post->post_type, 'post-formats') && !in_array('post_format', $post_taxonomies)){
482
  $post_taxonomies[] = 'post_format';
483
  }
484
-
485
  $taxonomies_blacklist = get_option('duplicate_post_taxonomies_blacklist');
486
  if ($taxonomies_blacklist == "") $taxonomies_blacklist = array();
487
  if(get_option('duplicate_post_copyformat') == 0){
@@ -512,7 +602,7 @@ function duplicate_post_copy_post_meta_info($new_id, $post) {
512
  $meta_blacklist = explode(',', $meta_blacklist);
513
  $meta_blacklist = array_filter($meta_blacklist);
514
  $meta_blacklist = array_map('trim', $meta_blacklist);
515
- }
516
  $meta_blacklist[] = '_edit_lock'; // edit lock
517
  $meta_blacklist[] = '_edit_last'; // edit lock
518
  if(get_option('duplicate_post_copytemplate') == 0){
@@ -521,13 +611,14 @@ function duplicate_post_copy_post_meta_info($new_id, $post) {
521
  if(get_option('duplicate_post_copythumbnail') == 0){
522
  $meta_blacklist[] = '_thumbnail_id';
523
  }
524
-
525
- $meta_blacklist = apply_filters( 'duplicate_post_blacklist_filter' , $meta_blacklist );
526
-
 
527
  $meta_blacklist_string = '('.implode(')|(',$meta_blacklist).')';
528
  if(strpos($meta_blacklist_string, '*') !== false){
529
  $meta_blacklist_string = str_replace(array('*'), array('[a-zA-Z0-9_]*'), $meta_blacklist_string);
530
-
531
  $meta_keys = array();
532
  foreach($post_meta_keys as $meta_key){
533
  if(!preg_match('#^'.$meta_blacklist_string.'$#', $meta_key))
@@ -564,12 +655,12 @@ function duplicate_post_addslashes_to_strings_only( $value ) {
564
  return is_string( $value ) ? addslashes( $value ) : $value;
565
  }
566
 
567
- function duplicate_post_wp_slash( $value ) {
568
- return duplicate_post_addslashes_deep( $value );
569
- }
570
-
571
-
572
-
573
  /**
574
  * Copy the attachments
575
  */
@@ -618,7 +709,7 @@ function duplicate_post_copy_attachments($new_id, $post){
618
  if(get_option('duplicate_post_copythumbnail') == 1 && $old_thumbnail_id == $child->ID){
619
  set_post_thumbnail($new_id, $new_attachment_id);
620
  }
621
-
622
  }
623
  }
624
 
@@ -656,7 +747,7 @@ function duplicate_post_copy_comments($new_id, $post){
656
  'comment_author_email' => $comment->comment_author_email,
657
  'comment_author_url' => $comment->comment_author_url,
658
  'comment_content' => $comment->comment_content,
659
- 'comment_type' => '',
660
  'comment_parent' => $parent,
661
  'user_id' => $comment->user_id,
662
  'comment_author_IP' => $comment->comment_author_IP,
@@ -677,14 +768,14 @@ function duplicate_post_copy_comments($new_id, $post){
677
  * Create a duplicate from a post
678
  */
679
  function duplicate_post_create_duplicate($post, $status = '', $parent_id = '') {
680
-
681
  do_action('duplicate_post_pre_copy');
682
 
683
  if (!duplicate_post_is_post_type_enabled($post->post_type) && $post->post_type != 'attachment')
684
  wp_die(esc_html__('Copy features for this post type are not enabled in options page', 'duplicate-post'));
685
-
686
  $new_post_status = (empty($status))? $post->post_status: $status;
687
-
688
  if ($post->post_type != 'attachment'){
689
  $prefix = sanitize_text_field(get_option('duplicate_post_title_prefix'));
690
  $suffix = sanitize_text_field(get_option('duplicate_post_title_suffix'));
@@ -698,10 +789,13 @@ function duplicate_post_create_duplicate($post, $status = '', $parent_id = '') {
698
  }
699
  $title = trim($prefix.$title.$suffix);
700
 
701
- if ($title == ''){
702
- // empty title
703
- $title = __('Untitled', 'default');
704
- }
 
 
 
705
  if (get_option('duplicate_post_copystatus') == 0){
706
  $new_post_status = 'draft';
707
  } else {
@@ -718,8 +812,8 @@ function duplicate_post_create_duplicate($post, $status = '', $parent_id = '') {
718
  }
719
  }
720
  }
721
- }
722
-
723
  $new_post_author = wp_get_current_user();
724
  $new_post_author_id = $new_post_author->ID;
725
  if ( get_option('duplicate_post_copyauthor') == '1' ){
@@ -734,13 +828,13 @@ function duplicate_post_create_duplicate($post, $status = '', $parent_id = '') {
734
  }
735
  }
736
  }
737
-
738
  $menu_order = (get_option('duplicate_post_copymenuorder') == '1') ? $post->menu_order : 0;
739
  $increase_menu_order_by = get_option('duplicate_post_increase_menu_order_by');
740
  if(!empty($increase_menu_order_by) && is_numeric($increase_menu_order_by)){
741
  $menu_order += intval($increase_menu_order_by);
742
  }
743
-
744
  $post_name = $post->post_name;
745
  if(get_option('duplicate_post_copyslug') != 1){
746
  $post_name = '';
@@ -752,7 +846,7 @@ function duplicate_post_create_duplicate($post, $status = '', $parent_id = '') {
752
  'ping_status' => $post->ping_status,
753
  'post_author' => $new_post_author_id,
754
  'post_content' => (get_option('duplicate_post_copycontent') == '1') ? $post->post_content : "" ,
755
- 'post_content_filtered' => (get_option('duplicate_post_copycontent') == '1') ? $post->post_content_filtered : "" ,
756
  'post_excerpt' => (get_option('duplicate_post_copyexcerpt') == '1') ? $post->post_excerpt : "",
757
  'post_mime_type' => $post->post_mime_type,
758
  'post_parent' => $new_post_parent = empty($parent_id)? $post->post_parent : $parent_id,
@@ -772,29 +866,28 @@ function duplicate_post_create_duplicate($post, $status = '', $parent_id = '') {
772
 
773
  // If you have written a plugin which uses non-WP database tables to save
774
  // information about a post you can hook this action to dupe that data.
775
-
776
  if($new_post_id !== 0 && !is_wp_error($new_post_id)){
777
-
778
  if ($post->post_type == 'page' || is_post_type_hierarchical( $post->post_type ))
779
  do_action( 'dp_duplicate_page', $new_post_id, $post, $status );
780
  else
781
  do_action( 'dp_duplicate_post', $new_post_id, $post, $status );
782
-
783
  delete_post_meta($new_post_id, '_dp_original');
784
  add_post_meta($new_post_id, '_dp_original', $post->ID);
785
-
786
  do_action('duplicate_post_post_copy');
787
-
788
  }
789
-
790
  return $new_post_id;
791
  }
792
 
793
  //Add some links on the plugin page
794
  function duplicate_post_add_plugin_links($links, $file) {
795
  if ( $file == plugin_basename(dirname(__FILE__).'/duplicate-post.php') ) {
796
- $links[] = '<a href="https://duplicate-post.lopo.it/" aria-label="' . esc_attr__('Documentation for Duplicate Post', 'duplicate-post') . '">' . esc_html__('Documentation', 'duplicate-post') . '</a>';
797
- $links[] = '<a href="https://duplicate-post.lopo.it/donate" aria-label="' . esc_attr__('Donate to support Duplicate Post', 'duplicate-post') . '">' . esc_html__('Donate', 'duplicate-post') . '</a>';
798
  }
799
  return $links;
800
  }
@@ -803,7 +896,8 @@ function duplicate_post_add_plugin_links($links, $file) {
803
  function duplicate_post_action_admin_notice() {
804
  if ( ! empty( $_REQUEST['cloned'] ) ) {
805
  $copied_posts = intval( $_REQUEST['cloned'] );
806
- printf( '<div id="message" class="updated fade"><p>' .
 
807
  _n( '%s item copied.',
808
  '%s items copied.',
809
  $copied_posts,
27
 
28
  function duplicate_post_admin_init(){
29
  duplicate_post_plugin_upgrade();
30
+
31
  if (get_option('duplicate_post_show_row') == 1){
32
  add_filter('post_row_actions', 'duplicate_post_make_duplicate_link_row',10,2);
33
  add_filter('page_row_actions', 'duplicate_post_make_duplicate_link_row',10,2);
34
  }
35
+
36
  if (get_site_option('duplicate_post_show_notice') == 1){
37
  if(is_multisite()){
38
  add_action( 'network_admin_notices', 'duplicate_post_show_update_notice' );
41
  }
42
  add_action( 'wp_ajax_duplicate_post_dismiss_notice', 'duplicate_post_dismiss_notice' );
43
  }
44
+
45
  if (get_option('duplicate_post_show_submitbox') == 1){
46
  add_action( 'post_submitbox_start', 'duplicate_post_add_duplicate_post_button' );
47
  }
64
  */
65
  add_action('admin_action_duplicate_post_save_as_new_post', 'duplicate_post_save_as_new_post');
66
  add_action('admin_action_duplicate_post_save_as_new_post_draft', 'duplicate_post_save_as_new_post_draft');
67
+
68
  add_filter('removable_query_args', 'duplicate_post_add_removable_query_arg', 10, 1);
69
+
70
  // Using our action hooks
71
+
72
  add_action('dp_duplicate_post', 'duplicate_post_copy_post_meta_info', 10, 2);
73
  add_action('dp_duplicate_page', 'duplicate_post_copy_post_meta_info', 10, 2);
74
+
75
  if(get_option('duplicate_post_copychildren') == 1){
76
  add_action('dp_duplicate_post', 'duplicate_post_copy_children', 20, 3);
77
  add_action('dp_duplicate_page', 'duplicate_post_copy_children', 20, 3);
78
  }
79
+
80
  if(get_option('duplicate_post_copyattachments') == 1){
81
  add_action('dp_duplicate_post', 'duplicate_post_copy_attachments', 30, 2);
82
  add_action('dp_duplicate_page', 'duplicate_post_copy_attachments', 30, 2);
83
  }
84
+
85
  if(get_option('duplicate_post_copycomments') == 1){
86
  add_action('dp_duplicate_post', 'duplicate_post_copy_comments', 40, 2);
87
  add_action('dp_duplicate_page', 'duplicate_post_copy_comments', 40, 2);
88
  }
89
+
90
  add_action('dp_duplicate_post', 'duplicate_post_copy_post_taxonomies', 50, 2);
91
  add_action('dp_duplicate_page', 'duplicate_post_copy_post_taxonomies', 50, 2);
92
+
93
  add_filter('plugin_row_meta', 'duplicate_post_add_plugin_links', 10, 2);
94
+
95
  add_action( 'admin_notices', 'duplicate_post_action_admin_notice' );
96
  }
97
 
101
  */
102
  function duplicate_post_plugin_upgrade() {
103
  $installed_version = duplicate_post_get_installed_version();
104
+
105
  if ( $installed_version == duplicate_post_get_current_version() )
106
  return;
107
 
108
+
109
  if (empty($installed_version)) {
110
  // Get default roles
111
  $default_roles = array(
112
  3 => 'editor',
113
  8 => 'administrator',
114
  );
115
+
116
  // Cycle all roles and assign capability if its level >= duplicate_post_copy_user_level
117
  foreach ($default_roles as $level => $name){
118
  $role = get_role($name);
120
  }
121
  } else {
122
  $min_user_level = get_option('duplicate_post_copy_user_level');
123
+
124
  if (!empty($min_user_level)){
125
  // Get default roles
126
  $default_roles = array(
129
  3 => 'editor',
130
  8 => 'administrator',
131
  );
132
+
133
  // Cycle all roles and assign capability if its level >= duplicate_post_copy_user_level
134
  foreach ($default_roles as $level => $name){
135
  $role = get_role($name);
139
  delete_option('duplicate_post_copy_user_level');
140
  }
141
  }
142
+
143
+
144
  add_option('duplicate_post_copytitle','1');
145
  add_option('duplicate_post_copydate','0');
146
  add_option('duplicate_post_copystatus','0');
166
  add_option('duplicate_post_show_original_column','0');
167
  add_option('duplicate_post_show_original_in_post_states','0');
168
  add_option('duplicate_post_show_original_meta_box','0');
169
+
170
  $taxonomies_blacklist = get_option('duplicate_post_taxonomies_blacklist');
171
  if ($taxonomies_blacklist == "") $taxonomies_blacklist = array();
172
  if(in_array('post_format',$taxonomies_blacklist)){
174
  $taxonomies_blacklist = array_diff($taxonomies_blacklist, array('post_format'));
175
  update_option('duplicate_post_taxonomies_blacklist', $taxonomies_blacklist);
176
  }
177
+
178
  $meta_blacklist = explode(",",get_option('duplicate_post_blacklist'));
179
  if ($meta_blacklist == "") $meta_blacklist = array();
180
  $meta_blacklist = array_map('trim', $meta_blacklist);
181
  if(in_array('_wp_page_template', $meta_blacklist)){
182
  update_option('duplicate_post_copytemplate', 0);
183
+ $meta_blacklist = array_diff($meta_blacklist, array('_wp_page_template'));
184
+ }
185
  if(in_array('_thumbnail_id', $meta_blacklist)){
186
  update_option('duplicate_post_copythumbnail', 0);
187
  $meta_blacklist = array_diff($meta_blacklist, array('_thumbnail_id'));
192
  delete_option('duplicate_post_create_user_level');
193
  delete_option('duplicate_post_view_user_level');
194
  delete_option('dp_notice');
195
+
196
  delete_site_option('duplicate_post_version');
197
  update_option( 'duplicate_post_version', duplicate_post_get_current_version() );
198
+
199
  delete_option('duplicate_post_show_notice', 0);
200
  update_site_option('duplicate_post_show_notice', 1);
201
+
202
  }
203
 
204
  /**
207
  function duplicate_post_show_update_notice() {
208
  if(!current_user_can( 'manage_options')) return;
209
  $class = 'notice is-dismissible';
210
+ /* translators: %1$s: Yoast, %2$s: version number */
211
+ $message = '<p style="margin: 0;"><strong>' . sprintf( __( 'What\'s new in %1$s Duplicate Post version %2$s:', 'duplicate-post' ), 'Yoast', DUPLICATE_POST_CURRENT_VERSION ) . '</strong> ';
212
+ /* translators: %s: Yoast */
213
+ $message .= sprintf( __( 'First release from %s + accessibility improvements + deprecated filter', 'duplicate-post' ), 'Yoast' ) . '</p>';
214
+ $message .= '<p>%%SIGNUP_FORM%%</p>';
215
+ $message .= esc_html__('Serving the WordPress community since November 2007.', 'duplicate-post');
 
216
  global $wp_version;
217
  if( version_compare($wp_version, '4.2') < 0 ){
218
  $message .= '<a id="duplicate-post-dismiss-notice" href="javascript:duplicate_post_dismiss_notice();">'.__('Dismiss this notice.', 'default').'</a>';
219
  }
220
+ $allowed_tags = array(
221
+ 'a' => array(
222
+ 'href' => array(),
223
+ 'title' => array(),
224
+ ),
225
+ 'br' => array(),
226
+ 'p' => array(),
227
+ 'em' => array(),
228
+ 'strong' => array(),
229
+ );
230
+
231
+ $sanitized_message = wp_kses( $message, $allowed_tags );
232
+ $sanitized_message = str_replace( '%%SIGNUP_FORM%%', duplicate_post_newsletter_signup_form(), $sanitized_message );
233
+
234
+ $img_path = plugins_url( '/duplicate_post_yoast_icon-125x125.png', __FILE__ );
235
+
236
  echo '<div id="duplicate-post-notice" class="'.$class.'" style="display: flex; align-items: center;">
237
+ <img src="' . $img_path . '" alt=""/>
238
+ <div style="margin: 0.5em">'.$sanitized_message.'</div>
 
 
 
239
  </div>';
240
  echo "<script>
241
  function duplicate_post_dismiss_notice(){
247
  jQuery('#duplicate-post-notice').hide();
248
  });
249
  }
250
+
251
  jQuery(document).ready(function(){
252
  jQuery('body').on('click', '.notice-dismiss', function(){
253
  duplicate_post_dismiss_notice();
256
  </script>";
257
  }
258
 
259
+ /**
260
+ * Renders the newsletter signup form.
261
+ *
262
+ * @return string The HTML of the newsletter signup form (escaped).
263
+ */
264
+ function duplicate_post_newsletter_signup_form() {
265
+ /* translators: %1$s: Yoast */
266
+ $copy = sprintf( __( 'If you want to stay up to date about all the exciting developments around Duplicate Post, subscribe to the %1$s newsletter!',
267
+ 'duplicate-post' ), 'Yoast' );
268
+
269
+ $email_label = __( 'Email Address', 'duplicate-post' );
270
+
271
+ $html = '
272
+ <!-- Begin Mailchimp Signup Form -->
273
+ <div id="mc_embed_signup">
274
+ <form action="https://yoast.us1.list-manage.com/subscribe/post?u=ffa93edfe21752c921f860358&amp;id=972f1c9122" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
275
+ <div id="mc_embed_signup_scroll">
276
+ ' . $copy . '
277
+ <div class="mc-field-group" style="margin-top: 8px;">
278
+ <label for="mce-EMAIL">' . $email_label . '</label>
279
+ <input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
280
+ <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
281
+ </div>
282
+ <div id="mce-responses" class="clear">
283
+ <div class="response" id="mce-error-response" style="display:none"></div>
284
+ <div class="response" id="mce-success-response" style="display:none"></div>
285
+ </div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
286
+ <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_ffa93edfe21752c921f860358_972f1c9122" tabindex="-1" value=""></div>
287
+ </div>
288
+ </form>
289
+ </div>
290
+ <!--End mc_embed_signup-->
291
+ ';
292
+
293
+ return $html;
294
+ }
295
+
296
+
297
  function duplicate_post_dismiss_notice() {
298
  $result = update_site_option('duplicate_post_show_notice', 0);
299
  return $result;
339
  }
340
 
341
  printf(
342
+ '<fieldset class="inline-edit-col-left" id="duplicate_post_quick_edit_fieldset">
343
  <div class="inline-edit-col">
344
+ <input type="checkbox"
345
+ name="duplicate_post_remove_original"
346
+ id="duplicate-post-remove-original"
347
+ value="duplicate_post_remove_original"
348
+ aria-describedby="duplicate-post-remove-original-description">
349
+ <label for="duplicate-post-remove-original">
350
  <span class="checkbox-title">%s</span>
351
  </label>
352
+ <span id="duplicate-post-remove-original-description" class="checkbox-title">%s</span>
353
  </div>
354
  </fieldset>',
355
  __(
356
+ 'Delete reference to original item.',
357
+ 'duplicate-post'
358
+ ),
359
+ __(
360
+ 'The original item this was copied from is: <span class="duplicate_post_original_item_title_span"></span>',
361
  'duplicate-post'
362
  )
363
  );
410
  $original_item = duplicate_post_get_original( $post->ID );
411
  if ( $original_item ) {
412
  ?>
413
+ <p>
414
+ <input type="checkbox"
415
+ name="duplicate_post_remove_original"
416
+ id="duplicate-post-remove-original"
417
+ value="duplicate_post_remove_original"
418
+ aria-describedby="duplicate-post-remove-original-description">
419
+ <label for="duplicate-post-remove-original">
420
+ <?php esc_html_e( 'Delete reference to original item.', 'duplicate-post' ); ?>
421
+ </label>
422
+ </p>
423
+ <p id="duplicate-post-remove-original-description">
424
+ <?php
425
+ /* translators: $s: link to edit or view the original item */
426
+ printf( __( 'The original item this was copied from is: <span class="duplicate_post_original_item_title_span">%s</span>', 'duplicate-post' ), duplicate_post_get_edit_or_view_link( $original_item ) );
427
+ ?>
428
+ </p>
429
+
430
  <?php
431
  } else { ?>
432
  <script>
441
  * Add the link to action list for post_row_actions
442
  */
443
  function duplicate_post_make_duplicate_link_row($actions, $post) {
444
+ //$title = empty( $post->post_title ) ? __( '(no title)', 'duplicate-post' ) : $post->post_title;
445
+ $title = _draft_or_post_title( $post );
446
+
447
+ /**
448
+ * Filter allowing displaying duplicate post link for current post.
449
+ *
450
+ * @param boolean $show_duplicate_link When to show duplicate link.
451
+ * @param WP_Post $post The post object.
452
+ *
453
+ * @return boolean
454
+ */
455
+ if ( apply_filters( 'duplicate_post_show_link', duplicate_post_is_current_user_allowed_to_copy() && duplicate_post_is_post_type_enabled( $post->post_type ), $post ) ) {
456
+ $actions['clone'] = '<a href="' . duplicate_post_get_clone_post_link( $post->ID, 'display', false ) .
457
+ '" aria-label="' . esc_attr(
458
+ /* translators: %s: Post title. */
459
+ sprintf( __( 'Clone &#8220;%s&#8221;', 'duplicate-post' ), $title )
460
+ ) . '">' .
461
+ esc_html_x( 'Clone', 'verb', 'duplicate-post' ) . '</a>';
462
+
463
+ $actions['edit_as_new_draft'] = '<a href="' . duplicate_post_get_clone_post_link( $post->ID ) .
464
+ '" aria-label="' . esc_attr(
465
+ /* translators: %s: Post title. */
466
+ sprintf( __( 'New draft of &#8220;%s&#8221;', 'duplicate-post' ), $title )
467
+ ) . '">' .
468
+ esc_html__( 'New Draft', 'duplicate-post' ) .
469
+ '</a>';
470
  }
471
  return $actions;
472
  }
511
  if(!duplicate_post_is_current_user_allowed_to_copy()){
512
  wp_die(esc_html__('Current user is not allowed to copy posts.', 'duplicate-post'));
513
  }
514
+
515
  if (! ( isset( $_GET['post']) || isset( $_POST['post']) || ( isset($_REQUEST['action']) && 'duplicate_post_save_as_new_post' == $_REQUEST['action'] ) ) ) {
516
  wp_die(esc_html__('No post to duplicate has been supplied!', 'duplicate-post'));
517
  }
518
 
519
  // Get the original post
520
  $id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
521
+
522
  check_admin_referer('duplicate-post_' . $id);
523
+
524
+ $post = get_post($id);
525
 
526
  // Copy the post and insert it
527
  if (isset($post) && $post!=null) {
528
  $post_type = $post->post_type;
529
  $new_id = duplicate_post_create_duplicate($post, $status);
530
+
531
  if ($status == ''){
532
  $sendback = wp_get_referer();
533
  if ( ! $sendback ||
571
  if(post_type_supports($post->post_type, 'post-formats') && !in_array('post_format', $post_taxonomies)){
572
  $post_taxonomies[] = 'post_format';
573
  }
574
+
575
  $taxonomies_blacklist = get_option('duplicate_post_taxonomies_blacklist');
576
  if ($taxonomies_blacklist == "") $taxonomies_blacklist = array();
577
  if(get_option('duplicate_post_copyformat') == 0){
602
  $meta_blacklist = explode(',', $meta_blacklist);
603
  $meta_blacklist = array_filter($meta_blacklist);
604
  $meta_blacklist = array_map('trim', $meta_blacklist);
605
+ }
606
  $meta_blacklist[] = '_edit_lock'; // edit lock
607
  $meta_blacklist[] = '_edit_last'; // edit lock
608
  if(get_option('duplicate_post_copytemplate') == 0){
611
  if(get_option('duplicate_post_copythumbnail') == 0){
612
  $meta_blacklist[] = '_thumbnail_id';
613
  }
614
+
615
+ $meta_blacklist = apply_filters_deprecated( 'duplicate_post_blacklist_filter' , array( $meta_blacklist ), '3.2.5', 'duplicate_post_excludelist_filter' );
616
+ $meta_blacklist = apply_filters( 'duplicate_post_excludelist_filter' , $meta_blacklist );
617
+
618
  $meta_blacklist_string = '('.implode(')|(',$meta_blacklist).')';
619
  if(strpos($meta_blacklist_string, '*') !== false){
620
  $meta_blacklist_string = str_replace(array('*'), array('[a-zA-Z0-9_]*'), $meta_blacklist_string);
621
+
622
  $meta_keys = array();
623
  foreach($post_meta_keys as $meta_key){
624
  if(!preg_match('#^'.$meta_blacklist_string.'$#', $meta_key))
655
  return is_string( $value ) ? addslashes( $value ) : $value;
656
  }
657
 
658
+ function duplicate_post_wp_slash( $value ) {
659
+ return duplicate_post_addslashes_deep( $value );
660
+ }
661
+
662
+
663
+
664
  /**
665
  * Copy the attachments
666
  */
709
  if(get_option('duplicate_post_copythumbnail') == 1 && $old_thumbnail_id == $child->ID){
710
  set_post_thumbnail($new_id, $new_attachment_id);
711
  }
712
+
713
  }
714
  }
715
 
747
  'comment_author_email' => $comment->comment_author_email,
748
  'comment_author_url' => $comment->comment_author_url,
749
  'comment_content' => $comment->comment_content,
750
+ 'comment_type' => '',
751
  'comment_parent' => $parent,
752
  'user_id' => $comment->user_id,
753
  'comment_author_IP' => $comment->comment_author_IP,
768
  * Create a duplicate from a post
769
  */
770
  function duplicate_post_create_duplicate($post, $status = '', $parent_id = '') {
771
+
772
  do_action('duplicate_post_pre_copy');
773
 
774
  if (!duplicate_post_is_post_type_enabled($post->post_type) && $post->post_type != 'attachment')
775
  wp_die(esc_html__('Copy features for this post type are not enabled in options page', 'duplicate-post'));
776
+
777
  $new_post_status = (empty($status))? $post->post_status: $status;
778
+
779
  if ($post->post_type != 'attachment'){
780
  $prefix = sanitize_text_field(get_option('duplicate_post_title_prefix'));
781
  $suffix = sanitize_text_field(get_option('duplicate_post_title_suffix'));
789
  }
790
  $title = trim($prefix.$title.$suffix);
791
 
792
+ /*
793
+ * Not sure we should force a title. Instead, we should respect what WP does.
794
+ * if ($title == ''){
795
+ * // empty title
796
+ * $title = __('Untitled', 'default');
797
+ * }
798
+ */
799
  if (get_option('duplicate_post_copystatus') == 0){
800
  $new_post_status = 'draft';
801
  } else {
812
  }
813
  }
814
  }
815
+ }
816
+
817
  $new_post_author = wp_get_current_user();
818
  $new_post_author_id = $new_post_author->ID;
819
  if ( get_option('duplicate_post_copyauthor') == '1' ){
828
  }
829
  }
830
  }
831
+
832
  $menu_order = (get_option('duplicate_post_copymenuorder') == '1') ? $post->menu_order : 0;
833
  $increase_menu_order_by = get_option('duplicate_post_increase_menu_order_by');
834
  if(!empty($increase_menu_order_by) && is_numeric($increase_menu_order_by)){
835
  $menu_order += intval($increase_menu_order_by);
836
  }
837
+
838
  $post_name = $post->post_name;
839
  if(get_option('duplicate_post_copyslug') != 1){
840
  $post_name = '';
846
  'ping_status' => $post->ping_status,
847
  'post_author' => $new_post_author_id,
848
  'post_content' => (get_option('duplicate_post_copycontent') == '1') ? $post->post_content : "" ,
849
+ 'post_content_filtered' => (get_option('duplicate_post_copycontent') == '1') ? $post->post_content_filtered : "" ,
850
  'post_excerpt' => (get_option('duplicate_post_copyexcerpt') == '1') ? $post->post_excerpt : "",
851
  'post_mime_type' => $post->post_mime_type,
852
  'post_parent' => $new_post_parent = empty($parent_id)? $post->post_parent : $parent_id,
866
 
867
  // If you have written a plugin which uses non-WP database tables to save
868
  // information about a post you can hook this action to dupe that data.
869
+
870
  if($new_post_id !== 0 && !is_wp_error($new_post_id)){
871
+
872
  if ($post->post_type == 'page' || is_post_type_hierarchical( $post->post_type ))
873
  do_action( 'dp_duplicate_page', $new_post_id, $post, $status );
874
  else
875
  do_action( 'dp_duplicate_post', $new_post_id, $post, $status );
876
+
877
  delete_post_meta($new_post_id, '_dp_original');
878
  add_post_meta($new_post_id, '_dp_original', $post->ID);
879
+
880
  do_action('duplicate_post_post_copy');
881
+
882
  }
883
+
884
  return $new_post_id;
885
  }
886
 
887
  //Add some links on the plugin page
888
  function duplicate_post_add_plugin_links($links, $file) {
889
  if ( $file == plugin_basename(dirname(__FILE__).'/duplicate-post.php') ) {
890
+ $links[] = '<a href="https://yoast.com/wordpress/plugins/duplicate-post/" aria-label="' . esc_attr__('Documentation for Duplicate Post', 'duplicate-post') . '">' . esc_html__('Documentation', 'duplicate-post') . '</a>';
 
891
  }
892
  return $links;
893
  }
896
  function duplicate_post_action_admin_notice() {
897
  if ( ! empty( $_REQUEST['cloned'] ) ) {
898
  $copied_posts = intval( $_REQUEST['cloned'] );
899
+ printf( '<div id="message" class="notice notice-success fade"><p>' .
900
+ /* translators: %s: number */
901
  _n( '%s item copied.',
902
  '%s items copied.',
903
  $copied_posts,
duplicate-post-common.php CHANGED
@@ -39,7 +39,7 @@ function duplicate_post_get_clone_post_link( $id = 0, $context = 'display', $dra
39
 
40
  if ( !$post = get_post( $id ) )
41
  return;
42
-
43
  if(!duplicate_post_is_post_type_enabled($post->post_type))
44
  return;
45
 
@@ -77,9 +77,7 @@ function duplicate_post_clone_post_link( $link = null, $before = '', $after = ''
77
  if ( null === $link )
78
  $link = esc_html__('Copy to a new draft', 'duplicate-post');
79
 
80
- $link = '<a class="post-clone-link" href="' . $url . '" title="'
81
- . esc_attr__("Copy to a new draft", 'duplicate-post')
82
- .'">' . $link . '</a>';
83
  echo $before . apply_filters( 'duplicate_post_clone_post_link', $link, $post->ID ) . $after;
84
  }
85
  /**
@@ -171,12 +169,12 @@ function duplicate_post_admin_bar_render() {
171
  'id' => 'new_draft',
172
  'title' => esc_attr__("Copy to a new draft", 'duplicate-post'),
173
  'href' => duplicate_post_get_clone_post_link( $current_object->ID )
174
- ) );
175
  }
176
  } else if ( is_admin() && isset( $_GET['post'] )){
177
  $id = $_GET['post'];
178
  $post = get_post($id);
179
- if( !is_null($post)
180
  && duplicate_post_is_current_user_allowed_to_copy()
181
  && duplicate_post_is_post_type_enabled($post->post_type)) {
182
  $wp_admin_bar->add_menu( array(
@@ -188,6 +186,10 @@ function duplicate_post_admin_bar_render() {
188
  }
189
  }
190
 
 
 
 
 
191
  function duplicate_post_add_css() {
192
  if(!is_admin_bar_showing()) return;
193
  $current_object = get_queried_object();
@@ -198,7 +200,7 @@ function duplicate_post_add_css() {
198
  && ( $post_type_object->show_ui || 'attachment' == $current_object->post_type )
199
  && (duplicate_post_is_post_type_enabled($current_object->post_type) ) )
200
  {
201
- wp_enqueue_style ( 'duplicate-post', plugins_url('/duplicate-post.css', __FILE__), array(), DUPLICATE_POST_CURRENT_VERSION );
202
  }
203
  } else if ( is_admin() && isset( $_GET['post'] )){
204
  $id = $_GET['post'];
@@ -206,11 +208,25 @@ function duplicate_post_add_css() {
206
  if( !is_null($post)
207
  && duplicate_post_is_current_user_allowed_to_copy()
208
  && duplicate_post_is_post_type_enabled($post->post_type)) {
209
- wp_enqueue_style ( 'duplicate-post', plugins_url('/duplicate-post.css', __FILE__), array(), DUPLICATE_POST_CURRENT_VERSION );
210
  }
211
  }
212
  }
213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
 
215
  add_action('init', 'duplicate_post_init');
216
 
@@ -220,6 +236,7 @@ function duplicate_post_init(){
220
  add_action ( 'wp_enqueue_scripts', 'duplicate_post_add_css' );
221
  add_action ( 'admin_enqueue_scripts', 'duplicate_post_add_css' );
222
  }
 
223
  }
224
 
225
  /**
@@ -227,4 +244,4 @@ function duplicate_post_init(){
227
  */
228
  function duplicate_post_tax_obj_cmp($a, $b) {
229
  return ($a->public < $b->public);
230
- }
39
 
40
  if ( !$post = get_post( $id ) )
41
  return;
42
+
43
  if(!duplicate_post_is_post_type_enabled($post->post_type))
44
  return;
45
 
77
  if ( null === $link )
78
  $link = esc_html__('Copy to a new draft', 'duplicate-post');
79
 
80
+ $link = '<a class="post-clone-link" href="' . $url . '">' . $link . '</a>';
 
 
81
  echo $before . apply_filters( 'duplicate_post_clone_post_link', $link, $post->ID ) . $after;
82
  }
83
  /**
169
  'id' => 'new_draft',
170
  'title' => esc_attr__("Copy to a new draft", 'duplicate-post'),
171
  'href' => duplicate_post_get_clone_post_link( $current_object->ID )
172
+ ) );
173
  }
174
  } else if ( is_admin() && isset( $_GET['post'] )){
175
  $id = $_GET['post'];
176
  $post = get_post($id);
177
+ if( !is_null($post)
178
  && duplicate_post_is_current_user_allowed_to_copy()
179
  && duplicate_post_is_post_type_enabled($post->post_type)) {
180
  $wp_admin_bar->add_menu( array(
186
  }
187
  }
188
 
189
+ function duplicate_post_enqueue_css() {
190
+ wp_enqueue_style ( 'duplicate-post', plugins_url('/duplicate-post.css', __FILE__), array(), DUPLICATE_POST_CURRENT_VERSION );
191
+ }
192
+
193
  function duplicate_post_add_css() {
194
  if(!is_admin_bar_showing()) return;
195
  $current_object = get_queried_object();
200
  && ( $post_type_object->show_ui || 'attachment' == $current_object->post_type )
201
  && (duplicate_post_is_post_type_enabled($current_object->post_type) ) )
202
  {
203
+ duplicate_post_enqueue_css();
204
  }
205
  } else if ( is_admin() && isset( $_GET['post'] )){
206
  $id = $_GET['post'];
208
  if( !is_null($post)
209
  && duplicate_post_is_current_user_allowed_to_copy()
210
  && duplicate_post_is_post_type_enabled($post->post_type)) {
211
+ duplicate_post_enqueue_css();
212
  }
213
  }
214
  }
215
 
216
+ function duplicate_post_add_css_to_post_list() {
217
+ if ( is_admin() ) {
218
+ $current_screen = get_current_screen();
219
+ if ( ! is_null( $current_screen ) ) {
220
+ if ( 'edit' === $current_screen->base ) {
221
+ $post_type = $current_screen->post_type;
222
+ if ( duplicate_post_is_current_user_allowed_to_copy()
223
+ && duplicate_post_is_post_type_enabled( $post_type ) ) {
224
+ duplicate_post_enqueue_css();
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
230
 
231
  add_action('init', 'duplicate_post_init');
232
 
236
  add_action ( 'wp_enqueue_scripts', 'duplicate_post_add_css' );
237
  add_action ( 'admin_enqueue_scripts', 'duplicate_post_add_css' );
238
  }
239
+ add_action ( 'admin_enqueue_scripts', 'duplicate_post_add_css_to_post_list' );
240
  }
241
 
242
  /**
244
  */
245
  function duplicate_post_tax_obj_cmp($a, $b) {
246
  return ($a->public < $b->public);
247
+ }
duplicate-post-options.css ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #duplicate_post_settings_form header.nav-tab-wrapper {
2
+ margin: 22px 0 0 0;
3
+ }
4
+
5
+ #duplicate_post_settings_form header .nav-tab{
6
+ cursor: pointer;
7
+ }
8
+
9
+ #duplicate_post_settings_form header .nav-tab:focus {
10
+ box-shadow: none;
11
+ outline: 1px dotted #000000;
12
+ }
13
+
14
+ .no-js #duplicate_post_settings_form header.nav-tab-wrapper {
15
+ display: none;
16
+ }
17
+
18
+ .no-js #duplicate_post_settings_form section {
19
+ border-top: 1px dashed #aaa;
20
+ margin-top: 22px;
21
+ padding-top: 22px;
22
+ }
23
+
24
+ .no-js #duplicate_post_settings_form section:first-of-type {
25
+ margin: 0;
26
+ padding: 0;
27
+ border: 0;
28
+ }
29
+
30
+ .no-js #duplicate_post_settings_form section[hidden] {
31
+ display: block;
32
+ }
33
+
34
+ #duplicate_post_settings_form label.taxonomy_private {
35
+ font-style: italic;
36
+ }
37
+
38
+ #duplicate_post_settings_form .toggle-private-taxonomies.button-link {
39
+ font-size: small;
40
+ margin-top: 1em;
41
+ }
duplicate-post-options.php CHANGED
@@ -46,13 +46,30 @@ function duplicate_post_register_settings() { // whitelist options
46
 
47
 
48
  function duplicate_post_menu() {
49
- add_options_page(__("Duplicate Post Options", 'duplicate-post'), __("Duplicate Post", 'duplicate-post'), 'manage_options', 'duplicatepost', 'duplicate_post_options');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
 
52
  function duplicate_post_options() {
 
53
 
54
  if ( current_user_can( 'promote_users' ) && (isset($_GET['settings-updated']) && $_GET['settings-updated'] == true)){
55
- global $wp_roles;
56
  $roles = $wp_roles->get_names();
57
 
58
  $dp_roles = get_option('duplicate_post_roles');
@@ -72,33 +89,12 @@ function duplicate_post_options() {
72
  }
73
  ?>
74
  <div class="wrap">
75
- <div id="icon-options-general" class="icon32">
76
- <br>
77
- </div>
78
  <h1>
79
- <?php esc_html_e("Duplicate Post Options", 'duplicate-post'); ?>
 
 
 
80
  </h1>
81
-
82
- <div
83
- style="display: flex; align-items: center; margin: 9px 15px 4px 0; padding: 5px 30px; float: left; clear:left; border: solid 3px #cccccc; width: 600px;">
84
- <svg xmlns="http://www.w3.org/2000/svg" style="padding: 0; margin: 10px 20px 10px 0;" width="80" height="80" viewBox="0 0 20 20">
85
- <path d="M18.9 4.3c0.6 0 1.1 0.5 1.1 1.1v13.6c0 0.6-0.5 1.1-1.1 1.1h-10.7c-0.6 0-1.1-0.5-1.1-1.1v-3.2h-6.1c-0.6 0-1.1-0.5-1.1-1.1v-7.5c0-0.6 0.3-1.4 0.8-1.8l4.6-4.6c0.4-0.4 1.2-0.8 1.8-0.8h4.6c0.6 0 1.1 0.5 1.1 1.1v3.7c0.4-0.3 1-0.4 1.4-0.4h4.6zM12.9 6.7l-3.3 3.3h3.3v-3.3zM5.7 2.4l-3.3 3.3h3.3v-3.3zM7.9 9.6l3.5-3.5v-4.6h-4.3v4.6c0 0.6-0.5 1.1-1.1 1.1h-4.6v7.1h5.7v-2.9c0-0.6 0.3-1.4 0.8-1.8zM18.6 18.6v-12.9h-4.3v4.6c0 0.6-0.5 1.1-1.1 1.1h-4.6v7.1h10z"
86
- fill="rgba(140,140,140,1)"/>
87
- </svg>
88
- <div>
89
- <p>
90
- <?php esc_html_e('Serving the WordPress community since November 2007.', 'duplicate-post'); ?>
91
- <br/>
92
- <strong><a href="https://duplicate-post.lopo.it/donate/"><?php esc_html_e('Support the plugin by making a donation or becoming a patron!', 'duplicate-post'); ?></a></strong>
93
- </p>
94
- <p>
95
- <a href="https://duplicate-post.lopo.it/" aria-label="<?php esc_attr_e('Documentation for Duplicate Post', 'duplicate-post'); ?>"><?php esc_html_e('Documentation', 'duplicate-post'); ?></a>
96
- - <a href="https://translate.wordpress.org/projects/wp-plugins/duplicate-post" aria-label="<?php esc_attr_e('Translate Duplicate Post', 'duplicate-post'); ?>"><?php esc_html_e('Translate', 'duplicate-post'); ?></a>
97
- - <a href="https://wordpress.org/support/plugin/duplicate-post" aria-label="<?php esc_attr_e('Support forum for Duplicate Post', 'duplicate-post'); ?>"><?php esc_html_e('Support Forum', 'duplicate-post'); ?></a>
98
- </p>
99
- </div>
100
- </div>
101
-
102
 
103
  <script>
104
  var tablist;
@@ -271,79 +267,19 @@ function duplicate_post_options() {
271
 
272
  });
273
 
274
- function toggle_private_taxonomies(){
275
- jQuery('.taxonomy_private').toggle(300);
276
- }
277
-
278
-
279
  jQuery(function(){
280
- jQuery('.taxonomy_private').hide(300);
 
 
 
 
 
 
 
 
281
  });
282
-
283
- </script>
284
-
285
- <style>
286
- header.nav-tab-wrapper {
287
- margin: 22px 0 0 0;
288
- }
289
-
290
- header .nav-tab:focus {
291
- color: #555;
292
- box-shadow: none;
293
- }
294
-
295
- #sections {
296
- padding: 22px;
297
- background: #fff;
298
- border: 1px solid #ccc;
299
- border-top: 0px;
300
- }
301
- /*
302
- section {
303
- display: none;
304
- }
305
-
306
- section:first-of-type {
307
- display: block;
308
- }*/
309
-
310
- .no-js header.nav-tab-wrapper {
311
- display: none;
312
- }
313
-
314
- .no-js #sections {
315
- border-top: 1px solid #ccc;
316
- margin-top: 22px;
317
- }
318
-
319
- .no-js section {
320
- border-top: 1px dashed #aaa;
321
- margin-top: 22px;
322
- padding-top: 22px;
323
- }
324
-
325
- .no-js section:first-child {
326
- margin: 0px;
327
- padding: 0px;
328
- border: 0px;
329
- }
330
-
331
- label {
332
- display: block;
333
- }
334
-
335
- label.taxonomy_private {
336
- font-style: italic;
337
- }
338
-
339
- a.toggle_link {
340
- font-size: small;
341
- }
342
- img#donate-button{
343
- vertical-align: middle;
344
- }
345
- </style>
346
 
 
347
 
348
  <form method="post" action="options.php" style="clear: both" id="duplicate_post_settings_form">
349
  <?php settings_fields('duplicate_post_group'); ?>
@@ -382,99 +318,201 @@ img#donate-button{
382
  role="tabpanel"
383
  id="what-tab"
384
  aria-labelledby="what">
385
-
386
- <table class="form-table">
387
- <tr valign="top">
388
- <th scope="row"><?php esc_html_e('Post/page elements to copy', 'duplicate-post'); ?>
389
- </th>
390
- <td colspan="2"><label> <input type="checkbox"
391
- name="duplicate_post_copytitle" value="1" <?php if(get_option('duplicate_post_copytitle') == 1) echo 'checked="checked"'; ?>/>
392
- <?php esc_html_e("Title", 'default'); ?>
393
- </label> <label> <input type="checkbox"
394
- name="duplicate_post_copydate" value="1" <?php if(get_option('duplicate_post_copydate') == 1) echo 'checked="checked"'; ?>/>
395
- <?php esc_html_e("Date", 'default'); ?>
396
- </label> <label> <input type="checkbox"
397
- name="duplicate_post_copystatus" value="1" <?php if(get_option('duplicate_post_copystatus') == 1) echo 'checked="checked"'; ?>/>
398
- <?php esc_html_e("Status", 'default'); ?>
399
- </label> <label> <input type="checkbox"
400
- name="duplicate_post_copyslug" value="1" <?php if(get_option('duplicate_post_copyslug') == 1) echo 'checked="checked"'; ?>/>
401
- <?php esc_html_e("Slug", 'default'); ?>
402
- </label> <label> <input type="checkbox"
403
- name="duplicate_post_copyexcerpt" value="1" <?php if(get_option('duplicate_post_copyexcerpt') == 1) echo 'checked="checked"'; ?>/>
404
- <?php esc_html_e("Excerpt", 'default'); ?>
405
- </label> <label> <input type="checkbox"
406
- name="duplicate_post_copycontent" value="1" <?php if(get_option('duplicate_post_copycontent') == 1) echo 'checked="checked"'; ?>/>
407
- <?php esc_html_e("Content", 'default'); ?>
408
- </label> <label> <input type="checkbox"
409
- name="duplicate_post_copythumbnail" value="1" <?php if(get_option('duplicate_post_copythumbnail') == 1) echo 'checked="checked"'; ?>/>
410
- <?php esc_html_e("Featured Image", 'default'); ?>
411
- </label> <label> <input type="checkbox"
412
- name="duplicate_post_copytemplate" value="1" <?php if(get_option('duplicate_post_copytemplate') == 1) echo 'checked="checked"'; ?>/>
413
- <?php esc_html_e("Template", 'default'); ?>
414
- </label> <label> <input type="checkbox"
415
- name="duplicate_post_copyformat" value="1" <?php if(get_option('duplicate_post_copyformat') == 1) echo 'checked="checked"'; ?>/>
416
- <?php echo esc_html_x("Format", 'post format', 'default'); ?>
417
- </label> <label> <input type="checkbox"
418
- name="duplicate_post_copyauthor" value="1" <?php if(get_option('duplicate_post_copyauthor') == 1) echo 'checked="checked"'; ?>/>
419
- <?php esc_html_e("Author", 'default'); ?>
420
- </label> <label> <input type="checkbox"
421
- name="duplicate_post_copypassword" value="1" <?php if(get_option('duplicate_post_copypassword') == 1) echo 'checked="checked"'; ?>/>
422
- <?php esc_html_e("Password", 'default'); ?>
423
- </label> <label> <input type="checkbox"
424
- name="duplicate_post_copyattachments" value="1" <?php if(get_option('duplicate_post_copyattachments') == 1) echo 'checked="checked"'; ?>/>
425
- <?php esc_html_e("Attachments", 'duplicate-post'); ?> <span class="description">(<?php esc_html_e("you probably want this unchecked, unless you have very special requirements", 'duplicate-post'); ?>)</span>
426
- </label> <label> <input type="checkbox"
427
- name="duplicate_post_copychildren" value="1" <?php if(get_option('duplicate_post_copychildren') == 1) echo 'checked="checked"'; ?>/>
428
- <?php esc_html_e("Children", 'duplicate-post'); ?>
429
- </label> <label> <input type="checkbox"
430
- name="duplicate_post_copycomments" value="1" <?php if(get_option('duplicate_post_copycomments') == 1) echo 'checked="checked"'; ?>/>
431
- <?php esc_html_e("Comments", 'default'); ?> <span class="description">(<?php esc_html_e("except pingbacks and trackbacks", 'duplicate-post'); ?>)</span>
432
- </label> <label> <input type="checkbox"
433
- name="duplicate_post_copymenuorder" value="1" <?php if(get_option('duplicate_post_copymenuorder') == 1) echo 'checked="checked"'; ?>/>
434
- <?php esc_html_e("Menu order", 'default'); ?>
435
- </label>
436
- </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
  </tr>
438
- <tr valign="top">
439
  <th scope="row">
440
  <label for="duplicate_post_title_prefix">
441
  <?php esc_html_e("Title prefix", 'duplicate-post'); ?>
442
  </label>
443
  </th>
444
- <td><input type="text" name="duplicate_post_title_prefix" id="duplicate_post_title_prefix"
445
- value="<?php form_option('duplicate_post_title_prefix'); ?>" />
446
- </td>
447
- <td><span class="description"><?php esc_html_e("Prefix to be added before the title, e.g. \"Copy of\" (blank for no prefix)", 'duplicate-post'); ?>
448
- </span>
 
 
449
  </td>
450
  </tr>
451
- <tr valign="top">
452
  <th scope="row">
453
  <label for="duplicate_post_title_suffix">
454
  <?php esc_html_e("Title suffix", 'duplicate-post'); ?>
455
  </label>
456
  </th>
457
- <td><input type="text" name="duplicate_post_title_suffix" id="duplicate_post_title_suffix"
458
- value="<?php form_option('duplicate_post_title_suffix'); ?>" />
459
- </td>
460
- <td><span class="description"><?php esc_html_e("Suffix to be added after the title, e.g. \"(dup)\" (blank for no suffix)", 'duplicate-post'); ?>
461
- </span>
 
 
462
  </td>
463
  </tr>
464
- <tr valign="top">
465
  <th scope="row">
466
  <label for="duplicate_post_increase_menu_order_by">
467
  <?php esc_html_e("Increase menu order by", 'duplicate-post'); ?>
468
  </label>
469
  </th>
470
- <td><input type="text" name="duplicate_post_increase_menu_order_by" id="duplicate_post_increase_menu_order_by"
471
- value="<?php form_option('duplicate_post_increase_menu_order_by'); ?>" />
472
- </td>
473
- <td><span class="description"><?php esc_html_e("Add this number to the original menu order (blank or zero to retain the value)", 'duplicate-post'); ?>
474
- </span>
 
 
475
  </td>
476
  </tr>
477
- <tr valign="top">
478
  <th scope="row">
479
  <label for="duplicate_post_blacklist">
480
  <?php esc_html_e("Do not copy these fields", 'duplicate-post'); ?>
@@ -483,34 +521,53 @@ img#donate-button{
483
  <td id="textfield"><input type="text"
484
  name="duplicate_post_blacklist"
485
  id="duplicate_post_blacklist"
486
- value="<?php form_option('duplicate_post_blacklist'); ?>" /></td>
487
- <td><span class="description"><?php esc_html_e("Comma-separated list of meta fields that must not be copied", 'duplicate-post'); ?><br />
488
- <small><?php esc_html_e("You can use * to match zero or more alphanumeric characters or underscores: e.g. field*", 'duplicate-post'); ?>
489
- </small> </span>
490
- </td>
 
 
491
  </tr>
492
- <tr valign="top">
493
- <th scope="row"><?php esc_html_e("Do not copy these taxonomies", 'duplicate-post'); ?><br />
494
- <a class="toggle_link" href="#"
495
- onclick="toggle_private_taxonomies();return false;"><?php esc_html_e('Show/hide private taxonomies', 'duplicate-post');?>
496
- </a>
497
  </th>
498
- <td colspan="2"><?php $taxonomies=get_taxonomies(array(),'objects'); usort($taxonomies, 'duplicate_post_tax_obj_cmp');
499
- $taxonomies_blacklist = get_option('duplicate_post_taxonomies_blacklist');
500
- if ($taxonomies_blacklist == "") $taxonomies_blacklist = array();
501
- foreach ($taxonomies as $taxonomy ) :
502
- if($taxonomy->name == 'post_format'){
503
- continue;
504
- }
505
- ?> <label
506
- class="taxonomy_<?php echo ($taxonomy->public)?'public':'private';?>">
507
- <input type="checkbox"
508
- name="duplicate_post_taxonomies_blacklist[]"
509
- value="<?php echo $taxonomy->name?>"
510
- <?php if(in_array($taxonomy->name, $taxonomies_blacklist)) echo 'checked="checked"'?> />
511
- <?php echo $taxonomy->labels->name.' ['.$taxonomy->name.']'; ?>
512
- </label> <?php endforeach; ?> <span class="description"><?php esc_html_e("Select the taxonomies you don't want to be copied", 'duplicate-post'); ?>
513
- </span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
514
  </td>
515
  </tr>
516
  </table>
@@ -521,46 +578,77 @@ img#donate-button{
521
  id="who-tab"
522
  aria-labelledby="who"
523
  hidden="hidden">
524
- <table class="form-table">
 
525
  <?php if ( current_user_can( 'promote_users' ) ){ ?>
526
- <tr valign="top">
527
- <th scope="row"><?php esc_html_e("Roles allowed to copy", 'duplicate-post'); ?>
528
- </th>
529
- <td><?php global $wp_roles;
530
- $roles = $wp_roles->get_names();
531
- $post_types = get_post_types( array( 'show_ui' => true ), 'objects' );
532
- $edit_capabilities = array('edit_posts' => true);
533
- foreach( $post_types as $post_type ) {
534
- $edit_capabilities[$post_type->cap->edit_posts] = true;
535
- }
536
- foreach ( $roles as $name => $display_name ):
537
- $role = get_role( $name );
538
- if( count ( array_intersect_key( $role->capabilities, $edit_capabilities ) ) > 0 ): ?>
539
- <label> <input
540
- type="checkbox" name="duplicate_post_roles[]"
541
- value="<?php echo $name ?>"
542
- <?php if($role->has_cap('copy_posts')) echo 'checked="checked"'?> />
543
- <?php echo translate_user_role($display_name); ?>
544
- </label> <?php endif; endforeach; ?> <span class="description"><?php esc_html_e("Warning: users will be able to copy all posts, even those of other users", 'duplicate-post'); ?><br />
545
- <?php esc_html_e("Passwords and contents of password-protected posts may become visible to undesired users and visitors", 'duplicate-post'); ?>
546
- </span>
547
- </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
548
  </tr>
549
  <?php } ?>
550
- <tr valign="top">
551
- <th scope="row"><?php esc_html_e("Enable for these post types", 'duplicate-post'); ?>
552
- </th>
553
- <td><?php $post_types = get_post_types(array('show_ui' => true),'objects');
554
- foreach ($post_types as $post_type_object ) :
555
- if ($post_type_object->name == 'attachment') continue; ?> <label> <input
556
- type="checkbox" name="duplicate_post_types_enabled[]"
557
- value="<?php echo $post_type_object->name?>"
558
- <?php if(duplicate_post_is_post_type_enabled($post_type_object->name)) echo 'checked="checked"'?> />
559
- <?php echo $post_type_object->labels->name?>
560
- </label> <?php endforeach; ?> <span class="description"><?php esc_html_e("Select the post types you want the plugin to be enabled", 'duplicate-post'); ?>
561
- <br /> <?php esc_html_e("Whether the links are displayed for custom post types registered by themes or plugins depends on their use of standard WordPress UI elements", 'duplicate-post'); ?>
562
- </span>
563
- </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
  </tr>
565
  </table>
566
  </section>
@@ -570,71 +658,145 @@ img#donate-button{
570
  id="where-tab"
571
  aria-labelledby="where"
572
  hidden="hidden">
573
- <table class="form-table">
574
- <tr valign="top">
575
- <th scope="row"><?php esc_html_e("Show links in", 'duplicate-post'); ?>
576
- </th>
577
- <td><label><input type="checkbox" name="duplicate_post_show_row"
578
- value="1" <?php if(get_option('duplicate_post_show_row') == 1) echo 'checked="checked"'; ?>/>
579
- <?php esc_html_e("Post list", 'duplicate-post'); ?> </label>
580
- <label><input type="checkbox" name="duplicate_post_show_submitbox" value="1" <?php if(get_option('duplicate_post_show_submitbox') == 1) echo 'checked="checked"'; ?>/>
581
- <?php esc_html_e("Edit screen", 'duplicate-post'); ?> </label>
582
- <label><input type="checkbox" name="duplicate_post_show_adminbar" value="1" <?php if(get_option('duplicate_post_show_adminbar') == 1) echo 'checked="checked"'; ?>/>
583
- <?php esc_html_e("Admin bar", 'duplicate-post'); ?> <span class="description">(<?php esc_html_e("now works on Edit screen too - check this option to use with Gutenberg enabled", 'duplicate-post'); ?>)</span></label>
584
- <?php global $wp_version;
585
- if( version_compare($wp_version, '4.7') >= 0 ){ ?>
586
- <label><input type="checkbox" name="duplicate_post_show_bulkactions" value="1" <?php if(get_option('duplicate_post_show_bulkactions') == 1) echo 'checked="checked"'; ?>/>
587
- <?php esc_html_e("Bulk Actions", 'default'); ?> </label>
588
- <?php } ?>
589
- </td>
590
- </tr>
591
- <tr valign="top">
592
- <td colspan="2"><span class="description"><?php esc_html_e("Whether the links are displayed for custom post types registered by themes or plugins depends on their use of standard WordPress UI elements", 'duplicate-post'); ?>
593
- <br /> <?php printf(__('You can also use the template tag duplicate_post_clone_post_link( $link, $before, $after, $id ). You can find more info about this on the <a href="%s">developer&apos;s guide for Duplicate Post</a>', 'duplicate-post'), 'https://duplicate-post.lopo.it/docs/developers-guide/functions-template-tags/duplicate_post_clone_post_link/'); ?>
594
- </span>
595
- </td>
596
- </tr>
597
- <tr valign="top">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
  <th scope="row"><?php esc_html_e("Show original item:", 'duplicate-post'); ?></th>
599
  <td>
600
- <label>
601
- <input type="checkbox" name="duplicate_post_show_original_meta_box"
602
- value="1" <?php if(get_option('duplicate_post_show_original_meta_box') == 1) echo 'checked="checked"'; ?>/>
603
- <?php esc_html_e("In a metabox in the Edit screen [Classic editor]", 'duplicate-post'); ?>
604
- <span class="description">(<?php esc_html_e("you'll also be able to delete the reference to the original item with a checkbox", 'duplicate-post'); ?>)</span>
605
- </label>
606
- <label>
607
- <input type="checkbox" name="duplicate_post_show_original_column"
608
- value="1" <?php if(get_option('duplicate_post_show_original_column') == 1) echo 'checked="checked"'; ?>/>
609
- <?php esc_html_e("In a column in the Post list", 'duplicate-post'); ?>
610
- <span class="description">(<?php esc_html_e("you'll also be able to delete the reference to the original item with a checkbox in Quick Edit", 'duplicate-post'); ?>)</span>
611
- </label>
612
- <label>
613
- <input type="checkbox" name="duplicate_post_show_original_in_post_states"
614
- value="1" <?php if(get_option('duplicate_post_show_original_in_post_states') == 1) echo 'checked="checked"'; ?>/>
615
- <?php esc_html_e("After the title in the Post list", 'duplicate-post'); ?>
616
- </label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
  </td>
618
  </tr>
619
- <tr valign="top">
620
- <th scope="row">
621
- <label for="duplicate_post_show_notice">
622
- <?php esc_html_e("Show update notice", 'duplicate-post'); ?>
623
- </label>
624
- </th>
625
- <td><input type="checkbox" name="duplicate_post_show_notice" id="duplicate_post_show_notice"
626
- value="1" <?php if(get_option('duplicate_post_show_notice') == 1) echo 'checked="checked"'; ?>/>
627
- </td>
628
- </tr>
 
 
 
 
 
 
 
629
  </table>
630
  </section>
631
  <p class="submit">
632
- <input type="submit" class="button-primary"
633
- value="<?php esc_html_e('Save Changes', 'duplicate-post') ?>" />
634
  </p>
635
 
636
  </form>
637
  </div>
638
  <?php
639
  }
640
- ?>
46
 
47
 
48
  function duplicate_post_menu() {
49
+ $page_hook = add_options_page(
50
+ /* translators: %s: Yoast */
51
+ sprintf( __( '%s Duplicate Post settings', 'duplicate-post' ), 'Yoast' ),
52
+ __( 'Duplicate Post', 'duplicate-post' ),
53
+ 'manage_options',
54
+ 'duplicatepost',
55
+ 'duplicate_post_options'
56
+ );
57
+ add_action( $page_hook, 'duplicate_post_add_options_page_css' );
58
+ }
59
+
60
+ /**
61
+ * Enqueues a CSS file with styles for the options page.
62
+ *
63
+ * @ignore
64
+ */
65
+ function duplicate_post_add_options_page_css() {
66
+ wp_enqueue_style( 'duplicate-post-options', plugins_url( '/duplicate-post-options.css', __FILE__ ), array(), DUPLICATE_POST_CURRENT_VERSION );
67
  }
68
 
69
  function duplicate_post_options() {
70
+ global $wp_roles, $wp_version;
71
 
72
  if ( current_user_can( 'promote_users' ) && (isset($_GET['settings-updated']) && $_GET['settings-updated'] == true)){
 
73
  $roles = $wp_roles->get_names();
74
 
75
  $dp_roles = get_option('duplicate_post_roles');
89
  }
90
  ?>
91
  <div class="wrap">
 
 
 
92
  <h1>
93
+ <?php
94
+ /* translators: %s: Yoast */
95
+ echo esc_html(sprintf( __( '%s Duplicate Post settings', 'duplicate-post'), 'Yoast' ) );
96
+ ?>
97
  </h1>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
  <script>
100
  var tablist;
267
 
268
  });
269
 
 
 
 
 
 
270
  jQuery(function(){
271
+ jQuery('.taxonomy_private').hide();
272
+
273
+ jQuery( '.toggle-private-taxonomies' )
274
+ .on( 'click', function() {
275
+ buttonElement = jQuery( this );
276
+ jQuery( '.taxonomy_private' ).toggle( 300, function() {
277
+ buttonElement.attr( 'aria-expanded', jQuery( this ).is( ":visible" ) );
278
+ } );
279
+ } );
280
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
+ </script>
283
 
284
  <form method="post" action="options.php" style="clear: both" id="duplicate_post_settings_form">
285
  <?php settings_fields('duplicate_post_group'); ?>
318
  role="tabpanel"
319
  id="what-tab"
320
  aria-labelledby="what">
321
+ <h2 class="hide-if-js"><?php esc_html_e( 'What to copy', 'duplicate-post' ); ?></h2>
322
+ <table class="form-table" role="presentation">
323
+ <tr>
324
+ <th scope="row"><?php esc_html_e('Post/page elements to copy', 'duplicate-post'); ?></th>
325
+ <td>
326
+ <fieldset>
327
+ <legend class="screen-reader-text"><?php esc_html_e( 'Post/page elements to copy', 'duplicate-post' ); ?></legend>
328
+ <input type="checkbox"
329
+ name="duplicate_post_copytitle" value="1"
330
+ id="duplicate-post-copytitle"
331
+ <?php
332
+ if ( 1 === intval( get_option( 'duplicate_post_copytitle' ) ) ) {
333
+ echo 'checked="checked"';}
334
+ ?>
335
+ />
336
+ <label for="duplicate-post-copytitle"><?php esc_html_e( 'Title', 'default' ); ?></label><br />
337
+ <input type="checkbox"
338
+ name="duplicate_post_copydate" value="1"
339
+ id="duplicate-post-copydate"
340
+ <?php
341
+ if ( 1 === intval( get_option( 'duplicate_post_copydate' ) ) ) {
342
+ echo 'checked="checked"';}
343
+ ?>
344
+ />
345
+ <label for="duplicate-post-copydate"><?php esc_html_e( 'Date', 'default' ); ?></label><br />
346
+ <input type="checkbox"
347
+ name="duplicate_post_copystatus" value="1"
348
+ id="duplicate-post-copystatus"
349
+ <?php
350
+ if ( 1 === intval( get_option( 'duplicate_post_copystatus' ) ) ) {
351
+ echo 'checked="checked"';}
352
+ ?>
353
+ />
354
+ <label for="duplicate-post-copystatus"><?php esc_html_e( 'Status', 'default' ); ?></label><br />
355
+ <input type="checkbox"
356
+ name="duplicate_post_copyslug" value="1"
357
+ id="duplicate-post-copyslug"
358
+ <?php
359
+ if ( 1 === intval( get_option( 'duplicate_post_copyslug' ) ) ) {
360
+ echo 'checked="checked"';}
361
+ ?>
362
+ />
363
+ <label for="duplicate-post-copyslug"><?php esc_html_e( 'Slug', 'default' ); ?></label><br />
364
+ <input type="checkbox"
365
+ name="duplicate_post_copyexcerpt" value="1"
366
+ id="duplicate-post-copyexcerpt"
367
+ <?php
368
+ if ( 1 === intval( get_option( 'duplicate_post_copyexcerpt' ) ) ) {
369
+ echo 'checked="checked"';}
370
+ ?>
371
+ />
372
+ <label for="duplicate-post-copyexcerpt"><?php esc_html_e( 'Excerpt', 'default' ); ?></label><br />
373
+ <input type="checkbox"
374
+ name="duplicate_post_copycontent" value="1"
375
+ id="duplicate-post-copycontent"
376
+ <?php
377
+ if ( 1 === intval( get_option( 'duplicate_post_copycontent' ) ) ) {
378
+ echo 'checked="checked"';}
379
+ ?>
380
+ />
381
+ <label for="duplicate-post-copycontent"><?php esc_html_e( 'Content', 'default' ); ?></label><br />
382
+ <input type="checkbox"
383
+ name="duplicate_post_copythumbnail" value="1"
384
+ id="duplicate-post-copythumbnail"
385
+ <?php
386
+ if ( 1 === intval( get_option( 'duplicate_post_copythumbnail' ) ) ) {
387
+ echo 'checked="checked"';}
388
+ ?>
389
+ />
390
+ <label for="duplicate-post-copythumbnail"><?php esc_html_e( 'Featured Image', 'default' ); ?></label><br />
391
+ <input type="checkbox"
392
+ name="duplicate_post_copytemplate" value="1"
393
+ id="duplicate-post-copytemplate"
394
+ <?php
395
+ if ( 1 === intval( get_option( 'duplicate_post_copytemplate' ) ) ) {
396
+ echo 'checked="checked"';}
397
+ ?>
398
+ />
399
+ <label for="duplicate-post-copytemplate"><?php esc_html_e( 'Template', 'default' ); ?></label><br />
400
+ <input type="checkbox"
401
+ name="duplicate_post_copyformat" value="1"
402
+ id="duplicate-post-copyformat"
403
+ <?php
404
+ if ( 1 === intval( get_option( 'duplicate_post_copyformat' ) ) ) {
405
+ echo 'checked="checked"';}
406
+ ?>
407
+ />
408
+ <label for="duplicate-post-copyformat"><?php echo esc_html_x( 'Format', 'post format', 'default' ); ?></label><br />
409
+ <input type="checkbox"
410
+ name="duplicate_post_copyauthor" value="1"
411
+ id="duplicate-post-copyauthor"
412
+ <?php
413
+ if ( 1 === intval( get_option( 'duplicate_post_copyauthor' ) ) ) {
414
+ echo 'checked="checked"';}
415
+ ?>
416
+ />
417
+ <label for="duplicate-post-copyauthor"><?php esc_html_e( 'Author', 'default' ); ?></label><br />
418
+ <input type="checkbox"
419
+ name="duplicate_post_copypassword" value="1"
420
+ id="duplicate-post-copypassword"
421
+ <?php
422
+ if ( 1 === intval( get_option( 'duplicate_post_copypassword' ) ) ) {
423
+ echo 'checked="checked"';}
424
+ ?>
425
+ />
426
+ <label for="duplicate-post-copypassword"><?php esc_html_e( 'Password', 'default' ); ?></label><br />
427
+ <input type="checkbox"
428
+ name="duplicate_post_copyattachments" value="1"
429
+ id="duplicate-post-copyattachments"
430
+ aria-describedby="duplicate-post-copyattachments-description"
431
+ <?php
432
+ if ( 1 === intval( get_option( 'duplicate_post_copyattachments' ) ) ) {
433
+ echo 'checked="checked"';}
434
+ ?>
435
+ />
436
+ <label for="duplicate-post-copyattachments"><?php esc_html_e( 'Attachments', 'duplicate-post' ); ?></label>
437
+ <span id="duplicate-post-copyattachments-description">(<?php esc_html_e( 'you probably want this unchecked, unless you have very special requirements', 'duplicate-post' ); ?>)</span><br />
438
+ <input type="checkbox"
439
+ name="duplicate_post_copychildren" value="1"
440
+ id="duplicate-post-copychildren"
441
+ <?php
442
+ if ( 1 === intval( get_option( 'duplicate_post_copychildren' ) ) ) {
443
+ echo 'checked="checked"';}
444
+ ?>
445
+ />
446
+ <label for="duplicate-post-copychildren"><?php esc_html_e( 'Children', 'duplicate-post' ); ?></label><br />
447
+ <input type="checkbox"
448
+ name="duplicate_post_copycomments" value="1"
449
+ id="duplicate-post-copycomments"
450
+ aria-describedby="duplicate-post-copycomments-description"
451
+ <?php
452
+ if ( 1 === intval( get_option( 'duplicate_post_copycomments' ) ) ) {
453
+ echo 'checked="checked"';}
454
+ ?>
455
+ />
456
+ <label for="duplicate-post-copycomments"><?php esc_html_e( 'Comments', 'default' ); ?></label>
457
+ <span id="duplicate-post-copycomments-description">(<?php esc_html_e( 'except pingbacks and trackbacks', 'duplicate-post' ); ?>)</span><br />
458
+ <input type="checkbox"
459
+ name="duplicate_post_copymenuorder" value="1"
460
+ id="duplicate-post-copymenuorder"
461
+ <?php
462
+ if ( 1 === intval( get_option( 'duplicate_post_copymenuorder' ) ) ) {
463
+ echo 'checked="checked"';}
464
+ ?>
465
+ />
466
+ <label for="duplicate-post-copymenuorder"><?php esc_html_e( 'Menu order', 'default' ); ?></label>
467
+ </fieldset>
468
+ </td>
469
  </tr>
470
+ <tr>
471
  <th scope="row">
472
  <label for="duplicate_post_title_prefix">
473
  <?php esc_html_e("Title prefix", 'duplicate-post'); ?>
474
  </label>
475
  </th>
476
+ <td><input type="text" name="duplicate_post_title_prefix"
477
+ id="duplicate_post_title_prefix"
478
+ aria-describedby="duplicate-post-title-prefix-description"
479
+ value="<?php form_option('duplicate_post_title_prefix'); ?>" />
480
+ <p id="duplicate-post-title-prefix-description">
481
+ <?php esc_html_e("Prefix to be added before the title, e.g. \"Copy of\" (blank for no prefix)", 'duplicate-post'); ?>
482
+ </p>
483
  </td>
484
  </tr>
485
+ <tr>
486
  <th scope="row">
487
  <label for="duplicate_post_title_suffix">
488
  <?php esc_html_e("Title suffix", 'duplicate-post'); ?>
489
  </label>
490
  </th>
491
+ <td><input type="text" name="duplicate_post_title_suffix"
492
+ id="duplicate_post_title_suffix"
493
+ aria-describedby="duplicate-post-title-suffix-description"
494
+ value="<?php form_option('duplicate_post_title_suffix'); ?>" />
495
+ <p id="duplicate-post-title-suffix-description">
496
+ <?php esc_html_e( 'Suffix to be added after the title, e.g. "(dup)" (blank for no suffix)', 'duplicate-post' ); ?>
497
+ </p>
498
  </td>
499
  </tr>
500
+ <tr>
501
  <th scope="row">
502
  <label for="duplicate_post_increase_menu_order_by">
503
  <?php esc_html_e("Increase menu order by", 'duplicate-post'); ?>
504
  </label>
505
  </th>
506
+ <td><input type="number" min="0" step="1" name="duplicate_post_increase_menu_order_by"
507
+ id="duplicate_post_increase_menu_order_by"
508
+ aria-describedby="duplicate-post-increase-menu-order-by-description"
509
+ value="<?php form_option('duplicate_post_increase_menu_order_by'); ?>" />
510
+ <p id="duplicate-post-increase-menu-order-by-description">
511
+ <?php esc_html_e( 'Add this number to the original menu order (blank or zero to retain the value)', 'duplicate-post' ); ?>
512
+ </p>
513
  </td>
514
  </tr>
515
+ <tr>
516
  <th scope="row">
517
  <label for="duplicate_post_blacklist">
518
  <?php esc_html_e("Do not copy these fields", 'duplicate-post'); ?>
521
  <td id="textfield"><input type="text"
522
  name="duplicate_post_blacklist"
523
  id="duplicate_post_blacklist"
524
+ aria-describedby="duplicate-post-blacklist-description"
525
+ value="<?php form_option('duplicate_post_blacklist'); ?>" />
526
+ <p id="duplicate-post-blacklist-description">
527
+ <?php esc_html_e( 'Comma-separated list of meta fields that must not be copied.', 'duplicate-post' ); ?>
528
+ <?php esc_html_e( 'You can use * to match zero or more alphanumeric characters or underscores: e.g. field*', 'duplicate-post' ); ?>
529
+ </p>
530
+ </td>
531
  </tr>
532
+ <tr>
533
+ <th scope="row">
534
+ <?php esc_html_e( 'Do not copy these taxonomies', 'duplicate-post' ); ?>
 
 
535
  </th>
536
+ <td>
537
+ <fieldset>
538
+ <legend class="screen-reader-text"><?php esc_html_e( 'Do not copy these taxonomies', 'duplicate-post' ); ?></legend>
539
+ <?php
540
+ $taxonomies = get_taxonomies( array(), 'objects' );
541
+ usort( $taxonomies, 'duplicate_post_tax_obj_cmp' );
542
+ $taxonomies_blacklist = get_option( 'duplicate_post_taxonomies_blacklist' );
543
+ if ( '' === $taxonomies_blacklist ) {
544
+ $taxonomies_blacklist = array();
545
+ }
546
+ foreach ( $taxonomies as $taxonomy ) :
547
+ if ( 'post_format' === $taxonomy->name ) {
548
+ continue;
549
+ }
550
+ ?>
551
+ <div class="taxonomy_<?php echo ( $taxonomy->public ) ? 'public' : 'private'; ?>">
552
+ <input type="checkbox"
553
+ name="duplicate_post_taxonomies_blacklist[]"
554
+ id="duplicate-post-<?php echo esc_attr( $taxonomy->name ); ?>"
555
+ value="<?php echo esc_attr( $taxonomy->name ); ?>"
556
+ <?php
557
+ if ( in_array( $taxonomy->name, $taxonomies_blacklist, true ) ) {
558
+ echo 'checked="checked"';
559
+ }
560
+ ?>
561
+ />
562
+ <label for="duplicate-post-<?php echo esc_attr( $taxonomy->name ); ?>">
563
+ <?php echo esc_html( $taxonomy->labels->name . ' [' . $taxonomy->name . ']' ); ?>
564
+ </label><br />
565
+ </div>
566
+ <?php endforeach; ?>
567
+ <button type="button" class="button-link hide-if-no-js toggle-private-taxonomies" aria-expanded="false">
568
+ <?php esc_html_e( 'Show/hide private taxonomies', 'duplicate-post' ); ?>
569
+ </button>
570
+ </fieldset>
571
  </td>
572
  </tr>
573
  </table>
578
  id="who-tab"
579
  aria-labelledby="who"
580
  hidden="hidden">
581
+ <h2 class="hide-if-js"><?php esc_html_e( 'Permissions', 'duplicate-post' ); ?></h2>
582
+ <table class="form-table" role="presentation">
583
  <?php if ( current_user_can( 'promote_users' ) ){ ?>
584
+ <tr>
585
+ <th scope="row"><?php esc_html_e("Roles allowed to copy", 'duplicate-post'); ?></th>
586
+ <td>
587
+ <fieldset>
588
+ <legend class="screen-reader-text"><?php esc_html_e( 'Roles allowed to copy', 'duplicate-post' ); ?></legend>
589
+ <?php
590
+
591
+ $roles = $wp_roles->get_names();
592
+ $post_types = get_post_types( array( 'show_ui' => true ), 'objects' );
593
+ $edit_capabilities = array( 'edit_posts' => true );
594
+ foreach ( $post_types as $post_type ) {
595
+ $edit_capabilities[ $post_type->cap->edit_posts ] = true;
596
+ }
597
+ foreach ( $roles as $name => $display_name ) :
598
+ $role = get_role( $name );
599
+ if ( count( array_intersect_key( $role->capabilities, $edit_capabilities ) ) > 0 ) :
600
+ ?>
601
+ <input type="checkbox"
602
+ name="duplicate_post_roles[]"
603
+ id="duplicate-post-<?php echo esc_attr( $name ); ?>"
604
+ value="<?php echo esc_attr( $name ); ?>"
605
+ <?php
606
+ if ( $role->has_cap( 'copy_posts' ) ) {
607
+ echo 'checked="checked"';}
608
+ ?>
609
+ />
610
+ <label for="duplicate-post-<?php echo esc_attr( $name ); ?>"><?php echo esc_html( translate_user_role( $display_name ) ); ?></label><br />
611
+ <?php
612
+ endif;
613
+ endforeach;
614
+ ?>
615
+ <p>
616
+ <?php esc_html_e( 'Warning: users will be able to copy all posts, even those of other users.', 'duplicate-post' ); ?><br />
617
+ <?php esc_html_e( 'Passwords and contents of password-protected posts may become visible to undesired users and visitors.', 'duplicate-post' ); ?>
618
+ </p>
619
+ </fieldset>
620
+ </td>
621
  </tr>
622
  <?php } ?>
623
+ <tr>
624
+ <th scope="row"><?php esc_html_e("Enable for these post types", 'duplicate-post'); ?></th>
625
+ <td>
626
+ <fieldset>
627
+ <legend class="screen-reader-text"><?php esc_html_e( 'Enable for these post types', 'duplicate-post' ); ?></legend>
628
+ <?php
629
+ $post_types = get_post_types( array( 'show_ui' => true ), 'objects' );
630
+ foreach ( $post_types as $post_type_object ) :
631
+ if ( 'attachment' === $post_type_object->name ) {
632
+ continue;
633
+ }
634
+ ?>
635
+ <input type="checkbox"
636
+ name="duplicate_post_types_enabled[]"
637
+ id="duplicate-post-<?php echo esc_attr( $post_type_object->name ); ?>"
638
+ value="<?php echo esc_attr( $post_type_object->name ); ?>"
639
+ <?php
640
+ if ( duplicate_post_is_post_type_enabled( $post_type_object->name ) ) {
641
+ echo 'checked="checked"';}
642
+ ?>
643
+ />
644
+ <label for="duplicate-post-<?php echo esc_attr( $post_type_object->name ); ?>"><?php echo esc_html( $post_type_object->labels->name ); ?></label><br />
645
+ <?php endforeach; ?>
646
+ <p>
647
+ <?php esc_html_e( 'Select the post types you want the plugin to be enabled for.', 'duplicate-post' ); ?><br />
648
+ <?php esc_html_e( 'Whether the links are displayed for custom post types registered by themes or plugins depends on their use of standard WordPress UI elements.', 'duplicate-post' ); ?>
649
+ </p>
650
+ </fieldset>
651
+ </td>
652
  </tr>
653
  </table>
654
  </section>
658
  id="where-tab"
659
  aria-labelledby="where"
660
  hidden="hidden">
661
+ <h2 class="hide-if-js"><?php esc_html_e( 'Display', 'duplicate-post' ); ?></h2>
662
+ <table class="form-table" role="presentation">
663
+ <tr>
664
+ <th scope="row"><?php esc_html_e( 'Show links in', 'duplicate-post' ); ?></th>
665
+ <td>
666
+ <fieldset>
667
+ <legend class="screen-reader-text"><?php esc_html_e( 'Show links in', 'duplicate-post' ); ?></legend>
668
+ <input
669
+ type="checkbox"
670
+ name="duplicate_post_show_row"
671
+ id="duplicate-post-show-row"
672
+ value="1"
673
+ <?php
674
+ if ( 1 === intval( get_option( 'duplicate_post_show_row' ) ) ) {
675
+ echo 'checked="checked"';}
676
+ ?>
677
+ />
678
+ <label for="duplicate-post-show-row"><?php esc_html_e( 'Post list', 'duplicate-post' ); ?></label><br />
679
+ <input
680
+ type="checkbox"
681
+ name="duplicate_post_show_submitbox"
682
+ id="duplicate-post-show-submitbox"
683
+ value="1"
684
+ <?php
685
+ if ( 1 === intval( get_option( 'duplicate_post_show_submitbox' ) ) ) {
686
+ echo 'checked="checked"';}
687
+ ?>
688
+ />
689
+ <label for="duplicate-post-show-submitbox"><?php esc_html_e( 'Edit screen', 'duplicate-post' ); ?></label><br />
690
+ <input
691
+ type="checkbox"
692
+ name="duplicate_post_show_adminbar"
693
+ id="duplicate-post-show-adminbar"
694
+ aria-describedby="duplicate-post-show-adminbar-description"
695
+ value="1"
696
+ <?php
697
+ if ( 1 === intval( get_option( 'duplicate_post_show_adminbar' ) ) ) {
698
+ echo 'checked="checked"';}
699
+ ?>
700
+ />
701
+ <label for="duplicate-post-show-adminbar"><?php esc_html_e( 'Admin bar', 'duplicate-post' ); ?></label>
702
+ <span id="duplicate-post-show-adminbar-description">(<?php esc_html_e( 'now works on Edit screen too - check this option to use with Gutenberg enabled', 'duplicate-post' ); ?>)</span><br />
703
+ <?php
704
+ if ( version_compare( $wp_version, '4.7' ) >= 0 ) {
705
+ ?>
706
+ <input
707
+ type="checkbox"
708
+ name="duplicate_post_show_bulkactions"
709
+ id="duplicate-post-show-bulkactions"
710
+ value="1"
711
+ <?php
712
+ if ( 1 === intval( get_option( 'duplicate_post_show_bulkactions' ) ) ) {
713
+ echo 'checked="checked"';}
714
+ ?>
715
+ />
716
+ <label for="duplicate-post-show-bulkactions"><?php esc_html_e( 'Bulk Actions', 'default' ); ?></label>
717
+ <?php } ?>
718
+ </fieldset>
719
+ <p>
720
+ <?php esc_html_e( 'Whether the links are displayed for custom post types registered by themes or plugins depends on their use of standard WordPress UI elements.', 'duplicate-post' ); ?>
721
+ <br />
722
+ <?php
723
+ printf(
724
+ /* translators: 1: Code start tag, 2: Code closing tag, 3: Link start tag to the template tag documentation, 4: Link closing tag. */
725
+ esc_html__( 'You can also use the template tag %1$sduplicate_post_clone_post_link( $link, $before, $after, $id )%2$s. %3$sMore info on the template tag%4$s.', 'duplicate-post' ),
726
+ '<code>',
727
+ '</code>',
728
+ '<a href="' . esc_url( 'https://duplicate-post.lopo.it/docs/developers-guide/functions-template-tags/duplicate_post_clone_post_link/' ) . '">',
729
+ '</a>'
730
+ );
731
+ ?>
732
+ </p>
733
+ </td>
734
+ </tr>
735
+ <tr>
736
  <th scope="row"><?php esc_html_e("Show original item:", 'duplicate-post'); ?></th>
737
  <td>
738
+ <input
739
+ type="checkbox"
740
+ name="duplicate_post_show_original_meta_box"
741
+ id="duplicate-post-show-original-meta-box"
742
+ aria-describedby="duplicate-post-show-original-meta-box-description"
743
+ value="1"
744
+ <?php
745
+ if( 1 === intval( get_option( 'duplicate_post_show_original_meta_box' ) ) ) {
746
+ echo 'checked="checked"';
747
+ } ?>/>
748
+ <label for="duplicate-post-show-original-meta-box"><?php esc_html_e("In a metabox in the Edit screen [Classic editor]", 'duplicate-post'); ?></label>
749
+ <p id="duplicate-post-show-original-meta-box-description">(<?php esc_html_e("you'll also be able to delete the reference to the original item with a checkbox", 'duplicate-post'); ?>)</p><br/>
750
+ <input
751
+ type="checkbox"
752
+ name="duplicate_post_show_original_column"
753
+ id="duplicate-post-show-original-column"
754
+ aria-describedby="duplicate-post-show-original-column-description"
755
+ value="1"
756
+ <?php
757
+ if( 1 === intval( get_option( 'duplicate_post_show_original_column' ) ) ) {
758
+ echo 'checked="checked"';
759
+ } ?>/>
760
+ <label for="duplicate-post-show-original-column"><?php esc_html_e("In a column in the Post list", 'duplicate-post'); ?></label>
761
+ <p id="duplicate-post-show-original-column-description">(<?php esc_html_e("you'll also be able to delete the reference to the original item with a checkbox in Quick Edit", 'duplicate-post'); ?>)</p><br/>
762
+ <input
763
+ type="checkbox"
764
+ name="duplicate_post_show_original_in_post_states"
765
+ id="duplicate-post-show-original-in-post-states"
766
+ value="1"
767
+ <?php
768
+ if( 1 === intval( get_option( 'duplicate_post_show_original_in_post_states' ) ) ) {
769
+ echo 'checked="checked"';
770
+ } ?>/>
771
+ <label for="duplicate-post-show-original-in-post-states"><?php esc_html_e("After the title in the Post list", 'duplicate-post'); ?></label>
772
  </td>
773
  </tr>
774
+ <tr>
775
+ <th scope="row"><?php esc_html_e( 'Update notice', 'duplicate-post' ); ?></th>
776
+ <td>
777
+ <input
778
+ type="checkbox"
779
+ name="duplicate_post_show_notice"
780
+ id="duplicate-post-show-notice"
781
+ value="1"
782
+ <?php
783
+ if ( 1 === intval( get_option( 'duplicate_post_show_notice' ) ) ) {
784
+ echo 'checked="checked"';
785
+ }
786
+ ?>
787
+ />
788
+ <label for="duplicate-post-show-notice"><?php esc_html_e( 'Show update notice', 'duplicate-post' ); ?></label>
789
+ </td>
790
+ </tr>
791
  </table>
792
  </section>
793
  <p class="submit">
794
+ <input type="submit" class="button button-primary"
795
+ value="<?php esc_html_e('Save changes', 'duplicate-post') ?>" />
796
  </p>
797
 
798
  </form>
799
  </div>
800
  <?php
801
  }
802
+ ?>
duplicate-post.css CHANGED
@@ -7,7 +7,7 @@
7
  #wpadminbar li#wp-admin-bar-new_draft{
8
  display: block;
9
  }
10
-
11
  #wpadminbar #wp-admin-bar-new_draft > .ab-item {
12
  text-indent: 100%;
13
  white-space: nowrap;
@@ -17,7 +17,7 @@
17
  color: #999;
18
  position: relative;
19
  }
20
-
21
  #wpadminbar #wp-admin-bar-new_draft > .ab-item::before {
22
  display: block;
23
  text-indent: 0;
@@ -29,4 +29,18 @@
29
  -webkit-font-smoothing: antialiased;
30
  -moz-osx-font-smoothing: grayscale;
31
  }
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  #wpadminbar li#wp-admin-bar-new_draft{
8
  display: block;
9
  }
10
+
11
  #wpadminbar #wp-admin-bar-new_draft > .ab-item {
12
  text-indent: 100%;
13
  white-space: nowrap;
17
  color: #999;
18
  position: relative;
19
  }
20
+
21
  #wpadminbar #wp-admin-bar-new_draft > .ab-item::before {
22
  display: block;
23
  text-indent: 0;
29
  -webkit-font-smoothing: antialiased;
30
  -moz-osx-font-smoothing: grayscale;
31
  }
32
+ }
33
+
34
+ fieldset#duplicate_post_quick_edit_fieldset{
35
+ clear: both;
36
+ }
37
+
38
+ fieldset#duplicate_post_quick_edit_fieldset label{
39
+ display: inline;
40
+ margin: 0;
41
+ vertical-align: unset;
42
+ }
43
+
44
+ fieldset#duplicate_post_quick_edit_fieldset a{
45
+ text-decoration: underline;
46
+ }
duplicate-post.php CHANGED
@@ -1,15 +1,15 @@
1
  <?php
2
- /*
3
- Plugin Name: Duplicate Post
4
- Plugin URI: https://duplicate-post.lopo.it/
5
- Description: Clone posts and pages.
6
- Version: 3.2.4
7
- Author: Enrico Battocchi
8
- Author URI: https://lopo.it
9
- Text Domain: duplicate-post
10
  */
11
 
12
- /* Copyright 2009-2012 Enrico Battocchi (email : enrico.battocchi@gmail.com)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
@@ -31,8 +31,7 @@ if ( ! defined( 'ABSPATH' ) ) {
31
  }
32
 
33
  // Version of the plugin
34
- define('DUPLICATE_POST_CURRENT_VERSION', '3.2.4' );
35
-
36
 
37
  /**
38
  * Initialise the internationalisation domain
@@ -42,17 +41,28 @@ function duplicate_post_load_plugin_textdomain() {
42
  }
43
  add_action( 'plugins_loaded', 'duplicate_post_load_plugin_textdomain' );
44
 
 
45
 
46
- add_filter("plugin_action_links_".plugin_basename(__FILE__), "duplicate_post_plugin_actions", 10, 4);
47
-
48
- function duplicate_post_plugin_actions( $actions, $plugin_file, $plugin_data, $context ) {
49
- array_unshift($actions,
50
- sprintf('<a href="%s" aria-label="%s">%s</a>',
51
- menu_page_url('duplicatepost', false),
52
- esc_attr__( 'Settings for Duplicate Post', 'duplicate-post'),
53
- esc_html__("Settings", 'default')
54
- )
 
 
 
 
 
 
 
 
55
  );
 
 
56
  return $actions;
57
  }
58
 
@@ -60,4 +70,4 @@ require_once (dirname(__FILE__).'/duplicate-post-common.php');
60
 
61
  if (is_admin()){
62
  require_once (dirname(__FILE__).'/duplicate-post-admin.php');
63
- }
1
  <?php
2
+ /**
3
+ * Plugin Name: Yoast Duplicate Post
4
+ * Plugin URI: https://yoast.com/wordpress/plugins/duplicate-post/
5
+ * Description: Clone posts and pages.
6
+ * Version: 3.2.5
7
+ * Author: Enrico Battocchi & Team Yoast
8
+ * Author URI: https://yoast.com
9
+ * Text Domain: duplicate-post
10
  */
11
 
12
+ /* Copyright 2020 Yoast BV (email : info@yoast.com)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
31
  }
32
 
33
  // Version of the plugin
34
+ define('DUPLICATE_POST_CURRENT_VERSION', '3.2.5' );
 
35
 
36
  /**
37
  * Initialise the internationalisation domain
41
  }
42
  add_action( 'plugins_loaded', 'duplicate_post_load_plugin_textdomain' );
43
 
44
+ add_filter( "plugin_action_links_" . plugin_basename(__FILE__), "duplicate_post_plugin_actions", 10);
45
 
46
+ /**
47
+ * Adds 'Settings' link to plugin entry in the Plugins list.
48
+ *
49
+ * @ignore
50
+ * @see 'plugin_action_links_$plugin_file'
51
+ *
52
+ * @param array $actions An array of plugin action links.
53
+ * @return array
54
+ */
55
+ function duplicate_post_plugin_actions( $actions ) {
56
+ $settings_action = array(
57
+ 'settings' => sprintf(
58
+ '<a href="%1$s" %2$s>%3$s</a>',
59
+ menu_page_url( 'duplicatepost', false ),
60
+ 'aria-label="' . __( 'Settings for Duplicate Post', 'duplicate-post' ) . '"',
61
+ esc_html__( 'Settings', 'default' )
62
+ ),
63
  );
64
+
65
+ $actions = $settings_action + $actions;
66
  return $actions;
67
  }
68
 
70
 
71
  if (is_admin()){
72
  require_once (dirname(__FILE__).'/duplicate-post-admin.php');
73
+ }
duplicate_post_yoast_icon-125x125.png ADDED
Binary file
readme.txt CHANGED
@@ -1,6 +1,6 @@
1
- === Duplicate Post ===
2
- Contributors: lopo
3
- Donate link: https://duplicate-post.lopo.it/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 3.6
6
  Tested up to: 5.4
@@ -14,7 +14,6 @@ Copy posts of any type with a click!
14
  == Description ==
15
 
16
  This plugin allows users to clone posts of any type, or copy them to new drafts for further editing.
17
- If you find this useful, [**please consider donating**](https://duplicate-post.lopo.it/donate/) whatever sum you choose, **even just 10 cents**. Just a few cents from every user would help me develop the plugin and improve support.
18
 
19
  How it works:
20
 
@@ -24,7 +23,7 @@ How it works:
24
 
25
  3. In 'Edit Posts'/'Edit Pages', you can click on 'New Draft' link below the post/page title.
26
 
27
- 4. On the post edit screen, you can click on 'Copy to a new draft' above "Cancel"/"Move to trash" or in the admin bar.
28
 
29
  5. While viewing a post as a logged in user, you can click on 'Copy to a new draft' in the admin bar.
30
 
@@ -32,19 +31,13 @@ How it works:
32
 
33
  There is also a **template tag**, so you can put it in your templates and clone your posts/pages from the front-end. Clicking on the link will lead you to the edit page for the new draft, just like the admin bar link.
34
 
35
- Duplicate Post has many useful settings to customize its behavior and restrict its use to certain roles or post types. Check out the extensive documentation on [the plugin's site](https://duplicate-post.lopo.it).
36
-
37
- **If you're a plugin developer**, I suggest you to read the [Developer's Guide](https://duplicate-post.lopo.it/docs/developers-guide/) to ensure compatibility between your plugin(s) and mine. Feel free to [contact me](https://duplicate-post.lopo.it/contact) so we can keep in touch and collaborate.
38
-
39
- Duplicate Post does not collect any information outside your WordPress installation, therefore it's 100% GDPR compliant.
40
-
41
- Thanks for all the suggestions, bug reports, translations and donations, they're frankly too many to be listed here!
42
 
43
  == Installation ==
44
 
45
  Use WordPress' Add New Plugin feature, searching "Duplicate Post", or download the archive and:
46
 
47
- 1. Unzip the archive on your computer
48
  2. Upload `duplicate-post` directory to the `/wp-content/plugins/` directory
49
  3. Activate the plugin through the 'Plugins' menu in WordPress
50
  4. Go to Settings -> Duplicate Post and customize behaviour as needed
@@ -66,7 +59,6 @@ If it still doesn't work, maybe there is some kind of conflict with other plugin
66
  From version 3.0 the plugin's translations are managed by the WordPress.org platform and the plugin is shipped without language files, so first of all update translations under Dashboard->Updates.
67
 
68
  If Duplicate Post is still in English, or if there are some untraslated strings, you can help traslating to your language [here](https://translate.wordpress.org/projects/wp-plugins/duplicate-post): you only need a WordPress.org account.
69
- [Contact me](https://duplicate-post.lopo.it/contact) if you wish to become an editor for your language.
70
 
71
  == Screenshots ==
72
 
@@ -74,11 +66,14 @@ If Duplicate Post is still in English, or if there are some untraslated strings,
74
  2. By clicking on "Clone" the post is cloned immediately. "New draft" leads to the edit screen.
75
  3. The options page.
76
  4. The template tag manually added to Twenty Ten theme. Click on the "Copy to a new draft" link and you're redirected to the edit screen for a new draft copy of your post.
77
- 5. The admin bar link.
78
  6. Bulk clone action.
79
 
80
  == Upgrade Notice ==
81
 
 
 
 
82
  = 3.2.4 =
83
  Options to show original post + accessibility improvements
84
 
@@ -116,7 +111,7 @@ Recommended if you have 3.0: fixes the upgrade bug
116
  Major redesign of the settings page + fine-tune options (what to copy, custom post types, etc.) + bugfixes and XSS prevention
117
 
118
  = 2.6 =
119
- PHP 5.4 (Strict Standards) compatible + Fixed possible XSS and SQL injections + other bugs
120
 
121
  = 2.4.1 =
122
  Fixes a couple of bug. Recommended if you have problems with v2.4
@@ -131,10 +126,10 @@ Fixes a bunch of bugs + copy attachments + choose where to show the links.
131
  VERY IMPORTANT UPGRADE to get rid of problems with complex custom fields, afflicting both 2.1.* releases.
132
 
133
  = 2.1.1 =
134
- Fix for upgrade problem
135
 
136
  = 2.1 =
137
- Copy from admin bar + user levels out, roles and capabilities in.
138
 
139
  = 2.0.2 =
140
  Fixed permalink bug + double choice on posts list
@@ -153,6 +148,13 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
153
 
154
  == Changelog ==
155
 
 
 
 
 
 
 
 
156
  = 3.2.4 (2019-12-10) =
157
  * Options to show original item in post list (in a column or alongside post states) or in a metabox in the edit screen
158
  * Accessibility improvements
@@ -165,7 +167,7 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
165
 
166
  = 3.2.2 (2018-04-13) =
167
  * The "Admin bar" option shows the link in the post edit screen too, so you can use the plugin with Gutenberg enabled
168
- * Option for "Slug" not set by default on new installations
169
  * Better display of icon in the Admin bar on small screens
170
 
171
  = 3.2.1 (2017-11-25) =
@@ -196,13 +198,13 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
196
  * Using wp_slash (WP 3.6+) or a better workaround (WP 4.4+) on the post and its meta, should also fix some compatibility issues
197
  * Check if admin bar is showing before enqueueing CSS
198
  * Probable fix for repeated clone bug
199
- * Other minor bugs fixed
200
 
201
  = 3.0.3 (2016-10-29) =
202
  * Notices in admin after copying
203
  * Fixes warning in custom post type archives
204
  * Uses site options for version and notice
205
- * Minor fixes
206
 
207
  = 3.0.2 (2016-10-18) =
208
  * Can now be enabled for every custom post type with visible UI (not just public ones)
@@ -226,7 +228,7 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
226
  = 2.6 (2014-04-27) =
227
  * PHP 5.4 (Strict Standards) compatible
228
  * Fixed possible XSS and SQL injections
229
- * other bugs
230
  * Updated and added translations
231
  * Tested up to WP 3.8.1
232
 
@@ -238,13 +240,13 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
238
  = 2.4 (2012-04-29) =
239
  * New option to clone the children of the original page
240
  * Licence changed to GPLv2 or later
241
- * Fixed publishing dates for drafts
242
  * Fixed bug with prefix/suffix
243
  * Translation project moved to GlotPress
244
 
245
  = 2.3 (2012-04-06) =
246
  * Added options to choose where to show the "Clone" links
247
- * Clone attachments (i.e. references in the DB, not physical files)
248
  * Fix for untranslated user roles
249
  * Some other fixes (missing checks, PHP warnings and errors, etc.)
250
 
@@ -312,7 +314,7 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
312
 
313
  = 0.5 (2009-01-09) =
314
  * Fix for post-meta
315
- * WP2.7 compatibility
316
 
317
  = 0.4 (2008-11-23) =
318
  * Support for new WP post revision feature
@@ -322,8 +324,7 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
322
 
323
  == Contribute ==
324
 
325
- If you find this useful and if you want to contribute, there are three ways:
326
 
327
- 1. You can [write me](https://duplicate-post.lopo.it/contact) and submit your bug reports, suggestions and requests for features;
328
  2. If you want to translate it to your language (there are just a few lines of text), you can use the [translation project](https://translate.wordpress.org/projects/wp-plugins/duplicate-post);
329
- 3. Using the plugin is free, but if you want you can support my efforts by donating with PayPal [here](https://duplicate-post.lopo.it/donate)
1
+ === Yoast Duplicate Post ===
2
+ Contributors: yoast, lopo
3
+ Donate link: https://yoast.com/wordpress/plugins/duplicate-post/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 3.6
6
  Tested up to: 5.4
14
  == Description ==
15
 
16
  This plugin allows users to clone posts of any type, or copy them to new drafts for further editing.
 
17
 
18
  How it works:
19
 
23
 
24
  3. In 'Edit Posts'/'Edit Pages', you can click on 'New Draft' link below the post/page title.
25
 
26
+ 4. On the post edit screen, you can click on 'Copy to a new draft' above "Cancel"/"Move to trash" or in the admin bar.
27
 
28
  5. While viewing a post as a logged in user, you can click on 'Copy to a new draft' in the admin bar.
29
 
31
 
32
  There is also a **template tag**, so you can put it in your templates and clone your posts/pages from the front-end. Clicking on the link will lead you to the edit page for the new draft, just like the admin bar link.
33
 
34
+ Duplicate Post has many useful settings to customize its behavior and restrict its use to certain roles or post types. Check out the extensive documentation [on yoast.com](https://yoast.com/wordpress/plugins/duplicate-post/) and our [developer docs](https://developer.yoast.com/duplicate-post/).
 
 
 
 
 
 
35
 
36
  == Installation ==
37
 
38
  Use WordPress' Add New Plugin feature, searching "Duplicate Post", or download the archive and:
39
 
40
+ 1. Unzip the archive on your computer
41
  2. Upload `duplicate-post` directory to the `/wp-content/plugins/` directory
42
  3. Activate the plugin through the 'Plugins' menu in WordPress
43
  4. Go to Settings -> Duplicate Post and customize behaviour as needed
59
  From version 3.0 the plugin's translations are managed by the WordPress.org platform and the plugin is shipped without language files, so first of all update translations under Dashboard->Updates.
60
 
61
  If Duplicate Post is still in English, or if there are some untraslated strings, you can help traslating to your language [here](https://translate.wordpress.org/projects/wp-plugins/duplicate-post): you only need a WordPress.org account.
 
62
 
63
  == Screenshots ==
64
 
66
  2. By clicking on "Clone" the post is cloned immediately. "New draft" leads to the edit screen.
67
  3. The options page.
68
  4. The template tag manually added to Twenty Ten theme. Click on the "Copy to a new draft" link and you're redirected to the edit screen for a new draft copy of your post.
69
+ 5. The admin bar link.
70
  6. Bulk clone action.
71
 
72
  == Upgrade Notice ==
73
 
74
+ = 3.2.5 =
75
+ First release from Yoast + accessibility improvements + filter deprecated
76
+
77
  = 3.2.4 =
78
  Options to show original post + accessibility improvements
79
 
111
  Major redesign of the settings page + fine-tune options (what to copy, custom post types, etc.) + bugfixes and XSS prevention
112
 
113
  = 2.6 =
114
+ PHP 5.4 (Strict Standards) compatible + Fixed possible XSS and SQL injections + other bugs
115
 
116
  = 2.4.1 =
117
  Fixes a couple of bug. Recommended if you have problems with v2.4
126
  VERY IMPORTANT UPGRADE to get rid of problems with complex custom fields, afflicting both 2.1.* releases.
127
 
128
  = 2.1.1 =
129
+ Fix for upgrade problem
130
 
131
  = 2.1 =
132
+ Copy from admin bar + user levels out, roles and capabilities in.
133
 
134
  = 2.0.2 =
135
  Fixed permalink bug + double choice on posts list
148
 
149
  == Changelog ==
150
 
151
+ = 3.2.5 (2020-07-07) =
152
+ * First release from Yoast
153
+ * Accessibility improvements to the settings page
154
+ * Accessibility improvements to the "Show original item" metabox
155
+ * Accessibility improvements to the "Show original item" check box in Quick Edit
156
+ * duplicate_post_blacklist_filter deprecated in favor of duplicate_post_excludelist_filter
157
+
158
  = 3.2.4 (2019-12-10) =
159
  * Options to show original item in post list (in a column or alongside post states) or in a metabox in the edit screen
160
  * Accessibility improvements
167
 
168
  = 3.2.2 (2018-04-13) =
169
  * The "Admin bar" option shows the link in the post edit screen too, so you can use the plugin with Gutenberg enabled
170
+ * Option for "Slug" not set by default on new installations
171
  * Better display of icon in the Admin bar on small screens
172
 
173
  = 3.2.1 (2017-11-25) =
198
  * Using wp_slash (WP 3.6+) or a better workaround (WP 4.4+) on the post and its meta, should also fix some compatibility issues
199
  * Check if admin bar is showing before enqueueing CSS
200
  * Probable fix for repeated clone bug
201
+ * Other minor bugs fixed
202
 
203
  = 3.0.3 (2016-10-29) =
204
  * Notices in admin after copying
205
  * Fixes warning in custom post type archives
206
  * Uses site options for version and notice
207
+ * Minor fixes
208
 
209
  = 3.0.2 (2016-10-18) =
210
  * Can now be enabled for every custom post type with visible UI (not just public ones)
228
  = 2.6 (2014-04-27) =
229
  * PHP 5.4 (Strict Standards) compatible
230
  * Fixed possible XSS and SQL injections
231
+ * other bugs
232
  * Updated and added translations
233
  * Tested up to WP 3.8.1
234
 
240
  = 2.4 (2012-04-29) =
241
  * New option to clone the children of the original page
242
  * Licence changed to GPLv2 or later
243
+ * Fixed publishing dates for drafts
244
  * Fixed bug with prefix/suffix
245
  * Translation project moved to GlotPress
246
 
247
  = 2.3 (2012-04-06) =
248
  * Added options to choose where to show the "Clone" links
249
+ * Clone attachments (i.e. references in the DB, not physical files)
250
  * Fix for untranslated user roles
251
  * Some other fixes (missing checks, PHP warnings and errors, etc.)
252
 
314
 
315
  = 0.5 (2009-01-09) =
316
  * Fix for post-meta
317
+ * WP2.7 compatibility
318
 
319
  = 0.4 (2008-11-23) =
320
  * Support for new WP post revision feature
324
 
325
  == Contribute ==
326
 
327
+ If you find this useful and if you want to contribute, there are two ways:
328
 
329
+ 1. Submit your bug reports, suggestions and requests for features on GitHub;
330
  2. If you want to translate it to your language (there are just a few lines of text), you can use the [translation project](https://translate.wordpress.org/projects/wp-plugins/duplicate-post);