| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
Plugin Name: Delete Duplicate Posts |
| 5 |
Plugin Script: delete-duplicate-posts.php |
| 6 |
Plugin URI: https://cleverplugins.com |
| 7 |
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. |
| 8 |
Version: 5.1 |
| 9 |
Author: cleverplugins.com |
| 10 |
Author URI: https://cleverplugins.com |
| 11 |
Min WP Version: 4.7 |
| 12 |
Max WP Version: 7.0 |
| 13 |
Text Domain: delete-duplicate-posts |
| 14 |
Domain Path: /languages |
| 15 |
*/ |
| 16 |
namespace DeleteDuplicatePosts; |
| 17 |
|
| 18 |
if ( !defined( 'ABSPATH' ) ) { |
| 19 |
exit; |
| 20 |
} |
| 21 |
define( 'DDP_VERSION', '5.1' ); |
| 22 |
define( 'DDP_PLUGIN_FILE', __FILE__ ); |
| 23 |
define( 'DDP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 24 |
require_once DDP_PLUGIN_DIR . 'vendor/autoload.php'; |
| 25 |
if ( function_exists( '\\DeleteDuplicatePosts\\ddp_fs' ) ) { |
| 26 |
\DeleteDuplicatePosts\ddp_fs()->set_basename( true, DDP_PLUGIN_FILE ); |
| 27 |
} else { |
| 28 |
// DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE `function_exists` CALL ABOVE TO PROPERLY WORK. |
| 29 |
if ( !function_exists( '\\DeleteDuplicatePosts\\ddp_fs' ) ) { |
| 30 |
/** |
| 31 |
* Create a helper function for easy SDK access. |
| 32 |
* |
| 33 |
* @return \Freemius |
| 34 |
*/ |
| 35 |
function ddp_fs() { |
| 36 |
global $ddp_fs; |
| 37 |
if ( !isset( $ddp_fs ) ) { |
| 38 |
// Activate multisite network integration. |
| 39 |
if ( !defined( 'WP_FS__PRODUCT_925_MULTISITE' ) ) { |
| 40 |
define( 'WP_FS__PRODUCT_925_MULTISITE', true ); |
| 41 |
} |
| 42 |
// Include Freemius SDK. |
| 43 |
// SDK is auto-loaded through composer. |
| 44 |
$ddp_fs = fs_dynamic_init( array( |
| 45 |
'id' => '925', |
| 46 |
'slug' => 'delete-duplicate-posts', |
| 47 |
'type' => 'plugin', |
| 48 |
'public_key' => 'pk_0af9f9e83f00e23728a55430a57dd', |
| 49 |
'is_premium' => false, |
| 50 |
'premium_suffix' => 'Pro', |
| 51 |
'has_addons' => false, |
| 52 |
'has_paid_plans' => true, |
| 53 |
'is_org_compliant' => true, |
| 54 |
'menu' => array( |
| 55 |
'slug' => 'delete-duplicate-posts', |
| 56 |
'first-path' => 'tools.php?page=delete-duplicate-posts&welcome-message=true', |
| 57 |
'contact' => false, |
| 58 |
'support' => false, |
| 59 |
'parent' => array( |
| 60 |
'slug' => 'tools.php', |
| 61 |
), |
| 62 |
), |
| 63 |
'is_live' => true, |
| 64 |
) ); |
| 65 |
} |
| 66 |
return $ddp_fs; |
| 67 |
} |
| 68 |
|
| 69 |
// Init Freemius. |
| 70 |
ddp_fs(); |
| 71 |
// Signal that SDK was initiated. |
| 72 |
do_action( 'ddp_fs_loaded' ); |
| 73 |
} |
| 74 |
ddp_fs()->add_action( 'after_uninstall', 'ddp_fs_uninstall_cleanup' ); |
| 75 |
/** |
| 76 |
* Cleans up when uninstalling |
| 77 |
* |
| 78 |
* @return void |
| 79 |
*/ |
| 80 |
function ddp_fs_uninstall_cleanup() { |
| 81 |
global $wpdb; |
| 82 |
$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'ddp_log' ); |
| 83 |
$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'ddp_redirects' ); |
| 84 |
delete_option( 'ddp_deleted_duplicates' ); |
| 85 |
delete_option( 'delete_duplicate_posts_options_v4' ); |
| 86 |
} |
| 87 |
|
| 88 |
new DDP_Plugin(); |
| 89 |
} |