Version Description
- Fixed bugs introduced with updating to WordPress 4.9.1 - Thank you to all who reported the problem.
Download this release
Release Info
| Developer | lkoudal |
| Plugin | |
| Version | 4.1.9.3 |
| Comparing to | |
| See all releases | |
Code changes from version 4.1.9.1 to 4.1.9.3
- delete-duplicate-posts.php +70 -59
- readme.txt +9 -3
delete-duplicate-posts.php
CHANGED
|
@@ -4,16 +4,22 @@ Plugin Name: Delete Duplicate Posts
|
|
| 4 |
Plugin Script: delete-duplicate-posts.php
|
| 5 |
Plugin URI: https://cleverplugins.com
|
| 6 |
Description: Remove duplicate blogposts on your blog! Searches and removes duplicate posts and their post meta tags. You can delete posts, pages and other Custom Post Types enabled on your website.
|
| 7 |
-
Version: 4.1.9.
|
| 8 |
Author: cleverplugins.com
|
| 9 |
Author URI: https://cleverplugins.com
|
| 10 |
Min WP Version: 4.3
|
| 11 |
-
Max WP Version: 4.
|
| 12 |
Text Domain: delete-duplicate-posts
|
| 13 |
Domain Path: /languages
|
| 14 |
|
| 15 |
== Changelog ==
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
= 4.1.9.1 =
|
| 18 |
* Fix missing 3rd party scripts.
|
| 19 |
|
|
@@ -81,33 +87,33 @@ Domain Path: /languages
|
|
| 81 |
|
| 82 |
// Create a helper function for easy SDK access.
|
| 83 |
function ddp_fs() {
|
| 84 |
-
|
| 85 |
|
| 86 |
-
|
| 87 |
// Include Freemius SDK.
|
| 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 |
// Init Freemius.
|
|
@@ -189,7 +195,7 @@ if (!class_exists('delete_duplicate_posts')) {
|
|
| 189 |
if (!$limit<>'') $limit=10; //defaults to 10!
|
| 190 |
if ($manualrun=='1') $limit=9999;
|
| 191 |
$order=$this->options['ddp_keep'];
|
| 192 |
-
if (($order<>'oldest')
|
| 193 |
$this->options['ddp_keep']='oldest';
|
| 194 |
}
|
| 195 |
|
|
@@ -213,15 +219,15 @@ if (!class_exists('delete_duplicate_posts')) {
|
|
| 213 |
$query="select bad_rows.ID, bad_rows.post_title, post_type
|
| 214 |
from $table_name as bad_rows
|
| 215 |
inner join (
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
) as good_rows on good_rows.post_title = bad_rows.post_title
|
| 226 |
and good_rows.save_this_post_id <> bad_rows.id
|
| 227 |
and (bad_rows.post_status='publish' OR bad_rows.post_status='draft')
|
|
@@ -423,17 +429,18 @@ if (!class_exists('delete_duplicate_posts')) {
|
|
| 423 |
|
| 424 |
if (isset($_POST['ddp_pts'])) {
|
| 425 |
$optionArray = $_POST['ddp_pts'];
|
|
|
|
| 426 |
for ($i=0; $i<count($optionArray); $i++) {
|
| 427 |
-
$posttypes[] = $optionArray[$i];
|
| 428 |
}
|
| 429 |
}
|
| 430 |
|
| 431 |
$this->options['ddp_enabled'] = ($_POST['ddp_enabled']=='on')?true:false;
|
| 432 |
$this->options['ddp_statusmail'] = ( (isset($_POST['ddp_statusmail'])) && ($_POST['ddp_statusmail']=='on'))?true:false;
|
| 433 |
-
$this->options['ddp_schedule'] =
|
| 434 |
-
$this->options['ddp_keep'] =
|
| 435 |
-
$this->options['ddp_pts'] =
|
| 436 |
-
$this->options['ddp_limit'] = $_POST['ddp_limit'];
|
| 437 |
if (isset($this->options['ddp_enabled'])) {
|
| 438 |
wp_clear_scheduled_hook('ddp_cron');
|
| 439 |
$interval = $this->options['ddp_schedule'];
|
|
@@ -441,6 +448,7 @@ if (!class_exists('delete_duplicate_posts')) {
|
|
| 441 |
wp_schedule_event(time(), $interval, 'ddp_cron');
|
| 442 |
$nextscheduled = wp_next_scheduled('ddp_cron');
|
| 443 |
}
|
|
|
|
| 444 |
$this->saveAdminOptions();
|
| 445 |
echo '<div class="updated fade"><p>'.__('Your changes were successfully saved.','delete-duplicate-posts').'</p></div>';
|
| 446 |
}
|
|
@@ -467,13 +475,14 @@ if (!class_exists('delete_duplicate_posts')) {
|
|
| 467 |
<div style="float:right; max-width: 300px;">
|
| 468 |
<a href="https://cleverplugins.com" target="_blank"><img src='<?php echo plugin_dir_url(__FILE__); ?>cleverpluginslogo.png' height="54" width="300" alt="<?php _e('Visit cleverplugins.com','delete-duplicate-posts'); ?>"></a>
|
| 469 |
<p>Have you checked out our free SEO Booster plugin? <a href="https://wordpress.org/plugins/seo-booster/" target="_blank">wordpress.org/plugins/seo-booster/</a><br/>
|
|
|
|
| 470 |
Or <a href="<?php echo admin_url('plugin-install.php?s=seo+booster+cleverplugins.com&tab=search&type=term'); ?>" target="_blank">click here to install now</a></p>
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
if (!$nextscheduled<>'') { // plugin active, but the cron needs to be activated also..
|
| 478 |
wp_clear_scheduled_hook('ddp_cron');
|
| 479 |
$interval = $this->options['ddp_schedule'];
|
|
@@ -488,7 +497,8 @@ if (!class_exists('delete_duplicate_posts')) {
|
|
| 488 |
|
| 489 |
// get custom post types and loop for queary.
|
| 490 |
$ddp_pts_arr = $this->options['ddp_pts'];
|
| 491 |
-
|
|
|
|
| 492 |
$ddp_pts = '';
|
| 493 |
foreach ($ddp_pts_arr as $key => $dpa ) {
|
| 494 |
$ddp_pts .= '"'.$dpa.'",';
|
|
@@ -501,7 +511,8 @@ if (!class_exists('delete_duplicate_posts')) {
|
|
| 501 |
$ddp_pts = rtrim($ddp_pts,',' );
|
| 502 |
|
| 503 |
$order=$this->options['ddp_keep'];
|
| 504 |
-
|
|
|
|
| 505 |
$this->options['ddp_keep']='oldest';
|
| 506 |
}
|
| 507 |
|
|
@@ -514,15 +525,15 @@ if (!class_exists('delete_duplicate_posts')) {
|
|
| 514 |
$query="select bad_rows.ID, bad_rows.post_title, post_type
|
| 515 |
from $table_name as bad_rows
|
| 516 |
inner join (
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
) as good_rows on good_rows.post_title = bad_rows.post_title
|
| 527 |
and good_rows.save_this_post_id <> bad_rows.id
|
| 528 |
and (bad_rows.post_status='publish' OR bad_rows.post_status='draft')
|
| 4 |
Plugin Script: delete-duplicate-posts.php
|
| 5 |
Plugin URI: https://cleverplugins.com
|
| 6 |
Description: Remove duplicate blogposts on your blog! Searches and removes duplicate posts and their post meta tags. You can delete posts, pages and other Custom Post Types enabled on your website.
|
| 7 |
+
Version: 4.1.9.3
|
| 8 |
Author: cleverplugins.com
|
| 9 |
Author URI: https://cleverplugins.com
|
| 10 |
Min WP Version: 4.3
|
| 11 |
+
Max WP Version: 4.9.1
|
| 12 |
Text Domain: delete-duplicate-posts
|
| 13 |
Domain Path: /languages
|
| 14 |
|
| 15 |
== Changelog ==
|
| 16 |
|
| 17 |
+
= 4.1.9.3 =
|
| 18 |
+
* Fixed bugs introduced with updating to WordPress 4.9.1 - Thank you to all who reported the problem.
|
| 19 |
+
|
| 20 |
+
= 4.1.9.2 =
|
| 21 |
+
* Fixed esc_sql() for WordPress 4.8.3
|
| 22 |
+
|
| 23 |
= 4.1.9.1 =
|
| 24 |
* Fix missing 3rd party scripts.
|
| 25 |
|
| 87 |
|
| 88 |
// Create a helper function for easy SDK access.
|
| 89 |
function ddp_fs() {
|
| 90 |
+
global $ddp_fs;
|
| 91 |
|
| 92 |
+
if ( ! isset( $ddp_fs ) ) {
|
| 93 |
// Include Freemius SDK.
|
| 94 |
+
require_once dirname(__FILE__) . '/freemius/start.php';
|
| 95 |
+
|
| 96 |
+
$ddp_fs = fs_dynamic_init( array(
|
| 97 |
+
'id' => '925',
|
| 98 |
+
'slug' => 'delete-duplicate-posts',
|
| 99 |
+
'type' => 'plugin',
|
| 100 |
+
'public_key' => 'pk_0af9f9e83f00e23728a55430a57dd',
|
| 101 |
+
'is_premium' => false,
|
| 102 |
+
'has_addons' => false,
|
| 103 |
+
'has_paid_plans' => false,
|
| 104 |
+
'menu' => array(
|
| 105 |
+
'slug' => 'delete-duplicate-posts.php',
|
| 106 |
+
'account' => true,
|
| 107 |
+
'contact' => false,
|
| 108 |
+
'support' => false,
|
| 109 |
+
'parent' => array(
|
| 110 |
+
'slug' => 'tools.php',
|
| 111 |
+
),
|
| 112 |
+
),
|
| 113 |
+
) );
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
return $ddp_fs;
|
| 117 |
}
|
| 118 |
|
| 119 |
// Init Freemius.
|
| 195 |
if (!$limit<>'') $limit=10; //defaults to 10!
|
| 196 |
if ($manualrun=='1') $limit=9999;
|
| 197 |
$order=$this->options['ddp_keep'];
|
| 198 |
+
if (($order<>'oldest') AND ($order<>'latest')) { // verify default value has been set.
|
| 199 |
$this->options['ddp_keep']='oldest';
|
| 200 |
}
|
| 201 |
|
| 219 |
$query="select bad_rows.ID, bad_rows.post_title, post_type
|
| 220 |
from $table_name as bad_rows
|
| 221 |
inner join (
|
| 222 |
+
select post_title,id, ".$minmax." as save_this_post_id
|
| 223 |
+
from $table_name
|
| 224 |
+
WHERE (
|
| 225 |
+
`post_status` = 'publish'
|
| 226 |
+
AND
|
| 227 |
+
`post_type` in (".$ddp_pts.")
|
| 228 |
+
)
|
| 229 |
+
group by post_title
|
| 230 |
+
having count(*) > 1
|
| 231 |
) as good_rows on good_rows.post_title = bad_rows.post_title
|
| 232 |
and good_rows.save_this_post_id <> bad_rows.id
|
| 233 |
and (bad_rows.post_status='publish' OR bad_rows.post_status='draft')
|
| 429 |
|
| 430 |
if (isset($_POST['ddp_pts'])) {
|
| 431 |
$optionArray = $_POST['ddp_pts'];
|
| 432 |
+
//$posttypes = $_POST['ddp_pts'];
|
| 433 |
for ($i=0; $i<count($optionArray); $i++) {
|
| 434 |
+
$posttypes[] = sanitize_text_field($optionArray[$i]);
|
| 435 |
}
|
| 436 |
}
|
| 437 |
|
| 438 |
$this->options['ddp_enabled'] = ($_POST['ddp_enabled']=='on')?true:false;
|
| 439 |
$this->options['ddp_statusmail'] = ( (isset($_POST['ddp_statusmail'])) && ($_POST['ddp_statusmail']=='on'))?true:false;
|
| 440 |
+
$this->options['ddp_schedule'] = sanitize_text_field($_POST['ddp_schedule']);
|
| 441 |
+
$this->options['ddp_keep'] = sanitize_text_field($_POST['ddp_keep']);
|
| 442 |
+
$this->options['ddp_pts'] = $posttypes;
|
| 443 |
+
$this->options['ddp_limit'] = sanitize_text_field($_POST['ddp_limit']);
|
| 444 |
if (isset($this->options['ddp_enabled'])) {
|
| 445 |
wp_clear_scheduled_hook('ddp_cron');
|
| 446 |
$interval = $this->options['ddp_schedule'];
|
| 448 |
wp_schedule_event(time(), $interval, 'ddp_cron');
|
| 449 |
$nextscheduled = wp_next_scheduled('ddp_cron');
|
| 450 |
}
|
| 451 |
+
|
| 452 |
$this->saveAdminOptions();
|
| 453 |
echo '<div class="updated fade"><p>'.__('Your changes were successfully saved.','delete-duplicate-posts').'</p></div>';
|
| 454 |
}
|
| 475 |
<div style="float:right; max-width: 300px;">
|
| 476 |
<a href="https://cleverplugins.com" target="_blank"><img src='<?php echo plugin_dir_url(__FILE__); ?>cleverpluginslogo.png' height="54" width="300" alt="<?php _e('Visit cleverplugins.com','delete-duplicate-posts'); ?>"></a>
|
| 477 |
<p>Have you checked out our free SEO Booster plugin? <a href="https://wordpress.org/plugins/seo-booster/" target="_blank">wordpress.org/plugins/seo-booster/</a><br/>
|
| 478 |
+
<p>Read more on <a href="https://cleverplugins.com/">cleverplugins.com</a><br/>
|
| 479 |
Or <a href="<?php echo admin_url('plugin-install.php?s=seo+booster+cleverplugins.com&tab=search&type=term'); ?>" target="_blank">click here to install now</a></p>
|
| 480 |
+
</div>
|
| 481 |
+
<h2>Delete Duplicate Posts v <?php echo $version; ?></h2>
|
| 482 |
+
<div id="dashboard">
|
| 483 |
+
<?php
|
| 484 |
+
if ($this->options['ddp_enabled'] ) {
|
| 485 |
+
$nextscheduled = wp_next_scheduled('ddp_cron');
|
| 486 |
if (!$nextscheduled<>'') { // plugin active, but the cron needs to be activated also..
|
| 487 |
wp_clear_scheduled_hook('ddp_cron');
|
| 488 |
$interval = $this->options['ddp_schedule'];
|
| 497 |
|
| 498 |
// get custom post types and loop for queary.
|
| 499 |
$ddp_pts_arr = $this->options['ddp_pts'];
|
| 500 |
+
|
| 501 |
+
if ((isset($ddp_pts_arr)) && (is_array($ddp_pts_arr)) ) {
|
| 502 |
$ddp_pts = '';
|
| 503 |
foreach ($ddp_pts_arr as $key => $dpa ) {
|
| 504 |
$ddp_pts .= '"'.$dpa.'",';
|
| 511 |
$ddp_pts = rtrim($ddp_pts,',' );
|
| 512 |
|
| 513 |
$order=$this->options['ddp_keep'];
|
| 514 |
+
|
| 515 |
+
if (($order<>'oldest') AND ($order<>'latest')) { // verify default value has been set.
|
| 516 |
$this->options['ddp_keep']='oldest';
|
| 517 |
}
|
| 518 |
|
| 525 |
$query="select bad_rows.ID, bad_rows.post_title, post_type
|
| 526 |
from $table_name as bad_rows
|
| 527 |
inner join (
|
| 528 |
+
select post_title,id, ".$minmax." as save_this_post_id
|
| 529 |
+
from $table_name
|
| 530 |
+
WHERE (
|
| 531 |
+
`post_status` = 'publish'
|
| 532 |
+
AND
|
| 533 |
+
`post_type` in (".$ddp_pts.")
|
| 534 |
+
)
|
| 535 |
+
group by post_title
|
| 536 |
+
having count(*) > 1
|
| 537 |
) as good_rows on good_rows.post_title = bad_rows.post_title
|
| 538 |
and good_rows.save_this_post_id <> bad_rows.id
|
| 539 |
and (bad_rows.post_status='publish' OR bad_rows.post_status='draft')
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: lkoudal,freemius
|
|
| 3 |
Tags: delete duplicate posts, delete duplicate,
|
| 4 |
Donate link: https://cleverplugins.com
|
| 5 |
Requires at least: 4.3
|
| 6 |
-
Tested up to: 4.
|
| 7 |
-
Stable tag: 4.1.9.
|
| 8 |
Requires PHP: 5.6
|
| 9 |
|
| 10 |
|
|
@@ -38,6 +38,12 @@ You should restore the backup you took of your website before you ran this tool.
|
|
| 38 |
|
| 39 |
== Changelog ==
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
= 4.1.9.1 =
|
| 42 |
* Fix missing 3rd party scripts.
|
| 43 |
|
|
@@ -152,4 +158,4 @@ You should restore the backup you took of your website before you ran this tool.
|
|
| 152 |
* First release
|
| 153 |
|
| 154 |
== Upgrade Notice ==
|
| 155 |
-
|
| 3 |
Tags: delete duplicate posts, delete duplicate,
|
| 4 |
Donate link: https://cleverplugins.com
|
| 5 |
Requires at least: 4.3
|
| 6 |
+
Tested up to: 4.9.1
|
| 7 |
+
Stable tag: 4.1.9.3
|
| 8 |
Requires PHP: 5.6
|
| 9 |
|
| 10 |
|
| 38 |
|
| 39 |
== Changelog ==
|
| 40 |
|
| 41 |
+
= 4.1.9.3 =
|
| 42 |
+
* Fixed bugs introduced with updating to WordPress 4.9.1 - Thank you to all who reported the problem.
|
| 43 |
+
|
| 44 |
+
= 4.1.9.2 =
|
| 45 |
+
* Fixed esc_sql() for WordPress 4.8.3
|
| 46 |
+
|
| 47 |
= 4.1.9.1 =
|
| 48 |
* Fix missing 3rd party scripts.
|
| 49 |
|
| 158 |
* First release
|
| 159 |
|
| 160 |
== Upgrade Notice ==
|
| 161 |
+
4.1.9.3 Fixes major bug introduced with WordPress 4.9 - Update now!
|
