Duplicate Post - Version 3.2.2

Version Description

Adds compatibility with Gutenberg UI and fixes a problem with slugs on new installs

Download this release

Release Info

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

Code changes from version 3.2.1 to 3.2.2

duplicate-post-admin.php CHANGED
@@ -131,7 +131,7 @@ function duplicate_post_plugin_upgrade() {
131
  add_option('duplicate_post_copytitle','1');
132
  add_option('duplicate_post_copydate','0');
133
  add_option('duplicate_post_copystatus','0');
134
- add_option('duplicate_post_copyslug','1');
135
  add_option('duplicate_post_copyexcerpt','1');
136
  add_option('duplicate_post_copycontent','1');
137
  add_option('duplicate_post_copythumbnail','1');
@@ -191,9 +191,10 @@ function duplicate_post_plugin_upgrade() {
191
  function duplicate_post_show_update_notice() {
192
  if(!current_user_can( 'manage_options')) return;
193
  $class = 'notice is-dismissible';
194
- $message = '<strong>'.esc_html__('Duplicate Post turns 10!', 'duplicate-post').'</strong> '.esc_html__('Serving the WordPress community since November 2007.', 'duplicate-post').'<br/>';
195
- $message .= '<em><a href="https://duplicate-post.lopo.it/">'.esc_html__('Check out the new 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/>';
196
- $message .= '<strong>'.sprintf(wp_kses(__('Help me develop the plugin and provide support by <a href="%s">donating even a small sum</a>.', 'duplicate-post'), array( 'a' => array( 'href' => array() ) ) ), "https://duplicate-post.lopo.it/donate").'</strong>';
 
197
  global $wp_version;
198
  if( version_compare($wp_version, '4.2') < 0 ){
199
  $message .= ' | <a id="duplicate-post-dismiss-notice" href="javascript:duplicate_post_dismiss_notice();">'.__('Dismiss this notice.').'</a>';
131
  add_option('duplicate_post_copytitle','1');
132
  add_option('duplicate_post_copydate','0');
133
  add_option('duplicate_post_copystatus','0');
134
+ add_option('duplicate_post_copyslug','0');
135
  add_option('duplicate_post_copyexcerpt','1');
136
  add_option('duplicate_post_copycontent','1');
137
  add_option('duplicate_post_copythumbnail','1');
191
  function duplicate_post_show_update_notice() {
192
  if(!current_user_can( 'manage_options')) return;
193
  $class = 'notice is-dismissible';
194
+ $message = '<strong>'.sprintf(__("What's new in Duplicate Post version %s:", 'duplicate-post'), DUPLICATE_POST_CURRENT_VERSION).'</strong><br/>';
195
+ $message .= esc_html__('Simple compatibility with Gutenberg user interface: enable "Admin bar" under the Settings', 'duplicate-post').' '.esc_html__('"Slug" option unset by default on new installations', 'duplicate-post').'<br/>';
196
+ $message .= '<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/>';
197
+ $message .= esc_html__('Serving the WordPress community since November 2007.', 'duplicate-post').' <strong>'.sprintf(wp_kses(__('Help me develop the plugin and provide support by <a href="%s">donating even a small sum</a>.', 'duplicate-post'), array( 'a' => array( 'href' => array() ) ) ), "https://duplicate-post.lopo.it/donate").'</strong>';
198
  global $wp_version;
199
  if( version_compare($wp_version, '4.2') < 0 ){
200
  $message .= ' | <a id="duplicate-post-dismiss-notice" href="javascript:duplicate_post_dismiss_notice();">'.__('Dismiss this notice.').'</a>';
duplicate-post-common.php CHANGED
@@ -103,34 +103,52 @@ function duplicate_post_admin_bar_render() {
103
  if(!is_admin_bar_showing()) return;
104
  global $wp_admin_bar;
105
  $current_object = get_queried_object();
106
- if ( empty($current_object) )
107
- return;
108
- if ( ! empty( $current_object->post_type )
109
- && ( $post_type_object = get_post_type_object( $current_object->post_type ) )
110
- && duplicate_post_is_current_user_allowed_to_copy()
111
- && ( $post_type_object->show_ui || 'attachment' == $current_object->post_type )
112
- && (duplicate_post_is_post_type_enabled($current_object->post_type) ) )
113
- {
114
- $wp_admin_bar->add_menu( array(
115
- 'id' => 'new_draft',
116
- 'title' => esc_attr__("Copy to a new draft", 'duplicate-post'),
117
- 'href' => duplicate_post_get_clone_post_link( $current_object->ID )
118
- ) );
 
 
 
 
 
 
 
 
 
 
 
119
  }
120
  }
121
 
122
  function duplicate_post_add_css() {
123
  if(!is_admin_bar_showing()) return;
124
  $current_object = get_queried_object();
125
- if ( empty($current_object) )
126
- return;
127
- if ( ! empty( $current_object->post_type )
128
- && ( $post_type_object = get_post_type_object( $current_object->post_type ) )
129
- && duplicate_post_is_current_user_allowed_to_copy()
130
- && ( $post_type_object->show_ui || 'attachment' == $current_object->post_type )
131
- && (duplicate_post_is_post_type_enabled($current_object->post_type) ) )
132
- {
133
- wp_enqueue_style ( 'duplicate-post', plugins_url('/duplicate-post.css', __FILE__));
 
 
 
 
 
 
 
134
  }
135
  }
136
 
@@ -140,7 +158,8 @@ add_action('init', 'duplicate_post_init');
140
  function duplicate_post_init(){
141
  if (get_option ( 'duplicate_post_show_adminbar' ) == 1) {
142
  add_action ( 'wp_before_admin_bar_render', 'duplicate_post_admin_bar_render' );
143
- add_action ( 'wp_enqueue_scripts', 'duplicate_post_add_css' );
 
144
  }
145
  }
146
 
103
  if(!is_admin_bar_showing()) return;
104
  global $wp_admin_bar;
105
  $current_object = get_queried_object();
106
+ if ( !empty($current_object) ){
107
+ if ( ! empty( $current_object->post_type )
108
+ && ( $post_type_object = get_post_type_object( $current_object->post_type ) )
109
+ && duplicate_post_is_current_user_allowed_to_copy()
110
+ && ( $post_type_object->show_ui || 'attachment' == $current_object->post_type )
111
+ && (duplicate_post_is_post_type_enabled($current_object->post_type) ) )
112
+ {
113
+ $wp_admin_bar->add_menu( array(
114
+ 'id' => 'new_draft',
115
+ 'title' => esc_attr__("Copy to a new draft", 'duplicate-post'),
116
+ 'href' => duplicate_post_get_clone_post_link( $current_object->ID )
117
+ ) );
118
+ }
119
+ } else if ( is_admin() && isset( $_GET['post'] )){
120
+ $id = $_GET['post'];
121
+ $post = get_post($id);
122
+ if( duplicate_post_is_current_user_allowed_to_copy()
123
+ && duplicate_post_is_post_type_enabled($post->post_type)) {
124
+ $wp_admin_bar->add_menu( array(
125
+ 'id' => 'new_draft',
126
+ 'title' => esc_attr__("Copy to a new draft", 'duplicate-post'),
127
+ 'href' => duplicate_post_get_clone_post_link( $id )
128
+ ) );
129
+ }
130
  }
131
  }
132
 
133
  function duplicate_post_add_css() {
134
  if(!is_admin_bar_showing()) return;
135
  $current_object = get_queried_object();
136
+ if ( !empty($current_object) ){
137
+ if ( ! empty( $current_object->post_type )
138
+ && ( $post_type_object = get_post_type_object( $current_object->post_type ) )
139
+ && duplicate_post_is_current_user_allowed_to_copy()
140
+ && ( $post_type_object->show_ui || 'attachment' == $current_object->post_type )
141
+ && (duplicate_post_is_post_type_enabled($current_object->post_type) ) )
142
+ {
143
+ wp_enqueue_style ( 'duplicate-post', plugins_url('/duplicate-post.css', __FILE__));
144
+ }
145
+ } else if ( is_admin() && isset( $_GET['post'] )){
146
+ $id = $_GET['post'];
147
+ $post = get_post($id);
148
+ if( duplicate_post_is_current_user_allowed_to_copy()
149
+ && duplicate_post_is_post_type_enabled($post->post_type)) {
150
+ wp_enqueue_style ( 'duplicate-post', plugins_url('/duplicate-post.css', __FILE__));
151
+ }
152
  }
153
  }
154
 
158
  function duplicate_post_init(){
159
  if (get_option ( 'duplicate_post_show_adminbar' ) == 1) {
160
  add_action ( 'wp_before_admin_bar_render', 'duplicate_post_admin_bar_render' );
161
+ add_action ( 'wp_enqueue_scripts', 'duplicate_post_add_css' );
162
+ add_action ( 'admin_enqueue_scripts', 'duplicate_post_add_css' );
163
  }
164
  }
165
 
duplicate-post-options.php CHANGED
@@ -360,7 +360,7 @@ img#donate-button{
360
  <label><input type="checkbox" name="duplicate_post_show_submitbox" value="1" <?php if(get_option('duplicate_post_show_submitbox') == 1) echo 'checked="checked"'; ?>"/>
361
  <?php esc_html_e("Edit screen", 'duplicate-post'); ?> </label>
362
  <label><input type="checkbox" name="duplicate_post_show_adminbar" value="1" <?php if(get_option('duplicate_post_show_adminbar') == 1) echo 'checked="checked"'; ?>"/>
363
- <?php esc_html_e("Admin bar", 'duplicate-post'); ?> </label>
364
  <?php global $wp_version;
365
  if( version_compare($wp_version, '4.7') >= 0 ){ ?>
366
  <label><input type="checkbox" name="duplicate_post_show_bulkactions" value="1" <?php if(get_option('duplicate_post_show_bulkactions') == 1) echo 'checked="checked"'; ?>"/>
360
  <label><input type="checkbox" name="duplicate_post_show_submitbox" value="1" <?php if(get_option('duplicate_post_show_submitbox') == 1) echo 'checked="checked"'; ?>"/>
361
  <?php esc_html_e("Edit screen", 'duplicate-post'); ?> </label>
362
  <label><input type="checkbox" name="duplicate_post_show_adminbar" value="1" <?php if(get_option('duplicate_post_show_adminbar') == 1) echo 'checked="checked"'; ?>"/>
363
+ <?php esc_html_e("Admin bar", 'duplicate-post'); ?> <small>(<?php esc_html_e("now works on Edit screen too — check this option to use with Gutenberg enabled", 'duplicate-post'); ?>)</small></label>
364
  <?php global $wp_version;
365
  if( version_compare($wp_version, '4.7') >= 0 ){ ?>
366
  <label><input type="checkbox" name="duplicate_post_show_bulkactions" value="1" <?php if(get_option('duplicate_post_show_bulkactions') == 1) echo 'checked="checked"'; ?>"/>
duplicate-post.css CHANGED
@@ -12,7 +12,7 @@
12
  text-indent: 100%;
13
  white-space: nowrap;
14
  overflow: hidden;
15
- width: 95px;
16
  padding: 0;
17
  color: #999;
18
  position: relative;
@@ -23,8 +23,8 @@
23
  text-indent: 0;
24
  font: 400 32px/1 dashicons;
25
  speak: none;
26
- top: 7px;
27
- width: 95px;
28
  text-align: center;
29
  -webkit-font-smoothing: antialiased;
30
  -moz-osx-font-smoothing: grayscale;
12
  text-indent: 100%;
13
  white-space: nowrap;
14
  overflow: hidden;
15
+ width: 52px;
16
  padding: 0;
17
  color: #999;
18
  position: relative;
23
  text-indent: 0;
24
  font: 400 32px/1 dashicons;
25
  speak: none;
26
+ top: 0px;
27
+ width: 52px;
28
  text-align: center;
29
  -webkit-font-smoothing: antialiased;
30
  -moz-osx-font-smoothing: grayscale;
duplicate-post.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Duplicate Post
4
  Plugin URI: https://duplicate-post.lopo.it/
5
  Description: Clone posts and pages.
6
- Version: 3.2.1
7
  Author: Enrico Battocchi
8
  Author URI: https://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.2.1' );
35
 
36
 
37
  /**
3
  Plugin Name: Duplicate Post
4
  Plugin URI: https://duplicate-post.lopo.it/
5
  Description: Clone posts and pages.
6
+ Version: 3.2.2
7
  Author: Enrico Battocchi
8
  Author URI: https://lopo.it
9
  Text Domain: duplicate-post
31
  }
32
 
33
  // Version of the plugin
34
+ define('DUPLICATE_POST_CURRENT_VERSION', '3.2.2' );
35
 
36
 
37
  /**
readme.txt CHANGED
@@ -4,7 +4,8 @@ Donate link: https://duplicate-post.lopo.it/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 3.6
6
  Tested up to: 4.9
7
- Stable tag: 3.2.1
 
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -23,7 +24,7 @@ How it works:
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".
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
 
@@ -35,6 +36,8 @@ Duplicate Post has many useful settings to customize its behavior and restrict i
35
 
36
  **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.
37
 
 
 
38
  Thanks for all the suggestions, bug reports, translations and donations, they're frankly too many to be listed here!
39
 
40
  == Installation ==
@@ -76,6 +79,9 @@ If Duplicate Post is still in English, or if there are some untraslated strings,
76
 
77
  == Upgrade Notice ==
78
 
 
 
 
79
  = 3.2.1 =
80
  Fixes some problems with Multisite, WPML, revisions
81
 
@@ -141,6 +147,11 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
141
 
142
  == Changelog ==
143
 
 
 
 
 
 
144
  = 3.2.1 (2017-11-25) =
145
  * Fixing some issues of the 3.* trunk before major redesign
146
  * Fixes issue when upgrading on multisite
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 3.6
6
  Tested up to: 4.9
7
+ Stable tag: 3.2.2
8
+ Requires PHP: 5.2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
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
 
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 ==
79
 
80
  == Upgrade Notice ==
81
 
82
+ = 3.2.2 =
83
+ Adds compatibility with Gutenberg UI and fixes a problem with slugs on new installs
84
+
85
  = 3.2.1 =
86
  Fixes some problems with Multisite, WPML, revisions
87
 
147
 
148
  == Changelog ==
149
 
150
+ = 3.2.2 (2018-04-13) =
151
+ * The "Admin bar" option shows the link in the post edit screen too, so you can use the plugin with Gutenberg enabled
152
+ * Option for "Slug" not set by default on new installations
153
+ * Better display of icon in the Admin bar on small screens
154
+
155
  = 3.2.1 (2017-11-25) =
156
  * Fixing some issues of the 3.* trunk before major redesign
157
  * Fixes issue when upgrading on multisite