Version Description
Copy from admin bar + user levels out, roles and capabilities in.
Download this release
Release Info
Developer | lopo |
Plugin | Duplicate Post |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.2 to 2.1
- duplicate-post-admin.php +305 -313
- duplicate-post-common.php +109 -71
- duplicate-post-options.php +170 -144
- duplicate-post.php +12 -2
- languages/duplicate-post-it_IT.mo +0 -0
- languages/duplicate-post-it_IT.po +102 -118
- languages/duplicate-post.pot +62 -62
- readme.txt +29 -13
- screenshot-3.png +0 -0
- screenshot-5.png +0 -0
duplicate-post-admin.php
CHANGED
@@ -1,314 +1,306 @@
|
|
1 |
-
<?php
|
2 |
-
// Added by WarmStal
|
3 |
-
if(!is_admin())
|
4 |
-
return;
|
5 |
-
|
6 |
-
require_once (dirname(__FILE__).'/duplicate-post-options.php');
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
$
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
function
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
$
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
$
|
230 |
-
|
231 |
-
|
232 |
-
}
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
$
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
$
|
249 |
-
|
250 |
-
$
|
251 |
-
|
252 |
-
$
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
$
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
$new_post_id
|
273 |
-
|
274 |
-
//
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
function duplicate_post_add_plugin_links($links, $file) {
|
308 |
-
if ( $file == plugin_basename(dirname(__FILE__).'/duplicate-post.php') ) {
|
309 |
-
$links[] = '<a href="http://lopo.it/duplicate-post-plugin">' . __('Donate', DUPLICATE_POST_I18N_DOMAIN) . '</a>';
|
310 |
-
$links[] = '<a href="http://lopo.it/duplicate-post-plugin">' . __('Translate', DUPLICATE_POST_I18N_DOMAIN) . '</a>';
|
311 |
-
}
|
312 |
-
return $links;
|
313 |
-
}
|
314 |
?>
|
1 |
+
<?php
|
2 |
+
// Added by WarmStal
|
3 |
+
if(!is_admin())
|
4 |
+
return;
|
5 |
+
|
6 |
+
require_once (dirname(__FILE__).'/duplicate-post-options.php');
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Wrapper for the option 'duplicate_post_version'
|
10 |
+
*/
|
11 |
+
function duplicate_post_get_installed_version() {
|
12 |
+
return get_option( 'duplicate_post_version' );
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Wrapper for the defined constant DUPLICATE_POST_CURRENT_VERSION
|
17 |
+
*/
|
18 |
+
function duplicate_post_get_current_version() {
|
19 |
+
return DUPLICATE_POST_CURRENT_VERSION;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Plugin activation
|
24 |
+
*/
|
25 |
+
add_action('activate_duplicate-post/duplicate-post.php','duplicate_post_plugin_activation');
|
26 |
+
|
27 |
+
function duplicate_post_plugin_activation() {
|
28 |
+
$installed_version = duplicate_post_get_installed_version();
|
29 |
+
|
30 |
+
if ( $installed_version==duplicate_post_get_current_version() ) {
|
31 |
+
// do nothing
|
32 |
+
} else {
|
33 |
+
// delete old, obsolete options
|
34 |
+
delete_option('duplicate_post_admin_user_level');
|
35 |
+
delete_option('duplicate_post_create_user_level');
|
36 |
+
delete_option('duplicate_post_view_user_level');
|
37 |
+
|
38 |
+
/*
|
39 |
+
* Convert old userlevel option to new capability scheme
|
40 |
+
*/
|
41 |
+
|
42 |
+
// Get old duplicate_post_copy_user_level option
|
43 |
+
$min_user_level = get_option('duplicate_post_copy_user_level');
|
44 |
+
|
45 |
+
// Get default roles
|
46 |
+
$default_roles = array(
|
47 |
+
1 => 'contributor',
|
48 |
+
2 => 'author',
|
49 |
+
3 => 'editor',
|
50 |
+
8 => 'administrator',
|
51 |
+
);
|
52 |
+
|
53 |
+
// Cycle all roles and assign capability if its level >= duplicate_post_copy_user_level
|
54 |
+
foreach ($default_roles as $level => $name){
|
55 |
+
$role = get_role($name);
|
56 |
+
if ($role && $min_user_level <= $level)
|
57 |
+
$role->add_cap( 'copy_posts' );
|
58 |
+
}
|
59 |
+
|
60 |
+
// delete old option
|
61 |
+
delete_option('duplicate_post_copy_user_level');
|
62 |
+
|
63 |
+
add_option(
|
64 |
+
'duplicate_post_copyexcerpt',
|
65 |
+
'1',
|
66 |
+
'Copy the excerpt from the original post/page' );
|
67 |
+
add_option(
|
68 |
+
'duplicate_post_copystatus',
|
69 |
+
'0',
|
70 |
+
'Copy the status (draft, published, pending) from the original post/page' );
|
71 |
+
add_option(
|
72 |
+
'duplicate_post_taxonomies_blacklist',
|
73 |
+
array(),
|
74 |
+
'List of the taxonomies that mustn\'t be copied' );
|
75 |
+
}
|
76 |
+
// Update version number
|
77 |
+
update_option( 'duplicate_post_version', duplicate_post_get_current_version() );
|
78 |
+
|
79 |
+
// enable notice
|
80 |
+
update_option('dp_notice', 1);
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
function dp_admin_notice(){
|
85 |
+
echo '<div class="updated">
|
86 |
+
<p>'.sprintf(__('<strong>Duplicate Post</strong> now has two different ways to work: you can clone immediately or you can copy to a new draft to edit.<br/>Learn more on the <a href="%s">plugin page</a>.', DUPLICATE_POST_I18N_DOMAIN), "http://wordpress.org/extend/plugins/duplicate-post/").'</p>
|
87 |
+
</div>';
|
88 |
+
update_option('dp_notice', 0);
|
89 |
+
}
|
90 |
+
|
91 |
+
if(get_option('dp_notice') != 0) add_action('admin_notices', 'dp_admin_notice');
|
92 |
+
|
93 |
+
add_filter('post_row_actions', 'duplicate_post_make_duplicate_link_row',10,2);
|
94 |
+
add_filter('page_row_actions', 'duplicate_post_make_duplicate_link_row',10,2);
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Add the link to action list for post_row_actions
|
98 |
+
*/
|
99 |
+
function duplicate_post_make_duplicate_link_row($actions, $post) {
|
100 |
+
if (duplicate_post_is_current_user_allowed_to_copy()) {
|
101 |
+
$actions['clone'] = '<a href="'.duplicate_post_get_clone_post_link( $post->ID , 'display', false).'" title="'
|
102 |
+
. esc_attr(__("Clone this item", DUPLICATE_POST_I18N_DOMAIN))
|
103 |
+
. '">' . __('Clone', DUPLICATE_POST_I18N_DOMAIN) . '</a>';
|
104 |
+
$actions['edit_as_new_draft'] = '<a href="'. duplicate_post_get_clone_post_link( $post->ID ) .'" title="'
|
105 |
+
. esc_attr(__('Copy to a new draft', DUPLICATE_POST_I18N_DOMAIN))
|
106 |
+
. '">' . __('New Draft', DUPLICATE_POST_I18N_DOMAIN) . '</a>';
|
107 |
+
}
|
108 |
+
return $actions;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Add a button in the post/page edit screen to create a clone
|
113 |
+
*/
|
114 |
+
add_action( 'post_submitbox_start', 'duplicate_post_add_duplicate_post_button' );
|
115 |
+
|
116 |
+
function duplicate_post_add_duplicate_post_button() {
|
117 |
+
if ( isset( $_GET['post'] ) && duplicate_post_is_current_user_allowed_to_copy()) {
|
118 |
+
?>
|
119 |
+
<div id="duplicate-action">
|
120 |
+
<a class="submitduplicate duplication"
|
121 |
+
href="<?php echo duplicate_post_get_clone_post_link( $_GET['post'] ) ?>"><?php _e('Copy to a new draft', DUPLICATE_POST_I18N_DOMAIN); ?>
|
122 |
+
</a>
|
123 |
+
</div>
|
124 |
+
<?php
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Connect actions to functions
|
130 |
+
*/
|
131 |
+
add_action('admin_action_duplicate_post_save_as_new_post', 'duplicate_post_save_as_new_post');
|
132 |
+
add_action('admin_action_duplicate_post_save_as_new_post_draft', 'duplicate_post_save_as_new_post_draft');
|
133 |
+
|
134 |
+
/*
|
135 |
+
* This function calls the creation of a new copy of the selected post (as a draft)
|
136 |
+
* then redirects to the edit post screen
|
137 |
+
*/
|
138 |
+
function duplicate_post_save_as_new_post_draft(){
|
139 |
+
duplicate_post_save_as_new_post('draft');
|
140 |
+
}
|
141 |
+
|
142 |
+
/*
|
143 |
+
* This function calls the creation of a new copy of the selected post (by default preserving the original publish status)
|
144 |
+
* then redirects to the post list
|
145 |
+
*/
|
146 |
+
function duplicate_post_save_as_new_post($status = ''){
|
147 |
+
if (! ( isset( $_GET['post']) || isset( $_POST['post']) || ( isset($_REQUEST['action']) && 'duplicate_post_save_as_new_post' == $_REQUEST['action'] ) ) ) {
|
148 |
+
wp_die(__('No post to duplicate has been supplied!', DUPLICATE_POST_I18N_DOMAIN));
|
149 |
+
}
|
150 |
+
|
151 |
+
// Get the original post
|
152 |
+
$id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
|
153 |
+
$post = get_post($id);
|
154 |
+
|
155 |
+
// Copy the post and insert it
|
156 |
+
if (isset($post) && $post!=null) {
|
157 |
+
$new_id = duplicate_post_create_duplicate($post, $status);
|
158 |
+
|
159 |
+
if ($status == ''){
|
160 |
+
// Redirect to the post list screen
|
161 |
+
wp_redirect( admin_url( 'edit.php?post_type='.$post->post_type) );
|
162 |
+
} else {
|
163 |
+
// Redirect to the edit screen for the new draft post
|
164 |
+
wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_id ) );
|
165 |
+
}
|
166 |
+
exit;
|
167 |
+
|
168 |
+
} else {
|
169 |
+
$post_type_obj = get_post_type_object( $post->post_type );
|
170 |
+
wp_die(esc_attr(__('Copy creation failed, could not find original:', DUPLICATE_POST_I18N_DOMAIN)) . ' ' . $id);
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Get the currently registered user
|
176 |
+
*/
|
177 |
+
function duplicate_post_get_current_user() {
|
178 |
+
if (function_exists('wp_get_current_user')) {
|
179 |
+
return wp_get_current_user();
|
180 |
+
} else if (function_exists('get_currentuserinfo')) {
|
181 |
+
global $userdata;
|
182 |
+
get_currentuserinfo();
|
183 |
+
return $userdata;
|
184 |
+
} else {
|
185 |
+
$user_login = $_COOKIE[USER_COOKIE];
|
186 |
+
$current_user = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_login='$user_login'");
|
187 |
+
return $current_user;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Copy the taxonomies of a post to another post
|
193 |
+
*/
|
194 |
+
function duplicate_post_copy_post_taxonomies($new_id, $post) {
|
195 |
+
global $wpdb;
|
196 |
+
if (isset($wpdb->terms)) {
|
197 |
+
// Clear default category (added by wp_insert_post)
|
198 |
+
wp_set_object_terms( $new_id, NULL, 'category' );
|
199 |
+
|
200 |
+
$post_taxonomies = get_object_taxonomies($post->post_type);
|
201 |
+
$taxonomies_blacklist = get_option('duplicate_post_taxonomies_blacklist');
|
202 |
+
if ($taxonomies_blacklist == "") $taxonomies_blacklist = array();
|
203 |
+
$taxonomies = array_diff($post_taxonomies, $taxonomies_blacklist);
|
204 |
+
foreach ($taxonomies as $taxonomy) {
|
205 |
+
$post_terms = wp_get_object_terms($post->ID, $taxonomy, array( 'orderby' => 'term_order' ));
|
206 |
+
$terms = array();
|
207 |
+
for ($i=0; $i<count($post_terms); $i++) {
|
208 |
+
$terms[] = $post_terms[$i]->slug;
|
209 |
+
}
|
210 |
+
wp_set_object_terms($new_id, $terms, $taxonomy);
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
// Using our action hooks to copy taxonomies
|
216 |
+
add_action('dp_duplicate_post', 'duplicate_post_copy_post_taxonomies', 10, 2);
|
217 |
+
add_action('dp_duplicate_page', 'duplicate_post_copy_post_taxonomies', 10, 2);
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Copy the meta information of a post to another post
|
221 |
+
*/
|
222 |
+
function duplicate_post_copy_post_meta_info($new_id, $post) {
|
223 |
+
$post_meta_keys = get_post_custom_keys($post->ID);
|
224 |
+
$meta_blacklist = explode(",",get_option('duplicate_post_blacklist'));
|
225 |
+
if ($meta_blacklist == "") $meta_blacklist = array();
|
226 |
+
$meta_keys = array_diff($post_meta_keys, $meta_blacklist);
|
227 |
+
|
228 |
+
foreach ($meta_keys as $meta_key) {
|
229 |
+
$meta_values = get_post_custom_values($meta_key, $post->ID);
|
230 |
+
foreach ($meta_values as $meta_value) {
|
231 |
+
add_post_meta($new_id, $meta_key, $meta_value);
|
232 |
+
}
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
// Using our action hooks to copy meta fields
|
237 |
+
add_action('dp_duplicate_post', 'duplicate_post_copy_post_meta_info', 10, 2);
|
238 |
+
add_action('dp_duplicate_page', 'duplicate_post_copy_post_meta_info', 10, 2);
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Create a duplicate from a post
|
242 |
+
*/
|
243 |
+
function duplicate_post_create_duplicate($post, $status = '') {
|
244 |
+
global $wpdb;
|
245 |
+
$prefix = get_option('duplicate_post_title_prefix');
|
246 |
+
$suffix = get_option('duplicate_post_title_suffix');
|
247 |
+
if (!empty($prefix)) $prefix.= " ";
|
248 |
+
if (!empty($prefix)) $suffix = " ".$suffix;
|
249 |
+
if (get_option('duplicate_post_copystatus') == 0) $status = 'draft';
|
250 |
+
$new_post_author = duplicate_post_get_current_user();
|
251 |
+
|
252 |
+
$new_post = array(
|
253 |
+
'menu_order' => $post->menu_order,
|
254 |
+
'comment_status' => $post->comment_status,
|
255 |
+
'ping_status' => $post->ping_status,
|
256 |
+
'pinged' => $post->pinged,
|
257 |
+
'post_author' => $new_post_author->ID,
|
258 |
+
'post_content' => $post->post_content,
|
259 |
+
'post_date' => $new_post_date = (get_option('duplicate_post_copydate') == 1) ? $post->post_date : current_time('mysql'),
|
260 |
+
'post_date_gmt' => get_gmt_from_date($new_post_date),
|
261 |
+
'post_excerpt' => (get_option('duplicate_post_copyexcerpt') == '1') ? $post->post_excerpt : "",
|
262 |
+
'post_parent' => $post->post_parent,
|
263 |
+
'post_password' => $post->post_password,
|
264 |
+
'post_status' => $new_post_status = (empty($status))? $post->post_status: $status,
|
265 |
+
'post_title' => $prefix.$post->post_title.$suffix,
|
266 |
+
'post_type' => $post->post_type,
|
267 |
+
'to_ping' => $post->to_ping
|
268 |
+
);
|
269 |
+
|
270 |
+
$new_post_id = wp_insert_post($new_post);
|
271 |
+
|
272 |
+
add_post_meta($new_post_id, '_dp_original', $post->ID);
|
273 |
+
|
274 |
+
// If you have written a plugin which uses non-WP database tables to save
|
275 |
+
// information about a post you can hook this action to dupe that data.
|
276 |
+
if ($post->post_type == 'page' || (function_exists('is_post_type_hierarchical') && is_post_type_hierarchical( $post->post_type )))
|
277 |
+
do_action( 'dp_duplicate_page', $new_post_id, $post );
|
278 |
+
else
|
279 |
+
do_action( 'dp_duplicate_post', $new_post_id, $post );
|
280 |
+
|
281 |
+
// If the copy gets immediately published, we have to set a proper slug.
|
282 |
+
if ($new_post_status == 'publish' || $new_post_status == 'future'){
|
283 |
+
$post_name = wp_unique_post_slug($post->post_name, $new_post_id, $new_post_status, $post->post_type, $post->post_parent);
|
284 |
+
|
285 |
+
$new_post = array();
|
286 |
+
$new_post['ID'] = $new_post_id;
|
287 |
+
$new_post['post_name'] = $post_name;
|
288 |
+
|
289 |
+
// Update the post into the database
|
290 |
+
wp_update_post( $new_post );
|
291 |
+
}
|
292 |
+
|
293 |
+
return $new_post_id;
|
294 |
+
}
|
295 |
+
|
296 |
+
//Add some links on the plugin page
|
297 |
+
add_filter('plugin_row_meta', 'duplicate_post_add_plugin_links', 10, 2);
|
298 |
+
|
299 |
+
function duplicate_post_add_plugin_links($links, $file) {
|
300 |
+
if ( $file == plugin_basename(dirname(__FILE__).'/duplicate-post.php') ) {
|
301 |
+
$links[] = '<a href="http://lopo.it/duplicate-post-plugin">' . __('Donate', DUPLICATE_POST_I18N_DOMAIN) . '</a>';
|
302 |
+
$links[] = '<a href="http://lopo.it/duplicate-post-plugin">' . __('Translate', DUPLICATE_POST_I18N_DOMAIN) . '</a>';
|
303 |
+
}
|
304 |
+
return $links;
|
305 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
?>
|
duplicate-post-common.php
CHANGED
@@ -1,72 +1,110 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Test if the user is allowed to copy posts
|
5 |
-
*/
|
6 |
-
function duplicate_post_is_current_user_allowed_to_copy() {
|
7 |
-
return current_user_can(
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Wrapper for the option 'duplicate_post_create_user_level'
|
12 |
-
*/
|
13 |
-
function duplicate_post_get_copy_user_level() {
|
14 |
-
return get_option( 'duplicate_post_copy_user_level' );
|
15 |
-
}
|
16 |
-
|
17 |
-
// Template
|
18 |
-
/**
|
19 |
-
* Retrieve duplicate post link for post.
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
*
|
24 |
-
*
|
25 |
-
* @
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
$
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
*
|
52 |
-
*
|
53 |
-
* @param
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
if ( !$
|
60 |
-
return;
|
61 |
-
|
62 |
-
if (
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
$link = '
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Test if the user is allowed to copy posts
|
5 |
+
*/
|
6 |
+
function duplicate_post_is_current_user_allowed_to_copy() {
|
7 |
+
return current_user_can('copy_posts');
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Wrapper for the option 'duplicate_post_create_user_level'
|
12 |
+
*/
|
13 |
+
function duplicate_post_get_copy_user_level() {
|
14 |
+
return get_option( 'duplicate_post_copy_user_level' );
|
15 |
+
}
|
16 |
+
|
17 |
+
// Template tag2
|
18 |
+
/**
|
19 |
+
* Retrieve duplicate post link for post.
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @param int $id Optional. Post ID.
|
23 |
+
* @param string $context Optional, default to display. How to write the '&', defaults to '&'.
|
24 |
+
* @param string $draft Optional, default to true
|
25 |
+
* @return string
|
26 |
+
*/
|
27 |
+
function duplicate_post_get_clone_post_link( $id = 0, $context = 'display', $draft = true ) {
|
28 |
+
if ( !duplicate_post_is_current_user_allowed_to_copy() )
|
29 |
+
return;
|
30 |
+
|
31 |
+
if ( !$post = &get_post( $id ) )
|
32 |
+
return;
|
33 |
+
|
34 |
+
if ($draft)
|
35 |
+
$action_name = "duplicate_post_save_as_new_post_draft";
|
36 |
+
else
|
37 |
+
$action_name = "duplicate_post_save_as_new_post";
|
38 |
+
|
39 |
+
if ( 'display' == $context )
|
40 |
+
$action = '?action='.$action_name.'&post='.$post->ID;
|
41 |
+
else
|
42 |
+
$action = '?action='.$action_name.'&post='.$post->ID;
|
43 |
+
|
44 |
+
$post_type_object = get_post_type_object( $post->post_type );
|
45 |
+
if ( !$post_type_object )
|
46 |
+
return;
|
47 |
+
|
48 |
+
return apply_filters( 'duplicate_post_get_clone_post_link', admin_url( "admin.php". $action ), $post->ID, $context );
|
49 |
+
}
|
50 |
+
/**
|
51 |
+
* Display duplicate post link for post.
|
52 |
+
*
|
53 |
+
* @param string $link Optional. Anchor text.
|
54 |
+
* @param string $before Optional. Display before edit link.
|
55 |
+
* @param string $after Optional. Display after edit link.
|
56 |
+
* @param int $id Optional. Post ID.
|
57 |
+
*/
|
58 |
+
function duplicate_post_clone_post_link( $link = null, $before = '', $after = '', $id = 0 ) {
|
59 |
+
if ( !$post = &get_post( $id ) )
|
60 |
+
return;
|
61 |
+
|
62 |
+
if ( !$url = duplicate_post_get_clone_post_link( $post->ID ) )
|
63 |
+
return;
|
64 |
+
|
65 |
+
if ( null === $link )
|
66 |
+
$link = __('Copy to a new draft', DUPLICATE_POST_I18N_DOMAIN);
|
67 |
+
|
68 |
+
$post_type_obj = get_post_type_object( $post->post_type );
|
69 |
+
$link = '<a class="post-clone-link" href="' . $url . '" title="'
|
70 |
+
. esc_attr(__("Copy to a new draft", DUPLICATE_POST_I18N_DOMAIN))
|
71 |
+
.'">' . $link . '</a>';
|
72 |
+
echo $before . apply_filters( 'duplicate_post_clone_post_link', $link, $post->ID ) . $after;
|
73 |
+
}
|
74 |
+
/**
|
75 |
+
* Get original post .
|
76 |
+
*
|
77 |
+
* @param int $id Optional. Post ID.
|
78 |
+
* @param string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N.
|
79 |
+
* @return mixed Post data
|
80 |
+
*/
|
81 |
+
function duplicate_post_get_original($id = 0 , $output = OBJECT){
|
82 |
+
if ( !$post = &get_post( $id ) )
|
83 |
+
return;
|
84 |
+
$original_ID = get_post_meta( $post->ID, '_dp_original');
|
85 |
+
if (empty($original_ID)) return null;
|
86 |
+
$original_post = &get_post($original_ID[0], $output);
|
87 |
+
return $original_post;
|
88 |
+
}
|
89 |
+
// Admin bar
|
90 |
+
function duplicate_post_admin_bar_render() {
|
91 |
+
global $wp_admin_bar;
|
92 |
+
$current_object = get_queried_object();
|
93 |
+
if ( empty($current_object) )
|
94 |
+
return;
|
95 |
+
if ( ! empty( $current_object->post_type )
|
96 |
+
&& ( $post_type_object = get_post_type_object( $current_object->post_type ) )
|
97 |
+
&& duplicate_post_is_current_user_allowed_to_copy()
|
98 |
+
&& ( $post_type_object->show_ui || 'attachment' == $current_object->post_type ) )
|
99 |
+
{
|
100 |
+
$wp_admin_bar->add_menu( array(
|
101 |
+
'parent' => 'edit',
|
102 |
+
'id' => 'new_draft',
|
103 |
+
'title' => __("Copy to a new draft", DUPLICATE_POST_I18N_DOMAIN),
|
104 |
+
'href' => duplicate_post_get_clone_post_link( $post->ID )
|
105 |
+
) );
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
add_action( 'wp_before_admin_bar_render', 'duplicate_post_admin_bar_render' );
|
110 |
?>
|
duplicate-post-options.php
CHANGED
@@ -1,145 +1,171 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Add an option page
|
4 |
-
*/
|
5 |
-
if ( is_admin() ){ // admin actions
|
6 |
-
add_action('admin_menu', 'duplicate_post_menu');
|
7 |
-
add_action( 'admin_init', 'duplicate_post_register_settings');
|
8 |
-
}
|
9 |
-
|
10 |
-
function duplicate_post_register_settings() { // whitelist options
|
11 |
-
register_setting( 'duplicate_post_group', 'duplicate_post_copydate');
|
12 |
-
register_setting( 'duplicate_post_group', 'duplicate_post_copyexcerpt');
|
13 |
-
register_setting( 'duplicate_post_group', 'duplicate_post_copystatus');
|
14 |
-
register_setting( 'duplicate_post_group', 'duplicate_post_blacklist');
|
15 |
-
register_setting( 'duplicate_post_group', 'duplicate_post_taxonomies_blacklist');
|
16 |
-
register_setting( 'duplicate_post_group', 'duplicate_post_title_prefix');
|
17 |
-
register_setting( 'duplicate_post_group', 'duplicate_post_title_suffix');
|
18 |
-
register_setting( 'duplicate_post_group', '
|
19 |
-
}
|
20 |
-
|
21 |
-
|
22 |
-
function duplicate_post_menu() {
|
23 |
-
add_options_page(__("Duplicate Post Options", DUPLICATE_POST_I18N_DOMAIN), __("Duplicate Post", DUPLICATE_POST_I18N_DOMAIN), 'administrator', 'duplicatepost', 'duplicate_post_options');
|
24 |
-
}
|
25 |
-
|
26 |
-
function duplicate_post_options() {
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
</
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
</
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
</
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
</
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
</
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
</
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
<
|
114 |
-
|
115 |
-
<?php echo
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
</
|
130 |
-
</
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Add an option page
|
4 |
+
*/
|
5 |
+
if ( is_admin() ){ // admin actions
|
6 |
+
add_action('admin_menu', 'duplicate_post_menu');
|
7 |
+
add_action( 'admin_init', 'duplicate_post_register_settings');
|
8 |
+
}
|
9 |
+
|
10 |
+
function duplicate_post_register_settings() { // whitelist options
|
11 |
+
register_setting( 'duplicate_post_group', 'duplicate_post_copydate');
|
12 |
+
register_setting( 'duplicate_post_group', 'duplicate_post_copyexcerpt');
|
13 |
+
register_setting( 'duplicate_post_group', 'duplicate_post_copystatus');
|
14 |
+
register_setting( 'duplicate_post_group', 'duplicate_post_blacklist');
|
15 |
+
register_setting( 'duplicate_post_group', 'duplicate_post_taxonomies_blacklist');
|
16 |
+
register_setting( 'duplicate_post_group', 'duplicate_post_title_prefix');
|
17 |
+
register_setting( 'duplicate_post_group', 'duplicate_post_title_suffix');
|
18 |
+
register_setting( 'duplicate_post_group', 'duplicate_post_roles');
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
function duplicate_post_menu() {
|
23 |
+
add_options_page(__("Duplicate Post Options", DUPLICATE_POST_I18N_DOMAIN), __("Duplicate Post", DUPLICATE_POST_I18N_DOMAIN), 'administrator', 'duplicatepost', 'duplicate_post_options');
|
24 |
+
}
|
25 |
+
|
26 |
+
function duplicate_post_options() {
|
27 |
+
|
28 |
+
if ( current_user_can( 'edit_users' ) && $_GET['settings-updated'] == true){
|
29 |
+
global $wp_roles;
|
30 |
+
$roles = $wp_roles->get_names();
|
31 |
+
|
32 |
+
$dp_roles = get_option('duplicate_post_roles');
|
33 |
+
if ( $dp_roles == "" ) $dp_roles = array();
|
34 |
+
|
35 |
+
foreach ($roles as $name => $display_name){
|
36 |
+
$role = get_role($name);
|
37 |
+
|
38 |
+
// role should have at least edit_posts capability
|
39 |
+
if ( !$role->has_cap('edit_posts') ) continue;
|
40 |
+
|
41 |
+
/* If the role doesn't have the capability and it was selected, add it. */
|
42 |
+
if ( !$role->has_cap( 'copy_posts' ) && in_array($name, $dp_roles) )
|
43 |
+
$role->add_cap( 'copy_posts' );
|
44 |
+
|
45 |
+
/* If the role has the capability and it wasn't selected, remove it. */
|
46 |
+
elseif ( $role->has_cap( 'copy_posts' ) && !in_array($name, $dp_roles) )
|
47 |
+
$role->remove_cap( 'copy_posts' );
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
?>
|
52 |
+
<div class="wrap">
|
53 |
+
<div id="icon-options-general" class="icon32"><br></div>
|
54 |
+
<h2 style="width: auto; float: left;">
|
55 |
+
<?php _e("Duplicate Post Options", DUPLICATE_POST_I18N_DOMAIN); ?>
|
56 |
+
</h2>
|
57 |
+
|
58 |
+
<div style="border: solid 1px #aaaaaa; background-color: #eeeeee; margin:9px 15px 4px 0; padding: 5px; text-align: center; font-weight: bold; float: left;">
|
59 |
+
<a href="http://lopo.it/duplicate-post-plugin"><?php _e('Visit plugin site'); ?></a> -
|
60 |
+
<a href="http://lopo.it/duplicate-post-plugin"><?php _e('Donate', DUPLICATE_POST_I18N_DOMAIN); ?></a> -
|
61 |
+
<a href="http://lopo.it/duplicate-post-plugin"><?php _e('Translate', DUPLICATE_POST_I18N_DOMAIN); ?></a>
|
62 |
+
</div>
|
63 |
+
|
64 |
+
<form method="post" action="options.php">
|
65 |
+
<?php settings_fields('duplicate_post_group'); ?>
|
66 |
+
|
67 |
+
<table class="form-table">
|
68 |
+
|
69 |
+
<tr valign="top">
|
70 |
+
<th scope="row"><?php _e("Copy post/page date also", DUPLICATE_POST_I18N_DOMAIN); ?>
|
71 |
+
</th>
|
72 |
+
<td><input type="checkbox" name="duplicate_post_copydate" value="1" <?php if(get_option('duplicate_post_copydate') == 1) echo 'checked="checked"'; ?>"/>
|
73 |
+
<span class="description"><?php _e("Normally, the new copy has its publication date set to current time: check the box to copy the original post/page date", DUPLICATE_POST_I18N_DOMAIN); ?>
|
74 |
+
</span>
|
75 |
+
</td>
|
76 |
+
</tr>
|
77 |
+
<tr valign="top">
|
78 |
+
<th scope="row"><?php _e("Copy post/page status", DUPLICATE_POST_I18N_DOMAIN); ?>
|
79 |
+
</th>
|
80 |
+
<td><input type="checkbox" name="duplicate_post_copystatus"
|
81 |
+
value="1" <?php if(get_option('duplicate_post_copystatus') == 1) echo 'checked="checked"'; ?>"/>
|
82 |
+
<span class="description"><?php _e("Copy the original post status (draft, published, pending) when cloning from the post list.", DUPLICATE_POST_I18N_DOMAIN); ?>
|
83 |
+
</span>
|
84 |
+
</td>
|
85 |
+
</tr>
|
86 |
+
<tr valign="top">
|
87 |
+
<th scope="row"><?php _e("Copy excerpt", DUPLICATE_POST_I18N_DOMAIN); ?>
|
88 |
+
</th>
|
89 |
+
<td><input type="checkbox" name="duplicate_post_copyexcerpt"
|
90 |
+
value="1" <?php if(get_option('duplicate_post_copyexcerpt') == 1) echo 'checked="checked"'; ?>"/>
|
91 |
+
<span class="description"><?php _e("Copy the excerpt from the original post/page", DUPLICATE_POST_I18N_DOMAIN); ?>
|
92 |
+
</span>
|
93 |
+
</td>
|
94 |
+
</tr>
|
95 |
+
<tr valign="top">
|
96 |
+
<th scope="row"><?php _e("Do not copy these fields", DUPLICATE_POST_I18N_DOMAIN); ?>
|
97 |
+
</th>
|
98 |
+
<td><input type="text" name="duplicate_post_blacklist"
|
99 |
+
value="<?php echo get_option('duplicate_post_blacklist'); ?>" /> <span
|
100 |
+
class="description"><?php _e("Comma-separated list of meta fields that must not be copied", DUPLICATE_POST_I18N_DOMAIN); ?>
|
101 |
+
</span>
|
102 |
+
</td>
|
103 |
+
</tr>
|
104 |
+
<tr valign="top">
|
105 |
+
<th scope="row"><?php _e("Do not copy these taxonomies", DUPLICATE_POST_I18N_DOMAIN); ?>
|
106 |
+
</th>
|
107 |
+
<td><div
|
108 |
+
style="height: 100px; width: 300px; padding: 5px; overflow: auto; border: 1px solid #ccc">
|
109 |
+
<?php $taxonomies=get_taxonomies(array('public' => true),'objects');
|
110 |
+
$taxonomies_blacklist = get_option('duplicate_post_taxonomies_blacklist');
|
111 |
+
if ($taxonomies_blacklist == "") $taxonomies_blacklist = array();
|
112 |
+
foreach ($taxonomies as $taxonomy ) : ?>
|
113 |
+
<label style="display: block;"> <input type="checkbox"
|
114 |
+
name="duplicate_post_taxonomies_blacklist[]"
|
115 |
+
value="<?php echo $taxonomy->name?>"
|
116 |
+
<?php if(in_array($taxonomy->name,$taxonomies_blacklist)) echo 'checked="checked"'?> />
|
117 |
+
<?php echo $taxonomy->labels->name?> </label>
|
118 |
+
<?php endforeach; ?>
|
119 |
+
</div> <span class="description"><?php _e("Select the taxonomies you don't want to be copied", DUPLICATE_POST_I18N_DOMAIN); ?>
|
120 |
+
</span>
|
121 |
+
</td>
|
122 |
+
</tr>
|
123 |
+
<tr valign="top">
|
124 |
+
<th scope="row"><?php _e("Title prefix", DUPLICATE_POST_I18N_DOMAIN); ?>
|
125 |
+
</th>
|
126 |
+
<td><input type="text" name="duplicate_post_title_prefix"
|
127 |
+
value="<?php echo get_option('duplicate_post_title_prefix'); ?>" />
|
128 |
+
<span class="description"><?php _e("Prefix to be added before the original title, e.g. \"Copy of\" (blank for no prefix)", DUPLICATE_POST_I18N_DOMAIN); ?>
|
129 |
+
</span>
|
130 |
+
</td>
|
131 |
+
</tr>
|
132 |
+
<tr valign="top">
|
133 |
+
<th scope="row"><?php _e("Title suffix", DUPLICATE_POST_I18N_DOMAIN); ?>
|
134 |
+
</th>
|
135 |
+
<td><input type="text" name="duplicate_post_title_suffix"
|
136 |
+
value="<?php echo get_option('duplicate_post_title_suffix'); ?>" />
|
137 |
+
<span class="description"><?php _e("Suffix to be added after the original title, e.g. \"(dup)\" (blank for no suffix)", DUPLICATE_POST_I18N_DOMAIN); ?>
|
138 |
+
</span>
|
139 |
+
</td>
|
140 |
+
</tr>
|
141 |
+
<tr valign="top">
|
142 |
+
<th scope="row"><?php _e("Roles allowed to copy", DUPLICATE_POST_I18N_DOMAIN); ?>
|
143 |
+
</th>
|
144 |
+
<td><div
|
145 |
+
style="height: 100px; width: 300px; padding: 5px; overflow: auto; border: 1px solid #ccc">
|
146 |
+
<?php global $wp_roles;
|
147 |
+
$roles = $wp_roles->get_names();
|
148 |
+
foreach ($roles as $name => $display_name): $role = get_role($name);
|
149 |
+
if ( !$role->has_cap('edit_posts') ) continue; ?>
|
150 |
+
<label style="display: block;"> <input type="checkbox"
|
151 |
+
name="duplicate_post_roles[]" value="<?php echo $name ?>"
|
152 |
+
<?php if($role->has_cap('copy_posts')) echo 'checked="checked"'?> />
|
153 |
+
<?php echo _x($display_name, "User role", "default") ?> </label>
|
154 |
+
<?php endforeach; ?>
|
155 |
+
</div> <span class="description"><?php _e("Warning: users will be able to copy all posts, even those of other users", DUPLICATE_POST_I18N_DOMAIN); ?>
|
156 |
+
</span>
|
157 |
+
</td>
|
158 |
+
</tr>
|
159 |
+
|
160 |
+
</table>
|
161 |
+
|
162 |
+
<p class="submit">
|
163 |
+
<input type="submit" class="button-primary"
|
164 |
+
value="<?php _e('Save Changes', DUPLICATE_POST_I18N_DOMAIN) ?>" />
|
165 |
+
</p>
|
166 |
+
|
167 |
+
</form>
|
168 |
+
</div>
|
169 |
+
<?php
|
170 |
+
}
|
171 |
?>
|
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: 2.
|
7 |
Author: Enrico Battocchi
|
8 |
Author URI: http://lopo.it
|
9 |
Text Domain: duplicate-post
|
@@ -29,15 +29,25 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
29 |
// i18n plugin domain
|
30 |
define('DUPLICATE_POST_I18N_DOMAIN', 'duplicate-post');
|
31 |
|
|
|
|
|
|
|
32 |
/**
|
33 |
* Initialise the internationalisation domain
|
34 |
*/
|
35 |
load_plugin_textdomain(DUPLICATE_POST_I18N_DOMAIN,
|
36 |
'wp-content/plugins/duplicate-post/languages','duplicate-post/languages');
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
require_once (dirname(__FILE__).'/duplicate-post-common.php');
|
39 |
|
40 |
if (is_admin()){
|
41 |
require_once (dirname(__FILE__).'/duplicate-post-admin.php');
|
42 |
}
|
43 |
-
?>
|
3 |
Plugin Name: Duplicate Post
|
4 |
Plugin URI: http://lopo.it/duplicate-post-plugin/
|
5 |
Description: Clone posts and pages.
|
6 |
+
Version: 2.1
|
7 |
Author: Enrico Battocchi
|
8 |
Author URI: http://lopo.it
|
9 |
Text Domain: duplicate-post
|
29 |
// i18n plugin domain
|
30 |
define('DUPLICATE_POST_I18N_DOMAIN', 'duplicate-post');
|
31 |
|
32 |
+
// Version of the plugin
|
33 |
+
define('DUPLICATE_POST_CURRENT_VERSION', '2.1' );
|
34 |
+
|
35 |
/**
|
36 |
* Initialise the internationalisation domain
|
37 |
*/
|
38 |
load_plugin_textdomain(DUPLICATE_POST_I18N_DOMAIN,
|
39 |
'wp-content/plugins/duplicate-post/languages','duplicate-post/languages');
|
40 |
|
41 |
+
add_filter("plugin_action_links_".plugin_basename(__FILE__), "duplicate_post_plugin_actions", 10, 4);
|
42 |
+
|
43 |
+
function duplicate_post_plugin_actions( $actions, $plugin_file, $plugin_data, $context ) {
|
44 |
+
array_unshift($actions, "<a href=\"".menu_page_url('duplicatepost', false)."\">".__("Settings")."</a>");
|
45 |
+
return $actions;
|
46 |
+
}
|
47 |
+
|
48 |
require_once (dirname(__FILE__).'/duplicate-post-common.php');
|
49 |
|
50 |
if (is_admin()){
|
51 |
require_once (dirname(__FILE__).'/duplicate-post-admin.php');
|
52 |
}
|
53 |
+
?>
|
languages/duplicate-post-it_IT.mo
CHANGED
Binary file
|
languages/duplicate-post-it_IT.po
CHANGED
@@ -6,160 +6,140 @@
|
|
6 |
msgid ""
|
7 |
msgstr ""
|
8 |
"Project-Id-Version: duplicate-post\n"
|
9 |
-
"Report-Msgid-Bugs-To:
|
10 |
-
"POT-Creation-Date: 2011-12-
|
11 |
-
"PO-Revision-Date: 2011-12-
|
12 |
-
"Last-Translator: Enrico Battocchi <
|
13 |
"Language-Team: Italian <it@li.org>\n"
|
|
|
14 |
"MIME-Version: 1.0\n"
|
15 |
"Content-Type: text/plain; charset=UTF-8\n"
|
16 |
"Content-Transfer-Encoding: 8bit\n"
|
17 |
"X-Launchpad-Export-Date: 2011-12-12 13:36+0000\n"
|
18 |
"X-Generator: Launchpad (build 14458)\n"
|
19 |
|
20 |
-
#: duplicate-post-admin.php:68
|
21 |
-
msgid ""
|
22 |
-
"<strong>Duplicate Post</strong> now has two different ways to work: you can "
|
23 |
-
"clone immediately or you can copy to a new draft to edit.<br/>\n"
|
24 |
-
" Learn more on the <a href=\"%s\">plugin page</a>."
|
25 |
-
msgstr ""
|
26 |
-
"<strong>Duplicate Post</strong> adesso ha due diverse modalità di "
|
27 |
-
"funzionamento: si può clonare immediatamente o copiare in una nuova bozza "
|
28 |
-
"da modificare<br/>\n"
|
29 |
-
"Maggiori informazioni nella <a href=\"%s\">pagina del plugin</a>."
|
30 |
-
|
31 |
-
#: duplicate-post-admin.php:88
|
32 |
-
msgid "Clone this item"
|
33 |
-
msgstr "Clona questo elemento"
|
34 |
-
|
35 |
-
#: duplicate-post-admin.php:89
|
36 |
-
msgid "Clone"
|
37 |
-
msgstr "Clona"
|
38 |
-
|
39 |
-
#: duplicate-post-admin.php:91 duplicate-post-admin.php:110
|
40 |
-
#: duplicate-post-common.php:63 duplicate-post-common.php:67
|
41 |
-
msgid "Copy to a new draft"
|
42 |
-
msgstr "Copia in una nuova bozza"
|
43 |
-
|
44 |
-
#: duplicate-post-admin.php:92
|
45 |
-
msgid "New Draft"
|
46 |
-
msgstr "Nuova bozza"
|
47 |
-
|
48 |
-
#: duplicate-post-admin.php:137
|
49 |
-
msgid "No post to duplicate has been supplied!"
|
50 |
-
msgstr "Non è stato fornito alcun articolo da copiare!"
|
51 |
-
|
52 |
-
#: duplicate-post-admin.php:159
|
53 |
-
msgid "Copy creation failed, could not find original:"
|
54 |
-
msgstr "Creazione della copia fallita, impossibile trovare l'originale:"
|
55 |
-
|
56 |
-
#: duplicate-post-admin.php:309
|
57 |
-
msgid "Donate"
|
58 |
-
msgstr "Invia una donazione"
|
59 |
-
|
60 |
-
#: duplicate-post-admin.php:310
|
61 |
-
msgid "Translate"
|
62 |
-
msgstr "Traduci"
|
63 |
-
|
64 |
#: duplicate-post-options.php:23
|
|
|
65 |
msgid "Duplicate Post Options"
|
66 |
msgstr "Opzioni di Duplicate Post"
|
67 |
|
68 |
-
#. #-#-#-#-# plugin.pot (Duplicate Post 2.
|
69 |
#. Plugin Name of the plugin/theme
|
70 |
-
#: duplicate-post-options.php:23
|
|
|
71 |
msgid "Duplicate Post"
|
72 |
msgstr "Duplicate Post"
|
73 |
|
74 |
-
#: duplicate-post-options.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
msgid "Copy post/page date also"
|
76 |
msgstr "Copia anche la data dell'articolo o pagina"
|
77 |
|
78 |
-
#: duplicate-post-options.php:
|
79 |
-
msgid ""
|
80 |
-
"
|
81 |
-
"the box to copy the original post/page date"
|
82 |
-
msgstr ""
|
83 |
-
"Normalmente, la nuova copia ha la data di pubblicazione impostata "
|
84 |
-
"all'istante corrente: spunta la casella per copiare la data "
|
85 |
-
"dell'articolo/pagina originale"
|
86 |
|
87 |
-
#: duplicate-post-options.php:
|
88 |
msgid "Copy post/page status"
|
89 |
msgstr "Copia anche lo stato dell'articolo o della pagina"
|
90 |
|
91 |
-
#: duplicate-post-options.php:
|
92 |
-
msgid ""
|
93 |
-
"
|
94 |
-
"the post list."
|
95 |
-
msgstr ""
|
96 |
-
"Copia lo stato (bozza, pubblicato, in sospeso) dell'articolo originale "
|
97 |
-
"quando si clona dalla lista degli articoli"
|
98 |
|
99 |
-
#: duplicate-post-options.php:
|
100 |
msgid "Copy excerpt"
|
101 |
msgstr "Copia il riassunto"
|
102 |
|
103 |
-
#: duplicate-post-options.php:
|
104 |
msgid "Copy the excerpt from the original post/page"
|
105 |
msgstr "Copia il riassunto dall'articolo o pagina originale"
|
106 |
|
107 |
-
#: duplicate-post-options.php:
|
108 |
msgid "Do not copy these fields"
|
109 |
msgstr "Non copiare questi campi"
|
110 |
|
111 |
-
#: duplicate-post-options.php:
|
112 |
msgid "Comma-separated list of meta fields that must not be copied"
|
113 |
msgstr "Lista separata da virgole di campi personalizzati da non copiare"
|
114 |
|
115 |
-
#: duplicate-post-options.php:
|
116 |
msgid "Do not copy these taxonomies"
|
117 |
msgstr "Non copiare queste tassonomie"
|
118 |
|
119 |
-
#: duplicate-post-options.php:
|
120 |
msgid "Select the taxonomies you don't want to be copied"
|
121 |
msgstr "Seleziona le tassonomie che non vuoi copiare"
|
122 |
|
123 |
-
#: duplicate-post-options.php:
|
124 |
msgid "Title prefix"
|
125 |
msgstr "Prefisso del titolo"
|
126 |
|
127 |
-
#: duplicate-post-options.php:
|
128 |
-
msgid ""
|
129 |
-
"
|
130 |
-
"prefix)"
|
131 |
-
msgstr ""
|
132 |
-
"Prefisso da aggiungere prima del titolo originale, es. \"Copia di\" "
|
133 |
-
"(lasciare vuoto per nessun prefisso)"
|
134 |
|
135 |
-
#: duplicate-post-options.php:
|
136 |
msgid "Title suffix"
|
137 |
msgstr "Suffisso del titolo"
|
138 |
|
139 |
-
#: duplicate-post-options.php:
|
140 |
-
msgid ""
|
141 |
-
"
|
142 |
-
"suffix)"
|
143 |
-
msgstr ""
|
144 |
-
"Suffisso da aggiungere prima del titolo originale, es. \"(copia)\" (lasciare "
|
145 |
-
"vuoto per nessun suffisso)"
|
146 |
|
147 |
-
#: duplicate-post-options.php:
|
148 |
-
msgid "
|
149 |
-
msgstr "
|
150 |
|
151 |
-
#: duplicate-post-options.php:
|
152 |
-
msgid ""
|
153 |
-
"
|
154 |
-
"users"
|
155 |
-
msgstr ""
|
156 |
-
"Attenzione: gli utenti potranno copiare tutti gli articoli, anche quelli "
|
157 |
-
"degli utenti di livello superiore"
|
158 |
|
159 |
-
#: duplicate-post-options.php:
|
160 |
msgid "Save Changes"
|
161 |
msgstr "Salva le modifiche"
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
#. Plugin URI of the plugin/theme
|
164 |
msgid "http://lopo.it/duplicate-post-plugin/"
|
165 |
msgstr "http://lopo.it/duplicate-post-plugin/"
|
@@ -176,45 +156,49 @@ msgstr "Enrico Battocchi"
|
|
176 |
msgid "http://lopo.it"
|
177 |
msgstr "http://lopo.it"
|
178 |
|
|
|
|
|
|
|
179 |
#~ msgid "Duplicate"
|
180 |
#~ msgstr "Duplica"
|
181 |
|
182 |
#~ msgid ""
|
183 |
-
#~ "Comma-separated list of meta fields that must not be copied when cloning
|
184 |
-
#~ "post/page"
|
185 |
#~ msgstr ""
|
186 |
#~ "Lista separata da virgole di campi personalizzati da non copiare quando "
|
187 |
#~ "viene clonato un post o una pagina"
|
188 |
|
189 |
#~ msgid ""
|
190 |
-
#~ "Prefix to be added before the original title when cloning a post/page, e.
|
191 |
-
#~ "\"Copy of\" (blank for no prefix)"
|
192 |
#~ msgstr ""
|
193 |
-
#~ "Prefisso da aggiungere prima del titolo originale quando si clona un post
|
194 |
-
#~ "una pagina, es. \"Copia di\" (lasciare vuoto per nessun prefisso)"
|
195 |
|
196 |
#~ msgid "Creates a copy of a post."
|
197 |
#~ msgstr "Crea una copia di un articolo."
|
198 |
|
199 |
#~ msgid ""
|
200 |
-
#~ "Normally, the new draft has publication date set to current time: check
|
201 |
-
#~ "box to copy the original post/page date"
|
202 |
#~ msgstr ""
|
203 |
#~ "Normalmente, la nuova bozza ha la data di pubblicazione impostata "
|
204 |
-
#~ "all'istante corrente: spunta la casella per copiare la data "
|
205 |
-
#~ "
|
206 |
|
207 |
#~ msgid ""
|
208 |
-
#~ "Suffix to be added after the original title when cloning a post/page, e.
|
209 |
-
#~ "\"(dup)\" (blank for no suffix)"
|
210 |
#~ msgstr ""
|
211 |
-
#~ "Suffisso da aggiungere prima del titolo originale quando si clona un post
|
212 |
-
#~ "una pagina, es. \"(copia)\" (lasciare vuoto per nessun suffisso)"
|
213 |
|
214 |
#~ msgid ""
|
215 |
-
#~ "Copy the original post status (draft, published, pending) when cloning
|
216 |
-
#~ "the post list. Cloning from the edit screen will always create a new
|
|
|
217 |
#~ msgstr ""
|
218 |
#~ "Copia lo stato dell'articolo originale (bozza, pubblicato, in sospeso) "
|
219 |
-
#~ "quando si clona dalla lista degli articoli. La duplicazione dalla
|
220 |
-
#~ "di modifica crerà sempre una nuova bozza."
|
6 |
msgid ""
|
7 |
msgstr ""
|
8 |
"Project-Id-Version: duplicate-post\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/duplicate-post\n"
|
10 |
+
"POT-Creation-Date: 2011-12-30 15:27:45+00:00\n"
|
11 |
+
"PO-Revision-Date: 2011-12-30 16:29+0100\n"
|
12 |
+
"Last-Translator: Enrico Battocchi <enrico.battocchi@gmail.com>\n"
|
13 |
"Language-Team: Italian <it@li.org>\n"
|
14 |
+
"Language: it\n"
|
15 |
"MIME-Version: 1.0\n"
|
16 |
"Content-Type: text/plain; charset=UTF-8\n"
|
17 |
"Content-Transfer-Encoding: 8bit\n"
|
18 |
"X-Launchpad-Export-Date: 2011-12-12 13:36+0000\n"
|
19 |
"X-Generator: Launchpad (build 14458)\n"
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
#: duplicate-post-options.php:23
|
22 |
+
#: duplicate-post-options.php:55
|
23 |
msgid "Duplicate Post Options"
|
24 |
msgstr "Opzioni di Duplicate Post"
|
25 |
|
26 |
+
#. #-#-#-#-# plugin.pot (Duplicate Post 2.1) #-#-#-#-#
|
27 |
#. Plugin Name of the plugin/theme
|
28 |
+
#: duplicate-post-options.php:23
|
29 |
+
#: duplicate-post-options.php:59
|
30 |
msgid "Duplicate Post"
|
31 |
msgstr "Duplicate Post"
|
32 |
|
33 |
+
#: duplicate-post-options.php:61
|
34 |
+
#: duplicate-post-admin.php:301
|
35 |
+
msgid "Donate"
|
36 |
+
msgstr "Invia una donazione"
|
37 |
+
|
38 |
+
#: duplicate-post-options.php:62
|
39 |
+
#: duplicate-post-admin.php:302
|
40 |
+
msgid "Translate"
|
41 |
+
msgstr "Traduci"
|
42 |
+
|
43 |
+
#: duplicate-post-options.php:71
|
44 |
msgid "Copy post/page date also"
|
45 |
msgstr "Copia anche la data dell'articolo o pagina"
|
46 |
|
47 |
+
#: duplicate-post-options.php:74
|
48 |
+
msgid "Normally, the new copy has its publication date set to current time: check the box to copy the original post/page date"
|
49 |
+
msgstr "Normalmente, la nuova copia ha la data di pubblicazione impostata all'istante corrente: spunta la casella per copiare la data dell'articolo/pagina originale"
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
#: duplicate-post-options.php:79
|
52 |
msgid "Copy post/page status"
|
53 |
msgstr "Copia anche lo stato dell'articolo o della pagina"
|
54 |
|
55 |
+
#: duplicate-post-options.php:83
|
56 |
+
msgid "Copy the original post status (draft, published, pending) when cloning from the post list."
|
57 |
+
msgstr "Copia lo stato (bozza, pubblicato, in sospeso) dell'articolo originale quando si clona dalla lista degli articoli"
|
|
|
|
|
|
|
|
|
58 |
|
59 |
+
#: duplicate-post-options.php:88
|
60 |
msgid "Copy excerpt"
|
61 |
msgstr "Copia il riassunto"
|
62 |
|
63 |
+
#: duplicate-post-options.php:92
|
64 |
msgid "Copy the excerpt from the original post/page"
|
65 |
msgstr "Copia il riassunto dall'articolo o pagina originale"
|
66 |
|
67 |
+
#: duplicate-post-options.php:97
|
68 |
msgid "Do not copy these fields"
|
69 |
msgstr "Non copiare questi campi"
|
70 |
|
71 |
+
#: duplicate-post-options.php:101
|
72 |
msgid "Comma-separated list of meta fields that must not be copied"
|
73 |
msgstr "Lista separata da virgole di campi personalizzati da non copiare"
|
74 |
|
75 |
+
#: duplicate-post-options.php:106
|
76 |
msgid "Do not copy these taxonomies"
|
77 |
msgstr "Non copiare queste tassonomie"
|
78 |
|
79 |
+
#: duplicate-post-options.php:120
|
80 |
msgid "Select the taxonomies you don't want to be copied"
|
81 |
msgstr "Seleziona le tassonomie che non vuoi copiare"
|
82 |
|
83 |
+
#: duplicate-post-options.php:125
|
84 |
msgid "Title prefix"
|
85 |
msgstr "Prefisso del titolo"
|
86 |
|
87 |
+
#: duplicate-post-options.php:129
|
88 |
+
msgid "Prefix to be added before the original title, e.g. \"Copy of\" (blank for no prefix)"
|
89 |
+
msgstr "Prefisso da aggiungere prima del titolo originale, es. \"Copia di\" (lasciare vuoto per nessun prefisso)"
|
|
|
|
|
|
|
|
|
90 |
|
91 |
+
#: duplicate-post-options.php:134
|
92 |
msgid "Title suffix"
|
93 |
msgstr "Suffisso del titolo"
|
94 |
|
95 |
+
#: duplicate-post-options.php:138
|
96 |
+
msgid "Suffix to be added after the original title, e.g. \"(dup)\" (blank for no suffix)"
|
97 |
+
msgstr "Suffisso da aggiungere prima del titolo originale, es. \"(copia)\" (lasciare vuoto per nessun suffisso)"
|
|
|
|
|
|
|
|
|
98 |
|
99 |
+
#: duplicate-post-options.php:143
|
100 |
+
msgid "Roles allowed to copy"
|
101 |
+
msgstr "Ruoli abilitati alla copia"
|
102 |
|
103 |
+
#: duplicate-post-options.php:156
|
104 |
+
msgid "Warning: users will be able to copy all posts, even those of other users"
|
105 |
+
msgstr "Attenzione: gli utenti potranno copiare tutti gli articoli, anche quelli di altri utenti"
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
#: duplicate-post-options.php:165
|
108 |
msgid "Save Changes"
|
109 |
msgstr "Salva le modifiche"
|
110 |
|
111 |
+
#: duplicate-post-admin.php:86
|
112 |
+
msgid "<strong>Duplicate Post</strong> now has two different ways to work: you can clone immediately or you can copy to a new draft to edit.<br/>Learn more on the <a href=\"%s\">plugin page</a>."
|
113 |
+
msgstr "<strong>Duplicate Post</strong> adesso ha due diverse modalità di funzionamento: si può clonare immediatamente o copiare in una nuova bozza da modificare.<br/>Maggiori informazioni nella <a href=\"%s\">pagina del plugin</a>."
|
114 |
+
|
115 |
+
#: duplicate-post-admin.php:102
|
116 |
+
msgid "Clone this item"
|
117 |
+
msgstr "Clona questo elemento"
|
118 |
+
|
119 |
+
#: duplicate-post-admin.php:103
|
120 |
+
msgid "Clone"
|
121 |
+
msgstr "Clona"
|
122 |
+
|
123 |
+
#: duplicate-post-admin.php:105
|
124 |
+
#: duplicate-post-admin.php:121
|
125 |
+
#: duplicate-post-common.php:68
|
126 |
+
#: duplicate-post-common.php:72
|
127 |
+
#: duplicate-post-common.php:91
|
128 |
+
msgid "Copy to a new draft"
|
129 |
+
msgstr "Copia in una nuova bozza"
|
130 |
+
|
131 |
+
#: duplicate-post-admin.php:106
|
132 |
+
msgid "New Draft"
|
133 |
+
msgstr "Nuova bozza"
|
134 |
+
|
135 |
+
#: duplicate-post-admin.php:148
|
136 |
+
msgid "No post to duplicate has been supplied!"
|
137 |
+
msgstr "Non è stato fornito alcun articolo da copiare!"
|
138 |
+
|
139 |
+
#: duplicate-post-admin.php:170
|
140 |
+
msgid "Copy creation failed, could not find original:"
|
141 |
+
msgstr "Creazione della copia fallita, impossibile trovare l'originale:"
|
142 |
+
|
143 |
#. Plugin URI of the plugin/theme
|
144 |
msgid "http://lopo.it/duplicate-post-plugin/"
|
145 |
msgstr "http://lopo.it/duplicate-post-plugin/"
|
156 |
msgid "http://lopo.it"
|
157 |
msgstr "http://lopo.it"
|
158 |
|
159 |
+
#~ msgid "Minimum level to copy posts"
|
160 |
+
#~ msgstr "Livello minimo per copiare gli articoli"
|
161 |
+
|
162 |
#~ msgid "Duplicate"
|
163 |
#~ msgstr "Duplica"
|
164 |
|
165 |
#~ msgid ""
|
166 |
+
#~ "Comma-separated list of meta fields that must not be copied when cloning "
|
167 |
+
#~ "a post/page"
|
168 |
#~ msgstr ""
|
169 |
#~ "Lista separata da virgole di campi personalizzati da non copiare quando "
|
170 |
#~ "viene clonato un post o una pagina"
|
171 |
|
172 |
#~ msgid ""
|
173 |
+
#~ "Prefix to be added before the original title when cloning a post/page, e."
|
174 |
+
#~ "g. \"Copy of\" (blank for no prefix)"
|
175 |
#~ msgstr ""
|
176 |
+
#~ "Prefisso da aggiungere prima del titolo originale quando si clona un post "
|
177 |
+
#~ "o una pagina, es. \"Copia di\" (lasciare vuoto per nessun prefisso)"
|
178 |
|
179 |
#~ msgid "Creates a copy of a post."
|
180 |
#~ msgstr "Crea una copia di un articolo."
|
181 |
|
182 |
#~ msgid ""
|
183 |
+
#~ "Normally, the new draft has publication date set to current time: check "
|
184 |
+
#~ "the box to copy the original post/page date"
|
185 |
#~ msgstr ""
|
186 |
#~ "Normalmente, la nuova bozza ha la data di pubblicazione impostata "
|
187 |
+
#~ "all'istante corrente: spunta la casella per copiare la data dell'articolo/"
|
188 |
+
#~ "pagina originale"
|
189 |
|
190 |
#~ msgid ""
|
191 |
+
#~ "Suffix to be added after the original title when cloning a post/page, e."
|
192 |
+
#~ "g. \"(dup)\" (blank for no suffix)"
|
193 |
#~ msgstr ""
|
194 |
+
#~ "Suffisso da aggiungere prima del titolo originale quando si clona un post "
|
195 |
+
#~ "o una pagina, es. \"(copia)\" (lasciare vuoto per nessun suffisso)"
|
196 |
|
197 |
#~ msgid ""
|
198 |
+
#~ "Copy the original post status (draft, published, pending) when cloning "
|
199 |
+
#~ "from the post list. Cloning from the edit screen will always create a new "
|
200 |
+
#~ "draft."
|
201 |
#~ msgstr ""
|
202 |
#~ "Copia lo stato dell'articolo originale (bozza, pubblicato, in sospeso) "
|
203 |
+
#~ "quando si clona dalla lista degli articoli. La duplicazione dalla "
|
204 |
+
#~ "schermata di modifica crerà sempre una nuova bozza."
|
languages/duplicate-post.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the Duplicate Post package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Duplicate Post 2.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/duplicate-post\n"
|
7 |
-
"POT-Creation-Date: 2011-12-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -12,134 +12,134 @@ msgstr ""
|
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
-
#: duplicate-post-
|
16 |
-
msgid ""
|
17 |
-
"<strong>Duplicate Post</strong> now has two different ways to work: you can "
|
18 |
-
"clone immediately or you can copy to a new draft to edit.<br/>\n"
|
19 |
-
" Learn more on the <a href=\"%s\">plugin page</a>."
|
20 |
-
msgstr ""
|
21 |
-
|
22 |
-
#: duplicate-post-admin.php:88
|
23 |
-
msgid "Clone this item"
|
24 |
-
msgstr ""
|
25 |
-
|
26 |
-
#: duplicate-post-admin.php:89
|
27 |
-
msgid "Clone"
|
28 |
-
msgstr ""
|
29 |
-
|
30 |
-
#: duplicate-post-admin.php:91 duplicate-post-admin.php:110
|
31 |
-
#: duplicate-post-common.php:63 duplicate-post-common.php:67
|
32 |
-
msgid "Copy to a new draft"
|
33 |
-
msgstr ""
|
34 |
-
|
35 |
-
#: duplicate-post-admin.php:92
|
36 |
-
msgid "New Draft"
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
#: duplicate-post-admin.php:137
|
40 |
-
msgid "No post to duplicate has been supplied!"
|
41 |
msgstr ""
|
42 |
|
43 |
-
|
44 |
-
|
|
|
|
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: duplicate-post-admin.php:
|
48 |
msgid "Donate"
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: duplicate-post-admin.php:
|
52 |
msgid "Translate"
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: duplicate-post-options.php:
|
56 |
-
msgid "Duplicate Post Options"
|
57 |
-
msgstr ""
|
58 |
-
|
59 |
-
#. #-#-#-#-# plugin.pot (Duplicate Post 2.0.2) #-#-#-#-#
|
60 |
-
#. Plugin Name of the plugin/theme
|
61 |
-
#: duplicate-post-options.php:23 duplicate-post-options.php:30
|
62 |
-
msgid "Duplicate Post"
|
63 |
-
msgstr ""
|
64 |
-
|
65 |
-
#: duplicate-post-options.php:39
|
66 |
msgid "Copy post/page date also"
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: duplicate-post-options.php:
|
70 |
msgid ""
|
71 |
"Normally, the new copy has its publication date set to current time: check "
|
72 |
"the box to copy the original post/page date"
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: duplicate-post-options.php:
|
76 |
msgid "Copy post/page status"
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: duplicate-post-options.php:
|
80 |
msgid ""
|
81 |
"Copy the original post status (draft, published, pending) when cloning from "
|
82 |
"the post list."
|
83 |
msgstr ""
|
84 |
|
85 |
-
#: duplicate-post-options.php:
|
86 |
msgid "Copy excerpt"
|
87 |
msgstr ""
|
88 |
|
89 |
-
#: duplicate-post-options.php:
|
90 |
msgid "Copy the excerpt from the original post/page"
|
91 |
msgstr ""
|
92 |
|
93 |
-
#: duplicate-post-options.php:
|
94 |
msgid "Do not copy these fields"
|
95 |
msgstr ""
|
96 |
|
97 |
-
#: duplicate-post-options.php:
|
98 |
msgid "Comma-separated list of meta fields that must not be copied"
|
99 |
msgstr ""
|
100 |
|
101 |
-
#: duplicate-post-options.php:
|
102 |
msgid "Do not copy these taxonomies"
|
103 |
msgstr ""
|
104 |
|
105 |
-
#: duplicate-post-options.php:
|
106 |
msgid "Select the taxonomies you don't want to be copied"
|
107 |
msgstr ""
|
108 |
|
109 |
-
#: duplicate-post-options.php:
|
110 |
msgid "Title prefix"
|
111 |
msgstr ""
|
112 |
|
113 |
-
#: duplicate-post-options.php:
|
114 |
msgid ""
|
115 |
"Prefix to be added before the original title, e.g. \"Copy of\" (blank for no "
|
116 |
"prefix)"
|
117 |
msgstr ""
|
118 |
|
119 |
-
#: duplicate-post-options.php:
|
120 |
msgid "Title suffix"
|
121 |
msgstr ""
|
122 |
|
123 |
-
#: duplicate-post-options.php:
|
124 |
msgid ""
|
125 |
"Suffix to be added after the original title, e.g. \"(dup)\" (blank for no "
|
126 |
"suffix)"
|
127 |
msgstr ""
|
128 |
|
129 |
-
#: duplicate-post-options.php:
|
130 |
-
msgid "
|
131 |
msgstr ""
|
132 |
|
133 |
-
#: duplicate-post-options.php:
|
134 |
msgid ""
|
135 |
-
"Warning: users will be able to copy all posts, even those of
|
136 |
-
"users"
|
137 |
msgstr ""
|
138 |
|
139 |
-
#: duplicate-post-options.php:
|
140 |
msgid "Save Changes"
|
141 |
msgstr ""
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
#. Plugin URI of the plugin/theme
|
144 |
msgid "http://lopo.it/duplicate-post-plugin/"
|
145 |
msgstr ""
|
2 |
# This file is distributed under the same license as the Duplicate Post package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Duplicate Post 2.1\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/duplicate-post\n"
|
7 |
+
"POT-Creation-Date: 2011-12-30 15:27:45+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
+
#: duplicate-post-options.php:23 duplicate-post-options.php:55
|
16 |
+
msgid "Duplicate Post Options"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
msgstr ""
|
18 |
|
19 |
+
#. #-#-#-#-# plugin.pot (Duplicate Post 2.1) #-#-#-#-#
|
20 |
+
#. Plugin Name of the plugin/theme
|
21 |
+
#: duplicate-post-options.php:23 duplicate-post-options.php:59
|
22 |
+
msgid "Duplicate Post"
|
23 |
msgstr ""
|
24 |
|
25 |
+
#: duplicate-post-options.php:61 duplicate-post-admin.php:301
|
26 |
msgid "Donate"
|
27 |
msgstr ""
|
28 |
|
29 |
+
#: duplicate-post-options.php:62 duplicate-post-admin.php:302
|
30 |
msgid "Translate"
|
31 |
msgstr ""
|
32 |
|
33 |
+
#: duplicate-post-options.php:71
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
msgid "Copy post/page date also"
|
35 |
msgstr ""
|
36 |
|
37 |
+
#: duplicate-post-options.php:74
|
38 |
msgid ""
|
39 |
"Normally, the new copy has its publication date set to current time: check "
|
40 |
"the box to copy the original post/page date"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: duplicate-post-options.php:79
|
44 |
msgid "Copy post/page status"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: duplicate-post-options.php:83
|
48 |
msgid ""
|
49 |
"Copy the original post status (draft, published, pending) when cloning from "
|
50 |
"the post list."
|
51 |
msgstr ""
|
52 |
|
53 |
+
#: duplicate-post-options.php:88
|
54 |
msgid "Copy excerpt"
|
55 |
msgstr ""
|
56 |
|
57 |
+
#: duplicate-post-options.php:92
|
58 |
msgid "Copy the excerpt from the original post/page"
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: duplicate-post-options.php:97
|
62 |
msgid "Do not copy these fields"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: duplicate-post-options.php:101
|
66 |
msgid "Comma-separated list of meta fields that must not be copied"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: duplicate-post-options.php:106
|
70 |
msgid "Do not copy these taxonomies"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: duplicate-post-options.php:120
|
74 |
msgid "Select the taxonomies you don't want to be copied"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: duplicate-post-options.php:125
|
78 |
msgid "Title prefix"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: duplicate-post-options.php:129
|
82 |
msgid ""
|
83 |
"Prefix to be added before the original title, e.g. \"Copy of\" (blank for no "
|
84 |
"prefix)"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: duplicate-post-options.php:134
|
88 |
msgid "Title suffix"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: duplicate-post-options.php:138
|
92 |
msgid ""
|
93 |
"Suffix to be added after the original title, e.g. \"(dup)\" (blank for no "
|
94 |
"suffix)"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: duplicate-post-options.php:143
|
98 |
+
msgid "Roles allowed to copy"
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: duplicate-post-options.php:156
|
102 |
msgid ""
|
103 |
+
"Warning: users will be able to copy all posts, even those of other users"
|
|
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: duplicate-post-options.php:165
|
107 |
msgid "Save Changes"
|
108 |
msgstr ""
|
109 |
|
110 |
+
#: duplicate-post-admin.php:86
|
111 |
+
msgid ""
|
112 |
+
"<strong>Duplicate Post</strong> now has two different ways to work: you can "
|
113 |
+
"clone immediately or you can copy to a new draft to edit.<br/>Learn more on "
|
114 |
+
"the <a href=\"%s\">plugin page</a>."
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: duplicate-post-admin.php:102
|
118 |
+
msgid "Clone this item"
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
#: duplicate-post-admin.php:103
|
122 |
+
msgid "Clone"
|
123 |
+
msgstr ""
|
124 |
+
|
125 |
+
#: duplicate-post-admin.php:105 duplicate-post-admin.php:121
|
126 |
+
#: duplicate-post-common.php:68 duplicate-post-common.php:72
|
127 |
+
#: duplicate-post-common.php:91
|
128 |
+
msgid "Copy to a new draft"
|
129 |
+
msgstr ""
|
130 |
+
|
131 |
+
#: duplicate-post-admin.php:106
|
132 |
+
msgid "New Draft"
|
133 |
+
msgstr ""
|
134 |
+
|
135 |
+
#: duplicate-post-admin.php:148
|
136 |
+
msgid "No post to duplicate has been supplied!"
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: duplicate-post-admin.php:170
|
140 |
+
msgid "Copy creation failed, could not find original:"
|
141 |
+
msgstr ""
|
142 |
+
|
143 |
#. Plugin URI of the plugin/theme
|
144 |
msgid "http://lopo.it/duplicate-post-plugin/"
|
145 |
msgstr ""
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://lopo.it/duplicate-post-plugin/
|
|
4 |
Tags: duplicate post, copy, clone
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
Clone posts and pages.
|
10 |
|
@@ -18,11 +18,13 @@ This plugin allows to clone a post or page, or edit it as a new draft.
|
|
18 |
|
19 |
3. On the post edit screen, you can click on 'Copy to a new draft' above "Cancel"/"Move to trash".
|
20 |
|
21 |
-
|
|
|
|
|
22 |
|
23 |
**Pay attention to the new behaviour!** The first way now allows you to clone a post with a single click, speeding up your work if you have many posts to duplicate.
|
24 |
|
25 |
-
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
|
26 |
|
27 |
In the Options page under Settings it is now possible to choose what to copy:
|
28 |
|
@@ -31,13 +33,11 @@ In the Options page under Settings it is now possible to choose what to copy:
|
|
31 |
* the original post/page excerpt
|
32 |
* which taxonomies and custom fields
|
33 |
|
34 |
-
You can also set a prefix (or a suffix) to place before (or after) the title of the cloned post/page, and the
|
35 |
-
|
36 |
-
Duplicate post is natively in English, but it's shipped with translations in several other languages (though some are incomplete). Now there is a [Launchpad translation project](https://translations.launchpad.net/duplicate-post/) available to help translating this plugin: feel free to contribute (you can also send me an e-mail using the form on my website).
|
37 |
|
38 |
-
|
39 |
|
40 |
-
|
41 |
|
42 |
Thanks for all the suggestions, bug reports, translations and donations, they're frankly too many to be listed here!
|
43 |
|
@@ -60,6 +60,8 @@ First, check your version of WordPress: the plugin is not supposed to work on ol
|
|
60 |
|
61 |
Then try to deactivate and re-activate it, some user have reported that this fixes the problem.
|
62 |
|
|
|
|
|
63 |
If not, maybe there is some kind of conflict with other plugins: feel free to write me 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).
|
64 |
|
65 |
= Can you add it to the bulk actions in the post/page list? =
|
@@ -73,10 +75,14 @@ There is an open ticket in WordPress Trac, as other plugin developers too are in
|
|
73 |
1. Here you can copy the post you're editing to a new draft.
|
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 |
|
78 |
== Upgrade Notice ==
|
79 |
|
|
|
|
|
|
|
80 |
= 2.0.2 =
|
81 |
Fixed permalink bug + double choice on posts list
|
82 |
|
@@ -94,6 +100,14 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
|
|
94 |
|
95 |
== Changelog ==
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
= 2.0.2 =
|
98 |
* Fixed bug for permalinks
|
99 |
* Two links on posts list: clone immediately or copy to a new draft to edit.
|
@@ -149,7 +163,7 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
|
|
149 |
|
150 |
|
151 |
|
152 |
-
== Template
|
153 |
|
154 |
I have added the template tag `duplicate_post_clone_post_link( $link, $before, $after, $id )`, which behaves just like [edit_post_link()](http://codex.wordpress.org/Function_Reference/edit_post_link).
|
155 |
That means that you can put it in your template (e.g., in single.php or page.php) so you can get a "Clone" link when displaying a post or page.
|
@@ -166,8 +180,10 @@ The parameters are:
|
|
166 |
(string) (optional) Text to put after the link text. Default: None
|
167 |
|
168 |
* *id*
|
169 |
-
(integer) (optional) Post ID. Default: Current post ID
|
170 |
-
|
|
|
|
|
171 |
|
172 |
|
173 |
== For plugin developers ==
|
@@ -193,5 +209,5 @@ If you find this useful and you if you want to contribute, there are three ways:
|
|
193 |
|
194 |
1. You can [write me](http://lopo.it/contatti/) and submit your bug reports, suggestions and requests for features;
|
195 |
2. If you want to translate it to your language (there are just a few lines of text), you can use the [Launchpad translation project](https://translations.launchpad.net/duplicate-post/), or [contact me](http://lopo.it/contatti/) and I’ll send you the .pot catalogue; your translation could be featured in next releases;
|
196 |
-
3. Using the plugin is free, but if you want you can send me some
|
197 |
|
4 |
Tags: duplicate post, copy, clone
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3
|
7 |
+
Stable tag: 2.1
|
8 |
|
9 |
Clone posts and pages.
|
10 |
|
18 |
|
19 |
3. On the post edit screen, you can click on 'Copy to a new draft' above "Cancel"/"Move to trash".
|
20 |
|
21 |
+
4. While viewing a post as a logged in user, you can click on 'Copy to a new draft' as a dropdown link under "Edi Post" in the admin bar.
|
22 |
+
|
23 |
+
2, 3 and 4 will lead to the edit page for the new draft: change what you want, click on 'Publish' and you're done.
|
24 |
|
25 |
**Pay attention to the new behaviour!** The first way now allows you to clone a post with a single click, speeding up your work if you have many posts to duplicate.
|
26 |
|
27 |
+
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.
|
28 |
|
29 |
In the Options page under Settings it is now possible to choose what to copy:
|
30 |
|
33 |
* the original post/page excerpt
|
34 |
* which taxonomies and custom fields
|
35 |
|
36 |
+
You can also set a prefix (or a suffix) to place before (or after) the title of the cloned post/page, and the roles allowed to clone posts or pages.
|
|
|
|
|
37 |
|
38 |
+
If you want to contribute to translate the plugin in languages other than English, there is a [Launchpad translation project](https://translations.launchpad.net/duplicate-post/) available (you can also send me an e-mail using the form on my website).
|
39 |
|
40 |
+
**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.
|
41 |
|
42 |
Thanks for all the suggestions, bug reports, translations and donations, they're frankly too many to be listed here!
|
43 |
|
60 |
|
61 |
Then try to deactivate and re-activate it, some user have reported that this fixes the problem.
|
62 |
|
63 |
+
Pay also attention to the new "Roles allowed to copy" option: it should convert the former "user level" option to the new standard, but unknown problems may arise. Make sure that your role is enabled.
|
64 |
+
|
65 |
If not, maybe there is some kind of conflict with other plugins: feel free to write me 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).
|
66 |
|
67 |
= Can you add it to the bulk actions in the post/page list? =
|
75 |
1. Here you can copy the post you're editing to a new draft.
|
76 |
2. By clicking on "Clone" the post is cloned immediately. "New draft" leads to the edit screen.
|
77 |
3. The options page.
|
78 |
+
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.
|
79 |
+
5. The admin bar link.
|
80 |
|
81 |
== Upgrade Notice ==
|
82 |
|
83 |
+
= 2.1 =
|
84 |
+
Copy from admin bar + user levels out, roles and capabilities in.
|
85 |
+
|
86 |
= 2.0.2 =
|
87 |
Fixed permalink bug + double choice on posts list
|
88 |
|
100 |
|
101 |
== Changelog ==
|
102 |
|
103 |
+
= 2.1 =
|
104 |
+
* Even more code cleaning (no more custom queries, using WP API)
|
105 |
+
* Term order preserved when copying
|
106 |
+
* Stopped using deprecated User levels, now it uses Roles and Capabilities
|
107 |
+
* 'Copy to a new draft' link in admin bar
|
108 |
+
* duplicate_post_get_original template tag
|
109 |
+
* Settings link in plugin list, 'Donate' and 'Translate' link in option page
|
110 |
+
|
111 |
= 2.0.2 =
|
112 |
* Fixed bug for permalinks
|
113 |
* Two links on posts list: clone immediately or copy to a new draft to edit.
|
163 |
|
164 |
|
165 |
|
166 |
+
== Template tags ==
|
167 |
|
168 |
I have added the template tag `duplicate_post_clone_post_link( $link, $before, $after, $id )`, which behaves just like [edit_post_link()](http://codex.wordpress.org/Function_Reference/edit_post_link).
|
169 |
That means that you can put it in your template (e.g., in single.php or page.php) so you can get a "Clone" link when displaying a post or page.
|
180 |
(string) (optional) Text to put after the link text. Default: None
|
181 |
|
182 |
* *id*
|
183 |
+
(integer) (optional) Post ID. Default: Current post ID
|
184 |
+
|
185 |
+
Another available template tag is `duplicate_post_get_original($id, $output)` which returns the original post, either as a post object, an associative array or a numeric array (depending on the $output parameter), jus as [get_post()](http://codex.wordpress.org/Function_Reference/get_post) does.
|
186 |
+
`duplicate_post_get_original()` relies on the `_dp_original` custom field.
|
187 |
|
188 |
|
189 |
== For plugin developers ==
|
209 |
|
210 |
1. You can [write me](http://lopo.it/contatti/) and submit your bug reports, suggestions and requests for features;
|
211 |
2. If you want to translate it to your language (there are just a few lines of text), you can use the [Launchpad translation project](https://translations.launchpad.net/duplicate-post/), or [contact me](http://lopo.it/contatti/) and I’ll send you the .pot catalogue; your translation could be featured in next releases;
|
212 |
+
3. Using the plugin is free, but if you want you can send me some money with PayPal [here](http://lopo.it/duplicate-post-plugin/)
|
213 |
|
screenshot-3.png
CHANGED
Binary file
|
screenshot-5.png
ADDED
Binary file
|