Duplicate Post - Version 3.1.2

Version Description

Fixes the problem with custom fields

Download this release

Release Info

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

Code changes from version 3.1.1 to 3.1.2

Files changed (3) hide show
  1. duplicate-post-admin.php +22 -10
  2. duplicate-post.php +2 -2
  3. readme.txt +14 -12
duplicate-post-admin.php CHANGED
@@ -307,9 +307,14 @@ function duplicate_post_copy_post_taxonomies($new_id, $post) {
307
  function duplicate_post_copy_post_meta_info($new_id, $post) {
308
  $post_meta_keys = get_post_custom_keys($post->ID);
309
  if (empty($post_meta_keys)) return;
310
- $meta_blacklist = explode(",",get_option('duplicate_post_blacklist'));
311
- if ($meta_blacklist == "") $meta_blacklist = array();
312
- $meta_blacklist = array_map('trim', $meta_blacklist);
 
 
 
 
 
313
  $meta_blacklist[] = '_wpas_done_all'; //Jetpack Publicize
314
  $meta_blacklist[] = '_wpas_done_'; //Jetpack Publicize
315
  $meta_blacklist[] = '_wpas_mess'; //Jetpack Publicize
@@ -321,17 +326,24 @@ function duplicate_post_copy_post_meta_info($new_id, $post) {
321
  if(get_option('duplicate_post_copythumbnail') == 0){
322
  $meta_blacklist[] = '_thumbnail_id';
323
  }
324
- //$meta_keys = array_diff($post_meta_keys, $meta_blacklist);
 
 
325
  $meta_blacklist_string = '('.implode(')|(',$meta_blacklist).')';
326
- $meta_blacklist_string = str_replace(array('*'), array('[a-zA-Z0-9_]*'), $meta_blacklist_string);
 
327
 
328
- $meta_keys = array();
329
- foreach($post_meta_keys as $meta_key){
330
- if(!preg_match('#^'.$meta_blacklist_string.'$#', $meta_key))
331
- $meta_keys[] = $meta_key;
 
 
 
332
  }
333
 
334
- $meta_keys = apply_filters( 'dp_meta_keys', $meta_keys );
 
335
  foreach ($meta_keys as $meta_key) {
336
  $meta_values = get_post_custom_values($meta_key, $post->ID);
337
  foreach ($meta_values as $meta_value) {
307
  function duplicate_post_copy_post_meta_info($new_id, $post) {
308
  $post_meta_keys = get_post_custom_keys($post->ID);
309
  if (empty($post_meta_keys)) return;
310
+ $meta_blacklist = get_option('duplicate_post_blacklist');
311
+ if ($meta_blacklist == ""){
312
+ $meta_blacklist = array();
313
+ } else {
314
+ $meta_blacklist = explode(',', $meta_blacklist);
315
+ $meta_blacklist = array_filter($meta_blacklist);
316
+ $meta_blacklist = array_map('trim', $meta_blacklist);
317
+ }
318
  $meta_blacklist[] = '_wpas_done_all'; //Jetpack Publicize
319
  $meta_blacklist[] = '_wpas_done_'; //Jetpack Publicize
320
  $meta_blacklist[] = '_wpas_mess'; //Jetpack Publicize
326
  if(get_option('duplicate_post_copythumbnail') == 0){
327
  $meta_blacklist[] = '_thumbnail_id';
328
  }
329
+
330
+ $meta_blacklist = apply_filters( 'duplicate_post_blacklist_filter' , $meta_blacklist );
331
+
332
  $meta_blacklist_string = '('.implode(')|(',$meta_blacklist).')';
333
+ if(strpos($meta_blacklist_string, '*') !== false){
334
+ $meta_blacklist_string = str_replace(array('*'), array('[a-zA-Z0-9_]*'), $meta_blacklist_string);
335
 
336
+ $meta_keys = array();
337
+ foreach($post_meta_keys as $meta_key){
338
+ if(!preg_match('#^'.$meta_blacklist_string.'$#', $meta_key))
339
+ $meta_keys[] = $meta_key;
340
+ }
341
+ } else {
342
+ $meta_keys = array_diff($post_meta_keys, $meta_blacklist);
343
  }
344
 
345
+ $meta_keys = apply_filters( 'duplicate_post_meta_keys_filter', $meta_keys );
346
+
347
  foreach ($meta_keys as $meta_key) {
348
  $meta_values = get_post_custom_values($meta_key, $post->ID);
349
  foreach ($meta_values as $meta_value) {
duplicate-post.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Duplicate Post
4
  Plugin URI: http://lopo.it/duplicate-post-plugin/
5
  Description: Clone posts and pages.
6
- Version: 3.1.1
7
  Author: Enrico Battocchi
8
  Author URI: http://lopo.it
9
  Text Domain: duplicate-post
@@ -31,7 +31,7 @@ if ( ! defined( 'ABSPATH' ) ) {
31
  }
32
 
33
  // Version of the plugin
34
- define('DUPLICATE_POST_CURRENT_VERSION', '3.1.1' );
35
 
36
 
37
  /**
3
  Plugin Name: Duplicate Post
4
  Plugin URI: http://lopo.it/duplicate-post-plugin/
5
  Description: Clone posts and pages.
6
+ Version: 3.1.2
7
  Author: Enrico Battocchi
8
  Author URI: http://lopo.it
9
  Text Domain: duplicate-post
31
  }
32
 
33
  // Version of the plugin
34
+ define('DUPLICATE_POST_CURRENT_VERSION', '3.1.2' );
35
 
36
 
37
  /**
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Duplicate Post ===
2
  Contributors: lopo
3
- Donate link: http://lopo.it/duplicate-post-plugin/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 3.6
6
  Tested up to: 4.7
7
- Stable tag: 3.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -13,7 +13,7 @@ Clone posts and pages.
13
  == Description ==
14
 
15
  This plugin allows to clone a post or page, or edit it as a new draft.
16
- If you find this useful, [**please consider donating**](http://lopo.it/duplicate-post-plugin/) whatever sum you choose, **even just 10 cents**. It's been downloaded thousands of times: just a few cents from every user would help me develop the plugin and improve support.
17
 
18
 
19
  How it works:
@@ -36,7 +36,7 @@ In the Options page under Settings it is now possible to choose what to copy, an
36
 
37
  You can also restrict the plugin to certain post types, and allow only some roles to clone posts or pages.
38
 
39
- If you want to contribute to translate the plugin in languages other than English, there is a [translation project](https://translate.wordpress.org/projects/wp-plugins/duplicate-post) available: [contact me](http://lopo.it/contatti/) if you wish to become an editor for your language.
40
 
41
  **If you're a plugin developer**, I suggest to read the section made just for you under "Other Notes", to ensure compatibility between your plugin(s) and mine.
42
 
@@ -53,10 +53,6 @@ Use WordPress' Add New Plugin feature, searching "Duplicate Post", or download t
53
 
54
  == Frequently Asked Questions ==
55
 
56
- = How to stop copying featured images? =
57
-
58
- Add `_thumbnail_id` to "Do not copy these fields" in the Settings page.
59
-
60
  = The plugin doesn't work, why? =
61
 
62
  First, check your version of WordPress: the plugin is not supposed to work on old versions anymore. Make sure also to upgrade to the last version of the plugin!
@@ -67,14 +63,14 @@ Pay also attention to the new "Roles allowed to copy" option: it should convert
67
 
68
  From version 3.0 onwards, post types must be enabled in the Options: check them as well.
69
 
70
- If not, maybe there is some kind of conflict with other plugins: feel free [to write me](http://lopo.it/contatti/) and we'll try to discover a solution (it will be *really* helpful if you try to deactivate all your other plugins one by one to see which one conflicts with mine... But do it only if you know what you're doing, I will not be responsible of any problem you may experience).
71
 
72
  = The plugin is not translated in my language! =
73
 
74
  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.
75
 
76
  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.
77
- [Contact me](http://lopo.it/contatti/) if you wish to become an editor for your language.
78
 
79
  == Screenshots ==
80
 
@@ -87,6 +83,9 @@ If Duplicate Post is still in English, or if there are some untraslated strings,
87
 
88
  == Upgrade Notice ==
89
 
 
 
 
90
  = 3.1.1 =
91
  Bulk clone + custom field wildcards + other features + bugfixes + fix for nasty nag
92
 
@@ -143,6 +142,9 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
143
 
144
  == Changelog ==
145
 
 
 
 
146
  = 3.1.1 =
147
  * Fix for nasty update nag (plus a failsafe checkbox)
148
 
@@ -321,7 +323,7 @@ Please refer to the [Plugin API](http://codex.wordpress.org/Plugin_API) for ever
321
 
322
  If you find this useful and if you want to contribute, there are three ways:
323
 
324
- 1. You can [write me](http://lopo.it/contatti/) and submit your bug reports, suggestions and requests for features;
325
  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);
326
- 3. Using the plugin is free, but if you want you can support my efforts by donating with PayPal [here](http://lopo.it/duplicate-post-plugin/)
327
 
1
  === Duplicate Post ===
2
  Contributors: lopo
3
+ Donate link: https://lopo.it/duplicate-post-plugin/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 3.6
6
  Tested up to: 4.7
7
+ Stable tag: 3.1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
13
  == Description ==
14
 
15
  This plugin allows to clone a post or page, or edit it as a new draft.
16
+ If you find this useful, [**please consider donating**](https://lopo.it/duplicate-post-plugin/) whatever sum you choose, **even just 10 cents**. It's been downloaded thousands of times: just a few cents from every user would help me develop the plugin and improve support.
17
 
18
 
19
  How it works:
36
 
37
  You can also restrict the plugin to certain post types, and allow only some roles to clone posts or pages.
38
 
39
+ If you want to contribute to translate the plugin in languages other than English, there is a [translation project](https://translate.wordpress.org/projects/wp-plugins/duplicate-post) available: [contact me](https://lopo.it/contatti/) if you wish to become an editor for your language.
40
 
41
  **If you're a plugin developer**, I suggest to read the section made just for you under "Other Notes", to ensure compatibility between your plugin(s) and mine.
42
 
53
 
54
  == Frequently Asked Questions ==
55
 
 
 
 
 
56
  = The plugin doesn't work, why? =
57
 
58
  First, check your version of WordPress: the plugin is not supposed to work on old versions anymore. Make sure also to upgrade to the last version of the plugin!
63
 
64
  From version 3.0 onwards, post types must be enabled in the Options: check them as well.
65
 
66
+ If not, maybe there is some kind of conflict with other plugins: feel free [to write me](https://lopo.it/contatti/) and we'll try to discover a solution (it will be *really* helpful if you try to deactivate all your other plugins one by one to see which one conflicts with mine... But do it only if you know what you're doing, I will not be responsible of any problem you may experience).
67
 
68
  = The plugin is not translated in my language! =
69
 
70
  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.
71
 
72
  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.
73
+ [Contact me](https://lopo.it/contatti/) if you wish to become an editor for your language.
74
 
75
  == Screenshots ==
76
 
83
 
84
  == Upgrade Notice ==
85
 
86
+ = 3.1.2 =
87
+ Fixes the problem with custom fields
88
+
89
  = 3.1.1 =
90
  Bulk clone + custom field wildcards + other features + bugfixes + fix for nasty nag
91
 
142
 
143
  == Changelog ==
144
 
145
+ = 3.1.2 =
146
+ * Fix for custom fields not copied
147
+
148
  = 3.1.1 =
149
  * Fix for nasty update nag (plus a failsafe checkbox)
150
 
323
 
324
  If you find this useful and if you want to contribute, there are three ways:
325
 
326
+ 1. You can [write me](https://lopo.it/contatti/) and submit your bug reports, suggestions and requests for features;
327
  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);
328
+ 3. Using the plugin is free, but if you want you can support my efforts by donating with PayPal [here](https://lopo.it/duplicate-post-plugin/)
329