Version Description
Download this release
Release Info
| Developer | lopo |
| Plugin | |
| Version | 0.4 |
| Comparing to | |
| See all releases | |
Code changes from version 0.3 to 0.4
- duplicate-post.php +12 -4
- make_duplicate_post.php +2 -2
- readme.txt +2 -2
- save_as_new_page.php +3 -3
- save_as_new_post.php +2 -2
duplicate-post.php
CHANGED
|
@@ -3,12 +3,12 @@
|
|
| 3 |
Plugin Name: Duplicate Post
|
| 4 |
Plugin URI: http://www.lopo.it/duplicate-post.tar.gz
|
| 5 |
Description: Create a copy of a post.
|
| 6 |
-
Version: 0.
|
| 7 |
Author: Enrico Battocchi
|
| 8 |
Author URI: http://www.lopo.it
|
| 9 |
*/
|
| 10 |
|
| 11 |
-
/* Copyright
|
| 12 |
|
| 13 |
This program is free software; you can redistribute it and/or modify
|
| 14 |
it under the terms of the GNU General Public License as published by
|
|
@@ -330,7 +330,11 @@ function duplicate_post_js_escape($text) {
|
|
| 330 |
*/
|
| 331 |
function duplicate_post_get_page($id) {
|
| 332 |
global $wpdb;
|
| 333 |
-
$post = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ID=$id");
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
return $post[0];
|
| 335 |
}
|
| 336 |
|
|
@@ -339,7 +343,11 @@ function duplicate_post_get_page($id) {
|
|
| 339 |
*/
|
| 340 |
function duplicate_post_get_post($id) {
|
| 341 |
global $wpdb;
|
| 342 |
-
$post = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ID=$id");
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
return $post[0];
|
| 344 |
}
|
| 345 |
|
| 3 |
Plugin Name: Duplicate Post
|
| 4 |
Plugin URI: http://www.lopo.it/duplicate-post.tar.gz
|
| 5 |
Description: Create a copy of a post.
|
| 6 |
+
Version: 0.4
|
| 7 |
Author: Enrico Battocchi
|
| 8 |
Author URI: http://www.lopo.it
|
| 9 |
*/
|
| 10 |
|
| 11 |
+
/* Copyright 2008 Enrico Battocchi (email : enrico.battocchi@gmail.com)
|
| 12 |
|
| 13 |
This program is free software; you can redistribute it and/or modify
|
| 14 |
it under the terms of the GNU General Public License as published by
|
| 330 |
*/
|
| 331 |
function duplicate_post_get_page($id) {
|
| 332 |
global $wpdb;
|
| 333 |
+
$post = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ID=$id");
|
| 334 |
+
if ($post->post_type == "revision"){
|
| 335 |
+
$id = $post->post_parent;
|
| 336 |
+
$post = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ID=$id");
|
| 337 |
+
}
|
| 338 |
return $post[0];
|
| 339 |
}
|
| 340 |
|
| 343 |
*/
|
| 344 |
function duplicate_post_get_post($id) {
|
| 345 |
global $wpdb;
|
| 346 |
+
$post = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ID=$id");
|
| 347 |
+
if ($post->post_type == "revision"){
|
| 348 |
+
$id = $post->post_parent;
|
| 349 |
+
$post = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ID=$id");
|
| 350 |
+
}
|
| 351 |
return $post[0];
|
| 352 |
}
|
| 353 |
|
make_duplicate_post.php
CHANGED
|
@@ -6,11 +6,11 @@
|
|
| 6 |
</div>
|
| 7 |
<?php
|
| 8 |
} else {
|
| 9 |
-
// Get the original
|
| 10 |
$id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
|
| 11 |
$post = duplicate_post_get_post($id);
|
| 12 |
|
| 13 |
-
// Copy the post and insert it
|
| 14 |
if (isset($post) && $post!=null) {
|
| 15 |
$new_id = duplicate_post_create_duplicate_from_post($post);
|
| 16 |
|
| 6 |
</div>
|
| 7 |
<?php
|
| 8 |
} else {
|
| 9 |
+
// Get the original post
|
| 10 |
$id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
|
| 11 |
$post = duplicate_post_get_post($id);
|
| 12 |
|
| 13 |
+
// Copy the post and insert it
|
| 14 |
if (isset($post) && $post!=null) {
|
| 15 |
$new_id = duplicate_post_create_duplicate_from_post($post);
|
| 16 |
|
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
Contributors: lopo
|
| 3 |
Tags: duplicate, post
|
| 4 |
Requires at least: 2.3
|
| 5 |
-
Tested up to: 2.3
|
| 6 |
-
Stable tag: 0.
|
| 7 |
|
| 8 |
Create a copy of a post.
|
| 9 |
|
| 2 |
Contributors: lopo
|
| 3 |
Tags: duplicate, post
|
| 4 |
Requires at least: 2.3
|
| 5 |
+
Tested up to: 2.6.3
|
| 6 |
+
Stable tag: 0.4
|
| 7 |
|
| 8 |
Create a copy of a post.
|
| 9 |
|
save_as_new_page.php
CHANGED
|
@@ -6,15 +6,15 @@
|
|
| 6 |
</div>
|
| 7 |
<?php
|
| 8 |
} else {
|
| 9 |
-
// Get the original
|
| 10 |
$id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
|
| 11 |
$post = duplicate_post_get_page($id);
|
| 12 |
|
| 13 |
-
// Copy the
|
| 14 |
if (isset($post) && $post!=null) {
|
| 15 |
$new_id = duplicate_post_create_duplicate_from_page($post);
|
| 16 |
|
| 17 |
-
// Show the
|
| 18 |
echo '<meta content="0; URL=page.php?action=edit&post=' . $new_id . '" http-equiv="Refresh" />';
|
| 19 |
exit;
|
| 20 |
} else {
|
| 6 |
</div>
|
| 7 |
<?php
|
| 8 |
} else {
|
| 9 |
+
// Get the original page
|
| 10 |
$id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
|
| 11 |
$post = duplicate_post_get_page($id);
|
| 12 |
|
| 13 |
+
// Copy the page and insert it
|
| 14 |
if (isset($post) && $post!=null) {
|
| 15 |
$new_id = duplicate_post_create_duplicate_from_page($post);
|
| 16 |
|
| 17 |
+
// Show the page edit
|
| 18 |
echo '<meta content="0; URL=page.php?action=edit&post=' . $new_id . '" http-equiv="Refresh" />';
|
| 19 |
exit;
|
| 20 |
} else {
|
save_as_new_post.php
CHANGED
|
@@ -6,11 +6,11 @@
|
|
| 6 |
</div>
|
| 7 |
<?php
|
| 8 |
} else {
|
| 9 |
-
// Get the original
|
| 10 |
$id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
|
| 11 |
$post = duplicate_post_get_post($id);
|
| 12 |
|
| 13 |
-
// Copy the post and insert it
|
| 14 |
if (isset($post) && $post!=null) {
|
| 15 |
$new_id = duplicate_post_create_duplicate_from_post($post);
|
| 16 |
|
| 6 |
</div>
|
| 7 |
<?php
|
| 8 |
} else {
|
| 9 |
+
// Get the original post
|
| 10 |
$id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
|
| 11 |
$post = duplicate_post_get_post($id);
|
| 12 |
|
| 13 |
+
// Copy the post and insert it
|
| 14 |
if (isset($post) && $post!=null) {
|
| 15 |
$new_id = duplicate_post_create_duplicate_from_post($post);
|
| 16 |
|
